axios 1.6.7 → 1.7.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of axios might be problematic. Click here for more details.

package/dist/axios.js CHANGED
@@ -1,330 +1,520 @@
1
- // Axios v1.6.7 Copyright (c) 2024 Matt Zabriskie and contributors
1
+ // Axios v1.7.0-beta.0 Copyright (c) 2024 Matt Zabriskie and contributors
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
4
4
  typeof define === 'function' && define.amd ? define(factory) :
5
5
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.axios = factory());
6
6
  })(this, (function () { 'use strict';
7
7
 
8
- function ownKeys(object, enumerableOnly) {
9
- var keys = Object.keys(object);
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);
10
171
  if (Object.getOwnPropertySymbols) {
11
- var symbols = Object.getOwnPropertySymbols(object);
12
- enumerableOnly && (symbols = symbols.filter(function (sym) {
13
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
14
- })), keys.push.apply(keys, symbols);
15
- }
16
- return keys;
17
- }
18
- function _objectSpread2(target) {
19
- for (var i = 1; i < arguments.length; i++) {
20
- var source = null != arguments[i] ? arguments[i] : {};
21
- i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
22
- _defineProperty(target, key, source[key]);
23
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
24
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
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));
25
186
  });
26
187
  }
27
- return target;
188
+ return e;
28
189
  }
29
190
  function _regeneratorRuntime() {
30
191
  _regeneratorRuntime = function () {
31
- return exports;
192
+ return e;
32
193
  };
33
- var exports = {},
34
- Op = Object.prototype,
35
- hasOwn = Op.hasOwnProperty,
36
- $Symbol = "function" == typeof Symbol ? Symbol : {},
37
- iteratorSymbol = $Symbol.iterator || "@@iterator",
38
- asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
39
- toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
40
- function define(obj, key, value) {
41
- return Object.defineProperty(obj, key, {
42
- value: value,
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,
43
208
  enumerable: !0,
44
209
  configurable: !0,
45
210
  writable: !0
46
- }), obj[key];
211
+ }), t[e];
47
212
  }
48
213
  try {
49
214
  define({}, "");
50
- } catch (err) {
51
- define = function (obj, key, value) {
52
- return obj[key] = value;
215
+ } catch (t) {
216
+ define = function (t, e, r) {
217
+ return t[e] = r;
53
218
  };
54
219
  }
55
- function wrap(innerFn, outerFn, self, tryLocsList) {
56
- var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
57
- generator = Object.create(protoGenerator.prototype),
58
- context = new Context(tryLocsList || []);
59
- return generator._invoke = function (innerFn, self, context) {
60
- var state = "suspendedStart";
61
- return function (method, arg) {
62
- if ("executing" === state) throw new Error("Generator is already running");
63
- if ("completed" === state) {
64
- if ("throw" === method) throw arg;
65
- return doneResult();
66
- }
67
- for (context.method = method, context.arg = arg;;) {
68
- var delegate = context.delegate;
69
- if (delegate) {
70
- var delegateResult = maybeInvokeDelegate(delegate, context);
71
- if (delegateResult) {
72
- if (delegateResult === ContinueSentinel) continue;
73
- return delegateResult;
74
- }
75
- }
76
- if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
77
- if ("suspendedStart" === state) throw state = "completed", context.arg;
78
- context.dispatchException(context.arg);
79
- } else "return" === context.method && context.abrupt("return", context.arg);
80
- state = "executing";
81
- var record = tryCatch(innerFn, self, context);
82
- if ("normal" === record.type) {
83
- if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
84
- return {
85
- value: record.arg,
86
- done: context.done
87
- };
88
- }
89
- "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
90
- }
91
- };
92
- }(innerFn, self, context), generator;
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;
93
227
  }
94
- function tryCatch(fn, obj, arg) {
228
+ function tryCatch(t, e, r) {
95
229
  try {
96
230
  return {
97
231
  type: "normal",
98
- arg: fn.call(obj, arg)
232
+ arg: t.call(e, r)
99
233
  };
100
- } catch (err) {
234
+ } catch (t) {
101
235
  return {
102
236
  type: "throw",
103
- arg: err
237
+ arg: t
104
238
  };
105
239
  }
106
240
  }
107
- exports.wrap = wrap;
108
- var ContinueSentinel = {};
241
+ e.wrap = wrap;
242
+ var h = "suspendedStart",
243
+ l = "suspendedYield",
244
+ f = "executing",
245
+ s = "completed",
246
+ y = {};
109
247
  function Generator() {}
110
248
  function GeneratorFunction() {}
111
249
  function GeneratorFunctionPrototype() {}
112
- var IteratorPrototype = {};
113
- define(IteratorPrototype, iteratorSymbol, function () {
250
+ var p = {};
251
+ define(p, a, function () {
114
252
  return this;
115
253
  });
116
- var getProto = Object.getPrototypeOf,
117
- NativeIteratorPrototype = getProto && getProto(getProto(values([])));
118
- NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
119
- var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
120
- function defineIteratorMethods(prototype) {
121
- ["next", "throw", "return"].forEach(function (method) {
122
- define(prototype, method, function (arg) {
123
- return this._invoke(method, arg);
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);
124
262
  });
125
263
  });
126
264
  }
127
- function AsyncIterator(generator, PromiseImpl) {
128
- function invoke(method, arg, resolve, reject) {
129
- var record = tryCatch(generator[method], generator, arg);
130
- if ("throw" !== record.type) {
131
- var result = record.arg,
132
- value = result.value;
133
- return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
134
- invoke("next", value, resolve, reject);
135
- }, function (err) {
136
- invoke("throw", err, resolve, reject);
137
- }) : PromiseImpl.resolve(value).then(function (unwrapped) {
138
- result.value = unwrapped, resolve(result);
139
- }, function (error) {
140
- return invoke("throw", error, resolve, reject);
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);
141
279
  });
142
280
  }
143
- reject(record.arg);
281
+ a(c.arg);
144
282
  }
145
- var previousPromise;
146
- this._invoke = function (method, arg) {
147
- function callInvokeWithMethodAndArg() {
148
- return new PromiseImpl(function (resolve, reject) {
149
- invoke(method, arg, resolve, reject);
150
- });
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();
151
292
  }
152
- return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
153
- };
293
+ });
154
294
  }
155
- function maybeInvokeDelegate(delegate, context) {
156
- var method = delegate.iterator[context.method];
157
- if (undefined === method) {
158
- if (context.delegate = null, "throw" === context.method) {
159
- if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
160
- context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
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
+ };
161
305
  }
162
- return ContinueSentinel;
163
- }
164
- var record = tryCatch(method, delegate.iterator, context.arg);
165
- if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
166
- var info = record.arg;
167
- return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
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);
168
340
  }
169
- function pushTryEntry(locs) {
170
- var entry = {
171
- tryLoc: locs[0]
341
+ function pushTryEntry(t) {
342
+ var e = {
343
+ tryLoc: t[0]
172
344
  };
173
- 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
345
+ 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
174
346
  }
175
- function resetTryEntry(entry) {
176
- var record = entry.completion || {};
177
- record.type = "normal", delete record.arg, entry.completion = record;
347
+ function resetTryEntry(t) {
348
+ var e = t.completion || {};
349
+ e.type = "normal", delete e.arg, t.completion = e;
178
350
  }
179
- function Context(tryLocsList) {
351
+ function Context(t) {
180
352
  this.tryEntries = [{
181
353
  tryLoc: "root"
182
- }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
183
- }
184
- function values(iterable) {
185
- if (iterable) {
186
- var iteratorMethod = iterable[iteratorSymbol];
187
- if (iteratorMethod) return iteratorMethod.call(iterable);
188
- if ("function" == typeof iterable.next) return iterable;
189
- if (!isNaN(iterable.length)) {
190
- var i = -1,
191
- next = function next() {
192
- for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
193
- return next.value = undefined, next.done = !0, next;
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;
194
366
  };
195
- return next.next = next;
367
+ return i.next = i;
196
368
  }
197
369
  }
198
- return {
199
- next: doneResult
200
- };
201
- }
202
- function doneResult() {
203
- return {
204
- value: undefined,
205
- done: !0
206
- };
370
+ throw new TypeError(typeof e + " is not iterable");
207
371
  }
208
- return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
209
- var ctor = "function" == typeof genFun && genFun.constructor;
210
- return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
211
- }, exports.mark = function (genFun) {
212
- return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
213
- }, exports.awrap = function (arg) {
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) {
214
384
  return {
215
- __await: arg
385
+ __await: t
216
386
  };
217
- }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
387
+ }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
218
388
  return this;
219
- }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
220
- void 0 === PromiseImpl && (PromiseImpl = Promise);
221
- var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
222
- return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
223
- return result.done ? result.value : iter.next();
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();
224
394
  });
