axios 0.27.2 → 0.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/CHANGELOG.md +121 -58
  2. package/README.md +271 -80
  3. package/SECURITY.md +3 -3
  4. package/UPGRADE_GUIDE.md +16 -15
  5. package/bin/check-build-version.js +19 -0
  6. package/bin/ssl_hotfix.js +22 -0
  7. package/dist/axios.js +1993 -2226
  8. package/dist/axios.js.map +1 -0
  9. package/dist/axios.min.js +2 -3
  10. package/dist/axios.min.js.map +1 -0
  11. package/dist/esm/axios.js +2354 -0
  12. package/dist/esm/axios.js.map +1 -0
  13. package/dist/esm/axios.min.js +2 -0
  14. package/dist/esm/axios.min.js.map +1 -0
  15. package/index.d.ts +104 -19
  16. package/lib/adapters/http.js +153 -114
  17. package/lib/adapters/xhr.js +14 -10
  18. package/lib/axios.js +5 -1
  19. package/lib/cancel/CancelToken.js +4 -5
  20. package/lib/cancel/CanceledError.js +4 -2
  21. package/lib/core/Axios.js +6 -1
  22. package/lib/core/AxiosError.js +12 -1
  23. package/lib/core/InterceptorManager.js +9 -0
  24. package/lib/core/dispatchRequest.js +7 -0
  25. package/lib/core/mergeConfig.js +3 -0
  26. package/lib/core/transformData.js +3 -2
  27. package/lib/defaults/index.js +42 -13
  28. package/lib/env/data.js +1 -1
  29. package/lib/helpers/AxiosURLSearchParams.js +42 -0
  30. package/lib/helpers/bind.js +1 -5
  31. package/lib/helpers/buildURL.js +14 -37
  32. package/lib/helpers/formDataToJSON.js +71 -0
  33. package/lib/helpers/fromDataURI.js +51 -0
  34. package/lib/helpers/isURLSameOrigin.js +12 -12
  35. package/lib/helpers/parseHeaders.js +2 -2
  36. package/lib/helpers/toFormData.js +141 -34
  37. package/lib/helpers/toURLEncodedForm.js +18 -0
  38. package/lib/platform/browser/classes/FormData.js +3 -0
  39. package/lib/platform/browser/classes/URLSearchParams.js +5 -0
  40. package/lib/platform/browser/index.js +11 -0
  41. package/lib/platform/index.js +3 -0
  42. package/lib/platform/node/classes/FormData.js +3 -0
  43. package/lib/platform/node/classes/URLSearchParams.js +5 -0
  44. package/lib/platform/node/index.js +11 -0
  45. package/lib/utils.js +68 -16
  46. package/package.json +19 -6
  47. package/rollup.config.js +60 -0
  48. package/dist/axios.map +0 -1
  49. package/dist/axios.min.map +0 -1
  50. /package/lib/{defaults/env → env/classes}/FormData.js +0 -0
