@cccsaurora/clue-ui 1.5.0-dev.464 → 1.5.0-dev.469

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.
Files changed (46) hide show
  1. package/{ActionForm-BT7_k0EL.js → ActionForm-pbNGEuwp.js} +3 -3
  2. package/{AnnotationDetails-Y_WoZhcI.js → AnnotationDetails-C-up01mY.js} +1 -1
  3. package/{AnnotationPreview-cStKX0if.js → AnnotationPreview-CEVRdPnY.js} +1 -1
  4. package/{ClueEnrichContext-C7sNEECP.js → ClueEnrichContext-DaGfR7GQ.js} +16 -20
  5. package/components/AnnotationDetailPopover.js +1 -1
  6. package/components/AnnotationDetails.js +2 -2
  7. package/components/AnnotationPreview.js +1 -1
  8. package/components/EnrichedCard.js +1 -1
  9. package/components/EnrichedChip.js +2 -2
  10. package/components/EnrichedTypography.js +2 -2
  11. package/components/RetryFailedEnrichments.js +1 -1
  12. package/components/SourcePicker.js +1 -1
  13. package/components/actions/ActionForm.js +1 -1
  14. package/components/actions/ExecutePopover.js +1 -1
  15. package/components/actions/ResultModal.js +1 -1
  16. package/components/enrichment/EnrichPopover.js +1 -1
  17. package/components/fetchers/Fetcher.js +1 -1
  18. package/components/group/GroupControl.js +1 -1
  19. package/components/stats/QueryStatus.js +1 -1
  20. package/database/index.js +2 -2
  21. package/database/replication.js +2 -2
  22. package/hooks/ClueActionContext.js +2 -2
  23. package/hooks/ClueDatabaseContext.js +1 -1
  24. package/hooks/ClueEnrichContext.js +2 -2
  25. package/hooks/ClueFetcherContext.js +1 -1
  26. package/hooks/ClueGroupContext.js +1 -1
  27. package/hooks/CluePopupContext.js +2 -2
  28. package/hooks/ClueProvider.js +3 -3
  29. package/hooks/selectors.js +2 -2
  30. package/hooks/useActionResult.js +1 -1
  31. package/hooks/useAnnotations.js +2 -2
  32. package/hooks/useClue.js +1 -1
  33. package/hooks/useClueActions.js +1 -1
  34. package/hooks/useClueTypeConfig.js +1 -1
  35. package/hooks/useErrors.js +1 -1
  36. package/hooks/useFetcherResult.js +1 -1
  37. package/icons/Action.js +2 -2
  38. package/icons/Assessment.js +1 -1
  39. package/icons/Context.js +1 -1
  40. package/icons/Opinion.js +1 -1
  41. package/{index-hzIDv8Mx.js → index-BFOmLhDH.js} +2 -2
  42. package/{index-CtFzsHDu.js → index-CWUzifNE.js} +1 -1
  43. package/{index-DpJxD74E.js → index-Gwnzh4FL.js} +1546 -882
  44. package/main.js +5 -5
  45. package/package.json +1 -1
  46. package/{replication-C5IO7X30.js → replication-DYXRsbKM.js} +1 -1
