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