225
- }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
395
+ }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
226
396
  return this;
227
- }), define(Gp, "toString", function () {
397
+ }), define(g, "toString", function () {
228
398
  return "[object Generator]";
229
- }), exports.keys = function (object) {
230
- var keys = [];
231
- for (var key in object) keys.push(key);
232
- return keys.reverse(), function next() {
233
- for (; keys.length;) {
234
- var key = keys.pop();
235
- if (key in object) return next.value = key, next.done = !1, next;
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;
236
407
  }
237
408
  return next.done = !0, next;
238
409
  };
239
- }, exports.values = values, Context.prototype = {
410
+ }, e.values = values, Context.prototype = {
240
411
  constructor: Context,
241
- reset: function (skipTempReset) {
242
- if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
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);
243
414
  },
244
415
  stop: function () {
245
416
  this.done = !0;
246
- var rootRecord = this.tryEntries[0].completion;
247
- if ("throw" === rootRecord.type) throw rootRecord.arg;
417
+ var t = this.tryEntries[0].completion;
418
+ if ("throw" === t.type) throw t.arg;
248
419
  return this.rval;
249
420
  },
250
- dispatchException: function (exception) {
251
- if (this.done) throw exception;
252
- var context = this;
253
- function handle(loc, caught) {
254
- return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
255
- }
256
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
257
- var entry = this.tryEntries[i],
258
- record = entry.completion;
259
- if ("root" === entry.tryLoc) return handle("end");
260
- if (entry.tryLoc <= this.prev) {
261
- var hasCatch = hasOwn.call(entry, "catchLoc"),
262
- hasFinally = hasOwn.call(entry, "finallyLoc");
263
- if (hasCatch && hasFinally) {
264
- if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
265
- if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
266
- } else if (hasCatch) {
267
- if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
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);
268
439
  } else {
269
- if (!hasFinally) throw new Error("try statement without catch or finally");
270
- if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
440
+ if (!u) throw new Error("try statement without catch or finally");
441
+ if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
271
442
  }
272
443
  }
273
444
  }
274
445
  },
275
- abrupt: function (type, arg) {
276
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
277
- var entry = this.tryEntries[i];
278
- if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
279
- var finallyEntry = entry;
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;
280
451
  break;
281
452
  }
282
453
  }
283
- finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
284
- var record = finallyEntry ? finallyEntry.completion : {};
285
- return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
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);
286
457
  },
287
- complete: function (record, afterLoc) {
288
- if ("throw" === record.type) throw record.arg;
289
- return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
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;
290
461
  },
291
- finish: function (finallyLoc) {
292
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
293
- var entry = this.tryEntries[i];
294
- if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
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;
295
466
  }
296
467
  },
297
- catch: function (tryLoc) {
298
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
299
- var entry = this.tryEntries[i];
300
- if (entry.tryLoc === tryLoc) {
301
- var record = entry.completion;
302
- if ("throw" === record.type) {
303
- var thrown = record.arg;
304
- resetTryEntry(entry);
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);
305
476
  }
306
- return thrown;
477
+ return o;
307
478
  }
308
479
  }
309
480
  throw new Error("illegal catch attempt");
310
481
  },
311
- delegateYield: function (iterable, resultName, nextLoc) {
482
+ delegateYield: function (e, r, n) {
312
483
  return this.delegate = {
313
- iterator: values(iterable),
314
- resultName: resultName,
315
- nextLoc: nextLoc
316
- }, "next" === this.method && (this.arg = undefined), ContinueSentinel;
484
+ iterator: values(e),
485
+ resultName: r,
486
+ nextLoc: n
487
+ }, "next" === this.method && (this.arg = t), y;
317
488
  }
318
- }, exports;
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);
319
504
  }
320
- function _typeof(obj) {
505
+ function _typeof(o) {
321
506
  "@babel/helpers - typeof";
322
507
 
323
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
324
- return typeof obj;
325
- } : function (obj) {
326
- return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
327
- }, _typeof(obj);
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
+ };
328
518
  }
329
519
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
330
520
  try {
@@ -367,7 +557,7 @@
367
557
  descriptor.enumerable = descriptor.enumerable || false;
368
558
  descriptor.configurable = true;
369
559
  if ("value" in descriptor) descriptor.writable = true;
370
- Object.defineProperty(target, descriptor.key, descriptor);
560
+ Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
371
561
  }
372
562
  }
373
563
  function _createClass(Constructor, protoProps, staticProps) {
@@ -379,6 +569,7 @@
379
569
  return Constructor;
380
570
  }
