@mapples/cli 0.0.8 → 0.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -24,6 +24,7 @@ var require$$0$6 = require('os');
24
24
  var require$$3$2 = require('http');
25
25
  var require$$4$1 = require('https');
26
26
  var require$$0$7 = require('url');
27
+ var http2 = require('http2');
27
28
  var require$$4$2 = require('assert');
28
29
  var zlib = require('zlib');
29
30
  var events = require('events');
@@ -23103,21 +23104,21 @@ var Observable = {};
23103
23104
 
23104
23105
  var Subscriber = {};
23105
23106
 
23106
- var isFunction$1 = {};
23107
+ var isFunction$2 = {};
23107
23108
 
23108
23109
  var hasRequiredIsFunction;
23109
23110
 
23110
23111
  function requireIsFunction () {
23111
- if (hasRequiredIsFunction) return isFunction$1;
23112
+ if (hasRequiredIsFunction) return isFunction$2;
23112
23113
  hasRequiredIsFunction = 1;
23113
- Object.defineProperty(isFunction$1, "__esModule", { value: true });
23114
- isFunction$1.isFunction = void 0;
23114
+ Object.defineProperty(isFunction$2, "__esModule", { value: true });
23115
+ isFunction$2.isFunction = void 0;
23115
23116
  function isFunction(value) {
23116
23117
  return typeof value === 'function';
23117
23118
  }
23118
- isFunction$1.isFunction = isFunction;
23119
+ isFunction$2.isFunction = isFunction;
23119
23120
 
23120
- return isFunction$1;
23121
+ return isFunction$2;
23121
23122
  }
23122
23123
 
23123
23124
  var Subscription = {};
@@ -23375,16 +23376,16 @@ function requireSubscription () {
23375
23376
  return Subscription;
23376
23377
  }
23377
23378
 
23378
- var config$1 = {};
23379
+ var config = {};
23379
23380
 
23380
23381
  var hasRequiredConfig;
23381
23382
 