@@ -257,6 +257,23 @@ function bind(fn, thisArg) {
257
257
  const { toString } = Object.prototype;
258
258
  const { getPrototypeOf } = Object;
259
259
  const { iterator, toStringTag } = Symbol;
260
+ const hasOwnProperty = (({ hasOwnProperty: hasOwnProperty2 }) => (obj, prop) => hasOwnProperty2.call(obj, prop))(Object.prototype);
261
+ const hasOwnInPrototypeChain = (thing, prop) => {
262
+ let obj = thing;
263
+ const seen = [];
264
+ while (obj != null && obj !== Object.prototype) {
265
+ if (seen.indexOf(obj) !== -1) {
266
+ return false;
267
+ }
268
+ seen.push(obj);
269
+ if (hasOwnProperty(obj, prop)) {
270
+ return true;
271
+ }
272
+ obj = getPrototypeOf(obj);
273
+ }
274
+ return false;
275
+ };
276
+ const getSafeProp = (obj, prop) => obj != null && hasOwnInPrototypeChain(obj, prop) ? obj[prop] : void 0;
260
277
  const kindOf = /* @__PURE__ */ ((cache) => (thing) => {
261
278
  const str = toString.call(thing);
262
279
  return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
@@ -287,11 +304,14 @@ const isNumber = typeOfTest("number");
287
304
  const isObject = (thing) => thing !== null && typeof thing === "object";
288
305
  const isBoolean = (thing) => thing === true || thing === false;
289
306
  const isPlainObject = (val) => {
290
- if (kindOf(val) !== "object") {
307
+ if (!isObject(val)) {
291
308
  return false;
292
309
  }
293
310
  const prototype2 = getPrototypeOf(val);
294
- return (prototype2 === null || prototype2 === Object.prototype || Object.getPrototypeOf(prototype2) === null) && !(toStringTag in val) && !(iterator in val);
311
+ return (prototype2 === null || prototype2 === Object.prototype || getPrototypeOf(prototype2) === null) && // Treat any genuine (non-Object.prototype-polluted) Symbol.toStringTag or
312
+ // Symbol.iterator as evidence the value is a tagged/iterable type rather
313
+ // than a plain object, while ignoring keys injected onto Object.prototype.
314
+ !hasOwnInPrototypeChain(val, toStringTag) && !hasOwnInPrototypeChain(val, iterator);
295
315
  };
296
316
  const isEmptyObject = (val) => {
297
317
  if (!isObject(val) || isBuffer(val)) {
@@ -305,13 +325,31 @@ const isEmptyObject = (val) => {
305
325
  };
306
326
  const isDate = kindOfTest("Date");
307
327
  const isFile = kindOfTest("File");
328
+ const isReactNativeBlob = (value) => {
329
+ return !!(value && typeof value.uri !== "undefined");
330
+ };
331
+ const isReactNative = (formData) => formData && typeof formData.getParts !== "undefined";
308
332
  const isBlob = kindOfTest("Blob");
309
333
  const isFileList = kindOfTest("FileList");
310
334
  const isStream = (val) => isObject(val) && isFunction$1(val.pipe);
335
+ function getGlobal() {
336
+ if (typeof globalThis !== "undefined") return globalThis;
337
+ if (typeof self !== "undefined") return self;
338
+ if (typeof window !== "undefined") return window;
339
+ if (typeof global !== "undefined") return global;
340
+ return {};
341
+ }
342
+ const G = getGlobal();
343
+ const FormDataCtor = typeof G.FormData !== "undefined" ? G.FormData : void 0;
311
344
  const isFormData = (thing) => {
312
- let kind;
313
- return thing && (typeof FormData === "function" && thing instanceof FormData || isFunction$1(thing.append) && ((kind = kindOf(thing)) === "formdata" || // detect form-data instance
314
- kind === "object" && isFunction$1(thing.toString) && thing.toString() === "[object FormData]"));
345
+ if (!thing) return false;
346
+ if (FormDataCtor && thing instanceof FormDataCtor) return true;
347
+ const proto = getPrototypeOf(thing);
348
+ if (!proto || proto === Object.prototype) return false;
349
+ if (!isFunction$1(thing.append)) return false;
350
+ const kind = kindOf(thing);
351
+ return kind === "formdata" || // detect form-data instance
352
+ kind === "object" && isFunction$1(thing.toString) && thing.toString() === "[object FormData]";
315
353
  };
316
354
  const isURLSearchParams = kindOfTest("URLSearchParams");
317
355
  const [isReadableStream, isRequest, isResponse, isHeaders] = [
@@ -320,7 +358,9 @@ const [isReadableStream, isRequest, isResponse, isHeaders] = [
320
358
  "Response",
321
359
  "Headers"
322
360
  ].map(kindOfTest);
323
- const trim = (str) => str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
361
+ const trim = (str) => {
362
+ return str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
363
+ };
324
364
  function forEach(obj, fn, { allOwnKeys = false } = {}) {
325
365
  if (obj === null || typeof obj === "undefined") {
326
366
  return;
@@ -368,16 +408,17 @@ const _global = (() => {
368
408
  return typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : global;
369
409
  })();
370
410
  const isContextDefined = (context) => !isUndefined(context) && context !== _global;
371
- function merge() {
411
+ function merge(...objs) {
372
412
  const { caseless, skipUndefined } = isContextDefined(this) && this || {};
373
413
  const result = {};
374
414
  const assignValue = (val, key) => {
375
415
  if (key === "__proto__" || key === "constructor" || key === "prototype") {
376
416
  return;
377
417
  }
378
- const targetKey = caseless && findKey(result, key) || key;
379
- if (isPlainObject(result[targetKey]) && isPlainObject(val)) {
380
- result[targetKey] = merge(result[targetKey], val);
418
+ const targetKey = caseless && typeof key === "string" && findKey(result, key) || key;
419
+ const existing = hasOwnProperty(result, targetKey) ? result[targetKey] : void 0;
420
+ if (isPlainObject(existing) && isPlainObject(val)) {
421
+ result[targetKey] = merge(existing, val);
381
422
  } else if (isPlainObject(val)) {
382
423
  result[targetKey] = merge({}, val);
383
424
  } else if (isArray(val)) {
@@ -386,8 +427,22 @@ function merge() {
386
427
  result[targetKey] = val;
387
428
  }
388
429
  };
389
- for (let i = 0, l = arguments.length; i < l; i++) {
390
- arguments[i] && forEach(arguments[i], assignValue);
430
+ for (let i = 0, l = objs.length; i < l; i++) {
431
+ const source = objs[i];
432
+ if (!source || isBuffer(source)) {
433
+ continue;
434
+ }
435
+ forEach(source, assignValue);
436
+ if (typeof source !== "object" || isArray(source)) {
437
+ continue;
438
+ }
439
+ const symbols = Object.getOwnPropertySymbols(source);
440
+ for (let j = 0; j < symbols.length; j++) {
441
+ const symbol = symbols[j];
442
+ if (propertyIsEnumerable.call(source, symbol)) {
443
+ assignValue(source[symbol], symbol);
444
+ }
445
+ }
391
446
  }
392
447
  return result;
393
448
  }
@@ -397,6 +452,9 @@ const extend = (a, b, thisArg, { allOwnKeys } = {}) => {
397
452
  (val, key) => {
398
453
  if (thisArg && isFunction$1(val)) {
399
454
  Object.defineProperty(a, key, {
455
+ // Null-proto descriptor so a polluted Object.prototype.get cannot
456
+ // hijack defineProperty's accessor-vs-data resolution.
457
+ __proto__: null,
400
458
  value: bind(val, thisArg),
401
459
  writable: true,
402
460
  enumerable: true,
@@ -404,6 +462,7 @@ const extend = (a, b, thisArg, { allOwnKeys } = {}) => {
404
462
  });
405
463
  } else {
406
464
  Object.defineProperty(a, key, {
465
+ __proto__: null,
407
466
  value: val,
408
467
  writable: true,
409
468
  enumerable: true,
@@ -422,17 +481,16 @@ const stripBOM = (content) => {
422
481
  return content;
423
482
  };
424
483
  const inherits = (constructor, superConstructor, props, descriptors) => {
425
- constructor.prototype = Object.create(
426
- superConstructor.prototype,
427
- descriptors
428
- );
484
+ constructor.prototype = Object.create(superConstructor.prototype, descriptors);
429
485
  Object.defineProperty(constructor.prototype, "constructor", {
486
+ __proto__: null,
430
487
  value: constructor,
431
488
  writable: true,
432
489
  enumerable: false,
433
490
  configurable: true
434
491
  });
435
492
  Object.defineProperty(constructor, "super", {
493
+ __proto__: null,
436
494
  value: superConstructor.prototype
437
495
  });
438
496
  props && Object.assign(constructor.prototype, props);
@@ -506,7 +564,7 @@ const toCamelCase = (str) => {
506
564
  return p1.toUpperCase() + p2;
507
565
  });
508
566
  };
509
- const hasOwnProperty = (({ hasOwnProperty: hasOwnProperty2 }) => (obj, prop) => hasOwnProperty2.call(obj, prop))(Object.prototype);
567
+ const { propertyIsEnumerable } = Object.prototype;
510
568
  const isRegExp = kindOfTest("RegExp");
511
569
  const reduceDescriptors = (obj, reducer) => {
512
570
  const descriptors = Object.getOwnPropertyDescriptors(obj);
@@ -521,7 +579,7 @@ const reduceDescriptors = (obj, reducer) => {
521
579
  };
522
580
  const freezeMethods = (obj) => {
523
581
  reduceDescriptors(obj, (descriptor, name) => {
524
- if (isFunction$1(obj) && ["arguments", "caller", "callee"].indexOf(name) !== -1) {
582
+ if (isFunction$1(obj) && ["arguments", "caller", "callee"].includes(name)) {
525
583
  return false;
526
584
  }
527
585
  const value = obj[name];
@@ -557,29 +615,29 @@ function isSpecCompliantForm(thing) {
557
615
  return !!(thing && isFunction$1(thing.append) && thing[toStringTag] === "FormData" && thing[iterator]);
558
616
  }
559
617
  const toJSONObject = (obj) => {
560
- const stack = new Array(10);
561
- const visit = (source, i) => {
618
+ const visited = /* @__PURE__ */ new WeakSet();
619
+ const visit = (source) => {
562
620
  if (isObject(source)) {
563
- if (stack.indexOf(source) >= 0) {
621
+ if (visited.has(source)) {
564
622
  return;
565
623
  }
566
624
  if (isBuffer(source)) {
567
625
  return source;
568
626
  }
569
627
  if (!("toJSON" in source)) {
570
- stack[i] = source;
628
+ visited.add(source);
571
629
  const target = isArray(source) ? [] : {};
572
630
  forEach(source, (value, key) => {
573
- const reducedValue = visit(value, i + 1);
631
+ const reducedValue = visit(value);
574
632
  !isUndefined(reducedValue) && (target[key] = reducedValue);
575
633
  });
576
- stack[i] = void 0;
634
+ visited.delete(source);
577
635
  return target;
578
636
  }
579
637
  }
580
638
  return source;
581
639
  };
582
- return visit(obj, 0);
640
+ return visit(obj);
583
641
  };
584
642
  const isAsyncFn = kindOfTest("AsyncFunction");
585
643
  const isThenable = (thing) => thing && (isObject(thing) || isFunction$1(thing)) && isFunction$1(thing.then) && isFunction$1(thing.catch);
@@ -605,6 +663,7 @@ const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
605
663
  })(typeof setImmediate === "function", isFunction$1(_global.postMessage));
606
664
  const asap = typeof queueMicrotask !== "undefined" ? queueMicrotask.bind(_global) : typeof process !== "undefined" && process.nextTick || _setImmediate;
607
665
  const isIterable = (thing) => thing != null && isFunction$1(thing[iterator]);
666
+ const isSafeIterable = (thing) => thing != null && hasOwnInPrototypeChain(thing, iterator) && isIterable(thing);
608
667
  const utils$1 = {
609
668
  isArray,
610
669
  isArrayBuffer,
@@ -624,6 +683,8 @@ const utils$1 = {
624
683
  isUndefined,
625
684
  isDate,
626
685
  isFile,
686
+ isReactNativeBlob,
687
+ isReactNative,
627
688
  isBlob,
628
689
  isRegExp,
629
690
  isFunction: isFunction$1,
@@ -648,6 +709,8 @@ const utils$1 = {
648
709
  hasOwnProperty,
649
710
  hasOwnProp: hasOwnProperty,
650
711
  // an alias to avoid ESLint no-prototype-builtins detection
712
+ hasOwnInPrototypeChain,
713
+ getSafeProp,
651
714
  reduceDescriptors,
652
715
  freezeMethods,
653
716
  toObjectSet,
@@ -663,203 +726,624 @@ const utils$1 = {
663
726
  isThenable,
664
727
  setImmediate: _setImmediate,
665
728
  asap,
666
- isIterable
729
+ isIterable,
730
+ isSafeIterable
667
731
  };
668
- let AxiosError$1 = class AxiosError extends Error {
669
- static from(error, code, config, request, response, customProps) {
670
- const axiosError = new AxiosError(error.message, code || error.code, config, request, response);
671
- axiosError.cause = error;
672
- axiosError.name = error.name;
673
- customProps && Object.assign(axiosError, customProps);
674
- return axiosError;
675
- }
676
- /**
677
- * Create an Error with the specified message, config, error code, request and response.
678
- *
679
- * @param {string} message The error message.
680
- * @param {string} [code] The error code (for example, 'ECONNABORTED').
681
- * @param {Object} [config] The config.
682
- * @param {Object} [request] The request.
683
- * @param {Object} [response] The response.
684
- *
685
- * @returns {Error} The created error.
686
- */
687
- constructor(message, code, config, request, response) {
688
- super(message);
689
- this.name = "AxiosError";
690
- this.isAxiosError = true;
691
- code && (this.code = code);
692
- config && (this.config = config);
693
- request && (this.request = request);
694
- if (response) {
695
- this.response = response;
696
- this.status = response.status;
732
+ const ignoreDuplicateOf = utils$1.toObjectSet([
733
+ "age",
734
+ "authorization",
735
+ "content-length",
736
+ "content-type",
737
+ "etag",
738
+ "expires",
739
+ "from",
740
+ "host",
741
+ "if-modified-since",
742
+ "if-unmodified-since",
743
+ "last-modified",
744
+ "location",
745
+ "max-forwards",
746
+ "proxy-authorization",
747
+ "referer",
748
+ "retry-after",
749
+ "user-agent"
750
+ ]);
751
+ const parseHeaders = (rawHeaders) => {
752
+ const parsed = {};
753
+ let key;
754
+ let val;
755
+ let i;
756
+ rawHeaders && rawHeaders.split("\n").forEach(function parser(line) {
757
+ i = line.indexOf(":");
758
+ key = line.substring(0, i).trim().toLowerCase();
759
+ val = line.substring(i + 1).trim();
760
+ if (!key || parsed[key] && ignoreDuplicateOf[key]) {
761
+ return;
762
+ }
763
+ if (key === "set-cookie") {
764
+ if (parsed[key]) {
765
+ parsed[key].push(val);
766
+ } else {
767
+ parsed[key] = [val];
768
+ }
769
+ } else {
770
+ parsed[key] = parsed[key] ? parsed[key] + ", " + val : val;
697
771
  }
772
+ });
773
+ return parsed;
774
+ };
775
+ function trimSPorHTAB(str) {
776
+ let start = 0;
777
+ let end = str.length;
778
+ while (start < end) {
779
+ const code = str.charCodeAt(start);
780
+ if (code !== 9 && code !== 32) {
781
+ break;
782
+ }
783
+ start += 1;
698
784
  }
699
- toJSON() {
700
- return {
701
- // Standard
702
- message: this.message,
703
- name: this.name,
704
- // Microsoft
705
- description: this.description,
706
- number: this.number,
707
- // Mozilla
708
- fileName: this.fileName,
709
- lineNumber: this.lineNumber,
710
- columnNumber: this.columnNumber,
711
- stack: this.stack,
712
- // Axios
713
- config: utils$1.toJSONObject(this.config),
714
- code: this.code,
715
- status: this.status
716
- };
785
+ while (end > start) {
786
+ const code = str.charCodeAt(end - 1);
787
+ if (code !== 9 && code !== 32) {
788
+ break;
789
+ }
790
+ end -= 1;
717
791
  }
718
- };
719
- AxiosError$1.ERR_BAD_OPTION_VALUE = "ERR_BAD_OPTION_VALUE";
720
- AxiosError$1.ERR_BAD_OPTION = "ERR_BAD_OPTION";
721
- AxiosError$1.ECONNABORTED = "ECONNABORTED";
722
- AxiosError$1.ETIMEDOUT = "ETIMEDOUT";
723
- AxiosError$1.ERR_NETWORK = "ERR_NETWORK";
724
- AxiosError$1.ERR_FR_TOO_MANY_REDIRECTS = "ERR_FR_TOO_MANY_REDIRECTS";
725
- AxiosError$1.ERR_DEPRECATED = "ERR_DEPRECATED";
726
- AxiosError$1.ERR_BAD_RESPONSE = "ERR_BAD_RESPONSE";
727
- AxiosError$1.ERR_BAD_REQUEST = "ERR_BAD_REQUEST";
728
- AxiosError$1.ERR_CANCELED = "ERR_CANCELED";
729
- AxiosError$1.ERR_NOT_SUPPORT = "ERR_NOT_SUPPORT";
730
- AxiosError$1.ERR_INVALID_URL = "ERR_INVALID_URL";
731
- const httpAdapter = null;
732
- function isVisitable(thing) {
733
- return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
792
+ return start === 0 && end === str.length ? str : str.slice(start, end);
734
793
  }
735
- function removeBrackets(key) {
736
- return utils$1.endsWith(key, "[]") ? key.slice(0, -2) : key;
794
+ const INVALID_UNICODE_HEADER_VALUE_CHARS = new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+", "g");
795
+ const INVALID_BYTE_STRING_HEADER_VALUE_CHARS = new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+", "g");
796
+ function sanitizeValue(value, invalidChars) {
797
+ if (utils$1.isArray(value)) {
798
+ return value.map((item) => sanitizeValue(item, invalidChars));
799
+ }
800
+ return trimSPorHTAB(String(value).replace(invalidChars, ""));
737
801
  }
738
- function renderKey(path, key, dots) {
739
- if (!path) return key;
740
- return path.concat(key).map(function each(token, i) {
741
- token = removeBrackets(token);
742
- return !dots && i ? "[" + token + "]" : token;
743
- }).join(dots ? "." : "");
802
+ const sanitizeHeaderValue = (value) => sanitizeValue(value, INVALID_UNICODE_HEADER_VALUE_CHARS);
803
+ const sanitizeByteStringHeaderValue = (value) => sanitizeValue(value, INVALID_BYTE_STRING_HEADER_VALUE_CHARS);
804
+ function toByteStringHeaderObject(headers) {
805
+ const byteStringHeaders = /* @__PURE__ */ Object.create(null);
806
+ utils$1.forEach(headers.toJSON(), (value, header) => {
807
+ byteStringHeaders[header] = sanitizeByteStringHeaderValue(value);
808
+ });
809
+ return byteStringHeaders;
744
810
  }
745
- function isFlatArray(arr) {
746
- return utils$1.isArray(arr) && !arr.some(isVisitable);
811
+ const $internals = Symbol("internals");
812
+ function normalizeHeader(header) {
813
+ return header && String(header).trim().toLowerCase();
747
814
  }
748
- const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) {
749
- return /^is[A-Z]/.test(prop);
750
- });
751
- function toFormData$1(obj, formData, options) {
752
- if (!utils$1.isObject(obj)) {
753
- throw new TypeError("target must be an object");
815
+ function normalizeValue(value) {
816
+ if (value === false || value == null) {
817
+ return value;
754
818
  }
755
- formData = formData || new FormData();
756
- options = utils$1.toFlatObject(options, {
757
- metaTokens: true,
758
- dots: false,
759
- indexes: false
760
- }, false, function defined(option, source) {
761
- return !utils$1.isUndefined(source[option]);
762
- });
763
- const metaTokens = options.metaTokens;
764
- const visitor = options.visitor || defaultVisitor;
765
- const dots = options.dots;
766
- const indexes = options.indexes;
767
- const _Blob = options.Blob || typeof Blob !== "undefined" && Blob;
768
- const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
769
- if (!utils$1.isFunction(visitor)) {
770
- throw new TypeError("visitor must be a function");
819
+ return utils$1.isArray(value) ? value.map(normalizeValue) : sanitizeHeaderValue(String(value));
820
+ }
821
+ function parseTokens(str) {
822
+ const tokens = /* @__PURE__ */ Object.create(null);
823
+ const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
824
+ let match;
825
+ while (match = tokensRE.exec(str)) {
826
+ tokens[match[1]] = match[2];
771
827
  }
772
- function convertValue(value) {
773
- if (value === null) return "";
774
- if (utils$1.isDate(value)) {
775
- return value.toISOString();
776
- }
777
- if (utils$1.isBoolean(value)) {
778
- return value.toString();
779
- }
780
- if (!useBlob && utils$1.isBlob(value)) {
781
- throw new AxiosError$1("Blob is not supported. Use a Buffer instead.");
782
- }
783
- if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
784
- return useBlob && typeof Blob === "function" ? new Blob([value]) : Buffer.from(value);
785
- }
786
- return value;
828
+ return tokens;
829
+ }
830
+ const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
831
+ function matchHeaderValue(context, value, header, filter2, isHeaderNameFilter) {
832
+ if (utils$1.isFunction(filter2)) {
833
+ return filter2.call(this, value, header);
787
834
  }
788
- function defaultVisitor(value, key, path) {
789
- let arr = value;
790
- if (value && !path && typeof value === "object") {
791
- if (utils$1.endsWith(key, "{}")) {
792
- key = metaTokens ? key : key.slice(0, -2);
793
- value = JSON.stringify(value);
794
- } else if (utils$1.isArray(value) && isFlatArray(value) || (utils$1.isFileList(value) || utils$1.endsWith(key, "[]")) && (arr = utils$1.toArray(value))) {
795
- key = removeBrackets(key);
796
- arr.forEach(function each(el, index) {
797
- !(utils$1.isUndefined(el) || el === null) && formData.append(
798
- // eslint-disable-next-line no-nested-ternary
799
- indexes === true ? renderKey([key], index, dots) : indexes === null ? key : key + "[]",
800
- convertValue(el)
801
- );
802
- });
803
- return false;
804
- }
805
- }
806
- if (isVisitable(value)) {
807
- return true;
808
- }
809
- formData.append(renderKey(path, key, dots), convertValue(value));
810
- return false;
835
+ if (isHeaderNameFilter) {
836
+ value = header;
811
837
  }
812
- const stack = [];
813
- const exposedHelpers = Object.assign(predicates, {
814
- defaultVisitor,
815
- convertValue,
816
- isVisitable
817
- });
818
- function build(value, path) {
819
- if (utils$1.isUndefined(value)) return;
820
- if (stack.indexOf(value) !== -1) {
821
- throw Error("Circular reference detected in " + path.join("."));
822
- }
823
- stack.push(value);
824
- utils$1.forEach(value, function each(el, key) {
825
- const result = !(utils$1.isUndefined(el) || el === null) && visitor.call(
826
- formData,
827
- el,
828
- utils$1.isString(key) ? key.trim() : key,
829
- path,
830
- exposedHelpers
831
- );
832
- if (result === true) {
833
- build(el, path ? path.concat(key) : [key]);
834
- }
835
- });
836
- stack.pop();
838
+ if (!utils$1.isString(value)) return;
839
+ if (utils$1.isString(filter2)) {
840
+ return value.indexOf(filter2) !== -1;
837
841
  }
838
- if (!utils$1.isObject(obj)) {
839
- throw new TypeError("data must be an object");
842
+ if (utils$1.isRegExp(filter2)) {
843
+ return filter2.test(value);
840
844
  }
841
- build(obj);
842
- return formData;
843
845
  }
844
- function encode$1(str) {
845
- const charMap = {
846
- "!": "%21",
847
- "'": "%27",
848
- "(": "%28",
849
- ")": "%29",
850
- "~": "%7E",
851
- "%20": "+",
852
- "%00": "\0"
853
- };
854
- return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
855
- return charMap[match];
846
+ function formatHeader(header) {
847
+ return header.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => {
848
+ return char.toUpperCase() + str;
856
849
  });
857
850
  }
858
- function AxiosURLSearchParams(params, options) {
859
- this._pairs = [];
860
- params && toFormData$1(params, this, options);
861
- }
862
- const prototype = AxiosURLSearchParams.prototype;
851
+ function buildAccessors(obj, header) {
852
+ const accessorName = utils$1.toCamelCase(" " + header);
853
+ ["get", "set", "has"].forEach((methodName) => {
854
+ Object.defineProperty(obj, methodName + accessorName, {
855
+ // Null-proto descriptor so a polluted Object.prototype.get cannot turn
856
+ // this data descriptor into an accessor descriptor on the way in.
857
+ __proto__: null,
858
+ value: function(arg1, arg2, arg3) {
859
+ return this[methodName].call(this, header, arg1, arg2, arg3);
860
+ },
861
+ configurable: true
862
+ });
863
+ });
864
+ }
865
+ let AxiosHeaders$1 = class AxiosHeaders {
866
+ constructor(headers) {
867
+ headers && this.set(headers);
868
+ }
869
+ set(header, valueOrRewrite, rewrite) {
870
+ const self2 = this;
871
+ function setHeader(_value, _header, _rewrite) {
872
+ const lHeader = normalizeHeader(_header);
873
+ if (!lHeader) {
874
+ return;
875
+ }
876
+ const key = utils$1.findKey(self2, lHeader);
877
+ if (!key || self2[key] === void 0 || _rewrite === true || _rewrite === void 0 && self2[key] !== false) {
878
+ self2[key || _header] = normalizeValue(_value);
879
+ }
880
+ }
881
+ const setHeaders = (headers, _rewrite) => utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
882
+ if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
883
+ setHeaders(header, valueOrRewrite);
884
+ } else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
885
+ setHeaders(parseHeaders(header), valueOrRewrite);
886
+ } else if (utils$1.isObject(header) && utils$1.isSafeIterable(header)) {
887
+ let obj = /* @__PURE__ */ Object.create(null), dest, key;
888
+ for (const entry of header) {
889
+ if (!utils$1.isArray(entry)) {
890
+ throw new TypeError("Object iterator must return a key-value pair");
891
+ }
892
+ key = entry[0];
893
+ if (utils$1.hasOwnProp(obj, key)) {
894
+ dest = obj[key];
895
+ obj[key] = utils$1.isArray(dest) ? [...dest, entry[1]] : [dest, entry[1]];
896
+ } else {
897
+ obj[key] = entry[1];
898
+ }
899
+ }
900
+ setHeaders(obj, valueOrRewrite);
901
+ } else {
902
+ header != null && setHeader(valueOrRewrite, header, rewrite);
903
+ }
904
+ return this;
905
+ }
906
+ get(header, parser) {
907
+ header = normalizeHeader(header);
908
+ if (header) {
909
+ const key = utils$1.findKey(this, header);
910
+ if (key) {
911
+ const value = this[key];
912
+ if (!parser) {
913
+ return value;
914
+ }
915
+ if (parser === true) {
916
+ return parseTokens(value);
917
+ }
918
+ if (utils$1.isFunction(parser)) {
919
+ return parser.call(this, value, key);
920
+ }
921
+ if (utils$1.isRegExp(parser)) {
922
+ return parser.exec(value);
923
+ }
924
+ throw new TypeError("parser must be boolean|regexp|function");
925
+ }
926
+ }
927
+ }
928
+ has(header, matcher) {
929
+ header = normalizeHeader(header);
930
+ if (header) {
931
+ const key = utils$1.findKey(this, header);
932
+ return !!(key && this[key] !== void 0 && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
933
+ }
934
+ return false;
935
+ }
936
+ delete(header, matcher) {
937
+ const self2 = this;
938
+ let deleted = false;
939
+ function deleteHeader(_header) {
940
+ _header = normalizeHeader(_header);
941
+ if (_header) {
942
+ const key = utils$1.findKey(self2, _header);
943
+ if (key && (!matcher || matchHeaderValue(self2, self2[key], key, matcher))) {
944
+ delete self2[key];
945
+ deleted = true;
946
+ }
947
+ }
948
+ }
949
+ if (utils$1.isArray(header)) {
950
+ header.forEach(deleteHeader);
951
+ } else {
952
+ deleteHeader(header);
953
+ }
954
+ return deleted;
955
+ }
956
+ clear(matcher) {
957
+ const keys = Object.keys(this);
958
+ let i = keys.length;
959
+ let deleted = false;
960
+ while (i--) {
961
+ const key = keys[i];
962
+ if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
963
+ delete this[key];
964
+ deleted = true;
965
+ }
966
+ }
967
+ return deleted;
968
+ }
969
+ normalize(format2) {
970
+ const self2 = this;
971
+ const headers = {};
972
+ utils$1.forEach(this, (value, header) => {
973
+ const key = utils$1.findKey(headers, header);
974
+ if (key) {
975
+ self2[key] = normalizeValue(value);
976
+ delete self2[header];
977
+ return;
978
+ }
979
+ const normalized = format2 ? formatHeader(header) : String(header).trim();
980
+ if (normalized !== header) {
981
+ delete self2[header];
982
+ }
983
+ self2[normalized] = normalizeValue(value);
984
+ headers[normalized] = true;
985
+ });
986
+ return this;
987
+ }
988
+ concat(...targets) {
989
+ return this.constructor.concat(this, ...targets);
990
+ }
991
+ toJSON(asStrings) {
992
+ const obj = /* @__PURE__ */ Object.create(null);
993
+ utils$1.forEach(this, (value, header) => {
994
+ value != null && value !== false && (obj[header] = asStrings && utils$1.isArray(value) ? value.join(", ") : value);
995
+ });
996
+ return obj;
997
+ }
998
+ [Symbol.iterator]() {
999
+ return Object.entries(this.toJSON())[Symbol.iterator]();
1000
+ }
1001
+ toString() {
1002
+ return Object.entries(this.toJSON()).map(([header, value]) => header + ": " + value).join("\n");
1003
+ }
1004
+ getSetCookie() {
1005
+ return this.get("set-cookie") || [];
1006
+ }
1007
+ get [Symbol.toStringTag]() {
1008
+ return "AxiosHeaders";
1009
+ }
1010
+ static from(thing) {
1011
+ return thing instanceof this ? thing : new this(thing);
1012
+ }
1013
+ static concat(first, ...targets) {
1014
+ const computed = new this(first);
1015
+ targets.forEach((target) => computed.set(target));
1016
+ return computed;
1017
+ }
1018
+ static accessor(header) {
1019
+ const internals = this[$internals] = this[$internals] = {
1020
+ accessors: {}
1021
+ };
1022
+ const accessors = internals.accessors;
1023
+ const prototype2 = this.prototype;
1024
+ function defineAccessor(_header) {
1025
+ const lHeader = normalizeHeader(_header);
1026
+ if (!accessors[lHeader]) {
1027
+ buildAccessors(prototype2, _header);
1028
+ accessors[lHeader] = true;
1029
+ }
1030
+ }
1031
+ utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
1032
+ return this;
1033
+ }
1034
+ };
1035
+ AxiosHeaders$1.accessor([
1036
+ "Content-Type",
1037
+ "Content-Length",
1038
+ "Accept",
1039
+ "Accept-Encoding",
1040
+ "User-Agent",
1041
+ "Authorization"
1042
+ ]);
1043
+ utils$1.reduceDescriptors(AxiosHeaders$1.prototype, ({ value }, key) => {
1044
+ let mapped = key[0].toUpperCase() + key.slice(1);
1045
+ return {
1046
+ get: () => value,
1047
+ set(headerValue) {
1048
+ this[mapped] = headerValue;
1049
+ }
1050
+ };
1051
+ });
1052
+ utils$1.freezeMethods(AxiosHeaders$1);
1053
+ const REDACTED = "[REDACTED ****]";
1054
+ function hasOwnOrPrototypeToJSON(source) {
1055
+ if (utils$1.hasOwnProp(source, "toJSON")) {
1056
+ return true;
1057
+ }
1058
+ let prototype2 = Object.getPrototypeOf(source);
1059
+ while (prototype2 && prototype2 !== Object.prototype) {
1060
+ if (utils$1.hasOwnProp(prototype2, "toJSON")) {
1061
+ return true;
1062
+ }
1063
+ prototype2 = Object.getPrototypeOf(prototype2);
1064
+ }
1065
+ return false;
1066
+ }
1067
+ function redactConfig(config, redactKeys) {
1068
+ const lowerKeys = new Set(redactKeys.map((k) => String(k).toLowerCase()));
1069
+ const seen = [];
1070
+ const visit = (source) => {
1071
+ if (source === null || typeof source !== "object") return source;
1072
+ if (utils$1.isBuffer(source)) return source;
1073
+ if (seen.indexOf(source) !== -1) return void 0;
1074
+ if (source instanceof AxiosHeaders$1) {
1075
+ source = source.toJSON();
1076
+ }
1077
+ seen.push(source);
1078
+ let result;
1079
+ if (utils$1.isArray(source)) {
1080
+ result = [];
1081
+ source.forEach((v, i) => {
1082
+ const reducedValue = visit(v);
1083
+ if (!utils$1.isUndefined(reducedValue)) {
1084
+ result[i] = reducedValue;
1085
+ }
1086
+ });
1087
+ } else {
1088
+ if (!utils$1.isPlainObject(source) && hasOwnOrPrototypeToJSON(source)) {
1089
+ seen.pop();
1090
+ return source;
1091
+ }
1092
+ result = /* @__PURE__ */ Object.create(null);
1093
+ for (const [key, value] of Object.entries(source)) {
1094
+ const reducedValue = lowerKeys.has(key.toLowerCase()) ? REDACTED : visit(value);
1095
+ if (!utils$1.isUndefined(reducedValue)) {
1096
+ result[key] = reducedValue;
1097
+ }
1098
+ }
1099
+ }
1100
+ seen.pop();
1101
+ return result;
1102
+ };
1103
+ return visit(config);
1104
+ }
1105
+ let AxiosError$1 = class AxiosError extends Error {
1106
+ static from(error, code, config, request, response, customProps) {
1107
+ const axiosError = new AxiosError(error.message, code || error.code, config, request, response);
1108
+ axiosError.cause = error;
1109
+ axiosError.name = error.name;
1110
+ if (error.status != null && axiosError.status == null) {
1111
+ axiosError.status = error.status;
1112
+ }
1113
+ customProps && Object.assign(axiosError, customProps);
1114
+ return axiosError;
1115
+ }
1116
+ /**
1117
+ * Create an Error with the specified message, config, error code, request and response.
1118
+ *
1119
+ * @param {string} message The error message.
1120
+ * @param {string} [code] The error code (for example, 'ECONNABORTED').
1121
+ * @param {Object} [config] The config.
1122
+ * @param {Object} [request] The request.
1123
+ * @param {Object} [response] The response.
1124
+ *
1125
+ * @returns {Error} The created error.
1126
+ */
1127
+ constructor(message, code, config, request, response) {
1128
+ super(message);
1129
+ Object.defineProperty(this, "message", {
1130
+ // Null-proto descriptor so a polluted Object.prototype.get cannot turn
1131
+ // this data descriptor into an accessor descriptor on the way in.
1132
+ __proto__: null,
1133
+ value: message,
1134
+ enumerable: true,
1135
+ writable: true,
1136
+ configurable: true
1137
+ });
1138
+ this.name = "AxiosError";
1139
+ this.isAxiosError = true;
1140
+ code && (this.code = code);
1141
+ config && (this.config = config);
1142
+ request && (this.request = request);
1143
+ if (response) {
1144
+ this.response = response;
1145
+ this.status = response.status;
1146
+ }
1147
+ }
1148
+ toJSON() {
1149
+ const config = this.config;
1150
+ const redactKeys = config && utils$1.hasOwnProp(config, "redact") ? config.redact : void 0;
1151
+ const serializedConfig = utils$1.isArray(redactKeys) && redactKeys.length > 0 ? redactConfig(config, redactKeys) : utils$1.toJSONObject(config);
1152
+ return {
1153
+ // Standard
1154
+ message: this.message,
1155
+ name: this.name,
1156
+ // Microsoft
1157
+ description: this.description,
1158
+ number: this.number,
1159
+ // Mozilla
1160
+ fileName: this.fileName,
1161
+ lineNumber: this.lineNumber,
1162
+ columnNumber: this.columnNumber,
1163
+ stack: this.stack,
1164
+ // Axios
1165
+ config: serializedConfig,
1166
+ code: this.code,
1167
+ status: this.status
1168
+ };
1169
+ }
1170
+ };
1171
+ AxiosError$1.ERR_BAD_OPTION_VALUE = "ERR_BAD_OPTION_VALUE";
1172
+ AxiosError$1.ERR_BAD_OPTION = "ERR_BAD_OPTION";
1173
+ AxiosError$1.ECONNABORTED = "ECONNABORTED";
1174
+ AxiosError$1.ETIMEDOUT = "ETIMEDOUT";
1175
+ AxiosError$1.ECONNREFUSED = "ECONNREFUSED";
1176
+ AxiosError$1.ERR_NETWORK = "ERR_NETWORK";
1177
+ AxiosError$1.ERR_FR_TOO_MANY_REDIRECTS = "ERR_FR_TOO_MANY_REDIRECTS";
1178
+ AxiosError$1.ERR_DEPRECATED = "ERR_DEPRECATED";
1179
+ AxiosError$1.ERR_BAD_RESPONSE = "ERR_BAD_RESPONSE";
1180
+ AxiosError$1.ERR_BAD_REQUEST = "ERR_BAD_REQUEST";
1181
+ AxiosError$1.ERR_CANCELED = "ERR_CANCELED";
1182
+ AxiosError$1.ERR_NOT_SUPPORT = "ERR_NOT_SUPPORT";
1183
+ AxiosError$1.ERR_INVALID_URL = "ERR_INVALID_URL";
1184
+ AxiosError$1.ERR_FORM_DATA_DEPTH_EXCEEDED = "ERR_FORM_DATA_DEPTH_EXCEEDED";
1185
+ const httpAdapter = null;
1186
+ const DEFAULT_FORM_DATA_MAX_DEPTH = 100;
1187
+ function isVisitable(thing) {
1188
+ return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
1189
+ }
1190
+ function removeBrackets(key) {
1191
+ return utils$1.endsWith(key, "[]") ? key.slice(0, -2) : key;
1192
+ }
1193
+ function renderKey(path, key, dots) {
1194
+ if (!path) return key;
1195
+ return path.concat(key).map(function each(token, i) {
1196
+ token = removeBrackets(token);
1197
+ return !dots && i ? "[" + token + "]" : token;
1198
+ }).join(dots ? "." : "");
1199
+ }
1200
+ function isFlatArray(arr) {
1201
+ return utils$1.isArray(arr) && !arr.some(isVisitable);
1202
+ }
1203
+ const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) {
1204
+ return /^is[A-Z]/.test(prop);
1205
+ });
1206
+ function toFormData$1(obj, formData, options) {
1207
+ if (!utils$1.isObject(obj)) {
1208
+ throw new TypeError("target must be an object");
1209
+ }
1210
+ formData = formData || new FormData();
1211
+ options = utils$1.toFlatObject(
1212
+ options,
1213
+ {
1214
+ metaTokens: true,
1215
+ dots: false,
1216
+ indexes: false
1217
+ },
1218
+ false,
1219
+ function defined(option, source) {
1220
+ return !utils$1.isUndefined(source[option]);
1221
+ }
1222
+ );
1223
+ const metaTokens = options.metaTokens;
1224
+ const visitor = options.visitor || defaultVisitor;
1225
+ const dots = options.dots;
1226
+ const indexes = options.indexes;
1227
+ const _Blob = options.Blob || typeof Blob !== "undefined" && Blob;
1228
+ const maxDepth = options.maxDepth === void 0 ? DEFAULT_FORM_DATA_MAX_DEPTH : options.maxDepth;
1229
+ const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
1230
+ const stack = [];
1231
+ if (!utils$1.isFunction(visitor)) {
1232
+ throw new TypeError("visitor must be a function");
1233
+ }
1234
+ function convertValue(value) {
1235
+ if (value === null) return "";
1236
+ if (utils$1.isDate(value)) {
1237
+ return value.toISOString();
1238
+ }
1239
+ if (utils$1.isBoolean(value)) {
1240
+ return value.toString();
1241
+ }
1242
+ if (!useBlob && utils$1.isBlob(value)) {
1243
+ throw new AxiosError$1("Blob is not supported. Use a Buffer instead.");
1244
+ }
1245
+ if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
1246
+ return useBlob && typeof Blob === "function" ? new Blob([value]) : Buffer.from(value);
1247
+ }
1248
+ return value;
1249
+ }
1250
+ function throwIfMaxDepthExceeded(depth) {
1251
+ if (depth > maxDepth) {
1252
+ throw new AxiosError$1(
1253
+ "Object is too deeply nested (" + depth + " levels). Max depth: " + maxDepth,
1254
+ AxiosError$1.ERR_FORM_DATA_DEPTH_EXCEEDED
1255
+ );
1256
+ }
1257
+ }
1258
+ function stringifyWithDepthLimit(value, depth) {
1259
+ if (maxDepth === Infinity) {
1260
+ return JSON.stringify(value);
1261
+ }
1262
+ const ancestors = [];
1263
+ return JSON.stringify(value, function limitDepth(_key, currentValue) {
1264
+ if (!utils$1.isObject(currentValue)) {
1265
+ return currentValue;
1266
+ }
1267
+ while (ancestors.length && ancestors[ancestors.length - 1] !== this) {
1268
+ ancestors.pop();
1269
+ }
1270
+ ancestors.push(currentValue);
1271
+ throwIfMaxDepthExceeded(depth + ancestors.length - 1);
1272
+ return currentValue;
1273
+ });
1274
+ }
1275
+ function defaultVisitor(value, key, path) {
1276
+ let arr = value;
1277
+ if (utils$1.isReactNative(formData) && utils$1.isReactNativeBlob(value)) {
1278
+ formData.append(renderKey(path, key, dots), convertValue(value));
1279
+ return false;
1280
+ }
1281
+ if (value && !path && typeof value === "object") {
1282
+ if (utils$1.endsWith(key, "{}")) {
1283
+ key = metaTokens ? key : key.slice(0, -2);
1284
+ value = stringifyWithDepthLimit(value, 1);
1285
+ } else if (utils$1.isArray(value) && isFlatArray(value) || (utils$1.isFileList(value) || utils$1.endsWith(key, "[]")) && (arr = utils$1.toArray(value))) {
1286
+ key = removeBrackets(key);
1287
+ arr.forEach(function each(el, index) {
1288
+ !(utils$1.isUndefined(el) || el === null) && formData.append(
1289
+ // eslint-disable-next-line no-nested-ternary
1290
+ indexes === true ? renderKey([key], index, dots) : indexes === null ? key : key + "[]",
1291
+ convertValue(el)
1292
+ );
1293
+ });
1294
+ return false;
1295
+ }
1296
+ }
1297
+ if (isVisitable(value)) {
1298
+ return true;
1299
+ }
1300
+ formData.append(renderKey(path, key, dots), convertValue(value));
1301
+ return false;
1302
+ }
1303
+ const exposedHelpers = Object.assign(predicates, {
1304
+ defaultVisitor,
1305
+ convertValue,
1306
+ isVisitable
1307
+ });
1308
+ function build(value, path, depth = 0) {
1309
+ if (utils$1.isUndefined(value)) return;
1310
+ throwIfMaxDepthExceeded(depth);
1311
+ if (stack.indexOf(value) !== -1) {
1312
+ throw new Error("Circular reference detected in " + path.join("."));
1313
+ }
1314
+ stack.push(value);
1315
+ utils$1.forEach(value, function each(el, key) {
1316
+ const result = !(utils$1.isUndefined(el) || el === null) && visitor.call(formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers);
1317
+ if (result === true) {
1318
+ build(el, path ? path.concat(key) : [key], depth + 1);
1319
+ }
1320
+ });
1321
+ stack.pop();
1322
+ }
1323
+ if (!utils$1.isObject(obj)) {
1324
+ throw new TypeError("data must be an object");
1325
+ }
1326
+ build(obj);
1327
+ return formData;
1328
+ }
1329
+ function encode$1(str) {
1330
+ const charMap = {
1331
+ "!": "%21",
1332
+ "'": "%27",
1333
+ "(": "%28",
1334
+ ")": "%29",
1335
+ "~": "%7E",
1336
+ "%20": "+"
1337
+ };
1338
+ return encodeURIComponent(str).replace(/[!'()~]|%20/g, function replacer(match) {
1339
+ return charMap[match];
1340
+ });
1341
+ }
1342
+ function AxiosURLSearchParams(params, options) {
1343
+ this._pairs = [];
1344
+ params && toFormData$1(params, this, options);
1345
+ }
1346
+ const prototype = AxiosURLSearchParams.prototype;
863
1347
  prototype.append = function append(name, value) {
864
1348
  this._pairs.push([name, value]);
865
1349
  };
@@ -878,11 +1362,11 @@ function buildURL(url, params, options) {
878
1362
  if (!params) {
879
1363
  return url;
880
1364
  }
881
- const _encode = options && options.encode || encode;
882
1365
  const _options = utils$1.isFunction(options) ? {
883
1366
  serialize: options
884
1367
  } : options;
885
- const serializeFn = _options && _options.serialize;
1368
+ const _encode = utils$1.getSafeProp(_options, "encode") || encode;
1369
+ const serializeFn = utils$1.getSafeProp(_options, "serialize");
886
1370
  let serializedParams;
887
1371
  if (serializeFn) {
888
1372
  serializedParams = serializeFn(params, _options);
@@ -964,477 +1448,233 @@ const transitionalDefaults = {
964
1448
  silentJSONParsing: true,
965
1449
  forcedJSONParsing: true,
966
1450
  clarifyTimeoutError: false,
967
- legacyInterceptorReqResOrdering: true
1451
+ legacyInterceptorReqResOrdering: true,
1452
+ advertiseZstdAcceptEncoding: false,
1453
+ validateStatusUndefinedResolves: true
968
1454
  };
969
1455
  const URLSearchParams$1 = typeof URLSearchParams !== "undefined" ? URLSearchParams : AxiosURLSearchParams;
970
- const FormData$1 = typeof FormData !== "undefined" ? FormData : null;
971
- const Blob$1 = typeof Blob !== "undefined" ? Blob : null;
972
- const platform$1 = {
973
- isBrowser: true,
974
- classes: {
975
- URLSearchParams: URLSearchParams$1,
976
- FormData: FormData$1,
977
- Blob: Blob$1
978
- },
979
- protocols: ["http", "https", "file", "blob", "url", "data"]
980
- };
981
- const hasBrowserEnv = typeof window !== "undefined" && typeof document !== "undefined";
982
- const _navigator = typeof navigator === "object" && navigator || void 0;
983
- const hasStandardBrowserEnv = hasBrowserEnv && (!_navigator || ["ReactNative", "NativeScript", "NS"].indexOf(_navigator.product) < 0);
984
- const hasStandardBrowserWebWorkerEnv = (() => {
985
- return typeof WorkerGlobalScope !== "undefined" && // eslint-disable-next-line no-undef
986
- self instanceof WorkerGlobalScope && typeof self.importScripts === "function";
987
- })();
988
- const origin = hasBrowserEnv && window.location.href || "http://localhost";
989
- const utils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
990
- __proto__: null,
991
- hasBrowserEnv,
992
- hasStandardBrowserEnv,
993
- hasStandardBrowserWebWorkerEnv,
994
- navigator: _navigator,
995
- origin
996
- }, Symbol.toStringTag, { value: "Module" }));
997
- const platform = {
998
- ...utils,
999
- ...platform$1
1000
- };
1001
- function toURLEncodedForm(data, options) {
1002
- return toFormData$1(data, new platform.classes.URLSearchParams(), {
1003
- visitor: function(value, key, path, helpers) {
1004
- if (platform.isNode && utils$1.isBuffer(value)) {
1005
- this.append(key, value.toString("base64"));
1006
- return false;
1007
- }
1008
- return helpers.defaultVisitor.apply(this, arguments);
1009
- },
1010
- ...options
1011
- });
1012
- }
1013
- function parsePropPath(name) {
1014
- return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map((match) => {
1015
- return match[0] === "[]" ? "" : match[1] || match[0];
1016
- });
1017
- }
1018
- function arrayToObject(arr) {
1019
- const obj = {};
1020
- const keys = Object.keys(arr);
1021
- let i;
1022
- const len = keys.length;
1023
- let key;
1024
- for (i = 0; i < len; i++) {
1025
- key = keys[i];
1026
- obj[key] = arr[key];
1027
- }
1028
- return obj;
1029
- }
1030
- function formDataToJSON(formData) {
1031
- function buildPath(path, value, target, index) {
1032
- let name = path[index++];
1033
- if (name === "__proto__") return true;
1034
- const isNumericKey = Number.isFinite(+name);
1035
- const isLast = index >= path.length;
1036
- name = !name && utils$1.isArray(target) ? target.length : name;
1037
- if (isLast) {
1038
- if (utils$1.hasOwnProp(target, name)) {
1039
- target[name] = [target[name], value];
1040
- } else {
1041
- target[name] = value;
1042
- }
1043
- return !isNumericKey;
1044
- }
1045
- if (!target[name] || !utils$1.isObject(target[name])) {
1046
- target[name] = [];
1047
- }
1048
- const result = buildPath(path, value, target[name], index);
1049
- if (result && utils$1.isArray(target[name])) {
1050
- target[name] = arrayToObject(target[name]);
1051
- }
1052
- return !isNumericKey;
1053
- }
1054
- if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {
1055
- const obj = {};
1056
- utils$1.forEachEntry(formData, (name, value) => {
1057
- buildPath(parsePropPath(name), value, obj, 0);
1058
- });
1059
- return obj;
1060
- }
1061
- return null;
1062
- }
1063
- function stringifySafely(rawValue, parser, encoder) {
1064
- if (utils$1.isString(rawValue)) {
1065
- try {
1066
- (parser || JSON.parse)(rawValue);
1067
- return utils$1.trim(rawValue);
1068
- } catch (e) {
1069
- if (e.name !== "SyntaxError") {
1070
- throw e;
1071
- }
1072
- }
1073
- }
1074
- return (encoder || JSON.stringify)(rawValue);
1075
- }
1076
- const defaults = {
1077
- transitional: transitionalDefaults,
1078
- adapter: ["xhr", "http", "fetch"],
1079
- transformRequest: [function transformRequest(data, headers) {
1080
- const contentType = headers.getContentType() || "";
1081
- const hasJSONContentType = contentType.indexOf("application/json") > -1;
1082
- const isObjectPayload = utils$1.isObject(data);
1083
- if (isObjectPayload && utils$1.isHTMLForm(data)) {
1084
- data = new FormData(data);
1085
- }
1086
- const isFormData2 = utils$1.isFormData(data);
1087
- if (isFormData2) {
1088
- return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
1089
- }
1090
- if (utils$1.isArrayBuffer(data) || utils$1.isBuffer(data) || utils$1.isStream(data) || utils$1.isFile(data) || utils$1.isBlob(data) || utils$1.isReadableStream(data)) {
1091
- return data;
1092
- }
1093
- if (utils$1.isArrayBufferView(data)) {
1094
- return data.buffer;
1095
- }
1096
- if (utils$1.isURLSearchParams(data)) {
1097
- headers.setContentType("application/x-www-form-urlencoded;charset=utf-8", false);
1098
- return data.toString();
1099
- }
1100
- let isFileList2;
1101
- if (isObjectPayload) {
1102
- if (contentType.indexOf("application/x-www-form-urlencoded") > -1) {
1103
- return toURLEncodedForm(data, this.formSerializer).toString();
1104
- }
1105
- if ((isFileList2 = utils$1.isFileList(data)) || contentType.indexOf("multipart/form-data") > -1) {
1106
- const _FormData = this.env && this.env.FormData;
1107
- return toFormData$1(
1108
- isFileList2 ? { "files[]": data } : data,
1109
- _FormData && new _FormData(),
1110
- this.formSerializer
1111
- );
1112
- }
1113
- }
1114
- if (isObjectPayload || hasJSONContentType) {
1115
- headers.setContentType("application/json", false);
1116
- return stringifySafely(data);
1117
- }
1118
- return data;
1119
- }],
1120
- transformResponse: [function transformResponse(data) {
1121
- const transitional2 = this.transitional || defaults.transitional;
1122
- const forcedJSONParsing = transitional2 && transitional2.forcedJSONParsing;
1123
- const JSONRequested = this.responseType === "json";
1124
- if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
1125
- return data;
1126
- }
1127
- if (data && utils$1.isString(data) && (forcedJSONParsing && !this.responseType || JSONRequested)) {
1128
- const silentJSONParsing = transitional2 && transitional2.silentJSONParsing;
1129
- const strictJSONParsing = !silentJSONParsing && JSONRequested;
1130
- try {
1131
- return JSON.parse(data, this.parseReviver);
1132
- } catch (e) {
1133
- if (strictJSONParsing) {
1134
- if (e.name === "SyntaxError") {
1135
- throw AxiosError$1.from(e, AxiosError$1.ERR_BAD_RESPONSE, this, null, this.response);
1136
- }
1137
- throw e;
1138
- }
1139
- }
1140
- }
1141
- return data;
1142
- }],
1143
- /**
1144
- * A timeout in milliseconds to abort a request. If set to 0 (default) a
1145
- * timeout is not created.
1146
- */
1147
- timeout: 0,
1148
- xsrfCookieName: "XSRF-TOKEN",
1149
- xsrfHeaderName: "X-XSRF-TOKEN",
1150
- maxContentLength: -1,
1151
- maxBodyLength: -1,
1152
- env: {
1153
- FormData: platform.classes.FormData,
1154
- Blob: platform.classes.Blob
1155
- },
1156
- validateStatus: function validateStatus(status2) {
1157
- return status2 >= 200 && status2 < 300;
1158
- },
1159
- headers: {
1160
- common: {
1161
- "Accept": "application/json, text/plain, */*",
1162
- "Content-Type": void 0
1163
- }
1164
- }
1165
- };
1166
- utils$1.forEach(["delete", "get", "head", "post", "put", "patch"], (method) => {
1167
- defaults.headers[method] = {};
1168
- });
1169
- const ignoreDuplicateOf = utils$1.toObjectSet([
1170
- "age",
1171
- "authorization",
1172
- "content-length",
1173
- "content-type",
1174
- "etag",
1175
- "expires",
1176
- "from",
1177
- "host",
1178
- "if-modified-since",
1179
- "if-unmodified-since",
1180
- "last-modified",
1181
- "location",
1182
- "max-forwards",
1183
- "proxy-authorization",
1184
- "referer",
1185
- "retry-after",
1186
- "user-agent"
1187
- ]);
1188
- const parseHeaders = (rawHeaders) => {
1189
- const parsed = {};
1190
- let key;
1191
- let val;
1192
- let i;
1193
- rawHeaders && rawHeaders.split("\n").forEach(function parser(line) {
1194
- i = line.indexOf(":");
1195
- key = line.substring(0, i).trim().toLowerCase();
1196
- val = line.substring(i + 1).trim();
1197
- if (!key || parsed[key] && ignoreDuplicateOf[key]) {
1198
- return;
1199
- }
1200
- if (key === "set-cookie") {
1201
- if (parsed[key]) {
1202
- parsed[key].push(val);
1203
- } else {
1204
- parsed[key] = [val];
1456
+ const FormData$1 = typeof FormData !== "undefined" ? FormData : null;
1457
+ const Blob$1 = typeof Blob !== "undefined" ? Blob : null;
1458
+ const platform$1 = {
1459
+ isBrowser: true,
1460
+ classes: {
1461
+ URLSearchParams: URLSearchParams$1,
1462
+ FormData: FormData$1,
1463
+ Blob: Blob$1
1464
+ },
1465
+ protocols: ["http", "https", "file", "blob", "url", "data"]
1466
+ };
1467
+ const hasBrowserEnv = typeof window !== "undefined" && typeof document !== "undefined";
1468
+ const _navigator = typeof navigator === "object" && navigator || void 0;
1469
+ const hasStandardBrowserEnv = hasBrowserEnv && (!_navigator || ["ReactNative", "NativeScript", "NS"].indexOf(_navigator.product) < 0);
1470
+ const hasStandardBrowserWebWorkerEnv = (() => {
1471
+ return typeof WorkerGlobalScope !== "undefined" && // eslint-disable-next-line no-undef
1472
+ self instanceof WorkerGlobalScope && typeof self.importScripts === "function";
1473
+ })();
1474
+ const origin = hasBrowserEnv && window.location.href || "http://localhost";
1475
+ const utils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1476
+ __proto__: null,
1477
+ hasBrowserEnv,
1478
+ hasStandardBrowserEnv,
1479
+ hasStandardBrowserWebWorkerEnv,
1480
+ navigator: _navigator,
1481
+ origin
1482
+ }, Symbol.toStringTag, { value: "Module" }));
1483
+ const platform = {
1484
+ ...utils,
1485
+ ...platform$1
1486
+ };
1487
+ function toURLEncodedForm(data, options) {
1488
+ return toFormData$1(data, new platform.classes.URLSearchParams(), {
1489
+ visitor: function(value, key, path, helpers) {
1490
+ if (platform.isNode && utils$1.isBuffer(value)) {
1491
+ this.append(key, value.toString("base64"));
1492
+ return false;
1205
1493
  }
1206
- } else {
1207
- parsed[key] = parsed[key] ? parsed[key] + ", " + val : val;
1208
- }
1494
+ return helpers.defaultVisitor.apply(this, arguments);
1495
+ },
1496
+ ...options
1209
1497
  });
1210
- return parsed;
1211
- };
1212
- const $internals = Symbol("internals");
1213
- function normalizeHeader(header) {
1214
- return header && String(header).trim().toLowerCase();
1215
1498
  }
1216
- function normalizeValue(value) {
1217
- if (value === false || value == null) {
1218
- return value;
1499
+ const MAX_DEPTH = DEFAULT_FORM_DATA_MAX_DEPTH;
1500
+ function throwIfDepthExceeded(index) {
1501
+ if (index > MAX_DEPTH) {
1502
+ throw new AxiosError$1(
1503
+ "FormData field is too deeply nested (" + index + " levels). Max depth: " + MAX_DEPTH,
1504
+ AxiosError$1.ERR_FORM_DATA_DEPTH_EXCEEDED
1505
+ );
1219
1506
  }
1220
- return utils$1.isArray(value) ? value.map(normalizeValue) : String(value);
1221
1507
  }
1222
- function parseTokens(str) {
1223
- const tokens = /* @__PURE__ */ Object.create(null);
1224
- const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
1508
+ function parsePropPath(name) {
1509
+ const path = [];
1510
+ const pattern = /\w+|\[(\w*)]/g;
1225
1511
  let match;
1226
- while (match = tokensRE.exec(str)) {
1227
- tokens[match[1]] = match[2];
1512
+ while ((match = pattern.exec(name)) !== null) {
1513
+ throwIfDepthExceeded(path.length);
1514
+ path.push(match[0] === "[]" ? "" : match[1] || match[0]);
1228
1515
  }
1229
- return tokens;
1516
+ return path;
1230
1517
  }
1231
- const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
1232
- function matchHeaderValue(context, value, header, filter2, isHeaderNameFilter) {
1233
- if (utils$1.isFunction(filter2)) {
1234
- return filter2.call(this, value, header);
1235
- }
1236
- if (isHeaderNameFilter) {
1237
- value = header;
1238
- }
1239
- if (!utils$1.isString(value)) return;
1240
- if (utils$1.isString(filter2)) {
1241
- return value.indexOf(filter2) !== -1;
1242
- }
1243
- if (utils$1.isRegExp(filter2)) {
1244
- return filter2.test(value);
1518
+ function arrayToObject(arr) {
1519
+ const obj = {};
1520
+ const keys = Object.keys(arr);
1521
+ let i;
1522
+ const len = keys.length;
1523
+ let key;
1524
+ for (i = 0; i < len; i++) {
1525
+ key = keys[i];
1526
+ obj[key] = arr[key];
1245
1527
  }
1528
+ return obj;
1246
1529
  }
1247
- function formatHeader(header) {
1248
- return header.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => {
1249
- return char.toUpperCase() + str;
1250
- });
1251
- }
1252
- function buildAccessors(obj, header) {
1253
- const accessorName = utils$1.toCamelCase(" " + header);
1254
- ["get", "set", "has"].forEach((methodName) => {
1255
- Object.defineProperty(obj, methodName + accessorName, {
1256
- value: function(arg1, arg2, arg3) {
1257
- return this[methodName].call(this, header, arg1, arg2, arg3);
1258
- },
1259
- configurable: true
1260
- });
1261
- });
1262
- }
1263
- let AxiosHeaders$1 = class AxiosHeaders {
1264
- constructor(headers) {
1265
- headers && this.set(headers);
1266
- }
1267
- set(header, valueOrRewrite, rewrite) {
1268
- const self2 = this;
1269
- function setHeader(_value, _header, _rewrite) {
1270
- const lHeader = normalizeHeader(_header);
1271
- if (!lHeader) {
1272
- throw new Error("header name must be a non-empty string");
1273
- }
1274
- const key = utils$1.findKey(self2, lHeader);
1275
- if (!key || self2[key] === void 0 || _rewrite === true || _rewrite === void 0 && self2[key] !== false) {
1276
- self2[key || _header] = normalizeValue(_value);
1277
- }
1278
- }
1279
- const setHeaders = (headers, _rewrite) => utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
1280
- if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
1281
- setHeaders(header, valueOrRewrite);
1282
- } else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
1283
- setHeaders(parseHeaders(header), valueOrRewrite);
1284
- } else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
1285
- let obj = {}, dest, key;
1286
- for (const entry of header) {
1287
- if (!utils$1.isArray(entry)) {
1288
- throw TypeError("Object iterator must return a key-value pair");
1289
- }
1290
- obj[key = entry[0]] = (dest = obj[key]) ? utils$1.isArray(dest) ? [...dest, entry[1]] : [dest, entry[1]] : entry[1];
1291
- }
1292
- setHeaders(obj, valueOrRewrite);
1293
- } else {
1294
- header != null && setHeader(valueOrRewrite, header, rewrite);
1295
- }
1296
- return this;
1297
- }
1298
- get(header, parser) {
1299
- header = normalizeHeader(header);
1300
- if (header) {
1301
- const key = utils$1.findKey(this, header);
1302
- if (key) {
1303
- const value = this[key];
1304
- if (!parser) {
1305
- return value;
1306
- }
1307
- if (parser === true) {
1308
- return parseTokens(value);
1309
- }
1310
- if (utils$1.isFunction(parser)) {
1311
- return parser.call(this, value, key);
1312
- }
1313
- if (utils$1.isRegExp(parser)) {
1314
- return parser.exec(value);
1315
- }
1316
- throw new TypeError("parser must be boolean|regexp|function");
1317
- }
1318
- }
1319
- }
1320
- has(header, matcher) {
1321
- header = normalizeHeader(header);
1322
- if (header) {
1323
- const key = utils$1.findKey(this, header);
1324
- return !!(key && this[key] !== void 0 && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
1325
- }
1326
- return false;
1327
- }
1328
- delete(header, matcher) {
1329
- const self2 = this;
1330
- let deleted = false;
1331
- function deleteHeader(_header) {
1332
- _header = normalizeHeader(_header);
1333
- if (_header) {
1334
- const key = utils$1.findKey(self2, _header);
1335
- if (key && (!matcher || matchHeaderValue(self2, self2[key], key, matcher))) {
1336
- delete self2[key];
1337
- deleted = true;
1338
- }
1530
+ function formDataToJSON(formData) {
1531
+ function buildPath(path, value, target, index) {
1532
+ throwIfDepthExceeded(index);
1533
+ let name = path[index++];
1534
+ if (name === "__proto__") return true;
1535
+ const isNumericKey = Number.isFinite(+name);
1536
+ const isLast = index >= path.length;
1537
+ name = !name && utils$1.isArray(target) ? target.length : name;
1538
+ if (isLast) {
1539
+ if (utils$1.hasOwnProp(target, name)) {
1540
+ target[name] = utils$1.isArray(target[name]) ? target[name].concat(value) : [target[name], value];
1541
+ } else {
1542
+ target[name] = value;
1339
1543
  }
1544
+ return !isNumericKey;
1340
1545
  }
1341
- if (utils$1.isArray(header)) {
1342
- header.forEach(deleteHeader);
1343
- } else {
1344
- deleteHeader(header);
1546
+ if (!utils$1.hasOwnProp(target, name) || !utils$1.isObject(target[name])) {
1547
+ target[name] = [];
1345
1548
  }
1346
- return deleted;
1347
- }
1348
- clear(matcher) {
1349
- const keys = Object.keys(this);
1350
- let i = keys.length;
1351
- let deleted = false;
1352
- while (i--) {
1353
- const key = keys[i];
1354
- if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
1355
- delete this[key];
1356
- deleted = true;
1357
- }
1549
+ const result = buildPath(path, value, target[name], index);
1550
+ if (result && utils$1.isArray(target[name])) {
1551
+ target[name] = arrayToObject(target[name]);
1358
1552
  }
1359
- return deleted;
1360
- }
1361
- normalize(format2) {
1362
- const self2 = this;
1363
- const headers = {};
1364
- utils$1.forEach(this, (value, header) => {
1365
- const key = utils$1.findKey(headers, header);
1366
- if (key) {
1367
- self2[key] = normalizeValue(value);
1368
- delete self2[header];
1369
- return;
1370
- }
1371
- const normalized = format2 ? formatHeader(header) : String(header).trim();
1372
- if (normalized !== header) {
1373
- delete self2[header];
1374
- }
1375
- self2[normalized] = normalizeValue(value);
1376
- headers[normalized] = true;
1377
- });
1378
- return this;
1379
- }
1380
- concat(...targets) {
1381
- return this.constructor.concat(this, ...targets);
1553
+ return !isNumericKey;
1382
1554
  }
1383
- toJSON(asStrings) {
1384
- const obj = /* @__PURE__ */ Object.create(null);
1385
- utils$1.forEach(this, (value, header) => {
1386
- value != null && value !== false && (obj[header] = asStrings && utils$1.isArray(value) ? value.join(", ") : value);
1555
+ if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {
1556
+ const obj = {};
1557
+ utils$1.forEachEntry(formData, (name, value) => {
1558
+ buildPath(parsePropPath(name), value, obj, 0);
1387
1559
  });
1388
1560
  return obj;
1389
1561
  }
1390
- [Symbol.iterator]() {
1391
- return Object.entries(this.toJSON())[Symbol.iterator]();
1392
- }
1393
- toString() {
1394
- return Object.entries(this.toJSON()).map(([header, value]) => header + ": " + value).join("\n");
1395
- }
1396
- getSetCookie() {
1397
- return this.get("set-cookie") || [];
1398
- }
1399
- get [Symbol.toStringTag]() {
1400
- return "AxiosHeaders";
1401
- }
1402
- static from(thing) {
1403
- return thing instanceof this ? thing : new this(thing);
1404
- }
1405
- static concat(first, ...targets) {
1406
- const computed = new this(first);
1407
- targets.forEach((target) => computed.set(target));
1408
- return computed;
1562
+ return null;
1563
+ }
1564
+ const own = (obj, key) => obj != null && utils$1.hasOwnProp(obj, key) ? obj[key] : void 0;
1565
+ function stringifySafely(rawValue, parser, encoder) {
1566
+ if (utils$1.isString(rawValue)) {
1567
+ try {
1568
+ (parser || JSON.parse)(rawValue);
1569
+ return utils$1.trim(rawValue);
1570
+ } catch (e) {
1571
+ if (e.name !== "SyntaxError") {
1572
+ throw e;
1573
+ }
1574
+ }
1409
1575
  }
1410
- static accessor(header) {
1411
- const internals = this[$internals] = this[$internals] = {
1412
- accessors: {}
1413
- };
1414
- const accessors = internals.accessors;
1415
- const prototype2 = this.prototype;
1416
- function defineAccessor(_header) {
1417
- const lHeader = normalizeHeader(_header);
1418
- if (!accessors[lHeader]) {
1419
- buildAccessors(prototype2, _header);
1420
- accessors[lHeader] = true;
1576
+ return (encoder || JSON.stringify)(rawValue);
1577
+ }
1578
+ const defaults = {
1579
+ transitional: transitionalDefaults,
1580
+ adapter: ["xhr", "http", "fetch"],
1581
+ transformRequest: [
1582
+ function transformRequest(data, headers) {
1583
+ const contentType = headers.getContentType() || "";
1584
+ const hasJSONContentType = contentType.indexOf("application/json") > -1;
1585
+ const isObjectPayload = utils$1.isObject(data);
1586
+ if (isObjectPayload && utils$1.isHTMLForm(data)) {
1587
+ data = new FormData(data);
1588
+ }
1589
+ const isFormData2 = utils$1.isFormData(data);
1590
+ if (isFormData2) {
1591
+ return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
1592
+ }
1593
+ if (utils$1.isArrayBuffer(data) || utils$1.isBuffer(data) || utils$1.isStream(data) || utils$1.isFile(data) || utils$1.isBlob(data) || utils$1.isReadableStream(data)) {
1594
+ return data;
1595
+ }
1596
+ if (utils$1.isArrayBufferView(data)) {
1597
+ return data.buffer;
1598
+ }
1599
+ if (utils$1.isURLSearchParams(data)) {
1600
+ headers.setContentType("application/x-www-form-urlencoded;charset=utf-8", false);
1601
+ return data.toString();
1602
+ }
1603
+ let isFileList2;
1604
+ if (isObjectPayload) {
1605
+ const formSerializer = own(this, "formSerializer");
1606
+ if (contentType.indexOf("application/x-www-form-urlencoded") > -1) {
1607
+ return toURLEncodedForm(data, formSerializer).toString();
1608
+ }
1609
+ if ((isFileList2 = utils$1.isFileList(data)) || contentType.indexOf("multipart/form-data") > -1) {
1610
+ const env = own(this, "env");
1611
+ const _FormData = env && env.FormData;
1612
+ return toFormData$1(
1613
+ isFileList2 ? { "files[]": data } : data,
1614
+ _FormData && new _FormData(),
1615
+ formSerializer
1616
+ );
1617
+ }
1618
+ }
1619
+ if (isObjectPayload || hasJSONContentType) {
1620
+ headers.setContentType("application/json", false);
1621
+ return stringifySafely(data);
1421
1622
  }
1623
+ return data;
1624
+ }
1625
+ ],
1626
+ transformResponse: [
1627
+ function transformResponse(data) {
1628
+ const transitional2 = own(this, "transitional") || defaults.transitional;
1629
+ const forcedJSONParsing = transitional2 && transitional2.forcedJSONParsing;
1630
+ const responseType = own(this, "responseType");
1631
+ const JSONRequested = responseType === "json";
1632
+ if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
1633
+ return data;
1634
+ }
1635
+ if (data && utils$1.isString(data) && (forcedJSONParsing && !responseType || JSONRequested)) {
1636
+ const silentJSONParsing = transitional2 && transitional2.silentJSONParsing;
1637
+ const strictJSONParsing = !silentJSONParsing && JSONRequested;
1638
+ try {
1639
+ return JSON.parse(data, own(this, "parseReviver"));
1640
+ } catch (e) {
1641
+ if (strictJSONParsing) {
1642
+ if (e.name === "SyntaxError") {
1643
+ throw AxiosError$1.from(e, AxiosError$1.ERR_BAD_RESPONSE, this, null, own(this, "response"));
1644
+ }
1645
+ throw e;
1646
+ }
1647
+ }
1648
+ }
1649
+ return data;
1650
+ }
1651
+ ],
1652
+ /**
1653
+ * A timeout in milliseconds to abort a request. If set to 0 (default) a
1654
+ * timeout is not created.
1655
+ */
1656
+ timeout: 0,
1657
+ xsrfCookieName: "XSRF-TOKEN",
1658
+ xsrfHeaderName: "X-XSRF-TOKEN",
1659
+ maxContentLength: -1,
1660
+ maxBodyLength: -1,
1661
+ env: {
1662
+ FormData: platform.classes.FormData,
1663
+ Blob: platform.classes.Blob
1664
+ },
1665
+ validateStatus: function validateStatus(status2) {
1666
+ return status2 >= 200 && status2 < 300;
1667
+ },
1668
+ headers: {
1669
+ common: {
1670
+ Accept: "application/json, text/plain, */*",
1671
+ "Content-Type": void 0
1422
1672
  }
1423
- utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
1424
- return this;
1425
1673
  }
1426
1674
  };
1427
- AxiosHeaders$1.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]);
1428
- utils$1.reduceDescriptors(AxiosHeaders$1.prototype, ({ value }, key) => {
1429
- let mapped = key[0].toUpperCase() + key.slice(1);
1430
- return {
1431
- get: () => value,
1432
- set(headerValue) {
1433
- this[mapped] = headerValue;
1434
- }
1435
- };
1675
+ utils$1.forEach(["delete", "get", "head", "post", "put", "patch", "query"], (method) => {
1676
+ defaults.headers[method] = {};
1436
1677
  });
1437
- utils$1.freezeMethods(AxiosHeaders$1);
1438
1678
  function transformData(fns, response) {
1439
1679
  const config = this || defaults;
1440
1680
  const context = response || config;
@@ -1472,7 +1712,7 @@ function settle(resolve, reject, response) {
1472
1712
  } else {
1473
1713
  reject(new AxiosError$1(
1474
1714
  "Request failed with status code " + response.status,
1475
- [AxiosError$1.ERR_BAD_REQUEST, AxiosError$1.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
1715
+ response.status >= 400 && response.status < 500 ? AxiosError$1.ERR_BAD_REQUEST : AxiosError$1.ERR_BAD_RESPONSE,
1476
1716
  response.config,
1477
1717
  response.request,
1478
1718
  response
@@ -1480,7 +1720,7 @@ function settle(resolve, reject, response) {
1480
1720
  }
1481
1721
  }
1482
1722
  function parseProtocol(url) {
1483
- const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
1723
+ const match = /^([-+\w]{1,25}):(?:\/\/)?/.exec(url);
1484
1724
  return match && match[1] || "";
1485
1725
  }
1486
1726
  function speedometer(samplesCount, min) {
@@ -1552,19 +1792,22 @@ const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
1552
1792
  let bytesNotified = 0;
1553
1793
  const _speedometer = speedometer(50, 250);
1554
1794
  return throttle((e) => {
1555
- const loaded = e.loaded;
1795
+ if (!e || typeof e.loaded !== "number") {
1796
+ return;
1797
+ }
1798
+ const rawLoaded = e.loaded;
1556
1799
  const total = e.lengthComputable ? e.total : void 0;
1557
- const progressBytes = loaded - bytesNotified;
1800
+ const loaded = total != null ? Math.min(rawLoaded, total) : rawLoaded;
1801
+ const progressBytes = Math.max(0, loaded - bytesNotified);
1558
1802
  const rate = _speedometer(progressBytes);
1559
- const inRange = loaded <= total;
1560
- bytesNotified = loaded;
1803
+ bytesNotified = Math.max(bytesNotified, loaded);
1561
1804
  const data = {
1562
1805
  loaded,
1563
1806
  total,
1564
1807
  progress: total ? loaded / total : void 0,
1565
1808
  bytes: progressBytes,
1566
1809
  rate: rate ? rate : void 0,
1567
- estimated: rate && total && inRange ? (total - loaded) / rate : void 0,
1810
+ estimated: rate && total ? (total - loaded) / rate : void 0,
1568
1811
  event: e,
1569
1812
  lengthComputable: total != null,
1570
1813
  [isDownloadStream ? "download" : "upload"]: true
@@ -1574,11 +1817,14 @@ const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
1574
1817
  };
1575
1818
  const progressEventDecorator = (total, throttled) => {
1576
1819
  const lengthComputable = total != null;
1577
- return [(loaded) => throttled[0]({
1578
- lengthComputable,
1579
- total,
1580
- loaded
1581
- }), throttled[1]];
1820
+ return [
1821
+ (loaded) => throttled[0]({
1822
+ lengthComputable,
1823
+ total,
1824
+ loaded
1825
+ }),
1826
+ throttled[1]
1827
+ ];
1582
1828
  };
1583
1829
  const asyncDecorator = (fn) => (...args) => utils$1.asap(() => fn(...args));
1584
1830
  const isURLSameOrigin = platform.hasStandardBrowserEnv ? /* @__PURE__ */ ((origin2, isMSIE) => (url) => {
@@ -1613,8 +1859,15 @@ const cookies = platform.hasStandardBrowserEnv ? (
1613
1859
  },
1614
1860
  read(name) {
1615
1861
  if (typeof document === "undefined") return null;
1616
- const match = document.cookie.match(new RegExp("(?:^|; )" + name + "=([^;]*)"));
1617
- return match ? decodeURIComponent(match[1]) : null;
1862
+ const cookies2 = document.cookie.split(";");
1863
+ for (let i = 0; i < cookies2.length; i++) {
1864
+ const cookie = cookies2[i].replace(/^\s+/, "");
1865
+ const eq = cookie.indexOf("=");
1866
+ if (eq !== -1 && cookie.slice(0, eq) === name) {
1867
+ return decodeURIComponent(cookie.slice(eq + 1));
1868
+ }
1869
+ }
1870
+ return null;
1618
1871
  },
1619
1872
  remove(name) {
1620
1873
  this.write(name, "", Date.now() - 864e5, "/");
@@ -1641,9 +1894,32 @@ function isAbsoluteURL(url) {
1641
1894
  function combineURLs(baseURL, relativeURL) {
1642
1895
  return relativeURL ? baseURL.replace(/\/?\/$/, "") + "/" + relativeURL.replace(/^\/+/, "") : baseURL;
1643
1896
  }
1644
- function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
1897
+ const malformedHttpProtocol = /^https?:(?!\/\/)/i;
1898
+ const httpProtocolControlCharacters = /[\t\n\r]/g;
1899
+ function stripLeadingC0ControlOrSpace(url) {
1900
+ let i = 0;
1901
+ while (i < url.length && url.charCodeAt(i) <= 32) {
1902
+ i++;
1903
+ }
1904
+ return url.slice(i);
1905
+ }
1906
+ function normalizeURLForProtocolCheck(url) {
1907
+ return stripLeadingC0ControlOrSpace(url).replace(httpProtocolControlCharacters, "");
1908
+ }
1909
+ function assertValidHttpProtocolURL(url, config) {
1910
+ if (typeof url === "string" && malformedHttpProtocol.test(normalizeURLForProtocolCheck(url))) {
1911
+ throw new AxiosError$1(
1912
+ 'Invalid URL: missing "//" after protocol',
1913
+ AxiosError$1.ERR_INVALID_URL,
1914
+ config
1915
+ );
1916
+ }
1917
+ }
1918
+ function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls, config) {
1919
+ assertValidHttpProtocolURL(requestedURL, config);
1645
1920
  let isRelativeUrl = !isAbsoluteURL(requestedURL);
1646
- if (baseURL && (isRelativeUrl || allowAbsoluteUrls == false)) {
1921
+ if (baseURL && (isRelativeUrl || allowAbsoluteUrls === false)) {
1922
+ assertValidHttpProtocolURL(baseURL, config);
1647
1923
  return combineURLs(baseURL, requestedURL);
1648
1924
  }
1649
1925
  return requestedURL;
@@ -1651,7 +1927,16 @@ function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
1651
1927
  const headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? { ...thing } : thing;
1652
1928
  function mergeConfig$1(config1, config2) {
1653
1929
  config2 = config2 || {};
1654
- const config = {};
1930
+ const config = /* @__PURE__ */ Object.create(null);
1931
+ Object.defineProperty(config, "hasOwnProperty", {
1932
+ // Null-proto descriptor so a polluted Object.prototype.get cannot turn
1933
+ // this data descriptor into an accessor descriptor on the way in.
1934
+ __proto__: null,
1935
+ value: Object.prototype.hasOwnProperty,
1936
+ enumerable: false,
1937
+ writable: true,
1938
+ configurable: true
1939
+ });
1655
1940
  function getMergedValue(target, source, prop, caseless) {
1656
1941
  if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
1657
1942
  return utils$1.merge.call({ caseless }, target, source);
@@ -1681,10 +1966,27 @@ function mergeConfig$1(config1, config2) {
1681
1966
  return getMergedValue(void 0, a);
1682
1967
  }
1683
1968
  }
1969
+ function getMergedTransitionalOption(prop) {
1970
+ const transitional2 = utils$1.hasOwnProp(config2, "transitional") ? config2.transitional : void 0;
1971
+ if (!utils$1.isUndefined(transitional2)) {
1972
+ if (utils$1.isPlainObject(transitional2)) {
1973
+ if (utils$1.hasOwnProp(transitional2, prop)) {
1974
+ return transitional2[prop];
1975
+ }
1976
+ } else {
1977
+ return void 0;
1978
+ }
1979
+ }
1980
+ const transitional1 = utils$1.hasOwnProp(config1, "transitional") ? config1.transitional : void 0;
1981
+ if (utils$1.isPlainObject(transitional1) && utils$1.hasOwnProp(transitional1, prop)) {
1982
+ return transitional1[prop];
1983
+ }
1984
+ return void 0;
1985
+ }
1684
1986
  function mergeDirectKeys(a, b, prop) {
1685
- if (prop in config2) {
1987
+ if (utils$1.hasOwnProp(config2, prop)) {
1686
1988
  return getMergedValue(a, b);
1687
- } else if (prop in config1) {
1989
+ } else if (utils$1.hasOwnProp(config1, prop)) {
1688
1990
  return getMergedValue(void 0, a);
1689
1991
  }
1690
1992
  }
@@ -1715,49 +2017,83 @@ function mergeConfig$1(config1, config2) {
1715
2017
  httpsAgent: defaultToConfig2,
1716
2018
  cancelToken: defaultToConfig2,
1717
2019
  socketPath: defaultToConfig2,
2020
+ allowedSocketPaths: defaultToConfig2,
1718
2021
  responseEncoding: defaultToConfig2,
1719
2022
  validateStatus: mergeDirectKeys,
1720
2023
  headers: (a, b, prop) => mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true)
1721
2024
  };
1722
- utils$1.forEach(
1723
- Object.keys({ ...config1, ...config2 }),
1724
- function computeConfigValue(prop) {
1725
- if (prop === "__proto__" || prop === "constructor" || prop === "prototype")
1726
- return;
1727
- const merge2 = utils$1.hasOwnProp(mergeMap, prop) ? mergeMap[prop] : mergeDeepProperties;
1728
- const configValue = merge2(config1[prop], config2[prop], prop);
1729
- utils$1.isUndefined(configValue) && merge2 !== mergeDirectKeys || (config[prop] = configValue);
2025
+ utils$1.forEach(Object.keys({ ...config1, ...config2 }), function computeConfigValue(prop) {
2026
+ if (prop === "__proto__" || prop === "constructor" || prop === "prototype") return;
2027
+ const merge2 = utils$1.hasOwnProp(mergeMap, prop) ? mergeMap[prop] : mergeDeepProperties;
2028
+ const a = utils$1.hasOwnProp(config1, prop) ? config1[prop] : void 0;
2029
+ const b = utils$1.hasOwnProp(config2, prop) ? config2[prop] : void 0;
2030
+ const configValue = merge2(a, b, prop);
2031
+ utils$1.isUndefined(configValue) && merge2 !== mergeDirectKeys || (config[prop] = configValue);
2032
+ });
2033
+ if (utils$1.hasOwnProp(config2, "validateStatus") && utils$1.isUndefined(config2.validateStatus) && getMergedTransitionalOption("validateStatusUndefinedResolves") === false) {
2034
+ if (utils$1.hasOwnProp(config1, "validateStatus")) {
2035
+ config.validateStatus = getMergedValue(void 0, config1.validateStatus);
2036
+ } else {
2037
+ delete config.validateStatus;
1730
2038
  }
1731
- );
2039
+ }
1732
2040
  return config;
1733
2041
  }
1734
- const resolveConfig = (config) => {
2042
+ const FORM_DATA_CONTENT_HEADERS = ["content-type", "content-length"];
2043
+ function setFormDataHeaders(headers, formHeaders, policy) {
2044
+ if (policy !== "content-only") {
2045
+ headers.set(formHeaders);
2046
+ return;
2047
+ }
2048
+ Object.entries(formHeaders).forEach(([key, val]) => {
2049
+ if (FORM_DATA_CONTENT_HEADERS.includes(key.toLowerCase())) {
2050
+ headers.set(key, val);
2051
+ }
2052
+ });
2053
+ }
2054
+ const encodeUTF8$1 = (str) => encodeURIComponent(str).replace(
2055
+ /%([0-9A-F]{2})/gi,
2056
+ (_, hex) => String.fromCharCode(parseInt(hex, 16))
2057
+ );
2058
+ function resolveConfig(config) {
1735
2059
  const newConfig = mergeConfig$1({}, config);
1736
- let { data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth: auth2 } = newConfig;
2060
+ const own2 = (key) => utils$1.hasOwnProp(newConfig, key) ? newConfig[key] : void 0;
2061
+ const data = own2("data");
2062
+ let withXSRFToken = own2("withXSRFToken");
2063
+ const xsrfHeaderName = own2("xsrfHeaderName");
2064
+ const xsrfCookieName = own2("xsrfCookieName");
2065
+ let headers = own2("headers");
2066
+ const auth2 = own2("auth");
2067
+ const baseURL = own2("baseURL");
2068
+ const allowAbsoluteUrls = own2("allowAbsoluteUrls");
2069
+ const url = own2("url");
1737
2070
  newConfig.headers = headers = AxiosHeaders$1.from(headers);
1738
- newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls), config.params, config.paramsSerializer);
2071
+ newConfig.url = buildURL(
2072
+ buildFullPath(baseURL, url, allowAbsoluteUrls, newConfig),
2073
+ own2("params"),
2074
+ own2("paramsSerializer")
2075
+ );
1739
2076
  if (auth2) {
2077
+ const username = utils$1.getSafeProp(auth2, "username") || "";
2078
+ const password = utils$1.getSafeProp(auth2, "password") || "";
1740
2079
  headers.set(
1741
2080
  "Authorization",
1742
- "Basic " + btoa((auth2.username || "") + ":" + (auth2.password ? unescape(encodeURIComponent(auth2.password)) : ""))
2081
+ "Basic " + btoa(username + ":" + (password ? encodeUTF8$1(password) : ""))
1743
2082
  );
1744
2083
  }
1745
2084
  if (utils$1.isFormData(data)) {
1746
- if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
2085
+ if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv || utils$1.isReactNative(data)) {
1747
2086
  headers.setContentType(void 0);
1748
2087
  } else if (utils$1.isFunction(data.getHeaders)) {
1749
- const formHeaders = data.getHeaders();
1750
- const allowedHeaders = ["content-type", "content-length"];
1751
- Object.entries(formHeaders).forEach(([key, val]) => {
1752
- if (allowedHeaders.includes(key.toLowerCase())) {
1753
- headers.set(key, val);
1754
- }
1755
- });
2088
+ setFormDataHeaders(headers, data.getHeaders(), own2("formDataHeaderPolicy"));
1756
2089
  }
1757
2090
  }
1758
2091
  if (platform.hasStandardBrowserEnv) {
1759
- withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
1760
- if (withXSRFToken || withXSRFToken !== false && isURLSameOrigin(newConfig.url)) {
2092
+ if (utils$1.isFunction(withXSRFToken)) {
2093
+ withXSRFToken = withXSRFToken(newConfig);
2094
+ }
2095
+ const shouldSendXSRF = withXSRFToken === true || withXSRFToken == null && isURLSameOrigin(newConfig.url);
2096
+ if (shouldSendXSRF) {
1761
2097
  const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
1762
2098
  if (xsrfValue) {
1763
2099
  headers.set(xsrfHeaderName, xsrfValue);
@@ -1765,7 +2101,7 @@ const resolveConfig = (config) => {
1765
2101
  }
1766
2102
  }
1767
2103
  return newConfig;
1768
- };
2104
+ }
1769
2105
  const isXHRAdapterSupported = typeof XMLHttpRequest !== "undefined";
1770
2106
  const xhrAdapter = isXHRAdapterSupported && function(config) {
1771
2107
  return new Promise(function dispatchXhrRequest(resolve, reject) {
@@ -1801,13 +2137,17 @@ const xhrAdapter = isXHRAdapterSupported && function(config) {
1801
2137
  config,
1802
2138
  request
1803
2139
  };
1804
- settle(function _resolve(value) {
1805
- resolve(value);
1806
- done();
1807
- }, function _reject(err) {
1808
- reject(err);
1809
- done();
1810
- }, response);
2140
+ settle(
2141
+ function _resolve(value) {
2142
+ resolve(value);
2143
+ done();
2144
+ },
2145
+ function _reject(err) {
2146
+ reject(err);
2147
+ done();
2148
+ },
2149
+ response
2150
+ );
1811
2151
  request = null;
1812
2152
  }
1813
2153
  if ("onloadend" in request) {
@@ -1817,7 +2157,7 @@ const xhrAdapter = isXHRAdapterSupported && function(config) {
1817
2157
  if (!request || request.readyState !== 4) {
1818
2158
  return;
1819
2159
  }
1820
- if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf("file:") === 0)) {
2160
+ if (request.status === 0 && !(request.responseURL && request.responseURL.startsWith("file:"))) {
1821
2161
  return;
1822
2162
  }
1823
2163
  setTimeout(onloadend);
@@ -1828,6 +2168,7 @@ const xhrAdapter = isXHRAdapterSupported && function(config) {
1828
2168
  return;
1829
2169
  }
1830
2170
  reject(new AxiosError$1("Request aborted", AxiosError$1.ECONNABORTED, config, request));
2171
+ done();
1831
2172
  request = null;
1832
2173
  };
1833
2174
  request.onerror = function handleError(event) {
@@ -1835,6 +2176,7 @@ const xhrAdapter = isXHRAdapterSupported && function(config) {
1835
2176
  const err = new AxiosError$1(msg, AxiosError$1.ERR_NETWORK, config, request);
1836
2177
  err.event = event || null;
1837
2178
  reject(err);
2179
+ done();
1838
2180
  request = null;
1839
2181
  };
1840
2182
  request.ontimeout = function handleTimeout() {
@@ -1843,17 +2185,20 @@ const xhrAdapter = isXHRAdapterSupported && function(config) {
1843
2185
  if (_config.timeoutErrorMessage) {
1844
2186
  timeoutErrorMessage = _config.timeoutErrorMessage;
1845
2187
  }
1846
- reject(new AxiosError$1(
1847
- timeoutErrorMessage,
1848
- transitional2.clarifyTimeoutError ? AxiosError$1.ETIMEDOUT : AxiosError$1.ECONNABORTED,
1849
- config,
1850
- request
1851
- ));
2188
+ reject(
2189
+ new AxiosError$1(
2190
+ timeoutErrorMessage,
2191
+ transitional2.clarifyTimeoutError ? AxiosError$1.ETIMEDOUT : AxiosError$1.ECONNABORTED,
2192
+ config,
2193
+ request
2194
+ )
2195
+ );
2196
+ done();
1852
2197
  request = null;
1853
2198
  };
1854
2199
  requestData === void 0 && requestHeaders.setContentType(null);
1855
2200
  if ("setRequestHeader" in request) {
1856
- utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
2201
+ utils$1.forEach(toByteStringHeaderObject(requestHeaders), function setRequestHeader(val, key) {
1857
2202
  request.setRequestHeader(key, val);
1858
2203
  });
1859
2204
  }
@@ -1879,6 +2224,7 @@ const xhrAdapter = isXHRAdapterSupported && function(config) {
1879
2224
  }
1880
2225
  reject(!cancel || cancel.type ? new CanceledError$1(null, config, request) : cancel);
1881
2226
  request.abort();
2227
+ done();
1882
2228
  request = null;
1883
2229
  };
1884
2230
  _config.cancelToken && _config.cancelToken.subscribe(onCanceled);
@@ -1887,45 +2233,55 @@ const xhrAdapter = isXHRAdapterSupported && function(config) {
1887
2233
  }
1888
2234
  }
1889
2235
  const protocol = parseProtocol(_config.url);
1890
- if (protocol && platform.protocols.indexOf(protocol) === -1) {
1891
- reject(new AxiosError$1("Unsupported protocol " + protocol + ":", AxiosError$1.ERR_BAD_REQUEST, config));
2236
+ if (protocol && !platform.protocols.includes(protocol)) {
2237
+ reject(
2238
+ new AxiosError$1(
2239
+ "Unsupported protocol " + protocol + ":",
2240
+ AxiosError$1.ERR_BAD_REQUEST,
2241
+ config
2242
+ )
2243
+ );
1892
2244
  return;
1893
2245
  }
1894
2246
  request.send(requestData || null);
1895
2247
  });
1896
2248
  };
1897
2249
  const composeSignals = (signals, timeout) => {
1898
- const { length } = signals = signals ? signals.filter(Boolean) : [];
1899
- if (timeout || length) {
1900
- let controller = new AbortController();
1901
- let aborted;
1902
- const onabort = function(reason) {
1903
- if (!aborted) {
1904
- aborted = true;
1905
- unsubscribe();
1906
- const err = reason instanceof Error ? reason : this.reason;
1907
- controller.abort(err instanceof AxiosError$1 ? err : new CanceledError$1(err instanceof Error ? err.message : err));
1908
- }
1909
- };
1910
- let timer = timeout && setTimeout(() => {
1911
- timer = null;
1912
- onabort(new AxiosError$1(`timeout of ${timeout}ms exceeded`, AxiosError$1.ETIMEDOUT));
1913
- }, timeout);
1914
- const unsubscribe = () => {
1915
- if (signals) {
1916
- timer && clearTimeout(timer);
1917
- timer = null;
1918
- signals.forEach((signal2) => {
1919
- signal2.unsubscribe ? signal2.unsubscribe(onabort) : signal2.removeEventListener("abort", onabort);
1920
- });
1921
- signals = null;
1922
- }
1923
- };
1924
- signals.forEach((signal2) => signal2.addEventListener("abort", onabort));
1925
- const { signal } = controller;
1926
- signal.unsubscribe = () => utils$1.asap(unsubscribe);
1927
- return signal;
2250
+ signals = signals ? signals.filter(Boolean) : [];
2251
+ if (!timeout && !signals.length) {
2252
+ return;
1928
2253
  }
2254
+ const controller = new AbortController();
2255
+ let aborted = false;
2256
+ const onabort = function(reason) {
2257
+ if (!aborted) {
2258
+ aborted = true;
2259
+ unsubscribe();
2260
+ const err = reason instanceof Error ? reason : this.reason;
2261
+ controller.abort(
2262
+ err instanceof AxiosError$1 ? err : new CanceledError$1(err instanceof Error ? err.message : err)
2263
+ );
2264
+ }
2265
+ };
2266
+ let timer = timeout && setTimeout(() => {
2267
+ timer = null;
2268
+ onabort(new AxiosError$1(`timeout of ${timeout}ms exceeded`, AxiosError$1.ETIMEDOUT));
2269
+ }, timeout);
2270
+ const unsubscribe = () => {
2271
+ if (!signals) {
2272
+ return;
2273
+ }
2274
+ timer && clearTimeout(timer);
2275
+ timer = null;
2276
+ signals.forEach((signal2) => {
2277
+ signal2.unsubscribe ? signal2.unsubscribe(onabort) : signal2.removeEventListener("abort", onabort);
2278
+ });
2279
+ signals = null;
2280
+ };
2281
+ signals.forEach((signal2) => signal2.addEventListener("abort", onabort));
2282
+ const { signal } = controller;
2283
+ signal.unsubscribe = () => utils$1.asap(unsubscribe);
2284
+ return signal;
1929
2285
  };
1930
2286
  const streamChunk = function* (chunk, chunkSize) {
1931
2287
  let len = chunk.byteLength;
@@ -1974,44 +2330,127 @@ const trackStream = (stream, chunkSize, onProgress, onFinish) => {
1974
2330
  onFinish && onFinish(e);
1975
2331
  }
1976
2332
  };
1977
- return new ReadableStream({
1978
- async pull(controller) {
1979
- try {
1980
- const { done: done2, value } = await iterator2.next();
1981
- if (done2) {
1982
- _onFinish();
1983
- controller.close();
1984
- return;
1985
- }
1986
- let len = value.byteLength;
1987
- if (onProgress) {
1988
- let loadedBytes = bytes += len;
1989
- onProgress(loadedBytes);
2333
+ return new ReadableStream(
2334
+ {
2335
+ async pull(controller) {
2336
+ try {
2337
+ const { done: done2, value } = await iterator2.next();
2338
+ if (done2) {
2339
+ _onFinish();
2340
+ controller.close();
2341
+ return;
2342
+ }
2343
+ let len = value.byteLength;
2344
+ if (onProgress) {
2345
+ let loadedBytes = bytes += len;
2346
+ onProgress(loadedBytes);
2347
+ }
2348
+ controller.enqueue(new Uint8Array(value));
2349
+ } catch (err) {
2350
+ _onFinish(err);
2351
+ throw err;
1990
2352
  }
1991
- controller.enqueue(new Uint8Array(value));
1992
- } catch (err) {
1993
- _onFinish(err);
1994
- throw err;
2353
+ },
2354
+ cancel(reason) {
2355
+ _onFinish(reason);
2356
+ return iterator2.return();
1995
2357
  }
1996
2358
  },
1997
- cancel(reason) {
1998
- _onFinish(reason);
1999
- return iterator2.return();
2359
+ {
2360
+ highWaterMark: 2
2000
2361
  }
2001
- }, {
2002
- highWaterMark: 2
2003
- });
2362
+ );
2004
2363
  };
2364
+ const isHexDigit = (charCode) => charCode >= 48 && charCode <= 57 || charCode >= 65 && charCode <= 70 || charCode >= 97 && charCode <= 102;
2365
+ const isPercentEncodedByte = (str, i, len) => i + 2 < len && isHexDigit(str.charCodeAt(i + 1)) && isHexDigit(str.charCodeAt(i + 2));
2366
+ function estimateDataURLDecodedBytes(url) {
2367
+ if (!url || typeof url !== "string") return 0;
2368
+ if (!url.startsWith("data:")) return 0;
2369
+ const comma = url.indexOf(",");
2370
+ if (comma < 0) return 0;
2371
+ const meta = url.slice(5, comma);
2372
+ const body = url.slice(comma + 1);
2373
+ const isBase64 = /;base64/i.test(meta);
2374
+ if (isBase64) {
2375
+ let effectiveLen = body.length;
2376
+ const len = body.length;
2377
+ for (let i = 0; i < len; i++) {
2378
+ if (body.charCodeAt(i) === 37 && i + 2 < len) {
2379
+ const a = body.charCodeAt(i + 1);
2380
+ const b = body.charCodeAt(i + 2);
2381
+ const isHex = isHexDigit(a) && isHexDigit(b);
2382
+ if (isHex) {
2383
+ effectiveLen -= 2;
2384
+ i += 2;
2385
+ }
2386
+ }
2387
+ }
2388
+ let pad = 0;
2389
+ let idx = len - 1;
2390
+ const tailIsPct3D = (j) => j >= 2 && body.charCodeAt(j - 2) === 37 && // '%'
2391
+ body.charCodeAt(j - 1) === 51 && // '3'
2392
+ (body.charCodeAt(j) === 68 || body.charCodeAt(j) === 100);
2393
+ if (idx >= 0) {
2394
+ if (body.charCodeAt(idx) === 61) {
2395
+ pad++;
2396
+ idx--;
2397
+ } else if (tailIsPct3D(idx)) {
2398
+ pad++;
2399
+ idx -= 3;
2400
+ }
2401
+ }
2402
+ if (pad === 1 && idx >= 0) {
2403
+ if (body.charCodeAt(idx) === 61) {
2404
+ pad++;
2405
+ } else if (tailIsPct3D(idx)) {
2406
+ pad++;
2407
+ }
2408
+ }
2409
+ const groups = Math.floor(effectiveLen / 4);
2410
+ const bytes2 = groups * 3 - (pad || 0);
2411
+ return bytes2 > 0 ? bytes2 : 0;
2412
+ }
2413
+ let bytes = 0;
2414
+ for (let i = 0, len = body.length; i < len; i++) {
2415
+ const c = body.charCodeAt(i);
2416
+ if (c === 37 && isPercentEncodedByte(body, i, len)) {
2417
+ bytes += 1;
2418
+ i += 2;
2419
+ } else if (c < 128) {
2420
+ bytes += 1;
2421
+ } else if (c < 2048) {
2422
+ bytes += 2;
2423
+ } else if (c >= 55296 && c <= 56319 && i + 1 < len) {
2424
+ const next = body.charCodeAt(i + 1);
2425
+ if (next >= 56320 && next <= 57343) {
2426
+ bytes += 4;
2427
+ i++;
2428
+ } else {
2429
+ bytes += 3;
2430
+ }
2431
+ } else {
2432
+ bytes += 3;
2433
+ }
2434
+ }
2435
+ return bytes;
2436
+ }
2437
+ const VERSION$1 = "1.18.0";
2005
2438
  const DEFAULT_CHUNK_SIZE = 64 * 1024;
2006
2439
  const { isFunction } = utils$1;
2007
- const globalFetchAPI = (({ Request, Response }) => ({
2008
- Request,
2009
- Response
2010
- }))(utils$1.global);
2011
- const {
2012
- ReadableStream: ReadableStream$1,
2013
- TextEncoder
2014
- } = utils$1.global;
2440
+ const encodeUTF8 = (str) => encodeURIComponent(str).replace(
2441
+ /%([0-9A-F]{2})/gi,
2442
+ (_, hex) => String.fromCharCode(parseInt(hex, 16))
2443
+ );
2444
+ const decodeURIComponentSafe = (value) => {
2445
+ if (!utils$1.isString(value)) {
2446
+ return value;
2447
+ }
2448
+ try {
2449
+ return decodeURIComponent(value);
2450
+ } catch (error) {
2451
+ return value;
2452
+ }
2453
+ };
2015
2454
  const test = (fn, ...args) => {
2016
2455
  try {
2017
2456
  return !!fn(...args);
@@ -2019,10 +2458,27 @@ const test = (fn, ...args) => {
2019
2458
  return false;
2020
2459
  }
2021
2460
  };
2461
+ const maybeWithAuthCredentials = (url) => {
2462
+ const protocolIndex = url.indexOf("://");
2463
+ let urlToCheck = url;
2464
+ if (protocolIndex !== -1) {
2465
+ urlToCheck = urlToCheck.slice(protocolIndex + 3);
2466
+ }
2467
+ return urlToCheck.includes("@") || urlToCheck.includes(":");
2468
+ };
2022
2469
  const factory = (env) => {
2023
- env = utils$1.merge.call({
2024
- skipUndefined: true
2025
- }, globalFetchAPI, env);
2470
+ const globalObject = utils$1.global !== void 0 && utils$1.global !== null ? utils$1.global : globalThis;
2471
+ const { ReadableStream: ReadableStream2, TextEncoder } = globalObject;
2472
+ env = utils$1.merge.call(
2473
+ {
2474
+ skipUndefined: true
2475
+ },
2476
+ {
2477
+ Request: globalObject.Request,
2478
+ Response: globalObject.Response
2479
+ },
2480
+ env
2481
+ );
2026
2482
  const { fetch: envFetch, Request, Response } = env;
2027
2483
  const isFetchSupported = envFetch ? isFunction(envFetch) : typeof fetch === "function";
2028
2484
  const isRequestSupported = isFunction(Request);
@@ -2030,18 +2486,22 @@ const factory = (env) => {
2030
2486
  if (!isFetchSupported) {
2031
2487
  return false;
2032
2488
  }
2033
- const isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream$1);
2489
+ const isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream2);
2034
2490
  const encodeText = isFetchSupported && (typeof TextEncoder === "function" ? /* @__PURE__ */ ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) : async (str) => new Uint8Array(await new Request(str).arrayBuffer()));
2035
2491
  const supportsRequestStream = isRequestSupported && isReadableStreamSupported && test(() => {
2036
2492
  let duplexAccessed = false;
2037
- const hasContentType = new Request(platform.origin, {
2038
- body: new ReadableStream$1(),
2493
+ const request = new Request(platform.origin, {
2494
+ body: new ReadableStream2(),
2039
2495
  method: "POST",
2040
2496
  get duplex() {
2041
2497
  duplexAccessed = true;
2042
2498
  return "half";
2043
2499
  }
2044
- }).headers.has("Content-Type");
2500
+ });
2501
+ const hasContentType = request.headers.has("Content-Type");
2502
+ if (request.body != null) {
2503
+ request.body.cancel();
2504
+ }
2045
2505
  return duplexAccessed && !hasContentType;
2046
2506
  });
2047
2507
  const supportsResponseStream = isResponseSupported && isReadableStreamSupported && test(() => utils$1.isReadableStream(new Response("").body));
@@ -2055,7 +2515,11 @@ const factory = (env) => {
2055
2515
  if (method) {
2056
2516
  return method.call(res);
2057
2517
  }
2058
- throw new AxiosError$1(`Response type '${type}' is not supported`, AxiosError$1.ERR_NOT_SUPPORT, config);
2518
+ throw new AxiosError$1(
2519
+ `Response type '${type}' is not supported`,
2520
+ AxiosError$1.ERR_NOT_SUPPORT,
2521
+ config
2522
+ );
2059
2523
  });
2060
2524
  });
2061
2525
  })();
@@ -2100,63 +2564,189 @@ const factory = (env) => {
2100
2564
  responseType,
2101
2565
  headers,
2102
2566
  withCredentials = "same-origin",
2103
- fetchOptions
2567
+ fetchOptions,
2568
+ maxContentLength,
2569
+ maxBodyLength
2104
2570
  } = resolveConfig(config);
2571
+ const hasMaxContentLength = utils$1.isNumber(maxContentLength) && maxContentLength > -1;
2572
+ const hasMaxBodyLength = utils$1.isNumber(maxBodyLength) && maxBodyLength > -1;
2573
+ const own2 = (key) => utils$1.hasOwnProp(config, key) ? config[key] : void 0;
2105
2574
  let _fetch = envFetch || fetch;
2106
2575
  responseType = responseType ? (responseType + "").toLowerCase() : "text";
2107
- let composedSignal = composeSignals([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
2576
+ let composedSignal = composeSignals(
2577
+ [signal, cancelToken && cancelToken.toAbortSignal()],
2578
+ timeout
2579
+ );
2108
2580
  let request = null;
2109
2581
  const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
2110
2582
  composedSignal.unsubscribe();
2111
2583
  });
2112
2584
  let requestContentLength;
2585
+ let pendingBodyError = null;
2586
+ const maxBodyLengthError = () => new AxiosError$1(
2587
+ "Request body larger than maxBodyLength limit",
2588
+ AxiosError$1.ERR_BAD_REQUEST,
2589
+ config,
2590
+ request
2591
+ );
2113
2592
  try {
2114
- if (onUploadProgress && supportsRequestStream && method !== "get" && method !== "head" && (requestContentLength = await resolveBodyLength(headers, data)) !== 0) {
2115
- let _request = new Request(url, {
2116
- method: "POST",
2117
- body: data,
2118
- duplex: "half"
2119
- });
2120
- let contentTypeHeader;
2121
- if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get("content-type"))) {
2122
- headers.setContentType(contentTypeHeader);
2593
+ let auth2 = void 0;
2594
+ const configAuth = own2("auth");
2595
+ if (configAuth) {
2596
+ const username = utils$1.getSafeProp(configAuth, "username") || "";
2597
+ const password = utils$1.getSafeProp(configAuth, "password") || "";
2598
+ auth2 = {
2599
+ username,
2600
+ password
2601
+ };
2602
+ }
2603
+ if (maybeWithAuthCredentials(url)) {
2604
+ const parsedURL = new URL(url, platform.origin);
2605
+ if (!auth2 && (parsedURL.username || parsedURL.password)) {
2606
+ const urlUsername = decodeURIComponentSafe(parsedURL.username);
2607
+ const urlPassword = decodeURIComponentSafe(parsedURL.password);
2608
+ auth2 = {
2609
+ username: urlUsername,
2610
+ password: urlPassword
2611
+ };
2612
+ }
2613
+ if (parsedURL.username || parsedURL.password) {
2614
+ parsedURL.username = "";
2615
+ parsedURL.password = "";
2616
+ url = parsedURL.href;
2123
2617
  }
2124
- if (_request.body) {
2125
- const [onProgress, flush] = progressEventDecorator(
2126
- requestContentLength,
2127
- progressEventReducer(asyncDecorator(onUploadProgress))
2618
+ }
2619
+ if (auth2) {
2620
+ headers.delete("authorization");
2621
+ headers.set(
2622
+ "Authorization",
2623
+ "Basic " + btoa(encodeUTF8((auth2.username || "") + ":" + (auth2.password || "")))
2624
+ );
2625
+ }
2626
+ if (hasMaxContentLength && typeof url === "string" && url.startsWith("data:")) {
2627
+ const estimated = estimateDataURLDecodedBytes(url);
2628
+ if (estimated > maxContentLength) {
2629
+ throw new AxiosError$1(
2630
+ "maxContentLength size of " + maxContentLength + " exceeded",
2631
+ AxiosError$1.ERR_BAD_RESPONSE,
2632
+ config,
2633
+ request
2128
2634
  );
2129
- data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
2130
2635
  }
2131
2636
  }
2637
+ if (hasMaxBodyLength && method !== "get" && method !== "head") {
2638
+ const outboundLength = await getBodyLength(data);
2639
+ if (typeof outboundLength === "number" && isFinite(outboundLength)) {
2640
+ requestContentLength = outboundLength;
2641
+ if (outboundLength > maxBodyLength) {
2642
+ throw maxBodyLengthError();
2643
+ }
2644
+ }
2645
+ }
2646
+ const mustEnforceStreamBody = hasMaxBodyLength && (utils$1.isReadableStream(data) || utils$1.isStream(data));
2647
+ const trackRequestStream = (stream, onProgress, flush) => trackStream(
2648
+ stream,
2649
+ DEFAULT_CHUNK_SIZE,
2650
+ (loadedBytes) => {
2651
+ if (hasMaxBodyLength && loadedBytes > maxBodyLength) {
2652
+ throw pendingBodyError = maxBodyLengthError();
2653
+ }
2654
+ onProgress && onProgress(loadedBytes);
2655
+ },
2656
+ flush
2657
+ );
2658
+ if (supportsRequestStream && method !== "get" && method !== "head" && (onUploadProgress || mustEnforceStreamBody)) {
2659
+ requestContentLength = requestContentLength == null ? await resolveBodyLength(headers, data) : requestContentLength;
2660
+ if (requestContentLength !== 0 || mustEnforceStreamBody) {
2661
+ let _request = new Request(url, {
2662
+ method: "POST",
2663
+ body: data,
2664
+ duplex: "half"
2665
+ });
2666
+ let contentTypeHeader;
2667
+ if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get("content-type"))) {
2668
+ headers.setContentType(contentTypeHeader);
2669
+ }
2670
+ if (_request.body) {
2671
+ const [onProgress, flush] = onUploadProgress && progressEventDecorator(
2672
+ requestContentLength,
2673
+ progressEventReducer(asyncDecorator(onUploadProgress))
2674
+ ) || [];
2675
+ data = trackRequestStream(_request.body, onProgress, flush);
2676
+ }
2677
+ }
2678
+ } else if (mustEnforceStreamBody && !isRequestSupported && isReadableStreamSupported && method !== "get" && method !== "head") {
2679
+ data = trackRequestStream(data);
2680
+ } else if (mustEnforceStreamBody && isRequestSupported && !supportsRequestStream && method !== "get" && method !== "head") {
2681
+ throw new AxiosError$1(
2682
+ "Stream request bodies are not supported by the current fetch implementation",
2683
+ AxiosError$1.ERR_NOT_SUPPORT,
2684
+ config,
2685
+ request
2686
+ );
2687
+ }
2132
2688
  if (!utils$1.isString(withCredentials)) {
2133
2689
  withCredentials = withCredentials ? "include" : "omit";
2134
2690
  }
2135
2691
  const isCredentialsSupported = isRequestSupported && "credentials" in Request.prototype;
2692
+ if (utils$1.isFormData(data)) {
2693
+ const contentType = headers.getContentType();
2694
+ if (contentType && /^multipart\/form-data/i.test(contentType) && !/boundary=/i.test(contentType)) {
2695
+ headers.delete("content-type");
2696
+ }
2697
+ }
2698
+ headers.set("User-Agent", "axios/" + VERSION$1, false);
2136
2699
  const resolvedOptions = {
2137
2700
  ...fetchOptions,
2138
2701
  signal: composedSignal,
2139
2702
  method: method.toUpperCase(),
2140
- headers: headers.normalize().toJSON(),
2703
+ headers: toByteStringHeaderObject(headers.normalize()),
2141
2704
  body: data,
2142
2705
  duplex: "half",
2143
2706
  credentials: isCredentialsSupported ? withCredentials : void 0
2144
2707
  };
2145
2708
  request = isRequestSupported && new Request(url, resolvedOptions);
2146
2709
  let response = await (isRequestSupported ? _fetch(request, fetchOptions) : _fetch(url, resolvedOptions));
2710
+ const responseHeaders = AxiosHeaders$1.from(response.headers);
2711
+ if (hasMaxContentLength) {
2712
+ const declaredLength = utils$1.toFiniteNumber(responseHeaders.getContentLength());
2713
+ if (declaredLength != null && declaredLength > maxContentLength) {
2714
+ throw new AxiosError$1(
2715
+ "maxContentLength size of " + maxContentLength + " exceeded",
2716
+ AxiosError$1.ERR_BAD_RESPONSE,
2717
+ config,
2718
+ request
2719
+ );
2720
+ }
2721
+ }
2147
2722
  const isStreamResponse = supportsResponseStream && (responseType === "stream" || responseType === "response");
2148
- if (supportsResponseStream && (onDownloadProgress || isStreamResponse && unsubscribe)) {
2723
+ if (supportsResponseStream && response.body && (onDownloadProgress || hasMaxContentLength || isStreamResponse && unsubscribe)) {
2149
2724
  const options = {};
2150
2725
  ["status", "statusText", "headers"].forEach((prop) => {
2151
2726
  options[prop] = response[prop];
2152
2727
  });
2153
- const responseContentLength = utils$1.toFiniteNumber(response.headers.get("content-length"));
2728
+ const responseContentLength = utils$1.toFiniteNumber(responseHeaders.getContentLength());
2154
2729
  const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
2155
2730
  responseContentLength,
2156
2731
  progressEventReducer(asyncDecorator(onDownloadProgress), true)
2157
2732
  ) || [];
2733
+ let bytesRead = 0;
2734
+ const onChunkProgress = (loadedBytes) => {
2735
+ if (hasMaxContentLength) {
2736
+ bytesRead = loadedBytes;
2737
+ if (bytesRead > maxContentLength) {
2738
+ throw new AxiosError$1(
2739
+ "maxContentLength size of " + maxContentLength + " exceeded",
2740
+ AxiosError$1.ERR_BAD_RESPONSE,
2741
+ config,
2742
+ request
2743
+ );
2744
+ }
2745
+ }
2746
+ onProgress && onProgress(loadedBytes);
2747
+ };
2158
2748
  response = new Response(
2159
- trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
2749
+ trackStream(response.body, DEFAULT_CHUNK_SIZE, onChunkProgress, () => {
2160
2750
  flush && flush();
2161
2751
  unsubscribe && unsubscribe();
2162
2752
  }),
@@ -2164,7 +2754,30 @@ const factory = (env) => {
2164
2754
  );
2165
2755
  }
2166
2756
  responseType = responseType || "text";
2167
- let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || "text"](response, config);
2757
+ let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || "text"](
2758
+ response,
2759
+ config
2760
+ );
2761
+ if (hasMaxContentLength && !supportsResponseStream && !isStreamResponse) {
2762
+ let materializedSize;
2763
+ if (responseData != null) {
2764
+ if (typeof responseData.byteLength === "number") {
2765
+ materializedSize = responseData.byteLength;
2766
+ } else if (typeof responseData.size === "number") {
2767
+ materializedSize = responseData.size;
2768
+ } else if (typeof responseData === "string") {
2769
+ materializedSize = typeof TextEncoder === "function" ? new TextEncoder().encode(responseData).byteLength : responseData.length;
2770
+ }
2771
+ }
2772
+ if (typeof materializedSize === "number" && materializedSize > maxContentLength) {
2773
+ throw new AxiosError$1(
2774
+ "maxContentLength size of " + maxContentLength + " exceeded",
2775
+ AxiosError$1.ERR_BAD_RESPONSE,
2776
+ config,
2777
+ request
2778
+ );
2779
+ }
2780
+ }
2168
2781
  !isStreamResponse && unsubscribe && unsubscribe();
2169
2782
  return await new Promise((resolve, reject) => {
2170
2783
  settle(resolve, reject, {
@@ -2178,9 +2791,30 @@ const factory = (env) => {
2178
2791
  });
2179
2792
  } catch (err) {
2180
2793
  unsubscribe && unsubscribe();
2794
+ if (composedSignal && composedSignal.aborted && composedSignal.reason instanceof AxiosError$1) {
2795
+ const canceledError = composedSignal.reason;
2796
+ canceledError.config = config;
2797
+ request && (canceledError.request = request);
2798
+ err !== canceledError && (canceledError.cause = err);
2799
+ throw canceledError;
2800
+ }
2801
+ if (pendingBodyError) {
2802
+ request && !pendingBodyError.request && (pendingBodyError.request = request);
2803
+ throw pendingBodyError;
2804
+ }
2805
+ if (err instanceof AxiosError$1) {
2806
+ request && !err.request && (err.request = request);
2807
+ throw err;
2808
+ }
2181
2809
  if (err && err.name === "TypeError" && /Load failed|fetch/i.test(err.message)) {
2182
2810
  throw Object.assign(
2183
- new AxiosError$1("Network Error", AxiosError$1.ERR_NETWORK, config, request, err && err.response),
2811
+ new AxiosError$1(
2812
+ "Network Error",
2813
+ AxiosError$1.ERR_NETWORK,
2814
+ config,
2815
+ request,
2816
+ err && err.response
2817
+ ),
2184
2818
  {
2185
2819
  cause: err.cause || err
2186
2820
  }
@@ -2194,11 +2828,7 @@ const seedCache = /* @__PURE__ */ new Map();
2194
2828
  const getFetch = (config) => {
2195
2829
  let env = config && config.env || {};
2196
2830
  const { fetch: fetch2, Request, Response } = env;
2197
- const seeds = [
2198
- Request,
2199
- Response,
2200
- fetch2
2201
- ];
2831
+ const seeds = [Request, Response, fetch2];
2202
2832
  let len = seeds.length, i = len, seed, target, map = seedCache;
2203
2833
  while (i--) {
2204
2834
  seed = seeds[i];
@@ -2219,10 +2849,10 @@ const knownAdapters = {
2219
2849
  utils$1.forEach(knownAdapters, (fn, value) => {
2220
2850
  if (fn) {
2221
2851
  try {
2222
- Object.defineProperty(fn, "name", { value });
2852
+ Object.defineProperty(fn, "name", { __proto__: null, value });
2223
2853
  } catch (e) {
2224
2854
  }
2225
- Object.defineProperty(fn, "adapterName", { value });
2855
+ Object.defineProperty(fn, "adapterName", { __proto__: null, value });
2226
2856
  }
2227
2857
  });
2228
2858
  const renderReason = (reason) => `- ${reason}`;
@@ -2283,39 +2913,44 @@ function throwIfCancellationRequested(config) {
2283
2913
  function dispatchRequest(config) {
2284
2914
  throwIfCancellationRequested(config);
2285
2915
  config.headers = AxiosHeaders$1.from(config.headers);
2286
- config.data = transformData.call(
2287
- config,
2288
- config.transformRequest
2289
- );
2916
+ config.data = transformData.call(config, config.transformRequest);
2290
2917
  if (["post", "put", "patch"].indexOf(config.method) !== -1) {
2291
2918
  config.headers.setContentType("application/x-www-form-urlencoded", false);
2292
2919
  }
2293
2920
  const adapter = adapters.getAdapter(config.adapter || defaults.adapter, config);
2294
- return adapter(config).then(function onAdapterResolution(response) {
2295
- throwIfCancellationRequested(config);
2296
- response.data = transformData.call(
2297
- config,
2298
- config.transformResponse,
2299
- response
2300
- );
2301
- response.headers = AxiosHeaders$1.from(response.headers);
2302
- return response;
2303
- }, function onAdapterRejection(reason) {
2304
- if (!isCancel$1(reason)) {
2921
+ return adapter(config).then(
2922
+ function onAdapterResolution(response) {
2305
2923
  throwIfCancellationRequested(config);
2306
- if (reason && reason.response) {
2307
- reason.response.data = transformData.call(
2308
- config,
2309
- config.transformResponse,
2310
- reason.response
2311
- );
2312
- reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
2924
+ config.response = response;
2925
+ try {
2926
+ response.data = transformData.call(config, config.transformResponse, response);
2927
+ } finally {
2928
+ delete config.response;
2929
+ }
2930
+ response.headers = AxiosHeaders$1.from(response.headers);
2931
+ return response;
2932
+ },
2933
+ function onAdapterRejection(reason) {
2934
+ if (!isCancel$1(reason)) {
2935
+ throwIfCancellationRequested(config);
2936
+ if (reason && reason.response) {
2937
+ config.response = reason.response;
2938
+ try {
2939
+ reason.response.data = transformData.call(
2940
+ config,
2941
+ config.transformResponse,
2942
+ reason.response
2943
+ );
2944
+ } finally {
2945
+ delete config.response;
2946
+ }
2947
+ reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
2948
+ }
2313
2949
  }
2950
+ return Promise.reject(reason);
2314
2951
  }
2315
- return Promise.reject(reason);
2316
- });
2952
+ );
2317
2953
  }
2318
- const VERSION$1 = "1.13.5";
2319
2954
  const validators$1 = {};
2320
2955
  ["object", "boolean", "number", "function", "string", "symbol"].forEach((type, i) => {
2321
2956
  validators$1[type] = function validator2(thing) {
@@ -2360,12 +2995,15 @@ function assertOptions(options, schema, allowUnknown) {
2360
2995
  let i = keys.length;
2361
2996
  while (i-- > 0) {
2362
2997
  const opt = keys[i];
2363
- const validator2 = schema[opt];
2998
+ const validator2 = Object.prototype.hasOwnProperty.call(schema, opt) ? schema[opt] : void 0;
2364
2999
  if (validator2) {
2365
3000
  const value = options[opt];
2366
3001
  const result = value === void 0 || validator2(value, opt, options);
2367
3002
  if (result !== true) {
2368
- throw new AxiosError$1("option " + opt + " must be " + result, AxiosError$1.ERR_BAD_OPTION_VALUE);
3003
+ throw new AxiosError$1(
3004
+ "option " + opt + " must be " + result,
3005
+ AxiosError$1.ERR_BAD_OPTION_VALUE
3006
+ );
2369
3007
  }
2370
3008
  continue;
2371
3009
  }
@@ -2402,12 +3040,23 @@ let Axios$1 = class Axios {
2402
3040
  if (err instanceof Error) {
2403
3041
  let dummy = {};
2404
3042
  Error.captureStackTrace ? Error.captureStackTrace(dummy) : dummy = new Error();
2405
- const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, "") : "";
3043
+ const stack = (() => {
3044
+ if (!dummy.stack) {
3045
+ return "";
3046
+ }
3047
+ const firstNewlineIndex = dummy.stack.indexOf("\n");
3048
+ return firstNewlineIndex === -1 ? "" : dummy.stack.slice(firstNewlineIndex + 1);
3049
+ })();
2406
3050
  try {
2407
3051
  if (!err.stack) {
2408
3052
  err.stack = stack;
2409
- } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ""))) {
2410
- err.stack += "\n" + stack;
3053
+ } else if (stack) {
3054
+ const firstNewlineIndex = stack.indexOf("\n");
3055
+ const secondNewlineIndex = firstNewlineIndex === -1 ? -1 : stack.indexOf("\n", firstNewlineIndex + 1);
3056
+ const stackWithoutTwoTopLines = secondNewlineIndex === -1 ? "" : stack.slice(secondNewlineIndex + 1);
3057
+ if (!String(err.stack).endsWith(stackWithoutTwoTopLines)) {
3058
+ err.stack += "\n" + stack;
3059
+ }
2411
3060
  }
2412
3061
  } catch (e) {
2413
3062
  }
@@ -2425,12 +3074,18 @@ let Axios$1 = class Axios {
2425
3074
  config = mergeConfig$1(this.defaults, config);
2426
3075
  const { transitional: transitional2, paramsSerializer, headers } = config;
2427
3076
  if (transitional2 !== void 0) {
2428
- validator.assertOptions(transitional2, {
2429
- silentJSONParsing: validators.transitional(validators.boolean),
2430
- forcedJSONParsing: validators.transitional(validators.boolean),
2431
- clarifyTimeoutError: validators.transitional(validators.boolean),
2432
- legacyInterceptorReqResOrdering: validators.transitional(validators.boolean)
2433
- }, false);
3077
+ validator.assertOptions(
3078
+ transitional2,
3079
+ {
3080
+ silentJSONParsing: validators.transitional(validators.boolean),
3081
+ forcedJSONParsing: validators.transitional(validators.boolean),
3082
+ clarifyTimeoutError: validators.transitional(validators.boolean),
3083
+ legacyInterceptorReqResOrdering: validators.transitional(validators.boolean),
3084
+ advertiseZstdAcceptEncoding: validators.transitional(validators.boolean),
3085
+ validateStatusUndefinedResolves: validators.transitional(validators.boolean)
3086
+ },
3087
+ false
3088
+ );
2434
3089
  }
2435
3090
  if (paramsSerializer != null) {
2436
3091
  if (utils$1.isFunction(paramsSerializer)) {
@@ -2438,10 +3093,14 @@ let Axios$1 = class Axios {
2438
3093
  serialize: paramsSerializer
2439
3094
  };
2440
3095
  } else {
2441
- validator.assertOptions(paramsSerializer, {
2442
- encode: validators.function,
2443
- serialize: validators.function
2444
- }, true);
3096
+ validator.assertOptions(
3097
+ paramsSerializer,
3098
+ {
3099
+ encode: validators.function,
3100
+ serialize: validators.function
3101
+ },
3102
+ true
3103
+ );
2445
3104
  }
2446
3105
  }
2447
3106
  if (config.allowAbsoluteUrls !== void 0) ;
@@ -2450,21 +3109,19 @@ let Axios$1 = class Axios {
2450
3109
  } else {
2451
3110
  config.allowAbsoluteUrls = true;
2452
3111
  }
2453
- validator.assertOptions(config, {
2454
- baseUrl: validators.spelling("baseURL"),
2455
- withXsrfToken: validators.spelling("withXSRFToken")
2456
- }, true);
2457
- config.method = (config.method || this.defaults.method || "get").toLowerCase();
2458
- let contextHeaders = headers && utils$1.merge(
2459
- headers.common,
2460
- headers[config.method]
2461
- );
2462
- headers && utils$1.forEach(
2463
- ["delete", "get", "head", "post", "put", "patch", "common"],
2464
- (method) => {
2465
- delete headers[method];
2466
- }
3112
+ validator.assertOptions(
3113
+ config,
3114
+ {
3115
+ baseUrl: validators.spelling("baseURL"),
3116
+ withXsrfToken: validators.spelling("withXSRFToken")
3117
+ },
3118
+ true
2467
3119
  );
3120
+ config.method = (config.method || this.defaults.method || "get").toLowerCase();
3121
+ let contextHeaders = headers && utils$1.merge(headers.common, headers[config.method]);
3122
+ headers && utils$1.forEach(["delete", "get", "head", "post", "put", "patch", "query", "common"], (method) => {
3123
+ delete headers[method];
3124
+ });
2468
3125
  config.headers = AxiosHeaders$1.concat(contextHeaders, headers);
2469
3126
  const requestInterceptorChain = [];
2470
3127
  let synchronousRequestInterceptors = true;
@@ -2525,34 +3182,40 @@ let Axios$1 = class Axios {
2525
3182
  }
2526
3183
  getUri(config) {
2527
3184
  config = mergeConfig$1(this.defaults, config);
2528
- const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
3185
+ const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls, config);
2529
3186
  return buildURL(fullPath, config.params, config.paramsSerializer);
2530
3187
  }
2531
3188
  };
2532
3189
  utils$1.forEach(["delete", "get", "head", "options"], function forEachMethodNoData(method) {
2533
3190
  Axios$1.prototype[method] = function(url, config) {
2534
- return this.request(mergeConfig$1(config || {}, {
2535
- method,
2536
- url,
2537
- data: (config || {}).data
2538
- }));
3191
+ return this.request(
3192
+ mergeConfig$1(config || {}, {
3193
+ method,
3194
+ url,
3195
+ data: config && utils$1.hasOwnProp(config, "data") ? config.data : void 0
3196
+ })
3197
+ );
2539
3198
  };
2540
3199
  });
2541
- utils$1.forEach(["post", "put", "patch"], function forEachMethodWithData(method) {
3200
+ utils$1.forEach(["post", "put", "patch", "query"], function forEachMethodWithData(method) {
2542
3201
  function generateHTTPMethod(isForm) {
2543
3202
  return function httpMethod(url, data, config) {
2544
- return this.request(mergeConfig$1(config || {}, {
2545
- method,
2546
- headers: isForm ? {
2547
- "Content-Type": "multipart/form-data"
2548
- } : {},
2549
- url,
2550
- data
2551
- }));
3203
+ return this.request(
3204
+ mergeConfig$1(config || {}, {
3205
+ method,
3206
+ headers: isForm ? {
3207
+ "Content-Type": "multipart/form-data"
3208
+ } : {},
3209
+ url,
3210
+ data
3211
+ })
3212
+ );
2552
3213
  };
2553
3214
  }
2554
3215
  Axios$1.prototype[method] = generateHTTPMethod();
2555
- Axios$1.prototype[method + "Form"] = generateHTTPMethod(true);
3216
+ if (method !== "query") {
3217
+ Axios$1.prototype[method + "Form"] = generateHTTPMethod(true);
3218
+ }
2556
3219
  });
2557
3220
  let CancelToken$1 = class CancelToken {
2558
3221
  constructor(executor) {
@@ -2736,7 +3399,7 @@ function createInstance(defaultConfig) {
2736
3399
  const instance = bind(Axios$1.prototype.request, context);
2737
3400
  utils$1.extend(instance, Axios$1.prototype, context, { allOwnKeys: true });
2738
3401
  utils$1.extend(instance, context, null, { allOwnKeys: true });
2739
- instance.create = function create(instanceConfig) {
3402
+ instance.create = function create2(instanceConfig) {
2740
3403
  return createInstance(mergeConfig$1(defaultConfig, instanceConfig));
2741
3404
  };
2742
3405
  return instance;
@@ -2777,7 +3440,8 @@ const {
2777
3440
  HttpStatusCode,
2778
3441
  formToJSON,
2779
3442
  getAdapter,
2780
- mergeConfig
3443
+ mergeConfig,
3444
+ create
2781
3445
  } = axios;
2782
3446
  var isRetryAllowed$1;
2783
3447
  var hasRequiredIsRetryAllowed;