@neurosity/sdk 7.0.1 → 7.2.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.
Files changed (170) hide show
  1. package/dist/index.js +2155 -970
  2. package/dist/index.js.map +1 -1
  3. package/dist/index.mjs +2155 -970
  4. package/dist/index.mjs.map +1 -1
  5. package/dist/neurosity.iife.js +2155 -970
  6. package/dist/neurosity.iife.js.map +1 -1
  7. package/dist/neurosity.umd.js +2155 -970
  8. package/dist/neurosity.umd.js.map +1 -1
  9. package/dist/types/Neurosity.d.ts +102 -0
  10. package/dist/types/Neurosity.d.ts.map +1 -0
  11. package/dist/types/api/bluetooth/BluetoothClient.d.ts +77 -0
  12. package/dist/types/api/bluetooth/BluetoothClient.d.ts.map +1 -0
  13. package/dist/types/api/bluetooth/BluetoothTransport.d.ts +31 -0
  14. package/dist/types/api/bluetooth/BluetoothTransport.d.ts.map +1 -0
  15. package/dist/types/api/bluetooth/constants.d.ts +5 -0
  16. package/dist/types/api/bluetooth/constants.d.ts.map +1 -0
  17. package/dist/types/api/bluetooth/index.d.ts +6 -0
  18. package/dist/types/api/bluetooth/index.d.ts.map +1 -0
  19. package/dist/types/api/bluetooth/react-native/ReactNativeTransport.d.ts +73 -0
  20. package/dist/types/api/bluetooth/react-native/ReactNativeTransport.d.ts.map +1 -0
  21. package/dist/types/api/bluetooth/react-native/index.d.ts +3 -0
  22. package/dist/types/api/bluetooth/react-native/index.d.ts.map +1 -0
  23. package/dist/types/api/bluetooth/react-native/types/BleManagerTypes.d.ts +64 -0
  24. package/dist/types/api/bluetooth/react-native/types/BleManagerTypes.d.ts.map +1 -0
  25. package/dist/types/api/bluetooth/react-native/types/ReactNativeTypes.d.ts +41 -0
  26. package/dist/types/api/bluetooth/react-native/types/ReactNativeTypes.d.ts.map +1 -0
  27. package/dist/types/api/bluetooth/react-native/types/index.d.ts +3 -0
  28. package/dist/types/api/bluetooth/react-native/types/index.d.ts.map +1 -0
  29. package/dist/types/api/bluetooth/types/index.d.ts +21 -0
  30. package/dist/types/api/bluetooth/types/index.d.ts.map +1 -0
  31. package/dist/types/api/bluetooth/utils/binaryBufferToEpoch.d.ts +10 -0
  32. package/dist/types/api/bluetooth/utils/binaryBufferToEpoch.d.ts.map +1 -0
  33. package/dist/types/api/bluetooth/utils/create6DigitPin.d.ts +2 -0
  34. package/dist/types/api/bluetooth/utils/create6DigitPin.d.ts.map +1 -0
  35. package/dist/types/api/bluetooth/utils/csvBufferToEpoch.d.ts +6 -0
  36. package/dist/types/api/bluetooth/utils/csvBufferToEpoch.d.ts.map +1 -0
  37. package/dist/types/api/bluetooth/utils/decodeJSONChunks.d.ts +10 -0
  38. package/dist/types/api/bluetooth/utils/decodeJSONChunks.d.ts.map +1 -0
  39. package/dist/types/api/bluetooth/utils/osHasBluetoothSupport.d.ts +3 -0
  40. package/dist/types/api/bluetooth/utils/osHasBluetoothSupport.d.ts.map +1 -0
  41. package/dist/types/api/bluetooth/utils/stitch.d.ts +6 -0
  42. package/dist/types/api/bluetooth/utils/stitch.d.ts.map +1 -0
  43. package/dist/types/api/bluetooth/utils/textCodec.d.ts +11 -0
  44. package/dist/types/api/bluetooth/utils/textCodec.d.ts.map +1 -0
  45. package/dist/types/api/bluetooth/web/WebBluetoothTransport.d.ts +48 -0
  46. package/dist/types/api/bluetooth/web/WebBluetoothTransport.d.ts.map +1 -0
  47. package/dist/types/api/bluetooth/web/isMaybeWebWorkerContext.d.ts +2 -0
  48. package/dist/types/api/bluetooth/web/isMaybeWebWorkerContext.d.ts.map +1 -0
  49. package/dist/types/api/bluetooth/web/isWebBluetoothSupported.d.ts +2 -0
  50. package/dist/types/api/bluetooth/web/isWebBluetoothSupported.d.ts.map +1 -0
  51. package/dist/types/api/firebase/FirebaseApp.d.ts +13 -0
  52. package/dist/types/api/firebase/FirebaseApp.d.ts.map +1 -0
  53. package/dist/types/api/firebase/FirebaseDevice.d.ts +35 -0
  54. package/dist/types/api/firebase/FirebaseDevice.d.ts.map +1 -0
  55. package/dist/types/api/firebase/FirebaseUser.d.ts +50 -0
  56. package/dist/types/api/firebase/FirebaseUser.d.ts.map +1 -0
  57. package/dist/types/api/firebase/config.d.ts +9 -0
  58. package/dist/types/api/firebase/config.d.ts.map +1 -0
  59. package/dist/types/api/firebase/deviceStore.d.ts +24 -0
  60. package/dist/types/api/firebase/deviceStore.d.ts.map +1 -0
  61. package/dist/types/api/firebase/index.d.ts +4 -0
  62. package/dist/types/api/firebase/index.d.ts.map +1 -0
  63. package/dist/types/api/https/config.d.ts +2 -0
  64. package/dist/types/api/https/config.d.ts.map +1 -0
  65. package/dist/types/api/https/createOAuthURL.d.ts +4 -0
  66. package/dist/types/api/https/createOAuthURL.d.ts.map +1 -0
  67. package/dist/types/api/https/getOAuthToken.d.ts +4 -0
  68. package/dist/types/api/https/getOAuthToken.d.ts.map +1 -0
  69. package/dist/types/api/https/utils.d.ts +3 -0
  70. package/dist/types/api/https/utils.d.ts.map +1 -0
  71. package/dist/types/api/index.d.ts +74 -0
  72. package/dist/types/api/index.d.ts.map +1 -0
  73. package/dist/types/index.d.ts +4 -0
  74. package/dist/types/index.d.ts.map +1 -0
  75. package/dist/types/subscriptions/SubscriptionManager.d.ts +9 -0
  76. package/dist/types/subscriptions/SubscriptionManager.d.ts.map +1 -0
  77. package/dist/types/timesync/Timesync.d.ts +21 -0
  78. package/dist/types/timesync/Timesync.d.ts.map +1 -0
  79. package/dist/types/timesync/index.d.ts +2 -0
  80. package/dist/types/timesync/index.d.ts.map +1 -0
  81. package/dist/types/types/accelerometer.d.ts +12 -0
  82. package/dist/types/types/accelerometer.d.ts.map +1 -0
  83. package/dist/types/types/actions.d.ts +11 -0
  84. package/dist/types/types/actions.d.ts.map +1 -0
  85. package/dist/types/types/apiKey.d.ts +31 -0
  86. package/dist/types/types/apiKey.d.ts.map +1 -0
  87. package/dist/types/types/awareness.d.ts +2 -0
  88. package/dist/types/types/awareness.d.ts.map +1 -0
  89. package/dist/types/types/brainwaves.d.ts +40 -0
  90. package/dist/types/types/brainwaves.d.ts.map +1 -0
  91. package/dist/types/types/calm.d.ts +7 -0
  92. package/dist/types/types/calm.d.ts.map +1 -0
  93. package/dist/types/types/client.d.ts +20 -0
  94. package/dist/types/types/client.d.ts.map +1 -0
  95. package/dist/types/types/credentials.d.ts +16 -0
  96. package/dist/types/types/credentials.d.ts.map +1 -0
  97. package/dist/types/types/deviceInfo.d.ts +20 -0
  98. package/dist/types/types/deviceInfo.d.ts.map +1 -0
  99. package/dist/types/types/epoch.d.ts +10 -0
  100. package/dist/types/types/epoch.d.ts.map +1 -0
  101. package/dist/types/types/experiment.d.ts +10 -0
  102. package/dist/types/types/experiment.d.ts.map +1 -0
  103. package/dist/types/types/focus.d.ts +7 -0
  104. package/dist/types/types/focus.d.ts.map +1 -0
  105. package/dist/types/types/hapticEffects.d.ts +126 -0
  106. package/dist/types/types/hapticEffects.d.ts.map +1 -0
  107. package/dist/types/types/index.d.ts +27 -0
  108. package/dist/types/types/index.d.ts.map +1 -0
  109. package/dist/types/types/kinesis.d.ts +7 -0
  110. package/dist/types/types/kinesis.d.ts.map +1 -0
  111. package/dist/types/types/marker.d.ts +5 -0
  112. package/dist/types/types/marker.d.ts.map +1 -0
  113. package/dist/types/types/metrics.d.ts +13 -0
  114. package/dist/types/types/metrics.d.ts.map +1 -0
  115. package/dist/types/types/oauth.d.ts +21 -0
  116. package/dist/types/types/oauth.d.ts.map +1 -0
  117. package/dist/types/types/options.d.ts +25 -0
  118. package/dist/types/types/options.d.ts.map +1 -0
  119. package/dist/types/types/recording.d.ts +26 -0
  120. package/dist/types/types/recording.d.ts.map +1 -0
  121. package/dist/types/types/sample.d.ts +10 -0
  122. package/dist/types/types/sample.d.ts.map +1 -0
  123. package/dist/types/types/settings.d.ts +8 -0
  124. package/dist/types/types/settings.d.ts.map +1 -0
  125. package/dist/types/types/signalQuality.d.ts +9 -0
  126. package/dist/types/types/signalQuality.d.ts.map +1 -0
  127. package/dist/types/types/signalQualityV2.d.ts +14 -0
  128. package/dist/types/types/signalQualityV2.d.ts.map +1 -0
  129. package/dist/types/types/skill.d.ts +45 -0
  130. package/dist/types/types/skill.d.ts.map +1 -0
  131. package/dist/types/types/status.d.ts +21 -0
  132. package/dist/types/types/status.d.ts.map +1 -0
  133. package/dist/types/types/streaming.d.ts +10 -0
  134. package/dist/types/types/streaming.d.ts.map +1 -0
  135. package/dist/types/types/subscriptions.d.ts +15 -0
  136. package/dist/types/types/subscriptions.d.ts.map +1 -0
  137. package/dist/types/types/training.d.ts +14 -0
  138. package/dist/types/types/training.d.ts.map +1 -0
  139. package/dist/types/types/user.d.ts +10 -0
  140. package/dist/types/types/user.d.ts.map +1 -0
  141. package/dist/types/utils/errors.d.ts +6 -0
  142. package/dist/types/utils/errors.d.ts.map +1 -0
  143. package/dist/types/utils/filterInternalKeys.d.ts +4 -0
  144. package/dist/types/utils/filterInternalKeys.d.ts.map +1 -0
  145. package/dist/types/utils/hapticEffects.d.ts +124 -0
  146. package/dist/types/utils/hapticEffects.d.ts.map +1 -0
  147. package/dist/types/utils/heartbeat.d.ts +5 -0
  148. package/dist/types/utils/heartbeat.d.ts.map +1 -0
  149. package/dist/types/utils/index.d.ts +14 -0
  150. package/dist/types/utils/index.d.ts.map +1 -0
  151. package/dist/types/utils/is-node.d.ts +2 -0
  152. package/dist/types/utils/is-node.d.ts.map +1 -0
  153. package/dist/types/utils/metrics.d.ts +4 -0
  154. package/dist/types/utils/metrics.d.ts.map +1 -0
  155. package/dist/types/utils/permissions.d.ts +16 -0
  156. package/dist/types/utils/permissions.d.ts.map +1 -0
  157. package/dist/types/utils/pick.d.ts +2 -0
  158. package/dist/types/utils/pick.d.ts.map +1 -0
  159. package/dist/types/utils/pipes.d.ts +18 -0
  160. package/dist/types/utils/pipes.d.ts.map +1 -0
  161. package/dist/types/utils/platform.d.ts +31 -0
  162. package/dist/types/utils/platform.d.ts.map +1 -0
  163. package/dist/types/utils/subscription.d.ts +7 -0
  164. package/dist/types/utils/subscription.d.ts.map +1 -0
  165. package/dist/types/utils/transferDevice.d.ts +10 -0
  166. package/dist/types/utils/transferDevice.d.ts.map +1 -0
  167. package/dist/types/utils/whileOnline.d.ts +9 -0
  168. package/dist/types/utils/whileOnline.d.ts.map +1 -0
  169. package/package.json +13 -9
  170. package/dist/index.d.ts +0 -1067
@@ -142,7 +142,7 @@
142
142
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
143
143
  };
144
144
 
145
- function isFunction$2(value) {
145
+ function isFunction$3(value) {
146
146
  return typeof value === 'function';
147
147
  }
148
148
 
@@ -210,7 +210,7 @@
210
210
  }
211
211
  }
212
212
  var initialFinalizer = this.initialTeardown;