381
571
  function _defineProperty(obj, key, value) {
572
+ key = _toPropertyKey(key);
382
573
  if (key in obj) {
383
574
  Object.defineProperty(obj, key, {
384
575
  value: value,
@@ -409,30 +600,6 @@
409
600
  function _iterableToArray(iter) {
410
601
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
411
602
  }
412
- function _iterableToArrayLimit(arr, i) {
413
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
414
- if (_i == null) return;
415
- var _arr = [];
416
- var _n = true;
417
- var _d = false;
418
- var _s, _e;
419
- try {
420
- for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
421
- _arr.push(_s.value);
422
- if (i && _arr.length === i) break;
423
- }
424
- } catch (err) {
425
- _d = true;
426
- _e = err;
427
- } finally {
428
- try {
429
- if (!_n && _i["return"] != null) _i["return"]();
430
- } finally {
431
- if (_d) throw _e;
432
- }
433
- }
434
- return _arr;
435
- }
436
603
  function _unsupportedIterableToArray(o, minLen) {
437
604
  if (!o) return;
438
605
  if (typeof o === "string") return _arrayLikeToArray(o, minLen);
@@ -452,6 +619,57 @@
452
619
  function _nonIterableRest() {
453
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.");
454
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
+ }
455
673
 
456
674
  function bind(fn, thisArg) {
457
675
  return function wrap() {
@@ -667,6 +885,12 @@
667
885
  * @returns {boolean} True if value is a URLSearchParams object, otherwise false
668
886
  */
669
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];
670
894
 
671
895
  /**
672
896
  * Trim excess whitespace off the beginning and end of a string
@@ -766,8 +990,8 @@
766
990
  *
767
991
  * @returns {Object} Result of all merge properties
768
992
  */
769
- function /* obj1, obj2, obj3, ... */
770
- merge() {
993
+ function merge( /* obj1, obj2, obj3, ... */
994
+ ) {
771
995
  var _ref2 = isContextDefined(this) && this || {},
772
996
  caseless = _ref2.caseless;
773
997
  var result = {};
@@ -1040,8 +1264,7 @@
1040
1264
  };
1041
1265
  var noop = function noop() {};
1042
1266
  var toFiniteNumber = function toFiniteNumber(value, defaultValue) {
1043
- value = +value;
1044
- return Number.isFinite(value) ? value : defaultValue;
1267
+ return value != null && Number.isFinite(value = +value) ? value : defaultValue;
1045
1268
  };
1046
1269
  var ALPHA = 'abcdefghijklmnopqrstuvwxyz';
1047
1270
  var DIGIT = '0123456789';
@@ -1108,6 +1331,10 @@
1108
1331
  isBoolean: isBoolean,
1109
1332
  isObject: isObject,
1110
1333
  isPlainObject: isPlainObject,
1334
+ isReadableStream: isReadableStream,
1335
+ isRequest: isRequest,
1336
+ isResponse: isResponse,
1337
+ isHeaders: isHeaders,
1111
1338
  isUndefined: isUndefined,
1112
1339
  isDate: isDate,
1113
1340
  isFile: isFile,
@@ -1639,12 +1866,14 @@
1639
1866
  // eslint-disable-next-line no-undef
1640
1867
  self instanceof WorkerGlobalScope && typeof self.importScripts === 'function';
1641
1868
  }();
1869
+ var origin = hasBrowserEnv && window.location.href || 'http://localhost';
1642
1870
 
1643
1871
  var utils = /*#__PURE__*/Object.freeze({
1644
1872
  __proto__: null,
1645
1873
  hasBrowserEnv: hasBrowserEnv,
1646
1874
  hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
1647
- hasStandardBrowserEnv: hasStandardBrowserEnv
1875
+ hasStandardBrowserEnv: hasStandardBrowserEnv,
1876
+ origin: origin
1648
1877
  });
1649
1878
 
1650
1879
  var platform = _objectSpread2(_objectSpread2({}, utils), platform$1);
@@ -1764,7 +1993,7 @@
1764
1993
  }
1765
1994
  var defaults = {
1766
1995
  transitional: transitionalDefaults,
1767
- adapter: ['xhr', 'http'],
1996
+ adapter: ['xhr', 'http', 'fetch'],
1768
1997
  transformRequest: [function transformRequest(data, headers) {
1769
1998
  var contentType = headers.getContentType() || '';
1770
1999
  var hasJSONContentType = contentType.indexOf('application/json') > -1;
@@ -1776,7 +2005,7 @@
1776
2005
  if (isFormData) {
1777
2006
  return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
1778
2007
  }
1779
- if (utils$1.isArrayBuffer(data) || utils$1.isBuffer(data) || utils$1.isStream(data) || utils$1.isFile(data) || utils$1.isBlob(data)) {
2008
+ 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)) {
1780
2009
  return data;
1781
2010
  }
1782
2011
  if (utils$1.isArrayBufferView(data)) {
@@ -1808,6 +2037,9 @@
1808
2037
  var transitional = this.transitional || defaults.transitional;
1809
2038
  var forcedJSONParsing = transitional && transitional.forcedJSONParsing;
1810
2039
  var JSONRequested = this.responseType === 'json';
2040
+ if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
2041
+ return data;
2042
+ }
1811
2043
  if (data && utils$1.isString(data) && (forcedJSONParsing && !this.responseType || JSONRequested)) {
1812
2044
  var silentJSONParsing = transitional && transitional.silentJSONParsing;
1813
2045
  var strictJSONParsing = !silentJSONParsing && JSONRequested;
@@ -1976,6 +2208,21 @@
1976
2208
  setHeaders(header, valueOrRewrite);
1977
2209
  } else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
1978
2210
  setHeaders(parseHeaders(header), valueOrRewrite);
2211
+ } else if (utils$1.isHeaders(header)) {
2212
+ var _iterator = _createForOfIteratorHelper(header.entries()),
2213
+ _step;
2214
+ try {
2215
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
2216
+ var _step$value = _slicedToArray(_step.value, 2),
2217
+ key = _step$value[0],
2218
+ value = _step$value[1];
2219
+ setHeader(value, key, rewrite);
2220
+ }
2221
+ } catch (err) {
2222
+ _iterator.e(err);
2223
+ } finally {
2224
+ _iterator.f();
2225
+ }
1979
2226
  } else {
1980
2227
  header != null && setHeader(valueOrRewrite, header, rewrite);
1981
2228
  }
@@ -2227,6 +2474,164 @@
2227
2474
  }
2228
2475
  }
2229
2476
 
2477
+ function parseProtocol(url) {
2478
+ var match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
2479
+ return match && match[1] || '';
2480
+ }
2481
+
2482
+ /**
2483
+ * Calculate data maxRate
2484
+ * @param {Number} [samplesCount= 10]
2485
+ * @param {Number} [min= 1000]
2486
+ * @returns {Function}
2487
+ */
2488
+ function speedometer(samplesCount, min) {
2489
+ samplesCount = samplesCount || 10;
2490
+ var bytes = new Array(samplesCount);
2491
+ var timestamps = new Array(samplesCount);
2492
+ var head = 0;
2493
+ var tail = 0;
2494
+ var firstSampleTS;
2495
+ min = min !== undefined ? min : 1000;
2496
+ return function push(chunkLength) {
2497
+ var now = Date.now();
2498
+ var startedAt = timestamps[tail];
2499
+ if (!firstSampleTS) {
2500
+ firstSampleTS = now;
2501
+ }
2502
+ bytes[head] = chunkLength;
2503
+ timestamps[head] = now;
2504
+ var i = tail;
2505
+ var bytesCount = 0;
2506
+ while (i !== head) {
2507
+ bytesCount += bytes[i++];
2508
+ i = i % samplesCount;
2509
+ }
2510
+ head = (head + 1) % samplesCount;
2511
+ if (head === tail) {
2512
+ tail = (tail + 1) % samplesCount;
2513
+ }
2514
+ if (now - firstSampleTS < min) {
2515
+ return;
2516
+ }
2517
+ var passed = startedAt && now - startedAt;
2518
+ return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
2519
+ };
2520
+ }
2521
+
2522
+ /**
2523
+ * Throttle decorator
2524
+ * @param {Function} fn
2525
+ * @param {Number} freq
2526
+ * @return {Function}
2527
+ */
2528
+ function throttle(fn, freq) {
2529
+ var timestamp = 0;
2530
+ var threshold = 1000 / freq;
2531
+ var timer = null;
2532
+ return function throttled() {
2533
+ var _arguments = arguments;
2534
+ var force = this === true;
2535
+ var now = Date.now();
2536
+ if (force || now - timestamp > threshold) {
2537
+ if (timer) {
2538
+ clearTimeout(timer);
2539
+ timer = null;
2540
+ }
2541
+ timestamp = now;
2542
+ return fn.apply(null, arguments);
2543
+ }
2544
+ if (!timer) {
2545
+ timer = setTimeout(function () {
2546
+ timer = null;
2547
+ timestamp = Date.now();
2548
+ return fn.apply(null, _arguments);
2549
+ }, threshold - (now - timestamp));
2550
+ }
2551
+ };
2552
+ }
2553
+
2554
+ var progressEventReducer = (function (listener, isDownloadStream) {
2555
+ var freq = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 3;
2556
+ var bytesNotified = 0;
2557
+ var _speedometer = speedometer(50, 250);
2558
+ return throttle(function (e) {
2559
+ var loaded = e.loaded;
2560
+ var total = e.lengthComputable ? e.total : undefined;
2561
+ var progressBytes = loaded - bytesNotified;
2562
+ var rate = _speedometer(progressBytes);
2563
+ var inRange = loaded <= total;
2564
+ bytesNotified = loaded;
2565
+ var data = {
2566
+ loaded: loaded,
2567
+ total: total,
2568
+ progress: total ? loaded / total : undefined,
2569
+ bytes: progressBytes,
2570
+ rate: rate ? rate : undefined,
2571
+ estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
2572
+ event: e,
2573
+ lengthComputable: total != null
2574
+ };
2575
+ data[isDownloadStream ? 'download' : 'upload'] = true;
2576
+ listener(data);
2577
+ }, freq);
2578
+ });
2579
+
2580
+ var isURLSameOrigin = platform.hasStandardBrowserEnv ?
2581
+ // Standard browser envs have full support of the APIs needed to test
2582
+ // whether the request URL is of the same origin as current location.
2583
+ function standardBrowserEnv() {
2584
+ var msie = /(msie|trident)/i.test(navigator.userAgent);
2585
+ var urlParsingNode = document.createElement('a');
2586
+ var originURL;
2587
+
2588
+ /**
2589
+ * Parse a URL to discover its components
2590
+ *
2591
+ * @param {String} url The URL to be parsed
2592
+ * @returns {Object}
2593
+ */
2594
+ function resolveURL(url) {
2595
+ var href = url;
2596
+ if (msie) {
2597
+ // IE needs attribute set twice to normalize properties
2598
+ urlParsingNode.setAttribute('href', href);
2599
+ href = urlParsingNode.href;
2600
+ }
2601
+ urlParsingNode.setAttribute('href', href);
2602
+
2603
+ // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
2604
+ return {
2605
+ href: urlParsingNode.href,
2606
+ protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
2607
+ host: urlParsingNode.host,
2608
+ search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
2609
+ hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
2610
+ hostname: urlParsingNode.hostname,
2611
+ port: urlParsingNode.port,
2612
+ pathname: urlParsingNode.pathname.charAt(0) === '/' ? urlParsingNode.pathname : '/' + urlParsingNode.pathname
2613
+ };
2614
+ }
2615
+ originURL = resolveURL(window.location.href);
2616
+
2617
+ /**
2618
+ * Determine if a URL shares the same origin as the current location
2619
+ *
2620
+ * @param {String} requestURL The URL to test
2621
+ * @returns {boolean} True if URL shares the same origin, otherwise false
2622
+ */
2623
+ return function isURLSameOrigin(requestURL) {
2624
+ var parsed = utils$1.isString(requestURL) ? resolveURL(requestURL) : requestURL;
2625
+ return parsed.protocol === originURL.protocol && parsed.host === originURL.host;
2626
+ };
2627
+ }() :
2628
+ // Non standard browser envs (web workers, react-native) lack needed support.
2629
+ function nonStandardBrowserEnv() {
2630
+ return function isURLSameOrigin() {
2631
+ return true;
2632
+ };
2633
+ }();
2634
+
2230
2635
  var cookies = platform.hasStandardBrowserEnv ?
2231
2636
  // Standard browser envs support document.cookie
2232
2637
  {
@@ -2298,173 +2703,179 @@
2298
2703
  return requestedURL;
2299
2704
  }
2300
2705
 
2301
- var isURLSameOrigin = platform.hasStandardBrowserEnv ?
2302
- // Standard browser envs have full support of the APIs needed to test
2303
- // whether the request URL is of the same origin as current location.
2304
- function standardBrowserEnv() {
2305
- var msie = /(msie|trident)/i.test(navigator.userAgent);
2306
- var urlParsingNode = document.createElement('a');
2307
- var originURL;
2308
-
2309
- /**
2310
- * Parse a URL to discover its components
2311
- *
2312
- * @param {String} url The URL to be parsed
2313
- * @returns {Object}
2314
- */
2315
- function resolveURL(url) {
2316
- var href = url;
2317
- if (msie) {
2318
- // IE needs attribute set twice to normalize properties
2319
- urlParsingNode.setAttribute('href', href);
2320
- href = urlParsingNode.href;
2321
- }
2322
- urlParsingNode.setAttribute('href', href);
2706
+ var headersToObject = function headersToObject(thing) {
2707
+ return thing instanceof AxiosHeaders$1 ? _objectSpread2({}, thing) : thing;
2708
+ };
2323
2709
 
2324
- // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
2325
- return {
2326
- href: urlParsingNode.href,
2327
- protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
2328
- host: urlParsingNode.host,
2329
- search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
2330
- hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
2331
- hostname: urlParsingNode.hostname,
2332
- port: urlParsingNode.port,
2333
- pathname: urlParsingNode.pathname.charAt(0) === '/' ? urlParsingNode.pathname : '/' + urlParsingNode.pathname
2334
- };
2710
+ /**
2711
+ * Config-specific merge-function which creates a new config-object
2712
+ * by merging two configuration objects together.
2713
+ *
2714
+ * @param {Object} config1
2715
+ * @param {Object} config2
2716
+ *
2717
+ * @returns {Object} New object resulting from merging config2 to config1
2718
+ */
2719
+ function mergeConfig(config1, config2) {
2720
+ // eslint-disable-next-line no-param-reassign
2721
+ config2 = config2 || {};
2722
+ var config = {};
2723
+ function getMergedValue(target, source, caseless) {
2724
+ if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
2725
+ return utils$1.merge.call({
2726
+ caseless: caseless
2727
+ }, target, source);
2728
+ } else if (utils$1.isPlainObject(source)) {
2729
+ return utils$1.merge({}, source);
2730
+ } else if (utils$1.isArray(source)) {
2731
+ return source.slice();
2732
+ }
2733
+ return source;
2335
2734
  }
2336
- originURL = resolveURL(window.location.href);
2337
2735
 
2338
- /**
2339
- * Determine if a URL shares the same origin as the current location
2340
- *
2341
- * @param {String} requestURL The URL to test
2342
- * @returns {boolean} True if URL shares the same origin, otherwise false
2343
- */
2344
- return function isURLSameOrigin(requestURL) {
2345
- var parsed = utils$1.isString(requestURL) ? resolveURL(requestURL) : requestURL;
2346
- return parsed.protocol === originURL.protocol && parsed.host === originURL.host;
2347
- };
2348
- }() :
2349
- // Non standard browser envs (web workers, react-native) lack needed support.
2350
- function nonStandardBrowserEnv() {
2351
- return function isURLSameOrigin() {
2352
- return true;
2353
- };
2354
- }();
2355
-
2356
- function parseProtocol(url) {
2357
- var match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
2358
- return match && match[1] || '';
2359
- }
2736
+ // eslint-disable-next-line consistent-return
2737
+ function mergeDeepProperties(a, b, caseless) {
2738
+ if (!utils$1.isUndefined(b)) {
2739
+ return getMergedValue(a, b, caseless);
2740
+ } else if (!utils$1.isUndefined(a)) {
2741
+ return getMergedValue(undefined, a, caseless);
2742
+ }
2743
+ }
2360
2744
 
2361
- /**
2362
- * Calculate data maxRate
2363
- * @param {Number} [samplesCount= 10]
2364
- * @param {Number} [min= 1000]
2365
- * @returns {Function}
2366
- */
2367
- function speedometer(samplesCount, min) {
2368
- samplesCount = samplesCount || 10;
2369
- var bytes = new Array(samplesCount);
2370
- var timestamps = new Array(samplesCount);
2371
- var head = 0;
2372
- var tail = 0;
2373
- var firstSampleTS;
2374
- min = min !== undefined ? min : 1000;
2375
- return function push(chunkLength) {
2376
- var now = Date.now();
2377
- var startedAt = timestamps[tail];
2378
- if (!firstSampleTS) {
2379
- firstSampleTS = now;
2745
+ // eslint-disable-next-line consistent-return
2746
+ function valueFromConfig2(a, b) {
2747
+ if (!utils$1.isUndefined(b)) {
2748
+ return getMergedValue(undefined, b);
2380
2749
  }
2381
- bytes[head] = chunkLength;
2382
- timestamps[head] = now;
2383
- var i = tail;
2384
- var bytesCount = 0;
2385
- while (i !== head) {
2386
- bytesCount += bytes[i++];
2387
- i = i % samplesCount;
2750
+ }
2751
+
2752
+ // eslint-disable-next-line consistent-return
2753
+ function defaultToConfig2(a, b) {
2754
+ if (!utils$1.isUndefined(b)) {
2755
+ return getMergedValue(undefined, b);
2756
+ } else if (!utils$1.isUndefined(a)) {
2757
+ return getMergedValue(undefined, a);
2388
2758
  }
2389
- head = (head + 1) % samplesCount;
2390
- if (head === tail) {
2391
- tail = (tail + 1) % samplesCount;
2759
+ }
2760
+
2761
+ // eslint-disable-next-line consistent-return
2762
+ function mergeDirectKeys(a, b, prop) {
2763
+ if (prop in config2) {
2764
+ return getMergedValue(a, b);
2765
+ } else if (prop in config1) {
2766
+ return getMergedValue(undefined, a);
2392
2767
  }
2393
- if (now - firstSampleTS < min) {
2394
- return;
2768
+ }
2769
+ var mergeMap = {
2770
+ url: valueFromConfig2,
2771
+ method: valueFromConfig2,
2772
+ data: valueFromConfig2,
2773
+ baseURL: defaultToConfig2,
2774
+ transformRequest: defaultToConfig2,
2775
+ transformResponse: defaultToConfig2,
2776
+ paramsSerializer: defaultToConfig2,
2777
+ timeout: defaultToConfig2,
2778
+ timeoutMessage: defaultToConfig2,
2779
+ withCredentials: defaultToConfig2,
2780
+ withXSRFToken: defaultToConfig2,
2781
+ adapter: defaultToConfig2,
2782
+ responseType: defaultToConfig2,
2783
+ xsrfCookieName: defaultToConfig2,
2784
+ xsrfHeaderName: defaultToConfig2,
2785
+ onUploadProgress: defaultToConfig2,
2786
+ onDownloadProgress: defaultToConfig2,
2787
+ decompress: defaultToConfig2,
2788
+ maxContentLength: defaultToConfig2,
2789
+ maxBodyLength: defaultToConfig2,
2790
+ beforeRedirect: defaultToConfig2,
2791
+ transport: defaultToConfig2,
2792
+ httpAgent: defaultToConfig2,
2793
+ httpsAgent: defaultToConfig2,
2794
+ cancelToken: defaultToConfig2,
2795
+ socketPath: defaultToConfig2,
2796
+ responseEncoding: defaultToConfig2,
2797
+ validateStatus: mergeDirectKeys,
2798
+ headers: function headers(a, b) {
2799
+ return mergeDeepProperties(headersToObject(a), headersToObject(b), true);
2395
2800
  }
2396
- var passed = startedAt && now - startedAt;
2397
- return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
2398
2801
  };
2802
+ utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
2803
+ var merge = mergeMap[prop] || mergeDeepProperties;
2804
+ var configValue = merge(config1[prop], config2[prop], prop);
2805
+ utils$1.isUndefined(configValue) && merge !== mergeDirectKeys || (config[prop] = configValue);
2806
+ });
2807
+ return config;
2399
2808
  }
2400
2809
 
2401
- function progressEventReducer(listener, isDownloadStream) {
2402
- var bytesNotified = 0;
2403
- var _speedometer = speedometer(50, 250);
2404
- return function (e) {
2405
- var loaded = e.loaded;
2406
- var total = e.lengthComputable ? e.total : undefined;
2407
- var progressBytes = loaded - bytesNotified;
2408
- var rate = _speedometer(progressBytes);
2409
- var inRange = loaded <= total;
2410
- bytesNotified = loaded;
2411
- var data = {
2412
- loaded: loaded,
2413
- total: total,
2414
- progress: total ? loaded / total : undefined,
2415
- bytes: progressBytes,
2416
- rate: rate ? rate : undefined,
2417
- estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
2418
- event: e
2419
- };
2420
- data[isDownloadStream ? 'download' : 'upload'] = true;
2421
- listener(data);
2422
- };
2423
- }
2810
+ var resolveConfig = (function (config) {
2811
+ var newConfig = mergeConfig({}, config);
2812
+ var data = newConfig.data,
2813
+ withXSRFToken = newConfig.withXSRFToken,
2814
+ xsrfHeaderName = newConfig.xsrfHeaderName,
2815
+ xsrfCookieName = newConfig.xsrfCookieName,
2816
+ headers = newConfig.headers,
2817
+ auth = newConfig.auth;
2818
+ newConfig.headers = headers = AxiosHeaders$1.from(headers);
2819
+ newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url), config.params, config.paramsSerializer);
2820
+
2821
+ // HTTP basic authentication
2822
+ if (auth) {
2823
+ headers.set('Authorization', 'Basic ' + btoa((auth.username || '') + ':' + (auth.password ? unescape(encodeURIComponent(auth.password)) : '')));
2824
+ }
2825
+ var contentType;
2826
+ if (utils$1.isFormData(data)) {
2827
+ if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
2828
+ headers.setContentType(undefined); // Let the browser set it
2829
+ } else if ((contentType = headers.getContentType()) !== false) {
2830
+ // fix semicolon duplication issue for ReactNative FormData implementation
2831
+ var _ref = contentType ? contentType.split(';').map(function (token) {
2832
+ return token.trim();
2833
+ }).filter(Boolean) : [],
2834
+ _ref2 = _toArray(_ref),
2835
+ type = _ref2[0],
2836
+ tokens = _ref2.slice(1);
2837
+ headers.setContentType([type || 'multipart/form-data'].concat(_toConsumableArray(tokens)).join('; '));
2838
+ }
2839
+ }
2840
+
2841
+ // Add xsrf header
2842
+ // This is only done if running in a standard browser environment.
2843
+ // Specifically not if we're in a web worker, or react-native.
2844
+
2845
+ if (platform.hasStandardBrowserEnv) {
2846
+ withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
2847
+ if (withXSRFToken || withXSRFToken !== false && isURLSameOrigin(newConfig.url)) {
2848
+ // Add xsrf header
2849
+ var xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
2850
+ if (xsrfValue) {
2851
+ headers.set(xsrfHeaderName, xsrfValue);
2852
+ }
2853
+ }
2854
+ }
2855
+ return newConfig;
2856
+ });
2857
+
2424
2858
  var isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
2425
2859
  var xhrAdapter = isXHRAdapterSupported && function (config) {
2426
2860
  return new Promise(function dispatchXhrRequest(resolve, reject) {
2427
- var requestData = config.data;
2428
- var requestHeaders = AxiosHeaders$1.from(config.headers).normalize();
2429
- var responseType = config.responseType,
2430
- withXSRFToken = config.withXSRFToken;
2861
+ var _config = resolveConfig(config);
2862
+ var requestData = _config.data;
2863
+ var requestHeaders = AxiosHeaders$1.from(_config.headers).normalize();
2864
+ var responseType = _config.responseType;
2431
2865
  var onCanceled;
2432
2866
  function done() {
2433
- if (config.cancelToken) {
2434
- config.cancelToken.unsubscribe(onCanceled);
2867
+ if (_config.cancelToken) {
2868
+ _config.cancelToken.unsubscribe(onCanceled);
2435
2869
  }
2436
- if (config.signal) {
2437
- config.signal.removeEventListener('abort', onCanceled);
2438
- }
2439
- }
2440
- var contentType;
2441
- if (utils$1.isFormData(requestData)) {
2442
- if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
2443
- requestHeaders.setContentType(false); // Let the browser set it
2444
- } else if ((contentType = requestHeaders.getContentType()) !== false) {
2445
- // fix semicolon duplication issue for ReactNative FormData implementation
2446
- var _ref = contentType ? contentType.split(';').map(function (token) {
2447
- return token.trim();
2448
- }).filter(Boolean) : [],
2449
- _ref2 = _toArray(_ref),
2450
- type = _ref2[0],
2451
- tokens = _ref2.slice(1);
2452
- requestHeaders.setContentType([type || 'multipart/form-data'].concat(_toConsumableArray(tokens)).join('; '));
2870
+ if (_config.signal) {
2871
+ _config.signal.removeEventListener('abort', onCanceled);
2453
2872
  }
2454
2873
  }
2455
2874
  var request = new XMLHttpRequest();
2456
-
2457
- // HTTP basic authentication
2458
- if (config.auth) {
2459
- var username = config.auth.username || '';
2460
- var password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';
2461
- requestHeaders.set('Authorization', 'Basic ' + btoa(username + ':' + password));
2462
- }
2463
- var fullPath = buildFullPath(config.baseURL, config.url);
2464
- request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
2875
+ request.open(_config.method.toUpperCase(), _config.url, true);
2465
2876
 
2466
2877
  // Set the request timeout in MS
2467
- request.timeout = config.timeout;
2878
+ request.timeout = _config.timeout;
2468
2879
  function onloadend() {
2469
2880
  if (!request) {
2470
2881
  return;
@@ -2519,7 +2930,7 @@
2519
2930
  if (!request) {
2520
2931
  return;
2521
2932
  }
2522
- reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, config, request));
2933
+ reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, _config, request));
2523
2934
 
2524
2935
  // Clean up request
2525
2936
  request = null;
@@ -2529,7 +2940,7 @@
2529
2940
  request.onerror = function handleError() {
2530
2941
  // Real errors are hidden from us by the browser
2531
2942
  // onerror should only fire if it's a network error
2532
- reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request));
2943
+ reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK, _config, request));
2533
2944
 
2534
2945
  // Clean up request
2535
2946
  request = null;
@@ -2537,31 +2948,17 @@
2537
2948
 
2538
2949
  // Handle timeout
2539
2950
  request.ontimeout = function handleTimeout() {
2540
- var timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';
2541
- var transitional = config.transitional || transitionalDefaults;
2542
- if (config.timeoutErrorMessage) {
2543
- timeoutErrorMessage = config.timeoutErrorMessage;
2951
+ var timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded';
2952
+ var transitional = _config.transitional || transitionalDefaults;
2953
+ if (_config.timeoutErrorMessage) {
2954
+ timeoutErrorMessage = _config.timeoutErrorMessage;
2544
2955
  }
2545
- reject(new AxiosError(timeoutErrorMessage, transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED, config, request));
2956
+ reject(new AxiosError(timeoutErrorMessage, transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED, _config, request));
2546
2957
 
2547
2958
  // Clean up request
2548
2959
  request = null;
2549
2960
  };
2550
2961
 
2551
- // Add xsrf header
2552
- // This is only done if running in a standard browser environment.
2553
- // Specifically not if we're in a web worker, or react-native.
2554
- if (platform.hasStandardBrowserEnv) {
2555
- withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(config));
2556
- if (withXSRFToken || withXSRFToken !== false && isURLSameOrigin(fullPath)) {
2557
- // Add xsrf header
2558
- var xsrfValue = config.xsrfHeaderName && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
2559
- if (xsrfValue) {
2560
- requestHeaders.set(config.xsrfHeaderName, xsrfValue);
2561
- }
2562
- }
2563
- }
2564
-
2565
2962
  // Remove Content-Type if data is undefined
2566
2963
  requestData === undefined && requestHeaders.setContentType(null);
2567
2964
 
@@ -2573,25 +2970,25 @@
2573
2970
  }
2574
2971
 
2575
2972
  // Add withCredentials to request if needed
2576
- if (!utils$1.isUndefined(config.withCredentials)) {
2577
- request.withCredentials = !!config.withCredentials;
2973
+ if (!utils$1.isUndefined(_config.withCredentials)) {
2974
+ request.withCredentials = !!_config.withCredentials;
2578
2975
  }
2579
2976
 
2580
2977
  // Add responseType to request if needed
2581
2978
  if (responseType && responseType !== 'json') {
2582
- request.responseType = config.responseType;
2979
+ request.responseType = _config.responseType;
2583
2980
  }
2584
2981
 
2585
2982
  // Handle progress if needed
2586
- if (typeof config.onDownloadProgress === 'function') {
2587
- request.addEventListener('progress', progressEventReducer(config.onDownloadProgress, true));
2983
+ if (typeof _config.onDownloadProgress === 'function') {
2984
+ request.addEventListener('progress', progressEventReducer(_config.onDownloadProgress, true));
2588
2985
  }
2589
2986
 
2590
2987
  // Not all browsers support upload events
2591
- if (typeof config.onUploadProgress === 'function' && request.upload) {
2592
- request.upload.addEventListener('progress', progressEventReducer(config.onUploadProgress));
2988
+ if (typeof _config.onUploadProgress === 'function' && request.upload) {
2989
+ request.upload.addEventListener('progress', progressEventReducer(_config.onUploadProgress));
2593
2990
  }
2594
- if (config.cancelToken || config.signal) {
2991
+ if (_config.cancelToken || _config.signal) {
2595
2992
  // Handle cancellation
2596
2993
  // eslint-disable-next-line func-names
2597
2994
  onCanceled = function onCanceled(cancel) {
@@ -2602,12 +2999,12 @@
2602
2999
  request.abort();
2603
3000
  request = null;
2604
3001
  };
2605
- config.cancelToken && config.cancelToken.subscribe(onCanceled);
2606
- if (config.signal) {
2607
- config.signal.aborted ? onCanceled() : config.signal.addEventListener('abort', onCanceled);
3002
+ _config.cancelToken && _config.cancelToken.subscribe(onCanceled);
3003
+ if (_config.signal) {
3004
+ _config.signal.aborted ? onCanceled() : _config.signal.addEventListener('abort', onCanceled);
2608
3005
  }
2609
3006
  }
2610
- var protocol = parseProtocol(fullPath);
3007
+ var protocol = parseProtocol(_config.url);
2611
3008
  if (protocol && platform.protocols.indexOf(protocol) === -1) {
2612
3009
  reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));
2613
3010
  return;
@@ -2618,9 +3015,409 @@
2618
3015
  });
2619
3016
  };
2620
3017
 
3018
+ var composeSignals = function composeSignals(signals, timeout) {
3019
+ var controller = new AbortController();
3020
+ var aborted;
3021
+ var onabort = function onabort(cancel) {
3022
+ if (!aborted) {
3023
+ aborted = true;
3024
+ unsubscribe();
3025
+ var err = cancel instanceof Error ? cancel : this.reason;
3026
+ controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err));
3027
+ }
3028
+ };
3029
+ var timer = timeout && setTimeout(function () {
3030
+ onabort(new AxiosError("timeout ".concat(timeout, " of ms exceeded"), AxiosError.ETIMEDOUT));
3031
+ }, timeout);
3032
+ var unsubscribe = function unsubscribe() {
3033
+ if (signals) {
3034
+ timer && clearTimeout(timer);
3035
+ timer = null;
3036
+ signals.forEach(function (signal) {
3037
+ signal && (signal.removeEventListener ? signal.removeEventListener('abort', onabort) : signal.unsubscribe(onabort));
3038
+ });
3039
+ signals = null;
3040
+ }
3041
+ };
3042
+ signals.forEach(function (signal) {
3043
+ return signal && signal.addEventListener && signal.addEventListener('abort', onabort);
3044
+ });
3045
+ var signal = controller.signal;
3046
+ signal.unsubscribe = unsubscribe;
3047
+ return [signal, function () {
3048
+ timer && clearTimeout(timer);
3049
+ timer = null;
3050
+ }];
3051
+ };
3052
+ var composeSignals$1 = composeSignals;
3053
+
3054
+ var streamChunk = /*#__PURE__*/_regeneratorRuntime().mark(function streamChunk(chunk, chunkSize) {
3055
+ var len, pos, end;
3056
+ return _regeneratorRuntime().wrap(function streamChunk$(_context) {
3057
+ while (1) switch (_context.prev = _context.next) {
3058
+ case 0:
3059
+ len = chunk.byteLength;
3060
+ if (!(!chunkSize || len < chunkSize)) {
3061
+ _context.next = 5;
3062
+ break;
3063
+ }
3064
+ _context.next = 4;
3065
+ return chunk;
3066
+ case 4:
3067
+ return _context.abrupt("return");
3068
+ case 5:
3069
+ pos = 0;
3070
+ case 6:
3071
+ if (!(pos < len)) {
3072
+ _context.next = 13;
3073
+ break;
3074
+ }
3075
+ end = pos + chunkSize;
3076
+ _context.next = 10;
3077
+ return chunk.slice(pos, end);
3078
+ case 10:
3079
+ pos = end;
3080
+ _context.next = 6;
3081
+ break;
3082
+ case 13:
3083
+ case "end":
3084
+ return _context.stop();
3085
+ }
3086
+ }, streamChunk);
3087
+ });
3088
+ var encoder = new TextEncoder();
3089
+ var readBytes = /*#__PURE__*/function () {
3090
+ var _ref = _wrapAsyncGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(iterable, chunkSize) {
3091
+ var _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, chunk;
3092
+ return _regeneratorRuntime().wrap(function _callee$(_context2) {
3093
+ while (1) switch (_context2.prev = _context2.next) {
3094
+ case 0:
3095
+ _iteratorAbruptCompletion = false;
3096
+ _didIteratorError = false;
3097
+ _context2.prev = 2;
3098
+ _iterator = _asyncIterator(iterable);
3099
+ case 4:
3100
+ _context2.next = 6;
3101
+ return _awaitAsyncGenerator(_iterator.next());
3102
+ case 6:
3103
+ if (!(_iteratorAbruptCompletion = !(_step = _context2.sent).done)) {
3104
+ _context2.next = 27;
3105
+ break;
3106
+ }
3107
+ chunk = _step.value;
3108
+ _context2.t0 = _asyncGeneratorDelegate;
3109
+ _context2.t1 = _asyncIterator;
3110
+ _context2.t2 = streamChunk;
3111
+ if (!ArrayBuffer.isView(chunk)) {
3112
+ _context2.next = 15;
3113
+ break;
3114
+ }
3115
+ _context2.t3 = chunk;
3116
+ _context2.next = 18;
3117
+ break;
3118
+ case 15:
3119
+ _context2.next = 17;
3120
+ return _awaitAsyncGenerator(encoder.encode(String(chunk)));
3121
+ case 17:
3122
+ _context2.t3 = _context2.sent;
3123
+ case 18:
3124
+ _context2.t4 = _context2.t3;
3125
+ _context2.t5 = chunkSize;
3126
+ _context2.t6 = (0, _context2.t2)(_context2.t4, _context2.t5);
3127
+ _context2.t7 = (0, _context2.t1)(_context2.t6);
3128
+ _context2.t8 = _awaitAsyncGenerator;
3129
+ return _context2.delegateYield((0, _context2.t0)(_context2.t7, _context2.t8), "t9", 24);
3130
+ case 24:
3131
+ _iteratorAbruptCompletion = false;
3132
+ _context2.next = 4;
3133
+ break;
3134
+ case 27:
3135
+ _context2.next = 33;
3136
+ break;
3137
+ case 29:
3138
+ _context2.prev = 29;
3139
+ _context2.t10 = _context2["catch"](2);
3140
+ _didIteratorError = true;
3141
+ _iteratorError = _context2.t10;
3142
+ case 33:
3143
+ _context2.prev = 33;
3144
+ _context2.prev = 34;
3145
+ if (!(_iteratorAbruptCompletion && _iterator["return"] != null)) {
3146
+ _context2.next = 38;
3147
+ break;
3148
+ }
3149
+ _context2.next = 38;
3150
+ return _awaitAsyncGenerator(_iterator["return"]());
3151
+ case 38:
3152
+ _context2.prev = 38;
3153
+ if (!_didIteratorError) {
3154
+ _context2.next = 41;
3155
+ break;
3156
+ }
3157
+ throw _iteratorError;
3158
+ case 41:
3159
+ return _context2.finish(38);
3160
+ case 42:
3161
+ return _context2.finish(33);
3162
+ case 43:
3163
+ case "end":
3164
+ return _context2.stop();
3165
+ }
3166
+ }, _callee, null, [[2, 29, 33, 43], [34,, 38, 42]]);
3167
+ }));
3168
+ return function readBytes(_x, _x2) {
3169
+ return _ref.apply(this, arguments);
3170
+ };
3171
+ }();
3172
+ var trackStream = function trackStream(stream, chunkSize, onProgress, onFinish) {
3173
+ var iterator = readBytes(stream, chunkSize);
3174
+ var bytes = 0;
3175
+ return new ReadableStream({
3176
+ type: 'bytes',
3177
+ pull: function pull(controller) {
3178
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
3179
+ var _yield$iterator$next, done, value, len;
3180
+ return _regeneratorRuntime().wrap(function _callee2$(_context3) {
3181
+ while (1) switch (_context3.prev = _context3.next) {
3182
+ case 0:
3183
+ _context3.next = 2;
3184
+ return iterator.next();
3185
+ case 2:
3186
+ _yield$iterator$next = _context3.sent;
3187
+ done = _yield$iterator$next.done;
3188
+ value = _yield$iterator$next.value;
3189
+ if (!done) {
3190
+ _context3.next = 9;
3191
+ break;
3192
+ }
3193
+ controller.close();
3194
+ onFinish();
3195
+ return _context3.abrupt("return");
3196
+ case 9:
3197
+ len = value.byteLength;
3198
+ onProgress && onProgress(bytes += len);
3199
+ controller.enqueue(new Uint8Array(value));
3200
+ case 12:
3201
+ case "end":
3202
+ return _context3.stop();
3203
+ }
3204
+ }, _callee2);
3205
+ }))();
3206
+ },
3207
+ cancel: function cancel(reason) {
3208
+ onFinish(reason);
3209
+ return iterator["return"]();
3210
+ }
3211
+ }, {
3212
+ highWaterMark: 2
3213
+ });
3214
+ };
3215
+
3216
+ var fetchProgressDecorator = function fetchProgressDecorator(total, fn) {
3217
+ var lengthComputable = total != null;
3218
+ return function (loaded) {
3219
+ return setTimeout(function () {
3220
+ return fn({
3221
+ lengthComputable: lengthComputable,
3222
+ total: total,
3223
+ loaded: loaded
3224
+ });
3225
+ });
3226
+ };
3227
+ };
3228
+ var isFetchSupported = typeof fetch !== 'undefined';
3229
+ var supportsRequestStreams = isFetchSupported && function () {
3230
+ var duplexAccessed = false;
3231
+ var hasContentType = new Request(platform.origin, {
3232
+ body: new ReadableStream(),
3233
+ method: 'POST',
3234
+ get duplex() {
3235
+ duplexAccessed = true;
3236
+ return 'half';
3237
+ }
3238
+ }).headers.has('Content-Type');
3239
+ return duplexAccessed && !hasContentType;
3240
+ }();
3241
+ var DEFAULT_CHUNK_SIZE = 64 * 1024;
3242
+ var resolvers = {
3243
+ stream: function stream(res) {
3244
+ return res.body;
3245
+ }
3246
+ };
3247
+ isFetchSupported && ['text', 'arrayBuffer', 'blob', 'formData'].forEach(function (type) {
3248
+ return [resolvers[type] = utils$1.isFunction(Response.prototype[type]) ? function (res) {
3249
+ return res[type]();
3250
+ } : function (_, config) {
3251
+ throw new AxiosError("Response type ".concat(type, " is not supported"), AxiosError.ERR_NOT_SUPPORT, config);
3252
+ }];
3253
+ });
3254
+ var getBodyLength = /*#__PURE__*/function () {
3255
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(body) {
3256
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
3257
+ while (1) switch (_context.prev = _context.next) {
3258
+ case 0:
3259
+ if (!utils$1.isBlob(body)) {
3260
+ _context.next = 2;
3261
+ break;
3262
+ }
3263
+ return _context.abrupt("return", body.size);
3264
+ case 2:
3265
+ if (!utils$1.isSpecCompliantForm(body)) {
3266
+ _context.next = 6;
3267
+ break;
3268
+ }
3269
+ _context.next = 5;
3270
+ return new Request(body).arrayBuffer();
3271
+ case 5:
3272
+ return _context.abrupt("return", _context.sent.byteLength);
3273
+ case 6:
3274
+ if (!utils$1.isArrayBufferView(body)) {
3275
+ _context.next = 8;
3276
+ break;
3277
+ }
3278
+ return _context.abrupt("return", body.byteLength);
3279
+ case 8:
3280
+ if (utils$1.isURLSearchParams(body)) {
3281
+ body = body + '';
3282
+ }
3283
+ if (!utils$1.isString(body)) {
3284
+ _context.next = 13;
3285
+ break;
3286
+ }
3287
+ _context.next = 12;
3288
+ return new TextEncoder().encode(body);
3289
+ case 12:
3290
+ return _context.abrupt("return", _context.sent.byteLength);
3291
+ case 13:
3292
+ case "end":
3293
+ return _context.stop();
3294
+ }
3295
+ }, _callee);
3296
+ }));
3297
+ return function getBodyLength(_x) {
3298
+ return _ref.apply(this, arguments);
3299
+ };
3300
+ }();
3301
+ var resolveBodyLength = /*#__PURE__*/function () {
3302
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(headers, body) {
3303
+ var length;
3304
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
3305
+ while (1) switch (_context2.prev = _context2.next) {
3306
+ case 0:
3307
+ length = utils$1.toFiniteNumber(headers.getContentLength());
3308
+ return _context2.abrupt("return", length == null ? getBodyLength(body) : length);
3309
+ case 2:
3310
+ case "end":
3311
+ return _context2.stop();
3312
+ }
3313
+ }, _callee2);
3314
+ }));
3315
+ return function resolveBodyLength(_x2, _x3) {
3316
+ return _ref2.apply(this, arguments);
3317
+ };
3318
+ }();
3319
+ var fetchAdapter = ( /*#__PURE__*/(function () {
3320
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(config) {
3321
+ var _resolveConfig, url, method, data, signal, cancelToken, timeout, onDownloadProgress, onUploadProgress, responseType, headers, _resolveConfig$withCr, withCredentials, fetchOptions, _ref4, _ref5, composedSignal, stopTimeout, finished, request, onFinish, requestContentLength, _request, contentTypeHeader, response, isStreamResponse, options, responseContentLength, responseData, code;
3322
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
3323
+ while (1) switch (_context3.prev = _context3.next) {
3324
+ case 0:
3325
+ _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;
3326
+ responseType = responseType ? (responseType + '').toLowerCase() : 'text';
3327
+ _ref4 = signal || cancelToken || timeout ? composeSignals$1([signal, cancelToken], timeout) : [], _ref5 = _slicedToArray(_ref4, 2), composedSignal = _ref5[0], stopTimeout = _ref5[1];
3328
+ onFinish = function onFinish() {
3329
+ !finished && setTimeout(function () {
3330
+ composedSignal && composedSignal.unsubscribe();
3331
+ });
3332
+ finished = true;
3333
+ };
3334
+ _context3.prev = 4;
3335
+ if (!(onUploadProgress && supportsRequestStreams && method !== 'get' && method !== 'head')) {
3336
+ _context3.next = 12;
3337
+ break;
3338
+ }
3339
+ _context3.next = 8;
3340
+ return resolveBodyLength(headers, data);
3341
+ case 8:
3342
+ requestContentLength = _context3.sent;
3343
+ _request = new Request(url, {
3344
+ method: method,
3345
+ body: data,
3346
+ duplex: "half"
3347
+ });
3348
+ if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
3349
+ headers.setContentType(contentTypeHeader);
3350
+ }
3351
+ data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, fetchProgressDecorator(requestContentLength, progressEventReducer(onUploadProgress)));
3352
+ case 12:
3353
+ if (!utils$1.isString(withCredentials)) {
3354
+ withCredentials = withCredentials ? 'cors' : 'omit';
3355
+ }
3356
+ request = new Request(url, _objectSpread2(_objectSpread2({}, fetchOptions), {}, {
3357
+ signal: composedSignal,
3358
+ method: method,
3359
+ headers: headers.normalize().toJSON(),
3360
+ body: data,
3361
+ duplex: "half",
3362
+ withCredentials: withCredentials
3363
+ }));
3364
+ _context3.next = 16;
3365
+ return fetch(request);
3366
+ case 16:
3367
+ response = _context3.sent;
3368
+ isStreamResponse = responseType === 'stream' || responseType === 'response';
3369
+ if (onDownloadProgress || isStreamResponse) {
3370
+ options = {};
3371
+ Object.getOwnPropertyNames(response).forEach(function (prop) {
3372
+ options[prop] = response[prop];
3373
+ });
3374
+ responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
3375
+ response = new Response(trackStream(response.body, DEFAULT_CHUNK_SIZE, onDownloadProgress && fetchProgressDecorator(responseContentLength, progressEventReducer(onDownloadProgress, true)), isStreamResponse && onFinish), options);
3376
+ }
3377
+ responseType = responseType || 'text';
3378
+ _context3.next = 22;
3379
+ return resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config);
3380
+ case 22:
3381
+ responseData = _context3.sent;
3382
+ !isStreamResponse && onFinish();
3383
+ stopTimeout && stopTimeout();
3384
+ _context3.next = 27;
3385
+ return new Promise(function (resolve, reject) {
3386
+ settle(resolve, reject, {
3387
+ data: responseData,
3388
+ headers: AxiosHeaders$1.from(response.headers),
3389
+ status: response.status,
3390
+ statusText: response.statusText,
3391
+ config: config,
3392
+ request: request
3393
+ });
3394
+ });
3395
+ case 27:
3396
+ return _context3.abrupt("return", _context3.sent);
3397
+ case 30:
3398
+ _context3.prev = 30;
3399
+ _context3.t0 = _context3["catch"](4);
3400
+ onFinish();
3401
+ code = _context3.t0.code;
3402
+ if (_context3.t0.name === 'NetworkError') {
3403
+ code = AxiosError.ERR_NETWORK;
3404
+ }
3405
+ throw AxiosError.from(_context3.t0, code, config, request);
3406
+ case 36:
3407
+ case "end":
3408
+ return _context3.stop();
3409
+ }
3410
+ }, _callee3, null, [[4, 30]]);
3411
+ }));
3412
+ return function (_x4) {
3413
+ return _ref3.apply(this, arguments);
3414
+ };
3415
+ })());
3416
+
2621
3417
  var knownAdapters = {
2622
3418
  http: httpAdapter,
2623
- xhr: xhrAdapter
3419
+ xhr: xhrAdapter,
3420
+ fetch: fetchAdapter
2624
3421
  };
