@solana/web3.js 1.24.3 → 1.25.1
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/lib/index.browser.esm.js +558 -22
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +1 -1
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.esm.js +1 -1
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +564 -30
- package/lib/index.iife.js.map +1 -1
- package/lib/index.iife.min.js +2 -2
- package/lib/index.iife.min.js.map +1 -1
- package/package.json +5 -3
- package/src/connection.ts +2 -1
package/lib/index.browser.esm.js
CHANGED
|
@@ -2290,36 +2290,572 @@ class BpfLoader {
|
|
|
2290
2290
|
|
|
2291
2291
|
}
|
|
2292
2292
|
|
|
2293
|
-
var
|
|
2293
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
2294
|
+
|
|
2295
|
+
function getDefaultExportFromCjs (x) {
|
|
2296
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
2297
|
+
}
|
|
2298
|
+
|
|
2299
|
+
var browserPonyfill = {exports: {}};
|
|
2294
2300
|
|
|
2295
2301
|
(function (module, exports) {
|
|
2302
|
+
var global = typeof self !== 'undefined' ? self : commonjsGlobal;
|
|
2303
|
+
var __self__ = (function () {
|
|
2304
|
+
function F() {
|
|
2305
|
+
this.fetch = false;
|
|
2306
|
+
this.DOMException = global.DOMException;
|
|
2307
|
+
}
|
|
2308
|
+
F.prototype = global;
|
|
2309
|
+
return new F();
|
|
2310
|
+
})();
|
|
2311
|
+
(function(self) {
|
|
2312
|
+
|
|
2313
|
+
((function (exports) {
|
|
2314
|
+
|
|
2315
|
+
var support = {
|
|
2316
|
+
searchParams: 'URLSearchParams' in self,
|
|
2317
|
+
iterable: 'Symbol' in self && 'iterator' in Symbol,
|
|
2318
|
+
blob:
|
|
2319
|
+
'FileReader' in self &&
|
|
2320
|
+
'Blob' in self &&
|
|
2321
|
+
(function() {
|
|
2322
|
+
try {
|
|
2323
|
+
new Blob();
|
|
2324
|
+
return true
|
|
2325
|
+
} catch (e) {
|
|
2326
|
+
return false
|
|
2327
|
+
}
|
|
2328
|
+
})(),
|
|
2329
|
+
formData: 'FormData' in self,
|
|
2330
|
+
arrayBuffer: 'ArrayBuffer' in self
|
|
2331
|
+
};
|
|
2296
2332
|
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2333
|
+
function isDataView(obj) {
|
|
2334
|
+
return obj && DataView.prototype.isPrototypeOf(obj)
|
|
2335
|
+
}
|
|
2336
|
+
|
|
2337
|
+
if (support.arrayBuffer) {
|
|
2338
|
+
var viewClasses = [
|
|
2339
|
+
'[object Int8Array]',
|
|
2340
|
+
'[object Uint8Array]',
|
|
2341
|
+
'[object Uint8ClampedArray]',
|
|
2342
|
+
'[object Int16Array]',
|
|
2343
|
+
'[object Uint16Array]',
|
|
2344
|
+
'[object Int32Array]',
|
|
2345
|
+
'[object Uint32Array]',
|
|
2346
|
+
'[object Float32Array]',
|
|
2347
|
+
'[object Float64Array]'
|
|
2348
|
+
];
|
|
2349
|
+
|
|
2350
|
+
var isArrayBufferView =
|
|
2351
|
+
ArrayBuffer.isView ||
|
|
2352
|
+
function(obj) {
|
|
2353
|
+
return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1
|
|
2354
|
+
};
|
|
2355
|
+
}
|
|
2307
2356
|
|
|
2308
|
-
|
|
2357
|
+
function normalizeName(name) {
|
|
2358
|
+
if (typeof name !== 'string') {
|
|
2359
|
+
name = String(name);
|
|
2360
|
+
}
|
|
2361
|
+
if (/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(name)) {
|
|
2362
|
+
throw new TypeError('Invalid character in header field name')
|
|
2363
|
+
}
|
|
2364
|
+
return name.toLowerCase()
|
|
2365
|
+
}
|
|
2309
2366
|
|
|
2310
|
-
|
|
2367
|
+
function normalizeValue(value) {
|
|
2368
|
+
if (typeof value !== 'string') {
|
|
2369
|
+
value = String(value);
|
|
2370
|
+
}
|
|
2371
|
+
return value
|
|
2372
|
+
}
|
|
2311
2373
|
|
|
2312
|
-
//
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2374
|
+
// Build a destructive iterator for the value list
|
|
2375
|
+
function iteratorFor(items) {
|
|
2376
|
+
var iterator = {
|
|
2377
|
+
next: function() {
|
|
2378
|
+
var value = items.shift();
|
|
2379
|
+
return {done: value === undefined, value: value}
|
|
2380
|
+
}
|
|
2381
|
+
};
|
|
2382
|
+
|
|
2383
|
+
if (support.iterable) {
|
|
2384
|
+
iterator[Symbol.iterator] = function() {
|
|
2385
|
+
return iterator
|
|
2386
|
+
};
|
|
2387
|
+
}
|
|
2388
|
+
|
|
2389
|
+
return iterator
|
|
2390
|
+
}
|
|
2391
|
+
|
|
2392
|
+
function Headers(headers) {
|
|
2393
|
+
this.map = {};
|
|
2394
|
+
|
|
2395
|
+
if (headers instanceof Headers) {
|
|
2396
|
+
headers.forEach(function(value, name) {
|
|
2397
|
+
this.append(name, value);
|
|
2398
|
+
}, this);
|
|
2399
|
+
} else if (Array.isArray(headers)) {
|
|
2400
|
+
headers.forEach(function(header) {
|
|
2401
|
+
this.append(header[0], header[1]);
|
|
2402
|
+
}, this);
|
|
2403
|
+
} else if (headers) {
|
|
2404
|
+
Object.getOwnPropertyNames(headers).forEach(function(name) {
|
|
2405
|
+
this.append(name, headers[name]);
|
|
2406
|
+
}, this);
|
|
2407
|
+
}
|
|
2408
|
+
}
|
|
2409
|
+
|
|
2410
|
+
Headers.prototype.append = function(name, value) {
|
|
2411
|
+
name = normalizeName(name);
|
|
2412
|
+
value = normalizeValue(value);
|
|
2413
|
+
var oldValue = this.map[name];
|
|
2414
|
+
this.map[name] = oldValue ? oldValue + ', ' + value : value;
|
|
2415
|
+
};
|
|
2416
|
+
|
|
2417
|
+
Headers.prototype['delete'] = function(name) {
|
|
2418
|
+
delete this.map[normalizeName(name)];
|
|
2419
|
+
};
|
|
2420
|
+
|
|
2421
|
+
Headers.prototype.get = function(name) {
|
|
2422
|
+
name = normalizeName(name);
|
|
2423
|
+
return this.has(name) ? this.map[name] : null
|
|
2424
|
+
};
|
|
2425
|
+
|
|
2426
|
+
Headers.prototype.has = function(name) {
|
|
2427
|
+
return this.map.hasOwnProperty(normalizeName(name))
|
|
2428
|
+
};
|
|
2429
|
+
|
|
2430
|
+
Headers.prototype.set = function(name, value) {
|
|
2431
|
+
this.map[normalizeName(name)] = normalizeValue(value);
|
|
2432
|
+
};
|
|
2433
|
+
|
|
2434
|
+
Headers.prototype.forEach = function(callback, thisArg) {
|
|
2435
|
+
for (var name in this.map) {
|
|
2436
|
+
if (this.map.hasOwnProperty(name)) {
|
|
2437
|
+
callback.call(thisArg, this.map[name], name, this);
|
|
2438
|
+
}
|
|
2439
|
+
}
|
|
2440
|
+
};
|
|
2441
|
+
|
|
2442
|
+
Headers.prototype.keys = function() {
|
|
2443
|
+
var items = [];
|
|
2444
|
+
this.forEach(function(value, name) {
|
|
2445
|
+
items.push(name);
|
|
2446
|
+
});
|
|
2447
|
+
return iteratorFor(items)
|
|
2448
|
+
};
|
|
2449
|
+
|
|
2450
|
+
Headers.prototype.values = function() {
|
|
2451
|
+
var items = [];
|
|
2452
|
+
this.forEach(function(value) {
|
|
2453
|
+
items.push(value);
|
|
2454
|
+
});
|
|
2455
|
+
return iteratorFor(items)
|
|
2456
|
+
};
|
|
2457
|
+
|
|
2458
|
+
Headers.prototype.entries = function() {
|
|
2459
|
+
var items = [];
|
|
2460
|
+
this.forEach(function(value, name) {
|
|
2461
|
+
items.push([name, value]);
|
|
2462
|
+
});
|
|
2463
|
+
return iteratorFor(items)
|
|
2464
|
+
};
|
|
2465
|
+
|
|
2466
|
+
if (support.iterable) {
|
|
2467
|
+
Headers.prototype[Symbol.iterator] = Headers.prototype.entries;
|
|
2468
|
+
}
|
|
2469
|
+
|
|
2470
|
+
function consumed(body) {
|
|
2471
|
+
if (body.bodyUsed) {
|
|
2472
|
+
return Promise.reject(new TypeError('Already read'))
|
|
2473
|
+
}
|
|
2474
|
+
body.bodyUsed = true;
|
|
2475
|
+
}
|
|
2476
|
+
|
|
2477
|
+
function fileReaderReady(reader) {
|
|
2478
|
+
return new Promise(function(resolve, reject) {
|
|
2479
|
+
reader.onload = function() {
|
|
2480
|
+
resolve(reader.result);
|
|
2481
|
+
};
|
|
2482
|
+
reader.onerror = function() {
|
|
2483
|
+
reject(reader.error);
|
|
2484
|
+
};
|
|
2485
|
+
})
|
|
2486
|
+
}
|
|
2487
|
+
|
|
2488
|
+
function readBlobAsArrayBuffer(blob) {
|
|
2489
|
+
var reader = new FileReader();
|
|
2490
|
+
var promise = fileReaderReady(reader);
|
|
2491
|
+
reader.readAsArrayBuffer(blob);
|
|
2492
|
+
return promise
|
|
2493
|
+
}
|
|
2494
|
+
|
|
2495
|
+
function readBlobAsText(blob) {
|
|
2496
|
+
var reader = new FileReader();
|
|
2497
|
+
var promise = fileReaderReady(reader);
|
|
2498
|
+
reader.readAsText(blob);
|
|
2499
|
+
return promise
|
|
2500
|
+
}
|
|
2501
|
+
|
|
2502
|
+
function readArrayBufferAsText(buf) {
|
|
2503
|
+
var view = new Uint8Array(buf);
|
|
2504
|
+
var chars = new Array(view.length);
|
|
2505
|
+
|
|
2506
|
+
for (var i = 0; i < view.length; i++) {
|
|
2507
|
+
chars[i] = String.fromCharCode(view[i]);
|
|
2508
|
+
}
|
|
2509
|
+
return chars.join('')
|
|
2510
|
+
}
|
|
2511
|
+
|
|
2512
|
+
function bufferClone(buf) {
|
|
2513
|
+
if (buf.slice) {
|
|
2514
|
+
return buf.slice(0)
|
|
2515
|
+
} else {
|
|
2516
|
+
var view = new Uint8Array(buf.byteLength);
|
|
2517
|
+
view.set(new Uint8Array(buf));
|
|
2518
|
+
return view.buffer
|
|
2519
|
+
}
|
|
2520
|
+
}
|
|
2521
|
+
|
|
2522
|
+
function Body() {
|
|
2523
|
+
this.bodyUsed = false;
|
|
2524
|
+
|
|
2525
|
+
this._initBody = function(body) {
|
|
2526
|
+
this._bodyInit = body;
|
|
2527
|
+
if (!body) {
|
|
2528
|
+
this._bodyText = '';
|
|
2529
|
+
} else if (typeof body === 'string') {
|
|
2530
|
+
this._bodyText = body;
|
|
2531
|
+
} else if (support.blob && Blob.prototype.isPrototypeOf(body)) {
|
|
2532
|
+
this._bodyBlob = body;
|
|
2533
|
+
} else if (support.formData && FormData.prototype.isPrototypeOf(body)) {
|
|
2534
|
+
this._bodyFormData = body;
|
|
2535
|
+
} else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
|
|
2536
|
+
this._bodyText = body.toString();
|
|
2537
|
+
} else if (support.arrayBuffer && support.blob && isDataView(body)) {
|
|
2538
|
+
this._bodyArrayBuffer = bufferClone(body.buffer);
|
|
2539
|
+
// IE 10-11 can't handle a DataView body.
|
|
2540
|
+
this._bodyInit = new Blob([this._bodyArrayBuffer]);
|
|
2541
|
+
} else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) {
|
|
2542
|
+
this._bodyArrayBuffer = bufferClone(body);
|
|
2543
|
+
} else {
|
|
2544
|
+
this._bodyText = body = Object.prototype.toString.call(body);
|
|
2545
|
+
}
|
|
2546
|
+
|
|
2547
|
+
if (!this.headers.get('content-type')) {
|
|
2548
|
+
if (typeof body === 'string') {
|
|
2549
|
+
this.headers.set('content-type', 'text/plain;charset=UTF-8');
|
|
2550
|
+
} else if (this._bodyBlob && this._bodyBlob.type) {
|
|
2551
|
+
this.headers.set('content-type', this._bodyBlob.type);
|
|
2552
|
+
} else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
|
|
2553
|
+
this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8');
|
|
2554
|
+
}
|
|
2555
|
+
}
|
|
2556
|
+
};
|
|
2557
|
+
|
|
2558
|
+
if (support.blob) {
|
|
2559
|
+
this.blob = function() {
|
|
2560
|
+
var rejected = consumed(this);
|
|
2561
|
+
if (rejected) {
|
|
2562
|
+
return rejected
|
|
2563
|
+
}
|
|
2564
|
+
|
|
2565
|
+
if (this._bodyBlob) {
|
|
2566
|
+
return Promise.resolve(this._bodyBlob)
|
|
2567
|
+
} else if (this._bodyArrayBuffer) {
|
|
2568
|
+
return Promise.resolve(new Blob([this._bodyArrayBuffer]))
|
|
2569
|
+
} else if (this._bodyFormData) {
|
|
2570
|
+
throw new Error('could not read FormData body as blob')
|
|
2571
|
+
} else {
|
|
2572
|
+
return Promise.resolve(new Blob([this._bodyText]))
|
|
2573
|
+
}
|
|
2574
|
+
};
|
|
2575
|
+
|
|
2576
|
+
this.arrayBuffer = function() {
|
|
2577
|
+
if (this._bodyArrayBuffer) {
|
|
2578
|
+
return consumed(this) || Promise.resolve(this._bodyArrayBuffer)
|
|
2579
|
+
} else {
|
|
2580
|
+
return this.blob().then(readBlobAsArrayBuffer)
|
|
2581
|
+
}
|
|
2582
|
+
};
|
|
2583
|
+
}
|
|
2584
|
+
|
|
2585
|
+
this.text = function() {
|
|
2586
|
+
var rejected = consumed(this);
|
|
2587
|
+
if (rejected) {
|
|
2588
|
+
return rejected
|
|
2589
|
+
}
|
|
2590
|
+
|
|
2591
|
+
if (this._bodyBlob) {
|
|
2592
|
+
return readBlobAsText(this._bodyBlob)
|
|
2593
|
+
} else if (this._bodyArrayBuffer) {
|
|
2594
|
+
return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer))
|
|
2595
|
+
} else if (this._bodyFormData) {
|
|
2596
|
+
throw new Error('could not read FormData body as text')
|
|
2597
|
+
} else {
|
|
2598
|
+
return Promise.resolve(this._bodyText)
|
|
2599
|
+
}
|
|
2600
|
+
};
|
|
2601
|
+
|
|
2602
|
+
if (support.formData) {
|
|
2603
|
+
this.formData = function() {
|
|
2604
|
+
return this.text().then(decode)
|
|
2605
|
+
};
|
|
2606
|
+
}
|
|
2607
|
+
|
|
2608
|
+
this.json = function() {
|
|
2609
|
+
return this.text().then(JSON.parse)
|
|
2610
|
+
};
|
|
2611
|
+
|
|
2612
|
+
return this
|
|
2613
|
+
}
|
|
2614
|
+
|
|
2615
|
+
// HTTP methods whose capitalization should be normalized
|
|
2616
|
+
var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT'];
|
|
2617
|
+
|
|
2618
|
+
function normalizeMethod(method) {
|
|
2619
|
+
var upcased = method.toUpperCase();
|
|
2620
|
+
return methods.indexOf(upcased) > -1 ? upcased : method
|
|
2621
|
+
}
|
|
2622
|
+
|
|
2623
|
+
function Request(input, options) {
|
|
2624
|
+
options = options || {};
|
|
2625
|
+
var body = options.body;
|
|
2626
|
+
|
|
2627
|
+
if (input instanceof Request) {
|
|
2628
|
+
if (input.bodyUsed) {
|
|
2629
|
+
throw new TypeError('Already read')
|
|
2630
|
+
}
|
|
2631
|
+
this.url = input.url;
|
|
2632
|
+
this.credentials = input.credentials;
|
|
2633
|
+
if (!options.headers) {
|
|
2634
|
+
this.headers = new Headers(input.headers);
|
|
2635
|
+
}
|
|
2636
|
+
this.method = input.method;
|
|
2637
|
+
this.mode = input.mode;
|
|
2638
|
+
this.signal = input.signal;
|
|
2639
|
+
if (!body && input._bodyInit != null) {
|
|
2640
|
+
body = input._bodyInit;
|
|
2641
|
+
input.bodyUsed = true;
|
|
2642
|
+
}
|
|
2643
|
+
} else {
|
|
2644
|
+
this.url = String(input);
|
|
2645
|
+
}
|
|
2646
|
+
|
|
2647
|
+
this.credentials = options.credentials || this.credentials || 'same-origin';
|
|
2648
|
+
if (options.headers || !this.headers) {
|
|
2649
|
+
this.headers = new Headers(options.headers);
|
|
2650
|
+
}
|
|
2651
|
+
this.method = normalizeMethod(options.method || this.method || 'GET');
|
|
2652
|
+
this.mode = options.mode || this.mode || null;
|
|
2653
|
+
this.signal = options.signal || this.signal;
|
|
2654
|
+
this.referrer = null;
|
|
2655
|
+
|
|
2656
|
+
if ((this.method === 'GET' || this.method === 'HEAD') && body) {
|
|
2657
|
+
throw new TypeError('Body not allowed for GET or HEAD requests')
|
|
2658
|
+
}
|
|
2659
|
+
this._initBody(body);
|
|
2660
|
+
}
|
|
2661
|
+
|
|
2662
|
+
Request.prototype.clone = function() {
|
|
2663
|
+
return new Request(this, {body: this._bodyInit})
|
|
2664
|
+
};
|
|
2665
|
+
|
|
2666
|
+
function decode(body) {
|
|
2667
|
+
var form = new FormData();
|
|
2668
|
+
body
|
|
2669
|
+
.trim()
|
|
2670
|
+
.split('&')
|
|
2671
|
+
.forEach(function(bytes) {
|
|
2672
|
+
if (bytes) {
|
|
2673
|
+
var split = bytes.split('=');
|
|
2674
|
+
var name = split.shift().replace(/\+/g, ' ');
|
|
2675
|
+
var value = split.join('=').replace(/\+/g, ' ');
|
|
2676
|
+
form.append(decodeURIComponent(name), decodeURIComponent(value));
|
|
2677
|
+
}
|
|
2678
|
+
});
|
|
2679
|
+
return form
|
|
2680
|
+
}
|
|
2681
|
+
|
|
2682
|
+
function parseHeaders(rawHeaders) {
|
|
2683
|
+
var headers = new Headers();
|
|
2684
|
+
// Replace instances of \r\n and \n followed by at least one space or horizontal tab with a space
|
|
2685
|
+
// https://tools.ietf.org/html/rfc7230#section-3.2
|
|
2686
|
+
var preProcessedHeaders = rawHeaders.replace(/\r?\n[\t ]+/g, ' ');
|
|
2687
|
+
preProcessedHeaders.split(/\r?\n/).forEach(function(line) {
|
|
2688
|
+
var parts = line.split(':');
|
|
2689
|
+
var key = parts.shift().trim();
|
|
2690
|
+
if (key) {
|
|
2691
|
+
var value = parts.join(':').trim();
|
|
2692
|
+
headers.append(key, value);
|
|
2693
|
+
}
|
|
2694
|
+
});
|
|
2695
|
+
return headers
|
|
2696
|
+
}
|
|
2697
|
+
|
|
2698
|
+
Body.call(Request.prototype);
|
|
2699
|
+
|
|
2700
|
+
function Response(bodyInit, options) {
|
|
2701
|
+
if (!options) {
|
|
2702
|
+
options = {};
|
|
2703
|
+
}
|
|
2704
|
+
|
|
2705
|
+
this.type = 'default';
|
|
2706
|
+
this.status = options.status === undefined ? 200 : options.status;
|
|
2707
|
+
this.ok = this.status >= 200 && this.status < 300;
|
|
2708
|
+
this.statusText = 'statusText' in options ? options.statusText : 'OK';
|
|
2709
|
+
this.headers = new Headers(options.headers);
|
|
2710
|
+
this.url = options.url || '';
|
|
2711
|
+
this._initBody(bodyInit);
|
|
2712
|
+
}
|
|
2713
|
+
|
|
2714
|
+
Body.call(Response.prototype);
|
|
2715
|
+
|
|
2716
|
+
Response.prototype.clone = function() {
|
|
2717
|
+
return new Response(this._bodyInit, {
|
|
2718
|
+
status: this.status,
|
|
2719
|
+
statusText: this.statusText,
|
|
2720
|
+
headers: new Headers(this.headers),
|
|
2721
|
+
url: this.url
|
|
2722
|
+
})
|
|
2723
|
+
};
|
|
2724
|
+
|
|
2725
|
+
Response.error = function() {
|
|
2726
|
+
var response = new Response(null, {status: 0, statusText: ''});
|
|
2727
|
+
response.type = 'error';
|
|
2728
|
+
return response
|
|
2729
|
+
};
|
|
2730
|
+
|
|
2731
|
+
var redirectStatuses = [301, 302, 303, 307, 308];
|
|
2732
|
+
|
|
2733
|
+
Response.redirect = function(url, status) {
|
|
2734
|
+
if (redirectStatuses.indexOf(status) === -1) {
|
|
2735
|
+
throw new RangeError('Invalid status code')
|
|
2736
|
+
}
|
|
2737
|
+
|
|
2738
|
+
return new Response(null, {status: status, headers: {location: url}})
|
|
2739
|
+
};
|
|
2740
|
+
|
|
2741
|
+
exports.DOMException = self.DOMException;
|
|
2742
|
+
try {
|
|
2743
|
+
new exports.DOMException();
|
|
2744
|
+
} catch (err) {
|
|
2745
|
+
exports.DOMException = function(message, name) {
|
|
2746
|
+
this.message = message;
|
|
2747
|
+
this.name = name;
|
|
2748
|
+
var error = Error(message);
|
|
2749
|
+
this.stack = error.stack;
|
|
2750
|
+
};
|
|
2751
|
+
exports.DOMException.prototype = Object.create(Error.prototype);
|
|
2752
|
+
exports.DOMException.prototype.constructor = exports.DOMException;
|
|
2753
|
+
}
|
|
2754
|
+
|
|
2755
|
+
function fetch(input, init) {
|
|
2756
|
+
return new Promise(function(resolve, reject) {
|
|
2757
|
+
var request = new Request(input, init);
|
|
2758
|
+
|
|
2759
|
+
if (request.signal && request.signal.aborted) {
|
|
2760
|
+
return reject(new exports.DOMException('Aborted', 'AbortError'))
|
|
2761
|
+
}
|
|
2762
|
+
|
|
2763
|
+
var xhr = new XMLHttpRequest();
|
|
2764
|
+
|
|
2765
|
+
function abortXhr() {
|
|
2766
|
+
xhr.abort();
|
|
2767
|
+
}
|
|
2768
|
+
|
|
2769
|
+
xhr.onload = function() {
|
|
2770
|
+
var options = {
|
|
2771
|
+
status: xhr.status,
|
|
2772
|
+
statusText: xhr.statusText,
|
|
2773
|
+
headers: parseHeaders(xhr.getAllResponseHeaders() || '')
|
|
2774
|
+
};
|
|
2775
|
+
options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL');
|
|
2776
|
+
var body = 'response' in xhr ? xhr.response : xhr.responseText;
|
|
2777
|
+
resolve(new Response(body, options));
|
|
2778
|
+
};
|
|
2779
|
+
|
|
2780
|
+
xhr.onerror = function() {
|
|
2781
|
+
reject(new TypeError('Network request failed'));
|
|
2782
|
+
};
|
|
2783
|
+
|
|
2784
|
+
xhr.ontimeout = function() {
|
|
2785
|
+
reject(new TypeError('Network request failed'));
|
|
2786
|
+
};
|
|
2787
|
+
|
|
2788
|
+
xhr.onabort = function() {
|
|
2789
|
+
reject(new exports.DOMException('Aborted', 'AbortError'));
|
|
2790
|
+
};
|
|
2791
|
+
|
|
2792
|
+
xhr.open(request.method, request.url, true);
|
|
2793
|
+
|
|
2794
|
+
if (request.credentials === 'include') {
|
|
2795
|
+
xhr.withCredentials = true;
|
|
2796
|
+
} else if (request.credentials === 'omit') {
|
|
2797
|
+
xhr.withCredentials = false;
|
|
2798
|
+
}
|
|
2799
|
+
|
|
2800
|
+
if ('responseType' in xhr && support.blob) {
|
|
2801
|
+
xhr.responseType = 'blob';
|
|
2802
|
+
}
|
|
2803
|
+
|
|
2804
|
+
request.headers.forEach(function(value, name) {
|
|
2805
|
+
xhr.setRequestHeader(name, value);
|
|
2806
|
+
});
|
|
2807
|
+
|
|
2808
|
+
if (request.signal) {
|
|
2809
|
+
request.signal.addEventListener('abort', abortXhr);
|
|
2810
|
+
|
|
2811
|
+
xhr.onreadystatechange = function() {
|
|
2812
|
+
// DONE (success or failure)
|
|
2813
|
+
if (xhr.readyState === 4) {
|
|
2814
|
+
request.signal.removeEventListener('abort', abortXhr);
|
|
2815
|
+
}
|
|
2816
|
+
};
|
|
2817
|
+
}
|
|
2818
|
+
|
|
2819
|
+
xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit);
|
|
2820
|
+
})
|
|
2821
|
+
}
|
|
2822
|
+
|
|
2823
|
+
fetch.polyfill = true;
|
|
2824
|
+
|
|
2825
|
+
if (!self.fetch) {
|
|
2826
|
+
self.fetch = fetch;
|
|
2827
|
+
self.Headers = Headers;
|
|
2828
|
+
self.Request = Request;
|
|
2829
|
+
self.Response = Response;
|
|
2830
|
+
}
|
|
2831
|
+
|
|
2832
|
+
exports.Headers = Headers;
|
|
2833
|
+
exports.Request = Request;
|
|
2834
|
+
exports.Response = Response;
|
|
2835
|
+
exports.fetch = fetch;
|
|
2836
|
+
|
|
2837
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2838
|
+
|
|
2839
|
+
return exports;
|
|
2316
2840
|
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2841
|
+
})({}));
|
|
2842
|
+
})(__self__);
|
|
2843
|
+
__self__.fetch.ponyfill = true;
|
|
2844
|
+
// Remove "polyfill" property added by whatwg-fetch
|
|
2845
|
+
delete __self__.fetch.polyfill;
|
|
2846
|
+
// Choose between native implementation (global) or custom implementation (__self__)
|
|
2847
|
+
// var ctx = global.fetch ? global : __self__;
|
|
2848
|
+
var ctx = __self__; // this line disable service worker support temporarily
|
|
2849
|
+
exports = ctx.fetch; // To enable: import fetch from 'cross-fetch'
|
|
2850
|
+
exports.default = ctx.fetch; // For TypeScript consumers without esModuleInterop.
|
|
2851
|
+
exports.fetch = ctx.fetch; // To enable: import {fetch} from 'cross-fetch'
|
|
2852
|
+
exports.Headers = ctx.Headers;
|
|
2853
|
+
exports.Request = ctx.Request;
|
|
2854
|
+
exports.Response = ctx.Response;
|
|
2855
|
+
module.exports = exports;
|
|
2856
|
+
}(browserPonyfill, browserPonyfill.exports));
|
|
2321
2857
|
|
|
2322
|
-
var fetch =
|
|
2858
|
+
var fetch = /*@__PURE__*/getDefaultExportFromCjs(browserPonyfill.exports);
|
|
2323
2859
|
|
|
2324
2860
|
const MINIMUM_SLOT_PER_EPOCH = 32; // Returns the number of trailing zeros in the binary representation of self.
|
|
2325
2861
|
|