utils-dev.be08a1a2.js 77 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501
  1. import "./element-dev.26a170ea.js";
  2. function bind(fn, thisArg) {
  3. return function wrap() {
  4. return fn.apply(thisArg, arguments);
  5. };
  6. }
  7. const { toString } = Object.prototype;
  8. const { getPrototypeOf } = Object;
  9. const { iterator, toStringTag } = Symbol;
  10. const kindOf = ((cache) => (thing) => {
  11. const str = toString.call(thing);
  12. return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
  13. })(/* @__PURE__ */ Object.create(null));
  14. const kindOfTest = (type) => {
  15. type = type.toLowerCase();
  16. return (thing) => kindOf(thing) === type;
  17. };
  18. const typeOfTest = (type) => (thing) => typeof thing === type;
  19. const { isArray } = Array;
  20. const isUndefined = typeOfTest("undefined");
  21. function isBuffer(val) {
  22. return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) && isFunction$1(val.constructor.isBuffer) && val.constructor.isBuffer(val);
  23. }
  24. const isArrayBuffer = kindOfTest("ArrayBuffer");
  25. function isArrayBufferView(val) {
  26. let result;
  27. if (typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView) {
  28. result = ArrayBuffer.isView(val);
  29. } else {
  30. result = val && val.buffer && isArrayBuffer(val.buffer);
  31. }
  32. return result;
  33. }
  34. const isString = typeOfTest("string");
  35. const isFunction$1 = typeOfTest("function");
  36. const isNumber = typeOfTest("number");
  37. const isObject = (thing) => thing !== null && typeof thing === "object";
  38. const isBoolean = (thing) => thing === true || thing === false;
  39. const isPlainObject = (val) => {
  40. if (kindOf(val) !== "object") {
  41. return false;
  42. }
  43. const prototype2 = getPrototypeOf(val);
  44. return (prototype2 === null || prototype2 === Object.prototype || Object.getPrototypeOf(prototype2) === null) && !(toStringTag in val) && !(iterator in val);
  45. };
  46. const isEmptyObject = (val) => {
  47. if (!isObject(val) || isBuffer(val)) {
  48. return false;
  49. }
  50. try {
  51. return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
  52. } catch (e) {
  53. return false;
  54. }
  55. };
  56. const isDate = kindOfTest("Date");
  57. const isFile = kindOfTest("File");
  58. const isBlob = kindOfTest("Blob");
  59. const isFileList = kindOfTest("FileList");
  60. const isStream = (val) => isObject(val) && isFunction$1(val.pipe);
  61. const isFormData = (thing) => {
  62. let kind;
  63. return thing && (typeof FormData === "function" && thing instanceof FormData || isFunction$1(thing.append) && ((kind = kindOf(thing)) === "formdata" || // detect form-data instance
  64. kind === "object" && isFunction$1(thing.toString) && thing.toString() === "[object FormData]"));
  65. };
  66. const isURLSearchParams = kindOfTest("URLSearchParams");
  67. const [isReadableStream, isRequest, isResponse, isHeaders] = ["ReadableStream", "Request", "Response", "Headers"].map(kindOfTest);
  68. const trim = (str) => str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
  69. function forEach(obj, fn, { allOwnKeys = false } = {}) {
  70. if (obj === null || typeof obj === "undefined") {
  71. return;
  72. }
  73. let i;
  74. let l;
  75. if (typeof obj !== "object") {
  76. obj = [obj];
  77. }
  78. if (isArray(obj)) {
  79. for (i = 0, l = obj.length; i < l; i++) {
  80. fn.call(null, obj[i], i, obj);
  81. }
  82. } else {
  83. if (isBuffer(obj)) {
  84. return;
  85. }
  86. const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
  87. const len = keys.length;
  88. let key;
  89. for (i = 0; i < len; i++) {
  90. key = keys[i];
  91. fn.call(null, obj[key], key, obj);
  92. }
  93. }
  94. }
  95. function findKey(obj, key) {
  96. if (isBuffer(obj)) {
  97. return null;
  98. }
  99. key = key.toLowerCase();
  100. const keys = Object.keys(obj);
  101. let i = keys.length;
  102. let _key;
  103. while (i-- > 0) {
  104. _key = keys[i];
  105. if (key === _key.toLowerCase()) {
  106. return _key;
  107. }
  108. }
  109. return null;
  110. }
  111. const _global = (() => {
  112. if (typeof globalThis !== "undefined")
  113. return globalThis;
  114. return typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : global;
  115. })();
  116. const isContextDefined = (context) => !isUndefined(context) && context !== _global;
  117. function merge() {
  118. const { caseless, skipUndefined } = isContextDefined(this) && this || {};
  119. const result = {};
  120. const assignValue = (val, key) => {
  121. const targetKey = caseless && findKey(result, key) || key;
  122. if (isPlainObject(result[targetKey]) && isPlainObject(val)) {
  123. result[targetKey] = merge(result[targetKey], val);
  124. } else if (isPlainObject(val)) {
  125. result[targetKey] = merge({}, val);
  126. } else if (isArray(val)) {
  127. result[targetKey] = val.slice();
  128. } else if (!skipUndefined || !isUndefined(val)) {
  129. result[targetKey] = val;
  130. }
  131. };
  132. for (let i = 0, l = arguments.length; i < l; i++) {
  133. arguments[i] && forEach(arguments[i], assignValue);
  134. }
  135. return result;
  136. }
  137. const extend = (a, b, thisArg, { allOwnKeys } = {}) => {
  138. forEach(b, (val, key) => {
  139. if (thisArg && isFunction$1(val)) {
  140. a[key] = bind(val, thisArg);
  141. } else {
  142. a[key] = val;
  143. }
  144. }, { allOwnKeys });
  145. return a;
  146. };
  147. const stripBOM = (content) => {
  148. if (content.charCodeAt(0) === 65279) {
  149. content = content.slice(1);
  150. }
  151. return content;
  152. };
  153. const inherits = (constructor, superConstructor, props, descriptors2) => {
  154. constructor.prototype = Object.create(superConstructor.prototype, descriptors2);
  155. constructor.prototype.constructor = constructor;
  156. Object.defineProperty(constructor, "super", {
  157. value: superConstructor.prototype
  158. });
  159. props && Object.assign(constructor.prototype, props);
  160. };
  161. const toFlatObject = (sourceObj, destObj, filter2, propFilter) => {
  162. let props;
  163. let i;
  164. let prop;
  165. const merged = {};
  166. destObj = destObj || {};
  167. if (sourceObj == null)
  168. return destObj;
  169. do {
  170. props = Object.getOwnPropertyNames(sourceObj);
  171. i = props.length;
  172. while (i-- > 0) {
  173. prop = props[i];
  174. if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
  175. destObj[prop] = sourceObj[prop];
  176. merged[prop] = true;
  177. }
  178. }
  179. sourceObj = filter2 !== false && getPrototypeOf(sourceObj);
  180. } while (sourceObj && (!filter2 || filter2(sourceObj, destObj)) && sourceObj !== Object.prototype);
  181. return destObj;
  182. };
  183. const endsWith = (str, searchString, position) => {
  184. str = String(str);
  185. if (position === void 0 || position > str.length) {
  186. position = str.length;
  187. }
  188. position -= searchString.length;
  189. const lastIndex = str.indexOf(searchString, position);
  190. return lastIndex !== -1 && lastIndex === position;
  191. };
  192. const toArray = (thing) => {
  193. if (!thing)
  194. return null;
  195. if (isArray(thing))
  196. return thing;
  197. let i = thing.length;
  198. if (!isNumber(i))
  199. return null;
  200. const arr = new Array(i);
  201. while (i-- > 0) {
  202. arr[i] = thing[i];
  203. }
  204. return arr;
  205. };
  206. const isTypedArray = ((TypedArray) => {
  207. return (thing) => {
  208. return TypedArray && thing instanceof TypedArray;
  209. };
  210. })(typeof Uint8Array !== "undefined" && getPrototypeOf(Uint8Array));
  211. const forEachEntry = (obj, fn) => {
  212. const generator = obj && obj[iterator];
  213. const _iterator = generator.call(obj);
  214. let result;
  215. while ((result = _iterator.next()) && !result.done) {
  216. const pair = result.value;
  217. fn.call(obj, pair[0], pair[1]);
  218. }
  219. };
  220. const matchAll = (regExp, str) => {
  221. let matches;
  222. const arr = [];
  223. while ((matches = regExp.exec(str)) !== null) {
  224. arr.push(matches);
  225. }
  226. return arr;
  227. };
  228. const isHTMLForm = kindOfTest("HTMLFormElement");
  229. const toCamelCase = (str) => {
  230. return str.toLowerCase().replace(
  231. /[-_\s]([a-z\d])(\w*)/g,
  232. function replacer(m, p1, p2) {
  233. return p1.toUpperCase() + p2;
  234. }
  235. );
  236. };
  237. const hasOwnProperty = (({ hasOwnProperty: hasOwnProperty2 }) => (obj, prop) => hasOwnProperty2.call(obj, prop))(Object.prototype);
  238. const isRegExp = kindOfTest("RegExp");
  239. const reduceDescriptors = (obj, reducer) => {
  240. const descriptors2 = Object.getOwnPropertyDescriptors(obj);
  241. const reducedDescriptors = {};
  242. forEach(descriptors2, (descriptor, name) => {
  243. let ret;
  244. if ((ret = reducer(descriptor, name, obj)) !== false) {
  245. reducedDescriptors[name] = ret || descriptor;
  246. }
  247. });
  248. Object.defineProperties(obj, reducedDescriptors);
  249. };
  250. const freezeMethods = (obj) => {
  251. reduceDescriptors(obj, (descriptor, name) => {
  252. if (isFunction$1(obj) && ["arguments", "caller", "callee"].indexOf(name) !== -1) {
  253. return false;
  254. }
  255. const value = obj[name];
  256. if (!isFunction$1(value))
  257. return;
  258. descriptor.enumerable = false;
  259. if ("writable" in descriptor) {
  260. descriptor.writable = false;
  261. return;
  262. }
  263. if (!descriptor.set) {
  264. descriptor.set = () => {
  265. throw Error("Can not rewrite read-only method '" + name + "'");
  266. };
  267. }
  268. });
  269. };
  270. const toObjectSet = (arrayOrString, delimiter) => {
  271. const obj = {};
  272. const define = (arr) => {
  273. arr.forEach((value) => {
  274. obj[value] = true;
  275. });
  276. };
  277. isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));
  278. return obj;
  279. };
  280. const noop = () => {
  281. };
  282. const toFiniteNumber = (value, defaultValue) => {
  283. return value != null && Number.isFinite(value = +value) ? value : defaultValue;
  284. };
  285. function isSpecCompliantForm(thing) {
  286. return !!(thing && isFunction$1(thing.append) && thing[toStringTag] === "FormData" && thing[iterator]);
  287. }
  288. const toJSONObject = (obj) => {
  289. const stack = new Array(10);
  290. const visit = (source, i) => {
  291. if (isObject(source)) {
  292. if (stack.indexOf(source) >= 0) {
  293. return;
  294. }
  295. if (isBuffer(source)) {
  296. return source;
  297. }
  298. if (!("toJSON" in source)) {
  299. stack[i] = source;
  300. const target = isArray(source) ? [] : {};
  301. forEach(source, (value, key) => {
  302. const reducedValue = visit(value, i + 1);
  303. !isUndefined(reducedValue) && (target[key] = reducedValue);
  304. });
  305. stack[i] = void 0;
  306. return target;
  307. }
  308. }
  309. return source;
  310. };
  311. return visit(obj, 0);
  312. };
  313. const isAsyncFn = kindOfTest("AsyncFunction");
  314. const isThenable = (thing) => thing && (isObject(thing) || isFunction$1(thing)) && isFunction$1(thing.then) && isFunction$1(thing.catch);
  315. const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
  316. if (setImmediateSupported) {
  317. return setImmediate;
  318. }
  319. return postMessageSupported ? ((token, callbacks) => {
  320. _global.addEventListener("message", ({ source, data }) => {
  321. if (source === _global && data === token) {
  322. callbacks.length && callbacks.shift()();
  323. }
  324. }, false);
  325. return (cb) => {
  326. callbacks.push(cb);
  327. _global.postMessage(token, "*");
  328. };
  329. })(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb);
  330. })(
  331. typeof setImmediate === "function",
  332. isFunction$1(_global.postMessage)
  333. );
  334. const asap = typeof queueMicrotask !== "undefined" ? queueMicrotask.bind(_global) : typeof process !== "undefined" && process.nextTick || _setImmediate;
  335. const isIterable = (thing) => thing != null && isFunction$1(thing[iterator]);
  336. const utils$1 = {
  337. isArray,
  338. isArrayBuffer,
  339. isBuffer,
  340. isFormData,
  341. isArrayBufferView,
  342. isString,
  343. isNumber,
  344. isBoolean,
  345. isObject,
  346. isPlainObject,
  347. isEmptyObject,
  348. isReadableStream,
  349. isRequest,
  350. isResponse,
  351. isHeaders,
  352. isUndefined,
  353. isDate,
  354. isFile,
  355. isBlob,
  356. isRegExp,
  357. isFunction: isFunction$1,
  358. isStream,
  359. isURLSearchParams,
  360. isTypedArray,
  361. isFileList,
  362. forEach,
  363. merge,
  364. extend,
  365. trim,
  366. stripBOM,
  367. inherits,
  368. toFlatObject,
  369. kindOf,
  370. kindOfTest,
  371. endsWith,
  372. toArray,
  373. forEachEntry,
  374. matchAll,
  375. isHTMLForm,
  376. hasOwnProperty,
  377. hasOwnProp: hasOwnProperty,
  378. // an alias to avoid ESLint no-prototype-builtins detection
  379. reduceDescriptors,
  380. freezeMethods,
  381. toObjectSet,
  382. toCamelCase,
  383. noop,
  384. toFiniteNumber,
  385. findKey,
  386. global: _global,
  387. isContextDefined,
  388. isSpecCompliantForm,
  389. toJSONObject,
  390. isAsyncFn,
  391. isThenable,
  392. setImmediate: _setImmediate,
  393. asap,
  394. isIterable
  395. };
  396. function AxiosError(message, code, config, request, response) {
  397. Error.call(this);
  398. if (Error.captureStackTrace) {
  399. Error.captureStackTrace(this, this.constructor);
  400. } else {
  401. this.stack = new Error().stack;
  402. }
  403. this.message = message;
  404. this.name = "AxiosError";
  405. code && (this.code = code);
  406. config && (this.config = config);
  407. request && (this.request = request);
  408. if (response) {
  409. this.response = response;
  410. this.status = response.status ? response.status : null;
  411. }
  412. }
  413. utils$1.inherits(AxiosError, Error, {
  414. toJSON: function toJSON() {
  415. return {
  416. // Standard
  417. message: this.message,
  418. name: this.name,
  419. // Microsoft
  420. description: this.description,
  421. number: this.number,
  422. // Mozilla
  423. fileName: this.fileName,
  424. lineNumber: this.lineNumber,
  425. columnNumber: this.columnNumber,
  426. stack: this.stack,
  427. // Axios
  428. config: utils$1.toJSONObject(this.config),
  429. code: this.code,
  430. status: this.status
  431. };
  432. }
  433. });
  434. const prototype$1 = AxiosError.prototype;
  435. const descriptors = {};
  436. [
  437. "ERR_BAD_OPTION_VALUE",
  438. "ERR_BAD_OPTION",
  439. "ECONNABORTED",
  440. "ETIMEDOUT",
  441. "ERR_NETWORK",
  442. "ERR_FR_TOO_MANY_REDIRECTS",
  443. "ERR_DEPRECATED",
  444. "ERR_BAD_RESPONSE",
  445. "ERR_BAD_REQUEST",
  446. "ERR_CANCELED",
  447. "ERR_NOT_SUPPORT",
  448. "ERR_INVALID_URL"
  449. // eslint-disable-next-line func-names
  450. ].forEach((code) => {
  451. descriptors[code] = { value: code };
  452. });
  453. Object.defineProperties(AxiosError, descriptors);
  454. Object.defineProperty(prototype$1, "isAxiosError", { value: true });
  455. AxiosError.from = (error, code, config, request, response, customProps) => {
  456. const axiosError = Object.create(prototype$1);
  457. utils$1.toFlatObject(error, axiosError, function filter2(obj) {
  458. return obj !== Error.prototype;
  459. }, (prop) => {
  460. return prop !== "isAxiosError";
  461. });
  462. const msg = error && error.message ? error.message : "Error";
  463. const errCode = code == null && error ? error.code : code;
  464. AxiosError.call(axiosError, msg, errCode, config, request, response);
  465. if (error && axiosError.cause == null) {
  466. Object.defineProperty(axiosError, "cause", { value: error, configurable: true });
  467. }
  468. axiosError.name = error && error.name || "Error";
  469. customProps && Object.assign(axiosError, customProps);
  470. return axiosError;
  471. };
  472. const httpAdapter = null;
  473. function isVisitable(thing) {
  474. return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
  475. }
  476. function removeBrackets(key) {
  477. return utils$1.endsWith(key, "[]") ? key.slice(0, -2) : key;
  478. }
  479. function renderKey(path, key, dots) {
  480. if (!path)
  481. return key;
  482. return path.concat(key).map(function each(token, i) {
  483. token = removeBrackets(token);
  484. return !dots && i ? "[" + token + "]" : token;
  485. }).join(dots ? "." : "");
  486. }
  487. function isFlatArray(arr) {
  488. return utils$1.isArray(arr) && !arr.some(isVisitable);
  489. }
  490. const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) {
  491. return /^is[A-Z]/.test(prop);
  492. });
  493. function toFormData(obj, formData, options) {
  494. if (!utils$1.isObject(obj)) {
  495. throw new TypeError("target must be an object");
  496. }
  497. formData = formData || new FormData();
  498. options = utils$1.toFlatObject(options, {
  499. metaTokens: true,
  500. dots: false,
  501. indexes: false
  502. }, false, function defined(option, source) {
  503. return !utils$1.isUndefined(source[option]);
  504. });
  505. const metaTokens = options.metaTokens;
  506. const visitor = options.visitor || defaultVisitor;
  507. const dots = options.dots;
  508. const indexes = options.indexes;
  509. const _Blob = options.Blob || typeof Blob !== "undefined" && Blob;
  510. const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
  511. if (!utils$1.isFunction(visitor)) {
  512. throw new TypeError("visitor must be a function");
  513. }
  514. function convertValue(value) {
  515. if (value === null)
  516. return "";
  517. if (utils$1.isDate(value)) {
  518. return value.toISOString();
  519. }
  520. if (utils$1.isBoolean(value)) {
  521. return value.toString();
  522. }
  523. if (!useBlob && utils$1.isBlob(value)) {
  524. throw new AxiosError("Blob is not supported. Use a Buffer instead.");
  525. }
  526. if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
  527. return useBlob && typeof Blob === "function" ? new Blob([value]) : Buffer.from(value);
  528. }
  529. return value;
  530. }
  531. function defaultVisitor(value, key, path) {
  532. let arr = value;
  533. if (value && !path && typeof value === "object") {
  534. if (utils$1.endsWith(key, "{}")) {
  535. key = metaTokens ? key : key.slice(0, -2);
  536. value = JSON.stringify(value);
  537. } else if (utils$1.isArray(value) && isFlatArray(value) || (utils$1.isFileList(value) || utils$1.endsWith(key, "[]")) && (arr = utils$1.toArray(value))) {
  538. key = removeBrackets(key);
  539. arr.forEach(function each(el, index) {
  540. !(utils$1.isUndefined(el) || el === null) && formData.append(
  541. // eslint-disable-next-line no-nested-ternary
  542. indexes === true ? renderKey([key], index, dots) : indexes === null ? key : key + "[]",
  543. convertValue(el)
  544. );
  545. });
  546. return false;
  547. }
  548. }
  549. if (isVisitable(value)) {
  550. return true;
  551. }
  552. formData.append(renderKey(path, key, dots), convertValue(value));
  553. return false;
  554. }
  555. const stack = [];
  556. const exposedHelpers = Object.assign(predicates, {
  557. defaultVisitor,
  558. convertValue,
  559. isVisitable
  560. });
  561. function build(value, path) {
  562. if (utils$1.isUndefined(value))
  563. return;
  564. if (stack.indexOf(value) !== -1) {
  565. throw Error("Circular reference detected in " + path.join("."));
  566. }
  567. stack.push(value);
  568. utils$1.forEach(value, function each(el, key) {
  569. const result = !(utils$1.isUndefined(el) || el === null) && visitor.call(
  570. formData,
  571. el,
  572. utils$1.isString(key) ? key.trim() : key,
  573. path,
  574. exposedHelpers
  575. );
  576. if (result === true) {
  577. build(el, path ? path.concat(key) : [key]);
  578. }
  579. });
  580. stack.pop();
  581. }
  582. if (!utils$1.isObject(obj)) {
  583. throw new TypeError("data must be an object");
  584. }
  585. build(obj);
  586. return formData;
  587. }
  588. function encode$1(str) {
  589. const charMap = {
  590. "!": "%21",
  591. "'": "%27",
  592. "(": "%28",
  593. ")": "%29",
  594. "~": "%7E",
  595. "%20": "+",
  596. "%00": "\0"
  597. };
  598. return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
  599. return charMap[match];
  600. });
  601. }
  602. function AxiosURLSearchParams(params, options) {
  603. this._pairs = [];
  604. params && toFormData(params, this, options);
  605. }
  606. const prototype = AxiosURLSearchParams.prototype;
  607. prototype.append = function append(name, value) {
  608. this._pairs.push([name, value]);
  609. };
  610. prototype.toString = function toString2(encoder) {
  611. const _encode = encoder ? function(value) {
  612. return encoder.call(this, value, encode$1);
  613. } : encode$1;
  614. return this._pairs.map(function each(pair) {
  615. return _encode(pair[0]) + "=" + _encode(pair[1]);
  616. }, "").join("&");
  617. };
  618. function encode(val) {
  619. return encodeURIComponent(val).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+");
  620. }
  621. function buildURL(url, params, options) {
  622. if (!params) {
  623. return url;
  624. }
  625. const _encode = options && options.encode || encode;
  626. if (utils$1.isFunction(options)) {
  627. options = {
  628. serialize: options
  629. };
  630. }
  631. const serializeFn = options && options.serialize;
  632. let serializedParams;
  633. if (serializeFn) {
  634. serializedParams = serializeFn(params, options);
  635. } else {
  636. serializedParams = utils$1.isURLSearchParams(params) ? params.toString() : new AxiosURLSearchParams(params, options).toString(_encode);
  637. }
  638. if (serializedParams) {
  639. const hashmarkIndex = url.indexOf("#");
  640. if (hashmarkIndex !== -1) {
  641. url = url.slice(0, hashmarkIndex);
  642. }
  643. url += (url.indexOf("?") === -1 ? "?" : "&") + serializedParams;
  644. }
  645. return url;
  646. }
  647. class InterceptorManager {
  648. constructor() {
  649. this.handlers = [];
  650. }
  651. /**
  652. * Add a new interceptor to the stack
  653. *
  654. * @param {Function} fulfilled The function to handle `then` for a `Promise`
  655. * @param {Function} rejected The function to handle `reject` for a `Promise`
  656. *
  657. * @return {Number} An ID used to remove interceptor later
  658. */
  659. use(fulfilled, rejected, options) {
  660. this.handlers.push({
  661. fulfilled,
  662. rejected,
  663. synchronous: options ? options.synchronous : false,
  664. runWhen: options ? options.runWhen : null
  665. });
  666. return this.handlers.length - 1;
  667. }
  668. /**
  669. * Remove an interceptor from the stack
  670. *
  671. * @param {Number} id The ID that was returned by `use`
  672. *
  673. * @returns {void}
  674. */
  675. eject(id) {
  676. if (this.handlers[id]) {
  677. this.handlers[id] = null;
  678. }
  679. }
  680. /**
  681. * Clear all interceptors from the stack
  682. *
  683. * @returns {void}
  684. */
  685. clear() {
  686. if (this.handlers) {
  687. this.handlers = [];
  688. }
  689. }
  690. /**
  691. * Iterate over all the registered interceptors
  692. *
  693. * This method is particularly useful for skipping over any
  694. * interceptors that may have become `null` calling `eject`.
  695. *
  696. * @param {Function} fn The function to call for each interceptor
  697. *
  698. * @returns {void}
  699. */
  700. forEach(fn) {
  701. utils$1.forEach(this.handlers, function forEachHandler(h) {
  702. if (h !== null) {
  703. fn(h);
  704. }
  705. });
  706. }
  707. }
  708. const InterceptorManager$1 = InterceptorManager;
  709. const transitionalDefaults = {
  710. silentJSONParsing: true,
  711. forcedJSONParsing: true,
  712. clarifyTimeoutError: false
  713. };
  714. const URLSearchParams$1 = typeof URLSearchParams !== "undefined" ? URLSearchParams : AxiosURLSearchParams;
  715. const FormData$1 = typeof FormData !== "undefined" ? FormData : null;
  716. const Blob$1 = typeof Blob !== "undefined" ? Blob : null;
  717. const platform$1 = {
  718. isBrowser: true,
  719. classes: {
  720. URLSearchParams: URLSearchParams$1,
  721. FormData: FormData$1,
  722. Blob: Blob$1
  723. },
  724. protocols: ["http", "https", "file", "blob", "url", "data"]
  725. };
  726. const hasBrowserEnv = typeof window !== "undefined" && typeof document !== "undefined";
  727. const _navigator = typeof navigator === "object" && navigator || void 0;
  728. const hasStandardBrowserEnv = hasBrowserEnv && (!_navigator || ["ReactNative", "NativeScript", "NS"].indexOf(_navigator.product) < 0);
  729. const hasStandardBrowserWebWorkerEnv = (() => {
  730. return typeof WorkerGlobalScope !== "undefined" && // eslint-disable-next-line no-undef
  731. self instanceof WorkerGlobalScope && typeof self.importScripts === "function";
  732. })();
  733. const origin = hasBrowserEnv && window.location.href || "http://localhost";
  734. const utils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  735. __proto__: null,
  736. hasBrowserEnv,
  737. hasStandardBrowserEnv,
  738. hasStandardBrowserWebWorkerEnv,
  739. navigator: _navigator,
  740. origin
  741. }, Symbol.toStringTag, { value: "Module" }));
  742. const platform = {
  743. ...utils,
  744. ...platform$1
  745. };
  746. function toURLEncodedForm(data, options) {
  747. return toFormData(data, new platform.classes.URLSearchParams(), {
  748. visitor: function(value, key, path, helpers) {
  749. if (platform.isNode && utils$1.isBuffer(value)) {
  750. this.append(key, value.toString("base64"));
  751. return false;
  752. }
  753. return helpers.defaultVisitor.apply(this, arguments);
  754. },
  755. ...options
  756. });
  757. }
  758. function parsePropPath(name) {
  759. return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map((match) => {
  760. return match[0] === "[]" ? "" : match[1] || match[0];
  761. });
  762. }
  763. function arrayToObject(arr) {
  764. const obj = {};
  765. const keys = Object.keys(arr);
  766. let i;
  767. const len = keys.length;
  768. let key;
  769. for (i = 0; i < len; i++) {
  770. key = keys[i];
  771. obj[key] = arr[key];
  772. }
  773. return obj;
  774. }
  775. function formDataToJSON(formData) {
  776. function buildPath(path, value, target, index) {
  777. let name = path[index++];
  778. if (name === "__proto__")
  779. return true;
  780. const isNumericKey = Number.isFinite(+name);
  781. const isLast = index >= path.length;
  782. name = !name && utils$1.isArray(target) ? target.length : name;
  783. if (isLast) {
  784. if (utils$1.hasOwnProp(target, name)) {
  785. target[name] = [target[name], value];
  786. } else {
  787. target[name] = value;
  788. }
  789. return !isNumericKey;
  790. }
  791. if (!target[name] || !utils$1.isObject(target[name])) {
  792. target[name] = [];
  793. }
  794. const result = buildPath(path, value, target[name], index);
  795. if (result && utils$1.isArray(target[name])) {
  796. target[name] = arrayToObject(target[name]);
  797. }
  798. return !isNumericKey;
  799. }
  800. if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {
  801. const obj = {};
  802. utils$1.forEachEntry(formData, (name, value) => {
  803. buildPath(parsePropPath(name), value, obj, 0);
  804. });
  805. return obj;
  806. }
  807. return null;
  808. }
  809. function stringifySafely(rawValue, parser, encoder) {
  810. if (utils$1.isString(rawValue)) {
  811. try {
  812. (parser || JSON.parse)(rawValue);
  813. return utils$1.trim(rawValue);
  814. } catch (e) {
  815. if (e.name !== "SyntaxError") {
  816. throw e;
  817. }
  818. }
  819. }
  820. return (encoder || JSON.stringify)(rawValue);
  821. }
  822. const defaults = {
  823. transitional: transitionalDefaults,
  824. adapter: ["xhr", "http", "fetch"],
  825. transformRequest: [function transformRequest(data, headers) {
  826. const contentType = headers.getContentType() || "";
  827. const hasJSONContentType = contentType.indexOf("application/json") > -1;
  828. const isObjectPayload = utils$1.isObject(data);
  829. if (isObjectPayload && utils$1.isHTMLForm(data)) {
  830. data = new FormData(data);
  831. }
  832. const isFormData2 = utils$1.isFormData(data);
  833. if (isFormData2) {
  834. return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
  835. }
  836. 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)) {
  837. return data;
  838. }
  839. if (utils$1.isArrayBufferView(data)) {
  840. return data.buffer;
  841. }
  842. if (utils$1.isURLSearchParams(data)) {
  843. headers.setContentType("application/x-www-form-urlencoded;charset=utf-8", false);
  844. return data.toString();
  845. }
  846. let isFileList2;
  847. if (isObjectPayload) {
  848. if (contentType.indexOf("application/x-www-form-urlencoded") > -1) {
  849. return toURLEncodedForm(data, this.formSerializer).toString();
  850. }
  851. if ((isFileList2 = utils$1.isFileList(data)) || contentType.indexOf("multipart/form-data") > -1) {
  852. const _FormData = this.env && this.env.FormData;
  853. return toFormData(
  854. isFileList2 ? { "files[]": data } : data,
  855. _FormData && new _FormData(),
  856. this.formSerializer
  857. );
  858. }
  859. }
  860. if (isObjectPayload || hasJSONContentType) {
  861. headers.setContentType("application/json", false);
  862. return stringifySafely(data);
  863. }
  864. return data;
  865. }],
  866. transformResponse: [function transformResponse(data) {
  867. const transitional2 = this.transitional || defaults.transitional;
  868. const forcedJSONParsing = transitional2 && transitional2.forcedJSONParsing;
  869. const JSONRequested = this.responseType === "json";
  870. if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
  871. return data;
  872. }
  873. if (data && utils$1.isString(data) && (forcedJSONParsing && !this.responseType || JSONRequested)) {
  874. const silentJSONParsing = transitional2 && transitional2.silentJSONParsing;
  875. const strictJSONParsing = !silentJSONParsing && JSONRequested;
  876. try {
  877. return JSON.parse(data, this.parseReviver);
  878. } catch (e) {
  879. if (strictJSONParsing) {
  880. if (e.name === "SyntaxError") {
  881. throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response);
  882. }
  883. throw e;
  884. }
  885. }
  886. }
  887. return data;
  888. }],
  889. /**
  890. * A timeout in milliseconds to abort a request. If set to 0 (default) a
  891. * timeout is not created.
  892. */
  893. timeout: 0,
  894. xsrfCookieName: "XSRF-TOKEN",
  895. xsrfHeaderName: "X-XSRF-TOKEN",
  896. maxContentLength: -1,
  897. maxBodyLength: -1,
  898. env: {
  899. FormData: platform.classes.FormData,
  900. Blob: platform.classes.Blob
  901. },
  902. validateStatus: function validateStatus(status) {
  903. return status >= 200 && status < 300;
  904. },
  905. headers: {
  906. common: {
  907. "Accept": "application/json, text/plain, */*",
  908. "Content-Type": void 0
  909. }
  910. }
  911. };
  912. utils$1.forEach(["delete", "get", "head", "post", "put", "patch"], (method) => {
  913. defaults.headers[method] = {};
  914. });
  915. const defaults$1 = defaults;
  916. const ignoreDuplicateOf = utils$1.toObjectSet([
  917. "age",
  918. "authorization",
  919. "content-length",
  920. "content-type",
  921. "etag",
  922. "expires",
  923. "from",
  924. "host",
  925. "if-modified-since",
  926. "if-unmodified-since",
  927. "last-modified",
  928. "location",
  929. "max-forwards",
  930. "proxy-authorization",
  931. "referer",
  932. "retry-after",
  933. "user-agent"
  934. ]);
  935. const parseHeaders = (rawHeaders) => {
  936. const parsed = {};
  937. let key;
  938. let val;
  939. let i;
  940. rawHeaders && rawHeaders.split("\n").forEach(function parser(line) {
  941. i = line.indexOf(":");
  942. key = line.substring(0, i).trim().toLowerCase();
  943. val = line.substring(i + 1).trim();
  944. if (!key || parsed[key] && ignoreDuplicateOf[key]) {
  945. return;
  946. }
  947. if (key === "set-cookie") {
  948. if (parsed[key]) {
  949. parsed[key].push(val);
  950. } else {
  951. parsed[key] = [val];
  952. }
  953. } else {
  954. parsed[key] = parsed[key] ? parsed[key] + ", " + val : val;
  955. }
  956. });
  957. return parsed;
  958. };
  959. const $internals = Symbol("internals");
  960. function normalizeHeader(header) {
  961. return header && String(header).trim().toLowerCase();
  962. }
  963. function normalizeValue(value) {
  964. if (value === false || value == null) {
  965. return value;
  966. }
  967. return utils$1.isArray(value) ? value.map(normalizeValue) : String(value);
  968. }
  969. function parseTokens(str) {
  970. const tokens = /* @__PURE__ */ Object.create(null);
  971. const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
  972. let match;
  973. while (match = tokensRE.exec(str)) {
  974. tokens[match[1]] = match[2];
  975. }
  976. return tokens;
  977. }
  978. const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
  979. function matchHeaderValue(context, value, header, filter2, isHeaderNameFilter) {
  980. if (utils$1.isFunction(filter2)) {
  981. return filter2.call(this, value, header);
  982. }
  983. if (isHeaderNameFilter) {
  984. value = header;
  985. }
  986. if (!utils$1.isString(value))
  987. return;
  988. if (utils$1.isString(filter2)) {
  989. return value.indexOf(filter2) !== -1;
  990. }
  991. if (utils$1.isRegExp(filter2)) {
  992. return filter2.test(value);
  993. }
  994. }
  995. function formatHeader(header) {
  996. return header.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => {
  997. return char.toUpperCase() + str;
  998. });
  999. }
  1000. function buildAccessors(obj, header) {
  1001. const accessorName = utils$1.toCamelCase(" " + header);
  1002. ["get", "set", "has"].forEach((methodName) => {
  1003. Object.defineProperty(obj, methodName + accessorName, {
  1004. value: function(arg1, arg2, arg3) {
  1005. return this[methodName].call(this, header, arg1, arg2, arg3);
  1006. },
  1007. configurable: true
  1008. });
  1009. });
  1010. }
  1011. class AxiosHeaders {
  1012. constructor(headers) {
  1013. headers && this.set(headers);
  1014. }
  1015. set(header, valueOrRewrite, rewrite) {
  1016. const self2 = this;
  1017. function setHeader(_value, _header, _rewrite) {
  1018. const lHeader = normalizeHeader(_header);
  1019. if (!lHeader) {
  1020. throw new Error("header name must be a non-empty string");
  1021. }
  1022. const key = utils$1.findKey(self2, lHeader);
  1023. if (!key || self2[key] === void 0 || _rewrite === true || _rewrite === void 0 && self2[key] !== false) {
  1024. self2[key || _header] = normalizeValue(_value);
  1025. }
  1026. }
  1027. const setHeaders = (headers, _rewrite) => utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
  1028. if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
  1029. setHeaders(header, valueOrRewrite);
  1030. } else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
  1031. setHeaders(parseHeaders(header), valueOrRewrite);
  1032. } else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
  1033. let obj = {}, dest, key;
  1034. for (const entry of header) {
  1035. if (!utils$1.isArray(entry)) {
  1036. throw TypeError("Object iterator must return a key-value pair");
  1037. }
  1038. obj[key = entry[0]] = (dest = obj[key]) ? utils$1.isArray(dest) ? [...dest, entry[1]] : [dest, entry[1]] : entry[1];
  1039. }
  1040. setHeaders(obj, valueOrRewrite);
  1041. } else {
  1042. header != null && setHeader(valueOrRewrite, header, rewrite);
  1043. }
  1044. return this;
  1045. }
  1046. get(header, parser) {
  1047. header = normalizeHeader(header);
  1048. if (header) {
  1049. const key = utils$1.findKey(this, header);
  1050. if (key) {
  1051. const value = this[key];
  1052. if (!parser) {
  1053. return value;
  1054. }
  1055. if (parser === true) {
  1056. return parseTokens(value);
  1057. }
  1058. if (utils$1.isFunction(parser)) {
  1059. return parser.call(this, value, key);
  1060. }
  1061. if (utils$1.isRegExp(parser)) {
  1062. return parser.exec(value);
  1063. }
  1064. throw new TypeError("parser must be boolean|regexp|function");
  1065. }
  1066. }
  1067. }
  1068. has(header, matcher) {
  1069. header = normalizeHeader(header);
  1070. if (header) {
  1071. const key = utils$1.findKey(this, header);
  1072. return !!(key && this[key] !== void 0 && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
  1073. }
  1074. return false;
  1075. }
  1076. delete(header, matcher) {
  1077. const self2 = this;
  1078. let deleted = false;
  1079. function deleteHeader(_header) {
  1080. _header = normalizeHeader(_header);
  1081. if (_header) {
  1082. const key = utils$1.findKey(self2, _header);
  1083. if (key && (!matcher || matchHeaderValue(self2, self2[key], key, matcher))) {
  1084. delete self2[key];
  1085. deleted = true;
  1086. }
  1087. }
  1088. }
  1089. if (utils$1.isArray(header)) {
  1090. header.forEach(deleteHeader);
  1091. } else {
  1092. deleteHeader(header);
  1093. }
  1094. return deleted;
  1095. }
  1096. clear(matcher) {
  1097. const keys = Object.keys(this);
  1098. let i = keys.length;
  1099. let deleted = false;
  1100. while (i--) {
  1101. const key = keys[i];
  1102. if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
  1103. delete this[key];
  1104. deleted = true;
  1105. }
  1106. }
  1107. return deleted;
  1108. }
  1109. normalize(format) {
  1110. const self2 = this;
  1111. const headers = {};
  1112. utils$1.forEach(this, (value, header) => {
  1113. const key = utils$1.findKey(headers, header);
  1114. if (key) {
  1115. self2[key] = normalizeValue(value);
  1116. delete self2[header];
  1117. return;
  1118. }
  1119. const normalized = format ? formatHeader(header) : String(header).trim();
  1120. if (normalized !== header) {
  1121. delete self2[header];
  1122. }
  1123. self2[normalized] = normalizeValue(value);
  1124. headers[normalized] = true;
  1125. });
  1126. return this;
  1127. }
  1128. concat(...targets) {
  1129. return this.constructor.concat(this, ...targets);
  1130. }
  1131. toJSON(asStrings) {
  1132. const obj = /* @__PURE__ */ Object.create(null);
  1133. utils$1.forEach(this, (value, header) => {
  1134. value != null && value !== false && (obj[header] = asStrings && utils$1.isArray(value) ? value.join(", ") : value);
  1135. });
  1136. return obj;
  1137. }
  1138. [Symbol.iterator]() {
  1139. return Object.entries(this.toJSON())[Symbol.iterator]();
  1140. }
  1141. toString() {
  1142. return Object.entries(this.toJSON()).map(([header, value]) => header + ": " + value).join("\n");
  1143. }
  1144. getSetCookie() {
  1145. return this.get("set-cookie") || [];
  1146. }
  1147. get [Symbol.toStringTag]() {
  1148. return "AxiosHeaders";
  1149. }
  1150. static from(thing) {
  1151. return thing instanceof this ? thing : new this(thing);
  1152. }
  1153. static concat(first, ...targets) {
  1154. const computed = new this(first);
  1155. targets.forEach((target) => computed.set(target));
  1156. return computed;
  1157. }
  1158. static accessor(header) {
  1159. const internals = this[$internals] = this[$internals] = {
  1160. accessors: {}
  1161. };
  1162. const accessors = internals.accessors;
  1163. const prototype2 = this.prototype;
  1164. function defineAccessor(_header) {
  1165. const lHeader = normalizeHeader(_header);
  1166. if (!accessors[lHeader]) {
  1167. buildAccessors(prototype2, _header);
  1168. accessors[lHeader] = true;
  1169. }
  1170. }
  1171. utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
  1172. return this;
  1173. }
  1174. }
  1175. AxiosHeaders.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]);
  1176. utils$1.reduceDescriptors(AxiosHeaders.prototype, ({ value }, key) => {
  1177. let mapped = key[0].toUpperCase() + key.slice(1);
  1178. return {
  1179. get: () => value,
  1180. set(headerValue) {
  1181. this[mapped] = headerValue;
  1182. }
  1183. };
  1184. });
  1185. utils$1.freezeMethods(AxiosHeaders);
  1186. const AxiosHeaders$1 = AxiosHeaders;
  1187. function transformData(fns, response) {
  1188. const config = this || defaults$1;
  1189. const context = response || config;
  1190. const headers = AxiosHeaders$1.from(context.headers);
  1191. let data = context.data;
  1192. utils$1.forEach(fns, function transform(fn) {
  1193. data = fn.call(config, data, headers.normalize(), response ? response.status : void 0);
  1194. });
  1195. headers.normalize();
  1196. return data;
  1197. }
  1198. function isCancel(value) {
  1199. return !!(value && value.__CANCEL__);
  1200. }
  1201. function CanceledError(message, config, request) {
  1202. AxiosError.call(this, message == null ? "canceled" : message, AxiosError.ERR_CANCELED, config, request);
  1203. this.name = "CanceledError";
  1204. }
  1205. utils$1.inherits(CanceledError, AxiosError, {
  1206. __CANCEL__: true
  1207. });
  1208. function settle(resolve, reject, response) {
  1209. const validateStatus2 = response.config.validateStatus;
  1210. if (!response.status || !validateStatus2 || validateStatus2(response.status)) {
  1211. resolve(response);
  1212. } else {
  1213. reject(new AxiosError(
  1214. "Request failed with status code " + response.status,
  1215. [AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
  1216. response.config,
  1217. response.request,
  1218. response
  1219. ));
  1220. }
  1221. }
  1222. function parseProtocol(url) {
  1223. const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
  1224. return match && match[1] || "";
  1225. }
  1226. function speedometer(samplesCount, min) {
  1227. samplesCount = samplesCount || 10;
  1228. const bytes = new Array(samplesCount);
  1229. const timestamps = new Array(samplesCount);
  1230. let head = 0;
  1231. let tail = 0;
  1232. let firstSampleTS;
  1233. min = min !== void 0 ? min : 1e3;
  1234. return function push(chunkLength) {
  1235. const now = Date.now();
  1236. const startedAt = timestamps[tail];
  1237. if (!firstSampleTS) {
  1238. firstSampleTS = now;
  1239. }
  1240. bytes[head] = chunkLength;
  1241. timestamps[head] = now;
  1242. let i = tail;
  1243. let bytesCount = 0;
  1244. while (i !== head) {
  1245. bytesCount += bytes[i++];
  1246. i = i % samplesCount;
  1247. }
  1248. head = (head + 1) % samplesCount;
  1249. if (head === tail) {
  1250. tail = (tail + 1) % samplesCount;
  1251. }
  1252. if (now - firstSampleTS < min) {
  1253. return;
  1254. }
  1255. const passed = startedAt && now - startedAt;
  1256. return passed ? Math.round(bytesCount * 1e3 / passed) : void 0;
  1257. };
  1258. }
  1259. function throttle(fn, freq) {
  1260. let timestamp = 0;
  1261. let threshold = 1e3 / freq;
  1262. let lastArgs;
  1263. let timer;
  1264. const invoke = (args, now = Date.now()) => {
  1265. timestamp = now;
  1266. lastArgs = null;
  1267. if (timer) {
  1268. clearTimeout(timer);
  1269. timer = null;
  1270. }
  1271. fn(...args);
  1272. };
  1273. const throttled = (...args) => {
  1274. const now = Date.now();
  1275. const passed = now - timestamp;
  1276. if (passed >= threshold) {
  1277. invoke(args, now);
  1278. } else {
  1279. lastArgs = args;
  1280. if (!timer) {
  1281. timer = setTimeout(() => {
  1282. timer = null;
  1283. invoke(lastArgs);
  1284. }, threshold - passed);
  1285. }
  1286. }
  1287. };
  1288. const flush = () => lastArgs && invoke(lastArgs);
  1289. return [throttled, flush];
  1290. }
  1291. const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
  1292. let bytesNotified = 0;
  1293. const _speedometer = speedometer(50, 250);
  1294. return throttle((e) => {
  1295. const loaded = e.loaded;
  1296. const total = e.lengthComputable ? e.total : void 0;
  1297. const progressBytes = loaded - bytesNotified;
  1298. const rate = _speedometer(progressBytes);
  1299. const inRange = loaded <= total;
  1300. bytesNotified = loaded;
  1301. const data = {
  1302. loaded,
  1303. total,
  1304. progress: total ? loaded / total : void 0,
  1305. bytes: progressBytes,
  1306. rate: rate ? rate : void 0,
  1307. estimated: rate && total && inRange ? (total - loaded) / rate : void 0,
  1308. event: e,
  1309. lengthComputable: total != null,
  1310. [isDownloadStream ? "download" : "upload"]: true
  1311. };
  1312. listener(data);
  1313. }, freq);
  1314. };
  1315. const progressEventDecorator = (total, throttled) => {
  1316. const lengthComputable = total != null;
  1317. return [(loaded) => throttled[0]({
  1318. lengthComputable,
  1319. total,
  1320. loaded
  1321. }), throttled[1]];
  1322. };
  1323. const asyncDecorator = (fn) => (...args) => utils$1.asap(() => fn(...args));
  1324. const isURLSameOrigin = platform.hasStandardBrowserEnv ? ((origin2, isMSIE) => (url) => {
  1325. url = new URL(url, platform.origin);
  1326. return origin2.protocol === url.protocol && origin2.host === url.host && (isMSIE || origin2.port === url.port);
  1327. })(
  1328. new URL(platform.origin),
  1329. platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)
  1330. ) : () => true;
  1331. const cookies = platform.hasStandardBrowserEnv ? (
  1332. // Standard browser envs support document.cookie
  1333. {
  1334. write(name, value, expires, path, domain, secure, sameSite) {
  1335. if (typeof document === "undefined")
  1336. return;
  1337. const cookie = [`${name}=${encodeURIComponent(value)}`];
  1338. if (utils$1.isNumber(expires)) {
  1339. cookie.push(`expires=${new Date(expires).toUTCString()}`);
  1340. }
  1341. if (utils$1.isString(path)) {
  1342. cookie.push(`path=${path}`);
  1343. }
  1344. if (utils$1.isString(domain)) {
  1345. cookie.push(`domain=${domain}`);
  1346. }
  1347. if (secure === true) {
  1348. cookie.push("secure");
  1349. }
  1350. if (utils$1.isString(sameSite)) {
  1351. cookie.push(`SameSite=${sameSite}`);
  1352. }
  1353. document.cookie = cookie.join("; ");
  1354. },
  1355. read(name) {
  1356. if (typeof document === "undefined")
  1357. return null;
  1358. const match = document.cookie.match(new RegExp("(?:^|; )" + name + "=([^;]*)"));
  1359. return match ? decodeURIComponent(match[1]) : null;
  1360. },
  1361. remove(name) {
  1362. this.write(name, "", Date.now() - 864e5, "/");
  1363. }
  1364. }
  1365. ) : (
  1366. // Non-standard browser env (web workers, react-native) lack needed support.
  1367. {
  1368. write() {
  1369. },
  1370. read() {
  1371. return null;
  1372. },
  1373. remove() {
  1374. }
  1375. }
  1376. );
  1377. function isAbsoluteURL(url) {
  1378. return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
  1379. }
  1380. function combineURLs(baseURL, relativeURL) {
  1381. return relativeURL ? baseURL.replace(/\/?\/$/, "") + "/" + relativeURL.replace(/^\/+/, "") : baseURL;
  1382. }
  1383. function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
  1384. let isRelativeUrl = !isAbsoluteURL(requestedURL);
  1385. if (baseURL && (isRelativeUrl || allowAbsoluteUrls == false)) {
  1386. return combineURLs(baseURL, requestedURL);
  1387. }
  1388. return requestedURL;
  1389. }
  1390. const headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? { ...thing } : thing;
  1391. function mergeConfig(config1, config2) {
  1392. config2 = config2 || {};
  1393. const config = {};
  1394. function getMergedValue(target, source, prop, caseless) {
  1395. if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
  1396. return utils$1.merge.call({ caseless }, target, source);
  1397. } else if (utils$1.isPlainObject(source)) {
  1398. return utils$1.merge({}, source);
  1399. } else if (utils$1.isArray(source)) {
  1400. return source.slice();
  1401. }
  1402. return source;
  1403. }
  1404. function mergeDeepProperties(a, b, prop, caseless) {
  1405. if (!utils$1.isUndefined(b)) {
  1406. return getMergedValue(a, b, prop, caseless);
  1407. } else if (!utils$1.isUndefined(a)) {
  1408. return getMergedValue(void 0, a, prop, caseless);
  1409. }
  1410. }
  1411. function valueFromConfig2(a, b) {
  1412. if (!utils$1.isUndefined(b)) {
  1413. return getMergedValue(void 0, b);
  1414. }
  1415. }
  1416. function defaultToConfig2(a, b) {
  1417. if (!utils$1.isUndefined(b)) {
  1418. return getMergedValue(void 0, b);
  1419. } else if (!utils$1.isUndefined(a)) {
  1420. return getMergedValue(void 0, a);
  1421. }
  1422. }
  1423. function mergeDirectKeys(a, b, prop) {
  1424. if (prop in config2) {
  1425. return getMergedValue(a, b);
  1426. } else if (prop in config1) {
  1427. return getMergedValue(void 0, a);
  1428. }
  1429. }
  1430. const mergeMap = {
  1431. url: valueFromConfig2,
  1432. method: valueFromConfig2,
  1433. data: valueFromConfig2,
  1434. baseURL: defaultToConfig2,
  1435. transformRequest: defaultToConfig2,
  1436. transformResponse: defaultToConfig2,
  1437. paramsSerializer: defaultToConfig2,
  1438. timeout: defaultToConfig2,
  1439. timeoutMessage: defaultToConfig2,
  1440. withCredentials: defaultToConfig2,
  1441. withXSRFToken: defaultToConfig2,
  1442. adapter: defaultToConfig2,
  1443. responseType: defaultToConfig2,
  1444. xsrfCookieName: defaultToConfig2,
  1445. xsrfHeaderName: defaultToConfig2,
  1446. onUploadProgress: defaultToConfig2,
  1447. onDownloadProgress: defaultToConfig2,
  1448. decompress: defaultToConfig2,
  1449. maxContentLength: defaultToConfig2,
  1450. maxBodyLength: defaultToConfig2,
  1451. beforeRedirect: defaultToConfig2,
  1452. transport: defaultToConfig2,
  1453. httpAgent: defaultToConfig2,
  1454. httpsAgent: defaultToConfig2,
  1455. cancelToken: defaultToConfig2,
  1456. socketPath: defaultToConfig2,
  1457. responseEncoding: defaultToConfig2,
  1458. validateStatus: mergeDirectKeys,
  1459. headers: (a, b, prop) => mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true)
  1460. };
  1461. utils$1.forEach(Object.keys({ ...config1, ...config2 }), function computeConfigValue(prop) {
  1462. const merge2 = mergeMap[prop] || mergeDeepProperties;
  1463. const configValue = merge2(config1[prop], config2[prop], prop);
  1464. utils$1.isUndefined(configValue) && merge2 !== mergeDirectKeys || (config[prop] = configValue);
  1465. });
  1466. return config;
  1467. }
  1468. const resolveConfig = (config) => {
  1469. const newConfig = mergeConfig({}, config);
  1470. let { data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth } = newConfig;
  1471. newConfig.headers = headers = AxiosHeaders$1.from(headers);
  1472. newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls), config.params, config.paramsSerializer);
  1473. if (auth) {
  1474. headers.set(
  1475. "Authorization",
  1476. "Basic " + btoa((auth.username || "") + ":" + (auth.password ? unescape(encodeURIComponent(auth.password)) : ""))
  1477. );
  1478. }
  1479. if (utils$1.isFormData(data)) {
  1480. if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
  1481. headers.setContentType(void 0);
  1482. } else if (utils$1.isFunction(data.getHeaders)) {
  1483. const formHeaders = data.getHeaders();
  1484. const allowedHeaders = ["content-type", "content-length"];
  1485. Object.entries(formHeaders).forEach(([key, val]) => {
  1486. if (allowedHeaders.includes(key.toLowerCase())) {
  1487. headers.set(key, val);
  1488. }
  1489. });
  1490. }
  1491. }
  1492. if (platform.hasStandardBrowserEnv) {
  1493. withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
  1494. if (withXSRFToken || withXSRFToken !== false && isURLSameOrigin(newConfig.url)) {
  1495. const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
  1496. if (xsrfValue) {
  1497. headers.set(xsrfHeaderName, xsrfValue);
  1498. }
  1499. }
  1500. }
  1501. return newConfig;
  1502. };
  1503. const isXHRAdapterSupported = typeof XMLHttpRequest !== "undefined";
  1504. const xhrAdapter = isXHRAdapterSupported && function(config) {
  1505. return new Promise(function dispatchXhrRequest(resolve, reject) {
  1506. const _config = resolveConfig(config);
  1507. let requestData = _config.data;
  1508. const requestHeaders = AxiosHeaders$1.from(_config.headers).normalize();
  1509. let { responseType, onUploadProgress, onDownloadProgress } = _config;
  1510. let onCanceled;
  1511. let uploadThrottled, downloadThrottled;
  1512. let flushUpload, flushDownload;
  1513. function done() {
  1514. flushUpload && flushUpload();
  1515. flushDownload && flushDownload();
  1516. _config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
  1517. _config.signal && _config.signal.removeEventListener("abort", onCanceled);
  1518. }
  1519. let request = new XMLHttpRequest();
  1520. request.open(_config.method.toUpperCase(), _config.url, true);
  1521. request.timeout = _config.timeout;
  1522. function onloadend() {
  1523. if (!request) {
  1524. return;
  1525. }
  1526. const responseHeaders = AxiosHeaders$1.from(
  1527. "getAllResponseHeaders" in request && request.getAllResponseHeaders()
  1528. );
  1529. const responseData = !responseType || responseType === "text" || responseType === "json" ? request.responseText : request.response;
  1530. const response = {
  1531. data: responseData,
  1532. status: request.status,
  1533. statusText: request.statusText,
  1534. headers: responseHeaders,
  1535. config,
  1536. request
  1537. };
  1538. settle(function _resolve(value) {
  1539. resolve(value);
  1540. done();
  1541. }, function _reject(err) {
  1542. reject(err);
  1543. done();
  1544. }, response);
  1545. request = null;
  1546. }
  1547. if ("onloadend" in request) {
  1548. request.onloadend = onloadend;
  1549. } else {
  1550. request.onreadystatechange = function handleLoad() {
  1551. if (!request || request.readyState !== 4) {
  1552. return;
  1553. }
  1554. if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf("file:") === 0)) {
  1555. return;
  1556. }
  1557. setTimeout(onloadend);
  1558. };
  1559. }
  1560. request.onabort = function handleAbort() {
  1561. if (!request) {
  1562. return;
  1563. }
  1564. reject(new AxiosError("Request aborted", AxiosError.ECONNABORTED, config, request));
  1565. request = null;
  1566. };
  1567. request.onerror = function handleError(event) {
  1568. const msg = event && event.message ? event.message : "Network Error";
  1569. const err = new AxiosError(msg, AxiosError.ERR_NETWORK, config, request);
  1570. err.event = event || null;
  1571. reject(err);
  1572. request = null;
  1573. };
  1574. request.ontimeout = function handleTimeout() {
  1575. let timeoutErrorMessage = _config.timeout ? "timeout of " + _config.timeout + "ms exceeded" : "timeout exceeded";
  1576. const transitional2 = _config.transitional || transitionalDefaults;
  1577. if (_config.timeoutErrorMessage) {
  1578. timeoutErrorMessage = _config.timeoutErrorMessage;
  1579. }
  1580. reject(new AxiosError(
  1581. timeoutErrorMessage,
  1582. transitional2.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,
  1583. config,
  1584. request
  1585. ));
  1586. request = null;
  1587. };
  1588. requestData === void 0 && requestHeaders.setContentType(null);
  1589. if ("setRequestHeader" in request) {
  1590. utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
  1591. request.setRequestHeader(key, val);
  1592. });
  1593. }
  1594. if (!utils$1.isUndefined(_config.withCredentials)) {
  1595. request.withCredentials = !!_config.withCredentials;
  1596. }
  1597. if (responseType && responseType !== "json") {
  1598. request.responseType = _config.responseType;
  1599. }
  1600. if (onDownloadProgress) {
  1601. [downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true);
  1602. request.addEventListener("progress", downloadThrottled);
  1603. }
  1604. if (onUploadProgress && request.upload) {
  1605. [uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress);
  1606. request.upload.addEventListener("progress", uploadThrottled);
  1607. request.upload.addEventListener("loadend", flushUpload);
  1608. }
  1609. if (_config.cancelToken || _config.signal) {
  1610. onCanceled = (cancel) => {
  1611. if (!request) {
  1612. return;
  1613. }
  1614. reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);
  1615. request.abort();
  1616. request = null;
  1617. };
  1618. _config.cancelToken && _config.cancelToken.subscribe(onCanceled);
  1619. if (_config.signal) {
  1620. _config.signal.aborted ? onCanceled() : _config.signal.addEventListener("abort", onCanceled);
  1621. }
  1622. }
  1623. const protocol = parseProtocol(_config.url);
  1624. if (protocol && platform.protocols.indexOf(protocol) === -1) {
  1625. reject(new AxiosError("Unsupported protocol " + protocol + ":", AxiosError.ERR_BAD_REQUEST, config));
  1626. return;
  1627. }
  1628. request.send(requestData || null);
  1629. });
  1630. };
  1631. const composeSignals = (signals, timeout) => {
  1632. const { length } = signals = signals ? signals.filter(Boolean) : [];
  1633. if (timeout || length) {
  1634. let controller = new AbortController();
  1635. let aborted;
  1636. const onabort = function(reason) {
  1637. if (!aborted) {
  1638. aborted = true;
  1639. unsubscribe();
  1640. const err = reason instanceof Error ? reason : this.reason;
  1641. controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err));
  1642. }
  1643. };
  1644. let timer = timeout && setTimeout(() => {
  1645. timer = null;
  1646. onabort(new AxiosError(`timeout ${timeout} of ms exceeded`, AxiosError.ETIMEDOUT));
  1647. }, timeout);
  1648. const unsubscribe = () => {
  1649. if (signals) {
  1650. timer && clearTimeout(timer);
  1651. timer = null;
  1652. signals.forEach((signal2) => {
  1653. signal2.unsubscribe ? signal2.unsubscribe(onabort) : signal2.removeEventListener("abort", onabort);
  1654. });
  1655. signals = null;
  1656. }
  1657. };
  1658. signals.forEach((signal2) => signal2.addEventListener("abort", onabort));
  1659. const { signal } = controller;
  1660. signal.unsubscribe = () => utils$1.asap(unsubscribe);
  1661. return signal;
  1662. }
  1663. };
  1664. const composeSignals$1 = composeSignals;
  1665. const streamChunk = function* (chunk, chunkSize) {
  1666. let len = chunk.byteLength;
  1667. if (!chunkSize || len < chunkSize) {
  1668. yield chunk;
  1669. return;
  1670. }
  1671. let pos = 0;
  1672. let end;
  1673. while (pos < len) {
  1674. end = pos + chunkSize;
  1675. yield chunk.slice(pos, end);
  1676. pos = end;
  1677. }
  1678. };
  1679. const readBytes = async function* (iterable, chunkSize) {
  1680. for await (const chunk of readStream(iterable)) {
  1681. yield* streamChunk(chunk, chunkSize);
  1682. }
  1683. };
  1684. const readStream = async function* (stream) {
  1685. if (stream[Symbol.asyncIterator]) {
  1686. yield* stream;
  1687. return;
  1688. }
  1689. const reader = stream.getReader();
  1690. try {
  1691. for (; ; ) {
  1692. const { done, value } = await reader.read();
  1693. if (done) {
  1694. break;
  1695. }
  1696. yield value;
  1697. }
  1698. } finally {
  1699. await reader.cancel();
  1700. }
  1701. };
  1702. const trackStream = (stream, chunkSize, onProgress, onFinish) => {
  1703. const iterator2 = readBytes(stream, chunkSize);
  1704. let bytes = 0;
  1705. let done;
  1706. let _onFinish = (e) => {
  1707. if (!done) {
  1708. done = true;
  1709. onFinish && onFinish(e);
  1710. }
  1711. };
  1712. return new ReadableStream({
  1713. async pull(controller) {
  1714. try {
  1715. const { done: done2, value } = await iterator2.next();
  1716. if (done2) {
  1717. _onFinish();
  1718. controller.close();
  1719. return;
  1720. }
  1721. let len = value.byteLength;
  1722. if (onProgress) {
  1723. let loadedBytes = bytes += len;
  1724. onProgress(loadedBytes);
  1725. }
  1726. controller.enqueue(new Uint8Array(value));
  1727. } catch (err) {
  1728. _onFinish(err);
  1729. throw err;
  1730. }
  1731. },
  1732. cancel(reason) {
  1733. _onFinish(reason);
  1734. return iterator2.return();
  1735. }
  1736. }, {
  1737. highWaterMark: 2
  1738. });
  1739. };
  1740. const DEFAULT_CHUNK_SIZE = 64 * 1024;
  1741. const { isFunction } = utils$1;
  1742. const globalFetchAPI = (({ Request, Response }) => ({
  1743. Request,
  1744. Response
  1745. }))(utils$1.global);
  1746. const {
  1747. ReadableStream: ReadableStream$1,
  1748. TextEncoder
  1749. } = utils$1.global;
  1750. const test = (fn, ...args) => {
  1751. try {
  1752. return !!fn(...args);
  1753. } catch (e) {
  1754. return false;
  1755. }
  1756. };
  1757. const factory = (env) => {
  1758. env = utils$1.merge.call({
  1759. skipUndefined: true
  1760. }, globalFetchAPI, env);
  1761. const { fetch: envFetch, Request, Response } = env;
  1762. const isFetchSupported = envFetch ? isFunction(envFetch) : typeof fetch === "function";
  1763. const isRequestSupported = isFunction(Request);
  1764. const isResponseSupported = isFunction(Response);
  1765. if (!isFetchSupported) {
  1766. return false;
  1767. }
  1768. const isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream$1);
  1769. const encodeText = isFetchSupported && (typeof TextEncoder === "function" ? ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) : async (str) => new Uint8Array(await new Request(str).arrayBuffer()));
  1770. const supportsRequestStream = isRequestSupported && isReadableStreamSupported && test(() => {
  1771. let duplexAccessed = false;
  1772. const hasContentType = new Request(platform.origin, {
  1773. body: new ReadableStream$1(),
  1774. method: "POST",
  1775. get duplex() {
  1776. duplexAccessed = true;
  1777. return "half";
  1778. }
  1779. }).headers.has("Content-Type");
  1780. return duplexAccessed && !hasContentType;
  1781. });
  1782. const supportsResponseStream = isResponseSupported && isReadableStreamSupported && test(() => utils$1.isReadableStream(new Response("").body));
  1783. const resolvers = {
  1784. stream: supportsResponseStream && ((res) => res.body)
  1785. };
  1786. isFetchSupported && (() => {
  1787. ["text", "arrayBuffer", "blob", "formData", "stream"].forEach((type) => {
  1788. !resolvers[type] && (resolvers[type] = (res, config) => {
  1789. let method = res && res[type];
  1790. if (method) {
  1791. return method.call(res);
  1792. }
  1793. throw new AxiosError(`Response type '${type}' is not supported`, AxiosError.ERR_NOT_SUPPORT, config);
  1794. });
  1795. });
  1796. })();
  1797. const getBodyLength = async (body) => {
  1798. if (body == null) {
  1799. return 0;
  1800. }
  1801. if (utils$1.isBlob(body)) {
  1802. return body.size;
  1803. }
  1804. if (utils$1.isSpecCompliantForm(body)) {
  1805. const _request = new Request(platform.origin, {
  1806. method: "POST",
  1807. body
  1808. });
  1809. return (await _request.arrayBuffer()).byteLength;
  1810. }
  1811. if (utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
  1812. return body.byteLength;
  1813. }
  1814. if (utils$1.isURLSearchParams(body)) {
  1815. body = body + "";
  1816. }
  1817. if (utils$1.isString(body)) {
  1818. return (await encodeText(body)).byteLength;
  1819. }
  1820. };
  1821. const resolveBodyLength = async (headers, body) => {
  1822. const length = utils$1.toFiniteNumber(headers.getContentLength());
  1823. return length == null ? getBodyLength(body) : length;
  1824. };
  1825. return async (config) => {
  1826. let {
  1827. url,
  1828. method,
  1829. data,
  1830. signal,
  1831. cancelToken,
  1832. timeout,
  1833. onDownloadProgress,
  1834. onUploadProgress,
  1835. responseType,
  1836. headers,
  1837. withCredentials = "same-origin",
  1838. fetchOptions
  1839. } = resolveConfig(config);
  1840. let _fetch = envFetch || fetch;
  1841. responseType = responseType ? (responseType + "").toLowerCase() : "text";
  1842. let composedSignal = composeSignals$1([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
  1843. let request = null;
  1844. const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
  1845. composedSignal.unsubscribe();
  1846. });
  1847. let requestContentLength;
  1848. try {
  1849. if (onUploadProgress && supportsRequestStream && method !== "get" && method !== "head" && (requestContentLength = await resolveBodyLength(headers, data)) !== 0) {
  1850. let _request = new Request(url, {
  1851. method: "POST",
  1852. body: data,
  1853. duplex: "half"
  1854. });
  1855. let contentTypeHeader;
  1856. if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get("content-type"))) {
  1857. headers.setContentType(contentTypeHeader);
  1858. }
  1859. if (_request.body) {
  1860. const [onProgress, flush] = progressEventDecorator(
  1861. requestContentLength,
  1862. progressEventReducer(asyncDecorator(onUploadProgress))
  1863. );
  1864. data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
  1865. }
  1866. }
  1867. if (!utils$1.isString(withCredentials)) {
  1868. withCredentials = withCredentials ? "include" : "omit";
  1869. }
  1870. const isCredentialsSupported = isRequestSupported && "credentials" in Request.prototype;
  1871. const resolvedOptions = {
  1872. ...fetchOptions,
  1873. signal: composedSignal,
  1874. method: method.toUpperCase(),
  1875. headers: headers.normalize().toJSON(),
  1876. body: data,
  1877. duplex: "half",
  1878. credentials: isCredentialsSupported ? withCredentials : void 0
  1879. };
  1880. request = isRequestSupported && new Request(url, resolvedOptions);
  1881. let response = await (isRequestSupported ? _fetch(request, fetchOptions) : _fetch(url, resolvedOptions));
  1882. const isStreamResponse = supportsResponseStream && (responseType === "stream" || responseType === "response");
  1883. if (supportsResponseStream && (onDownloadProgress || isStreamResponse && unsubscribe)) {
  1884. const options = {};
  1885. ["status", "statusText", "headers"].forEach((prop) => {
  1886. options[prop] = response[prop];
  1887. });
  1888. const responseContentLength = utils$1.toFiniteNumber(response.headers.get("content-length"));
  1889. const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
  1890. responseContentLength,
  1891. progressEventReducer(asyncDecorator(onDownloadProgress), true)
  1892. ) || [];
  1893. response = new Response(
  1894. trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
  1895. flush && flush();
  1896. unsubscribe && unsubscribe();
  1897. }),
  1898. options
  1899. );
  1900. }
  1901. responseType = responseType || "text";
  1902. let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || "text"](response, config);
  1903. !isStreamResponse && unsubscribe && unsubscribe();
  1904. return await new Promise((resolve, reject) => {
  1905. settle(resolve, reject, {
  1906. data: responseData,
  1907. headers: AxiosHeaders$1.from(response.headers),
  1908. status: response.status,
  1909. statusText: response.statusText,
  1910. config,
  1911. request
  1912. });
  1913. });
  1914. } catch (err) {
  1915. unsubscribe && unsubscribe();
  1916. if (err && err.name === "TypeError" && /Load failed|fetch/i.test(err.message)) {
  1917. throw Object.assign(
  1918. new AxiosError("Network Error", AxiosError.ERR_NETWORK, config, request),
  1919. {
  1920. cause: err.cause || err
  1921. }
  1922. );
  1923. }
  1924. throw AxiosError.from(err, err && err.code, config, request);
  1925. }
  1926. };
  1927. };
  1928. const seedCache = /* @__PURE__ */ new Map();
  1929. const getFetch = (config) => {
  1930. let env = config && config.env || {};
  1931. const { fetch: fetch2, Request, Response } = env;
  1932. const seeds = [
  1933. Request,
  1934. Response,
  1935. fetch2
  1936. ];
  1937. let len = seeds.length, i = len, seed, target, map = seedCache;
  1938. while (i--) {
  1939. seed = seeds[i];
  1940. target = map.get(seed);
  1941. target === void 0 && map.set(seed, target = i ? /* @__PURE__ */ new Map() : factory(env));
  1942. map = target;
  1943. }
  1944. return target;
  1945. };
  1946. getFetch();
  1947. const knownAdapters = {
  1948. http: httpAdapter,
  1949. xhr: xhrAdapter,
  1950. fetch: {
  1951. get: getFetch
  1952. }
  1953. };
  1954. utils$1.forEach(knownAdapters, (fn, value) => {
  1955. if (fn) {
  1956. try {
  1957. Object.defineProperty(fn, "name", { value });
  1958. } catch (e) {
  1959. }
  1960. Object.defineProperty(fn, "adapterName", { value });
  1961. }
  1962. });
  1963. const renderReason = (reason) => `- ${reason}`;
  1964. const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false;
  1965. function getAdapter(adapters2, config) {
  1966. adapters2 = utils$1.isArray(adapters2) ? adapters2 : [adapters2];
  1967. const { length } = adapters2;
  1968. let nameOrAdapter;
  1969. let adapter;
  1970. const rejectedReasons = {};
  1971. for (let i = 0; i < length; i++) {
  1972. nameOrAdapter = adapters2[i];
  1973. let id;
  1974. adapter = nameOrAdapter;
  1975. if (!isResolvedHandle(nameOrAdapter)) {
  1976. adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
  1977. if (adapter === void 0) {
  1978. throw new AxiosError(`Unknown adapter '${id}'`);
  1979. }
  1980. }
  1981. if (adapter && (utils$1.isFunction(adapter) || (adapter = adapter.get(config)))) {
  1982. break;
  1983. }
  1984. rejectedReasons[id || "#" + i] = adapter;
  1985. }
  1986. if (!adapter) {
  1987. const reasons = Object.entries(rejectedReasons).map(
  1988. ([id, state]) => `adapter ${id} ` + (state === false ? "is not supported by the environment" : "is not available in the build")
  1989. );
  1990. let s = length ? reasons.length > 1 ? "since :\n" + reasons.map(renderReason).join("\n") : " " + renderReason(reasons[0]) : "as no adapter specified";
  1991. throw new AxiosError(
  1992. `There is no suitable adapter to dispatch the request ` + s,
  1993. "ERR_NOT_SUPPORT"
  1994. );
  1995. }
  1996. return adapter;
  1997. }
  1998. const adapters = {
  1999. /**
  2000. * Resolve an adapter from a list of adapter names or functions.
  2001. * @type {Function}
  2002. */
  2003. getAdapter,
  2004. /**
  2005. * Exposes all known adapters
  2006. * @type {Object<string, Function|Object>}
  2007. */
  2008. adapters: knownAdapters
  2009. };
  2010. function throwIfCancellationRequested(config) {
  2011. if (config.cancelToken) {
  2012. config.cancelToken.throwIfRequested();
  2013. }
  2014. if (config.signal && config.signal.aborted) {
  2015. throw new CanceledError(null, config);
  2016. }
  2017. }
  2018. function dispatchRequest(config) {
  2019. throwIfCancellationRequested(config);
  2020. config.headers = AxiosHeaders$1.from(config.headers);
  2021. config.data = transformData.call(
  2022. config,
  2023. config.transformRequest
  2024. );
  2025. if (["post", "put", "patch"].indexOf(config.method) !== -1) {
  2026. config.headers.setContentType("application/x-www-form-urlencoded", false);
  2027. }
  2028. const adapter = adapters.getAdapter(config.adapter || defaults$1.adapter, config);
  2029. return adapter(config).then(function onAdapterResolution(response) {
  2030. throwIfCancellationRequested(config);
  2031. response.data = transformData.call(
  2032. config,
  2033. config.transformResponse,
  2034. response
  2035. );
  2036. response.headers = AxiosHeaders$1.from(response.headers);
  2037. return response;
  2038. }, function onAdapterRejection(reason) {
  2039. if (!isCancel(reason)) {
  2040. throwIfCancellationRequested(config);
  2041. if (reason && reason.response) {
  2042. reason.response.data = transformData.call(
  2043. config,
  2044. config.transformResponse,
  2045. reason.response
  2046. );
  2047. reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
  2048. }
  2049. }
  2050. return Promise.reject(reason);
  2051. });
  2052. }
  2053. const VERSION = "1.13.2";
  2054. const validators$1 = {};
  2055. ["object", "boolean", "number", "function", "string", "symbol"].forEach((type, i) => {
  2056. validators$1[type] = function validator2(thing) {
  2057. return typeof thing === type || "a" + (i < 1 ? "n " : " ") + type;
  2058. };
  2059. });
  2060. const deprecatedWarnings = {};
  2061. validators$1.transitional = function transitional(validator2, version, message) {
  2062. function formatMessage(opt, desc) {
  2063. return "[Axios v" + VERSION + "] Transitional option '" + opt + "'" + desc + (message ? ". " + message : "");
  2064. }
  2065. return (value, opt, opts) => {
  2066. if (validator2 === false) {
  2067. throw new AxiosError(
  2068. formatMessage(opt, " has been removed" + (version ? " in " + version : "")),
  2069. AxiosError.ERR_DEPRECATED
  2070. );
  2071. }
  2072. if (version && !deprecatedWarnings[opt]) {
  2073. deprecatedWarnings[opt] = true;
  2074. console.warn(
  2075. formatMessage(
  2076. opt,
  2077. " has been deprecated since v" + version + " and will be removed in the near future"
  2078. )
  2079. );
  2080. }
  2081. return validator2 ? validator2(value, opt, opts) : true;
  2082. };
  2083. };
  2084. validators$1.spelling = function spelling(correctSpelling) {
  2085. return (value, opt) => {
  2086. console.warn(`${opt} is likely a misspelling of ${correctSpelling}`);
  2087. return true;
  2088. };
  2089. };
  2090. function assertOptions(options, schema, allowUnknown) {
  2091. if (typeof options !== "object") {
  2092. throw new AxiosError("options must be an object", AxiosError.ERR_BAD_OPTION_VALUE);
  2093. }
  2094. const keys = Object.keys(options);
  2095. let i = keys.length;
  2096. while (i-- > 0) {
  2097. const opt = keys[i];
  2098. const validator2 = schema[opt];
  2099. if (validator2) {
  2100. const value = options[opt];
  2101. const result = value === void 0 || validator2(value, opt, options);
  2102. if (result !== true) {
  2103. throw new AxiosError("option " + opt + " must be " + result, AxiosError.ERR_BAD_OPTION_VALUE);
  2104. }
  2105. continue;
  2106. }
  2107. if (allowUnknown !== true) {
  2108. throw new AxiosError("Unknown option " + opt, AxiosError.ERR_BAD_OPTION);
  2109. }
  2110. }
  2111. }
  2112. const validator = {
  2113. assertOptions,
  2114. validators: validators$1
  2115. };
  2116. const validators = validator.validators;
  2117. class Axios {
  2118. constructor(instanceConfig) {
  2119. this.defaults = instanceConfig || {};
  2120. this.interceptors = {
  2121. request: new InterceptorManager$1(),
  2122. response: new InterceptorManager$1()
  2123. };
  2124. }
  2125. /**
  2126. * Dispatch a request
  2127. *
  2128. * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
  2129. * @param {?Object} config
  2130. *
  2131. * @returns {Promise} The Promise to be fulfilled
  2132. */
  2133. async request(configOrUrl, config) {
  2134. try {
  2135. return await this._request(configOrUrl, config);
  2136. } catch (err) {
  2137. if (err instanceof Error) {
  2138. let dummy = {};
  2139. Error.captureStackTrace ? Error.captureStackTrace(dummy) : dummy = new Error();
  2140. const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, "") : "";
  2141. try {
  2142. if (!err.stack) {
  2143. err.stack = stack;
  2144. } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ""))) {
  2145. err.stack += "\n" + stack;
  2146. }
  2147. } catch (e) {
  2148. }
  2149. }
  2150. throw err;
  2151. }
  2152. }
  2153. _request(configOrUrl, config) {
  2154. if (typeof configOrUrl === "string") {
  2155. config = config || {};
  2156. config.url = configOrUrl;
  2157. } else {
  2158. config = configOrUrl || {};
  2159. }
  2160. config = mergeConfig(this.defaults, config);
  2161. const { transitional: transitional2, paramsSerializer, headers } = config;
  2162. if (transitional2 !== void 0) {
  2163. validator.assertOptions(transitional2, {
  2164. silentJSONParsing: validators.transitional(validators.boolean),
  2165. forcedJSONParsing: validators.transitional(validators.boolean),
  2166. clarifyTimeoutError: validators.transitional(validators.boolean)
  2167. }, false);
  2168. }
  2169. if (paramsSerializer != null) {
  2170. if (utils$1.isFunction(paramsSerializer)) {
  2171. config.paramsSerializer = {
  2172. serialize: paramsSerializer
  2173. };
  2174. } else {
  2175. validator.assertOptions(paramsSerializer, {
  2176. encode: validators.function,
  2177. serialize: validators.function
  2178. }, true);
  2179. }
  2180. }
  2181. if (config.allowAbsoluteUrls !== void 0)
  2182. ;
  2183. else if (this.defaults.allowAbsoluteUrls !== void 0) {
  2184. config.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls;
  2185. } else {
  2186. config.allowAbsoluteUrls = true;
  2187. }
  2188. validator.assertOptions(config, {
  2189. baseUrl: validators.spelling("baseURL"),
  2190. withXsrfToken: validators.spelling("withXSRFToken")
  2191. }, true);
  2192. config.method = (config.method || this.defaults.method || "get").toLowerCase();
  2193. let contextHeaders = headers && utils$1.merge(
  2194. headers.common,
  2195. headers[config.method]
  2196. );
  2197. headers && utils$1.forEach(
  2198. ["delete", "get", "head", "post", "put", "patch", "common"],
  2199. (method) => {
  2200. delete headers[method];
  2201. }
  2202. );
  2203. config.headers = AxiosHeaders$1.concat(contextHeaders, headers);
  2204. const requestInterceptorChain = [];
  2205. let synchronousRequestInterceptors = true;
  2206. this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
  2207. if (typeof interceptor.runWhen === "function" && interceptor.runWhen(config) === false) {
  2208. return;
  2209. }
  2210. synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
  2211. requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
  2212. });
  2213. const responseInterceptorChain = [];
  2214. this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
  2215. responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
  2216. });
  2217. let promise;
  2218. let i = 0;
  2219. let len;
  2220. if (!synchronousRequestInterceptors) {
  2221. const chain = [dispatchRequest.bind(this), void 0];
  2222. chain.unshift(...requestInterceptorChain);
  2223. chain.push(...responseInterceptorChain);
  2224. len = chain.length;
  2225. promise = Promise.resolve(config);
  2226. while (i < len) {
  2227. promise = promise.then(chain[i++], chain[i++]);
  2228. }
  2229. return promise;
  2230. }
  2231. len = requestInterceptorChain.length;
  2232. let newConfig = config;
  2233. while (i < len) {
  2234. const onFulfilled = requestInterceptorChain[i++];
  2235. const onRejected = requestInterceptorChain[i++];
  2236. try {
  2237. newConfig = onFulfilled(newConfig);
  2238. } catch (error) {
  2239. onRejected.call(this, error);
  2240. break;
  2241. }
  2242. }
  2243. try {
  2244. promise = dispatchRequest.call(this, newConfig);
  2245. } catch (error) {
  2246. return Promise.reject(error);
  2247. }
  2248. i = 0;
  2249. len = responseInterceptorChain.length;
  2250. while (i < len) {
  2251. promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);
  2252. }
  2253. return promise;
  2254. }
  2255. getUri(config) {
  2256. config = mergeConfig(this.defaults, config);
  2257. const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
  2258. return buildURL(fullPath, config.params, config.paramsSerializer);
  2259. }
  2260. }
  2261. utils$1.forEach(["delete", "get", "head", "options"], function forEachMethodNoData(method) {
  2262. Axios.prototype[method] = function(url, config) {
  2263. return this.request(mergeConfig(config || {}, {
  2264. method,
  2265. url,
  2266. data: (config || {}).data
  2267. }));
  2268. };
  2269. });
  2270. utils$1.forEach(["post", "put", "patch"], function forEachMethodWithData(method) {
  2271. function generateHTTPMethod(isForm) {
  2272. return function httpMethod(url, data, config) {
  2273. return this.request(mergeConfig(config || {}, {
  2274. method,
  2275. headers: isForm ? {
  2276. "Content-Type": "multipart/form-data"
  2277. } : {},
  2278. url,
  2279. data
  2280. }));
  2281. };
  2282. }
  2283. Axios.prototype[method] = generateHTTPMethod();
  2284. Axios.prototype[method + "Form"] = generateHTTPMethod(true);
  2285. });
  2286. const Axios$1 = Axios;
  2287. class CancelToken {
  2288. constructor(executor) {
  2289. if (typeof executor !== "function") {
  2290. throw new TypeError("executor must be a function.");
  2291. }
  2292. let resolvePromise;
  2293. this.promise = new Promise(function promiseExecutor(resolve) {
  2294. resolvePromise = resolve;
  2295. });
  2296. const token = this;
  2297. this.promise.then((cancel) => {
  2298. if (!token._listeners)
  2299. return;
  2300. let i = token._listeners.length;
  2301. while (i-- > 0) {
  2302. token._listeners[i](cancel);
  2303. }
  2304. token._listeners = null;
  2305. });
  2306. this.promise.then = (onfulfilled) => {
  2307. let _resolve;
  2308. const promise = new Promise((resolve) => {
  2309. token.subscribe(resolve);
  2310. _resolve = resolve;
  2311. }).then(onfulfilled);
  2312. promise.cancel = function reject() {
  2313. token.unsubscribe(_resolve);
  2314. };
  2315. return promise;
  2316. };
  2317. executor(function cancel(message, config, request) {
  2318. if (token.reason) {
  2319. return;
  2320. }
  2321. token.reason = new CanceledError(message, config, request);
  2322. resolvePromise(token.reason);
  2323. });
  2324. }
  2325. /**
  2326. * Throws a `CanceledError` if cancellation has been requested.
  2327. */
  2328. throwIfRequested() {
  2329. if (this.reason) {
  2330. throw this.reason;
  2331. }
  2332. }
  2333. /**
  2334. * Subscribe to the cancel signal
  2335. */
  2336. subscribe(listener) {
  2337. if (this.reason) {
  2338. listener(this.reason);
  2339. return;
  2340. }
  2341. if (this._listeners) {
  2342. this._listeners.push(listener);
  2343. } else {
  2344. this._listeners = [listener];
  2345. }
  2346. }
  2347. /**
  2348. * Unsubscribe from the cancel signal
  2349. */
  2350. unsubscribe(listener) {
  2351. if (!this._listeners) {
  2352. return;
  2353. }
  2354. const index = this._listeners.indexOf(listener);
  2355. if (index !== -1) {
  2356. this._listeners.splice(index, 1);
  2357. }
  2358. }
  2359. toAbortSignal() {
  2360. const controller = new AbortController();
  2361. const abort = (err) => {
  2362. controller.abort(err);
  2363. };
  2364. this.subscribe(abort);
  2365. controller.signal.unsubscribe = () => this.unsubscribe(abort);
  2366. return controller.signal;
  2367. }
  2368. /**
  2369. * Returns an object that contains a new `CancelToken` and a function that, when called,
  2370. * cancels the `CancelToken`.
  2371. */
  2372. static source() {
  2373. let cancel;
  2374. const token = new CancelToken(function executor(c) {
  2375. cancel = c;
  2376. });
  2377. return {
  2378. token,
  2379. cancel
  2380. };
  2381. }
  2382. }
  2383. const CancelToken$1 = CancelToken;
  2384. function spread(callback) {
  2385. return function wrap(arr) {
  2386. return callback.apply(null, arr);
  2387. };
  2388. }
  2389. function isAxiosError(payload) {
  2390. return utils$1.isObject(payload) && payload.isAxiosError === true;
  2391. }
  2392. const HttpStatusCode = {
  2393. Continue: 100,
  2394. SwitchingProtocols: 101,
  2395. Processing: 102,
  2396. EarlyHints: 103,
  2397. Ok: 200,
  2398. Created: 201,
  2399. Accepted: 202,
  2400. NonAuthoritativeInformation: 203,
  2401. NoContent: 204,
  2402. ResetContent: 205,
  2403. PartialContent: 206,
  2404. MultiStatus: 207,
  2405. AlreadyReported: 208,
  2406. ImUsed: 226,
  2407. MultipleChoices: 300,
  2408. MovedPermanently: 301,
  2409. Found: 302,
  2410. SeeOther: 303,
  2411. NotModified: 304,
  2412. UseProxy: 305,
  2413. Unused: 306,
  2414. TemporaryRedirect: 307,
  2415. PermanentRedirect: 308,
  2416. BadRequest: 400,
  2417. Unauthorized: 401,
  2418. PaymentRequired: 402,
  2419. Forbidden: 403,
  2420. NotFound: 404,
  2421. MethodNotAllowed: 405,
  2422. NotAcceptable: 406,
  2423. ProxyAuthenticationRequired: 407,
  2424. RequestTimeout: 408,
  2425. Conflict: 409,
  2426. Gone: 410,
  2427. LengthRequired: 411,
  2428. PreconditionFailed: 412,
  2429. PayloadTooLarge: 413,
  2430. UriTooLong: 414,
  2431. UnsupportedMediaType: 415,
  2432. RangeNotSatisfiable: 416,
  2433. ExpectationFailed: 417,
  2434. ImATeapot: 418,
  2435. MisdirectedRequest: 421,
  2436. UnprocessableEntity: 422,
  2437. Locked: 423,
  2438. FailedDependency: 424,
  2439. TooEarly: 425,
  2440. UpgradeRequired: 426,
  2441. PreconditionRequired: 428,
  2442. TooManyRequests: 429,
  2443. RequestHeaderFieldsTooLarge: 431,
  2444. UnavailableForLegalReasons: 451,
  2445. InternalServerError: 500,
  2446. NotImplemented: 501,
  2447. BadGateway: 502,
  2448. ServiceUnavailable: 503,
  2449. GatewayTimeout: 504,
  2450. HttpVersionNotSupported: 505,
  2451. VariantAlsoNegotiates: 506,
  2452. InsufficientStorage: 507,
  2453. LoopDetected: 508,
  2454. NotExtended: 510,
  2455. NetworkAuthenticationRequired: 511,
  2456. WebServerIsDown: 521,
  2457. ConnectionTimedOut: 522,
  2458. OriginIsUnreachable: 523,
  2459. TimeoutOccurred: 524,
  2460. SslHandshakeFailed: 525,
  2461. InvalidSslCertificate: 526
  2462. };
  2463. Object.entries(HttpStatusCode).forEach(([key, value]) => {
  2464. HttpStatusCode[value] = key;
  2465. });
  2466. const HttpStatusCode$1 = HttpStatusCode;
  2467. function createInstance(defaultConfig) {
  2468. const context = new Axios$1(defaultConfig);
  2469. const instance = bind(Axios$1.prototype.request, context);
  2470. utils$1.extend(instance, Axios$1.prototype, context, { allOwnKeys: true });
  2471. utils$1.extend(instance, context, null, { allOwnKeys: true });
  2472. instance.create = function create(instanceConfig) {
  2473. return createInstance(mergeConfig(defaultConfig, instanceConfig));
  2474. };
  2475. return instance;
  2476. }
  2477. const axios = createInstance(defaults$1);
  2478. axios.Axios = Axios$1;
  2479. axios.CanceledError = CanceledError;
  2480. axios.CancelToken = CancelToken$1;
  2481. axios.isCancel = isCancel;
  2482. axios.VERSION = VERSION;
  2483. axios.toFormData = toFormData;
  2484. axios.AxiosError = AxiosError;
  2485. axios.Cancel = axios.CanceledError;
  2486. axios.all = function all(promises) {
  2487. return Promise.all(promises);
  2488. };
  2489. axios.spread = spread;
  2490. axios.isAxiosError = isAxiosError;
  2491. axios.mergeConfig = mergeConfig;
  2492. axios.AxiosHeaders = AxiosHeaders$1;
  2493. axios.formToJSON = (thing) => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
  2494. axios.getAdapter = adapters.getAdapter;
  2495. axios.HttpStatusCode = HttpStatusCode$1;
  2496. axios.default = axios;
  2497. const axios$1 = axios;
  2498. export {
  2499. axios$1 as a
  2500. };
  2501. //# sourceMappingURL=utils-dev.be08a1a2.js.map