2625
3422
  utils$1.forEach(knownAdapters, function (fn, value) {
2626
3423
  if (fn) {
@@ -2734,111 +3531,7 @@
2734
3531
  });
2735
3532
  }
2736
3533
 
2737
- var headersToObject = function headersToObject(thing) {
2738
- return thing instanceof AxiosHeaders$1 ? thing.toJSON() : thing;
2739
- };
2740
-
2741
- /**
2742
- * Config-specific merge-function which creates a new config-object
2743
- * by merging two configuration objects together.
2744
- *
2745
- * @param {Object} config1
2746
- * @param {Object} config2
2747
- *
2748
- * @returns {Object} New object resulting from merging config2 to config1
2749
- */
2750
- function mergeConfig(config1, config2) {
2751
- // eslint-disable-next-line no-param-reassign
2752
- config2 = config2 || {};
2753
- var config = {};
2754
- function getMergedValue(target, source, caseless) {
2755
- if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
2756
- return utils$1.merge.call({
2757
- caseless: caseless
2758
- }, target, source);
2759
- } else if (utils$1.isPlainObject(source)) {
2760
- return utils$1.merge({}, source);
2761
- } else if (utils$1.isArray(source)) {
2762
- return source.slice();
2763
- }
2764
- return source;
2765
- }
2766
-
2767
- // eslint-disable-next-line consistent-return
2768
- function mergeDeepProperties(a, b, caseless) {
2769
- if (!utils$1.isUndefined(b)) {
2770
- return getMergedValue(a, b, caseless);
2771
- } else if (!utils$1.isUndefined(a)) {
2772
- return getMergedValue(undefined, a, caseless);
2773
- }
2774
- }
2775
-
2776
- // eslint-disable-next-line consistent-return
2777
- function valueFromConfig2(a, b) {
2778
- if (!utils$1.isUndefined(b)) {
2779
- return getMergedValue(undefined, b);
2780
- }
2781
- }
2782
-
2783
- // eslint-disable-next-line consistent-return
2784
- function defaultToConfig2(a, b) {
2785
- if (!utils$1.isUndefined(b)) {
2786
- return getMergedValue(undefined, b);
2787
- } else if (!utils$1.isUndefined(a)) {
2788
- return getMergedValue(undefined, a);
2789
- }
2790
- }
2791
-
2792
- // eslint-disable-next-line consistent-return
2793
- function mergeDirectKeys(a, b, prop) {
2794
- if (prop in config2) {
2795
- return getMergedValue(a, b);
2796
- } else if (prop in config1) {
2797
- return getMergedValue(undefined, a);
2798
- }
2799
- }
2800
- var mergeMap = {
2801
- url: valueFromConfig2,
2802
- method: valueFromConfig2,
2803
- data: valueFromConfig2,
2804
- baseURL: defaultToConfig2,
2805
- transformRequest: defaultToConfig2,
2806
- transformResponse: defaultToConfig2,
2807
- paramsSerializer: defaultToConfig2,
2808
- timeout: defaultToConfig2,
2809
- timeoutMessage: defaultToConfig2,
2810
- withCredentials: defaultToConfig2,
2811
- withXSRFToken: defaultToConfig2,
2812
- adapter: defaultToConfig2,
2813
- responseType: defaultToConfig2,
2814
- xsrfCookieName: defaultToConfig2,
2815
- xsrfHeaderName: defaultToConfig2,
2816
- onUploadProgress: defaultToConfig2,
2817
- onDownloadProgress: defaultToConfig2,
2818
- decompress: defaultToConfig2,
2819
- maxContentLength: defaultToConfig2,
2820
- maxBodyLength: defaultToConfig2,
2821
- beforeRedirect: defaultToConfig2,
2822
- transport: defaultToConfig2,
2823
- httpAgent: defaultToConfig2,
2824
- httpsAgent: defaultToConfig2,
2825
- cancelToken: defaultToConfig2,
2826
- socketPath: defaultToConfig2,
2827
- responseEncoding: defaultToConfig2,
2828
- validateStatus: mergeDirectKeys,
2829
- headers: function headers(a, b) {
2830
- return mergeDeepProperties(headersToObject(a), headersToObject(b), true);
2831
- }
2832
- };
2833
- utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
2834
- var merge = mergeMap[prop] || mergeDeepProperties;
2835
- var configValue = merge(config1[prop], config2[prop], prop);
2836
- utils$1.isUndefined(configValue) && merge !== mergeDirectKeys || (config[prop] = configValue);
2837
- });
2838
- return config;
2839
- }
2840
-
2841
- var VERSION = "1.6.7";
3534
+ var VERSION = "1.7.0-beta.0";
2842
3535
 
