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.esm.js CHANGED
@@ -163,24 +163,24 @@ function encodeText(input, destination) {
163
163
  }
164
164
  const TextEncoderE = g["TextEncoder"] || TextEncoderP;
165
165
 
166
- var _a$a, _b$3;
166
+ var _a$b, _b$4;
167
167
  /** @internal */
168
- const state$h = Symbol( /* "TextDecoderState" */);
168
+ const state$k = Symbol( /* "TextDecoderState" */);
169
169
  class TextDecoderP {
170
170
  constructor(label = "utf-8", { fatal = false, ignoreBOM = false } = {}) {
171
171
  let _label = "" + label;
172
172
  if (["utf-8", "utf8", "unicode-1-1-utf-8"].indexOf(_label.toLowerCase()) === -1) {
173
173
  throw new RangeError(`Failed to construct 'TextDecoder': encoding ('${_label}') not implemented.`);
174
174
  }
175
- this[state$h] = new TextDecoderState();
176
- this[state$h].fatal = !!fatal;
177
- this[state$h].ignoreBOM = !!ignoreBOM;
175
+ this[state$k] = new TextDecoderState();
176
+ this[state$k].fatal = !!fatal;
177
+ this[state$k].ignoreBOM = !!ignoreBOM;
178
178
  }
179
179
  get encoding() { return "utf-8"; }
180
- get fatal() { return this[state$h].fatal; }
181
- get ignoreBOM() { return this[state$h].ignoreBOM; }
180
+ get fatal() { return this[state$k].fatal; }
181
+ get ignoreBOM() { return this[state$k].ignoreBOM; }
182
182
  decode(input, { stream = false } = {}) {
183
- const s = this[state$h];
183
+ const s = this[state$k];
184
184
  let bytes;
185
185
  if (input !== undefined) {
186
186
  if (input instanceof ArrayBuffer) {
@@ -319,11 +319,11 @@ class TextDecoderState {
319
319
  constructor() {
320
320
  this.fatal = false;
321
321
  this.ignoreBOM = false;
322
- this[_a$a] = 0;
323
- this[_b$3] = [];
322
+ this[_a$b] = 0;
323
+ this[_b$4] = [];
324
324
  }
325
325
  }
326
- _a$a = _bomDone, _b$3 = _partial;
326
+ _a$b = _bomDone, _b$4 = _partial;
327
327
  function getBytesPerSequence(byte) {
328
328
  return (byte > 0xEF) ? 4 : (byte > 0xDF) ? 3 : (byte > 0xBF) ? 2 : 1;
329
329
  }
@@ -344,7 +344,7 @@ const concatString = (res) => {
344
344
  const TextDecoderE = g["TextDecoder"] || TextDecoderP;
345
345
 
346
346
  /** @internal */
347
- const state$g = Symbol( /* "BlobState" */);
347
+ const state$j = Symbol( /* "BlobState" */);
348
348
  class BlobP {
349
349
  constructor(blobParts = [], options) {
350
350
  if (!(Array.isArray(blobParts) || (blobParts && typeof blobParts === "object" && Symbol.iterator in blobParts))) {
@@ -355,7 +355,7 @@ class BlobP {
355
355
  for (let i = 0; i < _blobParts.length; ++i) {
356
356
  let chunk = _blobParts[i];
357
357
  if (isPolyfillType("Blob", chunk)) {
358
- chunks.push(chunk[state$g][_buffer]);
358
+ chunks.push(chunk[state$j][_buffer]);
359
359
  }
360
360
  else if (chunk instanceof ArrayBuffer || ArrayBuffer.isView(chunk)) {
361
361
  chunks.push(BufferSource_toUint8Array(chunk));
@@ -364,29 +364,29 @@ class BlobP {
364
364
  chunks.push(encode$1("" + chunk));
365
365
  }
366
366
  }
367
- this[state$g] = new BlobState(concat(chunks));
368
- const s = this[state$g];
367
+ this[state$j] = new BlobState(concat(chunks));
368
+ const s = this[state$j];
369
369
  s.size = s[_buffer].length;
370
370
  let rawType = "" + ((options === null || options === void 0 ? void 0 : options.type) || "");
371
371
  s.type = /[^\u0020-\u007E]/.test(rawType) ? "" : rawType.toLowerCase();
372
372
  }
373
- get size() { return this[state$g].size; }
374
- get type() { return this[state$g].type; }
373
+ get size() { return this[state$j].size; }
374
+ get type() { return this[state$j].type; }
375
375
  arrayBuffer() {
376
- return Promise.resolve(clone(this[state$g][_buffer].buffer).buffer);
376
+ return Promise.resolve(clone(this[state$j][_buffer].buffer).buffer);
377
377
  }
378
378
  bytes() {
379
- return Promise.resolve(clone(this[state$g][_buffer].buffer));
379
+ return Promise.resolve(clone(this[state$j][_buffer].buffer));
380
380
  }
381
381
  slice(start, end, contentType) {
382
- 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
382
+ 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
383
383
  return new BlobP([sliced], { type: "" + (contentType !== null && contentType !== void 0 ? contentType : "") });
384
384
  }
385
385
  stream() {
386
386
  throw new TypeError("Failed to execute 'stream' on 'Blob': method not implemented.");
387
387
  }
388
388
  text() {
389
- return Promise.resolve(decode$1(this[state$g][_buffer]));
389
+ return Promise.resolve(decode$1(this[state$j][_buffer]));
390
390
  }
391
391
  /** @internal */ toString() { return "[object Blob]"; }
392
392
  /** @internal */ get isPolyfill() { return { symbol: polyfill, hierarchy: ["Blob"] }; }
@@ -404,7 +404,7 @@ class BlobState {
404
404
  }
405
405
  /** @internal */
406
406
  function Blob_toUint8Array(blob) {
407
- return blob[state$g][_buffer];
407
+ return blob[state$j][_buffer];
408
408
  }
409
409
  function BufferSource_toUint8Array(buf) {
410
410
  return buf instanceof ArrayBuffer
@@ -463,18 +463,18 @@ function Uint8Array_toBase64(input) {
463
463
  const BlobE = g["Blob"] || BlobP;
464
464
 
465
465
  /** @internal */
466
- const state$f = Symbol( /* "FileState" */);
466
+ const state$i = Symbol( /* "FileState" */);
467
467
  class FileP extends BlobP {
468
468
  constructor(...args) {
469
469
  const [fileBits, fileName, options] = args;
470
470
  checkArgsLength(args, 2, "File");
471
471
  super(fileBits, options);
472
- this[state$f] = new FileState();
473
- this[state$f].lastModified = +((options === null || options === void 0 ? void 0 : options.lastModified) ? new Date(options.lastModified) : new Date()) || 0;
474
- this[state$f].name = "" + fileName;
472
+ this[state$i] = new FileState();
473
+ this[state$i].lastModified = +((options === null || options === void 0 ? void 0 : options.lastModified) ? new Date(options.lastModified) : new Date()) || 0;
474
+ this[state$i].name = "" + fileName;
475
475
  }
476
- get lastModified() { return this[state$f].lastModified; }
477
- get name() { return this[state$f].name; }
476
+ get lastModified() { return this[state$i].lastModified; }
477
+ get name() { return this[state$i].name; }
478
478
  get webkitRelativePath() { return ""; }
479
479
  /** @internal */ toString() { return "[object File]"; }
480
480
  /** @internal */ get isPolyfill() { return { symbol: polyfill, hierarchy: ["File", "Blob"] }; }
@@ -489,39 +489,39 @@ class FileState {
489
489
  }
490
490
  const FileE = g["Blob"] ? g["File"] : FileP;
491
491
 
492
- var _a$9, _b$2, _c$1, _d$1, _e$1;
493
- /** @internal */ const state$e = Symbol( /* "EventState" */);
492
+ var _a$a, _b$3, _c$1, _d$1, _e$1;
493
+ /** @internal */ const state$h = Symbol( /* "EventState" */);
494
494
  class EventP {
495
495
  constructor(...args) {
496
496
  const [type, eventInitDict] = args;
497
497
  checkArgsLength(args, 1, new.target.name);
498
- this[state$e] = new EventState();
499
- const s = this[state$e];
498
+ this[state$h] = new EventState();
499
+ const s = this[state$h];
500
500
  s.type = "" + type;
501
501
  s.bubbles = !!(eventInitDict === null || eventInitDict === void 0 ? void 0 : eventInitDict.bubbles);
502
502
  s.cancelable = !!(eventInitDict === null || eventInitDict === void 0 ? void 0 : eventInitDict.cancelable);
503
503
  s.composed = !!(eventInitDict === null || eventInitDict === void 0 ? void 0 : eventInitDict.composed);
504
504
  Object.defineProperty(this, "isTrusted", {
505
505
  enumerable: true,
506
- get: (function isTrusted() { return this[state$e][_isTrusted]; }).bind(this),
506
+ get: (function isTrusted() { return this[state$h][_isTrusted]; }).bind(this),
507
507
  });
508
508
  }
509
- get type() { return this[state$e].type; }
510
- get bubbles() { return this[state$e].bubbles; }
511
- get cancelable() { return this[state$e].cancelable; }
512
- get composed() { return this[state$e].composed; }
513
- get target() { return this[state$e].target; }
514
- get currentTarget() { return this[state$e].currentTarget; }
515
- get eventPhase() { return this[state$e].eventPhase; }
516
- get srcElement() { return this[state$e].target; }
517
- get cancelBubble() { return this[state$e].cancelBubble; }
518
- set cancelBubble(value) { this[state$e].cancelBubble = !!value; }
519
- get defaultPrevented() { return this[state$e].defaultPrevented; }
520
- get returnValue() { return this[state$e].returnValue; }
509
+ get type() { return this[state$h].type; }
510
+ get bubbles() { return this[state$h].bubbles; }
511
+ get cancelable() { return this[state$h].cancelable; }
512
+ get composed() { return this[state$h].composed; }
513
+ get target() { return this[state$h].target; }
514
+ get currentTarget() { return this[state$h].currentTarget; }
515
+ get eventPhase() { return this[state$h].eventPhase; }
516
+ get srcElement() { return this[state$h].target; }
517
+ get cancelBubble() { return this[state$h].cancelBubble; }
518
+ set cancelBubble(value) { this[state$h].cancelBubble = !!value; }
519
+ get defaultPrevented() { return this[state$h].defaultPrevented; }
520
+ get returnValue() { return this[state$h].returnValue; }
521
521
  set returnValue(value) { if (!value) {
522
522
  this.preventDefault();
523
523
  } }
524
- get timeStamp() { return this[state$e].timeStamp; }
524
+ get timeStamp() { return this[state$h].timeStamp; }
525
525
  composedPath() {
526
526
  let path = !!this.target ? [this.target] : [];
527
527
  if (!!this.currentTarget && this.currentTarget !== this.target)
@@ -531,7 +531,7 @@ class EventP {
531
531
  initEvent(...args) {
532
532
  const [type, bubbles, cancelable] = args;
533
533
  checkArgsLength(args, 1, "Event", "initEvent");
534
- const s = this[state$e];
534
+ const s = this[state$h];
535
535
  if (s[_dispatched])
536
536
  return;
537
537
  s.type = "" + type;
@@ -539,7 +539,7 @@ class EventP {
539
539
  s.cancelable = !!cancelable;
540
540
  }
541
541
  preventDefault() {
542
- const s = this[state$e];
542
+ const s = this[state$h];
543
543
  if (s[_passive]) {
544
544
  console.warn(`Ignoring 'preventDefault()' call on event of type '${this.type}' from a listener registered as 'passive'.`);
545
545
  return;
@@ -551,7 +551,7 @@ class EventP {
551
551
  }
552
552
  }
553
553
  stopImmediatePropagation() {
554
- this[state$e][_stopImmediatePropagationCalled] = true;
554
+ this[state$h][_stopImmediatePropagationCalled] = true;
555
555
  this.cancelBubble = true;
556
556
  }
557
557
  stopPropagation() {
@@ -560,14 +560,14 @@ class EventP {
560
560
  /** @internal */ toString() { return "[object Event]"; }
561
561
  /** @internal */ get isPolyfill() { return { symbol: polyfill, hierarchy: ["Event"] }; }
562
562
  }
563
- const properties$1 = {
563
+ const properties$2 = {
564
564
  NONE: { value: 0, enumerable: true },
565
565
  CAPTURING_PHASE: { value: 1, enumerable: true },
566
566
  AT_TARGET: { value: 2, enumerable: true },
567
567
  BUBBLING_PHASE: { value: 3, enumerable: true },
568
568
  };
569
- Object.defineProperties(EventP, properties$1);
570
- Object.defineProperties(EventP.prototype, properties$1);
569
+ Object.defineProperties(EventP, properties$2);
570
+ Object.defineProperties(EventP.prototype, properties$2);
571
571
  Class_setStringTag(EventP, "Event");
572
572
  /** @internal */ const _timeStamp = (new Date()).getTime();
573
573
  /** @internal */ const _isTrusted = Symbol();
@@ -589,17 +589,17 @@ class EventState {
589
589
  this.defaultPrevented = false;
590
590
  this.returnValue = true;
591
591
  this.timeStamp = (new Date()).getTime() - _timeStamp;
592
- this[_a$9] = false;
593
- this[_b$2] = false;
592
+ this[_a$a] = false;
593
+ this[_b$3] = false;
594
594
  this[_c$1] = false;
595
595
  this[_d$1] = false;
596
596
  this[_e$1] = false;
597
597
  }
598
598
  }
599
- _a$9 = _isTrusted, _b$2 = _passive, _c$1 = _dispatched, _d$1 = _preventDefaultCalled, _e$1 = _stopImmediatePropagationCalled;
599
+ _a$a = _isTrusted, _b$3 = _passive, _c$1 = _dispatched, _d$1 = _preventDefaultCalled, _e$1 = _stopImmediatePropagationCalled;
600
600
  /** @internal */
601
601
  function Event_setTrusted(event, isTrusted) {
602
- Object.defineProperty(event[state$e], _isTrusted, {
602
+ Object.defineProperty(event[state$h], _isTrusted, {
603
603
  value: isTrusted,
604
604
  writable: true,
605
605
  enumerable: true,
@@ -607,16 +607,16 @@ function Event_setTrusted(event, isTrusted) {
607
607
  });
608
608
  }
609
609
  const passive$1 = 0;
610
- const dispatched$2 = 1;
610
+ const dispatched$3 = 1;
611
611
  const preventDefaultCalled$1 = 2;
612
612
  const stopImmediatePropagationCalled$1 = 3;
613
613
  /** @internal */
614
614
  function Event_getEtField(event, field) {
615
- const s = event[state$e];
615
+ const s = event[state$h];
616
616
  switch (field) {
617
617
  case passive$1:
618
618
  return s[_passive];
619
- case dispatched$2:
619
+ case dispatched$3:
620
620
  return s[_dispatched];
621
621
  case preventDefaultCalled$1:
622
622
  return s[_preventDefaultCalled];
@@ -626,12 +626,12 @@ function Event_getEtField(event, field) {
626
626
  }
627
627
  /** @internal */
628
628
  function Event_setEtField(event, field, value) {
629
- const s = event[state$e];
629
+ const s = event[state$h];
630
630
  switch (field) {
631
631
  case passive$1:
632
632
  s[_passive] = value;
633
633
  break;
634
- case dispatched$2:
634
+ case dispatched$3:
635
635
  s[_dispatched] = value;
636
636
  break;
637
637
  case preventDefaultCalled$1:
@@ -645,30 +645,30 @@ function Event_setEtField(event, field, value) {
645
645
  /** @internal */
646
646
  function createInnerEvent(target, type, eventInitDict, isTrusted = true) {
647
647
  let event = new EventP(type, eventInitDict);
648
- event[state$e].target = target;
649
- event[state$e][_isTrusted] = isTrusted;
648
+ event[state$h].target = target;
649
+ event[state$h][_isTrusted] = isTrusted;
650
650
  return event;
651
651
  }
652
652
  const EventE = g["EventTarget"] ? g["Event"] : EventP;
653
653
 
654
- var _a$8;
654
+ var _a$9;
655
655
  const passive = 0;
656
- const dispatched$1 = 1;
656
+ const dispatched$2 = 1;
657
657
  const preventDefaultCalled = 2;
658
658
  const stopImmediatePropagationCalled = 3;
659
- /** @internal */ const state$d = Symbol( /* "EventTargetState" */);
659
+ /** @internal */ const state$g = Symbol( /* "EventTargetState" */);
660
660
  class EventTargetP {
661
661
  constructor() {
662
- this[state$d] = new EventTargetState(this);
663
- this[state$d].name = new.target.name;
662
+ this[state$g] = new EventTargetState(this);
663
+ this[state$g].name = new.target.name;
664
664
  }
665
665
  addEventListener(...args) {
666
666
  const [type, callback, options] = args;
667
- checkArgsLength(args, 2, this[state$d].name, "addEventListener");
667
+ checkArgsLength(args, 2, this[state$g].name, "addEventListener");
668
668
  if (typeof callback !== "function" && typeof callback !== "object" && typeof callback !== "undefined") {
669
- throw new TypeError(`Failed to execute 'addEventListener' on '${this[state$d].name}': parameter 2 is not of type 'Object'.`);
669
+ throw new TypeError(`Failed to execute 'addEventListener' on '${this[state$g].name}': parameter 2 is not of type 'Object'.`);
670
670
  }
671
- const s = this[state$d];
671
+ const s = this[state$g];
672
672
  const executor = new Executor(type, callback);
673
673
  executor.options.capture = typeof options === "boolean" ? options : !!(options === null || options === void 0 ? void 0 : options.capture);
674
674
  if (!s[_executors].some(x => x.equals(executor))) {
@@ -688,21 +688,21 @@ class EventTargetP {
688
688
  }
689
689
  dispatchEvent(...args) {
690
690
  const [event] = args;
691
- checkArgsLength(args, 1, this[state$d].name, "dispatchEvent");
691
+ checkArgsLength(args, 1, this[state$g].name, "dispatchEvent");
692
692
  if (!(event instanceof EventP)) {
693
- throw new TypeError(`Failed to execute 'dispatchEvent' on '${this[state$d].name}': parameter 1 is not of type 'Event'.`);
693
+ throw new TypeError(`Failed to execute 'dispatchEvent' on '${this[state$g].name}': parameter 1 is not of type 'Event'.`);
694
694
  }
695
695
  Event_setTrusted(event, false);
696
- event[state$e].target = this;
696
+ event[state$h].target = this;
697
697
  return EventTarget_fire(this, event);
698
698
  }
699
699
  removeEventListener(...args) {
700
700
  const [type, callback, options] = args;
701
- checkArgsLength(args, 2, this[state$d].name, "removeEventListener");
701
+ checkArgsLength(args, 2, this[state$g].name, "removeEventListener");
702
702
  if (typeof callback !== "function" && typeof callback !== "object" && typeof callback !== "undefined") {
703
- throw new TypeError(`Failed to execute 'removeEventListener' on '${this[state$d].name}': parameter 2 is not of type 'Object'.`);
703
+ throw new TypeError(`Failed to execute 'removeEventListener' on '${this[state$g].name}': parameter 2 is not of type 'Object'.`);
704
704
  }
705
- const s = this[state$d];
705
+ const s = this[state$g];
706
706
  const executor = new Executor(type, callback);
707
707
  executor.options.capture = typeof options === "boolean" ? options : !!(options === null || options === void 0 ? void 0 : options.capture);
708
708
  if (s[_executors].some(x => x.equals(executor))) {
@@ -719,20 +719,20 @@ const _executors = Symbol();
719
719
  class EventTargetState {
720
720
  constructor(target) {
721
721
  this.name = "EventTarget";
722
- this[_a$8] = [];
722
+ this[_a$9] = [];
723
723
  this.target = target;
724
724
  }
725
725
  }
726
- _a$8 = _executors;
726
+ _a$9 = _executors;
727
727
  /** @internal */
728
728
  function EventTarget_fire(target, event) {
729
- const s = target[state$d];
730
- const evs = event[state$e];
729
+ const s = target[state$g];
730
+ const evs = event[state$h];
731
731
  if (!event.target)
732
732
  evs.target = target;
733
733
  evs.currentTarget = target;
734
734
  evs.eventPhase = EventP.AT_TARGET;
735
- Event_setEtField(event, dispatched$1, true);
735
+ Event_setEtField(event, dispatched$2, true);
736
736
  let onceIndexes = [];
737
737
  for (let i = 0; i < s[_executors].length; ++i) {
738
738
  if (Event_getEtField(event, stopImmediatePropagationCalled))
@@ -762,11 +762,11 @@ function EventTarget_fire(target, event) {
762
762
  }
763
763
  evs.currentTarget = null;
764
764
  evs.eventPhase = EventP.NONE;
765
- Event_setEtField(event, dispatched$1, false);
765
+ Event_setEtField(event, dispatched$2, false);
766
766
  return !(event.cancelable && Event_getEtField(event, preventDefaultCalled));
767
767
  }
768
768
  function reply(target, signal, executor) {
769
- const s = target[state$d];
769
+ const s = target[state$g];
770
770
  const onAbort = () => {
771
771
  s[_executors] = s[_executors].filter(x => !x.equals(executor));
772
772
  signal.removeEventListener("abort", onAbort);
@@ -816,13 +816,13 @@ function executeFn(target, cb, ev) {
816
816
  const EventTargetE = g["EventTarget"] || EventTargetP;
817
817
 
818
818
  /** @internal */
819
- const state$c = Symbol( /* "ProgressEventState" */);
819
+ const state$f = Symbol( /* "ProgressEventState" */);
820
820
  class ProgressEventP extends EventP {
821
821
  constructor(type, eventInitDict) {
822
822
  var _a, _b;
823
823
  super(type, eventInitDict);
824
- this[state$c] = new ProgressEventState();
825
- const s = this[state$c];
824
+ this[state$f] = new ProgressEventState();
825
+ const s = this[state$f];
826
826
  s.lengthComputable = !!(eventInitDict === null || eventInitDict === void 0 ? void 0 : eventInitDict.lengthComputable);
827
827
  s.loaded = Number((_a = eventInitDict === null || eventInitDict === void 0 ? void 0 : eventInitDict.loaded) !== null && _a !== void 0 ? _a : 0);
828
828
  s.total = Number((_b = eventInitDict === null || eventInitDict === void 0 ? void 0 : eventInitDict.total) !== null && _b !== void 0 ? _b : 0);
@@ -837,9 +837,9 @@ class ProgressEventP extends EventP {
837
837
  throw new TypeError(`Failed to construct 'ProgressEvent': Failed to read the '${errField}' property from 'ProgressEventInit': The provided double value is non-finite.`);
838
838
  }
839
839
  }
840
- get lengthComputable() { return getValue(this[state$c].lengthComputable); }
841
- get loaded() { return getValue(this[state$c].loaded); }
842
- get total() { return getValue(this[state$c].total); }
840
+ get lengthComputable() { return getValue(this[state$f].lengthComputable); }
841
+ get loaded() { return getValue(this[state$f].loaded); }
842
+ get total() { return getValue(this[state$f].total); }
843
843
  /** @internal */ toString() { return "[object ProgressEvent]"; }
844
844
  /** @internal */ get isPolyfill() { return { symbol: polyfill, hierarchy: ["ProgressEvent", "Event"] }; }
845
845
  }
@@ -857,10 +857,10 @@ function getValue(val) {
857
857
  }
858
858
  function createInnerProgressEvent(target, type, { lengthComputable = false, loaded = 0, total = 0, } = {}) {
859
859
  let event = new ProgressEventP(type);
860
- event[state$c].lengthComputable = lengthComputable;
861
- event[state$c].loaded = loaded;
862
- event[state$c].total = total;
863
- event[state$e].target = target;
860
+ event[state$f].lengthComputable = lengthComputable;
861
+ event[state$f].loaded = loaded;
862
+ event[state$f].total = total;
863
+ event[state$h].target = target;
864
864
  Event_setTrusted(event, true);
865
865
  return event;
866
866
  }
@@ -873,22 +873,22 @@ function emitProcessEvent(target, type, loaded = 0, total = 0) {
873
873
  });
874
874
  EventTarget_fire(target, event);
875
875
  }
876
- const ProgressEventE = g["EventTarget"] ? g["ProgressEvent"] : ProgressEventP;
876
+ g["EventTarget"] ? g["ProgressEvent"] : ProgressEventP;
877
877
 
878
- var _a$7;
878
+ var _a$8;
879
879
  /** @internal */
880
- const state$b = Symbol( /* "FileReaderState" */);
880
+ const state$e = Symbol( /* "FileReaderState" */);
881
881
  class FileReaderP extends EventTargetP {
882
882
  constructor() {
883
883
  super();
884
- this[state$b] = new FileReaderState(this);
884
+ this[state$e] = new FileReaderState(this);
885
885
  }
886
- get readyState() { return this[state$b].readyState; }
887
- get result() { return this[state$b].result; }
888
- get error() { return this[state$b].error; }
886
+ get readyState() { return this[state$e].readyState; }
887
+ get result() { return this[state$e].result; }
888
+ get error() { return this[state$e].error; }
889
889
  abort() {
890
890
  if (this.readyState === FileReaderP.LOADING) {
891
- const s = this[state$b];
891
+ const s = this[state$e];
892
892
  s.readyState = FileReaderP.DONE;
893
893
  s.result = null;
894
894
  s.error = new MPException("An ongoing operation was aborted, typically with a call to abort().", "AbortError");
@@ -897,7 +897,7 @@ class FileReaderP extends EventTargetP {
897
897
  }
898
898
  readAsArrayBuffer(...args) {
899
899
  read$1(this, "readAsArrayBuffer", args, blob => {
900
- this[state$b].result = Blob_toUint8Array(blob).buffer.slice(0);
900
+ this[state$e].result = Blob_toUint8Array(blob).buffer.slice(0);
901
901
  });
902
902
  }
903
903
  readAsBinaryString(...args) {
@@ -908,12 +908,12 @@ class FileReaderP extends EventTargetP {
908
908
  let char = buf[i];
909
909
  str.push(String.fromCharCode(char));
910
910
  }
911
- this[state$b].result = str.join("");
911
+ this[state$e].result = str.join("");
912
912
  });
913
913
  }
914
914
  readAsDataURL(...args) {
915
915
  read$1(this, "readAsDataURL", args, blob => {
916
- this[state$b].result = "data:" + (blob.type || "application/octet-stream") + ";base64," + Uint8Array_toBase64(Blob_toUint8Array(blob));
916
+ this[state$e].result = "data:" + (blob.type || "application/octet-stream") + ";base64," + Uint8Array_toBase64(Blob_toUint8Array(blob));
917
917
  });
918
918
  }
919
919
  readAsText(...args) {
@@ -925,41 +925,41 @@ class FileReaderP extends EventTargetP {
925
925
  console.error(`TypeError: Failed to execute 'readAsText' on 'FileReader': encoding ('${_encoding}') not implemented.`);
926
926
  }
927
927
  }
928
- this[state$b].result = decode$1(Blob_toUint8Array(blob));
928
+ this[state$e].result = decode$1(Blob_toUint8Array(blob));
929
929
  });
930
930
  }
931
- get onabort() { return this[state$b].onabort; }
932
- set onabort(value) { this[state$b].onabort = value; attach$1(this, "abort"); }
933
- get onerror() { return this[state$b].onerror; }
934
- set onerror(value) { this[state$b].onerror = value; attach$1(this, "error"); }
935
- get onload() { return this[state$b].onload; }
936
- set onload(value) { this[state$b].onload = value; attach$1(this, "load"); }
937
- get onloadend() { return this[state$b].onloadend; }
938
- set onloadend(value) { this[state$b].onloadend = value; attach$1(this, "loadend"); }
939
- get onloadstart() { return this[state$b].onloadstart; }
940
- set onloadstart(value) { this[state$b].onloadstart = value; attach$1(this, "loadstart"); }
941
- get onprogress() { return this[state$b].onprogress; }
942
- set onprogress(value) { this[state$b].onprogress = value; attach$1(this, "progress"); }
931
+ get onabort() { return this[state$e].onabort; }
932
+ set onabort(value) { this[state$e].onabort = value; attach$2(this, "abort"); }
933
+ get onerror() { return this[state$e].onerror; }
934
+ set onerror(value) { this[state$e].onerror = value; attach$2(this, "error"); }
935
+ get onload() { return this[state$e].onload; }
936
+ set onload(value) { this[state$e].onload = value; attach$2(this, "load"); }
937
+ get onloadend() { return this[state$e].onloadend; }
938
+ set onloadend(value) { this[state$e].onloadend = value; attach$2(this, "loadend"); }
939
+ get onloadstart() { return this[state$e].onloadstart; }
940
+ set onloadstart(value) { this[state$e].onloadstart = value; attach$2(this, "loadstart"); }
941
+ get onprogress() { return this[state$e].onprogress; }
942
+ set onprogress(value) { this[state$e].onprogress = value; attach$2(this, "progress"); }
943
943
  /** @internal */ toString() { return "[object FileReader]"; }
944
944
  /** @internal */ get isPolyfill() { return { symbol: polyfill, hierarchy: ["FileReader", "EventTarget"] }; }
945
945
  }
946
- const properties = {
946
+ const properties$1 = {
947
947
  EMPTY: { value: 0, enumerable: true },
948
948
  LOADING: { value: 1, enumerable: true },
949
949
  DONE: { value: 2, enumerable: true },
950
950
  };
951
- Object.defineProperties(FileReaderP, properties);
952
- Object.defineProperties(FileReaderP.prototype, properties);
951
+ Object.defineProperties(FileReaderP, properties$1);
952
+ Object.defineProperties(FileReaderP.prototype, properties$1);
953
953
  Class_setStringTag(FileReaderP, "FileReader");
954
954
  /** @internal */
955
- const _handlers$3 = Symbol();
955
+ const _handlers$4 = Symbol();
956
956
  /** @internal */
957
957
  class FileReaderState {
958
958
  constructor(target) {
959
959
  this.readyState = FileReaderP.EMPTY;
960
960
  this.result = null;
961
961
  this.error = null;
962
- this[_a$7] = getHandlers$3(this);
962
+ this[_a$8] = getHandlers$4(this);
963
963
  this.onabort = null;
964
964
  this.onerror = null;
965
965
  this.onload = null;
@@ -969,14 +969,14 @@ class FileReaderState {
969
969
  this.target = target;
970
970
  }
971
971
  }
972
- _a$7 = _handlers$3;
972
+ _a$8 = _handlers$4;
973
973
  function read$1(reader, kind, args, setResult) {
974
974
  const [blob] = args;
975
975
  checkArgsLength(args, 1, "FileReader", kind);
976
976
  if (!isPolyfillType("Blob", blob)) {
977
977
  throw new TypeError("Failed to execute '" + kind + "' on 'FileReader': parameter 1 is not of type 'Blob'.");
978
978
  }
979
- const s = reader[state$b];
979
+ const s = reader[state$e];
980
980
  s.error = null;
981
981
  s.readyState = FileReaderP.LOADING;
982
982
  emitProcessEvent(s.target, "loadstart", 0, blob.size);
@@ -996,14 +996,14 @@ function read$1(reader, kind, args, setResult) {
996
996
  emitProcessEvent(s.target, "loadend", !!s.result ? blob.size : 0, blob.size);
997
997
  });
998
998
  }
999
- function attach$1(reader, type) {
1000
- const s = reader[state$b];
999
+ function attach$2(reader, type) {
1000
+ const s = reader[state$e];
1001
1001
  const fnName = ("on" + type);
1002
1002
  const cb = s[fnName];
1003
- const listener = s[_handlers$3][fnName];
1003
+ const listener = s[_handlers$4][fnName];
1004
1004
  attachFn(reader, type, cb, listener);
1005
1005
  }
1006
- function getHandlers$3(s) {
1006
+ function getHandlers$4(s) {
1007
1007
  return {
1008
1008
  onabort: (ev) => { executeFn(s.target, s.onabort, ev); },
1009
1009
  onerror: (ev) => { executeFn(s.target, s.onerror, ev); },
@@ -1015,12 +1015,12 @@ function getHandlers$3(s) {
1015
1015
  }
1016
1016
  const FileReaderE = g["Blob"] ? g["FileReader"] : FileReaderP;
1017
1017
 
1018
- var _a$6;
1019
- /** @internal */ const state$a = Symbol( /* "URLSearchParamsState" */);
1018
+ var _a$7;
1019
+ /** @internal */ const state$d = Symbol( /* "URLSearchParamsState" */);
1020
1020
  const checkArgsFn$2 = (args, required, funcName) => { checkArgsLength(args, required, "URLSearchParams", funcName); };
1021
1021
  class URLSearchParamsP {
1022
1022
  constructor(init) {
1023
- this[state$a] = new URLSearchParamsState();
1023
+ this[state$d] = new URLSearchParamsState();
1024
1024
  if (init !== undefined) {
1025
1025
  if (isObjectType("URLSearchParams", init)) {
1026
1026
  init.forEach((value, name) => { this.append(name, value); }, this);
@@ -1068,18 +1068,18 @@ class URLSearchParamsP {
1068
1068
  }
1069
1069
  }
1070
1070
  }
1071
- get size() { return this[state$a][_urlspArray].length; }
1071
+ get size() { return this[state$d][_urlspArray].length; }
1072
1072
  append(...args) {
1073
1073
  const [name, value] = args;
1074
1074
  checkArgsFn$2(args, 2, "append");
1075
- this[state$a][_urlspArray].push(["" + name, normalizeValue$1(value)]);
1075
+ this[state$d][_urlspArray].push(["" + name, normalizeValue$1(value)]);
1076
1076
  }
1077
1077
  delete(...args) {
1078
1078
  const [name, value] = args;
1079
1079
  checkArgsFn$2(args, 1, "delete");
1080
1080
  let _name = "" + name;
1081
1081
  let index = -1;
1082
- let array = this[state$a][_urlspArray];
1082
+ let array = this[state$d][_urlspArray];
1083
1083
  let result = [];
1084
1084
  for (let i = 0; i < array.length; ++i) {
1085
1085
  let item = array[i];
@@ -1093,14 +1093,14 @@ class URLSearchParamsP {
1093
1093
  result.push(item);
1094
1094
  }
1095
1095
  if (index > -1) {
1096
- this[state$a][_urlspArray] = result;
1096
+ this[state$d][_urlspArray] = result;
1097
1097
  }
1098
1098
  }
1099
1099
  get(...args) {
1100
1100
  const [name] = args;
1101
1101
  checkArgsFn$2(args, 1, "get");
1102
1102
  let _name = "" + name;
1103
- let array = this[state$a][_urlspArray];
1103
+ let array = this[state$d][_urlspArray];
1104
1104
  for (let i = 0; i < array.length; ++i) {
1105
1105
  let item = array[i];
1106
1106
  if (item[0] === _name) {
@@ -1113,7 +1113,7 @@ class URLSearchParamsP {
1113
1113
  const [name] = args;
1114
1114
  checkArgsFn$2(args, 1, "getAll");
1115
1115
  let _name = "" + name;
1116
- let array = this[state$a][_urlspArray];
1116
+ let array = this[state$d][_urlspArray];
1117
1117
  let result = [];
1118
1118
  for (let i = 0; i < array.length; ++i) {
1119
1119
  let item = array[i];
@@ -1127,7 +1127,7 @@ class URLSearchParamsP {
1127
1127
  const [name, value] = args;
1128
1128
  checkArgsFn$2(args, 1, "has");
1129
1129
  let _name = "" + name;
1130
- let array = this[state$a][_urlspArray];
1130
+ let array = this[state$d][_urlspArray];
1131
1131
  for (let i = 0; i < array.length; ++i) {
1132
1132
  let item = array[i];
1133
1133
  if (item[0] === _name) {
@@ -1149,7 +1149,7 @@ class URLSearchParamsP {
1149
1149
  let _name = "" + name;
1150
1150
  let _value = normalizeValue$1(value);
1151
1151
  let index = -1;
1152
- let array = this[state$a][_urlspArray];
1152
+ let array = this[state$d][_urlspArray];
1153
1153
  let result = [];
1154
1154
  for (let i = 0; i < array.length; ++i) {
1155
1155
  let item = array[i];
@@ -1165,10 +1165,10 @@ class URLSearchParamsP {
1165
1165
  if (index === -1) {
1166
1166
  result.push([_name, _value]);
1167
1167
  }
1168
- this[state$a][_urlspArray] = result;
1168
+ this[state$d][_urlspArray] = result;
1169
1169
  }
1170
1170
  sort() {
1171
- this[state$a][_urlspArray].sort((a, b) => a[0] < b[0] ? -1 : a[0] > b[0] ? 1 : 0);
1171
+ this[state$d][_urlspArray].sort((a, b) => a[0] < b[0] ? -1 : a[0] > b[0] ? 1 : 0);
1172
1172
  }
1173
1173
  forEach(...args) {
1174
1174
  const [callbackfn, thisArg] = args;
@@ -1176,26 +1176,26 @@ class URLSearchParamsP {
1176
1176
  if (typeof callbackfn !== "function") {
1177
1177
  throw new TypeError("Failed to execute 'forEach' on 'URLSearchParams': parameter 1 is not of type 'Function'.");
1178
1178
  }
1179
- let array = this[state$a][_urlspArray];
1179
+ let array = this[state$d][_urlspArray];
1180
1180
  for (let i = 0; i < array.length; ++i) {
1181
1181
  let item = array[i];
1182
1182
  callbackfn.call(thisArg, item[1], item[0], this);
1183
1183
  }
1184
1184
  }
1185
1185
  entries() {
1186
- return this[state$a][_urlspArray].map(x => [x[0], x[1]]).values();
1186
+ return this[state$d][_urlspArray].map(x => [x[0], x[1]]).values();
1187
1187
  }
1188
1188
  keys() {
1189
- return this[state$a][_urlspArray].map(x => x[0]).values();
1189
+ return this[state$d][_urlspArray].map(x => x[0]).values();
1190
1190
  }
1191
1191
  values() {
1192
- return this[state$a][_urlspArray].map(x => x[1]).values();
1192
+ return this[state$d][_urlspArray].map(x => x[1]).values();
1193
1193
  }
1194
1194
  [Symbol.iterator]() {
1195
1195
  return this.entries();
1196
1196
  }
1197
1197
  toString() {
1198
- let array = this[state$a][_urlspArray];
1198
+ let array = this[state$d][_urlspArray];
1199
1199
  let result = [];
1200
1200
  for (let i = 0; i < array.length; ++i) {
1201
1201
  let item = array[i];
@@ -1212,10 +1212,10 @@ const _urlspArray = Symbol();
1212
1212
  /** @internal */
1213
1213
  class URLSearchParamsState {
1214
1214
  constructor() {
1215
- this[_a$6] = [];
1215
+ this[_a$7] = [];
1216
1216
  }
1217
1217
  }
1218
- _a$6 = _urlspArray;
1218
+ _a$7 = _urlspArray;
1219
1219
  function normalizeValue$1(value) {
1220
1220
  return typeof value === "string" ? value : (value !== null && value !== undefined && typeof value.toString === "function"
1221
1221
  ? value.toString()
@@ -1240,8 +1240,8 @@ function decode(str) {
1240
1240
  }
1241
1241
  const URLSearchParamsE = g["URLSearchParams"] || URLSearchParamsP;
1242
1242
 
1243
- var _a$5;
1244
- /** @internal */ const state$9 = Symbol( /* "FormDataState" */);
1243
+ var _a$6;
1244
+ /** @internal */ const state$c = Symbol( /* "FormDataState" */);
1245
1245
  const checkArgsFn$1 = (args, required, funcName) => { checkArgsLength(args, required, "FormData", funcName); };
1246
1246
  class FormDataP {
1247
1247
  constructor(form, submitter) {
@@ -1255,19 +1255,19 @@ class FormDataP {
1255
1255
  console.error("TypeError: Failed to construct 'FormData': parameter 1 and parameter 2 not implemented.");
1256
1256
  }
1257
1257
  }
1258
- this[state$9] = new FormDataState();
1258
+ this[state$c] = new FormDataState();
1259
1259
  }
1260
1260
  append(...args) {
1261
1261
  const [name, value, filename] = args;
1262
1262
  checkArgsFn$1(args, 2, "append");
1263
- this[state$9][_formData].push(normalizeArgs(name, value, filename));
1263
+ this[state$c][_formData].push(normalizeArgs(name, value, filename));
1264
1264
  }
1265
1265
  delete(...args) {
1266
1266
  const [name] = args;
1267
1267
  checkArgsFn$1(args, 1, "delete");
1268
1268
  let _name = "" + name;
1269
1269
  let index = -1;
1270
- let array = this[state$9][_formData];
1270
+ let array = this[state$c][_formData];
1271
1271
  let result = [];
1272
1272
  for (let i = 0; i < array.length; ++i) {
1273
1273
  let item = array[i];
@@ -1278,14 +1278,14 @@ class FormDataP {
1278
1278
  result.push(item);
1279
1279
  }
1280
1280
  if (index > -1) {
1281
- this[state$9][_formData] = result;
1281
+ this[state$c][_formData] = result;
1282
1282
  }
1283
1283
  }
1284
1284
  get(...args) {
1285
1285
  const [name] = args;
1286
1286
  checkArgsFn$1(args, 1, "get");
1287
1287
  let _name = "" + name;
1288
- let array = this[state$9][_formData];
1288
+ let array = this[state$c][_formData];
1289
1289
  for (let i = 0; i < array.length; ++i) {
1290
1290
  let item = array[i];
1291
1291
  if (item[0] === _name) {
@@ -1298,7 +1298,7 @@ class FormDataP {
1298
1298
  const [name] = args;
1299
1299
  checkArgsFn$1(args, 1, "getAll");
1300
1300
  let _name = "" + name;
1301
- let array = this[state$9][_formData];
1301
+ let array = this[state$c][_formData];
1302
1302
  let result = [];
1303
1303
  for (let i = 0; i < array.length; ++i) {
1304
1304
  let item = array[i];
@@ -1312,7 +1312,7 @@ class FormDataP {
1312
1312
  const [name] = args;
1313
1313
  checkArgsFn$1(args, 1, "has");
1314
1314
  let _name = "" + name;
1315
- let array = this[state$9][_formData];
1315
+ let array = this[state$c][_formData];
1316
1316
  for (let i = 0; i < array.length; ++i) {
1317
1317
  let item = array[i];
1318
1318
  if (item[0] === _name) {
@@ -1327,7 +1327,7 @@ class FormDataP {
1327
1327
  let _name = "" + name;
1328
1328
  let _args = normalizeArgs(name, value, filename);
1329
1329
  let index = -1;
1330
- let array = this[state$9][_formData];
1330
+ let array = this[state$c][_formData];
1331
1331
  let result = [];
1332
1332
  for (let i = 0; i < array.length; ++i) {
1333
1333
  let item = array[i];
@@ -1343,7 +1343,7 @@ class FormDataP {
1343
1343
  if (index === -1) {
1344
1344
  result.push(_args);
1345
1345
  }
1346
- this[state$9][_formData] = result;
1346
+ this[state$c][_formData] = result;
1347
1347
  }
1348
1348
  forEach(...args) {
1349
1349
  const [callbackfn, thisArg] = args;
@@ -1351,20 +1351,20 @@ class FormDataP {
1351
1351
  if (typeof callbackfn !== "function") {
1352
1352
  throw new TypeError("Failed to execute 'forEach' on 'FormData': parameter 1 is not of type 'Function'.");
1353
1353
  }
1354
- let array = this[state$9][_formData];
1354
+ let array = this[state$c][_formData];
1355
1355
  for (let i = 0; i < array.length; ++i) {
1356
1356
  let item = array[i];
1357
1357
  callbackfn.call(thisArg, item[1], item[0], thisArg);
1358
1358
  }
1359
1359
  }
1360
1360
  entries() {
1361
- return this[state$9][_formData].map(x => [x[0], x[1]]).values();
1361
+ return this[state$c][_formData].map(x => [x[0], x[1]]).values();
1362
1362
  }
1363
1363
  keys() {
1364
- return this[state$9][_formData].map(x => x[0]).values();
1364
+ return this[state$c][_formData].map(x => x[0]).values();
1365
1365
  }
1366
1366
  values() {
1367
- return this[state$9][_formData].map(x => x[1]).values();
1367
+ return this[state$c][_formData].map(x => x[1]).values();
1368
1368
  }
1369
1369
  [Symbol.iterator]() {
1370
1370
  return this.entries();
@@ -1378,17 +1378,17 @@ const _formData = Symbol();
1378
1378
  /** @internal */
1379
1379
  class FormDataState {
1380
1380
  constructor() {
1381
- this[_a$5] = [];
1381
+ this[_a$6] = [];
1382
1382
  }
1383
1383
  }
1384
- _a$5 = _formData;
1384
+ _a$6 = _formData;
1385
1385
  /** @internal */
1386
1386
  function FormData_toBlob(formData) {
1387
1387
  const boundary = "----formdata-mphttpx-" + Math.random();
1388
1388
  const p = `--${boundary}\r\nContent-Disposition: form-data; name="`;
1389
1389
  let chunks = [];
1390
- for (let i = 0; i < formData[state$9][_formData].length; ++i) {
1391
- let pair = formData[state$9][_formData][i];
1390
+ for (let i = 0; i < formData[state$c][_formData].length; ++i) {
1391
+ let pair = formData[state$c][_formData][i];
1392
1392
  let name = pair[0];
1393
1393
  let value = pair[1];
1394
1394
  if (typeof value === "string") {
@@ -1478,12 +1478,12 @@ function createFormDataFromBinaryText(text, boundary) {
1478
1478
  }
1479
1479
  const FormDataE = g["FormData"] || FormDataP;
1480
1480
 
1481
- var _a$4, _b$1;
1482
- /** @internal */ const state$8 = Symbol( /* "HeadersState" */);
1481
+ var _a$5, _b$2;
1482
+ /** @internal */ const state$b = Symbol( /* "HeadersState" */);
1483
1483
  const checkArgsFn = (args, required, funcName) => { checkArgsLength(args, required, "Headers", funcName); };
1484
1484
  class HeadersP {
1485
1485
  constructor(init) {
1486
- this[state$8] = new HeadersState();
1486
+ this[state$b] = new HeadersState();
1487
1487
  if (init !== undefined) {
1488
1488
  if (isObjectType("Headers", init)) {
1489
1489
  init.forEach((value, name) => { this.append(name, value); }, this);
@@ -1514,15 +1514,15 @@ class HeadersP {
1514
1514
  }
1515
1515
  }
1516
1516
  }
1517
- this[state$8][_initialized] = true;
1517
+ this[state$b][_initialized] = true;
1518
1518
  }
1519
1519
  append(...args) {
1520
1520
  const [name, value] = args;
1521
1521
  checkArgsFn(args, 2, "append");
1522
- let _name = normalizeName(name, throwsFn(this[state$8][_initialized] ? "append" : ""));
1522
+ let _name = normalizeName(name, throwsFn(this[state$b][_initialized] ? "append" : ""));
1523
1523
  let _value = normalizeValue(value);
1524
1524
  let index = -1;
1525
- let array = this[state$8][_headersArray];
1525
+ let array = this[state$b][_headersArray];
1526
1526
  for (let i = 0; i < array.length; ++i) {
1527
1527
  let item = array[i];
1528
1528
  if (item[0] === _name) {
@@ -1540,7 +1540,7 @@ class HeadersP {
1540
1540
  checkArgsFn(args, 1, "delete");
1541
1541
  let _name = normalizeName(name, throwsFn("delete"));
1542
1542
  let index = -1;
1543
- let array = this[state$8][_headersArray];
1543
+ let array = this[state$b][_headersArray];
1544
1544
  let result = [];
1545
1545
  for (let i = 0; i < array.length; ++i) {
1546
1546
  let item = array[i];
@@ -1551,14 +1551,14 @@ class HeadersP {
1551
1551
  result.push(item);
1552
1552
  }
1553
1553
  if (index > -1) {
1554
- this[state$8][_headersArray] = result;
1554
+ this[state$b][_headersArray] = result;
1555
1555
  }
1556
1556
  }
1557
1557
  get(...args) {
1558
1558
  const [name] = args;
1559
1559
  checkArgsFn(args, 1, "get");
1560
1560
  let _name = normalizeName(name, throwsFn("get"));
1561
- let array = this[state$8][_headersArray];
1561
+ let array = this[state$b][_headersArray];
1562
1562
  for (let i = 0; i < array.length; ++i) {
1563
1563
  let item = array[i];
1564
1564
  if (item[0] === _name) {
@@ -1575,7 +1575,7 @@ class HeadersP {
1575
1575
  const [name] = args;
1576
1576
  checkArgsFn(args, 1, "has");
1577
1577
  let _name = normalizeName(name, throwsFn("has"));
1578
- let array = this[state$8][_headersArray];
1578
+ let array = this[state$b][_headersArray];
1579
1579
  for (let i = 0; i < array.length; ++i) {
1580
1580
  let item = array[i];
1581
1581
  if (item[0] === _name) {
@@ -1590,7 +1590,7 @@ class HeadersP {
1590
1590
  let _name = normalizeName(name, throwsFn("set"));
1591
1591
  let _value = normalizeValue(value);
1592
1592
  let index = -1;
1593
- let array = this[state$8][_headersArray];
1593
+ let array = this[state$b][_headersArray];
1594
1594
  for (let i = 0; i < array.length; ++i) {
1595
1595
  let item = array[i];
1596
1596
  if (item[0] === _name) {
@@ -1609,20 +1609,20 @@ class HeadersP {
1609
1609
  if (typeof callbackfn !== "function") {
1610
1610
  throw new TypeError("Failed to execute 'forEach' on 'Headers': parameter 1 is not of type 'Function'.");
1611
1611
  }
1612
- let array = this[state$8][_headersArray];
1612
+ let array = this[state$b][_headersArray];
1613
1613
  for (let i = 0; i < array.length; ++i) {
1614
1614
  let item = array[i];
1615
1615
  callbackfn.call(thisArg, item[1], item[0], this);
1616
1616
  }
1617
1617
  }
1618
1618
  entries() {
1619
- return this[state$8][_headersArray].map(x => [x[0], x[1]]).values();
1619
+ return this[state$b][_headersArray].map(x => [x[0], x[1]]).values();
1620
1620
  }
1621
1621
  keys() {
1622
- return this[state$8][_headersArray].map(x => x[0]).values();
1622
+ return this[state$b][_headersArray].map(x => x[0]).values();
1623
1623
  }
1624
1624
  values() {
1625
- return this[state$8][_headersArray].map(x => x[1]).values();
1625
+ return this[state$b][_headersArray].map(x => x[1]).values();
1626
1626
  }
1627
1627
  [Symbol.iterator]() {
1628
1628
  return this.entries();
@@ -1636,11 +1636,11 @@ Class_setStringTag(HeadersP, "Headers");
1636
1636
  /** @internal */
1637
1637
  class HeadersState {
1638
1638
  constructor() {
1639
- this[_a$4] = false;
1640
- this[_b$1] = [];
1639
+ this[_a$5] = false;
1640
+ this[_b$2] = [];
1641
1641
  }
1642
1642
  }
1643
- _a$4 = _initialized, _b$1 = _headersArray;
1643
+ _a$5 = _initialized, _b$2 = _headersArray;
1644
1644
  function throwsFn(kind) {
1645
1645
  return () => {
1646
1646
  throw new TypeError(`Failed to ${kind ? ("execute '" + kind + "' on") : "construct"} 'Headers': Invalid name`);
@@ -1684,23 +1684,23 @@ function parseHeaders(rawHeaders) {
1684
1684
  }
1685
1685
  const HeadersE = g["Headers"] || HeadersP;
1686
1686
 
1687
- var _a$3;
1688
- /** @internal */ const state$7 = Symbol( /* "BodyState" */);
1687
+ var _a$4;
1688
+ /** @internal */ const state$a = Symbol( /* "BodyState" */);
1689
1689
  class BodyImpl {
1690
1690
  /** @internal */
1691
1691
  constructor() {
1692
1692
  if (new.target === BodyImpl) {
1693
1693
  throw new TypeError("Failed to construct 'Body': Illegal constructor");
1694
1694
  }
1695
- this[state$7] = new BodyState();
1695
+ this[state$a] = new BodyState();
1696
1696
  }
1697
1697
  get body() {
1698
- if (!this[state$7][_body]) {
1698
+ if (!this[state$a][_body]) {
1699
1699
  return null;
1700
1700
  }
1701
- throw new TypeError(`Failed to access 'body' on '${this[state$7].name}': property not implemented.`);
1701
+ throw new TypeError(`Failed to access 'body' on '${this[state$a].name}': property not implemented.`);
1702
1702
  }
1703
- get bodyUsed() { return this[state$7].bodyUsed; }
1703
+ get bodyUsed() { return this[state$a].bodyUsed; }
1704
1704
  ;
1705
1705
  arrayBuffer() {
1706
1706
  const kind = "arrayBuffer";
@@ -1737,23 +1737,23 @@ class BodyState {
1737
1737
  constructor() {
1738
1738
  this.name = "Body";
1739
1739
  this.bodyUsed = false;
1740
- this[_a$3] = "";
1740
+ this[_a$4] = "";
1741
1741
  }
1742
1742
  }
1743
- _a$3 = _body;
1743
+ _a$4 = _body;
1744
1744
  /** @internal */
1745
1745
  function Body_init(body, payload) {
1746
1746
  const b = body;
1747
1747
  if (isObjectType("ReadableStream", payload)) {
1748
- throw new TypeError(`Failed to construct '${b[state$7].name}': ReadableStream not implemented.`);
1748
+ throw new TypeError(`Failed to construct '${b[state$a].name}': ReadableStream not implemented.`);
1749
1749
  }
1750
- b[state$7][_body] = convert(payload, true, type => { if (!b.headers.has("Content-Type")) {
1750
+ b[state$a][_body] = convert(payload, true, type => { if (!b.headers.has("Content-Type")) {
1751
1751
  b.headers.set("Content-Type", type);
1752
1752
  } });
1753
1753
  }
1754
1754
  /** @internal */
1755
1755
  function Body_toPayload(body) {
1756
- return body[state$7][_body];
1756
+ return body[state$a][_body];
1757
1757
  }
1758
1758
  function read(body, kind) {
1759
1759
  return new Promise((resolve, reject) => {
@@ -1766,7 +1766,7 @@ function read(body, kind) {
1766
1766
  });
1767
1767
  }
1768
1768
  function readSync(body, kind) {
1769
- const payload = body[state$7][_body];
1769
+ const payload = body[state$a][_body];
1770
1770
  if (kind === "arrayBuffer") {
1771
1771
  return convertBack("arraybuffer", payload);
1772
1772
  }
@@ -1803,7 +1803,7 @@ function readSync(body, kind) {
1803
1803
  }
1804
1804
  }
1805
1805
  function consumed(body, kind) {
1806
- const s = body[state$7];
1806
+ const s = body[state$a];
1807
1807
  if (!s[_body])
1808
1808
  return;
1809
1809
  if (s.bodyUsed) {
@@ -1883,9 +1883,9 @@ function convertBack(type, data) {
1883
1883
  }
1884
1884
  }
1885
1885
 
1886
- var _a$2;
1886
+ var _a$3;
1887
1887
  /** @internal */
1888
- const state$6 = Symbol( /* "AbortSignalState" */);
1888
+ const state$9 = Symbol( /* "AbortSignalState" */);
1889
1889
  class AbortSignalP extends EventTargetP {
1890
1890
  static abort(reason) {
1891
1891
  let signal = createAbortSignal();
@@ -1942,40 +1942,40 @@ class AbortSignalP extends EventTargetP {
1942
1942
  throw new TypeError("Failed to construct 'AbortSignal': Illegal constructor");
1943
1943
  }
1944
1944
  super();
1945
- this[state$6] = new AbortSignalState(this);
1945
+ this[state$9] = new AbortSignalState(this);
1946
1946
  }
1947
- get aborted() { return this[state$6].aborted; }
1948
- get reason() { return this[state$6].reason; }
1947
+ get aborted() { return this[state$9].aborted; }
1948
+ get reason() { return this[state$9].reason; }
1949
1949
  throwIfAborted() {
1950
1950
  if (this.aborted) {
1951
1951
  throw this.reason;
1952
1952
  }
1953
1953
  }
1954
- get onabort() { return this[state$6].onabort; }
1954
+ get onabort() { return this[state$9].onabort; }
1955
1955
  set onabort(value) {
1956
- this[state$6].onabort = value;
1957
- attachFn(this, "abort", value, this[state$6][_handlers$2].onabort);
1956
+ this[state$9].onabort = value;
1957
+ attachFn(this, "abort", value, this[state$9][_handlers$3].onabort);
1958
1958
  }
1959
1959
  /** @internal */ toString() { return "[object AbortSignal]"; }
1960
1960
  /** @internal */ get isPolyfill() { return { symbol: polyfill, hierarchy: ["AbortSignal", "EventTarget"] }; }
1961
1961
  }
1962
1962
  Class_setStringTag(AbortSignalP, "AbortSignal");
1963
1963
  /** @internal */
1964
- const _handlers$2 = Symbol();
1964
+ const _handlers$3 = Symbol();
1965
1965
  /** @internal */
1966
1966
  class AbortSignalState {
1967
1967
  constructor(target) {
1968
1968
  this.aborted = false;
1969
1969
  this.reason = undefined;
1970
- this[_a$2] = getHandlers$2(this);
1970
+ this[_a$3] = getHandlers$3(this);
1971
1971
  this.onabort = null;
1972
1972
  this.target = target;
1973
1973
  }
1974
1974
  }
1975
- _a$2 = _handlers$2;
1975
+ _a$3 = _handlers$3;
1976
1976
  /** @internal */
1977
1977
  function AbortSignal_abort(signal, reason, notify = true, isTrusted = true) {
1978
- const s = signal[state$6];
1978
+ const s = signal[state$9];
1979
1979
  if (!s.aborted) {
1980
1980
  s.aborted = true;
1981
1981
  s.reason = reason !== null && reason !== void 0 ? reason : (new MPException("signal is aborted without reason", "AbortError"));
@@ -1985,7 +1985,7 @@ function AbortSignal_abort(signal, reason, notify = true, isTrusted = true) {
1985
1985
  }
1986
1986
  }
1987
1987
  }
1988
- function getHandlers$2(s) {
1988
+ function getHandlers$3(s) {
1989
1989
  return {
1990
1990
  onabort: (ev) => { executeFn(s.target, s.onabort, ev); },
1991
1991
  };
@@ -1993,21 +1993,21 @@ function getHandlers$2(s) {
1993
1993
  /** @internal */
1994
1994
  function createAbortSignal() {
1995
1995
  let signal = Object.create(AbortSignalP.prototype);
1996
- signal[state$d] = new EventTargetState(signal);
1997
- signal[state$6] = new AbortSignalState(signal);
1996
+ signal[state$g] = new EventTargetState(signal);
1997
+ signal[state$9] = new AbortSignalState(signal);
1998
1998
  return signal;
1999
1999
  }
2000
2000
  const AbortSignalE = g["AbortSignal"] || AbortSignalP;
2001
2001
 
2002
2002
  /** @internal */
2003
- const state$5 = Symbol( /* "AbortControllerState" */);
2003
+ const state$8 = Symbol( /* "AbortControllerState" */);
2004
2004
  class AbortControllerP {
2005
2005
  constructor() {
2006
- this[state$5] = new AbortControllerState();
2006
+ this[state$8] = new AbortControllerState();
2007
2007
  }
2008
- get signal() { return this[state$5].signal; }
2008
+ get signal() { return this[state$8].signal; }
2009
2009
  abort(reason) {
2010
- AbortSignal_abort(this[state$5].signal, reason);
2010
+ AbortSignal_abort(this[state$8].signal, reason);
2011
2011
  }
2012
2012
  /** @internal */ toString() { return "[object AbortController]"; }
2013
2013
  /** @internal */ get isPolyfill() { return { symbol: polyfill, hierarchy: ["AbortController"] }; }
@@ -2021,15 +2021,15 @@ class AbortControllerState {
2021
2021
  }
2022
2022
  const AbortControllerE = g["AbortController"] || AbortControllerP;
2023
2023
 
2024
- /** @internal */ const state$4 = Symbol( /* "RequestState" */);
2024
+ /** @internal */ const state$7 = Symbol( /* "RequestState" */);
2025
2025
  class RequestP extends BodyImpl {
2026
2026
  constructor(...args) {
2027
2027
  const [input, init] = args;
2028
2028
  checkArgsLength(args, 1, "Request");
2029
2029
  super();
2030
- this[state$7].name = "Request";
2031
- this[state$4] = new RequestState();
2032
- const s = this[state$4];
2030
+ this[state$a].name = "Request";
2031
+ this[state$7] = new RequestState();
2032
+ const s = this[state$7];
2033
2033
  let _init = init !== null && init !== void 0 ? init : {};
2034
2034
  if (typeof _init !== "object") {
2035
2035
  throw new TypeError("Failed to construct 'Request': The provided value is not of type 'RequestInit'.");
@@ -2046,7 +2046,7 @@ class RequestP extends BodyImpl {
2046
2046
  }
2047
2047
  s.method = input.method;
2048
2048
  s.mode = input.mode;
2049
- let inputSignal = input[state$4].signal;
2049
+ let inputSignal = input[state$7].signal;
2050
2050
  if (inputSignal) {
2051
2051
  s.signal = inputSignal;
2052
2052
  }
@@ -2054,7 +2054,7 @@ class RequestP extends BodyImpl {
2054
2054
  let payload = Body_toPayload(input);
2055
2055
  if (!body && payload !== "") {
2056
2056
  body = payload;
2057
- input[state$7].bodyUsed = true;
2057
+ input[state$a].bodyUsed = true;
2058
2058
  }
2059
2059
  }
2060
2060
  else {
@@ -2098,31 +2098,31 @@ class RequestP extends BodyImpl {
2098
2098
  }
2099
2099
  }
2100
2100
  }
2101
- get cache() { return this[state$4].cache; }
2102
- get credentials() { return this[state$4].credentials; }
2103
- get destination() { return this[state$4].destination; }
2101
+ get cache() { return this[state$7].cache; }
2102
+ get credentials() { return this[state$7].credentials; }
2103
+ get destination() { return this[state$7].destination; }
2104
2104
  get headers() {
2105
- const s = this[state$4];
2105
+ const s = this[state$7];
2106
2106
  if (!s.headers) {
2107
2107
  s.headers = new HeadersP();
2108
2108
  }
2109
2109
  return s.headers;
2110
2110
  }
2111
- get integrity() { return this[state$4].integrity; }
2112
- get keepalive() { return this[state$4].keepalive; }
2113
- get method() { return this[state$4].method; }
2114
- get mode() { return this[state$4].mode; }
2115
- get redirect() { return this[state$4].redirect; }
2116
- get referrer() { return this[state$4].referrer; }
2117
- get referrerPolicy() { return this[state$4].referrerPolicy; }
2111
+ get integrity() { return this[state$7].integrity; }
2112
+ get keepalive() { return this[state$7].keepalive; }
2113
+ get method() { return this[state$7].method; }
2114
+ get mode() { return this[state$7].mode; }
2115
+ get redirect() { return this[state$7].redirect; }
2116
+ get referrer() { return this[state$7].referrer; }
2117
+ get referrerPolicy() { return this[state$7].referrerPolicy; }
2118
2118
  get signal() {
2119
- const s = this[state$4];
2119
+ const s = this[state$7];
2120
2120
  if (!s.signal) {
2121
2121
  s.signal = (new AbortControllerP()).signal;
2122
2122
  }
2123
2123
  return s.signal;
2124
2124
  }
2125
- get url() { return this[state$4].url; }
2125
+ get url() { return this[state$7].url; }
2126
2126
  clone() {
2127
2127
  var _a;
2128
2128
  if (this.bodyUsed) {
@@ -2161,7 +2161,7 @@ const RequestE = g["Request"] || RequestP;
2161
2161
 
2162
2162
  // @ts-nocheck
2163
2163
  /** @internal */
2164
- const mp$2 = (() => {
2164
+ const mp$3 = (() => {
2165
2165
  let u = "undefined", r = "request", f = "function";
2166
2166
  let mp;
2167
2167
  mp =
@@ -2186,7 +2186,7 @@ const mp$2 = (() => {
2186
2186
  return mp;
2187
2187
  })();
2188
2188
 
2189
- const request = mp$2 ? mp$2.request : function errorRequest(options) {
2189
+ const request = mp$3 ? mp$3.request : function errorRequest(options) {
2190
2190
  const errMsg = "NOT_SUPPORTED_ERR";
2191
2191
  const errno = 9;
2192
2192
  const err = {
@@ -2213,8 +2213,8 @@ const request = mp$2 ? mp$2.request : function errorRequest(options) {
2213
2213
  throw new ReferenceError("request is not defined");
2214
2214
  };
2215
2215
 
2216
- var _a$1;
2217
- /** @internal */ const state$3 = Symbol( /* "XMLHttpRequestEventTargetState" */);
2216
+ var _a$2;
2217
+ /** @internal */ const state$6 = Symbol( /* "XMLHttpRequestEventTargetState" */);
2218
2218
  class XMLHttpRequestEventTargetP extends EventTargetP {
2219
2219
  /** @internal */
2220
2220
  constructor() {
@@ -2222,35 +2222,35 @@ class XMLHttpRequestEventTargetP extends EventTargetP {
2222
2222
  throw new TypeError("Failed to construct 'XMLHttpRequestEventTarget': Illegal constructor");
2223
2223
  }
2224
2224
  super();
2225
- this[state$3] = new XMLHttpRequestEventTargetState(this);
2226
- }
2227
- get onabort() { return this[state$3].onabort; }
2228
- set onabort(value) { this[state$3].onabort = value; attach(this, "abort"); }
2229
- get onerror() { return this[state$3].onerror; }
2230
- set onerror(value) { this[state$3].onerror = value; attach(this, "error"); }
2231
- get onload() { return this[state$3].onload; }
2232
- set onload(value) { this[state$3].onload = value; attach(this, "load"); }
2233
- get onloadend() { return this[state$3].onloadend; }
2234
- set onloadend(value) { this[state$3].onloadend = value; attach(this, "loadend"); }
2235
- get onloadstart() { return this[state$3].onloadstart; }
2236
- set onloadstart(value) { this[state$3].onloadstart = value; attach(this, "loadstart"); }
2237
- get onprogress() { return this[state$3].onprogress; }
2238
- set onprogress(value) { this[state$3].onprogress = value; attach(this, "progress"); }
2239
- get ontimeout() { return this[state$3].ontimeout; }
2240
- set ontimeout(value) { this[state$3].ontimeout = value; attach(this, "timeout"); }
2225
+ this[state$6] = new XMLHttpRequestEventTargetState(this);
2226
+ }
2227
+ get onabort() { return this[state$6].onabort; }
2228
+ set onabort(value) { this[state$6].onabort = value; attach$1(this, "abort"); }
2229
+ get onerror() { return this[state$6].onerror; }
2230
+ set onerror(value) { this[state$6].onerror = value; attach$1(this, "error"); }
2231
+ get onload() { return this[state$6].onload; }
2232
+ set onload(value) { this[state$6].onload = value; attach$1(this, "load"); }
2233
+ get onloadend() { return this[state$6].onloadend; }
2234
+ set onloadend(value) { this[state$6].onloadend = value; attach$1(this, "loadend"); }
2235
+ get onloadstart() { return this[state$6].onloadstart; }
2236
+ set onloadstart(value) { this[state$6].onloadstart = value; attach$1(this, "loadstart"); }
2237
+ get onprogress() { return this[state$6].onprogress; }
2238
+ set onprogress(value) { this[state$6].onprogress = value; attach$1(this, "progress"); }
2239
+ get ontimeout() { return this[state$6].ontimeout; }
2240
+ set ontimeout(value) { this[state$6].ontimeout = value; attach$1(this, "timeout"); }
2241
2241
  /** @internal */ toString() { return "[object XMLHttpRequestEventTarget]"; }
2242
2242
  /** @internal */ get isPolyfill() { return { symbol: polyfill, hierarchy: ["XMLHttpRequestEventTarget", "EventTarget"] }; }
2243
2243
  }
2244
2244
  Class_setStringTag(XMLHttpRequestEventTargetP, "XMLHttpRequestEventTarget");
2245
2245
  /** @internal */
2246
- const _handlers$1 = Symbol();
2246
+ const _handlers$2 = Symbol();
2247
2247
  /** @internal */
2248
2248
  class XMLHttpRequestEventTargetState {
2249
2249
  /**
2250
2250
  * @param _target XMLHttpRequestEventTarget
2251
2251
  */
2252
2252
  constructor(_target) {
2253
- this[_a$1] = getHandlers$1(this);
2253
+ this[_a$2] = getHandlers$2(this);
2254
2254
  this.onabort = null;
2255
2255
  this.onerror = null;
2256
2256
  this.onload = null;
@@ -2261,15 +2261,15 @@ class XMLHttpRequestEventTargetState {
2261
2261
  this.target = _target;
2262
2262
  }
2263
2263
  }
2264
- _a$1 = _handlers$1;
2265
- function attach(target, type) {
2266
- const s = target[state$3];
2264
+ _a$2 = _handlers$2;
2265
+ function attach$1(target, type) {
2266
+ const s = target[state$6];
2267
2267
  const fnName = ("on" + type);
2268
2268
  const cb = s[fnName];
2269
- const listener = s[_handlers$1][fnName];
2269
+ const listener = s[_handlers$2][fnName];
2270
2270
  attachFn(target, type, cb, listener);
2271
2271
  }
2272
- function getHandlers$1(s) {
2272
+ function getHandlers$2(s) {
2273
2273
  return {
2274
2274
  onabort: (ev) => { executeFn(s.target, s.onabort, ev); },
2275
2275
  onerror: (ev) => { executeFn(s.target, s.onerror, ev); },
@@ -2376,50 +2376,50 @@ Class_setStringTag(XMLHttpRequestUploadP, "XMLHttpRequestUpload");
2376
2376
  /** @internal */
2377
2377
  function createXMLHttpRequestUpload() {
2378
2378
  let upload = Object.create(XMLHttpRequestUploadP.prototype);
2379
- upload[state$d] = new EventTargetState(upload);
2380
- upload[state$3] = new XMLHttpRequestEventTargetState(upload);
2379
+ upload[state$g] = new EventTargetState(upload);
2380
+ upload[state$6] = new XMLHttpRequestEventTargetState(upload);
2381
2381
  return upload;
2382
2382
  }
2383
2383
 
2384
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
2385
- const mp$1 = { request: request };
2386
- const setRequest = (request) => { mp$1.request = request; };
2384
+ var _a$1, _b$1, _c, _d, _e, _f, _g, _h, _j, _k;
2385
+ const mp$2 = { request: request };
2386
+ const setRequest = (request) => { mp$2.request = request; };
2387
2387
  /** @internal */
2388
- const state$2 = Symbol( /* "XMLHttpRequestState" */);
2388
+ const state$5 = Symbol( /* "XMLHttpRequestState" */);
2389
2389
  class XMLHttpRequestImpl extends XMLHttpRequestEventTargetP {
2390
2390
  constructor() {
2391
2391
  super();
2392
- this[state$2] = new XMLHttpRequestState(this);
2392
+ this[state$5] = new XMLHttpRequestState(this);
2393
2393
  }
2394
- get readyState() { return this[state$2].readyState; }
2395
- get response() { return this[state$2].response; }
2394
+ get readyState() { return this[state$5].readyState; }
2395
+ get response() { return this[state$5].response; }
2396
2396
  get responseText() { return (!this.responseType || this.responseType === "text") ? this.response : ""; }
2397
- get responseType() { return this[state$2].responseType; }
2398
- set responseType(value) { this[state$2].responseType = normalizeResponseType(value); }
2399
- get responseURL() { return this[state$2].responseURL; }
2397
+ get responseType() { return this[state$5].responseType; }
2398
+ set responseType(value) { this[state$5].responseType = normalizeResponseType(value); }
2399
+ get responseURL() { return this[state$5].responseURL; }
2400
2400
  get responseXML() { return null; }
2401
- get status() { return this[state$2].status; }
2401
+ get status() { return this[state$5].status; }
2402
2402
  get statusText() {
2403
2403
  if (this.readyState === XMLHttpRequestImpl.UNSENT || this.readyState === XMLHttpRequestImpl.OPENED)
2404
2404
  return "";
2405
- return this[state$2].statusText || statusTextMap(this.status);
2405
+ return this[state$5].statusText || statusTextMap(this.status);
2406
2406
  }
2407
- get timeout() { return this[state$2].timeout; }
2408
- set timeout(value) { this[state$2].timeout = value > 0 ? value : 0; }
2407
+ get timeout() { return this[state$5].timeout; }
2408
+ set timeout(value) { this[state$5].timeout = value > 0 ? value : 0; }
2409
2409
  get upload() {
2410
- const s = this[state$2];
2410
+ const s = this[state$5];
2411
2411
  if (!s.upload) {
2412
2412
  s.upload = createXMLHttpRequestUpload();
2413
2413
  }
2414
2414
  return s.upload;
2415
2415
  }
2416
- get withCredentials() { return this[state$2].withCredentials; }
2417
- set withCredentials(value) { this[state$2].withCredentials = !!value; }
2416
+ get withCredentials() { return this[state$5].withCredentials; }
2417
+ set withCredentials(value) { this[state$5].withCredentials = !!value; }
2418
2418
  abort() {
2419
2419
  clearRequest(this);
2420
2420
  }
2421
2421
  getAllResponseHeaders() {
2422
- const headers = this[state$2][_responseHeaders];
2422
+ const headers = this[state$5][_responseHeaders];
2423
2423
  if (!headers)
2424
2424
  return "";
2425
2425
  let result = [];
@@ -2429,9 +2429,9 @@ class XMLHttpRequestImpl extends XMLHttpRequestEventTargetP {
2429
2429
  getResponseHeader(...args) {
2430
2430
  const [name] = args;
2431
2431
  checkArgsLength(args, 1, "XMLHttpRequest", "getResponseHeader");
2432
- if (!this[state$2][_responseHeaders])
2432
+ if (!this[state$5][_responseHeaders])
2433
2433
  return null;
2434
- return this[state$2][_responseHeaders].get(name);
2434
+ return this[state$5][_responseHeaders].get(name);
2435
2435
  }
2436
2436
  open(...args) {
2437
2437
  const [method, url, async = true, username = null, password = null] = args;
@@ -2439,7 +2439,7 @@ class XMLHttpRequestImpl extends XMLHttpRequestEventTargetP {
2439
2439
  if (!async) {
2440
2440
  console.warn("Synchronous XMLHttpRequest is not supported because of its detrimental effects to the end user's experience.");
2441
2441
  }
2442
- const s = this[state$2];
2442
+ const s = this[state$5];
2443
2443
  clearRequest(this, false);
2444
2444
  s[_method] = normalizeMethod(method);
2445
2445
  s[_requestURL] = "" + url;
@@ -2457,12 +2457,12 @@ class XMLHttpRequestImpl extends XMLHttpRequestEventTargetP {
2457
2457
  overrideMimeType(...args) {
2458
2458
  const [mime] = args;
2459
2459
  checkArgsLength(args, 1, "XMLHttpRequest", "overrideMimeType");
2460
- if (this[state$2][_inAfterOpenBeforeSend]) {
2460
+ if (this[state$5][_inAfterOpenBeforeSend]) {
2461
2461
  console.error(`TypeError: Failed to execute 'overrideMimeType' on 'XMLHttpRequest': mimeType ('${mime}') not implemented.`);
2462
2462
  }
2463
2463
  }
2464
2464
  send(body) {
2465
- const s = this[state$2];
2465
+ const s = this[state$5];
2466
2466
  if (!s[_inAfterOpenBeforeSend] || s.readyState !== XMLHttpRequestImpl.OPENED) {
2467
2467
  throw new MPException("Failed to execute 'send' on 'XMLHttpRequest': The object's state must be OPENED.", "InvalidStateError");
2468
2468
  }
@@ -2495,7 +2495,7 @@ class XMLHttpRequestImpl extends XMLHttpRequestEventTargetP {
2495
2495
  };
2496
2496
  // Alipay Mini Program
2497
2497
  options.headers = options.header;
2498
- s[_requestTask] = mp$1.request(options);
2498
+ s[_requestTask] = mp$2.request(options);
2499
2499
  emitProcessEvent(this, "loadstart");
2500
2500
  if (processContentLength && s.upload) {
2501
2501
  emitProcessEvent(this.upload, "loadstart", 0, contentLength);
@@ -2522,7 +2522,7 @@ class XMLHttpRequestImpl extends XMLHttpRequestEventTargetP {
2522
2522
  setRequestHeader(...args) {
2523
2523
  const [name, value] = args;
2524
2524
  checkArgsLength(args, 2, "XMLHttpRequest", "setRequestHeader");
2525
- const s = this[state$2];
2525
+ const s = this[state$5];
2526
2526
  if (!s[_inAfterOpenBeforeSend] || s.readyState !== XMLHttpRequestImpl.OPENED) {
2527
2527
  throw new MPException("Failed to execute 'setRequestHeader' on 'XMLHttpRequest': The object's state must be OPENED.", "InvalidStateError");
2528
2528
  }
@@ -2531,10 +2531,10 @@ class XMLHttpRequestImpl extends XMLHttpRequestEventTargetP {
2531
2531
  });
2532
2532
  s[_requestHeaders].append(_name, value);
2533
2533
  }
2534
- get onreadystatechange() { return this[state$2].onreadystatechange; }
2534
+ get onreadystatechange() { return this[state$5].onreadystatechange; }
2535
2535
  set onreadystatechange(value) {
2536
- this[state$2].onreadystatechange = value;
2537
- attachFn(this, "readystatechange", value, this[state$2][_handlers].onreadystatechange);
2536
+ this[state$5].onreadystatechange = value;
2537
+ attachFn(this, "readystatechange", value, this[state$5][_handlers$1].onreadystatechange);
2538
2538
  }
2539
2539
  /** @internal */ toString() { return "[object XMLHttpRequest]"; }
2540
2540
  /** @internal */ get isPolyfill() { return { symbol: polyfill, hierarchy: ["XMLHttpRequest", "XMLHttpRequestEventTarget", "EventTarget"] }; }
@@ -2542,7 +2542,7 @@ class XMLHttpRequestImpl extends XMLHttpRequestEventTargetP {
2542
2542
  Object.defineProperties(XMLHttpRequestImpl, XHR_properties);
2543
2543
  Object.defineProperties(XMLHttpRequestImpl.prototype, XHR_properties);
2544
2544
  Class_setStringTag(XMLHttpRequestImpl, "XMLHttpRequest");
2545
- /** @internal */ const _handlers = Symbol();
2545
+ /** @internal */ const _handlers$1 = Symbol();
2546
2546
  /** @internal */ const _inAfterOpenBeforeSend = Symbol();
2547
2547
  /** @internal */ const _resetPending = Symbol();
2548
2548
  /** @internal */ const _timeoutId = Symbol();
@@ -2563,9 +2563,9 @@ class XMLHttpRequestState {
2563
2563
  this.statusText = "";
2564
2564
  this.timeout = 0;
2565
2565
  this.withCredentials = false;
2566
- this[_a] = getHandlers(this);
2566
+ this[_a$1] = getHandlers$1(this);
2567
2567
  this.onreadystatechange = null;
2568
- this[_b] = false;
2568
+ this[_b$1] = false;
2569
2569
  this[_c] = false;
2570
2570
  this[_d] = 0;
2571
2571
  this[_e] = "";
@@ -2577,8 +2577,8 @@ class XMLHttpRequestState {
2577
2577
  this.target = target;
2578
2578
  }
2579
2579
  }
2580
- _a = _handlers, _b = _inAfterOpenBeforeSend, _c = _resetPending, _d = _timeoutId, _e = _requestURL, _f = _method, _g = _requestHeaders, _h = _responseHeaders, _j = _responseContentLength, _k = _requestTask;
2581
- function getHandlers(s) {
2580
+ _a$1 = _handlers$1, _b$1 = _inAfterOpenBeforeSend, _c = _resetPending, _d = _timeoutId, _e = _requestURL, _f = _method, _g = _requestHeaders, _h = _responseHeaders, _j = _responseContentLength, _k = _requestTask;
2581
+ function getHandlers$1(s) {
2582
2582
  return {
2583
2583
  onreadystatechange: (ev) => { executeFn(s.target, s.onreadystatechange, ev); },
2584
2584
  };
@@ -2587,7 +2587,7 @@ function normalizeDataType(responseType) {
2587
2587
  return (responseType === "blob" || responseType === "arraybuffer") ? "arraybuffer" : "text";
2588
2588
  }
2589
2589
  function requestSuccess(res) {
2590
- const s = this[state$2];
2590
+ const s = this[state$5];
2591
2591
  s.responseURL = s[_requestURL];
2592
2592
  s.status = "statusCode" in res ? res.statusCode : "status" in res ? res.status : 200;
2593
2593
  s[_responseHeaders] = new HeadersP(("header" in res ? res.header : "headers" in res ? res.headers : undefined));
@@ -2628,7 +2628,7 @@ function requestFail(err) {
2628
2628
  });
2629
2629
  return;
2630
2630
  }
2631
- const s = this[state$2];
2631
+ const s = this[state$5];
2632
2632
  s.status = 0;
2633
2633
  s.statusText = "errMsg" in err ? err.errMsg : "errorMessage" in err ? err.errorMessage : "";
2634
2634
  if (!s[_inAfterOpenBeforeSend] && s.readyState !== XMLHttpRequestImpl.UNSENT && s.readyState !== XMLHttpRequestImpl.DONE) {
@@ -2637,7 +2637,7 @@ function requestFail(err) {
2637
2637
  }
2638
2638
  }
2639
2639
  function requestComplete() {
2640
- const s = this[state$2];
2640
+ const s = this[state$5];
2641
2641
  s[_requestTask] = null;
2642
2642
  if (!s[_inAfterOpenBeforeSend] && (s.readyState === XMLHttpRequestImpl.OPENED || s.readyState === XMLHttpRequestImpl.LOADING)) {
2643
2643
  setReadyStateAndNotify(this, XMLHttpRequestImpl.DONE);
@@ -2656,7 +2656,7 @@ function safeAbort(task) {
2656
2656
  }
2657
2657
  }
2658
2658
  function clearRequest(xhr, delay = true) {
2659
- const s = xhr[state$2];
2659
+ const s = xhr[state$5];
2660
2660
  const timerFn = delay ? setTimeout : (f) => { f(); };
2661
2661
  s[_resetPending] = true;
2662
2662
  if (s[_requestTask] && s.readyState !== XMLHttpRequestImpl.DONE) {
@@ -2686,7 +2686,7 @@ function clearRequest(xhr, delay = true) {
2686
2686
  });
2687
2687
  }
2688
2688
  function checkRequestTimeout(xhr) {
2689
- const s = xhr[state$2];
2689
+ const s = xhr[state$5];
2690
2690
  if (s.timeout) {
2691
2691
  s[_timeoutId] = setTimeout(() => {
2692
2692
  if (!s.status && s.readyState !== XMLHttpRequestImpl.DONE) {
@@ -2699,7 +2699,7 @@ function checkRequestTimeout(xhr) {
2699
2699
  }
2700
2700
  }
2701
2701
  function resetXHR(xhr) {
2702
- const s = xhr[state$2];
2702
+ const s = xhr[state$5];
2703
2703
  s[_resetPending] = false;
2704
2704
  resetRequestTimeout(xhr);
2705
2705
  s.response = "";
@@ -2711,14 +2711,14 @@ function resetXHR(xhr) {
2711
2711
  s[_responseContentLength] = () => 0;
2712
2712
  }
2713
2713
  function resetRequestTimeout(xhr) {
2714
- const s = xhr[state$2];
2714
+ const s = xhr[state$5];
2715
2715
  if (s[_timeoutId]) {
2716
2716
  clearTimeout(s[_timeoutId]);
2717
2717
  s[_timeoutId] = 0;
2718
2718
  }
2719
2719
  }
2720
2720
  function setReadyStateAndNotify(xhr, value) {
2721
- const s = xhr[state$2];
2721
+ const s = xhr[state$5];
2722
2722
  let hasChanged = value !== s.readyState;
2723
2723
  s.readyState = value;
2724
2724
  if (hasChanged) {
@@ -2730,13 +2730,13 @@ function setReadyStateAndNotify(xhr, value) {
2730
2730
  const XMLHttpRequestP = XMLHttpRequestImpl;
2731
2731
  const XMLHttpRequestE = (typeof XMLHttpRequest !== "undefined" && XMLHttpRequest) || XMLHttpRequestP;
2732
2732
 
2733
- /** @internal */ const state$1 = Symbol( /* "ResponseState" */);
2733
+ /** @internal */ const state$4 = Symbol( /* "ResponseState" */);
2734
2734
  class ResponseP extends BodyImpl {
2735
2735
  constructor(body, init) {
2736
2736
  super();
2737
- this[state$7].name = "Response";
2738
- this[state$1] = new ResponseState();
2739
- const s = this[state$1];
2737
+ this[state$a].name = "Response";
2738
+ this[state$4] = new ResponseState();
2739
+ const s = this[state$4];
2740
2740
  let _init = init !== null && init !== void 0 ? init : {};
2741
2741
  if (typeof _init !== "object") {
2742
2742
  throw new TypeError("Failed to construct 'Response': The provided value is not of type 'ResponseInit'.");
@@ -2754,18 +2754,18 @@ class ResponseP extends BodyImpl {
2754
2754
  Body_init(this, body);
2755
2755
  }
2756
2756
  get headers() {
2757
- const s = this[state$1];
2757
+ const s = this[state$4];
2758
2758
  if (!s.headers) {
2759
2759
  s.headers = new HeadersP();
2760
2760
  }
2761
2761
  return s.headers;
2762
2762
  }
2763
- get ok() { return this[state$1].ok; }
2764
- get redirected() { return this[state$1].redirected; }
2765
- get status() { return this[state$1].status; }
2766
- get statusText() { return this[state$1].statusText; }
2767
- get type() { return this[state$1].type; }
2768
- get url() { return this[state$1].url; }
2763
+ get ok() { return this[state$4].ok; }
2764
+ get redirected() { return this[state$4].redirected; }
2765
+ get status() { return this[state$4].status; }
2766
+ get statusText() { return this[state$4].statusText; }
2767
+ get type() { return this[state$4].type; }
2768
+ get url() { return this[state$4].url; }
2769
2769
  clone() {
2770
2770
  if (this.bodyUsed) {
2771
2771
  throw new TypeError("Failed to execute 'clone' on 'Response': Response body is already used");
@@ -2775,7 +2775,7 @@ class ResponseP extends BodyImpl {
2775
2775
  status: this.status,
2776
2776
  statusText: this.statusText,
2777
2777
  });
2778
- response[state$1].url = this.url;
2778
+ response[state$4].url = this.url;
2779
2779
  return response;
2780
2780
  }
2781
2781
  static json(...args) {
@@ -2787,9 +2787,9 @@ class ResponseP extends BodyImpl {
2787
2787
  }
2788
2788
  static error() {
2789
2789
  let response = new ResponseP(null, { status: 200, statusText: "" });
2790
- response[state$1].ok = false;
2791
- response[state$1].status = 0;
2792
- response[state$1].type = "error";
2790
+ response[state$4].ok = false;
2791
+ response[state$4].status = 0;
2792
+ response[state$4].type = "error";
2793
2793
  return response;
2794
2794
  }
2795
2795
  static redirect(...args) {
@@ -2817,8 +2817,8 @@ class ResponseState {
2817
2817
  }
2818
2818
  const ResponseE = g["Response"] || ResponseP;
2819
2819
 
2820
- const mp = { XMLHttpRequest: XMLHttpRequestE };
2821
- const setXMLHttpRequest = (XHR) => { mp.XMLHttpRequest = XHR; };
2820
+ const mp$1 = { XMLHttpRequest: XMLHttpRequestE };
2821
+ const setXMLHttpRequest = (XHR) => { mp$1.XMLHttpRequest = XHR; };
2822
2822
  function fetchP(...args) {
2823
2823
  if (new.target === fetchP) {
2824
2824
  throw new TypeError("fetch is not a constructor");
@@ -2827,11 +2827,11 @@ function fetchP(...args) {
2827
2827
  checkArgsLength(args, 1, "Window", "fetch");
2828
2828
  return new Promise((resolve, reject) => {
2829
2829
  const request = new RequestP(input, init);
2830
- const signal = request[state$4].signal;
2830
+ const signal = request[state$7].signal;
2831
2831
  if (signal && signal.aborted) {
2832
2832
  return reject(signal.reason);
2833
2833
  }
2834
- let xhr = new mp.XMLHttpRequest();
2834
+ let xhr = new mp$1.XMLHttpRequest();
2835
2835
  xhr.onload = function () {
2836
2836
  let options = {
2837
2837
  headers: parseHeaders(xhr.getAllResponseHeaders() || ""),
@@ -2845,7 +2845,7 @@ function fetchP(...args) {
2845
2845
  }
2846
2846
  setTimeout(() => {
2847
2847
  let response = new ResponseP("response" in xhr ? xhr.response : xhr.responseText, options);
2848
- response[state$1].url = "responseURL" in xhr ? xhr.responseURL : (options.headers.get("X-Request-URL") || "");
2848
+ response[state$4].url = "responseURL" in xhr ? xhr.responseURL : (options.headers.get("X-Request-URL") || "");
2849
2849
  resolve(response);
2850
2850
  });
2851
2851
  };
@@ -2908,24 +2908,24 @@ function fetchP(...args) {
2908
2908
  }
2909
2909
  const fetchE = g["fetch"] || fetchP;
2910
2910
 
2911
- const dispatched = 1;
2911
+ const dispatched$1 = 1;
2912
2912
  /** @internal */
2913
- const state = Symbol( /* "CustomEventState" */);
2913
+ const state$3 = Symbol( /* "CustomEventState" */);
2914
2914
  class CustomEventP extends EventP {
2915
2915
  constructor(type, eventInitDict) {
2916
2916
  var _a;
2917
2917
  super(type, eventInitDict);
2918
- this[state] = new CustomEventState();
2919
- this[state].detail = (_a = eventInitDict === null || eventInitDict === void 0 ? void 0 : eventInitDict.detail) !== null && _a !== void 0 ? _a : null;
2918
+ this[state$3] = new CustomEventState();
2919
+ this[state$3].detail = (_a = eventInitDict === null || eventInitDict === void 0 ? void 0 : eventInitDict.detail) !== null && _a !== void 0 ? _a : null;
2920
2920
  }
2921
- get detail() { return this[state].detail; }
2921
+ get detail() { return this[state$3].detail; }
2922
2922
  initCustomEvent(...args) {
2923
2923
  const [type, bubbles, cancelable, detail] = args;
2924
2924
  checkArgsLength(args, 1, "CustomEvent", "initCustomEvent");
2925
- if (Event_getEtField(this, dispatched))
2925
+ if (Event_getEtField(this, dispatched$1))
2926
2926
  return;
2927
2927
  this.initEvent(type, bubbles, cancelable);
2928
- this[state].detail = detail !== null && detail !== void 0 ? detail : null;
2928
+ this[state$3].detail = detail !== null && detail !== void 0 ? detail : null;
2929
2929
  }
2930
2930
  /** @internal */ toString() { return "[object CustomEvent]"; }
2931
2931
  /** @internal */ get isPolyfill() { return { symbol: polyfill, hierarchy: ["CustomEvent", "Event"] }; }
@@ -2936,4 +2936,316 @@ class CustomEventState {
2936
2936
  }
2937
2937
  const CustomEventE = g["EventTarget"] ? g["CustomEvent"] : CustomEventP;
2938
2938
 
2939
- export { AbortControllerE as AbortController, AbortControllerP, AbortSignalE as AbortSignal, AbortSignalP, BlobE as Blob, BlobP, CustomEventE as CustomEvent, CustomEventP, EventE as Event, EventP, EventTargetE as EventTarget, EventTargetP, FileE as File, FileP, FileReaderE as FileReader, FileReaderP, FormDataE as FormData, FormDataP, HeadersE as Headers, HeadersP, ProgressEventE as ProgressEvent, ProgressEventP, RequestE as Request, RequestP, ResponseE as Response, ResponseP, TextDecoderE as TextDecoder, TextDecoderP, TextEncoderE as TextEncoder, TextEncoderP, URLSearchParamsE as URLSearchParams, URLSearchParamsP, XMLHttpRequestE as XMLHttpRequest, XMLHttpRequestP, fetchE as fetch, fetchP, setRequest, setXMLHttpRequest };
2939
+ /** @internal */
2940
+ const state$2 = Symbol( /* "CloseEventState" */);
2941
+ class CloseEventP extends EventP {
2942
+ constructor(type, eventInitDict) {
2943
+ var _a;
2944
+ super(type, eventInitDict);
2945
+ this[state$2] = new CloseEventState();
2946
+ const s = this[state$2];
2947
+ let _code = Number((_a = eventInitDict === null || eventInitDict === void 0 ? void 0 : eventInitDict.code) !== null && _a !== void 0 ? _a : 0);
2948
+ s.code = isNaN(_code) ? 0 : _code;
2949
+ if ((eventInitDict === null || eventInitDict === void 0 ? void 0 : eventInitDict.reason) !== undefined)
2950
+ s.reason = "" + eventInitDict.reason;
2951
+ s.wasClean = !!(eventInitDict === null || eventInitDict === void 0 ? void 0 : eventInitDict.wasClean);
2952
+ }
2953
+ get code() { return this[state$2].code; }
2954
+ get reason() { return this[state$2].reason; }
2955
+ get wasClean() { return this[state$2].wasClean; }
2956
+ /** @internal */ toString() { return "[object CloseEvent]"; }
2957
+ /** @internal */ get isPolyfill() { return { symbol: polyfill, hierarchy: ["CloseEvent", "Event"] }; }
2958
+ }
2959
+ Class_setStringTag(CloseEventP, "CloseEvent");
2960
+ /** @internal */
2961
+ class CloseEventState {
2962
+ constructor() {
2963
+ this.code = 0;
2964
+ this.reason = "";
2965
+ this.wasClean = false;
2966
+ }
2967
+ }
2968
+ g["EventTarget"] ? g["CloseEvent"] : CloseEventP;
2969
+
2970
+ const dispatched = 1;
2971
+ /** @internal */
2972
+ const state$1 = Symbol( /* "MessageEventState" */);
2973
+ class MessageEventP extends EventP {
2974
+ constructor(type, eventInitDict) {
2975
+ var _a;
2976
+ super(type, eventInitDict);
2977
+ this[state$1] = new MessageEventState();
2978
+ const s = this[state$1];
2979
+ s.data = (_a = eventInitDict === null || eventInitDict === void 0 ? void 0 : eventInitDict.data) !== null && _a !== void 0 ? _a : null;
2980
+ if ((eventInitDict === null || eventInitDict === void 0 ? void 0 : eventInitDict.origin) !== undefined)
2981
+ s.origin = "" + eventInitDict.origin;
2982
+ if ((eventInitDict === null || eventInitDict === void 0 ? void 0 : eventInitDict.lastEventId) !== undefined)
2983
+ s.lastEventId = "" + eventInitDict.lastEventId;
2984
+ if ((eventInitDict === null || eventInitDict === void 0 ? void 0 : eventInitDict.source) !== undefined)
2985
+ s.source = eventInitDict.source;
2986
+ if ((eventInitDict === null || eventInitDict === void 0 ? void 0 : eventInitDict.ports) !== undefined)
2987
+ s.ports = eventInitDict.ports;
2988
+ }
2989
+ get data() { return this[state$1].data; }
2990
+ get lastEventId() { return this[state$1].lastEventId; }
2991
+ get origin() { return this[state$1].origin; }
2992
+ get ports() { return this[state$1].ports; }
2993
+ get source() { return this[state$1].source; }
2994
+ initMessageEvent(...args) {
2995
+ const [type, bubbles, cancelable, data, origin, lastEventId, source, ports] = args;
2996
+ checkArgsLength(args, 1, "MessageEvent", "initMessageEvent");
2997
+ if (Event_getEtField(this, dispatched))
2998
+ return;
2999
+ this.initEvent(type, bubbles, cancelable);
3000
+ const s = this[state$1];
3001
+ s.data = data !== null && data !== void 0 ? data : null;
3002
+ if (origin !== undefined)
3003
+ s.origin = "" + origin;
3004
+ if (lastEventId !== undefined)
3005
+ s.lastEventId = "" + lastEventId;
3006
+ if (source !== undefined)
3007
+ s.source = source;
3008
+ if (ports !== undefined)
3009
+ s.ports = ports;
3010
+ }
3011
+ /** @internal */ toString() { return "[object MessageEvent]"; }
3012
+ /** @internal */ get isPolyfill() { return { symbol: polyfill, hierarchy: ["MessageEvent", "Event"] }; }
3013
+ }
3014
+ Class_setStringTag(MessageEventP, "MessageEvent");
3015
+ /** @internal */
3016
+ class MessageEventState {
3017
+ constructor() {
3018
+ this.data = null;
3019
+ this.lastEventId = "";
3020
+ this.origin = "";
3021
+ this.ports = [];
3022
+ this.source = null;
3023
+ }
3024
+ }
3025
+ g["EventTarget"] ? g["MessageEvent"] : MessageEventP;
3026
+
3027
+ const connectSocket = mp$3 ? mp$3.connectSocket : function errorConnectSocket(options) {
3028
+ return {
3029
+ send(obj) { },
3030
+ close(obj) { },
3031
+ onOpen(listener) { },
3032
+ onMessage(listener) { },
3033
+ onError(listener) {
3034
+ if (typeof listener === "function") {
3035
+ listener({ errMsg: "NOT_SUPPORTED_ERR" });
3036
+ }
3037
+ },
3038
+ onClose(listener) {
3039
+ if (typeof listener === "function") {
3040
+ setTimeout(() => { listener({ code: 3009, reason: "NOT_SUPPORTED_ERR" }); });
3041
+ }
3042
+ },
3043
+ };
3044
+ };
3045
+
3046
+ var _a, _b;
3047
+ const mp = { connectSocket: connectSocket };
3048
+ const setConnectSocket = (connectSocket) => { mp.connectSocket = connectSocket; };
3049
+ /** @internal */
3050
+ const state = Symbol( /* "WebSocketState" */);
3051
+ class WebSocketImpl extends EventTargetP {
3052
+ constructor(...args) {
3053
+ const [url, protocols] = args;
3054
+ checkArgsLength(args, 1, "WebSocket");
3055
+ super();
3056
+ this[state] = new WebSocketState(this, {
3057
+ url: "" + url,
3058
+ protocols: protocols !== undefined
3059
+ ? (Array.isArray(protocols) || (protocols && typeof protocols === "object" && Symbol.iterator in protocols))
3060
+ ? Array.isArray(protocols) ? protocols : Array.from(protocols)
3061
+ : ["" + protocols]
3062
+ : [],
3063
+ multiple: true, // Alipay Mini Program
3064
+ fail(err) { console.error(err); },
3065
+ });
3066
+ let socketTask = this[state][_socketTask];
3067
+ if (socketTask && typeof socketTask === "object") {
3068
+ onOpen(this);
3069
+ onClose(this);
3070
+ onError(this);
3071
+ onMessage(this);
3072
+ }
3073
+ else {
3074
+ throw new Error(`connectSocket can't establish a connection to the server at ${"" + url}.`);
3075
+ }
3076
+ }
3077
+ get binaryType() { return this[state].binaryType; }
3078
+ set binaryType(value) { if (value === "blob" || value === "arraybuffer") {
3079
+ this[state].binaryType = value;
3080
+ } }
3081
+ get bufferedAmount() { return this[state].bufferedAmount; }
3082
+ get extensions() { return this[state].extensions; }
3083
+ get protocol() { return this[state].protocol; }
3084
+ get readyState() { return this[state].readyState; }
3085
+ get url() { return this[state].url; }
3086
+ close(code, reason) {
3087
+ if (this.readyState === WebSocketImpl.CLOSING || this.readyState === WebSocketImpl.CLOSED)
3088
+ return;
3089
+ this[state].readyState = WebSocketImpl.CLOSING;
3090
+ this[state][_socketTask].close({
3091
+ code: code,
3092
+ reason: reason,
3093
+ fail(err) { console.error(err); },
3094
+ complete: (function () {
3095
+ this[state].readyState = WebSocketImpl.CLOSED;
3096
+ }).bind(this),
3097
+ });
3098
+ }
3099
+ send(...args) {
3100
+ const [data] = args;
3101
+ checkArgsLength(args, 1, "WebSocket", "send");
3102
+ if (this.readyState === WebSocketImpl.CONNECTING) {
3103
+ throw new MPException("Failed to execute 'send' on 'WebSocket': Still in CONNECTING state.", "InvalidStateError");
3104
+ }
3105
+ if (this.readyState === WebSocketImpl.CLOSING || this.readyState === WebSocketImpl.CLOSED) {
3106
+ return console.error("WebSocket is already in CLOSING or CLOSED state.");
3107
+ }
3108
+ let _data;
3109
+ if (data instanceof ArrayBuffer) {
3110
+ _data = data;
3111
+ }
3112
+ else if (ArrayBuffer.isView(data)) {
3113
+ _data = data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength);
3114
+ }
3115
+ else if (isPolyfillType("Blob", data)) {
3116
+ _data = Blob_toUint8Array(data).buffer.slice(0);
3117
+ }
3118
+ else {
3119
+ _data = "" + data;
3120
+ }
3121
+ this[state][_socketTask].send({
3122
+ data: _data,
3123
+ fail(err) { console.error(err); },
3124
+ });
3125
+ }
3126
+ get onclose() { return this[state].onclose; }
3127
+ set onclose(value) { this[state].onclose = value; attach(this, "close"); }
3128
+ get onerror() { return this[state].onerror; }
3129
+ set onerror(value) { this[state].onerror = value; attach(this, "error"); }
3130
+ get onmessage() { return this[state].onmessage; }
3131
+ set onmessage(value) { this[state].onmessage = value; attach(this, "message"); }
3132
+ get onopen() { return this[state].onopen; }
3133
+ set onopen(value) { this[state].onopen = value; attach(this, "open"); }
3134
+ /** @internal */ toString() { return "[object WebSocket]"; }
3135
+ /** @internal */ get isPolyfill() { return { symbol: polyfill, hierarchy: ["WebSocket", "EventTarget"] }; }
3136
+ }
3137
+ const properties = {
3138
+ CONNECTING: { value: 0, enumerable: true },
3139
+ OPEN: { value: 1, enumerable: true },
3140
+ CLOSING: { value: 2, enumerable: true },
3141
+ CLOSED: { value: 3, enumerable: true },
3142
+ };
3143
+ Object.defineProperties(WebSocketImpl, properties);
3144
+ Object.defineProperties(WebSocketImpl.prototype, properties);
3145
+ Class_setStringTag(WebSocketImpl, "WebSocket");
3146
+ /** @internal */ const _socketTask = Symbol();
3147
+ /** @internal */ const _error = Symbol();
3148
+ /** @internal */ const _handlers = Symbol();
3149
+ /** @internal */
3150
+ class WebSocketState {
3151
+ constructor(target, opts) {
3152
+ this.binaryType = "blob";
3153
+ this.bufferedAmount = 0;
3154
+ this.extensions = "";
3155
+ this.protocol = "";
3156
+ this.readyState = 0;
3157
+ this[_a] = null;
3158
+ this[_b] = getHandlers(this);
3159
+ this.onclose = null;
3160
+ this.onerror = null;
3161
+ this.onmessage = null;
3162
+ this.onopen = null;
3163
+ this.target = target;
3164
+ this.url = opts.url;
3165
+ this[_socketTask] = mp.connectSocket(opts);
3166
+ }
3167
+ }
3168
+ _a = _error, _b = _handlers;
3169
+ function attach(target, type) {
3170
+ const s = target[state];
3171
+ const fnName = ("on" + type);
3172
+ const cb = s[fnName];
3173
+ const listener = s[_handlers][fnName];
3174
+ attachFn(target, type, cb, listener);
3175
+ }
3176
+ function getHandlers(s) {
3177
+ return {
3178
+ onclose: (ev) => { executeFn(s.target, s.onclose, ev); },
3179
+ onerror: (ev) => { executeFn(s.target, s.onerror, ev); },
3180
+ onmessage: (ev) => { executeFn(s.target, s.onmessage, ev); },
3181
+ onopen: (ev) => { executeFn(s.target, s.onopen, ev); },
3182
+ };
3183
+ }
3184
+ function onOpen(ws) {
3185
+ let _ws = ws;
3186
+ _ws[state][_socketTask].onOpen(res => {
3187
+ if ("header" in res && res.header && typeof res.header === "object") {
3188
+ let headers = new HeadersP(res.header);
3189
+ _ws[state].protocol = headers.get("Sec-WebSocket-Protocol") || "";
3190
+ }
3191
+ _ws[state].readyState = WebSocketImpl.OPEN;
3192
+ EventTarget_fire(_ws, createInnerEvent(_ws, "open"));
3193
+ });
3194
+ }
3195
+ function onClose(ws) {
3196
+ let _ws = ws;
3197
+ _ws[state][_socketTask].onClose(res => {
3198
+ _ws[state].readyState = WebSocketImpl.CLOSED;
3199
+ let event = new CloseEventP("close", {
3200
+ wasClean: !_ws[state][_error],
3201
+ code: res.code,
3202
+ reason: res.reason,
3203
+ });
3204
+ Event_setTrusted(event, true);
3205
+ EventTarget_fire(_ws, event);
3206
+ });
3207
+ }
3208
+ function onError(ws) {
3209
+ let _ws = ws;
3210
+ _ws[state][_socketTask].onError(res => {
3211
+ console.error(res);
3212
+ _ws[state][_error] = res;
3213
+ _ws[state].readyState = WebSocketImpl.CLOSED;
3214
+ EventTarget_fire(_ws, createInnerEvent(_ws, "error"));
3215
+ });
3216
+ }
3217
+ function onMessage(ws) {
3218
+ let _ws = ws;
3219
+ _ws[state][_socketTask].onMessage(res => {
3220
+ let data = res.data;
3221
+ let _data;
3222
+ // Alipay Mini Program
3223
+ if (data && typeof data === "object" && "data" in data) {
3224
+ _data = data.data;
3225
+ if ("isBuffer" in data && data.isBuffer && typeof _data === "string") {
3226
+ // @ts-ignore
3227
+ try {
3228
+ _data = my.base64ToArrayBuffer(_data);
3229
+ }
3230
+ catch (e) { }
3231
+ }
3232
+ }
3233
+ else {
3234
+ _data = data;
3235
+ }
3236
+ if (_data instanceof ArrayBuffer && _ws.binaryType === "blob") {
3237
+ _data = new BlobP([_data]);
3238
+ }
3239
+ let event = new MessageEventP("message", {
3240
+ data: _data,
3241
+ origin: _ws.url,
3242
+ });
3243
+ Event_setTrusted(event, true);
3244
+ EventTarget_fire(_ws, event);
3245
+ });
3246
+ }
3247
+
3248
+ const WebSocketP = WebSocketImpl;
3249
+ const WebSocketE = (typeof WebSocket !== "undefined" && WebSocket) || WebSocketP;
3250
+
3251
+ export { AbortControllerE as AbortController, AbortControllerP, AbortSignalE as AbortSignal, AbortSignalP, BlobE as Blob, BlobP, CustomEventE as CustomEvent, CustomEventP, EventE as Event, EventP, EventTargetE as EventTarget, EventTargetP, FileE as File, FileP, FileReaderE as FileReader, FileReaderP, FormDataE as FormData, FormDataP, HeadersE as Headers, HeadersP, RequestE as Request, RequestP, ResponseE as Response, ResponseP, TextDecoderE as TextDecoder, TextDecoderP, TextEncoderE as TextEncoder, TextEncoderP, URLSearchParamsE as URLSearchParams, URLSearchParamsP, WebSocketE as WebSocket, WebSocketP, XMLHttpRequestE as XMLHttpRequest, XMLHttpRequestP, fetchE as fetch, fetchP, setConnectSocket, setRequest, setXMLHttpRequest };