varsnap 1.8.4 → 1.9.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/dist/varsnap.js DELETED
@@ -1,1911 +0,0 @@
1
- /*
2
- * Varsnap.js v1.8.4
3
- */
4
- (function(exports) {
5
- !function(t) {
6
- if ("object" == typeof exports && "undefined" != typeof module) module.exports = t(); else if ("function" == typeof define && define.amd) define([], t); else {
7
- ("undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ? self : this).varsnap = t();
8
- }
9
- }(function() {
10
- var t, e, r, n = (t = function(t, r) {
11
- (function(t) {
12
- (function() {
13
- "use strict";
14
- function t(t) {
15
- if (t > 2147483647) throw new RangeError('The value "' + t + '" is invalid for option "size"');
16
- var e = new Uint8Array(t);
17
- return e.__proto__ = n.prototype, e;
18
- }
19
- function n(t, e, r) {
20
- if ("number" == typeof t) {
21
- if ("string" == typeof e) throw new TypeError('The "string" argument must be of type string. Received type number');
22
- return s(t);
23
- }
24
- return o(t, e, r);
25
- }
26
- function o(e, r, o) {
27
- if ("string" == typeof e) return function(e, r) {
28
- if ("string" == typeof r && "" !== r || (r = "utf8"),
29
- !n.isEncoding(r)) throw new TypeError("Unknown encoding: " + r);
30
- var o = 0 | f(e, r), i = t(o), s = i.write(e, r);
31
- return s !== o && (i = i.slice(0, s)), i;
32
- }(e, r);
33
- if (ArrayBuffer.isView(e)) return a(e);
34
- if (null == e) throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof e);
35
- if (L(e, ArrayBuffer) || e && L(e.buffer, ArrayBuffer)) return function(t, e, r) {
36
- if (e < 0 || t.byteLength < e) throw new RangeError('"offset" is outside of buffer bounds');
37
- if (t.byteLength < e + (r || 0)) throw new RangeError('"length" is outside of buffer bounds');
38
- var o;
39
- return (o = void 0 === e && void 0 === r ? new Uint8Array(t) : void 0 === r ? new Uint8Array(t, e) : new Uint8Array(t, e, r)).__proto__ = n.prototype,
40
- o;
41
- }(e, r, o);
42
- if ("number" == typeof e) throw new TypeError('The "value" argument must not be of type number. Received type number');
43
- var i = e.valueOf && e.valueOf();
44
- if (null != i && i !== e) return n.from(i, r, o);
45
- var s = function(e) {
46
- if (n.isBuffer(e)) {
47
- var r = 0 | u(e.length), o = t(r);
48
- return 0 === o.length || e.copy(o, 0, 0, r), o;
49
- }
50
- return void 0 !== e.length ? "number" != typeof e.length || I(e.length) ? t(0) : a(e) : "Buffer" === e.type && Array.isArray(e.data) ? a(e.data) : void 0;
51
- }(e);
52
- if (s) return s;
53
- if ("undefined" != typeof Symbol && null != Symbol.toPrimitive && "function" == typeof e[Symbol.toPrimitive]) return n.from(e[Symbol.toPrimitive]("string"), r, o);
54
- throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof e);
55
- }
56
- function i(t) {
57
- if ("number" != typeof t) throw new TypeError('"size" argument must be of type number');
58
- if (t < 0) throw new RangeError('The value "' + t + '" is invalid for option "size"');
59
- }
60
- function s(e) {
61
- return i(e), t(e < 0 ? 0 : 0 | u(e));
62
- }
63
- function a(e) {
64
- for (var r = e.length < 0 ? 0 : 0 | u(e.length), n = t(r), o = 0; o < r; o += 1) n[o] = 255 & e[o];
65
- return n;
66
- }
67
- function u(t) {
68
- if (t >= 2147483647) throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + 2147483647..toString(16) + " bytes");
69
- return 0 | t;
70
- }
71
- function f(t, e) {
72
- if (n.isBuffer(t)) return t.length;
73
- if (ArrayBuffer.isView(t) || L(t, ArrayBuffer)) return t.byteLength;
74
- if ("string" != typeof t) throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type ' + typeof t);
75
- var r = t.length, o = arguments.length > 2 && !0 === arguments[2];
76
- if (!o && 0 === r) return 0;
77
- for (var i = !1; ;) switch (e) {
78
- case "ascii":
79
- case "latin1":
80
- case "binary":
81
- return r;
82
-
83
- case "utf8":
84
- case "utf-8":
85
- return x(t).length;
86
-
87
- case "ucs2":
88
- case "ucs-2":
89
- case "utf16le":
90
- case "utf-16le":
91
- return 2 * r;
92
-
93
- case "hex":
94
- return r >>> 1;
95
-
96
- case "base64":
97
- return P(t).length;
98
-
99
- default:
100
- if (i) return o ? -1 : x(t).length;
101
- e = ("" + e).toLowerCase(), i = !0;
102
- }
103
- }
104
- function c(t, e, r) {
105
- var n = t[e];
106
- t[e] = t[r], t[r] = n;
107
- }
108
- function l(t, e, r, o, i) {
109
- if (0 === t.length) return -1;
110
- if ("string" == typeof r ? (o = r, r = 0) : r > 2147483647 ? r = 2147483647 : r < -2147483648 && (r = -2147483648),
111
- I(r = +r) && (r = i ? 0 : t.length - 1), r < 0 && (r = t.length + r),
112
- r >= t.length) {
113
- if (i) return -1;
114
- r = t.length - 1;
115
- } else if (r < 0) {
116
- if (!i) return -1;
117
- r = 0;
118
- }
119
- if ("string" == typeof e && (e = n.from(e, o)), n.isBuffer(e)) return 0 === e.length ? -1 : h(t, e, r, o, i);
120
- if ("number" == typeof e) return e &= 255, "function" == typeof Uint8Array.prototype.indexOf ? i ? Uint8Array.prototype.indexOf.call(t, e, r) : Uint8Array.prototype.lastIndexOf.call(t, e, r) : h(t, [ e ], r, o, i);
121
- throw new TypeError("val must be string, number or Buffer");
122
- }
123
- function h(t, e, r, n, o) {
124
- var i, s = 1, a = t.length, u = e.length;
125
- if (void 0 !== n && ("ucs2" === (n = String(n).toLowerCase()) || "ucs-2" === n || "utf16le" === n || "utf-16le" === n)) {
126
- if (t.length < 2 || e.length < 2) return -1;
127
- s = 2, a /= 2, u /= 2, r /= 2;
128
- }
129
- function f(t, e) {
130
- return 1 === s ? t[e] : t.readUInt16BE(e * s);
131
- }
132
- if (o) {
133
- var c = -1;
134
- for (i = r; i < a; i++) if (f(t, i) === f(e, -1 === c ? 0 : i - c)) {
135
- if (-1 === c && (c = i), i - c + 1 === u) return c * s;
136
- } else -1 !== c && (i -= i - c), c = -1;
137
- } else for (r + u > a && (r = a - u), i = r; i >= 0; i--) {
138
- for (var l = !0, h = 0; h < u; h++) if (f(t, i + h) !== f(e, h)) {
139
- l = !1;
140
- break;
141
- }
142
- if (l) return i;
143
- }
144
- return -1;
145
- }
146
- function p(t, e, r, n) {
147
- r = Number(r) || 0;
148
- var o = t.length - r;
149
- n ? (n = Number(n)) > o && (n = o) : n = o;
150
- var i = e.length;
151
- n > i / 2 && (n = i / 2);
152
- for (var s = 0; s < n; ++s) {
153
- var a = parseInt(e.substr(2 * s, 2), 16);
154
- if (I(a)) return s;
155
- t[r + s] = a;
156
- }
157
- return s;
158
- }
159
- function d(t, e, r, n) {
160
- return N(x(e, t.length - r), t, r, n);
161
- }
162
- function g(t, e, r, n) {
163
- return N(function(t) {
164
- for (var e = [], r = 0; r < t.length; ++r) e.push(255 & t.charCodeAt(r));
165
- return e;
166
- }(e), t, r, n);
167
- }
168
- function y(t, e, r, n) {
169
- return g(t, e, r, n);
170
- }
171
- function v(t, e, r, n) {
172
- return N(P(e), t, r, n);
173
- }
174
- function m(t, e, r, n) {
175
- return N(function(t, e) {
176
- for (var r, n, o, i = [], s = 0; s < t.length && !((e -= 2) < 0); ++s) n = (r = t.charCodeAt(s)) >> 8,
177
- o = r % 256, i.push(o), i.push(n);
178
- return i;
179
- }(e, t.length - r), t, r, n);
180
- }
181
- function w(t, e, r) {
182
- return 0 === e && r === t.length ? j.fromByteArray(t) : j.fromByteArray(t.slice(e, r));
183
- }
184
- function b(t, e, r) {
185
- r = Math.min(t.length, r);
186
- for (var n = [], o = e; o < r; ) {
187
- var i, s, a, u, f = t[o], c = null, l = f > 239 ? 4 : f > 223 ? 3 : f > 191 ? 2 : 1;
188
- if (o + l <= r) switch (l) {
189
- case 1:
190
- f < 128 && (c = f);
191
- break;
192
-
193
- case 2:
194
- 128 == (192 & (i = t[o + 1])) && (u = (31 & f) << 6 | 63 & i) > 127 && (c = u);
195
- break;
196
-
197
- case 3:
198
- i = t[o + 1], s = t[o + 2], 128 == (192 & i) && 128 == (192 & s) && (u = (15 & f) << 12 | (63 & i) << 6 | 63 & s) > 2047 && (u < 55296 || u > 57343) && (c = u);
199
- break;
200
-
201
- case 4:
202
- i = t[o + 1], s = t[o + 2], a = t[o + 3], 128 == (192 & i) && 128 == (192 & s) && 128 == (192 & a) && (u = (15 & f) << 18 | (63 & i) << 12 | (63 & s) << 6 | 63 & a) > 65535 && u < 1114112 && (c = u);
203
- }
204
- null === c ? (c = 65533, l = 1) : c > 65535 && (c -= 65536,
205
- n.push(c >>> 10 & 1023 | 55296), c = 56320 | 1023 & c),
206
- n.push(c), o += l;
207
- }
208
- return function(t) {
209
- var e = t.length;
210
- if (e <= E) return String.fromCharCode.apply(String, t);
211
- for (var r = "", n = 0; n < e; ) r += String.fromCharCode.apply(String, t.slice(n, n += E));
212
- return r;
213
- }(n);
214
- }
215
- r.Buffer = n, r.INSPECT_MAX_BYTES = 50, n.TYPED_ARRAY_SUPPORT = function() {
216
- try {
217
- var t = new Uint8Array(1);
218
- return t.__proto__ = {
219
- __proto__: Uint8Array.prototype,
220
- foo: function() {
221
- return 42;
222
- }
223
- }, 42 === t.foo();
224
- } catch (e) {
225
- return !1;
226
- }
227
- }(), n.TYPED_ARRAY_SUPPORT || "undefined" == typeof console || "function" != typeof console.error || console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),
228
- Object.defineProperty(n.prototype, "parent", {
229
- enumerable: !0,
230
- get: function() {
231
- if (n.isBuffer(this)) return this.buffer;
232
- }
233
- }), Object.defineProperty(n.prototype, "offset", {
234
- enumerable: !0,
235
- get: function() {
236
- if (n.isBuffer(this)) return this.byteOffset;
237
- }
238
- }), "undefined" != typeof Symbol && null != Symbol.species && n[Symbol.species] === n && Object.defineProperty(n, Symbol.species, {
239
- value: null,
240
- configurable: !0,
241
- enumerable: !1,
242
- writable: !1
243
- }), n.poolSize = 8192, n.from = function(t, e, r) {
244
- return o(t, e, r);
245
- }, n.prototype.__proto__ = Uint8Array.prototype, n.__proto__ = Uint8Array,
246
- n.alloc = function(e, r, n) {
247
- return function(e, r, n) {
248
- return i(e), e <= 0 ? t(e) : void 0 !== r ? "string" == typeof n ? t(e).fill(r, n) : t(e).fill(r) : t(e);
249
- }(e, r, n);
250
- }, n.allocUnsafe = function(t) {
251
- return s(t);
252
- }, n.allocUnsafeSlow = function(t) {
253
- return s(t);
254
- }, n.isBuffer = function(t) {
255
- return null != t && !0 === t._isBuffer && t !== n.prototype;
256
- }, n.compare = function(t, e) {
257
- if (L(t, Uint8Array) && (t = n.from(t, t.offset, t.byteLength)),
258
- L(e, Uint8Array) && (e = n.from(e, e.offset, e.byteLength)),
259
- !n.isBuffer(t) || !n.isBuffer(e)) throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');
260
- if (t === e) return 0;
261
- for (var r = t.length, o = e.length, i = 0, s = Math.min(r, o); i < s; ++i) if (t[i] !== e[i]) {
262
- r = t[i], o = e[i];
263
- break;
264
- }
265
- return r < o ? -1 : o < r ? 1 : 0;
266
- }, n.isEncoding = function(t) {
267
- switch (String(t).toLowerCase()) {
268
- case "hex":
269
- case "utf8":
270
- case "utf-8":
271
- case "ascii":
272
- case "latin1":
273
- case "binary":
274
- case "base64":
275
- case "ucs2":
276
- case "ucs-2":
277
- case "utf16le":
278
- case "utf-16le":
279
- return !0;
280
-
281
- default:
282
- return !1;
283
- }
284
- }, n.concat = function(t, e) {
285
- if (!Array.isArray(t)) throw new TypeError('"list" argument must be an Array of Buffers');
286
- if (0 === t.length) return n.alloc(0);
287
- var r;
288
- if (void 0 === e) for (e = 0, r = 0; r < t.length; ++r) e += t[r].length;
289
- var o = n.allocUnsafe(e), i = 0;
290
- for (r = 0; r < t.length; ++r) {
291
- var s = t[r];
292
- if (L(s, Uint8Array) && (s = n.from(s)), !n.isBuffer(s)) throw new TypeError('"list" argument must be an Array of Buffers');
293
- s.copy(o, i), i += s.length;
294
- }
295
- return o;
296
- }, n.byteLength = f, n.prototype._isBuffer = !0, n.prototype.swap16 = function() {
297
- var t = this.length;
298
- if (t % 2 != 0) throw new RangeError("Buffer size must be a multiple of 16-bits");
299
- for (var e = 0; e < t; e += 2) c(this, e, e + 1);
300
- return this;
301
- }, n.prototype.swap32 = function() {
302
- var t = this.length;
303
- if (t % 4 != 0) throw new RangeError("Buffer size must be a multiple of 32-bits");
304
- for (var e = 0; e < t; e += 4) c(this, e, e + 3), c(this, e + 1, e + 2);
305
- return this;
306
- }, n.prototype.swap64 = function() {
307
- var t = this.length;
308
- if (t % 8 != 0) throw new RangeError("Buffer size must be a multiple of 64-bits");
309
- for (var e = 0; e < t; e += 8) c(this, e, e + 7), c(this, e + 1, e + 6),
310
- c(this, e + 2, e + 5), c(this, e + 3, e + 4);
311
- return this;
312
- }, n.prototype.toString = function() {
313
- var t = this.length;
314
- return 0 === t ? "" : 0 === arguments.length ? b(this, 0, t) : function(t, e, r) {
315
- var n = !1;
316
- if ((void 0 === e || e < 0) && (e = 0), e > this.length) return "";
317
- if ((void 0 === r || r > this.length) && (r = this.length),
318
- r <= 0) return "";
319
- if ((r >>>= 0) <= (e >>>= 0)) return "";
320
- for (t || (t = "utf8"); ;) switch (t) {
321
- case "hex":
322
- return S(this, e, r);
323
-
324
- case "utf8":
325
- case "utf-8":
326
- return b(this, e, r);
327
-
328
- case "ascii":
329
- return A(this, e, r);
330
-
331
- case "latin1":
332
- case "binary":
333
- return T(this, e, r);
334
-
335
- case "base64":
336
- return w(this, e, r);
337
-
338
- case "ucs2":
339
- case "ucs-2":
340
- case "utf16le":
341
- case "utf-16le":
342
- return _(this, e, r);
343
-
344
- default:
345
- if (n) throw new TypeError("Unknown encoding: " + t);
346
- t = (t + "").toLowerCase(), n = !0;
347
- }
348
- }.apply(this, arguments);
349
- }, n.prototype.toLocaleString = n.prototype.toString, n.prototype.equals = function(t) {
350
- if (!n.isBuffer(t)) throw new TypeError("Argument must be a Buffer");
351
- return this === t || 0 === n.compare(this, t);
352
- }, n.prototype.inspect = function() {
353
- var t = "", e = r.INSPECT_MAX_BYTES;
354
- return t = this.toString("hex", 0, e).replace(/(.{2})/g, "$1 ").trim(),
355
- this.length > e && (t += " ... "), "<Buffer " + t + ">";
356
- }, n.prototype.compare = function(t, e, r, o, i) {
357
- if (L(t, Uint8Array) && (t = n.from(t, t.offset, t.byteLength)),
358
- !n.isBuffer(t)) throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type ' + typeof t);
359
- if (void 0 === e && (e = 0), void 0 === r && (r = t ? t.length : 0),
360
- void 0 === o && (o = 0), void 0 === i && (i = this.length),
361
- e < 0 || r > t.length || o < 0 || i > this.length) throw new RangeError("out of range index");
362
- if (o >= i && e >= r) return 0;
363
- if (o >= i) return -1;
364
- if (e >= r) return 1;
365
- if (this === t) return 0;
366
- for (var s = (i >>>= 0) - (o >>>= 0), a = (r >>>= 0) - (e >>>= 0), u = Math.min(s, a), f = this.slice(o, i), c = t.slice(e, r), l = 0; l < u; ++l) if (f[l] !== c[l]) {
367
- s = f[l], a = c[l];
368
- break;
369
- }
370
- return s < a ? -1 : a < s ? 1 : 0;
371
- }, n.prototype.includes = function(t, e, r) {
372
- return -1 !== this.indexOf(t, e, r);
373
- }, n.prototype.indexOf = function(t, e, r) {
374
- return l(this, t, e, r, !0);
375
- }, n.prototype.lastIndexOf = function(t, e, r) {
376
- return l(this, t, e, r, !1);
377
- }, n.prototype.write = function(t, e, r, n) {
378
- if (void 0 === e) n = "utf8", r = this.length, e = 0; else if (void 0 === r && "string" == typeof e) n = e,
379
- r = this.length, e = 0; else {
380
- if (!isFinite(e)) throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");
381
- e >>>= 0, isFinite(r) ? (r >>>= 0, void 0 === n && (n = "utf8")) : (n = r,
382
- r = void 0);
383
- }
384
- var o = this.length - e;
385
- if ((void 0 === r || r > o) && (r = o), t.length > 0 && (r < 0 || e < 0) || e > this.length) throw new RangeError("Attempt to write outside buffer bounds");
386
- n || (n = "utf8");
387
- for (var i = !1; ;) switch (n) {
388
- case "hex":
389
- return p(this, t, e, r);
390
-
391
- case "utf8":
392
- case "utf-8":
393
- return d(this, t, e, r);
394
-
395
- case "ascii":
396
- return g(this, t, e, r);
397
-
398
- case "latin1":
399
- case "binary":
400
- return y(this, t, e, r);
401
-
402
- case "base64":
403
- return v(this, t, e, r);
404
-
405
- case "ucs2":
406
- case "ucs-2":
407
- case "utf16le":
408
- case "utf-16le":
409
- return m(this, t, e, r);
410
-
411
- default:
412
- if (i) throw new TypeError("Unknown encoding: " + n);
413
- n = ("" + n).toLowerCase(), i = !0;
414
- }
415
- }, n.prototype.toJSON = function() {
416
- return {
417
- type: "Buffer",
418
- data: Array.prototype.slice.call(this._arr || this, 0)
419
- };
420
- };
421
- var E = 4096;
422
- function A(t, e, r) {
423
- var n = "";
424
- r = Math.min(t.length, r);
425
- for (var o = e; o < r; ++o) n += String.fromCharCode(127 & t[o]);
426
- return n;
427
- }
428
- function T(t, e, r) {
429
- var n = "";
430
- r = Math.min(t.length, r);
431
- for (var o = e; o < r; ++o) n += String.fromCharCode(t[o]);
432
- return n;
433
- }
434
- function S(t, e, r) {
435
- var n, o = t.length;
436
- (!e || e < 0) && (e = 0), (!r || r < 0 || r > o) && (r = o);
437
- for (var i = "", s = e; s < r; ++s) i += (n = t[s]) < 16 ? "0" + n.toString(16) : n.toString(16);
438
- return i;
439
- }
440
- function _(t, e, r) {
441
- for (var n = t.slice(e, r), o = "", i = 0; i < n.length; i += 2) o += String.fromCharCode(n[i] + 256 * n[i + 1]);
442
- return o;
443
- }
444
- function R(t, e, r) {
445
- if (t % 1 != 0 || t < 0) throw new RangeError("offset is not uint");
446
- if (t + e > r) throw new RangeError("Trying to access beyond buffer length");
447
- }
448
- function O(t, e, r, o, i, s) {
449
- if (!n.isBuffer(t)) throw new TypeError('"buffer" argument must be a Buffer instance');
450
- if (e > i || e < s) throw new RangeError('"value" argument is out of bounds');
451
- if (r + o > t.length) throw new RangeError("Index out of range");
452
- }
453
- function C(t, e, r, n, o, i) {
454
- if (r + n > t.length) throw new RangeError("Index out of range");
455
- if (r < 0) throw new RangeError("Index out of range");
456
- }
457
- function B(t, e, r, n, o) {
458
- return e = +e, r >>>= 0, o || C(t, 0, r, 4), q.write(t, e, r, n, 23, 4),
459
- r + 4;
460
- }
461
- function U(t, e, r, n, o) {
462
- return e = +e, r >>>= 0, o || C(t, 0, r, 8), q.write(t, e, r, n, 52, 8),
463
- r + 8;
464
- }
465
- n.prototype.slice = function(t, e) {
466
- var r = this.length;
467
- (t = ~~t) < 0 ? (t += r) < 0 && (t = 0) : t > r && (t = r),
468
- (e = void 0 === e ? r : ~~e) < 0 ? (e += r) < 0 && (e = 0) : e > r && (e = r),
469
- e < t && (e = t);
470
- var o = this.subarray(t, e);
471
- return o.__proto__ = n.prototype, o;
472
- }, n.prototype.readUIntLE = function(t, e, r) {
473
- t >>>= 0, e >>>= 0, r || R(t, e, this.length);
474
- for (var n = this[t], o = 1, i = 0; ++i < e && (o *= 256); ) n += this[t + i] * o;
475
- return n;
476
- }, n.prototype.readUIntBE = function(t, e, r) {
477
- t >>>= 0, e >>>= 0, r || R(t, e, this.length);
478
- for (var n = this[t + --e], o = 1; e > 0 && (o *= 256); ) n += this[t + --e] * o;
479
- return n;
480
- }, n.prototype.readUInt8 = function(t, e) {
481
- return t >>>= 0, e || R(t, 1, this.length), this[t];
482
- }, n.prototype.readUInt16LE = function(t, e) {
483
- return t >>>= 0, e || R(t, 2, this.length), this[t] | this[t + 1] << 8;
484
- }, n.prototype.readUInt16BE = function(t, e) {
485
- return t >>>= 0, e || R(t, 2, this.length), this[t] << 8 | this[t + 1];
486
- }, n.prototype.readUInt32LE = function(t, e) {
487
- return t >>>= 0, e || R(t, 4, this.length), (this[t] | this[t + 1] << 8 | this[t + 2] << 16) + 16777216 * this[t + 3];
488
- }, n.prototype.readUInt32BE = function(t, e) {
489
- return t >>>= 0, e || R(t, 4, this.length), 16777216 * this[t] + (this[t + 1] << 16 | this[t + 2] << 8 | this[t + 3]);
490
- }, n.prototype.readIntLE = function(t, e, r) {
491
- t >>>= 0, e >>>= 0, r || R(t, e, this.length);
492
- for (var n = this[t], o = 1, i = 0; ++i < e && (o *= 256); ) n += this[t + i] * o;
493
- return n >= (o *= 128) && (n -= Math.pow(2, 8 * e)), n;
494
- }, n.prototype.readIntBE = function(t, e, r) {
495
- t >>>= 0, e >>>= 0, r || R(t, e, this.length);
496
- for (var n = e, o = 1, i = this[t + --n]; n > 0 && (o *= 256); ) i += this[t + --n] * o;
497
- return i >= (o *= 128) && (i -= Math.pow(2, 8 * e)), i;
498
- }, n.prototype.readInt8 = function(t, e) {
499
- return t >>>= 0, e || R(t, 1, this.length), 128 & this[t] ? -1 * (255 - this[t] + 1) : this[t];
500
- }, n.prototype.readInt16LE = function(t, e) {
501
- t >>>= 0, e || R(t, 2, this.length);
502
- var r = this[t] | this[t + 1] << 8;
503
- return 32768 & r ? 4294901760 | r : r;
504
- }, n.prototype.readInt16BE = function(t, e) {
505
- t >>>= 0, e || R(t, 2, this.length);
506
- var r = this[t + 1] | this[t] << 8;
507
- return 32768 & r ? 4294901760 | r : r;
508
- }, n.prototype.readInt32LE = function(t, e) {
509
- return t >>>= 0, e || R(t, 4, this.length), this[t] | this[t + 1] << 8 | this[t + 2] << 16 | this[t + 3] << 24;
510
- }, n.prototype.readInt32BE = function(t, e) {
511
- return t >>>= 0, e || R(t, 4, this.length), this[t] << 24 | this[t + 1] << 16 | this[t + 2] << 8 | this[t + 3];
512
- }, n.prototype.readFloatLE = function(t, e) {
513
- return t >>>= 0, e || R(t, 4, this.length), q.read(this, t, !0, 23, 4);
514
- }, n.prototype.readFloatBE = function(t, e) {
515
- return t >>>= 0, e || R(t, 4, this.length), q.read(this, t, !1, 23, 4);
516
- }, n.prototype.readDoubleLE = function(t, e) {
517
- return t >>>= 0, e || R(t, 8, this.length), q.read(this, t, !0, 52, 8);
518
- }, n.prototype.readDoubleBE = function(t, e) {
519
- return t >>>= 0, e || R(t, 8, this.length), q.read(this, t, !1, 52, 8);
520
- }, n.prototype.writeUIntLE = function(t, e, r, n) {
521
- t = +t, e >>>= 0, r >>>= 0, n || O(this, t, e, r, Math.pow(2, 8 * r) - 1, 0);
522
- var o = 1, i = 0;
523
- for (this[e] = 255 & t; ++i < r && (o *= 256); ) this[e + i] = t / o & 255;
524
- return e + r;
525
- }, n.prototype.writeUIntBE = function(t, e, r, n) {
526
- t = +t, e >>>= 0, r >>>= 0, n || O(this, t, e, r, Math.pow(2, 8 * r) - 1, 0);
527
- var o = r - 1, i = 1;
528
- for (this[e + o] = 255 & t; --o >= 0 && (i *= 256); ) this[e + o] = t / i & 255;
529
- return e + r;
530
- }, n.prototype.writeUInt8 = function(t, e, r) {
531
- return t = +t, e >>>= 0, r || O(this, t, e, 1, 255, 0),
532
- this[e] = 255 & t, e + 1;
533
- }, n.prototype.writeUInt16LE = function(t, e, r) {
534
- return t = +t, e >>>= 0, r || O(this, t, e, 2, 65535, 0),
535
- this[e] = 255 & t, this[e + 1] = t >>> 8, e + 2;
536
- }, n.prototype.writeUInt16BE = function(t, e, r) {
537
- return t = +t, e >>>= 0, r || O(this, t, e, 2, 65535, 0),
538
- this[e] = t >>> 8, this[e + 1] = 255 & t, e + 2;
539
- }, n.prototype.writeUInt32LE = function(t, e, r) {
540
- return t = +t, e >>>= 0, r || O(this, t, e, 4, 4294967295, 0),
541
- this[e + 3] = t >>> 24, this[e + 2] = t >>> 16, this[e + 1] = t >>> 8,
542
- this[e] = 255 & t, e + 4;
543
- }, n.prototype.writeUInt32BE = function(t, e, r) {
544
- return t = +t, e >>>= 0, r || O(this, t, e, 4, 4294967295, 0),
545
- this[e] = t >>> 24, this[e + 1] = t >>> 16, this[e + 2] = t >>> 8,
546
- this[e + 3] = 255 & t, e + 4;
547
- }, n.prototype.writeIntLE = function(t, e, r, n) {
548
- if (t = +t, e >>>= 0, !n) {
549
- var o = Math.pow(2, 8 * r - 1);
550
- O(this, t, e, r, o - 1, -o);
551
- }
552
- var i = 0, s = 1, a = 0;
553
- for (this[e] = 255 & t; ++i < r && (s *= 256); ) t < 0 && 0 === a && 0 !== this[e + i - 1] && (a = 1),
554
- this[e + i] = (t / s >> 0) - a & 255;
555
- return e + r;
556
- }, n.prototype.writeIntBE = function(t, e, r, n) {
557
- if (t = +t, e >>>= 0, !n) {
558
- var o = Math.pow(2, 8 * r - 1);
559
- O(this, t, e, r, o - 1, -o);
560
- }
561
- var i = r - 1, s = 1, a = 0;
562
- for (this[e + i] = 255 & t; --i >= 0 && (s *= 256); ) t < 0 && 0 === a && 0 !== this[e + i + 1] && (a = 1),
563
- this[e + i] = (t / s >> 0) - a & 255;
564
- return e + r;
565
- }, n.prototype.writeInt8 = function(t, e, r) {
566
- return t = +t, e >>>= 0, r || O(this, t, e, 1, 127, -128),
567
- t < 0 && (t = 255 + t + 1), this[e] = 255 & t, e + 1;
568
- }, n.prototype.writeInt16LE = function(t, e, r) {
569
- return t = +t, e >>>= 0, r || O(this, t, e, 2, 32767, -32768),
570
- this[e] = 255 & t, this[e + 1] = t >>> 8, e + 2;
571
- }, n.prototype.writeInt16BE = function(t, e, r) {
572
- return t = +t, e >>>= 0, r || O(this, t, e, 2, 32767, -32768),
573
- this[e] = t >>> 8, this[e + 1] = 255 & t, e + 2;
574
- }, n.prototype.writeInt32LE = function(t, e, r) {
575
- return t = +t, e >>>= 0, r || O(this, t, e, 4, 2147483647, -2147483648),
576
- this[e] = 255 & t, this[e + 1] = t >>> 8, this[e + 2] = t >>> 16,
577
- this[e + 3] = t >>> 24, e + 4;
578
- }, n.prototype.writeInt32BE = function(t, e, r) {
579
- return t = +t, e >>>= 0, r || O(this, t, e, 4, 2147483647, -2147483648),
580
- t < 0 && (t = 4294967295 + t + 1), this[e] = t >>> 24, this[e + 1] = t >>> 16,
581
- this[e + 2] = t >>> 8, this[e + 3] = 255 & t, e + 4;
582
- }, n.prototype.writeFloatLE = function(t, e, r) {
583
- return B(this, t, e, !0, r);
584
- }, n.prototype.writeFloatBE = function(t, e, r) {
585
- return B(this, t, e, !1, r);
586
- }, n.prototype.writeDoubleLE = function(t, e, r) {
587
- return U(this, t, e, !0, r);
588
- }, n.prototype.writeDoubleBE = function(t, e, r) {
589
- return U(this, t, e, !1, r);
590
- }, n.prototype.copy = function(t, e, r, o) {
591
- if (!n.isBuffer(t)) throw new TypeError("argument should be a Buffer");
592
- if (r || (r = 0), o || 0 === o || (o = this.length), e >= t.length && (e = t.length),
593
- e || (e = 0), o > 0 && o < r && (o = r), o === r) return 0;
594
- if (0 === t.length || 0 === this.length) return 0;
595
- if (e < 0) throw new RangeError("targetStart out of bounds");
596
- if (r < 0 || r >= this.length) throw new RangeError("Index out of range");
597
- if (o < 0) throw new RangeError("sourceEnd out of bounds");
598
- o > this.length && (o = this.length), t.length - e < o - r && (o = t.length - e + r);
599
- var i = o - r;
600
- if (this === t && "function" == typeof Uint8Array.prototype.copyWithin) this.copyWithin(e, r, o); else if (this === t && r < e && e < o) for (var s = i - 1; s >= 0; --s) t[s + e] = this[s + r]; else Uint8Array.prototype.set.call(t, this.subarray(r, o), e);
601
- return i;
602
- }, n.prototype.fill = function(t, e, r, o) {
603
- if ("string" == typeof t) {
604
- if ("string" == typeof e ? (o = e, e = 0, r = this.length) : "string" == typeof r && (o = r,
605
- r = this.length), void 0 !== o && "string" != typeof o) throw new TypeError("encoding must be a string");
606
- if ("string" == typeof o && !n.isEncoding(o)) throw new TypeError("Unknown encoding: " + o);
607
- if (1 === t.length) {
608
- var i = t.charCodeAt(0);
609
- ("utf8" === o && i < 128 || "latin1" === o) && (t = i);
610
- }
611
- } else "number" == typeof t && (t &= 255);
612
- if (e < 0 || this.length < e || this.length < r) throw new RangeError("Out of range index");
613
- if (r <= e) return this;
614
- var s;
615
- if (e >>>= 0, r = void 0 === r ? this.length : r >>> 0,
616
- t || (t = 0), "number" == typeof t) for (s = e; s < r; ++s) this[s] = t; else {
617
- var a = n.isBuffer(t) ? t : n.from(t, o), u = a.length;
618
- if (0 === u) throw new TypeError('The value "' + t + '" is invalid for argument "value"');
619
- for (s = 0; s < r - e; ++s) this[s + e] = a[s % u];
620
- }
621
- return this;
622
- };
623
- var k = /[^+/0-9A-Za-z-_]/g;
624
- function x(t, e) {
625
- var r;
626
- e = e || 1 / 0;
627
- for (var n = t.length, o = null, i = [], s = 0; s < n; ++s) {
628
- if ((r = t.charCodeAt(s)) > 55295 && r < 57344) {
629
- if (!o) {
630
- if (r > 56319) {
631
- (e -= 3) > -1 && i.push(239, 191, 189);
632
- continue;
633
- }
634
- if (s + 1 === n) {
635
- (e -= 3) > -1 && i.push(239, 191, 189);
636
- continue;
637
- }
638
- o = r;
639
- continue;
640
- }
641
- if (r < 56320) {
642
- (e -= 3) > -1 && i.push(239, 191, 189), o = r;
643
- continue;
644
- }
645
- r = 65536 + (o - 55296 << 10 | r - 56320);
646
- } else o && (e -= 3) > -1 && i.push(239, 191, 189);
647
- if (o = null, r < 128) {
648
- if ((e -= 1) < 0) break;
649
- i.push(r);
650
- } else if (r < 2048) {
651
- if ((e -= 2) < 0) break;
652
- i.push(r >> 6 | 192, 63 & r | 128);
653
- } else if (r < 65536) {
654
- if ((e -= 3) < 0) break;
655
- i.push(r >> 12 | 224, r >> 6 & 63 | 128, 63 & r | 128);
656
- } else {
657
- if (!(r < 1114112)) throw new Error("Invalid code point");
658
- if ((e -= 4) < 0) break;
659
- i.push(r >> 18 | 240, r >> 12 & 63 | 128, r >> 6 & 63 | 128, 63 & r | 128);
660
- }
661
- }
662
- return i;
663
- }
664
- function P(t) {
665
- return j.toByteArray(function(t) {
666
- if ((t = (t = t.split("=")[0]).trim().replace(k, "")).length < 2) return "";
667
- for (;t.length % 4 != 0; ) t += "=";
668
- return t;
669
- }(t));
670
- }
671
- function N(t, e, r, n) {
672
- for (var o = 0; o < n && !(o + r >= e.length || o >= t.length); ++o) e[o + r] = t[o];
673
- return o;
674
- }
675
- function L(t, e) {
676
- return t instanceof e || null != t && null != t.constructor && null != t.constructor.name && t.constructor.name === e.name;
677
- }
678
- function I(t) {
679
- return t != t;
680
- }
681
- }).call(this);
682
- }).call(this, n({}).Buffer);
683
- }, function(r) {
684
- return e || t(e = {
685
- exports: {},
686
- parent: r
687
- }, e.exports), e.exports;
688
- }), o = function(t, e) {
689
- return function() {
690
- for (var r = new Array(arguments.length), n = 0; n < r.length; n++) r[n] = arguments[n];
691
- return t.apply(e, r);
692
- };
693
- }, i = Object.prototype.toString, s = (r = Object.create(null), function(t) {
694
- var e = i.call(t);
695
- return r[e] || (r[e] = e.slice(8, -1).toLowerCase());
696
- });
697
- function a(t) {
698
- return t = t.toLowerCase(), function(e) {
699
- return s(e) === t;
700
- };
701
- }
702
- function u(t) {
703
- return Array.isArray(t);
704
- }
705
- function f(t) {
706
- return void 0 === t;
707
- }
708
- var c = a("ArrayBuffer");
709
- function l(t) {
710
- return null !== t && "object" == typeof t;
711
- }
712
- function h(t) {
713
- if ("object" !== s(t)) return !1;
714
- var e = Object.getPrototypeOf(t);
715
- return null === e || e === Object.prototype;
716
- }
717
- var p = a("Date"), d = a("File"), g = a("Blob"), y = a("FileList");
718
- function v(t) {
719
- return "[object Function]" === i.call(t);
720
- }
721
- var m = a("URLSearchParams");
722
- function w(t, e) {
723
- if (null != t) if ("object" != typeof t && (t = [ t ]), u(t)) for (var r = 0, n = t.length; r < n; r++) e.call(null, t[r], r, t); else for (var o in t) Object.prototype.hasOwnProperty.call(t, o) && e.call(null, t[o], o, t);
724
- }
725
- var b, E = (b = "undefined" != typeof Uint8Array && Object.getPrototypeOf(Uint8Array),
726
- function(t) {
727
- return b && t instanceof b;
728
- }), A = {
729
- isArray: u,
730
- isArrayBuffer: c,
731
- isBuffer: function(t) {
732
- return null !== t && !f(t) && null !== t.constructor && !f(t.constructor) && "function" == typeof t.constructor.isBuffer && t.constructor.isBuffer(t);
733
- },
734
- isFormData: function(t) {
735
- return t && ("function" == typeof FormData && t instanceof FormData || "[object FormData]" === i.call(t) || v(t.toString) && "[object FormData]" === t.toString());
736
- },
737
- isArrayBufferView: function(t) {
738
- return "undefined" != typeof ArrayBuffer && ArrayBuffer.isView ? ArrayBuffer.isView(t) : t && t.buffer && c(t.buffer);
739
- },
740
- isString: function(t) {
741
- return "string" == typeof t;
742
- },
743
- isNumber: function(t) {
744
- return "number" == typeof t;
745
- },
746
- isObject: l,
747
- isPlainObject: h,
748
- isUndefined: f,
749
- isDate: p,
750
- isFile: d,
751
- isBlob: g,
752
- isStream: function(t) {
753
- return l(t) && v(t.pipe);
754
- },
755
- isURLSearchParams: m,
756
- isStandardBrowserEnv: function() {
757
- return ("undefined" == typeof navigator || "ReactNative" !== navigator.product && "NativeScript" !== navigator.product && "NS" !== navigator.product) && "undefined" != typeof window && "undefined" != typeof document;
758
- },
759
- forEach: w,
760
- merge: function t() {
761
- var e = {};
762
- function r(r, n) {
763
- h(e[n]) && h(r) ? e[n] = t(e[n], r) : h(r) ? e[n] = t({}, r) : u(r) ? e[n] = r.slice() : e[n] = r;
764
- }
765
- for (var n = 0, o = arguments.length; n < o; n++) w(arguments[n], r);
766
- return e;
767
- },
768
- extend: function(t, e, r) {
769
- return w(e, function(e, n) {
770
- t[n] = r && "function" == typeof e ? o(e, r) : e;
771
- }), t;
772
- },
773
- trim: function(t) {
774
- return t.trim ? t.trim() : t.replace(/^\s+|\s+$/g, "");
775
- },
776
- inherits: function(t, e, r, n) {
777
- t.prototype = Object.create(e.prototype, n), t.prototype.constructor = t,
778
- r && Object.assign(t.prototype, r);
779
- },
780
- toFlatObject: function(t, e, r) {
781
- var n, o, i, s = {};
782
- e = e || {};
783
- do {
784
- for (o = (n = Object.getOwnPropertyNames(t)).length; o-- > 0; ) s[i = n[o]] || (e[i] = t[i],
785
- s[i] = !0);
786
- t = Object.getPrototypeOf(t);
787
- } while (t && (!r || r(t, e)) && t !== Object.prototype);
788
- return e;
789
- },
790
- endsWith: function(t, e, r) {
791
- t = String(t), (void 0 === r || r > t.length) && (r = t.length),
792
- r -= e.length;
793
- var n = t.indexOf(e, r);
794
- return -1 !== n && n === r;
795
- },
796
- toArray: function(t) {
797
- if (!t) return null;
798
- var e = t.length;
799
- if (f(e)) return null;
800
- for (var r = new Array(e); e-- > 0; ) r[e] = t[e];
801
- return r;
802
- },
803
- isTypedArray: E,
804
- isFileList: y
805
- };
806
- function T(t) {
807
- return encodeURIComponent(t).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]");
808
- }
809
- var S = function(t, e, r) {
810
- if (!e) return t;
811
- var n;
812
- if (r) n = r(e); else if (A.isURLSearchParams(e)) n = e.toString(); else {
813
- var o = [];
814
- A.forEach(e, function(t, e) {
815
- null != t && (A.isArray(t) ? e += "[]" : t = [ t ], A.forEach(t, function(t) {
816
- A.isDate(t) ? t = t.toISOString() : A.isObject(t) && (t = JSON.stringify(t)),
817
- o.push(T(e) + "=" + T(t));
818
- }));
819
- }), n = o.join("&");
820
- }
821
- if (n) {
822
- var i = t.indexOf("#");
823
- -1 !== i && (t = t.slice(0, i)), t += (-1 === t.indexOf("?") ? "?" : "&") + n;
824
- }
825
- return t;
826
- }, _ = {};
827
- function R() {
828
- this.handlers = [];
829
- }
830
- R.prototype.use = function(t, e, r) {
831
- return this.handlers.push({
832
- fulfilled: t,
833
- rejected: e,
834
- synchronous: !!r && r.synchronous,
835
- runWhen: r ? r.runWhen : null
836
- }), this.handlers.length - 1;
837
- }, R.prototype.eject = function(t) {
838
- this.handlers[t] && (this.handlers[t] = null);
839
- }, R.prototype.forEach = function(t) {
840
- A.forEach(this.handlers, function(e) {
841
- null !== e && t(e);
842
- });
843
- }, _ = R;
844
- var O = function(t, e) {
845
- A.forEach(t, function(r, n) {
846
- n !== e && n.toUpperCase() === e.toUpperCase() && (t[e] = r, delete t[n]);
847
- });
848
- }, C = {};
849
- function B(t, e, r, n, o) {
850
- Error.call(this), this.message = t, this.name = "AxiosError", e && (this.code = e),
851
- r && (this.config = r), n && (this.request = n), o && (this.response = o);
852
- }
853
- A.inherits(B, Error, {
854
- toJSON: function() {
855
- return {
856
- message: this.message,
857
- name: this.name,
858
- description: this.description,
859
- number: this.number,
860
- fileName: this.fileName,
861
- lineNumber: this.lineNumber,
862
- columnNumber: this.columnNumber,
863
- stack: this.stack,
864
- config: this.config,
865
- code: this.code,
866
- status: this.response && this.response.status ? this.response.status : null
867
- };
868
- }
869
- });
870
- var U = B.prototype, k = {};
871
- [ "ERR_BAD_OPTION_VALUE", "ERR_BAD_OPTION", "ECONNABORTED", "ETIMEDOUT", "ERR_NETWORK", "ERR_FR_TOO_MANY_REDIRECTS", "ERR_DEPRECATED", "ERR_BAD_RESPONSE", "ERR_BAD_REQUEST", "ERR_CANCELED" ].forEach(function(t) {
872
- k[t] = {
873
- value: t
874
- };
875
- }), Object.defineProperties(B, k), Object.defineProperty(U, "isAxiosError", {
876
- value: !0
877
- }), B.from = function(t, e, r, n, o, i) {
878
- var s = Object.create(U);
879
- return A.toFlatObject(t, s, function(t) {
880
- return t !== Error.prototype;
881
- }), B.call(s, t.message, e, r, n, o), s.name = t.name, i && Object.assign(s, i),
882
- s;
883
- }, C = B;
884
- for (var x = {
885
- silentJSONParsing: !0,
886
- forcedJSONParsing: !0,
887
- clarifyTimeoutError: !1
888
- }, j = {
889
- toByteArray: function(t) {
890
- var e, r, n = F(t), o = n[0], i = n[1], s = new L(function(t, e, r) {
891
- return 3 * (e + r) / 4 - r;
892
- }(0, o, i)), a = 0, u = i > 0 ? o - 4 : o;
893
- for (r = 0; r < u; r += 4) e = N[t.charCodeAt(r)] << 18 | N[t.charCodeAt(r + 1)] << 12 | N[t.charCodeAt(r + 2)] << 6 | N[t.charCodeAt(r + 3)],
894
- s[a++] = e >> 16 & 255, s[a++] = e >> 8 & 255, s[a++] = 255 & e;
895
- return 2 === i && (e = N[t.charCodeAt(r)] << 2 | N[t.charCodeAt(r + 1)] >> 4,
896
- s[a++] = 255 & e), 1 === i && (e = N[t.charCodeAt(r)] << 10 | N[t.charCodeAt(r + 1)] << 4 | N[t.charCodeAt(r + 2)] >> 2,
897
- s[a++] = e >> 8 & 255, s[a++] = 255 & e), s;
898
- },
899
- fromByteArray: function(t) {
900
- for (var e, r = t.length, n = r % 3, o = [], i = 0, s = r - n; i < s; i += 16383) o.push(z(t, i, i + 16383 > s ? s : i + 16383));
901
- return 1 === n ? (e = t[r - 1], o.push(P[e >> 2] + P[e << 4 & 63] + "==")) : 2 === n && (e = (t[r - 2] << 8) + t[r - 1],
902
- o.push(P[e >> 10] + P[e >> 4 & 63] + P[e << 2 & 63] + "=")), o.join("");
903
- }
904
- }, P = [], N = [], L = "undefined" != typeof Uint8Array ? Uint8Array : Array, I = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", D = 0, M = I.length; D < M; ++D) P[D] = I[D],
905
- N[I.charCodeAt(D)] = D;
906
- function F(t) {
907
- var e = t.length;
908
- if (e % 4 > 0) throw new Error("Invalid string. Length must be a multiple of 4");
909
- var r = t.indexOf("=");
910
- return -1 === r && (r = e), [ r, r === e ? 0 : 4 - r % 4 ];
911
- }
912
- function z(t, e, r) {
913
- for (var n, o, i = [], s = e; s < r; s += 3) n = (t[s] << 16 & 16711680) + (t[s + 1] << 8 & 65280) + (255 & t[s + 2]),
914
- i.push(P[(o = n) >> 18 & 63] + P[o >> 12 & 63] + P[o >> 6 & 63] + P[63 & o]);
915
- return i.join("");
916
- }
917
- N["-".charCodeAt(0)] = 62, N["_".charCodeAt(0)] = 63;
918
- var q = {
919
- read: function(t, e, r, n, o) {
920
- var i, s, a = 8 * o - n - 1, u = (1 << a) - 1, f = u >> 1, c = -7, l = r ? o - 1 : 0, h = r ? -1 : 1, p = t[e + l];
921
- for (l += h, i = p & (1 << -c) - 1, p >>= -c, c += a; c > 0; i = 256 * i + t[e + l],
922
- l += h, c -= 8);
923
- for (s = i & (1 << -c) - 1, i >>= -c, c += n; c > 0; s = 256 * s + t[e + l],
924
- l += h, c -= 8);
925
- if (0 === i) i = 1 - f; else {
926
- if (i === u) return s ? NaN : 1 / 0 * (p ? -1 : 1);
927
- s += Math.pow(2, n), i -= f;
928
- }
929
- return (p ? -1 : 1) * s * Math.pow(2, i - n);
930
- },
931
- write: function(t, e, r, n, o, i) {
932
- var s, a, u, f = 8 * i - o - 1, c = (1 << f) - 1, l = c >> 1, h = 23 === o ? Math.pow(2, -24) - Math.pow(2, -77) : 0, p = n ? 0 : i - 1, d = n ? 1 : -1, g = e < 0 || 0 === e && 1 / e < 0 ? 1 : 0;
933
- for (e = Math.abs(e), isNaN(e) || e === 1 / 0 ? (a = isNaN(e) ? 1 : 0,
934
- s = c) : (s = Math.floor(Math.log(e) / Math.LN2), e * (u = Math.pow(2, -s)) < 1 && (s--,
935
- u *= 2), (e += s + l >= 1 ? h / u : h * Math.pow(2, 1 - l)) * u >= 2 && (s++,
936
- u /= 2), s + l >= c ? (a = 0, s = c) : s + l >= 1 ? (a = (e * u - 1) * Math.pow(2, o),
937
- s += l) : (a = e * Math.pow(2, l - 1) * Math.pow(2, o), s = 0)); o >= 8; t[r + p] = 255 & a,
938
- p += d, a /= 256, o -= 8);
939
- for (s = s << o | a, f += o; f > 0; t[r + p] = 255 & s, p += d,
940
- s /= 256, f -= 8);
941
- t[r + p - d] |= 128 * g;
942
- }
943
- }, V = {};
944
- (function(t) {
945
- (function() {
946
- "use strict";
947
- V = function(e, r) {
948
- r = r || new FormData();
949
- var n = [];
950
- function o(e) {
951
- return null === e ? "" : A.isDate(e) ? e.toISOString() : A.isArrayBuffer(e) || A.isTypedArray(e) ? "function" == typeof Blob ? new Blob([ e ]) : t.from(e) : e;
952
- }
953
- return function t(e, i) {
954
- if (A.isPlainObject(e) || A.isArray(e)) {
955
- if (-1 !== n.indexOf(e)) throw Error("Circular reference detected in " + i);
956
- n.push(e), A.forEach(e, function(e, n) {
957
- if (!A.isUndefined(e)) {
958
- var s, a = i ? i + "." + n : n;
959
- if (e && !i && "object" == typeof e) if (A.endsWith(n, "{}")) e = JSON.stringify(e); else if (A.endsWith(n, "[]") && (s = A.toArray(e))) return void s.forEach(function(t) {
960
- !A.isUndefined(t) && r.append(a, o(t));
961
- });
962
- t(e, a);
963
- }
964
- }), n.pop();
965
- } else r.append(i, o(e));
966
- }(e), r;
967
- };
968
- }).call(this);
969
- }).call(this, n({}).Buffer);
970
- var J = A.isStandardBrowserEnv() ? {
971
- write: function(t, e, r, n, o, i) {
972
- var s = [];
973
- s.push(t + "=" + encodeURIComponent(e)), A.isNumber(r) && s.push("expires=" + new Date(r).toGMTString()),
974
- A.isString(n) && s.push("path=" + n), A.isString(o) && s.push("domain=" + o),
975
- !0 === i && s.push("secure"), document.cookie = s.join("; ");
976
- },
977
- read: function(t) {
978
- var e = document.cookie.match(new RegExp("(^|;\\s*)(" + t + ")=([^;]*)"));
979
- return e ? decodeURIComponent(e[3]) : null;
980
- },
981
- remove: function(t) {
982
- this.write(t, "", Date.now() - 864e5);
983
- }
984
- } : {
985
- write: function() {},
986
- read: function() {
987
- return null;
988
- },
989
- remove: function() {}
990
- }, W = function(t, e) {
991
- return t && !/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e) ? function(t, e) {
992
- return e ? t.replace(/\/+$/, "") + "/" + e.replace(/^\/+/, "") : t;
993
- }(t, e) : e;
994
- }, H = [ "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" ], Y = A.isStandardBrowserEnv() ? function() {
995
- var t, e = /(msie|trident)/i.test(navigator.userAgent), r = document.createElement("a");
996
- function n(t) {
997
- var n = t;
998
- return e && (r.setAttribute("href", n), n = r.href), r.setAttribute("href", n),
999
- {
1000
- href: r.href,
1001
- protocol: r.protocol ? r.protocol.replace(/:$/, "") : "",
1002
- host: r.host,
1003
- search: r.search ? r.search.replace(/^\?/, "") : "",
1004
- hash: r.hash ? r.hash.replace(/^#/, "") : "",
1005
- hostname: r.hostname,
1006
- port: r.port,
1007
- pathname: "/" === r.pathname.charAt(0) ? r.pathname : "/" + r.pathname
1008
- };
1009
- }
1010
- return t = n(window.location.href), function(e) {
1011
- var r = A.isString(e) ? n(e) : e;
1012
- return r.protocol === t.protocol && r.host === t.host;
1013
- };
1014
- }() : function() {
1015
- return !0;
1016
- }, X = {};
1017
- function $(t) {
1018
- C.call(this, null == t ? "canceled" : t, C.ERR_CANCELED), this.name = "CanceledError";
1019
- }
1020
- A.inherits($, C, {
1021
- __CANCEL__: !0
1022
- }), X = $;
1023
- var G, K, Q, Z = function(t) {
1024
- return new Promise(function(e, r) {
1025
- var n, o = t.data, i = t.headers, s = t.responseType;
1026
- function a() {
1027
- t.cancelToken && t.cancelToken.unsubscribe(n), t.signal && t.signal.removeEventListener("abort", n);
1028
- }
1029
- A.isFormData(o) && A.isStandardBrowserEnv() && delete i["Content-Type"];
1030
- var u = new XMLHttpRequest();
1031
- if (t.auth) {
1032
- var f = t.auth.username || "", c = t.auth.password ? unescape(encodeURIComponent(t.auth.password)) : "";
1033
- i.Authorization = "Basic " + btoa(f + ":" + c);
1034
- }
1035
- var l = W(t.baseURL, t.url);
1036
- function h() {
1037
- if (u) {
1038
- var n = "getAllResponseHeaders" in u ? function(t) {
1039
- var e, r, n, o = {};
1040
- return t ? (A.forEach(t.split("\n"), function(t) {
1041
- if (n = t.indexOf(":"), e = A.trim(t.substr(0, n)).toLowerCase(),
1042
- r = A.trim(t.substr(n + 1)), e) {
1043
- if (o[e] && H.indexOf(e) >= 0) return;
1044
- o[e] = "set-cookie" === e ? (o[e] ? o[e] : []).concat([ r ]) : o[e] ? o[e] + ", " + r : r;
1045
- }
1046
- }), o) : o;
1047
- }(u.getAllResponseHeaders()) : null;
1048
- (function(t, e, r) {
1049
- var n = r.config.validateStatus;
1050
- r.status && n && !n(r.status) ? e(new C("Request failed with status code " + r.status, [ C.ERR_BAD_REQUEST, C.ERR_BAD_RESPONSE ][Math.floor(r.status / 100) - 4], r.config, r.request, r)) : t(r);
1051
- })(function(t) {
1052
- e(t), a();
1053
- }, function(t) {
1054
- r(t), a();
1055
- }, {
1056
- data: s && "text" !== s && "json" !== s ? u.response : u.responseText,
1057
- status: u.status,
1058
- statusText: u.statusText,
1059
- headers: n,
1060
- config: t,
1061
- request: u
1062
- }), u = null;
1063
- }
1064
- }
1065
- if (u.open(t.method.toUpperCase(), S(l, t.params, t.paramsSerializer), !0),
1066
- u.timeout = t.timeout, "onloadend" in u ? u.onloadend = h : u.onreadystatechange = function() {
1067
- u && 4 === u.readyState && (0 !== u.status || u.responseURL && 0 === u.responseURL.indexOf("file:")) && setTimeout(h);
1068
- }, u.onabort = function() {
1069
- u && (r(new C("Request aborted", C.ECONNABORTED, t, u)), u = null);
1070
- }, u.onerror = function() {
1071
- r(new C("Network Error", C.ERR_NETWORK, t, u, u)), u = null;
1072
- }, u.ontimeout = function() {
1073
- var e = t.timeout ? "timeout of " + t.timeout + "ms exceeded" : "timeout exceeded", n = t.transitional || x;
1074
- t.timeoutErrorMessage && (e = t.timeoutErrorMessage), r(new C(e, n.clarifyTimeoutError ? C.ETIMEDOUT : C.ECONNABORTED, t, u)),
1075
- u = null;
1076
- }, A.isStandardBrowserEnv()) {
1077
- var p = (t.withCredentials || Y(l)) && t.xsrfCookieName ? J.read(t.xsrfCookieName) : void 0;
1078
- p && (i[t.xsrfHeaderName] = p);
1079
- }
1080
- "setRequestHeader" in u && A.forEach(i, function(t, e) {
1081
- void 0 === o && "content-type" === e.toLowerCase() ? delete i[e] : u.setRequestHeader(e, t);
1082
- }), A.isUndefined(t.withCredentials) || (u.withCredentials = !!t.withCredentials),
1083
- s && "json" !== s && (u.responseType = t.responseType), "function" == typeof t.onDownloadProgress && u.addEventListener("progress", t.onDownloadProgress),
1084
- "function" == typeof t.onUploadProgress && u.upload && u.upload.addEventListener("progress", t.onUploadProgress),
1085
- (t.cancelToken || t.signal) && (n = function(t) {
1086
- u && (r(!t || t && t.type ? new X() : t), u.abort(), u = null);
1087
- }, t.cancelToken && t.cancelToken.subscribe(n), t.signal && (t.signal.aborted ? n() : t.signal.addEventListener("abort", n))),
1088
- o || (o = null);
1089
- var d, g = (d = /^([-+\w]{1,25})(:?\/\/|:)/.exec(l)) && d[1] || "";
1090
- g && -1 === [ "http", "https", "file" ].indexOf(g) ? r(new C("Unsupported protocol " + g + ":", C.ERR_BAD_REQUEST, t)) : u.send(o);
1091
- });
1092
- }, tt = G = {};
1093
- function et() {
1094
- throw new Error("setTimeout has not been defined");
1095
- }
1096
- function rt() {
1097
- throw new Error("clearTimeout has not been defined");
1098
- }
1099
- function nt(t) {
1100
- if (K === setTimeout) return setTimeout(t, 0);
1101
- if ((K === et || !K) && setTimeout) return K = setTimeout, setTimeout(t, 0);
1102
- try {
1103
- return K(t, 0);
1104
- } catch (e) {
1105
- try {
1106
- return K.call(null, t, 0);
1107
- } catch (e) {
1108
- return K.call(this, t, 0);
1109
- }
1110
- }
1111
- }
1112
- !function() {
1113
- try {
1114
- K = "function" == typeof setTimeout ? setTimeout : et;
1115
- } catch (e) {
1116
- K = et;
1117
- }
1118
- try {
1119
- Q = "function" == typeof clearTimeout ? clearTimeout : rt;
1120
- } catch (e) {
1121
- Q = rt;
1122
- }
1123
- }();
1124
- var ot, it = [], st = !1, at = -1;
1125
- function ut() {
1126
- st && ot && (st = !1, ot.length ? it = ot.concat(it) : at = -1, it.length && ft());
1127
- }
1128
- function ft() {
1129
- if (!st) {
1130
- var t = nt(ut);
1131
- st = !0;
1132
- for (var r = it.length; r; ) {
1133
- for (ot = it, it = []; ++at < r; ) ot && ot[at].run();
1134
- at = -1, r = it.length;
1135
- }
1136
- ot = null, st = !1, function(t) {
1137
- if (Q === clearTimeout) return clearTimeout(t);
1138
- if ((Q === rt || !Q) && clearTimeout) return Q = clearTimeout,
1139
- clearTimeout(t);
1140
- try {
1141
- Q(t);
1142
- } catch (e) {
1143
- try {
1144
- return Q.call(null, t);
1145
- } catch (e) {
1146
- return Q.call(this, t);
1147
- }
1148
- }
1149
- }(t);
1150
- }
1151
- }
1152
- function ct(t, e) {
1153
- this.fun = t, this.array = e;
1154
- }
1155
- function lt() {}
1156
- tt.nextTick = function(t) {
1157
- var e = new Array(arguments.length - 1);
1158
- if (arguments.length > 1) for (var r = 1; r < arguments.length; r++) e[r - 1] = arguments[r];
1159
- it.push(new ct(t, e)), 1 !== it.length || st || nt(ft);
1160
- }, ct.prototype.run = function() {
1161
- this.fun.apply(null, this.array);
1162
- }, tt.title = "browser", tt.browser = !0, tt.env = {}, tt.argv = [], tt.version = "",
1163
- tt.versions = {}, tt.on = lt, tt.addListener = lt, tt.once = lt, tt.off = lt,
1164
- tt.removeListener = lt, tt.removeAllListeners = lt, tt.emit = lt, tt.prependListener = lt,
1165
- tt.prependOnceListener = lt, tt.listeners = function(t) {
1166
- return [];
1167
- }, tt.binding = function(t) {
1168
- throw new Error("process.binding is not supported");
1169
- }, tt.cwd = function() {
1170
- return "/";
1171
- }, tt.chdir = function(t) {
1172
- throw new Error("process.chdir is not supported");
1173
- }, tt.umask = function() {
1174
- return 0;
1175
- };
1176
- var ht = {};
1177
- (function(t) {
1178
- (function() {
1179
- "use strict";
1180
- var r = {
1181
- "Content-Type": "application/x-www-form-urlencoded"
1182
- };
1183
- function n(t, e) {
1184
- !A.isUndefined(t) && A.isUndefined(t["Content-Type"]) && (t["Content-Type"] = e);
1185
- }
1186
- var o, i = {
1187
- transitional: x,
1188
- adapter: (("undefined" != typeof XMLHttpRequest || void 0 !== t && "[object process]" === Object.prototype.toString.call(t)) && (o = Z),
1189
- o),
1190
- transformRequest: [ function(t, r) {
1191
- if (O(r, "Accept"), O(r, "Content-Type"), A.isFormData(t) || A.isArrayBuffer(t) || A.isBuffer(t) || A.isStream(t) || A.isFile(t) || A.isBlob(t)) return t;
1192
- if (A.isArrayBufferView(t)) return t.buffer;
1193
- if (A.isURLSearchParams(t)) return n(r, "application/x-www-form-urlencoded;charset=utf-8"),
1194
- t.toString();
1195
- var o, i = A.isObject(t), s = r && r["Content-Type"];
1196
- if ((o = A.isFileList(t)) || i && "multipart/form-data" === s) {
1197
- var a = this.env && this.env.FormData;
1198
- return V(o ? {
1199
- "files[]": t
1200
- } : t, a && new a());
1201
- }
1202
- return i || "application/json" === s ? (n(r, "application/json"),
1203
- function(t, r, n) {
1204
- if (A.isString(t)) try {
1205
- return (0, JSON.parse)(t), A.trim(t);
1206
- } catch (e) {
1207
- if ("SyntaxError" !== e.name) throw e;
1208
- }
1209
- return (0, JSON.stringify)(t);
1210
- }(t)) : t;
1211
- } ],
1212
- transformResponse: [ function(t) {
1213
- var r = this.transitional || i.transitional, n = r && r.silentJSONParsing, o = r && r.forcedJSONParsing, s = !n && "json" === this.responseType;
1214
- if (s || o && A.isString(t) && t.length) try {
1215
- return JSON.parse(t);
1216
- } catch (e) {
1217
- if (s) {
1218
- if ("SyntaxError" === e.name) throw C.from(e, C.ERR_BAD_RESPONSE, this, null, this.response);
1219
- throw e;
1220
- }
1221
- }
1222
- return t;
1223
- } ],
1224
- timeout: 0,
1225
- xsrfCookieName: "XSRF-TOKEN",
1226
- xsrfHeaderName: "X-XSRF-TOKEN",
1227
- maxContentLength: -1,
1228
- maxBodyLength: -1,
1229
- env: {
1230
- FormData: null
1231
- },
1232
- validateStatus: function(t) {
1233
- return t >= 200 && t < 300;
1234
- },
1235
- headers: {
1236
- common: {
1237
- Accept: "application/json, text/plain, */*"
1238
- }
1239
- }
1240
- };
1241
- A.forEach([ "delete", "get", "head" ], function(t) {
1242
- i.headers[t] = {};
1243
- }), A.forEach([ "post", "put", "patch" ], function(t) {
1244
- i.headers[t] = A.merge(r);
1245
- }), ht = i;
1246
- }).call(this);
1247
- }).call(this, G);
1248
- var pt = function(t, e, r) {
1249
- var n = this || ht;
1250
- return A.forEach(r, function(r) {
1251
- t = r.call(n, t, e);
1252
- }), t;
1253
- }, dt = function(t) {
1254
- return !(!t || !t.__CANCEL__);
1255
- };
1256
- function gt(t) {
1257
- if (t.cancelToken && t.cancelToken.throwIfRequested(), t.signal && t.signal.aborted) throw new X();
1258
- }
1259
- var yt, vt = function(t) {
1260
- return gt(t), t.headers = t.headers || {}, t.data = pt.call(t, t.data, t.headers, t.transformRequest),
1261
- t.headers = A.merge(t.headers.common || {}, t.headers[t.method] || {}, t.headers),
1262
- A.forEach([ "delete", "get", "head", "post", "put", "patch", "common" ], function(e) {
1263
- delete t.headers[e];
1264
- }), (t.adapter || ht.adapter)(t).then(function(e) {
1265
- return gt(t), e.data = pt.call(t, e.data, e.headers, t.transformResponse),
1266
- e;
1267
- }, function(e) {
1268
- return dt(e) || (gt(t), e && e.response && (e.response.data = pt.call(t, e.response.data, e.response.headers, t.transformResponse))),
1269
- Promise.reject(e);
1270
- });
1271
- }, mt = function(t, e) {
1272
- e = e || {};
1273
- var r = {};
1274
- function n(t, e) {
1275
- return A.isPlainObject(t) && A.isPlainObject(e) ? A.merge(t, e) : A.isPlainObject(e) ? A.merge({}, e) : A.isArray(e) ? e.slice() : e;
1276
- }
1277
- function o(r) {
1278
- return A.isUndefined(e[r]) ? A.isUndefined(t[r]) ? void 0 : n(void 0, t[r]) : n(t[r], e[r]);
1279
- }
1280
- function i(t) {
1281
- if (!A.isUndefined(e[t])) return n(void 0, e[t]);
1282
- }
1283
- function s(r) {
1284
- return A.isUndefined(e[r]) ? A.isUndefined(t[r]) ? void 0 : n(void 0, t[r]) : n(void 0, e[r]);
1285
- }
1286
- function a(r) {
1287
- return r in e ? n(t[r], e[r]) : r in t ? n(void 0, t[r]) : void 0;
1288
- }
1289
- var u = {
1290
- url: i,
1291
- method: i,
1292
- data: i,
1293
- baseURL: s,
1294
- transformRequest: s,
1295
- transformResponse: s,
1296
- paramsSerializer: s,
1297
- timeout: s,
1298
- timeoutMessage: s,
1299
- withCredentials: s,
1300
- adapter: s,
1301
- responseType: s,
1302
- xsrfCookieName: s,
1303
- xsrfHeaderName: s,
1304
- onUploadProgress: s,
1305
- onDownloadProgress: s,
1306
- decompress: s,
1307
- maxContentLength: s,
1308
- maxBodyLength: s,
1309
- beforeRedirect: s,
1310
- transport: s,
1311
- httpAgent: s,
1312
- httpsAgent: s,
1313
- cancelToken: s,
1314
- socketPath: s,
1315
- responseEncoding: s,
1316
- validateStatus: a
1317
- };
1318
- return A.forEach(Object.keys(t).concat(Object.keys(e)), function(t) {
1319
- var e = u[t] || o, n = e(t);
1320
- A.isUndefined(n) && e !== a || (r[t] = n);
1321
- }), r;
1322
- }, wt = "0.27.2", bt = wt, Et = {};
1323
- [ "object", "boolean", "number", "function", "string", "symbol" ].forEach(function(t, e) {
1324
- Et[t] = function(r) {
1325
- return typeof r === t || "a" + (e < 1 ? "n " : " ") + t;
1326
- };
1327
- });
1328
- var At = {};
1329
- Et.transitional = function(t, e, r) {
1330
- function n(t, e) {
1331
- return "[Axios v" + bt + "] Transitional option '" + t + "'" + e + (r ? ". " + r : "");
1332
- }
1333
- return function(r, o, i) {
1334
- if (!1 === t) throw new C(n(o, " has been removed" + (e ? " in " + e : "")), C.ERR_DEPRECATED);
1335
- return e && !At[o] && (At[o] = !0, console.warn(n(o, " has been deprecated since v" + e + " and will be removed in the near future"))),
1336
- !t || t(r, o, i);
1337
- };
1338
- };
1339
- var Tt = {}, St = (yt = {
1340
- assertOptions: function(t, e, r) {
1341
- if ("object" != typeof t) throw new C("options must be an object", C.ERR_BAD_OPTION_VALUE);
1342
- for (var n = Object.keys(t), o = n.length; o-- > 0; ) {
1343
- var i = n[o], s = e[i];
1344
- if (s) {
1345
- var a = t[i], u = void 0 === a || s(a, i, t);
1346
- if (!0 !== u) throw new C("option " + i + " must be " + u, C.ERR_BAD_OPTION_VALUE);
1347
- } else if (!0 !== r) throw new C("Unknown option " + i, C.ERR_BAD_OPTION);
1348
- }
1349
- },
1350
- validators: Et
1351
- }).validators;
1352
- function _t(t) {
1353
- this.defaults = t, this.interceptors = {
1354
- request: new _(),
1355
- response: new _()
1356
- };
1357
- }
1358
- _t.prototype.request = function(t, e) {
1359
- "string" == typeof t ? (e = e || {}).url = t : e = t || {}, (e = mt(this.defaults, e)).method ? e.method = e.method.toLowerCase() : this.defaults.method ? e.method = this.defaults.method.toLowerCase() : e.method = "get";
1360
- var r = e.transitional;
1361
- void 0 !== r && yt.assertOptions(r, {
1362
- silentJSONParsing: St.transitional(St.boolean),
1363
- forcedJSONParsing: St.transitional(St.boolean),
1364
- clarifyTimeoutError: St.transitional(St.boolean)
1365
- }, !1);
1366
- var n = [], o = !0;
1367
- this.interceptors.request.forEach(function(t) {
1368
- "function" == typeof t.runWhen && !1 === t.runWhen(e) || (o = o && t.synchronous,
1369
- n.unshift(t.fulfilled, t.rejected));
1370
- });
1371
- var i, s = [];
1372
- if (this.interceptors.response.forEach(function(t) {
1373
- s.push(t.fulfilled, t.rejected);
1374
- }), !o) {
1375
- var a = [ vt, void 0 ];
1376
- for (Array.prototype.unshift.apply(a, n), a = a.concat(s), i = Promise.resolve(e); a.length; ) i = i.then(a.shift(), a.shift());
1377
- return i;
1378
- }
1379
- for (var u = e; n.length; ) {
1380
- var f = n.shift(), c = n.shift();
1381
- try {
1382
- u = f(u);
1383
- } catch (l) {
1384
- c(l);
1385
- break;
1386
- }
1387
- }
1388
- try {
1389
- i = vt(u);
1390
- } catch (l) {
1391
- return Promise.reject(l);
1392
- }
1393
- for (;s.length; ) i = i.then(s.shift(), s.shift());
1394
- return i;
1395
- }, _t.prototype.getUri = function(t) {
1396
- t = mt(this.defaults, t);
1397
- var e = W(t.baseURL, t.url);
1398
- return S(e, t.params, t.paramsSerializer);
1399
- }, A.forEach([ "delete", "get", "head", "options" ], function(t) {
1400
- _t.prototype[t] = function(e, r) {
1401
- return this.request(mt(r || {}, {
1402
- method: t,
1403
- url: e,
1404
- data: (r || {}).data
1405
- }));
1406
- };
1407
- }), A.forEach([ "post", "put", "patch" ], function(t) {
1408
- function e(e) {
1409
- return function(r, n, o) {
1410
- return this.request(mt(o || {}, {
1411
- method: t,
1412
- headers: e ? {
1413
- "Content-Type": "multipart/form-data"
1414
- } : {},
1415
- url: r,
1416
- data: n
1417
- }));
1418
- };
1419
- }
1420
- _t.prototype[t] = e(), _t.prototype[t + "Form"] = e(!0);
1421
- }), Tt = _t;
1422
- var Rt;
1423
- function Ot(t) {
1424
- if ("function" != typeof t) throw new TypeError("executor must be a function.");
1425
- var e;
1426
- this.promise = new Promise(function(t) {
1427
- e = t;
1428
- });
1429
- var r = this;
1430
- this.promise.then(function(t) {
1431
- if (r._listeners) {
1432
- var e, n = r._listeners.length;
1433
- for (e = 0; e < n; e++) r._listeners[e](t);
1434
- r._listeners = null;
1435
- }
1436
- }), this.promise.then = function(t) {
1437
- var e, n = new Promise(function(t) {
1438
- r.subscribe(t), e = t;
1439
- }).then(t);
1440
- return n.cancel = function() {
1441
- r.unsubscribe(e);
1442
- }, n;
1443
- }, t(function(t) {
1444
- r.reason || (r.reason = new X(t), e(r.reason));
1445
- });
1446
- }
1447
- Ot.prototype.throwIfRequested = function() {
1448
- if (this.reason) throw this.reason;
1449
- }, Ot.prototype.subscribe = function(t) {
1450
- this.reason ? t(this.reason) : this._listeners ? this._listeners.push(t) : this._listeners = [ t ];
1451
- }, Ot.prototype.unsubscribe = function(t) {
1452
- if (this._listeners) {
1453
- var e = this._listeners.indexOf(t);
1454
- -1 !== e && this._listeners.splice(e, 1);
1455
- }
1456
- }, Ot.source = function() {
1457
- var t;
1458
- return {
1459
- token: new Ot(function(e) {
1460
- t = e;
1461
- }),
1462
- cancel: t
1463
- };
1464
- }, Rt = Ot;
1465
- var Ct = {}, Bt = function t(e) {
1466
- var r = new Tt(e), n = o(Tt.prototype.request, r);
1467
- return A.extend(n, Tt.prototype, r), A.extend(n, r), n.create = function(r) {
1468
- return t(mt(e, r));
1469
- }, n;
1470
- }(ht);
1471
- Bt.Axios = Tt, Bt.CanceledError = X, Bt.CancelToken = Rt, Bt.isCancel = dt,
1472
- Bt.VERSION = wt, Bt.toFormData = V, Bt.AxiosError = C, Bt.Cancel = Bt.CanceledError,
1473
- Bt.all = function(t) {
1474
- return Promise.all(t);
1475
- }, Bt.spread = function(t) {
1476
- return function(e) {
1477
- return t.apply(null, e);
1478
- };
1479
- }, Bt.isAxiosError = function(t) {
1480
- return A.isObject(t) && !0 === t.isAxiosError;
1481
- }, (Ct = Bt).default = Bt;
1482
- var Ut = Ct, kt = {}, xt = {};
1483
- return function(t) {
1484
- (function() {
1485
- "use strict";
1486
- function e(t, e) {
1487
- var n = "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
1488
- if (!n) {
1489
- if (Array.isArray(t) || (n = r(t)) || e && t && "number" == typeof t.length) {
1490
- n && (t = n);
1491
- var o = 0, i = function() {};
1492
- return {
1493
- s: i,
1494
- n: function() {
1495
- return o >= t.length ? {
1496
- done: !0
1497
- } : {
1498
- done: !1,
1499
- value: t[o++]
1500
- };
1501
- },
1502
- e: function(t) {
1503
- throw t;
1504
- },
1505
- f: i
1506
- };
1507
- }
1508
- throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1509
- }
1510
- var s, a = !0, u = !1;
1511
- return {
1512
- s: function() {
1513
- n = n.call(t);
1514
- },
1515
- n: function() {
1516
- var t = n.next();
1517
- return a = t.done, t;
1518
- },
1519
- e: function(t) {
1520
- u = !0, s = t;
1521
- },
1522
- f: function() {
1523
- try {
1524
- a || null == n.return || n.return();
1525
- } finally {
1526
- if (u) throw s;
1527
- }
1528
- }
1529
- };
1530
- }
1531
- function r(t, e) {
1532
- if (t) {
1533
- if ("string" == typeof t) return n(t, e);
1534
- var r = Object.prototype.toString.call(t).slice(8, -1);
1535
- return "Object" === r && t.constructor && (r = t.constructor.name),
1536
- "Map" === r || "Set" === r ? Array.from(t) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? n(t, e) : void 0;
1537
- }
1538
- }
1539
- function n(t, e) {
1540
- (null == e || e > t.length) && (e = t.length);
1541
- for (var r = 0, n = new Array(e); r < e; r++) n[r] = t[r];
1542
- return n;
1543
- }
1544
- function o(t) {
1545
- return (o = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
1546
- return typeof t;
1547
- } : function(t) {
1548
- return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
1549
- })(t);
1550
- }
1551
- function i(t, e) {
1552
- if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function");
1553
- }
1554
- function s(t, e) {
1555
- for (var r = 0; r < e.length; r++) {
1556
- var n = e[r];
1557
- n.enumerable = n.enumerable || !1, n.configurable = !0,
1558
- "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n);
1559
- }
1560
- }
1561
- function a(t, e, r) {
1562
- return e && s(t.prototype, e), r && s(t, r), Object.defineProperty(t, "prototype", {
1563
- writable: !1
1564
- }), t;
1565
- }
1566
- Object.defineProperty(xt, "__esModule", {
1567
- value: !0
1568
- }), xt.varsnap = xt.clientName = xt.version = void 0;
1569
- xt.version = "1.8.4", xt.clientName = "javascript." + xt.version;
1570
- var u = {
1571
- varsnap: !0,
1572
- env: "development",
1573
- branch: "",
1574
- producerToken: "",
1575
- consumerToken: "",
1576
- logger: console
1577
- }, f = [], c = [], l = function() {
1578
- function e() {
1579
- i(this, e);
1580
- }
1581
- return a(e, null, [ {
1582
- key: "getConfig",
1583
- value: function(t, e) {
1584
- if (!t) return "";
1585
- var r = t[e];
1586
- return r ? r = r.toString().toLowerCase() : "";
1587
- }
1588
- }, {
1589
- key: "setConfig",
1590
- value: function(t, e, r) {
1591
- return "varsnap" === e && ("string" == typeof r && (r = "true" === r),
1592
- t[e] = r), "env" !== e && "producerToken" !== e && "consumerToken" !== e && "branch" !== e || (t[e] = r),
1593
- "logger" === e && (t[e] = r), t;
1594
- }
1595
- }, {
1596
- key: "getSignature",
1597
- value: function(t, e) {
1598
- var r = "";
1599
- return r = "" !== e && void 0 !== e ? e : (r = (r = t.toString().split("{")[0]).replace(/^\s+|\s+$/g, "")).replace(/,\s+/g, ","),
1600
- "javascript." + xt.version + "." + r;
1601
- }
1602
- }, {
1603
- key: "ajax",
1604
- value: function(t, r) {
1605
- var n = {
1606
- method: "POST",
1607
- url: t,
1608
- headers: {
1609
- "Content-Type": "application/x-www-form-urlencoded"
1610
- },
1611
- data: new URLSearchParams(r).toString(),
1612
- responseType: "json"
1613
- };
1614
- return e.isNode() && n.headers && (n.headers["User-Agent"] = "varsnap.js"),
1615
- (0, Ut.default)(n).then(function(t) {
1616
- return t.data;
1617
- }).catch(function(t) {
1618
- return t;
1619
- });
1620
- }
1621
- }, {
1622
- key: "debug",
1623
- value: function(t, e) {
1624
- t.logger && t.logger.debug(e);
1625
- }
1626
- }, {
1627
- key: "log",
1628
- value: function(t, e) {
1629
- t.logger && t.logger.log(e);
1630
- }
1631
- }, {
1632
- key: "error",
1633
- value: function(t, e) {
1634
- t.logger && t.logger.error(e);
1635
- }
1636
- }, {
1637
- key: "resetProducers",
1638
- value: function() {
1639
- f = [];
1640
- }
1641
- }, {
1642
- key: "resetConsumers",
1643
- value: function() {
1644
- c = [];
1645
- }
1646
- }, {
1647
- key: "getProducers",
1648
- value: function() {
1649
- return f;
1650
- }
1651
- }, {
1652
- key: "getConsumers",
1653
- value: function() {
1654
- return c;
1655
- }
1656
- }, {
1657
- key: "limitString",
1658
- value: function(t) {
1659
- var e = String(t);
1660
- return e.length <= 30 ? e : e.substring(0, 30 - "...".length) + "...";
1661
- }
1662
- }, {
1663
- key: "isNode",
1664
- value: function() {
1665
- return "object" === (void 0 === t ? "undefined" : o(t)) && "undefined" == typeof window;
1666
- }
1667
- }, {
1668
- key: "getBranch",
1669
- value: function(t) {
1670
- var r = e.getConfig(t, "branch");
1671
- return r ? new Promise(function(t) {
1672
- return t(r);
1673
- }) : e.isNode() ? new Promise(function(t) {
1674
- (0, kt.exec)("git rev-parse --abbrev-ref HEAD", function(e, r) {
1675
- return t(r.trim());
1676
- });
1677
- }) : new Promise(function(t) {
1678
- return t("");
1679
- });
1680
- }
1681
- } ]), e;
1682
- }(), h = function() {
1683
- function t(e, r, n) {
1684
- i(this, t), this.targetFunc = e, this.signature = r, this.config = n;
1685
- }
1686
- return a(t, [ {
1687
- key: "isEnabled",
1688
- value: function() {
1689
- return !!this.config.varsnap && "production" === l.getConfig(this.config, "env") && !!l.getConfig(this.config, "producerToken");
1690
- }
1691
- }, {
1692
- key: "produce",
1693
- value: function(e, r) {
1694
- var n = this;
1695
- return this.isEnabled() ? (l.debug(this.config, "Sending call to Varsnap"),
1696
- Promise.resolve(r).then(function(r) {
1697
- var o = {
1698
- producer_token: l.getConfig(n.config, "producerToken"),
1699
- signature: n.signature,
1700
- inputs: t.serialize(e),
1701
- prod_outputs: t.serialize(r)
1702
- };
1703
- return l.ajax("https://www.varsnap.com/api/snap/produce/", o).then(function() {
1704
- return !0;
1705
- }).catch(function(t) {
1706
- if (t.response) {
1707
- if (429 === t.response.status) return l.error(n.config, "Cannot produce to Varsnap; Signature at rate limit"),
1708
- !0;
1709
- 404 === t.response.status ? l.error(n.config, "Cannot produce to Varsnap; check your producer token") : l.error(n.config, t.response.statusText);
1710
- }
1711
- return !1;
1712
- });
1713
- })) : new Promise(function(t) {
1714
- return t(!1);
1715
- });
1716
- }
1717
- } ], [ {
1718
- key: "serialize",
1719
- value: function(t) {
1720
- return JSON.stringify(t);
1721
- }
1722
- }, {
1723
- key: "serialize_formatted",
1724
- value: function(t) {
1725
- return JSON.stringify(t, null, 2);
1726
- }
1727
- } ]), t;
1728
- }(), p = function() {
1729
- function t(e, r, n) {
1730
- i(this, t), this.targetFunc = e, this.signature = r, this.config = n;
1731
- }
1732
- return a(t, [ {
1733
- key: "isEnabled",
1734
- value: function() {
1735
- return !!this.config.varsnap && "development" === l.getConfig(this.config, "env") && !!l.getConfig(this.config, "consumerToken");
1736
- }
1737
- }, {
1738
- key: "consume",
1739
- value: function(o) {
1740
- var i = this;
1741
- if (!this.isEnabled()) return new Promise(function(t) {
1742
- return l.error(i.config, "Varsnap not enabled for testing"),
1743
- t(!1);
1744
- });
1745
- var s = {
1746
- consumer_token: l.getConfig(this.config, "consumerToken"),
1747
- signature: this.signature
1748
- };
1749
- return l.ajax("https://www.varsnap.com/api/snap/consume/", s).then(function(a) {
1750
- var u = a;
1751
- if (!u || "ok" !== u.status) return [ new Promise(function(t) {
1752
- return l.error(i.config, "Received error from Varsnap: " + u.status),
1753
- t(!1);
1754
- }) ];
1755
- 0 === u.results.length && l.log(i.config, "No snaps found for signature: " + s.signature);
1756
- var f, c = [], p = e(u.results);
1757
- try {
1758
- var d = function() {
1759
- var e, s = f.value, a = t.deserialize(s.inputs), u = t.deserialize(s.prod_outputs), l = void 0;
1760
- try {
1761
- l = i.targetFunc.apply(i, function(t) {
1762
- if (Array.isArray(t)) return n(t);
1763
- }(e = a) || function(t) {
1764
- if ("undefined" != typeof Symbol && null != t[Symbol.iterator] || null != t["@@iterator"]) return Array.from(t);
1765
- }(e) || r(e) || function() {
1766
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1767
- }());
1768
- } catch (d) {
1769
- l = d;
1770
- }
1771
- var p = Promise.resolve(l).then(function(t) {
1772
- var e = h.serialize(u) === h.serialize(t);
1773
- return i.reportCentral(o, s, u, t, e).then(function(r) {
1774
- i.reportLog(s.id, a, u, t, e, r);
1775
- }), e;
1776
- });
1777
- c.push(p);
1778
- };
1779
- for (p.s(); !(f = p.n()).done; ) d();
1780
- } catch (g) {
1781
- p.e(g);
1782
- } finally {
1783
- p.f();
1784
- }
1785
- return c;
1786
- }).then(function(t) {
1787
- return Promise.all(t).then(function(t) {
1788
- return t.every(function(t) {
1789
- return t;
1790
- });
1791
- });
1792
- }).catch(function(t) {
1793
- return l.error(i.config, "Cannot contact Varsnap: " + t),
1794
- !1;
1795
- });
1796
- }
1797
- }, {
1798
- key: "reportCentral",
1799
- value: function(t, e, r, n, o) {
1800
- var i = this, s = {
1801
- trial_group_id: t.trial_group_id,
1802
- consumer_token: l.getConfig(this.config, "consumerToken"),
1803
- snap_id: e.id,
1804
- test_outputs: h.serialize(n),
1805
- matches: o.toString(),
1806
- snap_outputs_formatted: h.serialize_formatted(r),
1807
- test_outputs_formatted: h.serialize_formatted(n)
1808
- };
1809
- return l.ajax("https://www.varsnap.com/api/trial/produce/", s).then(function(t) {
1810
- var e = t;
1811
- return !(!e || "ok" !== e.status) && e.trial_url;
1812
- }).catch(function(t) {
1813
- return l.error(i.config, "Cannot upload test results to Varsnap: " + t),
1814
- !1;
1815
- });
1816
- }
1817
- }, {
1818
- key: "reportLog",
1819
- value: function(t, e, r, n, o, i) {
1820
- if (!o) {
1821
- l.log(this.config, ""), l.log(this.config, "Testing with Varsnap uuid: " + t),
1822
- l.log(this.config, "Signature: " + this.signature),
1823
- l.log(this.config, "Function input args: " + l.limitString(e)),
1824
- l.log(this.config, "Production function outputs: " + l.limitString(r)),
1825
- l.log(this.config, "Your function outputs: " + l.limitString(n)),
1826
- l.log(this.config, "Matching outputs: " + o);
1827
- var s = "Cannot upload trial";
1828
- i && (s = String(i)), l.log(this.config, "Trial URL: " + s);
1829
- }
1830
- }
1831
- }, {
1832
- key: "reportTrialGroup",
1833
- value: function(t) {
1834
- l.log(this.config, "Trial Group: " + t.trial_group_url);
1835
- }
1836
- } ], [ {
1837
- key: "deserialize",
1838
- value: function(t) {
1839
- if ("" !== t) return JSON.parse(t);
1840
- }
1841
- } ]), t;
1842
- }();
1843
- function d(t, e) {
1844
- void 0 === e && (e = "");
1845
- var r = l.getSignature(t, e), n = new h(t, r, d._config), o = new p(t, r, d._config), i = function() {
1846
- for (var e, r = arguments.length, o = new Array(r), i = 0; i < r; i++) o[i] = arguments[i];
1847
- try {
1848
- e = t.apply(void 0, o);
1849
- } catch (s) {
1850
- throw n.produce(o, s), s;
1851
- }
1852
- return n.produce(o, e), e;
1853
- };
1854
- return i.producer = n, i.consumer = o, i.signature = r, f.push(n),
1855
- c.push(o), i;
1856
- }
1857
- function g() {
1858
- var t, r = l.getConsumers();
1859
- return 0 === r.length ? Promise.resolve(!0) : (t = r[0].config,
1860
- l.getBranch(t).then(function(e) {
1861
- return {
1862
- branch: e,
1863
- consumer_token: l.getConfig(t, "consumerToken"),
1864
- client: xt.clientName
1865
- };
1866
- }).then(function(t) {
1867
- var e = t;
1868
- return l.ajax("https://www.varsnap.com/api/trial_group/", e);
1869
- }).then(function(t) {
1870
- return t;
1871
- }).catch(function(e) {
1872
- var r;
1873
- return r = e && e.response && e.response.data ? e.response.data.error : e.toString(),
1874
- l.error(t, "Cannot generate a new Trial Group: " + r), {
1875
- status: "not ok",
1876
- project_id: "",
1877
- trial_group_id: "",
1878
- trial_group_url: ""
1879
- };
1880
- })).then(function(t) {
1881
- var n, o = [], i = e(r);
1882
- try {
1883
- for (i.s(); !(n = i.n()).done; ) {
1884
- var s = n.value.consume(t);
1885
- o.push(s);
1886
- }
1887
- } catch (a) {
1888
- i.e(a);
1889
- } finally {
1890
- i.f();
1891
- }
1892
- return r.length > 0 && r[0].reportTrialGroup(t), Promise.all(o);
1893
- }).then(function(t) {
1894
- return t.every(function(t) {
1895
- return t;
1896
- });
1897
- });
1898
- }
1899
- xt.varsnap = d, d._config = u, d.updateConfig = function(t) {
1900
- for (var e = d._config, r = 0, n = Object.keys(d._config); r < n.length; r++) {
1901
- var o = n[r];
1902
- Object.prototype.hasOwnProperty.call(t, o) && (e = l.setConfig(e, o, t[o]));
1903
- }
1904
- d._config = e;
1905
- }, d.reset = function() {
1906
- l.resetConsumers(), l.resetProducers();
1907
- }, d.version = xt.version, d.runTests = g;
1908
- }).call(this);
1909
- }.call(this, G), xt.varsnap;
1910
- });
1911
- })(typeof Varsnap == "undefined" ? Varsnap = {} : Varsnap);