@kimafinance/kima-transaction-widget 1.2.72-beta.1 → 1.2.74-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -9,7 +9,6 @@ var SolanaAdapter = require('@solana/wallet-adapter-react');
9
9
  var walletAdapterWallets = require('@solana/wallet-adapter-wallets');
10
10
  var tronwalletAdapterLedger = require('@tronweb3/tronwallet-adapter-ledger');
11
11
  var tronwalletAdapterTronlink = require('@tronweb3/tronwallet-adapter-tronlink');
12
- var tronwalletAdapterOkxwallet = require('@tronweb3/tronwallet-adapter-okxwallet');
13
12
  var tronwalletAdapterTokenpocket = require('@tronweb3/tronwallet-adapter-tokenpocket');
14
13
  var tronwalletAdapterReactHooks = require('@tronweb3/tronwallet-adapter-react-hooks');
15
14
  var tronwalletAbstractAdapter = require('@tronweb3/tronwallet-abstract-adapter');
@@ -8813,6 +8812,8 @@ const isFormData = (thing) => {
8813
8812
  */
8814
8813
  const isURLSearchParams = kindOfTest('URLSearchParams');
8815
8814
 
8815
+ const [isReadableStream, isRequest, isResponse, isHeaders] = ['ReadableStream', 'Request', 'Response', 'Headers'].map(kindOfTest);
8816
+
8816
8817
  /**
8817
8818
  * Trim excess whitespace off the beginning and end of a string
8818
8819
  *
@@ -9201,8 +9202,7 @@ const toObjectSet = (arrayOrString, delimiter) => {
9201
9202
  const noop = () => {};
9202
9203
 
9203
9204
  const toFiniteNumber = (value, defaultValue) => {
9204
- value = +value;
9205
- return Number.isFinite(value) ? value : defaultValue;
9205
+ return value != null && Number.isFinite(value = +value) ? value : defaultValue;
9206
9206
  };
9207
9207
 
9208
9208
  const ALPHA = 'abcdefghijklmnopqrstuvwxyz';
@@ -9272,6 +9272,36 @@ const isAsyncFn = kindOfTest('AsyncFunction');
9272
9272
  const isThenable = (thing) =>
9273
9273
  thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
9274
9274
 
9275
+ // original code
9276
+ // https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34
9277
+
9278
+ const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
9279
+ if (setImmediateSupported) {
9280
+ return setImmediate;
9281
+ }
9282
+
9283
+ return postMessageSupported ? ((token, callbacks) => {
9284
+ _global.addEventListener("message", ({source, data}) => {
9285
+ if (source === _global && data === token) {
9286
+ callbacks.length && callbacks.shift()();
9287
+ }
9288
+ }, false);
9289
+
9290
+ return (cb) => {
9291
+ callbacks.push(cb);
9292
+ _global.postMessage(token, "*");
9293
+ }
9294
+ })(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb);
9295
+ })(
9296
+ typeof setImmediate === 'function',
9297
+ isFunction(_global.postMessage)
9298
+ );
9299
+
9300
+ const asap = typeof queueMicrotask !== 'undefined' ?
9301
+ queueMicrotask.bind(_global) : ( typeof process !== 'undefined' && process.nextTick || _setImmediate);
9302
+
9303
+ // *********************
9304
+
9275
9305
  var utils$1 = {
9276
9306
  isArray,
9277
9307
  isArrayBuffer,
@@ -9283,6 +9313,10 @@ var utils$1 = {
9283
9313
  isBoolean,
9284
9314
  isObject,
9285
9315
  isPlainObject,
9316
+ isReadableStream,
9317
+ isRequest,
9318
+ isResponse,
9319
+ isHeaders,
9286
9320
  isUndefined,
9287
9321
  isDate,
9288
9322
  isFile,
@@ -9323,7 +9357,9 @@ var utils$1 = {
9323
9357
  isSpecCompliantForm,
9324
9358
  toJSONObject,
9325
9359
  isAsyncFn,
9326
- isThenable
9360
+ isThenable,
9361
+ setImmediate: _setImmediate,
9362
+ asap
9327
9363
  };
9328
9364
 
9329
9365
  /**
@@ -9351,7 +9387,10 @@ function AxiosError(message, code, config, request, response) {
9351
9387
  code && (this.code = code);
9352
9388
  config && (this.config = config);
9353
9389
  request && (this.request = request);
9354
- response && (this.response = response);
9390
+ if (response) {
9391
+ this.response = response;
9392
+ this.status = response.status ? response.status : null;
9393
+ }
9355
9394
  }
9356
9395
 
9357
9396
  utils$1.inherits(AxiosError, Error, {
@@ -9371,7 +9410,7 @@ utils$1.inherits(AxiosError, Error, {
9371
9410
  // Axios
9372
9411
  config: utils$1.toJSONObject(this.config),
9373
9412
  code: this.code,
9374
- status: this.response && this.response.status ? this.response.status : null
9413
+ status: this.status
9375
9414
  };
9376
9415
  }
9377
9416
  });
@@ -9837,6 +9876,8 @@ var platform = {
9837
9876
 
9838
9877
  const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
9839
9878
 
9879
+ const _navigator = typeof navigator === 'object' && navigator || undefined;
9880
+
9840
9881
  /**
9841
9882
  * Determine if we're running in a standard browser environment
9842
9883
  *
@@ -9854,10 +9895,8 @@ const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'unde
9854
9895
  *
9855
9896
  * @returns {boolean}
9856
9897
  */
9857
- const hasStandardBrowserEnv = (
9858
- (product) => {
9859
- return hasBrowserEnv && ['ReactNative', 'NativeScript', 'NS'].indexOf(product) < 0
9860
- })(typeof navigator !== 'undefined' && navigator.product);
9898
+ const hasStandardBrowserEnv = hasBrowserEnv &&
9899
+ (!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);
9861
9900
 
9862
9901
  /**
9863
9902
  * Determine if we're running in a standard browser webWorker environment
@@ -9877,11 +9916,15 @@ const hasStandardBrowserWebWorkerEnv = (() => {
9877
9916
  );
9878
9917
  })();
9879
9918
 
9919
+ const origin = hasBrowserEnv && window.location.href || 'http://localhost';
9920
+
9880
9921
  var utils$2 = {
9881
9922
  __proto__: null,
9882
9923
  hasBrowserEnv: hasBrowserEnv,
9883
9924
  hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
9884
- hasStandardBrowserEnv: hasStandardBrowserEnv
9925
+ hasStandardBrowserEnv: hasStandardBrowserEnv,
9926
+ navigator: _navigator,
9927
+ origin: origin
9885
9928
  };
9886
9929
 
9887
9930
  var platform$1 = {
@@ -10021,7 +10064,7 @@ const defaults = {
10021
10064
 
10022
10065
  transitional: transitionalDefaults,
10023
10066
 
10024
- adapter: ['xhr', 'http'],
10067
+ adapter: ['xhr', 'http', 'fetch'],
10025
10068
 
10026
10069
  transformRequest: [function transformRequest(data, headers) {
10027
10070
  const contentType = headers.getContentType() || '';
@@ -10042,7 +10085,8 @@ const defaults = {
10042
10085
  utils$1.isBuffer(data) ||
10043
10086
  utils$1.isStream(data) ||
10044
10087
  utils$1.isFile(data) ||
10045
- utils$1.isBlob(data)
10088
+ utils$1.isBlob(data) ||
10089
+ utils$1.isReadableStream(data)
10046
10090
  ) {
10047
10091
  return data;
10048
10092
  }
@@ -10085,6 +10129,10 @@ const defaults = {
10085
10129
  const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
10086
10130
  const JSONRequested = this.responseType === 'json';
10087
10131
 
10132
+ if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
10133
+ return data;
10134
+ }
10135
+
10088
10136
  if (data && utils$1.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
10089
10137
  const silentJSONParsing = transitional && transitional.silentJSONParsing;
10090
10138
  const strictJSONParsing = !silentJSONParsing && JSONRequested;
@@ -10286,6 +10334,10 @@ class AxiosHeaders {
10286
10334
  setHeaders(header, valueOrRewrite);
10287
10335
  } else if(utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
10288
10336
  setHeaders(parseHeaders(header), valueOrRewrite);
10337
+ } else if (utils$1.isHeaders(header)) {
10338
+ for (const [key, value] of header.entries()) {
10339
+ setHeader(value, key, rewrite);
10340
+ }
10289
10341
  } else {
10290
10342
  header != null && setHeader(valueOrRewrite, header, rewrite);
10291
10343
  }
@@ -10551,96 +10603,153 @@ function settle(resolve, reject, response) {
10551
10603
  }
10552
10604
  }
10553
10605
 
10554
- var cookies = platform$1.hasStandardBrowserEnv ?
10606
+ function parseProtocol(url) {
10607
+ const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
10608
+ return match && match[1] || '';
10609
+ }
10555
10610
 
10556
- // Standard browser envs support document.cookie
10557
- {
10558
- write(name, value, expires, path, domain, secure) {
10559
- const cookie = [name + '=' + encodeURIComponent(value)];
10611
+ /**
10612
+ * Calculate data maxRate
10613
+ * @param {Number} [samplesCount= 10]
10614
+ * @param {Number} [min= 1000]
10615
+ * @returns {Function}
10616
+ */
10617
+ function speedometer(samplesCount, min) {
10618
+ samplesCount = samplesCount || 10;
10619
+ const bytes = new Array(samplesCount);
10620
+ const timestamps = new Array(samplesCount);
10621
+ let head = 0;
10622
+ let tail = 0;
10623
+ let firstSampleTS;
10560
10624
 
10561
- utils$1.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString());
10625
+ min = min !== undefined ? min : 1000;
10562
10626
 
10563
- utils$1.isString(path) && cookie.push('path=' + path);
10627
+ return function push(chunkLength) {
10628
+ const now = Date.now();
10564
10629
 
10565
- utils$1.isString(domain) && cookie.push('domain=' + domain);
10630
+ const startedAt = timestamps[tail];
10566
10631
 
10567
- secure === true && cookie.push('secure');
10632
+ if (!firstSampleTS) {
10633
+ firstSampleTS = now;
10634
+ }
10568
10635
 
10569
- document.cookie = cookie.join('; ');
10570
- },
10636
+ bytes[head] = chunkLength;
10637
+ timestamps[head] = now;
10571
10638
 
10572
- read(name) {
10573
- const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
10574
- return (match ? decodeURIComponent(match[3]) : null);
10575
- },
10639
+ let i = tail;
10640
+ let bytesCount = 0;
10576
10641
 
10577
- remove(name) {
10578
- this.write(name, '', Date.now() - 86400000);
10642
+ while (i !== head) {
10643
+ bytesCount += bytes[i++];
10644
+ i = i % samplesCount;
10579
10645
  }
10580
- }
10581
10646
 
10582
- :
10647
+ head = (head + 1) % samplesCount;
10583
10648
 
10584
- // Non-standard browser env (web workers, react-native) lack needed support.
10585
- {
10586
- write() {},
10587
- read() {
10588
- return null;
10589
- },
10590
- remove() {}
10591
- };
10649
+ if (head === tail) {
10650
+ tail = (tail + 1) % samplesCount;
10651
+ }
10592
10652
 
10593
- /**
10594
- * Determines whether the specified URL is absolute
10595
- *
10596
- * @param {string} url The URL to test
10597
- *
10598
- * @returns {boolean} True if the specified URL is absolute, otherwise false
10599
- */
10600
- function isAbsoluteURL(url) {
10601
- // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
10602
- // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
10603
- // by any combination of letters, digits, plus, period, or hyphen.
10604
- return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
10605
- }
10653
+ if (now - firstSampleTS < min) {
10654
+ return;
10655
+ }
10606
10656
 
10607
- /**
10608
- * Creates a new URL by combining the specified URLs
10609
- *
10610
- * @param {string} baseURL The base URL
10611
- * @param {string} relativeURL The relative URL
10612
- *
10613
- * @returns {string} The combined URL
10614
- */
10615
- function combineURLs(baseURL, relativeURL) {
10616
- return relativeURL
10617
- ? baseURL.replace(/\/?\/$/, '') + '/' + relativeURL.replace(/^\/+/, '')
10618
- : baseURL;
10657
+ const passed = startedAt && now - startedAt;
10658
+
10659
+ return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
10660
+ };
10619
10661
  }
