@nmshd/transport 2.1.1 → 2.1.3

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.
@@ -15,11 +15,11 @@ exports.buildInformation = void 0;
15
15
  const ts_serval_1 = __webpack_require__(/*! @js-soft/ts-serval */ "@js-soft/ts-serval");
16
16
  const crypto_1 = __webpack_require__(/*! @nmshd/crypto */ "@nmshd/crypto");
17
17
  exports.buildInformation = {
18
- version: "2.1.1",
19
- build: "60",
20
- date: "2023-09-11T14:55:13+00:00",
21
- commit: "d46b16ce43f76f0db91c2df01455a7f8ac3183e0",
22
- dependencies: {"@js-soft/docdb-access-abstractions":"1.0.1","@js-soft/logging-abstractions":"1.0.0","@js-soft/simple-logger":"1.0.2","@js-soft/ts-utils":"2.3.1","axios":"^1.5.0","deep-equal":"^2.2.2","fast-json-patch":"^3.1.1","form-data":"^4.0.0","json-stringify-safe":"^5.0.1","lodash":"^4.17.21","luxon":"^3.4.3","qs":"^6.11.2","reflect-metadata":"^0.1.13","ts-simple-nameof":"^1.3.1","uuid":"^9.0.0"},
18
+ version: "2.1.3",
19
+ build: "62",
20
+ date: "2023-11-13T12:38:14+00:00",
21
+ commit: "c24f8b1360b20847ca808d5bae2ed63654d126c6",
22
+ dependencies: {"@js-soft/docdb-access-abstractions":"1.0.1","@js-soft/logging-abstractions":"1.0.0","@js-soft/simple-logger":"1.0.3","@js-soft/ts-utils":"2.3.1","axios":"^1.6.1","fast-json-patch":"^3.1.1","form-data":"^4.0.0","json-stringify-safe":"^5.0.1","lodash":"^4.17.21","luxon":"^3.4.4","qs":"^6.11.2","reflect-metadata":"^0.1.13","ts-simple-nameof":"^1.3.1","uuid":"^9.0.1"},
23
23
  libraries: {
24
24
  crypto: crypto_1.buildInformation,
25
25
  serval: ts_serval_1.buildInformation
@@ -1618,7 +1618,7 @@ class RESTClient {
1618
1618
  return ClientResult_1.ClientResult.ok({}, platformParameters);
1619
1619
  }
1620
1620
  if (response.status === 404) {
1621
- const error = new RequestError_1.RequestError(method, path, platformParameters, "error.transport.request.notFound", "The requested entity was not found. Make sure the ID exists and the record is not expired.", "", 404);
1621
+ const error = new RequestError_1.RequestError(method, path, platformParameters, "error.transport.request.notFound", "An http request returned an unspecific 404 (Not Found) error, which is usually the case if the Backbone is not reachable. This could be a temporary problem, or a network, gateway, firewall or configuration issue.", "", 404);
1622
1622
  this._logger.debug(error);
1623
1623
  return ClientResult_1.ClientResult.fail(error, platformParameters);
1624
1624
  }
@@ -12588,6 +12588,10 @@ const typescript_logging_1 = __webpack_require__(/*! typescript-logging */ "./no
12588
12588
  const typescript_logging_log4ts_style_1 = __webpack_require__(/*! typescript-logging-log4ts-style */ "./node_modules/typescript-logging-log4ts-style/dist/bundle/typescript-logging-log4ts.esm.js");
12589
12589
  const SimpleLogger_1 = __webpack_require__(/*! ./SimpleLogger */ "./node_modules/@js-soft/simple-logger/dist/SimpleLogger.js");
12590
12590
  class SimpleLoggerFactory {
12591
+ getLogger(name) {
12592
+ const logger = this.provider.getLogger(name instanceof Function ? name.name : name);
12593
+ return new SimpleLogger_1.SimpleLogger(logger);
12594
+ }
12591
12595
  constructor(logLevel = typescript_logging_1.LogLevel.Warn, factoryName = Math.random().toString(36).substring(7)) {
12592
12596
  this.provider = typescript_logging_log4ts_style_1.Log4TSProvider.createProvider(factoryName, {
12593
12597
  groups: [
@@ -12598,10 +12602,6 @@ class SimpleLoggerFactory {
12598
12602
  ]
12599
12603
  });
12600
12604
  }
12601
- getLogger(name) {
12602
- const logger = this.provider.getLogger(name instanceof Function ? name.name : name);
12603
- return new SimpleLogger_1.SimpleLogger(logger);
12604
- }
12605
12605
  }
12606
12606
  exports.SimpleLoggerFactory = SimpleLoggerFactory;
12607
12607
  //# sourceMappingURL=SimpleLoggerFactory.js.map
@@ -13232,12 +13232,13 @@ module.exports = function callBoundIntrinsic(name, allowMissing) {
13232
13232
 
13233
13233
  var bind = __webpack_require__(/*! function-bind */ "./node_modules/function-bind/index.js");
13234
13234
  var GetIntrinsic = __webpack_require__(/*! get-intrinsic */ "./node_modules/get-intrinsic/index.js");
13235
+ var setFunctionLength = __webpack_require__(/*! set-function-length */ "./node_modules/set-function-length/index.js");
13235
13236
 
13237
+ var $TypeError = GetIntrinsic('%TypeError%');
13236
13238
  var $apply = GetIntrinsic('%Function.prototype.apply%');
13237
13239
  var $call = GetIntrinsic('%Function.prototype.call%');
13238
13240
  var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply);
13239
13241
 
13240
- var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true);
13241
13242
  var $defineProperty = GetIntrinsic('%Object.defineProperty%', true);
13242
13243
  var $max = GetIntrinsic('%Math.max%');
13243
13244
 
@@ -13251,19 +13252,15 @@ if ($defineProperty) {
13251
13252
  }
13252
13253
 
13253
13254
  module.exports = function callBind(originalFunction) {
13254
- var func = $reflectApply(bind, $call, arguments);
13255
- if ($gOPD && $defineProperty) {
13256
- var desc = $gOPD(func, 'length');
13257
- if (desc.configurable) {
13258
- // original length, plus the receiver, minus any additional arguments (after the receiver)
13259
- $defineProperty(
13260
- func,
13261
- 'length',
13262
- { value: 1 + $max(0, originalFunction.length - (arguments.length - 1)) }
13263
- );
13264
- }
13255
+ if (typeof originalFunction !== 'function') {
13256
+ throw new $TypeError('a function is required');
13265
13257
  }
13266
- return func;
13258
+ var func = $reflectApply(bind, $call, arguments);
13259
+ return setFunctionLength(
13260
+ func,
13261
+ 1 + $max(0, originalFunction.length - (arguments.length - 1)),
13262
+ true
13263
+ );
13267
13264
  };
13268
13265
 
13269
13266
  var applyBind = function applyBind() {
@@ -13277,6 +13274,85 @@ if ($defineProperty) {
13277
13274
  }
13278
13275
 
13279
13276
 
13277
+ /***/ }),
13278
+
13279
+ /***/ "./node_modules/define-data-property/index.js":
13280
+ /*!****************************************************!*\
13281
+ !*** ./node_modules/define-data-property/index.js ***!
13282
+ \****************************************************/
13283
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
13284
+
13285
+ "use strict";
13286
+
13287
+
13288
+ var hasPropertyDescriptors = __webpack_require__(/*! has-property-descriptors */ "./node_modules/has-property-descriptors/index.js")();
13289
+
13290
+ var GetIntrinsic = __webpack_require__(/*! get-intrinsic */ "./node_modules/get-intrinsic/index.js");
13291
+
13292
+ var $defineProperty = hasPropertyDescriptors && GetIntrinsic('%Object.defineProperty%', true);
13293
+ if ($defineProperty) {
13294
+ try {
13295
+ $defineProperty({}, 'a', { value: 1 });
13296
+ } catch (e) {
13297
+ // IE 8 has a broken defineProperty
13298
+ $defineProperty = false;
13299
+ }
13300
+ }
13301
+
13302
+ var $SyntaxError = GetIntrinsic('%SyntaxError%');
13303
+ var $TypeError = GetIntrinsic('%TypeError%');
13304
+
13305
+ var gopd = __webpack_require__(/*! gopd */ "./node_modules/gopd/index.js");
13306
+
13307
+ /** @type {(obj: Record<PropertyKey, unknown>, property: PropertyKey, value: unknown, nonEnumerable?: boolean | null, nonWritable?: boolean | null, nonConfigurable?: boolean | null, loose?: boolean) => void} */
13308
+ module.exports = function defineDataProperty(
13309
+ obj,
13310
+ property,
13311
+ value
13312
+ ) {
13313
+ if (!obj || (typeof obj !== 'object' && typeof obj !== 'function')) {
13314
+ throw new $TypeError('`obj` must be an object or a function`');
13315
+ }
13316
+ if (typeof property !== 'string' && typeof property !== 'symbol') {
13317
+ throw new $TypeError('`property` must be a string or a symbol`');
13318
+ }
13319
+ if (arguments.length > 3 && typeof arguments[3] !== 'boolean' && arguments[3] !== null) {
13320
+ throw new $TypeError('`nonEnumerable`, if provided, must be a boolean or null');
13321
+ }
13322
+ if (arguments.length > 4 && typeof arguments[4] !== 'boolean' && arguments[4] !== null) {
13323
+ throw new $TypeError('`nonWritable`, if provided, must be a boolean or null');
13324
+ }
13325
+ if (arguments.length > 5 && typeof arguments[5] !== 'boolean' && arguments[5] !== null) {
13326
+ throw new $TypeError('`nonConfigurable`, if provided, must be a boolean or null');
13327
+ }
13328
+ if (arguments.length > 6 && typeof arguments[6] !== 'boolean') {
13329
+ throw new $TypeError('`loose`, if provided, must be a boolean');
13330
+ }
13331
+
13332
+ var nonEnumerable = arguments.length > 3 ? arguments[3] : null;
13333
+ var nonWritable = arguments.length > 4 ? arguments[4] : null;
13334
+ var nonConfigurable = arguments.length > 5 ? arguments[5] : null;
13335
+ var loose = arguments.length > 6 ? arguments[6] : false;
13336
+
13337
+ /* @type {false | TypedPropertyDescriptor<unknown>} */
13338
+ var desc = !!gopd && gopd(obj, property);
13339
+
13340
+ if ($defineProperty) {
13341
+ $defineProperty(obj, property, {
13342
+ configurable: nonConfigurable === null && desc ? desc.configurable : !nonConfigurable,
13343
+ enumerable: nonEnumerable === null && desc ? desc.enumerable : !nonEnumerable,
13344
+ value: value,
13345
+ writable: nonWritable === null && desc ? desc.writable : !nonWritable
13346
+ });
13347
+ } else if (loose || (!nonEnumerable && !nonWritable && !nonConfigurable)) {
13348
+ // must fall back to [[Set]], and was not explicitly asked to make non-enumerable, non-writable, or non-configurable
13349
+ obj[property] = value; // eslint-disable-line no-param-reassign
13350
+ } else {
13351
+ throw new $SyntaxError('This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.');
13352
+ }
13353
+ };
13354
+
13355
+
13280
13356
  /***/ }),
13281
13357
 
13282
13358
  /***/ "./node_modules/eventemitter2/lib/eventemitter2.js":
@@ -14935,43 +15011,75 @@ module.exports = typeof self == 'object' ? self.FormData : window.FormData;
14935
15011
  /* eslint no-invalid-this: 1 */
14936
15012
 
14937
15013
  var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';
14938
- var slice = Array.prototype.slice;
14939
15014
  var toStr = Object.prototype.toString;
15015
+ var max = Math.max;
14940
15016
  var funcType = '[object Function]';
14941
15017
 
15018
+ var concatty = function concatty(a, b) {
15019
+ var arr = [];
15020
+
15021
+ for (var i = 0; i < a.length; i += 1) {
15022
+ arr[i] = a[i];
15023
+ }
15024
+ for (var j = 0; j < b.length; j += 1) {
15025
+ arr[j + a.length] = b[j];
15026
+ }
15027
+
15028
+ return arr;
15029
+ };
15030
+
15031
+ var slicy = function slicy(arrLike, offset) {
15032
+ var arr = [];
15033
+ for (var i = offset || 0, j = 0; i < arrLike.length; i += 1, j += 1) {
15034
+ arr[j] = arrLike[i];
15035
+ }
15036
+ return arr;
15037
+ };
15038
+
15039
+ var joiny = function (arr, joiner) {
15040
+ var str = '';
15041
+ for (var i = 0; i < arr.length; i += 1) {
15042
+ str += arr[i];
15043
+ if (i + 1 < arr.length) {
15044
+ str += joiner;
15045
+ }
15046
+ }
15047
+ return str;
15048
+ };
15049
+
14942
15050
  module.exports = function bind(that) {
14943
15051
  var target = this;
14944
- if (typeof target !== 'function' || toStr.call(target) !== funcType) {
15052
+ if (typeof target !== 'function' || toStr.apply(target) !== funcType) {
14945
15053
  throw new TypeError(ERROR_MESSAGE + target);
14946
15054
  }
14947
- var args = slice.call(arguments, 1);
15055
+ var args = slicy(arguments, 1);
14948
15056
 
14949
15057
  var bound;
14950
15058
  var binder = function () {
14951
15059
  if (this instanceof bound) {
14952
15060
  var result = target.apply(
14953
15061
  this,
14954
- args.concat(slice.call(arguments))
15062
+ concatty(args, arguments)
14955
15063
  );
14956
15064
  if (Object(result) === result) {
14957
15065
  return result;
14958
15066
  }
14959
15067
  return this;
14960
- } else {
14961
- return target.apply(
14962
- that,
14963
- args.concat(slice.call(arguments))
14964
- );
14965
15068
  }
15069
+ return target.apply(
15070
+ that,
15071
+ concatty(args, arguments)
15072
+ );
15073
+
14966
15074
  };
14967
15075
 
14968
- var boundLength = Math.max(0, target.length - args.length);
15076
+ var boundLength = max(0, target.length - args.length);
14969
15077
  var boundArgs = [];
14970
15078
  for (var i = 0; i < boundLength; i++) {
14971
- boundArgs.push('$' + i);
15079
+ boundArgs[i] = '$' + i;
14972
15080
  }
14973
15081
 
14974
- bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder);
15082
+ bound = Function('binder', 'return function (' + joiny(boundArgs, ',') + '){ return binder.apply(this,arguments); }')(binder);
14975
15083
 
14976
15084
  if (target.prototype) {
14977
15085
  var Empty = function Empty() {};
@@ -15225,7 +15333,7 @@ var LEGACY_ALIASES = {
15225
15333
  };
15226
15334
 
15227
15335
  var bind = __webpack_require__(/*! function-bind */ "./node_modules/function-bind/index.js");
15228
- var hasOwn = __webpack_require__(/*! has */ "./node_modules/has/src/index.js");
15336
+ var hasOwn = __webpack_require__(/*! hasown */ "./node_modules/hasown/index.js");
15229
15337
  var $concat = bind.call(Function.call, Array.prototype.concat);
15230
15338
  var $spliceApply = bind.call(Function.apply, Array.prototype.splice);
15231
15339
  var $replace = bind.call(Function.call, String.prototype.replace);
@@ -15362,6 +15470,77 @@ module.exports = function GetIntrinsic(name, allowMissing) {
15362
15470
  };
15363
15471
 
15364
15472
 
15473
+ /***/ }),
15474
+
15475
+ /***/ "./node_modules/gopd/index.js":
15476
+ /*!************************************!*\
15477
+ !*** ./node_modules/gopd/index.js ***!
15478
+ \************************************/
15479
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
15480
+
15481
+ "use strict";
15482
+
15483
+
15484
+ var GetIntrinsic = __webpack_require__(/*! get-intrinsic */ "./node_modules/get-intrinsic/index.js");
15485
+
15486
+ var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true);
15487
+
15488
+ if ($gOPD) {
15489
+ try {
15490
+ $gOPD([], 'length');
15491
+ } catch (e) {
15492
+ // IE 8 has a broken gOPD
15493
+ $gOPD = null;
15494
+ }
15495
+ }
15496
+
15497
+ module.exports = $gOPD;
15498
+
15499
+
15500
+ /***/ }),
15501
+
15502
+ /***/ "./node_modules/has-property-descriptors/index.js":
15503
+ /*!********************************************************!*\
15504
+ !*** ./node_modules/has-property-descriptors/index.js ***!
15505
+ \********************************************************/
15506
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
15507
+
15508
+ "use strict";
15509
+
15510
+
15511
+ var GetIntrinsic = __webpack_require__(/*! get-intrinsic */ "./node_modules/get-intrinsic/index.js");
15512
+
15513
+ var $defineProperty = GetIntrinsic('%Object.defineProperty%', true);
15514
+
15515
+ var hasPropertyDescriptors = function hasPropertyDescriptors() {
15516
+ if ($defineProperty) {
15517
+ try {
15518
+ $defineProperty({}, 'a', { value: 1 });
15519
+ return true;
15520
+ } catch (e) {
15521
+ // IE 8 has a broken defineProperty
15522
+ return false;
15523
+ }
15524
+ }
15525
+ return false;
15526
+ };
15527
+
15528
+ hasPropertyDescriptors.hasArrayLengthDefineBug = function hasArrayLengthDefineBug() {
15529
+ // node v0.6 has a bug where array lengths can be Set but not Defined
15530
+ if (!hasPropertyDescriptors()) {
15531
+ return null;
15532
+ }
15533
+ try {
15534
+ return $defineProperty([], 'length', { value: 1 }).length !== 1;
15535
+ } catch (e) {
15536
+ // In Firefox 4-22, defining length on an array throws an exception.
15537
+ return true;
15538
+ }
15539
+ };
15540
+
15541
+ module.exports = hasPropertyDescriptors;
15542
+
15543
+
15365
15544
  /***/ }),
