@carbon/ibmdotcom-services 2.38.0 → 2.40.0

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.
@@ -829,6 +829,13 @@
829
829
  })(slicedToArray);
830
830
  var _slicedToArray = /*@__PURE__*/getDefaultExportFromCjs(slicedToArray.exports);
831
831
 
832
+ /**
833
+ * Create a bound version of a function with a specified `this` context
834
+ *
835
+ * @param {Function} fn - The function to bind
836
+ * @param {*} thisArg - The value to be passed as the `this` parameter
837
+ * @returns {Function} A new function that will call the original function with the specified `this` context
838
+ */
832
839
  function bind(fn, thisArg) {
833
840
  return function wrap() {
834
841
  return fn.apply(thisArg, arguments);
@@ -839,6 +846,8 @@
839
846
 
840
847
  var toString = Object.prototype.toString;
841
848
  var getPrototypeOf = Object.getPrototypeOf;
849
+ var iterator = Symbol.iterator,
850
+ toStringTag = Symbol.toStringTag;
842
851
  var kindOf = function (cache) {
843
852
  return function (thing) {
844
853
  var str = toString.call(thing);
@@ -883,7 +892,7 @@
883
892
  * @returns {boolean} True if value is a Buffer, otherwise false
884
893
  */
885
894
  function isBuffer(val) {
886
- return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);
895
+ return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) && isFunction$1(val.constructor.isBuffer) && val.constructor.isBuffer(val);
887
896
  }
888
897
 
889
898
  /**
@@ -927,7 +936,7 @@
927
936
  * @param {*} val The value to test
928
937
  * @returns {boolean} True if value is a Function, otherwise false
929
938
  */
930
- var isFunction = typeOfTest('function');
939
+ var isFunction$1 = typeOfTest('function');
931
940
 
932
941
  /**
933
942
  * Determine if a value is a Number
@@ -971,7 +980,27 @@
971
980
  return false;
972
981
  }
973
982
  var prototype = getPrototypeOf(val);
974
- return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val);
983
+ return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(toStringTag in val) && !(iterator in val);
984
+ };
985
+
986
+ /**
987
+ * Determine if a value is an empty object (safely handles Buffers)
988
+ *
989
+ * @param {*} val The value to test
990
+ *
991
+ * @returns {boolean} True if value is an empty object, otherwise false
992
+ */
993
+ var isEmptyObject = function isEmptyObject(val) {
994
+ // Early return for non-objects or Buffers to prevent RangeError
995
+ if (!isObject(val) || isBuffer(val)) {
996
+ return false;
997
+ }
998
+ try {
999
+ return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
1000
+ } catch (e) {
1001
+ // Fallback for any other objects that might cause RangeError with Object.keys()
1002
+ return false;
1003
+ }
975
1004
  };
976
1005
 
977
1006
  /**
@@ -1018,7 +1047,7 @@
1018
1047
  * @returns {boolean} True if value is a Stream, otherwise false
1019
1048
  */
1020
1049
  var isStream = function isStream(val) {
1021
- return isObject(val) && isFunction(val.pipe);
1050
+ return isObject(val) && isFunction$1(val.pipe);
1022
1051
  };
1023
1052
 
1024
1053
  /**
@@ -1030,9 +1059,9 @@
1030
1059
  */
1031
1060
  var isFormData = function isFormData(thing) {
1032
1061
  var kind;
1033
- return thing && (typeof FormData === 'function' && thing instanceof FormData || isFunction(thing.append) && ((kind = kindOf(thing)) === 'formdata' ||
1062
+ return thing && (typeof FormData === 'function' && thing instanceof FormData || isFunction$1(thing.append) && ((kind = kindOf(thing)) === 'formdata' ||
1034
1063
  // detect form-data instance
1035
- kind === 'object' && isFunction(thing.toString) && thing.toString() === '[object FormData]'));
1064
+ kind === 'object' && isFunction$1(thing.toString) && thing.toString() === '[object FormData]'));
1036
1065
  };
1037
1066
 
1038
1067
  /**
@@ -1098,6 +1127,11 @@
1098
1127
  fn.call(null, obj[i], i, obj);
1099
1128
  }
1100
1129
  } else {
1130
+ // Buffer check
1131
+ if (isBuffer(obj)) {
1132
+ return;
1133
+ }
1134
+
1101
1135
  // Iterate over object keys
1102
1136
  var keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
1103
1137
  var len = keys.length;
@@ -1109,6 +1143,9 @@
1109
1143
  }
1110
1144
  }
1111
1145
  function findKey(obj, key) {
1146
+ if (isBuffer(obj)) {
1147
+ return null;
1148
+ }
1112
1149
  key = key.toLowerCase();
1113
1150
  var keys = Object.keys(obj);
1114
1151
  var i = keys.length;
@@ -1148,10 +1185,11 @@
1148
1185
  *
1149
1186
  * @returns {Object} Result of all merge properties
1150
1187
  */
1151
- function merge( /* obj1, obj2, obj3, ... */
1188
+ function merge(/* obj1, obj2, obj3, ... */
1152
1189
  ) {
1153
1190
  var _ref2 = isContextDefined(this) && this || {},
1154
- caseless = _ref2.caseless;
1191
+ caseless = _ref2.caseless,
1192
+ skipUndefined = _ref2.skipUndefined;
1155
1193
  var result = {};
1156
1194
  var assignValue = function assignValue(val, key) {
1157
1195
  var targetKey = caseless && findKey(result, key) || key;
@@ -1161,7 +1199,7 @@
1161
1199
  result[targetKey] = merge({}, val);
1162
1200
  } else if (isArray(val)) {
1163
1201
  result[targetKey] = val.slice();
1164
- } else {
1202
+ } else if (!skipUndefined || !isUndefined(val)) {
1165
1203
  result[targetKey] = val;
1166
1204
  }
1167
1205
  };
@@ -1185,7 +1223,7 @@
1185
1223
  var _ref3 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {},
1186
1224
  allOwnKeys = _ref3.allOwnKeys;
1187
1225
  forEach(b, function (val, key) {
1188
- if (thisArg && isFunction(val)) {
1226
+ if (thisArg && isFunction$1(val)) {
1189
1227
  a[key] = bind(val, thisArg);
1190
1228
  } else {
1191
1229
  a[key] = val;
@@ -1286,7 +1324,7 @@
1286
1324
  *
1287
1325
  * @returns {?Array}
1288
1326
  */
1289
- var toArray$1 = function toArray(thing) {
1327
+ var toArray = function toArray(thing) {
1290
1328
  if (!thing) return null;
1291
1329
  if (isArray(thing)) return thing;
1292
1330
  var i = thing.length;
@@ -1323,10 +1361,10 @@
1323
1361
  * @returns {void}
1324
1362
  */
1325
1363
  var forEachEntry = function forEachEntry(obj, fn) {
1326
- var generator = obj && obj[Symbol.iterator];
1327
- var iterator = generator.call(obj);
1364
+ var generator = obj && obj[iterator];
1365
+ var _iterator = generator.call(obj);
1328
1366
  var result;
1329
- while ((result = iterator.next()) && !result.done) {
1367
+ while ((result = _iterator.next()) && !result.done) {
1330
1368
  var pair = result.value;
1331
1369
  fn.call(obj, pair[0], pair[1]);
1332
1370
  }
@@ -1393,11 +1431,11 @@
1393
1431
  var freezeMethods = function freezeMethods(obj) {
1394
1432
  reduceDescriptors(obj, function (descriptor, name) {
1395
1433
  // skip restricted props in strict mode
1396
- if (isFunction(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
1434
+ if (isFunction$1(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
1397
1435
  return false;
1398
1436
  }
1399
1437
  var value = obj[name];
1400
- if (!isFunction(value)) return;
1438
+ if (!isFunction$1(value)) return;
1401
1439
  descriptor.enumerable = false;
1402
1440
  if ('writable' in descriptor) {
1403
1441
  descriptor.writable = false;
@@ -1433,7 +1471,7 @@
1433
1471
  * @returns {boolean}
1434
1472
  */
1435
1473
  function isSpecCompliantForm(thing) {
1436
- return !!(thing && isFunction(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator]);
1474
+ return !!(thing && isFunction$1(thing.append) && thing[toStringTag] === 'FormData' && thing[iterator]);
1437
1475
  }
1438
1476
  var toJSONObject = function toJSONObject(obj) {
1439
1477
  var stack = new Array(10);
@@ -1442,6 +1480,11 @@
1442
1480
  if (stack.indexOf(source) >= 0) {
1443
1481
  return;
1444
1482
  }
1483
+
1484
+ //Buffer check
1485
+ if (isBuffer(source)) {
1486
+ return source;
1487
+ }
1445
1488
  if (!('toJSON' in source)) {
1446
1489
  stack[i] = source;
1447
1490
  var target = isArray(source) ? [] : {};
@@ -1459,7 +1502,7 @@
1459
1502
  };
1460
1503
  var isAsyncFn = kindOfTest('AsyncFunction');
1461
1504
  var isThenable = function isThenable(thing) {
1462
- return thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
1505
+ return thing && (isObject(thing) || isFunction$1(thing)) && isFunction$1(thing.then) && isFunction$1(thing.catch);
1463
1506
  };
1464
1507
 
1465
1508
  // original code
@@ -1484,11 +1527,14 @@
1484
1527
  }("axios@".concat(Math.random()), []) : function (cb) {
1485
1528
  return setTimeout(cb);
1486
1529
  };
1487
- }(typeof setImmediate === 'function', isFunction(_global.postMessage));
1530
+ }(typeof setImmediate === 'function', isFunction$1(_global.postMessage));
1488
1531
  var asap = typeof queueMicrotask !== 'undefined' ? queueMicrotask.bind(_global) : typeof process !== 'undefined' && process.nextTick || _setImmediate;
1489
1532
 
1490
1533
  // *********************
1491
1534
 
1535
+ var isIterable = function isIterable(thing) {
1536
+ return thing != null && isFunction$1(thing[iterator]);
1537
+ };
1492
1538
  var utils$1 = {
1493
1539
  isArray: isArray,
1494
1540
  isArrayBuffer: isArrayBuffer,
@@ -1500,6 +1546,7 @@
1500
1546
  isBoolean: isBoolean,
1501
1547
  isObject: isObject,
1502
1548
  isPlainObject: isPlainObject,
1549
+ isEmptyObject: isEmptyObject,
1503
1550
  isReadableStream: isReadableStream,
1504
1551
  isRequest: isRequest,
1505
1552
  isResponse: isResponse,
@@ -1509,7 +1556,7 @@
1509
1556
  isFile: isFile,
1510
1557
  isBlob: isBlob,
1511
1558
  isRegExp: isRegExp,
1512
- isFunction: isFunction,
1559
+ isFunction: isFunction$1,
1513
1560
  isStream: isStream,
1514
1561
  isURLSearchParams: isURLSearchParams,
1515
1562
  isTypedArray: isTypedArray,
@@ -1524,7 +1571,7 @@
1524
1571
  kindOf: kindOf,
1525
1572
  kindOfTest: kindOfTest,
1526
1573
  endsWith: endsWith,
1527
- toArray: toArray$1,
1574
+ toArray: toArray,
1528
1575
  forEachEntry: forEachEntry,
1529
1576
  matchAll: matchAll,
1530
1577
  isHTMLForm: isHTMLForm,
@@ -1545,7 +1592,8 @@
1545
1592
  isAsyncFn: isAsyncFn,
1546
1593
  isThenable: isThenable,
1547
1594
  setImmediate: _setImmediate,
1548
- asap: asap
1595
+ asap: asap,
1596
+ isIterable: isIterable
1549
1597
  };
1550
1598
 
1551
1599
  /**
@@ -1619,9 +1667,20 @@
1619
1667
  }, function (prop) {
1620
1668
  return prop !== 'isAxiosError';
1621
1669
  });
1622
- AxiosError.call(axiosError, error.message, code, config, request, response);
1623
- axiosError.cause = error;
1624
- axiosError.name = error.name;
1670
+ var msg = error && error.message ? error.message : 'Error';
1671
+
1672
+ // Prefer explicit code; otherwise copy the low-level error's code (e.g. ECONNREFUSED)
1673
+ var errCode = code == null && error ? error.code : code;
1674
+ AxiosError.call(axiosError, msg, errCode, config, request, response);
1675
+
1676
+ // Chain the original error on the standard field; non-enumerable to avoid JSON noise
1677
+ if (error && axiosError.cause == null) {
1678
+ Object.defineProperty(axiosError, 'cause', {
1679
+ value: error,
1680
+ configurable: true
1681
+ });
1682
+ }
1683
+ axiosError.name = error && error.name || 'Error';
1625
1684
  customProps && Object.assign(axiosError, customProps);
1626
1685
  return axiosError;
1627
1686
  };
@@ -1738,6 +1797,9 @@
1738
1797
  if (utils$1.isDate(value)) {
1739
1798
  return value.toISOString();
1740
1799
  }
1800
+ if (utils$1.isBoolean(value)) {
1801
+ return value.toString();
1802
+ }
1741
1803
  if (!useBlob && utils$1.isBlob(value)) {
1742
1804
  throw new AxiosError('Blob is not supported. Use a Buffer instead.');
1743
1805
  }
@@ -1866,7 +1928,7 @@
1866
1928
  * @returns {string} The encoded value.
1867
1929
  */
1868
1930
  function encode(val) {
1869
- return encodeURIComponent(val).replace(/%3A/gi, ':').replace(/%24/g, '$').replace(/%2C/gi, ',').replace(/%20/g, '+').replace(/%5B/gi, '[').replace(/%5D/gi, ']');
1931
+ return encodeURIComponent(val).replace(/%3A/gi, ':').replace(/%24/g, '$').replace(/%2C/gi, ',').replace(/%20/g, '+');
1870
1932
  }
1871
1933
 
1872
1934
  /**
@@ -1937,7 +1999,7 @@
1937
1999
  *
1938
2000
  * @param {Number} id The ID that was returned by `use`
1939
2001
  *
1940
- * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
2002
+ * @returns {void}
1941
2003
  */
1942
2004
  }, {
1943
2005
  key: "eject",
@@ -2068,12 +2130,14 @@
2068
2130
  origin: origin
2069
2131
  });
2070
2132
 
2133
+ function ownKeys$4(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
2134
+ function _objectSpread$4(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$4(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$4(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
2135
+ var platform = _objectSpread$4(_objectSpread$4({}, utils), platform$1);
2136
+
2071
2137
  function ownKeys$3(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
2072
2138
  function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$3(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$3(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
2073
- var platform = _objectSpread$3(_objectSpread$3({}, utils), platform$1);
2074
-
2075
2139
  function toURLEncodedForm(data, options) {
2076
- return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({
2140
+ return toFormData(data, new platform.classes.URLSearchParams(), _objectSpread$3({
2077
2141
  visitor: function visitor(value, key, path, helpers) {
2078
2142
  if (platform.isNode && utils$1.isBuffer(value)) {
2079
2143
  this.append(key, value.toString('base64'));
@@ -2238,7 +2302,7 @@
2238
2302
  var silentJSONParsing = transitional && transitional.silentJSONParsing;
2239
2303
  var strictJSONParsing = !silentJSONParsing && JSONRequested;
2240
2304
  try {
2241
- return JSON.parse(data);
2305
+ return JSON.parse(data, this.parseReviver);
2242
2306
  } catch (e) {
2243
2307
  if (strictJSONParsing) {
2244
2308
  if (e.name === 'SyntaxError') {
@@ -2278,6 +2342,48 @@
2278
2342
  });
2279
2343
  var defaults$1 = defaults;
2280
2344
 
2345
+ var toConsumableArray = {exports: {}};
2346
+
2347
+ var arrayWithoutHoles = {exports: {}};
2348
+
2349
+ (function (module) {
2350
+ var arrayLikeToArray$1 = arrayLikeToArray.exports;
2351
+ function _arrayWithoutHoles(r) {
2352
+ if (Array.isArray(r)) return arrayLikeToArray$1(r);
2353
+ }
2354
+ module.exports = _arrayWithoutHoles, module.exports.__esModule = true, module.exports["default"] = module.exports;
2355
+ })(arrayWithoutHoles);
2356
+
2357
+ var iterableToArray = {exports: {}};
2358
+
2359
+ (function (module) {
2360
+ function _iterableToArray(r) {
2361
+ if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
2362
+ }
2363
+ module.exports = _iterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
2364
+ })(iterableToArray);
2365
+
2366
+ var nonIterableSpread = {exports: {}};
2367
+
2368
+ (function (module) {
2369
+ function _nonIterableSpread() {
2370
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2371
+ }
2372
+ module.exports = _nonIterableSpread, module.exports.__esModule = true, module.exports["default"] = module.exports;
2373
+ })(nonIterableSpread);
2374
+
2375
+ (function (module) {
2376
+ var arrayWithoutHoles$1 = arrayWithoutHoles.exports;
2377
+ var iterableToArray$1 = iterableToArray.exports;
2378
+ var unsupportedIterableToArray$1 = unsupportedIterableToArray.exports;
2379
+ var nonIterableSpread$1 = nonIterableSpread.exports;
2380
+ function _toConsumableArray(r) {
2381
+ return arrayWithoutHoles$1(r) || iterableToArray$1(r) || unsupportedIterableToArray$1(r) || nonIterableSpread$1();
2382
+ }
2383
+ module.exports = _toConsumableArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
2384
+ })(toConsumableArray);
2385
+ var _toConsumableArray = /*@__PURE__*/getDefaultExportFromCjs(toConsumableArray.exports);
2386
+
2281
2387
  // RawAxiosHeaders whose duplicates are ignored by node
2282
2388
  // c.f. https://nodejs.org/api/http.html#http_message_headers
2283
2389
  var ignoreDuplicateOf = utils$1.toObjectSet(['age', 'authorization', 'content-length', 'content-type', 'etag', 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since', 'last-modified', 'location', 'max-forwards', 'proxy-authorization', 'referer', 'retry-after', 'user-agent']);
@@ -2405,21 +2511,26 @@
2405
2511
  setHeaders(header, valueOrRewrite);
2406
2512
  } else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
2407
2513
  setHeaders(parseHeaders(header), valueOrRewrite);
2408
- } else if (utils$1.isHeaders(header)) {
2409
- var _iterator = _createForOfIteratorHelper(header.entries()),
2514
+ } else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
2515
+ var obj = {},
2516
+ dest,
2517
+ key;
2518
+ var _iterator = _createForOfIteratorHelper(header),
2410
2519
  _step;
2411
2520
  try {
2412
2521
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
2413
- var _step$value = _slicedToArray(_step.value, 2),
2414
- key = _step$value[0],
2415
- value = _step$value[1];
2416
- setHeader(value, key, rewrite);
2522
+ var entry = _step.value;
2523
+ if (!utils$1.isArray(entry)) {
2524
+ throw TypeError('Object iterator must return a key-value pair');
2525
+ }
2526
+ obj[key = entry[0]] = (dest = obj[key]) ? utils$1.isArray(dest) ? [].concat(_toConsumableArray(dest), [entry[1]]) : [dest, entry[1]] : entry[1];
2417
2527
  }
2418
2528
  } catch (err) {
2419
2529
  _iterator.e(err);
2420
2530
  } finally {
2421
2531
  _iterator.f();
2422
2532
  }
2533
+ setHeaders(obj, valueOrRewrite);
2423
2534
  } else {
2424
2535
  header != null && setHeader(valueOrRewrite, header, rewrite);
2425
2536
  }
@@ -2550,6 +2661,11 @@
2550
2661
  return header + ': ' + value;
2551
2662
  }).join('\n');
2552
2663
  }
2664
+ }, {
2665
+ key: "getSetCookie",
2666
+ value: function getSetCookie() {
2667
+ return this.get("set-cookie") || [];
2668
+ }
2553
2669
  }, {
2554
2670
  key: Symbol.toStringTag,
2555
2671
  get: function get() {
@@ -2734,7 +2850,7 @@
2734
2850
  clearTimeout(timer);
2735
2851
  timer = null;
2736
2852
  }
2737
- fn.apply(null, args);
2853
+ fn.apply(void 0, _toConsumableArray(args));
2738
2854
  };
2739
2855
  var throttled = function throttled() {
2740
2856
  var now = Date.now();
@@ -2805,62 +2921,6 @@
2805
2921
  };
2806
2922
  };
2807
2923
 
2808
- var toConsumableArray = {exports: {}};
2809
-
2810
- var arrayWithoutHoles = {exports: {}};
2811
-
2812
- (function (module) {
2813
- var arrayLikeToArray$1 = arrayLikeToArray.exports;
2814
- function _arrayWithoutHoles(r) {
2815
- if (Array.isArray(r)) return arrayLikeToArray$1(r);
2816
- }
2817
- module.exports = _arrayWithoutHoles, module.exports.__esModule = true, module.exports["default"] = module.exports;
2818
- })(arrayWithoutHoles);
2819
-
2820
- var iterableToArray = {exports: {}};
2821
-
2822
- (function (module) {
2823
- function _iterableToArray(r) {
2824
- if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
2825
- }
2826
- module.exports = _iterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
2827
- })(iterableToArray);
2828
-
2829
- var nonIterableSpread = {exports: {}};
2830
-
2831
- (function (module) {
2832
- function _nonIterableSpread() {
2833
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2834
- }
2835
- module.exports = _nonIterableSpread, module.exports.__esModule = true, module.exports["default"] = module.exports;
2836
- })(nonIterableSpread);
2837
-
2838
- (function (module) {
2839
- var arrayWithoutHoles$1 = arrayWithoutHoles.exports;
2840
- var iterableToArray$1 = iterableToArray.exports;
2841
- var unsupportedIterableToArray$1 = unsupportedIterableToArray.exports;
2842
- var nonIterableSpread$1 = nonIterableSpread.exports;
2843
- function _toConsumableArray(r) {
2844
- return arrayWithoutHoles$1(r) || iterableToArray$1(r) || unsupportedIterableToArray$1(r) || nonIterableSpread$1();
2845
- }
2846
- module.exports = _toConsumableArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
2847
- })(toConsumableArray);
2848
- var _toConsumableArray = /*@__PURE__*/getDefaultExportFromCjs(toConsumableArray.exports);
2849
-
2850
- var toArray = {exports: {}};
2851
-
2852
- (function (module) {
2853
- var arrayWithHoles$1 = arrayWithHoles.exports;
2854
- var iterableToArray$1 = iterableToArray.exports;
2855
- var unsupportedIterableToArray$1 = unsupportedIterableToArray.exports;
2856
- var nonIterableRest$1 = nonIterableRest.exports;
2857
- function _toArray(r) {
2858
- return arrayWithHoles$1(r) || iterableToArray$1(r) || unsupportedIterableToArray$1(r) || nonIterableRest$1();
2859
- }
2860
- module.exports = _toArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
2861
- })(toArray);
2862
- var _toArray = /*@__PURE__*/getDefaultExportFromCjs(toArray.exports);
2863
-
2864
2924
  var isURLSameOrigin = platform.hasStandardBrowserEnv ? function (origin, isMSIE) {
2865
2925
  return function (url) {
2866
2926
  url = new URL(url, platform.origin);
@@ -2873,20 +2933,33 @@
2873
2933
  var cookies = platform.hasStandardBrowserEnv ?
2874
2934
  // Standard browser envs support document.cookie
2875
2935
  {
2876
- write: function write(name, value, expires, path, domain, secure) {
2877
- var cookie = [name + '=' + encodeURIComponent(value)];
2878
- utils$1.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString());
2879
- utils$1.isString(path) && cookie.push('path=' + path);
2880
- utils$1.isString(domain) && cookie.push('domain=' + domain);
2881
- secure === true && cookie.push('secure');
2936
+ write: function write(name, value, expires, path, domain, secure, sameSite) {
2937
+ if (typeof document === 'undefined') return;
2938
+ var cookie = ["".concat(name, "=").concat(encodeURIComponent(value))];
2939
+ if (utils$1.isNumber(expires)) {
2940
+ cookie.push("expires=".concat(new Date(expires).toUTCString()));
2941
+ }
2942
+ if (utils$1.isString(path)) {
2943
+ cookie.push("path=".concat(path));
2944
+ }
2945
+ if (utils$1.isString(domain)) {
2946
+ cookie.push("domain=".concat(domain));
2947
+ }
2948
+ if (secure === true) {
2949
+ cookie.push('secure');
2950
+ }
2951
+ if (utils$1.isString(sameSite)) {
2952
+ cookie.push("SameSite=".concat(sameSite));
2953
+ }
2882
2954
  document.cookie = cookie.join('; ');
2883
2955
  },
2884
2956
  read: function read(name) {
2885
- var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
2886
- return match ? decodeURIComponent(match[3]) : null;
2957
+ if (typeof document === 'undefined') return null;
2958
+ var match = document.cookie.match(new RegExp('(?:^|; )' + name + '=([^;]*)'));
2959
+ return match ? decodeURIComponent(match[1]) : null;
2887
2960
  },
2888
2961
  remove: function remove(name) {
2889
- this.write(name, '', Date.now() - 86400000);
2962
+ this.write(name, '', Date.now() - 86400000, '/');
2890
2963
  }
2891
2964
  } :
2892
2965
  // Non-standard browser env (web workers, react-native) lack needed support.
@@ -2936,7 +3009,7 @@
2936
3009
  */
2937
3010
  function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
2938
3011
  var isRelativeUrl = !isAbsoluteURL(requestedURL);
2939
- if (baseURL && isRelativeUrl || allowAbsoluteUrls == false) {
3012
+ if (baseURL && (isRelativeUrl || allowAbsoluteUrls == false)) {
2940
3013
  return combineURLs(baseURL, requestedURL);
2941
3014
  }
2942
3015
  return requestedURL;
@@ -3040,7 +3113,7 @@
3040
3113
  return mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true);
3041
3114
  }
3042
3115
  };
3043
- utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
3116
+ utils$1.forEach(Object.keys(_objectSpread$2(_objectSpread$2({}, config1), config2)), function computeConfigValue(prop) {
3044
3117
  var merge = mergeMap[prop] || mergeDeepProperties;
3045
3118
  var configValue = merge(config1[prop], config2[prop], prop);
3046
3119
  utils$1.isUndefined(configValue) && merge !== mergeDirectKeys || (config[prop] = configValue);
@@ -3057,25 +3130,28 @@
3057
3130
  headers = newConfig.headers,
3058
3131
  auth = newConfig.auth;
3059
3132
  newConfig.headers = headers = AxiosHeaders$1.from(headers);
3060
- newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url), config.params, config.paramsSerializer);
3133
+ newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls), config.params, config.paramsSerializer);
3061
3134
 
3062
3135
  // HTTP basic authentication
3063
3136
  if (auth) {
3064
3137
  headers.set('Authorization', 'Basic ' + btoa((auth.username || '') + ':' + (auth.password ? unescape(encodeURIComponent(auth.password)) : '')));
3065
3138
  }
3066
- var contentType;
3067
3139
  if (utils$1.isFormData(data)) {
3068
3140
  if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
3069
- headers.setContentType(undefined); // Let the browser set it
3070
- } else if ((contentType = headers.getContentType()) !== false) {
3071
- // fix semicolon duplication issue for ReactNative FormData implementation
3072
- var _ref = contentType ? contentType.split(';').map(function (token) {
3073
- return token.trim();
3074
- }).filter(Boolean) : [],
3075
- _ref2 = _toArray(_ref),
3076
- type = _ref2[0],
3077
- tokens = _ref2.slice(1);
3078
- headers.setContentType([type || 'multipart/form-data'].concat(_toConsumableArray(tokens)).join('; '));
3141
+ headers.setContentType(undefined); // browser handles it
3142
+ } else if (utils$1.isFunction(data.getHeaders)) {
3143
+ // Node.js FormData (like form-data package)
3144
+ var formHeaders = data.getHeaders();
3145
+ // Only set safe headers to avoid overwriting security headers
3146
+ var allowedHeaders = ['content-type', 'content-length'];
3147
+ Object.entries(formHeaders).forEach(function (_ref) {
3148
+ var _ref2 = _slicedToArray(_ref, 2),
3149
+ key = _ref2[0],
3150
+ val = _ref2[1];
3151
+ if (allowedHeaders.includes(key.toLowerCase())) {
3152
+ headers.set(key, val);
3153
+ }
3154
+ });
3079
3155
  }
3080
3156
  }
3081
3157
 
@@ -3181,12 +3257,15 @@
3181
3257
  };
3182
3258
 
3183
3259
  // Handle low level network errors
3184
- request.onerror = function handleError() {
3185
- // Real errors are hidden from us by the browser
3186
- // onerror should only fire if it's a network error
3187
- reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request));
3188
-
3189
- // Clean up request
3260
+ request.onerror = function handleError(event) {
3261
+ // Browsers deliver a ProgressEvent in XHR onerror
3262
+ // (message may be empty; when present, surface it)
3263
+ // See https://developer.mozilla.org/docs/Web/API/XMLHttpRequest/error_event
3264
+ var msg = event && event.message ? event.message : 'Network Error';
3265
+ var err = new AxiosError(msg, AxiosError.ERR_NETWORK, config, request);
3266
+ // attach the underlying event for consumers who want details
3267
+ err.event = event || null;
3268
+ reject(err);
3190
3269
  request = null;
3191
3270
  };
3192
3271
 
@@ -3437,145 +3516,145 @@
3437
3516
  function AsyncFromSyncIterator(r) { function AsyncFromSyncIteratorContinuation(r) { if (Object(r) !== r) return Promise.reject(new TypeError(r + " is not an object.")); var n = r.done; return Promise.resolve(r.value).then(function (r) { return { value: r, done: n }; }); } return AsyncFromSyncIterator = function AsyncFromSyncIterator(r) { this.s = r, this.n = r.next; }, AsyncFromSyncIterator.prototype = { s: null, n: null, next: function next() { return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments)); }, return: function _return(r) { var n = this.s.return; return void 0 === n ? Promise.resolve({ value: r, done: !0 }) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments)); }, throw: function _throw(r) { var n = this.s.return; return void 0 === n ? Promise.reject(r) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments)); } }, new AsyncFromSyncIterator(r); }
3438
3517
  var streamChunk = /*#__PURE__*/regenerator.mark(function streamChunk(chunk, chunkSize) {
3439
3518
  var len, pos, end;
3440
- return regenerator.wrap(function streamChunk$(_context) {
3519
+ return regenerator.wrap(function (_context) {
3441
3520
  while (1) switch (_context.prev = _context.next) {
3442
3521
  case 0:
3443
3522
  len = chunk.byteLength;
3444
3523
  if (!(!chunkSize || len < chunkSize)) {
3445
- _context.next = 5;
3524
+ _context.next = 2;
3446
3525
  break;
3447
3526
  }
3448
- _context.next = 4;
3527
+ _context.next = 1;
3449
3528
  return chunk;
3450
- case 4:
3529
+ case 1:
3451
3530
  return _context.abrupt("return");
3452
- case 5:
3531
+ case 2:
3453
3532
  pos = 0;
3454
- case 6:
3533
+ case 3:
3455
3534
  if (!(pos < len)) {
3456
- _context.next = 13;
3535
+ _context.next = 5;
3457
3536
  break;
3458
3537
  }
3459
3538
  end = pos + chunkSize;
3460
- _context.next = 10;
3539
+ _context.next = 4;
3461
3540
  return chunk.slice(pos, end);
3462
- case 10:
3541
+ case 4:
3463
3542
  pos = end;
3464
- _context.next = 6;
3543
+ _context.next = 3;
3465
3544
  break;
3466
- case 13:
3545
+ case 5:
3467
3546
  case "end":
3468
3547
  return _context.stop();
3469
3548
  }
3470
3549
  }, streamChunk);
3471
3550
  });
3472
3551
  var readBytes = /*#__PURE__*/function () {
3473
- var _ref = _wrapAsyncGenerator( /*#__PURE__*/regenerator.mark(function _callee(iterable, chunkSize) {
3474
- var _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, chunk;
3475
- return regenerator.wrap(function _callee$(_context2) {
3552
+ var _ref = _wrapAsyncGenerator(/*#__PURE__*/regenerator.mark(function _callee(iterable, chunkSize) {
3553
+ var _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, chunk, _t;
3554
+ return regenerator.wrap(function (_context2) {
3476
3555
  while (1) switch (_context2.prev = _context2.next) {
3477
3556
  case 0:
3478
3557
  _iteratorAbruptCompletion = false;
3479
3558
  _didIteratorError = false;
3480
- _context2.prev = 2;
3559
+ _context2.prev = 1;
3481
3560
  _iterator = _asyncIterator(readStream(iterable));
3482
- case 4:
3483
- _context2.next = 6;
3561
+ case 2:
3562
+ _context2.next = 3;
3484
3563
  return _awaitAsyncGenerator(_iterator.next());
3485
- case 6:
3564
+ case 3:
3486
3565
  if (!(_iteratorAbruptCompletion = !(_step = _context2.sent).done)) {
3487
- _context2.next = 12;
3566
+ _context2.next = 5;
3488
3567
  break;
3489
3568
  }
3490
3569
  chunk = _step.value;
3491
- return _context2.delegateYield(_asyncGeneratorDelegate(_asyncIterator(streamChunk(chunk, chunkSize)), _awaitAsyncGenerator), "t0", 9);
3492
- case 9:
3570
+ return _context2.delegateYield(_asyncGeneratorDelegate(_asyncIterator(streamChunk(chunk, chunkSize)), _awaitAsyncGenerator), "t0", 4);
3571
+ case 4:
3493
3572
  _iteratorAbruptCompletion = false;
3494
- _context2.next = 4;
3573
+ _context2.next = 2;
3495
3574
  break;
3496
- case 12:
3497
- _context2.next = 18;
3575
+ case 5:
3576
+ _context2.next = 7;
3498
3577
  break;
3499
- case 14:
3500
- _context2.prev = 14;
3501
- _context2.t1 = _context2["catch"](2);
3578
+ case 6:
3579
+ _context2.prev = 6;
3580
+ _t = _context2["catch"](1);
3502
3581
  _didIteratorError = true;
3503
- _iteratorError = _context2.t1;
3504
- case 18:
3505
- _context2.prev = 18;
3506
- _context2.prev = 19;
3582
+ _iteratorError = _t;
3583
+ case 7:
3584
+ _context2.prev = 7;
3585
+ _context2.prev = 8;
3507
3586
  if (!(_iteratorAbruptCompletion && _iterator.return != null)) {
3508
- _context2.next = 23;
3587
+ _context2.next = 9;
3509
3588
  break;
3510
3589
  }
3511
- _context2.next = 23;
3590
+ _context2.next = 9;
3512
3591
  return _awaitAsyncGenerator(_iterator.return());
3513
- case 23:
3514
- _context2.prev = 23;
3592
+ case 9:
3593
+ _context2.prev = 9;
3515
3594
  if (!_didIteratorError) {
3516
- _context2.next = 26;
3595
+ _context2.next = 10;
3517
3596
  break;
3518
3597
  }
3519
3598
  throw _iteratorError;
3520
- case 26:
3521
- return _context2.finish(23);
3522
- case 27:
3523
- return _context2.finish(18);
3524
- case 28:
3599
+ case 10:
3600
+ return _context2.finish(9);
3601
+ case 11:
3602
+ return _context2.finish(7);
3603
+ case 12:
3525
3604
  case "end":
3526
3605
  return _context2.stop();
3527
3606
  }
3528
- }, _callee, null, [[2, 14, 18, 28], [19,, 23, 27]]);
3607
+ }, _callee, null, [[1, 6, 7, 12], [8,, 9, 11]]);
3529
3608
  }));
3530
3609
  return function readBytes(_x, _x2) {
3531
3610
  return _ref.apply(this, arguments);
3532
3611
  };
3533
3612
  }();
3534
3613
  var readStream = /*#__PURE__*/function () {
3535
- var _ref2 = _wrapAsyncGenerator( /*#__PURE__*/regenerator.mark(function _callee2(stream) {
3614
+ var _ref2 = _wrapAsyncGenerator(/*#__PURE__*/regenerator.mark(function _callee2(stream) {
3536
3615
  var reader, _yield$_awaitAsyncGen, done, value;
3537
- return regenerator.wrap(function _callee2$(_context3) {
3616
+ return regenerator.wrap(function (_context3) {
3538
3617
  while (1) switch (_context3.prev = _context3.next) {
3539
3618
  case 0:
3540
3619
  if (!stream[Symbol.asyncIterator]) {
3541
- _context3.next = 3;
3620
+ _context3.next = 2;
3542
3621
  break;
3543
3622
  }
3544
- return _context3.delegateYield(_asyncGeneratorDelegate(_asyncIterator(stream), _awaitAsyncGenerator), "t0", 2);
3545
- case 2:
3623
+ return _context3.delegateYield(_asyncGeneratorDelegate(_asyncIterator(stream), _awaitAsyncGenerator), "t0", 1);
3624
+ case 1:
3546
3625
  return _context3.abrupt("return");
3547
- case 3:
3626
+ case 2:
3548
3627
  reader = stream.getReader();
3549
- _context3.prev = 4;
3550
- case 5:
3551
- _context3.next = 7;
3628
+ _context3.prev = 3;
3629
+ case 4:
3630
+ _context3.next = 5;
3552
3631
  return _awaitAsyncGenerator(reader.read());
3553
- case 7:
3632
+ case 5:
3554
3633
  _yield$_awaitAsyncGen = _context3.sent;
3555
3634
  done = _yield$_awaitAsyncGen.done;
3556
3635
  value = _yield$_awaitAsyncGen.value;
3557
3636
  if (!done) {
3558
- _context3.next = 12;
3637
+ _context3.next = 6;
3559
3638
  break;
3560
3639
  }
3561
- return _context3.abrupt("break", 16);
3562
- case 12:
3563
- _context3.next = 14;
3640
+ return _context3.abrupt("continue", 8);
3641
+ case 6:
3642
+ _context3.next = 7;
3564
3643
  return value;
3565
- case 14:
3566
- _context3.next = 5;
3644
+ case 7:
3645
+ _context3.next = 4;
3567
3646
  break;
3568
- case 16:
3569
- _context3.prev = 16;
3570
- _context3.next = 19;
3647
+ case 8:
3648
+ _context3.prev = 8;
3649
+ _context3.next = 9;
3571
3650
  return _awaitAsyncGenerator(reader.cancel());
3572
- case 19:
3573
- return _context3.finish(16);
3574
- case 20:
3651
+ case 9:
3652
+ return _context3.finish(8);
3653
+ case 10:
3575
3654
  case "end":
3576
3655
  return _context3.stop();
3577
3656
  }
3578
- }, _callee2, null, [[4,, 16, 20]]);
3657
+ }, _callee2, null, [[3,, 8, 10]]);
3579
3658
  }));
3580
3659
  return function readStream(_x3) {
3581
3660
  return _ref2.apply(this, arguments);
@@ -3593,44 +3672,44 @@
3593
3672
  };
3594
3673
  return new ReadableStream({
3595
3674
  pull: function pull(controller) {
3596
- return _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee3() {
3597
- var _yield$iterator$next, _done, value, len, loadedBytes;
3598
- return regenerator.wrap(function _callee3$(_context4) {
3675
+ return _asyncToGenerator(/*#__PURE__*/regenerator.mark(function _callee3() {
3676
+ var _yield$iterator$next, _done, value, len, loadedBytes, _t2;
3677
+ return regenerator.wrap(function (_context4) {
3599
3678
  while (1) switch (_context4.prev = _context4.next) {
3600
3679
  case 0:
3601
3680
  _context4.prev = 0;
3602
- _context4.next = 3;
3681
+ _context4.next = 1;
3603
3682
  return iterator.next();
3604
- case 3:
3683
+ case 1:
3605
3684
  _yield$iterator$next = _context4.sent;
3606
3685
  _done = _yield$iterator$next.done;
3607
3686
  value = _yield$iterator$next.value;
3608
3687
  if (!_done) {
3609
- _context4.next = 10;
3688
+ _context4.next = 2;
3610
3689
  break;
3611
3690
  }
3612
3691
  _onFinish();
3613
3692
  controller.close();
3614
3693
  return _context4.abrupt("return");
3615
- case 10:
3694
+ case 2:
3616
3695
  len = value.byteLength;
3617
3696
  if (onProgress) {
3618
3697
  loadedBytes = bytes += len;
3619
3698
  onProgress(loadedBytes);
3620
3699
  }
3621
3700
  controller.enqueue(new Uint8Array(value));
3622
- _context4.next = 19;
3701
+ _context4.next = 4;
3623
3702
  break;
3624
- case 15:
3625
- _context4.prev = 15;
3626
- _context4.t0 = _context4["catch"](0);
3627
- _onFinish(_context4.t0);
3628
- throw _context4.t0;
3629
- case 19:
3703
+ case 3:
3704
+ _context4.prev = 3;
3705
+ _t2 = _context4["catch"](0);
3706
+ _onFinish(_t2);
3707
+ throw _t2;
3708
+ case 4:
3630
3709
  case "end":
3631
3710
  return _context4.stop();
3632
3711
  }
3633
- }, _callee3, null, [[0, 15]]);
3712
+ }, _callee3, null, [[0, 3]]);
3634
3713
  }))();
3635
3714
  },
3636
3715
  cancel: function cancel(reason) {
@@ -3644,35 +3723,19 @@
3644
3723
 
3645
3724
  function ownKeys$1(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3646
3725
  function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
3647
- var isFetchSupported = typeof fetch === 'function' && typeof Request === 'function' && typeof Response === 'function';
3648
- var isReadableStreamSupported = isFetchSupported && typeof ReadableStream === 'function';
3649
-
3650
- // used only inside the fetch adapter
3651
- var encodeText = isFetchSupported && (typeof TextEncoder === 'function' ? function (encoder) {
3652
- return function (str) {
3653
- return encoder.encode(str);
3654
- };
3655
- }(new TextEncoder()) : ( /*#__PURE__*/function () {
3656
- var _ref = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee(str) {
3657
- return regenerator.wrap(function _callee$(_context) {
3658
- while (1) switch (_context.prev = _context.next) {
3659
- case 0:
3660
- _context.t0 = Uint8Array;
3661
- _context.next = 3;
3662
- return new Response(str).arrayBuffer();
3663
- case 3:
3664
- _context.t1 = _context.sent;
3665
- return _context.abrupt("return", new _context.t0(_context.t1));
3666
- case 5:
3667
- case "end":
3668
- return _context.stop();
3669
- }
3670
- }, _callee);
3671
- }));
3672
- return function (_x) {
3673
- return _ref.apply(this, arguments);
3726
+ var DEFAULT_CHUNK_SIZE = 64 * 1024;
3727
+ var isFunction = utils$1.isFunction;
3728
+ var globalFetchAPI = function (_ref) {
3729
+ var Request = _ref.Request,
3730
+ Response = _ref.Response;
3731
+ return {
3732
+ Request: Request,
3733
+ Response: Response
3674
3734
  };
3675
- }()));
3735
+ }(utils$1.global);
3736
+ var _utils$global = utils$1.global,
3737
+ ReadableStream$1 = _utils$global.ReadableStream,
3738
+ TextEncoder = _utils$global.TextEncoder;
3676
3739
  var test = function test(fn) {
3677
3740
  try {
3678
3741
  for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
@@ -3683,233 +3746,313 @@
3683
3746
  return false;
3684
3747
  }
3685
3748
  };
3686
- var supportsRequestStream = isReadableStreamSupported && test(function () {
3687
- var duplexAccessed = false;
3688
- var hasContentType = new Request(platform.origin, {
3689
- body: new ReadableStream(),
3690
- method: 'POST',
3691
- get duplex() {
3692
- duplexAccessed = true;
3693
- return 'half';
3694
- }
3695
- }).headers.has('Content-Type');
3696
- return duplexAccessed && !hasContentType;
3697
- });
3698
- var DEFAULT_CHUNK_SIZE = 64 * 1024;
3699
- var supportsResponseStream = isReadableStreamSupported && test(function () {
3700
- return utils$1.isReadableStream(new Response('').body);
3701
- });
3702
- var resolvers = {
3703
- stream: supportsResponseStream && function (res) {
3704
- return res.body;
3749
+ var factory = function factory(env) {
3750
+ env = utils$1.merge.call({
3751
+ skipUndefined: true
3752
+ }, globalFetchAPI, env);
3753
+ var _env = env,
3754
+ envFetch = _env.fetch,
3755
+ Request = _env.Request,
3756
+ Response = _env.Response;
3757
+ var isFetchSupported = envFetch ? isFunction(envFetch) : typeof fetch === 'function';
3758
+ var isRequestSupported = isFunction(Request);
3759
+ var isResponseSupported = isFunction(Response);
3760
+ if (!isFetchSupported) {
3761
+ return false;
3705
3762
  }
3706
- };
3707
- isFetchSupported && function (res) {
3708
- ['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(function (type) {
3709
- !resolvers[type] && (resolvers[type] = utils$1.isFunction(res[type]) ? function (res) {
3710
- return res[type]();
3711
- } : function (_, config) {
3712
- throw new AxiosError("Response type '".concat(type, "' is not supported"), AxiosError.ERR_NOT_SUPPORT, config);
3713
- });
3714
- });
3715
- }(new Response());
3716
- var getBodyLength = /*#__PURE__*/function () {
3717
- var _ref2 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee2(body) {
3718
- var _request;
3719
- return regenerator.wrap(function _callee2$(_context2) {
3720
- while (1) switch (_context2.prev = _context2.next) {
3721
- case 0:
3722
- if (!(body == null)) {
3723
- _context2.next = 2;
3724
- break;
3725
- }
3726
- return _context2.abrupt("return", 0);
3727
- case 2:
3728
- if (!utils$1.isBlob(body)) {
3729
- _context2.next = 4;
3730
- break;
3731
- }
3732
- return _context2.abrupt("return", body.size);
3733
- case 4:
3734
- if (!utils$1.isSpecCompliantForm(body)) {
3735
- _context2.next = 9;
3736
- break;
3737
- }
3738
- _request = new Request(platform.origin, {
3739
- method: 'POST',
3740
- body: body
3741
- });
3742
- _context2.next = 8;
3743
- return _request.arrayBuffer();
3744
- case 8:
3745
- return _context2.abrupt("return", _context2.sent.byteLength);
3746
- case 9:
3747
- if (!(utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body))) {
3748
- _context2.next = 11;
3749
- break;
3750
- }
3751
- return _context2.abrupt("return", body.byteLength);
3752
- case 11:
3753
- if (utils$1.isURLSearchParams(body)) {
3754
- body = body + '';
3755
- }
3756
- if (!utils$1.isString(body)) {
3757
- _context2.next = 16;
3758
- break;
3759
- }
3760
- _context2.next = 15;
3761
- return encodeText(body);
3762
- case 15:
3763
- return _context2.abrupt("return", _context2.sent.byteLength);
3764
- case 16:
3765
- case "end":
3766
- return _context2.stop();
3767
- }
3768
- }, _callee2);
3769
- }));
3770
- return function getBodyLength(_x2) {
3771
- return _ref2.apply(this, arguments);
3772
- };
3773
- }();
3774
- var resolveBodyLength = /*#__PURE__*/function () {
3775
- var _ref3 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee3(headers, body) {
3776
- var length;
3777
- return regenerator.wrap(function _callee3$(_context3) {
3778
- while (1) switch (_context3.prev = _context3.next) {
3779
- case 0:
3780
- length = utils$1.toFiniteNumber(headers.getContentLength());
3781
- return _context3.abrupt("return", length == null ? getBodyLength(body) : length);
3782
- case 2:
3783
- case "end":
3784
- return _context3.stop();
3763
+ var isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream$1);
3764
+ var encodeText = isFetchSupported && (typeof TextEncoder === 'function' ? function (encoder) {
3765
+ return function (str) {
3766
+ return encoder.encode(str);
3767
+ };
3768
+ }(new TextEncoder()) : (/*#__PURE__*/function () {
3769
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/regenerator.mark(function _callee(str) {
3770
+ var _t, _t2;
3771
+ return regenerator.wrap(function (_context) {
3772
+ while (1) switch (_context.prev = _context.next) {
3773
+ case 0:
3774
+ _t = Uint8Array;
3775
+ _context.next = 1;
3776
+ return new Request(str).arrayBuffer();
3777
+ case 1:
3778
+ _t2 = _context.sent;
3779
+ return _context.abrupt("return", new _t(_t2));
3780
+ case 2:
3781
+ case "end":
3782
+ return _context.stop();
3783
+ }
3784
+ }, _callee);
3785
+ }));
3786
+ return function (_x) {
3787
+ return _ref2.apply(this, arguments);
3788
+ };
3789
+ }()));
3790
+ var supportsRequestStream = isRequestSupported && isReadableStreamSupported && test(function () {
3791
+ var duplexAccessed = false;
3792
+ var hasContentType = new Request(platform.origin, {
3793
+ body: new ReadableStream$1(),
3794
+ method: 'POST',
3795
+ get duplex() {
3796
+ duplexAccessed = true;
3797
+ return 'half';
3785
3798
  }
3786
- }, _callee3);
3787
- }));
3788
- return function resolveBodyLength(_x3, _x4) {
3789
- return _ref3.apply(this, arguments);
3799
+ }).headers.has('Content-Type');
3800
+ return duplexAccessed && !hasContentType;
3801
+ });
3802
+ var supportsResponseStream = isResponseSupported && isReadableStreamSupported && test(function () {
3803
+ return utils$1.isReadableStream(new Response('').body);
3804
+ });
3805
+ var resolvers = {
3806
+ stream: supportsResponseStream && function (res) {
3807
+ return res.body;
3808
+ }
3790
3809
  };
3791
- }();
3792
- var fetchAdapter = isFetchSupported && ( /*#__PURE__*/function () {
3793
- var _ref4 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee4(config) {
3794
- var _resolveConfig, url, method, data, signal, cancelToken, timeout, onDownloadProgress, onUploadProgress, responseType, headers, _resolveConfig$withCr, withCredentials, fetchOptions, composedSignal, request, unsubscribe, requestContentLength, _request, contentTypeHeader, _progressEventDecorat, _progressEventDecorat2, onProgress, flush, isCredentialsSupported, response, isStreamResponse, options, responseContentLength, _ref5, _ref6, _onProgress, _flush, responseData;
3795
- return regenerator.wrap(function _callee4$(_context4) {
3796
- while (1) switch (_context4.prev = _context4.next) {
3797
- case 0:
3798
- _resolveConfig = resolveConfig(config), url = _resolveConfig.url, method = _resolveConfig.method, data = _resolveConfig.data, signal = _resolveConfig.signal, cancelToken = _resolveConfig.cancelToken, timeout = _resolveConfig.timeout, onDownloadProgress = _resolveConfig.onDownloadProgress, onUploadProgress = _resolveConfig.onUploadProgress, responseType = _resolveConfig.responseType, headers = _resolveConfig.headers, _resolveConfig$withCr = _resolveConfig.withCredentials, withCredentials = _resolveConfig$withCr === void 0 ? 'same-origin' : _resolveConfig$withCr, fetchOptions = _resolveConfig.fetchOptions;
3799
- responseType = responseType ? (responseType + '').toLowerCase() : 'text';
3800
- composedSignal = composeSignals$1([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
3801
- unsubscribe = composedSignal && composedSignal.unsubscribe && function () {
3802
- composedSignal.unsubscribe();
3803
- };
3804
- _context4.prev = 4;
3805
- _context4.t0 = onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head';
3806
- if (!_context4.t0) {
3807
- _context4.next = 11;
3808
- break;
3809
- }
3810
- _context4.next = 9;
3811
- return resolveBodyLength(headers, data);
3812
- case 9:
3813
- _context4.t1 = requestContentLength = _context4.sent;
3814
- _context4.t0 = _context4.t1 !== 0;
3815
- case 11:
3816
- if (!_context4.t0) {
3817
- _context4.next = 15;
3818
- break;
3819
- }
3820
- _request = new Request(url, {
3821
- method: 'POST',
3822
- body: data,
3823
- duplex: "half"
3824
- });
3825
- if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
3826
- headers.setContentType(contentTypeHeader);
3827
- }
3828
- if (_request.body) {
3829
- _progressEventDecorat = progressEventDecorator(requestContentLength, progressEventReducer(asyncDecorator(onUploadProgress))), _progressEventDecorat2 = _slicedToArray(_progressEventDecorat, 2), onProgress = _progressEventDecorat2[0], flush = _progressEventDecorat2[1];
3830
- data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
3831
- }
3832
- case 15:
3833
- if (!utils$1.isString(withCredentials)) {
3834
- withCredentials = withCredentials ? 'include' : 'omit';
3835
- }
3810
+ isFetchSupported && function () {
3811
+ ['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(function (type) {
3812
+ !resolvers[type] && (resolvers[type] = function (res, config) {
3813
+ var method = res && res[type];
3814
+ if (method) {
3815
+ return method.call(res);
3816
+ }
3817
+ throw new AxiosError("Response type '".concat(type, "' is not supported"), AxiosError.ERR_NOT_SUPPORT, config);
3818
+ });
3819
+ });
3820
+ }();
3821
+ var getBodyLength = /*#__PURE__*/function () {
3822
+ var _ref3 = _asyncToGenerator(/*#__PURE__*/regenerator.mark(function _callee2(body) {
3823
+ var _request;
3824
+ return regenerator.wrap(function (_context2) {
3825
+ while (1) switch (_context2.prev = _context2.next) {
3826
+ case 0:
3827
+ if (!(body == null)) {
3828
+ _context2.next = 1;
3829
+ break;
3830
+ }
3831
+ return _context2.abrupt("return", 0);
3832
+ case 1:
3833
+ if (!utils$1.isBlob(body)) {
3834
+ _context2.next = 2;
3835
+ break;
3836
+ }
3837
+ return _context2.abrupt("return", body.size);
3838
+ case 2:
3839
+ if (!utils$1.isSpecCompliantForm(body)) {
3840
+ _context2.next = 4;
3841
+ break;
3842
+ }
3843
+ _request = new Request(platform.origin, {
3844
+ method: 'POST',
3845
+ body: body
3846
+ });
3847
+ _context2.next = 3;
3848
+ return _request.arrayBuffer();
3849
+ case 3:
3850
+ return _context2.abrupt("return", _context2.sent.byteLength);
3851
+ case 4:
3852
+ if (!(utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body))) {
3853
+ _context2.next = 5;
3854
+ break;
3855
+ }
3856
+ return _context2.abrupt("return", body.byteLength);
3857
+ case 5:
3858
+ if (utils$1.isURLSearchParams(body)) {
3859
+ body = body + '';
3860
+ }
3861
+ if (!utils$1.isString(body)) {
3862
+ _context2.next = 7;
3863
+ break;
3864
+ }
3865
+ _context2.next = 6;
3866
+ return encodeText(body);
3867
+ case 6:
3868
+ return _context2.abrupt("return", _context2.sent.byteLength);
3869
+ case 7:
3870
+ case "end":
3871
+ return _context2.stop();
3872
+ }
3873
+ }, _callee2);
3874
+ }));
3875
+ return function getBodyLength(_x2) {
3876
+ return _ref3.apply(this, arguments);
3877
+ };
3878
+ }();
3879
+ var resolveBodyLength = /*#__PURE__*/function () {
3880
+ var _ref4 = _asyncToGenerator(/*#__PURE__*/regenerator.mark(function _callee3(headers, body) {
3881
+ var length;
3882
+ return regenerator.wrap(function (_context3) {
3883
+ while (1) switch (_context3.prev = _context3.next) {
3884
+ case 0:
3885
+ length = utils$1.toFiniteNumber(headers.getContentLength());
3886
+ return _context3.abrupt("return", length == null ? getBodyLength(body) : length);
3887
+ case 1:
3888
+ case "end":
3889
+ return _context3.stop();
3890
+ }
3891
+ }, _callee3);
3892
+ }));
3893
+ return function resolveBodyLength(_x3, _x4) {
3894
+ return _ref4.apply(this, arguments);
3895
+ };
3896
+ }();
3897
+ return /*#__PURE__*/function () {
3898
+ var _ref5 = _asyncToGenerator(/*#__PURE__*/regenerator.mark(function _callee4(config) {
3899
+ var _resolveConfig, url, method, data, signal, cancelToken, timeout, onDownloadProgress, onUploadProgress, responseType, headers, _resolveConfig$withCr, withCredentials, fetchOptions, _fetch, composedSignal, request, unsubscribe, requestContentLength, _request, contentTypeHeader, _progressEventDecorat, _progressEventDecorat2, onProgress, flush, isCredentialsSupported, resolvedOptions, response, isStreamResponse, options, responseContentLength, _ref6, _ref7, _onProgress, _flush, responseData, _t3, _t4, _t5;
3900
+ return regenerator.wrap(function (_context4) {
3901
+ while (1) switch (_context4.prev = _context4.next) {
3902
+ case 0:
3903
+ _resolveConfig = resolveConfig(config), url = _resolveConfig.url, method = _resolveConfig.method, data = _resolveConfig.data, signal = _resolveConfig.signal, cancelToken = _resolveConfig.cancelToken, timeout = _resolveConfig.timeout, onDownloadProgress = _resolveConfig.onDownloadProgress, onUploadProgress = _resolveConfig.onUploadProgress, responseType = _resolveConfig.responseType, headers = _resolveConfig.headers, _resolveConfig$withCr = _resolveConfig.withCredentials, withCredentials = _resolveConfig$withCr === void 0 ? 'same-origin' : _resolveConfig$withCr, fetchOptions = _resolveConfig.fetchOptions;
3904
+ _fetch = envFetch || fetch;
3905
+ responseType = responseType ? (responseType + '').toLowerCase() : 'text';
3906
+ composedSignal = composeSignals$1([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
3907
+ request = null;
3908
+ unsubscribe = composedSignal && composedSignal.unsubscribe && function () {
3909
+ composedSignal.unsubscribe();
3910
+ };
3911
+ _context4.prev = 1;
3912
+ _t3 = onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head';
3913
+ if (!_t3) {
3914
+ _context4.next = 3;
3915
+ break;
3916
+ }
3917
+ _context4.next = 2;
3918
+ return resolveBodyLength(headers, data);
3919
+ case 2:
3920
+ _t4 = requestContentLength = _context4.sent;
3921
+ _t3 = _t4 !== 0;
3922
+ case 3:
3923
+ if (!_t3) {
3924
+ _context4.next = 4;
3925
+ break;
3926
+ }
3927
+ _request = new Request(url, {
3928
+ method: 'POST',
3929
+ body: data,
3930
+ duplex: "half"
3931
+ });
3932
+ if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
3933
+ headers.setContentType(contentTypeHeader);
3934
+ }
3935
+ if (_request.body) {
3936
+ _progressEventDecorat = progressEventDecorator(requestContentLength, progressEventReducer(asyncDecorator(onUploadProgress))), _progressEventDecorat2 = _slicedToArray(_progressEventDecorat, 2), onProgress = _progressEventDecorat2[0], flush = _progressEventDecorat2[1];
3937
+ data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
3938
+ }
3939
+ case 4:
3940
+ if (!utils$1.isString(withCredentials)) {
3941
+ withCredentials = withCredentials ? 'include' : 'omit';
3942
+ }
3836
3943
 
3837
- // Cloudflare Workers throws when credentials are defined
3838
- // see https://github.com/cloudflare/workerd/issues/902
3839
- isCredentialsSupported = "credentials" in Request.prototype;
3840
- request = new Request(url, _objectSpread$1(_objectSpread$1({}, fetchOptions), {}, {
3841
- signal: composedSignal,
3842
- method: method.toUpperCase(),
3843
- headers: headers.normalize().toJSON(),
3844
- body: data,
3845
- duplex: "half",
3846
- credentials: isCredentialsSupported ? withCredentials : undefined
3847
- }));
3848
- _context4.next = 20;
3849
- return fetch(request);
3850
- case 20:
3851
- response = _context4.sent;
3852
- isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
3853
- if (supportsResponseStream && (onDownloadProgress || isStreamResponse && unsubscribe)) {
3854
- options = {};
3855
- ['status', 'statusText', 'headers'].forEach(function (prop) {
3856
- options[prop] = response[prop];
3944
+ // Cloudflare Workers throws when credentials are defined
3945
+ // see https://github.com/cloudflare/workerd/issues/902
3946
+ isCredentialsSupported = isRequestSupported && "credentials" in Request.prototype;
3947
+ resolvedOptions = _objectSpread$1(_objectSpread$1({}, fetchOptions), {}, {
3948
+ signal: composedSignal,
3949
+ method: method.toUpperCase(),
3950
+ headers: headers.normalize().toJSON(),
3951
+ body: data,
3952
+ duplex: "half",
3953
+ credentials: isCredentialsSupported ? withCredentials : undefined
3857
3954
  });
3858
- responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
3859
- _ref5 = onDownloadProgress && progressEventDecorator(responseContentLength, progressEventReducer(asyncDecorator(onDownloadProgress), true)) || [], _ref6 = _slicedToArray(_ref5, 2), _onProgress = _ref6[0], _flush = _ref6[1];
3860
- response = new Response(trackStream(response.body, DEFAULT_CHUNK_SIZE, _onProgress, function () {
3861
- _flush && _flush();
3862
- unsubscribe && unsubscribe();
3863
- }), options);
3864
- }
3865
- responseType = responseType || 'text';
3866
- _context4.next = 26;
3867
- return resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config);
3868
- case 26:
3869
- responseData = _context4.sent;
3870
- !isStreamResponse && unsubscribe && unsubscribe();
3871
- _context4.next = 30;
3872
- return new Promise(function (resolve, reject) {
3873
- settle(resolve, reject, {
3874
- data: responseData,
3875
- headers: AxiosHeaders$1.from(response.headers),
3876
- status: response.status,
3877
- statusText: response.statusText,
3878
- config: config,
3879
- request: request
3955
+ request = isRequestSupported && new Request(url, resolvedOptions);
3956
+ _context4.next = 5;
3957
+ return isRequestSupported ? _fetch(request, fetchOptions) : _fetch(url, resolvedOptions);
3958
+ case 5:
3959
+ response = _context4.sent;
3960
+ isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
3961
+ if (supportsResponseStream && (onDownloadProgress || isStreamResponse && unsubscribe)) {
3962
+ options = {};
3963
+ ['status', 'statusText', 'headers'].forEach(function (prop) {
3964
+ options[prop] = response[prop];
3965
+ });
3966
+ responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
3967
+ _ref6 = onDownloadProgress && progressEventDecorator(responseContentLength, progressEventReducer(asyncDecorator(onDownloadProgress), true)) || [], _ref7 = _slicedToArray(_ref6, 2), _onProgress = _ref7[0], _flush = _ref7[1];
3968
+ response = new Response(trackStream(response.body, DEFAULT_CHUNK_SIZE, _onProgress, function () {
3969
+ _flush && _flush();
3970
+ unsubscribe && unsubscribe();
3971
+ }), options);
3972
+ }
3973
+ responseType = responseType || 'text';
3974
+ _context4.next = 6;
3975
+ return resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config);
3976
+ case 6:
3977
+ responseData = _context4.sent;
3978
+ !isStreamResponse && unsubscribe && unsubscribe();
3979
+ _context4.next = 7;
3980
+ return new Promise(function (resolve, reject) {
3981
+ settle(resolve, reject, {
3982
+ data: responseData,
3983
+ headers: AxiosHeaders$1.from(response.headers),
3984
+ status: response.status,
3985
+ statusText: response.statusText,
3986
+ config: config,
3987
+ request: request
3988
+ });
3880
3989
  });
3881
- });
3882
- case 30:
3883
- return _context4.abrupt("return", _context4.sent);
3884
- case 33:
3885
- _context4.prev = 33;
3886
- _context4.t2 = _context4["catch"](4);
3887
- unsubscribe && unsubscribe();
3888
- if (!(_context4.t2 && _context4.t2.name === 'TypeError' && /fetch/i.test(_context4.t2.message))) {
3889
- _context4.next = 38;
3890
- break;
3891
- }
3892
- throw Object.assign(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request), {
3893
- cause: _context4.t2.cause || _context4.t2
3894
- });
3895
- case 38:
3896
- throw AxiosError.from(_context4.t2, _context4.t2 && _context4.t2.code, config, request);
3897
- case 39:
3898
- case "end":
3899
- return _context4.stop();
3900
- }
3901
- }, _callee4, null, [[4, 33]]);
3902
- }));
3903
- return function (_x5) {
3904
- return _ref4.apply(this, arguments);
3905
- };
3906
- }());
3990
+ case 7:
3991
+ return _context4.abrupt("return", _context4.sent);
3992
+ case 8:
3993
+ _context4.prev = 8;
3994
+ _t5 = _context4["catch"](1);
3995
+ unsubscribe && unsubscribe();
3996
+ if (!(_t5 && _t5.name === 'TypeError' && /Load failed|fetch/i.test(_t5.message))) {
3997
+ _context4.next = 9;
3998
+ break;
3999
+ }
4000
+ throw Object.assign(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request), {
4001
+ cause: _t5.cause || _t5
4002
+ });
4003
+ case 9:
4004
+ throw AxiosError.from(_t5, _t5 && _t5.code, config, request);
4005
+ case 10:
4006
+ case "end":
4007
+ return _context4.stop();
4008
+ }
4009
+ }, _callee4, null, [[1, 8]]);
4010
+ }));
4011
+ return function (_x5) {
4012
+ return _ref5.apply(this, arguments);
4013
+ };
4014
+ }();
4015
+ };
4016
+ var seedCache = new Map();
4017
+ var getFetch = function getFetch(config) {
4018
+ var env = config && config.env || {};
4019
+ var fetch = env.fetch,
4020
+ Request = env.Request,
4021
+ Response = env.Response;
4022
+ var seeds = [Request, Response, fetch];
4023
+ var len = seeds.length,
4024
+ i = len,
4025
+ seed,
4026
+ target,
4027
+ map = seedCache;
4028
+ while (i--) {
4029
+ seed = seeds[i];
4030
+ target = map.get(seed);
4031
+ target === undefined && map.set(seed, target = i ? new Map() : factory(env));
4032
+ map = target;
4033
+ }
4034
+ return target;
4035
+ };
4036
+ getFetch();
3907
4037
 
4038
+ /**
4039
+ * Known adapters mapping.
4040
+ * Provides environment-specific adapters for Axios:
4041
+ * - `http` for Node.js
4042
+ * - `xhr` for browsers
4043
+ * - `fetch` for fetch API-based requests
4044
+ *
4045
+ * @type {Object<string, Function|Object>}
4046
+ */
3908
4047
  var knownAdapters = {
3909
4048
  http: httpAdapter,
3910
4049
  xhr: xhrAdapter,
3911
- fetch: fetchAdapter
4050
+ fetch: {
4051
+ get: getFetch
4052
+ }
3912
4053
  };
4054
+
4055
+ // Assign adapter names for easier debugging and identification
3913
4056
  utils$1.forEach(knownAdapters, function (fn, value) {
3914
4057
  if (fn) {
3915
4058
  try {
@@ -3924,47 +4067,85 @@
3924
4067
  });
3925
4068
  }
3926
4069
  });
4070
+
4071
+ /**
4072
+ * Render a rejection reason string for unknown or unsupported adapters
4073
+ *
4074
+ * @param {string} reason
4075
+ * @returns {string}
4076
+ */
3927
4077
  var renderReason = function renderReason(reason) {
3928
4078
  return "- ".concat(reason);
3929
4079
  };
4080
+
4081
+ /**
4082
+ * Check if the adapter is resolved (function, null, or false)
4083
+ *
4084
+ * @param {Function|null|false} adapter
4085
+ * @returns {boolean}
4086
+ */
3930
4087
  var isResolvedHandle = function isResolvedHandle(adapter) {
3931
4088
  return utils$1.isFunction(adapter) || adapter === null || adapter === false;
3932
4089
  };
3933
- var adapters = {
3934
- getAdapter: function getAdapter(adapters) {
3935
- adapters = utils$1.isArray(adapters) ? adapters : [adapters];
3936
- var _adapters = adapters,
3937
- length = _adapters.length;
3938
- var nameOrAdapter;
3939
- var adapter;
3940
- var rejectedReasons = {};
3941
- for (var i = 0; i < length; i++) {
3942
- nameOrAdapter = adapters[i];
3943
- var id = void 0;
3944
- adapter = nameOrAdapter;
3945
- if (!isResolvedHandle(nameOrAdapter)) {
3946
- adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
3947
- if (adapter === undefined) {
3948
- throw new AxiosError("Unknown adapter '".concat(id, "'"));
3949
- }
3950
- }
3951
- if (adapter) {
3952
- break;
4090
+
4091
+ /**
4092
+ * Get the first suitable adapter from the provided list.
4093
+ * Tries each adapter in order until a supported one is found.
4094
+ * Throws an AxiosError if no adapter is suitable.
4095
+ *
4096
+ * @param {Array<string|Function>|string|Function} adapters - Adapter(s) by name or function.
4097
+ * @param {Object} config - Axios request configuration
4098
+ * @throws {AxiosError} If no suitable adapter is available
4099
+ * @returns {Function} The resolved adapter function
4100
+ */
4101
+ function getAdapter(adapters, config) {
4102
+ adapters = utils$1.isArray(adapters) ? adapters : [adapters];
4103
+ var _adapters = adapters,
4104
+ length = _adapters.length;
4105
+ var nameOrAdapter;
4106
+ var adapter;
4107
+ var rejectedReasons = {};
4108
+ for (var i = 0; i < length; i++) {
4109
+ nameOrAdapter = adapters[i];
4110
+ var id = void 0;
4111
+ adapter = nameOrAdapter;
4112
+ if (!isResolvedHandle(nameOrAdapter)) {
4113
+ adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
4114
+ if (adapter === undefined) {
4115
+ throw new AxiosError("Unknown adapter '".concat(id, "'"));
3953
4116
  }
3954
- rejectedReasons[id || '#' + i] = adapter;
3955
4117
  }
3956
- if (!adapter) {
3957
- var reasons = Object.entries(rejectedReasons).map(function (_ref) {
3958
- var _ref2 = _slicedToArray(_ref, 2),
3959
- id = _ref2[0],
3960
- state = _ref2[1];
3961
- return "adapter ".concat(id, " ") + (state === false ? 'is not supported by the environment' : 'is not available in the build');
3962
- });
3963
- var s = length ? reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0]) : 'as no adapter specified';
3964
- throw new AxiosError("There is no suitable adapter to dispatch the request " + s, 'ERR_NOT_SUPPORT');
4118
+ if (adapter && (utils$1.isFunction(adapter) || (adapter = adapter.get(config)))) {
4119
+ break;
3965
4120
  }
3966
- return adapter;
3967
- },
4121
+ rejectedReasons[id || '#' + i] = adapter;
4122
+ }
4123
+ if (!adapter) {
4124
+ var reasons = Object.entries(rejectedReasons).map(function (_ref) {
4125
+ var _ref2 = _slicedToArray(_ref, 2),
4126
+ id = _ref2[0],
4127
+ state = _ref2[1];
4128
+ return "adapter ".concat(id, " ") + (state === false ? 'is not supported by the environment' : 'is not available in the build');
4129
+ });
4130
+ var s = length ? reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0]) : 'as no adapter specified';
4131
+ throw new AxiosError("There is no suitable adapter to dispatch the request " + s, 'ERR_NOT_SUPPORT');
4132
+ }
4133
+ return adapter;
4134
+ }
4135
+
4136
+ /**
4137
+ * Exports Axios adapters and utility to resolve an adapter
4138
+ */
4139
+ var adapters = {
4140
+ /**
4141
+ * Resolve an adapter from a list of adapter names or functions.
4142
+ * @type {Function}
4143
+ */
4144
+ getAdapter: getAdapter,
4145
+ /**
4146
+ * Exposes all known adapters
4147
+ * @type {Object<string, Function|Object>}
4148
+ */
3968
4149
  adapters: knownAdapters
3969
4150
  };
3970
4151
 
@@ -4000,7 +4181,7 @@
4000
4181
  if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {
4001
4182
  config.headers.setContentType('application/x-www-form-urlencoded', false);
4002
4183
  }
4003
- var adapter = adapters.getAdapter(config.adapter || defaults$1.adapter);
4184
+ var adapter = adapters.getAdapter(config.adapter || defaults$1.adapter, config);
4004
4185
  return adapter(config).then(function onAdapterResolution(response) {
4005
4186
  throwIfCancellationRequested(config);
4006
4187
 
@@ -4022,7 +4203,7 @@
4022
4203
  });
4023
4204
  }
4024
4205
 
4025
- var VERSION = "1.8.2";
4206
+ var VERSION = "1.13.2";
4026
4207
 
4027
4208
  var validators$1 = {};
4028
4209
 
@@ -4118,7 +4299,7 @@
4118
4299
  var Axios = /*#__PURE__*/function () {
4119
4300
  function Axios(instanceConfig) {
4120
4301
  _classCallCheck$1(this, Axios);
4121
- this.defaults = instanceConfig;
4302
+ this.defaults = instanceConfig || {};
4122
4303
  this.interceptors = {
4123
4304
  request: new InterceptorManager$1(),
4124
4305
  response: new InterceptorManager$1()
@@ -4136,42 +4317,42 @@
4136
4317
  return _createClass$1(Axios, [{
4137
4318
  key: "request",
4138
4319
  value: (function () {
4139
- var _request2 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee(configOrUrl, config) {
4140
- var dummy, stack;
4141
- return regenerator.wrap(function _callee$(_context) {
4320
+ var _request2 = _asyncToGenerator(/*#__PURE__*/regenerator.mark(function _callee(configOrUrl, config) {
4321
+ var dummy, stack, _t;
4322
+ return regenerator.wrap(function (_context) {
4142
4323
  while (1) switch (_context.prev = _context.next) {
4143
4324
  case 0:
4144
4325
  _context.prev = 0;
4145
- _context.next = 3;
4326
+ _context.next = 1;
4146
4327
  return this._request(configOrUrl, config);
4147
- case 3:
4328
+ case 1:
4148
4329
  return _context.abrupt("return", _context.sent);
4149
- case 6:
4150
- _context.prev = 6;
4151
- _context.t0 = _context["catch"](0);
4152
- if (_context.t0 instanceof Error) {
4330
+ case 2:
4331
+ _context.prev = 2;
4332
+ _t = _context["catch"](0);
4333
+ if (_t instanceof Error) {
4153
4334
  dummy = {};
4154
4335
  Error.captureStackTrace ? Error.captureStackTrace(dummy) : dummy = new Error();
4155
4336
 
4156
4337
  // slice off the Error: ... line
4157
4338
  stack = dummy.stack ? dummy.stack.replace(/^.+\n/, '') : '';
4158
4339
  try {
4159
- if (!_context.t0.stack) {
4160
- _context.t0.stack = stack;
4340
+ if (!_t.stack) {
4341
+ _t.stack = stack;
4161
4342
  // match without the 2 top stack lines
4162
- } else if (stack && !String(_context.t0.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) {
4163
- _context.t0.stack += '\n' + stack;
4343
+ } else if (stack && !String(_t.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) {
4344
+ _t.stack += '\n' + stack;
4164
4345
  }
4165
4346
  } catch (e) {
4166
4347
  // ignore the case where "stack" is an un-writable property
4167
4348
  }
4168
4349
  }
4169
- throw _context.t0;
4170
- case 10:
4350
+ throw _t;
4351
+ case 3:
4171
4352
  case "end":
4172
4353
  return _context.stop();
4173
4354
  }
4174
- }, _callee, this, [[0, 6]]);
4355
+ }, _callee, this, [[0, 2]]);
4175
4356
  }));
4176
4357
  function request(_x, _x2) {
4177
4358
  return _request2.apply(this, arguments);
@@ -4265,7 +4446,6 @@
4265
4446
  }
4266
4447
  len = requestInterceptorChain.length;
4267
4448
  var newConfig = config;
4268
- i = 0;
4269
4449
  while (i < len) {
4270
4450
  var onFulfilled = requestInterceptorChain[i++];
4271
4451
  var onRejected = requestInterceptorChain[i++];
@@ -4557,7 +4737,13 @@
4557
4737
  InsufficientStorage: 507,
4558
4738
  LoopDetected: 508,
4559
4739
  NotExtended: 510,
4560
- NetworkAuthenticationRequired: 511
4740
+ NetworkAuthenticationRequired: 511,
4741
+ WebServerIsDown: 521,
4742
+ ConnectionTimedOut: 522,
4743
+ OriginIsUnreachable: 523,
4744
+ TimeoutOccurred: 524,
4745
+ SslHandshakeFailed: 525,
4746
+ InvalidSslCertificate: 526
4561
4747
  };
4562
4748
  Object.entries(HttpStatusCode).forEach(function (_ref) {
4563
4749
  var _ref2 = _slicedToArray(_ref, 2),
@@ -4833,12 +5019,12 @@
4833
5019
  }, {
4834
5020
  key: "checkAPI",
4835
5021
  value: (function () {
4836
- var _checkAPI = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee() {
5022
+ var _checkAPI = _asyncToGenerator(/*#__PURE__*/regenerator.mark(function _callee() {
4837
5023
  var cloudLogin;
4838
- return regenerator.wrap(function _callee$(_context) {
5024
+ return regenerator.wrap(function (_context) {
4839
5025
  while (1) switch (_context.prev = _context.next) {
4840
5026
  case 0:
4841
- _context.next = 2;
5027
+ _context.next = 1;
4842
5028
  return axios$1.get('/api/v6/selected-account?profile=true', {
4843
5029
  headers: {
4844
5030
  Accept: 'application/json'
@@ -4849,12 +5035,12 @@
4849
5035
  console.error(error);
4850
5036
  return 'anonymous';
4851
5037
  });
4852
- case 2:
5038
+ case 1:
4853
5039
  cloudLogin = _context.sent;
4854
5040
  return _context.abrupt("return", {
4855
5041
  user: cloudLogin
4856
5042
  });
4857
- case 4:
5043
+ case 2:
4858
5044
  case "end":
4859
5045
  return _context.stop();
4860
5046
  }
@@ -4979,19 +5165,19 @@
4979
5165
  }, {
4980
5166
  key: "getAll",
4981
5167
  value: (function () {
4982
- var _getAll = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee() {
4983
- return regenerator.wrap(function _callee$(_context) {
5168
+ var _getAll = _asyncToGenerator(/*#__PURE__*/regenerator.mark(function _callee() {
5169
+ return regenerator.wrap(function (_context) {
4984
5170
  while (1) switch (_context.prev = _context.next) {
4985
5171
  case 0:
4986
- _context.next = 2;
5172
+ _context.next = 1;
4987
5173
  return this.isReady().then(function () {
4988
5174
  return lib.digitalData;
4989
5175
  }).catch(function () {
4990
5176
  return null;
4991
5177
  });
4992
- case 2:
5178
+ case 1:
4993
5179
  return _context.abrupt("return", _context.sent);
4994
- case 3:
5180
+ case 2:
4995
5181
  case "end":
4996
5182
  return _context.stop();
4997
5183
  }
@@ -5013,17 +5199,17 @@
5013
5199
  }, {
5014
5200
  key: "setVersion",
5015
5201
  value: (function () {
5016
- var _setVersion = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee2() {
5017
- return regenerator.wrap(function _callee2$(_context2) {
5202
+ var _setVersion = _asyncToGenerator(/*#__PURE__*/regenerator.mark(function _callee2() {
5203
+ return regenerator.wrap(function (_context2) {
5018
5204
  while (1) switch (_context2.prev = _context2.next) {
5019
5205
  case 0:
5020
- _context2.next = 2;
5206
+ _context2.next = 1;
5021
5207
  return this.isReady().then(function () {
5022
5208
  lib.digitalData.page.pageInfo.version = settings.version;
5023
5209
  });
5024
- case 2:
5210
+ case 1:
5025
5211
  return _context2.abrupt("return", _context2.sent);
5026
- case 3:
5212
+ case 2:
5027
5213
  case "end":
5028
5214
  return _context2.stop();
5029
5215
  }
@@ -5045,17 +5231,17 @@
5045
5231
  }, {
5046
5232
  key: "getLanguage",
5047
5233
  value: (function () {
5048
- var _getLanguage = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee3() {
5049
- return regenerator.wrap(function _callee3$(_context3) {
5234
+ var _getLanguage = _asyncToGenerator(/*#__PURE__*/regenerator.mark(function _callee3() {
5235
+ return regenerator.wrap(function (_context3) {
5050
5236
  while (1) switch (_context3.prev = _context3.next) {
5051
5237
  case 0:
5052
- _context3.next = 2;
5238
+ _context3.next = 1;
5053
5239
  return this.isReady().then(function () {
5054
5240
  return lib.digitalData.page.pageInfo.language;
5055
5241
  });
5056
- case 2:
5242
+ case 1:
5057
5243
  return _context3.abrupt("return", _context3.sent);
5058
- case 3:
5244
+ case 2:
5059
5245
  case "end":
5060
5246
  return _context3.stop();
5061
5247
  }
@@ -5077,17 +5263,17 @@
5077
5263
  }, {
5078
5264
  key: "getLocation",
5079
5265
  value: (function () {
5080
- var _getLocation = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee4() {
5081
- return regenerator.wrap(function _callee4$(_context4) {
5266
+ var _getLocation = _asyncToGenerator(/*#__PURE__*/regenerator.mark(function _callee4() {
5267
+ return regenerator.wrap(function (_context4) {
5082
5268
  while (1) switch (_context4.prev = _context4.next) {
5083
5269
  case 0:
5084
- _context4.next = 2;
5270
+ _context4.next = 1;
5085
5271
  return this.isReady().then(function () {
5086
5272
  return lib.digitalData.user.location.country.toLowerCase();
5087
5273
  });
5088
- case 2:
5274
+ case 1:
5089
5275
  return _context4.abrupt("return", _context4.sent);
5090
- case 3:
5276
+ case 2:
5091
5277
  case "end":
5092
5278
  return _context4.stop();
5093
5279
  }
@@ -5454,23 +5640,23 @@
5454
5640
  * @returns {Promise<Locale|boolean>} The cookie object if 'cc' and 'lc' values are present, otherwise false.
5455
5641
  */
5456
5642
  var _getLocaleFromCookie = /*#__PURE__*/function () {
5457
- var _ref = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee() {
5643
+ var _ref = _asyncToGenerator(/*#__PURE__*/regenerator.mark(function _callee() {
5458
5644
  var cookie;
5459
- return regenerator.wrap(function _callee$(_context) {
5645
+ return regenerator.wrap(function (_context) {
5460
5646
  while (1) switch (_context.prev = _context.next) {
5461
5647
  case 0:
5462
5648
  cookie = ipcinfoCookie.get();
5463
5649
  if (!(cookie && cookie.cc && cookie.lc)) {
5464
- _context.next = 5;
5650
+ _context.next = 2;
5465
5651
  break;
5466
5652
  }
5467
- _context.next = 4;
5653
+ _context.next = 1;
5468
5654
  return LocaleAPI.getList(cookie);
5469
- case 4:
5655
+ case 1:
5470
5656
  return _context.abrupt("return", cookie);
5471
- case 5:
5657
+ case 2:
5472
5658
  return _context.abrupt("return", false);
5473
- case 6:
5659
+ case 3:
5474
5660
  case "end":
5475
5661
  return _context.stop();
5476
5662
  }
@@ -5488,47 +5674,47 @@
5488
5674
  * @returns {Promise<Locale|boolean>} The verified locale or false if not found.
5489
5675
  */
5490
5676
  var _getLocaleFromBrowser = /*#__PURE__*/function () {
5491
- var _ref2 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee2() {
5677
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/regenerator.mark(function _callee2() {
5492
5678
  var cc, lang, lc, list, verifiedCodes;
5493
- return regenerator.wrap(function _callee2$(_context2) {
5679
+ return regenerator.wrap(function (_context2) {
5494
5680
  while (1) switch (_context2.prev = _context2.next) {
5495
5681
  case 0:
5496
5682
  _context2.prev = 0;
5497
- _context2.next = 3;
5683
+ _context2.next = 1;
5498
5684
  return DDOAPI.getLocation();
5499
- case 3:
5685
+ case 1:
5500
5686
  cc = _context2.sent;
5501
5687
  // Language preference from browser can return in either 'en-US' format or
5502
5688
  // 'en' so will need to extract language only.
5503
5689
  lang = lib.navigator.language;
5504
5690
  lc = lang.split('-')[0];
5505
5691
  if (!(cc && lc)) {
5506
- _context2.next = 13;
5692
+ _context2.next = 3;
5507
5693
  break;
5508
5694
  }
5509
- _context2.next = 9;
5695
+ _context2.next = 2;
5510
5696
  return LocaleAPI.getList({
5511
5697
  cc: cc,
5512
5698
  lc: lc
5513
5699
  });
5514
- case 9:
5700
+ case 2:
5515
5701
  list = _context2.sent;
5516
5702
  verifiedCodes = LocaleAPI.verifyLocale(cc, lc, list); // Set the ipcInfo cookie.
5517
5703
  ipcinfoCookie.set(verifiedCodes);
5518
5704
  return _context2.abrupt("return", verifiedCodes);
5519
- case 13:
5520
- _context2.next = 17;
5705
+ case 3:
5706
+ _context2.next = 5;
5521
5707
  break;
5522
- case 15:
5523
- _context2.prev = 15;
5524
- _context2.t0 = _context2["catch"](0);
5525
- case 17:
5708
+ case 4:
5709
+ _context2.prev = 4;
5710
+ _context2["catch"](0);
5711
+ case 5:
5526
5712
  return _context2.abrupt("return", false);
5527
- case 18:
5713
+ case 6:
5528
5714
  case "end":
5529
5715
  return _context2.stop();
5530
5716
  }
5531
- }, _callee2, null, [[0, 15]]);
5717
+ }, _callee2, null, [[0, 4]]);
5532
5718
  }));
5533
5719
  return function _getLocaleFromBrowser() {
5534
5720
  return _ref2.apply(this, arguments);
@@ -5629,35 +5815,35 @@
5629
5815
  }, {
5630
5816
  key: "getLocale",
5631
5817
  value: (function () {
5632
- var _getLocale = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee3() {
5818
+ var _getLocale = _asyncToGenerator(/*#__PURE__*/regenerator.mark(function _callee3() {
5633
5819
  var localeGetters, _i, _localeGetters, getter, locale;
5634
- return regenerator.wrap(function _callee3$(_context3) {
5820
+ return regenerator.wrap(function (_context3) {
5635
5821
  while (1) switch (_context3.prev = _context3.next) {
5636
5822
  case 0:
5637
5823
  localeGetters = [_getLocaleFromDDO, _getLocaleFromLangAttr, _getLocaleFromCookie, _getLocaleFromBrowser];
5638
5824
  _i = 0, _localeGetters = localeGetters;
5639
- case 2:
5825
+ case 1:
5640
5826
  if (!(_i < _localeGetters.length)) {
5641
- _context3.next = 12;
5827
+ _context3.next = 4;
5642
5828
  break;
5643
5829
  }
5644
5830
  getter = _localeGetters[_i];
5645
- _context3.next = 6;
5831
+ _context3.next = 2;
5646
5832
  return getter();
5647
- case 6:
5833
+ case 2:
5648
5834
  locale = _context3.sent;
5649
5835
  if (!locale) {
5650
- _context3.next = 9;
5836
+ _context3.next = 3;
5651
5837
  break;
5652
5838
  }
5653
5839
  return _context3.abrupt("return", locale);
5654
- case 9:
5840
+ case 3:
5655
5841
  _i++;
5656
- _context3.next = 2;
5842
+ _context3.next = 1;
5657
5843
  break;
5658
- case 12:
5844
+ case 4:
5659
5845
  return _context3.abrupt("return", _getLocaleDefault());
5660
- case 13:
5846
+ case 5:
5661
5847
  case "end":
5662
5848
  return _context3.stop();
5663
5849
  }
@@ -5685,8 +5871,8 @@
5685
5871
  }, {
5686
5872
  key: "getLang",
5687
5873
  value: (function () {
5688
- var _getLang = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee4() {
5689
- return regenerator.wrap(function _callee4$(_context4) {
5874
+ var _getLang = _asyncToGenerator(/*#__PURE__*/regenerator.mark(function _callee4() {
5875
+ return regenerator.wrap(function (_context4) {
5690
5876
  while (1) switch (_context4.prev = _context4.next) {
5691
5877
  case 0:
5692
5878
  return _context4.abrupt("return", this.getLocale());
@@ -5711,28 +5897,28 @@
5711
5897
  }, {
5712
5898
  key: "getLangDisplay",
5713
5899
  value: (function () {
5714
- var _getLangDisplay = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee5(locale) {
5715
- var lang, list, countries, location;
5716
- return regenerator.wrap(function _callee5$(_context5) {
5900
+ var _getLangDisplay = _asyncToGenerator(/*#__PURE__*/regenerator.mark(function _callee5(locale) {
5901
+ var lang, list, countries, location, _t2;
5902
+ return regenerator.wrap(function (_context5) {
5717
5903
  while (1) switch (_context5.prev = _context5.next) {
5718
5904
  case 0:
5719
5905
  if (!locale) {
5720
- _context5.next = 4;
5906
+ _context5.next = 1;
5721
5907
  break;
5722
5908
  }
5723
- _context5.t0 = locale;
5724
- _context5.next = 7;
5909
+ _t2 = locale;
5910
+ _context5.next = 3;
5725
5911
  break;
5726
- case 4:
5727
- _context5.next = 6;
5912
+ case 1:
5913
+ _context5.next = 2;
5728
5914
  return this.getLocale();
5729
- case 6:
5730
- _context5.t0 = _context5.sent;
5731
- case 7:
5732
- lang = _context5.t0;
5733
- _context5.next = 10;
5915
+ case 2:
5916
+ _t2 = _context5.sent;
5917
+ case 3:
5918
+ lang = _t2;
5919
+ _context5.next = 4;
5734
5920
  return this.getList(lang);
5735
- case 10:
5921
+ case 4:
5736
5922
  list = _context5.sent;
5737
5923
  // combines the countryList arrays
5738
5924
  countries = [];
@@ -5755,13 +5941,13 @@
5755
5941
  }
5756
5942
  });
5757
5943
  if (!location.length) {
5758
- _context5.next = 18;
5944
+ _context5.next = 5;
5759
5945
  break;
5760
5946
  }
5761
5947
  return _context5.abrupt("return", "".concat(location[0].name, " \u2014 ").concat(location[0].locale[0][1]));
5762
- case 18:
5948
+ case 5:
5763
5949
  return _context5.abrupt("return", _localeNameDefault);
5764
- case 19:
5950
+ case 6:
5765
5951
  case "end":
5766
5952
  return _context5.stop();
5767
5953
  }
@@ -5792,17 +5978,17 @@
5792
5978
  }, {
5793
5979
  key: "getList",
5794
5980
  value: (function () {
5795
- var _getList = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee6(_ref3) {
5981
+ var _getList = _asyncToGenerator(/*#__PURE__*/regenerator.mark(function _callee6(_ref3) {
5796
5982
  var _this = this;
5797
5983
  var cc, lc;
5798
- return regenerator.wrap(function _callee6$(_context6) {
5984
+ return regenerator.wrap(function (_context6) {
5799
5985
  while (1) switch (_context6.prev = _context6.next) {
5800
5986
  case 0:
5801
5987
  cc = _ref3.cc, lc = _ref3.lc;
5802
5988
  return _context6.abrupt("return", new Promise(function (resolve, reject) {
5803
5989
  _this.fetchList(cc, lc, resolve, reject);
5804
5990
  }));
5805
- case 2:
5991
+ case 1:
5806
5992
  case "end":
5807
5993
  return _context6.stop();
5808
5994
  }
@@ -6004,15 +6190,15 @@
6004
6190
  * }
6005
6191
  */
6006
6192
  function () {
6007
- var _getResults = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee(query) {
6193
+ var _getResults = _asyncToGenerator(/*#__PURE__*/regenerator.mark(function _callee(query) {
6008
6194
  var lc, cc, url;
6009
- return regenerator.wrap(function _callee$(_context) {
6195
+ return regenerator.wrap(function (_context) {
6010
6196
  while (1) switch (_context.prev = _context.next) {
6011
6197
  case 0:
6012
6198
  lc = 'en'; // TODO: create utility for fetching lc
6013
6199
  cc = 'us'; // TODO: create utility for fetching cc
6014
6200
  url = "".concat(_endpoint$2, "?locale=").concat(lc, "-").concat(cc, "&q=").concat(encodeURIComponent(query));
6015
- _context.next = 5;
6201
+ _context.next = 1;
6016
6202
  return axios$1.get(url, {
6017
6203
  headers: {
6018
6204
  'Content-Type': 'application/json; charset=utf-8'
@@ -6020,9 +6206,9 @@
6020
6206
  }).then(function (response) {
6021
6207
  return response.data;
6022
6208
  });
6023
- case 5:
6209
+ case 1:
6024
6210
  return _context.abrupt("return", _context.sent);
6025
- case 6:
6211
+ case 2:
6026
6212
  case "end":
6027
6213
  return _context.stop();
6028
6214
  }
@@ -6127,11 +6313,11 @@
6127
6313
  * }
6128
6314
  */
6129
6315
  function () {
6130
- var _getUserStatus = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee() {
6131
- return regenerator.wrap(function _callee$(_context) {
6316
+ var _getUserStatus = _asyncToGenerator(/*#__PURE__*/regenerator.mark(function _callee() {
6317
+ return regenerator.wrap(function (_context) {
6132
6318
  while (1) switch (_context.prev = _context.next) {
6133
6319
  case 0:
6134
- _context.next = 2;
6320
+ _context.next = 1;
6135
6321
  return axios$1.get(_endpoint$1, {
6136
6322
  headers: {
6137
6323
  'Content-Type': 'application/json; charset=utf-8'
@@ -6145,9 +6331,9 @@
6145
6331
  user: 'Unauthenticated'
6146
6332
  };
6147
6333
  });
6148
- case 2:
6334
+ case 1:
6149
6335
  return _context.abrupt("return", _context.sent);
6150
- case 3:
6336
+ case 2:
6151
6337
  case "end":
6152
6338
  return _context.stop();
6153
6339
  }
@@ -6183,12 +6369,12 @@
6183
6369
  }, {
6184
6370
  key: "checkCloudDocsAPI",
6185
6371
  value: (function () {
6186
- var _checkCloudDocsAPI = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee2() {
6372
+ var _checkCloudDocsAPI = _asyncToGenerator(/*#__PURE__*/regenerator.mark(function _callee2() {
6187
6373
  var cloudLogin;
6188
- return regenerator.wrap(function _callee2$(_context2) {
6374
+ return regenerator.wrap(function (_context2) {
6189
6375
  while (1) switch (_context2.prev = _context2.next) {
6190
6376
  case 0:
6191
- _context2.next = 2;
6377
+ _context2.next = 1;
6192
6378
  return axios$1.get('/api/v6/selected-account?profile=true', {
6193
6379
  headers: {
6194
6380
  Accept: 'application/json'
@@ -6199,12 +6385,12 @@
6199
6385
  console.error(error);
6200
6386
  return 'anonymous';
6201
6387
  });
6202
- case 2:
6388
+ case 1:
6203
6389
  cloudLogin = _context2.sent;
6204
6390
  return _context2.abrupt("return", {
6205
6391
  user: cloudLogin
6206
6392
  });
6207
- case 4:
6393
+ case 2:
6208
6394
  case "end":
6209
6395
  return _context2.stop();
6210
6396
  }
@@ -6315,25 +6501,25 @@
6315
6501
  * }
6316
6502
  */
6317
6503
  function () {
6318
- var _getResults = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee(query) {
6504
+ var _getResults = _asyncToGenerator(/*#__PURE__*/regenerator.mark(function _callee(query) {
6319
6505
  var appid,
6320
6506
  lang,
6321
6507
  urlQuery,
6322
6508
  url,
6323
6509
  _args = arguments;
6324
- return regenerator.wrap(function _callee$(_context) {
6510
+ return regenerator.wrap(function (_context) {
6325
6511
  while (1) switch (_context.prev = _context.next) {
6326
6512
  case 0:
6327
6513
  appid = _args.length > 1 && _args[1] !== undefined ? _args[1] : '';
6328
- _context.next = 3;
6514
+ _context.next = 1;
6329
6515
  return LocaleAPI.getLang();
6330
- case 3:
6516
+ case 1:
6331
6517
  lang = _context.sent;
6332
6518
  urlQuery = ["lang=".concat(lang.lc).concat(lang.cc ? "&cc=".concat(lang.cc) : ''), "query=".concat(encodeURIComponent(query)), "".concat(appid ? "appid=".concat(appid) : '')].filter(function (item) {
6333
6519
  return item;
6334
6520
  }).join('&');
6335
6521
  url = "".concat(_endpoint, "?").concat(urlQuery);
6336
- _context.next = 8;
6522
+ _context.next = 2;
6337
6523
  return axios$1.get(url, {
6338
6524
  headers: {
6339
6525
  'Content-Type': 'application/json; charset=utf-8'
@@ -6341,9 +6527,9 @@
6341
6527
  }).then(function (response) {
6342
6528
  return response.data.response;
6343
6529
  });
6344
- case 8:
6530
+ case 2:
6345
6531
  return _context.abrupt("return", _context.sent);
6346
- case 9:
6532
+ case 3:
6347
6533
  case "end":
6348
6534
  return _context.stop();
6349
6535
  }
@@ -6464,34 +6650,34 @@
6464
6650
  }, {
6465
6651
  key: "getTranslation",
6466
6652
  value: (function () {
6467
- var _getTranslation = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee(codes, endpoint) {
6653
+ var _getTranslation = _asyncToGenerator(/*#__PURE__*/regenerator.mark(function _callee(codes, endpoint) {
6468
6654
  var _this = this;
6469
6655
  var lang, country, locale;
6470
- return regenerator.wrap(function _callee$(_context) {
6656
+ return regenerator.wrap(function (_context) {
6471
6657
  while (1) switch (_context.prev = _context.next) {
6472
6658
  case 0:
6473
6659
  lang = 'en';
6474
6660
  country = 'us';
6475
6661
  if (!(codes && codes.lc && codes.cc)) {
6476
- _context.next = 7;
6662
+ _context.next = 1;
6477
6663
  break;
6478
6664
  }
6479
6665
  lang = codes.lc;
6480
6666
  country = codes.cc;
6481
- _context.next = 12;
6667
+ _context.next = 3;
6482
6668
  break;
6483
- case 7:
6484
- _context.next = 9;
6669
+ case 1:
6670
+ _context.next = 2;
6485
6671
  return LocaleAPI.getLocale();
6486
- case 9:
6672
+ case 2:
6487
6673
  locale = _context.sent;
6488
6674
  lang = locale.lc;
6489
6675
  country = locale.cc;
6490
- case 12:
6676
+ case 3:
6491
6677
  return _context.abrupt("return", new Promise(function (resolve, reject) {
6492
6678
  _this.fetchTranslation(lang, country, endpoint, resolve, reject);
6493
6679
  }));
6494
- case 13:
6680
+ case 4:
6495
6681
  case "end":
6496
6682
  return _context.stop();
6497
6683
  }
@@ -6825,20 +7011,20 @@
6825
7011
  }, {
6826
7012
  key: "embedMedia",
6827
7013
  value: (function () {
6828
- var _embedMedia = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee(mediaId, targetId) {
7014
+ var _embedMedia = _asyncToGenerator(/*#__PURE__*/regenerator.mark(function _callee(mediaId, targetId) {
6829
7015
  var flashvars,
6830
7016
  useIbmMetrics,
6831
7017
  customReadyCallback,
6832
7018
  fireEvent,
6833
7019
  _args = arguments;
6834
- return regenerator.wrap(function _callee$(_context) {
7020
+ return regenerator.wrap(function (_context) {
6835
7021
  while (1) switch (_context.prev = _context.next) {
6836
7022
  case 0:
6837
7023
  flashvars = _args.length > 2 && _args[2] !== undefined ? _args[2] : {};
6838
7024
  useIbmMetrics = _args.length > 3 && _args[3] !== undefined ? _args[3] : true;
6839
7025
  customReadyCallback = _args.length > 4 && _args[4] !== undefined ? _args[4] : function () {};
6840
7026
  fireEvent = this.fireEvent;
6841
- _context.next = 6;
7027
+ _context.next = 1;
6842
7028
  return this.checkScript().then(function () {
6843
7029
  var promiseKWidget = new Promise(function (resolve) {
6844
7030
  var defaultFlashVars = {
@@ -6928,9 +7114,9 @@
6928
7114
  }
6929
7115
  };
6930
7116
  });
6931
- case 6:
7117
+ case 1:
6932
7118
  return _context.abrupt("return", _context.sent);
6933
- case 7:
7119
+ case 2:
6934
7120
  case "end":
6935
7121
  return _context.stop();
6936
7122
  }
@@ -6993,11 +7179,11 @@
6993
7179
  }, {
6994
7180
  key: "api",
6995
7181
  value: (function () {
6996
- var _api = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee2(mediaId) {
6997
- return regenerator.wrap(function _callee2$(_context2) {
7182
+ var _api = _asyncToGenerator(/*#__PURE__*/regenerator.mark(function _callee2(mediaId) {
7183
+ return regenerator.wrap(function (_context2) {
6998
7184
  while (1) switch (_context2.prev = _context2.next) {
6999
7185
  case 0:
7000
- _context2.next = 2;
7186
+ _context2.next = 1;
7001
7187
  return this.checkScript().then(function () {
7002
7188
  if (mediaData && mediaData[mediaId]) {
7003
7189
  return mediaData[mediaId];
@@ -7016,9 +7202,9 @@
7016
7202
  });
7017
7203
  }
7018
7204
  });
7019
- case 2:
7205
+ case 1:
7020
7206
  return _context2.abrupt("return", _context2.sent);
7021
- case 3:
7207
+ case 2:
7022
7208
  case "end":
7023
7209
  return _context2.stop();
7024
7210
  }