10620
10662
 
10621
10663
  /**
10622
- * Creates a new URL by combining the baseURL with the requestedURL,
10623
- * only when the requestedURL is not already an absolute URL.
10624
- * If the requestURL is absolute, this function returns the requestedURL untouched.
10625
- *
10626
- * @param {string} baseURL The base URL
10627
- * @param {string} requestedURL Absolute or relative URL to combine
10628
- *
10629
- * @returns {string} The combined full path
10664
+ * Throttle decorator
10665
+ * @param {Function} fn
10666
+ * @param {Number} freq
10667
+ * @return {Function}
10630
10668
  */
10631
- function buildFullPath(baseURL, requestedURL) {
10632
- if (baseURL && !isAbsoluteURL(requestedURL)) {
10633
- return combineURLs(baseURL, requestedURL);
10634
- }
10635
- return requestedURL;
10669
+ function throttle(fn, freq) {
10670
+ let timestamp = 0;
10671
+ let threshold = 1000 / freq;
10672
+ let lastArgs;
10673
+ let timer;
10674
+
10675
+ const invoke = (args, now = Date.now()) => {
10676
+ timestamp = now;
10677
+ lastArgs = null;
10678
+ if (timer) {
10679
+ clearTimeout(timer);
10680
+ timer = null;
10681
+ }
10682
+ fn.apply(null, args);
10683
+ };
10684
+
10685
+ const throttled = (...args) => {
10686
+ const now = Date.now();
10687
+ const passed = now - timestamp;
10688
+ if ( passed >= threshold) {
10689
+ invoke(args, now);
10690
+ } else {
10691
+ lastArgs = args;
10692
+ if (!timer) {
10693
+ timer = setTimeout(() => {
10694
+ timer = null;
10695
+ invoke(lastArgs);
10696
+ }, threshold - passed);
10697
+ }
10698
+ }
10699
+ };
10700
+
10701
+ const flush = () => lastArgs && invoke(lastArgs);
10702
+
10703
+ return [throttled, flush];
10636
10704
  }
10637
10705
 
10706
+ const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
10707
+ let bytesNotified = 0;
10708
+ const _speedometer = speedometer(50, 250);
10709
+
10710
+ return throttle(e => {
10711
+ const loaded = e.loaded;
10712
+ const total = e.lengthComputable ? e.total : undefined;
10713
+ const progressBytes = loaded - bytesNotified;
10714
+ const rate = _speedometer(progressBytes);
10715
+ const inRange = loaded <= total;
10716
+
10717
+ bytesNotified = loaded;
10718
+
10719
+ const data = {
10720
+ loaded,
10721
+ total,
10722
+ progress: total ? (loaded / total) : undefined,
10723
+ bytes: progressBytes,
10724
+ rate: rate ? rate : undefined,
10725
+ estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
10726
+ event: e,
10727
+ lengthComputable: total != null,
10728
+ [isDownloadStream ? 'download' : 'upload']: true
10729
+ };
10730
+
10731
+ listener(data);
10732
+ }, freq);
10733
+ };
10734
+
10735
+ const progressEventDecorator = (total, throttled) => {
10736
+ const lengthComputable = total != null;
10737
+
10738
+ return [(loaded) => throttled[0]({
10739
+ lengthComputable,
10740
+ total,
10741
+ loaded
10742
+ }), throttled[1]];
10743
+ };
10744
+
10745
+ const asyncDecorator = (fn) => (...args) => utils$1.asap(() => fn(...args));
10746
+
10638
10747
  var isURLSameOrigin = platform$1.hasStandardBrowserEnv ?
