mphttpx 1.0.11 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +61 -4
- package/dist/index.cjs.js +656 -345
- package/dist/index.cjs.min.js +1 -1
- package/dist/index.d.ts +46 -374
- package/dist/index.esm.js +654 -344
- package/dist/index.esm.min.js +1 -1
- package/package.json +7 -3
package/dist/index.cjs.js
CHANGED
|
@@ -165,24 +165,24 @@ function encodeText(input, destination) {
|
|
|
165
165
|
}
|
|
166
166
|
const TextEncoderE = g["TextEncoder"] || TextEncoderP;
|
|
167
167
|
|
|
168
|
-
var _a$
|
|
168
|
+
var _a$b, _b$4;
|
|
169
169
|
/** @internal */
|
|
170
|
-
const state$
|
|
170
|
+
const state$k = Symbol( /* "TextDecoderState" */);
|
|
171
171
|
class TextDecoderP {
|
|
172
172
|
constructor(label = "utf-8", { fatal = false, ignoreBOM = false } = {}) {
|
|
173
173
|
let _label = "" + label;
|
|
174
174
|
if (["utf-8", "utf8", "unicode-1-1-utf-8"].indexOf(_label.toLowerCase()) === -1) {
|
|
175
175
|
throw new RangeError(`Failed to construct 'TextDecoder': encoding ('${_label}') not implemented.`);
|
|
176
176
|
}
|
|
177
|
-
this[state$
|
|
178
|
-
this[state$
|
|
179
|
-
this[state$
|
|
177
|
+
this[state$k] = new TextDecoderState();
|
|
178
|
+
this[state$k].fatal = !!fatal;
|
|
179
|
+
this[state$k].ignoreBOM = !!ignoreBOM;
|
|
180
180
|
}
|
|
181
181
|
get encoding() { return "utf-8"; }
|
|
182
|
-
get fatal() { return this[state$
|
|
183
|
-
get ignoreBOM() { return this[state$
|
|
182
|
+
get fatal() { return this[state$k].fatal; }
|
|
183
|
+
get ignoreBOM() { return this[state$k].ignoreBOM; }
|
|
184
184
|
decode(input, { stream = false } = {}) {
|
|
185
|
-
const s = this[state$
|
|
185
|
+
const s = this[state$k];
|
|
186
186
|
let bytes;
|
|
187
187
|
if (input !== undefined) {
|
|
188
188
|
if (input instanceof ArrayBuffer) {
|
|
@@ -321,11 +321,11 @@ class TextDecoderState {
|
|
|
321
321
|
constructor() {
|
|
322
322
|
this.fatal = false;
|
|
323
323
|
this.ignoreBOM = false;
|
|
324
|
-
this[_a$
|
|
325
|
-
this[_b$
|
|
324
|
+
this[_a$b] = 0;
|
|
325
|
+
this[_b$4] = [];
|
|
326
326
|
}
|
|
327
327
|
}
|
|
328
|
-
_a$
|
|
328
|
+
_a$b = _bomDone, _b$4 = _partial;
|
|
329
329
|
function getBytesPerSequence(byte) {
|
|
330
330
|
return (byte > 0xEF) ? 4 : (byte > 0xDF) ? 3 : (byte > 0xBF) ? 2 : 1;
|
|
331
331
|
}
|
|
@@ -346,7 +346,7 @@ const concatString = (res) => {
|
|
|
346
346
|
const TextDecoderE = g["TextDecoder"] || TextDecoderP;
|
|
347
347
|
|
|
348
348
|
/** @internal */
|
|
349
|
-
const state$
|
|
349
|
+
const state$j = Symbol( /* "BlobState" */);
|
|
350
350
|
class BlobP {
|
|
351
351
|
constructor(blobParts = [], options) {
|
|
352
352
|
if (!(Array.isArray(blobParts) || (blobParts && typeof blobParts === "object" && Symbol.iterator in blobParts))) {
|
|
@@ -357,7 +357,7 @@ class BlobP {
|
|
|
357
357
|
for (let i = 0; i < _blobParts.length; ++i) {
|
|
358
358
|
let chunk = _blobParts[i];
|
|
359
359
|
if (isPolyfillType("Blob", chunk)) {
|
|
360
|
-
chunks.push(chunk[state$
|
|
360
|
+
chunks.push(chunk[state$j][_buffer]);
|
|
361
361
|
}
|
|
362
362
|
else if (chunk instanceof ArrayBuffer || ArrayBuffer.isView(chunk)) {
|
|
363
363
|
chunks.push(BufferSource_toUint8Array(chunk));
|
|
@@ -366,29 +366,29 @@ class BlobP {
|
|
|
366
366
|
chunks.push(encode$1("" + chunk));
|
|
367
367
|
}
|
|
368
368
|
}
|
|
369
|
-
this[state$
|
|
370
|
-
const s = this[state$
|
|
369
|
+
this[state$j] = new BlobState(concat(chunks));
|
|
370
|
+
const s = this[state$j];
|
|
371
371
|
s.size = s[_buffer].length;
|
|
372
372
|
let rawType = "" + ((options === null || options === void 0 ? void 0 : options.type) || "");
|
|
373
373
|
s.type = /[^\u0020-\u007E]/.test(rawType) ? "" : rawType.toLowerCase();
|
|
374
374
|
}
|
|
375
|
-
get size() { return this[state$
|
|
376
|
-
get type() { return this[state$
|
|
375
|
+
get size() { return this[state$j].size; }
|
|
376
|
+
get type() { return this[state$j].type; }
|
|
377
377
|
arrayBuffer() {
|
|
378
|
-
return Promise.resolve(clone(this[state$
|
|
378
|
+
return Promise.resolve(clone(this[state$j][_buffer].buffer).buffer);
|
|
379
379
|
}
|
|
380
380
|
bytes() {
|
|
381
|
-
return Promise.resolve(clone(this[state$
|
|
381
|
+
return Promise.resolve(clone(this[state$j][_buffer].buffer));
|
|
382
382
|
}
|
|
383
383
|
slice(start, end, contentType) {
|
|
384
|
-
let sliced = this[state$
|
|
384
|
+
let sliced = this[state$j][_buffer].slice(start !== null && start !== void 0 ? start : 0, end !== null && end !== void 0 ? end : this[state$j][_buffer].length); // × WeChat 2.5.0
|
|
385
385
|
return new BlobP([sliced], { type: "" + (contentType !== null && contentType !== void 0 ? contentType : "") });
|
|
386
386
|
}
|
|
387
387
|
stream() {
|
|
388
388
|
throw new TypeError("Failed to execute 'stream' on 'Blob': method not implemented.");
|
|
389
389
|
}
|
|
390
390
|
text() {
|
|
391
|
-
return Promise.resolve(decode$1(this[state$
|
|
391
|
+
return Promise.resolve(decode$1(this[state$j][_buffer]));
|
|
392
392
|
}
|
|
393
393
|
/** @internal */ toString() { return "[object Blob]"; }
|
|
394
394
|
/** @internal */ get isPolyfill() { return { symbol: polyfill, hierarchy: ["Blob"] }; }
|
|
@@ -406,7 +406,7 @@ class BlobState {
|
|
|
406
406
|
}
|
|
407
407
|
/** @internal */
|
|
408
408
|
function Blob_toUint8Array(blob) {
|
|
409
|
-
return blob[state$
|
|
409
|
+
return blob[state$j][_buffer];
|
|
410
410
|
}
|
|
411
411
|
function BufferSource_toUint8Array(buf) {
|
|
412
412
|
return buf instanceof ArrayBuffer
|
|
@@ -465,18 +465,18 @@ function Uint8Array_toBase64(input) {
|
|
|
465
465
|
const BlobE = g["Blob"] || BlobP;
|
|
466
466
|
|
|
467
467
|
/** @internal */
|
|
468
|
-
const state$
|
|
468
|
+
const state$i = Symbol( /* "FileState" */);
|
|
469
469
|
class FileP extends BlobP {
|
|
470
470
|
constructor(...args) {
|
|
471
471
|
const [fileBits, fileName, options] = args;
|
|
472
472
|
checkArgsLength(args, 2, "File");
|
|
473
473
|
super(fileBits, options);
|
|
474
|
-
this[state$
|
|
475
|
-
this[state$
|
|
476
|
-
this[state$
|
|
474
|
+
this[state$i] = new FileState();
|
|
475
|
+
this[state$i].lastModified = +((options === null || options === void 0 ? void 0 : options.lastModified) ? new Date(options.lastModified) : new Date()) || 0;
|
|
476
|
+
this[state$i].name = "" + fileName;
|
|
477
477
|
}
|
|
478
|
-
get lastModified() { return this[state$
|
|
479
|
-
get name() { return this[state$
|
|
478
|
+
get lastModified() { return this[state$i].lastModified; }
|
|
479
|
+
get name() { return this[state$i].name; }
|
|
480
480
|
get webkitRelativePath() { return ""; }
|
|
481
481
|
/** @internal */ toString() { return "[object File]"; }
|
|
482
482
|
/** @internal */ get isPolyfill() { return { symbol: polyfill, hierarchy: ["File", "Blob"] }; }
|
|
@@ -491,39 +491,39 @@ class FileState {
|
|
|
491
491
|
}
|
|
492
492
|
const FileE = g["Blob"] ? g["File"] : FileP;
|
|
493
493
|
|
|
494
|
-
var _a$
|
|
495
|
-
/** @internal */ const state$
|
|
494
|
+
var _a$a, _b$3, _c$1, _d$1, _e$1;
|
|
495
|
+
/** @internal */ const state$h = Symbol( /* "EventState" */);
|
|
496
496
|
class EventP {
|
|
497
497
|
constructor(...args) {
|
|
498
498
|
const [type, eventInitDict] = args;
|
|
499
499
|
checkArgsLength(args, 1, new.target.name);
|
|
500
|
-
this[state$
|
|
501
|
-
const s = this[state$
|
|
500
|
+
this[state$h] = new EventState();
|
|
501
|
+
const s = this[state$h];
|
|
502
502
|
s.type = "" + type;
|
|
503
503
|
s.bubbles = !!(eventInitDict === null || eventInitDict === void 0 ? void 0 : eventInitDict.bubbles);
|
|
504
504
|
s.cancelable = !!(eventInitDict === null || eventInitDict === void 0 ? void 0 : eventInitDict.cancelable);
|
|
505
505
|
s.composed = !!(eventInitDict === null || eventInitDict === void 0 ? void 0 : eventInitDict.composed);
|
|
506
506
|
Object.defineProperty(this, "isTrusted", {
|
|
507
507
|
enumerable: true,
|
|
508
|
-
get: (function isTrusted() { return this[state$
|
|
508
|
+
get: (function isTrusted() { return this[state$h][_isTrusted]; }).bind(this),
|
|
509
509
|
});
|
|
510
510
|
}
|
|
511
|
-
get type() { return this[state$
|
|
512
|
-
get bubbles() { return this[state$
|
|
513
|
-
get cancelable() { return this[state$
|
|
514
|
-
get composed() { return this[state$
|
|
515
|
-
get target() { return this[state$
|
|
516
|
-
get currentTarget() { return this[state$
|
|
517
|
-
get eventPhase() { return this[state$
|
|
518
|
-
get srcElement() { return this[state$
|
|
519
|
-
get cancelBubble() { return this[state$
|
|
520
|
-
set cancelBubble(value) { this[state$
|
|
521
|
-
get defaultPrevented() { return this[state$
|
|
522
|
-
get returnValue() { return this[state$
|
|
511
|
+
get type() { return this[state$h].type; }
|
|
512
|
+
get bubbles() { return this[state$h].bubbles; }
|
|
513
|
+
get cancelable() { return this[state$h].cancelable; }
|
|
514
|
+
get composed() { return this[state$h].composed; }
|
|
515
|
+
get target() { return this[state$h].target; }
|
|
516
|
+
get currentTarget() { return this[state$h].currentTarget; }
|
|
517
|
+
get eventPhase() { return this[state$h].eventPhase; }
|
|
518
|
+
get srcElement() { return this[state$h].target; }
|
|
519
|
+
get cancelBubble() { return this[state$h].cancelBubble; }
|
|
520
|
+
set cancelBubble(value) { this[state$h].cancelBubble = !!value; }
|
|
521
|
+
get defaultPrevented() { return this[state$h].defaultPrevented; }
|
|
522
|
+
get returnValue() { return this[state$h].returnValue; }
|
|
523
523
|
set returnValue(value) { if (!value) {
|
|
524
524
|
this.preventDefault();
|
|
525
525
|
} }
|
|
526
|
-
get timeStamp() { return this[state$
|
|
526
|
+
get timeStamp() { return this[state$h].timeStamp; }
|
|
527
527
|
composedPath() {
|
|
528
528
|
let path = !!this.target ? [this.target] : [];
|
|
529
529
|
if (!!this.currentTarget && this.currentTarget !== this.target)
|
|
@@ -533,7 +533,7 @@ class EventP {
|
|
|
533
533
|
initEvent(...args) {
|
|
534
534
|
const [type, bubbles, cancelable] = args;
|
|
535
535
|
checkArgsLength(args, 1, "Event", "initEvent");
|
|
536
|
-
const s = this[state$
|
|
536
|
+
const s = this[state$h];
|
|
537
537
|
if (s[_dispatched])
|
|
538
538
|
return;
|
|
539
539
|
s.type = "" + type;
|
|
@@ -541,7 +541,7 @@ class EventP {
|
|
|
541
541
|
s.cancelable = !!cancelable;
|
|
542
542
|
}
|
|
543
543
|
preventDefault() {
|
|
544
|
-
const s = this[state$
|
|
544
|
+
const s = this[state$h];
|
|
545
545
|
if (s[_passive]) {
|
|
546
546
|
console.warn(`Ignoring 'preventDefault()' call on event of type '${this.type}' from a listener registered as 'passive'.`);
|
|
547
547
|
return;
|
|
@@ -553,7 +553,7 @@ class EventP {
|
|
|
553
553
|
}
|
|
554
554
|
}
|
|
555
555
|
stopImmediatePropagation() {
|
|
556
|
-
this[state$
|
|
556
|
+
this[state$h][_stopImmediatePropagationCalled] = true;
|
|
557
557
|
this.cancelBubble = true;
|
|
558
558
|
}
|
|
559
559
|
stopPropagation() {
|
|
@@ -562,14 +562,14 @@ class EventP {
|
|
|
562
562
|
/** @internal */ toString() { return "[object Event]"; }
|
|
563
563
|
/** @internal */ get isPolyfill() { return { symbol: polyfill, hierarchy: ["Event"] }; }
|
|
564
564
|
}
|
|
565
|
-
const properties$
|
|
565
|
+
const properties$2 = {
|
|
566
566
|
NONE: { value: 0, enumerable: true },
|
|
567
567
|
CAPTURING_PHASE: { value: 1, enumerable: true },
|
|
568
568
|
AT_TARGET: { value: 2, enumerable: true },
|
|
569
569
|
BUBBLING_PHASE: { value: 3, enumerable: true },
|
|
570
570
|
};
|
|
571
|
-
Object.defineProperties(EventP, properties$
|
|
572
|
-
Object.defineProperties(EventP.prototype, properties$
|
|
571
|
+
Object.defineProperties(EventP, properties$2);
|
|
572
|
+
Object.defineProperties(EventP.prototype, properties$2);
|
|
573
573
|
Class_setStringTag(EventP, "Event");
|
|
574
574
|
/** @internal */ const _timeStamp = (new Date()).getTime();
|
|
575
575
|
/** @internal */ const _isTrusted = Symbol();
|
|
@@ -591,17 +591,17 @@ class EventState {
|
|
|
591
591
|
this.defaultPrevented = false;
|
|
592
592
|
this.returnValue = true;
|
|
593
593
|
this.timeStamp = (new Date()).getTime() - _timeStamp;
|
|
594
|
-
this[_a$
|
|
595
|
-
this[_b$
|
|
594
|
+
this[_a$a] = false;
|
|
595
|
+
this[_b$3] = false;
|
|
596
596
|
this[_c$1] = false;
|
|
597
597
|
this[_d$1] = false;
|
|
598
598
|
this[_e$1] = false;
|
|
599
599
|
}
|
|
600
600
|
}
|
|
601
|
-
_a$
|
|
601
|
+
_a$a = _isTrusted, _b$3 = _passive, _c$1 = _dispatched, _d$1 = _preventDefaultCalled, _e$1 = _stopImmediatePropagationCalled;
|
|
602
602
|
/** @internal */
|
|
603
603
|
function Event_setTrusted(event, isTrusted) {
|
|
604
|
-
Object.defineProperty(event[state$
|
|
604
|
+
Object.defineProperty(event[state$h], _isTrusted, {
|
|
605
605
|
value: isTrusted,
|
|
606
606
|
writable: true,
|
|
607
607
|
enumerable: true,
|
|
@@ -609,16 +609,16 @@ function Event_setTrusted(event, isTrusted) {
|
|
|
609
609
|
});
|
|
610
610
|
}
|
|
611
611
|
const passive$1 = 0;
|
|
612
|
-
const dispatched$
|
|
612
|
+
const dispatched$3 = 1;
|
|
613
613
|
const preventDefaultCalled$1 = 2;
|
|
614
614
|
const stopImmediatePropagationCalled$1 = 3;
|
|
615
615
|
/** @internal */
|
|
616
616
|
function Event_getEtField(event, field) {
|
|
617
|
-
const s = event[state$
|
|
617
|
+
const s = event[state$h];
|
|
618
618
|
switch (field) {
|
|
619
619
|
case passive$1:
|
|
620
620
|
return s[_passive];
|
|
621
|
-
case dispatched$
|
|
621
|
+
case dispatched$3:
|
|
622
622
|
return s[_dispatched];
|
|
623
623
|
case preventDefaultCalled$1:
|
|
624
624
|
return s[_preventDefaultCalled];
|
|
@@ -628,12 +628,12 @@ function Event_getEtField(event, field) {
|
|
|
628
628
|
}
|
|
629
629
|
/** @internal */
|
|
630
630
|
function Event_setEtField(event, field, value) {
|
|
631
|
-
const s = event[state$
|
|
631
|
+
const s = event[state$h];
|
|
632
632
|
switch (field) {
|
|
633
633
|
case passive$1:
|
|
634
634
|
s[_passive] = value;
|
|
635
635
|
break;
|
|
636
|
-
case dispatched$
|
|
636
|
+
case dispatched$3:
|
|
637
637
|
s[_dispatched] = value;
|
|
638
638
|
break;
|
|
639
639
|
case preventDefaultCalled$1:
|
|
@@ -647,30 +647,30 @@ function Event_setEtField(event, field, value) {
|
|
|
647
647
|
/** @internal */
|
|
648
648
|
function createInnerEvent(target, type, eventInitDict, isTrusted = true) {
|
|
649
649
|
let event = new EventP(type, eventInitDict);
|
|
650
|
-
event[state$
|
|
651
|
-
event[state$
|
|
650
|
+
event[state$h].target = target;
|
|
651
|
+
event[state$h][_isTrusted] = isTrusted;
|
|
652
652
|
return event;
|
|
653
653
|
}
|
|
654
654
|
const EventE = g["EventTarget"] ? g["Event"] : EventP;
|
|
655
655
|
|
|
656
|
-
var _a$
|
|
656
|
+
var _a$9;
|
|
657
657
|
const passive = 0;
|
|
658
|
-
const dispatched$
|
|
658
|
+
const dispatched$2 = 1;
|
|
659
659
|
const preventDefaultCalled = 2;
|
|
660
660
|
const stopImmediatePropagationCalled = 3;
|
|
661
|
-
/** @internal */ const state$
|
|
661
|
+
/** @internal */ const state$g = Symbol( /* "EventTargetState" */);
|
|
662
662
|
class EventTargetP {
|
|
663
663
|
constructor() {
|
|
664
|
-
this[state$
|
|
665
|
-
this[state$
|
|
664
|
+
this[state$g] = new EventTargetState(this);
|
|
665
|
+
this[state$g].name = new.target.name;
|
|
666
666
|
}
|
|
667
667
|
addEventListener(...args) {
|
|
668
668
|
const [type, callback, options] = args;
|
|
669
|
-
checkArgsLength(args, 2, this[state$
|
|
669
|
+
checkArgsLength(args, 2, this[state$g].name, "addEventListener");
|
|
670
670
|
if (typeof callback !== "function" && typeof callback !== "object" && typeof callback !== "undefined") {
|
|
671
|
-
throw new TypeError(`Failed to execute 'addEventListener' on '${this[state$
|
|
671
|
+
throw new TypeError(`Failed to execute 'addEventListener' on '${this[state$g].name}': parameter 2 is not of type 'Object'.`);
|
|
672
672
|
}
|
|
673
|
-
const s = this[state$
|
|
673
|
+
const s = this[state$g];
|
|
674
674
|
const executor = new Executor(type, callback);
|
|
675
675
|
executor.options.capture = typeof options === "boolean" ? options : !!(options === null || options === void 0 ? void 0 : options.capture);
|
|
676
676
|
if (!s[_executors].some(x => x.equals(executor))) {
|
|
@@ -678,7 +678,7 @@ class EventTargetP {
|
|
|
678
678
|
const { once, passive, signal } = options;
|
|
679
679
|
executor.options.once = !!once;
|
|
680
680
|
executor.options.passive = !!passive;
|
|
681
|
-
if (signal) {
|
|
681
|
+
if (signal && isPolyfillType("EventTarget", signal)) {
|
|
682
682
|
executor.options.signal = signal;
|
|
683
683
|
reply(this, signal, executor);
|
|
684
684
|
}
|
|
@@ -690,21 +690,21 @@ class EventTargetP {
|
|
|
690
690
|
}
|
|
691
691
|
dispatchEvent(...args) {
|
|
692
692
|
const [event] = args;
|
|
693
|
-
checkArgsLength(args, 1, this[state$
|
|
693
|
+
checkArgsLength(args, 1, this[state$g].name, "dispatchEvent");
|
|
694
694
|
if (!(event instanceof EventP)) {
|
|
695
|
-
throw new TypeError(`Failed to execute 'dispatchEvent' on '${this[state$
|
|
695
|
+
throw new TypeError(`Failed to execute 'dispatchEvent' on '${this[state$g].name}': parameter 1 is not of type 'Event'.`);
|
|
696
696
|
}
|
|
697
697
|
Event_setTrusted(event, false);
|
|
698
|
-
event[state$
|
|
698
|
+
event[state$h].target = this;
|
|
699
699
|
return EventTarget_fire(this, event);
|
|
700
700
|
}
|
|
701
701
|
removeEventListener(...args) {
|
|
702
702
|
const [type, callback, options] = args;
|
|
703
|
-
checkArgsLength(args, 2, this[state$
|
|
703
|
+
checkArgsLength(args, 2, this[state$g].name, "removeEventListener");
|
|
704
704
|
if (typeof callback !== "function" && typeof callback !== "object" && typeof callback !== "undefined") {
|
|
705
|
-
throw new TypeError(`Failed to execute 'removeEventListener' on '${this[state$
|
|
705
|
+
throw new TypeError(`Failed to execute 'removeEventListener' on '${this[state$g].name}': parameter 2 is not of type 'Object'.`);
|
|
706
706
|
}
|
|
707
|
-
const s = this[state$
|
|
707
|
+
const s = this[state$g];
|
|
708
708
|
const executor = new Executor(type, callback);
|
|
709
709
|
executor.options.capture = typeof options === "boolean" ? options : !!(options === null || options === void 0 ? void 0 : options.capture);
|
|
710
710
|
if (s[_executors].some(x => x.equals(executor))) {
|
|
@@ -721,20 +721,20 @@ const _executors = Symbol();
|
|
|
721
721
|
class EventTargetState {
|
|
722
722
|
constructor(target) {
|
|
723
723
|
this.name = "EventTarget";
|
|
724
|
-
this[_a$
|
|
724
|
+
this[_a$9] = [];
|
|
725
725
|
this.target = target;
|
|
726
726
|
}
|
|
727
727
|
}
|
|
728
|
-
_a$
|
|
728
|
+
_a$9 = _executors;
|
|
729
729
|
/** @internal */
|
|
730
730
|
function EventTarget_fire(target, event) {
|
|
731
|
-
const s = target[state$
|
|
732
|
-
const evs = event[state$
|
|
731
|
+
const s = target[state$g];
|
|
732
|
+
const evs = event[state$h];
|
|
733
733
|
if (!event.target)
|
|
734
734
|
evs.target = target;
|
|
735
735
|
evs.currentTarget = target;
|
|
736
736
|
evs.eventPhase = EventP.AT_TARGET;
|
|
737
|
-
Event_setEtField(event, dispatched$
|
|
737
|
+
Event_setEtField(event, dispatched$2, true);
|
|
738
738
|
let onceIndexes = [];
|
|
739
739
|
for (let i = 0; i < s[_executors].length; ++i) {
|
|
740
740
|
if (Event_getEtField(event, stopImmediatePropagationCalled))
|
|
@@ -764,21 +764,16 @@ function EventTarget_fire(target, event) {
|
|
|
764
764
|
}
|
|
765
765
|
evs.currentTarget = null;
|
|
766
766
|
evs.eventPhase = EventP.NONE;
|
|
767
|
-
Event_setEtField(event, dispatched$
|
|
767
|
+
Event_setEtField(event, dispatched$2, false);
|
|
768
768
|
return !(event.cancelable && Event_getEtField(event, preventDefaultCalled));
|
|
769
769
|
}
|
|
770
770
|
function reply(target, signal, executor) {
|
|
771
|
-
const s = target[state$
|
|
771
|
+
const s = target[state$g];
|
|
772
772
|
const onAbort = () => {
|
|
773
773
|
s[_executors] = s[_executors].filter(x => !x.equals(executor));
|
|
774
774
|
signal.removeEventListener("abort", onAbort);
|
|
775
775
|
};
|
|
776
|
-
|
|
777
|
-
signal.addEventListener("abort", onAbort);
|
|
778
|
-
}
|
|
779
|
-
catch (e) {
|
|
780
|
-
console.warn(e);
|
|
781
|
-
}
|
|
776
|
+
signal.addEventListener("abort", onAbort);
|
|
782
777
|
}
|
|
783
778
|
/** @internal */
|
|
784
779
|
class Executor {
|
|
@@ -804,7 +799,7 @@ function extract(cb) {
|
|
|
804
799
|
}
|
|
805
800
|
}
|
|
806
801
|
function isEventListenerObject(cb) {
|
|
807
|
-
return !!cb && "handleEvent" in cb && typeof cb.handleEvent === "function";
|
|
802
|
+
return !!cb && typeof cb === "object" && "handleEvent" in cb && typeof cb.handleEvent === "function";
|
|
808
803
|
}
|
|
809
804
|
/** @internal */
|
|
810
805
|
function attachFn(target, type, cb, listener) {
|
|
@@ -823,13 +818,13 @@ function executeFn(target, cb, ev) {
|
|
|
823
818
|
const EventTargetE = g["EventTarget"] || EventTargetP;
|
|
824
819
|
|
|
825
820
|
/** @internal */
|
|
826
|
-
const state$
|
|
821
|
+
const state$f = Symbol( /* "ProgressEventState" */);
|
|
827
822
|
class ProgressEventP extends EventP {
|
|
828
823
|
constructor(type, eventInitDict) {
|
|
829
824
|
var _a, _b;
|
|
830
825
|
super(type, eventInitDict);
|
|
831
|
-
this[state$
|
|
832
|
-
const s = this[state$
|
|
826
|
+
this[state$f] = new ProgressEventState();
|
|
827
|
+
const s = this[state$f];
|
|
833
828
|
s.lengthComputable = !!(eventInitDict === null || eventInitDict === void 0 ? void 0 : eventInitDict.lengthComputable);
|
|
834
829
|
s.loaded = Number((_a = eventInitDict === null || eventInitDict === void 0 ? void 0 : eventInitDict.loaded) !== null && _a !== void 0 ? _a : 0);
|
|
835
830
|
s.total = Number((_b = eventInitDict === null || eventInitDict === void 0 ? void 0 : eventInitDict.total) !== null && _b !== void 0 ? _b : 0);
|
|
@@ -844,9 +839,9 @@ class ProgressEventP extends EventP {
|
|
|
844
839
|
throw new TypeError(`Failed to construct 'ProgressEvent': Failed to read the '${errField}' property from 'ProgressEventInit': The provided double value is non-finite.`);
|
|
845
840
|
}
|
|
846
841
|
}
|
|
847
|
-
get lengthComputable() { return getValue(this[state$
|
|
848
|
-
get loaded() { return getValue(this[state$
|
|
849
|
-
get total() { return getValue(this[state$
|
|
842
|
+
get lengthComputable() { return getValue(this[state$f].lengthComputable); }
|
|
843
|
+
get loaded() { return getValue(this[state$f].loaded); }
|
|
844
|
+
get total() { return getValue(this[state$f].total); }
|
|
850
845
|
/** @internal */ toString() { return "[object ProgressEvent]"; }
|
|
851
846
|
/** @internal */ get isPolyfill() { return { symbol: polyfill, hierarchy: ["ProgressEvent", "Event"] }; }
|
|
852
847
|
}
|
|
@@ -864,10 +859,10 @@ function getValue(val) {
|
|
|
864
859
|
}
|
|
865
860
|
function createInnerProgressEvent(target, type, { lengthComputable = false, loaded = 0, total = 0, } = {}) {
|
|
866
861
|
let event = new ProgressEventP(type);
|
|
867
|
-
event[state$
|
|
868
|
-
event[state$
|
|
869
|
-
event[state$
|
|
870
|
-
event[state$
|
|
862
|
+
event[state$f].lengthComputable = lengthComputable;
|
|
863
|
+
event[state$f].loaded = loaded;
|
|
864
|
+
event[state$f].total = total;
|
|
865
|
+
event[state$h].target = target;
|
|
871
866
|
Event_setTrusted(event, true);
|
|
872
867
|
return event;
|
|
873
868
|
}
|
|
@@ -880,22 +875,22 @@ function emitProcessEvent(target, type, loaded = 0, total = 0) {
|
|
|
880
875
|
});
|
|
881
876
|
EventTarget_fire(target, event);
|
|
882
877
|
}
|
|
883
|
-
|
|
878
|
+
g["EventTarget"] ? g["ProgressEvent"] : ProgressEventP;
|
|
884
879
|
|
|
885
|
-
var _a$
|
|
880
|
+
var _a$8;
|
|
886
881
|
/** @internal */
|
|
887
|
-
const state$
|
|
882
|
+
const state$e = Symbol( /* "FileReaderState" */);
|
|
888
883
|
class FileReaderP extends EventTargetP {
|
|
889
884
|
constructor() {
|
|
890
885
|
super();
|
|
891
|
-
this[state$
|
|
886
|
+
this[state$e] = new FileReaderState(this);
|
|
892
887
|
}
|
|
893
|
-
get readyState() { return this[state$
|
|
894
|
-
get result() { return this[state$
|
|
895
|
-
get error() { return this[state$
|
|
888
|
+
get readyState() { return this[state$e].readyState; }
|
|
889
|
+
get result() { return this[state$e].result; }
|
|
890
|
+
get error() { return this[state$e].error; }
|
|
896
891
|
abort() {
|
|
897
892
|
if (this.readyState === FileReaderP.LOADING) {
|
|
898
|
-
const s = this[state$
|
|
893
|
+
const s = this[state$e];
|
|
899
894
|
s.readyState = FileReaderP.DONE;
|
|
900
895
|
s.result = null;
|
|
901
896
|
s.error = new MPException("An ongoing operation was aborted, typically with a call to abort().", "AbortError");
|
|
@@ -904,7 +899,7 @@ class FileReaderP extends EventTargetP {
|
|
|
904
899
|
}
|
|
905
900
|
readAsArrayBuffer(...args) {
|
|
906
901
|
read$1(this, "readAsArrayBuffer", args, blob => {
|
|
907
|
-
this[state$
|
|
902
|
+
this[state$e].result = Blob_toUint8Array(blob).buffer.slice(0);
|
|
908
903
|
});
|
|
909
904
|
}
|
|
910
905
|
readAsBinaryString(...args) {
|
|
@@ -915,12 +910,12 @@ class FileReaderP extends EventTargetP {
|
|
|
915
910
|
let char = buf[i];
|
|
916
911
|
str.push(String.fromCharCode(char));
|
|
917
912
|
}
|
|
918
|
-
this[state$
|
|
913
|
+
this[state$e].result = str.join("");
|
|
919
914
|
});
|
|
920
915
|
}
|
|
921
916
|
readAsDataURL(...args) {
|
|
922
917
|
read$1(this, "readAsDataURL", args, blob => {
|
|
923
|
-
this[state$
|
|
918
|
+
this[state$e].result = "data:" + (blob.type || "application/octet-stream") + ";base64," + Uint8Array_toBase64(Blob_toUint8Array(blob));
|
|
924
919
|
});
|
|
925
920
|
}
|
|
926
921
|
readAsText(...args) {
|
|
@@ -932,41 +927,41 @@ class FileReaderP extends EventTargetP {
|
|
|
932
927
|
console.error(`TypeError: Failed to execute 'readAsText' on 'FileReader': encoding ('${_encoding}') not implemented.`);
|
|
933
928
|
}
|
|
934
929
|
}
|
|
935
|
-
this[state$
|
|
930
|
+
this[state$e].result = decode$1(Blob_toUint8Array(blob));
|
|
936
931
|
});
|
|
937
932
|
}
|
|
938
|
-
get onabort() { return this[state$
|
|
939
|
-
set onabort(value) { this[state$
|
|
940
|
-
get onerror() { return this[state$
|
|
941
|
-
set onerror(value) { this[state$
|
|
942
|
-
get onload() { return this[state$
|
|
943
|
-
set onload(value) { this[state$
|
|
944
|
-
get onloadend() { return this[state$
|
|
945
|
-
set onloadend(value) { this[state$
|
|
946
|
-
get onloadstart() { return this[state$
|
|
947
|
-
set onloadstart(value) { this[state$
|
|
948
|
-
get onprogress() { return this[state$
|
|
949
|
-
set onprogress(value) { this[state$
|
|
933
|
+
get onabort() { return this[state$e].onabort; }
|
|
934
|
+
set onabort(value) { this[state$e].onabort = value; attach$2(this, "abort"); }
|
|
935
|
+
get onerror() { return this[state$e].onerror; }
|
|
936
|
+
set onerror(value) { this[state$e].onerror = value; attach$2(this, "error"); }
|
|
937
|
+
get onload() { return this[state$e].onload; }
|
|
938
|
+
set onload(value) { this[state$e].onload = value; attach$2(this, "load"); }
|
|
939
|
+
get onloadend() { return this[state$e].onloadend; }
|
|
940
|
+
set onloadend(value) { this[state$e].onloadend = value; attach$2(this, "loadend"); }
|
|
941
|
+
get onloadstart() { return this[state$e].onloadstart; }
|
|
942
|
+
set onloadstart(value) { this[state$e].onloadstart = value; attach$2(this, "loadstart"); }
|
|
943
|
+
get onprogress() { return this[state$e].onprogress; }
|
|
944
|
+
set onprogress(value) { this[state$e].onprogress = value; attach$2(this, "progress"); }
|
|
950
945
|
/** @internal */ toString() { return "[object FileReader]"; }
|
|
951
946
|
/** @internal */ get isPolyfill() { return { symbol: polyfill, hierarchy: ["FileReader", "EventTarget"] }; }
|
|
952
947
|
}
|
|
953
|
-
const properties = {
|
|
948
|
+
const properties$1 = {
|
|
954
949
|
EMPTY: { value: 0, enumerable: true },
|
|
955
950
|
LOADING: { value: 1, enumerable: true },
|
|
956
951
|
DONE: { value: 2, enumerable: true },
|
|
957
952
|
};
|
|
958
|
-
Object.defineProperties(FileReaderP, properties);
|
|
959
|
-
Object.defineProperties(FileReaderP.prototype, properties);
|
|
953
|
+
Object.defineProperties(FileReaderP, properties$1);
|
|
954
|
+
Object.defineProperties(FileReaderP.prototype, properties$1);
|
|
960
955
|
Class_setStringTag(FileReaderP, "FileReader");
|
|
961
956
|
/** @internal */
|
|
962
|
-
const _handlers$
|
|
957
|
+
const _handlers$4 = Symbol();
|
|
963
958
|
/** @internal */
|
|
964
959
|
class FileReaderState {
|
|
965
960
|
constructor(target) {
|
|
966
961
|
this.readyState = FileReaderP.EMPTY;
|
|
967
962
|
this.result = null;
|
|
968
963
|
this.error = null;
|
|
969
|
-
this[_a$
|
|
964
|
+
this[_a$8] = getHandlers$4(this);
|
|
970
965
|
this.onabort = null;
|
|
971
966
|
this.onerror = null;
|
|
972
967
|
this.onload = null;
|
|
@@ -976,14 +971,14 @@ class FileReaderState {
|
|
|
976
971
|
this.target = target;
|
|
977
972
|
}
|
|
978
973
|
}
|
|
979
|
-
_a$
|
|
974
|
+
_a$8 = _handlers$4;
|
|
980
975
|
function read$1(reader, kind, args, setResult) {
|
|
981
976
|
const [blob] = args;
|
|
982
977
|
checkArgsLength(args, 1, "FileReader", kind);
|
|
983
978
|
if (!isPolyfillType("Blob", blob)) {
|
|
984
979
|
throw new TypeError("Failed to execute '" + kind + "' on 'FileReader': parameter 1 is not of type 'Blob'.");
|
|
985
980
|
}
|
|
986
|
-
const s = reader[state$
|
|
981
|
+
const s = reader[state$e];
|
|
987
982
|
s.error = null;
|
|
988
983
|
s.readyState = FileReaderP.LOADING;
|
|
989
984
|
emitProcessEvent(s.target, "loadstart", 0, blob.size);
|
|
@@ -1003,14 +998,14 @@ function read$1(reader, kind, args, setResult) {
|
|
|
1003
998
|
emitProcessEvent(s.target, "loadend", !!s.result ? blob.size : 0, blob.size);
|
|
1004
999
|
});
|
|
1005
1000
|
}
|
|
1006
|
-
function attach$
|
|
1007
|
-
const s = reader[state$
|
|
1001
|
+
function attach$2(reader, type) {
|
|
1002
|
+
const s = reader[state$e];
|
|
1008
1003
|
const fnName = ("on" + type);
|
|
1009
1004
|
const cb = s[fnName];
|
|
1010
|
-
const listener = s[_handlers$
|
|
1005
|
+
const listener = s[_handlers$4][fnName];
|
|
1011
1006
|
attachFn(reader, type, cb, listener);
|
|
1012
1007
|
}
|
|
1013
|
-
function getHandlers$
|
|
1008
|
+
function getHandlers$4(s) {
|
|
1014
1009
|
return {
|
|
1015
1010
|
onabort: (ev) => { executeFn(s.target, s.onabort, ev); },
|
|
1016
1011
|
onerror: (ev) => { executeFn(s.target, s.onerror, ev); },
|
|
@@ -1022,12 +1017,12 @@ function getHandlers$3(s) {
|
|
|
1022
1017
|
}
|
|
1023
1018
|
const FileReaderE = g["Blob"] ? g["FileReader"] : FileReaderP;
|
|
1024
1019
|
|
|
1025
|
-
var _a$
|
|
1026
|
-
/** @internal */ const state$
|
|
1020
|
+
var _a$7;
|
|
1021
|
+
/** @internal */ const state$d = Symbol( /* "URLSearchParamsState" */);
|
|
1027
1022
|
const checkArgsFn$2 = (args, required, funcName) => { checkArgsLength(args, required, "URLSearchParams", funcName); };
|
|
1028
1023
|
class URLSearchParamsP {
|
|
1029
1024
|
constructor(init) {
|
|
1030
|
-
this[state$
|
|
1025
|
+
this[state$d] = new URLSearchParamsState();
|
|
1031
1026
|
if (init !== undefined) {
|
|
1032
1027
|
if (isObjectType("URLSearchParams", init)) {
|
|
1033
1028
|
init.forEach((value, name) => { this.append(name, value); }, this);
|
|
@@ -1075,18 +1070,18 @@ class URLSearchParamsP {
|
|
|
1075
1070
|
}
|
|
1076
1071
|
}
|
|
1077
1072
|
}
|
|
1078
|
-
get size() { return this[state$
|
|
1073
|
+
get size() { return this[state$d][_urlspArray].length; }
|
|
1079
1074
|
append(...args) {
|
|
1080
1075
|
const [name, value] = args;
|
|
1081
1076
|
checkArgsFn$2(args, 2, "append");
|
|
1082
|
-
this[state$
|
|
1077
|
+
this[state$d][_urlspArray].push(["" + name, normalizeValue$1(value)]);
|
|
1083
1078
|
}
|
|
1084
1079
|
delete(...args) {
|
|
1085
1080
|
const [name, value] = args;
|
|
1086
1081
|
checkArgsFn$2(args, 1, "delete");
|
|
1087
1082
|
let _name = "" + name;
|
|
1088
1083
|
let index = -1;
|
|
1089
|
-
let array = this[state$
|
|
1084
|
+
let array = this[state$d][_urlspArray];
|
|
1090
1085
|
let result = [];
|
|
1091
1086
|
for (let i = 0; i < array.length; ++i) {
|
|
1092
1087
|
let item = array[i];
|
|
@@ -1100,14 +1095,14 @@ class URLSearchParamsP {
|
|
|
1100
1095
|
result.push(item);
|
|
1101
1096
|
}
|
|
1102
1097
|
if (index > -1) {
|
|
1103
|
-
this[state$
|
|
1098
|
+
this[state$d][_urlspArray] = result;
|
|
1104
1099
|
}
|
|
1105
1100
|
}
|
|
1106
1101
|
get(...args) {
|
|
1107
1102
|
const [name] = args;
|
|
1108
1103
|
checkArgsFn$2(args, 1, "get");
|
|
1109
1104
|
let _name = "" + name;
|
|
1110
|
-
let array = this[state$
|
|
1105
|
+
let array = this[state$d][_urlspArray];
|
|
1111
1106
|
for (let i = 0; i < array.length; ++i) {
|
|
1112
1107
|
let item = array[i];
|
|
1113
1108
|
if (item[0] === _name) {
|
|
@@ -1120,7 +1115,7 @@ class URLSearchParamsP {
|
|
|
1120
1115
|
const [name] = args;
|
|
1121
1116
|
checkArgsFn$2(args, 1, "getAll");
|
|
1122
1117
|
let _name = "" + name;
|
|
1123
|
-
let array = this[state$
|
|
1118
|
+
let array = this[state$d][_urlspArray];
|
|
1124
1119
|
let result = [];
|
|
1125
1120
|
for (let i = 0; i < array.length; ++i) {
|
|
1126
1121
|
let item = array[i];
|
|
@@ -1134,7 +1129,7 @@ class URLSearchParamsP {
|
|
|
1134
1129
|
const [name, value] = args;
|
|
1135
1130
|
checkArgsFn$2(args, 1, "has");
|
|
1136
1131
|
let _name = "" + name;
|
|
1137
|
-
let array = this[state$
|
|
1132
|
+
let array = this[state$d][_urlspArray];
|
|
1138
1133
|
for (let i = 0; i < array.length; ++i) {
|
|
1139
1134
|
let item = array[i];
|
|
1140
1135
|
if (item[0] === _name) {
|
|
@@ -1156,7 +1151,7 @@ class URLSearchParamsP {
|
|
|
1156
1151
|
let _name = "" + name;
|
|
1157
1152
|
let _value = normalizeValue$1(value);
|
|
1158
1153
|
let index = -1;
|
|
1159
|
-
let array = this[state$
|
|
1154
|
+
let array = this[state$d][_urlspArray];
|
|
1160
1155
|
let result = [];
|
|
1161
1156
|
for (let i = 0; i < array.length; ++i) {
|
|
1162
1157
|
let item = array[i];
|
|
@@ -1172,10 +1167,10 @@ class URLSearchParamsP {
|
|
|
1172
1167
|
if (index === -1) {
|
|
1173
1168
|
result.push([_name, _value]);
|
|
1174
1169
|
}
|
|
1175
|
-
this[state$
|
|
1170
|
+
this[state$d][_urlspArray] = result;
|
|
1176
1171
|
}
|
|
1177
1172
|
sort() {
|
|
1178
|
-
this[state$
|
|
1173
|
+
this[state$d][_urlspArray].sort((a, b) => a[0] < b[0] ? -1 : a[0] > b[0] ? 1 : 0);
|
|
1179
1174
|
}
|
|
1180
1175
|
forEach(...args) {
|
|
1181
1176
|
const [callbackfn, thisArg] = args;
|
|
@@ -1183,26 +1178,26 @@ class URLSearchParamsP {
|
|
|
1183
1178
|
if (typeof callbackfn !== "function") {
|
|
1184
1179
|
throw new TypeError("Failed to execute 'forEach' on 'URLSearchParams': parameter 1 is not of type 'Function'.");
|
|
1185
1180
|
}
|
|
1186
|
-
let array = this[state$
|
|
1181
|
+
let array = this[state$d][_urlspArray];
|
|
1187
1182
|
for (let i = 0; i < array.length; ++i) {
|
|
1188
1183
|
let item = array[i];
|
|
1189
1184
|
callbackfn.call(thisArg, item[1], item[0], this);
|
|
1190
1185
|
}
|
|
1191
1186
|
}
|
|
1192
1187
|
entries() {
|
|
1193
|
-
return this[state$
|
|
1188
|
+
return this[state$d][_urlspArray].map(x => [x[0], x[1]]).values();
|
|
1194
1189
|
}
|
|
1195
1190
|
keys() {
|
|
1196
|
-
return this[state$
|
|
1191
|
+
return this[state$d][_urlspArray].map(x => x[0]).values();
|
|
1197
1192
|
}
|
|
1198
1193
|
values() {
|
|
1199
|
-
return this[state$
|
|
1194
|
+
return this[state$d][_urlspArray].map(x => x[1]).values();
|
|
1200
1195
|
}
|
|
1201
1196
|
[Symbol.iterator]() {
|
|
1202
1197
|
return this.entries();
|
|
1203
1198
|
}
|
|
1204
1199
|
toString() {
|
|
1205
|
-
let array = this[state$
|
|
1200
|
+
let array = this[state$d][_urlspArray];
|
|
1206
1201
|
let result = [];
|
|
1207
1202
|
for (let i = 0; i < array.length; ++i) {
|
|
1208
1203
|
let item = array[i];
|
|
@@ -1219,10 +1214,10 @@ const _urlspArray = Symbol();
|
|
|
1219
1214
|
/** @internal */
|
|
1220
1215
|
class URLSearchParamsState {
|
|
1221
1216
|
constructor() {
|
|
1222
|
-
this[_a$
|
|
1217
|
+
this[_a$7] = [];
|
|
1223
1218
|
}
|
|
1224
1219
|
}
|
|
1225
|
-
_a$
|
|
1220
|
+
_a$7 = _urlspArray;
|
|
1226
1221
|
function normalizeValue$1(value) {
|
|
1227
1222
|
return typeof value === "string" ? value : (value !== null && value !== undefined && typeof value.toString === "function"
|
|
1228
1223
|
? value.toString()
|
|
@@ -1247,8 +1242,8 @@ function decode(str) {
|
|
|
1247
1242
|
}
|
|
1248
1243
|
const URLSearchParamsE = g["URLSearchParams"] || URLSearchParamsP;
|
|
1249
1244
|
|
|
1250
|
-
var _a$
|
|
1251
|
-
/** @internal */ const state$
|
|
1245
|
+
var _a$6;
|
|
1246
|
+
/** @internal */ const state$c = Symbol( /* "FormDataState" */);
|
|
1252
1247
|
const checkArgsFn$1 = (args, required, funcName) => { checkArgsLength(args, required, "FormData", funcName); };
|
|
1253
1248
|
class FormDataP {
|
|
1254
1249
|
constructor(form, submitter) {
|
|
@@ -1262,19 +1257,19 @@ class FormDataP {
|
|
|
1262
1257
|
console.error("TypeError: Failed to construct 'FormData': parameter 1 and parameter 2 not implemented.");
|
|
1263
1258
|
}
|
|
1264
1259
|
}
|
|
1265
|
-
this[state$
|
|
1260
|
+
this[state$c] = new FormDataState();
|
|
1266
1261
|
}
|
|
1267
1262
|
append(...args) {
|
|
1268
1263
|
const [name, value, filename] = args;
|
|
1269
1264
|
checkArgsFn$1(args, 2, "append");
|
|
1270
|
-
this[state$
|
|
1265
|
+
this[state$c][_formData].push(normalizeArgs(name, value, filename));
|
|
1271
1266
|
}
|
|
1272
1267
|
delete(...args) {
|
|
1273
1268
|
const [name] = args;
|
|
1274
1269
|
checkArgsFn$1(args, 1, "delete");
|
|
1275
1270
|
let _name = "" + name;
|
|
1276
1271
|
let index = -1;
|
|
1277
|
-
let array = this[state$
|
|
1272
|
+
let array = this[state$c][_formData];
|
|
1278
1273
|
let result = [];
|
|
1279
1274
|
for (let i = 0; i < array.length; ++i) {
|
|
1280
1275
|
let item = array[i];
|
|
@@ -1285,14 +1280,14 @@ class FormDataP {
|
|
|
1285
1280
|
result.push(item);
|
|
1286
1281
|
}
|
|
1287
1282
|
if (index > -1) {
|
|
1288
|
-
this[state$
|
|
1283
|
+
this[state$c][_formData] = result;
|
|
1289
1284
|
}
|
|
1290
1285
|
}
|
|
1291
1286
|
get(...args) {
|
|
1292
1287
|
const [name] = args;
|
|
1293
1288
|
checkArgsFn$1(args, 1, "get");
|
|
1294
1289
|
let _name = "" + name;
|
|
1295
|
-
let array = this[state$
|
|
1290
|
+
let array = this[state$c][_formData];
|
|
1296
1291
|
for (let i = 0; i < array.length; ++i) {
|
|
1297
1292
|
let item = array[i];
|
|
1298
1293
|
if (item[0] === _name) {
|
|
@@ -1305,7 +1300,7 @@ class FormDataP {
|
|
|
1305
1300
|
const [name] = args;
|
|
1306
1301
|
checkArgsFn$1(args, 1, "getAll");
|
|
1307
1302
|
let _name = "" + name;
|
|
1308
|
-
let array = this[state$
|
|
1303
|
+
let array = this[state$c][_formData];
|
|
1309
1304
|
let result = [];
|
|
1310
1305
|
for (let i = 0; i < array.length; ++i) {
|
|
1311
1306
|
let item = array[i];
|
|
@@ -1319,7 +1314,7 @@ class FormDataP {
|
|
|
1319
1314
|
const [name] = args;
|
|
1320
1315
|
checkArgsFn$1(args, 1, "has");
|
|
1321
1316
|
let _name = "" + name;
|
|
1322
|
-
let array = this[state$
|
|
1317
|
+
let array = this[state$c][_formData];
|
|
1323
1318
|
for (let i = 0; i < array.length; ++i) {
|
|
1324
1319
|
let item = array[i];
|
|
1325
1320
|
if (item[0] === _name) {
|
|
@@ -1334,7 +1329,7 @@ class FormDataP {
|
|
|
1334
1329
|
let _name = "" + name;
|
|
1335
1330
|
let _args = normalizeArgs(name, value, filename);
|
|
1336
1331
|
let index = -1;
|
|
1337
|
-
let array = this[state$
|
|
1332
|
+
let array = this[state$c][_formData];
|
|
1338
1333
|
let result = [];
|
|
1339
1334
|
for (let i = 0; i < array.length; ++i) {
|
|
1340
1335
|
let item = array[i];
|
|
@@ -1350,7 +1345,7 @@ class FormDataP {
|
|
|
1350
1345
|
if (index === -1) {
|
|
1351
1346
|
result.push(_args);
|
|
1352
1347
|
}
|
|
1353
|
-
this[state$
|
|
1348
|
+
this[state$c][_formData] = result;
|
|
1354
1349
|
}
|
|
1355
1350
|
forEach(...args) {
|
|
1356
1351
|
const [callbackfn, thisArg] = args;
|
|
@@ -1358,20 +1353,20 @@ class FormDataP {
|
|
|
1358
1353
|
if (typeof callbackfn !== "function") {
|
|
1359
1354
|
throw new TypeError("Failed to execute 'forEach' on 'FormData': parameter 1 is not of type 'Function'.");
|
|
1360
1355
|
}
|
|
1361
|
-
let array = this[state$
|
|
1356
|
+
let array = this[state$c][_formData];
|
|
1362
1357
|
for (let i = 0; i < array.length; ++i) {
|
|
1363
1358
|
let item = array[i];
|
|
1364
1359
|
callbackfn.call(thisArg, item[1], item[0], thisArg);
|
|
1365
1360
|
}
|
|
1366
1361
|
}
|
|
1367
1362
|
entries() {
|
|
1368
|
-
return this[state$
|
|
1363
|
+
return this[state$c][_formData].map(x => [x[0], x[1]]).values();
|
|
1369
1364
|
}
|
|
1370
1365
|
keys() {
|
|
1371
|
-
return this[state$
|
|
1366
|
+
return this[state$c][_formData].map(x => x[0]).values();
|
|
1372
1367
|
}
|
|
1373
1368
|
values() {
|
|
1374
|
-
return this[state$
|
|
1369
|
+
return this[state$c][_formData].map(x => x[1]).values();
|
|
1375
1370
|
}
|
|
1376
1371
|
[Symbol.iterator]() {
|
|
1377
1372
|
return this.entries();
|
|
@@ -1385,17 +1380,17 @@ const _formData = Symbol();
|
|
|
1385
1380
|
/** @internal */
|
|
1386
1381
|
class FormDataState {
|
|
1387
1382
|
constructor() {
|
|
1388
|
-
this[_a$
|
|
1383
|
+
this[_a$6] = [];
|
|
1389
1384
|
}
|
|
1390
1385
|
}
|
|
1391
|
-
_a$
|
|
1386
|
+
_a$6 = _formData;
|
|
1392
1387
|
/** @internal */
|
|
1393
1388
|
function FormData_toBlob(formData) {
|
|
1394
1389
|
const boundary = "----formdata-mphttpx-" + Math.random();
|
|
1395
1390
|
const p = `--${boundary}\r\nContent-Disposition: form-data; name="`;
|
|
1396
1391
|
let chunks = [];
|
|
1397
|
-
for (let i = 0; i < formData[state$
|
|
1398
|
-
let pair = formData[state$
|
|
1392
|
+
for (let i = 0; i < formData[state$c][_formData].length; ++i) {
|
|
1393
|
+
let pair = formData[state$c][_formData][i];
|
|
1399
1394
|
let name = pair[0];
|
|
1400
1395
|
let value = pair[1];
|
|
1401
1396
|
if (typeof value === "string") {
|
|
@@ -1485,12 +1480,12 @@ function createFormDataFromBinaryText(text, boundary) {
|
|
|
1485
1480
|
}
|
|
1486
1481
|
const FormDataE = g["FormData"] || FormDataP;
|
|
1487
1482
|
|
|
1488
|
-
var _a$
|
|
1489
|
-
/** @internal */ const state$
|
|
1483
|
+
var _a$5, _b$2;
|
|
1484
|
+
/** @internal */ const state$b = Symbol( /* "HeadersState" */);
|
|
1490
1485
|
const checkArgsFn = (args, required, funcName) => { checkArgsLength(args, required, "Headers", funcName); };
|
|
1491
1486
|
class HeadersP {
|
|
1492
1487
|
constructor(init) {
|
|
1493
|
-
this[state$
|
|
1488
|
+
this[state$b] = new HeadersState();
|
|
1494
1489
|
if (init !== undefined) {
|
|
1495
1490
|
if (isObjectType("Headers", init)) {
|
|
1496
1491
|
init.forEach((value, name) => { this.append(name, value); }, this);
|
|
@@ -1521,15 +1516,15 @@ class HeadersP {
|
|
|
1521
1516
|
}
|
|
1522
1517
|
}
|
|
1523
1518
|
}
|
|
1524
|
-
this[state$
|
|
1519
|
+
this[state$b][_initialized] = true;
|
|
1525
1520
|
}
|
|
1526
1521
|
append(...args) {
|
|
1527
1522
|
const [name, value] = args;
|
|
1528
1523
|
checkArgsFn(args, 2, "append");
|
|
1529
|
-
let _name = normalizeName(name, throwsFn(this[state$
|
|
1524
|
+
let _name = normalizeName(name, throwsFn(this[state$b][_initialized] ? "append" : ""));
|
|
1530
1525
|
let _value = normalizeValue(value);
|
|
1531
1526
|
let index = -1;
|
|
1532
|
-
let array = this[state$
|
|
1527
|
+
let array = this[state$b][_headersArray];
|
|
1533
1528
|
for (let i = 0; i < array.length; ++i) {
|
|
1534
1529
|
let item = array[i];
|
|
1535
1530
|
if (item[0] === _name) {
|
|
@@ -1547,7 +1542,7 @@ class HeadersP {
|
|
|
1547
1542
|
checkArgsFn(args, 1, "delete");
|
|
1548
1543
|
let _name = normalizeName(name, throwsFn("delete"));
|
|
1549
1544
|
let index = -1;
|
|
1550
|
-
let array = this[state$
|
|
1545
|
+
let array = this[state$b][_headersArray];
|
|
1551
1546
|
let result = [];
|
|
1552
1547
|
for (let i = 0; i < array.length; ++i) {
|
|
1553
1548
|
let item = array[i];
|
|
@@ -1558,14 +1553,14 @@ class HeadersP {
|
|
|
1558
1553
|
result.push(item);
|
|
1559
1554
|
}
|
|
1560
1555
|
if (index > -1) {
|
|
1561
|
-
this[state$
|
|
1556
|
+
this[state$b][_headersArray] = result;
|
|
1562
1557
|
}
|
|
1563
1558
|
}
|
|
1564
1559
|
get(...args) {
|
|
1565
1560
|
const [name] = args;
|
|
1566
1561
|
checkArgsFn(args, 1, "get");
|
|
1567
1562
|
let _name = normalizeName(name, throwsFn("get"));
|
|
1568
|
-
let array = this[state$
|
|
1563
|
+
let array = this[state$b][_headersArray];
|
|
1569
1564
|
for (let i = 0; i < array.length; ++i) {
|
|
1570
1565
|
let item = array[i];
|
|
1571
1566
|
if (item[0] === _name) {
|
|
@@ -1582,7 +1577,7 @@ class HeadersP {
|
|
|
1582
1577
|
const [name] = args;
|
|
1583
1578
|
checkArgsFn(args, 1, "has");
|
|
1584
1579
|
let _name = normalizeName(name, throwsFn("has"));
|
|
1585
|
-
let array = this[state$
|
|
1580
|
+
let array = this[state$b][_headersArray];
|
|
1586
1581
|
for (let i = 0; i < array.length; ++i) {
|
|
1587
1582
|
let item = array[i];
|
|
1588
1583
|
if (item[0] === _name) {
|
|
@@ -1597,7 +1592,7 @@ class HeadersP {
|
|
|
1597
1592
|
let _name = normalizeName(name, throwsFn("set"));
|
|
1598
1593
|
let _value = normalizeValue(value);
|
|
1599
1594
|
let index = -1;
|
|
1600
|
-
let array = this[state$
|
|
1595
|
+
let array = this[state$b][_headersArray];
|
|
1601
1596
|
for (let i = 0; i < array.length; ++i) {
|
|
1602
1597
|
let item = array[i];
|
|
1603
1598
|
if (item[0] === _name) {
|
|
@@ -1616,20 +1611,20 @@ class HeadersP {
|
|
|
1616
1611
|
if (typeof callbackfn !== "function") {
|
|
1617
1612
|
throw new TypeError("Failed to execute 'forEach' on 'Headers': parameter 1 is not of type 'Function'.");
|
|
1618
1613
|
}
|
|
1619
|
-
let array = this[state$
|
|
1614
|
+
let array = this[state$b][_headersArray];
|
|
1620
1615
|
for (let i = 0; i < array.length; ++i) {
|
|
1621
1616
|
let item = array[i];
|
|
1622
1617
|
callbackfn.call(thisArg, item[1], item[0], this);
|
|
1623
1618
|
}
|
|
1624
1619
|
}
|
|
1625
1620
|
entries() {
|
|
1626
|
-
return this[state$
|
|
1621
|
+
return this[state$b][_headersArray].map(x => [x[0], x[1]]).values();
|
|
1627
1622
|
}
|
|
1628
1623
|
keys() {
|
|
1629
|
-
return this[state$
|
|
1624
|
+
return this[state$b][_headersArray].map(x => x[0]).values();
|
|
1630
1625
|
}
|
|
1631
1626
|
values() {
|
|
1632
|
-
return this[state$
|
|
1627
|
+
return this[state$b][_headersArray].map(x => x[1]).values();
|
|
1633
1628
|
}
|
|
1634
1629
|
[Symbol.iterator]() {
|
|
1635
1630
|
return this.entries();
|
|
@@ -1643,11 +1638,11 @@ Class_setStringTag(HeadersP, "Headers");
|
|
|
1643
1638
|
/** @internal */
|
|
1644
1639
|
class HeadersState {
|
|
1645
1640
|
constructor() {
|
|
1646
|
-
this[_a$
|
|
1647
|
-
this[_b$
|
|
1641
|
+
this[_a$5] = false;
|
|
1642
|
+
this[_b$2] = [];
|
|
1648
1643
|
}
|
|
1649
1644
|
}
|
|
1650
|
-
_a$
|
|
1645
|
+
_a$5 = _initialized, _b$2 = _headersArray;
|
|
1651
1646
|
function throwsFn(kind) {
|
|
1652
1647
|
return () => {
|
|
1653
1648
|
throw new TypeError(`Failed to ${kind ? ("execute '" + kind + "' on") : "construct"} 'Headers': Invalid name`);
|
|
@@ -1691,23 +1686,23 @@ function parseHeaders(rawHeaders) {
|
|
|
1691
1686
|
}
|
|
1692
1687
|
const HeadersE = g["Headers"] || HeadersP;
|
|
1693
1688
|
|
|
1694
|
-
var _a$
|
|
1695
|
-
/** @internal */ const state$
|
|
1689
|
+
var _a$4;
|
|
1690
|
+
/** @internal */ const state$a = Symbol( /* "BodyState" */);
|
|
1696
1691
|
class BodyImpl {
|
|
1697
1692
|
/** @internal */
|
|
1698
1693
|
constructor() {
|
|
1699
1694
|
if (new.target === BodyImpl) {
|
|
1700
1695
|
throw new TypeError("Failed to construct 'Body': Illegal constructor");
|
|
1701
1696
|
}
|
|
1702
|
-
this[state$
|
|
1697
|
+
this[state$a] = new BodyState();
|
|
1703
1698
|
}
|
|
1704
1699
|
get body() {
|
|
1705
|
-
if (!this[state$
|
|
1700
|
+
if (!this[state$a][_body]) {
|
|
1706
1701
|
return null;
|
|
1707
1702
|
}
|
|
1708
|
-
throw new TypeError(`Failed to access 'body' on '${this[state$
|
|
1703
|
+
throw new TypeError(`Failed to access 'body' on '${this[state$a].name}': property not implemented.`);
|
|
1709
1704
|
}
|
|
1710
|
-
get bodyUsed() { return this[state$
|
|
1705
|
+
get bodyUsed() { return this[state$a].bodyUsed; }
|
|
1711
1706
|
;
|
|
1712
1707
|
arrayBuffer() {
|
|
1713
1708
|
const kind = "arrayBuffer";
|
|
@@ -1744,23 +1739,23 @@ class BodyState {
|
|
|
1744
1739
|
constructor() {
|
|
1745
1740
|
this.name = "Body";
|
|
1746
1741
|
this.bodyUsed = false;
|
|
1747
|
-
this[_a$
|
|
1742
|
+
this[_a$4] = "";
|
|
1748
1743
|
}
|
|
1749
1744
|
}
|
|
1750
|
-
_a$
|
|
1745
|
+
_a$4 = _body;
|
|
1751
1746
|
/** @internal */
|
|
1752
1747
|
function Body_init(body, payload) {
|
|
1753
1748
|
const b = body;
|
|
1754
1749
|
if (isObjectType("ReadableStream", payload)) {
|
|
1755
|
-
throw new TypeError(`Failed to construct '${b[state$
|
|
1750
|
+
throw new TypeError(`Failed to construct '${b[state$a].name}': ReadableStream not implemented.`);
|
|
1756
1751
|
}
|
|
1757
|
-
b[state$
|
|
1752
|
+
b[state$a][_body] = convert(payload, true, type => { if (!b.headers.has("Content-Type")) {
|
|
1758
1753
|
b.headers.set("Content-Type", type);
|
|
1759
1754
|
} });
|
|
1760
1755
|
}
|
|
1761
1756
|
/** @internal */
|
|
1762
1757
|
function Body_toPayload(body) {
|
|
1763
|
-
return body[state$
|
|
1758
|
+
return body[state$a][_body];
|
|
1764
1759
|
}
|
|
1765
1760
|
function read(body, kind) {
|
|
1766
1761
|
return new Promise((resolve, reject) => {
|
|
@@ -1773,7 +1768,7 @@ function read(body, kind) {
|
|
|
1773
1768
|
});
|
|
1774
1769
|
}
|
|
1775
1770
|
function readSync(body, kind) {
|
|
1776
|
-
const payload = body[state$
|
|
1771
|
+
const payload = body[state$a][_body];
|
|
1777
1772
|
if (kind === "arrayBuffer") {
|
|
1778
1773
|
return convertBack("arraybuffer", payload);
|
|
1779
1774
|
}
|
|
@@ -1810,7 +1805,7 @@ function readSync(body, kind) {
|
|
|
1810
1805
|
}
|
|
1811
1806
|
}
|
|
1812
1807
|
function consumed(body, kind) {
|
|
1813
|
-
const s = body[state$
|
|
1808
|
+
const s = body[state$a];
|
|
1814
1809
|
if (!s[_body])
|
|
1815
1810
|
return;
|
|
1816
1811
|
if (s.bodyUsed) {
|
|
@@ -1890,9 +1885,9 @@ function convertBack(type, data) {
|
|
|
1890
1885
|
}
|
|
1891
1886
|
}
|
|
1892
1887
|
|
|
1893
|
-
var _a$
|
|
1888
|
+
var _a$3;
|
|
1894
1889
|
/** @internal */
|
|
1895
|
-
const state$
|
|
1890
|
+
const state$9 = Symbol( /* "AbortSignalState" */);
|
|
1896
1891
|
class AbortSignalP extends EventTargetP {
|
|
1897
1892
|
static abort(reason) {
|
|
1898
1893
|
let signal = createAbortSignal();
|
|
@@ -1949,40 +1944,40 @@ class AbortSignalP extends EventTargetP {
|
|
|
1949
1944
|
throw new TypeError("Failed to construct 'AbortSignal': Illegal constructor");
|
|
1950
1945
|
}
|
|
1951
1946
|
super();
|
|
1952
|
-
this[state$
|
|
1947
|
+
this[state$9] = new AbortSignalState(this);
|
|
1953
1948
|
}
|
|
1954
|
-
get aborted() { return this[state$
|
|
1955
|
-
get reason() { return this[state$
|
|
1949
|
+
get aborted() { return this[state$9].aborted; }
|
|
1950
|
+
get reason() { return this[state$9].reason; }
|
|
1956
1951
|
throwIfAborted() {
|
|
1957
1952
|
if (this.aborted) {
|
|
1958
1953
|
throw this.reason;
|
|
1959
1954
|
}
|
|
1960
1955
|
}
|
|
1961
|
-
get onabort() { return this[state$
|
|
1956
|
+
get onabort() { return this[state$9].onabort; }
|
|
1962
1957
|
set onabort(value) {
|
|
1963
|
-
this[state$
|
|
1964
|
-
attachFn(this, "abort", value, this[state$
|
|
1958
|
+
this[state$9].onabort = value;
|
|
1959
|
+
attachFn(this, "abort", value, this[state$9][_handlers$3].onabort);
|
|
1965
1960
|
}
|
|
1966
1961
|
/** @internal */ toString() { return "[object AbortSignal]"; }
|
|
1967
1962
|
/** @internal */ get isPolyfill() { return { symbol: polyfill, hierarchy: ["AbortSignal", "EventTarget"] }; }
|
|
1968
1963
|
}
|
|
1969
1964
|
Class_setStringTag(AbortSignalP, "AbortSignal");
|
|
1970
1965
|
/** @internal */
|
|
1971
|
-
const _handlers$
|
|
1966
|
+
const _handlers$3 = Symbol();
|
|
1972
1967
|
/** @internal */
|
|
1973
1968
|
class AbortSignalState {
|
|
1974
1969
|
constructor(target) {
|
|
1975
1970
|
this.aborted = false;
|
|
1976
1971
|
this.reason = undefined;
|
|
1977
|
-
this[_a$
|
|
1972
|
+
this[_a$3] = getHandlers$3(this);
|
|
1978
1973
|
this.onabort = null;
|
|
1979
1974
|
this.target = target;
|
|
1980
1975
|
}
|
|
1981
1976
|
}
|
|
1982
|
-
_a$
|
|
1977
|
+
_a$3 = _handlers$3;
|
|
1983
1978
|
/** @internal */
|
|
1984
1979
|
function AbortSignal_abort(signal, reason, notify = true, isTrusted = true) {
|
|
1985
|
-
const s = signal[state$
|
|
1980
|
+
const s = signal[state$9];
|
|
1986
1981
|
if (!s.aborted) {
|
|
1987
1982
|
s.aborted = true;
|
|
1988
1983
|
s.reason = reason !== null && reason !== void 0 ? reason : (new MPException("signal is aborted without reason", "AbortError"));
|
|
@@ -1992,7 +1987,7 @@ function AbortSignal_abort(signal, reason, notify = true, isTrusted = true) {
|
|
|
1992
1987
|
}
|
|
1993
1988
|
}
|
|
1994
1989
|
}
|
|
1995
|
-
function getHandlers$
|
|
1990
|
+
function getHandlers$3(s) {
|
|
1996
1991
|
return {
|
|
1997
1992
|
onabort: (ev) => { executeFn(s.target, s.onabort, ev); },
|
|
1998
1993
|
};
|
|
@@ -2000,21 +1995,21 @@ function getHandlers$2(s) {
|
|
|
2000
1995
|
/** @internal */
|
|
2001
1996
|
function createAbortSignal() {
|
|
2002
1997
|
let signal = Object.create(AbortSignalP.prototype);
|
|
2003
|
-
signal[state$
|
|
2004
|
-
signal[state$
|
|
1998
|
+
signal[state$g] = new EventTargetState(signal);
|
|
1999
|
+
signal[state$9] = new AbortSignalState(signal);
|
|
2005
2000
|
return signal;
|
|
2006
2001
|
}
|
|
2007
2002
|
const AbortSignalE = g["AbortSignal"] || AbortSignalP;
|
|
2008
2003
|
|
|
2009
2004
|
/** @internal */
|
|
2010
|
-
const state$
|
|
2005
|
+
const state$8 = Symbol( /* "AbortControllerState" */);
|
|
2011
2006
|
class AbortControllerP {
|
|
2012
2007
|
constructor() {
|
|
2013
|
-
this[state$
|
|
2008
|
+
this[state$8] = new AbortControllerState();
|
|
2014
2009
|
}
|
|
2015
|
-
get signal() { return this[state$
|
|
2010
|
+
get signal() { return this[state$8].signal; }
|
|
2016
2011
|
abort(reason) {
|
|
2017
|
-
AbortSignal_abort(this[state$
|
|
2012
|
+
AbortSignal_abort(this[state$8].signal, reason);
|
|
2018
2013
|
}
|
|
2019
2014
|
/** @internal */ toString() { return "[object AbortController]"; }
|
|
2020
2015
|
/** @internal */ get isPolyfill() { return { symbol: polyfill, hierarchy: ["AbortController"] }; }
|
|
@@ -2028,15 +2023,15 @@ class AbortControllerState {
|
|
|
2028
2023
|
}
|
|
2029
2024
|
const AbortControllerE = g["AbortController"] || AbortControllerP;
|
|
2030
2025
|
|
|
2031
|
-
/** @internal */ const state$
|
|
2026
|
+
/** @internal */ const state$7 = Symbol( /* "RequestState" */);
|
|
2032
2027
|
class RequestP extends BodyImpl {
|
|
2033
2028
|
constructor(...args) {
|
|
2034
2029
|
const [input, init] = args;
|
|
2035
2030
|
checkArgsLength(args, 1, "Request");
|
|
2036
2031
|
super();
|
|
2037
|
-
this[state$
|
|
2038
|
-
this[state$
|
|
2039
|
-
const s = this[state$
|
|
2032
|
+
this[state$a].name = "Request";
|
|
2033
|
+
this[state$7] = new RequestState();
|
|
2034
|
+
const s = this[state$7];
|
|
2040
2035
|
let _init = init !== null && init !== void 0 ? init : {};
|
|
2041
2036
|
if (typeof _init !== "object") {
|
|
2042
2037
|
throw new TypeError("Failed to construct 'Request': The provided value is not of type 'RequestInit'.");
|
|
@@ -2053,7 +2048,7 @@ class RequestP extends BodyImpl {
|
|
|
2053
2048
|
}
|
|
2054
2049
|
s.method = input.method;
|
|
2055
2050
|
s.mode = input.mode;
|
|
2056
|
-
let inputSignal = input[state$
|
|
2051
|
+
let inputSignal = input[state$7].signal;
|
|
2057
2052
|
if (inputSignal) {
|
|
2058
2053
|
s.signal = inputSignal;
|
|
2059
2054
|
}
|
|
@@ -2061,7 +2056,7 @@ class RequestP extends BodyImpl {
|
|
|
2061
2056
|
let payload = Body_toPayload(input);
|
|
2062
2057
|
if (!body && payload !== "") {
|
|
2063
2058
|
body = payload;
|
|
2064
|
-
input[state$
|
|
2059
|
+
input[state$a].bodyUsed = true;
|
|
2065
2060
|
}
|
|
2066
2061
|
}
|
|
2067
2062
|
else {
|
|
@@ -2105,31 +2100,31 @@ class RequestP extends BodyImpl {
|
|
|
2105
2100
|
}
|
|
2106
2101
|
}
|
|
2107
2102
|
}
|
|
2108
|
-
get cache() { return this[state$
|
|
2109
|
-
get credentials() { return this[state$
|
|
2110
|
-
get destination() { return this[state$
|
|
2103
|
+
get cache() { return this[state$7].cache; }
|
|
2104
|
+
get credentials() { return this[state$7].credentials; }
|
|
2105
|
+
get destination() { return this[state$7].destination; }
|
|
2111
2106
|
get headers() {
|
|
2112
|
-
const s = this[state$
|
|
2107
|
+
const s = this[state$7];
|
|
2113
2108
|
if (!s.headers) {
|
|
2114
2109
|
s.headers = new HeadersP();
|
|
2115
2110
|
}
|
|
2116
2111
|
return s.headers;
|
|
2117
2112
|
}
|
|
2118
|
-
get integrity() { return this[state$
|
|
2119
|
-
get keepalive() { return this[state$
|
|
2120
|
-
get method() { return this[state$
|
|
2121
|
-
get mode() { return this[state$
|
|
2122
|
-
get redirect() { return this[state$
|
|
2123
|
-
get referrer() { return this[state$
|
|
2124
|
-
get referrerPolicy() { return this[state$
|
|
2113
|
+
get integrity() { return this[state$7].integrity; }
|
|
2114
|
+
get keepalive() { return this[state$7].keepalive; }
|
|
2115
|
+
get method() { return this[state$7].method; }
|
|
2116
|
+
get mode() { return this[state$7].mode; }
|
|
2117
|
+
get redirect() { return this[state$7].redirect; }
|
|
2118
|
+
get referrer() { return this[state$7].referrer; }
|
|
2119
|
+
get referrerPolicy() { return this[state$7].referrerPolicy; }
|
|
2125
2120
|
get signal() {
|
|
2126
|
-
const s = this[state$
|
|
2121
|
+
const s = this[state$7];
|
|
2127
2122
|
if (!s.signal) {
|
|
2128
2123
|
s.signal = (new AbortControllerP()).signal;
|
|
2129
2124
|
}
|
|
2130
2125
|
return s.signal;
|
|
2131
2126
|
}
|
|
2132
|
-
get url() { return this[state$
|
|
2127
|
+
get url() { return this[state$7].url; }
|
|
2133
2128
|
clone() {
|
|
2134
2129
|
var _a;
|
|
2135
2130
|
if (this.bodyUsed) {
|
|
@@ -2168,7 +2163,7 @@ const RequestE = g["Request"] || RequestP;
|
|
|
2168
2163
|
|
|
2169
2164
|
// @ts-nocheck
|
|
2170
2165
|
/** @internal */
|
|
2171
|
-
const mp$
|
|
2166
|
+
const mp$3 = (() => {
|
|
2172
2167
|
let u = "undefined", r = "request", f = "function";
|
|
2173
2168
|
let mp;
|
|
2174
2169
|
mp =
|
|
@@ -2193,7 +2188,7 @@ const mp$2 = (() => {
|
|
|
2193
2188
|
return mp;
|
|
2194
2189
|
})();
|
|
2195
2190
|
|
|
2196
|
-
const request = mp$
|
|
2191
|
+
const request = mp$3 ? mp$3.request : function errorRequest(options) {
|
|
2197
2192
|
const errMsg = "NOT_SUPPORTED_ERR";
|
|
2198
2193
|
const errno = 9;
|
|
2199
2194
|
const err = {
|
|
@@ -2220,8 +2215,8 @@ const request = mp$2 ? mp$2.request : function errorRequest(options) {
|
|
|
2220
2215
|
throw new ReferenceError("request is not defined");
|
|
2221
2216
|
};
|
|
2222
2217
|
|
|
2223
|
-
var _a$
|
|
2224
|
-
/** @internal */ const state$
|
|
2218
|
+
var _a$2;
|
|
2219
|
+
/** @internal */ const state$6 = Symbol( /* "XMLHttpRequestEventTargetState" */);
|
|
2225
2220
|
class XMLHttpRequestEventTargetP extends EventTargetP {
|
|
2226
2221
|
/** @internal */
|
|
2227
2222
|
constructor() {
|
|
@@ -2229,35 +2224,35 @@ class XMLHttpRequestEventTargetP extends EventTargetP {
|
|
|
2229
2224
|
throw new TypeError("Failed to construct 'XMLHttpRequestEventTarget': Illegal constructor");
|
|
2230
2225
|
}
|
|
2231
2226
|
super();
|
|
2232
|
-
this[state$
|
|
2233
|
-
}
|
|
2234
|
-
get onabort() { return this[state$
|
|
2235
|
-
set onabort(value) { this[state$
|
|
2236
|
-
get onerror() { return this[state$
|
|
2237
|
-
set onerror(value) { this[state$
|
|
2238
|
-
get onload() { return this[state$
|
|
2239
|
-
set onload(value) { this[state$
|
|
2240
|
-
get onloadend() { return this[state$
|
|
2241
|
-
set onloadend(value) { this[state$
|
|
2242
|
-
get onloadstart() { return this[state$
|
|
2243
|
-
set onloadstart(value) { this[state$
|
|
2244
|
-
get onprogress() { return this[state$
|
|
2245
|
-
set onprogress(value) { this[state$
|
|
2246
|
-
get ontimeout() { return this[state$
|
|
2247
|
-
set ontimeout(value) { this[state$
|
|
2227
|
+
this[state$6] = new XMLHttpRequestEventTargetState(this);
|
|
2228
|
+
}
|
|
2229
|
+
get onabort() { return this[state$6].onabort; }
|
|
2230
|
+
set onabort(value) { this[state$6].onabort = value; attach$1(this, "abort"); }
|
|
2231
|
+
get onerror() { return this[state$6].onerror; }
|
|
2232
|
+
set onerror(value) { this[state$6].onerror = value; attach$1(this, "error"); }
|
|
2233
|
+
get onload() { return this[state$6].onload; }
|
|
2234
|
+
set onload(value) { this[state$6].onload = value; attach$1(this, "load"); }
|
|
2235
|
+
get onloadend() { return this[state$6].onloadend; }
|
|
2236
|
+
set onloadend(value) { this[state$6].onloadend = value; attach$1(this, "loadend"); }
|
|
2237
|
+
get onloadstart() { return this[state$6].onloadstart; }
|
|
2238
|
+
set onloadstart(value) { this[state$6].onloadstart = value; attach$1(this, "loadstart"); }
|
|
2239
|
+
get onprogress() { return this[state$6].onprogress; }
|
|
2240
|
+
set onprogress(value) { this[state$6].onprogress = value; attach$1(this, "progress"); }
|
|
2241
|
+
get ontimeout() { return this[state$6].ontimeout; }
|
|
2242
|
+
set ontimeout(value) { this[state$6].ontimeout = value; attach$1(this, "timeout"); }
|
|
2248
2243
|
/** @internal */ toString() { return "[object XMLHttpRequestEventTarget]"; }
|
|
2249
2244
|
/** @internal */ get isPolyfill() { return { symbol: polyfill, hierarchy: ["XMLHttpRequestEventTarget", "EventTarget"] }; }
|
|
2250
2245
|
}
|
|
2251
2246
|
Class_setStringTag(XMLHttpRequestEventTargetP, "XMLHttpRequestEventTarget");
|
|
2252
2247
|
/** @internal */
|
|
2253
|
-
const _handlers$
|
|
2248
|
+
const _handlers$2 = Symbol();
|
|
2254
2249
|
/** @internal */
|
|
2255
2250
|
class XMLHttpRequestEventTargetState {
|
|
2256
2251
|
/**
|
|
2257
2252
|
* @param _target XMLHttpRequestEventTarget
|
|
2258
2253
|
*/
|
|
2259
2254
|
constructor(_target) {
|
|
2260
|
-
this[_a$
|
|
2255
|
+
this[_a$2] = getHandlers$2(this);
|
|
2261
2256
|
this.onabort = null;
|
|
2262
2257
|
this.onerror = null;
|
|
2263
2258
|
this.onload = null;
|
|
@@ -2268,15 +2263,15 @@ class XMLHttpRequestEventTargetState {
|
|
|
2268
2263
|
this.target = _target;
|
|
2269
2264
|
}
|
|
2270
2265
|
}
|
|
2271
|
-
_a$
|
|
2272
|
-
function attach(target, type) {
|
|
2273
|
-
const s = target[state$
|
|
2266
|
+
_a$2 = _handlers$2;
|
|
2267
|
+
function attach$1(target, type) {
|
|
2268
|
+
const s = target[state$6];
|
|
2274
2269
|
const fnName = ("on" + type);
|
|
2275
2270
|
const cb = s[fnName];
|
|
2276
|
-
const listener = s[_handlers$
|
|
2271
|
+
const listener = s[_handlers$2][fnName];
|
|
2277
2272
|
attachFn(target, type, cb, listener);
|
|
2278
2273
|
}
|
|
2279
|
-
function getHandlers$
|
|
2274
|
+
function getHandlers$2(s) {
|
|
2280
2275
|
return {
|
|
2281
2276
|
onabort: (ev) => { executeFn(s.target, s.onabort, ev); },
|
|
2282
2277
|
onerror: (ev) => { executeFn(s.target, s.onerror, ev); },
|
|
@@ -2383,59 +2378,62 @@ Class_setStringTag(XMLHttpRequestUploadP, "XMLHttpRequestUpload");
|
|
|
2383
2378
|
/** @internal */
|
|
2384
2379
|
function createXMLHttpRequestUpload() {
|
|
2385
2380
|
let upload = Object.create(XMLHttpRequestUploadP.prototype);
|
|
2386
|
-
upload[state$
|
|
2387
|
-
upload[state$
|
|
2381
|
+
upload[state$g] = new EventTargetState(upload);
|
|
2382
|
+
upload[state$6] = new XMLHttpRequestEventTargetState(upload);
|
|
2388
2383
|
return upload;
|
|
2389
2384
|
}
|
|
2390
2385
|
|
|
2391
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
2392
|
-
const mp$
|
|
2393
|
-
const setRequest = (request) => { mp$
|
|
2386
|
+
var _a$1, _b$1, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
2387
|
+
const mp$2 = { request: request };
|
|
2388
|
+
const setRequest = (request) => { mp$2.request = request; };
|
|
2394
2389
|
/** @internal */
|
|
2395
|
-
const state$
|
|
2390
|
+
const state$5 = Symbol( /* "XMLHttpRequestState" */);
|
|
2396
2391
|
class XMLHttpRequestImpl extends XMLHttpRequestEventTargetP {
|
|
2397
2392
|
constructor() {
|
|
2398
2393
|
super();
|
|
2399
|
-
this[state$
|
|
2394
|
+
this[state$5] = new XMLHttpRequestState(this);
|
|
2400
2395
|
}
|
|
2401
|
-
get readyState() { return this[state$
|
|
2402
|
-
get response() { return this[state$
|
|
2396
|
+
get readyState() { return this[state$5].readyState; }
|
|
2397
|
+
get response() { return this[state$5].response; }
|
|
2403
2398
|
get responseText() { return (!this.responseType || this.responseType === "text") ? this.response : ""; }
|
|
2404
|
-
get responseType() { return this[state$
|
|
2405
|
-
set responseType(value) { this[state$
|
|
2406
|
-
get responseURL() { return this[state$
|
|
2399
|
+
get responseType() { return this[state$5].responseType; }
|
|
2400
|
+
set responseType(value) { this[state$5].responseType = normalizeResponseType(value); }
|
|
2401
|
+
get responseURL() { return this[state$5].responseURL; }
|
|
2407
2402
|
get responseXML() { return null; }
|
|
2408
|
-
get status() { return this[state$
|
|
2403
|
+
get status() { return this[state$5].status; }
|
|
2409
2404
|
get statusText() {
|
|
2410
2405
|
if (this.readyState === XMLHttpRequestImpl.UNSENT || this.readyState === XMLHttpRequestImpl.OPENED)
|
|
2411
2406
|
return "";
|
|
2412
|
-
return this[state$
|
|
2407
|
+
return this[state$5].statusText || statusTextMap(this.status);
|
|
2413
2408
|
}
|
|
2414
|
-
get timeout() { return this[state$
|
|
2415
|
-
set timeout(value) { this[state$
|
|
2409
|
+
get timeout() { return this[state$5].timeout; }
|
|
2410
|
+
set timeout(value) { this[state$5].timeout = value > 0 ? value : 0; }
|
|
2416
2411
|
get upload() {
|
|
2417
|
-
const s = this[state$
|
|
2412
|
+
const s = this[state$5];
|
|
2418
2413
|
if (!s.upload) {
|
|
2419
2414
|
s.upload = createXMLHttpRequestUpload();
|
|
2420
2415
|
}
|
|
2421
2416
|
return s.upload;
|
|
2422
2417
|
}
|
|
2423
|
-
get withCredentials() { return this[state$
|
|
2424
|
-
set withCredentials(value) { this[state$
|
|
2418
|
+
get withCredentials() { return this[state$5].withCredentials; }
|
|
2419
|
+
set withCredentials(value) { this[state$5].withCredentials = !!value; }
|
|
2425
2420
|
abort() {
|
|
2426
2421
|
clearRequest(this);
|
|
2427
2422
|
}
|
|
2428
2423
|
getAllResponseHeaders() {
|
|
2429
|
-
|
|
2424
|
+
const headers = this[state$5][_responseHeaders];
|
|
2425
|
+
if (!headers)
|
|
2430
2426
|
return "";
|
|
2431
|
-
|
|
2427
|
+
let result = [];
|
|
2428
|
+
headers.forEach((value, name) => { result.push(`${name}: ${value}\r\n`); });
|
|
2429
|
+
return result.join("");
|
|
2432
2430
|
}
|
|
2433
2431
|
getResponseHeader(...args) {
|
|
2434
2432
|
const [name] = args;
|
|
2435
2433
|
checkArgsLength(args, 1, "XMLHttpRequest", "getResponseHeader");
|
|
2436
|
-
if (!this[state$
|
|
2434
|
+
if (!this[state$5][_responseHeaders])
|
|
2437
2435
|
return null;
|
|
2438
|
-
return this[state$
|
|
2436
|
+
return this[state$5][_responseHeaders].get(name);
|
|
2439
2437
|
}
|
|
2440
2438
|
open(...args) {
|
|
2441
2439
|
const [method, url, async = true, username = null, password = null] = args;
|
|
@@ -2443,7 +2441,7 @@ class XMLHttpRequestImpl extends XMLHttpRequestEventTargetP {
|
|
|
2443
2441
|
if (!async) {
|
|
2444
2442
|
console.warn("Synchronous XMLHttpRequest is not supported because of its detrimental effects to the end user's experience.");
|
|
2445
2443
|
}
|
|
2446
|
-
const s = this[state$
|
|
2444
|
+
const s = this[state$5];
|
|
2447
2445
|
clearRequest(this, false);
|
|
2448
2446
|
s[_method] = normalizeMethod(method);
|
|
2449
2447
|
s[_requestURL] = "" + url;
|
|
@@ -2461,12 +2459,12 @@ class XMLHttpRequestImpl extends XMLHttpRequestEventTargetP {
|
|
|
2461
2459
|
overrideMimeType(...args) {
|
|
2462
2460
|
const [mime] = args;
|
|
2463
2461
|
checkArgsLength(args, 1, "XMLHttpRequest", "overrideMimeType");
|
|
2464
|
-
if (this[state$
|
|
2462
|
+
if (this[state$5][_inAfterOpenBeforeSend]) {
|
|
2465
2463
|
console.error(`TypeError: Failed to execute 'overrideMimeType' on 'XMLHttpRequest': mimeType ('${mime}') not implemented.`);
|
|
2466
2464
|
}
|
|
2467
2465
|
}
|
|
2468
2466
|
send(body) {
|
|
2469
|
-
const s = this[state$
|
|
2467
|
+
const s = this[state$5];
|
|
2470
2468
|
if (!s[_inAfterOpenBeforeSend] || s.readyState !== XMLHttpRequestImpl.OPENED) {
|
|
2471
2469
|
throw new MPException("Failed to execute 'send' on 'XMLHttpRequest': The object's state must be OPENED.", "InvalidStateError");
|
|
2472
2470
|
}
|
|
@@ -2499,7 +2497,7 @@ class XMLHttpRequestImpl extends XMLHttpRequestEventTargetP {
|
|
|
2499
2497
|
};
|
|
2500
2498
|
// Alipay Mini Program
|
|
2501
2499
|
options.headers = options.header;
|
|
2502
|
-
s[_requestTask] = mp$
|
|
2500
|
+
s[_requestTask] = mp$2.request(options);
|
|
2503
2501
|
emitProcessEvent(this, "loadstart");
|
|
2504
2502
|
if (processContentLength && s.upload) {
|
|
2505
2503
|
emitProcessEvent(this.upload, "loadstart", 0, contentLength);
|
|
@@ -2526,7 +2524,7 @@ class XMLHttpRequestImpl extends XMLHttpRequestEventTargetP {
|
|
|
2526
2524
|
setRequestHeader(...args) {
|
|
2527
2525
|
const [name, value] = args;
|
|
2528
2526
|
checkArgsLength(args, 2, "XMLHttpRequest", "setRequestHeader");
|
|
2529
|
-
const s = this[state$
|
|
2527
|
+
const s = this[state$5];
|
|
2530
2528
|
if (!s[_inAfterOpenBeforeSend] || s.readyState !== XMLHttpRequestImpl.OPENED) {
|
|
2531
2529
|
throw new MPException("Failed to execute 'setRequestHeader' on 'XMLHttpRequest': The object's state must be OPENED.", "InvalidStateError");
|
|
2532
2530
|
}
|
|
@@ -2535,10 +2533,10 @@ class XMLHttpRequestImpl extends XMLHttpRequestEventTargetP {
|
|
|
2535
2533
|
});
|
|
2536
2534
|
s[_requestHeaders].append(_name, value);
|
|
2537
2535
|
}
|
|
2538
|
-
get onreadystatechange() { return this[state$
|
|
2536
|
+
get onreadystatechange() { return this[state$5].onreadystatechange; }
|
|
2539
2537
|
set onreadystatechange(value) {
|
|
2540
|
-
this[state$
|
|
2541
|
-
attachFn(this, "readystatechange", value, this[state$
|
|
2538
|
+
this[state$5].onreadystatechange = value;
|
|
2539
|
+
attachFn(this, "readystatechange", value, this[state$5][_handlers$1].onreadystatechange);
|
|
2542
2540
|
}
|
|
2543
2541
|
/** @internal */ toString() { return "[object XMLHttpRequest]"; }
|
|
2544
2542
|
/** @internal */ get isPolyfill() { return { symbol: polyfill, hierarchy: ["XMLHttpRequest", "XMLHttpRequestEventTarget", "EventTarget"] }; }
|
|
@@ -2546,7 +2544,7 @@ class XMLHttpRequestImpl extends XMLHttpRequestEventTargetP {
|
|
|
2546
2544
|
Object.defineProperties(XMLHttpRequestImpl, XHR_properties);
|
|
2547
2545
|
Object.defineProperties(XMLHttpRequestImpl.prototype, XHR_properties);
|
|
2548
2546
|
Class_setStringTag(XMLHttpRequestImpl, "XMLHttpRequest");
|
|
2549
|
-
/** @internal */ const _handlers = Symbol();
|
|
2547
|
+
/** @internal */ const _handlers$1 = Symbol();
|
|
2550
2548
|
/** @internal */ const _inAfterOpenBeforeSend = Symbol();
|
|
2551
2549
|
/** @internal */ const _resetPending = Symbol();
|
|
2552
2550
|
/** @internal */ const _timeoutId = Symbol();
|
|
@@ -2567,9 +2565,9 @@ class XMLHttpRequestState {
|
|
|
2567
2565
|
this.statusText = "";
|
|
2568
2566
|
this.timeout = 0;
|
|
2569
2567
|
this.withCredentials = false;
|
|
2570
|
-
this[_a] = getHandlers(this);
|
|
2568
|
+
this[_a$1] = getHandlers$1(this);
|
|
2571
2569
|
this.onreadystatechange = null;
|
|
2572
|
-
this[_b] = false;
|
|
2570
|
+
this[_b$1] = false;
|
|
2573
2571
|
this[_c] = false;
|
|
2574
2572
|
this[_d] = 0;
|
|
2575
2573
|
this[_e] = "";
|
|
@@ -2581,8 +2579,8 @@ class XMLHttpRequestState {
|
|
|
2581
2579
|
this.target = target;
|
|
2582
2580
|
}
|
|
2583
2581
|
}
|
|
2584
|
-
_a = _handlers, _b = _inAfterOpenBeforeSend, _c = _resetPending, _d = _timeoutId, _e = _requestURL, _f = _method, _g = _requestHeaders, _h = _responseHeaders, _j = _responseContentLength, _k = _requestTask;
|
|
2585
|
-
function getHandlers(s) {
|
|
2582
|
+
_a$1 = _handlers$1, _b$1 = _inAfterOpenBeforeSend, _c = _resetPending, _d = _timeoutId, _e = _requestURL, _f = _method, _g = _requestHeaders, _h = _responseHeaders, _j = _responseContentLength, _k = _requestTask;
|
|
2583
|
+
function getHandlers$1(s) {
|
|
2586
2584
|
return {
|
|
2587
2585
|
onreadystatechange: (ev) => { executeFn(s.target, s.onreadystatechange, ev); },
|
|
2588
2586
|
};
|
|
@@ -2591,7 +2589,7 @@ function normalizeDataType(responseType) {
|
|
|
2591
2589
|
return (responseType === "blob" || responseType === "arraybuffer") ? "arraybuffer" : "text";
|
|
2592
2590
|
}
|
|
2593
2591
|
function requestSuccess(res) {
|
|
2594
|
-
const s = this[state$
|
|
2592
|
+
const s = this[state$5];
|
|
2595
2593
|
s.responseURL = s[_requestURL];
|
|
2596
2594
|
s.status = "statusCode" in res ? res.statusCode : "status" in res ? res.status : 200;
|
|
2597
2595
|
s[_responseHeaders] = new HeadersP(("header" in res ? res.header : "headers" in res ? res.headers : undefined));
|
|
@@ -2632,7 +2630,7 @@ function requestFail(err) {
|
|
|
2632
2630
|
});
|
|
2633
2631
|
return;
|
|
2634
2632
|
}
|
|
2635
|
-
const s = this[state$
|
|
2633
|
+
const s = this[state$5];
|
|
2636
2634
|
s.status = 0;
|
|
2637
2635
|
s.statusText = "errMsg" in err ? err.errMsg : "errorMessage" in err ? err.errorMessage : "";
|
|
2638
2636
|
if (!s[_inAfterOpenBeforeSend] && s.readyState !== XMLHttpRequestImpl.UNSENT && s.readyState !== XMLHttpRequestImpl.DONE) {
|
|
@@ -2641,7 +2639,7 @@ function requestFail(err) {
|
|
|
2641
2639
|
}
|
|
2642
2640
|
}
|
|
2643
2641
|
function requestComplete() {
|
|
2644
|
-
const s = this[state$
|
|
2642
|
+
const s = this[state$5];
|
|
2645
2643
|
s[_requestTask] = null;
|
|
2646
2644
|
if (!s[_inAfterOpenBeforeSend] && (s.readyState === XMLHttpRequestImpl.OPENED || s.readyState === XMLHttpRequestImpl.LOADING)) {
|
|
2647
2645
|
setReadyStateAndNotify(this, XMLHttpRequestImpl.DONE);
|
|
@@ -2660,7 +2658,7 @@ function safeAbort(task) {
|
|
|
2660
2658
|
}
|
|
2661
2659
|
}
|
|
2662
2660
|
function clearRequest(xhr, delay = true) {
|
|
2663
|
-
const s = xhr[state$
|
|
2661
|
+
const s = xhr[state$5];
|
|
2664
2662
|
const timerFn = delay ? setTimeout : (f) => { f(); };
|
|
2665
2663
|
s[_resetPending] = true;
|
|
2666
2664
|
if (s[_requestTask] && s.readyState !== XMLHttpRequestImpl.DONE) {
|
|
@@ -2690,7 +2688,7 @@ function clearRequest(xhr, delay = true) {
|
|
|
2690
2688
|
});
|
|
2691
2689
|
}
|
|
2692
2690
|
function checkRequestTimeout(xhr) {
|
|
2693
|
-
const s = xhr[state$
|
|
2691
|
+
const s = xhr[state$5];
|
|
2694
2692
|
if (s.timeout) {
|
|
2695
2693
|
s[_timeoutId] = setTimeout(() => {
|
|
2696
2694
|
if (!s.status && s.readyState !== XMLHttpRequestImpl.DONE) {
|
|
@@ -2703,7 +2701,7 @@ function checkRequestTimeout(xhr) {
|
|
|
2703
2701
|
}
|
|
2704
2702
|
}
|
|
2705
2703
|
function resetXHR(xhr) {
|
|
2706
|
-
const s = xhr[state$
|
|
2704
|
+
const s = xhr[state$5];
|
|
2707
2705
|
s[_resetPending] = false;
|
|
2708
2706
|
resetRequestTimeout(xhr);
|
|
2709
2707
|
s.response = "";
|
|
@@ -2715,14 +2713,14 @@ function resetXHR(xhr) {
|
|
|
2715
2713
|
s[_responseContentLength] = () => 0;
|
|
2716
2714
|
}
|
|
2717
2715
|
function resetRequestTimeout(xhr) {
|
|
2718
|
-
const s = xhr[state$
|
|
2716
|
+
const s = xhr[state$5];
|
|
2719
2717
|
if (s[_timeoutId]) {
|
|
2720
2718
|
clearTimeout(s[_timeoutId]);
|
|
2721
2719
|
s[_timeoutId] = 0;
|
|
2722
2720
|
}
|
|
2723
2721
|
}
|
|
2724
2722
|
function setReadyStateAndNotify(xhr, value) {
|
|
2725
|
-
const s = xhr[state$
|
|
2723
|
+
const s = xhr[state$5];
|
|
2726
2724
|
let hasChanged = value !== s.readyState;
|
|
2727
2725
|
s.readyState = value;
|
|
2728
2726
|
if (hasChanged) {
|
|
@@ -2734,13 +2732,13 @@ function setReadyStateAndNotify(xhr, value) {
|
|
|
2734
2732
|
const XMLHttpRequestP = XMLHttpRequestImpl;
|
|
2735
2733
|
const XMLHttpRequestE = (typeof XMLHttpRequest !== "undefined" && XMLHttpRequest) || XMLHttpRequestP;
|
|
2736
2734
|
|
|
2737
|
-
/** @internal */ const state$
|
|
2735
|
+
/** @internal */ const state$4 = Symbol( /* "ResponseState" */);
|
|
2738
2736
|
class ResponseP extends BodyImpl {
|
|
2739
2737
|
constructor(body, init) {
|
|
2740
2738
|
super();
|
|
2741
|
-
this[state$
|
|
2742
|
-
this[state$
|
|
2743
|
-
const s = this[state$
|
|
2739
|
+
this[state$a].name = "Response";
|
|
2740
|
+
this[state$4] = new ResponseState();
|
|
2741
|
+
const s = this[state$4];
|
|
2744
2742
|
let _init = init !== null && init !== void 0 ? init : {};
|
|
2745
2743
|
if (typeof _init !== "object") {
|
|
2746
2744
|
throw new TypeError("Failed to construct 'Response': The provided value is not of type 'ResponseInit'.");
|
|
@@ -2758,18 +2756,18 @@ class ResponseP extends BodyImpl {
|
|
|
2758
2756
|
Body_init(this, body);
|
|
2759
2757
|
}
|
|
2760
2758
|
get headers() {
|
|
2761
|
-
const s = this[state$
|
|
2759
|
+
const s = this[state$4];
|
|
2762
2760
|
if (!s.headers) {
|
|
2763
2761
|
s.headers = new HeadersP();
|
|
2764
2762
|
}
|
|
2765
2763
|
return s.headers;
|
|
2766
2764
|
}
|
|
2767
|
-
get ok() { return this[state$
|
|
2768
|
-
get redirected() { return this[state$
|
|
2769
|
-
get status() { return this[state$
|
|
2770
|
-
get statusText() { return this[state$
|
|
2771
|
-
get type() { return this[state$
|
|
2772
|
-
get url() { return this[state$
|
|
2765
|
+
get ok() { return this[state$4].ok; }
|
|
2766
|
+
get redirected() { return this[state$4].redirected; }
|
|
2767
|
+
get status() { return this[state$4].status; }
|
|
2768
|
+
get statusText() { return this[state$4].statusText; }
|
|
2769
|
+
get type() { return this[state$4].type; }
|
|
2770
|
+
get url() { return this[state$4].url; }
|
|
2773
2771
|
clone() {
|
|
2774
2772
|
if (this.bodyUsed) {
|
|
2775
2773
|
throw new TypeError("Failed to execute 'clone' on 'Response': Response body is already used");
|
|
@@ -2779,7 +2777,7 @@ class ResponseP extends BodyImpl {
|
|
|
2779
2777
|
status: this.status,
|
|
2780
2778
|
statusText: this.statusText,
|
|
2781
2779
|
});
|
|
2782
|
-
response[state$
|
|
2780
|
+
response[state$4].url = this.url;
|
|
2783
2781
|
return response;
|
|
2784
2782
|
}
|
|
2785
2783
|
static json(...args) {
|
|
@@ -2791,9 +2789,9 @@ class ResponseP extends BodyImpl {
|
|
|
2791
2789
|
}
|
|
2792
2790
|
static error() {
|
|
2793
2791
|
let response = new ResponseP(null, { status: 200, statusText: "" });
|
|
2794
|
-
response[state$
|
|
2795
|
-
response[state$
|
|
2796
|
-
response[state$
|
|
2792
|
+
response[state$4].ok = false;
|
|
2793
|
+
response[state$4].status = 0;
|
|
2794
|
+
response[state$4].type = "error";
|
|
2797
2795
|
return response;
|
|
2798
2796
|
}
|
|
2799
2797
|
static redirect(...args) {
|
|
@@ -2821,8 +2819,8 @@ class ResponseState {
|
|
|
2821
2819
|
}
|
|
2822
2820
|
const ResponseE = g["Response"] || ResponseP;
|
|
2823
2821
|
|
|
2824
|
-
const mp = { XMLHttpRequest: XMLHttpRequestE };
|
|
2825
|
-
const setXMLHttpRequest = (XHR) => { mp.XMLHttpRequest = XHR; };
|
|
2822
|
+
const mp$1 = { XMLHttpRequest: XMLHttpRequestE };
|
|
2823
|
+
const setXMLHttpRequest = (XHR) => { mp$1.XMLHttpRequest = XHR; };
|
|
2826
2824
|
function fetchP(...args) {
|
|
2827
2825
|
if (new.target === fetchP) {
|
|
2828
2826
|
throw new TypeError("fetch is not a constructor");
|
|
@@ -2831,11 +2829,11 @@ function fetchP(...args) {
|
|
|
2831
2829
|
checkArgsLength(args, 1, "Window", "fetch");
|
|
2832
2830
|
return new Promise((resolve, reject) => {
|
|
2833
2831
|
const request = new RequestP(input, init);
|
|
2834
|
-
const signal = request[state$
|
|
2832
|
+
const signal = request[state$7].signal;
|
|
2835
2833
|
if (signal && signal.aborted) {
|
|
2836
2834
|
return reject(signal.reason);
|
|
2837
2835
|
}
|
|
2838
|
-
let xhr = new mp.XMLHttpRequest();
|
|
2836
|
+
let xhr = new mp$1.XMLHttpRequest();
|
|
2839
2837
|
xhr.onload = function () {
|
|
2840
2838
|
let options = {
|
|
2841
2839
|
headers: parseHeaders(xhr.getAllResponseHeaders() || ""),
|
|
@@ -2849,7 +2847,7 @@ function fetchP(...args) {
|
|
|
2849
2847
|
}
|
|
2850
2848
|
setTimeout(() => {
|
|
2851
2849
|
let response = new ResponseP("response" in xhr ? xhr.response : xhr.responseText, options);
|
|
2852
|
-
response[state$
|
|
2850
|
+
response[state$4].url = "responseURL" in xhr ? xhr.responseURL : (options.headers.get("X-Request-URL") || "");
|
|
2853
2851
|
resolve(response);
|
|
2854
2852
|
});
|
|
2855
2853
|
};
|
|
@@ -2912,24 +2910,24 @@ function fetchP(...args) {
|
|
|
2912
2910
|
}
|
|
2913
2911
|
const fetchE = g["fetch"] || fetchP;
|
|
2914
2912
|
|
|
2915
|
-
const dispatched = 1;
|
|
2913
|
+
const dispatched$1 = 1;
|
|
2916
2914
|
/** @internal */
|
|
2917
|
-
const state = Symbol( /* "CustomEventState" */);
|
|
2915
|
+
const state$3 = Symbol( /* "CustomEventState" */);
|
|
2918
2916
|
class CustomEventP extends EventP {
|
|
2919
2917
|
constructor(type, eventInitDict) {
|
|
2920
2918
|
var _a;
|
|
2921
2919
|
super(type, eventInitDict);
|
|
2922
|
-
this[state] = new CustomEventState();
|
|
2923
|
-
this[state].detail = (_a = eventInitDict === null || eventInitDict === void 0 ? void 0 : eventInitDict.detail) !== null && _a !== void 0 ? _a : null;
|
|
2920
|
+
this[state$3] = new CustomEventState();
|
|
2921
|
+
this[state$3].detail = (_a = eventInitDict === null || eventInitDict === void 0 ? void 0 : eventInitDict.detail) !== null && _a !== void 0 ? _a : null;
|
|
2924
2922
|
}
|
|
2925
|
-
get detail() { return this[state].detail; }
|
|
2923
|
+
get detail() { return this[state$3].detail; }
|
|
2926
2924
|
initCustomEvent(...args) {
|
|
2927
2925
|
const [type, bubbles, cancelable, detail] = args;
|
|
2928
2926
|
checkArgsLength(args, 1, "CustomEvent", "initCustomEvent");
|
|
2929
|
-
if (Event_getEtField(this, dispatched))
|
|
2927
|
+
if (Event_getEtField(this, dispatched$1))
|
|
2930
2928
|
return;
|
|
2931
2929
|
this.initEvent(type, bubbles, cancelable);
|
|
2932
|
-
this[state].detail = detail !== null && detail !== void 0 ? detail : null;
|
|
2930
|
+
this[state$3].detail = detail !== null && detail !== void 0 ? detail : null;
|
|
2933
2931
|
}
|
|
2934
2932
|
/** @internal */ toString() { return "[object CustomEvent]"; }
|
|
2935
2933
|
/** @internal */ get isPolyfill() { return { symbol: polyfill, hierarchy: ["CustomEvent", "Event"] }; }
|
|
@@ -2940,6 +2938,318 @@ class CustomEventState {
|
|
|
2940
2938
|
}
|
|
2941
2939
|
const CustomEventE = g["EventTarget"] ? g["CustomEvent"] : CustomEventP;
|
|
2942
2940
|
|
|
2941
|
+
/** @internal */
|
|
2942
|
+
const state$2 = Symbol( /* "CloseEventState" */);
|
|
2943
|
+
class CloseEventP extends EventP {
|
|
2944
|
+
constructor(type, eventInitDict) {
|
|
2945
|
+
var _a;
|
|
2946
|
+
super(type, eventInitDict);
|
|
2947
|
+
this[state$2] = new CloseEventState();
|
|
2948
|
+
const s = this[state$2];
|
|
2949
|
+
let _code = Number((_a = eventInitDict === null || eventInitDict === void 0 ? void 0 : eventInitDict.code) !== null && _a !== void 0 ? _a : 0);
|
|
2950
|
+
s.code = isNaN(_code) ? 0 : _code;
|
|
2951
|
+
if ((eventInitDict === null || eventInitDict === void 0 ? void 0 : eventInitDict.reason) !== undefined)
|
|
2952
|
+
s.reason = "" + eventInitDict.reason;
|
|
2953
|
+
s.wasClean = !!(eventInitDict === null || eventInitDict === void 0 ? void 0 : eventInitDict.wasClean);
|
|
2954
|
+
}
|
|
2955
|
+
get code() { return this[state$2].code; }
|
|
2956
|
+
get reason() { return this[state$2].reason; }
|
|
2957
|
+
get wasClean() { return this[state$2].wasClean; }
|
|
2958
|
+
/** @internal */ toString() { return "[object CloseEvent]"; }
|
|
2959
|
+
/** @internal */ get isPolyfill() { return { symbol: polyfill, hierarchy: ["CloseEvent", "Event"] }; }
|
|
2960
|
+
}
|
|
2961
|
+
Class_setStringTag(CloseEventP, "CloseEvent");
|
|
2962
|
+
/** @internal */
|
|
2963
|
+
class CloseEventState {
|
|
2964
|
+
constructor() {
|
|
2965
|
+
this.code = 0;
|
|
2966
|
+
this.reason = "";
|
|
2967
|
+
this.wasClean = false;
|
|
2968
|
+
}
|
|
2969
|
+
}
|
|
2970
|
+
g["EventTarget"] ? g["CloseEvent"] : CloseEventP;
|
|
2971
|
+
|
|
2972
|
+
const dispatched = 1;
|
|
2973
|
+
/** @internal */
|
|
2974
|
+
const state$1 = Symbol( /* "MessageEventState" */);
|
|
2975
|
+
class MessageEventP extends EventP {
|
|
2976
|
+
constructor(type, eventInitDict) {
|
|
2977
|
+
var _a;
|
|
2978
|
+
super(type, eventInitDict);
|
|
2979
|
+
this[state$1] = new MessageEventState();
|
|
2980
|
+
const s = this[state$1];
|
|
2981
|
+
s.data = (_a = eventInitDict === null || eventInitDict === void 0 ? void 0 : eventInitDict.data) !== null && _a !== void 0 ? _a : null;
|
|
2982
|
+
if ((eventInitDict === null || eventInitDict === void 0 ? void 0 : eventInitDict.origin) !== undefined)
|
|
2983
|
+
s.origin = "" + eventInitDict.origin;
|
|
2984
|
+
if ((eventInitDict === null || eventInitDict === void 0 ? void 0 : eventInitDict.lastEventId) !== undefined)
|
|
2985
|
+
s.lastEventId = "" + eventInitDict.lastEventId;
|
|
2986
|
+
if ((eventInitDict === null || eventInitDict === void 0 ? void 0 : eventInitDict.source) !== undefined)
|
|
2987
|
+
s.source = eventInitDict.source;
|
|
2988
|
+
if ((eventInitDict === null || eventInitDict === void 0 ? void 0 : eventInitDict.ports) !== undefined)
|
|
2989
|
+
s.ports = eventInitDict.ports;
|
|
2990
|
+
}
|
|
2991
|
+
get data() { return this[state$1].data; }
|
|
2992
|
+
get lastEventId() { return this[state$1].lastEventId; }
|
|
2993
|
+
get origin() { return this[state$1].origin; }
|
|
2994
|
+
get ports() { return this[state$1].ports; }
|
|
2995
|
+
get source() { return this[state$1].source; }
|
|
2996
|
+
initMessageEvent(...args) {
|
|
2997
|
+
const [type, bubbles, cancelable, data, origin, lastEventId, source, ports] = args;
|
|
2998
|
+
checkArgsLength(args, 1, "MessageEvent", "initMessageEvent");
|
|
2999
|
+
if (Event_getEtField(this, dispatched))
|
|
3000
|
+
return;
|
|
3001
|
+
this.initEvent(type, bubbles, cancelable);
|
|
3002
|
+
const s = this[state$1];
|
|
3003
|
+
s.data = data !== null && data !== void 0 ? data : null;
|
|
3004
|
+
if (origin !== undefined)
|
|
3005
|
+
s.origin = "" + origin;
|
|
3006
|
+
if (lastEventId !== undefined)
|
|
3007
|
+
s.lastEventId = "" + lastEventId;
|
|
3008
|
+
if (source !== undefined)
|
|
3009
|
+
s.source = source;
|
|
3010
|
+
if (ports !== undefined)
|
|
3011
|
+
s.ports = ports;
|
|
3012
|
+
}
|
|
3013
|
+
/** @internal */ toString() { return "[object MessageEvent]"; }
|
|
3014
|
+
/** @internal */ get isPolyfill() { return { symbol: polyfill, hierarchy: ["MessageEvent", "Event"] }; }
|
|
3015
|
+
}
|
|
3016
|
+
Class_setStringTag(MessageEventP, "MessageEvent");
|
|
3017
|
+
/** @internal */
|
|
3018
|
+
class MessageEventState {
|
|
3019
|
+
constructor() {
|
|
3020
|
+
this.data = null;
|
|
3021
|
+
this.lastEventId = "";
|
|
3022
|
+
this.origin = "";
|
|
3023
|
+
this.ports = [];
|
|
3024
|
+
this.source = null;
|
|
3025
|
+
}
|
|
3026
|
+
}
|
|
3027
|
+
g["EventTarget"] ? g["MessageEvent"] : MessageEventP;
|
|
3028
|
+
|
|
3029
|
+
const connectSocket = mp$3 ? mp$3.connectSocket : function errorConnectSocket(options) {
|
|
3030
|
+
return {
|
|
3031
|
+
send(obj) { },
|
|
3032
|
+
close(obj) { },
|
|
3033
|
+
onOpen(listener) { },
|
|
3034
|
+
onMessage(listener) { },
|
|
3035
|
+
onError(listener) {
|
|
3036
|
+
if (typeof listener === "function") {
|
|
3037
|
+
listener({ errMsg: "NOT_SUPPORTED_ERR" });
|
|
3038
|
+
}
|
|
3039
|
+
},
|
|
3040
|
+
onClose(listener) {
|
|
3041
|
+
if (typeof listener === "function") {
|
|
3042
|
+
setTimeout(() => { listener({ code: 3009, reason: "NOT_SUPPORTED_ERR" }); });
|
|
3043
|
+
}
|
|
3044
|
+
},
|
|
3045
|
+
};
|
|
3046
|
+
};
|
|
3047
|
+
|
|
3048
|
+
var _a, _b;
|
|
3049
|
+
const mp = { connectSocket: connectSocket };
|
|
3050
|
+
const setConnectSocket = (connectSocket) => { mp.connectSocket = connectSocket; };
|
|
3051
|
+
/** @internal */
|
|
3052
|
+
const state = Symbol( /* "WebSocketState" */);
|
|
3053
|
+
class WebSocketImpl extends EventTargetP {
|
|
3054
|
+
constructor(...args) {
|
|
3055
|
+
const [url, protocols] = args;
|
|
3056
|
+
checkArgsLength(args, 1, "WebSocket");
|
|
3057
|
+
super();
|
|
3058
|
+
this[state] = new WebSocketState(this, {
|
|
3059
|
+
url: "" + url,
|
|
3060
|
+
protocols: protocols !== undefined
|
|
3061
|
+
? (Array.isArray(protocols) || (protocols && typeof protocols === "object" && Symbol.iterator in protocols))
|
|
3062
|
+
? Array.isArray(protocols) ? protocols : Array.from(protocols)
|
|
3063
|
+
: ["" + protocols]
|
|
3064
|
+
: [],
|
|
3065
|
+
multiple: true, // Alipay Mini Program
|
|
3066
|
+
fail(err) { console.error(err); },
|
|
3067
|
+
});
|
|
3068
|
+
let socketTask = this[state][_socketTask];
|
|
3069
|
+
if (socketTask && typeof socketTask === "object") {
|
|
3070
|
+
onOpen(this);
|
|
3071
|
+
onClose(this);
|
|
3072
|
+
onError(this);
|
|
3073
|
+
onMessage(this);
|
|
3074
|
+
}
|
|
3075
|
+
else {
|
|
3076
|
+
throw new Error(`connectSocket can't establish a connection to the server at ${"" + url}.`);
|
|
3077
|
+
}
|
|
3078
|
+
}
|
|
3079
|
+
get binaryType() { return this[state].binaryType; }
|
|
3080
|
+
set binaryType(value) { if (value === "blob" || value === "arraybuffer") {
|
|
3081
|
+
this[state].binaryType = value;
|
|
3082
|
+
} }
|
|
3083
|
+
get bufferedAmount() { return this[state].bufferedAmount; }
|
|
3084
|
+
get extensions() { return this[state].extensions; }
|
|
3085
|
+
get protocol() { return this[state].protocol; }
|
|
3086
|
+
get readyState() { return this[state].readyState; }
|
|
3087
|
+
get url() { return this[state].url; }
|
|
3088
|
+
close(code, reason) {
|
|
3089
|
+
if (this.readyState === WebSocketImpl.CLOSING || this.readyState === WebSocketImpl.CLOSED)
|
|
3090
|
+
return;
|
|
3091
|
+
this[state].readyState = WebSocketImpl.CLOSING;
|
|
3092
|
+
this[state][_socketTask].close({
|
|
3093
|
+
code: code,
|
|
3094
|
+
reason: reason,
|
|
3095
|
+
fail(err) { console.error(err); },
|
|
3096
|
+
complete: (function () {
|
|
3097
|
+
this[state].readyState = WebSocketImpl.CLOSED;
|
|
3098
|
+
}).bind(this),
|
|
3099
|
+
});
|
|
3100
|
+
}
|
|
3101
|
+
send(...args) {
|
|
3102
|
+
const [data] = args;
|
|
3103
|
+
checkArgsLength(args, 1, "WebSocket", "send");
|
|
3104
|
+
if (this.readyState === WebSocketImpl.CONNECTING) {
|
|
3105
|
+
throw new MPException("Failed to execute 'send' on 'WebSocket': Still in CONNECTING state.", "InvalidStateError");
|
|
3106
|
+
}
|
|
3107
|
+
if (this.readyState === WebSocketImpl.CLOSING || this.readyState === WebSocketImpl.CLOSED) {
|
|
3108
|
+
return console.error("WebSocket is already in CLOSING or CLOSED state.");
|
|
3109
|
+
}
|
|
3110
|
+
let _data;
|
|
3111
|
+
if (data instanceof ArrayBuffer) {
|
|
3112
|
+
_data = data;
|
|
3113
|
+
}
|
|
3114
|
+
else if (ArrayBuffer.isView(data)) {
|
|
3115
|
+
_data = data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength);
|
|
3116
|
+
}
|
|
3117
|
+
else if (isPolyfillType("Blob", data)) {
|
|
3118
|
+
_data = Blob_toUint8Array(data).buffer.slice(0);
|
|
3119
|
+
}
|
|
3120
|
+
else {
|
|
3121
|
+
_data = "" + data;
|
|
3122
|
+
}
|
|
3123
|
+
this[state][_socketTask].send({
|
|
3124
|
+
data: _data,
|
|
3125
|
+
fail(err) { console.error(err); },
|
|
3126
|
+
});
|
|
3127
|
+
}
|
|
3128
|
+
get onclose() { return this[state].onclose; }
|
|
3129
|
+
set onclose(value) { this[state].onclose = value; attach(this, "close"); }
|
|
3130
|
+
get onerror() { return this[state].onerror; }
|
|
3131
|
+
set onerror(value) { this[state].onerror = value; attach(this, "error"); }
|
|
3132
|
+
get onmessage() { return this[state].onmessage; }
|
|
3133
|
+
set onmessage(value) { this[state].onmessage = value; attach(this, "message"); }
|
|
3134
|
+
get onopen() { return this[state].onopen; }
|
|
3135
|
+
set onopen(value) { this[state].onopen = value; attach(this, "open"); }
|
|
3136
|
+
/** @internal */ toString() { return "[object WebSocket]"; }
|
|
3137
|
+
/** @internal */ get isPolyfill() { return { symbol: polyfill, hierarchy: ["WebSocket", "EventTarget"] }; }
|
|
3138
|
+
}
|
|
3139
|
+
const properties = {
|
|
3140
|
+
CONNECTING: { value: 0, enumerable: true },
|
|
3141
|
+
OPEN: { value: 1, enumerable: true },
|
|
3142
|
+
CLOSING: { value: 2, enumerable: true },
|
|
3143
|
+
CLOSED: { value: 3, enumerable: true },
|
|
3144
|
+
};
|
|
3145
|
+
Object.defineProperties(WebSocketImpl, properties);
|
|
3146
|
+
Object.defineProperties(WebSocketImpl.prototype, properties);
|
|
3147
|
+
Class_setStringTag(WebSocketImpl, "WebSocket");
|
|
3148
|
+
/** @internal */ const _socketTask = Symbol();
|
|
3149
|
+
/** @internal */ const _error = Symbol();
|
|
3150
|
+
/** @internal */ const _handlers = Symbol();
|
|
3151
|
+
/** @internal */
|
|
3152
|
+
class WebSocketState {
|
|
3153
|
+
constructor(target, opts) {
|
|
3154
|
+
this.binaryType = "blob";
|
|
3155
|
+
this.bufferedAmount = 0;
|
|
3156
|
+
this.extensions = "";
|
|
3157
|
+
this.protocol = "";
|
|
3158
|
+
this.readyState = 0;
|
|
3159
|
+
this[_a] = null;
|
|
3160
|
+
this[_b] = getHandlers(this);
|
|
3161
|
+
this.onclose = null;
|
|
3162
|
+
this.onerror = null;
|
|
3163
|
+
this.onmessage = null;
|
|
3164
|
+
this.onopen = null;
|
|
3165
|
+
this.target = target;
|
|
3166
|
+
this.url = opts.url;
|
|
3167
|
+
this[_socketTask] = mp.connectSocket(opts);
|
|
3168
|
+
}
|
|
3169
|
+
}
|
|
3170
|
+
_a = _error, _b = _handlers;
|
|
3171
|
+
function attach(target, type) {
|
|
3172
|
+
const s = target[state];
|
|
3173
|
+
const fnName = ("on" + type);
|
|
3174
|
+
const cb = s[fnName];
|
|
3175
|
+
const listener = s[_handlers][fnName];
|
|
3176
|
+
attachFn(target, type, cb, listener);
|
|
3177
|
+
}
|
|
3178
|
+
function getHandlers(s) {
|
|
3179
|
+
return {
|
|
3180
|
+
onclose: (ev) => { executeFn(s.target, s.onclose, ev); },
|
|
3181
|
+
onerror: (ev) => { executeFn(s.target, s.onerror, ev); },
|
|
3182
|
+
onmessage: (ev) => { executeFn(s.target, s.onmessage, ev); },
|
|
3183
|
+
onopen: (ev) => { executeFn(s.target, s.onopen, ev); },
|
|
3184
|
+
};
|
|
3185
|
+
}
|
|
3186
|
+
function onOpen(ws) {
|
|
3187
|
+
let _ws = ws;
|
|
3188
|
+
_ws[state][_socketTask].onOpen(res => {
|
|
3189
|
+
if ("header" in res && res.header && typeof res.header === "object") {
|
|
3190
|
+
let headers = new HeadersP(res.header);
|
|
3191
|
+
_ws[state].protocol = headers.get("Sec-WebSocket-Protocol") || "";
|
|
3192
|
+
}
|
|
3193
|
+
_ws[state].readyState = WebSocketImpl.OPEN;
|
|
3194
|
+
EventTarget_fire(_ws, createInnerEvent(_ws, "open"));
|
|
3195
|
+
});
|
|
3196
|
+
}
|
|
3197
|
+
function onClose(ws) {
|
|
3198
|
+
let _ws = ws;
|
|
3199
|
+
_ws[state][_socketTask].onClose(res => {
|
|
3200
|
+
_ws[state].readyState = WebSocketImpl.CLOSED;
|
|
3201
|
+
let event = new CloseEventP("close", {
|
|
3202
|
+
wasClean: !_ws[state][_error],
|
|
3203
|
+
code: res.code,
|
|
3204
|
+
reason: res.reason,
|
|
3205
|
+
});
|
|
3206
|
+
Event_setTrusted(event, true);
|
|
3207
|
+
EventTarget_fire(_ws, event);
|
|
3208
|
+
});
|
|
3209
|
+
}
|
|
3210
|
+
function onError(ws) {
|
|
3211
|
+
let _ws = ws;
|
|
3212
|
+
_ws[state][_socketTask].onError(res => {
|
|
3213
|
+
console.error(res);
|
|
3214
|
+
_ws[state][_error] = res;
|
|
3215
|
+
_ws[state].readyState = WebSocketImpl.CLOSED;
|
|
3216
|
+
EventTarget_fire(_ws, createInnerEvent(_ws, "error"));
|
|
3217
|
+
});
|
|
3218
|
+
}
|
|
3219
|
+
function onMessage(ws) {
|
|
3220
|
+
let _ws = ws;
|
|
3221
|
+
_ws[state][_socketTask].onMessage(res => {
|
|
3222
|
+
let data = res.data;
|
|
3223
|
+
let _data;
|
|
3224
|
+
// Alipay Mini Program
|
|
3225
|
+
if (data && typeof data === "object" && "data" in data) {
|
|
3226
|
+
_data = data.data;
|
|
3227
|
+
if ("isBuffer" in data && data.isBuffer && typeof _data === "string") {
|
|
3228
|
+
// @ts-ignore
|
|
3229
|
+
try {
|
|
3230
|
+
_data = my.base64ToArrayBuffer(_data);
|
|
3231
|
+
}
|
|
3232
|
+
catch (e) { }
|
|
3233
|
+
}
|
|
3234
|
+
}
|
|
3235
|
+
else {
|
|
3236
|
+
_data = data;
|
|
3237
|
+
}
|
|
3238
|
+
if (_data instanceof ArrayBuffer && _ws.binaryType === "blob") {
|
|
3239
|
+
_data = new BlobP([_data]);
|
|
3240
|
+
}
|
|
3241
|
+
let event = new MessageEventP("message", {
|
|
3242
|
+
data: _data,
|
|
3243
|
+
origin: _ws.url,
|
|
3244
|
+
});
|
|
3245
|
+
Event_setTrusted(event, true);
|
|
3246
|
+
EventTarget_fire(_ws, event);
|
|
3247
|
+
});
|
|
3248
|
+
}
|
|
3249
|
+
|
|
3250
|
+
const WebSocketP = WebSocketImpl;
|
|
3251
|
+
const WebSocketE = (typeof WebSocket !== "undefined" && WebSocket) || WebSocketP;
|
|
3252
|
+
|
|
2943
3253
|
exports.AbortController = AbortControllerE;
|
|
2944
3254
|
exports.AbortControllerP = AbortControllerP;
|
|
2945
3255
|
exports.AbortSignal = AbortSignalE;
|
|
@@ -2960,8 +3270,6 @@ exports.FormData = FormDataE;
|
|
|
2960
3270
|
exports.FormDataP = FormDataP;
|
|
2961
3271
|
exports.Headers = HeadersE;
|
|
2962
3272
|
exports.HeadersP = HeadersP;
|
|
2963
|
-
exports.ProgressEvent = ProgressEventE;
|
|
2964
|
-
exports.ProgressEventP = ProgressEventP;
|
|
2965
3273
|
exports.Request = RequestE;
|
|
2966
3274
|
exports.RequestP = RequestP;
|
|
2967
3275
|
exports.Response = ResponseE;
|
|
@@ -2972,9 +3280,12 @@ exports.TextEncoder = TextEncoderE;
|
|
|
2972
3280
|
exports.TextEncoderP = TextEncoderP;
|
|
2973
3281
|
exports.URLSearchParams = URLSearchParamsE;
|
|
2974
3282
|
exports.URLSearchParamsP = URLSearchParamsP;
|
|
3283
|
+
exports.WebSocket = WebSocketE;
|
|
3284
|
+
exports.WebSocketP = WebSocketP;
|
|
2975
3285
|
exports.XMLHttpRequest = XMLHttpRequestE;
|
|
2976
3286
|
exports.XMLHttpRequestP = XMLHttpRequestP;
|
|
2977
3287
|
exports.fetch = fetchE;
|
|
2978
3288
|
exports.fetchP = fetchP;
|
|
3289
|
+
exports.setConnectSocket = setConnectSocket;
|
|
2979
3290
|
exports.setRequest = setRequest;
|
|
2980
3291
|
exports.setXMLHttpRequest = setXMLHttpRequest;
|