@membranehq/sdk 0.29.1 → 0.29.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bundle.js CHANGED
@@ -23601,7 +23601,7 @@
23601
23601
  }
23602
23602
  }
23603
23603
 
23604
- /*! Axios v1.16.0 Copyright (c) 2026 Matt Zabriskie and contributors */
23604
+ /*! Axios v1.19.0 Copyright (c) 2026 Matt Zabriskie and contributors */
23605
23605
  /**
23606
23606
  * Create a bound version of a function with a specified `this` context
23607
23607
  *
@@ -23621,6 +23621,57 @@
23621
23621
  const { getPrototypeOf } = Object;
23622
23622
  const { iterator, toStringTag } = Symbol;
23623
23623
 
23624
+ /* Creating a function that will check if an object has a property. */
23625
+ const hasOwnProperty = (
23626
+ ({ hasOwnProperty }) =>
23627
+ (obj, prop) =>
23628
+ hasOwnProperty.call(obj, prop)
23629
+ )(Object.prototype);
23630
+
23631
+ /**
23632
+ * Walk the prototype chain (excluding the shared Object.prototype) looking for
23633
+ * an own `prop`. This distinguishes genuine own/inherited members — including
23634
+ * class accessors and template prototypes — from members injected via
23635
+ * Object.prototype pollution (e.g. `Object.prototype.username = '...'`), which
23636
+ * live on Object.prototype itself and are therefore never matched.
23637
+ *
23638
+ * @param {*} thing The value whose chain to inspect
23639
+ * @param {string|symbol} prop The property key to look for
23640
+ *
23641
+ * @returns {boolean} True when `prop` is owned below Object.prototype
23642
+ */
23643
+ const hasOwnInPrototypeChain = (thing, prop) => {
23644
+ let obj = thing;
23645
+ const seen = [];
23646
+
23647
+ while (obj != null && obj !== Object.prototype) {
23648
+ if (seen.indexOf(obj) !== -1) {
23649
+ return false;
23650
+ }
23651
+ seen.push(obj);
23652
+
23653
+ if (hasOwnProperty(obj, prop)) {
23654
+ return true;
23655
+ }
23656
+ obj = getPrototypeOf(obj);
23657
+ }
23658
+ return false;
23659
+ };
23660
+
23661
+ /**
23662
+ * Read `obj[prop]` only when it is safe from Object.prototype pollution. Own
23663
+ * properties and members inherited from a non-Object.prototype source (a class
23664
+ * instance or template object) are honored; a value reachable only through a
23665
+ * polluted Object.prototype is ignored and `undefined` is returned.
23666
+ *
23667
+ * @param {*} obj The source object
23668
+ * @param {string|symbol} prop The property key to read
23669
+ *
23670
+ * @returns {*} The resolved value, or undefined when unsafe/absent
23671
+ */
23672
+ const getSafeProp = (obj, prop) =>
23673
+ obj != null && hasOwnInPrototypeChain(obj, prop) ? obj[prop] : undefined;
23674
+
23624
23675
  const kindOf = ((cache) => (thing) => {
23625
23676
  const str = toString.call(thing);
23626
23677
  return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
@@ -23746,7 +23797,7 @@
23746
23797
  * @returns {boolean} True if value is a plain Object, otherwise false
23747
23798
  */
23748
23799
  const isPlainObject = (val) => {
23749
- if (kindOf(val) !== 'object') {
23800
+ if (!isObject(val)) {
23750
23801
  return false;
23751
23802
  }
23752
23803
 
@@ -23754,9 +23805,12 @@
23754
23805
  return (
23755
23806
  (prototype === null ||
23756
23807
  prototype === Object.prototype ||
23757
- Object.getPrototypeOf(prototype) === null) &&
23758
- !(toStringTag in val) &&
23759
- !(iterator in val)
23808
+ getPrototypeOf(prototype) === null) &&
23809
+ // Treat any genuine (non-Object.prototype-polluted) Symbol.toStringTag or
23810
+ // Symbol.iterator as evidence the value is a tagged/iterable type rather
23811
+ // than a plain object, while ignoring keys injected onto Object.prototype.
23812
+ !hasOwnInPrototypeChain(val, toStringTag) &&
23813
+ !hasOwnInPrototypeChain(val, iterator)
23760
23814
  );
23761
23815
  };
23762
23816
 
@@ -23841,6 +23895,7 @@
23841
23895
  * @returns {boolean} True if value is a FileList, otherwise false
23842
23896
  */
23843
23897
  const isFileList = kindOfTest('FileList');
23898
+ const isSet = kindOfTest('Set');
23844
23899
 
23845
23900
  /**
23846
23901
  * Determine if a value is a Stream
@@ -24025,7 +24080,9 @@
24025
24080
  return;
24026
24081
  }
24027
24082
 
24028
- const targetKey = (caseless && findKey(result, key)) || key;
24083
+ // findKey lowercases the key, so caseless lookup only applies to strings —
24084
+ // symbol keys are identity-matched.
24085
+ const targetKey = (caseless && typeof key === 'string' && findKey(result, key)) || key;
24029
24086
  // Read via own-prop only — a bare `result[targetKey]` walks the prototype
24030
24087
  // chain, so a polluted Object.prototype value could surface here and get
24031
24088
  // copied into the merged result.
@@ -24042,7 +24099,24 @@
24042
24099
  };
24043
24100
 
24044
24101
  for (let i = 0, l = objs.length; i < l; i++) {
24045
- objs[i] && forEach(objs[i], assignValue);
24102
+ const source = objs[i];
24103
+ if (!source || isBuffer(source)) {
24104
+ continue;
24105
+ }
24106
+
24107
+ forEach(source, assignValue);
24108
+
24109
+ if (typeof source !== 'object' || isArray(source)) {
24110
+ continue;
24111
+ }
24112
+
24113
+ const symbols = Object.getOwnPropertySymbols(source);
24114
+ for (let j = 0; j < symbols.length; j++) {
24115
+ const symbol = symbols[j];
24116
+ if (propertyIsEnumerable.call(source, symbol)) {
24117
+ assignValue(source[symbol], symbol);
24118
+ }
24119
+ }
24046
24120
  }
24047
24121
  return result;
24048
24122
  }
@@ -24264,12 +24338,7 @@
24264
24338
  });
24265
24339
  };
24266
24340
 
24267
- /* Creating a function that will check if an object has a property. */
24268
- const hasOwnProperty = (
24269
- ({ hasOwnProperty }) =>
24270
- (obj, prop) =>
24271
- hasOwnProperty.call(obj, prop)
24272
- )(Object.prototype);
24341
+ const { propertyIsEnumerable } = Object.prototype;
24273
24342
 
24274
24343
  /**
24275
24344
  * Determine if a value is a RegExp object
@@ -24376,11 +24445,11 @@
24376
24445
  * @returns {Object} The JSON-compatible object.
24377
24446
  */
24378
24447
  const toJSONObject = (obj) => {
24379
- const stack = new Array(10);
24448
+ const visited = new WeakSet();
24380
24449
 
24381
- const visit = (source, i) => {
24450
+ const visit = (source) => {
24382
24451
  if (isObject(source)) {
24383
- if (stack.indexOf(source) >= 0) {
24452
+ if (visited.has(source)) {
24384
24453
  return;
24385
24454
  }
24386
24455
 
@@ -24390,15 +24459,27 @@
24390
24459
  }
24391
24460
 
24392
24461
  if (!('toJSON' in source)) {
24393
- stack[i] = source;
24394
- const target = isArray(source) ? [] : {};
24462
+ // add-on descent / delete-on-ascent: preserves path semantics, so DAG nodes serialise at every occurrence (see #7230).
24463
+ visited.add(source);
24395
24464
 
24396
- forEach(source, (value, key) => {
24397
- const reducedValue = visit(value, i + 1);
24398
- !isUndefined(reducedValue) && (target[key] = reducedValue);
24399
- });
24465
+ let target;
24466
+
24467
+ if (isSet(source)) {
24468
+ target = [];
24469
+ for (const value of source) {
24470
+ const reducedValue = visit(value);
24471
+ !isUndefined(reducedValue) && target.push(reducedValue);
24472
+ }
24473
+ } else {
24474
+ target = isArray(source) ? [] : {};
24475
+
24476
+ forEach(source, (value, key) => {
24477
+ const reducedValue = visit(value);
24478
+ !isUndefined(reducedValue) && (target[key] = reducedValue);
24479
+ });
24480
+ }
24400
24481
 
24401
- stack[i] = undefined;
24482
+ visited.delete(source);
24402
24483
 
24403
24484
  return target;
24404
24485
  }
@@ -24407,7 +24488,7 @@
24407
24488
  return source;
24408
24489
  };
24409
24490
 
24410
- return visit(obj, 0);
24491
+ return visit(obj);
24411
24492
  };
24412
24493
 
24413
24494
  /**
@@ -24481,6 +24562,20 @@
24481
24562
 
24482
24563
  const isIterable = (thing) => thing != null && isFunction$1(thing[iterator]);
24483
24564
 
24565
+ /**
24566
+ * Determine if a value is iterable via an iterator that is NOT sourced solely
24567
+ * from a polluted Object.prototype. Use this instead of `isIterable` whenever
24568
+ * the iterable comes from untrusted input (e.g. user-supplied header sources),
24569
+ * so `Object.prototype[Symbol.iterator] = ...` cannot turn an ordinary object
24570
+ * into an attacker-controlled entries iterator.
24571
+ *
24572
+ * @param {*} thing The value to test
24573
+ *
24574
+ * @returns {boolean} True if value has a non-polluted iterator
24575
+ */
24576
+ const isSafeIterable = (thing) =>
24577
+ thing != null && hasOwnInPrototypeChain(thing, iterator) && isIterable(thing);
24578
+
24484
24579
  var utils$1 = {
24485
24580
  isArray,
24486
24581
  isArrayBuffer,
@@ -24525,6 +24620,8 @@
24525
24620
  isHTMLForm,
24526
24621
  hasOwnProperty,
24527
24622
  hasOwnProp: hasOwnProperty, // an alias to avoid ESLint no-prototype-builtins detection
24623
+ hasOwnInPrototypeChain,
24624
+ getSafeProp,
24528
24625
  reduceDescriptors,
24529
24626
  freezeMethods,
24530
24627
  toObjectSet,
@@ -24541,6 +24638,7 @@
24541
24638
  setImmediate: _setImmediate,
24542
24639
  asap,
24543
24640
  isIterable,
24641
+ isSafeIterable,
24544
24642
  };
24545
24643
 
24546
24644
  // RawAxiosHeaders whose duplicates are ignored by node
@@ -24591,28 +24689,26 @@
24591
24689
  key = line.substring(0, i).trim().toLowerCase();
24592
24690
  val = line.substring(i + 1).trim();
24593
24691
 
24594
- if (!key || (parsed[key] && ignoreDuplicateOf[key])) {
24692
+ const hasKey = utils$1.hasOwnProp(parsed, key);
24693
+
24694
+ if (!key || (hasKey && utils$1.hasOwnProp(ignoreDuplicateOf, key))) {
24595
24695
  return;
24596
24696
  }
24597
24697
 
24598
24698
  if (key === 'set-cookie') {
24599
- if (parsed[key]) {
24699
+ if (hasKey) {
24600
24700
  parsed[key].push(val);
24601
24701
  } else {
24602
24702
  parsed[key] = [val];
24603
24703
  }
24604
24704
  } else {
24605
- parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
24705
+ parsed[key] = hasKey ? parsed[key] + ', ' + val : val;
24606
24706
  }
24607
24707
  });
24608
24708
 
24609
24709
  return parsed;
24610
24710
  };
24611
24711
 
24612
- const $internals = Symbol('internals');
24613
-
24614
- const INVALID_HEADER_VALUE_CHARS_RE = /[^\x09\x20-\x7E\x80-\xFF]/g;
24615
-
24616
24712
  function trimSPorHTAB(str) {
24617
24713
  let start = 0;
24618
24714
  let end = str.length;
@@ -24640,12 +24736,40 @@
24640
24736
  return start === 0 && end === str.length ? str : str.slice(start, end);
24641
24737
  }
24642
24738
 
24643
- function normalizeHeader(header) {
24644
- return header && String(header).trim().toLowerCase();
24739
+ // The control-code ranges are intentional: header sanitization strips C0/DEL bytes.
24740
+ // eslint-disable-next-line no-control-regex
24741
+ const INVALID_UNICODE_HEADER_VALUE_CHARS = new RegExp('[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+', 'g');
24742
+ // eslint-disable-next-line no-control-regex
24743
+ const INVALID_BYTE_STRING_HEADER_VALUE_CHARS = new RegExp('[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+', 'g');
24744
+
24745
+ function sanitizeValue(value, invalidChars) {
24746
+ if (utils$1.isArray(value)) {
24747
+ return value.map((item) => sanitizeValue(item, invalidChars));
24748
+ }
24749
+
24750
+ return trimSPorHTAB(String(value).replace(invalidChars, ''));
24751
+ }
24752
+
24753
+ const sanitizeHeaderValue = (value) =>
24754
+ sanitizeValue(value, INVALID_UNICODE_HEADER_VALUE_CHARS);
24755
+
24756
+ const sanitizeByteStringHeaderValue = (value) =>
24757
+ sanitizeValue(value, INVALID_BYTE_STRING_HEADER_VALUE_CHARS);
24758
+
24759
+ function toByteStringHeaderObject(headers) {
24760
+ const byteStringHeaders = Object.create(null);
24761
+
24762
+ utils$1.forEach(headers.toJSON(), (value, header) => {
24763
+ byteStringHeaders[header] = sanitizeByteStringHeaderValue(value);
24764
+ });
24765
+
24766
+ return byteStringHeaders;
24645
24767
  }
24646
24768
 
24647
- function sanitizeHeaderValue(str) {
24648
- return trimSPorHTAB(str.replace(INVALID_HEADER_VALUE_CHARS_RE, ''));
24769
+ const $internals = Symbol('internals');
24770
+
24771
+ function normalizeHeader(header) {
24772
+ return header && String(header).trim().toLowerCase();
24649
24773
  }
24650
24774
 
24651
24775
  function normalizeValue(value) {
@@ -24668,6 +24792,124 @@
24668
24792
  return tokens;
24669
24793
  }
24670
24794
 
24795
+ const parameterNameRE = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;
24796
+
24797
+ function trimOWS(value) {
24798
+ let start = 0;
24799
+ let end = value.length;
24800
+
24801
+ while (start < end) {
24802
+ const code = value.charCodeAt(start);
24803
+
24804
+ if (code !== 0x09 && code !== 0x20) {
24805
+ break;
24806
+ }
24807
+
24808
+ start += 1;
24809
+ }
24810
+
24811
+ while (end > start) {
24812
+ const code = value.charCodeAt(end - 1);
24813
+
24814
+ if (code !== 0x09 && code !== 0x20) {
24815
+ break;
24816
+ }
24817
+
24818
+ end -= 1;
24819
+ }
24820
+
24821
+ return start === 0 && end === value.length ? value : value.slice(start, end);
24822
+ }
24823
+
24824
+ function decodeQuotedString(value) {
24825
+ const last = value.length - 1;
24826
+
24827
+ if (last < 1 || value.charCodeAt(0) !== 0x22 || value.charCodeAt(last) !== 0x22) {
24828
+ return value;
24829
+ }
24830
+
24831
+ let decoded = '';
24832
+
24833
+ for (let i = 1; i < last; i++) {
24834
+ const code = value.charCodeAt(i);
24835
+
24836
+ if (code === 0x22) {
24837
+ return value;
24838
+ }
24839
+
24840
+ if (code === 0x5c) {
24841
+ i += 1;
24842
+
24843
+ if (i >= last) {
24844
+ return value;
24845
+ }
24846
+ }
24847
+
24848
+ decoded += value[i];
24849
+ }
24850
+
24851
+ return decoded;
24852
+ }
24853
+
24854
+ function parseParameters(value) {
24855
+ const parameters = Object.create(null);
24856
+ const str = String(value);
24857
+ let start = 0;
24858
+ let quoted = false;
24859
+ let escaped = false;
24860
+
24861
+ function parseParameter(end) {
24862
+ const part = trimOWS(str.slice(start, end));
24863
+ const equals = part.indexOf('=');
24864
+
24865
+ if (equals < 1) {
24866
+ return;
24867
+ }
24868
+
24869
+ const name = trimOWS(part.slice(0, equals));
24870
+
24871
+ if (!parameterNameRE.test(name)) {
24872
+ return;
24873
+ }
24874
+
24875
+ const normalizedName = name.toLowerCase();
24876
+
24877
+ if (
24878
+ normalizedName === '__proto__' ||
24879
+ normalizedName === 'constructor' ||
24880
+ normalizedName === 'prototype'
24881
+ ) {
24882
+ return;
24883
+ }
24884
+
24885
+ const parameterValue = trimOWS(part.slice(equals + 1));
24886
+ parameters[normalizedName] = decodeQuotedString(parameterValue);
24887
+ }
24888
+
24889
+ for (let i = 0; i < str.length; i++) {
24890
+ const code = str.charCodeAt(i);
24891
+
24892
+ if (quoted) {
24893
+ if (escaped) {
24894
+ escaped = false;
24895
+ } else if (code === 0x5c) {
24896
+ escaped = true;
24897
+ } else if (code === 0x22) {
24898
+ quoted = false;
24899
+ }
24900
+ } else if (code === 0x22) {
24901
+ quoted = true;
24902
+ } else if (code === 0x2c || code === 0x3b) {
24903
+ parseParameter(i);
24904
+ start = i + 1;
24905
+ }
24906
+ }
24907
+
24908
+ parseParameter(str.length);
24909
+
24910
+ return parameters;
24911
+ }
24912
+
24671
24913
  const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
24672
24914
 
24673
24915
  function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
@@ -24727,7 +24969,7 @@
24727
24969
  const lHeader = normalizeHeader(_header);
24728
24970
 
24729
24971
  if (!lHeader) {
24730
- throw new Error('header name must be a non-empty string');
24972
+ return;
24731
24973
  }
24732
24974
 
24733
24975
  const key = utils$1.findKey(self, lHeader);
@@ -24749,20 +24991,23 @@
24749
24991
  setHeaders(header, valueOrRewrite);
24750
24992
  } else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
24751
24993
  setHeaders(parseHeaders(header), valueOrRewrite);
24752
- } else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
24753
- let obj = {},
24994
+ } else if (utils$1.isObject(header) && utils$1.isSafeIterable(header)) {
24995
+ let obj = Object.create(null),
24754
24996
  dest,
24755
24997
  key;
24756
24998
  for (const entry of header) {
24757
24999
  if (!utils$1.isArray(entry)) {
24758
- throw TypeError('Object iterator must return a key-value pair');
25000
+ throw new TypeError('Object iterator must return a key-value pair');
24759
25001
  }
24760
25002
 
24761
- obj[(key = entry[0])] = (dest = obj[key])
24762
- ? utils$1.isArray(dest)
24763
- ? [...dest, entry[1]]
24764
- : [dest, entry[1]]
24765
- : entry[1];
25003
+ key = entry[0];
25004
+
25005
+ if (utils$1.hasOwnProp(obj, key)) {
25006
+ dest = obj[key];
25007
+ obj[key] = utils$1.isArray(dest) ? [...dest, entry[1]] : [dest, entry[1]];
25008
+ } else {
25009
+ obj[key] = entry[1];
25010
+ }
24766
25011
  }
24767
25012
 
24768
25013
  setHeaders(obj, valueOrRewrite);
@@ -24916,7 +25161,8 @@
24916
25161
  }
24917
25162
 
24918
25163
  getSetCookie() {
24919
- return this.get('set-cookie') || [];
25164
+ const value = this.get('set-cookie');
25165
+ return utils$1.isArray(value) ? value : value == null || value === false ? [] : [value];
24920
25166
  }
24921
25167
 
24922
25168
  get [Symbol.toStringTag]() {
@@ -24927,6 +25173,10 @@
24927
25173
  return thing instanceof this ? thing : new this(thing);
24928
25174
  }
24929
25175
 
25176
+ static parseParameters(value) {
25177
+ return parseParameters(value);
25178
+ }
25179
+
24930
25180
  static concat(first, ...targets) {
24931
25181
  const computed = new this(first);
24932
25182
 
@@ -25052,10 +25302,53 @@
25052
25302
  return visit(config);
25053
25303
  }
25054
25304
 
25305
+ function stringifySafely$1(value) {
25306
+ try {
25307
+ return String(value);
25308
+ } catch (err) {
25309
+ return '';
25310
+ }
25311
+ }
25312
+
25313
+ function aggregateErrorMessage(error) {
25314
+ const message = error.errors
25315
+ .map((entry) => {
25316
+ try {
25317
+ return entry && entry.message ? stringifySafely$1(entry.message) : stringifySafely$1(entry);
25318
+ } catch (err) {
25319
+ return '';
25320
+ }
25321
+ })
25322
+ .filter(Boolean)
25323
+ .join('; ');
25324
+
25325
+ return message || error.name || 'AggregateError';
25326
+ }
25327
+
25055
25328
  let AxiosError$1 = class AxiosError extends Error {
25056
25329
  static from(error, code, config, request, response, customProps) {
25057
- const axiosError = new AxiosError(error.message, code || error.code, config, request, response);
25058
- axiosError.cause = error;
25330
+ // `AggregateError` (thrown by Node on dual-stack/Happy-Eyeballs connection
25331
+ // failures) has an empty `message`; its detail lives in `errors[]`. Without
25332
+ // this, the wrapped error surfaces with a blank message (see #6721).
25333
+ let message = error.message;
25334
+ if (!message && utils$1.isArray(error.errors) && error.errors.length) {
25335
+ message = aggregateErrorMessage(error);
25336
+ }
25337
+
25338
+ const axiosError = new AxiosError(message, code || error.code, config, request, response);
25339
+ // Match native `Error` `cause` semantics: non-enumerable. The wrapped
25340
+ // error often carries circular internals (sockets, requests, agents), so
25341
+ // an enumerable `cause` makes structured loggers (pino/winston) and any
25342
+ // own-property walk throw "Converting circular structure to JSON".
25343
+ // Regression from #6982; see #7205. `__proto__: null` mirrors the
25344
+ // `message` descriptor below (prototype-pollution-safe descriptor).
25345
+ Object.defineProperty(axiosError, 'cause', {
25346
+ __proto__: null,
25347
+ value: error,
25348
+ writable: true,
25349
+ enumerable: false,
25350
+ configurable: true,
25351
+ });
25059
25352
  axiosError.name = error.name;
25060
25353
 
25061
25354
  // Preserve status from the original error if not already set from response
@@ -25156,6 +25449,10 @@
25156
25449
  // eslint-disable-next-line strict
25157
25450
  var httpAdapter = null;
25158
25451
 
25452
+ // Default nesting limit shared with the inverse transform (formDataToJSON) so
25453
+ // the FormData <-> JSON round-trip stays symmetric.
25454
+ const DEFAULT_FORM_DATA_MAX_DEPTH = 100;
25455
+
25159
25456
  /**
25160
25457
  * Determines if the given thing is a array or js object.
25161
25458
  *
@@ -25266,8 +25563,9 @@
25266
25563
  const dots = options.dots;
25267
25564
  const indexes = options.indexes;
25268
25565
  const _Blob = options.Blob || (typeof Blob !== 'undefined' && Blob);
25269
- const maxDepth = options.maxDepth === undefined ? 100 : options.maxDepth;
25566
+ const maxDepth = options.maxDepth === undefined ? DEFAULT_FORM_DATA_MAX_DEPTH : options.maxDepth;
25270
25567
  const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
25568
+ const stack = [];
25271
25569
 
25272
25570
  if (!utils$1.isFunction(visitor)) {
25273
25571
  throw new TypeError('visitor must be a function');
@@ -25289,12 +25587,47 @@
25289
25587
  }
25290
25588
 
25291
25589
  if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
25292
- return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
25590
+ if (useBlob && typeof _Blob === 'function') {
25591
+ return new _Blob([value]);
25592
+ }
25593
+ throw new AxiosError$1('Blob is not supported. Use a Buffer instead.', AxiosError$1.ERR_NOT_SUPPORT);
25293
25594
  }
25294
25595
 
25295
25596
  return value;
25296
25597
  }
25297
25598
 
25599
+ function throwIfMaxDepthExceeded(depth) {
25600
+ if (depth > maxDepth) {
25601
+ throw new AxiosError$1(
25602
+ 'Object is too deeply nested (' + depth + ' levels). Max depth: ' + maxDepth,
25603
+ AxiosError$1.ERR_FORM_DATA_DEPTH_EXCEEDED
25604
+ );
25605
+ }
25606
+ }
25607
+
25608
+ function stringifyWithDepthLimit(value, depth) {
25609
+ if (maxDepth === Infinity) {
25610
+ return JSON.stringify(value);
25611
+ }
25612
+
25613
+ const ancestors = [];
25614
+
25615
+ return JSON.stringify(value, function limitDepth(_key, currentValue) {
25616
+ if (!utils$1.isObject(currentValue)) {
25617
+ return currentValue;
25618
+ }
25619
+
25620
+ while (ancestors.length && ancestors[ancestors.length - 1] !== this) {
25621
+ ancestors.pop();
25622
+ }
25623
+
25624
+ ancestors.push(currentValue);
25625
+ throwIfMaxDepthExceeded(depth + ancestors.length - 1);
25626
+
25627
+ return currentValue;
25628
+ });
25629
+ }
25630
+
25298
25631
  /**
25299
25632
  * Default visitor.
25300
25633
  *
@@ -25318,7 +25651,7 @@
25318
25651
  // eslint-disable-next-line no-param-reassign
25319
25652
  key = metaTokens ? key : key.slice(0, -2);
25320
25653
  // eslint-disable-next-line no-param-reassign
25321
- value = JSON.stringify(value);
25654
+ value = stringifyWithDepthLimit(value, 1);
25322
25655
  } else if (
25323
25656
  (utils$1.isArray(value) && isFlatArray(value)) ||
25324
25657
  ((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value)))
@@ -25351,8 +25684,6 @@
25351
25684
  return false;
25352
25685
  }
25353
25686
 
25354
- const stack = [];
25355
-
25356
25687
  const exposedHelpers = Object.assign(predicates, {
25357
25688
  defaultVisitor,
25358
25689
  convertValue,
@@ -25362,15 +25693,10 @@
25362
25693
  function build(value, path, depth = 0) {
25363
25694
  if (utils$1.isUndefined(value)) return;
25364
25695
 
25365
- if (depth > maxDepth) {
25366
- throw new AxiosError$1(
25367
- 'Object is too deeply nested (' + depth + ' levels). Max depth: ' + maxDepth,
25368
- AxiosError$1.ERR_FORM_DATA_DEPTH_EXCEEDED
25369
- );
25370
- }
25696
+ throwIfMaxDepthExceeded(depth);
25371
25697
 
25372
25698
  if (stack.indexOf(value) !== -1) {
25373
- throw Error('Circular reference detected in ' + path.join('.'));
25699
+ throw new Error('Circular reference detected in ' + path.join('.'));
25374
25700
  }
25375
25701
 
25376
25702
  stack.push(value);
@@ -25441,9 +25767,7 @@
25441
25767
 
25442
25768
  prototype.toString = function toString(encoder) {
25443
25769
  const _encode = encoder
25444
- ? function (value) {
25445
- return encoder.call(this, value, encode$1);
25446
- }
25770
+ ? (value) => encoder.call(this, value, encode$1)
25447
25771
  : encode$1;
25448
25772
 
25449
25773
  return this._pairs
@@ -25482,8 +25806,7 @@
25482
25806
  if (!params) {
25483
25807
  return url;
25484
25808
  }
25485
-
25486
- const _encode = (options && options.encode) || encode;
25809
+ url = url || '';
25487
25810
 
25488
25811
  const _options = utils$1.isFunction(options)
25489
25812
  ? {
@@ -25491,7 +25814,11 @@
25491
25814
  }
25492
25815
  : options;
25493
25816
 
25494
- const serializeFn = _options && _options.serialize;
25817
+ // Read serializer options pollution-safely: own properties and methods on a
25818
+ // class/template prototype are honored, but values injected onto a polluted
25819
+ // Object.prototype are ignored.
25820
+ const _encode = utils$1.getSafeProp(_options, 'encode') || encode;
25821
+ const serializeFn = utils$1.getSafeProp(_options, 'serialize');
25495
25822
 
25496
25823
  let serializedParams;
25497
25824
 
@@ -25587,6 +25914,8 @@
25587
25914
  forcedJSONParsing: true,
25588
25915
  clarifyTimeoutError: false,
25589
25916
  legacyInterceptorReqResOrdering: true,
25917
+ advertiseZstdAcceptEncoding: false,
25918
+ validateStatusUndefinedResolves: true,
25590
25919
  };
25591
25920
 
25592
25921
  var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
@@ -25678,6 +26007,17 @@
25678
26007
  });
25679
26008
  }
25680
26009
 
26010
+ const MAX_DEPTH = DEFAULT_FORM_DATA_MAX_DEPTH;
26011
+
26012
+ function throwIfDepthExceeded(index) {
26013
+ if (index > MAX_DEPTH) {
26014
+ throw new AxiosError$1(
26015
+ 'FormData field is too deeply nested (' + index + ' levels). Max depth: ' + MAX_DEPTH,
26016
+ AxiosError$1.ERR_FORM_DATA_DEPTH_EXCEEDED
26017
+ );
26018
+ }
26019
+ }
26020
+
25681
26021
  /**
25682
26022
  * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']
25683
26023
  *
@@ -25686,13 +26026,26 @@
25686
26026
  * @returns An array of strings.
25687
26027
  */
25688
26028
  function parsePropPath(name) {
25689
- // foo[x][y][z]
25690
- // foo.x.y.z
25691
- // foo-x-y-z
25692
- // foo x y z
25693
- return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map((match) => {
25694
- return match[0] === '[]' ? '' : match[1] || match[0];
25695
- });
26029
+ // foo[x][y][z] -> ['foo', 'x', 'y', 'z']
26030
+ // foo.x.y.z -> ['foo', 'x', 'y', 'z']
26031
+ // A path is split on `.` and on `[...]` groups. A segment — whether written
26032
+ // in dot notation or captured inside brackets — may contain any character
26033
+ // except `.`, `[` and `]`, so a key like `user-name` or `user name` is kept
26034
+ // literal instead of being split (#5402). `.`, `[` and `]` keep their existing
26035
+ // meaning, e.g. `foo[bar.baz]` -> ['foo', 'bar', 'baz'] and `[]` is an array push.
26036
+ // Excluding `[` from the bracket group also makes the match fail fast at the
26037
+ // next `[`, so a malformed name cannot rescan to the end of the string from
26038
+ // every unmatched `[` — parsing stays linear in the length of the name.
26039
+ const path = [];
26040
+ const pattern = /[^.[\]]+|\[([^.[\]]*)]/g;
26041
+ let match;
26042
+
26043
+ while ((match = pattern.exec(name)) !== null) {
26044
+ throwIfDepthExceeded(path.length);
26045
+ path.push(match[0] === '[]' ? '' : match[1] || match[0]);
26046
+ }
26047
+
26048
+ return path;
25696
26049
  }
25697
26050
 
25698
26051
  /**
@@ -25724,6 +26077,8 @@
25724
26077
  */
25725
26078
  function formDataToJSON(formData) {
25726
26079
  function buildPath(path, value, target, index) {
26080
+ throwIfDepthExceeded(index);
26081
+
25727
26082
  let name = path[index++];
25728
26083
 
25729
26084
  if (name === '__proto__') return true;
@@ -25744,7 +26099,7 @@
25744
26099
  return !isNumericKey;
25745
26100
  }
25746
26101
 
25747
- if (!target[name] || !utils$1.isObject(target[name])) {
26102
+ if (!utils$1.hasOwnProp(target, name) || !utils$1.isObject(target[name])) {
25748
26103
  target[name] = [];
25749
26104
  }
25750
26105
 
@@ -26109,9 +26464,12 @@
26109
26464
  const _speedometer = speedometer(50, 250);
26110
26465
 
26111
26466
  return throttle((e) => {
26467
+ if (!e || typeof e.loaded !== 'number') {
26468
+ return;
26469
+ }
26112
26470
  const rawLoaded = e.loaded;
26113
26471
  const total = e.lengthComputable ? e.total : undefined;
26114
- const loaded = total != null ? Math.min(rawLoaded, total) : rawLoaded;
26472
+ const loaded = Math.max(0, total != null ? Math.min(rawLoaded, total) : rawLoaded);
26115
26473
  const progressBytes = Math.max(0, loaded - bytesNotified);
26116
26474
  const rate = _speedometer(progressBytes);
26117
26475
 
@@ -26148,9 +26506,9 @@
26148
26506
  };
26149
26507
 
26150
26508
  const asyncDecorator =
26151
- (fn) =>
26509
+ (fn, scheduler = utils$1.asap) =>
26152
26510
  (...args) =>
26153
- utils$1.asap(() => fn(...args));
26511
+ scheduler(() => fn(...args));
26154
26512
 
26155
26513
  var isURLSameOrigin = platform.hasStandardBrowserEnv
26156
26514
  ? ((origin, isMSIE) => (url) => {
@@ -26206,7 +26564,11 @@
26206
26564
  const cookie = cookies[i].replace(/^\s+/, '');
26207
26565
  const eq = cookie.indexOf('=');
26208
26566
  if (eq !== -1 && cookie.slice(0, eq) === name) {
26209
- return decodeURIComponent(cookie.slice(eq + 1));
26567
+ try {
26568
+ return decodeURIComponent(cookie.slice(eq + 1));
26569
+ } catch (e) {
26570
+ return cookie.slice(eq + 1);
26571
+ }
26210
26572
  }
26211
26573
  }
26212
26574
  return null;
@@ -26252,9 +26614,80 @@
26252
26614
  * @returns {string} The combined URL
26253
26615
  */
26254
26616
  function combineURLs(baseURL, relativeURL) {
26255
- return relativeURL
26256
- ? baseURL.replace(/\/?\/$/, '') + '/' + relativeURL.replace(/^\/+/, '')
26257
- : baseURL;
26617
+ if (!relativeURL) {
26618
+ return baseURL;
26619
+ }
26620
+
26621
+ let end = baseURL.length;
26622
+
26623
+ while (end > 0 && baseURL.charCodeAt(end - 1) === 47) {
26624
+ end--;
26625
+ }
26626
+
26627
+ return baseURL.slice(0, end) + '/' + relativeURL.replace(/^\/+/, '');
26628
+ }
26629
+
26630
+ const malformedHttpProtocol = /^https?:(?!\/\/)/i;
26631
+ const httpProtocolControlCharacters = /[\t\n\r]/g;
26632
+
26633
+ function stripLeadingC0ControlOrSpace(url) {
26634
+ let i = 0;
26635
+ while (i < url.length && url.charCodeAt(i) <= 0x20) {
26636
+ i++;
26637
+ }
26638
+ return url.slice(i);
26639
+ }
26640
+
26641
+ function normalizeURLForProtocolCheck(url) {
26642
+ return stripLeadingC0ControlOrSpace(url).replace(httpProtocolControlCharacters, '');
26643
+ }
26644
+
26645
+ // Redact the parts of a URL that can carry secrets before it is embedded in an
26646
+ // error message. AxiosError.toJSON() serializes `message` verbatim and errors
26647
+ // are commonly logged, while the opt-in `config.redact` model only cleans
26648
+ // config keys — it cannot reach the message. Redact only the genuinely
26649
+ // sensitive substrings — userinfo (credentials), query parameter values and
26650
+ // fragment contents — with the same REDACTED marker the config redaction uses,
26651
+ // while keeping the scheme, host, path and parameter names so the offending
26652
+ // request stays accurately identifiable.
26653
+ function redactFragment(fragment) {
26654
+ if (!fragment) {
26655
+ return fragment;
26656
+ }
26657
+
26658
+ return fragment.replace(/(^|&)([^=&]*=)?[^&]+/g, (match, separator, parameterName = '') => {
26659
+ return `${separator}${parameterName}${REDACTED}`;
26660
+ });
26661
+ }
26662
+
26663
+ function redactSensitiveURLParts(url) {
26664
+ const redactedURL = url.replace(/^(https?:\/{0,2})[^/?#]*@/i, `$1${REDACTED}@`);
26665
+ const fragmentIndex = redactedURL.indexOf('#');
26666
+ const urlWithoutFragment =
26667
+ fragmentIndex === -1 ? redactedURL : redactedURL.slice(0, fragmentIndex);
26668
+ const redactedURLWithoutFragment = urlWithoutFragment.replace(
26669
+ /([?&][^=&#]*=)[^&#]*/g,
26670
+ `$1${REDACTED}`
26671
+ );
26672
+
26673
+ if (fragmentIndex === -1) {
26674
+ return redactedURLWithoutFragment;
26675
+ }
26676
+
26677
+ return `${redactedURLWithoutFragment}#${redactFragment(redactedURL.slice(fragmentIndex + 1))}`;
26678
+ }
26679
+
26680
+ function assertValidHttpProtocolURL(url, config) {
26681
+ if (typeof url === 'string') {
26682
+ const normalizedURL = normalizeURLForProtocolCheck(url);
26683
+ if (malformedHttpProtocol.test(normalizedURL)) {
26684
+ throw new AxiosError$1(
26685
+ `Invalid URL ${JSON.stringify(redactSensitiveURLParts(normalizedURL))}: missing "//" after protocol`,
26686
+ AxiosError$1.ERR_INVALID_URL,
26687
+ config
26688
+ );
26689
+ }
26690
+ }
26258
26691
  }
26259
26692
 
26260
26693
  /**
@@ -26267,9 +26700,11 @@
26267
26700
  *
26268
26701
  * @returns {string} The combined full path
26269
26702
  */
26270
- function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
26703
+ function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls, config) {
26704
+ assertValidHttpProtocolURL(requestedURL, config);
26271
26705
  let isRelativeUrl = !isAbsoluteURL(requestedURL);
26272
26706
  if (baseURL && (isRelativeUrl || allowAbsoluteUrls === false)) {
26707
+ assertValidHttpProtocolURL(baseURL, config);
26273
26708
  return combineURLs(baseURL, requestedURL);
26274
26709
  }
26275
26710
  return requestedURL;
@@ -26277,6 +26712,17 @@
26277
26712
 
26278
26713
  const headersToObject = (thing) => (thing instanceof AxiosHeaders$1 ? { ...thing } : thing);
26279
26714
 
26715
+ const ownEnumerableKeys = (thing) => {
26716
+ if (Object.getOwnPropertySymbols && Object.getOwnPropertyDescriptor) {
26717
+ return Object.keys(thing).concat(
26718
+ Object.getOwnPropertySymbols(thing).filter(
26719
+ (symbol) => Object.getOwnPropertyDescriptor(thing, symbol).enumerable
26720
+ )
26721
+ );
26722
+ }
26723
+ return Object.keys(thing);
26724
+ };
26725
+
26280
26726
  /**
26281
26727
  * Config-specific merge-function which creates a new config-object
26282
26728
  * by merging two configuration objects together.
@@ -26288,6 +26734,7 @@
26288
26734
  */
26289
26735
  function mergeConfig$1(config1, config2) {
26290
26736
  // eslint-disable-next-line no-param-reassign
26737
+ config1 = config1 || {};
26291
26738
  config2 = config2 || {};
26292
26739
 
26293
26740
  // Use a null-prototype object so that downstream reads such as `config.auth`
@@ -26340,6 +26787,32 @@
26340
26787
  }
26341
26788
  }
26342
26789
 
26790
+ function getMergedTransitionalOption(prop) {
26791
+ const transitional2 = utils$1.hasOwnProp(config2, 'transitional')
26792
+ ? config2.transitional
26793
+ : undefined;
26794
+
26795
+ if (!utils$1.isUndefined(transitional2)) {
26796
+ if (utils$1.isPlainObject(transitional2)) {
26797
+ if (utils$1.hasOwnProp(transitional2, prop)) {
26798
+ return transitional2[prop];
26799
+ }
26800
+ } else {
26801
+ return undefined;
26802
+ }
26803
+ }
26804
+
26805
+ const transitional1 = utils$1.hasOwnProp(config1, 'transitional')
26806
+ ? config1.transitional
26807
+ : undefined;
26808
+
26809
+ if (utils$1.isPlainObject(transitional1) && utils$1.hasOwnProp(transitional1, prop)) {
26810
+ return transitional1[prop];
26811
+ }
26812
+
26813
+ return undefined;
26814
+ }
26815
+
26343
26816
  // eslint-disable-next-line consistent-return
26344
26817
  function mergeDirectKeys(a, b, prop) {
26345
26818
  if (utils$1.hasOwnProp(config2, prop)) {
@@ -26383,7 +26856,7 @@
26383
26856
  mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true),
26384
26857
  };
26385
26858
 
26386
- utils$1.forEach(Object.keys({ ...config1, ...config2 }), function computeConfigValue(prop) {
26859
+ utils$1.forEach(ownEnumerableKeys({ ...config1, ...config2 }), function computeConfigValue(prop) {
26387
26860
  if (prop === '__proto__' || prop === 'constructor' || prop === 'prototype') return;
26388
26861
  const merge = utils$1.hasOwnProp(mergeMap, prop) ? mergeMap[prop] : mergeDeepProperties;
26389
26862
  const a = utils$1.hasOwnProp(config1, prop) ? config1[prop] : undefined;
@@ -26392,18 +26865,41 @@
26392
26865
  (utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
26393
26866
  });
26394
26867
 
26868
+ if (
26869
+ utils$1.hasOwnProp(config2, 'validateStatus') &&
26870
+ utils$1.isUndefined(config2.validateStatus) &&
26871
+ getMergedTransitionalOption('validateStatusUndefinedResolves') === false
26872
+ ) {
26873
+ if (utils$1.hasOwnProp(config1, 'validateStatus')) {
26874
+ config.validateStatus = getMergedValue(undefined, config1.validateStatus);
26875
+ } else {
26876
+ delete config.validateStatus;
26877
+ }
26878
+ }
26879
+
26395
26880
  return config;
26396
26881
  }
26397
26882
 
26398
26883
  const FORM_DATA_CONTENT_HEADERS = ['content-type', 'content-length'];
26399
26884
 
26885
+ /**
26886
+ * Apply the headers generated by a FormData implementation to the request headers,
26887
+ * honoring the `formDataHeaderPolicy` option: with 'content-only', copy only the
26888
+ * content-* headers; otherwise merge all of them.
26889
+ *
26890
+ * @param {AxiosHeaders} headers - the request headers to mutate
26891
+ * @param {Object | null | undefined} formHeaders - headers produced by the FormData implementation
26892
+ * @param {String} [policy] - the resolved `formDataHeaderPolicy` config value
26893
+ *
26894
+ * @returns {void}
26895
+ */
26400
26896
  function setFormDataHeaders(headers, formHeaders, policy) {
26401
26897
  if (policy !== 'content-only') {
26402
26898
  headers.set(formHeaders);
26403
26899
  return;
26404
26900
  }
26405
26901
 
26406
- Object.entries(formHeaders).forEach(([key, val]) => {
26902
+ Object.entries(formHeaders || {}).forEach(([key, val]) => {
26407
26903
  if (FORM_DATA_CONTENT_HEADERS.includes(key.toLowerCase())) {
26408
26904
  headers.set(key, val);
26409
26905
  }
@@ -26418,12 +26914,12 @@
26418
26914
  *
26419
26915
  * @returns {string} UTF-8 bytes as a Latin-1 string
26420
26916
  */
26421
- const encodeUTF8 = (str) =>
26917
+ const encodeUTF8$1 = (str) =>
26422
26918
  encodeURIComponent(str).replace(/%([0-9A-F]{2})/gi, (_, hex) =>
26423
26919
  String.fromCharCode(parseInt(hex, 16))
26424
26920
  );
26425
26921
 
26426
- var resolveConfig = (config) => {
26922
+ function resolveConfig(config) {
26427
26923
  const newConfig = mergeConfig$1({}, config);
26428
26924
 
26429
26925
  // Read only own properties to prevent prototype pollution gadgets
@@ -26443,23 +26939,33 @@
26443
26939
  newConfig.headers = headers = AxiosHeaders$1.from(headers);
26444
26940
 
26445
26941
  newConfig.url = buildURL(
26446
- buildFullPath(baseURL, url, allowAbsoluteUrls),
26447
- config.params,
26448
- config.paramsSerializer
26942
+ buildFullPath(baseURL, url, allowAbsoluteUrls, newConfig),
26943
+ own('params'),
26944
+ own('paramsSerializer')
26449
26945
  );
26450
26946
 
26451
26947
  // HTTP basic authentication
26452
26948
  if (auth) {
26453
- headers.set(
26454
- 'Authorization',
26455
- 'Basic ' +
26456
- btoa((auth.username || '') + ':' + (auth.password ? encodeUTF8(auth.password) : ''))
26457
- );
26949
+ const username = utils$1.getSafeProp(auth, 'username') || '';
26950
+ const password = utils$1.getSafeProp(auth, 'password') || '';
26951
+
26952
+ try {
26953
+ headers.set(
26954
+ 'Authorization',
26955
+ 'Basic ' + btoa(username + ':' + (password ? encodeUTF8$1(password) : ''))
26956
+ );
26957
+ } catch (e) {
26958
+ throw AxiosError$1.from(e, AxiosError$1.ERR_BAD_OPTION_VALUE, config);
26959
+ }
26458
26960
  }
26459
26961
 
26460
26962
  if (utils$1.isFormData(data)) {
26461
- if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
26462
- headers.setContentType(undefined); // browser handles it
26963
+ if (
26964
+ platform.hasStandardBrowserEnv ||
26965
+ platform.hasStandardBrowserWebWorkerEnv ||
26966
+ utils$1.isReactNative(data)
26967
+ ) {
26968
+ headers.setContentType(undefined); // browser/web worker/RN handles it
26463
26969
  } else if (utils$1.isFunction(data.getHeaders)) {
26464
26970
  // Node.js FormData (like form-data package)
26465
26971
  setFormDataHeaders(headers, data.getHeaders(), own('formDataHeaderPolicy'));
@@ -26491,7 +26997,7 @@
26491
26997
  }
26492
26998
 
26493
26999
  return newConfig;
26494
- };
27000
+ }
26495
27001
 
26496
27002
  const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
26497
27003
 
@@ -26640,7 +27146,7 @@
26640
27146
 
26641
27147
  // Add headers to the request
26642
27148
  if ('setRequestHeader' in request) {
26643
- utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
27149
+ utils$1.forEach(toByteStringHeaderObject(requestHeaders), function setRequestHeader(val, key) {
26644
27150
  request.setRequestHeader(key, val);
26645
27151
  });
26646
27152
  }
@@ -26701,6 +27207,7 @@
26701
27207
  config
26702
27208
  )
26703
27209
  );
27210
+ done();
26704
27211
  return;
26705
27212
  }
26706
27213
 
@@ -26710,54 +27217,66 @@
26710
27217
  };
26711
27218
 
26712
27219
  const composeSignals = (signals, timeout) => {
26713
- const { length } = (signals = signals ? signals.filter(Boolean) : []);
26714
-
26715
- if (timeout || length) {
26716
- let controller = new AbortController();
26717
-
26718
- let aborted;
26719
-
26720
- const onabort = function (reason) {
26721
- if (!aborted) {
26722
- aborted = true;
26723
- unsubscribe();
26724
- const err = reason instanceof Error ? reason : this.reason;
26725
- controller.abort(
26726
- err instanceof AxiosError$1
26727
- ? err
26728
- : new CanceledError$1(err instanceof Error ? err.message : err)
26729
- );
26730
- }
26731
- };
27220
+ signals = signals ? signals.filter(Boolean) : [];
26732
27221
 
26733
- let timer =
26734
- timeout &&
26735
- setTimeout(() => {
26736
- timer = null;
26737
- onabort(new AxiosError$1(`timeout of ${timeout}ms exceeded`, AxiosError$1.ETIMEDOUT));
26738
- }, timeout);
26739
-
26740
- const unsubscribe = () => {
26741
- if (signals) {
26742
- timer && clearTimeout(timer);
26743
- timer = null;
26744
- signals.forEach((signal) => {
26745
- signal.unsubscribe
26746
- ? signal.unsubscribe(onabort)
26747
- : signal.removeEventListener('abort', onabort);
26748
- });
26749
- signals = null;
26750
- }
26751
- };
27222
+ if (!timeout && !signals.length) {
27223
+ return;
27224
+ }
26752
27225
 
26753
- signals.forEach((signal) => signal.addEventListener('abort', onabort));
27226
+ const controller = new AbortController();
26754
27227
 
26755
- const { signal } = controller;
27228
+ let aborted = false;
26756
27229
 
26757
- signal.unsubscribe = () => utils$1.asap(unsubscribe);
27230
+ const onabort = function (reason) {
27231
+ if (!aborted) {
27232
+ aborted = true;
27233
+ unsubscribe();
27234
+ const err = reason instanceof Error ? reason : this.reason;
27235
+ controller.abort(
27236
+ err instanceof AxiosError$1
27237
+ ? err
27238
+ : new CanceledError$1(err instanceof Error ? err.message : err)
27239
+ );
27240
+ }
27241
+ };
26758
27242
 
26759
- return signal;
26760
- }
27243
+ let timer =
27244
+ timeout &&
27245
+ setTimeout(() => {
27246
+ timer = null;
27247
+ onabort(new AxiosError$1(`timeout of ${timeout}ms exceeded`, AxiosError$1.ETIMEDOUT));
27248
+ }, timeout);
27249
+
27250
+ const unsubscribe = () => {
27251
+ if (!signals) { return; }
27252
+ timer && clearTimeout(timer);
27253
+ timer = null;
27254
+ signals.forEach((signal) => {
27255
+ signal.unsubscribe
27256
+ ? signal.unsubscribe(onabort)
27257
+ : signal.removeEventListener('abort', onabort);
27258
+ });
27259
+ signals = null;
27260
+ };
27261
+
27262
+ signals.forEach((signal) => {
27263
+ if (aborted) {
27264
+ return;
27265
+ }
27266
+
27267
+ if (signal.aborted) {
27268
+ onabort.call(signal);
27269
+ return;
27270
+ }
27271
+
27272
+ signal.addEventListener('abort', onabort, { once: true });
27273
+ });
27274
+
27275
+ const { signal } = controller;
27276
+
27277
+ signal.unsubscribe = () => utils$1.asap(unsubscribe);
27278
+
27279
+ return signal;
26761
27280
  };
26762
27281
 
26763
27282
  const streamChunk = function* (chunk, chunkSize) {
@@ -26851,88 +27370,128 @@
26851
27370
  };
26852
27371
 
26853
27372
  /**
26854
- * Estimate decoded byte length of a data:// URL *without* allocating large buffers.
26855
- * - For base64: compute exact decoded size using length and padding;
26856
- * handle %XX at the character-count level (no string allocation).
26857
- * - For non-base64: use UTF-8 byteLength of the encoded body as a safe upper bound.
26858
- *
26859
- * @param {string} url
26860
- * @returns {number}
27373
+ * Estimate data: URL byte lengths *without* allocating large buffers.
27374
+ * - Fetch percent-decodes a base64 body before decoding it.
27375
+ * - Node's Buffer.from(body, 'base64') sizes its backing allocation from the
27376
+ * raw body, including ignored characters and content after padding.
27377
+ * - Non-base64 data is percent-decoded and then encoded as UTF-8.
26861
27378
  */
26862
- function estimateDataURLDecodedBytes(url) {
26863
- if (!url || typeof url !== 'string') return 0;
26864
- if (!url.startsWith('data:')) return 0;
27379
+ const isHexDigit = (charCode) =>
27380
+ (charCode >= 48 && charCode <= 57) ||
27381
+ (charCode >= 65 && charCode <= 70) ||
27382
+ (charCode >= 97 && charCode <= 102);
26865
27383
 
26866
- const comma = url.indexOf(',');
26867
- if (comma < 0) return 0;
27384
+ const isPercentEncodedByte = (str, i, len) =>
27385
+ i + 2 < len && isHexDigit(str.charCodeAt(i + 1)) && isHexDigit(str.charCodeAt(i + 2));
26868
27386
 
26869
- const meta = url.slice(5, comma);
26870
- const body = url.slice(comma + 1);
26871
- const isBase64 = /;base64/i.test(meta);
27387
+ const hexValue = (charCode) => (charCode <= 57 ? charCode - 48 : (charCode & 0xdf) - 55);
26872
27388
 
26873
- if (isBase64) {
26874
- let effectiveLen = body.length;
26875
- const len = body.length; // cache length
27389
+ const isBase64Char = (charCode) =>
27390
+ (charCode >= 65 && charCode <= 90) || // A-Z
27391
+ (charCode >= 97 && charCode <= 122) || // a-z
27392
+ (charCode >= 48 && charCode <= 57) || // 0-9
27393
+ charCode === 43 || // +
27394
+ charCode === 47 || // /
27395
+ charCode === 45 || // - (base64url)
27396
+ charCode === 95; // _ (base64url)
26876
27397
 
26877
- for (let i = 0; i < len; i++) {
26878
- if (body.charCodeAt(i) === 37 /* '%' */ && i + 2 < len) {
26879
- const a = body.charCodeAt(i + 1);
26880
- const b = body.charCodeAt(i + 2);
26881
- const isHex =
26882
- ((a >= 48 && a <= 57) || (a >= 65 && a <= 70) || (a >= 97 && a <= 102)) &&
26883
- ((b >= 48 && b <= 57) || (b >= 65 && b <= 70) || (b >= 97 && b <= 102));
27398
+ const isBase64Whitespace = (charCode) =>
27399
+ charCode === 9 || charCode === 10 || charCode === 12 || charCode === 13 || charCode === 32;
26884
27400
 
26885
- if (isHex) {
26886
- effectiveLen -= 2;
26887
- i += 2;
26888
- }
26889
- }
27401
+ const base64Bytes = (significant) => {
27402
+ const groups = Math.floor(significant / 4);
27403
+ const remainder = significant % 4;
27404
+ return groups * 3 + (remainder === 2 ? 1 : remainder === 3 ? 2 : 0);
27405
+ };
27406
+
27407
+ // Buffer.byteLength(body, 'base64') uses the raw string length as an allocation
27408
+ // upper bound even when Buffer.from later ignores characters or stops at '='.
27409
+ const estimateBase64BufferAllocation = (body) => {
27410
+ const len = body.length;
27411
+ let padding = 0;
27412
+
27413
+ if (len > 0 && body.charCodeAt(len - 1) === 61 /* '=' */) {
27414
+ padding++;
27415
+
27416
+ if (len > 1 && body.charCodeAt(len - 2) === 61 /* '=' */) {
27417
+ padding++;
26890
27418
  }
27419
+ }
27420
+
27421
+ return Math.floor(((len - padding) * 3) / 4);
27422
+ };
26891
27423
 
26892
- let pad = 0;
26893
- let idx = len - 1;
27424
+ const estimatePercentDecodedBase64Bytes = (body) => {
27425
+ const len = body.length;
27426
+ let significant = 0;
27427
+ let padding = 0;
27428
+ let invalid = false;
26894
27429
 
26895
- const tailIsPct3D = (j) =>
26896
- j >= 2 &&
26897
- body.charCodeAt(j - 2) === 37 && // '%'
26898
- body.charCodeAt(j - 1) === 51 && // '3'
26899
- (body.charCodeAt(j) === 68 || body.charCodeAt(j) === 100); // 'D' or 'd'
27430
+ for (let i = 0; i < len; i++) {
27431
+ let code = body.charCodeAt(i);
26900
27432
 
26901
- if (idx >= 0) {
26902
- if (body.charCodeAt(idx) === 61 /* '=' */) {
26903
- pad++;
26904
- idx--;
26905
- } else if (tailIsPct3D(idx)) {
26906
- pad++;
26907
- idx -= 3;
26908
- }
27433
+ if (code === 37 /* '%' */ && isPercentEncodedByte(body, i, len)) {
27434
+ code = hexValue(body.charCodeAt(i + 1)) * 16 + hexValue(body.charCodeAt(i + 2));
27435
+ i += 2;
26909
27436
  }
26910
27437
 
26911
- if (pad === 1 && idx >= 0) {
26912
- if (body.charCodeAt(idx) === 61 /* '=' */) {
26913
- pad++;
26914
- } else if (tailIsPct3D(idx)) {
26915
- pad++;
26916
- }
27438
+ if (isBase64Whitespace(code)) {
27439
+ continue;
27440
+ }
27441
+
27442
+ if (code === 61 /* '=' */) {
27443
+ padding++;
27444
+ continue;
26917
27445
  }
26918
27446
 
26919
- const groups = Math.floor(effectiveLen / 4);
26920
- const bytes = groups * 3 - (pad || 0);
26921
- return bytes > 0 ? bytes : 0;
27447
+ if (!isBase64Char(code) || padding > 0) {
27448
+ invalid = true;
27449
+ continue;
27450
+ }
27451
+
27452
+ significant++;
26922
27453
  }
26923
27454
 
26924
- if (typeof Buffer !== 'undefined' && typeof Buffer.byteLength === 'function') {
26925
- return Buffer.byteLength(body, 'utf8');
27455
+ // Fetch rejects malformed forgiving-base64 input. Returning the raw-size
27456
+ // allocation bound keeps that invalid input from becoming a pre-check bypass.
27457
+ if (
27458
+ invalid ||
27459
+ padding > 2 ||
27460
+ (padding > 0 && (significant + padding) % 4 !== 0) ||
27461
+ significant % 4 === 1
27462
+ ) {
27463
+ return estimateBase64BufferAllocation(body);
27464
+ }
27465
+
27466
+ return base64Bytes(significant);
27467
+ };
27468
+
27469
+ const estimateDataURLBytes = (url, estimateBase64) => {
27470
+ if (!url || typeof url !== 'string') return 0;
27471
+ if (!url.startsWith('data:')) return 0;
27472
+
27473
+ const comma = url.indexOf(',');
27474
+ if (comma < 0) return 0;
27475
+
27476
+ const meta = url.slice(5, comma);
27477
+ const body = url.slice(comma + 1);
27478
+ const isBase64 = /;base64/i.test(meta);
27479
+
27480
+ if (isBase64) {
27481
+ return estimateBase64(body);
26926
27482
  }
26927
27483
 
26928
27484
  // Compute UTF-8 byte length directly from UTF-16 code units without allocating
26929
27485
  // a byte buffer (TextEncoder.encode would defeat the DoS guard on large bodies).
26930
- // Using body.length here would undercount non-ASCII (e.g. '€' is 1 code unit
26931
- // but 3 UTF-8 bytes).
27486
+ // Valid %XX triplets count as one decoded byte; this matches the bytes that
27487
+ // decodeURIComponent(body) would produce before Buffer re-encodes the string.
26932
27488
  let bytes = 0;
26933
27489
  for (let i = 0, len = body.length; i < len; i++) {
26934
27490
  const c = body.charCodeAt(i);
26935
- if (c < 0x80) {
27491
+ if (c === 37 /* '%' */ && isPercentEncodedByte(body, i, len)) {
27492
+ bytes += 1;
27493
+ i += 2;
27494
+ } else if (c < 0x80) {
26936
27495
  bytes += 1;
26937
27496
  } else if (c < 0x800) {
26938
27497
  bytes += 2;
@@ -26949,14 +27508,59 @@
26949
27508
  }
26950
27509
  }
26951
27510
  return bytes;
27511
+ };
27512
+
27513
+ /**
27514
+ * Estimate the percent-decoded payload size used by Fetch data: URLs.
27515
+ *
27516
+ * @param {string} url
27517
+ * @returns {number}
27518
+ */
27519
+ function estimateDataURLDecodedBytes(url) {
27520
+ // Fetch removes URL fragments before processing a data: URL.
27521
+ const fragmentIndex = typeof url === 'string' ? url.indexOf('#') : -1;
27522
+
27523
+ return estimateDataURLBytes(
27524
+ fragmentIndex === -1 ? url : url.slice(0, fragmentIndex),
27525
+ estimatePercentDecodedBase64Bytes
27526
+ );
26952
27527
  }
26953
27528
 
26954
- const VERSION$1 = "1.16.0";
27529
+ const VERSION$1 = "1.19.0";
26955
27530
 
26956
27531
  const DEFAULT_CHUNK_SIZE = 64 * 1024;
26957
27532
 
26958
27533
  const { isFunction } = utils$1;
26959
27534
 
27535
+ /**
27536
+ * Encode a UTF-8 string to a Latin-1 byte string for use with btoa().
27537
+ * This is a modern replacement for the deprecated unescape(encodeURIComponent(str)) pattern.
27538
+ *
27539
+ * @param {string} str The string to encode
27540
+ *
27541
+ * @returns {string} UTF-8 bytes as a Latin-1 string
27542
+ */
27543
+ const encodeUTF8 = (str) =>
27544
+ encodeURIComponent(str).replace(/%([0-9A-F]{2})/gi, (_, hex) =>
27545
+ String.fromCharCode(parseInt(hex, 16))
27546
+ );
27547
+
27548
+ // Node's WHATWG URL parser returns `username` and `password` percent-encoded.
27549
+ // Decode before composing the `auth` option so credentials such as
27550
+ // `my%40email.com:pass` are sent as `my@email.com:pass`. Falls back to the
27551
+ // original value for malformed input so a bad encoding never throws.
27552
+ const decodeURIComponentSafe = (value) => {
27553
+ if (!utils$1.isString(value)) {
27554
+ return value;
27555
+ }
27556
+
27557
+ try {
27558
+ return decodeURIComponent(value);
27559
+ } catch (error) {
27560
+ return value;
27561
+ }
27562
+ };
27563
+
26960
27564
  const test = (fn, ...args) => {
26961
27565
  try {
26962
27566
  return !!fn(...args);
@@ -26965,8 +27569,20 @@
26965
27569
  }
26966
27570
  };
26967
27571
 
27572
+ const maybeWithAuthCredentials = (url) => {
27573
+ const protocolIndex = url.indexOf('://');
27574
+ let urlToCheck = url;
27575
+ if (protocolIndex !== -1) {
27576
+ urlToCheck = urlToCheck.slice(protocolIndex + 3);
27577
+ }
27578
+ return urlToCheck.includes('@') || urlToCheck.includes(':');
27579
+ };
27580
+
26968
27581
  const factory = (env) => {
26969
- const globalObject = utils$1.global ?? globalThis;
27582
+ const globalObject =
27583
+ utils$1.global !== undefined && utils$1.global !== null
27584
+ ? utils$1.global
27585
+ : globalThis;
26970
27586
  const { ReadableStream, TextEncoder } = globalObject;
26971
27587
 
26972
27588
  env = utils$1.merge.call(
@@ -27109,6 +27725,7 @@
27109
27725
 
27110
27726
  const hasMaxContentLength = utils$1.isNumber(maxContentLength) && maxContentLength > -1;
27111
27727
  const hasMaxBodyLength = utils$1.isNumber(maxBodyLength) && maxBodyLength > -1;
27728
+ const own = (key) => (utils$1.hasOwnProp(config, key) ? config[key] : undefined);
27112
27729
 
27113
27730
  let _fetch = envFetch || fetch;
27114
27731
 
@@ -27130,7 +27747,61 @@
27130
27747
 
27131
27748
  let requestContentLength;
27132
27749
 
27750
+ // AxiosError we raise while the request body is being streamed. Captured
27751
+ // by identity so the catch block can surface it directly, regardless of
27752
+ // how the runtime wraps the resulting fetch rejection (undici exposes it
27753
+ // as `err.cause`; some browsers drop the original error entirely).
27754
+ let pendingBodyError = null;
27755
+
27756
+ const maxBodyLengthError = () =>
27757
+ new AxiosError$1(
27758
+ 'Request body larger than maxBodyLength limit',
27759
+ AxiosError$1.ERR_BAD_REQUEST,
27760
+ config,
27761
+ request
27762
+ );
27763
+
27133
27764
  try {
27765
+ // HTTP basic authentication
27766
+ let auth = undefined;
27767
+ const configAuth = own('auth');
27768
+
27769
+ if (configAuth) {
27770
+ const username = utils$1.getSafeProp(configAuth, 'username') || '';
27771
+ const password = utils$1.getSafeProp(configAuth, 'password') || '';
27772
+ auth = {
27773
+ username,
27774
+ password
27775
+ };
27776
+ }
27777
+
27778
+ if (maybeWithAuthCredentials(url)) {
27779
+ const parsedURL = new URL(url, platform.origin);
27780
+
27781
+ if (!auth && (parsedURL.username || parsedURL.password)) {
27782
+ const urlUsername = decodeURIComponentSafe(parsedURL.username);
27783
+ const urlPassword = decodeURIComponentSafe(parsedURL.password);
27784
+ auth = {
27785
+ username: urlUsername,
27786
+ password: urlPassword
27787
+ };
27788
+ }
27789
+
27790
+ if (parsedURL.username || parsedURL.password) {
27791
+ parsedURL.username = '';
27792
+ parsedURL.password = '';
27793
+ url = parsedURL.href;
27794
+ }
27795
+ }
27796
+
27797
+ if (auth) {
27798
+ headers.delete('authorization');
27799
+ headers.set(
27800
+ 'Authorization',
27801
+ 'Basic ' + btoa(encodeUTF8((auth.username || '') + ':' + (auth.password || '')))
27802
+ );
27803
+ }
27804
+
27134
27805
  // Enforce maxContentLength for data: URLs up-front so we never materialize
27135
27806
  // an oversized payload. The HTTP adapter applies the same check (see http.js
27136
27807
  // "if (protocol === 'data:')" branch).
@@ -27146,53 +27817,96 @@
27146
27817
  }
27147
27818
  }
27148
27819
 
27149
- // Enforce maxBodyLength against the outbound request body before dispatch.
27150
- // Mirrors http.js behavior (ERR_BAD_REQUEST / 'Request body larger than
27151
- // maxBodyLength limit'). Skip when the body length cannot be determined
27152
- // (e.g. a live ReadableStream supplied by the caller).
27820
+ // Enforce maxBodyLength against known-size bodies before dispatch using
27821
+ // the body's *actual* size never a caller-declared Content-Length,
27822
+ // which could under-report to slip an oversized body past the check.
27823
+ // Unknown-size streams return undefined here and are counted per-chunk
27824
+ // below as fetch consumes them.
27153
27825
  if (hasMaxBodyLength && method !== 'get' && method !== 'head') {
27154
- const outboundLength = await resolveBodyLength(headers, data);
27155
- if (
27156
- typeof outboundLength === 'number' &&
27157
- isFinite(outboundLength) &&
27158
- outboundLength > maxBodyLength
27159
- ) {
27160
- throw new AxiosError$1(
27161
- 'Request body larger than maxBodyLength limit',
27162
- AxiosError$1.ERR_BAD_REQUEST,
27163
- config,
27164
- request
27165
- );
27826
+ const outboundLength = await getBodyLength(data);
27827
+ if (typeof outboundLength === 'number' && isFinite(outboundLength)) {
27828
+ requestContentLength = outboundLength;
27829
+ if (outboundLength > maxBodyLength) {
27830
+ throw maxBodyLengthError();
27831
+ }
27166
27832
  }
27167
27833
  }
27168
27834
 
27835
+ // A streamed body under maxBodyLength must be counted as fetch consumes
27836
+ // it; its size is never trusted from a caller-declared Content-Length.
27837
+ const mustEnforceStreamBody =
27838
+ hasMaxBodyLength && (utils$1.isReadableStream(data) || utils$1.isStream(data));
27839
+
27840
+ const trackRequestStream = (stream, onProgress, flush) =>
27841
+ trackStream(
27842
+ stream,
27843
+ DEFAULT_CHUNK_SIZE,
27844
+ (loadedBytes) => {
27845
+ if (hasMaxBodyLength && loadedBytes > maxBodyLength) {
27846
+ throw (pendingBodyError = maxBodyLengthError());
27847
+ }
27848
+ onProgress && onProgress(loadedBytes);
27849
+ },
27850
+ flush
27851
+ );
27852
+
27169
27853
  if (
27170
- onUploadProgress &&
27171
27854
  supportsRequestStream &&
27172
27855
  method !== 'get' &&
27173
27856
  method !== 'head' &&
27174
- (requestContentLength = await resolveBodyLength(headers, data)) !== 0
27857
+ (onUploadProgress || mustEnforceStreamBody)
27175
27858
  ) {
27176
- let _request = new Request(url, {
27177
- method: 'POST',
27178
- body: data,
27179
- duplex: 'half',
27180
- });
27859
+ requestContentLength =
27860
+ requestContentLength == null ? await resolveBodyLength(headers, data) : requestContentLength;
27861
+
27862
+ // A declared length of 0 is only trusted to skip the wrap when we are
27863
+ // not enforcing a stream limit (which must not rely on that header).
27864
+ if (requestContentLength !== 0 || mustEnforceStreamBody) {
27865
+ let _request = new Request(url, {
27866
+ method: 'POST',
27867
+ body: data,
27868
+ duplex: 'half',
27869
+ });
27181
27870
 
27182
- let contentTypeHeader;
27871
+ let contentTypeHeader;
27183
27872
 
27184
- if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
27185
- headers.setContentType(contentTypeHeader);
27186
- }
27873
+ if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
27874
+ headers.setContentType(contentTypeHeader);
27875
+ }
27187
27876
 
27188
- if (_request.body) {
27189
- const [onProgress, flush] = progressEventDecorator(
27190
- requestContentLength,
27191
- progressEventReducer(asyncDecorator(onUploadProgress))
27192
- );
27877
+ if (_request.body) {
27878
+ const [onProgress, flush] =
27879
+ (onUploadProgress &&
27880
+ progressEventDecorator(
27881
+ requestContentLength,
27882
+ progressEventReducer(asyncDecorator(onUploadProgress))
27883
+ )) ||
27884
+ [];
27193
27885
 
27194
- data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
27886
+ data = trackRequestStream(_request.body, onProgress, flush);
27887
+ }
27195
27888
  }
27889
+ } else if (
27890
+ mustEnforceStreamBody &&
27891
+ !isRequestSupported &&
27892
+ isReadableStreamSupported &&
27893
+ method !== 'get' &&
27894
+ method !== 'head'
27895
+ ) {
27896
+ data = trackRequestStream(data);
27897
+ } else if (
27898
+ mustEnforceStreamBody &&
27899
+ isRequestSupported &&
27900
+ !supportsRequestStream &&
27901
+ method !== 'get' &&
27902
+ method !== 'head'
27903
+ ) {
27904
+ throw new AxiosError$1(
27905
+ 'Stream request bodies are not supported by the current fetch implementation',
27906
+ AxiosError$1.ERR_NOT_SUPPORT,
27907
+ config,
27908
+ request
27909
+ );
27196
27910
  }
27197
27911
 
27198
27912
  if (!utils$1.isString(withCredentials)) {
@@ -27223,7 +27937,7 @@
27223
27937
  ...fetchOptions,
27224
27938
  signal: composedSignal,
27225
27939
  method: method.toUpperCase(),
27226
- headers: headers.normalize().toJSON(),
27940
+ headers: toByteStringHeaderObject(headers.normalize()),
27227
27941
  body: data,
27228
27942
  duplex: 'half',
27229
27943
  credentials: isCredentialsSupported ? withCredentials : undefined,
@@ -27235,10 +27949,12 @@
27235
27949
  ? _fetch(request, fetchOptions)
27236
27950
  : _fetch(url, resolvedOptions));
27237
27951
 
27952
+ const responseHeaders = AxiosHeaders$1.from(response.headers);
27953
+
27238
27954
  // Cheap pre-check: if the server honestly declares a content-length that
27239
27955
  // already exceeds the cap, reject before we start streaming.
27240
27956
  if (hasMaxContentLength) {
27241
- const declaredLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
27957
+ const declaredLength = utils$1.toFiniteNumber(responseHeaders.getContentLength());
27242
27958
  if (declaredLength != null && declaredLength > maxContentLength) {
27243
27959
  throw new AxiosError$1(
27244
27960
  'maxContentLength size of ' + maxContentLength + ' exceeded',
@@ -27263,7 +27979,7 @@
27263
27979
  options[prop] = response[prop];
27264
27980
  });
27265
27981
 
27266
- const responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
27982
+ const responseContentLength = utils$1.toFiniteNumber(responseHeaders.getContentLength());
27267
27983
 
27268
27984
  const [onProgress, flush] =
27269
27985
  (onDownloadProgress &&
@@ -27354,23 +28070,55 @@
27354
28070
  const canceledError = composedSignal.reason;
27355
28071
  canceledError.config = config;
27356
28072
  request && (canceledError.request = request);
27357
- err !== canceledError && (canceledError.cause = err);
28073
+ if (err !== canceledError) {
28074
+ // Non-enumerable to match native Error `cause` semantics so loggers
28075
+ // don't recurse into circular fetch internals (see #7205).
28076
+ Object.defineProperty(canceledError, 'cause', {
28077
+ __proto__: null,
28078
+ value: err,
28079
+ writable: true,
28080
+ enumerable: false,
28081
+ configurable: true,
28082
+ });
28083
+ }
27358
28084
  throw canceledError;
27359
28085
  }
27360
28086
 
28087
+ // Surface a maxBodyLength violation we raised while the request body was
28088
+ // being streamed. Matching by identity (rather than reading
28089
+ // `err.cause.isAxiosError`) keeps the error deterministic across runtimes
28090
+ // and avoids both prototype-pollution reads and mis-attributing a foreign
28091
+ // AxiosError that merely happened to land in `err.cause`.
28092
+ if (pendingBodyError) {
28093
+ request && !pendingBodyError.request && (pendingBodyError.request = request);
28094
+ throw pendingBodyError;
28095
+ }
28096
+
28097
+ // Re-throw AxiosErrors we raised synchronously (data: URL / content-length
28098
+ // pre-checks, response size enforcement) without re-wrapping them.
28099
+ if (err instanceof AxiosError$1) {
28100
+ request && !err.request && (err.request = request);
28101
+ throw err;
28102
+ }
28103
+
27361
28104
  if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
27362
- throw Object.assign(
27363
- new AxiosError$1(
27364
- 'Network Error',
27365
- AxiosError$1.ERR_NETWORK,
27366
- config,
27367
- request,
27368
- err && err.response
27369
- ),
27370
- {
27371
- cause: err.cause || err,
27372
- }
28105
+ const networkError = new AxiosError$1(
28106
+ 'Network Error',
28107
+ AxiosError$1.ERR_NETWORK,
28108
+ config,
28109
+ request,
28110
+ err && err.response
27373
28111
  );
28112
+ // Non-enumerable to match native Error `cause` semantics so loggers
28113
+ // don't recurse into circular fetch internals (see #7205).
28114
+ Object.defineProperty(networkError, 'cause', {
28115
+ __proto__: null,
28116
+ value: err.cause || err,
28117
+ writable: true,
28118
+ enumerable: false,
28119
+ configurable: true,
28120
+ });
28121
+ throw networkError;
27374
28122
  }
27375
28123
 
27376
28124
  throw AxiosError$1.from(err, err && err.code, config, request, err && err.response);
@@ -27508,7 +28256,7 @@
27508
28256
 
27509
28257
  throw new AxiosError$1(
27510
28258
  `There is no suitable adapter to dispatch the request ` + s,
27511
- 'ERR_NOT_SUPPORT'
28259
+ AxiosError$1.ERR_NOT_SUPPORT
27512
28260
  );
27513
28261
  }
27514
28262
 
@@ -27689,7 +28437,7 @@
27689
28437
  */
27690
28438
 
27691
28439
  function assertOptions(options, schema, allowUnknown) {
27692
- if (typeof options !== 'object') {
28440
+ if (typeof options !== 'object' || options === null) {
27693
28441
  throw new AxiosError$1('options must be an object', AxiosError$1.ERR_BAD_OPTION_VALUE);
27694
28442
  }
27695
28443
  const keys = Object.keys(options);
@@ -27812,6 +28560,8 @@
27812
28560
  forcedJSONParsing: validators.transitional(validators.boolean),
27813
28561
  clarifyTimeoutError: validators.transitional(validators.boolean),
27814
28562
  legacyInterceptorReqResOrdering: validators.transitional(validators.boolean),
28563
+ advertiseZstdAcceptEncoding: validators.transitional(validators.boolean),
28564
+ validateStatusUndefinedResolves: validators.transitional(validators.boolean),
27815
28565
  },
27816
28566
  false
27817
28567
  );
@@ -27916,17 +28666,35 @@
27916
28666
  const onFulfilled = requestInterceptorChain[i++];
27917
28667
  const onRejected = requestInterceptorChain[i++];
27918
28668
  try {
27919
- newConfig = onFulfilled(newConfig);
28669
+ newConfig = onFulfilled ? onFulfilled(newConfig) : newConfig;
27920
28670
  } catch (error) {
27921
- onRejected.call(this, error);
28671
+ if (!onRejected) {
28672
+ promise = Promise.reject(error);
28673
+ break;
28674
+ }
28675
+
28676
+ try {
28677
+ const rejectedResult = onRejected.call(this, error);
28678
+
28679
+ if (utils$1.isThenable(rejectedResult)) {
28680
+ promise = Promise.resolve(rejectedResult).then(() =>
28681
+ dispatchRequest.call(this, newConfig)
28682
+ );
28683
+ }
28684
+ } catch (rejectedError) {
28685
+ promise = Promise.reject(rejectedError);
28686
+ }
28687
+
27922
28688
  break;
27923
28689
  }
27924
28690
  }
27925
28691
 
27926
- try {
27927
- promise = dispatchRequest.call(this, newConfig);
27928
- } catch (error) {
27929
- return Promise.reject(error);
28692
+ if (!promise) {
28693
+ try {
28694
+ promise = dispatchRequest.call(this, newConfig);
28695
+ } catch (error) {
28696
+ promise = Promise.reject(error);
28697
+ }
27930
28698
  }
27931
28699
 
27932
28700
  i = 0;
@@ -27941,7 +28709,7 @@
27941
28709
 
27942
28710
  getUri(config) {
27943
28711
  config = mergeConfig$1(this.defaults, config);
27944
- const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
28712
+ const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls, config);
27945
28713
  return buildURL(fullPath, config.params, config.paramsSerializer);
27946
28714
  }
27947
28715
  };
@@ -27954,7 +28722,7 @@
27954
28722
  mergeConfig$1(config || {}, {
27955
28723
  method,
27956
28724
  url,
27957
- data: (config || {}).data,
28725
+ data: config && utils$1.hasOwnProp(config, 'data') ? config.data : undefined,
27958
28726
  })
27959
28727
  );
27960
28728
  };
@@ -28219,6 +28987,7 @@
28219
28987
  LoopDetected: 508,
28220
28988
  NotExtended: 510,
28221
28989
  NetworkAuthenticationRequired: 511,
28990
+ WebServerReturnsAnUnknownError: 520,
28222
28991
  WebServerIsDown: 521,
28223
28992
  ConnectionTimedOut: 522,
28224
28993
  OriginIsUnreachable: 523,