10639
10748
 
10640
10749
  // Standard browser envs have full support of the APIs needed to test
10641
10750
  // whether the request URL is of the same origin as current location.
10642
10751
  (function standardBrowserEnv() {
10643
- const msie = /(msie|trident)/i.test(navigator.userAgent);
10752
+ const msie = platform$1.navigator && /(msie|trident)/i.test(platform$1.navigator.userAgent);
10644
10753
  const urlParsingNode = document.createElement('a');
10645
10754
  let originURL;
10646
10755
 
@@ -10698,137 +10807,267 @@ var isURLSameOrigin = platform$1.hasStandardBrowserEnv ?
10698
10807
  };
10699
10808
  })();
10700
10809
 
10701
- function parseProtocol(url) {
10702
- const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
10703
- return match && match[1] || '';
10704
- }
10810
+ var cookies = platform$1.hasStandardBrowserEnv ?
10705
10811
 
10706
- /**
10707
- * Calculate data maxRate
10708
- * @param {Number} [samplesCount= 10]
10709
- * @param {Number} [min= 1000]
10710
- * @returns {Function}
10711
- */
10712
- function speedometer(samplesCount, min) {
10713
- samplesCount = samplesCount || 10;
10714
- const bytes = new Array(samplesCount);
10715
- const timestamps = new Array(samplesCount);
10716
- let head = 0;
10717
- let tail = 0;
10718
- let firstSampleTS;
10812
+ // Standard browser envs support document.cookie
10813
+ {
10814
+ write(name, value, expires, path, domain, secure) {
10815
+ const cookie = [name + '=' + encodeURIComponent(value)];
10719
10816
 
10720
- min = min !== undefined ? min : 1000;
10817
+ utils$1.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString());
10721
10818
 
10722
- return function push(chunkLength) {
10723
- const now = Date.now();
10819
+ utils$1.isString(path) && cookie.push('path=' + path);
10724
10820
 
10725
- const startedAt = timestamps[tail];
10821
+ utils$1.isString(domain) && cookie.push('domain=' + domain);
10726
10822
 
10727
- if (!firstSampleTS) {
10728
- firstSampleTS = now;
10729
- }
10823
+ secure === true && cookie.push('secure');
10730
10824
 
10731
- bytes[head] = chunkLength;
10732
- timestamps[head] = now;
10825
+ document.cookie = cookie.join('; ');
10826
+ },
10733
10827
 
10734
- let i = tail;
10735
- let bytesCount = 0;
10828
+ read(name) {
10829
+ const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
10830
+ return (match ? decodeURIComponent(match[3]) : null);
10831
+ },
10736
10832
 
10737
- while (i !== head) {
10738
- bytesCount += bytes[i++];
10739
- i = i % samplesCount;
10833
+ remove(name) {
10834
+ this.write(name, '', Date.now() - 86400000);
10740
10835
  }
10836
+ }
10741
10837
 
10742
- head = (head + 1) % samplesCount;
10743
-
10744
- if (head === tail) {
10745
- tail = (tail + 1) % samplesCount;
10746
- }
10838
+ :
10747
10839
 
10748
- if (now - firstSampleTS < min) {
10749
- return;
10750
- }
10840
+ // Non-standard browser env (web workers, react-native) lack needed support.
10841
+ {
10842
+ write() {},
10843
+ read() {
10844
+ return null;
10845
+ },
10846
+ remove() {}
10847
+ };
10751
10848
 
10752
- const passed = startedAt && now - startedAt;
10849
+ /**
10850
+ * Determines whether the specified URL is absolute
10851
+ *
10852
+ * @param {string} url The URL to test
10853
+ *
10854
+ * @returns {boolean} True if the specified URL is absolute, otherwise false
10855
+ */
10856
+ function isAbsoluteURL(url) {
10857
+ // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
10858
+ // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
10859
+ // by any combination of letters, digits, plus, period, or hyphen.
10860
+ return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
10861
+ }
10753
10862
 
10754
- return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
10755
- };
10863
+ /**
10864
+ * Creates a new URL by combining the specified URLs
10865
+ *
10866
+ * @param {string} baseURL The base URL
10867
+ * @param {string} relativeURL The relative URL
10868
+ *
10869
+ * @returns {string} The combined URL
10870
+ */
10871
+ function combineURLs(baseURL, relativeURL) {
10872
+ return relativeURL
10873
+ ? baseURL.replace(/\/?\/$/, '') + '/' + relativeURL.replace(/^\/+/, '')
10874
+ : baseURL;
10756
10875
  }
10757
10876
 
10758
- function progressEventReducer(listener, isDownloadStream) {
10759
- let bytesNotified = 0;
10760
- const _speedometer = speedometer(50, 250);
10877
+ /**
10878
+ * Creates a new URL by combining the baseURL with the requestedURL,
10879
+ * only when the requestedURL is not already an absolute URL.
10880
+ * If the requestURL is absolute, this function returns the requestedURL untouched.
10881
+ *
10882
+ * @param {string} baseURL The base URL
10883
+ * @param {string} requestedURL Absolute or relative URL to combine
10884
+ *
10885
+ * @returns {string} The combined full path
10886
+ */
10887
+ function buildFullPath(baseURL, requestedURL) {
10888
+ if (baseURL && !isAbsoluteURL(requestedURL)) {
10889
+ return combineURLs(baseURL, requestedURL);
10890
+ }
10891
+ return requestedURL;
10892
+ }
10761
10893
 
10762
- return e => {
10763
- const loaded = e.loaded;
10764
- const total = e.lengthComputable ? e.total : undefined;
10765
- const progressBytes = loaded - bytesNotified;
10766
- const rate = _speedometer(progressBytes);
10767
- const inRange = loaded <= total;
10894
+ const headersToObject = (thing) => thing instanceof AxiosHeaders ? { ...thing } : thing;
10768
10895
 
10769
- bytesNotified = loaded;
10896
+ /**
10897
+ * Config-specific merge-function which creates a new config-object
10898
+ * by merging two configuration objects together.
10899
+ *
10900
+ * @param {Object} config1
10901
+ * @param {Object} config2
10902
+ *
10903
+ * @returns {Object} New object resulting from merging config2 to config1
10904
+ */
10905
+ function mergeConfig(config1, config2) {
10906
+ // eslint-disable-next-line no-param-reassign
10907
+ config2 = config2 || {};
10908
+ const config = {};
10770
10909
 
10771
- const data = {
10772
- loaded,
10773
- total,
10774
- progress: total ? (loaded / total) : undefined,
10775
- bytes: progressBytes,
10776
- rate: rate ? rate : undefined,
10777
- estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
10778
- event: e
10779
- };
10910
+ function getMergedValue(target, source, caseless) {
10911
+ if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
10912
+ return utils$1.merge.call({caseless}, target, source);
10913
+ } else if (utils$1.isPlainObject(source)) {
10914
+ return utils$1.merge({}, source);
10915
+ } else if (utils$1.isArray(source)) {
10916
+ return source.slice();
10917
+ }
10918
+ return source;
10919
+ }
10780
10920
 
10781
- data[isDownloadStream ? 'download' : 'upload'] = true;
10921
+ // eslint-disable-next-line consistent-return
10922
+ function mergeDeepProperties(a, b, caseless) {
10923
+ if (!utils$1.isUndefined(b)) {
10924
+ return getMergedValue(a, b, caseless);
10925
+ } else if (!utils$1.isUndefined(a)) {
10926
+ return getMergedValue(undefined, a, caseless);
10927
+ }
10928
+ }
10782
10929
 
10783
- listener(data);
10930
+ // eslint-disable-next-line consistent-return
10931
+ function valueFromConfig2(a, b) {
10932
+ if (!utils$1.isUndefined(b)) {
10933
+ return getMergedValue(undefined, b);
10934
+ }
10935
+ }
10936
+
10937
+ // eslint-disable-next-line consistent-return
10938
+ function defaultToConfig2(a, b) {
10939
+ if (!utils$1.isUndefined(b)) {
10940
+ return getMergedValue(undefined, b);
10941
+ } else if (!utils$1.isUndefined(a)) {
10942
+ return getMergedValue(undefined, a);
10943
+ }
10944
+ }
10945
+
10946
+ // eslint-disable-next-line consistent-return
10947
+ function mergeDirectKeys(a, b, prop) {
10948
+ if (prop in config2) {
10949
+ return getMergedValue(a, b);
10950
+ } else if (prop in config1) {
10951
+ return getMergedValue(undefined, a);
10952
+ }
10953
+ }
10954
+
10955
+ const mergeMap = {
10956
+ url: valueFromConfig2,
10957
+ method: valueFromConfig2,
10958
+ data: valueFromConfig2,
10959
+ baseURL: defaultToConfig2,
10960
+ transformRequest: defaultToConfig2,
10961
+ transformResponse: defaultToConfig2,
10962
+ paramsSerializer: defaultToConfig2,
10963
+ timeout: defaultToConfig2,
10964
+ timeoutMessage: defaultToConfig2,
10965
+ withCredentials: defaultToConfig2,
10966
+ withXSRFToken: defaultToConfig2,
10967
+ adapter: defaultToConfig2,
10968
+ responseType: defaultToConfig2,
10969
+ xsrfCookieName: defaultToConfig2,
10970
+ xsrfHeaderName: defaultToConfig2,
10971
+ onUploadProgress: defaultToConfig2,
10972
+ onDownloadProgress: defaultToConfig2,
10973
+ decompress: defaultToConfig2,
10974
+ maxContentLength: defaultToConfig2,
10975
+ maxBodyLength: defaultToConfig2,
10976
+ beforeRedirect: defaultToConfig2,
10977
+ transport: defaultToConfig2,
10978
+ httpAgent: defaultToConfig2,
10979
+ httpsAgent: defaultToConfig2,
10980
+ cancelToken: defaultToConfig2,
10981
+ socketPath: defaultToConfig2,
10982
+ responseEncoding: defaultToConfig2,
10983
+ validateStatus: mergeDirectKeys,
10984
+ headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)
10784
10985
  };
10986
+
10987
+ utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
10988
+ const merge = mergeMap[prop] || mergeDeepProperties;
10989
+ const configValue = merge(config1[prop], config2[prop], prop);
10990
+ (utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
10991
+ });
10992
+
10993
+ return config;
10785
10994
  }
