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