axios 0.27.2 → 1.0.0-alpha.1

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