axios.js 151 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546
  1. /*! Axios v1.15.2 Copyright (c) 2026 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 _OverloadYield(e, d) {
  8. this.v = e, this.k = d;
  9. }
  10. function _arrayLikeToArray(r, a) {
  11. (null == a || a > r.length) && (a = r.length);
  12. for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
  13. return n;
  14. }
  15. function _arrayWithHoles(r) {
  16. if (Array.isArray(r)) return r;
  17. }
  18. function _arrayWithoutHoles(r) {
  19. if (Array.isArray(r)) return _arrayLikeToArray(r);
  20. }
  21. function _assertThisInitialized(e) {
  22. if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  23. return e;
  24. }
  25. function _asyncGeneratorDelegate(t) {
  26. var e = {},
  27. n = false;
  28. function pump(e, r) {
  29. return n = true, r = new Promise(function (n) {
  30. n(t[e](r));
  31. }), {
  32. done: false,
  33. value: new _OverloadYield(r, 1)
  34. };
  35. }
  36. return e["undefined" != typeof Symbol && Symbol.iterator || "@@iterator"] = function () {
  37. return this;
  38. }, e.next = function (t) {
  39. return n ? (n = false, t) : pump("next", t);
  40. }, "function" == typeof t.throw && (e.throw = function (t) {
  41. if (n) throw n = false, t;
  42. return pump("throw", t);
  43. }), "function" == typeof t.return && (e.return = function (t) {
  44. return n ? (n = false, t) : pump("return", t);
  45. }), e;
  46. }
  47. function _asyncIterator(r) {
  48. var n,
  49. t,
  50. o,
  51. e = 2;
  52. for ("undefined" != typeof Symbol && (t = Symbol.asyncIterator, o = Symbol.iterator); e--;) {
  53. if (t && null != (n = r[t])) return n.call(r);
  54. if (o && null != (n = r[o])) return new AsyncFromSyncIterator(n.call(r));
  55. t = "@@asyncIterator", o = "@@iterator";
  56. }
  57. throw new TypeError("Object is not async iterable");
  58. }
  59. function AsyncFromSyncIterator(r) {
  60. function AsyncFromSyncIteratorContinuation(r) {
  61. if (Object(r) !== r) return Promise.reject(new TypeError(r + " is not an object."));
  62. var n = r.done;
  63. return Promise.resolve(r.value).then(function (r) {
  64. return {
  65. value: r,
  66. done: n
  67. };
  68. });
  69. }
  70. return AsyncFromSyncIterator = function (r) {
  71. this.s = r, this.n = r.next;
  72. }, AsyncFromSyncIterator.prototype = {
  73. s: null,
  74. n: null,
  75. next: function () {
  76. return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments));
  77. },
  78. return: function (r) {
  79. var n = this.s.return;
  80. return void 0 === n ? Promise.resolve({
  81. value: r,
  82. done: true
  83. }) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments));
  84. },
  85. throw: function (r) {
  86. var n = this.s.return;
  87. return void 0 === n ? Promise.reject(r) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments));
  88. }
  89. }, new AsyncFromSyncIterator(r);
  90. }
  91. function asyncGeneratorStep(n, t, e, r, o, a, c) {
  92. try {
  93. var i = n[a](c),
  94. u = i.value;
  95. } catch (n) {
  96. return void e(n);
  97. }
  98. i.done ? t(u) : Promise.resolve(u).then(r, o);
  99. }
  100. function _asyncToGenerator(n) {
  101. return function () {
  102. var t = this,
  103. e = arguments;
  104. return new Promise(function (r, o) {
  105. var a = n.apply(t, e);
  106. function _next(n) {
  107. asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
  108. }
  109. function _throw(n) {
  110. asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
  111. }
  112. _next(void 0);
  113. });
  114. };
  115. }
  116. function _awaitAsyncGenerator(e) {
  117. return new _OverloadYield(e, 0);
  118. }
  119. function _callSuper(t, o, e) {
  120. return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e));
  121. }
  122. function _classCallCheck(a, n) {
  123. if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
  124. }
  125. function _construct(t, e, r) {
  126. if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments);
  127. var o = [null];
  128. o.push.apply(o, e);
  129. var p = new (t.bind.apply(t, o))();
  130. return r && _setPrototypeOf(p, r.prototype), p;
  131. }
  132. function _defineProperties(e, r) {
  133. for (var t = 0; t < r.length; t++) {
  134. var o = r[t];
  135. o.enumerable = o.enumerable || false, o.configurable = true, "value" in o && (o.writable = true), Object.defineProperty(e, _toPropertyKey(o.key), o);
  136. }
  137. }
  138. function _createClass(e, r, t) {
  139. return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
  140. writable: false
  141. }), e;
  142. }
  143. function _createForOfIteratorHelper(r, e) {
  144. var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
  145. if (!t) {
  146. if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e) {
  147. t && (r = t);
  148. var n = 0,
  149. F = function () {};
  150. return {
  151. s: F,
  152. n: function () {
  153. return n >= r.length ? {
  154. done: true
  155. } : {
  156. done: false,
  157. value: r[n++]
  158. };
  159. },
  160. e: function (r) {
  161. throw r;
  162. },
  163. f: F
  164. };
  165. }
  166. throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  167. }
  168. var o,
  169. a = true,
  170. u = false;
  171. return {
  172. s: function () {
  173. t = t.call(r);
  174. },
  175. n: function () {
  176. var r = t.next();
  177. return a = r.done, r;
  178. },
  179. e: function (r) {
  180. u = true, o = r;
  181. },
  182. f: function () {
  183. try {
  184. a || null == t.return || t.return();
  185. } finally {
  186. if (u) throw o;
  187. }
  188. }
  189. };
  190. }
  191. function _defineProperty(e, r, t) {
  192. return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
  193. value: t,
  194. enumerable: true,
  195. configurable: true,
  196. writable: true
  197. }) : e[r] = t, e;
  198. }
  199. function _getPrototypeOf(t) {
  200. return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) {
  201. return t.__proto__ || Object.getPrototypeOf(t);
  202. }, _getPrototypeOf(t);
  203. }
  204. function _inherits(t, e) {
  205. if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
  206. t.prototype = Object.create(e && e.prototype, {
  207. constructor: {
  208. value: t,
  209. writable: true,
  210. configurable: true
  211. }
  212. }), Object.defineProperty(t, "prototype", {
  213. writable: false
  214. }), e && _setPrototypeOf(t, e);
  215. }
  216. function _isNativeFunction(t) {
  217. try {
  218. return -1 !== Function.toString.call(t).indexOf("[native code]");
  219. } catch (n) {
  220. return "function" == typeof t;
  221. }
  222. }
  223. function _isNativeReflectConstruct() {
  224. try {
  225. var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
  226. } catch (t) {}
  227. return (_isNativeReflectConstruct = function () {
  228. return !!t;
  229. })();
  230. }
  231. function _iterableToArray(r) {
  232. if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
  233. }
  234. function _iterableToArrayLimit(r, l) {
  235. var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
  236. if (null != t) {
  237. var e,
  238. n,
  239. i,
  240. u,
  241. a = [],
  242. f = true,
  243. o = false;
  244. try {
  245. if (i = (t = t.call(r)).next, 0 === l) {
  246. if (Object(t) !== t) return;
  247. f = !1;
  248. } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
  249. } catch (r) {
  250. o = true, n = r;
  251. } finally {
  252. try {
  253. if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
  254. } finally {
  255. if (o) throw n;
  256. }
  257. }
  258. return a;
  259. }
  260. }
  261. function _nonIterableRest() {
  262. throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  263. }
  264. function _nonIterableSpread() {
  265. throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  266. }
  267. function ownKeys(e, r) {
  268. var t = Object.keys(e);
  269. if (Object.getOwnPropertySymbols) {
  270. var o = Object.getOwnPropertySymbols(e);
  271. r && (o = o.filter(function (r) {
  272. return Object.getOwnPropertyDescriptor(e, r).enumerable;
  273. })), t.push.apply(t, o);
  274. }
  275. return t;
  276. }
  277. function _objectSpread2(e) {
  278. for (var r = 1; r < arguments.length; r++) {
  279. var t = null != arguments[r] ? arguments[r] : {};
  280. r % 2 ? ownKeys(Object(t), true).forEach(function (r) {
  281. _defineProperty(e, r, t[r]);
  282. }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
  283. Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
  284. });
  285. }
  286. return e;
  287. }
  288. function _possibleConstructorReturn(t, e) {
  289. if (e && ("object" == typeof e || "function" == typeof e)) return e;
  290. if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
  291. return _assertThisInitialized(t);
  292. }
  293. function _regenerator() {
  294. /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
  295. var e,
  296. t,
  297. r = "function" == typeof Symbol ? Symbol : {},
  298. n = r.iterator || "@@iterator",
  299. o = r.toStringTag || "@@toStringTag";
  300. function i(r, n, o, i) {
  301. var c = n && n.prototype instanceof Generator ? n : Generator,
  302. u = Object.create(c.prototype);
  303. return _regeneratorDefine(u, "_invoke", function (r, n, o) {
  304. var i,
  305. c,
  306. u,
  307. f = 0,
  308. p = o || [],
  309. y = false,
  310. G = {
  311. p: 0,
  312. n: 0,
  313. v: e,
  314. a: d,
  315. f: d.bind(e, 4),
  316. d: function (t, r) {
  317. return i = t, c = 0, u = e, G.n = r, a;
  318. }
  319. };
  320. function d(r, n) {
  321. for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) {
  322. var o,
  323. i = p[t],
  324. d = G.p,
  325. l = i[2];
  326. r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0));
  327. }
  328. if (o || r > 1) return a;
  329. throw y = true, n;
  330. }
  331. return function (o, p, l) {
  332. if (f > 1) throw TypeError("Generator is already running");
  333. for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) {
  334. i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u);
  335. try {
  336. if (f = 2, i) {
  337. if (c || (o = "next"), t = i[o]) {
  338. if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object");
  339. if (!t.done) return t;
  340. u = t.value, c < 2 && (c = 0);
  341. } else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1);
  342. i = e;
  343. } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break;
  344. } catch (t) {
  345. i = e, c = 1, u = t;
  346. } finally {
  347. f = 1;
  348. }
  349. }
  350. return {
  351. value: t,
  352. done: y
  353. };
  354. };
  355. }(r, o, i), true), u;
  356. }
  357. var a = {};
  358. function Generator() {}
  359. function GeneratorFunction() {}
  360. function GeneratorFunctionPrototype() {}
  361. t = Object.getPrototypeOf;
  362. var c = [][n] ? t(t([][n]())) : (_regeneratorDefine(t = {}, n, function () {
  363. return this;
  364. }), t),
  365. u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c);
  366. function f(e) {
  367. return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e;
  368. }
  369. return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine(u), _regeneratorDefine(u, o, "Generator"), _regeneratorDefine(u, n, function () {
  370. return this;
  371. }), _regeneratorDefine(u, "toString", function () {
  372. return "[object Generator]";
  373. }), (_regenerator = function () {
  374. return {
  375. w: i,
  376. m: f
  377. };
  378. })();
  379. }
  380. function _regeneratorDefine(e, r, n, t) {
  381. var i = Object.defineProperty;
  382. try {
  383. i({}, "", {});
  384. } catch (e) {
  385. i = 0;
  386. }
  387. _regeneratorDefine = function (e, r, n, t) {
  388. function o(r, n) {
  389. _regeneratorDefine(e, r, function (e) {
  390. return this._invoke(r, n, e);
  391. });
  392. }
  393. r ? i ? i(e, r, {
  394. value: n,
  395. enumerable: !t,
  396. configurable: !t,
  397. writable: !t
  398. }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2));
  399. }, _regeneratorDefine(e, r, n, t);
  400. }
  401. function _regeneratorValues(e) {
  402. if (null != e) {
  403. var t = e["function" == typeof Symbol && Symbol.iterator || "@@iterator"],
  404. r = 0;
  405. if (t) return t.call(e);
  406. if ("function" == typeof e.next) return e;
  407. if (!isNaN(e.length)) return {
  408. next: function () {
  409. return e && r >= e.length && (e = void 0), {
  410. value: e && e[r++],
  411. done: !e
  412. };
  413. }
  414. };
  415. }
  416. throw new TypeError(typeof e + " is not iterable");
  417. }
  418. function _setPrototypeOf(t, e) {
  419. return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
  420. return t.__proto__ = e, t;
  421. }, _setPrototypeOf(t, e);
  422. }
  423. function _slicedToArray(r, e) {
  424. return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
  425. }
  426. function _toConsumableArray(r) {
  427. return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
  428. }
  429. function _toPrimitive(t, r) {
  430. if ("object" != typeof t || !t) return t;
  431. var e = t[Symbol.toPrimitive];
  432. if (void 0 !== e) {
  433. var i = e.call(t, r);
  434. if ("object" != typeof i) return i;
  435. throw new TypeError("@@toPrimitive must return a primitive value.");
  436. }
  437. return ("string" === r ? String : Number)(t);
  438. }
  439. function _toPropertyKey(t) {
  440. var i = _toPrimitive(t, "string");
  441. return "symbol" == typeof i ? i : i + "";
  442. }
  443. function _typeof(o) {
  444. "@babel/helpers - typeof";
  445. return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
  446. return typeof o;
  447. } : function (o) {
  448. return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
  449. }, _typeof(o);
  450. }
  451. function _unsupportedIterableToArray(r, a) {
  452. if (r) {
  453. if ("string" == typeof r) return _arrayLikeToArray(r, a);
  454. var t = {}.toString.call(r).slice(8, -1);
  455. return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
  456. }
  457. }
  458. function _wrapAsyncGenerator(e) {
  459. return function () {
  460. return new AsyncGenerator(e.apply(this, arguments));
  461. };
  462. }
  463. function AsyncGenerator(e) {
  464. var r, t;
  465. function resume(r, t) {
  466. try {
  467. var n = e[r](t),
  468. o = n.value,
  469. u = o instanceof _OverloadYield;
  470. Promise.resolve(u ? o.v : o).then(function (t) {
  471. if (u) {
  472. var i = "return" === r ? "return" : "next";
  473. if (!o.k || t.done) return resume(i, t);
  474. t = e[i](t).value;
  475. }
  476. settle(n.done ? "return" : "normal", t);
  477. }, function (e) {
  478. resume("throw", e);
  479. });
  480. } catch (e) {
  481. settle("throw", e);
  482. }
  483. }
  484. function settle(e, n) {
  485. switch (e) {
  486. case "return":
  487. r.resolve({
  488. value: n,
  489. done: true
  490. });
  491. break;
  492. case "throw":
  493. r.reject(n);
  494. break;
  495. default:
  496. r.resolve({
  497. value: n,
  498. done: false
  499. });
  500. }
  501. (r = r.next) ? resume(r.key, r.arg) : t = null;
  502. }
  503. this._invoke = function (e, n) {
  504. return new Promise(function (o, u) {
  505. var i = {
  506. key: e,
  507. arg: n,
  508. resolve: o,
  509. reject: u,
  510. next: null
  511. };
  512. t ? t = t.next = i : (r = t = i, resume(e, n));
  513. });
  514. }, "function" != typeof e.return && (this.return = void 0);
  515. }
  516. AsyncGenerator.prototype["function" == typeof Symbol && Symbol.asyncIterator || "@@asyncIterator"] = function () {
  517. return this;
  518. }, AsyncGenerator.prototype.next = function (e) {
  519. return this._invoke("next", e);
  520. }, AsyncGenerator.prototype.throw = function (e) {
  521. return this._invoke("throw", e);
  522. }, AsyncGenerator.prototype.return = function (e) {
  523. return this._invoke("return", e);
  524. };
  525. function _wrapNativeSuper(t) {
  526. var r = "function" == typeof Map ? new Map() : void 0;
  527. return _wrapNativeSuper = function (t) {
  528. if (null === t || !_isNativeFunction(t)) return t;
  529. if ("function" != typeof t) throw new TypeError("Super expression must either be null or a function");
  530. if (void 0 !== r) {
  531. if (r.has(t)) return r.get(t);
  532. r.set(t, Wrapper);
  533. }
  534. function Wrapper() {
  535. return _construct(t, arguments, _getPrototypeOf(this).constructor);
  536. }
  537. return Wrapper.prototype = Object.create(t.prototype, {
  538. constructor: {
  539. value: Wrapper,
  540. enumerable: false,
  541. writable: true,
  542. configurable: true
  543. }
  544. }), _setPrototypeOf(Wrapper, t);
  545. }, _wrapNativeSuper(t);
  546. }
  547. /**
  548. * Create a bound version of a function with a specified `this` context
  549. *
  550. * @param {Function} fn - The function to bind
  551. * @param {*} thisArg - The value to be passed as the `this` parameter
  552. * @returns {Function} A new function that will call the original function with the specified `this` context
  553. */
  554. function bind(fn, thisArg) {
  555. return function wrap() {
  556. return fn.apply(thisArg, arguments);
  557. };
  558. }
  559. // utils is a library of generic helper functions non-specific to axios
  560. var toString = Object.prototype.toString;
  561. var getPrototypeOf = Object.getPrototypeOf;
  562. var iterator = Symbol.iterator,
  563. toStringTag = Symbol.toStringTag;
  564. var kindOf = function (cache) {
  565. return function (thing) {
  566. var str = toString.call(thing);
  567. return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
  568. };
  569. }(Object.create(null));
  570. var kindOfTest = function kindOfTest(type) {
  571. type = type.toLowerCase();
  572. return function (thing) {
  573. return kindOf(thing) === type;
  574. };
  575. };
  576. var typeOfTest = function typeOfTest(type) {
  577. return function (thing) {
  578. return _typeof(thing) === type;
  579. };
  580. };
  581. /**
  582. * Determine if a value is a non-null object
  583. *
  584. * @param {Object} val The value to test
  585. *
  586. * @returns {boolean} True if value is an Array, otherwise false
  587. */
  588. var isArray = Array.isArray;
  589. /**
  590. * Determine if a value is undefined
  591. *
  592. * @param {*} val The value to test
  593. *
  594. * @returns {boolean} True if the value is undefined, otherwise false
  595. */
  596. var isUndefined = typeOfTest('undefined');
  597. /**
  598. * Determine if a value is a Buffer
  599. *
  600. * @param {*} val The value to test
  601. *
  602. * @returns {boolean} True if value is a Buffer, otherwise false
  603. */
  604. function isBuffer(val) {
  605. return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) && isFunction$1(val.constructor.isBuffer) && val.constructor.isBuffer(val);
  606. }
  607. /**
  608. * Determine if a value is an ArrayBuffer
  609. *
  610. * @param {*} val The value to test
  611. *
  612. * @returns {boolean} True if value is an ArrayBuffer, otherwise false
  613. */
  614. var isArrayBuffer = kindOfTest('ArrayBuffer');
  615. /**
  616. * Determine if a value is a view on an ArrayBuffer
  617. *
  618. * @param {*} val The value to test
  619. *
  620. * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
  621. */
  622. function isArrayBufferView(val) {
  623. var result;
  624. if (typeof ArrayBuffer !== 'undefined' && ArrayBuffer.isView) {
  625. result = ArrayBuffer.isView(val);
  626. } else {
  627. result = val && val.buffer && isArrayBuffer(val.buffer);
  628. }
  629. return result;
  630. }
  631. /**
  632. * Determine if a value is a String
  633. *
  634. * @param {*} val The value to test
  635. *
  636. * @returns {boolean} True if value is a String, otherwise false
  637. */
  638. var isString = typeOfTest('string');
  639. /**
  640. * Determine if a value is a Function
  641. *
  642. * @param {*} val The value to test
  643. * @returns {boolean} True if value is a Function, otherwise false
  644. */
  645. var isFunction$1 = typeOfTest('function');
  646. /**
  647. * Determine if a value is a Number
  648. *
  649. * @param {*} val The value to test
  650. *
  651. * @returns {boolean} True if value is a Number, otherwise false
  652. */
  653. var isNumber = typeOfTest('number');
  654. /**
  655. * Determine if a value is an Object
  656. *
  657. * @param {*} thing The value to test
  658. *
  659. * @returns {boolean} True if value is an Object, otherwise false
  660. */
  661. var isObject = function isObject(thing) {
  662. return thing !== null && _typeof(thing) === 'object';
  663. };
  664. /**
  665. * Determine if a value is a Boolean
  666. *
  667. * @param {*} thing The value to test
  668. * @returns {boolean} True if value is a Boolean, otherwise false
  669. */
  670. var isBoolean = function isBoolean(thing) {
  671. return thing === true || thing === false;
  672. };
  673. /**
  674. * Determine if a value is a plain Object
  675. *
  676. * @param {*} val The value to test
  677. *
  678. * @returns {boolean} True if value is a plain Object, otherwise false
  679. */
  680. var isPlainObject = function isPlainObject(val) {
  681. if (kindOf(val) !== 'object') {
  682. return false;
  683. }
  684. var prototype = getPrototypeOf(val);
  685. return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(toStringTag in val) && !(iterator in val);
  686. };
  687. /**
  688. * Determine if a value is an empty object (safely handles Buffers)
  689. *
  690. * @param {*} val The value to test
  691. *
  692. * @returns {boolean} True if value is an empty object, otherwise false
  693. */
  694. var isEmptyObject = function isEmptyObject(val) {
  695. // Early return for non-objects or Buffers to prevent RangeError
  696. if (!isObject(val) || isBuffer(val)) {
  697. return false;
  698. }
  699. try {
  700. return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
  701. } catch (e) {
  702. // Fallback for any other objects that might cause RangeError with Object.keys()
  703. return false;
  704. }
  705. };
  706. /**
  707. * Determine if a value is a Date
  708. *
  709. * @param {*} val The value to test
  710. *
  711. * @returns {boolean} True if value is a Date, otherwise false
  712. */
  713. var isDate = kindOfTest('Date');
  714. /**
  715. * Determine if a value is a File
  716. *
  717. * @param {*} val The value to test
  718. *
  719. * @returns {boolean} True if value is a File, otherwise false
  720. */
  721. var isFile = kindOfTest('File');
  722. /**
  723. * Determine if a value is a React Native Blob
  724. * React Native "blob": an object with a `uri` attribute. Optionally, it can
  725. * also have a `name` and `type` attribute to specify filename and content type
  726. *
  727. * @see https://github.com/facebook/react-native/blob/26684cf3adf4094eb6c405d345a75bf8c7c0bf88/Libraries/Network/FormData.js#L68-L71
  728. *
  729. * @param {*} value The value to test
  730. *
  731. * @returns {boolean} True if value is a React Native Blob, otherwise false
  732. */
  733. var isReactNativeBlob = function isReactNativeBlob(value) {
  734. return !!(value && typeof value.uri !== 'undefined');
  735. };
  736. /**
  737. * Determine if environment is React Native
  738. * ReactNative `FormData` has a non-standard `getParts()` method
  739. *
  740. * @param {*} formData The formData to test
  741. *
  742. * @returns {boolean} True if environment is React Native, otherwise false
  743. */
  744. var isReactNative = function isReactNative(formData) {
  745. return formData && typeof formData.getParts !== 'undefined';
  746. };
  747. /**
  748. * Determine if a value is a Blob
  749. *
  750. * @param {*} val The value to test
  751. *
  752. * @returns {boolean} True if value is a Blob, otherwise false
  753. */
  754. var isBlob = kindOfTest('Blob');
  755. /**
  756. * Determine if a value is a FileList
  757. *
  758. * @param {*} val The value to test
  759. *
  760. * @returns {boolean} True if value is a File, otherwise false
  761. */
  762. var isFileList = kindOfTest('FileList');
  763. /**
  764. * Determine if a value is a Stream
  765. *
  766. * @param {*} val The value to test
  767. *
  768. * @returns {boolean} True if value is a Stream, otherwise false
  769. */
  770. var isStream = function isStream(val) {
  771. return isObject(val) && isFunction$1(val.pipe);
  772. };
  773. /**
  774. * Determine if a value is a FormData
  775. *
  776. * @param {*} thing The value to test
  777. *
  778. * @returns {boolean} True if value is an FormData, otherwise false
  779. */
  780. function getGlobal() {
  781. if (typeof globalThis !== 'undefined') return globalThis;
  782. if (typeof self !== 'undefined') return self;
  783. if (typeof window !== 'undefined') return window;
  784. if (typeof global !== 'undefined') return global;
  785. return {};
  786. }
  787. var G = getGlobal();
  788. var FormDataCtor = typeof G.FormData !== 'undefined' ? G.FormData : undefined;
  789. var isFormData = function isFormData(thing) {
  790. if (!thing) return false;
  791. if (FormDataCtor && thing instanceof FormDataCtor) return true;
  792. // Reject plain objects inheriting directly from Object.prototype so prototype-pollution gadgets can't spoof FormData (GHSA-6chq-wfr3-2hj9).
  793. var proto = getPrototypeOf(thing);
  794. if (!proto || proto === Object.prototype) return false;
  795. if (!isFunction$1(thing.append)) return false;
  796. var kind = kindOf(thing);
  797. return kind === 'formdata' ||
  798. // detect form-data instance
  799. kind === 'object' && isFunction$1(thing.toString) && thing.toString() === '[object FormData]';
  800. };
  801. /**
  802. * Determine if a value is a URLSearchParams object
  803. *
  804. * @param {*} val The value to test
  805. *
  806. * @returns {boolean} True if value is a URLSearchParams object, otherwise false
  807. */
  808. var isURLSearchParams = kindOfTest('URLSearchParams');
  809. var _map = ['ReadableStream', 'Request', 'Response', 'Headers'].map(kindOfTest),
  810. _map2 = _slicedToArray(_map, 4),
  811. isReadableStream = _map2[0],
  812. isRequest = _map2[1],
  813. isResponse = _map2[2],
  814. isHeaders = _map2[3];
  815. /**
  816. * Trim excess whitespace off the beginning and end of a string
  817. *
  818. * @param {String} str The String to trim
  819. *
  820. * @returns {String} The String freed of excess whitespace
  821. */
  822. var trim = function trim(str) {
  823. return str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
  824. };
  825. /**
  826. * Iterate over an Array or an Object invoking a function for each item.
  827. *
  828. * If `obj` is an Array callback will be called passing
  829. * the value, index, and complete array for each item.
  830. *
  831. * If 'obj' is an Object callback will be called passing
  832. * the value, key, and complete object for each property.
  833. *
  834. * @param {Object|Array<unknown>} obj The object to iterate
  835. * @param {Function} fn The callback to invoke for each item
  836. *
  837. * @param {Object} [options]
  838. * @param {Boolean} [options.allOwnKeys = false]
  839. * @returns {any}
  840. */
  841. function forEach(obj, fn) {
  842. var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
  843. _ref$allOwnKeys = _ref.allOwnKeys,
  844. allOwnKeys = _ref$allOwnKeys === void 0 ? false : _ref$allOwnKeys;
  845. // Don't bother if no value provided
  846. if (obj === null || typeof obj === 'undefined') {
  847. return;
  848. }
  849. var i;
  850. var l;
  851. // Force an array if not already something iterable
  852. if (_typeof(obj) !== 'object') {
  853. /*eslint no-param-reassign:0*/
  854. obj = [obj];
  855. }
  856. if (isArray(obj)) {
  857. // Iterate over array values
  858. for (i = 0, l = obj.length; i < l; i++) {
  859. fn.call(null, obj[i], i, obj);
  860. }
  861. } else {
  862. // Buffer check
  863. if (isBuffer(obj)) {
  864. return;
  865. }
  866. // Iterate over object keys
  867. var keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
  868. var len = keys.length;
  869. var key;
  870. for (i = 0; i < len; i++) {
  871. key = keys[i];
  872. fn.call(null, obj[key], key, obj);
  873. }
  874. }
  875. }
  876. /**
  877. * Finds a key in an object, case-insensitive, returning the actual key name.
  878. * Returns null if the object is a Buffer or if no match is found.
  879. *
  880. * @param {Object} obj - The object to search.
  881. * @param {string} key - The key to find (case-insensitive).
  882. * @returns {?string} The actual key name if found, otherwise null.
  883. */
  884. function findKey(obj, key) {
  885. if (isBuffer(obj)) {
  886. return null;
  887. }
  888. key = key.toLowerCase();
  889. var keys = Object.keys(obj);
  890. var i = keys.length;
  891. var _key;
  892. while (i-- > 0) {
  893. _key = keys[i];
  894. if (key === _key.toLowerCase()) {
  895. return _key;
  896. }
  897. }
  898. return null;
  899. }
  900. var _global = function () {
  901. /*eslint no-undef:0*/
  902. if (typeof globalThis !== 'undefined') return globalThis;
  903. return typeof self !== 'undefined' ? self : typeof window !== 'undefined' ? window : global;
  904. }();
  905. var isContextDefined = function isContextDefined(context) {
  906. return !isUndefined(context) && context !== _global;
  907. };
  908. /**
  909. * Accepts varargs expecting each argument to be an object, then
  910. * immutably merges the properties of each object and returns result.
  911. *
  912. * When multiple objects contain the same key the later object in
  913. * the arguments list will take precedence.
  914. *
  915. * Example:
  916. *
  917. * ```js
  918. * const result = merge({foo: 123}, {foo: 456});
  919. * console.log(result.foo); // outputs 456
  920. * ```
  921. *
  922. * @param {Object} obj1 Object to merge
  923. *
  924. * @returns {Object} Result of all merge properties
  925. */
  926. function merge(/* obj1, obj2, obj3, ... */
  927. ) {
  928. var _ref2 = isContextDefined(this) && this || {},
  929. caseless = _ref2.caseless,
  930. skipUndefined = _ref2.skipUndefined;
  931. var result = {};
  932. var assignValue = function assignValue(val, key) {
  933. // Skip dangerous property names to prevent prototype pollution
  934. if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
  935. return;
  936. }
  937. var targetKey = caseless && findKey(result, key) || key;
  938. if (isPlainObject(result[targetKey]) && isPlainObject(val)) {
  939. result[targetKey] = merge(result[targetKey], val);
  940. } else if (isPlainObject(val)) {
  941. result[targetKey] = merge({}, val);
  942. } else if (isArray(val)) {
  943. result[targetKey] = val.slice();
  944. } else if (!skipUndefined || !isUndefined(val)) {
  945. result[targetKey] = val;
  946. }
  947. };
  948. for (var i = 0, l = arguments.length; i < l; i++) {
  949. arguments[i] && forEach(arguments[i], assignValue);
  950. }
  951. return result;
  952. }
  953. /**
  954. * Extends object a by mutably adding to it the properties of object b.
  955. *
  956. * @param {Object} a The object to be extended
  957. * @param {Object} b The object to copy properties from
  958. * @param {Object} thisArg The object to bind function to
  959. *
  960. * @param {Object} [options]
  961. * @param {Boolean} [options.allOwnKeys]
  962. * @returns {Object} The resulting value of object a
  963. */
  964. var extend = function extend(a, b, thisArg) {
  965. var _ref3 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {},
  966. allOwnKeys = _ref3.allOwnKeys;
  967. forEach(b, function (val, key) {
  968. if (thisArg && isFunction$1(val)) {
  969. Object.defineProperty(a, key, {
  970. value: bind(val, thisArg),
  971. writable: true,
  972. enumerable: true,
  973. configurable: true
  974. });
  975. } else {
  976. Object.defineProperty(a, key, {
  977. value: val,
  978. writable: true,
  979. enumerable: true,
  980. configurable: true
  981. });
  982. }
  983. }, {
  984. allOwnKeys: allOwnKeys
  985. });
  986. return a;
  987. };
  988. /**
  989. * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
  990. *
  991. * @param {string} content with BOM
  992. *
  993. * @returns {string} content value without BOM
  994. */
  995. var stripBOM = function stripBOM(content) {
  996. if (content.charCodeAt(0) === 0xfeff) {
  997. content = content.slice(1);
  998. }
  999. return content;
  1000. };
  1001. /**
  1002. * Inherit the prototype methods from one constructor into another
  1003. * @param {function} constructor
  1004. * @param {function} superConstructor
  1005. * @param {object} [props]
  1006. * @param {object} [descriptors]
  1007. *
  1008. * @returns {void}
  1009. */
  1010. var inherits = function inherits(constructor, superConstructor, props, descriptors) {
  1011. constructor.prototype = Object.create(superConstructor.prototype, descriptors);
  1012. Object.defineProperty(constructor.prototype, 'constructor', {
  1013. value: constructor,
  1014. writable: true,
  1015. enumerable: false,
  1016. configurable: true
  1017. });
  1018. Object.defineProperty(constructor, 'super', {
  1019. value: superConstructor.prototype
  1020. });
  1021. props && Object.assign(constructor.prototype, props);
  1022. };
  1023. /**
  1024. * Resolve object with deep prototype chain to a flat object
  1025. * @param {Object} sourceObj source object
  1026. * @param {Object} [destObj]
  1027. * @param {Function|Boolean} [filter]
  1028. * @param {Function} [propFilter]
  1029. *
  1030. * @returns {Object}
  1031. */
  1032. var toFlatObject = function toFlatObject(sourceObj, destObj, filter, propFilter) {
  1033. var props;
  1034. var i;
  1035. var prop;
  1036. var merged = {};
  1037. destObj = destObj || {};
  1038. // eslint-disable-next-line no-eq-null,eqeqeq
  1039. if (sourceObj == null) return destObj;
  1040. do {
  1041. props = Object.getOwnPropertyNames(sourceObj);
  1042. i = props.length;
  1043. while (i-- > 0) {
  1044. prop = props[i];
  1045. if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
  1046. destObj[prop] = sourceObj[prop];
  1047. merged[prop] = true;
  1048. }
  1049. }
  1050. sourceObj = filter !== false && getPrototypeOf(sourceObj);
  1051. } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);
  1052. return destObj;
  1053. };
  1054. /**
  1055. * Determines whether a string ends with the characters of a specified string
  1056. *
  1057. * @param {String} str
  1058. * @param {String} searchString
  1059. * @param {Number} [position= 0]
  1060. *
  1061. * @returns {boolean}
  1062. */
  1063. var endsWith = function endsWith(str, searchString, position) {
  1064. str = String(str);
  1065. if (position === undefined || position > str.length) {
  1066. position = str.length;
  1067. }
  1068. position -= searchString.length;
  1069. var lastIndex = str.indexOf(searchString, position);
  1070. return lastIndex !== -1 && lastIndex === position;
  1071. };
  1072. /**
  1073. * Returns new array from array like object or null if failed
  1074. *
  1075. * @param {*} [thing]
  1076. *
  1077. * @returns {?Array}
  1078. */
  1079. var toArray = function toArray(thing) {
  1080. if (!thing) return null;
  1081. if (isArray(thing)) return thing;
  1082. var i = thing.length;
  1083. if (!isNumber(i)) return null;
  1084. var arr = new Array(i);
  1085. while (i-- > 0) {
  1086. arr[i] = thing[i];
  1087. }
  1088. return arr;
  1089. };
  1090. /**
  1091. * Checking if the Uint8Array exists and if it does, it returns a function that checks if the
  1092. * thing passed in is an instance of Uint8Array
  1093. *
  1094. * @param {TypedArray}
  1095. *
  1096. * @returns {Array}
  1097. */
  1098. // eslint-disable-next-line func-names
  1099. var isTypedArray = function (TypedArray) {
  1100. // eslint-disable-next-line func-names
  1101. return function (thing) {
  1102. return TypedArray && thing instanceof TypedArray;
  1103. };
  1104. }(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array));
  1105. /**
  1106. * For each entry in the object, call the function with the key and value.
  1107. *
  1108. * @param {Object<any, any>} obj - The object to iterate over.
  1109. * @param {Function} fn - The function to call for each entry.
  1110. *
  1111. * @returns {void}
  1112. */
  1113. var forEachEntry = function forEachEntry(obj, fn) {
  1114. var generator = obj && obj[iterator];
  1115. var _iterator = generator.call(obj);
  1116. var result;
  1117. while ((result = _iterator.next()) && !result.done) {
  1118. var pair = result.value;
  1119. fn.call(obj, pair[0], pair[1]);
  1120. }
  1121. };
  1122. /**
  1123. * It takes a regular expression and a string, and returns an array of all the matches
  1124. *
  1125. * @param {string} regExp - The regular expression to match against.
  1126. * @param {string} str - The string to search.
  1127. *
  1128. * @returns {Array<boolean>}
  1129. */
  1130. var matchAll = function matchAll(regExp, str) {
  1131. var matches;
  1132. var arr = [];
  1133. while ((matches = regExp.exec(str)) !== null) {
  1134. arr.push(matches);
  1135. }
  1136. return arr;
  1137. };
  1138. /* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */
  1139. var isHTMLForm = kindOfTest('HTMLFormElement');
  1140. var toCamelCase = function toCamelCase(str) {
  1141. return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g, function replacer(m, p1, p2) {
  1142. return p1.toUpperCase() + p2;
  1143. });
  1144. };
  1145. /* Creating a function that will check if an object has a property. */
  1146. var hasOwnProperty = function (_ref4) {
  1147. var hasOwnProperty = _ref4.hasOwnProperty;
  1148. return function (obj, prop) {
  1149. return hasOwnProperty.call(obj, prop);
  1150. };
  1151. }(Object.prototype);
  1152. /**
  1153. * Determine if a value is a RegExp object
  1154. *
  1155. * @param {*} val The value to test
  1156. *
  1157. * @returns {boolean} True if value is a RegExp object, otherwise false
  1158. */
  1159. var isRegExp = kindOfTest('RegExp');
  1160. var reduceDescriptors = function reduceDescriptors(obj, reducer) {
  1161. var descriptors = Object.getOwnPropertyDescriptors(obj);
  1162. var reducedDescriptors = {};
  1163. forEach(descriptors, function (descriptor, name) {
  1164. var ret;
  1165. if ((ret = reducer(descriptor, name, obj)) !== false) {
  1166. reducedDescriptors[name] = ret || descriptor;
  1167. }
  1168. });
  1169. Object.defineProperties(obj, reducedDescriptors);
  1170. };
  1171. /**
  1172. * Makes all methods read-only
  1173. * @param {Object} obj
  1174. */
  1175. var freezeMethods = function freezeMethods(obj) {
  1176. reduceDescriptors(obj, function (descriptor, name) {
  1177. // skip restricted props in strict mode
  1178. if (isFunction$1(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
  1179. return false;
  1180. }
  1181. var value = obj[name];
  1182. if (!isFunction$1(value)) return;
  1183. descriptor.enumerable = false;
  1184. if ('writable' in descriptor) {
  1185. descriptor.writable = false;
  1186. return;
  1187. }
  1188. if (!descriptor.set) {
  1189. descriptor.set = function () {
  1190. throw Error("Can not rewrite read-only method '" + name + "'");
  1191. };
  1192. }
  1193. });
  1194. };
  1195. /**
  1196. * Converts an array or a delimited string into an object set with values as keys and true as values.
  1197. * Useful for fast membership checks.
  1198. *
  1199. * @param {Array|string} arrayOrString - The array or string to convert.
  1200. * @param {string} delimiter - The delimiter to use if input is a string.
  1201. * @returns {Object} An object with keys from the array or string, values set to true.
  1202. */
  1203. var toObjectSet = function toObjectSet(arrayOrString, delimiter) {
  1204. var obj = {};
  1205. var define = function define(arr) {
  1206. arr.forEach(function (value) {
  1207. obj[value] = true;
  1208. });
  1209. };
  1210. isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));
  1211. return obj;
  1212. };
  1213. var noop = function noop() {};
  1214. var toFiniteNumber = function toFiniteNumber(value, defaultValue) {
  1215. return value != null && Number.isFinite(value = +value) ? value : defaultValue;
  1216. };
  1217. /**
  1218. * If the thing is a FormData object, return true, otherwise return false.
  1219. *
  1220. * @param {unknown} thing - The thing to check.
  1221. *
  1222. * @returns {boolean}
  1223. */
  1224. function isSpecCompliantForm(thing) {
  1225. return !!(thing && isFunction$1(thing.append) && thing[toStringTag] === 'FormData' && thing[iterator]);
  1226. }
  1227. /**
  1228. * Recursively converts an object to a JSON-compatible object, handling circular references and Buffers.
  1229. *
  1230. * @param {Object} obj - The object to convert.
  1231. * @returns {Object} The JSON-compatible object.
  1232. */
  1233. var toJSONObject = function toJSONObject(obj) {
  1234. var stack = new Array(10);
  1235. var _visit = function visit(source, i) {
  1236. if (isObject(source)) {
  1237. if (stack.indexOf(source) >= 0) {
  1238. return;
  1239. }
  1240. //Buffer check
  1241. if (isBuffer(source)) {
  1242. return source;
  1243. }
  1244. if (!('toJSON' in source)) {
  1245. stack[i] = source;
  1246. var target = isArray(source) ? [] : {};
  1247. forEach(source, function (value, key) {
  1248. var reducedValue = _visit(value, i + 1);
  1249. !isUndefined(reducedValue) && (target[key] = reducedValue);
  1250. });
  1251. stack[i] = undefined;
  1252. return target;
  1253. }
  1254. }
  1255. return source;
  1256. };
  1257. return _visit(obj, 0);
  1258. };
  1259. /**
  1260. * Determines if a value is an async function.
  1261. *
  1262. * @param {*} thing - The value to test.
  1263. * @returns {boolean} True if value is an async function, otherwise false.
  1264. */
  1265. var isAsyncFn = kindOfTest('AsyncFunction');
  1266. /**
  1267. * Determines if a value is thenable (has then and catch methods).
  1268. *
  1269. * @param {*} thing - The value to test.
  1270. * @returns {boolean} True if value is thenable, otherwise false.
  1271. */
  1272. var isThenable = function isThenable(thing) {
  1273. return thing && (isObject(thing) || isFunction$1(thing)) && isFunction$1(thing.then) && isFunction$1(thing["catch"]);
  1274. };
  1275. // original code
  1276. // https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34
  1277. /**
  1278. * Provides a cross-platform setImmediate implementation.
  1279. * Uses native setImmediate if available, otherwise falls back to postMessage or setTimeout.
  1280. *
  1281. * @param {boolean} setImmediateSupported - Whether setImmediate is supported.
  1282. * @param {boolean} postMessageSupported - Whether postMessage is supported.
  1283. * @returns {Function} A function to schedule a callback asynchronously.
  1284. */
  1285. var _setImmediate = function (setImmediateSupported, postMessageSupported) {
  1286. if (setImmediateSupported) {
  1287. return setImmediate;
  1288. }
  1289. return postMessageSupported ? function (token, callbacks) {
  1290. _global.addEventListener('message', function (_ref5) {
  1291. var source = _ref5.source,
  1292. data = _ref5.data;
  1293. if (source === _global && data === token) {
  1294. callbacks.length && callbacks.shift()();
  1295. }
  1296. }, false);
  1297. return function (cb) {
  1298. callbacks.push(cb);
  1299. _global.postMessage(token, '*');
  1300. };
  1301. }("axios@".concat(Math.random()), []) : function (cb) {
  1302. return setTimeout(cb);
  1303. };
  1304. }(typeof setImmediate === 'function', isFunction$1(_global.postMessage));
  1305. /**
  1306. * Schedules a microtask or asynchronous callback as soon as possible.
  1307. * Uses queueMicrotask if available, otherwise falls back to process.nextTick or _setImmediate.
  1308. *
  1309. * @type {Function}
  1310. */
  1311. var asap = typeof queueMicrotask !== 'undefined' ? queueMicrotask.bind(_global) : typeof process !== 'undefined' && process.nextTick || _setImmediate;
  1312. // *********************
  1313. var isIterable = function isIterable(thing) {
  1314. return thing != null && isFunction$1(thing[iterator]);
  1315. };
  1316. var utils$1 = {
  1317. isArray: isArray,
  1318. isArrayBuffer: isArrayBuffer,
  1319. isBuffer: isBuffer,
  1320. isFormData: isFormData,
  1321. isArrayBufferView: isArrayBufferView,
  1322. isString: isString,
  1323. isNumber: isNumber,
  1324. isBoolean: isBoolean,
  1325. isObject: isObject,
  1326. isPlainObject: isPlainObject,
  1327. isEmptyObject: isEmptyObject,
  1328. isReadableStream: isReadableStream,
  1329. isRequest: isRequest,
  1330. isResponse: isResponse,
  1331. isHeaders: isHeaders,
  1332. isUndefined: isUndefined,
  1333. isDate: isDate,
  1334. isFile: isFile,
  1335. isReactNativeBlob: isReactNativeBlob,
  1336. isReactNative: isReactNative,
  1337. isBlob: isBlob,
  1338. isRegExp: isRegExp,
  1339. isFunction: isFunction$1,
  1340. isStream: isStream,
  1341. isURLSearchParams: isURLSearchParams,
  1342. isTypedArray: isTypedArray,
  1343. isFileList: isFileList,
  1344. forEach: forEach,
  1345. merge: merge,
  1346. extend: extend,
  1347. trim: trim,
  1348. stripBOM: stripBOM,
  1349. inherits: inherits,
  1350. toFlatObject: toFlatObject,
  1351. kindOf: kindOf,
  1352. kindOfTest: kindOfTest,
  1353. endsWith: endsWith,
  1354. toArray: toArray,
  1355. forEachEntry: forEachEntry,
  1356. matchAll: matchAll,
  1357. isHTMLForm: isHTMLForm,
  1358. hasOwnProperty: hasOwnProperty,
  1359. hasOwnProp: hasOwnProperty,
  1360. // an alias to avoid ESLint no-prototype-builtins detection
  1361. reduceDescriptors: reduceDescriptors,
  1362. freezeMethods: freezeMethods,
  1363. toObjectSet: toObjectSet,
  1364. toCamelCase: toCamelCase,
  1365. noop: noop,
  1366. toFiniteNumber: toFiniteNumber,
  1367. findKey: findKey,
  1368. global: _global,
  1369. isContextDefined: isContextDefined,
  1370. isSpecCompliantForm: isSpecCompliantForm,
  1371. toJSONObject: toJSONObject,
  1372. isAsyncFn: isAsyncFn,
  1373. isThenable: isThenable,
  1374. setImmediate: _setImmediate,
  1375. asap: asap,
  1376. isIterable: isIterable
  1377. };
  1378. var AxiosError = /*#__PURE__*/function (_Error) {
  1379. /**
  1380. * Create an Error with the specified message, config, error code, request and response.
  1381. *
  1382. * @param {string} message The error message.
  1383. * @param {string} [code] The error code (for example, 'ECONNABORTED').
  1384. * @param {Object} [config] The config.
  1385. * @param {Object} [request] The request.
  1386. * @param {Object} [response] The response.
  1387. *
  1388. * @returns {Error} The created error.
  1389. */
  1390. function AxiosError(message, code, config, request, response) {
  1391. var _this;
  1392. _classCallCheck(this, AxiosError);
  1393. _this = _callSuper(this, AxiosError, [message]);
  1394. // Make message enumerable to maintain backward compatibility
  1395. // The native Error constructor sets message as non-enumerable,
  1396. // but axios < v1.13.3 had it as enumerable
  1397. Object.defineProperty(_this, 'message', {
  1398. value: message,
  1399. enumerable: true,
  1400. writable: true,
  1401. configurable: true
  1402. });
  1403. _this.name = 'AxiosError';
  1404. _this.isAxiosError = true;
  1405. code && (_this.code = code);
  1406. config && (_this.config = config);
  1407. request && (_this.request = request);
  1408. if (response) {
  1409. _this.response = response;
  1410. _this.status = response.status;
  1411. }
  1412. return _this;
  1413. }
  1414. _inherits(AxiosError, _Error);
  1415. return _createClass(AxiosError, [{
  1416. key: "toJSON",
  1417. value: function toJSON() {
  1418. return {
  1419. // Standard
  1420. message: this.message,
  1421. name: this.name,
  1422. // Microsoft
  1423. description: this.description,
  1424. number: this.number,
  1425. // Mozilla
  1426. fileName: this.fileName,
  1427. lineNumber: this.lineNumber,
  1428. columnNumber: this.columnNumber,
  1429. stack: this.stack,
  1430. // Axios
  1431. config: utils$1.toJSONObject(this.config),
  1432. code: this.code,
  1433. status: this.status
  1434. };
  1435. }
  1436. }], [{
  1437. key: "from",
  1438. value: function from(error, code, config, request, response, customProps) {
  1439. var axiosError = new AxiosError(error.message, code || error.code, config, request, response);
  1440. axiosError.cause = error;
  1441. axiosError.name = error.name;
  1442. // Preserve status from the original error if not already set from response
  1443. if (error.status != null && axiosError.status == null) {
  1444. axiosError.status = error.status;
  1445. }
  1446. customProps && Object.assign(axiosError, customProps);
  1447. return axiosError;
  1448. }
  1449. }]);
  1450. }(/*#__PURE__*/_wrapNativeSuper(Error)); // This can be changed to static properties as soon as the parser options in .eslint.cjs are updated.
  1451. AxiosError.ERR_BAD_OPTION_VALUE = 'ERR_BAD_OPTION_VALUE';
  1452. AxiosError.ERR_BAD_OPTION = 'ERR_BAD_OPTION';
  1453. AxiosError.ECONNABORTED = 'ECONNABORTED';
  1454. AxiosError.ETIMEDOUT = 'ETIMEDOUT';
  1455. AxiosError.ERR_NETWORK = 'ERR_NETWORK';
  1456. AxiosError.ERR_FR_TOO_MANY_REDIRECTS = 'ERR_FR_TOO_MANY_REDIRECTS';
  1457. AxiosError.ERR_DEPRECATED = 'ERR_DEPRECATED';
  1458. AxiosError.ERR_BAD_RESPONSE = 'ERR_BAD_RESPONSE';
  1459. AxiosError.ERR_BAD_REQUEST = 'ERR_BAD_REQUEST';
  1460. AxiosError.ERR_CANCELED = 'ERR_CANCELED';
  1461. AxiosError.ERR_NOT_SUPPORT = 'ERR_NOT_SUPPORT';
  1462. AxiosError.ERR_INVALID_URL = 'ERR_INVALID_URL';
  1463. AxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED = 'ERR_FORM_DATA_DEPTH_EXCEEDED';
  1464. // eslint-disable-next-line strict
  1465. var httpAdapter = null;
  1466. /**
  1467. * Determines if the given thing is a array or js object.
  1468. *
  1469. * @param {string} thing - The object or array to be visited.
  1470. *
  1471. * @returns {boolean}
  1472. */
  1473. function isVisitable(thing) {
  1474. return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
  1475. }
  1476. /**
  1477. * It removes the brackets from the end of a string
  1478. *
  1479. * @param {string} key - The key of the parameter.
  1480. *
  1481. * @returns {string} the key without the brackets.
  1482. */
  1483. function removeBrackets(key) {
  1484. return utils$1.endsWith(key, '[]') ? key.slice(0, -2) : key;
  1485. }
  1486. /**
  1487. * It takes a path, a key, and a boolean, and returns a string
  1488. *
  1489. * @param {string} path - The path to the current key.
  1490. * @param {string} key - The key of the current object being iterated over.
  1491. * @param {string} dots - If true, the key will be rendered with dots instead of brackets.
  1492. *
  1493. * @returns {string} The path to the current key.
  1494. */
  1495. function renderKey(path, key, dots) {
  1496. if (!path) return key;
  1497. return path.concat(key).map(function each(token, i) {
  1498. // eslint-disable-next-line no-param-reassign
  1499. token = removeBrackets(token);
  1500. return !dots && i ? '[' + token + ']' : token;
  1501. }).join(dots ? '.' : '');
  1502. }
  1503. /**
  1504. * If the array is an array and none of its elements are visitable, then it's a flat array.
  1505. *
  1506. * @param {Array<any>} arr - The array to check
  1507. *
  1508. * @returns {boolean}
  1509. */
  1510. function isFlatArray(arr) {
  1511. return utils$1.isArray(arr) && !arr.some(isVisitable);
  1512. }
  1513. var predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) {
  1514. return /^is[A-Z]/.test(prop);
  1515. });
  1516. /**
  1517. * Convert a data object to FormData
  1518. *
  1519. * @param {Object} obj
  1520. * @param {?Object} [formData]
  1521. * @param {?Object} [options]
  1522. * @param {Function} [options.visitor]
  1523. * @param {Boolean} [options.metaTokens = true]
  1524. * @param {Boolean} [options.dots = false]
  1525. * @param {?Boolean} [options.indexes = false]
  1526. *
  1527. * @returns {Object}
  1528. **/
  1529. /**
  1530. * It converts an object into a FormData object
  1531. *
  1532. * @param {Object<any, any>} obj - The object to convert to form data.
  1533. * @param {string} formData - The FormData object to append to.
  1534. * @param {Object<string, any>} options
  1535. *
  1536. * @returns
  1537. */
  1538. function toFormData(obj, formData, options) {
  1539. if (!utils$1.isObject(obj)) {
  1540. throw new TypeError('target must be an object');
  1541. }
  1542. // eslint-disable-next-line no-param-reassign
  1543. formData = formData || new (FormData)();
  1544. // eslint-disable-next-line no-param-reassign
  1545. options = utils$1.toFlatObject(options, {
  1546. metaTokens: true,
  1547. dots: false,
  1548. indexes: false
  1549. }, false, function defined(option, source) {
  1550. // eslint-disable-next-line no-eq-null,eqeqeq
  1551. return !utils$1.isUndefined(source[option]);
  1552. });
  1553. var metaTokens = options.metaTokens;
  1554. // eslint-disable-next-line no-use-before-define
  1555. var visitor = options.visitor || defaultVisitor;
  1556. var dots = options.dots;
  1557. var indexes = options.indexes;
  1558. var _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
  1559. var maxDepth = options.maxDepth === undefined ? 100 : options.maxDepth;
  1560. var useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
  1561. if (!utils$1.isFunction(visitor)) {
  1562. throw new TypeError('visitor must be a function');
  1563. }
  1564. function convertValue(value) {
  1565. if (value === null) return '';
  1566. if (utils$1.isDate(value)) {
  1567. return value.toISOString();
  1568. }
  1569. if (utils$1.isBoolean(value)) {
  1570. return value.toString();
  1571. }
  1572. if (!useBlob && utils$1.isBlob(value)) {
  1573. throw new AxiosError('Blob is not supported. Use a Buffer instead.');
  1574. }
  1575. if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
  1576. return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
  1577. }
  1578. return value;
  1579. }
  1580. /**
  1581. * Default visitor.
  1582. *
  1583. * @param {*} value
  1584. * @param {String|Number} key
  1585. * @param {Array<String|Number>} path
  1586. * @this {FormData}
  1587. *
  1588. * @returns {boolean} return true to visit the each prop of the value recursively
  1589. */
  1590. function defaultVisitor(value, key, path) {
  1591. var arr = value;
  1592. if (utils$1.isReactNative(formData) && utils$1.isReactNativeBlob(value)) {
  1593. formData.append(renderKey(path, key, dots), convertValue(value));
  1594. return false;
  1595. }
  1596. if (value && !path && _typeof(value) === 'object') {
  1597. if (utils$1.endsWith(key, '{}')) {
  1598. // eslint-disable-next-line no-param-reassign
  1599. key = metaTokens ? key : key.slice(0, -2);
  1600. // eslint-disable-next-line no-param-reassign
  1601. value = JSON.stringify(value);
  1602. } else if (utils$1.isArray(value) && isFlatArray(value) || (utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value))) {
  1603. // eslint-disable-next-line no-param-reassign
  1604. key = removeBrackets(key);
  1605. arr.forEach(function each(el, index) {
  1606. !(utils$1.isUndefined(el) || el === null) && formData.append(
  1607. // eslint-disable-next-line no-nested-ternary
  1608. indexes === true ? renderKey([key], index, dots) : indexes === null ? key : key + '[]', convertValue(el));
  1609. });
  1610. return false;
  1611. }
  1612. }
  1613. if (isVisitable(value)) {
  1614. return true;
  1615. }
  1616. formData.append(renderKey(path, key, dots), convertValue(value));
  1617. return false;
  1618. }
  1619. var stack = [];
  1620. var exposedHelpers = Object.assign(predicates, {
  1621. defaultVisitor: defaultVisitor,
  1622. convertValue: convertValue,
  1623. isVisitable: isVisitable
  1624. });
  1625. function build(value, path) {
  1626. var depth = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  1627. if (utils$1.isUndefined(value)) return;
  1628. if (depth > maxDepth) {
  1629. throw new AxiosError('Object is too deeply nested (' + depth + ' levels). Max depth: ' + maxDepth, AxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED);
  1630. }
  1631. if (stack.indexOf(value) !== -1) {
  1632. throw Error('Circular reference detected in ' + path.join('.'));
  1633. }
  1634. stack.push(value);
  1635. utils$1.forEach(value, function each(el, key) {
  1636. var result = !(utils$1.isUndefined(el) || el === null) && visitor.call(formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers);
  1637. if (result === true) {
  1638. build(el, path ? path.concat(key) : [key], depth + 1);
  1639. }
  1640. });
  1641. stack.pop();
  1642. }
  1643. if (!utils$1.isObject(obj)) {
  1644. throw new TypeError('data must be an object');
  1645. }
  1646. build(obj);
  1647. return formData;
  1648. }
  1649. /**
  1650. * It encodes a string by replacing all characters that are not in the unreserved set with
  1651. * their percent-encoded equivalents
  1652. *
  1653. * @param {string} str - The string to encode.
  1654. *
  1655. * @returns {string} The encoded string.
  1656. */
  1657. function encode$1(str) {
  1658. var charMap = {
  1659. '!': '%21',
  1660. "'": '%27',
  1661. '(': '%28',
  1662. ')': '%29',
  1663. '~': '%7E',
  1664. '%20': '+'
  1665. };
  1666. return encodeURIComponent(str).replace(/[!'()~]|%20/g, function replacer(match) {
  1667. return charMap[match];
  1668. });
  1669. }
  1670. /**
  1671. * It takes a params object and converts it to a FormData object
  1672. *
  1673. * @param {Object<string, any>} params - The parameters to be converted to a FormData object.
  1674. * @param {Object<string, any>} options - The options object passed to the Axios constructor.
  1675. *
  1676. * @returns {void}
  1677. */
  1678. function AxiosURLSearchParams(params, options) {
  1679. this._pairs = [];
  1680. params && toFormData(params, this, options);
  1681. }
  1682. var prototype = AxiosURLSearchParams.prototype;
  1683. prototype.append = function append(name, value) {
  1684. this._pairs.push([name, value]);
  1685. };
  1686. prototype.toString = function toString(encoder) {
  1687. var _encode = encoder ? function (value) {
  1688. return encoder.call(this, value, encode$1);
  1689. } : encode$1;
  1690. return this._pairs.map(function each(pair) {
  1691. return _encode(pair[0]) + '=' + _encode(pair[1]);
  1692. }, '').join('&');
  1693. };
  1694. /**
  1695. * It replaces URL-encoded forms of `:`, `$`, `,`, and spaces with
  1696. * their plain counterparts (`:`, `$`, `,`, `+`).
  1697. *
  1698. * @param {string} val The value to be encoded.
  1699. *
  1700. * @returns {string} The encoded value.
  1701. */
  1702. function encode(val) {
  1703. return encodeURIComponent(val).replace(/%3A/gi, ':').replace(/%24/g, '$').replace(/%2C/gi, ',').replace(/%20/g, '+');
  1704. }
  1705. /**
  1706. * Build a URL by appending params to the end
  1707. *
  1708. * @param {string} url The base of the url (e.g., http://www.google.com)
  1709. * @param {object} [params] The params to be appended
  1710. * @param {?(object|Function)} options
  1711. *
  1712. * @returns {string} The formatted url
  1713. */
  1714. function buildURL(url, params, options) {
  1715. if (!params) {
  1716. return url;
  1717. }
  1718. var _encode = options && options.encode || encode;
  1719. var _options = utils$1.isFunction(options) ? {
  1720. serialize: options
  1721. } : options;
  1722. var serializeFn = _options && _options.serialize;
  1723. var serializedParams;
  1724. if (serializeFn) {
  1725. serializedParams = serializeFn(params, _options);
  1726. } else {
  1727. serializedParams = utils$1.isURLSearchParams(params) ? params.toString() : new AxiosURLSearchParams(params, _options).toString(_encode);
  1728. }
  1729. if (serializedParams) {
  1730. var hashmarkIndex = url.indexOf('#');
  1731. if (hashmarkIndex !== -1) {
  1732. url = url.slice(0, hashmarkIndex);
  1733. }
  1734. url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
  1735. }
  1736. return url;
  1737. }
  1738. var InterceptorManager = /*#__PURE__*/function () {
  1739. function InterceptorManager() {
  1740. _classCallCheck(this, InterceptorManager);
  1741. this.handlers = [];
  1742. }
  1743. /**
  1744. * Add a new interceptor to the stack
  1745. *
  1746. * @param {Function} fulfilled The function to handle `then` for a `Promise`
  1747. * @param {Function} rejected The function to handle `reject` for a `Promise`
  1748. * @param {Object} options The options for the interceptor, synchronous and runWhen
  1749. *
  1750. * @return {Number} An ID used to remove interceptor later
  1751. */
  1752. return _createClass(InterceptorManager, [{
  1753. key: "use",
  1754. value: function use(fulfilled, rejected, options) {
  1755. this.handlers.push({
  1756. fulfilled: fulfilled,
  1757. rejected: rejected,
  1758. synchronous: options ? options.synchronous : false,
  1759. runWhen: options ? options.runWhen : null
  1760. });
  1761. return this.handlers.length - 1;
  1762. }
  1763. /**
  1764. * Remove an interceptor from the stack
  1765. *
  1766. * @param {Number} id The ID that was returned by `use`
  1767. *
  1768. * @returns {void}
  1769. */
  1770. }, {
  1771. key: "eject",
  1772. value: function eject(id) {
  1773. if (this.handlers[id]) {
  1774. this.handlers[id] = null;
  1775. }
  1776. }
  1777. /**
  1778. * Clear all interceptors from the stack
  1779. *
  1780. * @returns {void}
  1781. */
  1782. }, {
  1783. key: "clear",
  1784. value: function clear() {
  1785. if (this.handlers) {
  1786. this.handlers = [];
  1787. }
  1788. }
  1789. /**
  1790. * Iterate over all the registered interceptors
  1791. *
  1792. * This method is particularly useful for skipping over any
  1793. * interceptors that may have become `null` calling `eject`.
  1794. *
  1795. * @param {Function} fn The function to call for each interceptor
  1796. *
  1797. * @returns {void}
  1798. */
  1799. }, {
  1800. key: "forEach",
  1801. value: function forEach(fn) {
  1802. utils$1.forEach(this.handlers, function forEachHandler(h) {
  1803. if (h !== null) {
  1804. fn(h);
  1805. }
  1806. });
  1807. }
  1808. }]);
  1809. }();
  1810. var transitionalDefaults = {
  1811. silentJSONParsing: true,
  1812. forcedJSONParsing: true,
  1813. clarifyTimeoutError: false,
  1814. legacyInterceptorReqResOrdering: true
  1815. };
  1816. var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
  1817. var FormData$1 = typeof FormData !== 'undefined' ? FormData : null;
  1818. var Blob$1 = typeof Blob !== 'undefined' ? Blob : null;
  1819. var platform$1 = {
  1820. isBrowser: true,
  1821. classes: {
  1822. URLSearchParams: URLSearchParams$1,
  1823. FormData: FormData$1,
  1824. Blob: Blob$1
  1825. },
  1826. protocols: ['http', 'https', 'file', 'blob', 'url', 'data']
  1827. };
  1828. var hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
  1829. var _navigator = (typeof navigator === "undefined" ? "undefined" : _typeof(navigator)) === 'object' && navigator || undefined;
  1830. /**
  1831. * Determine if we're running in a standard browser environment
  1832. *
  1833. * This allows axios to run in a web worker, and react-native.
  1834. * Both environments support XMLHttpRequest, but not fully standard globals.
  1835. *
  1836. * web workers:
  1837. * typeof window -> undefined
  1838. * typeof document -> undefined
  1839. *
  1840. * react-native:
  1841. * navigator.product -> 'ReactNative'
  1842. * nativescript
  1843. * navigator.product -> 'NativeScript' or 'NS'
  1844. *
  1845. * @returns {boolean}
  1846. */
  1847. var hasStandardBrowserEnv = hasBrowserEnv && (!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);
  1848. /**
  1849. * Determine if we're running in a standard browser webWorker environment
  1850. *
  1851. * Although the `isStandardBrowserEnv` method indicates that
  1852. * `allows axios to run in a web worker`, the WebWorker will still be
  1853. * filtered out due to its judgment standard
  1854. * `typeof window !== 'undefined' && typeof document !== 'undefined'`.
  1855. * This leads to a problem when axios post `FormData` in webWorker
  1856. */
  1857. var hasStandardBrowserWebWorkerEnv = function () {
  1858. return typeof WorkerGlobalScope !== 'undefined' &&
  1859. // eslint-disable-next-line no-undef
  1860. self instanceof WorkerGlobalScope && typeof self.importScripts === 'function';
  1861. }();
  1862. var origin = hasBrowserEnv && window.location.href || 'http://localhost';
  1863. var utils = /*#__PURE__*/Object.freeze({
  1864. __proto__: null,
  1865. hasBrowserEnv: hasBrowserEnv,
  1866. hasStandardBrowserEnv: hasStandardBrowserEnv,
  1867. hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
  1868. navigator: _navigator,
  1869. origin: origin
  1870. });
  1871. var platform = _objectSpread2(_objectSpread2({}, utils), platform$1);
  1872. function toURLEncodedForm(data, options) {
  1873. return toFormData(data, new platform.classes.URLSearchParams(), _objectSpread2({
  1874. visitor: function visitor(value, key, path, helpers) {
  1875. if (platform.isNode && utils$1.isBuffer(value)) {
  1876. this.append(key, value.toString('base64'));
  1877. return false;
  1878. }
  1879. return helpers.defaultVisitor.apply(this, arguments);
  1880. }
  1881. }, options));
  1882. }
  1883. /**
  1884. * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']
  1885. *
  1886. * @param {string} name - The name of the property to get.
  1887. *
  1888. * @returns An array of strings.
  1889. */
  1890. function parsePropPath(name) {
  1891. // foo[x][y][z]
  1892. // foo.x.y.z
  1893. // foo-x-y-z
  1894. // foo x y z
  1895. return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map(function (match) {
  1896. return match[0] === '[]' ? '' : match[1] || match[0];
  1897. });
  1898. }
  1899. /**
  1900. * Convert an array to an object.
  1901. *
  1902. * @param {Array<any>} arr - The array to convert to an object.
  1903. *
  1904. * @returns An object with the same keys and values as the array.
  1905. */
  1906. function arrayToObject(arr) {
  1907. var obj = {};
  1908. var keys = Object.keys(arr);
  1909. var i;
  1910. var len = keys.length;
  1911. var key;
  1912. for (i = 0; i < len; i++) {
  1913. key = keys[i];
  1914. obj[key] = arr[key];
  1915. }
  1916. return obj;
  1917. }
  1918. /**
  1919. * It takes a FormData object and returns a JavaScript object
  1920. *
  1921. * @param {string} formData The FormData object to convert to JSON.
  1922. *
  1923. * @returns {Object<string, any> | null} The converted object.
  1924. */
  1925. function formDataToJSON(formData) {
  1926. function buildPath(path, value, target, index) {
  1927. var name = path[index++];
  1928. if (name === '__proto__') return true;
  1929. var isNumericKey = Number.isFinite(+name);
  1930. var isLast = index >= path.length;
  1931. name = !name && utils$1.isArray(target) ? target.length : name;
  1932. if (isLast) {
  1933. if (utils$1.hasOwnProp(target, name)) {
  1934. target[name] = utils$1.isArray(target[name]) ? target[name].concat(value) : [target[name], value];
  1935. } else {
  1936. target[name] = value;
  1937. }
  1938. return !isNumericKey;
  1939. }
  1940. if (!target[name] || !utils$1.isObject(target[name])) {
  1941. target[name] = [];
  1942. }
  1943. var result = buildPath(path, value, target[name], index);
  1944. if (result && utils$1.isArray(target[name])) {
  1945. target[name] = arrayToObject(target[name]);
  1946. }
  1947. return !isNumericKey;
  1948. }
  1949. if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {
  1950. var obj = {};
  1951. utils$1.forEachEntry(formData, function (name, value) {
  1952. buildPath(parsePropPath(name), value, obj, 0);
  1953. });
  1954. return obj;
  1955. }
  1956. return null;
  1957. }
  1958. var own = function own(obj, key) {
  1959. return obj != null && utils$1.hasOwnProp(obj, key) ? obj[key] : undefined;
  1960. };
  1961. /**
  1962. * It takes a string, tries to parse it, and if it fails, it returns the stringified version
  1963. * of the input
  1964. *
  1965. * @param {any} rawValue - The value to be stringified.
  1966. * @param {Function} parser - A function that parses a string into a JavaScript object.
  1967. * @param {Function} encoder - A function that takes a value and returns a string.
  1968. *
  1969. * @returns {string} A stringified version of the rawValue.
  1970. */
  1971. function stringifySafely(rawValue, parser, encoder) {
  1972. if (utils$1.isString(rawValue)) {
  1973. try {
  1974. (parser || JSON.parse)(rawValue);
  1975. return utils$1.trim(rawValue);
  1976. } catch (e) {
  1977. if (e.name !== 'SyntaxError') {
  1978. throw e;
  1979. }
  1980. }
  1981. }
  1982. return (encoder || JSON.stringify)(rawValue);
  1983. }
  1984. var defaults = {
  1985. transitional: transitionalDefaults,
  1986. adapter: ['xhr', 'http', 'fetch'],
  1987. transformRequest: [function transformRequest(data, headers) {
  1988. var contentType = headers.getContentType() || '';
  1989. var hasJSONContentType = contentType.indexOf('application/json') > -1;
  1990. var isObjectPayload = utils$1.isObject(data);
  1991. if (isObjectPayload && utils$1.isHTMLForm(data)) {
  1992. data = new FormData(data);
  1993. }
  1994. var isFormData = utils$1.isFormData(data);
  1995. if (isFormData) {
  1996. return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
  1997. }
  1998. if (utils$1.isArrayBuffer(data) || utils$1.isBuffer(data) || utils$1.isStream(data) || utils$1.isFile(data) || utils$1.isBlob(data) || utils$1.isReadableStream(data)) {
  1999. return data;
  2000. }
  2001. if (utils$1.isArrayBufferView(data)) {
  2002. return data.buffer;
  2003. }
  2004. if (utils$1.isURLSearchParams(data)) {
  2005. headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
  2006. return data.toString();
  2007. }
  2008. var isFileList;
  2009. if (isObjectPayload) {
  2010. var formSerializer = own(this, 'formSerializer');
  2011. if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
  2012. return toURLEncodedForm(data, formSerializer).toString();
  2013. }
  2014. if ((isFileList = utils$1.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
  2015. var env = own(this, 'env');
  2016. var _FormData = env && env.FormData;
  2017. return toFormData(isFileList ? {
  2018. 'files[]': data
  2019. } : data, _FormData && new _FormData(), formSerializer);
  2020. }
  2021. }
  2022. if (isObjectPayload || hasJSONContentType) {
  2023. headers.setContentType('application/json', false);
  2024. return stringifySafely(data);
  2025. }
  2026. return data;
  2027. }],
  2028. transformResponse: [function transformResponse(data) {
  2029. var transitional = own(this, 'transitional') || defaults.transitional;
  2030. var forcedJSONParsing = transitional && transitional.forcedJSONParsing;
  2031. var responseType = own(this, 'responseType');
  2032. var JSONRequested = responseType === 'json';
  2033. if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
  2034. return data;
  2035. }
  2036. if (data && utils$1.isString(data) && (forcedJSONParsing && !responseType || JSONRequested)) {
  2037. var silentJSONParsing = transitional && transitional.silentJSONParsing;
  2038. var strictJSONParsing = !silentJSONParsing && JSONRequested;
  2039. try {
  2040. return JSON.parse(data, own(this, 'parseReviver'));
  2041. } catch (e) {
  2042. if (strictJSONParsing) {
  2043. if (e.name === 'SyntaxError') {
  2044. throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, own(this, 'response'));
  2045. }
  2046. throw e;
  2047. }
  2048. }
  2049. }
  2050. return data;
  2051. }],
  2052. /**
  2053. * A timeout in milliseconds to abort a request. If set to 0 (default) a
  2054. * timeout is not created.
  2055. */
  2056. timeout: 0,
  2057. xsrfCookieName: 'XSRF-TOKEN',
  2058. xsrfHeaderName: 'X-XSRF-TOKEN',
  2059. maxContentLength: -1,
  2060. maxBodyLength: -1,
  2061. env: {
  2062. FormData: platform.classes.FormData,
  2063. Blob: platform.classes.Blob
  2064. },
  2065. validateStatus: function validateStatus(status) {
  2066. return status >= 200 && status < 300;
  2067. },
  2068. headers: {
  2069. common: {
  2070. Accept: 'application/json, text/plain, */*',
  2071. 'Content-Type': undefined
  2072. }
  2073. }
  2074. };
  2075. utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], function (method) {
  2076. defaults.headers[method] = {};
  2077. });
  2078. // RawAxiosHeaders whose duplicates are ignored by node
  2079. // c.f. https://nodejs.org/api/http.html#http_message_headers
  2080. 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']);
  2081. /**
  2082. * Parse headers into an object
  2083. *
  2084. * ```
  2085. * Date: Wed, 27 Aug 2014 08:58:49 GMT
  2086. * Content-Type: application/json
  2087. * Connection: keep-alive
  2088. * Transfer-Encoding: chunked
  2089. * ```
  2090. *
  2091. * @param {String} rawHeaders Headers needing to be parsed
  2092. *
  2093. * @returns {Object} Headers parsed into an object
  2094. */
  2095. var parseHeaders = (function (rawHeaders) {
  2096. var parsed = {};
  2097. var key;
  2098. var val;
  2099. var i;
  2100. rawHeaders && rawHeaders.split('\n').forEach(function parser(line) {
  2101. i = line.indexOf(':');
  2102. key = line.substring(0, i).trim().toLowerCase();
  2103. val = line.substring(i + 1).trim();
  2104. if (!key || parsed[key] && ignoreDuplicateOf[key]) {
  2105. return;
  2106. }
  2107. if (key === 'set-cookie') {
  2108. if (parsed[key]) {
  2109. parsed[key].push(val);
  2110. } else {
  2111. parsed[key] = [val];
  2112. }
  2113. } else {
  2114. parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
  2115. }
  2116. });
  2117. return parsed;
  2118. });
  2119. var $internals = Symbol('internals');
  2120. var INVALID_HEADER_VALUE_CHARS_RE = /[^\x09\x20-\x7E\x80-\xFF]/g;
  2121. function trimSPorHTAB(str) {
  2122. var start = 0;
  2123. var end = str.length;
  2124. while (start < end) {
  2125. var code = str.charCodeAt(start);
  2126. if (code !== 0x09 && code !== 0x20) {
  2127. break;
  2128. }
  2129. start += 1;
  2130. }
  2131. while (end > start) {
  2132. var _code = str.charCodeAt(end - 1);
  2133. if (_code !== 0x09 && _code !== 0x20) {
  2134. break;
  2135. }
  2136. end -= 1;
  2137. }
  2138. return start === 0 && end === str.length ? str : str.slice(start, end);
  2139. }
  2140. function normalizeHeader(header) {
  2141. return header && String(header).trim().toLowerCase();
  2142. }
  2143. function sanitizeHeaderValue(str) {
  2144. return trimSPorHTAB(str.replace(INVALID_HEADER_VALUE_CHARS_RE, ''));
  2145. }
  2146. function normalizeValue(value) {
  2147. if (value === false || value == null) {
  2148. return value;
  2149. }
  2150. return utils$1.isArray(value) ? value.map(normalizeValue) : sanitizeHeaderValue(String(value));
  2151. }
  2152. function parseTokens(str) {
  2153. var tokens = Object.create(null);
  2154. var tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
  2155. var match;
  2156. while (match = tokensRE.exec(str)) {
  2157. tokens[match[1]] = match[2];
  2158. }
  2159. return tokens;
  2160. }
  2161. var isValidHeaderName = function isValidHeaderName(str) {
  2162. return /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
  2163. };
  2164. function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
  2165. if (utils$1.isFunction(filter)) {
  2166. return filter.call(this, value, header);
  2167. }
  2168. if (isHeaderNameFilter) {
  2169. value = header;
  2170. }
  2171. if (!utils$1.isString(value)) return;
  2172. if (utils$1.isString(filter)) {
  2173. return value.indexOf(filter) !== -1;
  2174. }
  2175. if (utils$1.isRegExp(filter)) {
  2176. return filter.test(value);
  2177. }
  2178. }
  2179. function formatHeader(header) {
  2180. return header.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, function (w, _char, str) {
  2181. return _char.toUpperCase() + str;
  2182. });
  2183. }
  2184. function buildAccessors(obj, header) {
  2185. var accessorName = utils$1.toCamelCase(' ' + header);
  2186. ['get', 'set', 'has'].forEach(function (methodName) {
  2187. Object.defineProperty(obj, methodName + accessorName, {
  2188. value: function value(arg1, arg2, arg3) {
  2189. return this[methodName].call(this, header, arg1, arg2, arg3);
  2190. },
  2191. configurable: true
  2192. });
  2193. });
  2194. }
  2195. var AxiosHeaders = /*#__PURE__*/function () {
  2196. function AxiosHeaders(headers) {
  2197. _classCallCheck(this, AxiosHeaders);
  2198. headers && this.set(headers);
  2199. }
  2200. return _createClass(AxiosHeaders, [{
  2201. key: "set",
  2202. value: function set(header, valueOrRewrite, rewrite) {
  2203. var self = this;
  2204. function setHeader(_value, _header, _rewrite) {
  2205. var lHeader = normalizeHeader(_header);
  2206. if (!lHeader) {
  2207. throw new Error('header name must be a non-empty string');
  2208. }
  2209. var key = utils$1.findKey(self, lHeader);
  2210. if (!key || self[key] === undefined || _rewrite === true || _rewrite === undefined && self[key] !== false) {
  2211. self[key || _header] = normalizeValue(_value);
  2212. }
  2213. }
  2214. var setHeaders = function setHeaders(headers, _rewrite) {
  2215. return utils$1.forEach(headers, function (_value, _header) {
  2216. return setHeader(_value, _header, _rewrite);
  2217. });
  2218. };
  2219. if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
  2220. setHeaders(header, valueOrRewrite);
  2221. } else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
  2222. setHeaders(parseHeaders(header), valueOrRewrite);
  2223. } else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
  2224. var obj = {},
  2225. dest,
  2226. key;
  2227. var _iterator = _createForOfIteratorHelper(header),
  2228. _step;
  2229. try {
  2230. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  2231. var entry = _step.value;
  2232. if (!utils$1.isArray(entry)) {
  2233. throw TypeError('Object iterator must return a key-value pair');
  2234. }
  2235. obj[key = entry[0]] = (dest = obj[key]) ? utils$1.isArray(dest) ? [].concat(_toConsumableArray(dest), [entry[1]]) : [dest, entry[1]] : entry[1];
  2236. }
  2237. } catch (err) {
  2238. _iterator.e(err);
  2239. } finally {
  2240. _iterator.f();
  2241. }
  2242. setHeaders(obj, valueOrRewrite);
  2243. } else {
  2244. header != null && setHeader(valueOrRewrite, header, rewrite);
  2245. }
  2246. return this;
  2247. }
  2248. }, {
  2249. key: "get",
  2250. value: function get(header, parser) {
  2251. header = normalizeHeader(header);
  2252. if (header) {
  2253. var key = utils$1.findKey(this, header);
  2254. if (key) {
  2255. var value = this[key];
  2256. if (!parser) {
  2257. return value;
  2258. }
  2259. if (parser === true) {
  2260. return parseTokens(value);
  2261. }
  2262. if (utils$1.isFunction(parser)) {
  2263. return parser.call(this, value, key);
  2264. }
  2265. if (utils$1.isRegExp(parser)) {
  2266. return parser.exec(value);
  2267. }
  2268. throw new TypeError('parser must be boolean|regexp|function');
  2269. }
  2270. }
  2271. }
  2272. }, {
  2273. key: "has",
  2274. value: function has(header, matcher) {
  2275. header = normalizeHeader(header);
  2276. if (header) {
  2277. var key = utils$1.findKey(this, header);
  2278. return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
  2279. }
  2280. return false;
  2281. }
  2282. }, {
  2283. key: "delete",
  2284. value: function _delete(header, matcher) {
  2285. var self = this;
  2286. var deleted = false;
  2287. function deleteHeader(_header) {
  2288. _header = normalizeHeader(_header);
  2289. if (_header) {
  2290. var key = utils$1.findKey(self, _header);
  2291. if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
  2292. delete self[key];
  2293. deleted = true;
  2294. }
  2295. }
  2296. }
  2297. if (utils$1.isArray(header)) {
  2298. header.forEach(deleteHeader);
  2299. } else {
  2300. deleteHeader(header);
  2301. }
  2302. return deleted;
  2303. }
  2304. }, {
  2305. key: "clear",
  2306. value: function clear(matcher) {
  2307. var keys = Object.keys(this);
  2308. var i = keys.length;
  2309. var deleted = false;
  2310. while (i--) {
  2311. var key = keys[i];
  2312. if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
  2313. delete this[key];
  2314. deleted = true;
  2315. }
  2316. }
  2317. return deleted;
  2318. }
  2319. }, {
  2320. key: "normalize",
  2321. value: function normalize(format) {
  2322. var self = this;
  2323. var headers = {};
  2324. utils$1.forEach(this, function (value, header) {
  2325. var key = utils$1.findKey(headers, header);
  2326. if (key) {
  2327. self[key] = normalizeValue(value);
  2328. delete self[header];
  2329. return;
  2330. }
  2331. var normalized = format ? formatHeader(header) : String(header).trim();
  2332. if (normalized !== header) {
  2333. delete self[header];
  2334. }
  2335. self[normalized] = normalizeValue(value);
  2336. headers[normalized] = true;
  2337. });
  2338. return this;
  2339. }
  2340. }, {
  2341. key: "concat",
  2342. value: function concat() {
  2343. var _this$constructor;
  2344. for (var _len = arguments.length, targets = new Array(_len), _key = 0; _key < _len; _key++) {
  2345. targets[_key] = arguments[_key];
  2346. }
  2347. return (_this$constructor = this.constructor).concat.apply(_this$constructor, [this].concat(targets));
  2348. }
  2349. }, {
  2350. key: "toJSON",
  2351. value: function toJSON(asStrings) {
  2352. var obj = Object.create(null);
  2353. utils$1.forEach(this, function (value, header) {
  2354. value != null && value !== false && (obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value);
  2355. });
  2356. return obj;
  2357. }
  2358. }, {
  2359. key: Symbol.iterator,
  2360. value: function value() {
  2361. return Object.entries(this.toJSON())[Symbol.iterator]();
  2362. }
  2363. }, {
  2364. key: "toString",
  2365. value: function toString() {
  2366. return Object.entries(this.toJSON()).map(function (_ref) {
  2367. var _ref2 = _slicedToArray(_ref, 2),
  2368. header = _ref2[0],
  2369. value = _ref2[1];
  2370. return header + ': ' + value;
  2371. }).join('\n');
  2372. }
  2373. }, {
  2374. key: "getSetCookie",
  2375. value: function getSetCookie() {
  2376. return this.get('set-cookie') || [];
  2377. }
  2378. }, {
  2379. key: Symbol.toStringTag,
  2380. get: function get() {
  2381. return 'AxiosHeaders';
  2382. }
  2383. }], [{
  2384. key: "from",
  2385. value: function from(thing) {
  2386. return thing instanceof this ? thing : new this(thing);
  2387. }
  2388. }, {
  2389. key: "concat",
  2390. value: function concat(first) {
  2391. var computed = new this(first);
  2392. for (var _len2 = arguments.length, targets = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
  2393. targets[_key2 - 1] = arguments[_key2];
  2394. }
  2395. targets.forEach(function (target) {
  2396. return computed.set(target);
  2397. });
  2398. return computed;
  2399. }
  2400. }, {
  2401. key: "accessor",
  2402. value: function accessor(header) {
  2403. var internals = this[$internals] = this[$internals] = {
  2404. accessors: {}
  2405. };
  2406. var accessors = internals.accessors;
  2407. var prototype = this.prototype;
  2408. function defineAccessor(_header) {
  2409. var lHeader = normalizeHeader(_header);
  2410. if (!accessors[lHeader]) {
  2411. buildAccessors(prototype, _header);
  2412. accessors[lHeader] = true;
  2413. }
  2414. }
  2415. utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
  2416. return this;
  2417. }
  2418. }]);
  2419. }();
  2420. AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);
  2421. // reserved names hotfix
  2422. utils$1.reduceDescriptors(AxiosHeaders.prototype, function (_ref3, key) {
  2423. var value = _ref3.value;
  2424. var mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
  2425. return {
  2426. get: function get() {
  2427. return value;
  2428. },
  2429. set: function set(headerValue) {
  2430. this[mapped] = headerValue;
  2431. }
  2432. };
  2433. });
  2434. utils$1.freezeMethods(AxiosHeaders);
  2435. /**
  2436. * Transform the data for a request or a response
  2437. *
  2438. * @param {Array|Function} fns A single function or Array of functions
  2439. * @param {?Object} response The response object
  2440. *
  2441. * @returns {*} The resulting transformed data
  2442. */
  2443. function transformData(fns, response) {
  2444. var config = this || defaults;
  2445. var context = response || config;
  2446. var headers = AxiosHeaders.from(context.headers);
  2447. var data = context.data;
  2448. utils$1.forEach(fns, function transform(fn) {
  2449. data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);
  2450. });
  2451. headers.normalize();
  2452. return data;
  2453. }
  2454. function isCancel(value) {
  2455. return !!(value && value.__CANCEL__);
  2456. }
  2457. var CanceledError = /*#__PURE__*/function (_AxiosError) {
  2458. /**
  2459. * A `CanceledError` is an object that is thrown when an operation is canceled.
  2460. *
  2461. * @param {string=} message The message.
  2462. * @param {Object=} config The config.
  2463. * @param {Object=} request The request.
  2464. *
  2465. * @returns {CanceledError} The created error.
  2466. */
  2467. function CanceledError(message, config, request) {
  2468. var _this;
  2469. _classCallCheck(this, CanceledError);
  2470. _this = _callSuper(this, CanceledError, [message == null ? 'canceled' : message, AxiosError.ERR_CANCELED, config, request]);
  2471. _this.name = 'CanceledError';
  2472. _this.__CANCEL__ = true;
  2473. return _this;
  2474. }
  2475. _inherits(CanceledError, _AxiosError);
  2476. return _createClass(CanceledError);
  2477. }(AxiosError);
  2478. /**
  2479. * Resolve or reject a Promise based on response status.
  2480. *
  2481. * @param {Function} resolve A function that resolves the promise.
  2482. * @param {Function} reject A function that rejects the promise.
  2483. * @param {object} response The response.
  2484. *
  2485. * @returns {object} The response.
  2486. */
  2487. function settle(resolve, reject, response) {
  2488. var validateStatus = response.config.validateStatus;
  2489. if (!response.status || !validateStatus || validateStatus(response.status)) {
  2490. resolve(response);
  2491. } else {
  2492. 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));
  2493. }
  2494. }
  2495. function parseProtocol(url) {
  2496. var match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
  2497. return match && match[1] || '';
  2498. }
  2499. /**
  2500. * Calculate data maxRate
  2501. * @param {Number} [samplesCount= 10]
  2502. * @param {Number} [min= 1000]
  2503. * @returns {Function}
  2504. */
  2505. function speedometer(samplesCount, min) {
  2506. samplesCount = samplesCount || 10;
  2507. var bytes = new Array(samplesCount);
  2508. var timestamps = new Array(samplesCount);
  2509. var head = 0;
  2510. var tail = 0;
  2511. var firstSampleTS;
  2512. min = min !== undefined ? min : 1000;
  2513. return function push(chunkLength) {
  2514. var now = Date.now();
  2515. var startedAt = timestamps[tail];
  2516. if (!firstSampleTS) {
  2517. firstSampleTS = now;
  2518. }
  2519. bytes[head] = chunkLength;
  2520. timestamps[head] = now;
  2521. var i = tail;
  2522. var bytesCount = 0;
  2523. while (i !== head) {
  2524. bytesCount += bytes[i++];
  2525. i = i % samplesCount;
  2526. }
  2527. head = (head + 1) % samplesCount;
  2528. if (head === tail) {
  2529. tail = (tail + 1) % samplesCount;
  2530. }
  2531. if (now - firstSampleTS < min) {
  2532. return;
  2533. }
  2534. var passed = startedAt && now - startedAt;
  2535. return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
  2536. };
  2537. }
  2538. /**
  2539. * Throttle decorator
  2540. * @param {Function} fn
  2541. * @param {Number} freq
  2542. * @return {Function}
  2543. */
  2544. function throttle(fn, freq) {
  2545. var timestamp = 0;
  2546. var threshold = 1000 / freq;
  2547. var lastArgs;
  2548. var timer;
  2549. var invoke = function invoke(args) {
  2550. var now = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Date.now();
  2551. timestamp = now;
  2552. lastArgs = null;
  2553. if (timer) {
  2554. clearTimeout(timer);
  2555. timer = null;
  2556. }
  2557. fn.apply(void 0, _toConsumableArray(args));
  2558. };
  2559. var throttled = function throttled() {
  2560. var now = Date.now();
  2561. var passed = now - timestamp;
  2562. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  2563. args[_key] = arguments[_key];
  2564. }
  2565. if (passed >= threshold) {
  2566. invoke(args, now);
  2567. } else {
  2568. lastArgs = args;
  2569. if (!timer) {
  2570. timer = setTimeout(function () {
  2571. timer = null;
  2572. invoke(lastArgs);
  2573. }, threshold - passed);
  2574. }
  2575. }
  2576. };
  2577. var flush = function flush() {
  2578. return lastArgs && invoke(lastArgs);
  2579. };
  2580. return [throttled, flush];
  2581. }
  2582. var progressEventReducer = function progressEventReducer(listener, isDownloadStream) {
  2583. var freq = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 3;
  2584. var bytesNotified = 0;
  2585. var _speedometer = speedometer(50, 250);
  2586. return throttle(function (e) {
  2587. var rawLoaded = e.loaded;
  2588. var total = e.lengthComputable ? e.total : undefined;
  2589. var loaded = total != null ? Math.min(rawLoaded, total) : rawLoaded;
  2590. var progressBytes = Math.max(0, loaded - bytesNotified);
  2591. var rate = _speedometer(progressBytes);
  2592. bytesNotified = Math.max(bytesNotified, loaded);
  2593. var data = _defineProperty({
  2594. loaded: loaded,
  2595. total: total,
  2596. progress: total ? loaded / total : undefined,
  2597. bytes: progressBytes,
  2598. rate: rate ? rate : undefined,
  2599. estimated: rate && total ? (total - loaded) / rate : undefined,
  2600. event: e,
  2601. lengthComputable: total != null
  2602. }, isDownloadStream ? 'download' : 'upload', true);
  2603. listener(data);
  2604. }, freq);
  2605. };
  2606. var progressEventDecorator = function progressEventDecorator(total, throttled) {
  2607. var lengthComputable = total != null;
  2608. return [function (loaded) {
  2609. return throttled[0]({
  2610. lengthComputable: lengthComputable,
  2611. total: total,
  2612. loaded: loaded
  2613. });
  2614. }, throttled[1]];
  2615. };
  2616. var asyncDecorator = function asyncDecorator(fn) {
  2617. return function () {
  2618. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  2619. args[_key] = arguments[_key];
  2620. }
  2621. return utils$1.asap(function () {
  2622. return fn.apply(void 0, args);
  2623. });
  2624. };
  2625. };
  2626. var isURLSameOrigin = platform.hasStandardBrowserEnv ? function (origin, isMSIE) {
  2627. return function (url) {
  2628. url = new URL(url, platform.origin);
  2629. return origin.protocol === url.protocol && origin.host === url.host && (isMSIE || origin.port === url.port);
  2630. };
  2631. }(new URL(platform.origin), platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)) : function () {
  2632. return true;
  2633. };
  2634. var cookies = platform.hasStandardBrowserEnv ?
  2635. // Standard browser envs support document.cookie
  2636. {
  2637. write: function write(name, value, expires, path, domain, secure, sameSite) {
  2638. if (typeof document === 'undefined') return;
  2639. var cookie = ["".concat(name, "=").concat(encodeURIComponent(value))];
  2640. if (utils$1.isNumber(expires)) {
  2641. cookie.push("expires=".concat(new Date(expires).toUTCString()));
  2642. }
  2643. if (utils$1.isString(path)) {
  2644. cookie.push("path=".concat(path));
  2645. }
  2646. if (utils$1.isString(domain)) {
  2647. cookie.push("domain=".concat(domain));
  2648. }
  2649. if (secure === true) {
  2650. cookie.push('secure');
  2651. }
  2652. if (utils$1.isString(sameSite)) {
  2653. cookie.push("SameSite=".concat(sameSite));
  2654. }
  2655. document.cookie = cookie.join('; ');
  2656. },
  2657. read: function read(name) {
  2658. if (typeof document === 'undefined') return null;
  2659. var match = document.cookie.match(new RegExp('(?:^|; )' + name + '=([^;]*)'));
  2660. return match ? decodeURIComponent(match[1]) : null;
  2661. },
  2662. remove: function remove(name) {
  2663. this.write(name, '', Date.now() - 86400000, '/');
  2664. }
  2665. } :
  2666. // Non-standard browser env (web workers, react-native) lack needed support.
  2667. {
  2668. write: function write() {},
  2669. read: function read() {
  2670. return null;
  2671. },
  2672. remove: function remove() {}
  2673. };
  2674. /**
  2675. * Determines whether the specified URL is absolute
  2676. *
  2677. * @param {string} url The URL to test
  2678. *
  2679. * @returns {boolean} True if the specified URL is absolute, otherwise false
  2680. */
  2681. function isAbsoluteURL(url) {
  2682. // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
  2683. // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
  2684. // by any combination of letters, digits, plus, period, or hyphen.
  2685. if (typeof url !== 'string') {
  2686. return false;
  2687. }
  2688. return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
  2689. }
  2690. /**
  2691. * Creates a new URL by combining the specified URLs
  2692. *
  2693. * @param {string} baseURL The base URL
  2694. * @param {string} relativeURL The relative URL
  2695. *
  2696. * @returns {string} The combined URL
  2697. */
  2698. function combineURLs(baseURL, relativeURL) {
  2699. return relativeURL ? baseURL.replace(/\/?\/$/, '') + '/' + relativeURL.replace(/^\/+/, '') : baseURL;
  2700. }
  2701. /**
  2702. * Creates a new URL by combining the baseURL with the requestedURL,
  2703. * only when the requestedURL is not already an absolute URL.
  2704. * If the requestURL is absolute, this function returns the requestedURL untouched.
  2705. *
  2706. * @param {string} baseURL The base URL
  2707. * @param {string} requestedURL Absolute or relative URL to combine
  2708. *
  2709. * @returns {string} The combined full path
  2710. */
  2711. function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
  2712. var isRelativeUrl = !isAbsoluteURL(requestedURL);
  2713. if (baseURL && (isRelativeUrl || allowAbsoluteUrls === false)) {
  2714. return combineURLs(baseURL, requestedURL);
  2715. }
  2716. return requestedURL;
  2717. }
  2718. var headersToObject = function headersToObject(thing) {
  2719. return thing instanceof AxiosHeaders ? _objectSpread2({}, thing) : thing;
  2720. };
  2721. /**
  2722. * Config-specific merge-function which creates a new config-object
  2723. * by merging two configuration objects together.
  2724. *
  2725. * @param {Object} config1
  2726. * @param {Object} config2
  2727. *
  2728. * @returns {Object} New object resulting from merging config2 to config1
  2729. */
  2730. function mergeConfig(config1, config2) {
  2731. // eslint-disable-next-line no-param-reassign
  2732. config2 = config2 || {};
  2733. // Use a null-prototype object so that downstream reads such as `config.auth`
  2734. // or `config.baseURL` cannot inherit polluted values from Object.prototype
  2735. // (see GHSA-q8qp-cvcw-x6jj). `hasOwnProperty` is restored as a non-enumerable
  2736. // own slot to preserve ergonomics for user code that relies on it.
  2737. var config = Object.create(null);
  2738. Object.defineProperty(config, 'hasOwnProperty', {
  2739. value: Object.prototype.hasOwnProperty,
  2740. enumerable: false,
  2741. writable: true,
  2742. configurable: true
  2743. });
  2744. function getMergedValue(target, source, prop, caseless) {
  2745. if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
  2746. return utils$1.merge.call({
  2747. caseless: caseless
  2748. }, target, source);
  2749. } else if (utils$1.isPlainObject(source)) {
  2750. return utils$1.merge({}, source);
  2751. } else if (utils$1.isArray(source)) {
  2752. return source.slice();
  2753. }
  2754. return source;
  2755. }
  2756. function mergeDeepProperties(a, b, prop, caseless) {
  2757. if (!utils$1.isUndefined(b)) {
  2758. return getMergedValue(a, b, prop, caseless);
  2759. } else if (!utils$1.isUndefined(a)) {
  2760. return getMergedValue(undefined, a, prop, caseless);
  2761. }
  2762. }
  2763. // eslint-disable-next-line consistent-return
  2764. function valueFromConfig2(a, b) {
  2765. if (!utils$1.isUndefined(b)) {
  2766. return getMergedValue(undefined, b);
  2767. }
  2768. }
  2769. // eslint-disable-next-line consistent-return
  2770. function defaultToConfig2(a, b) {
  2771. if (!utils$1.isUndefined(b)) {
  2772. return getMergedValue(undefined, b);
  2773. } else if (!utils$1.isUndefined(a)) {
  2774. return getMergedValue(undefined, a);
  2775. }
  2776. }
  2777. // eslint-disable-next-line consistent-return
  2778. function mergeDirectKeys(a, b, prop) {
  2779. if (utils$1.hasOwnProp(config2, prop)) {
  2780. return getMergedValue(a, b);
  2781. } else if (utils$1.hasOwnProp(config1, prop)) {
  2782. return getMergedValue(undefined, a);
  2783. }
  2784. }
  2785. var mergeMap = {
  2786. url: valueFromConfig2,
  2787. method: valueFromConfig2,
  2788. data: valueFromConfig2,
  2789. baseURL: defaultToConfig2,
  2790. transformRequest: defaultToConfig2,
  2791. transformResponse: defaultToConfig2,
  2792. paramsSerializer: defaultToConfig2,
  2793. timeout: defaultToConfig2,
  2794. timeoutMessage: defaultToConfig2,
  2795. withCredentials: defaultToConfig2,
  2796. withXSRFToken: defaultToConfig2,
  2797. adapter: defaultToConfig2,
  2798. responseType: defaultToConfig2,
  2799. xsrfCookieName: defaultToConfig2,
  2800. xsrfHeaderName: defaultToConfig2,
  2801. onUploadProgress: defaultToConfig2,
  2802. onDownloadProgress: defaultToConfig2,
  2803. decompress: defaultToConfig2,
  2804. maxContentLength: defaultToConfig2,
  2805. maxBodyLength: defaultToConfig2,
  2806. beforeRedirect: defaultToConfig2,
  2807. transport: defaultToConfig2,
  2808. httpAgent: defaultToConfig2,
  2809. httpsAgent: defaultToConfig2,
  2810. cancelToken: defaultToConfig2,
  2811. socketPath: defaultToConfig2,
  2812. allowedSocketPaths: defaultToConfig2,
  2813. responseEncoding: defaultToConfig2,
  2814. validateStatus: mergeDirectKeys,
  2815. headers: function headers(a, b, prop) {
  2816. return mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true);
  2817. }
  2818. };
  2819. utils$1.forEach(Object.keys(_objectSpread2(_objectSpread2({}, config1), config2)), function computeConfigValue(prop) {
  2820. if (prop === '__proto__' || prop === 'constructor' || prop === 'prototype') return;
  2821. var merge = utils$1.hasOwnProp(mergeMap, prop) ? mergeMap[prop] : mergeDeepProperties;
  2822. var a = utils$1.hasOwnProp(config1, prop) ? config1[prop] : undefined;
  2823. var b = utils$1.hasOwnProp(config2, prop) ? config2[prop] : undefined;
  2824. var configValue = merge(a, b, prop);
  2825. utils$1.isUndefined(configValue) && merge !== mergeDirectKeys || (config[prop] = configValue);
  2826. });
  2827. return config;
  2828. }
  2829. var resolveConfig = (function (config) {
  2830. var newConfig = mergeConfig({}, config);
  2831. // Read only own properties to prevent prototype pollution gadgets
  2832. // (e.g. Object.prototype.baseURL = 'https://evil.com'). See GHSA-q8qp-cvcw-x6jj.
  2833. var own = function own(key) {
  2834. return utils$1.hasOwnProp(newConfig, key) ? newConfig[key] : undefined;
  2835. };
  2836. var data = own('data');
  2837. var withXSRFToken = own('withXSRFToken');
  2838. var xsrfHeaderName = own('xsrfHeaderName');
  2839. var xsrfCookieName = own('xsrfCookieName');
  2840. var headers = own('headers');
  2841. var auth = own('auth');
  2842. var baseURL = own('baseURL');
  2843. var allowAbsoluteUrls = own('allowAbsoluteUrls');
  2844. var url = own('url');
  2845. newConfig.headers = headers = AxiosHeaders.from(headers);
  2846. newConfig.url = buildURL(buildFullPath(baseURL, url, allowAbsoluteUrls), config.params, config.paramsSerializer);
  2847. // HTTP basic authentication
  2848. if (auth) {
  2849. headers.set('Authorization', 'Basic ' + btoa((auth.username || '') + ':' + (auth.password ? unescape(encodeURIComponent(auth.password)) : '')));
  2850. }
  2851. if (utils$1.isFormData(data)) {
  2852. if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
  2853. headers.setContentType(undefined); // browser handles it
  2854. } else if (utils$1.isFunction(data.getHeaders)) {
  2855. // Node.js FormData (like form-data package)
  2856. var formHeaders = data.getHeaders();
  2857. // Only set safe headers to avoid overwriting security headers
  2858. var allowedHeaders = ['content-type', 'content-length'];
  2859. Object.entries(formHeaders).forEach(function (_ref) {
  2860. var _ref2 = _slicedToArray(_ref, 2),
  2861. key = _ref2[0],
  2862. val = _ref2[1];
  2863. if (allowedHeaders.includes(key.toLowerCase())) {
  2864. headers.set(key, val);
  2865. }
  2866. });
  2867. }
  2868. }
  2869. // Add xsrf header
  2870. // This is only done if running in a standard browser environment.
  2871. // Specifically not if we're in a web worker, or react-native.
  2872. if (platform.hasStandardBrowserEnv) {
  2873. if (utils$1.isFunction(withXSRFToken)) {
  2874. withXSRFToken = withXSRFToken(newConfig);
  2875. }
  2876. // Strict boolean check — prevents proto-pollution gadgets (e.g. Object.prototype.withXSRFToken = 1)
  2877. // and misconfigurations (e.g. "false") from short-circuiting the same-origin check and leaking
  2878. // the XSRF token cross-origin. See GHSA-xx6v-rp6x-q39c.
  2879. var shouldSendXSRF = withXSRFToken === true || withXSRFToken == null && isURLSameOrigin(newConfig.url);
  2880. if (shouldSendXSRF) {
  2881. var xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
  2882. if (xsrfValue) {
  2883. headers.set(xsrfHeaderName, xsrfValue);
  2884. }
  2885. }
  2886. }
  2887. return newConfig;
  2888. });
  2889. var isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
  2890. var xhrAdapter = isXHRAdapterSupported && function (config) {
  2891. return new Promise(function dispatchXhrRequest(resolve, reject) {
  2892. var _config = resolveConfig(config);
  2893. var requestData = _config.data;
  2894. var requestHeaders = AxiosHeaders.from(_config.headers).normalize();
  2895. var responseType = _config.responseType,
  2896. onUploadProgress = _config.onUploadProgress,
  2897. onDownloadProgress = _config.onDownloadProgress;
  2898. var onCanceled;
  2899. var uploadThrottled, downloadThrottled;
  2900. var flushUpload, flushDownload;
  2901. function done() {
  2902. flushUpload && flushUpload(); // flush events
  2903. flushDownload && flushDownload(); // flush events
  2904. _config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
  2905. _config.signal && _config.signal.removeEventListener('abort', onCanceled);
  2906. }
  2907. var request = new XMLHttpRequest();
  2908. request.open(_config.method.toUpperCase(), _config.url, true);
  2909. // Set the request timeout in MS
  2910. request.timeout = _config.timeout;
  2911. function onloadend() {
  2912. if (!request) {
  2913. return;
  2914. }
  2915. // Prepare the response
  2916. var responseHeaders = AxiosHeaders.from('getAllResponseHeaders' in request && request.getAllResponseHeaders());
  2917. var responseData = !responseType || responseType === 'text' || responseType === 'json' ? request.responseText : request.response;
  2918. var response = {
  2919. data: responseData,
  2920. status: request.status,
  2921. statusText: request.statusText,
  2922. headers: responseHeaders,
  2923. config: config,
  2924. request: request
  2925. };
  2926. settle(function _resolve(value) {
  2927. resolve(value);
  2928. done();
  2929. }, function _reject(err) {
  2930. reject(err);
  2931. done();
  2932. }, response);
  2933. // Clean up request
  2934. request = null;
  2935. }
  2936. if ('onloadend' in request) {
  2937. // Use onloadend if available
  2938. request.onloadend = onloadend;
  2939. } else {
  2940. // Listen for ready state to emulate onloadend
  2941. request.onreadystatechange = function handleLoad() {
  2942. if (!request || request.readyState !== 4) {
  2943. return;
  2944. }
  2945. // The request errored out and we didn't get a response, this will be
  2946. // handled by onerror instead
  2947. // With one exception: request that using file: protocol, most browsers
  2948. // will return status as 0 even though it's a successful request
  2949. if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
  2950. return;
  2951. }
  2952. // readystate handler is calling before onerror or ontimeout handlers,
  2953. // so we should call onloadend on the next 'tick'
  2954. setTimeout(onloadend);
  2955. };
  2956. }
  2957. // Handle browser request cancellation (as opposed to a manual cancellation)
  2958. request.onabort = function handleAbort() {
  2959. if (!request) {
  2960. return;
  2961. }
  2962. reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, config, request));
  2963. // Clean up request
  2964. request = null;
  2965. };
  2966. // Handle low level network errors
  2967. request.onerror = function handleError(event) {
  2968. // Browsers deliver a ProgressEvent in XHR onerror
  2969. // (message may be empty; when present, surface it)
  2970. // See https://developer.mozilla.org/docs/Web/API/XMLHttpRequest/error_event
  2971. var msg = event && event.message ? event.message : 'Network Error';
  2972. var err = new AxiosError(msg, AxiosError.ERR_NETWORK, config, request);
  2973. // attach the underlying event for consumers who want details
  2974. err.event = event || null;
  2975. reject(err);
  2976. request = null;
  2977. };
  2978. // Handle timeout
  2979. request.ontimeout = function handleTimeout() {
  2980. var timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded';
  2981. var transitional = _config.transitional || transitionalDefaults;
  2982. if (_config.timeoutErrorMessage) {
  2983. timeoutErrorMessage = _config.timeoutErrorMessage;
  2984. }
  2985. reject(new AxiosError(timeoutErrorMessage, transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED, config, request));
  2986. // Clean up request
  2987. request = null;
  2988. };
  2989. // Remove Content-Type if data is undefined
  2990. requestData === undefined && requestHeaders.setContentType(null);
  2991. // Add headers to the request
  2992. if ('setRequestHeader' in request) {
  2993. utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
  2994. request.setRequestHeader(key, val);
  2995. });
  2996. }
  2997. // Add withCredentials to request if needed
  2998. if (!utils$1.isUndefined(_config.withCredentials)) {
  2999. request.withCredentials = !!_config.withCredentials;
  3000. }
  3001. // Add responseType to request if needed
  3002. if (responseType && responseType !== 'json') {
  3003. request.responseType = _config.responseType;
  3004. }
  3005. // Handle progress if needed
  3006. if (onDownloadProgress) {
  3007. var _progressEventReducer = progressEventReducer(onDownloadProgress, true);
  3008. var _progressEventReducer2 = _slicedToArray(_progressEventReducer, 2);
  3009. downloadThrottled = _progressEventReducer2[0];
  3010. flushDownload = _progressEventReducer2[1];
  3011. request.addEventListener('progress', downloadThrottled);
  3012. }
  3013. // Not all browsers support upload events
  3014. if (onUploadProgress && request.upload) {
  3015. var _progressEventReducer3 = progressEventReducer(onUploadProgress);
  3016. var _progressEventReducer4 = _slicedToArray(_progressEventReducer3, 2);
  3017. uploadThrottled = _progressEventReducer4[0];
  3018. flushUpload = _progressEventReducer4[1];
  3019. request.upload.addEventListener('progress', uploadThrottled);
  3020. request.upload.addEventListener('loadend', flushUpload);
  3021. }
  3022. if (_config.cancelToken || _config.signal) {
  3023. // Handle cancellation
  3024. // eslint-disable-next-line func-names
  3025. onCanceled = function onCanceled(cancel) {
  3026. if (!request) {
  3027. return;
  3028. }
  3029. reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);
  3030. request.abort();
  3031. request = null;
  3032. };
  3033. _config.cancelToken && _config.cancelToken.subscribe(onCanceled);
  3034. if (_config.signal) {
  3035. _config.signal.aborted ? onCanceled() : _config.signal.addEventListener('abort', onCanceled);
  3036. }
  3037. }
  3038. var protocol = parseProtocol(_config.url);
  3039. if (protocol && platform.protocols.indexOf(protocol) === -1) {
  3040. reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));
  3041. return;
  3042. }
  3043. // Send the request
  3044. request.send(requestData || null);
  3045. });
  3046. };
  3047. var composeSignals = function composeSignals(signals, timeout) {
  3048. var _signals = signals = signals ? signals.filter(Boolean) : [],
  3049. length = _signals.length;
  3050. if (timeout || length) {
  3051. var controller = new AbortController();
  3052. var aborted;
  3053. var onabort = function onabort(reason) {
  3054. if (!aborted) {
  3055. aborted = true;
  3056. unsubscribe();
  3057. var err = reason instanceof Error ? reason : this.reason;
  3058. controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err));
  3059. }
  3060. };
  3061. var timer = timeout && setTimeout(function () {
  3062. timer = null;
  3063. onabort(new AxiosError("timeout of ".concat(timeout, "ms exceeded"), AxiosError.ETIMEDOUT));
  3064. }, timeout);
  3065. var unsubscribe = function unsubscribe() {
  3066. if (signals) {
  3067. timer && clearTimeout(timer);
  3068. timer = null;
  3069. signals.forEach(function (signal) {
  3070. signal.unsubscribe ? signal.unsubscribe(onabort) : signal.removeEventListener('abort', onabort);
  3071. });
  3072. signals = null;
  3073. }
  3074. };
  3075. signals.forEach(function (signal) {
  3076. return signal.addEventListener('abort', onabort);
  3077. });
  3078. var signal = controller.signal;
  3079. signal.unsubscribe = function () {
  3080. return utils$1.asap(unsubscribe);
  3081. };
  3082. return signal;
  3083. }
  3084. };
  3085. var streamChunk = /*#__PURE__*/_regenerator().m(function streamChunk(chunk, chunkSize) {
  3086. var len, pos, end;
  3087. return _regenerator().w(function (_context) {
  3088. while (1) switch (_context.n) {
  3089. case 0:
  3090. len = chunk.byteLength;
  3091. if (!(!chunkSize || len < chunkSize)) {
  3092. _context.n = 2;
  3093. break;
  3094. }
  3095. _context.n = 1;
  3096. return chunk;
  3097. case 1:
  3098. return _context.a(2);
  3099. case 2:
  3100. pos = 0;
  3101. case 3:
  3102. if (!(pos < len)) {
  3103. _context.n = 5;
  3104. break;
  3105. }
  3106. end = pos + chunkSize;
  3107. _context.n = 4;
  3108. return chunk.slice(pos, end);
  3109. case 4:
  3110. pos = end;
  3111. _context.n = 3;
  3112. break;
  3113. case 5:
  3114. return _context.a(2);
  3115. }
  3116. }, streamChunk);
  3117. });
  3118. var readBytes = /*#__PURE__*/function () {
  3119. var _ref = _wrapAsyncGenerator(/*#__PURE__*/_regenerator().m(function _callee(iterable, chunkSize) {
  3120. var _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, chunk, _t;
  3121. return _regenerator().w(function (_context2) {
  3122. while (1) switch (_context2.p = _context2.n) {
  3123. case 0:
  3124. _iteratorAbruptCompletion = false;
  3125. _didIteratorError = false;
  3126. _context2.p = 1;
  3127. _iterator = _asyncIterator(readStream(iterable));
  3128. case 2:
  3129. _context2.n = 3;
  3130. return _awaitAsyncGenerator(_iterator.next());
  3131. case 3:
  3132. if (!(_iteratorAbruptCompletion = !(_step = _context2.v).done)) {
  3133. _context2.n = 5;
  3134. break;
  3135. }
  3136. chunk = _step.value;
  3137. return _context2.d(_regeneratorValues(_asyncGeneratorDelegate(_asyncIterator(streamChunk(chunk, chunkSize)))), 4);
  3138. case 4:
  3139. _iteratorAbruptCompletion = false;
  3140. _context2.n = 2;
  3141. break;
  3142. case 5:
  3143. _context2.n = 7;
  3144. break;
  3145. case 6:
  3146. _context2.p = 6;
  3147. _t = _context2.v;
  3148. _didIteratorError = true;
  3149. _iteratorError = _t;
  3150. case 7:
  3151. _context2.p = 7;
  3152. _context2.p = 8;
  3153. if (!(_iteratorAbruptCompletion && _iterator["return"] != null)) {
  3154. _context2.n = 9;
  3155. break;
  3156. }
  3157. _context2.n = 9;
  3158. return _awaitAsyncGenerator(_iterator["return"]());
  3159. case 9:
  3160. _context2.p = 9;
  3161. if (!_didIteratorError) {
  3162. _context2.n = 10;
  3163. break;
  3164. }
  3165. throw _iteratorError;
  3166. case 10:
  3167. return _context2.f(9);
  3168. case 11:
  3169. return _context2.f(7);
  3170. case 12:
  3171. return _context2.a(2);
  3172. }
  3173. }, _callee, null, [[8,, 9, 11], [1, 6, 7, 12]]);
  3174. }));
  3175. return function readBytes(_x, _x2) {
  3176. return _ref.apply(this, arguments);
  3177. };
  3178. }();
  3179. var readStream = /*#__PURE__*/function () {
  3180. var _ref2 = _wrapAsyncGenerator(/*#__PURE__*/_regenerator().m(function _callee2(stream) {
  3181. var reader, _yield$_awaitAsyncGen, done, value;
  3182. return _regenerator().w(function (_context3) {
  3183. while (1) switch (_context3.p = _context3.n) {
  3184. case 0:
  3185. if (!stream[Symbol.asyncIterator]) {
  3186. _context3.n = 2;
  3187. break;
  3188. }
  3189. return _context3.d(_regeneratorValues(_asyncGeneratorDelegate(_asyncIterator(stream))), 1);
  3190. case 1:
  3191. return _context3.a(2);
  3192. case 2:
  3193. reader = stream.getReader();
  3194. _context3.p = 3;
  3195. case 4:
  3196. _context3.n = 5;
  3197. return _awaitAsyncGenerator(reader.read());
  3198. case 5:
  3199. _yield$_awaitAsyncGen = _context3.v;
  3200. done = _yield$_awaitAsyncGen.done;
  3201. value = _yield$_awaitAsyncGen.value;
  3202. if (!done) {
  3203. _context3.n = 6;
  3204. break;
  3205. }
  3206. return _context3.a(3, 8);
  3207. case 6:
  3208. _context3.n = 7;
  3209. return value;
  3210. case 7:
  3211. _context3.n = 4;
  3212. break;
  3213. case 8:
  3214. _context3.p = 8;
  3215. _context3.n = 9;
  3216. return _awaitAsyncGenerator(reader.cancel());
  3217. case 9:
  3218. return _context3.f(8);
  3219. case 10:
  3220. return _context3.a(2);
  3221. }
  3222. }, _callee2, null, [[3,, 8, 10]]);
  3223. }));
  3224. return function readStream(_x3) {
  3225. return _ref2.apply(this, arguments);
  3226. };
  3227. }();
  3228. var trackStream = function trackStream(stream, chunkSize, onProgress, onFinish) {
  3229. var iterator = readBytes(stream, chunkSize);
  3230. var bytes = 0;
  3231. var done;
  3232. var _onFinish = function _onFinish(e) {
  3233. if (!done) {
  3234. done = true;
  3235. onFinish && onFinish(e);
  3236. }
  3237. };
  3238. return new ReadableStream({
  3239. pull: function pull(controller) {
  3240. return _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
  3241. var _yield$iterator$next, _done, value, len, loadedBytes, _t2;
  3242. return _regenerator().w(function (_context4) {
  3243. while (1) switch (_context4.p = _context4.n) {
  3244. case 0:
  3245. _context4.p = 0;
  3246. _context4.n = 1;
  3247. return iterator.next();
  3248. case 1:
  3249. _yield$iterator$next = _context4.v;
  3250. _done = _yield$iterator$next.done;
  3251. value = _yield$iterator$next.value;
  3252. if (!_done) {
  3253. _context4.n = 2;
  3254. break;
  3255. }
  3256. _onFinish();
  3257. controller.close();
  3258. return _context4.a(2);
  3259. case 2:
  3260. len = value.byteLength;
  3261. if (onProgress) {
  3262. loadedBytes = bytes += len;
  3263. onProgress(loadedBytes);
  3264. }
  3265. controller.enqueue(new Uint8Array(value));
  3266. _context4.n = 4;
  3267. break;
  3268. case 3:
  3269. _context4.p = 3;
  3270. _t2 = _context4.v;
  3271. _onFinish(_t2);
  3272. throw _t2;
  3273. case 4:
  3274. return _context4.a(2);
  3275. }
  3276. }, _callee3, null, [[0, 3]]);
  3277. }))();
  3278. },
  3279. cancel: function cancel(reason) {
  3280. _onFinish(reason);
  3281. return iterator["return"]();
  3282. }
  3283. }, {
  3284. highWaterMark: 2
  3285. });
  3286. };
  3287. var DEFAULT_CHUNK_SIZE = 64 * 1024;
  3288. var isFunction = utils$1.isFunction;
  3289. var globalFetchAPI = function (_ref) {
  3290. var Request = _ref.Request,
  3291. Response = _ref.Response;
  3292. return {
  3293. Request: Request,
  3294. Response: Response
  3295. };
  3296. }(utils$1.global);
  3297. var _utils$global = utils$1.global,
  3298. ReadableStream$1 = _utils$global.ReadableStream,
  3299. TextEncoder = _utils$global.TextEncoder;
  3300. var test = function test(fn) {
  3301. try {
  3302. for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  3303. args[_key - 1] = arguments[_key];
  3304. }
  3305. return !!fn.apply(void 0, args);
  3306. } catch (e) {
  3307. return false;
  3308. }
  3309. };
  3310. var factory = function factory(env) {
  3311. env = utils$1.merge.call({
  3312. skipUndefined: true
  3313. }, globalFetchAPI, env);
  3314. var _env = env,
  3315. envFetch = _env.fetch,
  3316. Request = _env.Request,
  3317. Response = _env.Response;
  3318. var isFetchSupported = envFetch ? isFunction(envFetch) : typeof fetch === 'function';
  3319. var isRequestSupported = isFunction(Request);
  3320. var isResponseSupported = isFunction(Response);
  3321. if (!isFetchSupported) {
  3322. return false;
  3323. }
  3324. var isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream$1);
  3325. var encodeText = isFetchSupported && (typeof TextEncoder === 'function' ? function (encoder) {
  3326. return function (str) {
  3327. return encoder.encode(str);
  3328. };
  3329. }(new TextEncoder()) : (/*#__PURE__*/function () {
  3330. var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(str) {
  3331. var _t, _t2;
  3332. return _regenerator().w(function (_context) {
  3333. while (1) switch (_context.n) {
  3334. case 0:
  3335. _t = Uint8Array;
  3336. _context.n = 1;
  3337. return new Request(str).arrayBuffer();
  3338. case 1:
  3339. _t2 = _context.v;
  3340. return _context.a(2, new _t(_t2));
  3341. }
  3342. }, _callee);
  3343. }));
  3344. return function (_x) {
  3345. return _ref2.apply(this, arguments);
  3346. };
  3347. }()));
  3348. var supportsRequestStream = isRequestSupported && isReadableStreamSupported && test(function () {
  3349. var duplexAccessed = false;
  3350. var request = new Request(platform.origin, {
  3351. body: new ReadableStream$1(),
  3352. method: 'POST',
  3353. get duplex() {
  3354. duplexAccessed = true;
  3355. return 'half';
  3356. }
  3357. });
  3358. var hasContentType = request.headers.has('Content-Type');
  3359. if (request.body != null) {
  3360. request.body.cancel();
  3361. }
  3362. return duplexAccessed && !hasContentType;
  3363. });
  3364. var supportsResponseStream = isResponseSupported && isReadableStreamSupported && test(function () {
  3365. return utils$1.isReadableStream(new Response('').body);
  3366. });
  3367. var resolvers = {
  3368. stream: supportsResponseStream && function (res) {
  3369. return res.body;
  3370. }
  3371. };
  3372. isFetchSupported && function () {
  3373. ['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(function (type) {
  3374. !resolvers[type] && (resolvers[type] = function (res, config) {
  3375. var method = res && res[type];
  3376. if (method) {
  3377. return method.call(res);
  3378. }
  3379. throw new AxiosError("Response type '".concat(type, "' is not supported"), AxiosError.ERR_NOT_SUPPORT, config);
  3380. });
  3381. });
  3382. }();
  3383. var getBodyLength = /*#__PURE__*/function () {
  3384. var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(body) {
  3385. var _request;
  3386. return _regenerator().w(function (_context2) {
  3387. while (1) switch (_context2.n) {
  3388. case 0:
  3389. if (!(body == null)) {
  3390. _context2.n = 1;
  3391. break;
  3392. }
  3393. return _context2.a(2, 0);
  3394. case 1:
  3395. if (!utils$1.isBlob(body)) {
  3396. _context2.n = 2;
  3397. break;
  3398. }
  3399. return _context2.a(2, body.size);
  3400. case 2:
  3401. if (!utils$1.isSpecCompliantForm(body)) {
  3402. _context2.n = 4;
  3403. break;
  3404. }
  3405. _request = new Request(platform.origin, {
  3406. method: 'POST',
  3407. body: body
  3408. });
  3409. _context2.n = 3;
  3410. return _request.arrayBuffer();
  3411. case 3:
  3412. return _context2.a(2, _context2.v.byteLength);
  3413. case 4:
  3414. if (!(utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body))) {
  3415. _context2.n = 5;
  3416. break;
  3417. }
  3418. return _context2.a(2, body.byteLength);
  3419. case 5:
  3420. if (utils$1.isURLSearchParams(body)) {
  3421. body = body + '';
  3422. }
  3423. if (!utils$1.isString(body)) {
  3424. _context2.n = 7;
  3425. break;
  3426. }
  3427. _context2.n = 6;
  3428. return encodeText(body);
  3429. case 6:
  3430. return _context2.a(2, _context2.v.byteLength);
  3431. case 7:
  3432. return _context2.a(2);
  3433. }
  3434. }, _callee2);
  3435. }));
  3436. return function getBodyLength(_x2) {
  3437. return _ref3.apply(this, arguments);
  3438. };
  3439. }();
  3440. var resolveBodyLength = /*#__PURE__*/function () {
  3441. var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(headers, body) {
  3442. var length;
  3443. return _regenerator().w(function (_context3) {
  3444. while (1) switch (_context3.n) {
  3445. case 0:
  3446. length = utils$1.toFiniteNumber(headers.getContentLength());
  3447. return _context3.a(2, length == null ? getBodyLength(body) : length);
  3448. }
  3449. }, _callee3);
  3450. }));
  3451. return function resolveBodyLength(_x3, _x4) {
  3452. return _ref4.apply(this, arguments);
  3453. };
  3454. }();
  3455. return /*#__PURE__*/function () {
  3456. var _ref5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(config) {
  3457. var _resolveConfig, url, method, data, signal, cancelToken, timeout, onDownloadProgress, onUploadProgress, responseType, headers, _resolveConfig$withCr, withCredentials, fetchOptions, _fetch, composedSignal, request, unsubscribe, requestContentLength, _request, contentTypeHeader, _progressEventDecorat, _progressEventDecorat2, onProgress, flush, isCredentialsSupported, contentType, resolvedOptions, response, isStreamResponse, options, responseContentLength, _ref6, _ref7, _onProgress, _flush, responseData, _t3, _t4, _t5;
  3458. return _regenerator().w(function (_context4) {
  3459. while (1) switch (_context4.p = _context4.n) {
  3460. case 0:
  3461. _resolveConfig = resolveConfig(config), url = _resolveConfig.url, method = _resolveConfig.method, data = _resolveConfig.data, signal = _resolveConfig.signal, cancelToken = _resolveConfig.cancelToken, timeout = _resolveConfig.timeout, onDownloadProgress = _resolveConfig.onDownloadProgress, onUploadProgress = _resolveConfig.onUploadProgress, responseType = _resolveConfig.responseType, headers = _resolveConfig.headers, _resolveConfig$withCr = _resolveConfig.withCredentials, withCredentials = _resolveConfig$withCr === void 0 ? 'same-origin' : _resolveConfig$withCr, fetchOptions = _resolveConfig.fetchOptions;
  3462. _fetch = envFetch || fetch;
  3463. responseType = responseType ? (responseType + '').toLowerCase() : 'text';
  3464. composedSignal = composeSignals([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
  3465. request = null;
  3466. unsubscribe = composedSignal && composedSignal.unsubscribe && function () {
  3467. composedSignal.unsubscribe();
  3468. };
  3469. _context4.p = 1;
  3470. _t3 = onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head';
  3471. if (!_t3) {
  3472. _context4.n = 3;
  3473. break;
  3474. }
  3475. _context4.n = 2;
  3476. return resolveBodyLength(headers, data);
  3477. case 2:
  3478. _t4 = requestContentLength = _context4.v;
  3479. _t3 = _t4 !== 0;
  3480. case 3:
  3481. if (!_t3) {
  3482. _context4.n = 4;
  3483. break;
  3484. }
  3485. _request = new Request(url, {
  3486. method: 'POST',
  3487. body: data,
  3488. duplex: 'half'
  3489. });
  3490. if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
  3491. headers.setContentType(contentTypeHeader);
  3492. }
  3493. if (_request.body) {
  3494. _progressEventDecorat = progressEventDecorator(requestContentLength, progressEventReducer(asyncDecorator(onUploadProgress))), _progressEventDecorat2 = _slicedToArray(_progressEventDecorat, 2), onProgress = _progressEventDecorat2[0], flush = _progressEventDecorat2[1];
  3495. data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
  3496. }
  3497. case 4:
  3498. if (!utils$1.isString(withCredentials)) {
  3499. withCredentials = withCredentials ? 'include' : 'omit';
  3500. }
  3501. // Cloudflare Workers throws when credentials are defined
  3502. // see https://github.com/cloudflare/workerd/issues/902
  3503. isCredentialsSupported = isRequestSupported && 'credentials' in Request.prototype; // If data is FormData and Content-Type is multipart/form-data without boundary,
  3504. // delete it so fetch can set it correctly with the boundary
  3505. if (utils$1.isFormData(data)) {
  3506. contentType = headers.getContentType();
  3507. if (contentType && /^multipart\/form-data/i.test(contentType) && !/boundary=/i.test(contentType)) {
  3508. headers["delete"]('content-type');
  3509. }
  3510. }
  3511. resolvedOptions = _objectSpread2(_objectSpread2({}, fetchOptions), {}, {
  3512. signal: composedSignal,
  3513. method: method.toUpperCase(),
  3514. headers: headers.normalize().toJSON(),
  3515. body: data,
  3516. duplex: 'half',
  3517. credentials: isCredentialsSupported ? withCredentials : undefined
  3518. });
  3519. request = isRequestSupported && new Request(url, resolvedOptions);
  3520. _context4.n = 5;
  3521. return isRequestSupported ? _fetch(request, fetchOptions) : _fetch(url, resolvedOptions);
  3522. case 5:
  3523. response = _context4.v;
  3524. isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
  3525. if (supportsResponseStream && (onDownloadProgress || isStreamResponse && unsubscribe)) {
  3526. options = {};
  3527. ['status', 'statusText', 'headers'].forEach(function (prop) {
  3528. options[prop] = response[prop];
  3529. });
  3530. responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
  3531. _ref6 = onDownloadProgress && progressEventDecorator(responseContentLength, progressEventReducer(asyncDecorator(onDownloadProgress), true)) || [], _ref7 = _slicedToArray(_ref6, 2), _onProgress = _ref7[0], _flush = _ref7[1];
  3532. response = new Response(trackStream(response.body, DEFAULT_CHUNK_SIZE, _onProgress, function () {
  3533. _flush && _flush();
  3534. unsubscribe && unsubscribe();
  3535. }), options);
  3536. }
  3537. responseType = responseType || 'text';
  3538. _context4.n = 6;
  3539. return resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config);
  3540. case 6:
  3541. responseData = _context4.v;
  3542. !isStreamResponse && unsubscribe && unsubscribe();
  3543. _context4.n = 7;
  3544. return new Promise(function (resolve, reject) {
  3545. settle(resolve, reject, {
  3546. data: responseData,
  3547. headers: AxiosHeaders.from(response.headers),
  3548. status: response.status,
  3549. statusText: response.statusText,
  3550. config: config,
  3551. request: request
  3552. });
  3553. });
  3554. case 7:
  3555. return _context4.a(2, _context4.v);
  3556. case 8:
  3557. _context4.p = 8;
  3558. _t5 = _context4.v;
  3559. unsubscribe && unsubscribe();
  3560. if (!(_t5 && _t5.name === 'TypeError' && /Load failed|fetch/i.test(_t5.message))) {
  3561. _context4.n = 9;
  3562. break;
  3563. }
  3564. throw Object.assign(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request, _t5 && _t5.response), {
  3565. cause: _t5.cause || _t5
  3566. });
  3567. case 9:
  3568. throw AxiosError.from(_t5, _t5 && _t5.code, config, request, _t5 && _t5.response);
  3569. case 10:
  3570. return _context4.a(2);
  3571. }
  3572. }, _callee4, null, [[1, 8]]);
  3573. }));
  3574. return function (_x5) {
  3575. return _ref5.apply(this, arguments);
  3576. };
  3577. }();
  3578. };
  3579. var seedCache = new Map();
  3580. var getFetch = function getFetch(config) {
  3581. var env = config && config.env || {};
  3582. var fetch = env.fetch,
  3583. Request = env.Request,
  3584. Response = env.Response;
  3585. var seeds = [Request, Response, fetch];
  3586. var len = seeds.length,
  3587. i = len,
  3588. seed,
  3589. target,
  3590. map = seedCache;
  3591. while (i--) {
  3592. seed = seeds[i];
  3593. target = map.get(seed);
  3594. target === undefined && map.set(seed, target = i ? new Map() : factory(env));
  3595. map = target;
  3596. }
  3597. return target;
  3598. };
  3599. getFetch();
  3600. /**
  3601. * Known adapters mapping.
  3602. * Provides environment-specific adapters for Axios:
  3603. * - `http` for Node.js
  3604. * - `xhr` for browsers
  3605. * - `fetch` for fetch API-based requests
  3606. *
  3607. * @type {Object<string, Function|Object>}
  3608. */
  3609. var knownAdapters = {
  3610. http: httpAdapter,
  3611. xhr: xhrAdapter,
  3612. fetch: {
  3613. get: getFetch
  3614. }
  3615. };
  3616. // Assign adapter names for easier debugging and identification
  3617. utils$1.forEach(knownAdapters, function (fn, value) {
  3618. if (fn) {
  3619. try {
  3620. Object.defineProperty(fn, 'name', {
  3621. value: value
  3622. });
  3623. } catch (e) {
  3624. // eslint-disable-next-line no-empty
  3625. }
  3626. Object.defineProperty(fn, 'adapterName', {
  3627. value: value
  3628. });
  3629. }
  3630. });
  3631. /**
  3632. * Render a rejection reason string for unknown or unsupported adapters
  3633. *
  3634. * @param {string} reason
  3635. * @returns {string}
  3636. */
  3637. var renderReason = function renderReason(reason) {
  3638. return "- ".concat(reason);
  3639. };
  3640. /**
  3641. * Check if the adapter is resolved (function, null, or false)
  3642. *
  3643. * @param {Function|null|false} adapter
  3644. * @returns {boolean}
  3645. */
  3646. var isResolvedHandle = function isResolvedHandle(adapter) {
  3647. return utils$1.isFunction(adapter) || adapter === null || adapter === false;
  3648. };
  3649. /**
  3650. * Get the first suitable adapter from the provided list.
  3651. * Tries each adapter in order until a supported one is found.
  3652. * Throws an AxiosError if no adapter is suitable.
  3653. *
  3654. * @param {Array<string|Function>|string|Function} adapters - Adapter(s) by name or function.
  3655. * @param {Object} config - Axios request configuration
  3656. * @throws {AxiosError} If no suitable adapter is available
  3657. * @returns {Function} The resolved adapter function
  3658. */
  3659. function getAdapter(adapters, config) {
  3660. adapters = utils$1.isArray(adapters) ? adapters : [adapters];
  3661. var _adapters = adapters,
  3662. length = _adapters.length;
  3663. var nameOrAdapter;
  3664. var adapter;
  3665. var rejectedReasons = {};
  3666. for (var i = 0; i < length; i++) {
  3667. nameOrAdapter = adapters[i];
  3668. var id = void 0;
  3669. adapter = nameOrAdapter;
  3670. if (!isResolvedHandle(nameOrAdapter)) {
  3671. adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
  3672. if (adapter === undefined) {
  3673. throw new AxiosError("Unknown adapter '".concat(id, "'"));
  3674. }
  3675. }
  3676. if (adapter && (utils$1.isFunction(adapter) || (adapter = adapter.get(config)))) {
  3677. break;
  3678. }
  3679. rejectedReasons[id || '#' + i] = adapter;
  3680. }
  3681. if (!adapter) {
  3682. var reasons = Object.entries(rejectedReasons).map(function (_ref) {
  3683. var _ref2 = _slicedToArray(_ref, 2),
  3684. id = _ref2[0],
  3685. state = _ref2[1];
  3686. return "adapter ".concat(id, " ") + (state === false ? 'is not supported by the environment' : 'is not available in the build');
  3687. });
  3688. var s = length ? reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0]) : 'as no adapter specified';
  3689. throw new AxiosError("There is no suitable adapter to dispatch the request " + s, 'ERR_NOT_SUPPORT');
  3690. }
  3691. return adapter;
  3692. }
  3693. /**
  3694. * Exports Axios adapters and utility to resolve an adapter
  3695. */
  3696. var adapters = {
  3697. /**
  3698. * Resolve an adapter from a list of adapter names or functions.
  3699. * @type {Function}
  3700. */
  3701. getAdapter: getAdapter,
  3702. /**
  3703. * Exposes all known adapters
  3704. * @type {Object<string, Function|Object>}
  3705. */
  3706. adapters: knownAdapters
  3707. };
  3708. /**
  3709. * Throws a `CanceledError` if cancellation has been requested.
  3710. *
  3711. * @param {Object} config The config that is to be used for the request
  3712. *
  3713. * @returns {void}
  3714. */
  3715. function throwIfCancellationRequested(config) {
  3716. if (config.cancelToken) {
  3717. config.cancelToken.throwIfRequested();
  3718. }
  3719. if (config.signal && config.signal.aborted) {
  3720. throw new CanceledError(null, config);
  3721. }
  3722. }
  3723. /**
  3724. * Dispatch a request to the server using the configured adapter.
  3725. *
  3726. * @param {object} config The config that is to be used for the request
  3727. *
  3728. * @returns {Promise} The Promise to be fulfilled
  3729. */
  3730. function dispatchRequest(config) {
  3731. throwIfCancellationRequested(config);
  3732. config.headers = AxiosHeaders.from(config.headers);
  3733. // Transform request data
  3734. config.data = transformData.call(config, config.transformRequest);
  3735. if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {
  3736. config.headers.setContentType('application/x-www-form-urlencoded', false);
  3737. }
  3738. var adapter = adapters.getAdapter(config.adapter || defaults.adapter, config);
  3739. return adapter(config).then(function onAdapterResolution(response) {
  3740. throwIfCancellationRequested(config);
  3741. // Transform response data
  3742. response.data = transformData.call(config, config.transformResponse, response);
  3743. response.headers = AxiosHeaders.from(response.headers);
  3744. return response;
  3745. }, function onAdapterRejection(reason) {
  3746. if (!isCancel(reason)) {
  3747. throwIfCancellationRequested(config);
  3748. // Transform response data
  3749. if (reason && reason.response) {
  3750. reason.response.data = transformData.call(config, config.transformResponse, reason.response);
  3751. reason.response.headers = AxiosHeaders.from(reason.response.headers);
  3752. }
  3753. }
  3754. return Promise.reject(reason);
  3755. });
  3756. }
  3757. var VERSION = "1.15.2";
  3758. var validators$1 = {};
  3759. // eslint-disable-next-line func-names
  3760. ['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach(function (type, i) {
  3761. validators$1[type] = function validator(thing) {
  3762. return _typeof(thing) === type || 'a' + (i < 1 ? 'n ' : ' ') + type;
  3763. };
  3764. });
  3765. var deprecatedWarnings = {};
  3766. /**
  3767. * Transitional option validator
  3768. *
  3769. * @param {function|boolean?} validator - set to false if the transitional option has been removed
  3770. * @param {string?} version - deprecated version / removed since version
  3771. * @param {string?} message - some message with additional info
  3772. *
  3773. * @returns {function}
  3774. */
  3775. validators$1.transitional = function transitional(validator, version, message) {
  3776. function formatMessage(opt, desc) {
  3777. return '[Axios v' + VERSION + "] Transitional option '" + opt + "'" + desc + (message ? '. ' + message : '');
  3778. }
  3779. // eslint-disable-next-line func-names
  3780. return function (value, opt, opts) {
  3781. if (validator === false) {
  3782. throw new AxiosError(formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')), AxiosError.ERR_DEPRECATED);
  3783. }
  3784. if (version && !deprecatedWarnings[opt]) {
  3785. deprecatedWarnings[opt] = true;
  3786. // eslint-disable-next-line no-console
  3787. console.warn(formatMessage(opt, ' has been deprecated since v' + version + ' and will be removed in the near future'));
  3788. }
  3789. return validator ? validator(value, opt, opts) : true;
  3790. };
  3791. };
  3792. validators$1.spelling = function spelling(correctSpelling) {
  3793. return function (value, opt) {
  3794. // eslint-disable-next-line no-console
  3795. console.warn("".concat(opt, " is likely a misspelling of ").concat(correctSpelling));
  3796. return true;
  3797. };
  3798. };
  3799. /**
  3800. * Assert object's properties type
  3801. *
  3802. * @param {object} options
  3803. * @param {object} schema
  3804. * @param {boolean?} allowUnknown
  3805. *
  3806. * @returns {object}
  3807. */
  3808. function assertOptions(options, schema, allowUnknown) {
  3809. if (_typeof(options) !== 'object') {
  3810. throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE);
  3811. }
  3812. var keys = Object.keys(options);
  3813. var i = keys.length;
  3814. while (i-- > 0) {
  3815. var opt = keys[i];
  3816. // Use hasOwnProperty so a polluted Object.prototype.<opt> cannot supply
  3817. // a non-function validator and cause a TypeError. See GHSA-q8qp-cvcw-x6jj.
  3818. var validator = Object.prototype.hasOwnProperty.call(schema, opt) ? schema[opt] : undefined;
  3819. if (validator) {
  3820. var value = options[opt];
  3821. var result = value === undefined || validator(value, opt, options);
  3822. if (result !== true) {
  3823. throw new AxiosError('option ' + opt + ' must be ' + result, AxiosError.ERR_BAD_OPTION_VALUE);
  3824. }
  3825. continue;
  3826. }
  3827. if (allowUnknown !== true) {
  3828. throw new AxiosError('Unknown option ' + opt, AxiosError.ERR_BAD_OPTION);
  3829. }
  3830. }
  3831. }
  3832. var validator = {
  3833. assertOptions: assertOptions,
  3834. validators: validators$1
  3835. };
  3836. var validators = validator.validators;
  3837. /**
  3838. * Create a new instance of Axios
  3839. *
  3840. * @param {Object} instanceConfig The default config for the instance
  3841. *
  3842. * @return {Axios} A new instance of Axios
  3843. */
  3844. var Axios = /*#__PURE__*/function () {
  3845. function Axios(instanceConfig) {
  3846. _classCallCheck(this, Axios);
  3847. this.defaults = instanceConfig || {};
  3848. this.interceptors = {
  3849. request: new InterceptorManager(),
  3850. response: new InterceptorManager()
  3851. };
  3852. }
  3853. /**
  3854. * Dispatch a request
  3855. *
  3856. * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
  3857. * @param {?Object} config
  3858. *
  3859. * @returns {Promise} The Promise to be fulfilled
  3860. */
  3861. return _createClass(Axios, [{
  3862. key: "request",
  3863. value: (function () {
  3864. var _request2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(configOrUrl, config) {
  3865. var dummy, stack, firstNewlineIndex, secondNewlineIndex, stackWithoutTwoTopLines, _t;
  3866. return _regenerator().w(function (_context) {
  3867. while (1) switch (_context.p = _context.n) {
  3868. case 0:
  3869. _context.p = 0;
  3870. _context.n = 1;
  3871. return this._request(configOrUrl, config);
  3872. case 1:
  3873. return _context.a(2, _context.v);
  3874. case 2:
  3875. _context.p = 2;
  3876. _t = _context.v;
  3877. if (_t instanceof Error) {
  3878. dummy = {};
  3879. Error.captureStackTrace ? Error.captureStackTrace(dummy) : dummy = new Error();
  3880. // slice off the Error: ... line
  3881. stack = function () {
  3882. if (!dummy.stack) {
  3883. return '';
  3884. }
  3885. var firstNewlineIndex = dummy.stack.indexOf('\n');
  3886. return firstNewlineIndex === -1 ? '' : dummy.stack.slice(firstNewlineIndex + 1);
  3887. }();
  3888. try {
  3889. if (!_t.stack) {
  3890. _t.stack = stack;
  3891. // match without the 2 top stack lines
  3892. } else if (stack) {
  3893. firstNewlineIndex = stack.indexOf('\n');
  3894. secondNewlineIndex = firstNewlineIndex === -1 ? -1 : stack.indexOf('\n', firstNewlineIndex + 1);
  3895. stackWithoutTwoTopLines = secondNewlineIndex === -1 ? '' : stack.slice(secondNewlineIndex + 1);
  3896. if (!String(_t.stack).endsWith(stackWithoutTwoTopLines)) {
  3897. _t.stack += '\n' + stack;
  3898. }
  3899. }
  3900. } catch (e) {
  3901. // ignore the case where "stack" is an un-writable property
  3902. }
  3903. }
  3904. throw _t;
  3905. case 3:
  3906. return _context.a(2);
  3907. }
  3908. }, _callee, this, [[0, 2]]);
  3909. }));
  3910. function request(_x, _x2) {
  3911. return _request2.apply(this, arguments);
  3912. }
  3913. return request;
  3914. }())
  3915. }, {
  3916. key: "_request",
  3917. value: function _request(configOrUrl, config) {
  3918. /*eslint no-param-reassign:0*/
  3919. // Allow for axios('example/url'[, config]) a la fetch API
  3920. if (typeof configOrUrl === 'string') {
  3921. config = config || {};
  3922. config.url = configOrUrl;
  3923. } else {
  3924. config = configOrUrl || {};
  3925. }
  3926. config = mergeConfig(this.defaults, config);
  3927. var _config = config,
  3928. transitional = _config.transitional,
  3929. paramsSerializer = _config.paramsSerializer,
  3930. headers = _config.headers;
  3931. if (transitional !== undefined) {
  3932. validator.assertOptions(transitional, {
  3933. silentJSONParsing: validators.transitional(validators["boolean"]),
  3934. forcedJSONParsing: validators.transitional(validators["boolean"]),
  3935. clarifyTimeoutError: validators.transitional(validators["boolean"]),
  3936. legacyInterceptorReqResOrdering: validators.transitional(validators["boolean"])
  3937. }, false);
  3938. }
  3939. if (paramsSerializer != null) {
  3940. if (utils$1.isFunction(paramsSerializer)) {
  3941. config.paramsSerializer = {
  3942. serialize: paramsSerializer
  3943. };
  3944. } else {
  3945. validator.assertOptions(paramsSerializer, {
  3946. encode: validators["function"],
  3947. serialize: validators["function"]
  3948. }, true);
  3949. }
  3950. }
  3951. // Set config.allowAbsoluteUrls
  3952. if (config.allowAbsoluteUrls !== undefined) ; else if (this.defaults.allowAbsoluteUrls !== undefined) {
  3953. config.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls;
  3954. } else {
  3955. config.allowAbsoluteUrls = true;
  3956. }
  3957. validator.assertOptions(config, {
  3958. baseUrl: validators.spelling('baseURL'),
  3959. withXsrfToken: validators.spelling('withXSRFToken')
  3960. }, true);
  3961. // Set config.method
  3962. config.method = (config.method || this.defaults.method || 'get').toLowerCase();
  3963. // Flatten headers
  3964. var contextHeaders = headers && utils$1.merge(headers.common, headers[config.method]);
  3965. headers && utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], function (method) {
  3966. delete headers[method];
  3967. });
  3968. config.headers = AxiosHeaders.concat(contextHeaders, headers);
  3969. // filter out skipped interceptors
  3970. var requestInterceptorChain = [];
  3971. var synchronousRequestInterceptors = true;
  3972. this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
  3973. if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {
  3974. return;
  3975. }
  3976. synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
  3977. var transitional = config.transitional || transitionalDefaults;
  3978. var legacyInterceptorReqResOrdering = transitional && transitional.legacyInterceptorReqResOrdering;
  3979. if (legacyInterceptorReqResOrdering) {
  3980. requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
  3981. } else {
  3982. requestInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
  3983. }
  3984. });
  3985. var responseInterceptorChain = [];
  3986. this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
  3987. responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
  3988. });
  3989. var promise;
  3990. var i = 0;
  3991. var len;
  3992. if (!synchronousRequestInterceptors) {
  3993. var chain = [dispatchRequest.bind(this), undefined];
  3994. chain.unshift.apply(chain, requestInterceptorChain);
  3995. chain.push.apply(chain, responseInterceptorChain);
  3996. len = chain.length;
  3997. promise = Promise.resolve(config);
  3998. while (i < len) {
  3999. promise = promise.then(chain[i++], chain[i++]);
  4000. }
  4001. return promise;
  4002. }
  4003. len = requestInterceptorChain.length;
  4004. var newConfig = config;
  4005. while (i < len) {
  4006. var onFulfilled = requestInterceptorChain[i++];
  4007. var onRejected = requestInterceptorChain[i++];
  4008. try {
  4009. newConfig = onFulfilled(newConfig);
  4010. } catch (error) {
  4011. onRejected.call(this, error);
  4012. break;
  4013. }
  4014. }
  4015. try {
  4016. promise = dispatchRequest.call(this, newConfig);
  4017. } catch (error) {
  4018. return Promise.reject(error);
  4019. }
  4020. i = 0;
  4021. len = responseInterceptorChain.length;
  4022. while (i < len) {
  4023. promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);
  4024. }
  4025. return promise;
  4026. }
  4027. }, {
  4028. key: "getUri",
  4029. value: function getUri(config) {
  4030. config = mergeConfig(this.defaults, config);
  4031. var fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
  4032. return buildURL(fullPath, config.params, config.paramsSerializer);
  4033. }
  4034. }]);
  4035. }(); // Provide aliases for supported request methods
  4036. utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
  4037. /*eslint func-names:0*/
  4038. Axios.prototype[method] = function (url, config) {
  4039. return this.request(mergeConfig(config || {}, {
  4040. method: method,
  4041. url: url,
  4042. data: (config || {}).data
  4043. }));
  4044. };
  4045. });
  4046. utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
  4047. function generateHTTPMethod(isForm) {
  4048. return function httpMethod(url, data, config) {
  4049. return this.request(mergeConfig(config || {}, {
  4050. method: method,
  4051. headers: isForm ? {
  4052. 'Content-Type': 'multipart/form-data'
  4053. } : {},
  4054. url: url,
  4055. data: data
  4056. }));
  4057. };
  4058. }
  4059. Axios.prototype[method] = generateHTTPMethod();
  4060. Axios.prototype[method + 'Form'] = generateHTTPMethod(true);
  4061. });
  4062. /**
  4063. * A `CancelToken` is an object that can be used to request cancellation of an operation.
  4064. *
  4065. * @param {Function} executor The executor function.
  4066. *
  4067. * @returns {CancelToken}
  4068. */
  4069. var CancelToken = /*#__PURE__*/function () {
  4070. function CancelToken(executor) {
  4071. _classCallCheck(this, CancelToken);
  4072. if (typeof executor !== 'function') {
  4073. throw new TypeError('executor must be a function.');
  4074. }
  4075. var resolvePromise;
  4076. this.promise = new Promise(function promiseExecutor(resolve) {
  4077. resolvePromise = resolve;
  4078. });
  4079. var token = this;
  4080. // eslint-disable-next-line func-names
  4081. this.promise.then(function (cancel) {
  4082. if (!token._listeners) return;
  4083. var i = token._listeners.length;
  4084. while (i-- > 0) {
  4085. token._listeners[i](cancel);
  4086. }
  4087. token._listeners = null;
  4088. });
  4089. // eslint-disable-next-line func-names
  4090. this.promise.then = function (onfulfilled) {
  4091. var _resolve;
  4092. // eslint-disable-next-line func-names
  4093. var promise = new Promise(function (resolve) {
  4094. token.subscribe(resolve);
  4095. _resolve = resolve;
  4096. }).then(onfulfilled);
  4097. promise.cancel = function reject() {
  4098. token.unsubscribe(_resolve);
  4099. };
  4100. return promise;
  4101. };
  4102. executor(function cancel(message, config, request) {
  4103. if (token.reason) {
  4104. // Cancellation has already been requested
  4105. return;
  4106. }
  4107. token.reason = new CanceledError(message, config, request);
  4108. resolvePromise(token.reason);
  4109. });
  4110. }
  4111. /**
  4112. * Throws a `CanceledError` if cancellation has been requested.
  4113. */
  4114. return _createClass(CancelToken, [{
  4115. key: "throwIfRequested",
  4116. value: function throwIfRequested() {
  4117. if (this.reason) {
  4118. throw this.reason;
  4119. }
  4120. }
  4121. /**
  4122. * Subscribe to the cancel signal
  4123. */
  4124. }, {
  4125. key: "subscribe",
  4126. value: function subscribe(listener) {
  4127. if (this.reason) {
  4128. listener(this.reason);
  4129. return;
  4130. }
  4131. if (this._listeners) {
  4132. this._listeners.push(listener);
  4133. } else {
  4134. this._listeners = [listener];
  4135. }
  4136. }
  4137. /**
  4138. * Unsubscribe from the cancel signal
  4139. */
  4140. }, {
  4141. key: "unsubscribe",
  4142. value: function unsubscribe(listener) {
  4143. if (!this._listeners) {
  4144. return;
  4145. }
  4146. var index = this._listeners.indexOf(listener);
  4147. if (index !== -1) {
  4148. this._listeners.splice(index, 1);
  4149. }
  4150. }
  4151. }, {
  4152. key: "toAbortSignal",
  4153. value: function toAbortSignal() {
  4154. var _this = this;
  4155. var controller = new AbortController();
  4156. var abort = function abort(err) {
  4157. controller.abort(err);
  4158. };
  4159. this.subscribe(abort);
  4160. controller.signal.unsubscribe = function () {
  4161. return _this.unsubscribe(abort);
  4162. };
  4163. return controller.signal;
  4164. }
  4165. /**
  4166. * Returns an object that contains a new `CancelToken` and a function that, when called,
  4167. * cancels the `CancelToken`.
  4168. */
  4169. }], [{
  4170. key: "source",
  4171. value: function source() {
  4172. var cancel;
  4173. var token = new CancelToken(function executor(c) {
  4174. cancel = c;
  4175. });
  4176. return {
  4177. token: token,
  4178. cancel: cancel
  4179. };
  4180. }
  4181. }]);
  4182. }();
  4183. /**
  4184. * Syntactic sugar for invoking a function and expanding an array for arguments.
  4185. *
  4186. * Common use case would be to use `Function.prototype.apply`.
  4187. *
  4188. * ```js
  4189. * function f(x, y, z) {}
  4190. * const args = [1, 2, 3];
  4191. * f.apply(null, args);
  4192. * ```
  4193. *
  4194. * With `spread` this example can be re-written.
  4195. *
  4196. * ```js
  4197. * spread(function(x, y, z) {})([1, 2, 3]);
  4198. * ```
  4199. *
  4200. * @param {Function} callback
  4201. *
  4202. * @returns {Function}
  4203. */
  4204. function spread(callback) {
  4205. return function wrap(arr) {
  4206. return callback.apply(null, arr);
  4207. };
  4208. }
  4209. /**
  4210. * Determines whether the payload is an error thrown by Axios
  4211. *
  4212. * @param {*} payload The value to test
  4213. *
  4214. * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
  4215. */
  4216. function isAxiosError(payload) {
  4217. return utils$1.isObject(payload) && payload.isAxiosError === true;
  4218. }
  4219. var HttpStatusCode = {
  4220. Continue: 100,
  4221. SwitchingProtocols: 101,
  4222. Processing: 102,
  4223. EarlyHints: 103,
  4224. Ok: 200,
  4225. Created: 201,
  4226. Accepted: 202,
  4227. NonAuthoritativeInformation: 203,
  4228. NoContent: 204,
  4229. ResetContent: 205,
  4230. PartialContent: 206,
  4231. MultiStatus: 207,
  4232. AlreadyReported: 208,
  4233. ImUsed: 226,
  4234. MultipleChoices: 300,
  4235. MovedPermanently: 301,
  4236. Found: 302,
  4237. SeeOther: 303,
  4238. NotModified: 304,
  4239. UseProxy: 305,
  4240. Unused: 306,
  4241. TemporaryRedirect: 307,
  4242. PermanentRedirect: 308,
  4243. BadRequest: 400,
  4244. Unauthorized: 401,
  4245. PaymentRequired: 402,
  4246. Forbidden: 403,
  4247. NotFound: 404,
  4248. MethodNotAllowed: 405,
  4249. NotAcceptable: 406,
  4250. ProxyAuthenticationRequired: 407,
  4251. RequestTimeout: 408,
  4252. Conflict: 409,
  4253. Gone: 410,
  4254. LengthRequired: 411,
  4255. PreconditionFailed: 412,
  4256. PayloadTooLarge: 413,
  4257. UriTooLong: 414,
  4258. UnsupportedMediaType: 415,
  4259. RangeNotSatisfiable: 416,
  4260. ExpectationFailed: 417,
  4261. ImATeapot: 418,
  4262. MisdirectedRequest: 421,
  4263. UnprocessableEntity: 422,
  4264. Locked: 423,
  4265. FailedDependency: 424,
  4266. TooEarly: 425,
  4267. UpgradeRequired: 426,
  4268. PreconditionRequired: 428,
  4269. TooManyRequests: 429,
  4270. RequestHeaderFieldsTooLarge: 431,
  4271. UnavailableForLegalReasons: 451,
  4272. InternalServerError: 500,
  4273. NotImplemented: 501,
  4274. BadGateway: 502,
  4275. ServiceUnavailable: 503,
  4276. GatewayTimeout: 504,
  4277. HttpVersionNotSupported: 505,
  4278. VariantAlsoNegotiates: 506,
  4279. InsufficientStorage: 507,
  4280. LoopDetected: 508,
  4281. NotExtended: 510,
  4282. NetworkAuthenticationRequired: 511,
  4283. WebServerIsDown: 521,
  4284. ConnectionTimedOut: 522,
  4285. OriginIsUnreachable: 523,
  4286. TimeoutOccurred: 524,
  4287. SslHandshakeFailed: 525,
  4288. InvalidSslCertificate: 526
  4289. };
  4290. Object.entries(HttpStatusCode).forEach(function (_ref) {
  4291. var _ref2 = _slicedToArray(_ref, 2),
  4292. key = _ref2[0],
  4293. value = _ref2[1];
  4294. HttpStatusCode[value] = key;
  4295. });
  4296. /**
  4297. * Create an instance of Axios
  4298. *
  4299. * @param {Object} defaultConfig The default config for the instance
  4300. *
  4301. * @returns {Axios} A new instance of Axios
  4302. */
  4303. function createInstance(defaultConfig) {
  4304. var context = new Axios(defaultConfig);
  4305. var instance = bind(Axios.prototype.request, context);
  4306. // Copy axios.prototype to instance
  4307. utils$1.extend(instance, Axios.prototype, context, {
  4308. allOwnKeys: true
  4309. });
  4310. // Copy context to instance
  4311. utils$1.extend(instance, context, null, {
  4312. allOwnKeys: true
  4313. });
  4314. // Factory for creating new instances
  4315. instance.create = function create(instanceConfig) {
  4316. return createInstance(mergeConfig(defaultConfig, instanceConfig));
  4317. };
  4318. return instance;
  4319. }
  4320. // Create the default instance to be exported
  4321. var axios = createInstance(defaults);
  4322. // Expose Axios class to allow class inheritance
  4323. axios.Axios = Axios;
  4324. // Expose Cancel & CancelToken
  4325. axios.CanceledError = CanceledError;
  4326. axios.CancelToken = CancelToken;
  4327. axios.isCancel = isCancel;
  4328. axios.VERSION = VERSION;
  4329. axios.toFormData = toFormData;
  4330. // Expose AxiosError class
  4331. axios.AxiosError = AxiosError;
  4332. // alias for CanceledError for backward compatibility
  4333. axios.Cancel = axios.CanceledError;
  4334. // Expose all/spread
  4335. axios.all = function all(promises) {
  4336. return Promise.all(promises);
  4337. };
  4338. axios.spread = spread;
  4339. // Expose isAxiosError
  4340. axios.isAxiosError = isAxiosError;
  4341. // Expose mergeConfig
  4342. axios.mergeConfig = mergeConfig;
  4343. axios.AxiosHeaders = AxiosHeaders;
  4344. axios.formToJSON = function (thing) {
  4345. return formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
  4346. };
  4347. axios.getAdapter = adapters.getAdapter;
  4348. axios.HttpStatusCode = HttpStatusCode;
  4349. axios["default"] = axios;
  4350. return axios;
  4351. }));
  4352. //# sourceMappingURL=axios.js.map