15366
15545
 
15367
15546
  /***/ "./node_modules/has-proto/index.js":
@@ -15463,18 +15642,21 @@ module.exports = function hasSymbols() {
15463
15642
 
15464
15643
  /***/ }),
15465
15644
 
15466
- /***/ "./node_modules/has/src/index.js":
15467
- /*!***************************************!*\
15468
- !*** ./node_modules/has/src/index.js ***!
15469
- \***************************************/
15645
+ /***/ "./node_modules/hasown/index.js":
15646
+ /*!**************************************!*\
15647
+ !*** ./node_modules/hasown/index.js ***!
15648
+ \**************************************/
15470
15649
  /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
15471
15650
 
15472
15651
  "use strict";
15473
15652
 
15474
15653
 
15654
+ var call = Function.prototype.call;
15655
+ var $hasOwn = Object.prototype.hasOwnProperty;
15475
15656
  var bind = __webpack_require__(/*! function-bind */ "./node_modules/function-bind/index.js");
15476
15657
 
15477
- module.exports = bind.call(Function.call, Object.prototype.hasOwnProperty);
15658
+ /** @type {(o: {}, p: PropertyKey) => p is keyof o} */
15659
+ module.exports = bind.call(call, $hasOwn);
15478
15660
 
15479
15661
 
15480
15662
  /***/ }),
@@ -33344,6 +33526,17 @@ function systemLocale() {
33344
33526
  return sysLocaleCache;
33345
33527
  }
33346
33528
  }
33529
+ let weekInfoCache = {};
33530
+ function getCachedWeekInfo(locString) {
33531
+ let data = weekInfoCache[locString];
33532
+ if (!data) {
33533
+ const locale = new Intl.Locale(locString);
33534
+ // browsers currently implement this as a property, but spec says it should be a getter function
33535
+ data = "getWeekInfo" in locale ? locale.getWeekInfo() : locale.weekInfo;
33536
+ weekInfoCache[locString] = data;
33537
+ }
33538
+ return data;
33539
+ }
33347
33540
  function parseLocaleString(localeStr) {
33348
33541
  // I really want to avoid writing a BCP 47 parser
33349
33542
  // see, e.g. https://github.com/wooorm/bcp-47
@@ -33581,6 +33774,11 @@ class PolyRelFormatter {
33581
33774
  }
33582
33775
  }
33583
33776
  }
33777
+ const fallbackWeekSettings = {
33778
+ firstDay: 1,
33779
+ minimalDays: 4,
33780
+ weekend: [6, 7]
33781
+ };
33584
33782
 
