mphttpx 2.6.0 → 2.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,13 +10,6 @@ function _callSuper(t, o, e) {
10
10
  function _classCallCheck(a, n) {
11
11
  if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
12
12
  }
13
- function _construct(t, e, r) {
14
- if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments);
15
- var o = [null];
16
- o.push.apply(o, e);
17
- var p = new (t.bind.apply(t, o))();
18
- return r && _setPrototypeOf(p, r.prototype), p;
19
- }
20
13
  function _defineProperties(e, r) {
21
14
  for (var t = 0; t < r.length; t++) {
22
15
  var o = r[t];
@@ -53,13 +46,6 @@ function _inherits(t, e) {
53
46
  writable: false
54
47
  }), e && _setPrototypeOf(t, e);
55
48
  }
56
- function _isNativeFunction(t) {
57
- try {
58
- return -1 !== Function.toString.call(t).indexOf("[native code]");
59
- } catch (n) {
60
- return "function" == typeof t;
61
- }
62
- }
63
49
  function _isNativeReflectConstruct() {
64
50
  try {
65
51
  var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
@@ -101,35 +87,20 @@ function _typeof(o) {
101
87
  return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
102
88
  }, _typeof(o);
103
89
  }
104
- function _wrapNativeSuper(t) {
105
- var r = "function" == typeof Map ? new Map() : void 0;
106
- return _wrapNativeSuper = function (t) {
107
- if (null === t || !_isNativeFunction(t)) return t;
108
- if ("function" != typeof t) throw new TypeError("Super expression must either be null or a function");
109
- if (void 0 !== r) {
110
- if (r.has(t)) return r.get(t);
111
- r.set(t, Wrapper);
112
- }
113
- function Wrapper() {
114
- return _construct(t, arguments, _getPrototypeOf(this).constructor);
115
- }
116
- return Wrapper.prototype = Object.create(t.prototype, {
117
- constructor: {
118
- value: Wrapper,
119
- enumerable: false,
120
- writable: true,
121
- configurable: true
122
- }
123
- }), _setPrototypeOf(Wrapper, t);
124
- }, _wrapNativeSuper(t);
125
- }
126
90
 
127
91
  // Safe fallback for Symbol.iterator and Symbol.toStringTag — uses native Symbol when available, string keys otherwise.
128
92
  var _Symbol = {
129
- iterator: typeof Symbol === "function" && Symbol.iterator || "Symbol(Symbol.iterator)",
130
- toStringTag: typeof Symbol === "function" && Symbol.toStringTag || "Symbol(Symbol.toStringTag)"
93
+ iterator: /*#__PURE__*/function () {
94
+ return typeof Symbol === "function" && Symbol.iterator || "Symbol(Symbol.iterator)";
95
+ }(),
96
+ toStringTag: /*#__PURE__*/function () {
97
+ return typeof Symbol === "function" && Symbol.toStringTag || "Symbol(Symbol.toStringTag)";
98
+ }()
131
99
  };
132
- var DOMExceptionP = /*#__PURE__*/function (_Error, _Symbol$toStringTag) {
100
+ var _Error = /*#__PURE__*/function () {
101
+ return Error;
102
+ }();
103
+ var DOMExceptionP = /*#__PURE__*/function (_Error2, _Symbol$toStringTag) {
133
104
  function DOMExceptionP(message, name) {
134
105
  var _this;
135
106
  _classCallCheck(this, DOMExceptionP);
@@ -138,7 +109,7 @@ var DOMExceptionP = /*#__PURE__*/function (_Error, _Symbol$toStringTag) {
138
109
  return _this;
139
110
  }
140
111
  /** @internal */
141
- _inherits(DOMExceptionP, _Error);
112
+ _inherits(DOMExceptionP, _Error2);
142
113
  return _createClass(DOMExceptionP, [{
143
114
  key: _Symbol$toStringTag,
144
115
  get: function get() {
@@ -153,15 +124,19 @@ var DOMExceptionP = /*#__PURE__*/function (_Error, _Symbol$toStringTag) {
153
124
  };
154
125
  }
155
126
  }]);
156
- }(/*#__PURE__*/_wrapNativeSuper(Error), _Symbol.toStringTag);
157
- var DOMExceptionE = function () {
127
+ }(_Error, _Symbol.toStringTag);
128
+ function isDOMExceptionSupported() {
158
129
  try {
159
130
  new DOMException();
160
131
  return true;
161
132
  } catch (e) {
162
133
  return false;
163
134
  }
164
- }() ? DOMException : DOMExceptionP;
135
+ }
136
+ function getDOMExceptionClass() {
137
+ return isDOMExceptionSupported() ? DOMException : DOMExceptionP;
138
+ }
139
+ var DOMExceptionE = /*#__PURE__*/getDOMExceptionClass();
165
140
  function className(object) {
166
141
  try {
167
142
  return object.__MPHTTPX__.chain[0];
@@ -174,8 +149,8 @@ function setState(target, name, value) {
174
149
  value: value
175
150
  });
176
151
  }
177
- // Safe wrapper around String() for type-like representations (e.g. "[object Blob]"). Axios
178
- function typeString(value) {
152
+ // Safe wrapper around String() catches errors and returns "[object Unknown]" as fallback.
153
+ function safeString(value) {
179
154
  try {
180
155
  return String(value);
181
156
  } catch (e) {
@@ -192,7 +167,9 @@ function isPolyfillType(name, value) {
192
167
  return strict ? index === 0 : index > -1;
193
168
  }(value[field].chain.indexOf(name));
194
169
  }
195
- var iteratorSupported = typeof Symbol === "function" && !!Symbol.iterator;
170
+ var iteratorSupported = /*#__PURE__*/function () {
171
+ return typeof Symbol === "function" && !!Symbol.iterator;
172
+ }();
196
173
  function isSequence(value) {
197
174
  return Array.isArray(value) || !!value && _typeof(value) === "object" && iteratorSupported && Symbol.iterator in value && typeof value[Symbol.iterator] === "function";
198
175
  }
@@ -364,11 +341,14 @@ function encodeText(input, destination) {
364
341
  }
365
342
  return {
366
343
  encoded: !HAS_DESTINATION ? target.slice(0, at) : destination,
344
+ // × WeChat 2.5.0
367
345
  read: read,
368
346
  written: at
369
347
  };
370
348
  }
371
- var TextEncoderE = typeof TextEncoder !== "undefined" && TextEncoder || TextEncoderP;
349
+ var TextEncoderE = /*#__PURE__*/function () {
350
+ return typeof TextEncoder !== "undefined" && TextEncoder || TextEncoderP;
351
+ }();
372
352
 
373
353
  var validLabels = ["utf-8", "utf8", "unicode-1-1-utf-8"];
374
354
  var TextDecoderP = /*#__PURE__*/function (_Symbol$toStringTag) {
@@ -456,7 +436,7 @@ function decodeText(input) {
456
436
  }
457
437
  return "";
458
438
  }
459
- var bytes = isArrayBuffer(input) ? new Uint8Array(input) : ArrayBuffer.isView(input) ? new Uint8Array(input.buffer, input.byteOffset, input.byteLength) : function () {
439
+ var bytes = isArrayBuffer(input) ? new Uint8Array(input) : ArrayBuffer_isView(input) ? new Uint8Array(input.buffer, input.byteOffset, input.byteLength) : function () {
460
440
  throw new TypeError("Input could not be converted to any of: ArrayBufferView, ArrayBuffer.");
461
441
  }();
462
442
  if (settings.partial.length > 0) {
@@ -580,12 +560,21 @@ function concatString(val) {
580
560
  }
581
561
  // Mini Program
582
562
  function isOtherArrayBuffer(value) {
583
- return !!value && _typeof(value) === "object" && "byteLength" in value && typeof value.byteLength === "number" && (isObjectType("ArrayBuffer", value) || typeString(value) === "[object ArrayBuffer]");
563
+ return !!value && _typeof(value) === "object" && "byteLength" in value && typeof value.byteLength === "number" && (isObjectType("ArrayBuffer", value) || safeString(value) === "[object ArrayBuffer]");
584
564
  }
585
565
  function isArrayBuffer(value) {
586
566
  return !!value && _typeof(value) === "object" && ArrayBuffer.prototype.isPrototypeOf(value) || isOtherArrayBuffer(value);
587
567
  }
588
- var TextDecoderE = typeof TextDecoder !== "undefined" && TextDecoder || TextDecoderP;
568
+ function isArrayBufferView(value) {
569
+ var typedArrayTags = ["[object Int8Array]", "[object Uint8Array]", "[object Uint8ClampedArray]", "[object Int16Array]", "[object Uint16Array]", "[object Int32Array]", "[object Uint32Array]", "[object Float32Array]", "[object Float64Array]"];
570
+ return !!value && _typeof(value) === "object" && (typedArrayTags.indexOf(Object.prototype.toString.call(value)) > -1 || typeof DataView !== "undefined" && DataView.prototype.isPrototypeOf(value));
571
+ }
572
+ function ArrayBuffer_isView(value) {
573
+ return ArrayBuffer.isView ? ArrayBuffer.isView(value) : isArrayBufferView(value);
574
+ }
575
+ var TextDecoderE = /*#__PURE__*/function () {
576
+ return typeof TextDecoder !== "undefined" && TextDecoder || TextDecoderP;
577
+ }();
589
578
 
590
579
  var EventP = /*#__PURE__*/function (_Symbol$toStringTag) {
591
580
  function EventP(type, eventInitDict) {
@@ -796,7 +785,9 @@ var EventState = /*#__PURE__*/_createClass(function EventState() {
796
785
  function state$j(target) {
797
786
  return target.__Event__;
798
787
  }
799
- var timeStamp = new Date().getTime();
788
+ var timeStamp = /*#__PURE__*/function () {
789
+ return new Date().getTime();
790
+ }();
800
791
  function getFuncName(func) {
801
792
  // ES5
802
793
  return "name" in func ? func.name : "unknown";
@@ -822,7 +813,9 @@ function Event_setTrusted(event, isTrusted) {
822
813
  var s = state$j(event) || {};
823
814
  s.isTrusted = "".concat(getFuncName(createTrustedPropertyDescriptor), ":").concat(isTrusted ? "YES" : "NO");
824
815
  }
825
- var EventE = typeof Event !== "undefined" && Event || EventP;
816
+ var EventE = /*#__PURE__*/function () {
817
+ return typeof Event !== "undefined" && Event || EventP;
818
+ }();
826
819
 
827
820
  var EventTargetP = /*#__PURE__*/function (_Symbol$toStringTag) {
828
821
  function EventTargetP() {
@@ -931,7 +924,7 @@ function isEvent(value) {
931
924
  var predicate = function predicate(str) {
932
925
  return "[object " === str.slice(0, 8) && str.slice(-6) === "Event]";
933
926
  };
934
- return !!value && _typeof(value) === "object" && "type" in value && typeof value.type === "string" && (predicate(Object.prototype.toString.call(value)) || predicate(typeString(value)));
927
+ return !!value && _typeof(value) === "object" && "type" in value && typeof value.type === "string" && (predicate(Object.prototype.toString.call(value)) || predicate(safeString(value)));
935
928
  }
936
929
  function whenAbort(target, executor, signal) {
937
930
  var _onAbort = function onAbort() {
@@ -1016,7 +1009,9 @@ function isEventTarget(value) {
1016
1009
  function isExternalEventTarget(value) {
1017
1010
  return !!value && _typeof(value) === "object" && "addEventListener" in value && typeof value.addEventListener === "function" && "removeEventListener" in value && typeof value.removeEventListener === "function";
1018
1011
  }
1019
- var EventTargetE = typeof EventTarget !== "undefined" && EventTarget || EventTargetP;
1012
+ var EventTargetE = /*#__PURE__*/function () {
1013
+ return typeof EventTarget !== "undefined" && EventTarget || EventTargetP;
1014
+ }();
1020
1015
 
1021
1016
  var CustomEventP = /*#__PURE__*/function (_EventP, _Symbol$toStringTag) {
1022
1017
  function CustomEventP(type, eventInitDict) {
@@ -1072,7 +1067,9 @@ var CustomEventState = /*#__PURE__*/_createClass(function CustomEventState() {
1072
1067
  function state$h(target) {
1073
1068
  return target.__CustomEvent__;
1074
1069
  }
1075
- var CustomEventE = typeof CustomEvent !== "undefined" && CustomEvent || CustomEventP;
1070
+ var CustomEventE = /*#__PURE__*/function () {
1071
+ return typeof CustomEvent !== "undefined" && CustomEvent || CustomEventP;
1072
+ }();
1076
1073
 
1077
1074
  var AbortSignalP = /*#__PURE__*/function (_EventTargetP, _Symbol$toStringTag) {
1078
1075
  /** @internal */
@@ -1235,7 +1232,9 @@ function AbortSignal_abort(signal) {
1235
1232
  }
1236
1233
  }
1237
1234
  }
1238
- var AbortSignalE = typeof AbortSignal !== "undefined" && AbortSignal || AbortSignalP;
1235
+ var AbortSignalE = /*#__PURE__*/function () {
1236
+ return typeof AbortSignal !== "undefined" && AbortSignal || AbortSignalP;
1237
+ }();
1239
1238
 
1240
1239
  var AbortControllerP = /*#__PURE__*/function (_Symbol$toStringTag) {
1241
1240
  function AbortControllerP() {
@@ -1282,12 +1281,20 @@ var AbortControllerState = /*#__PURE__*/_createClass(function AbortControllerSta
1282
1281
  function state$f(target) {
1283
1282
  return target.__AbortController__;
1284
1283
  }
1285
- var AbortControllerE = typeof AbortController !== "undefined" && AbortController || AbortControllerP;
1284
+ var AbortControllerE = /*#__PURE__*/function () {
1285
+ return typeof AbortController !== "undefined" && AbortController || AbortControllerP;
1286
+ }();
1286
1287
 
1287
- var encode$1 = TextEncoderE.prototype.encode.bind(new TextEncoderE());
1288
- var decode$1 = TextDecoderE.prototype.decode.bind(new TextDecoderE());
1288
+ var encode$1 = /*#__PURE__*/function () {
1289
+ return TextEncoderE.prototype.encode.bind(new TextEncoderE());
1290
+ }();
1291
+ var decode$1 = /*#__PURE__*/function () {
1292
+ return TextDecoderE.prototype.decode.bind(new TextDecoderE());
1293
+ }();
1289
1294
  var mp$3 = {
1290
- ReadableStream: typeof ReadableStream !== "undefined" && ReadableStream || undefined
1295
+ ReadableStream: /*#__PURE__*/function () {
1296
+ return typeof ReadableStream !== "undefined" && ReadableStream || undefined;
1297
+ }()
1291
1298
  };
1292
1299
  function setReadableStreamClass(RSClass) {
1293
1300
  mp$3.ReadableStream = RSClass;
@@ -1311,7 +1318,7 @@ var BlobP = /*#__PURE__*/function (_Symbol$toStringTag) {
1311
1318
  return new Uint8Array(r);
1312
1319
  }));
1313
1320
  } else {
1314
- var bytes = isArrayBuffer(chunk) || ArrayBuffer.isView(chunk) ? BufferSource_toUint8Array(chunk) : encode$1(chunk);
1321
+ var bytes = isArrayBuffer(chunk) || ArrayBuffer_isView(chunk) ? BufferSource_toUint8Array(chunk) : encode$1(chunk);
1315
1322
  size += bytes.length;
1316
1323
  tasks.push(Promise.resolve(bytes));
1317
1324
  }
@@ -1354,7 +1361,7 @@ var BlobP = /*#__PURE__*/function (_Symbol$toStringTag) {
1354
1361
  var blob = Object.create(BlobP.prototype);
1355
1362
  setState(blob, "__Blob__", new BlobState(state$e(this).promise.then(function (r) {
1356
1363
  return clone(r.slice(_start, _end));
1357
- })));
1364
+ }))); // × WeChat 2.5.0
1358
1365
  state$e(blob).size = calcSlicedSize(this.size, _start, _end);
1359
1366
  state$e(blob).type = normalizeType(contentType);
1360
1367
  return blob;
@@ -1483,15 +1490,19 @@ function isExternalBlob(value) {
1483
1490
  var strict = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
1484
1491
  var expects = ["[object Blob]"];
1485
1492
  if (!strict) expects.push("[object File]");
1486
- return !!value && _typeof(value) === "object" && "size" in value && typeof value.size === "number" && "arrayBuffer" in value && typeof value.arrayBuffer === "function" && (expects.indexOf(Object.prototype.toString.call(value)) > -1 || expects.indexOf(typeString(value)) > -1);
1493
+ return !!value && _typeof(value) === "object" && "size" in value && typeof value.size === "number" && "arrayBuffer" in value && typeof value.arrayBuffer === "function" && (expects.indexOf(Object.prototype.toString.call(value)) > -1 || expects.indexOf(safeString(value)) > -1);
1487
1494
  }
1488
- var BlobE = function () {
1495
+ function isBlobSupported() {
1489
1496
  try {
1490
- return new Blob(['ä']).size === 2;
1497
+ return new Blob(["ä"]).size === 2;
1491
1498
  } catch (e) {
1492
1499
  return false;
1493
1500
  }
1494
- }() ? Blob : BlobP;
1501
+ }
1502
+ function getBlobClass() {
1503
+ return isBlobSupported() ? Blob : BlobP;
1504
+ }
1505
+ var BlobE = /*#__PURE__*/getBlobClass();
1495
1506
 
1496
1507
  function createFileClass(BlobClass) {
1497
1508
  var FileClass = /*#__PURE__*/function (_BlobClass, _Symbol$toStringTag) {
@@ -1556,15 +1567,19 @@ var FileState = /*#__PURE__*/_createClass(function FileState() {
1556
1567
  function state$d(target) {
1557
1568
  return target.__File__;
1558
1569
  }
1559
- var FilePolyfill = createFileClass(BlobP);
1560
- var FileE = function () {
1570
+ var FilePolyfill = /*#__PURE__*/createFileClass(BlobP);
1571
+ function isFileSupported() {
1561
1572
  try {
1562
1573
  new File([], "");
1563
1574
  return true;
1564
1575
  } catch (e) {
1565
1576
  return false;
1566
1577
  }
1567
- }() ? File : BlobE === BlobP ? FilePolyfill : createFileClass(BlobE);
1578
+ }
1579
+ function getFileClass() {
1580
+ return isFileSupported() ? File : BlobE === BlobP ? FilePolyfill : createFileClass(BlobE);
1581
+ }
1582
+ var FileE = /*#__PURE__*/getFileClass();
1568
1583
 
1569
1584
  var fields = ["loaded", "total"];
1570
1585
  var ProgressEventP = /*#__PURE__*/function (_EventP, _Symbol$toStringTag) {
@@ -1841,7 +1856,7 @@ var FileReaderP = /*#__PURE__*/function (_EventTargetP, _Symbol$toStringTag) {
1841
1856
  /** @internal */
1842
1857
  var FileReaderState = /*#__PURE__*/_createClass(function FileReaderState(target) {
1843
1858
  _classCallCheck(this, FileReaderState);
1844
- this.pos = 0 /* FRCycle.EMPTY */;
1859
+ /** @internal */this.pos = 0 /* FRCycle.EMPTY */;
1845
1860
  this.readyState = 0 /* EMPTY */;
1846
1861
  this.result = null;
1847
1862
  this.error = null;
@@ -1970,7 +1985,9 @@ function Uint8Array_toBase64(input) {
1970
1985
  }
1971
1986
  return output.join("");
1972
1987
  }
1973
- var FileReaderE = typeof FileReader !== "undefined" && FileReader || FileReaderP;
1988
+ var FileReaderE = /*#__PURE__*/function () {
1989
+ return typeof FileReader !== "undefined" && FileReader || FileReaderP;
1990
+ }();
1974
1991
 
1975
1992
  var URLSearchParamsP = /*#__PURE__*/function (_Symbol$iterator, _Symbol$toStringTag) {
1976
1993
  function URLSearchParamsP(init) {
@@ -2242,9 +2259,11 @@ function isURLSearchParams(value) {
2242
2259
  return isPolyfillType("URLSearchParams", value) || isExternalURLSearchParams(value);
2243
2260
  }
2244
2261
  function isExternalURLSearchParams(value) {
2245
- return isObjectType("URLSearchParams", value) || !!value && _typeof(value) === "object" && typeof URLSearchParams === "function" && value instanceof URLSearchParams;
2262
+ return isObjectType("URLSearchParams", value) || !!value && _typeof(value) === "object" && "size" in value && typeof value.size === "number" && "forEach" in value && typeof value.forEach === "function" && typeof URLSearchParams === "function" && value instanceof URLSearchParams;
2246
2263
  }
2247
- var URLSearchParamsE = typeof URLSearchParams !== "undefined" && URLSearchParams || URLSearchParamsP;
2264
+ var URLSearchParamsE = /*#__PURE__*/function () {
2265
+ return typeof URLSearchParams !== "undefined" && URLSearchParams || URLSearchParamsP;
2266
+ }();
2248
2267
 
2249
2268
  var FormDataP = /*#__PURE__*/function (_Symbol$iterator, _Symbol$toStringTag) {
2250
2269
  function FormDataP(form, submitter) {
@@ -2493,7 +2512,7 @@ function isFormData(value) {
2493
2512
  }
2494
2513
  function isExternalFormData(value) {
2495
2514
  var expect = "[object FormData]";
2496
- return !!value && _typeof(value) === "object" && "forEach" in value && typeof value.forEach === "function" && (Object.prototype.toString.call(value) === expect || typeString(value) === expect);
2515
+ return !!value && _typeof(value) === "object" && "forEach" in value && typeof value.forEach === "function" && (Object.prototype.toString.call(value) === expect || safeString(value) === expect);
2497
2516
  }
2498
2517
  function FormData_toBlob(formData, externalBoundary) {
2499
2518
  var boundary = externalBoundary || "----formdata-mphttpx-" + Math.random();
@@ -2602,12 +2621,14 @@ function createFormDataFromBinaryText(text, boundary) {
2602
2621
  });
2603
2622
  return formData;
2604
2623
  }
2605
- var FormDataE = typeof FormData !== "undefined" && FormData || FormDataP;
2624
+ var FormDataE = /*#__PURE__*/function () {
2625
+ return typeof FormData !== "undefined" && FormData || FormDataP;
2626
+ }();
2606
2627
 
2607
2628
  var Payload = /*#__PURE__*/function () {
2608
2629
  function Payload(body, contentType) {
2609
2630
  _classCallCheck(this, Payload);
2610
- this._type = "";
2631
+ /** @internal */this._type = "";
2611
2632
  if (contentType) {
2612
2633
  this.type = contentType;
2613
2634
  }
@@ -2627,7 +2648,7 @@ var Payload = /*#__PURE__*/function () {
2627
2648
  } else if (isArrayBuffer(body)) {
2628
2649
  this.promise = Promise.resolve(body.slice(0));
2629
2650
  this.length = body.byteLength;
2630
- } else if (ArrayBuffer.isView(body)) {
2651
+ } else if (ArrayBuffer_isView(body)) {
2631
2652
  var _body2 = body.buffer.slice(body.byteOffset, body.byteOffset + body.byteLength);
2632
2653
  this.promise = Promise.resolve(_body2);
2633
2654
  this.length = _body2.byteLength;
@@ -2770,7 +2791,7 @@ function state$8(target) {
2770
2791
  }
2771
2792
  function initBody(instance, body) {
2772
2793
  var b = instance;
2773
- if (isReadableStream(body)) {
2794
+ if (isExternalReadableStream(body)) {
2774
2795
  throw new TypeError("Failed to construct '".concat(className(b), "': ReadableStream not implemented."));
2775
2796
  }
2776
2797
  if (body !== null && body !== undefined) {
@@ -2811,12 +2832,9 @@ function consumed(body, kind) {
2811
2832
  }
2812
2833
  return Promise.reject(new TypeError("Failed to execute '".concat(kind, "' on '").concat(className(body), "': body stream already read")));
2813
2834
  }
2814
- function isReadableStream(value) {
2815
- return isExternalReadableStream(value);
2816
- }
2817
2835
  function isExternalReadableStream(value) {
2818
2836
  var expect = "[object ReadableStream]";
2819
- return !!value && _typeof(value) === "object" && "getReader" in value && typeof value.getReader === "function" && (Object.prototype.toString.call(value) === expect || typeString(value) === expect);
2837
+ return !!value && _typeof(value) === "object" && "getReader" in value && typeof value.getReader === "function" && (Object.prototype.toString.call(value) === expect || safeString(value) === expect);
2820
2838
  }
2821
2839
 
2822
2840
  var HeadersP = /*#__PURE__*/function (_Symbol$iterator, _Symbol$toStringTag) {
@@ -2895,9 +2913,7 @@ var HeadersP = /*#__PURE__*/function (_Symbol$iterator, _Symbol$toStringTag) {
2895
2913
  key: "forEach",
2896
2914
  value: function forEach(callbackfn, thisArg) {
2897
2915
  checkArgsFn(arguments.length, 1, "forEach");
2898
- if (typeof callbackfn !== "function") {
2899
- throw new TypeError("Failed to execute 'forEach' on 'Headers': parameter 1 is not of type 'Function'.");
2900
- }
2916
+ if (typeof callbackfn !== "function") throw new TypeError("Failed to execute 'forEach' on 'Headers': parameter 1 is not of type 'Function'.");
2901
2917
  var dict = state$7(this).dict;
2902
2918
  var names = Object.getOwnPropertyNames(dict);
2903
2919
  for (var i = 0; i < names.length; ++i) {
@@ -2994,7 +3010,7 @@ function isHeaders(value) {
2994
3010
  }
2995
3011
  function isExternalHeaders(value) {
2996
3012
  var expect = "[object Headers]";
2997
- return !!value && _typeof(value) === "object" && "forEach" in value && typeof value.forEach === "function" && (Object.prototype.toString.call(value) === expect || typeString(value) === expect);
3013
+ return !!value && _typeof(value) === "object" && "forEach" in value && typeof value.forEach === "function" && (Object.prototype.toString.call(value) === expect || safeString(value) === expect);
2998
3014
  }
2999
3015
  function normalizeName(name, throwError) {
3000
3016
  if (typeof name !== "string") {
@@ -3039,7 +3055,9 @@ function createHeaders(headers) {
3039
3055
  }
3040
3056
  return new HeadersE(headers);
3041
3057
  }
3042
- var HeadersE = typeof Headers !== "undefined" && Headers || HeadersP;
3058
+ var HeadersE = /*#__PURE__*/function () {
3059
+ return typeof Headers !== "undefined" && Headers || HeadersP;
3060
+ }();
3043
3061
 
3044
3062
  var RequestP = /*#__PURE__*/function (_BodyImpl, _Symbol$toStringTag) {
3045
3063
  function RequestP(input, init) {
@@ -3233,7 +3251,7 @@ function isRequest(value) {
3233
3251
  }
3234
3252
  function isExternalRequest(value) {
3235
3253
  var expect = "[object Request]";
3236
- return !!value && _typeof(value) === "object" && "arrayBuffer" in value && typeof value.arrayBuffer === "function" && (Object.prototype.toString.call(value) === expect || typeString(value) === expect);
3254
+ return !!value && _typeof(value) === "object" && "arrayBuffer" in value && typeof value.arrayBuffer === "function" && (Object.prototype.toString.call(value) === expect || safeString(value) === expect);
3237
3255
  }
3238
3256
  function createPhonyPayload(request) {
3239
3257
  var payload = Object.create(Payload.prototype);
@@ -3278,7 +3296,9 @@ function normalizeMethod(method) {
3278
3296
  var upcased = method.toUpperCase();
3279
3297
  return methods.indexOf(upcased) > -1 ? upcased : method;
3280
3298
  }
3281
- var RequestE = typeof Request !== "undefined" && Request || RequestP;
3299
+ var RequestE = /*#__PURE__*/function () {
3300
+ return typeof Request !== "undefined" && Request || RequestP;
3301
+ }();
3282
3302
 
3283
3303
  var ResponseP = /*#__PURE__*/function (_BodyImpl, _Symbol$toStringTag) {
3284
3304
  function ResponseP(body, init) {
@@ -3426,19 +3446,29 @@ var ResponseState = /*#__PURE__*/_createClass(function ResponseState() {
3426
3446
  function state$5(target) {
3427
3447
  return target.__Response__;
3428
3448
  }
3429
- var ResponseE = typeof Response !== "undefined" && Response || ResponseP;
3449
+ var ResponseE = /*#__PURE__*/function () {
3450
+ return typeof Response !== "undefined" && Response || ResponseP;
3451
+ }();
3430
3452
 
3431
3453
  var mp$2 = {
3432
- XMLHttpRequest: typeof XMLHttpRequest !== "undefined" && XMLHttpRequest || undefined
3454
+ XMLHttpRequest: /*#__PURE__*/function () {
3455
+ return typeof XMLHttpRequest !== "undefined" && XMLHttpRequest || undefined;
3456
+ }()
3433
3457
  };
3434
3458
  function setXMLHttpRequestClass(XHRClass) {
3435
3459
  mp$2.XMLHttpRequest = XHRClass;
3436
3460
  }
3461
+ var textMode = {
3462
+ value: false
3463
+ };
3464
+ function setTextMode(value) {
3465
+ textMode.value = !!value;
3466
+ }
3437
3467
  function fetchP(input, init) {
3438
- checkArgsLength(arguments.length, 1, "Window", "fetch"); // @ts-expect-error
3439
3468
  if (this instanceof fetchP) {
3440
3469
  throw new TypeError("fetch is not a constructor");
3441
3470
  }
3471
+ checkArgsLength(arguments.length, 1, "globalThis", "fetch");
3442
3472
  return new Promise(function (resolve, reject) {
3443
3473
  var request = new RequestP(input, init);
3444
3474
  var signal = request.__Request__.signal;
@@ -3489,7 +3519,7 @@ function fetchP(input, init) {
3489
3519
  reject(new DOMExceptionE("The request timed out.", "TimeoutError"));
3490
3520
  }, 0);
3491
3521
  };
3492
- xhr.open(request.method, fixUrl$1(request.url), true);
3522
+ xhr.open(request.method, fixUrl(request.url), true);
3493
3523
  if (request.credentials === "include") {
3494
3524
  xhr.withCredentials = true;
3495
3525
  } else if (request.credentials === "omit") {
@@ -3534,7 +3564,7 @@ function fetchP(input, init) {
3534
3564
  };
3535
3565
  }
3536
3566
  if (!payload) xhr.send();else payload.promise.then(function (body) {
3537
- if (!aborted) xhr.send(body !== "" ? body : undefined);else reject(createAbortException());
3567
+ if (!aborted) xhr.send(body !== "" ? coerceBody(body) : undefined);else reject(createAbortException());
3538
3568
  }).catch(function (e) {
3539
3569
  reject(new TypeError("Failed to fetch"));
3540
3570
  console.error(e);
@@ -3544,15 +3574,22 @@ function fetchP(input, init) {
3544
3574
  function createAbortException() {
3545
3575
  return new DOMExceptionE("The user aborted a request.", "AbortError");
3546
3576
  }
3547
- var locationSupported = typeof location !== "undefined" && !!location;
3548
- var fixUrl$1 = function fixUrl(url) {
3577
+ var locationSupported = /*#__PURE__*/function () {
3578
+ return typeof location !== "undefined" && !!location;
3579
+ }();
3580
+ function fixUrl(url) {
3549
3581
  if (url === "" && locationSupported && (location === null || location === void 0 ? void 0 : location.href)) {
3550
3582
  return location.href;
3551
3583
  } else {
3552
3584
  return url;
3553
3585
  }
3554
- };
3555
- var fetchE$1 = typeof fetch !== "undefined" && fetch || fetchP;
3586
+ }
3587
+ function coerceBody(data) {
3588
+ return textMode.value && typeof data !== "string" ? decode$1(data) : data;
3589
+ }
3590
+ var fetchE$1 = /*#__PURE__*/function () {
3591
+ return typeof fetch !== "undefined" && fetch || fetchP;
3592
+ }();
3556
3593
 
3557
3594
  var fullOverride = {
3558
3595
  value: false
@@ -3612,10 +3649,16 @@ function fixFetch(fetchFunc) {
3612
3649
  };
3613
3650
  }
3614
3651
  }
3652
+ function getSignal(val) {
3653
+ return !!val && _typeof(val) === "object" && "signal" in val && isEventTarget(val.signal) && val.signal;
3654
+ }
3615
3655
  function _fetch(input, init) {
3616
3656
  if (isPolyfillType("Request", input)) {
3617
3657
  var _input = input;
3618
- var _init = init || {};
3658
+ var _init = init !== null && init !== void 0 ? init : {};
3659
+ if (_typeof(_init) !== "object") {
3660
+ _init = {};
3661
+ }
3619
3662
  if (!_init.method) {
3620
3663
  _init.method = _input.method;
3621
3664
  }
@@ -3667,10 +3710,11 @@ function fixFetch(fetchFunc) {
3667
3710
  if (payload.type) {
3668
3711
  setContentType(init, payload.type);
3669
3712
  }
3713
+ var signal = getSignal(init) || getSignal(input);
3670
3714
  var removeFn = null;
3671
3715
  var aborted = false;
3672
3716
  var processing = true;
3673
- if (input && _typeof(input) === "object" && "signal" in input && isEventTarget(input.signal)) {
3717
+ if (signal) {
3674
3718
  var abortFn = function abortFn() {
3675
3719
  if (processing) {
3676
3720
  aborted = true;
@@ -3678,12 +3722,12 @@ function fixFetch(fetchFunc) {
3678
3722
  removeFn();
3679
3723
  };
3680
3724
  removeFn = function removeFn() {
3681
- input.signal.removeEventListener("abort", abortFn);
3725
+ signal.removeEventListener("abort", abortFn);
3682
3726
  };
3683
- input.signal.addEventListener("abort", abortFn);
3727
+ signal.addEventListener("abort", abortFn);
3684
3728
  }
3685
3729
  payload.promise.then(function (r) {
3686
- init.body = r !== "" ? r : null;
3730
+ init.body = r !== "" ? coerceBody(r) : null;
3687
3731
  if (!aborted) {
3688
3732
  resolve(fetchFn.call(this, input, init));
3689
3733
  } else {
@@ -3700,8 +3744,9 @@ function fixFetch(fetchFunc) {
3700
3744
  }
3701
3745
  }); // finally
3702
3746
  } else {
3703
- if (init && init.body && isPolyfillType("URLSearchParams", init.body)) {
3747
+ if (init && init.body && (fullOverride.value ? isURLSearchParams(init.body) : isPolyfillType("URLSearchParams", init.body))) {
3704
3748
  setContentType(init, "application/x-www-form-urlencoded;charset=UTF-8");
3749
+ init.body = init.body.toString();
3705
3750
  }
3706
3751
  resolve(fetchFn.call(this, input, init));
3707
3752
  }
@@ -3754,7 +3799,7 @@ function fixXMLHttpRequest(XHRClass) {
3754
3799
  this.withCredentials = withCredentials;
3755
3800
  console.warn("Illegal to set the 'withCredentials' property on 'XMLHttpRequest': The value may only be set if the object's state is UNSENT or OPENED.");
3756
3801
  }
3757
- _send.call(this, r !== "" ? r : undefined);
3802
+ _send.call(this, r !== "" ? coerceBody(r) : undefined);
3758
3803
  }
3759
3804
  state(this).aborted = false;
3760
3805
  state(this).processing = false;
@@ -3764,7 +3809,12 @@ function fixXMLHttpRequest(XHRClass) {
3764
3809
  console.error(e);
3765
3810
  }.bind(this));
3766
3811
  } else {
3767
- if (isPolyfillType("URLSearchParams", body) && !state(this).hasContentType) this.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8");
3812
+ if (fullOverride.value ? isURLSearchParams(body) : isPolyfillType("URLSearchParams", body)) {
3813
+ if (!state(this).hasContentType) {
3814
+ this.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8");
3815
+ }
3816
+ body = body.toString();
3817
+ }
3768
3818
  _send.call(this, body);
3769
3819
  }
3770
3820
  };
@@ -3798,8 +3848,9 @@ function fixWebSocket(WSClass) {
3798
3848
  var _send = Klass.prototype.send;
3799
3849
  Klass.prototype.send = function (data) {
3800
3850
  if (fullOverride.value ? isBlob(data) : isPolyfillType("Blob", data)) {
3801
- var payload = new Payload(data);
3802
- payload.promise.then(function (r) {
3851
+ if (this.readyState === 0 /* CONNECTING */) throw new DOMExceptionE("Failed to execute 'send' on 'WebSocket': Still in CONNECTING state.", "InvalidStateError");
3852
+ if (this.readyState === 2 /* CLOSING */ || this.readyState === 3 /* CLOSED */) return console.error("WebSocket is already in CLOSING or CLOSED state.");
3853
+ data.arrayBuffer().then(function (r) {
3803
3854
  if (this.readyState !== 1 /* OPEN */) return;
3804
3855
  _send.call(this, r);
3805
3856
  }.bind(this));
@@ -3811,831 +3862,6 @@ function fixWebSocket(WSClass) {
3811
3862
  Klass["__MPHTTPX__Polyfill__"] = true;
3812
3863
  }
3813
3864
 
3814
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
3815
-
3816
- function getDefaultExportFromCjs (x) {
3817
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
3818
- }
3819
-
3820
- var requiresPort;
3821
- var hasRequiredRequiresPort;
3822
- function requireRequiresPort() {
3823
- if (hasRequiredRequiresPort) return requiresPort;
3824
- hasRequiredRequiresPort = 1;
3825
-
3826
- /**
3827
- * Check if we're required to add a port number.
3828
- *
3829
- * @see https://url.spec.whatwg.org/#default-port
3830
- * @param {Number|String} port Port number we need to check
3831
- * @param {String} protocol Protocol we need to check against.
3832
- * @returns {Boolean} Is it a default port for the given protocol
3833
- * @api private
3834
- */
3835
- requiresPort = function required(port, protocol) {
3836
- protocol = protocol.split(':')[0];
3837
- port = +port;
3838
- if (!port) return false;
3839
- switch (protocol) {
3840
- case 'http':
3841
- case 'ws':
3842
- return port !== 80;
3843
- case 'https':
3844
- case 'wss':
3845
- return port !== 443;
3846
- case 'ftp':
3847
- return port !== 21;
3848
- case 'gopher':
3849
- return port !== 70;
3850
- case 'file':
3851
- return false;
3852
- }
3853
- return port !== 0;
3854
- };
3855
- return requiresPort;
3856
- }
3857
-
3858
- var querystringify = {};
3859
-
3860
- var hasRequiredQuerystringify;
3861
- function requireQuerystringify() {
3862
- if (hasRequiredQuerystringify) return querystringify;
3863
- hasRequiredQuerystringify = 1;
3864
- var has = Object.prototype.hasOwnProperty,
3865
- undef;
3866
-
3867
- /**
3868
- * Decode a URI encoded string.
3869
- *
3870
- * @param {String} input The URI encoded string.
3871
- * @returns {String|Null} The decoded string.
3872
- * @api private
3873
- */
3874
- function decode(input) {
3875
- try {
3876
- return decodeURIComponent(input.replace(/\+/g, ' '));
3877
- } catch (e) {
3878
- return null;
3879
- }
3880
- }
3881
-
3882
- /**
3883
- * Attempts to encode a given input.
3884
- *
3885
- * @param {String} input The string that needs to be encoded.
3886
- * @returns {String|Null} The encoded string.
3887
- * @api private
3888
- */
3889
- function encode(input) {
3890
- try {
3891
- return encodeURIComponent(input);
3892
- } catch (e) {
3893
- return null;
3894
- }
3895
- }
3896
-
3897
- /**
3898
- * Simple query string parser.
3899
- *
3900
- * @param {String} query The query string that needs to be parsed.
3901
- * @returns {Object}
3902
- * @api public
3903
- */
3904
- function querystring(query) {
3905
- var parser = /([^=?#&]+)=?([^&]*)/g,
3906
- result = {},
3907
- part;
3908
- while (part = parser.exec(query)) {
3909
- var key = decode(part[1]),
3910
- value = decode(part[2]);
3911
-
3912
- //
3913
- // Prevent overriding of existing properties. This ensures that build-in
3914
- // methods like `toString` or __proto__ are not overriden by malicious
3915
- // querystrings.
3916
- //
3917
- // In the case if failed decoding, we want to omit the key/value pairs
3918
- // from the result.
3919
- //
3920
- if (key === null || value === null || key in result) continue;
3921
- result[key] = value;
3922
- }
3923
- return result;
3924
- }
3925
-
3926
- /**
3927
- * Transform a query string to an object.
3928
- *
3929
- * @param {Object} obj Object that should be transformed.
3930
- * @param {String} prefix Optional prefix.
3931
- * @returns {String}
3932
- * @api public
3933
- */
3934
- function querystringify$1(obj, prefix) {
3935
- prefix = prefix || '';
3936
- var pairs = [],
3937
- value,
3938
- key;
3939
-
3940
- //
3941
- // Optionally prefix with a '?' if needed
3942
- //
3943
- if ('string' !== typeof prefix) prefix = '?';
3944
- for (key in obj) {
3945
- if (has.call(obj, key)) {
3946
- value = obj[key];
3947
-
3948
- //
3949
- // Edge cases where we actually want to encode the value to an empty
3950
- // string instead of the stringified value.
3951
- //
3952
- if (!value && (value === null || value === undef || isNaN(value))) {
3953
- value = '';
3954
- }
3955
- key = encode(key);
3956
- value = encode(value);
3957
-
3958
- //
3959
- // If we failed to encode the strings, we should bail out as we don't
3960
- // want to add invalid strings to the query.
3961
- //
3962
- if (key === null || value === null) continue;
3963
- pairs.push(key + '=' + value);
3964
- }
3965
- }
3966
- return pairs.length ? prefix + pairs.join('&') : '';
3967
- }
3968
-
3969
- //
3970
- // Expose the module.
3971
- //
3972
- querystringify.stringify = querystringify$1;
3973
- querystringify.parse = querystring;
3974
- return querystringify;
3975
- }
3976
-
3977
- var urlParse;
3978
- var hasRequiredUrlParse;
3979
- function requireUrlParse() {
3980
- if (hasRequiredUrlParse) return urlParse;
3981
- hasRequiredUrlParse = 1;
3982
- var required = requireRequiresPort(),
3983
- qs = requireQuerystringify(),
3984
- controlOrWhitespace = /^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,
3985
- CRHTLF = /[\n\r\t]/g,
3986
- slashes = /^[A-Za-z][A-Za-z0-9+-.]*:\/\//,
3987
- port = /:\d+$/,
3988
- protocolre = /^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,
3989
- windowsDriveLetter = /^[a-zA-Z]:/;
3990
-
3991
- /**
3992
- * Remove control characters and whitespace from the beginning of a string.
3993
- *
3994
- * @param {Object|String} str String to trim.
3995
- * @returns {String} A new string representing `str` stripped of control
3996
- * characters and whitespace from its beginning.
3997
- * @public
3998
- */
3999
- function trimLeft(str) {
4000
- return (str ? str : '').toString().replace(controlOrWhitespace, '');
4001
- }
4002
-
4003
- /**
4004
- * These are the parse rules for the URL parser, it informs the parser
4005
- * about:
4006
- *
4007
- * 0. The char it Needs to parse, if it's a string it should be done using
4008
- * indexOf, RegExp using exec and NaN means set as current value.
4009
- * 1. The property we should set when parsing this value.
4010
- * 2. Indication if it's backwards or forward parsing, when set as number it's
4011
- * the value of extra chars that should be split off.
4012
- * 3. Inherit from location if non existing in the parser.
4013
- * 4. `toLowerCase` the resulting value.
4014
- */
4015
- var rules = [['#', 'hash'],
4016
- // Extract from the back.
4017
- ['?', 'query'],
4018
- // Extract from the back.
4019
- function sanitize(address, url) {
4020
- // Sanitize what is left of the address
4021
- return isSpecial(url.protocol) ? address.replace(/\\/g, '/') : address;
4022
- }, ['/', 'pathname'],
4023
- // Extract from the back.
4024
- ['@', 'auth', 1],
4025
- // Extract from the front.
4026
- [NaN, 'host', undefined, 1, 1],
4027
- // Set left over value.
4028
- [/:(\d*)$/, 'port', undefined, 1],
4029
- // RegExp the back.
4030
- [NaN, 'hostname', undefined, 1, 1] // Set left over.
4031
- ];
4032
-
4033
- /**
4034
- * These properties should not be copied or inherited from. This is only needed
4035
- * for all non blob URL's as a blob URL does not include a hash, only the
4036
- * origin.
4037
- *
4038
- * @type {Object}
4039
- * @private
4040
- */
4041
- var ignore = {
4042
- hash: 1,
4043
- query: 1
4044
- };
4045
-
4046
- /**
4047
- * The location object differs when your code is loaded through a normal page,
4048
- * Worker or through a worker using a blob. And with the blobble begins the
4049
- * trouble as the location object will contain the URL of the blob, not the
4050
- * location of the page where our code is loaded in. The actual origin is
4051
- * encoded in the `pathname` so we can thankfully generate a good "default"
4052
- * location from it so we can generate proper relative URL's again.
4053
- *
4054
- * @param {Object|String} loc Optional default location object.
4055
- * @returns {Object} lolcation object.
4056
- * @public
4057
- */
4058
- function lolcation(loc) {
4059
- var globalVar;
4060
- if (typeof window !== 'undefined') globalVar = window;else if (typeof commonjsGlobal !== 'undefined') globalVar = commonjsGlobal;else if (typeof self !== 'undefined') globalVar = self;else globalVar = {};
4061
- var location = globalVar.location || {};
4062
- loc = loc || location;
4063
- var finaldestination = {},
4064
- type = _typeof(loc),
4065
- key;
4066
- if ('blob:' === loc.protocol) {
4067
- finaldestination = new Url(unescape(loc.pathname), {});
4068
- } else if ('string' === type) {
4069
- finaldestination = new Url(loc, {});
4070
- for (key in ignore) delete finaldestination[key];
4071
- } else if ('object' === type) {
4072
- for (key in loc) {
4073
- if (key in ignore) continue;
4074
- finaldestination[key] = loc[key];
4075
- }
4076
- if (finaldestination.slashes === undefined) {
4077
- finaldestination.slashes = slashes.test(loc.href);
4078
- }
4079
- }
4080
- return finaldestination;
4081
- }
4082
-
4083
- /**
4084
- * Check whether a protocol scheme is special.
4085
- *
4086
- * @param {String} The protocol scheme of the URL
4087
- * @return {Boolean} `true` if the protocol scheme is special, else `false`
4088
- * @private
4089
- */
4090
- function isSpecial(scheme) {
4091
- return scheme === 'file:' || scheme === 'ftp:' || scheme === 'http:' || scheme === 'https:' || scheme === 'ws:' || scheme === 'wss:';
4092
- }
4093
-
4094
- /**
4095
- * @typedef ProtocolExtract
4096
- * @type Object
4097
- * @property {String} protocol Protocol matched in the URL, in lowercase.
4098
- * @property {Boolean} slashes `true` if protocol is followed by "//", else `false`.
4099
- * @property {String} rest Rest of the URL that is not part of the protocol.
4100
- */
4101
-
4102
- /**
4103
- * Extract protocol information from a URL with/without double slash ("//").
4104
- *
4105
- * @param {String} address URL we want to extract from.
4106
- * @param {Object} location
4107
- * @return {ProtocolExtract} Extracted information.
4108
- * @private
4109
- */
4110
- function extractProtocol(address, location) {
4111
- address = trimLeft(address);
4112
- address = address.replace(CRHTLF, '');
4113
- location = location || {};
4114
- var match = protocolre.exec(address);
4115
- var protocol = match[1] ? match[1].toLowerCase() : '';
4116
- var forwardSlashes = !!match[2];
4117
- var otherSlashes = !!match[3];
4118
- var slashesCount = 0;
4119
- var rest;
4120
- if (forwardSlashes) {
4121
- if (otherSlashes) {
4122
- rest = match[2] + match[3] + match[4];
4123
- slashesCount = match[2].length + match[3].length;
4124
- } else {
4125
- rest = match[2] + match[4];
4126
- slashesCount = match[2].length;
4127
- }
4128
- } else {
4129
- if (otherSlashes) {
4130
- rest = match[3] + match[4];
4131
- slashesCount = match[3].length;
4132
- } else {
4133
- rest = match[4];
4134
- }
4135
- }
4136
- if (protocol === 'file:') {
4137
- if (slashesCount >= 2) {
4138
- rest = rest.slice(2);
4139
- }
4140
- } else if (isSpecial(protocol)) {
4141
- rest = match[4];
4142
- } else if (protocol) {
4143
- if (forwardSlashes) {
4144
- rest = rest.slice(2);
4145
- }
4146
- } else if (slashesCount >= 2 && isSpecial(location.protocol)) {
4147
- rest = match[4];
4148
- }
4149
- return {
4150
- protocol: protocol,
4151
- slashes: forwardSlashes || isSpecial(protocol),
4152
- slashesCount: slashesCount,
4153
- rest: rest
4154
- };
4155
- }
4156
-
4157
- /**
4158
- * Resolve a relative URL pathname against a base URL pathname.
4159
- *
4160
- * @param {String} relative Pathname of the relative URL.
4161
- * @param {String} base Pathname of the base URL.
4162
- * @return {String} Resolved pathname.
4163
- * @private
4164
- */
4165
- function resolve(relative, base) {
4166
- if (relative === '') return base;
4167
- var path = (base || '/').split('/').slice(0, -1).concat(relative.split('/')),
4168
- i = path.length,
4169
- last = path[i - 1],
4170
- unshift = false,
4171
- up = 0;
4172
- while (i--) {
4173
- if (path[i] === '.') {
4174
- path.splice(i, 1);
4175
- } else if (path[i] === '..') {
4176
- path.splice(i, 1);
4177
- up++;
4178
- } else if (up) {
4179
- if (i === 0) unshift = true;
4180
- path.splice(i, 1);
4181
- up--;
4182
- }
4183
- }
4184
- if (unshift) path.unshift('');
4185
- if (last === '.' || last === '..') path.push('');
4186
- return path.join('/');
4187
- }
4188
-
4189
- /**
4190
- * The actual URL instance. Instead of returning an object we've opted-in to
4191
- * create an actual constructor as it's much more memory efficient and
4192
- * faster and it pleases my OCD.
4193
- *
4194
- * It is worth noting that we should not use `URL` as class name to prevent
4195
- * clashes with the global URL instance that got introduced in browsers.
4196
- *
4197
- * @constructor
4198
- * @param {String} address URL we want to parse.
4199
- * @param {Object|String} [location] Location defaults for relative paths.
4200
- * @param {Boolean|Function} [parser] Parser for the query string.
4201
- * @private
4202
- */
4203
- function Url(address, location, parser) {
4204
- address = trimLeft(address);
4205
- address = address.replace(CRHTLF, '');
4206
- if (!(this instanceof Url)) {
4207
- return new Url(address, location, parser);
4208
- }
4209
- var relative,
4210
- extracted,
4211
- parse,
4212
- instruction,
4213
- index,
4214
- key,
4215
- instructions = rules.slice(),
4216
- type = _typeof(location),
4217
- url = this,
4218
- i = 0;
4219
-
4220
- //
4221
- // The following if statements allows this module two have compatibility with
4222
- // 2 different API:
4223
- //
4224
- // 1. Node.js's `url.parse` api which accepts a URL, boolean as arguments
4225
- // where the boolean indicates that the query string should also be parsed.
4226
- //
4227
- // 2. The `URL` interface of the browser which accepts a URL, object as
4228
- // arguments. The supplied object will be used as default values / fall-back
4229
- // for relative paths.
4230
- //
4231
- if ('object' !== type && 'string' !== type) {
4232
- parser = location;
4233
- location = null;
4234
- }
4235
- if (parser && 'function' !== typeof parser) parser = qs.parse;
4236
- location = lolcation(location);
4237
-
4238
- //
4239
- // Extract protocol information before running the instructions.
4240
- //
4241
- extracted = extractProtocol(address || '', location);
4242
- relative = !extracted.protocol && !extracted.slashes;
4243
- url.slashes = extracted.slashes || relative && location.slashes;
4244
- url.protocol = extracted.protocol || location.protocol || '';
4245
- address = extracted.rest;
4246
-
4247
- //
4248
- // When the authority component is absent the URL starts with a path
4249
- // component.
4250
- //
4251
- if (extracted.protocol === 'file:' && (extracted.slashesCount !== 2 || windowsDriveLetter.test(address)) || !extracted.slashes && (extracted.protocol || extracted.slashesCount < 2 || !isSpecial(url.protocol))) {
4252
- instructions[3] = [/(.*)/, 'pathname'];
4253
- }
4254
- for (; i < instructions.length; i++) {
4255
- instruction = instructions[i];
4256
- if (typeof instruction === 'function') {
4257
- address = instruction(address, url);
4258
- continue;
4259
- }
4260
- parse = instruction[0];
4261
- key = instruction[1];
4262
- if (parse !== parse) {
4263
- url[key] = address;
4264
- } else if ('string' === typeof parse) {
4265
- index = parse === '@' ? address.lastIndexOf(parse) : address.indexOf(parse);
4266
- if (~index) {
4267
- if ('number' === typeof instruction[2]) {
4268
- url[key] = address.slice(0, index);
4269
- address = address.slice(index + instruction[2]);
4270
- } else {
4271
- url[key] = address.slice(index);
4272
- address = address.slice(0, index);
4273
- }
4274
- }
4275
- } else if (index = parse.exec(address)) {
4276
- url[key] = index[1];
4277
- address = address.slice(0, index.index);
4278
- }
4279
- url[key] = url[key] || (relative && instruction[3] ? location[key] || '' : '');
4280
-
4281
- //
4282
- // Hostname, host and protocol should be lowercased so they can be used to
4283
- // create a proper `origin`.
4284
- //
4285
- if (instruction[4]) url[key] = url[key].toLowerCase();
4286
- }
4287
-
4288
- //
4289
- // Also parse the supplied query string in to an object. If we're supplied
4290
- // with a custom parser as function use that instead of the default build-in
4291
- // parser.
4292
- //
4293
- if (parser) url.query = parser(url.query);
4294
-
4295
- //
4296
- // If the URL is relative, resolve the pathname against the base URL.
4297
- //
4298
- if (relative && location.slashes && url.pathname.charAt(0) !== '/' && (url.pathname !== '' || location.pathname !== '')) {
4299
- url.pathname = resolve(url.pathname, location.pathname);
4300
- }
4301
-
4302
- //
4303
- // Default to a / for pathname if none exists. This normalizes the URL
4304
- // to always have a /
4305
- //
4306
- if (url.pathname.charAt(0) !== '/' && isSpecial(url.protocol)) {
4307
- url.pathname = '/' + url.pathname;
4308
- }
4309
-
4310
- //
4311
- // We should not add port numbers if they are already the default port number
4312
- // for a given protocol. As the host also contains the port number we're going
4313
- // override it with the hostname which contains no port number.
4314
- //
4315
- if (!required(url.port, url.protocol)) {
4316
- url.host = url.hostname;
4317
- url.port = '';
4318
- }
4319
-
4320
- //
4321
- // Parse down the `auth` for the username and password.
4322
- //
4323
- url.username = url.password = '';
4324
- if (url.auth) {
4325
- index = url.auth.indexOf(':');
4326
- if (~index) {
4327
- url.username = url.auth.slice(0, index);
4328
- url.username = encodeURIComponent(decodeURIComponent(url.username));
4329
- url.password = url.auth.slice(index + 1);
4330
- url.password = encodeURIComponent(decodeURIComponent(url.password));
4331
- } else {
4332
- url.username = encodeURIComponent(decodeURIComponent(url.auth));
4333
- }
4334
- url.auth = url.password ? url.username + ':' + url.password : url.username;
4335
- }
4336
- url.origin = url.protocol !== 'file:' && isSpecial(url.protocol) && url.host ? url.protocol + '//' + url.host : 'null';
4337
-
4338
- //
4339
- // The href is just the compiled result.
4340
- //
4341
- url.href = url.toString();
4342
- }
4343
-
4344
- /**
4345
- * This is convenience method for changing properties in the URL instance to
4346
- * insure that they all propagate correctly.
4347
- *
4348
- * @param {String} part Property we need to adjust.
4349
- * @param {Mixed} value The newly assigned value.
4350
- * @param {Boolean|Function} fn When setting the query, it will be the function
4351
- * used to parse the query.
4352
- * When setting the protocol, double slash will be
4353
- * removed from the final url if it is true.
4354
- * @returns {URL} URL instance for chaining.
4355
- * @public
4356
- */
4357
- function set(part, value, fn) {
4358
- var url = this;
4359
- switch (part) {
4360
- case 'query':
4361
- if ('string' === typeof value && value.length) {
4362
- value = (fn || qs.parse)(value);
4363
- }
4364
- url[part] = value;
4365
- break;
4366
- case 'port':
4367
- url[part] = value;
4368
- if (!required(value, url.protocol)) {
4369
- url.host = url.hostname;
4370
- url[part] = '';
4371
- } else if (value) {
4372
- url.host = url.hostname + ':' + value;
4373
- }
4374
- break;
4375
- case 'hostname':
4376
- url[part] = value;
4377
- if (url.port) value += ':' + url.port;
4378
- url.host = value;
4379
- break;
4380
- case 'host':
4381
- url[part] = value;
4382
- if (port.test(value)) {
4383
- value = value.split(':');
4384
- url.port = value.pop();
4385
- url.hostname = value.join(':');
4386
- } else {
4387
- url.hostname = value;
4388
- url.port = '';
4389
- }
4390
- break;
4391
- case 'protocol':
4392
- url.protocol = value.toLowerCase();
4393
- url.slashes = !fn;
4394
- break;
4395
- case 'pathname':
4396
- case 'hash':
4397
- if (value) {
4398
- var char = part === 'pathname' ? '/' : '#';
4399
- url[part] = value.charAt(0) !== char ? char + value : value;
4400
- } else {
4401
- url[part] = value;
4402
- }
4403
- break;
4404
- case 'username':
4405
- case 'password':
4406
- url[part] = encodeURIComponent(value);
4407
- break;
4408
- case 'auth':
4409
- var index = value.indexOf(':');
4410
- if (~index) {
4411
- url.username = value.slice(0, index);
4412
- url.username = encodeURIComponent(decodeURIComponent(url.username));
4413
- url.password = value.slice(index + 1);
4414
- url.password = encodeURIComponent(decodeURIComponent(url.password));
4415
- } else {
4416
- url.username = encodeURIComponent(decodeURIComponent(value));
4417
- }
4418
- }
4419
- for (var i = 0; i < rules.length; i++) {
4420
- var ins = rules[i];
4421
- if (ins[4]) url[ins[1]] = url[ins[1]].toLowerCase();
4422
- }
4423
- url.auth = url.password ? url.username + ':' + url.password : url.username;
4424
- url.origin = url.protocol !== 'file:' && isSpecial(url.protocol) && url.host ? url.protocol + '//' + url.host : 'null';
4425
- url.href = url.toString();
4426
- return url;
4427
- }
4428
-
4429
- /**
4430
- * Transform the properties back in to a valid and full URL string.
4431
- *
4432
- * @param {Function} stringify Optional query stringify function.
4433
- * @returns {String} Compiled version of the URL.
4434
- * @public
4435
- */
4436
- function toString(stringify) {
4437
- if (!stringify || 'function' !== typeof stringify) stringify = qs.stringify;
4438
- var query,
4439
- url = this,
4440
- host = url.host,
4441
- protocol = url.protocol;
4442
- if (protocol && protocol.charAt(protocol.length - 1) !== ':') protocol += ':';
4443
- var result = protocol + (url.protocol && url.slashes || isSpecial(url.protocol) ? '//' : '');
4444
- if (url.username) {
4445
- result += url.username;
4446
- if (url.password) result += ':' + url.password;
4447
- result += '@';
4448
- } else if (url.password) {
4449
- result += ':' + url.password;
4450
- result += '@';
4451
- } else if (url.protocol !== 'file:' && isSpecial(url.protocol) && !host && url.pathname !== '/') {
4452
- //
4453
- // Add back the empty userinfo, otherwise the original invalid URL
4454
- // might be transformed into a valid one with `url.pathname` as host.
4455
- //
4456
- result += '@';
4457
- }
4458
-
4459
- //
4460
- // Trailing colon is removed from `url.host` when it is parsed. If it still
4461
- // ends with a colon, then add back the trailing colon that was removed. This
4462
- // prevents an invalid URL from being transformed into a valid one.
4463
- //
4464
- if (host[host.length - 1] === ':' || port.test(url.hostname) && !url.port) {
4465
- host += ':';
4466
- }
4467
- result += host + url.pathname;
4468
- query = 'object' === _typeof(url.query) ? stringify(url.query) : url.query;
4469
- if (query) result += '?' !== query.charAt(0) ? '?' + query : query;
4470
- if (url.hash) result += url.hash;
4471
- return result;
4472
- }
4473
- Url.prototype = {
4474
- set: set,
4475
- toString: toString
4476
- };
4477
-
4478
- //
4479
- // Expose the URL parser and some additional properties that might be useful for
4480
- // others or testing.
4481
- //
4482
- Url.extractProtocol = extractProtocol;
4483
- Url.location = lolcation;
4484
- Url.trimLeft = trimLeft;
4485
- Url.qs = qs;
4486
- urlParse = Url;
4487
- return urlParse;
4488
- }
4489
-
4490
- var urlParseExports = requireUrlParse();
4491
- var Url = /*@__PURE__*/getDefaultExportFromCjs(urlParseExports);
4492
-
4493
- var validUrl$1 = {exports: {}};
4494
-
4495
- var hasRequiredValidUrl;
4496
- function requireValidUrl() {
4497
- if (hasRequiredValidUrl) return validUrl$1.exports;
4498
- hasRequiredValidUrl = 1;
4499
- (function (module) {
4500
- (function (module) {
4501
-
4502
- module.exports.is_uri = is_iri;
4503
- module.exports.is_http_uri = is_http_iri;
4504
- module.exports.is_https_uri = is_https_iri;
4505
- module.exports.is_web_uri = is_web_iri;
4506
- // Create aliases
4507
- module.exports.isUri = is_iri;
4508
- module.exports.isHttpUri = is_http_iri;
4509
- module.exports.isHttpsUri = is_https_iri;
4510
- module.exports.isWebUri = is_web_iri;
4511
-
4512
- // private function
4513
- // internal URI spitter method - direct from RFC 3986
4514
- var splitUri = function splitUri(uri) {
4515
- var splitted = uri.match(/(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?/);
4516
- return splitted;
4517
- };
4518
- function is_iri(value) {
4519
- if (!value) {
4520
- return;
4521
- }
4522
-
4523
- // check for illegal characters
4524
- if (/[^a-z0-9\:\/\?\#\[\]\@\!\$\&\'\(\)\*\+\,\;\=\.\-\_\~\%]/i.test(value)) return;
4525
-
4526
- // check for hex escapes that aren't complete
4527
- if (/%[^0-9a-f]/i.test(value)) return;
4528
- if (/%[0-9a-f](:?[^0-9a-f]|$)/i.test(value)) return;
4529
- var splitted = [];
4530
- var scheme = '';
4531
- var authority = '';
4532
- var path = '';
4533
- var query = '';
4534
- var fragment = '';
4535
- var out = '';
4536
-
4537
- // from RFC 3986
4538
- splitted = splitUri(value);
4539
- scheme = splitted[1];
4540
- authority = splitted[2];
4541
- path = splitted[3];
4542
- query = splitted[4];
4543
- fragment = splitted[5];
4544
-
4545
- // scheme and path are required, though the path can be empty
4546
- if (!(scheme && scheme.length && path.length >= 0)) return;
4547
-
4548
- // if authority is present, the path must be empty or begin with a /
4549
- if (authority && authority.length) {
4550
- if (!(path.length === 0 || /^\//.test(path))) return;
4551
- } else {
4552
- // if authority is not present, the path must not start with //
4553
- if (/^\/\//.test(path)) return;
4554
- }
4555
-
4556
- // scheme must begin with a letter, then consist of letters, digits, +, ., or -
4557
- if (!/^[a-z][a-z0-9\+\-\.]*$/.test(scheme.toLowerCase())) return;
4558
-
4559
- // re-assemble the URL per section 5.3 in RFC 3986
4560
- out += scheme + ':';
4561
- if (authority && authority.length) {
4562
- out += '//' + authority;
4563
- }
4564
- out += path;
4565
- if (query && query.length) {
4566
- out += '?' + query;
4567
- }
4568
- if (fragment && fragment.length) {
4569
- out += '#' + fragment;
4570
- }
4571
- return out;
4572
- }
4573
- function is_http_iri(value, allowHttps) {
4574
- if (!is_iri(value)) {
4575
- return;
4576
- }
4577
- var splitted = [];
4578
- var scheme = '';
4579
- var authority = '';
4580
- var path = '';
4581
- var port = '';
4582
- var query = '';
4583
- var fragment = '';
4584
- var out = '';
4585
-
4586
- // from RFC 3986
4587
- splitted = splitUri(value);
4588
- scheme = splitted[1];
4589
- authority = splitted[2];
4590
- path = splitted[3];
4591
- query = splitted[4];
4592
- fragment = splitted[5];
4593
- if (!scheme) return;
4594
- if (allowHttps) {
4595
- if (scheme.toLowerCase() != 'https') return;
4596
- } else {
4597
- if (scheme.toLowerCase() != 'http') return;
4598
- }
4599
-
4600
- // fully-qualified URIs must have an authority section that is
4601
- // a valid host
4602
- if (!authority) {
4603
- return;
4604
- }
4605
-
4606
- // enable port component
4607
- if (/:(\d+)$/.test(authority)) {
4608
- port = authority.match(/:(\d+)$/)[0];
4609
- authority = authority.replace(/:\d+$/, '');
4610
- }
4611
- out += scheme + ':';
4612
- out += '//' + authority;
4613
- if (port) {
4614
- out += port;
4615
- }
4616
- out += path;
4617
- if (query && query.length) {
4618
- out += '?' + query;
4619
- }
4620
- if (fragment && fragment.length) {
4621
- out += '#' + fragment;
4622
- }
4623
- return out;
4624
- }
4625
- function is_https_iri(value) {
4626
- return is_http_iri(value, true);
4627
- }
4628
- function is_web_iri(value) {
4629
- return is_http_iri(value) || is_https_iri(value);
4630
- }
4631
- })(module);
4632
- })(validUrl$1);
4633
- return validUrl$1.exports;
4634
- }
4635
-
4636
- var validUrlExports = requireValidUrl();
4637
- var validUrl = /*@__PURE__*/getDefaultExportFromCjs(validUrlExports);
4638
-
4639
3865
  // @ts-nocheck
4640
3866
  var platform$2 = {
4641
3867
  value: null
@@ -4725,15 +3951,16 @@ function getPlatform() {
4725
3951
  return platform$2.value;
4726
3952
  }
4727
3953
 
4728
- var platform$1 = getPlatform();
3954
+ var platform$1 = /*#__PURE__*/getPlatform();
4729
3955
  function getRequestFunc() {
4730
3956
  var extractFn = function extractFn(platform) {
4731
3957
  // @ts-ignore
4732
- return platform && (platform.mp.request || platform.mp.httpRequest /* DingTalk Mini Program */);
3958
+ var request = platform && (platform.mp.request || platform.mp.httpRequest /* DingTalk Mini Program */);
3959
+ return typeof request === "function" ? request.bind(platform.mp) : request;
4733
3960
  };
4734
3961
  return extractFn(platform$1) || function errorRequest(options) {
4735
- var errMsg = "NOT_SUPPORTED_ERR";
4736
- var errno = 9;
3962
+ var errMsg = "NOT_SUPPORTED_ERR",
3963
+ errno = 9; // DOMException (NotSupportedError)
4737
3964
  var errInfo = {
4738
3965
  errMsg: errMsg,
4739
3966
  errno: errno,
@@ -5009,15 +4236,23 @@ function createXMLHttpRequestUpload() {
5009
4236
  }
5010
4237
 
5011
4238
  var mp$1 = {
5012
- request: getRequestFunc()
4239
+ request: /*#__PURE__*/getRequestFunc()
5013
4240
  };
5014
- function setRequestFunc(request) {
5015
- mp$1.request = request;
4241
+ function setRequestFunc(request, thisArg) {
4242
+ mp$1.request = typeof request === "function" && thisArg !== undefined ? request.bind(thisArg) : request;
5016
4243
  }
5017
4244
  var CookieAccessor = {
5018
4245
  get: null,
5019
4246
  set: null
5020
4247
  };
4248
+ function useCookie(accessor) {
4249
+ CookieAccessor.get = function (url, withCredentials) {
4250
+ return accessor.get(url, withCredentials);
4251
+ };
4252
+ CookieAccessor.set = function (url, withCredentials, cookies) {
4253
+ return accessor.set(url, withCredentials, cookies);
4254
+ };
4255
+ }
5021
4256
  var XMLHttpRequestP = /*#__PURE__*/function (_XMLHttpRequestEventT, _Symbol$toStringTag) {
5022
4257
  function XMLHttpRequestP() {
5023
4258
  var _this;
@@ -5228,8 +4463,8 @@ var XMLHttpRequestP = /*#__PURE__*/function (_XMLHttpRequestEventT, _Symbol$toSt
5228
4463
  var request = function (data) {
5229
4464
  if (requestId !== s.requestId) return;
5230
4465
  if (s.pos !== 2 /* XHRCycle.LOADSTART */ && s.pos !== 8 /* XHRCycle.UPLOAD_LOADEND */) return;
5231
- options.data = data !== "" ? data : undefined;
5232
4466
  options.headers = options.header; // Alipay Mini Program
4467
+ options.data = data ? coerceBody(data) : undefined;
5233
4468
  s.requestTask = mp$1.request(options);
5234
4469
  }.bind(this);
5235
4470
  checkRequestTimeout(this);
@@ -5607,501 +4842,22 @@ function execLoadend(xhr) {
5607
4842
  clearRequestTimeout(s);
5608
4843
  emitProgressEvent(xhr, "loadend", contentLength, contentLength);
5609
4844
  }
5610
- var XMLHttpRequestE = typeof XMLHttpRequest !== "undefined" && XMLHttpRequest || XMLHttpRequestP;
5611
-
5612
- var defaultParseOptions = {
5613
- decodeValues: true,
5614
- map: false,
5615
- silent: false,
5616
- split: "auto" // auto = split strings but not arrays
5617
- };
5618
- function isForbiddenKey(key) {
5619
- return typeof key !== "string" || key in {};
5620
- }
5621
- function createNullObj() {
5622
- return Object.create(null);
5623
- }
5624
- function isNonEmptyString(str) {
5625
- return typeof str === "string" && !!str.trim();
5626
- }
5627
- function parseString(setCookieValue, options) {
5628
- var parts = setCookieValue.split(";").filter(isNonEmptyString);
5629
- var nameValuePairStr = parts.shift();
5630
- if (!nameValuePairStr) {
5631
- return null;
5632
- }
5633
- var parsed = parseNameValuePair(nameValuePairStr);
5634
- var name = parsed.name;
5635
- var value = parsed.value;
5636
- options = options ? Object.assign({}, defaultParseOptions, options) : defaultParseOptions;
5637
- if (isForbiddenKey(name)) {
5638
- return null;
5639
- }
5640
- try {
5641
- value = options.decodeValues ? decodeURIComponent(value) : value; // decode cookie value
5642
- } catch (e) {
5643
- console.error("set-cookie-parser: failed to decode cookie value. Set options.decodeValues=false to disable decoding.", e);
5644
- }
5645
- var cookie = createNullObj();
5646
- cookie.name = name;
5647
- cookie.value = value;
5648
- parts.forEach(function (part) {
5649
- var sides = part.split("=");
5650
- var key = sides.shift().trim().toLowerCase();
5651
- if (isForbiddenKey(key)) {
5652
- return;
5653
- }
5654
- var value = sides.join("=").trim();
5655
- if (key === "expires") {
5656
- cookie.expires = new Date(value);
5657
- } else if (key === "max-age") {
5658
- var n = parseInt(value, 10);
5659
- if (!Number.isNaN(n)) cookie.maxAge = n;
5660
- } else if (key === "secure") {
5661
- cookie.secure = true;
5662
- } else if (key === "httponly") {
5663
- cookie.httpOnly = true;
5664
- } else if (key === "samesite") {
5665
- cookie.sameSite = value;
5666
- } else if (key === "partitioned") {
5667
- cookie.partitioned = true;
5668
- } else if (key) {
5669
- cookie[key] = value;
5670
- }
5671
- });
5672
- return cookie;
5673
- }
5674
- function parseNameValuePair(nameValuePairStr) {
5675
- // Parses name-value-pair according to rfc6265bis draft
5676
-
5677
- var name = "";
5678
- var value = "";
5679
- var nameValueArr = nameValuePairStr.split("=");
5680
- if (nameValueArr.length > 1) {
5681
- name = nameValueArr.shift();
5682
- value = nameValueArr.join("="); // everything after the first =, joined by a "=" if there was more than one part
5683
- } else {
5684
- value = nameValuePairStr;
5685
- }
5686
- return {
5687
- name: name,
5688
- value: value
5689
- };
5690
- }
5691
- function parseSetCookie(input, options) {
5692
- options = options ? Object.assign({}, defaultParseOptions, options) : defaultParseOptions;
5693
- if (!input) {
5694
- if (!options.map) {
5695
- return [];
5696
- } else {
5697
- return createNullObj();
5698
- }
5699
- }
5700
- if (input.headers) {
5701
- if (typeof input.headers.getSetCookie === "function") {
5702
- // for fetch responses - they combine headers of the same type in the headers array,
5703
- // but getSetCookie returns an uncombined array
5704
- input = input.headers.getSetCookie();
5705
- } else if (input.headers["set-cookie"]) {
5706
- // fast-path for node.js (which automatically normalizes header names to lower-case)
5707
- input = input.headers["set-cookie"];
5708
- } else {
5709
- // slow-path for other environments - see #25
5710
- var sch = input.headers[Object.keys(input.headers).find(function (key) {
5711
- return key.toLowerCase() === "set-cookie";
5712
- })];
5713
- // warn if called on a request-like object with a cookie header rather than a set-cookie header - see #34, 36
5714
- if (!sch && input.headers.cookie && !options.silent) {
5715
- console.warn("Warning: set-cookie-parser appears to have been called on a request object. It is designed to parse Set-Cookie headers from responses, not Cookie headers from requests. Set the option {silent: true} to suppress this warning.");
5716
- }
5717
- input = sch;
5718
- }
5719
- }
5720
- var split = options.split;
5721
- var isArray = Array.isArray(input);
5722
- if (split === "auto") {
5723
- split = !isArray;
5724
- }
5725
- if (!isArray) {
5726
- input = [input];
5727
- }
5728
- input = input.filter(isNonEmptyString);
5729
- if (split) {
5730
- input = input.map(splitCookiesString).flat();
5731
- }
5732
- if (!options.map) {
5733
- return input.map(function (str) {
5734
- return parseString(str, options);
5735
- }).filter(Boolean);
5736
- } else {
5737
- var cookies = createNullObj();
5738
- return input.reduce(function (cookies, str) {
5739
- var cookie = parseString(str, options);
5740
- if (cookie && !isForbiddenKey(cookie.name)) {
5741
- cookies[cookie.name] = cookie;
5742
- }
5743
- return cookies;
5744
- }, cookies);
5745
- }
5746
- }
5747
-
5748
- /*
5749
- Set-Cookie header field-values are sometimes comma joined in one string. This splits them without choking on commas
5750
- that are within a single set-cookie field-value, such as in the Expires portion.
5751
-
5752
- This is uncommon, but explicitly allowed - see https://tools.ietf.org/html/rfc2616#section-4.2
5753
- Node.js does this for every header *except* set-cookie - see https://github.com/nodejs/node/blob/d5e363b77ebaf1caf67cd7528224b651c86815c1/lib/_http_incoming.js#L128
5754
- React Native's fetch does this for *every* header, including set-cookie.
5755
-
5756
- Based on: https://github.com/google/j2objc/commit/16820fdbc8f76ca0c33472810ce0cb03d20efe25
5757
- Credits to: https://github.com/tomball for original and https://github.com/chrusart for JavaScript implementation
5758
- */
5759
- function splitCookiesString(cookiesString) {
5760
- if (Array.isArray(cookiesString)) {
5761
- return cookiesString;
5762
- }
5763
- if (typeof cookiesString !== "string") {
5764
- return [];
5765
- }
5766
- var cookiesStrings = [];
5767
- var pos = 0;
5768
- var start;
5769
- var ch;
5770
- var lastComma;
5771
- var nextStart;
5772
- var cookiesSeparatorFound;
5773
- function skipWhitespace() {
5774
- while (pos < cookiesString.length && /\s/.test(cookiesString.charAt(pos))) {
5775
- pos += 1;
5776
- }
5777
- return pos < cookiesString.length;
5778
- }
5779
- function notSpecialChar() {
5780
- ch = cookiesString.charAt(pos);
5781
- return ch !== "=" && ch !== ";" && ch !== ",";
5782
- }
5783
- while (pos < cookiesString.length) {
5784
- start = pos;
5785
- cookiesSeparatorFound = false;
5786
- while (skipWhitespace()) {
5787
- ch = cookiesString.charAt(pos);
5788
- if (ch === ",") {
5789
- // ',' is a cookie separator if we have later first '=', not ';' or ','
5790
- lastComma = pos;
5791
- pos += 1;
5792
- skipWhitespace();
5793
- nextStart = pos;
5794
- while (pos < cookiesString.length && notSpecialChar()) {
5795
- pos += 1;
5796
- }
5797
-
5798
- // currently special character
5799
- if (pos < cookiesString.length && cookiesString.charAt(pos) === "=") {
5800
- // we found cookies separator
5801
- cookiesSeparatorFound = true;
5802
- // pos is inside the next cookie, so back up and return it.
5803
- pos = nextStart;
5804
- cookiesStrings.push(cookiesString.substring(start, lastComma));
5805
- start = pos;
5806
- } else {
5807
- // in param ',' or param separator ';',
5808
- // we continue from that comma
5809
- pos = lastComma + 1;
5810
- }
5811
- } else {
5812
- pos += 1;
5813
- }
5814
- }
5815
- if (!cookiesSeparatorFound || pos >= cookiesString.length) {
5816
- cookiesStrings.push(cookiesString.substring(start, cookiesString.length));
5817
- }
5818
- }
5819
- return cookiesStrings;
5820
- }
5821
-
5822
- // named export for CJS
5823
- parseSetCookie.parseSetCookie = parseSetCookie;
5824
- // for backwards compatibility
5825
- parseSetCookie.parse = parseSetCookie;
5826
- parseSetCookie.parseString = parseString;
5827
- parseSetCookie.splitCookiesString = splitCookiesString;
5828
-
5829
- var webSite = {
5830
- url: new Url("https://example.com")
5831
- };
5832
- var storage = {
5833
- value: null
5834
- };
5835
- var CookieStorage = /*#__PURE__*/function () {
5836
- function CookieStorage() {
5837
- _classCallCheck(this, CookieStorage);
5838
- this.cookies = [];
5839
- this.restore();
5840
- setTimeout(function () {
5841
- this.persist();
5842
- }.bind(this), 0);
5843
- }
5844
- return _createClass(CookieStorage, [{
5845
- key: "storageKey",
5846
- get: function get() {
5847
- return "__COOKIE_MPHTTPX__";
5848
- }
5849
- }, {
5850
- key: "restore",
5851
- value: function restore() {
5852
- if (!platform$1) return;
5853
- var cookies = function () {
5854
- try {
5855
- var data = platform$1.name !== "Alipay" ? platform$1.mp.getStorageSync(this.storageKey)
5856
- // @ts-ignore
5857
- : platform$1.mp.getStorageSync({
5858
- key: this.storageKey
5859
- }).data; // Alipay Mini Program
5860
- var parsed = data ? JSON.parse(data) : [];
5861
- return Array.isArray(parsed) ? parsed : [];
5862
- } catch (e) {
5863
- return [];
5864
- }
5865
- }.bind(this)();
5866
- var isValid = function isValid(val) {
5867
- return _typeof(val) === "object" && val && typeof val._expires === "number";
5868
- };
5869
- this.cookies = cookies.filter(function (_c) {
5870
- return isValid(_c);
5871
- }).map(function (_c) {
5872
- var copy = copyCookie(_c);
5873
- copy.expires = new Date(_c._expires || 0);
5874
- return copy;
5875
- });
5876
- }
5877
- }, {
5878
- key: "persist",
5879
- value: function persist() {
5880
- if (!platform$1) return;
5881
- var cookies = this.cookies.filter(function (c) {
5882
- return c.expires && c.expires > new Date();
5883
- }).map(function (c) {
5884
- var copy = copyCookie(c);
5885
- copy._expires = c.expires.getTime();
5886
- return copy;
5887
- });
5888
- platform$1.mp.setStorage({
5889
- key: this.storageKey,
5890
- data: JSON.stringify(cookies)
5891
- });
5892
- }
5893
- }, {
5894
- key: "getForUrl",
5895
- value: function getForUrl(fromPage, url, withCredentials) {
5896
- var currentUrl = new Url(fixUrl(url));
5897
- var sameOrigin = webSite.url.origin === currentUrl.origin;
5898
- if (!fromPage) {
5899
- if (!sameOrigin && !withCredentials) return "";
5900
- }
5901
- var results = {
5902
- valid: [],
5903
- expired: []
5904
- };
5905
- for (var i = 0; i < this.cookies.length; ++i) {
5906
- var cookie = this.cookies[i];
5907
- if (fromPage && cookie.httpOnly) {
5908
- continue;
5909
- }
5910
- if (!fromPage) {
5911
- if (!sameOrigin && cookie.sameSite && cookie.sameSite.toLowerCase() !== "none") {
5912
- continue;
5913
- }
5914
- if (currentUrl.hostname !== "127.0.0.1" && currentUrl.hostname !== "localhost") {
5915
- if (cookie.secure && currentUrl.protocol !== "https") {
5916
- continue;
5917
- }
5918
- }
5919
- }
5920
- if (checkDomain(currentUrl.hostname, cookie.domain)) {
5921
- if (checkPath(currentUrl.pathname, cookie.path)) {
5922
- if (!cookie.expires || cookie.expires > new Date()) {
5923
- results.valid.push(cookie);
5924
- } else {
5925
- results.expired.push(cookie);
5926
- }
5927
- }
5928
- }
5929
- }
5930
- if (results.expired.length > 0) {
5931
- this.cookies = this.cookies.filter(function (c) {
5932
- return !c.expires || c.expires > new Date();
5933
- });
5934
- setTimeout(function () {
5935
- this.persist();
5936
- }.bind(this), 0);
5937
- }
5938
- return results.valid.map(function (c) {
5939
- return c.name + "=" + c.value;
5940
- }).join("; ");
5941
- }
5942
- }, {
5943
- key: "setForUrl",
5944
- value: function setForUrl(fromPage, url, withCredentials, cookies) {
5945
- var _this = this;
5946
- if (!cookies) return;
5947
- var currentUrl = new Url(fixUrl(url));
5948
- var sameOrigin = webSite.url.origin === currentUrl.origin;
5949
- if (!fromPage) {
5950
- if (!sameOrigin && !withCredentials) return;
5951
- }
5952
- var results = !fromPage ? parseSetCookie(cookies) : parseSetCookie("" + cookies, {
5953
- split: false
5954
- });
5955
- var _loop = function _loop() {
5956
- var cookie = results[i];
5957
- if (!cookie.name) return 0; // continue
5958
- if (fromPage) {
5959
- if (cookie.httpOnly) {
5960
- return 0; // continue
5961
- }
5962
- }
5963
- if (cookie.sameSite && cookie.sameSite.toLowerCase() === "none" && !cookie.secure) {
5964
- return 0; // continue
5965
- }
5966
- if (!cookie.domain) {
5967
- cookie.domain = currentUrl.hostname;
5968
- } else {
5969
- cookie.domain = cookie.domain.toLowerCase();
5970
- if (cookie.domain.split(".").filter(function (x) {
5971
- return !!x;
5972
- }).length >= 2) {
5973
- cookie.domain = prependDot(cookie.domain);
5974
- }
5975
- }
5976
- if (!cookie.path) {
5977
- cookie.path = currentUrl.pathname;
5978
- }
5979
- if (typeof cookie.maxAge === "number") {
5980
- cookie.expires = new Date(new Date().getTime() + cookie.maxAge * 1000);
5981
- }
5982
- if (checkDomain(currentUrl.hostname, cookie.domain)) {
5983
- _this.cookies = _this.cookies.filter(function (c) {
5984
- return !isSameCookie(c, cookie);
5985
- });
5986
- if (!cookie.expires || cookie.expires > new Date()) {
5987
- _this.cookies = [cookie].concat(_this.cookies);
5988
- }
5989
- }
5990
- },
5991
- _ret;
5992
- for (var i = 0; i < results.length; ++i) {
5993
- _ret = _loop();
5994
- if (_ret === 0) continue;
5995
- }
5996
- this.cookies.sort(function (a, b) {
5997
- var a_domain = prependDot(a.domain);
5998
- var b_domain = prependDot(b.domain);
5999
- if (a_domain.length !== b_domain.length) {
6000
- return b_domain.length - a_domain.length;
6001
- } else {
6002
- var a_path = appendSlash(a.path);
6003
- var b_path = appendSlash(b.path);
6004
- return b_path.length - a_path.length;
6005
- }
6006
- });
6007
- this.cookies = this.cookies.filter(function (c) {
6008
- return !c.expires || c.expires > new Date();
6009
- });
6010
- setTimeout(function () {
6011
- this.persist();
6012
- }.bind(this), 0);
6013
- }
6014
- }]);
4845
+ var XMLHttpRequestE = /*#__PURE__*/function () {
4846
+ return typeof XMLHttpRequest !== "undefined" && XMLHttpRequest || XMLHttpRequestP;
6015
4847
  }();
6016
- function fixUrl(url) {
6017
- return validUrl.isUri(url) ? url : webSite.url.origin + (url.substring(0, 1) === "/" ? "" : "/") + url;
6018
- }
6019
- function isSameCookie(left, right) {
6020
- return left.domain === right.domain && left.path === right.path && left.name === right.name;
6021
- }
6022
- function copyCookie(source) {
6023
- var copy = {
6024
- name: source.name,
6025
- value: source.value
6026
- };
6027
- if (source.domain !== undefined) {
6028
- copy.domain = source.domain;
6029
- }
6030
- if (source.path !== undefined) {
6031
- copy.path = source.path;
6032
- }
6033
- if (source.expires !== undefined) {
6034
- copy.expires = source.expires;
6035
- }
6036
- if (source.secure !== undefined) {
6037
- copy.secure = source.secure;
6038
- }
6039
- if (source.sameSite !== undefined) {
6040
- copy.sameSite = source.sameSite;
6041
- }
6042
- if (source.httpOnly !== undefined) {
6043
- copy.httpOnly = source.httpOnly;
6044
- }
6045
- if (source.partitioned !== undefined) {
6046
- copy.partitioned = source.partitioned;
6047
- }
6048
- return copy;
6049
- }
6050
- function prependDot(str) {
6051
- return (str.substring(0, 1) === "." ? "" : ".") + str;
6052
- }
6053
- function appendSlash(str) {
6054
- return str + (str.slice(-1) === "/" ? "" : "/");
6055
- }
6056
- function checkDomain(urlDomain, cookieDomain) {
6057
- if (cookieDomain.split(".").filter(function (x) {
6058
- return !!x;
6059
- }).length < 2) {
6060
- return urlDomain === cookieDomain;
6061
- }
6062
- var _urlDomain = prependDot(urlDomain);
6063
- var _cookieDomain = prependDot(cookieDomain);
6064
- return _urlDomain.slice(-_cookieDomain.length) === _cookieDomain;
6065
- }
6066
- function checkPath(urlPath, cookiePath) {
6067
- var _urlPath = appendSlash(urlPath);
6068
- var _cookiePath = appendSlash(cookiePath);
6069
- return _urlPath.slice(0, _cookiePath.length) === _cookiePath;
6070
- }
6071
- function createCookieInstance() {
6072
- if (!storage.value) {
6073
- storage.value = new CookieStorage();
6074
- }
6075
- var cookieSupported = typeof document !== "undefined" && document && "cookie" in document;
6076
- return {
6077
- get: function get() {
6078
- if (cookieSupported) return document.cookie;else return storage.value.getForUrl(true, webSite.url.href, false);
6079
- },
6080
- set: function set(cookie) {
6081
- if (cookieSupported) document.cookie = cookie;else storage.value.setForUrl(true, webSite.url.href, false, cookie);
6082
- }
6083
- };
6084
- }
6085
- var Cookie = createCookieInstance();
6086
- function enableCookie(url) {
6087
- if (validUrl.isUri(url)) {
6088
- webSite.url = new Url(url);
6089
- }
6090
- if (!storage.value) {
6091
- storage.value = new CookieStorage();
6092
- }
6093
- if (!CookieAccessor.get && !CookieAccessor.set) {
6094
- CookieAccessor.get = CookieStorage.prototype.getForUrl.bind(storage.value, false);
6095
- CookieAccessor.set = CookieStorage.prototype.setForUrl.bind(storage.value, false);
6096
- }
6097
- }
6098
4848
 
6099
- var fetches = function () {
4849
+ var fetches = /*#__PURE__*/function () {
4850
+ // Mini Program requires explicit XHR assignment,
4851
+ // otherwise the polyfill won't be picked up.
6100
4852
  setXMLHttpRequestClass(XMLHttpRequestE);
6101
- return [fetchE$1, fetchP];
4853
+ return [fetchE$1 /* global */, fetchP /* polyfill */];
4854
+ }();
4855
+ var fetchE = /*#__PURE__*/function () {
4856
+ return fetches[0];
4857
+ }();
4858
+ var fetchPolyfill = /*#__PURE__*/function () {
4859
+ return fetches[1];
6102
4860
  }();
6103
- var fetchE = fetches[0];
6104
- var fetchPolyfill = fetches[1];
6105
4861
 
6106
4862
  var CloseEventP = /*#__PURE__*/function (_EventP, _Symbol$toStringTag) {
6107
4863
  function CloseEventP(type, eventInitDict) {
@@ -6255,9 +5011,13 @@ function state$1(target) {
6255
5011
  return target.__MessageEvent__;
6256
5012
  }
6257
5013
 
6258
- var platform = getPlatform();
5014
+ var platform = /*#__PURE__*/getPlatform();
6259
5015
  function getConnectSocketFunc() {
6260
- return platform ? platform.mp.connectSocket : function errorConnectSocket(options) {
5016
+ var extractFn = function extractFn(platform) {
5017
+ var connectSocket = platform && platform.mp.connectSocket;
5018
+ return typeof connectSocket === "function" ? connectSocket.bind(platform.mp) : connectSocket;
5019
+ };
5020
+ return extractFn(platform) || function errorConnectSocket(options) {
6261
5021
  return {
6262
5022
  send: function send(obj) {},
6263
5023
  close: function close(obj) {},
@@ -6265,16 +5025,22 @@ function getConnectSocketFunc() {
6265
5025
  onMessage: function onMessage(listener) {},
6266
5026
  onError: function onError(listener) {
6267
5027
  if (typeof listener === "function") {
5028
+ // DOMException (NotSupportedError)
6268
5029
  listener({
6269
- errMsg: "NOT_SUPPORTED_ERR"
5030
+ errMsg: "NOT_SUPPORTED_ERR",
5031
+ errno: 9
6270
5032
  });
5033
+ setTimeout(function () {
5034
+ throw new ReferenceError("connectSocket is not defined");
5035
+ }, 0);
6271
5036
  }
6272
5037
  },
6273
5038
  onClose: function onClose(listener) {
6274
5039
  if (typeof listener === "function") {
5040
+ // Alipay Mini Program (code: 1000, 3000~4999)
6275
5041
  setTimeout(function () {
6276
5042
  listener({
6277
- code: 3009,
5043
+ code: 3000 + 9,
6278
5044
  reason: "NOT_SUPPORTED_ERR"
6279
5045
  });
6280
5046
  }, 0);
@@ -6285,10 +5051,10 @@ function getConnectSocketFunc() {
6285
5051
  }
6286
5052
 
6287
5053
  var mp = {
6288
- connectSocket: getConnectSocketFunc()
5054
+ connectSocket: /*#__PURE__*/getConnectSocketFunc()
6289
5055
  };
6290
- function setConnectSocketFunc(connectSocket) {
6291
- mp.connectSocket = connectSocket;
5056
+ function setConnectSocketFunc(connectSocket, thisArg) {
5057
+ mp.connectSocket = typeof connectSocket === "function" && thisArg !== undefined ? connectSocket.bind(thisArg) : connectSocket;
6292
5058
  }
6293
5059
  var WebSocketP = /*#__PURE__*/function (_EventTargetP, _Symbol$toStringTag) {
6294
5060
  function WebSocketP(url, protocols) {
@@ -6398,12 +5164,8 @@ var WebSocketP = /*#__PURE__*/function (_EventTargetP, _Symbol$toStringTag) {
6398
5164
  key: "send",
6399
5165
  value: function send(data) {
6400
5166
  checkArgsLength(arguments.length, 1, "WebSocket", "send");
6401
- if (this.readyState === 0 /* CONNECTING */) {
6402
- throw new DOMExceptionE("Failed to execute 'send' on 'WebSocket': Still in CONNECTING state.", "InvalidStateError");
6403
- }
6404
- if (this.readyState === 2 /* CLOSING */ || this.readyState === 3 /* CLOSED */) {
6405
- return console.error("WebSocket is already in CLOSING or CLOSED state.");
6406
- }
5167
+ if (this.readyState === 0 /* CONNECTING */) throw new DOMExceptionE("Failed to execute 'send' on 'WebSocket': Still in CONNECTING state.", "InvalidStateError");
5168
+ if (this.readyState === 2 /* CLOSING */ || this.readyState === 3 /* CLOSED */) return console.error("WebSocket is already in CLOSING or CLOSED state.");
6407
5169
  var _send = function (data) {
6408
5170
  if (this.readyState === 1 /* OPEN */) {
6409
5171
  state(this).socketTask.send({
@@ -6414,11 +5176,11 @@ var WebSocketP = /*#__PURE__*/function (_EventTargetP, _Symbol$toStringTag) {
6414
5176
  });
6415
5177
  }
6416
5178
  }.bind(this);
6417
- if (typeof data !== "string" && !isArrayBuffer(data) && !isBlob(data) && !ArrayBuffer.isView(data)) {
5179
+ if (typeof data !== "string" && !isArrayBuffer(data) && !isBlob(data) && !ArrayBuffer_isView(data)) {
6418
5180
  return _send(data);
6419
5181
  }
6420
- var payload = new Payload(data);
6421
- payload.promise.then(function (_data) {
5182
+ var payload = createPayload(data);
5183
+ payload.then(function (_data) {
6422
5184
  _send(_data);
6423
5185
  });
6424
5186
  }
@@ -6535,6 +5297,19 @@ function getHandlers(t) {
6535
5297
  function state(target) {
6536
5298
  return target.__WebSocket__;
6537
5299
  }
5300
+ function createPayload(data) {
5301
+ if (typeof data === "string") {
5302
+ return Promise.resolve(data);
5303
+ } else if (isArrayBuffer(data)) {
5304
+ return Promise.resolve(data.slice(0));
5305
+ } else if (ArrayBuffer_isView(data)) {
5306
+ return Promise.resolve(data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength));
5307
+ } else if (isBlob(data)) {
5308
+ return data.arrayBuffer();
5309
+ } else {
5310
+ return Promise.resolve("" + data);
5311
+ }
5312
+ }
6538
5313
  function emitEvent(target, type) {
6539
5314
  var event = new EventP(type);
6540
5315
  // @ts-ignore
@@ -6601,7 +5376,9 @@ function onMessage(socket) {
6601
5376
  EventTarget_dispatchEvent(socket, event);
6602
5377
  });
6603
5378
  }
6604
- var WebSocketE = typeof WebSocket !== "undefined" && WebSocket || WebSocketP;
5379
+ var WebSocketE = /*#__PURE__*/function () {
5380
+ return typeof WebSocket !== "undefined" && WebSocket || WebSocketP;
5381
+ }();
6605
5382
 
6606
5383
  exports.AbortController = AbortControllerE;
6607
5384
  exports.AbortControllerP = AbortControllerP;
@@ -6609,7 +5386,6 @@ exports.AbortSignal = AbortSignalE;
6609
5386
  exports.AbortSignalP = AbortSignalP;
6610
5387
  exports.Blob = BlobE;
6611
5388
  exports.BlobP = BlobP;
6612
- exports.Cookie = Cookie;
6613
5389
  exports.CustomEvent = CustomEventE;
6614
5390
  exports.CustomEventP = CustomEventP;
6615
5391
  exports.Event = EventE;
@@ -6638,18 +5414,16 @@ exports.WebSocket = WebSocketE;
6638
5414
  exports.WebSocketP = WebSocketP;
6639
5415
  exports.XMLHttpRequest = XMLHttpRequestE;
6640
5416
  exports.XMLHttpRequestP = XMLHttpRequestP;
6641
- exports.enableCookie = enableCookie;
6642
5417
  exports.fetch = fetchE;
6643
5418
  exports.fetchP = fetchPolyfill;
6644
5419
  exports.fixFetch = fixFetch;
6645
5420
  exports.fixWebSocket = fixWebSocket;
6646
5421
  exports.fixXMLHttpRequest = fixXMLHttpRequest;
6647
5422
  exports.getPlatform = getPlatform;
6648
- exports.setConnectSocket = setConnectSocketFunc;
6649
5423
  exports.setConnectSocketFunc = setConnectSocketFunc;
6650
5424
  exports.setFullOverride = setFullOverride;
6651
5425
  exports.setReadableStreamClass = setReadableStreamClass;
6652
- exports.setRequest = setRequestFunc;
6653
5426
  exports.setRequestFunc = setRequestFunc;
6654
- exports.setXMLHttpRequest = setXMLHttpRequestClass;
5427
+ exports.setTextMode = setTextMode;
6655
5428
  exports.setXMLHttpRequestClass = setXMLHttpRequestClass;
5429
+ exports.useCookie = useCookie;