source: imaps-frontend/node_modules/axios/dist/axios.js

main
Last change on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

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