10786
10995
 
10787
- const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
10996
+ var resolveConfig = (config) => {
10997
+ const newConfig = mergeConfig({}, config);
10788
10998
 
10789
- var xhrAdapter = isXHRAdapterSupported && function (config) {
10790
- return new Promise(function dispatchXhrRequest(resolve, reject) {
10791
- let requestData = config.data;
10792
- const requestHeaders = AxiosHeaders.from(config.headers).normalize();
10793
- let {responseType, withXSRFToken} = config;
10794
- let onCanceled;
10795
- function done() {
10796
- if (config.cancelToken) {
10797
- config.cancelToken.unsubscribe(onCanceled);
10798
- }
10999
+ let {data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth} = newConfig;
10799
11000
 
10800
- if (config.signal) {
10801
- config.signal.removeEventListener('abort', onCanceled);
10802
- }
11001
+ newConfig.headers = headers = AxiosHeaders.from(headers);
11002
+
11003
+ newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url), config.params, config.paramsSerializer);
11004
+
11005
+ // HTTP basic authentication
11006
+ if (auth) {
11007
+ headers.set('Authorization', 'Basic ' +
11008
+ btoa((auth.username || '') + ':' + (auth.password ? unescape(encodeURIComponent(auth.password)) : ''))
11009
+ );
11010
+ }
11011
+
11012
+ let contentType;
11013
+
11014
+ if (utils$1.isFormData(data)) {
11015
+ if (platform$1.hasStandardBrowserEnv || platform$1.hasStandardBrowserWebWorkerEnv) {
11016
+ headers.setContentType(undefined); // Let the browser set it
11017
+ } else if ((contentType = headers.getContentType()) !== false) {
11018
+ // fix semicolon duplication issue for ReactNative FormData implementation
11019
+ const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : [];
11020
+ headers.setContentType([type || 'multipart/form-data', ...tokens].join('; '));
10803
11021
  }
11022
+ }
11023
+
11024
+ // Add xsrf header
11025
+ // This is only done if running in a standard browser environment.
11026
+ // Specifically not if we're in a web worker, or react-native.
11027
+
11028
+ if (platform$1.hasStandardBrowserEnv) {
11029
+ withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
10804
11030
 
10805
- let contentType;
11031
+ if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(newConfig.url))) {
11032
+ // Add xsrf header
11033
+ const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
10806
11034
 
10807
- if (utils$1.isFormData(requestData)) {
10808
- if (platform$1.hasStandardBrowserEnv || platform$1.hasStandardBrowserWebWorkerEnv) {
10809
- requestHeaders.setContentType(false); // Let the browser set it
10810
- } else if ((contentType = requestHeaders.getContentType()) !== false) {
10811
- // fix semicolon duplication issue for ReactNative FormData implementation
10812
- const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : [];
10813
- requestHeaders.setContentType([type || 'multipart/form-data', ...tokens].join('; '));
11035
+ if (xsrfValue) {
11036
+ headers.set(xsrfHeaderName, xsrfValue);
10814
11037
  }
10815
11038
  }
11039
+ }
10816
11040
 
10817
- let request = new XMLHttpRequest();
11041
+ return newConfig;
11042
+ };
10818
11043
 
10819
- // HTTP basic authentication
10820
- if (config.auth) {
10821
- const username = config.auth.username || '';
10822
- const password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';
10823
- requestHeaders.set('Authorization', 'Basic ' + btoa(username + ':' + password));
11044
+ const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
11045
+
11046
+ var xhrAdapter = isXHRAdapterSupported && function (config) {
11047
+ return new Promise(function dispatchXhrRequest(resolve, reject) {
11048
+ const _config = resolveConfig(config);
11049
+ let requestData = _config.data;
11050
+ const requestHeaders = AxiosHeaders.from(_config.headers).normalize();
11051
+ let {responseType, onUploadProgress, onDownloadProgress} = _config;
11052
+ let onCanceled;
11053
+ let uploadThrottled, downloadThrottled;
11054
+ let flushUpload, flushDownload;
11055
+
11056
+ function done() {
11057
+ flushUpload && flushUpload(); // flush events
11058
+ flushDownload && flushDownload(); // flush events
11059
+
11060
+ _config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
11061
+
11062
+ _config.signal && _config.signal.removeEventListener('abort', onCanceled);
10824
11063
  }
10825
11064
 
10826
- const fullPath = buildFullPath(config.baseURL, config.url);
11065
+ let request = new XMLHttpRequest();
10827
11066
 
10828
- request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
11067
+ request.open(_config.method.toUpperCase(), _config.url, true);
10829
11068
 
10830
11069
  // Set the request timeout in MS
10831
- request.timeout = config.timeout;
11070
+ request.timeout = _config.timeout;
10832
11071
 
10833
11072
  function onloadend() {
10834
11073
  if (!request) {
@@ -10908,10 +11147,10 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
10908
11147
 
10909
11148
  // Handle timeout
10910
11149
  request.ontimeout = function handleTimeout() {
10911
- let timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';
10912
- const transitional = config.transitional || transitionalDefaults;
10913
- if (config.timeoutErrorMessage) {
10914
- timeoutErrorMessage = config.timeoutErrorMessage;
11150
+ let timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded';
11151
+ const transitional = _config.transitional || transitionalDefaults;
11152
+ if (_config.timeoutErrorMessage) {
11153
+ timeoutErrorMessage = _config.timeoutErrorMessage;
10915
11154
  }
10916
11155
  reject(new AxiosError(
10917
11156
  timeoutErrorMessage,
@@ -10923,22 +11162,6 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
10923
11162
  request = null;
10924
11163
  };
10925
11164
 
10926
- // Add xsrf header
10927
- // This is only done if running in a standard browser environment.
10928
- // Specifically not if we're in a web worker, or react-native.
10929
- if(platform$1.hasStandardBrowserEnv) {
10930
- withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(config));
10931
-
10932
- if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(fullPath))) {
10933
- // Add xsrf header
10934
- const xsrfValue = config.xsrfHeaderName && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
10935
-
10936
- if (xsrfValue) {
10937
- requestHeaders.set(config.xsrfHeaderName, xsrfValue);
10938
- }
10939
- }
10940
- }
10941
-
10942
11165
  // Remove Content-Type if data is undefined
10943
11166
  requestData === undefined && requestHeaders.setContentType(null);
10944
11167
 
@@ -10950,26 +11173,31 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
10950
11173
  }
10951
11174
 
10952
11175
  // Add withCredentials to request if needed
10953
- if (!utils$1.isUndefined(config.withCredentials)) {
10954
- request.withCredentials = !!config.withCredentials;
11176
+ if (!utils$1.isUndefined(_config.withCredentials)) {
11177
+ request.withCredentials = !!_config.withCredentials;
10955
11178
  }
10956
11179
 
10957
11180
  // Add responseType to request if needed
10958
11181
  if (responseType && responseType !== 'json') {
10959
- request.responseType = config.responseType;
11182
+ request.responseType = _config.responseType;
10960
11183
  }
10961
11184
 
10962
11185
  // Handle progress if needed
10963
- if (typeof config.onDownloadProgress === 'function') {
10964
- request.addEventListener('progress', progressEventReducer(config.onDownloadProgress, true));
11186
+ if (onDownloadProgress) {
11187
+ ([downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true));
11188
+ request.addEventListener('progress', downloadThrottled);
10965
11189
  }
10966
11190
 
10967
11191
  // Not all browsers support upload events
10968
- if (typeof config.onUploadProgress === 'function' && request.upload) {
10969
- request.upload.addEventListener('progress', progressEventReducer(config.onUploadProgress));
11192
+ if (onUploadProgress && request.upload) {
11193
+ ([uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress));
11194
+
11195
+ request.upload.addEventListener('progress', uploadThrottled);
11196
+
11197
+ request.upload.addEventListener('loadend', flushUpload);
10970
11198
  }
10971
11199
 
10972
- if (config.cancelToken || config.signal) {
11200
+ if (_config.cancelToken || _config.signal) {
10973
11201
  // Handle cancellation
10974
11202
  // eslint-disable-next-line func-names
10975
11203
  onCanceled = cancel => {
@@ -10981,13 +11209,13 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
10981
11209
  request = null;
10982
11210
  };
10983
11211
 
10984
- config.cancelToken && config.cancelToken.subscribe(onCanceled);
10985
- if (config.signal) {
10986
- config.signal.aborted ? onCanceled() : config.signal.addEventListener('abort', onCanceled);
11212
+ _config.cancelToken && _config.cancelToken.subscribe(onCanceled);
11213
+ if (_config.signal) {
11214
+ _config.signal.aborted ? onCanceled() : _config.signal.addEventListener('abort', onCanceled);
10987
11215
  }
10988
11216
  }
10989
11217
 
10990
- const protocol = parseProtocol(fullPath);
11218
+ const protocol = parseProtocol(_config.url);
10991
11219
 
10992
11220
  if (protocol && platform$1.protocols.indexOf(protocol) === -1) {
10993
11221
  reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));
@@ -11000,9 +11228,358 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
11000
11228
  });
11001
11229
  };
11002
11230
 
11231
+ const composeSignals = (signals, timeout) => {
11232
+ const {length} = (signals = signals ? signals.filter(Boolean) : []);
11233
+
11234
+ if (timeout || length) {
11235
+ let controller = new AbortController();
11236
+
11237
+ let aborted;
11238
+
11239
+ const onabort = function (reason) {
11240
+ if (!aborted) {
11241
+ aborted = true;
11242
+ unsubscribe();
11243
+ const err = reason instanceof Error ? reason : this.reason;
11244
+ controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err));
11245
+ }
11246
+ };
11247
+
11248
+ let timer = timeout && setTimeout(() => {
11249
+ timer = null;
11250
+ onabort(new AxiosError(`timeout ${timeout} of ms exceeded`, AxiosError.ETIMEDOUT));
11251
+ }, timeout);
11252
+
11253
+ const unsubscribe = () => {
11254
+ if (signals) {
11255
+ timer && clearTimeout(timer);
11256
+ timer = null;
11257
+ signals.forEach(signal => {
11258
+ signal.unsubscribe ? signal.unsubscribe(onabort) : signal.removeEventListener('abort', onabort);
11259
+ });
11260
+ signals = null;
11261
+ }
11262
+ };
11263
+
11264
+ signals.forEach((signal) => signal.addEventListener('abort', onabort));
11265
+
11266
+ const {signal} = controller;
11267
+
11268
+ signal.unsubscribe = () => utils$1.asap(unsubscribe);
11269
+
11270
+ return signal;
11271
+ }
11272
+ };
11273
+
11274
+ const streamChunk = function* (chunk, chunkSize) {
11275
+ let len = chunk.byteLength;
11276
+
11277
+ if (!chunkSize || len < chunkSize) {
11278
+ yield chunk;
11279
+ return;
11280
+ }
11281
+
11282
+ let pos = 0;
11283
+ let end;
11284
+
11285
+ while (pos < len) {
11286
+ end = pos + chunkSize;
11287
+ yield chunk.slice(pos, end);
11288
+ pos = end;
11289
+ }
11290
+ };
11291
+
11292
+ const readBytes = async function* (iterable, chunkSize) {
11293
+ for await (const chunk of readStream(iterable)) {
11294
+ yield* streamChunk(chunk, chunkSize);
11295
+ }
11296
+ };
11297
+
11298
+ const readStream = async function* (stream) {
11299
+ if (stream[Symbol.asyncIterator]) {
11300
+ yield* stream;
11301
+ return;
11302
+ }
11303
+
11304
+ const reader = stream.getReader();
11305
+ try {
11306
+ for (;;) {
11307
+ const {done, value} = await reader.read();
11308
+ if (done) {
11309
+ break;
11310
+ }
11311
+ yield value;
11312
+ }
11313
+ } finally {
11314
+ await reader.cancel();
11315
+ }
11316
+ };
11317
+
11318
+ const trackStream = (stream, chunkSize, onProgress, onFinish) => {
11319
+ const iterator = readBytes(stream, chunkSize);
11320
+
11321
+ let bytes = 0;
11322
+ let done;
11323
+ let _onFinish = (e) => {
11324
+ if (!done) {
11325
+ done = true;
11326
+ onFinish && onFinish(e);
11327
+ }
11328
+ };
11329
+
11330
+ return new ReadableStream({
11331
+ async pull(controller) {
11332
+ try {
11333
+ const {done, value} = await iterator.next();
11334
+
11335
+ if (done) {
11336
+ _onFinish();
11337
+ controller.close();
11338
+ return;
11339
+ }
11340
+
11341
+ let len = value.byteLength;
11342
+ if (onProgress) {
11343
+ let loadedBytes = bytes += len;
11344
+ onProgress(loadedBytes);
11345
+ }
11346
+ controller.enqueue(new Uint8Array(value));
11347
+ } catch (err) {
11348
+ _onFinish(err);
11349
+ throw err;
11350
+ }
11351
+ },
11352
+ cancel(reason) {
11353
+ _onFinish(reason);
11354
+ return iterator.return();
11355
+ }
11356
+ }, {
11357
+ highWaterMark: 2
11358
+ })
11359
+ };
11360
+
11361
+ const isFetchSupported = typeof fetch === 'function' && typeof Request === 'function' && typeof Response === 'function';
11362
+ const isReadableStreamSupported = isFetchSupported && typeof ReadableStream === 'function';
11363
+
11364
+ // used only inside the fetch adapter
11365
+ const encodeText = isFetchSupported && (typeof TextEncoder === 'function' ?
11366
+ ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) :
11367
+ async (str) => new Uint8Array(await new Response(str).arrayBuffer())
11368
+ );
11369
+
11370
+ const test = (fn, ...args) => {
11371
+ try {
11372
+ return !!fn(...args);
11373
+ } catch (e) {
11374
+ return false
11375
+ }
11376
+ };
11377
+
11378
+ const supportsRequestStream = isReadableStreamSupported && test(() => {
11379
+ let duplexAccessed = false;
11380
+
11381
+ const hasContentType = new Request(platform$1.origin, {
11382
+ body: new ReadableStream(),
11383
+ method: 'POST',
11384
+ get duplex() {
11385
+ duplexAccessed = true;
11386
+ return 'half';
11387
+ },
11388
+ }).headers.has('Content-Type');
11389
+
11390
+ return duplexAccessed && !hasContentType;
11391
+ });
11392
+
11393
+ const DEFAULT_CHUNK_SIZE = 64 * 1024;
11394
+
11395
+ const supportsResponseStream = isReadableStreamSupported &&
11396
+ test(() => utils$1.isReadableStream(new Response('').body));
11397
+
11398
+
11399
+ const resolvers = {
11400
+ stream: supportsResponseStream && ((res) => res.body)
11401
+ };
11402
+
11403
+ isFetchSupported && (((res) => {
11404
+ ['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => {
11405
+ !resolvers[type] && (resolvers[type] = utils$1.isFunction(res[type]) ? (res) => res[type]() :
11406
+ (_, config) => {
11407
+ throw new AxiosError(`Response type '${type}' is not supported`, AxiosError.ERR_NOT_SUPPORT, config);
11408
+ });
11409
+ });
11410
+ })(new Response));
11411
+
11412
+ const getBodyLength = async (body) => {
11413
+ if (body == null) {
11414
+ return 0;
11415
+ }
11416
+
11417
+ if(utils$1.isBlob(body)) {
11418
+ return body.size;
11419
+ }
11420
+
11421
+ if(utils$1.isSpecCompliantForm(body)) {
11422
+ const _request = new Request(platform$1.origin, {
11423
+ method: 'POST',
11424
+ body,
11425
+ });
11426
+ return (await _request.arrayBuffer()).byteLength;
11427
+ }
11428
+
11429
+ if(utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
11430
+ return body.byteLength;
11431
+ }
11432
+
11433
+ if(utils$1.isURLSearchParams(body)) {
11434
+ body = body + '';
11435
+ }
11436
+
11437
+ if(utils$1.isString(body)) {
11438
+ return (await encodeText(body)).byteLength;
11439
+ }
11440
+ };
11441
+
11442
+ const resolveBodyLength = async (headers, body) => {
11443
+ const length = utils$1.toFiniteNumber(headers.getContentLength());
11444
+
11445
+ return length == null ? getBodyLength(body) : length;
11446
+ };
11447
+
11448
+ var fetchAdapter = isFetchSupported && (async (config) => {
11449
+ let {
11450
+ url,
11451
+ method,
11452
+ data,
11453
+ signal,
11454
+ cancelToken,
11455
+ timeout,
11456
+ onDownloadProgress,
11457
+ onUploadProgress,
11458
+ responseType,
11459
+ headers,
11460
+ withCredentials = 'same-origin',
11461
+ fetchOptions
11462
+ } = resolveConfig(config);
11463
+
11464
+ responseType = responseType ? (responseType + '').toLowerCase() : 'text';
11465
+
11466
+ let composedSignal = composeSignals([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
11467
+
11468
+ let request;
11469
+
11470
+ const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
11471
+ composedSignal.unsubscribe();
11472
+ });
11473
+
11474
+ let requestContentLength;
11475
+
11476
+ try {
11477
+ if (
11478
+ onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' &&
11479
+ (requestContentLength = await resolveBodyLength(headers, data)) !== 0
11480
+ ) {
11481
+ let _request = new Request(url, {
11482
+ method: 'POST',
11483
+ body: data,
11484
+ duplex: "half"
11485
+ });
11486
+
11487
+ let contentTypeHeader;
11488
+
11489
+ if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
11490
+ headers.setContentType(contentTypeHeader);
11491
+ }
11492
+
11493
+ if (_request.body) {
11494
+ const [onProgress, flush] = progressEventDecorator(
11495
+ requestContentLength,
11496
+ progressEventReducer(asyncDecorator(onUploadProgress))
11497
+ );
11498
+
11499
+ data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
11500
+ }
11501
+ }
11502
+
11503
+ if (!utils$1.isString(withCredentials)) {
11504
+ withCredentials = withCredentials ? 'include' : 'omit';
11505
+ }
11506
+
11507
+ // Cloudflare Workers throws when credentials are defined
11508
+ // see https://github.com/cloudflare/workerd/issues/902
11509
+ const isCredentialsSupported = "credentials" in Request.prototype;
11510
+ request = new Request(url, {
11511
+ ...fetchOptions,
11512
+ signal: composedSignal,
11513
+ method: method.toUpperCase(),
11514
+ headers: headers.normalize().toJSON(),
11515
+ body: data,
11516
+ duplex: "half",
11517
+ credentials: isCredentialsSupported ? withCredentials : undefined
11518
+ });
11519
+
11520
+ let response = await fetch(request);
11521
+
11522
+ const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
11523
+
11524
+ if (supportsResponseStream && (onDownloadProgress || (isStreamResponse && unsubscribe))) {
11525
+ const options = {};
11526
+
11527
+ ['status', 'statusText', 'headers'].forEach(prop => {
11528
+ options[prop] = response[prop];
11529
+ });
11530
+
11531
+ const responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
11532
+
11533
+ const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
11534
+ responseContentLength,
11535
+ progressEventReducer(asyncDecorator(onDownloadProgress), true)
11536
+ ) || [];
11537
+
11538
+ response = new Response(
11539
+ trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
11540
+ flush && flush();
11541
+ unsubscribe && unsubscribe();
11542
+ }),
11543
+ options
11544
+ );
11545
+ }
11546
+
11547
+ responseType = responseType || 'text';
11548
+
11549
+ let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config);
11550
+
11551
+ !isStreamResponse && unsubscribe && unsubscribe();
11552
+
11553
+ return await new Promise((resolve, reject) => {
11554
+ settle(resolve, reject, {
11555
+ data: responseData,
11556
+ headers: AxiosHeaders.from(response.headers),
11557
+ status: response.status,
11558
+ statusText: response.statusText,
11559
+ config,
11560
+ request
11561
+ });
11562
+ })
11563
+ } catch (err) {
11564
+ unsubscribe && unsubscribe();
11565
+
11566
+ if (err && err.name === 'TypeError' && /fetch/i.test(err.message)) {
11567
+ throw Object.assign(
11568
+ new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request),
11569
+ {
11570
+ cause: err.cause || err
11571
+ }
11572
+ )
11573
+ }
11574
+
11575
+ throw AxiosError.from(err, err && err.code, config, request);
11576
+ }
11577
+ });
11578
+
11003
11579
  const knownAdapters = {
11004
11580
  http: httpAdapter,
11005
- xhr: xhrAdapter
11581
+ xhr: xhrAdapter,
11582
+ fetch: fetchAdapter
11006
11583
  };
