source: imaps-frontend/node_modules/axios/dist/axios.js@ 0c6b92a

main
Last change on this file since 0c6b92a was 0c6b92a, checked in by stefan toskovski <stefantoska84@…>, 5 weeks ago

Pred finalna verzija

  • Property mode set to 100644
File size: 141.1 KB
Line 
1// Axios v1.7.8 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|Function)} 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 if (utils$1.isFunction(options)) {
1749 options = {
1750 serialize: options
1751 };
1752 }
1753 var serializeFn = options && options.serialize;
1754 var serializedParams;
1755 if (serializeFn) {
1756 serializedParams = serializeFn(params, options);
1757 } else {
1758 serializedParams = utils$1.isURLSearchParams(params) ? params.toString() : new AxiosURLSearchParams(params, options).toString(_encode);
1759 }
1760 if (serializedParams) {
1761 var hashmarkIndex = url.indexOf("#");
1762 if (hashmarkIndex !== -1) {
1763 url = url.slice(0, hashmarkIndex);
1764 }
1765 url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
1766 }
1767 return url;
1768 }
1769
1770 var InterceptorManager = /*#__PURE__*/function () {
1771 function InterceptorManager() {
1772 _classCallCheck(this, InterceptorManager);
1773 this.handlers = [];
1774 }
1775
1776 /**
1777 * Add a new interceptor to the stack
1778 *
1779 * @param {Function} fulfilled The function to handle `then` for a `Promise`
1780 * @param {Function} rejected The function to handle `reject` for a `Promise`
1781 *
1782 * @return {Number} An ID used to remove interceptor later
1783 */
1784 _createClass(InterceptorManager, [{
1785 key: "use",
1786 value: function use(fulfilled, rejected, options) {
1787 this.handlers.push({
1788 fulfilled: fulfilled,
1789 rejected: rejected,
1790 synchronous: options ? options.synchronous : false,
1791 runWhen: options ? options.runWhen : null
1792 });
1793 return this.handlers.length - 1;
1794 }
1795
1796 /**
1797 * Remove an interceptor from the stack
1798 *
1799 * @param {Number} id The ID that was returned by `use`
1800 *
1801 * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
1802 */
1803 }, {
1804 key: "eject",
1805 value: function eject(id) {
1806 if (this.handlers[id]) {
1807 this.handlers[id] = null;
1808 }
1809 }
1810
1811 /**
1812 * Clear all interceptors from the stack
1813 *
1814 * @returns {void}
1815 */
1816 }, {
1817 key: "clear",
1818 value: function clear() {
1819 if (this.handlers) {
1820 this.handlers = [];
1821 }
1822 }
1823
1824 /**
1825 * Iterate over all the registered interceptors
1826 *
1827 * This method is particularly useful for skipping over any
1828 * interceptors that may have become `null` calling `eject`.
1829 *
1830 * @param {Function} fn The function to call for each interceptor
1831 *
1832 * @returns {void}
1833 */
1834 }, {
1835 key: "forEach",
1836 value: function forEach(fn) {
1837 utils$1.forEach(this.handlers, function forEachHandler(h) {
1838 if (h !== null) {
1839 fn(h);
1840 }
1841 });
1842 }
1843 }]);
1844 return InterceptorManager;
1845 }();
1846 var InterceptorManager$1 = InterceptorManager;
1847
1848 var transitionalDefaults = {
1849 silentJSONParsing: true,
1850 forcedJSONParsing: true,
1851 clarifyTimeoutError: false
1852 };
1853
1854 var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
1855
1856 var FormData$1 = typeof FormData !== 'undefined' ? FormData : null;
1857
1858 var Blob$1 = typeof Blob !== 'undefined' ? Blob : null;
1859
1860 var platform$1 = {
1861 isBrowser: true,
1862 classes: {
1863 URLSearchParams: URLSearchParams$1,
1864 FormData: FormData$1,
1865 Blob: Blob$1
1866 },
1867 protocols: ['http', 'https', 'file', 'blob', 'url', 'data']
1868 };
1869
1870 var hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
1871 var _navigator = (typeof navigator === "undefined" ? "undefined" : _typeof(navigator)) === 'object' && navigator || undefined;
1872
1873 /**
1874 * Determine if we're running in a standard browser environment
1875 *
1876 * This allows axios to run in a web worker, and react-native.
1877 * Both environments support XMLHttpRequest, but not fully standard globals.
1878 *
1879 * web workers:
1880 * typeof window -> undefined
1881 * typeof document -> undefined
1882 *
1883 * react-native:
1884 * navigator.product -> 'ReactNative'
1885 * nativescript
1886 * navigator.product -> 'NativeScript' or 'NS'
1887 *
1888 * @returns {boolean}
1889 */
1890 var hasStandardBrowserEnv = hasBrowserEnv && (!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);
1891
1892 /**
1893 * Determine if we're running in a standard browser webWorker environment
1894 *
1895 * Although the `isStandardBrowserEnv` method indicates that
1896 * `allows axios to run in a web worker`, the WebWorker will still be
1897 * filtered out due to its judgment standard
1898 * `typeof window !== 'undefined' && typeof document !== 'undefined'`.
1899 * This leads to a problem when axios post `FormData` in webWorker
1900 */
1901 var hasStandardBrowserWebWorkerEnv = function () {
1902 return typeof WorkerGlobalScope !== 'undefined' &&
1903 // eslint-disable-next-line no-undef
1904 self instanceof WorkerGlobalScope && typeof self.importScripts === 'function';
1905 }();
1906 var origin = hasBrowserEnv && window.location.href || 'http://localhost';
1907
1908 var utils = /*#__PURE__*/Object.freeze({
1909 __proto__: null,
1910 hasBrowserEnv: hasBrowserEnv,
1911 hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
1912 hasStandardBrowserEnv: hasStandardBrowserEnv,
1913 navigator: _navigator,
1914 origin: origin
1915 });
1916
1917 var platform = _objectSpread2(_objectSpread2({}, utils), platform$1);
1918
1919 function toURLEncodedForm(data, options) {
1920 return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({
1921 visitor: function visitor(value, key, path, helpers) {
1922 if (platform.isNode && utils$1.isBuffer(value)) {
1923 this.append(key, value.toString('base64'));
1924 return false;
1925 }
1926 return helpers.defaultVisitor.apply(this, arguments);
1927 }
1928 }, options));
1929 }
1930
1931 /**
1932 * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']
1933 *
1934 * @param {string} name - The name of the property to get.
1935 *
1936 * @returns An array of strings.
1937 */
1938 function parsePropPath(name) {
1939 // foo[x][y][z]
1940 // foo.x.y.z
1941 // foo-x-y-z
1942 // foo x y z
1943 return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map(function (match) {
1944 return match[0] === '[]' ? '' : match[1] || match[0];
1945 });
1946 }
1947
1948 /**
1949 * Convert an array to an object.
1950 *
1951 * @param {Array<any>} arr - The array to convert to an object.
1952 *
1953 * @returns An object with the same keys and values as the array.
1954 */
1955 function arrayToObject(arr) {
1956 var obj = {};
1957 var keys = Object.keys(arr);
1958 var i;
1959 var len = keys.length;
1960 var key;
1961 for (i = 0; i < len; i++) {
1962 key = keys[i];
1963 obj[key] = arr[key];
1964 }
1965 return obj;
1966 }
1967
1968 /**
1969 * It takes a FormData object and returns a JavaScript object
1970 *
1971 * @param {string} formData The FormData object to convert to JSON.
1972 *
1973 * @returns {Object<string, any> | null} The converted object.
1974 */
1975 function formDataToJSON(formData) {
1976 function buildPath(path, value, target, index) {
1977 var name = path[index++];
1978 if (name === '__proto__') return true;
1979 var isNumericKey = Number.isFinite(+name);
1980 var isLast = index >= path.length;
1981 name = !name && utils$1.isArray(target) ? target.length : name;
1982 if (isLast) {
1983 if (utils$1.hasOwnProp(target, name)) {
1984 target[name] = [target[name], value];
1985 } else {
1986 target[name] = value;
1987 }
1988 return !isNumericKey;
1989 }
1990 if (!target[name] || !utils$1.isObject(target[name])) {
1991 target[name] = [];
1992 }
1993 var result = buildPath(path, value, target[name], index);
1994 if (result && utils$1.isArray(target[name])) {
1995 target[name] = arrayToObject(target[name]);
1996 }
1997 return !isNumericKey;
1998 }
1999 if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {
2000 var obj = {};
2001 utils$1.forEachEntry(formData, function (name, value) {
2002 buildPath(parsePropPath(name), value, obj, 0);
2003 });
2004 return obj;
2005 }
2006 return null;
2007 }
2008
2009 /**
2010 * It takes a string, tries to parse it, and if it fails, it returns the stringified version
2011 * of the input
2012 *
2013 * @param {any} rawValue - The value to be stringified.
2014 * @param {Function} parser - A function that parses a string into a JavaScript object.
2015 * @param {Function} encoder - A function that takes a value and returns a string.
2016 *
2017 * @returns {string} A stringified version of the rawValue.
2018 */
2019 function stringifySafely(rawValue, parser, encoder) {
2020 if (utils$1.isString(rawValue)) {
2021 try {
2022 (parser || JSON.parse)(rawValue);
2023 return utils$1.trim(rawValue);
2024 } catch (e) {
2025 if (e.name !== 'SyntaxError') {
2026 throw e;
2027 }
2028 }
2029 }
2030 return (encoder || JSON.stringify)(rawValue);
2031 }
2032 var defaults = {
2033 transitional: transitionalDefaults,
2034 adapter: ['xhr', 'http', 'fetch'],
2035 transformRequest: [function transformRequest(data, headers) {
2036 var contentType = headers.getContentType() || '';
2037 var hasJSONContentType = contentType.indexOf('application/json') > -1;
2038 var isObjectPayload = utils$1.isObject(data);
2039 if (isObjectPayload && utils$1.isHTMLForm(data)) {
2040 data = new FormData(data);
2041 }
2042 var isFormData = utils$1.isFormData(data);
2043 if (isFormData) {
2044 return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
2045 }
2046 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)) {
2047 return data;
2048 }
2049 if (utils$1.isArrayBufferView(data)) {
2050 return data.buffer;
2051 }
2052 if (utils$1.isURLSearchParams(data)) {
2053 headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
2054 return data.toString();
2055 }
2056 var isFileList;
2057 if (isObjectPayload) {
2058 if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
2059 return toURLEncodedForm(data, this.formSerializer).toString();
2060 }
2061 if ((isFileList = utils$1.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
2062 var _FormData = this.env && this.env.FormData;
2063 return toFormData(isFileList ? {
2064 'files[]': data
2065 } : data, _FormData && new _FormData(), this.formSerializer);
2066 }
2067 }
2068 if (isObjectPayload || hasJSONContentType) {
2069 headers.setContentType('application/json', false);
2070 return stringifySafely(data);
2071 }
2072 return data;
2073 }],
2074 transformResponse: [function transformResponse(data) {
2075 var transitional = this.transitional || defaults.transitional;
2076 var forcedJSONParsing = transitional && transitional.forcedJSONParsing;
2077 var JSONRequested = this.responseType === 'json';
2078 if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
2079 return data;
2080 }
2081 if (data && utils$1.isString(data) && (forcedJSONParsing && !this.responseType || JSONRequested)) {
2082 var silentJSONParsing = transitional && transitional.silentJSONParsing;
2083 var strictJSONParsing = !silentJSONParsing && JSONRequested;
2084 try {
2085 return JSON.parse(data);
2086 } catch (e) {
2087 if (strictJSONParsing) {
2088 if (e.name === 'SyntaxError') {
2089 throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response);
2090 }
2091 throw e;
2092 }
2093 }
2094 }
2095 return data;
2096 }],
2097 /**
2098 * A timeout in milliseconds to abort a request. If set to 0 (default) a
2099 * timeout is not created.
2100 */
2101 timeout: 0,
2102 xsrfCookieName: 'XSRF-TOKEN',
2103 xsrfHeaderName: 'X-XSRF-TOKEN',
2104 maxContentLength: -1,
2105 maxBodyLength: -1,
2106 env: {
2107 FormData: platform.classes.FormData,
2108 Blob: platform.classes.Blob
2109 },
2110 validateStatus: function validateStatus(status) {
2111 return status >= 200 && status < 300;
2112 },
2113 headers: {
2114 common: {
2115 'Accept': 'application/json, text/plain, */*',
2116 'Content-Type': undefined
2117 }
2118 }
2119 };
2120 utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], function (method) {
2121 defaults.headers[method] = {};
2122 });
2123 var defaults$1 = defaults;
2124
2125 // RawAxiosHeaders whose duplicates are ignored by node
2126 // c.f. https://nodejs.org/api/http.html#http_message_headers
2127 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']);
2128
2129 /**
2130 * Parse headers into an object
2131 *
2132 * ```
2133 * Date: Wed, 27 Aug 2014 08:58:49 GMT
2134 * Content-Type: application/json
2135 * Connection: keep-alive
2136 * Transfer-Encoding: chunked
2137 * ```
2138 *
2139 * @param {String} rawHeaders Headers needing to be parsed
2140 *
2141 * @returns {Object} Headers parsed into an object
2142 */
2143 var parseHeaders = (function (rawHeaders) {
2144 var parsed = {};
2145 var key;
2146 var val;
2147 var i;
2148 rawHeaders && rawHeaders.split('\n').forEach(function parser(line) {
2149 i = line.indexOf(':');
2150 key = line.substring(0, i).trim().toLowerCase();
2151 val = line.substring(i + 1).trim();
2152 if (!key || parsed[key] && ignoreDuplicateOf[key]) {
2153 return;
2154 }
2155 if (key === 'set-cookie') {
2156 if (parsed[key]) {
2157 parsed[key].push(val);
2158 } else {
2159 parsed[key] = [val];
2160 }
2161 } else {
2162 parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
2163 }
2164 });
2165 return parsed;
2166 });
2167
2168 var $internals = Symbol('internals');
2169 function normalizeHeader(header) {
2170 return header && String(header).trim().toLowerCase();
2171 }
2172 function normalizeValue(value) {
2173 if (value === false || value == null) {
2174 return value;
2175 }
2176 return utils$1.isArray(value) ? value.map(normalizeValue) : String(value);
2177 }
2178 function parseTokens(str) {
2179 var tokens = Object.create(null);
2180 var tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
2181 var match;
2182 while (match = tokensRE.exec(str)) {
2183 tokens[match[1]] = match[2];
2184 }
2185 return tokens;
2186 }
2187 var isValidHeaderName = function isValidHeaderName(str) {
2188 return /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
2189 };
2190 function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
2191 if (utils$1.isFunction(filter)) {
2192 return filter.call(this, value, header);
2193 }
2194 if (isHeaderNameFilter) {
2195 value = header;
2196 }
2197 if (!utils$1.isString(value)) return;
2198 if (utils$1.isString(filter)) {
2199 return value.indexOf(filter) !== -1;
2200 }
2201 if (utils$1.isRegExp(filter)) {
2202 return filter.test(value);
2203 }
2204 }
2205 function formatHeader(header) {
2206 return header.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, function (w, _char, str) {
2207 return _char.toUpperCase() + str;
2208 });
2209 }
2210 function buildAccessors(obj, header) {
2211 var accessorName = utils$1.toCamelCase(' ' + header);
2212 ['get', 'set', 'has'].forEach(function (methodName) {
2213 Object.defineProperty(obj, methodName + accessorName, {
2214 value: function value(arg1, arg2, arg3) {
2215 return this[methodName].call(this, header, arg1, arg2, arg3);
2216 },
2217 configurable: true
2218 });
2219 });
2220 }
2221 var AxiosHeaders = /*#__PURE__*/function (_Symbol$iterator, _Symbol$toStringTag) {
2222 function AxiosHeaders(headers) {
2223 _classCallCheck(this, AxiosHeaders);
2224 headers && this.set(headers);
2225 }
2226 _createClass(AxiosHeaders, [{
2227 key: "set",
2228 value: function set(header, valueOrRewrite, rewrite) {
2229 var self = this;
2230 function setHeader(_value, _header, _rewrite) {
2231 var lHeader = normalizeHeader(_header);
2232 if (!lHeader) {
2233 throw new Error('header name must be a non-empty string');
2234 }
2235 var key = utils$1.findKey(self, lHeader);
2236 if (!key || self[key] === undefined || _rewrite === true || _rewrite === undefined && self[key] !== false) {
2237 self[key || _header] = normalizeValue(_value);
2238 }
2239 }
2240 var setHeaders = function setHeaders(headers, _rewrite) {
2241 return utils$1.forEach(headers, function (_value, _header) {
2242 return setHeader(_value, _header, _rewrite);
2243 });
2244 };
2245 if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
2246 setHeaders(header, valueOrRewrite);
2247 } else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
2248 setHeaders(parseHeaders(header), valueOrRewrite);
2249 } else if (utils$1.isHeaders(header)) {
2250 var _iterator = _createForOfIteratorHelper(header.entries()),
2251 _step;
2252 try {
2253 for (_iterator.s(); !(_step = _iterator.n()).done;) {
2254 var _step$value = _slicedToArray(_step.value, 2),
2255 key = _step$value[0],
2256 value = _step$value[1];
2257 setHeader(value, key, rewrite);
2258 }
2259 } catch (err) {
2260 _iterator.e(err);
2261 } finally {
2262 _iterator.f();
2263 }
2264 } else {
2265 header != null && setHeader(valueOrRewrite, header, rewrite);
2266 }
2267 return this;
2268 }
2269 }, {
2270 key: "get",
2271 value: function get(header, parser) {
2272 header = normalizeHeader(header);
2273 if (header) {
2274 var key = utils$1.findKey(this, header);
2275 if (key) {
2276 var value = this[key];
2277 if (!parser) {
2278 return value;
2279 }
2280 if (parser === true) {
2281 return parseTokens(value);
2282 }
2283 if (utils$1.isFunction(parser)) {
2284 return parser.call(this, value, key);
2285 }
2286 if (utils$1.isRegExp(parser)) {
2287 return parser.exec(value);
2288 }
2289 throw new TypeError('parser must be boolean|regexp|function');
2290 }
2291 }
2292 }
2293 }, {
2294 key: "has",
2295 value: function has(header, matcher) {
2296 header = normalizeHeader(header);
2297 if (header) {
2298 var key = utils$1.findKey(this, header);
2299 return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
2300 }
2301 return false;
2302 }
2303 }, {
2304 key: "delete",
2305 value: function _delete(header, matcher) {
2306 var self = this;
2307 var deleted = false;
2308 function deleteHeader(_header) {
2309 _header = normalizeHeader(_header);
2310 if (_header) {
2311 var key = utils$1.findKey(self, _header);
2312 if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
2313 delete self[key];
2314 deleted = true;
2315 }
2316 }
2317 }
2318 if (utils$1.isArray(header)) {
2319 header.forEach(deleteHeader);
2320 } else {
2321 deleteHeader(header);
2322 }
2323 return deleted;
2324 }
2325 }, {
2326 key: "clear",
2327 value: function clear(matcher) {
2328 var keys = Object.keys(this);
2329 var i = keys.length;
2330 var deleted = false;
2331 while (i--) {
2332 var key = keys[i];
2333 if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
2334 delete this[key];
2335 deleted = true;
2336 }
2337 }
2338 return deleted;
2339 }
2340 }, {
2341 key: "normalize",
2342 value: function normalize(format) {
2343 var self = this;
2344 var headers = {};
2345 utils$1.forEach(this, function (value, header) {
2346 var key = utils$1.findKey(headers, header);
2347 if (key) {
2348 self[key] = normalizeValue(value);
2349 delete self[header];
2350 return;
2351 }
2352 var normalized = format ? formatHeader(header) : String(header).trim();
2353 if (normalized !== header) {
2354 delete self[header];
2355 }
2356 self[normalized] = normalizeValue(value);
2357 headers[normalized] = true;
2358 });
2359 return this;
2360 }
2361 }, {
2362 key: "concat",
2363 value: function concat() {
2364 var _this$constructor;
2365 for (var _len = arguments.length, targets = new Array(_len), _key = 0; _key < _len; _key++) {
2366 targets[_key] = arguments[_key];
2367 }
2368 return (_this$constructor = this.constructor).concat.apply(_this$constructor, [this].concat(targets));
2369 }
2370 }, {
2371 key: "toJSON",
2372 value: function toJSON(asStrings) {
2373 var obj = Object.create(null);
2374 utils$1.forEach(this, function (value, header) {
2375 value != null && value !== false && (obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value);
2376 });
2377 return obj;
2378 }
2379 }, {
2380 key: _Symbol$iterator,
2381 value: function value() {
2382 return Object.entries(this.toJSON())[Symbol.iterator]();
2383 }
2384 }, {
2385 key: "toString",
2386 value: function toString() {
2387 return Object.entries(this.toJSON()).map(function (_ref) {
2388 var _ref2 = _slicedToArray(_ref, 2),
2389 header = _ref2[0],
2390 value = _ref2[1];
2391 return header + ': ' + value;
2392 }).join('\n');
2393 }
2394 }, {
2395 key: _Symbol$toStringTag,
2396 get: function get() {
2397 return 'AxiosHeaders';
2398 }
2399 }], [{
2400 key: "from",
2401 value: function from(thing) {
2402 return thing instanceof this ? thing : new this(thing);
2403 }
2404 }, {
2405 key: "concat",
2406 value: function concat(first) {
2407 var computed = new this(first);
2408 for (var _len2 = arguments.length, targets = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
2409 targets[_key2 - 1] = arguments[_key2];
2410 }
2411 targets.forEach(function (target) {
2412 return computed.set(target);
2413 });
2414 return computed;
2415 }
2416 }, {
2417 key: "accessor",
2418 value: function accessor(header) {
2419 var internals = this[$internals] = this[$internals] = {
2420 accessors: {}
2421 };
2422 var accessors = internals.accessors;
2423 var prototype = this.prototype;
2424 function defineAccessor(_header) {
2425 var lHeader = normalizeHeader(_header);
2426 if (!accessors[lHeader]) {
2427 buildAccessors(prototype, _header);
2428 accessors[lHeader] = true;
2429 }
2430 }
2431 utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
2432 return this;
2433 }
2434 }]);
2435 return AxiosHeaders;
2436 }(Symbol.iterator, Symbol.toStringTag);
2437 AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);
2438
2439 // reserved names hotfix
2440 utils$1.reduceDescriptors(AxiosHeaders.prototype, function (_ref3, key) {
2441 var value = _ref3.value;
2442 var mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
2443 return {
2444 get: function get() {
2445 return value;
2446 },
2447 set: function set(headerValue) {
2448 this[mapped] = headerValue;
2449 }
2450 };
2451 });
2452 utils$1.freezeMethods(AxiosHeaders);
2453 var AxiosHeaders$1 = AxiosHeaders;
2454
2455 /**
2456 * Transform the data for a request or a response
2457 *
2458 * @param {Array|Function} fns A single function or Array of functions
2459 * @param {?Object} response The response object
2460 *
2461 * @returns {*} The resulting transformed data
2462 */
2463 function transformData(fns, response) {
2464 var config = this || defaults$1;
2465 var context = response || config;
2466 var headers = AxiosHeaders$1.from(context.headers);
2467 var data = context.data;
2468 utils$1.forEach(fns, function transform(fn) {
2469 data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);
2470 });
2471 headers.normalize();
2472 return data;
2473 }
2474
2475 function isCancel(value) {
2476 return !!(value && value.__CANCEL__);
2477 }
2478
2479 /**
2480 * A `CanceledError` is an object that is thrown when an operation is canceled.
2481 *
2482 * @param {string=} message The message.
2483 * @param {Object=} config The config.
2484 * @param {Object=} request The request.
2485 *
2486 * @returns {CanceledError} The created error.
2487 */
2488 function CanceledError(message, config, request) {
2489 // eslint-disable-next-line no-eq-null,eqeqeq
2490 AxiosError.call(this, message == null ? 'canceled' : message, AxiosError.ERR_CANCELED, config, request);
2491 this.name = 'CanceledError';
2492 }
2493 utils$1.inherits(CanceledError, AxiosError, {
2494 __CANCEL__: true
2495 });
2496
2497 /**
2498 * Resolve or reject a Promise based on response status.
2499 *
2500 * @param {Function} resolve A function that resolves the promise.
2501 * @param {Function} reject A function that rejects the promise.
2502 * @param {object} response The response.
2503 *
2504 * @returns {object} The response.
2505 */
2506 function settle(resolve, reject, response) {
2507 var validateStatus = response.config.validateStatus;
2508 if (!response.status || !validateStatus || validateStatus(response.status)) {
2509 resolve(response);
2510 } else {
2511 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));
2512 }
2513 }
2514
2515 function parseProtocol(url) {
2516 var match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
2517 return match && match[1] || '';
2518 }
2519
2520 /**
2521 * Calculate data maxRate
2522 * @param {Number} [samplesCount= 10]
2523 * @param {Number} [min= 1000]
2524 * @returns {Function}
2525 */
2526 function speedometer(samplesCount, min) {
2527 samplesCount = samplesCount || 10;
2528 var bytes = new Array(samplesCount);
2529 var timestamps = new Array(samplesCount);
2530 var head = 0;
2531 var tail = 0;
2532 var firstSampleTS;
2533 min = min !== undefined ? min : 1000;
2534 return function push(chunkLength) {
2535 var now = Date.now();
2536 var startedAt = timestamps[tail];
2537 if (!firstSampleTS) {
2538 firstSampleTS = now;
2539 }
2540 bytes[head] = chunkLength;
2541 timestamps[head] = now;
2542 var i = tail;
2543 var bytesCount = 0;
2544 while (i !== head) {
2545 bytesCount += bytes[i++];
2546 i = i % samplesCount;
2547 }
2548 head = (head + 1) % samplesCount;
2549 if (head === tail) {
2550 tail = (tail + 1) % samplesCount;
2551 }
2552 if (now - firstSampleTS < min) {
2553 return;
2554 }
2555 var passed = startedAt && now - startedAt;
2556 return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
2557 };
2558 }
2559
2560 /**
2561 * Throttle decorator
2562 * @param {Function} fn
2563 * @param {Number} freq
2564 * @return {Function}
2565 */
2566 function throttle(fn, freq) {
2567 var timestamp = 0;
2568 var threshold = 1000 / freq;
2569 var lastArgs;
2570 var timer;
2571 var invoke = function invoke(args) {
2572 var now = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Date.now();
2573 timestamp = now;
2574 lastArgs = null;
2575 if (timer) {
2576 clearTimeout(timer);
2577 timer = null;
2578 }
2579 fn.apply(null, args);
2580 };
2581 var throttled = function throttled() {
2582 var now = Date.now();
2583 var passed = now - timestamp;
2584 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
2585 args[_key] = arguments[_key];
2586 }
2587 if (passed >= threshold) {
2588 invoke(args, now);
2589 } else {
2590 lastArgs = args;
2591 if (!timer) {
2592 timer = setTimeout(function () {
2593 timer = null;
2594 invoke(lastArgs);
2595 }, threshold - passed);
2596 }
2597 }
2598 };
2599 var flush = function flush() {
2600 return lastArgs && invoke(lastArgs);
2601 };
2602 return [throttled, flush];
2603 }
2604
2605 var progressEventReducer = function progressEventReducer(listener, isDownloadStream) {
2606 var freq = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 3;
2607 var bytesNotified = 0;
2608 var _speedometer = speedometer(50, 250);
2609 return throttle(function (e) {
2610 var loaded = e.loaded;
2611 var total = e.lengthComputable ? e.total : undefined;
2612 var progressBytes = loaded - bytesNotified;
2613 var rate = _speedometer(progressBytes);
2614 var inRange = loaded <= total;
2615 bytesNotified = loaded;
2616 var data = _defineProperty({
2617 loaded: loaded,
2618 total: total,
2619 progress: total ? loaded / total : undefined,
2620 bytes: progressBytes,
2621 rate: rate ? rate : undefined,
2622 estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
2623 event: e,
2624 lengthComputable: total != null
2625 }, isDownloadStream ? 'download' : 'upload', true);
2626 listener(data);
2627 }, freq);
2628 };
2629 var progressEventDecorator = function progressEventDecorator(total, throttled) {
2630 var lengthComputable = total != null;
2631 return [function (loaded) {
2632 return throttled[0]({
2633 lengthComputable: lengthComputable,
2634 total: total,
2635 loaded: loaded
2636 });
2637 }, throttled[1]];
2638 };
2639 var asyncDecorator = function asyncDecorator(fn) {
2640 return function () {
2641 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
2642 args[_key] = arguments[_key];
2643 }
2644 return utils$1.asap(function () {
2645 return fn.apply(void 0, args);
2646 });
2647 };
2648 };
2649
2650 var isURLSameOrigin = platform.hasStandardBrowserEnv ? function (origin, isMSIE) {
2651 return function (url) {
2652 url = new URL(url, platform.origin);
2653 return origin.protocol === url.protocol && origin.host === url.host && (isMSIE || origin.port === url.port);
2654 };
2655 }(new URL(platform.origin), platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)) : function () {
2656 return true;
2657 };
2658
2659 var cookies = platform.hasStandardBrowserEnv ?
2660 // Standard browser envs support document.cookie
2661 {
2662 write: function write(name, value, expires, path, domain, secure) {
2663 var cookie = [name + '=' + encodeURIComponent(value)];
2664 utils$1.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString());
2665 utils$1.isString(path) && cookie.push('path=' + path);
2666 utils$1.isString(domain) && cookie.push('domain=' + domain);
2667 secure === true && cookie.push('secure');
2668 document.cookie = cookie.join('; ');
2669 },
2670 read: function read(name) {
2671 var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
2672 return match ? decodeURIComponent(match[3]) : null;
2673 },
2674 remove: function remove(name) {
2675 this.write(name, '', Date.now() - 86400000);
2676 }
2677 } :
2678 // Non-standard browser env (web workers, react-native) lack needed support.
2679 {
2680 write: function write() {},
2681 read: function read() {
2682 return null;
2683 },
2684 remove: function remove() {}
2685 };
2686
2687 /**
2688 * Determines whether the specified URL is absolute
2689 *
2690 * @param {string} url The URL to test
2691 *
2692 * @returns {boolean} True if the specified URL is absolute, otherwise false
2693 */
2694 function isAbsoluteURL(url) {
2695 // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
2696 // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
2697 // by any combination of letters, digits, plus, period, or hyphen.
2698 return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
2699 }
2700
2701 /**
2702 * Creates a new URL by combining the specified URLs
2703 *
2704 * @param {string} baseURL The base URL
2705 * @param {string} relativeURL The relative URL
2706 *
2707 * @returns {string} The combined URL
2708 */
2709 function combineURLs(baseURL, relativeURL) {
2710 return relativeURL ? baseURL.replace(/\/?\/$/, '') + '/' + relativeURL.replace(/^\/+/, '') : baseURL;
2711 }
2712
2713 /**
2714 * Creates a new URL by combining the baseURL with the requestedURL,
2715 * only when the requestedURL is not already an absolute URL.
2716 * If the requestURL is absolute, this function returns the requestedURL untouched.
2717 *
2718 * @param {string} baseURL The base URL
2719 * @param {string} requestedURL Absolute or relative URL to combine
2720 *
2721 * @returns {string} The combined full path
2722 */
2723 function buildFullPath(baseURL, requestedURL) {
2724 if (baseURL && !isAbsoluteURL(requestedURL)) {
2725 return combineURLs(baseURL, requestedURL);
2726 }
2727 return requestedURL;
2728 }
2729
2730 var headersToObject = function headersToObject(thing) {
2731 return thing instanceof AxiosHeaders$1 ? _objectSpread2({}, thing) : thing;
2732 };
2733
2734 /**
2735 * Config-specific merge-function which creates a new config-object
2736 * by merging two configuration objects together.
2737 *
2738 * @param {Object} config1
2739 * @param {Object} config2
2740 *
2741 * @returns {Object} New object resulting from merging config2 to config1
2742 */
2743 function mergeConfig(config1, config2) {
2744 // eslint-disable-next-line no-param-reassign
2745 config2 = config2 || {};
2746 var config = {};
2747 function getMergedValue(target, source, prop, caseless) {
2748 if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
2749 return utils$1.merge.call({
2750 caseless: caseless
2751 }, target, source);
2752 } else if (utils$1.isPlainObject(source)) {
2753 return utils$1.merge({}, source);
2754 } else if (utils$1.isArray(source)) {
2755 return source.slice();
2756 }
2757 return source;
2758 }
2759
2760 // eslint-disable-next-line consistent-return
2761 function mergeDeepProperties(a, b, prop, caseless) {
2762 if (!utils$1.isUndefined(b)) {
2763 return getMergedValue(a, b, prop, caseless);
2764 } else if (!utils$1.isUndefined(a)) {
2765 return getMergedValue(undefined, a, prop, caseless);
2766 }
2767 }
2768
2769 // eslint-disable-next-line consistent-return
2770 function valueFromConfig2(a, b) {
2771 if (!utils$1.isUndefined(b)) {
2772 return getMergedValue(undefined, b);
2773 }
2774 }
2775
2776 // eslint-disable-next-line consistent-return
2777 function defaultToConfig2(a, b) {
2778 if (!utils$1.isUndefined(b)) {
2779 return getMergedValue(undefined, b);
2780 } else if (!utils$1.isUndefined(a)) {
2781 return getMergedValue(undefined, a);
2782 }
2783 }
2784
2785 // eslint-disable-next-line consistent-return
2786 function mergeDirectKeys(a, b, prop) {
2787 if (prop in config2) {
2788 return getMergedValue(a, b);
2789 } else if (prop in config1) {
2790 return getMergedValue(undefined, a);
2791 }
2792 }
2793 var mergeMap = {
2794 url: valueFromConfig2,
2795 method: valueFromConfig2,
2796 data: valueFromConfig2,
2797 baseURL: defaultToConfig2,
2798 transformRequest: defaultToConfig2,
2799 transformResponse: defaultToConfig2,
2800 paramsSerializer: defaultToConfig2,
2801 timeout: defaultToConfig2,
2802 timeoutMessage: defaultToConfig2,
2803 withCredentials: defaultToConfig2,
2804 withXSRFToken: defaultToConfig2,
2805 adapter: defaultToConfig2,
2806 responseType: defaultToConfig2,
2807 xsrfCookieName: defaultToConfig2,
2808 xsrfHeaderName: defaultToConfig2,
2809 onUploadProgress: defaultToConfig2,
2810 onDownloadProgress: defaultToConfig2,
2811 decompress: defaultToConfig2,
2812 maxContentLength: defaultToConfig2,
2813 maxBodyLength: defaultToConfig2,
2814 beforeRedirect: defaultToConfig2,
2815 transport: defaultToConfig2,
2816 httpAgent: defaultToConfig2,
2817 httpsAgent: defaultToConfig2,
2818 cancelToken: defaultToConfig2,
2819 socketPath: defaultToConfig2,
2820 responseEncoding: defaultToConfig2,
2821 validateStatus: mergeDirectKeys,
2822 headers: function headers(a, b, prop) {
2823 return mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true);
2824 }
2825 };
2826 utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
2827 var merge = mergeMap[prop] || mergeDeepProperties;
2828 var configValue = merge(config1[prop], config2[prop], prop);
2829 utils$1.isUndefined(configValue) && merge !== mergeDirectKeys || (config[prop] = configValue);
2830 });
2831 return config;
2832 }
2833
2834 var resolveConfig = (function (config) {
2835 var newConfig = mergeConfig({}, config);
2836 var data = newConfig.data,
2837 withXSRFToken = newConfig.withXSRFToken,
2838 xsrfHeaderName = newConfig.xsrfHeaderName,
2839 xsrfCookieName = newConfig.xsrfCookieName,
2840 headers = newConfig.headers,
2841 auth = newConfig.auth;
2842 newConfig.headers = headers = AxiosHeaders$1.from(headers);
2843 newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url), config.params, config.paramsSerializer);
2844
2845 // HTTP basic authentication
2846 if (auth) {
2847 headers.set('Authorization', 'Basic ' + btoa((auth.username || '') + ':' + (auth.password ? unescape(encodeURIComponent(auth.password)) : '')));
2848 }
2849 var contentType;
2850 if (utils$1.isFormData(data)) {
2851 if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
2852 headers.setContentType(undefined); // Let the browser set it
2853 } else if ((contentType = headers.getContentType()) !== false) {
2854 // fix semicolon duplication issue for ReactNative FormData implementation
2855 var _ref = contentType ? contentType.split(';').map(function (token) {
2856 return token.trim();
2857 }).filter(Boolean) : [],
2858 _ref2 = _toArray(_ref),
2859 type = _ref2[0],
2860 tokens = _ref2.slice(1);
2861 headers.setContentType([type || 'multipart/form-data'].concat(_toConsumableArray(tokens)).join('; '));
2862 }
2863 }
2864
2865 // Add xsrf header
2866 // This is only done if running in a standard browser environment.
2867 // Specifically not if we're in a web worker, or react-native.
2868
2869 if (platform.hasStandardBrowserEnv) {
2870 withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
2871 if (withXSRFToken || withXSRFToken !== false && isURLSameOrigin(newConfig.url)) {
2872 // Add xsrf header
2873 var xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
2874 if (xsrfValue) {
2875 headers.set(xsrfHeaderName, xsrfValue);
2876 }
2877 }
2878 }
2879 return newConfig;
2880 });
2881
2882 var isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
2883 var xhrAdapter = isXHRAdapterSupported && function (config) {
2884 return new Promise(function dispatchXhrRequest(resolve, reject) {
2885 var _config = resolveConfig(config);
2886 var requestData = _config.data;
2887 var requestHeaders = AxiosHeaders$1.from(_config.headers).normalize();
2888 var responseType = _config.responseType,
2889 onUploadProgress = _config.onUploadProgress,
2890 onDownloadProgress = _config.onDownloadProgress;
2891 var onCanceled;
2892 var uploadThrottled, downloadThrottled;
2893 var flushUpload, flushDownload;
2894 function done() {
2895 flushUpload && flushUpload(); // flush events
2896 flushDownload && flushDownload(); // flush events
2897
2898 _config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
2899 _config.signal && _config.signal.removeEventListener('abort', onCanceled);
2900 }
2901 var request = new XMLHttpRequest();
2902 request.open(_config.method.toUpperCase(), _config.url, true);
2903
2904 // Set the request timeout in MS
2905 request.timeout = _config.timeout;
2906 function onloadend() {
2907 if (!request) {
2908 return;
2909 }
2910 // Prepare the response
2911 var responseHeaders = AxiosHeaders$1.from('getAllResponseHeaders' in request && request.getAllResponseHeaders());
2912 var responseData = !responseType || responseType === 'text' || responseType === 'json' ? request.responseText : request.response;
2913 var response = {
2914 data: responseData,
2915 status: request.status,
2916 statusText: request.statusText,
2917 headers: responseHeaders,
2918 config: config,
2919 request: request
2920 };
2921 settle(function _resolve(value) {
2922 resolve(value);
2923 done();
2924 }, function _reject(err) {
2925 reject(err);
2926 done();
2927 }, response);
2928
2929 // Clean up request
2930 request = null;
2931 }
2932 if ('onloadend' in request) {
2933 // Use onloadend if available
2934 request.onloadend = onloadend;
2935 } else {
2936 // Listen for ready state to emulate onloadend
2937 request.onreadystatechange = function handleLoad() {
2938 if (!request || request.readyState !== 4) {
2939 return;
2940 }
2941
2942 // The request errored out and we didn't get a response, this will be
2943 // handled by onerror instead
2944 // With one exception: request that using file: protocol, most browsers
2945 // will return status as 0 even though it's a successful request
2946 if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
2947 return;
2948 }
2949 // readystate handler is calling before onerror or ontimeout handlers,
2950 // so we should call onloadend on the next 'tick'
2951 setTimeout(onloadend);
2952 };
2953 }
2954
2955 // Handle browser request cancellation (as opposed to a manual cancellation)
2956 request.onabort = function handleAbort() {
2957 if (!request) {
2958 return;
2959 }
2960 reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, config, request));
2961
2962 // Clean up request
2963 request = null;
2964 };
2965
2966 // Handle low level network errors
2967 request.onerror = function handleError() {
2968 // Real errors are hidden from us by the browser
2969 // onerror should only fire if it's a network error
2970 reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request));
2971
2972 // Clean up request
2973 request = null;
2974 };
2975
2976 // Handle timeout
2977 request.ontimeout = function handleTimeout() {
2978 var timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded';
2979 var transitional = _config.transitional || transitionalDefaults;
2980 if (_config.timeoutErrorMessage) {
2981 timeoutErrorMessage = _config.timeoutErrorMessage;
2982 }
2983 reject(new AxiosError(timeoutErrorMessage, transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED, config, request));
2984
2985 // Clean up request
2986 request = null;
2987 };
2988
2989 // Remove Content-Type if data is undefined
2990 requestData === undefined && requestHeaders.setContentType(null);
2991
2992 // Add headers to the request
2993 if ('setRequestHeader' in request) {
2994 utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
2995 request.setRequestHeader(key, val);
2996 });
2997 }
2998
2999 // Add withCredentials to request if needed
3000 if (!utils$1.isUndefined(_config.withCredentials)) {
3001 request.withCredentials = !!_config.withCredentials;
3002 }
3003
3004 // Add responseType to request if needed
3005 if (responseType && responseType !== 'json') {
3006 request.responseType = _config.responseType;
3007 }
3008
3009 // Handle progress if needed
3010 if (onDownloadProgress) {
3011 var _progressEventReducer = progressEventReducer(onDownloadProgress, true);
3012 var _progressEventReducer2 = _slicedToArray(_progressEventReducer, 2);
3013 downloadThrottled = _progressEventReducer2[0];
3014 flushDownload = _progressEventReducer2[1];
3015 request.addEventListener('progress', downloadThrottled);
3016 }
3017
3018 // Not all browsers support upload events
3019 if (onUploadProgress && request.upload) {
3020 var _progressEventReducer3 = progressEventReducer(onUploadProgress);
3021 var _progressEventReducer4 = _slicedToArray(_progressEventReducer3, 2);
3022 uploadThrottled = _progressEventReducer4[0];
3023 flushUpload = _progressEventReducer4[1];
3024 request.upload.addEventListener('progress', uploadThrottled);
3025 request.upload.addEventListener('loadend', flushUpload);
3026 }
3027 if (_config.cancelToken || _config.signal) {
3028 // Handle cancellation
3029 // eslint-disable-next-line func-names
3030 onCanceled = function onCanceled(cancel) {
3031 if (!request) {
3032 return;
3033 }
3034 reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);
3035 request.abort();
3036 request = null;
3037 };
3038 _config.cancelToken && _config.cancelToken.subscribe(onCanceled);
3039 if (_config.signal) {
3040 _config.signal.aborted ? onCanceled() : _config.signal.addEventListener('abort', onCanceled);
3041 }
3042 }
3043 var protocol = parseProtocol(_config.url);
3044 if (protocol && platform.protocols.indexOf(protocol) === -1) {
3045 reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));
3046 return;
3047 }
3048
3049 // Send the request
3050 request.send(requestData || null);
3051 });
3052 };
3053
3054 var composeSignals = function composeSignals(signals, timeout) {
3055 var _signals = signals = signals ? signals.filter(Boolean) : [],
3056 length = _signals.length;
3057 if (timeout || length) {
3058 var controller = new AbortController();
3059 var aborted;
3060 var onabort = function onabort(reason) {
3061 if (!aborted) {
3062 aborted = true;
3063 unsubscribe();
3064 var err = reason instanceof Error ? reason : this.reason;
3065 controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err));
3066 }
3067 };
3068 var timer = timeout && setTimeout(function () {
3069 timer = null;
3070 onabort(new AxiosError("timeout ".concat(timeout, " of ms exceeded"), AxiosError.ETIMEDOUT));
3071 }, timeout);
3072 var unsubscribe = function unsubscribe() {
3073 if (signals) {
3074 timer && clearTimeout(timer);
3075 timer = null;
3076 signals.forEach(function (signal) {
3077 signal.unsubscribe ? signal.unsubscribe(onabort) : signal.removeEventListener('abort', onabort);
3078 });
3079 signals = null;
3080 }
3081 };
3082 signals.forEach(function (signal) {
3083 return signal.addEventListener('abort', onabort);
3084 });
3085 var signal = controller.signal;
3086 signal.unsubscribe = function () {
3087 return utils$1.asap(unsubscribe);
3088 };
3089 return signal;
3090 }
3091 };
3092 var composeSignals$1 = composeSignals;
3093
3094 var streamChunk = /*#__PURE__*/_regeneratorRuntime().mark(function streamChunk(chunk, chunkSize) {
3095 var len, pos, end;
3096 return _regeneratorRuntime().wrap(function streamChunk$(_context) {
3097 while (1) switch (_context.prev = _context.next) {
3098 case 0:
3099 len = chunk.byteLength;
3100 if (!(!chunkSize || len < chunkSize)) {
3101 _context.next = 5;
3102 break;
3103 }
3104 _context.next = 4;
3105 return chunk;
3106 case 4:
3107 return _context.abrupt("return");
3108 case 5:
3109 pos = 0;
3110 case 6:
3111 if (!(pos < len)) {
3112 _context.next = 13;
3113 break;
3114 }
3115 end = pos + chunkSize;
3116 _context.next = 10;
3117 return chunk.slice(pos, end);
3118 case 10:
3119 pos = end;
3120 _context.next = 6;
3121 break;
3122 case 13:
3123 case "end":
3124 return _context.stop();
3125 }
3126 }, streamChunk);
3127 });
3128 var readBytes = /*#__PURE__*/function () {
3129 var _ref = _wrapAsyncGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(iterable, chunkSize) {
3130 var _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, chunk;
3131 return _regeneratorRuntime().wrap(function _callee$(_context2) {
3132 while (1) switch (_context2.prev = _context2.next) {
3133 case 0:
3134 _iteratorAbruptCompletion = false;
3135 _didIteratorError = false;
3136 _context2.prev = 2;
3137 _iterator = _asyncIterator(readStream(iterable));
3138 case 4:
3139 _context2.next = 6;
3140 return _awaitAsyncGenerator(_iterator.next());
3141 case 6:
3142 if (!(_iteratorAbruptCompletion = !(_step = _context2.sent).done)) {
3143 _context2.next = 12;
3144 break;
3145 }
3146 chunk = _step.value;
3147 return _context2.delegateYield(_asyncGeneratorDelegate(_asyncIterator(streamChunk(chunk, chunkSize))), "t0", 9);
3148 case 9:
3149 _iteratorAbruptCompletion = false;
3150 _context2.next = 4;
3151 break;
3152 case 12:
3153 _context2.next = 18;
3154 break;
3155 case 14:
3156 _context2.prev = 14;
3157 _context2.t1 = _context2["catch"](2);
3158 _didIteratorError = true;
3159 _iteratorError = _context2.t1;
3160 case 18:
3161 _context2.prev = 18;
3162 _context2.prev = 19;
3163 if (!(_iteratorAbruptCompletion && _iterator["return"] != null)) {
3164 _context2.next = 23;
3165 break;
3166 }
3167 _context2.next = 23;
3168 return _awaitAsyncGenerator(_iterator["return"]());
3169 case 23:
3170 _context2.prev = 23;
3171 if (!_didIteratorError) {
3172 _context2.next = 26;
3173 break;
3174 }
3175 throw _iteratorError;
3176 case 26:
3177 return _context2.finish(23);
3178 case 27:
3179 return _context2.finish(18);
3180 case 28:
3181 case "end":
3182 return _context2.stop();
3183 }
3184 }, _callee, null, [[2, 14, 18, 28], [19,, 23, 27]]);
3185 }));
3186 return function readBytes(_x, _x2) {
3187 return _ref.apply(this, arguments);
3188 };
3189 }();
3190 var readStream = /*#__PURE__*/function () {
3191 var _ref2 = _wrapAsyncGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(stream) {
3192 var reader, _yield$_awaitAsyncGen, done, value;
3193 return _regeneratorRuntime().wrap(function _callee2$(_context3) {
3194 while (1) switch (_context3.prev = _context3.next) {
3195 case 0:
3196 if (!stream[Symbol.asyncIterator]) {
3197 _context3.next = 3;
3198 break;
3199 }
3200 return _context3.delegateYield(_asyncGeneratorDelegate(_asyncIterator(stream)), "t0", 2);
3201 case 2:
3202 return _context3.abrupt("return");
3203 case 3:
3204 reader = stream.getReader();
3205 _context3.prev = 4;
3206 case 5:
3207 _context3.next = 7;
3208 return _awaitAsyncGenerator(reader.read());
3209 case 7:
3210 _yield$_awaitAsyncGen = _context3.sent;
3211 done = _yield$_awaitAsyncGen.done;
3212 value = _yield$_awaitAsyncGen.value;
3213 if (!done) {
3214 _context3.next = 12;
3215 break;
3216 }
3217 return _context3.abrupt("break", 16);
3218 case 12:
3219 _context3.next = 14;
3220 return value;
3221 case 14:
3222 _context3.next = 5;
3223 break;
3224 case 16:
3225 _context3.prev = 16;
3226 _context3.next = 19;
3227 return _awaitAsyncGenerator(reader.cancel());
3228 case 19:
3229 return _context3.finish(16);
3230 case 20:
3231 case "end":
3232 return _context3.stop();
3233 }
3234 }, _callee2, null, [[4,, 16, 20]]);
3235 }));
3236 return function readStream(_x3) {
3237 return _ref2.apply(this, arguments);
3238 };
3239 }();
3240 var trackStream = function trackStream(stream, chunkSize, onProgress, onFinish) {
3241 var iterator = readBytes(stream, chunkSize);
3242 var bytes = 0;
3243 var done;
3244 var _onFinish = function _onFinish(e) {
3245 if (!done) {
3246 done = true;
3247 onFinish && onFinish(e);
3248 }
3249 };
3250 return new ReadableStream({
3251 pull: function pull(controller) {
3252 return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
3253 var _yield$iterator$next, _done, value, len, loadedBytes;
3254 return _regeneratorRuntime().wrap(function _callee3$(_context4) {
3255 while (1) switch (_context4.prev = _context4.next) {
3256 case 0:
3257 _context4.prev = 0;
3258 _context4.next = 3;
3259 return iterator.next();
3260 case 3:
3261 _yield$iterator$next = _context4.sent;
3262 _done = _yield$iterator$next.done;
3263 value = _yield$iterator$next.value;
3264 if (!_done) {
3265 _context4.next = 10;
3266 break;
3267 }
3268 _onFinish();
3269 controller.close();
3270 return _context4.abrupt("return");
3271 case 10:
3272 len = value.byteLength;
3273 if (onProgress) {
3274 loadedBytes = bytes += len;
3275 onProgress(loadedBytes);
3276 }
3277 controller.enqueue(new Uint8Array(value));
3278 _context4.next = 19;
3279 break;
3280 case 15:
3281 _context4.prev = 15;
3282 _context4.t0 = _context4["catch"](0);
3283 _onFinish(_context4.t0);
3284 throw _context4.t0;
3285 case 19:
3286 case "end":
3287 return _context4.stop();
3288 }
3289 }, _callee3, null, [[0, 15]]);
3290 }))();
3291 },
3292 cancel: function cancel(reason) {
3293 _onFinish(reason);
3294 return iterator["return"]();
3295 }
3296 }, {
3297 highWaterMark: 2
3298 });
3299 };
3300
3301 var isFetchSupported = typeof fetch === 'function' && typeof Request === 'function' && typeof Response === 'function';
3302 var isReadableStreamSupported = isFetchSupported && typeof ReadableStream === 'function';
3303
3304 // used only inside the fetch adapter
3305 var encodeText = isFetchSupported && (typeof TextEncoder === 'function' ? function (encoder) {
3306 return function (str) {
3307 return encoder.encode(str);
3308 };
3309 }(new TextEncoder()) : ( /*#__PURE__*/function () {
3310 var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(str) {
3311 return _regeneratorRuntime().wrap(function _callee$(_context) {
3312 while (1) switch (_context.prev = _context.next) {
3313 case 0:
3314 _context.t0 = Uint8Array;
3315 _context.next = 3;
3316 return new Response(str).arrayBuffer();
3317 case 3:
3318 _context.t1 = _context.sent;
3319 return _context.abrupt("return", new _context.t0(_context.t1));
3320 case 5:
3321 case "end":
3322 return _context.stop();
3323 }
3324 }, _callee);
3325 }));
3326 return function (_x) {
3327 return _ref.apply(this, arguments);
3328 };
3329 }()));
3330 var test = function test(fn) {
3331 try {
3332 for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
3333 args[_key - 1] = arguments[_key];
3334 }
3335 return !!fn.apply(void 0, args);
3336 } catch (e) {
3337 return false;
3338 }
3339 };
3340 var supportsRequestStream = isReadableStreamSupported && test(function () {
3341 var duplexAccessed = false;
3342 var hasContentType = new Request(platform.origin, {
3343 body: new ReadableStream(),
3344 method: 'POST',
3345 get duplex() {
3346 duplexAccessed = true;
3347 return 'half';
3348 }
3349 }).headers.has('Content-Type');
3350 return duplexAccessed && !hasContentType;
3351 });
3352 var DEFAULT_CHUNK_SIZE = 64 * 1024;
3353 var supportsResponseStream = isReadableStreamSupported && test(function () {
3354 return utils$1.isReadableStream(new Response('').body);
3355 });
3356 var resolvers = {
3357 stream: supportsResponseStream && function (res) {
3358 return res.body;
3359 }
3360 };
3361 isFetchSupported && function (res) {
3362 ['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(function (type) {
3363 !resolvers[type] && (resolvers[type] = utils$1.isFunction(res[type]) ? function (res) {
3364 return res[type]();
3365 } : function (_, config) {
3366 throw new AxiosError("Response type '".concat(type, "' is not supported"), AxiosError.ERR_NOT_SUPPORT, config);
3367 });
3368 });
3369 }(new Response());
3370 var getBodyLength = /*#__PURE__*/function () {
3371 var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(body) {
3372 var _request;
3373 return _regeneratorRuntime().wrap(function _callee2$(_context2) {
3374 while (1) switch (_context2.prev = _context2.next) {
3375 case 0:
3376 if (!(body == null)) {
3377 _context2.next = 2;
3378 break;
3379 }
3380 return _context2.abrupt("return", 0);
3381 case 2:
3382 if (!utils$1.isBlob(body)) {
3383 _context2.next = 4;
3384 break;
3385 }
3386 return _context2.abrupt("return", body.size);
3387 case 4:
3388 if (!utils$1.isSpecCompliantForm(body)) {
3389 _context2.next = 9;
3390 break;
3391 }
3392 _request = new Request(platform.origin, {
3393 method: 'POST',
3394 body: body
3395 });
3396 _context2.next = 8;
3397 return _request.arrayBuffer();
3398 case 8:
3399 return _context2.abrupt("return", _context2.sent.byteLength);
3400 case 9:
3401 if (!(utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body))) {
3402 _context2.next = 11;
3403 break;
3404 }
3405 return _context2.abrupt("return", body.byteLength);
3406 case 11:
3407 if (utils$1.isURLSearchParams(body)) {
3408 body = body + '';
3409 }
3410 if (!utils$1.isString(body)) {
3411 _context2.next = 16;
3412 break;
3413 }
3414 _context2.next = 15;
3415 return encodeText(body);
3416 case 15:
3417 return _context2.abrupt("return", _context2.sent.byteLength);
3418 case 16:
3419 case "end":
3420 return _context2.stop();
3421 }
3422 }, _callee2);
3423 }));
3424 return function getBodyLength(_x2) {
3425 return _ref2.apply(this, arguments);
3426 };
3427 }();
3428 var resolveBodyLength = /*#__PURE__*/function () {
3429 var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(headers, body) {
3430 var length;
3431 return _regeneratorRuntime().wrap(function _callee3$(_context3) {
3432 while (1) switch (_context3.prev = _context3.next) {
3433 case 0:
3434 length = utils$1.toFiniteNumber(headers.getContentLength());
3435 return _context3.abrupt("return", length == null ? getBodyLength(body) : length);
3436 case 2:
3437 case "end":
3438 return _context3.stop();
3439 }
3440 }, _callee3);
3441 }));
3442 return function resolveBodyLength(_x3, _x4) {
3443 return _ref3.apply(this, arguments);
3444 };
3445 }();
3446 var fetchAdapter = isFetchSupported && ( /*#__PURE__*/function () {
3447 var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(config) {
3448 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;
3449 return _regeneratorRuntime().wrap(function _callee4$(_context4) {
3450 while (1) switch (_context4.prev = _context4.next) {
3451 case 0:
3452 _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;
3453 responseType = responseType ? (responseType + '').toLowerCase() : 'text';
3454 composedSignal = composeSignals$1([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
3455 unsubscribe = composedSignal && composedSignal.unsubscribe && function () {
3456 composedSignal.unsubscribe();
3457 };
3458 _context4.prev = 4;
3459 _context4.t0 = onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head';
3460 if (!_context4.t0) {
3461 _context4.next = 11;
3462 break;
3463 }
3464 _context4.next = 9;
3465 return resolveBodyLength(headers, data);
3466 case 9:
3467 _context4.t1 = requestContentLength = _context4.sent;
3468 _context4.t0 = _context4.t1 !== 0;
3469 case 11:
3470 if (!_context4.t0) {
3471 _context4.next = 15;
3472 break;
3473 }
3474 _request = new Request(url, {
3475 method: 'POST',
3476 body: data,
3477 duplex: "half"
3478 });
3479 if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
3480 headers.setContentType(contentTypeHeader);
3481 }
3482 if (_request.body) {
3483 _progressEventDecorat = progressEventDecorator(requestContentLength, progressEventReducer(asyncDecorator(onUploadProgress))), _progressEventDecorat2 = _slicedToArray(_progressEventDecorat, 2), onProgress = _progressEventDecorat2[0], flush = _progressEventDecorat2[1];
3484 data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
3485 }
3486 case 15:
3487 if (!utils$1.isString(withCredentials)) {
3488 withCredentials = withCredentials ? 'include' : 'omit';
3489 }
3490
3491 // Cloudflare Workers throws when credentials are defined
3492 // see https://github.com/cloudflare/workerd/issues/902
3493 isCredentialsSupported = "credentials" in Request.prototype;
3494 request = new Request(url, _objectSpread2(_objectSpread2({}, fetchOptions), {}, {
3495 signal: composedSignal,
3496 method: method.toUpperCase(),
3497 headers: headers.normalize().toJSON(),
3498 body: data,
3499 duplex: "half",
3500 credentials: isCredentialsSupported ? withCredentials : undefined
3501 }));
3502 _context4.next = 20;
3503 return fetch(request);
3504 case 20:
3505 response = _context4.sent;
3506 isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
3507 if (supportsResponseStream && (onDownloadProgress || isStreamResponse && unsubscribe)) {
3508 options = {};
3509 ['status', 'statusText', 'headers'].forEach(function (prop) {
3510 options[prop] = response[prop];
3511 });
3512 responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
3513 _ref5 = onDownloadProgress && progressEventDecorator(responseContentLength, progressEventReducer(asyncDecorator(onDownloadProgress), true)) || [], _ref6 = _slicedToArray(_ref5, 2), _onProgress = _ref6[0], _flush = _ref6[1];
3514 response = new Response(trackStream(response.body, DEFAULT_CHUNK_SIZE, _onProgress, function () {
3515 _flush && _flush();
3516 unsubscribe && unsubscribe();
3517 }), options);
3518 }
3519 responseType = responseType || 'text';
3520 _context4.next = 26;
3521 return resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config);
3522 case 26:
3523 responseData = _context4.sent;
3524 !isStreamResponse && unsubscribe && unsubscribe();
3525 _context4.next = 30;
3526 return new Promise(function (resolve, reject) {
3527 settle(resolve, reject, {
3528 data: responseData,
3529 headers: AxiosHeaders$1.from(response.headers),
3530 status: response.status,
3531 statusText: response.statusText,
3532 config: config,
3533 request: request
3534 });
3535 });
3536 case 30:
3537 return _context4.abrupt("return", _context4.sent);
3538 case 33:
3539 _context4.prev = 33;
3540 _context4.t2 = _context4["catch"](4);
3541 unsubscribe && unsubscribe();
3542 if (!(_context4.t2 && _context4.t2.name === 'TypeError' && /fetch/i.test(_context4.t2.message))) {
3543 _context4.next = 38;
3544 break;
3545 }
3546 throw Object.assign(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request), {
3547 cause: _context4.t2.cause || _context4.t2
3548 });
3549 case 38:
3550 throw AxiosError.from(_context4.t2, _context4.t2 && _context4.t2.code, config, request);
3551 case 39:
3552 case "end":
3553 return _context4.stop();
3554 }
3555 }, _callee4, null, [[4, 33]]);
3556 }));
3557 return function (_x5) {
3558 return _ref4.apply(this, arguments);
3559 };
3560 }());
3561
3562 var knownAdapters = {
3563 http: httpAdapter,
3564 xhr: xhrAdapter,
3565 fetch: fetchAdapter
3566 };
3567 utils$1.forEach(knownAdapters, function (fn, value) {
3568 if (fn) {
3569 try {
3570 Object.defineProperty(fn, 'name', {
3571 value: value
3572 });
3573 } catch (e) {
3574 // eslint-disable-next-line no-empty
3575 }
3576 Object.defineProperty(fn, 'adapterName', {
3577 value: value
3578 });
3579 }
3580 });
3581 var renderReason = function renderReason(reason) {
3582 return "- ".concat(reason);
3583 };
3584 var isResolvedHandle = function isResolvedHandle(adapter) {
3585 return utils$1.isFunction(adapter) || adapter === null || adapter === false;
3586 };
3587 var adapters = {
3588 getAdapter: function getAdapter(adapters) {
3589 adapters = utils$1.isArray(adapters) ? adapters : [adapters];
3590 var _adapters = adapters,
3591 length = _adapters.length;
3592 var nameOrAdapter;
3593 var adapter;
3594 var rejectedReasons = {};
3595 for (var i = 0; i < length; i++) {
3596 nameOrAdapter = adapters[i];
3597 var id = void 0;
3598 adapter = nameOrAdapter;
3599 if (!isResolvedHandle(nameOrAdapter)) {
3600 adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
3601 if (adapter === undefined) {
3602 throw new AxiosError("Unknown adapter '".concat(id, "'"));
3603 }
3604 }
3605 if (adapter) {
3606 break;
3607 }
3608 rejectedReasons[id || '#' + i] = adapter;
3609 }
3610 if (!adapter) {
3611 var reasons = Object.entries(rejectedReasons).map(function (_ref) {
3612 var _ref2 = _slicedToArray(_ref, 2),
3613 id = _ref2[0],
3614 state = _ref2[1];
3615 return "adapter ".concat(id, " ") + (state === false ? 'is not supported by the environment' : 'is not available in the build');
3616 });
3617 var s = length ? reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0]) : 'as no adapter specified';
3618 throw new AxiosError("There is no suitable adapter to dispatch the request " + s, 'ERR_NOT_SUPPORT');
3619 }
3620 return adapter;
3621 },
3622 adapters: knownAdapters
3623 };
3624
3625 /**
3626 * Throws a `CanceledError` if cancellation has been requested.
3627 *
3628 * @param {Object} config The config that is to be used for the request
3629 *
3630 * @returns {void}
3631 */
3632 function throwIfCancellationRequested(config) {
3633 if (config.cancelToken) {
3634 config.cancelToken.throwIfRequested();
3635 }
3636 if (config.signal && config.signal.aborted) {
3637 throw new CanceledError(null, config);
3638 }
3639 }
3640
3641 /**
3642 * Dispatch a request to the server using the configured adapter.
3643 *
3644 * @param {object} config The config that is to be used for the request
3645 *
3646 * @returns {Promise} The Promise to be fulfilled
3647 */
3648 function dispatchRequest(config) {
3649 throwIfCancellationRequested(config);
3650 config.headers = AxiosHeaders$1.from(config.headers);
3651
3652 // Transform request data
3653 config.data = transformData.call(config, config.transformRequest);
3654 if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {
3655 config.headers.setContentType('application/x-www-form-urlencoded', false);
3656 }
3657 var adapter = adapters.getAdapter(config.adapter || defaults$1.adapter);
3658 return adapter(config).then(function onAdapterResolution(response) {
3659 throwIfCancellationRequested(config);
3660
3661 // Transform response data
3662 response.data = transformData.call(config, config.transformResponse, response);
3663 response.headers = AxiosHeaders$1.from(response.headers);
3664 return response;
3665 }, function onAdapterRejection(reason) {
3666 if (!isCancel(reason)) {
3667 throwIfCancellationRequested(config);
3668
3669 // Transform response data
3670 if (reason && reason.response) {
3671 reason.response.data = transformData.call(config, config.transformResponse, reason.response);
3672 reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
3673 }
3674 }
3675 return Promise.reject(reason);
3676 });
3677 }
3678
3679 var VERSION = "1.7.8";
3680
3681 var validators$1 = {};
3682
3683 // eslint-disable-next-line func-names
3684 ['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach(function (type, i) {
3685 validators$1[type] = function validator(thing) {
3686 return _typeof(thing) === type || 'a' + (i < 1 ? 'n ' : ' ') + type;
3687 };
3688 });
3689 var deprecatedWarnings = {};
3690
3691 /**
3692 * Transitional option validator
3693 *
3694 * @param {function|boolean?} validator - set to false if the transitional option has been removed
3695 * @param {string?} version - deprecated version / removed since version
3696 * @param {string?} message - some message with additional info
3697 *
3698 * @returns {function}
3699 */
3700 validators$1.transitional = function transitional(validator, version, message) {
3701 function formatMessage(opt, desc) {
3702 return '[Axios v' + VERSION + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : '');
3703 }
3704
3705 // eslint-disable-next-line func-names
3706 return function (value, opt, opts) {
3707 if (validator === false) {
3708 throw new AxiosError(formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')), AxiosError.ERR_DEPRECATED);
3709 }
3710 if (version && !deprecatedWarnings[opt]) {
3711 deprecatedWarnings[opt] = true;
3712 // eslint-disable-next-line no-console
3713 console.warn(formatMessage(opt, ' has been deprecated since v' + version + ' and will be removed in the near future'));
3714 }
3715 return validator ? validator(value, opt, opts) : true;
3716 };
3717 };
3718 validators$1.spelling = function spelling(correctSpelling) {
3719 return function (value, opt) {
3720 // eslint-disable-next-line no-console
3721 console.warn("".concat(opt, " is likely a misspelling of ").concat(correctSpelling));
3722 return true;
3723 };
3724 };
3725
3726 /**
3727 * Assert object's properties type
3728 *
3729 * @param {object} options
3730 * @param {object} schema
3731 * @param {boolean?} allowUnknown
3732 *
3733 * @returns {object}
3734 */
3735
3736 function assertOptions(options, schema, allowUnknown) {
3737 if (_typeof(options) !== 'object') {
3738 throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE);
3739 }
3740 var keys = Object.keys(options);
3741 var i = keys.length;
3742 while (i-- > 0) {
3743 var opt = keys[i];
3744 var validator = schema[opt];
3745 if (validator) {
3746 var value = options[opt];
3747 var result = value === undefined || validator(value, opt, options);
3748 if (result !== true) {
3749 throw new AxiosError('option ' + opt + ' must be ' + result, AxiosError.ERR_BAD_OPTION_VALUE);
3750 }
3751 continue;
3752 }
3753 if (allowUnknown !== true) {
3754 throw new AxiosError('Unknown option ' + opt, AxiosError.ERR_BAD_OPTION);
3755 }
3756 }
3757 }
3758 var validator = {
3759 assertOptions: assertOptions,
3760 validators: validators$1
3761 };
3762
3763 var validators = validator.validators;
3764
3765 /**
3766 * Create a new instance of Axios
3767 *
3768 * @param {Object} instanceConfig The default config for the instance
3769 *
3770 * @return {Axios} A new instance of Axios
3771 */
3772 var Axios = /*#__PURE__*/function () {
3773 function Axios(instanceConfig) {
3774 _classCallCheck(this, Axios);
3775 this.defaults = instanceConfig;
3776 this.interceptors = {
3777 request: new InterceptorManager$1(),
3778 response: new InterceptorManager$1()
3779 };
3780 }
3781
3782 /**
3783 * Dispatch a request
3784 *
3785 * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
3786 * @param {?Object} config
3787 *
3788 * @returns {Promise} The Promise to be fulfilled
3789 */
3790 _createClass(Axios, [{
3791 key: "request",
3792 value: (function () {
3793 var _request2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(configOrUrl, config) {
3794 var dummy, stack;
3795 return _regeneratorRuntime().wrap(function _callee$(_context) {
3796 while (1) switch (_context.prev = _context.next) {
3797 case 0:
3798 _context.prev = 0;
3799 _context.next = 3;
3800 return this._request(configOrUrl, config);
3801 case 3:
3802 return _context.abrupt("return", _context.sent);
3803 case 6:
3804 _context.prev = 6;
3805 _context.t0 = _context["catch"](0);
3806 if (_context.t0 instanceof Error) {
3807 dummy = {};
3808 Error.captureStackTrace ? Error.captureStackTrace(dummy) : dummy = new Error();
3809
3810 // slice off the Error: ... line
3811 stack = dummy.stack ? dummy.stack.replace(/^.+\n/, '') : '';
3812 try {
3813 if (!_context.t0.stack) {
3814 _context.t0.stack = stack;
3815 // match without the 2 top stack lines
3816 } else if (stack && !String(_context.t0.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) {
3817 _context.t0.stack += '\n' + stack;
3818 }
3819 } catch (e) {
3820 // ignore the case where "stack" is an un-writable property
3821 }
3822 }
3823 throw _context.t0;
3824 case 10:
3825 case "end":
3826 return _context.stop();
3827 }
3828 }, _callee, this, [[0, 6]]);
3829 }));
3830 function request(_x, _x2) {
3831 return _request2.apply(this, arguments);
3832 }
3833 return request;
3834 }())
3835 }, {
3836 key: "_request",
3837 value: function _request(configOrUrl, config) {
3838 /*eslint no-param-reassign:0*/
3839 // Allow for axios('example/url'[, config]) a la fetch API
3840 if (typeof configOrUrl === 'string') {
3841 config = config || {};
3842 config.url = configOrUrl;
3843 } else {
3844 config = configOrUrl || {};
3845 }
3846 config = mergeConfig(this.defaults, config);
3847 var _config = config,
3848 transitional = _config.transitional,
3849 paramsSerializer = _config.paramsSerializer,
3850 headers = _config.headers;
3851 if (transitional !== undefined) {
3852 validator.assertOptions(transitional, {
3853 silentJSONParsing: validators.transitional(validators["boolean"]),
3854 forcedJSONParsing: validators.transitional(validators["boolean"]),
3855 clarifyTimeoutError: validators.transitional(validators["boolean"])
3856 }, false);
3857 }
3858 if (paramsSerializer != null) {
3859 if (utils$1.isFunction(paramsSerializer)) {
3860 config.paramsSerializer = {
3861 serialize: paramsSerializer
3862 };
3863 } else {
3864 validator.assertOptions(paramsSerializer, {
3865 encode: validators["function"],
3866 serialize: validators["function"]
3867 }, true);
3868 }
3869 }
3870 validator.assertOptions(config, {
3871 baseUrl: validators.spelling('baseURL'),
3872 withXsrfToken: validators.spelling('withXSRFToken')
3873 }, true);
3874
3875 // Set config.method
3876 config.method = (config.method || this.defaults.method || 'get').toLowerCase();
3877
3878 // Flatten headers
3879 var contextHeaders = headers && utils$1.merge(headers.common, headers[config.method]);
3880 headers && utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], function (method) {
3881 delete headers[method];
3882 });
3883 config.headers = AxiosHeaders$1.concat(contextHeaders, headers);
3884
3885 // filter out skipped interceptors
3886 var requestInterceptorChain = [];
3887 var synchronousRequestInterceptors = true;
3888 this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
3889 if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {
3890 return;
3891 }
3892 synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
3893 requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
3894 });
3895 var responseInterceptorChain = [];
3896 this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
3897 responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
3898 });
3899 var promise;
3900 var i = 0;
3901 var len;
3902 if (!synchronousRequestInterceptors) {
3903 var chain = [dispatchRequest.bind(this), undefined];
3904 chain.unshift.apply(chain, requestInterceptorChain);
3905 chain.push.apply(chain, responseInterceptorChain);
3906 len = chain.length;
3907 promise = Promise.resolve(config);
3908 while (i < len) {
3909 promise = promise.then(chain[i++], chain[i++]);
3910 }
3911 return promise;
3912 }
3913 len = requestInterceptorChain.length;
3914 var newConfig = config;
3915 i = 0;
3916 while (i < len) {
3917 var onFulfilled = requestInterceptorChain[i++];
3918 var onRejected = requestInterceptorChain[i++];
3919 try {
3920 newConfig = onFulfilled(newConfig);
3921 } catch (error) {
3922 onRejected.call(this, error);
3923 break;
3924 }
3925 }
3926 try {
3927 promise = dispatchRequest.call(this, newConfig);
3928 } catch (error) {
3929 return Promise.reject(error);
3930 }
3931 i = 0;
3932 len = responseInterceptorChain.length;
3933 while (i < len) {
3934 promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);
3935 }
3936 return promise;
3937 }
3938 }, {
3939 key: "getUri",
3940 value: function getUri(config) {
3941 config = mergeConfig(this.defaults, config);
3942 var fullPath = buildFullPath(config.baseURL, config.url);
3943 return buildURL(fullPath, config.params, config.paramsSerializer);
3944 }
3945 }]);
3946 return Axios;
3947 }(); // Provide aliases for supported request methods
3948 utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
3949 /*eslint func-names:0*/
3950 Axios.prototype[method] = function (url, config) {
3951 return this.request(mergeConfig(config || {}, {
3952 method: method,
3953 url: url,
3954 data: (config || {}).data
3955 }));
3956 };
3957 });
3958 utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
3959 /*eslint func-names:0*/
3960
3961 function generateHTTPMethod(isForm) {
3962 return function httpMethod(url, data, config) {
3963 return this.request(mergeConfig(config || {}, {
3964 method: method,
3965 headers: isForm ? {
3966 'Content-Type': 'multipart/form-data'
3967 } : {},
3968 url: url,
3969 data: data
3970 }));
3971 };
3972 }
3973 Axios.prototype[method] = generateHTTPMethod();
3974 Axios.prototype[method + 'Form'] = generateHTTPMethod(true);
3975 });
3976 var Axios$1 = Axios;
3977
3978 /**
3979 * A `CancelToken` is an object that can be used to request cancellation of an operation.
3980 *
3981 * @param {Function} executor The executor function.
3982 *
3983 * @returns {CancelToken}
3984 */
3985 var CancelToken = /*#__PURE__*/function () {
3986 function CancelToken(executor) {
3987 _classCallCheck(this, CancelToken);
3988 if (typeof executor !== 'function') {
3989 throw new TypeError('executor must be a function.');
3990 }
3991 var resolvePromise;
3992 this.promise = new Promise(function promiseExecutor(resolve) {
3993 resolvePromise = resolve;
3994 });
3995 var token = this;
3996
3997 // eslint-disable-next-line func-names
3998 this.promise.then(function (cancel) {
3999 if (!token._listeners) return;
4000 var i = token._listeners.length;
4001 while (i-- > 0) {
4002 token._listeners[i](cancel);
4003 }
4004 token._listeners = null;
4005 });
4006
4007 // eslint-disable-next-line func-names
4008 this.promise.then = function (onfulfilled) {
4009 var _resolve;
4010 // eslint-disable-next-line func-names
4011 var promise = new Promise(function (resolve) {
4012 token.subscribe(resolve);
4013 _resolve = resolve;
4014 }).then(onfulfilled);
4015 promise.cancel = function reject() {
4016 token.unsubscribe(_resolve);
4017 };
4018 return promise;
4019 };
4020 executor(function cancel(message, config, request) {
4021 if (token.reason) {
4022 // Cancellation has already been requested
4023 return;
4024 }
4025 token.reason = new CanceledError(message, config, request);
4026 resolvePromise(token.reason);
4027 });
4028 }
4029
4030 /**
4031 * Throws a `CanceledError` if cancellation has been requested.
4032 */
4033 _createClass(CancelToken, [{
4034 key: "throwIfRequested",
4035 value: function throwIfRequested() {
4036 if (this.reason) {
4037 throw this.reason;
4038 }
4039 }
4040
4041 /**
4042 * Subscribe to the cancel signal
4043 */
4044 }, {
4045 key: "subscribe",
4046 value: function subscribe(listener) {
4047 if (this.reason) {
4048 listener(this.reason);
4049 return;
4050 }
4051 if (this._listeners) {
4052 this._listeners.push(listener);
4053 } else {
4054 this._listeners = [listener];
4055 }
4056 }
4057
4058 /**
4059 * Unsubscribe from the cancel signal
4060 */
4061 }, {
4062 key: "unsubscribe",
4063 value: function unsubscribe(listener) {
4064 if (!this._listeners) {
4065 return;
4066 }
4067 var index = this._listeners.indexOf(listener);
4068 if (index !== -1) {
4069 this._listeners.splice(index, 1);
4070 }
4071 }
4072 }, {
4073 key: "toAbortSignal",
4074 value: function toAbortSignal() {
4075 var _this = this;
4076 var controller = new AbortController();
4077 var abort = function abort(err) {
4078 controller.abort(err);
4079 };
4080 this.subscribe(abort);
4081 controller.signal.unsubscribe = function () {
4082 return _this.unsubscribe(abort);
4083 };
4084 return controller.signal;
4085 }
4086
4087 /**
4088 * Returns an object that contains a new `CancelToken` and a function that, when called,
4089 * cancels the `CancelToken`.
4090 */
4091 }], [{
4092 key: "source",
4093 value: function source() {
4094 var cancel;
4095 var token = new CancelToken(function executor(c) {
4096 cancel = c;
4097 });
4098 return {
4099 token: token,
4100 cancel: cancel
4101 };
4102 }
4103 }]);
4104 return CancelToken;
4105 }();
4106 var CancelToken$1 = CancelToken;
4107
4108 /**
4109 * Syntactic sugar for invoking a function and expanding an array for arguments.
4110 *
4111 * Common use case would be to use `Function.prototype.apply`.
4112 *
4113 * ```js
4114 * function f(x, y, z) {}
4115 * var args = [1, 2, 3];
4116 * f.apply(null, args);
4117 * ```
4118 *
4119 * With `spread` this example can be re-written.
4120 *
4121 * ```js
4122 * spread(function(x, y, z) {})([1, 2, 3]);
4123 * ```
4124 *
4125 * @param {Function} callback
4126 *
4127 * @returns {Function}
4128 */
4129 function spread(callback) {
4130 return function wrap(arr) {
4131 return callback.apply(null, arr);
4132 };
4133 }
4134
4135 /**
4136 * Determines whether the payload is an error thrown by Axios
4137 *
4138 * @param {*} payload The value to test
4139 *
4140 * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
4141 */
4142 function isAxiosError(payload) {
4143 return utils$1.isObject(payload) && payload.isAxiosError === true;
4144 }
4145
4146 var HttpStatusCode = {
4147 Continue: 100,
4148 SwitchingProtocols: 101,
4149 Processing: 102,
4150 EarlyHints: 103,
4151 Ok: 200,
4152 Created: 201,
4153 Accepted: 202,
4154 NonAuthoritativeInformation: 203,
4155 NoContent: 204,
4156 ResetContent: 205,
4157 PartialContent: 206,
4158 MultiStatus: 207,
4159 AlreadyReported: 208,
4160 ImUsed: 226,
4161 MultipleChoices: 300,
4162 MovedPermanently: 301,
4163 Found: 302,
4164 SeeOther: 303,
4165 NotModified: 304,
4166 UseProxy: 305,
4167 Unused: 306,
4168 TemporaryRedirect: 307,
4169 PermanentRedirect: 308,
4170 BadRequest: 400,
4171 Unauthorized: 401,
4172 PaymentRequired: 402,
4173 Forbidden: 403,
4174 NotFound: 404,
4175 MethodNotAllowed: 405,
4176 NotAcceptable: 406,
4177 ProxyAuthenticationRequired: 407,
4178 RequestTimeout: 408,
4179 Conflict: 409,
4180 Gone: 410,
4181 LengthRequired: 411,
4182 PreconditionFailed: 412,
4183 PayloadTooLarge: 413,
4184 UriTooLong: 414,
4185 UnsupportedMediaType: 415,
4186 RangeNotSatisfiable: 416,
4187 ExpectationFailed: 417,
4188 ImATeapot: 418,
4189 MisdirectedRequest: 421,
4190 UnprocessableEntity: 422,
4191 Locked: 423,
4192 FailedDependency: 424,
4193 TooEarly: 425,
4194 UpgradeRequired: 426,
4195 PreconditionRequired: 428,
4196 TooManyRequests: 429,
4197 RequestHeaderFieldsTooLarge: 431,
4198 UnavailableForLegalReasons: 451,
4199 InternalServerError: 500,
4200 NotImplemented: 501,
4201 BadGateway: 502,
4202 ServiceUnavailable: 503,
4203 GatewayTimeout: 504,
4204 HttpVersionNotSupported: 505,
4205 VariantAlsoNegotiates: 506,
4206 InsufficientStorage: 507,
4207 LoopDetected: 508,
4208 NotExtended: 510,
4209 NetworkAuthenticationRequired: 511
4210 };
4211 Object.entries(HttpStatusCode).forEach(function (_ref) {
4212 var _ref2 = _slicedToArray(_ref, 2),
4213 key = _ref2[0],
4214 value = _ref2[1];
4215 HttpStatusCode[value] = key;
4216 });
4217 var HttpStatusCode$1 = HttpStatusCode;
4218
4219 /**
4220 * Create an instance of Axios
4221 *
4222 * @param {Object} defaultConfig The default config for the instance
4223 *
4224 * @returns {Axios} A new instance of Axios
4225 */
4226 function createInstance(defaultConfig) {
4227 var context = new Axios$1(defaultConfig);
4228 var instance = bind(Axios$1.prototype.request, context);
4229
4230 // Copy axios.prototype to instance
4231 utils$1.extend(instance, Axios$1.prototype, context, {
4232 allOwnKeys: true
4233 });
4234
4235 // Copy context to instance
4236 utils$1.extend(instance, context, null, {
4237 allOwnKeys: true
4238 });
4239
4240 // Factory for creating new instances
4241 instance.create = function create(instanceConfig) {
4242 return createInstance(mergeConfig(defaultConfig, instanceConfig));
4243 };
4244 return instance;
4245 }
4246
4247 // Create the default instance to be exported
4248 var axios = createInstance(defaults$1);
4249
4250 // Expose Axios class to allow class inheritance
4251 axios.Axios = Axios$1;
4252
4253 // Expose Cancel & CancelToken
4254 axios.CanceledError = CanceledError;
4255 axios.CancelToken = CancelToken$1;
4256 axios.isCancel = isCancel;
4257 axios.VERSION = VERSION;
4258 axios.toFormData = toFormData;
4259
4260 // Expose AxiosError class
4261 axios.AxiosError = AxiosError;
4262
4263 // alias for CanceledError for backward compatibility
4264 axios.Cancel = axios.CanceledError;
4265
4266 // Expose all/spread
4267 axios.all = function all(promises) {
4268 return Promise.all(promises);
4269 };
4270 axios.spread = spread;
4271
4272 // Expose isAxiosError
4273 axios.isAxiosError = isAxiosError;
4274
4275 // Expose mergeConfig
4276 axios.mergeConfig = mergeConfig;
4277 axios.AxiosHeaders = AxiosHeaders$1;
4278 axios.formToJSON = function (thing) {
4279 return formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
4280 };
4281 axios.getAdapter = adapters.getAdapter;
4282 axios.HttpStatusCode = HttpStatusCode$1;
4283 axios["default"] = axios;
4284
4285 return axios;
4286
4287}));
4288//# sourceMappingURL=axios.js.map
Note: See TracBrowser for help on using the repository browser.