mphttpx 1.0.12 → 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/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$a, _b$3;
168
+ var _a$b, _b$4;
169
169
  /** @internal */
170
- const state$h = Symbol( /* "TextDecoderState" */);
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$h] = new TextDecoderState();
178
- this[state$h].fatal = !!fatal;
179
- this[state$h].ignoreBOM = !!ignoreBOM;
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$h].fatal; }
183
- get ignoreBOM() { return this[state$h].ignoreBOM; }
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$h];
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$a] = 0;
325
- this[_b$3] = [];
324
+ this[_a$b] = 0;
325
+ this[_b$4] = [];
326
326
  }
327
327
  }
328
- _a$a = _bomDone, _b$3 = _partial;
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$g = Symbol( /* "BlobState" */);
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$g][_buffer]);
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$g] = new BlobState(concat(chunks));
370
- const s = this[state$g];
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$g].size; }
376
- get type() { return this[state$g].type; }
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$g][_buffer].buffer).buffer);
378
+ return Promise.resolve(clone(this[state$j][_buffer].buffer).buffer);
379
379
  }
380
380
  bytes() {
381
- return Promise.resolve(clone(this[state$g][_buffer].buffer));
381
+ return Promise.resolve(clone(this[state$j][_buffer].buffer));
382
382
  }
383
383
  slice(start, end, contentType) {
384
- let sliced = this[state$g][_buffer].slice(start !== null && start !== void 0 ? start : 0, end !== null && end !== void 0 ? end : this[state$g][_buffer].length); // × WeChat 2.5.0
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$g][_buffer]));
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$g][_buffer];
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$f = Symbol( /* "FileState" */);
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$f] = new FileState();
475
- this[state$f].lastModified = +((options === null || options === void 0 ? void 0 : options.lastModified) ? new Date(options.lastModified) : new Date()) || 0;
476
- this[state$f].name = "" + fileName;
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$f].lastModified; }
479
- get name() { return this[state$f].name; }
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$9, _b$2, _c$1, _d$1, _e$1;
495
- /** @internal */ const state$e = Symbol( /* "EventState" */);
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$e] = new EventState();
501
- const s = this[state$e];
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$e][_isTrusted]; }).bind(this),
508
+ get: (function isTrusted() { return this[state$h][_isTrusted]; }).bind(this),
509
509
  });
510
510
  }
511
- get type() { return this[state$e].type; }
512
- get bubbles() { return this[state$e].bubbles; }
513
- get cancelable() { return this[state$e].cancelable; }
514
- get composed() { return this[state$e].composed; }
515
- get target() { return this[state$e].target; }
516
- get currentTarget() { return this[state$e].currentTarget; }
517
- get eventPhase() { return this[state$e].eventPhase; }
518
- get srcElement() { return this[state$e].target; }
519
- get cancelBubble() { return this[state$e].cancelBubble; }
520
- set cancelBubble(value) { this[state$e].cancelBubble = !!value; }
521
- get defaultPrevented() { return this[state$e].defaultPrevented; }
522
- get returnValue() { return this[state$e].returnValue; }
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$e].timeStamp; }
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$e];
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$e];
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$e][_stopImmediatePropagationCalled] = true;
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$1 = {
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$1);
572
- Object.defineProperties(EventP.prototype, properties$1);
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$9] = false;
595
- this[_b$2] = false;
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$9 = _isTrusted, _b$2 = _passive, _c$1 = _dispatched, _d$1 = _preventDefaultCalled, _e$1 = _stopImmediatePropagationCalled;
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$e], _isTrusted, {
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$2 = 1;
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$e];
617
+ const s = event[state$h];
618
618
  switch (field) {
619
619
  case passive$1:
620
620
  return s[_passive];
621
- case dispatched$2:
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$e];
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$2:
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$e].target = target;
651
- event[state$e][_isTrusted] = isTrusted;
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$8;
656
+ var _a$9;
657
657
  const passive = 0;
658
- const dispatched$1 = 1;
658
+ const dispatched$2 = 1;
659
659
  const preventDefaultCalled = 2;
660
660
  const stopImmediatePropagationCalled = 3;
661
- /** @internal */ const state$d = Symbol( /* "EventTargetState" */);
661
+ /** @internal */ const state$g = Symbol( /* "EventTargetState" */);
662
662
  class EventTargetP {
663
663
  constructor() {
664
- this[state$d] = new EventTargetState(this);
665
- this[state$d].name = new.target.name;
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$d].name, "addEventListener");
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$d].name}': parameter 2 is not of type 'Object'.`);
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$d];
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))) {
@@ -690,21 +690,21 @@ class EventTargetP {
690
690
  }
691
691
  dispatchEvent(...args) {
692
692
  const [event] = args;
693
- checkArgsLength(args, 1, this[state$d].name, "dispatchEvent");
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$d].name}': parameter 1 is not of type 'Event'.`);
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$e].target = this;
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$d].name, "removeEventListener");
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$d].name}': parameter 2 is not of type 'Object'.`);
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$d];
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$8] = [];
724
+ this[_a$9] = [];
725
725
  this.target = target;
726
726
  }
727
727
  }
728
- _a$8 = _executors;
728
+ _a$9 = _executors;
729
729
  /** @internal */
730
730
  function EventTarget_fire(target, event) {
731
- const s = target[state$d];
732
- const evs = event[state$e];
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$1, true);
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,11 +764,11 @@ function EventTarget_fire(target, event) {
764
764
  }
765
765
  evs.currentTarget = null;
766
766
  evs.eventPhase = EventP.NONE;
767
- Event_setEtField(event, dispatched$1, false);
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$d];
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);
@@ -818,13 +818,13 @@ function executeFn(target, cb, ev) {
818
818
  const EventTargetE = g["EventTarget"] || EventTargetP;
819
819
 
820
820
  /** @internal */
821
- const state$c = Symbol( /* "ProgressEventState" */);
821
+ const state$f = Symbol( /* "ProgressEventState" */);
822
822
  class ProgressEventP extends EventP {
823
823
  constructor(type, eventInitDict) {
824
824
  var _a, _b;
825
825
  super(type, eventInitDict);
826
- this[state$c] = new ProgressEventState();
827
- const s = this[state$c];
826
+ this[state$f] = new ProgressEventState();
827
+ const s = this[state$f];
828
828
  s.lengthComputable = !!(eventInitDict === null || eventInitDict === void 0 ? void 0 : eventInitDict.lengthComputable);
829
829
  s.loaded = Number((_a = eventInitDict === null || eventInitDict === void 0 ? void 0 : eventInitDict.loaded) !== null && _a !== void 0 ? _a : 0);
830
830
  s.total = Number((_b = eventInitDict === null || eventInitDict === void 0 ? void 0 : eventInitDict.total) !== null && _b !== void 0 ? _b : 0);
@@ -839,9 +839,9 @@ class ProgressEventP extends EventP {
839
839
  throw new TypeError(`Failed to construct 'ProgressEvent': Failed to read the '${errField}' property from 'ProgressEventInit': The provided double value is non-finite.`);
840
840
  }
841
841
  }
842
- get lengthComputable() { return getValue(this[state$c].lengthComputable); }
843
- get loaded() { return getValue(this[state$c].loaded); }
844
- get total() { return getValue(this[state$c].total); }
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); }
845
845
  /** @internal */ toString() { return "[object ProgressEvent]"; }
846
846
  /** @internal */ get isPolyfill() { return { symbol: polyfill, hierarchy: ["ProgressEvent", "Event"] }; }
847
847
  }
@@ -859,10 +859,10 @@ function getValue(val) {
859
859
  }
860
860
  function createInnerProgressEvent(target, type, { lengthComputable = false, loaded = 0, total = 0, } = {}) {
861
861
  let event = new ProgressEventP(type);
862
- event[state$c].lengthComputable = lengthComputable;
863
- event[state$c].loaded = loaded;
864
- event[state$c].total = total;
865
- event[state$e].target = target;
862
+ event[state$f].lengthComputable = lengthComputable;
863
+ event[state$f].loaded = loaded;
864
+ event[state$f].total = total;
865
+ event[state$h].target = target;
866
866
  Event_setTrusted(event, true);
867
867
  return event;
868
868
  }
@@ -875,22 +875,22 @@ function emitProcessEvent(target, type, loaded = 0, total = 0) {
875
875
  });
876
876
  EventTarget_fire(target, event);
877
877
  }
878
- const ProgressEventE = g["EventTarget"] ? g["ProgressEvent"] : ProgressEventP;
878
+ g["EventTarget"] ? g["ProgressEvent"] : ProgressEventP;
879
879
 
880
- var _a$7;
880
+ var _a$8;
881
881
  /** @internal */