11007
11584
 
11008
11585
  utils$1.forEach(knownAdapters, (fn, value) => {
@@ -11146,109 +11723,7 @@ function dispatchRequest(config) {
11146
11723
  });
11147
11724
  }
11148
11725
 
11149
- const headersToObject = (thing) => thing instanceof AxiosHeaders ? thing.toJSON() : thing;
11150
-
11151
- /**
11152
- * Config-specific merge-function which creates a new config-object
11153
- * by merging two configuration objects together.
11154
- *
11155
- * @param {Object} config1
11156
- * @param {Object} config2
11157
- *
11158
- * @returns {Object} New object resulting from merging config2 to config1
11159
- */
11160
- function mergeConfig(config1, config2) {
11161
- // eslint-disable-next-line no-param-reassign
11162
- config2 = config2 || {};
11163
- const config = {};
11164
-
11165
- function getMergedValue(target, source, caseless) {
11166
- if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
11167
- return utils$1.merge.call({caseless}, target, source);
11168
- } else if (utils$1.isPlainObject(source)) {
11169
- return utils$1.merge({}, source);
11170
- } else if (utils$1.isArray(source)) {
11171
- return source.slice();
11172
- }
11173
- return source;
11174
- }
11175
-
11176
- // eslint-disable-next-line consistent-return
11177
- function mergeDeepProperties(a, b, caseless) {
11178
- if (!utils$1.isUndefined(b)) {
11179
- return getMergedValue(a, b, caseless);
11180
- } else if (!utils$1.isUndefined(a)) {
11181
- return getMergedValue(undefined, a, caseless);
11182
- }
11183
- }
11184
-
11185
- // eslint-disable-next-line consistent-return
11186
- function valueFromConfig2(a, b) {
11187
- if (!utils$1.isUndefined(b)) {
11188
- return getMergedValue(undefined, b);
11189
- }
11190
- }
11191
-
11192
- // eslint-disable-next-line consistent-return
11193
- function defaultToConfig2(a, b) {
11194
- if (!utils$1.isUndefined(b)) {
11195
- return getMergedValue(undefined, b);
11196
- } else if (!utils$1.isUndefined(a)) {
11197
- return getMergedValue(undefined, a);
11198
- }
11199
- }
11200
-
11201
- // eslint-disable-next-line consistent-return
11202
- function mergeDirectKeys(a, b, prop) {
11203
- if (prop in config2) {
11204
- return getMergedValue(a, b);
11205
- } else if (prop in config1) {
11206
- return getMergedValue(undefined, a);
11207
- }
11208
- }
11209
-
11210
- const mergeMap = {
11211
- url: valueFromConfig2,
11212
- method: valueFromConfig2,
11213
- data: valueFromConfig2,
11214
- baseURL: defaultToConfig2,
11215
- transformRequest: defaultToConfig2,
11216
- transformResponse: defaultToConfig2,
11217
- paramsSerializer: defaultToConfig2,
11218
- timeout: defaultToConfig2,
11219
- timeoutMessage: defaultToConfig2,
11220
- withCredentials: defaultToConfig2,
11221
- withXSRFToken: defaultToConfig2,
11222
- adapter: defaultToConfig2,
11223
- responseType: defaultToConfig2,
11224
- xsrfCookieName: defaultToConfig2,
11225
- xsrfHeaderName: defaultToConfig2,
11226
- onUploadProgress: defaultToConfig2,
11227
- onDownloadProgress: defaultToConfig2,
11228
- decompress: defaultToConfig2,
11229
- maxContentLength: defaultToConfig2,
11230
- maxBodyLength: defaultToConfig2,
11231
- beforeRedirect: defaultToConfig2,
11232
- transport: defaultToConfig2,
11233
- httpAgent: defaultToConfig2,
11234
- httpsAgent: defaultToConfig2,
11235
- cancelToken: defaultToConfig2,
11236
- socketPath: defaultToConfig2,
11237
- responseEncoding: defaultToConfig2,
11238
- validateStatus: mergeDirectKeys,
11239
- headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)
11240
- };
11241
-
11242
- utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
11243
- const merge = mergeMap[prop] || mergeDeepProperties;
11244
- const configValue = merge(config1[prop], config2[prop], prop);
11245
- (utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
11246
- });
11247
-
11248
- return config;
11249
- }
11250
-
11251
- const VERSION = "1.6.7";
11726
+ const VERSION = "1.7.7";
11252
11727
 
