mphttpx 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +994 -843
- package/dist/index.cjs.min.js +1 -1
- package/dist/index.d.ts +128 -180
- package/dist/index.esm.js +994 -843
- package/dist/index.esm.min.js +1 -1
- package/dist/types/AbortSignalP.d.ts +7 -3
- package/dist/types/BlobP.d.ts +4 -2
- package/dist/types/BodyP.d.ts +5 -10
- package/dist/types/EventP.d.ts +21 -11
- package/dist/types/EventTargetP.d.ts +3 -4
- package/dist/types/FileReaderP.d.ts +9 -9
- package/dist/types/FormDataP.d.ts +5 -3
- package/dist/types/HeadersP.d.ts +4 -2
- package/dist/types/ProgressEventP.d.ts +5 -3
- package/dist/types/RequestP.d.ts +3 -3
- package/dist/types/ResponseP.d.ts +3 -2
- package/dist/types/TextDecoderP.d.ts +4 -2
- package/dist/types/URLSearchParamsP.d.ts +3 -2
- package/dist/types/XMLHttpRequestEventTargetP.d.ts +12 -9
- package/dist/types/XMLHttpRequestP.d.ts +25 -23
- package/dist/types/isPolyfill.d.ts +2 -1
- package/dist/types/request.d.ts +2 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const polyfill = Symbol("isPolyfill");
|
|
4
|
-
const state$9 = Symbol("INTERNAL_STATE");
|
|
5
4
|
/* eslint-disable no-prototype-builtins */
|
|
6
5
|
const g = (typeof globalThis !== "undefined" && globalThis) ||
|
|
7
6
|
(typeof self !== "undefined" && self) ||
|
|
@@ -21,13 +20,13 @@ function isPolyfillType(name, value) {
|
|
|
21
20
|
&& value.isPolyfill.symbol === polyfill
|
|
22
21
|
&& "hierarchy" in value.isPolyfill
|
|
23
22
|
&& Array.isArray(value.isPolyfill.hierarchy)
|
|
24
|
-
&& value.isPolyfill.hierarchy.
|
|
23
|
+
&& value.isPolyfill.hierarchy.indexOf(name) > -1;
|
|
25
24
|
}
|
|
26
25
|
class MPException extends Error {
|
|
27
26
|
constructor(message, name) {
|
|
28
27
|
super();
|
|
29
|
-
this.message = message
|
|
30
|
-
this.name = name
|
|
28
|
+
this.message = message !== null && message !== void 0 ? message : this.message;
|
|
29
|
+
this.name = name !== null && name !== void 0 ? name : this.name;
|
|
31
30
|
}
|
|
32
31
|
}
|
|
33
32
|
function defineStringTag(targetFunc, stringTag) {
|
|
@@ -36,6 +35,12 @@ function defineStringTag(targetFunc, stringTag) {
|
|
|
36
35
|
value: stringTag,
|
|
37
36
|
});
|
|
38
37
|
}
|
|
38
|
+
function objectValues(obj) {
|
|
39
|
+
return Object.keys(obj).map(key => obj[key]);
|
|
40
|
+
}
|
|
41
|
+
function objectEntries(obj) {
|
|
42
|
+
return Object.keys(obj).map(key => [key, obj[key]]);
|
|
43
|
+
}
|
|
39
44
|
|
|
40
45
|
class TextEncoderP {
|
|
41
46
|
get encoding() { return "utf-8"; }
|
|
@@ -136,21 +141,22 @@ function encodeText(input, destination) {
|
|
|
136
141
|
}
|
|
137
142
|
const TextEncoderE = g["TextEncoder"] || TextEncoderP;
|
|
138
143
|
|
|
139
|
-
|
|
144
|
+
var _a$a, _b$3;
|
|
145
|
+
const state$h = Symbol( /* "TextDecoderState" */);
|
|
140
146
|
class TextDecoderP {
|
|
141
147
|
constructor(utfLabel = "utf-8", { fatal = false, ignoreBOM = false } = {}) {
|
|
142
|
-
if (
|
|
148
|
+
if (UTF8Labels.indexOf(utfLabel.toLowerCase()) === -1) {
|
|
143
149
|
throw new RangeError("TextDecoder: The encoding label provided ('" + utfLabel + "') is invalid.");
|
|
144
150
|
}
|
|
145
|
-
this[state$
|
|
146
|
-
this[state$
|
|
147
|
-
this[state$
|
|
151
|
+
this[state$h] = new TextDecoderState();
|
|
152
|
+
this[state$h].fatal = fatal;
|
|
153
|
+
this[state$h].ignoreBOM = ignoreBOM;
|
|
148
154
|
}
|
|
149
|
-
[state$8];
|
|
150
155
|
get encoding() { return "utf-8"; }
|
|
151
|
-
get fatal() { return this[state$
|
|
152
|
-
get ignoreBOM() { return this[state$
|
|
156
|
+
get fatal() { return this[state$h].fatal; }
|
|
157
|
+
get ignoreBOM() { return this[state$h].ignoreBOM; }
|
|
153
158
|
decode(buffer, { stream = false } = {}) {
|
|
159
|
+
const that = this[state$h];
|
|
154
160
|
let buf;
|
|
155
161
|
if (typeof buffer !== "undefined") {
|
|
156
162
|
if (buffer instanceof Uint8Array) {
|
|
@@ -164,28 +170,28 @@ class TextDecoderP {
|
|
|
164
170
|
}
|
|
165
171
|
}
|
|
166
172
|
else {
|
|
167
|
-
if (
|
|
173
|
+
if (that[_partial].length > 0) {
|
|
168
174
|
if (this.fatal) {
|
|
169
175
|
throw new TypeError("TextDecoder: Incomplete UTF-8 sequence.");
|
|
170
176
|
}
|
|
171
177
|
else {
|
|
172
|
-
|
|
178
|
+
that[_partial] = [];
|
|
173
179
|
}
|
|
174
180
|
}
|
|
175
181
|
return "";
|
|
176
182
|
}
|
|
177
|
-
if (!
|
|
183
|
+
if (!that[_bomSeen] && this.ignoreBOM && buf.length >= 3) {
|
|
178
184
|
if (buf[0] === 0xef && buf[1] === 0xbb && buf[2] === 0xbf) {
|
|
179
185
|
buf = buf.subarray(3);
|
|
180
|
-
|
|
186
|
+
that[_bomSeen] = true;
|
|
181
187
|
}
|
|
182
188
|
}
|
|
183
|
-
if (
|
|
184
|
-
let merged = new Uint8Array(
|
|
185
|
-
merged.set(
|
|
186
|
-
merged.set(buf,
|
|
189
|
+
if (that[_partial].length > 0) {
|
|
190
|
+
let merged = new Uint8Array(that[_partial].length + buf.length);
|
|
191
|
+
merged.set(that[_partial], 0);
|
|
192
|
+
merged.set(buf, that[_partial].length);
|
|
187
193
|
buf = merged;
|
|
188
|
-
|
|
194
|
+
that[_partial] = [];
|
|
189
195
|
}
|
|
190
196
|
let end = buf.length;
|
|
191
197
|
let res = [];
|
|
@@ -202,7 +208,7 @@ class TextDecoderP {
|
|
|
202
208
|
}
|
|
203
209
|
i--;
|
|
204
210
|
}
|
|
205
|
-
|
|
211
|
+
that[_partial] = Array.from(buf.slice(end)); // save tail
|
|
206
212
|
buf = buf.slice(0, end);
|
|
207
213
|
}
|
|
208
214
|
let i = 0;
|
|
@@ -279,128 +285,155 @@ class TextDecoderP {
|
|
|
279
285
|
get isPolyfill() { return { symbol: polyfill, hierarchy: ["TextDecoder"] }; }
|
|
280
286
|
}
|
|
281
287
|
defineStringTag(TextDecoderP, "TextDecoder");
|
|
288
|
+
const _bomSeen = Symbol();
|
|
289
|
+
const _partial = Symbol();
|
|
282
290
|
class TextDecoderState {
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
291
|
+
constructor() {
|
|
292
|
+
this.fatal = false;
|
|
293
|
+
this.ignoreBOM = false;
|
|
294
|
+
this[_a$a] = false;
|
|
295
|
+
this[_b$3] = [];
|
|
296
|
+
}
|
|
287
297
|
}
|
|
298
|
+
_a$a = _bomSeen, _b$3 = _partial;
|
|
288
299
|
const UTF8Labels = ["utf-8", "utf8", "unicode-1-1-utf-8"];
|
|
289
300
|
function getBytesPerSequence(byte) {
|
|
290
301
|
return (byte > 0xEF) ? 4 : (byte > 0xDF) ? 3 : (byte > 0xBF) ? 2 : 1;
|
|
291
302
|
}
|
|
292
303
|
const TextDecoderE = g["TextDecoder"] || TextDecoderP;
|
|
293
304
|
|
|
305
|
+
var _a$9, _b$2, _c$1, _d$1, _e$1, _f$1;
|
|
306
|
+
const state$g = Symbol( /* "EventState" */);
|
|
294
307
|
class EventP {
|
|
295
|
-
static NONE = 0;
|
|
296
|
-
static CAPTURING_PHASE = 1;
|
|
297
|
-
static AT_TARGET = 2;
|
|
298
|
-
static BUBBLING_PHASE = 3;
|
|
299
308
|
constructor(type, eventInitDict) {
|
|
300
|
-
this
|
|
301
|
-
this
|
|
302
|
-
this
|
|
303
|
-
this
|
|
304
|
-
this[state$
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
get
|
|
312
|
-
get
|
|
313
|
-
get
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
get srcElement() { return this[state$
|
|
319
|
-
cancelBubble
|
|
320
|
-
|
|
321
|
-
get
|
|
309
|
+
this.NONE = EventP.NONE;
|
|
310
|
+
this.CAPTURING_PHASE = EventP.CAPTURING_PHASE;
|
|
311
|
+
this.AT_TARGET = EventP.AT_TARGET;
|
|
312
|
+
this.BUBBLING_PHASE = EventP.BUBBLING_PHASE;
|
|
313
|
+
this[state$g] = new EventState();
|
|
314
|
+
const that = this[state$g];
|
|
315
|
+
that.type = String(type);
|
|
316
|
+
that.bubbles = !!(eventInitDict === null || eventInitDict === void 0 ? void 0 : eventInitDict.bubbles);
|
|
317
|
+
that.cancelable = !!(eventInitDict === null || eventInitDict === void 0 ? void 0 : eventInitDict.cancelable);
|
|
318
|
+
that.composed = !!(eventInitDict === null || eventInitDict === void 0 ? void 0 : eventInitDict.composed);
|
|
319
|
+
}
|
|
320
|
+
get type() { return this[state$g].type; }
|
|
321
|
+
get bubbles() { return this[state$g].bubbles; }
|
|
322
|
+
get cancelable() { return this[state$g].cancelable; }
|
|
323
|
+
get composed() { return this[state$g].composed; }
|
|
324
|
+
get target() { return this[state$g].target; }
|
|
325
|
+
get currentTarget() { return this[state$g].currentTarget; }
|
|
326
|
+
get eventPhase() { return this[state$g].eventPhase; }
|
|
327
|
+
get srcElement() { return this[state$g].target; }
|
|
328
|
+
get cancelBubble() { return this[state$g].cancelBubble; }
|
|
329
|
+
set cancelBubble(value) { this[state$g].cancelBubble = value; }
|
|
330
|
+
get defaultPrevented() { return this[state$g].defaultPrevented; }
|
|
331
|
+
get returnValue() { return this[state$g].returnValue; }
|
|
322
332
|
set returnValue(value) { if (!value) {
|
|
323
333
|
this.preventDefault();
|
|
324
334
|
} }
|
|
325
|
-
get isTrusted() { return this[state$
|
|
326
|
-
get timeStamp() { return this[state$
|
|
335
|
+
get isTrusted() { return this[state$g][_isTrusted]; }
|
|
336
|
+
get timeStamp() { return this[state$g].timeStamp; }
|
|
327
337
|
composedPath() {
|
|
328
338
|
const path = !!this.target ? [this.target] : [];
|
|
329
339
|
if (!!this.currentTarget && this.currentTarget !== this.target)
|
|
330
340
|
path.push(this.currentTarget);
|
|
331
341
|
return path;
|
|
332
342
|
}
|
|
333
|
-
initEvent
|
|
334
|
-
|
|
343
|
+
initEvent(type, bubbles, cancelable) {
|
|
344
|
+
const that = this[state$g];
|
|
345
|
+
if (that[_dispatched])
|
|
335
346
|
return;
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
}
|
|
340
|
-
preventDefault
|
|
341
|
-
|
|
347
|
+
that.type = String(type);
|
|
348
|
+
that.bubbles = !!bubbles;
|
|
349
|
+
that.cancelable = !!cancelable;
|
|
350
|
+
}
|
|
351
|
+
preventDefault() {
|
|
352
|
+
const that = this[state$g];
|
|
353
|
+
if (that[_passive]) {
|
|
342
354
|
console.warn(`Ignoring 'preventDefault()' call on event of type '${this.type}' from a listener registered as 'passive'.`);
|
|
343
355
|
return;
|
|
344
356
|
}
|
|
345
357
|
if (this.cancelable) {
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
358
|
+
that[_preventDefaultCalled] = true;
|
|
359
|
+
that.defaultPrevented = true;
|
|
360
|
+
that.returnValue = false;
|
|
349
361
|
}
|
|
350
|
-
}
|
|
351
|
-
stopImmediatePropagation
|
|
352
|
-
this[state$
|
|
362
|
+
}
|
|
363
|
+
stopImmediatePropagation() {
|
|
364
|
+
this[state$g][_stopImmediatePropagationCalled] = true;
|
|
353
365
|
this.cancelBubble = true;
|
|
354
|
-
}
|
|
366
|
+
}
|
|
355
367
|
stopPropagation() {
|
|
356
368
|
this.cancelBubble = true;
|
|
357
369
|
}
|
|
358
370
|
toString() { return "[object Event]"; }
|
|
359
371
|
get isPolyfill() { return { symbol: polyfill, hierarchy: ["Event"] }; }
|
|
360
372
|
}
|
|
373
|
+
EventP.NONE = 0;
|
|
374
|
+
EventP.CAPTURING_PHASE = 1;
|
|
375
|
+
EventP.AT_TARGET = 2;
|
|
376
|
+
EventP.BUBBLING_PHASE = 3;
|
|
361
377
|
defineStringTag(EventP, "Event");
|
|
378
|
+
const _TimeStamp = Symbol();
|
|
379
|
+
const _isTrusted = Symbol();
|
|
380
|
+
const _passive = Symbol();
|
|
381
|
+
const _dispatched = Symbol();
|
|
382
|
+
const _preventDefaultCalled = Symbol();
|
|
383
|
+
const _stopImmediatePropagationCalled = Symbol();
|
|
362
384
|
class EventState {
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
385
|
+
constructor() {
|
|
386
|
+
this.type = "";
|
|
387
|
+
this.bubbles = false;
|
|
388
|
+
this.cancelable = false;
|
|
389
|
+
this.composed = false;
|
|
390
|
+
this.target = null;
|
|
391
|
+
this.currentTarget = null;
|
|
392
|
+
this.eventPhase = EventP.NONE;
|
|
393
|
+
this.cancelBubble = false;
|
|
394
|
+
this.defaultPrevented = false;
|
|
395
|
+
this.returnValue = true;
|
|
396
|
+
this.timeStamp = (new Date()).getTime() - EventState[_TimeStamp];
|
|
397
|
+
this[_b$2] = false;
|
|
398
|
+
this[_c$1] = false;
|
|
399
|
+
this[_d$1] = false;
|
|
400
|
+
this[_e$1] = false;
|
|
401
|
+
this[_f$1] = false;
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
_a$9 = _TimeStamp, _b$2 = _isTrusted, _c$1 = _passive, _d$1 = _dispatched, _e$1 = _preventDefaultCalled, _f$1 = _stopImmediatePropagationCalled;
|
|
405
|
+
EventState[_a$9] = (new Date()).getTime();
|
|
406
|
+
function createInnerEvent(target, type, eventInitDict, isTrusted = true) {
|
|
407
|
+
const event = new EventP(type, eventInitDict);
|
|
408
|
+
event[state$g].target = target;
|
|
409
|
+
event[state$g][_isTrusted] = isTrusted;
|
|
410
|
+
return event;
|
|
379
411
|
}
|
|
380
412
|
const EventE = g["EventTarget"] ? g["Event"] : EventP;
|
|
381
413
|
|
|
382
|
-
|
|
414
|
+
var _a$8;
|
|
415
|
+
const state$f = Symbol( /* "EventTargetState" */);
|
|
383
416
|
class EventTargetP {
|
|
384
417
|
constructor() {
|
|
385
|
-
this[state$
|
|
418
|
+
this[state$f] = new EventTargetState(this);
|
|
386
419
|
}
|
|
387
|
-
[state$7];
|
|
388
420
|
addEventListener(type, callback, options) {
|
|
421
|
+
const that = this[state$f];
|
|
389
422
|
const executor = new Executor(type, callback);
|
|
390
|
-
executor.options.capture = typeof options === "boolean" ? options : !!options
|
|
391
|
-
if (!
|
|
423
|
+
executor.options.capture = typeof options === "boolean" ? options : !!(options === null || options === void 0 ? void 0 : options.capture);
|
|
424
|
+
if (!that[_executors].some(x => x.equals(executor))) {
|
|
392
425
|
if (typeof options === "object") {
|
|
393
426
|
const { once, passive, signal } = options;
|
|
394
427
|
executor.options.once = !!once;
|
|
395
428
|
executor.options.passive = !!passive;
|
|
396
429
|
if (signal) {
|
|
397
430
|
executor.options.signal = signal;
|
|
398
|
-
|
|
431
|
+
reply.call(that, signal, executor);
|
|
399
432
|
}
|
|
400
433
|
}
|
|
401
|
-
|
|
434
|
+
that[_executors].push(executor);
|
|
402
435
|
const f = (v) => !!v.options.capture ? 0 : 1;
|
|
403
|
-
|
|
436
|
+
that[_executors] = that[_executors].sort((a, b) => f(a) - f(b));
|
|
404
437
|
}
|
|
405
438
|
}
|
|
406
439
|
dispatchEvent(event) {
|
|
@@ -410,104 +443,104 @@ class EventTargetP {
|
|
|
410
443
|
if (!(event instanceof EventP)) {
|
|
411
444
|
throw new TypeError("EventTarget.dispatchEvent: Argument 1 does not implement interface Event.");
|
|
412
445
|
}
|
|
413
|
-
const s = event[state$
|
|
446
|
+
const s = event[state$g];
|
|
414
447
|
s.target = this;
|
|
415
|
-
s
|
|
416
|
-
return this[state$
|
|
448
|
+
s[_isTrusted] = false;
|
|
449
|
+
return fire.call(this[state$f], event);
|
|
417
450
|
}
|
|
418
451
|
removeEventListener(type, callback, options) {
|
|
452
|
+
const that = this[state$f];
|
|
419
453
|
const executor = new Executor(type, callback);
|
|
420
|
-
executor.options.capture = typeof options === "boolean" ? options : !!options
|
|
421
|
-
if (
|
|
422
|
-
|
|
454
|
+
executor.options.capture = typeof options === "boolean" ? options : !!(options === null || options === void 0 ? void 0 : options.capture);
|
|
455
|
+
if (that[_executors].some(x => x.equals(executor))) {
|
|
456
|
+
that[_executors] = that[_executors].filter(x => !x.equals(executor));
|
|
423
457
|
}
|
|
424
458
|
}
|
|
425
459
|
toString() { return "[object EventTarget]"; }
|
|
426
460
|
get isPolyfill() { return { symbol: polyfill, hierarchy: ["EventTarget"] }; }
|
|
427
461
|
}
|
|
428
462
|
defineStringTag(EventTargetP, "EventTarget");
|
|
463
|
+
const _executors = Symbol();
|
|
429
464
|
class EventTargetState {
|
|
430
465
|
constructor(target) {
|
|
466
|
+
this[_a$8] = [];
|
|
431
467
|
this.target = target;
|
|
432
468
|
}
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
const { callback: cb } = executor;
|
|
452
|
-
if (typeof cb === "function")
|
|
453
|
-
cb.call(this.target, event);
|
|
454
|
-
}
|
|
455
|
-
catch (e) {
|
|
456
|
-
console.error(e);
|
|
457
|
-
}
|
|
458
|
-
s._passive = false;
|
|
459
|
-
if (s._stopImmediatePropagationCalled)
|
|
460
|
-
break;
|
|
461
|
-
}
|
|
462
|
-
if (onceIndexes.length > 0) {
|
|
463
|
-
this.executors = this.executors.reduce((acc, cur, index) => {
|
|
464
|
-
if (!onceIndexes.includes(index))
|
|
465
|
-
acc.push(cur);
|
|
466
|
-
return acc;
|
|
467
|
-
}, []);
|
|
468
|
-
}
|
|
469
|
-
s.currentTarget = null;
|
|
470
|
-
s.eventPhase = EventP.NONE;
|
|
471
|
-
s._dispatched = false;
|
|
472
|
-
return !(event.cancelable && s._preventDefaultCalled);
|
|
473
|
-
}
|
|
474
|
-
reply(signal, executor) {
|
|
469
|
+
}
|
|
470
|
+
_a$8 = _executors;
|
|
471
|
+
function fire(event) {
|
|
472
|
+
const s = event[state$g];
|
|
473
|
+
if (!event.target)
|
|
474
|
+
s.target = this.target;
|
|
475
|
+
s.currentTarget = this.target;
|
|
476
|
+
s.eventPhase = EventP.AT_TARGET;
|
|
477
|
+
s[_dispatched] = true;
|
|
478
|
+
const onceIndexes = [];
|
|
479
|
+
for (let i = 0; i < this[_executors].length; ++i) {
|
|
480
|
+
const executor = this[_executors][i];
|
|
481
|
+
if (executor.type !== event.type)
|
|
482
|
+
continue;
|
|
483
|
+
s[_passive] = !!executor.options.passive;
|
|
484
|
+
if (executor.options.once)
|
|
485
|
+
onceIndexes.push(i);
|
|
486
|
+
const { callback: cb } = executor;
|
|
475
487
|
try {
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
signal.removeEventListener("abort", onAbort);
|
|
479
|
-
};
|
|
480
|
-
signal.addEventListener("abort", onAbort);
|
|
488
|
+
if (typeof cb === "function")
|
|
489
|
+
cb.call(this.target, event);
|
|
481
490
|
}
|
|
482
491
|
catch (e) {
|
|
483
492
|
console.error(e);
|
|
484
493
|
}
|
|
494
|
+
s[_passive] = false;
|
|
495
|
+
if (s[_stopImmediatePropagationCalled])
|
|
496
|
+
break;
|
|
497
|
+
}
|
|
498
|
+
if (onceIndexes.length > 0) {
|
|
499
|
+
this[_executors] = this[_executors].reduce((acc, cur, index) => {
|
|
500
|
+
if (onceIndexes.indexOf(index) === -1)
|
|
501
|
+
acc.push(cur);
|
|
502
|
+
return acc;
|
|
503
|
+
}, []);
|
|
485
504
|
}
|
|
505
|
+
s.currentTarget = null;
|
|
506
|
+
s.eventPhase = EventP.NONE;
|
|
507
|
+
s[_dispatched] = false;
|
|
508
|
+
return !(event.cancelable && s[_preventDefaultCalled]);
|
|
486
509
|
}
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
}
|
|
495
|
-
else {
|
|
496
|
-
return cb;
|
|
497
|
-
}
|
|
510
|
+
function reply(signal, executor) {
|
|
511
|
+
const onAbort = () => {
|
|
512
|
+
this[_executors] = this[_executors].filter(x => !x.equals(executor));
|
|
513
|
+
signal.removeEventListener("abort", onAbort);
|
|
514
|
+
};
|
|
515
|
+
try {
|
|
516
|
+
signal.addEventListener("abort", onAbort);
|
|
498
517
|
}
|
|
518
|
+
catch (e) {
|
|
519
|
+
console.error(e);
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
class Executor {
|
|
499
523
|
constructor(type, callback) {
|
|
524
|
+
this.options = {};
|
|
500
525
|
this.type = String(type);
|
|
501
|
-
this.callback =
|
|
526
|
+
this.callback = extract(callback);
|
|
502
527
|
}
|
|
503
|
-
type;
|
|
504
|
-
callback;
|
|
505
|
-
options = {};
|
|
506
528
|
equals(executor) {
|
|
507
529
|
return Object.is(this.type, executor.type) && Object.is(this.callback, executor.callback)
|
|
508
530
|
&& Object.is(this.options.capture, executor.options.capture);
|
|
509
531
|
}
|
|
510
532
|
}
|
|
533
|
+
function extract(cb) {
|
|
534
|
+
if (typeof cb === "function") {
|
|
535
|
+
return cb;
|
|
536
|
+
}
|
|
537
|
+
else if (isEventListenerObject(cb)) {
|
|
538
|
+
return cb.handleEvent;
|
|
539
|
+
}
|
|
540
|
+
else {
|
|
541
|
+
return cb;
|
|
542
|
+
}
|
|
543
|
+
}
|
|
511
544
|
function isEventListenerObject(cb) {
|
|
512
545
|
return !!cb && "handleEvent" in cb && typeof cb.handleEvent === "function";
|
|
513
546
|
}
|
|
@@ -525,54 +558,77 @@ function executeFn(cb, ev) {
|
|
|
525
558
|
}
|
|
526
559
|
const EventTargetE = g["EventTarget"] || EventTargetP;
|
|
527
560
|
|
|
528
|
-
const state$
|
|
561
|
+
const state$e = Symbol( /* "CustomEventState" */);
|
|
529
562
|
class CustomEventP extends EventP {
|
|
530
563
|
constructor(type, eventInitDict) {
|
|
564
|
+
var _a;
|
|
531
565
|
super(type, eventInitDict);
|
|
532
|
-
this[state$
|
|
533
|
-
this[state$
|
|
566
|
+
this[state$e] = new CustomEventState();
|
|
567
|
+
this[state$e].detail = (_a = eventInitDict === null || eventInitDict === void 0 ? void 0 : eventInitDict.detail) !== null && _a !== void 0 ? _a : null;
|
|
534
568
|
}
|
|
535
|
-
[state$
|
|
536
|
-
get detail() { return this[state$6].detail; }
|
|
569
|
+
get detail() { return this[state$e].detail; }
|
|
537
570
|
initCustomEvent(type, bubbles, cancelable, detail) {
|
|
538
|
-
if (this[state$
|
|
571
|
+
if (this[state$g][_dispatched])
|
|
539
572
|
return;
|
|
540
573
|
this.initEvent(type, bubbles, cancelable);
|
|
541
|
-
this[state$
|
|
574
|
+
this[state$e].detail = detail !== null && detail !== void 0 ? detail : null;
|
|
542
575
|
}
|
|
543
576
|
toString() { return "[object CustomEvent]"; }
|
|
544
577
|
get isPolyfill() { return { symbol: polyfill, hierarchy: ["CustomEvent", "Event"] }; }
|
|
545
578
|
}
|
|
546
579
|
defineStringTag(CustomEventP, "CustomEvent");
|
|
547
580
|
class CustomEventState {
|
|
548
|
-
detail;
|
|
549
581
|
}
|
|
550
582
|
const CustomEventE = g["EventTarget"] ? g["CustomEvent"] : CustomEventP;
|
|
551
583
|
|
|
552
|
-
const state$
|
|
584
|
+
const state$d = Symbol( /* "ProgressEventState" */);
|
|
553
585
|
class ProgressEventP extends EventP {
|
|
554
586
|
constructor(type, eventInitDict) {
|
|
587
|
+
var _a, _b;
|
|
555
588
|
super(type, eventInitDict);
|
|
556
|
-
this[state$
|
|
557
|
-
this[state$
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
get lengthComputable() { return this[state$
|
|
563
|
-
get loaded() { return this[state$
|
|
564
|
-
get total() { return this[state$
|
|
589
|
+
this[state$d] = new ProgressEventState();
|
|
590
|
+
const that = this[state$d];
|
|
591
|
+
that.lengthComputable = !!(eventInitDict === null || eventInitDict === void 0 ? void 0 : eventInitDict.lengthComputable);
|
|
592
|
+
that.loaded = (_a = eventInitDict === null || eventInitDict === void 0 ? void 0 : eventInitDict.loaded) !== null && _a !== void 0 ? _a : 0;
|
|
593
|
+
that.total = (_b = eventInitDict === null || eventInitDict === void 0 ? void 0 : eventInitDict.total) !== null && _b !== void 0 ? _b : 0;
|
|
594
|
+
}
|
|
595
|
+
get lengthComputable() { return getValue(this[state$d].lengthComputable); }
|
|
596
|
+
get loaded() { return getValue(this[state$d].loaded); }
|
|
597
|
+
get total() { return getValue(this[state$d].total); }
|
|
565
598
|
toString() { return "[object ProgressEvent]"; }
|
|
566
599
|
get isPolyfill() { return { symbol: polyfill, hierarchy: ["ProgressEvent", "Event"] }; }
|
|
567
600
|
}
|
|
568
601
|
defineStringTag(ProgressEventP, "ProgressEvent");
|
|
569
602
|
class ProgressEventState {
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
603
|
+
constructor() {
|
|
604
|
+
this.lengthComputable = false;
|
|
605
|
+
this.loaded = 0;
|
|
606
|
+
this.total = 0;
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
function getValue(val) {
|
|
610
|
+
return typeof val === "function" ? val() : val;
|
|
611
|
+
}
|
|
612
|
+
function createInnerProgressEvent(target, type, { lengthComputable = false, loaded = 0, total = 0, } = {}) {
|
|
613
|
+
const event = new ProgressEventP(type);
|
|
614
|
+
event[state$d].lengthComputable = lengthComputable;
|
|
615
|
+
event[state$d].loaded = loaded;
|
|
616
|
+
event[state$d].total = total;
|
|
617
|
+
event[state$g].target = target;
|
|
618
|
+
event[state$g][_isTrusted] = true;
|
|
619
|
+
return event;
|
|
620
|
+
}
|
|
621
|
+
function emitProcessEvent(target, type, loaded = 0, total = 0) {
|
|
622
|
+
const event = createInnerProgressEvent(target, type, {
|
|
623
|
+
lengthComputable: () => { return getValue(total) > 0; },
|
|
624
|
+
loaded,
|
|
625
|
+
total,
|
|
626
|
+
});
|
|
627
|
+
fire.call(target[state$f], event);
|
|
573
628
|
}
|
|
574
629
|
const ProgressEventE = g["EventTarget"] ? g["ProgressEvent"] : ProgressEventP;
|
|
575
630
|
|
|
631
|
+
const state$c = Symbol( /* "BlobState" */);
|
|
576
632
|
class BlobP {
|
|
577
633
|
constructor(blobParts = [], options) {
|
|
578
634
|
if (!Array.isArray(blobParts)) {
|
|
@@ -581,7 +637,7 @@ class BlobP {
|
|
|
581
637
|
let encoder = null;
|
|
582
638
|
let chunks = blobParts.reduce((chunks, part) => {
|
|
583
639
|
if (isPolyfillType("Blob", part)) {
|
|
584
|
-
chunks.push(part[state$
|
|
640
|
+
chunks.push(part[state$c][_u8array]);
|
|
585
641
|
}
|
|
586
642
|
else if (part instanceof ArrayBuffer || ArrayBuffer.isView(part)) {
|
|
587
643
|
chunks.push(convert$1(part));
|
|
@@ -594,42 +650,42 @@ class BlobP {
|
|
|
594
650
|
}
|
|
595
651
|
return chunks;
|
|
596
652
|
}, []);
|
|
597
|
-
this[state$
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
get size() { return this[state$
|
|
604
|
-
get type() { return this[state$
|
|
653
|
+
this[state$c] = new BlobState(concat(chunks));
|
|
654
|
+
const that = this[state$c];
|
|
655
|
+
that.size = that[_u8array].length;
|
|
656
|
+
const rawType = (options === null || options === void 0 ? void 0 : options.type) || "";
|
|
657
|
+
that.type = /[^\u0020-\u007E]/.test(rawType) ? "" : rawType.toLowerCase();
|
|
658
|
+
}
|
|
659
|
+
get size() { return this[state$c].size; }
|
|
660
|
+
get type() { return this[state$c].type; }
|
|
605
661
|
arrayBuffer() {
|
|
606
|
-
return Promise.resolve(clone(this[state$
|
|
662
|
+
return Promise.resolve(clone(this[state$c][_u8array].buffer).buffer);
|
|
607
663
|
}
|
|
608
664
|
bytes() {
|
|
609
|
-
return Promise.resolve(clone(this[state$
|
|
665
|
+
return Promise.resolve(clone(this[state$c][_u8array].buffer));
|
|
610
666
|
}
|
|
611
667
|
slice(start, end, contentType) {
|
|
612
|
-
const sliced = this[state$
|
|
613
|
-
return new BlobP([sliced], { type: contentType
|
|
668
|
+
const sliced = this[state$c][_u8array].slice(start !== null && start !== void 0 ? start : 0, end !== null && end !== void 0 ? end : this[state$c][_u8array].length);
|
|
669
|
+
return new BlobP([sliced], { type: contentType !== null && contentType !== void 0 ? contentType : "" });
|
|
614
670
|
}
|
|
615
671
|
stream() {
|
|
616
672
|
throw new ReferenceError("ReadableStream is not defined");
|
|
617
673
|
}
|
|
618
674
|
text() {
|
|
619
675
|
const decoder = new TextDecoderP();
|
|
620
|
-
return Promise.resolve(decoder.decode(this[state$
|
|
676
|
+
return Promise.resolve(decoder.decode(this[state$c][_u8array]));
|
|
621
677
|
}
|
|
622
678
|
toString() { return "[object Blob]"; }
|
|
623
679
|
get isPolyfill() { return { symbol: polyfill, hierarchy: ["Blob"] }; }
|
|
624
680
|
}
|
|
625
681
|
defineStringTag(BlobP, "Blob");
|
|
682
|
+
const _u8array = Symbol();
|
|
626
683
|
class BlobState {
|
|
627
684
|
constructor(buffer) {
|
|
628
|
-
this.
|
|
685
|
+
this.size = 0;
|
|
686
|
+
this.type = "";
|
|
687
|
+
this[_u8array] = buffer;
|
|
629
688
|
}
|
|
630
|
-
size = 0;
|
|
631
|
-
type = "";
|
|
632
|
-
_u8array;
|
|
633
689
|
}
|
|
634
690
|
function u8array2base64(input) {
|
|
635
691
|
let byteToCharMap = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
|
|
@@ -676,151 +732,151 @@ function concat(chunks) {
|
|
|
676
732
|
}
|
|
677
733
|
const BlobE = g["Blob"] || BlobP;
|
|
678
734
|
|
|
679
|
-
const state$
|
|
735
|
+
const state$b = Symbol( /* "FileState" */);
|
|
680
736
|
class FileP extends BlobP {
|
|
681
737
|
constructor(fileBits, fileName, options) {
|
|
682
738
|
super(fileBits, options);
|
|
683
|
-
this[state$
|
|
684
|
-
this[state$
|
|
685
|
-
this[state$
|
|
739
|
+
this[state$b] = new FileState();
|
|
740
|
+
this[state$b].lastModified = +((options === null || options === void 0 ? void 0 : options.lastModified) ? new Date(options.lastModified) : new Date());
|
|
741
|
+
this[state$b].name = fileName.replace(/\//g, ":");
|
|
686
742
|
}
|
|
687
|
-
[state$
|
|
688
|
-
get
|
|
689
|
-
get name() { return this[state$4].name; }
|
|
743
|
+
get lastModified() { return this[state$b].lastModified; }
|
|
744
|
+
get name() { return this[state$b].name; }
|
|
690
745
|
get webkitRelativePath() { return ""; }
|
|
691
746
|
toString() { return "[object File]"; }
|
|
692
747
|
get isPolyfill() { return { symbol: polyfill, hierarchy: ["File", "Blob"] }; }
|
|
693
748
|
}
|
|
694
749
|
defineStringTag(FileP, "File");
|
|
695
750
|
class FileState {
|
|
696
|
-
|
|
697
|
-
|
|
751
|
+
constructor() {
|
|
752
|
+
this.lastModified = 0;
|
|
753
|
+
this.name = "";
|
|
754
|
+
}
|
|
698
755
|
}
|
|
699
756
|
const FileE = g["Blob"] ? g["File"] : FileP;
|
|
700
757
|
|
|
701
|
-
|
|
758
|
+
var _a$7;
|
|
759
|
+
const state$a = Symbol( /* "FileReaderState" */);
|
|
702
760
|
class FileReaderP extends EventTargetP {
|
|
703
|
-
static EMPTY = 0;
|
|
704
|
-
static LOADING = 1;
|
|
705
|
-
static DONE = 2;
|
|
706
761
|
constructor() {
|
|
707
762
|
super();
|
|
708
|
-
this
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
763
|
+
this.EMPTY = 0;
|
|
764
|
+
this.LOADING = 1;
|
|
765
|
+
this.DONE = 2;
|
|
766
|
+
this.readAsArrayBuffer = (blob) => {
|
|
767
|
+
read$1.call(this[state$a], "readAsArrayBuffer", blob, () => {
|
|
768
|
+
this[state$a].result = blob[state$c][_u8array].buffer.slice(0);
|
|
769
|
+
});
|
|
770
|
+
};
|
|
771
|
+
this.readAsBinaryString = (blob) => {
|
|
772
|
+
read$1.call(this[state$a], "readAsBinaryString", blob, () => {
|
|
773
|
+
this[state$a].result = blob[state$c][_u8array].reduce((acc, cur) => {
|
|
774
|
+
acc += String.fromCharCode(cur);
|
|
775
|
+
return acc;
|
|
776
|
+
}, "");
|
|
777
|
+
});
|
|
778
|
+
};
|
|
779
|
+
this.readAsDataURL = (blob) => {
|
|
780
|
+
read$1.call(this[state$a], "readAsDataURL", blob, () => {
|
|
781
|
+
this[state$a].result = "data:" + blob.type + ";base64," + u8array2base64(blob[state$c][_u8array]);
|
|
782
|
+
});
|
|
783
|
+
};
|
|
784
|
+
this.readAsText = (blob, encoding) => {
|
|
785
|
+
read$1.call(this[state$a], "readAsText", blob, () => {
|
|
786
|
+
this[state$a].result = (new TextDecoderP(encoding)).decode(blob[state$c][_u8array]);
|
|
787
|
+
});
|
|
788
|
+
};
|
|
789
|
+
this[state$a] = new FileReaderState(this);
|
|
790
|
+
}
|
|
791
|
+
get readyState() { return this[state$a].readyState; }
|
|
792
|
+
get result() { return this[state$a].result; }
|
|
793
|
+
get error() { return this[state$a].error; }
|
|
717
794
|
abort() {
|
|
718
795
|
if (this.readyState === FileReaderP.LOADING) {
|
|
719
|
-
this[state$
|
|
720
|
-
this[state$
|
|
721
|
-
|
|
722
|
-
}
|
|
723
|
-
}
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
}
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
};
|
|
737
|
-
readAsDataURL = (blob) => {
|
|
738
|
-
this[state$3].read("readAsDataURL", blob, () => {
|
|
739
|
-
this[state$3].result = "data:" + blob.type + ";base64," + u8array2base64(blob[state$9]._u8array);
|
|
740
|
-
});
|
|
741
|
-
};
|
|
742
|
-
readAsText = (blob, encoding) => {
|
|
743
|
-
this[state$3].read("readAsText", blob, () => {
|
|
744
|
-
this[state$3].result = (new TextDecoderP(encoding)).decode(blob[state$9]._u8array);
|
|
745
|
-
});
|
|
746
|
-
};
|
|
747
|
-
get onabort() { return this[state$3].onabort; }
|
|
748
|
-
set onabort(value) { this[state$3].onabort = value; this[state$3].attach("abort"); }
|
|
749
|
-
get onerror() { return this[state$3].onerror; }
|
|
750
|
-
set onerror(value) { this[state$3].onerror = value; this[state$3].attach("error"); }
|
|
751
|
-
get onload() { return this[state$3].onload; }
|
|
752
|
-
set onload(value) { this[state$3].onload = value; this[state$3].attach("load"); }
|
|
753
|
-
get onloadend() { return this[state$3].onloadend; }
|
|
754
|
-
set onloadend(value) { this[state$3].onloadend = value; this[state$3].attach("loadend"); }
|
|
755
|
-
get onloadstart() { return this[state$3].onloadstart; }
|
|
756
|
-
set onloadstart(value) { this[state$3].onloadstart = value; this[state$3].attach("loadstart"); }
|
|
757
|
-
get onprogress() { return this[state$3].onprogress; }
|
|
758
|
-
set onprogress(value) { this[state$3].onprogress = value; this[state$3].attach("progress"); }
|
|
796
|
+
this[state$a].readyState = FileReaderP.DONE;
|
|
797
|
+
this[state$a].result = null;
|
|
798
|
+
emitProcessEvent(this, "abort");
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
get onabort() { return this[state$a].onabort; }
|
|
802
|
+
set onabort(value) { this[state$a].onabort = value; attach$1.call(this[state$a], "abort"); }
|
|
803
|
+
get onerror() { return this[state$a].onerror; }
|
|
804
|
+
set onerror(value) { this[state$a].onerror = value; attach$1.call(this[state$a], "error"); }
|
|
805
|
+
get onload() { return this[state$a].onload; }
|
|
806
|
+
set onload(value) { this[state$a].onload = value; attach$1.call(this[state$a], "load"); }
|
|
807
|
+
get onloadend() { return this[state$a].onloadend; }
|
|
808
|
+
set onloadend(value) { this[state$a].onloadend = value; attach$1.call(this[state$a], "loadend"); }
|
|
809
|
+
get onloadstart() { return this[state$a].onloadstart; }
|
|
810
|
+
set onloadstart(value) { this[state$a].onloadstart = value; attach$1.call(this[state$a], "loadstart"); }
|
|
811
|
+
get onprogress() { return this[state$a].onprogress; }
|
|
812
|
+
set onprogress(value) { this[state$a].onprogress = value; attach$1.call(this[state$a], "progress"); }
|
|
759
813
|
toString() { return "[object FileReader]"; }
|
|
760
814
|
get isPolyfill() { return { symbol: polyfill, hierarchy: ["FileReader", "EventTarget"] }; }
|
|
761
815
|
}
|
|
816
|
+
FileReaderP.EMPTY = 0;
|
|
817
|
+
FileReaderP.LOADING = 1;
|
|
818
|
+
FileReaderP.DONE = 2;
|
|
762
819
|
defineStringTag(FileReaderP, "FileReader");
|
|
820
|
+
const _handlers$3 = Symbol();
|
|
763
821
|
class FileReaderState {
|
|
764
822
|
constructor(target) {
|
|
823
|
+
this.readyState = FileReaderP.EMPTY;
|
|
824
|
+
this.result = null;
|
|
825
|
+
this.error = null;
|
|
826
|
+
this[_a$7] = getHandlers$3.call(this);
|
|
827
|
+
this.onabort = null;
|
|
828
|
+
this.onerror = null;
|
|
829
|
+
this.onload = null;
|
|
830
|
+
this.onloadend = null;
|
|
831
|
+
this.onloadstart = null;
|
|
832
|
+
this.onprogress = null;
|
|
765
833
|
this.target = target;
|
|
766
834
|
}
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
if (!isPolyfillType("Blob", blob)) {
|
|
773
|
-
throw new TypeError("Failed to execute '" + kind + "' on 'FileReader': parameter 1 is not of type 'Blob'.");
|
|
774
|
-
}
|
|
775
|
-
this.error = null;
|
|
776
|
-
this.readyState = FileReaderP.LOADING;
|
|
777
|
-
this.emitProcessEvent("loadstart", 0, blob.size);
|
|
778
|
-
setTimeout(() => {
|
|
779
|
-
if (this.readyState === FileReaderP.LOADING) {
|
|
780
|
-
this.readyState = FileReaderP.DONE;
|
|
781
|
-
try {
|
|
782
|
-
setResult();
|
|
783
|
-
this.emitProcessEvent("load", blob.size, blob.size);
|
|
784
|
-
}
|
|
785
|
-
catch (e) {
|
|
786
|
-
this.result = null;
|
|
787
|
-
this.error = e;
|
|
788
|
-
this.emitProcessEvent("error", 0, blob.size);
|
|
789
|
-
}
|
|
790
|
-
}
|
|
791
|
-
this.emitProcessEvent("loadend", !!this.result ? blob.size : 0, blob.size);
|
|
792
|
-
});
|
|
835
|
+
}
|
|
836
|
+
_a$7 = _handlers$3;
|
|
837
|
+
function read$1(kind, blob, setResult) {
|
|
838
|
+
if (!isPolyfillType("Blob", blob)) {
|
|
839
|
+
throw new TypeError("Failed to execute '" + kind + "' on 'FileReader': parameter 1 is not of type 'Blob'.");
|
|
793
840
|
}
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
841
|
+
this.error = null;
|
|
842
|
+
this.readyState = FileReaderP.LOADING;
|
|
843
|
+
emitProcessEvent(this.target, "loadstart", 0, blob.size);
|
|
844
|
+
setTimeout(() => {
|
|
845
|
+
if (this.readyState === FileReaderP.LOADING) {
|
|
846
|
+
this.readyState = FileReaderP.DONE;
|
|
847
|
+
try {
|
|
848
|
+
setResult();
|
|
849
|
+
emitProcessEvent(this.target, "load", blob.size, blob.size);
|
|
850
|
+
}
|
|
851
|
+
catch (e) {
|
|
852
|
+
this.result = null;
|
|
853
|
+
this.error = e;
|
|
854
|
+
emitProcessEvent(this.target, "error", 0, blob.size);
|
|
855
|
+
}
|
|
856
|
+
}
|
|
857
|
+
emitProcessEvent(this.target, "loadend", !!this.result ? blob.size : 0, blob.size);
|
|
858
|
+
});
|
|
859
|
+
}
|
|
860
|
+
function attach$1(type) {
|
|
861
|
+
const fnName = ("on" + type);
|
|
862
|
+
const cb = this[fnName];
|
|
863
|
+
const listener = this[_handlers$3][fnName];
|
|
864
|
+
attachFn.call(this.target, type, cb, listener);
|
|
865
|
+
}
|
|
866
|
+
function getHandlers$3() {
|
|
867
|
+
return {
|
|
868
|
+
onabort: (ev) => { executeFn.call(this.target, this.onabort, ev); },
|
|
869
|
+
onerror: (ev) => { executeFn.call(this.target, this.onerror, ev); },
|
|
870
|
+
onload: (ev) => { executeFn.call(this.target, this.onload, ev); },
|
|
871
|
+
onloadend: (ev) => { executeFn.call(this.target, this.onloadend, ev); },
|
|
872
|
+
onloadstart: (ev) => { executeFn.call(this.target, this.onloadstart, ev); },
|
|
873
|
+
onprogress: (ev) => { executeFn.call(this.target, this.onprogress, ev); },
|
|
874
|
+
};
|
|
821
875
|
}
|
|
822
876
|
const FileReaderE = g["Blob"] ? g["FileReader"] : FileReaderP;
|
|
823
877
|
|
|
878
|
+
var _a$6;
|
|
879
|
+
const state$9 = Symbol( /* "FormDataState" */);
|
|
824
880
|
class FormDataP {
|
|
825
881
|
constructor(form, submitter) {
|
|
826
882
|
if (form !== void 0) {
|
|
@@ -831,20 +887,19 @@ class FormDataP {
|
|
|
831
887
|
}
|
|
832
888
|
this[state$9] = new FormDataState();
|
|
833
889
|
}
|
|
834
|
-
[state$9];
|
|
835
890
|
append(name, value, filename) {
|
|
836
|
-
this[state$9].
|
|
891
|
+
this[state$9][_formData].push(normalizeArgs(name, value, filename));
|
|
837
892
|
}
|
|
838
893
|
delete(name) {
|
|
839
894
|
const result = [];
|
|
840
895
|
name = String(name);
|
|
841
|
-
each(this[state$9]
|
|
896
|
+
each(this[state$9][_formData], entry => {
|
|
842
897
|
entry[0] !== name && result.push(entry);
|
|
843
898
|
});
|
|
844
|
-
this[state$9]
|
|
899
|
+
this[state$9][_formData] = result;
|
|
845
900
|
}
|
|
846
901
|
get(name) {
|
|
847
|
-
const entries = this[state$9]
|
|
902
|
+
const entries = this[state$9][_formData];
|
|
848
903
|
name = String(name);
|
|
849
904
|
for (let i = 0; i < entries.length; ++i) {
|
|
850
905
|
if (entries[i][0] === name) {
|
|
@@ -856,15 +911,15 @@ class FormDataP {
|
|
|
856
911
|
getAll(name) {
|
|
857
912
|
const result = [];
|
|
858
913
|
name = String(name);
|
|
859
|
-
each(this[state$9]
|
|
914
|
+
each(this[state$9][_formData], data => {
|
|
860
915
|
data[0] === name && result.push(data[1]);
|
|
861
916
|
});
|
|
862
917
|
return result;
|
|
863
918
|
}
|
|
864
919
|
has(name) {
|
|
865
920
|
name = String(name);
|
|
866
|
-
for (let i = 0; i < this[state$9].
|
|
867
|
-
if (this[state$9]
|
|
921
|
+
for (let i = 0; i < this[state$9][_formData].length; ++i) {
|
|
922
|
+
if (this[state$9][_formData][i][0] === name) {
|
|
868
923
|
return true;
|
|
869
924
|
}
|
|
870
925
|
}
|
|
@@ -875,13 +930,13 @@ class FormDataP {
|
|
|
875
930
|
const result = [];
|
|
876
931
|
const args = normalizeArgs(name, value, filename);
|
|
877
932
|
let replace = true;
|
|
878
|
-
each(this[state$9]
|
|
933
|
+
each(this[state$9][_formData], data => {
|
|
879
934
|
data[0] === name
|
|
880
935
|
? replace && (replace = !result.push(args))
|
|
881
936
|
: result.push(data);
|
|
882
937
|
});
|
|
883
938
|
replace && result.push(args);
|
|
884
|
-
this[state$9]
|
|
939
|
+
this[state$9][_formData] = result;
|
|
885
940
|
}
|
|
886
941
|
forEach(callbackfn, thisArg) {
|
|
887
942
|
for (const [name, value] of this) {
|
|
@@ -889,13 +944,13 @@ class FormDataP {
|
|
|
889
944
|
}
|
|
890
945
|
}
|
|
891
946
|
entries() {
|
|
892
|
-
return this[state$9].
|
|
947
|
+
return this[state$9][_formData].values();
|
|
893
948
|
}
|
|
894
949
|
keys() {
|
|
895
|
-
return this[state$9].
|
|
950
|
+
return this[state$9][_formData].map(x => x[0]).values();
|
|
896
951
|
}
|
|
897
952
|
values() {
|
|
898
|
-
return this[state$9].
|
|
953
|
+
return this[state$9][_formData].map(x => x[1]).values();
|
|
899
954
|
}
|
|
900
955
|
[Symbol.iterator]() {
|
|
901
956
|
return this.entries();
|
|
@@ -904,13 +959,16 @@ class FormDataP {
|
|
|
904
959
|
get isPolyfill() { return { symbol: polyfill, hierarchy: ["FormData"] }; }
|
|
905
960
|
}
|
|
906
961
|
defineStringTag(FormDataP, "FormData");
|
|
962
|
+
const _formData = Symbol();
|
|
907
963
|
class FormDataState {
|
|
908
|
-
|
|
964
|
+
constructor() {
|
|
965
|
+
this[_a$6] = [];
|
|
966
|
+
}
|
|
909
967
|
toBlob() {
|
|
910
968
|
const boundary = "----formdata-polyfill-" + Math.random();
|
|
911
969
|
const p = `--${boundary}\r\nContent-Disposition: form-data; name="`;
|
|
912
970
|
let chunks = [];
|
|
913
|
-
for (const [name, value] of this.
|
|
971
|
+
for (const [name, value] of this[_formData].values()) {
|
|
914
972
|
if (typeof value === "string") {
|
|
915
973
|
chunks.push(p + escape(normalizeLinefeeds(name)) + `"\r\n\r\n${normalizeLinefeeds(value)}\r\n`);
|
|
916
974
|
}
|
|
@@ -924,6 +982,7 @@ class FormDataState {
|
|
|
924
982
|
});
|
|
925
983
|
}
|
|
926
984
|
}
|
|
985
|
+
_a$6 = _formData;
|
|
927
986
|
function normalizeArgs(name, value, filename) {
|
|
928
987
|
if (isPolyfillType("Blob", value)) {
|
|
929
988
|
filename = filename !== undefined
|
|
@@ -954,7 +1013,7 @@ function escape(str) {
|
|
|
954
1013
|
* @param body - Text in multipart/form-data format (including boundaries and data)
|
|
955
1014
|
* @returns Parsed FormData object (text fields as strings, files as File objects)
|
|
956
1015
|
*/
|
|
957
|
-
function
|
|
1016
|
+
function createFormDataFromBody(body, errMsg = "Failed to fetch") {
|
|
958
1017
|
const formData = new FormDataP();
|
|
959
1018
|
if (typeof body !== "string" || body.trim() === "") {
|
|
960
1019
|
return formData;
|
|
@@ -963,7 +1022,7 @@ function createFormData(body) {
|
|
|
963
1022
|
const firstLineEnd = body.indexOf("\r\n");
|
|
964
1023
|
if (firstLineEnd === -1) {
|
|
965
1024
|
// Invalid multipart format: Missing line break in header
|
|
966
|
-
throw new TypeError(
|
|
1025
|
+
throw new TypeError(errMsg);
|
|
967
1026
|
}
|
|
968
1027
|
const boundary = body.substring(2, firstLineEnd).trim();
|
|
969
1028
|
if (!boundary) {
|
|
@@ -977,7 +1036,7 @@ function createFormData(body) {
|
|
|
977
1036
|
});
|
|
978
1037
|
if (parts.length === 0) {
|
|
979
1038
|
// Invalid multipart format: No parts found
|
|
980
|
-
throw new TypeError(
|
|
1039
|
+
throw new TypeError(errMsg);
|
|
981
1040
|
}
|
|
982
1041
|
// 3. Parse each part
|
|
983
1042
|
parts.forEach(part => {
|
|
@@ -985,7 +1044,7 @@ function createFormData(body) {
|
|
|
985
1044
|
const separatorIndex = part.indexOf("\r\n\r\n");
|
|
986
1045
|
if (separatorIndex === -1) {
|
|
987
1046
|
// Invalid part format: Missing header-content separator
|
|
988
|
-
throw new TypeError(
|
|
1047
|
+
throw new TypeError(errMsg);
|
|
989
1048
|
}
|
|
990
1049
|
// Extract header (Content-Disposition and Content-Type)
|
|
991
1050
|
const headerRaw = part.substring(0, separatorIndex).trim();
|
|
@@ -996,7 +1055,7 @@ function createFormData(body) {
|
|
|
996
1055
|
const contentTypeMatch = headerRaw.match(/Content-Type: ([^\r\n]+)/); // MIME type (optional)
|
|
997
1056
|
if (!nameMatch || !nameMatch[1]) {
|
|
998
1057
|
// Invalid part format: Missing field name
|
|
999
|
-
throw new TypeError(
|
|
1058
|
+
throw new TypeError(errMsg);
|
|
1000
1059
|
}
|
|
1001
1060
|
const fieldName = nameMatch[1];
|
|
1002
1061
|
const isFile = !!filenameMatch; // Whether it's a file field
|
|
@@ -1017,7 +1076,7 @@ function createFormData(body) {
|
|
|
1017
1076
|
}
|
|
1018
1077
|
catch (e) {
|
|
1019
1078
|
// `Failed to process file field "${fieldName}": ${(e as Error).message}`
|
|
1020
|
-
throw new TypeError(
|
|
1079
|
+
throw new TypeError(errMsg);
|
|
1021
1080
|
}
|
|
1022
1081
|
}
|
|
1023
1082
|
else {
|
|
@@ -1030,25 +1089,26 @@ function createFormData(body) {
|
|
|
1030
1089
|
}
|
|
1031
1090
|
const FormDataE = g["FormData"] || FormDataP;
|
|
1032
1091
|
|
|
1092
|
+
var _a$5;
|
|
1093
|
+
const state$8 = Symbol( /* "URLSearchParamsState" */);
|
|
1033
1094
|
class URLSearchParamsP {
|
|
1034
1095
|
constructor(init) {
|
|
1035
1096
|
let search = init || "";
|
|
1036
1097
|
if (isObjectType("URLSearchParams", search)) {
|
|
1037
1098
|
search = search.toString();
|
|
1038
1099
|
}
|
|
1039
|
-
this[state$
|
|
1040
|
-
this[state$
|
|
1100
|
+
this[state$8] = new URLSearchParamsState();
|
|
1101
|
+
this[state$8][_urlspDict] = parseToDict(search);
|
|
1041
1102
|
}
|
|
1042
|
-
[state$9];
|
|
1043
1103
|
get size() {
|
|
1044
|
-
return
|
|
1104
|
+
return objectValues(this[state$8][_urlspDict]).reduce((acc, cur) => acc + cur.length, 0);
|
|
1045
1105
|
}
|
|
1046
1106
|
append(name, value) {
|
|
1047
|
-
appendTo(this[state$
|
|
1107
|
+
appendTo(this[state$8][_urlspDict], name, value);
|
|
1048
1108
|
}
|
|
1049
1109
|
delete(name, value) {
|
|
1050
1110
|
let dict = {};
|
|
1051
|
-
for (let [key, values] of
|
|
1111
|
+
for (let [key, values] of objectEntries(this[state$8][_urlspDict])) {
|
|
1052
1112
|
if (key === name) {
|
|
1053
1113
|
if (value !== undefined) {
|
|
1054
1114
|
let vals = values.filter(x => x !== ("" + value));
|
|
@@ -1059,64 +1119,66 @@ class URLSearchParamsP {
|
|
|
1059
1119
|
}
|
|
1060
1120
|
Object.assign(dict, { [key]: values });
|
|
1061
1121
|
}
|
|
1062
|
-
this[state$
|
|
1122
|
+
this[state$8][_urlspDict] = dict;
|
|
1063
1123
|
}
|
|
1064
1124
|
get(name) {
|
|
1065
|
-
|
|
1125
|
+
var _b;
|
|
1126
|
+
return this.has(name) ? (_b = this[state$8][_urlspDict][name][0]) !== null && _b !== void 0 ? _b : null : null;
|
|
1066
1127
|
}
|
|
1067
1128
|
getAll(name) {
|
|
1068
|
-
return this.has(name) ? this[state$
|
|
1129
|
+
return this.has(name) ? this[state$8][_urlspDict][name].slice(0) : [];
|
|
1069
1130
|
}
|
|
1070
1131
|
has(name, value) {
|
|
1071
|
-
if (hasOwnProperty(this[state$
|
|
1132
|
+
if (hasOwnProperty(this[state$8][_urlspDict], name)) {
|
|
1072
1133
|
if (value !== undefined) {
|
|
1073
|
-
return this[state$
|
|
1134
|
+
return this[state$8][_urlspDict][name].indexOf(("" + value)) > -1;
|
|
1074
1135
|
}
|
|
1075
1136
|
return true;
|
|
1076
1137
|
}
|
|
1077
1138
|
return false;
|
|
1078
1139
|
}
|
|
1079
1140
|
set(name, value) {
|
|
1080
|
-
this[state$
|
|
1141
|
+
this[state$8][_urlspDict][name] = ["" + value];
|
|
1081
1142
|
}
|
|
1082
1143
|
sort() {
|
|
1083
|
-
|
|
1144
|
+
const that = this[state$8];
|
|
1145
|
+
let keys = Object.keys(that[_urlspDict]);
|
|
1084
1146
|
keys.sort();
|
|
1085
1147
|
let dict = {};
|
|
1086
1148
|
for (let key of keys) {
|
|
1087
|
-
Object.assign(dict, { [key]:
|
|
1149
|
+
Object.assign(dict, { [key]: that[_urlspDict][key] });
|
|
1088
1150
|
}
|
|
1089
|
-
|
|
1151
|
+
that[_urlspDict] = dict;
|
|
1090
1152
|
}
|
|
1091
1153
|
forEach(callbackfn, thisArg) {
|
|
1092
|
-
|
|
1154
|
+
objectEntries(this[state$8][_urlspDict]).forEach(([key, values]) => {
|
|
1093
1155
|
values.forEach(value => {
|
|
1094
1156
|
callbackfn.call(thisArg, value, key, this);
|
|
1095
1157
|
});
|
|
1096
1158
|
});
|
|
1097
1159
|
}
|
|
1098
1160
|
entries() {
|
|
1099
|
-
return
|
|
1161
|
+
return objectEntries(this[state$8][_urlspDict])
|
|
1100
1162
|
.map(([key, values]) => {
|
|
1101
1163
|
return values.map(value => {
|
|
1102
1164
|
return [key, value];
|
|
1103
1165
|
});
|
|
1104
1166
|
})
|
|
1105
|
-
.
|
|
1167
|
+
.reduce(flatCb, [])
|
|
1106
1168
|
.values();
|
|
1107
1169
|
}
|
|
1108
1170
|
keys() {
|
|
1109
|
-
return Object.keys(this[state$
|
|
1171
|
+
return Object.keys(this[state$8][_urlspDict]).values();
|
|
1110
1172
|
}
|
|
1111
1173
|
values() {
|
|
1112
|
-
return
|
|
1174
|
+
return objectValues(this[state$8][_urlspDict]).reduce(flatCb, []).values();
|
|
1113
1175
|
}
|
|
1114
1176
|
[Symbol.iterator]() {
|
|
1115
1177
|
return this.entries();
|
|
1116
1178
|
}
|
|
1117
1179
|
toString() {
|
|
1118
1180
|
let query = [];
|
|
1119
|
-
for (let [key, values] of
|
|
1181
|
+
for (let [key, values] of objectEntries(this[state$8][_urlspDict])) {
|
|
1120
1182
|
let name = encode$1(key);
|
|
1121
1183
|
for (let val of values) {
|
|
1122
1184
|
query.push(name + "=" + encode$1(val));
|
|
@@ -1127,9 +1189,13 @@ class URLSearchParamsP {
|
|
|
1127
1189
|
get isPolyfill() { return { symbol: polyfill, hierarchy: ["URLSearchParams"] }; }
|
|
1128
1190
|
}
|
|
1129
1191
|
defineStringTag(URLSearchParamsP, "URLSearchParams");
|
|
1192
|
+
const _urlspDict = Symbol();
|
|
1130
1193
|
class URLSearchParamsState {
|
|
1131
|
-
|
|
1194
|
+
constructor() {
|
|
1195
|
+
this[_a$5] = {};
|
|
1196
|
+
}
|
|
1132
1197
|
}
|
|
1198
|
+
_a$5 = _urlspDict;
|
|
1133
1199
|
function parseToDict(search) {
|
|
1134
1200
|
let dict = {};
|
|
1135
1201
|
if (typeof search === "object") {
|
|
@@ -1203,26 +1269,34 @@ function decode$1(str) {
|
|
|
1203
1269
|
function hasOwnProperty(obj, prop) {
|
|
1204
1270
|
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
1205
1271
|
}
|
|
1272
|
+
function flatCb(acc, cur) {
|
|
1273
|
+
for (const item of cur) {
|
|
1274
|
+
acc.push(item);
|
|
1275
|
+
}
|
|
1276
|
+
return acc;
|
|
1277
|
+
}
|
|
1206
1278
|
const URLSearchParamsE = g["URLSearchParams"] || URLSearchParamsP;
|
|
1207
1279
|
|
|
1280
|
+
var _a$4;
|
|
1281
|
+
const state$7 = Symbol( /* "AbortSignalState" */);
|
|
1208
1282
|
class AbortSignalP extends EventTargetP {
|
|
1209
1283
|
static abort(reason) {
|
|
1210
1284
|
const signal = createAbortSignalP();
|
|
1211
|
-
signal[state$
|
|
1285
|
+
abort.call(signal[state$7], reason, false);
|
|
1212
1286
|
return signal;
|
|
1213
1287
|
}
|
|
1214
1288
|
static any(signals) {
|
|
1215
1289
|
const signal = createAbortSignalP();
|
|
1216
1290
|
const abortedSignal = signals.find(x => x.aborted);
|
|
1217
1291
|
if (abortedSignal) {
|
|
1218
|
-
signal[state$
|
|
1292
|
+
abort.call(signal[state$7], abortedSignal.reason, false);
|
|
1219
1293
|
}
|
|
1220
1294
|
else {
|
|
1221
1295
|
function abortFn(ev) {
|
|
1222
1296
|
for (const sig of signals) {
|
|
1223
1297
|
sig.removeEventListener("abort", abortFn);
|
|
1224
1298
|
}
|
|
1225
|
-
signal[state$
|
|
1299
|
+
abort.call(signal[state$7], this.reason, true, ev.isTrusted);
|
|
1226
1300
|
}
|
|
1227
1301
|
for (const sig of signals) {
|
|
1228
1302
|
sig.addEventListener("abort", abortFn);
|
|
@@ -1233,7 +1307,7 @@ class AbortSignalP extends EventTargetP {
|
|
|
1233
1307
|
static timeout(milliseconds) {
|
|
1234
1308
|
const signal = createAbortSignalP();
|
|
1235
1309
|
setTimeout(() => {
|
|
1236
|
-
signal[state$
|
|
1310
|
+
abort.call(signal[state$7], new MPException("signal timed out", "TimeoutError"));
|
|
1237
1311
|
}, milliseconds);
|
|
1238
1312
|
return signal;
|
|
1239
1313
|
}
|
|
@@ -1242,128 +1316,140 @@ class AbortSignalP extends EventTargetP {
|
|
|
1242
1316
|
throw new TypeError("Failed to construct 'AbortSignal': Illegal constructor");
|
|
1243
1317
|
}
|
|
1244
1318
|
super();
|
|
1245
|
-
this[state$
|
|
1319
|
+
this[state$7] = new AbortSignalState(this);
|
|
1246
1320
|
}
|
|
1247
|
-
[state$
|
|
1248
|
-
get
|
|
1249
|
-
get reason() { return this[state$9].reason; }
|
|
1321
|
+
get aborted() { return this[state$7].aborted; }
|
|
1322
|
+
get reason() { return this[state$7].reason; }
|
|
1250
1323
|
throwIfAborted() {
|
|
1251
1324
|
if (this.aborted) {
|
|
1252
1325
|
throw this.reason;
|
|
1253
1326
|
}
|
|
1254
1327
|
}
|
|
1255
|
-
get onabort() { return this[state$
|
|
1328
|
+
get onabort() { return this[state$7].onabort; }
|
|
1256
1329
|
set onabort(value) {
|
|
1257
|
-
this[state$
|
|
1258
|
-
attachFn.call(this, "abort", value, this[state$
|
|
1330
|
+
this[state$7].onabort = value;
|
|
1331
|
+
attachFn.call(this, "abort", value, this[state$7][_handlers$2].onabort);
|
|
1259
1332
|
}
|
|
1260
1333
|
toString() { return "[object AbortSignal]"; }
|
|
1261
1334
|
get isPolyfill() { return { symbol: polyfill, hierarchy: ["AbortSignal", "EventTarget"] }; }
|
|
1262
1335
|
}
|
|
1263
1336
|
defineStringTag(AbortSignalP, "AbortSignal");
|
|
1337
|
+
const _handlers$2 = Symbol();
|
|
1264
1338
|
class AbortSignalState {
|
|
1265
1339
|
constructor(target) {
|
|
1340
|
+
this.aborted = false;
|
|
1341
|
+
this.reason = undefined;
|
|
1342
|
+
this[_a$4] = getHandlers$2.call(this);
|
|
1343
|
+
this.onabort = null;
|
|
1266
1344
|
this.target = target;
|
|
1267
1345
|
}
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
evt[state$9].target = this.target;
|
|
1278
|
-
evt[state$9].isTrusted = isTrusted;
|
|
1279
|
-
this.target[state$7].fire(evt);
|
|
1280
|
-
}
|
|
1346
|
+
}
|
|
1347
|
+
_a$4 = _handlers$2;
|
|
1348
|
+
function abort(reason, notify = true, isTrusted = true) {
|
|
1349
|
+
if (!this.aborted) {
|
|
1350
|
+
this.aborted = true;
|
|
1351
|
+
this.reason = reason !== null && reason !== void 0 ? reason : (new MPException("signal is aborted without reason", "AbortError"));
|
|
1352
|
+
if (notify) {
|
|
1353
|
+
const evt = createInnerEvent(this.target, "abort", undefined, isTrusted);
|
|
1354
|
+
fire.call(this.target[state$f], evt);
|
|
1281
1355
|
}
|
|
1282
1356
|
}
|
|
1283
|
-
|
|
1284
|
-
|
|
1357
|
+
}
|
|
1358
|
+
function getHandlers$2() {
|
|
1359
|
+
return {
|
|
1360
|
+
onabort: (ev) => { executeFn.call(this.target, this.onabort, ev); },
|
|
1361
|
+
};
|
|
1285
1362
|
}
|
|
1286
1363
|
function createAbortSignalP() {
|
|
1287
1364
|
const instance = Object.create(AbortSignalP.prototype);
|
|
1288
|
-
instance[state$
|
|
1289
|
-
instance[state$
|
|
1365
|
+
instance[state$f] = new EventTargetState(instance);
|
|
1366
|
+
instance[state$7] = new AbortSignalState(instance);
|
|
1290
1367
|
return instance;
|
|
1291
1368
|
}
|
|
1292
1369
|
const AbortSignalE = g["AbortSignal"] || AbortSignalP;
|
|
1293
1370
|
|
|
1294
|
-
const state$
|
|
1371
|
+
const state$6 = Symbol( /* "AbortControllerState" */);
|
|
1295
1372
|
class AbortControllerP {
|
|
1296
1373
|
constructor() {
|
|
1297
|
-
this[state$
|
|
1374
|
+
this[state$6] = new AbortControllerState();
|
|
1298
1375
|
}
|
|
1299
|
-
[state$
|
|
1300
|
-
get signal() { return this[state$2].signal; }
|
|
1376
|
+
get signal() { return this[state$6].signal; }
|
|
1301
1377
|
abort(reason) {
|
|
1302
|
-
this[state$
|
|
1378
|
+
abort.call(this[state$6].signal[state$7], reason);
|
|
1303
1379
|
}
|
|
1304
1380
|
toString() { return "[object AbortController]"; }
|
|
1305
1381
|
get isPolyfill() { return { symbol: polyfill, hierarchy: ["AbortController"] }; }
|
|
1306
1382
|
}
|
|
1307
1383
|
defineStringTag(AbortControllerP, "AbortController");
|
|
1308
1384
|
class AbortControllerState {
|
|
1309
|
-
|
|
1385
|
+
constructor() {
|
|
1386
|
+
this.signal = createAbortSignalP();
|
|
1387
|
+
}
|
|
1310
1388
|
}
|
|
1311
1389
|
const AbortControllerE = g["AbortController"] || AbortControllerP;
|
|
1312
1390
|
|
|
1391
|
+
var _a$3;
|
|
1392
|
+
const state$5 = Symbol( /* "XMLHttpRequestEventTargetState" */);
|
|
1313
1393
|
class XMLHttpRequestEventTargetP extends EventTargetP {
|
|
1314
1394
|
constructor() {
|
|
1315
1395
|
if (new.target === XMLHttpRequestEventTargetP) {
|
|
1316
1396
|
throw new TypeError("Failed to construct 'XMLHttpRequestEventTarget': Illegal constructor");
|
|
1317
1397
|
}
|
|
1318
1398
|
super();
|
|
1319
|
-
this[state$
|
|
1320
|
-
}
|
|
1321
|
-
[state$
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
set ontimeout(value) { this[state$9].ontimeout = value; this[state$9].attach("timeout"); }
|
|
1399
|
+
this[state$5] = new XMLHttpRequestEventTargetState(this);
|
|
1400
|
+
}
|
|
1401
|
+
get onabort() { return this[state$5].onabort; }
|
|
1402
|
+
set onabort(value) { this[state$5].onabort = value; attach.call(this[state$5], "abort"); }
|
|
1403
|
+
get onerror() { return this[state$5].onerror; }
|
|
1404
|
+
set onerror(value) { this[state$5].onerror = value; attach.call(this[state$5], "error"); }
|
|
1405
|
+
get onload() { return this[state$5].onload; }
|
|
1406
|
+
set onload(value) { this[state$5].onload = value; attach.call(this[state$5], "load"); }
|
|
1407
|
+
get onloadend() { return this[state$5].onloadend; }
|
|
1408
|
+
set onloadend(value) { this[state$5].onloadend = value; attach.call(this[state$5], "loadend"); }
|
|
1409
|
+
get onloadstart() { return this[state$5].onloadstart; }
|
|
1410
|
+
set onloadstart(value) { this[state$5].onloadstart = value; attach.call(this[state$5], "loadstart"); }
|
|
1411
|
+
get onprogress() { return this[state$5].onprogress; }
|
|
1412
|
+
set onprogress(value) { this[state$5].onprogress = value; attach.call(this[state$5], "progress"); }
|
|
1413
|
+
get ontimeout() { return this[state$5].ontimeout; }
|
|
1414
|
+
set ontimeout(value) { this[state$5].ontimeout = value; attach.call(this[state$5], "timeout"); }
|
|
1336
1415
|
toString() { return "[object XMLHttpRequestEventTarget]"; }
|
|
1337
1416
|
get isPolyfill() { return { symbol: polyfill, hierarchy: ["XMLHttpRequestEventTarget", "EventTarget"] }; }
|
|
1338
1417
|
}
|
|
1339
1418
|
defineStringTag(XMLHttpRequestEventTargetP, "XMLHttpRequestEventTarget");
|
|
1419
|
+
const _handlers$1 = Symbol();
|
|
1340
1420
|
class XMLHttpRequestEventTargetState {
|
|
1341
1421
|
/**
|
|
1342
1422
|
* @param _target XMLHttpRequestEventTargetP
|
|
1343
1423
|
*/
|
|
1344
1424
|
constructor(_target) {
|
|
1425
|
+
this[_a$3] = getHandlers$1.call(this);
|
|
1426
|
+
this.onabort = null;
|
|
1427
|
+
this.onerror = null;
|
|
1428
|
+
this.onload = null;
|
|
1429
|
+
this.onloadend = null;
|
|
1430
|
+
this.onloadstart = null;
|
|
1431
|
+
this.onprogress = null;
|
|
1432
|
+
this.ontimeout = null;
|
|
1345
1433
|
this.target = _target;
|
|
1346
1434
|
}
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
ontimeout = null;
|
|
1366
|
-
_ontimeout = (ev) => { executeFn.call(this.target, this.ontimeout, ev); };
|
|
1435
|
+
}
|
|
1436
|
+
_a$3 = _handlers$1;
|
|
1437
|
+
function attach(type) {
|
|
1438
|
+
const fnName = ("on" + type);
|
|
1439
|
+
const cb = this[fnName];
|
|
1440
|
+
const listener = this[_handlers$1][fnName];
|
|
1441
|
+
attachFn.call(this.target, type, cb, listener);
|
|
1442
|
+
}
|
|
1443
|
+
function getHandlers$1() {
|
|
1444
|
+
return {
|
|
1445
|
+
onabort: (ev) => { executeFn.call(this.target, this.onabort, ev); },
|
|
1446
|
+
onerror: (ev) => { executeFn.call(this.target, this.onerror, ev); },
|
|
1447
|
+
onload: (ev) => { executeFn.call(this.target, this.onload, ev); },
|
|
1448
|
+
onloadend: (ev) => { executeFn.call(this.target, this.onloadend, ev); },
|
|
1449
|
+
onloadstart: (ev) => { executeFn.call(this.target, this.onloadstart, ev); },
|
|
1450
|
+
onprogress: (ev) => { executeFn.call(this.target, this.onprogress, ev); },
|
|
1451
|
+
ontimeout: (ev) => { executeFn.call(this.target, this.ontimeout, ev); },
|
|
1452
|
+
};
|
|
1367
1453
|
}
|
|
1368
1454
|
|
|
1369
1455
|
class XMLHttpRequestUploadP extends XMLHttpRequestEventTargetP {
|
|
@@ -1379,8 +1465,8 @@ class XMLHttpRequestUploadP extends XMLHttpRequestEventTargetP {
|
|
|
1379
1465
|
defineStringTag(XMLHttpRequestUploadP, "XMLHttpRequestUpload");
|
|
1380
1466
|
function createXMLHttpRequestUploadP() {
|
|
1381
1467
|
const instance = Object.create(XMLHttpRequestUploadP.prototype);
|
|
1382
|
-
instance[state$
|
|
1383
|
-
instance[state$
|
|
1468
|
+
instance[state$f] = new EventTargetState(instance);
|
|
1469
|
+
instance[state$5] = new XMLHttpRequestEventTargetState(instance);
|
|
1384
1470
|
return instance;
|
|
1385
1471
|
}
|
|
1386
1472
|
|
|
@@ -1389,22 +1475,22 @@ const mp = (() => {
|
|
|
1389
1475
|
let u = "undefined", r = "request", f = "function";
|
|
1390
1476
|
let mp;
|
|
1391
1477
|
mp =
|
|
1392
|
-
(typeof wx !== u && typeof wx
|
|
1393
|
-
(typeof my !== u && typeof my
|
|
1394
|
-
(typeof qq !== u && typeof qq
|
|
1395
|
-
(typeof jd !== u && typeof jd
|
|
1396
|
-
(typeof swan !== u && typeof swan
|
|
1397
|
-
(typeof tt !== u && typeof tt
|
|
1398
|
-
(typeof ks !== u && typeof ks
|
|
1399
|
-
(typeof qh !== u && typeof qh
|
|
1478
|
+
(typeof wx !== u && typeof (wx === null || wx === void 0 ? void 0 : wx[r]) === f && wx) || // 微信
|
|
1479
|
+
(typeof my !== u && typeof (my === null || my === void 0 ? void 0 : my[r]) === f && my) || // 支付宝
|
|
1480
|
+
(typeof qq !== u && typeof (qq === null || qq === void 0 ? void 0 : qq[r]) === f && qq) || // QQ
|
|
1481
|
+
(typeof jd !== u && typeof (jd === null || jd === void 0 ? void 0 : jd[r]) === f && jd) || // 京东
|
|
1482
|
+
(typeof swan !== u && typeof (swan === null || swan === void 0 ? void 0 : swan[r]) === f && swan) || // 百度
|
|
1483
|
+
(typeof tt !== u && typeof (tt === null || tt === void 0 ? void 0 : tt[r]) === f && tt) || // 抖音 | 飞书
|
|
1484
|
+
(typeof ks !== u && typeof (ks === null || ks === void 0 ? void 0 : ks[r]) === f && ks) || // 快手
|
|
1485
|
+
(typeof qh !== u && typeof (qh === null || qh === void 0 ? void 0 : qh[r]) === f && qh) || // 360
|
|
1400
1486
|
undefined;
|
|
1401
1487
|
if (typeof g["XMLHttpRequest"] === f) {
|
|
1402
1488
|
return;
|
|
1403
1489
|
}
|
|
1404
1490
|
if (mp === undefined)
|
|
1405
1491
|
mp =
|
|
1406
|
-
(typeof uni !== u && typeof uni
|
|
1407
|
-
(typeof Taro !== u && typeof Taro
|
|
1492
|
+
(typeof uni !== u && typeof (uni === null || uni === void 0 ? void 0 : uni[r]) === f && uni) || // UniApp
|
|
1493
|
+
(typeof Taro !== u && typeof (Taro === null || Taro === void 0 ? void 0 : Taro[r]) === f && Taro) || // Taro
|
|
1408
1494
|
undefined;
|
|
1409
1495
|
return mp;
|
|
1410
1496
|
})();
|
|
@@ -1422,300 +1508,319 @@ const request = mp ? mp.request : function errorRequest(options) {
|
|
|
1422
1508
|
useHttpDNS: false,
|
|
1423
1509
|
};
|
|
1424
1510
|
Promise.resolve(err)
|
|
1425
|
-
.then(err => {
|
|
1426
|
-
options.fail
|
|
1511
|
+
.then(err => { try {
|
|
1512
|
+
if (options.fail) {
|
|
1513
|
+
options.fail(err);
|
|
1514
|
+
}
|
|
1515
|
+
}
|
|
1516
|
+
catch (e) {
|
|
1517
|
+
console.warn(e);
|
|
1427
1518
|
} })
|
|
1428
|
-
.
|
|
1519
|
+
.then(() => { if (options.complete) {
|
|
1429
1520
|
options.complete(err);
|
|
1430
1521
|
} });
|
|
1431
1522
|
throw new ReferenceError("request is not defined");
|
|
1432
1523
|
};
|
|
1433
1524
|
|
|
1434
|
-
|
|
1525
|
+
var _a$2, _b$1, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
1526
|
+
const state$4 = Symbol( /* "XMLHttpRequestState" */);
|
|
1435
1527
|
class XMLHttpRequestP extends XMLHttpRequestEventTargetP {
|
|
1436
|
-
static UNSENT = 0;
|
|
1437
|
-
static OPENED = 1;
|
|
1438
|
-
static HEADERS_RECEIVED = 2;
|
|
1439
|
-
static LOADING = 3;
|
|
1440
|
-
static DONE = 4;
|
|
1441
1528
|
constructor() {
|
|
1442
1529
|
super();
|
|
1443
|
-
this
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
get
|
|
1452
|
-
get response() { return this[state$1].response; }
|
|
1530
|
+
this.UNSENT = 0;
|
|
1531
|
+
this.OPENED = 1;
|
|
1532
|
+
this.HEADERS_RECEIVED = 2;
|
|
1533
|
+
this.LOADING = 3;
|
|
1534
|
+
this.DONE = 4;
|
|
1535
|
+
this[state$4] = new XMLHttpRequestState(this);
|
|
1536
|
+
}
|
|
1537
|
+
get readyState() { return this[state$4].readyState; }
|
|
1538
|
+
get response() { return this[state$4].response; }
|
|
1453
1539
|
get responseText() { return (!this.responseType || this.responseType === "text") ? this.response : ""; }
|
|
1454
|
-
get responseType() { return this[state$
|
|
1455
|
-
set responseType(value) { this[state$
|
|
1456
|
-
get responseURL() { return this[state$
|
|
1540
|
+
get responseType() { return this[state$4].responseType; }
|
|
1541
|
+
set responseType(value) { this[state$4].responseType = value; }
|
|
1542
|
+
get responseURL() { return this[state$4].responseURL; }
|
|
1457
1543
|
get responseXML() { return null; }
|
|
1458
|
-
get status() { return this[state$
|
|
1544
|
+
get status() { return this[state$4].status; }
|
|
1459
1545
|
get statusText() {
|
|
1460
1546
|
if (this.readyState === XMLHttpRequestP.UNSENT || this.readyState === XMLHttpRequestP.OPENED)
|
|
1461
1547
|
return "";
|
|
1462
|
-
return this[state$
|
|
1548
|
+
return this[state$4].statusText || statusTextMap(this.status);
|
|
1463
1549
|
}
|
|
1464
|
-
get timeout() { return this[state$
|
|
1465
|
-
set timeout(value) { this[state$
|
|
1466
|
-
get upload() { return this[state$
|
|
1467
|
-
get withCredentials() { return this[state$
|
|
1468
|
-
set withCredentials(value) { this[state$
|
|
1550
|
+
get timeout() { return this[state$4].timeout; }
|
|
1551
|
+
set timeout(value) { this[state$4].timeout = value; }
|
|
1552
|
+
get upload() { return this[state$4].upload; }
|
|
1553
|
+
get withCredentials() { return this[state$4].withCredentials; }
|
|
1554
|
+
set withCredentials(value) { this[state$4].withCredentials = value; }
|
|
1469
1555
|
abort() {
|
|
1470
|
-
this[state$
|
|
1556
|
+
clearRequest.call(this[state$4]);
|
|
1471
1557
|
}
|
|
1472
1558
|
getAllResponseHeaders() {
|
|
1473
|
-
if (!this[state$
|
|
1559
|
+
if (!this[state$4][_responseHeaders])
|
|
1474
1560
|
return "";
|
|
1475
|
-
return
|
|
1561
|
+
return objectEntries(this[state$4][_responseHeaders] || {}).map(([k, v]) => `${k}: ${v}\r\n`).join("");
|
|
1476
1562
|
}
|
|
1477
1563
|
getResponseHeader(name) {
|
|
1478
|
-
|
|
1564
|
+
var _l, _m;
|
|
1565
|
+
if (!this[state$4][_responseHeaders])
|
|
1479
1566
|
return null;
|
|
1480
|
-
|
|
1567
|
+
const nameKey = name.toLowerCase();
|
|
1568
|
+
return (_m = (_l = objectEntries(this[state$4][_responseHeaders] || {}).find(x => x[0].toLowerCase() === nameKey)) === null || _l === void 0 ? void 0 : _l[1]) !== null && _m !== void 0 ? _m : null;
|
|
1481
1569
|
}
|
|
1482
1570
|
open(...args) {
|
|
1483
1571
|
const [method, url, async = true, username = null, password = null] = args;
|
|
1572
|
+
const that = this[state$4];
|
|
1484
1573
|
if (args.length < 2) {
|
|
1485
1574
|
throw new TypeError(`Failed to execute 'open' on 'XMLHttpRequest': 2 arguments required, but only ${args.length} present.`);
|
|
1486
1575
|
}
|
|
1487
1576
|
if (!async) {
|
|
1488
|
-
console.warn("Synchronous XMLHttpRequest is
|
|
1577
|
+
console.warn("Synchronous XMLHttpRequest is not supported because of its detrimental effects to the end user's experience.");
|
|
1578
|
+
}
|
|
1579
|
+
clearRequest.call(that, false);
|
|
1580
|
+
that[_method] = normalizeMethod(method);
|
|
1581
|
+
that[_requestURL] = String(url);
|
|
1582
|
+
if (username !== null || password !== null) {
|
|
1583
|
+
const _username = String(username !== null && username !== void 0 ? username : "");
|
|
1584
|
+
const _password = String(password !== null && password !== void 0 ? password : "");
|
|
1585
|
+
if (_username.length > 0 || _password.length > 0) {
|
|
1586
|
+
const auth = `Basic ${u8array2base64((new TextEncoderP()).encode(_username + ":" + _password))}`;
|
|
1587
|
+
this.setRequestHeader("Authorization", auth);
|
|
1588
|
+
}
|
|
1589
|
+
}
|
|
1590
|
+
that[_inAfterOpenBeforeSend] = true;
|
|
1591
|
+
setReadyStateAndNotify.call(that, XMLHttpRequestP.OPENED);
|
|
1592
|
+
}
|
|
1593
|
+
overrideMimeType(mime) {
|
|
1594
|
+
if (this[state$4][_inAfterOpenBeforeSend]) {
|
|
1595
|
+
console.warn(`XMLHttpRequest.overrideMimeType(${mime}) is not implemented: The method will have no effect on response parsing.`);
|
|
1489
1596
|
}
|
|
1490
|
-
this[state$1].clearRequest(false);
|
|
1491
|
-
this[state$1]._method = normalizeMethod(method);
|
|
1492
|
-
this[state$1]._reqURL = String(url);
|
|
1493
|
-
this[state$1]._reqCanSend = true;
|
|
1494
|
-
this[state$1].setReadyStateAndNotify(XMLHttpRequestP.OPENED);
|
|
1495
1597
|
}
|
|
1496
|
-
overrideMimeType(mime) { }
|
|
1497
1598
|
send(body) {
|
|
1498
|
-
|
|
1599
|
+
const that = this[state$4];
|
|
1600
|
+
if (!that[_inAfterOpenBeforeSend] || that.readyState !== XMLHttpRequestP.OPENED) {
|
|
1499
1601
|
throw new MPException("Failed to execute 'send' on 'XMLHttpRequest': The object's state must be OPENED.", "InvalidStateError");
|
|
1500
1602
|
}
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
assignRequestHeader(this[state$1]._reqHeaders, name, value);
|
|
1507
|
-
}
|
|
1508
|
-
get onreadystatechange() { return this[state$1].onreadystatechange; }
|
|
1509
|
-
set onreadystatechange(value) {
|
|
1510
|
-
this[state$1].onreadystatechange = value;
|
|
1511
|
-
attachFn.call(this, "readystatechange", value, this[state$1]._onreadystatechange);
|
|
1512
|
-
}
|
|
1513
|
-
toString() { return "[object XMLHttpRequest"; }
|
|
1514
|
-
get isPolyfill() { return { symbol: polyfill, hierarchy: ["XMLHttpRequest", "XMLHttpRequestEventTarget", "EventTarget"] }; }
|
|
1515
|
-
}
|
|
1516
|
-
defineStringTag(XMLHttpRequestP, "XMLHttpRequest");
|
|
1517
|
-
class XMLHttpRequestState {
|
|
1518
|
-
constructor(target) {
|
|
1519
|
-
this.target = target;
|
|
1520
|
-
this.upload = createXMLHttpRequestUploadP();
|
|
1521
|
-
}
|
|
1522
|
-
target;
|
|
1523
|
-
readyState = XMLHttpRequestP.UNSENT;
|
|
1524
|
-
response = "";
|
|
1525
|
-
responseType = "";
|
|
1526
|
-
responseURL = "";
|
|
1527
|
-
status = 0;
|
|
1528
|
-
statusText = "";
|
|
1529
|
-
timeout = 0;
|
|
1530
|
-
upload;
|
|
1531
|
-
withCredentials = false;
|
|
1532
|
-
_reqCanSend = false;
|
|
1533
|
-
_resetPending = false;
|
|
1534
|
-
_timeoutId = 0;
|
|
1535
|
-
_reqURL = "";
|
|
1536
|
-
_method = "GET";
|
|
1537
|
-
_reqHeaders = { Accept: "*/*" };
|
|
1538
|
-
_resHeaders = null;
|
|
1539
|
-
_resContLen = 0;
|
|
1540
|
-
_requestTask = null;
|
|
1541
|
-
execRequest(body) {
|
|
1542
|
-
const allowsRequestBody = !["GET", "HEAD"].includes(this._method);
|
|
1543
|
-
const contentTypeExists = Object.keys(this._reqHeaders).map(x => x.toLowerCase()).includes("Content-Type".toLowerCase());
|
|
1544
|
-
const processHeaders = allowsRequestBody && !contentTypeExists;
|
|
1545
|
-
const processContentLength = this.upload[state$7].executors.length > 0;
|
|
1546
|
-
let headers = { ...this._reqHeaders };
|
|
1603
|
+
that[_inAfterOpenBeforeSend] = false;
|
|
1604
|
+
const allowsRequestBody = ["GET", "HEAD"].indexOf(that[_method]) === -1;
|
|
1605
|
+
const processHeaders = allowsRequestBody && Object.keys(that[_requestHeaders]).map(x => x.toLowerCase()).indexOf("content-type") === -1;
|
|
1606
|
+
const processContentLength = that.upload[state$f][_executors].length > 0;
|
|
1607
|
+
let headers = Object.assign({}, that[_requestHeaders]);
|
|
1547
1608
|
let contentLength = 0;
|
|
1548
|
-
let data = convert(body, processHeaders ? v => { headers
|
|
1549
|
-
|
|
1550
|
-
url:
|
|
1551
|
-
method:
|
|
1609
|
+
let data = convert(body, processHeaders ? v => { assignRequestHeader(headers, "Content-Type", v); } : void 0, processContentLength ? v => { contentLength = v; } : void 0);
|
|
1610
|
+
that[_requestTask] = request({
|
|
1611
|
+
url: that[_requestURL],
|
|
1612
|
+
method: that[_method],
|
|
1552
1613
|
header: headers,
|
|
1553
1614
|
data,
|
|
1554
|
-
dataType:
|
|
1555
|
-
responseType:
|
|
1556
|
-
success:
|
|
1557
|
-
fail:
|
|
1558
|
-
complete:
|
|
1615
|
+
dataType: that.responseType === "json" ? "json" : normalizeDataType(that.responseType),
|
|
1616
|
+
responseType: normalizeDataType(that.responseType),
|
|
1617
|
+
success: requestSuccess.bind(that),
|
|
1618
|
+
fail: requestFail.bind(that),
|
|
1619
|
+
complete: requestComplete.bind(that),
|
|
1559
1620
|
});
|
|
1560
|
-
|
|
1621
|
+
emitProcessEvent(this, "loadstart");
|
|
1561
1622
|
if (processContentLength) {
|
|
1562
|
-
const hasRequestBody = allowsRequestBody &&
|
|
1623
|
+
const hasRequestBody = allowsRequestBody && (typeof data === "string" ? data.length > 0 : data.byteLength > 0);
|
|
1563
1624
|
if (hasRequestBody) {
|
|
1564
|
-
|
|
1625
|
+
emitProcessEvent(that.upload, "loadstart", 0, contentLength);
|
|
1565
1626
|
}
|
|
1566
1627
|
setTimeout(() => {
|
|
1567
|
-
const _aborted =
|
|
1628
|
+
const _aborted = that[_inAfterOpenBeforeSend] || that.readyState !== XMLHttpRequestP.OPENED;
|
|
1568
1629
|
const _contentLength = _aborted ? 0 : contentLength;
|
|
1569
1630
|
if (_aborted) {
|
|
1570
|
-
|
|
1631
|
+
emitProcessEvent(that.upload, "abort");
|
|
1571
1632
|
}
|
|
1572
1633
|
else {
|
|
1573
1634
|
if (hasRequestBody) {
|
|
1574
|
-
|
|
1635
|
+
emitProcessEvent(that.upload, "load", _contentLength, _contentLength);
|
|
1575
1636
|
}
|
|
1576
1637
|
}
|
|
1577
1638
|
if (_aborted || hasRequestBody) {
|
|
1578
|
-
|
|
1639
|
+
emitProcessEvent(that.upload, "loadend", _contentLength, _contentLength);
|
|
1579
1640
|
}
|
|
1580
1641
|
});
|
|
1581
1642
|
}
|
|
1643
|
+
checkRequestTimeout.call(that);
|
|
1582
1644
|
}
|
|
1583
|
-
|
|
1584
|
-
this
|
|
1585
|
-
this.status = statusCode;
|
|
1586
|
-
this._resHeaders = header;
|
|
1587
|
-
this._resContLen = parseInt(this.target.getResponseHeader("Content-Length") || "0");
|
|
1588
|
-
if (this.readyState === XMLHttpRequestP.OPENED) {
|
|
1589
|
-
this.setReadyStateAndNotify(XMLHttpRequestP.HEADERS_RECEIVED);
|
|
1590
|
-
this.setReadyStateAndNotify(XMLHttpRequestP.LOADING);
|
|
1591
|
-
setTimeout(() => {
|
|
1592
|
-
if (!this._reqCanSend) {
|
|
1593
|
-
let l = this._resContLen;
|
|
1594
|
-
try {
|
|
1595
|
-
this.response = convertBack(this.responseType, data);
|
|
1596
|
-
this.emitProcessEvent("load", l, l);
|
|
1597
|
-
}
|
|
1598
|
-
catch (e) {
|
|
1599
|
-
console.error(e);
|
|
1600
|
-
this.emitProcessEvent("error");
|
|
1601
|
-
}
|
|
1602
|
-
}
|
|
1603
|
-
});
|
|
1604
|
-
}
|
|
1645
|
+
setRequestHeader(name, value) {
|
|
1646
|
+
assignRequestHeader(this[state$4][_requestHeaders], name, value);
|
|
1605
1647
|
}
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1648
|
+
get onreadystatechange() { return this[state$4].onreadystatechange; }
|
|
1649
|
+
set onreadystatechange(value) {
|
|
1650
|
+
this[state$4].onreadystatechange = value;
|
|
1651
|
+
attachFn.call(this, "readystatechange", value, this[state$4][_handlers].onreadystatechange);
|
|
1652
|
+
}
|
|
1653
|
+
toString() { return "[object XMLHttpRequest]"; }
|
|
1654
|
+
get isPolyfill() { return { symbol: polyfill, hierarchy: ["XMLHttpRequest", "XMLHttpRequestEventTarget", "EventTarget"] }; }
|
|
1655
|
+
}
|
|
1656
|
+
XMLHttpRequestP.UNSENT = 0;
|
|
1657
|
+
XMLHttpRequestP.OPENED = 1;
|
|
1658
|
+
XMLHttpRequestP.HEADERS_RECEIVED = 2;
|
|
1659
|
+
XMLHttpRequestP.LOADING = 3;
|
|
1660
|
+
XMLHttpRequestP.DONE = 4;
|
|
1661
|
+
defineStringTag(XMLHttpRequestP, "XMLHttpRequest");
|
|
1662
|
+
const _handlers = Symbol();
|
|
1663
|
+
const _inAfterOpenBeforeSend = Symbol();
|
|
1664
|
+
const _resetPending = Symbol();
|
|
1665
|
+
const _timeoutId = Symbol();
|
|
1666
|
+
const _requestURL = Symbol();
|
|
1667
|
+
const _method = Symbol();
|
|
1668
|
+
const _requestHeaders = Symbol();
|
|
1669
|
+
const _responseHeaders = Symbol();
|
|
1670
|
+
const _responseContentLength = Symbol();
|
|
1671
|
+
const _requestTask = Symbol();
|
|
1672
|
+
class XMLHttpRequestState {
|
|
1673
|
+
constructor(target) {
|
|
1674
|
+
this.readyState = XMLHttpRequestP.UNSENT;
|
|
1675
|
+
this.response = "";
|
|
1676
|
+
this.responseType = "";
|
|
1677
|
+
this.responseURL = "";
|
|
1619
1678
|
this.status = 0;
|
|
1620
|
-
this.statusText = "
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1679
|
+
this.statusText = "";
|
|
1680
|
+
this.timeout = 0;
|
|
1681
|
+
this.withCredentials = false;
|
|
1682
|
+
this[_a$2] = getHandlers.call(this);
|
|
1683
|
+
this.onreadystatechange = null;
|
|
1684
|
+
this[_b$1] = false;
|
|
1685
|
+
this[_c] = false;
|
|
1686
|
+
this[_d] = 0;
|
|
1687
|
+
this[_e] = "";
|
|
1688
|
+
this[_f] = "GET";
|
|
1689
|
+
this[_g] = { Accept: "*/*" };
|
|
1690
|
+
this[_h] = null;
|
|
1691
|
+
this[_j] = 0;
|
|
1692
|
+
this[_k] = null;
|
|
1693
|
+
this.target = target;
|
|
1694
|
+
this.upload = createXMLHttpRequestUploadP();
|
|
1625
1695
|
}
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1696
|
+
}
|
|
1697
|
+
_a$2 = _handlers, _b$1 = _inAfterOpenBeforeSend, _c = _resetPending, _d = _timeoutId, _e = _requestURL, _f = _method, _g = _requestHeaders, _h = _responseHeaders, _j = _responseContentLength, _k = _requestTask;
|
|
1698
|
+
function requestSuccess({ statusCode, header, data }) {
|
|
1699
|
+
this.responseURL = this[_requestURL];
|
|
1700
|
+
this.status = statusCode;
|
|
1701
|
+
this[_responseHeaders] = header;
|
|
1702
|
+
const lengthStr = this.target.getResponseHeader("Content-Length");
|
|
1703
|
+
this[_responseContentLength] = () => { return lengthStr ? parseInt(lengthStr) : 0; };
|
|
1704
|
+
if (this.readyState === XMLHttpRequestP.OPENED) {
|
|
1705
|
+
setReadyStateAndNotify.call(this, XMLHttpRequestP.HEADERS_RECEIVED);
|
|
1706
|
+
setReadyStateAndNotify.call(this, XMLHttpRequestP.LOADING);
|
|
1631
1707
|
setTimeout(() => {
|
|
1632
|
-
if (!this
|
|
1633
|
-
let l = this
|
|
1634
|
-
|
|
1708
|
+
if (!this[_inAfterOpenBeforeSend]) {
|
|
1709
|
+
let l = this[_responseContentLength];
|
|
1710
|
+
try {
|
|
1711
|
+
this.response = convertBack(this.responseType, data);
|
|
1712
|
+
emitProcessEvent(this.target, "load", l, l);
|
|
1713
|
+
}
|
|
1714
|
+
catch (e) {
|
|
1715
|
+
console.error(e);
|
|
1716
|
+
emitProcessEvent(this.target, "error");
|
|
1717
|
+
}
|
|
1635
1718
|
}
|
|
1636
1719
|
});
|
|
1637
1720
|
}
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1721
|
+
}
|
|
1722
|
+
function requestFail(err) {
|
|
1723
|
+
// Alipay Mini Programs
|
|
1724
|
+
// error: 14 --- JSON parse data error
|
|
1725
|
+
// error: 19 --- http status error
|
|
1726
|
+
// At this point, the error data object will contain three pieces of information
|
|
1727
|
+
// returned from the server: status, headers, and data.
|
|
1728
|
+
// In the browser's XMLHttpRequest, these two errors (Error 14 and Error 19)
|
|
1729
|
+
// differ from those in Alipay Mini Programs and should instead return normally.
|
|
1730
|
+
// Therefore, this scenario is also handled here as a successful request response.
|
|
1731
|
+
if ("status" in err) {
|
|
1732
|
+
requestSuccess.call(this, { statusCode: err.status, header: err.headers, data: err.data });
|
|
1733
|
+
return;
|
|
1734
|
+
}
|
|
1735
|
+
this.status = 0;
|
|
1736
|
+
this.statusText = "errMsg" in err ? err.errMsg : "errorMessage" in err ? err.errorMessage : "";
|
|
1737
|
+
if (!this[_inAfterOpenBeforeSend] && this.readyState !== XMLHttpRequestP.UNSENT && this.readyState !== XMLHttpRequestP.DONE) {
|
|
1738
|
+
emitProcessEvent(this.target, "error");
|
|
1739
|
+
resetRequestTimeout.call(this);
|
|
1740
|
+
}
|
|
1741
|
+
}
|
|
1742
|
+
function requestComplete() {
|
|
1743
|
+
this[_requestTask] = null;
|
|
1744
|
+
if (!this[_inAfterOpenBeforeSend] && (this.readyState === XMLHttpRequestP.OPENED || this.readyState === XMLHttpRequestP.LOADING)) {
|
|
1745
|
+
setReadyStateAndNotify.call(this, XMLHttpRequestP.DONE);
|
|
1746
|
+
}
|
|
1747
|
+
setTimeout(() => {
|
|
1748
|
+
if (!this[_inAfterOpenBeforeSend]) {
|
|
1749
|
+
let l = this[_responseContentLength];
|
|
1750
|
+
emitProcessEvent(this.target, "loadend", l, l);
|
|
1751
|
+
}
|
|
1752
|
+
});
|
|
1753
|
+
}
|
|
1754
|
+
function clearRequest(delay = true) {
|
|
1755
|
+
const timerFn = delay ? setTimeout : (f) => { f(); };
|
|
1756
|
+
this[_resetPending] = true;
|
|
1757
|
+
if (this[_requestTask] && this.readyState !== XMLHttpRequestP.DONE) {
|
|
1758
|
+
if (delay) {
|
|
1759
|
+
setReadyStateAndNotify.call(this, XMLHttpRequestP.DONE);
|
|
1657
1760
|
}
|
|
1658
1761
|
timerFn(() => {
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1762
|
+
const requestTask = this[_requestTask];
|
|
1763
|
+
if (requestTask) {
|
|
1764
|
+
requestTask.abort();
|
|
1765
|
+
}
|
|
1766
|
+
if (delay) {
|
|
1767
|
+
emitProcessEvent(this.target, "abort");
|
|
1768
|
+
}
|
|
1769
|
+
if (delay && !requestTask) {
|
|
1770
|
+
emitProcessEvent(this.target, "loadend");
|
|
1664
1771
|
}
|
|
1665
1772
|
});
|
|
1666
1773
|
}
|
|
1667
|
-
|
|
1668
|
-
if (this
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
this.setReadyStateAndNotify(XMLHttpRequestP.DONE);
|
|
1674
|
-
this.emitProcessEvent("timeout");
|
|
1675
|
-
}
|
|
1676
|
-
}, this.timeout);
|
|
1774
|
+
timerFn(() => {
|
|
1775
|
+
if (this[_resetPending]) {
|
|
1776
|
+
if (delay) {
|
|
1777
|
+
this.readyState = XMLHttpRequestP.UNSENT;
|
|
1778
|
+
}
|
|
1779
|
+
resetXHR.call(this);
|
|
1677
1780
|
}
|
|
1781
|
+
});
|
|
1782
|
+
}
|
|
1783
|
+
function checkRequestTimeout() {
|
|
1784
|
+
if (this.timeout) {
|
|
1785
|
+
this[_timeoutId] = setTimeout(() => {
|
|
1786
|
+
if (!this.status && this.readyState !== XMLHttpRequestP.DONE) {
|
|
1787
|
+
if (this[_requestTask])
|
|
1788
|
+
this[_requestTask].abort();
|
|
1789
|
+
setReadyStateAndNotify.call(this, XMLHttpRequestP.DONE);
|
|
1790
|
+
emitProcessEvent(this.target, "timeout");
|
|
1791
|
+
}
|
|
1792
|
+
}, this.timeout);
|
|
1678
1793
|
}
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
}
|
|
1696
|
-
emitProcessEvent(type, loaded = 0, total = 0, target) {
|
|
1697
|
-
const _target = target ?? this.target;
|
|
1698
|
-
const _event = new ProgressEventP(type, {
|
|
1699
|
-
lengthComputable: total > 0,
|
|
1700
|
-
loaded,
|
|
1701
|
-
total,
|
|
1702
|
-
});
|
|
1703
|
-
_event[state$9].target = _target;
|
|
1704
|
-
_event[state$9].isTrusted = true;
|
|
1705
|
-
_target[state$7].fire(_event);
|
|
1794
|
+
}
|
|
1795
|
+
function resetXHR() {
|
|
1796
|
+
this[_resetPending] = false;
|
|
1797
|
+
resetRequestTimeout.call(this);
|
|
1798
|
+
this.response = "";
|
|
1799
|
+
this.responseURL = "";
|
|
1800
|
+
this.status = 0;
|
|
1801
|
+
this.statusText = "";
|
|
1802
|
+
this[_requestHeaders] = {};
|
|
1803
|
+
this[_responseHeaders] = null;
|
|
1804
|
+
this[_responseContentLength] = 0;
|
|
1805
|
+
}
|
|
1806
|
+
function resetRequestTimeout() {
|
|
1807
|
+
if (this[_timeoutId]) {
|
|
1808
|
+
clearTimeout(this[_timeoutId]);
|
|
1809
|
+
this[_timeoutId] = 0;
|
|
1706
1810
|
}
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
this.target[state$7].fire(evt);
|
|
1715
|
-
}
|
|
1811
|
+
}
|
|
1812
|
+
function setReadyStateAndNotify(value) {
|
|
1813
|
+
const hasChanged = value !== this.readyState;
|
|
1814
|
+
this.readyState = value;
|
|
1815
|
+
if (hasChanged) {
|
|
1816
|
+
const evt = createInnerEvent(this.target, "readystatechange");
|
|
1817
|
+
fire.call(this.target[state$f], evt);
|
|
1716
1818
|
}
|
|
1717
|
-
|
|
1718
|
-
|
|
1819
|
+
}
|
|
1820
|
+
function getHandlers() {
|
|
1821
|
+
return {
|
|
1822
|
+
onreadystatechange: (ev) => { executeFn.call(this.target, this.onreadystatechange, ev); },
|
|
1823
|
+
};
|
|
1719
1824
|
}
|
|
1720
1825
|
// HTTP methods whose capitalization should be normalized
|
|
1721
1826
|
const methods = ["CONNECT", "DELETE", "GET", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "TRACE"];
|
|
@@ -1723,9 +1828,13 @@ function normalizeMethod(method) {
|
|
|
1723
1828
|
let upcased = method.toUpperCase();
|
|
1724
1829
|
return methods.indexOf(upcased) > -1 ? upcased : method;
|
|
1725
1830
|
}
|
|
1831
|
+
function normalizeDataType(responseType) {
|
|
1832
|
+
return (responseType === "blob" || responseType === "arraybuffer") ? "arraybuffer" : "text";
|
|
1833
|
+
}
|
|
1726
1834
|
function assignRequestHeader(headers, name, value) {
|
|
1835
|
+
const nameKey = name.toLowerCase();
|
|
1727
1836
|
for (const key of Object.keys(headers)) {
|
|
1728
|
-
if (key.toLowerCase() ===
|
|
1837
|
+
if (key.toLowerCase() === nameKey) {
|
|
1729
1838
|
headers[key] = value;
|
|
1730
1839
|
return;
|
|
1731
1840
|
}
|
|
@@ -1762,14 +1871,14 @@ function convert(body, setContentType, setContentLength) {
|
|
|
1762
1871
|
result = body.buffer.slice(body.byteOffset, body.byteOffset + body.byteLength);
|
|
1763
1872
|
}
|
|
1764
1873
|
else if (isPolyfillType("Blob", body)) {
|
|
1765
|
-
result = body[state$
|
|
1874
|
+
result = body[state$c][_u8array].buffer.slice(0);
|
|
1766
1875
|
if (setContentType && body.type) {
|
|
1767
1876
|
setContentType(body.type);
|
|
1768
1877
|
}
|
|
1769
1878
|
}
|
|
1770
1879
|
else if (isPolyfillType("FormData", body)) {
|
|
1771
1880
|
const blob = body[state$9].toBlob();
|
|
1772
|
-
result = blob[state$
|
|
1881
|
+
result = blob[state$c][_u8array].buffer;
|
|
1773
1882
|
if (setContentType) {
|
|
1774
1883
|
setContentType(blob.type);
|
|
1775
1884
|
}
|
|
@@ -1781,7 +1890,12 @@ function convert(body, setContentType, setContentLength) {
|
|
|
1781
1890
|
result = String(body);
|
|
1782
1891
|
}
|
|
1783
1892
|
if (setContentLength) {
|
|
1784
|
-
|
|
1893
|
+
if (typeof result === "string") {
|
|
1894
|
+
setContentLength(() => { return encode(result).byteLength; });
|
|
1895
|
+
}
|
|
1896
|
+
else {
|
|
1897
|
+
setContentLength(result.byteLength);
|
|
1898
|
+
}
|
|
1785
1899
|
}
|
|
1786
1900
|
return result;
|
|
1787
1901
|
}
|
|
@@ -1871,107 +1985,117 @@ function statusTextMap(val) {
|
|
|
1871
1985
|
}
|
|
1872
1986
|
const XMLHttpRequestE = (typeof XMLHttpRequest !== "undefined" && XMLHttpRequest) || XMLHttpRequestP;
|
|
1873
1987
|
|
|
1874
|
-
|
|
1988
|
+
var _a$1, _b;
|
|
1989
|
+
const state$3 = Symbol( /* "BodyState" */);
|
|
1875
1990
|
class BodyP {
|
|
1876
1991
|
constructor() {
|
|
1877
1992
|
if (new.target === BodyP) {
|
|
1878
1993
|
throw new TypeError("Failed to construct 'Body': Illegal constructor");
|
|
1879
1994
|
}
|
|
1880
|
-
this[state] = new BodyState();
|
|
1995
|
+
this[state$3] = new BodyState();
|
|
1881
1996
|
}
|
|
1882
|
-
[state];
|
|
1883
1997
|
get body() {
|
|
1884
|
-
if (!this[state]
|
|
1998
|
+
if (!this[state$3][_body]) {
|
|
1885
1999
|
return null;
|
|
1886
2000
|
}
|
|
1887
2001
|
throw new ReferenceError("ReadableStream is not defined");
|
|
1888
2002
|
}
|
|
1889
|
-
get bodyUsed() { return this[state].bodyUsed; }
|
|
2003
|
+
get bodyUsed() { return this[state$3].bodyUsed; }
|
|
1890
2004
|
;
|
|
1891
2005
|
arrayBuffer() {
|
|
1892
2006
|
const kind = "arrayBuffer";
|
|
1893
|
-
return this[state]
|
|
2007
|
+
return consumed.call(this[state$3], kind) || read.call(this[state$3], kind);
|
|
1894
2008
|
}
|
|
1895
2009
|
blob() {
|
|
1896
2010
|
const kind = "blob";
|
|
1897
|
-
return this[state]
|
|
2011
|
+
return consumed.call(this[state$3], kind) || read.call(this[state$3], kind);
|
|
1898
2012
|
}
|
|
1899
2013
|
bytes() {
|
|
1900
2014
|
const kind = "bytes";
|
|
1901
|
-
return this[state]
|
|
2015
|
+
return consumed.call(this[state$3], kind) || read.call(this[state$3], kind);
|
|
1902
2016
|
}
|
|
1903
2017
|
formData() {
|
|
1904
2018
|
const kind = "formData";
|
|
1905
|
-
return this[state]
|
|
2019
|
+
return consumed.call(this[state$3], kind) || read.call(this[state$3], kind);
|
|
1906
2020
|
}
|
|
1907
2021
|
json() {
|
|
1908
2022
|
const kind = "json";
|
|
1909
|
-
return this[state]
|
|
2023
|
+
return consumed.call(this[state$3], kind) || read.call(this[state$3], kind);
|
|
1910
2024
|
}
|
|
1911
2025
|
text() {
|
|
1912
2026
|
const kind = "text";
|
|
1913
|
-
return this[state]
|
|
2027
|
+
return consumed.call(this[state$3], kind) || read.call(this[state$3], kind);
|
|
1914
2028
|
}
|
|
1915
2029
|
toString() { return "[object Body]"; }
|
|
1916
2030
|
get isPolyfill() { return { symbol: polyfill, hierarchy: ["Body"] }; }
|
|
1917
2031
|
}
|
|
1918
2032
|
defineStringTag(BodyP, "Body");
|
|
2033
|
+
const _name = Symbol();
|
|
2034
|
+
const _body = Symbol();
|
|
1919
2035
|
class BodyState {
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
if (isObjectType("ReadableStream", body)) {
|
|
1925
|
-
throw new ReferenceError("ReadableStream is not defined");
|
|
1926
|
-
}
|
|
1927
|
-
this._body = convert(body, type => {
|
|
1928
|
-
if (headers && !headers.get("Content-Type")) {
|
|
1929
|
-
headers.set("Content-Type", type);
|
|
1930
|
-
}
|
|
1931
|
-
});
|
|
2036
|
+
constructor() {
|
|
2037
|
+
this.bodyUsed = false;
|
|
2038
|
+
this[_a$1] = "Body";
|
|
2039
|
+
this[_b] = "";
|
|
1932
2040
|
}
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
}
|
|
1939
|
-
else if (kind === "blob") {
|
|
1940
|
-
resolve(convertBack("blob", this._body));
|
|
1941
|
-
}
|
|
1942
|
-
else if (kind === "bytes") {
|
|
1943
|
-
let arrayBuffer = convertBack("arraybuffer", this._body);
|
|
1944
|
-
resolve(new Uint8Array(arrayBuffer));
|
|
1945
|
-
}
|
|
1946
|
-
else if (kind === "formData") {
|
|
1947
|
-
let text = convertBack("text", this._body);
|
|
1948
|
-
resolve(createFormData(text));
|
|
1949
|
-
}
|
|
1950
|
-
else if (kind === "json") {
|
|
1951
|
-
resolve(convertBack("json", this._body));
|
|
1952
|
-
}
|
|
1953
|
-
else {
|
|
1954
|
-
resolve(convertBack("text", this._body));
|
|
1955
|
-
}
|
|
1956
|
-
}
|
|
1957
|
-
catch (e) {
|
|
1958
|
-
reject(e);
|
|
1959
|
-
}
|
|
1960
|
-
});
|
|
2041
|
+
}
|
|
2042
|
+
_a$1 = _name, _b = _body;
|
|
2043
|
+
function initFn(body, headers) {
|
|
2044
|
+
if (isObjectType("ReadableStream", body)) {
|
|
2045
|
+
throw new ReferenceError("ReadableStream is not defined");
|
|
1961
2046
|
}
|
|
1962
|
-
|
|
1963
|
-
if (!
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
2047
|
+
this[_body] = convert(body, type => {
|
|
2048
|
+
if (headers && !headers.get("Content-Type")) {
|
|
2049
|
+
headers.set("Content-Type", type);
|
|
2050
|
+
}
|
|
2051
|
+
});
|
|
2052
|
+
}
|
|
2053
|
+
function read(kind) {
|
|
2054
|
+
return new Promise((resolve, reject) => {
|
|
2055
|
+
try {
|
|
2056
|
+
resolve(readSync.call(this, kind));
|
|
1967
2057
|
}
|
|
1968
|
-
|
|
2058
|
+
catch (e) {
|
|
2059
|
+
reject(e);
|
|
2060
|
+
}
|
|
2061
|
+
});
|
|
2062
|
+
}
|
|
2063
|
+
function readSync(kind) {
|
|
2064
|
+
if (kind === "arrayBuffer") {
|
|
2065
|
+
return convertBack("arraybuffer", this[_body]);
|
|
2066
|
+
}
|
|
2067
|
+
else if (kind === "blob") {
|
|
2068
|
+
return convertBack("blob", this[_body]);
|
|
2069
|
+
}
|
|
2070
|
+
else if (kind === "bytes") {
|
|
2071
|
+
let arrayBuffer = convertBack("arraybuffer", this[_body]);
|
|
2072
|
+
return new Uint8Array(arrayBuffer);
|
|
2073
|
+
}
|
|
2074
|
+
else if (kind === "formData") {
|
|
2075
|
+
let text = convertBack("text", this[_body]);
|
|
2076
|
+
return createFormDataFromBody(text);
|
|
2077
|
+
}
|
|
2078
|
+
else if (kind === "json") {
|
|
2079
|
+
return convertBack("json", this[_body]);
|
|
2080
|
+
}
|
|
2081
|
+
else {
|
|
2082
|
+
return convertBack("text", this[_body]);
|
|
1969
2083
|
}
|
|
1970
2084
|
}
|
|
2085
|
+
function consumed(kind) {
|
|
2086
|
+
if (!this[_body])
|
|
2087
|
+
return;
|
|
2088
|
+
if (this.bodyUsed) {
|
|
2089
|
+
return Promise.reject(new TypeError(`TypeError: Failed to execute '${kind}' on '${this[_name]}': body stream already read`));
|
|
2090
|
+
}
|
|
2091
|
+
this.bodyUsed = true;
|
|
2092
|
+
}
|
|
1971
2093
|
|
|
2094
|
+
var _a;
|
|
2095
|
+
const state$2 = Symbol( /* "HeadersState" */);
|
|
1972
2096
|
class HeadersP {
|
|
1973
2097
|
constructor(init) {
|
|
1974
|
-
this[state$
|
|
2098
|
+
this[state$2] = new HeadersState();
|
|
1975
2099
|
if (isObjectType("Headers", init)) {
|
|
1976
2100
|
init.forEach((value, name) => {
|
|
1977
2101
|
this.append(name, value);
|
|
@@ -1989,25 +2113,26 @@ class HeadersP {
|
|
|
1989
2113
|
});
|
|
1990
2114
|
}
|
|
1991
2115
|
else if (init) {
|
|
1992
|
-
|
|
2116
|
+
objectEntries(init).forEach(([name, value]) => {
|
|
1993
2117
|
this.append(name, value);
|
|
1994
2118
|
});
|
|
1995
2119
|
}
|
|
1996
2120
|
}
|
|
1997
|
-
[state$9];
|
|
1998
2121
|
append(name, value) {
|
|
2122
|
+
var _b;
|
|
1999
2123
|
let key = normalizeName(name, "append");
|
|
2000
2124
|
value = normalizeValue(value);
|
|
2001
|
-
let oldValue = this[state$
|
|
2002
|
-
this[state$
|
|
2125
|
+
let oldValue = (_b = this[state$2][_headersMap].get(key)) === null || _b === void 0 ? void 0 : _b[1];
|
|
2126
|
+
this[state$2][_headersMap].set(key, ["" + name, oldValue ? `${oldValue}, ${value}` : value]);
|
|
2003
2127
|
}
|
|
2004
2128
|
delete(name) {
|
|
2005
2129
|
let key = normalizeName(name, "delete");
|
|
2006
|
-
this[state$
|
|
2130
|
+
this[state$2][_headersMap].delete(key);
|
|
2007
2131
|
}
|
|
2008
2132
|
get(name) {
|
|
2133
|
+
var _b, _c;
|
|
2009
2134
|
let key = normalizeName(name, "get");
|
|
2010
|
-
return this[state$
|
|
2135
|
+
return (_c = (_b = this[state$2][_headersMap].get(key)) === null || _b === void 0 ? void 0 : _b[1]) !== null && _c !== void 0 ? _c : null;
|
|
2011
2136
|
}
|
|
2012
2137
|
getSetCookie() {
|
|
2013
2138
|
let value = this.get("Set-Cookie");
|
|
@@ -2015,11 +2140,11 @@ class HeadersP {
|
|
|
2015
2140
|
}
|
|
2016
2141
|
has(name) {
|
|
2017
2142
|
let key = normalizeName(name, "has");
|
|
2018
|
-
return this[state$
|
|
2143
|
+
return this[state$2][_headersMap].has(key);
|
|
2019
2144
|
}
|
|
2020
2145
|
set(name, value) {
|
|
2021
2146
|
let key = normalizeName(name, "set");
|
|
2022
|
-
this[state$
|
|
2147
|
+
this[state$2][_headersMap].set(key, ["" + name, normalizeValue(value)]);
|
|
2023
2148
|
}
|
|
2024
2149
|
forEach(callbackfn, thisArg) {
|
|
2025
2150
|
Array.from(this.entries()).forEach(([name, value]) => {
|
|
@@ -2027,7 +2152,7 @@ class HeadersP {
|
|
|
2027
2152
|
});
|
|
2028
2153
|
}
|
|
2029
2154
|
entries() {
|
|
2030
|
-
return this[state$
|
|
2155
|
+
return this[state$2][_headersMap].values();
|
|
2031
2156
|
}
|
|
2032
2157
|
keys() {
|
|
2033
2158
|
return Array.from(this.entries()).map(pair => pair[0]).values();
|
|
@@ -2042,9 +2167,13 @@ class HeadersP {
|
|
|
2042
2167
|
get isPolyfill() { return { symbol: polyfill, hierarchy: ["Headers"] }; }
|
|
2043
2168
|
}
|
|
2044
2169
|
defineStringTag(HeadersP, "Headers");
|
|
2170
|
+
const _headersMap = Symbol();
|
|
2045
2171
|
class HeadersState {
|
|
2046
|
-
|
|
2172
|
+
constructor() {
|
|
2173
|
+
this[_a] = new Map();
|
|
2174
|
+
}
|
|
2047
2175
|
}
|
|
2176
|
+
_a = _headersMap;
|
|
2048
2177
|
function normalizeName(name, kind = "") {
|
|
2049
2178
|
if (typeof name !== "string") {
|
|
2050
2179
|
name = String(name);
|
|
@@ -2062,142 +2191,186 @@ function normalizeValue(value) {
|
|
|
2062
2191
|
}
|
|
2063
2192
|
return value;
|
|
2064
2193
|
}
|
|
2194
|
+
function parseHeaders(rawHeaders) {
|
|
2195
|
+
let headers = new HeadersP();
|
|
2196
|
+
let preProcessedHeaders = rawHeaders.replace(/\r?\n[\t ]+/g, " ");
|
|
2197
|
+
preProcessedHeaders
|
|
2198
|
+
.split("\r")
|
|
2199
|
+
.map(function (header) {
|
|
2200
|
+
return header.indexOf("\n") === 0 ? header.substring(1, header.length) : header;
|
|
2201
|
+
})
|
|
2202
|
+
.forEach(function (line) {
|
|
2203
|
+
let parts = line.split(":");
|
|
2204
|
+
let key = parts.shift().trim();
|
|
2205
|
+
if (key) {
|
|
2206
|
+
let value = parts.join(":").trim();
|
|
2207
|
+
try {
|
|
2208
|
+
headers.append(key, value);
|
|
2209
|
+
}
|
|
2210
|
+
catch (error) {
|
|
2211
|
+
console.warn("Response " + error.message);
|
|
2212
|
+
}
|
|
2213
|
+
}
|
|
2214
|
+
});
|
|
2215
|
+
return headers;
|
|
2216
|
+
}
|
|
2065
2217
|
const HeadersE = g["Headers"] || HeadersP;
|
|
2066
2218
|
|
|
2219
|
+
const state$1 = Symbol( /* "RequestState" */);
|
|
2067
2220
|
class RequestP extends BodyP {
|
|
2068
2221
|
constructor(input, init) {
|
|
2069
2222
|
super();
|
|
2070
|
-
this[state$
|
|
2071
|
-
this[state]
|
|
2072
|
-
|
|
2223
|
+
this[state$1] = new RequestState();
|
|
2224
|
+
const that = this[state$1];
|
|
2225
|
+
this[state$3][_name] = "Request";
|
|
2226
|
+
let options = init !== null && init !== void 0 ? init : {};
|
|
2073
2227
|
let body = options.body;
|
|
2074
2228
|
if (isPolyfillType("Request", input)) {
|
|
2075
2229
|
if (input.bodyUsed) {
|
|
2076
2230
|
throw new TypeError("Failed to construct 'Request': Cannot construct a Request with a Request object that has already been used.");
|
|
2077
2231
|
}
|
|
2078
|
-
|
|
2232
|
+
that.credentials = input.credentials;
|
|
2079
2233
|
if (!options.headers) {
|
|
2080
|
-
|
|
2234
|
+
that.headers = new HeadersP(input.headers);
|
|
2081
2235
|
}
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2236
|
+
that.method = input.method;
|
|
2237
|
+
that.mode = input.mode;
|
|
2238
|
+
that.signal = input.signal;
|
|
2239
|
+
that.url = input.url;
|
|
2086
2240
|
let _input = input;
|
|
2087
|
-
if (!body && _input[state]
|
|
2088
|
-
body = _input[state]
|
|
2089
|
-
_input[state].bodyUsed = true;
|
|
2241
|
+
if (!body && _input[state$3][_body] !== null) {
|
|
2242
|
+
body = _input[state$3][_body];
|
|
2243
|
+
_input[state$3].bodyUsed = true;
|
|
2090
2244
|
}
|
|
2091
2245
|
}
|
|
2092
2246
|
else {
|
|
2093
|
-
|
|
2247
|
+
that.url = String(input);
|
|
2094
2248
|
}
|
|
2095
2249
|
if (options.credentials) {
|
|
2096
|
-
|
|
2250
|
+
that.credentials = options.credentials;
|
|
2097
2251
|
}
|
|
2098
2252
|
if (options.headers) {
|
|
2099
|
-
|
|
2253
|
+
that.headers = new HeadersP(options.headers);
|
|
2100
2254
|
}
|
|
2101
2255
|
if (options.method) {
|
|
2102
|
-
|
|
2256
|
+
that.method = normalizeMethod(options.method);
|
|
2103
2257
|
}
|
|
2104
2258
|
if (options.mode) {
|
|
2105
|
-
|
|
2259
|
+
that.mode = options.mode;
|
|
2106
2260
|
}
|
|
2107
2261
|
if (options.signal) {
|
|
2108
|
-
|
|
2262
|
+
that.signal = options.signal;
|
|
2109
2263
|
}
|
|
2110
2264
|
if ((this.method === "GET" || this.method === "HEAD") && body) {
|
|
2111
2265
|
throw new TypeError("Failed to construct 'Request': Request with GET/HEAD method cannot have body.");
|
|
2112
2266
|
}
|
|
2113
|
-
this[state]
|
|
2267
|
+
initFn.call(this[state$3], body, this.headers);
|
|
2114
2268
|
if (this.method === "GET" || this.method === "HEAD") {
|
|
2115
2269
|
if (options.cache === "no-store" || options.cache === "no-cache") {
|
|
2116
2270
|
// Search for a '_' parameter in the query string
|
|
2117
2271
|
let reParamSearch = /([?&])_=[^&]*/;
|
|
2118
2272
|
if (reParamSearch.test(this.url)) {
|
|
2119
2273
|
// If it already exists then set the value with the current time
|
|
2120
|
-
|
|
2274
|
+
that.url = this.url.replace(reParamSearch, "$1_=" + (new Date()).getTime());
|
|
2121
2275
|
}
|
|
2122
2276
|
else {
|
|
2123
2277
|
// Otherwise add a new '_' parameter to the end with the current time
|
|
2124
2278
|
let reQueryString = /\?/;
|
|
2125
|
-
|
|
2279
|
+
that.url += (reQueryString.test(this.url) ? "&" : "?") + "_=" + (new Date()).getTime();
|
|
2126
2280
|
}
|
|
2127
2281
|
}
|
|
2128
2282
|
}
|
|
2129
2283
|
}
|
|
2130
|
-
[state$
|
|
2131
|
-
get
|
|
2132
|
-
get
|
|
2133
|
-
get
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
get
|
|
2141
|
-
get
|
|
2142
|
-
get
|
|
2143
|
-
get
|
|
2284
|
+
get cache() { return this[state$1].cache; }
|
|
2285
|
+
get credentials() { return this[state$1].credentials; }
|
|
2286
|
+
get destination() { return this[state$1].destination; }
|
|
2287
|
+
get headers() {
|
|
2288
|
+
const that = this[state$1];
|
|
2289
|
+
if (!that.headers) {
|
|
2290
|
+
that.headers = new HeadersP();
|
|
2291
|
+
}
|
|
2292
|
+
return that.headers;
|
|
2293
|
+
}
|
|
2294
|
+
get integrity() { return this[state$1].integrity; }
|
|
2295
|
+
get keepalive() { return this[state$1].keepalive; }
|
|
2296
|
+
get method() { return this[state$1].method; }
|
|
2297
|
+
get mode() { return this[state$1].mode; }
|
|
2298
|
+
get redirect() { return this[state$1].redirect; }
|
|
2299
|
+
get referrer() { return this[state$1].referrer; }
|
|
2300
|
+
get referrerPolicy() { return this[state$1].referrerPolicy; }
|
|
2301
|
+
get signal() {
|
|
2302
|
+
const that = this[state$1];
|
|
2303
|
+
if (!that.signal) {
|
|
2304
|
+
that.signal = (new AbortControllerP()).signal;
|
|
2305
|
+
}
|
|
2306
|
+
return that.signal;
|
|
2307
|
+
}
|
|
2308
|
+
get url() { return this[state$1].url; }
|
|
2144
2309
|
clone() {
|
|
2145
|
-
|
|
2310
|
+
var _a;
|
|
2311
|
+
return new RequestP(this, { body: (_a = this[state$3][_body]) !== null && _a !== void 0 ? _a : null });
|
|
2146
2312
|
}
|
|
2147
2313
|
toString() { return "[object Request]"; }
|
|
2148
2314
|
get isPolyfill() { return { symbol: polyfill, hierarchy: ["Request"] }; }
|
|
2149
2315
|
}
|
|
2150
2316
|
defineStringTag(RequestP, "Request");
|
|
2151
2317
|
class RequestState {
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2318
|
+
constructor() {
|
|
2319
|
+
this.cache = "default";
|
|
2320
|
+
this.credentials = "same-origin";
|
|
2321
|
+
this.destination = "";
|
|
2322
|
+
this.integrity = "";
|
|
2323
|
+
this.keepalive = false;
|
|
2324
|
+
this.method = "GET";
|
|
2325
|
+
this.mode = "cors";
|
|
2326
|
+
this.redirect = "follow";
|
|
2327
|
+
this.referrer = "about:client";
|
|
2328
|
+
this.referrerPolicy = "";
|
|
2329
|
+
this.url = "";
|
|
2330
|
+
}
|
|
2165
2331
|
}
|
|
2166
2332
|
const RequestE = g["Request"] || RequestP;
|
|
2167
2333
|
|
|
2334
|
+
const state = Symbol( /* "ResponseState" */);
|
|
2168
2335
|
class ResponseP extends BodyP {
|
|
2169
2336
|
constructor(body, init) {
|
|
2170
2337
|
super();
|
|
2171
|
-
this[state
|
|
2172
|
-
this[state]
|
|
2173
|
-
|
|
2338
|
+
this[state] = new ResponseState();
|
|
2339
|
+
const that = this[state];
|
|
2340
|
+
this[state$3][_name] = "Response";
|
|
2341
|
+
let options = init !== null && init !== void 0 ? init : {};
|
|
2174
2342
|
let status = options.status === undefined ? 200 : options.status;
|
|
2175
2343
|
if (status < 200 || status > 500) {
|
|
2176
2344
|
throw new RangeError(`Failed to construct 'Response': The status provided (${+status}) is outside the range [200, 599].`);
|
|
2177
2345
|
}
|
|
2178
2346
|
if (options.headers) {
|
|
2179
|
-
|
|
2180
|
-
}
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
this[state]
|
|
2185
|
-
}
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
get
|
|
2347
|
+
that.headers = new HeadersP(options.headers);
|
|
2348
|
+
}
|
|
2349
|
+
that.ok = this.status >= 200 && this.status < 300;
|
|
2350
|
+
that.status = status;
|
|
2351
|
+
that.statusText = options.statusText === undefined ? "" : "" + options.statusText;
|
|
2352
|
+
initFn.call(this[state$3], body, this.headers);
|
|
2353
|
+
}
|
|
2354
|
+
get headers() {
|
|
2355
|
+
const that = this[state];
|
|
2356
|
+
if (!that.headers) {
|
|
2357
|
+
that.headers = new HeadersP();
|
|
2358
|
+
}
|
|
2359
|
+
return that.headers;
|
|
2360
|
+
}
|
|
2361
|
+
get ok() { return this[state].ok; }
|
|
2362
|
+
get redirected() { return this[state].redirected; }
|
|
2363
|
+
get status() { return this[state].status; }
|
|
2364
|
+
get statusText() { return this[state].statusText; }
|
|
2365
|
+
get type() { return this[state].type; }
|
|
2366
|
+
get url() { return this[state].url; }
|
|
2194
2367
|
clone() {
|
|
2195
|
-
const response = new ResponseP(this[state]
|
|
2368
|
+
const response = new ResponseP(this[state$3][_body], {
|
|
2196
2369
|
headers: new HeadersP(this.headers),
|
|
2197
2370
|
status: this.status,
|
|
2198
2371
|
statusText: this.statusText,
|
|
2199
2372
|
});
|
|
2200
|
-
response[state
|
|
2373
|
+
response[state].url = this.url;
|
|
2201
2374
|
return response;
|
|
2202
2375
|
}
|
|
2203
2376
|
static json(data, init) {
|
|
@@ -2205,9 +2378,9 @@ class ResponseP extends BodyP {
|
|
|
2205
2378
|
}
|
|
2206
2379
|
static error() {
|
|
2207
2380
|
const response = new ResponseP(null, { status: 200, statusText: "" });
|
|
2208
|
-
response[state
|
|
2209
|
-
response[state
|
|
2210
|
-
response[state
|
|
2381
|
+
response[state].ok = false;
|
|
2382
|
+
response[state].status = 0;
|
|
2383
|
+
response[state].type = "error";
|
|
2211
2384
|
return response;
|
|
2212
2385
|
}
|
|
2213
2386
|
static redirect(url, status = 301) {
|
|
@@ -2221,13 +2394,14 @@ class ResponseP extends BodyP {
|
|
|
2221
2394
|
}
|
|
2222
2395
|
defineStringTag(ResponseP, "Response");
|
|
2223
2396
|
class ResponseState {
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2397
|
+
constructor() {
|
|
2398
|
+
this.ok = true;
|
|
2399
|
+
this.redirected = false;
|
|
2400
|
+
this.status = 200;
|
|
2401
|
+
this.statusText = "";
|
|
2402
|
+
this.type = "default";
|
|
2403
|
+
this.url = "";
|
|
2404
|
+
}
|
|
2231
2405
|
}
|
|
2232
2406
|
const ResponseE = g["Response"] || ResponseP;
|
|
2233
2407
|
|
|
@@ -2243,13 +2417,13 @@ function fetchP(input, init) {
|
|
|
2243
2417
|
let xhr = new XMLHttpRequestE();
|
|
2244
2418
|
xhr.onload = function () {
|
|
2245
2419
|
let options = {
|
|
2246
|
-
headers: xhr instanceof XMLHttpRequestP ? (new HeadersP(xhr[state$
|
|
2420
|
+
headers: xhr instanceof XMLHttpRequestP ? (new HeadersP(xhr[state$4][_responseHeaders] || undefined)) : parseHeaders(xhr.getAllResponseHeaders() || ""),
|
|
2247
2421
|
status: xhr.status,
|
|
2248
2422
|
statusText: xhr.statusText,
|
|
2249
2423
|
};
|
|
2250
2424
|
setTimeout(() => {
|
|
2251
2425
|
const response = new ResponseP(xhr.response, options);
|
|
2252
|
-
response[state
|
|
2426
|
+
response[state].url = xhr.responseURL;
|
|
2253
2427
|
resolve(response);
|
|
2254
2428
|
});
|
|
2255
2429
|
};
|
|
@@ -2278,7 +2452,7 @@ function fetchP(input, init) {
|
|
|
2278
2452
|
if (init && isObjectHeaders(init.headers)) {
|
|
2279
2453
|
let headers = init.headers;
|
|
2280
2454
|
let names = [];
|
|
2281
|
-
|
|
2455
|
+
objectEntries(headers).forEach(([name, value]) => {
|
|
2282
2456
|
names.push(normalizeName(name));
|
|
2283
2457
|
xhr.setRequestHeader(name, normalizeValue(value));
|
|
2284
2458
|
});
|
|
@@ -2303,35 +2477,12 @@ function fetchP(input, init) {
|
|
|
2303
2477
|
}
|
|
2304
2478
|
};
|
|
2305
2479
|
}
|
|
2306
|
-
xhr.send(request[state]
|
|
2480
|
+
xhr.send(request[state$3][_body]);
|
|
2307
2481
|
});
|
|
2308
2482
|
}
|
|
2309
2483
|
function isObjectHeaders(val) {
|
|
2310
2484
|
return typeof val === "object" && !isObjectType("Headers", val);
|
|
2311
2485
|
}
|
|
2312
|
-
function parseHeaders(rawHeaders) {
|
|
2313
|
-
let headers = new HeadersP();
|
|
2314
|
-
let preProcessedHeaders = rawHeaders.replace(/\r?\n[\t ]+/g, " ");
|
|
2315
|
-
preProcessedHeaders
|
|
2316
|
-
.split("\r")
|
|
2317
|
-
.map(function (header) {
|
|
2318
|
-
return header.indexOf("\n") === 0 ? header.substring(1, header.length) : header;
|
|
2319
|
-
})
|
|
2320
|
-
.forEach(function (line) {
|
|
2321
|
-
let parts = line.split(":");
|
|
2322
|
-
let key = parts.shift().trim();
|
|
2323
|
-
if (key) {
|
|
2324
|
-
let value = parts.join(":").trim();
|
|
2325
|
-
try {
|
|
2326
|
-
headers.append(key, value);
|
|
2327
|
-
}
|
|
2328
|
-
catch (error) {
|
|
2329
|
-
console.warn("Response " + error.message);
|
|
2330
|
-
}
|
|
2331
|
-
}
|
|
2332
|
-
});
|
|
2333
|
-
return headers;
|
|
2334
|
-
}
|
|
2335
2486
|
const fetchE = g["fetch"] || fetchP;
|
|
2336
2487
|
|
|
2337
2488
|
exports.AbortController = AbortControllerE;
|