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