11253
11728
  const validators = {};
11254
11729
 
@@ -11374,12 +11849,15 @@ class Axios {
11374
11849
 
11375
11850
  // slice off the Error: ... line
11376
11851
  const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, '') : '';
11377
-
11378
- if (!err.stack) {
11379
- err.stack = stack;
11380
- // match without the 2 top stack lines
11381
- } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) {
11382
- err.stack += '\n' + stack;
11852
+ try {
11853
+ if (!err.stack) {
11854
+ err.stack = stack;
11855
+ // match without the 2 top stack lines
11856
+ } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) {
11857
+ err.stack += '\n' + stack;
11858
+ }
11859
+ } catch (e) {
11860
+ // ignore the case where "stack" is an un-writable property
11383
11861
  }
11384
11862
  }
11385
11863
 
@@ -11650,6 +12128,20 @@ class CancelToken {
11650
12128
  }
11651
12129
  }
11652
12130
 
12131
+ toAbortSignal() {
12132
+ const controller = new AbortController();
12133
+
12134
+ const abort = (err) => {
12135
+ controller.abort(err);
12136
+ };
12137
+
12138
+ this.subscribe(abort);
12139
+
12140
+ controller.signal.unsubscribe = () => this.unsubscribe(abort);
12141
+
12142
+ return controller.signal;
12143
+ }
12144
+
11653
12145
  /**
11654
12146
  * Returns an object that contains a new `CancelToken` and a function that, when called,
11655
12147
  * cancels the `CancelToken`.
@@ -12856,8 +13348,7 @@ var KimaProvider = function KimaProvider(_ref) {
12856
13348
  accountNumber: 2
12857
13349
  });
12858
13350
  var tokenPocketAdapter = new tronwalletAdapterTokenpocket.TokenPocketAdapter();
12859
- var okxwalletAdapter = new tronwalletAdapterOkxwallet.OkxWalletAdapter();
12860
- return [tronLinkAdapter, tokenPocketAdapter, okxwalletAdapter, ledger];
13351
+ return [tronLinkAdapter, tokenPocketAdapter, ledger];
12861
13352
  }, []);
12862
13353
  function onError(e) {
12863
13354
  if (e instanceof tronwalletAbstractAdapter.WalletNotFoundError) {