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