882
- const state$b = Symbol( /* "FileReaderState" */);
882
+ const state$e = Symbol( /* "FileReaderState" */);
883
883
  class FileReaderP extends EventTargetP {
884
884
  constructor() {
885
885
  super();
886
- this[state$b] = new FileReaderState(this);
886
+ this[state$e] = new FileReaderState(this);
887
887
  }
888
- get readyState() { return this[state$b].readyState; }
889
- get result() { return this[state$b].result; }
890
- get error() { return this[state$b].error; }
888
+ get readyState() { return this[state$e].readyState; }
889
+ get result() { return this[state$e].result; }
890
+ get error() { return this[state$e].error; }
891
891
  abort() {
892
892
  if (this.readyState === FileReaderP.LOADING) {
893
- const s = this[state$b];
893
+ const s = this[state$e];
894
894
  s.readyState = FileReaderP.DONE;
895
895
  s.result = null;
896
896
  s.error = new MPException("An ongoing operation was aborted, typically with a call to abort().", "AbortError");
@@ -899,7 +899,7 @@ class FileReaderP extends EventTargetP {
899
899
  }
900
900
  readAsArrayBuffer(...args) {
901
901
  read$1(this, "readAsArrayBuffer", args, blob => {
902
- this[state$b].result = Blob_toUint8Array(blob).buffer.slice(0);
902
+ this[state$e].result = Blob_toUint8Array(blob).buffer.slice(0);
903
903
  });
904
904
  }
905
905
  readAsBinaryString(...args) {
@@ -910,12 +910,12 @@ class FileReaderP extends EventTargetP {
910
910
  let char = buf[i];
911
911
  str.push(String.fromCharCode(char));
912
912
  }
913
- this[state$b].result = str.join("");
913
+ this[state$e].result = str.join("");
914
914
  });
915
915
  }
916
916
  readAsDataURL(...args) {
917
917
  read$1(this, "readAsDataURL", args, blob => {
918
- this[state$b].result = "data:" + (blob.type || "application/octet-stream") + ";base64," + Uint8Array_toBase64(Blob_toUint8Array(blob));
918
+ this[state$e].result = "data:" + (blob.type || "application/octet-stream") + ";base64," + Uint8Array_toBase64(Blob_toUint8Array(blob));
919
919
  });
920
920
  }
921
921
  readAsText(...args) {
@@ -927,41 +927,41 @@ class FileReaderP extends EventTargetP {
927
927
  console.error(`TypeError: Failed to execute 'readAsText' on 'FileReader': encoding ('${_encoding}') not implemented.`);
928
928
  }
929
929
  }
930
- this[state$b].result = decode$1(Blob_toUint8Array(blob));
930
+ this[state$e].result = decode$1(Blob_toUint8Array(blob));
931
931
  });
932
932
  }
933
- get onabort() { return this[state$b].onabort; }
934
- set onabort(value) { this[state$b].onabort = value; attach$1(this, "abort"); }
935
- get onerror() { return this[state$b].onerror; }
936
- set onerror(value) { this[state$b].onerror = value; attach$1(this, "error"); }
937
- get onload() { return this[state$b].onload; }
938
- set onload(value) { this[state$b].onload = value; attach$1(this, "load"); }
939
- get onloadend() { return this[state$b].onloadend; }
940
- set onloadend(value) { this[state$b].onloadend = value; attach$1(this, "loadend"); }
941
- get onloadstart() { return this[state$b].onloadstart; }
942
- set onloadstart(value) { this[state$b].onloadstart = value; attach$1(this, "loadstart"); }
943
- get onprogress() { return this[state$b].onprogress; }
944
- set onprogress(value) { this[state$b].onprogress = value; attach$1(this, "progress"); }
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"); }
945
945
  /** @internal */ toString() { return "[object FileReader]"; }
946
946
  /** @internal */ get isPolyfill() { return { symbol: polyfill, hierarchy: ["FileReader", "EventTarget"] }; }
947
947
  }