package/dist/axios.js CHANGED
@@ -1,2595 +1,2362 @@
1
- /* axios v0.27.2 | (c) 2022 by Matt Zabriskie */
2
- (function webpackUniversalModuleDefinition(root, factory) {
3
- if(typeof exports === 'object' && typeof module === 'object')
4
- module.exports = factory();
5
- else if(typeof define === 'function' && define.amd)
6
- define([], factory);
7
- else if(typeof exports === 'object')
8
- exports["axios"] = factory();
9
- else
10
- root["axios"] = factory();
11
- })(this, function() {
12
- return /******/ (function(modules) { // webpackBootstrap
13
- /******/ // The module cache
14
- /******/ var installedModules = {};
15
- /******/
16
- /******/ // The require function
17
- /******/ function __webpack_require__(moduleId) {
18
- /******/
19
- /******/ // Check if module is in cache
20
- /******/ if(installedModules[moduleId]) {
21
- /******/ return installedModules[moduleId].exports;
22
- /******/ }
23
- /******/ // Create a new module (and put it into the cache)
24
- /******/ var module = installedModules[moduleId] = {
25
- /******/ i: moduleId,
26
- /******/ l: false,
27
- /******/ exports: {}
28
- /******/ };
29
- /******/
30
- /******/ // Execute the module function
31
- /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
32
- /******/
33
- /******/ // Flag the module as loaded
34
- /******/ module.l = true;
35
- /******/
36
- /******/ // Return the exports of the module
37
- /******/ return module.exports;
38
- /******/ }
39
- /******/
40
- /******/
41
- /******/ // expose the modules object (__webpack_modules__)
42
- /******/ __webpack_require__.m = modules;
43
- /******/
44
- /******/ // expose the module cache
45
- /******/ __webpack_require__.c = installedModules;
46
- /******/
47
- /******/ // define getter function for harmony exports
48
- /******/ __webpack_require__.d = function(exports, name, getter) {
49
- /******/ if(!__webpack_require__.o(exports, name)) {
50
- /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
51
- /******/ }
52
- /******/ };
53
- /******/
54
- /******/ // define __esModule on exports
55
- /******/ __webpack_require__.r = function(exports) {
56
- /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
57
- /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
58
- /******/ }
59
- /******/ Object.defineProperty(exports, '__esModule', { value: true });
60
- /******/ };
61
- /******/
62
- /******/ // create a fake namespace object
63
- /******/ // mode & 1: value is a module id, require it
64
- /******/ // mode & 2: merge all properties of value into the ns
65
- /******/ // mode & 4: return value when already ns object
66
- /******/ // mode & 8|1: behave like require
67
- /******/ __webpack_require__.t = function(value, mode) {
68
- /******/ if(mode & 1) value = __webpack_require__(value);
69
- /******/ if(mode & 8) return value;
70
- /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
71
- /******/ var ns = Object.create(null);
72
- /******/ __webpack_require__.r(ns);
73
- /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
74
- /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
75
- /******/ return ns;
76
- /******/ };
77
- /******/
78
- /******/ // getDefaultExport function for compatibility with non-harmony modules
79
- /******/ __webpack_require__.n = function(module) {
80
- /******/ var getter = module && module.__esModule ?
81
- /******/ function getDefault() { return module['default']; } :
82
- /******/ function getModuleExports() { return module; };
83
- /******/ __webpack_require__.d(getter, 'a', getter);
84
- /******/ return getter;
85
- /******/ };
86
- /******/
87
- /******/ // Object.prototype.hasOwnProperty.call
88
- /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
89
- /******/
90
- /******/ // __webpack_public_path__
91
- /******/ __webpack_require__.p = "";
92
- /******/
93
- /******/
94
- /******/ // Load entry module and return exports
95
- /******/ return __webpack_require__(__webpack_require__.s = "./index.js");
96
- /******/ })
97
- /************************************************************************/
98
- /******/ ({
99
-
100
- /***/ "./index.js":
101
- /*!******************!*\
102
- !*** ./index.js ***!
103
- \******************/
104
- /*! no static exports found */
105
- /***/ (function(module, exports, __webpack_require__) {
106
-
107
- module.exports = __webpack_require__(/*! ./lib/axios */ "./lib/axios.js");
108
-
109
- /***/ }),
110
-
111
- /***/ "./lib/adapters/xhr.js":
112
- /*!*****************************!*\
113
- !*** ./lib/adapters/xhr.js ***!
114
- \*****************************/
115
- /*! no static exports found */
116
- /***/ (function(module, exports, __webpack_require__) {
117
-
118
- "use strict";
119
-
120
-
121
- var utils = __webpack_require__(/*! ./../utils */ "./lib/utils.js");
122
- var settle = __webpack_require__(/*! ./../core/settle */ "./lib/core/settle.js");
123
- var cookies = __webpack_require__(/*! ./../helpers/cookies */ "./lib/helpers/cookies.js");
124
- var buildURL = __webpack_require__(/*! ./../helpers/buildURL */ "./lib/helpers/buildURL.js");
125
- var buildFullPath = __webpack_require__(/*! ../core/buildFullPath */ "./lib/core/buildFullPath.js");
126
- var parseHeaders = __webpack_require__(/*! ./../helpers/parseHeaders */ "./lib/helpers/parseHeaders.js");
127
- var isURLSameOrigin = __webpack_require__(/*! ./../helpers/isURLSameOrigin */ "./lib/helpers/isURLSameOrigin.js");
128
- var transitionalDefaults = __webpack_require__(/*! ../defaults/transitional */ "./lib/defaults/transitional.js");
129
- var AxiosError = __webpack_require__(/*! ../core/AxiosError */ "./lib/core/AxiosError.js");
130
- var CanceledError = __webpack_require__(/*! ../cancel/CanceledError */ "./lib/cancel/CanceledError.js");
131
- var parseProtocol = __webpack_require__(/*! ../helpers/parseProtocol */ "./lib/helpers/parseProtocol.js");
132
-
133
- module.exports = function xhrAdapter(config) {
134
- return new Promise(function dispatchXhrRequest(resolve, reject) {
135
- var requestData = config.data;
136
- var requestHeaders = config.headers;
137
- var responseType = config.responseType;
138
- var onCanceled;
139
- function done() {
140
- if (config.cancelToken) {
141
- config.cancelToken.unsubscribe(onCanceled);
142
- }
1
+ // axios v0.28.0 Copyright (c) 2024 Matt Zabriskie
2
+ (function (global, factory) {
3
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
4
+ typeof define === 'function' && define.amd ? define(factory) :
5
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.axios = factory());
6
+ })(this, (function () { 'use strict';
7
+
8
+ var bind = function bind(fn, thisArg) {
9
+ return function wrap() {
10
+ return fn.apply(thisArg, arguments);
11
+ };
12
+ };
143
13
 
144
- if (config.signal) {
145
- config.signal.removeEventListener('abort', onCanceled);
146
- }
147
- }
14
+ // utils is a library of generic helper functions non-specific to axios
148
15
 
149
- if (utils.isFormData(requestData) && utils.isStandardBrowserEnv()) {
150
- delete requestHeaders['Content-Type']; // Let the browser set it
151
- }
16
+ var toString = Object.prototype.toString;
152
17
 
153
- var request = new XMLHttpRequest();
18
+ // eslint-disable-next-line func-names
19
+ var kindOf = (function(cache) {
20
+ // eslint-disable-next-line func-names
21
+ return function(thing) {
22
+ var str = toString.call(thing);
23
+ return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
24
+ };
25
+ })(Object.create(null));
154
26
 
155
- // HTTP basic authentication
156
- if (config.auth) {
157
- var username = config.auth.username || '';
158
- var password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';
159
- requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
160
- }
27
+ function kindOfTest(type) {
28
+ type = type.toLowerCase();
29
+ return function isKindOf(thing) {
30
+ return kindOf(thing) === type;
31
+ };
32
+ }
161
33
 
162
- var fullPath = buildFullPath(config.baseURL, config.url);
34
+ /**
35
+ * Determine if a value is an Array
36
+ *
37
+ * @param {Object} val The value to test
38
+ * @returns {boolean} True if value is an Array, otherwise false
39
+ */
40
+ function isArray(val) {
41
+ return Array.isArray(val);
42
+ }
163
43
 
164
- request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
44
+ /**
45
+ * Determine if a value is undefined
46
+ *
47
+ * @param {Object} val The value to test
48
+ * @returns {boolean} True if the value is undefined, otherwise false
49
+ */
50
+ function isUndefined(val) {
51
+ return typeof val === 'undefined';
52
+ }
165
53
 
166
- // Set the request timeout in MS
167
- request.timeout = config.timeout;
54
+ /**
55
+ * Determine if a value is a Buffer
56
+ *
57
+ * @param {Object} val The value to test
58
+ * @returns {boolean} True if value is a Buffer, otherwise false
59
+ */
60
+ function isBuffer(val) {
61
+ return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
62
+ && typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val);
63
+ }
168
64
 
169
- function onloadend() {
170
- if (!request) {
171
- return;
172
- }
173
- // Prepare the response
174
- var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
175
- var responseData = !responseType || responseType === 'text' || responseType === 'json' ?
176
- request.responseText : request.response;
177
- var response = {
178
- data: responseData,
179
- status: request.status,
180
- statusText: request.statusText,
181
- headers: responseHeaders,
182
- config: config,
183
- request: request
184
- };
65
+ /**
66
+ * Determine if a value is an ArrayBuffer
67
+ *
68
+ * @function
69
+ * @param {Object} val The value to test
70
+ * @returns {boolean} True if value is an ArrayBuffer, otherwise false
71
+ */
72
+ var isArrayBuffer = kindOfTest('ArrayBuffer');
185
73
 
186
- settle(function _resolve(value) {
187
- resolve(value);
188
- done();
189
- }, function _reject(err) {
190
- reject(err);
191
- done();
192
- }, response);
193
74
 
194
- // Clean up request
195
- request = null;
75
+ /**
76
+ * Determine if a value is a view on an ArrayBuffer
77
+ *
78
+ * @param {Object} val The value to test
79
+ * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
80
+ */
81
+ function isArrayBufferView(val) {
82
+ var result;
83
+ if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
84
+ result = ArrayBuffer.isView(val);
85
+ } else {
86
+ result = (val) && (val.buffer) && (isArrayBuffer(val.buffer));
196
87
  }
88
+ return result;
89
+ }
197
90
 
198
- if ('onloadend' in request) {
199
- // Use onloadend if available
200
- request.onloadend = onloadend;
201
- } else {
202
- // Listen for ready state to emulate onloadend
203
- request.onreadystatechange = function handleLoad() {
204
- if (!request || request.readyState !== 4) {
205
- return;
206
- }
91
+ /**
92
+ * Determine if a value is a String
93
+ *
94
+ * @param {Object} val The value to test
95
+ * @returns {boolean} True if value is a String, otherwise false
96
+ */
97
+ function isString(val) {
98
+ return typeof val === 'string';
99
+ }
207
100
 
208
- // The request errored out and we didn't get a response, this will be
209
- // handled by onerror instead
210
- // With one exception: request that using file: protocol, most browsers
211
- // will return status as 0 even though it's a successful request
212
- if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
213
- return;
214
- }
215
- // readystate handler is calling before onerror or ontimeout handlers,
216
- // so we should call onloadend on the next 'tick'
217
- setTimeout(onloadend);
218
- };
101
+ /**
102
+ * Determine if a value is a Number
103
+ *
104
+ * @param {Object} val The value to test
105
+ * @returns {boolean} True if value is a Number, otherwise false
106
+ */
107
+ function isNumber(val) {
108
+ return typeof val === 'number';
109
+ }
110
+
111
+ /**
112
+ * Determine if a value is an Object
113
+ *
114
+ * @param {Object} val The value to test
115
+ * @returns {boolean} True if value is an Object, otherwise false
116
+ */
117
+ function isObject(val) {
118
+ return val !== null && typeof val === 'object';
119
+ }
120
+
121
+ /**
122
+ * Determine if a value is a plain Object
123
+ *
124
+ * @param {Object} val The value to test
125
+ * @return {boolean} True if value is a plain Object, otherwise false
126
+ */
127
+ function isPlainObject(val) {
128
+ if (kindOf(val) !== 'object') {
129
+ return false;
219
130
  }
220
131
 
221
- // Handle browser request cancellation (as opposed to a manual cancellation)
222
- request.onabort = function handleAbort() {
223
- if (!request) {
224
- return;
225
- }
132
+ var prototype = Object.getPrototypeOf(val);
133
+ return prototype === null || prototype === Object.prototype;
134
+ }
135
+
136
+ /**
137
+ * Determine if a value is a empty Object
138
+ *
139
+ * @param {Object} val The value to test
140
+ * @return {boolean} True if value is a empty Object, otherwise false
141
+ */
142
+ function isEmptyObject(val) {
143
+ return val && Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
144
+ }
226
145
 
227
- reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, config, request));
146
+ /**
147
+ * Determine if a value is a Date
148
+ *
149
+ * @function
150
+ * @param {Object} val The value to test
151
+ * @returns {boolean} True if value is a Date, otherwise false
152
+ */
153
+ var isDate = kindOfTest('Date');
228
154
 
229
- // Clean up request
230
- request = null;
231
- };
155
+ /**
156
+ * Determine if a value is a File
157
+ *
158
+ * @function
159
+ * @param {Object} val The value to test
160
+ * @returns {boolean} True if value is a File, otherwise false
161
+ */
162
+ var isFile = kindOfTest('File');
232
163
 
233
- // Handle low level network errors
234
- request.onerror = function handleError() {
235
- // Real errors are hidden from us by the browser
236
- // onerror should only fire if it's a network error
237
- reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request, request));
164
+ /**
165
+ * Determine if a value is a Blob
166
+ *
167
+ * @function
168
+ * @param {Object} val The value to test
169
+ * @returns {boolean} True if value is a Blob, otherwise false
170
+ */
171
+ var isBlob = kindOfTest('Blob');
238
172
 
239
- // Clean up request
240
- request = null;
241
- };
173
+ /**
174
+ * Determine if a value is a FileList
175
+ *
176
+ * @function
177
+ * @param {Object} val The value to test
178
+ * @returns {boolean} True if value is a File, otherwise false
179
+ */
180
+ var isFileList = kindOfTest('FileList');
242
181
 
243
- // Handle timeout
244
- request.ontimeout = function handleTimeout() {
245
- var timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';
246
- var transitional = config.transitional || transitionalDefaults;
247
- if (config.timeoutErrorMessage) {
248
- timeoutErrorMessage = config.timeoutErrorMessage;
249
- }
250
- reject(new AxiosError(
251
- timeoutErrorMessage,
252
- transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,
253
- config,
254
- request));
182
+ /**
183
+ * Determine if a value is a Function
184
+ *
185
+ * @param {Object} val The value to test
186
+ * @returns {boolean} True if value is a Function, otherwise false
187
+ */
188
+ function isFunction(val) {
189
+ return toString.call(val) === '[object Function]';
190
+ }
255
191
 
256
- // Clean up request
257
- request = null;
258
- };
192
+ /**
193
+ * Determine if a value is a Stream
194
+ *
195
+ * @param {Object} val The value to test
196
+ * @returns {boolean} True if value is a Stream, otherwise false
197
+ */
198
+ function isStream(val) {
199
+ return isObject(val) && isFunction(val.pipe);
200
+ }
259
201
 
260
- // Add xsrf header
261
- // This is only done if running in a standard browser environment.
262
- // Specifically not if we're in a web worker, or react-native.
263
- if (utils.isStandardBrowserEnv()) {
264
- // Add xsrf header
265
- var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ?
266
- cookies.read(config.xsrfCookieName) :
267
- undefined;
202
+ /**
203
+ * Determine if a value is a FormData
204
+ *
205
+ * @param {Object} thing The value to test
206
+ * @returns {boolean} True if value is an FormData, otherwise false
207
+ */
208
+ function isFormData(thing) {
209
+ var pattern = '[object FormData]';
210
+ return thing && (
211
+ (typeof FormData === 'function' && thing instanceof FormData) ||
212
+ toString.call(thing) === pattern ||
213
+ (isFunction(thing.toString) && thing.toString() === pattern)
214
+ );
215
+ }
268
216
 
269
- if (xsrfValue) {
270
- requestHeaders[config.xsrfHeaderName] = xsrfValue;
271
- }
272
- }
217
+ /**
218
+ * Determine if a value is a URLSearchParams object
219
+ * @function
220
+ * @param {Object} val The value to test
221
+ * @returns {boolean} True if value is a URLSearchParams object, otherwise false
222
+ */
223
+ var isURLSearchParams = kindOfTest('URLSearchParams');
273
224
 
274
- // Add headers to the request
275
- if ('setRequestHeader' in request) {
276
- utils.forEach(requestHeaders, function setRequestHeader(val, key) {
277
- if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {
278
- // Remove Content-Type if data is undefined
279
- delete requestHeaders[key];
280
- } else {
281
- // Otherwise add header to the request
282
- request.setRequestHeader(key, val);
283
- }
284
- });
285
- }
225
+ /**
226
+ * Trim excess whitespace off the beginning and end of a string
227
+ *
228
+ * @param {String} str The String to trim
229
+ * @returns {String} The String freed of excess whitespace
230
+ */
231
+ function trim(str) {
232
+ return str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
233
+ }
286
234
 
287
- // Add withCredentials to request if needed
288
- if (!utils.isUndefined(config.withCredentials)) {
289
- request.withCredentials = !!config.withCredentials;
235
+ /**
236
+ * Determine if we're running in a standard browser environment
237
+ *
238
+ * This allows axios to run in a web worker, and react-native.
239
+ * Both environments support XMLHttpRequest, but not fully standard globals.
240
+ *
241
+ * web workers:
242
+ * typeof window -> undefined
243
+ * typeof document -> undefined
244
+ *
245
+ * react-native:
246
+ * navigator.product -> 'ReactNative'
247
+ * nativescript
248
+ * navigator.product -> 'NativeScript' or 'NS'
249
+ */
250
+ function isStandardBrowserEnv() {
251
+ var product;
252
+ if (typeof navigator !== 'undefined' && (
253
+ (product = navigator.product) === 'ReactNative' ||
254
+ product === 'NativeScript' ||
255
+ product === 'NS')
256
+ ) {
257
+ return false;
290
258
  }
291
259
 
292
- // Add responseType to request if needed
293
- if (responseType && responseType !== 'json') {
294
- request.responseType = config.responseType;
295
- }
260
+ return typeof window !== 'undefined' && typeof document !== 'undefined';
261
+ }
296
262
 
297
- // Handle progress if needed
298
- if (typeof config.onDownloadProgress === 'function') {
299
- request.addEventListener('progress', config.onDownloadProgress);
263
+ /**
264
+ * Iterate over an Array or an Object invoking a function for each item.
265
+ *
266
+ * If `obj` is an Array callback will be called passing
267
+ * the value, index, and complete array for each item.
268
+ *
269
+ * If 'obj' is an Object callback will be called passing
270
+ * the value, key, and complete object for each property.
271
+ *
272
+ * @param {Object|Array} obj The object to iterate
273
+ * @param {Function} fn The callback to invoke for each item
274
+ */
275
+ function forEach(obj, fn) {
276
+ // Don't bother if no value provided
277
+ if (obj === null || typeof obj === 'undefined') {
278
+ return;
300
279
  }
301
280
 
302
- // Not all browsers support upload events
303
- if (typeof config.onUploadProgress === 'function' && request.upload) {
304
- request.upload.addEventListener('progress', config.onUploadProgress);
281
+ // Force an array if not already something iterable
282
+ if (typeof obj !== 'object') {
283
+ /*eslint no-param-reassign:0*/
284
+ obj = [obj];
305
285
  }
306
286
 
307
- if (config.cancelToken || config.signal) {
308
- // Handle cancellation
309
- // eslint-disable-next-line func-names
310
- onCanceled = function(cancel) {
311
- if (!request) {
312
- return;
287
+ if (isArray(obj)) {
288
+ // Iterate over array values
289
+ for (var i = 0, l = obj.length; i < l; i++) {
290
+ fn.call(null, obj[i], i, obj);
291
+ }
292
+ } else {
293
+ // Iterate over object keys
294
+ for (var key in obj) {
295
+ if (Object.prototype.hasOwnProperty.call(obj, key)) {
296
+ fn.call(null, obj[key], key, obj);
313
297
  }
314
- reject(!cancel || (cancel && cancel.type) ? new CanceledError() : cancel);
315
- request.abort();
316
- request = null;
317
- };
318
-
319
- config.cancelToken && config.cancelToken.subscribe(onCanceled);
320
- if (config.signal) {
321
- config.signal.aborted ? onCanceled() : config.signal.addEventListener('abort', onCanceled);
322
298
  }
323
299
  }
300
+ }
324
301
 
325
- if (!requestData) {
326
- requestData = null;
302
+ /**
303
+ * Accepts varargs expecting each argument to be an object, then
304
+ * immutably merges the properties of each object and returns result.
305
+ *
306
+ * When multiple objects contain the same key the later object in
307
+ * the arguments list will take precedence.
308
+ *
309
+ * Example:
310
+ *
311
+ * ```js
312
+ * var result = merge({foo: 123}, {foo: 456});
313
+ * console.log(result.foo); // outputs 456
314
+ * ```
315
+ *
316
+ * @param {Object} obj1 Object to merge
317
+ * @returns {Object} Result of all merge properties
318
+ */
319
+ function merge(/* obj1, obj2, obj3, ... */) {
320
+ var result = {};
321
+ function assignValue(val, key) {
322
+ if (isPlainObject(result[key]) && isPlainObject(val)) {
323
+ result[key] = merge(result[key], val);
324
+ } else if (isPlainObject(val)) {
325
+ result[key] = merge({}, val);
326
+ } else if (isArray(val)) {
327
+ result[key] = val.slice();
328
+ } else {
329
+ result[key] = val;
330
+ }
327
331
  }
328
332
 
329
- var protocol = parseProtocol(fullPath);
330
-
331
- if (protocol && [ 'http', 'https', 'file' ].indexOf(protocol) === -1) {
332
- reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));
333
- return;
333
+ for (var i = 0, l = arguments.length; i < l; i++) {
334
+ forEach(arguments[i], assignValue);
334
335
  }
336
+ return result;
337
+ }
335
338
 
339
+ /**
340
+ * Extends object a by mutably adding to it the properties of object b.
341
+ *
342
+ * @param {Object} a The object to be extended
343
+ * @param {Object} b The object to copy properties from
344
+ * @param {Object} thisArg The object to bind function to
345
+ * @return {Object} The resulting value of object a
346
+ */
347
+ function extend(a, b, thisArg) {
348
+ forEach(b, function assignValue(val, key) {
349
+ if (thisArg && typeof val === 'function') {
350
+ a[key] = bind(val, thisArg);
351
+ } else {
352
+ a[key] = val;
353
+ }
354
+ });
355
+ return a;
356
+ }
336
357
 
337
- // Send the request
338
- request.send(requestData);
339
- });
340
- };
341
-
342
-
343
- /***/ }),
344
-
345
- /***/ "./lib/axios.js":
346
- /*!**********************!*\
347
- !*** ./lib/axios.js ***!
348
- \**********************/
349
- /*! no static exports found */
350
- /***/ (function(module, exports, __webpack_require__) {
351
-
352
- "use strict";
353
-
354
-
355
- var utils = __webpack_require__(/*! ./utils */ "./lib/utils.js");
356
- var bind = __webpack_require__(/*! ./helpers/bind */ "./lib/helpers/bind.js");
357
- var Axios = __webpack_require__(/*! ./core/Axios */ "./lib/core/Axios.js");
358
- var mergeConfig = __webpack_require__(/*! ./core/mergeConfig */ "./lib/core/mergeConfig.js");
359
- var defaults = __webpack_require__(/*! ./defaults */ "./lib/defaults/index.js");
358
+ /**
359
+ * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
360
+ *
361
+ * @param {string} content with BOM
362
+ * @return {string} content value without BOM
363
+ */
364
+ function stripBOM(content) {
365
+ if (content.charCodeAt(0) === 0xFEFF) {
366
+ content = content.slice(1);
367
+ }
368
+ return content;
369
+ }
360
370
 
361
- /**
362
- * Create an instance of Axios
363
- *
364
- * @param {Object} defaultConfig The default config for the instance
365
- * @return {Axios} A new instance of Axios
366
- */
367
- function createInstance(defaultConfig) {
368
- var context = new Axios(defaultConfig);
369
- var instance = bind(Axios.prototype.request, context);
371
+ /**
372
+ * Inherit the prototype methods from one constructor into another
373
+ * @param {function} constructor
374
+ * @param {function} superConstructor
375
+ * @param {object} [props]
376
+ * @param {object} [descriptors]
377
+ */
370
378
 
371
- // Copy axios.prototype to instance
372
- utils.extend(instance, Axios.prototype, context);
379
+ function inherits(constructor, superConstructor, props, descriptors) {
380
+ constructor.prototype = Object.create(superConstructor.prototype, descriptors);
381
+ constructor.prototype.constructor = constructor;
382
+ props && Object.assign(constructor.prototype, props);
383
+ }
373
384
 
374
- // Copy context to instance
375
- utils.extend(instance, context);
385
+ /**
386
+ * Resolve object with deep prototype chain to a flat object
387
+ * @param {Object} sourceObj source object
388
+ * @param {Object} [destObj]
389
+ * @param {Function|Boolean} [filter]
390
+ * @param {Function} [propFilter]
391
+ * @returns {Object}
392
+ */
376
393
 
377
- // Factory for creating new instances
378
- instance.create = function create(instanceConfig) {
379
- return createInstance(mergeConfig(defaultConfig, instanceConfig));
380
- };
394
+ function toFlatObject(sourceObj, destObj, filter, propFilter) {
395
+ var props;
396
+ var i;
397
+ var prop;
398
+ var merged = {};
399
+
400
+ destObj = destObj || {};
401
+ // eslint-disable-next-line no-eq-null,eqeqeq
402
+ if (sourceObj == null) return destObj;
403
+
404
+ do {
405
+ props = Object.getOwnPropertyNames(sourceObj);
406
+ i = props.length;
407
+ while (i-- > 0) {
408
+ prop = props[i];
409
+ if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
410
+ destObj[prop] = sourceObj[prop];
411
+ merged[prop] = true;
412
+ }
413
+ }
414
+ sourceObj = filter !== false && Object.getPrototypeOf(sourceObj);
415
+ } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);
381
416
 
382
- return instance;
383
- }
417
+ return destObj;
418
+ }
384
419
 
385
- // Create the default instance to be exported
386
- var axios = createInstance(defaults);
420
+ /*
421
+ * determines whether a string ends with the characters of a specified string
422
+ * @param {String} str
423
+ * @param {String} searchString
424
+ * @param {Number} [position= 0]
425
+ * @returns {boolean}
426
+ */
427
+ function endsWith(str, searchString, position) {
428
+ str = String(str);
429
+ if (position === undefined || position > str.length) {
430
+ position = str.length;
431
+ }
432
+ position -= searchString.length;
433
+ var lastIndex = str.indexOf(searchString, position);
434
+ return lastIndex !== -1 && lastIndex === position;
435
+ }
387
436
 
388
- // Expose Axios class to allow class inheritance
389
- axios.Axios = Axios;
390
437
 
391
- // Expose Cancel & CancelToken
392
- axios.CanceledError = __webpack_require__(/*! ./cancel/CanceledError */ "./lib/cancel/CanceledError.js");
393
- axios.CancelToken = __webpack_require__(/*! ./cancel/CancelToken */ "./lib/cancel/CancelToken.js");
394
- axios.isCancel = __webpack_require__(/*! ./cancel/isCancel */ "./lib/cancel/isCancel.js");
395
- axios.VERSION = __webpack_require__(/*! ./env/data */ "./lib/env/data.js").version;
396
- axios.toFormData = __webpack_require__(/*! ./helpers/toFormData */ "./lib/helpers/toFormData.js");
438
+ /**
439
+ * Returns new array from array like object or null if failed
440
+ * @param {*} [thing]
441
+ * @returns {?Array}
442
+ */
443
+ function toArray(thing) {
444
+ if (!thing) return null;
445
+ if (isArray(thing)) return thing;
446
+ var i = thing.length;
447
+ if (!isNumber(i)) return null;
448
+ var arr = new Array(i);
449
+ while (i-- > 0) {
450
+ arr[i] = thing[i];
451
+ }
452
+ return arr;
453
+ }
397
454
 
398
- // Expose AxiosError class
399
- axios.AxiosError = __webpack_require__(/*! ../lib/core/AxiosError */ "./lib/core/AxiosError.js");
455
+ // eslint-disable-next-line func-names
456
+ var isTypedArray = (function(TypedArray) {
457
+ // eslint-disable-next-line func-names
458
+ return function(thing) {
459
+ return TypedArray && thing instanceof TypedArray;
460
+ };
461
+ })(typeof Uint8Array !== 'undefined' && Object.getPrototypeOf(Uint8Array));
400
462
 
401
- // alias for CanceledError for backward compatibility
402
- axios.Cancel = axios.CanceledError;
463
+ function forEachEntry(obj, fn) {
464
+ var generator = obj && obj[Symbol.iterator];
403
465
 
404
- // Expose all/spread
405
- axios.all = function all(promises) {
406
- return Promise.all(promises);
407
- };
408
- axios.spread = __webpack_require__(/*! ./helpers/spread */ "./lib/helpers/spread.js");
466
+ var iterator = generator.call(obj);
409
467
 
410
- // Expose isAxiosError
411
- axios.isAxiosError = __webpack_require__(/*! ./helpers/isAxiosError */ "./lib/helpers/isAxiosError.js");
468
+ var result;
412
469
 
413
- module.exports = axios;
470
+ while ((result = iterator.next()) && !result.done) {
471
+ var pair = result.value;
472
+ fn.call(obj, pair[0], pair[1]);
473
+ }
474
+ }
414
475
 
415
- // Allow use of default import syntax in TypeScript
416
- module.exports.default = axios;
476
+ function matchAll(regExp, str) {
477
+ var matches;
478
+ var arr = [];
417
479
 
480
+ while ((matches = regExp.exec(str)) !== null) {
481
+ arr.push(matches);
482
+ }
418
483
 
419
- /***/ }),
484
+ return arr;
485
+ }
420
486
 
421
- /***/ "./lib/cancel/CancelToken.js":
422
- /*!***********************************!*\
423
- !*** ./lib/cancel/CancelToken.js ***!
424
- \***********************************/
425
- /*! no static exports found */
426
- /***/ (function(module, exports, __webpack_require__) {
487
+ var isHTMLForm = kindOfTest('HTMLFormElement');
427
488
 
428
- "use strict";
489
+ var hasOwnProperty = (function resolver(_hasOwnProperty) {
490
+ return function(obj, prop) {
491
+ return _hasOwnProperty.call(obj, prop);
492
+ };
493
+ })(Object.prototype.hasOwnProperty);
494
+
495
+ var utils = {
496
+ isArray: isArray,
497
+ isArrayBuffer: isArrayBuffer,
498
+ isBuffer: isBuffer,
499
+ isFormData: isFormData,
500
+ isArrayBufferView: isArrayBufferView,
501
+ isString: isString,
502
+ isNumber: isNumber,
503
+ isObject: isObject,
504
+ isPlainObject: isPlainObject,
505
+ isEmptyObject: isEmptyObject,
506
+ isUndefined: isUndefined,
507
+ isDate: isDate,
508
+ isFile: isFile,
509
+ isBlob: isBlob,
510
+ isFunction: isFunction,
511
+ isStream: isStream,
512
+ isURLSearchParams: isURLSearchParams,
513
+ isStandardBrowserEnv: isStandardBrowserEnv,
514
+ forEach: forEach,
515
+ merge: merge,
516
+ extend: extend,
517
+ trim: trim,
518
+ stripBOM: stripBOM,
519
+ inherits: inherits,
520
+ toFlatObject: toFlatObject,
521
+ kindOf: kindOf,
522
+ kindOfTest: kindOfTest,
523
+ endsWith: endsWith,
524
+ toArray: toArray,
525
+ isTypedArray: isTypedArray,
526
+ isFileList: isFileList,
527
+ forEachEntry: forEachEntry,
528
+ matchAll: matchAll,
529
+ isHTMLForm: isHTMLForm,
530
+ hasOwnProperty: hasOwnProperty
531
+ };
429
532
 
533
+ /**
534
+ * Create an Error with the specified message, config, error code, request and response.
535
+ *
536
+ * @param {string} message The error message.
537
+ * @param {string} [code] The error code (for example, 'ECONNABORTED').
538
+ * @param {Object} [config] The config.
539
+ * @param {Object} [request] The request.
540
+ * @param {Object} [response] The response.
541
+ * @returns {Error} The created error.
542
+ */
543
+ function AxiosError(message, code, config, request, response) {
544
+ Error.call(this);
430
545
 
431
- var CanceledError = __webpack_require__(/*! ./CanceledError */ "./lib/cancel/CanceledError.js");
546
+ if (Error.captureStackTrace) {
547
+ Error.captureStackTrace(this, this.constructor);
548
+ } else {
549
+ this.stack = (new Error()).stack;
550
+ }
432
551
 
433
- /**
434
- * A `CancelToken` is an object that can be used to request cancellation of an operation.
435
- *
436
- * @class
437
- * @param {Function} executor The executor function.
438
- */
439
- function CancelToken(executor) {
440
- if (typeof executor !== 'function') {
441
- throw new TypeError('executor must be a function.');
552
+ this.message = message;
553
+ this.name = 'AxiosError';
554
+ code && (this.code = code);
555
+ config && (this.config = config);
556
+ request && (this.request = request);
557
+ response && (this.response = response);
442
558
  }
443
559
 
444
- var resolvePromise;
560
+ utils.inherits(AxiosError, Error, {
561
+ toJSON: function toJSON() {
562
+ return {
563
+ // Standard
564
+ message: this.message,
565
+ name: this.name,
566
+ // Microsoft
567
+ description: this.description,
568
+ number: this.number,
569
+ // Mozilla
570
+ fileName: this.fileName,
571
+ lineNumber: this.lineNumber,
572
+ columnNumber: this.columnNumber,
573
+ stack: this.stack,
574
+ // Axios
575
+ config: this.config,
576
+ code: this.code,
577
+ status: this.response && this.response.status ? this.response.status : null
578
+ };
579
+ }
580
+ });
445
581
 
446
- this.promise = new Promise(function promiseExecutor(resolve) {
447
- resolvePromise = resolve;
582
+ var prototype$1 = AxiosError.prototype;
583
+ var descriptors = {};
584
+
585
+ [
586
+ 'ERR_BAD_OPTION_VALUE',
587
+ 'ERR_BAD_OPTION',
588
+ 'ECONNABORTED',
589
+ 'ETIMEDOUT',
590
+ 'ERR_NETWORK',
591
+ 'ERR_FR_TOO_MANY_REDIRECTS',
592
+ 'ERR_DEPRECATED',
593
+ 'ERR_BAD_RESPONSE',
594
+ 'ERR_BAD_REQUEST',
595
+ 'ERR_CANCELED',
596
+ 'ERR_NOT_SUPPORT',
597
+ 'ERR_INVALID_URL'
598
+ // eslint-disable-next-line func-names
599
+ ].forEach(function(code) {
600
+ descriptors[code] = {value: code};
448
601
  });
449
602
 
450
- var token = this;
603
+ Object.defineProperties(AxiosError, descriptors);
604
+ Object.defineProperty(prototype$1, 'isAxiosError', {value: true});
451
605
 
452
606
  // eslint-disable-next-line func-names
453
- this.promise.then(function(cancel) {
454
- if (!token._listeners) return;
607
+ AxiosError.from = function(error, code, config, request, response, customProps) {
608
+ var axiosError = Object.create(prototype$1);
455
609
 
456
- var i;
457
- var l = token._listeners.length;
610
+ utils.toFlatObject(error, axiosError, function filter(obj) {
611
+ return obj !== Error.prototype;
612
+ });
458
613
 
459
- for (i = 0; i < l; i++) {
460
- token._listeners[i](cancel);
461
- }
462
- token._listeners = null;
463
- });
614
+ AxiosError.call(axiosError, error.message, code, config, request, response);
464
615
 
465
- // eslint-disable-next-line func-names
466
- this.promise.then = function(onfulfilled) {
467
- var _resolve;
468
- // eslint-disable-next-line func-names
469
- var promise = new Promise(function(resolve) {
470
- token.subscribe(resolve);
471
- _resolve = resolve;
472
- }).then(onfulfilled);
616
+ axiosError.cause = error;
473
617
 
474
- promise.cancel = function reject() {
475
- token.unsubscribe(_resolve);
476
- };
618
+ axiosError.name = error.name;
477
619
 
478
- return promise;
620
+ customProps && Object.assign(axiosError, customProps);
621
+
622
+ return axiosError;
479
623
  };
480
624
 
481
- executor(function cancel(message) {
482
- if (token.reason) {
483
- // Cancellation has already been requested
484
- return;
485
- }
625
+ var AxiosError_1 = AxiosError;
486
626
 
487
- token.reason = new CanceledError(message);
488
- resolvePromise(token.reason);
489
- });
490
- }
491
-
492
- /**
493
- * Throws a `CanceledError` if cancellation has been requested.
494
- */
495
- CancelToken.prototype.throwIfRequested = function throwIfRequested() {
496
- if (this.reason) {
497
- throw this.reason;
498
- }
499
- };
627
+ /* eslint-env browser */
628
+ var browser$1 = typeof self == 'object' ? self.FormData : window.FormData;
500
629
 
501
- /**
502
- * Subscribe to the cancel signal
503
- */
630
+ // eslint-disable-next-line strict
631
+ var FormData$1 = browser$1;
504
632
 
505
- CancelToken.prototype.subscribe = function subscribe(listener) {
506
- if (this.reason) {
507
- listener(this.reason);
508
- return;
633
+ function isVisitable(thing) {
634
+ return utils.isPlainObject(thing) || utils.isArray(thing);
509
635
  }
510
636
 
511
- if (this._listeners) {
512
- this._listeners.push(listener);
513
- } else {
514
- this._listeners = [listener];
637
+ function removeBrackets(key) {
638
+ return utils.endsWith(key, '[]') ? key.slice(0, -2) : key;
515
639
  }
516
- };
517
-
518
- /**
519
- * Unsubscribe from the cancel signal
520
- */
521
640
 
522
- CancelToken.prototype.unsubscribe = function unsubscribe(listener) {
523
- if (!this._listeners) {
524
- return;
641
+ function renderKey(path, key, dots) {
642
+ if (!path) return key;
643
+ return path.concat(key).map(function each(token, i) {
644
+ // eslint-disable-next-line no-param-reassign
645
+ token = removeBrackets(token);
646
+ return !dots && i ? '[' + token + ']' : token;
647
+ }).join(dots ? '.' : '');
525
648
  }
526
- var index = this._listeners.indexOf(listener);
527
- if (index !== -1) {
528
- this._listeners.splice(index, 1);
649
+
650
+ function isFlatArray(arr) {
651
+ return utils.isArray(arr) && !arr.some(isVisitable);
529
652
  }
530
- };
531
-
532
- /**
533
- * Returns an object that contains a new `CancelToken` and a function that, when called,
534
- * cancels the `CancelToken`.
535
- */
536
- CancelToken.source = function source() {
537
- var cancel;
538
- var token = new CancelToken(function executor(c) {
539
- cancel = c;
653
+
654
+ var predicates = utils.toFlatObject(utils, {}, null, function filter(prop) {
655
+ return /^is[A-Z]/.test(prop);
540
656
  });
541
- return {
542
- token: token,
543
- cancel: cancel
544
- };
545
- };
546
657
 
547
- module.exports = CancelToken;
658
+ function isSpecCompliant(thing) {
659
+ return thing && utils.isFunction(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator];
660
+ }
661
+
662
+ /**
663
+ * Convert a data object to FormData
664
+ * @param {Object} obj
665
+ * @param {?Object} [formData]
666
+ * @param {?Object} [options]
667
+ * @param {Function} [options.visitor]
668
+ * @param {Boolean} [options.metaTokens = true]
669
+ * @param {Boolean} [options.dots = false]
670
+ * @param {?Boolean} [options.indexes = false]
671
+ * @returns {Object}
672
+ **/
673
+
674
+ function toFormData(obj, formData, options) {
675
+ if (!utils.isObject(obj)) {
676
+ throw new TypeError('target must be an object');
677
+ }
678
+
679
+ // eslint-disable-next-line no-param-reassign
680
+ formData = formData || new (FormData$1 || FormData)();
681
+
682
+ // eslint-disable-next-line no-param-reassign
683
+ options = utils.toFlatObject(options, {
684
+ metaTokens: true,
685
+ dots: false,
686
+ indexes: false
687
+ }, false, function defined(option, source) {
688
+ // eslint-disable-next-line no-eq-null,eqeqeq
689
+ return !utils.isUndefined(source[option]);
690
+ });
548
691
 
692
+ var metaTokens = options.metaTokens;
693
+ // eslint-disable-next-line no-use-before-define
694
+ var visitor = options.visitor || defaultVisitor;
695
+ var dots = options.dots;
696
+ var indexes = options.indexes;
697
+ var _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
698
+ var useBlob = _Blob && isSpecCompliant(formData);
549
699
 
550
- /***/ }),
700
+ if (!utils.isFunction(visitor)) {
701
+ throw new TypeError('visitor must be a function');
702
+ }
551
703
 
552
- /***/ "./lib/cancel/CanceledError.js":
553
- /*!*************************************!*\
554
- !*** ./lib/cancel/CanceledError.js ***!
555
- \*************************************/
556
- /*! no static exports found */
557
- /***/ (function(module, exports, __webpack_require__) {
704
+ function convertValue(value) {
705
+ if (value === null) return '';
558
706
 
559
- "use strict";
707
+ if (utils.isDate(value)) {
708
+ return value.toISOString();
709
+ }
560
710
 
711
+ if (!useBlob && utils.isBlob(value)) {
712
+ throw new AxiosError_1('Blob is not supported. Use a Buffer instead.');
713
+ }
561
714
 
562
- var AxiosError = __webpack_require__(/*! ../core/AxiosError */ "./lib/core/AxiosError.js");
563
- var utils = __webpack_require__(/*! ../utils */ "./lib/utils.js");
715
+ if (utils.isArrayBuffer(value) || utils.isTypedArray(value)) {
716
+ return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
717
+ }
564
718
 
565
- /**
566
- * A `CanceledError` is an object that is thrown when an operation is canceled.
567
- *
568
- * @class
569
- * @param {string=} message The message.
570
- */
571
- function CanceledError(message) {
572
- // eslint-disable-next-line no-eq-null,eqeqeq
573
- AxiosError.call(this, message == null ? 'canceled' : message, AxiosError.ERR_CANCELED);
574
- this.name = 'CanceledError';
575
- }
719
+ return value;
720
+ }
576
721
 
577
- utils.inherits(CanceledError, AxiosError, {
578
- __CANCEL__: true
579
- });
722
+ /**
723
+ *
724
+ * @param {*} value
725
+ * @param {String|Number} key
726
+ * @param {Array<String|Number>} path
727
+ * @this {FormData}
728
+ * @returns {boolean} return true to visit the each prop of the value recursively
729
+ */
730
+ function defaultVisitor(value, key, path) {
731
+ var arr = value;
732
+
733
+ if (value && !path && typeof value === 'object') {
734
+ if (utils.endsWith(key, '{}')) {
735
+ // eslint-disable-next-line no-param-reassign
736
+ key = metaTokens ? key : key.slice(0, -2);
737
+ // eslint-disable-next-line no-param-reassign
738
+ value = JSON.stringify(value);
739
+ } else if (
740
+ (utils.isArray(value) && isFlatArray(value)) ||
741
+ (utils.isFileList(value) || utils.endsWith(key, '[]') && (arr = utils.toArray(value))
742
+ )) {
743
+ // eslint-disable-next-line no-param-reassign
744
+ key = removeBrackets(key);
745
+
746
+ arr.forEach(function each(el, index) {
747
+ !utils.isUndefined(el) && formData.append(
748
+ // eslint-disable-next-line no-nested-ternary
749
+ indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'),
750
+ convertValue(el)
751
+ );
752
+ });
753
+ return false;
754
+ }
755
+ }
580
756
 
581
- module.exports = CanceledError;
757
+ if (isVisitable(value)) {
758
+ return true;
759
+ }
582
760
 
761
+ formData.append(renderKey(path, key, dots), convertValue(value));
583
762
 
584
- /***/ }),
763
+ return false;
764
+ }
585
765
 
586
- /***/ "./lib/cancel/isCancel.js":
587
- /*!********************************!*\
588
- !*** ./lib/cancel/isCancel.js ***!
589
- \********************************/
590
- /*! no static exports found */
591
- /***/ (function(module, exports, __webpack_require__) {
766
+ var stack = [];
592
767
 
593
- "use strict";
768
+ var exposedHelpers = Object.assign(predicates, {
769
+ defaultVisitor: defaultVisitor,
770
+ convertValue: convertValue,
771
+ isVisitable: isVisitable
772
+ });
594
773
 
774
+ function build(value, path) {
775
+ if (utils.isUndefined(value)) return;
595
776
 
596
- module.exports = function isCancel(value) {
597
- return !!(value && value.__CANCEL__);
598
- };
777
+ if (stack.indexOf(value) !== -1) {
778
+ throw Error('Circular reference detected in ' + path.join('.'));
779
+ }
599
780
 
781
+ stack.push(value);
600
782
 
601
- /***/ }),
783
+ utils.forEach(value, function each(el, key) {
784
+ var result = !utils.isUndefined(el) && visitor.call(
785
+ formData, el, utils.isString(key) ? key.trim() : key, path, exposedHelpers
786
+ );
602
787
 
603
- /***/ "./lib/core/Axios.js":
604
- /*!***************************!*\
605
- !*** ./lib/core/Axios.js ***!
606
- \***************************/
607
- /*! no static exports found */
608
- /***/ (function(module, exports, __webpack_require__) {
788
+ if (result === true) {
789
+ build(el, path ? path.concat(key) : [key]);
790
+ }
791
+ });
609
792
 
610
- "use strict";
793
+ stack.pop();
794
+ }
611
795
 
796
+ if (!utils.isObject(obj)) {
797
+ throw new TypeError('data must be an object');
798
+ }
612
799
 
613
- var utils = __webpack_require__(/*! ./../utils */ "./lib/utils.js");
614
- var buildURL = __webpack_require__(/*! ../helpers/buildURL */ "./lib/helpers/buildURL.js");
615
- var InterceptorManager = __webpack_require__(/*! ./InterceptorManager */ "./lib/core/InterceptorManager.js");
616
- var dispatchRequest = __webpack_require__(/*! ./dispatchRequest */ "./lib/core/dispatchRequest.js");
617
- var mergeConfig = __webpack_require__(/*! ./mergeConfig */ "./lib/core/mergeConfig.js");
618
- var buildFullPath = __webpack_require__(/*! ./buildFullPath */ "./lib/core/buildFullPath.js");
619
- var validator = __webpack_require__(/*! ../helpers/validator */ "./lib/helpers/validator.js");
800
+ build(obj);
620
801
 
621
- var validators = validator.validators;
622
- /**
623
- * Create a new instance of Axios
624
- *
625
- * @param {Object} instanceConfig The default config for the instance
626
- */
627
- function Axios(instanceConfig) {
628
- this.defaults = instanceConfig;
629
- this.interceptors = {
630
- request: new InterceptorManager(),
631
- response: new InterceptorManager()
632
- };
633
- }
634
-
635
- /**
636
- * Dispatch a request
637
- *
638
- * @param {Object} config The config specific for this request (merged with this.defaults)
639
- */
640
- Axios.prototype.request = function request(configOrUrl, config) {
641
- /*eslint no-param-reassign:0*/
642
- // Allow for axios('example/url'[, config]) a la fetch API
643
- if (typeof configOrUrl === 'string') {
644
- config = config || {};
645
- config.url = configOrUrl;
646
- } else {
647
- config = configOrUrl || {};
802
+ return formData;
648
803
  }
649
804
 
650
- config = mergeConfig(this.defaults, config);
651
-
652
- // Set config.method
653
- if (config.method) {
654
- config.method = config.method.toLowerCase();
655
- } else if (this.defaults.method) {
656
- config.method = this.defaults.method.toLowerCase();
657
- } else {
658
- config.method = 'get';
805
+ var toFormData_1 = toFormData;
806
+
807
+ function encode$1(str) {
808
+ var charMap = {
809
+ '!': '%21',
810
+ "'": '%27',
811
+ '(': '%28',
812
+ ')': '%29',
813
+ '~': '%7E',
814
+ '%20': '+',
815
+ '%00': '\x00'
816
+ };
817
+ return encodeURIComponent(str).replace(/[!'\(\)~]|%20|%00/g, function replacer(match) {
818
+ return charMap[match];
819
+ });
659
820
  }
660
821
 
661
- var transitional = config.transitional;
822
+ function AxiosURLSearchParams(params, options) {
823
+ this._pairs = [];
662
824
 
663
- if (transitional !== undefined) {
664
- validator.assertOptions(transitional, {
665
- silentJSONParsing: validators.transitional(validators.boolean),
666
- forcedJSONParsing: validators.transitional(validators.boolean),
667
- clarifyTimeoutError: validators.transitional(validators.boolean)
668
- }, false);
825
+ params && toFormData_1(params, this, options);
669
826
  }
670
827
 
671
- // filter out skipped interceptors
672
- var requestInterceptorChain = [];
673
- var synchronousRequestInterceptors = true;
674
- this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
675
- if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {
676
- return;
677
- }
828
+ var prototype = AxiosURLSearchParams.prototype;
678
829
 
679
- synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
830
+ prototype.append = function append(name, value) {
831
+ this._pairs.push([name, value]);
832
+ };
680
833
 
681
- requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
682
- });
834
+ prototype.toString = function toString(encoder) {
835
+ var _encode = encoder ? function(value) {
836
+ return encoder.call(this, value, encode$1);
837
+ } : encode$1;
683
838
 
684
- var responseInterceptorChain = [];
685
- this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
686
- responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
687
- });
839
+ return this._pairs.map(function each(pair) {
840
+ return _encode(pair[0]) + '=' + _encode(pair[1]);
841
+ }, '').join('&');
842
+ };
843
+
844
+ var AxiosURLSearchParams_1 = AxiosURLSearchParams;
688
845
 
689
- var promise;
846
+ function encode(val) {
847
+ return encodeURIComponent(val).
848
+ replace(/%3A/gi, ':').
849
+ replace(/%24/g, '$').
850
+ replace(/%2C/gi, ',').
851
+ replace(/%20/g, '+').
852
+ replace(/%5B/gi, '[').
853
+ replace(/%5D/gi, ']');
854
+ }
690
855
 
691
- if (!synchronousRequestInterceptors) {
692
- var chain = [dispatchRequest, undefined];
856
+ /**
857
+ * Build a URL by appending params to the end
858
+ *
859
+ * @param {string} url The base of the url (e.g., http://www.google.com)
860
+ * @param {object} [params] The params to be appended
861
+ * @param {?object} options
862
+ * @returns {string} The formatted url
863
+ */
864
+ var buildURL = function buildURL(url, params, options) {
865
+ /*eslint no-param-reassign:0*/
866
+ if (!params) {
867
+ return url;
868
+ }
693
869
 
694
- Array.prototype.unshift.apply(chain, requestInterceptorChain);
695
- chain = chain.concat(responseInterceptorChain);
870
+ var hashmarkIndex = url.indexOf('#');
696
871
 
697
- promise = Promise.resolve(config);
698
- while (chain.length) {
699
- promise = promise.then(chain.shift(), chain.shift());
872
+ if (hashmarkIndex !== -1) {
873
+ url = url.slice(0, hashmarkIndex);
700
874
  }
701
875
 
702
- return promise;
703
- }
876
+ var _encode = options && options.encode || encode;
704
877
 
878
+ var serializerParams = utils.isURLSearchParams(params) ?
879
+ params.toString() :
880
+ new AxiosURLSearchParams_1(params, options).toString(_encode);
705
881
 
706
- var newConfig = config;
707
- while (requestInterceptorChain.length) {
708
- var onFulfilled = requestInterceptorChain.shift();
709
- var onRejected = requestInterceptorChain.shift();
710
- try {
711
- newConfig = onFulfilled(newConfig);
712
- } catch (error) {
713
- onRejected(error);
714
- break;
882
+ if (serializerParams) {
883
+ url += (url.indexOf('?') === -1 ? '?' : '&') + serializerParams;
715
884
  }
716
- }
717
885
 
718
- try {
719
- promise = dispatchRequest(newConfig);
720
- } catch (error) {
721
- return Promise.reject(error);
722
- }
886
+ return url;
887
+ };
723
888
 
724
- while (responseInterceptorChain.length) {
725
- promise = promise.then(responseInterceptorChain.shift(), responseInterceptorChain.shift());
889
+ function InterceptorManager() {
890
+ this.handlers = [];
726
891
  }
727
892
 
728
- return promise;
729
- };
730
-
731
- Axios.prototype.getUri = function getUri(config) {
732
- config = mergeConfig(this.defaults, config);
733
- var fullPath = buildFullPath(config.baseURL, config.url);
734
- return buildURL(fullPath, config.params, config.paramsSerializer);
735
- };
736
-
737
- // Provide aliases for supported request methods
738
- utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
739
- /*eslint func-names:0*/
740
- Axios.prototype[method] = function(url, config) {
741
- return this.request(mergeConfig(config || {}, {
742
- method: method,
743
- url: url,
744
- data: (config || {}).data
745
- }));
893
+ /**
894
+ * Add a new interceptor to the stack
895
+ *
896
+ * @param {Function} fulfilled The function to handle `then` for a `Promise`
897
+ * @param {Function} rejected The function to handle `reject` for a `Promise`
898
+ *
899
+ * @return {Number} An ID used to remove interceptor later
900
+ */
901
+ InterceptorManager.prototype.use = function use(fulfilled, rejected, options) {
902
+ this.handlers.push({
903
+ fulfilled: fulfilled,
904
+ rejected: rejected,
905
+ synchronous: options ? options.synchronous : false,
906
+ runWhen: options ? options.runWhen : null
907
+ });
908
+ return this.handlers.length - 1;
746
909
  };
747
- });
748
910
 
749
- utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
750
- /*eslint func-names:0*/
911
+ /**
912
+ * Remove an interceptor from the stack
913
+ *
914
+ * @param {Number} id The ID that was returned by `use`
915
+ */
916
+ InterceptorManager.prototype.eject = function eject(id) {
917
+ if (this.handlers[id]) {
918
+ this.handlers[id] = null;
919
+ }
920
+ };
751
921
 
752
- function generateHTTPMethod(isForm) {
753
- return function httpMethod(url, data, config) {
754
- return this.request(mergeConfig(config || {}, {
755
- method: method,
756
- headers: isForm ? {
757
- 'Content-Type': 'multipart/form-data'
758
- } : {},
759
- url: url,
760
- data: data
761
- }));
762
- };
763
- }
922
+ /**
923
+ * Clear all interceptors from the stack
924
+ */
925
+ InterceptorManager.prototype.clear = function clear() {
926
+ if (this.handlers) {
927
+ this.handlers = [];
928
+ }
929
+ };
764
930
 
765
- Axios.prototype[method] = generateHTTPMethod();
931
+ /**
932
+ * Iterate over all the registered interceptors
933
+ *
934
+ * This method is particularly useful for skipping over any
935
+ * interceptors that may have become `null` calling `eject`.
936
+ *
937
+ * @param {Function} fn The function to call for each interceptor
938
+ */
939
+ InterceptorManager.prototype.forEach = function forEach(fn) {
940
+ utils.forEach(this.handlers, function forEachHandler(h) {
941
+ if (h !== null) {
942
+ fn(h);
943
+ }
944
+ });
945
+ };
766
946
 
767
- Axios.prototype[method + 'Form'] = generateHTTPMethod(true);
768
- });
947
+ var InterceptorManager_1 = InterceptorManager;
769
948
 
770
- module.exports = Axios;
949
+ var normalizeHeaderName = function normalizeHeaderName(headers, normalizedName) {
950
+ utils.forEach(headers, function processHeader(value, name) {
951
+ if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
952
+ headers[normalizedName] = value;
953
+ delete headers[name];
954
+ }
955
+ });
956
+ };
771
957
 
958
+ var transitional = {
959
+ silentJSONParsing: true,
960
+ forcedJSONParsing: true,
961
+ clarifyTimeoutError: false
962
+ };
772
963
 
773
- /***/ }),
964
+ var URLSearchParams_1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams_1;
774
965
 
775
- /***/ "./lib/core/AxiosError.js":
776
- /*!********************************!*\
777
- !*** ./lib/core/AxiosError.js ***!
778
- \********************************/
779
- /*! no static exports found */
780
- /***/ (function(module, exports, __webpack_require__) {
966
+ var FormData_1 = FormData;
781
967
 
782
- "use strict";
968
+ var browser = {
969
+ isBrowser: true,
970
+ classes: {
971
+ URLSearchParams: URLSearchParams_1,
972
+ FormData: FormData_1,
973
+ Blob: Blob
974
+ },
975
+ protocols: ['http', 'https', 'file', 'blob', 'url', 'data']
976
+ };
783
977
 
978
+ var platform = browser;
784
979
 
785
- var utils = __webpack_require__(/*! ../utils */ "./lib/utils.js");
980
+ var toURLEncodedForm = function toURLEncodedForm(data, options) {
981
+ return toFormData_1(data, new platform.classes.URLSearchParams(), Object.assign({
982
+ visitor: function(value, key, path, helpers) {
983
+ if (platform.isNode && utils.isBuffer(value)) {
984
+ this.append(key, value.toString('base64'));
985
+ return false;
986
+ }
786
987
 
787
- /**
788
- * Create an Error with the specified message, config, error code, request and response.
789
- *
790
- * @param {string} message The error message.
791
- * @param {string} [code] The error code (for example, 'ECONNABORTED').
792
- * @param {Object} [config] The config.
793
- * @param {Object} [request] The request.
794
- * @param {Object} [response] The response.
795
- * @returns {Error} The created error.
796
- */
797
- function AxiosError(message, code, config, request, response) {
798
- Error.call(this);
799
- this.message = message;
800
- this.name = 'AxiosError';
801
- code && (this.code = code);
802
- config && (this.config = config);
803
- request && (this.request = request);
804
- response && (this.response = response);
805
- }
988
+ return helpers.defaultVisitor.apply(this, arguments);
989
+ }
990
+ }, options));
991
+ };
806
992
 
807
- utils.inherits(AxiosError, Error, {
808
- toJSON: function toJSON() {
809
- return {
810
- // Standard
811
- message: this.message,
812
- name: this.name,
813
- // Microsoft
814
- description: this.description,
815
- number: this.number,
816
- // Mozilla
817
- fileName: this.fileName,
818
- lineNumber: this.lineNumber,
819
- columnNumber: this.columnNumber,
820
- stack: this.stack,
821
- // Axios
822
- config: this.config,
823
- code: this.code,
824
- status: this.response && this.response.status ? this.response.status : null
825
- };
993
+ function parsePropPath(name) {
994
+ // foo[x][y][z]
995
+ // foo.x.y.z
996
+ // foo-x-y-z
997
+ // foo x y z
998
+ return utils.matchAll(/\w+|\[(\w*)]/g, name).map(function(match) {
999
+ return match[0] === '[]' ? '' : match[1] || match[0];
1000
+ });
826
1001
  }
827
- });
828
-
829
- var prototype = AxiosError.prototype;
830
- var descriptors = {};
831
-
832
- [
833
- 'ERR_BAD_OPTION_VALUE',
834
- 'ERR_BAD_OPTION',
835
- 'ECONNABORTED',
836
- 'ETIMEDOUT',
837
- 'ERR_NETWORK',
838
- 'ERR_FR_TOO_MANY_REDIRECTS',
839
- 'ERR_DEPRECATED',
840
- 'ERR_BAD_RESPONSE',
841
- 'ERR_BAD_REQUEST',
842
- 'ERR_CANCELED'
843
- // eslint-disable-next-line func-names
844
- ].forEach(function(code) {
845
- descriptors[code] = {value: code};
846
- });
847
-
848
- Object.defineProperties(AxiosError, descriptors);
849
- Object.defineProperty(prototype, 'isAxiosError', {value: true});
850
-
851
- // eslint-disable-next-line func-names
852
- AxiosError.from = function(error, code, config, request, response, customProps) {
853
- var axiosError = Object.create(prototype);
854
-
855
- utils.toFlatObject(error, axiosError, function filter(obj) {
856
- return obj !== Error.prototype;
857
- });
858
-
859
- AxiosError.call(axiosError, error.message, code, config, request, response);
860
-
861
- axiosError.name = error.name;
862
-
863
- customProps && Object.assign(axiosError, customProps);
864
-
865
- return axiosError;
866
- };
867
-
868
- module.exports = AxiosError;
869
1002
 
1003
+ function arrayToObject(arr) {
1004
+ var obj = {};
1005
+ var keys = Object.keys(arr);
1006
+ var i;
1007
+ var len = keys.length;
1008
+ var key;
1009
+ for (i = 0; i < len; i++) {
1010
+ key = keys[i];
1011
+ obj[key] = arr[key];
1012
+ }
1013
+ return obj;
1014
+ }
870
1015
 
871
- /***/ }),
1016
+ function formDataToJSON(formData) {
1017
+ function buildPath(path, value, target, index) {
1018
+ var name = path[index++];
1019
+ var isNumericKey = Number.isFinite(+name);
1020
+ var isLast = index >= path.length;
1021
+ name = !name && utils.isArray(target) ? target.length : name;
872
1022
 
873
- /***/ "./lib/core/InterceptorManager.js":
874
- /*!****************************************!*\
875
- !*** ./lib/core/InterceptorManager.js ***!
876
- \****************************************/
877
- /*! no static exports found */
878
- /***/ (function(module, exports, __webpack_require__) {
1023
+ if (isLast) {
1024
+ if (utils.hasOwnProperty(target, name)) {
1025
+ target[name] = [target[name], value];
1026
+ } else {
1027
+ target[name] = value;
1028
+ }
879
1029
 
880
- "use strict";
1030
+ return !isNumericKey;
1031
+ }
881
1032
 
1033
+ if (!target[name] || !utils.isObject(target[name])) {
1034
+ target[name] = [];
1035
+ }
882
1036
 
883
- var utils = __webpack_require__(/*! ./../utils */ "./lib/utils.js");
1037
+ var result = buildPath(path, value, target[name], index);
884
1038
 
885
- function InterceptorManager() {
886
- this.handlers = [];
887
- }
1039
+ if (result && utils.isArray(target[name])) {
1040
+ target[name] = arrayToObject(target[name]);
1041
+ }
888
1042
 
889
- /**
890
- * Add a new interceptor to the stack
891
- *
892
- * @param {Function} fulfilled The function to handle `then` for a `Promise`
893
- * @param {Function} rejected The function to handle `reject` for a `Promise`
894
- *
895
- * @return {Number} An ID used to remove interceptor later
896
- */
897
- InterceptorManager.prototype.use = function use(fulfilled, rejected, options) {
898
- this.handlers.push({
899
- fulfilled: fulfilled,
900
- rejected: rejected,
901
- synchronous: options ? options.synchronous : false,
902
- runWhen: options ? options.runWhen : null
903
- });
904
- return this.handlers.length - 1;
905
- };
906
-
907
- /**
908
- * Remove an interceptor from the stack
909
- *
910
- * @param {Number} id The ID that was returned by `use`
911
- */
912
- InterceptorManager.prototype.eject = function eject(id) {
913
- if (this.handlers[id]) {
914
- this.handlers[id] = null;
915
- }
916
- };
917
-
918
- /**
919
- * Iterate over all the registered interceptors
920
- *
921
- * This method is particularly useful for skipping over any
922
- * interceptors that may have become `null` calling `eject`.
923
- *
924
- * @param {Function} fn The function to call for each interceptor
925
- */
926
- InterceptorManager.prototype.forEach = function forEach(fn) {
927
- utils.forEach(this.handlers, function forEachHandler(h) {
928
- if (h !== null) {
929
- fn(h);
1043
+ return !isNumericKey;
930
1044
  }
931
- });
932
- };
933
1045
 
934
- module.exports = InterceptorManager;
1046
+ if (utils.isFormData(formData) && utils.isFunction(formData.entries)) {
1047
+ var obj = {};
935
1048
 
1049
+ utils.forEachEntry(formData, function(name, value) {
1050
+ buildPath(parsePropPath(name), value, obj, 0);
1051
+ });
936
1052
 
937
- /***/ }),
1053
+ return obj;
1054
+ }
938
1055
 
939
- /***/ "./lib/core/buildFullPath.js":
940
- /*!***********************************!*\
941
- !*** ./lib/core/buildFullPath.js ***!
942
- \***********************************/
943
- /*! no static exports found */
944
- /***/ (function(module, exports, __webpack_require__) {
1056
+ return null;
1057
+ }
945
1058
 
946
- "use strict";
1059
+ var formDataToJSON_1 = formDataToJSON;
947
1060
 
1061
+ /**
1062
+ * Resolve or reject a Promise based on response status.
1063
+ *
1064
+ * @param {Function} resolve A function that resolves the promise.
1065
+ * @param {Function} reject A function that rejects the promise.
1066
+ * @param {object} response The response.
1067
+ */
1068
+ var settle = function settle(resolve, reject, response) {
1069
+ var validateStatus = response.config.validateStatus;
1070
+ if (!response.status || !validateStatus || validateStatus(response.status)) {
1071
+ resolve(response);
1072
+ } else {
1073
+ reject(new AxiosError_1(
1074
+ 'Request failed with status code ' + response.status,
1075
+ [AxiosError_1.ERR_BAD_REQUEST, AxiosError_1.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
1076
+ response.config,
1077
+ response.request,
1078
+ response
1079
+ ));
1080
+ }
1081
+ };
948
1082
 
949
- var isAbsoluteURL = __webpack_require__(/*! ../helpers/isAbsoluteURL */ "./lib/helpers/isAbsoluteURL.js");
950
- var combineURLs = __webpack_require__(/*! ../helpers/combineURLs */ "./lib/helpers/combineURLs.js");
1083
+ var cookies = (
1084
+ utils.isStandardBrowserEnv() ?
951
1085
 
952
- /**
953
- * Creates a new URL by combining the baseURL with the requestedURL,
954
- * only when the requestedURL is not already an absolute URL.
955
- * If the requestURL is absolute, this function returns the requestedURL untouched.
956
- *
957
- * @param {string} baseURL The base URL
958
- * @param {string} requestedURL Absolute or relative URL to combine
959
- * @returns {string} The combined full path
960
- */
961
- module.exports = function buildFullPath(baseURL, requestedURL) {
962
- if (baseURL && !isAbsoluteURL(requestedURL)) {
963
- return combineURLs(baseURL, requestedURL);
964
- }
965
- return requestedURL;
966
- };
1086
+ // Standard browser envs support document.cookie
1087
+ (function standardBrowserEnv() {
1088
+ return {
1089
+ write: function write(name, value, expires, path, domain, secure) {
1090
+ var cookie = [];
1091
+ cookie.push(name + '=' + encodeURIComponent(value));
967
1092
 
1093
+ if (utils.isNumber(expires)) {
1094
+ cookie.push('expires=' + new Date(expires).toGMTString());
1095
+ }
968
1096
 
969
- /***/ }),
1097
+ if (utils.isString(path)) {
1098
+ cookie.push('path=' + path);
1099
+ }
970
1100
 
971
- /***/ "./lib/core/dispatchRequest.js":
972
- /*!*************************************!*\
973
- !*** ./lib/core/dispatchRequest.js ***!
974
- \*************************************/
975
- /*! no static exports found */
976
- /***/ (function(module, exports, __webpack_require__) {
1101
+ if (utils.isString(domain)) {
1102
+ cookie.push('domain=' + domain);
1103
+ }
977
1104
 
978
- "use strict";
1105
+ if (secure === true) {
1106
+ cookie.push('secure');
1107
+ }
979
1108
 
1109
+ document.cookie = cookie.join('; ');
1110
+ },
980
1111
 
981
- var utils = __webpack_require__(/*! ./../utils */ "./lib/utils.js");
982
- var transformData = __webpack_require__(/*! ./transformData */ "./lib/core/transformData.js");
983
- var isCancel = __webpack_require__(/*! ../cancel/isCancel */ "./lib/cancel/isCancel.js");
984
- var defaults = __webpack_require__(/*! ../defaults */ "./lib/defaults/index.js");
985
- var CanceledError = __webpack_require__(/*! ../cancel/CanceledError */ "./lib/cancel/CanceledError.js");
1112
+ read: function read(name) {
1113
+ var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
1114
+ return (match ? decodeURIComponent(match[3]) : null);
1115
+ },
986
1116
 
987
- /**
988
- * Throws a `CanceledError` if cancellation has been requested.
989
- */
990
- function throwIfCancellationRequested(config) {
991
- if (config.cancelToken) {
992
- config.cancelToken.throwIfRequested();
993
- }
1117
+ remove: function remove(name) {
1118
+ this.write(name, '', Date.now() - 86400000);
1119
+ }
1120
+ };
1121
+ })() :
994
1122
 
995
- if (config.signal && config.signal.aborted) {
996
- throw new CanceledError();
997
- }
998
- }
999
-
1000
- /**
1001
- * Dispatch a request to the server using the configured adapter.
1002
- *
1003
- * @param {object} config The config that is to be used for the request
1004
- * @returns {Promise} The Promise to be fulfilled
1005
- */
1006
- module.exports = function dispatchRequest(config) {
1007
- throwIfCancellationRequested(config);
1008
-
1009
- // Ensure headers exist
1010
- config.headers = config.headers || {};
1011
-
1012
- // Transform request data
1013
- config.data = transformData.call(
1014
- config,
1015
- config.data,
1016
- config.headers,
1017
- config.transformRequest
1123
+ // Non standard browser env (web workers, react-native) lack needed support.
1124
+ (function nonStandardBrowserEnv() {
1125
+ return {
1126
+ write: function write() {},
1127
+ read: function read() { return null; },
1128
+ remove: function remove() {}
1129
+ };
1130
+ })()
1018
1131
  );
1019
1132
 
1020
- // Flatten headers
1021
- config.headers = utils.merge(
1022
- config.headers.common || {},
1023
- config.headers[config.method] || {},
1024
- config.headers
1025
- );
1133
+ /**
1134
+ * Determines whether the specified URL is absolute
1135
+ *
1136
+ * @param {string} url The URL to test
1137
+ * @returns {boolean} True if the specified URL is absolute, otherwise false
1138
+ */
1139
+ var isAbsoluteURL = function isAbsoluteURL(url) {
1140
+ // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
1141
+ // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
1142
+ // by any combination of letters, digits, plus, period, or hyphen.
1143
+ return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
1144
+ };
1145
+
1146
+ /**
1147
+ * Creates a new URL by combining the specified URLs
1148
+ *
1149
+ * @param {string} baseURL The base URL
1150
+ * @param {string} relativeURL The relative URL
1151
+ * @returns {string} The combined URL
1152
+ */
1153
+ var combineURLs = function combineURLs(baseURL, relativeURL) {
1154
+ return relativeURL
1155
+ ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
1156
+ : baseURL;
1157
+ };
1026
1158
 
1027
- utils.forEach(
1028
- ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
1029
- function cleanHeaderConfig(method) {
1030
- delete config.headers[method];
1159
+ /**
1160
+ * Creates a new URL by combining the baseURL with the requestedURL,
1161
+ * only when the requestedURL is not already an absolute URL.
1162
+ * If the requestURL is absolute, this function returns the requestedURL untouched.
1163
+ *
1164
+ * @param {string} baseURL The base URL
1165
+ * @param {string} requestedURL Absolute or relative URL to combine
1166
+ * @returns {string} The combined full path
1167
+ */
1168
+ var buildFullPath = function buildFullPath(baseURL, requestedURL) {
1169
+ if (baseURL && !isAbsoluteURL(requestedURL)) {
1170
+ return combineURLs(baseURL, requestedURL);
1031
1171
  }
1032
- );
1172
+ return requestedURL;
1173
+ };
1033
1174
 
1034
- var adapter = config.adapter || defaults.adapter;
1175
+ // Headers whose duplicates are ignored by node
1176
+ // c.f. https://nodejs.org/api/http.html#http_message_headers
1177
+ var ignoreDuplicateOf = [
1178
+ 'age', 'authorization', 'content-length', 'content-type', 'etag',
1179
+ 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
1180
+ 'last-modified', 'location', 'max-forwards', 'proxy-authorization',
1181
+ 'referer', 'retry-after', 'user-agent'
1182
+ ];
1035
1183
 
1036
- return adapter(config).then(function onAdapterResolution(response) {
1037
- throwIfCancellationRequested(config);
1184
+ /**
1185
+ * Parse headers into an object
1186
+ *
1187
+ * ```
1188
+ * Date: Wed, 27 Aug 2014 08:58:49 GMT
1189
+ * Content-Type: application/json
1190
+ * Connection: keep-alive
1191
+ * Transfer-Encoding: chunked
1192
+ * ```
1193
+ *
1194
+ * @param {String} headers Headers needing to be parsed
1195
+ * @returns {Object} Headers parsed into an object
1196
+ */
1197
+ var parseHeaders = function parseHeaders(headers) {
1198
+ var parsed = {};
1199
+ var key;
1200
+ var val;
1201
+ var i;
1038
1202
 
1039
- // Transform response data
1040
- response.data = transformData.call(
1041
- config,
1042
- response.data,
1043
- response.headers,
1044
- config.transformResponse
1045
- );
1203
+ if (!headers) { return parsed; }
1046
1204
 
1047
- return response;
1048
- }, function onAdapterRejection(reason) {
1049
- if (!isCancel(reason)) {
1050
- throwIfCancellationRequested(config);
1205
+ utils.forEach(headers.split('\n'), function parser(line) {
1206
+ i = line.indexOf(':');
1207
+ key = utils.trim(line.slice(0, i)).toLowerCase();
1208
+ val = utils.trim(line.slice(i + 1));
1051
1209
 
1052
- // Transform response data
1053
- if (reason && reason.response) {
1054
- reason.response.data = transformData.call(
1055
- config,
1056
- reason.response.data,
1057
- reason.response.headers,
1058
- config.transformResponse
1059
- );
1210
+ if (key) {
1211
+ if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {
1212
+ return;
1213
+ }
1214
+ if (key === 'set-cookie') {
1215
+ parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);
1216
+ } else {
1217
+ parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
1218
+ }
1060
1219
  }
1061
- }
1062
-
1063
- return Promise.reject(reason);
1064
- });
1065
- };
1066
-
1067
-
1068
- /***/ }),
1069
-
1070
- /***/ "./lib/core/mergeConfig.js":
1071
- /*!*********************************!*\
1072
- !*** ./lib/core/mergeConfig.js ***!
1073
- \*********************************/
1074
- /*! no static exports found */
1075
- /***/ (function(module, exports, __webpack_require__) {
1076
-
1077
- "use strict";
1078
-
1079
-
1080
- var utils = __webpack_require__(/*! ../utils */ "./lib/utils.js");
1081
-
1082
- /**
1083
- * Config-specific merge-function which creates a new config-object
1084
- * by merging two configuration objects together.
1085
- *
1086
- * @param {Object} config1
1087
- * @param {Object} config2
1088
- * @returns {Object} New object resulting from merging config2 to config1
1089
- */
1090
- module.exports = function mergeConfig(config1, config2) {
1091
- // eslint-disable-next-line no-param-reassign
1092
- config2 = config2 || {};
1093
- var config = {};
1094
-
1095
- function getMergedValue(target, source) {
1096
- if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
1097
- return utils.merge(target, source);
1098
- } else if (utils.isPlainObject(source)) {
1099
- return utils.merge({}, source);
1100
- } else if (utils.isArray(source)) {
1101
- return source.slice();
1102
- }
1103
- return source;
1104
- }
1220
+ });
1105
1221
 
1106
- // eslint-disable-next-line consistent-return
1107
- function mergeDeepProperties(prop) {
1108
- if (!utils.isUndefined(config2[prop])) {
1109
- return getMergedValue(config1[prop], config2[prop]);
1110
- } else if (!utils.isUndefined(config1[prop])) {
1111
- return getMergedValue(undefined, config1[prop]);
1112
- }
1113
- }
1222
+ return parsed;
1223
+ };
1114
1224
 
1115
- // eslint-disable-next-line consistent-return
1116
- function valueFromConfig2(prop) {
1117
- if (!utils.isUndefined(config2[prop])) {
1118
- return getMergedValue(undefined, config2[prop]);
1119
- }
1120
- }
1225
+ var isURLSameOrigin = (
1226
+ utils.isStandardBrowserEnv() ?
1227
+
1228
+ // Standard browser envs have full support of the APIs needed to test
1229
+ // whether the request URL is of the same origin as current location.
1230
+ (function standardBrowserEnv() {
1231
+ var msie = /(msie|trident)/i.test(navigator.userAgent);
1232
+ var urlParsingNode = document.createElement('a');
1233
+ var originURL;
1234
+
1235
+ /**
1236
+ * Parse a URL to discover it's components
1237
+ *
1238
+ * @param {String} url The URL to be parsed
1239
+ * @returns {Object}
1240
+ */
1241
+ function resolveURL(url) {
1242
+ var href = url;
1243
+
1244
+ if (msie) {
1245
+ // IE needs attribute set twice to normalize properties
1246
+ urlParsingNode.setAttribute('href', href);
1247
+ href = urlParsingNode.href;
1248
+ }
1121
1249
 
1122
- // eslint-disable-next-line consistent-return
1123
- function defaultToConfig2(prop) {
1124
- if (!utils.isUndefined(config2[prop])) {
1125
- return getMergedValue(undefined, config2[prop]);
1126
- } else if (!utils.isUndefined(config1[prop])) {
1127
- return getMergedValue(undefined, config1[prop]);
1128
- }
1129
- }
1250
+ urlParsingNode.setAttribute('href', href);
1130
1251
 
1131
- // eslint-disable-next-line consistent-return
1132
- function mergeDirectKeys(prop) {
1133
- if (prop in config2) {
1134
- return getMergedValue(config1[prop], config2[prop]);
1135
- } else if (prop in config1) {
1136
- return getMergedValue(undefined, config1[prop]);
1137
- }
1138
- }
1252
+ // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
1253
+ return {
1254
+ href: urlParsingNode.href,
1255
+ protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
1256
+ host: urlParsingNode.host,
1257
+ search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
1258
+ hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
1259
+ hostname: urlParsingNode.hostname,
1260
+ port: urlParsingNode.port,
1261
+ pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
1262
+ urlParsingNode.pathname :
1263
+ '/' + urlParsingNode.pathname
1264
+ };
1265
+ }
1139
1266
 
1140
- var mergeMap = {
1141
- 'url': valueFromConfig2,
1142
- 'method': valueFromConfig2,
1143
- 'data': valueFromConfig2,
1144
- 'baseURL': defaultToConfig2,
1145
- 'transformRequest': defaultToConfig2,
1146
- 'transformResponse': defaultToConfig2,
1147
- 'paramsSerializer': defaultToConfig2,
1148
- 'timeout': defaultToConfig2,
1149
- 'timeoutMessage': defaultToConfig2,
1150
- 'withCredentials': defaultToConfig2,
1151
- 'adapter': defaultToConfig2,
1152
- 'responseType': defaultToConfig2,
1153
- 'xsrfCookieName': defaultToConfig2,
1154
- 'xsrfHeaderName': defaultToConfig2,
1155
- 'onUploadProgress': defaultToConfig2,
1156
- 'onDownloadProgress': defaultToConfig2,
1157
- 'decompress': defaultToConfig2,
1158
- 'maxContentLength': defaultToConfig2,
1159
- 'maxBodyLength': defaultToConfig2,
1160
- 'beforeRedirect': defaultToConfig2,
1161
- 'transport': defaultToConfig2,
1162
- 'httpAgent': defaultToConfig2,
1163
- 'httpsAgent': defaultToConfig2,
1164
- 'cancelToken': defaultToConfig2,
1165
- 'socketPath': defaultToConfig2,
1166
- 'responseEncoding': defaultToConfig2,
1167
- 'validateStatus': mergeDirectKeys
1168
- };
1267
+ originURL = resolveURL(window.location.href);
1268
+
1269
+ /**
1270
+ * Determine if a URL shares the same origin as the current location
1271
+ *
1272
+ * @param {String} requestURL The URL to test
1273
+ * @returns {boolean} True if URL shares the same origin, otherwise false
1274
+ */
1275
+ return function isURLSameOrigin(requestURL) {
1276
+ var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
1277
+ return (parsed.protocol === originURL.protocol &&
1278
+ parsed.host === originURL.host);
1279
+ };
1280
+ })() :
1169
1281
 
1170
- utils.forEach(Object.keys(config1).concat(Object.keys(config2)), function computeConfigValue(prop) {
1171
- var merge = mergeMap[prop] || mergeDeepProperties;
1172
- var configValue = merge(prop);
1173
- (utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
1174
- });
1282
+ // Non standard browser envs (web workers, react-native) lack needed support.
1283
+ (function nonStandardBrowserEnv() {
1284
+ return function isURLSameOrigin() {
1285
+ return true;
1286
+ };
1287
+ })()
1288
+ );
1175
1289
 
1176
- return config;
1177
- };
1178
-
1179
-
1180
- /***/ }),
1181
-
1182
- /***/ "./lib/core/settle.js":
1183
- /*!****************************!*\
1184
- !*** ./lib/core/settle.js ***!
1185
- \****************************/
1186
- /*! no static exports found */
1187
- /***/ (function(module, exports, __webpack_require__) {
1188
-
1189
- "use strict";
1190
-
1191
-
1192
- var AxiosError = __webpack_require__(/*! ./AxiosError */ "./lib/core/AxiosError.js");
1193
-
1194
- /**
1195
- * Resolve or reject a Promise based on response status.
1196
- *
1197
- * @param {Function} resolve A function that resolves the promise.
1198
- * @param {Function} reject A function that rejects the promise.
1199
- * @param {object} response The response.
1200
- */
1201
- module.exports = function settle(resolve, reject, response) {
1202
- var validateStatus = response.config.validateStatus;
1203
- if (!response.status || !validateStatus || validateStatus(response.status)) {
1204
- resolve(response);
1205
- } else {
1206
- reject(new AxiosError(
1207
- 'Request failed with status code ' + response.status,
1208
- [AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
1209
- response.config,
1210
- response.request,
1211
- response
1212
- ));
1290
+ /**
1291
+ * A `CanceledError` is an object that is thrown when an operation is canceled.
1292
+ *
1293
+ * @class
1294
+ * @param {string=} message The message.
1295
+ * @param {Object=} config The config.
1296
+ * @param {Object=} request The request.
1297
+ */
1298
+ function CanceledError(message, config, request) {
1299
+ // eslint-disable-next-line no-eq-null,eqeqeq
1300
+ AxiosError_1.call(this, message == null ? 'canceled' : message, AxiosError_1.ERR_CANCELED, config, request);
1301
+ this.name = 'CanceledError';
1213
1302
  }
1214
- };
1215
1303
 
1304
+ utils.inherits(CanceledError, AxiosError_1, {
1305
+ __CANCEL__: true
1306
+ });
1216
1307
 
1217
- /***/ }),
1218
-
1219
- /***/ "./lib/core/transformData.js":
1220
- /*!***********************************!*\
1221
- !*** ./lib/core/transformData.js ***!
1222
- \***********************************/
1223
- /*! no static exports found */
1224
- /***/ (function(module, exports, __webpack_require__) {
1308
+ var CanceledError_1 = CanceledError;
1225
1309
 
1226
- "use strict";
1310
+ var parseProtocol = function parseProtocol(url) {
1311
+ var match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
1312
+ return match && match[1] || '';
1313
+ };
1227
1314
 
1315
+ var xhr = function xhrAdapter(config) {
1316
+ return new Promise(function dispatchXhrRequest(resolve, reject) {
1317
+ var requestData = config.data;
1318
+ var requestHeaders = config.headers;
1319
+ var responseType = config.responseType;
1320
+ var withXSRFToken = config.withXSRFToken;
1321
+ var onCanceled;
1322
+ function done() {
1323
+ if (config.cancelToken) {
1324
+ config.cancelToken.unsubscribe(onCanceled);
1325
+ }
1228
1326
 
1229
- var utils = __webpack_require__(/*! ./../utils */ "./lib/utils.js");
1230
- var defaults = __webpack_require__(/*! ../defaults */ "./lib/defaults/index.js");
1327
+ if (config.signal) {
1328
+ config.signal.removeEventListener('abort', onCanceled);
1329
+ }
1330
+ }
1231
1331
 
1232
- /**
1233
- * Transform the data for a request or a response
1234
- *
1235
- * @param {Object|String} data The data to be transformed
1236
- * @param {Array} headers The headers for the request or response
1237
- * @param {Array|Function} fns A single function or Array of functions
1238
- * @returns {*} The resulting transformed data
1239
- */
1240
- module.exports = function transformData(data, headers, fns) {
1241
- var context = this || defaults;
1242
- /*eslint no-param-reassign:0*/
1243
- utils.forEach(fns, function transform(fn) {
1244
- data = fn.call(context, data, headers);
1245
- });
1332
+ if (utils.isFormData(requestData) && utils.isStandardBrowserEnv()) {
1333
+ delete requestHeaders['Content-Type']; // Let the browser set it
1334
+ }
1246
1335
 
1247
- return data;
1248
- };
1336
+ var request = new XMLHttpRequest();
1249
1337
 
1338
+ // HTTP basic authentication
1339
+ if (config.auth) {
1340
+ var username = config.auth.username || '';
1341
+ var password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';
1342
+ requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
1343
+ }
1250
1344
 
1251
- /***/ }),
1345
+ var fullPath = buildFullPath(config.baseURL, config.url);
1252
1346
 
1253
- /***/ "./lib/defaults/index.js":
1254
- /*!*******************************!*\
1255
- !*** ./lib/defaults/index.js ***!
1256
- \*******************************/
1257
- /*! no static exports found */
1258
- /***/ (function(module, exports, __webpack_require__) {
1347
+ request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
1259
1348
 
1260
- "use strict";
1349
+ // Set the request timeout in MS
1350
+ request.timeout = config.timeout;
1261
1351
 
1352
+ function onloadend() {
1353
+ if (!request) {
1354
+ return;
1355
+ }
1356
+ // Prepare the response
1357
+ var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
1358
+ var responseData = !responseType || responseType === 'text' || responseType === 'json' ?
1359
+ request.responseText : request.response;
1360
+ var response = {
1361
+ data: responseData,
1362
+ status: request.status,
1363
+ statusText: request.statusText,
1364
+ headers: responseHeaders,
1365
+ config: config,
1366
+ request: request
1367
+ };
1262
1368
 
1263
- var utils = __webpack_require__(/*! ../utils */ "./lib/utils.js");
1264
- var normalizeHeaderName = __webpack_require__(/*! ../helpers/normalizeHeaderName */ "./lib/helpers/normalizeHeaderName.js");
1265
- var AxiosError = __webpack_require__(/*! ../core/AxiosError */ "./lib/core/AxiosError.js");
1266
- var transitionalDefaults = __webpack_require__(/*! ./transitional */ "./lib/defaults/transitional.js");
1267
- var toFormData = __webpack_require__(/*! ../helpers/toFormData */ "./lib/helpers/toFormData.js");
1369
+ settle(function _resolve(value) {
1370
+ resolve(value);
1371
+ done();
1372
+ }, function _reject(err) {
1373
+ reject(err);
1374
+ done();
1375
+ }, response);
1268
1376
 
1269
- var DEFAULT_CONTENT_TYPE = {
1270
- 'Content-Type': 'application/x-www-form-urlencoded'
1271
- };
1377
+ // Clean up request
1378
+ request = null;
1379
+ }
1272
1380
 
1273
- function setContentTypeIfUnset(headers, value) {
1274
- if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
1275
- headers['Content-Type'] = value;
1276
- }
1277
- }
1278
-
1279
- function getDefaultAdapter() {
1280
- var adapter;
1281
- if (typeof XMLHttpRequest !== 'undefined') {
1282
- // For browsers use XHR adapter
1283
- adapter = __webpack_require__(/*! ../adapters/xhr */ "./lib/adapters/xhr.js");
1284
- } else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {
1285
- // For node use HTTP adapter
1286
- adapter = __webpack_require__(/*! ../adapters/http */ "./lib/adapters/xhr.js");
1287
- }
1288
- return adapter;
1289
- }
1381
+ if ('onloadend' in request) {
1382
+ // Use onloadend if available
1383
+ request.onloadend = onloadend;
1384
+ } else {
1385
+ // Listen for ready state to emulate onloadend
1386
+ request.onreadystatechange = function handleLoad() {
1387
+ if (!request || request.readyState !== 4) {
1388
+ return;
1389
+ }
1290
1390
 
1291
- function stringifySafely(rawValue, parser, encoder) {
1292
- if (utils.isString(rawValue)) {
1293
- try {
1294
- (parser || JSON.parse)(rawValue);
1295
- return utils.trim(rawValue);
1296
- } catch (e) {
1297
- if (e.name !== 'SyntaxError') {
1298
- throw e;
1391
+ // The request errored out and we didn't get a response, this will be
1392
+ // handled by onerror instead
1393
+ // With one exception: request that using file: protocol, most browsers
1394
+ // will return status as 0 even though it's a successful request
1395
+ if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
1396
+ return;
1397
+ }
1398
+ // readystate handler is calling before onerror or ontimeout handlers,
1399
+ // so we should call onloadend on the next 'tick'
1400
+ setTimeout(onloadend);
1401
+ };
1299
1402
  }
1300
- }
1301
- }
1302
1403
 
1303
- return (encoder || JSON.stringify)(rawValue);
1304
- }
1404
+ // Handle browser request cancellation (as opposed to a manual cancellation)
1405
+ request.onabort = function handleAbort() {
1406
+ if (!request) {
1407
+ return;
1408
+ }
1305
1409
 
1306
- var defaults = {
1410
+ reject(new AxiosError_1('Request aborted', AxiosError_1.ECONNABORTED, config, request));
1307
1411
 
1308
- transitional: transitionalDefaults,
1412
+ // Clean up request
1413
+ request = null;
1414
+ };
1309
1415
 
1310
- adapter: getDefaultAdapter(),
1416
+ // Handle low level network errors
1417
+ request.onerror = function handleError() {
1418
+ // Real errors are hidden from us by the browser
1419
+ // onerror should only fire if it's a network error
1420
+ reject(new AxiosError_1('Network Error', AxiosError_1.ERR_NETWORK, config, request));
1311
1421
 
1312
- transformRequest: [function transformRequest(data, headers) {
1313
- normalizeHeaderName(headers, 'Accept');
1314
- normalizeHeaderName(headers, 'Content-Type');
1422
+ // Clean up request
1423
+ request = null;
1424
+ };
1315
1425
 
1316
- if (utils.isFormData(data) ||
1317
- utils.isArrayBuffer(data) ||
1318
- utils.isBuffer(data) ||
1319
- utils.isStream(data) ||
1320
- utils.isFile(data) ||
1321
- utils.isBlob(data)
1322
- ) {
1323
- return data;
1324
- }
1325
- if (utils.isArrayBufferView(data)) {
1326
- return data.buffer;
1327
- }
1328
- if (utils.isURLSearchParams(data)) {
1329
- setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
1330
- return data.toString();
1331
- }
1426
+ // Handle timeout
1427
+ request.ontimeout = function handleTimeout() {
1428
+ var timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';
1429
+ var transitional$1 = config.transitional || transitional;
1430
+ if (config.timeoutErrorMessage) {
1431
+ timeoutErrorMessage = config.timeoutErrorMessage;
1432
+ }
1433
+ reject(new AxiosError_1(
1434
+ timeoutErrorMessage,
1435
+ transitional$1.clarifyTimeoutError ? AxiosError_1.ETIMEDOUT : AxiosError_1.ECONNABORTED,
1436
+ config,
1437
+ request));
1332
1438
 
1333
- var isObjectPayload = utils.isObject(data);
1334
- var contentType = headers && headers['Content-Type'];
1439
+ // Clean up request
1440
+ request = null;
1441
+ };
1335
1442
 
1336
- var isFileList;
1443
+ // Add xsrf header
1444
+ // This is only done if running in a standard browser environment.
1445
+ // Specifically not if we're in a web worker, or react-native.
1446
+ if (utils.isStandardBrowserEnv()) {
1447
+ // Add xsrf header
1448
+ withXSRFToken && utils.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(config));
1449
+ if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(fullPath))) {
1450
+ // Add xsrf header
1451
+ var xsrfValue = config.xsrfHeaderName && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
1452
+ if (xsrfValue) {
1453
+ requestHeaders[config.xsrfHeaderName] = xsrfValue;
1454
+ }
1455
+ }
1456
+ }
1337
1457
 
1338
- if ((isFileList = utils.isFileList(data)) || (isObjectPayload && contentType === 'multipart/form-data')) {
1339
- var _FormData = this.env && this.env.FormData;
1340
- return toFormData(isFileList ? {'files[]': data} : data, _FormData && new _FormData());
1341
- } else if (isObjectPayload || contentType === 'application/json') {
1342
- setContentTypeIfUnset(headers, 'application/json');
1343
- return stringifySafely(data);
1344
- }
1458
+ // Add headers to the request
1459
+ if ('setRequestHeader' in request) {
1460
+ utils.forEach(requestHeaders, function setRequestHeader(val, key) {
1461
+ if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {
1462
+ // Remove Content-Type if data is undefined
1463
+ delete requestHeaders[key];
1464
+ } else {
1465
+ // Otherwise add header to the request
1466
+ request.setRequestHeader(key, val);
1467
+ }
1468
+ });
1469
+ }
1345
1470
 
1346
- return data;
1347
- }],
1471
+ // Add withCredentials to request if needed
1472
+ if (!utils.isUndefined(config.withCredentials)) {
1473
+ request.withCredentials = !!config.withCredentials;
1474
+ }
1348
1475
 
1349
- transformResponse: [function transformResponse(data) {
1350
- var transitional = this.transitional || defaults.transitional;
1351
- var silentJSONParsing = transitional && transitional.silentJSONParsing;
1352
- var forcedJSONParsing = transitional && transitional.forcedJSONParsing;
1353
- var strictJSONParsing = !silentJSONParsing && this.responseType === 'json';
1476
+ // Add responseType to request if needed
1477
+ if (responseType && responseType !== 'json') {
1478
+ request.responseType = config.responseType;
1479
+ }
1354
1480
 
1355
- if (strictJSONParsing || (forcedJSONParsing && utils.isString(data) && data.length)) {
1356
- try {
1357
- return JSON.parse(data);
1358
- } catch (e) {
1359
- if (strictJSONParsing) {
1360
- if (e.name === 'SyntaxError') {
1361
- throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response);
1481
+ // Handle progress if needed
1482
+ if (typeof config.onDownloadProgress === 'function') {
1483
+ request.addEventListener('progress', config.onDownloadProgress);
1484
+ }
1485
+
1486
+ // Not all browsers support upload events
1487
+ if (typeof config.onUploadProgress === 'function' && request.upload) {
1488
+ request.upload.addEventListener('progress', config.onUploadProgress);
1489
+ }
1490
+
1491
+ if (config.cancelToken || config.signal) {
1492
+ // Handle cancellation
1493
+ // eslint-disable-next-line func-names
1494
+ onCanceled = function(cancel) {
1495
+ if (!request) {
1496
+ return;
1362
1497
  }
1363
- throw e;
1498
+ reject(!cancel || cancel.type ? new CanceledError_1(null, config, req) : cancel);
1499
+ request.abort();
1500
+ request = null;
1501
+ };
1502
+
1503
+ config.cancelToken && config.cancelToken.subscribe(onCanceled);
1504
+ if (config.signal) {
1505
+ config.signal.aborted ? onCanceled() : config.signal.addEventListener('abort', onCanceled);
1364
1506
  }
1365
1507
  }
1366
- }
1367
1508
 
1368
- return data;
1369
- }],
1509
+ // false, 0 (zero number), and '' (empty string) are valid JSON values
1510
+ if (!requestData && requestData !== false && requestData !== 0 && requestData !== '') {
1511
+ requestData = null;
1512
+ }
1370
1513
 
1371
- /**
1372
- * A timeout in milliseconds to abort a request. If set to 0 (default) a
1373
- * timeout is not created.
1374
- */
1375
- timeout: 0,
1514
+ var protocol = parseProtocol(fullPath);
1376
1515
 
1377
- xsrfCookieName: 'XSRF-TOKEN',
1378
- xsrfHeaderName: 'X-XSRF-TOKEN',
1516
+ if (protocol && platform.protocols.indexOf(protocol) === -1) {
1517
+ reject(new AxiosError_1('Unsupported protocol ' + protocol + ':', AxiosError_1.ERR_BAD_REQUEST, config));
1518
+ return;
1519
+ }
1379
1520
 
1380
- maxContentLength: -1,
1381
- maxBodyLength: -1,
1382
1521
 
1383
- env: {
1384
- FormData: __webpack_require__(/*! ./env/FormData */ "./lib/helpers/null.js")
1385
- },
1522
+ // Send the request
1523
+ request.send(requestData);
1524
+ });
1525
+ };
1386
1526
 
1387
- validateStatus: function validateStatus(status) {
1388
- return status >= 200 && status < 300;
1389
- },
1527
+ var DEFAULT_CONTENT_TYPE = {
1528
+ 'Content-Type': 'application/x-www-form-urlencoded'
1529
+ };
1390
1530
 
1391
- headers: {
1392
- common: {
1393
- 'Accept': 'application/json, text/plain, */*'
1531
+ function setContentTypeIfUnset(headers, value) {
1532
+ if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
1533
+ headers['Content-Type'] = value;
1394
1534
  }
1395
1535
  }
1396
- };
1397
-
1398
- utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
1399
- defaults.headers[method] = {};
1400
- });
1401
-
1402
- utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
1403
- defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
1404
- });
1405
-
1406
- module.exports = defaults;
1407
1536
 
1537
+ function getDefaultAdapter() {
1538
+ var adapter;
1539
+ if (typeof XMLHttpRequest !== 'undefined') {
1540
+ // For browsers use XHR adapter
1541
+ adapter = xhr;
1542
+ } else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {
1543
+ // For node use HTTP adapter
1544
+ adapter = xhr;
1545
+ }
1546
+ return adapter;
1547
+ }
1408
1548
 
1409
- /***/ }),
1410
-
1411
- /***/ "./lib/defaults/transitional.js":
1412
- /*!**************************************!*\
1413
- !*** ./lib/defaults/transitional.js ***!
1414
- \**************************************/
1415
- /*! no static exports found */
1416
- /***/ (function(module, exports, __webpack_require__) {
1549
+ function stringifySafely(rawValue, parser, encoder) {
1550
+ if (utils.isString(rawValue)) {
1551
+ try {
1552
+ (parser || JSON.parse)(rawValue);
1553
+ return utils.trim(rawValue);
1554
+ } catch (e) {
1555
+ if (e.name !== 'SyntaxError') {
1556
+ throw e;
1557
+ }
1558
+ }
1559
+ }
1417
1560
 
1418
- "use strict";
1561
+ return (encoder || JSON.stringify)(rawValue);
1562
+ }
1419
1563
 
1564
+ var defaults = {
1420
1565
 
1421
- module.exports = {
1422
- silentJSONParsing: true,
1423
- forcedJSONParsing: true,
1424
- clarifyTimeoutError: false
1425
- };
1566
+ transitional: transitional,
1426
1567
 
1568
+ adapter: getDefaultAdapter(),
1427
1569
 
1428
- /***/ }),
1570
+ transformRequest: [function transformRequest(data, headers) {
1571
+ normalizeHeaderName(headers, 'Accept');
1572
+ normalizeHeaderName(headers, 'Content-Type');
1429
1573
 
1430
- /***/ "./lib/env/data.js":
1431
- /*!*************************!*\
1432
- !*** ./lib/env/data.js ***!
1433
- \*************************/
1434
- /*! no static exports found */
1435
- /***/ (function(module, exports) {
1574
+ var contentType = headers && headers['Content-Type'] || '';
1575
+ var hasJSONContentType = contentType.indexOf('application/json') > -1;
1576
+ var isObjectPayload = utils.isObject(data);
1436
1577
 
1437
- module.exports = {
1438
- "version": "0.27.2"
1439
- };
1578
+ if (isObjectPayload && utils.isHTMLForm(data)) {
1579
+ data = new FormData(data);
1580
+ }
1440
1581
 
1441
- /***/ }),
1582
+ var isFormData = utils.isFormData(data);
1442
1583
 
1443
- /***/ "./lib/helpers/bind.js":
1444
- /*!*****************************!*\
1445
- !*** ./lib/helpers/bind.js ***!
1446
- \*****************************/
1447
- /*! no static exports found */
1448
- /***/ (function(module, exports, __webpack_require__) {
1584
+ if (isFormData) {
1585
+ return hasJSONContentType ? JSON.stringify(formDataToJSON_1(data)) : data;
1586
+ }
1449
1587
 
1450
- "use strict";
1588
+ if (utils.isArrayBuffer(data) ||
1589
+ utils.isBuffer(data) ||
1590
+ utils.isStream(data) ||
1591
+ utils.isFile(data) ||
1592
+ utils.isBlob(data)
1593
+ ) {
1594
+ return data;
1595
+ }
1596
+ if (utils.isArrayBufferView(data)) {
1597
+ return data.buffer;
1598
+ }
1599
+ if (utils.isURLSearchParams(data)) {
1600
+ setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
1601
+ return data.toString();
1602
+ }
1451
1603
 
1604
+ var isFileList;
1452
1605
 
1453
- module.exports = function bind(fn, thisArg) {
1454
- return function wrap() {
1455
- var args = new Array(arguments.length);
1456
- for (var i = 0; i < args.length; i++) {
1457
- args[i] = arguments[i];
1458
- }
1459
- return fn.apply(thisArg, args);
1460
- };
1461
- };
1462
-
1463
-
1464
- /***/ }),
1465
-
1466
- /***/ "./lib/helpers/buildURL.js":
1467
- /*!*********************************!*\
1468
- !*** ./lib/helpers/buildURL.js ***!
1469
- \*********************************/
1470
- /*! no static exports found */
1471
- /***/ (function(module, exports, __webpack_require__) {
1472
-
1473
- "use strict";
1474
-
1475
-
1476
- var utils = __webpack_require__(/*! ./../utils */ "./lib/utils.js");
1477
-
1478
- function encode(val) {
1479
- return encodeURIComponent(val).
1480
- replace(/%3A/gi, ':').
1481
- replace(/%24/g, '$').
1482
- replace(/%2C/gi, ',').
1483
- replace(/%20/g, '+').
1484
- replace(/%5B/gi, '[').
1485
- replace(/%5D/gi, ']');
1486
- }
1487
-
1488
- /**
1489
- * Build a URL by appending params to the end
1490
- *
1491
- * @param {string} url The base of the url (e.g., http://www.google.com)
1492
- * @param {object} [params] The params to be appended
1493
- * @returns {string} The formatted url
1494
- */
1495
- module.exports = function buildURL(url, params, paramsSerializer) {
1496
- /*eslint no-param-reassign:0*/
1497
- if (!params) {
1498
- return url;
1499
- }
1606
+ if (isObjectPayload) {
1607
+ if (contentType.indexOf('application/x-www-form-urlencoded') !== -1) {
1608
+ return toURLEncodedForm(data, this.formSerializer).toString();
1609
+ }
1500
1610
 
1501
- var serializedParams;
1502
- if (paramsSerializer) {
1503
- serializedParams = paramsSerializer(params);
1504
- } else if (utils.isURLSearchParams(params)) {
1505
- serializedParams = params.toString();
1506
- } else {
1507
- var parts = [];
1611
+ if ((isFileList = utils.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
1612
+ var _FormData = this.env && this.env.FormData;
1508
1613
 
1509
- utils.forEach(params, function serialize(val, key) {
1510
- if (val === null || typeof val === 'undefined') {
1511
- return;
1614
+ return toFormData_1(
1615
+ isFileList ? {'files[]': data} : data,
1616
+ _FormData && new _FormData(),
1617
+ this.formSerializer
1618
+ );
1619
+ }
1512
1620
  }
1513
1621
 
1514
- if (utils.isArray(val)) {
1515
- key = key + '[]';
1516
- } else {
1517
- val = [val];
1622
+ if (isObjectPayload || hasJSONContentType ) {
1623
+ setContentTypeIfUnset(headers, 'application/json');
1624
+ return stringifySafely(data);
1518
1625
  }
1519
1626
 
1520
- utils.forEach(val, function parseValue(v) {
1521
- if (utils.isDate(v)) {
1522
- v = v.toISOString();
1523
- } else if (utils.isObject(v)) {
1524
- v = JSON.stringify(v);
1627
+ return data;
1628
+ }],
1629
+
1630
+ transformResponse: [function transformResponse(data) {
1631
+ var transitional = this.transitional || defaults.transitional;
1632
+ var forcedJSONParsing = transitional && transitional.forcedJSONParsing;
1633
+ var JSONRequested = this.responseType === 'json';
1634
+
1635
+ if (data && utils.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
1636
+ var silentJSONParsing = transitional && transitional.silentJSONParsing;
1637
+ var strictJSONParsing = !silentJSONParsing && JSONRequested;
1638
+
1639
+ try {
1640
+ return JSON.parse(data);
1641
+ } catch (e) {
1642
+ if (strictJSONParsing) {
1643
+ if (e.name === 'SyntaxError') {
1644
+ throw AxiosError_1.from(e, AxiosError_1.ERR_BAD_RESPONSE, this, null, this.response);
1645
+ }
1646
+ throw e;
1647
+ }
1525
1648
  }
1526
- parts.push(encode(key) + '=' + encode(v));
1527
- });
1528
- });
1649
+ }
1529
1650
 
1530
- serializedParams = parts.join('&');
1531
- }
1651
+ return data;
1652
+ }],
1532
1653
 
1533
- if (serializedParams) {
1534
- var hashmarkIndex = url.indexOf('#');
1535
- if (hashmarkIndex !== -1) {
1536
- url = url.slice(0, hashmarkIndex);
1537
- }
1654
+ /**
1655
+ * A timeout in milliseconds to abort a request. If set to 0 (default) a
1656
+ * timeout is not created.
1657
+ */
1658
+ timeout: 0,
1538
1659
 
1539
- url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
1540
- }
1660
+ xsrfCookieName: 'XSRF-TOKEN',
1661
+ xsrfHeaderName: 'X-XSRF-TOKEN',
1541
1662
 
1542
- return url;
1543
- };
1663
+ maxContentLength: -1,
1664
+ maxBodyLength: -1,
1544
1665
 
1666
+ env: {
1667
+ FormData: platform.classes.FormData,
1668
+ Blob: platform.classes.Blob
1669
+ },
1545
1670
 
1546
- /***/ }),
1671
+ validateStatus: function validateStatus(status) {
1672
+ return status >= 200 && status < 300;
1673
+ },
1547
1674
 
1548
- /***/ "./lib/helpers/combineURLs.js":
1549
- /*!************************************!*\
1550
- !*** ./lib/helpers/combineURLs.js ***!
1551
- \************************************/
1552
- /*! no static exports found */
1553
- /***/ (function(module, exports, __webpack_require__) {
1675
+ headers: {
1676
+ common: {
1677
+ 'Accept': 'application/json, text/plain, */*'
1678
+ }
1679
+ }
1680
+ };
1554
1681
 
1555
- "use strict";
1682
+ utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
1683
+ defaults.headers[method] = {};
1684
+ });
1556
1685
 
1686
+ utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
1687
+ defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
1688
+ });
1557
1689
 
1558
- /**
1559
- * Creates a new URL by combining the specified URLs
1560
- *
1561
- * @param {string} baseURL The base URL
1562
- * @param {string} relativeURL The relative URL
1563
- * @returns {string} The combined URL
1564
- */
1565
- module.exports = function combineURLs(baseURL, relativeURL) {
1566
- return relativeURL
1567
- ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
1568
- : baseURL;
1569
- };
1690
+ var defaults_1 = defaults;
1570
1691
 
1692
+ /**
1693
+ * Transform the data for a request or a response
1694
+ *
1695
+ * @param {Object|String} data The data to be transformed
1696
+ * @param {Array} headers The headers for the request or response
1697
+ * @param {Number} status HTTP status code
1698
+ * @param {Array|Function} fns A single function or Array of functions
1699
+ * @returns {*} The resulting transformed data
1700
+ */
1701
+ var transformData = function transformData(data, headers, status, fns) {
1702
+ var context = this || defaults_1;
1703
+ /*eslint no-param-reassign:0*/
1704
+ utils.forEach(fns, function transform(fn) {
1705
+ data = fn.call(context, data, headers, status);
1706
+ });
1571
1707
 
1572
- /***/ }),
1708
+ return data;
1709
+ };
1573
1710
 
1574
- /***/ "./lib/helpers/cookies.js":
1575
- /*!********************************!*\
1576
- !*** ./lib/helpers/cookies.js ***!
1577
- \********************************/
1578
- /*! no static exports found */
1579
- /***/ (function(module, exports, __webpack_require__) {
1711
+ var isCancel = function isCancel(value) {
1712
+ return !!(value && value.__CANCEL__);
1713
+ };
1580
1714
 
1581
- "use strict";
1715
+ /**
1716
+ * Throws a `CanceledError` if cancellation has been requested.
1717
+ */
1718
+ function throwIfCancellationRequested(config) {
1719
+ if (config.cancelToken) {
1720
+ config.cancelToken.throwIfRequested();
1721
+ }
1582
1722
 
1723
+ if (config.signal && config.signal.aborted) {
1724
+ throw new CanceledError_1();
1725
+ }
1726
+ }
1583
1727
 
1584
- var utils = __webpack_require__(/*! ./../utils */ "./lib/utils.js");
1728
+ /**
1729
+ * Dispatch a request to the server using the configured adapter.
1730
+ *
1731
+ * @param {object} config The config that is to be used for the request
1732
+ * @returns {Promise} The Promise to be fulfilled
1733
+ */
1734
+ var dispatchRequest = function dispatchRequest(config) {
1735
+ throwIfCancellationRequested(config);
1585
1736
 
1586
- module.exports = (
1587
- utils.isStandardBrowserEnv() ?
1737
+ // Ensure headers exist
1738
+ config.headers = config.headers || {};
1588
1739
 
1589
- // Standard browser envs support document.cookie
1590
- (function standardBrowserEnv() {
1591
- return {
1592
- write: function write(name, value, expires, path, domain, secure) {
1593
- var cookie = [];
1594
- cookie.push(name + '=' + encodeURIComponent(value));
1740
+ // Transform request data
1741
+ config.data = transformData.call(
1742
+ config,
1743
+ config.data,
1744
+ config.headers,
1745
+ null,
1746
+ config.transformRequest
1747
+ );
1595
1748
 
1596
- if (utils.isNumber(expires)) {
1597
- cookie.push('expires=' + new Date(expires).toGMTString());
1598
- }
1749
+ normalizeHeaderName(config.headers, 'Accept');
1750
+ normalizeHeaderName(config.headers, 'Content-Type');
1599
1751
 
1600
- if (utils.isString(path)) {
1601
- cookie.push('path=' + path);
1602
- }
1752
+ // Flatten headers
1753
+ config.headers = utils.merge(
1754
+ config.headers.common || {},
1755
+ config.headers[config.method] || {},
1756
+ config.headers
1757
+ );
1603
1758
 
1604
- if (utils.isString(domain)) {
1605
- cookie.push('domain=' + domain);
1606
- }
1759
+ utils.forEach(
1760
+ ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
1761
+ function cleanHeaderConfig(method) {
1762
+ delete config.headers[method];
1763
+ }
1764
+ );
1607
1765
 
1608
- if (secure === true) {
1609
- cookie.push('secure');
1610
- }
1766
+ var adapter = config.adapter || defaults_1.adapter;
1611
1767
 
1612
- document.cookie = cookie.join('; ');
1613
- },
1768
+ return adapter(config).then(function onAdapterResolution(response) {
1769
+ throwIfCancellationRequested(config);
1614
1770
 
1615
- read: function read(name) {
1616
- var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
1617
- return (match ? decodeURIComponent(match[3]) : null);
1618
- },
1771
+ // Transform response data
1772
+ response.data = transformData.call(
1773
+ config,
1774
+ response.data,
1775
+ response.headers,
1776
+ response.status,
1777
+ config.transformResponse
1778
+ );
1619
1779
 
1620
- remove: function remove(name) {
1621
- this.write(name, '', Date.now() - 86400000);
1780
+ return response;
1781
+ }, function onAdapterRejection(reason) {
1782
+ if (!isCancel(reason)) {
1783
+ throwIfCancellationRequested(config);
1784
+
1785
+ // Transform response data
1786
+ if (reason && reason.response) {
1787
+ reason.response.data = transformData.call(
1788
+ config,
1789
+ reason.response.data,
1790
+ reason.response.headers,
1791
+ reason.response.status,
1792
+ config.transformResponse
1793
+ );
1622
1794
  }
1623
- };
1624
- })() :
1625
-
1626
- // Non standard browser env (web workers, react-native) lack needed support.
1627
- (function nonStandardBrowserEnv() {
1628
- return {
1629
- write: function write() {},
1630
- read: function read() { return null; },
1631
- remove: function remove() {}
1632
- };
1633
- })()
1634
- );
1635
-
1636
-
1637
- /***/ }),
1795
+ }
1638
1796
 
1639
- /***/ "./lib/helpers/isAbsoluteURL.js":
1640
- /*!**************************************!*\
1641
- !*** ./lib/helpers/isAbsoluteURL.js ***!
1642
- \**************************************/
1643
- /*! no static exports found */
1644
- /***/ (function(module, exports, __webpack_require__) {
1797
+ return Promise.reject(reason);
1798
+ });
1799
+ };
1645
1800
 
1646
- "use strict";
1801
+ /**
1802
+ * Config-specific merge-function which creates a new config-object
1803
+ * by merging two configuration objects together.
1804
+ *
1805
+ * @param {Object} config1
1806
+ * @param {Object} config2
1807
+ * @returns {Object} New object resulting from merging config2 to config1
1808
+ */
1809
+ var mergeConfig = function mergeConfig(config1, config2) {
1810
+ // eslint-disable-next-line no-param-reassign
1811
+ config2 = config2 || {};
1812
+ var config = {};
1813
+
1814
+ function getMergedValue(target, source) {
1815
+ if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
1816
+ return utils.merge(target, source);
1817
+ } else if (utils.isEmptyObject(source)) {
1818
+ return utils.merge({}, target);
1819
+ } else if (utils.isPlainObject(source)) {
1820
+ return utils.merge({}, source);
1821
+ } else if (utils.isArray(source)) {
1822
+ return source.slice();
1823
+ }
1824
+ return source;
1825
+ }
1647
1826
 
1827
+ // eslint-disable-next-line consistent-return
1828
+ function mergeDeepProperties(prop) {
1829
+ if (!utils.isUndefined(config2[prop])) {
1830
+ return getMergedValue(config1[prop], config2[prop]);
1831
+ } else if (!utils.isUndefined(config1[prop])) {
1832
+ return getMergedValue(undefined, config1[prop]);
1833
+ }
1834
+ }
1648
1835
 
1649
- /**
1650
- * Determines whether the specified URL is absolute
1651
- *
1652
- * @param {string} url The URL to test
1653
- * @returns {boolean} True if the specified URL is absolute, otherwise false
1654
- */
1655
- module.exports = function isAbsoluteURL(url) {
1656
- // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
1657
- // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
1658
- // by any combination of letters, digits, plus, period, or hyphen.
1659
- return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
1660
- };
1836
+ // eslint-disable-next-line consistent-return
1837
+ function valueFromConfig2(prop) {
1838
+ if (!utils.isUndefined(config2[prop])) {
1839
+ return getMergedValue(undefined, config2[prop]);
1840
+ }
1841
+ }
1661
1842
 
1843
+ // eslint-disable-next-line consistent-return
1844
+ function defaultToConfig2(prop) {
1845
+ if (!utils.isUndefined(config2[prop])) {
1846
+ return getMergedValue(undefined, config2[prop]);
1847
+ } else if (!utils.isUndefined(config1[prop])) {
1848
+ return getMergedValue(undefined, config1[prop]);
1849
+ }
1850
+ }
1662
1851
 
1663
- /***/ }),
1852
+ // eslint-disable-next-line consistent-return
1853
+ function mergeDirectKeys(prop) {
1854
+ if (prop in config2) {
1855
+ return getMergedValue(config1[prop], config2[prop]);
1856
+ } else if (prop in config1) {
1857
+ return getMergedValue(undefined, config1[prop]);
1858
+ }
1859
+ }
1664
1860
 
1665
- /***/ "./lib/helpers/isAxiosError.js":
1666
- /*!*************************************!*\
1667
- !*** ./lib/helpers/isAxiosError.js ***!
1668
- \*************************************/
1669
- /*! no static exports found */
1670
- /***/ (function(module, exports, __webpack_require__) {
1861
+ var mergeMap = {
1862
+ 'url': valueFromConfig2,
1863
+ 'method': valueFromConfig2,
1864
+ 'data': valueFromConfig2,
1865
+ 'baseURL': defaultToConfig2,
1866
+ 'transformRequest': defaultToConfig2,
1867
+ 'transformResponse': defaultToConfig2,
1868
+ 'paramsSerializer': defaultToConfig2,
1869
+ 'timeout': defaultToConfig2,
1870
+ 'timeoutMessage': defaultToConfig2,
1871
+ 'withCredentials': defaultToConfig2,
1872
+ 'withXSRFToken': defaultToConfig2,
1873
+ 'adapter': defaultToConfig2,
1874
+ 'responseType': defaultToConfig2,
1875
+ 'xsrfCookieName': defaultToConfig2,
1876
+ 'xsrfHeaderName': defaultToConfig2,
1877
+ 'onUploadProgress': defaultToConfig2,
1878
+ 'onDownloadProgress': defaultToConfig2,
1879
+ 'decompress': defaultToConfig2,
1880
+ 'maxContentLength': defaultToConfig2,
1881
+ 'maxBodyLength': defaultToConfig2,
1882
+ 'beforeRedirect': defaultToConfig2,
1883
+ 'transport': defaultToConfig2,
1884
+ 'httpAgent': defaultToConfig2,
1885
+ 'httpsAgent': defaultToConfig2,
1886
+ 'cancelToken': defaultToConfig2,
1887
+ 'socketPath': defaultToConfig2,
1888
+ 'responseEncoding': defaultToConfig2,
1889
+ 'validateStatus': mergeDirectKeys
1890
+ };
1671
1891
 
1672
- "use strict";
1892
+ utils.forEach(Object.keys(config1).concat(Object.keys(config2)), function computeConfigValue(prop) {
1893
+ var merge = mergeMap[prop] || mergeDeepProperties;
1894
+ var configValue = merge(prop);
1895
+ (utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
1896
+ });
1673
1897
 
1898
+ return config;
1899
+ };
1674
1900
 
1675
- var utils = __webpack_require__(/*! ./../utils */ "./lib/utils.js");
1901
+ var data = {
1902
+ "version": "0.28.0"
1903
+ };
1676
1904
 
1677
- /**
1678
- * Determines whether the payload is an error thrown by Axios
1679
- *
1680
- * @param {*} payload The value to test
1681
- * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
1682
- */
1683
- module.exports = function isAxiosError(payload) {
1684
- return utils.isObject(payload) && (payload.isAxiosError === true);
1685
- };
1905
+ var VERSION = data.version;
1686
1906
 
1687
1907
 
1688
- /***/ }),
1908
+ var validators$1 = {};
1689
1909
 
1690
- /***/ "./lib/helpers/isURLSameOrigin.js":
1691
- /*!****************************************!*\
1692
- !*** ./lib/helpers/isURLSameOrigin.js ***!
1693
- \****************************************/
1694
- /*! no static exports found */
1695
- /***/ (function(module, exports, __webpack_require__) {
1910
+ // eslint-disable-next-line func-names
1911
+ ['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach(function(type, i) {
1912
+ validators$1[type] = function validator(thing) {
1913
+ return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type;
1914
+ };
1915
+ });
1696
1916
 
1697
- "use strict";
1917
+ var deprecatedWarnings = {};
1698
1918
 
1919
+ /**
1920
+ * Transitional option validator
1921
+ * @param {function|boolean?} validator - set to false if the transitional option has been removed
1922
+ * @param {string?} version - deprecated version / removed since version
1923
+ * @param {string?} message - some message with additional info
1924
+ * @returns {function}
1925
+ */
1926
+ validators$1.transitional = function transitional(validator, version, message) {
1927
+ function formatMessage(opt, desc) {
1928
+ return '[Axios v' + VERSION + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : '');
1929
+ }
1699
1930
 
1700
- var utils = __webpack_require__(/*! ./../utils */ "./lib/utils.js");
1931
+ // eslint-disable-next-line func-names
1932
+ return function(value, opt, opts) {
1933
+ if (validator === false) {
1934
+ throw new AxiosError_1(
1935
+ formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')),
1936
+ AxiosError_1.ERR_DEPRECATED
1937
+ );
1938
+ }
1701
1939
 
1702
- module.exports = (
1703
- utils.isStandardBrowserEnv() ?
1940
+ if (version && !deprecatedWarnings[opt]) {
1941
+ deprecatedWarnings[opt] = true;
1942
+ // eslint-disable-next-line no-console
1943
+ console.warn(
1944
+ formatMessage(
1945
+ opt,
1946
+ ' has been deprecated since v' + version + ' and will be removed in the near future'
1947
+ )
1948
+ );
1949
+ }
1704
1950
 
1705
- // Standard browser envs have full support of the APIs needed to test
1706
- // whether the request URL is of the same origin as current location.
1707
- (function standardBrowserEnv() {
1708
- var msie = /(msie|trident)/i.test(navigator.userAgent);
1709
- var urlParsingNode = document.createElement('a');
1710
- var originURL;
1951
+ return validator ? validator(value, opt, opts) : true;
1952
+ };
1953
+ };
1711
1954
 
1712
- /**
1713
- * Parse a URL to discover it's components
1714
- *
1715
- * @param {String} url The URL to be parsed
1716
- * @returns {Object}
1717
- */
1718
- function resolveURL(url) {
1719
- var href = url;
1955
+ /**
1956
+ * Assert object's properties type
1957
+ * @param {object} options
1958
+ * @param {object} schema
1959
+ * @param {boolean?} allowUnknown
1960
+ */
1720
1961
 
1721
- if (msie) {
1722
- // IE needs attribute set twice to normalize properties
1723
- urlParsingNode.setAttribute('href', href);
1724
- href = urlParsingNode.href;
1962
+ function assertOptions(options, schema, allowUnknown) {
1963
+ if (typeof options !== 'object') {
1964
+ throw new AxiosError_1('options must be an object', AxiosError_1.ERR_BAD_OPTION_VALUE);
1965
+ }
1966
+ var keys = Object.keys(options);
1967
+ var i = keys.length;
1968
+ while (i-- > 0) {
1969
+ var opt = keys[i];
1970
+ var validator = schema[opt];
1971
+ if (validator) {
1972
+ var value = options[opt];
1973
+ var result = value === undefined || validator(value, opt, options);
1974
+ if (result !== true) {
1975
+ throw new AxiosError_1('option ' + opt + ' must be ' + result, AxiosError_1.ERR_BAD_OPTION_VALUE);
1725
1976
  }
1726
-
1727
- urlParsingNode.setAttribute('href', href);
1728
-
1729
- // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
1730
- return {
1731
- href: urlParsingNode.href,
1732
- protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
1733
- host: urlParsingNode.host,
1734
- search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
1735
- hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
1736
- hostname: urlParsingNode.hostname,
1737
- port: urlParsingNode.port,
1738
- pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
1739
- urlParsingNode.pathname :
1740
- '/' + urlParsingNode.pathname
1741
- };
1977
+ continue;
1978
+ }
1979
+ if (allowUnknown !== true) {
1980
+ throw new AxiosError_1('Unknown option ' + opt, AxiosError_1.ERR_BAD_OPTION);
1742
1981
  }
1982
+ }
1983
+ }
1743
1984
 
1744
- originURL = resolveURL(window.location.href);
1745
-
1746
- /**
1747
- * Determine if a URL shares the same origin as the current location
1748
- *
1749
- * @param {String} requestURL The URL to test
1750
- * @returns {boolean} True if URL shares the same origin, otherwise false
1751
- */
1752
- return function isURLSameOrigin(requestURL) {
1753
- var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
1754
- return (parsed.protocol === originURL.protocol &&
1755
- parsed.host === originURL.host);
1756
- };
1757
- })() :
1985
+ var validator = {
1986
+ assertOptions: assertOptions,
1987
+ validators: validators$1
1988
+ };
1758
1989
 
1759
- // Non standard browser envs (web workers, react-native) lack needed support.
1760
- (function nonStandardBrowserEnv() {
1761
- return function isURLSameOrigin() {
1762
- return true;
1763
- };
1764
- })()
1765
- );
1990
+ var validators = validator.validators;
1991
+ /**
1992
+ * Create a new instance of Axios
1993
+ *
1994
+ * @param {Object} instanceConfig The default config for the instance
1995
+ */
1996
+ function Axios(instanceConfig) {
1997
+ this.defaults = instanceConfig;
1998
+ this.interceptors = {
1999
+ request: new InterceptorManager_1(),
2000
+ response: new InterceptorManager_1()
2001
+ };
2002
+ }
1766
2003
 
2004
+ /**
2005
+ * Dispatch a request
2006
+ *
2007
+ * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
2008
+ * @param {?Object} config
2009
+ */
2010
+ Axios.prototype.request = function request(configOrUrl, config) {
2011
+ /*eslint no-param-reassign:0*/
2012
+ // Allow for axios('example/url'[, config]) a la fetch API
2013
+ if (typeof configOrUrl === 'string') {
2014
+ config = config || {};
2015
+ config.url = configOrUrl;
2016
+ } else {
2017
+ config = configOrUrl || {};
2018
+ }
1767
2019
 
1768
- /***/ }),
2020
+ config = mergeConfig(this.defaults, config);
1769
2021
 
1770
- /***/ "./lib/helpers/normalizeHeaderName.js":
1771
- /*!********************************************!*\
1772
- !*** ./lib/helpers/normalizeHeaderName.js ***!
1773
- \********************************************/
1774
- /*! no static exports found */
1775
- /***/ (function(module, exports, __webpack_require__) {
2022
+ // Set config.method
2023
+ if (config.method) {
2024
+ config.method = config.method.toLowerCase();
2025
+ } else if (this.defaults.method) {
2026
+ config.method = this.defaults.method.toLowerCase();
2027
+ } else {
2028
+ config.method = 'get';
2029
+ }
1776
2030
 
1777
- "use strict";
2031
+ var transitional = config.transitional;
1778
2032
 
2033
+ if (transitional !== undefined) {
2034
+ validator.assertOptions(transitional, {
2035
+ silentJSONParsing: validators.transitional(validators.boolean),
2036
+ forcedJSONParsing: validators.transitional(validators.boolean),
2037
+ clarifyTimeoutError: validators.transitional(validators.boolean)
2038
+ }, false);
2039
+ }
1779
2040
 
1780
- var utils = __webpack_require__(/*! ../utils */ "./lib/utils.js");
2041
+ var paramsSerializer = config.paramsSerializer;
1781
2042
 
1782
- module.exports = function normalizeHeaderName(headers, normalizedName) {
1783
- utils.forEach(headers, function processHeader(value, name) {
1784
- if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
1785
- headers[normalizedName] = value;
1786
- delete headers[name];
1787
- }
1788
- });
1789
- };
1790
-
1791
-
1792
- /***/ }),
1793
-
1794
- /***/ "./lib/helpers/null.js":
1795
- /*!*****************************!*\
1796
- !*** ./lib/helpers/null.js ***!
1797
- \*****************************/
1798
- /*! no static exports found */
1799
- /***/ (function(module, exports) {
1800
-
1801
- // eslint-disable-next-line strict
1802
- module.exports = null;
1803
-
1804
-
1805
- /***/ }),
1806
-
1807
- /***/ "./lib/helpers/parseHeaders.js":
1808
- /*!*************************************!*\
1809
- !*** ./lib/helpers/parseHeaders.js ***!
1810
- \*************************************/
1811
- /*! no static exports found */
1812
- /***/ (function(module, exports, __webpack_require__) {
1813
-
1814
- "use strict";
1815
-
1816
-
1817
- var utils = __webpack_require__(/*! ./../utils */ "./lib/utils.js");
1818
-
1819
- // Headers whose duplicates are ignored by node
1820
- // c.f. https://nodejs.org/api/http.html#http_message_headers
1821
- var ignoreDuplicateOf = [
1822
- 'age', 'authorization', 'content-length', 'content-type', 'etag',
1823
- 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
1824
- 'last-modified', 'location', 'max-forwards', 'proxy-authorization',
1825
- 'referer', 'retry-after', 'user-agent'
1826
- ];
1827
-
1828
- /**
1829
- * Parse headers into an object
1830
- *
1831
- * ```
1832
- * Date: Wed, 27 Aug 2014 08:58:49 GMT
1833
- * Content-Type: application/json
1834
- * Connection: keep-alive
1835
- * Transfer-Encoding: chunked
1836
- * ```
1837
- *
1838
- * @param {String} headers Headers needing to be parsed
1839
- * @returns {Object} Headers parsed into an object
1840
- */
1841
- module.exports = function parseHeaders(headers) {
1842
- var parsed = {};
1843
- var key;
1844
- var val;
1845
- var i;
1846
-
1847
- if (!headers) { return parsed; }
1848
-
1849
- utils.forEach(headers.split('\n'), function parser(line) {
1850
- i = line.indexOf(':');
1851
- key = utils.trim(line.substr(0, i)).toLowerCase();
1852
- val = utils.trim(line.substr(i + 1));
1853
-
1854
- if (key) {
1855
- if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {
2043
+ utils.isFunction(paramsSerializer) && (config.paramsSerializer = {serialize: paramsSerializer});
2044
+
2045
+ // filter out skipped interceptors
2046
+ var requestInterceptorChain = [];
2047
+ var synchronousRequestInterceptors = true;
2048
+ this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
2049
+ if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {
1856
2050
  return;
1857
2051
  }
1858
- if (key === 'set-cookie') {
1859
- parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);
1860
- } else {
1861
- parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
1862
- }
1863
- }
1864
- });
1865
-
1866
- return parsed;
1867
- };
1868
-
1869
-
1870
- /***/ }),
1871
-
1872
- /***/ "./lib/helpers/parseProtocol.js":
1873
- /*!**************************************!*\
1874
- !*** ./lib/helpers/parseProtocol.js ***!
1875
- \**************************************/
1876
- /*! no static exports found */
1877
- /***/ (function(module, exports, __webpack_require__) {
1878
-
1879
- "use strict";
1880
-
1881
-
1882
- module.exports = function parseProtocol(url) {
1883
- var match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
1884
- return match && match[1] || '';
1885
- };
1886
-
1887
-
1888
- /***/ }),
1889
-
1890
- /***/ "./lib/helpers/spread.js":
1891
- /*!*******************************!*\
1892
- !*** ./lib/helpers/spread.js ***!
1893
- \*******************************/
1894
- /*! no static exports found */
1895
- /***/ (function(module, exports, __webpack_require__) {
1896
-
1897
- "use strict";
1898
-
1899
-
1900
- /**
1901
- * Syntactic sugar for invoking a function and expanding an array for arguments.
1902
- *
1903
- * Common use case would be to use `Function.prototype.apply`.
1904
- *
1905
- * ```js
1906
- * function f(x, y, z) {}
1907
- * var args = [1, 2, 3];
1908
- * f.apply(null, args);
1909
- * ```
1910
- *
1911
- * With `spread` this example can be re-written.
1912
- *
1913
- * ```js
1914
- * spread(function(x, y, z) {})([1, 2, 3]);
1915
- * ```
1916
- *
1917
- * @param {Function} callback
1918
- * @returns {Function}
1919
- */
1920
- module.exports = function spread(callback) {
1921
- return function wrap(arr) {
1922
- return callback.apply(null, arr);
1923
- };
1924
- };
1925
2052
 
2053
+ synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
1926
2054
 
1927
- /***/ }),
2055
+ requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
2056
+ });
1928
2057
 
1929
- /***/ "./lib/helpers/toFormData.js":
1930
- /*!***********************************!*\
1931
- !*** ./lib/helpers/toFormData.js ***!
1932
- \***********************************/
1933
- /*! no static exports found */
1934
- /***/ (function(module, exports, __webpack_require__) {
2058
+ var responseInterceptorChain = [];
2059
+ this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
2060
+ responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
2061
+ });
1935
2062
 
1936
- "use strict";
2063
+ var promise;
1937
2064
 
2065
+ if (!synchronousRequestInterceptors) {
2066
+ var chain = [dispatchRequest, undefined];
1938
2067
 
1939
- var utils = __webpack_require__(/*! ../utils */ "./lib/utils.js");
2068
+ Array.prototype.unshift.apply(chain, requestInterceptorChain);
2069
+ chain = chain.concat(responseInterceptorChain);
1940
2070
 
1941
- /**
1942
- * Convert a data object to FormData
1943
- * @param {Object} obj
1944
- * @param {?Object} [formData]
1945
- * @returns {Object}
1946
- **/
2071
+ promise = Promise.resolve(config);
2072
+ while (chain.length) {
2073
+ promise = promise.then(chain.shift(), chain.shift());
2074
+ }
1947
2075
 
1948
- function toFormData(obj, formData) {
1949
- // eslint-disable-next-line no-param-reassign
1950
- formData = formData || new FormData();
2076
+ return promise;
2077
+ }
1951
2078
 
1952
- var stack = [];
1953
2079
 
1954
- function convertValue(value) {
1955
- if (value === null) return '';
2080
+ var newConfig = config;
2081
+ while (requestInterceptorChain.length) {
2082
+ var onFulfilled = requestInterceptorChain.shift();
2083
+ var onRejected = requestInterceptorChain.shift();
2084
+ try {
2085
+ newConfig = onFulfilled(newConfig);
2086
+ } catch (error) {
2087
+ onRejected(error);
2088
+ break;
2089
+ }
2090
+ }
1956
2091
 
1957
- if (utils.isDate(value)) {
1958
- return value.toISOString();
2092
+ try {
2093
+ promise = dispatchRequest(newConfig);
2094
+ } catch (error) {
2095
+ return Promise.reject(error);
1959
2096
  }
1960
2097
 
1961
- if (utils.isArrayBuffer(value) || utils.isTypedArray(value)) {
1962
- return typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
2098
+ while (responseInterceptorChain.length) {
2099
+ promise = promise.then(responseInterceptorChain.shift(), responseInterceptorChain.shift());
1963
2100
  }
1964
2101
 
1965
- return value;
1966
- }
2102
+ return promise;
2103
+ };
1967
2104
 
1968
- function build(data, parentKey) {
1969
- if (utils.isPlainObject(data) || utils.isArray(data)) {
1970
- if (stack.indexOf(data) !== -1) {
1971
- throw Error('Circular reference detected in ' + parentKey);
1972
- }
2105
+ Axios.prototype.getUri = function getUri(config) {
2106
+ config = mergeConfig(this.defaults, config);
2107
+ var fullPath = buildFullPath(config.baseURL, config.url);
2108
+ return buildURL(fullPath, config.params, config.paramsSerializer);
2109
+ };
1973
2110
 
1974
- stack.push(data);
1975
-
1976
- utils.forEach(data, function each(value, key) {
1977
- if (utils.isUndefined(value)) return;
1978
- var fullKey = parentKey ? parentKey + '.' + key : key;
1979
- var arr;
1980
-
1981
- if (value && !parentKey && typeof value === 'object') {
1982
- if (utils.endsWith(key, '{}')) {
1983
- // eslint-disable-next-line no-param-reassign
1984
- value = JSON.stringify(value);
1985
- } else if (utils.endsWith(key, '[]') && (arr = utils.toArray(value))) {
1986
- // eslint-disable-next-line func-names
1987
- arr.forEach(function(el) {
1988
- !utils.isUndefined(el) && formData.append(fullKey, convertValue(el));
1989
- });
1990
- return;
1991
- }
1992
- }
2111
+ // Provide aliases for supported request methods
2112
+ utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
2113
+ /*eslint func-names:0*/
2114
+ Axios.prototype[method] = function(url, config) {
2115
+ return this.request(mergeConfig(config || {}, {
2116
+ method: method,
2117
+ url: url,
2118
+ data: (config || {}).data
2119
+ }));
2120
+ };
2121
+ });
1993
2122
 
1994
- build(value, fullKey);
1995
- });
2123
+ utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
2124
+ /*eslint func-names:0*/
2125
+
2126
+ function generateHTTPMethod(isForm) {
2127
+ return function httpMethod(url, data, config) {
2128
+ return this.request(mergeConfig(config || {}, {
2129
+ method: method,
2130
+ headers: isForm ? {
2131
+ 'Content-Type': 'multipart/form-data'
2132
+ } : {},
2133
+ url: url,
2134
+ data: data
2135
+ }));
2136
+ };
2137
+ }
1996
2138
 
1997
- stack.pop();
1998
- } else {
1999
- formData.append(parentKey, convertValue(data));
2139
+ Axios.prototype[method] = generateHTTPMethod();
2140
+
2141
+ Axios.prototype[method + 'Form'] = generateHTTPMethod(true);
2142
+ });
2143
+
2144
+ var Axios_1 = Axios;
2145
+
2146
+ /**
2147
+ * A `CancelToken` is an object that can be used to request cancellation of an operation.
2148
+ *
2149
+ * @class
2150
+ * @param {Function} executor The executor function.
2151
+ */
2152
+ function CancelToken(executor) {
2153
+ if (typeof executor !== 'function') {
2154
+ throw new TypeError('executor must be a function.');
2000
2155
  }
2001
- }
2002
2156
 
2003
- build(obj);
2157
+ var resolvePromise;
2004
2158
 
2005
- return formData;
2006
- }
2159
+ this.promise = new Promise(function promiseExecutor(resolve) {
2160
+ resolvePromise = resolve;
2161
+ });
2007
2162
 
2008
- module.exports = toFormData;
2163
+ var token = this;
2009
2164
 
2165
+ // eslint-disable-next-line func-names
2166
+ this.promise.then(function(cancel) {
2167
+ if (!token._listeners) return;
2010
2168
 
2011
- /***/ }),
2169
+ var i = token._listeners.length;
2012
2170
 
2013
- /***/ "./lib/helpers/validator.js":
2014
- /*!**********************************!*\
2015
- !*** ./lib/helpers/validator.js ***!
2016
- \**********************************/
2017
- /*! no static exports found */
2018
- /***/ (function(module, exports, __webpack_require__) {
2171
+ while (i-- > 0) {
2172
+ token._listeners[i](cancel);
2173
+ }
2174
+ token._listeners = null;
2175
+ });
2019
2176
 
2020
- "use strict";
2177
+ // eslint-disable-next-line func-names
2178
+ this.promise.then = function(onfulfilled) {
2179
+ var _resolve;
2180
+ // eslint-disable-next-line func-names
2181
+ var promise = new Promise(function(resolve) {
2182
+ token.subscribe(resolve);
2183
+ _resolve = resolve;
2184
+ }).then(onfulfilled);
2021
2185
 
2186
+ promise.cancel = function reject() {
2187
+ token.unsubscribe(_resolve);
2188
+ };
2022
2189
 
2023
- var VERSION = __webpack_require__(/*! ../env/data */ "./lib/env/data.js").version;
2024
- var AxiosError = __webpack_require__(/*! ../core/AxiosError */ "./lib/core/AxiosError.js");
2190
+ return promise;
2191
+ };
2025
2192
 
2026
- var validators = {};
2193
+ executor(function cancel(message, config, request) {
2194
+ if (token.reason) {
2195
+ // Cancellation has already been requested
2196
+ return;
2197
+ }
2027
2198
 
2028
- // eslint-disable-next-line func-names
2029
- ['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach(function(type, i) {
2030
- validators[type] = function validator(thing) {
2031
- return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type;
2032
- };
2033
- });
2034
-
2035
- var deprecatedWarnings = {};
2036
-
2037
- /**
2038
- * Transitional option validator
2039
- * @param {function|boolean?} validator - set to false if the transitional option has been removed
2040
- * @param {string?} version - deprecated version / removed since version
2041
- * @param {string?} message - some message with additional info
2042
- * @returns {function}
2043
- */
2044
- validators.transitional = function transitional(validator, version, message) {
2045
- function formatMessage(opt, desc) {
2046
- return '[Axios v' + VERSION + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : '');
2199
+ token.reason = new CanceledError_1(message, config, request);
2200
+ resolvePromise(token.reason);
2201
+ });
2047
2202
  }
2048
2203
 
2049
- // eslint-disable-next-line func-names
2050
- return function(value, opt, opts) {
2051
- if (validator === false) {
2052
- throw new AxiosError(
2053
- formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')),
2054
- AxiosError.ERR_DEPRECATED
2055
- );
2204
+ /**
2205
+ * Throws a `CanceledError` if cancellation has been requested.
2206
+ */
2207
+ CancelToken.prototype.throwIfRequested = function throwIfRequested() {
2208
+ if (this.reason) {
2209
+ throw this.reason;
2056
2210
  }
2211
+ };
2057
2212
 
2058
- if (version && !deprecatedWarnings[opt]) {
2059
- deprecatedWarnings[opt] = true;
2060
- // eslint-disable-next-line no-console
2061
- console.warn(
2062
- formatMessage(
2063
- opt,
2064
- ' has been deprecated since v' + version + ' and will be removed in the near future'
2065
- )
2066
- );
2213
+ /**
2214
+ * Subscribe to the cancel signal
2215
+ */
2216
+
2217
+ CancelToken.prototype.subscribe = function subscribe(listener) {
2218
+ if (this.reason) {
2219
+ listener(this.reason);
2220
+ return;
2067
2221
  }
2068
2222
 
2069
- return validator ? validator(value, opt, opts) : true;
2223
+ if (this._listeners) {
2224
+ this._listeners.push(listener);
2225
+ } else {
2226
+ this._listeners = [listener];
2227
+ }
2070
2228
  };
2071
- };
2072
-
2073
- /**
2074
- * Assert object's properties type
2075
- * @param {object} options
2076
- * @param {object} schema
2077
- * @param {boolean?} allowUnknown
2078
- */
2079
-
2080
- function assertOptions(options, schema, allowUnknown) {
2081
- if (typeof options !== 'object') {
2082
- throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE);
2083
- }
2084
- var keys = Object.keys(options);
2085
- var i = keys.length;
2086
- while (i-- > 0) {
2087
- var opt = keys[i];
2088
- var validator = schema[opt];
2089
- if (validator) {
2090
- var value = options[opt];
2091
- var result = value === undefined || validator(value, opt, options);
2092
- if (result !== true) {
2093
- throw new AxiosError('option ' + opt + ' must be ' + result, AxiosError.ERR_BAD_OPTION_VALUE);
2094
- }
2095
- continue;
2229
+
2230
+ /**
2231
+ * Unsubscribe from the cancel signal
2232
+ */
2233
+
2234
+ CancelToken.prototype.unsubscribe = function unsubscribe(listener) {
2235
+ if (!this._listeners) {
2236
+ return;
2096
2237
  }
2097
- if (allowUnknown !== true) {
2098
- throw new AxiosError('Unknown option ' + opt, AxiosError.ERR_BAD_OPTION);
2238
+ var index = this._listeners.indexOf(listener);
2239
+ if (index !== -1) {
2240
+ this._listeners.splice(index, 1);
2099
2241
  }
2100
- }
2101
- }
2242
+ };
2102
2243
 
2103
- module.exports = {
2104
- assertOptions: assertOptions,
2105
- validators: validators
2106
- };
2244
+ /**
2245
+ * Returns an object that contains a new `CancelToken` and a function that, when called,
2246
+ * cancels the `CancelToken`.
2247
+ */
2248
+ CancelToken.source = function source() {
2249
+ var cancel;
2250
+ var token = new CancelToken(function executor(c) {
2251
+ cancel = c;
2252
+ });
2253
+ return {
2254
+ token: token,
2255
+ cancel: cancel
2256
+ };
2257
+ };
2107
2258
 
2259
+ var CancelToken_1 = CancelToken;
2108
2260
 
2109
- /***/ }),
2261
+ /**
2262
+ * Syntactic sugar for invoking a function and expanding an array for arguments.
2263
+ *
2264
+ * Common use case would be to use `Function.prototype.apply`.
2265
+ *
2266
+ * ```js
2267
+ * function f(x, y, z) {}
2268
+ * var args = [1, 2, 3];
2269
+ * f.apply(null, args);
2270
+ * ```
2271
+ *
2272
+ * With `spread` this example can be re-written.
2273
+ *
2274
+ * ```js
2275
+ * spread(function(x, y, z) {})([1, 2, 3]);
2276
+ * ```
2277
+ *
2278
+ * @param {Function} callback
2279
+ * @returns {Function}
2280
+ */
2281
+ var spread = function spread(callback) {
2282
+ return function wrap(arr) {
2283
+ return callback.apply(null, arr);
2284
+ };
2285
+ };
2110
2286
 
2111
- /***/ "./lib/utils.js":
2112
- /*!**********************!*\
2113
- !*** ./lib/utils.js ***!
2114
- \**********************/
2115
- /*! no static exports found */
2116
- /***/ (function(module, exports, __webpack_require__) {
2287
+ /**
2288
+ * Determines whether the payload is an error thrown by Axios
2289
+ *
2290
+ * @param {*} payload The value to test
2291
+ * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
2292
+ */
2293
+ var isAxiosError = function isAxiosError(payload) {
2294
+ return utils.isObject(payload) && (payload.isAxiosError === true);
2295
+ };
2117
2296
 
2118
- "use strict";
2297
+ /**
2298
+ * Create an instance of Axios
2299
+ *
2300
+ * @param {Object} defaultConfig The default config for the instance
2301
+ * @return {Axios} A new instance of Axios
2302
+ */
2303
+ function createInstance(defaultConfig) {
2304
+ var context = new Axios_1(defaultConfig);
2305
+ var instance = bind(Axios_1.prototype.request, context);
2119
2306
 
2307
+ // Copy axios.prototype to instance
2308
+ utils.extend(instance, Axios_1.prototype, context);
2120
2309
 
2121
- var bind = __webpack_require__(/*! ./helpers/bind */ "./lib/helpers/bind.js");
2310
+ // Copy context to instance
2311
+ utils.extend(instance, context);
2122
2312
 
2123
- // utils is a library of generic helper functions non-specific to axios
2313
+ // Factory for creating new instances
2314
+ instance.create = function create(instanceConfig) {
2315
+ return createInstance(mergeConfig(defaultConfig, instanceConfig));
2316
+ };
2124
2317
 
2125
- var toString = Object.prototype.toString;
2318
+ return instance;
2319
+ }
2126
2320
 
2127
- // eslint-disable-next-line func-names
2128
- var kindOf = (function(cache) {
2129
- // eslint-disable-next-line func-names
2130
- return function(thing) {
2131
- var str = toString.call(thing);
2132
- return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
2133
- };
2134
- })(Object.create(null));
2321
+ // Create the default instance to be exported
2322
+ var axios = createInstance(defaults_1);
2135
2323
 
2136
- function kindOfTest(type) {
2137
- type = type.toLowerCase();
2138
- return function isKindOf(thing) {
2139
- return kindOf(thing) === type;
2140
- };
2141
- }
2142
-
2143
- /**
2144
- * Determine if a value is an Array
2145
- *
2146
- * @param {Object} val The value to test
2147
- * @returns {boolean} True if value is an Array, otherwise false
2148
- */
2149
- function isArray(val) {
2150
- return Array.isArray(val);
2151
- }
2152
-
2153
- /**
2154
- * Determine if a value is undefined
2155
- *
2156
- * @param {Object} val The value to test
2157
- * @returns {boolean} True if the value is undefined, otherwise false
2158
- */
2159
- function isUndefined(val) {
2160
- return typeof val === 'undefined';
2161
- }
2162
-
2163
- /**
2164
- * Determine if a value is a Buffer
2165
- *
2166
- * @param {Object} val The value to test
2167
- * @returns {boolean} True if value is a Buffer, otherwise false
2168
- */
2169
- function isBuffer(val) {
2170
- return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
2171
- && typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val);
2172
- }
2173
-
2174
- /**
2175
- * Determine if a value is an ArrayBuffer
2176
- *
2177
- * @function
2178
- * @param {Object} val The value to test
2179
- * @returns {boolean} True if value is an ArrayBuffer, otherwise false
2180
- */
2181
- var isArrayBuffer = kindOfTest('ArrayBuffer');
2182
-
2183
-
2184
- /**
2185
- * Determine if a value is a view on an ArrayBuffer
2186
- *
2187
- * @param {Object} val The value to test
2188
- * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
2189
- */
2190
- function isArrayBufferView(val) {
2191
- var result;
2192
- if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
2193
- result = ArrayBuffer.isView(val);
2194
- } else {
2195
- result = (val) && (val.buffer) && (isArrayBuffer(val.buffer));
2196
- }
2197
- return result;
2198
- }
2199
-
2200
- /**
2201
- * Determine if a value is a String
2202
- *
2203
- * @param {Object} val The value to test
2204
- * @returns {boolean} True if value is a String, otherwise false
2205
- */
2206
- function isString(val) {
2207
- return typeof val === 'string';
2208
- }
2209
-
2210
- /**
2211
- * Determine if a value is a Number
2212
- *
2213
- * @param {Object} val The value to test
2214
- * @returns {boolean} True if value is a Number, otherwise false
2215
- */
2216
- function isNumber(val) {
2217
- return typeof val === 'number';
2218
- }
2219
-
2220
- /**
2221
- * Determine if a value is an Object
2222
- *
2223
- * @param {Object} val The value to test
2224
- * @returns {boolean} True if value is an Object, otherwise false
2225
- */
2226
- function isObject(val) {
2227
- return val !== null && typeof val === 'object';
2228
- }
2229
-
2230
- /**
2231
- * Determine if a value is a plain Object
2232
- *
2233
- * @param {Object} val The value to test
2234
- * @return {boolean} True if value is a plain Object, otherwise false
2235
- */
2236
- function isPlainObject(val) {
2237
- if (kindOf(val) !== 'object') {
2238
- return false;
2239
- }
2324
+ // Expose Axios class to allow class inheritance
2325
+ axios.Axios = Axios_1;
2240
2326
 
2241
- var prototype = Object.getPrototypeOf(val);
2242
- return prototype === null || prototype === Object.prototype;
2243
- }
2244
-
2245
- /**
2246
- * Determine if a value is a Date
2247
- *
2248
- * @function
2249
- * @param {Object} val The value to test
2250
- * @returns {boolean} True if value is a Date, otherwise false
2251
- */
2252
- var isDate = kindOfTest('Date');
2253
-
2254
- /**
2255
- * Determine if a value is a File
2256
- *
2257
- * @function
2258
- * @param {Object} val The value to test
2259
- * @returns {boolean} True if value is a File, otherwise false
2260
- */
2261
- var isFile = kindOfTest('File');
2262
-
2263
- /**
2264
- * Determine if a value is a Blob
2265
- *
2266
- * @function
2267
- * @param {Object} val The value to test
2268
- * @returns {boolean} True if value is a Blob, otherwise false
2269
- */
2270
- var isBlob = kindOfTest('Blob');
2271
-
2272
- /**
2273
- * Determine if a value is a FileList
2274
- *
2275
- * @function
2276
- * @param {Object} val The value to test
2277
- * @returns {boolean} True if value is a File, otherwise false
2278
- */
2279
- var isFileList = kindOfTest('FileList');
2280
-
2281
- /**
2282
- * Determine if a value is a Function
2283
- *
2284
- * @param {Object} val The value to test
2285
- * @returns {boolean} True if value is a Function, otherwise false
2286
- */
2287
- function isFunction(val) {
2288
- return toString.call(val) === '[object Function]';
2289
- }
2290
-
2291
- /**
2292
- * Determine if a value is a Stream
2293
- *
2294
- * @param {Object} val The value to test
2295
- * @returns {boolean} True if value is a Stream, otherwise false
2296
- */
2297
- function isStream(val) {
2298
- return isObject(val) && isFunction(val.pipe);
2299
- }
2300
-
2301
- /**
2302
- * Determine if a value is a FormData
2303
- *
2304
- * @param {Object} thing The value to test
2305
- * @returns {boolean} True if value is an FormData, otherwise false
2306
- */
2307
- function isFormData(thing) {
2308
- var pattern = '[object FormData]';
2309
- return thing && (
2310
- (typeof FormData === 'function' && thing instanceof FormData) ||
2311
- toString.call(thing) === pattern ||
2312
- (isFunction(thing.toString) && thing.toString() === pattern)
2313
- );
2314
- }
2315
-
2316
- /**
2317
- * Determine if a value is a URLSearchParams object
2318
- * @function
2319
- * @param {Object} val The value to test
2320
- * @returns {boolean} True if value is a URLSearchParams object, otherwise false
2321
- */
2322
- var isURLSearchParams = kindOfTest('URLSearchParams');
2323
-
2324
- /**
2325
- * Trim excess whitespace off the beginning and end of a string
2326
- *
2327
- * @param {String} str The String to trim
2328
- * @returns {String} The String freed of excess whitespace
2329
- */
2330
- function trim(str) {
2331
- return str.trim ? str.trim() : str.replace(/^\s+|\s+$/g, '');
2332
- }
2333
-
2334
- /**
2335
- * Determine if we're running in a standard browser environment
2336
- *
2337
- * This allows axios to run in a web worker, and react-native.
2338
- * Both environments support XMLHttpRequest, but not fully standard globals.
2339
- *
2340
- * web workers:
2341
- * typeof window -> undefined
2342
- * typeof document -> undefined
2343
- *
2344
- * react-native:
2345
- * navigator.product -> 'ReactNative'
2346
- * nativescript
2347
- * navigator.product -> 'NativeScript' or 'NS'
2348
- */
2349
- function isStandardBrowserEnv() {
2350
- if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||
2351
- navigator.product === 'NativeScript' ||
2352
- navigator.product === 'NS')) {
2353
- return false;
2354
- }
2355
- return (
2356
- typeof window !== 'undefined' &&
2357
- typeof document !== 'undefined'
2358
- );
2359
- }
2360
-
2361
- /**
2362
- * Iterate over an Array or an Object invoking a function for each item.
2363
- *
2364
- * If `obj` is an Array callback will be called passing
2365
- * the value, index, and complete array for each item.
2366
- *
2367
- * If 'obj' is an Object callback will be called passing
2368
- * the value, key, and complete object for each property.
2369
- *
2370
- * @param {Object|Array} obj The object to iterate
2371
- * @param {Function} fn The callback to invoke for each item
2372
- */
2373
- function forEach(obj, fn) {
2374
- // Don't bother if no value provided
2375
- if (obj === null || typeof obj === 'undefined') {
2376
- return;
2377
- }
2327
+ // Expose Cancel & CancelToken
2328
+ axios.CanceledError = CanceledError_1;
2329
+ axios.CancelToken = CancelToken_1;
2330
+ axios.isCancel = isCancel;
2331
+ axios.VERSION = data.version;
2332
+ axios.toFormData = toFormData_1;
2378
2333
 
2379
- // Force an array if not already something iterable
2380
- if (typeof obj !== 'object') {
2381
- /*eslint no-param-reassign:0*/
2382
- obj = [obj];
2383
- }
2334
+ // Expose AxiosError class
2335
+ axios.AxiosError = AxiosError_1;
2384
2336
 
2385
- if (isArray(obj)) {
2386
- // Iterate over array values
2387
- for (var i = 0, l = obj.length; i < l; i++) {
2388
- fn.call(null, obj[i], i, obj);
2389
- }
2390
- } else {
2391
- // Iterate over object keys
2392
- for (var key in obj) {
2393
- if (Object.prototype.hasOwnProperty.call(obj, key)) {
2394
- fn.call(null, obj[key], key, obj);
2395
- }
2396
- }
2397
- }
2398
- }
2399
-
2400
- /**
2401
- * Accepts varargs expecting each argument to be an object, then
2402
- * immutably merges the properties of each object and returns result.
2403
- *
2404
- * When multiple objects contain the same key the later object in
2405
- * the arguments list will take precedence.
2406
- *
2407
- * Example:
2408
- *
2409
- * ```js
2410
- * var result = merge({foo: 123}, {foo: 456});
2411
- * console.log(result.foo); // outputs 456
2412
- * ```
2413
- *
2414
- * @param {Object} obj1 Object to merge
2415
- * @returns {Object} Result of all merge properties
2416
- */
2417
- function merge(/* obj1, obj2, obj3, ... */) {
2418
- var result = {};
2419
- function assignValue(val, key) {
2420
- if (isPlainObject(result[key]) && isPlainObject(val)) {
2421
- result[key] = merge(result[key], val);
2422
- } else if (isPlainObject(val)) {
2423
- result[key] = merge({}, val);
2424
- } else if (isArray(val)) {
2425
- result[key] = val.slice();
2426
- } else {
2427
- result[key] = val;
2428
- }
2429
- }
2337
+ // alias for CanceledError for backward compatibility
2338
+ axios.Cancel = axios.CanceledError;
2430
2339
 
2431
- for (var i = 0, l = arguments.length; i < l; i++) {
2432
- forEach(arguments[i], assignValue);
2433
- }
2434
- return result;
2435
- }
2436
-
2437
- /**
2438
- * Extends object a by mutably adding to it the properties of object b.
2439
- *
2440
- * @param {Object} a The object to be extended
2441
- * @param {Object} b The object to copy properties from
2442
- * @param {Object} thisArg The object to bind function to
2443
- * @return {Object} The resulting value of object a
2444
- */
2445
- function extend(a, b, thisArg) {
2446
- forEach(b, function assignValue(val, key) {
2447
- if (thisArg && typeof val === 'function') {
2448
- a[key] = bind(val, thisArg);
2449
- } else {
2450
- a[key] = val;
2451
- }
2452
- });
2453
- return a;
2454
- }
2455
-
2456
- /**
2457
- * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
2458
- *
2459
- * @param {string} content with BOM
2460
- * @return {string} content value without BOM
2461
- */
2462
- function stripBOM(content) {
2463
- if (content.charCodeAt(0) === 0xFEFF) {
2464
- content = content.slice(1);
2465
- }
2466
- return content;
2467
- }
2468
-
2469
- /**
2470
- * Inherit the prototype methods from one constructor into another
2471
- * @param {function} constructor
2472
- * @param {function} superConstructor
2473
- * @param {object} [props]
2474
- * @param {object} [descriptors]
2475
- */
2476
-
2477
- function inherits(constructor, superConstructor, props, descriptors) {
2478
- constructor.prototype = Object.create(superConstructor.prototype, descriptors);
2479
- constructor.prototype.constructor = constructor;
2480
- props && Object.assign(constructor.prototype, props);
2481
- }
2482
-
2483
- /**
2484
- * Resolve object with deep prototype chain to a flat object
2485
- * @param {Object} sourceObj source object
2486
- * @param {Object} [destObj]
2487
- * @param {Function} [filter]
2488
- * @returns {Object}
2489
- */
2490
-
2491
- function toFlatObject(sourceObj, destObj, filter) {
2492
- var props;
2493
- var i;
2494
- var prop;
2495
- var merged = {};
2496
-
2497
- destObj = destObj || {};
2498
-
2499
- do {
2500
- props = Object.getOwnPropertyNames(sourceObj);
2501
- i = props.length;
2502
- while (i-- > 0) {
2503
- prop = props[i];
2504
- if (!merged[prop]) {
2505
- destObj[prop] = sourceObj[prop];
2506
- merged[prop] = true;
2507
- }
2508
- }
2509
- sourceObj = Object.getPrototypeOf(sourceObj);
2510
- } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);
2511
-
2512
- return destObj;
2513
- }
2514
-
2515
- /*
2516
- * determines whether a string ends with the characters of a specified string
2517
- * @param {String} str
2518
- * @param {String} searchString
2519
- * @param {Number} [position= 0]
2520
- * @returns {boolean}
2521
- */
2522
- function endsWith(str, searchString, position) {
2523
- str = String(str);
2524
- if (position === undefined || position > str.length) {
2525
- position = str.length;
2526
- }
2527
- position -= searchString.length;
2528
- var lastIndex = str.indexOf(searchString, position);
2529
- return lastIndex !== -1 && lastIndex === position;
2530
- }
2531
-
2532
-
2533
- /**
2534
- * Returns new array from array like object
2535
- * @param {*} [thing]
2536
- * @returns {Array}
2537
- */
2538
- function toArray(thing) {
2539
- if (!thing) return null;
2540
- var i = thing.length;
2541
- if (isUndefined(i)) return null;
2542
- var arr = new Array(i);
2543
- while (i-- > 0) {
2544
- arr[i] = thing[i];
2545
- }
2546
- return arr;
2547
- }
2340
+ // Expose all/spread
2341
+ axios.all = function all(promises) {
2342
+ return Promise.all(promises);
2343
+ };
2344
+ axios.spread = spread;
2548
2345
 
2549
- // eslint-disable-next-line func-names
2550
- var isTypedArray = (function(TypedArray) {
2551
- // eslint-disable-next-line func-names
2552
- return function(thing) {
2553
- return TypedArray && thing instanceof TypedArray;
2346
+ // Expose isAxiosError
2347
+ axios.isAxiosError = isAxiosError;
2348
+
2349
+ axios.formToJSON = function(thing) {
2350
+ return formDataToJSON_1(utils.isHTMLForm(thing) ? new FormData(thing) : thing);
2554
2351
  };
2555
- })(typeof Uint8Array !== 'undefined' && Object.getPrototypeOf(Uint8Array));
2556
-
2557
- module.exports = {
2558
- isArray: isArray,
2559
- isArrayBuffer: isArrayBuffer,
2560
- isBuffer: isBuffer,
2561
- isFormData: isFormData,
2562
- isArrayBufferView: isArrayBufferView,
2563
- isString: isString,
2564
- isNumber: isNumber,
2565
- isObject: isObject,
2566
- isPlainObject: isPlainObject,
2567
- isUndefined: isUndefined,
2568
- isDate: isDate,
2569
- isFile: isFile,
2570
- isBlob: isBlob,
2571
- isFunction: isFunction,
2572
- isStream: isStream,
2573
- isURLSearchParams: isURLSearchParams,
2574
- isStandardBrowserEnv: isStandardBrowserEnv,
2575
- forEach: forEach,
2576
- merge: merge,
2577
- extend: extend,
2578
- trim: trim,
2579
- stripBOM: stripBOM,
2580
- inherits: inherits,
2581
- toFlatObject: toFlatObject,
2582
- kindOf: kindOf,
2583
- kindOfTest: kindOfTest,
2584
- endsWith: endsWith,
2585
- toArray: toArray,
2586
- isTypedArray: isTypedArray,
2587
- isFileList: isFileList
2588
- };
2589
-
2590
-
2591
- /***/ })
2592
-
2593
- /******/ });
2594
- });
2595
- //# sourceMappingURL=axios.map
2352
+
2353
+ var axios_1 = axios;
2354
+
2355
+ // Allow use of default import syntax in TypeScript
2356
+ var _default = axios;
2357
+ axios_1.default = _default;
2358
+
2359
+ return axios_1;
2360
+
2361
+ }));
2362
+ //# sourceMappingURL=axios.js.map