2843
3536
  var validators$1 = {};
2844
3537
 
@@ -2944,38 +3637,36 @@
2944
3637
  */
2945
3638
  _createClass(Axios, [{
2946
3639
  key: "request",
2947
- value: function () {
3640
+ value: (function () {
2948
3641
  var _request2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(configOrUrl, config) {
2949
3642
  var dummy, stack;
2950
3643
  return _regeneratorRuntime().wrap(function _callee$(_context) {
2951
- while (1) {
2952
- switch (_context.prev = _context.next) {
2953
- case 0:
2954
- _context.prev = 0;
2955
- _context.next = 3;
2956
- return this._request(configOrUrl, config);
2957
- case 3:
2958
- return _context.abrupt("return", _context.sent);
2959
- case 6:
2960
- _context.prev = 6;
2961
- _context.t0 = _context["catch"](0);
2962
- if (_context.t0 instanceof Error) {
2963
- Error.captureStackTrace ? Error.captureStackTrace(dummy = {}) : dummy = new Error();
2964
-
2965
- // slice off the Error: ... line
2966
- stack = dummy.stack ? dummy.stack.replace(/^.+\n/, '') : '';
2967
- if (!_context.t0.stack) {
2968
- _context.t0.stack = stack;
2969
- // match without the 2 top stack lines
2970
- } else if (stack && !String(_context.t0.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) {
2971
- _context.t0.stack += '\n' + stack;
2972
- }
3644
+ while (1) switch (_context.prev = _context.next) {
3645
+ case 0:
3646
+ _context.prev = 0;
3647
+ _context.next = 3;
3648
+ return this._request(configOrUrl, config);
3649
+ case 3:
3650
+ return _context.abrupt("return", _context.sent);
3651
+ case 6:
3652
+ _context.prev = 6;
3653
+ _context.t0 = _context["catch"](0);
3654
+ if (_context.t0 instanceof Error) {
3655
+ Error.captureStackTrace ? Error.captureStackTrace(dummy = {}) : dummy = new Error();
3656
+
3657
+ // slice off the Error: ... line
3658
+ stack = dummy.stack ? dummy.stack.replace(/^.+\n/, '') : '';
3659
+ if (!_context.t0.stack) {
3660
+ _context.t0.stack = stack;
3661
+ // match without the 2 top stack lines
3662
+ } else if (stack && !String(_context.t0.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) {
3663
+ _context.t0.stack += '\n' + stack;
2973
3664
  }
2974
- throw _context.t0;
2975
- case 10:
2976
- case "end":
2977
- return _context.stop();
2978
- }
3665
+ }
3666
+ throw _context.t0;
3667
+ case 10:
3668
+ case "end":
3669
+ return _context.stop();
2979
3670
  }
2980
3671
  }, _callee, this, [[0, 6]]);
2981
3672
  }));
@@ -2983,7 +3674,7 @@
2983
3674
  return _request2.apply(this, arguments);
2984
3675
  }
2985
3676
  return request;
2986
- }()
3677
+ }())
2987
3678
  }, {
2988
3679
  key: "_request",
2989
3680
  value: function _request(configOrUrl, config) {