948
- const properties = {
948
+ const properties$1 = {
949
949
  EMPTY: { value: 0, enumerable: true },
950
950
  LOADING: { value: 1, enumerable: true },
951
951
  DONE: { value: 2, enumerable: true },
952
952
  };
953
- Object.defineProperties(FileReaderP, properties);
954
- Object.defineProperties(FileReaderP.prototype, properties);
953
+ Object.defineProperties(FileReaderP, properties$1);
954
+ Object.defineProperties(FileReaderP.prototype, properties$1);
955
955
  Class_setStringTag(FileReaderP, "FileReader");
956
956
  /** @internal */
957
- const _handlers$3 = Symbol();
957
+ const _handlers$4 = Symbol();
958
958
  /** @internal */
959
959
  class FileReaderState {
960
960
  constructor(target) {
961
961
  this.readyState = FileReaderP.EMPTY;
962
962
  this.result = null;
963
963
  this.error = null;
964
- this[_a$7] = getHandlers$3(this);
964
+ this[_a$8] = getHandlers$4(this);
965
965
  this.onabort = null;
966
966
  this.onerror = null;
967
967
  this.onload = null;
@@ -971,14 +971,14 @@ class FileReaderState {
971
971
  this.target = target;
972
972
  }
973
973
  }
974
- _a$7 = _handlers$3;
974
+ _a$8 = _handlers$4;
975
975
  function read$1(reader, kind, args, setResult) {
976
976
  const [blob] = args;
977
977
  checkArgsLength(args, 1, "FileReader", kind);
978
978
  if (!isPolyfillType("Blob", blob)) {
979
979
  throw new TypeError("Failed to execute '" + kind + "' on 'FileReader': parameter 1 is not of type 'Blob'.");
980
980
  }
981
- const s = reader[state$b];
981
+ const s = reader[state$e];
982
982
  s.error = null;
983
983
  s.readyState = FileReaderP.LOADING;
984
984
  emitProcessEvent(s.target, "loadstart", 0, blob.size);
@@ -998,14 +998,14 @@ function read$1(reader, kind, args, setResult) {
998
998
  emitProcessEvent(s.target, "loadend", !!s.result ? blob.size : 0, blob.size);
999
999
  });
1000
1000
  }
1001
- function attach$1(reader, type) {
1002
- const s = reader[state$b];
1001
+ function attach$2(reader, type) {
1002
+ const s = reader[state$e];
1003
1003
  const fnName = ("on" + type);
1004
1004
  const cb = s[fnName];
1005
- const listener = s[_handlers$3][fnName];
1005
+ const listener = s[_handlers$4][fnName];
1006
1006
  attachFn(reader, type, cb, listener);
1007
1007
  }
1008
- function getHandlers$3(s) {
1008
+ function getHandlers$4(s) {
1009
1009
  return {
1010
1010
  onabort: (ev) => { executeFn(s.target, s.onabort, ev); },
1011
1011
  onerror: (ev) => { executeFn(s.target, s.onerror, ev); },
@@ -1017,12 +1017,12 @@ function getHandlers$3(s) {
1017
1017
  }
1018
1018
  const FileReaderE = g["Blob"] ? g["FileReader"] : FileReaderP;
1019
1019
 
1020
- var _a$6;
1021
- /** @internal */ const state$a = Symbol( /* "URLSearchParamsState" */);
1020
+ var _a$7;
1021
+ /** @internal */ const state$d = Symbol( /* "URLSearchParamsState" */);
1022
1022
  const checkArgsFn$2 = (args, required, funcName) => { checkArgsLength(args, required, "URLSearchParams", funcName); };
1023
1023
  class URLSearchParamsP {
1024
1024
  constructor(init) {
1025
- this[state$a] = new URLSearchParamsState();
1025
+ this[state$d] = new URLSearchParamsState();
1026
1026
  if (init !== undefined) {
1027
1027
  if (isObjectType("URLSearchParams", init)) {
1028
1028
  init.forEach((value, name) => { this.append(name, value); }, this);
@@ -1070,18 +1070,18 @@ class URLSearchParamsP {
1070
1070
  }
1071
1071
  }
1072
1072
  }
1073
- get size() { return this[state$a][_urlspArray].length; }
1073
+ get size() { return this[state$d][_urlspArray].length; }
1074
1074
  append(...args) {
1075
1075
  const [name, value] = args;
1076
1076
  checkArgsFn$2(args, 2, "append");
1077
- this[state$a][_urlspArray].push(["" + name, normalizeValue$1(value)]);
1077
+ this[state$d][_urlspArray].push(["" + name, normalizeValue$1(value)]);
1078
1078
  }
1079
1079
  delete(...args) {
1080
1080
  const [name, value] = args;
1081
1081
  checkArgsFn$2(args, 1, "delete");
1082
1082
  let _name = "" + name;
1083
1083
  let index = -1;
1084
- let array = this[state$a][_urlspArray];
1084
+ let array = this[state$d][_urlspArray];
1085
1085
  let result = [];
1086
1086
  for (let i = 0; i < array.length; ++i) {
1087
1087
  let item = array[i];
@@ -1095,14 +1095,14 @@ class URLSearchParamsP {
1095
1095
  result.push(item);
1096
1096
  }
1097
1097
  if (index > -1) {
1098
- this[state$a][_urlspArray] = result;
1098
+ this[state$d][_urlspArray] = result;
1099
1099
  }
1100
1100
  }
1101
1101
  get(...args) {
1102
1102
  const [name] = args;
1103
1103
  checkArgsFn$2(args, 1, "get");
1104
1104
  let _name = "" + name;
1105
- let array = this[state$a][_urlspArray];
1105
+ let array = this[state$d][_urlspArray];
1106
1106
  for (let i = 0; i < array.length; ++i) {
1107
1107
  let item = array[i];
1108
1108
  if (item[0] === _name) {
@@ -1115,7 +1115,7 @@ class URLSearchParamsP {
1115
1115
  const [name] = args;
1116
1116
  checkArgsFn$2(args, 1, "getAll");
1117
1117
  let _name = "" + name;
1118
- let array = this[state$a][_urlspArray];
1118
+ let array = this[state$d][_urlspArray];
1119
1119
  let result = [];
1120
1120
  for (let i = 0; i < array.length; ++i) {
1121
1121
  let item = array[i];
@@ -1129,7 +1129,7 @@ class URLSearchParamsP {
1129
1129
  const [name, value] = args;
1130
1130
  checkArgsFn$2(args, 1, "has");
1131
1131
  let _name = "" + name;
1132
- let array = this[state$a][_urlspArray];
1132
+ let array = this[state$d][_urlspArray];
1133
1133
  for (let i = 0; i < array.length; ++i) {
1134
1134
  let item = array[i];
1135
1135
  if (item[0] === _name) {
@@ -1151,7 +1151,7 @@ class URLSearchParamsP {
1151
1151
  let _name = "" + name;
1152
1152
  let _value = normalizeValue$1(value);
1153
1153
  let index = -1;
1154
- let array = this[state$a][_urlspArray];
1154
+ let array = this[state$d][_urlspArray];
1155
1155
  let result = [];
1156
1156
  for (let i = 0; i < array.length; ++i) {
1157
1157
  let item = array[i];
@@ -1167,10 +1167,10 @@ class URLSearchParamsP {
1167
1167
  if (index === -1) {
1168
1168
  result.push([_name, _value]);
1169
1169
  }
1170
- this[state$a][_urlspArray] = result;
1170
+ this[state$d][_urlspArray] = result;
1171
1171
  }
1172
1172
  sort() {
1173
- this[state$a][_urlspArray].sort((a, b) => a[0] < b[0] ? -1 : a[0] > b[0] ? 1 : 0);
1173
+ this[state$d][_urlspArray].sort((a, b) => a[0] < b[0] ? -1 : a[0] > b[0] ? 1 : 0);
1174
1174
  }
1175
1175
  forEach(...args) {
1176
1176
  const [callbackfn, thisArg] = args;
@@ -1178,26 +1178,26 @@ class URLSearchParamsP {
1178
1178
  if (typeof callbackfn !== "function") {
1179
1179
  throw new TypeError("Failed to execute 'forEach' on 'URLSearchParams': parameter 1 is not of type 'Function'.");
1180
1180
  }
1181
- let array = this[state$a][_urlspArray];
1181
+ let array = this[state$d][_urlspArray];
1182
1182
  for (let i = 0; i < array.length; ++i) {
1183
1183
  let item = array[i];
1184
1184
  callbackfn.call(thisArg, item[1], item[0], this);
1185
1185
  }
1186
1186
  }
1187
1187
  entries() {
1188
- return this[state$a][_urlspArray].map(x => [x[0], x[1]]).values();
1188
+ return this[state$d][_urlspArray].map(x => [x[0], x[1]]).values();
1189
1189
  }
1190
1190
  keys() {
1191
- return this[state$a][_urlspArray].map(x => x[0]).values();
1191
+ return this[state$d][_urlspArray].map(x => x[0]).values();
1192
1192
  }
1193
1193
  values() {
1194
- return this[state$a][_urlspArray].map(x => x[1]).values();
1194
+ return this[state$d][_urlspArray].map(x => x[1]).values();
1195
1195
  }
1196
1196
  [Symbol.iterator]() {
1197
1197
  return this.entries();
1198
1198
  }
1199
1199
  toString() {
1200
- let array = this[state$a][_urlspArray];
1200
+ let array = this[state$d][_urlspArray];
1201
1201
  let result = [];
1202
1202
  for (let i = 0; i < array.length; ++i) {
1203
1203
  let item = array[i];
@@ -1214,10 +1214,10 @@ const _urlspArray = Symbol();
1214
1214
  /** @internal */
1215
1215
  class URLSearchParamsState {
1216
1216
  constructor() {
1217
- this[_a$6] = [];
1217
+ this[_a$7] = [];
1218
1218
  }
1219
1219
  }
1220
- _a$6 = _urlspArray;
1220
+ _a$7 = _urlspArray;
1221
1221
  function normalizeValue$1(value) {
1222
1222
  return typeof value === "string" ? value : (value !== null && value !== undefined && typeof value.toString === "function"
1223
1223
  ? value.toString()
@@ -1242,8 +1242,8 @@ function decode(str) {
1242
1242
  }
1243
1243
  const URLSearchParamsE = g["URLSearchParams"] || URLSearchParamsP;
1244
1244
 
1245
- var _a$5;
1246
- /** @internal */ const state$9 = Symbol( /* "FormDataState" */);
1245
+ var _a$6;
1246
+ /** @internal */ const state$c = Symbol( /* "FormDataState" */);
1247
1247
  const checkArgsFn$1 = (args, required, funcName) => { checkArgsLength(args, required, "FormData", funcName); };
1248
1248
  class FormDataP {
1249
1249
  constructor(form, submitter) {
@@ -1257,19 +1257,19 @@ class FormDataP {
1257
1257
  console.error("TypeError: Failed to construct 'FormData': parameter 1 and parameter 2 not implemented.");
1258
1258
  }
1259
1259
  }
1260
- this[state$9] = new FormDataState();
1260
+ this[state$c] = new FormDataState();
1261
1261
  }
1262
1262
  append(...args) {
1263
1263
  const [name, value, filename] = args;
1264
1264
  checkArgsFn$1(args, 2, "append");
1265
- this[state$9][_formData].push(normalizeArgs(name, value, filename));
1265
+ this[state$c][_formData].push(normalizeArgs(name, value, filename));
1266
1266
  }
1267
1267
  delete(...args) {
1268
1268
  const [name] = args;
1269
1269
  checkArgsFn$1(args, 1, "delete");
1270
1270
  let _name = "" + name;
1271
1271
  let index = -1;
1272
- let array = this[state$9][_formData];
1272
+ let array = this[state$c][_formData];
1273
1273
  let result = [];
1274
1274
  for (let i = 0; i < array.length; ++i) {
1275
1275
  let item = array[i];
@@ -1280,14 +1280,14 @@ class FormDataP {
1280
1280
  result.push(item);
1281
1281
  }
1282
1282
  if (index > -1) {
1283
- this[state$9][_formData] = result;
1283
+ this[state$c][_formData] = result;
1284
1284
  }
1285
1285
  }
1286
1286
  get(...args) {
1287
1287
  const [name] = args;
1288
1288
  checkArgsFn$1(args, 1, "get");
1289
1289
  let _name = "" + name;
1290
- let array = this[state$9][_formData];
1290
+ let array = this[state$c][_formData];
1291
1291
  for (let i = 0; i < array.length; ++i) {
1292
1292
  let item = array[i];
1293
1293
  if (item[0] === _name) {
@@ -1300,7 +1300,7 @@ class FormDataP {
1300
1300
  const [name] = args;
1301
1301
  checkArgsFn$1(args, 1, "getAll");
1302
1302
  let _name = "" + name;
1303
- let array = this[state$9][_formData];
1303
+ let array = this[state$c][_formData];
1304
1304
  let result = [];
1305
1305
  for (let i = 0; i < array.length; ++i) {
1306
1306
  let item = array[i];
@@ -1314,7 +1314,7 @@ class FormDataP {
1314
1314
  const [name] = args;
1315
1315
  checkArgsFn$1(args, 1, "has");
1316
1316
  let _name = "" + name;
1317
- let array = this[state$9][_formData];
1317
+ let array = this[state$c][_formData];
1318
1318
  for (let i = 0; i < array.length; ++i) {
1319
1319
  let item = array[i];
1320
1320
  if (item[0] === _name) {
@@ -1329,7 +1329,7 @@ class FormDataP {
1329
1329
  let _name = "" + name;
1330
1330
  let _args = normalizeArgs(name, value, filename);
1331
1331
  let index = -1;
1332
- let array = this[state$9][_formData];
1332
+ let array = this[state$c][_formData];
1333
1333
  let result = [];
1334
1334
  for (let i = 0; i < array.length; ++i) {
1335
1335
  let item = array[i];
@@ -1345,7 +1345,7 @@ class FormDataP {
1345
1345
  if (index === -1) {
1346
1346
  result.push(_args);
1347
1347
  }
1348
- this[state$9][_formData] = result;
1348
+ this[state$c][_formData] = result;
1349
1349
  }
1350
1350
  forEach(...args) {
1351
1351
  const [callbackfn, thisArg] = args;
@@ -1353,20 +1353,20 @@ class FormDataP {
1353
1353
  if (typeof callbackfn !== "function") {
1354
1354
  throw new TypeError("Failed to execute 'forEach' on 'FormData': parameter 1 is not of type 'Function'.");
1355
1355
  }
1356
- let array = this[state$9][_formData];
1356
+ let array = this[state$c][_formData];
1357
1357
  for (let i = 0; i < array.length; ++i) {
1358
1358
  let item = array[i];
1359
1359
  callbackfn.call(thisArg, item[1], item[0], thisArg);
1360
1360
  }
1361
1361
  }
1362
1362
  entries() {
1363
- return this[state$9][_formData].map(x => [x[0], x[1]]).values();
1363
+ return this[state$c][_formData].map(x => [x[0], x[1]]).values();
1364
1364
  }
1365
1365
  keys() {
1366
- return this[state$9][_formData].map(x => x[0]).values();
1366
+ return this[state$c][_formData].map(x => x[0]).values();
1367
1367
  }
1368
1368
  values() {
1369
- return this[state$9][_formData].map(x => x[1]).values();
1369
+ return this[state$c][_formData].map(x => x[1]).values();
1370
1370
  }
1371
1371
  [Symbol.iterator]() {
1372
1372
  return this.entries();
@@ -1380,17 +1380,17 @@ const _formData = Symbol();
1380
1380
  /** @internal */
1381
1381
  class FormDataState {
1382
1382
  constructor() {
1383
- this[_a$5] = [];
1383
+ this[_a$6] = [];
1384
1384
  }
1385
1385
  }
1386
- _a$5 = _formData;
1386
+ _a$6 = _formData;
1387
1387
  /** @internal */
1388
1388
  function FormData_toBlob(formData) {
1389
1389
  const boundary = "----formdata-mphttpx-" + Math.random();
1390
1390
  const p = `--${boundary}\r\nContent-Disposition: form-data; name="`;
1391
1391
  let chunks = [];
1392
- for (let i = 0; i < formData[state$9][_formData].length; ++i) {
1393
- let pair = formData[state$9][_formData][i];
1392
+ for (let i = 0; i < formData[state$c][_formData].length; ++i) {
1393
+ let pair = formData[state$c][_formData][i];
1394
1394
  let name = pair[0];
1395
1395
  let value = pair[1];
1396
1396
  if (typeof value === "string") {
@@ -1480,12 +1480,12 @@ function createFormDataFromBinaryText(text, boundary) {
1480
1480
  }
1481
1481
  const FormDataE = g["FormData"] || FormDataP;
1482
1482
 
1483
- var _a$4, _b$1;
1484
- /** @internal */ const state$8 = Symbol( /* "HeadersState" */);
1483
+ var _a$5, _b$2;
1484
+ /** @internal */ const state$b = Symbol( /* "HeadersState" */);
1485
1485
  const checkArgsFn = (args, required, funcName) => { checkArgsLength(args, required, "Headers", funcName); };
1486
1486
  class HeadersP {
1487
1487
  constructor(init) {
1488
- this[state$8] = new HeadersState();
1488
+ this[state$b] = new HeadersState();
1489
1489
  if (init !== undefined) {
1490
1490
  if (isObjectType("Headers", init)) {
1491
1491
  init.forEach((value, name) => { this.append(name, value); }, this);
@@ -1516,15 +1516,15 @@ class HeadersP {
1516
1516
  }
1517
1517
  }
1518
1518
  }
1519
- this[state$8][_initialized] = true;
1519
+ this[state$b][_initialized] = true;
1520
1520
  }
1521
1521
  append(...args) {
1522
1522
  const [name, value] = args;
1523
1523
  checkArgsFn(args, 2, "append");
1524
- let _name = normalizeName(name, throwsFn(this[state$8][_initialized] ? "append" : ""));
1524
+ let _name = normalizeName(name, throwsFn(this[state$b][_initialized] ? "append" : ""));
1525
1525
  let _value = normalizeValue(value);
1526
1526
  let index = -1;
1527
- let array = this[state$8][_headersArray];
1527
+ let array = this[state$b][_headersArray];
1528
1528
  for (let i = 0; i < array.length; ++i) {
1529
1529
  let item = array[i];
1530
1530
  if (item[0] === _name) {
@@ -1542,7 +1542,7 @@ class HeadersP {
1542
1542
  checkArgsFn(args, 1, "delete");
1543
1543
  let _name = normalizeName(name, throwsFn("delete"));
1544
1544
  let index = -1;
1545
- let array = this[state$8][_headersArray];
1545
+ let array = this[state$b][_headersArray];
1546
1546
  let result = [];
1547
1547
  for (let i = 0; i < array.length; ++i) {
1548
1548
  let item = array[i];
@@ -1553,14 +1553,14 @@ class HeadersP {
1553
1553
  result.push(item);
1554
1554
  }
1555
1555
  if (index > -1) {
1556
- this[state$8][_headersArray] = result;
1556
+ this[state$b][_headersArray] = result;
1557
1557
  }
1558
1558
  }
1559
1559
  get(...args) {
1560
1560
  const [name] = args;
1561
1561
  checkArgsFn(args, 1, "get");
1562
1562
  let _name = normalizeName(name, throwsFn("get"));
1563
- let array = this[state$8][_headersArray];
1563
+ let array = this[state$b][_headersArray];
1564
1564
  for (let i = 0; i < array.length; ++i) {
1565
1565
  let item = array[i];
1566
1566
  if (item[0] === _name) {
@@ -1577,7 +1577,7 @@ class HeadersP {
1577
1577
  const [name] = args;
1578
1578
  checkArgsFn(args, 1, "has");
1579
1579
  let _name = normalizeName(name, throwsFn("has"));
1580
- let array = this[state$8][_headersArray];
1580
+ let array = this[state$b][_headersArray];
1581
1581
  for (let i = 0; i < array.length; ++i) {
1582
1582
  let item = array[i];
1583
1583
  if (item[0] === _name) {
@@ -1592,7 +1592,7 @@ class HeadersP {
1592
1592
  let _name = normalizeName(name, throwsFn("set"));
1593
1593
  let _value = normalizeValue(value);
1594
1594
  let index = -1;
1595
- let array = this[state$8][_headersArray];
1595
+ let array = this[state$b][_headersArray];
1596
1596
  for (let i = 0; i < array.length; ++i) {
1597
1597
  let item = array[i];
1598
1598
  if (item[0] === _name) {
@@ -1611,20 +1611,20 @@ class HeadersP {
1611
1611
  if (typeof callbackfn !== "function") {
1612
1612
  throw new TypeError("Failed to execute 'forEach' on 'Headers': parameter 1 is not of type 'Function'.");
1613
1613
  }
1614
- let array = this[state$8][_headersArray];
1614
+ let array = this[state$b][_headersArray];
1615
1615
  for (let i = 0; i < array.length; ++i) {
1616
1616
  let item = array[i];
1617
1617
  callbackfn.call(thisArg, item[1], item[0], this);
1618
1618
  }
1619
1619
  }
1620
1620
  entries() {
1621
- return this[state$8][_headersArray].map(x => [x[0], x[1]]).values();
1621
+ return this[state$b][_headersArray].map(x => [x[0], x[1]]).values();
1622
1622
  }
1623
1623
  keys() {
1624
- return this[state$8][_headersArray].map(x => x[0]).values();
1624
+ return this[state$b][_headersArray].map(x => x[0]).values();
1625
1625
  }
1626
1626
  values() {
1627
- return this[state$8][_headersArray].map(x => x[1]).values();
1627
+ return this[state$b][_headersArray].map(x => x[1]).values();
1628
1628
  }
1629
1629
  [Symbol.iterator]() {
1630
1630
  return this.entries();
@@ -1638,11 +1638,11 @@ Class_setStringTag(HeadersP, "Headers");
1638
1638
  /** @internal */
1639
1639
  class HeadersState {
1640
1640
  constructor() {
1641
- this[_a$4] = false;
1642
- this[_b$1] = [];
1641
+ this[_a$5] = false;
1642
+ this[_b$2] = [];
1643
1643
  }
1644
1644
  }
1645
- _a$4 = _initialized, _b$1 = _headersArray;
1645
+ _a$5 = _initialized, _b$2 = _headersArray;
1646
1646
  function throwsFn(kind) {
1647
1647
  return () => {
1648
1648
  throw new TypeError(`Failed to ${kind ? ("execute '" + kind + "' on") : "construct"} 'Headers': Invalid name`);
@@ -1686,23 +1686,23 @@ function parseHeaders(rawHeaders) {
1686
1686
  }
1687
1687
  const HeadersE = g["Headers"] || HeadersP;
1688
1688
 
1689
- var _a$3;
1690
- /** @internal */ const state$7 = Symbol( /* "BodyState" */);
1689
+ var _a$4;
1690
+ /** @internal */ const state$a = Symbol( /* "BodyState" */);
1691
1691
  class BodyImpl {
1692
1692
  /** @internal */
1693
1693
  constructor() {
1694
1694
  if (new.target === BodyImpl) {
1695
1695
  throw new TypeError("Failed to construct 'Body': Illegal constructor");
1696
1696
  }
1697
- this[state$7] = new BodyState();
1697
+ this[state$a] = new BodyState();
1698
1698
  }
1699
1699
  get body() {
1700
- if (!this[state$7][_body]) {
1700
+ if (!this[state$a][_body]) {
1701
1701
  return null;
1702
1702
  }
1703
- throw new TypeError(`Failed to access 'body' on '${this[state$7].name}': property not implemented.`);
1703
+ throw new TypeError(`Failed to access 'body' on '${this[state$a].name}': property not implemented.`);
1704
1704
  }
1705
- get bodyUsed() { return this[state$7].bodyUsed; }
1705
+ get bodyUsed() { return this[state$a].bodyUsed; }
1706
1706
  ;
1707
1707
  arrayBuffer() {
1708
1708
  const kind = "arrayBuffer";
@@ -1739,23 +1739,23 @@ class BodyState {
1739
1739
  constructor() {
1740
1740
  this.name = "Body";
1741
1741
  this.bodyUsed = false;
1742
- this[_a$3] = "";
1742
+ this[_a$4] = "";
1743
1743
  }
1744
1744
  }
1745
- _a$3 = _body;
1745
+ _a$4 = _body;
1746
1746
  /** @internal */
1747
1747
  function Body_init(body, payload) {
1748
1748
  const b = body;
1749
1749
  if (isObjectType("ReadableStream", payload)) {
1750
- throw new TypeError(`Failed to construct '${b[state$7].name}': ReadableStream not implemented.`);
1750
+ throw new TypeError(`Failed to construct '${b[state$a].name}': ReadableStream not implemented.`);
1751
1751
  }
1752
- b[state$7][_body] = convert(payload, true, type => { if (!b.headers.has("Content-Type")) {
1752
+ b[state$a][_body] = convert(payload, true, type => { if (!b.headers.has("Content-Type")) {
1753
1753
  b.headers.set("Content-Type", type);
1754
1754
  } });
1755
1755
  }
1756
1756
  /** @internal */
1757
1757
  function Body_toPayload(body) {
1758
- return body[state$7][_body];
1758
+ return body[state$a][_body];
1759
1759
  }
1760
1760
  function read(body, kind) {
1761
1761
  return new Promise((resolve, reject) => {
@@ -1768,7 +1768,7 @@ function read(body, kind) {
1768
1768
  });
1769
1769
  }
1770
1770
  function readSync(body, kind) {
1771
- const payload = body[state$7][_body];
1771
+ const payload = body[state$a][_body];
1772
1772
  if (kind === "arrayBuffer") {
1773
1773
  return convertBack("arraybuffer", payload);
1774
1774
  }
@@ -1805,7 +1805,7 @@ function readSync(body, kind) {
1805
1805
  }
1806
1806
  }
1807
1807
  function consumed(body, kind) {
1808
- const s = body[state$7];
1808
+ const s = body[state$a];
1809
1809
  if (!s[_body])
1810
1810
  return;
1811
1811
  if (s.bodyUsed) {
@@ -1885,9 +1885,9 @@ function convertBack(type, data) {
1885
1885
  }
1886
1886
  }
1887
1887
 
1888
- var _a$2;
1888
+ var _a$3;
1889
1889
  /** @internal */
1890
- const state$6 = Symbol( /* "AbortSignalState" */);
1890
+ const state$9 = Symbol( /* "AbortSignalState" */);
1891
1891
  class AbortSignalP extends EventTargetP {
1892
1892
  static abort(reason) {
1893
1893
  let signal = createAbortSignal();
@@ -1944,40 +1944,40 @@ class AbortSignalP extends EventTargetP {
1944
1944
  throw new TypeError("Failed to construct 'AbortSignal': Illegal constructor");
1945
1945
  }
1946
1946
  super();
1947
- this[state$6] = new AbortSignalState(this);
1947
+ this[state$9] = new AbortSignalState(this);
1948
1948
  }
1949
- get aborted() { return this[state$6].aborted; }
1950
- get reason() { return this[state$6].reason; }
1949
+ get aborted() { return this[state$9].aborted; }
1950
+ get reason() { return this[state$9].reason; }
1951
1951
  throwIfAborted() {
1952
1952
  if (this.aborted) {
1953
1953
  throw this.reason;
1954
1954
  }
1955
1955
  }
1956
- get onabort() { return this[state$6].onabort; }
1956
+ get onabort() { return this[state$9].onabort; }
1957
1957
  set onabort(value) {
1958
- this[state$6].onabort = value;
1959
- attachFn(this, "abort", value, this[state$6][_handlers$2].onabort);
1958
+ this[state$9].onabort = value;
1959
+ attachFn(this, "abort", value, this[state$9][_handlers$3].onabort);
1960
1960
  }
1961
1961
  /** @internal */ toString() { return "[object AbortSignal]"; }
1962
1962
  /** @internal */ get isPolyfill() { return { symbol: polyfill, hierarchy: ["AbortSignal", "EventTarget"] }; }
1963
1963
  }
1964
1964
  Class_setStringTag(AbortSignalP, "AbortSignal");
1965
1965
  /** @internal */
1966
- const _handlers$2 = Symbol();
1966
+ const _handlers$3 = Symbol();
1967
1967
  /** @internal */
1968
1968
  class AbortSignalState {
1969
1969
  constructor(target) {
1970
1970
  this.aborted = false;
1971
1971
  this.reason = undefined;
1972
- this[_a$2] = getHandlers$2(this);
1972
+ this[_a$3] = getHandlers$3(this);
1973
1973
  this.onabort = null;
1974
1974
  this.target = target;
1975
1975
  }
1976
1976
  }
1977
- _a$2 = _handlers$2;
1977
+ _a$3 = _handlers$3;
1978
1978
  /** @internal */
1979
1979
  function AbortSignal_abort(signal, reason, notify = true, isTrusted = true) {
1980
- const s = signal[state$6];
1980
+ const s = signal[state$9];
1981
1981
  if (!s.aborted) {
1982
1982
  s.aborted = true;
1983
1983
  s.reason = reason !== null && reason !== void 0 ? reason : (new MPException("signal is aborted without reason", "AbortError"));
@@ -1987,7 +1987,7 @@ function AbortSignal_abort(signal, reason, notify = true, isTrusted = true) {
1987
1987
  }
1988
1988
  }
1989
1989
  }
1990
- function getHandlers$2(s) {
1990
+ function getHandlers$3(s) {
1991
1991
  return {
1992
1992
  onabort: (ev) => { executeFn(s.target, s.onabort, ev); },
1993
1993
  };
@@ -1995,21 +1995,21 @@ function getHandlers$2(s) {
1995
1995
  /** @internal */
1996
1996
  function createAbortSignal() {
1997
1997
  let signal = Object.create(AbortSignalP.prototype);
1998
- signal[state$d] = new EventTargetState(signal);
1999
- signal[state$6] = new AbortSignalState(signal);
1998
+ signal[state$g] = new EventTargetState(signal);
1999
+ signal[state$9] = new AbortSignalState(signal);
2000
2000
  return signal;
2001
2001
  }
2002
2002
  const AbortSignalE = g["AbortSignal"] || AbortSignalP;
2003
2003
 
2004
2004
  /** @internal */
2005
- const state$5 = Symbol( /* "AbortControllerState" */);
2005
+ const state$8 = Symbol( /* "AbortControllerState" */);
2006
2006
  class AbortControllerP {
2007
2007
  constructor() {
2008
- this[state$5] = new AbortControllerState();
2008
+ this[state$8] = new AbortControllerState();
2009
2009
  }
2010
- get signal() { return this[state$5].signal; }
2010
+ get signal() { return this[state$8].signal; }
2011
2011
  abort(reason) {
2012
- AbortSignal_abort(this[state$5].signal, reason);
2012
+ AbortSignal_abort(this[state$8].signal, reason);
2013
2013
  }
2014
2014
  /** @internal */ toString() { return "[object AbortController]"; }
2015
2015
  /** @internal */ get isPolyfill() { return { symbol: polyfill, hierarchy: ["AbortController"] }; }
@@ -2023,15 +2023,15 @@ class AbortControllerState {
2023
2023
  }
2024
2024
  const AbortControllerE = g["AbortController"] || AbortControllerP;
2025
2025
 
2026
- /** @internal */ const state$4 = Symbol( /* "RequestState" */);
2026
+ /** @internal */ const state$7 = Symbol( /* "RequestState" */);
2027
2027
  class RequestP extends BodyImpl {
2028
2028
  constructor(...args) {
2029
2029
  const [input, init] = args;
2030
2030
  checkArgsLength(args, 1, "Request");
2031
2031
  super();
2032
- this[state$7].name = "Request";
2033
- this[state$4] = new RequestState();
2034
- const s = this[state$4];
2032
+ this[state$a].name = "Request";
2033
+ this[state$7] = new RequestState();
2034
+ const s = this[state$7];
2035
2035
  let _init = init !== null && init !== void 0 ? init : {};
2036
2036
  if (typeof _init !== "object") {
2037
2037
  throw new TypeError("Failed to construct 'Request': The provided value is not of type 'RequestInit'.");
@@ -2048,7 +2048,7 @@ class RequestP extends BodyImpl {
2048
2048
  }
2049
2049
  s.method = input.method;
2050
2050
  s.mode = input.mode;
2051
- let inputSignal = input[state$4].signal;
2051
+ let inputSignal = input[state$7].signal;
2052
2052
  if (inputSignal) {
2053
2053
  s.signal = inputSignal;
2054
2054
  }
@@ -2056,7 +2056,7 @@ class RequestP extends BodyImpl {
2056
2056
  let payload = Body_toPayload(input);
2057
2057
  if (!body && payload !== "") {
2058
2058
  body = payload;
2059
- input[state$7].bodyUsed = true;
2059
+ input[state$a].bodyUsed = true;
2060
2060
  }
2061
2061
  }
2062
2062
  else {
@@ -2100,31 +2100,31 @@ class RequestP extends BodyImpl {
2100
2100
  }
2101
2101
  }
2102
2102
  }
2103
- get cache() { return this[state$4].cache; }
2104
- get credentials() { return this[state$4].credentials; }
2105
- get destination() { return this[state$4].destination; }
2103
+ get cache() { return this[state$7].cache; }
2104
+ get credentials() { return this[state$7].credentials; }
2105
+ get destination() { return this[state$7].destination; }
2106
2106
  get headers() {
2107
- const s = this[state$4];
2107
+ const s = this[state$7];
2108
2108
  if (!s.headers) {
2109
2109
  s.headers = new HeadersP();
2110
2110
  }
2111
2111
  return s.headers;
2112
2112
  }
2113
- get integrity() { return this[state$4].integrity; }
2114
- get keepalive() { return this[state$4].keepalive; }
2115
- get method() { return this[state$4].method; }
2116
- get mode() { return this[state$4].mode; }
2117
- get redirect() { return this[state$4].redirect; }
2118
- get referrer() { return this[state$4].referrer; }
2119
- get referrerPolicy() { return this[state$4].referrerPolicy; }
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; }
2120
2120
  get signal() {
2121
- const s = this[state$4];
2121
+ const s = this[state$7];
2122
2122
  if (!s.signal) {
2123
2123
  s.signal = (new AbortControllerP()).signal;
2124
2124
  }
2125
2125
  return s.signal;
2126
2126
  }
2127
- get url() { return this[state$4].url; }
2127
+ get url() { return this[state$7].url; }
2128
2128
  clone() {
2129
2129
  var _a;
2130
2130
  if (this.bodyUsed) {
@@ -2163,7 +2163,7 @@ const RequestE = g["Request"] || RequestP;
2163
2163
 
2164
2164
  // @ts-nocheck
2165
2165
  /** @internal */
2166
- const mp$2 = (() => {
2166
+ const mp$3 = (() => {
2167
2167
  let u = "undefined", r = "request", f = "function";
2168
2168
  let mp;
2169
2169
  mp =
@@ -2188,7 +2188,7 @@ const mp$2 = (() => {
2188
2188
  return mp;
2189
2189
  })();
2190
2190
 
2191
- const request = mp$2 ? mp$2.request : function errorRequest(options) {
2191
+ const request = mp$3 ? mp$3.request : function errorRequest(options) {
2192
2192
  const errMsg = "NOT_SUPPORTED_ERR";
2193
2193
  const errno = 9;
2194
2194
  const err = {
@@ -2215,8 +2215,8 @@ const request = mp$2 ? mp$2.request : function errorRequest(options) {
2215
2215
  throw new ReferenceError("request is not defined");
2216
2216
  };
2217
2217
 
2218
- var _a$1;
2219
- /** @internal */ const state$3 = Symbol( /* "XMLHttpRequestEventTargetState" */);
2218
+ var _a$2;
2219
+ /** @internal */ const state$6 = Symbol( /* "XMLHttpRequestEventTargetState" */);
2220
2220
  class XMLHttpRequestEventTargetP extends EventTargetP {
2221
2221
  /** @internal */
2222
2222
  constructor() {
@@ -2224,35 +2224,35 @@ class XMLHttpRequestEventTargetP extends EventTargetP {
2224
2224
  throw new TypeError("Failed to construct 'XMLHttpRequestEventTarget': Illegal constructor");
2225
2225
  }
2226
2226
  super();
2227
- this[state$3] = new XMLHttpRequestEventTargetState(this);
2228
- }
2229
- get onabort() { return this[state$3].onabort; }
2230
- set onabort(value) { this[state$3].onabort = value; attach(this, "abort"); }
2231
- get onerror() { return this[state$3].onerror; }
2232
- set onerror(value) { this[state$3].onerror = value; attach(this, "error"); }
2233
- get onload() { return this[state$3].onload; }
2234
- set onload(value) { this[state$3].onload = value; attach(this, "load"); }
2235
- get onloadend() { return this[state$3].onloadend; }
2236
- set onloadend(value) { this[state$3].onloadend = value; attach(this, "loadend"); }
2237
- get onloadstart() { return this[state$3].onloadstart; }
2238
- set onloadstart(value) { this[state$3].onloadstart = value; attach(this, "loadstart"); }
2239
- get onprogress() { return this[state$3].onprogress; }
2240
- set onprogress(value) { this[state$3].onprogress = value; attach(this, "progress"); }
2241
- get ontimeout() { return this[state$3].ontimeout; }
2242
- set ontimeout(value) { this[state$3].ontimeout = value; attach(this, "timeout"); }
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"); }
2243
2243
  /** @internal */ toString() { return "[object XMLHttpRequestEventTarget]"; }
2244
2244
  /** @internal */ get isPolyfill() { return { symbol: polyfill, hierarchy: ["XMLHttpRequestEventTarget", "EventTarget"] }; }
2245
2245
  }
2246
2246
  Class_setStringTag(XMLHttpRequestEventTargetP, "XMLHttpRequestEventTarget");
2247
2247
  /** @internal */
2248
- const _handlers$1 = Symbol();
2248
+ const _handlers$2 = Symbol();
2249
2249
  /** @internal */
2250
2250
  class XMLHttpRequestEventTargetState {
2251
2251
  /**
2252
2252
  * @param _target XMLHttpRequestEventTarget
2253
2253
  */
2254
2254
  constructor(_target) {
2255
- this[_a$1] = getHandlers$1(this);
2255
+ this[_a$2] = getHandlers$2(this);
2256
2256
  this.onabort = null;
2257
2257
  this.onerror = null;
2258
2258
  this.onload = null;
@@ -2263,15 +2263,15 @@ class XMLHttpRequestEventTargetState {
2263
2263
  this.target = _target;
2264
2264
  }
2265
2265
  }
2266
- _a$1 = _handlers$1;
2267
- function attach(target, type) {
2268
- const s = target[state$3];
2266
+ _a$2 = _handlers$2;
2267
+ function attach$1(target, type) {
2268
+ const s = target[state$6];
2269
2269
  const fnName = ("on" + type);
2270
2270
  const cb = s[fnName];
2271
- const listener = s[_handlers$1][fnName];
2271
+ const listener = s[_handlers$2][fnName];
2272
2272
  attachFn(target, type, cb, listener);
2273
2273
  }
2274
- function getHandlers$1(s) {
2274
+ function getHandlers$2(s) {
2275
2275
  return {
2276
2276
  onabort: (ev) => { executeFn(s.target, s.onabort, ev); },
2277
2277
  onerror: (ev) => { executeFn(s.target, s.onerror, ev); },
@@ -2378,50 +2378,50 @@ Class_setStringTag(XMLHttpRequestUploadP, "XMLHttpRequestUpload");
2378
2378
  /** @internal */
2379
2379
  function createXMLHttpRequestUpload() {
2380
2380
  let upload = Object.create(XMLHttpRequestUploadP.prototype);
2381
- upload[state$d] = new EventTargetState(upload);
2382
- upload[state$3] = new XMLHttpRequestEventTargetState(upload);
2381
+ upload[state$g] = new EventTargetState(upload);
2382
+ upload[state$6] = new XMLHttpRequestEventTargetState(upload);
2383
2383
  return upload;
2384
2384
  }
2385
2385
 
2386
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
2387
- const mp$1 = { request: request };
2388
- const setRequest = (request) => { mp$1.request = request; };
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; };
2389
2389
  /** @internal */
2390
- const state$2 = Symbol( /* "XMLHttpRequestState" */);
2390
+ const state$5 = Symbol( /* "XMLHttpRequestState" */);
2391
2391
  class XMLHttpRequestImpl extends XMLHttpRequestEventTargetP {
2392
2392
  constructor() {
2393
2393
  super();
2394
- this[state$2] = new XMLHttpRequestState(this);
2394
+ this[state$5] = new XMLHttpRequestState(this);
2395
2395
  }
2396
- get readyState() { return this[state$2].readyState; }
2397
- get response() { return this[state$2].response; }
2396
+ get readyState() { return this[state$5].readyState; }
2397
+ get response() { return this[state$5].response; }
2398
2398
  get responseText() { return (!this.responseType || this.responseType === "text") ? this.response : ""; }
2399
- get responseType() { return this[state$2].responseType; }
2400
- set responseType(value) { this[state$2].responseType = normalizeResponseType(value); }
2401
- get responseURL() { return this[state$2].responseURL; }
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; }
2402
2402
  get responseXML() { return null; }
2403
- get status() { return this[state$2].status; }
2403
+ get status() { return this[state$5].status; }
2404
2404
  get statusText() {
2405
2405
  if (this.readyState === XMLHttpRequestImpl.UNSENT || this.readyState === XMLHttpRequestImpl.OPENED)
2406
2406
  return "";
2407
- return this[state$2].statusText || statusTextMap(this.status);
2407
+ return this[state$5].statusText || statusTextMap(this.status);
2408
2408
  }
2409
- get timeout() { return this[state$2].timeout; }
2410
- set timeout(value) { this[state$2].timeout = value > 0 ? value : 0; }
2409
+ get timeout() { return this[state$5].timeout; }
2410
+ set timeout(value) { this[state$5].timeout = value > 0 ? value : 0; }
2411
2411
  get upload() {
2412
- const s = this[state$2];
2412
+ const s = this[state$5];
2413
2413
  if (!s.upload) {
2414
2414
  s.upload = createXMLHttpRequestUpload();
2415
2415
  }
2416
2416
  return s.upload;
2417
2417
  }
2418
- get withCredentials() { return this[state$2].withCredentials; }
2419
- set withCredentials(value) { this[state$2].withCredentials = !!value; }
2418
+ get withCredentials() { return this[state$5].withCredentials; }
2419
+ set withCredentials(value) { this[state$5].withCredentials = !!value; }
2420
2420
  abort() {
2421
2421
  clearRequest(this);
2422
2422
  }
2423
2423
  getAllResponseHeaders() {
2424
- const headers = this[state$2][_responseHeaders];
2424
+ const headers = this[state$5][_responseHeaders];
2425
2425
  if (!headers)
2426
2426
  return "";
2427
2427
  let result = [];
@@ -2431,9 +2431,9 @@ class XMLHttpRequestImpl extends XMLHttpRequestEventTargetP {
2431
2431
  getResponseHeader(...args) {
2432
2432
  const [name] = args;
2433
2433
  checkArgsLength(args, 1, "XMLHttpRequest", "getResponseHeader");
2434
- if (!this[state$2][_responseHeaders])
2434
+ if (!this[state$5][_responseHeaders])
2435
2435
  return null;
2436
- return this[state$2][_responseHeaders].get(name);
2436
+ return this[state$5][_responseHeaders].get(name);
2437
2437
  }
2438
2438
  open(...args) {
2439
2439
  const [method, url, async = true, username = null, password = null] = args;
@@ -2441,7 +2441,7 @@ class XMLHttpRequestImpl extends XMLHttpRequestEventTargetP {
2441
2441
  if (!async) {
2442
2442
  console.warn("Synchronous XMLHttpRequest is not supported because of its detrimental effects to the end user's experience.");
2443
2443
  }
2444
- const s = this[state$2];
2444
+ const s = this[state$5];
2445
2445
  clearRequest(this, false);
2446
2446
  s[_method] = normalizeMethod(method);
2447
2447
  s[_requestURL] = "" + url;
@@ -2459,12 +2459,12 @@ class XMLHttpRequestImpl extends XMLHttpRequestEventTargetP {
2459
2459
  overrideMimeType(...args) {
2460
2460
  const [mime] = args;
2461
2461
  checkArgsLength(args, 1, "XMLHttpRequest", "overrideMimeType");
2462
- if (this[state$2][_inAfterOpenBeforeSend]) {
2462
+ if (this[state$5][_inAfterOpenBeforeSend]) {
2463
2463
  console.error(`TypeError: Failed to execute 'overrideMimeType' on 'XMLHttpRequest': mimeType ('${mime}') not implemented.`);
2464
2464
  }
2465
2465
  }
2466
2466
  send(body) {
2467
- const s = this[state$2];
2467
+ const s = this[state$5];
2468
2468
  if (!s[_inAfterOpenBeforeSend] || s.readyState !== XMLHttpRequestImpl.OPENED) {
2469
2469
  throw new MPException("Failed to execute 'send' on 'XMLHttpRequest': The object's state must be OPENED.", "InvalidStateError");
2470
2470
  }
@@ -2497,7 +2497,7 @@ class XMLHttpRequestImpl extends XMLHttpRequestEventTargetP {
2497
2497
  };
2498
2498
  // Alipay Mini Program
2499
2499
  options.headers = options.header;
2500
- s[_requestTask] = mp$1.request(options);
2500
+ s[_requestTask] = mp$2.request(options);
2501
2501
  emitProcessEvent(this, "loadstart");
2502
2502
  if (processContentLength && s.upload) {
2503
2503
  emitProcessEvent(this.upload, "loadstart", 0, contentLength);
@@ -2524,7 +2524,7 @@ class XMLHttpRequestImpl extends XMLHttpRequestEventTargetP {
2524
2524
  setRequestHeader(...args) {
2525
2525
  const [name, value] = args;
2526
2526
  checkArgsLength(args, 2, "XMLHttpRequest", "setRequestHeader");
2527
- const s = this[state$2];
2527
+ const s = this[state$5];
2528
2528
  if (!s[_inAfterOpenBeforeSend] || s.readyState !== XMLHttpRequestImpl.OPENED) {
2529
2529
  throw new MPException("Failed to execute 'setRequestHeader' on 'XMLHttpRequest': The object's state must be OPENED.", "InvalidStateError");
2530
2530
  }
@@ -2533,10 +2533,10 @@ class XMLHttpRequestImpl extends XMLHttpRequestEventTargetP {
2533
2533
  });
2534
2534
  s[_requestHeaders].append(_name, value);
2535
2535
  }
2536
- get onreadystatechange() { return this[state$2].onreadystatechange; }
2536
+ get onreadystatechange() { return this[state$5].onreadystatechange; }
2537
2537
  set onreadystatechange(value) {
2538
- this[state$2].onreadystatechange = value;
2539
- attachFn(this, "readystatechange", value, this[state$2][_handlers].onreadystatechange);
2538
+ this[state$5].onreadystatechange = value;
2539
+ attachFn(this, "readystatechange", value, this[state$5][_handlers$1].onreadystatechange);
2540
2540
  }
2541
2541
  /** @internal */ toString() { return "[object XMLHttpRequest]"; }
2542
2542
  /** @internal */ get isPolyfill() { return { symbol: polyfill, hierarchy: ["XMLHttpRequest", "XMLHttpRequestEventTarget", "EventTarget"] }; }
@@ -2544,7 +2544,7 @@ class XMLHttpRequestImpl extends XMLHttpRequestEventTargetP {
2544
2544
  Object.defineProperties(XMLHttpRequestImpl, XHR_properties);
2545
2545
  Object.defineProperties(XMLHttpRequestImpl.prototype, XHR_properties);
2546
2546
  Class_setStringTag(XMLHttpRequestImpl, "XMLHttpRequest");
2547
- /** @internal */ const _handlers = Symbol();
2547
+ /** @internal */ const _handlers$1 = Symbol();
2548
2548
  /** @internal */ const _inAfterOpenBeforeSend = Symbol();
2549
2549
  /** @internal */ const _resetPending = Symbol();
2550
2550
  /** @internal */ const _timeoutId = Symbol();
@@ -2565,9 +2565,9 @@ class XMLHttpRequestState {
2565
2565
  this.statusText = "";
2566
2566
  this.timeout = 0;
2567
2567
  this.withCredentials = false;
2568
- this[_a] = getHandlers(this);
2568
+ this[_a$1] = getHandlers$1(this);
2569
2569
  this.onreadystatechange = null;
2570
- this[_b] = false;
2570
+ this[_b$1] = false;
2571
2571
  this[_c] = false;
2572
2572
  this[_d] = 0;
2573
2573
  this[_e] = "";
@@ -2579,8 +2579,8 @@ class XMLHttpRequestState {
2579
2579
  this.target = target;
2580
2580
  }
2581
2581
  }
2582
- _a = _handlers, _b = _inAfterOpenBeforeSend, _c = _resetPending, _d = _timeoutId, _e = _requestURL, _f = _method, _g = _requestHeaders, _h = _responseHeaders, _j = _responseContentLength, _k = _requestTask;
2583
- 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) {
2584
2584
  return {
2585
2585
  onreadystatechange: (ev) => { executeFn(s.target, s.onreadystatechange, ev); },
2586
2586
  };
@@ -2589,7 +2589,7 @@ function normalizeDataType(responseType) {
2589
2589
  return (responseType === "blob" || responseType === "arraybuffer") ? "arraybuffer" : "text";
2590
2590
  }
2591
2591
  function requestSuccess(res) {
2592
- const s = this[state$2];
2592
+ const s = this[state$5];
2593
2593
  s.responseURL = s[_requestURL];
2594
2594
  s.status = "statusCode" in res ? res.statusCode : "status" in res ? res.status : 200;
2595
2595
  s[_responseHeaders] = new HeadersP(("header" in res ? res.header : "headers" in res ? res.headers : undefined));
@@ -2630,7 +2630,7 @@ function requestFail(err) {
2630
2630
  });
2631
2631
  return;
2632
2632
  }
2633
- const s = this[state$2];
2633
+ const s = this[state$5];
2634
2634
  s.status = 0;
2635
2635
  s.statusText = "errMsg" in err ? err.errMsg : "errorMessage" in err ? err.errorMessage : "";
2636
2636
  if (!s[_inAfterOpenBeforeSend] && s.readyState !== XMLHttpRequestImpl.UNSENT && s.readyState !== XMLHttpRequestImpl.DONE) {
@@ -2639,7 +2639,7 @@ function requestFail(err) {
2639
2639
  }
2640
2640
  }
2641
2641
  function requestComplete() {
2642
- const s = this[state$2];
2642
+ const s = this[state$5];
2643
2643
  s[_requestTask] = null;
2644
2644
  if (!s[_inAfterOpenBeforeSend] && (s.readyState === XMLHttpRequestImpl.OPENED || s.readyState === XMLHttpRequestImpl.LOADING)) {
2645
2645
  setReadyStateAndNotify(this, XMLHttpRequestImpl.DONE);
@@ -2658,7 +2658,7 @@ function safeAbort(task) {
2658
2658
  }
2659
2659
  }
2660
2660
  function clearRequest(xhr, delay = true) {
2661
- const s = xhr[state$2];
2661
+ const s = xhr[state$5];
2662
2662
  const timerFn = delay ? setTimeout : (f) => { f(); };
2663
2663
  s[_resetPending] = true;
2664
2664
  if (s[_requestTask] && s.readyState !== XMLHttpRequestImpl.DONE) {
@@ -2688,7 +2688,7 @@ function clearRequest(xhr, delay = true) {
2688
2688
  });
2689
2689
  }
2690
2690
  function checkRequestTimeout(xhr) {
2691
- const s = xhr[state$2];
2691
+ const s = xhr[state$5];
2692
2692
  if (s.timeout) {
2693
2693
  s[_timeoutId] = setTimeout(() => {
2694
2694
  if (!s.status && s.readyState !== XMLHttpRequestImpl.DONE) {
@@ -2701,7 +2701,7 @@ function checkRequestTimeout(xhr) {
2701
2701
  }
2702
2702
  }
2703
2703
  function resetXHR(xhr) {
2704
- const s = xhr[state$2];
2704
+ const s = xhr[state$5];
2705
2705
  s[_resetPending] = false;
2706
2706
  resetRequestTimeout(xhr);
2707
2707
  s.response = "";
@@ -2713,14 +2713,14 @@ function resetXHR(xhr) {
2713
2713
  s[_responseContentLength] = () => 0;
2714
2714
  }
2715
2715
  function resetRequestTimeout(xhr) {
2716
- const s = xhr[state$2];
2716
+ const s = xhr[state$5];
2717
2717
  if (s[_timeoutId]) {
2718
2718
  clearTimeout(s[_timeoutId]);
2719
2719
  s[_timeoutId] = 0;
2720
2720
  }
2721
2721
  }
2722
2722
  function setReadyStateAndNotify(xhr, value) {
2723
- const s = xhr[state$2];
2723
+ const s = xhr[state$5];
2724
2724
  let hasChanged = value !== s.readyState;
2725
2725
  s.readyState = value;
2726
2726
  if (hasChanged) {
@@ -2732,13 +2732,13 @@ function setReadyStateAndNotify(xhr, value) {
2732
2732
  const XMLHttpRequestP = XMLHttpRequestImpl;
2733
2733
  const XMLHttpRequestE = (typeof XMLHttpRequest !== "undefined" && XMLHttpRequest) || XMLHttpRequestP;
2734
2734
 
2735
- /** @internal */ const state$1 = Symbol( /* "ResponseState" */);
2735
+ /** @internal */ const state$4 = Symbol( /* "ResponseState" */);
2736
2736
  class ResponseP extends BodyImpl {
2737
2737
  constructor(body, init) {
2738
2738
  super();
2739
- this[state$7].name = "Response";
2740
- this[state$1] = new ResponseState();
2741
- const s = this[state$1];
2739
+ this[state$a].name = "Response";
2740
+ this[state$4] = new ResponseState();
2741
+ const s = this[state$4];
2742
2742
  let _init = init !== null && init !== void 0 ? init : {};
2743
2743
  if (typeof _init !== "object") {
2744
2744
  throw new TypeError("Failed to construct 'Response': The provided value is not of type 'ResponseInit'.");
@@ -2756,18 +2756,18 @@ class ResponseP extends BodyImpl {
2756
2756
  Body_init(this, body);
2757
2757
  }
2758
2758
  get headers() {
2759
- const s = this[state$1];
2759
+ const s = this[state$4];
2760
2760
  if (!s.headers) {
2761
2761
  s.headers = new HeadersP();
2762
2762
  }
2763
2763
  return s.headers;
2764
2764
  }
2765
- get ok() { return this[state$1].ok; }
2766
- get redirected() { return this[state$1].redirected; }
2767
- get status() { return this[state$1].status; }
2768
- get statusText() { return this[state$1].statusText; }
2769
- get type() { return this[state$1].type; }
2770
- get url() { return this[state$1].url; }
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; }
2771
2771
  clone() {
2772
2772
  if (this.bodyUsed) {
2773
2773
  throw new TypeError("Failed to execute 'clone' on 'Response': Response body is already used");
@@ -2777,7 +2777,7 @@ class ResponseP extends BodyImpl {
2777
2777
  status: this.status,
2778
2778
  statusText: this.statusText,
2779
2779
  });
2780
- response[state$1].url = this.url;
2780
+ response[state$4].url = this.url;
2781
2781
  return response;
2782
2782
  }
2783
2783
  static json(...args) {
@@ -2789,9 +2789,9 @@ class ResponseP extends BodyImpl {
2789
2789
  }
2790
2790
  static error() {
2791
2791
  let response = new ResponseP(null, { status: 200, statusText: "" });
2792
- response[state$1].ok = false;
2793
- response[state$1].status = 0;
2794
- response[state$1].type = "error";
2792
+ response[state$4].ok = false;
2793
+ response[state$4].status = 0;
2794
+ response[state$4].type = "error";
2795
2795
  return response;
2796
2796
  }
2797
2797
  static redirect(...args) {
@@ -2819,8 +2819,8 @@ class ResponseState {
2819
2819
  }
2820
2820
  const ResponseE = g["Response"] || ResponseP;
2821
2821
 
2822
- const mp = { XMLHttpRequest: XMLHttpRequestE };
2823
- const setXMLHttpRequest = (XHR) => { mp.XMLHttpRequest = XHR; };
2822
+ const mp$1 = { XMLHttpRequest: XMLHttpRequestE };
2823
+ const setXMLHttpRequest = (XHR) => { mp$1.XMLHttpRequest = XHR; };
2824
2824
  function fetchP(...args) {
2825
2825
  if (new.target === fetchP) {
2826
2826
  throw new TypeError("fetch is not a constructor");
@@ -2829,11 +2829,11 @@ function fetchP(...args) {
2829
2829
  checkArgsLength(args, 1, "Window", "fetch");
2830
2830
  return new Promise((resolve, reject) => {
2831
2831
  const request = new RequestP(input, init);
2832
- const signal = request[state$4].signal;
2832
+ const signal = request[state$7].signal;
2833
2833
  if (signal && signal.aborted) {
2834
2834
  return reject(signal.reason);
2835
2835
  }
2836
- let xhr = new mp.XMLHttpRequest();
2836
+ let xhr = new mp$1.XMLHttpRequest();
2837
2837
  xhr.onload = function () {
2838
2838
  let options = {
2839
2839
  headers: parseHeaders(xhr.getAllResponseHeaders() || ""),
@@ -2847,7 +2847,7 @@ function fetchP(...args) {
2847
2847
  }
2848
2848
  setTimeout(() => {
2849
2849
  let response = new ResponseP("response" in xhr ? xhr.response : xhr.responseText, options);
2850
- response[state$1].url = "responseURL" in xhr ? xhr.responseURL : (options.headers.get("X-Request-URL") || "");
2850
+ response[state$4].url = "responseURL" in xhr ? xhr.responseURL : (options.headers.get("X-Request-URL") || "");
2851
2851
  resolve(response);
2852
2852
  });
2853
2853
  };
@@ -2910,24 +2910,24 @@ function fetchP(...args) {
2910
2910
  }
2911
2911
  const fetchE = g["fetch"] || fetchP;
2912
2912
 
2913
- const dispatched = 1;
2913
+ const dispatched$1 = 1;
2914
2914
  /** @internal */
2915
- const state = Symbol( /* "CustomEventState" */);
2915
+ const state$3 = Symbol( /* "CustomEventState" */);
2916
2916
  class CustomEventP extends EventP {
2917
2917
  constructor(type, eventInitDict) {
2918
2918
  var _a;
2919
2919
  super(type, eventInitDict);
2920
- this[state] = new CustomEventState();
2921
- 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;
2922
2922
  }
2923
- get detail() { return this[state].detail; }
2923
+ get detail() { return this[state$3].detail; }
2924
2924
  initCustomEvent(...args) {
2925
2925
  const [type, bubbles, cancelable, detail] = args;
2926
2926
  checkArgsLength(args, 1, "CustomEvent", "initCustomEvent");
2927
- if (Event_getEtField(this, dispatched))
2927
+ if (Event_getEtField(this, dispatched$1))
2928
2928
  return;
2929
2929
  this.initEvent(type, bubbles, cancelable);
2930
- this[state].detail = detail !== null && detail !== void 0 ? detail : null;
2930
+ this[state$3].detail = detail !== null && detail !== void 0 ? detail : null;
2931
2931
  }
2932
2932
  /** @internal */ toString() { return "[object CustomEvent]"; }
2933
2933
  /** @internal */ get isPolyfill() { return { symbol: polyfill, hierarchy: ["CustomEvent", "Event"] }; }
@@ -2938,6 +2938,318 @@ class CustomEventState {
2938
2938
  }
2939
2939
  const CustomEventE = g["EventTarget"] ? g["CustomEvent"] : CustomEventP;
2940
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
+
2941
3253
  exports.AbortController = AbortControllerE;
2942
3254
  exports.AbortControllerP = AbortControllerP;
2943
3255
  exports.AbortSignal = AbortSignalE;
@@ -2958,8 +3270,6 @@ exports.FormData = FormDataE;
2958
3270
  exports.FormDataP = FormDataP;
2959
3271
  exports.Headers = HeadersE;
2960
3272
  exports.HeadersP = HeadersP;
2961
- exports.ProgressEvent = ProgressEventE;
2962
- exports.ProgressEventP = ProgressEventP;
2963
3273
  exports.Request = RequestE;
2964
3274
  exports.RequestP = RequestP;
2965
3275
  exports.Response = ResponseE;
@@ -2970,9 +3280,12 @@ exports.TextEncoder = TextEncoderE;
2970
3280
  exports.TextEncoderP = TextEncoderP;
2971
3281
  exports.URLSearchParams = URLSearchParamsE;
2972
3282
  exports.URLSearchParamsP = URLSearchParamsP;
3283
+ exports.WebSocket = WebSocketE;
3284
+ exports.WebSocketP = WebSocketP;
2973
3285
  exports.XMLHttpRequest = XMLHttpRequestE;
2974
3286
  exports.XMLHttpRequestP = XMLHttpRequestP;
2975
3287
  exports.fetch = fetchE;
2976
3288
  exports.fetchP = fetchP;
3289
+ exports.setConnectSocket = setConnectSocket;
2977
3290
  exports.setRequest = setRequest;
2978
3291
  exports.setXMLHttpRequest = setXMLHttpRequest;