33585
33783
  /**
33586
33784
  * @private
@@ -33588,15 +33786,16 @@ class PolyRelFormatter {
33588
33786
 
33589
33787
  class Locale {
33590
33788
  static fromOpts(opts) {
33591
- return Locale.create(opts.locale, opts.numberingSystem, opts.outputCalendar, opts.defaultToEN);
33789
+ return Locale.create(opts.locale, opts.numberingSystem, opts.outputCalendar, opts.weekSettings, opts.defaultToEN);
33592
33790
  }
33593
- static create(locale, numberingSystem, outputCalendar, defaultToEN = false) {
33791
+ static create(locale, numberingSystem, outputCalendar, weekSettings, defaultToEN = false) {
33594
33792
  const specifiedLocale = locale || Settings.defaultLocale;
33595
33793
  // the system locale is useful for human readable strings but annoying for parsing/formatting known formats
33596
33794
  const localeR = specifiedLocale || (defaultToEN ? "en-US" : systemLocale());
33597
33795
  const numberingSystemR = numberingSystem || Settings.defaultNumberingSystem;
33598
33796
  const outputCalendarR = outputCalendar || Settings.defaultOutputCalendar;
33599
- return new Locale(localeR, numberingSystemR, outputCalendarR, specifiedLocale);
33797
+ const weekSettingsR = validateWeekSettings(weekSettings) || Settings.defaultWeekSettings;
33798
+ return new Locale(localeR, numberingSystemR, outputCalendarR, weekSettingsR, specifiedLocale);
33600
33799
  }
33601
33800
  static resetCache() {
33602
33801
  sysLocaleCache = null;
@@ -33607,15 +33806,17 @@ class Locale {
33607
33806
  static fromObject({
33608
33807
  locale,
33609
33808
  numberingSystem,
33610
- outputCalendar
33809
+ outputCalendar,
33810
+ weekSettings
33611
33811
  } = {}) {
33612
- return Locale.create(locale, numberingSystem, outputCalendar);
33812
+ return Locale.create(locale, numberingSystem, outputCalendar, weekSettings);
33613
33813
  }
33614
- constructor(locale, numbering, outputCalendar, specifiedLocale) {
33814
+ constructor(locale, numbering, outputCalendar, weekSettings, specifiedLocale) {
33615
33815
  const [parsedLocale, parsedNumberingSystem, parsedOutputCalendar] = parseLocaleString(locale);
33616
33816
  this.locale = parsedLocale;
33617
33817
  this.numberingSystem = numbering || parsedNumberingSystem || null;
33618
33818
  this.outputCalendar = outputCalendar || parsedOutputCalendar || null;
33819
+ this.weekSettings = weekSettings;
33619
33820
  this.intl = intlConfigString(this.locale, this.numberingSystem, this.outputCalendar);
33620
33821
  this.weekdaysCache = {
33621
33822
  format: {},
@@ -33645,7 +33846,7 @@ class Locale {
33645
33846
  if (!alts || Object.getOwnPropertyNames(alts).length === 0) {
33646
33847
  return this;
33647
33848
  } else {
33648
- return Locale.create(alts.locale || this.specifiedLocale, alts.numberingSystem || this.numberingSystem, alts.outputCalendar || this.outputCalendar, alts.defaultToEN || false);
33849
+ return Locale.create(alts.locale || this.specifiedLocale, alts.numberingSystem || this.numberingSystem, alts.outputCalendar || this.outputCalendar, validateWeekSettings(alts.weekSettings) || this.weekSettings, alts.defaultToEN || false);
33649
33850
  }
33650
33851
  }
33651
33852
  redefaultToEN(alts = {}) {
@@ -33743,6 +33944,24 @@ class Locale {
33743
33944
  isEnglish() {
33744
33945
  return this.locale === "en" || this.locale.toLowerCase() === "en-us" || new Intl.DateTimeFormat(this.intl).resolvedOptions().locale.startsWith("en-us");
33745
33946
  }
33947
+ getWeekSettings() {
33948
+ if (this.weekSettings) {
33949
+ return this.weekSettings;
33950
+ } else if (!hasLocaleWeekInfo()) {
33951
+ return fallbackWeekSettings;
33952
+ } else {
33953
+ return getCachedWeekInfo(this.locale);
33954
+ }
33955
+ }
33956
+ getStartOfWeek() {
33957
+ return this.getWeekSettings().firstDay;
33958
+ }
33959
+ getMinDaysInFirstWeek() {
33960
+ return this.getWeekSettings().minimalDays;
33961
+ }
33962
+ getWeekendDays() {
33963
+ return this.getWeekSettings().weekend;
33964
+ }
33746
33965
  equals(other) {
33747
33966
  return this.locale === other.locale && this.numberingSystem === other.numberingSystem && this.outputCalendar === other.outputCalendar;
33748
33967
  }
@@ -33926,7 +34145,8 @@ let now = () => Date.now(),
33926
34145
  defaultNumberingSystem = null,
33927
34146
  defaultOutputCalendar = null,
33928
34147
  twoDigitCutoffYear = 60,
33929
- throwOnInvalid;
34148
+ throwOnInvalid,
34149
+ defaultWeekSettings = null;
33930
34150
 
33931
34151
  /**
33932
34152
  * Settings contains static getters and setters that control Luxon's overall behavior. Luxon is a simple library with few options, but the ones it does have live here.
@@ -34017,6 +34237,31 @@ class Settings {
34017
34237
  defaultOutputCalendar = outputCalendar;
34018
34238
  }
34019
34239
 
34240
+ /**
34241
+ * @typedef {Object} WeekSettings
34242
+ * @property {number} firstDay
34243
+ * @property {number} minimalDays
34244
+ * @property {number[]} weekend
34245
+ */
34246
+
34247
+ /**
34248
+ * @return {WeekSettings|null}
34249
+ */
34250
+ static get defaultWeekSettings() {
34251
+ return defaultWeekSettings;
34252
+ }
34253
+
34254
+ /**
34255
+ * Allows overriding the default locale week settings, i.e. the start of the week, the weekend and
34256
+ * how many days are required in the first week of a year.
34257
+ * Does not affect existing instances.
34258
+ *
34259
+ * @param {WeekSettings|null} weekSettings
34260
+ */
34261
+ static set defaultWeekSettings(weekSettings) {
34262
+ defaultWeekSettings = validateWeekSettings(weekSettings);
34263
+ }
34264
+
34020
34265
  /**
34021
34266
  * Get the cutoff year after which a string encoding a year as two digits is interpreted to occur in the current century.
34022
34267
  * @type {number}
@@ -34063,6 +34308,224 @@ class Settings {
34063
34308
  }
34064
34309
  }
34065
34310
 
34311
+ class Invalid {
34312
+ constructor(reason, explanation) {
34313
+ this.reason = reason;
34314
+ this.explanation = explanation;
34315
+ }
34316
+ toMessage() {
34317
+ if (this.explanation) {
34318
+ return `${this.reason}: ${this.explanation}`;
34319
+ } else {
34320
+ return this.reason;
34321
+ }
34322
+ }
34323
+ }
34324
+
34325
+ const nonLeapLadder = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334],
34326
+ leapLadder = [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335];
34327
+ function unitOutOfRange(unit, value) {
34328
+ return new Invalid("unit out of range", `you specified ${value} (of type ${typeof value}) as a ${unit}, which is invalid`);
34329
+ }
34330
+ function dayOfWeek(year, month, day) {
34331
+ const d = new Date(Date.UTC(year, month - 1, day));
34332
+ if (year < 100 && year >= 0) {
34333
+ d.setUTCFullYear(d.getUTCFullYear() - 1900);
34334
+ }
34335
+ const js = d.getUTCDay();
34336
+ return js === 0 ? 7 : js;
34337
+ }
34338
+ function computeOrdinal(year, month, day) {
34339
+ return day + (isLeapYear(year) ? leapLadder : nonLeapLadder)[month - 1];
34340
+ }
34341
+ function uncomputeOrdinal(year, ordinal) {
34342
+ const table = isLeapYear(year) ? leapLadder : nonLeapLadder,
34343
+ month0 = table.findIndex(i => i < ordinal),
34344
+ day = ordinal - table[month0];
34345
+ return {
34346
+ month: month0 + 1,
34347
+ day
34348
+ };
34349
+ }
34350
+ function isoWeekdayToLocal(isoWeekday, startOfWeek) {
34351
+ return (isoWeekday - startOfWeek + 7) % 7 + 1;
34352
+ }
34353
+
34354
+ /**
34355
+ * @private
34356
+ */
34357
+
34358
+ function gregorianToWeek(gregObj, minDaysInFirstWeek = 4, startOfWeek = 1) {
34359
+ const {
34360
+ year,
34361
+ month,
34362
+ day
34363
+ } = gregObj,
34364
+ ordinal = computeOrdinal(year, month, day),
34365
+ weekday = isoWeekdayToLocal(dayOfWeek(year, month, day), startOfWeek);
34366
+ let weekNumber = Math.floor((ordinal - weekday + 14 - minDaysInFirstWeek) / 7),
34367
+ weekYear;
34368
+ if (weekNumber < 1) {
34369
+ weekYear = year - 1;
34370
+ weekNumber = weeksInWeekYear(weekYear, minDaysInFirstWeek, startOfWeek);
34371
+ } else if (weekNumber > weeksInWeekYear(year, minDaysInFirstWeek, startOfWeek)) {
34372
+ weekYear = year + 1;
34373
+ weekNumber = 1;
34374
+ } else {
34375
+ weekYear = year;
34376
+ }
34377
+ return {
34378
+ weekYear,
34379
+ weekNumber,
34380
+ weekday,
34381
+ ...timeObject(gregObj)
34382
+ };
34383
+ }
34384
+ function weekToGregorian(weekData, minDaysInFirstWeek = 4, startOfWeek = 1) {
34385
+ const {
34386
+ weekYear,
34387
+ weekNumber,
34388
+ weekday
34389
+ } = weekData,
34390
+ weekdayOfJan4 = isoWeekdayToLocal(dayOfWeek(weekYear, 1, minDaysInFirstWeek), startOfWeek),
34391
+ yearInDays = daysInYear(weekYear);
34392
+ let ordinal = weekNumber * 7 + weekday - weekdayOfJan4 - 7 + minDaysInFirstWeek,
34393
+ year;
34394
+ if (ordinal < 1) {
34395
+ year = weekYear - 1;
34396
+ ordinal += daysInYear(year);
34397
+ } else if (ordinal > yearInDays) {
34398
+ year = weekYear + 1;
34399
+ ordinal -= daysInYear(weekYear);
34400
+ } else {
34401
+ year = weekYear;
34402
+ }
34403
+ const {
34404
+ month,
34405
+ day
34406
+ } = uncomputeOrdinal(year, ordinal);
34407
+ return {
34408
+ year,
34409
+ month,
34410
+ day,
34411
+ ...timeObject(weekData)
34412
+ };
34413
+ }
34414
+ function gregorianToOrdinal(gregData) {
34415
+ const {
34416
+ year,
34417
+ month,
34418
+ day
34419
+ } = gregData;
34420
+ const ordinal = computeOrdinal(year, month, day);
34421
+ return {
34422
+ year,
34423
+ ordinal,
34424
+ ...timeObject(gregData)
34425
+ };
34426
+ }
34427
+ function ordinalToGregorian(ordinalData) {
34428
+ const {
34429
+ year,
34430
+ ordinal
34431
+ } = ordinalData;
34432
+ const {
34433
+ month,
34434
+ day
34435
+ } = uncomputeOrdinal(year, ordinal);
34436
+ return {
34437
+ year,
34438
+ month,
34439
+ day,
34440
+ ...timeObject(ordinalData)
34441
+ };
34442
+ }
34443
+
34444
+ /**
34445
+ * Check if local week units like localWeekday are used in obj.
34446
+ * If so, validates that they are not mixed with ISO week units and then copies them to the normal week unit properties.
34447
+ * Modifies obj in-place!
34448
+ * @param obj the object values
34449
+ */
34450
+ function usesLocalWeekValues(obj, loc) {
34451
+ const hasLocaleWeekData = !isUndefined(obj.localWeekday) || !isUndefined(obj.localWeekNumber) || !isUndefined(obj.localWeekYear);
34452
+ if (hasLocaleWeekData) {
34453
+ const hasIsoWeekData = !isUndefined(obj.weekday) || !isUndefined(obj.weekNumber) || !isUndefined(obj.weekYear);
34454
+ if (hasIsoWeekData) {
34455
+ throw new ConflictingSpecificationError("Cannot mix locale-based week fields with ISO-based week fields");
34456
+ }
34457
+ if (!isUndefined(obj.localWeekday)) obj.weekday = obj.localWeekday;
34458
+ if (!isUndefined(obj.localWeekNumber)) obj.weekNumber = obj.localWeekNumber;
34459
+ if (!isUndefined(obj.localWeekYear)) obj.weekYear = obj.localWeekYear;
34460
+ delete obj.localWeekday;
34461
+ delete obj.localWeekNumber;
34462
+ delete obj.localWeekYear;
34463
+ return {
34464
+ minDaysInFirstWeek: loc.getMinDaysInFirstWeek(),
34465
+ startOfWeek: loc.getStartOfWeek()
34466
+ };
34467
+ } else {
34468
+ return {
34469
+ minDaysInFirstWeek: 4,
34470
+ startOfWeek: 1
34471
+ };
34472
+ }
34473
+ }
34474
+ function hasInvalidWeekData(obj, minDaysInFirstWeek = 4, startOfWeek = 1) {
34475
+ const validYear = isInteger(obj.weekYear),
34476
+ validWeek = integerBetween(obj.weekNumber, 1, weeksInWeekYear(obj.weekYear, minDaysInFirstWeek, startOfWeek)),
34477
+ validWeekday = integerBetween(obj.weekday, 1, 7);
34478
+ if (!validYear) {
34479
+ return unitOutOfRange("weekYear", obj.weekYear);
34480
+ } else if (!validWeek) {
34481
+ return unitOutOfRange("week", obj.weekNumber);
34482
+ } else if (!validWeekday) {
34483
+ return unitOutOfRange("weekday", obj.weekday);
34484
+ } else return false;
34485
+ }
34486
+ function hasInvalidOrdinalData(obj) {
34487
+ const validYear = isInteger(obj.year),
34488
+ validOrdinal = integerBetween(obj.ordinal, 1, daysInYear(obj.year));
34489
+ if (!validYear) {
34490
+ return unitOutOfRange("year", obj.year);
34491
+ } else if (!validOrdinal) {
34492
+ return unitOutOfRange("ordinal", obj.ordinal);
34493
+ } else return false;
34494
+ }
34495
+ function hasInvalidGregorianData(obj) {
34496
+ const validYear = isInteger(obj.year),
34497
+ validMonth = integerBetween(obj.month, 1, 12),
34498
+ validDay = integerBetween(obj.day, 1, daysInMonth(obj.year, obj.month));
34499
+ if (!validYear) {
34500
+ return unitOutOfRange("year", obj.year);
34501
+ } else if (!validMonth) {
34502
+ return unitOutOfRange("month", obj.month);
34503
+ } else if (!validDay) {
34504
+ return unitOutOfRange("day", obj.day);
34505
+ } else return false;
34506
+ }
34507
+ function hasInvalidTimeData(obj) {
34508
+ const {
34509
+ hour,
34510
+ minute,
34511
+ second,
34512
+ millisecond
34513
+ } = obj;
34514
+ const validHour = integerBetween(hour, 0, 23) || hour === 24 && minute === 0 && second === 0 && millisecond === 0,
34515
+ validMinute = integerBetween(minute, 0, 59),
34516
+ validSecond = integerBetween(second, 0, 59),
34517
+ validMillisecond = integerBetween(millisecond, 0, 999);
34518
+ if (!validHour) {
34519
+ return unitOutOfRange("hour", hour);
34520
+ } else if (!validMinute) {
34521
+ return unitOutOfRange("minute", minute);
34522
+ } else if (!validSecond) {
34523
+ return unitOutOfRange("second", second);
34524
+ } else if (!validMillisecond) {
34525
+ return unitOutOfRange("millisecond", millisecond);
34526
+ } else return false;
34527
+ }
34528
+
34066
34529
  /*
34067
34530
  This is just a junk drawer, containing anything used across multiple classes.
34068
34531
  Because Luxon is small(ish), this should stay small and we won't worry about splitting
@@ -34100,6 +34563,13 @@ function hasRelative() {
34100
34563
  return false;
34101
34564
  }
34102
34565
  }
34566
+ function hasLocaleWeekInfo() {
34567
+ try {
34568
+ return typeof Intl !== "undefined" && !!Intl.Locale && ("weekInfo" in Intl.Locale.prototype || "getWeekInfo" in Intl.Locale.prototype);
34569
+ } catch (e) {
34570
+ return false;
34571
+ }
34572
+ }
34103
34573
 
34104
34574
  // OBJECTS AND ARRAYS
34105
34575
 
@@ -34130,6 +34600,22 @@ function pick(obj, keys) {
34130
34600
  function hasOwnProperty(obj, prop) {
34131
34601
  return Object.prototype.hasOwnProperty.call(obj, prop);
34132
34602
  }
34603
+ function validateWeekSettings(settings) {
34604
+ if (settings == null) {
34605
+ return null;
34606
+ } else if (typeof settings !== "object") {
34607
+ throw new InvalidArgumentError("Week settings must be an object");
34608
+ } else {
34609
+ if (!integerBetween(settings.firstDay, 1, 7) || !integerBetween(settings.minimalDays, 1, 7) || !Array.isArray(settings.weekend) || settings.weekend.some(v => !integerBetween(v, 1, 7))) {
34610
+ throw new InvalidArgumentError("Invalid week settings");
34611
+ }
34612
+ return {
34613
+ firstDay: settings.firstDay,
34614
+ minimalDays: settings.minimalDays,
34615
+ weekend: Array.from(settings.weekend)
34616
+ };
34617
+ }
34618
+ }
34133
34619
 
34134
34620
  // NUMBERS AND STRINGS
34135
34621
 
@@ -34212,11 +34698,16 @@ function objToLocalTS(obj) {
34212
34698
  }
34213
34699
  return +d;
34214
34700
  }
34215
- function weeksInWeekYear(weekYear) {
34216
- const p1 = (weekYear + Math.floor(weekYear / 4) - Math.floor(weekYear / 100) + Math.floor(weekYear / 400)) % 7,
34217
- last = weekYear - 1,
34218
- p2 = (last + Math.floor(last / 4) - Math.floor(last / 100) + Math.floor(last / 400)) % 7;
34219
- return p1 === 4 || p2 === 3 ? 53 : 52;
34701
+
34702
+ // adapted from moment.js: https://github.com/moment/moment/blob/000ac1800e620f770f4eb31b5ae908f6167b0ab2/src/lib/units/week-calendar-utils.js
34703
+ function firstWeekOffset(year, minDaysInFirstWeek, startOfWeek) {
34704
+ const fwdlw = isoWeekdayToLocal(dayOfWeek(year, 1, minDaysInFirstWeek), startOfWeek);
34705
+ return -fwdlw + minDaysInFirstWeek - 1;
34706
+ }
34707
+ function weeksInWeekYear(weekYear, minDaysInFirstWeek = 4, startOfWeek = 1) {
34708
+ const weekOffset = firstWeekOffset(weekYear, minDaysInFirstWeek, startOfWeek);
34709
+ const weekOffsetNext = firstWeekOffset(weekYear + 1, minDaysInFirstWeek, startOfWeek);
34710
+ return (daysInYear(weekYear) - weekOffset + weekOffsetNext) / 7;
34220
34711
  }
34221
34712
  function untruncateYear(year) {
34222
34713
  if (year > 99) {
@@ -34757,6 +35248,14 @@ class Formatter {
34757
35248
  return this.num(dt.weekNumber);
34758
35249
  case "WW":
34759
35250
  return this.num(dt.weekNumber, 2);
35251
+ case "n":
35252
+ return this.num(dt.localWeekNumber);
35253
+ case "nn":
35254
+ return this.num(dt.localWeekNumber, 2);
35255
+ case "ii":
35256
+ return this.num(dt.localWeekYear.toString().slice(-2), 2);
35257
+ case "iiii":
35258
+ return this.num(dt.localWeekYear, 4);
34760
35259
  case "o":
34761
35260
  return this.num(dt.ordinal);
34762
35261
  case "ooo":
@@ -34818,20 +35317,6 @@ class Formatter {
34818
35317
  }
34819
35318
  }
34820
35319
 
34821
- class Invalid {
34822
- constructor(reason, explanation) {
34823
- this.reason = reason;
34824
- this.explanation = explanation;
34825
- }
34826
- toMessage() {
34827
- if (this.explanation) {
34828
- return `${this.reason}: ${this.explanation}`;
34829
- } else {
34830
- return this.reason;
34831
- }
34832
- }
34833
- }
34834
-
34835
35320
  /*
34836
35321
  * This file handles parsing for well-specified formats. Here's how it works:
34837
35322
  * Two things go into parsing: a regex to match with and an extractor to take apart the groups in the match.
@@ -35508,9 +35993,10 @@ class Duration {
35508
35993
 
35509
35994
  /**
35510
35995
  * Returns a string representation of a Duration with all units included.
35511
- * To modify its behavior use the `listStyle` and any Intl.NumberFormat option, though `unitDisplay` is especially relevant.
35512
- * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat
35513
- * @param opts - On option object to override the formatting. Accepts the same keys as the options parameter of the native `Int.NumberFormat` constructor, as well as `listStyle`.
35996
+ * To modify its behavior, use `listStyle` and any Intl.NumberFormat option, though `unitDisplay` is especially relevant.
35997
+ * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#options
35998
+ * @param {Object} opts - Formatting options. Accepts the same keys as the options parameter of the native `Intl.NumberFormat` constructor, as well as `listStyle`.
35999
+ * @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.
35514
36000
  * @example
35515
36001
  * ```js
35516
36002
  * var dur = Duration.fromObject({ days: 1, hours: 5, minutes: 6 })
@@ -35631,6 +36117,18 @@ class Duration {
35631
36117
  return this.toISO();
35632
36118
  }
35633
36119
 
36120
+ /**
36121
+ * Returns a string representation of this Duration appropriate for the REPL.
36122
+ * @return {string}
36123
+ */
36124
+ [Symbol.for("nodejs.util.inspect.custom")]() {
36125
+ if (this.isValid) {
36126
+ return `Duration { values: ${JSON.stringify(this.values)} }`;
36127
+ } else {
36128
+ return `Duration { Invalid, reason: ${this.invalidReason} }`;
36129
+ }
36130
+ }
36131
+
35634
36132
  /**
35635
36133
  * Returns an milliseconds value of this Duration.
35636
36134
  * @return {number}
@@ -35766,7 +36264,7 @@ class Duration {
35766
36264
  * Assuming the overall value of the Duration is positive, this means:
35767
36265
  * - excessive values for lower-order units are converted to higher-order units (if possible, see first and second example)
35768
36266
  * - negative lower-order units are converted to higher order units (there must be such a higher order unit, otherwise
35769
- * the overall value would be negative, see second example)
36267
+ * the overall value would be negative, see third example)
35770
36268
  * - fractional values for higher-order units are converted to lower-order units (if possible, see fourth example)
35771
36269
  *
35772
36270
  * If the overall value is negative, the result of this method is equivalent to `this.negate().normalize().negate()`.
@@ -36224,12 +36722,22 @@ class Interval {
36224
36722
  * Unlike {@link Interval#length} this counts sections of the calendar, not periods of time, e.g. specifying 'day'
36225
36723
  * asks 'what dates are included in this interval?', not 'how many days long is this interval?'
36226
36724
  * @param {string} [unit='milliseconds'] - the unit of time to count.
36725
+ * @param {Object} opts - options
36726
+ * @param {boolean} [opts.useLocaleWeeks=false] - If true, use weeks based on the locale, i.e. use the locale-dependent start of the week; this operation will always use the locale of the start DateTime
36227
36727
  * @return {number}
36228
36728
  */
