仲裁视频会议H5

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