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