36229
- count(unit = "milliseconds") {
36729
+ count(unit = "milliseconds", opts) {
36230
36730
  if (!this.isValid) return NaN;
36231
- const start = this.start.startOf(unit),
36232
- end = this.end.startOf(unit);
36731
+ const start = this.start.startOf(unit, opts);
36732
+ let end;
36733
+ if (opts != null && opts.useLocaleWeeks) {
36734
+ end = this.end.reconfigure({
36735
+ locale: start.locale
36736
+ });
36737
+ } else {
36738
+ end = this.end;
36739
+ }
36740
+ end = end.startOf(unit, opts);
36233
36741
  return Math.floor(end.diff(start, unit).get(unit)) + (end.valueOf() !== this.end.valueOf());
36234
36742
  }
36235
36743
 
@@ -36302,7 +36810,7 @@ class Interval {
36302
36810
  */
36303
36811
  splitAt(...dateTimes) {
36304
36812
  if (!this.isValid) return [];
36305
- const sorted = dateTimes.map(friendlyDateTime).filter(d => this.contains(d)).sort(),
36813
+ const sorted = dateTimes.map(friendlyDateTime).filter(d => this.contains(d)).sort((a, b) => a.toMillis() - b.toMillis()),
36306
36814
  results = [];
36307
36815
  let {
36308
36816
  s
@@ -36509,6 +37017,18 @@ class Interval {
36509
37017
  return `[${this.s.toISO()} – ${this.e.toISO()})`;
36510
37018
  }
36511
37019
 
37020
+ /**
37021
+ * Returns a string representation of this Interval appropriate for the REPL.
37022
+ * @return {string}
37023
+ */
37024
+ [Symbol.for("nodejs.util.inspect.custom")]() {
37025
+ if (this.isValid) {
37026
+ return `Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`;
37027
+ } else {
37028
+ return `Interval { Invalid, reason: ${this.invalidReason} }`;
37029
+ }
37030
+ }
37031
+
36512
37032
  /**
36513
37033
  * Returns a localized string representing this Interval. Accepts the same options as the
36514
37034
  * Intl.DateTimeFormat constructor and any presets defined by Luxon, such as
@@ -36659,6 +37179,50 @@ class Info {
36659
37179
  return normalizeZone(input, Settings.defaultZone);
36660
37180
  }
36661
37181
 
37182
+ /**
37183
+ * Get the weekday on which the week starts according to the given locale.
37184
+ * @param {Object} opts - options
37185
+ * @param {string} [opts.locale] - the locale code
37186
+ * @param {string} [opts.locObj=null] - an existing locale object to use
37187
+ * @returns {number} the start of the week, 1 for Monday through 7 for Sunday
37188
+ */
37189
+ static getStartOfWeek({
37190
+ locale = null,
37191
+ locObj = null
37192
+ } = {}) {
37193
+ return (locObj || Locale.create(locale)).getStartOfWeek();
37194
+ }
37195
+
37196
+ /**
37197
+ * Get the minimum number of days necessary in a week before it is considered part of the next year according
37198
+ * to the given locale.
37199
+ * @param {Object} opts - options
37200
+ * @param {string} [opts.locale] - the locale code
37201
+ * @param {string} [opts.locObj=null] - an existing locale object to use
37202
+ * @returns {number}
37203
+ */
37204
+ static getMinimumDaysInFirstWeek({
37205
+ locale = null,
37206
+ locObj = null
37207
+ } = {}) {
37208
+ return (locObj || Locale.create(locale)).getMinDaysInFirstWeek();
37209
+ }
37210
+
37211
+ /**
37212
+ * Get the weekdays, which are considered the weekend according to the given locale
37213
+ * @param {Object} opts - options
37214
+ * @param {string} [opts.locale] - the locale code
37215
+ * @param {string} [opts.locObj=null] - an existing locale object to use
37216
+ * @returns {number[]} an array of weekdays, 1 for Monday through 7 for Sunday
37217
+ */
37218
+ static getWeekendWeekdays({
37219
+ locale = null,
37220
+ locObj = null
37221
+ } = {}) {
37222
+ // copy the array, because we cache it internally
37223
+ return (locObj || Locale.create(locale)).getWeekendDays().slice();
37224
+ }
37225
+
36662
37226
  /**
36663
37227
  * Return an array of standalone month names.
36664
37228
  * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat
@@ -36784,12 +37348,14 @@ class Info {
36784
37348
  * Some features of Luxon are not available in all environments. For example, on older browsers, relative time formatting support is not available. Use this function to figure out if that's the case.
36785
37349
  * Keys:
36786
37350
  * * `relative`: whether this environment supports relative time formatting
36787
- * @example Info.features() //=> { relative: false }
37351
+ * * `localeWeek`: whether this environment supports different weekdays for the start of the week based on the locale
37352
+ * @example Info.features() //=> { relative: false, localeWeek: true }
36788
37353
  * @return {Object}
36789
37354
  */
36790
37355
  static features() {
36791
37356
  return {
36792
- relative: hasRelative()
37357
+ relative: hasRelative(),
37358
+ localeWeek: hasLocaleWeekInfo()
36793
37359
  };
36794
37360
  }
36795
37361
  }
@@ -37393,176 +37959,6 @@ function formatOptsToTokens(formatOpts, locale) {
37393
37959
  return parts.map(p => tokenForPart(p, formatOpts, resolvedOpts));
37394
37960
  }
37395
37961
 
37396
- const nonLeapLadder = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334],
37397
- leapLadder = [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335];
37398
- function unitOutOfRange(unit, value) {
37399
- return new Invalid("unit out of range", `you specified ${value} (of type ${typeof value}) as a ${unit}, which is invalid`);
37400
- }
37401
- function dayOfWeek(year, month, day) {
37402
- const d = new Date(Date.UTC(year, month - 1, day));
37403
- if (year < 100 && year >= 0) {
37404
- d.setUTCFullYear(d.getUTCFullYear() - 1900);
37405
- }
37406
- const js = d.getUTCDay();
37407
- return js === 0 ? 7 : js;
37408
- }
37409
- function computeOrdinal(year, month, day) {
37410
- return day + (isLeapYear(year) ? leapLadder : nonLeapLadder)[month - 1];
37411
- }
37412
- function uncomputeOrdinal(year, ordinal) {
37413
- const table = isLeapYear(year) ? leapLadder : nonLeapLadder,
37414
- month0 = table.findIndex(i => i < ordinal),
37415
- day = ordinal - table[month0];
37416
- return {
37417
- month: month0 + 1,
37418
- day
37419
- };
37420
- }
37421
-
37422
- /**
37423
- * @private
37424
- */
37425
-
37426
- function gregorianToWeek(gregObj) {
37427
- const {
37428
- year,
37429
- month,
37430
- day
37431
- } = gregObj,
37432
- ordinal = computeOrdinal(year, month, day),
37433
- weekday = dayOfWeek(year, month, day);
37434
- let weekNumber = Math.floor((ordinal - weekday + 10) / 7),
37435
- weekYear;
37436
- if (weekNumber < 1) {
37437
- weekYear = year - 1;
37438
- weekNumber = weeksInWeekYear(weekYear);
37439
- } else if (weekNumber > weeksInWeekYear(year)) {
37440
- weekYear = year + 1;
37441
- weekNumber = 1;
37442
- } else {
37443
- weekYear = year;
37444
- }
37445
- return {
37446
- weekYear,
37447
- weekNumber,
37448
- weekday,
37449
- ...timeObject(gregObj)
37450
- };
37451
- }
37452
- function weekToGregorian(weekData) {
37453
- const {
37454
- weekYear,
37455
- weekNumber,
37456
- weekday
37457
- } = weekData,
37458
- weekdayOfJan4 = dayOfWeek(weekYear, 1, 4),
37459
- yearInDays = daysInYear(weekYear);
37460
- let ordinal = weekNumber * 7 + weekday - weekdayOfJan4 - 3,
37461
- year;
37462
- if (ordinal < 1) {
37463
- year = weekYear - 1;
37464
- ordinal += daysInYear(year);
37465
- } else if (ordinal > yearInDays) {
37466
- year = weekYear + 1;
37467
- ordinal -= daysInYear(weekYear);
37468
- } else {
37469
- year = weekYear;
37470
- }
37471
- const {
37472
- month,
37473
- day
37474
- } = uncomputeOrdinal(year, ordinal);
37475
- return {
37476
- year,
37477
- month,
37478
- day,
37479
- ...timeObject(weekData)
37480
- };
37481
- }
37482
- function gregorianToOrdinal(gregData) {
37483
- const {
37484
- year,
37485
- month,
37486
- day
37487
- } = gregData;
37488
- const ordinal = computeOrdinal(year, month, day);
37489
- return {
37490
- year,
37491
- ordinal,
37492
- ...timeObject(gregData)
37493
- };
37494
- }
37495
- function ordinalToGregorian(ordinalData) {
37496
- const {
37497
- year,
37498
- ordinal
37499
- } = ordinalData;
37500
- const {
37501
- month,
37502
- day
37503
- } = uncomputeOrdinal(year, ordinal);
37504
- return {
37505
- year,
37506
- month,
37507
- day,
37508
- ...timeObject(ordinalData)
37509
- };
37510
- }
37511
- function hasInvalidWeekData(obj) {
37512
- const validYear = isInteger(obj.weekYear),
37513
- validWeek = integerBetween(obj.weekNumber, 1, weeksInWeekYear(obj.weekYear)),
37514
- validWeekday = integerBetween(obj.weekday, 1, 7);
37515
- if (!validYear) {
37516
- return unitOutOfRange("weekYear", obj.weekYear);
37517
- } else if (!validWeek) {
37518
- return unitOutOfRange("week", obj.week);
37519
- } else if (!validWeekday) {
37520
- return unitOutOfRange("weekday", obj.weekday);
37521
- } else return false;
37522
- }
37523
- function hasInvalidOrdinalData(obj) {
37524
- const validYear = isInteger(obj.year),
37525
- validOrdinal = integerBetween(obj.ordinal, 1, daysInYear(obj.year));
37526
- if (!validYear) {
37527
- return unitOutOfRange("year", obj.year);
37528
- } else if (!validOrdinal) {
37529
- return unitOutOfRange("ordinal", obj.ordinal);
37530
- } else return false;
37531
- }
37532
- function hasInvalidGregorianData(obj) {
37533
- const validYear = isInteger(obj.year),
37534
- validMonth = integerBetween(obj.month, 1, 12),
37535
- validDay = integerBetween(obj.day, 1, daysInMonth(obj.year, obj.month));
37536
- if (!validYear) {
37537
- return unitOutOfRange("year", obj.year);
37538
- } else if (!validMonth) {
37539
- return unitOutOfRange("month", obj.month);
37540
- } else if (!validDay) {
37541
- return unitOutOfRange("day", obj.day);
37542
- } else return false;
37543
- }
37544
- function hasInvalidTimeData(obj) {
37545
- const {
37546
- hour,
37547
- minute,
37548
- second,
37549
- millisecond
37550
- } = obj;
37551
- const validHour = integerBetween(hour, 0, 23) || hour === 24 && minute === 0 && second === 0 && millisecond === 0,
37552
- validMinute = integerBetween(minute, 0, 59),
37553
- validSecond = integerBetween(second, 0, 59),
37554
- validMillisecond = integerBetween(millisecond, 0, 999);
37555
- if (!validHour) {
37556
- return unitOutOfRange("hour", hour);
37557
- } else if (!validMinute) {
37558
- return unitOutOfRange("minute", minute);
37559
- } else if (!validSecond) {
37560
- return unitOutOfRange("second", second);
37561
- } else if (!validMillisecond) {
37562
- return unitOutOfRange("millisecond", millisecond);
37563
- } else return false;
37564
- }
37565
-
37566
37962
  const INVALID = "Invalid DateTime";
37567
37963
  const MAX_DATE = 8.64e15;
37568
37964
  function unsupportedZone(zone) {
@@ -37570,6 +37966,9 @@ function unsupportedZone(zone) {
37570
37966
  }
37571
37967
 
37572
37968
  // we cache week data on the DT object and this intermediates the cache
37969
+ /**
37970
+ * @param {DateTime} dt
37971
+ */
37573
37972
  function possiblyCachedWeekData(dt) {
37574
37973
  if (dt.weekData === null) {
37575
37974
  dt.weekData = gregorianToWeek(dt.c);
@@ -37577,6 +37976,16 @@ function possiblyCachedWeekData(dt) {
37577
37976
  return dt.weekData;
37578
37977
  }
37579
37978
 
37979
+ /**
37980
+ * @param {DateTime} dt
37981
+ */
37982
+ function possiblyCachedLocalWeekData(dt) {
37983
+ if (dt.localWeekData === null) {
37984
+ dt.localWeekData = gregorianToWeek(dt.c, dt.loc.getMinDaysInFirstWeek(), dt.loc.getStartOfWeek());
37985
+ }
37986
+ return dt.localWeekData;
37987
+ }
37988
+
37580
37989
  // clone really means, "make a new object with these modifications". all "setters" really use this
37581
37990
  // to create a new object while only changing some of the properties
37582
37991
  function clone(inst, alts) {
@@ -37821,6 +38230,21 @@ function normalizeUnit(unit) {
37821
38230
  if (!normalized) throw new InvalidUnitError(unit);
37822
38231
  return normalized;
37823
38232
  }
38233
+ function normalizeUnitWithLocalWeeks(unit) {
38234
+ switch (unit.toLowerCase()) {
38235
+ case "localweekday":
38236
+ case "localweekdays":
38237
+ return "localWeekday";
38238
+ case "localweeknumber":
38239
+ case "localweeknumbers":
38240
+ return "localWeekNumber";
38241
+ case "localweekyear":
38242
+ case "localweekyears":
38243
+ return "localWeekYear";
38244
+ default:
38245
+ return normalizeUnit(unit);
38246
+ }
38247
+ }
37824
38248
 
37825
38249
  // this is a dumbed down version of fromObject() that runs about 60% faster
37826
38250
  // but doesn't do any validation, makes a bunch of assumptions about what units
@@ -37955,6 +38379,10 @@ class DateTime {
37955
38379
  * @access private
37956
38380
  */
37957
38381
  this.weekData = null;
38382
+ /**
38383
+ * @access private
38384
+ */
38385
+ this.localWeekData = null;
37958
38386
  /**
37959
38387
  * @access private
37960
38388
  */
@@ -38136,13 +38564,16 @@ class DateTime {
38136
38564
  * @param {number} obj.weekYear - an ISO week year
38137
38565
  * @param {number} obj.weekNumber - an ISO week number, between 1 and 52 or 53, depending on the year
38138
38566
  * @param {number} obj.weekday - an ISO weekday, 1-7, where 1 is Monday and 7 is Sunday
38567
+ * @param {number} obj.localWeekYear - a week year, according to the locale
38568
+ * @param {number} obj.localWeekNumber - a week number, between 1 and 52 or 53, depending on the year, according to the locale
38569
+ * @param {number} obj.localWeekday - a weekday, 1-7, where 1 is the first and 7 is the last day of the week, according to the locale
38139
38570
  * @param {number} obj.hour - hour of the day, 0-23
38140
38571
  * @param {number} obj.minute - minute of the hour, 0-59
38141
38572
  * @param {number} obj.second - second of the minute, 0-59
38142
38573
  * @param {number} obj.millisecond - millisecond of the second, 0-999
38143
38574
  * @param {Object} opts - options for creating this DateTime
38144
38575
  * @param {string|Zone} [opts.zone='local'] - interpret the numbers in the context of a particular zone. Can take any value taken as the first argument to setZone()
38145
- * @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance
38576
+ * @param {string} [opts.locale='system\'s locale'] - a locale to set on the resulting DateTime instance
38146
38577
  * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance
38147
38578
  * @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance
38148
38579
  * @example DateTime.fromObject({ year: 1982, month: 5, day: 25}).toISODate() //=> '1982-05-25'
@@ -38152,6 +38583,7 @@ class DateTime {
38152
38583
  * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }, { zone: 'local' })
38153
38584
  * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }, { zone: 'America/New_York' })
38154
38585
  * @example DateTime.fromObject({ weekYear: 2016, weekNumber: 2, weekday: 3 }).toISODate() //=> '2016-01-13'
38586
+ * @example DateTime.fromObject({ localWeekYear: 2022, localWeekNumber: 1, localWeekday: 1 }, { locale: "en-US" }).toISODate() //=> '2021-12-26'
38155
38587
  * @return {DateTime}
38156
38588
  */
38157
38589
  static fromObject(obj, opts = {}) {
@@ -38160,15 +38592,19 @@ class DateTime {
38160
38592
  if (!zoneToUse.isValid) {
38161
38593
  return DateTime.invalid(unsupportedZone(zoneToUse));
38162
38594
  }
38595
+ const loc = Locale.fromObject(opts);
38596
+ const normalized = normalizeObject(obj, normalizeUnitWithLocalWeeks);
38597
+ const {
38598
+ minDaysInFirstWeek,
38599
+ startOfWeek
38600
+ } = usesLocalWeekValues(normalized, loc);
38163
38601
  const tsNow = Settings.now(),
38164
38602
  offsetProvis = !isUndefined(opts.specificOffset) ? opts.specificOffset : zoneToUse.offset(tsNow),
38165
- normalized = normalizeObject(obj, normalizeUnit),
38166
38603
  containsOrdinal = !isUndefined(normalized.ordinal),
38167
38604
  containsGregorYear = !isUndefined(normalized.year),
38168
38605
  containsGregorMD = !isUndefined(normalized.month) || !isUndefined(normalized.day),
38169
38606
  containsGregor = containsGregorYear || containsGregorMD,
38170
- definiteWeekDef = normalized.weekYear || normalized.weekNumber,
38171
- loc = Locale.fromObject(opts);
38607
+ definiteWeekDef = normalized.weekYear || normalized.weekNumber;
38172
38608
 
38173
38609
  // cases:
38174
38610
  // just a weekday -> this week's instance of that weekday, no worries
@@ -38191,7 +38627,7 @@ class DateTime {
38191
38627
  if (useWeekData) {
38192
38628
  units = orderedWeekUnits;
38193
38629
  defaultValues = defaultWeekUnitValues;
38194
- objNow = gregorianToWeek(objNow);
38630
+ objNow = gregorianToWeek(objNow, minDaysInFirstWeek, startOfWeek);
38195
38631
  } else if (containsOrdinal) {
38196
38632
  units = orderedOrdinalUnits;
38197
38633
  defaultValues = defaultOrdinalUnitValues;
@@ -38215,14 +38651,14 @@ class DateTime {
38215
38651
  }
38216
38652
 
38217
38653
  // make sure the values we have are in range
38218
- const higherOrderInvalid = useWeekData ? hasInvalidWeekData(normalized) : containsOrdinal ? hasInvalidOrdinalData(normalized) : hasInvalidGregorianData(normalized),
38654
+ const higherOrderInvalid = useWeekData ? hasInvalidWeekData(normalized, minDaysInFirstWeek, startOfWeek) : containsOrdinal ? hasInvalidOrdinalData(normalized) : hasInvalidGregorianData(normalized),
38219
38655
  invalid = higherOrderInvalid || hasInvalidTimeData(normalized);
38220
38656
  if (invalid) {
38221
38657
  return DateTime.invalid(invalid);
38222
38658
  }
38223
38659
 
38224
38660
  // compute the actual time
38225
- const gregorian = useWeekData ? weekToGregorian(normalized) : containsOrdinal ? ordinalToGregorian(normalized) : normalized,
38661
+ const gregorian = useWeekData ? weekToGregorian(normalized, minDaysInFirstWeek, startOfWeek) : containsOrdinal ? ordinalToGregorian(normalized) : normalized,
38226
38662
  [tsFinal, offsetFinal] = objToTS(gregorian, offsetProvis, zoneToUse),
38227
38663
  inst = new DateTime({
38228
38664
  ts: tsFinal,
@@ -38601,6 +39037,43 @@ class DateTime {
38601
39037
  return this.isValid ? possiblyCachedWeekData(this).weekday : NaN;
38602
39038
  }
38603
39039
 
39040
+ /**
39041
+ * Returns true if this date is on a weekend according to the locale, false otherwise
39042
+ * @returns {boolean}
39043
+ */
39044
+ get isWeekend() {
39045
+ return this.isValid && this.loc.getWeekendDays().includes(this.weekday);
39046
+ }
39047
+
39048
+ /**
39049
+ * Get the day of the week according to the locale.
39050
+ * 1 is the first day of the week and 7 is the last day of the week.
39051
+ * If the locale assigns Sunday as the first day of the week, then a date which is a Sunday will return 1,
39052
+ * @returns {number}
39053
+ */
39054
+ get localWeekday() {
39055
+ return this.isValid ? possiblyCachedLocalWeekData(this).weekday : NaN;
39056
+ }
39057
+
39058
+ /**
39059
+ * Get the week number of the week year according to the locale. Different locales assign week numbers differently,
39060
+ * because the week can start on different days of the week (see localWeekday) and because a different number of days
39061
+ * is required for a week to count as the first week of a year.
39062
+ * @returns {number}
39063
+ */
39064
+ get localWeekNumber() {
39065
+ return this.isValid ? possiblyCachedLocalWeekData(this).weekNumber : NaN;
39066
+ }
39067
+
39068
+ /**
39069
+ * Get the week year according to the locale. Different locales assign week numbers (and therefor week years)
39070
+ * differently, see localWeekNumber.
39071
+ * @returns {number}
39072
+ */
39073
+ get localWeekYear() {
39074
+ return this.isValid ? possiblyCachedLocalWeekData(this).weekYear : NaN;
39075
+ }
39076
+
38604
39077
  /**
38605
39078
  * Get the ordinal (meaning the day of the year)
38606
39079
  * @example DateTime.local(2017, 5, 25).ordinal //=> 145
@@ -38801,6 +39274,16 @@ class DateTime {
38801
39274
  return this.isValid ? weeksInWeekYear(this.weekYear) : NaN;
38802
39275
  }
38803
39276
 
39277
+ /**
39278
+ * Returns the number of weeks in this DateTime's local week year
39279
+ * @example DateTime.local(2020, 6, {locale: 'en-US'}).weeksInLocalWeekYear //=> 52
39280
+ * @example DateTime.local(2020, 6, {locale: 'de-DE'}).weeksInLocalWeekYear //=> 53
39281
+ * @type {number}
39282
+ */
39283
+ get weeksInLocalWeekYear() {
39284
+ return this.isValid ? weeksInWeekYear(this.localWeekYear, this.loc.getMinDaysInFirstWeek(), this.loc.getStartOfWeek()) : NaN;
39285
+ }
39286
+
38804
39287
  /**
38805
39288
  * Returns the resolved Intl options for this DateTime.
38806
39289
  * This is useful in understanding the behavior of formatting methods
@@ -38912,6 +39395,9 @@ class DateTime {
38912
39395
  /**
38913
39396
  * "Set" the values of specified units. Returns a newly-constructed DateTime.
38914
39397
  * You can only set units with this method; for "setting" metadata, see {@link DateTime#reconfigure} and {@link DateTime#setZone}.
39398
+ *
39399
+ * This method also supports setting locale-based week units, i.e. `localWeekday`, `localWeekNumber` and `localWeekYear`.
39400
+ * They cannot be mixed with ISO-week units like `weekday`.
38915
39401
  * @param {Object} values - a mapping of units to numbers
38916
39402
  * @example dt.set({ year: 2017 })
38917
39403
  * @example dt.set({ hour: 8, minute: 30 })
@@ -38921,8 +39407,12 @@ class DateTime {
38921
39407
  */
38922
39408
  set(values) {
38923
39409
  if (!this.isValid) return this;
38924
- const normalized = normalizeObject(values, normalizeUnit),
38925
- settingWeekStuff = !isUndefined(normalized.weekYear) || !isUndefined(normalized.weekNumber) || !isUndefined(normalized.weekday),
39410
+ const normalized = normalizeObject(values, normalizeUnitWithLocalWeeks);
39411
+ const {
39412
+ minDaysInFirstWeek,
39413
+ startOfWeek
39414
+ } = usesLocalWeekValues(normalized, this.loc);
39415
+ const settingWeekStuff = !isUndefined(normalized.weekYear) || !isUndefined(normalized.weekNumber) || !isUndefined(normalized.weekday),
38926
39416
  containsOrdinal = !isUndefined(normalized.ordinal),
38927
39417
  containsGregorYear = !isUndefined(normalized.year),
38928
39418
  containsGregorMD = !isUndefined(normalized.month) || !isUndefined(normalized.day),
@@ -38937,9 +39427,9 @@ class DateTime {
38937
39427
  let mixed;
38938
39428
  if (settingWeekStuff) {
38939
39429
  mixed = weekToGregorian({
38940
- ...gregorianToWeek(this.c),
39430
+ ...gregorianToWeek(this.c, minDaysInFirstWeek, startOfWeek),
38941
39431
  ...normalized
38942
- });
39432
+ }, minDaysInFirstWeek, startOfWeek);
38943
39433
  } else if (!isUndefined(normalized.ordinal)) {
38944
39434
  mixed = ordinalToGregorian({
38945
39435
  ...gregorianToOrdinal(this.c),
@@ -38998,6 +39488,8 @@ class DateTime {
38998
39488
  /**
38999
39489
  * "Set" this DateTime to the beginning of a unit of time.
39000
39490
  * @param {string} unit - The unit to go to the beginning of. Can be 'year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', or 'millisecond'.
39491
+ * @param {Object} opts - options
39492
+ * @param {boolean} [opts.useLocaleWeeks=false] - If true, use weeks based on the locale, i.e. use the locale-dependent start of the week
39001
39493
  * @example DateTime.local(2014, 3, 3).startOf('month').toISODate(); //=> '2014-03-01'
39002
39494
  * @example DateTime.local(2014, 3, 3).startOf('year').toISODate(); //=> '2014-01-01'
39003
39495
  * @example DateTime.local(2014, 3, 3).startOf('week').toISODate(); //=> '2014-03-03', weeks always start on Mondays
@@ -39005,7 +39497,9 @@ class DateTime {
39005
39497
  * @example DateTime.local(2014, 3, 3, 5, 30).startOf('hour').toISOTime(); //=> '05:00:00.000-05:00'
39006
39498
  * @return {DateTime}
39007
39499
  */
39008
- startOf(unit) {
39500
+ startOf(unit, {
39501
+ useLocaleWeeks = false
39502
+ } = {}) {
39009
39503
  if (!this.isValid) return this;
39010
39504
  const o = {},
39011
39505
  normalizedUnit = Duration.normalizeUnit(unit);
@@ -39034,7 +39528,18 @@ class DateTime {
39034
39528
  }
39035
39529
 
39036
39530
  if (normalizedUnit === "weeks") {
39037
- o.weekday = 1;
39531
+ if (useLocaleWeeks) {
39532
+ const startOfWeek = this.loc.getStartOfWeek();
39533
+ const {
39534
+ weekday
39535
+ } = this;
39536
+ if (weekday < startOfWeek) {
39537
+ o.weekNumber = this.weekNumber - 1;
39538
+ }
39539
+ o.weekday = startOfWeek;
39540
+ } else {
39541
+ o.weekday = 1;
39542
+ }
39038
39543
  }
39039
39544
  if (normalizedUnit === "quarters") {
39040
39545
  const q = Math.ceil(this.month / 3);
@@ -39046,6 +39551,8 @@ class DateTime {
39046
39551
  /**
39047
39552
  * "Set" this DateTime to the end (meaning the last millisecond) of a unit of time
39048
39553
  * @param {string} unit - The unit to go to the end of. Can be 'year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', or 'millisecond'.
39554
+ * @param {Object} opts - options
39555
+ * @param {boolean} [opts.useLocaleWeeks=false] - If true, use weeks based on the locale, i.e. use the locale-dependent start of the week
39049
39556
  * @example DateTime.local(2014, 3, 3).endOf('month').toISO(); //=> '2014-03-31T23:59:59.999-05:00'
39050
39557
  * @example DateTime.local(2014, 3, 3).endOf('year').toISO(); //=> '2014-12-31T23:59:59.999-05:00'
39051
39558
  * @example DateTime.local(2014, 3, 3).endOf('week').toISO(); // => '2014-03-09T23:59:59.999-05:00', weeks start on Mondays
@@ -39053,10 +39560,10 @@ class DateTime {
39053
39560
  * @example DateTime.local(2014, 3, 3, 5, 30).endOf('hour').toISO(); //=> '2014-03-03T05:59:59.999-05:00'
39054
39561
  * @return {DateTime}
39055
39562
  */
39056
- endOf(unit) {
39563
+ endOf(unit, opts) {
39057
39564
  return this.isValid ? this.plus({
39058
39565
  [unit]: 1
39059
- }).startOf(unit).minus(1) : this;
39566
+ }).startOf(unit, opts).minus(1) : this;
39060
39567
  }
39061
39568
 
39062
39569
  // OUTPUT
@@ -39296,6 +39803,18 @@ class DateTime {
39296
39803
  return this.isValid ? this.toISO() : INVALID;
39297
39804
  }
39298
39805
 
39806
+ /**
39807
+ * Returns a string representation of this DateTime appropriate for the REPL.
39808
+ * @return {string}
39809
+ */
39810
+ [Symbol.for("nodejs.util.inspect.custom")]() {
39811
+ if (this.isValid) {
39812
+ return `DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }`;
39813
+ } else {
39814
+ return `DateTime { Invalid, reason: ${this.invalidReason} }`;
39815
+ }
39816
+ }
39817
+
39299
39818
  /**
39300
39819
  * Returns the epoch milliseconds of this DateTime. Alias of {@link DateTime#toMillis}
39301
39820
  * @return {number}
@@ -39433,16 +39952,18 @@ class DateTime {
39433
39952
  * Note that time zones are **ignored** in this comparison, which compares the **local** calendar time. Use {@link DateTime#setZone} to convert one of the dates if needed.
39434
39953
  * @param {DateTime} otherDateTime - the other DateTime
39435
39954
  * @param {string} unit - the unit of time to check sameness on
39955
+ * @param {Object} opts - options
39956
+ * @param {boolean} [opts.useLocaleWeeks=false] - If true, use weeks based on the locale, i.e. use the locale-dependent start of the week; only the locale of this DateTime is used
39436
39957
  * @example DateTime.now().hasSame(otherDT, 'day'); //~> true if otherDT is in the same current calendar day
39437
39958
  * @return {boolean}
39438
39959
  */
39439
- hasSame(otherDateTime, unit) {
39960
+ hasSame(otherDateTime, unit, opts) {
39440
39961
  if (!this.isValid) return false;
39441
39962
  const inputMs = otherDateTime.valueOf();
39442
39963
  const adjustedToZone = this.setZone(otherDateTime.zone, {
39443
39964
  keepLocalTime: true
39444
39965
  });
39445
- return adjustedToZone.startOf(unit) <= inputMs && inputMs <= adjustedToZone.endOf(unit);
39966
+ return adjustedToZone.startOf(unit, opts) <= inputMs && inputMs <= adjustedToZone.endOf(unit, opts);
39446
39967
  }
39447
39968
 
39448
39969
  /**
@@ -39766,7 +40287,7 @@ function friendlyDateTime(dateTimeish) {
39766
40287
  }
39767
40288
  }
39768
40289
 
39769
- const VERSION = "3.4.3";
40290
+ const VERSION = "3.4.4";
39770
40291
 
39771
40292
  exports.DateTime = DateTime;
39772
40293
  exports.Duration = Duration;
@@ -42370,6 +42891,58 @@ var Reflect;
42370
42891
  })(Reflect || (Reflect = {}));
42371
42892
 
42372
42893
 
42894
+ /***/ }),
42895
+
42896
+ /***/ "./node_modules/set-function-length/index.js":
42897
+ /*!***************************************************!*\
42898
+ !*** ./node_modules/set-function-length/index.js ***!
42899
+ \***************************************************/
42900
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
42901
+
42902
+ "use strict";
42903
+
42904
+
42905
+ var GetIntrinsic = __webpack_require__(/*! get-intrinsic */ "./node_modules/get-intrinsic/index.js");
42906
+ var define = __webpack_require__(/*! define-data-property */ "./node_modules/define-data-property/index.js");
42907
+ var hasDescriptors = __webpack_require__(/*! has-property-descriptors */ "./node_modules/has-property-descriptors/index.js")();
42908
+ var gOPD = __webpack_require__(/*! gopd */ "./node_modules/gopd/index.js");
42909
+
42910
+ var $TypeError = GetIntrinsic('%TypeError%');
42911
+ var $floor = GetIntrinsic('%Math.floor%');
42912
+
42913
+ module.exports = function setFunctionLength(fn, length) {
42914
+ if (typeof fn !== 'function') {
42915
+ throw new $TypeError('`fn` is not a function');
42916
+ }
42917
+ if (typeof length !== 'number' || length < 0 || length > 0xFFFFFFFF || $floor(length) !== length) {
42918
+ throw new $TypeError('`length` must be a positive 32-bit integer');
42919
+ }
42920
+
42921
+ var loose = arguments.length > 2 && !!arguments[2];
42922
+
42923
+ var functionLengthIsConfigurable = true;
42924
+ var functionLengthIsWritable = true;
42925
+ if ('length' in fn && gOPD) {
42926
+ var desc = gOPD(fn, 'length');
42927
+ if (desc && !desc.configurable) {
42928
+ functionLengthIsConfigurable = false;
42929
+ }
42930
+ if (desc && !desc.writable) {
42931
+ functionLengthIsWritable = false;
42932
+ }
42933
+ }
42934
+
42935
+ if (functionLengthIsConfigurable || functionLengthIsWritable || !loose) {
42936
+ if (hasDescriptors) {
42937
+ define(fn, 'length', length, true, true);
42938
+ } else {
42939
+ define(fn, 'length', length);
42940
+ }
42941
+ }
42942
+ return fn;
42943
+ };
42944
+
42945
+
42373
42946
  /***/ }),
42374
42947
 
42375
42948
  /***/ "./node_modules/side-channel/index.js":
@@ -42768,9 +43341,9 @@ const provider = new InternalProviderImpl();
42768
43341
 
42769
43342
  var InternalLogger = /*#__PURE__*/Object.freeze({
42770
43343
  __proto__: null,
43344
+ INTERNAL_LOGGING_SETTINGS: INTERNAL_LOGGING_SETTINGS,
42771
43345
  get InternalLogLevel () { return InternalLogLevel; },
42772
- getInternalLogger: getInternalLogger,
42773
- INTERNAL_LOGGING_SETTINGS: INTERNAL_LOGGING_SETTINGS
43346
+ getInternalLogger: getInternalLogger
42774
43347
  });
42775
43348
 
42776
43349
  /**
@@ -42778,13 +43351,14 @@ var InternalLogger = /*#__PURE__*/Object.freeze({
42778
43351
  */
42779
43352
  var LogLevel;
42780
43353
  (function (LogLevel) {
42781
- // Do not reverse/change order, a test relies on it.
43354
+ // Do not change values/order. Logging a message relies on this.
42782
43355
  LogLevel[LogLevel["Trace"] = 0] = "Trace";
42783
43356
  LogLevel[LogLevel["Debug"] = 1] = "Debug";
42784
43357
  LogLevel[LogLevel["Info"] = 2] = "Info";
42785
43358
  LogLevel[LogLevel["Warn"] = 3] = "Warn";
42786
43359
  LogLevel[LogLevel["Error"] = 4] = "Error";
42787
43360
  LogLevel[LogLevel["Fatal"] = 5] = "Fatal";
43361
+ LogLevel[LogLevel["Off"] = 6] = "Off";
42788
43362
  })(LogLevel || (LogLevel = {}));
42789
43363
  /* tslint:disable:no-namespace */
42790
43364
  (function (LogLevel) {
@@ -42806,6 +43380,8 @@ var LogLevel;
42806
43380
  return LogLevel.Error;
42807
43381
  case "fatal":
42808
43382
  return LogLevel.Fatal;
43383
+ case "off":
43384
+ return LogLevel.Off;
42809
43385
  default:
42810
43386
  return undefined;
42811
43387
  }
@@ -43181,9 +43757,9 @@ function createLogProvider(name, settings) {
43181
43757
  var index = /*#__PURE__*/Object.freeze({
43182
43758
  __proto__: null,
43183
43759
  EnhancedMap: EnhancedMap,
43184
- padStart: padStart,
43760
+ maxLengthStringValueInArray: maxLengthStringValueInArray,
43185
43761
  padEnd: padEnd,
43186
- maxLengthStringValueInArray: maxLengthStringValueInArray
43762
+ padStart: padStart
43187
43763
  });
43188
43764
 
43189
43765
  function log4TSGroupConfigDebug(config) {
@@ -43800,9 +44376,9 @@ const provider = new InternalProviderImpl();
43800
44376
 
43801
44377
  var InternalLogger = /*#__PURE__*/Object.freeze({
43802
44378
  __proto__: null,
44379
+ INTERNAL_LOGGING_SETTINGS: INTERNAL_LOGGING_SETTINGS,
43803
44380
  get InternalLogLevel () { return InternalLogLevel; },
43804
- getInternalLogger: getInternalLogger,
43805
- INTERNAL_LOGGING_SETTINGS: INTERNAL_LOGGING_SETTINGS
44381
+ getInternalLogger: getInternalLogger
43806
44382
  });
43807
44383
 
43808
44384
  /**
@@ -43810,13 +44386,14 @@ var InternalLogger = /*#__PURE__*/Object.freeze({
43810
44386
  */
43811
44387
  var LogLevel;
43812
44388
  (function (LogLevel) {
43813
- // Do not reverse/change order, a test relies on it.
44389
+ // Do not change values/order. Logging a message relies on this.
43814
44390
  LogLevel[LogLevel["Trace"] = 0] = "Trace";
43815
44391
  LogLevel[LogLevel["Debug"] = 1] = "Debug";
43816
44392
  LogLevel[LogLevel["Info"] = 2] = "Info";
43817
44393
  LogLevel[LogLevel["Warn"] = 3] = "Warn";
43818
44394
  LogLevel[LogLevel["Error"] = 4] = "Error";
43819
44395
  LogLevel[LogLevel["Fatal"] = 5] = "Fatal";
44396
+ LogLevel[LogLevel["Off"] = 6] = "Off";
43820
44397
  })(LogLevel || (LogLevel = {}));
43821
44398
  /* tslint:disable:no-namespace */
43822
44399
  (function (LogLevel) {
@@ -43838,6 +44415,8 @@ var LogLevel;
43838
44415
  return LogLevel.Error;
43839
44416
  case "fatal":
43840
44417
  return LogLevel.Fatal;
44418
+ case "off":
44419
+ return LogLevel.Off;
43841
44420
  default:
43842
44421
  return undefined;
43843
44422
  }
@@ -44213,9 +44792,9 @@ function createLogProvider(name, settings) {
44213
44792
  var index = /*#__PURE__*/Object.freeze({
44214
44793
  __proto__: null,
44215
44794
  EnhancedMap: EnhancedMap,
44216
- padStart: padStart,
44795
+ maxLengthStringValueInArray: maxLengthStringValueInArray,
44217
44796
  padEnd: padEnd,
44218
- maxLengthStringValueInArray: maxLengthStringValueInArray
44797
+ padStart: padStart
44219
44798
  });
44220
44799
 
44221
44800
  /**
@@ -44910,7 +45489,7 @@ for (let i = 0; i < 256; ++i) {
44910
45489
  function unsafeStringify(arr, offset = 0) {
44911
45490
  // Note: Be careful editing this code! It's been tuned for performance
44912
45491
  // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
44913
- return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
45492
+ return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];
44914
45493
  }
44915
45494
 
44916
45495
  function stringify(arr, offset = 0) {
@@ -45341,7 +45920,7 @@ module.exports = TSServal;
45341
45920
  /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
45342
45921
 
45343
45922
  "use strict";
45344
- // Axios v1.5.0 Copyright (c) 2023 Matt Zabriskie and contributors
45923
+ // Axios v1.6.1 Copyright (c) 2023 Matt Zabriskie and contributors
45345
45924
 
45346
45925
 
45347
45926
  function bind(fn, thisArg) {
@@ -46016,7 +46595,7 @@ const isAsyncFn = kindOfTest('AsyncFunction');
46016
46595
  const isThenable = (thing) =>
46017
46596
  thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
46018
46597
 
46019
- var utils = {
46598
+ var utils$1 = {
46020
46599
  isArray,
46021
46600
  isArrayBuffer,
46022
46601
  isBuffer,
@@ -46098,7 +46677,7 @@ function AxiosError(message, code, config, request, response) {
46098
46677
  response && (this.response = response);
46099
46678
  }
46100
46679
 
46101
- utils.inherits(AxiosError, Error, {
46680
+ utils$1.inherits(AxiosError, Error, {
46102
46681
  toJSON: function toJSON() {
46103
46682
  return {
46104
46683
  // Standard
@@ -46113,7 +46692,7 @@ utils.inherits(AxiosError, Error, {
46113
46692
  columnNumber: this.columnNumber,
46114
46693
  stack: this.stack,
46115
46694
  // Axios
46116
- config: utils.toJSONObject(this.config),
46695
+ config: utils$1.toJSONObject(this.config),
46117
46696
  code: this.code,
46118
46697
  status: this.response && this.response.status ? this.response.status : null
46119
46698
  };
@@ -46148,7 +46727,7 @@ Object.defineProperty(prototype$1, 'isAxiosError', {value: true});
46148
46727
  AxiosError.from = (error, code, config, request, response, customProps) => {
46149
46728
  const axiosError = Object.create(prototype$1);
46150
46729
 
46151
- utils.toFlatObject(error, axiosError, function filter(obj) {
46730
+ utils$1.toFlatObject(error, axiosError, function filter(obj) {
46152
46731
  return obj !== Error.prototype;
46153
46732
  }, prop => {
46154
46733
  return prop !== 'isAxiosError';
@@ -46176,7 +46755,7 @@ var httpAdapter = null;
46176
46755
  * @returns {boolean}
46177
46756
  */
46178
46757
  function isVisitable(thing) {
46179
- return utils.isPlainObject(thing) || utils.isArray(thing);
46758
+ return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
46180
46759
  }
46181
46760
 
46182
46761
  /**
@@ -46187,7 +46766,7 @@ function isVisitable(thing) {
46187
46766
  * @returns {string} the key without the brackets.
46188
46767
  */
46189
46768
  function removeBrackets(key) {
46190
- return utils.endsWith(key, '[]') ? key.slice(0, -2) : key;
46769
+ return utils$1.endsWith(key, '[]') ? key.slice(0, -2) : key;
46191
46770
  }
46192
46771
 
46193
46772
  /**
@@ -46216,10 +46795,10 @@ function renderKey(path, key, dots) {
46216
46795
  * @returns {boolean}
46217
46796
  */
46218
46797
  function isFlatArray(arr) {
46219
- return utils.isArray(arr) && !arr.some(isVisitable);
46798
+ return utils$1.isArray(arr) && !arr.some(isVisitable);
46220
46799
  }
46221
46800
 
46222
- const predicates = utils.toFlatObject(utils, {}, null, function filter(prop) {
46801
+ const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) {
46223
46802
  return /^is[A-Z]/.test(prop);
46224
46803
  });
46225
46804
 
@@ -46247,7 +46826,7 @@ const predicates = utils.toFlatObject(utils, {}, null, function filter(prop) {
46247
46826
  * @returns
46248
46827
  */
46249
46828
  function toFormData(obj, formData, options) {
46250
- if (!utils.isObject(obj)) {
46829
+ if (!utils$1.isObject(obj)) {
46251
46830
  throw new TypeError('target must be an object');
46252
46831
  }
46253
46832
 
@@ -46255,13 +46834,13 @@ function toFormData(obj, formData, options) {
46255
46834
  formData = formData || new (FormData)();
46256
46835
 
46257
46836
  // eslint-disable-next-line no-param-reassign
46258
- options = utils.toFlatObject(options, {
46837
+ options = utils$1.toFlatObject(options, {
46259
46838
  metaTokens: true,
46260
46839
  dots: false,
46261
46840
  indexes: false
46262
46841
  }, false, function defined(option, source) {
46263
46842
  // eslint-disable-next-line no-eq-null,eqeqeq
46264
- return !utils.isUndefined(source[option]);
46843
+ return !utils$1.isUndefined(source[option]);
46265
46844
  });
46266
46845
 
46267
46846
  const metaTokens = options.metaTokens;
@@ -46270,24 +46849,24 @@ function toFormData(obj, formData, options) {
46270
46849
  const dots = options.dots;
46271
46850
  const indexes = options.indexes;
46272
46851
  const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
46273
- const useBlob = _Blob && utils.isSpecCompliantForm(formData);
46852
+ const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
46274
46853
 
46275
- if (!utils.isFunction(visitor)) {
46854
+ if (!utils$1.isFunction(visitor)) {
46276
46855
  throw new TypeError('visitor must be a function');
46277
46856
  }
46278
46857
 
46279
46858
  function convertValue(value) {
46280
46859
  if (value === null) return '';
46281
46860
 
46282
- if (utils.isDate(value)) {
46861
+ if (utils$1.isDate(value)) {
46283
46862
  return value.toISOString();
46284
46863
  }
46285
46864
 
46286
- if (!useBlob && utils.isBlob(value)) {
46865
+ if (!useBlob && utils$1.isBlob(value)) {
46287
46866
  throw new AxiosError('Blob is not supported. Use a Buffer instead.');
46288
46867
  }
46289
46868
 
46290
- if (utils.isArrayBuffer(value) || utils.isTypedArray(value)) {
46869
+ if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
46291
46870
  return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
46292
46871
  }
46293
46872
 
@@ -46308,20 +46887,20 @@ function toFormData(obj, formData, options) {
46308
46887
  let arr = value;
46309
46888
 
46310
46889
  if (value && !path && typeof value === 'object') {
46311
- if (utils.endsWith(key, '{}')) {
46890
+ if (utils$1.endsWith(key, '{}')) {
46312
46891
  // eslint-disable-next-line no-param-reassign
46313
46892
  key = metaTokens ? key : key.slice(0, -2);
46314
46893
  // eslint-disable-next-line no-param-reassign
46315
46894
  value = JSON.stringify(value);
46316
46895
  } else if (
46317
- (utils.isArray(value) && isFlatArray(value)) ||
46318
- ((utils.isFileList(value) || utils.endsWith(key, '[]')) && (arr = utils.toArray(value))
46896
+ (utils$1.isArray(value) && isFlatArray(value)) ||
46897
+ ((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value))
46319
46898
  )) {
46320
46899
  // eslint-disable-next-line no-param-reassign
46321
46900
  key = removeBrackets(key);
46322
46901
 
46323
46902
  arr.forEach(function each(el, index) {
46324
- !(utils.isUndefined(el) || el === null) && formData.append(
46903
+ !(utils$1.isUndefined(el) || el === null) && formData.append(
46325
46904
  // eslint-disable-next-line no-nested-ternary
46326
46905
  indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'),
46327
46906
  convertValue(el)
@@ -46349,7 +46928,7 @@ function toFormData(obj, formData, options) {
46349
46928
  });
46350
46929
 
46351
46930
  function build(value, path) {
46352
- if (utils.isUndefined(value)) return;
46931
+ if (utils$1.isUndefined(value)) return;
46353
46932
 
46354
46933
  if (stack.indexOf(value) !== -1) {
46355
46934
  throw Error('Circular reference detected in ' + path.join('.'));
@@ -46357,9 +46936,9 @@ function toFormData(obj, formData, options) {
46357
46936
 
46358
46937
  stack.push(value);
46359
46938
 
46360
- utils.forEach(value, function each(el, key) {
46361
- const result = !(utils.isUndefined(el) || el === null) && visitor.call(
46362
- formData, el, utils.isString(key) ? key.trim() : key, path, exposedHelpers
46939
+ utils$1.forEach(value, function each(el, key) {
46940
+ const result = !(utils$1.isUndefined(el) || el === null) && visitor.call(
46941
+ formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers
46363
46942
  );
46364
46943
 
46365
46944
  if (result === true) {
@@ -46370,7 +46949,7 @@ function toFormData(obj, formData, options) {
46370
46949
  stack.pop();
46371
46950
  }
46372
46951
 
46373
- if (!utils.isObject(obj)) {
46952
+ if (!utils$1.isObject(obj)) {
46374
46953
  throw new TypeError('data must be an object');
46375
46954
  }
46376
46955
 
@@ -46474,7 +47053,7 @@ function buildURL(url, params, options) {
46474
47053
  if (serializeFn) {
46475
47054
  serializedParams = serializeFn(params, options);
46476
47055
  } else {
46477
- serializedParams = utils.isURLSearchParams(params) ?
47056
+ serializedParams = utils$1.isURLSearchParams(params) ?
46478
47057
  params.toString() :
46479
47058
  new AxiosURLSearchParams(params, options).toString(_encode);
46480
47059
  }
@@ -46549,7 +47128,7 @@ class InterceptorManager {
46549
47128
  * @returns {void}
46550
47129
  */
46551
47130
  forEach(fn) {
46552
- utils.forEach(this.handlers, function forEachHandler(h) {
47131
+ utils$1.forEach(this.handlers, function forEachHandler(h) {
46553
47132
  if (h !== null) {
46554
47133
  fn(h);
46555
47134
  }
@@ -46571,6 +47150,18 @@ var FormData$1 = typeof FormData !== 'undefined' ? FormData : null;
46571
47150
 
46572
47151
  var Blob$1 = typeof Blob !== 'undefined' ? Blob : null;
46573
47152
 
47153
+ var platform$1 = {
47154
+ isBrowser: true,
47155
+ classes: {
47156
+ URLSearchParams: URLSearchParams$1,
47157
+ FormData: FormData$1,
47158
+ Blob: Blob$1
47159
+ },
47160
+ protocols: ['http', 'https', 'file', 'blob', 'url', 'data']
47161
+ };
47162
+
47163
+ const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
47164
+
46574
47165
  /**
46575
47166
  * Determine if we're running in a standard browser environment
46576
47167
  *
@@ -46588,18 +47179,10 @@ var Blob$1 = typeof Blob !== 'undefined' ? Blob : null;
46588
47179
  *
46589
47180
  * @returns {boolean}
46590
47181
  */
46591
- const isStandardBrowserEnv = (() => {
46592
- let product;
46593
- if (typeof navigator !== 'undefined' && (
46594
- (product = navigator.product) === 'ReactNative' ||
46595
- product === 'NativeScript' ||
46596
- product === 'NS')
46597
- ) {
46598
- return false;
46599
- }
46600
-
46601
- return typeof window !== 'undefined' && typeof document !== 'undefined';
46602
- })();
47182
+ const hasStandardBrowserEnv = (
47183
+ (product) => {
47184
+ return hasBrowserEnv && ['ReactNative', 'NativeScript', 'NS'].indexOf(product) < 0
47185
+ })(typeof navigator !== 'undefined' && navigator.product);
46603
47186
 
46604
47187
  /**
46605
47188
  * Determine if we're running in a standard browser webWorker environment
@@ -46610,7 +47193,7 @@ const isStandardBrowserEnv = (() => {
46610
47193
  * `typeof window !== 'undefined' && typeof document !== 'undefined'`.
46611
47194
  * This leads to a problem when axios post `FormData` in webWorker
46612
47195
  */
46613
- const isStandardBrowserWebWorkerEnv = (() => {
47196
+ const hasStandardBrowserWebWorkerEnv = (() => {
46614
47197
  return (
46615
47198
  typeof WorkerGlobalScope !== 'undefined' &&
46616
47199
  // eslint-disable-next-line no-undef
@@ -46619,23 +47202,22 @@ const isStandardBrowserEnv = (() => {
46619
47202
  );
46620
47203
  })();
46621
47204
 
47205
+ var utils = /*#__PURE__*/Object.freeze({
47206
+ __proto__: null,
47207
+ hasBrowserEnv: hasBrowserEnv,
47208
+ hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
47209
+ hasStandardBrowserEnv: hasStandardBrowserEnv
47210
+ });
46622
47211
 
46623
47212
  var platform = {
46624
- isBrowser: true,
46625
- classes: {
46626
- URLSearchParams: URLSearchParams$1,
46627
- FormData: FormData$1,
46628
- Blob: Blob$1
46629
- },
46630
- isStandardBrowserEnv,
46631
- isStandardBrowserWebWorkerEnv,
46632
- protocols: ['http', 'https', 'file', 'blob', 'url', 'data']
47213
+ ...utils,
47214
+ ...platform$1
46633
47215
  };
46634
47216
 
46635
47217
  function toURLEncodedForm(data, options) {
46636
47218
  return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({
46637
47219
  visitor: function(value, key, path, helpers) {
46638
- if (platform.isNode && utils.isBuffer(value)) {
47220
+ if (platform.isNode && utils$1.isBuffer(value)) {
46639
47221
  this.append(key, value.toString('base64'));
46640
47222
  return false;
46641
47223
  }
@@ -46657,7 +47239,7 @@ function parsePropPath(name) {
46657
47239
  // foo.x.y.z
46658
47240
  // foo-x-y-z
46659
47241
  // foo x y z
46660
- return utils.matchAll(/\w+|\[(\w*)]/g, name).map(match => {
47242
+ return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map(match => {
46661
47243
  return match[0] === '[]' ? '' : match[1] || match[0];
46662
47244
  });
46663
47245
  }
@@ -46694,10 +47276,10 @@ function formDataToJSON(formData) {
46694
47276
  let name = path[index++];
46695
47277
  const isNumericKey = Number.isFinite(+name);
46696
47278
  const isLast = index >= path.length;
46697
- name = !name && utils.isArray(target) ? target.length : name;
47279
+ name = !name && utils$1.isArray(target) ? target.length : name;
46698
47280
 
46699
47281
  if (isLast) {
46700
- if (utils.hasOwnProp(target, name)) {
47282
+ if (utils$1.hasOwnProp(target, name)) {
46701
47283
  target[name] = [target[name], value];
46702
47284
  } else {
46703
47285
  target[name] = value;
@@ -46706,23 +47288,23 @@ function formDataToJSON(formData) {
46706
47288
  return !isNumericKey;
46707
47289
  }
46708
47290
 
46709
- if (!target[name] || !utils.isObject(target[name])) {
47291
+ if (!target[name] || !utils$1.isObject(target[name])) {
46710
47292
  target[name] = [];
46711
47293
  }
46712
47294
 
46713
47295
  const result = buildPath(path, value, target[name], index);
46714
47296
 
46715
- if (result && utils.isArray(target[name])) {
47297
+ if (result && utils$1.isArray(target[name])) {
46716
47298
  target[name] = arrayToObject(target[name]);
46717
47299
  }
46718
47300
 
46719
47301
  return !isNumericKey;
46720
47302
  }
46721
47303
 
46722
- if (utils.isFormData(formData) && utils.isFunction(formData.entries)) {
47304
+ if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {
46723
47305
  const obj = {};
46724
47306
 
46725
- utils.forEachEntry(formData, (name, value) => {
47307
+ utils$1.forEachEntry(formData, (name, value) => {
46726
47308
  buildPath(parsePropPath(name), value, obj, 0);
46727
47309
  });
46728
47310
 
@@ -46743,10 +47325,10 @@ function formDataToJSON(formData) {
46743
47325
  * @returns {string} A stringified version of the rawValue.
46744
47326
  */
46745
47327
  function stringifySafely(rawValue, parser, encoder) {
46746
- if (utils.isString(rawValue)) {
47328
+ if (utils$1.isString(rawValue)) {
46747
47329
  try {
46748
47330
  (parser || JSON.parse)(rawValue);
46749
- return utils.trim(rawValue);
47331
+ return utils$1.trim(rawValue);
46750
47332
  } catch (e) {
46751
47333
  if (e.name !== 'SyntaxError') {
46752
47334
  throw e;
@@ -46761,18 +47343,18 @@ const defaults = {
46761
47343
 
46762
47344
  transitional: transitionalDefaults,
46763
47345
 
46764
- adapter: platform.isNode ? 'http' : 'xhr',
47346
+ adapter: ['xhr', 'http'],
46765
47347
 
46766
47348
  transformRequest: [function transformRequest(data, headers) {
46767
47349
  const contentType = headers.getContentType() || '';
46768
47350
  const hasJSONContentType = contentType.indexOf('application/json') > -1;
46769
- const isObjectPayload = utils.isObject(data);
47351
+ const isObjectPayload = utils$1.isObject(data);
46770
47352
 
46771
- if (isObjectPayload && utils.isHTMLForm(data)) {
47353
+ if (isObjectPayload && utils$1.isHTMLForm(data)) {
46772
47354
  data = new FormData(data);
46773
47355
  }
46774
47356
 
46775
- const isFormData = utils.isFormData(data);
47357
+ const isFormData = utils$1.isFormData(data);
46776
47358
 
46777
47359
  if (isFormData) {
46778
47360
  if (!hasJSONContentType) {
@@ -46781,18 +47363,18 @@ const defaults = {
46781
47363
  return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
46782
47364
  }
46783
47365
 
46784
- if (utils.isArrayBuffer(data) ||
46785
- utils.isBuffer(data) ||
46786
- utils.isStream(data) ||
46787
- utils.isFile(data) ||
46788
- utils.isBlob(data)
47366
+ if (utils$1.isArrayBuffer(data) ||
47367
+ utils$1.isBuffer(data) ||
47368
+ utils$1.isStream(data) ||
47369
+ utils$1.isFile(data) ||
47370
+ utils$1.isBlob(data)
46789
47371
  ) {
46790
47372
  return data;
46791
47373
  }
46792
- if (utils.isArrayBufferView(data)) {
47374
+ if (utils$1.isArrayBufferView(data)) {
46793
47375
  return data.buffer;
46794
47376
  }
46795
- if (utils.isURLSearchParams(data)) {
47377
+ if (utils$1.isURLSearchParams(data)) {
46796
47378
  headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
46797
47379
  return data.toString();
46798
47380
  }
@@ -46804,7 +47386,7 @@ const defaults = {
46804
47386
  return toURLEncodedForm(data, this.formSerializer).toString();
46805
47387
  }
46806
47388
 
46807
- if ((isFileList = utils.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
47389
+ if ((isFileList = utils$1.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
46808
47390
  const _FormData = this.env && this.env.FormData;
46809
47391
 
46810
47392
  return toFormData(
@@ -46828,7 +47410,7 @@ const defaults = {
46828
47410
  const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
46829
47411
  const JSONRequested = this.responseType === 'json';
46830
47412
 
46831
- if (data && utils.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
47413
+ if (data && utils$1.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
46832
47414
  const silentJSONParsing = transitional && transitional.silentJSONParsing;
46833
47415
  const strictJSONParsing = !silentJSONParsing && JSONRequested;
46834
47416
 
@@ -46876,7 +47458,7 @@ const defaults = {
46876
47458
  }
46877
47459
  };
46878
47460
 
46879
- utils.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
47461
+ utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
46880
47462
  defaults.headers[method] = {};
46881
47463
  });
46882
47464
 
@@ -46884,7 +47466,7 @@ var defaults$1 = defaults;
46884
47466
 
46885
47467
  // RawAxiosHeaders whose duplicates are ignored by node
46886
47468
  // c.f. https://nodejs.org/api/http.html#http_message_headers
46887
- const ignoreDuplicateOf = utils.toObjectSet([
47469
+ const ignoreDuplicateOf = utils$1.toObjectSet([
46888
47470
  'age', 'authorization', 'content-length', 'content-type', 'etag',
46889
47471
  'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
46890
47472
  'last-modified', 'location', 'max-forwards', 'proxy-authorization',
@@ -46945,7 +47527,7 @@ function normalizeValue(value) {
46945
47527
  return value;
46946
47528
  }
46947
47529
 
46948
- return utils.isArray(value) ? value.map(normalizeValue) : String(value);
47530
+ return utils$1.isArray(value) ? value.map(normalizeValue) : String(value);
46949
47531
  }
46950
47532
 
46951
47533
  function parseTokens(str) {
@@ -46963,7 +47545,7 @@ function parseTokens(str) {
46963
47545
  const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
46964
47546
 
46965
47547
  function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
46966
- if (utils.isFunction(filter)) {
47548
+ if (utils$1.isFunction(filter)) {
46967
47549
  return filter.call(this, value, header);
46968
47550
  }
46969
47551
 
@@ -46971,13 +47553,13 @@ function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
46971
47553
  value = header;
46972
47554
  }
46973
47555
 
46974
- if (!utils.isString(value)) return;
47556
+ if (!utils$1.isString(value)) return;
46975
47557
 
46976
- if (utils.isString(filter)) {
47558
+ if (utils$1.isString(filter)) {
46977
47559
  return value.indexOf(filter) !== -1;
46978
47560
  }
46979
47561
 
46980
- if (utils.isRegExp(filter)) {
47562
+ if (utils$1.isRegExp(filter)) {
46981
47563
  return filter.test(value);
46982
47564
  }
46983
47565
  }
@@ -46990,7 +47572,7 @@ function formatHeader(header) {
46990
47572
  }
46991
47573
 
46992
47574
  function buildAccessors(obj, header) {
46993
- const accessorName = utils.toCamelCase(' ' + header);
47575
+ const accessorName = utils$1.toCamelCase(' ' + header);
46994
47576
 
46995
47577
  ['get', 'set', 'has'].forEach(methodName => {
46996
47578
  Object.defineProperty(obj, methodName + accessorName, {
@@ -47017,7 +47599,7 @@ class AxiosHeaders {
47017
47599
  throw new Error('header name must be a non-empty string');
47018
47600
  }
47019
47601
 
47020
- const key = utils.findKey(self, lHeader);
47602
+ const key = utils$1.findKey(self, lHeader);
47021
47603
 
47022
47604
  if(!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) {
47023
47605
  self[key || _header] = normalizeValue(_value);
@@ -47025,11 +47607,11 @@ class AxiosHeaders {
47025
47607
  }
47026
47608
 
47027
47609
  const setHeaders = (headers, _rewrite) =>
47028
- utils.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
47610
+ utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
47029
47611
 
47030
- if (utils.isPlainObject(header) || header instanceof this.constructor) {
47612
+ if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
47031
47613
  setHeaders(header, valueOrRewrite);
47032
- } else if(utils.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
47614
+ } else if(utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
47033
47615
  setHeaders(parseHeaders(header), valueOrRewrite);
47034
47616
  } else {
47035
47617
  header != null && setHeader(valueOrRewrite, header, rewrite);
@@ -47042,7 +47624,7 @@ class AxiosHeaders {
47042
47624
  header = normalizeHeader(header);
47043
47625
 
47044
47626
  if (header) {
47045
- const key = utils.findKey(this, header);
47627
+ const key = utils$1.findKey(this, header);
47046
47628
 
47047
47629
  if (key) {
47048
47630
  const value = this[key];
@@ -47055,11 +47637,11 @@ class AxiosHeaders {
47055
47637
  return parseTokens(value);
47056
47638
  }
47057
47639
 
47058
- if (utils.isFunction(parser)) {
47640
+ if (utils$1.isFunction(parser)) {
47059
47641
  return parser.call(this, value, key);
47060
47642
  }
47061
47643
 
47062
- if (utils.isRegExp(parser)) {
47644
+ if (utils$1.isRegExp(parser)) {
47063
47645
  return parser.exec(value);
47064
47646
  }
47065
47647
 
@@ -47072,7 +47654,7 @@ class AxiosHeaders {
47072
47654
  header = normalizeHeader(header);
47073
47655
 
47074
47656
  if (header) {
47075
- const key = utils.findKey(this, header);
47657
+ const key = utils$1.findKey(this, header);
47076
47658
 
47077
47659
  return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
47078
47660
  }
@@ -47088,7 +47670,7 @@ class AxiosHeaders {
47088
47670
  _header = normalizeHeader(_header);
47089
47671
 
47090
47672
  if (_header) {
47091
- const key = utils.findKey(self, _header);
47673
+ const key = utils$1.findKey(self, _header);
47092
47674
 
47093
47675
  if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
47094
47676
  delete self[key];
@@ -47098,7 +47680,7 @@ class AxiosHeaders {
47098
47680
  }
47099
47681
  }
47100
47682
 
47101
- if (utils.isArray(header)) {
47683
+ if (utils$1.isArray(header)) {
47102
47684
  header.forEach(deleteHeader);
47103
47685
  } else {
47104
47686
  deleteHeader(header);
@@ -47127,8 +47709,8 @@ class AxiosHeaders {
47127
47709
  const self = this;
47128
47710
  const headers = {};
47129
47711
 
47130
- utils.forEach(this, (value, header) => {
47131
- const key = utils.findKey(headers, header);
47712
+ utils$1.forEach(this, (value, header) => {
47713
+ const key = utils$1.findKey(headers, header);
47132
47714
 
47133
47715
  if (key) {
47134
47716
  self[key] = normalizeValue(value);
@@ -47157,8 +47739,8 @@ class AxiosHeaders {
47157
47739
  toJSON(asStrings) {
47158
47740
  const obj = Object.create(null);
47159
47741
 
47160
- utils.forEach(this, (value, header) => {
47161
- value != null && value !== false && (obj[header] = asStrings && utils.isArray(value) ? value.join(', ') : value);
47742
+ utils$1.forEach(this, (value, header) => {
47743
+ value != null && value !== false && (obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value);
47162
47744
  });
47163
47745
 
47164
47746
  return obj;
@@ -47205,7 +47787,7 @@ class AxiosHeaders {
47205
47787
  }
47206
47788
  }
47207
47789
 
47208
- utils.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
47790
+ utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
47209
47791
 
47210
47792
  return this;
47211
47793
  }
@@ -47214,7 +47796,7 @@ class AxiosHeaders {
47214
47796
  AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);
47215
47797
 
47216
47798
  // reserved names hotfix
47217
- utils.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => {
47799
+ utils$1.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => {
47218
47800
  let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
47219
47801
  return {
47220
47802
  get: () => value,
@@ -47224,7 +47806,7 @@ utils.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => {
47224
47806
  }
47225
47807
  });
47226
47808
 
47227
- utils.freezeMethods(AxiosHeaders);
47809
+ utils$1.freezeMethods(AxiosHeaders);
47228
47810
 
47229
47811
  var AxiosHeaders$1 = AxiosHeaders;
47230
47812
 
@@ -47242,7 +47824,7 @@ function transformData(fns, response) {
47242
47824
  const headers = AxiosHeaders$1.from(context.headers);
47243
47825
  let data = context.data;
47244
47826
 
47245
- utils.forEach(fns, function transform(fn) {
47827
+ utils$1.forEach(fns, function transform(fn) {
47246
47828
  data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);
47247
47829
  });
47248
47830
 
@@ -47270,7 +47852,7 @@ function CanceledError(message, config, request) {
47270
47852
  this.name = 'CanceledError';
47271
47853
  }
47272
47854
 
47273
- utils.inherits(CanceledError, AxiosError, {
47855
+ utils$1.inherits(CanceledError, AxiosError, {
47274
47856
  __CANCEL__: true
47275
47857
  });
47276
47858
 
@@ -47298,7 +47880,7 @@ function settle(resolve, reject, response) {
47298
47880
  }
47299
47881
  }
47300
47882
 
47301
- var cookies = platform.isStandardBrowserEnv ?
47883
+ var cookies = platform.hasStandardBrowserEnv ?
47302
47884
 
47303
47885
  // Standard browser envs support document.cookie
47304
47886
  (function standardBrowserEnv() {
@@ -47307,15 +47889,15 @@ var cookies = platform.isStandardBrowserEnv ?
47307
47889
  const cookie = [];
47308
47890
  cookie.push(name + '=' + encodeURIComponent(value));
47309
47891
 
47310
- if (utils.isNumber(expires)) {
47892
+ if (utils$1.isNumber(expires)) {
47311
47893
  cookie.push('expires=' + new Date(expires).toGMTString());
47312
47894
  }
47313
47895
 
47314
- if (utils.isString(path)) {
47896
+ if (utils$1.isString(path)) {
47315
47897
  cookie.push('path=' + path);
47316
47898
  }
47317
47899
 
47318
- if (utils.isString(domain)) {
47900
+ if (utils$1.isString(domain)) {
47319
47901
  cookie.push('domain=' + domain);
47320
47902
  }
47321
47903
 
@@ -47391,7 +47973,7 @@ function buildFullPath(baseURL, requestedURL) {
47391
47973
  return requestedURL;
47392
47974
  }
47393
47975
 
47394
- var isURLSameOrigin = platform.isStandardBrowserEnv ?
47976
+ var isURLSameOrigin = platform.hasStandardBrowserEnv ?
47395
47977
 
47396
47978
  // Standard browser envs have full support of the APIs needed to test
47397
47979
  // whether the request URL is of the same origin as current location.
@@ -47441,7 +48023,7 @@ var isURLSameOrigin = platform.isStandardBrowserEnv ?
47441
48023
  * @returns {boolean} True if URL shares the same origin, otherwise false
47442
48024
  */
47443
48025
  return function isURLSameOrigin(requestURL) {
47444
- const parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
48026
+ const parsed = (utils$1.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
47445
48027
  return (parsed.protocol === originURL.protocol &&
47446
48028
  parsed.host === originURL.host);
47447
48029
  };
@@ -47558,11 +48140,15 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
47558
48140
  }
47559
48141
  }
47560
48142
 
47561
- if (utils.isFormData(requestData)) {
47562
- if (platform.isStandardBrowserEnv || platform.isStandardBrowserWebWorkerEnv) {
48143
+ let contentType;
48144
+
48145
+ if (utils$1.isFormData(requestData)) {
48146
+ if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
47563
48147
  requestHeaders.setContentType(false); // Let the browser set it
47564
- } else {
47565
- requestHeaders.setContentType('multipart/form-data;', false); // mobile/desktop app frameworks
48148
+ } else if ((contentType = requestHeaders.getContentType()) !== false) {
48149
+ // fix semicolon duplication issue for ReactNative FormData implementation
48150
+ const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : [];
48151
+ requestHeaders.setContentType([type || 'multipart/form-data', ...tokens].join('; '));
47566
48152
  }
47567
48153
  }
47568
48154
 
@@ -47678,10 +48264,10 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
47678
48264
  // Add xsrf header
47679
48265
  // This is only done if running in a standard browser environment.
47680
48266
  // Specifically not if we're in a web worker, or react-native.
47681
- if (platform.isStandardBrowserEnv) {
48267
+ if (platform.hasStandardBrowserEnv) {
47682
48268
  // Add xsrf header
47683
- const xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath))
47684
- && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
48269
+ // regarding CVE-2023-45857 config.withCredentials condition was removed temporarily
48270
+ const xsrfValue = isURLSameOrigin(fullPath) && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
47685
48271
 
47686
48272
  if (xsrfValue) {
47687
48273
  requestHeaders.set(config.xsrfHeaderName, xsrfValue);
@@ -47693,13 +48279,13 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
47693
48279
 
47694
48280
  // Add headers to the request
47695
48281
  if ('setRequestHeader' in request) {
47696
- utils.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
48282
+ utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
47697
48283
  request.setRequestHeader(key, val);
47698
48284
  });
47699
48285
  }
47700
48286
 
47701
48287
  // Add withCredentials to request if needed
47702
- if (!utils.isUndefined(config.withCredentials)) {
48288
+ if (!utils$1.isUndefined(config.withCredentials)) {
47703
48289
  request.withCredentials = !!config.withCredentials;
47704
48290
  }
47705
48291
 
@@ -47754,8 +48340,8 @@ const knownAdapters = {
47754
48340
  xhr: xhrAdapter
47755
48341
  };
47756
48342
 
47757
- utils.forEach(knownAdapters, (fn, value) => {
47758
- if(fn) {
48343
+ utils$1.forEach(knownAdapters, (fn, value) => {
48344
+ if (fn) {
47759
48345
  try {
47760
48346
  Object.defineProperty(fn, 'name', {value});
47761
48347
  } catch (e) {
@@ -47765,38 +48351,56 @@ utils.forEach(knownAdapters, (fn, value) => {
47765
48351
  }
47766
48352
  });
47767
48353
 
48354
+ const renderReason = (reason) => `- ${reason}`;
48355
+
48356
+ const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false;
48357
+
47768
48358
  var adapters = {
47769
48359
  getAdapter: (adapters) => {
47770
- adapters = utils.isArray(adapters) ? adapters : [adapters];
48360
+ adapters = utils$1.isArray(adapters) ? adapters : [adapters];
47771
48361
 
47772
48362
  const {length} = adapters;
47773
48363
  let nameOrAdapter;
47774
48364
  let adapter;
47775
48365
 
48366
+ const rejectedReasons = {};
48367
+
47776
48368
  for (let i = 0; i < length; i++) {
47777
48369
  nameOrAdapter = adapters[i];
47778
- if((adapter = utils.isString(nameOrAdapter) ? knownAdapters[nameOrAdapter.toLowerCase()] : nameOrAdapter)) {
48370
+ let id;
48371
+
48372
+ adapter = nameOrAdapter;
48373
+
48374
+ if (!isResolvedHandle(nameOrAdapter)) {
48375
+ adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
48376
+
48377
+ if (adapter === undefined) {
48378
+ throw new AxiosError(`Unknown adapter '${id}'`);
48379
+ }
48380
+ }
48381
+
48382
+ if (adapter) {
47779
48383
  break;
47780
48384
  }
48385
+
48386
+ rejectedReasons[id || '#' + i] = adapter;
47781
48387
  }
47782
48388
 
47783
48389
  if (!adapter) {
47784
- if (adapter === false) {
47785
- throw new AxiosError(
47786
- `Adapter ${nameOrAdapter} is not supported by the environment`,
47787
- 'ERR_NOT_SUPPORT'
48390
+
48391
+ const reasons = Object.entries(rejectedReasons)
48392
+ .map(([id, state]) => `adapter ${id} ` +
48393
+ (state === false ? 'is not supported by the environment' : 'is not available in the build')
47788
48394
  );
47789
- }
47790
48395
 
47791
- throw new Error(
47792
- utils.hasOwnProp(knownAdapters, nameOrAdapter) ?
47793
- `Adapter '${nameOrAdapter}' is not available in the build` :
47794
- `Unknown adapter '${nameOrAdapter}'`
47795
- );
47796
- }
48396
+ let s = length ?
48397
+ (reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0])) :
48398
+ 'as no adapter specified';
47797
48399
 
47798
- if (!utils.isFunction(adapter)) {
47799
- throw new TypeError('adapter is not a function');
48400
+ throw new AxiosError(
48401
+ `There is no suitable adapter to dispatch the request ` + s,
48402
+ 'ERR_NOT_SUPPORT'
48403
+ );
47800
48404
  }
47801
48405
 
47802
48406
  return adapter;
@@ -47894,11 +48498,11 @@ function mergeConfig(config1, config2) {
47894
48498
  const config = {};
47895
48499
 
47896
48500
  function getMergedValue(target, source, caseless) {
47897
- if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
47898
- return utils.merge.call({caseless}, target, source);
47899
- } else if (utils.isPlainObject(source)) {
47900
- return utils.merge({}, source);
47901
- } else if (utils.isArray(source)) {
48501
+ if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
48502
+ return utils$1.merge.call({caseless}, target, source);
48503
+ } else if (utils$1.isPlainObject(source)) {
48504
+ return utils$1.merge({}, source);
48505
+ } else if (utils$1.isArray(source)) {
47902
48506
  return source.slice();
47903
48507
  }
47904
48508
  return source;
@@ -47906,25 +48510,25 @@ function mergeConfig(config1, config2) {
47906
48510
 
47907
48511
  // eslint-disable-next-line consistent-return
47908
48512
  function mergeDeepProperties(a, b, caseless) {
47909
- if (!utils.isUndefined(b)) {
48513
+ if (!utils$1.isUndefined(b)) {
47910
48514
  return getMergedValue(a, b, caseless);
47911
- } else if (!utils.isUndefined(a)) {
48515
+ } else if (!utils$1.isUndefined(a)) {
47912
48516
  return getMergedValue(undefined, a, caseless);
47913
48517
  }
47914
48518
  }
47915
48519
 
47916
48520
  // eslint-disable-next-line consistent-return
47917
48521
  function valueFromConfig2(a, b) {
47918
- if (!utils.isUndefined(b)) {
48522
+ if (!utils$1.isUndefined(b)) {
47919
48523
  return getMergedValue(undefined, b);
47920
48524
  }
47921
48525
  }
47922
48526
 
47923
48527
  // eslint-disable-next-line consistent-return
47924
48528
  function defaultToConfig2(a, b) {
47925
- if (!utils.isUndefined(b)) {
48529
+ if (!utils$1.isUndefined(b)) {
47926
48530
  return getMergedValue(undefined, b);
47927
- } else if (!utils.isUndefined(a)) {
48531
+ } else if (!utils$1.isUndefined(a)) {
47928
48532
  return getMergedValue(undefined, a);
47929
48533
  }
47930
48534
  }
@@ -47969,16 +48573,16 @@ function mergeConfig(config1, config2) {
47969
48573
  headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)
47970
48574
  };
47971
48575
 
47972
- utils.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
48576
+ utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
47973
48577
  const merge = mergeMap[prop] || mergeDeepProperties;
47974
48578
  const configValue = merge(config1[prop], config2[prop], prop);
47975
- (utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
48579
+ (utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
47976
48580
  });
47977
48581
 
47978
48582
  return config;
47979
48583
  }
47980
48584
 
47981
- const VERSION = "1.5.0";
48585
+ const VERSION = "1.6.1";
47982
48586
 
47983
48587
  const validators$1 = {};
47984
48588
 
@@ -48116,7 +48720,7 @@ class Axios {
48116
48720
  }
48117
48721
 
48118
48722
  if (paramsSerializer != null) {
48119
- if (utils.isFunction(paramsSerializer)) {
48723
+ if (utils$1.isFunction(paramsSerializer)) {
48120
48724
  config.paramsSerializer = {
48121
48725
  serialize: paramsSerializer
48122
48726
  };
@@ -48132,12 +48736,12 @@ class Axios {
48132
48736
  config.method = (config.method || this.defaults.method || 'get').toLowerCase();
48133
48737
 
48134
48738
  // Flatten headers
48135
- let contextHeaders = headers && utils.merge(
48739
+ let contextHeaders = headers && utils$1.merge(
48136
48740
  headers.common,
48137
48741
  headers[config.method]
48138
48742
  );
48139
48743
 
48140
- headers && utils.forEach(
48744
+ headers && utils$1.forEach(
48141
48745
  ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
48142
48746
  (method) => {
48143
48747
  delete headers[method];
@@ -48224,7 +48828,7 @@ class Axios {
48224
48828
  }
48225
48829
 
48226
48830
  // Provide aliases for supported request methods
48227
- utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
48831
+ utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
48228
48832
  /*eslint func-names:0*/
48229
48833
  Axios.prototype[method] = function(url, config) {
48230
48834
  return this.request(mergeConfig(config || {}, {
@@ -48235,7 +48839,7 @@ utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData
48235
48839
  };
48236
48840
  });
48237
48841
 
48238
- utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
48842
+ utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
48239
48843
  /*eslint func-names:0*/
48240
48844
 
48241
48845
  function generateHTTPMethod(isForm) {
@@ -48411,7 +49015,7 @@ function spread(callback) {
48411
49015
  * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
48412
49016
  */
48413
49017
  function isAxiosError(payload) {
48414
- return utils.isObject(payload) && (payload.isAxiosError === true);
49018
+ return utils$1.isObject(payload) && (payload.isAxiosError === true);
48415
49019
  }
48416
49020
 
48417
49021
  const HttpStatusCode = {
@@ -48498,10 +49102,10 @@ function createInstance(defaultConfig) {
48498
49102
  const instance = bind(Axios$1.prototype.request, context);
48499
49103
 
48500
49104
  // Copy axios.prototype to instance
48501
- utils.extend(instance, Axios$1.prototype, context, {allOwnKeys: true});
49105
+ utils$1.extend(instance, Axios$1.prototype, context, {allOwnKeys: true});
48502
49106
 
48503
49107
  // Copy context to instance
48504
- utils.extend(instance, context, null, {allOwnKeys: true});
49108
+ utils$1.extend(instance, context, null, {allOwnKeys: true});
48505
49109
 
48506
49110
  // Factory for creating new instances
48507
49111
  instance.create = function create(instanceConfig) {
@@ -48545,7 +49149,7 @@ axios.mergeConfig = mergeConfig;
48545
49149
 
48546
49150
  axios.AxiosHeaders = AxiosHeaders$1;
48547
49151
 
48548
- axios.formToJSON = thing => formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing);
49152
+ axios.formToJSON = thing => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
48549
49153
 
48550
49154
  axios.getAdapter = adapters.getAdapter;
48551
49155