23382
23383
  function requireConfig () {
23383
- if (hasRequiredConfig) return config$1;
23384
+ if (hasRequiredConfig) return config;
23384
23385
  hasRequiredConfig = 1;
23385
- Object.defineProperty(config$1, "__esModule", { value: true });
23386
- config$1.config = void 0;
23387
- config$1.config = {
23386
+ Object.defineProperty(config, "__esModule", { value: true });
23387
+ config.config = void 0;
23388
+ config.config = {
23388
23389
  onUnhandledError: null,
23389
23390
  onStoppedNotification: null,
23390
23391
  Promise: undefined,
@@ -23392,7 +23393,7 @@ function requireConfig () {
23392
23393
  useDeprecatedNextContext: false,
23393
23394
  };
23394
23395
 
23395
- return config$1;
23396
+ return config;
23396
23397
  }
23397
23398
 
23398
23399
  var reportUnhandledError = {};
@@ -50243,7 +50244,7 @@ const DEFAULT_CONFIG = {
50243
50244
  sandboxUrl: 'https://staging.mapples.org',
50244
50245
  assetUrl: 'https://staging.assets.mapples.org',
50245
50246
  useExpoRouter: false,
50246
- sourceDir: 'src',
50247
+ sourceDir: 'mapples',
50247
50248
  dirs: {
50248
50249
  pages: 'pages',
50249
50250
  style: 'style',
@@ -52817,6 +52818,87 @@ const getPackageVersionFromJson = (packageName) => {
52817
52818
  const getInstalledVersion = (packageName) => {
52818
52819
  return getPackageVersionFromJson(packageName);
52819
52820
  };
52821
+ const parseVersion = (version) => {
52822
+ const parts = version.split('.').map(Number);
52823
+ while (parts.length < 3) {
52824
+ parts.push(0);
52825
+ }
52826
+ return parts;
52827
+ };
52828
+ const compareVersions = (v1, v2) => {
52829
+ const parts1 = parseVersion(v1);
52830
+ const parts2 = parseVersion(v2);
52831
+ for (let i = 0; i < 3; i++) {
52832
+ if (parts1[i] < parts2[i])
52833
+ return -1;
52834
+ if (parts1[i] > parts2[i])
52835
+ return 1;
52836
+ }
52837
+ return 0;
52838
+ };
52839
+ const isVersionSatisfied = (installedVersion, latestVersion) => {
52840
+ try {
52841
+ // Remove whitespace
52842
+ const installed = installedVersion.trim();
52843
+ const latest = latestVersion.trim();
52844
+ // If exact match (starts with a digit, no prefix), do exact comparison
52845
+ if (/^\d/.test(installed)) {
52846
+ return compareVersions(installed, latest) === 0;
52847
+ }
52848
+ // Handle caret (^) prefix: ^1.0.3 means >=1.0.3 <2.0.0
52849
+ if (installed.startsWith('^')) {
52850
+ const baseVersion = installed.slice(1);
52851
+ const baseParts = parseVersion(baseVersion);
52852
+ // Check if latest >= base version
52853
+ if (compareVersions(latest, baseVersion) < 0) {
52854
+ return false;
52855
+ }
52856
+ // Check if latest < next major version
52857
+ const nextMajor = [baseParts[0] + 1, 0, 0];
52858
+ const nextMajorStr = nextMajor.join('.');
52859
+ return compareVersions(latest, nextMajorStr) < 0;
52860
+ }
52861
+ // Handle tilde (~) prefix: ~1.0.3 means >=1.0.3 <1.1.0
52862
+ if (installed.startsWith('~')) {
52863
+ const baseVersion = installed.slice(1);
52864
+ const baseParts = parseVersion(baseVersion);
52865
+ // Check if latest >= base version
52866
+ if (compareVersions(latest, baseVersion) < 0) {
52867
+ return false;
52868
+ }
52869
+ // Check if latest < next minor version
52870
+ const nextMinor = [baseParts[0], baseParts[1] + 1, 0];
52871
+ const nextMinorStr = nextMinor.join('.');
52872
+ return compareVersions(latest, nextMinorStr) < 0;
52873
+ }
52874
+ // Handle >= prefix
52875
+ if (installed.startsWith('>=')) {
52876
+ const minVersion = installed.slice(2);
52877
+ return compareVersions(latest, minVersion) >= 0;
52878
+ }
52879
+ // Handle <= prefix
52880
+ if (installed.startsWith('<=')) {
52881
+ const maxVersion = installed.slice(2);
52882
+ return compareVersions(latest, maxVersion) <= 0;
52883
+ }
52884
+ // Handle > prefix
52885
+ if (installed.startsWith('>')) {
52886
+ const minVersion = installed.slice(1);
52887
+ return compareVersions(latest, minVersion) > 0;
52888
+ }
52889
+ // Handle < prefix
52890
+ if (installed.startsWith('<')) {
52891
+ const maxVersion = installed.slice(1);
52892
+ return compareVersions(latest, maxVersion) < 0;
52893
+ }
52894
+ // If we can't parse it, fall back to string comparison
52895
+ return installed === latest;
52896
+ }
52897
+ catch {
52898
+ // If parsing fails, fall back to string comparison
52899
+ return installedVersion === latestVersion;
52900
+ }
52901
+ };
52820
52902
  const installPackage = (packageName, version, packageManager) => {
52821
52903
  try {
52822
52904
  let command;
@@ -52872,6 +52954,15 @@ const isExpoAvailable = () => {
52872
52954
  return false;
52873
52955
  }
52874
52956
  };
52957
+ const isSDKVersionSupported = (installedSDKVersion, requiredSDKVersions) => {
52958
+ if (!installedSDKVersion) {
52959
+ return false;
52960
+ }
52961
+ const requiredVersions = Array.isArray(requiredSDKVersions)
52962
+ ? requiredSDKVersions
52963
+ : [requiredSDKVersions];
52964
+ return requiredVersions.some((requiredVersion) => installedSDKVersion.includes(requiredVersion));
52965
+ };
52875
52966
  const installExpoPackage = (packageName) => {
52876
52967
  try {
52877
52968
  console.log(chalk.blue(`Installing ${packageName} with expo install...`));
@@ -52928,7 +53019,7 @@ const syncPackages = async (autoApprove = false) => {
52928
53019
  type: 'mapples',
52929
53020
  });
52930
53021
  }
52931
- else if (installedVersion !== latestVersion) {
53022
+ else if (!isVersionSatisfied(installedVersion, latestVersion)) {
52932
53023
  packagesToUpdate.push({
52933
53024
  name: packageName,
52934
53025
  currentVersion: installedVersion,
@@ -52944,15 +53035,19 @@ const syncPackages = async (autoApprove = false) => {
52944
53035
  if (packageList.expo) {
52945
53036
  console.log(chalk.blue('\n📱 Checking Expo packages...'));
52946
53037
  const installedSDKVersion = getInstalledExpoSDKVersion();
52947
- const requiredSDKVersion = packageList.expo.sdk;
53038
+ const requiredSDKVersions = packageList.expo.sdk;
53039
+ const requiredVersionsArray = Array.isArray(requiredSDKVersions)
53040
+ ? requiredSDKVersions
53041
+ : [requiredSDKVersions];
53042
+ const requiredVersionsDisplay = requiredVersionsArray.join(', ');
52948
53043
  if (!installedSDKVersion) {
52949
53044
  expoIssues.push(`Expo is not installed or not available`);
52950
53045
  }
52951
- else if (!installedSDKVersion.includes(requiredSDKVersion)) {
52952
- expoIssues.push(`Expo SDK version mismatch: installed ${installedSDKVersion}, required ${requiredSDKVersion}`);
53046
+ else if (!isSDKVersionSupported(installedSDKVersion, requiredSDKVersions)) {
53047
+ expoIssues.push(`Expo SDK version mismatch: installed ${installedSDKVersion}, required ${requiredVersionsDisplay}`);
52953
53048
  }
52954
53049
  else {
52955
- console.log(chalk.green(`✓ Expo SDK version ${installedSDKVersion} matches required ${requiredSDKVersion}`));
53050
+ console.log(chalk.green(`✓ Expo SDK version ${installedSDKVersion} matches required version(s): ${requiredVersionsDisplay}`));
52956
53051
  }
52957
53052
  if (isExpoAvailable()) {
52958
53053
  for (const packageName of packageList.expo.dependencies) {
@@ -53054,7 +53149,7 @@ const showPackageInfo = () => {
53054
53149
  if (!installedVersion) {
53055
53150
  console.log(chalk.red(` • ${packageName}: not installed (latest: ${latestVersion || 'unknown'})`));
53056
53151
  }
53057
- else if (installedVersion !== latestVersion) {
53152
+ else if (!latestVersion || !isVersionSatisfied(installedVersion, latestVersion)) {
53058
53153
  console.log(chalk.yellow(` • ${packageName}: ${installedVersion} (latest: ${latestVersion || 'unknown'})`));
53059
53154
  }
53060
53155
  else {
@@ -53065,12 +53160,16 @@ const showPackageInfo = () => {
53065
53160
  if (packageList.expo) {
53066
53161
  console.log(chalk.blue('\n📱 Expo packages:'));
53067
53162
  const installedSDKVersion = getInstalledExpoSDKVersion();
53068
- const requiredSDKVersion = packageList.expo.sdk;
53163
+ const requiredSDKVersions = packageList.expo.sdk;
53164
+ const requiredVersionsArray = Array.isArray(requiredSDKVersions)
53165
+ ? requiredSDKVersions
53166
+ : [requiredSDKVersions];
53167
+ const requiredVersionsDisplay = requiredVersionsArray.join(', ');
53069
53168
  if (!installedSDKVersion) {
53070
- console.log(chalk.red(` • Expo SDK: not installed (required: ${requiredSDKVersion})`));
53169
+ console.log(chalk.red(` • Expo SDK: not installed (required: ${requiredVersionsDisplay})`));
53071
53170
  }
53072
- else if (!installedSDKVersion.includes(requiredSDKVersion)) {
53073
- console.log(chalk.yellow(` • Expo SDK: ${installedSDKVersion} (required: ${requiredSDKVersion})`));
53171
+ else if (!isSDKVersionSupported(installedSDKVersion, requiredSDKVersions)) {
53172
+ console.log(chalk.yellow(` • Expo SDK: ${installedSDKVersion} (required: ${requiredVersionsDisplay})`));
53074
53173
  }
53075
53174
  else {
53076
53175
  console.log(chalk.green(` • Expo SDK: ${installedSDKVersion} ✓`));
@@ -55105,6 +55204,13 @@ function requireCliTable3 () {
55105
55204
  var cliTable3Exports = requireCliTable3();
55106
55205
  var Table = /*@__PURE__*/getDefaultExportFromCjs(cliTable3Exports);
55107
55206
 
55207
+ /**
55208
+ * Create a bound version of a function with a specified `this` context
55209
+ *
55210
+ * @param {Function} fn - The function to bind
55211
+ * @param {*} thisArg - The value to be passed as the `this` parameter
55212
+ * @returns {Function} A new function that will call the original function with the specified `this` context
55213
+ */
55108
55214
  function bind(fn, thisArg) {
55109
55215
  return function wrap() {
55110
55216
  return fn.apply(thisArg, arguments);
@@ -55156,7 +55262,7 @@ const isUndefined = typeOfTest('undefined');
55156
55262
  */
55157
55263
  function isBuffer(val) {
55158
55264
  return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
55159
- && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);
55265
+ && isFunction$1(val.constructor.isBuffer) && val.constructor.isBuffer(val);
55160
55266
  }
55161
55267
 
55162
55268
  /**
@@ -55201,7 +55307,7 @@ const isString = typeOfTest('string');
55201
55307
  * @param {*} val The value to test
55202
55308
  * @returns {boolean} True if value is a Function, otherwise false
55203
55309
  */
55204
- const isFunction = typeOfTest('function');
55310
+ const isFunction$1 = typeOfTest('function');
55205
55311
 
55206
55312
  /**
55207
55313
  * Determine if a value is a Number
@@ -55257,7 +55363,7 @@ const isEmptyObject = (val) => {
55257
55363
  if (!isObject(val) || isBuffer(val)) {
55258
55364
  return false;
55259
55365
  }
55260
-
55366
+
55261
55367
  try {
55262
55368
  return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
55263
55369
  } catch (e) {
@@ -55309,7 +55415,7 @@ const isFileList = kindOfTest('FileList');
55309
55415
  *
55310
55416
  * @returns {boolean} True if value is a Stream, otherwise false
55311
55417
  */
55312
- const isStream = (val) => isObject(val) && isFunction(val.pipe);
55418
+ const isStream = (val) => isObject(val) && isFunction$1(val.pipe);
55313
55419
 
55314
55420
  /**
55315
55421
  * Determine if a value is a FormData
@@ -55322,10 +55428,10 @@ const isFormData = (thing) => {
55322
55428
  let kind;
55323
55429
  return thing && (
55324
55430
  (typeof FormData === 'function' && thing instanceof FormData) || (
55325
- isFunction(thing.append) && (
55431
+ isFunction$1(thing.append) && (
55326
55432
  (kind = kindOf(thing)) === 'formdata' ||
55327
55433
  // detect form-data instance
55328
- (kind === 'object' && isFunction(thing.toString) && thing.toString() === '[object FormData]')
55434
+ (kind === 'object' && isFunction$1(thing.toString) && thing.toString() === '[object FormData]')
55329
55435
  )
55330
55436
  )
55331
55437
  )
@@ -55450,7 +55556,7 @@ const isContextDefined = (context) => !isUndefined(context) && context !== _glob
55450
55556
  * @returns {Object} Result of all merge properties
55451
55557
  */
55452
55558
  function merge(/* obj1, obj2, obj3, ... */) {
55453
- const {caseless} = isContextDefined(this) && this || {};
55559
+ const {caseless, skipUndefined} = isContextDefined(this) && this || {};
55454
55560
  const result = {};
55455
55561
  const assignValue = (val, key) => {
55456
55562
  const targetKey = caseless && findKey(result, key) || key;
@@ -55460,7 +55566,7 @@ function merge(/* obj1, obj2, obj3, ... */) {
55460
55566
  result[targetKey] = merge({}, val);
55461
55567
  } else if (isArray(val)) {
55462
55568
  result[targetKey] = val.slice();
55463
- } else {
55569
+ } else if (!skipUndefined || !isUndefined(val)) {
55464
55570
  result[targetKey] = val;
55465
55571
  }
55466
55572
  };
@@ -55483,7 +55589,7 @@ function merge(/* obj1, obj2, obj3, ... */) {
55483
55589
  */
55484
55590
  const extend = (a, b, thisArg, {allOwnKeys}= {}) => {
55485
55591
  forEach(b, (val, key) => {
55486
- if (thisArg && isFunction(val)) {
55592
+ if (thisArg && isFunction$1(val)) {
55487
55593
  a[key] = bind(val, thisArg);
55488
55594
  } else {
55489
55595
  a[key] = val;
@@ -55699,13 +55805,13 @@ const reduceDescriptors = (obj, reducer) => {
55699
55805
  const freezeMethods = (obj) => {
55700
55806
  reduceDescriptors(obj, (descriptor, name) => {
55701
55807
  // skip restricted props in strict mode
55702
- if (isFunction(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
55808
+ if (isFunction$1(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
55703
55809
  return false;
55704
55810
  }
55705
55811
 
55706
55812
  const value = obj[name];
55707
55813
 
55708
- if (!isFunction(value)) return;
55814
+ if (!isFunction$1(value)) return;
55709
55815
 
55710
55816
  descriptor.enumerable = false;
55711
55817
 
@@ -55742,6 +55848,8 @@ const toFiniteNumber = (value, defaultValue) => {
55742
55848
  return value != null && Number.isFinite(value = +value) ? value : defaultValue;
55743
55849
  };
55744
55850
 
55851
+
55852
+
55745
55853
  /**
55746
55854
  * If the thing is a FormData object, return true, otherwise return false.
55747
55855
  *
@@ -55750,7 +55858,7 @@ const toFiniteNumber = (value, defaultValue) => {
55750
55858
  * @returns {boolean}
55751
55859
  */
55752
55860
  function isSpecCompliantForm(thing) {
55753
- return !!(thing && isFunction(thing.append) && thing[toStringTag] === 'FormData' && thing[iterator]);
55861
+ return !!(thing && isFunction$1(thing.append) && thing[toStringTag] === 'FormData' && thing[iterator]);
55754
55862
  }
55755
55863
 
55756
55864
  const toJSONObject = (obj) => {
@@ -55792,7 +55900,7 @@ const toJSONObject = (obj) => {
55792
55900
  const isAsyncFn = kindOfTest('AsyncFunction');
55793
55901
 
55794
55902
  const isThenable = (thing) =>
55795
- thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
55903
+ thing && (isObject(thing) || isFunction$1(thing)) && isFunction$1(thing.then) && isFunction$1(thing.catch);
55796
55904
 
55797
55905
  // original code
55798
55906
  // https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34
@@ -55816,7 +55924,7 @@ const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
55816
55924
  })(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb);
55817
55925
  })(
55818
55926
  typeof setImmediate === 'function',
55819
- isFunction(_global.postMessage)
55927
+ isFunction$1(_global.postMessage)
55820
55928
  );
55821
55929
 
55822
55930
  const asap = typeof queueMicrotask !== 'undefined' ?
@@ -55825,7 +55933,7 @@ const asap = typeof queueMicrotask !== 'undefined' ?
55825
55933
  // *********************
55826
55934
 
55827
55935
 
55828
- const isIterable = (thing) => thing != null && isFunction(thing[iterator]);
55936
+ const isIterable = (thing) => thing != null && isFunction$1(thing[iterator]);
55829
55937
 
55830
55938
 
55831
55939
  var utils$1 = {
@@ -55849,7 +55957,7 @@ var utils$1 = {
55849
55957
  isFile,
55850
55958
  isBlob,
55851
55959
  isRegExp,
55852
- isFunction,
55960
+ isFunction: isFunction$1,
55853
55961
  isStream,
55854
55962
  isURLSearchParams,
55855
55963
  isTypedArray,
@@ -55975,11 +56083,18 @@ AxiosError$1.from = (error, code, config, request, response, customProps) => {
55975
56083
  return prop !== 'isAxiosError';
55976
56084
  });
55977
56085
 
55978
- AxiosError$1.call(axiosError, error.message, code, config, request, response);
56086
+ const msg = error && error.message ? error.message : 'Error';
55979
56087
 
55980
- axiosError.cause = error;
56088
+ // Prefer explicit code; otherwise copy the low-level error's code (e.g. ECONNREFUSED)
56089
+ const errCode = code == null && error ? error.code : code;
56090
+ AxiosError$1.call(axiosError, msg, errCode, config, request, response);
56091
+
56092
+ // Chain the original error on the standard field; non-enumerable to avoid JSON noise
56093
+ if (error && axiosError.cause == null) {
56094
+ Object.defineProperty(axiosError, 'cause', { value: error, configurable: true });
56095
+ }
55981
56096
 
55982
- axiosError.name = error.name;
56097
+ axiosError.name = (error && error.name) || 'Error';
55983
56098
 
55984
56099
  customProps && Object.assign(axiosError, customProps);
55985
56100
 
@@ -69583,9 +69698,7 @@ function encode(val) {
69583
69698
  replace(/%3A/gi, ':').
69584
69699
  replace(/%24/g, '$').
69585
69700
  replace(/%2C/gi, ',').
69586
- replace(/%20/g, '+').
69587
- replace(/%5B/gi, '[').
69588
- replace(/%5D/gi, ']');
69701
+ replace(/%20/g, '+');
69589
69702
  }
69590
69703
 
69591
69704
  /**
@@ -69663,7 +69776,7 @@ class InterceptorManager {
69663
69776
  *
69664
69777
  * @param {Number} id The ID that was returned by `use`
69665
69778
  *
69666
- * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
69779
+ * @returns {void}
69667
69780
  */
69668
69781
  eject(id) {
69669
69782
  if (this.handlers[id]) {
@@ -70009,7 +70122,7 @@ const defaults = {
70009
70122
  const strictJSONParsing = !silentJSONParsing && JSONRequested;
70010
70123
 
70011
70124
  try {
70012
- return JSON.parse(data);
70125
+ return JSON.parse(data, this.parseReviver);
70013
70126
  } catch (e) {
70014
70127
  if (strictJSONParsing) {
70015
70128
  if (e.name === 'SyntaxError') {
@@ -72584,7 +72697,7 @@ function requireFollowRedirects () {
72584
72697
  var followRedirectsExports = requireFollowRedirects();
72585
72698
  var followRedirects = /*@__PURE__*/getDefaultExportFromCjs(followRedirectsExports);
72586
72699
 
72587
- const VERSION$1 = "1.11.0";
72700
+ const VERSION$1 = "1.13.2";
72588
72701
 
72589
72702
  function parseProtocol(url) {
72590
72703
  const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
@@ -73067,6 +73180,80 @@ const progressEventDecorator = (total, throttled) => {
73067
73180
 
73068
73181
  const asyncDecorator = (fn) => (...args) => utils$1.asap(() => fn(...args));
73069
73182
 
73183
+ /**
73184
+ * Estimate decoded byte length of a data:// URL *without* allocating large buffers.
73185
+ * - For base64: compute exact decoded size using length and padding;
73186
+ * handle %XX at the character-count level (no string allocation).
73187
+ * - For non-base64: use UTF-8 byteLength of the encoded body as a safe upper bound.
73188
+ *
73189
+ * @param {string} url
73190
+ * @returns {number}
73191
+ */
73192
+ function estimateDataURLDecodedBytes(url) {
73193
+ if (!url || typeof url !== 'string') return 0;
73194
+ if (!url.startsWith('data:')) return 0;
73195
+
73196
+ const comma = url.indexOf(',');
73197
+ if (comma < 0) return 0;
73198
+
73199
+ const meta = url.slice(5, comma);
73200
+ const body = url.slice(comma + 1);
73201
+ const isBase64 = /;base64/i.test(meta);
73202
+
73203
+ if (isBase64) {
73204
+ let effectiveLen = body.length;
73205
+ const len = body.length; // cache length
73206
+
73207
+ for (let i = 0; i < len; i++) {
73208
+ if (body.charCodeAt(i) === 37 /* '%' */ && i + 2 < len) {
73209
+ const a = body.charCodeAt(i + 1);
73210
+ const b = body.charCodeAt(i + 2);
73211
+ const isHex =
73212
+ ((a >= 48 && a <= 57) || (a >= 65 && a <= 70) || (a >= 97 && a <= 102)) &&
73213
+ ((b >= 48 && b <= 57) || (b >= 65 && b <= 70) || (b >= 97 && b <= 102));
73214
+
73215
+ if (isHex) {
73216
+ effectiveLen -= 2;
73217
+ i += 2;
73218
+ }
73219
+ }
73220
+ }
73221
+
73222
+ let pad = 0;
73223
+ let idx = len - 1;
73224
+
73225
+ const tailIsPct3D = (j) =>
73226
+ j >= 2 &&
73227
+ body.charCodeAt(j - 2) === 37 && // '%'
73228
+ body.charCodeAt(j - 1) === 51 && // '3'
73229
+ (body.charCodeAt(j) === 68 || body.charCodeAt(j) === 100); // 'D' or 'd'
73230
+
73231
+ if (idx >= 0) {
73232
+ if (body.charCodeAt(idx) === 61 /* '=' */) {
73233
+ pad++;
73234
+ idx--;
73235
+ } else if (tailIsPct3D(idx)) {
73236
+ pad++;
73237
+ idx -= 3;
73238
+ }
73239
+ }
73240
+
73241
+ if (pad === 1 && idx >= 0) {
73242
+ if (body.charCodeAt(idx) === 61 /* '=' */) {
73243
+ pad++;
73244
+ } else if (tailIsPct3D(idx)) {
73245
+ pad++;
73246
+ }
73247
+ }
73248
+
73249
+ const groups = Math.floor(effectiveLen / 4);
73250
+ const bytes = groups * 3 - (pad || 0);
73251
+ return bytes > 0 ? bytes : 0;
73252
+ }
73253
+
73254
+ return Buffer.byteLength(body, 'utf8');
73255
+ }
73256
+
73070
73257
  const zlibOptions = {
73071
73258
  flush: zlib.constants.Z_SYNC_FLUSH,
73072
73259
  finishFlush: zlib.constants.Z_SYNC_FLUSH
@@ -73087,6 +73274,7 @@ const supportedProtocols = platform.protocols.map(protocol => {
73087
73274
  return protocol + ':';
73088
73275
  });
73089
73276
 
73277
+
73090
73278
  const flushOnFinish = (stream, [throttled, flush]) => {
73091
73279
  stream
73092
73280
  .on('end', flush)
@@ -73095,6 +73283,102 @@ const flushOnFinish = (stream, [throttled, flush]) => {
73095
73283
  return throttled;
73096
73284
  };
73097
73285
 
73286
+ class Http2Sessions {
73287
+ constructor() {
73288
+ this.sessions = Object.create(null);
73289
+ }
73290
+
73291
+ getSession(authority, options) {
73292
+ options = Object.assign({
73293
+ sessionTimeout: 1000
73294
+ }, options);
73295
+
73296
+ let authoritySessions = this.sessions[authority];
73297
+
73298
+ if (authoritySessions) {
73299
+ let len = authoritySessions.length;
73300
+
73301
+ for (let i = 0; i < len; i++) {
73302
+ const [sessionHandle, sessionOptions] = authoritySessions[i];
73303
+ if (!sessionHandle.destroyed && !sessionHandle.closed && require$$0$4.isDeepStrictEqual(sessionOptions, options)) {
73304
+ return sessionHandle;
73305
+ }
73306
+ }
73307
+ }
73308
+
73309
+ const session = http2.connect(authority, options);
73310
+
73311
+ let removed;
73312
+
73313
+ const removeSession = () => {
73314
+ if (removed) {
73315
+ return;
73316
+ }
73317
+
73318
+ removed = true;
73319
+
73320
+ let entries = authoritySessions, len = entries.length, i = len;
73321
+
73322
+ while (i--) {
73323
+ if (entries[i][0] === session) {
73324
+ if (len === 1) {
73325
+ delete this.sessions[authority];
73326
+ } else {
73327
+ entries.splice(i, 1);
73328
+ }
73329
+ return;
73330
+ }
73331
+ }
73332
+ };
73333
+
73334
+ const originalRequestFn = session.request;
73335
+
73336
+ const {sessionTimeout} = options;
73337
+
73338
+ if(sessionTimeout != null) {
73339
+
73340
+ let timer;
73341
+ let streamsCount = 0;
73342
+
73343
+ session.request = function () {
73344
+ const stream = originalRequestFn.apply(this, arguments);
73345
+
73346
+ streamsCount++;
73347
+
73348
+ if (timer) {
73349
+ clearTimeout(timer);
73350
+ timer = null;
73351
+ }
73352
+
73353
+ stream.once('close', () => {
73354
+ if (!--streamsCount) {
73355
+ timer = setTimeout(() => {
73356
+ timer = null;
73357
+ removeSession();
73358
+ }, sessionTimeout);
73359
+ }
73360
+ });
73361
+
73362
+ return stream;
73363
+ };
73364
+ }
73365
+
73366
+ session.once('close', removeSession);
73367
+
73368
+ let entry = [
73369
+ session,
73370
+ options
73371
+ ];
73372
+
73373
+ authoritySessions ? authoritySessions.push(entry) : authoritySessions = this.sessions[authority] = [entry];
73374
+
73375
+ return session;
73376
+ }
73377
+ }
73378
+
73379
+ const http2Sessions = new Http2Sessions();
73380
+
73381
+
73098
73382
  /**
73099
73383
  * If the proxy or config beforeRedirects functions are defined, call them with the options
73100
73384
  * object.
@@ -73206,16 +73490,75 @@ const resolveFamily = ({address, family}) => {
73206
73490
 
73207
73491
  const buildAddressEntry = (address, family) => resolveFamily(utils$1.isObject(address) ? address : {address, family});
73208
73492
 
73493
+ const http2Transport = {
73494
+ request(options, cb) {
73495
+ const authority = options.protocol + '//' + options.hostname + ':' + (options.port || 80);
73496
+
73497
+ const {http2Options, headers} = options;
73498
+
73499
+ const session = http2Sessions.getSession(authority, http2Options);
73500
+
73501
+ const {
73502
+ HTTP2_HEADER_SCHEME,
73503
+ HTTP2_HEADER_METHOD,
73504
+ HTTP2_HEADER_PATH,
73505
+ HTTP2_HEADER_STATUS
73506
+ } = http2.constants;
73507
+
73508
+ const http2Headers = {
73509
+ [HTTP2_HEADER_SCHEME]: options.protocol.replace(':', ''),
73510
+ [HTTP2_HEADER_METHOD]: options.method,
73511
+ [HTTP2_HEADER_PATH]: options.path,
73512
+ };
73513
+
73514
+ utils$1.forEach(headers, (header, name) => {
73515
+ name.charAt(0) !== ':' && (http2Headers[name] = header);
73516
+ });
73517
+
73518
+ const req = session.request(http2Headers);
73519
+
73520
+ req.once('response', (responseHeaders) => {
73521
+ const response = req; //duplex
73522
+
73523
+ responseHeaders = Object.assign({}, responseHeaders);
73524
+
73525
+ const status = responseHeaders[HTTP2_HEADER_STATUS];
73526
+
73527
+ delete responseHeaders[HTTP2_HEADER_STATUS];
73528
+
73529
+ response.headers = responseHeaders;
73530
+
73531
+ response.statusCode = +status;
73532
+
73533
+ cb(response);
73534
+ });
73535
+
73536
+ return req;
73537
+ }
73538
+ };
73539
+
73209
73540
  /*eslint consistent-return:0*/
73210
73541
  var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
73211
73542
  return wrapAsync(async function dispatchHttpRequest(resolve, reject, onDone) {
73212
- let {data, lookup, family} = config;
73543
+ let {data, lookup, family, httpVersion = 1, http2Options} = config;
73213
73544
  const {responseType, responseEncoding} = config;
73214
73545
  const method = config.method.toUpperCase();
73215
73546
  let isDone;
73216
73547
  let rejected = false;
73217
73548
  let req;
73218
73549
 
73550
+ httpVersion = +httpVersion;
73551
+
73552
+ if (Number.isNaN(httpVersion)) {
73553
+ throw TypeError(`Invalid protocol version: '${config.httpVersion}' is not a number`);
73554
+ }
73555
+
73556
+ if (httpVersion !== 1 && httpVersion !== 2) {
73557
+ throw TypeError(`Unsupported protocol version '${httpVersion}'`);
73558
+ }
73559
+
73560
+ const isHttp2 = httpVersion === 2;
73561
+
73219
73562
  if (lookup) {
73220
73563
  const _lookup = callbackify(lookup, (value) => utils$1.isArray(value) ? value : [value]);
73221
73564
  // hotfix to support opt.all option which is required for node 20.x
@@ -73232,8 +73575,17 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
73232
73575
  };
73233
73576
  }
73234
73577
 
73235
- // temporary internal emitter until the AxiosRequest class will be implemented
73236
- const emitter = new events.EventEmitter();
73578
+ const abortEmitter = new events.EventEmitter();
73579
+
73580
+ function abort(reason) {
73581
+ try {
73582
+ abortEmitter.emit('abort', !reason || reason.type ? new CanceledError$1(null, config, req) : reason);
73583
+ } catch(err) {
73584
+ console.warn('emit error', err);
73585
+ }
73586
+ }
73587
+
73588
+ abortEmitter.once('abort', reject);
73237
73589
 
73238
73590
  const onFinished = () => {
73239
73591
  if (config.cancelToken) {
@@ -73244,29 +73596,40 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
73244
73596
  config.signal.removeEventListener('abort', abort);
73245
73597
  }
73246
73598
 
73247
- emitter.removeAllListeners();
73599
+ abortEmitter.removeAllListeners();
73248
73600
  };
73249
73601
 
73250
- onDone((value, isRejected) => {
73602
+ if (config.cancelToken || config.signal) {
73603
+ config.cancelToken && config.cancelToken.subscribe(abort);
73604
+ if (config.signal) {
73605
+ config.signal.aborted ? abort() : config.signal.addEventListener('abort', abort);
73606
+ }
73607
+ }
73608
+
73609
+ onDone((response, isRejected) => {
73251
73610
  isDone = true;
73611
+
73252
73612
  if (isRejected) {
73253
73613
  rejected = true;
73254
73614
  onFinished();
73615
+ return;
73616
+ }
73617
+
73618
+ const {data} = response;
73619
+
73620
+ if (data instanceof stream.Readable || data instanceof stream.Duplex) {
73621
+ const offListeners = stream.finished(data, () => {
73622
+ offListeners();
73623
+ onFinished();
73624
+ });
73625
+ } else {
73626
+ onFinished();
73255
73627
  }
73256
73628
  });
73257
73629
 
73258
- function abort(reason) {
73259
- emitter.emit('abort', !reason || reason.type ? new CanceledError$1(null, config, req) : reason);
73260
- }
73261
73630
 
73262
- emitter.once('abort', reject);
73263
73631
 
73264
- if (config.cancelToken || config.signal) {
73265
- config.cancelToken && config.cancelToken.subscribe(abort);
73266
- if (config.signal) {
73267
- config.signal.aborted ? abort() : config.signal.addEventListener('abort', abort);
73268
- }
73269
- }
73632
+
73270
73633
 
73271
73634
  // Parse url
73272
73635
  const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
@@ -73274,6 +73637,21 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
73274
73637
  const protocol = parsed.protocol || supportedProtocols[0];
73275
73638
 
73276
73639
  if (protocol === 'data:') {
73640
+ // Apply the same semantics as HTTP: only enforce if a finite, non-negative cap is set.
73641
+ if (config.maxContentLength > -1) {
73642
+ // Use the exact string passed to fromDataURI (config.url); fall back to fullPath if needed.
73643
+ const dataUrl = String(config.url || fullPath || '');
73644
+ const estimated = estimateDataURLDecodedBytes(dataUrl);
73645
+
73646
+ if (estimated > config.maxContentLength) {
73647
+ return reject(new AxiosError$1(
73648
+ 'maxContentLength size of ' + config.maxContentLength + ' exceeded',
73649
+ AxiosError$1.ERR_BAD_RESPONSE,
73650
+ config
73651
+ ));
73652
+ }
73653
+ }
73654
+
73277
73655
  let convertedData;
73278
73656
 
73279
73657
  if (method !== 'GET') {
@@ -73457,7 +73835,8 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
73457
73835
  protocol,
73458
73836
  family,
73459
73837
  beforeRedirect: dispatchBeforeRedirect,
73460
- beforeRedirects: {}
73838
+ beforeRedirects: {},
73839
+ http2Options
73461
73840
  };
73462
73841
 
73463
73842
  // cacheable-lookup integration hotfix
@@ -73474,18 +73853,23 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
73474
73853
  let transport;
73475
73854
  const isHttpsRequest = isHttps.test(options.protocol);
73476
73855
  options.agent = isHttpsRequest ? config.httpsAgent : config.httpAgent;
73477
- if (config.transport) {
73478
- transport = config.transport;
73479
- } else if (config.maxRedirects === 0) {
73480
- transport = isHttpsRequest ? require$$4$1 : require$$3$2;
73856
+
73857
+ if (isHttp2) {
73858
+ transport = http2Transport;
73481
73859
  } else {
73482
- if (config.maxRedirects) {
73483
- options.maxRedirects = config.maxRedirects;
73484
- }
73485
- if (config.beforeRedirect) {
73486
- options.beforeRedirects.config = config.beforeRedirect;
73860
+ if (config.transport) {
73861
+ transport = config.transport;
73862
+ } else if (config.maxRedirects === 0) {
73863
+ transport = isHttpsRequest ? require$$4$1 : require$$3$2;
73864
+ } else {
73865
+ if (config.maxRedirects) {
73866
+ options.maxRedirects = config.maxRedirects;
73867
+ }
73868
+ if (config.beforeRedirect) {
73869
+ options.beforeRedirects.config = config.beforeRedirect;
73870
+ }
73871
+ transport = isHttpsRequest ? httpsFollow : httpFollow;
73487
73872
  }
73488
- transport = isHttpsRequest ? httpsFollow : httpFollow;
73489
73873
  }
73490
73874
 
73491
73875
  if (config.maxBodyLength > -1) {
@@ -73505,7 +73889,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
73505
73889
 
73506
73890
  const streams = [res];
73507
73891
 
73508
- const responseLength = +res.headers['content-length'];
73892
+ const responseLength = utils$1.toFiniteNumber(res.headers['content-length']);
73509
73893
 
73510
73894
  if (onDownloadProgress || maxDownloadRate) {
73511
73895
  const transformStream = new AxiosTransformStream({
@@ -73568,10 +73952,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
73568
73952
 
73569
73953
  responseStream = streams.length > 1 ? stream.pipeline(streams, utils$1.noop) : streams[0];
73570
73954
 
73571
- const offListeners = stream.finished(responseStream, () => {
73572
- offListeners();
73573
- onFinished();
73574
- });
73955
+
73575
73956
 
73576
73957
  const response = {
73577
73958
  status: res.statusCode,
@@ -73597,7 +73978,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
73597
73978
  // stream.destroy() emit aborted event before calling reject() on Node.js v16
73598
73979
  rejected = true;
73599
73980
  responseStream.destroy();
73600
- reject(new AxiosError$1('maxContentLength size of ' + config.maxContentLength + ' exceeded',
73981
+ abort(new AxiosError$1('maxContentLength size of ' + config.maxContentLength + ' exceeded',
73601
73982
  AxiosError$1.ERR_BAD_RESPONSE, config, lastRequest));
73602
73983
  }
73603
73984
  });
@@ -73639,7 +74020,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
73639
74020
  });
73640
74021
  }
73641
74022
 
73642
- emitter.once('abort', err => {
74023
+ abortEmitter.once('abort', err => {
73643
74024
  if (!responseStream.destroyed) {
73644
74025
  responseStream.emit('error', err);
73645
74026
  responseStream.destroy();
@@ -73647,9 +74028,12 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
73647
74028
  });
73648
74029
  });
73649
74030
 
73650
- emitter.once('abort', err => {
73651
- reject(err);
73652
- req.destroy(err);
74031
+ abortEmitter.once('abort', err => {
74032
+ if (req.close) {
74033
+ req.close();
74034
+ } else {
74035
+ req.destroy(err);
74036
+ }
73653
74037
  });
73654
74038
 
73655
74039
  // Handle errors
@@ -73671,7 +74055,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
73671
74055
  const timeout = parseInt(config.timeout, 10);
73672
74056
 
73673
74057
  if (Number.isNaN(timeout)) {
73674
- reject(new AxiosError$1(
74058
+ abort(new AxiosError$1(
73675
74059
  'error trying to parse `config.timeout` to int',
73676
74060
  AxiosError$1.ERR_BAD_OPTION_VALUE,
73677
74061
  config,
@@ -73693,14 +74077,16 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
73693
74077
  if (config.timeoutErrorMessage) {
73694
74078
  timeoutErrorMessage = config.timeoutErrorMessage;
73695
74079
  }
73696
- reject(new AxiosError$1(
74080
+ abort(new AxiosError$1(
73697
74081
  timeoutErrorMessage,
73698
74082
  transitional.clarifyTimeoutError ? AxiosError$1.ETIMEDOUT : AxiosError$1.ECONNABORTED,
73699
74083
  config,
73700
74084
  req
73701
74085
  ));
73702
- abort();
73703
74086
  });
74087
+ } else {
74088
+ // explicitly reset the socket timeout value for a possible `keep-alive` request
74089
+ req.setTimeout(0);
73704
74090
  }
73705
74091
 
73706
74092
 
@@ -73726,7 +74112,8 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
73726
74112
 
73727
74113
  data.pipe(req);
73728
74114
  } else {
73729
- req.end(data);
74115
+ data && req.write(data);
74116
+ req.end();
73730
74117
  }
73731
74118
  });
73732
74119
  };
@@ -73748,27 +74135,38 @@ var cookies = platform.hasStandardBrowserEnv ?
73748
74135
 
73749
74136
  // Standard browser envs support document.cookie
73750
74137
  {
73751
- write(name, value, expires, path, domain, secure) {
73752
- const cookie = [name + '=' + encodeURIComponent(value)];
74138
+ write(name, value, expires, path, domain, secure, sameSite) {
74139
+ if (typeof document === 'undefined') return;
73753
74140
 
73754
- utils$1.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString());
74141
+ const cookie = [`${name}=${encodeURIComponent(value)}`];
73755
74142
 
73756
- utils$1.isString(path) && cookie.push('path=' + path);
73757
-
73758
- utils$1.isString(domain) && cookie.push('domain=' + domain);
73759
-
73760
- secure === true && cookie.push('secure');
74143
+ if (utils$1.isNumber(expires)) {
74144
+ cookie.push(`expires=${new Date(expires).toUTCString()}`);
74145
+ }
74146
+ if (utils$1.isString(path)) {
74147
+ cookie.push(`path=${path}`);
74148
+ }
74149
+ if (utils$1.isString(domain)) {
74150
+ cookie.push(`domain=${domain}`);
74151
+ }
74152
+ if (secure === true) {
74153
+ cookie.push('secure');
74154
+ }
74155
+ if (utils$1.isString(sameSite)) {
74156
+ cookie.push(`SameSite=${sameSite}`);
74157
+ }
73761
74158
 
73762
74159
  document.cookie = cookie.join('; ');
73763
74160
  },
73764
74161
 
73765
74162
  read(name) {
73766
- const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
73767
- return (match ? decodeURIComponent(match[3]) : null);
74163
+ if (typeof document === 'undefined') return null;
74164
+ const match = document.cookie.match(new RegExp('(?:^|; )' + name + '=([^;]*)'));
74165
+ return match ? decodeURIComponent(match[1]) : null;
73768
74166
  },
73769
74167
 
73770
74168
  remove(name) {
73771
- this.write(name, '', Date.now() - 86400000);
74169
+ this.write(name, '', Date.now() - 86400000, '/');
73772
74170
  }
73773
74171
  }
73774
74172
 
@@ -73811,11 +74209,11 @@ function mergeConfig$1(config1, config2) {
73811
74209
  }
73812
74210
 
73813
74211
  // eslint-disable-next-line consistent-return
73814
- function mergeDeepProperties(a, b, prop , caseless) {
74212
+ function mergeDeepProperties(a, b, prop, caseless) {
73815
74213
  if (!utils$1.isUndefined(b)) {
73816
- return getMergedValue(a, b, prop , caseless);
74214
+ return getMergedValue(a, b, prop, caseless);
73817
74215
  } else if (!utils$1.isUndefined(a)) {
73818
- return getMergedValue(undefined, a, prop , caseless);
74216
+ return getMergedValue(undefined, a, prop, caseless);
73819
74217
  }
73820
74218
  }
73821
74219
 
@@ -73873,7 +74271,7 @@ function mergeConfig$1(config1, config2) {
73873
74271
  socketPath: defaultToConfig2,
73874
74272
  responseEncoding: defaultToConfig2,
73875
74273
  validateStatus: mergeDirectKeys,
73876
- headers: (a, b , prop) => mergeDeepProperties(headersToObject(a), headersToObject(b),prop, true)
74274
+ headers: (a, b, prop) => mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true)
73877
74275
  };
73878
74276
 
73879
74277
  utils$1.forEach(Object.keys({...config1, ...config2}), function computeConfigValue(prop) {
@@ -73888,7 +74286,7 @@ function mergeConfig$1(config1, config2) {
73888
74286
  var resolveConfig = (config) => {
73889
74287
  const newConfig = mergeConfig$1({}, config);
73890
74288
 
73891
- let {data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth} = newConfig;
74289
+ let { data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth } = newConfig;
73892
74290
 
73893
74291
  newConfig.headers = headers = AxiosHeaders$1.from(headers);
73894
74292
 
@@ -73901,17 +74299,21 @@ var resolveConfig = (config) => {
73901
74299
  );
73902
74300
  }
73903
74301
 
73904
- let contentType;
73905
-
73906
74302
  if (utils$1.isFormData(data)) {
73907
74303
  if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
73908
- headers.setContentType(undefined); // Let the browser set it
73909
- } else if ((contentType = headers.getContentType()) !== false) {
73910
- // fix semicolon duplication issue for ReactNative FormData implementation
73911
- const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : [];
73912
- headers.setContentType([type || 'multipart/form-data', ...tokens].join('; '));
74304
+ headers.setContentType(undefined); // browser handles it
74305
+ } else if (utils$1.isFunction(data.getHeaders)) {
74306
+ // Node.js FormData (like form-data package)
74307
+ const formHeaders = data.getHeaders();
74308
+ // Only set safe headers to avoid overwriting security headers
74309
+ const allowedHeaders = ['content-type', 'content-length'];
74310
+ Object.entries(formHeaders).forEach(([key, val]) => {
74311
+ if (allowedHeaders.includes(key.toLowerCase())) {
74312
+ headers.set(key, val);
74313
+ }
74314
+ });
73913
74315
  }
73914
- }
74316
+ }
73915
74317
 
73916
74318
  // Add xsrf header
73917
74319
  // This is only done if running in a standard browser environment.
@@ -74028,15 +74430,18 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
74028
74430
  };
74029
74431
 
74030
74432
  // Handle low level network errors
74031
- request.onerror = function handleError() {
74032
- // Real errors are hidden from us by the browser
74033
- // onerror should only fire if it's a network error
74034
- reject(new AxiosError$1('Network Error', AxiosError$1.ERR_NETWORK, config, request));
74035
-
74036
- // Clean up request
74037
- request = null;
74433
+ request.onerror = function handleError(event) {
74434
+ // Browsers deliver a ProgressEvent in XHR onerror
74435
+ // (message may be empty; when present, surface it)
74436
+ // See https://developer.mozilla.org/docs/Web/API/XMLHttpRequest/error_event
74437
+ const msg = event && event.message ? event.message : 'Network Error';
74438
+ const err = new AxiosError$1(msg, AxiosError$1.ERR_NETWORK, config, request);
74439
+ // attach the underlying event for consumers who want details
74440
+ err.event = event || null;
74441
+ reject(err);
74442
+ request = null;
74038
74443
  };
74039
-
74444
+
74040
74445
  // Handle timeout
74041
74446
  request.ontimeout = function handleTimeout() {
74042
74447
  let timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded';
@@ -74250,14 +74655,18 @@ const trackStream = (stream, chunkSize, onProgress, onFinish) => {
74250
74655
  })
74251
74656
  };
74252
74657
 
74253
- const isFetchSupported = typeof fetch === 'function' && typeof Request === 'function' && typeof Response === 'function';
74254
- const isReadableStreamSupported = isFetchSupported && typeof ReadableStream === 'function';
74658
+ const DEFAULT_CHUNK_SIZE = 64 * 1024;
74659
+
74660
+ const {isFunction} = utils$1;
74661
+
74662
+ const globalFetchAPI = (({Request, Response}) => ({
74663
+ Request, Response
74664
+ }))(utils$1.global);
74665
+
74666
+ const {
74667
+ ReadableStream: ReadableStream$1, TextEncoder: TextEncoder$1
74668
+ } = utils$1.global;
74255
74669
 
74256
- // used only inside the fetch adapter
74257
- const encodeText = isFetchSupported && (typeof TextEncoder === 'function' ?
74258
- ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) :
74259
- async (str) => new Uint8Array(await new Response(str).arrayBuffer())
74260
- );
74261
74670
 
74262
74671
  const test = (fn, ...args) => {
74263
74672
  try {
@@ -74267,278 +74676,380 @@ const test = (fn, ...args) => {
74267
74676
  }
74268
74677
  };
74269
74678
 
74270
- const supportsRequestStream = isReadableStreamSupported && test(() => {
74271
- let duplexAccessed = false;
74679
+ const factory = (env) => {
74680
+ env = utils$1.merge.call({
74681
+ skipUndefined: true
74682
+ }, globalFetchAPI, env);
74272
74683
 
74273
- const hasContentType = new Request(platform.origin, {
74274
- body: new ReadableStream(),
74275
- method: 'POST',
74276
- get duplex() {
74277
- duplexAccessed = true;
74278
- return 'half';
74279
- },
74280
- }).headers.has('Content-Type');
74684
+ const {fetch: envFetch, Request, Response} = env;
74685
+ const isFetchSupported = envFetch ? isFunction(envFetch) : typeof fetch === 'function';
74686
+ const isRequestSupported = isFunction(Request);
74687
+ const isResponseSupported = isFunction(Response);
74281
74688
 
74282
- return duplexAccessed && !hasContentType;
74283
- });
74689
+ if (!isFetchSupported) {
74690
+ return false;
74691
+ }
74284
74692
 
74285
- const DEFAULT_CHUNK_SIZE = 64 * 1024;
74693
+ const isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream$1);
74286
74694
 
74287
- const supportsResponseStream = isReadableStreamSupported &&
74288
- test(() => utils$1.isReadableStream(new Response('').body));
74695
+ const encodeText = isFetchSupported && (typeof TextEncoder$1 === 'function' ?
74696
+ ((encoder) => (str) => encoder.encode(str))(new TextEncoder$1()) :
74697
+ async (str) => new Uint8Array(await new Request(str).arrayBuffer())
74698
+ );
74289
74699
 
74700
+ const supportsRequestStream = isRequestSupported && isReadableStreamSupported && test(() => {
74701
+ let duplexAccessed = false;
74290
74702
 
74291
- const resolvers = {
74292
- stream: supportsResponseStream && ((res) => res.body)
74293
- };
74703
+ const hasContentType = new Request(platform.origin, {
74704
+ body: new ReadableStream$1(),
74705
+ method: 'POST',
74706
+ get duplex() {
74707
+ duplexAccessed = true;
74708
+ return 'half';
74709
+ },
74710
+ }).headers.has('Content-Type');
74294
74711
 
74295
- isFetchSupported && (((res) => {
74296
- ['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => {
74297
- !resolvers[type] && (resolvers[type] = utils$1.isFunction(res[type]) ? (res) => res[type]() :
74298
- (_, config) => {
74299
- throw new AxiosError$1(`Response type '${type}' is not supported`, AxiosError$1.ERR_NOT_SUPPORT, config);
74300
- });
74712
+ return duplexAccessed && !hasContentType;
74301
74713
  });
74302
- })(new Response));
74303
74714
 
74304
- const getBodyLength = async (body) => {
74305
- if (body == null) {
74306
- return 0;
74307
- }
74715
+ const supportsResponseStream = isResponseSupported && isReadableStreamSupported &&
74716
+ test(() => utils$1.isReadableStream(new Response('').body));
74308
74717
 
74309
- if(utils$1.isBlob(body)) {
74310
- return body.size;
74311
- }
74718
+ const resolvers = {
74719
+ stream: supportsResponseStream && ((res) => res.body)
74720
+ };
74312
74721
 
74313
- if(utils$1.isSpecCompliantForm(body)) {
74314
- const _request = new Request(platform.origin, {
74315
- method: 'POST',
74316
- body,
74722
+ isFetchSupported && ((() => {
74723
+ ['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => {
74724
+ !resolvers[type] && (resolvers[type] = (res, config) => {
74725
+ let method = res && res[type];
74726
+
74727
+ if (method) {
74728
+ return method.call(res);
74729
+ }
74730
+
74731
+ throw new AxiosError$1(`Response type '${type}' is not supported`, AxiosError$1.ERR_NOT_SUPPORT, config);
74732
+ });
74317
74733
  });
74318
- return (await _request.arrayBuffer()).byteLength;
74319
- }
74734
+ })());
74320
74735
 
74321
- if(utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
74322
- return body.byteLength;
74323
- }
74736
+ const getBodyLength = async (body) => {
74737
+ if (body == null) {
74738
+ return 0;
74739
+ }
74324
74740
 
74325
- if(utils$1.isURLSearchParams(body)) {
74326
- body = body + '';
74327
- }
74741
+ if (utils$1.isBlob(body)) {
74742
+ return body.size;
74743
+ }
74328
74744
 
74329
- if(utils$1.isString(body)) {
74330
- return (await encodeText(body)).byteLength;
74331
- }
74332
- };
74745
+ if (utils$1.isSpecCompliantForm(body)) {
74746
+ const _request = new Request(platform.origin, {
74747
+ method: 'POST',
74748
+ body,
74749
+ });
74750
+ return (await _request.arrayBuffer()).byteLength;
74751
+ }
74752
+
74753
+ if (utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
74754
+ return body.byteLength;
74755
+ }
74333
74756
 
74334
- const resolveBodyLength = async (headers, body) => {
74335
- const length = utils$1.toFiniteNumber(headers.getContentLength());
74757
+ if (utils$1.isURLSearchParams(body)) {
74758
+ body = body + '';
74759
+ }
74336
74760
 
74337
- return length == null ? getBodyLength(body) : length;
74338
- };
74761
+ if (utils$1.isString(body)) {
74762
+ return (await encodeText(body)).byteLength;
74763
+ }
74764
+ };
74765
+
74766
+ const resolveBodyLength = async (headers, body) => {
74767
+ const length = utils$1.toFiniteNumber(headers.getContentLength());
74768
+
74769
+ return length == null ? getBodyLength(body) : length;
74770
+ };
74771
+
74772
+ return async (config) => {
74773
+ let {
74774
+ url,
74775
+ method,
74776
+ data,
74777
+ signal,
74778
+ cancelToken,
74779
+ timeout,
74780
+ onDownloadProgress,
74781
+ onUploadProgress,
74782
+ responseType,
74783
+ headers,
74784
+ withCredentials = 'same-origin',
74785
+ fetchOptions
74786
+ } = resolveConfig(config);
74339
74787
 
74340
- var fetchAdapter = isFetchSupported && (async (config) => {
74341
- let {
74342
- url,
74343
- method,
74344
- data,
74345
- signal,
74346
- cancelToken,
74347
- timeout,
74348
- onDownloadProgress,
74349
- onUploadProgress,
74350
- responseType,
74351
- headers,
74352
- withCredentials = 'same-origin',
74353
- fetchOptions
74354
- } = resolveConfig(config);
74355
-
74356
- responseType = responseType ? (responseType + '').toLowerCase() : 'text';
74357
-
74358
- let composedSignal = composeSignals([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
74359
-
74360
- let request;
74361
-
74362
- const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
74788
+ let _fetch = envFetch || fetch;
74789
+
74790
+ responseType = responseType ? (responseType + '').toLowerCase() : 'text';
74791
+
74792
+ let composedSignal = composeSignals([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
74793
+
74794
+ let request = null;
74795
+
74796
+ const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
74363
74797
  composedSignal.unsubscribe();
74364
- });
74798
+ });
74365
74799
 
74366
- let requestContentLength;
74800
+ let requestContentLength;
74367
74801
 
74368
- try {
74369
- if (
74370
- onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' &&
74371
- (requestContentLength = await resolveBodyLength(headers, data)) !== 0
74372
- ) {
74373
- let _request = new Request(url, {
74374
- method: 'POST',
74375
- body: data,
74376
- duplex: "half"
74377
- });
74802
+ try {
74803
+ if (
74804
+ onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' &&
74805
+ (requestContentLength = await resolveBodyLength(headers, data)) !== 0
74806
+ ) {
74807
+ let _request = new Request(url, {
74808
+ method: 'POST',
74809
+ body: data,
74810
+ duplex: "half"
74811
+ });
74378
74812
 
74379
- let contentTypeHeader;
74813
+ let contentTypeHeader;
74380
74814
 
74381
- if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
74382
- headers.setContentType(contentTypeHeader);
74383
- }
74815
+ if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
74816
+ headers.setContentType(contentTypeHeader);
74817
+ }
74384
74818
 
74385
- if (_request.body) {
74386
- const [onProgress, flush] = progressEventDecorator(
74387
- requestContentLength,
74388
- progressEventReducer(asyncDecorator(onUploadProgress))
74389
- );
74819
+ if (_request.body) {
74820
+ const [onProgress, flush] = progressEventDecorator(
74821
+ requestContentLength,
74822
+ progressEventReducer(asyncDecorator(onUploadProgress))
74823
+ );
74390
74824
 
74391
- data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
74825
+ data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
74826
+ }
74392
74827
  }
74393
- }
74394
74828
 
74395
- if (!utils$1.isString(withCredentials)) {
74396
- withCredentials = withCredentials ? 'include' : 'omit';
74397
- }
74829
+ if (!utils$1.isString(withCredentials)) {
74830
+ withCredentials = withCredentials ? 'include' : 'omit';
74831
+ }
74398
74832
 
74399
- // Cloudflare Workers throws when credentials are defined
74400
- // see https://github.com/cloudflare/workerd/issues/902
74401
- const isCredentialsSupported = "credentials" in Request.prototype;
74402
- request = new Request(url, {
74403
- ...fetchOptions,
74404
- signal: composedSignal,
74405
- method: method.toUpperCase(),
74406
- headers: headers.normalize().toJSON(),
74407
- body: data,
74408
- duplex: "half",
74409
- credentials: isCredentialsSupported ? withCredentials : undefined
74410
- });
74833
+ // Cloudflare Workers throws when credentials are defined
74834
+ // see https://github.com/cloudflare/workerd/issues/902
74835
+ const isCredentialsSupported = isRequestSupported && "credentials" in Request.prototype;
74411
74836
 
74412
- let response = await fetch(request, fetchOptions);
74837
+ const resolvedOptions = {
74838
+ ...fetchOptions,
74839
+ signal: composedSignal,
74840
+ method: method.toUpperCase(),
74841
+ headers: headers.normalize().toJSON(),
74842
+ body: data,
74843
+ duplex: "half",
74844
+ credentials: isCredentialsSupported ? withCredentials : undefined
74845
+ };
74413
74846
 
74414
- const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
74847
+ request = isRequestSupported && new Request(url, resolvedOptions);
74415
74848
 
74416
- if (supportsResponseStream && (onDownloadProgress || (isStreamResponse && unsubscribe))) {
74417
- const options = {};
74849
+ let response = await (isRequestSupported ? _fetch(request, fetchOptions) : _fetch(url, resolvedOptions));
74418
74850
 
74419
- ['status', 'statusText', 'headers'].forEach(prop => {
74420
- options[prop] = response[prop];
74421
- });
74851
+ const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
74422
74852
 
74423
- const responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
74853
+ if (supportsResponseStream && (onDownloadProgress || (isStreamResponse && unsubscribe))) {
74854
+ const options = {};
74424
74855
 
74425
- const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
74426
- responseContentLength,
74427
- progressEventReducer(asyncDecorator(onDownloadProgress), true)
74428
- ) || [];
74856
+ ['status', 'statusText', 'headers'].forEach(prop => {
74857
+ options[prop] = response[prop];
74858
+ });
74429
74859
 
74430
- response = new Response(
74431
- trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
74432
- flush && flush();
74433
- unsubscribe && unsubscribe();
74434
- }),
74435
- options
74436
- );
74437
- }
74860
+ const responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
74438
74861
 
74439
- responseType = responseType || 'text';
74862
+ const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
74863
+ responseContentLength,
74864
+ progressEventReducer(asyncDecorator(onDownloadProgress), true)
74865
+ ) || [];
74866
+
74867
+ response = new Response(
74868
+ trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
74869
+ flush && flush();
74870
+ unsubscribe && unsubscribe();
74871
+ }),
74872
+ options
74873
+ );
74874
+ }
74440
74875
 
74441
- let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config);
74876
+ responseType = responseType || 'text';
74442
74877
 
74443
- !isStreamResponse && unsubscribe && unsubscribe();
74878
+ let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config);
74444
74879
 
74445
- return await new Promise((resolve, reject) => {
74446
- settle(resolve, reject, {
74447
- data: responseData,
74448
- headers: AxiosHeaders$1.from(response.headers),
74449
- status: response.status,
74450
- statusText: response.statusText,
74451
- config,
74452
- request
74453
- });
74454
- })
74455
- } catch (err) {
74456
- unsubscribe && unsubscribe();
74880
+ !isStreamResponse && unsubscribe && unsubscribe();
74457
74881
 
74458
- if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
74459
- throw Object.assign(
74460
- new AxiosError$1('Network Error', AxiosError$1.ERR_NETWORK, config, request),
74461
- {
74462
- cause: err.cause || err
74463
- }
74464
- )
74882
+ return await new Promise((resolve, reject) => {
74883
+ settle(resolve, reject, {
74884
+ data: responseData,
74885
+ headers: AxiosHeaders$1.from(response.headers),
74886
+ status: response.status,
74887
+ statusText: response.statusText,
74888
+ config,
74889
+ request
74890
+ });
74891
+ })
74892
+ } catch (err) {
74893
+ unsubscribe && unsubscribe();
74894
+
74895
+ if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
74896
+ throw Object.assign(
74897
+ new AxiosError$1('Network Error', AxiosError$1.ERR_NETWORK, config, request),
74898
+ {
74899
+ cause: err.cause || err
74900
+ }
74901
+ )
74902
+ }
74903
+
74904
+ throw AxiosError$1.from(err, err && err.code, config, request);
74465
74905
  }
74906
+ }
74907
+ };
74908
+
74909
+ const seedCache = new Map();
74910
+
74911
+ const getFetch = (config) => {
74912
+ let env = (config && config.env) || {};
74913
+ const {fetch, Request, Response} = env;
74914
+ const seeds = [
74915
+ Request, Response, fetch
74916
+ ];
74917
+
74918
+ let len = seeds.length, i = len,
74919
+ seed, target, map = seedCache;
74466
74920
 
74467
- throw AxiosError$1.from(err, err && err.code, config, request);
74921
+ while (i--) {
74922
+ seed = seeds[i];
74923
+ target = map.get(seed);
74924
+
74925
+ target === undefined && map.set(seed, target = (i ? new Map() : factory(env)));
74926
+
74927
+ map = target;
74468
74928
  }
74469
- });
74470
74929
 
74930
+ return target;
74931
+ };
74932
+
74933
+ getFetch();
74934
+
74935
+ /**
74936
+ * Known adapters mapping.
74937
+ * Provides environment-specific adapters for Axios:
74938
+ * - `http` for Node.js
74939
+ * - `xhr` for browsers
74940
+ * - `fetch` for fetch API-based requests
74941
+ *
74942
+ * @type {Object<string, Function|Object>}
74943
+ */
74471
74944
  const knownAdapters = {
74472
74945
  http: httpAdapter,
74473
74946
  xhr: xhrAdapter,
74474
- fetch: fetchAdapter
74947
+ fetch: {
74948
+ get: getFetch,
74949
+ }
74475
74950
  };
74476
74951
 
74952
+ // Assign adapter names for easier debugging and identification
74477
74953
  utils$1.forEach(knownAdapters, (fn, value) => {
74478
74954
  if (fn) {
74479
74955
  try {
74480
- Object.defineProperty(fn, 'name', {value});
74956
+ Object.defineProperty(fn, 'name', { value });
74481
74957
  } catch (e) {
74482
74958
  // eslint-disable-next-line no-empty
74483
74959
  }
74484
- Object.defineProperty(fn, 'adapterName', {value});
74960
+ Object.defineProperty(fn, 'adapterName', { value });
74485
74961
  }
74486
74962
  });
74487
74963
 
74964
+ /**
74965
+ * Render a rejection reason string for unknown or unsupported adapters
74966
+ *
74967
+ * @param {string} reason
74968
+ * @returns {string}
74969
+ */
74488
74970
  const renderReason = (reason) => `- ${reason}`;
74489
74971
 
74972
+ /**
74973
+ * Check if the adapter is resolved (function, null, or false)
74974
+ *
74975
+ * @param {Function|null|false} adapter
74976
+ * @returns {boolean}
74977
+ */
74490
74978
  const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false;
74491
74979
 
74492
- var adapters = {
74493
- getAdapter: (adapters) => {
74494
- adapters = utils$1.isArray(adapters) ? adapters : [adapters];
74495
-
74496
- const {length} = adapters;
74497
- let nameOrAdapter;
74498
- let adapter;
74980
+ /**
74981
+ * Get the first suitable adapter from the provided list.
74982
+ * Tries each adapter in order until a supported one is found.
74983
+ * Throws an AxiosError if no adapter is suitable.
74984
+ *
74985
+ * @param {Array<string|Function>|string|Function} adapters - Adapter(s) by name or function.
74986
+ * @param {Object} config - Axios request configuration
74987
+ * @throws {AxiosError} If no suitable adapter is available
74988
+ * @returns {Function} The resolved adapter function
74989
+ */
74990
+ function getAdapter$1(adapters, config) {
74991
+ adapters = utils$1.isArray(adapters) ? adapters : [adapters];
74499
74992
 
74500
- const rejectedReasons = {};
74993
+ const { length } = adapters;
74994
+ let nameOrAdapter;
74995
+ let adapter;
74501
74996
 
74502
- for (let i = 0; i < length; i++) {
74503
- nameOrAdapter = adapters[i];
74504
- let id;
74997
+ const rejectedReasons = {};
74505
74998
 
74506
- adapter = nameOrAdapter;
74999
+ for (let i = 0; i < length; i++) {
75000
+ nameOrAdapter = adapters[i];
75001
+ let id;
74507
75002
 
74508
- if (!isResolvedHandle(nameOrAdapter)) {
74509
- adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
75003
+ adapter = nameOrAdapter;
74510
75004
 
74511
- if (adapter === undefined) {
74512
- throw new AxiosError$1(`Unknown adapter '${id}'`);
74513
- }
74514
- }
75005
+ if (!isResolvedHandle(nameOrAdapter)) {
75006
+ adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
74515
75007
 
74516
- if (adapter) {
74517
- break;
75008
+ if (adapter === undefined) {
75009
+ throw new AxiosError$1(`Unknown adapter '${id}'`);
74518
75010
  }
75011
+ }
74519
75012
 
74520
- rejectedReasons[id || '#' + i] = adapter;
75013
+ if (adapter && (utils$1.isFunction(adapter) || (adapter = adapter.get(config)))) {
75014
+ break;
74521
75015
  }
74522
75016
 
74523
- if (!adapter) {
75017
+ rejectedReasons[id || '#' + i] = adapter;
75018
+ }
74524
75019
 
74525
- const reasons = Object.entries(rejectedReasons)
74526
- .map(([id, state]) => `adapter ${id} ` +
74527
- (state === false ? 'is not supported by the environment' : 'is not available in the build')
74528
- );
75020
+ if (!adapter) {
75021
+ const reasons = Object.entries(rejectedReasons)
75022
+ .map(([id, state]) => `adapter ${id} ` +
75023
+ (state === false ? 'is not supported by the environment' : 'is not available in the build')
75024
+ );
74529
75025
 
74530
- let s = length ?
74531
- (reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0])) :
74532
- 'as no adapter specified';
75026
+ let s = length ?
75027
+ (reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0])) :
75028
+ 'as no adapter specified';
74533
75029
 
74534
- throw new AxiosError$1(
74535
- `There is no suitable adapter to dispatch the request ` + s,
74536
- 'ERR_NOT_SUPPORT'
74537
- );
74538
- }
75030
+ throw new AxiosError$1(
75031
+ `There is no suitable adapter to dispatch the request ` + s,
75032
+ 'ERR_NOT_SUPPORT'
75033
+ );
75034
+ }
74539
75035
 
74540
- return adapter;
74541
- },
75036
+ return adapter;
75037
+ }
75038
+
75039
+ /**
75040
+ * Exports Axios adapters and utility to resolve an adapter
75041
+ */
75042
+ var adapters = {
75043
+ /**
75044
+ * Resolve an adapter from a list of adapter names or functions.
75045
+ * @type {Function}
75046
+ */
75047
+ getAdapter: getAdapter$1,
75048
+
75049
+ /**
75050
+ * Exposes all known adapters
75051
+ * @type {Object<string, Function|Object>}
75052
+ */
74542
75053
  adapters: knownAdapters
74543
75054
  };
74544
75055
 
@@ -74581,7 +75092,7 @@ function dispatchRequest(config) {
74581
75092
  config.headers.setContentType('application/x-www-form-urlencoded', false);
74582
75093
  }
74583
75094
 
74584
- const adapter = adapters.getAdapter(config.adapter || defaults.adapter);
75095
+ const adapter = adapters.getAdapter(config.adapter || defaults.adapter, config);
74585
75096
 
74586
75097
  return adapter(config).then(function onAdapterResolution(response) {
74587
75098
  throwIfCancellationRequested(config);
@@ -74869,8 +75380,6 @@ let Axios$1 = class Axios {
74869
75380
 
74870
75381
  let newConfig = config;
74871
75382
 
74872
- i = 0;
74873
-
74874
75383
  while (i < len) {
74875
75384
  const onFulfilled = requestInterceptorChain[i++];
74876
75385
  const onRejected = requestInterceptorChain[i++];
@@ -75170,6 +75679,12 @@ const HttpStatusCode$1 = {
75170
75679
  LoopDetected: 508,
75171
75680
  NotExtended: 510,
75172
75681
  NetworkAuthenticationRequired: 511,
75682
+ WebServerIsDown: 521,
75683
+ ConnectionTimedOut: 522,
75684
+ OriginIsUnreachable: 523,
75685
+ TimeoutOccurred: 524,
75686
+ SslHandshakeFailed: 525,
75687
+ InvalidSslCertificate: 526,
75173
75688
  };
75174
75689
 
75175
75690
  Object.entries(HttpStatusCode$1).forEach(([key, value]) => {
@@ -75305,19 +75820,41 @@ const assetsService = (axiosInstance) => {
75305
75820
  };
75306
75821
  };
75307
75822
 
75308
- const config = readConfig() || { ...DEFAULT_CONFIG, apiKey: '' };
75309
- const sandboxAxiosInstance = axios.create({
75310
- baseURL: config.sandboxUrl,
75311
- headers: {
75312
- 'X-API-Key': config.apiKey,
75823
+ let sandboxAxiosInstance = null;
75824
+ const getAxiosInstance = () => {
75825
+ const config = readConfig() || { ...DEFAULT_CONFIG, apiKey: '' };
75826
+ // Create or update the axios instance with current config
75827
+ if (!sandboxAxiosInstance) {
75828
+ sandboxAxiosInstance = axios.create({
75829
+ baseURL: config.sandboxUrl,
75830
+ headers: {
75831
+ 'X-API-Key': config.apiKey,
75832
+ },
75833
+ });
75834
+ }
75835
+ else {
75836
+ // Update the existing instance with new config
75837
+ sandboxAxiosInstance.defaults.baseURL = config.sandboxUrl;
75838
+ sandboxAxiosInstance.defaults.headers['X-API-Key'] = config.apiKey;
75839
+ }
75840
+ return sandboxAxiosInstance;
75841
+ };
75842
+ const getServices = () => {
75843
+ const instance = getAxiosInstance();
75844
+ return {
75845
+ pages: pagesService(instance),
75846
+ project: projectService(instance),
75847
+ style: styleService(instance),
75848
+ assets: assetsService(instance),
75849
+ };
75850
+ };
75851
+ // Initialize services with lazy loading
75852
+ const services = new Proxy({}, {
75853
+ get(_, prop) {
75854
+ const servicesInstance = getServices();
75855
+ return servicesInstance[prop];
75313
75856
  },
75314
75857
  });
75315
- const services = {
75316
- pages: pagesService(sandboxAxiosInstance),
75317
- project: projectService(sandboxAxiosInstance),
75318
- style: styleService(sandboxAxiosInstance),
75319
- assets: assetsService(sandboxAxiosInstance),
75320
- };
75321
75858
 
75322
75859
  const fetchPages = async () => {
75323
75860
  try {