智慧水务管理系统 - 精河县供水工程综合管理平台

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200
  1. /*! Axios v1.18.0 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 t, n;
  465. function resume(t, n) {
  466. try {
  467. var r = e[t](n),
  468. o = r.value,
  469. u = o instanceof _OverloadYield;
  470. Promise.resolve(u ? o.v : o).then(function (n) {
  471. if (u) {
  472. var i = "return" === t && o.k ? t : "next";
  473. if (!o.k || n.done) return resume(i, n);
  474. n = e[i](n).value;
  475. }
  476. settle(!!r.done, n);
  477. }, function (e) {
  478. resume("throw", e);
  479. });
  480. } catch (e) {
  481. settle(2, e);
  482. }
  483. }
  484. function settle(e, r) {
  485. 2 === e ? t.reject(r) : t.resolve({
  486. value: r,
  487. done: e
  488. }), (t = t.next) ? resume(t.key, t.arg) : n = null;
  489. }
  490. this._invoke = function (e, r) {
  491. return new Promise(function (o, u) {
  492. var i = {
  493. key: e,
  494. arg: r,
  495. resolve: o,
  496. reject: u,
  497. next: null
  498. };
  499. n ? n = n.next = i : (t = n = i, resume(e, r));
  500. });
  501. }, "function" != typeof e.return && (this.return = void 0);
  502. }
  503. AsyncGenerator.prototype["function" == typeof Symbol && Symbol.asyncIterator || "@@asyncIterator"] = function () {
  504. return this;
  505. }, AsyncGenerator.prototype.next = function (e) {
  506. return this._invoke("next", e);
  507. }, AsyncGenerator.prototype.throw = function (e) {
  508. return this._invoke("throw", e);
  509. }, AsyncGenerator.prototype.return = function (e) {
  510. return this._invoke("return", e);
  511. };
  512. function _wrapNativeSuper(t) {
  513. var r = "function" == typeof Map ? new Map() : void 0;
  514. return _wrapNativeSuper = function (t) {
  515. if (null === t || !_isNativeFunction(t)) return t;
  516. if ("function" != typeof t) throw new TypeError("Super expression must either be null or a function");
  517. if (void 0 !== r) {
  518. if (r.has(t)) return r.get(t);
  519. r.set(t, Wrapper);
  520. }
  521. function Wrapper() {
  522. return _construct(t, arguments, _getPrototypeOf(this).constructor);
  523. }
  524. return Wrapper.prototype = Object.create(t.prototype, {
  525. constructor: {
  526. value: Wrapper,
  527. enumerable: false,
  528. writable: true,
  529. configurable: true
  530. }
  531. }), _setPrototypeOf(Wrapper, t);
  532. }, _wrapNativeSuper(t);
  533. }
  534. /**
  535. * Create a bound version of a function with a specified `this` context
  536. *
  537. * @param {Function} fn - The function to bind
  538. * @param {*} thisArg - The value to be passed as the `this` parameter
  539. * @returns {Function} A new function that will call the original function with the specified `this` context
  540. */
  541. function bind(fn, thisArg) {
  542. return function wrap() {
  543. return fn.apply(thisArg, arguments);
  544. };
  545. }
  546. // utils is a library of generic helper functions non-specific to axios
  547. var toString = Object.prototype.toString;
  548. var getPrototypeOf = Object.getPrototypeOf;
  549. var iterator = Symbol.iterator,
  550. toStringTag = Symbol.toStringTag;
  551. /* Creating a function that will check if an object has a property. */
  552. var hasOwnProperty = function (_ref) {
  553. var hasOwnProperty = _ref.hasOwnProperty;
  554. return function (obj, prop) {
  555. return hasOwnProperty.call(obj, prop);
  556. };
  557. }(Object.prototype);
  558. /**
  559. * Walk the prototype chain (excluding the shared Object.prototype) looking for
  560. * an own `prop`. This distinguishes genuine own/inherited members — including
  561. * class accessors and template prototypes — from members injected via
  562. * Object.prototype pollution (e.g. `Object.prototype.username = '...'`), which
  563. * live on Object.prototype itself and are therefore never matched.
  564. *
  565. * @param {*} thing The value whose chain to inspect
  566. * @param {string|symbol} prop The property key to look for
  567. *
  568. * @returns {boolean} True when `prop` is owned below Object.prototype
  569. */
  570. var hasOwnInPrototypeChain = function hasOwnInPrototypeChain(thing, prop) {
  571. var obj = thing;
  572. var seen = [];
  573. while (obj != null && obj !== Object.prototype) {
  574. if (seen.indexOf(obj) !== -1) {
  575. return false;
  576. }
  577. seen.push(obj);
  578. if (hasOwnProperty(obj, prop)) {
  579. return true;
  580. }
  581. obj = getPrototypeOf(obj);
  582. }
  583. return false;
  584. };
  585. /**
  586. * Read `obj[prop]` only when it is safe from Object.prototype pollution. Own
  587. * properties and members inherited from a non-Object.prototype source (a class
  588. * instance or template object) are honored; a value reachable only through a
  589. * polluted Object.prototype is ignored and `undefined` is returned.
  590. *
  591. * @param {*} obj The source object
  592. * @param {string|symbol} prop The property key to read
  593. *
  594. * @returns {*} The resolved value, or undefined when unsafe/absent
  595. */
  596. var getSafeProp = function getSafeProp(obj, prop) {
  597. return obj != null && hasOwnInPrototypeChain(obj, prop) ? obj[prop] : undefined;
  598. };
  599. var kindOf = function (cache) {
  600. return function (thing) {
  601. var str = toString.call(thing);
  602. return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
  603. };
  604. }(Object.create(null));
  605. var kindOfTest = function kindOfTest(type) {
  606. type = type.toLowerCase();
  607. return function (thing) {
  608. return kindOf(thing) === type;
  609. };
  610. };
  611. var typeOfTest = function typeOfTest(type) {
  612. return function (thing) {
  613. return _typeof(thing) === type;
  614. };
  615. };
  616. /**
  617. * Determine if a value is a non-null object
  618. *
  619. * @param {Object} val The value to test
  620. *
  621. * @returns {boolean} True if value is an Array, otherwise false
  622. */
  623. var isArray = Array.isArray;
  624. /**
  625. * Determine if a value is undefined
  626. *
  627. * @param {*} val The value to test
  628. *
  629. * @returns {boolean} True if the value is undefined, otherwise false
  630. */
  631. var isUndefined = typeOfTest('undefined');
  632. /**
  633. * Determine if a value is a Buffer
  634. *
  635. * @param {*} val The value to test
  636. *
  637. * @returns {boolean} True if value is a Buffer, otherwise false
  638. */
  639. function isBuffer(val) {
  640. return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) && isFunction$1(val.constructor.isBuffer) && val.constructor.isBuffer(val);
  641. }
  642. /**
  643. * Determine if a value is an ArrayBuffer
  644. *
  645. * @param {*} val The value to test
  646. *
  647. * @returns {boolean} True if value is an ArrayBuffer, otherwise false
  648. */
  649. var isArrayBuffer = kindOfTest('ArrayBuffer');
  650. /**
  651. * Determine if a value is a view on an ArrayBuffer
  652. *
  653. * @param {*} val The value to test
  654. *
  655. * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
  656. */
  657. function isArrayBufferView(val) {
  658. var result;
  659. if (typeof ArrayBuffer !== 'undefined' && ArrayBuffer.isView) {
  660. result = ArrayBuffer.isView(val);
  661. } else {
  662. result = val && val.buffer && isArrayBuffer(val.buffer);
  663. }
  664. return result;
  665. }
  666. /**
  667. * Determine if a value is a String
  668. *
  669. * @param {*} val The value to test
  670. *
  671. * @returns {boolean} True if value is a String, otherwise false
  672. */
  673. var isString = typeOfTest('string');
  674. /**
  675. * Determine if a value is a Function
  676. *
  677. * @param {*} val The value to test
  678. * @returns {boolean} True if value is a Function, otherwise false
  679. */
  680. var isFunction$1 = typeOfTest('function');
  681. /**
  682. * Determine if a value is a Number
  683. *
  684. * @param {*} val The value to test
  685. *
  686. * @returns {boolean} True if value is a Number, otherwise false
  687. */
  688. var isNumber = typeOfTest('number');
  689. /**
  690. * Determine if a value is an Object
  691. *
  692. * @param {*} thing The value to test
  693. *
  694. * @returns {boolean} True if value is an Object, otherwise false
  695. */
  696. var isObject = function isObject(thing) {
  697. return thing !== null && _typeof(thing) === 'object';
  698. };
  699. /**
  700. * Determine if a value is a Boolean
  701. *
  702. * @param {*} thing The value to test
  703. * @returns {boolean} True if value is a Boolean, otherwise false
  704. */
  705. var isBoolean = function isBoolean(thing) {
  706. return thing === true || thing === false;
  707. };
  708. /**
  709. * Determine if a value is a plain Object
  710. *
  711. * @param {*} val The value to test
  712. *
  713. * @returns {boolean} True if value is a plain Object, otherwise false
  714. */
  715. var isPlainObject = function isPlainObject(val) {
  716. if (!isObject(val)) {
  717. return false;
  718. }
  719. var prototype = getPrototypeOf(val);
  720. return (prototype === null || prototype === Object.prototype || getPrototypeOf(prototype) === null) &&
  721. // Treat any genuine (non-Object.prototype-polluted) Symbol.toStringTag or
  722. // Symbol.iterator as evidence the value is a tagged/iterable type rather
  723. // than a plain object, while ignoring keys injected onto Object.prototype.
  724. !hasOwnInPrototypeChain(val, toStringTag) && !hasOwnInPrototypeChain(val, iterator);
  725. };
  726. /**
  727. * Determine if a value is an empty object (safely handles Buffers)
  728. *
  729. * @param {*} val The value to test
  730. *
  731. * @returns {boolean} True if value is an empty object, otherwise false
  732. */
  733. var isEmptyObject = function isEmptyObject(val) {
  734. // Early return for non-objects or Buffers to prevent RangeError
  735. if (!isObject(val) || isBuffer(val)) {
  736. return false;
  737. }
  738. try {
  739. return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
  740. } catch (e) {
  741. // Fallback for any other objects that might cause RangeError with Object.keys()
  742. return false;
  743. }
  744. };
  745. /**
  746. * Determine if a value is a Date
  747. *
  748. * @param {*} val The value to test
  749. *
  750. * @returns {boolean} True if value is a Date, otherwise false
  751. */
  752. var isDate = kindOfTest('Date');
  753. /**
  754. * Determine if a value is a File
  755. *
  756. * @param {*} val The value to test
  757. *
  758. * @returns {boolean} True if value is a File, otherwise false
  759. */
  760. var isFile = kindOfTest('File');
  761. /**
  762. * Determine if a value is a React Native Blob
  763. * React Native "blob": an object with a `uri` attribute. Optionally, it can
  764. * also have a `name` and `type` attribute to specify filename and content type
  765. *
  766. * @see https://github.com/facebook/react-native/blob/26684cf3adf4094eb6c405d345a75bf8c7c0bf88/Libraries/Network/FormData.js#L68-L71
  767. *
  768. * @param {*} value The value to test
  769. *
  770. * @returns {boolean} True if value is a React Native Blob, otherwise false
  771. */
  772. var isReactNativeBlob = function isReactNativeBlob(value) {
  773. return !!(value && typeof value.uri !== 'undefined');
  774. };
  775. /**
  776. * Determine if environment is React Native
  777. * ReactNative `FormData` has a non-standard `getParts()` method
  778. *
  779. * @param {*} formData The formData to test
  780. *
  781. * @returns {boolean} True if environment is React Native, otherwise false
  782. */
  783. var isReactNative = function isReactNative(formData) {
  784. return formData && typeof formData.getParts !== 'undefined';
  785. };
  786. /**
  787. * Determine if a value is a Blob
  788. *
  789. * @param {*} val The value to test
  790. *
  791. * @returns {boolean} True if value is a Blob, otherwise false
  792. */
  793. var isBlob = kindOfTest('Blob');
  794. /**
  795. * Determine if a value is a FileList
  796. *
  797. * @param {*} val The value to test
  798. *
  799. * @returns {boolean} True if value is a FileList, otherwise false
  800. */
  801. var isFileList = kindOfTest('FileList');
  802. /**
  803. * Determine if a value is a Stream
  804. *
  805. * @param {*} val The value to test
  806. *
  807. * @returns {boolean} True if value is a Stream, otherwise false
  808. */
  809. var isStream = function isStream(val) {
  810. return isObject(val) && isFunction$1(val.pipe);
  811. };
  812. /**
  813. * Determine if a value is a FormData
  814. *
  815. * @param {*} thing The value to test
  816. *
  817. * @returns {boolean} True if value is an FormData, otherwise false
  818. */
  819. function getGlobal() {
  820. if (typeof globalThis !== 'undefined') return globalThis;
  821. if (typeof self !== 'undefined') return self;
  822. if (typeof window !== 'undefined') return window;
  823. if (typeof global !== 'undefined') return global;
  824. return {};
  825. }
  826. var G = getGlobal();
  827. var FormDataCtor = typeof G.FormData !== 'undefined' ? G.FormData : undefined;
  828. var isFormData = function isFormData(thing) {
  829. if (!thing) return false;
  830. if (FormDataCtor && thing instanceof FormDataCtor) return true;
  831. // Reject plain objects inheriting directly from Object.prototype so prototype-pollution gadgets can't spoof FormData.
  832. var proto = getPrototypeOf(thing);
  833. if (!proto || proto === Object.prototype) return false;
  834. if (!isFunction$1(thing.append)) return false;
  835. var kind = kindOf(thing);
  836. return kind === 'formdata' ||
  837. // detect form-data instance
  838. kind === 'object' && isFunction$1(thing.toString) && thing.toString() === '[object FormData]';
  839. };
  840. /**
  841. * Determine if a value is a URLSearchParams object
  842. *
  843. * @param {*} val The value to test
  844. *
  845. * @returns {boolean} True if value is a URLSearchParams object, otherwise false
  846. */
  847. var isURLSearchParams = kindOfTest('URLSearchParams');
  848. var _map = ['ReadableStream', 'Request', 'Response', 'Headers'].map(kindOfTest),
  849. _map2 = _slicedToArray(_map, 4),
  850. isReadableStream = _map2[0],
  851. isRequest = _map2[1],
  852. isResponse = _map2[2],
  853. isHeaders = _map2[3];
  854. /**
  855. * Trim excess whitespace off the beginning and end of a string
  856. *
  857. * @param {String} str The String to trim
  858. *
  859. * @returns {String} The String freed of excess whitespace
  860. */
  861. var trim = function trim(str) {
  862. return str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
  863. };
  864. /**
  865. * Iterate over an Array or an Object invoking a function for each item.
  866. *
  867. * If `obj` is an Array callback will be called passing
  868. * the value, index, and complete array for each item.
  869. *
  870. * If 'obj' is an Object callback will be called passing
  871. * the value, key, and complete object for each property.
  872. *
  873. * @param {Object|Array<unknown>} obj The object to iterate
  874. * @param {Function} fn The callback to invoke for each item
  875. *
  876. * @param {Object} [options]
  877. * @param {Boolean} [options.allOwnKeys = false]
  878. * @returns {any}
  879. */
  880. function forEach(obj, fn) {
  881. var _ref2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
  882. _ref2$allOwnKeys = _ref2.allOwnKeys,
  883. allOwnKeys = _ref2$allOwnKeys === void 0 ? false : _ref2$allOwnKeys;
  884. // Don't bother if no value provided
  885. if (obj === null || typeof obj === 'undefined') {
  886. return;
  887. }
  888. var i;
  889. var l;
  890. // Force an array if not already something iterable
  891. if (_typeof(obj) !== 'object') {
  892. /*eslint no-param-reassign:0*/
  893. obj = [obj];
  894. }
  895. if (isArray(obj)) {
  896. // Iterate over array values
  897. for (i = 0, l = obj.length; i < l; i++) {
  898. fn.call(null, obj[i], i, obj);
  899. }
  900. } else {
  901. // Buffer check
  902. if (isBuffer(obj)) {
  903. return;
  904. }
  905. // Iterate over object keys
  906. var keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
  907. var len = keys.length;
  908. var key;
  909. for (i = 0; i < len; i++) {
  910. key = keys[i];
  911. fn.call(null, obj[key], key, obj);
  912. }
  913. }
  914. }
  915. /**
  916. * Finds a key in an object, case-insensitive, returning the actual key name.
  917. * Returns null if the object is a Buffer or if no match is found.
  918. *
  919. * @param {Object} obj - The object to search.
  920. * @param {string} key - The key to find (case-insensitive).
  921. * @returns {?string} The actual key name if found, otherwise null.
  922. */
  923. function findKey(obj, key) {
  924. if (isBuffer(obj)) {
  925. return null;
  926. }
  927. key = key.toLowerCase();
  928. var keys = Object.keys(obj);
  929. var i = keys.length;
  930. var _key;
  931. while (i-- > 0) {
  932. _key = keys[i];
  933. if (key === _key.toLowerCase()) {
  934. return _key;
  935. }
  936. }
  937. return null;
  938. }
  939. var _global = function () {
  940. /*eslint no-undef:0*/
  941. if (typeof globalThis !== 'undefined') return globalThis;
  942. return typeof self !== 'undefined' ? self : typeof window !== 'undefined' ? window : global;
  943. }();
  944. var isContextDefined = function isContextDefined(context) {
  945. return !isUndefined(context) && context !== _global;
  946. };
  947. /**
  948. * Accepts varargs expecting each argument to be an object, then
  949. * immutably merges the properties of each object and returns result.
  950. *
  951. * When multiple objects contain the same key the later object in
  952. * the arguments list will take precedence.
  953. *
  954. * Example:
  955. *
  956. * ```js
  957. * const result = merge({foo: 123}, {foo: 456});
  958. * console.log(result.foo); // outputs 456
  959. * ```
  960. *
  961. * @param {Object} obj1 Object to merge
  962. *
  963. * @returns {Object} Result of all merge properties
  964. */
  965. function merge() {
  966. var _ref3 = isContextDefined(this) && this || {},
  967. caseless = _ref3.caseless,
  968. skipUndefined = _ref3.skipUndefined;
  969. var result = {};
  970. var assignValue = function assignValue(val, key) {
  971. // Skip dangerous property names to prevent prototype pollution
  972. if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
  973. return;
  974. }
  975. // findKey lowercases the key, so caseless lookup only applies to strings —
  976. // symbol keys are identity-matched.
  977. var targetKey = caseless && typeof key === 'string' && findKey(result, key) || key;
  978. // Read via own-prop only — a bare `result[targetKey]` walks the prototype
  979. // chain, so a polluted Object.prototype value could surface here and get
  980. // copied into the merged result.
  981. var existing = hasOwnProperty(result, targetKey) ? result[targetKey] : undefined;
  982. if (isPlainObject(existing) && isPlainObject(val)) {
  983. result[targetKey] = merge(existing, val);
  984. } else if (isPlainObject(val)) {
  985. result[targetKey] = merge({}, val);
  986. } else if (isArray(val)) {
  987. result[targetKey] = val.slice();
  988. } else if (!skipUndefined || !isUndefined(val)) {
  989. result[targetKey] = val;
  990. }
  991. };
  992. for (var i = 0, l = arguments.length; i < l; i++) {
  993. var source = i < 0 || arguments.length <= i ? undefined : arguments[i];
  994. if (!source || isBuffer(source)) {
  995. continue;
  996. }
  997. forEach(source, assignValue);
  998. if (_typeof(source) !== 'object' || isArray(source)) {
  999. continue;
  1000. }
  1001. var symbols = Object.getOwnPropertySymbols(source);
  1002. for (var j = 0; j < symbols.length; j++) {
  1003. var symbol = symbols[j];
  1004. if (propertyIsEnumerable.call(source, symbol)) {
  1005. assignValue(source[symbol], symbol);
  1006. }
  1007. }
  1008. }
  1009. return result;
  1010. }
  1011. /**
  1012. * Extends object a by mutably adding to it the properties of object b.
  1013. *
  1014. * @param {Object} a The object to be extended
  1015. * @param {Object} b The object to copy properties from
  1016. * @param {Object} thisArg The object to bind function to
  1017. *
  1018. * @param {Object} [options]
  1019. * @param {Boolean} [options.allOwnKeys]
  1020. * @returns {Object} The resulting value of object a
  1021. */
  1022. var extend = function extend(a, b, thisArg) {
  1023. var _ref4 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {},
  1024. allOwnKeys = _ref4.allOwnKeys;
  1025. forEach(b, function (val, key) {
  1026. if (thisArg && isFunction$1(val)) {
  1027. Object.defineProperty(a, key, {
  1028. // Null-proto descriptor so a polluted Object.prototype.get cannot
  1029. // hijack defineProperty's accessor-vs-data resolution.
  1030. __proto__: null,
  1031. value: bind(val, thisArg),
  1032. writable: true,
  1033. enumerable: true,
  1034. configurable: true
  1035. });
  1036. } else {
  1037. Object.defineProperty(a, key, {
  1038. __proto__: null,
  1039. value: val,
  1040. writable: true,
  1041. enumerable: true,
  1042. configurable: true
  1043. });
  1044. }
  1045. }, {
  1046. allOwnKeys: allOwnKeys
  1047. });
  1048. return a;
  1049. };
  1050. /**
  1051. * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
  1052. *
  1053. * @param {string} content with BOM
  1054. *
  1055. * @returns {string} content value without BOM
  1056. */
  1057. var stripBOM = function stripBOM(content) {
  1058. if (content.charCodeAt(0) === 0xfeff) {
  1059. content = content.slice(1);
  1060. }
  1061. return content;
  1062. };
  1063. /**
  1064. * Inherit the prototype methods from one constructor into another
  1065. * @param {function} constructor
  1066. * @param {function} superConstructor
  1067. * @param {object} [props]
  1068. * @param {object} [descriptors]
  1069. *
  1070. * @returns {void}
  1071. */
  1072. var inherits = function inherits(constructor, superConstructor, props, descriptors) {
  1073. constructor.prototype = Object.create(superConstructor.prototype, descriptors);
  1074. Object.defineProperty(constructor.prototype, 'constructor', {
  1075. __proto__: null,
  1076. value: constructor,
  1077. writable: true,
  1078. enumerable: false,
  1079. configurable: true
  1080. });
  1081. Object.defineProperty(constructor, 'super', {
  1082. __proto__: null,
  1083. value: superConstructor.prototype
  1084. });
  1085. props && Object.assign(constructor.prototype, props);
  1086. };
  1087. /**
  1088. * Resolve object with deep prototype chain to a flat object
  1089. * @param {Object} sourceObj source object
  1090. * @param {Object} [destObj]
  1091. * @param {Function|Boolean} [filter]
  1092. * @param {Function} [propFilter]
  1093. *
  1094. * @returns {Object}
  1095. */
  1096. var toFlatObject = function toFlatObject(sourceObj, destObj, filter, propFilter) {
  1097. var props;
  1098. var i;
  1099. var prop;
  1100. var merged = {};
  1101. destObj = destObj || {};
  1102. // eslint-disable-next-line no-eq-null,eqeqeq
  1103. if (sourceObj == null) return destObj;
  1104. do {
  1105. props = Object.getOwnPropertyNames(sourceObj);
  1106. i = props.length;
  1107. while (i-- > 0) {
  1108. prop = props[i];
  1109. if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
  1110. destObj[prop] = sourceObj[prop];
  1111. merged[prop] = true;
  1112. }
  1113. }
  1114. sourceObj = filter !== false && getPrototypeOf(sourceObj);
  1115. } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);
  1116. return destObj;
  1117. };
  1118. /**
  1119. * Determines whether a string ends with the characters of a specified string
  1120. *
  1121. * @param {String} str
  1122. * @param {String} searchString
  1123. * @param {Number} [position= 0]
  1124. *
  1125. * @returns {boolean}
  1126. */
  1127. var endsWith = function endsWith(str, searchString, position) {
  1128. str = String(str);
  1129. if (position === undefined || position > str.length) {
  1130. position = str.length;
  1131. }
  1132. position -= searchString.length;
  1133. var lastIndex = str.indexOf(searchString, position);
  1134. return lastIndex !== -1 && lastIndex === position;
  1135. };
  1136. /**
  1137. * Returns new array from array like object or null if failed
  1138. *
  1139. * @param {*} [thing]
  1140. *
  1141. * @returns {?Array}
  1142. */
  1143. var toArray = function toArray(thing) {
  1144. if (!thing) return null;
  1145. if (isArray(thing)) return thing;
  1146. var i = thing.length;
  1147. if (!isNumber(i)) return null;
  1148. var arr = new Array(i);
  1149. while (i-- > 0) {
  1150. arr[i] = thing[i];
  1151. }
  1152. return arr;
  1153. };
  1154. /**
  1155. * Checking if the Uint8Array exists and if it does, it returns a function that checks if the
  1156. * thing passed in is an instance of Uint8Array
  1157. *
  1158. * @param {TypedArray}
  1159. *
  1160. * @returns {Array}
  1161. */
  1162. // eslint-disable-next-line func-names
  1163. var isTypedArray = function (TypedArray) {
  1164. // eslint-disable-next-line func-names
  1165. return function (thing) {
  1166. return TypedArray && thing instanceof TypedArray;
  1167. };
  1168. }(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array));
  1169. /**
  1170. * For each entry in the object, call the function with the key and value.
  1171. *
  1172. * @param {Object<any, any>} obj - The object to iterate over.
  1173. * @param {Function} fn - The function to call for each entry.
  1174. *
  1175. * @returns {void}
  1176. */
  1177. var forEachEntry = function forEachEntry(obj, fn) {
  1178. var generator = obj && obj[iterator];
  1179. var _iterator = generator.call(obj);
  1180. var result;
  1181. while ((result = _iterator.next()) && !result.done) {
  1182. var pair = result.value;
  1183. fn.call(obj, pair[0], pair[1]);
  1184. }
  1185. };
  1186. /**
  1187. * It takes a regular expression and a string, and returns an array of all the matches
  1188. *
  1189. * @param {string} regExp - The regular expression to match against.
  1190. * @param {string} str - The string to search.
  1191. *
  1192. * @returns {Array<boolean>}
  1193. */
  1194. var matchAll = function matchAll(regExp, str) {
  1195. var matches;
  1196. var arr = [];
  1197. while ((matches = regExp.exec(str)) !== null) {
  1198. arr.push(matches);
  1199. }
  1200. return arr;
  1201. };
  1202. /* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */
  1203. var isHTMLForm = kindOfTest('HTMLFormElement');
  1204. var toCamelCase = function toCamelCase(str) {
  1205. return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g, function replacer(m, p1, p2) {
  1206. return p1.toUpperCase() + p2;
  1207. });
  1208. };
  1209. var propertyIsEnumerable = Object.prototype.propertyIsEnumerable;
  1210. /**
  1211. * Determine if a value is a RegExp object
  1212. *
  1213. * @param {*} val The value to test
  1214. *
  1215. * @returns {boolean} True if value is a RegExp object, otherwise false
  1216. */
  1217. var isRegExp = kindOfTest('RegExp');
  1218. var reduceDescriptors = function reduceDescriptors(obj, reducer) {
  1219. var descriptors = Object.getOwnPropertyDescriptors(obj);
  1220. var reducedDescriptors = {};
  1221. forEach(descriptors, function (descriptor, name) {
  1222. var ret;
  1223. if ((ret = reducer(descriptor, name, obj)) !== false) {
  1224. reducedDescriptors[name] = ret || descriptor;
  1225. }
  1226. });
  1227. Object.defineProperties(obj, reducedDescriptors);
  1228. };
  1229. /**
  1230. * Makes all methods read-only
  1231. * @param {Object} obj
  1232. */
  1233. var freezeMethods = function freezeMethods(obj) {
  1234. reduceDescriptors(obj, function (descriptor, name) {
  1235. // skip restricted props in strict mode
  1236. if (isFunction$1(obj) && ['arguments', 'caller', 'callee'].includes(name)) {
  1237. return false;
  1238. }
  1239. var value = obj[name];
  1240. if (!isFunction$1(value)) return;
  1241. descriptor.enumerable = false;
  1242. if ('writable' in descriptor) {
  1243. descriptor.writable = false;
  1244. return;
  1245. }
  1246. if (!descriptor.set) {
  1247. descriptor.set = function () {
  1248. throw Error("Can not rewrite read-only method '" + name + "'");
  1249. };
  1250. }
  1251. });
  1252. };
  1253. /**
  1254. * Converts an array or a delimited string into an object set with values as keys and true as values.
  1255. * Useful for fast membership checks.
  1256. *
  1257. * @param {Array|string} arrayOrString - The array or string to convert.
  1258. * @param {string} delimiter - The delimiter to use if input is a string.
  1259. * @returns {Object} An object with keys from the array or string, values set to true.
  1260. */
  1261. var toObjectSet = function toObjectSet(arrayOrString, delimiter) {
  1262. var obj = {};
  1263. var define = function define(arr) {
  1264. arr.forEach(function (value) {
  1265. obj[value] = true;
  1266. });
  1267. };
  1268. isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));
  1269. return obj;
  1270. };
  1271. var noop = function noop() {};
  1272. var toFiniteNumber = function toFiniteNumber(value, defaultValue) {
  1273. return value != null && Number.isFinite(value = +value) ? value : defaultValue;
  1274. };
  1275. /**
  1276. * If the thing is a FormData object, return true, otherwise return false.
  1277. *
  1278. * @param {unknown} thing - The thing to check.
  1279. *
  1280. * @returns {boolean}
  1281. */
  1282. function isSpecCompliantForm(thing) {
  1283. return !!(thing && isFunction$1(thing.append) && thing[toStringTag] === 'FormData' && thing[iterator]);
  1284. }
  1285. /**
  1286. * Recursively converts an object to a JSON-compatible object, handling circular references and Buffers.
  1287. *
  1288. * @param {Object} obj - The object to convert.
  1289. * @returns {Object} The JSON-compatible object.
  1290. */
  1291. var toJSONObject = function toJSONObject(obj) {
  1292. var visited = new WeakSet();
  1293. var _visit = function visit(source) {
  1294. if (isObject(source)) {
  1295. if (visited.has(source)) {
  1296. return;
  1297. }
  1298. //Buffer check
  1299. if (isBuffer(source)) {
  1300. return source;
  1301. }
  1302. if (!('toJSON' in source)) {
  1303. // add-on descent / delete-on-ascent: preserves path semantics, so DAG nodes serialise at every occurrence (see #7230).
  1304. visited.add(source);
  1305. var target = isArray(source) ? [] : {};
  1306. forEach(source, function (value, key) {
  1307. var reducedValue = _visit(value);
  1308. !isUndefined(reducedValue) && (target[key] = reducedValue);
  1309. });
  1310. visited["delete"](source);
  1311. return target;
  1312. }
  1313. }
  1314. return source;
  1315. };
  1316. return _visit(obj);
  1317. };
  1318. /**
  1319. * Determines if a value is an async function.
  1320. *
  1321. * @param {*} thing - The value to test.
  1322. * @returns {boolean} True if value is an async function, otherwise false.
  1323. */
  1324. var isAsyncFn = kindOfTest('AsyncFunction');
  1325. /**
  1326. * Determines if a value is thenable (has then and catch methods).
  1327. *
  1328. * @param {*} thing - The value to test.
  1329. * @returns {boolean} True if value is thenable, otherwise false.
  1330. */
  1331. var isThenable = function isThenable(thing) {
  1332. return thing && (isObject(thing) || isFunction$1(thing)) && isFunction$1(thing.then) && isFunction$1(thing["catch"]);
  1333. };
  1334. // original code
  1335. // https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34
  1336. /**
  1337. * Provides a cross-platform setImmediate implementation.
  1338. * Uses native setImmediate if available, otherwise falls back to postMessage or setTimeout.
  1339. *
  1340. * @param {boolean} setImmediateSupported - Whether setImmediate is supported.
  1341. * @param {boolean} postMessageSupported - Whether postMessage is supported.
  1342. * @returns {Function} A function to schedule a callback asynchronously.
  1343. */
  1344. var _setImmediate = function (setImmediateSupported, postMessageSupported) {
  1345. if (setImmediateSupported) {
  1346. return setImmediate;
  1347. }
  1348. return postMessageSupported ? function (token, callbacks) {
  1349. _global.addEventListener('message', function (_ref5) {
  1350. var source = _ref5.source,
  1351. data = _ref5.data;
  1352. if (source === _global && data === token) {
  1353. callbacks.length && callbacks.shift()();
  1354. }
  1355. }, false);
  1356. return function (cb) {
  1357. callbacks.push(cb);
  1358. _global.postMessage(token, '*');
  1359. };
  1360. }("axios@".concat(Math.random()), []) : function (cb) {
  1361. return setTimeout(cb);
  1362. };
  1363. }(typeof setImmediate === 'function', isFunction$1(_global.postMessage));
  1364. /**
  1365. * Schedules a microtask or asynchronous callback as soon as possible.
  1366. * Uses queueMicrotask if available, otherwise falls back to process.nextTick or _setImmediate.
  1367. *
  1368. * @type {Function}
  1369. */
  1370. var asap = typeof queueMicrotask !== 'undefined' ? queueMicrotask.bind(_global) : typeof process !== 'undefined' && process.nextTick || _setImmediate;
  1371. // *********************
  1372. var isIterable = function isIterable(thing) {
  1373. return thing != null && isFunction$1(thing[iterator]);
  1374. };
  1375. /**
  1376. * Determine if a value is iterable via an iterator that is NOT sourced solely
  1377. * from a polluted Object.prototype. Use this instead of `isIterable` whenever
  1378. * the iterable comes from untrusted input (e.g. user-supplied header sources),
  1379. * so `Object.prototype[Symbol.iterator] = ...` cannot turn an ordinary object
  1380. * into an attacker-controlled entries iterator.
  1381. *
  1382. * @param {*} thing The value to test
  1383. *
  1384. * @returns {boolean} True if value has a non-polluted iterator
  1385. */
  1386. var isSafeIterable = function isSafeIterable(thing) {
  1387. return thing != null && hasOwnInPrototypeChain(thing, iterator) && isIterable(thing);
  1388. };
  1389. var utils$1 = {
  1390. isArray: isArray,
  1391. isArrayBuffer: isArrayBuffer,
  1392. isBuffer: isBuffer,
  1393. isFormData: isFormData,
  1394. isArrayBufferView: isArrayBufferView,
  1395. isString: isString,
  1396. isNumber: isNumber,
  1397. isBoolean: isBoolean,
  1398. isObject: isObject,
  1399. isPlainObject: isPlainObject,
  1400. isEmptyObject: isEmptyObject,
  1401. isReadableStream: isReadableStream,
  1402. isRequest: isRequest,
  1403. isResponse: isResponse,
  1404. isHeaders: isHeaders,
  1405. isUndefined: isUndefined,
  1406. isDate: isDate,
  1407. isFile: isFile,
  1408. isReactNativeBlob: isReactNativeBlob,
  1409. isReactNative: isReactNative,
  1410. isBlob: isBlob,
  1411. isRegExp: isRegExp,
  1412. isFunction: isFunction$1,
  1413. isStream: isStream,
  1414. isURLSearchParams: isURLSearchParams,
  1415. isTypedArray: isTypedArray,
  1416. isFileList: isFileList,
  1417. forEach: forEach,
  1418. merge: merge,
  1419. extend: extend,
  1420. trim: trim,
  1421. stripBOM: stripBOM,
  1422. inherits: inherits,
  1423. toFlatObject: toFlatObject,
  1424. kindOf: kindOf,
  1425. kindOfTest: kindOfTest,
  1426. endsWith: endsWith,
  1427. toArray: toArray,
  1428. forEachEntry: forEachEntry,
  1429. matchAll: matchAll,
  1430. isHTMLForm: isHTMLForm,
  1431. hasOwnProperty: hasOwnProperty,
  1432. hasOwnProp: hasOwnProperty,
  1433. // an alias to avoid ESLint no-prototype-builtins detection
  1434. hasOwnInPrototypeChain: hasOwnInPrototypeChain,
  1435. getSafeProp: getSafeProp,
  1436. reduceDescriptors: reduceDescriptors,
  1437. freezeMethods: freezeMethods,
  1438. toObjectSet: toObjectSet,
  1439. toCamelCase: toCamelCase,
  1440. noop: noop,
  1441. toFiniteNumber: toFiniteNumber,
  1442. findKey: findKey,
  1443. global: _global,
  1444. isContextDefined: isContextDefined,
  1445. isSpecCompliantForm: isSpecCompliantForm,
  1446. toJSONObject: toJSONObject,
  1447. isAsyncFn: isAsyncFn,
  1448. isThenable: isThenable,
  1449. setImmediate: _setImmediate,
  1450. asap: asap,
  1451. isIterable: isIterable,
  1452. isSafeIterable: isSafeIterable
  1453. };
  1454. // RawAxiosHeaders whose duplicates are ignored by node
  1455. // c.f. https://nodejs.org/api/http.html#http_message_headers
  1456. 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']);
  1457. /**
  1458. * Parse headers into an object
  1459. *
  1460. * ```
  1461. * Date: Wed, 27 Aug 2014 08:58:49 GMT
  1462. * Content-Type: application/json
  1463. * Connection: keep-alive
  1464. * Transfer-Encoding: chunked
  1465. * ```
  1466. *
  1467. * @param {String} rawHeaders Headers needing to be parsed
  1468. *
  1469. * @returns {Object} Headers parsed into an object
  1470. */
  1471. var parseHeaders = (function (rawHeaders) {
  1472. var parsed = {};
  1473. var key;
  1474. var val;
  1475. var i;
  1476. rawHeaders && rawHeaders.split('\n').forEach(function parser(line) {
  1477. i = line.indexOf(':');
  1478. key = line.substring(0, i).trim().toLowerCase();
  1479. val = line.substring(i + 1).trim();
  1480. if (!key || parsed[key] && ignoreDuplicateOf[key]) {
  1481. return;
  1482. }
  1483. if (key === 'set-cookie') {
  1484. if (parsed[key]) {
  1485. parsed[key].push(val);
  1486. } else {
  1487. parsed[key] = [val];
  1488. }
  1489. } else {
  1490. parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
  1491. }
  1492. });
  1493. return parsed;
  1494. });
  1495. function trimSPorHTAB(str) {
  1496. var start = 0;
  1497. var end = str.length;
  1498. while (start < end) {
  1499. var code = str.charCodeAt(start);
  1500. if (code !== 0x09 && code !== 0x20) {
  1501. break;
  1502. }
  1503. start += 1;
  1504. }
  1505. while (end > start) {
  1506. var _code = str.charCodeAt(end - 1);
  1507. if (_code !== 0x09 && _code !== 0x20) {
  1508. break;
  1509. }
  1510. end -= 1;
  1511. }
  1512. return start === 0 && end === str.length ? str : str.slice(start, end);
  1513. }
  1514. // The control-code ranges are intentional: header sanitization strips C0/DEL bytes.
  1515. // eslint-disable-next-line no-control-regex
  1516. var INVALID_UNICODE_HEADER_VALUE_CHARS = new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+", 'g');
  1517. // eslint-disable-next-line no-control-regex
  1518. var INVALID_BYTE_STRING_HEADER_VALUE_CHARS = new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+", 'g');
  1519. function sanitizeValue(value, invalidChars) {
  1520. if (utils$1.isArray(value)) {
  1521. return value.map(function (item) {
  1522. return sanitizeValue(item, invalidChars);
  1523. });
  1524. }
  1525. return trimSPorHTAB(String(value).replace(invalidChars, ''));
  1526. }
  1527. var sanitizeHeaderValue = function sanitizeHeaderValue(value) {
  1528. return sanitizeValue(value, INVALID_UNICODE_HEADER_VALUE_CHARS);
  1529. };
  1530. var sanitizeByteStringHeaderValue = function sanitizeByteStringHeaderValue(value) {
  1531. return sanitizeValue(value, INVALID_BYTE_STRING_HEADER_VALUE_CHARS);
  1532. };
  1533. function toByteStringHeaderObject(headers) {
  1534. var byteStringHeaders = Object.create(null);
  1535. utils$1.forEach(headers.toJSON(), function (value, header) {
  1536. byteStringHeaders[header] = sanitizeByteStringHeaderValue(value);
  1537. });
  1538. return byteStringHeaders;
  1539. }
  1540. var $internals = Symbol('internals');
  1541. function normalizeHeader(header) {
  1542. return header && String(header).trim().toLowerCase();
  1543. }
  1544. function normalizeValue(value) {
  1545. if (value === false || value == null) {
  1546. return value;
  1547. }
  1548. return utils$1.isArray(value) ? value.map(normalizeValue) : sanitizeHeaderValue(String(value));
  1549. }
  1550. function parseTokens(str) {
  1551. var tokens = Object.create(null);
  1552. var tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
  1553. var match;
  1554. while (match = tokensRE.exec(str)) {
  1555. tokens[match[1]] = match[2];
  1556. }
  1557. return tokens;
  1558. }
  1559. var isValidHeaderName = function isValidHeaderName(str) {
  1560. return /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
  1561. };
  1562. function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
  1563. if (utils$1.isFunction(filter)) {
  1564. return filter.call(this, value, header);
  1565. }
  1566. if (isHeaderNameFilter) {
  1567. value = header;
  1568. }
  1569. if (!utils$1.isString(value)) return;
  1570. if (utils$1.isString(filter)) {
  1571. return value.indexOf(filter) !== -1;
  1572. }
  1573. if (utils$1.isRegExp(filter)) {
  1574. return filter.test(value);
  1575. }
  1576. }
  1577. function formatHeader(header) {
  1578. return header.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, function (w, _char, str) {
  1579. return _char.toUpperCase() + str;
  1580. });
  1581. }
  1582. function buildAccessors(obj, header) {
  1583. var accessorName = utils$1.toCamelCase(' ' + header);
  1584. ['get', 'set', 'has'].forEach(function (methodName) {
  1585. Object.defineProperty(obj, methodName + accessorName, {
  1586. // Null-proto descriptor so a polluted Object.prototype.get cannot turn
  1587. // this data descriptor into an accessor descriptor on the way in.
  1588. __proto__: null,
  1589. value: function value(arg1, arg2, arg3) {
  1590. return this[methodName].call(this, header, arg1, arg2, arg3);
  1591. },
  1592. configurable: true
  1593. });
  1594. });
  1595. }
  1596. var AxiosHeaders = /*#__PURE__*/function () {
  1597. function AxiosHeaders(headers) {
  1598. _classCallCheck(this, AxiosHeaders);
  1599. headers && this.set(headers);
  1600. }
  1601. return _createClass(AxiosHeaders, [{
  1602. key: "set",
  1603. value: function set(header, valueOrRewrite, rewrite) {
  1604. var self = this;
  1605. function setHeader(_value, _header, _rewrite) {
  1606. var lHeader = normalizeHeader(_header);
  1607. if (!lHeader) {
  1608. return;
  1609. }
  1610. var key = utils$1.findKey(self, lHeader);
  1611. if (!key || self[key] === undefined || _rewrite === true || _rewrite === undefined && self[key] !== false) {
  1612. self[key || _header] = normalizeValue(_value);
  1613. }
  1614. }
  1615. var setHeaders = function setHeaders(headers, _rewrite) {
  1616. return utils$1.forEach(headers, function (_value, _header) {
  1617. return setHeader(_value, _header, _rewrite);
  1618. });
  1619. };
  1620. if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
  1621. setHeaders(header, valueOrRewrite);
  1622. } else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
  1623. setHeaders(parseHeaders(header), valueOrRewrite);
  1624. } else if (utils$1.isObject(header) && utils$1.isSafeIterable(header)) {
  1625. var obj = Object.create(null),
  1626. dest,
  1627. key;
  1628. var _iterator = _createForOfIteratorHelper(header),
  1629. _step;
  1630. try {
  1631. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  1632. var entry = _step.value;
  1633. if (!utils$1.isArray(entry)) {
  1634. throw new TypeError('Object iterator must return a key-value pair');
  1635. }
  1636. key = entry[0];
  1637. if (utils$1.hasOwnProp(obj, key)) {
  1638. dest = obj[key];
  1639. obj[key] = utils$1.isArray(dest) ? [].concat(_toConsumableArray(dest), [entry[1]]) : [dest, entry[1]];
  1640. } else {
  1641. obj[key] = entry[1];
  1642. }
  1643. }
  1644. } catch (err) {
  1645. _iterator.e(err);
  1646. } finally {
  1647. _iterator.f();
  1648. }
  1649. setHeaders(obj, valueOrRewrite);
  1650. } else {
  1651. header != null && setHeader(valueOrRewrite, header, rewrite);
  1652. }
  1653. return this;
  1654. }
  1655. }, {
  1656. key: "get",
  1657. value: function get(header, parser) {
  1658. header = normalizeHeader(header);
  1659. if (header) {
  1660. var key = utils$1.findKey(this, header);
  1661. if (key) {
  1662. var value = this[key];
  1663. if (!parser) {
  1664. return value;
  1665. }
  1666. if (parser === true) {
  1667. return parseTokens(value);
  1668. }
  1669. if (utils$1.isFunction(parser)) {
  1670. return parser.call(this, value, key);
  1671. }
  1672. if (utils$1.isRegExp(parser)) {
  1673. return parser.exec(value);
  1674. }
  1675. throw new TypeError('parser must be boolean|regexp|function');
  1676. }
  1677. }
  1678. }
  1679. }, {
  1680. key: "has",
  1681. value: function has(header, matcher) {
  1682. header = normalizeHeader(header);
  1683. if (header) {
  1684. var key = utils$1.findKey(this, header);
  1685. return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
  1686. }
  1687. return false;
  1688. }
  1689. }, {
  1690. key: "delete",
  1691. value: function _delete(header, matcher) {
  1692. var self = this;
  1693. var deleted = false;
  1694. function deleteHeader(_header) {
  1695. _header = normalizeHeader(_header);
  1696. if (_header) {
  1697. var key = utils$1.findKey(self, _header);
  1698. if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
  1699. delete self[key];
  1700. deleted = true;
  1701. }
  1702. }
  1703. }
  1704. if (utils$1.isArray(header)) {
  1705. header.forEach(deleteHeader);
  1706. } else {
  1707. deleteHeader(header);
  1708. }
  1709. return deleted;
  1710. }
  1711. }, {
  1712. key: "clear",
  1713. value: function clear(matcher) {
  1714. var keys = Object.keys(this);
  1715. var i = keys.length;
  1716. var deleted = false;
  1717. while (i--) {
  1718. var key = keys[i];
  1719. if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
  1720. delete this[key];
  1721. deleted = true;
  1722. }
  1723. }
  1724. return deleted;
  1725. }
  1726. }, {
  1727. key: "normalize",
  1728. value: function normalize(format) {
  1729. var self = this;
  1730. var headers = {};
  1731. utils$1.forEach(this, function (value, header) {
  1732. var key = utils$1.findKey(headers, header);
  1733. if (key) {
  1734. self[key] = normalizeValue(value);
  1735. delete self[header];
  1736. return;
  1737. }
  1738. var normalized = format ? formatHeader(header) : String(header).trim();
  1739. if (normalized !== header) {
  1740. delete self[header];
  1741. }
  1742. self[normalized] = normalizeValue(value);
  1743. headers[normalized] = true;
  1744. });
  1745. return this;
  1746. }
  1747. }, {
  1748. key: "concat",
  1749. value: function concat() {
  1750. var _this$constructor;
  1751. for (var _len = arguments.length, targets = new Array(_len), _key = 0; _key < _len; _key++) {
  1752. targets[_key] = arguments[_key];
  1753. }
  1754. return (_this$constructor = this.constructor).concat.apply(_this$constructor, [this].concat(targets));
  1755. }
  1756. }, {
  1757. key: "toJSON",
  1758. value: function toJSON(asStrings) {
  1759. var obj = Object.create(null);
  1760. utils$1.forEach(this, function (value, header) {
  1761. value != null && value !== false && (obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value);
  1762. });
  1763. return obj;
  1764. }
  1765. }, {
  1766. key: Symbol.iterator,
  1767. value: function value() {
  1768. return Object.entries(this.toJSON())[Symbol.iterator]();
  1769. }
  1770. }, {
  1771. key: "toString",
  1772. value: function toString() {
  1773. return Object.entries(this.toJSON()).map(function (_ref) {
  1774. var _ref2 = _slicedToArray(_ref, 2),
  1775. header = _ref2[0],
  1776. value = _ref2[1];
  1777. return header + ': ' + value;
  1778. }).join('\n');
  1779. }
  1780. }, {
  1781. key: "getSetCookie",
  1782. value: function getSetCookie() {
  1783. return this.get('set-cookie') || [];
  1784. }
  1785. }, {
  1786. key: Symbol.toStringTag,
  1787. get: function get() {
  1788. return 'AxiosHeaders';
  1789. }
  1790. }], [{
  1791. key: "from",
  1792. value: function from(thing) {
  1793. return thing instanceof this ? thing : new this(thing);
  1794. }
  1795. }, {
  1796. key: "concat",
  1797. value: function concat(first) {
  1798. var computed = new this(first);
  1799. for (var _len2 = arguments.length, targets = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
  1800. targets[_key2 - 1] = arguments[_key2];
  1801. }
  1802. targets.forEach(function (target) {
  1803. return computed.set(target);
  1804. });
  1805. return computed;
  1806. }
  1807. }, {
  1808. key: "accessor",
  1809. value: function accessor(header) {
  1810. var internals = this[$internals] = this[$internals] = {
  1811. accessors: {}
  1812. };
  1813. var accessors = internals.accessors;
  1814. var prototype = this.prototype;
  1815. function defineAccessor(_header) {
  1816. var lHeader = normalizeHeader(_header);
  1817. if (!accessors[lHeader]) {
  1818. buildAccessors(prototype, _header);
  1819. accessors[lHeader] = true;
  1820. }
  1821. }
  1822. utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
  1823. return this;
  1824. }
  1825. }]);
  1826. }();
  1827. AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);
  1828. // reserved names hotfix
  1829. utils$1.reduceDescriptors(AxiosHeaders.prototype, function (_ref3, key) {
  1830. var value = _ref3.value;
  1831. var mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
  1832. return {
  1833. get: function get() {
  1834. return value;
  1835. },
  1836. set: function set(headerValue) {
  1837. this[mapped] = headerValue;
  1838. }
  1839. };
  1840. });
  1841. utils$1.freezeMethods(AxiosHeaders);
  1842. var REDACTED = '[REDACTED ****]';
  1843. function hasOwnOrPrototypeToJSON(source) {
  1844. if (utils$1.hasOwnProp(source, 'toJSON')) {
  1845. return true;
  1846. }
  1847. var prototype = Object.getPrototypeOf(source);
  1848. while (prototype && prototype !== Object.prototype) {
  1849. if (utils$1.hasOwnProp(prototype, 'toJSON')) {
  1850. return true;
  1851. }
  1852. prototype = Object.getPrototypeOf(prototype);
  1853. }
  1854. return false;
  1855. }
  1856. // Build a plain-object snapshot of `config` and replace the value of any key
  1857. // (case-insensitive) listed in `redactKeys` with REDACTED. Walks through arrays
  1858. // and AxiosHeaders, and short-circuits on circular references.
  1859. function redactConfig(config, redactKeys) {
  1860. var lowerKeys = new Set(redactKeys.map(function (k) {
  1861. return String(k).toLowerCase();
  1862. }));
  1863. var seen = [];
  1864. var _visit = function visit(source) {
  1865. if (source === null || _typeof(source) !== 'object') return source;
  1866. if (utils$1.isBuffer(source)) return source;
  1867. if (seen.indexOf(source) !== -1) return undefined;
  1868. if (source instanceof AxiosHeaders) {
  1869. source = source.toJSON();
  1870. }
  1871. seen.push(source);
  1872. var result;
  1873. if (utils$1.isArray(source)) {
  1874. result = [];
  1875. source.forEach(function (v, i) {
  1876. var reducedValue = _visit(v);
  1877. if (!utils$1.isUndefined(reducedValue)) {
  1878. result[i] = reducedValue;
  1879. }
  1880. });
  1881. } else {
  1882. if (!utils$1.isPlainObject(source) && hasOwnOrPrototypeToJSON(source)) {
  1883. seen.pop();
  1884. return source;
  1885. }
  1886. result = Object.create(null);
  1887. for (var _i = 0, _Object$entries = Object.entries(source); _i < _Object$entries.length; _i++) {
  1888. var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
  1889. key = _Object$entries$_i[0],
  1890. value = _Object$entries$_i[1];
  1891. var reducedValue = lowerKeys.has(key.toLowerCase()) ? REDACTED : _visit(value);
  1892. if (!utils$1.isUndefined(reducedValue)) {
  1893. result[key] = reducedValue;
  1894. }
  1895. }
  1896. }
  1897. seen.pop();
  1898. return result;
  1899. };
  1900. return _visit(config);
  1901. }
  1902. var AxiosError = /*#__PURE__*/function (_Error) {
  1903. /**
  1904. * Create an Error with the specified message, config, error code, request and response.
  1905. *
  1906. * @param {string} message The error message.
  1907. * @param {string} [code] The error code (for example, 'ECONNABORTED').
  1908. * @param {Object} [config] The config.
  1909. * @param {Object} [request] The request.
  1910. * @param {Object} [response] The response.
  1911. *
  1912. * @returns {Error} The created error.
  1913. */
  1914. function AxiosError(message, code, config, request, response) {
  1915. var _this;
  1916. _classCallCheck(this, AxiosError);
  1917. _this = _callSuper(this, AxiosError, [message]);
  1918. // Make message enumerable to maintain backward compatibility
  1919. // The native Error constructor sets message as non-enumerable,
  1920. // but axios < v1.13.3 had it as enumerable
  1921. Object.defineProperty(_this, 'message', {
  1922. // Null-proto descriptor so a polluted Object.prototype.get cannot turn
  1923. // this data descriptor into an accessor descriptor on the way in.
  1924. __proto__: null,
  1925. value: message,
  1926. enumerable: true,
  1927. writable: true,
  1928. configurable: true
  1929. });
  1930. _this.name = 'AxiosError';
  1931. _this.isAxiosError = true;
  1932. code && (_this.code = code);
  1933. config && (_this.config = config);
  1934. request && (_this.request = request);
  1935. if (response) {
  1936. _this.response = response;
  1937. _this.status = response.status;
  1938. }
  1939. return _this;
  1940. }
  1941. _inherits(AxiosError, _Error);
  1942. return _createClass(AxiosError, [{
  1943. key: "toJSON",
  1944. value: function toJSON() {
  1945. // Opt-in redaction: when the request config carries a `redact` array, the
  1946. // value of any matching key (case-insensitive, at any depth) is replaced
  1947. // with REDACTED in the serialized snapshot. Undefined or empty leaves the
  1948. // existing serialization behavior unchanged.
  1949. var config = this.config;
  1950. var redactKeys = config && utils$1.hasOwnProp(config, 'redact') ? config.redact : undefined;
  1951. var serializedConfig = utils$1.isArray(redactKeys) && redactKeys.length > 0 ? redactConfig(config, redactKeys) : utils$1.toJSONObject(config);
  1952. return {
  1953. // Standard
  1954. message: this.message,
  1955. name: this.name,
  1956. // Microsoft
  1957. description: this.description,
  1958. number: this.number,
  1959. // Mozilla
  1960. fileName: this.fileName,
  1961. lineNumber: this.lineNumber,
  1962. columnNumber: this.columnNumber,
  1963. stack: this.stack,
  1964. // Axios
  1965. config: serializedConfig,
  1966. code: this.code,
  1967. status: this.status
  1968. };
  1969. }
  1970. }], [{
  1971. key: "from",
  1972. value: function from(error, code, config, request, response, customProps) {
  1973. var axiosError = new AxiosError(error.message, code || error.code, config, request, response);
  1974. axiosError.cause = error;
  1975. axiosError.name = error.name;
  1976. // Preserve status from the original error if not already set from response
  1977. if (error.status != null && axiosError.status == null) {
  1978. axiosError.status = error.status;
  1979. }
  1980. customProps && Object.assign(axiosError, customProps);
  1981. return axiosError;
  1982. }
  1983. }]);
  1984. }(/*#__PURE__*/_wrapNativeSuper(Error)); // This can be changed to static properties as soon as the parser options in .eslint.cjs are updated.
  1985. AxiosError.ERR_BAD_OPTION_VALUE = 'ERR_BAD_OPTION_VALUE';
  1986. AxiosError.ERR_BAD_OPTION = 'ERR_BAD_OPTION';
  1987. AxiosError.ECONNABORTED = 'ECONNABORTED';
  1988. AxiosError.ETIMEDOUT = 'ETIMEDOUT';
  1989. AxiosError.ECONNREFUSED = 'ECONNREFUSED';
  1990. AxiosError.ERR_NETWORK = 'ERR_NETWORK';
  1991. AxiosError.ERR_FR_TOO_MANY_REDIRECTS = 'ERR_FR_TOO_MANY_REDIRECTS';
  1992. AxiosError.ERR_DEPRECATED = 'ERR_DEPRECATED';
  1993. AxiosError.ERR_BAD_RESPONSE = 'ERR_BAD_RESPONSE';
  1994. AxiosError.ERR_BAD_REQUEST = 'ERR_BAD_REQUEST';
  1995. AxiosError.ERR_CANCELED = 'ERR_CANCELED';
  1996. AxiosError.ERR_NOT_SUPPORT = 'ERR_NOT_SUPPORT';
  1997. AxiosError.ERR_INVALID_URL = 'ERR_INVALID_URL';
  1998. AxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED = 'ERR_FORM_DATA_DEPTH_EXCEEDED';
  1999. // eslint-disable-next-line strict
  2000. var httpAdapter = null;
  2001. // Default nesting limit shared with the inverse transform (formDataToJSON) so
  2002. // the FormData <-> JSON round-trip stays symmetric.
  2003. var DEFAULT_FORM_DATA_MAX_DEPTH = 100;
  2004. /**
  2005. * Determines if the given thing is a array or js object.
  2006. *
  2007. * @param {string} thing - The object or array to be visited.
  2008. *
  2009. * @returns {boolean}
  2010. */
  2011. function isVisitable(thing) {
  2012. return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
  2013. }
  2014. /**
  2015. * It removes the brackets from the end of a string
  2016. *
  2017. * @param {string} key - The key of the parameter.
  2018. *
  2019. * @returns {string} the key without the brackets.
  2020. */
  2021. function removeBrackets(key) {
  2022. return utils$1.endsWith(key, '[]') ? key.slice(0, -2) : key;
  2023. }
  2024. /**
  2025. * It takes a path, a key, and a boolean, and returns a string
  2026. *
  2027. * @param {string} path - The path to the current key.
  2028. * @param {string} key - The key of the current object being iterated over.
  2029. * @param {string} dots - If true, the key will be rendered with dots instead of brackets.
  2030. *
  2031. * @returns {string} The path to the current key.
  2032. */
  2033. function renderKey(path, key, dots) {
  2034. if (!path) return key;
  2035. return path.concat(key).map(function each(token, i) {
  2036. // eslint-disable-next-line no-param-reassign
  2037. token = removeBrackets(token);
  2038. return !dots && i ? '[' + token + ']' : token;
  2039. }).join(dots ? '.' : '');
  2040. }
  2041. /**
  2042. * If the array is an array and none of its elements are visitable, then it's a flat array.
  2043. *
  2044. * @param {Array<any>} arr - The array to check
  2045. *
  2046. * @returns {boolean}
  2047. */
  2048. function isFlatArray(arr) {
  2049. return utils$1.isArray(arr) && !arr.some(isVisitable);
  2050. }
  2051. var predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) {
  2052. return /^is[A-Z]/.test(prop);
  2053. });
  2054. /**
  2055. * Convert a data object to FormData
  2056. *
  2057. * @param {Object} obj
  2058. * @param {?Object} [formData]
  2059. * @param {?Object} [options]
  2060. * @param {Function} [options.visitor]
  2061. * @param {Boolean} [options.metaTokens = true]
  2062. * @param {Boolean} [options.dots = false]
  2063. * @param {?Boolean} [options.indexes = false]
  2064. *
  2065. * @returns {Object}
  2066. **/
  2067. /**
  2068. * It converts an object into a FormData object
  2069. *
  2070. * @param {Object<any, any>} obj - The object to convert to form data.
  2071. * @param {string} formData - The FormData object to append to.
  2072. * @param {Object<string, any>} options
  2073. *
  2074. * @returns
  2075. */
  2076. function toFormData(obj, formData, options) {
  2077. if (!utils$1.isObject(obj)) {
  2078. throw new TypeError('target must be an object');
  2079. }
  2080. // eslint-disable-next-line no-param-reassign
  2081. formData = formData || new (FormData)();
  2082. // eslint-disable-next-line no-param-reassign
  2083. options = utils$1.toFlatObject(options, {
  2084. metaTokens: true,
  2085. dots: false,
  2086. indexes: false
  2087. }, false, function defined(option, source) {
  2088. // eslint-disable-next-line no-eq-null,eqeqeq
  2089. return !utils$1.isUndefined(source[option]);
  2090. });
  2091. var metaTokens = options.metaTokens;
  2092. // eslint-disable-next-line no-use-before-define
  2093. var visitor = options.visitor || defaultVisitor;
  2094. var dots = options.dots;
  2095. var indexes = options.indexes;
  2096. var _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
  2097. var maxDepth = options.maxDepth === undefined ? DEFAULT_FORM_DATA_MAX_DEPTH : options.maxDepth;
  2098. var useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
  2099. var stack = [];
  2100. if (!utils$1.isFunction(visitor)) {
  2101. throw new TypeError('visitor must be a function');
  2102. }
  2103. function convertValue(value) {
  2104. if (value === null) return '';
  2105. if (utils$1.isDate(value)) {
  2106. return value.toISOString();
  2107. }
  2108. if (utils$1.isBoolean(value)) {
  2109. return value.toString();
  2110. }
  2111. if (!useBlob && utils$1.isBlob(value)) {
  2112. throw new AxiosError('Blob is not supported. Use a Buffer instead.');
  2113. }
  2114. if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
  2115. return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
  2116. }
  2117. return value;
  2118. }
  2119. function throwIfMaxDepthExceeded(depth) {
  2120. if (depth > maxDepth) {
  2121. throw new AxiosError('Object is too deeply nested (' + depth + ' levels). Max depth: ' + maxDepth, AxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED);
  2122. }
  2123. }
  2124. function stringifyWithDepthLimit(value, depth) {
  2125. if (maxDepth === Infinity) {
  2126. return JSON.stringify(value);
  2127. }
  2128. var ancestors = [];
  2129. return JSON.stringify(value, function limitDepth(_key, currentValue) {
  2130. if (!utils$1.isObject(currentValue)) {
  2131. return currentValue;
  2132. }
  2133. while (ancestors.length && ancestors[ancestors.length - 1] !== this) {
  2134. ancestors.pop();
  2135. }
  2136. ancestors.push(currentValue);
  2137. throwIfMaxDepthExceeded(depth + ancestors.length - 1);
  2138. return currentValue;
  2139. });
  2140. }
  2141. /**
  2142. * Default visitor.
  2143. *
  2144. * @param {*} value
  2145. * @param {String|Number} key
  2146. * @param {Array<String|Number>} path
  2147. * @this {FormData}
  2148. *
  2149. * @returns {boolean} return true to visit the each prop of the value recursively
  2150. */
  2151. function defaultVisitor(value, key, path) {
  2152. var arr = value;
  2153. if (utils$1.isReactNative(formData) && utils$1.isReactNativeBlob(value)) {
  2154. formData.append(renderKey(path, key, dots), convertValue(value));
  2155. return false;
  2156. }
  2157. if (value && !path && _typeof(value) === 'object') {
  2158. if (utils$1.endsWith(key, '{}')) {
  2159. // eslint-disable-next-line no-param-reassign
  2160. key = metaTokens ? key : key.slice(0, -2);
  2161. // eslint-disable-next-line no-param-reassign
  2162. value = stringifyWithDepthLimit(value, 1);
  2163. } else if (utils$1.isArray(value) && isFlatArray(value) || (utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value))) {
  2164. // eslint-disable-next-line no-param-reassign
  2165. key = removeBrackets(key);
  2166. arr.forEach(function each(el, index) {
  2167. !(utils$1.isUndefined(el) || el === null) && formData.append(
  2168. // eslint-disable-next-line no-nested-ternary
  2169. indexes === true ? renderKey([key], index, dots) : indexes === null ? key : key + '[]', convertValue(el));
  2170. });
  2171. return false;
  2172. }
  2173. }
  2174. if (isVisitable(value)) {
  2175. return true;
  2176. }
  2177. formData.append(renderKey(path, key, dots), convertValue(value));
  2178. return false;
  2179. }
  2180. var exposedHelpers = Object.assign(predicates, {
  2181. defaultVisitor: defaultVisitor,
  2182. convertValue: convertValue,
  2183. isVisitable: isVisitable
  2184. });
  2185. function build(value, path) {
  2186. var depth = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  2187. if (utils$1.isUndefined(value)) return;
  2188. throwIfMaxDepthExceeded(depth);
  2189. if (stack.indexOf(value) !== -1) {
  2190. throw new Error('Circular reference detected in ' + path.join('.'));
  2191. }
  2192. stack.push(value);
  2193. utils$1.forEach(value, function each(el, key) {
  2194. var result = !(utils$1.isUndefined(el) || el === null) && visitor.call(formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers);
  2195. if (result === true) {
  2196. build(el, path ? path.concat(key) : [key], depth + 1);
  2197. }
  2198. });
  2199. stack.pop();
  2200. }
  2201. if (!utils$1.isObject(obj)) {
  2202. throw new TypeError('data must be an object');
  2203. }
  2204. build(obj);
  2205. return formData;
  2206. }
  2207. /**
  2208. * It encodes a string by replacing all characters that are not in the unreserved set with
  2209. * their percent-encoded equivalents
  2210. *
  2211. * @param {string} str - The string to encode.
  2212. *
  2213. * @returns {string} The encoded string.
  2214. */
  2215. function encode$1(str) {
  2216. var charMap = {
  2217. '!': '%21',
  2218. "'": '%27',
  2219. '(': '%28',
  2220. ')': '%29',
  2221. '~': '%7E',
  2222. '%20': '+'
  2223. };
  2224. return encodeURIComponent(str).replace(/[!'()~]|%20/g, function replacer(match) {
  2225. return charMap[match];
  2226. });
  2227. }
  2228. /**
  2229. * It takes a params object and converts it to a FormData object
  2230. *
  2231. * @param {Object<string, any>} params - The parameters to be converted to a FormData object.
  2232. * @param {Object<string, any>} options - The options object passed to the Axios constructor.
  2233. *
  2234. * @returns {void}
  2235. */
  2236. function AxiosURLSearchParams(params, options) {
  2237. this._pairs = [];
  2238. params && toFormData(params, this, options);
  2239. }
  2240. var prototype = AxiosURLSearchParams.prototype;
  2241. prototype.append = function append(name, value) {
  2242. this._pairs.push([name, value]);
  2243. };
  2244. prototype.toString = function toString(encoder) {
  2245. var _encode = encoder ? function (value) {
  2246. return encoder.call(this, value, encode$1);
  2247. } : encode$1;
  2248. return this._pairs.map(function each(pair) {
  2249. return _encode(pair[0]) + '=' + _encode(pair[1]);
  2250. }, '').join('&');
  2251. };
  2252. /**
  2253. * It replaces URL-encoded forms of `:`, `$`, `,`, and spaces with
  2254. * their plain counterparts (`:`, `$`, `,`, `+`).
  2255. *
  2256. * @param {string} val The value to be encoded.
  2257. *
  2258. * @returns {string} The encoded value.
  2259. */
  2260. function encode(val) {
  2261. return encodeURIComponent(val).replace(/%3A/gi, ':').replace(/%24/g, '$').replace(/%2C/gi, ',').replace(/%20/g, '+');
  2262. }
  2263. /**
  2264. * Build a URL by appending params to the end
  2265. *
  2266. * @param {string} url The base of the url (e.g., http://www.google.com)
  2267. * @param {object} [params] The params to be appended
  2268. * @param {?(object|Function)} options
  2269. *
  2270. * @returns {string} The formatted url
  2271. */
  2272. function buildURL(url, params, options) {
  2273. if (!params) {
  2274. return url;
  2275. }
  2276. var _options = utils$1.isFunction(options) ? {
  2277. serialize: options
  2278. } : options;
  2279. // Read serializer options pollution-safely: own properties and methods on a
  2280. // class/template prototype are honored, but values injected onto a polluted
  2281. // Object.prototype are ignored.
  2282. var _encode = utils$1.getSafeProp(_options, 'encode') || encode;
  2283. var serializeFn = utils$1.getSafeProp(_options, 'serialize');
  2284. var serializedParams;
  2285. if (serializeFn) {
  2286. serializedParams = serializeFn(params, _options);
  2287. } else {
  2288. serializedParams = utils$1.isURLSearchParams(params) ? params.toString() : new AxiosURLSearchParams(params, _options).toString(_encode);
  2289. }
  2290. if (serializedParams) {
  2291. var hashmarkIndex = url.indexOf('#');
  2292. if (hashmarkIndex !== -1) {
  2293. url = url.slice(0, hashmarkIndex);
  2294. }
  2295. url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
  2296. }
  2297. return url;
  2298. }
  2299. var InterceptorManager = /*#__PURE__*/function () {
  2300. function InterceptorManager() {
  2301. _classCallCheck(this, InterceptorManager);
  2302. this.handlers = [];
  2303. }
  2304. /**
  2305. * Add a new interceptor to the stack
  2306. *
  2307. * @param {Function} fulfilled The function to handle `then` for a `Promise`
  2308. * @param {Function} rejected The function to handle `reject` for a `Promise`
  2309. * @param {Object} options The options for the interceptor, synchronous and runWhen
  2310. *
  2311. * @return {Number} An ID used to remove interceptor later
  2312. */
  2313. return _createClass(InterceptorManager, [{
  2314. key: "use",
  2315. value: function use(fulfilled, rejected, options) {
  2316. this.handlers.push({
  2317. fulfilled: fulfilled,
  2318. rejected: rejected,
  2319. synchronous: options ? options.synchronous : false,
  2320. runWhen: options ? options.runWhen : null
  2321. });
  2322. return this.handlers.length - 1;
  2323. }
  2324. /**
  2325. * Remove an interceptor from the stack
  2326. *
  2327. * @param {Number} id The ID that was returned by `use`
  2328. *
  2329. * @returns {void}
  2330. */
  2331. }, {
  2332. key: "eject",
  2333. value: function eject(id) {
  2334. if (this.handlers[id]) {
  2335. this.handlers[id] = null;
  2336. }
  2337. }
  2338. /**
  2339. * Clear all interceptors from the stack
  2340. *
  2341. * @returns {void}
  2342. */
  2343. }, {
  2344. key: "clear",
  2345. value: function clear() {
  2346. if (this.handlers) {
  2347. this.handlers = [];
  2348. }
  2349. }
  2350. /**
  2351. * Iterate over all the registered interceptors
  2352. *
  2353. * This method is particularly useful for skipping over any
  2354. * interceptors that may have become `null` calling `eject`.
  2355. *
  2356. * @param {Function} fn The function to call for each interceptor
  2357. *
  2358. * @returns {void}
  2359. */
  2360. }, {
  2361. key: "forEach",
  2362. value: function forEach(fn) {
  2363. utils$1.forEach(this.handlers, function forEachHandler(h) {
  2364. if (h !== null) {
  2365. fn(h);
  2366. }
  2367. });
  2368. }
  2369. }]);
  2370. }();
  2371. var transitionalDefaults = {
  2372. silentJSONParsing: true,
  2373. forcedJSONParsing: true,
  2374. clarifyTimeoutError: false,
  2375. legacyInterceptorReqResOrdering: true,
  2376. advertiseZstdAcceptEncoding: false,
  2377. validateStatusUndefinedResolves: true
  2378. };
  2379. var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
  2380. var FormData$1 = typeof FormData !== 'undefined' ? FormData : null;
  2381. var Blob$1 = typeof Blob !== 'undefined' ? Blob : null;
  2382. var platform$1 = {
  2383. isBrowser: true,
  2384. classes: {
  2385. URLSearchParams: URLSearchParams$1,
  2386. FormData: FormData$1,
  2387. Blob: Blob$1
  2388. },
  2389. protocols: ['http', 'https', 'file', 'blob', 'url', 'data']
  2390. };
  2391. var hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
  2392. var _navigator = (typeof navigator === "undefined" ? "undefined" : _typeof(navigator)) === 'object' && navigator || undefined;
  2393. /**
  2394. * Determine if we're running in a standard browser environment
  2395. *
  2396. * This allows axios to run in a web worker, and react-native.
  2397. * Both environments support XMLHttpRequest, but not fully standard globals.
  2398. *
  2399. * web workers:
  2400. * typeof window -> undefined
  2401. * typeof document -> undefined
  2402. *
  2403. * react-native:
  2404. * navigator.product -> 'ReactNative'
  2405. * nativescript
  2406. * navigator.product -> 'NativeScript' or 'NS'
  2407. *
  2408. * @returns {boolean}
  2409. */
  2410. var hasStandardBrowserEnv = hasBrowserEnv && (!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);
  2411. /**
  2412. * Determine if we're running in a standard browser webWorker environment
  2413. *
  2414. * Although the `isStandardBrowserEnv` method indicates that
  2415. * `allows axios to run in a web worker`, the WebWorker will still be
  2416. * filtered out due to its judgment standard
  2417. * `typeof window !== 'undefined' && typeof document !== 'undefined'`.
  2418. * This leads to a problem when axios post `FormData` in webWorker
  2419. */
  2420. var hasStandardBrowserWebWorkerEnv = function () {
  2421. return typeof WorkerGlobalScope !== 'undefined' &&
  2422. // eslint-disable-next-line no-undef
  2423. self instanceof WorkerGlobalScope && typeof self.importScripts === 'function';
  2424. }();
  2425. var origin = hasBrowserEnv && window.location.href || 'http://localhost';
  2426. var utils = /*#__PURE__*/Object.freeze({
  2427. __proto__: null,
  2428. hasBrowserEnv: hasBrowserEnv,
  2429. hasStandardBrowserEnv: hasStandardBrowserEnv,
  2430. hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
  2431. navigator: _navigator,
  2432. origin: origin
  2433. });
  2434. var platform = _objectSpread2(_objectSpread2({}, utils), platform$1);
  2435. function toURLEncodedForm(data, options) {
  2436. return toFormData(data, new platform.classes.URLSearchParams(), _objectSpread2({
  2437. visitor: function visitor(value, key, path, helpers) {
  2438. if (platform.isNode && utils$1.isBuffer(value)) {
  2439. this.append(key, value.toString('base64'));
  2440. return false;
  2441. }
  2442. return helpers.defaultVisitor.apply(this, arguments);
  2443. }
  2444. }, options));
  2445. }
  2446. var MAX_DEPTH = DEFAULT_FORM_DATA_MAX_DEPTH;
  2447. function throwIfDepthExceeded(index) {
  2448. if (index > MAX_DEPTH) {
  2449. throw new AxiosError('FormData field is too deeply nested (' + index + ' levels). Max depth: ' + MAX_DEPTH, AxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED);
  2450. }
  2451. }
  2452. /**
  2453. * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']
  2454. *
  2455. * @param {string} name - The name of the property to get.
  2456. *
  2457. * @returns An array of strings.
  2458. */
  2459. function parsePropPath(name) {
  2460. // foo[x][y][z]
  2461. // foo.x.y.z
  2462. // foo-x-y-z
  2463. // foo x y z
  2464. var path = [];
  2465. var pattern = /\w+|\[(\w*)]/g;
  2466. var match;
  2467. while ((match = pattern.exec(name)) !== null) {
  2468. throwIfDepthExceeded(path.length);
  2469. path.push(match[0] === '[]' ? '' : match[1] || match[0]);
  2470. }
  2471. return path;
  2472. }
  2473. /**
  2474. * Convert an array to an object.
  2475. *
  2476. * @param {Array<any>} arr - The array to convert to an object.
  2477. *
  2478. * @returns An object with the same keys and values as the array.
  2479. */
  2480. function arrayToObject(arr) {
  2481. var obj = {};
  2482. var keys = Object.keys(arr);
  2483. var i;
  2484. var len = keys.length;
  2485. var key;
  2486. for (i = 0; i < len; i++) {
  2487. key = keys[i];
  2488. obj[key] = arr[key];
  2489. }
  2490. return obj;
  2491. }
  2492. /**
  2493. * It takes a FormData object and returns a JavaScript object
  2494. *
  2495. * @param {string} formData The FormData object to convert to JSON.
  2496. *
  2497. * @returns {Object<string, any> | null} The converted object.
  2498. */
  2499. function formDataToJSON(formData) {
  2500. function buildPath(path, value, target, index) {
  2501. throwIfDepthExceeded(index);
  2502. var name = path[index++];
  2503. if (name === '__proto__') return true;
  2504. var isNumericKey = Number.isFinite(+name);
  2505. var isLast = index >= path.length;
  2506. name = !name && utils$1.isArray(target) ? target.length : name;
  2507. if (isLast) {
  2508. if (utils$1.hasOwnProp(target, name)) {
  2509. target[name] = utils$1.isArray(target[name]) ? target[name].concat(value) : [target[name], value];
  2510. } else {
  2511. target[name] = value;
  2512. }
  2513. return !isNumericKey;
  2514. }
  2515. if (!utils$1.hasOwnProp(target, name) || !utils$1.isObject(target[name])) {
  2516. target[name] = [];
  2517. }
  2518. var result = buildPath(path, value, target[name], index);
  2519. if (result && utils$1.isArray(target[name])) {
  2520. target[name] = arrayToObject(target[name]);
  2521. }
  2522. return !isNumericKey;
  2523. }
  2524. if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {
  2525. var obj = {};
  2526. utils$1.forEachEntry(formData, function (name, value) {
  2527. buildPath(parsePropPath(name), value, obj, 0);
  2528. });
  2529. return obj;
  2530. }
  2531. return null;
  2532. }
  2533. var own = function own(obj, key) {
  2534. return obj != null && utils$1.hasOwnProp(obj, key) ? obj[key] : undefined;
  2535. };
  2536. /**
  2537. * It takes a string, tries to parse it, and if it fails, it returns the stringified version
  2538. * of the input
  2539. *
  2540. * @param {any} rawValue - The value to be stringified.
  2541. * @param {Function} parser - A function that parses a string into a JavaScript object.
  2542. * @param {Function} encoder - A function that takes a value and returns a string.
  2543. *
  2544. * @returns {string} A stringified version of the rawValue.
  2545. */
  2546. function stringifySafely(rawValue, parser, encoder) {
  2547. if (utils$1.isString(rawValue)) {
  2548. try {
  2549. (parser || JSON.parse)(rawValue);
  2550. return utils$1.trim(rawValue);
  2551. } catch (e) {
  2552. if (e.name !== 'SyntaxError') {
  2553. throw e;
  2554. }
  2555. }
  2556. }
  2557. return (encoder || JSON.stringify)(rawValue);
  2558. }
  2559. var defaults = {
  2560. transitional: transitionalDefaults,
  2561. adapter: ['xhr', 'http', 'fetch'],
  2562. transformRequest: [function transformRequest(data, headers) {
  2563. var contentType = headers.getContentType() || '';
  2564. var hasJSONContentType = contentType.indexOf('application/json') > -1;
  2565. var isObjectPayload = utils$1.isObject(data);
  2566. if (isObjectPayload && utils$1.isHTMLForm(data)) {
  2567. data = new FormData(data);
  2568. }
  2569. var isFormData = utils$1.isFormData(data);
  2570. if (isFormData) {
  2571. return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
  2572. }
  2573. 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)) {
  2574. return data;
  2575. }
  2576. if (utils$1.isArrayBufferView(data)) {
  2577. return data.buffer;
  2578. }
  2579. if (utils$1.isURLSearchParams(data)) {
  2580. headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
  2581. return data.toString();
  2582. }
  2583. var isFileList;
  2584. if (isObjectPayload) {
  2585. var formSerializer = own(this, 'formSerializer');
  2586. if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
  2587. return toURLEncodedForm(data, formSerializer).toString();
  2588. }
  2589. if ((isFileList = utils$1.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
  2590. var env = own(this, 'env');
  2591. var _FormData = env && env.FormData;
  2592. return toFormData(isFileList ? {
  2593. 'files[]': data
  2594. } : data, _FormData && new _FormData(), formSerializer);
  2595. }
  2596. }
  2597. if (isObjectPayload || hasJSONContentType) {
  2598. headers.setContentType('application/json', false);
  2599. return stringifySafely(data);
  2600. }
  2601. return data;
  2602. }],
  2603. transformResponse: [function transformResponse(data) {
  2604. var transitional = own(this, 'transitional') || defaults.transitional;
  2605. var forcedJSONParsing = transitional && transitional.forcedJSONParsing;
  2606. var responseType = own(this, 'responseType');
  2607. var JSONRequested = responseType === 'json';
  2608. if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
  2609. return data;
  2610. }
  2611. if (data && utils$1.isString(data) && (forcedJSONParsing && !responseType || JSONRequested)) {
  2612. var silentJSONParsing = transitional && transitional.silentJSONParsing;
  2613. var strictJSONParsing = !silentJSONParsing && JSONRequested;
  2614. try {
  2615. return JSON.parse(data, own(this, 'parseReviver'));
  2616. } catch (e) {
  2617. if (strictJSONParsing) {
  2618. if (e.name === 'SyntaxError') {
  2619. throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, own(this, 'response'));
  2620. }
  2621. throw e;
  2622. }
  2623. }
  2624. }
  2625. return data;
  2626. }],
  2627. /**
  2628. * A timeout in milliseconds to abort a request. If set to 0 (default) a
  2629. * timeout is not created.
  2630. */
  2631. timeout: 0,
  2632. xsrfCookieName: 'XSRF-TOKEN',
  2633. xsrfHeaderName: 'X-XSRF-TOKEN',
  2634. maxContentLength: -1,
  2635. maxBodyLength: -1,
  2636. env: {
  2637. FormData: platform.classes.FormData,
  2638. Blob: platform.classes.Blob
  2639. },
  2640. validateStatus: function validateStatus(status) {
  2641. return status >= 200 && status < 300;
  2642. },
  2643. headers: {
  2644. common: {
  2645. Accept: 'application/json, text/plain, */*',
  2646. 'Content-Type': undefined
  2647. }
  2648. }
  2649. };
  2650. utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'query'], function (method) {
  2651. defaults.headers[method] = {};
  2652. });
  2653. /**
  2654. * Transform the data for a request or a response
  2655. *
  2656. * @param {Array|Function} fns A single function or Array of functions
  2657. * @param {?Object} response The response object
  2658. *
  2659. * @returns {*} The resulting transformed data
  2660. */
  2661. function transformData(fns, response) {
  2662. var config = this || defaults;
  2663. var context = response || config;
  2664. var headers = AxiosHeaders.from(context.headers);
  2665. var data = context.data;
  2666. utils$1.forEach(fns, function transform(fn) {
  2667. data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);
  2668. });
  2669. headers.normalize();
  2670. return data;
  2671. }
  2672. function isCancel(value) {
  2673. return !!(value && value.__CANCEL__);
  2674. }
  2675. var CanceledError = /*#__PURE__*/function (_AxiosError) {
  2676. /**
  2677. * A `CanceledError` is an object that is thrown when an operation is canceled.
  2678. *
  2679. * @param {string=} message The message.
  2680. * @param {Object=} config The config.
  2681. * @param {Object=} request The request.
  2682. *
  2683. * @returns {CanceledError} The created error.
  2684. */
  2685. function CanceledError(message, config, request) {
  2686. var _this;
  2687. _classCallCheck(this, CanceledError);
  2688. _this = _callSuper(this, CanceledError, [message == null ? 'canceled' : message, AxiosError.ERR_CANCELED, config, request]);
  2689. _this.name = 'CanceledError';
  2690. _this.__CANCEL__ = true;
  2691. return _this;
  2692. }
  2693. _inherits(CanceledError, _AxiosError);
  2694. return _createClass(CanceledError);
  2695. }(AxiosError);
  2696. /**
  2697. * Resolve or reject a Promise based on response status.
  2698. *
  2699. * @param {Function} resolve A function that resolves the promise.
  2700. * @param {Function} reject A function that rejects the promise.
  2701. * @param {object} response The response.
  2702. *
  2703. * @returns {object} The response.
  2704. */
  2705. function settle(resolve, reject, response) {
  2706. var validateStatus = response.config.validateStatus;
  2707. if (!response.status || !validateStatus || validateStatus(response.status)) {
  2708. resolve(response);
  2709. } else {
  2710. reject(new AxiosError('Request failed with status code ' + response.status, response.status >= 400 && response.status < 500 ? AxiosError.ERR_BAD_REQUEST : AxiosError.ERR_BAD_RESPONSE, response.config, response.request, response));
  2711. }
  2712. }
  2713. function parseProtocol(url) {
  2714. var match = /^([-+\w]{1,25}):(?:\/\/)?/.exec(url);
  2715. return match && match[1] || '';
  2716. }
  2717. /**
  2718. * Calculate data maxRate
  2719. * @param {Number} [samplesCount= 10]
  2720. * @param {Number} [min= 1000]
  2721. * @returns {Function}
  2722. */
  2723. function speedometer(samplesCount, min) {
  2724. samplesCount = samplesCount || 10;
  2725. var bytes = new Array(samplesCount);
  2726. var timestamps = new Array(samplesCount);
  2727. var head = 0;
  2728. var tail = 0;
  2729. var firstSampleTS;
  2730. min = min !== undefined ? min : 1000;
  2731. return function push(chunkLength) {
  2732. var now = Date.now();
  2733. var startedAt = timestamps[tail];
  2734. if (!firstSampleTS) {
  2735. firstSampleTS = now;
  2736. }
  2737. bytes[head] = chunkLength;
  2738. timestamps[head] = now;
  2739. var i = tail;
  2740. var bytesCount = 0;
  2741. while (i !== head) {
  2742. bytesCount += bytes[i++];
  2743. i = i % samplesCount;
  2744. }
  2745. head = (head + 1) % samplesCount;
  2746. if (head === tail) {
  2747. tail = (tail + 1) % samplesCount;
  2748. }
  2749. if (now - firstSampleTS < min) {
  2750. return;
  2751. }
  2752. var passed = startedAt && now - startedAt;
  2753. return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
  2754. };
  2755. }
  2756. /**
  2757. * Throttle decorator
  2758. * @param {Function} fn
  2759. * @param {Number} freq
  2760. * @return {Function}
  2761. */
  2762. function throttle(fn, freq) {
  2763. var timestamp = 0;
  2764. var threshold = 1000 / freq;
  2765. var lastArgs;
  2766. var timer;
  2767. var invoke = function invoke(args) {
  2768. var now = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Date.now();
  2769. timestamp = now;
  2770. lastArgs = null;
  2771. if (timer) {
  2772. clearTimeout(timer);
  2773. timer = null;
  2774. }
  2775. fn.apply(void 0, _toConsumableArray(args));
  2776. };
  2777. var throttled = function throttled() {
  2778. var now = Date.now();
  2779. var passed = now - timestamp;
  2780. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  2781. args[_key] = arguments[_key];
  2782. }
  2783. if (passed >= threshold) {
  2784. invoke(args, now);
  2785. } else {
  2786. lastArgs = args;
  2787. if (!timer) {
  2788. timer = setTimeout(function () {
  2789. timer = null;
  2790. invoke(lastArgs);
  2791. }, threshold - passed);
  2792. }
  2793. }
  2794. };
  2795. var flush = function flush() {
  2796. return lastArgs && invoke(lastArgs);
  2797. };
  2798. return [throttled, flush];
  2799. }
  2800. var progressEventReducer = function progressEventReducer(listener, isDownloadStream) {
  2801. var freq = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 3;
  2802. var bytesNotified = 0;
  2803. var _speedometer = speedometer(50, 250);
  2804. return throttle(function (e) {
  2805. if (!e || typeof e.loaded !== 'number') {
  2806. return;
  2807. }
  2808. var rawLoaded = e.loaded;
  2809. var total = e.lengthComputable ? e.total : undefined;
  2810. var loaded = total != null ? Math.min(rawLoaded, total) : rawLoaded;
  2811. var progressBytes = Math.max(0, loaded - bytesNotified);
  2812. var rate = _speedometer(progressBytes);
  2813. bytesNotified = Math.max(bytesNotified, loaded);
  2814. var data = _defineProperty({
  2815. loaded: loaded,
  2816. total: total,
  2817. progress: total ? loaded / total : undefined,
  2818. bytes: progressBytes,
  2819. rate: rate ? rate : undefined,
  2820. estimated: rate && total ? (total - loaded) / rate : undefined,
  2821. event: e,
  2822. lengthComputable: total != null
  2823. }, isDownloadStream ? 'download' : 'upload', true);
  2824. listener(data);
  2825. }, freq);
  2826. };
  2827. var progressEventDecorator = function progressEventDecorator(total, throttled) {
  2828. var lengthComputable = total != null;
  2829. return [function (loaded) {
  2830. return throttled[0]({
  2831. lengthComputable: lengthComputable,
  2832. total: total,
  2833. loaded: loaded
  2834. });
  2835. }, throttled[1]];
  2836. };
  2837. var asyncDecorator = function asyncDecorator(fn) {
  2838. return function () {
  2839. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  2840. args[_key] = arguments[_key];
  2841. }
  2842. return utils$1.asap(function () {
  2843. return fn.apply(void 0, args);
  2844. });
  2845. };
  2846. };
  2847. var isURLSameOrigin = platform.hasStandardBrowserEnv ? function (origin, isMSIE) {
  2848. return function (url) {
  2849. url = new URL(url, platform.origin);
  2850. return origin.protocol === url.protocol && origin.host === url.host && (isMSIE || origin.port === url.port);
  2851. };
  2852. }(new URL(platform.origin), platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)) : function () {
  2853. return true;
  2854. };
  2855. var cookies = platform.hasStandardBrowserEnv ?
  2856. // Standard browser envs support document.cookie
  2857. {
  2858. write: function write(name, value, expires, path, domain, secure, sameSite) {
  2859. if (typeof document === 'undefined') return;
  2860. var cookie = ["".concat(name, "=").concat(encodeURIComponent(value))];
  2861. if (utils$1.isNumber(expires)) {
  2862. cookie.push("expires=".concat(new Date(expires).toUTCString()));
  2863. }
  2864. if (utils$1.isString(path)) {
  2865. cookie.push("path=".concat(path));
  2866. }
  2867. if (utils$1.isString(domain)) {
  2868. cookie.push("domain=".concat(domain));
  2869. }
  2870. if (secure === true) {
  2871. cookie.push('secure');
  2872. }
  2873. if (utils$1.isString(sameSite)) {
  2874. cookie.push("SameSite=".concat(sameSite));
  2875. }
  2876. document.cookie = cookie.join('; ');
  2877. },
  2878. read: function read(name) {
  2879. if (typeof document === 'undefined') return null;
  2880. // Match name=value by splitting on the semicolon separator instead of building a
  2881. // RegExp from `name` — interpolating an unescaped string into a RegExp would let
  2882. // metacharacters (e.g. `.+?` in an attacker-influenced cookie name) cause ReDoS or
  2883. // match the wrong cookie. Browsers may serialize cookie pairs as either ";" or
  2884. // "; ", so ignore optional whitespace before each cookie name.
  2885. var cookies = document.cookie.split(';');
  2886. for (var i = 0; i < cookies.length; i++) {
  2887. var cookie = cookies[i].replace(/^\s+/, '');
  2888. var eq = cookie.indexOf('=');
  2889. if (eq !== -1 && cookie.slice(0, eq) === name) {
  2890. return decodeURIComponent(cookie.slice(eq + 1));
  2891. }
  2892. }
  2893. return null;
  2894. },
  2895. remove: function remove(name) {
  2896. this.write(name, '', Date.now() - 86400000, '/');
  2897. }
  2898. } :
  2899. // Non-standard browser env (web workers, react-native) lack needed support.
  2900. {
  2901. write: function write() {},
  2902. read: function read() {
  2903. return null;
  2904. },
  2905. remove: function remove() {}
  2906. };
  2907. /**
  2908. * Determines whether the specified URL is absolute
  2909. *
  2910. * @param {string} url The URL to test
  2911. *
  2912. * @returns {boolean} True if the specified URL is absolute, otherwise false
  2913. */
  2914. function isAbsoluteURL(url) {
  2915. // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
  2916. // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
  2917. // by any combination of letters, digits, plus, period, or hyphen.
  2918. if (typeof url !== 'string') {
  2919. return false;
  2920. }
  2921. return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
  2922. }
  2923. /**
  2924. * Creates a new URL by combining the specified URLs
  2925. *
  2926. * @param {string} baseURL The base URL
  2927. * @param {string} relativeURL The relative URL
  2928. *
  2929. * @returns {string} The combined URL
  2930. */
  2931. function combineURLs(baseURL, relativeURL) {
  2932. return relativeURL ? baseURL.replace(/\/?\/$/, '') + '/' + relativeURL.replace(/^\/+/, '') : baseURL;
  2933. }
  2934. var malformedHttpProtocol = /^https?:(?!\/\/)/i;
  2935. var httpProtocolControlCharacters = /[\t\n\r]/g;
  2936. function stripLeadingC0ControlOrSpace(url) {
  2937. var i = 0;
  2938. while (i < url.length && url.charCodeAt(i) <= 0x20) {
  2939. i++;
  2940. }
  2941. return url.slice(i);
  2942. }
  2943. function normalizeURLForProtocolCheck(url) {
  2944. return stripLeadingC0ControlOrSpace(url).replace(httpProtocolControlCharacters, '');
  2945. }
  2946. function assertValidHttpProtocolURL(url, config) {
  2947. if (typeof url === 'string' && malformedHttpProtocol.test(normalizeURLForProtocolCheck(url))) {
  2948. throw new AxiosError('Invalid URL: missing "//" after protocol', AxiosError.ERR_INVALID_URL, config);
  2949. }
  2950. }
  2951. /**
  2952. * Creates a new URL by combining the baseURL with the requestedURL,
  2953. * only when the requestedURL is not already an absolute URL.
  2954. * If the requestURL is absolute, this function returns the requestedURL untouched.
  2955. *
  2956. * @param {string} baseURL The base URL
  2957. * @param {string} requestedURL Absolute or relative URL to combine
  2958. *
  2959. * @returns {string} The combined full path
  2960. */
  2961. function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls, config) {
  2962. assertValidHttpProtocolURL(requestedURL, config);
  2963. var isRelativeUrl = !isAbsoluteURL(requestedURL);
  2964. if (baseURL && (isRelativeUrl || allowAbsoluteUrls === false)) {
  2965. assertValidHttpProtocolURL(baseURL, config);
  2966. return combineURLs(baseURL, requestedURL);
  2967. }
  2968. return requestedURL;
  2969. }
  2970. var headersToObject = function headersToObject(thing) {
  2971. return thing instanceof AxiosHeaders ? _objectSpread2({}, thing) : thing;
  2972. };
  2973. /**
  2974. * Config-specific merge-function which creates a new config-object
  2975. * by merging two configuration objects together.
  2976. *
  2977. * @param {Object} config1
  2978. * @param {Object} config2
  2979. *
  2980. * @returns {Object} New object resulting from merging config2 to config1
  2981. */
  2982. function mergeConfig(config1, config2) {
  2983. // eslint-disable-next-line no-param-reassign
  2984. config2 = config2 || {};
  2985. // Use a null-prototype object so that downstream reads such as `config.auth`
  2986. // or `config.baseURL` cannot inherit polluted values from Object.prototype.
  2987. // `hasOwnProperty` is restored as a non-enumerable own slot to preserve
  2988. // ergonomics for user code that relies on it.
  2989. var config = Object.create(null);
  2990. Object.defineProperty(config, 'hasOwnProperty', {
  2991. // Null-proto descriptor so a polluted Object.prototype.get cannot turn
  2992. // this data descriptor into an accessor descriptor on the way in.
  2993. __proto__: null,
  2994. value: Object.prototype.hasOwnProperty,
  2995. enumerable: false,
  2996. writable: true,
  2997. configurable: true
  2998. });
  2999. function getMergedValue(target, source, prop, caseless) {
  3000. if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
  3001. return utils$1.merge.call({
  3002. caseless: caseless
  3003. }, target, source);
  3004. } else if (utils$1.isPlainObject(source)) {
  3005. return utils$1.merge({}, source);
  3006. } else if (utils$1.isArray(source)) {
  3007. return source.slice();
  3008. }
  3009. return source;
  3010. }
  3011. function mergeDeepProperties(a, b, prop, caseless) {
  3012. if (!utils$1.isUndefined(b)) {
  3013. return getMergedValue(a, b, prop, caseless);
  3014. } else if (!utils$1.isUndefined(a)) {
  3015. return getMergedValue(undefined, a, prop, caseless);
  3016. }
  3017. }
  3018. // eslint-disable-next-line consistent-return
  3019. function valueFromConfig2(a, b) {
  3020. if (!utils$1.isUndefined(b)) {
  3021. return getMergedValue(undefined, b);
  3022. }
  3023. }
  3024. // eslint-disable-next-line consistent-return
  3025. function defaultToConfig2(a, b) {
  3026. if (!utils$1.isUndefined(b)) {
  3027. return getMergedValue(undefined, b);
  3028. } else if (!utils$1.isUndefined(a)) {
  3029. return getMergedValue(undefined, a);
  3030. }
  3031. }
  3032. function getMergedTransitionalOption(prop) {
  3033. var transitional2 = utils$1.hasOwnProp(config2, 'transitional') ? config2.transitional : undefined;
  3034. if (!utils$1.isUndefined(transitional2)) {
  3035. if (utils$1.isPlainObject(transitional2)) {
  3036. if (utils$1.hasOwnProp(transitional2, prop)) {
  3037. return transitional2[prop];
  3038. }
  3039. } else {
  3040. return undefined;
  3041. }
  3042. }
  3043. var transitional1 = utils$1.hasOwnProp(config1, 'transitional') ? config1.transitional : undefined;
  3044. if (utils$1.isPlainObject(transitional1) && utils$1.hasOwnProp(transitional1, prop)) {
  3045. return transitional1[prop];
  3046. }
  3047. return undefined;
  3048. }
  3049. // eslint-disable-next-line consistent-return
  3050. function mergeDirectKeys(a, b, prop) {
  3051. if (utils$1.hasOwnProp(config2, prop)) {
  3052. return getMergedValue(a, b);
  3053. } else if (utils$1.hasOwnProp(config1, prop)) {
  3054. return getMergedValue(undefined, a);
  3055. }
  3056. }
  3057. var mergeMap = {
  3058. url: valueFromConfig2,
  3059. method: valueFromConfig2,
  3060. data: valueFromConfig2,
  3061. baseURL: defaultToConfig2,
  3062. transformRequest: defaultToConfig2,
  3063. transformResponse: defaultToConfig2,
  3064. paramsSerializer: defaultToConfig2,
  3065. timeout: defaultToConfig2,
  3066. timeoutMessage: defaultToConfig2,
  3067. withCredentials: defaultToConfig2,
  3068. withXSRFToken: defaultToConfig2,
  3069. adapter: defaultToConfig2,
  3070. responseType: defaultToConfig2,
  3071. xsrfCookieName: defaultToConfig2,
  3072. xsrfHeaderName: defaultToConfig2,
  3073. onUploadProgress: defaultToConfig2,
  3074. onDownloadProgress: defaultToConfig2,
  3075. decompress: defaultToConfig2,
  3076. maxContentLength: defaultToConfig2,
  3077. maxBodyLength: defaultToConfig2,
  3078. beforeRedirect: defaultToConfig2,
  3079. transport: defaultToConfig2,
  3080. httpAgent: defaultToConfig2,
  3081. httpsAgent: defaultToConfig2,
  3082. cancelToken: defaultToConfig2,
  3083. socketPath: defaultToConfig2,
  3084. allowedSocketPaths: defaultToConfig2,
  3085. responseEncoding: defaultToConfig2,
  3086. validateStatus: mergeDirectKeys,
  3087. headers: function headers(a, b, prop) {
  3088. return mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true);
  3089. }
  3090. };
  3091. utils$1.forEach(Object.keys(_objectSpread2(_objectSpread2({}, config1), config2)), function computeConfigValue(prop) {
  3092. if (prop === '__proto__' || prop === 'constructor' || prop === 'prototype') return;
  3093. var merge = utils$1.hasOwnProp(mergeMap, prop) ? mergeMap[prop] : mergeDeepProperties;
  3094. var a = utils$1.hasOwnProp(config1, prop) ? config1[prop] : undefined;
  3095. var b = utils$1.hasOwnProp(config2, prop) ? config2[prop] : undefined;
  3096. var configValue = merge(a, b, prop);
  3097. utils$1.isUndefined(configValue) && merge !== mergeDirectKeys || (config[prop] = configValue);
  3098. });
  3099. if (utils$1.hasOwnProp(config2, 'validateStatus') && utils$1.isUndefined(config2.validateStatus) && getMergedTransitionalOption('validateStatusUndefinedResolves') === false) {
  3100. if (utils$1.hasOwnProp(config1, 'validateStatus')) {
  3101. config.validateStatus = getMergedValue(undefined, config1.validateStatus);
  3102. } else {
  3103. delete config.validateStatus;
  3104. }
  3105. }
  3106. return config;
  3107. }
  3108. var FORM_DATA_CONTENT_HEADERS = ['content-type', 'content-length'];
  3109. function setFormDataHeaders(headers, formHeaders, policy) {
  3110. if (policy !== 'content-only') {
  3111. headers.set(formHeaders);
  3112. return;
  3113. }
  3114. Object.entries(formHeaders).forEach(function (_ref) {
  3115. var _ref2 = _slicedToArray(_ref, 2),
  3116. key = _ref2[0],
  3117. val = _ref2[1];
  3118. if (FORM_DATA_CONTENT_HEADERS.includes(key.toLowerCase())) {
  3119. headers.set(key, val);
  3120. }
  3121. });
  3122. }
  3123. /**
  3124. * Encode a UTF-8 string to a Latin-1 byte string for use with btoa().
  3125. * This is a modern replacement for the deprecated unescape(encodeURIComponent(str)) pattern.
  3126. *
  3127. * @param {string} str The string to encode
  3128. *
  3129. * @returns {string} UTF-8 bytes as a Latin-1 string
  3130. */
  3131. var encodeUTF8$1 = function encodeUTF8(str) {
  3132. return encodeURIComponent(str).replace(/%([0-9A-F]{2})/gi, function (_, hex) {
  3133. return String.fromCharCode(parseInt(hex, 16));
  3134. });
  3135. };
  3136. function resolveConfig(config) {
  3137. var newConfig = mergeConfig({}, config);
  3138. // Read only own properties to prevent prototype pollution gadgets
  3139. // (e.g. Object.prototype.baseURL = 'https://evil.com').
  3140. var own = function own(key) {
  3141. return utils$1.hasOwnProp(newConfig, key) ? newConfig[key] : undefined;
  3142. };
  3143. var data = own('data');
  3144. var withXSRFToken = own('withXSRFToken');
  3145. var xsrfHeaderName = own('xsrfHeaderName');
  3146. var xsrfCookieName = own('xsrfCookieName');
  3147. var headers = own('headers');
  3148. var auth = own('auth');
  3149. var baseURL = own('baseURL');
  3150. var allowAbsoluteUrls = own('allowAbsoluteUrls');
  3151. var url = own('url');
  3152. newConfig.headers = headers = AxiosHeaders.from(headers);
  3153. newConfig.url = buildURL(buildFullPath(baseURL, url, allowAbsoluteUrls, newConfig), own('params'), own('paramsSerializer'));
  3154. // HTTP basic authentication
  3155. if (auth) {
  3156. var username = utils$1.getSafeProp(auth, 'username') || '';
  3157. var password = utils$1.getSafeProp(auth, 'password') || '';
  3158. headers.set('Authorization', 'Basic ' + btoa(username + ':' + (password ? encodeUTF8$1(password) : '')));
  3159. }
  3160. if (utils$1.isFormData(data)) {
  3161. if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv || utils$1.isReactNative(data)) {
  3162. headers.setContentType(undefined); // browser/web worker/RN handles it
  3163. } else if (utils$1.isFunction(data.getHeaders)) {
  3164. // Node.js FormData (like form-data package)
  3165. setFormDataHeaders(headers, data.getHeaders(), own('formDataHeaderPolicy'));
  3166. }
  3167. }
  3168. // Add xsrf header
  3169. // This is only done if running in a standard browser environment.
  3170. // Specifically not if we're in a web worker, or react-native.
  3171. if (platform.hasStandardBrowserEnv) {
  3172. if (utils$1.isFunction(withXSRFToken)) {
  3173. withXSRFToken = withXSRFToken(newConfig);
  3174. }
  3175. // Strict boolean check — prevents proto-pollution gadgets (e.g. Object.prototype.withXSRFToken = 1)
  3176. // and misconfigurations (e.g. "false") from short-circuiting the same-origin check and leaking
  3177. // the XSRF token cross-origin.
  3178. var shouldSendXSRF = withXSRFToken === true || withXSRFToken == null && isURLSameOrigin(newConfig.url);
  3179. if (shouldSendXSRF) {
  3180. var xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
  3181. if (xsrfValue) {
  3182. headers.set(xsrfHeaderName, xsrfValue);
  3183. }
  3184. }
  3185. }
  3186. return newConfig;
  3187. }
  3188. var isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
  3189. var xhrAdapter = isXHRAdapterSupported && function (config) {
  3190. return new Promise(function dispatchXhrRequest(resolve, reject) {
  3191. var _config = resolveConfig(config);
  3192. var requestData = _config.data;
  3193. var requestHeaders = AxiosHeaders.from(_config.headers).normalize();
  3194. var responseType = _config.responseType,
  3195. onUploadProgress = _config.onUploadProgress,
  3196. onDownloadProgress = _config.onDownloadProgress;
  3197. var onCanceled;
  3198. var uploadThrottled, downloadThrottled;
  3199. var flushUpload, flushDownload;
  3200. function done() {
  3201. flushUpload && flushUpload(); // flush events
  3202. flushDownload && flushDownload(); // flush events
  3203. _config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
  3204. _config.signal && _config.signal.removeEventListener('abort', onCanceled);
  3205. }
  3206. var request = new XMLHttpRequest();
  3207. request.open(_config.method.toUpperCase(), _config.url, true);
  3208. // Set the request timeout in MS
  3209. request.timeout = _config.timeout;
  3210. function onloadend() {
  3211. if (!request) {
  3212. return;
  3213. }
  3214. // Prepare the response
  3215. var responseHeaders = AxiosHeaders.from('getAllResponseHeaders' in request && request.getAllResponseHeaders());
  3216. var responseData = !responseType || responseType === 'text' || responseType === 'json' ? request.responseText : request.response;
  3217. var response = {
  3218. data: responseData,
  3219. status: request.status,
  3220. statusText: request.statusText,
  3221. headers: responseHeaders,
  3222. config: config,
  3223. request: request
  3224. };
  3225. settle(function _resolve(value) {
  3226. resolve(value);
  3227. done();
  3228. }, function _reject(err) {
  3229. reject(err);
  3230. done();
  3231. }, response);
  3232. // Clean up request
  3233. request = null;
  3234. }
  3235. if ('onloadend' in request) {
  3236. // Use onloadend if available
  3237. request.onloadend = onloadend;
  3238. } else {
  3239. // Listen for ready state to emulate onloadend
  3240. request.onreadystatechange = function handleLoad() {
  3241. if (!request || request.readyState !== 4) {
  3242. return;
  3243. }
  3244. // The request errored out and we didn't get a response, this will be
  3245. // handled by onerror instead
  3246. // With one exception: request that using file: protocol, most browsers
  3247. // will return status as 0 even though it's a successful request
  3248. if (request.status === 0 && !(request.responseURL && request.responseURL.startsWith('file:'))) {
  3249. return;
  3250. }
  3251. // readystate handler is calling before onerror or ontimeout handlers,
  3252. // so we should call onloadend on the next 'tick'
  3253. setTimeout(onloadend);
  3254. };
  3255. }
  3256. // Handle browser request cancellation (as opposed to a manual cancellation)
  3257. request.onabort = function handleAbort() {
  3258. if (!request) {
  3259. return;
  3260. }
  3261. reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, config, request));
  3262. done();
  3263. // Clean up request
  3264. request = null;
  3265. };
  3266. // Handle low level network errors
  3267. request.onerror = function handleError(event) {
  3268. // Browsers deliver a ProgressEvent in XHR onerror
  3269. // (message may be empty; when present, surface it)
  3270. // See https://developer.mozilla.org/docs/Web/API/XMLHttpRequest/error_event
  3271. var msg = event && event.message ? event.message : 'Network Error';
  3272. var err = new AxiosError(msg, AxiosError.ERR_NETWORK, config, request);
  3273. // attach the underlying event for consumers who want details
  3274. err.event = event || null;
  3275. reject(err);
  3276. done();
  3277. request = null;
  3278. };
  3279. // Handle timeout
  3280. request.ontimeout = function handleTimeout() {
  3281. var timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded';
  3282. var transitional = _config.transitional || transitionalDefaults;
  3283. if (_config.timeoutErrorMessage) {
  3284. timeoutErrorMessage = _config.timeoutErrorMessage;
  3285. }
  3286. reject(new AxiosError(timeoutErrorMessage, transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED, config, request));
  3287. done();
  3288. // Clean up request
  3289. request = null;
  3290. };
  3291. // Remove Content-Type if data is undefined
  3292. requestData === undefined && requestHeaders.setContentType(null);
  3293. // Add headers to the request
  3294. if ('setRequestHeader' in request) {
  3295. utils$1.forEach(toByteStringHeaderObject(requestHeaders), function setRequestHeader(val, key) {
  3296. request.setRequestHeader(key, val);
  3297. });
  3298. }
  3299. // Add withCredentials to request if needed
  3300. if (!utils$1.isUndefined(_config.withCredentials)) {
  3301. request.withCredentials = !!_config.withCredentials;
  3302. }
  3303. // Add responseType to request if needed
  3304. if (responseType && responseType !== 'json') {
  3305. request.responseType = _config.responseType;
  3306. }
  3307. // Handle progress if needed
  3308. if (onDownloadProgress) {
  3309. var _progressEventReducer = progressEventReducer(onDownloadProgress, true);
  3310. var _progressEventReducer2 = _slicedToArray(_progressEventReducer, 2);
  3311. downloadThrottled = _progressEventReducer2[0];
  3312. flushDownload = _progressEventReducer2[1];
  3313. request.addEventListener('progress', downloadThrottled);
  3314. }
  3315. // Not all browsers support upload events
  3316. if (onUploadProgress && request.upload) {
  3317. var _progressEventReducer3 = progressEventReducer(onUploadProgress);
  3318. var _progressEventReducer4 = _slicedToArray(_progressEventReducer3, 2);
  3319. uploadThrottled = _progressEventReducer4[0];
  3320. flushUpload = _progressEventReducer4[1];
  3321. request.upload.addEventListener('progress', uploadThrottled);
  3322. request.upload.addEventListener('loadend', flushUpload);
  3323. }
  3324. if (_config.cancelToken || _config.signal) {
  3325. // Handle cancellation
  3326. // eslint-disable-next-line func-names
  3327. onCanceled = function onCanceled(cancel) {
  3328. if (!request) {
  3329. return;
  3330. }
  3331. reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);
  3332. request.abort();
  3333. done();
  3334. request = null;
  3335. };
  3336. _config.cancelToken && _config.cancelToken.subscribe(onCanceled);
  3337. if (_config.signal) {
  3338. _config.signal.aborted ? onCanceled() : _config.signal.addEventListener('abort', onCanceled);
  3339. }
  3340. }
  3341. var protocol = parseProtocol(_config.url);
  3342. if (protocol && !platform.protocols.includes(protocol)) {
  3343. reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));
  3344. return;
  3345. }
  3346. // Send the request
  3347. request.send(requestData || null);
  3348. });
  3349. };
  3350. var composeSignals = function composeSignals(signals, timeout) {
  3351. signals = signals ? signals.filter(Boolean) : [];
  3352. if (!timeout && !signals.length) {
  3353. return;
  3354. }
  3355. var controller = new AbortController();
  3356. var aborted = false;
  3357. var onabort = function onabort(reason) {
  3358. if (!aborted) {
  3359. aborted = true;
  3360. unsubscribe();
  3361. var err = reason instanceof Error ? reason : this.reason;
  3362. controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err));
  3363. }
  3364. };
  3365. var timer = timeout && setTimeout(function () {
  3366. timer = null;
  3367. onabort(new AxiosError("timeout of ".concat(timeout, "ms exceeded"), AxiosError.ETIMEDOUT));
  3368. }, timeout);
  3369. var unsubscribe = function unsubscribe() {
  3370. if (!signals) {
  3371. return;
  3372. }
  3373. timer && clearTimeout(timer);
  3374. timer = null;
  3375. signals.forEach(function (signal) {
  3376. signal.unsubscribe ? signal.unsubscribe(onabort) : signal.removeEventListener('abort', onabort);
  3377. });
  3378. signals = null;
  3379. };
  3380. signals.forEach(function (signal) {
  3381. return signal.addEventListener('abort', onabort);
  3382. });
  3383. var signal = controller.signal;
  3384. signal.unsubscribe = function () {
  3385. return utils$1.asap(unsubscribe);
  3386. };
  3387. return signal;
  3388. };
  3389. var streamChunk = /*#__PURE__*/_regenerator().m(function streamChunk(chunk, chunkSize) {
  3390. var len, pos, end;
  3391. return _regenerator().w(function (_context) {
  3392. while (1) switch (_context.n) {
  3393. case 0:
  3394. len = chunk.byteLength;
  3395. if (!(!chunkSize || len < chunkSize)) {
  3396. _context.n = 2;
  3397. break;
  3398. }
  3399. _context.n = 1;
  3400. return chunk;
  3401. case 1:
  3402. return _context.a(2);
  3403. case 2:
  3404. pos = 0;
  3405. case 3:
  3406. if (!(pos < len)) {
  3407. _context.n = 5;
  3408. break;
  3409. }
  3410. end = pos + chunkSize;
  3411. _context.n = 4;
  3412. return chunk.slice(pos, end);
  3413. case 4:
  3414. pos = end;
  3415. _context.n = 3;
  3416. break;
  3417. case 5:
  3418. return _context.a(2);
  3419. }
  3420. }, streamChunk);
  3421. });
  3422. var readBytes = /*#__PURE__*/function () {
  3423. var _ref = _wrapAsyncGenerator(/*#__PURE__*/_regenerator().m(function _callee(iterable, chunkSize) {
  3424. var _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, chunk, _t;
  3425. return _regenerator().w(function (_context2) {
  3426. while (1) switch (_context2.p = _context2.n) {
  3427. case 0:
  3428. _iteratorAbruptCompletion = false;
  3429. _didIteratorError = false;
  3430. _context2.p = 1;
  3431. _iterator = _asyncIterator(readStream(iterable));
  3432. case 2:
  3433. _context2.n = 3;
  3434. return _awaitAsyncGenerator(_iterator.next());
  3435. case 3:
  3436. if (!(_iteratorAbruptCompletion = !(_step = _context2.v).done)) {
  3437. _context2.n = 5;
  3438. break;
  3439. }
  3440. chunk = _step.value;
  3441. return _context2.d(_regeneratorValues(_asyncGeneratorDelegate(_asyncIterator(streamChunk(chunk, chunkSize)))), 4);
  3442. case 4:
  3443. _iteratorAbruptCompletion = false;
  3444. _context2.n = 2;
  3445. break;
  3446. case 5:
  3447. _context2.n = 7;
  3448. break;
  3449. case 6:
  3450. _context2.p = 6;
  3451. _t = _context2.v;
  3452. _didIteratorError = true;
  3453. _iteratorError = _t;
  3454. case 7:
  3455. _context2.p = 7;
  3456. _context2.p = 8;
  3457. if (!(_iteratorAbruptCompletion && _iterator["return"] != null)) {
  3458. _context2.n = 9;
  3459. break;
  3460. }
  3461. _context2.n = 9;
  3462. return _awaitAsyncGenerator(_iterator["return"]());
  3463. case 9:
  3464. _context2.p = 9;
  3465. if (!_didIteratorError) {
  3466. _context2.n = 10;
  3467. break;
  3468. }
  3469. throw _iteratorError;
  3470. case 10:
  3471. return _context2.f(9);
  3472. case 11:
  3473. return _context2.f(7);
  3474. case 12:
  3475. return _context2.a(2);
  3476. }
  3477. }, _callee, null, [[8,, 9, 11], [1, 6, 7, 12]]);
  3478. }));
  3479. return function readBytes(_x, _x2) {
  3480. return _ref.apply(this, arguments);
  3481. };
  3482. }();
  3483. var readStream = /*#__PURE__*/function () {
  3484. var _ref2 = _wrapAsyncGenerator(/*#__PURE__*/_regenerator().m(function _callee2(stream) {
  3485. var reader, _yield$_awaitAsyncGen, done, value;
  3486. return _regenerator().w(function (_context3) {
  3487. while (1) switch (_context3.p = _context3.n) {
  3488. case 0:
  3489. if (!stream[Symbol.asyncIterator]) {
  3490. _context3.n = 2;
  3491. break;
  3492. }
  3493. return _context3.d(_regeneratorValues(_asyncGeneratorDelegate(_asyncIterator(stream))), 1);
  3494. case 1:
  3495. return _context3.a(2);
  3496. case 2:
  3497. reader = stream.getReader();
  3498. _context3.p = 3;
  3499. case 4:
  3500. _context3.n = 5;
  3501. return _awaitAsyncGenerator(reader.read());
  3502. case 5:
  3503. _yield$_awaitAsyncGen = _context3.v;
  3504. done = _yield$_awaitAsyncGen.done;
  3505. value = _yield$_awaitAsyncGen.value;
  3506. if (!done) {
  3507. _context3.n = 6;
  3508. break;
  3509. }
  3510. return _context3.a(3, 8);
  3511. case 6:
  3512. _context3.n = 7;
  3513. return value;
  3514. case 7:
  3515. _context3.n = 4;
  3516. break;
  3517. case 8:
  3518. _context3.p = 8;
  3519. _context3.n = 9;
  3520. return _awaitAsyncGenerator(reader.cancel());
  3521. case 9:
  3522. return _context3.f(8);
  3523. case 10:
  3524. return _context3.a(2);
  3525. }
  3526. }, _callee2, null, [[3,, 8, 10]]);
  3527. }));
  3528. return function readStream(_x3) {
  3529. return _ref2.apply(this, arguments);
  3530. };
  3531. }();
  3532. var trackStream = function trackStream(stream, chunkSize, onProgress, onFinish) {
  3533. var iterator = readBytes(stream, chunkSize);
  3534. var bytes = 0;
  3535. var done;
  3536. var _onFinish = function _onFinish(e) {
  3537. if (!done) {
  3538. done = true;
  3539. onFinish && onFinish(e);
  3540. }
  3541. };
  3542. return new ReadableStream({
  3543. pull: function pull(controller) {
  3544. return _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
  3545. var _yield$iterator$next, _done, value, len, loadedBytes, _t2;
  3546. return _regenerator().w(function (_context4) {
  3547. while (1) switch (_context4.p = _context4.n) {
  3548. case 0:
  3549. _context4.p = 0;
  3550. _context4.n = 1;
  3551. return iterator.next();
  3552. case 1:
  3553. _yield$iterator$next = _context4.v;
  3554. _done = _yield$iterator$next.done;
  3555. value = _yield$iterator$next.value;
  3556. if (!_done) {
  3557. _context4.n = 2;
  3558. break;
  3559. }
  3560. _onFinish();
  3561. controller.close();
  3562. return _context4.a(2);
  3563. case 2:
  3564. len = value.byteLength;
  3565. if (onProgress) {
  3566. loadedBytes = bytes += len;
  3567. onProgress(loadedBytes);
  3568. }
  3569. controller.enqueue(new Uint8Array(value));
  3570. _context4.n = 4;
  3571. break;
  3572. case 3:
  3573. _context4.p = 3;
  3574. _t2 = _context4.v;
  3575. _onFinish(_t2);
  3576. throw _t2;
  3577. case 4:
  3578. return _context4.a(2);
  3579. }
  3580. }, _callee3, null, [[0, 3]]);
  3581. }))();
  3582. },
  3583. cancel: function cancel(reason) {
  3584. _onFinish(reason);
  3585. return iterator["return"]();
  3586. }
  3587. }, {
  3588. highWaterMark: 2
  3589. });
  3590. };
  3591. /**
  3592. * Estimate decoded byte length of a data:// URL *without* allocating large buffers.
  3593. * - For base64: compute exact decoded size using length and padding;
  3594. * handle %XX at the character-count level (no string allocation).
  3595. * - For non-base64: compute the exact percent-decoded UTF-8 byte length.
  3596. *
  3597. * @param {string} url
  3598. * @returns {number}
  3599. */
  3600. var isHexDigit = function isHexDigit(charCode) {
  3601. return charCode >= 48 && charCode <= 57 || charCode >= 65 && charCode <= 70 || charCode >= 97 && charCode <= 102;
  3602. };
  3603. var isPercentEncodedByte = function isPercentEncodedByte(str, i, len) {
  3604. return i + 2 < len && isHexDigit(str.charCodeAt(i + 1)) && isHexDigit(str.charCodeAt(i + 2));
  3605. };
  3606. function estimateDataURLDecodedBytes(url) {
  3607. if (!url || typeof url !== 'string') return 0;
  3608. if (!url.startsWith('data:')) return 0;
  3609. var comma = url.indexOf(',');
  3610. if (comma < 0) return 0;
  3611. var meta = url.slice(5, comma);
  3612. var body = url.slice(comma + 1);
  3613. var isBase64 = /;base64/i.test(meta);
  3614. if (isBase64) {
  3615. var effectiveLen = body.length;
  3616. var len = body.length; // cache length
  3617. for (var i = 0; i < len; i++) {
  3618. if (body.charCodeAt(i) === 37 /* '%' */ && i + 2 < len) {
  3619. var a = body.charCodeAt(i + 1);
  3620. var b = body.charCodeAt(i + 2);
  3621. var isHex = isHexDigit(a) && isHexDigit(b);
  3622. if (isHex) {
  3623. effectiveLen -= 2;
  3624. i += 2;
  3625. }
  3626. }
  3627. }
  3628. var pad = 0;
  3629. var idx = len - 1;
  3630. var tailIsPct3D = function tailIsPct3D(j) {
  3631. return j >= 2 && body.charCodeAt(j - 2) === 37 &&
  3632. // '%'
  3633. body.charCodeAt(j - 1) === 51 && (
  3634. // '3'
  3635. body.charCodeAt(j) === 68 || body.charCodeAt(j) === 100);
  3636. }; // 'D' or 'd'
  3637. if (idx >= 0) {
  3638. if (body.charCodeAt(idx) === 61 /* '=' */) {
  3639. pad++;
  3640. idx--;
  3641. } else if (tailIsPct3D(idx)) {
  3642. pad++;
  3643. idx -= 3;
  3644. }
  3645. }
  3646. if (pad === 1 && idx >= 0) {
  3647. if (body.charCodeAt(idx) === 61 /* '=' */) {
  3648. pad++;
  3649. } else if (tailIsPct3D(idx)) {
  3650. pad++;
  3651. }
  3652. }
  3653. var groups = Math.floor(effectiveLen / 4);
  3654. var _bytes = groups * 3 - (pad || 0);
  3655. return _bytes > 0 ? _bytes : 0;
  3656. }
  3657. // Compute UTF-8 byte length directly from UTF-16 code units without allocating
  3658. // a byte buffer (TextEncoder.encode would defeat the DoS guard on large bodies).
  3659. // Valid %XX triplets count as one decoded byte; this matches the bytes that
  3660. // decodeURIComponent(body) would produce before Buffer re-encodes the string.
  3661. var bytes = 0;
  3662. for (var _i = 0, _len = body.length; _i < _len; _i++) {
  3663. var c = body.charCodeAt(_i);
  3664. if (c === 37 /* '%' */ && isPercentEncodedByte(body, _i, _len)) {
  3665. bytes += 1;
  3666. _i += 2;
  3667. } else if (c < 0x80) {
  3668. bytes += 1;
  3669. } else if (c < 0x800) {
  3670. bytes += 2;
  3671. } else if (c >= 0xd800 && c <= 0xdbff && _i + 1 < _len) {
  3672. var next = body.charCodeAt(_i + 1);
  3673. if (next >= 0xdc00 && next <= 0xdfff) {
  3674. bytes += 4;
  3675. _i++;
  3676. } else {
  3677. bytes += 3;
  3678. }
  3679. } else {
  3680. bytes += 3;
  3681. }
  3682. }
  3683. return bytes;
  3684. }
  3685. var VERSION = "1.18.0";
  3686. var DEFAULT_CHUNK_SIZE = 64 * 1024;
  3687. var isFunction = utils$1.isFunction;
  3688. /**
  3689. * Encode a UTF-8 string to a Latin-1 byte string for use with btoa().
  3690. * This is a modern replacement for the deprecated unescape(encodeURIComponent(str)) pattern.
  3691. *
  3692. * @param {string} str The string to encode
  3693. *
  3694. * @returns {string} UTF-8 bytes as a Latin-1 string
  3695. */
  3696. var encodeUTF8 = function encodeUTF8(str) {
  3697. return encodeURIComponent(str).replace(/%([0-9A-F]{2})/gi, function (_, hex) {
  3698. return String.fromCharCode(parseInt(hex, 16));
  3699. });
  3700. };
  3701. // Node's WHATWG URL parser returns `username` and `password` percent-encoded.
  3702. // Decode before composing the `auth` option so credentials such as
  3703. // `my%40email.com:pass` are sent as `my@email.com:pass`. Falls back to the
  3704. // original value for malformed input so a bad encoding never throws.
  3705. var decodeURIComponentSafe = function decodeURIComponentSafe(value) {
  3706. if (!utils$1.isString(value)) {
  3707. return value;
  3708. }
  3709. try {
  3710. return decodeURIComponent(value);
  3711. } catch (error) {
  3712. return value;
  3713. }
  3714. };
  3715. var test = function test(fn) {
  3716. try {
  3717. for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  3718. args[_key - 1] = arguments[_key];
  3719. }
  3720. return !!fn.apply(void 0, args);
  3721. } catch (e) {
  3722. return false;
  3723. }
  3724. };
  3725. var maybeWithAuthCredentials = function maybeWithAuthCredentials(url) {
  3726. var protocolIndex = url.indexOf('://');
  3727. var urlToCheck = url;
  3728. if (protocolIndex !== -1) {
  3729. urlToCheck = urlToCheck.slice(protocolIndex + 3);
  3730. }
  3731. return urlToCheck.includes('@') || urlToCheck.includes(':');
  3732. };
  3733. var factory = function factory(env) {
  3734. var globalObject = utils$1.global !== undefined && utils$1.global !== null ? utils$1.global : globalThis;
  3735. var ReadableStream = globalObject.ReadableStream,
  3736. TextEncoder = globalObject.TextEncoder;
  3737. env = utils$1.merge.call({
  3738. skipUndefined: true
  3739. }, {
  3740. Request: globalObject.Request,
  3741. Response: globalObject.Response
  3742. }, env);
  3743. var _env = env,
  3744. envFetch = _env.fetch,
  3745. Request = _env.Request,
  3746. Response = _env.Response;
  3747. var isFetchSupported = envFetch ? isFunction(envFetch) : typeof fetch === 'function';
  3748. var isRequestSupported = isFunction(Request);
  3749. var isResponseSupported = isFunction(Response);
  3750. if (!isFetchSupported) {
  3751. return false;
  3752. }
  3753. var isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream);
  3754. var encodeText = isFetchSupported && (typeof TextEncoder === 'function' ? function (encoder) {
  3755. return function (str) {
  3756. return encoder.encode(str);
  3757. };
  3758. }(new TextEncoder()) : (/*#__PURE__*/function () {
  3759. var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(str) {
  3760. var _t, _t2;
  3761. return _regenerator().w(function (_context) {
  3762. while (1) switch (_context.n) {
  3763. case 0:
  3764. _t = Uint8Array;
  3765. _context.n = 1;
  3766. return new Request(str).arrayBuffer();
  3767. case 1:
  3768. _t2 = _context.v;
  3769. return _context.a(2, new _t(_t2));
  3770. }
  3771. }, _callee);
  3772. }));
  3773. return function (_x) {
  3774. return _ref.apply(this, arguments);
  3775. };
  3776. }()));
  3777. var supportsRequestStream = isRequestSupported && isReadableStreamSupported && test(function () {
  3778. var duplexAccessed = false;
  3779. var request = new Request(platform.origin, {
  3780. body: new ReadableStream(),
  3781. method: 'POST',
  3782. get duplex() {
  3783. duplexAccessed = true;
  3784. return 'half';
  3785. }
  3786. });
  3787. var hasContentType = request.headers.has('Content-Type');
  3788. if (request.body != null) {
  3789. request.body.cancel();
  3790. }
  3791. return duplexAccessed && !hasContentType;
  3792. });
  3793. var supportsResponseStream = isResponseSupported && isReadableStreamSupported && test(function () {
  3794. return utils$1.isReadableStream(new Response('').body);
  3795. });
  3796. var resolvers = {
  3797. stream: supportsResponseStream && function (res) {
  3798. return res.body;
  3799. }
  3800. };
  3801. isFetchSupported && function () {
  3802. ['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(function (type) {
  3803. !resolvers[type] && (resolvers[type] = function (res, config) {
  3804. var method = res && res[type];
  3805. if (method) {
  3806. return method.call(res);
  3807. }
  3808. throw new AxiosError("Response type '".concat(type, "' is not supported"), AxiosError.ERR_NOT_SUPPORT, config);
  3809. });
  3810. });
  3811. }();
  3812. var getBodyLength = /*#__PURE__*/function () {
  3813. var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(body) {
  3814. var _request;
  3815. return _regenerator().w(function (_context2) {
  3816. while (1) switch (_context2.n) {
  3817. case 0:
  3818. if (!(body == null)) {
  3819. _context2.n = 1;
  3820. break;
  3821. }
  3822. return _context2.a(2, 0);
  3823. case 1:
  3824. if (!utils$1.isBlob(body)) {
  3825. _context2.n = 2;
  3826. break;
  3827. }
  3828. return _context2.a(2, body.size);
  3829. case 2:
  3830. if (!utils$1.isSpecCompliantForm(body)) {
  3831. _context2.n = 4;
  3832. break;
  3833. }
  3834. _request = new Request(platform.origin, {
  3835. method: 'POST',
  3836. body: body
  3837. });
  3838. _context2.n = 3;
  3839. return _request.arrayBuffer();
  3840. case 3:
  3841. return _context2.a(2, _context2.v.byteLength);
  3842. case 4:
  3843. if (!(utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body))) {
  3844. _context2.n = 5;
  3845. break;
  3846. }
  3847. return _context2.a(2, body.byteLength);
  3848. case 5:
  3849. if (utils$1.isURLSearchParams(body)) {
  3850. body = body + '';
  3851. }
  3852. if (!utils$1.isString(body)) {
  3853. _context2.n = 7;
  3854. break;
  3855. }
  3856. _context2.n = 6;
  3857. return encodeText(body);
  3858. case 6:
  3859. return _context2.a(2, _context2.v.byteLength);
  3860. case 7:
  3861. return _context2.a(2);
  3862. }
  3863. }, _callee2);
  3864. }));
  3865. return function getBodyLength(_x2) {
  3866. return _ref2.apply(this, arguments);
  3867. };
  3868. }();
  3869. var resolveBodyLength = /*#__PURE__*/function () {
  3870. var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(headers, body) {
  3871. var length;
  3872. return _regenerator().w(function (_context3) {
  3873. while (1) switch (_context3.n) {
  3874. case 0:
  3875. length = utils$1.toFiniteNumber(headers.getContentLength());
  3876. return _context3.a(2, length == null ? getBodyLength(body) : length);
  3877. }
  3878. }, _callee3);
  3879. }));
  3880. return function resolveBodyLength(_x3, _x4) {
  3881. return _ref3.apply(this, arguments);
  3882. };
  3883. }();
  3884. return /*#__PURE__*/function () {
  3885. var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(config) {
  3886. var _resolveConfig, url, method, data, signal, cancelToken, timeout, onDownloadProgress, onUploadProgress, responseType, headers, _resolveConfig$withCr, withCredentials, fetchOptions, maxContentLength, maxBodyLength, hasMaxContentLength, hasMaxBodyLength, own, _fetch, composedSignal, request, unsubscribe, requestContentLength, pendingBodyError, maxBodyLengthError, auth, configAuth, username, password, parsedURL, urlUsername, urlPassword, estimated, outboundLength, mustEnforceStreamBody, trackRequestStream, _request, contentTypeHeader, _ref5, _ref6, onProgress, flush, isCredentialsSupported, contentType, resolvedOptions, response, responseHeaders, declaredLength, isStreamResponse, options, responseContentLength, _ref7, _ref8, _onProgress, _flush, bytesRead, onChunkProgress, responseData, materializedSize, canceledError, _t3, _t4;
  3887. return _regenerator().w(function (_context4) {
  3888. while (1) switch (_context4.p = _context4.n) {
  3889. case 0:
  3890. _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, maxContentLength = _resolveConfig.maxContentLength, maxBodyLength = _resolveConfig.maxBodyLength;
  3891. hasMaxContentLength = utils$1.isNumber(maxContentLength) && maxContentLength > -1;
  3892. hasMaxBodyLength = utils$1.isNumber(maxBodyLength) && maxBodyLength > -1;
  3893. own = function own(key) {
  3894. return utils$1.hasOwnProp(config, key) ? config[key] : undefined;
  3895. };
  3896. _fetch = envFetch || fetch;
  3897. responseType = responseType ? (responseType + '').toLowerCase() : 'text';
  3898. composedSignal = composeSignals([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
  3899. request = null;
  3900. unsubscribe = composedSignal && composedSignal.unsubscribe && function () {
  3901. composedSignal.unsubscribe();
  3902. };
  3903. // AxiosError we raise while the request body is being streamed. Captured
  3904. // by identity so the catch block can surface it directly, regardless of
  3905. // how the runtime wraps the resulting fetch rejection (undici exposes it
  3906. // as `err.cause`; some browsers drop the original error entirely).
  3907. pendingBodyError = null;
  3908. maxBodyLengthError = function maxBodyLengthError() {
  3909. return new AxiosError('Request body larger than maxBodyLength limit', AxiosError.ERR_BAD_REQUEST, config, request);
  3910. };
  3911. _context4.p = 1;
  3912. // HTTP basic authentication
  3913. auth = undefined;
  3914. configAuth = own('auth');
  3915. if (configAuth) {
  3916. username = utils$1.getSafeProp(configAuth, 'username') || '';
  3917. password = utils$1.getSafeProp(configAuth, 'password') || '';
  3918. auth = {
  3919. username: username,
  3920. password: password
  3921. };
  3922. }
  3923. if (maybeWithAuthCredentials(url)) {
  3924. parsedURL = new URL(url, platform.origin);
  3925. if (!auth && (parsedURL.username || parsedURL.password)) {
  3926. urlUsername = decodeURIComponentSafe(parsedURL.username);
  3927. urlPassword = decodeURIComponentSafe(parsedURL.password);
  3928. auth = {
  3929. username: urlUsername,
  3930. password: urlPassword
  3931. };
  3932. }
  3933. if (parsedURL.username || parsedURL.password) {
  3934. parsedURL.username = '';
  3935. parsedURL.password = '';
  3936. url = parsedURL.href;
  3937. }
  3938. }
  3939. if (auth) {
  3940. headers["delete"]('authorization');
  3941. headers.set('Authorization', 'Basic ' + btoa(encodeUTF8((auth.username || '') + ':' + (auth.password || ''))));
  3942. }
  3943. // Enforce maxContentLength for data: URLs up-front so we never materialize
  3944. // an oversized payload. The HTTP adapter applies the same check (see http.js
  3945. // "if (protocol === 'data:')" branch).
  3946. if (!(hasMaxContentLength && typeof url === 'string' && url.startsWith('data:'))) {
  3947. _context4.n = 2;
  3948. break;
  3949. }
  3950. estimated = estimateDataURLDecodedBytes(url);
  3951. if (!(estimated > maxContentLength)) {
  3952. _context4.n = 2;
  3953. break;
  3954. }
  3955. throw new AxiosError('maxContentLength size of ' + maxContentLength + ' exceeded', AxiosError.ERR_BAD_RESPONSE, config, request);
  3956. case 2:
  3957. if (!(hasMaxBodyLength && method !== 'get' && method !== 'head')) {
  3958. _context4.n = 4;
  3959. break;
  3960. }
  3961. _context4.n = 3;
  3962. return getBodyLength(data);
  3963. case 3:
  3964. outboundLength = _context4.v;
  3965. if (!(typeof outboundLength === 'number' && isFinite(outboundLength))) {
  3966. _context4.n = 4;
  3967. break;
  3968. }
  3969. requestContentLength = outboundLength;
  3970. if (!(outboundLength > maxBodyLength)) {
  3971. _context4.n = 4;
  3972. break;
  3973. }
  3974. throw maxBodyLengthError();
  3975. case 4:
  3976. // A streamed body under maxBodyLength must be counted as fetch consumes
  3977. // it; its size is never trusted from a caller-declared Content-Length.
  3978. mustEnforceStreamBody = hasMaxBodyLength && (utils$1.isReadableStream(data) || utils$1.isStream(data));
  3979. trackRequestStream = function trackRequestStream(stream, onProgress, flush) {
  3980. return trackStream(stream, DEFAULT_CHUNK_SIZE, function (loadedBytes) {
  3981. if (hasMaxBodyLength && loadedBytes > maxBodyLength) {
  3982. throw pendingBodyError = maxBodyLengthError();
  3983. }
  3984. onProgress && onProgress(loadedBytes);
  3985. }, flush);
  3986. };
  3987. if (!(supportsRequestStream && method !== 'get' && method !== 'head' && (onUploadProgress || mustEnforceStreamBody))) {
  3988. _context4.n = 8;
  3989. break;
  3990. }
  3991. if (!(requestContentLength == null)) {
  3992. _context4.n = 6;
  3993. break;
  3994. }
  3995. _context4.n = 5;
  3996. return resolveBodyLength(headers, data);
  3997. case 5:
  3998. _t3 = _context4.v;
  3999. _context4.n = 7;
  4000. break;
  4001. case 6:
  4002. _t3 = requestContentLength;
  4003. case 7:
  4004. requestContentLength = _t3;
  4005. // A declared length of 0 is only trusted to skip the wrap when we are
  4006. // not enforcing a stream limit (which must not rely on that header).
  4007. if (requestContentLength !== 0 || mustEnforceStreamBody) {
  4008. _request = new Request(url, {
  4009. method: 'POST',
  4010. body: data,
  4011. duplex: 'half'
  4012. });
  4013. if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
  4014. headers.setContentType(contentTypeHeader);
  4015. }
  4016. if (_request.body) {
  4017. _ref5 = onUploadProgress && progressEventDecorator(requestContentLength, progressEventReducer(asyncDecorator(onUploadProgress))) || [], _ref6 = _slicedToArray(_ref5, 2), onProgress = _ref6[0], flush = _ref6[1];
  4018. data = trackRequestStream(_request.body, onProgress, flush);
  4019. }
  4020. }
  4021. _context4.n = 10;
  4022. break;
  4023. case 8:
  4024. if (!(mustEnforceStreamBody && !isRequestSupported && isReadableStreamSupported && method !== 'get' && method !== 'head')) {
  4025. _context4.n = 9;
  4026. break;
  4027. }
  4028. data = trackRequestStream(data);
  4029. _context4.n = 10;
  4030. break;
  4031. case 9:
  4032. if (!(mustEnforceStreamBody && isRequestSupported && !supportsRequestStream && method !== 'get' && method !== 'head')) {
  4033. _context4.n = 10;
  4034. break;
  4035. }
  4036. throw new AxiosError('Stream request bodies are not supported by the current fetch implementation', AxiosError.ERR_NOT_SUPPORT, config, request);
  4037. case 10:
  4038. if (!utils$1.isString(withCredentials)) {
  4039. withCredentials = withCredentials ? 'include' : 'omit';
  4040. }
  4041. // Cloudflare Workers throws when credentials are defined
  4042. // see https://github.com/cloudflare/workerd/issues/902
  4043. isCredentialsSupported = isRequestSupported && 'credentials' in Request.prototype; // If data is FormData and Content-Type is multipart/form-data without boundary,
  4044. // delete it so fetch can set it correctly with the boundary
  4045. if (utils$1.isFormData(data)) {
  4046. contentType = headers.getContentType();
  4047. if (contentType && /^multipart\/form-data/i.test(contentType) && !/boundary=/i.test(contentType)) {
  4048. headers["delete"]('content-type');
  4049. }
  4050. }
  4051. // Set User-Agent header if not already set (fetch defaults to 'node' in Node.js)
  4052. headers.set('User-Agent', 'axios/' + VERSION, false);
  4053. resolvedOptions = _objectSpread2(_objectSpread2({}, fetchOptions), {}, {
  4054. signal: composedSignal,
  4055. method: method.toUpperCase(),
  4056. headers: toByteStringHeaderObject(headers.normalize()),
  4057. body: data,
  4058. duplex: 'half',
  4059. credentials: isCredentialsSupported ? withCredentials : undefined
  4060. });
  4061. request = isRequestSupported && new Request(url, resolvedOptions);
  4062. _context4.n = 11;
  4063. return isRequestSupported ? _fetch(request, fetchOptions) : _fetch(url, resolvedOptions);
  4064. case 11:
  4065. response = _context4.v;
  4066. responseHeaders = AxiosHeaders.from(response.headers); // Cheap pre-check: if the server honestly declares a content-length that
  4067. // already exceeds the cap, reject before we start streaming.
  4068. if (!hasMaxContentLength) {
  4069. _context4.n = 12;
  4070. break;
  4071. }
  4072. declaredLength = utils$1.toFiniteNumber(responseHeaders.getContentLength());
  4073. if (!(declaredLength != null && declaredLength > maxContentLength)) {
  4074. _context4.n = 12;
  4075. break;
  4076. }
  4077. throw new AxiosError('maxContentLength size of ' + maxContentLength + ' exceeded', AxiosError.ERR_BAD_RESPONSE, config, request);
  4078. case 12:
  4079. isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
  4080. if (supportsResponseStream && response.body && (onDownloadProgress || hasMaxContentLength || isStreamResponse && unsubscribe)) {
  4081. options = {};
  4082. ['status', 'statusText', 'headers'].forEach(function (prop) {
  4083. options[prop] = response[prop];
  4084. });
  4085. responseContentLength = utils$1.toFiniteNumber(responseHeaders.getContentLength());
  4086. _ref7 = onDownloadProgress && progressEventDecorator(responseContentLength, progressEventReducer(asyncDecorator(onDownloadProgress), true)) || [], _ref8 = _slicedToArray(_ref7, 2), _onProgress = _ref8[0], _flush = _ref8[1];
  4087. bytesRead = 0;
  4088. onChunkProgress = function onChunkProgress(loadedBytes) {
  4089. if (hasMaxContentLength) {
  4090. bytesRead = loadedBytes;
  4091. if (bytesRead > maxContentLength) {
  4092. throw new AxiosError('maxContentLength size of ' + maxContentLength + ' exceeded', AxiosError.ERR_BAD_RESPONSE, config, request);
  4093. }
  4094. }
  4095. _onProgress && _onProgress(loadedBytes);
  4096. };
  4097. response = new Response(trackStream(response.body, DEFAULT_CHUNK_SIZE, onChunkProgress, function () {
  4098. _flush && _flush();
  4099. unsubscribe && unsubscribe();
  4100. }), options);
  4101. }
  4102. responseType = responseType || 'text';
  4103. _context4.n = 13;
  4104. return resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config);
  4105. case 13:
  4106. responseData = _context4.v;
  4107. if (!(hasMaxContentLength && !supportsResponseStream && !isStreamResponse)) {
  4108. _context4.n = 14;
  4109. break;
  4110. }
  4111. if (responseData != null) {
  4112. if (typeof responseData.byteLength === 'number') {
  4113. materializedSize = responseData.byteLength;
  4114. } else if (typeof responseData.size === 'number') {
  4115. materializedSize = responseData.size;
  4116. } else if (typeof responseData === 'string') {
  4117. materializedSize = typeof TextEncoder === 'function' ? new TextEncoder().encode(responseData).byteLength : responseData.length;
  4118. }
  4119. }
  4120. if (!(typeof materializedSize === 'number' && materializedSize > maxContentLength)) {
  4121. _context4.n = 14;
  4122. break;
  4123. }
  4124. throw new AxiosError('maxContentLength size of ' + maxContentLength + ' exceeded', AxiosError.ERR_BAD_RESPONSE, config, request);
  4125. case 14:
  4126. !isStreamResponse && unsubscribe && unsubscribe();
  4127. _context4.n = 15;
  4128. return new Promise(function (resolve, reject) {
  4129. settle(resolve, reject, {
  4130. data: responseData,
  4131. headers: AxiosHeaders.from(response.headers),
  4132. status: response.status,
  4133. statusText: response.statusText,
  4134. config: config,
  4135. request: request
  4136. });
  4137. });
  4138. case 15:
  4139. return _context4.a(2, _context4.v);
  4140. case 16:
  4141. _context4.p = 16;
  4142. _t4 = _context4.v;
  4143. unsubscribe && unsubscribe();
  4144. // Safari can surface fetch aborts as a DOMException-like object whose
  4145. // branded getters throw. Prefer our composed signal reason before reading
  4146. // the caught error, preserving timeout vs cancellation semantics.
  4147. if (!(composedSignal && composedSignal.aborted && composedSignal.reason instanceof AxiosError)) {
  4148. _context4.n = 17;
  4149. break;
  4150. }
  4151. canceledError = composedSignal.reason;
  4152. canceledError.config = config;
  4153. request && (canceledError.request = request);
  4154. _t4 !== canceledError && (canceledError.cause = _t4);
  4155. throw canceledError;
  4156. case 17:
  4157. if (!pendingBodyError) {
  4158. _context4.n = 18;
  4159. break;
  4160. }
  4161. request && !pendingBodyError.request && (pendingBodyError.request = request);
  4162. throw pendingBodyError;
  4163. case 18:
  4164. if (!(_t4 instanceof AxiosError)) {
  4165. _context4.n = 19;
  4166. break;
  4167. }
  4168. request && !_t4.request && (_t4.request = request);
  4169. throw _t4;
  4170. case 19:
  4171. if (!(_t4 && _t4.name === 'TypeError' && /Load failed|fetch/i.test(_t4.message))) {
  4172. _context4.n = 20;
  4173. break;
  4174. }
  4175. throw Object.assign(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request, _t4 && _t4.response), {
  4176. cause: _t4.cause || _t4
  4177. });
  4178. case 20:
  4179. throw AxiosError.from(_t4, _t4 && _t4.code, config, request, _t4 && _t4.response);
  4180. case 21:
  4181. return _context4.a(2);
  4182. }
  4183. }, _callee4, null, [[1, 16]]);
  4184. }));
  4185. return function (_x5) {
  4186. return _ref4.apply(this, arguments);
  4187. };
  4188. }();
  4189. };
  4190. var seedCache = new Map();
  4191. var getFetch = function getFetch(config) {
  4192. var env = config && config.env || {};
  4193. var fetch = env.fetch,
  4194. Request = env.Request,
  4195. Response = env.Response;
  4196. var seeds = [Request, Response, fetch];
  4197. var len = seeds.length,
  4198. i = len,
  4199. seed,
  4200. target,
  4201. map = seedCache;
  4202. while (i--) {
  4203. seed = seeds[i];
  4204. target = map.get(seed);
  4205. target === undefined && map.set(seed, target = i ? new Map() : factory(env));
  4206. map = target;
  4207. }
  4208. return target;
  4209. };
  4210. getFetch();
  4211. /**
  4212. * Known adapters mapping.
  4213. * Provides environment-specific adapters for Axios:
  4214. * - `http` for Node.js
  4215. * - `xhr` for browsers
  4216. * - `fetch` for fetch API-based requests
  4217. *
  4218. * @type {Object<string, Function|Object>}
  4219. */
  4220. var knownAdapters = {
  4221. http: httpAdapter,
  4222. xhr: xhrAdapter,
  4223. fetch: {
  4224. get: getFetch
  4225. }
  4226. };
  4227. // Assign adapter names for easier debugging and identification
  4228. utils$1.forEach(knownAdapters, function (fn, value) {
  4229. if (fn) {
  4230. try {
  4231. // Null-proto descriptors so a polluted Object.prototype.get cannot turn
  4232. // these data descriptors into accessor descriptors on the way in.
  4233. Object.defineProperty(fn, 'name', {
  4234. __proto__: null,
  4235. value: value
  4236. });
  4237. } catch (e) {
  4238. // eslint-disable-next-line no-empty
  4239. }
  4240. Object.defineProperty(fn, 'adapterName', {
  4241. __proto__: null,
  4242. value: value
  4243. });
  4244. }
  4245. });
  4246. /**
  4247. * Render a rejection reason string for unknown or unsupported adapters
  4248. *
  4249. * @param {string} reason
  4250. * @returns {string}
  4251. */
  4252. var renderReason = function renderReason(reason) {
  4253. return "- ".concat(reason);
  4254. };
  4255. /**
  4256. * Check if the adapter is resolved (function, null, or false)
  4257. *
  4258. * @param {Function|null|false} adapter
  4259. * @returns {boolean}
  4260. */
  4261. var isResolvedHandle = function isResolvedHandle(adapter) {
  4262. return utils$1.isFunction(adapter) || adapter === null || adapter === false;
  4263. };
  4264. /**
  4265. * Get the first suitable adapter from the provided list.
  4266. * Tries each adapter in order until a supported one is found.
  4267. * Throws an AxiosError if no adapter is suitable.
  4268. *
  4269. * @param {Array<string|Function>|string|Function} adapters - Adapter(s) by name or function.
  4270. * @param {Object} config - Axios request configuration
  4271. * @throws {AxiosError} If no suitable adapter is available
  4272. * @returns {Function} The resolved adapter function
  4273. */
  4274. function getAdapter(adapters, config) {
  4275. adapters = utils$1.isArray(adapters) ? adapters : [adapters];
  4276. var _adapters = adapters,
  4277. length = _adapters.length;
  4278. var nameOrAdapter;
  4279. var adapter;
  4280. var rejectedReasons = {};
  4281. for (var i = 0; i < length; i++) {
  4282. nameOrAdapter = adapters[i];
  4283. var id = void 0;
  4284. adapter = nameOrAdapter;
  4285. if (!isResolvedHandle(nameOrAdapter)) {
  4286. adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
  4287. if (adapter === undefined) {
  4288. throw new AxiosError("Unknown adapter '".concat(id, "'"));
  4289. }
  4290. }
  4291. if (adapter && (utils$1.isFunction(adapter) || (adapter = adapter.get(config)))) {
  4292. break;
  4293. }
  4294. rejectedReasons[id || '#' + i] = adapter;
  4295. }
  4296. if (!adapter) {
  4297. var reasons = Object.entries(rejectedReasons).map(function (_ref) {
  4298. var _ref2 = _slicedToArray(_ref, 2),
  4299. id = _ref2[0],
  4300. state = _ref2[1];
  4301. return "adapter ".concat(id, " ") + (state === false ? 'is not supported by the environment' : 'is not available in the build');
  4302. });
  4303. var s = length ? reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0]) : 'as no adapter specified';
  4304. throw new AxiosError("There is no suitable adapter to dispatch the request " + s, 'ERR_NOT_SUPPORT');
  4305. }
  4306. return adapter;
  4307. }
  4308. /**
  4309. * Exports Axios adapters and utility to resolve an adapter
  4310. */
  4311. var adapters = {
  4312. /**
  4313. * Resolve an adapter from a list of adapter names or functions.
  4314. * @type {Function}
  4315. */
  4316. getAdapter: getAdapter,
  4317. /**
  4318. * Exposes all known adapters
  4319. * @type {Object<string, Function|Object>}
  4320. */
  4321. adapters: knownAdapters
  4322. };
  4323. /**
  4324. * Throws a `CanceledError` if cancellation has been requested.
  4325. *
  4326. * @param {Object} config The config that is to be used for the request
  4327. *
  4328. * @returns {void}
  4329. */
  4330. function throwIfCancellationRequested(config) {
  4331. if (config.cancelToken) {
  4332. config.cancelToken.throwIfRequested();
  4333. }
  4334. if (config.signal && config.signal.aborted) {
  4335. throw new CanceledError(null, config);
  4336. }
  4337. }
  4338. /**
  4339. * Dispatch a request to the server using the configured adapter.
  4340. *
  4341. * @param {object} config The config that is to be used for the request
  4342. *
  4343. * @returns {Promise} The Promise to be fulfilled
  4344. */
  4345. function dispatchRequest(config) {
  4346. throwIfCancellationRequested(config);
  4347. config.headers = AxiosHeaders.from(config.headers);
  4348. // Transform request data
  4349. config.data = transformData.call(config, config.transformRequest);
  4350. if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {
  4351. config.headers.setContentType('application/x-www-form-urlencoded', false);
  4352. }
  4353. var adapter = adapters.getAdapter(config.adapter || defaults.adapter, config);
  4354. return adapter(config).then(function onAdapterResolution(response) {
  4355. throwIfCancellationRequested(config);
  4356. // Expose the current response on config so that transformResponse can
  4357. // attach it to any AxiosError it throws (e.g. on JSON parse failure).
  4358. // We clean it up afterwards to avoid polluting the config object.
  4359. config.response = response;
  4360. try {
  4361. response.data = transformData.call(config, config.transformResponse, response);
  4362. } finally {
  4363. delete config.response;
  4364. }
  4365. response.headers = AxiosHeaders.from(response.headers);
  4366. return response;
  4367. }, function onAdapterRejection(reason) {
  4368. if (!isCancel(reason)) {
  4369. throwIfCancellationRequested(config);
  4370. // Transform response data
  4371. if (reason && reason.response) {
  4372. config.response = reason.response;
  4373. try {
  4374. reason.response.data = transformData.call(config, config.transformResponse, reason.response);
  4375. } finally {
  4376. delete config.response;
  4377. }
  4378. reason.response.headers = AxiosHeaders.from(reason.response.headers);
  4379. }
  4380. }
  4381. return Promise.reject(reason);
  4382. });
  4383. }
  4384. var validators$1 = {};
  4385. // eslint-disable-next-line func-names
  4386. ['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach(function (type, i) {
  4387. validators$1[type] = function validator(thing) {
  4388. return _typeof(thing) === type || 'a' + (i < 1 ? 'n ' : ' ') + type;
  4389. };
  4390. });
  4391. var deprecatedWarnings = {};
  4392. /**
  4393. * Transitional option validator
  4394. *
  4395. * @param {function|boolean?} validator - set to false if the transitional option has been removed
  4396. * @param {string?} version - deprecated version / removed since version
  4397. * @param {string?} message - some message with additional info
  4398. *
  4399. * @returns {function}
  4400. */
  4401. validators$1.transitional = function transitional(validator, version, message) {
  4402. function formatMessage(opt, desc) {
  4403. return '[Axios v' + VERSION + "] Transitional option '" + opt + "'" + desc + (message ? '. ' + message : '');
  4404. }
  4405. // eslint-disable-next-line func-names
  4406. return function (value, opt, opts) {
  4407. if (validator === false) {
  4408. throw new AxiosError(formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')), AxiosError.ERR_DEPRECATED);
  4409. }
  4410. if (version && !deprecatedWarnings[opt]) {
  4411. deprecatedWarnings[opt] = true;
  4412. // eslint-disable-next-line no-console
  4413. console.warn(formatMessage(opt, ' has been deprecated since v' + version + ' and will be removed in the near future'));
  4414. }
  4415. return validator ? validator(value, opt, opts) : true;
  4416. };
  4417. };
  4418. validators$1.spelling = function spelling(correctSpelling) {
  4419. return function (value, opt) {
  4420. // eslint-disable-next-line no-console
  4421. console.warn("".concat(opt, " is likely a misspelling of ").concat(correctSpelling));
  4422. return true;
  4423. };
  4424. };
  4425. /**
  4426. * Assert object's properties type
  4427. *
  4428. * @param {object} options
  4429. * @param {object} schema
  4430. * @param {boolean?} allowUnknown
  4431. *
  4432. * @returns {object}
  4433. */
  4434. function assertOptions(options, schema, allowUnknown) {
  4435. if (_typeof(options) !== 'object') {
  4436. throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE);
  4437. }
  4438. var keys = Object.keys(options);
  4439. var i = keys.length;
  4440. while (i-- > 0) {
  4441. var opt = keys[i];
  4442. // Use hasOwnProperty so a polluted Object.prototype.<opt> cannot supply
  4443. // a non-function validator and cause a TypeError.
  4444. var validator = Object.prototype.hasOwnProperty.call(schema, opt) ? schema[opt] : undefined;
  4445. if (validator) {
  4446. var value = options[opt];
  4447. var result = value === undefined || validator(value, opt, options);
  4448. if (result !== true) {
  4449. throw new AxiosError('option ' + opt + ' must be ' + result, AxiosError.ERR_BAD_OPTION_VALUE);
  4450. }
  4451. continue;
  4452. }
  4453. if (allowUnknown !== true) {
  4454. throw new AxiosError('Unknown option ' + opt, AxiosError.ERR_BAD_OPTION);
  4455. }
  4456. }
  4457. }
  4458. var validator = {
  4459. assertOptions: assertOptions,
  4460. validators: validators$1
  4461. };
  4462. var validators = validator.validators;
  4463. /**
  4464. * Create a new instance of Axios
  4465. *
  4466. * @param {Object} instanceConfig The default config for the instance
  4467. *
  4468. * @return {Axios} A new instance of Axios
  4469. */
  4470. var Axios = /*#__PURE__*/function () {
  4471. function Axios(instanceConfig) {
  4472. _classCallCheck(this, Axios);
  4473. this.defaults = instanceConfig || {};
  4474. this.interceptors = {
  4475. request: new InterceptorManager(),
  4476. response: new InterceptorManager()
  4477. };
  4478. }
  4479. /**
  4480. * Dispatch a request
  4481. *
  4482. * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
  4483. * @param {?Object} config
  4484. *
  4485. * @returns {Promise} The Promise to be fulfilled
  4486. */
  4487. return _createClass(Axios, [{
  4488. key: "request",
  4489. value: (function () {
  4490. var _request2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(configOrUrl, config) {
  4491. var dummy, stack, firstNewlineIndex, secondNewlineIndex, stackWithoutTwoTopLines, _t;
  4492. return _regenerator().w(function (_context) {
  4493. while (1) switch (_context.p = _context.n) {
  4494. case 0:
  4495. _context.p = 0;
  4496. _context.n = 1;
  4497. return this._request(configOrUrl, config);
  4498. case 1:
  4499. return _context.a(2, _context.v);
  4500. case 2:
  4501. _context.p = 2;
  4502. _t = _context.v;
  4503. if (_t instanceof Error) {
  4504. dummy = {};
  4505. Error.captureStackTrace ? Error.captureStackTrace(dummy) : dummy = new Error();
  4506. // slice off the Error: ... line
  4507. stack = function () {
  4508. if (!dummy.stack) {
  4509. return '';
  4510. }
  4511. var firstNewlineIndex = dummy.stack.indexOf('\n');
  4512. return firstNewlineIndex === -1 ? '' : dummy.stack.slice(firstNewlineIndex + 1);
  4513. }();
  4514. try {
  4515. if (!_t.stack) {
  4516. _t.stack = stack;
  4517. // match without the 2 top stack lines
  4518. } else if (stack) {
  4519. firstNewlineIndex = stack.indexOf('\n');
  4520. secondNewlineIndex = firstNewlineIndex === -1 ? -1 : stack.indexOf('\n', firstNewlineIndex + 1);
  4521. stackWithoutTwoTopLines = secondNewlineIndex === -1 ? '' : stack.slice(secondNewlineIndex + 1);
  4522. if (!String(_t.stack).endsWith(stackWithoutTwoTopLines)) {
  4523. _t.stack += '\n' + stack;
  4524. }
  4525. }
  4526. } catch (e) {
  4527. // ignore the case where "stack" is an un-writable property
  4528. }
  4529. }
  4530. throw _t;
  4531. case 3:
  4532. return _context.a(2);
  4533. }
  4534. }, _callee, this, [[0, 2]]);
  4535. }));
  4536. function request(_x, _x2) {
  4537. return _request2.apply(this, arguments);
  4538. }
  4539. return request;
  4540. }())
  4541. }, {
  4542. key: "_request",
  4543. value: function _request(configOrUrl, config) {
  4544. /*eslint no-param-reassign:0*/
  4545. // Allow for axios('example/url'[, config]) a la fetch API
  4546. if (typeof configOrUrl === 'string') {
  4547. config = config || {};
  4548. config.url = configOrUrl;
  4549. } else {
  4550. config = configOrUrl || {};
  4551. }
  4552. config = mergeConfig(this.defaults, config);
  4553. var _config = config,
  4554. transitional = _config.transitional,
  4555. paramsSerializer = _config.paramsSerializer,
  4556. headers = _config.headers;
  4557. if (transitional !== undefined) {
  4558. validator.assertOptions(transitional, {
  4559. silentJSONParsing: validators.transitional(validators["boolean"]),
  4560. forcedJSONParsing: validators.transitional(validators["boolean"]),
  4561. clarifyTimeoutError: validators.transitional(validators["boolean"]),
  4562. legacyInterceptorReqResOrdering: validators.transitional(validators["boolean"]),
  4563. advertiseZstdAcceptEncoding: validators.transitional(validators["boolean"]),
  4564. validateStatusUndefinedResolves: validators.transitional(validators["boolean"])
  4565. }, false);
  4566. }
  4567. if (paramsSerializer != null) {
  4568. if (utils$1.isFunction(paramsSerializer)) {
  4569. config.paramsSerializer = {
  4570. serialize: paramsSerializer
  4571. };
  4572. } else {
  4573. validator.assertOptions(paramsSerializer, {
  4574. encode: validators["function"],
  4575. serialize: validators["function"]
  4576. }, true);
  4577. }
  4578. }
  4579. // Set config.allowAbsoluteUrls
  4580. if (config.allowAbsoluteUrls !== undefined) ; else if (this.defaults.allowAbsoluteUrls !== undefined) {
  4581. config.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls;
  4582. } else {
  4583. config.allowAbsoluteUrls = true;
  4584. }
  4585. validator.assertOptions(config, {
  4586. baseUrl: validators.spelling('baseURL'),
  4587. withXsrfToken: validators.spelling('withXSRFToken')
  4588. }, true);
  4589. // Set config.method
  4590. config.method = (config.method || this.defaults.method || 'get').toLowerCase();
  4591. // Flatten headers
  4592. var contextHeaders = headers && utils$1.merge(headers.common, headers[config.method]);
  4593. headers && utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'query', 'common'], function (method) {
  4594. delete headers[method];
  4595. });
  4596. config.headers = AxiosHeaders.concat(contextHeaders, headers);
  4597. // filter out skipped interceptors
  4598. var requestInterceptorChain = [];
  4599. var synchronousRequestInterceptors = true;
  4600. this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
  4601. if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {
  4602. return;
  4603. }
  4604. synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
  4605. var transitional = config.transitional || transitionalDefaults;
  4606. var legacyInterceptorReqResOrdering = transitional && transitional.legacyInterceptorReqResOrdering;
  4607. if (legacyInterceptorReqResOrdering) {
  4608. requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
  4609. } else {
  4610. requestInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
  4611. }
  4612. });
  4613. var responseInterceptorChain = [];
  4614. this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
  4615. responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
  4616. });
  4617. var promise;
  4618. var i = 0;
  4619. var len;
  4620. if (!synchronousRequestInterceptors) {
  4621. var chain = [dispatchRequest.bind(this), undefined];
  4622. chain.unshift.apply(chain, requestInterceptorChain);
  4623. chain.push.apply(chain, responseInterceptorChain);
  4624. len = chain.length;
  4625. promise = Promise.resolve(config);
  4626. while (i < len) {
  4627. promise = promise.then(chain[i++], chain[i++]);
  4628. }
  4629. return promise;
  4630. }
  4631. len = requestInterceptorChain.length;
  4632. var newConfig = config;
  4633. while (i < len) {
  4634. var onFulfilled = requestInterceptorChain[i++];
  4635. var onRejected = requestInterceptorChain[i++];
  4636. try {
  4637. newConfig = onFulfilled(newConfig);
  4638. } catch (error) {
  4639. onRejected.call(this, error);
  4640. break;
  4641. }
  4642. }
  4643. try {
  4644. promise = dispatchRequest.call(this, newConfig);
  4645. } catch (error) {
  4646. return Promise.reject(error);
  4647. }
  4648. i = 0;
  4649. len = responseInterceptorChain.length;
  4650. while (i < len) {
  4651. promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);
  4652. }
  4653. return promise;
  4654. }
  4655. }, {
  4656. key: "getUri",
  4657. value: function getUri(config) {
  4658. config = mergeConfig(this.defaults, config);
  4659. var fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls, config);
  4660. return buildURL(fullPath, config.params, config.paramsSerializer);
  4661. }
  4662. }]);
  4663. }(); // Provide aliases for supported request methods
  4664. utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
  4665. /*eslint func-names:0*/
  4666. Axios.prototype[method] = function (url, config) {
  4667. return this.request(mergeConfig(config || {}, {
  4668. method: method,
  4669. url: url,
  4670. data: config && utils$1.hasOwnProp(config, 'data') ? config.data : undefined
  4671. }));
  4672. };
  4673. });
  4674. utils$1.forEach(['post', 'put', 'patch', 'query'], function forEachMethodWithData(method) {
  4675. function generateHTTPMethod(isForm) {
  4676. return function httpMethod(url, data, config) {
  4677. return this.request(mergeConfig(config || {}, {
  4678. method: method,
  4679. headers: isForm ? {
  4680. 'Content-Type': 'multipart/form-data'
  4681. } : {},
  4682. url: url,
  4683. data: data
  4684. }));
  4685. };
  4686. }
  4687. Axios.prototype[method] = generateHTTPMethod();
  4688. // QUERY is a safe/idempotent read method; multipart form bodies don't fit
  4689. // its semantics, so no queryForm shorthand is generated.
  4690. if (method !== 'query') {
  4691. Axios.prototype[method + 'Form'] = generateHTTPMethod(true);
  4692. }
  4693. });
  4694. /**
  4695. * A `CancelToken` is an object that can be used to request cancellation of an operation.
  4696. *
  4697. * @param {Function} executor The executor function.
  4698. *
  4699. * @returns {CancelToken}
  4700. */
  4701. var CancelToken = /*#__PURE__*/function () {
  4702. function CancelToken(executor) {
  4703. _classCallCheck(this, CancelToken);
  4704. if (typeof executor !== 'function') {
  4705. throw new TypeError('executor must be a function.');
  4706. }
  4707. var resolvePromise;
  4708. this.promise = new Promise(function promiseExecutor(resolve) {
  4709. resolvePromise = resolve;
  4710. });
  4711. var token = this;
  4712. // eslint-disable-next-line func-names
  4713. this.promise.then(function (cancel) {
  4714. if (!token._listeners) return;
  4715. var i = token._listeners.length;
  4716. while (i-- > 0) {
  4717. token._listeners[i](cancel);
  4718. }
  4719. token._listeners = null;
  4720. });
  4721. // eslint-disable-next-line func-names
  4722. this.promise.then = function (onfulfilled) {
  4723. var _resolve;
  4724. // eslint-disable-next-line func-names
  4725. var promise = new Promise(function (resolve) {
  4726. token.subscribe(resolve);
  4727. _resolve = resolve;
  4728. }).then(onfulfilled);
  4729. promise.cancel = function reject() {
  4730. token.unsubscribe(_resolve);
  4731. };
  4732. return promise;
  4733. };
  4734. executor(function cancel(message, config, request) {
  4735. if (token.reason) {
  4736. // Cancellation has already been requested
  4737. return;
  4738. }
  4739. token.reason = new CanceledError(message, config, request);
  4740. resolvePromise(token.reason);
  4741. });
  4742. }
  4743. /**
  4744. * Throws a `CanceledError` if cancellation has been requested.
  4745. */
  4746. return _createClass(CancelToken, [{
  4747. key: "throwIfRequested",
  4748. value: function throwIfRequested() {
  4749. if (this.reason) {
  4750. throw this.reason;
  4751. }
  4752. }
  4753. /**
  4754. * Subscribe to the cancel signal
  4755. */
  4756. }, {
  4757. key: "subscribe",
  4758. value: function subscribe(listener) {
  4759. if (this.reason) {
  4760. listener(this.reason);
  4761. return;
  4762. }
  4763. if (this._listeners) {
  4764. this._listeners.push(listener);
  4765. } else {
  4766. this._listeners = [listener];
  4767. }
  4768. }
  4769. /**
  4770. * Unsubscribe from the cancel signal
  4771. */
  4772. }, {
  4773. key: "unsubscribe",
  4774. value: function unsubscribe(listener) {
  4775. if (!this._listeners) {
  4776. return;
  4777. }
  4778. var index = this._listeners.indexOf(listener);
  4779. if (index !== -1) {
  4780. this._listeners.splice(index, 1);
  4781. }
  4782. }
  4783. }, {
  4784. key: "toAbortSignal",
  4785. value: function toAbortSignal() {
  4786. var _this = this;
  4787. var controller = new AbortController();
  4788. var abort = function abort(err) {
  4789. controller.abort(err);
  4790. };
  4791. this.subscribe(abort);
  4792. controller.signal.unsubscribe = function () {
  4793. return _this.unsubscribe(abort);
  4794. };
  4795. return controller.signal;
  4796. }
  4797. /**
  4798. * Returns an object that contains a new `CancelToken` and a function that, when called,
  4799. * cancels the `CancelToken`.
  4800. */
  4801. }], [{
  4802. key: "source",
  4803. value: function source() {
  4804. var cancel;
  4805. var token = new CancelToken(function executor(c) {
  4806. cancel = c;
  4807. });
  4808. return {
  4809. token: token,
  4810. cancel: cancel
  4811. };
  4812. }
  4813. }]);
  4814. }();
  4815. /**
  4816. * Syntactic sugar for invoking a function and expanding an array for arguments.
  4817. *
  4818. * Common use case would be to use `Function.prototype.apply`.
  4819. *
  4820. * ```js
  4821. * function f(x, y, z) {}
  4822. * const args = [1, 2, 3];
  4823. * f.apply(null, args);
  4824. * ```
  4825. *
  4826. * With `spread` this example can be re-written.
  4827. *
  4828. * ```js
  4829. * spread(function(x, y, z) {})([1, 2, 3]);
  4830. * ```
  4831. *
  4832. * @param {Function} callback
  4833. *
  4834. * @returns {Function}
  4835. */
  4836. function spread(callback) {
  4837. return function wrap(arr) {
  4838. return callback.apply(null, arr);
  4839. };
  4840. }
  4841. /**
  4842. * Determines whether the payload is an error thrown by Axios
  4843. *
  4844. * @param {*} payload The value to test
  4845. *
  4846. * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
  4847. */
  4848. function isAxiosError(payload) {
  4849. return utils$1.isObject(payload) && payload.isAxiosError === true;
  4850. }
  4851. var HttpStatusCode = {
  4852. Continue: 100,
  4853. SwitchingProtocols: 101,
  4854. Processing: 102,
  4855. EarlyHints: 103,
  4856. Ok: 200,
  4857. Created: 201,
  4858. Accepted: 202,
  4859. NonAuthoritativeInformation: 203,
  4860. NoContent: 204,
  4861. ResetContent: 205,
  4862. PartialContent: 206,
  4863. MultiStatus: 207,
  4864. AlreadyReported: 208,
  4865. ImUsed: 226,
  4866. MultipleChoices: 300,
  4867. MovedPermanently: 301,
  4868. Found: 302,
  4869. SeeOther: 303,
  4870. NotModified: 304,
  4871. UseProxy: 305,
  4872. Unused: 306,
  4873. TemporaryRedirect: 307,
  4874. PermanentRedirect: 308,
  4875. BadRequest: 400,
  4876. Unauthorized: 401,
  4877. PaymentRequired: 402,
  4878. Forbidden: 403,
  4879. NotFound: 404,
  4880. MethodNotAllowed: 405,
  4881. NotAcceptable: 406,
  4882. ProxyAuthenticationRequired: 407,
  4883. RequestTimeout: 408,
  4884. Conflict: 409,
  4885. Gone: 410,
  4886. LengthRequired: 411,
  4887. PreconditionFailed: 412,
  4888. PayloadTooLarge: 413,
  4889. UriTooLong: 414,
  4890. UnsupportedMediaType: 415,
  4891. RangeNotSatisfiable: 416,
  4892. ExpectationFailed: 417,
  4893. ImATeapot: 418,
  4894. MisdirectedRequest: 421,
  4895. UnprocessableEntity: 422,
  4896. Locked: 423,
  4897. FailedDependency: 424,
  4898. TooEarly: 425,
  4899. UpgradeRequired: 426,
  4900. PreconditionRequired: 428,
  4901. TooManyRequests: 429,
  4902. RequestHeaderFieldsTooLarge: 431,
  4903. UnavailableForLegalReasons: 451,
  4904. InternalServerError: 500,
  4905. NotImplemented: 501,
  4906. BadGateway: 502,
  4907. ServiceUnavailable: 503,
  4908. GatewayTimeout: 504,
  4909. HttpVersionNotSupported: 505,
  4910. VariantAlsoNegotiates: 506,
  4911. InsufficientStorage: 507,
  4912. LoopDetected: 508,
  4913. NotExtended: 510,
  4914. NetworkAuthenticationRequired: 511,
  4915. WebServerIsDown: 521,
  4916. ConnectionTimedOut: 522,
  4917. OriginIsUnreachable: 523,
  4918. TimeoutOccurred: 524,
  4919. SslHandshakeFailed: 525,
  4920. InvalidSslCertificate: 526
  4921. };
  4922. Object.entries(HttpStatusCode).forEach(function (_ref) {
  4923. var _ref2 = _slicedToArray(_ref, 2),
  4924. key = _ref2[0],
  4925. value = _ref2[1];
  4926. HttpStatusCode[value] = key;
  4927. });
  4928. /**
  4929. * Create an instance of Axios
  4930. *
  4931. * @param {Object} defaultConfig The default config for the instance
  4932. *
  4933. * @returns {Axios} A new instance of Axios
  4934. */
  4935. function createInstance(defaultConfig) {
  4936. var context = new Axios(defaultConfig);
  4937. var instance = bind(Axios.prototype.request, context);
  4938. // Copy axios.prototype to instance
  4939. utils$1.extend(instance, Axios.prototype, context, {
  4940. allOwnKeys: true
  4941. });
  4942. // Copy context to instance
  4943. utils$1.extend(instance, context, null, {
  4944. allOwnKeys: true
  4945. });
  4946. // Factory for creating new instances
  4947. instance.create = function create(instanceConfig) {
  4948. return createInstance(mergeConfig(defaultConfig, instanceConfig));
  4949. };
  4950. return instance;
  4951. }
  4952. // Create the default instance to be exported
  4953. var axios = createInstance(defaults);
  4954. // Expose Axios class to allow class inheritance
  4955. axios.Axios = Axios;
  4956. // Expose Cancel & CancelToken
  4957. axios.CanceledError = CanceledError;
  4958. axios.CancelToken = CancelToken;
  4959. axios.isCancel = isCancel;
  4960. axios.VERSION = VERSION;
  4961. axios.toFormData = toFormData;
  4962. // Expose AxiosError class
  4963. axios.AxiosError = AxiosError;
  4964. // alias for CanceledError for backward compatibility
  4965. axios.Cancel = axios.CanceledError;
  4966. // Expose all/spread
  4967. axios.all = function all(promises) {
  4968. return Promise.all(promises);
  4969. };
  4970. axios.spread = spread;
  4971. // Expose isAxiosError
  4972. axios.isAxiosError = isAxiosError;
  4973. // Expose mergeConfig
  4974. axios.mergeConfig = mergeConfig;
  4975. axios.AxiosHeaders = AxiosHeaders;
  4976. axios.formToJSON = function (thing) {
  4977. return formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
  4978. };
  4979. axios.getAdapter = adapters.getAdapter;
  4980. axios.HttpStatusCode = HttpStatusCode;
  4981. axios["default"] = axios;
  4982. return axios;
  4983. }));
  4984. //# sourceMappingURL=axios.js.map