213
- if (isFunction$2(initialFinalizer)) {
213
+ if (isFunction$3(initialFinalizer)) {
214
214
  try {
215
215
  initialFinalizer();
216
216
  }
@@ -302,10 +302,10 @@
302
302
  var EMPTY_SUBSCRIPTION = Subscription$1.EMPTY;
303
303
  function isSubscription(value) {
304
304
  return (value instanceof Subscription$1 ||
305
- (value && 'closed' in value && isFunction$2(value.remove) && isFunction$2(value.add) && isFunction$2(value.unsubscribe)));
305
+ (value && 'closed' in value && isFunction$3(value.remove) && isFunction$3(value.add) && isFunction$3(value.unsubscribe)));
306
306
  }
307
307
  function execFinalizer(finalizer) {
308
- if (isFunction$2(finalizer)) {
308
+ if (isFunction$3(finalizer)) {
309
309
  finalizer();
310
310
  }
311
311
  else {
@@ -460,7 +460,7 @@
460
460
  function SafeSubscriber(observerOrNext, error, complete) {
461
461
  var _this = _super.call(this) || this;
462
462
  var partialObserver;
463
- if (isFunction$2(observerOrNext) || !observerOrNext) {
463
+ if (isFunction$3(observerOrNext) || !observerOrNext) {
464
464
  partialObserver = {
465
465
  next: (observerOrNext !== null && observerOrNext !== void 0 ? observerOrNext : undefined),
466
466
  error: error !== null && error !== void 0 ? error : undefined,
@@ -605,14 +605,14 @@
605
605
  return (_a = promiseCtor !== null && promiseCtor !== void 0 ? promiseCtor : config$1.Promise) !== null && _a !== void 0 ? _a : Promise;
606
606
  }
607
607
  function isObserver(value) {
608
- return value && isFunction$2(value.next) && isFunction$2(value.error) && isFunction$2(value.complete);
608
+ return value && isFunction$3(value.next) && isFunction$3(value.error) && isFunction$3(value.complete);
609
609
  }
610
610
  function isSubscriber(value) {
611
611
  return (value && value instanceof Subscriber) || (isObserver(value) && isSubscription(value));
612
612
  }
613
613
 
614
614
  function hasLift(source) {
615
- return isFunction$2(source === null || source === void 0 ? void 0 : source.lift);
615
+ return isFunction$3(source === null || source === void 0 ? void 0 : source.lift);
616
616
  }
617
617
  function operate(init) {
618
618
  return function (source) {
@@ -1107,14 +1107,14 @@
1107
1107
  var EMPTY = new Observable(function (subscriber) { return subscriber.complete(); });
1108
1108
 
1109
1109
  function isScheduler(value) {
1110
- return value && isFunction$2(value.schedule);
1110
+ return value && isFunction$3(value.schedule);
1111
1111
  }
1112
1112
 
1113
1113
  function last(arr) {
1114
1114
  return arr[arr.length - 1];
1115
1115
  }
1116
1116
  function popResultSelector(args) {
1117
- return isFunction$2(last(args)) ? args.pop() : undefined;
1117
+ return isFunction$3(last(args)) ? args.pop() : undefined;
1118
1118
  }
1119
1119
  function popScheduler(args) {
1120
1120
  return isScheduler(last(args)) ? args.pop() : undefined;
@@ -1126,15 +1126,15 @@
1126
1126
  var isArrayLike = (function (x) { return x && typeof x.length === 'number' && typeof x !== 'function'; });
1127
1127
 
1128
1128
  function isPromise(value) {
1129
- return isFunction$2(value === null || value === void 0 ? void 0 : value.then);
1129
+ return isFunction$3(value === null || value === void 0 ? void 0 : value.then);
1130
1130
  }
1131
1131
 
1132
1132
  function isInteropObservable(input) {
1133
- return isFunction$2(input[observable]);
1133
+ return isFunction$3(input[observable]);
1134
1134
  }
1135
1135
 
1136
1136
  function isAsyncIterable(obj) {
1137
- return Symbol.asyncIterator && isFunction$2(obj === null || obj === void 0 ? void 0 : obj[Symbol.asyncIterator]);
1137
+ return Symbol.asyncIterator && isFunction$3(obj === null || obj === void 0 ? void 0 : obj[Symbol.asyncIterator]);
1138
1138
  }
1139
1139
 
1140
1140
  function createInvalidObservableTypeError(input) {
@@ -1147,10 +1147,10 @@
1147
1147
  }
1148
1148
  return Symbol.iterator;
1149
1149
  }
1150
- var iterator = getSymbolIterator();
1150
+ var iterator$1 = getSymbolIterator();
1151
1151
 
1152
- function isIterable(input) {
1153
- return isFunction$2(input === null || input === void 0 ? void 0 : input[iterator]);
1152
+ function isIterable$1(input) {
1153
+ return isFunction$3(input === null || input === void 0 ? void 0 : input[iterator$1]);
1154
1154
  }
1155
1155
 
1156
1156
  function readableStreamLikeToAsyncGenerator(readableStream) {
@@ -1186,7 +1186,7 @@
1186
1186
  });
1187
1187
  }
1188
1188
  function isReadableStreamLike(obj) {
1189
- return isFunction$2(obj === null || obj === void 0 ? void 0 : obj.getReader);
1189
+ return isFunction$3(obj === null || obj === void 0 ? void 0 : obj.getReader);
1190
1190
  }
1191
1191
 
1192
1192
  function innerFrom(input) {
@@ -1206,7 +1206,7 @@
1206
1206
  if (isAsyncIterable(input)) {
1207
1207
  return fromAsyncIterable(input);
1208
1208
  }
1209
- if (isIterable(input)) {
1209
+ if (isIterable$1(input)) {
1210
1210
  return fromIterable(input);
1211
1211
  }
1212
1212
  if (isReadableStreamLike(input)) {
@@ -1218,7 +1218,7 @@
1218
1218
  function fromInteropObservable(obj) {
1219
1219
  return new Observable(function (subscriber) {
1220
1220
  var obs = obj[observable]();
1221
- if (isFunction$2(obs.subscribe)) {
1221
+ if (isFunction$3(obs.subscribe)) {
1222
1222
  return obs.subscribe(subscriber);
1223
1223
  }
1224
1224
  throw new TypeError('Provided object does not correctly implement Symbol.observable');
@@ -1379,15 +1379,15 @@
1379
1379
 
1380
1380
  function scheduleIterable(input, scheduler) {
1381
1381
  return new Observable(function (subscriber) {
1382
- var iterator$1;
1382
+ var iterator;
1383
1383
  executeSchedule(subscriber, scheduler, function () {
1384
- iterator$1 = input[iterator]();
1384
+ iterator = input[iterator$1]();
1385
1385
  executeSchedule(subscriber, scheduler, function () {
1386
1386
  var _a;
1387
1387
  var value;
1388
1388
  var done;
1389
1389
  try {
1390
- (_a = iterator$1.next(), value = _a.value, done = _a.done);
1390
+ (_a = iterator.next(), value = _a.value, done = _a.done);
1391
1391
  }
1392
1392
  catch (err) {
1393
1393
  subscriber.error(err);
@@ -1401,7 +1401,7 @@
1401
1401
  }
1402
1402
  }, 0, true);
1403
1403
  });
1404
- return function () { return isFunction$2(iterator$1 === null || iterator$1 === void 0 ? void 0 : iterator$1.return) && iterator$1.return(); };
1404
+ return function () { return isFunction$3(iterator === null || iterator === void 0 ? void 0 : iterator.return) && iterator.return(); };
1405
1405
  });
1406
1406
  }
1407
1407
 
@@ -1444,7 +1444,7 @@
1444
1444
  if (isAsyncIterable(input)) {
1445
1445
  return scheduleAsyncIterable(input, scheduler);
1446
1446
  }
1447
- if (isIterable(input)) {
1447
+ if (isIterable$1(input)) {
1448
1448
  return scheduleIterable(input, scheduler);
1449
1449
  }
1450
1450
  if (isReadableStreamLike(input)) {
@@ -1468,7 +1468,7 @@
1468
1468
  }
1469
1469
 
1470
1470
  function throwError(errorOrErrorFactory, scheduler) {
1471
- var errorFactory = isFunction$2(errorOrErrorFactory) ? errorOrErrorFactory : function () { return errorOrErrorFactory; };
1471
+ var errorFactory = isFunction$3(errorOrErrorFactory) ? errorOrErrorFactory : function () { return errorOrErrorFactory; };
1472
1472
  var init = function (subscriber) { return subscriber.error(errorFactory()); };
1473
1473
  return new Observable(init);
1474
1474
  }
@@ -1659,7 +1659,7 @@
1659
1659
 
1660
1660
  function mergeMap(project, resultSelector, concurrent) {
1661
1661
  if (concurrent === void 0) { concurrent = Infinity; }
1662
- if (isFunction$2(resultSelector)) {
1662
+ if (isFunction$3(resultSelector)) {
1663
1663
  return mergeMap(function (a, i) { return map$1(function (b, ii) { return resultSelector(a, b, i, ii); })(innerFrom(project(a, i))); }, concurrent);
1664
1664
  }
1665
1665
  else if (typeof resultSelector === 'number') {
@@ -1701,7 +1701,7 @@
1701
1701
  return subscriber.next(e.length === 1 ? e[0] : e);
1702
1702
  };
1703
1703
  var retValue = addHandler(handler);
1704
- return isFunction$2(removeHandler) ? function () { return removeHandler(handler, retValue); } : undefined;
1704
+ return isFunction$3(removeHandler) ? function () { return removeHandler(handler, retValue); } : undefined;
1705
1705
  });
1706
1706
  }
1707
1707
 
@@ -1867,7 +1867,7 @@
1867
1867
  }
1868
1868
 
1869
1869
  function concatMap(project, resultSelector) {
1870
- return isFunction$2(resultSelector) ? mergeMap(project, resultSelector, 1) : mergeMap(project, 1);
1870
+ return isFunction$3(resultSelector) ? mergeMap(project, resultSelector, 1) : mergeMap(project, 1);
1871
1871
  }
1872
1872
 
1873
1873
  function concat() {
@@ -2089,7 +2089,7 @@
2089
2089
  }
2090
2090
 
2091
2091
  function tap(observerOrNext, error, complete) {
2092
- var tapObserver = isFunction$2(observerOrNext) || error || complete
2092
+ var tapObserver = isFunction$3(observerOrNext) || error || complete
2093
2093
  ?
2094
2094
  { next: observerOrNext, error: error, complete: complete }
2095
2095
  : observerOrNext;
@@ -2634,7 +2634,7 @@
2634
2634
  * @returns the `globalThis` object for the given environment.
2635
2635
  * @public
2636
2636
  */
2637
- function getGlobal() {
2637
+ function getGlobal$1() {
2638
2638
  if (typeof self !== 'undefined') {
2639
2639
  return self;
2640
2640
  }
@@ -2663,7 +2663,7 @@
2663
2663
  * See the License for the specific language governing permissions and
2664
2664
  * limitations under the License.
2665
2665
  */
2666
- const getDefaultsFromGlobal = () => getGlobal().__FIREBASE_DEFAULTS__;
2666
+ const getDefaultsFromGlobal = () => getGlobal$1().__FIREBASE_DEFAULTS__;
2667
2667
  /**
2668
2668
  * Attempt to read defaults from a JSON string provided to
2669
2669
  * process(.)env(.)__FIREBASE_DEFAULTS__ or a JSON file whose path is in
@@ -3133,7 +3133,7 @@
3133
3133
  *
3134
3134
  * @return true if ReactNative environment is detected.
3135
3135
  */
3136
- function isReactNative() {
3136
+ function isReactNative$1() {
3137
3137
  return (typeof navigator === 'object' && navigator['product'] === 'ReactNative');
3138
3138
  }
3139
3139
  /** Detects Internet Explorer. */
@@ -9832,7 +9832,7 @@
9832
9832
  if (isMobileCordova()) {
9833
9833
  stats['framework.cordova'] = 1;
9834
9834
  }
9835
- else if (isReactNative()) {
9835
+ else if (isReactNative$1()) {
9836
9836
  stats['framework.reactnative'] = 1;
9837
9837
  }
9838
9838
  this.reportStats(stats);
@@ -19393,7 +19393,7 @@
19393
19393
  this.longDelay = longDelay;
19394
19394
  // Internal error when improperly initialized.
19395
19395
  debugAssert(longDelay > shortDelay, 'Short delay should be less than long delay!');
19396
- this.isMobile = isMobileCordova() || isReactNative();
19396
+ this.isMobile = isMobileCordova() || isReactNative$1();
19397
19397
  }
19398
19398
  get() {
19399
19399
  if (!_isOnline()) {
@@ -30526,8 +30526,9 @@
30526
30526
  registerVersion(F, M, "esm2020");
30527
30527
  }();
30528
30528
 
30529
+ const productionApiKey = ["AIza", "SyB0TkZ83Fj0CIzn8AAmE-Osc92s3ER8hy8"].join("");
30529
30530
  const config = {
30530
- apiKey: "AIzaSyB0TkZ83Fj0CIzn8AAmE-Osc92s3ER8hy8",
30531
+ apiKey: productionApiKey,
30531
30532
  authDomain: "neurosity-device.firebaseapp.com",
30532
30533
  databaseURL: "https://neurosity-device.firebaseio.com",
30533
30534
  projectId: "neurosity-device",
@@ -31547,16 +31548,14 @@
31547
31548
  this.firebaseUser.onUserClaimsChange().subscribe((userClaims) => {
31548
31549
  this.userClaims = userClaims;
31549
31550
  });
31550
- this.onDeviceChange().subscribe(async (device) => {
31551
+ this.onDeviceChange().subscribe((device) => {
31551
31552
  if (this.firebaseDevice) {
31552
- try {
31553
- await this.firebaseDevice.disconnect();
31554
- }
31555
- catch (error) {
31553
+ this.firebaseDevice.disconnect().catch((error) => {
31556
31554
  console.error("Error disconnecting from device", error);
31557
- }
31555
+ });
31558
31556
  }
31559
31557
  if (!device) {
31558
+ this.firebaseDevice = undefined;
31560
31559
  return;
31561
31560
  }
31562
31561
  this.firebaseDevice = new FirebaseDevice({
@@ -31843,6 +31842,7 @@
31843
31842
  calm: "7d47617d-a60a-41d1-8df6-cfb78d02ffeb",
31844
31843
  accelerometer: "84501dee-8665-4073-b111-bdecd69fb489",
31845
31844
  signalQuality: "cf28ed0c-20cd-48ed-93c5-ee2fb265099a",
31845
+ signalQualityV2: "902ac5f3-ce59-4c11-94fa-437e89f90630",
31846
31846
  raw: "009cf0bb-b68d-4af1-a0e5-625f2eb964a6",
31847
31847
  rawUnfiltered: "5472432e-3313-4169-add8-6fcb29accb0e",
31848
31848
  psd: "d6684fb0-8518-40c0-8e88-4634e762435d",
@@ -31903,20 +31903,14 @@
31903
31903
  const metrics = {
31904
31904
  kinesis,
31905
31905
  predictions: kinesis,
31906
- channelAnalysis: channelNames,
31907
31906
  signalQuality: channelNames,
31908
- status: {
31909
- state: {},
31910
- battery: {},
31911
- charging: {},
31912
- connected: {},
31913
- connectedSince: {},
31914
- connectedLast: {},
31915
- updatingProgress: {},
31916
- simulate: {},
31917
- ssid: {}
31907
+ signalQualityV2: {
31908
+ timestamp: {},
31909
+ overall: {},
31910
+ byChannel: {}
31918
31911
  },
31919
31912
  accelerometer: {
31913
+ timestamp: {},
31920
31914
  acceleration: {},
31921
31915
  inclination: {},
31922
31916
  orientation: {},
@@ -32354,6 +32348,13 @@
32354
32348
  return new Error(`${prefix}You are trying to access data with an OAuth token or API key without access to the following scopes: ${requiredScopes.join(", ")}.`);
32355
32349
  }
32356
32350
 
32351
+ /**
32352
+ * Create a bound version of a function with a specified `this` context
32353
+ *
32354
+ * @param {Function} fn - The function to bind
32355
+ * @param {*} thisArg - The value to be passed as the `this` parameter
32356
+ * @returns {Function} A new function that will call the original function with the specified `this` context
32357
+ */
32357
32358
  function bind(fn, thisArg) {
32358
32359
  return function wrap() {
32359
32360
  return fn.apply(thisArg, arguments);
@@ -32362,29 +32363,30 @@
32362
32363
 
32363
32364
  // utils is a library of generic helper functions non-specific to axios
32364
32365
 
32365
- const {toString} = Object.prototype;
32366
- const {getPrototypeOf} = Object;
32366
+ const { toString } = Object.prototype;
32367
+ const { getPrototypeOf } = Object;
32368
+ const { iterator, toStringTag } = Symbol;
32367
32369
 
32368
- const kindOf = (cache => thing => {
32369
- const str = toString.call(thing);
32370
- return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
32370
+ const kindOf = ((cache) => (thing) => {
32371
+ const str = toString.call(thing);
32372
+ return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
32371
32373
  })(Object.create(null));
32372
32374
 
32373
32375
  const kindOfTest = (type) => {
32374
32376
  type = type.toLowerCase();
32375
- return (thing) => kindOf(thing) === type
32377
+ return (thing) => kindOf(thing) === type;
32376
32378
  };
32377
32379
 
32378
- const typeOfTest = type => thing => typeof thing === type;
32380
+ const typeOfTest = (type) => (thing) => typeof thing === type;
32379
32381
 
32380
32382
  /**
32381
- * Determine if a value is an Array
32383
+ * Determine if a value is a non-null object
32382
32384
  *
32383
32385
  * @param {Object} val The value to test
32384
32386
  *
32385
32387
  * @returns {boolean} True if value is an Array, otherwise false
32386
32388
  */
32387
- const {isArray} = Array;
32389
+ const { isArray } = Array;
32388
32390
 
32389
32391
  /**
32390
32392
  * Determine if a value is undefined
@@ -32403,8 +32405,14 @@
32403
32405
  * @returns {boolean} True if value is a Buffer, otherwise false
32404
32406
  */
32405
32407
  function isBuffer(val) {
32406
- return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
32407
- && isFunction$1(val.constructor.isBuffer) && val.constructor.isBuffer(val);
32408
+ return (
32409
+ val !== null &&
32410
+ !isUndefined(val) &&
32411
+ val.constructor !== null &&
32412
+ !isUndefined(val.constructor) &&
32413
+ isFunction$2(val.constructor.isBuffer) &&
32414
+ val.constructor.isBuffer(val)
32415
+ );
32408
32416
  }
32409
32417
 
32410
32418
  /**
@@ -32416,7 +32424,6 @@
32416
32424
  */
32417
32425
  const isArrayBuffer = kindOfTest('ArrayBuffer');
32418
32426
 
32419
-
32420
32427
  /**
32421
32428
  * Determine if a value is a view on an ArrayBuffer
32422
32429
  *
@@ -32426,10 +32433,10 @@
32426
32433
  */
32427
32434
  function isArrayBufferView(val) {
32428
32435
  let result;
32429
- if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
32436
+ if (typeof ArrayBuffer !== 'undefined' && ArrayBuffer.isView) {
32430
32437
  result = ArrayBuffer.isView(val);
32431
32438
  } else {
32432
- result = (val) && (val.buffer) && (isArrayBuffer(val.buffer));
32439
+ result = val && val.buffer && isArrayBuffer(val.buffer);
32433
32440
  }
32434
32441
  return result;
32435
32442
  }
@@ -32449,7 +32456,7 @@
32449
32456
  * @param {*} val The value to test
32450
32457
  * @returns {boolean} True if value is a Function, otherwise false
32451
32458
  */
32452
- const isFunction$1 = typeOfTest('function');
32459
+ const isFunction$2 = typeOfTest('function');
32453
32460
 
32454
32461
  /**
32455
32462
  * Determine if a value is a Number
@@ -32475,7 +32482,7 @@
32475
32482
  * @param {*} thing The value to test
32476
32483
  * @returns {boolean} True if value is a Boolean, otherwise false
32477
32484
  */
32478
- const isBoolean = thing => thing === true || thing === false;
32485
+ const isBoolean = (thing) => thing === true || thing === false;
32479
32486
 
32480
32487
  /**
32481
32488
  * Determine if a value is a plain Object
@@ -32490,7 +32497,34 @@
32490
32497
  }
32491
32498
 
32492
32499
  const prototype = getPrototypeOf(val);
32493
- return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val);
32500
+ return (
32501
+ (prototype === null ||
32502
+ prototype === Object.prototype ||
32503
+ Object.getPrototypeOf(prototype) === null) &&
32504
+ !(toStringTag in val) &&
32505
+ !(iterator in val)
32506
+ );
32507
+ };
32508
+
32509
+ /**
32510
+ * Determine if a value is an empty object (safely handles Buffers)
32511
+ *
32512
+ * @param {*} val The value to test
32513
+ *
32514
+ * @returns {boolean} True if value is an empty object, otherwise false
32515
+ */
32516
+ const isEmptyObject = (val) => {
32517
+ // Early return for non-objects or Buffers to prevent RangeError
32518
+ if (!isObject$1(val) || isBuffer(val)) {
32519
+ return false;
32520
+ }
32521
+
32522
+ try {
32523
+ return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
32524
+ } catch (e) {
32525
+ // Fallback for any other objects that might cause RangeError with Object.keys()
32526
+ return false;
32527
+ }
32494
32528
  };
32495
32529
 
32496
32530
  /**
@@ -32511,6 +32545,31 @@
32511
32545
  */
32512
32546
  const isFile = kindOfTest('File');
32513
32547
 
32548
+ /**
32549
+ * Determine if a value is a React Native Blob
32550
+ * React Native "blob": an object with a `uri` attribute. Optionally, it can
32551
+ * also have a `name` and `type` attribute to specify filename and content type
32552
+ *
32553
+ * @see https://github.com/facebook/react-native/blob/26684cf3adf4094eb6c405d345a75bf8c7c0bf88/Libraries/Network/FormData.js#L68-L71
32554
+ *
32555
+ * @param {*} value The value to test
32556
+ *
32557
+ * @returns {boolean} True if value is a React Native Blob, otherwise false
32558
+ */
32559
+ const isReactNativeBlob = (value) => {
32560
+ return !!(value && typeof value.uri !== 'undefined');
32561
+ };
32562
+
32563
+ /**
32564
+ * Determine if environment is React Native
32565
+ * ReactNative `FormData` has a non-standard `getParts()` method
32566
+ *
32567
+ * @param {*} formData The formData to test
32568
+ *
32569
+ * @returns {boolean} True if environment is React Native, otherwise false
32570
+ */
32571
+ const isReactNative = (formData) => formData && typeof formData.getParts !== 'undefined';
32572
+
32514
32573
  /**
32515
32574
  * Determine if a value is a Blob
32516
32575
  *
@@ -32536,7 +32595,7 @@
32536
32595
  *
32537
32596
  * @returns {boolean} True if value is a Stream, otherwise false
32538
32597
  */
32539
- const isStream = (val) => isObject$1(val) && isFunction$1(val.pipe);
32598
+ const isStream = (val) => isObject$1(val) && isFunction$2(val.pipe);
32540
32599
 
32541
32600
  /**
32542
32601
  * Determine if a value is a FormData
@@ -32545,17 +32604,28 @@
32545
32604
  *
32546
32605
  * @returns {boolean} True if value is an FormData, otherwise false
32547
32606
  */
32607
+ function getGlobal() {
32608
+ if (typeof globalThis !== 'undefined') return globalThis;
32609
+ if (typeof self !== 'undefined') return self;
32610
+ if (typeof window !== 'undefined') return window;
32611
+ if (typeof global !== 'undefined') return global;
32612
+ return {};
32613
+ }
32614
+
32615
+ const G = getGlobal();
32616
+ const FormDataCtor = typeof G.FormData !== 'undefined' ? G.FormData : undefined;
32617
+
32548
32618
  const isFormData = (thing) => {
32549
32619
  let kind;
32550
32620
  return thing && (
32551
- (typeof FormData === 'function' && thing instanceof FormData) || (
32552
- isFunction$1(thing.append) && (
32621
+ (FormDataCtor && thing instanceof FormDataCtor) || (
32622
+ isFunction$2(thing.append) && (
32553
32623
  (kind = kindOf(thing)) === 'formdata' ||
32554
32624
  // detect form-data instance
32555
- (kind === 'object' && isFunction$1(thing.toString) && thing.toString() === '[object FormData]')
32625
+ (kind === 'object' && isFunction$2(thing.toString) && thing.toString() === '[object FormData]')
32556
32626
  )
32557
32627
  )
32558
- )
32628
+ );
32559
32629
  };
32560
32630
 
32561
32631
  /**
@@ -32567,6 +32637,13 @@
32567
32637
  */
32568
32638
  const isURLSearchParams = kindOfTest('URLSearchParams');
32569
32639
 
32640
+ const [isReadableStream, isRequest, isResponse, isHeaders] = [
32641
+ 'ReadableStream',
32642
+ 'Request',
32643
+ 'Response',
32644
+ 'Headers',
32645
+ ].map(kindOfTest);
32646
+
32570
32647
  /**
32571
32648
  * Trim excess whitespace off the beginning and end of a string
32572
32649
  *
@@ -32574,9 +32651,9 @@
32574
32651
  *
32575
32652
  * @returns {String} The String freed of excess whitespace
32576
32653
  */
32577
- const trim = (str) => str.trim ?
32578
- str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
32579
-
32654
+ const trim = (str) => {
32655
+ return str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
32656
+ };
32580
32657
  /**
32581
32658
  * Iterate over an Array or an Object invoking a function for each item.
32582
32659
  *
@@ -32586,13 +32663,14 @@
32586
32663
  * If 'obj' is an Object callback will be called passing
32587
32664
  * the value, key, and complete object for each property.
32588
32665
  *
32589
- * @param {Object|Array} obj The object to iterate
32666
+ * @param {Object|Array<unknown>} obj The object to iterate
32590
32667
  * @param {Function} fn The callback to invoke for each item
32591
32668
  *
32592
- * @param {Boolean} [allOwnKeys = false]
32669
+ * @param {Object} [options]
32670
+ * @param {Boolean} [options.allOwnKeys = false]
32593
32671
  * @returns {any}
32594
32672
  */
32595
- function forEach(obj, fn, {allOwnKeys = false} = {}) {
32673
+ function forEach(obj, fn, { allOwnKeys = false } = {}) {
32596
32674
  // Don't bother if no value provided
32597
32675
  if (obj === null || typeof obj === 'undefined') {
32598
32676
  return;
@@ -32613,6 +32691,11 @@
32613
32691
  fn.call(null, obj[i], i, obj);
32614
32692
  }
32615
32693
  } else {
32694
+ // Buffer check
32695
+ if (isBuffer(obj)) {
32696
+ return;
32697
+ }
32698
+
32616
32699
  // Iterate over object keys
32617
32700
  const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
32618
32701
  const len = keys.length;
@@ -32625,7 +32708,19 @@
32625
32708
  }
32626
32709
  }
32627
32710
 
32711
+ /**
32712
+ * Finds a key in an object, case-insensitive, returning the actual key name.
32713
+ * Returns null if the object is a Buffer or if no match is found.
32714
+ *
32715
+ * @param {Object} obj - The object to search.
32716
+ * @param {string} key - The key to find (case-insensitive).
32717
+ * @returns {?string} The actual key name if found, otherwise null.
32718
+ */
32628
32719
  function findKey(obj, key) {
32720
+ if (isBuffer(obj)) {
32721
+ return null;
32722
+ }
32723
+
32629
32724
  key = key.toLowerCase();
32630
32725
  const keys = Object.keys(obj);
32631
32726
  let i = keys.length;
@@ -32641,8 +32736,8 @@
32641
32736
 
32642
32737
  const _global = (() => {
32643
32738
  /*eslint no-undef:0*/
32644
- if (typeof globalThis !== "undefined") return globalThis;
32645
- return typeof self !== "undefined" ? self : (typeof window !== 'undefined' ? window : global)
32739
+ if (typeof globalThis !== 'undefined') return globalThis;
32740
+ return typeof self !== 'undefined' ? self : typeof window !== 'undefined' ? window : global;
32646
32741
  })();
32647
32742
 
32648
32743
  const isContextDefined = (context) => !isUndefined(context) && context !== _global;
@@ -32657,7 +32752,7 @@
32657
32752
  * Example:
32658
32753
  *
32659
32754
  * ```js
32660
- * var result = merge({foo: 123}, {foo: 456});
32755
+ * const result = merge({foo: 123}, {foo: 456});
32661
32756
  * console.log(result.foo); // outputs 456
32662
32757
  * ```
32663
32758
  *
@@ -32666,17 +32761,22 @@
32666
32761
  * @returns {Object} Result of all merge properties
32667
32762
  */
32668
32763
  function merge(/* obj1, obj2, obj3, ... */) {
32669
- const {caseless} = isContextDefined(this) && this || {};
32764
+ const { caseless, skipUndefined } = (isContextDefined(this) && this) || {};
32670
32765
  const result = {};
32671
32766
  const assignValue = (val, key) => {
32672
- const targetKey = caseless && findKey(result, key) || key;
32767
+ // Skip dangerous property names to prevent prototype pollution
32768
+ if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
32769
+ return;
32770
+ }
32771
+
32772
+ const targetKey = (caseless && findKey(result, key)) || key;
32673
32773
  if (isPlainObject(result[targetKey]) && isPlainObject(val)) {
32674
32774
  result[targetKey] = merge(result[targetKey], val);
32675
32775
  } else if (isPlainObject(val)) {
32676
32776
  result[targetKey] = merge({}, val);
32677
32777
  } else if (isArray(val)) {
32678
32778
  result[targetKey] = val.slice();
32679
- } else {
32779
+ } else if (!skipUndefined || !isUndefined(val)) {
32680
32780
  result[targetKey] = val;
32681
32781
  }
32682
32782
  };
@@ -32694,17 +32794,32 @@
32694
32794
  * @param {Object} b The object to copy properties from
32695
32795
  * @param {Object} thisArg The object to bind function to
32696
32796
  *
32697
- * @param {Boolean} [allOwnKeys]
32797
+ * @param {Object} [options]
32798
+ * @param {Boolean} [options.allOwnKeys]
32698
32799
  * @returns {Object} The resulting value of object a
32699
32800
  */
32700
- const extend = (a, b, thisArg, {allOwnKeys}= {}) => {
32701
- forEach(b, (val, key) => {
32702
- if (thisArg && isFunction$1(val)) {
32703
- a[key] = bind(val, thisArg);
32704
- } else {
32705
- a[key] = val;
32706
- }
32707
- }, {allOwnKeys});
32801
+ const extend = (a, b, thisArg, { allOwnKeys } = {}) => {
32802
+ forEach(
32803
+ b,
32804
+ (val, key) => {
32805
+ if (thisArg && isFunction$2(val)) {
32806
+ Object.defineProperty(a, key, {
32807
+ value: bind(val, thisArg),
32808
+ writable: true,
32809
+ enumerable: true,
32810
+ configurable: true,
32811
+ });
32812
+ } else {
32813
+ Object.defineProperty(a, key, {
32814
+ value: val,
32815
+ writable: true,
32816
+ enumerable: true,
32817
+ configurable: true,
32818
+ });
32819
+ }
32820
+ },
32821
+ { allOwnKeys }
32822
+ );
32708
32823
  return a;
32709
32824
  };
32710
32825
 
@@ -32716,7 +32831,7 @@
32716
32831
  * @returns {string} content value without BOM
32717
32832
  */
32718
32833
  const stripBOM = (content) => {
32719
- if (content.charCodeAt(0) === 0xFEFF) {
32834
+ if (content.charCodeAt(0) === 0xfeff) {
32720
32835
  content = content.slice(1);
32721
32836
  }
32722
32837
  return content;
@@ -32733,9 +32848,14 @@
32733
32848
  */
32734
32849
  const inherits = (constructor, superConstructor, props, descriptors) => {
32735
32850
  constructor.prototype = Object.create(superConstructor.prototype, descriptors);
32736
- constructor.prototype.constructor = constructor;
32851
+ Object.defineProperty(constructor.prototype, 'constructor', {
32852
+ value: constructor,
32853
+ writable: true,
32854
+ enumerable: false,
32855
+ configurable: true,
32856
+ });
32737
32857
  Object.defineProperty(constructor, 'super', {
32738
- value: superConstructor.prototype
32858
+ value: superConstructor.prototype,
32739
32859
  });
32740
32860
  props && Object.assign(constructor.prototype, props);
32741
32861
  };
@@ -32794,7 +32914,6 @@
32794
32914
  return lastIndex !== -1 && lastIndex === position;
32795
32915
  };
32796
32916
 
32797
-
32798
32917
  /**
32799
32918
  * Returns new array from array like object or null if failed
32800
32919
  *
@@ -32823,9 +32942,9 @@
32823
32942
  * @returns {Array}
32824
32943
  */
32825
32944
  // eslint-disable-next-line func-names
32826
- const isTypedArray = (TypedArray => {
32945
+ const isTypedArray = ((TypedArray) => {
32827
32946
  // eslint-disable-next-line func-names
32828
- return thing => {
32947
+ return (thing) => {
32829
32948
  return TypedArray && thing instanceof TypedArray;
32830
32949
  };
32831
32950
  })(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array));
@@ -32839,13 +32958,13 @@
32839
32958
  * @returns {void}
32840
32959
  */
32841
32960
  const forEachEntry = (obj, fn) => {
32842
- const generator = obj && obj[Symbol.iterator];
32961
+ const generator = obj && obj[iterator];
32843
32962
 
32844
- const iterator = generator.call(obj);
32963
+ const _iterator = generator.call(obj);
32845
32964
 
32846
32965
  let result;
32847
32966
 
32848
- while ((result = iterator.next()) && !result.done) {
32967
+ while ((result = _iterator.next()) && !result.done) {
32849
32968
  const pair = result.value;
32850
32969
  fn.call(obj, pair[0], pair[1]);
32851
32970
  }
@@ -32873,16 +32992,18 @@
32873
32992
  /* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */
32874
32993
  const isHTMLForm = kindOfTest('HTMLFormElement');
32875
32994
 
32876
- const toCamelCase = str => {
32877
- return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,
32878
- function replacer(m, p1, p2) {
32879
- return p1.toUpperCase() + p2;
32880
- }
32881
- );
32995
+ const toCamelCase = (str) => {
32996
+ return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g, function replacer(m, p1, p2) {
32997
+ return p1.toUpperCase() + p2;
32998
+ });
32882
32999
  };
32883
33000
 
32884
33001
  /* Creating a function that will check if an object has a property. */
32885
- const hasOwnProperty = (({hasOwnProperty}) => (obj, prop) => hasOwnProperty.call(obj, prop))(Object.prototype);
33002
+ const hasOwnProperty = (
33003
+ ({ hasOwnProperty }) =>
33004
+ (obj, prop) =>
33005
+ hasOwnProperty.call(obj, prop)
33006
+ )(Object.prototype);
32886
33007
 
32887
33008
  /**
32888
33009
  * Determine if a value is a RegExp object
@@ -32915,13 +33036,13 @@
32915
33036
  const freezeMethods = (obj) => {
32916
33037
  reduceDescriptors(obj, (descriptor, name) => {
32917
33038
  // skip restricted props in strict mode
32918
- if (isFunction$1(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
33039
+ if (isFunction$2(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
32919
33040
  return false;
32920
33041
  }
32921
33042
 
32922
33043
  const value = obj[name];
32923
33044
 
32924
- if (!isFunction$1(value)) return;
33045
+ if (!isFunction$2(value)) return;
32925
33046
 
32926
33047
  descriptor.enumerable = false;
32927
33048
 
@@ -32932,17 +33053,25 @@
32932
33053
 
32933
33054
  if (!descriptor.set) {
32934
33055
  descriptor.set = () => {
32935
- throw Error('Can not rewrite read-only method \'' + name + '\'');
33056
+ throw Error("Can not rewrite read-only method '" + name + "'");
32936
33057
  };
32937
33058
  }
32938
33059
  });
32939
33060
  };
32940
33061
 
33062
+ /**
33063
+ * Converts an array or a delimited string into an object set with values as keys and true as values.
33064
+ * Useful for fast membership checks.
33065
+ *
33066
+ * @param {Array|string} arrayOrString - The array or string to convert.
33067
+ * @param {string} delimiter - The delimiter to use if input is a string.
33068
+ * @returns {Object} An object with keys from the array or string, values set to true.
33069
+ */
32941
33070
  const toObjectSet = (arrayOrString, delimiter) => {
32942
33071
  const obj = {};
32943
33072
 
32944
33073
  const define = (arr) => {
32945
- arr.forEach(value => {
33074
+ arr.forEach((value) => {
32946
33075
  obj[value] = true;
32947
33076
  });
32948
33077
  };
@@ -32955,28 +33084,7 @@
32955
33084
  const noop = () => {};
32956
33085
 
32957
33086
  const toFiniteNumber = (value, defaultValue) => {
32958
- value = +value;
32959
- return Number.isFinite(value) ? value : defaultValue;
32960
- };
32961
-
32962
- const ALPHA = 'abcdefghijklmnopqrstuvwxyz';
32963
-
32964
- const DIGIT = '0123456789';
32965
-
32966
- const ALPHABET = {
32967
- DIGIT,
32968
- ALPHA,
32969
- ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT
32970
- };
32971
-
32972
- const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {
32973
- let str = '';
32974
- const {length} = alphabet;
32975
- while (size--) {
32976
- str += alphabet[Math.random() * length|0];
32977
- }
32978
-
32979
- return str;
33087
+ return value != null && Number.isFinite((value = +value)) ? value : defaultValue;
32980
33088
  };
32981
33089
 
32982
33090
  /**
@@ -32987,20 +33095,35 @@
32987
33095
  * @returns {boolean}
32988
33096
  */
32989
33097
  function isSpecCompliantForm(thing) {
32990
- return !!(thing && isFunction$1(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator]);
33098
+ return !!(
33099
+ thing &&
33100
+ isFunction$2(thing.append) &&
33101
+ thing[toStringTag] === 'FormData' &&
33102
+ thing[iterator]
33103
+ );
32991
33104
  }
32992
33105
 
33106
+ /**
33107
+ * Recursively converts an object to a JSON-compatible object, handling circular references and Buffers.
33108
+ *
33109
+ * @param {Object} obj - The object to convert.
33110
+ * @returns {Object} The JSON-compatible object.
33111
+ */
32993
33112
  const toJSONObject = (obj) => {
32994
33113
  const stack = new Array(10);
32995
33114
 
32996
33115
  const visit = (source, i) => {
32997
-
32998
33116
  if (isObject$1(source)) {
32999
33117
  if (stack.indexOf(source) >= 0) {
33000
33118
  return;
33001
33119
  }
33002
33120
 
33003
- if(!('toJSON' in source)) {
33121
+ //Buffer check
33122
+ if (isBuffer(source)) {
33123
+ return source;
33124
+ }
33125
+
33126
+ if (!('toJSON' in source)) {
33004
33127
  stack[i] = source;
33005
33128
  const target = isArray(source) ? [] : {};
33006
33129
 
@@ -33021,10 +33144,76 @@
33021
33144
  return visit(obj, 0);
33022
33145
  };
33023
33146
 
33147
+ /**
33148
+ * Determines if a value is an async function.
33149
+ *
33150
+ * @param {*} thing - The value to test.
33151
+ * @returns {boolean} True if value is an async function, otherwise false.
33152
+ */
33024
33153
  const isAsyncFn = kindOfTest('AsyncFunction');
33025
33154
 
33155
+ /**
33156
+ * Determines if a value is thenable (has then and catch methods).
33157
+ *
33158
+ * @param {*} thing - The value to test.
33159
+ * @returns {boolean} True if value is thenable, otherwise false.
33160
+ */
33026
33161
  const isThenable = (thing) =>
33027
- thing && (isObject$1(thing) || isFunction$1(thing)) && isFunction$1(thing.then) && isFunction$1(thing.catch);
33162
+ thing &&
33163
+ (isObject$1(thing) || isFunction$2(thing)) &&
33164
+ isFunction$2(thing.then) &&
33165
+ isFunction$2(thing.catch);
33166
+
33167
+ // original code
33168
+ // https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34
33169
+
33170
+ /**
33171
+ * Provides a cross-platform setImmediate implementation.
33172
+ * Uses native setImmediate if available, otherwise falls back to postMessage or setTimeout.
33173
+ *
33174
+ * @param {boolean} setImmediateSupported - Whether setImmediate is supported.
33175
+ * @param {boolean} postMessageSupported - Whether postMessage is supported.
33176
+ * @returns {Function} A function to schedule a callback asynchronously.
33177
+ */
33178
+ const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
33179
+ if (setImmediateSupported) {
33180
+ return setImmediate;
33181
+ }
33182
+
33183
+ return postMessageSupported
33184
+ ? ((token, callbacks) => {
33185
+ _global.addEventListener(
33186
+ 'message',
33187
+ ({ source, data }) => {
33188
+ if (source === _global && data === token) {
33189
+ callbacks.length && callbacks.shift()();
33190
+ }
33191
+ },
33192
+ false
33193
+ );
33194
+
33195
+ return (cb) => {
33196
+ callbacks.push(cb);
33197
+ _global.postMessage(token, '*');
33198
+ };
33199
+ })(`axios@${Math.random()}`, [])
33200
+ : (cb) => setTimeout(cb);
33201
+ })(typeof setImmediate === 'function', isFunction$2(_global.postMessage));
33202
+
33203
+ /**
33204
+ * Schedules a microtask or asynchronous callback as soon as possible.
33205
+ * Uses queueMicrotask if available, otherwise falls back to process.nextTick or _setImmediate.
33206
+ *
33207
+ * @type {Function}
33208
+ */
33209
+ const asap =
33210
+ typeof queueMicrotask !== 'undefined'
33211
+ ? queueMicrotask.bind(_global)
33212
+ : (typeof process !== 'undefined' && process.nextTick) || _setImmediate;
33213
+
33214
+ // *********************
33215
+
33216
+ const isIterable = (thing) => thing != null && isFunction$2(thing[iterator]);
33028
33217
 
33029
33218
  var utils$1 = {
33030
33219
  isArray,
@@ -33037,12 +33226,19 @@
33037
33226
  isBoolean,
33038
33227
  isObject: isObject$1,
33039
33228
  isPlainObject,
33229
+ isEmptyObject,
33230
+ isReadableStream,
33231
+ isRequest,
33232
+ isResponse,
33233
+ isHeaders,
33040
33234
  isUndefined,
33041
33235
  isDate,
33042
33236
  isFile,
33237
+ isReactNativeBlob,
33238
+ isReactNative,
33043
33239
  isBlob,
33044
33240
  isRegExp,
33045
- isFunction: isFunction$1,
33241
+ isFunction: isFunction$2,
33046
33242
  isStream,
33047
33243
  isURLSearchParams,
33048
33244
  isTypedArray,
@@ -33072,44 +33268,66 @@
33072
33268
  findKey,
33073
33269
  global: _global,
33074
33270
  isContextDefined,
33075
- ALPHABET,
33076
- generateString,
33077
33271
  isSpecCompliantForm,
33078
33272
  toJSONObject,
33079
33273
  isAsyncFn,
33080
- isThenable
33274
+ isThenable,
33275
+ setImmediate: _setImmediate,
33276
+ asap,
33277
+ isIterable,
33081
33278
  };
33082
33279
 
33083
- /**
33084
- * Create an Error with the specified message, config, error code, request and response.
33085
- *
33086
- * @param {string} message The error message.
33087
- * @param {string} [code] The error code (for example, 'ECONNABORTED').
33088
- * @param {Object} [config] The config.
33089
- * @param {Object} [request] The request.
33090
- * @param {Object} [response] The response.
33091
- *
33092
- * @returns {Error} The created error.
33093
- */
33094
- function AxiosError$1(message, code, config, request, response) {
33095
- Error.call(this);
33280
+ let AxiosError$1 = class AxiosError extends Error {
33281
+ static from(error, code, config, request, response, customProps) {
33282
+ const axiosError = new AxiosError(error.message, code || error.code, config, request, response);
33283
+ axiosError.cause = error;
33284
+ axiosError.name = error.name;
33096
33285
 
33097
- if (Error.captureStackTrace) {
33098
- Error.captureStackTrace(this, this.constructor);
33099
- } else {
33100
- this.stack = (new Error()).stack;
33286
+ // Preserve status from the original error if not already set from response
33287
+ if (error.status != null && axiosError.status == null) {
33288
+ axiosError.status = error.status;
33289
+ }
33290
+
33291
+ customProps && Object.assign(axiosError, customProps);
33292
+ return axiosError;
33101
33293
  }
33102
33294
 
33103
- this.message = message;
33104
- this.name = 'AxiosError';
33105
- code && (this.code = code);
33106
- config && (this.config = config);
33107
- request && (this.request = request);
33108
- response && (this.response = response);
33109
- }
33295
+ /**
33296
+ * Create an Error with the specified message, config, error code, request and response.
33297
+ *
33298
+ * @param {string} message The error message.
33299
+ * @param {string} [code] The error code (for example, 'ECONNABORTED').
33300
+ * @param {Object} [config] The config.
33301
+ * @param {Object} [request] The request.
33302
+ * @param {Object} [response] The response.
33303
+ *
33304
+ * @returns {Error} The created error.
33305
+ */
33306
+ constructor(message, code, config, request, response) {
33307
+ super(message);
33308
+
33309
+ // Make message enumerable to maintain backward compatibility
33310
+ // The native Error constructor sets message as non-enumerable,
33311
+ // but axios < v1.13.3 had it as enumerable
33312
+ Object.defineProperty(this, 'message', {
33313
+ value: message,
33314
+ enumerable: true,
33315
+ writable: true,
33316
+ configurable: true
33317
+ });
33318
+
33319
+ this.name = 'AxiosError';
33320
+ this.isAxiosError = true;
33321
+ code && (this.code = code);
33322
+ config && (this.config = config);
33323
+ request && (this.request = request);
33324
+ if (response) {
33325
+ this.response = response;
33326
+ this.status = response.status;
33327
+ }
33328
+ }
33110
33329
 
33111
- utils$1.inherits(AxiosError$1, Error, {
33112
- toJSON: function toJSON() {
33330
+ toJSON() {
33113
33331
  return {
33114
33332
  // Standard
33115
33333
  message: this.message,
@@ -33125,56 +33343,25 @@
33125
33343
  // Axios
33126
33344
  config: utils$1.toJSONObject(this.config),
33127
33345
  code: this.code,
33128
- status: this.response && this.response.status ? this.response.status : null
33346
+ status: this.status,
33129
33347
  };
33130
33348
  }
33131
- });
33132
-
33133
- const prototype$1 = AxiosError$1.prototype;
33134
- const descriptors = {};
33135
-
33136
- [
33137
- 'ERR_BAD_OPTION_VALUE',
33138
- 'ERR_BAD_OPTION',
33139
- 'ECONNABORTED',
33140
- 'ETIMEDOUT',
33141
- 'ERR_NETWORK',
33142
- 'ERR_FR_TOO_MANY_REDIRECTS',
33143
- 'ERR_DEPRECATED',
33144
- 'ERR_BAD_RESPONSE',
33145
- 'ERR_BAD_REQUEST',
33146
- 'ERR_CANCELED',
33147
- 'ERR_NOT_SUPPORT',
33148
- 'ERR_INVALID_URL'
33149
- // eslint-disable-next-line func-names
33150
- ].forEach(code => {
33151
- descriptors[code] = {value: code};
33152
- });
33153
-
33154
- Object.defineProperties(AxiosError$1, descriptors);
33155
- Object.defineProperty(prototype$1, 'isAxiosError', {value: true});
33156
-
33157
- // eslint-disable-next-line func-names
33158
- AxiosError$1.from = (error, code, config, request, response, customProps) => {
33159
- const axiosError = Object.create(prototype$1);
33160
-
33161
- utils$1.toFlatObject(error, axiosError, function filter(obj) {
33162
- return obj !== Error.prototype;
33163
- }, prop => {
33164
- return prop !== 'isAxiosError';
33165
- });
33166
-
33167
- AxiosError$1.call(axiosError, error.message, code, config, request, response);
33168
-
33169
- axiosError.cause = error;
33170
-
33171
- axiosError.name = error.name;
33172
-
33173
- customProps && Object.assign(axiosError, customProps);
33174
-
33175
- return axiosError;
33176
33349
  };
33177
33350
 
33351
+ // This can be changed to static properties as soon as the parser options in .eslint.cjs are updated.
33352
+ AxiosError$1.ERR_BAD_OPTION_VALUE = 'ERR_BAD_OPTION_VALUE';
33353
+ AxiosError$1.ERR_BAD_OPTION = 'ERR_BAD_OPTION';
33354
+ AxiosError$1.ECONNABORTED = 'ECONNABORTED';
33355
+ AxiosError$1.ETIMEDOUT = 'ETIMEDOUT';
33356
+ AxiosError$1.ERR_NETWORK = 'ERR_NETWORK';
33357
+ AxiosError$1.ERR_FR_TOO_MANY_REDIRECTS = 'ERR_FR_TOO_MANY_REDIRECTS';
33358
+ AxiosError$1.ERR_DEPRECATED = 'ERR_DEPRECATED';
33359
+ AxiosError$1.ERR_BAD_RESPONSE = 'ERR_BAD_RESPONSE';
33360
+ AxiosError$1.ERR_BAD_REQUEST = 'ERR_BAD_REQUEST';
33361
+ AxiosError$1.ERR_CANCELED = 'ERR_CANCELED';
33362
+ AxiosError$1.ERR_NOT_SUPPORT = 'ERR_NOT_SUPPORT';
33363
+ AxiosError$1.ERR_INVALID_URL = 'ERR_INVALID_URL';
33364
+
33178
33365
  // eslint-disable-next-line strict
33179
33366
  var httpAdapter = null;
33180
33367
 
@@ -33211,11 +33398,14 @@
33211
33398
  */
33212
33399
  function renderKey(path, key, dots) {
33213
33400
  if (!path) return key;
33214
- return path.concat(key).map(function each(token, i) {
33215
- // eslint-disable-next-line no-param-reassign
33216
- token = removeBrackets(token);
33217
- return !dots && i ? '[' + token + ']' : token;
33218
- }).join(dots ? '.' : '');
33401
+ return path
33402
+ .concat(key)
33403
+ .map(function each(token, i) {
33404
+ // eslint-disable-next-line no-param-reassign
33405
+ token = removeBrackets(token);
33406
+ return !dots && i ? '[' + token + ']' : token;
33407
+ })
33408
+ .join(dots ? '.' : '');
33219
33409
  }
33220
33410
 
33221
33411
  /**
@@ -33265,21 +33455,26 @@
33265
33455
  formData = formData || new (FormData)();
33266
33456
 
33267
33457
  // eslint-disable-next-line no-param-reassign
33268
- options = utils$1.toFlatObject(options, {
33269
- metaTokens: true,
33270
- dots: false,
33271
- indexes: false
33272
- }, false, function defined(option, source) {
33273
- // eslint-disable-next-line no-eq-null,eqeqeq
33274
- return !utils$1.isUndefined(source[option]);
33275
- });
33458
+ options = utils$1.toFlatObject(
33459
+ options,
33460
+ {
33461
+ metaTokens: true,
33462
+ dots: false,
33463
+ indexes: false,
33464
+ },
33465
+ false,
33466
+ function defined(option, source) {
33467
+ // eslint-disable-next-line no-eq-null,eqeqeq
33468
+ return !utils$1.isUndefined(source[option]);
33469
+ }
33470
+ );
33276
33471
 
33277
33472
  const metaTokens = options.metaTokens;
33278
33473
  // eslint-disable-next-line no-use-before-define
33279
33474
  const visitor = options.visitor || defaultVisitor;
33280
33475
  const dots = options.dots;
33281
33476
  const indexes = options.indexes;
33282
- const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
33477
+ const _Blob = options.Blob || (typeof Blob !== 'undefined' && Blob);
33283
33478
  const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
33284
33479
 
33285
33480
  if (!utils$1.isFunction(visitor)) {
@@ -33293,6 +33488,10 @@
33293
33488
  return value.toISOString();
33294
33489
  }
33295
33490
 
33491
+ if (utils$1.isBoolean(value)) {
33492
+ return value.toString();
33493
+ }
33494
+
33296
33495
  if (!useBlob && utils$1.isBlob(value)) {
33297
33496
  throw new AxiosError$1('Blob is not supported. Use a Buffer instead.');
33298
33497
  }
@@ -33317,6 +33516,11 @@
33317
33516
  function defaultVisitor(value, key, path) {
33318
33517
  let arr = value;
33319
33518
 
33519
+ if (utils$1.isReactNative(formData) && utils$1.isReactNativeBlob(value)) {
33520
+ formData.append(renderKey(path, key, dots), convertValue(value));
33521
+ return false;
33522
+ }
33523
+
33320
33524
  if (value && !path && typeof value === 'object') {
33321
33525
  if (utils$1.endsWith(key, '{}')) {
33322
33526
  // eslint-disable-next-line no-param-reassign
@@ -33325,17 +33529,22 @@
33325
33529
  value = JSON.stringify(value);
33326
33530
  } else if (
33327
33531
  (utils$1.isArray(value) && isFlatArray(value)) ||
33328
- ((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value))
33329
- )) {
33532
+ ((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value)))
33533
+ ) {
33330
33534
  // eslint-disable-next-line no-param-reassign
33331
33535
  key = removeBrackets(key);
33332
33536
 
33333
33537
  arr.forEach(function each(el, index) {
33334
- !(utils$1.isUndefined(el) || el === null) && formData.append(
33335
- // eslint-disable-next-line no-nested-ternary
33336
- indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'),
33337
- convertValue(el)
33338
- );
33538
+ !(utils$1.isUndefined(el) || el === null) &&
33539
+ formData.append(
33540
+ // eslint-disable-next-line no-nested-ternary
33541
+ indexes === true
33542
+ ? renderKey([key], index, dots)
33543
+ : indexes === null
33544
+ ? key
33545
+ : key + '[]',
33546
+ convertValue(el)
33547
+ );
33339
33548
  });
33340
33549
  return false;
33341
33550
  }
@@ -33355,7 +33564,7 @@
33355
33564
  const exposedHelpers = Object.assign(predicates, {
33356
33565
  defaultVisitor,
33357
33566
  convertValue,
33358
- isVisitable
33567
+ isVisitable,
33359
33568
  });
33360
33569
 
33361
33570
  function build(value, path) {
@@ -33368,9 +33577,9 @@
33368
33577
  stack.push(value);
33369
33578
 
33370
33579
  utils$1.forEach(value, function each(el, key) {
33371
- const result = !(utils$1.isUndefined(el) || el === null) && visitor.call(
33372
- formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers
33373
- );
33580
+ const result =
33581
+ !(utils$1.isUndefined(el) || el === null) &&
33582
+ visitor.call(formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers);
33374
33583
 
33375
33584
  if (result === true) {
33376
33585
  build(el, path ? path.concat(key) : [key]);
@@ -33405,7 +33614,7 @@
33405
33614
  ')': '%29',
33406
33615
  '~': '%7E',
33407
33616
  '%20': '+',
33408
- '%00': '\x00'
33617
+ '%00': '\x00',
33409
33618
  };
33410
33619
  return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
33411
33620
  return charMap[match];
@@ -33433,31 +33642,33 @@
33433
33642
  };
33434
33643
 
33435
33644
  prototype.toString = function toString(encoder) {
33436
- const _encode = encoder ? function(value) {
33437
- return encoder.call(this, value, encode$1);
33438
- } : encode$1;
33645
+ const _encode = encoder
33646
+ ? function (value) {
33647
+ return encoder.call(this, value, encode$1);
33648
+ }
33649
+ : encode$1;
33439
33650
 
33440
- return this._pairs.map(function each(pair) {
33441
- return _encode(pair[0]) + '=' + _encode(pair[1]);
33442
- }, '').join('&');
33651
+ return this._pairs
33652
+ .map(function each(pair) {
33653
+ return _encode(pair[0]) + '=' + _encode(pair[1]);
33654
+ }, '')
33655
+ .join('&');
33443
33656
  };
33444
33657
 
33445
33658
  /**
33446
- * It replaces all instances of the characters `:`, `$`, `,`, `+`, `[`, and `]` with their
33447
- * URI encoded counterparts
33659
+ * It replaces URL-encoded forms of `:`, `$`, `,`, and spaces with
33660
+ * their plain counterparts (`:`, `$`, `,`, `+`).
33448
33661
  *
33449
33662
  * @param {string} val The value to be encoded.
33450
33663
  *
33451
33664
  * @returns {string} The encoded value.
33452
33665
  */
33453
33666
  function encode(val) {
33454
- return encodeURIComponent(val).
33455
- replace(/%3A/gi, ':').
33456
- replace(/%24/g, '$').
33457
- replace(/%2C/gi, ',').
33458
- replace(/%20/g, '+').
33459
- replace(/%5B/gi, '[').
33460
- replace(/%5D/gi, ']');
33667
+ return encodeURIComponent(val)
33668
+ .replace(/%3A/gi, ':')
33669
+ .replace(/%24/g, '$')
33670
+ .replace(/%2C/gi, ',')
33671
+ .replace(/%20/g, '+');
33461
33672
  }
33462
33673
 
33463
33674
  /**
@@ -33465,32 +33676,37 @@
33465
33676
  *
33466
33677
  * @param {string} url The base of the url (e.g., http://www.google.com)
33467
33678
  * @param {object} [params] The params to be appended
33468
- * @param {?object} options
33679
+ * @param {?(object|Function)} options
33469
33680
  *
33470
33681
  * @returns {string} The formatted url
33471
33682
  */
33472
33683
  function buildURL(url, params, options) {
33473
- /*eslint no-param-reassign:0*/
33474
33684
  if (!params) {
33475
33685
  return url;
33476
33686
  }
33477
-
33478
- const _encode = options && options.encode || encode;
33479
33687
 
33480
- const serializeFn = options && options.serialize;
33688
+ const _encode = (options && options.encode) || encode;
33689
+
33690
+ const _options = utils$1.isFunction(options)
33691
+ ? {
33692
+ serialize: options,
33693
+ }
33694
+ : options;
33695
+
33696
+ const serializeFn = _options && _options.serialize;
33481
33697
 
33482
33698
  let serializedParams;
33483
33699
 
33484
33700
  if (serializeFn) {
33485
- serializedParams = serializeFn(params, options);
33701
+ serializedParams = serializeFn(params, _options);
33486
33702
  } else {
33487
- serializedParams = utils$1.isURLSearchParams(params) ?
33488
- params.toString() :
33489
- new AxiosURLSearchParams(params, options).toString(_encode);
33703
+ serializedParams = utils$1.isURLSearchParams(params)
33704
+ ? params.toString()
33705
+ : new AxiosURLSearchParams(params, _options).toString(_encode);
33490
33706
  }
33491
33707
 
33492
33708
  if (serializedParams) {
33493
- const hashmarkIndex = url.indexOf("#");
33709
+ const hashmarkIndex = url.indexOf('#');
33494
33710
 
33495
33711
  if (hashmarkIndex !== -1) {
33496
33712
  url = url.slice(0, hashmarkIndex);
@@ -33511,6 +33727,7 @@
33511
33727
  *
33512
33728
  * @param {Function} fulfilled The function to handle `then` for a `Promise`
33513
33729
  * @param {Function} rejected The function to handle `reject` for a `Promise`
33730
+ * @param {Object} options The options for the interceptor, synchronous and runWhen
33514
33731
  *
33515
33732
  * @return {Number} An ID used to remove interceptor later
33516
33733
  */
@@ -33519,7 +33736,7 @@
33519
33736
  fulfilled,
33520
33737
  rejected,
33521
33738
  synchronous: options ? options.synchronous : false,
33522
- runWhen: options ? options.runWhen : null
33739
+ runWhen: options ? options.runWhen : null,
33523
33740
  });
33524
33741
  return this.handlers.length - 1;
33525
33742
  }
@@ -33529,7 +33746,7 @@
33529
33746
  *
33530
33747
  * @param {Number} id The ID that was returned by `use`
33531
33748
  *
33532
- * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
33749
+ * @returns {void}
33533
33750
  */
33534
33751
  eject(id) {
33535
33752
  if (this.handlers[id]) {
@@ -33570,7 +33787,8 @@
33570
33787
  var transitionalDefaults = {
33571
33788
  silentJSONParsing: true,
33572
33789
  forcedJSONParsing: true,
33573
- clarifyTimeoutError: false
33790
+ clarifyTimeoutError: false,
33791
+ legacyInterceptorReqResOrdering: true,
33574
33792
  };
33575
33793
 
33576
33794
  var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
@@ -33584,13 +33802,15 @@
33584
33802
  classes: {
33585
33803
  URLSearchParams: URLSearchParams$1,
33586
33804
  FormData: FormData$1,
33587
- Blob: Blob$1
33805
+ Blob: Blob$1,
33588
33806
  },
33589
- protocols: ['http', 'https', 'file', 'blob', 'url', 'data']
33807
+ protocols: ['http', 'https', 'file', 'blob', 'url', 'data'],
33590
33808
  };
33591
33809
 
33592
33810
  const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
33593
33811
 
33812
+ const _navigator = (typeof navigator === 'object' && navigator) || undefined;
33813
+
33594
33814
  /**
33595
33815
  * Determine if we're running in a standard browser environment
33596
33816
  *
@@ -33608,10 +33828,9 @@
33608
33828
  *
33609
33829
  * @returns {boolean}
33610
33830
  */
33611
- const hasStandardBrowserEnv = (
33612
- (product) => {
33613
- return hasBrowserEnv && ['ReactNative', 'NativeScript', 'NS'].indexOf(product) < 0
33614
- })(typeof navigator !== 'undefined' && navigator.product);
33831
+ const hasStandardBrowserEnv =
33832
+ hasBrowserEnv &&
33833
+ (!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);
33615
33834
 
33616
33835
  /**
33617
33836
  * Determine if we're running in a standard browser webWorker environment
@@ -33631,29 +33850,34 @@
33631
33850
  );
33632
33851
  })();
33633
33852
 
33853
+ const origin = (hasBrowserEnv && window.location.href) || 'http://localhost';
33854
+
33634
33855
  var utils = /*#__PURE__*/Object.freeze({
33635
33856
  __proto__: null,
33636
33857
  hasBrowserEnv: hasBrowserEnv,
33637
33858
  hasStandardBrowserEnv: hasStandardBrowserEnv,
33638
- hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv
33859
+ hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
33860
+ navigator: _navigator,
33861
+ origin: origin
33639
33862
  });
33640
33863
 
33641
33864
  var platform = {
33642
33865
  ...utils,
33643
- ...platform$1
33866
+ ...platform$1,
33644
33867
  };
33645
33868
 
33646
33869
  function toURLEncodedForm(data, options) {
33647
- return toFormData$1(data, new platform.classes.URLSearchParams(), Object.assign({
33648
- visitor: function(value, key, path, helpers) {
33870
+ return toFormData$1(data, new platform.classes.URLSearchParams(), {
33871
+ visitor: function (value, key, path, helpers) {
33649
33872
  if (platform.isNode && utils$1.isBuffer(value)) {
33650
33873
  this.append(key, value.toString('base64'));
33651
33874
  return false;
33652
33875
  }
33653
33876
 
33654
33877
  return helpers.defaultVisitor.apply(this, arguments);
33655
- }
33656
- }, options));
33878
+ },
33879
+ ...options,
33880
+ });
33657
33881
  }
33658
33882
 
33659
33883
  /**
@@ -33668,7 +33892,7 @@
33668
33892
  // foo.x.y.z
33669
33893
  // foo-x-y-z
33670
33894
  // foo x y z
33671
- return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map(match => {
33895
+ return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map((match) => {
33672
33896
  return match[0] === '[]' ? '' : match[1] || match[0];
33673
33897
  });
33674
33898
  }
@@ -33703,6 +33927,9 @@
33703
33927
  function formDataToJSON(formData) {
33704
33928
  function buildPath(path, value, target, index) {
33705
33929
  let name = path[index++];
33930
+
33931
+ if (name === '__proto__') return true;
33932
+
33706
33933
  const isNumericKey = Number.isFinite(+name);
33707
33934
  const isLast = index >= path.length;
33708
33935
  name = !name && utils$1.isArray(target) ? target.length : name;
@@ -33769,94 +33996,107 @@
33769
33996
  }
33770
33997
 
33771
33998
  const defaults = {
33772
-
33773
33999
  transitional: transitionalDefaults,
33774
34000
 
33775
- adapter: ['xhr', 'http'],
34001
+ adapter: ['xhr', 'http', 'fetch'],
33776
34002
 
33777
- transformRequest: [function transformRequest(data, headers) {
33778
- const contentType = headers.getContentType() || '';
33779
- const hasJSONContentType = contentType.indexOf('application/json') > -1;
33780
- const isObjectPayload = utils$1.isObject(data);
34003
+ transformRequest: [
34004
+ function transformRequest(data, headers) {
34005
+ const contentType = headers.getContentType() || '';
34006
+ const hasJSONContentType = contentType.indexOf('application/json') > -1;
34007
+ const isObjectPayload = utils$1.isObject(data);
33781
34008
 
33782
- if (isObjectPayload && utils$1.isHTMLForm(data)) {
33783
- data = new FormData(data);
33784
- }
34009
+ if (isObjectPayload && utils$1.isHTMLForm(data)) {
34010
+ data = new FormData(data);
34011
+ }
34012
+
34013
+ const isFormData = utils$1.isFormData(data);
33785
34014
 
33786
- const isFormData = utils$1.isFormData(data);
34015
+ if (isFormData) {
34016
+ return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
34017
+ }
33787
34018
 
33788
- if (isFormData) {
33789
- if (!hasJSONContentType) {
34019
+ if (
34020
+ utils$1.isArrayBuffer(data) ||
34021
+ utils$1.isBuffer(data) ||
34022
+ utils$1.isStream(data) ||
34023
+ utils$1.isFile(data) ||
34024
+ utils$1.isBlob(data) ||
34025
+ utils$1.isReadableStream(data)
34026
+ ) {
33790
34027
  return data;
33791
34028
  }
33792
- return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
33793
- }
34029
+ if (utils$1.isArrayBufferView(data)) {
34030
+ return data.buffer;
34031
+ }
34032
+ if (utils$1.isURLSearchParams(data)) {
34033
+ headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
34034
+ return data.toString();
34035
+ }
33794
34036
 
33795
- if (utils$1.isArrayBuffer(data) ||
33796
- utils$1.isBuffer(data) ||
33797
- utils$1.isStream(data) ||
33798
- utils$1.isFile(data) ||
33799
- utils$1.isBlob(data)
33800
- ) {
33801
- return data;
33802
- }
33803
- if (utils$1.isArrayBufferView(data)) {
33804
- return data.buffer;
33805
- }
33806
- if (utils$1.isURLSearchParams(data)) {
33807
- headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
33808
- return data.toString();
33809
- }
34037
+ let isFileList;
33810
34038
 
33811
- let isFileList;
34039
+ if (isObjectPayload) {
34040
+ if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
34041
+ return toURLEncodedForm(data, this.formSerializer).toString();
34042
+ }
33812
34043
 
33813
- if (isObjectPayload) {
33814
- if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
33815
- return toURLEncodedForm(data, this.formSerializer).toString();
33816
- }
34044
+ if (
34045
+ (isFileList = utils$1.isFileList(data)) ||
34046
+ contentType.indexOf('multipart/form-data') > -1
34047
+ ) {
34048
+ const _FormData = this.env && this.env.FormData;
33817
34049
 
33818
- if ((isFileList = utils$1.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
33819
- const _FormData = this.env && this.env.FormData;
34050
+ return toFormData$1(
34051
+ isFileList ? { 'files[]': data } : data,
34052
+ _FormData && new _FormData(),
34053
+ this.formSerializer
34054
+ );
34055
+ }
34056
+ }
33820
34057
 
33821
- return toFormData$1(
33822
- isFileList ? {'files[]': data} : data,
33823
- _FormData && new _FormData(),
33824
- this.formSerializer
33825
- );
34058
+ if (isObjectPayload || hasJSONContentType) {
34059
+ headers.setContentType('application/json', false);
34060
+ return stringifySafely(data);
33826
34061
  }
33827
- }
33828
34062
 
33829
- if (isObjectPayload || hasJSONContentType ) {
33830
- headers.setContentType('application/json', false);
33831
- return stringifySafely(data);
33832
- }
34063
+ return data;
34064
+ },
34065
+ ],
33833
34066
 
33834
- return data;
33835
- }],
34067
+ transformResponse: [
34068
+ function transformResponse(data) {
34069
+ const transitional = this.transitional || defaults.transitional;
34070
+ const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
34071
+ const JSONRequested = this.responseType === 'json';
33836
34072
 
33837
- transformResponse: [function transformResponse(data) {
33838
- const transitional = this.transitional || defaults.transitional;
33839
- const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
33840
- const JSONRequested = this.responseType === 'json';
34073
+ if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
34074
+ return data;
34075
+ }
33841
34076
 
33842
- if (data && utils$1.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
33843
- const silentJSONParsing = transitional && transitional.silentJSONParsing;
33844
- const strictJSONParsing = !silentJSONParsing && JSONRequested;
34077
+ if (
34078
+ data &&
34079
+ utils$1.isString(data) &&
34080
+ ((forcedJSONParsing && !this.responseType) || JSONRequested)
34081
+ ) {
34082
+ const silentJSONParsing = transitional && transitional.silentJSONParsing;
34083
+ const strictJSONParsing = !silentJSONParsing && JSONRequested;
33845
34084
 
33846
- try {
33847
- return JSON.parse(data);
33848
- } catch (e) {
33849
- if (strictJSONParsing) {
33850
- if (e.name === 'SyntaxError') {
33851
- throw AxiosError$1.from(e, AxiosError$1.ERR_BAD_RESPONSE, this, null, this.response);
34085
+ try {
34086
+ return JSON.parse(data, this.parseReviver);
34087
+ } catch (e) {
34088
+ if (strictJSONParsing) {
34089
+ if (e.name === 'SyntaxError') {
34090
+ throw AxiosError$1.from(e, AxiosError$1.ERR_BAD_RESPONSE, this, null, this.response);
34091
+ }
34092
+ throw e;
33852
34093
  }
33853
- throw e;
33854
34094
  }
33855
34095
  }
33856
- }
33857
34096
 
33858
- return data;
33859
- }],
34097
+ return data;
34098
+ },
34099
+ ],
33860
34100
 
33861
34101
  /**
33862
34102
  * A timeout in milliseconds to abort a request. If set to 0 (default) a
@@ -33872,7 +34112,7 @@
33872
34112
 
33873
34113
  env: {
33874
34114
  FormData: platform.classes.FormData,
33875
- Blob: platform.classes.Blob
34115
+ Blob: platform.classes.Blob,
33876
34116
  },
33877
34117
 
33878
34118
  validateStatus: function validateStatus(status) {
@@ -33881,10 +34121,10 @@
33881
34121
 
33882
34122
  headers: {
33883
34123
  common: {
33884
- 'Accept': 'application/json, text/plain, */*',
33885
- 'Content-Type': undefined
33886
- }
33887
- }
34124
+ Accept: 'application/json, text/plain, */*',
34125
+ 'Content-Type': undefined,
34126
+ },
34127
+ },
33888
34128
  };
33889
34129
 
33890
34130
  utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
@@ -33894,10 +34134,23 @@
33894
34134
  // RawAxiosHeaders whose duplicates are ignored by node
33895
34135
  // c.f. https://nodejs.org/api/http.html#http_message_headers
33896
34136
  const ignoreDuplicateOf = utils$1.toObjectSet([
33897
- 'age', 'authorization', 'content-length', 'content-type', 'etag',
33898
- 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
33899
- 'last-modified', 'location', 'max-forwards', 'proxy-authorization',
33900
- 'referer', 'retry-after', 'user-agent'
34137
+ 'age',
34138
+ 'authorization',
34139
+ 'content-length',
34140
+ 'content-type',
34141
+ 'etag',
34142
+ 'expires',
34143
+ 'from',
34144
+ 'host',
34145
+ 'if-modified-since',
34146
+ 'if-unmodified-since',
34147
+ 'last-modified',
34148
+ 'location',
34149
+ 'max-forwards',
34150
+ 'proxy-authorization',
34151
+ 'referer',
34152
+ 'retry-after',
34153
+ 'user-agent',
33901
34154
  ]);
33902
34155
 
33903
34156
  /**
@@ -33914,47 +34167,81 @@
33914
34167
  *
33915
34168
  * @returns {Object} Headers parsed into an object
33916
34169
  */
33917
- var parseHeaders = rawHeaders => {
34170
+ var parseHeaders = (rawHeaders) => {
33918
34171
  const parsed = {};
33919
34172
  let key;
33920
34173
  let val;
33921
34174
  let i;
33922
34175
 
33923
- rawHeaders && rawHeaders.split('\n').forEach(function parser(line) {
33924
- i = line.indexOf(':');
33925
- key = line.substring(0, i).trim().toLowerCase();
33926
- val = line.substring(i + 1).trim();
34176
+ rawHeaders &&
34177
+ rawHeaders.split('\n').forEach(function parser(line) {
34178
+ i = line.indexOf(':');
34179
+ key = line.substring(0, i).trim().toLowerCase();
34180
+ val = line.substring(i + 1).trim();
33927
34181
 
33928
- if (!key || (parsed[key] && ignoreDuplicateOf[key])) {
33929
- return;
33930
- }
34182
+ if (!key || (parsed[key] && ignoreDuplicateOf[key])) {
34183
+ return;
34184
+ }
33931
34185
 
33932
- if (key === 'set-cookie') {
33933
- if (parsed[key]) {
33934
- parsed[key].push(val);
34186
+ if (key === 'set-cookie') {
34187
+ if (parsed[key]) {
34188
+ parsed[key].push(val);
34189
+ } else {
34190
+ parsed[key] = [val];
34191
+ }
33935
34192
  } else {
33936
- parsed[key] = [val];
34193
+ parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
33937
34194
  }
33938
- } else {
33939
- parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
33940
- }
33941
- });
34195
+ });
33942
34196
 
33943
34197
  return parsed;
33944
34198
  };
33945
34199
 
33946
34200
  const $internals = Symbol('internals');
33947
34201
 
34202
+ const isValidHeaderValue = (value) => !/[\r\n]/.test(value);
34203
+
34204
+ function assertValidHeaderValue(value, header) {
34205
+ if (value === false || value == null) {
34206
+ return;
34207
+ }
34208
+
34209
+ if (utils$1.isArray(value)) {
34210
+ value.forEach((v) => assertValidHeaderValue(v, header));
34211
+ return;
34212
+ }
34213
+
34214
+ if (!isValidHeaderValue(String(value))) {
34215
+ throw new Error(`Invalid character in header content ["${header}"]`);
34216
+ }
34217
+ }
34218
+
33948
34219
  function normalizeHeader(header) {
33949
34220
  return header && String(header).trim().toLowerCase();
33950
34221
  }
33951
34222
 
34223
+ function stripTrailingCRLF(str) {
34224
+ let end = str.length;
34225
+
34226
+ while (end > 0) {
34227
+ const charCode = str.charCodeAt(end - 1);
34228
+
34229
+ if (charCode !== 10 && charCode !== 13) {
34230
+ break;
34231
+ }
34232
+
34233
+ end -= 1;
34234
+ }
34235
+
34236
+ return end === str.length ? str : str.slice(0, end);
34237
+ }
34238
+
33952
34239
  function normalizeValue(value) {
33953
34240
  if (value === false || value == null) {
33954
34241
  return value;
33955
34242
  }
33956
34243
 
33957
- return utils$1.isArray(value) ? value.map(normalizeValue) : String(value);
34244
+ return utils$1.isArray(value) ? value.map(normalizeValue) : stripTrailingCRLF(String(value));
33958
34245
  }
33959
34246
 
33960
34247
  function parseTokens(str) {
@@ -33992,8 +34279,10 @@
33992
34279
  }
33993
34280
 
33994
34281
  function formatHeader(header) {
33995
- return header.trim()
33996
- .toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => {
34282
+ return header
34283
+ .trim()
34284
+ .toLowerCase()
34285
+ .replace(/([a-z\d])(\w*)/g, (w, char, str) => {
33997
34286
  return char.toUpperCase() + str;
33998
34287
  });
33999
34288
  }
@@ -34001,12 +34290,12 @@
34001
34290
  function buildAccessors(obj, header) {
34002
34291
  const accessorName = utils$1.toCamelCase(' ' + header);
34003
34292
 
34004
- ['get', 'set', 'has'].forEach(methodName => {
34293
+ ['get', 'set', 'has'].forEach((methodName) => {
34005
34294
  Object.defineProperty(obj, methodName + accessorName, {
34006
- value: function(arg1, arg2, arg3) {
34295
+ value: function (arg1, arg2, arg3) {
34007
34296
  return this[methodName].call(this, header, arg1, arg2, arg3);
34008
34297
  },
34009
- configurable: true
34298
+ configurable: true,
34010
34299
  });
34011
34300
  });
34012
34301
  }
@@ -34028,7 +34317,13 @@
34028
34317
 
34029
34318
  const key = utils$1.findKey(self, lHeader);
34030
34319
 
34031
- if(!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) {
34320
+ if (
34321
+ !key ||
34322
+ self[key] === undefined ||
34323
+ _rewrite === true ||
34324
+ (_rewrite === undefined && self[key] !== false)
34325
+ ) {
34326
+ assertValidHeaderValue(_value, _header);
34032
34327
  self[key || _header] = normalizeValue(_value);
34033
34328
  }
34034
34329
  }
@@ -34038,8 +34333,25 @@
34038
34333
 
34039
34334
  if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
34040
34335
  setHeaders(header, valueOrRewrite);
34041
- } else if(utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
34336
+ } else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
34042
34337
  setHeaders(parseHeaders(header), valueOrRewrite);
34338
+ } else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
34339
+ let obj = {},
34340
+ dest,
34341
+ key;
34342
+ for (const entry of header) {
34343
+ if (!utils$1.isArray(entry)) {
34344
+ throw TypeError('Object iterator must return a key-value pair');
34345
+ }
34346
+
34347
+ obj[(key = entry[0])] = (dest = obj[key])
34348
+ ? utils$1.isArray(dest)
34349
+ ? [...dest, entry[1]]
34350
+ : [dest, entry[1]]
34351
+ : entry[1];
34352
+ }
34353
+
34354
+ setHeaders(obj, valueOrRewrite);
34043
34355
  } else {
34044
34356
  header != null && setHeader(valueOrRewrite, header, rewrite);
34045
34357
  }
@@ -34083,7 +34395,11 @@
34083
34395
  if (header) {
34084
34396
  const key = utils$1.findKey(this, header);
34085
34397
 
34086
- return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
34398
+ return !!(
34399
+ key &&
34400
+ this[key] !== undefined &&
34401
+ (!matcher || matchHeaderValue(this, this[key], key, matcher))
34402
+ );
34087
34403
  }
34088
34404
 
34089
34405
  return false;
@@ -34123,7 +34439,7 @@
34123
34439
 
34124
34440
  while (i--) {
34125
34441
  const key = keys[i];
34126
- if(!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
34442
+ if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
34127
34443
  delete this[key];
34128
34444
  deleted = true;
34129
34445
  }
@@ -34167,7 +34483,9 @@
34167
34483
  const obj = Object.create(null);
34168
34484
 
34169
34485
  utils$1.forEach(this, (value, header) => {
34170
- value != null && value !== false && (obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value);
34486
+ value != null &&
34487
+ value !== false &&
34488
+ (obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value);
34171
34489
  });
34172
34490
 
34173
34491
  return obj;
@@ -34178,7 +34496,13 @@
34178
34496
  }
34179
34497
 
34180
34498
  toString() {
34181
- return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\n');
34499
+ return Object.entries(this.toJSON())
34500
+ .map(([header, value]) => header + ': ' + value)
34501
+ .join('\n');
34502
+ }
34503
+
34504
+ getSetCookie() {
34505
+ return this.get('set-cookie') || [];
34182
34506
  }
34183
34507
 
34184
34508
  get [Symbol.toStringTag]() {
@@ -34198,9 +34522,12 @@
34198
34522
  }
34199
34523
 
34200
34524
  static accessor(header) {
34201
- const internals = this[$internals] = (this[$internals] = {
34202
- accessors: {}
34203
- });
34525
+ const internals =
34526
+ (this[$internals] =
34527
+ this[$internals] =
34528
+ {
34529
+ accessors: {},
34530
+ });
34204
34531
 
34205
34532
  const accessors = internals.accessors;
34206
34533
  const prototype = this.prototype;
@@ -34220,17 +34547,24 @@
34220
34547
  }
34221
34548
  };
34222
34549
 
34223
- AxiosHeaders$1.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);
34550
+ AxiosHeaders$1.accessor([
34551
+ 'Content-Type',
34552
+ 'Content-Length',
34553
+ 'Accept',
34554
+ 'Accept-Encoding',
34555
+ 'User-Agent',
34556
+ 'Authorization',
34557
+ ]);
34224
34558
 
34225
34559
  // reserved names hotfix
34226
- utils$1.reduceDescriptors(AxiosHeaders$1.prototype, ({value}, key) => {
34560
+ utils$1.reduceDescriptors(AxiosHeaders$1.prototype, ({ value }, key) => {
34227
34561
  let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
34228
34562
  return {
34229
34563
  get: () => value,
34230
34564
  set(headerValue) {
34231
34565
  this[mapped] = headerValue;
34232
- }
34233
- }
34566
+ },
34567
+ };
34234
34568
  });
34235
34569
 
34236
34570
  utils$1.freezeMethods(AxiosHeaders$1);
@@ -34262,24 +34596,22 @@
34262
34596
  return !!(value && value.__CANCEL__);
34263
34597
  }
34264
34598
 
34265
- /**
34266
- * A `CanceledError` is an object that is thrown when an operation is canceled.
34267
- *
34268
- * @param {string=} message The message.
34269
- * @param {Object=} config The config.
34270
- * @param {Object=} request The request.
34271
- *
34272
- * @returns {CanceledError} The created error.
34273
- */
34274
- function CanceledError$1(message, config, request) {
34275
- // eslint-disable-next-line no-eq-null,eqeqeq
34276
- AxiosError$1.call(this, message == null ? 'canceled' : message, AxiosError$1.ERR_CANCELED, config, request);
34277
- this.name = 'CanceledError';
34278
- }
34279
-
34280
- utils$1.inherits(CanceledError$1, AxiosError$1, {
34281
- __CANCEL__: true
34282
- });
34599
+ let CanceledError$1 = class CanceledError extends AxiosError$1 {
34600
+ /**
34601
+ * A `CanceledError` is an object that is thrown when an operation is canceled.
34602
+ *
34603
+ * @param {string=} message The message.
34604
+ * @param {Object=} config The config.
34605
+ * @param {Object=} request The request.
34606
+ *
34607
+ * @returns {CanceledError} The created error.
34608
+ */
34609
+ constructor(message, config, request) {
34610
+ super(message == null ? 'canceled' : message, AxiosError$1.ERR_CANCELED, config, request);
34611
+ this.name = 'CanceledError';
34612
+ this.__CANCEL__ = true;
34613
+ }
34614
+ };
34283
34615
 
34284
34616
  /**
34285
34617
  * Resolve or reject a Promise based on response status.
@@ -34295,166 +34627,23 @@
34295
34627
  if (!response.status || !validateStatus || validateStatus(response.status)) {
34296
34628
  resolve(response);
34297
34629
  } else {
34298
- reject(new AxiosError$1(
34299
- 'Request failed with status code ' + response.status,
34300
- [AxiosError$1.ERR_BAD_REQUEST, AxiosError$1.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
34301
- response.config,
34302
- response.request,
34303
- response
34304
- ));
34305
- }
34306
- }
34307
-
34308
- var cookies = platform.hasStandardBrowserEnv ?
34309
-
34310
- // Standard browser envs support document.cookie
34311
- {
34312
- write(name, value, expires, path, domain, secure) {
34313
- const cookie = [name + '=' + encodeURIComponent(value)];
34314
-
34315
- utils$1.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString());
34316
-
34317
- utils$1.isString(path) && cookie.push('path=' + path);
34318
-
34319
- utils$1.isString(domain) && cookie.push('domain=' + domain);
34320
-
34321
- secure === true && cookie.push('secure');
34322
-
34323
- document.cookie = cookie.join('; ');
34324
- },
34325
-
34326
- read(name) {
34327
- const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
34328
- return (match ? decodeURIComponent(match[3]) : null);
34329
- },
34330
-
34331
- remove(name) {
34332
- this.write(name, '', Date.now() - 86400000);
34333
- }
34334
- }
34335
-
34336
- :
34337
-
34338
- // Non-standard browser env (web workers, react-native) lack needed support.
34339
- {
34340
- write() {},
34341
- read() {
34342
- return null;
34343
- },
34344
- remove() {}
34345
- };
34346
-
34347
- /**
34348
- * Determines whether the specified URL is absolute
34349
- *
34350
- * @param {string} url The URL to test
34351
- *
34352
- * @returns {boolean} True if the specified URL is absolute, otherwise false
34353
- */
34354
- function isAbsoluteURL(url) {
34355
- // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
34356
- // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
34357
- // by any combination of letters, digits, plus, period, or hyphen.
34358
- return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
34359
- }
34360
-
34361
- /**
34362
- * Creates a new URL by combining the specified URLs
34363
- *
34364
- * @param {string} baseURL The base URL
34365
- * @param {string} relativeURL The relative URL
34366
- *
34367
- * @returns {string} The combined URL
34368
- */
34369
- function combineURLs(baseURL, relativeURL) {
34370
- return relativeURL
34371
- ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
34372
- : baseURL;
34373
- }
34374
-
34375
- /**
34376
- * Creates a new URL by combining the baseURL with the requestedURL,
34377
- * only when the requestedURL is not already an absolute URL.
34378
- * If the requestURL is absolute, this function returns the requestedURL untouched.
34379
- *
34380
- * @param {string} baseURL The base URL
34381
- * @param {string} requestedURL Absolute or relative URL to combine
34382
- *
34383
- * @returns {string} The combined full path
34384
- */
34385
- function buildFullPath(baseURL, requestedURL) {
34386
- if (baseURL && !isAbsoluteURL(requestedURL)) {
34387
- return combineURLs(baseURL, requestedURL);
34630
+ reject(
34631
+ new AxiosError$1(
34632
+ 'Request failed with status code ' + response.status,
34633
+ [AxiosError$1.ERR_BAD_REQUEST, AxiosError$1.ERR_BAD_RESPONSE][
34634
+ Math.floor(response.status / 100) - 4
34635
+ ],
34636
+ response.config,
34637
+ response.request,
34638
+ response
34639
+ )
34640
+ );
34388
34641
  }
34389
- return requestedURL;
34390
34642
  }
34391
34643
 
34392
- var isURLSameOrigin = platform.hasStandardBrowserEnv ?
34393
-
34394
- // Standard browser envs have full support of the APIs needed to test
34395
- // whether the request URL is of the same origin as current location.
34396
- (function standardBrowserEnv() {
34397
- const msie = /(msie|trident)/i.test(navigator.userAgent);
34398
- const urlParsingNode = document.createElement('a');
34399
- let originURL;
34400
-
34401
- /**
34402
- * Parse a URL to discover its components
34403
- *
34404
- * @param {String} url The URL to be parsed
34405
- * @returns {Object}
34406
- */
34407
- function resolveURL(url) {
34408
- let href = url;
34409
-
34410
- if (msie) {
34411
- // IE needs attribute set twice to normalize properties
34412
- urlParsingNode.setAttribute('href', href);
34413
- href = urlParsingNode.href;
34414
- }
34415
-
34416
- urlParsingNode.setAttribute('href', href);
34417
-
34418
- // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
34419
- return {
34420
- href: urlParsingNode.href,
34421
- protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
34422
- host: urlParsingNode.host,
34423
- search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
34424
- hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
34425
- hostname: urlParsingNode.hostname,
34426
- port: urlParsingNode.port,
34427
- pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
34428
- urlParsingNode.pathname :
34429
- '/' + urlParsingNode.pathname
34430
- };
34431
- }
34432
-
34433
- originURL = resolveURL(window.location.href);
34434
-
34435
- /**
34436
- * Determine if a URL shares the same origin as the current location
34437
- *
34438
- * @param {String} requestURL The URL to test
34439
- * @returns {boolean} True if URL shares the same origin, otherwise false
34440
- */
34441
- return function isURLSameOrigin(requestURL) {
34442
- const parsed = (utils$1.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
34443
- return (parsed.protocol === originURL.protocol &&
34444
- parsed.host === originURL.host);
34445
- };
34446
- })() :
34447
-
34448
- // Non standard browser envs (web workers, react-native) lack needed support.
34449
- (function nonStandardBrowserEnv() {
34450
- return function isURLSameOrigin() {
34451
- return true;
34452
- };
34453
- })();
34454
-
34455
34644
  function parseProtocol(url) {
34456
34645
  const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
34457
- return match && match[1] || '';
34646
+ return (match && match[1]) || '';
34458
34647
  }
34459
34648
 
34460
34649
  /**
@@ -34505,15 +34694,58 @@
34505
34694
 
34506
34695
  const passed = startedAt && now - startedAt;
34507
34696
 
34508
- return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
34697
+ return passed ? Math.round((bytesCount * 1000) / passed) : undefined;
34509
34698
  };
34510
34699
  }
34511
34700
 
34512
- function progressEventReducer(listener, isDownloadStream) {
34701
+ /**
34702
+ * Throttle decorator
34703
+ * @param {Function} fn
34704
+ * @param {Number} freq
34705
+ * @return {Function}
34706
+ */
34707
+ function throttle(fn, freq) {
34708
+ let timestamp = 0;
34709
+ let threshold = 1000 / freq;
34710
+ let lastArgs;
34711
+ let timer;
34712
+
34713
+ const invoke = (args, now = Date.now()) => {
34714
+ timestamp = now;
34715
+ lastArgs = null;
34716
+ if (timer) {
34717
+ clearTimeout(timer);
34718
+ timer = null;
34719
+ }
34720
+ fn(...args);
34721
+ };
34722
+
34723
+ const throttled = (...args) => {
34724
+ const now = Date.now();
34725
+ const passed = now - timestamp;
34726
+ if (passed >= threshold) {
34727
+ invoke(args, now);
34728
+ } else {
34729
+ lastArgs = args;
34730
+ if (!timer) {
34731
+ timer = setTimeout(() => {
34732
+ timer = null;
34733
+ invoke(lastArgs);
34734
+ }, threshold - passed);
34735
+ }
34736
+ }
34737
+ };
34738
+
34739
+ const flush = () => lastArgs && invoke(lastArgs);
34740
+
34741
+ return [throttled, flush];
34742
+ }
34743
+
34744
+ const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
34513
34745
  let bytesNotified = 0;
34514
34746
  const _speedometer = speedometer(50, 250);
34515
34747
 
34516
- return e => {
34748
+ return throttle((e) => {
34517
34749
  const loaded = e.loaded;
34518
34750
  const total = e.lengthComputable ? e.total : undefined;
34519
34751
  const progressBytes = loaded - bytesNotified;
@@ -34525,306 +34757,1113 @@
34525
34757
  const data = {
34526
34758
  loaded,
34527
34759
  total,
34528
- progress: total ? (loaded / total) : undefined,
34760
+ progress: total ? loaded / total : undefined,
34529
34761
  bytes: progressBytes,
34530
34762
  rate: rate ? rate : undefined,
34531
34763
  estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
34532
- event: e
34764
+ event: e,
34765
+ lengthComputable: total != null,
34766
+ [isDownloadStream ? 'download' : 'upload']: true,
34533
34767
  };
34534
34768
 
34535
- data[isDownloadStream ? 'download' : 'upload'] = true;
34536
-
34537
34769
  listener(data);
34770
+ }, freq);
34771
+ };
34772
+
34773
+ const progressEventDecorator = (total, throttled) => {
34774
+ const lengthComputable = total != null;
34775
+
34776
+ return [
34777
+ (loaded) =>
34778
+ throttled[0]({
34779
+ lengthComputable,
34780
+ total,
34781
+ loaded,
34782
+ }),
34783
+ throttled[1],
34784
+ ];
34785
+ };
34786
+
34787
+ const asyncDecorator =
34788
+ (fn) =>
34789
+ (...args) =>
34790
+ utils$1.asap(() => fn(...args));
34791
+
34792
+ var isURLSameOrigin = platform.hasStandardBrowserEnv
34793
+ ? ((origin, isMSIE) => (url) => {
34794
+ url = new URL(url, platform.origin);
34795
+
34796
+ return (
34797
+ origin.protocol === url.protocol &&
34798
+ origin.host === url.host &&
34799
+ (isMSIE || origin.port === url.port)
34800
+ );
34801
+ })(
34802
+ new URL(platform.origin),
34803
+ platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)
34804
+ )
34805
+ : () => true;
34806
+
34807
+ var cookies = platform.hasStandardBrowserEnv
34808
+ ? // Standard browser envs support document.cookie
34809
+ {
34810
+ write(name, value, expires, path, domain, secure, sameSite) {
34811
+ if (typeof document === 'undefined') return;
34812
+
34813
+ const cookie = [`${name}=${encodeURIComponent(value)}`];
34814
+
34815
+ if (utils$1.isNumber(expires)) {
34816
+ cookie.push(`expires=${new Date(expires).toUTCString()}`);
34817
+ }
34818
+ if (utils$1.isString(path)) {
34819
+ cookie.push(`path=${path}`);
34820
+ }
34821
+ if (utils$1.isString(domain)) {
34822
+ cookie.push(`domain=${domain}`);
34823
+ }
34824
+ if (secure === true) {
34825
+ cookie.push('secure');
34826
+ }
34827
+ if (utils$1.isString(sameSite)) {
34828
+ cookie.push(`SameSite=${sameSite}`);
34829
+ }
34830
+
34831
+ document.cookie = cookie.join('; ');
34832
+ },
34833
+
34834
+ read(name) {
34835
+ if (typeof document === 'undefined') return null;
34836
+ const match = document.cookie.match(new RegExp('(?:^|; )' + name + '=([^;]*)'));
34837
+ return match ? decodeURIComponent(match[1]) : null;
34838
+ },
34839
+
34840
+ remove(name) {
34841
+ this.write(name, '', Date.now() - 86400000, '/');
34842
+ },
34843
+ }
34844
+ : // Non-standard browser env (web workers, react-native) lack needed support.
34845
+ {
34846
+ write() {},
34847
+ read() {
34848
+ return null;
34849
+ },
34850
+ remove() {},
34851
+ };
34852
+
34853
+ /**
34854
+ * Determines whether the specified URL is absolute
34855
+ *
34856
+ * @param {string} url The URL to test
34857
+ *
34858
+ * @returns {boolean} True if the specified URL is absolute, otherwise false
34859
+ */
34860
+ function isAbsoluteURL(url) {
34861
+ // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
34862
+ // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
34863
+ // by any combination of letters, digits, plus, period, or hyphen.
34864
+ if (typeof url !== 'string') {
34865
+ return false;
34866
+ }
34867
+
34868
+ return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
34869
+ }
34870
+
34871
+ /**
34872
+ * Creates a new URL by combining the specified URLs
34873
+ *
34874
+ * @param {string} baseURL The base URL
34875
+ * @param {string} relativeURL The relative URL
34876
+ *
34877
+ * @returns {string} The combined URL
34878
+ */
34879
+ function combineURLs(baseURL, relativeURL) {
34880
+ return relativeURL
34881
+ ? baseURL.replace(/\/?\/$/, '') + '/' + relativeURL.replace(/^\/+/, '')
34882
+ : baseURL;
34883
+ }
34884
+
34885
+ /**
34886
+ * Creates a new URL by combining the baseURL with the requestedURL,
34887
+ * only when the requestedURL is not already an absolute URL.
34888
+ * If the requestURL is absolute, this function returns the requestedURL untouched.
34889
+ *
34890
+ * @param {string} baseURL The base URL
34891
+ * @param {string} requestedURL Absolute or relative URL to combine
34892
+ *
34893
+ * @returns {string} The combined full path
34894
+ */
34895
+ function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
34896
+ let isRelativeUrl = !isAbsoluteURL(requestedURL);
34897
+ if (baseURL && (isRelativeUrl || allowAbsoluteUrls == false)) {
34898
+ return combineURLs(baseURL, requestedURL);
34899
+ }
34900
+ return requestedURL;
34901
+ }
34902
+
34903
+ const headersToObject = (thing) => (thing instanceof AxiosHeaders$1 ? { ...thing } : thing);
34904
+
34905
+ /**
34906
+ * Config-specific merge-function which creates a new config-object
34907
+ * by merging two configuration objects together.
34908
+ *
34909
+ * @param {Object} config1
34910
+ * @param {Object} config2
34911
+ *
34912
+ * @returns {Object} New object resulting from merging config2 to config1
34913
+ */
34914
+ function mergeConfig$1(config1, config2) {
34915
+ // eslint-disable-next-line no-param-reassign
34916
+ config2 = config2 || {};
34917
+ const config = {};
34918
+
34919
+ function getMergedValue(target, source, prop, caseless) {
34920
+ if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
34921
+ return utils$1.merge.call({ caseless }, target, source);
34922
+ } else if (utils$1.isPlainObject(source)) {
34923
+ return utils$1.merge({}, source);
34924
+ } else if (utils$1.isArray(source)) {
34925
+ return source.slice();
34926
+ }
34927
+ return source;
34928
+ }
34929
+
34930
+ function mergeDeepProperties(a, b, prop, caseless) {
34931
+ if (!utils$1.isUndefined(b)) {
34932
+ return getMergedValue(a, b, prop, caseless);
34933
+ } else if (!utils$1.isUndefined(a)) {
34934
+ return getMergedValue(undefined, a, prop, caseless);
34935
+ }
34936
+ }
34937
+
34938
+ // eslint-disable-next-line consistent-return
34939
+ function valueFromConfig2(a, b) {
34940
+ if (!utils$1.isUndefined(b)) {
34941
+ return getMergedValue(undefined, b);
34942
+ }
34943
+ }
34944
+
34945
+ // eslint-disable-next-line consistent-return
34946
+ function defaultToConfig2(a, b) {
34947
+ if (!utils$1.isUndefined(b)) {
34948
+ return getMergedValue(undefined, b);
34949
+ } else if (!utils$1.isUndefined(a)) {
34950
+ return getMergedValue(undefined, a);
34951
+ }
34952
+ }
34953
+
34954
+ // eslint-disable-next-line consistent-return
34955
+ function mergeDirectKeys(a, b, prop) {
34956
+ if (prop in config2) {
34957
+ return getMergedValue(a, b);
34958
+ } else if (prop in config1) {
34959
+ return getMergedValue(undefined, a);
34960
+ }
34961
+ }
34962
+
34963
+ const mergeMap = {
34964
+ url: valueFromConfig2,
34965
+ method: valueFromConfig2,
34966
+ data: valueFromConfig2,
34967
+ baseURL: defaultToConfig2,
34968
+ transformRequest: defaultToConfig2,
34969
+ transformResponse: defaultToConfig2,
34970
+ paramsSerializer: defaultToConfig2,
34971
+ timeout: defaultToConfig2,
34972
+ timeoutMessage: defaultToConfig2,
34973
+ withCredentials: defaultToConfig2,
34974
+ withXSRFToken: defaultToConfig2,
34975
+ adapter: defaultToConfig2,
34976
+ responseType: defaultToConfig2,
34977
+ xsrfCookieName: defaultToConfig2,
34978
+ xsrfHeaderName: defaultToConfig2,
34979
+ onUploadProgress: defaultToConfig2,
34980
+ onDownloadProgress: defaultToConfig2,
34981
+ decompress: defaultToConfig2,
34982
+ maxContentLength: defaultToConfig2,
34983
+ maxBodyLength: defaultToConfig2,
34984
+ beforeRedirect: defaultToConfig2,
34985
+ transport: defaultToConfig2,
34986
+ httpAgent: defaultToConfig2,
34987
+ httpsAgent: defaultToConfig2,
34988
+ cancelToken: defaultToConfig2,
34989
+ socketPath: defaultToConfig2,
34990
+ responseEncoding: defaultToConfig2,
34991
+ validateStatus: mergeDirectKeys,
34992
+ headers: (a, b, prop) =>
34993
+ mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true),
34538
34994
  };
34995
+
34996
+ utils$1.forEach(Object.keys({ ...config1, ...config2 }), function computeConfigValue(prop) {
34997
+ if (prop === '__proto__' || prop === 'constructor' || prop === 'prototype') return;
34998
+ const merge = utils$1.hasOwnProp(mergeMap, prop) ? mergeMap[prop] : mergeDeepProperties;
34999
+ const configValue = merge(config1[prop], config2[prop], prop);
35000
+ (utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
35001
+ });
35002
+
35003
+ return config;
34539
35004
  }
34540
35005
 
34541
- const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
35006
+ var resolveConfig = (config) => {
35007
+ const newConfig = mergeConfig$1({}, config);
34542
35008
 
34543
- var xhrAdapter = isXHRAdapterSupported && function (config) {
34544
- return new Promise(function dispatchXhrRequest(resolve, reject) {
34545
- let requestData = config.data;
34546
- const requestHeaders = AxiosHeaders$1.from(config.headers).normalize();
34547
- let {responseType, withXSRFToken} = config;
34548
- let onCanceled;
34549
- function done() {
34550
- if (config.cancelToken) {
34551
- config.cancelToken.unsubscribe(onCanceled);
34552
- }
35009
+ let { data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth } = newConfig;
34553
35010
 
34554
- if (config.signal) {
34555
- config.signal.removeEventListener('abort', onCanceled);
34556
- }
35011
+ newConfig.headers = headers = AxiosHeaders$1.from(headers);
35012
+
35013
+ newConfig.url = buildURL(
35014
+ buildFullPath(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls),
35015
+ config.params,
35016
+ config.paramsSerializer
35017
+ );
35018
+
35019
+ // HTTP basic authentication
35020
+ if (auth) {
35021
+ headers.set(
35022
+ 'Authorization',
35023
+ 'Basic ' +
35024
+ btoa(
35025
+ (auth.username || '') +
35026
+ ':' +
35027
+ (auth.password ? unescape(encodeURIComponent(auth.password)) : '')
35028
+ )
35029
+ );
35030
+ }
35031
+
35032
+ if (utils$1.isFormData(data)) {
35033
+ if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
35034
+ headers.setContentType(undefined); // browser handles it
35035
+ } else if (utils$1.isFunction(data.getHeaders)) {
35036
+ // Node.js FormData (like form-data package)
35037
+ const formHeaders = data.getHeaders();
35038
+ // Only set safe headers to avoid overwriting security headers
35039
+ const allowedHeaders = ['content-type', 'content-length'];
35040
+ Object.entries(formHeaders).forEach(([key, val]) => {
35041
+ if (allowedHeaders.includes(key.toLowerCase())) {
35042
+ headers.set(key, val);
35043
+ }
35044
+ });
34557
35045
  }
35046
+ }
35047
+
35048
+ // Add xsrf header
35049
+ // This is only done if running in a standard browser environment.
35050
+ // Specifically not if we're in a web worker, or react-native.
34558
35051
 
34559
- let contentType;
35052
+ if (platform.hasStandardBrowserEnv) {
35053
+ withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
34560
35054
 
34561
- if (utils$1.isFormData(requestData)) {
34562
- if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
34563
- requestHeaders.setContentType(false); // Let the browser set it
34564
- } else if ((contentType = requestHeaders.getContentType()) !== false) {
34565
- // fix semicolon duplication issue for ReactNative FormData implementation
34566
- const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : [];
34567
- requestHeaders.setContentType([type || 'multipart/form-data', ...tokens].join('; '));
35055
+ if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(newConfig.url))) {
35056
+ // Add xsrf header
35057
+ const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
35058
+
35059
+ if (xsrfValue) {
35060
+ headers.set(xsrfHeaderName, xsrfValue);
34568
35061
  }
34569
35062
  }
35063
+ }
34570
35064
 
34571
- let request = new XMLHttpRequest();
35065
+ return newConfig;
35066
+ };
34572
35067
 
34573
- // HTTP basic authentication
34574
- if (config.auth) {
34575
- const username = config.auth.username || '';
34576
- const password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';
34577
- requestHeaders.set('Authorization', 'Basic ' + btoa(username + ':' + password));
34578
- }
35068
+ const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
34579
35069
 
34580
- const fullPath = buildFullPath(config.baseURL, config.url);
35070
+ var xhrAdapter = isXHRAdapterSupported &&
35071
+ function (config) {
35072
+ return new Promise(function dispatchXhrRequest(resolve, reject) {
35073
+ const _config = resolveConfig(config);
35074
+ let requestData = _config.data;
35075
+ const requestHeaders = AxiosHeaders$1.from(_config.headers).normalize();
35076
+ let { responseType, onUploadProgress, onDownloadProgress } = _config;
35077
+ let onCanceled;
35078
+ let uploadThrottled, downloadThrottled;
35079
+ let flushUpload, flushDownload;
34581
35080
 
34582
- request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
35081
+ function done() {
35082
+ flushUpload && flushUpload(); // flush events
35083
+ flushDownload && flushDownload(); // flush events
34583
35084
 
34584
- // Set the request timeout in MS
34585
- request.timeout = config.timeout;
35085
+ _config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
34586
35086
 
34587
- function onloadend() {
34588
- if (!request) {
34589
- return;
35087
+ _config.signal && _config.signal.removeEventListener('abort', onCanceled);
34590
35088
  }
34591
- // Prepare the response
34592
- const responseHeaders = AxiosHeaders$1.from(
34593
- 'getAllResponseHeaders' in request && request.getAllResponseHeaders()
34594
- );
34595
- const responseData = !responseType || responseType === 'text' || responseType === 'json' ?
34596
- request.responseText : request.response;
34597
- const response = {
34598
- data: responseData,
34599
- status: request.status,
34600
- statusText: request.statusText,
34601
- headers: responseHeaders,
34602
- config,
34603
- request
34604
- };
34605
35089
 
34606
- settle(function _resolve(value) {
34607
- resolve(value);
34608
- done();
34609
- }, function _reject(err) {
34610
- reject(err);
34611
- done();
34612
- }, response);
35090
+ let request = new XMLHttpRequest();
34613
35091
 
34614
- // Clean up request
34615
- request = null;
34616
- }
35092
+ request.open(_config.method.toUpperCase(), _config.url, true);
34617
35093
 
34618
- if ('onloadend' in request) {
34619
- // Use onloadend if available
34620
- request.onloadend = onloadend;
34621
- } else {
34622
- // Listen for ready state to emulate onloadend
34623
- request.onreadystatechange = function handleLoad() {
34624
- if (!request || request.readyState !== 4) {
35094
+ // Set the request timeout in MS
35095
+ request.timeout = _config.timeout;
35096
+
35097
+ function onloadend() {
35098
+ if (!request) {
34625
35099
  return;
34626
35100
  }
35101
+ // Prepare the response
35102
+ const responseHeaders = AxiosHeaders$1.from(
35103
+ 'getAllResponseHeaders' in request && request.getAllResponseHeaders()
35104
+ );
35105
+ const responseData =
35106
+ !responseType || responseType === 'text' || responseType === 'json'
35107
+ ? request.responseText
35108
+ : request.response;
35109
+ const response = {
35110
+ data: responseData,
35111
+ status: request.status,
35112
+ statusText: request.statusText,
35113
+ headers: responseHeaders,
35114
+ config,
35115
+ request,
35116
+ };
35117
+
35118
+ settle(
35119
+ function _resolve(value) {
35120
+ resolve(value);
35121
+ done();
35122
+ },
35123
+ function _reject(err) {
35124
+ reject(err);
35125
+ done();
35126
+ },
35127
+ response
35128
+ );
35129
+
35130
+ // Clean up request
35131
+ request = null;
35132
+ }
34627
35133
 
34628
- // The request errored out and we didn't get a response, this will be
34629
- // handled by onerror instead
34630
- // With one exception: request that using file: protocol, most browsers
34631
- // will return status as 0 even though it's a successful request
34632
- if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
35134
+ if ('onloadend' in request) {
35135
+ // Use onloadend if available
35136
+ request.onloadend = onloadend;
35137
+ } else {
35138
+ // Listen for ready state to emulate onloadend
35139
+ request.onreadystatechange = function handleLoad() {
35140
+ if (!request || request.readyState !== 4) {
35141
+ return;
35142
+ }
35143
+
35144
+ // The request errored out and we didn't get a response, this will be
35145
+ // handled by onerror instead
35146
+ // With one exception: request that using file: protocol, most browsers
35147
+ // will return status as 0 even though it's a successful request
35148
+ if (
35149
+ request.status === 0 &&
35150
+ !(request.responseURL && request.responseURL.indexOf('file:') === 0)
35151
+ ) {
35152
+ return;
35153
+ }
35154
+ // readystate handler is calling before onerror or ontimeout handlers,
35155
+ // so we should call onloadend on the next 'tick'
35156
+ setTimeout(onloadend);
35157
+ };
35158
+ }
35159
+
35160
+ // Handle browser request cancellation (as opposed to a manual cancellation)
35161
+ request.onabort = function handleAbort() {
35162
+ if (!request) {
34633
35163
  return;
34634
35164
  }
34635
- // readystate handler is calling before onerror or ontimeout handlers,
34636
- // so we should call onloadend on the next 'tick'
34637
- setTimeout(onloadend);
35165
+
35166
+ reject(new AxiosError$1('Request aborted', AxiosError$1.ECONNABORTED, config, request));
35167
+
35168
+ // Clean up request
35169
+ request = null;
35170
+ };
35171
+
35172
+ // Handle low level network errors
35173
+ request.onerror = function handleError(event) {
35174
+ // Browsers deliver a ProgressEvent in XHR onerror
35175
+ // (message may be empty; when present, surface it)
35176
+ // See https://developer.mozilla.org/docs/Web/API/XMLHttpRequest/error_event
35177
+ const msg = event && event.message ? event.message : 'Network Error';
35178
+ const err = new AxiosError$1(msg, AxiosError$1.ERR_NETWORK, config, request);
35179
+ // attach the underlying event for consumers who want details
35180
+ err.event = event || null;
35181
+ reject(err);
35182
+ request = null;
34638
35183
  };
34639
- }
34640
35184
 
34641
- // Handle browser request cancellation (as opposed to a manual cancellation)
34642
- request.onabort = function handleAbort() {
34643
- if (!request) {
35185
+ // Handle timeout
35186
+ request.ontimeout = function handleTimeout() {
35187
+ let timeoutErrorMessage = _config.timeout
35188
+ ? 'timeout of ' + _config.timeout + 'ms exceeded'
35189
+ : 'timeout exceeded';
35190
+ const transitional = _config.transitional || transitionalDefaults;
35191
+ if (_config.timeoutErrorMessage) {
35192
+ timeoutErrorMessage = _config.timeoutErrorMessage;
35193
+ }
35194
+ reject(
35195
+ new AxiosError$1(
35196
+ timeoutErrorMessage,
35197
+ transitional.clarifyTimeoutError ? AxiosError$1.ETIMEDOUT : AxiosError$1.ECONNABORTED,
35198
+ config,
35199
+ request
35200
+ )
35201
+ );
35202
+
35203
+ // Clean up request
35204
+ request = null;
35205
+ };
35206
+
35207
+ // Remove Content-Type if data is undefined
35208
+ requestData === undefined && requestHeaders.setContentType(null);
35209
+
35210
+ // Add headers to the request
35211
+ if ('setRequestHeader' in request) {
35212
+ utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
35213
+ request.setRequestHeader(key, val);
35214
+ });
35215
+ }
35216
+
35217
+ // Add withCredentials to request if needed
35218
+ if (!utils$1.isUndefined(_config.withCredentials)) {
35219
+ request.withCredentials = !!_config.withCredentials;
35220
+ }
35221
+
35222
+ // Add responseType to request if needed
35223
+ if (responseType && responseType !== 'json') {
35224
+ request.responseType = _config.responseType;
35225
+ }
35226
+
35227
+ // Handle progress if needed
35228
+ if (onDownloadProgress) {
35229
+ [downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true);
35230
+ request.addEventListener('progress', downloadThrottled);
35231
+ }
35232
+
35233
+ // Not all browsers support upload events
35234
+ if (onUploadProgress && request.upload) {
35235
+ [uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress);
35236
+
35237
+ request.upload.addEventListener('progress', uploadThrottled);
35238
+
35239
+ request.upload.addEventListener('loadend', flushUpload);
35240
+ }
35241
+
35242
+ if (_config.cancelToken || _config.signal) {
35243
+ // Handle cancellation
35244
+ // eslint-disable-next-line func-names
35245
+ onCanceled = (cancel) => {
35246
+ if (!request) {
35247
+ return;
35248
+ }
35249
+ reject(!cancel || cancel.type ? new CanceledError$1(null, config, request) : cancel);
35250
+ request.abort();
35251
+ request = null;
35252
+ };
35253
+
35254
+ _config.cancelToken && _config.cancelToken.subscribe(onCanceled);
35255
+ if (_config.signal) {
35256
+ _config.signal.aborted
35257
+ ? onCanceled()
35258
+ : _config.signal.addEventListener('abort', onCanceled);
35259
+ }
35260
+ }
35261
+
35262
+ const protocol = parseProtocol(_config.url);
35263
+
35264
+ if (protocol && platform.protocols.indexOf(protocol) === -1) {
35265
+ reject(
35266
+ new AxiosError$1(
35267
+ 'Unsupported protocol ' + protocol + ':',
35268
+ AxiosError$1.ERR_BAD_REQUEST,
35269
+ config
35270
+ )
35271
+ );
34644
35272
  return;
34645
35273
  }
34646
35274
 
34647
- reject(new AxiosError$1('Request aborted', AxiosError$1.ECONNABORTED, config, request));
35275
+ // Send the request
35276
+ request.send(requestData || null);
35277
+ });
35278
+ };
34648
35279
 
34649
- // Clean up request
34650
- request = null;
34651
- };
35280
+ const composeSignals = (signals, timeout) => {
35281
+ const { length } = (signals = signals ? signals.filter(Boolean) : []);
35282
+
35283
+ if (timeout || length) {
35284
+ let controller = new AbortController();
34652
35285
 
34653
- // Handle low level network errors
34654
- request.onerror = function handleError() {
34655
- // Real errors are hidden from us by the browser
34656
- // onerror should only fire if it's a network error
34657
- reject(new AxiosError$1('Network Error', AxiosError$1.ERR_NETWORK, config, request));
35286
+ let aborted;
34658
35287
 
34659
- // Clean up request
34660
- request = null;
35288
+ const onabort = function (reason) {
35289
+ if (!aborted) {
35290
+ aborted = true;
35291
+ unsubscribe();
35292
+ const err = reason instanceof Error ? reason : this.reason;
35293
+ controller.abort(
35294
+ err instanceof AxiosError$1
35295
+ ? err
35296
+ : new CanceledError$1(err instanceof Error ? err.message : err)
35297
+ );
35298
+ }
34661
35299
  };
34662
35300
 
34663
- // Handle timeout
34664
- request.ontimeout = function handleTimeout() {
34665
- let timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';
34666
- const transitional = config.transitional || transitionalDefaults;
34667
- if (config.timeoutErrorMessage) {
34668
- timeoutErrorMessage = config.timeoutErrorMessage;
35301
+ let timer =
35302
+ timeout &&
35303
+ setTimeout(() => {
35304
+ timer = null;
35305
+ onabort(new AxiosError$1(`timeout of ${timeout}ms exceeded`, AxiosError$1.ETIMEDOUT));
35306
+ }, timeout);
35307
+
35308
+ const unsubscribe = () => {
35309
+ if (signals) {
35310
+ timer && clearTimeout(timer);
35311
+ timer = null;
35312
+ signals.forEach((signal) => {
35313
+ signal.unsubscribe
35314
+ ? signal.unsubscribe(onabort)
35315
+ : signal.removeEventListener('abort', onabort);
35316
+ });
35317
+ signals = null;
34669
35318
  }
34670
- reject(new AxiosError$1(
34671
- timeoutErrorMessage,
34672
- transitional.clarifyTimeoutError ? AxiosError$1.ETIMEDOUT : AxiosError$1.ECONNABORTED,
34673
- config,
34674
- request));
34675
-
34676
- // Clean up request
34677
- request = null;
34678
35319
  };
34679
35320
 
34680
- // Add xsrf header
34681
- // This is only done if running in a standard browser environment.
34682
- // Specifically not if we're in a web worker, or react-native.
34683
- if(platform.hasStandardBrowserEnv) {
34684
- withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(config));
35321
+ signals.forEach((signal) => signal.addEventListener('abort', onabort));
34685
35322
 
34686
- if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(fullPath))) {
34687
- // Add xsrf header
34688
- const xsrfValue = config.xsrfHeaderName && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
35323
+ const { signal } = controller;
34689
35324
 
34690
- if (xsrfValue) {
34691
- requestHeaders.set(config.xsrfHeaderName, xsrfValue);
34692
- }
35325
+ signal.unsubscribe = () => utils$1.asap(unsubscribe);
35326
+
35327
+ return signal;
35328
+ }
35329
+ };
35330
+
35331
+ const streamChunk = function* (chunk, chunkSize) {
35332
+ let len = chunk.byteLength;
35333
+
35334
+ if (len < chunkSize) {
35335
+ yield chunk;
35336
+ return;
35337
+ }
35338
+
35339
+ let pos = 0;
35340
+ let end;
35341
+
35342
+ while (pos < len) {
35343
+ end = pos + chunkSize;
35344
+ yield chunk.slice(pos, end);
35345
+ pos = end;
35346
+ }
35347
+ };
35348
+
35349
+ const readBytes = async function* (iterable, chunkSize) {
35350
+ for await (const chunk of readStream(iterable)) {
35351
+ yield* streamChunk(chunk, chunkSize);
35352
+ }
35353
+ };
35354
+
35355
+ const readStream = async function* (stream) {
35356
+ if (stream[Symbol.asyncIterator]) {
35357
+ yield* stream;
35358
+ return;
35359
+ }
35360
+
35361
+ const reader = stream.getReader();
35362
+ try {
35363
+ for (;;) {
35364
+ const { done, value } = await reader.read();
35365
+ if (done) {
35366
+ break;
34693
35367
  }
35368
+ yield value;
34694
35369
  }
35370
+ } finally {
35371
+ await reader.cancel();
35372
+ }
35373
+ };
35374
+
35375
+ const trackStream = (stream, chunkSize, onProgress, onFinish) => {
35376
+ const iterator = readBytes(stream, chunkSize);
35377
+
35378
+ let bytes = 0;
35379
+ let done;
35380
+ let _onFinish = (e) => {
35381
+ if (!done) {
35382
+ done = true;
35383
+ onFinish && onFinish(e);
35384
+ }
35385
+ };
35386
+
35387
+ return new ReadableStream(
35388
+ {
35389
+ async pull(controller) {
35390
+ try {
35391
+ const { done, value } = await iterator.next();
35392
+
35393
+ if (done) {
35394
+ _onFinish();
35395
+ controller.close();
35396
+ return;
35397
+ }
35398
+
35399
+ let len = value.byteLength;
35400
+ if (onProgress) {
35401
+ let loadedBytes = (bytes += len);
35402
+ onProgress(loadedBytes);
35403
+ }
35404
+ controller.enqueue(new Uint8Array(value));
35405
+ } catch (err) {
35406
+ _onFinish(err);
35407
+ throw err;
35408
+ }
35409
+ },
35410
+ cancel(reason) {
35411
+ _onFinish(reason);
35412
+ return iterator.return();
35413
+ },
35414
+ },
35415
+ {
35416
+ highWaterMark: 2,
35417
+ }
35418
+ );
35419
+ };
35420
+
35421
+ const DEFAULT_CHUNK_SIZE = 64 * 1024;
35422
+
35423
+ const { isFunction: isFunction$1 } = utils$1;
35424
+
35425
+ const globalFetchAPI = (({ Request, Response }) => ({
35426
+ Request,
35427
+ Response,
35428
+ }))(utils$1.global);
35429
+
35430
+ const { ReadableStream: ReadableStream$1, TextEncoder: TextEncoder$1 } = utils$1.global;
35431
+
35432
+ const test = (fn, ...args) => {
35433
+ try {
35434
+ return !!fn(...args);
35435
+ } catch (e) {
35436
+ return false;
35437
+ }
35438
+ };
35439
+
35440
+ const factory = (env) => {
35441
+ env = utils$1.merge.call(
35442
+ {
35443
+ skipUndefined: true,
35444
+ },
35445
+ globalFetchAPI,
35446
+ env
35447
+ );
35448
+
35449
+ const { fetch: envFetch, Request, Response } = env;
35450
+ const isFetchSupported = envFetch ? isFunction$1(envFetch) : typeof fetch === 'function';
35451
+ const isRequestSupported = isFunction$1(Request);
35452
+ const isResponseSupported = isFunction$1(Response);
35453
+
35454
+ if (!isFetchSupported) {
35455
+ return false;
35456
+ }
35457
+
35458
+ const isReadableStreamSupported = isFetchSupported && isFunction$1(ReadableStream$1);
35459
+
35460
+ const encodeText =
35461
+ isFetchSupported &&
35462
+ (typeof TextEncoder$1 === 'function'
35463
+ ? (
35464
+ (encoder) => (str) =>
35465
+ encoder.encode(str)
35466
+ )(new TextEncoder$1())
35467
+ : async (str) => new Uint8Array(await new Request(str).arrayBuffer()));
35468
+
35469
+ const supportsRequestStream =
35470
+ isRequestSupported &&
35471
+ isReadableStreamSupported &&
35472
+ test(() => {
35473
+ let duplexAccessed = false;
35474
+
35475
+ const body = new ReadableStream$1();
35476
+
35477
+ const hasContentType = new Request(platform.origin, {
35478
+ body,
35479
+ method: 'POST',
35480
+ get duplex() {
35481
+ duplexAccessed = true;
35482
+ return 'half';
35483
+ },
35484
+ }).headers.has('Content-Type');
35485
+
35486
+ body.cancel();
35487
+
35488
+ return duplexAccessed && !hasContentType;
35489
+ });
35490
+
35491
+ const supportsResponseStream =
35492
+ isResponseSupported &&
35493
+ isReadableStreamSupported &&
35494
+ test(() => utils$1.isReadableStream(new Response('').body));
34695
35495
 
34696
- // Remove Content-Type if data is undefined
34697
- requestData === undefined && requestHeaders.setContentType(null);
35496
+ const resolvers = {
35497
+ stream: supportsResponseStream && ((res) => res.body),
35498
+ };
35499
+
35500
+ isFetchSupported &&
35501
+ (() => {
35502
+ ['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach((type) => {
35503
+ !resolvers[type] &&
35504
+ (resolvers[type] = (res, config) => {
35505
+ let method = res && res[type];
35506
+
35507
+ if (method) {
35508
+ return method.call(res);
35509
+ }
34698
35510
 
34699
- // Add headers to the request
34700
- if ('setRequestHeader' in request) {
34701
- utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
34702
- request.setRequestHeader(key, val);
35511
+ throw new AxiosError$1(
35512
+ `Response type '${type}' is not supported`,
35513
+ AxiosError$1.ERR_NOT_SUPPORT,
35514
+ config
35515
+ );
35516
+ });
34703
35517
  });
35518
+ })();
35519
+
35520
+ const getBodyLength = async (body) => {
35521
+ if (body == null) {
35522
+ return 0;
34704
35523
  }
34705
35524
 
34706
- // Add withCredentials to request if needed
34707
- if (!utils$1.isUndefined(config.withCredentials)) {
34708
- request.withCredentials = !!config.withCredentials;
35525
+ if (utils$1.isBlob(body)) {
35526
+ return body.size;
34709
35527
  }
34710
35528
 
34711
- // Add responseType to request if needed
34712
- if (responseType && responseType !== 'json') {
34713
- request.responseType = config.responseType;
35529
+ if (utils$1.isSpecCompliantForm(body)) {
35530
+ const _request = new Request(platform.origin, {
35531
+ method: 'POST',
35532
+ body,
35533
+ });
35534
+ return (await _request.arrayBuffer()).byteLength;
34714
35535
  }
34715
35536
 
34716
- // Handle progress if needed
34717
- if (typeof config.onDownloadProgress === 'function') {
34718
- request.addEventListener('progress', progressEventReducer(config.onDownloadProgress, true));
35537
+ if (utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
35538
+ return body.byteLength;
34719
35539
  }
34720
35540
 
34721
- // Not all browsers support upload events
34722
- if (typeof config.onUploadProgress === 'function' && request.upload) {
34723
- request.upload.addEventListener('progress', progressEventReducer(config.onUploadProgress));
35541
+ if (utils$1.isURLSearchParams(body)) {
35542
+ body = body + '';
34724
35543
  }
34725
35544
 
34726
- if (config.cancelToken || config.signal) {
34727
- // Handle cancellation
34728
- // eslint-disable-next-line func-names
34729
- onCanceled = cancel => {
34730
- if (!request) {
34731
- return;
35545
+ if (utils$1.isString(body)) {
35546
+ return (await encodeText(body)).byteLength;
35547
+ }
35548
+ };
35549
+
35550
+ const resolveBodyLength = async (headers, body) => {
35551
+ const length = utils$1.toFiniteNumber(headers.getContentLength());
35552
+
35553
+ return length == null ? getBodyLength(body) : length;
35554
+ };
35555
+
35556
+ return async (config) => {
35557
+ let {
35558
+ url,
35559
+ method,
35560
+ data,
35561
+ signal,
35562
+ cancelToken,
35563
+ timeout,
35564
+ onDownloadProgress,
35565
+ onUploadProgress,
35566
+ responseType,
35567
+ headers,
35568
+ withCredentials = 'same-origin',
35569
+ fetchOptions,
35570
+ } = resolveConfig(config);
35571
+
35572
+ let _fetch = envFetch || fetch;
35573
+
35574
+ responseType = responseType ? (responseType + '').toLowerCase() : 'text';
35575
+
35576
+ let composedSignal = composeSignals(
35577
+ [signal, cancelToken && cancelToken.toAbortSignal()],
35578
+ timeout
35579
+ );
35580
+
35581
+ let request = null;
35582
+
35583
+ const unsubscribe =
35584
+ composedSignal &&
35585
+ composedSignal.unsubscribe &&
35586
+ (() => {
35587
+ composedSignal.unsubscribe();
35588
+ });
35589
+
35590
+ let requestContentLength;
35591
+
35592
+ try {
35593
+ if (
35594
+ onUploadProgress &&
35595
+ supportsRequestStream &&
35596
+ method !== 'get' &&
35597
+ method !== 'head' &&
35598
+ (requestContentLength = await resolveBodyLength(headers, data)) !== 0
35599
+ ) {
35600
+ let _request = new Request(url, {
35601
+ method: 'POST',
35602
+ body: data,
35603
+ duplex: 'half',
35604
+ });
35605
+
35606
+ let contentTypeHeader;
35607
+
35608
+ if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
35609
+ headers.setContentType(contentTypeHeader);
34732
35610
  }
34733
- reject(!cancel || cancel.type ? new CanceledError$1(null, config, request) : cancel);
34734
- request.abort();
34735
- request = null;
35611
+
35612
+ if (_request.body) {
35613
+ const [onProgress, flush] = progressEventDecorator(
35614
+ requestContentLength,
35615
+ progressEventReducer(asyncDecorator(onUploadProgress))
35616
+ );
35617
+
35618
+ data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
35619
+ }
35620
+ }
35621
+
35622
+ if (!utils$1.isString(withCredentials)) {
35623
+ withCredentials = withCredentials ? 'include' : 'omit';
35624
+ }
35625
+
35626
+ // Cloudflare Workers throws when credentials are defined
35627
+ // see https://github.com/cloudflare/workerd/issues/902
35628
+ const isCredentialsSupported = isRequestSupported && 'credentials' in Request.prototype;
35629
+
35630
+ const resolvedOptions = {
35631
+ ...fetchOptions,
35632
+ signal: composedSignal,
35633
+ method: method.toUpperCase(),
35634
+ headers: headers.normalize().toJSON(),
35635
+ body: data,
35636
+ duplex: 'half',
35637
+ credentials: isCredentialsSupported ? withCredentials : undefined,
34736
35638
  };
34737
35639
 
34738
- config.cancelToken && config.cancelToken.subscribe(onCanceled);
34739
- if (config.signal) {
34740
- config.signal.aborted ? onCanceled() : config.signal.addEventListener('abort', onCanceled);
35640
+ request = isRequestSupported && new Request(url, resolvedOptions);
35641
+
35642
+ let response = await (isRequestSupported
35643
+ ? _fetch(request, fetchOptions)
35644
+ : _fetch(url, resolvedOptions));
35645
+
35646
+ const isStreamResponse =
35647
+ supportsResponseStream && (responseType === 'stream' || responseType === 'response');
35648
+
35649
+ if (supportsResponseStream && (onDownloadProgress || (isStreamResponse && unsubscribe))) {
35650
+ const options = {};
35651
+
35652
+ ['status', 'statusText', 'headers'].forEach((prop) => {
35653
+ options[prop] = response[prop];
35654
+ });
35655
+
35656
+ const responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
35657
+
35658
+ const [onProgress, flush] =
35659
+ (onDownloadProgress &&
35660
+ progressEventDecorator(
35661
+ responseContentLength,
35662
+ progressEventReducer(asyncDecorator(onDownloadProgress), true)
35663
+ )) ||
35664
+ [];
35665
+
35666
+ response = new Response(
35667
+ trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
35668
+ flush && flush();
35669
+ unsubscribe && unsubscribe();
35670
+ }),
35671
+ options
35672
+ );
34741
35673
  }
34742
- }
34743
35674
 
34744
- const protocol = parseProtocol(fullPath);
35675
+ responseType = responseType || 'text';
34745
35676
 
34746
- if (protocol && platform.protocols.indexOf(protocol) === -1) {
34747
- reject(new AxiosError$1('Unsupported protocol ' + protocol + ':', AxiosError$1.ERR_BAD_REQUEST, config));
34748
- return;
35677
+ let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || 'text'](
35678
+ response,
35679
+ config
35680
+ );
35681
+
35682
+ !isStreamResponse && unsubscribe && unsubscribe();
35683
+
35684
+ return await new Promise((resolve, reject) => {
35685
+ settle(resolve, reject, {
35686
+ data: responseData,
35687
+ headers: AxiosHeaders$1.from(response.headers),
35688
+ status: response.status,
35689
+ statusText: response.statusText,
35690
+ config,
35691
+ request,
35692
+ });
35693
+ });
35694
+ } catch (err) {
35695
+ unsubscribe && unsubscribe();
35696
+
35697
+ if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
35698
+ throw Object.assign(
35699
+ new AxiosError$1(
35700
+ 'Network Error',
35701
+ AxiosError$1.ERR_NETWORK,
35702
+ config,
35703
+ request,
35704
+ err && err.response
35705
+ ),
35706
+ {
35707
+ cause: err.cause || err,
35708
+ }
35709
+ );
35710
+ }
35711
+
35712
+ throw AxiosError$1.from(err, err && err.code, config, request, err && err.response);
34749
35713
  }
35714
+ };
35715
+ };
34750
35716
 
35717
+ const seedCache = new Map();
34751
35718
 
34752
- // Send the request
34753
- request.send(requestData || null);
34754
- });
35719
+ const getFetch = (config) => {
35720
+ let env = (config && config.env) || {};
35721
+ const { fetch, Request, Response } = env;
35722
+ const seeds = [Request, Response, fetch];
35723
+
35724
+ let len = seeds.length,
35725
+ i = len,
35726
+ seed,
35727
+ target,
35728
+ map = seedCache;
35729
+
35730
+ while (i--) {
35731
+ seed = seeds[i];
35732
+ target = map.get(seed);
35733
+
35734
+ target === undefined && map.set(seed, (target = i ? new Map() : factory(env)));
35735
+
35736
+ map = target;
35737
+ }
35738
+
35739
+ return target;
34755
35740
  };
34756
35741
 
35742
+ getFetch();
35743
+
35744
+ /**
35745
+ * Known adapters mapping.
35746
+ * Provides environment-specific adapters for Axios:
35747
+ * - `http` for Node.js
35748
+ * - `xhr` for browsers
35749
+ * - `fetch` for fetch API-based requests
35750
+ *
35751
+ * @type {Object<string, Function|Object>}
35752
+ */
34757
35753
  const knownAdapters = {
34758
35754
  http: httpAdapter,
34759
- xhr: xhrAdapter
35755
+ xhr: xhrAdapter,
35756
+ fetch: {
35757
+ get: getFetch,
35758
+ },
34760
35759
  };
34761
35760
 
35761
+ // Assign adapter names for easier debugging and identification
34762
35762
  utils$1.forEach(knownAdapters, (fn, value) => {
34763
35763
  if (fn) {
34764
35764
  try {
34765
- Object.defineProperty(fn, 'name', {value});
35765
+ Object.defineProperty(fn, 'name', { value });
34766
35766
  } catch (e) {
34767
35767
  // eslint-disable-next-line no-empty
34768
35768
  }
34769
- Object.defineProperty(fn, 'adapterName', {value});
35769
+ Object.defineProperty(fn, 'adapterName', { value });
34770
35770
  }
34771
35771
  });
34772
35772
 
35773
+ /**
35774
+ * Render a rejection reason string for unknown or unsupported adapters
35775
+ *
35776
+ * @param {string} reason
35777
+ * @returns {string}
35778
+ */
34773
35779
  const renderReason = (reason) => `- ${reason}`;
34774
35780
 
34775
- const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false;
35781
+ /**
35782
+ * Check if the adapter is resolved (function, null, or false)
35783
+ *
35784
+ * @param {Function|null|false} adapter
35785
+ * @returns {boolean}
35786
+ */
35787
+ const isResolvedHandle = (adapter) =>
35788
+ utils$1.isFunction(adapter) || adapter === null || adapter === false;
34776
35789
 
34777
- var adapters = {
34778
- getAdapter: (adapters) => {
34779
- adapters = utils$1.isArray(adapters) ? adapters : [adapters];
35790
+ /**
35791
+ * Get the first suitable adapter from the provided list.
35792
+ * Tries each adapter in order until a supported one is found.
35793
+ * Throws an AxiosError if no adapter is suitable.
35794
+ *
35795
+ * @param {Array<string|Function>|string|Function} adapters - Adapter(s) by name or function.
35796
+ * @param {Object} config - Axios request configuration
35797
+ * @throws {AxiosError} If no suitable adapter is available
35798
+ * @returns {Function} The resolved adapter function
35799
+ */
35800
+ function getAdapter$1(adapters, config) {
35801
+ adapters = utils$1.isArray(adapters) ? adapters : [adapters];
34780
35802
 
34781
- const {length} = adapters;
34782
- let nameOrAdapter;
34783
- let adapter;
35803
+ const { length } = adapters;
35804
+ let nameOrAdapter;
35805
+ let adapter;
34784
35806
 
34785
- const rejectedReasons = {};
35807
+ const rejectedReasons = {};
34786
35808
 
34787
- for (let i = 0; i < length; i++) {
34788
- nameOrAdapter = adapters[i];
34789
- let id;
35809
+ for (let i = 0; i < length; i++) {
35810
+ nameOrAdapter = adapters[i];
35811
+ let id;
34790
35812
 
34791
- adapter = nameOrAdapter;
35813
+ adapter = nameOrAdapter;
34792
35814
 
34793
- if (!isResolvedHandle(nameOrAdapter)) {
34794
- adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
35815
+ if (!isResolvedHandle(nameOrAdapter)) {
35816
+ adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
34795
35817
 
34796
- if (adapter === undefined) {
34797
- throw new AxiosError$1(`Unknown adapter '${id}'`);
34798
- }
34799
- }
34800
-
34801
- if (adapter) {
34802
- break;
35818
+ if (adapter === undefined) {
35819
+ throw new AxiosError$1(`Unknown adapter '${id}'`);
34803
35820
  }
35821
+ }
34804
35822
 
34805
- rejectedReasons[id || '#' + i] = adapter;
35823
+ if (adapter && (utils$1.isFunction(adapter) || (adapter = adapter.get(config)))) {
35824
+ break;
34806
35825
  }
34807
35826
 
34808
- if (!adapter) {
35827
+ rejectedReasons[id || '#' + i] = adapter;
35828
+ }
34809
35829
 
34810
- const reasons = Object.entries(rejectedReasons)
34811
- .map(([id, state]) => `adapter ${id} ` +
34812
- (state === false ? 'is not supported by the environment' : 'is not available in the build')
34813
- );
35830
+ if (!adapter) {
35831
+ const reasons = Object.entries(rejectedReasons).map(
35832
+ ([id, state]) =>
35833
+ `adapter ${id} ` +
35834
+ (state === false ? 'is not supported by the environment' : 'is not available in the build')
35835
+ );
34814
35836
 
34815
- let s = length ?
34816
- (reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0])) :
34817
- 'as no adapter specified';
35837
+ let s = length
35838
+ ? reasons.length > 1
35839
+ ? 'since :\n' + reasons.map(renderReason).join('\n')
35840
+ : ' ' + renderReason(reasons[0])
35841
+ : 'as no adapter specified';
34818
35842
 
34819
- throw new AxiosError$1(
34820
- `There is no suitable adapter to dispatch the request ` + s,
34821
- 'ERR_NOT_SUPPORT'
34822
- );
34823
- }
35843
+ throw new AxiosError$1(
35844
+ `There is no suitable adapter to dispatch the request ` + s,
35845
+ 'ERR_NOT_SUPPORT'
35846
+ );
35847
+ }
34824
35848
 
34825
- return adapter;
34826
- },
34827
- adapters: knownAdapters
35849
+ return adapter;
35850
+ }
35851
+
35852
+ /**
35853
+ * Exports Axios adapters and utility to resolve an adapter
35854
+ */
35855
+ var adapters = {
35856
+ /**
35857
+ * Resolve an adapter from a list of adapter names or functions.
35858
+ * @type {Function}
35859
+ */
35860
+ getAdapter: getAdapter$1,
35861
+
35862
+ /**
35863
+ * Exposes all known adapters
35864
+ * @type {Object<string, Function|Object>}
35865
+ */
35866
+ adapters: knownAdapters,
34828
35867
  };
34829
35868
 
34830
35869
  /**
@@ -34857,152 +35896,46 @@
34857
35896
  config.headers = AxiosHeaders$1.from(config.headers);
34858
35897
 
34859
35898
  // Transform request data
34860
- config.data = transformData.call(
34861
- config,
34862
- config.transformRequest
34863
- );
35899
+ config.data = transformData.call(config, config.transformRequest);
34864
35900
 
34865
35901
  if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {
34866
35902
  config.headers.setContentType('application/x-www-form-urlencoded', false);
34867
35903
  }
34868
35904
 
34869
- const adapter = adapters.getAdapter(config.adapter || defaults.adapter);
34870
-
34871
- return adapter(config).then(function onAdapterResolution(response) {
34872
- throwIfCancellationRequested(config);
34873
-
34874
- // Transform response data
34875
- response.data = transformData.call(
34876
- config,
34877
- config.transformResponse,
34878
- response
34879
- );
35905
+ const adapter = adapters.getAdapter(config.adapter || defaults.adapter, config);
34880
35906
 
34881
- response.headers = AxiosHeaders$1.from(response.headers);
34882
-
34883
- return response;
34884
- }, function onAdapterRejection(reason) {
34885
- if (!isCancel$1(reason)) {
35907
+ return adapter(config).then(
35908
+ function onAdapterResolution(response) {
34886
35909
  throwIfCancellationRequested(config);
34887
35910
 
34888
35911
  // Transform response data
34889
- if (reason && reason.response) {
34890
- reason.response.data = transformData.call(
34891
- config,
34892
- config.transformResponse,
34893
- reason.response
34894
- );
34895
- reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
34896
- }
34897
- }
35912
+ response.data = transformData.call(config, config.transformResponse, response);
34898
35913
 
34899
- return Promise.reject(reason);
34900
- });
34901
- }
34902
-
34903
- const headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? thing.toJSON() : thing;
35914
+ response.headers = AxiosHeaders$1.from(response.headers);
34904
35915
 
34905
- /**
34906
- * Config-specific merge-function which creates a new config-object
34907
- * by merging two configuration objects together.
34908
- *
34909
- * @param {Object} config1
34910
- * @param {Object} config2
34911
- *
34912
- * @returns {Object} New object resulting from merging config2 to config1
34913
- */
34914
- function mergeConfig$1(config1, config2) {
34915
- // eslint-disable-next-line no-param-reassign
34916
- config2 = config2 || {};
34917
- const config = {};
34918
-
34919
- function getMergedValue(target, source, caseless) {
34920
- if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
34921
- return utils$1.merge.call({caseless}, target, source);
34922
- } else if (utils$1.isPlainObject(source)) {
34923
- return utils$1.merge({}, source);
34924
- } else if (utils$1.isArray(source)) {
34925
- return source.slice();
34926
- }
34927
- return source;
34928
- }
34929
-
34930
- // eslint-disable-next-line consistent-return
34931
- function mergeDeepProperties(a, b, caseless) {
34932
- if (!utils$1.isUndefined(b)) {
34933
- return getMergedValue(a, b, caseless);
34934
- } else if (!utils$1.isUndefined(a)) {
34935
- return getMergedValue(undefined, a, caseless);
34936
- }
34937
- }
34938
-
34939
- // eslint-disable-next-line consistent-return
34940
- function valueFromConfig2(a, b) {
34941
- if (!utils$1.isUndefined(b)) {
34942
- return getMergedValue(undefined, b);
34943
- }
34944
- }
34945
-
34946
- // eslint-disable-next-line consistent-return
34947
- function defaultToConfig2(a, b) {
34948
- if (!utils$1.isUndefined(b)) {
34949
- return getMergedValue(undefined, b);
34950
- } else if (!utils$1.isUndefined(a)) {
34951
- return getMergedValue(undefined, a);
34952
- }
34953
- }
35916
+ return response;
35917
+ },
35918
+ function onAdapterRejection(reason) {
35919
+ if (!isCancel$1(reason)) {
35920
+ throwIfCancellationRequested(config);
35921
+
35922
+ // Transform response data
35923
+ if (reason && reason.response) {
35924
+ reason.response.data = transformData.call(
35925
+ config,
35926
+ config.transformResponse,
35927
+ reason.response
35928
+ );
35929
+ reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
35930
+ }
35931
+ }
34954
35932
 
34955
- // eslint-disable-next-line consistent-return
34956
- function mergeDirectKeys(a, b, prop) {
34957
- if (prop in config2) {
34958
- return getMergedValue(a, b);
34959
- } else if (prop in config1) {
34960
- return getMergedValue(undefined, a);
35933
+ return Promise.reject(reason);
34961
35934
  }
34962
- }
34963
-
34964
- const mergeMap = {
34965
- url: valueFromConfig2,
34966
- method: valueFromConfig2,
34967
- data: valueFromConfig2,
34968
- baseURL: defaultToConfig2,
34969
- transformRequest: defaultToConfig2,
34970
- transformResponse: defaultToConfig2,
34971
- paramsSerializer: defaultToConfig2,
34972
- timeout: defaultToConfig2,
34973
- timeoutMessage: defaultToConfig2,
34974
- withCredentials: defaultToConfig2,
34975
- withXSRFToken: defaultToConfig2,
34976
- adapter: defaultToConfig2,
34977
- responseType: defaultToConfig2,
34978
- xsrfCookieName: defaultToConfig2,
34979
- xsrfHeaderName: defaultToConfig2,
34980
- onUploadProgress: defaultToConfig2,
34981
- onDownloadProgress: defaultToConfig2,
34982
- decompress: defaultToConfig2,
34983
- maxContentLength: defaultToConfig2,
34984
- maxBodyLength: defaultToConfig2,
34985
- beforeRedirect: defaultToConfig2,
34986
- transport: defaultToConfig2,
34987
- httpAgent: defaultToConfig2,
34988
- httpsAgent: defaultToConfig2,
34989
- cancelToken: defaultToConfig2,
34990
- socketPath: defaultToConfig2,
34991
- responseEncoding: defaultToConfig2,
34992
- validateStatus: mergeDirectKeys,
34993
- headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)
34994
- };
34995
-
34996
- utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
34997
- const merge = mergeMap[prop] || mergeDeepProperties;
34998
- const configValue = merge(config1[prop], config2[prop], prop);
34999
- (utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
35000
- });
35001
-
35002
- return config;
35935
+ );
35003
35936
  }
35004
35937
 
35005
- const VERSION$1 = "1.6.2";
35938
+ const VERSION$1 = "1.15.0";
35006
35939
 
35007
35940
  const validators$1 = {};
35008
35941
 
@@ -35026,7 +35959,15 @@
35026
35959
  */
35027
35960
  validators$1.transitional = function transitional(validator, version, message) {
35028
35961
  function formatMessage(opt, desc) {
35029
- return '[Axios v' + VERSION$1 + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : '');
35962
+ return (
35963
+ '[Axios v' +
35964
+ VERSION$1 +
35965
+ "] Transitional option '" +
35966
+ opt +
35967
+ "'" +
35968
+ desc +
35969
+ (message ? '. ' + message : '')
35970
+ );
35030
35971
  }
35031
35972
 
35032
35973
  // eslint-disable-next-line func-names
@@ -35053,6 +35994,14 @@
35053
35994
  };
35054
35995
  };
35055
35996
 
35997
+ validators$1.spelling = function spelling(correctSpelling) {
35998
+ return (value, opt) => {
35999
+ // eslint-disable-next-line no-console
36000
+ console.warn(`${opt} is likely a misspelling of ${correctSpelling}`);
36001
+ return true;
36002
+ };
36003
+ };
36004
+
35056
36005
  /**
35057
36006
  * Assert object's properties type
35058
36007
  *
@@ -35076,7 +36025,10 @@
35076
36025
  const value = options[opt];
35077
36026
  const result = value === undefined || validator(value, opt, options);
35078
36027
  if (result !== true) {
35079
- throw new AxiosError$1('option ' + opt + ' must be ' + result, AxiosError$1.ERR_BAD_OPTION_VALUE);
36028
+ throw new AxiosError$1(
36029
+ 'option ' + opt + ' must be ' + result,
36030
+ AxiosError$1.ERR_BAD_OPTION_VALUE
36031
+ );
35080
36032
  }
35081
36033
  continue;
35082
36034
  }
@@ -35088,7 +36040,7 @@
35088
36040
 
35089
36041
  var validator = {
35090
36042
  assertOptions,
35091
- validators: validators$1
36043
+ validators: validators$1,
35092
36044
  };
35093
36045
 
35094
36046
  const validators = validator.validators;
@@ -35102,10 +36054,10 @@
35102
36054
  */
35103
36055
  let Axios$1 = class Axios {
35104
36056
  constructor(instanceConfig) {
35105
- this.defaults = instanceConfig;
36057
+ this.defaults = instanceConfig || {};
35106
36058
  this.interceptors = {
35107
36059
  request: new InterceptorManager(),
35108
- response: new InterceptorManager()
36060
+ response: new InterceptorManager(),
35109
36061
  };
35110
36062
  }
35111
36063
 
@@ -35117,7 +36069,50 @@
35117
36069
  *
35118
36070
  * @returns {Promise} The Promise to be fulfilled
35119
36071
  */
35120
- request(configOrUrl, config) {
36072
+ async request(configOrUrl, config) {
36073
+ try {
36074
+ return await this._request(configOrUrl, config);
36075
+ } catch (err) {
36076
+ if (err instanceof Error) {
36077
+ let dummy = {};
36078
+
36079
+ Error.captureStackTrace ? Error.captureStackTrace(dummy) : (dummy = new Error());
36080
+
36081
+ // slice off the Error: ... line
36082
+ const stack = (() => {
36083
+ if (!dummy.stack) {
36084
+ return '';
36085
+ }
36086
+
36087
+ const firstNewlineIndex = dummy.stack.indexOf('\n');
36088
+
36089
+ return firstNewlineIndex === -1 ? '' : dummy.stack.slice(firstNewlineIndex + 1);
36090
+ })();
36091
+ try {
36092
+ if (!err.stack) {
36093
+ err.stack = stack;
36094
+ // match without the 2 top stack lines
36095
+ } else if (stack) {
36096
+ const firstNewlineIndex = stack.indexOf('\n');
36097
+ const secondNewlineIndex =
36098
+ firstNewlineIndex === -1 ? -1 : stack.indexOf('\n', firstNewlineIndex + 1);
36099
+ const stackWithoutTwoTopLines =
36100
+ secondNewlineIndex === -1 ? '' : stack.slice(secondNewlineIndex + 1);
36101
+
36102
+ if (!String(err.stack).endsWith(stackWithoutTwoTopLines)) {
36103
+ err.stack += '\n' + stack;
36104
+ }
36105
+ }
36106
+ } catch (e) {
36107
+ // ignore the case where "stack" is an un-writable property
36108
+ }
36109
+ }
36110
+
36111
+ throw err;
36112
+ }
36113
+ }
36114
+
36115
+ _request(configOrUrl, config) {
35121
36116
  /*eslint no-param-reassign:0*/
35122
36117
  // Allow for axios('example/url'[, config]) a la fetch API
35123
36118
  if (typeof configOrUrl === 'string') {
@@ -35129,44 +36124,64 @@
35129
36124
 
35130
36125
  config = mergeConfig$1(this.defaults, config);
35131
36126
 
35132
- const {transitional, paramsSerializer, headers} = config;
36127
+ const { transitional, paramsSerializer, headers } = config;
35133
36128
 
35134
36129
  if (transitional !== undefined) {
35135
- validator.assertOptions(transitional, {
35136
- silentJSONParsing: validators.transitional(validators.boolean),
35137
- forcedJSONParsing: validators.transitional(validators.boolean),
35138
- clarifyTimeoutError: validators.transitional(validators.boolean)
35139
- }, false);
36130
+ validator.assertOptions(
36131
+ transitional,
36132
+ {
36133
+ silentJSONParsing: validators.transitional(validators.boolean),
36134
+ forcedJSONParsing: validators.transitional(validators.boolean),
36135
+ clarifyTimeoutError: validators.transitional(validators.boolean),
36136
+ legacyInterceptorReqResOrdering: validators.transitional(validators.boolean),
36137
+ },
36138
+ false
36139
+ );
35140
36140
  }
35141
36141
 
35142
36142
  if (paramsSerializer != null) {
35143
36143
  if (utils$1.isFunction(paramsSerializer)) {
35144
36144
  config.paramsSerializer = {
35145
- serialize: paramsSerializer
36145
+ serialize: paramsSerializer,
35146
36146
  };
35147
36147
  } else {
35148
- validator.assertOptions(paramsSerializer, {
35149
- encode: validators.function,
35150
- serialize: validators.function
35151
- }, true);
36148
+ validator.assertOptions(
36149
+ paramsSerializer,
36150
+ {
36151
+ encode: validators.function,
36152
+ serialize: validators.function,
36153
+ },
36154
+ true
36155
+ );
35152
36156
  }
35153
36157
  }
35154
36158
 
36159
+ // Set config.allowAbsoluteUrls
36160
+ if (config.allowAbsoluteUrls !== undefined) ; else if (this.defaults.allowAbsoluteUrls !== undefined) {
36161
+ config.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls;
36162
+ } else {
36163
+ config.allowAbsoluteUrls = true;
36164
+ }
36165
+
36166
+ validator.assertOptions(
36167
+ config,
36168
+ {
36169
+ baseUrl: validators.spelling('baseURL'),
36170
+ withXsrfToken: validators.spelling('withXSRFToken'),
36171
+ },
36172
+ true
36173
+ );
36174
+
35155
36175
  // Set config.method
35156
36176
  config.method = (config.method || this.defaults.method || 'get').toLowerCase();
35157
36177
 
35158
36178
  // Flatten headers
35159
- let contextHeaders = headers && utils$1.merge(
35160
- headers.common,
35161
- headers[config.method]
35162
- );
36179
+ let contextHeaders = headers && utils$1.merge(headers.common, headers[config.method]);
35163
36180
 
35164
- headers && utils$1.forEach(
35165
- ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
35166
- (method) => {
36181
+ headers &&
36182
+ utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], (method) => {
35167
36183
  delete headers[method];
35168
- }
35169
- );
36184
+ });
35170
36185
 
35171
36186
  config.headers = AxiosHeaders$1.concat(contextHeaders, headers);
35172
36187
 
@@ -35180,7 +36195,15 @@
35180
36195
 
35181
36196
  synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
35182
36197
 
35183
- requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
36198
+ const transitional = config.transitional || transitionalDefaults;
36199
+ const legacyInterceptorReqResOrdering =
36200
+ transitional && transitional.legacyInterceptorReqResOrdering;
36201
+
36202
+ if (legacyInterceptorReqResOrdering) {
36203
+ requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
36204
+ } else {
36205
+ requestInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
36206
+ }
35184
36207
  });
35185
36208
 
35186
36209
  const responseInterceptorChain = [];
@@ -35194,8 +36217,8 @@
35194
36217
 
35195
36218
  if (!synchronousRequestInterceptors) {
35196
36219
  const chain = [dispatchRequest.bind(this), undefined];
35197
- chain.unshift.apply(chain, requestInterceptorChain);
35198
- chain.push.apply(chain, responseInterceptorChain);
36220
+ chain.unshift(...requestInterceptorChain);
36221
+ chain.push(...responseInterceptorChain);
35199
36222
  len = chain.length;
35200
36223
 
35201
36224
  promise = Promise.resolve(config);
@@ -35211,8 +36234,6 @@
35211
36234
 
35212
36235
  let newConfig = config;
35213
36236
 
35214
- i = 0;
35215
-
35216
36237
  while (i < len) {
35217
36238
  const onFulfilled = requestInterceptorChain[i++];
35218
36239
  const onRejected = requestInterceptorChain[i++];
@@ -35242,7 +36263,7 @@
35242
36263
 
35243
36264
  getUri(config) {
35244
36265
  config = mergeConfig$1(this.defaults, config);
35245
- const fullPath = buildFullPath(config.baseURL, config.url);
36266
+ const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
35246
36267
  return buildURL(fullPath, config.params, config.paramsSerializer);
35247
36268
  }
35248
36269
  };
@@ -35250,28 +36271,32 @@
35250
36271
  // Provide aliases for supported request methods
35251
36272
  utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
35252
36273
  /*eslint func-names:0*/
35253
- Axios$1.prototype[method] = function(url, config) {
35254
- return this.request(mergeConfig$1(config || {}, {
35255
- method,
35256
- url,
35257
- data: (config || {}).data
35258
- }));
36274
+ Axios$1.prototype[method] = function (url, config) {
36275
+ return this.request(
36276
+ mergeConfig$1(config || {}, {
36277
+ method,
36278
+ url,
36279
+ data: (config || {}).data,
36280
+ })
36281
+ );
35259
36282
  };
35260
36283
  });
35261
36284
 
35262
36285
  utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
35263
- /*eslint func-names:0*/
35264
-
35265
36286
  function generateHTTPMethod(isForm) {
35266
36287
  return function httpMethod(url, data, config) {
35267
- return this.request(mergeConfig$1(config || {}, {
35268
- method,
35269
- headers: isForm ? {
35270
- 'Content-Type': 'multipart/form-data'
35271
- } : {},
35272
- url,
35273
- data
35274
- }));
36288
+ return this.request(
36289
+ mergeConfig$1(config || {}, {
36290
+ method,
36291
+ headers: isForm
36292
+ ? {
36293
+ 'Content-Type': 'multipart/form-data',
36294
+ }
36295
+ : {},
36296
+ url,
36297
+ data,
36298
+ })
36299
+ );
35275
36300
  };
35276
36301
  }
35277
36302
 
@@ -35302,7 +36327,7 @@
35302
36327
  const token = this;
35303
36328
 
35304
36329
  // eslint-disable-next-line func-names
35305
- this.promise.then(cancel => {
36330
+ this.promise.then((cancel) => {
35306
36331
  if (!token._listeners) return;
35307
36332
 
35308
36333
  let i = token._listeners.length;
@@ -35314,10 +36339,10 @@
35314
36339
  });
35315
36340
 
35316
36341
  // eslint-disable-next-line func-names
35317
- this.promise.then = onfulfilled => {
36342
+ this.promise.then = (onfulfilled) => {
35318
36343
  let _resolve;
35319
36344
  // eslint-disable-next-line func-names
35320
- const promise = new Promise(resolve => {
36345
+ const promise = new Promise((resolve) => {
35321
36346
  token.subscribe(resolve);
35322
36347
  _resolve = resolve;
35323
36348
  }).then(onfulfilled);
@@ -35380,6 +36405,20 @@
35380
36405
  }
35381
36406
  }
35382
36407
 
36408
+ toAbortSignal() {
36409
+ const controller = new AbortController();
36410
+
36411
+ const abort = (err) => {
36412
+ controller.abort(err);
36413
+ };
36414
+
36415
+ this.subscribe(abort);
36416
+
36417
+ controller.signal.unsubscribe = () => this.unsubscribe(abort);
36418
+
36419
+ return controller.signal;
36420
+ }
36421
+
35383
36422
  /**
35384
36423
  * Returns an object that contains a new `CancelToken` and a function that, when called,
35385
36424
  * cancels the `CancelToken`.
@@ -35391,7 +36430,7 @@
35391
36430
  });
35392
36431
  return {
35393
36432
  token,
35394
- cancel
36433
+ cancel,
35395
36434
  };
35396
36435
  }
35397
36436
  };
@@ -35403,7 +36442,7 @@
35403
36442
  *
35404
36443
  * ```js
35405
36444
  * function f(x, y, z) {}
35406
- * var args = [1, 2, 3];
36445
+ * const args = [1, 2, 3];
35407
36446
  * f.apply(null, args);
35408
36447
  * ```
35409
36448
  *
@@ -35431,7 +36470,7 @@
35431
36470
  * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
35432
36471
  */
35433
36472
  function isAxiosError$1(payload) {
35434
- return utils$1.isObject(payload) && (payload.isAxiosError === true);
36473
+ return utils$1.isObject(payload) && payload.isAxiosError === true;
35435
36474
  }
35436
36475
 
35437
36476
  const HttpStatusCode$1 = {
@@ -35498,6 +36537,12 @@
35498
36537
  LoopDetected: 508,
35499
36538
  NotExtended: 510,
35500
36539
  NetworkAuthenticationRequired: 511,
36540
+ WebServerIsDown: 521,
36541
+ ConnectionTimedOut: 522,
36542
+ OriginIsUnreachable: 523,
36543
+ TimeoutOccurred: 524,
36544
+ SslHandshakeFailed: 525,
36545
+ InvalidSslCertificate: 526,
35501
36546
  };
35502
36547
 
35503
36548
  Object.entries(HttpStatusCode$1).forEach(([key, value]) => {
@@ -35516,10 +36561,10 @@
35516
36561
  const instance = bind(Axios$1.prototype.request, context);
35517
36562
 
35518
36563
  // Copy axios.prototype to instance
35519
- utils$1.extend(instance, Axios$1.prototype, context, {allOwnKeys: true});
36564
+ utils$1.extend(instance, Axios$1.prototype, context, { allOwnKeys: true });
35520
36565
 
35521
36566
  // Copy context to instance
35522
- utils$1.extend(instance, context, null, {allOwnKeys: true});
36567
+ utils$1.extend(instance, context, null, { allOwnKeys: true });
35523
36568
 
35524
36569
  // Factory for creating new instances
35525
36570
  instance.create = function create(instanceConfig) {
@@ -35563,7 +36608,7 @@
35563
36608
 
35564
36609
  axios.AxiosHeaders = AxiosHeaders$1;
35565
36610
 
35566
- axios.formToJSON = thing => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
36611
+ axios.formToJSON = (thing) => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
35567
36612
 
35568
36613
  axios.getAdapter = adapters.getAdapter;
35569
36614
 
@@ -35590,7 +36635,7 @@
35590
36635
  HttpStatusCode,
35591
36636
  formToJSON,
35592
36637
  getAdapter,
35593
- mergeConfig
36638
+ mergeConfig,
35594
36639
  } = axios;
35595
36640
 
35596
36641
  const prodFunctionsBaseUrl = "https://us-central1-neurosity-device.cloudfunctions.net";
@@ -35982,7 +37027,7 @@
35982
37027
  function requireBuffer () {
35983
37028
  if (hasRequiredBuffer) return buffer;
35984
37029
  hasRequiredBuffer = 1;
35985
- (function (exports) {
37030
+ (function (exports$1) {
35986
37031
 
35987
37032
  const base64 = requireBase64Js();
35988
37033
  const ieee754 = requireIeee754();
@@ -35991,12 +37036,12 @@
35991
37036
  ? Symbol['for']('nodejs.util.inspect.custom') // eslint-disable-line dot-notation
35992
37037
  : null;
35993
37038
 
35994
- exports.Buffer = Buffer;
35995
- exports.SlowBuffer = SlowBuffer;
35996
- exports.INSPECT_MAX_BYTES = 50;
37039
+ exports$1.Buffer = Buffer;
37040
+ exports$1.SlowBuffer = SlowBuffer;
37041
+ exports$1.INSPECT_MAX_BYTES = 50;
35997
37042
 
35998
37043
  const K_MAX_LENGTH = 0x7fffffff;
35999
- exports.kMaxLength = K_MAX_LENGTH;
37044
+ exports$1.kMaxLength = K_MAX_LENGTH;
36000
37045
 
36001
37046
  /**
36002
37047
  * If `Buffer.TYPED_ARRAY_SUPPORT`:
@@ -36592,7 +37637,7 @@
36592
37637
 
36593
37638
  Buffer.prototype.inspect = function inspect () {
36594
37639
  let str = '';
36595
- const max = exports.INSPECT_MAX_BYTES;
37640
+ const max = exports$1.INSPECT_MAX_BYTES;
36596
37641
  str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim();
36597
37642
  if (this.length > max) str += ' ... ';
36598
37643
  return '<Buffer ' + str + '>'
@@ -39017,6 +40062,7 @@
39017
40062
  this._brainwavesPowerByBand$ =
39018
40063
  this._subscribeWhileAuthenticated("powerByBand");
39019
40064
  this._signalQuality$ = this._subscribeWhileAuthenticated("signalQuality");
40065
+ this._signalQualityV2$ = this._subscribeWhileAuthenticated("signalQualityV2");
39020
40066
  this._status$ = this._subscribeWhileAuthenticated("status");
39021
40067
  this._settings$ = this._subscribeWhileAuthenticated("settings");
39022
40068
  this._wifiNearbyNetworks$ =
@@ -39153,6 +40199,9 @@
39153
40199
  signalQuality() {
39154
40200
  return this._signalQuality$;
39155
40201
  }
40202
+ signalQualityV2() {
40203
+ return this._signalQualityV2$;
40204
+ }
39156
40205
  async addMarker(label) {
39157
40206
  await this.dispatchAction({
39158
40207
  action: "marker",
@@ -39315,20 +40364,20 @@
39315
40364
  function requireRe () {
39316
40365
  if (hasRequiredRe) return re.exports;
39317
40366
  hasRequiredRe = 1;
39318
- (function (module, exports) {
40367
+ (function (module, exports$1) {
39319
40368
  const {
39320
40369
  MAX_SAFE_COMPONENT_LENGTH,
39321
40370
  MAX_SAFE_BUILD_LENGTH,
39322
40371
  MAX_LENGTH,
39323
40372
  } = requireConstants();
39324
40373
  const debug = requireDebug();
39325
- exports = module.exports = {};
40374
+ exports$1 = module.exports = {};
39326
40375
 
39327
40376
  // The actual regexps go on exports.re
39328
- const re = exports.re = [];
39329
- const safeRe = exports.safeRe = [];
39330
- const src = exports.src = [];
39331
- const t = exports.t = {};
40377
+ const re = exports$1.re = [];
40378
+ const safeRe = exports$1.safeRe = [];
40379
+ const src = exports$1.src = [];
40380
+ const t = exports$1.t = {};
39332
40381
  let R = 0;
39333
40382
 
39334
40383
  const LETTERDASHNUMBER = '[a-zA-Z0-9-]';
@@ -39489,7 +40538,7 @@
39489
40538
  createToken('LONETILDE', '(?:~>?)');
39490
40539
 
39491
40540
  createToken('TILDETRIM', `(\\s*)${src[t.LONETILDE]}\\s+`, true);
39492
- exports.tildeTrimReplace = '$1~';
40541
+ exports$1.tildeTrimReplace = '$1~';
39493
40542
 
39494
40543
  createToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);
39495
40544
  createToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);
@@ -39499,7 +40548,7 @@
39499
40548
  createToken('LONECARET', '(?:\\^)');
39500
40549
 
39501
40550
  createToken('CARETTRIM', `(\\s*)${src[t.LONECARET]}\\s+`, true);
39502
- exports.caretTrimReplace = '$1^';
40551
+ exports$1.caretTrimReplace = '$1^';
39503
40552
 
39504
40553
  createToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);
39505
40554
  createToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);
@@ -39512,7 +40561,7 @@
39512
40561
  // it modifies, so that `> 1.2.3` ==> `>1.2.3`
39513
40562
  createToken('COMPARATORTRIM', `(\\s*)${src[t.GTLT]
39514
40563
  }\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true);
39515
- exports.comparatorTrimReplace = '$1$2$3';
40564
+ exports$1.comparatorTrimReplace = '$1$2$3';
39516
40565
 
39517
40566
  // Something like `1.2.3 - 1.2.4`
39518
40567
  // Note that these all use the loose form, because they'll be
@@ -40294,6 +41343,127 @@
40294
41343
  bluetooth: () => this.bluetoothClient.brainwaves(label)
40295
41344
  });
40296
41345
  }
41346
+ async record(options) {
41347
+ var _a;
41348
+ if (!(await this.cloudClient.didSelectDevice())) {
41349
+ return Promise.reject(mustSelectDevice);
41350
+ }
41351
+ const [hasOAuthError, OAuthError] = validateScopeBasedPermissionForAction(this.cloudClient.userClaims, {
41352
+ command: "brainwaves",
41353
+ action: "record"});
41354
+ if (hasOAuthError) {
41355
+ return Promise.reject(OAuthError);
41356
+ }
41357
+ if (!options.label) {
41358
+ return Promise.reject(new Error(`${prefix}A label is required for record.`));
41359
+ }
41360
+ if (!options.duration || options.duration <= 0) {
41361
+ return Promise.reject(new Error(`${prefix}A positive duration is required for record.`));
41362
+ }
41363
+ const MAX_DURATION = 30 * 60 * 1000;
41364
+ if (options.duration > MAX_DURATION) {
41365
+ return Promise.reject(new Error(`${prefix}Duration ${options.duration}ms exceeds maximum of ${MAX_DURATION}ms (30 minutes).`));
41366
+ }
41367
+ const response = await this.dispatchAction({
41368
+ command: "brainwaves",
41369
+ action: "record",
41370
+ message: {
41371
+ name: options.name || options.label,
41372
+ label: options.label,
41373
+ duration: options.duration,
41374
+ experimentId: options.experimentId || "sdk-recording"
41375
+ },
41376
+ responseRequired: true,
41377
+ responseTimeout: options.duration + 90000
41378
+ });
41379
+ return (_a = response === null || response === void 0 ? void 0 : response.message) !== null && _a !== void 0 ? _a : response;
41380
+ }
41381
+ async startRecording(options) {
41382
+ var _a;
41383
+ if (!(await this.cloudClient.didSelectDevice())) {
41384
+ return Promise.reject(mustSelectDevice);
41385
+ }
41386
+ const [hasOAuthError, OAuthError] = validateScopeBasedPermissionForAction(this.cloudClient.userClaims, {
41387
+ command: "brainwaves",
41388
+ action: "startRecording"});
41389
+ if (hasOAuthError) {
41390
+ return Promise.reject(OAuthError);
41391
+ }
41392
+ if (!options.label) {
41393
+ return Promise.reject(new Error(`${prefix}A label is required for startRecording.`));
41394
+ }
41395
+ if (!options.maxDuration || options.maxDuration <= 0) {
41396
+ return Promise.reject(new Error(`${prefix}A positive maxDuration is required for startRecording.`));
41397
+ }
41398
+ const MAX_DURATION = 30 * 60 * 1000;
41399
+ if (options.maxDuration > MAX_DURATION) {
41400
+ return Promise.reject(new Error(`${prefix}Duration ${options.maxDuration}ms exceeds maximum of ${MAX_DURATION}ms (30 minutes).`));
41401
+ }
41402
+ const response = await this.dispatchAction({
41403
+ command: "brainwaves",
41404
+ action: "startRecording",
41405
+ message: {
41406
+ name: options.name || options.label,
41407
+ label: options.label,
41408
+ maxDuration: options.maxDuration,
41409
+ experimentId: options.experimentId || "sdk-recording"
41410
+ },
41411
+ responseRequired: true,
41412
+ responseTimeout: options.maxDuration + 10000
41413
+ });
41414
+ const startResponse = (_a = response === null || response === void 0 ? void 0 : response.message) !== null && _a !== void 0 ? _a : response;
41415
+ if (!(startResponse === null || startResponse === void 0 ? void 0 : startResponse.ok)) {
41416
+ return Promise.reject(new Error(`${prefix}Failed to start recording: ${(startResponse === null || startResponse === void 0 ? void 0 : startResponse.error) || "unknown error"}`));
41417
+ }
41418
+ const { cancel: cancelAction, complete: completeAction } = startResponse;
41419
+ const startTime = Date.now();
41420
+ let stopped = false;
41421
+ let resolveResult;
41422
+ const resultPromise = new Promise((resolve) => {
41423
+ resolveResult = resolve;
41424
+ });
41425
+ const elapsedSubscribers = new Set();
41426
+ const elapsed$ = new Observable((subscriber) => {
41427
+ elapsedSubscribers.add(subscriber);
41428
+ const timer = setInterval(() => {
41429
+ subscriber.next(Date.now() - startTime);
41430
+ }, 1000);
41431
+ return () => {
41432
+ clearInterval(timer);
41433
+ elapsedSubscribers.delete(subscriber);
41434
+ };
41435
+ });
41436
+ const completeAllElapsed = () => {
41437
+ for (const sub of elapsedSubscribers) {
41438
+ sub.complete();
41439
+ }
41440
+ };
41441
+ const stop = async () => {
41442
+ var _a, _b;
41443
+ if (stopped)
41444
+ return resultPromise;
41445
+ stopped = true;
41446
+ completeAllElapsed();
41447
+ const stopResponse = await this.dispatchAction(completeAction);
41448
+ const result = (_b = (_a = stopResponse === null || stopResponse === void 0 ? void 0 : stopResponse.message) !== null && _a !== void 0 ? _a : stopResponse) !== null && _b !== void 0 ? _b : { ok: true };
41449
+ resolveResult(result);
41450
+ return result;
41451
+ };
41452
+ const cancel = async () => {
41453
+ if (stopped)
41454
+ return;
41455
+ stopped = true;
41456
+ completeAllElapsed();
41457
+ await this.dispatchAction(cancelAction);
41458
+ resolveResult({ ok: false, error: "cancelled" });
41459
+ };
41460
+ return {
41461
+ elapsed$,
41462
+ stop,
41463
+ cancel,
41464
+ result: resultPromise
41465
+ };
41466
+ }
40297
41467
  calm() {
40298
41468
  const [hasOAuthError, OAuthError] = validateScopeBasedPermissionForFunctionName(this.cloudClient.userClaims, "calm");
40299
41469
  if (hasOAuthError) {
@@ -40323,6 +41493,21 @@
40323
41493
  bluetooth: () => this.bluetoothClient.signalQuality()
40324
41494
  });
40325
41495
  }
41496
+ signalQualityV2() {
41497
+ const metric = "signalQualityV2";
41498
+ const [hasOAuthError, OAuthError] = validateScopeBasedPermissionForFunctionName(this.cloudClient.userClaims, "signalQuality");
41499
+ if (hasOAuthError) {
41500
+ return throwError(() => OAuthError);
41501
+ }
41502
+ return this._withStreamingModeObservable({
41503
+ wifi: () => getCloudMetric(this._getCloudMetricDependencies(), {
41504
+ metric,
41505
+ labels: getLabels(metric),
41506
+ atomic: true
41507
+ }),
41508
+ bluetooth: () => this.bluetoothClient.signalQualityV2()
41509
+ });
41510
+ }
40326
41511
  settings() {
40327
41512
  const [hasOAuthError, OAuthError] = validateScopeBasedPermissionForFunctionName(this.cloudClient.userClaims, "settings");
40328
41513
  if (hasOAuthError) {