@verdocs/web-sdk 6.9.2 → 6.9.6
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/cjs/{index-CeUF44L9.js → index-DZBJS0kx.js} +441 -263
- package/dist/cjs/index-DZBJS0kx.js.map +1 -0
- package/dist/cjs/{utils-DsDnct9q.js → utils-Cws_jB5L.js} +3 -3
- package/dist/cjs/{utils-DsDnct9q.js.map → utils-Cws_jB5L.js.map} +1 -1
- package/dist/cjs/verdocs-contact-picker.cjs.entry.js +1659 -1199
- package/dist/cjs/verdocs-contact-picker.entry.cjs.js.map +1 -1
- package/dist/cjs/verdocs-download-dialog_4.cjs.entry.js +2 -2
- package/dist/cjs/verdocs-envelope-sidebar.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-envelopes-list.cjs.entry.js +2 -2
- package/dist/cjs/verdocs-field-attachment_11.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-organization-card_2.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-pagination_2.cjs.entry.js +2 -2
- package/dist/cjs/verdocs-preview_6.cjs.entry.js +2 -2
- package/dist/cjs/verdocs-sign.cjs.entry.js +2 -2
- package/dist/cjs/verdocs-signing-progress.cjs.entry.js +2 -2
- package/dist/cjs/verdocs-template-document-page_2.cjs.entry.js +2 -2
- package/dist/cjs/verdocs-templates-list.cjs.entry.js +1 -1
- package/dist/collection/components/controls/verdocs-organization-card/verdocs-organization-card.js +1 -1
- package/dist/components/{p-DPfgYCMd.js → p-BUM3HlaD.js} +3 -3
- package/dist/components/{p-DPfgYCMd.js.map → p-BUM3HlaD.js.map} +1 -1
- package/dist/components/{p-CaoZmlp7.js → p-BZT9jy-7.js} +4 -4
- package/dist/components/{p-CaoZmlp7.js.map → p-BZT9jy-7.js.map} +1 -1
- package/dist/components/{p-B1XBGdC7.js → p-BpbLz33N.js} +5 -5
- package/dist/components/{p-B1XBGdC7.js.map → p-BpbLz33N.js.map} +1 -1
- package/dist/components/{p-BCwx8bsK.js → p-BszQpvWk.js} +3 -3
- package/dist/components/{p-BCwx8bsK.js.map → p-BszQpvWk.js.map} +1 -1
- package/dist/components/{p-DqlhK3CE.js → p-CDSREIen.js} +5 -5
- package/dist/components/{p-DqlhK3CE.js.map → p-CDSREIen.js.map} +1 -1
- package/dist/components/{p-6fSdgmoO.js → p-CIJlsf-4.js} +441 -263
- package/dist/components/p-CIJlsf-4.js.map +1 -0
- package/dist/components/{p-D1TqIILD.js → p-CLFt5iKT.js} +3 -3
- package/dist/components/{p-D1TqIILD.js.map → p-CLFt5iKT.js.map} +1 -1
- package/dist/components/{p-uNqpODUQ.js → p-CfktXSy-.js} +3 -3
- package/dist/components/{p-uNqpODUQ.js.map → p-CfktXSy-.js.map} +1 -1
- package/dist/components/{p-CndV_5Je.js → p-CqJhwGiq.js} +3 -3
- package/dist/components/{p-CndV_5Je.js.map → p-CqJhwGiq.js.map} +1 -1
- package/dist/components/{p-B6tZPSE-.js → p-NpSE9E9W.js} +3 -3
- package/dist/components/{p-B6tZPSE-.js.map → p-NpSE9E9W.js.map} +1 -1
- package/dist/components/{p-EQhWyfg9.js → p-Q1QCVjxH.js} +1660 -1200
- package/dist/components/p-Q1QCVjxH.js.map +1 -0
- package/dist/components/verdocs-build.js +6 -6
- package/dist/components/verdocs-contact-picker.js +1 -1
- package/dist/components/verdocs-envelope-document-page.js +1 -1
- package/dist/components/verdocs-envelope-sidebar.js +1 -1
- package/dist/components/verdocs-envelopes-list.js +2 -2
- package/dist/components/verdocs-field-date.js +1 -1
- package/dist/components/verdocs-organization-card.js +1 -1
- package/dist/components/verdocs-preview.js +1 -1
- package/dist/components/verdocs-quick-filter.js +1 -1
- package/dist/components/verdocs-send.js +1 -1
- package/dist/components/verdocs-sign.js +3 -3
- package/dist/components/verdocs-signing-progress.js +1 -1
- package/dist/components/verdocs-template-document-page.js +1 -1
- package/dist/components/verdocs-template-fields.js +1 -1
- package/dist/components/verdocs-templates-list.js +2 -2
- package/dist/components/verdocs-view.js +1 -1
- package/dist/esm/{index-dzBXqXlK.js → index-BAIpxOBc.js} +441 -263
- package/dist/esm/index-BAIpxOBc.js.map +1 -0
- package/dist/esm/{utils-Bty_rQI7.js → utils-BARodnJ-.js} +3 -3
- package/dist/esm/{utils-Bty_rQI7.js.map → utils-BARodnJ-.js.map} +1 -1
- package/dist/esm/verdocs-contact-picker.entry.js +1659 -1199
- package/dist/esm/verdocs-contact-picker.entry.js.map +1 -1
- package/dist/esm/verdocs-download-dialog_4.entry.js +2 -2
- package/dist/esm/verdocs-envelope-sidebar.entry.js +1 -1
- package/dist/esm/verdocs-envelopes-list.entry.js +2 -2
- package/dist/esm/verdocs-field-attachment_11.entry.js +1 -1
- package/dist/esm/verdocs-organization-card_2.entry.js +1 -1
- package/dist/esm/verdocs-pagination_2.entry.js +2 -2
- package/dist/esm/verdocs-preview_6.entry.js +2 -2
- package/dist/esm/verdocs-sign.entry.js +2 -2
- package/dist/esm/verdocs-signing-progress.entry.js +2 -2
- package/dist/esm/verdocs-template-document-page_2.entry.js +2 -2
- package/dist/esm/verdocs-templates-list.entry.js +1 -1
- package/dist/esm-es5/{index-dzBXqXlK.js → index-BAIpxOBc.js} +1 -1
- package/dist/esm-es5/index-BAIpxOBc.js.map +1 -0
- package/dist/esm-es5/{utils-Bty_rQI7.js → utils-BARodnJ-.js} +2 -2
- package/dist/esm-es5/{utils-Bty_rQI7.js.map → utils-BARodnJ-.js.map} +1 -1
- package/dist/esm-es5/verdocs-contact-picker.entry.js +2 -2
- package/dist/esm-es5/verdocs-contact-picker.entry.js.map +1 -1
- package/dist/esm-es5/verdocs-download-dialog_4.entry.js +1 -1
- package/dist/esm-es5/verdocs-envelope-sidebar.entry.js +1 -1
- package/dist/esm-es5/verdocs-envelopes-list.entry.js +1 -1
- package/dist/esm-es5/verdocs-field-attachment_11.entry.js +1 -1
- package/dist/esm-es5/verdocs-organization-card_2.entry.js +1 -1
- package/dist/esm-es5/verdocs-pagination_2.entry.js +1 -1
- package/dist/esm-es5/verdocs-preview_6.entry.js +1 -1
- package/dist/esm-es5/verdocs-sign.entry.js +1 -1
- package/dist/esm-es5/verdocs-signing-progress.entry.js +1 -1
- package/dist/esm-es5/verdocs-template-document-page_2.entry.js +1 -1
- package/dist/esm-es5/verdocs-templates-list.entry.js +1 -1
- package/dist/verdocs-web-sdk/p-0123c74b.entry.js +2 -0
- package/dist/verdocs-web-sdk/{p-b99e606b.entry.js.map → p-0123c74b.entry.js.map} +1 -1
- package/dist/verdocs-web-sdk/{p-7fa0abc5.system.entry.js → p-0e84941e.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-30ce93f4.entry.js → p-1293f519.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-f79ebbc1.entry.js → p-1abc6703.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-8b80fe24.system.entry.js → p-1dc9071b.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-f02af327.entry.js → p-39aeb4d9.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-3202f0eb.entry.js → p-3d06e25a.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-6dd3761c.system.entry.js → p-49da9aa5.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-609d7eea.entry.js → p-635ab903.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-Fo42OGz9.system.js.map → p-646DanNR.system.js.map} +1 -1
- package/dist/verdocs-web-sdk/{p-90005b19.entry.js → p-6cd3bf28.entry.js} +3 -3
- package/dist/verdocs-web-sdk/{p-2ebc769e.entry.js → p-6d7ef1ae.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-e97ce39e.system.entry.js → p-736d9d6f.system.entry.js} +3 -3
- package/dist/verdocs-web-sdk/{p-0e938b08.system.entry.js → p-73b7432b.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/p-89bc0b8f.entry.js +3 -0
- package/dist/verdocs-web-sdk/p-89bc0b8f.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/{p-83f10fb7.system.entry.js → p-9643d5ea.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-0f6aa428.system.entry.js → p-9730baa6.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-CyHGFYot.system.js.map → p-B2zrDH6t.system.js.map} +1 -1
- package/dist/verdocs-web-sdk/p-B8zpaHu-.system.js +1 -1
- package/dist/verdocs-web-sdk/{p-dzBXqXlK.js → p-BAIpxOBc.js} +1 -1
- package/dist/verdocs-web-sdk/p-BAIpxOBc.js.map +1 -0
- package/dist/verdocs-web-sdk/{p-BkSli2zt.system.js.map → p-BI6jATLL.system.js.map} +1 -1
- package/dist/verdocs-web-sdk/{p-NAwq_U8G.js → p-BdWA0nYY.js} +2 -2
- package/dist/verdocs-web-sdk/{p-NAwq_U8G.js.map → p-BdWA0nYY.js.map} +1 -1
- package/dist/verdocs-web-sdk/{p-DmF0GSqu.system.js → p-C57tUJVh.system.js} +1 -1
- package/dist/verdocs-web-sdk/p-C57tUJVh.system.js.map +1 -0
- package/dist/verdocs-web-sdk/{p-BUFQbxzf.system.js.map → p-CMWEpsaN.system.js.map} +1 -1
- package/dist/verdocs-web-sdk/{p-Cu7Ldm4g.system.js.map → p-DGlgalVg.system.js.map} +1 -1
- package/dist/verdocs-web-sdk/{p-HR08HTpW.system.js.map → p-DQVp8f1P.system.js.map} +1 -1
- package/dist/verdocs-web-sdk/{p-CLSDwNJu.system.js.map → p-DZUqTE-c.system.js.map} +1 -1
- package/dist/verdocs-web-sdk/{p-CnF3etgg.system.js → p-DuZ2r_0x.system.js} +2 -2
- package/dist/verdocs-web-sdk/{p-CnF3etgg.system.js.map → p-DuZ2r_0x.system.js.map} +1 -1
- package/dist/verdocs-web-sdk/{p-CkFoHSeo.system.js.map → p-DwliOfPT.system.js.map} +1 -1
- package/dist/verdocs-web-sdk/p-MnLRiB06.system.js.map +1 -0
- package/dist/verdocs-web-sdk/{p-ffbf5761.system.entry.js → p-a81d0cab.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-76770d9c.entry.js → p-a8280659.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-53530f64.system.entry.js → p-a9b91350.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-6d41df5d.system.entry.js → p-b285f874.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/p-babc150d.system.entry.js +4 -0
- package/dist/verdocs-web-sdk/p-babc150d.system.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/{p-COoeV-vc.system.js.map → p-bi37w16M.system.js.map} +1 -1
- package/dist/verdocs-web-sdk/{p-843c96c6.entry.js → p-c5e04f7b.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-64a68e39.entry.js → p-c9ba1a90.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-e33fd901.system.entry.js → p-f1741f0f.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-yUsULl32.system.js.map → p-ox265pyo.system.js.map} +1 -1
- package/dist/verdocs-web-sdk/{p-CotMN3Ey.system.js.map → p-rab0065u.system.js.map} +1 -1
- package/dist/verdocs-web-sdk/verdocs-contact-picker.entry.esm.js.map +1 -1
- package/dist/verdocs-web-sdk/verdocs-web-sdk.esm.js +1 -1
- package/package.json +4 -4
- package/dist/cjs/index-CeUF44L9.js.map +0 -1
- package/dist/components/p-6fSdgmoO.js.map +0 -1
- package/dist/components/p-EQhWyfg9.js.map +0 -1
- package/dist/esm/index-dzBXqXlK.js.map +0 -1
- package/dist/esm-es5/index-dzBXqXlK.js.map +0 -1
- package/dist/verdocs-web-sdk/p-4a24c445.system.entry.js +0 -4
- package/dist/verdocs-web-sdk/p-4a24c445.system.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-5b00dbf2.entry.js +0 -3
- package/dist/verdocs-web-sdk/p-5b00dbf2.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-Bg14ZSNR.system.js.map +0 -1
- package/dist/verdocs-web-sdk/p-DmF0GSqu.system.js.map +0 -1
- package/dist/verdocs-web-sdk/p-b99e606b.entry.js +0 -2
- package/dist/verdocs-web-sdk/p-dzBXqXlK.js.map +0 -1
- /package/dist/verdocs-web-sdk/{p-7fa0abc5.system.entry.js.map → p-0e84941e.system.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-30ce93f4.entry.js.map → p-1293f519.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-f79ebbc1.entry.js.map → p-1abc6703.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-8b80fe24.system.entry.js.map → p-1dc9071b.system.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-f02af327.entry.js.map → p-39aeb4d9.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-3202f0eb.entry.js.map → p-3d06e25a.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-6dd3761c.system.entry.js.map → p-49da9aa5.system.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-609d7eea.entry.js.map → p-635ab903.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-90005b19.entry.js.map → p-6cd3bf28.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-2ebc769e.entry.js.map → p-6d7ef1ae.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-e97ce39e.system.entry.js.map → p-736d9d6f.system.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-0e938b08.system.entry.js.map → p-73b7432b.system.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-83f10fb7.system.entry.js.map → p-9643d5ea.system.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-0f6aa428.system.entry.js.map → p-9730baa6.system.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-ffbf5761.system.entry.js.map → p-a81d0cab.system.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-76770d9c.entry.js.map → p-a8280659.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-53530f64.system.entry.js.map → p-a9b91350.system.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-6d41df5d.system.entry.js.map → p-b285f874.system.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-843c96c6.entry.js.map → p-c5e04f7b.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-64a68e39.entry.js.map → p-c9ba1a90.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-e33fd901.system.entry.js.map → p-f1741f0f.system.entry.js.map} +0 -0
|
@@ -2,11 +2,11 @@ import { r as registerInstance, c as createEvent, h, F as Fragment } from './ind
|
|
|
2
2
|
import { VerdocsEndpoint, formatFullName, getActiveEntitlements, isValidEmail } from '@verdocs/js-sdk';
|
|
3
3
|
import { c as commonjsGlobal, g as getDefaultExportFromCjs } from './_commonjsHelpers-BFTU3MAI.js';
|
|
4
4
|
import { B as BETA_ORIGINS } from './Environment-C_Xku1v2.js';
|
|
5
|
-
import { f as convertToE164 } from './utils-
|
|
6
|
-
import './index-
|
|
5
|
+
import { f as convertToE164 } from './utils-BARodnJ-.js';
|
|
6
|
+
import './index-BAIpxOBc.js';
|
|
7
7
|
import './Types-BqoC0yeA.js';
|
|
8
8
|
|
|
9
|
-
/*! Axios v1.
|
|
9
|
+
/*! Axios v1.16.1 Copyright (c) 2026 Matt Zabriskie and contributors */
|
|
10
10
|
|
|
11
11
|
var axios_1;
|
|
12
12
|
var hasRequiredAxios;
|
|
@@ -218,9 +218,9 @@ function requireAxios () {
|
|
|
218
218
|
* also have a `name` and `type` attribute to specify filename and content type
|
|
219
219
|
*
|
|
220
220
|
* @see https://github.com/facebook/react-native/blob/26684cf3adf4094eb6c405d345a75bf8c7c0bf88/Libraries/Network/FormData.js#L68-L71
|
|
221
|
-
*
|
|
221
|
+
*
|
|
222
222
|
* @param {*} value The value to test
|
|
223
|
-
*
|
|
223
|
+
*
|
|
224
224
|
* @returns {boolean} True if value is a React Native Blob, otherwise false
|
|
225
225
|
*/
|
|
226
226
|
const isReactNativeBlob = (value) => {
|
|
@@ -230,9 +230,9 @@ function requireAxios () {
|
|
|
230
230
|
/**
|
|
231
231
|
* Determine if environment is React Native
|
|
232
232
|
* ReactNative `FormData` has a non-standard `getParts()` method
|
|
233
|
-
*
|
|
233
|
+
*
|
|
234
234
|
* @param {*} formData The formData to test
|
|
235
|
-
*
|
|
235
|
+
*
|
|
236
236
|
* @returns {boolean} True if environment is React Native, otherwise false
|
|
237
237
|
*/
|
|
238
238
|
const isReactNative = (formData) => formData && typeof formData.getParts !== 'undefined';
|
|
@@ -251,7 +251,7 @@ function requireAxios () {
|
|
|
251
251
|
*
|
|
252
252
|
* @param {*} val The value to test
|
|
253
253
|
*
|
|
254
|
-
* @returns {boolean} True if value is a
|
|
254
|
+
* @returns {boolean} True if value is a FileList, otherwise false
|
|
255
255
|
*/
|
|
256
256
|
const isFileList = kindOfTest('FileList');
|
|
257
257
|
|
|
@@ -283,15 +283,17 @@ function requireAxios () {
|
|
|
283
283
|
const FormDataCtor = typeof G.FormData !== 'undefined' ? G.FormData : undefined;
|
|
284
284
|
|
|
285
285
|
const isFormData = (thing) => {
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
286
|
+
if (!thing) return false;
|
|
287
|
+
if (FormDataCtor && thing instanceof FormDataCtor) return true;
|
|
288
|
+
// Reject plain objects inheriting directly from Object.prototype so prototype-pollution gadgets can't spoof FormData.
|
|
289
|
+
const proto = getPrototypeOf(thing);
|
|
290
|
+
if (!proto || proto === Object.prototype) return false;
|
|
291
|
+
if (!isFunction$1(thing.append)) return false;
|
|
292
|
+
const kind = kindOf(thing);
|
|
293
|
+
return (
|
|
294
|
+
kind === 'formdata' ||
|
|
295
|
+
// detect form-data instance
|
|
296
|
+
(kind === 'object' && isFunction$1(thing.toString) && thing.toString() === '[object FormData]')
|
|
295
297
|
);
|
|
296
298
|
};
|
|
297
299
|
|
|
@@ -427,7 +429,7 @@ function requireAxios () {
|
|
|
427
429
|
*
|
|
428
430
|
* @returns {Object} Result of all merge properties
|
|
429
431
|
*/
|
|
430
|
-
function merge(
|
|
432
|
+
function merge(...objs) {
|
|
431
433
|
const { caseless, skipUndefined } = (isContextDefined(this) && this) || {};
|
|
432
434
|
const result = {};
|
|
433
435
|
const assignValue = (val, key) => {
|
|
@@ -437,8 +439,12 @@ function requireAxios () {
|
|
|
437
439
|
}
|
|
438
440
|
|
|
439
441
|
const targetKey = (caseless && findKey(result, key)) || key;
|
|
440
|
-
|
|
441
|
-
|
|
442
|
+
// Read via own-prop only — a bare `result[targetKey]` walks the prototype
|
|
443
|
+
// chain, so a polluted Object.prototype value could surface here and get
|
|
444
|
+
// copied into the merged result.
|
|
445
|
+
const existing = hasOwnProperty(result, targetKey) ? result[targetKey] : undefined;
|
|
446
|
+
if (isPlainObject(existing) && isPlainObject(val)) {
|
|
447
|
+
result[targetKey] = merge(existing, val);
|
|
442
448
|
} else if (isPlainObject(val)) {
|
|
443
449
|
result[targetKey] = merge({}, val);
|
|
444
450
|
} else if (isArray(val)) {
|
|
@@ -448,8 +454,8 @@ function requireAxios () {
|
|
|
448
454
|
}
|
|
449
455
|
};
|
|
450
456
|
|
|
451
|
-
for (let i = 0, l =
|
|
452
|
-
|
|
457
|
+
for (let i = 0, l = objs.length; i < l; i++) {
|
|
458
|
+
objs[i] && forEach(objs[i], assignValue);
|
|
453
459
|
}
|
|
454
460
|
return result;
|
|
455
461
|
}
|
|
@@ -471,6 +477,9 @@ function requireAxios () {
|
|
|
471
477
|
(val, key) => {
|
|
472
478
|
if (thisArg && isFunction$1(val)) {
|
|
473
479
|
Object.defineProperty(a, key, {
|
|
480
|
+
// Null-proto descriptor so a polluted Object.prototype.get cannot
|
|
481
|
+
// hijack defineProperty's accessor-vs-data resolution.
|
|
482
|
+
__proto__: null,
|
|
474
483
|
value: bind(val, thisArg),
|
|
475
484
|
writable: true,
|
|
476
485
|
enumerable: true,
|
|
@@ -478,6 +487,7 @@ function requireAxios () {
|
|
|
478
487
|
});
|
|
479
488
|
} else {
|
|
480
489
|
Object.defineProperty(a, key, {
|
|
490
|
+
__proto__: null,
|
|
481
491
|
value: val,
|
|
482
492
|
writable: true,
|
|
483
493
|
enumerable: true,
|
|
@@ -516,12 +526,14 @@ function requireAxios () {
|
|
|
516
526
|
const inherits = (constructor, superConstructor, props, descriptors) => {
|
|
517
527
|
constructor.prototype = Object.create(superConstructor.prototype, descriptors);
|
|
518
528
|
Object.defineProperty(constructor.prototype, 'constructor', {
|
|
529
|
+
__proto__: null,
|
|
519
530
|
value: constructor,
|
|
520
531
|
writable: true,
|
|
521
532
|
enumerable: false,
|
|
522
533
|
configurable: true,
|
|
523
534
|
});
|
|
524
535
|
Object.defineProperty(constructor, 'super', {
|
|
536
|
+
__proto__: null,
|
|
525
537
|
value: superConstructor.prototype,
|
|
526
538
|
});
|
|
527
539
|
props && Object.assign(constructor.prototype, props);
|
|
@@ -703,7 +715,7 @@ function requireAxios () {
|
|
|
703
715
|
const freezeMethods = (obj) => {
|
|
704
716
|
reduceDescriptors(obj, (descriptor, name) => {
|
|
705
717
|
// skip restricted props in strict mode
|
|
706
|
-
if (isFunction$1(obj) && ['arguments', 'caller', 'callee'].
|
|
718
|
+
if (isFunction$1(obj) && ['arguments', 'caller', 'callee'].includes(name)) {
|
|
707
719
|
return false;
|
|
708
720
|
}
|
|
709
721
|
|
|
@@ -777,11 +789,11 @@ function requireAxios () {
|
|
|
777
789
|
* @returns {Object} The JSON-compatible object.
|
|
778
790
|
*/
|
|
779
791
|
const toJSONObject = (obj) => {
|
|
780
|
-
const
|
|
792
|
+
const visited = new WeakSet();
|
|
781
793
|
|
|
782
|
-
const visit = (source
|
|
794
|
+
const visit = (source) => {
|
|
783
795
|
if (isObject(source)) {
|
|
784
|
-
if (
|
|
796
|
+
if (visited.has(source)) {
|
|
785
797
|
return;
|
|
786
798
|
}
|
|
787
799
|
|
|
@@ -791,15 +803,16 @@ function requireAxios () {
|
|
|
791
803
|
}
|
|
792
804
|
|
|
793
805
|
if (!('toJSON' in source)) {
|
|
794
|
-
|
|
806
|
+
// add-on descent / delete-on-ascent: preserves path semantics, so DAG nodes serialise at every occurrence (see #7230).
|
|
807
|
+
visited.add(source);
|
|
795
808
|
const target = isArray(source) ? [] : {};
|
|
796
809
|
|
|
797
810
|
forEach(source, (value, key) => {
|
|
798
|
-
const reducedValue = visit(value
|
|
811
|
+
const reducedValue = visit(value);
|
|
799
812
|
!isUndefined(reducedValue) && (target[key] = reducedValue);
|
|
800
813
|
});
|
|
801
814
|
|
|
802
|
-
|
|
815
|
+
visited.delete(source);
|
|
803
816
|
|
|
804
817
|
return target;
|
|
805
818
|
}
|
|
@@ -808,7 +821,7 @@ function requireAxios () {
|
|
|
808
821
|
return source;
|
|
809
822
|
};
|
|
810
823
|
|
|
811
|
-
return visit(obj
|
|
824
|
+
return visit(obj);
|
|
812
825
|
};
|
|
813
826
|
|
|
814
827
|
/**
|
|
@@ -944,1297 +957,1422 @@ function requireAxios () {
|
|
|
944
957
|
isIterable,
|
|
945
958
|
};
|
|
946
959
|
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
960
|
+
// RawAxiosHeaders whose duplicates are ignored by node
|
|
961
|
+
// c.f. https://nodejs.org/api/http.html#http_message_headers
|
|
962
|
+
const ignoreDuplicateOf = utils$1.toObjectSet([
|
|
963
|
+
'age',
|
|
964
|
+
'authorization',
|
|
965
|
+
'content-length',
|
|
966
|
+
'content-type',
|
|
967
|
+
'etag',
|
|
968
|
+
'expires',
|
|
969
|
+
'from',
|
|
970
|
+
'host',
|
|
971
|
+
'if-modified-since',
|
|
972
|
+
'if-unmodified-since',
|
|
973
|
+
'last-modified',
|
|
974
|
+
'location',
|
|
975
|
+
'max-forwards',
|
|
976
|
+
'proxy-authorization',
|
|
977
|
+
'referer',
|
|
978
|
+
'retry-after',
|
|
979
|
+
'user-agent',
|
|
980
|
+
]);
|
|
952
981
|
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
982
|
+
/**
|
|
983
|
+
* Parse headers into an object
|
|
984
|
+
*
|
|
985
|
+
* ```
|
|
986
|
+
* Date: Wed, 27 Aug 2014 08:58:49 GMT
|
|
987
|
+
* Content-Type: application/json
|
|
988
|
+
* Connection: keep-alive
|
|
989
|
+
* Transfer-Encoding: chunked
|
|
990
|
+
* ```
|
|
991
|
+
*
|
|
992
|
+
* @param {String} rawHeaders Headers needing to be parsed
|
|
993
|
+
*
|
|
994
|
+
* @returns {Object} Headers parsed into an object
|
|
995
|
+
*/
|
|
996
|
+
var parseHeaders = (rawHeaders) => {
|
|
997
|
+
const parsed = {};
|
|
998
|
+
let key;
|
|
999
|
+
let val;
|
|
1000
|
+
let i;
|
|
1001
|
+
|
|
1002
|
+
rawHeaders &&
|
|
1003
|
+
rawHeaders.split('\n').forEach(function parser(line) {
|
|
1004
|
+
i = line.indexOf(':');
|
|
1005
|
+
key = line.substring(0, i).trim().toLowerCase();
|
|
1006
|
+
val = line.substring(i + 1).trim();
|
|
1007
|
+
|
|
1008
|
+
if (!key || (parsed[key] && ignoreDuplicateOf[key])) {
|
|
1009
|
+
return;
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
if (key === 'set-cookie') {
|
|
1013
|
+
if (parsed[key]) {
|
|
1014
|
+
parsed[key].push(val);
|
|
1015
|
+
} else {
|
|
1016
|
+
parsed[key] = [val];
|
|
1017
|
+
}
|
|
1018
|
+
} else {
|
|
1019
|
+
parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
|
|
1020
|
+
}
|
|
1021
|
+
});
|
|
1022
|
+
|
|
1023
|
+
return parsed;
|
|
1024
|
+
};
|
|
1025
|
+
|
|
1026
|
+
function trimSPorHTAB(str) {
|
|
1027
|
+
let start = 0;
|
|
1028
|
+
let end = str.length;
|
|
1029
|
+
|
|
1030
|
+
while (start < end) {
|
|
1031
|
+
const code = str.charCodeAt(start);
|
|
1032
|
+
|
|
1033
|
+
if (code !== 0x09 && code !== 0x20) {
|
|
1034
|
+
break;
|
|
956
1035
|
}
|
|
957
1036
|
|
|
958
|
-
|
|
959
|
-
return axiosError;
|
|
1037
|
+
start += 1;
|
|
960
1038
|
}
|
|
961
1039
|
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
* @param {Object} [config] The config.
|
|
968
|
-
* @param {Object} [request] The request.
|
|
969
|
-
* @param {Object} [response] The response.
|
|
970
|
-
*
|
|
971
|
-
* @returns {Error} The created error.
|
|
972
|
-
*/
|
|
973
|
-
constructor(message, code, config, request, response) {
|
|
974
|
-
super(message);
|
|
975
|
-
|
|
976
|
-
// Make message enumerable to maintain backward compatibility
|
|
977
|
-
// The native Error constructor sets message as non-enumerable,
|
|
978
|
-
// but axios < v1.13.3 had it as enumerable
|
|
979
|
-
Object.defineProperty(this, 'message', {
|
|
980
|
-
value: message,
|
|
981
|
-
enumerable: true,
|
|
982
|
-
writable: true,
|
|
983
|
-
configurable: true
|
|
984
|
-
});
|
|
985
|
-
|
|
986
|
-
this.name = 'AxiosError';
|
|
987
|
-
this.isAxiosError = true;
|
|
988
|
-
code && (this.code = code);
|
|
989
|
-
config && (this.config = config);
|
|
990
|
-
request && (this.request = request);
|
|
991
|
-
if (response) {
|
|
992
|
-
this.response = response;
|
|
993
|
-
this.status = response.status;
|
|
994
|
-
}
|
|
1040
|
+
while (end > start) {
|
|
1041
|
+
const code = str.charCodeAt(end - 1);
|
|
1042
|
+
|
|
1043
|
+
if (code !== 0x09 && code !== 0x20) {
|
|
1044
|
+
break;
|
|
995
1045
|
}
|
|
996
1046
|
|
|
997
|
-
|
|
998
|
-
return {
|
|
999
|
-
// Standard
|
|
1000
|
-
message: this.message,
|
|
1001
|
-
name: this.name,
|
|
1002
|
-
// Microsoft
|
|
1003
|
-
description: this.description,
|
|
1004
|
-
number: this.number,
|
|
1005
|
-
// Mozilla
|
|
1006
|
-
fileName: this.fileName,
|
|
1007
|
-
lineNumber: this.lineNumber,
|
|
1008
|
-
columnNumber: this.columnNumber,
|
|
1009
|
-
stack: this.stack,
|
|
1010
|
-
// Axios
|
|
1011
|
-
config: utils$1.toJSONObject(this.config),
|
|
1012
|
-
code: this.code,
|
|
1013
|
-
status: this.status,
|
|
1014
|
-
};
|
|
1047
|
+
end -= 1;
|
|
1015
1048
|
}
|
|
1049
|
+
|
|
1050
|
+
return start === 0 && end === str.length ? str : str.slice(start, end);
|
|
1016
1051
|
}
|
|
1017
1052
|
|
|
1018
|
-
//
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
AxiosError.ERR_NETWORK = 'ERR_NETWORK';
|
|
1024
|
-
AxiosError.ERR_FR_TOO_MANY_REDIRECTS = 'ERR_FR_TOO_MANY_REDIRECTS';
|
|
1025
|
-
AxiosError.ERR_DEPRECATED = 'ERR_DEPRECATED';
|
|
1026
|
-
AxiosError.ERR_BAD_RESPONSE = 'ERR_BAD_RESPONSE';
|
|
1027
|
-
AxiosError.ERR_BAD_REQUEST = 'ERR_BAD_REQUEST';
|
|
1028
|
-
AxiosError.ERR_CANCELED = 'ERR_CANCELED';
|
|
1029
|
-
AxiosError.ERR_NOT_SUPPORT = 'ERR_NOT_SUPPORT';
|
|
1030
|
-
AxiosError.ERR_INVALID_URL = 'ERR_INVALID_URL';
|
|
1053
|
+
// The control-code ranges are intentional: header sanitization strips C0/DEL bytes.
|
|
1054
|
+
// eslint-disable-next-line no-control-regex
|
|
1055
|
+
const INVALID_UNICODE_HEADER_VALUE_CHARS = new RegExp('[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+', 'g');
|
|
1056
|
+
// eslint-disable-next-line no-control-regex
|
|
1057
|
+
const INVALID_BYTE_STRING_HEADER_VALUE_CHARS = new RegExp('[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+', 'g');
|
|
1031
1058
|
|
|
1032
|
-
|
|
1033
|
-
|
|
1059
|
+
function sanitizeValue(value, invalidChars) {
|
|
1060
|
+
if (utils$1.isArray(value)) {
|
|
1061
|
+
return value.map((item) => sanitizeValue(item, invalidChars));
|
|
1062
|
+
}
|
|
1034
1063
|
|
|
1035
|
-
|
|
1036
|
-
* Determines if the given thing is a array or js object.
|
|
1037
|
-
*
|
|
1038
|
-
* @param {string} thing - The object or array to be visited.
|
|
1039
|
-
*
|
|
1040
|
-
* @returns {boolean}
|
|
1041
|
-
*/
|
|
1042
|
-
function isVisitable(thing) {
|
|
1043
|
-
return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
|
|
1064
|
+
return trimSPorHTAB(String(value).replace(invalidChars, ''));
|
|
1044
1065
|
}
|
|
1045
1066
|
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
*
|
|
1049
|
-
* @param {string} key - The key of the parameter.
|
|
1050
|
-
*
|
|
1051
|
-
* @returns {string} the key without the brackets.
|
|
1052
|
-
*/
|
|
1053
|
-
function removeBrackets(key) {
|
|
1054
|
-
return utils$1.endsWith(key, '[]') ? key.slice(0, -2) : key;
|
|
1055
|
-
}
|
|
1067
|
+
const sanitizeHeaderValue = (value) =>
|
|
1068
|
+
sanitizeValue(value, INVALID_UNICODE_HEADER_VALUE_CHARS);
|
|
1056
1069
|
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
*
|
|
1060
|
-
* @param {string} path - The path to the current key.
|
|
1061
|
-
* @param {string} key - The key of the current object being iterated over.
|
|
1062
|
-
* @param {string} dots - If true, the key will be rendered with dots instead of brackets.
|
|
1063
|
-
*
|
|
1064
|
-
* @returns {string} The path to the current key.
|
|
1065
|
-
*/
|
|
1066
|
-
function renderKey(path, key, dots) {
|
|
1067
|
-
if (!path) return key;
|
|
1068
|
-
return path
|
|
1069
|
-
.concat(key)
|
|
1070
|
-
.map(function each(token, i) {
|
|
1071
|
-
// eslint-disable-next-line no-param-reassign
|
|
1072
|
-
token = removeBrackets(token);
|
|
1073
|
-
return !dots && i ? '[' + token + ']' : token;
|
|
1074
|
-
})
|
|
1075
|
-
.join(dots ? '.' : '');
|
|
1076
|
-
}
|
|
1070
|
+
const sanitizeByteStringHeaderValue = (value) =>
|
|
1071
|
+
sanitizeValue(value, INVALID_BYTE_STRING_HEADER_VALUE_CHARS);
|
|
1077
1072
|
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
return utils$1.isArray(arr) && !arr.some(isVisitable);
|
|
1073
|
+
function toByteStringHeaderObject(headers) {
|
|
1074
|
+
const byteStringHeaders = Object.create(null);
|
|
1075
|
+
|
|
1076
|
+
utils$1.forEach(headers.toJSON(), (value, header) => {
|
|
1077
|
+
byteStringHeaders[header] = sanitizeByteStringHeaderValue(value);
|
|
1078
|
+
});
|
|
1079
|
+
|
|
1080
|
+
return byteStringHeaders;
|
|
1087
1081
|
}
|
|
1088
1082
|
|
|
1089
|
-
const
|
|
1090
|
-
return /^is[A-Z]/.test(prop);
|
|
1091
|
-
});
|
|
1083
|
+
const $internals = Symbol('internals');
|
|
1092
1084
|
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
* @param {Object} obj
|
|
1097
|
-
* @param {?Object} [formData]
|
|
1098
|
-
* @param {?Object} [options]
|
|
1099
|
-
* @param {Function} [options.visitor]
|
|
1100
|
-
* @param {Boolean} [options.metaTokens = true]
|
|
1101
|
-
* @param {Boolean} [options.dots = false]
|
|
1102
|
-
* @param {?Boolean} [options.indexes = false]
|
|
1103
|
-
*
|
|
1104
|
-
* @returns {Object}
|
|
1105
|
-
**/
|
|
1085
|
+
function normalizeHeader(header) {
|
|
1086
|
+
return header && String(header).trim().toLowerCase();
|
|
1087
|
+
}
|
|
1106
1088
|
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
* @param {Object<any, any>} obj - The object to convert to form data.
|
|
1111
|
-
* @param {string} formData - The FormData object to append to.
|
|
1112
|
-
* @param {Object<string, any>} options
|
|
1113
|
-
*
|
|
1114
|
-
* @returns
|
|
1115
|
-
*/
|
|
1116
|
-
function toFormData(obj, formData, options) {
|
|
1117
|
-
if (!utils$1.isObject(obj)) {
|
|
1118
|
-
throw new TypeError('target must be an object');
|
|
1089
|
+
function normalizeValue(value) {
|
|
1090
|
+
if (value === false || value == null) {
|
|
1091
|
+
return value;
|
|
1119
1092
|
}
|
|
1120
1093
|
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
// eslint-disable-next-line no-param-reassign
|
|
1125
|
-
options = utils$1.toFlatObject(
|
|
1126
|
-
options,
|
|
1127
|
-
{
|
|
1128
|
-
metaTokens: true,
|
|
1129
|
-
dots: false,
|
|
1130
|
-
indexes: false,
|
|
1131
|
-
},
|
|
1132
|
-
false,
|
|
1133
|
-
function defined(option, source) {
|
|
1134
|
-
// eslint-disable-next-line no-eq-null,eqeqeq
|
|
1135
|
-
return !utils$1.isUndefined(source[option]);
|
|
1136
|
-
}
|
|
1137
|
-
);
|
|
1094
|
+
return utils$1.isArray(value) ? value.map(normalizeValue) : sanitizeHeaderValue(String(value));
|
|
1095
|
+
}
|
|
1138
1096
|
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
const
|
|
1142
|
-
|
|
1143
|
-
const indexes = options.indexes;
|
|
1144
|
-
const _Blob = options.Blob || (typeof Blob !== 'undefined' && Blob);
|
|
1145
|
-
const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
|
|
1097
|
+
function parseTokens(str) {
|
|
1098
|
+
const tokens = Object.create(null);
|
|
1099
|
+
const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
|
|
1100
|
+
let match;
|
|
1146
1101
|
|
|
1147
|
-
|
|
1148
|
-
|
|
1102
|
+
while ((match = tokensRE.exec(str))) {
|
|
1103
|
+
tokens[match[1]] = match[2];
|
|
1149
1104
|
}
|
|
1150
1105
|
|
|
1151
|
-
|
|
1152
|
-
|
|
1106
|
+
return tokens;
|
|
1107
|
+
}
|
|
1153
1108
|
|
|
1154
|
-
|
|
1155
|
-
return value.toISOString();
|
|
1156
|
-
}
|
|
1109
|
+
const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
|
|
1157
1110
|
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
if (!useBlob && utils$1.isBlob(value)) {
|
|
1163
|
-
throw new AxiosError('Blob is not supported. Use a Buffer instead.');
|
|
1164
|
-
}
|
|
1165
|
-
|
|
1166
|
-
if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
|
|
1167
|
-
return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
|
|
1168
|
-
}
|
|
1111
|
+
function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
|
|
1112
|
+
if (utils$1.isFunction(filter)) {
|
|
1113
|
+
return filter.call(this, value, header);
|
|
1114
|
+
}
|
|
1169
1115
|
|
|
1170
|
-
|
|
1116
|
+
if (isHeaderNameFilter) {
|
|
1117
|
+
value = header;
|
|
1171
1118
|
}
|
|
1172
1119
|
|
|
1173
|
-
|
|
1174
|
-
* Default visitor.
|
|
1175
|
-
*
|
|
1176
|
-
* @param {*} value
|
|
1177
|
-
* @param {String|Number} key
|
|
1178
|
-
* @param {Array<String|Number>} path
|
|
1179
|
-
* @this {FormData}
|
|
1180
|
-
*
|
|
1181
|
-
* @returns {boolean} return true to visit the each prop of the value recursively
|
|
1182
|
-
*/
|
|
1183
|
-
function defaultVisitor(value, key, path) {
|
|
1184
|
-
let arr = value;
|
|
1120
|
+
if (!utils$1.isString(value)) return;
|
|
1185
1121
|
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
}
|
|
1122
|
+
if (utils$1.isString(filter)) {
|
|
1123
|
+
return value.indexOf(filter) !== -1;
|
|
1124
|
+
}
|
|
1190
1125
|
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
// eslint-disable-next-line no-param-reassign
|
|
1196
|
-
value = JSON.stringify(value);
|
|
1197
|
-
} else if (
|
|
1198
|
-
(utils$1.isArray(value) && isFlatArray(value)) ||
|
|
1199
|
-
((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value)))
|
|
1200
|
-
) {
|
|
1201
|
-
// eslint-disable-next-line no-param-reassign
|
|
1202
|
-
key = removeBrackets(key);
|
|
1126
|
+
if (utils$1.isRegExp(filter)) {
|
|
1127
|
+
return filter.test(value);
|
|
1128
|
+
}
|
|
1129
|
+
}
|
|
1203
1130
|
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
: key + '[]',
|
|
1213
|
-
convertValue(el)
|
|
1214
|
-
);
|
|
1215
|
-
});
|
|
1216
|
-
return false;
|
|
1217
|
-
}
|
|
1218
|
-
}
|
|
1131
|
+
function formatHeader(header) {
|
|
1132
|
+
return header
|
|
1133
|
+
.trim()
|
|
1134
|
+
.toLowerCase()
|
|
1135
|
+
.replace(/([a-z\d])(\w*)/g, (w, char, str) => {
|
|
1136
|
+
return char.toUpperCase() + str;
|
|
1137
|
+
});
|
|
1138
|
+
}
|
|
1219
1139
|
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
}
|
|
1140
|
+
function buildAccessors(obj, header) {
|
|
1141
|
+
const accessorName = utils$1.toCamelCase(' ' + header);
|
|
1223
1142
|
|
|
1224
|
-
|
|
1143
|
+
['get', 'set', 'has'].forEach((methodName) => {
|
|
1144
|
+
Object.defineProperty(obj, methodName + accessorName, {
|
|
1145
|
+
// Null-proto descriptor so a polluted Object.prototype.get cannot turn
|
|
1146
|
+
// this data descriptor into an accessor descriptor on the way in.
|
|
1147
|
+
__proto__: null,
|
|
1148
|
+
value: function (arg1, arg2, arg3) {
|
|
1149
|
+
return this[methodName].call(this, header, arg1, arg2, arg3);
|
|
1150
|
+
},
|
|
1151
|
+
configurable: true,
|
|
1152
|
+
});
|
|
1153
|
+
});
|
|
1154
|
+
}
|
|
1225
1155
|
|
|
1226
|
-
|
|
1156
|
+
class AxiosHeaders {
|
|
1157
|
+
constructor(headers) {
|
|
1158
|
+
headers && this.set(headers);
|
|
1227
1159
|
}
|
|
1228
1160
|
|
|
1229
|
-
|
|
1161
|
+
set(header, valueOrRewrite, rewrite) {
|
|
1162
|
+
const self = this;
|
|
1230
1163
|
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
convertValue,
|
|
1234
|
-
isVisitable,
|
|
1235
|
-
});
|
|
1164
|
+
function setHeader(_value, _header, _rewrite) {
|
|
1165
|
+
const lHeader = normalizeHeader(_header);
|
|
1236
1166
|
|
|
1237
|
-
|
|
1238
|
-
|
|
1167
|
+
if (!lHeader) {
|
|
1168
|
+
throw new Error('header name must be a non-empty string');
|
|
1169
|
+
}
|
|
1239
1170
|
|
|
1240
|
-
|
|
1241
|
-
|
|
1171
|
+
const key = utils$1.findKey(self, lHeader);
|
|
1172
|
+
|
|
1173
|
+
if (
|
|
1174
|
+
!key ||
|
|
1175
|
+
self[key] === undefined ||
|
|
1176
|
+
_rewrite === true ||
|
|
1177
|
+
(_rewrite === undefined && self[key] !== false)
|
|
1178
|
+
) {
|
|
1179
|
+
self[key || _header] = normalizeValue(_value);
|
|
1180
|
+
}
|
|
1242
1181
|
}
|
|
1243
1182
|
|
|
1244
|
-
|
|
1183
|
+
const setHeaders = (headers, _rewrite) =>
|
|
1184
|
+
utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
|
|
1245
1185
|
|
|
1246
|
-
utils$1.
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1186
|
+
if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
|
|
1187
|
+
setHeaders(header, valueOrRewrite);
|
|
1188
|
+
} else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
|
|
1189
|
+
setHeaders(parseHeaders(header), valueOrRewrite);
|
|
1190
|
+
} else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
|
|
1191
|
+
let obj = {},
|
|
1192
|
+
dest,
|
|
1193
|
+
key;
|
|
1194
|
+
for (const entry of header) {
|
|
1195
|
+
if (!utils$1.isArray(entry)) {
|
|
1196
|
+
throw TypeError('Object iterator must return a key-value pair');
|
|
1197
|
+
}
|
|
1250
1198
|
|
|
1251
|
-
|
|
1252
|
-
|
|
1199
|
+
obj[(key = entry[0])] = (dest = obj[key])
|
|
1200
|
+
? utils$1.isArray(dest)
|
|
1201
|
+
? [...dest, entry[1]]
|
|
1202
|
+
: [dest, entry[1]]
|
|
1203
|
+
: entry[1];
|
|
1253
1204
|
}
|
|
1254
|
-
});
|
|
1255
1205
|
|
|
1256
|
-
|
|
1257
|
-
|
|
1206
|
+
setHeaders(obj, valueOrRewrite);
|
|
1207
|
+
} else {
|
|
1208
|
+
header != null && setHeader(valueOrRewrite, header, rewrite);
|
|
1209
|
+
}
|
|
1258
1210
|
|
|
1259
|
-
|
|
1260
|
-
throw new TypeError('data must be an object');
|
|
1211
|
+
return this;
|
|
1261
1212
|
}
|
|
1262
1213
|
|
|
1263
|
-
|
|
1214
|
+
get(header, parser) {
|
|
1215
|
+
header = normalizeHeader(header);
|
|
1264
1216
|
|
|
1265
|
-
|
|
1266
|
-
|
|
1217
|
+
if (header) {
|
|
1218
|
+
const key = utils$1.findKey(this, header);
|
|
1267
1219
|
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
* their percent-encoded equivalents
|
|
1271
|
-
*
|
|
1272
|
-
* @param {string} str - The string to encode.
|
|
1273
|
-
*
|
|
1274
|
-
* @returns {string} The encoded string.
|
|
1275
|
-
*/
|
|
1276
|
-
function encode$1(str) {
|
|
1277
|
-
const charMap = {
|
|
1278
|
-
'!': '%21',
|
|
1279
|
-
"'": '%27',
|
|
1280
|
-
'(': '%28',
|
|
1281
|
-
')': '%29',
|
|
1282
|
-
'~': '%7E',
|
|
1283
|
-
'%20': '+',
|
|
1284
|
-
'%00': '\x00',
|
|
1285
|
-
};
|
|
1286
|
-
return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
|
|
1287
|
-
return charMap[match];
|
|
1288
|
-
});
|
|
1289
|
-
}
|
|
1220
|
+
if (key) {
|
|
1221
|
+
const value = this[key];
|
|
1290
1222
|
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
* @param {Object<string, any>} params - The parameters to be converted to a FormData object.
|
|
1295
|
-
* @param {Object<string, any>} options - The options object passed to the Axios constructor.
|
|
1296
|
-
*
|
|
1297
|
-
* @returns {void}
|
|
1298
|
-
*/
|
|
1299
|
-
function AxiosURLSearchParams(params, options) {
|
|
1300
|
-
this._pairs = [];
|
|
1223
|
+
if (!parser) {
|
|
1224
|
+
return value;
|
|
1225
|
+
}
|
|
1301
1226
|
|
|
1302
|
-
|
|
1303
|
-
|
|
1227
|
+
if (parser === true) {
|
|
1228
|
+
return parseTokens(value);
|
|
1229
|
+
}
|
|
1304
1230
|
|
|
1305
|
-
|
|
1231
|
+
if (utils$1.isFunction(parser)) {
|
|
1232
|
+
return parser.call(this, value, key);
|
|
1233
|
+
}
|
|
1306
1234
|
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1235
|
+
if (utils$1.isRegExp(parser)) {
|
|
1236
|
+
return parser.exec(value);
|
|
1237
|
+
}
|
|
1310
1238
|
|
|
1311
|
-
|
|
1312
|
-
const _encode = encoder
|
|
1313
|
-
? function (value) {
|
|
1314
|
-
return encoder.call(this, value, encode$1);
|
|
1239
|
+
throw new TypeError('parser must be boolean|regexp|function');
|
|
1315
1240
|
}
|
|
1316
|
-
|
|
1241
|
+
}
|
|
1242
|
+
}
|
|
1317
1243
|
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
return _encode(pair[0]) + '=' + _encode(pair[1]);
|
|
1321
|
-
}, '')
|
|
1322
|
-
.join('&');
|
|
1323
|
-
};
|
|
1244
|
+
has(header, matcher) {
|
|
1245
|
+
header = normalizeHeader(header);
|
|
1324
1246
|
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
* their plain counterparts (`:`, `$`, `,`, `+`).
|
|
1328
|
-
*
|
|
1329
|
-
* @param {string} val The value to be encoded.
|
|
1330
|
-
*
|
|
1331
|
-
* @returns {string} The encoded value.
|
|
1332
|
-
*/
|
|
1333
|
-
function encode(val) {
|
|
1334
|
-
return encodeURIComponent(val)
|
|
1335
|
-
.replace(/%3A/gi, ':')
|
|
1336
|
-
.replace(/%24/g, '$')
|
|
1337
|
-
.replace(/%2C/gi, ',')
|
|
1338
|
-
.replace(/%20/g, '+');
|
|
1339
|
-
}
|
|
1247
|
+
if (header) {
|
|
1248
|
+
const key = utils$1.findKey(this, header);
|
|
1340
1249
|
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
*/
|
|
1350
|
-
function buildURL(url, params, options) {
|
|
1351
|
-
if (!params) {
|
|
1352
|
-
return url;
|
|
1250
|
+
return !!(
|
|
1251
|
+
key &&
|
|
1252
|
+
this[key] !== undefined &&
|
|
1253
|
+
(!matcher || matchHeaderValue(this, this[key], key, matcher))
|
|
1254
|
+
);
|
|
1255
|
+
}
|
|
1256
|
+
|
|
1257
|
+
return false;
|
|
1353
1258
|
}
|
|
1354
1259
|
|
|
1355
|
-
|
|
1260
|
+
delete(header, matcher) {
|
|
1261
|
+
const self = this;
|
|
1262
|
+
let deleted = false;
|
|
1356
1263
|
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
serialize: options,
|
|
1360
|
-
}
|
|
1361
|
-
: options;
|
|
1264
|
+
function deleteHeader(_header) {
|
|
1265
|
+
_header = normalizeHeader(_header);
|
|
1362
1266
|
|
|
1363
|
-
|
|
1267
|
+
if (_header) {
|
|
1268
|
+
const key = utils$1.findKey(self, _header);
|
|
1364
1269
|
|
|
1365
|
-
|
|
1270
|
+
if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
|
|
1271
|
+
delete self[key];
|
|
1366
1272
|
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1273
|
+
deleted = true;
|
|
1274
|
+
}
|
|
1275
|
+
}
|
|
1276
|
+
}
|
|
1277
|
+
|
|
1278
|
+
if (utils$1.isArray(header)) {
|
|
1279
|
+
header.forEach(deleteHeader);
|
|
1280
|
+
} else {
|
|
1281
|
+
deleteHeader(header);
|
|
1282
|
+
}
|
|
1283
|
+
|
|
1284
|
+
return deleted;
|
|
1373
1285
|
}
|
|
1374
1286
|
|
|
1375
|
-
|
|
1376
|
-
const
|
|
1287
|
+
clear(matcher) {
|
|
1288
|
+
const keys = Object.keys(this);
|
|
1289
|
+
let i = keys.length;
|
|
1290
|
+
let deleted = false;
|
|
1377
1291
|
|
|
1378
|
-
|
|
1379
|
-
|
|
1292
|
+
while (i--) {
|
|
1293
|
+
const key = keys[i];
|
|
1294
|
+
if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
|
|
1295
|
+
delete this[key];
|
|
1296
|
+
deleted = true;
|
|
1297
|
+
}
|
|
1380
1298
|
}
|
|
1381
|
-
|
|
1299
|
+
|
|
1300
|
+
return deleted;
|
|
1382
1301
|
}
|
|
1383
1302
|
|
|
1384
|
-
|
|
1385
|
-
|
|
1303
|
+
normalize(format) {
|
|
1304
|
+
const self = this;
|
|
1305
|
+
const headers = {};
|
|
1386
1306
|
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
this.handlers = [];
|
|
1390
|
-
}
|
|
1307
|
+
utils$1.forEach(this, (value, header) => {
|
|
1308
|
+
const key = utils$1.findKey(headers, header);
|
|
1391
1309
|
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1310
|
+
if (key) {
|
|
1311
|
+
self[key] = normalizeValue(value);
|
|
1312
|
+
delete self[header];
|
|
1313
|
+
return;
|
|
1314
|
+
}
|
|
1315
|
+
|
|
1316
|
+
const normalized = format ? formatHeader(header) : String(header).trim();
|
|
1317
|
+
|
|
1318
|
+
if (normalized !== header) {
|
|
1319
|
+
delete self[header];
|
|
1320
|
+
}
|
|
1321
|
+
|
|
1322
|
+
self[normalized] = normalizeValue(value);
|
|
1323
|
+
|
|
1324
|
+
headers[normalized] = true;
|
|
1407
1325
|
});
|
|
1408
|
-
return this.handlers.length - 1;
|
|
1409
|
-
}
|
|
1410
1326
|
|
|
1411
|
-
|
|
1412
|
-
* Remove an interceptor from the stack
|
|
1413
|
-
*
|
|
1414
|
-
* @param {Number} id The ID that was returned by `use`
|
|
1415
|
-
*
|
|
1416
|
-
* @returns {void}
|
|
1417
|
-
*/
|
|
1418
|
-
eject(id) {
|
|
1419
|
-
if (this.handlers[id]) {
|
|
1420
|
-
this.handlers[id] = null;
|
|
1421
|
-
}
|
|
1327
|
+
return this;
|
|
1422
1328
|
}
|
|
1423
1329
|
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
*
|
|
1427
|
-
* @returns {void}
|
|
1428
|
-
*/
|
|
1429
|
-
clear() {
|
|
1430
|
-
if (this.handlers) {
|
|
1431
|
-
this.handlers = [];
|
|
1432
|
-
}
|
|
1330
|
+
concat(...targets) {
|
|
1331
|
+
return this.constructor.concat(this, ...targets);
|
|
1433
1332
|
}
|
|
1434
1333
|
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
*
|
|
1443
|
-
* @returns {void}
|
|
1444
|
-
*/
|
|
1445
|
-
forEach(fn) {
|
|
1446
|
-
utils$1.forEach(this.handlers, function forEachHandler(h) {
|
|
1447
|
-
if (h !== null) {
|
|
1448
|
-
fn(h);
|
|
1449
|
-
}
|
|
1334
|
+
toJSON(asStrings) {
|
|
1335
|
+
const obj = Object.create(null);
|
|
1336
|
+
|
|
1337
|
+
utils$1.forEach(this, (value, header) => {
|
|
1338
|
+
value != null &&
|
|
1339
|
+
value !== false &&
|
|
1340
|
+
(obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value);
|
|
1450
1341
|
});
|
|
1342
|
+
|
|
1343
|
+
return obj;
|
|
1451
1344
|
}
|
|
1452
|
-
}
|
|
1453
1345
|
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
clarifyTimeoutError: false,
|
|
1458
|
-
legacyInterceptorReqResOrdering: true,
|
|
1459
|
-
};
|
|
1346
|
+
[Symbol.iterator]() {
|
|
1347
|
+
return Object.entries(this.toJSON())[Symbol.iterator]();
|
|
1348
|
+
}
|
|
1460
1349
|
|
|
1461
|
-
|
|
1350
|
+
toString() {
|
|
1351
|
+
return Object.entries(this.toJSON())
|
|
1352
|
+
.map(([header, value]) => header + ': ' + value)
|
|
1353
|
+
.join('\n');
|
|
1354
|
+
}
|
|
1462
1355
|
|
|
1463
|
-
|
|
1356
|
+
getSetCookie() {
|
|
1357
|
+
return this.get('set-cookie') || [];
|
|
1358
|
+
}
|
|
1464
1359
|
|
|
1465
|
-
|
|
1360
|
+
get [Symbol.toStringTag]() {
|
|
1361
|
+
return 'AxiosHeaders';
|
|
1362
|
+
}
|
|
1466
1363
|
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
URLSearchParams: URLSearchParams$1,
|
|
1471
|
-
FormData: FormData$1,
|
|
1472
|
-
Blob: Blob$1,
|
|
1473
|
-
},
|
|
1474
|
-
protocols: ['http', 'https', 'file', 'blob', 'url', 'data'],
|
|
1475
|
-
};
|
|
1364
|
+
static from(thing) {
|
|
1365
|
+
return thing instanceof this ? thing : new this(thing);
|
|
1366
|
+
}
|
|
1476
1367
|
|
|
1477
|
-
|
|
1368
|
+
static concat(first, ...targets) {
|
|
1369
|
+
const computed = new this(first);
|
|
1478
1370
|
|
|
1479
|
-
|
|
1371
|
+
targets.forEach((target) => computed.set(target));
|
|
1480
1372
|
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
*
|
|
1484
|
-
* This allows axios to run in a web worker, and react-native.
|
|
1485
|
-
* Both environments support XMLHttpRequest, but not fully standard globals.
|
|
1486
|
-
*
|
|
1487
|
-
* web workers:
|
|
1488
|
-
* typeof window -> undefined
|
|
1489
|
-
* typeof document -> undefined
|
|
1490
|
-
*
|
|
1491
|
-
* react-native:
|
|
1492
|
-
* navigator.product -> 'ReactNative'
|
|
1493
|
-
* nativescript
|
|
1494
|
-
* navigator.product -> 'NativeScript' or 'NS'
|
|
1495
|
-
*
|
|
1496
|
-
* @returns {boolean}
|
|
1497
|
-
*/
|
|
1498
|
-
const hasStandardBrowserEnv =
|
|
1499
|
-
hasBrowserEnv &&
|
|
1500
|
-
(!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);
|
|
1373
|
+
return computed;
|
|
1374
|
+
}
|
|
1501
1375
|
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
* This leads to a problem when axios post `FormData` in webWorker
|
|
1510
|
-
*/
|
|
1511
|
-
const hasStandardBrowserWebWorkerEnv = (() => {
|
|
1512
|
-
return (
|
|
1513
|
-
typeof WorkerGlobalScope !== 'undefined' &&
|
|
1514
|
-
// eslint-disable-next-line no-undef
|
|
1515
|
-
self instanceof WorkerGlobalScope &&
|
|
1516
|
-
typeof self.importScripts === 'function'
|
|
1517
|
-
);
|
|
1518
|
-
})();
|
|
1376
|
+
static accessor(header) {
|
|
1377
|
+
const internals =
|
|
1378
|
+
(this[$internals] =
|
|
1379
|
+
this[$internals] =
|
|
1380
|
+
{
|
|
1381
|
+
accessors: {},
|
|
1382
|
+
});
|
|
1519
1383
|
|
|
1520
|
-
|
|
1384
|
+
const accessors = internals.accessors;
|
|
1385
|
+
const prototype = this.prototype;
|
|
1521
1386
|
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
hasBrowserEnv: hasBrowserEnv,
|
|
1525
|
-
hasStandardBrowserEnv: hasStandardBrowserEnv,
|
|
1526
|
-
hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
|
|
1527
|
-
navigator: _navigator,
|
|
1528
|
-
origin: origin
|
|
1529
|
-
});
|
|
1387
|
+
function defineAccessor(_header) {
|
|
1388
|
+
const lHeader = normalizeHeader(_header);
|
|
1530
1389
|
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
};
|
|
1535
|
-
|
|
1536
|
-
function toURLEncodedForm(data, options) {
|
|
1537
|
-
return toFormData(data, new platform.classes.URLSearchParams(), {
|
|
1538
|
-
visitor: function (value, key, path, helpers) {
|
|
1539
|
-
if (platform.isNode && utils$1.isBuffer(value)) {
|
|
1540
|
-
this.append(key, value.toString('base64'));
|
|
1541
|
-
return false;
|
|
1390
|
+
if (!accessors[lHeader]) {
|
|
1391
|
+
buildAccessors(prototype, _header);
|
|
1392
|
+
accessors[lHeader] = true;
|
|
1542
1393
|
}
|
|
1394
|
+
}
|
|
1543
1395
|
|
|
1544
|
-
|
|
1545
|
-
},
|
|
1546
|
-
...options,
|
|
1547
|
-
});
|
|
1548
|
-
}
|
|
1549
|
-
|
|
1550
|
-
/**
|
|
1551
|
-
* It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']
|
|
1552
|
-
*
|
|
1553
|
-
* @param {string} name - The name of the property to get.
|
|
1554
|
-
*
|
|
1555
|
-
* @returns An array of strings.
|
|
1556
|
-
*/
|
|
1557
|
-
function parsePropPath(name) {
|
|
1558
|
-
// foo[x][y][z]
|
|
1559
|
-
// foo.x.y.z
|
|
1560
|
-
// foo-x-y-z
|
|
1561
|
-
// foo x y z
|
|
1562
|
-
return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map((match) => {
|
|
1563
|
-
return match[0] === '[]' ? '' : match[1] || match[0];
|
|
1564
|
-
});
|
|
1565
|
-
}
|
|
1396
|
+
utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
|
|
1566
1397
|
|
|
1567
|
-
|
|
1568
|
-
* Convert an array to an object.
|
|
1569
|
-
*
|
|
1570
|
-
* @param {Array<any>} arr - The array to convert to an object.
|
|
1571
|
-
*
|
|
1572
|
-
* @returns An object with the same keys and values as the array.
|
|
1573
|
-
*/
|
|
1574
|
-
function arrayToObject(arr) {
|
|
1575
|
-
const obj = {};
|
|
1576
|
-
const keys = Object.keys(arr);
|
|
1577
|
-
let i;
|
|
1578
|
-
const len = keys.length;
|
|
1579
|
-
let key;
|
|
1580
|
-
for (i = 0; i < len; i++) {
|
|
1581
|
-
key = keys[i];
|
|
1582
|
-
obj[key] = arr[key];
|
|
1398
|
+
return this;
|
|
1583
1399
|
}
|
|
1584
|
-
return obj;
|
|
1585
1400
|
}
|
|
1586
1401
|
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
function buildPath(path, value, target, index) {
|
|
1596
|
-
let name = path[index++];
|
|
1597
|
-
|
|
1598
|
-
if (name === '__proto__') return true;
|
|
1599
|
-
|
|
1600
|
-
const isNumericKey = Number.isFinite(+name);
|
|
1601
|
-
const isLast = index >= path.length;
|
|
1602
|
-
name = !name && utils$1.isArray(target) ? target.length : name;
|
|
1603
|
-
|
|
1604
|
-
if (isLast) {
|
|
1605
|
-
if (utils$1.hasOwnProp(target, name)) {
|
|
1606
|
-
target[name] = [target[name], value];
|
|
1607
|
-
} else {
|
|
1608
|
-
target[name] = value;
|
|
1609
|
-
}
|
|
1610
|
-
|
|
1611
|
-
return !isNumericKey;
|
|
1612
|
-
}
|
|
1613
|
-
|
|
1614
|
-
if (!target[name] || !utils$1.isObject(target[name])) {
|
|
1615
|
-
target[name] = [];
|
|
1616
|
-
}
|
|
1617
|
-
|
|
1618
|
-
const result = buildPath(path, value, target[name], index);
|
|
1619
|
-
|
|
1620
|
-
if (result && utils$1.isArray(target[name])) {
|
|
1621
|
-
target[name] = arrayToObject(target[name]);
|
|
1622
|
-
}
|
|
1402
|
+
AxiosHeaders.accessor([
|
|
1403
|
+
'Content-Type',
|
|
1404
|
+
'Content-Length',
|
|
1405
|
+
'Accept',
|
|
1406
|
+
'Accept-Encoding',
|
|
1407
|
+
'User-Agent',
|
|
1408
|
+
'Authorization',
|
|
1409
|
+
]);
|
|
1623
1410
|
|
|
1624
|
-
|
|
1625
|
-
|
|
1411
|
+
// reserved names hotfix
|
|
1412
|
+
utils$1.reduceDescriptors(AxiosHeaders.prototype, ({ value }, key) => {
|
|
1413
|
+
let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
|
|
1414
|
+
return {
|
|
1415
|
+
get: () => value,
|
|
1416
|
+
set(headerValue) {
|
|
1417
|
+
this[mapped] = headerValue;
|
|
1418
|
+
},
|
|
1419
|
+
};
|
|
1420
|
+
});
|
|
1626
1421
|
|
|
1627
|
-
|
|
1628
|
-
const obj = {};
|
|
1422
|
+
utils$1.freezeMethods(AxiosHeaders);
|
|
1629
1423
|
|
|
1630
|
-
|
|
1631
|
-
buildPath(parsePropPath(name), value, obj, 0);
|
|
1632
|
-
});
|
|
1424
|
+
const REDACTED = '[REDACTED ****]';
|
|
1633
1425
|
|
|
1634
|
-
|
|
1426
|
+
function hasOwnOrPrototypeToJSON(source) {
|
|
1427
|
+
if (utils$1.hasOwnProp(source, 'toJSON')) {
|
|
1428
|
+
return true;
|
|
1635
1429
|
}
|
|
1636
1430
|
|
|
1637
|
-
|
|
1638
|
-
}
|
|
1431
|
+
let prototype = Object.getPrototypeOf(source);
|
|
1639
1432
|
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
*
|
|
1644
|
-
* @param {any} rawValue - The value to be stringified.
|
|
1645
|
-
* @param {Function} parser - A function that parses a string into a JavaScript object.
|
|
1646
|
-
* @param {Function} encoder - A function that takes a value and returns a string.
|
|
1647
|
-
*
|
|
1648
|
-
* @returns {string} A stringified version of the rawValue.
|
|
1649
|
-
*/
|
|
1650
|
-
function stringifySafely(rawValue, parser, encoder) {
|
|
1651
|
-
if (utils$1.isString(rawValue)) {
|
|
1652
|
-
try {
|
|
1653
|
-
(0, JSON.parse)(rawValue);
|
|
1654
|
-
return utils$1.trim(rawValue);
|
|
1655
|
-
} catch (e) {
|
|
1656
|
-
if (e.name !== 'SyntaxError') {
|
|
1657
|
-
throw e;
|
|
1658
|
-
}
|
|
1433
|
+
while (prototype && prototype !== Object.prototype) {
|
|
1434
|
+
if (utils$1.hasOwnProp(prototype, 'toJSON')) {
|
|
1435
|
+
return true;
|
|
1659
1436
|
}
|
|
1437
|
+
|
|
1438
|
+
prototype = Object.getPrototypeOf(prototype);
|
|
1660
1439
|
}
|
|
1661
1440
|
|
|
1662
|
-
return
|
|
1441
|
+
return false;
|
|
1663
1442
|
}
|
|
1664
1443
|
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
function transformRequest(data, headers) {
|
|
1672
|
-
const contentType = headers.getContentType() || '';
|
|
1673
|
-
const hasJSONContentType = contentType.indexOf('application/json') > -1;
|
|
1674
|
-
const isObjectPayload = utils$1.isObject(data);
|
|
1675
|
-
|
|
1676
|
-
if (isObjectPayload && utils$1.isHTMLForm(data)) {
|
|
1677
|
-
data = new FormData(data);
|
|
1678
|
-
}
|
|
1679
|
-
|
|
1680
|
-
const isFormData = utils$1.isFormData(data);
|
|
1681
|
-
|
|
1682
|
-
if (isFormData) {
|
|
1683
|
-
return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
|
|
1684
|
-
}
|
|
1685
|
-
|
|
1686
|
-
if (
|
|
1687
|
-
utils$1.isArrayBuffer(data) ||
|
|
1688
|
-
utils$1.isBuffer(data) ||
|
|
1689
|
-
utils$1.isStream(data) ||
|
|
1690
|
-
utils$1.isFile(data) ||
|
|
1691
|
-
utils$1.isBlob(data) ||
|
|
1692
|
-
utils$1.isReadableStream(data)
|
|
1693
|
-
) {
|
|
1694
|
-
return data;
|
|
1695
|
-
}
|
|
1696
|
-
if (utils$1.isArrayBufferView(data)) {
|
|
1697
|
-
return data.buffer;
|
|
1698
|
-
}
|
|
1699
|
-
if (utils$1.isURLSearchParams(data)) {
|
|
1700
|
-
headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
|
|
1701
|
-
return data.toString();
|
|
1702
|
-
}
|
|
1444
|
+
// Build a plain-object snapshot of `config` and replace the value of any key
|
|
1445
|
+
// (case-insensitive) listed in `redactKeys` with REDACTED. Walks through arrays
|
|
1446
|
+
// and AxiosHeaders, and short-circuits on circular references.
|
|
1447
|
+
function redactConfig(config, redactKeys) {
|
|
1448
|
+
const lowerKeys = new Set(redactKeys.map((k) => String(k).toLowerCase()));
|
|
1449
|
+
const seen = [];
|
|
1703
1450
|
|
|
1704
|
-
|
|
1451
|
+
const visit = (source) => {
|
|
1452
|
+
if (source === null || typeof source !== 'object') return source;
|
|
1453
|
+
if (utils$1.isBuffer(source)) return source;
|
|
1454
|
+
if (seen.indexOf(source) !== -1) return undefined;
|
|
1705
1455
|
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
}
|
|
1456
|
+
if (source instanceof AxiosHeaders) {
|
|
1457
|
+
source = source.toJSON();
|
|
1458
|
+
}
|
|
1710
1459
|
|
|
1711
|
-
|
|
1712
|
-
(isFileList = utils$1.isFileList(data)) ||
|
|
1713
|
-
contentType.indexOf('multipart/form-data') > -1
|
|
1714
|
-
) {
|
|
1715
|
-
const _FormData = this.env && this.env.FormData;
|
|
1460
|
+
seen.push(source);
|
|
1716
1461
|
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1462
|
+
let result;
|
|
1463
|
+
if (utils$1.isArray(source)) {
|
|
1464
|
+
result = [];
|
|
1465
|
+
source.forEach((v, i) => {
|
|
1466
|
+
const reducedValue = visit(v);
|
|
1467
|
+
if (!utils$1.isUndefined(reducedValue)) {
|
|
1468
|
+
result[i] = reducedValue;
|
|
1722
1469
|
}
|
|
1470
|
+
});
|
|
1471
|
+
} else {
|
|
1472
|
+
if (!utils$1.isPlainObject(source) && hasOwnOrPrototypeToJSON(source)) {
|
|
1473
|
+
seen.pop();
|
|
1474
|
+
return source;
|
|
1723
1475
|
}
|
|
1724
1476
|
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1477
|
+
result = Object.create(null);
|
|
1478
|
+
for (const [key, value] of Object.entries(source)) {
|
|
1479
|
+
const reducedValue = lowerKeys.has(key.toLowerCase()) ? REDACTED : visit(value);
|
|
1480
|
+
if (!utils$1.isUndefined(reducedValue)) {
|
|
1481
|
+
result[key] = reducedValue;
|
|
1482
|
+
}
|
|
1728
1483
|
}
|
|
1484
|
+
}
|
|
1729
1485
|
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
transformResponse: [
|
|
1735
|
-
function transformResponse(data) {
|
|
1736
|
-
const transitional = this.transitional || defaults.transitional;
|
|
1737
|
-
const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
|
|
1738
|
-
const JSONRequested = this.responseType === 'json';
|
|
1486
|
+
seen.pop();
|
|
1487
|
+
return result;
|
|
1488
|
+
};
|
|
1739
1489
|
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
}
|
|
1490
|
+
return visit(config);
|
|
1491
|
+
}
|
|
1743
1492
|
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
const silentJSONParsing = transitional && transitional.silentJSONParsing;
|
|
1750
|
-
const strictJSONParsing = !silentJSONParsing && JSONRequested;
|
|
1493
|
+
class AxiosError extends Error {
|
|
1494
|
+
static from(error, code, config, request, response, customProps) {
|
|
1495
|
+
const axiosError = new AxiosError(error.message, code || error.code, config, request, response);
|
|
1496
|
+
axiosError.cause = error;
|
|
1497
|
+
axiosError.name = error.name;
|
|
1751
1498
|
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
if (e.name === 'SyntaxError') {
|
|
1757
|
-
throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response);
|
|
1758
|
-
}
|
|
1759
|
-
throw e;
|
|
1760
|
-
}
|
|
1761
|
-
}
|
|
1762
|
-
}
|
|
1499
|
+
// Preserve status from the original error if not already set from response
|
|
1500
|
+
if (error.status != null && axiosError.status == null) {
|
|
1501
|
+
axiosError.status = error.status;
|
|
1502
|
+
}
|
|
1763
1503
|
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1504
|
+
customProps && Object.assign(axiosError, customProps);
|
|
1505
|
+
return axiosError;
|
|
1506
|
+
}
|
|
1767
1507
|
|
|
1768
1508
|
/**
|
|
1769
|
-
*
|
|
1770
|
-
*
|
|
1509
|
+
* Create an Error with the specified message, config, error code, request and response.
|
|
1510
|
+
*
|
|
1511
|
+
* @param {string} message The error message.
|
|
1512
|
+
* @param {string} [code] The error code (for example, 'ECONNABORTED').
|
|
1513
|
+
* @param {Object} [config] The config.
|
|
1514
|
+
* @param {Object} [request] The request.
|
|
1515
|
+
* @param {Object} [response] The response.
|
|
1516
|
+
*
|
|
1517
|
+
* @returns {Error} The created error.
|
|
1771
1518
|
*/
|
|
1772
|
-
|
|
1519
|
+
constructor(message, code, config, request, response) {
|
|
1520
|
+
super(message);
|
|
1521
|
+
|
|
1522
|
+
// Make message enumerable to maintain backward compatibility
|
|
1523
|
+
// The native Error constructor sets message as non-enumerable,
|
|
1524
|
+
// but axios < v1.13.3 had it as enumerable
|
|
1525
|
+
Object.defineProperty(this, 'message', {
|
|
1526
|
+
// Null-proto descriptor so a polluted Object.prototype.get cannot turn
|
|
1527
|
+
// this data descriptor into an accessor descriptor on the way in.
|
|
1528
|
+
__proto__: null,
|
|
1529
|
+
value: message,
|
|
1530
|
+
enumerable: true,
|
|
1531
|
+
writable: true,
|
|
1532
|
+
configurable: true,
|
|
1533
|
+
});
|
|
1773
1534
|
|
|
1774
|
-
|
|
1775
|
-
|
|
1535
|
+
this.name = 'AxiosError';
|
|
1536
|
+
this.isAxiosError = true;
|
|
1537
|
+
code && (this.code = code);
|
|
1538
|
+
config && (this.config = config);
|
|
1539
|
+
request && (this.request = request);
|
|
1540
|
+
if (response) {
|
|
1541
|
+
this.response = response;
|
|
1542
|
+
this.status = response.status;
|
|
1543
|
+
}
|
|
1544
|
+
}
|
|
1776
1545
|
|
|
1777
|
-
|
|
1778
|
-
|
|
1546
|
+
toJSON() {
|
|
1547
|
+
// Opt-in redaction: when the request config carries a `redact` array, the
|
|
1548
|
+
// value of any matching key (case-insensitive, at any depth) is replaced
|
|
1549
|
+
// with REDACTED in the serialized snapshot. Undefined or empty leaves the
|
|
1550
|
+
// existing serialization behavior unchanged.
|
|
1551
|
+
const config = this.config;
|
|
1552
|
+
const redactKeys = config && utils$1.hasOwnProp(config, 'redact') ? config.redact : undefined;
|
|
1553
|
+
const serializedConfig =
|
|
1554
|
+
utils$1.isArray(redactKeys) && redactKeys.length > 0
|
|
1555
|
+
? redactConfig(config, redactKeys)
|
|
1556
|
+
: utils$1.toJSONObject(config);
|
|
1779
1557
|
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1558
|
+
return {
|
|
1559
|
+
// Standard
|
|
1560
|
+
message: this.message,
|
|
1561
|
+
name: this.name,
|
|
1562
|
+
// Microsoft
|
|
1563
|
+
description: this.description,
|
|
1564
|
+
number: this.number,
|
|
1565
|
+
// Mozilla
|
|
1566
|
+
fileName: this.fileName,
|
|
1567
|
+
lineNumber: this.lineNumber,
|
|
1568
|
+
columnNumber: this.columnNumber,
|
|
1569
|
+
stack: this.stack,
|
|
1570
|
+
// Axios
|
|
1571
|
+
config: serializedConfig,
|
|
1572
|
+
code: this.code,
|
|
1573
|
+
status: this.status,
|
|
1574
|
+
};
|
|
1575
|
+
}
|
|
1576
|
+
}
|
|
1784
1577
|
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1578
|
+
// This can be changed to static properties as soon as the parser options in .eslint.cjs are updated.
|
|
1579
|
+
AxiosError.ERR_BAD_OPTION_VALUE = 'ERR_BAD_OPTION_VALUE';
|
|
1580
|
+
AxiosError.ERR_BAD_OPTION = 'ERR_BAD_OPTION';
|
|
1581
|
+
AxiosError.ECONNABORTED = 'ECONNABORTED';
|
|
1582
|
+
AxiosError.ETIMEDOUT = 'ETIMEDOUT';
|
|
1583
|
+
AxiosError.ECONNREFUSED = 'ECONNREFUSED';
|
|
1584
|
+
AxiosError.ERR_NETWORK = 'ERR_NETWORK';
|
|
1585
|
+
AxiosError.ERR_FR_TOO_MANY_REDIRECTS = 'ERR_FR_TOO_MANY_REDIRECTS';
|
|
1586
|
+
AxiosError.ERR_DEPRECATED = 'ERR_DEPRECATED';
|
|
1587
|
+
AxiosError.ERR_BAD_RESPONSE = 'ERR_BAD_RESPONSE';
|
|
1588
|
+
AxiosError.ERR_BAD_REQUEST = 'ERR_BAD_REQUEST';
|
|
1589
|
+
AxiosError.ERR_CANCELED = 'ERR_CANCELED';
|
|
1590
|
+
AxiosError.ERR_NOT_SUPPORT = 'ERR_NOT_SUPPORT';
|
|
1591
|
+
AxiosError.ERR_INVALID_URL = 'ERR_INVALID_URL';
|
|
1592
|
+
AxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED = 'ERR_FORM_DATA_DEPTH_EXCEEDED';
|
|
1788
1593
|
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
Accept: 'application/json, text/plain, */*',
|
|
1792
|
-
'Content-Type': undefined,
|
|
1793
|
-
},
|
|
1794
|
-
},
|
|
1795
|
-
};
|
|
1594
|
+
// eslint-disable-next-line strict
|
|
1595
|
+
var httpAdapter = null;
|
|
1796
1596
|
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1597
|
+
/**
|
|
1598
|
+
* Determines if the given thing is a array or js object.
|
|
1599
|
+
*
|
|
1600
|
+
* @param {string} thing - The object or array to be visited.
|
|
1601
|
+
*
|
|
1602
|
+
* @returns {boolean}
|
|
1603
|
+
*/
|
|
1604
|
+
function isVisitable(thing) {
|
|
1605
|
+
return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
|
|
1606
|
+
}
|
|
1800
1607
|
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
'
|
|
1810
|
-
|
|
1811
|
-
'host',
|
|
1812
|
-
'if-modified-since',
|
|
1813
|
-
'if-unmodified-since',
|
|
1814
|
-
'last-modified',
|
|
1815
|
-
'location',
|
|
1816
|
-
'max-forwards',
|
|
1817
|
-
'proxy-authorization',
|
|
1818
|
-
'referer',
|
|
1819
|
-
'retry-after',
|
|
1820
|
-
'user-agent',
|
|
1821
|
-
]);
|
|
1608
|
+
/**
|
|
1609
|
+
* It removes the brackets from the end of a string
|
|
1610
|
+
*
|
|
1611
|
+
* @param {string} key - The key of the parameter.
|
|
1612
|
+
*
|
|
1613
|
+
* @returns {string} the key without the brackets.
|
|
1614
|
+
*/
|
|
1615
|
+
function removeBrackets(key) {
|
|
1616
|
+
return utils$1.endsWith(key, '[]') ? key.slice(0, -2) : key;
|
|
1617
|
+
}
|
|
1822
1618
|
|
|
1823
1619
|
/**
|
|
1824
|
-
*
|
|
1620
|
+
* It takes a path, a key, and a boolean, and returns a string
|
|
1825
1621
|
*
|
|
1826
|
-
*
|
|
1827
|
-
*
|
|
1828
|
-
*
|
|
1829
|
-
* Connection: keep-alive
|
|
1830
|
-
* Transfer-Encoding: chunked
|
|
1831
|
-
* ```
|
|
1622
|
+
* @param {string} path - The path to the current key.
|
|
1623
|
+
* @param {string} key - The key of the current object being iterated over.
|
|
1624
|
+
* @param {string} dots - If true, the key will be rendered with dots instead of brackets.
|
|
1832
1625
|
*
|
|
1833
|
-
* @
|
|
1626
|
+
* @returns {string} The path to the current key.
|
|
1627
|
+
*/
|
|
1628
|
+
function renderKey(path, key, dots) {
|
|
1629
|
+
if (!path) return key;
|
|
1630
|
+
return path
|
|
1631
|
+
.concat(key)
|
|
1632
|
+
.map(function each(token, i) {
|
|
1633
|
+
// eslint-disable-next-line no-param-reassign
|
|
1634
|
+
token = removeBrackets(token);
|
|
1635
|
+
return !dots && i ? '[' + token + ']' : token;
|
|
1636
|
+
})
|
|
1637
|
+
.join(dots ? '.' : '');
|
|
1638
|
+
}
|
|
1639
|
+
|
|
1640
|
+
/**
|
|
1641
|
+
* If the array is an array and none of its elements are visitable, then it's a flat array.
|
|
1834
1642
|
*
|
|
1835
|
-
* @
|
|
1643
|
+
* @param {Array<any>} arr - The array to check
|
|
1644
|
+
*
|
|
1645
|
+
* @returns {boolean}
|
|
1836
1646
|
*/
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
let val;
|
|
1841
|
-
let i;
|
|
1647
|
+
function isFlatArray(arr) {
|
|
1648
|
+
return utils$1.isArray(arr) && !arr.some(isVisitable);
|
|
1649
|
+
}
|
|
1842
1650
|
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
key = line.substring(0, i).trim().toLowerCase();
|
|
1847
|
-
val = line.substring(i + 1).trim();
|
|
1651
|
+
const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) {
|
|
1652
|
+
return /^is[A-Z]/.test(prop);
|
|
1653
|
+
});
|
|
1848
1654
|
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1655
|
+
/**
|
|
1656
|
+
* Convert a data object to FormData
|
|
1657
|
+
*
|
|
1658
|
+
* @param {Object} obj
|
|
1659
|
+
* @param {?Object} [formData]
|
|
1660
|
+
* @param {?Object} [options]
|
|
1661
|
+
* @param {Function} [options.visitor]
|
|
1662
|
+
* @param {Boolean} [options.metaTokens = true]
|
|
1663
|
+
* @param {Boolean} [options.dots = false]
|
|
1664
|
+
* @param {?Boolean} [options.indexes = false]
|
|
1665
|
+
*
|
|
1666
|
+
* @returns {Object}
|
|
1667
|
+
**/
|
|
1852
1668
|
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1669
|
+
/**
|
|
1670
|
+
* It converts an object into a FormData object
|
|
1671
|
+
*
|
|
1672
|
+
* @param {Object<any, any>} obj - The object to convert to form data.
|
|
1673
|
+
* @param {string} formData - The FormData object to append to.
|
|
1674
|
+
* @param {Object<string, any>} options
|
|
1675
|
+
*
|
|
1676
|
+
* @returns
|
|
1677
|
+
*/
|
|
1678
|
+
function toFormData(obj, formData, options) {
|
|
1679
|
+
if (!utils$1.isObject(obj)) {
|
|
1680
|
+
throw new TypeError('target must be an object');
|
|
1681
|
+
}
|
|
1863
1682
|
|
|
1864
|
-
|
|
1865
|
-
|
|
1683
|
+
// eslint-disable-next-line no-param-reassign
|
|
1684
|
+
formData = formData || new (FormData)();
|
|
1866
1685
|
|
|
1867
|
-
|
|
1686
|
+
// eslint-disable-next-line no-param-reassign
|
|
1687
|
+
options = utils$1.toFlatObject(
|
|
1688
|
+
options,
|
|
1689
|
+
{
|
|
1690
|
+
metaTokens: true,
|
|
1691
|
+
dots: false,
|
|
1692
|
+
indexes: false,
|
|
1693
|
+
},
|
|
1694
|
+
false,
|
|
1695
|
+
function defined(option, source) {
|
|
1696
|
+
// eslint-disable-next-line no-eq-null,eqeqeq
|
|
1697
|
+
return !utils$1.isUndefined(source[option]);
|
|
1698
|
+
}
|
|
1699
|
+
);
|
|
1868
1700
|
|
|
1869
|
-
|
|
1701
|
+
const metaTokens = options.metaTokens;
|
|
1702
|
+
// eslint-disable-next-line no-use-before-define
|
|
1703
|
+
const visitor = options.visitor || defaultVisitor;
|
|
1704
|
+
const dots = options.dots;
|
|
1705
|
+
const indexes = options.indexes;
|
|
1706
|
+
const _Blob = options.Blob || (typeof Blob !== 'undefined' && Blob);
|
|
1707
|
+
const maxDepth = options.maxDepth === undefined ? 100 : options.maxDepth;
|
|
1708
|
+
const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
|
|
1870
1709
|
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
return;
|
|
1710
|
+
if (!utils$1.isFunction(visitor)) {
|
|
1711
|
+
throw new TypeError('visitor must be a function');
|
|
1874
1712
|
}
|
|
1875
1713
|
|
|
1876
|
-
|
|
1877
|
-
value
|
|
1878
|
-
|
|
1714
|
+
function convertValue(value) {
|
|
1715
|
+
if (value === null) return '';
|
|
1716
|
+
|
|
1717
|
+
if (utils$1.isDate(value)) {
|
|
1718
|
+
return value.toISOString();
|
|
1719
|
+
}
|
|
1720
|
+
|
|
1721
|
+
if (utils$1.isBoolean(value)) {
|
|
1722
|
+
return value.toString();
|
|
1723
|
+
}
|
|
1724
|
+
|
|
1725
|
+
if (!useBlob && utils$1.isBlob(value)) {
|
|
1726
|
+
throw new AxiosError('Blob is not supported. Use a Buffer instead.');
|
|
1727
|
+
}
|
|
1728
|
+
|
|
1729
|
+
if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
|
|
1730
|
+
return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
|
|
1731
|
+
}
|
|
1732
|
+
|
|
1733
|
+
return value;
|
|
1879
1734
|
}
|
|
1880
1735
|
|
|
1881
|
-
|
|
1882
|
-
|
|
1736
|
+
/**
|
|
1737
|
+
* Default visitor.
|
|
1738
|
+
*
|
|
1739
|
+
* @param {*} value
|
|
1740
|
+
* @param {String|Number} key
|
|
1741
|
+
* @param {Array<String|Number>} path
|
|
1742
|
+
* @this {FormData}
|
|
1743
|
+
*
|
|
1744
|
+
* @returns {boolean} return true to visit the each prop of the value recursively
|
|
1745
|
+
*/
|
|
1746
|
+
function defaultVisitor(value, key, path) {
|
|
1747
|
+
let arr = value;
|
|
1748
|
+
|
|
1749
|
+
if (utils$1.isReactNative(formData) && utils$1.isReactNativeBlob(value)) {
|
|
1750
|
+
formData.append(renderKey(path, key, dots), convertValue(value));
|
|
1751
|
+
return false;
|
|
1752
|
+
}
|
|
1753
|
+
|
|
1754
|
+
if (value && !path && typeof value === 'object') {
|
|
1755
|
+
if (utils$1.endsWith(key, '{}')) {
|
|
1756
|
+
// eslint-disable-next-line no-param-reassign
|
|
1757
|
+
key = metaTokens ? key : key.slice(0, -2);
|
|
1758
|
+
// eslint-disable-next-line no-param-reassign
|
|
1759
|
+
value = JSON.stringify(value);
|
|
1760
|
+
} else if (
|
|
1761
|
+
(utils$1.isArray(value) && isFlatArray(value)) ||
|
|
1762
|
+
((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value)))
|
|
1763
|
+
) {
|
|
1764
|
+
// eslint-disable-next-line no-param-reassign
|
|
1765
|
+
key = removeBrackets(key);
|
|
1766
|
+
|
|
1767
|
+
arr.forEach(function each(el, index) {
|
|
1768
|
+
!(utils$1.isUndefined(el) || el === null) &&
|
|
1769
|
+
formData.append(
|
|
1770
|
+
// eslint-disable-next-line no-nested-ternary
|
|
1771
|
+
indexes === true
|
|
1772
|
+
? renderKey([key], index, dots)
|
|
1773
|
+
: indexes === null
|
|
1774
|
+
? key
|
|
1775
|
+
: key + '[]',
|
|
1776
|
+
convertValue(el)
|
|
1777
|
+
);
|
|
1778
|
+
});
|
|
1779
|
+
return false;
|
|
1780
|
+
}
|
|
1781
|
+
}
|
|
1782
|
+
|
|
1783
|
+
if (isVisitable(value)) {
|
|
1784
|
+
return true;
|
|
1785
|
+
}
|
|
1786
|
+
|
|
1787
|
+
formData.append(renderKey(path, key, dots), convertValue(value));
|
|
1788
|
+
|
|
1789
|
+
return false;
|
|
1883
1790
|
}
|
|
1791
|
+
|
|
1792
|
+
const stack = [];
|
|
1793
|
+
|
|
1794
|
+
const exposedHelpers = Object.assign(predicates, {
|
|
1795
|
+
defaultVisitor,
|
|
1796
|
+
convertValue,
|
|
1797
|
+
isVisitable,
|
|
1798
|
+
});
|
|
1799
|
+
|
|
1800
|
+
function build(value, path, depth = 0) {
|
|
1801
|
+
if (utils$1.isUndefined(value)) return;
|
|
1802
|
+
|
|
1803
|
+
if (depth > maxDepth) {
|
|
1804
|
+
throw new AxiosError(
|
|
1805
|
+
'Object is too deeply nested (' + depth + ' levels). Max depth: ' + maxDepth,
|
|
1806
|
+
AxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED
|
|
1807
|
+
);
|
|
1808
|
+
}
|
|
1809
|
+
|
|
1810
|
+
if (stack.indexOf(value) !== -1) {
|
|
1811
|
+
throw Error('Circular reference detected in ' + path.join('.'));
|
|
1812
|
+
}
|
|
1813
|
+
|
|
1814
|
+
stack.push(value);
|
|
1815
|
+
|
|
1816
|
+
utils$1.forEach(value, function each(el, key) {
|
|
1817
|
+
const result =
|
|
1818
|
+
!(utils$1.isUndefined(el) || el === null) &&
|
|
1819
|
+
visitor.call(formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers);
|
|
1820
|
+
|
|
1821
|
+
if (result === true) {
|
|
1822
|
+
build(el, path ? path.concat(key) : [key], depth + 1);
|
|
1823
|
+
}
|
|
1824
|
+
});
|
|
1825
|
+
|
|
1826
|
+
stack.pop();
|
|
1827
|
+
}
|
|
1828
|
+
|
|
1829
|
+
if (!utils$1.isObject(obj)) {
|
|
1830
|
+
throw new TypeError('data must be an object');
|
|
1831
|
+
}
|
|
1832
|
+
|
|
1833
|
+
build(obj);
|
|
1834
|
+
|
|
1835
|
+
return formData;
|
|
1884
1836
|
}
|
|
1885
1837
|
|
|
1886
|
-
|
|
1887
|
-
|
|
1838
|
+
/**
|
|
1839
|
+
* It encodes a string by replacing all characters that are not in the unreserved set with
|
|
1840
|
+
* their percent-encoded equivalents
|
|
1841
|
+
*
|
|
1842
|
+
* @param {string} str - The string to encode.
|
|
1843
|
+
*
|
|
1844
|
+
* @returns {string} The encoded string.
|
|
1845
|
+
*/
|
|
1846
|
+
function encode$1(str) {
|
|
1847
|
+
const charMap = {
|
|
1848
|
+
'!': '%21',
|
|
1849
|
+
"'": '%27',
|
|
1850
|
+
'(': '%28',
|
|
1851
|
+
')': '%29',
|
|
1852
|
+
'~': '%7E',
|
|
1853
|
+
'%20': '+',
|
|
1854
|
+
};
|
|
1855
|
+
return encodeURIComponent(str).replace(/[!'()~]|%20/g, function replacer(match) {
|
|
1856
|
+
return charMap[match];
|
|
1857
|
+
});
|
|
1858
|
+
}
|
|
1859
|
+
|
|
1860
|
+
/**
|
|
1861
|
+
* It takes a params object and converts it to a FormData object
|
|
1862
|
+
*
|
|
1863
|
+
* @param {Object<string, any>} params - The parameters to be converted to a FormData object.
|
|
1864
|
+
* @param {Object<string, any>} options - The options object passed to the Axios constructor.
|
|
1865
|
+
*
|
|
1866
|
+
* @returns {void}
|
|
1867
|
+
*/
|
|
1868
|
+
function AxiosURLSearchParams(params, options) {
|
|
1869
|
+
this._pairs = [];
|
|
1870
|
+
|
|
1871
|
+
params && toFormData(params, this, options);
|
|
1872
|
+
}
|
|
1873
|
+
|
|
1874
|
+
const prototype = AxiosURLSearchParams.prototype;
|
|
1875
|
+
|
|
1876
|
+
prototype.append = function append(name, value) {
|
|
1877
|
+
this._pairs.push([name, value]);
|
|
1878
|
+
};
|
|
1879
|
+
|
|
1880
|
+
prototype.toString = function toString(encoder) {
|
|
1881
|
+
const _encode = encoder
|
|
1882
|
+
? function (value) {
|
|
1883
|
+
return encoder.call(this, value, encode$1);
|
|
1884
|
+
}
|
|
1885
|
+
: encode$1;
|
|
1886
|
+
|
|
1887
|
+
return this._pairs
|
|
1888
|
+
.map(function each(pair) {
|
|
1889
|
+
return _encode(pair[0]) + '=' + _encode(pair[1]);
|
|
1890
|
+
}, '')
|
|
1891
|
+
.join('&');
|
|
1892
|
+
};
|
|
1893
|
+
|
|
1894
|
+
/**
|
|
1895
|
+
* It replaces URL-encoded forms of `:`, `$`, `,`, and spaces with
|
|
1896
|
+
* their plain counterparts (`:`, `$`, `,`, `+`).
|
|
1897
|
+
*
|
|
1898
|
+
* @param {string} val The value to be encoded.
|
|
1899
|
+
*
|
|
1900
|
+
* @returns {string} The encoded value.
|
|
1901
|
+
*/
|
|
1902
|
+
function encode(val) {
|
|
1903
|
+
return encodeURIComponent(val)
|
|
1904
|
+
.replace(/%3A/gi, ':')
|
|
1905
|
+
.replace(/%24/g, '$')
|
|
1906
|
+
.replace(/%2C/gi, ',')
|
|
1907
|
+
.replace(/%20/g, '+');
|
|
1888
1908
|
}
|
|
1889
1909
|
|
|
1890
|
-
|
|
1891
|
-
|
|
1910
|
+
/**
|
|
1911
|
+
* Build a URL by appending params to the end
|
|
1912
|
+
*
|
|
1913
|
+
* @param {string} url The base of the url (e.g., http://www.google.com)
|
|
1914
|
+
* @param {object} [params] The params to be appended
|
|
1915
|
+
* @param {?(object|Function)} options
|
|
1916
|
+
*
|
|
1917
|
+
* @returns {string} The formatted url
|
|
1918
|
+
*/
|
|
1919
|
+
function buildURL(url, params, options) {
|
|
1920
|
+
if (!params) {
|
|
1921
|
+
return url;
|
|
1922
|
+
}
|
|
1892
1923
|
|
|
1893
|
-
|
|
1894
|
-
const charCode = str.charCodeAt(end - 1);
|
|
1924
|
+
const _encode = (options && options.encode) || encode;
|
|
1895
1925
|
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1926
|
+
const _options = utils$1.isFunction(options)
|
|
1927
|
+
? {
|
|
1928
|
+
serialize: options,
|
|
1929
|
+
}
|
|
1930
|
+
: options;
|
|
1899
1931
|
|
|
1900
|
-
|
|
1901
|
-
}
|
|
1932
|
+
const serializeFn = _options && _options.serialize;
|
|
1902
1933
|
|
|
1903
|
-
|
|
1904
|
-
}
|
|
1934
|
+
let serializedParams;
|
|
1905
1935
|
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1936
|
+
if (serializeFn) {
|
|
1937
|
+
serializedParams = serializeFn(params, _options);
|
|
1938
|
+
} else {
|
|
1939
|
+
serializedParams = utils$1.isURLSearchParams(params)
|
|
1940
|
+
? params.toString()
|
|
1941
|
+
: new AxiosURLSearchParams(params, _options).toString(_encode);
|
|
1909
1942
|
}
|
|
1910
1943
|
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
function parseTokens(str) {
|
|
1915
|
-
const tokens = Object.create(null);
|
|
1916
|
-
const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
|
|
1917
|
-
let match;
|
|
1944
|
+
if (serializedParams) {
|
|
1945
|
+
const hashmarkIndex = url.indexOf('#');
|
|
1918
1946
|
|
|
1919
|
-
|
|
1920
|
-
|
|
1947
|
+
if (hashmarkIndex !== -1) {
|
|
1948
|
+
url = url.slice(0, hashmarkIndex);
|
|
1949
|
+
}
|
|
1950
|
+
url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
|
|
1921
1951
|
}
|
|
1922
1952
|
|
|
1923
|
-
return
|
|
1953
|
+
return url;
|
|
1924
1954
|
}
|
|
1925
1955
|
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
if (utils$1.isFunction(filter)) {
|
|
1930
|
-
return filter.call(this, value, header);
|
|
1956
|
+
class InterceptorManager {
|
|
1957
|
+
constructor() {
|
|
1958
|
+
this.handlers = [];
|
|
1931
1959
|
}
|
|
1932
1960
|
|
|
1933
|
-
|
|
1934
|
-
|
|
1961
|
+
/**
|
|
1962
|
+
* Add a new interceptor to the stack
|
|
1963
|
+
*
|
|
1964
|
+
* @param {Function} fulfilled The function to handle `then` for a `Promise`
|
|
1965
|
+
* @param {Function} rejected The function to handle `reject` for a `Promise`
|
|
1966
|
+
* @param {Object} options The options for the interceptor, synchronous and runWhen
|
|
1967
|
+
*
|
|
1968
|
+
* @return {Number} An ID used to remove interceptor later
|
|
1969
|
+
*/
|
|
1970
|
+
use(fulfilled, rejected, options) {
|
|
1971
|
+
this.handlers.push({
|
|
1972
|
+
fulfilled,
|
|
1973
|
+
rejected,
|
|
1974
|
+
synchronous: options ? options.synchronous : false,
|
|
1975
|
+
runWhen: options ? options.runWhen : null,
|
|
1976
|
+
});
|
|
1977
|
+
return this.handlers.length - 1;
|
|
1935
1978
|
}
|
|
1936
1979
|
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1980
|
+
/**
|
|
1981
|
+
* Remove an interceptor from the stack
|
|
1982
|
+
*
|
|
1983
|
+
* @param {Number} id The ID that was returned by `use`
|
|
1984
|
+
*
|
|
1985
|
+
* @returns {void}
|
|
1986
|
+
*/
|
|
1987
|
+
eject(id) {
|
|
1988
|
+
if (this.handlers[id]) {
|
|
1989
|
+
this.handlers[id] = null;
|
|
1990
|
+
}
|
|
1941
1991
|
}
|
|
1942
1992
|
|
|
1943
|
-
|
|
1944
|
-
|
|
1993
|
+
/**
|
|
1994
|
+
* Clear all interceptors from the stack
|
|
1995
|
+
*
|
|
1996
|
+
* @returns {void}
|
|
1997
|
+
*/
|
|
1998
|
+
clear() {
|
|
1999
|
+
if (this.handlers) {
|
|
2000
|
+
this.handlers = [];
|
|
2001
|
+
}
|
|
1945
2002
|
}
|
|
1946
|
-
}
|
|
1947
|
-
|
|
1948
|
-
function formatHeader(header) {
|
|
1949
|
-
return header
|
|
1950
|
-
.trim()
|
|
1951
|
-
.toLowerCase()
|
|
1952
|
-
.replace(/([a-z\d])(\w*)/g, (w, char, str) => {
|
|
1953
|
-
return char.toUpperCase() + str;
|
|
1954
|
-
});
|
|
1955
|
-
}
|
|
1956
|
-
|
|
1957
|
-
function buildAccessors(obj, header) {
|
|
1958
|
-
const accessorName = utils$1.toCamelCase(' ' + header);
|
|
1959
2003
|
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
2004
|
+
/**
|
|
2005
|
+
* Iterate over all the registered interceptors
|
|
2006
|
+
*
|
|
2007
|
+
* This method is particularly useful for skipping over any
|
|
2008
|
+
* interceptors that may have become `null` calling `eject`.
|
|
2009
|
+
*
|
|
2010
|
+
* @param {Function} fn The function to call for each interceptor
|
|
2011
|
+
*
|
|
2012
|
+
* @returns {void}
|
|
2013
|
+
*/
|
|
2014
|
+
forEach(fn) {
|
|
2015
|
+
utils$1.forEach(this.handlers, function forEachHandler(h) {
|
|
2016
|
+
if (h !== null) {
|
|
2017
|
+
fn(h);
|
|
2018
|
+
}
|
|
1966
2019
|
});
|
|
1967
|
-
});
|
|
1968
|
-
}
|
|
1969
|
-
|
|
1970
|
-
class AxiosHeaders {
|
|
1971
|
-
constructor(headers) {
|
|
1972
|
-
headers && this.set(headers);
|
|
1973
2020
|
}
|
|
2021
|
+
}
|
|
1974
2022
|
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
if (!lHeader) {
|
|
1982
|
-
throw new Error('header name must be a non-empty string');
|
|
1983
|
-
}
|
|
1984
|
-
|
|
1985
|
-
const key = utils$1.findKey(self, lHeader);
|
|
1986
|
-
|
|
1987
|
-
if (
|
|
1988
|
-
!key ||
|
|
1989
|
-
self[key] === undefined ||
|
|
1990
|
-
_rewrite === true ||
|
|
1991
|
-
(_rewrite === undefined && self[key] !== false)
|
|
1992
|
-
) {
|
|
1993
|
-
assertValidHeaderValue(_value, _header);
|
|
1994
|
-
self[key || _header] = normalizeValue(_value);
|
|
1995
|
-
}
|
|
1996
|
-
}
|
|
1997
|
-
|
|
1998
|
-
const setHeaders = (headers, _rewrite) =>
|
|
1999
|
-
utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
|
|
2023
|
+
var transitionalDefaults = {
|
|
2024
|
+
silentJSONParsing: true,
|
|
2025
|
+
forcedJSONParsing: true,
|
|
2026
|
+
clarifyTimeoutError: false,
|
|
2027
|
+
legacyInterceptorReqResOrdering: true,
|
|
2028
|
+
};
|
|
2000
2029
|
|
|
2001
|
-
|
|
2002
|
-
setHeaders(header, valueOrRewrite);
|
|
2003
|
-
} else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
|
|
2004
|
-
setHeaders(parseHeaders(header), valueOrRewrite);
|
|
2005
|
-
} else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
|
|
2006
|
-
let obj = {},
|
|
2007
|
-
dest,
|
|
2008
|
-
key;
|
|
2009
|
-
for (const entry of header) {
|
|
2010
|
-
if (!utils$1.isArray(entry)) {
|
|
2011
|
-
throw TypeError('Object iterator must return a key-value pair');
|
|
2012
|
-
}
|
|
2030
|
+
var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
|
|
2013
2031
|
|
|
2014
|
-
|
|
2015
|
-
? utils$1.isArray(dest)
|
|
2016
|
-
? [...dest, entry[1]]
|
|
2017
|
-
: [dest, entry[1]]
|
|
2018
|
-
: entry[1];
|
|
2019
|
-
}
|
|
2032
|
+
var FormData$1 = typeof FormData !== 'undefined' ? FormData : null;
|
|
2020
2033
|
|
|
2021
|
-
|
|
2022
|
-
} else {
|
|
2023
|
-
header != null && setHeader(valueOrRewrite, header, rewrite);
|
|
2024
|
-
}
|
|
2034
|
+
var Blob$1 = typeof Blob !== 'undefined' ? Blob : null;
|
|
2025
2035
|
|
|
2026
|
-
|
|
2027
|
-
|
|
2036
|
+
var platform$1 = {
|
|
2037
|
+
isBrowser: true,
|
|
2038
|
+
classes: {
|
|
2039
|
+
URLSearchParams: URLSearchParams$1,
|
|
2040
|
+
FormData: FormData$1,
|
|
2041
|
+
Blob: Blob$1,
|
|
2042
|
+
},
|
|
2043
|
+
protocols: ['http', 'https', 'file', 'blob', 'url', 'data'],
|
|
2044
|
+
};
|
|
2028
2045
|
|
|
2029
|
-
|
|
2030
|
-
header = normalizeHeader(header);
|
|
2046
|
+
const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
|
|
2031
2047
|
|
|
2032
|
-
|
|
2033
|
-
const key = utils$1.findKey(this, header);
|
|
2048
|
+
const _navigator = (typeof navigator === 'object' && navigator) || undefined;
|
|
2034
2049
|
|
|
2035
|
-
|
|
2036
|
-
|
|
2050
|
+
/**
|
|
2051
|
+
* Determine if we're running in a standard browser environment
|
|
2052
|
+
*
|
|
2053
|
+
* This allows axios to run in a web worker, and react-native.
|
|
2054
|
+
* Both environments support XMLHttpRequest, but not fully standard globals.
|
|
2055
|
+
*
|
|
2056
|
+
* web workers:
|
|
2057
|
+
* typeof window -> undefined
|
|
2058
|
+
* typeof document -> undefined
|
|
2059
|
+
*
|
|
2060
|
+
* react-native:
|
|
2061
|
+
* navigator.product -> 'ReactNative'
|
|
2062
|
+
* nativescript
|
|
2063
|
+
* navigator.product -> 'NativeScript' or 'NS'
|
|
2064
|
+
*
|
|
2065
|
+
* @returns {boolean}
|
|
2066
|
+
*/
|
|
2067
|
+
const hasStandardBrowserEnv =
|
|
2068
|
+
hasBrowserEnv &&
|
|
2069
|
+
(!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);
|
|
2037
2070
|
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2071
|
+
/**
|
|
2072
|
+
* Determine if we're running in a standard browser webWorker environment
|
|
2073
|
+
*
|
|
2074
|
+
* Although the `isStandardBrowserEnv` method indicates that
|
|
2075
|
+
* `allows axios to run in a web worker`, the WebWorker will still be
|
|
2076
|
+
* filtered out due to its judgment standard
|
|
2077
|
+
* `typeof window !== 'undefined' && typeof document !== 'undefined'`.
|
|
2078
|
+
* This leads to a problem when axios post `FormData` in webWorker
|
|
2079
|
+
*/
|
|
2080
|
+
const hasStandardBrowserWebWorkerEnv = (() => {
|
|
2081
|
+
return (
|
|
2082
|
+
typeof WorkerGlobalScope !== 'undefined' &&
|
|
2083
|
+
// eslint-disable-next-line no-undef
|
|
2084
|
+
self instanceof WorkerGlobalScope &&
|
|
2085
|
+
typeof self.importScripts === 'function'
|
|
2086
|
+
);
|
|
2087
|
+
})();
|
|
2041
2088
|
|
|
2042
|
-
|
|
2043
|
-
return parseTokens(value);
|
|
2044
|
-
}
|
|
2089
|
+
const origin = (hasBrowserEnv && window.location.href) || 'http://localhost';
|
|
2045
2090
|
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2091
|
+
var utils = /*#__PURE__*/Object.freeze({
|
|
2092
|
+
__proto__: null,
|
|
2093
|
+
hasBrowserEnv: hasBrowserEnv,
|
|
2094
|
+
hasStandardBrowserEnv: hasStandardBrowserEnv,
|
|
2095
|
+
hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
|
|
2096
|
+
navigator: _navigator,
|
|
2097
|
+
origin: origin
|
|
2098
|
+
});
|
|
2049
2099
|
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2100
|
+
var platform = {
|
|
2101
|
+
...utils,
|
|
2102
|
+
...platform$1,
|
|
2103
|
+
};
|
|
2053
2104
|
|
|
2054
|
-
|
|
2105
|
+
function toURLEncodedForm(data, options) {
|
|
2106
|
+
return toFormData(data, new platform.classes.URLSearchParams(), {
|
|
2107
|
+
visitor: function (value, key, path, helpers) {
|
|
2108
|
+
if (platform.isNode && utils$1.isBuffer(value)) {
|
|
2109
|
+
this.append(key, value.toString('base64'));
|
|
2110
|
+
return false;
|
|
2055
2111
|
}
|
|
2056
|
-
}
|
|
2057
|
-
}
|
|
2058
|
-
|
|
2059
|
-
has(header, matcher) {
|
|
2060
|
-
header = normalizeHeader(header);
|
|
2061
2112
|
|
|
2062
|
-
|
|
2063
|
-
|
|
2113
|
+
return helpers.defaultVisitor.apply(this, arguments);
|
|
2114
|
+
},
|
|
2115
|
+
...options,
|
|
2116
|
+
});
|
|
2117
|
+
}
|
|
2064
2118
|
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2119
|
+
/**
|
|
2120
|
+
* It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']
|
|
2121
|
+
*
|
|
2122
|
+
* @param {string} name - The name of the property to get.
|
|
2123
|
+
*
|
|
2124
|
+
* @returns An array of strings.
|
|
2125
|
+
*/
|
|
2126
|
+
function parsePropPath(name) {
|
|
2127
|
+
// foo[x][y][z]
|
|
2128
|
+
// foo.x.y.z
|
|
2129
|
+
// foo-x-y-z
|
|
2130
|
+
// foo x y z
|
|
2131
|
+
return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map((match) => {
|
|
2132
|
+
return match[0] === '[]' ? '' : match[1] || match[0];
|
|
2133
|
+
});
|
|
2134
|
+
}
|
|
2071
2135
|
|
|
2072
|
-
|
|
2136
|
+
/**
|
|
2137
|
+
* Convert an array to an object.
|
|
2138
|
+
*
|
|
2139
|
+
* @param {Array<any>} arr - The array to convert to an object.
|
|
2140
|
+
*
|
|
2141
|
+
* @returns An object with the same keys and values as the array.
|
|
2142
|
+
*/
|
|
2143
|
+
function arrayToObject(arr) {
|
|
2144
|
+
const obj = {};
|
|
2145
|
+
const keys = Object.keys(arr);
|
|
2146
|
+
let i;
|
|
2147
|
+
const len = keys.length;
|
|
2148
|
+
let key;
|
|
2149
|
+
for (i = 0; i < len; i++) {
|
|
2150
|
+
key = keys[i];
|
|
2151
|
+
obj[key] = arr[key];
|
|
2073
2152
|
}
|
|
2153
|
+
return obj;
|
|
2154
|
+
}
|
|
2074
2155
|
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2156
|
+
/**
|
|
2157
|
+
* It takes a FormData object and returns a JavaScript object
|
|
2158
|
+
*
|
|
2159
|
+
* @param {string} formData The FormData object to convert to JSON.
|
|
2160
|
+
*
|
|
2161
|
+
* @returns {Object<string, any> | null} The converted object.
|
|
2162
|
+
*/
|
|
2163
|
+
function formDataToJSON(formData) {
|
|
2164
|
+
function buildPath(path, value, target, index) {
|
|
2165
|
+
let name = path[index++];
|
|
2081
2166
|
|
|
2082
|
-
|
|
2083
|
-
const key = utils$1.findKey(self, _header);
|
|
2167
|
+
if (name === '__proto__') return true;
|
|
2084
2168
|
|
|
2085
|
-
|
|
2086
|
-
|
|
2169
|
+
const isNumericKey = Number.isFinite(+name);
|
|
2170
|
+
const isLast = index >= path.length;
|
|
2171
|
+
name = !name && utils$1.isArray(target) ? target.length : name;
|
|
2087
2172
|
|
|
2088
|
-
|
|
2089
|
-
|
|
2173
|
+
if (isLast) {
|
|
2174
|
+
if (utils$1.hasOwnProp(target, name)) {
|
|
2175
|
+
target[name] = utils$1.isArray(target[name])
|
|
2176
|
+
? target[name].concat(value)
|
|
2177
|
+
: [target[name], value];
|
|
2178
|
+
} else {
|
|
2179
|
+
target[name] = value;
|
|
2090
2180
|
}
|
|
2091
|
-
}
|
|
2092
2181
|
|
|
2093
|
-
|
|
2094
|
-
header.forEach(deleteHeader);
|
|
2095
|
-
} else {
|
|
2096
|
-
deleteHeader(header);
|
|
2182
|
+
return !isNumericKey;
|
|
2097
2183
|
}
|
|
2098
2184
|
|
|
2099
|
-
|
|
2100
|
-
|
|
2185
|
+
if (!utils$1.hasOwnProp(target, name) || !utils$1.isObject(target[name])) {
|
|
2186
|
+
target[name] = [];
|
|
2187
|
+
}
|
|
2101
2188
|
|
|
2102
|
-
|
|
2103
|
-
const keys = Object.keys(this);
|
|
2104
|
-
let i = keys.length;
|
|
2105
|
-
let deleted = false;
|
|
2189
|
+
const result = buildPath(path, value, target[name], index);
|
|
2106
2190
|
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
|
|
2110
|
-
delete this[key];
|
|
2111
|
-
deleted = true;
|
|
2112
|
-
}
|
|
2191
|
+
if (result && utils$1.isArray(target[name])) {
|
|
2192
|
+
target[name] = arrayToObject(target[name]);
|
|
2113
2193
|
}
|
|
2114
2194
|
|
|
2115
|
-
return
|
|
2195
|
+
return !isNumericKey;
|
|
2116
2196
|
}
|
|
2117
2197
|
|
|
2118
|
-
|
|
2119
|
-
const
|
|
2120
|
-
const headers = {};
|
|
2198
|
+
if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {
|
|
2199
|
+
const obj = {};
|
|
2121
2200
|
|
|
2122
|
-
utils$1.
|
|
2123
|
-
|
|
2201
|
+
utils$1.forEachEntry(formData, (name, value) => {
|
|
2202
|
+
buildPath(parsePropPath(name), value, obj, 0);
|
|
2203
|
+
});
|
|
2124
2204
|
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
delete self[header];
|
|
2128
|
-
return;
|
|
2129
|
-
}
|
|
2205
|
+
return obj;
|
|
2206
|
+
}
|
|
2130
2207
|
|
|
2131
|
-
|
|
2208
|
+
return null;
|
|
2209
|
+
}
|
|
2132
2210
|
|
|
2133
|
-
|
|
2134
|
-
delete self[header];
|
|
2135
|
-
}
|
|
2211
|
+
const own = (obj, key) => (obj != null && utils$1.hasOwnProp(obj, key) ? obj[key] : undefined);
|
|
2136
2212
|
|
|
2137
|
-
|
|
2213
|
+
/**
|
|
2214
|
+
* It takes a string, tries to parse it, and if it fails, it returns the stringified version
|
|
2215
|
+
* of the input
|
|
2216
|
+
*
|
|
2217
|
+
* @param {any} rawValue - The value to be stringified.
|
|
2218
|
+
* @param {Function} parser - A function that parses a string into a JavaScript object.
|
|
2219
|
+
* @param {Function} encoder - A function that takes a value and returns a string.
|
|
2220
|
+
*
|
|
2221
|
+
* @returns {string} A stringified version of the rawValue.
|
|
2222
|
+
*/
|
|
2223
|
+
function stringifySafely(rawValue, parser, encoder) {
|
|
2224
|
+
if (utils$1.isString(rawValue)) {
|
|
2225
|
+
try {
|
|
2226
|
+
(0, JSON.parse)(rawValue);
|
|
2227
|
+
return utils$1.trim(rawValue);
|
|
2228
|
+
} catch (e) {
|
|
2229
|
+
if (e.name !== 'SyntaxError') {
|
|
2230
|
+
throw e;
|
|
2231
|
+
}
|
|
2232
|
+
}
|
|
2233
|
+
}
|
|
2138
2234
|
|
|
2139
|
-
|
|
2140
|
-
|
|
2235
|
+
return (encoder || JSON.stringify)(rawValue);
|
|
2236
|
+
}
|
|
2141
2237
|
|
|
2142
|
-
|
|
2143
|
-
|
|
2238
|
+
const defaults = {
|
|
2239
|
+
transitional: transitionalDefaults,
|
|
2144
2240
|
|
|
2145
|
-
|
|
2146
|
-
return this.constructor.concat(this, ...targets);
|
|
2147
|
-
}
|
|
2241
|
+
adapter: ['xhr', 'http', 'fetch'],
|
|
2148
2242
|
|
|
2149
|
-
|
|
2150
|
-
|
|
2243
|
+
transformRequest: [
|
|
2244
|
+
function transformRequest(data, headers) {
|
|
2245
|
+
const contentType = headers.getContentType() || '';
|
|
2246
|
+
const hasJSONContentType = contentType.indexOf('application/json') > -1;
|
|
2247
|
+
const isObjectPayload = utils$1.isObject(data);
|
|
2151
2248
|
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
(obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value);
|
|
2156
|
-
});
|
|
2249
|
+
if (isObjectPayload && utils$1.isHTMLForm(data)) {
|
|
2250
|
+
data = new FormData(data);
|
|
2251
|
+
}
|
|
2157
2252
|
|
|
2158
|
-
|
|
2159
|
-
}
|
|
2253
|
+
const isFormData = utils$1.isFormData(data);
|
|
2160
2254
|
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2255
|
+
if (isFormData) {
|
|
2256
|
+
return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
|
|
2257
|
+
}
|
|
2164
2258
|
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2259
|
+
if (
|
|
2260
|
+
utils$1.isArrayBuffer(data) ||
|
|
2261
|
+
utils$1.isBuffer(data) ||
|
|
2262
|
+
utils$1.isStream(data) ||
|
|
2263
|
+
utils$1.isFile(data) ||
|
|
2264
|
+
utils$1.isBlob(data) ||
|
|
2265
|
+
utils$1.isReadableStream(data)
|
|
2266
|
+
) {
|
|
2267
|
+
return data;
|
|
2268
|
+
}
|
|
2269
|
+
if (utils$1.isArrayBufferView(data)) {
|
|
2270
|
+
return data.buffer;
|
|
2271
|
+
}
|
|
2272
|
+
if (utils$1.isURLSearchParams(data)) {
|
|
2273
|
+
headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
|
|
2274
|
+
return data.toString();
|
|
2275
|
+
}
|
|
2170
2276
|
|
|
2171
|
-
|
|
2172
|
-
return this.get('set-cookie') || [];
|
|
2173
|
-
}
|
|
2277
|
+
let isFileList;
|
|
2174
2278
|
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2279
|
+
if (isObjectPayload) {
|
|
2280
|
+
const formSerializer = own(this, 'formSerializer');
|
|
2281
|
+
if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
|
|
2282
|
+
return toURLEncodedForm(data, formSerializer).toString();
|
|
2283
|
+
}
|
|
2178
2284
|
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2285
|
+
if (
|
|
2286
|
+
(isFileList = utils$1.isFileList(data)) ||
|
|
2287
|
+
contentType.indexOf('multipart/form-data') > -1
|
|
2288
|
+
) {
|
|
2289
|
+
const env = own(this, 'env');
|
|
2290
|
+
const _FormData = env && env.FormData;
|
|
2182
2291
|
|
|
2183
|
-
|
|
2184
|
-
|
|
2292
|
+
return toFormData(
|
|
2293
|
+
isFileList ? { 'files[]': data } : data,
|
|
2294
|
+
_FormData && new _FormData(),
|
|
2295
|
+
formSerializer
|
|
2296
|
+
);
|
|
2297
|
+
}
|
|
2298
|
+
}
|
|
2185
2299
|
|
|
2186
|
-
|
|
2300
|
+
if (isObjectPayload || hasJSONContentType) {
|
|
2301
|
+
headers.setContentType('application/json', false);
|
|
2302
|
+
return stringifySafely(data);
|
|
2303
|
+
}
|
|
2187
2304
|
|
|
2188
|
-
|
|
2189
|
-
|
|
2305
|
+
return data;
|
|
2306
|
+
},
|
|
2307
|
+
],
|
|
2190
2308
|
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
(this
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
});
|
|
2309
|
+
transformResponse: [
|
|
2310
|
+
function transformResponse(data) {
|
|
2311
|
+
const transitional = own(this, 'transitional') || defaults.transitional;
|
|
2312
|
+
const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
|
|
2313
|
+
const responseType = own(this, 'responseType');
|
|
2314
|
+
const JSONRequested = responseType === 'json';
|
|
2198
2315
|
|
|
2199
|
-
|
|
2200
|
-
|
|
2316
|
+
if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
|
|
2317
|
+
return data;
|
|
2318
|
+
}
|
|
2201
2319
|
|
|
2202
|
-
|
|
2203
|
-
|
|
2320
|
+
if (
|
|
2321
|
+
data &&
|
|
2322
|
+
utils$1.isString(data) &&
|
|
2323
|
+
((forcedJSONParsing && !responseType) || JSONRequested)
|
|
2324
|
+
) {
|
|
2325
|
+
const silentJSONParsing = transitional && transitional.silentJSONParsing;
|
|
2326
|
+
const strictJSONParsing = !silentJSONParsing && JSONRequested;
|
|
2204
2327
|
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2328
|
+
try {
|
|
2329
|
+
return JSON.parse(data, own(this, 'parseReviver'));
|
|
2330
|
+
} catch (e) {
|
|
2331
|
+
if (strictJSONParsing) {
|
|
2332
|
+
if (e.name === 'SyntaxError') {
|
|
2333
|
+
throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, own(this, 'response'));
|
|
2334
|
+
}
|
|
2335
|
+
throw e;
|
|
2336
|
+
}
|
|
2337
|
+
}
|
|
2208
2338
|
}
|
|
2209
|
-
}
|
|
2210
2339
|
|
|
2211
|
-
|
|
2340
|
+
return data;
|
|
2341
|
+
},
|
|
2342
|
+
],
|
|
2212
2343
|
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2344
|
+
/**
|
|
2345
|
+
* A timeout in milliseconds to abort a request. If set to 0 (default) a
|
|
2346
|
+
* timeout is not created.
|
|
2347
|
+
*/
|
|
2348
|
+
timeout: 0,
|
|
2216
2349
|
|
|
2217
|
-
|
|
2218
|
-
'
|
|
2219
|
-
'Content-Length',
|
|
2220
|
-
'Accept',
|
|
2221
|
-
'Accept-Encoding',
|
|
2222
|
-
'User-Agent',
|
|
2223
|
-
'Authorization',
|
|
2224
|
-
]);
|
|
2350
|
+
xsrfCookieName: 'XSRF-TOKEN',
|
|
2351
|
+
xsrfHeaderName: 'X-XSRF-TOKEN',
|
|
2225
2352
|
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2353
|
+
maxContentLength: -1,
|
|
2354
|
+
maxBodyLength: -1,
|
|
2355
|
+
|
|
2356
|
+
env: {
|
|
2357
|
+
FormData: platform.classes.FormData,
|
|
2358
|
+
Blob: platform.classes.Blob,
|
|
2359
|
+
},
|
|
2360
|
+
|
|
2361
|
+
validateStatus: function validateStatus(status) {
|
|
2362
|
+
return status >= 200 && status < 300;
|
|
2363
|
+
},
|
|
2364
|
+
|
|
2365
|
+
headers: {
|
|
2366
|
+
common: {
|
|
2367
|
+
Accept: 'application/json, text/plain, */*',
|
|
2368
|
+
'Content-Type': undefined,
|
|
2233
2369
|
},
|
|
2234
|
-
}
|
|
2235
|
-
}
|
|
2370
|
+
},
|
|
2371
|
+
};
|
|
2236
2372
|
|
|
2237
|
-
utils$1.
|
|
2373
|
+
utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'query'], (method) => {
|
|
2374
|
+
defaults.headers[method] = {};
|
|
2375
|
+
});
|
|
2238
2376
|
|
|
2239
2377
|
/**
|
|
2240
2378
|
* Transform the data for a request or a response
|
|
@@ -2294,22 +2432,18 @@ function requireAxios () {
|
|
|
2294
2432
|
if (!response.status || !validateStatus || validateStatus(response.status)) {
|
|
2295
2433
|
resolve(response);
|
|
2296
2434
|
} else {
|
|
2297
|
-
reject(
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
response.request,
|
|
2305
|
-
response
|
|
2306
|
-
)
|
|
2307
|
-
);
|
|
2435
|
+
reject(new AxiosError(
|
|
2436
|
+
'Request failed with status code ' + response.status,
|
|
2437
|
+
response.status >= 400 && response.status < 500 ? AxiosError.ERR_BAD_REQUEST : AxiosError.ERR_BAD_RESPONSE,
|
|
2438
|
+
response.config,
|
|
2439
|
+
response.request,
|
|
2440
|
+
response
|
|
2441
|
+
));
|
|
2308
2442
|
}
|
|
2309
2443
|
}
|
|
2310
2444
|
|
|
2311
2445
|
function parseProtocol(url) {
|
|
2312
|
-
const match = /^([-+\w]{1,25})(
|
|
2446
|
+
const match = /^([-+\w]{1,25}):(?:\/\/)?/.exec(url);
|
|
2313
2447
|
return (match && match[1]) || '';
|
|
2314
2448
|
}
|
|
2315
2449
|
|
|
@@ -2413,13 +2547,16 @@ function requireAxios () {
|
|
|
2413
2547
|
const _speedometer = speedometer(50, 250);
|
|
2414
2548
|
|
|
2415
2549
|
return throttle((e) => {
|
|
2416
|
-
|
|
2550
|
+
if (!e || typeof e.loaded !== 'number') {
|
|
2551
|
+
return;
|
|
2552
|
+
}
|
|
2553
|
+
const rawLoaded = e.loaded;
|
|
2417
2554
|
const total = e.lengthComputable ? e.total : undefined;
|
|
2418
|
-
const
|
|
2555
|
+
const loaded = total != null ? Math.min(rawLoaded, total) : rawLoaded;
|
|
2556
|
+
const progressBytes = Math.max(0, loaded - bytesNotified);
|
|
2419
2557
|
const rate = _speedometer(progressBytes);
|
|
2420
|
-
const inRange = loaded <= total;
|
|
2421
2558
|
|
|
2422
|
-
bytesNotified = loaded;
|
|
2559
|
+
bytesNotified = Math.max(bytesNotified, loaded);
|
|
2423
2560
|
|
|
2424
2561
|
const data = {
|
|
2425
2562
|
loaded,
|
|
@@ -2427,7 +2564,7 @@ function requireAxios () {
|
|
|
2427
2564
|
progress: total ? loaded / total : undefined,
|
|
2428
2565
|
bytes: progressBytes,
|
|
2429
2566
|
rate: rate ? rate : undefined,
|
|
2430
|
-
estimated: rate && total
|
|
2567
|
+
estimated: rate && total ? (total - loaded) / rate : undefined,
|
|
2431
2568
|
event: e,
|
|
2432
2569
|
lengthComputable: total != null,
|
|
2433
2570
|
[isDownloadStream ? 'download' : 'upload']: true,
|
|
@@ -2500,8 +2637,20 @@ function requireAxios () {
|
|
|
2500
2637
|
|
|
2501
2638
|
read(name) {
|
|
2502
2639
|
if (typeof document === 'undefined') return null;
|
|
2503
|
-
|
|
2504
|
-
|
|
2640
|
+
// Match name=value by splitting on the semicolon separator instead of building a
|
|
2641
|
+
// RegExp from `name` — interpolating an unescaped string into a RegExp would let
|
|
2642
|
+
// metacharacters (e.g. `.+?` in an attacker-influenced cookie name) cause ReDoS or
|
|
2643
|
+
// match the wrong cookie. Browsers may serialize cookie pairs as either ";" or
|
|
2644
|
+
// "; ", so ignore optional whitespace before each cookie name.
|
|
2645
|
+
const cookies = document.cookie.split(';');
|
|
2646
|
+
for (let i = 0; i < cookies.length; i++) {
|
|
2647
|
+
const cookie = cookies[i].replace(/^\s+/, '');
|
|
2648
|
+
const eq = cookie.indexOf('=');
|
|
2649
|
+
if (eq !== -1 && cookie.slice(0, eq) === name) {
|
|
2650
|
+
return decodeURIComponent(cookie.slice(eq + 1));
|
|
2651
|
+
}
|
|
2652
|
+
}
|
|
2653
|
+
return null;
|
|
2505
2654
|
},
|
|
2506
2655
|
|
|
2507
2656
|
remove(name) {
|
|
@@ -2561,7 +2710,7 @@ function requireAxios () {
|
|
|
2561
2710
|
*/
|
|
2562
2711
|
function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
|
|
2563
2712
|
let isRelativeUrl = !isAbsoluteURL(requestedURL);
|
|
2564
|
-
if (baseURL && (isRelativeUrl || allowAbsoluteUrls
|
|
2713
|
+
if (baseURL && (isRelativeUrl || allowAbsoluteUrls === false)) {
|
|
2565
2714
|
return combineURLs(baseURL, requestedURL);
|
|
2566
2715
|
}
|
|
2567
2716
|
return requestedURL;
|
|
@@ -2581,7 +2730,21 @@ function requireAxios () {
|
|
|
2581
2730
|
function mergeConfig(config1, config2) {
|
|
2582
2731
|
// eslint-disable-next-line no-param-reassign
|
|
2583
2732
|
config2 = config2 || {};
|
|
2584
|
-
|
|
2733
|
+
|
|
2734
|
+
// Use a null-prototype object so that downstream reads such as `config.auth`
|
|
2735
|
+
// or `config.baseURL` cannot inherit polluted values from Object.prototype.
|
|
2736
|
+
// `hasOwnProperty` is restored as a non-enumerable own slot to preserve
|
|
2737
|
+
// ergonomics for user code that relies on it.
|
|
2738
|
+
const config = Object.create(null);
|
|
2739
|
+
Object.defineProperty(config, 'hasOwnProperty', {
|
|
2740
|
+
// Null-proto descriptor so a polluted Object.prototype.get cannot turn
|
|
2741
|
+
// this data descriptor into an accessor descriptor on the way in.
|
|
2742
|
+
__proto__: null,
|
|
2743
|
+
value: Object.prototype.hasOwnProperty,
|
|
2744
|
+
enumerable: false,
|
|
2745
|
+
writable: true,
|
|
2746
|
+
configurable: true,
|
|
2747
|
+
});
|
|
2585
2748
|
|
|
2586
2749
|
function getMergedValue(target, source, prop, caseless) {
|
|
2587
2750
|
if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
|
|
@@ -2620,9 +2783,9 @@ function requireAxios () {
|
|
|
2620
2783
|
|
|
2621
2784
|
// eslint-disable-next-line consistent-return
|
|
2622
2785
|
function mergeDirectKeys(a, b, prop) {
|
|
2623
|
-
if (prop
|
|
2786
|
+
if (utils$1.hasOwnProp(config2, prop)) {
|
|
2624
2787
|
return getMergedValue(a, b);
|
|
2625
|
-
} else if (prop
|
|
2788
|
+
} else if (utils$1.hasOwnProp(config1, prop)) {
|
|
2626
2789
|
return getMergedValue(undefined, a);
|
|
2627
2790
|
}
|
|
2628
2791
|
}
|
|
@@ -2654,6 +2817,7 @@ function requireAxios () {
|
|
|
2654
2817
|
httpsAgent: defaultToConfig2,
|
|
2655
2818
|
cancelToken: defaultToConfig2,
|
|
2656
2819
|
socketPath: defaultToConfig2,
|
|
2820
|
+
allowedSocketPaths: defaultToConfig2,
|
|
2657
2821
|
responseEncoding: defaultToConfig2,
|
|
2658
2822
|
validateStatus: mergeDirectKeys,
|
|
2659
2823
|
headers: (a, b, prop) =>
|
|
@@ -2663,22 +2827,64 @@ function requireAxios () {
|
|
|
2663
2827
|
utils$1.forEach(Object.keys({ ...config1, ...config2 }), function computeConfigValue(prop) {
|
|
2664
2828
|
if (prop === '__proto__' || prop === 'constructor' || prop === 'prototype') return;
|
|
2665
2829
|
const merge = utils$1.hasOwnProp(mergeMap, prop) ? mergeMap[prop] : mergeDeepProperties;
|
|
2666
|
-
const
|
|
2830
|
+
const a = utils$1.hasOwnProp(config1, prop) ? config1[prop] : undefined;
|
|
2831
|
+
const b = utils$1.hasOwnProp(config2, prop) ? config2[prop] : undefined;
|
|
2832
|
+
const configValue = merge(a, b, prop);
|
|
2667
2833
|
(utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
|
2668
2834
|
});
|
|
2669
2835
|
|
|
2670
2836
|
return config;
|
|
2671
2837
|
}
|
|
2672
2838
|
|
|
2839
|
+
const FORM_DATA_CONTENT_HEADERS = ['content-type', 'content-length'];
|
|
2840
|
+
|
|
2841
|
+
function setFormDataHeaders(headers, formHeaders, policy) {
|
|
2842
|
+
if (policy !== 'content-only') {
|
|
2843
|
+
headers.set(formHeaders);
|
|
2844
|
+
return;
|
|
2845
|
+
}
|
|
2846
|
+
|
|
2847
|
+
Object.entries(formHeaders).forEach(([key, val]) => {
|
|
2848
|
+
if (FORM_DATA_CONTENT_HEADERS.includes(key.toLowerCase())) {
|
|
2849
|
+
headers.set(key, val);
|
|
2850
|
+
}
|
|
2851
|
+
});
|
|
2852
|
+
}
|
|
2853
|
+
|
|
2854
|
+
/**
|
|
2855
|
+
* Encode a UTF-8 string to a Latin-1 byte string for use with btoa().
|
|
2856
|
+
* This is a modern replacement for the deprecated unescape(encodeURIComponent(str)) pattern.
|
|
2857
|
+
*
|
|
2858
|
+
* @param {string} str The string to encode
|
|
2859
|
+
*
|
|
2860
|
+
* @returns {string} UTF-8 bytes as a Latin-1 string
|
|
2861
|
+
*/
|
|
2862
|
+
const encodeUTF8 = (str) =>
|
|
2863
|
+
encodeURIComponent(str).replace(/%([0-9A-F]{2})/gi, (_, hex) =>
|
|
2864
|
+
String.fromCharCode(parseInt(hex, 16))
|
|
2865
|
+
);
|
|
2866
|
+
|
|
2673
2867
|
var resolveConfig = (config) => {
|
|
2674
2868
|
const newConfig = mergeConfig({}, config);
|
|
2675
2869
|
|
|
2676
|
-
|
|
2870
|
+
// Read only own properties to prevent prototype pollution gadgets
|
|
2871
|
+
// (e.g. Object.prototype.baseURL = 'https://evil.com').
|
|
2872
|
+
const own = (key) => (utils$1.hasOwnProp(newConfig, key) ? newConfig[key] : undefined);
|
|
2873
|
+
|
|
2874
|
+
const data = own('data');
|
|
2875
|
+
let withXSRFToken = own('withXSRFToken');
|
|
2876
|
+
const xsrfHeaderName = own('xsrfHeaderName');
|
|
2877
|
+
const xsrfCookieName = own('xsrfCookieName');
|
|
2878
|
+
let headers = own('headers');
|
|
2879
|
+
const auth = own('auth');
|
|
2880
|
+
const baseURL = own('baseURL');
|
|
2881
|
+
const allowAbsoluteUrls = own('allowAbsoluteUrls');
|
|
2882
|
+
const url = own('url');
|
|
2677
2883
|
|
|
2678
2884
|
newConfig.headers = headers = AxiosHeaders.from(headers);
|
|
2679
2885
|
|
|
2680
2886
|
newConfig.url = buildURL(
|
|
2681
|
-
buildFullPath(
|
|
2887
|
+
buildFullPath(baseURL, url, allowAbsoluteUrls),
|
|
2682
2888
|
config.params,
|
|
2683
2889
|
config.paramsSerializer
|
|
2684
2890
|
);
|
|
@@ -2688,11 +2894,7 @@ function requireAxios () {
|
|
|
2688
2894
|
headers.set(
|
|
2689
2895
|
'Authorization',
|
|
2690
2896
|
'Basic ' +
|
|
2691
|
-
btoa(
|
|
2692
|
-
(auth.username || '') +
|
|
2693
|
-
':' +
|
|
2694
|
-
(auth.password ? unescape(encodeURIComponent(auth.password)) : '')
|
|
2695
|
-
)
|
|
2897
|
+
btoa((auth.username || '') + ':' + (auth.password ? encodeUTF8(auth.password) : ''))
|
|
2696
2898
|
);
|
|
2697
2899
|
}
|
|
2698
2900
|
|
|
@@ -2701,14 +2903,7 @@ function requireAxios () {
|
|
|
2701
2903
|
headers.setContentType(undefined); // browser handles it
|
|
2702
2904
|
} else if (utils$1.isFunction(data.getHeaders)) {
|
|
2703
2905
|
// Node.js FormData (like form-data package)
|
|
2704
|
-
|
|
2705
|
-
// Only set safe headers to avoid overwriting security headers
|
|
2706
|
-
const allowedHeaders = ['content-type', 'content-length'];
|
|
2707
|
-
Object.entries(formHeaders).forEach(([key, val]) => {
|
|
2708
|
-
if (allowedHeaders.includes(key.toLowerCase())) {
|
|
2709
|
-
headers.set(key, val);
|
|
2710
|
-
}
|
|
2711
|
-
});
|
|
2906
|
+
setFormDataHeaders(headers, data.getHeaders(), own('formDataHeaderPolicy'));
|
|
2712
2907
|
}
|
|
2713
2908
|
}
|
|
2714
2909
|
|
|
@@ -2717,10 +2912,17 @@ function requireAxios () {
|
|
|
2717
2912
|
// Specifically not if we're in a web worker, or react-native.
|
|
2718
2913
|
|
|
2719
2914
|
if (platform.hasStandardBrowserEnv) {
|
|
2720
|
-
|
|
2915
|
+
if (utils$1.isFunction(withXSRFToken)) {
|
|
2916
|
+
withXSRFToken = withXSRFToken(newConfig);
|
|
2917
|
+
}
|
|
2721
2918
|
|
|
2722
|
-
|
|
2723
|
-
|
|
2919
|
+
// Strict boolean check — prevents proto-pollution gadgets (e.g. Object.prototype.withXSRFToken = 1)
|
|
2920
|
+
// and misconfigurations (e.g. "false") from short-circuiting the same-origin check and leaking
|
|
2921
|
+
// the XSRF token cross-origin.
|
|
2922
|
+
const shouldSendXSRF =
|
|
2923
|
+
withXSRFToken === true || (withXSRFToken == null && isURLSameOrigin(newConfig.url));
|
|
2924
|
+
|
|
2925
|
+
if (shouldSendXSRF) {
|
|
2724
2926
|
const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
|
|
2725
2927
|
|
|
2726
2928
|
if (xsrfValue) {
|
|
@@ -2814,7 +3016,7 @@ function requireAxios () {
|
|
|
2814
3016
|
// will return status as 0 even though it's a successful request
|
|
2815
3017
|
if (
|
|
2816
3018
|
request.status === 0 &&
|
|
2817
|
-
!(request.responseURL && request.responseURL.
|
|
3019
|
+
!(request.responseURL && request.responseURL.startsWith('file:'))
|
|
2818
3020
|
) {
|
|
2819
3021
|
return;
|
|
2820
3022
|
}
|
|
@@ -2831,6 +3033,7 @@ function requireAxios () {
|
|
|
2831
3033
|
}
|
|
2832
3034
|
|
|
2833
3035
|
reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, config, request));
|
|
3036
|
+
done();
|
|
2834
3037
|
|
|
2835
3038
|
// Clean up request
|
|
2836
3039
|
request = null;
|
|
@@ -2846,6 +3049,7 @@ function requireAxios () {
|
|
|
2846
3049
|
// attach the underlying event for consumers who want details
|
|
2847
3050
|
err.event = event || null;
|
|
2848
3051
|
reject(err);
|
|
3052
|
+
done();
|
|
2849
3053
|
request = null;
|
|
2850
3054
|
};
|
|
2851
3055
|
|
|
@@ -2866,6 +3070,7 @@ function requireAxios () {
|
|
|
2866
3070
|
request
|
|
2867
3071
|
)
|
|
2868
3072
|
);
|
|
3073
|
+
done();
|
|
2869
3074
|
|
|
2870
3075
|
// Clean up request
|
|
2871
3076
|
request = null;
|
|
@@ -2876,7 +3081,7 @@ function requireAxios () {
|
|
|
2876
3081
|
|
|
2877
3082
|
// Add headers to the request
|
|
2878
3083
|
if ('setRequestHeader' in request) {
|
|
2879
|
-
utils$1.forEach(requestHeaders
|
|
3084
|
+
utils$1.forEach(toByteStringHeaderObject(requestHeaders), function setRequestHeader(val, key) {
|
|
2880
3085
|
request.setRequestHeader(key, val);
|
|
2881
3086
|
});
|
|
2882
3087
|
}
|
|
@@ -2915,6 +3120,7 @@ function requireAxios () {
|
|
|
2915
3120
|
}
|
|
2916
3121
|
reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);
|
|
2917
3122
|
request.abort();
|
|
3123
|
+
done();
|
|
2918
3124
|
request = null;
|
|
2919
3125
|
};
|
|
2920
3126
|
|
|
@@ -2928,7 +3134,7 @@ function requireAxios () {
|
|
|
2928
3134
|
|
|
2929
3135
|
const protocol = parseProtocol(_config.url);
|
|
2930
3136
|
|
|
2931
|
-
if (protocol && platform.protocols.
|
|
3137
|
+
if (protocol && !platform.protocols.includes(protocol)) {
|
|
2932
3138
|
reject(
|
|
2933
3139
|
new AxiosError(
|
|
2934
3140
|
'Unsupported protocol ' + protocol + ':',
|
|
@@ -2945,54 +3151,55 @@ function requireAxios () {
|
|
|
2945
3151
|
};
|
|
2946
3152
|
|
|
2947
3153
|
const composeSignals = (signals, timeout) => {
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
if (timeout || length) {
|
|
2951
|
-
let controller = new AbortController();
|
|
2952
|
-
|
|
2953
|
-
let aborted;
|
|
2954
|
-
|
|
2955
|
-
const onabort = function (reason) {
|
|
2956
|
-
if (!aborted) {
|
|
2957
|
-
aborted = true;
|
|
2958
|
-
unsubscribe();
|
|
2959
|
-
const err = reason instanceof Error ? reason : this.reason;
|
|
2960
|
-
controller.abort(
|
|
2961
|
-
err instanceof AxiosError
|
|
2962
|
-
? err
|
|
2963
|
-
: new CanceledError(err instanceof Error ? err.message : err)
|
|
2964
|
-
);
|
|
2965
|
-
}
|
|
2966
|
-
};
|
|
3154
|
+
signals = signals ? signals.filter(Boolean) : [];
|
|
2967
3155
|
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
}
|
|
3156
|
+
if (!timeout && !signals.length) {
|
|
3157
|
+
return;
|
|
3158
|
+
}
|
|
3159
|
+
|
|
3160
|
+
const controller = new AbortController();
|
|
3161
|
+
|
|
3162
|
+
let aborted = false;
|
|
3163
|
+
|
|
3164
|
+
const onabort = function (reason) {
|
|
3165
|
+
if (!aborted) {
|
|
3166
|
+
aborted = true;
|
|
3167
|
+
unsubscribe();
|
|
3168
|
+
const err = reason instanceof Error ? reason : this.reason;
|
|
3169
|
+
controller.abort(
|
|
3170
|
+
err instanceof AxiosError
|
|
3171
|
+
? err
|
|
3172
|
+
: new CanceledError(err instanceof Error ? err.message : err)
|
|
3173
|
+
);
|
|
3174
|
+
}
|
|
3175
|
+
};
|
|
3176
|
+
|
|
3177
|
+
let timer =
|
|
3178
|
+
timeout &&
|
|
3179
|
+
setTimeout(() => {
|
|
3180
|
+
timer = null;
|
|
3181
|
+
onabort(new AxiosError(`timeout of ${timeout}ms exceeded`, AxiosError.ETIMEDOUT));
|
|
3182
|
+
}, timeout);
|
|
3183
|
+
|
|
3184
|
+
const unsubscribe = () => {
|
|
3185
|
+
if (!signals) { return; }
|
|
3186
|
+
timer && clearTimeout(timer);
|
|
3187
|
+
timer = null;
|
|
3188
|
+
signals.forEach((signal) => {
|
|
3189
|
+
signal.unsubscribe
|
|
3190
|
+
? signal.unsubscribe(onabort)
|
|
3191
|
+
: signal.removeEventListener('abort', onabort);
|
|
3192
|
+
});
|
|
3193
|
+
signals = null;
|
|
3194
|
+
};
|
|
2987
3195
|
|
|
2988
|
-
|
|
3196
|
+
signals.forEach((signal) => signal.addEventListener('abort', onabort));
|
|
2989
3197
|
|
|
2990
|
-
|
|
3198
|
+
const { signal } = controller;
|
|
2991
3199
|
|
|
2992
|
-
|
|
3200
|
+
signal.unsubscribe = () => utils$1.asap(unsubscribe);
|
|
2993
3201
|
|
|
2994
|
-
|
|
2995
|
-
}
|
|
3202
|
+
return signal;
|
|
2996
3203
|
};
|
|
2997
3204
|
|
|
2998
3205
|
const streamChunk = function* (chunk, chunkSize) {
|
|
@@ -3085,16 +3292,112 @@ function requireAxios () {
|
|
|
3085
3292
|
);
|
|
3086
3293
|
};
|
|
3087
3294
|
|
|
3088
|
-
|
|
3295
|
+
/**
|
|
3296
|
+
* Estimate decoded byte length of a data:// URL *without* allocating large buffers.
|
|
3297
|
+
* - For base64: compute exact decoded size using length and padding;
|
|
3298
|
+
* handle %XX at the character-count level (no string allocation).
|
|
3299
|
+
* - For non-base64: use UTF-8 byteLength of the encoded body as a safe upper bound.
|
|
3300
|
+
*
|
|
3301
|
+
* @param {string} url
|
|
3302
|
+
* @returns {number}
|
|
3303
|
+
*/
|
|
3304
|
+
function estimateDataURLDecodedBytes(url) {
|
|
3305
|
+
if (!url || typeof url !== 'string') return 0;
|
|
3306
|
+
if (!url.startsWith('data:')) return 0;
|
|
3307
|
+
|
|
3308
|
+
const comma = url.indexOf(',');
|
|
3309
|
+
if (comma < 0) return 0;
|
|
3310
|
+
|
|
3311
|
+
const meta = url.slice(5, comma);
|
|
3312
|
+
const body = url.slice(comma + 1);
|
|
3313
|
+
const isBase64 = /;base64/i.test(meta);
|
|
3314
|
+
|
|
3315
|
+
if (isBase64) {
|
|
3316
|
+
let effectiveLen = body.length;
|
|
3317
|
+
const len = body.length; // cache length
|
|
3318
|
+
|
|
3319
|
+
for (let i = 0; i < len; i++) {
|
|
3320
|
+
if (body.charCodeAt(i) === 37 /* '%' */ && i + 2 < len) {
|
|
3321
|
+
const a = body.charCodeAt(i + 1);
|
|
3322
|
+
const b = body.charCodeAt(i + 2);
|
|
3323
|
+
const isHex =
|
|
3324
|
+
((a >= 48 && a <= 57) || (a >= 65 && a <= 70) || (a >= 97 && a <= 102)) &&
|
|
3325
|
+
((b >= 48 && b <= 57) || (b >= 65 && b <= 70) || (b >= 97 && b <= 102));
|
|
3326
|
+
|
|
3327
|
+
if (isHex) {
|
|
3328
|
+
effectiveLen -= 2;
|
|
3329
|
+
i += 2;
|
|
3330
|
+
}
|
|
3331
|
+
}
|
|
3332
|
+
}
|
|
3089
3333
|
|
|
3090
|
-
|
|
3334
|
+
let pad = 0;
|
|
3335
|
+
let idx = len - 1;
|
|
3336
|
+
|
|
3337
|
+
const tailIsPct3D = (j) =>
|
|
3338
|
+
j >= 2 &&
|
|
3339
|
+
body.charCodeAt(j - 2) === 37 && // '%'
|
|
3340
|
+
body.charCodeAt(j - 1) === 51 && // '3'
|
|
3341
|
+
(body.charCodeAt(j) === 68 || body.charCodeAt(j) === 100); // 'D' or 'd'
|
|
3342
|
+
|
|
3343
|
+
if (idx >= 0) {
|
|
3344
|
+
if (body.charCodeAt(idx) === 61 /* '=' */) {
|
|
3345
|
+
pad++;
|
|
3346
|
+
idx--;
|
|
3347
|
+
} else if (tailIsPct3D(idx)) {
|
|
3348
|
+
pad++;
|
|
3349
|
+
idx -= 3;
|
|
3350
|
+
}
|
|
3351
|
+
}
|
|
3352
|
+
|
|
3353
|
+
if (pad === 1 && idx >= 0) {
|
|
3354
|
+
if (body.charCodeAt(idx) === 61 /* '=' */) {
|
|
3355
|
+
pad++;
|
|
3356
|
+
} else if (tailIsPct3D(idx)) {
|
|
3357
|
+
pad++;
|
|
3358
|
+
}
|
|
3359
|
+
}
|
|
3360
|
+
|
|
3361
|
+
const groups = Math.floor(effectiveLen / 4);
|
|
3362
|
+
const bytes = groups * 3 - (pad || 0);
|
|
3363
|
+
return bytes > 0 ? bytes : 0;
|
|
3364
|
+
}
|
|
3365
|
+
|
|
3366
|
+
if (typeof Buffer !== 'undefined' && typeof Buffer.byteLength === 'function') {
|
|
3367
|
+
return Buffer.byteLength(body, 'utf8');
|
|
3368
|
+
}
|
|
3369
|
+
|
|
3370
|
+
// Compute UTF-8 byte length directly from UTF-16 code units without allocating
|
|
3371
|
+
// a byte buffer (TextEncoder.encode would defeat the DoS guard on large bodies).
|
|
3372
|
+
// Using body.length here would undercount non-ASCII (e.g. '€' is 1 code unit
|
|
3373
|
+
// but 3 UTF-8 bytes).
|
|
3374
|
+
let bytes = 0;
|
|
3375
|
+
for (let i = 0, len = body.length; i < len; i++) {
|
|
3376
|
+
const c = body.charCodeAt(i);
|
|
3377
|
+
if (c < 0x80) {
|
|
3378
|
+
bytes += 1;
|
|
3379
|
+
} else if (c < 0x800) {
|
|
3380
|
+
bytes += 2;
|
|
3381
|
+
} else if (c >= 0xd800 && c <= 0xdbff && i + 1 < len) {
|
|
3382
|
+
const next = body.charCodeAt(i + 1);
|
|
3383
|
+
if (next >= 0xdc00 && next <= 0xdfff) {
|
|
3384
|
+
bytes += 4;
|
|
3385
|
+
i++;
|
|
3386
|
+
} else {
|
|
3387
|
+
bytes += 3;
|
|
3388
|
+
}
|
|
3389
|
+
} else {
|
|
3390
|
+
bytes += 3;
|
|
3391
|
+
}
|
|
3392
|
+
}
|
|
3393
|
+
return bytes;
|
|
3394
|
+
}
|
|
3395
|
+
|
|
3396
|
+
const VERSION = "1.16.1";
|
|
3091
3397
|
|
|
3092
|
-
const
|
|
3093
|
-
Request,
|
|
3094
|
-
Response,
|
|
3095
|
-
}))(utils$1.global);
|
|
3398
|
+
const DEFAULT_CHUNK_SIZE = 64 * 1024;
|
|
3096
3399
|
|
|
3097
|
-
const {
|
|
3400
|
+
const { isFunction } = utils$1;
|
|
3098
3401
|
|
|
3099
3402
|
const test = (fn, ...args) => {
|
|
3100
3403
|
try {
|
|
@@ -3105,11 +3408,20 @@ function requireAxios () {
|
|
|
3105
3408
|
};
|
|
3106
3409
|
|
|
3107
3410
|
const factory = (env) => {
|
|
3411
|
+
const globalObject =
|
|
3412
|
+
utils$1.global !== undefined && utils$1.global !== null
|
|
3413
|
+
? utils$1.global
|
|
3414
|
+
: globalThis;
|
|
3415
|
+
const { ReadableStream, TextEncoder } = globalObject;
|
|
3416
|
+
|
|
3108
3417
|
env = utils$1.merge.call(
|
|
3109
3418
|
{
|
|
3110
3419
|
skipUndefined: true,
|
|
3111
3420
|
},
|
|
3112
|
-
|
|
3421
|
+
{
|
|
3422
|
+
Request: globalObject.Request,
|
|
3423
|
+
Response: globalObject.Response,
|
|
3424
|
+
},
|
|
3113
3425
|
env
|
|
3114
3426
|
);
|
|
3115
3427
|
|
|
@@ -3122,7 +3434,7 @@ function requireAxios () {
|
|
|
3122
3434
|
return false;
|
|
3123
3435
|
}
|
|
3124
3436
|
|
|
3125
|
-
const isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream
|
|
3437
|
+
const isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream);
|
|
3126
3438
|
|
|
3127
3439
|
const encodeText =
|
|
3128
3440
|
isFetchSupported &&
|
|
@@ -3139,18 +3451,20 @@ function requireAxios () {
|
|
|
3139
3451
|
test(() => {
|
|
3140
3452
|
let duplexAccessed = false;
|
|
3141
3453
|
|
|
3142
|
-
const
|
|
3143
|
-
|
|
3144
|
-
const hasContentType = new Request(platform.origin, {
|
|
3145
|
-
body,
|
|
3454
|
+
const request = new Request(platform.origin, {
|
|
3455
|
+
body: new ReadableStream(),
|
|
3146
3456
|
method: 'POST',
|
|
3147
3457
|
get duplex() {
|
|
3148
3458
|
duplexAccessed = true;
|
|
3149
3459
|
return 'half';
|
|
3150
3460
|
},
|
|
3151
|
-
})
|
|
3461
|
+
});
|
|
3152
3462
|
|
|
3153
|
-
|
|
3463
|
+
const hasContentType = request.headers.has('Content-Type');
|
|
3464
|
+
|
|
3465
|
+
if (request.body != null) {
|
|
3466
|
+
request.body.cancel();
|
|
3467
|
+
}
|
|
3154
3468
|
|
|
3155
3469
|
return duplexAccessed && !hasContentType;
|
|
3156
3470
|
});
|
|
@@ -3234,8 +3548,13 @@ function requireAxios () {
|
|
|
3234
3548
|
headers,
|
|
3235
3549
|
withCredentials = 'same-origin',
|
|
3236
3550
|
fetchOptions,
|
|
3551
|
+
maxContentLength,
|
|
3552
|
+
maxBodyLength,
|
|
3237
3553
|
} = resolveConfig(config);
|
|
3238
3554
|
|
|
3555
|
+
const hasMaxContentLength = utils$1.isNumber(maxContentLength) && maxContentLength > -1;
|
|
3556
|
+
const hasMaxBodyLength = utils$1.isNumber(maxBodyLength) && maxBodyLength > -1;
|
|
3557
|
+
|
|
3239
3558
|
let _fetch = envFetch || fetch;
|
|
3240
3559
|
|
|
3241
3560
|
responseType = responseType ? (responseType + '').toLowerCase() : 'text';
|
|
@@ -3257,6 +3576,41 @@ function requireAxios () {
|
|
|
3257
3576
|
let requestContentLength;
|
|
3258
3577
|
|
|
3259
3578
|
try {
|
|
3579
|
+
// Enforce maxContentLength for data: URLs up-front so we never materialize
|
|
3580
|
+
// an oversized payload. The HTTP adapter applies the same check (see http.js
|
|
3581
|
+
// "if (protocol === 'data:')" branch).
|
|
3582
|
+
if (hasMaxContentLength && typeof url === 'string' && url.startsWith('data:')) {
|
|
3583
|
+
const estimated = estimateDataURLDecodedBytes(url);
|
|
3584
|
+
if (estimated > maxContentLength) {
|
|
3585
|
+
throw new AxiosError(
|
|
3586
|
+
'maxContentLength size of ' + maxContentLength + ' exceeded',
|
|
3587
|
+
AxiosError.ERR_BAD_RESPONSE,
|
|
3588
|
+
config,
|
|
3589
|
+
request
|
|
3590
|
+
);
|
|
3591
|
+
}
|
|
3592
|
+
}
|
|
3593
|
+
|
|
3594
|
+
// Enforce maxBodyLength against the outbound request body before dispatch.
|
|
3595
|
+
// Mirrors http.js behavior (ERR_BAD_REQUEST / 'Request body larger than
|
|
3596
|
+
// maxBodyLength limit'). Skip when the body length cannot be determined
|
|
3597
|
+
// (e.g. a live ReadableStream supplied by the caller).
|
|
3598
|
+
if (hasMaxBodyLength && method !== 'get' && method !== 'head') {
|
|
3599
|
+
const outboundLength = await resolveBodyLength(headers, data);
|
|
3600
|
+
if (
|
|
3601
|
+
typeof outboundLength === 'number' &&
|
|
3602
|
+
isFinite(outboundLength) &&
|
|
3603
|
+
outboundLength > maxBodyLength
|
|
3604
|
+
) {
|
|
3605
|
+
throw new AxiosError(
|
|
3606
|
+
'Request body larger than maxBodyLength limit',
|
|
3607
|
+
AxiosError.ERR_BAD_REQUEST,
|
|
3608
|
+
config,
|
|
3609
|
+
request
|
|
3610
|
+
);
|
|
3611
|
+
}
|
|
3612
|
+
}
|
|
3613
|
+
|
|
3260
3614
|
if (
|
|
3261
3615
|
onUploadProgress &&
|
|
3262
3616
|
supportsRequestStream &&
|
|
@@ -3294,11 +3648,27 @@ function requireAxios () {
|
|
|
3294
3648
|
// see https://github.com/cloudflare/workerd/issues/902
|
|
3295
3649
|
const isCredentialsSupported = isRequestSupported && 'credentials' in Request.prototype;
|
|
3296
3650
|
|
|
3651
|
+
// If data is FormData and Content-Type is multipart/form-data without boundary,
|
|
3652
|
+
// delete it so fetch can set it correctly with the boundary
|
|
3653
|
+
if (utils$1.isFormData(data)) {
|
|
3654
|
+
const contentType = headers.getContentType();
|
|
3655
|
+
if (
|
|
3656
|
+
contentType &&
|
|
3657
|
+
/^multipart\/form-data/i.test(contentType) &&
|
|
3658
|
+
!/boundary=/i.test(contentType)
|
|
3659
|
+
) {
|
|
3660
|
+
headers.delete('content-type');
|
|
3661
|
+
}
|
|
3662
|
+
}
|
|
3663
|
+
|
|
3664
|
+
// Set User-Agent header if not already set (fetch defaults to 'node' in Node.js)
|
|
3665
|
+
headers.set('User-Agent', 'axios/' + VERSION, false);
|
|
3666
|
+
|
|
3297
3667
|
const resolvedOptions = {
|
|
3298
3668
|
...fetchOptions,
|
|
3299
3669
|
signal: composedSignal,
|
|
3300
3670
|
method: method.toUpperCase(),
|
|
3301
|
-
headers: headers.normalize()
|
|
3671
|
+
headers: toByteStringHeaderObject(headers.normalize()),
|
|
3302
3672
|
body: data,
|
|
3303
3673
|
duplex: 'half',
|
|
3304
3674
|
credentials: isCredentialsSupported ? withCredentials : undefined,
|
|
@@ -3310,10 +3680,28 @@ function requireAxios () {
|
|
|
3310
3680
|
? _fetch(request, fetchOptions)
|
|
3311
3681
|
: _fetch(url, resolvedOptions));
|
|
3312
3682
|
|
|
3683
|
+
// Cheap pre-check: if the server honestly declares a content-length that
|
|
3684
|
+
// already exceeds the cap, reject before we start streaming.
|
|
3685
|
+
if (hasMaxContentLength) {
|
|
3686
|
+
const declaredLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
|
|
3687
|
+
if (declaredLength != null && declaredLength > maxContentLength) {
|
|
3688
|
+
throw new AxiosError(
|
|
3689
|
+
'maxContentLength size of ' + maxContentLength + ' exceeded',
|
|
3690
|
+
AxiosError.ERR_BAD_RESPONSE,
|
|
3691
|
+
config,
|
|
3692
|
+
request
|
|
3693
|
+
);
|
|
3694
|
+
}
|
|
3695
|
+
}
|
|
3696
|
+
|
|
3313
3697
|
const isStreamResponse =
|
|
3314
3698
|
supportsResponseStream && (responseType === 'stream' || responseType === 'response');
|
|
3315
3699
|
|
|
3316
|
-
if (
|
|
3700
|
+
if (
|
|
3701
|
+
supportsResponseStream &&
|
|
3702
|
+
response.body &&
|
|
3703
|
+
(onDownloadProgress || hasMaxContentLength || (isStreamResponse && unsubscribe))
|
|
3704
|
+
) {
|
|
3317
3705
|
const options = {};
|
|
3318
3706
|
|
|
3319
3707
|
['status', 'statusText', 'headers'].forEach((prop) => {
|
|
@@ -3330,8 +3718,24 @@ function requireAxios () {
|
|
|
3330
3718
|
)) ||
|
|
3331
3719
|
[];
|
|
3332
3720
|
|
|
3721
|
+
let bytesRead = 0;
|
|
3722
|
+
const onChunkProgress = (loadedBytes) => {
|
|
3723
|
+
if (hasMaxContentLength) {
|
|
3724
|
+
bytesRead = loadedBytes;
|
|
3725
|
+
if (bytesRead > maxContentLength) {
|
|
3726
|
+
throw new AxiosError(
|
|
3727
|
+
'maxContentLength size of ' + maxContentLength + ' exceeded',
|
|
3728
|
+
AxiosError.ERR_BAD_RESPONSE,
|
|
3729
|
+
config,
|
|
3730
|
+
request
|
|
3731
|
+
);
|
|
3732
|
+
}
|
|
3733
|
+
}
|
|
3734
|
+
onProgress && onProgress(loadedBytes);
|
|
3735
|
+
};
|
|
3736
|
+
|
|
3333
3737
|
response = new Response(
|
|
3334
|
-
trackStream(response.body, DEFAULT_CHUNK_SIZE,
|
|
3738
|
+
trackStream(response.body, DEFAULT_CHUNK_SIZE, onChunkProgress, () => {
|
|
3335
3739
|
flush && flush();
|
|
3336
3740
|
unsubscribe && unsubscribe();
|
|
3337
3741
|
}),
|
|
@@ -3346,6 +3750,33 @@ function requireAxios () {
|
|
|
3346
3750
|
config
|
|
3347
3751
|
);
|
|
3348
3752
|
|
|
3753
|
+
// Fallback enforcement for environments without ReadableStream support
|
|
3754
|
+
// (legacy runtimes). Detect materialized size from typed output; skip
|
|
3755
|
+
// streams/Response passthrough since the user will read those themselves.
|
|
3756
|
+
if (hasMaxContentLength && !supportsResponseStream && !isStreamResponse) {
|
|
3757
|
+
let materializedSize;
|
|
3758
|
+
if (responseData != null) {
|
|
3759
|
+
if (typeof responseData.byteLength === 'number') {
|
|
3760
|
+
materializedSize = responseData.byteLength;
|
|
3761
|
+
} else if (typeof responseData.size === 'number') {
|
|
3762
|
+
materializedSize = responseData.size;
|
|
3763
|
+
} else if (typeof responseData === 'string') {
|
|
3764
|
+
materializedSize =
|
|
3765
|
+
typeof TextEncoder === 'function'
|
|
3766
|
+
? new TextEncoder().encode(responseData).byteLength
|
|
3767
|
+
: responseData.length;
|
|
3768
|
+
}
|
|
3769
|
+
}
|
|
3770
|
+
if (typeof materializedSize === 'number' && materializedSize > maxContentLength) {
|
|
3771
|
+
throw new AxiosError(
|
|
3772
|
+
'maxContentLength size of ' + maxContentLength + ' exceeded',
|
|
3773
|
+
AxiosError.ERR_BAD_RESPONSE,
|
|
3774
|
+
config,
|
|
3775
|
+
request
|
|
3776
|
+
);
|
|
3777
|
+
}
|
|
3778
|
+
}
|
|
3779
|
+
|
|
3349
3780
|
!isStreamResponse && unsubscribe && unsubscribe();
|
|
3350
3781
|
|
|
3351
3782
|
return await new Promise((resolve, reject) => {
|
|
@@ -3361,6 +3792,17 @@ function requireAxios () {
|
|
|
3361
3792
|
} catch (err) {
|
|
3362
3793
|
unsubscribe && unsubscribe();
|
|
3363
3794
|
|
|
3795
|
+
// Safari can surface fetch aborts as a DOMException-like object whose
|
|
3796
|
+
// branded getters throw. Prefer our composed signal reason before reading
|
|
3797
|
+
// the caught error, preserving timeout vs cancellation semantics.
|
|
3798
|
+
if (composedSignal && composedSignal.aborted && composedSignal.reason instanceof AxiosError) {
|
|
3799
|
+
const canceledError = composedSignal.reason;
|
|
3800
|
+
canceledError.config = config;
|
|
3801
|
+
request && (canceledError.request = request);
|
|
3802
|
+
err !== canceledError && (canceledError.cause = err);
|
|
3803
|
+
throw canceledError;
|
|
3804
|
+
}
|
|
3805
|
+
|
|
3364
3806
|
if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
|
|
3365
3807
|
throw Object.assign(
|
|
3366
3808
|
new AxiosError(
|
|
@@ -3429,11 +3871,13 @@ function requireAxios () {
|
|
|
3429
3871
|
utils$1.forEach(knownAdapters, (fn, value) => {
|
|
3430
3872
|
if (fn) {
|
|
3431
3873
|
try {
|
|
3432
|
-
Object.
|
|
3874
|
+
// Null-proto descriptors so a polluted Object.prototype.get cannot turn
|
|
3875
|
+
// these data descriptors into accessor descriptors on the way in.
|
|
3876
|
+
Object.defineProperty(fn, 'name', { __proto__: null, value });
|
|
3433
3877
|
} catch (e) {
|
|
3434
3878
|
// eslint-disable-next-line no-empty
|
|
3435
3879
|
}
|
|
3436
|
-
Object.defineProperty(fn, 'adapterName', { value });
|
|
3880
|
+
Object.defineProperty(fn, 'adapterName', { __proto__: null, value });
|
|
3437
3881
|
}
|
|
3438
3882
|
});
|
|
3439
3883
|
|
|
@@ -3575,8 +4019,15 @@ function requireAxios () {
|
|
|
3575
4019
|
function onAdapterResolution(response) {
|
|
3576
4020
|
throwIfCancellationRequested(config);
|
|
3577
4021
|
|
|
3578
|
-
//
|
|
3579
|
-
|
|
4022
|
+
// Expose the current response on config so that transformResponse can
|
|
4023
|
+
// attach it to any AxiosError it throws (e.g. on JSON parse failure).
|
|
4024
|
+
// We clean it up afterwards to avoid polluting the config object.
|
|
4025
|
+
config.response = response;
|
|
4026
|
+
try {
|
|
4027
|
+
response.data = transformData.call(config, config.transformResponse, response);
|
|
4028
|
+
} finally {
|
|
4029
|
+
delete config.response;
|
|
4030
|
+
}
|
|
3580
4031
|
|
|
3581
4032
|
response.headers = AxiosHeaders.from(response.headers);
|
|
3582
4033
|
|
|
@@ -3588,11 +4039,16 @@ function requireAxios () {
|
|
|
3588
4039
|
|
|
3589
4040
|
// Transform response data
|
|
3590
4041
|
if (reason && reason.response) {
|
|
3591
|
-
|
|
3592
|
-
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
|
|
4042
|
+
config.response = reason.response;
|
|
4043
|
+
try {
|
|
4044
|
+
reason.response.data = transformData.call(
|
|
4045
|
+
config,
|
|
4046
|
+
config.transformResponse,
|
|
4047
|
+
reason.response
|
|
4048
|
+
);
|
|
4049
|
+
} finally {
|
|
4050
|
+
delete config.response;
|
|
4051
|
+
}
|
|
3596
4052
|
reason.response.headers = AxiosHeaders.from(reason.response.headers);
|
|
3597
4053
|
}
|
|
3598
4054
|
}
|
|
@@ -3602,8 +4058,6 @@ function requireAxios () {
|
|
|
3602
4058
|
);
|
|
3603
4059
|
}
|
|
3604
4060
|
|
|
3605
|
-
const VERSION = "1.15.0";
|
|
3606
|
-
|
|
3607
4061
|
const validators$1 = {};
|
|
3608
4062
|
|
|
3609
4063
|
// eslint-disable-next-line func-names
|
|
@@ -3687,7 +4141,9 @@ function requireAxios () {
|
|
|
3687
4141
|
let i = keys.length;
|
|
3688
4142
|
while (i-- > 0) {
|
|
3689
4143
|
const opt = keys[i];
|
|
3690
|
-
|
|
4144
|
+
// Use hasOwnProperty so a polluted Object.prototype.<opt> cannot supply
|
|
4145
|
+
// a non-function validator and cause a TypeError.
|
|
4146
|
+
const validator = Object.prototype.hasOwnProperty.call(schema, opt) ? schema[opt] : undefined;
|
|
3691
4147
|
if (validator) {
|
|
3692
4148
|
const value = options[opt];
|
|
3693
4149
|
const result = value === undefined || validator(value, opt, options);
|
|
@@ -3846,7 +4302,7 @@ function requireAxios () {
|
|
|
3846
4302
|
let contextHeaders = headers && utils$1.merge(headers.common, headers[config.method]);
|
|
3847
4303
|
|
|
3848
4304
|
headers &&
|
|
3849
|
-
utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], (method) => {
|
|
4305
|
+
utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'query', 'common'], (method) => {
|
|
3850
4306
|
delete headers[method];
|
|
3851
4307
|
});
|
|
3852
4308
|
|
|
@@ -3949,7 +4405,7 @@ function requireAxios () {
|
|
|
3949
4405
|
};
|
|
3950
4406
|
});
|
|
3951
4407
|
|
|
3952
|
-
utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
|
4408
|
+
utils$1.forEach(['post', 'put', 'patch', 'query'], function forEachMethodWithData(method) {
|
|
3953
4409
|
function generateHTTPMethod(isForm) {
|
|
3954
4410
|
return function httpMethod(url, data, config) {
|
|
3955
4411
|
return this.request(
|
|
@@ -3969,7 +4425,11 @@ function requireAxios () {
|
|
|
3969
4425
|
|
|
3970
4426
|
Axios.prototype[method] = generateHTTPMethod();
|
|
3971
4427
|
|
|
3972
|
-
|
|
4428
|
+
// QUERY is a safe/idempotent read method; multipart form bodies don't fit
|
|
4429
|
+
// its semantics, so no queryForm shorthand is generated.
|
|
4430
|
+
if (method !== 'query') {
|
|
4431
|
+
Axios.prototype[method + 'Form'] = generateHTTPMethod(true);
|
|
4432
|
+
}
|
|
3973
4433
|
});
|
|
3974
4434
|
|
|
3975
4435
|
/**
|