hook-fetch 0.0.1-beta

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.
@@ -0,0 +1,2922 @@
1
+ var __typeError = (msg) => {
2
+ throw TypeError(msg);
3
+ };
4
+ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
5
+ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
6
+ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
7
+ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
8
+ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
9
+ var _message, _name, _status, _statusText, _response, _config, _plugins, _controller, _config2, _promise, _isTimeout, _HookFetch_instances, init_fn, createNormalizeError_fn, normalizeError_fn, json_get, response_get, _timeout, _baseURL, _commonHeaders, _queue, _plugins2, _withCredentials, _Base_instances, requestWithParams_fn, requestWithBody_fn;
10
+ var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
11
+ function getDefaultExportFromCjs(x) {
12
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
13
+ }
14
+ function getAugmentedNamespace(n) {
15
+ if (Object.prototype.hasOwnProperty.call(n, "__esModule")) return n;
16
+ var f = n.default;
17
+ if (typeof f == "function") {
18
+ var a = function a2() {
19
+ if (this instanceof a2) {
20
+ return Reflect.construct(f, arguments, this.constructor);
21
+ }
22
+ return f.apply(this, arguments);
23
+ };
24
+ a.prototype = f.prototype;
25
+ } else a = {};
26
+ Object.defineProperty(a, "__esModule", { value: true });
27
+ Object.keys(n).forEach(function(k) {
28
+ var d = Object.getOwnPropertyDescriptor(n, k);
29
+ Object.defineProperty(a, k, d.get ? d : {
30
+ enumerable: true,
31
+ get: function() {
32
+ return n[k];
33
+ }
34
+ });
35
+ });
36
+ return a;
37
+ }
38
+ var type;
39
+ var hasRequiredType;
40
+ function requireType() {
41
+ if (hasRequiredType) return type;
42
+ hasRequiredType = 1;
43
+ type = TypeError;
44
+ return type;
45
+ }
46
+ const __viteBrowserExternal = {};
47
+ const __viteBrowserExternal$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
48
+ __proto__: null,
49
+ default: __viteBrowserExternal
50
+ }, Symbol.toStringTag, { value: "Module" }));
51
+ const require$$0 = /* @__PURE__ */ getAugmentedNamespace(__viteBrowserExternal$1);
52
+ var objectInspect;
53
+ var hasRequiredObjectInspect;
54
+ function requireObjectInspect() {
55
+ if (hasRequiredObjectInspect) return objectInspect;
56
+ hasRequiredObjectInspect = 1;
57
+ var hasMap = typeof Map === "function" && Map.prototype;
58
+ var mapSizeDescriptor = Object.getOwnPropertyDescriptor && hasMap ? Object.getOwnPropertyDescriptor(Map.prototype, "size") : null;
59
+ var mapSize = hasMap && mapSizeDescriptor && typeof mapSizeDescriptor.get === "function" ? mapSizeDescriptor.get : null;
60
+ var mapForEach = hasMap && Map.prototype.forEach;
61
+ var hasSet = typeof Set === "function" && Set.prototype;
62
+ var setSizeDescriptor = Object.getOwnPropertyDescriptor && hasSet ? Object.getOwnPropertyDescriptor(Set.prototype, "size") : null;
63
+ var setSize = hasSet && setSizeDescriptor && typeof setSizeDescriptor.get === "function" ? setSizeDescriptor.get : null;
64
+ var setForEach = hasSet && Set.prototype.forEach;
65
+ var hasWeakMap = typeof WeakMap === "function" && WeakMap.prototype;
66
+ var weakMapHas = hasWeakMap ? WeakMap.prototype.has : null;
67
+ var hasWeakSet = typeof WeakSet === "function" && WeakSet.prototype;
68
+ var weakSetHas = hasWeakSet ? WeakSet.prototype.has : null;
69
+ var hasWeakRef = typeof WeakRef === "function" && WeakRef.prototype;
70
+ var weakRefDeref = hasWeakRef ? WeakRef.prototype.deref : null;
71
+ var booleanValueOf = Boolean.prototype.valueOf;
72
+ var objectToString = Object.prototype.toString;
73
+ var functionToString = Function.prototype.toString;
74
+ var $match = String.prototype.match;
75
+ var $slice = String.prototype.slice;
76
+ var $replace = String.prototype.replace;
77
+ var $toUpperCase = String.prototype.toUpperCase;
78
+ var $toLowerCase = String.prototype.toLowerCase;
79
+ var $test = RegExp.prototype.test;
80
+ var $concat = Array.prototype.concat;
81
+ var $join = Array.prototype.join;
82
+ var $arrSlice = Array.prototype.slice;
83
+ var $floor = Math.floor;
84
+ var bigIntValueOf = typeof BigInt === "function" ? BigInt.prototype.valueOf : null;
85
+ var gOPS = Object.getOwnPropertySymbols;
86
+ var symToString = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? Symbol.prototype.toString : null;
87
+ var hasShammedSymbols = typeof Symbol === "function" && typeof Symbol.iterator === "object";
88
+ var toStringTag = typeof Symbol === "function" && Symbol.toStringTag && (typeof Symbol.toStringTag === hasShammedSymbols ? "object" : "symbol") ? Symbol.toStringTag : null;
89
+ var isEnumerable = Object.prototype.propertyIsEnumerable;
90
+ var gPO = (typeof Reflect === "function" ? Reflect.getPrototypeOf : Object.getPrototypeOf) || ([].__proto__ === Array.prototype ? function(O) {
91
+ return O.__proto__;
92
+ } : null);
93
+ function addNumericSeparator(num, str) {
94
+ if (num === Infinity || num === -Infinity || num !== num || num && num > -1e3 && num < 1e3 || $test.call(/e/, str)) {
95
+ return str;
96
+ }
97
+ var sepRegex = /[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;
98
+ if (typeof num === "number") {
99
+ var int = num < 0 ? -$floor(-num) : $floor(num);
100
+ if (int !== num) {
101
+ var intStr = String(int);
102
+ var dec = $slice.call(str, intStr.length + 1);
103
+ return $replace.call(intStr, sepRegex, "$&_") + "." + $replace.call($replace.call(dec, /([0-9]{3})/g, "$&_"), /_$/, "");
104
+ }
105
+ }
106
+ return $replace.call(str, sepRegex, "$&_");
107
+ }
108
+ var utilInspect = require$$0;
109
+ var inspectCustom = utilInspect.custom;
110
+ var inspectSymbol = isSymbol(inspectCustom) ? inspectCustom : null;
111
+ var quotes = {
112
+ __proto__: null,
113
+ "double": '"',
114
+ single: "'"
115
+ };
116
+ var quoteREs = {
117
+ __proto__: null,
118
+ "double": /(["\\])/g,
119
+ single: /(['\\])/g
120
+ };
121
+ objectInspect = function inspect_(obj, options, depth, seen) {
122
+ var opts = options || {};
123
+ if (has(opts, "quoteStyle") && !has(quotes, opts.quoteStyle)) {
124
+ throw new TypeError('option "quoteStyle" must be "single" or "double"');
125
+ }
126
+ if (has(opts, "maxStringLength") && (typeof opts.maxStringLength === "number" ? opts.maxStringLength < 0 && opts.maxStringLength !== Infinity : opts.maxStringLength !== null)) {
127
+ throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');
128
+ }
129
+ var customInspect = has(opts, "customInspect") ? opts.customInspect : true;
130
+ if (typeof customInspect !== "boolean" && customInspect !== "symbol") {
131
+ throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");
132
+ }
133
+ if (has(opts, "indent") && opts.indent !== null && opts.indent !== " " && !(parseInt(opts.indent, 10) === opts.indent && opts.indent > 0)) {
134
+ throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');
135
+ }
136
+ if (has(opts, "numericSeparator") && typeof opts.numericSeparator !== "boolean") {
137
+ throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');
138
+ }
139
+ var numericSeparator = opts.numericSeparator;
140
+ if (typeof obj === "undefined") {
141
+ return "undefined";
142
+ }
143
+ if (obj === null) {
144
+ return "null";
145
+ }
146
+ if (typeof obj === "boolean") {
147
+ return obj ? "true" : "false";
148
+ }
149
+ if (typeof obj === "string") {
150
+ return inspectString(obj, opts);
151
+ }
152
+ if (typeof obj === "number") {
153
+ if (obj === 0) {
154
+ return Infinity / obj > 0 ? "0" : "-0";
155
+ }
156
+ var str = String(obj);
157
+ return numericSeparator ? addNumericSeparator(obj, str) : str;
158
+ }
159
+ if (typeof obj === "bigint") {
160
+ var bigIntStr = String(obj) + "n";
161
+ return numericSeparator ? addNumericSeparator(obj, bigIntStr) : bigIntStr;
162
+ }
163
+ var maxDepth = typeof opts.depth === "undefined" ? 5 : opts.depth;
164
+ if (typeof depth === "undefined") {
165
+ depth = 0;
166
+ }
167
+ if (depth >= maxDepth && maxDepth > 0 && typeof obj === "object") {
168
+ return isArray(obj) ? "[Array]" : "[Object]";
169
+ }
170
+ var indent = getIndent(opts, depth);
171
+ if (typeof seen === "undefined") {
172
+ seen = [];
173
+ } else if (indexOf(seen, obj) >= 0) {
174
+ return "[Circular]";
175
+ }
176
+ function inspect(value, from, noIndent) {
177
+ if (from) {
178
+ seen = $arrSlice.call(seen);
179
+ seen.push(from);
180
+ }
181
+ if (noIndent) {
182
+ var newOpts = {
183
+ depth: opts.depth
184
+ };
185
+ if (has(opts, "quoteStyle")) {
186
+ newOpts.quoteStyle = opts.quoteStyle;
187
+ }
188
+ return inspect_(value, newOpts, depth + 1, seen);
189
+ }
190
+ return inspect_(value, opts, depth + 1, seen);
191
+ }
192
+ if (typeof obj === "function" && !isRegExp(obj)) {
193
+ var name = nameOf(obj);
194
+ var keys = arrObjKeys(obj, inspect);
195
+ return "[Function" + (name ? ": " + name : " (anonymous)") + "]" + (keys.length > 0 ? " { " + $join.call(keys, ", ") + " }" : "");
196
+ }
197
+ if (isSymbol(obj)) {
198
+ var symString = hasShammedSymbols ? $replace.call(String(obj), /^(Symbol\(.*\))_[^)]*$/, "$1") : symToString.call(obj);
199
+ return typeof obj === "object" && !hasShammedSymbols ? markBoxed(symString) : symString;
200
+ }
201
+ if (isElement(obj)) {
202
+ var s = "<" + $toLowerCase.call(String(obj.nodeName));
203
+ var attrs = obj.attributes || [];
204
+ for (var i = 0; i < attrs.length; i++) {
205
+ s += " " + attrs[i].name + "=" + wrapQuotes(quote(attrs[i].value), "double", opts);
206
+ }
207
+ s += ">";
208
+ if (obj.childNodes && obj.childNodes.length) {
209
+ s += "...";
210
+ }
211
+ s += "</" + $toLowerCase.call(String(obj.nodeName)) + ">";
212
+ return s;
213
+ }
214
+ if (isArray(obj)) {
215
+ if (obj.length === 0) {
216
+ return "[]";
217
+ }
218
+ var xs = arrObjKeys(obj, inspect);
219
+ if (indent && !singleLineValues(xs)) {
220
+ return "[" + indentedJoin(xs, indent) + "]";
221
+ }
222
+ return "[ " + $join.call(xs, ", ") + " ]";
223
+ }
224
+ if (isError(obj)) {
225
+ var parts = arrObjKeys(obj, inspect);
226
+ if (!("cause" in Error.prototype) && "cause" in obj && !isEnumerable.call(obj, "cause")) {
227
+ return "{ [" + String(obj) + "] " + $join.call($concat.call("[cause]: " + inspect(obj.cause), parts), ", ") + " }";
228
+ }
229
+ if (parts.length === 0) {
230
+ return "[" + String(obj) + "]";
231
+ }
232
+ return "{ [" + String(obj) + "] " + $join.call(parts, ", ") + " }";
233
+ }
234
+ if (typeof obj === "object" && customInspect) {
235
+ if (inspectSymbol && typeof obj[inspectSymbol] === "function" && utilInspect) {
236
+ return utilInspect(obj, { depth: maxDepth - depth });
237
+ } else if (customInspect !== "symbol" && typeof obj.inspect === "function") {
238
+ return obj.inspect();
239
+ }
240
+ }
241
+ if (isMap(obj)) {
242
+ var mapParts = [];
243
+ if (mapForEach) {
244
+ mapForEach.call(obj, function(value, key) {
245
+ mapParts.push(inspect(key, obj, true) + " => " + inspect(value, obj));
246
+ });
247
+ }
248
+ return collectionOf("Map", mapSize.call(obj), mapParts, indent);
249
+ }
250
+ if (isSet(obj)) {
251
+ var setParts = [];
252
+ if (setForEach) {
253
+ setForEach.call(obj, function(value) {
254
+ setParts.push(inspect(value, obj));
255
+ });
256
+ }
257
+ return collectionOf("Set", setSize.call(obj), setParts, indent);
258
+ }
259
+ if (isWeakMap(obj)) {
260
+ return weakCollectionOf("WeakMap");
261
+ }
262
+ if (isWeakSet(obj)) {
263
+ return weakCollectionOf("WeakSet");
264
+ }
265
+ if (isWeakRef(obj)) {
266
+ return weakCollectionOf("WeakRef");
267
+ }
268
+ if (isNumber(obj)) {
269
+ return markBoxed(inspect(Number(obj)));
270
+ }
271
+ if (isBigInt(obj)) {
272
+ return markBoxed(inspect(bigIntValueOf.call(obj)));
273
+ }
274
+ if (isBoolean(obj)) {
275
+ return markBoxed(booleanValueOf.call(obj));
276
+ }
277
+ if (isString(obj)) {
278
+ return markBoxed(inspect(String(obj)));
279
+ }
280
+ if (typeof window !== "undefined" && obj === window) {
281
+ return "{ [object Window] }";
282
+ }
283
+ if (typeof globalThis !== "undefined" && obj === globalThis || typeof commonjsGlobal !== "undefined" && obj === commonjsGlobal) {
284
+ return "{ [object globalThis] }";
285
+ }
286
+ if (!isDate(obj) && !isRegExp(obj)) {
287
+ var ys = arrObjKeys(obj, inspect);
288
+ var isPlainObject = gPO ? gPO(obj) === Object.prototype : obj instanceof Object || obj.constructor === Object;
289
+ var protoTag = obj instanceof Object ? "" : "null prototype";
290
+ var stringTag = !isPlainObject && toStringTag && Object(obj) === obj && toStringTag in obj ? $slice.call(toStr(obj), 8, -1) : protoTag ? "Object" : "";
291
+ var constructorTag = isPlainObject || typeof obj.constructor !== "function" ? "" : obj.constructor.name ? obj.constructor.name + " " : "";
292
+ var tag = constructorTag + (stringTag || protoTag ? "[" + $join.call($concat.call([], stringTag || [], protoTag || []), ": ") + "] " : "");
293
+ if (ys.length === 0) {
294
+ return tag + "{}";
295
+ }
296
+ if (indent) {
297
+ return tag + "{" + indentedJoin(ys, indent) + "}";
298
+ }
299
+ return tag + "{ " + $join.call(ys, ", ") + " }";
300
+ }
301
+ return String(obj);
302
+ };
303
+ function wrapQuotes(s, defaultStyle, opts) {
304
+ var style = opts.quoteStyle || defaultStyle;
305
+ var quoteChar = quotes[style];
306
+ return quoteChar + s + quoteChar;
307
+ }
308
+ function quote(s) {
309
+ return $replace.call(String(s), /"/g, "&quot;");
310
+ }
311
+ function canTrustToString(obj) {
312
+ return !toStringTag || !(typeof obj === "object" && (toStringTag in obj || typeof obj[toStringTag] !== "undefined"));
313
+ }
314
+ function isArray(obj) {
315
+ return toStr(obj) === "[object Array]" && canTrustToString(obj);
316
+ }
317
+ function isDate(obj) {
318
+ return toStr(obj) === "[object Date]" && canTrustToString(obj);
319
+ }
320
+ function isRegExp(obj) {
321
+ return toStr(obj) === "[object RegExp]" && canTrustToString(obj);
322
+ }
323
+ function isError(obj) {
324
+ return toStr(obj) === "[object Error]" && canTrustToString(obj);
325
+ }
326
+ function isString(obj) {
327
+ return toStr(obj) === "[object String]" && canTrustToString(obj);
328
+ }
329
+ function isNumber(obj) {
330
+ return toStr(obj) === "[object Number]" && canTrustToString(obj);
331
+ }
332
+ function isBoolean(obj) {
333
+ return toStr(obj) === "[object Boolean]" && canTrustToString(obj);
334
+ }
335
+ function isSymbol(obj) {
336
+ if (hasShammedSymbols) {
337
+ return obj && typeof obj === "object" && obj instanceof Symbol;
338
+ }
339
+ if (typeof obj === "symbol") {
340
+ return true;
341
+ }
342
+ if (!obj || typeof obj !== "object" || !symToString) {
343
+ return false;
344
+ }
345
+ try {
346
+ symToString.call(obj);
347
+ return true;
348
+ } catch (e) {
349
+ }
350
+ return false;
351
+ }
352
+ function isBigInt(obj) {
353
+ if (!obj || typeof obj !== "object" || !bigIntValueOf) {
354
+ return false;
355
+ }
356
+ try {
357
+ bigIntValueOf.call(obj);
358
+ return true;
359
+ } catch (e) {
360
+ }
361
+ return false;
362
+ }
363
+ var hasOwn = Object.prototype.hasOwnProperty || function(key) {
364
+ return key in this;
365
+ };
366
+ function has(obj, key) {
367
+ return hasOwn.call(obj, key);
368
+ }
369
+ function toStr(obj) {
370
+ return objectToString.call(obj);
371
+ }
372
+ function nameOf(f) {
373
+ if (f.name) {
374
+ return f.name;
375
+ }
376
+ var m = $match.call(functionToString.call(f), /^function\s*([\w$]+)/);
377
+ if (m) {
378
+ return m[1];
379
+ }
380
+ return null;
381
+ }
382
+ function indexOf(xs, x) {
383
+ if (xs.indexOf) {
384
+ return xs.indexOf(x);
385
+ }
386
+ for (var i = 0, l = xs.length; i < l; i++) {
387
+ if (xs[i] === x) {
388
+ return i;
389
+ }
390
+ }
391
+ return -1;
392
+ }
393
+ function isMap(x) {
394
+ if (!mapSize || !x || typeof x !== "object") {
395
+ return false;
396
+ }
397
+ try {
398
+ mapSize.call(x);
399
+ try {
400
+ setSize.call(x);
401
+ } catch (s) {
402
+ return true;
403
+ }
404
+ return x instanceof Map;
405
+ } catch (e) {
406
+ }
407
+ return false;
408
+ }
409
+ function isWeakMap(x) {
410
+ if (!weakMapHas || !x || typeof x !== "object") {
411
+ return false;
412
+ }
413
+ try {
414
+ weakMapHas.call(x, weakMapHas);
415
+ try {
416
+ weakSetHas.call(x, weakSetHas);
417
+ } catch (s) {
418
+ return true;
419
+ }
420
+ return x instanceof WeakMap;
421
+ } catch (e) {
422
+ }
423
+ return false;
424
+ }
425
+ function isWeakRef(x) {
426
+ if (!weakRefDeref || !x || typeof x !== "object") {
427
+ return false;
428
+ }
429
+ try {
430
+ weakRefDeref.call(x);
431
+ return true;
432
+ } catch (e) {
433
+ }
434
+ return false;
435
+ }
436
+ function isSet(x) {
437
+ if (!setSize || !x || typeof x !== "object") {
438
+ return false;
439
+ }
440
+ try {
441
+ setSize.call(x);
442
+ try {
443
+ mapSize.call(x);
444
+ } catch (m) {
445
+ return true;
446
+ }
447
+ return x instanceof Set;
448
+ } catch (e) {
449
+ }
450
+ return false;
451
+ }
452
+ function isWeakSet(x) {
453
+ if (!weakSetHas || !x || typeof x !== "object") {
454
+ return false;
455
+ }
456
+ try {
457
+ weakSetHas.call(x, weakSetHas);
458
+ try {
459
+ weakMapHas.call(x, weakMapHas);
460
+ } catch (s) {
461
+ return true;
462
+ }
463
+ return x instanceof WeakSet;
464
+ } catch (e) {
465
+ }
466
+ return false;
467
+ }
468
+ function isElement(x) {
469
+ if (!x || typeof x !== "object") {
470
+ return false;
471
+ }
472
+ if (typeof HTMLElement !== "undefined" && x instanceof HTMLElement) {
473
+ return true;
474
+ }
475
+ return typeof x.nodeName === "string" && typeof x.getAttribute === "function";
476
+ }
477
+ function inspectString(str, opts) {
478
+ if (str.length > opts.maxStringLength) {
479
+ var remaining = str.length - opts.maxStringLength;
480
+ var trailer = "... " + remaining + " more character" + (remaining > 1 ? "s" : "");
481
+ return inspectString($slice.call(str, 0, opts.maxStringLength), opts) + trailer;
482
+ }
483
+ var quoteRE = quoteREs[opts.quoteStyle || "single"];
484
+ quoteRE.lastIndex = 0;
485
+ var s = $replace.call($replace.call(str, quoteRE, "\\$1"), /[\x00-\x1f]/g, lowbyte);
486
+ return wrapQuotes(s, "single", opts);
487
+ }
488
+ function lowbyte(c) {
489
+ var n = c.charCodeAt(0);
490
+ var x = {
491
+ 8: "b",
492
+ 9: "t",
493
+ 10: "n",
494
+ 12: "f",
495
+ 13: "r"
496
+ }[n];
497
+ if (x) {
498
+ return "\\" + x;
499
+ }
500
+ return "\\x" + (n < 16 ? "0" : "") + $toUpperCase.call(n.toString(16));
501
+ }
502
+ function markBoxed(str) {
503
+ return "Object(" + str + ")";
504
+ }
505
+ function weakCollectionOf(type2) {
506
+ return type2 + " { ? }";
507
+ }
508
+ function collectionOf(type2, size, entries, indent) {
509
+ var joinedEntries = indent ? indentedJoin(entries, indent) : $join.call(entries, ", ");
510
+ return type2 + " (" + size + ") {" + joinedEntries + "}";
511
+ }
512
+ function singleLineValues(xs) {
513
+ for (var i = 0; i < xs.length; i++) {
514
+ if (indexOf(xs[i], "\n") >= 0) {
515
+ return false;
516
+ }
517
+ }
518
+ return true;
519
+ }
520
+ function getIndent(opts, depth) {
521
+ var baseIndent;
522
+ if (opts.indent === " ") {
523
+ baseIndent = " ";
524
+ } else if (typeof opts.indent === "number" && opts.indent > 0) {
525
+ baseIndent = $join.call(Array(opts.indent + 1), " ");
526
+ } else {
527
+ return null;
528
+ }
529
+ return {
530
+ base: baseIndent,
531
+ prev: $join.call(Array(depth + 1), baseIndent)
532
+ };
533
+ }
534
+ function indentedJoin(xs, indent) {
535
+ if (xs.length === 0) {
536
+ return "";
537
+ }
538
+ var lineJoiner = "\n" + indent.prev + indent.base;
539
+ return lineJoiner + $join.call(xs, "," + lineJoiner) + "\n" + indent.prev;
540
+ }
541
+ function arrObjKeys(obj, inspect) {
542
+ var isArr = isArray(obj);
543
+ var xs = [];
544
+ if (isArr) {
545
+ xs.length = obj.length;
546
+ for (var i = 0; i < obj.length; i++) {
547
+ xs[i] = has(obj, i) ? inspect(obj[i], obj) : "";
548
+ }
549
+ }
550
+ var syms = typeof gOPS === "function" ? gOPS(obj) : [];
551
+ var symMap;
552
+ if (hasShammedSymbols) {
553
+ symMap = {};
554
+ for (var k = 0; k < syms.length; k++) {
555
+ symMap["$" + syms[k]] = syms[k];
556
+ }
557
+ }
558
+ for (var key in obj) {
559
+ if (!has(obj, key)) {
560
+ continue;
561
+ }
562
+ if (isArr && String(Number(key)) === key && key < obj.length) {
563
+ continue;
564
+ }
565
+ if (hasShammedSymbols && symMap["$" + key] instanceof Symbol) {
566
+ continue;
567
+ } else if ($test.call(/[^\w$]/, key)) {
568
+ xs.push(inspect(key, obj) + ": " + inspect(obj[key], obj));
569
+ } else {
570
+ xs.push(key + ": " + inspect(obj[key], obj));
571
+ }
572
+ }
573
+ if (typeof gOPS === "function") {
574
+ for (var j = 0; j < syms.length; j++) {
575
+ if (isEnumerable.call(obj, syms[j])) {
576
+ xs.push("[" + inspect(syms[j]) + "]: " + inspect(obj[syms[j]], obj));
577
+ }
578
+ }
579
+ }
580
+ return xs;
581
+ }
582
+ return objectInspect;
583
+ }
584
+ var sideChannelList;
585
+ var hasRequiredSideChannelList;
586
+ function requireSideChannelList() {
587
+ if (hasRequiredSideChannelList) return sideChannelList;
588
+ hasRequiredSideChannelList = 1;
589
+ var inspect = /* @__PURE__ */ requireObjectInspect();
590
+ var $TypeError = /* @__PURE__ */ requireType();
591
+ var listGetNode = function(list, key, isDelete) {
592
+ var prev = list;
593
+ var curr;
594
+ for (; (curr = prev.next) != null; prev = curr) {
595
+ if (curr.key === key) {
596
+ prev.next = curr.next;
597
+ if (!isDelete) {
598
+ curr.next = /** @type {NonNullable<typeof list.next>} */
599
+ list.next;
600
+ list.next = curr;
601
+ }
602
+ return curr;
603
+ }
604
+ }
605
+ };
606
+ var listGet = function(objects, key) {
607
+ if (!objects) {
608
+ return void 0;
609
+ }
610
+ var node = listGetNode(objects, key);
611
+ return node && node.value;
612
+ };
613
+ var listSet = function(objects, key, value) {
614
+ var node = listGetNode(objects, key);
615
+ if (node) {
616
+ node.value = value;
617
+ } else {
618
+ objects.next = /** @type {import('./list.d.ts').ListNode<typeof value, typeof key>} */
619
+ {
620
+ // eslint-disable-line no-param-reassign, no-extra-parens
621
+ key,
622
+ next: objects.next,
623
+ value
624
+ };
625
+ }
626
+ };
627
+ var listHas = function(objects, key) {
628
+ if (!objects) {
629
+ return false;
630
+ }
631
+ return !!listGetNode(objects, key);
632
+ };
633
+ var listDelete = function(objects, key) {
634
+ if (objects) {
635
+ return listGetNode(objects, key, true);
636
+ }
637
+ };
638
+ sideChannelList = function getSideChannelList() {
639
+ var $o;
640
+ var channel = {
641
+ assert: function(key) {
642
+ if (!channel.has(key)) {
643
+ throw new $TypeError("Side channel does not contain " + inspect(key));
644
+ }
645
+ },
646
+ "delete": function(key) {
647
+ var root = $o && $o.next;
648
+ var deletedNode = listDelete($o, key);
649
+ if (deletedNode && root && root === deletedNode) {
650
+ $o = void 0;
651
+ }
652
+ return !!deletedNode;
653
+ },
654
+ get: function(key) {
655
+ return listGet($o, key);
656
+ },
657
+ has: function(key) {
658
+ return listHas($o, key);
659
+ },
660
+ set: function(key, value) {
661
+ if (!$o) {
662
+ $o = {
663
+ next: void 0
664
+ };
665
+ }
666
+ listSet(
667
+ /** @type {NonNullable<typeof $o>} */
668
+ $o,
669
+ key,
670
+ value
671
+ );
672
+ }
673
+ };
674
+ return channel;
675
+ };
676
+ return sideChannelList;
677
+ }
678
+ var esObjectAtoms;
679
+ var hasRequiredEsObjectAtoms;
680
+ function requireEsObjectAtoms() {
681
+ if (hasRequiredEsObjectAtoms) return esObjectAtoms;
682
+ hasRequiredEsObjectAtoms = 1;
683
+ esObjectAtoms = Object;
684
+ return esObjectAtoms;
685
+ }
686
+ var esErrors;
687
+ var hasRequiredEsErrors;
688
+ function requireEsErrors() {
689
+ if (hasRequiredEsErrors) return esErrors;
690
+ hasRequiredEsErrors = 1;
691
+ esErrors = Error;
692
+ return esErrors;
693
+ }
694
+ var _eval;
695
+ var hasRequired_eval;
696
+ function require_eval() {
697
+ if (hasRequired_eval) return _eval;
698
+ hasRequired_eval = 1;
699
+ _eval = EvalError;
700
+ return _eval;
701
+ }
702
+ var range;
703
+ var hasRequiredRange;
704
+ function requireRange() {
705
+ if (hasRequiredRange) return range;
706
+ hasRequiredRange = 1;
707
+ range = RangeError;
708
+ return range;
709
+ }
710
+ var ref;
711
+ var hasRequiredRef;
712
+ function requireRef() {
713
+ if (hasRequiredRef) return ref;
714
+ hasRequiredRef = 1;
715
+ ref = ReferenceError;
716
+ return ref;
717
+ }
718
+ var syntax;
719
+ var hasRequiredSyntax;
720
+ function requireSyntax() {
721
+ if (hasRequiredSyntax) return syntax;
722
+ hasRequiredSyntax = 1;
723
+ syntax = SyntaxError;
724
+ return syntax;
725
+ }
726
+ var uri;
727
+ var hasRequiredUri;
728
+ function requireUri() {
729
+ if (hasRequiredUri) return uri;
730
+ hasRequiredUri = 1;
731
+ uri = URIError;
732
+ return uri;
733
+ }
734
+ var abs;
735
+ var hasRequiredAbs;
736
+ function requireAbs() {
737
+ if (hasRequiredAbs) return abs;
738
+ hasRequiredAbs = 1;
739
+ abs = Math.abs;
740
+ return abs;
741
+ }
742
+ var floor;
743
+ var hasRequiredFloor;
744
+ function requireFloor() {
745
+ if (hasRequiredFloor) return floor;
746
+ hasRequiredFloor = 1;
747
+ floor = Math.floor;
748
+ return floor;
749
+ }
750
+ var max;
751
+ var hasRequiredMax;
752
+ function requireMax() {
753
+ if (hasRequiredMax) return max;
754
+ hasRequiredMax = 1;
755
+ max = Math.max;
756
+ return max;
757
+ }
758
+ var min;
759
+ var hasRequiredMin;
760
+ function requireMin() {
761
+ if (hasRequiredMin) return min;
762
+ hasRequiredMin = 1;
763
+ min = Math.min;
764
+ return min;
765
+ }
766
+ var pow;
767
+ var hasRequiredPow;
768
+ function requirePow() {
769
+ if (hasRequiredPow) return pow;
770
+ hasRequiredPow = 1;
771
+ pow = Math.pow;
772
+ return pow;
773
+ }
774
+ var round;
775
+ var hasRequiredRound;
776
+ function requireRound() {
777
+ if (hasRequiredRound) return round;
778
+ hasRequiredRound = 1;
779
+ round = Math.round;
780
+ return round;
781
+ }
782
+ var _isNaN;
783
+ var hasRequired_isNaN;
784
+ function require_isNaN() {
785
+ if (hasRequired_isNaN) return _isNaN;
786
+ hasRequired_isNaN = 1;
787
+ _isNaN = Number.isNaN || function isNaN2(a) {
788
+ return a !== a;
789
+ };
790
+ return _isNaN;
791
+ }
792
+ var sign;
793
+ var hasRequiredSign;
794
+ function requireSign() {
795
+ if (hasRequiredSign) return sign;
796
+ hasRequiredSign = 1;
797
+ var $isNaN = /* @__PURE__ */ require_isNaN();
798
+ sign = function sign2(number) {
799
+ if ($isNaN(number) || number === 0) {
800
+ return number;
801
+ }
802
+ return number < 0 ? -1 : 1;
803
+ };
804
+ return sign;
805
+ }
806
+ var gOPD;
807
+ var hasRequiredGOPD;
808
+ function requireGOPD() {
809
+ if (hasRequiredGOPD) return gOPD;
810
+ hasRequiredGOPD = 1;
811
+ gOPD = Object.getOwnPropertyDescriptor;
812
+ return gOPD;
813
+ }
814
+ var gopd;
815
+ var hasRequiredGopd;
816
+ function requireGopd() {
817
+ if (hasRequiredGopd) return gopd;
818
+ hasRequiredGopd = 1;
819
+ var $gOPD = /* @__PURE__ */ requireGOPD();
820
+ if ($gOPD) {
821
+ try {
822
+ $gOPD([], "length");
823
+ } catch (e) {
824
+ $gOPD = null;
825
+ }
826
+ }
827
+ gopd = $gOPD;
828
+ return gopd;
829
+ }
830
+ var esDefineProperty;
831
+ var hasRequiredEsDefineProperty;
832
+ function requireEsDefineProperty() {
833
+ if (hasRequiredEsDefineProperty) return esDefineProperty;
834
+ hasRequiredEsDefineProperty = 1;
835
+ var $defineProperty = Object.defineProperty || false;
836
+ if ($defineProperty) {
837
+ try {
838
+ $defineProperty({}, "a", { value: 1 });
839
+ } catch (e) {
840
+ $defineProperty = false;
841
+ }
842
+ }
843
+ esDefineProperty = $defineProperty;
844
+ return esDefineProperty;
845
+ }
846
+ var shams;
847
+ var hasRequiredShams;
848
+ function requireShams() {
849
+ if (hasRequiredShams) return shams;
850
+ hasRequiredShams = 1;
851
+ shams = function hasSymbols2() {
852
+ if (typeof Symbol !== "function" || typeof Object.getOwnPropertySymbols !== "function") {
853
+ return false;
854
+ }
855
+ if (typeof Symbol.iterator === "symbol") {
856
+ return true;
857
+ }
858
+ var obj = {};
859
+ var sym = Symbol("test");
860
+ var symObj = Object(sym);
861
+ if (typeof sym === "string") {
862
+ return false;
863
+ }
864
+ if (Object.prototype.toString.call(sym) !== "[object Symbol]") {
865
+ return false;
866
+ }
867
+ if (Object.prototype.toString.call(symObj) !== "[object Symbol]") {
868
+ return false;
869
+ }
870
+ var symVal = 42;
871
+ obj[sym] = symVal;
872
+ for (var _ in obj) {
873
+ return false;
874
+ }
875
+ if (typeof Object.keys === "function" && Object.keys(obj).length !== 0) {
876
+ return false;
877
+ }
878
+ if (typeof Object.getOwnPropertyNames === "function" && Object.getOwnPropertyNames(obj).length !== 0) {
879
+ return false;
880
+ }
881
+ var syms = Object.getOwnPropertySymbols(obj);
882
+ if (syms.length !== 1 || syms[0] !== sym) {
883
+ return false;
884
+ }
885
+ if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) {
886
+ return false;
887
+ }
888
+ if (typeof Object.getOwnPropertyDescriptor === "function") {
889
+ var descriptor = (
890
+ /** @type {PropertyDescriptor} */
891
+ Object.getOwnPropertyDescriptor(obj, sym)
892
+ );
893
+ if (descriptor.value !== symVal || descriptor.enumerable !== true) {
894
+ return false;
895
+ }
896
+ }
897
+ return true;
898
+ };
899
+ return shams;
900
+ }
901
+ var hasSymbols;
902
+ var hasRequiredHasSymbols;
903
+ function requireHasSymbols() {
904
+ if (hasRequiredHasSymbols) return hasSymbols;
905
+ hasRequiredHasSymbols = 1;
906
+ var origSymbol = typeof Symbol !== "undefined" && Symbol;
907
+ var hasSymbolSham = requireShams();
908
+ hasSymbols = function hasNativeSymbols() {
909
+ if (typeof origSymbol !== "function") {
910
+ return false;
911
+ }
912
+ if (typeof Symbol !== "function") {
913
+ return false;
914
+ }
915
+ if (typeof origSymbol("foo") !== "symbol") {
916
+ return false;
917
+ }
918
+ if (typeof Symbol("bar") !== "symbol") {
919
+ return false;
920
+ }
921
+ return hasSymbolSham();
922
+ };
923
+ return hasSymbols;
924
+ }
925
+ var Reflect_getPrototypeOf;
926
+ var hasRequiredReflect_getPrototypeOf;
927
+ function requireReflect_getPrototypeOf() {
928
+ if (hasRequiredReflect_getPrototypeOf) return Reflect_getPrototypeOf;
929
+ hasRequiredReflect_getPrototypeOf = 1;
930
+ Reflect_getPrototypeOf = typeof Reflect !== "undefined" && Reflect.getPrototypeOf || null;
931
+ return Reflect_getPrototypeOf;
932
+ }
933
+ var Object_getPrototypeOf;
934
+ var hasRequiredObject_getPrototypeOf;
935
+ function requireObject_getPrototypeOf() {
936
+ if (hasRequiredObject_getPrototypeOf) return Object_getPrototypeOf;
937
+ hasRequiredObject_getPrototypeOf = 1;
938
+ var $Object = /* @__PURE__ */ requireEsObjectAtoms();
939
+ Object_getPrototypeOf = $Object.getPrototypeOf || null;
940
+ return Object_getPrototypeOf;
941
+ }
942
+ var implementation;
943
+ var hasRequiredImplementation;
944
+ function requireImplementation() {
945
+ if (hasRequiredImplementation) return implementation;
946
+ hasRequiredImplementation = 1;
947
+ var ERROR_MESSAGE = "Function.prototype.bind called on incompatible ";
948
+ var toStr = Object.prototype.toString;
949
+ var max2 = Math.max;
950
+ var funcType = "[object Function]";
951
+ var concatty = function concatty2(a, b) {
952
+ var arr = [];
953
+ for (var i = 0; i < a.length; i += 1) {
954
+ arr[i] = a[i];
955
+ }
956
+ for (var j = 0; j < b.length; j += 1) {
957
+ arr[j + a.length] = b[j];
958
+ }
959
+ return arr;
960
+ };
961
+ var slicy = function slicy2(arrLike, offset) {
962
+ var arr = [];
963
+ for (var i = offset, j = 0; i < arrLike.length; i += 1, j += 1) {
964
+ arr[j] = arrLike[i];
965
+ }
966
+ return arr;
967
+ };
968
+ var joiny = function(arr, joiner) {
969
+ var str = "";
970
+ for (var i = 0; i < arr.length; i += 1) {
971
+ str += arr[i];
972
+ if (i + 1 < arr.length) {
973
+ str += joiner;
974
+ }
975
+ }
976
+ return str;
977
+ };
978
+ implementation = function bind(that) {
979
+ var target = this;
980
+ if (typeof target !== "function" || toStr.apply(target) !== funcType) {
981
+ throw new TypeError(ERROR_MESSAGE + target);
982
+ }
983
+ var args = slicy(arguments, 1);
984
+ var bound;
985
+ var binder = function() {
986
+ if (this instanceof bound) {
987
+ var result = target.apply(
988
+ this,
989
+ concatty(args, arguments)
990
+ );
991
+ if (Object(result) === result) {
992
+ return result;
993
+ }
994
+ return this;
995
+ }
996
+ return target.apply(
997
+ that,
998
+ concatty(args, arguments)
999
+ );
1000
+ };
1001
+ var boundLength = max2(0, target.length - args.length);
1002
+ var boundArgs = [];
1003
+ for (var i = 0; i < boundLength; i++) {
1004
+ boundArgs[i] = "$" + i;
1005
+ }
1006
+ bound = Function("binder", "return function (" + joiny(boundArgs, ",") + "){ return binder.apply(this,arguments); }")(binder);
1007
+ if (target.prototype) {
1008
+ var Empty = function Empty2() {
1009
+ };
1010
+ Empty.prototype = target.prototype;
1011
+ bound.prototype = new Empty();
1012
+ Empty.prototype = null;
1013
+ }
1014
+ return bound;
1015
+ };
1016
+ return implementation;
1017
+ }
1018
+ var functionBind;
1019
+ var hasRequiredFunctionBind;
1020
+ function requireFunctionBind() {
1021
+ if (hasRequiredFunctionBind) return functionBind;
1022
+ hasRequiredFunctionBind = 1;
1023
+ var implementation2 = requireImplementation();
1024
+ functionBind = Function.prototype.bind || implementation2;
1025
+ return functionBind;
1026
+ }
1027
+ var functionCall;
1028
+ var hasRequiredFunctionCall;
1029
+ function requireFunctionCall() {
1030
+ if (hasRequiredFunctionCall) return functionCall;
1031
+ hasRequiredFunctionCall = 1;
1032
+ functionCall = Function.prototype.call;
1033
+ return functionCall;
1034
+ }
1035
+ var functionApply;
1036
+ var hasRequiredFunctionApply;
1037
+ function requireFunctionApply() {
1038
+ if (hasRequiredFunctionApply) return functionApply;
1039
+ hasRequiredFunctionApply = 1;
1040
+ functionApply = Function.prototype.apply;
1041
+ return functionApply;
1042
+ }
1043
+ var reflectApply;
1044
+ var hasRequiredReflectApply;
1045
+ function requireReflectApply() {
1046
+ if (hasRequiredReflectApply) return reflectApply;
1047
+ hasRequiredReflectApply = 1;
1048
+ reflectApply = typeof Reflect !== "undefined" && Reflect && Reflect.apply;
1049
+ return reflectApply;
1050
+ }
1051
+ var actualApply;
1052
+ var hasRequiredActualApply;
1053
+ function requireActualApply() {
1054
+ if (hasRequiredActualApply) return actualApply;
1055
+ hasRequiredActualApply = 1;
1056
+ var bind = requireFunctionBind();
1057
+ var $apply = requireFunctionApply();
1058
+ var $call = requireFunctionCall();
1059
+ var $reflectApply = requireReflectApply();
1060
+ actualApply = $reflectApply || bind.call($call, $apply);
1061
+ return actualApply;
1062
+ }
1063
+ var callBindApplyHelpers;
1064
+ var hasRequiredCallBindApplyHelpers;
1065
+ function requireCallBindApplyHelpers() {
1066
+ if (hasRequiredCallBindApplyHelpers) return callBindApplyHelpers;
1067
+ hasRequiredCallBindApplyHelpers = 1;
1068
+ var bind = requireFunctionBind();
1069
+ var $TypeError = /* @__PURE__ */ requireType();
1070
+ var $call = requireFunctionCall();
1071
+ var $actualApply = requireActualApply();
1072
+ callBindApplyHelpers = function callBindBasic(args) {
1073
+ if (args.length < 1 || typeof args[0] !== "function") {
1074
+ throw new $TypeError("a function is required");
1075
+ }
1076
+ return $actualApply(bind, $call, args);
1077
+ };
1078
+ return callBindApplyHelpers;
1079
+ }
1080
+ var get;
1081
+ var hasRequiredGet;
1082
+ function requireGet() {
1083
+ if (hasRequiredGet) return get;
1084
+ hasRequiredGet = 1;
1085
+ var callBind = requireCallBindApplyHelpers();
1086
+ var gOPD2 = /* @__PURE__ */ requireGopd();
1087
+ var hasProtoAccessor;
1088
+ try {
1089
+ hasProtoAccessor = /** @type {{ __proto__?: typeof Array.prototype }} */
1090
+ [].__proto__ === Array.prototype;
1091
+ } catch (e) {
1092
+ if (!e || typeof e !== "object" || !("code" in e) || e.code !== "ERR_PROTO_ACCESS") {
1093
+ throw e;
1094
+ }
1095
+ }
1096
+ var desc = !!hasProtoAccessor && gOPD2 && gOPD2(
1097
+ Object.prototype,
1098
+ /** @type {keyof typeof Object.prototype} */
1099
+ "__proto__"
1100
+ );
1101
+ var $Object = Object;
1102
+ var $getPrototypeOf = $Object.getPrototypeOf;
1103
+ get = desc && typeof desc.get === "function" ? callBind([desc.get]) : typeof $getPrototypeOf === "function" ? (
1104
+ /** @type {import('./get')} */
1105
+ function getDunder(value) {
1106
+ return $getPrototypeOf(value == null ? value : $Object(value));
1107
+ }
1108
+ ) : false;
1109
+ return get;
1110
+ }
1111
+ var getProto;
1112
+ var hasRequiredGetProto;
1113
+ function requireGetProto() {
1114
+ if (hasRequiredGetProto) return getProto;
1115
+ hasRequiredGetProto = 1;
1116
+ var reflectGetProto = requireReflect_getPrototypeOf();
1117
+ var originalGetProto = requireObject_getPrototypeOf();
1118
+ var getDunderProto = /* @__PURE__ */ requireGet();
1119
+ getProto = reflectGetProto ? function getProto2(O) {
1120
+ return reflectGetProto(O);
1121
+ } : originalGetProto ? function getProto2(O) {
1122
+ if (!O || typeof O !== "object" && typeof O !== "function") {
1123
+ throw new TypeError("getProto: not an object");
1124
+ }
1125
+ return originalGetProto(O);
1126
+ } : getDunderProto ? function getProto2(O) {
1127
+ return getDunderProto(O);
1128
+ } : null;
1129
+ return getProto;
1130
+ }
1131
+ var hasown;
1132
+ var hasRequiredHasown;
1133
+ function requireHasown() {
1134
+ if (hasRequiredHasown) return hasown;
1135
+ hasRequiredHasown = 1;
1136
+ var call = Function.prototype.call;
1137
+ var $hasOwn = Object.prototype.hasOwnProperty;
1138
+ var bind = requireFunctionBind();
1139
+ hasown = bind.call(call, $hasOwn);
1140
+ return hasown;
1141
+ }
1142
+ var getIntrinsic;
1143
+ var hasRequiredGetIntrinsic;
1144
+ function requireGetIntrinsic() {
1145
+ if (hasRequiredGetIntrinsic) return getIntrinsic;
1146
+ hasRequiredGetIntrinsic = 1;
1147
+ var undefined$1;
1148
+ var $Object = /* @__PURE__ */ requireEsObjectAtoms();
1149
+ var $Error = /* @__PURE__ */ requireEsErrors();
1150
+ var $EvalError = /* @__PURE__ */ require_eval();
1151
+ var $RangeError = /* @__PURE__ */ requireRange();
1152
+ var $ReferenceError = /* @__PURE__ */ requireRef();
1153
+ var $SyntaxError = /* @__PURE__ */ requireSyntax();
1154
+ var $TypeError = /* @__PURE__ */ requireType();
1155
+ var $URIError = /* @__PURE__ */ requireUri();
1156
+ var abs2 = /* @__PURE__ */ requireAbs();
1157
+ var floor2 = /* @__PURE__ */ requireFloor();
1158
+ var max2 = /* @__PURE__ */ requireMax();
1159
+ var min2 = /* @__PURE__ */ requireMin();
1160
+ var pow2 = /* @__PURE__ */ requirePow();
1161
+ var round2 = /* @__PURE__ */ requireRound();
1162
+ var sign2 = /* @__PURE__ */ requireSign();
1163
+ var $Function = Function;
1164
+ var getEvalledConstructor = function(expressionSyntax) {
1165
+ try {
1166
+ return $Function('"use strict"; return (' + expressionSyntax + ").constructor;")();
1167
+ } catch (e) {
1168
+ }
1169
+ };
1170
+ var $gOPD = /* @__PURE__ */ requireGopd();
1171
+ var $defineProperty = /* @__PURE__ */ requireEsDefineProperty();
1172
+ var throwTypeError = function() {
1173
+ throw new $TypeError();
1174
+ };
1175
+ var ThrowTypeError = $gOPD ? function() {
1176
+ try {
1177
+ arguments.callee;
1178
+ return throwTypeError;
1179
+ } catch (calleeThrows) {
1180
+ try {
1181
+ return $gOPD(arguments, "callee").get;
1182
+ } catch (gOPDthrows) {
1183
+ return throwTypeError;
1184
+ }
1185
+ }
1186
+ }() : throwTypeError;
1187
+ var hasSymbols2 = requireHasSymbols()();
1188
+ var getProto2 = requireGetProto();
1189
+ var $ObjectGPO = requireObject_getPrototypeOf();
1190
+ var $ReflectGPO = requireReflect_getPrototypeOf();
1191
+ var $apply = requireFunctionApply();
1192
+ var $call = requireFunctionCall();
1193
+ var needsEval = {};
1194
+ var TypedArray = typeof Uint8Array === "undefined" || !getProto2 ? undefined$1 : getProto2(Uint8Array);
1195
+ var INTRINSICS = {
1196
+ __proto__: null,
1197
+ "%AggregateError%": typeof AggregateError === "undefined" ? undefined$1 : AggregateError,
1198
+ "%Array%": Array,
1199
+ "%ArrayBuffer%": typeof ArrayBuffer === "undefined" ? undefined$1 : ArrayBuffer,
1200
+ "%ArrayIteratorPrototype%": hasSymbols2 && getProto2 ? getProto2([][Symbol.iterator]()) : undefined$1,
1201
+ "%AsyncFromSyncIteratorPrototype%": undefined$1,
1202
+ "%AsyncFunction%": needsEval,
1203
+ "%AsyncGenerator%": needsEval,
1204
+ "%AsyncGeneratorFunction%": needsEval,
1205
+ "%AsyncIteratorPrototype%": needsEval,
1206
+ "%Atomics%": typeof Atomics === "undefined" ? undefined$1 : Atomics,
1207
+ "%BigInt%": typeof BigInt === "undefined" ? undefined$1 : BigInt,
1208
+ "%BigInt64Array%": typeof BigInt64Array === "undefined" ? undefined$1 : BigInt64Array,
1209
+ "%BigUint64Array%": typeof BigUint64Array === "undefined" ? undefined$1 : BigUint64Array,
1210
+ "%Boolean%": Boolean,
1211
+ "%DataView%": typeof DataView === "undefined" ? undefined$1 : DataView,
1212
+ "%Date%": Date,
1213
+ "%decodeURI%": decodeURI,
1214
+ "%decodeURIComponent%": decodeURIComponent,
1215
+ "%encodeURI%": encodeURI,
1216
+ "%encodeURIComponent%": encodeURIComponent,
1217
+ "%Error%": $Error,
1218
+ "%eval%": eval,
1219
+ // eslint-disable-line no-eval
1220
+ "%EvalError%": $EvalError,
1221
+ "%Float16Array%": typeof Float16Array === "undefined" ? undefined$1 : Float16Array,
1222
+ "%Float32Array%": typeof Float32Array === "undefined" ? undefined$1 : Float32Array,
1223
+ "%Float64Array%": typeof Float64Array === "undefined" ? undefined$1 : Float64Array,
1224
+ "%FinalizationRegistry%": typeof FinalizationRegistry === "undefined" ? undefined$1 : FinalizationRegistry,
1225
+ "%Function%": $Function,
1226
+ "%GeneratorFunction%": needsEval,
1227
+ "%Int8Array%": typeof Int8Array === "undefined" ? undefined$1 : Int8Array,
1228
+ "%Int16Array%": typeof Int16Array === "undefined" ? undefined$1 : Int16Array,
1229
+ "%Int32Array%": typeof Int32Array === "undefined" ? undefined$1 : Int32Array,
1230
+ "%isFinite%": isFinite,
1231
+ "%isNaN%": isNaN,
1232
+ "%IteratorPrototype%": hasSymbols2 && getProto2 ? getProto2(getProto2([][Symbol.iterator]())) : undefined$1,
1233
+ "%JSON%": typeof JSON === "object" ? JSON : undefined$1,
1234
+ "%Map%": typeof Map === "undefined" ? undefined$1 : Map,
1235
+ "%MapIteratorPrototype%": typeof Map === "undefined" || !hasSymbols2 || !getProto2 ? undefined$1 : getProto2((/* @__PURE__ */ new Map())[Symbol.iterator]()),
1236
+ "%Math%": Math,
1237
+ "%Number%": Number,
1238
+ "%Object%": $Object,
1239
+ "%Object.getOwnPropertyDescriptor%": $gOPD,
1240
+ "%parseFloat%": parseFloat,
1241
+ "%parseInt%": parseInt,
1242
+ "%Promise%": typeof Promise === "undefined" ? undefined$1 : Promise,
1243
+ "%Proxy%": typeof Proxy === "undefined" ? undefined$1 : Proxy,
1244
+ "%RangeError%": $RangeError,
1245
+ "%ReferenceError%": $ReferenceError,
1246
+ "%Reflect%": typeof Reflect === "undefined" ? undefined$1 : Reflect,
1247
+ "%RegExp%": RegExp,
1248
+ "%Set%": typeof Set === "undefined" ? undefined$1 : Set,
1249
+ "%SetIteratorPrototype%": typeof Set === "undefined" || !hasSymbols2 || !getProto2 ? undefined$1 : getProto2((/* @__PURE__ */ new Set())[Symbol.iterator]()),
1250
+ "%SharedArrayBuffer%": typeof SharedArrayBuffer === "undefined" ? undefined$1 : SharedArrayBuffer,
1251
+ "%String%": String,
1252
+ "%StringIteratorPrototype%": hasSymbols2 && getProto2 ? getProto2(""[Symbol.iterator]()) : undefined$1,
1253
+ "%Symbol%": hasSymbols2 ? Symbol : undefined$1,
1254
+ "%SyntaxError%": $SyntaxError,
1255
+ "%ThrowTypeError%": ThrowTypeError,
1256
+ "%TypedArray%": TypedArray,
1257
+ "%TypeError%": $TypeError,
1258
+ "%Uint8Array%": typeof Uint8Array === "undefined" ? undefined$1 : Uint8Array,
1259
+ "%Uint8ClampedArray%": typeof Uint8ClampedArray === "undefined" ? undefined$1 : Uint8ClampedArray,
1260
+ "%Uint16Array%": typeof Uint16Array === "undefined" ? undefined$1 : Uint16Array,
1261
+ "%Uint32Array%": typeof Uint32Array === "undefined" ? undefined$1 : Uint32Array,
1262
+ "%URIError%": $URIError,
1263
+ "%WeakMap%": typeof WeakMap === "undefined" ? undefined$1 : WeakMap,
1264
+ "%WeakRef%": typeof WeakRef === "undefined" ? undefined$1 : WeakRef,
1265
+ "%WeakSet%": typeof WeakSet === "undefined" ? undefined$1 : WeakSet,
1266
+ "%Function.prototype.call%": $call,
1267
+ "%Function.prototype.apply%": $apply,
1268
+ "%Object.defineProperty%": $defineProperty,
1269
+ "%Object.getPrototypeOf%": $ObjectGPO,
1270
+ "%Math.abs%": abs2,
1271
+ "%Math.floor%": floor2,
1272
+ "%Math.max%": max2,
1273
+ "%Math.min%": min2,
1274
+ "%Math.pow%": pow2,
1275
+ "%Math.round%": round2,
1276
+ "%Math.sign%": sign2,
1277
+ "%Reflect.getPrototypeOf%": $ReflectGPO
1278
+ };
1279
+ if (getProto2) {
1280
+ try {
1281
+ null.error;
1282
+ } catch (e) {
1283
+ var errorProto = getProto2(getProto2(e));
1284
+ INTRINSICS["%Error.prototype%"] = errorProto;
1285
+ }
1286
+ }
1287
+ var doEval = function doEval2(name) {
1288
+ var value;
1289
+ if (name === "%AsyncFunction%") {
1290
+ value = getEvalledConstructor("async function () {}");
1291
+ } else if (name === "%GeneratorFunction%") {
1292
+ value = getEvalledConstructor("function* () {}");
1293
+ } else if (name === "%AsyncGeneratorFunction%") {
1294
+ value = getEvalledConstructor("async function* () {}");
1295
+ } else if (name === "%AsyncGenerator%") {
1296
+ var fn = doEval2("%AsyncGeneratorFunction%");
1297
+ if (fn) {
1298
+ value = fn.prototype;
1299
+ }
1300
+ } else if (name === "%AsyncIteratorPrototype%") {
1301
+ var gen = doEval2("%AsyncGenerator%");
1302
+ if (gen && getProto2) {
1303
+ value = getProto2(gen.prototype);
1304
+ }
1305
+ }
1306
+ INTRINSICS[name] = value;
1307
+ return value;
1308
+ };
1309
+ var LEGACY_ALIASES = {
1310
+ __proto__: null,
1311
+ "%ArrayBufferPrototype%": ["ArrayBuffer", "prototype"],
1312
+ "%ArrayPrototype%": ["Array", "prototype"],
1313
+ "%ArrayProto_entries%": ["Array", "prototype", "entries"],
1314
+ "%ArrayProto_forEach%": ["Array", "prototype", "forEach"],
1315
+ "%ArrayProto_keys%": ["Array", "prototype", "keys"],
1316
+ "%ArrayProto_values%": ["Array", "prototype", "values"],
1317
+ "%AsyncFunctionPrototype%": ["AsyncFunction", "prototype"],
1318
+ "%AsyncGenerator%": ["AsyncGeneratorFunction", "prototype"],
1319
+ "%AsyncGeneratorPrototype%": ["AsyncGeneratorFunction", "prototype", "prototype"],
1320
+ "%BooleanPrototype%": ["Boolean", "prototype"],
1321
+ "%DataViewPrototype%": ["DataView", "prototype"],
1322
+ "%DatePrototype%": ["Date", "prototype"],
1323
+ "%ErrorPrototype%": ["Error", "prototype"],
1324
+ "%EvalErrorPrototype%": ["EvalError", "prototype"],
1325
+ "%Float32ArrayPrototype%": ["Float32Array", "prototype"],
1326
+ "%Float64ArrayPrototype%": ["Float64Array", "prototype"],
1327
+ "%FunctionPrototype%": ["Function", "prototype"],
1328
+ "%Generator%": ["GeneratorFunction", "prototype"],
1329
+ "%GeneratorPrototype%": ["GeneratorFunction", "prototype", "prototype"],
1330
+ "%Int8ArrayPrototype%": ["Int8Array", "prototype"],
1331
+ "%Int16ArrayPrototype%": ["Int16Array", "prototype"],
1332
+ "%Int32ArrayPrototype%": ["Int32Array", "prototype"],
1333
+ "%JSONParse%": ["JSON", "parse"],
1334
+ "%JSONStringify%": ["JSON", "stringify"],
1335
+ "%MapPrototype%": ["Map", "prototype"],
1336
+ "%NumberPrototype%": ["Number", "prototype"],
1337
+ "%ObjectPrototype%": ["Object", "prototype"],
1338
+ "%ObjProto_toString%": ["Object", "prototype", "toString"],
1339
+ "%ObjProto_valueOf%": ["Object", "prototype", "valueOf"],
1340
+ "%PromisePrototype%": ["Promise", "prototype"],
1341
+ "%PromiseProto_then%": ["Promise", "prototype", "then"],
1342
+ "%Promise_all%": ["Promise", "all"],
1343
+ "%Promise_reject%": ["Promise", "reject"],
1344
+ "%Promise_resolve%": ["Promise", "resolve"],
1345
+ "%RangeErrorPrototype%": ["RangeError", "prototype"],
1346
+ "%ReferenceErrorPrototype%": ["ReferenceError", "prototype"],
1347
+ "%RegExpPrototype%": ["RegExp", "prototype"],
1348
+ "%SetPrototype%": ["Set", "prototype"],
1349
+ "%SharedArrayBufferPrototype%": ["SharedArrayBuffer", "prototype"],
1350
+ "%StringPrototype%": ["String", "prototype"],
1351
+ "%SymbolPrototype%": ["Symbol", "prototype"],
1352
+ "%SyntaxErrorPrototype%": ["SyntaxError", "prototype"],
1353
+ "%TypedArrayPrototype%": ["TypedArray", "prototype"],
1354
+ "%TypeErrorPrototype%": ["TypeError", "prototype"],
1355
+ "%Uint8ArrayPrototype%": ["Uint8Array", "prototype"],
1356
+ "%Uint8ClampedArrayPrototype%": ["Uint8ClampedArray", "prototype"],
1357
+ "%Uint16ArrayPrototype%": ["Uint16Array", "prototype"],
1358
+ "%Uint32ArrayPrototype%": ["Uint32Array", "prototype"],
1359
+ "%URIErrorPrototype%": ["URIError", "prototype"],
1360
+ "%WeakMapPrototype%": ["WeakMap", "prototype"],
1361
+ "%WeakSetPrototype%": ["WeakSet", "prototype"]
1362
+ };
1363
+ var bind = requireFunctionBind();
1364
+ var hasOwn = /* @__PURE__ */ requireHasown();
1365
+ var $concat = bind.call($call, Array.prototype.concat);
1366
+ var $spliceApply = bind.call($apply, Array.prototype.splice);
1367
+ var $replace = bind.call($call, String.prototype.replace);
1368
+ var $strSlice = bind.call($call, String.prototype.slice);
1369
+ var $exec = bind.call($call, RegExp.prototype.exec);
1370
+ var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
1371
+ var reEscapeChar = /\\(\\)?/g;
1372
+ var stringToPath = function stringToPath2(string) {
1373
+ var first = $strSlice(string, 0, 1);
1374
+ var last = $strSlice(string, -1);
1375
+ if (first === "%" && last !== "%") {
1376
+ throw new $SyntaxError("invalid intrinsic syntax, expected closing `%`");
1377
+ } else if (last === "%" && first !== "%") {
1378
+ throw new $SyntaxError("invalid intrinsic syntax, expected opening `%`");
1379
+ }
1380
+ var result = [];
1381
+ $replace(string, rePropName, function(match, number, quote, subString) {
1382
+ result[result.length] = quote ? $replace(subString, reEscapeChar, "$1") : number || match;
1383
+ });
1384
+ return result;
1385
+ };
1386
+ var getBaseIntrinsic = function getBaseIntrinsic2(name, allowMissing) {
1387
+ var intrinsicName = name;
1388
+ var alias;
1389
+ if (hasOwn(LEGACY_ALIASES, intrinsicName)) {
1390
+ alias = LEGACY_ALIASES[intrinsicName];
1391
+ intrinsicName = "%" + alias[0] + "%";
1392
+ }
1393
+ if (hasOwn(INTRINSICS, intrinsicName)) {
1394
+ var value = INTRINSICS[intrinsicName];
1395
+ if (value === needsEval) {
1396
+ value = doEval(intrinsicName);
1397
+ }
1398
+ if (typeof value === "undefined" && !allowMissing) {
1399
+ throw new $TypeError("intrinsic " + name + " exists, but is not available. Please file an issue!");
1400
+ }
1401
+ return {
1402
+ alias,
1403
+ name: intrinsicName,
1404
+ value
1405
+ };
1406
+ }
1407
+ throw new $SyntaxError("intrinsic " + name + " does not exist!");
1408
+ };
1409
+ getIntrinsic = function GetIntrinsic(name, allowMissing) {
1410
+ if (typeof name !== "string" || name.length === 0) {
1411
+ throw new $TypeError("intrinsic name must be a non-empty string");
1412
+ }
1413
+ if (arguments.length > 1 && typeof allowMissing !== "boolean") {
1414
+ throw new $TypeError('"allowMissing" argument must be a boolean');
1415
+ }
1416
+ if ($exec(/^%?[^%]*%?$/, name) === null) {
1417
+ throw new $SyntaxError("`%` may not be present anywhere but at the beginning and end of the intrinsic name");
1418
+ }
1419
+ var parts = stringToPath(name);
1420
+ var intrinsicBaseName = parts.length > 0 ? parts[0] : "";
1421
+ var intrinsic = getBaseIntrinsic("%" + intrinsicBaseName + "%", allowMissing);
1422
+ var intrinsicRealName = intrinsic.name;
1423
+ var value = intrinsic.value;
1424
+ var skipFurtherCaching = false;
1425
+ var alias = intrinsic.alias;
1426
+ if (alias) {
1427
+ intrinsicBaseName = alias[0];
1428
+ $spliceApply(parts, $concat([0, 1], alias));
1429
+ }
1430
+ for (var i = 1, isOwn = true; i < parts.length; i += 1) {
1431
+ var part = parts[i];
1432
+ var first = $strSlice(part, 0, 1);
1433
+ var last = $strSlice(part, -1);
1434
+ if ((first === '"' || first === "'" || first === "`" || (last === '"' || last === "'" || last === "`")) && first !== last) {
1435
+ throw new $SyntaxError("property names with quotes must have matching quotes");
1436
+ }
1437
+ if (part === "constructor" || !isOwn) {
1438
+ skipFurtherCaching = true;
1439
+ }
1440
+ intrinsicBaseName += "." + part;
1441
+ intrinsicRealName = "%" + intrinsicBaseName + "%";
1442
+ if (hasOwn(INTRINSICS, intrinsicRealName)) {
1443
+ value = INTRINSICS[intrinsicRealName];
1444
+ } else if (value != null) {
1445
+ if (!(part in value)) {
1446
+ if (!allowMissing) {
1447
+ throw new $TypeError("base intrinsic for " + name + " exists, but the property is not available.");
1448
+ }
1449
+ return void 0;
1450
+ }
1451
+ if ($gOPD && i + 1 >= parts.length) {
1452
+ var desc = $gOPD(value, part);
1453
+ isOwn = !!desc;
1454
+ if (isOwn && "get" in desc && !("originalValue" in desc.get)) {
1455
+ value = desc.get;
1456
+ } else {
1457
+ value = value[part];
1458
+ }
1459
+ } else {
1460
+ isOwn = hasOwn(value, part);
1461
+ value = value[part];
1462
+ }
1463
+ if (isOwn && !skipFurtherCaching) {
1464
+ INTRINSICS[intrinsicRealName] = value;
1465
+ }
1466
+ }
1467
+ }
1468
+ return value;
1469
+ };
1470
+ return getIntrinsic;
1471
+ }
1472
+ var callBound;
1473
+ var hasRequiredCallBound;
1474
+ function requireCallBound() {
1475
+ if (hasRequiredCallBound) return callBound;
1476
+ hasRequiredCallBound = 1;
1477
+ var GetIntrinsic = /* @__PURE__ */ requireGetIntrinsic();
1478
+ var callBindBasic = requireCallBindApplyHelpers();
1479
+ var $indexOf = callBindBasic([GetIntrinsic("%String.prototype.indexOf%")]);
1480
+ callBound = function callBoundIntrinsic(name, allowMissing) {
1481
+ var intrinsic = (
1482
+ /** @type {(this: unknown, ...args: unknown[]) => unknown} */
1483
+ GetIntrinsic(name, !!allowMissing)
1484
+ );
1485
+ if (typeof intrinsic === "function" && $indexOf(name, ".prototype.") > -1) {
1486
+ return callBindBasic(
1487
+ /** @type {const} */
1488
+ [intrinsic]
1489
+ );
1490
+ }
1491
+ return intrinsic;
1492
+ };
1493
+ return callBound;
1494
+ }
1495
+ var sideChannelMap;
1496
+ var hasRequiredSideChannelMap;
1497
+ function requireSideChannelMap() {
1498
+ if (hasRequiredSideChannelMap) return sideChannelMap;
1499
+ hasRequiredSideChannelMap = 1;
1500
+ var GetIntrinsic = /* @__PURE__ */ requireGetIntrinsic();
1501
+ var callBound2 = /* @__PURE__ */ requireCallBound();
1502
+ var inspect = /* @__PURE__ */ requireObjectInspect();
1503
+ var $TypeError = /* @__PURE__ */ requireType();
1504
+ var $Map = GetIntrinsic("%Map%", true);
1505
+ var $mapGet = callBound2("Map.prototype.get", true);
1506
+ var $mapSet = callBound2("Map.prototype.set", true);
1507
+ var $mapHas = callBound2("Map.prototype.has", true);
1508
+ var $mapDelete = callBound2("Map.prototype.delete", true);
1509
+ var $mapSize = callBound2("Map.prototype.size", true);
1510
+ sideChannelMap = !!$Map && /** @type {Exclude<import('.'), false>} */
1511
+ function getSideChannelMap() {
1512
+ var $m;
1513
+ var channel = {
1514
+ assert: function(key) {
1515
+ if (!channel.has(key)) {
1516
+ throw new $TypeError("Side channel does not contain " + inspect(key));
1517
+ }
1518
+ },
1519
+ "delete": function(key) {
1520
+ if ($m) {
1521
+ var result = $mapDelete($m, key);
1522
+ if ($mapSize($m) === 0) {
1523
+ $m = void 0;
1524
+ }
1525
+ return result;
1526
+ }
1527
+ return false;
1528
+ },
1529
+ get: function(key) {
1530
+ if ($m) {
1531
+ return $mapGet($m, key);
1532
+ }
1533
+ },
1534
+ has: function(key) {
1535
+ if ($m) {
1536
+ return $mapHas($m, key);
1537
+ }
1538
+ return false;
1539
+ },
1540
+ set: function(key, value) {
1541
+ if (!$m) {
1542
+ $m = new $Map();
1543
+ }
1544
+ $mapSet($m, key, value);
1545
+ }
1546
+ };
1547
+ return channel;
1548
+ };
1549
+ return sideChannelMap;
1550
+ }
1551
+ var sideChannelWeakmap;
1552
+ var hasRequiredSideChannelWeakmap;
1553
+ function requireSideChannelWeakmap() {
1554
+ if (hasRequiredSideChannelWeakmap) return sideChannelWeakmap;
1555
+ hasRequiredSideChannelWeakmap = 1;
1556
+ var GetIntrinsic = /* @__PURE__ */ requireGetIntrinsic();
1557
+ var callBound2 = /* @__PURE__ */ requireCallBound();
1558
+ var inspect = /* @__PURE__ */ requireObjectInspect();
1559
+ var getSideChannelMap = requireSideChannelMap();
1560
+ var $TypeError = /* @__PURE__ */ requireType();
1561
+ var $WeakMap = GetIntrinsic("%WeakMap%", true);
1562
+ var $weakMapGet = callBound2("WeakMap.prototype.get", true);
1563
+ var $weakMapSet = callBound2("WeakMap.prototype.set", true);
1564
+ var $weakMapHas = callBound2("WeakMap.prototype.has", true);
1565
+ var $weakMapDelete = callBound2("WeakMap.prototype.delete", true);
1566
+ sideChannelWeakmap = $WeakMap ? (
1567
+ /** @type {Exclude<import('.'), false>} */
1568
+ function getSideChannelWeakMap() {
1569
+ var $wm;
1570
+ var $m;
1571
+ var channel = {
1572
+ assert: function(key) {
1573
+ if (!channel.has(key)) {
1574
+ throw new $TypeError("Side channel does not contain " + inspect(key));
1575
+ }
1576
+ },
1577
+ "delete": function(key) {
1578
+ if ($WeakMap && key && (typeof key === "object" || typeof key === "function")) {
1579
+ if ($wm) {
1580
+ return $weakMapDelete($wm, key);
1581
+ }
1582
+ } else if (getSideChannelMap) {
1583
+ if ($m) {
1584
+ return $m["delete"](key);
1585
+ }
1586
+ }
1587
+ return false;
1588
+ },
1589
+ get: function(key) {
1590
+ if ($WeakMap && key && (typeof key === "object" || typeof key === "function")) {
1591
+ if ($wm) {
1592
+ return $weakMapGet($wm, key);
1593
+ }
1594
+ }
1595
+ return $m && $m.get(key);
1596
+ },
1597
+ has: function(key) {
1598
+ if ($WeakMap && key && (typeof key === "object" || typeof key === "function")) {
1599
+ if ($wm) {
1600
+ return $weakMapHas($wm, key);
1601
+ }
1602
+ }
1603
+ return !!$m && $m.has(key);
1604
+ },
1605
+ set: function(key, value) {
1606
+ if ($WeakMap && key && (typeof key === "object" || typeof key === "function")) {
1607
+ if (!$wm) {
1608
+ $wm = new $WeakMap();
1609
+ }
1610
+ $weakMapSet($wm, key, value);
1611
+ } else if (getSideChannelMap) {
1612
+ if (!$m) {
1613
+ $m = getSideChannelMap();
1614
+ }
1615
+ $m.set(key, value);
1616
+ }
1617
+ }
1618
+ };
1619
+ return channel;
1620
+ }
1621
+ ) : getSideChannelMap;
1622
+ return sideChannelWeakmap;
1623
+ }
1624
+ var sideChannel;
1625
+ var hasRequiredSideChannel;
1626
+ function requireSideChannel() {
1627
+ if (hasRequiredSideChannel) return sideChannel;
1628
+ hasRequiredSideChannel = 1;
1629
+ var $TypeError = /* @__PURE__ */ requireType();
1630
+ var inspect = /* @__PURE__ */ requireObjectInspect();
1631
+ var getSideChannelList = requireSideChannelList();
1632
+ var getSideChannelMap = requireSideChannelMap();
1633
+ var getSideChannelWeakMap = requireSideChannelWeakmap();
1634
+ var makeChannel = getSideChannelWeakMap || getSideChannelMap || getSideChannelList;
1635
+ sideChannel = function getSideChannel() {
1636
+ var $channelData;
1637
+ var channel = {
1638
+ assert: function(key) {
1639
+ if (!channel.has(key)) {
1640
+ throw new $TypeError("Side channel does not contain " + inspect(key));
1641
+ }
1642
+ },
1643
+ "delete": function(key) {
1644
+ return !!$channelData && $channelData["delete"](key);
1645
+ },
1646
+ get: function(key) {
1647
+ return $channelData && $channelData.get(key);
1648
+ },
1649
+ has: function(key) {
1650
+ return !!$channelData && $channelData.has(key);
1651
+ },
1652
+ set: function(key, value) {
1653
+ if (!$channelData) {
1654
+ $channelData = makeChannel();
1655
+ }
1656
+ $channelData.set(key, value);
1657
+ }
1658
+ };
1659
+ return channel;
1660
+ };
1661
+ return sideChannel;
1662
+ }
1663
+ var formats;
1664
+ var hasRequiredFormats;
1665
+ function requireFormats() {
1666
+ if (hasRequiredFormats) return formats;
1667
+ hasRequiredFormats = 1;
1668
+ var replace = String.prototype.replace;
1669
+ var percentTwenties = /%20/g;
1670
+ var Format = {
1671
+ RFC1738: "RFC1738",
1672
+ RFC3986: "RFC3986"
1673
+ };
1674
+ formats = {
1675
+ "default": Format.RFC3986,
1676
+ formatters: {
1677
+ RFC1738: function(value) {
1678
+ return replace.call(value, percentTwenties, "+");
1679
+ },
1680
+ RFC3986: function(value) {
1681
+ return String(value);
1682
+ }
1683
+ },
1684
+ RFC1738: Format.RFC1738,
1685
+ RFC3986: Format.RFC3986
1686
+ };
1687
+ return formats;
1688
+ }
1689
+ var utils;
1690
+ var hasRequiredUtils;
1691
+ function requireUtils() {
1692
+ if (hasRequiredUtils) return utils;
1693
+ hasRequiredUtils = 1;
1694
+ var formats2 = /* @__PURE__ */ requireFormats();
1695
+ var has = Object.prototype.hasOwnProperty;
1696
+ var isArray = Array.isArray;
1697
+ var hexTable = function() {
1698
+ var array = [];
1699
+ for (var i = 0; i < 256; ++i) {
1700
+ array.push("%" + ((i < 16 ? "0" : "") + i.toString(16)).toUpperCase());
1701
+ }
1702
+ return array;
1703
+ }();
1704
+ var compactQueue = function compactQueue2(queue) {
1705
+ while (queue.length > 1) {
1706
+ var item = queue.pop();
1707
+ var obj = item.obj[item.prop];
1708
+ if (isArray(obj)) {
1709
+ var compacted = [];
1710
+ for (var j = 0; j < obj.length; ++j) {
1711
+ if (typeof obj[j] !== "undefined") {
1712
+ compacted.push(obj[j]);
1713
+ }
1714
+ }
1715
+ item.obj[item.prop] = compacted;
1716
+ }
1717
+ }
1718
+ };
1719
+ var arrayToObject = function arrayToObject2(source, options) {
1720
+ var obj = options && options.plainObjects ? { __proto__: null } : {};
1721
+ for (var i = 0; i < source.length; ++i) {
1722
+ if (typeof source[i] !== "undefined") {
1723
+ obj[i] = source[i];
1724
+ }
1725
+ }
1726
+ return obj;
1727
+ };
1728
+ var merge = function merge2(target, source, options) {
1729
+ if (!source) {
1730
+ return target;
1731
+ }
1732
+ if (typeof source !== "object" && typeof source !== "function") {
1733
+ if (isArray(target)) {
1734
+ target.push(source);
1735
+ } else if (target && typeof target === "object") {
1736
+ if (options && (options.plainObjects || options.allowPrototypes) || !has.call(Object.prototype, source)) {
1737
+ target[source] = true;
1738
+ }
1739
+ } else {
1740
+ return [target, source];
1741
+ }
1742
+ return target;
1743
+ }
1744
+ if (!target || typeof target !== "object") {
1745
+ return [target].concat(source);
1746
+ }
1747
+ var mergeTarget = target;
1748
+ if (isArray(target) && !isArray(source)) {
1749
+ mergeTarget = arrayToObject(target, options);
1750
+ }
1751
+ if (isArray(target) && isArray(source)) {
1752
+ source.forEach(function(item, i) {
1753
+ if (has.call(target, i)) {
1754
+ var targetItem = target[i];
1755
+ if (targetItem && typeof targetItem === "object" && item && typeof item === "object") {
1756
+ target[i] = merge2(targetItem, item, options);
1757
+ } else {
1758
+ target.push(item);
1759
+ }
1760
+ } else {
1761
+ target[i] = item;
1762
+ }
1763
+ });
1764
+ return target;
1765
+ }
1766
+ return Object.keys(source).reduce(function(acc, key) {
1767
+ var value = source[key];
1768
+ if (has.call(acc, key)) {
1769
+ acc[key] = merge2(acc[key], value, options);
1770
+ } else {
1771
+ acc[key] = value;
1772
+ }
1773
+ return acc;
1774
+ }, mergeTarget);
1775
+ };
1776
+ var assign = function assignSingleSource(target, source) {
1777
+ return Object.keys(source).reduce(function(acc, key) {
1778
+ acc[key] = source[key];
1779
+ return acc;
1780
+ }, target);
1781
+ };
1782
+ var decode = function(str, defaultDecoder, charset) {
1783
+ var strWithoutPlus = str.replace(/\+/g, " ");
1784
+ if (charset === "iso-8859-1") {
1785
+ return strWithoutPlus.replace(/%[0-9a-f]{2}/gi, unescape);
1786
+ }
1787
+ try {
1788
+ return decodeURIComponent(strWithoutPlus);
1789
+ } catch (e) {
1790
+ return strWithoutPlus;
1791
+ }
1792
+ };
1793
+ var limit = 1024;
1794
+ var encode = function encode2(str, defaultEncoder, charset, kind, format) {
1795
+ if (str.length === 0) {
1796
+ return str;
1797
+ }
1798
+ var string = str;
1799
+ if (typeof str === "symbol") {
1800
+ string = Symbol.prototype.toString.call(str);
1801
+ } else if (typeof str !== "string") {
1802
+ string = String(str);
1803
+ }
1804
+ if (charset === "iso-8859-1") {
1805
+ return escape(string).replace(/%u[0-9a-f]{4}/gi, function($0) {
1806
+ return "%26%23" + parseInt($0.slice(2), 16) + "%3B";
1807
+ });
1808
+ }
1809
+ var out = "";
1810
+ for (var j = 0; j < string.length; j += limit) {
1811
+ var segment = string.length >= limit ? string.slice(j, j + limit) : string;
1812
+ var arr = [];
1813
+ for (var i = 0; i < segment.length; ++i) {
1814
+ var c = segment.charCodeAt(i);
1815
+ if (c === 45 || c === 46 || c === 95 || c === 126 || c >= 48 && c <= 57 || c >= 65 && c <= 90 || c >= 97 && c <= 122 || format === formats2.RFC1738 && (c === 40 || c === 41)) {
1816
+ arr[arr.length] = segment.charAt(i);
1817
+ continue;
1818
+ }
1819
+ if (c < 128) {
1820
+ arr[arr.length] = hexTable[c];
1821
+ continue;
1822
+ }
1823
+ if (c < 2048) {
1824
+ arr[arr.length] = hexTable[192 | c >> 6] + hexTable[128 | c & 63];
1825
+ continue;
1826
+ }
1827
+ if (c < 55296 || c >= 57344) {
1828
+ arr[arr.length] = hexTable[224 | c >> 12] + hexTable[128 | c >> 6 & 63] + hexTable[128 | c & 63];
1829
+ continue;
1830
+ }
1831
+ i += 1;
1832
+ c = 65536 + ((c & 1023) << 10 | segment.charCodeAt(i) & 1023);
1833
+ arr[arr.length] = hexTable[240 | c >> 18] + hexTable[128 | c >> 12 & 63] + hexTable[128 | c >> 6 & 63] + hexTable[128 | c & 63];
1834
+ }
1835
+ out += arr.join("");
1836
+ }
1837
+ return out;
1838
+ };
1839
+ var compact = function compact2(value) {
1840
+ var queue = [{ obj: { o: value }, prop: "o" }];
1841
+ var refs = [];
1842
+ for (var i = 0; i < queue.length; ++i) {
1843
+ var item = queue[i];
1844
+ var obj = item.obj[item.prop];
1845
+ var keys = Object.keys(obj);
1846
+ for (var j = 0; j < keys.length; ++j) {
1847
+ var key = keys[j];
1848
+ var val = obj[key];
1849
+ if (typeof val === "object" && val !== null && refs.indexOf(val) === -1) {
1850
+ queue.push({ obj, prop: key });
1851
+ refs.push(val);
1852
+ }
1853
+ }
1854
+ }
1855
+ compactQueue(queue);
1856
+ return value;
1857
+ };
1858
+ var isRegExp = function isRegExp2(obj) {
1859
+ return Object.prototype.toString.call(obj) === "[object RegExp]";
1860
+ };
1861
+ var isBuffer = function isBuffer2(obj) {
1862
+ if (!obj || typeof obj !== "object") {
1863
+ return false;
1864
+ }
1865
+ return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj));
1866
+ };
1867
+ var combine = function combine2(a, b) {
1868
+ return [].concat(a, b);
1869
+ };
1870
+ var maybeMap = function maybeMap2(val, fn) {
1871
+ if (isArray(val)) {
1872
+ var mapped = [];
1873
+ for (var i = 0; i < val.length; i += 1) {
1874
+ mapped.push(fn(val[i]));
1875
+ }
1876
+ return mapped;
1877
+ }
1878
+ return fn(val);
1879
+ };
1880
+ utils = {
1881
+ arrayToObject,
1882
+ assign,
1883
+ combine,
1884
+ compact,
1885
+ decode,
1886
+ encode,
1887
+ isBuffer,
1888
+ isRegExp,
1889
+ maybeMap,
1890
+ merge
1891
+ };
1892
+ return utils;
1893
+ }
1894
+ var stringify_1;
1895
+ var hasRequiredStringify;
1896
+ function requireStringify() {
1897
+ if (hasRequiredStringify) return stringify_1;
1898
+ hasRequiredStringify = 1;
1899
+ var getSideChannel = requireSideChannel();
1900
+ var utils2 = /* @__PURE__ */ requireUtils();
1901
+ var formats2 = /* @__PURE__ */ requireFormats();
1902
+ var has = Object.prototype.hasOwnProperty;
1903
+ var arrayPrefixGenerators = {
1904
+ brackets: function brackets(prefix) {
1905
+ return prefix + "[]";
1906
+ },
1907
+ comma: "comma",
1908
+ indices: function indices(prefix, key) {
1909
+ return prefix + "[" + key + "]";
1910
+ },
1911
+ repeat: function repeat(prefix) {
1912
+ return prefix;
1913
+ }
1914
+ };
1915
+ var isArray = Array.isArray;
1916
+ var push = Array.prototype.push;
1917
+ var pushToArray = function(arr, valueOrArray) {
1918
+ push.apply(arr, isArray(valueOrArray) ? valueOrArray : [valueOrArray]);
1919
+ };
1920
+ var toISO = Date.prototype.toISOString;
1921
+ var defaultFormat = formats2["default"];
1922
+ var defaults = {
1923
+ addQueryPrefix: false,
1924
+ allowDots: false,
1925
+ allowEmptyArrays: false,
1926
+ arrayFormat: "indices",
1927
+ charset: "utf-8",
1928
+ charsetSentinel: false,
1929
+ commaRoundTrip: false,
1930
+ delimiter: "&",
1931
+ encode: true,
1932
+ encodeDotInKeys: false,
1933
+ encoder: utils2.encode,
1934
+ encodeValuesOnly: false,
1935
+ filter: void 0,
1936
+ format: defaultFormat,
1937
+ formatter: formats2.formatters[defaultFormat],
1938
+ // deprecated
1939
+ indices: false,
1940
+ serializeDate: function serializeDate(date) {
1941
+ return toISO.call(date);
1942
+ },
1943
+ skipNulls: false,
1944
+ strictNullHandling: false
1945
+ };
1946
+ var isNonNullishPrimitive = function isNonNullishPrimitive2(v) {
1947
+ return typeof v === "string" || typeof v === "number" || typeof v === "boolean" || typeof v === "symbol" || typeof v === "bigint";
1948
+ };
1949
+ var sentinel = {};
1950
+ var stringify = function stringify2(object, prefix, generateArrayPrefix, commaRoundTrip, allowEmptyArrays, strictNullHandling, skipNulls, encodeDotInKeys, encoder, filter, sort, allowDots, serializeDate, format, formatter, encodeValuesOnly, charset, sideChannel2) {
1951
+ var obj = object;
1952
+ var tmpSc = sideChannel2;
1953
+ var step = 0;
1954
+ var findFlag = false;
1955
+ while ((tmpSc = tmpSc.get(sentinel)) !== void 0 && !findFlag) {
1956
+ var pos = tmpSc.get(object);
1957
+ step += 1;
1958
+ if (typeof pos !== "undefined") {
1959
+ if (pos === step) {
1960
+ throw new RangeError("Cyclic object value");
1961
+ } else {
1962
+ findFlag = true;
1963
+ }
1964
+ }
1965
+ if (typeof tmpSc.get(sentinel) === "undefined") {
1966
+ step = 0;
1967
+ }
1968
+ }
1969
+ if (typeof filter === "function") {
1970
+ obj = filter(prefix, obj);
1971
+ } else if (obj instanceof Date) {
1972
+ obj = serializeDate(obj);
1973
+ } else if (generateArrayPrefix === "comma" && isArray(obj)) {
1974
+ obj = utils2.maybeMap(obj, function(value2) {
1975
+ if (value2 instanceof Date) {
1976
+ return serializeDate(value2);
1977
+ }
1978
+ return value2;
1979
+ });
1980
+ }
1981
+ if (obj === null) {
1982
+ if (strictNullHandling) {
1983
+ return encoder && !encodeValuesOnly ? encoder(prefix, defaults.encoder, charset, "key", format) : prefix;
1984
+ }
1985
+ obj = "";
1986
+ }
1987
+ if (isNonNullishPrimitive(obj) || utils2.isBuffer(obj)) {
1988
+ if (encoder) {
1989
+ var keyValue = encodeValuesOnly ? prefix : encoder(prefix, defaults.encoder, charset, "key", format);
1990
+ return [formatter(keyValue) + "=" + formatter(encoder(obj, defaults.encoder, charset, "value", format))];
1991
+ }
1992
+ return [formatter(prefix) + "=" + formatter(String(obj))];
1993
+ }
1994
+ var values = [];
1995
+ if (typeof obj === "undefined") {
1996
+ return values;
1997
+ }
1998
+ var objKeys;
1999
+ if (generateArrayPrefix === "comma" && isArray(obj)) {
2000
+ if (encodeValuesOnly && encoder) {
2001
+ obj = utils2.maybeMap(obj, encoder);
2002
+ }
2003
+ objKeys = [{ value: obj.length > 0 ? obj.join(",") || null : void 0 }];
2004
+ } else if (isArray(filter)) {
2005
+ objKeys = filter;
2006
+ } else {
2007
+ var keys = Object.keys(obj);
2008
+ objKeys = sort ? keys.sort(sort) : keys;
2009
+ }
2010
+ var encodedPrefix = encodeDotInKeys ? String(prefix).replace(/\./g, "%2E") : String(prefix);
2011
+ var adjustedPrefix = commaRoundTrip && isArray(obj) && obj.length === 1 ? encodedPrefix + "[]" : encodedPrefix;
2012
+ if (allowEmptyArrays && isArray(obj) && obj.length === 0) {
2013
+ return adjustedPrefix + "[]";
2014
+ }
2015
+ for (var j = 0; j < objKeys.length; ++j) {
2016
+ var key = objKeys[j];
2017
+ var value = typeof key === "object" && key && typeof key.value !== "undefined" ? key.value : obj[key];
2018
+ if (skipNulls && value === null) {
2019
+ continue;
2020
+ }
2021
+ var encodedKey = allowDots && encodeDotInKeys ? String(key).replace(/\./g, "%2E") : String(key);
2022
+ var keyPrefix = isArray(obj) ? typeof generateArrayPrefix === "function" ? generateArrayPrefix(adjustedPrefix, encodedKey) : adjustedPrefix : adjustedPrefix + (allowDots ? "." + encodedKey : "[" + encodedKey + "]");
2023
+ sideChannel2.set(object, step);
2024
+ var valueSideChannel = getSideChannel();
2025
+ valueSideChannel.set(sentinel, sideChannel2);
2026
+ pushToArray(values, stringify2(
2027
+ value,
2028
+ keyPrefix,
2029
+ generateArrayPrefix,
2030
+ commaRoundTrip,
2031
+ allowEmptyArrays,
2032
+ strictNullHandling,
2033
+ skipNulls,
2034
+ encodeDotInKeys,
2035
+ generateArrayPrefix === "comma" && encodeValuesOnly && isArray(obj) ? null : encoder,
2036
+ filter,
2037
+ sort,
2038
+ allowDots,
2039
+ serializeDate,
2040
+ format,
2041
+ formatter,
2042
+ encodeValuesOnly,
2043
+ charset,
2044
+ valueSideChannel
2045
+ ));
2046
+ }
2047
+ return values;
2048
+ };
2049
+ var normalizeStringifyOptions = function normalizeStringifyOptions2(opts) {
2050
+ if (!opts) {
2051
+ return defaults;
2052
+ }
2053
+ if (typeof opts.allowEmptyArrays !== "undefined" && typeof opts.allowEmptyArrays !== "boolean") {
2054
+ throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");
2055
+ }
2056
+ if (typeof opts.encodeDotInKeys !== "undefined" && typeof opts.encodeDotInKeys !== "boolean") {
2057
+ throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");
2058
+ }
2059
+ if (opts.encoder !== null && typeof opts.encoder !== "undefined" && typeof opts.encoder !== "function") {
2060
+ throw new TypeError("Encoder has to be a function.");
2061
+ }
2062
+ var charset = opts.charset || defaults.charset;
2063
+ if (typeof opts.charset !== "undefined" && opts.charset !== "utf-8" && opts.charset !== "iso-8859-1") {
2064
+ throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");
2065
+ }
2066
+ var format = formats2["default"];
2067
+ if (typeof opts.format !== "undefined") {
2068
+ if (!has.call(formats2.formatters, opts.format)) {
2069
+ throw new TypeError("Unknown format option provided.");
2070
+ }
2071
+ format = opts.format;
2072
+ }
2073
+ var formatter = formats2.formatters[format];
2074
+ var filter = defaults.filter;
2075
+ if (typeof opts.filter === "function" || isArray(opts.filter)) {
2076
+ filter = opts.filter;
2077
+ }
2078
+ var arrayFormat;
2079
+ if (opts.arrayFormat in arrayPrefixGenerators) {
2080
+ arrayFormat = opts.arrayFormat;
2081
+ } else if ("indices" in opts) {
2082
+ arrayFormat = opts.indices ? "indices" : "repeat";
2083
+ } else {
2084
+ arrayFormat = defaults.arrayFormat;
2085
+ }
2086
+ if ("commaRoundTrip" in opts && typeof opts.commaRoundTrip !== "boolean") {
2087
+ throw new TypeError("`commaRoundTrip` must be a boolean, or absent");
2088
+ }
2089
+ var allowDots = typeof opts.allowDots === "undefined" ? opts.encodeDotInKeys === true ? true : defaults.allowDots : !!opts.allowDots;
2090
+ return {
2091
+ addQueryPrefix: typeof opts.addQueryPrefix === "boolean" ? opts.addQueryPrefix : defaults.addQueryPrefix,
2092
+ allowDots,
2093
+ allowEmptyArrays: typeof opts.allowEmptyArrays === "boolean" ? !!opts.allowEmptyArrays : defaults.allowEmptyArrays,
2094
+ arrayFormat,
2095
+ charset,
2096
+ charsetSentinel: typeof opts.charsetSentinel === "boolean" ? opts.charsetSentinel : defaults.charsetSentinel,
2097
+ commaRoundTrip: !!opts.commaRoundTrip,
2098
+ delimiter: typeof opts.delimiter === "undefined" ? defaults.delimiter : opts.delimiter,
2099
+ encode: typeof opts.encode === "boolean" ? opts.encode : defaults.encode,
2100
+ encodeDotInKeys: typeof opts.encodeDotInKeys === "boolean" ? opts.encodeDotInKeys : defaults.encodeDotInKeys,
2101
+ encoder: typeof opts.encoder === "function" ? opts.encoder : defaults.encoder,
2102
+ encodeValuesOnly: typeof opts.encodeValuesOnly === "boolean" ? opts.encodeValuesOnly : defaults.encodeValuesOnly,
2103
+ filter,
2104
+ format,
2105
+ formatter,
2106
+ serializeDate: typeof opts.serializeDate === "function" ? opts.serializeDate : defaults.serializeDate,
2107
+ skipNulls: typeof opts.skipNulls === "boolean" ? opts.skipNulls : defaults.skipNulls,
2108
+ sort: typeof opts.sort === "function" ? opts.sort : null,
2109
+ strictNullHandling: typeof opts.strictNullHandling === "boolean" ? opts.strictNullHandling : defaults.strictNullHandling
2110
+ };
2111
+ };
2112
+ stringify_1 = function(object, opts) {
2113
+ var obj = object;
2114
+ var options = normalizeStringifyOptions(opts);
2115
+ var objKeys;
2116
+ var filter;
2117
+ if (typeof options.filter === "function") {
2118
+ filter = options.filter;
2119
+ obj = filter("", obj);
2120
+ } else if (isArray(options.filter)) {
2121
+ filter = options.filter;
2122
+ objKeys = filter;
2123
+ }
2124
+ var keys = [];
2125
+ if (typeof obj !== "object" || obj === null) {
2126
+ return "";
2127
+ }
2128
+ var generateArrayPrefix = arrayPrefixGenerators[options.arrayFormat];
2129
+ var commaRoundTrip = generateArrayPrefix === "comma" && options.commaRoundTrip;
2130
+ if (!objKeys) {
2131
+ objKeys = Object.keys(obj);
2132
+ }
2133
+ if (options.sort) {
2134
+ objKeys.sort(options.sort);
2135
+ }
2136
+ var sideChannel2 = getSideChannel();
2137
+ for (var i = 0; i < objKeys.length; ++i) {
2138
+ var key = objKeys[i];
2139
+ var value = obj[key];
2140
+ if (options.skipNulls && value === null) {
2141
+ continue;
2142
+ }
2143
+ pushToArray(keys, stringify(
2144
+ value,
2145
+ key,
2146
+ generateArrayPrefix,
2147
+ commaRoundTrip,
2148
+ options.allowEmptyArrays,
2149
+ options.strictNullHandling,
2150
+ options.skipNulls,
2151
+ options.encodeDotInKeys,
2152
+ options.encode ? options.encoder : null,
2153
+ options.filter,
2154
+ options.sort,
2155
+ options.allowDots,
2156
+ options.serializeDate,
2157
+ options.format,
2158
+ options.formatter,
2159
+ options.encodeValuesOnly,
2160
+ options.charset,
2161
+ sideChannel2
2162
+ ));
2163
+ }
2164
+ var joined = keys.join(options.delimiter);
2165
+ var prefix = options.addQueryPrefix === true ? "?" : "";
2166
+ if (options.charsetSentinel) {
2167
+ if (options.charset === "iso-8859-1") {
2168
+ prefix += "utf8=%26%2310003%3B&";
2169
+ } else {
2170
+ prefix += "utf8=%E2%9C%93&";
2171
+ }
2172
+ }
2173
+ return joined.length > 0 ? prefix + joined : "";
2174
+ };
2175
+ return stringify_1;
2176
+ }
2177
+ var parse;
2178
+ var hasRequiredParse;
2179
+ function requireParse() {
2180
+ if (hasRequiredParse) return parse;
2181
+ hasRequiredParse = 1;
2182
+ var utils2 = /* @__PURE__ */ requireUtils();
2183
+ var has = Object.prototype.hasOwnProperty;
2184
+ var isArray = Array.isArray;
2185
+ var defaults = {
2186
+ allowDots: false,
2187
+ allowEmptyArrays: false,
2188
+ allowPrototypes: false,
2189
+ allowSparse: false,
2190
+ arrayLimit: 20,
2191
+ charset: "utf-8",
2192
+ charsetSentinel: false,
2193
+ comma: false,
2194
+ decodeDotInKeys: false,
2195
+ decoder: utils2.decode,
2196
+ delimiter: "&",
2197
+ depth: 5,
2198
+ duplicates: "combine",
2199
+ ignoreQueryPrefix: false,
2200
+ interpretNumericEntities: false,
2201
+ parameterLimit: 1e3,
2202
+ parseArrays: true,
2203
+ plainObjects: false,
2204
+ strictDepth: false,
2205
+ strictNullHandling: false,
2206
+ throwOnLimitExceeded: false
2207
+ };
2208
+ var interpretNumericEntities = function(str) {
2209
+ return str.replace(/&#(\d+);/g, function($0, numberStr) {
2210
+ return String.fromCharCode(parseInt(numberStr, 10));
2211
+ });
2212
+ };
2213
+ var parseArrayValue = function(val, options, currentArrayLength) {
2214
+ if (val && typeof val === "string" && options.comma && val.indexOf(",") > -1) {
2215
+ return val.split(",");
2216
+ }
2217
+ if (options.throwOnLimitExceeded && currentArrayLength >= options.arrayLimit) {
2218
+ throw new RangeError("Array limit exceeded. Only " + options.arrayLimit + " element" + (options.arrayLimit === 1 ? "" : "s") + " allowed in an array.");
2219
+ }
2220
+ return val;
2221
+ };
2222
+ var isoSentinel = "utf8=%26%2310003%3B";
2223
+ var charsetSentinel = "utf8=%E2%9C%93";
2224
+ var parseValues = function parseQueryStringValues(str, options) {
2225
+ var obj = { __proto__: null };
2226
+ var cleanStr = options.ignoreQueryPrefix ? str.replace(/^\?/, "") : str;
2227
+ cleanStr = cleanStr.replace(/%5B/gi, "[").replace(/%5D/gi, "]");
2228
+ var limit = options.parameterLimit === Infinity ? void 0 : options.parameterLimit;
2229
+ var parts = cleanStr.split(
2230
+ options.delimiter,
2231
+ options.throwOnLimitExceeded ? limit + 1 : limit
2232
+ );
2233
+ if (options.throwOnLimitExceeded && parts.length > limit) {
2234
+ throw new RangeError("Parameter limit exceeded. Only " + limit + " parameter" + (limit === 1 ? "" : "s") + " allowed.");
2235
+ }
2236
+ var skipIndex = -1;
2237
+ var i;
2238
+ var charset = options.charset;
2239
+ if (options.charsetSentinel) {
2240
+ for (i = 0; i < parts.length; ++i) {
2241
+ if (parts[i].indexOf("utf8=") === 0) {
2242
+ if (parts[i] === charsetSentinel) {
2243
+ charset = "utf-8";
2244
+ } else if (parts[i] === isoSentinel) {
2245
+ charset = "iso-8859-1";
2246
+ }
2247
+ skipIndex = i;
2248
+ i = parts.length;
2249
+ }
2250
+ }
2251
+ }
2252
+ for (i = 0; i < parts.length; ++i) {
2253
+ if (i === skipIndex) {
2254
+ continue;
2255
+ }
2256
+ var part = parts[i];
2257
+ var bracketEqualsPos = part.indexOf("]=");
2258
+ var pos = bracketEqualsPos === -1 ? part.indexOf("=") : bracketEqualsPos + 1;
2259
+ var key;
2260
+ var val;
2261
+ if (pos === -1) {
2262
+ key = options.decoder(part, defaults.decoder, charset, "key");
2263
+ val = options.strictNullHandling ? null : "";
2264
+ } else {
2265
+ key = options.decoder(part.slice(0, pos), defaults.decoder, charset, "key");
2266
+ val = utils2.maybeMap(
2267
+ parseArrayValue(
2268
+ part.slice(pos + 1),
2269
+ options,
2270
+ isArray(obj[key]) ? obj[key].length : 0
2271
+ ),
2272
+ function(encodedVal) {
2273
+ return options.decoder(encodedVal, defaults.decoder, charset, "value");
2274
+ }
2275
+ );
2276
+ }
2277
+ if (val && options.interpretNumericEntities && charset === "iso-8859-1") {
2278
+ val = interpretNumericEntities(String(val));
2279
+ }
2280
+ if (part.indexOf("[]=") > -1) {
2281
+ val = isArray(val) ? [val] : val;
2282
+ }
2283
+ var existing = has.call(obj, key);
2284
+ if (existing && options.duplicates === "combine") {
2285
+ obj[key] = utils2.combine(obj[key], val);
2286
+ } else if (!existing || options.duplicates === "last") {
2287
+ obj[key] = val;
2288
+ }
2289
+ }
2290
+ return obj;
2291
+ };
2292
+ var parseObject = function(chain, val, options, valuesParsed) {
2293
+ var currentArrayLength = 0;
2294
+ if (chain.length > 0 && chain[chain.length - 1] === "[]") {
2295
+ var parentKey = chain.slice(0, -1).join("");
2296
+ currentArrayLength = Array.isArray(val) && val[parentKey] ? val[parentKey].length : 0;
2297
+ }
2298
+ var leaf = valuesParsed ? val : parseArrayValue(val, options, currentArrayLength);
2299
+ for (var i = chain.length - 1; i >= 0; --i) {
2300
+ var obj;
2301
+ var root = chain[i];
2302
+ if (root === "[]" && options.parseArrays) {
2303
+ obj = options.allowEmptyArrays && (leaf === "" || options.strictNullHandling && leaf === null) ? [] : utils2.combine([], leaf);
2304
+ } else {
2305
+ obj = options.plainObjects ? { __proto__: null } : {};
2306
+ var cleanRoot = root.charAt(0) === "[" && root.charAt(root.length - 1) === "]" ? root.slice(1, -1) : root;
2307
+ var decodedRoot = options.decodeDotInKeys ? cleanRoot.replace(/%2E/g, ".") : cleanRoot;
2308
+ var index = parseInt(decodedRoot, 10);
2309
+ if (!options.parseArrays && decodedRoot === "") {
2310
+ obj = { 0: leaf };
2311
+ } else if (!isNaN(index) && root !== decodedRoot && String(index) === decodedRoot && index >= 0 && (options.parseArrays && index <= options.arrayLimit)) {
2312
+ obj = [];
2313
+ obj[index] = leaf;
2314
+ } else if (decodedRoot !== "__proto__") {
2315
+ obj[decodedRoot] = leaf;
2316
+ }
2317
+ }
2318
+ leaf = obj;
2319
+ }
2320
+ return leaf;
2321
+ };
2322
+ var parseKeys = function parseQueryStringKeys(givenKey, val, options, valuesParsed) {
2323
+ if (!givenKey) {
2324
+ return;
2325
+ }
2326
+ var key = options.allowDots ? givenKey.replace(/\.([^.[]+)/g, "[$1]") : givenKey;
2327
+ var brackets = /(\[[^[\]]*])/;
2328
+ var child = /(\[[^[\]]*])/g;
2329
+ var segment = options.depth > 0 && brackets.exec(key);
2330
+ var parent = segment ? key.slice(0, segment.index) : key;
2331
+ var keys = [];
2332
+ if (parent) {
2333
+ if (!options.plainObjects && has.call(Object.prototype, parent)) {
2334
+ if (!options.allowPrototypes) {
2335
+ return;
2336
+ }
2337
+ }
2338
+ keys.push(parent);
2339
+ }
2340
+ var i = 0;
2341
+ while (options.depth > 0 && (segment = child.exec(key)) !== null && i < options.depth) {
2342
+ i += 1;
2343
+ if (!options.plainObjects && has.call(Object.prototype, segment[1].slice(1, -1))) {
2344
+ if (!options.allowPrototypes) {
2345
+ return;
2346
+ }
2347
+ }
2348
+ keys.push(segment[1]);
2349
+ }
2350
+ if (segment) {
2351
+ if (options.strictDepth === true) {
2352
+ throw new RangeError("Input depth exceeded depth option of " + options.depth + " and strictDepth is true");
2353
+ }
2354
+ keys.push("[" + key.slice(segment.index) + "]");
2355
+ }
2356
+ return parseObject(keys, val, options, valuesParsed);
2357
+ };
2358
+ var normalizeParseOptions = function normalizeParseOptions2(opts) {
2359
+ if (!opts) {
2360
+ return defaults;
2361
+ }
2362
+ if (typeof opts.allowEmptyArrays !== "undefined" && typeof opts.allowEmptyArrays !== "boolean") {
2363
+ throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");
2364
+ }
2365
+ if (typeof opts.decodeDotInKeys !== "undefined" && typeof opts.decodeDotInKeys !== "boolean") {
2366
+ throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");
2367
+ }
2368
+ if (opts.decoder !== null && typeof opts.decoder !== "undefined" && typeof opts.decoder !== "function") {
2369
+ throw new TypeError("Decoder has to be a function.");
2370
+ }
2371
+ if (typeof opts.charset !== "undefined" && opts.charset !== "utf-8" && opts.charset !== "iso-8859-1") {
2372
+ throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");
2373
+ }
2374
+ if (typeof opts.throwOnLimitExceeded !== "undefined" && typeof opts.throwOnLimitExceeded !== "boolean") {
2375
+ throw new TypeError("`throwOnLimitExceeded` option must be a boolean");
2376
+ }
2377
+ var charset = typeof opts.charset === "undefined" ? defaults.charset : opts.charset;
2378
+ var duplicates = typeof opts.duplicates === "undefined" ? defaults.duplicates : opts.duplicates;
2379
+ if (duplicates !== "combine" && duplicates !== "first" && duplicates !== "last") {
2380
+ throw new TypeError("The duplicates option must be either combine, first, or last");
2381
+ }
2382
+ var allowDots = typeof opts.allowDots === "undefined" ? opts.decodeDotInKeys === true ? true : defaults.allowDots : !!opts.allowDots;
2383
+ return {
2384
+ allowDots,
2385
+ allowEmptyArrays: typeof opts.allowEmptyArrays === "boolean" ? !!opts.allowEmptyArrays : defaults.allowEmptyArrays,
2386
+ allowPrototypes: typeof opts.allowPrototypes === "boolean" ? opts.allowPrototypes : defaults.allowPrototypes,
2387
+ allowSparse: typeof opts.allowSparse === "boolean" ? opts.allowSparse : defaults.allowSparse,
2388
+ arrayLimit: typeof opts.arrayLimit === "number" ? opts.arrayLimit : defaults.arrayLimit,
2389
+ charset,
2390
+ charsetSentinel: typeof opts.charsetSentinel === "boolean" ? opts.charsetSentinel : defaults.charsetSentinel,
2391
+ comma: typeof opts.comma === "boolean" ? opts.comma : defaults.comma,
2392
+ decodeDotInKeys: typeof opts.decodeDotInKeys === "boolean" ? opts.decodeDotInKeys : defaults.decodeDotInKeys,
2393
+ decoder: typeof opts.decoder === "function" ? opts.decoder : defaults.decoder,
2394
+ delimiter: typeof opts.delimiter === "string" || utils2.isRegExp(opts.delimiter) ? opts.delimiter : defaults.delimiter,
2395
+ // eslint-disable-next-line no-implicit-coercion, no-extra-parens
2396
+ depth: typeof opts.depth === "number" || opts.depth === false ? +opts.depth : defaults.depth,
2397
+ duplicates,
2398
+ ignoreQueryPrefix: opts.ignoreQueryPrefix === true,
2399
+ interpretNumericEntities: typeof opts.interpretNumericEntities === "boolean" ? opts.interpretNumericEntities : defaults.interpretNumericEntities,
2400
+ parameterLimit: typeof opts.parameterLimit === "number" ? opts.parameterLimit : defaults.parameterLimit,
2401
+ parseArrays: opts.parseArrays !== false,
2402
+ plainObjects: typeof opts.plainObjects === "boolean" ? opts.plainObjects : defaults.plainObjects,
2403
+ strictDepth: typeof opts.strictDepth === "boolean" ? !!opts.strictDepth : defaults.strictDepth,
2404
+ strictNullHandling: typeof opts.strictNullHandling === "boolean" ? opts.strictNullHandling : defaults.strictNullHandling,
2405
+ throwOnLimitExceeded: typeof opts.throwOnLimitExceeded === "boolean" ? opts.throwOnLimitExceeded : false
2406
+ };
2407
+ };
2408
+ parse = function(str, opts) {
2409
+ var options = normalizeParseOptions(opts);
2410
+ if (str === "" || str === null || typeof str === "undefined") {
2411
+ return options.plainObjects ? { __proto__: null } : {};
2412
+ }
2413
+ var tempObj = typeof str === "string" ? parseValues(str, options) : str;
2414
+ var obj = options.plainObjects ? { __proto__: null } : {};
2415
+ var keys = Object.keys(tempObj);
2416
+ for (var i = 0; i < keys.length; ++i) {
2417
+ var key = keys[i];
2418
+ var newObj = parseKeys(key, tempObj[key], options, typeof str === "string");
2419
+ obj = utils2.merge(obj, newObj, options);
2420
+ }
2421
+ if (options.allowSparse === true) {
2422
+ return obj;
2423
+ }
2424
+ return utils2.compact(obj);
2425
+ };
2426
+ return parse;
2427
+ }
2428
+ var lib;
2429
+ var hasRequiredLib;
2430
+ function requireLib() {
2431
+ if (hasRequiredLib) return lib;
2432
+ hasRequiredLib = 1;
2433
+ var stringify = /* @__PURE__ */ requireStringify();
2434
+ var parse2 = /* @__PURE__ */ requireParse();
2435
+ var formats2 = /* @__PURE__ */ requireFormats();
2436
+ lib = {
2437
+ formats: formats2,
2438
+ parse: parse2,
2439
+ stringify
2440
+ };
2441
+ return lib;
2442
+ }
2443
+ var libExports = /* @__PURE__ */ requireLib();
2444
+ const qs = /* @__PURE__ */ getDefaultExportFromCjs(libExports);
2445
+ const omit = (obj, keys2) => {
2446
+ if (!obj)
2447
+ return {};
2448
+ if (!keys2 || keys2.length === 0)
2449
+ return obj;
2450
+ return keys2.reduce(
2451
+ (acc, key) => {
2452
+ delete acc[key];
2453
+ return acc;
2454
+ },
2455
+ { ...obj }
2456
+ );
2457
+ };
2458
+ var ContentType = /* @__PURE__ */ ((ContentType2) => {
2459
+ ContentType2["JSON"] = "application/json";
2460
+ ContentType2["FORM_URLENCODED"] = "application/x-www-form-urlencoded";
2461
+ ContentType2["FORM_DATA"] = "multipart/form-data";
2462
+ ContentType2["TEXT"] = "text/plain";
2463
+ ContentType2["HTML"] = "text/html";
2464
+ ContentType2["XML"] = "text/xml";
2465
+ ContentType2["CSV"] = "text/csv";
2466
+ ContentType2["STREAM"] = "application/octet-stream";
2467
+ return ContentType2;
2468
+ })(ContentType || {});
2469
+ var StatusCode = /* @__PURE__ */ ((StatusCode2) => {
2470
+ StatusCode2[StatusCode2["TIME_OUT"] = 408] = "TIME_OUT";
2471
+ StatusCode2[StatusCode2["ABORTED"] = 499] = "ABORTED";
2472
+ StatusCode2[StatusCode2["NETWORK_ERROR"] = 599] = "NETWORK_ERROR";
2473
+ StatusCode2[StatusCode2["BODY_NULL"] = 502] = "BODY_NULL";
2474
+ StatusCode2[StatusCode2["UNKNOWN"] = 601] = "UNKNOWN";
2475
+ return StatusCode2;
2476
+ })(StatusCode || {});
2477
+ class ResponseError extends Error {
2478
+ constructor({ message, status, statusText, response, config, name }) {
2479
+ super(message);
2480
+ __privateAdd(this, _message);
2481
+ __privateAdd(this, _name);
2482
+ __privateAdd(this, _status);
2483
+ __privateAdd(this, _statusText);
2484
+ __privateAdd(this, _response);
2485
+ __privateAdd(this, _config);
2486
+ __privateSet(this, _message, message);
2487
+ __privateSet(this, _status, status);
2488
+ __privateSet(this, _statusText, statusText);
2489
+ __privateSet(this, _response, response);
2490
+ __privateSet(this, _config, config);
2491
+ __privateSet(this, _name, name ?? message);
2492
+ }
2493
+ get message() {
2494
+ return __privateGet(this, _message);
2495
+ }
2496
+ get status() {
2497
+ return __privateGet(this, _status);
2498
+ }
2499
+ get statusText() {
2500
+ return __privateGet(this, _statusText);
2501
+ }
2502
+ get response() {
2503
+ return __privateGet(this, _response);
2504
+ }
2505
+ get config() {
2506
+ return __privateGet(this, _config);
2507
+ }
2508
+ get name() {
2509
+ return __privateGet(this, _name);
2510
+ }
2511
+ }
2512
+ _message = new WeakMap();
2513
+ _name = new WeakMap();
2514
+ _status = new WeakMap();
2515
+ _statusText = new WeakMap();
2516
+ _response = new WeakMap();
2517
+ _config = new WeakMap();
2518
+ const parsePlugins = (plugins) => {
2519
+ const pluginsSet = /* @__PURE__ */ new Set();
2520
+ plugins.forEach((plugin) => {
2521
+ pluginsSet.add(plugin);
2522
+ });
2523
+ const pluginsArr = Array.from(pluginsSet).sort((a, b) => (a.priority ?? 0) - (b.priority ?? 0));
2524
+ const beforeRequestPlugins = [];
2525
+ const afterResponsePlugins = [];
2526
+ const errorPlugins = [];
2527
+ const finallyPlugins = [];
2528
+ const transformStreamChunkPlugins = [];
2529
+ pluginsArr.forEach((plugin) => {
2530
+ if (plugin.beforeRequest) {
2531
+ beforeRequestPlugins.push(plugin.beforeRequest);
2532
+ }
2533
+ if (plugin.afterResponse) {
2534
+ afterResponsePlugins.push(plugin.afterResponse);
2535
+ }
2536
+ if (plugin.onError) {
2537
+ errorPlugins.push(plugin.onError);
2538
+ }
2539
+ if (plugin.onFinally) {
2540
+ finallyPlugins.push(plugin.onFinally);
2541
+ }
2542
+ if (plugin.transformStreamChunk) {
2543
+ transformStreamChunkPlugins.push(plugin.transformStreamChunk);
2544
+ }
2545
+ });
2546
+ return {
2547
+ beforeRequestPlugins,
2548
+ afterResponsePlugins,
2549
+ errorPlugins,
2550
+ finallyPlugins,
2551
+ transformStreamChunkPlugins
2552
+ };
2553
+ };
2554
+ const buildUrl = (url, params, qsArrayFormat = "repeat") => {
2555
+ if (params) {
2556
+ const paramsStr = qs.stringify(params, { arrayFormat: qsArrayFormat });
2557
+ if (paramsStr) {
2558
+ url = url.includes("?") ? `${url}&${paramsStr}` : `${url}?${paramsStr}`;
2559
+ }
2560
+ }
2561
+ return url;
2562
+ };
2563
+ const mergeHeaders = (_baseHeaders = {}, _newHeaders = {}) => {
2564
+ const _result = _baseHeaders instanceof Headers ? _baseHeaders : new Headers(_baseHeaders);
2565
+ const combineHeaders = (_headers) => {
2566
+ if (!(_headers instanceof Headers)) {
2567
+ _headers = new Headers(_headers);
2568
+ }
2569
+ _headers.forEach((value, key) => {
2570
+ _result.set(key, value);
2571
+ });
2572
+ };
2573
+ combineHeaders(_newHeaders);
2574
+ return _result;
2575
+ };
2576
+ const withBodyArr = ["PATCH", "POST", "PUT"];
2577
+ const withoutBodyArr = ["GET", "HEAD", "OPTIONS", "DELETE"];
2578
+ const getBody = (body, method, headers, qsArrayFormat = "repeat") => {
2579
+ if (!body) return null;
2580
+ let res = null;
2581
+ if (withBodyArr.includes(method.toUpperCase())) {
2582
+ const _headers_ = new Headers(headers || {});
2583
+ const _contentType = _headers_.get("Content-Type") || "";
2584
+ if (_contentType.includes(ContentType.JSON)) {
2585
+ res = JSON.stringify(body);
2586
+ } else if (_contentType.includes(ContentType.FORM_URLENCODED)) {
2587
+ res = qs.stringify(body, { arrayFormat: qsArrayFormat });
2588
+ } else if (_contentType.includes(ContentType.FORM_DATA)) {
2589
+ const formData = new FormData();
2590
+ if (!(body instanceof FormData) && typeof body === "object") {
2591
+ const _data = body;
2592
+ Object.keys(_data).forEach((key) => {
2593
+ if (_data.prototype.hasOwnProperty.call(key)) {
2594
+ formData.append(key, _data[key]);
2595
+ }
2596
+ });
2597
+ res = formData;
2598
+ }
2599
+ }
2600
+ }
2601
+ if (withoutBodyArr.includes(method.toUpperCase())) {
2602
+ res = null;
2603
+ }
2604
+ return res;
2605
+ };
2606
+ class HookFetch {
2607
+ constructor(options) {
2608
+ __privateAdd(this, _HookFetch_instances);
2609
+ __privateAdd(this, _plugins);
2610
+ __privateAdd(this, _controller);
2611
+ __privateAdd(this, _config2);
2612
+ __privateAdd(this, _promise);
2613
+ __privateAdd(this, _isTimeout, false);
2614
+ const { plugins = [], controller, url, baseURL = "", params, data, qsArrayFormat = "repeat", withCredentials, extra, method = "GET", headers } = options;
2615
+ __privateSet(this, _controller, controller ?? new AbortController());
2616
+ __privateSet(this, _plugins, parsePlugins(plugins));
2617
+ __privateSet(this, _config2, {
2618
+ url,
2619
+ baseURL,
2620
+ params,
2621
+ data,
2622
+ withCredentials,
2623
+ extra,
2624
+ method,
2625
+ headers,
2626
+ qsArrayFormat
2627
+ });
2628
+ __privateSet(this, _promise, __privateMethod(this, _HookFetch_instances, init_fn).call(this, options));
2629
+ }
2630
+ then(onfulfilled, onrejected) {
2631
+ return __privateGet(this, _HookFetch_instances, json_get).then(onfulfilled, onrejected);
2632
+ }
2633
+ // 没有走插件错误处理x
2634
+ catch(onrejected) {
2635
+ return __privateGet(this, _HookFetch_instances, json_get).catch(onrejected);
2636
+ }
2637
+ finally(onfinally) {
2638
+ return __privateGet(this, _HookFetch_instances, json_get).finally(onfinally);
2639
+ }
2640
+ abort() {
2641
+ __privateGet(this, _controller).abort();
2642
+ }
2643
+ blob() {
2644
+ return __privateGet(this, _HookFetch_instances, response_get).then((r) => r.blob());
2645
+ }
2646
+ text() {
2647
+ return __privateGet(this, _HookFetch_instances, response_get).then((r) => r.text());
2648
+ }
2649
+ arrayBuffer() {
2650
+ return __privateGet(this, _HookFetch_instances, response_get).then((r) => r.arrayBuffer());
2651
+ }
2652
+ formData() {
2653
+ return __privateGet(this, _HookFetch_instances, response_get).then((r) => r.formData());
2654
+ }
2655
+ bytes() {
2656
+ return __privateGet(this, _HookFetch_instances, response_get).then((r) => r.bytes());
2657
+ }
2658
+ async *stream() {
2659
+ var _a, _b;
2660
+ const response = await __privateGet(this, _promise);
2661
+ const reader = (_b = (_a = response.clone()) == null ? void 0 : _a.body) == null ? void 0 : _b.getReader();
2662
+ if (!reader) {
2663
+ return;
2664
+ }
2665
+ while (true) {
2666
+ const { done, value } = await reader.read();
2667
+ if (done) {
2668
+ break;
2669
+ }
2670
+ let res = {
2671
+ source: value,
2672
+ result: value,
2673
+ error: null
2674
+ };
2675
+ try {
2676
+ for (const plugin of __privateGet(this, _plugins).transformStreamChunkPlugins) {
2677
+ res = await plugin(res);
2678
+ }
2679
+ yield res;
2680
+ } catch (error) {
2681
+ res.error = error;
2682
+ res.result = null;
2683
+ yield res;
2684
+ }
2685
+ }
2686
+ }
2687
+ }
2688
+ _plugins = new WeakMap();
2689
+ _controller = new WeakMap();
2690
+ _config2 = new WeakMap();
2691
+ _promise = new WeakMap();
2692
+ _isTimeout = new WeakMap();
2693
+ _HookFetch_instances = new WeakSet();
2694
+ init_fn = function({ timeout }) {
2695
+ return new Promise(async (resolve, reject) => {
2696
+ let config = __privateGet(this, _config2);
2697
+ const { beforeRequestPlugins } = __privateGet(this, _plugins);
2698
+ for (const plugin of beforeRequestPlugins) {
2699
+ config = await plugin(config);
2700
+ }
2701
+ const _url_ = buildUrl(config.baseURL + config.url, config.params, config.qsArrayFormat);
2702
+ const body = getBody(config.data, config.method, config.headers, config.qsArrayFormat);
2703
+ const otherOptions = omit(config ?? {}, ["baseURL", "data", "extra", "headers", "method", "params", "url", "withCredentials"]);
2704
+ const options = {
2705
+ ...otherOptions,
2706
+ method: config.method,
2707
+ headers: config.headers,
2708
+ signal: __privateGet(this, _controller).signal,
2709
+ credentials: config.withCredentials ? "include" : "omit",
2710
+ body
2711
+ };
2712
+ const req = fetch(_url_, options);
2713
+ let promises = [req];
2714
+ let timeoutId = null;
2715
+ if (timeout) {
2716
+ const timeoutPromise = new Promise((_) => {
2717
+ timeoutId = setTimeout(() => {
2718
+ var _a;
2719
+ __privateSet(this, _isTimeout, true);
2720
+ (_a = __privateGet(this, _controller)) == null ? void 0 : _a.abort();
2721
+ }, timeout);
2722
+ });
2723
+ promises.push(timeoutPromise);
2724
+ }
2725
+ try {
2726
+ const res = await Promise.race(promises);
2727
+ if (res) {
2728
+ if (res.ok) {
2729
+ resolve(res);
2730
+ }
2731
+ return reject(new ResponseError({
2732
+ message: "Fail Request",
2733
+ status: res.status,
2734
+ statusText: res.statusText,
2735
+ config: __privateGet(this, _config2),
2736
+ name: "Fail Request"
2737
+ }));
2738
+ }
2739
+ return reject(new ResponseError({
2740
+ message: "NETWORK_ERROR",
2741
+ status: StatusCode.NETWORK_ERROR,
2742
+ statusText: "Network Error",
2743
+ config: __privateGet(this, _config2),
2744
+ name: "Network Error"
2745
+ }));
2746
+ } catch (error) {
2747
+ reject(await __privateMethod(this, _HookFetch_instances, normalizeError_fn).call(this, error));
2748
+ } finally {
2749
+ if (timeoutId) {
2750
+ clearTimeout(timeoutId);
2751
+ }
2752
+ }
2753
+ });
2754
+ };
2755
+ createNormalizeError_fn = async function(error) {
2756
+ if (error instanceof ResponseError) return error;
2757
+ if (error instanceof TypeError) {
2758
+ if (error.name === "AbortError") {
2759
+ if (__privateGet(this, _isTimeout)) {
2760
+ return new ResponseError({
2761
+ message: "Request timeout",
2762
+ status: StatusCode.TIME_OUT,
2763
+ statusText: "Request timeout",
2764
+ config: __privateGet(this, _config2),
2765
+ name: "Request timeout",
2766
+ response: await __privateGet(this, _HookFetch_instances, response_get)
2767
+ });
2768
+ } else {
2769
+ return new ResponseError({
2770
+ message: "Request aborted",
2771
+ status: StatusCode.ABORTED,
2772
+ statusText: "Request aborted",
2773
+ config: __privateGet(this, _config2),
2774
+ name: "Request aborted",
2775
+ response: await __privateGet(this, _HookFetch_instances, response_get)
2776
+ });
2777
+ }
2778
+ }
2779
+ return new ResponseError({
2780
+ message: error.message,
2781
+ status: StatusCode.NETWORK_ERROR,
2782
+ statusText: "Unknown Request Error",
2783
+ config: __privateGet(this, _config2),
2784
+ name: error.name,
2785
+ response: await __privateGet(this, _HookFetch_instances, response_get)
2786
+ });
2787
+ }
2788
+ return new ResponseError({
2789
+ message: (error == null ? void 0 : error.message) ?? "Unknown Request Error",
2790
+ status: StatusCode.UNKNOWN,
2791
+ statusText: "Unknown Request Error",
2792
+ config: __privateGet(this, _config2),
2793
+ name: "Unknown Request Error",
2794
+ response: await __privateGet(this, _HookFetch_instances, response_get)
2795
+ });
2796
+ };
2797
+ normalizeError_fn = async function(error) {
2798
+ let err = await __privateMethod(this, _HookFetch_instances, createNormalizeError_fn).call(this, error);
2799
+ for (const plugin of __privateGet(this, _plugins).errorPlugins) {
2800
+ err = await plugin(err);
2801
+ }
2802
+ return err;
2803
+ };
2804
+ json_get = function() {
2805
+ return new Promise((resolve, reject) => {
2806
+ __privateGet(this, _HookFetch_instances, response_get).then((r) => r.json()).then(async (res) => {
2807
+ let result = res;
2808
+ for (const plugin of __privateGet(this, _plugins).afterResponsePlugins) {
2809
+ result = await plugin(result);
2810
+ }
2811
+ resolve(result);
2812
+ }).catch(async (err) => {
2813
+ reject(await __privateMethod(this, _HookFetch_instances, normalizeError_fn).call(this, err));
2814
+ }).finally(async () => {
2815
+ const options = {
2816
+ config: __privateGet(this, _config2),
2817
+ response: await __privateGet(this, _HookFetch_instances, response_get).then((r) => r.clone())
2818
+ };
2819
+ for (const plugin of __privateGet(this, _plugins).finallyPlugins) {
2820
+ plugin(options);
2821
+ }
2822
+ });
2823
+ });
2824
+ };
2825
+ response_get = function() {
2826
+ return __privateGet(this, _promise).then((r) => r.clone());
2827
+ };
2828
+ const request = (options) => {
2829
+ return new HookFetch(options);
2830
+ };
2831
+ class Base {
2832
+ constructor({ timeout = 0, baseURL = "", headers = {}, plugins = [], withCredentials = false }) {
2833
+ __privateAdd(this, _Base_instances);
2834
+ __privateAdd(this, _timeout);
2835
+ __privateAdd(this, _baseURL);
2836
+ __privateAdd(this, _commonHeaders);
2837
+ __privateAdd(this, _queue, []);
2838
+ __privateAdd(this, _plugins2, []);
2839
+ __privateAdd(this, _withCredentials);
2840
+ __privateSet(this, _timeout, timeout);
2841
+ __privateSet(this, _baseURL, baseURL);
2842
+ __privateSet(this, _commonHeaders, headers);
2843
+ __privateSet(this, _plugins2, plugins);
2844
+ __privateSet(this, _withCredentials, withCredentials);
2845
+ }
2846
+ // eslint-disable-next-line no-explicit-any
2847
+ use(plugin) {
2848
+ __privateGet(this, _plugins2).push(plugin);
2849
+ return this;
2850
+ }
2851
+ request(url, { timeout, headers, method = "GET", params, data, qsArrayFormat, withCredentials, extra } = {}) {
2852
+ const controller = new AbortController();
2853
+ __privateGet(this, _queue).push(controller);
2854
+ const req = request({
2855
+ url,
2856
+ baseURL: __privateGet(this, _baseURL),
2857
+ timeout: timeout ?? __privateGet(this, _timeout),
2858
+ plugins: __privateGet(this, _plugins2),
2859
+ headers: mergeHeaders(__privateGet(this, _commonHeaders), headers),
2860
+ controller,
2861
+ method,
2862
+ params,
2863
+ data,
2864
+ qsArrayFormat,
2865
+ withCredentials: withCredentials ?? __privateGet(this, _withCredentials),
2866
+ extra
2867
+ });
2868
+ req.finally(() => {
2869
+ __privateSet(this, _queue, __privateGet(this, _queue).filter((item) => item !== controller));
2870
+ });
2871
+ return req;
2872
+ }
2873
+ get(url, params = {}, options) {
2874
+ return __privateMethod(this, _Base_instances, requestWithParams_fn).call(this, url, params, options);
2875
+ }
2876
+ head(url, params = {}, options) {
2877
+ return __privateMethod(this, _Base_instances, requestWithParams_fn).call(this, url, params, options);
2878
+ }
2879
+ options(url, params = {}, options) {
2880
+ return __privateMethod(this, _Base_instances, requestWithParams_fn).call(this, url, params, options);
2881
+ }
2882
+ delete(url, options) {
2883
+ return this.request(url, options);
2884
+ }
2885
+ post(url, data, options) {
2886
+ return __privateMethod(this, _Base_instances, requestWithBody_fn).call(this, url, data, options);
2887
+ }
2888
+ put(url, data, options) {
2889
+ return __privateMethod(this, _Base_instances, requestWithBody_fn).call(this, url, data, options);
2890
+ }
2891
+ patch(url, data, options) {
2892
+ return __privateMethod(this, _Base_instances, requestWithBody_fn).call(this, url, data, options);
2893
+ }
2894
+ abortAll() {
2895
+ __privateGet(this, _queue).forEach((controller) => controller.abort());
2896
+ __privateSet(this, _queue, []);
2897
+ }
2898
+ }
2899
+ _timeout = new WeakMap();
2900
+ _baseURL = new WeakMap();
2901
+ _commonHeaders = new WeakMap();
2902
+ _queue = new WeakMap();
2903
+ _plugins2 = new WeakMap();
2904
+ _withCredentials = new WeakMap();
2905
+ _Base_instances = new WeakSet();
2906
+ requestWithParams_fn = function(url, params = {}, options = {}) {
2907
+ return this.request(url, { ...options, params });
2908
+ };
2909
+ requestWithBody_fn = function(url, data = {}, options = {}) {
2910
+ return this.request(url, { ...options, data });
2911
+ };
2912
+ const useRequest = (url, options = {}) => request({
2913
+ url,
2914
+ baseURL: "",
2915
+ ...options
2916
+ });
2917
+ const defaultFn = useRequest;
2918
+ defaultFn.create = (options) => new Base(options);
2919
+ export {
2920
+ defaultFn as default
2921
+ };
2922
+ //# sourceMappingURL=index.js.map