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