axios.js 46 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756
  1. /* axios v0.21.1 | (c) 2020 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. /******/ exports: {},
  26. /******/ id: moduleId,
  27. /******/ loaded: false
  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.loaded = 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. /******/ // __webpack_public_path__
  48. /******/ __webpack_require__.p = "";
  49. /******/
  50. /******/ // Load entry module and return exports
  51. /******/ return __webpack_require__(0);
  52. /******/ })
  53. /************************************************************************/
  54. /******/ ([
  55. /* 0 */
  56. /***/ (function(module, exports, __webpack_require__) {
  57. module.exports = __webpack_require__(1);
  58. /***/ }),
  59. /* 1 */
  60. /***/ (function(module, exports, __webpack_require__) {
  61. 'use strict';
  62. var utils = __webpack_require__(2);
  63. var bind = __webpack_require__(3);
  64. var Axios = __webpack_require__(4);
  65. var mergeConfig = __webpack_require__(22);
  66. var defaults = __webpack_require__(10);
  67. /**
  68. * Create an instance of Axios
  69. *
  70. * @param {Object} defaultConfig The default config for the instance
  71. * @return {Axios} A new instance of Axios
  72. */
  73. function createInstance(defaultConfig) {
  74. var context = new Axios(defaultConfig);
  75. var instance = bind(Axios.prototype.request, context);
  76. // Copy axios.prototype to instance
  77. utils.extend(instance, Axios.prototype, context);
  78. // Copy context to instance
  79. utils.extend(instance, context);
  80. return instance;
  81. }
  82. // Create the default instance to be exported
  83. var axios = createInstance(defaults);
  84. // Expose Axios class to allow class inheritance
  85. axios.Axios = Axios;
  86. // Factory for creating new instances
  87. axios.create = function create(instanceConfig) {
  88. return createInstance(mergeConfig(axios.defaults, instanceConfig));
  89. };
  90. // Expose Cancel & CancelToken
  91. axios.Cancel = __webpack_require__(23);
  92. axios.CancelToken = __webpack_require__(24);
  93. axios.isCancel = __webpack_require__(9);
  94. // Expose all/spread
  95. axios.all = function all(promises) {
  96. return Promise.all(promises);
  97. };
  98. axios.spread = __webpack_require__(25);
  99. // Expose isAxiosError
  100. axios.isAxiosError = __webpack_require__(26);
  101. module.exports = axios;
  102. // Allow use of default import syntax in TypeScript
  103. module.exports.default = axios;
  104. /***/ }),
  105. /* 2 */
  106. /***/ (function(module, exports, __webpack_require__) {
  107. 'use strict';
  108. var bind = __webpack_require__(3);
  109. /*global toString:true*/
  110. // utils is a library of generic helper functions non-specific to axios
  111. var toString = Object.prototype.toString;
  112. /**
  113. * Determine if a value is an Array
  114. *
  115. * @param {Object} val The value to test
  116. * @returns {boolean} True if value is an Array, otherwise false
  117. */
  118. function isArray(val) {
  119. return toString.call(val) === '[object Array]';
  120. }
  121. /**
  122. * Determine if a value is undefined
  123. *
  124. * @param {Object} val The value to test
  125. * @returns {boolean} True if the value is undefined, otherwise false
  126. */
  127. function isUndefined(val) {
  128. return typeof val === 'undefined';
  129. }
  130. /**
  131. * Determine if a value is a Buffer
  132. *
  133. * @param {Object} val The value to test
  134. * @returns {boolean} True if value is a Buffer, otherwise false
  135. */
  136. function isBuffer(val) {
  137. return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
  138. && typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val);
  139. }
  140. /**
  141. * Determine if a value is an ArrayBuffer
  142. *
  143. * @param {Object} val The value to test
  144. * @returns {boolean} True if value is an ArrayBuffer, otherwise false
  145. */
  146. function isArrayBuffer(val) {
  147. return toString.call(val) === '[object ArrayBuffer]';
  148. }
  149. /**
  150. * Determine if a value is a FormData
  151. *
  152. * @param {Object} val The value to test
  153. * @returns {boolean} True if value is an FormData, otherwise false
  154. */
  155. function isFormData(val) {
  156. return (typeof FormData !== 'undefined') && (val instanceof FormData);
  157. }
  158. /**
  159. * Determine if a value is a view on an ArrayBuffer
  160. *
  161. * @param {Object} val The value to test
  162. * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
  163. */
  164. function isArrayBufferView(val) {
  165. var result;
  166. if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
  167. result = ArrayBuffer.isView(val);
  168. } else {
  169. result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);
  170. }
  171. return result;
  172. }
  173. /**
  174. * Determine if a value is a String
  175. *
  176. * @param {Object} val The value to test
  177. * @returns {boolean} True if value is a String, otherwise false
  178. */
  179. function isString(val) {
  180. return typeof val === 'string';
  181. }
  182. /**
  183. * Determine if a value is a Number
  184. *
  185. * @param {Object} val The value to test
  186. * @returns {boolean} True if value is a Number, otherwise false
  187. */
  188. function isNumber(val) {
  189. return typeof val === 'number';
  190. }
  191. /**
  192. * Determine if a value is an Object
  193. *
  194. * @param {Object} val The value to test
  195. * @returns {boolean} True if value is an Object, otherwise false
  196. */
  197. function isObject(val) {
  198. return val !== null && typeof val === 'object';
  199. }
  200. /**
  201. * Determine if a value is a plain Object
  202. *
  203. * @param {Object} val The value to test
  204. * @return {boolean} True if value is a plain Object, otherwise false
  205. */
  206. function isPlainObject(val) {
  207. if (toString.call(val) !== '[object Object]') {
  208. return false;
  209. }
  210. var prototype = Object.getPrototypeOf(val);
  211. return prototype === null || prototype === Object.prototype;
  212. }
  213. /**
  214. * Determine if a value is a Date
  215. *
  216. * @param {Object} val The value to test
  217. * @returns {boolean} True if value is a Date, otherwise false
  218. */
  219. function isDate(val) {
  220. return toString.call(val) === '[object Date]';
  221. }
  222. /**
  223. * Determine if a value is a File
  224. *
  225. * @param {Object} val The value to test
  226. * @returns {boolean} True if value is a File, otherwise false
  227. */
  228. function isFile(val) {
  229. return toString.call(val) === '[object File]';
  230. }
  231. /**
  232. * Determine if a value is a Blob
  233. *
  234. * @param {Object} val The value to test
  235. * @returns {boolean} True if value is a Blob, otherwise false
  236. */
  237. function isBlob(val) {
  238. return toString.call(val) === '[object Blob]';
  239. }
  240. /**
  241. * Determine if a value is a Function
  242. *
  243. * @param {Object} val The value to test
  244. * @returns {boolean} True if value is a Function, otherwise false
  245. */
  246. function isFunction(val) {
  247. return toString.call(val) === '[object Function]';
  248. }
  249. /**
  250. * Determine if a value is a Stream
  251. *
  252. * @param {Object} val The value to test
  253. * @returns {boolean} True if value is a Stream, otherwise false
  254. */
  255. function isStream(val) {
  256. return isObject(val) && isFunction(val.pipe);
  257. }
  258. /**
  259. * Determine if a value is a URLSearchParams object
  260. *
  261. * @param {Object} val The value to test
  262. * @returns {boolean} True if value is a URLSearchParams object, otherwise false
  263. */
  264. function isURLSearchParams(val) {
  265. return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;
  266. }
  267. /**
  268. * Trim excess whitespace off the beginning and end of a string
  269. *
  270. * @param {String} str The String to trim
  271. * @returns {String} The String freed of excess whitespace
  272. */
  273. function trim(str) {
  274. return str.replace(/^\s*/, '').replace(/\s*$/, '');
  275. }
  276. /**
  277. * Determine if we're running in a standard browser environment
  278. *
  279. * This allows axios to run in a web worker, and react-native.
  280. * Both environments support XMLHttpRequest, but not fully standard globals.
  281. *
  282. * web workers:
  283. * typeof window -> undefined
  284. * typeof document -> undefined
  285. *
  286. * react-native:
  287. * navigator.product -> 'ReactNative'
  288. * nativescript
  289. * navigator.product -> 'NativeScript' or 'NS'
  290. */
  291. function isStandardBrowserEnv() {
  292. if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||
  293. navigator.product === 'NativeScript' ||
  294. navigator.product === 'NS')) {
  295. return false;
  296. }
  297. return (
  298. typeof window !== 'undefined' &&
  299. typeof document !== 'undefined'
  300. );
  301. }
  302. /**
  303. * Iterate over an Array or an Object invoking a function for each item.
  304. *
  305. * If `obj` is an Array callback will be called passing
  306. * the value, index, and complete array for each item.
  307. *
  308. * If 'obj' is an Object callback will be called passing
  309. * the value, key, and complete object for each property.
  310. *
  311. * @param {Object|Array} obj The object to iterate
  312. * @param {Function} fn The callback to invoke for each item
  313. */
  314. function forEach(obj, fn) {
  315. // Don't bother if no value provided
  316. if (obj === null || typeof obj === 'undefined') {
  317. return;
  318. }
  319. // Force an array if not already something iterable
  320. if (typeof obj !== 'object') {
  321. /*eslint no-param-reassign:0*/
  322. obj = [obj];
  323. }
  324. if (isArray(obj)) {
  325. // Iterate over array values
  326. for (var i = 0, l = obj.length; i < l; i++) {
  327. fn.call(null, obj[i], i, obj);
  328. }
  329. } else {
  330. // Iterate over object keys
  331. for (var key in obj) {
  332. if (Object.prototype.hasOwnProperty.call(obj, key)) {
  333. fn.call(null, obj[key], key, obj);
  334. }
  335. }
  336. }
  337. }
  338. /**
  339. * Accepts varargs expecting each argument to be an object, then
  340. * immutably merges the properties of each object and returns result.
  341. *
  342. * When multiple objects contain the same key the later object in
  343. * the arguments list will take precedence.
  344. *
  345. * Example:
  346. *
  347. * ```js
  348. * var result = merge({foo: 123}, {foo: 456});
  349. * console.log(result.foo); // outputs 456
  350. * ```
  351. *
  352. * @param {Object} obj1 Object to merge
  353. * @returns {Object} Result of all merge properties
  354. */
  355. function merge(/* obj1, obj2, obj3, ... */) {
  356. var result = {};
  357. function assignValue(val, key) {
  358. if (isPlainObject(result[key]) && isPlainObject(val)) {
  359. result[key] = merge(result[key], val);
  360. } else if (isPlainObject(val)) {
  361. result[key] = merge({}, val);
  362. } else if (isArray(val)) {
  363. result[key] = val.slice();
  364. } else {
  365. result[key] = val;
  366. }
  367. }
  368. for (var i = 0, l = arguments.length; i < l; i++) {
  369. forEach(arguments[i], assignValue);
  370. }
  371. return result;
  372. }
  373. /**
  374. * Extends object a by mutably adding to it the properties of object b.
  375. *
  376. * @param {Object} a The object to be extended
  377. * @param {Object} b The object to copy properties from
  378. * @param {Object} thisArg The object to bind function to
  379. * @return {Object} The resulting value of object a
  380. */
  381. function extend(a, b, thisArg) {
  382. forEach(b, function assignValue(val, key) {
  383. if (thisArg && typeof val === 'function') {
  384. a[key] = bind(val, thisArg);
  385. } else {
  386. a[key] = val;
  387. }
  388. });
  389. return a;
  390. }
  391. /**
  392. * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
  393. *
  394. * @param {string} content with BOM
  395. * @return {string} content value without BOM
  396. */
  397. function stripBOM(content) {
  398. if (content.charCodeAt(0) === 0xFEFF) {
  399. content = content.slice(1);
  400. }
  401. return content;
  402. }
  403. module.exports = {
  404. isArray: isArray,
  405. isArrayBuffer: isArrayBuffer,
  406. isBuffer: isBuffer,
  407. isFormData: isFormData,
  408. isArrayBufferView: isArrayBufferView,
  409. isString: isString,
  410. isNumber: isNumber,
  411. isObject: isObject,
  412. isPlainObject: isPlainObject,
  413. isUndefined: isUndefined,
  414. isDate: isDate,
  415. isFile: isFile,
  416. isBlob: isBlob,
  417. isFunction: isFunction,
  418. isStream: isStream,
  419. isURLSearchParams: isURLSearchParams,
  420. isStandardBrowserEnv: isStandardBrowserEnv,
  421. forEach: forEach,
  422. merge: merge,
  423. extend: extend,
  424. trim: trim,
  425. stripBOM: stripBOM
  426. };
  427. /***/ }),
  428. /* 3 */
  429. /***/ (function(module, exports) {
  430. 'use strict';
  431. module.exports = function bind(fn, thisArg) {
  432. return function wrap() {
  433. var args = new Array(arguments.length);
  434. for (var i = 0; i < args.length; i++) {
  435. args[i] = arguments[i];
  436. }
  437. return fn.apply(thisArg, args);
  438. };
  439. };
  440. /***/ }),
  441. /* 4 */
  442. /***/ (function(module, exports, __webpack_require__) {
  443. 'use strict';
  444. var utils = __webpack_require__(2);
  445. var buildURL = __webpack_require__(5);
  446. var InterceptorManager = __webpack_require__(6);
  447. var dispatchRequest = __webpack_require__(7);
  448. var mergeConfig = __webpack_require__(22);
  449. /**
  450. * Create a new instance of Axios
  451. *
  452. * @param {Object} instanceConfig The default config for the instance
  453. */
  454. function Axios(instanceConfig) {
  455. this.defaults = instanceConfig;
  456. this.interceptors = {
  457. request: new InterceptorManager(),
  458. response: new InterceptorManager()
  459. };
  460. }
  461. /**
  462. * Dispatch a request
  463. *
  464. * @param {Object} config The config specific for this request (merged with this.defaults)
  465. */
  466. Axios.prototype.request = function request(config) {
  467. /*eslint no-param-reassign:0*/
  468. // Allow for axios('example/url'[, config]) a la fetch API
  469. if (typeof config === 'string') {
  470. config = arguments[1] || {};
  471. config.url = arguments[0];
  472. } else {
  473. config = config || {};
  474. }
  475. config = mergeConfig(this.defaults, config);
  476. // Set config.method
  477. if (config.method) {
  478. config.method = config.method.toLowerCase();
  479. } else if (this.defaults.method) {
  480. config.method = this.defaults.method.toLowerCase();
  481. } else {
  482. config.method = 'get';
  483. }
  484. // Hook up interceptors middleware
  485. var chain = [dispatchRequest, undefined];
  486. var promise = Promise.resolve(config);
  487. this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
  488. chain.unshift(interceptor.fulfilled, interceptor.rejected);
  489. });
  490. this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
  491. chain.push(interceptor.fulfilled, interceptor.rejected);
  492. });
  493. while (chain.length) {
  494. promise = promise.then(chain.shift(), chain.shift());
  495. }
  496. return promise;
  497. };
  498. Axios.prototype.getUri = function getUri(config) {
  499. config = mergeConfig(this.defaults, config);
  500. return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\?/, '');
  501. };
  502. // Provide aliases for supported request methods
  503. utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
  504. /*eslint func-names:0*/
  505. Axios.prototype[method] = function(url, config) {
  506. return this.request(mergeConfig(config || {}, {
  507. method: method,
  508. url: url,
  509. data: (config || {}).data
  510. }));
  511. };
  512. });
  513. utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
  514. /*eslint func-names:0*/
  515. Axios.prototype[method] = function(url, data, config) {
  516. return this.request(mergeConfig(config || {}, {
  517. method: method,
  518. url: url,
  519. data: data
  520. }));
  521. };
  522. });
  523. module.exports = Axios;
  524. /***/ }),
  525. /* 5 */
  526. /***/ (function(module, exports, __webpack_require__) {
  527. 'use strict';
  528. var utils = __webpack_require__(2);
  529. function encode(val) {
  530. return encodeURIComponent(val).
  531. replace(/%3A/gi, ':').
  532. replace(/%24/g, '$').
  533. replace(/%2C/gi, ',').
  534. replace(/%20/g, '+').
  535. replace(/%5B/gi, '[').
  536. replace(/%5D/gi, ']');
  537. }
  538. /**
  539. * Build a URL by appending params to the end
  540. *
  541. * @param {string} url The base of the url (e.g., http://www.google.com)
  542. * @param {object} [params] The params to be appended
  543. * @returns {string} The formatted url
  544. */
  545. module.exports = function buildURL(url, params, paramsSerializer) {
  546. /*eslint no-param-reassign:0*/
  547. if (!params) {
  548. return url;
  549. }
  550. var serializedParams;
  551. if (paramsSerializer) {
  552. serializedParams = paramsSerializer(params);
  553. } else if (utils.isURLSearchParams(params)) {
  554. serializedParams = params.toString();
  555. } else {
  556. var parts = [];
  557. utils.forEach(params, function serialize(val, key) {
  558. if (val === null || typeof val === 'undefined') {
  559. return;
  560. }
  561. if (utils.isArray(val)) {
  562. key = key + '[]';
  563. } else {
  564. val = [val];
  565. }
  566. utils.forEach(val, function parseValue(v) {
  567. if (utils.isDate(v)) {
  568. v = v.toISOString();
  569. } else if (utils.isObject(v)) {
  570. v = JSON.stringify(v);
  571. }
  572. parts.push(encode(key) + '=' + encode(v));
  573. });
  574. });
  575. serializedParams = parts.join('&');
  576. }
  577. if (serializedParams) {
  578. var hashmarkIndex = url.indexOf('#');
  579. if (hashmarkIndex !== -1) {
  580. url = url.slice(0, hashmarkIndex);
  581. }
  582. url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
  583. }
  584. return url;
  585. };
  586. /***/ }),
  587. /* 6 */
  588. /***/ (function(module, exports, __webpack_require__) {
  589. 'use strict';
  590. var utils = __webpack_require__(2);
  591. function InterceptorManager() {
  592. this.handlers = [];
  593. }
  594. /**
  595. * Add a new interceptor to the stack
  596. *
  597. * @param {Function} fulfilled The function to handle `then` for a `Promise`
  598. * @param {Function} rejected The function to handle `reject` for a `Promise`
  599. *
  600. * @return {Number} An ID used to remove interceptor later
  601. */
  602. InterceptorManager.prototype.use = function use(fulfilled, rejected) {
  603. this.handlers.push({
  604. fulfilled: fulfilled,
  605. rejected: rejected
  606. });
  607. return this.handlers.length - 1;
  608. };
  609. /**
  610. * Remove an interceptor from the stack
  611. *
  612. * @param {Number} id The ID that was returned by `use`
  613. */
  614. InterceptorManager.prototype.eject = function eject(id) {
  615. if (this.handlers[id]) {
  616. this.handlers[id] = null;
  617. }
  618. };
  619. /**
  620. * Iterate over all the registered interceptors
  621. *
  622. * This method is particularly useful for skipping over any
  623. * interceptors that may have become `null` calling `eject`.
  624. *
  625. * @param {Function} fn The function to call for each interceptor
  626. */
  627. InterceptorManager.prototype.forEach = function forEach(fn) {
  628. utils.forEach(this.handlers, function forEachHandler(h) {
  629. if (h !== null) {
  630. fn(h);
  631. }
  632. });
  633. };
  634. module.exports = InterceptorManager;
  635. /***/ }),
  636. /* 7 */
  637. /***/ (function(module, exports, __webpack_require__) {
  638. 'use strict';
  639. var utils = __webpack_require__(2);
  640. var transformData = __webpack_require__(8);
  641. var isCancel = __webpack_require__(9);
  642. var defaults = __webpack_require__(10);
  643. /**
  644. * Throws a `Cancel` if cancellation has been requested.
  645. */
  646. function throwIfCancellationRequested(config) {
  647. if (config.cancelToken) {
  648. config.cancelToken.throwIfRequested();
  649. }
  650. }
  651. /**
  652. * Dispatch a request to the server using the configured adapter.
  653. *
  654. * @param {object} config The config that is to be used for the request
  655. * @returns {Promise} The Promise to be fulfilled
  656. */
  657. module.exports = function dispatchRequest(config) {
  658. throwIfCancellationRequested(config);
  659. // Ensure headers exist
  660. config.headers = config.headers || {};
  661. // Transform request data
  662. config.data = transformData(
  663. config.data,
  664. config.headers,
  665. config.transformRequest
  666. );
  667. // Flatten headers
  668. config.headers = utils.merge(
  669. config.headers.common || {},
  670. config.headers[config.method] || {},
  671. config.headers
  672. );
  673. utils.forEach(
  674. ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
  675. function cleanHeaderConfig(method) {
  676. delete config.headers[method];
  677. }
  678. );
  679. var adapter = config.adapter || defaults.adapter;
  680. return adapter(config).then(function onAdapterResolution(response) {
  681. throwIfCancellationRequested(config);
  682. // Transform response data
  683. response.data = transformData(
  684. response.data,
  685. response.headers,
  686. config.transformResponse
  687. );
  688. return response;
  689. }, function onAdapterRejection(reason) {
  690. if (!isCancel(reason)) {
  691. throwIfCancellationRequested(config);
  692. // Transform response data
  693. if (reason && reason.response) {
  694. reason.response.data = transformData(
  695. reason.response.data,
  696. reason.response.headers,
  697. config.transformResponse
  698. );
  699. }
  700. }
  701. return Promise.reject(reason);
  702. });
  703. };
  704. /***/ }),
  705. /* 8 */
  706. /***/ (function(module, exports, __webpack_require__) {
  707. 'use strict';
  708. var utils = __webpack_require__(2);
  709. /**
  710. * Transform the data for a request or a response
  711. *
  712. * @param {Object|String} data The data to be transformed
  713. * @param {Array} headers The headers for the request or response
  714. * @param {Array|Function} fns A single function or Array of functions
  715. * @returns {*} The resulting transformed data
  716. */
  717. module.exports = function transformData(data, headers, fns) {
  718. /*eslint no-param-reassign:0*/
  719. utils.forEach(fns, function transform(fn) {
  720. data = fn(data, headers);
  721. });
  722. return data;
  723. };
  724. /***/ }),
  725. /* 9 */
  726. /***/ (function(module, exports) {
  727. 'use strict';
  728. module.exports = function isCancel(value) {
  729. return !!(value && value.__CANCEL__);
  730. };
  731. /***/ }),
  732. /* 10 */
  733. /***/ (function(module, exports, __webpack_require__) {
  734. 'use strict';
  735. var utils = __webpack_require__(2);
  736. var normalizeHeaderName = __webpack_require__(11);
  737. var DEFAULT_CONTENT_TYPE = {
  738. 'Content-Type': 'application/x-www-form-urlencoded'
  739. };
  740. function setContentTypeIfUnset(headers, value) {
  741. if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
  742. headers['Content-Type'] = value;
  743. }
  744. }
  745. function getDefaultAdapter() {
  746. var adapter;
  747. if (typeof XMLHttpRequest !== 'undefined') {
  748. // For browsers use XHR adapter
  749. adapter = __webpack_require__(12);
  750. } else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {
  751. // For node use HTTP adapter
  752. adapter = __webpack_require__(12);
  753. }
  754. return adapter;
  755. }
  756. var defaults = {
  757. adapter: getDefaultAdapter(),
  758. transformRequest: [function transformRequest(data, headers) {
  759. normalizeHeaderName(headers, 'Accept');
  760. normalizeHeaderName(headers, 'Content-Type');
  761. if (utils.isFormData(data) ||
  762. utils.isArrayBuffer(data) ||
  763. utils.isBuffer(data) ||
  764. utils.isStream(data) ||
  765. utils.isFile(data) ||
  766. utils.isBlob(data)
  767. ) {
  768. return data;
  769. }
  770. if (utils.isArrayBufferView(data)) {
  771. return data.buffer;
  772. }
  773. if (utils.isURLSearchParams(data)) {
  774. setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
  775. return data.toString();
  776. }
  777. if (utils.isObject(data)) {
  778. setContentTypeIfUnset(headers, 'application/json;charset=utf-8');
  779. return JSON.stringify(data);
  780. }
  781. return data;
  782. }],
  783. transformResponse: [function transformResponse(data) {
  784. /*eslint no-param-reassign:0*/
  785. if (typeof data === 'string') {
  786. try {
  787. data = JSON.parse(data);
  788. } catch (e) { /* Ignore */ }
  789. }
  790. return data;
  791. }],
  792. /**
  793. * A timeout in milliseconds to abort a request. If set to 0 (default) a
  794. * timeout is not created.
  795. */
  796. timeout: 0,
  797. xsrfCookieName: 'XSRF-TOKEN',
  798. xsrfHeaderName: 'X-XSRF-TOKEN',
  799. maxContentLength: -1,
  800. maxBodyLength: -1,
  801. validateStatus: function validateStatus(status) {
  802. return status >= 200 && status < 300;
  803. }
  804. };
  805. defaults.headers = {
  806. common: {
  807. 'Accept': 'application/json, text/plain, */*'
  808. }
  809. };
  810. utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
  811. defaults.headers[method] = {};
  812. });
  813. utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
  814. defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
  815. });
  816. module.exports = defaults;
  817. /***/ }),
  818. /* 11 */
  819. /***/ (function(module, exports, __webpack_require__) {
  820. 'use strict';
  821. var utils = __webpack_require__(2);
  822. module.exports = function normalizeHeaderName(headers, normalizedName) {
  823. utils.forEach(headers, function processHeader(value, name) {
  824. if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
  825. headers[normalizedName] = value;
  826. delete headers[name];
  827. }
  828. });
  829. };
  830. /***/ }),
  831. /* 12 */
  832. /***/ (function(module, exports, __webpack_require__) {
  833. 'use strict';
  834. var utils = __webpack_require__(2);
  835. var settle = __webpack_require__(13);
  836. var cookies = __webpack_require__(16);
  837. var buildURL = __webpack_require__(5);
  838. var buildFullPath = __webpack_require__(17);
  839. var parseHeaders = __webpack_require__(20);
  840. var isURLSameOrigin = __webpack_require__(21);
  841. var createError = __webpack_require__(14);
  842. module.exports = function xhrAdapter(config) {
  843. return new Promise(function dispatchXhrRequest(resolve, reject) {
  844. var requestData = config.data;
  845. var requestHeaders = config.headers;
  846. if (utils.isFormData(requestData)) {
  847. delete requestHeaders['Content-Type']; // Let the browser set it
  848. }
  849. var request = new XMLHttpRequest();
  850. // HTTP basic authentication
  851. if (config.auth) {
  852. var username = config.auth.username || '';
  853. var password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';
  854. requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
  855. }
  856. var fullPath = buildFullPath(config.baseURL, config.url);
  857. request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
  858. // Set the request timeout in MS
  859. request.timeout = config.timeout;
  860. // Listen for ready state
  861. request.onreadystatechange = function handleLoad() {
  862. if (!request || request.readyState !== 4) {
  863. return;
  864. }
  865. // The request errored out and we didn't get a response, this will be
  866. // handled by onerror instead
  867. // With one exception: request that using file: protocol, most browsers
  868. // will return status as 0 even though it's a successful request
  869. if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
  870. return;
  871. }
  872. // Prepare the response
  873. var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
  874. var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;
  875. var response = {
  876. data: responseData,
  877. status: request.status,
  878. statusText: request.statusText,
  879. headers: responseHeaders,
  880. config: config,
  881. request: request
  882. };
  883. settle(resolve, reject, response);
  884. // Clean up request
  885. request = null;
  886. };
  887. // Handle browser request cancellation (as opposed to a manual cancellation)
  888. request.onabort = function handleAbort() {
  889. if (!request) {
  890. return;
  891. }
  892. reject(createError('Request aborted', config, 'ECONNABORTED', request));
  893. // Clean up request
  894. request = null;
  895. };
  896. // Handle low level network errors
  897. request.onerror = function handleError() {
  898. // Real errors are hidden from us by the browser
  899. // onerror should only fire if it's a network error
  900. reject(createError('Network Error', config, null, request));
  901. // Clean up request
  902. request = null;
  903. };
  904. // Handle timeout
  905. request.ontimeout = function handleTimeout() {
  906. var timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded';
  907. if (config.timeoutErrorMessage) {
  908. timeoutErrorMessage = config.timeoutErrorMessage;
  909. }
  910. reject(createError(timeoutErrorMessage, config, 'ECONNABORTED',
  911. request));
  912. // Clean up request
  913. request = null;
  914. };
  915. // Add xsrf header
  916. // This is only done if running in a standard browser environment.
  917. // Specifically not if we're in a web worker, or react-native.
  918. if (utils.isStandardBrowserEnv()) {
  919. // Add xsrf header
  920. var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ?
  921. cookies.read(config.xsrfCookieName) :
  922. undefined;
  923. if (xsrfValue) {
  924. requestHeaders[config.xsrfHeaderName] = xsrfValue;
  925. }
  926. }
  927. // Add headers to the request
  928. if ('setRequestHeader' in request) {
  929. utils.forEach(requestHeaders, function setRequestHeader(val, key) {
  930. if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {
  931. // Remove Content-Type if data is undefined
  932. delete requestHeaders[key];
  933. } else {
  934. // Otherwise add header to the request
  935. request.setRequestHeader(key, val);
  936. }
  937. });
  938. }
  939. // Add withCredentials to request if needed
  940. if (!utils.isUndefined(config.withCredentials)) {
  941. request.withCredentials = !!config.withCredentials;
  942. }
  943. // Add responseType to request if needed
  944. if (config.responseType) {
  945. try {
  946. request.responseType = config.responseType;
  947. } catch (e) {
  948. // Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2.
  949. // But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function.
  950. if (config.responseType !== 'json') {
  951. throw e;
  952. }
  953. }
  954. }
  955. // Handle progress if needed
  956. if (typeof config.onDownloadProgress === 'function') {
  957. request.addEventListener('progress', config.onDownloadProgress);
  958. }
  959. // Not all browsers support upload events
  960. if (typeof config.onUploadProgress === 'function' && request.upload) {
  961. request.upload.addEventListener('progress', config.onUploadProgress);
  962. }
  963. if (config.cancelToken) {
  964. // Handle cancellation
  965. config.cancelToken.promise.then(function onCanceled(cancel) {
  966. if (!request) {
  967. return;
  968. }
  969. request.abort();
  970. reject(cancel);
  971. // Clean up request
  972. request = null;
  973. });
  974. }
  975. if (!requestData) {
  976. requestData = null;
  977. }
  978. // Send the request
  979. request.send(requestData);
  980. });
  981. };
  982. /***/ }),
  983. /* 13 */
  984. /***/ (function(module, exports, __webpack_require__) {
  985. 'use strict';
  986. var createError = __webpack_require__(14);
  987. /**
  988. * Resolve or reject a Promise based on response status.
  989. *
  990. * @param {Function} resolve A function that resolves the promise.
  991. * @param {Function} reject A function that rejects the promise.
  992. * @param {object} response The response.
  993. */
  994. module.exports = function settle(resolve, reject, response) {
  995. var validateStatus = response.config.validateStatus;
  996. if (!response.status || !validateStatus || validateStatus(response.status)) {
  997. resolve(response);
  998. } else {
  999. reject(createError(
  1000. 'Request failed with status code ' + response.status,
  1001. response.config,
  1002. null,
  1003. response.request,
  1004. response
  1005. ));
  1006. }
  1007. };
  1008. /***/ }),
  1009. /* 14 */
  1010. /***/ (function(module, exports, __webpack_require__) {
  1011. 'use strict';
  1012. var enhanceError = __webpack_require__(15);
  1013. /**
  1014. * Create an Error with the specified message, config, error code, request and response.
  1015. *
  1016. * @param {string} message The error message.
  1017. * @param {Object} config The config.
  1018. * @param {string} [code] The error code (for example, 'ECONNABORTED').
  1019. * @param {Object} [request] The request.
  1020. * @param {Object} [response] The response.
  1021. * @returns {Error} The created error.
  1022. */
  1023. module.exports = function createError(message, config, code, request, response) {
  1024. var error = new Error(message);
  1025. return enhanceError(error, config, code, request, response);
  1026. };
  1027. /***/ }),
  1028. /* 15 */
  1029. /***/ (function(module, exports) {
  1030. 'use strict';
  1031. /**
  1032. * Update an Error with the specified config, error code, and response.
  1033. *
  1034. * @param {Error} error The error to update.
  1035. * @param {Object} config The config.
  1036. * @param {string} [code] The error code (for example, 'ECONNABORTED').
  1037. * @param {Object} [request] The request.
  1038. * @param {Object} [response] The response.
  1039. * @returns {Error} The error.
  1040. */
  1041. module.exports = function enhanceError(error, config, code, request, response) {
  1042. error.config = config;
  1043. if (code) {
  1044. error.code = code;
  1045. }
  1046. error.request = request;
  1047. error.response = response;
  1048. error.isAxiosError = true;
  1049. error.toJSON = function toJSON() {
  1050. return {
  1051. // Standard
  1052. message: this.message,
  1053. name: this.name,
  1054. // Microsoft
  1055. description: this.description,
  1056. number: this.number,
  1057. // Mozilla
  1058. fileName: this.fileName,
  1059. lineNumber: this.lineNumber,
  1060. columnNumber: this.columnNumber,
  1061. stack: this.stack,
  1062. // Axios
  1063. config: this.config,
  1064. code: this.code
  1065. };
  1066. };
  1067. return error;
  1068. };
  1069. /***/ }),
  1070. /* 16 */
  1071. /***/ (function(module, exports, __webpack_require__) {
  1072. 'use strict';
  1073. var utils = __webpack_require__(2);
  1074. module.exports = (
  1075. utils.isStandardBrowserEnv() ?
  1076. // Standard browser envs support document.cookie
  1077. (function standardBrowserEnv() {
  1078. return {
  1079. write: function write(name, value, expires, path, domain, secure) {
  1080. var cookie = [];
  1081. cookie.push(name + '=' + encodeURIComponent(value));
  1082. if (utils.isNumber(expires)) {
  1083. cookie.push('expires=' + new Date(expires).toGMTString());
  1084. }
  1085. if (utils.isString(path)) {
  1086. cookie.push('path=' + path);
  1087. }
  1088. if (utils.isString(domain)) {
  1089. cookie.push('domain=' + domain);
  1090. }
  1091. if (secure === true) {
  1092. cookie.push('secure');
  1093. }
  1094. document.cookie = cookie.join('; ');
  1095. },
  1096. read: function read(name) {
  1097. var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
  1098. return (match ? decodeURIComponent(match[3]) : null);
  1099. },
  1100. remove: function remove(name) {
  1101. this.write(name, '', Date.now() - 86400000);
  1102. }
  1103. };
  1104. })() :
  1105. // Non standard browser env (web workers, react-native) lack needed support.
  1106. (function nonStandardBrowserEnv() {
  1107. return {
  1108. write: function write() {},
  1109. read: function read() { return null; },
  1110. remove: function remove() {}
  1111. };
  1112. })()
  1113. );
  1114. /***/ }),
  1115. /* 17 */
  1116. /***/ (function(module, exports, __webpack_require__) {
  1117. 'use strict';
  1118. var isAbsoluteURL = __webpack_require__(18);
  1119. var combineURLs = __webpack_require__(19);
  1120. /**
  1121. * Creates a new URL by combining the baseURL with the requestedURL,
  1122. * only when the requestedURL is not already an absolute URL.
  1123. * If the requestURL is absolute, this function returns the requestedURL untouched.
  1124. *
  1125. * @param {string} baseURL The base URL
  1126. * @param {string} requestedURL Absolute or relative URL to combine
  1127. * @returns {string} The combined full path
  1128. */
  1129. module.exports = function buildFullPath(baseURL, requestedURL) {
  1130. if (baseURL && !isAbsoluteURL(requestedURL)) {
  1131. return combineURLs(baseURL, requestedURL);
  1132. }
  1133. return requestedURL;
  1134. };
  1135. /***/ }),
  1136. /* 18 */
  1137. /***/ (function(module, exports) {
  1138. 'use strict';
  1139. /**
  1140. * Determines whether the specified URL is absolute
  1141. *
  1142. * @param {string} url The URL to test
  1143. * @returns {boolean} True if the specified URL is absolute, otherwise false
  1144. */
  1145. module.exports = function isAbsoluteURL(url) {
  1146. // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
  1147. // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
  1148. // by any combination of letters, digits, plus, period, or hyphen.
  1149. return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
  1150. };
  1151. /***/ }),
  1152. /* 19 */
  1153. /***/ (function(module, exports) {
  1154. 'use strict';
  1155. /**
  1156. * Creates a new URL by combining the specified URLs
  1157. *
  1158. * @param {string} baseURL The base URL
  1159. * @param {string} relativeURL The relative URL
  1160. * @returns {string} The combined URL
  1161. */
  1162. module.exports = function combineURLs(baseURL, relativeURL) {
  1163. return relativeURL
  1164. ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
  1165. : baseURL;
  1166. };
  1167. /***/ }),
  1168. /* 20 */
  1169. /***/ (function(module, exports, __webpack_require__) {
  1170. 'use strict';
  1171. var utils = __webpack_require__(2);
  1172. // Headers whose duplicates are ignored by node
  1173. // c.f. https://nodejs.org/api/http.html#http_message_headers
  1174. var ignoreDuplicateOf = [
  1175. 'age', 'authorization', 'content-length', 'content-type', 'etag',
  1176. 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
  1177. 'last-modified', 'location', 'max-forwards', 'proxy-authorization',
  1178. 'referer', 'retry-after', 'user-agent'
  1179. ];
  1180. /**
  1181. * Parse headers into an object
  1182. *
  1183. * ```
  1184. * Date: Wed, 27 Aug 2014 08:58:49 GMT
  1185. * Content-Type: application/json
  1186. * Connection: keep-alive
  1187. * Transfer-Encoding: chunked
  1188. * ```
  1189. *
  1190. * @param {String} headers Headers needing to be parsed
  1191. * @returns {Object} Headers parsed into an object
  1192. */
  1193. module.exports = function parseHeaders(headers) {
  1194. var parsed = {};
  1195. var key;
  1196. var val;
  1197. var i;
  1198. if (!headers) { return parsed; }
  1199. utils.forEach(headers.split('\n'), function parser(line) {
  1200. i = line.indexOf(':');
  1201. key = utils.trim(line.substr(0, i)).toLowerCase();
  1202. val = utils.trim(line.substr(i + 1));
  1203. if (key) {
  1204. if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {
  1205. return;
  1206. }
  1207. if (key === 'set-cookie') {
  1208. parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);
  1209. } else {
  1210. parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
  1211. }
  1212. }
  1213. });
  1214. return parsed;
  1215. };
  1216. /***/ }),
  1217. /* 21 */
  1218. /***/ (function(module, exports, __webpack_require__) {
  1219. 'use strict';
  1220. var utils = __webpack_require__(2);
  1221. module.exports = (
  1222. utils.isStandardBrowserEnv() ?
  1223. // Standard browser envs have full support of the APIs needed to test
  1224. // whether the request URL is of the same origin as current location.
  1225. (function standardBrowserEnv() {
  1226. var msie = /(msie|trident)/i.test(navigator.userAgent);
  1227. var urlParsingNode = document.createElement('a');
  1228. var originURL;
  1229. /**
  1230. * Parse a URL to discover it's components
  1231. *
  1232. * @param {String} url The URL to be parsed
  1233. * @returns {Object}
  1234. */
  1235. function resolveURL(url) {
  1236. var href = url;
  1237. if (msie) {
  1238. // IE needs attribute set twice to normalize properties
  1239. urlParsingNode.setAttribute('href', href);
  1240. href = urlParsingNode.href;
  1241. }
  1242. urlParsingNode.setAttribute('href', href);
  1243. // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
  1244. return {
  1245. href: urlParsingNode.href,
  1246. protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
  1247. host: urlParsingNode.host,
  1248. search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
  1249. hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
  1250. hostname: urlParsingNode.hostname,
  1251. port: urlParsingNode.port,
  1252. pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
  1253. urlParsingNode.pathname :
  1254. '/' + urlParsingNode.pathname
  1255. };
  1256. }
  1257. originURL = resolveURL(window.location.href);
  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. })() :
  1270. // Non standard browser envs (web workers, react-native) lack needed support.
  1271. (function nonStandardBrowserEnv() {
  1272. return function isURLSameOrigin() {
  1273. return true;
  1274. };
  1275. })()
  1276. );
  1277. /***/ }),
  1278. /* 22 */
  1279. /***/ (function(module, exports, __webpack_require__) {
  1280. 'use strict';
  1281. var utils = __webpack_require__(2);
  1282. /**
  1283. * Config-specific merge-function which creates a new config-object
  1284. * by merging two configuration objects together.
  1285. *
  1286. * @param {Object} config1
  1287. * @param {Object} config2
  1288. * @returns {Object} New object resulting from merging config2 to config1
  1289. */
  1290. module.exports = function mergeConfig(config1, config2) {
  1291. // eslint-disable-next-line no-param-reassign
  1292. config2 = config2 || {};
  1293. var config = {};
  1294. var valueFromConfig2Keys = ['url', 'method', 'data'];
  1295. var mergeDeepPropertiesKeys = ['headers', 'auth', 'proxy', 'params'];
  1296. var defaultToConfig2Keys = [
  1297. 'baseURL', 'transformRequest', 'transformResponse', 'paramsSerializer',
  1298. 'timeout', 'timeoutMessage', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName',
  1299. 'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress', 'decompress',
  1300. 'maxContentLength', 'maxBodyLength', 'maxRedirects', 'transport', 'httpAgent',
  1301. 'httpsAgent', 'cancelToken', 'socketPath', 'responseEncoding'
  1302. ];
  1303. var directMergeKeys = ['validateStatus'];
  1304. function getMergedValue(target, source) {
  1305. if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
  1306. return utils.merge(target, source);
  1307. } else if (utils.isPlainObject(source)) {
  1308. return utils.merge({}, source);
  1309. } else if (utils.isArray(source)) {
  1310. return source.slice();
  1311. }
  1312. return source;
  1313. }
  1314. function mergeDeepProperties(prop) {
  1315. if (!utils.isUndefined(config2[prop])) {
  1316. config[prop] = getMergedValue(config1[prop], config2[prop]);
  1317. } else if (!utils.isUndefined(config1[prop])) {
  1318. config[prop] = getMergedValue(undefined, config1[prop]);
  1319. }
  1320. }
  1321. utils.forEach(valueFromConfig2Keys, function valueFromConfig2(prop) {
  1322. if (!utils.isUndefined(config2[prop])) {
  1323. config[prop] = getMergedValue(undefined, config2[prop]);
  1324. }
  1325. });
  1326. utils.forEach(mergeDeepPropertiesKeys, mergeDeepProperties);
  1327. utils.forEach(defaultToConfig2Keys, function defaultToConfig2(prop) {
  1328. if (!utils.isUndefined(config2[prop])) {
  1329. config[prop] = getMergedValue(undefined, config2[prop]);
  1330. } else if (!utils.isUndefined(config1[prop])) {
  1331. config[prop] = getMergedValue(undefined, config1[prop]);
  1332. }
  1333. });
  1334. utils.forEach(directMergeKeys, function merge(prop) {
  1335. if (prop in config2) {
  1336. config[prop] = getMergedValue(config1[prop], config2[prop]);
  1337. } else if (prop in config1) {
  1338. config[prop] = getMergedValue(undefined, config1[prop]);
  1339. }
  1340. });
  1341. var axiosKeys = valueFromConfig2Keys
  1342. .concat(mergeDeepPropertiesKeys)
  1343. .concat(defaultToConfig2Keys)
  1344. .concat(directMergeKeys);
  1345. var otherKeys = Object
  1346. .keys(config1)
  1347. .concat(Object.keys(config2))
  1348. .filter(function filterAxiosKeys(key) {
  1349. return axiosKeys.indexOf(key) === -1;
  1350. });
  1351. utils.forEach(otherKeys, mergeDeepProperties);
  1352. return config;
  1353. };
  1354. /***/ }),
  1355. /* 23 */
  1356. /***/ (function(module, exports) {
  1357. 'use strict';
  1358. /**
  1359. * A `Cancel` is an object that is thrown when an operation is canceled.
  1360. *
  1361. * @class
  1362. * @param {string=} message The message.
  1363. */
  1364. function Cancel(message) {
  1365. this.message = message;
  1366. }
  1367. Cancel.prototype.toString = function toString() {
  1368. return 'Cancel' + (this.message ? ': ' + this.message : '');
  1369. };
  1370. Cancel.prototype.__CANCEL__ = true;
  1371. module.exports = Cancel;
  1372. /***/ }),
  1373. /* 24 */
  1374. /***/ (function(module, exports, __webpack_require__) {
  1375. 'use strict';
  1376. var Cancel = __webpack_require__(23);
  1377. /**
  1378. * A `CancelToken` is an object that can be used to request cancellation of an operation.
  1379. *
  1380. * @class
  1381. * @param {Function} executor The executor function.
  1382. */
  1383. function CancelToken(executor) {
  1384. if (typeof executor !== 'function') {
  1385. throw new TypeError('executor must be a function.');
  1386. }
  1387. var resolvePromise;
  1388. this.promise = new Promise(function promiseExecutor(resolve) {
  1389. resolvePromise = resolve;
  1390. });
  1391. var token = this;
  1392. executor(function cancel(message) {
  1393. if (token.reason) {
  1394. // Cancellation has already been requested
  1395. return;
  1396. }
  1397. token.reason = new Cancel(message);
  1398. resolvePromise(token.reason);
  1399. });
  1400. }
  1401. /**
  1402. * Throws a `Cancel` if cancellation has been requested.
  1403. */
  1404. CancelToken.prototype.throwIfRequested = function throwIfRequested() {
  1405. if (this.reason) {
  1406. throw this.reason;
  1407. }
  1408. };
  1409. /**
  1410. * Returns an object that contains a new `CancelToken` and a function that, when called,
  1411. * cancels the `CancelToken`.
  1412. */
  1413. CancelToken.source = function source() {
  1414. var cancel;
  1415. var token = new CancelToken(function executor(c) {
  1416. cancel = c;
  1417. });
  1418. return {
  1419. token: token,
  1420. cancel: cancel
  1421. };
  1422. };
  1423. module.exports = CancelToken;
  1424. /***/ }),
  1425. /* 25 */
  1426. /***/ (function(module, exports) {
  1427. 'use strict';
  1428. /**
  1429. * Syntactic sugar for invoking a function and expanding an array for arguments.
  1430. *
  1431. * Common use case would be to use `Function.prototype.apply`.
  1432. *
  1433. * ```js
  1434. * function f(x, y, z) {}
  1435. * var args = [1, 2, 3];
  1436. * f.apply(null, args);
  1437. * ```
  1438. *
  1439. * With `spread` this example can be re-written.
  1440. *
  1441. * ```js
  1442. * spread(function(x, y, z) {})([1, 2, 3]);
  1443. * ```
  1444. *
  1445. * @param {Function} callback
  1446. * @returns {Function}
  1447. */
  1448. module.exports = function spread(callback) {
  1449. return function wrap(arr) {
  1450. return callback.apply(null, arr);
  1451. };
  1452. };
  1453. /***/ }),
  1454. /* 26 */
  1455. /***/ (function(module, exports) {
  1456. 'use strict';
  1457. /**
  1458. * Determines whether the payload is an error thrown by Axios
  1459. *
  1460. * @param {*} payload The value to test
  1461. * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
  1462. */
  1463. module.exports = function isAxiosError(payload) {
  1464. return (typeof payload === 'object') && (payload.isAxiosError === true);
  1465. };
  1466. /***/ })
  1467. /******/ ])
  1468. });
  1469. ;
  1470. //# sourceMappingURL=axios.map