@dimo-network/data-sdk 1.2.3 → 1.2.4

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.cjs CHANGED
@@ -1,12 +1,12 @@
1
1
  'use strict';
2
2
 
3
- var require$$1$1 = require('util');
4
3
  var Stream = require('stream');
5
4
  var require$$1$2 = require('path');
6
5
  var http = require('http');
7
6
  var https = require('https');
8
7
  var Url = require('url');
9
8
  var require$$6 = require('fs');
9
+ var crypto$2 = require('crypto');
10
10
  var require$$4 = require('assert');
11
11
  require('tty');
12
12
  require('os');
@@ -15,7 +15,6 @@ var require$$0$2 = require('events');
15
15
  var require$$0$3 = require('punycode');
16
16
  var require$$3 = require('net');
17
17
  var require$$4$1 = require('tls');
18
- var require$$1$3 = require('crypto');
19
18
  var require$$0$4 = require('buffer');
20
19
 
21
20
  var global$1 = (typeof global !== "undefined" ? global :
@@ -850,26 +849,6 @@ const toFiniteNumber = (value, defaultValue) => {
850
849
  return value != null && Number.isFinite(value = +value) ? value : defaultValue;
851
850
  };
852
851
 
853
- const ALPHA = 'abcdefghijklmnopqrstuvwxyz';
854
-
855
- const DIGIT = '0123456789';
856
-
857
- const ALPHABET = {
858
- DIGIT,
859
- ALPHA,
860
- ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT
861
- };
862
-
863
- const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {
864
- let str = '';
865
- const {length} = alphabet;
866
- while (size--) {
867
- str += alphabet[Math.random() * length|0];
868
- }
869
-
870
- return str;
871
- };
872
-
873
852
  /**
874
853
  * If the thing is a FormData object, return true, otherwise return false.
875
854
  *
@@ -997,8 +976,6 @@ var utils$4 = {
997
976
  findKey,
998
977
  global: _global,
999
978
  isContextDefined,
1000
- ALPHABET,
1001
- generateString,
1002
979
  isSpecCompliantForm,
1003
980
  toJSONObject,
1004
981
  isAsyncFn,
@@ -1836,8 +1813,8 @@ function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
1836
1813
  byteOffset = 0;
1837
1814
  } else if (byteOffset > 0x7fffffff) {
1838
1815
  byteOffset = 0x7fffffff;
1839
- } else if (byteOffset < -0x80000000) {
1840
- byteOffset = -0x80000000;
1816
+ } else if (byteOffset < -2147483648) {
1817
+ byteOffset = -2147483648;
1841
1818
  }
1842
1819
  byteOffset = +byteOffset; // Coerce to Number.
1843
1820
  if (isNaN(byteOffset)) {
@@ -2596,7 +2573,7 @@ Buffer$1.prototype.writeIntBE = function writeIntBE (value, offset, byteLength,
2596
2573
  Buffer$1.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
2597
2574
  value = +value;
2598
2575
  offset = offset | 0;
2599
- if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80);
2576
+ if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -128);
2600
2577
  if (!Buffer$1.TYPED_ARRAY_SUPPORT) value = Math.floor(value);
2601
2578
  if (value < 0) value = 0xff + value + 1;
2602
2579
  this[offset] = (value & 0xff);
@@ -2606,7 +2583,7 @@ Buffer$1.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
2606
2583
  Buffer$1.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
2607
2584
  value = +value;
2608
2585
  offset = offset | 0;
2609
- if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000);
2586
+ if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -32768);
2610
2587
  if (Buffer$1.TYPED_ARRAY_SUPPORT) {
2611
2588
  this[offset] = (value & 0xff);
2612
2589
  this[offset + 1] = (value >>> 8);
@@ -2619,7 +2596,7 @@ Buffer$1.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert
2619
2596
  Buffer$1.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
2620
2597
  value = +value;
2621
2598
  offset = offset | 0;
2622
- if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000);
2599
+ if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -32768);
2623
2600
  if (Buffer$1.TYPED_ARRAY_SUPPORT) {
2624
2601
  this[offset] = (value >>> 8);
2625
2602
  this[offset + 1] = (value & 0xff);
@@ -2632,7 +2609,7 @@ Buffer$1.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert
2632
2609
  Buffer$1.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
2633
2610
  value = +value;
2634
2611
  offset = offset | 0;
2635
- if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000);
2612
+ if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -2147483648);
2636
2613
  if (Buffer$1.TYPED_ARRAY_SUPPORT) {
2637
2614
  this[offset] = (value & 0xff);
2638
2615
  this[offset + 1] = (value >>> 8);
@@ -2647,7 +2624,7 @@ Buffer$1.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert
2647
2624
  Buffer$1.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
2648
2625
  value = +value;
2649
2626
  offset = offset | 0;
2650
- if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000);
2627
+ if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -2147483648);
2651
2628
  if (value < 0) value = 0xffffffff + value + 1;
2652
2629
  if (Buffer$1.TYPED_ARRAY_SUPPORT) {
2653
2630
  this[offset] = (value >>> 24);
@@ -2986,7 +2963,7 @@ function isSlowBuffer (obj) {
2986
2963
  *
2987
2964
  * @returns {Error} The created error.
2988
2965
  */
2989
- function AxiosError(message, code, config, request, response) {
2966
+ function AxiosError$1(message, code, config, request, response) {
2990
2967
  Error.call(this);
2991
2968
 
2992
2969
  if (Error.captureStackTrace) {
@@ -3006,7 +2983,7 @@ function AxiosError(message, code, config, request, response) {
3006
2983
  }
3007
2984
  }
3008
2985
 
3009
- utils$4.inherits(AxiosError, Error, {
2986
+ utils$4.inherits(AxiosError$1, Error, {
3010
2987
  toJSON: function toJSON() {
3011
2988
  return {
3012
2989
  // Standard
@@ -3028,7 +3005,7 @@ utils$4.inherits(AxiosError, Error, {
3028
3005
  }
3029
3006
  });
3030
3007
 
3031
- const prototype$1 = AxiosError.prototype;
3008
+ const prototype$1 = AxiosError$1.prototype;
3032
3009
  const descriptors = {};
3033
3010
 
3034
3011
  [
@@ -3049,11 +3026,11 @@ const descriptors = {};
3049
3026
  descriptors[code] = {value: code};
3050
3027
  });
3051
3028
 
3052
- Object.defineProperties(AxiosError, descriptors);
3029
+ Object.defineProperties(AxiosError$1, descriptors);
3053
3030
  Object.defineProperty(prototype$1, 'isAxiosError', {value: true});
3054
3031
 
3055
3032
  // eslint-disable-next-line func-names
3056
- AxiosError.from = (error, code, config, request, response, customProps) => {
3033
+ AxiosError$1.from = (error, code, config, request, response, customProps) => {
3057
3034
  const axiosError = Object.create(prototype$1);
3058
3035
 
3059
3036
  utils$4.toFlatObject(error, axiosError, function filter(obj) {
@@ -3062,7 +3039,7 @@ AxiosError.from = (error, code, config, request, response, customProps) => {
3062
3039
  return prop !== 'isAxiosError';
3063
3040
  });
3064
3041
 
3065
- AxiosError.call(axiosError, error.message, code, config, request, response);
3042
+ AxiosError$1.call(axiosError, error.message, code, config, request, response);
3066
3043
 
3067
3044
  axiosError.cause = error;
3068
3045
 
@@ -3080,7 +3057,7 @@ function getDefaultExportFromCjs (x) {
3080
3057
  }
3081
3058
 
3082
3059
  function getAugmentedNamespace(n) {
3083
- if (n.__esModule) return n;
3060
+ if (Object.prototype.hasOwnProperty.call(n, '__esModule')) return n;
3084
3061
  var f = n.default;
3085
3062
  if (typeof f == "function") {
3086
3063
  var a = function a () {
@@ -3104,6 +3081,102 @@ function getAugmentedNamespace(n) {
3104
3081
  return a;
3105
3082
  }
3106
3083
 
3084
+ class InvalidTokenError extends Error {
3085
+ }
3086
+ InvalidTokenError.prototype.name = "InvalidTokenError";
3087
+ function b64DecodeUnicode(str) {
3088
+ return decodeURIComponent(atob(str).replace(/(.)/g, (m, p) => {
3089
+ let code = p.charCodeAt(0).toString(16).toUpperCase();
3090
+ if (code.length < 2) {
3091
+ code = "0" + code;
3092
+ }
3093
+ return "%" + code;
3094
+ }));
3095
+ }
3096
+ function base64UrlDecode(str) {
3097
+ let output = str.replace(/-/g, "+").replace(/_/g, "/");
3098
+ switch (output.length % 4) {
3099
+ case 0:
3100
+ break;
3101
+ case 2:
3102
+ output += "==";
3103
+ break;
3104
+ case 3:
3105
+ output += "=";
3106
+ break;
3107
+ default:
3108
+ throw new Error("base64 string is not of the correct length");
3109
+ }
3110
+ try {
3111
+ return b64DecodeUnicode(output);
3112
+ }
3113
+ catch (err) {
3114
+ return atob(output);
3115
+ }
3116
+ }
3117
+ function jwtDecode(token, options) {
3118
+ if (typeof token !== "string") {
3119
+ throw new InvalidTokenError("Invalid token specified: must be a string");
3120
+ }
3121
+ options || (options = {});
3122
+ const pos = options.header === true ? 0 : 1;
3123
+ const part = token.split(".")[pos];
3124
+ if (typeof part !== "string") {
3125
+ throw new InvalidTokenError(`Invalid token specified: missing part #${pos + 1}`);
3126
+ }
3127
+ let decoded;
3128
+ try {
3129
+ decoded = base64UrlDecode(part);
3130
+ }
3131
+ catch (e) {
3132
+ throw new InvalidTokenError(`Invalid token specified: invalid base64 for part #${pos + 1} (${e.message})`);
3133
+ }
3134
+ try {
3135
+ return JSON.parse(decoded);
3136
+ }
3137
+ catch (e) {
3138
+ throw new InvalidTokenError(`Invalid token specified: invalid json for part #${pos + 1} (${e.message})`);
3139
+ }
3140
+ }
3141
+
3142
+ const decodeJwt = (token) => {
3143
+ try {
3144
+ const decoded = jwtDecode(token);
3145
+ return decoded;
3146
+ }
3147
+ catch (error) {
3148
+ console.error('Failed to decode JWT', error);
3149
+ return null;
3150
+ }
3151
+ };
3152
+
3153
+ const decodePermissions = (permissionHex) => {
3154
+ const cleanHex = permissionHex.toLowerCase().replace("0x", "");
3155
+ const permissionBits = BigInt("0x" + cleanHex);
3156
+ const grantedPermissions = [];
3157
+ for (let i = 0; i < 128; i++) {
3158
+ const bitPair = (permissionBits >> BigInt(i * 2)) & BigInt(0b11);
3159
+ if (bitPair === BigInt(0b11)) {
3160
+ grantedPermissions.push(i);
3161
+ }
3162
+ }
3163
+ return grantedPermissions;
3164
+ };
3165
+
3166
+ var util$1 = {
3167
+ decodeJwt,
3168
+ decodePermissions
3169
+ };
3170
+
3171
+ var util$2 = /*#__PURE__*/Object.freeze({
3172
+ __proto__: null,
3173
+ decodeJwt: decodeJwt,
3174
+ decodePermissions: decodePermissions,
3175
+ default: util$1
3176
+ });
3177
+
3178
+ var require$$1$1 = /*@__PURE__*/getAugmentedNamespace(util$2);
3179
+
3107
3180
  var delayed_stream;
3108
3181
  var hasRequiredDelayed_stream;
3109
3182
 
@@ -14822,6 +14895,1081 @@ function requireAsynckit () {
14822
14895
  return asynckit;
14823
14896
  }
14824
14897
 
14898
+ var esObjectAtoms;
14899
+ var hasRequiredEsObjectAtoms;
14900
+
14901
+ function requireEsObjectAtoms () {
14902
+ if (hasRequiredEsObjectAtoms) return esObjectAtoms;
14903
+ hasRequiredEsObjectAtoms = 1;
14904
+
14905
+ /** @type {import('.')} */
14906
+ esObjectAtoms = Object;
14907
+ return esObjectAtoms;
14908
+ }
14909
+
14910
+ var esErrors;
14911
+ var hasRequiredEsErrors;
14912
+
14913
+ function requireEsErrors () {
14914
+ if (hasRequiredEsErrors) return esErrors;
14915
+ hasRequiredEsErrors = 1;
14916
+
14917
+ /** @type {import('.')} */
14918
+ esErrors = Error;
14919
+ return esErrors;
14920
+ }
14921
+
14922
+ var _eval;
14923
+ var hasRequired_eval;
14924
+
14925
+ function require_eval () {
14926
+ if (hasRequired_eval) return _eval;
14927
+ hasRequired_eval = 1;
14928
+
14929
+ /** @type {import('./eval')} */
14930
+ _eval = EvalError;
14931
+ return _eval;
14932
+ }
14933
+
14934
+ var range;
14935
+ var hasRequiredRange;
14936
+
14937
+ function requireRange () {
14938
+ if (hasRequiredRange) return range;
14939
+ hasRequiredRange = 1;
14940
+
14941
+ /** @type {import('./range')} */
14942
+ range = RangeError;
14943
+ return range;
14944
+ }
14945
+
14946
+ var ref;
14947
+ var hasRequiredRef;
14948
+
14949
+ function requireRef () {
14950
+ if (hasRequiredRef) return ref;
14951
+ hasRequiredRef = 1;
14952
+
14953
+ /** @type {import('./ref')} */
14954
+ ref = ReferenceError;
14955
+ return ref;
14956
+ }
14957
+
14958
+ var syntax;
14959
+ var hasRequiredSyntax;
14960
+
14961
+ function requireSyntax () {
14962
+ if (hasRequiredSyntax) return syntax;
14963
+ hasRequiredSyntax = 1;
14964
+
14965
+ /** @type {import('./syntax')} */
14966
+ syntax = SyntaxError;
14967
+ return syntax;
14968
+ }
14969
+
14970
+ var type;
14971
+ var hasRequiredType;
14972
+
14973
+ function requireType () {
14974
+ if (hasRequiredType) return type;
14975
+ hasRequiredType = 1;
14976
+
14977
+ /** @type {import('./type')} */
14978
+ type = TypeError;
14979
+ return type;
14980
+ }
14981
+
14982
+ var uri;
14983
+ var hasRequiredUri;
14984
+
14985
+ function requireUri () {
14986
+ if (hasRequiredUri) return uri;
14987
+ hasRequiredUri = 1;
14988
+
14989
+ /** @type {import('./uri')} */
14990
+ uri = URIError;
14991
+ return uri;
14992
+ }
14993
+
14994
+ var abs;
14995
+ var hasRequiredAbs;
14996
+
14997
+ function requireAbs () {
14998
+ if (hasRequiredAbs) return abs;
14999
+ hasRequiredAbs = 1;
15000
+
15001
+ /** @type {import('./abs')} */
15002
+ abs = Math.abs;
15003
+ return abs;
15004
+ }
15005
+
15006
+ var floor;
15007
+ var hasRequiredFloor;
15008
+
15009
+ function requireFloor () {
15010
+ if (hasRequiredFloor) return floor;
15011
+ hasRequiredFloor = 1;
15012
+
15013
+ /** @type {import('./floor')} */
15014
+ floor = Math.floor;
15015
+ return floor;
15016
+ }
15017
+
15018
+ var max;
15019
+ var hasRequiredMax;
15020
+
15021
+ function requireMax () {
15022
+ if (hasRequiredMax) return max;
15023
+ hasRequiredMax = 1;
15024
+
15025
+ /** @type {import('./max')} */
15026
+ max = Math.max;
15027
+ return max;
15028
+ }
15029
+
15030
+ var min;
15031
+ var hasRequiredMin;
15032
+
15033
+ function requireMin () {
15034
+ if (hasRequiredMin) return min;
15035
+ hasRequiredMin = 1;
15036
+
15037
+ /** @type {import('./min')} */
15038
+ min = Math.min;
15039
+ return min;
15040
+ }
15041
+
15042
+ var pow$1;
15043
+ var hasRequiredPow;
15044
+
15045
+ function requirePow () {
15046
+ if (hasRequiredPow) return pow$1;
15047
+ hasRequiredPow = 1;
15048
+
15049
+ /** @type {import('./pow')} */
15050
+ pow$1 = Math.pow;
15051
+ return pow$1;
15052
+ }
15053
+
15054
+ var round;
15055
+ var hasRequiredRound;
15056
+
15057
+ function requireRound () {
15058
+ if (hasRequiredRound) return round;
15059
+ hasRequiredRound = 1;
15060
+
15061
+ /** @type {import('./round')} */
15062
+ round = Math.round;
15063
+ return round;
15064
+ }
15065
+
15066
+ var _isNaN;
15067
+ var hasRequired_isNaN;
15068
+
15069
+ function require_isNaN () {
15070
+ if (hasRequired_isNaN) return _isNaN;
15071
+ hasRequired_isNaN = 1;
15072
+
15073
+ /** @type {import('./isNaN')} */
15074
+ _isNaN = Number.isNaN || function isNaN(a) {
15075
+ return a !== a;
15076
+ };
15077
+ return _isNaN;
15078
+ }
15079
+
15080
+ var sign$5;
15081
+ var hasRequiredSign;
15082
+
15083
+ function requireSign () {
15084
+ if (hasRequiredSign) return sign$5;
15085
+ hasRequiredSign = 1;
15086
+
15087
+ var $isNaN = /*@__PURE__*/ require_isNaN();
15088
+
15089
+ /** @type {import('./sign')} */
15090
+ sign$5 = function sign(number) {
15091
+ if ($isNaN(number) || number === 0) {
15092
+ return number;
15093
+ }
15094
+ return number < 0 ? -1 : 1;
15095
+ };
15096
+ return sign$5;
15097
+ }
15098
+
15099
+ var gOPD;
15100
+ var hasRequiredGOPD;
15101
+
15102
+ function requireGOPD () {
15103
+ if (hasRequiredGOPD) return gOPD;
15104
+ hasRequiredGOPD = 1;
15105
+
15106
+ /** @type {import('./gOPD')} */
15107
+ gOPD = Object.getOwnPropertyDescriptor;
15108
+ return gOPD;
15109
+ }
15110
+
15111
+ var gopd;
15112
+ var hasRequiredGopd;
15113
+
15114
+ function requireGopd () {
15115
+ if (hasRequiredGopd) return gopd;
15116
+ hasRequiredGopd = 1;
15117
+
15118
+ /** @type {import('.')} */
15119
+ var $gOPD = /*@__PURE__*/ requireGOPD();
15120
+
15121
+ if ($gOPD) {
15122
+ try {
15123
+ $gOPD([], 'length');
15124
+ } catch (e) {
15125
+ // IE 8 has a broken gOPD
15126
+ $gOPD = null;
15127
+ }
15128
+ }
15129
+
15130
+ gopd = $gOPD;
15131
+ return gopd;
15132
+ }
15133
+
15134
+ var esDefineProperty;
15135
+ var hasRequiredEsDefineProperty;
15136
+
15137
+ function requireEsDefineProperty () {
15138
+ if (hasRequiredEsDefineProperty) return esDefineProperty;
15139
+ hasRequiredEsDefineProperty = 1;
15140
+
15141
+ /** @type {import('.')} */
15142
+ var $defineProperty = Object.defineProperty || false;
15143
+ if ($defineProperty) {
15144
+ try {
15145
+ $defineProperty({}, 'a', { value: 1 });
15146
+ } catch (e) {
15147
+ // IE 8 has a broken defineProperty
15148
+ $defineProperty = false;
15149
+ }
15150
+ }
15151
+
15152
+ esDefineProperty = $defineProperty;
15153
+ return esDefineProperty;
15154
+ }
15155
+
15156
+ var shams$1;
15157
+ var hasRequiredShams$1;
15158
+
15159
+ function requireShams$1 () {
15160
+ if (hasRequiredShams$1) return shams$1;
15161
+ hasRequiredShams$1 = 1;
15162
+
15163
+ /** @type {import('./shams')} */
15164
+ /* eslint complexity: [2, 18], max-statements: [2, 33] */
15165
+ shams$1 = function hasSymbols() {
15166
+ if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; }
15167
+ if (typeof Symbol.iterator === 'symbol') { return true; }
15168
+
15169
+ /** @type {{ [k in symbol]?: unknown }} */
15170
+ var obj = {};
15171
+ var sym = Symbol('test');
15172
+ var symObj = Object(sym);
15173
+ if (typeof sym === 'string') { return false; }
15174
+
15175
+ if (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; }
15176
+ if (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; }
15177
+
15178
+ // temp disabled per https://github.com/ljharb/object.assign/issues/17
15179
+ // if (sym instanceof Symbol) { return false; }
15180
+ // temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4
15181
+ // if (!(symObj instanceof Symbol)) { return false; }
15182
+
15183
+ // if (typeof Symbol.prototype.toString !== 'function') { return false; }
15184
+ // if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; }
15185
+
15186
+ var symVal = 42;
15187
+ obj[sym] = symVal;
15188
+ for (var _ in obj) { return false; } // eslint-disable-line no-restricted-syntax, no-unreachable-loop
15189
+ if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; }
15190
+
15191
+ if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; }
15192
+
15193
+ var syms = Object.getOwnPropertySymbols(obj);
15194
+ if (syms.length !== 1 || syms[0] !== sym) { return false; }
15195
+
15196
+ if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; }
15197
+
15198
+ if (typeof Object.getOwnPropertyDescriptor === 'function') {
15199
+ // eslint-disable-next-line no-extra-parens
15200
+ var descriptor = /** @type {PropertyDescriptor} */ (Object.getOwnPropertyDescriptor(obj, sym));
15201
+ if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; }
15202
+ }
15203
+
15204
+ return true;
15205
+ };
15206
+ return shams$1;
15207
+ }
15208
+
15209
+ var hasSymbols;
15210
+ var hasRequiredHasSymbols;
15211
+
15212
+ function requireHasSymbols () {
15213
+ if (hasRequiredHasSymbols) return hasSymbols;
15214
+ hasRequiredHasSymbols = 1;
15215
+
15216
+ var origSymbol = typeof Symbol !== 'undefined' && Symbol;
15217
+ var hasSymbolSham = requireShams$1();
15218
+
15219
+ /** @type {import('.')} */
15220
+ hasSymbols = function hasNativeSymbols() {
15221
+ if (typeof origSymbol !== 'function') { return false; }
15222
+ if (typeof Symbol !== 'function') { return false; }
15223
+ if (typeof origSymbol('foo') !== 'symbol') { return false; }
15224
+ if (typeof Symbol('bar') !== 'symbol') { return false; }
15225
+
15226
+ return hasSymbolSham();
15227
+ };
15228
+ return hasSymbols;
15229
+ }
15230
+
15231
+ var Reflect_getPrototypeOf;
15232
+ var hasRequiredReflect_getPrototypeOf;
15233
+
15234
+ function requireReflect_getPrototypeOf () {
15235
+ if (hasRequiredReflect_getPrototypeOf) return Reflect_getPrototypeOf;
15236
+ hasRequiredReflect_getPrototypeOf = 1;
15237
+
15238
+ /** @type {import('./Reflect.getPrototypeOf')} */
15239
+ Reflect_getPrototypeOf = (typeof Reflect !== 'undefined' && Reflect.getPrototypeOf) || null;
15240
+ return Reflect_getPrototypeOf;
15241
+ }
15242
+
15243
+ var Object_getPrototypeOf;
15244
+ var hasRequiredObject_getPrototypeOf;
15245
+
15246
+ function requireObject_getPrototypeOf () {
15247
+ if (hasRequiredObject_getPrototypeOf) return Object_getPrototypeOf;
15248
+ hasRequiredObject_getPrototypeOf = 1;
15249
+
15250
+ var $Object = /*@__PURE__*/ requireEsObjectAtoms();
15251
+
15252
+ /** @type {import('./Object.getPrototypeOf')} */
15253
+ Object_getPrototypeOf = $Object.getPrototypeOf || null;
15254
+ return Object_getPrototypeOf;
15255
+ }
15256
+
15257
+ var implementation;
15258
+ var hasRequiredImplementation;
15259
+
15260
+ function requireImplementation () {
15261
+ if (hasRequiredImplementation) return implementation;
15262
+ hasRequiredImplementation = 1;
15263
+
15264
+ /* eslint no-invalid-this: 1 */
15265
+
15266
+ var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';
15267
+ var toStr = Object.prototype.toString;
15268
+ var max = Math.max;
15269
+ var funcType = '[object Function]';
15270
+
15271
+ var concatty = function concatty(a, b) {
15272
+ var arr = [];
15273
+
15274
+ for (var i = 0; i < a.length; i += 1) {
15275
+ arr[i] = a[i];
15276
+ }
15277
+ for (var j = 0; j < b.length; j += 1) {
15278
+ arr[j + a.length] = b[j];
15279
+ }
15280
+
15281
+ return arr;
15282
+ };
15283
+
15284
+ var slicy = function slicy(arrLike, offset) {
15285
+ var arr = [];
15286
+ for (var i = offset, j = 0; i < arrLike.length; i += 1, j += 1) {
15287
+ arr[j] = arrLike[i];
15288
+ }
15289
+ return arr;
15290
+ };
15291
+
15292
+ var joiny = function (arr, joiner) {
15293
+ var str = '';
15294
+ for (var i = 0; i < arr.length; i += 1) {
15295
+ str += arr[i];
15296
+ if (i + 1 < arr.length) {
15297
+ str += joiner;
15298
+ }
15299
+ }
15300
+ return str;
15301
+ };
15302
+
15303
+ implementation = function bind(that) {
15304
+ var target = this;
15305
+ if (typeof target !== 'function' || toStr.apply(target) !== funcType) {
15306
+ throw new TypeError(ERROR_MESSAGE + target);
15307
+ }
15308
+ var args = slicy(arguments, 1);
15309
+
15310
+ var bound;
15311
+ var binder = function () {
15312
+ if (this instanceof bound) {
15313
+ var result = target.apply(
15314
+ this,
15315
+ concatty(args, arguments)
15316
+ );
15317
+ if (Object(result) === result) {
15318
+ return result;
15319
+ }
15320
+ return this;
15321
+ }
15322
+ return target.apply(
15323
+ that,
15324
+ concatty(args, arguments)
15325
+ );
15326
+
15327
+ };
15328
+
15329
+ var boundLength = max(0, target.length - args.length);
15330
+ var boundArgs = [];
15331
+ for (var i = 0; i < boundLength; i++) {
15332
+ boundArgs[i] = '$' + i;
15333
+ }
15334
+
15335
+ bound = Function('binder', 'return function (' + joiny(boundArgs, ',') + '){ return binder.apply(this,arguments); }')(binder);
15336
+
15337
+ if (target.prototype) {
15338
+ var Empty = function Empty() {};
15339
+ Empty.prototype = target.prototype;
15340
+ bound.prototype = new Empty();
15341
+ Empty.prototype = null;
15342
+ }
15343
+
15344
+ return bound;
15345
+ };
15346
+ return implementation;
15347
+ }
15348
+
15349
+ var functionBind;
15350
+ var hasRequiredFunctionBind;
15351
+
15352
+ function requireFunctionBind () {
15353
+ if (hasRequiredFunctionBind) return functionBind;
15354
+ hasRequiredFunctionBind = 1;
15355
+
15356
+ var implementation = requireImplementation();
15357
+
15358
+ functionBind = Function.prototype.bind || implementation;
15359
+ return functionBind;
15360
+ }
15361
+
15362
+ var functionCall;
15363
+ var hasRequiredFunctionCall;
15364
+
15365
+ function requireFunctionCall () {
15366
+ if (hasRequiredFunctionCall) return functionCall;
15367
+ hasRequiredFunctionCall = 1;
15368
+
15369
+ /** @type {import('./functionCall')} */
15370
+ functionCall = Function.prototype.call;
15371
+ return functionCall;
15372
+ }
15373
+
15374
+ var functionApply;
15375
+ var hasRequiredFunctionApply;
15376
+
15377
+ function requireFunctionApply () {
15378
+ if (hasRequiredFunctionApply) return functionApply;
15379
+ hasRequiredFunctionApply = 1;
15380
+
15381
+ /** @type {import('./functionApply')} */
15382
+ functionApply = Function.prototype.apply;
15383
+ return functionApply;
15384
+ }
15385
+
15386
+ var reflectApply;
15387
+ var hasRequiredReflectApply;
15388
+
15389
+ function requireReflectApply () {
15390
+ if (hasRequiredReflectApply) return reflectApply;
15391
+ hasRequiredReflectApply = 1;
15392
+
15393
+ /** @type {import('./reflectApply')} */
15394
+ reflectApply = typeof Reflect !== 'undefined' && Reflect && Reflect.apply;
15395
+ return reflectApply;
15396
+ }
15397
+
15398
+ var actualApply;
15399
+ var hasRequiredActualApply;
15400
+
15401
+ function requireActualApply () {
15402
+ if (hasRequiredActualApply) return actualApply;
15403
+ hasRequiredActualApply = 1;
15404
+
15405
+ var bind = requireFunctionBind();
15406
+
15407
+ var $apply = requireFunctionApply();
15408
+ var $call = requireFunctionCall();
15409
+ var $reflectApply = requireReflectApply();
15410
+
15411
+ /** @type {import('./actualApply')} */
15412
+ actualApply = $reflectApply || bind.call($call, $apply);
15413
+ return actualApply;
15414
+ }
15415
+
15416
+ var callBindApplyHelpers;
15417
+ var hasRequiredCallBindApplyHelpers;
15418
+
15419
+ function requireCallBindApplyHelpers () {
15420
+ if (hasRequiredCallBindApplyHelpers) return callBindApplyHelpers;
15421
+ hasRequiredCallBindApplyHelpers = 1;
15422
+
15423
+ var bind = requireFunctionBind();
15424
+ var $TypeError = /*@__PURE__*/ requireType();
15425
+
15426
+ var $call = requireFunctionCall();
15427
+ var $actualApply = requireActualApply();
15428
+
15429
+ /** @type {(args: [Function, thisArg?: unknown, ...args: unknown[]]) => Function} TODO FIXME, find a way to use import('.') */
15430
+ callBindApplyHelpers = function callBindBasic(args) {
15431
+ if (args.length < 1 || typeof args[0] !== 'function') {
15432
+ throw new $TypeError('a function is required');
15433
+ }
15434
+ return $actualApply(bind, $call, args);
15435
+ };
15436
+ return callBindApplyHelpers;
15437
+ }
15438
+
15439
+ var get;
15440
+ var hasRequiredGet;
15441
+
15442
+ function requireGet () {
15443
+ if (hasRequiredGet) return get;
15444
+ hasRequiredGet = 1;
15445
+
15446
+ var callBind = requireCallBindApplyHelpers();
15447
+ var gOPD = /*@__PURE__*/ requireGopd();
15448
+
15449
+ var hasProtoAccessor;
15450
+ try {
15451
+ // eslint-disable-next-line no-extra-parens, no-proto
15452
+ hasProtoAccessor = /** @type {{ __proto__?: typeof Array.prototype }} */ ([]).__proto__ === Array.prototype;
15453
+ } catch (e) {
15454
+ if (!e || typeof e !== 'object' || !('code' in e) || e.code !== 'ERR_PROTO_ACCESS') {
15455
+ throw e;
15456
+ }
15457
+ }
15458
+
15459
+ // eslint-disable-next-line no-extra-parens
15460
+ var desc = !!hasProtoAccessor && gOPD && gOPD(Object.prototype, /** @type {keyof typeof Object.prototype} */ ('__proto__'));
15461
+
15462
+ var $Object = Object;
15463
+ var $getPrototypeOf = $Object.getPrototypeOf;
15464
+
15465
+ /** @type {import('./get')} */
15466
+ get = desc && typeof desc.get === 'function'
15467
+ ? callBind([desc.get])
15468
+ : typeof $getPrototypeOf === 'function'
15469
+ ? /** @type {import('./get')} */ function getDunder(value) {
15470
+ // eslint-disable-next-line eqeqeq
15471
+ return $getPrototypeOf(value == null ? value : $Object(value));
15472
+ }
15473
+ : false;
15474
+ return get;
15475
+ }
15476
+
15477
+ var getProto;
15478
+ var hasRequiredGetProto;
15479
+
15480
+ function requireGetProto () {
15481
+ if (hasRequiredGetProto) return getProto;
15482
+ hasRequiredGetProto = 1;
15483
+
15484
+ var reflectGetProto = requireReflect_getPrototypeOf();
15485
+ var originalGetProto = requireObject_getPrototypeOf();
15486
+
15487
+ var getDunderProto = /*@__PURE__*/ requireGet();
15488
+
15489
+ /** @type {import('.')} */
15490
+ getProto = reflectGetProto
15491
+ ? function getProto(O) {
15492
+ // @ts-expect-error TS can't narrow inside a closure, for some reason
15493
+ return reflectGetProto(O);
15494
+ }
15495
+ : originalGetProto
15496
+ ? function getProto(O) {
15497
+ if (!O || (typeof O !== 'object' && typeof O !== 'function')) {
15498
+ throw new TypeError('getProto: not an object');
15499
+ }
15500
+ // @ts-expect-error TS can't narrow inside a closure, for some reason
15501
+ return originalGetProto(O);
15502
+ }
15503
+ : getDunderProto
15504
+ ? function getProto(O) {
15505
+ // @ts-expect-error TS can't narrow inside a closure, for some reason
15506
+ return getDunderProto(O);
15507
+ }
15508
+ : null;
15509
+ return getProto;
15510
+ }
15511
+
15512
+ var hasown;
15513
+ var hasRequiredHasown;
15514
+
15515
+ function requireHasown () {
15516
+ if (hasRequiredHasown) return hasown;
15517
+ hasRequiredHasown = 1;
15518
+
15519
+ var call = Function.prototype.call;
15520
+ var $hasOwn = Object.prototype.hasOwnProperty;
15521
+ var bind = requireFunctionBind();
15522
+
15523
+ /** @type {import('.')} */
15524
+ hasown = bind.call(call, $hasOwn);
15525
+ return hasown;
15526
+ }
15527
+
15528
+ var getIntrinsic;
15529
+ var hasRequiredGetIntrinsic;
15530
+
15531
+ function requireGetIntrinsic () {
15532
+ if (hasRequiredGetIntrinsic) return getIntrinsic;
15533
+ hasRequiredGetIntrinsic = 1;
15534
+
15535
+ var undefined$1;
15536
+
15537
+ var $Object = /*@__PURE__*/ requireEsObjectAtoms();
15538
+
15539
+ var $Error = /*@__PURE__*/ requireEsErrors();
15540
+ var $EvalError = /*@__PURE__*/ require_eval();
15541
+ var $RangeError = /*@__PURE__*/ requireRange();
15542
+ var $ReferenceError = /*@__PURE__*/ requireRef();
15543
+ var $SyntaxError = /*@__PURE__*/ requireSyntax();
15544
+ var $TypeError = /*@__PURE__*/ requireType();
15545
+ var $URIError = /*@__PURE__*/ requireUri();
15546
+
15547
+ var abs = /*@__PURE__*/ requireAbs();
15548
+ var floor = /*@__PURE__*/ requireFloor();
15549
+ var max = /*@__PURE__*/ requireMax();
15550
+ var min = /*@__PURE__*/ requireMin();
15551
+ var pow = /*@__PURE__*/ requirePow();
15552
+ var round = /*@__PURE__*/ requireRound();
15553
+ var sign = /*@__PURE__*/ requireSign();
15554
+
15555
+ var $Function = Function;
15556
+
15557
+ // eslint-disable-next-line consistent-return
15558
+ var getEvalledConstructor = function (expressionSyntax) {
15559
+ try {
15560
+ return $Function('"use strict"; return (' + expressionSyntax + ').constructor;')();
15561
+ } catch (e) {}
15562
+ };
15563
+
15564
+ var $gOPD = /*@__PURE__*/ requireGopd();
15565
+ var $defineProperty = /*@__PURE__*/ requireEsDefineProperty();
15566
+
15567
+ var throwTypeError = function () {
15568
+ throw new $TypeError();
15569
+ };
15570
+ var ThrowTypeError = $gOPD
15571
+ ? (function () {
15572
+ try {
15573
+ // eslint-disable-next-line no-unused-expressions, no-caller, no-restricted-properties
15574
+ arguments.callee; // IE 8 does not throw here
15575
+ return throwTypeError;
15576
+ } catch (calleeThrows) {
15577
+ try {
15578
+ // IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '')
15579
+ return $gOPD(arguments, 'callee').get;
15580
+ } catch (gOPDthrows) {
15581
+ return throwTypeError;
15582
+ }
15583
+ }
15584
+ }())
15585
+ : throwTypeError;
15586
+
15587
+ var hasSymbols = requireHasSymbols()();
15588
+
15589
+ var getProto = requireGetProto();
15590
+ var $ObjectGPO = requireObject_getPrototypeOf();
15591
+ var $ReflectGPO = requireReflect_getPrototypeOf();
15592
+
15593
+ var $apply = requireFunctionApply();
15594
+ var $call = requireFunctionCall();
15595
+
15596
+ var needsEval = {};
15597
+
15598
+ var TypedArray = typeof Uint8Array === 'undefined' || !getProto ? undefined$1 : getProto(Uint8Array);
15599
+
15600
+ var INTRINSICS = {
15601
+ __proto__: null,
15602
+ '%AggregateError%': typeof AggregateError === 'undefined' ? undefined$1 : AggregateError,
15603
+ '%Array%': Array,
15604
+ '%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined$1 : ArrayBuffer,
15605
+ '%ArrayIteratorPrototype%': hasSymbols && getProto ? getProto([][Symbol.iterator]()) : undefined$1,
15606
+ '%AsyncFromSyncIteratorPrototype%': undefined$1,
15607
+ '%AsyncFunction%': needsEval,
15608
+ '%AsyncGenerator%': needsEval,
15609
+ '%AsyncGeneratorFunction%': needsEval,
15610
+ '%AsyncIteratorPrototype%': needsEval,
15611
+ '%Atomics%': typeof Atomics === 'undefined' ? undefined$1 : Atomics,
15612
+ '%BigInt%': typeof BigInt === 'undefined' ? undefined$1 : BigInt,
15613
+ '%BigInt64Array%': typeof BigInt64Array === 'undefined' ? undefined$1 : BigInt64Array,
15614
+ '%BigUint64Array%': typeof BigUint64Array === 'undefined' ? undefined$1 : BigUint64Array,
15615
+ '%Boolean%': Boolean,
15616
+ '%DataView%': typeof DataView === 'undefined' ? undefined$1 : DataView,
15617
+ '%Date%': Date,
15618
+ '%decodeURI%': decodeURI,
15619
+ '%decodeURIComponent%': decodeURIComponent,
15620
+ '%encodeURI%': encodeURI,
15621
+ '%encodeURIComponent%': encodeURIComponent,
15622
+ '%Error%': $Error,
15623
+ '%eval%': eval, // eslint-disable-line no-eval
15624
+ '%EvalError%': $EvalError,
15625
+ '%Float16Array%': typeof Float16Array === 'undefined' ? undefined$1 : Float16Array,
15626
+ '%Float32Array%': typeof Float32Array === 'undefined' ? undefined$1 : Float32Array,
15627
+ '%Float64Array%': typeof Float64Array === 'undefined' ? undefined$1 : Float64Array,
15628
+ '%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined$1 : FinalizationRegistry,
15629
+ '%Function%': $Function,
15630
+ '%GeneratorFunction%': needsEval,
15631
+ '%Int8Array%': typeof Int8Array === 'undefined' ? undefined$1 : Int8Array,
15632
+ '%Int16Array%': typeof Int16Array === 'undefined' ? undefined$1 : Int16Array,
15633
+ '%Int32Array%': typeof Int32Array === 'undefined' ? undefined$1 : Int32Array,
15634
+ '%isFinite%': isFinite,
15635
+ '%isNaN%': isNaN,
15636
+ '%IteratorPrototype%': hasSymbols && getProto ? getProto(getProto([][Symbol.iterator]())) : undefined$1,
15637
+ '%JSON%': typeof JSON === 'object' ? JSON : undefined$1,
15638
+ '%Map%': typeof Map === 'undefined' ? undefined$1 : Map,
15639
+ '%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols || !getProto ? undefined$1 : getProto(new Map()[Symbol.iterator]()),
15640
+ '%Math%': Math,
15641
+ '%Number%': Number,
15642
+ '%Object%': $Object,
15643
+ '%Object.getOwnPropertyDescriptor%': $gOPD,
15644
+ '%parseFloat%': parseFloat,
15645
+ '%parseInt%': parseInt,
15646
+ '%Promise%': typeof Promise === 'undefined' ? undefined$1 : Promise,
15647
+ '%Proxy%': typeof Proxy === 'undefined' ? undefined$1 : Proxy,
15648
+ '%RangeError%': $RangeError,
15649
+ '%ReferenceError%': $ReferenceError,
15650
+ '%Reflect%': typeof Reflect === 'undefined' ? undefined$1 : Reflect,
15651
+ '%RegExp%': RegExp,
15652
+ '%Set%': typeof Set === 'undefined' ? undefined$1 : Set,
15653
+ '%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols || !getProto ? undefined$1 : getProto(new Set()[Symbol.iterator]()),
15654
+ '%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined$1 : SharedArrayBuffer,
15655
+ '%String%': String,
15656
+ '%StringIteratorPrototype%': hasSymbols && getProto ? getProto(''[Symbol.iterator]()) : undefined$1,
15657
+ '%Symbol%': hasSymbols ? Symbol : undefined$1,
15658
+ '%SyntaxError%': $SyntaxError,
15659
+ '%ThrowTypeError%': ThrowTypeError,
15660
+ '%TypedArray%': TypedArray,
15661
+ '%TypeError%': $TypeError,
15662
+ '%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined$1 : Uint8Array,
15663
+ '%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined$1 : Uint8ClampedArray,
15664
+ '%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined$1 : Uint16Array,
15665
+ '%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined$1 : Uint32Array,
15666
+ '%URIError%': $URIError,
15667
+ '%WeakMap%': typeof WeakMap === 'undefined' ? undefined$1 : WeakMap,
15668
+ '%WeakRef%': typeof WeakRef === 'undefined' ? undefined$1 : WeakRef,
15669
+ '%WeakSet%': typeof WeakSet === 'undefined' ? undefined$1 : WeakSet,
15670
+
15671
+ '%Function.prototype.call%': $call,
15672
+ '%Function.prototype.apply%': $apply,
15673
+ '%Object.defineProperty%': $defineProperty,
15674
+ '%Object.getPrototypeOf%': $ObjectGPO,
15675
+ '%Math.abs%': abs,
15676
+ '%Math.floor%': floor,
15677
+ '%Math.max%': max,
15678
+ '%Math.min%': min,
15679
+ '%Math.pow%': pow,
15680
+ '%Math.round%': round,
15681
+ '%Math.sign%': sign,
15682
+ '%Reflect.getPrototypeOf%': $ReflectGPO
15683
+ };
15684
+
15685
+ if (getProto) {
15686
+ try {
15687
+ null.error; // eslint-disable-line no-unused-expressions
15688
+ } catch (e) {
15689
+ // https://github.com/tc39/proposal-shadowrealm/pull/384#issuecomment-1364264229
15690
+ var errorProto = getProto(getProto(e));
15691
+ INTRINSICS['%Error.prototype%'] = errorProto;
15692
+ }
15693
+ }
15694
+
15695
+ var doEval = function doEval(name) {
15696
+ var value;
15697
+ if (name === '%AsyncFunction%') {
15698
+ value = getEvalledConstructor('async function () {}');
15699
+ } else if (name === '%GeneratorFunction%') {
15700
+ value = getEvalledConstructor('function* () {}');
15701
+ } else if (name === '%AsyncGeneratorFunction%') {
15702
+ value = getEvalledConstructor('async function* () {}');
15703
+ } else if (name === '%AsyncGenerator%') {
15704
+ var fn = doEval('%AsyncGeneratorFunction%');
15705
+ if (fn) {
15706
+ value = fn.prototype;
15707
+ }
15708
+ } else if (name === '%AsyncIteratorPrototype%') {
15709
+ var gen = doEval('%AsyncGenerator%');
15710
+ if (gen && getProto) {
15711
+ value = getProto(gen.prototype);
15712
+ }
15713
+ }
15714
+
15715
+ INTRINSICS[name] = value;
15716
+
15717
+ return value;
15718
+ };
15719
+
15720
+ var LEGACY_ALIASES = {
15721
+ __proto__: null,
15722
+ '%ArrayBufferPrototype%': ['ArrayBuffer', 'prototype'],
15723
+ '%ArrayPrototype%': ['Array', 'prototype'],
15724
+ '%ArrayProto_entries%': ['Array', 'prototype', 'entries'],
15725
+ '%ArrayProto_forEach%': ['Array', 'prototype', 'forEach'],
15726
+ '%ArrayProto_keys%': ['Array', 'prototype', 'keys'],
15727
+ '%ArrayProto_values%': ['Array', 'prototype', 'values'],
15728
+ '%AsyncFunctionPrototype%': ['AsyncFunction', 'prototype'],
15729
+ '%AsyncGenerator%': ['AsyncGeneratorFunction', 'prototype'],
15730
+ '%AsyncGeneratorPrototype%': ['AsyncGeneratorFunction', 'prototype', 'prototype'],
15731
+ '%BooleanPrototype%': ['Boolean', 'prototype'],
15732
+ '%DataViewPrototype%': ['DataView', 'prototype'],
15733
+ '%DatePrototype%': ['Date', 'prototype'],
15734
+ '%ErrorPrototype%': ['Error', 'prototype'],
15735
+ '%EvalErrorPrototype%': ['EvalError', 'prototype'],
15736
+ '%Float32ArrayPrototype%': ['Float32Array', 'prototype'],
15737
+ '%Float64ArrayPrototype%': ['Float64Array', 'prototype'],
15738
+ '%FunctionPrototype%': ['Function', 'prototype'],
15739
+ '%Generator%': ['GeneratorFunction', 'prototype'],
15740
+ '%GeneratorPrototype%': ['GeneratorFunction', 'prototype', 'prototype'],
15741
+ '%Int8ArrayPrototype%': ['Int8Array', 'prototype'],
15742
+ '%Int16ArrayPrototype%': ['Int16Array', 'prototype'],
15743
+ '%Int32ArrayPrototype%': ['Int32Array', 'prototype'],
15744
+ '%JSONParse%': ['JSON', 'parse'],
15745
+ '%JSONStringify%': ['JSON', 'stringify'],
15746
+ '%MapPrototype%': ['Map', 'prototype'],
15747
+ '%NumberPrototype%': ['Number', 'prototype'],
15748
+ '%ObjectPrototype%': ['Object', 'prototype'],
15749
+ '%ObjProto_toString%': ['Object', 'prototype', 'toString'],
15750
+ '%ObjProto_valueOf%': ['Object', 'prototype', 'valueOf'],
15751
+ '%PromisePrototype%': ['Promise', 'prototype'],
15752
+ '%PromiseProto_then%': ['Promise', 'prototype', 'then'],
15753
+ '%Promise_all%': ['Promise', 'all'],
15754
+ '%Promise_reject%': ['Promise', 'reject'],
15755
+ '%Promise_resolve%': ['Promise', 'resolve'],
15756
+ '%RangeErrorPrototype%': ['RangeError', 'prototype'],
15757
+ '%ReferenceErrorPrototype%': ['ReferenceError', 'prototype'],
15758
+ '%RegExpPrototype%': ['RegExp', 'prototype'],
15759
+ '%SetPrototype%': ['Set', 'prototype'],
15760
+ '%SharedArrayBufferPrototype%': ['SharedArrayBuffer', 'prototype'],
15761
+ '%StringPrototype%': ['String', 'prototype'],
15762
+ '%SymbolPrototype%': ['Symbol', 'prototype'],
15763
+ '%SyntaxErrorPrototype%': ['SyntaxError', 'prototype'],
15764
+ '%TypedArrayPrototype%': ['TypedArray', 'prototype'],
15765
+ '%TypeErrorPrototype%': ['TypeError', 'prototype'],
15766
+ '%Uint8ArrayPrototype%': ['Uint8Array', 'prototype'],
15767
+ '%Uint8ClampedArrayPrototype%': ['Uint8ClampedArray', 'prototype'],
15768
+ '%Uint16ArrayPrototype%': ['Uint16Array', 'prototype'],
15769
+ '%Uint32ArrayPrototype%': ['Uint32Array', 'prototype'],
15770
+ '%URIErrorPrototype%': ['URIError', 'prototype'],
15771
+ '%WeakMapPrototype%': ['WeakMap', 'prototype'],
15772
+ '%WeakSetPrototype%': ['WeakSet', 'prototype']
15773
+ };
15774
+
15775
+ var bind = requireFunctionBind();
15776
+ var hasOwn = /*@__PURE__*/ requireHasown();
15777
+ var $concat = bind.call($call, Array.prototype.concat);
15778
+ var $spliceApply = bind.call($apply, Array.prototype.splice);
15779
+ var $replace = bind.call($call, String.prototype.replace);
15780
+ var $strSlice = bind.call($call, String.prototype.slice);
15781
+ var $exec = bind.call($call, RegExp.prototype.exec);
15782
+
15783
+ /* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */
15784
+ var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
15785
+ var reEscapeChar = /\\(\\)?/g; /** Used to match backslashes in property paths. */
15786
+ var stringToPath = function stringToPath(string) {
15787
+ var first = $strSlice(string, 0, 1);
15788
+ var last = $strSlice(string, -1);
15789
+ if (first === '%' && last !== '%') {
15790
+ throw new $SyntaxError('invalid intrinsic syntax, expected closing `%`');
15791
+ } else if (last === '%' && first !== '%') {
15792
+ throw new $SyntaxError('invalid intrinsic syntax, expected opening `%`');
15793
+ }
15794
+ var result = [];
15795
+ $replace(string, rePropName, function (match, number, quote, subString) {
15796
+ result[result.length] = quote ? $replace(subString, reEscapeChar, '$1') : number || match;
15797
+ });
15798
+ return result;
15799
+ };
15800
+ /* end adaptation */
15801
+
15802
+ var getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) {
15803
+ var intrinsicName = name;
15804
+ var alias;
15805
+ if (hasOwn(LEGACY_ALIASES, intrinsicName)) {
15806
+ alias = LEGACY_ALIASES[intrinsicName];
15807
+ intrinsicName = '%' + alias[0] + '%';
15808
+ }
15809
+
15810
+ if (hasOwn(INTRINSICS, intrinsicName)) {
15811
+ var value = INTRINSICS[intrinsicName];
15812
+ if (value === needsEval) {
15813
+ value = doEval(intrinsicName);
15814
+ }
15815
+ if (typeof value === 'undefined' && !allowMissing) {
15816
+ throw new $TypeError('intrinsic ' + name + ' exists, but is not available. Please file an issue!');
15817
+ }
15818
+
15819
+ return {
15820
+ alias: alias,
15821
+ name: intrinsicName,
15822
+ value: value
15823
+ };
15824
+ }
15825
+
15826
+ throw new $SyntaxError('intrinsic ' + name + ' does not exist!');
15827
+ };
15828
+
15829
+ getIntrinsic = function GetIntrinsic(name, allowMissing) {
15830
+ if (typeof name !== 'string' || name.length === 0) {
15831
+ throw new $TypeError('intrinsic name must be a non-empty string');
15832
+ }
15833
+ if (arguments.length > 1 && typeof allowMissing !== 'boolean') {
15834
+ throw new $TypeError('"allowMissing" argument must be a boolean');
15835
+ }
15836
+
15837
+ if ($exec(/^%?[^%]*%?$/, name) === null) {
15838
+ throw new $SyntaxError('`%` may not be present anywhere but at the beginning and end of the intrinsic name');
15839
+ }
15840
+ var parts = stringToPath(name);
15841
+ var intrinsicBaseName = parts.length > 0 ? parts[0] : '';
15842
+
15843
+ var intrinsic = getBaseIntrinsic('%' + intrinsicBaseName + '%', allowMissing);
15844
+ var intrinsicRealName = intrinsic.name;
15845
+ var value = intrinsic.value;
15846
+ var skipFurtherCaching = false;
15847
+
15848
+ var alias = intrinsic.alias;
15849
+ if (alias) {
15850
+ intrinsicBaseName = alias[0];
15851
+ $spliceApply(parts, $concat([0, 1], alias));
15852
+ }
15853
+
15854
+ for (var i = 1, isOwn = true; i < parts.length; i += 1) {
15855
+ var part = parts[i];
15856
+ var first = $strSlice(part, 0, 1);
15857
+ var last = $strSlice(part, -1);
15858
+ if (
15859
+ (
15860
+ (first === '"' || first === "'" || first === '`')
15861
+ || (last === '"' || last === "'" || last === '`')
15862
+ )
15863
+ && first !== last
15864
+ ) {
15865
+ throw new $SyntaxError('property names with quotes must have matching quotes');
15866
+ }
15867
+ if (part === 'constructor' || !isOwn) {
15868
+ skipFurtherCaching = true;
15869
+ }
15870
+
15871
+ intrinsicBaseName += '.' + part;
15872
+ intrinsicRealName = '%' + intrinsicBaseName + '%';
15873
+
15874
+ if (hasOwn(INTRINSICS, intrinsicRealName)) {
15875
+ value = INTRINSICS[intrinsicRealName];
15876
+ } else if (value != null) {
15877
+ if (!(part in value)) {
15878
+ if (!allowMissing) {
15879
+ throw new $TypeError('base intrinsic for ' + name + ' exists, but the property is not available.');
15880
+ }
15881
+ return void 0;
15882
+ }
15883
+ if ($gOPD && (i + 1) >= parts.length) {
15884
+ var desc = $gOPD(value, part);
15885
+ isOwn = !!desc;
15886
+
15887
+ // By convention, when a data property is converted to an accessor
15888
+ // property to emulate a data property that does not suffer from
15889
+ // the override mistake, that accessor's getter is marked with
15890
+ // an `originalValue` property. Here, when we detect this, we
15891
+ // uphold the illusion by pretending to see that original data
15892
+ // property, i.e., returning the value rather than the getter
15893
+ // itself.
15894
+ if (isOwn && 'get' in desc && !('originalValue' in desc.get)) {
15895
+ value = desc.get;
15896
+ } else {
15897
+ value = value[part];
15898
+ }
15899
+ } else {
15900
+ isOwn = hasOwn(value, part);
15901
+ value = value[part];
15902
+ }
15903
+
15904
+ if (isOwn && !skipFurtherCaching) {
15905
+ INTRINSICS[intrinsicRealName] = value;
15906
+ }
15907
+ }
15908
+ }
15909
+ return value;
15910
+ };
15911
+ return getIntrinsic;
15912
+ }
15913
+
15914
+ var shams;
15915
+ var hasRequiredShams;
15916
+
15917
+ function requireShams () {
15918
+ if (hasRequiredShams) return shams;
15919
+ hasRequiredShams = 1;
15920
+
15921
+ var hasSymbols = requireShams$1();
15922
+
15923
+ /** @type {import('.')} */
15924
+ shams = function hasToStringTagShams() {
15925
+ return hasSymbols() && !!Symbol.toStringTag;
15926
+ };
15927
+ return shams;
15928
+ }
15929
+
15930
+ var esSetTostringtag;
15931
+ var hasRequiredEsSetTostringtag;
15932
+
15933
+ function requireEsSetTostringtag () {
15934
+ if (hasRequiredEsSetTostringtag) return esSetTostringtag;
15935
+ hasRequiredEsSetTostringtag = 1;
15936
+
15937
+ var GetIntrinsic = /*@__PURE__*/ requireGetIntrinsic();
15938
+
15939
+ var $defineProperty = GetIntrinsic('%Object.defineProperty%', true);
15940
+
15941
+ var hasToStringTag = requireShams()();
15942
+ var hasOwn = /*@__PURE__*/ requireHasown();
15943
+ var $TypeError = /*@__PURE__*/ requireType();
15944
+
15945
+ var toStringTag = hasToStringTag ? Symbol.toStringTag : null;
15946
+
15947
+ /** @type {import('.')} */
15948
+ esSetTostringtag = function setToStringTag(object, value) {
15949
+ var overrideIfSet = arguments.length > 2 && !!arguments[2] && arguments[2].force;
15950
+ var nonConfigurable = arguments.length > 2 && !!arguments[2] && arguments[2].nonConfigurable;
15951
+ if (
15952
+ (typeof overrideIfSet !== 'undefined' && typeof overrideIfSet !== 'boolean')
15953
+ || (typeof nonConfigurable !== 'undefined' && typeof nonConfigurable !== 'boolean')
15954
+ ) {
15955
+ throw new $TypeError('if provided, the `overrideIfSet` and `nonConfigurable` options must be booleans');
15956
+ }
15957
+ if (toStringTag && (overrideIfSet || !hasOwn(object, toStringTag))) {
15958
+ if ($defineProperty) {
15959
+ $defineProperty(object, toStringTag, {
15960
+ configurable: !nonConfigurable,
15961
+ enumerable: false,
15962
+ value: value,
15963
+ writable: false
15964
+ });
15965
+ } else {
15966
+ object[toStringTag] = value; // eslint-disable-line no-param-reassign
15967
+ }
15968
+ }
15969
+ };
15970
+ return esSetTostringtag;
15971
+ }
15972
+
14825
15973
  var populate;
14826
15974
  var hasRequiredPopulate;
14827
15975
 
@@ -14857,6 +16005,7 @@ function requireForm_data () {
14857
16005
  var Stream$1 = Stream.Stream;
14858
16006
  var mime = requireMimeTypes();
14859
16007
  var asynckit = requireAsynckit();
16008
+ var setToStringTag = /*@__PURE__*/ requireEsSetTostringtag();
14860
16009
  var populate = requirePopulate();
14861
16010
 
14862
16011
  // Public API
@@ -14951,7 +16100,7 @@ function requireForm_data () {
14951
16100
  FormData.LINE_BREAK.length;
14952
16101
 
14953
16102
  // empty or either doesn't have path or not an http response or not a stream
14954
- if (!value || ( !value.path && !(value.readable && value.hasOwnProperty('httpVersion')) && !(value instanceof Stream$1))) {
16103
+ if (!value || ( !value.path && !(value.readable && Object.prototype.hasOwnProperty.call(value, 'httpVersion')) && !(value instanceof Stream$1))) {
14955
16104
  return;
14956
16105
  }
14957
16106
 
@@ -14962,8 +16111,7 @@ function requireForm_data () {
14962
16111
  };
14963
16112
 
14964
16113
  FormData.prototype._lengthRetriever = function(value, callback) {
14965
-
14966
- if (value.hasOwnProperty('fd')) {
16114
+ if (Object.prototype.hasOwnProperty.call(value, 'fd')) {
14967
16115
 
14968
16116
  // take read range into a account
14969
16117
  // `end` = Infinity –> read file till the end
@@ -14998,11 +16146,11 @@ function requireForm_data () {
14998
16146
  }
14999
16147
 
15000
16148
  // or http response
15001
- } else if (value.hasOwnProperty('httpVersion')) {
16149
+ } else if (Object.prototype.hasOwnProperty.call(value, 'httpVersion')) {
15002
16150
  callback(null, +value.headers['content-length']);
15003
16151
 
15004
16152
  // or request stream http://github.com/mikeal/request
15005
- } else if (value.hasOwnProperty('httpModule')) {
16153
+ } else if (Object.prototype.hasOwnProperty.call(value, 'httpModule')) {
15006
16154
  // wait till response come back
15007
16155
  value.on('response', function(response) {
15008
16156
  value.pause();
@@ -15042,22 +16190,23 @@ function requireForm_data () {
15042
16190
 
15043
16191
  var header;
15044
16192
  for (var prop in headers) {
15045
- if (!headers.hasOwnProperty(prop)) continue;
15046
- header = headers[prop];
16193
+ if (Object.prototype.hasOwnProperty.call(headers, prop)) {
16194
+ header = headers[prop];
15047
16195
 
15048
- // skip nullish headers.
15049
- if (header == null) {
15050
- continue;
15051
- }
16196
+ // skip nullish headers.
16197
+ if (header == null) {
16198
+ continue;
16199
+ }
15052
16200
 
15053
- // convert all headers to arrays.
15054
- if (!Array.isArray(header)) {
15055
- header = [header];
15056
- }
16201
+ // convert all headers to arrays.
16202
+ if (!Array.isArray(header)) {
16203
+ header = [header];
16204
+ }
15057
16205
 
15058
- // add non-empty headers.
15059
- if (header.length) {
15060
- contents += prop + ': ' + header.join('; ') + FormData.LINE_BREAK;
16206
+ // add non-empty headers.
16207
+ if (header.length) {
16208
+ contents += prop + ': ' + header.join('; ') + FormData.LINE_BREAK;
16209
+ }
15061
16210
  }
15062
16211
  }
15063
16212
 
@@ -15078,7 +16227,7 @@ function requireForm_data () {
15078
16227
  // formidable and the browser add a name property
15079
16228
  // fs- and request- streams have path property
15080
16229
  filename = path.basename(options.filename || value.name || value.path);
15081
- } else if (value.readable && value.hasOwnProperty('httpVersion')) {
16230
+ } else if (value.readable && Object.prototype.hasOwnProperty.call(value, 'httpVersion')) {
15082
16231
  // or try http response
15083
16232
  filename = path.basename(value.client._httpMessage.path || '');
15084
16233
  }
@@ -15106,7 +16255,7 @@ function requireForm_data () {
15106
16255
  }
15107
16256
 
15108
16257
  // or if it's http-reponse
15109
- if (!contentType && value.readable && value.hasOwnProperty('httpVersion')) {
16258
+ if (!contentType && value.readable && Object.prototype.hasOwnProperty.call(value, 'httpVersion')) {
15110
16259
  contentType = value.headers['content-type'];
15111
16260
  }
15112
16261
 
@@ -15147,7 +16296,7 @@ function requireForm_data () {
15147
16296
  };
15148
16297
 
15149
16298
  for (header in userHeaders) {
15150
- if (userHeaders.hasOwnProperty(header)) {
16299
+ if (Object.prototype.hasOwnProperty.call(userHeaders, header)) {
15151
16300
  formHeaders[header.toLowerCase()] = userHeaders[header];
15152
16301
  }
15153
16302
  }
@@ -15168,7 +16317,7 @@ function requireForm_data () {
15168
16317
  };
15169
16318
 
15170
16319
  FormData.prototype.getBuffer = function() {
15171
- var dataBuffer = new Buffer$1.alloc( 0 );
16320
+ var dataBuffer = new Buffer$1.alloc(0);
15172
16321
  var boundary = this.getBoundary();
15173
16322
 
15174
16323
  // Create the form content. Add Line breaks to the end of data.
@@ -15348,6 +16497,7 @@ function requireForm_data () {
15348
16497
  FormData.prototype.toString = function () {
15349
16498
  return '[object FormData]';
15350
16499
  };
16500
+ setToStringTag(FormData, 'FormData');
15351
16501
  return form_data;
15352
16502
  }
15353
16503
 
@@ -15432,7 +16582,7 @@ const predicates = utils$4.toFlatObject(utils$4, {}, null, function filter(prop)
15432
16582
  *
15433
16583
  * @returns
15434
16584
  */
15435
- function toFormData(obj, formData, options) {
16585
+ function toFormData$1(obj, formData, options) {
15436
16586
  if (!utils$4.isObject(obj)) {
15437
16587
  throw new TypeError('target must be an object');
15438
16588
  }
@@ -15470,7 +16620,7 @@ function toFormData(obj, formData, options) {
15470
16620
  }
15471
16621
 
15472
16622
  if (!useBlob && utils$4.isBlob(value)) {
15473
- throw new AxiosError('Blob is not supported. Use a Buffer instead.');
16623
+ throw new AxiosError$1('Blob is not supported. Use a Buffer instead.');
15474
16624
  }
15475
16625
 
15476
16626
  if (utils$4.isArrayBuffer(value) || utils$4.isTypedArray(value)) {
@@ -15599,7 +16749,7 @@ function encode$1(str) {
15599
16749
  function AxiosURLSearchParams(params, options) {
15600
16750
  this._pairs = [];
15601
16751
 
15602
- params && toFormData(params, this, options);
16752
+ params && toFormData$1(params, this, options);
15603
16753
  }
15604
16754
 
15605
16755
  const prototype = AxiosURLSearchParams.prototype;
@@ -15757,6 +16907,29 @@ var transitionalDefaults = {
15757
16907
 
15758
16908
  var URLSearchParams = Url.URLSearchParams;
15759
16909
 
16910
+ const ALPHA = 'abcdefghijklmnopqrstuvwxyz';
16911
+
16912
+ const DIGIT = '0123456789';
16913
+
16914
+ const ALPHABET = {
16915
+ DIGIT,
16916
+ ALPHA,
16917
+ ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT
16918
+ };
16919
+
16920
+ const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {
16921
+ let str = '';
16922
+ const {length} = alphabet;
16923
+ const randomValues = new Uint32Array(size);
16924
+ crypto$2.randomFillSync(randomValues);
16925
+ for (let i = 0; i < size; i++) {
16926
+ str += alphabet[randomValues[i] % length];
16927
+ }
16928
+
16929
+ return str;
16930
+ };
16931
+
16932
+
15760
16933
  var platform$1 = {
15761
16934
  isNode: true,
15762
16935
  classes: {
@@ -15764,6 +16937,8 @@ var platform$1 = {
15764
16937
  FormData: FormData$1,
15765
16938
  Blob: typeof Blob !== 'undefined' && Blob || null
15766
16939
  },
16940
+ ALPHABET,
16941
+ generateString,
15767
16942
  protocols: [ 'http', 'https', 'file', 'data' ]
15768
16943
  };
15769
16944
 
@@ -15826,7 +17001,7 @@ var platform = {
15826
17001
  };
15827
17002
 
15828
17003
  function toURLEncodedForm(data, options) {
15829
- return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({
17004
+ return toFormData$1(data, new platform.classes.URLSearchParams(), Object.assign({
15830
17005
  visitor: function(value, key, path, helpers) {
15831
17006
  if (platform.isNode && utils$4.isBuffer(value)) {
15832
17007
  this.append(key, value.toString('base64'));
@@ -15950,7 +17125,7 @@ function stringifySafely(rawValue, parser, encoder) {
15950
17125
  }
15951
17126
  }
15952
17127
 
15953
- return (0, JSON.stringify)(rawValue);
17128
+ return (encoder || JSON.stringify)(rawValue);
15954
17129
  }
15955
17130
 
15956
17131
  const defaults = {
@@ -16001,7 +17176,7 @@ const defaults = {
16001
17176
  if ((isFileList = utils$4.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
16002
17177
  const _FormData = this.env && this.env.FormData;
16003
17178
 
16004
- return toFormData(
17179
+ return toFormData$1(
16005
17180
  isFileList ? {'files[]': data} : data,
16006
17181
  _FormData && new _FormData(),
16007
17182
  this.formSerializer
@@ -16035,7 +17210,7 @@ const defaults = {
16035
17210
  } catch (e) {
16036
17211
  if (strictJSONParsing) {
16037
17212
  if (e.name === 'SyntaxError') {
16038
- throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response);
17213
+ throw AxiosError$1.from(e, AxiosError$1.ERR_BAD_RESPONSE, this, null, this.response);
16039
17214
  }
16040
17215
  throw e;
16041
17216
  }
@@ -16198,7 +17373,7 @@ function buildAccessors(obj, header) {
16198
17373
  });
16199
17374
  }
16200
17375
 
16201
- class AxiosHeaders {
17376
+ let AxiosHeaders$1 = class AxiosHeaders {
16202
17377
  constructor(headers) {
16203
17378
  headers && this.set(headers);
16204
17379
  }
@@ -16409,12 +17584,12 @@ class AxiosHeaders {
16409
17584
 
16410
17585
  return this;
16411
17586
  }
16412
- }
17587
+ };
16413
17588
 
16414
- AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);
17589
+ AxiosHeaders$1.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);
16415
17590
 
16416
17591
  // reserved names hotfix
16417
- utils$4.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => {
17592
+ utils$4.reduceDescriptors(AxiosHeaders$1.prototype, ({value}, key) => {
16418
17593
  let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
16419
17594
  return {
16420
17595
  get: () => value,
@@ -16424,7 +17599,7 @@ utils$4.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => {
16424
17599
  }
16425
17600
  });
16426
17601
 
16427
- utils$4.freezeMethods(AxiosHeaders);
17602
+ utils$4.freezeMethods(AxiosHeaders$1);
16428
17603
 
16429
17604
  /**
16430
17605
  * Transform the data for a request or a response
@@ -16437,7 +17612,7 @@ utils$4.freezeMethods(AxiosHeaders);
16437
17612
  function transformData(fns, response) {
16438
17613
  const config = this || defaults;
16439
17614
  const context = response || config;
16440
- const headers = AxiosHeaders.from(context.headers);
17615
+ const headers = AxiosHeaders$1.from(context.headers);
16441
17616
  let data = context.data;
16442
17617
 
16443
17618
  utils$4.forEach(fns, function transform(fn) {
@@ -16449,7 +17624,7 @@ function transformData(fns, response) {
16449
17624
  return data;
16450
17625
  }
16451
17626
 
16452
- function isCancel(value) {
17627
+ function isCancel$1(value) {
16453
17628
  return !!(value && value.__CANCEL__);
16454
17629
  }
16455
17630
 
@@ -16462,13 +17637,13 @@ function isCancel(value) {
16462
17637
  *
16463
17638
  * @returns {CanceledError} The created error.
16464
17639
  */
16465
- function CanceledError(message, config, request) {
17640
+ function CanceledError$1(message, config, request) {
16466
17641
  // eslint-disable-next-line no-eq-null,eqeqeq
16467
- AxiosError.call(this, message == null ? 'canceled' : message, AxiosError.ERR_CANCELED, config, request);
17642
+ AxiosError$1.call(this, message == null ? 'canceled' : message, AxiosError$1.ERR_CANCELED, config, request);
16468
17643
  this.name = 'CanceledError';
16469
17644
  }
16470
17645
 
16471
- utils$4.inherits(CanceledError, AxiosError, {
17646
+ utils$4.inherits(CanceledError$1, AxiosError$1, {
16472
17647
  __CANCEL__: true
16473
17648
  });
16474
17649
 
@@ -16486,9 +17661,9 @@ function settle(resolve, reject, response) {
16486
17661
  if (!response.status || !validateStatus || validateStatus(response.status)) {
16487
17662
  resolve(response);
16488
17663
  } else {
16489
- reject(new AxiosError(
17664
+ reject(new AxiosError$1(
16490
17665
  'Request failed with status code ' + response.status,
16491
- [AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
17666
+ [AxiosError$1.ERR_BAD_REQUEST, AxiosError$1.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
16492
17667
  response.config,
16493
17668
  response.request,
16494
17669
  response
@@ -16534,8 +17709,9 @@ function combineURLs(baseURL, relativeURL) {
16534
17709
  *
16535
17710
  * @returns {string} The combined full path
16536
17711
  */
16537
- function buildFullPath(baseURL, requestedURL) {
16538
- if (baseURL && !isAbsoluteURL(requestedURL)) {
17712
+ function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
17713
+ let isRelativeUrl = !isAbsoluteURL(requestedURL);
17714
+ if (baseURL && isRelativeUrl || allowAbsoluteUrls == false) {
16539
17715
  return combineURLs(baseURL, requestedURL);
16540
17716
  }
16541
17717
  return requestedURL;
@@ -18152,7 +19328,7 @@ function requireFollowRedirects () {
18152
19328
  var followRedirectsExports = requireFollowRedirects();
18153
19329
  var followRedirects = /*@__PURE__*/getDefaultExportFromCjs(followRedirectsExports);
18154
19330
 
18155
- const VERSION = "1.7.9";
19331
+ const VERSION$1 = "1.8.2";
18156
19332
 
18157
19333
  function parseProtocol(url) {
18158
19334
  const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
@@ -18172,7 +19348,7 @@ const DATA_URL_PATTERN = /^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;
18172
19348
  * @returns {Buffer|Blob}
18173
19349
  */
18174
19350
  function fromDataURI(uri, asBlob, options) {
18175
- const _Blob = options.Blob || platform.classes.Blob;
19351
+ const _Blob = options && options.Blob || platform.classes.Blob;
18176
19352
  const protocol = parseProtocol(uri);
18177
19353
 
18178
19354
  if (asBlob === undefined && _Blob) {
@@ -18185,7 +19361,7 @@ function fromDataURI(uri, asBlob, options) {
18185
19361
  const match = DATA_URL_PATTERN.exec(uri);
18186
19362
 
18187
19363
  if (!match) {
18188
- throw new AxiosError('Invalid URL', AxiosError.ERR_INVALID_URL);
19364
+ throw new AxiosError$1('Invalid URL', AxiosError$1.ERR_INVALID_URL);
18189
19365
  }
18190
19366
 
18191
19367
  const mime = match[1];
@@ -18195,7 +19371,7 @@ function fromDataURI(uri, asBlob, options) {
18195
19371
 
18196
19372
  if (asBlob) {
18197
19373
  if (!_Blob) {
18198
- throw new AxiosError('Blob is not supported', AxiosError.ERR_NOT_SUPPORT);
19374
+ throw new AxiosError$1('Blob is not supported', AxiosError$1.ERR_NOT_SUPPORT);
18199
19375
  }
18200
19376
 
18201
19377
  return new _Blob([buffer], {type: mime});
@@ -18204,7 +19380,7 @@ function fromDataURI(uri, asBlob, options) {
18204
19380
  return buffer;
18205
19381
  }
18206
19382
 
18207
- throw new AxiosError('Unsupported protocol ' + protocol, AxiosError.ERR_NOT_SUPPORT);
19383
+ throw new AxiosError$1('Unsupported protocol ' + protocol, AxiosError$1.ERR_NOT_SUPPORT);
18208
19384
  }
18209
19385
 
18210
19386
  const kInternals = Symbol('internals');
@@ -18358,9 +19534,9 @@ const readBlob = async function* (blob) {
18358
19534
  }
18359
19535
  };
18360
19536
 
18361
- const BOUNDARY_ALPHABET = utils$4.ALPHABET.ALPHA_DIGIT + '-_';
19537
+ const BOUNDARY_ALPHABET = platform.ALPHABET.ALPHA_DIGIT + '-_';
18362
19538
 
18363
- const textEncoder = typeof TextEncoder === 'function' ? new TextEncoder() : new require$$1$1.TextEncoder();
19539
+ const textEncoder = typeof TextEncoder === 'function' ? new TextEncoder() : new util$1.TextEncoder();
18364
19540
 
18365
19541
  const CRLF = '\r\n';
18366
19542
  const CRLF_BYTES = textEncoder.encode(CRLF);
@@ -18418,8 +19594,8 @@ const formDataToStream = (form, headersHandler, options) => {
18418
19594
  const {
18419
19595
  tag = 'form-data-boundary',
18420
19596
  size = 25,
18421
- boundary = tag + '-' + utils$4.generateString(size, BOUNDARY_ALPHABET)
18422
- } = options;
19597
+ boundary = tag + '-' + platform.generateString(size, BOUNDARY_ALPHABET)
19598
+ } = options || {};
18423
19599
 
18424
19600
  if(!utils$4.isFormData(form)) {
18425
19601
  throw TypeError('FormData instance required');
@@ -18451,7 +19627,7 @@ const formDataToStream = (form, headersHandler, options) => {
18451
19627
  computedHeaders['Content-Length'] = contentLength;
18452
19628
  }
18453
19629
 
18454
- headersHandler(computedHeaders);
19630
+ headersHandler && headersHandler(computedHeaders);
18455
19631
 
18456
19632
  return Stream.Readable.from((async function *() {
18457
19633
  for(const part of parts) {
@@ -18824,7 +20000,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
18824
20000
  });
18825
20001
 
18826
20002
  function abort(reason) {
18827
- emitter.emit('abort', !reason || reason.type ? new CanceledError(null, config, req) : reason);
20003
+ emitter.emit('abort', !reason || reason.type ? new CanceledError$1(null, config, req) : reason);
18828
20004
  }
18829
20005
 
18830
20006
  emitter.once('abort', reject);
@@ -18837,7 +20013,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
18837
20013
  }
18838
20014
 
18839
20015
  // Parse url
18840
- const fullPath = buildFullPath(config.baseURL, config.url);
20016
+ const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
18841
20017
  const parsed = new URL(fullPath, platform.hasBrowserEnv ? platform.origin : undefined);
18842
20018
  const protocol = parsed.protocol || supportedProtocols[0];
18843
20019
 
@@ -18858,7 +20034,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
18858
20034
  Blob: config.env && config.env.Blob
18859
20035
  });
18860
20036
  } catch (err) {
18861
- throw AxiosError.from(err, AxiosError.ERR_BAD_REQUEST, config);
20037
+ throw AxiosError$1.from(err, AxiosError$1.ERR_BAD_REQUEST, config);
18862
20038
  }
18863
20039
 
18864
20040
  if (responseType === 'text') {
@@ -18875,26 +20051,26 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
18875
20051
  data: convertedData,
18876
20052
  status: 200,
18877
20053
  statusText: 'OK',
18878
- headers: new AxiosHeaders(),
20054
+ headers: new AxiosHeaders$1(),
18879
20055
  config
18880
20056
  });
18881
20057
  }
18882
20058
 
18883
20059
  if (supportedProtocols.indexOf(protocol) === -1) {
18884
- return reject(new AxiosError(
20060
+ return reject(new AxiosError$1(
18885
20061
  'Unsupported protocol ' + protocol,
18886
- AxiosError.ERR_BAD_REQUEST,
20062
+ AxiosError$1.ERR_BAD_REQUEST,
18887
20063
  config
18888
20064
  ));
18889
20065
  }
18890
20066
 
18891
- const headers = AxiosHeaders.from(config.headers).normalize();
20067
+ const headers = AxiosHeaders$1.from(config.headers).normalize();
18892
20068
 
18893
20069
  // Set User-Agent (required by some servers)
18894
20070
  // See https://github.com/axios/axios/issues/69
18895
20071
  // User-Agent is specified; handle case where no UA header is desired
18896
20072
  // Only set header if it hasn't been set in config
18897
- headers.set('User-Agent', 'axios/' + VERSION, false);
20073
+ headers.set('User-Agent', 'axios/' + VERSION$1, false);
18898
20074
 
18899
20075
  const {onUploadProgress, onDownloadProgress} = config;
18900
20076
  const maxRate = config.maxRate;
@@ -18908,7 +20084,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
18908
20084
  data = formDataToStream(data, (formHeaders) => {
18909
20085
  headers.set(formHeaders);
18910
20086
  }, {
18911
- tag: `axios-${VERSION}-boundary`,
20087
+ tag: `axios-${VERSION$1}-boundary`,
18912
20088
  boundary: userBoundary && userBoundary[1] || undefined
18913
20089
  });
18914
20090
  // support for https://www.npmjs.com/package/form-data api
@@ -18917,7 +20093,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
18917
20093
 
18918
20094
  if (!headers.hasContentLength()) {
18919
20095
  try {
18920
- const knownLength = await require$$1$1.promisify(data.getLength).call(data);
20096
+ const knownLength = await util$1.promisify(data.getLength).call(data);
18921
20097
  Number.isFinite(knownLength) && knownLength >= 0 && headers.setContentLength(knownLength);
18922
20098
  /*eslint no-empty:0*/
18923
20099
  } catch (e) {
@@ -18933,9 +20109,9 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
18933
20109
  } else if (utils$4.isString(data)) {
18934
20110
  data = Buffer$1.from(data, 'utf-8');
18935
20111
  } else {
18936
- return reject(new AxiosError(
20112
+ return reject(new AxiosError$1(
18937
20113
  'Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream',
18938
- AxiosError.ERR_BAD_REQUEST,
20114
+ AxiosError$1.ERR_BAD_REQUEST,
18939
20115
  config
18940
20116
  ));
18941
20117
  }
@@ -18944,9 +20120,9 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
18944
20120
  headers.setContentLength(data.length, false);
18945
20121
 
18946
20122
  if (config.maxBodyLength > -1 && data.length > config.maxBodyLength) {
18947
- return reject(new AxiosError(
20123
+ return reject(new AxiosError$1(
18948
20124
  'Request body larger than maxBodyLength limit',
18949
- AxiosError.ERR_BAD_REQUEST,
20125
+ AxiosError$1.ERR_BAD_REQUEST,
18950
20126
  config
18951
20127
  ));
18952
20128
  }
@@ -19144,7 +20320,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
19144
20320
  const response = {
19145
20321
  status: res.statusCode,
19146
20322
  statusText: res.statusMessage,
19147
- headers: new AxiosHeaders(res.headers),
20323
+ headers: new AxiosHeaders$1(res.headers),
19148
20324
  config,
19149
20325
  request: lastRequest
19150
20326
  };
@@ -19165,8 +20341,8 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
19165
20341
  // stream.destroy() emit aborted event before calling reject() on Node.js v16
19166
20342
  rejected = true;
19167
20343
  responseStream.destroy();
19168
- reject(new AxiosError('maxContentLength size of ' + config.maxContentLength + ' exceeded',
19169
- AxiosError.ERR_BAD_RESPONSE, config, lastRequest));
20344
+ reject(new AxiosError$1('maxContentLength size of ' + config.maxContentLength + ' exceeded',
20345
+ AxiosError$1.ERR_BAD_RESPONSE, config, lastRequest));
19170
20346
  }
19171
20347
  });
19172
20348
 
@@ -19175,9 +20351,9 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
19175
20351
  return;
19176
20352
  }
19177
20353
 
19178
- const err = new AxiosError(
20354
+ const err = new AxiosError$1(
19179
20355
  'stream has been aborted',
19180
- AxiosError.ERR_BAD_RESPONSE,
20356
+ AxiosError$1.ERR_BAD_RESPONSE,
19181
20357
  config,
19182
20358
  lastRequest
19183
20359
  );
@@ -19187,7 +20363,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
19187
20363
 
19188
20364
  responseStream.on('error', function handleStreamError(err) {
19189
20365
  if (req.destroyed) return;
19190
- reject(AxiosError.from(err, null, config, lastRequest));
20366
+ reject(AxiosError$1.from(err, null, config, lastRequest));
19191
20367
  });
19192
20368
 
19193
20369
  responseStream.on('end', function handleStreamEnd() {
@@ -19201,7 +20377,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
19201
20377
  }
19202
20378
  response.data = responseData;
19203
20379
  } catch (err) {
19204
- return reject(AxiosError.from(err, null, config, response.request, response));
20380
+ return reject(AxiosError$1.from(err, null, config, response.request, response));
19205
20381
  }
19206
20382
  settle(resolve, reject, response);
19207
20383
  });
@@ -19224,7 +20400,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
19224
20400
  req.on('error', function handleRequestError(err) {
19225
20401
  // @todo remove
19226
20402
  // if (req.aborted && err.code !== AxiosError.ERR_FR_TOO_MANY_REDIRECTS) return;
19227
- reject(AxiosError.from(err, null, config, req));
20403
+ reject(AxiosError$1.from(err, null, config, req));
19228
20404
  });
19229
20405
 
19230
20406
  // set tcp keep alive to prevent drop connection by peer
@@ -19239,9 +20415,9 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
19239
20415
  const timeout = parseInt(config.timeout, 10);
19240
20416
 
19241
20417
  if (Number.isNaN(timeout)) {
19242
- reject(new AxiosError(
20418
+ reject(new AxiosError$1(
19243
20419
  'error trying to parse `config.timeout` to int',
19244
- AxiosError.ERR_BAD_OPTION_VALUE,
20420
+ AxiosError$1.ERR_BAD_OPTION_VALUE,
19245
20421
  config,
19246
20422
  req
19247
20423
  ));
@@ -19261,9 +20437,9 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
19261
20437
  if (config.timeoutErrorMessage) {
19262
20438
  timeoutErrorMessage = config.timeoutErrorMessage;
19263
20439
  }
19264
- reject(new AxiosError(
20440
+ reject(new AxiosError$1(
19265
20441
  timeoutErrorMessage,
19266
- transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,
20442
+ transitional.clarifyTimeoutError ? AxiosError$1.ETIMEDOUT : AxiosError$1.ECONNABORTED,
19267
20443
  config,
19268
20444
  req
19269
20445
  ));
@@ -19288,7 +20464,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
19288
20464
 
19289
20465
  data.on('close', () => {
19290
20466
  if (!ended && !errored) {
19291
- abort(new CanceledError('Request stream has been aborted', config, req));
20467
+ abort(new CanceledError$1('Request stream has been aborted', config, req));
19292
20468
  }
19293
20469
  });
19294
20470
 
@@ -19351,7 +20527,7 @@ var cookies = platform.hasStandardBrowserEnv ?
19351
20527
  remove() {}
19352
20528
  };
19353
20529
 
19354
- const headersToObject = (thing) => thing instanceof AxiosHeaders ? { ...thing } : thing;
20530
+ const headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? { ...thing } : thing;
19355
20531
 
19356
20532
  /**
19357
20533
  * Config-specific merge-function which creates a new config-object
@@ -19362,7 +20538,7 @@ const headersToObject = (thing) => thing instanceof AxiosHeaders ? { ...thing }
19362
20538
  *
19363
20539
  * @returns {Object} New object resulting from merging config2 to config1
19364
20540
  */
19365
- function mergeConfig(config1, config2) {
20541
+ function mergeConfig$1(config1, config2) {
19366
20542
  // eslint-disable-next-line no-param-reassign
19367
20543
  config2 = config2 || {};
19368
20544
  const config = {};
@@ -19454,11 +20630,11 @@ function mergeConfig(config1, config2) {
19454
20630
  }
19455
20631
 
19456
20632
  var resolveConfig = (config) => {
19457
- const newConfig = mergeConfig({}, config);
20633
+ const newConfig = mergeConfig$1({}, config);
19458
20634
 
19459
20635
  let {data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth} = newConfig;
19460
20636
 
19461
- newConfig.headers = headers = AxiosHeaders.from(headers);
20637
+ newConfig.headers = headers = AxiosHeaders$1.from(headers);
19462
20638
 
19463
20639
  newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url), config.params, config.paramsSerializer);
19464
20640
 
@@ -19507,7 +20683,7 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
19507
20683
  return new Promise(function dispatchXhrRequest(resolve, reject) {
19508
20684
  const _config = resolveConfig(config);
19509
20685
  let requestData = _config.data;
19510
- const requestHeaders = AxiosHeaders.from(_config.headers).normalize();
20686
+ const requestHeaders = AxiosHeaders$1.from(_config.headers).normalize();
19511
20687
  let {responseType, onUploadProgress, onDownloadProgress} = _config;
19512
20688
  let onCanceled;
19513
20689
  let uploadThrottled, downloadThrottled;
@@ -19534,7 +20710,7 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
19534
20710
  return;
19535
20711
  }
19536
20712
  // Prepare the response
19537
- const responseHeaders = AxiosHeaders.from(
20713
+ const responseHeaders = AxiosHeaders$1.from(
19538
20714
  'getAllResponseHeaders' in request && request.getAllResponseHeaders()
19539
20715
  );
19540
20716
  const responseData = !responseType || responseType === 'text' || responseType === 'json' ?
@@ -19589,7 +20765,7 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
19589
20765
  return;
19590
20766
  }
19591
20767
 
19592
- reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, config, request));
20768
+ reject(new AxiosError$1('Request aborted', AxiosError$1.ECONNABORTED, config, request));
19593
20769
 
19594
20770
  // Clean up request
19595
20771
  request = null;
@@ -19599,7 +20775,7 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
19599
20775
  request.onerror = function handleError() {
19600
20776
  // Real errors are hidden from us by the browser
19601
20777
  // onerror should only fire if it's a network error
19602
- reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request));
20778
+ reject(new AxiosError$1('Network Error', AxiosError$1.ERR_NETWORK, config, request));
19603
20779
 
19604
20780
  // Clean up request
19605
20781
  request = null;
@@ -19612,9 +20788,9 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
19612
20788
  if (_config.timeoutErrorMessage) {
19613
20789
  timeoutErrorMessage = _config.timeoutErrorMessage;
19614
20790
  }
19615
- reject(new AxiosError(
20791
+ reject(new AxiosError$1(
19616
20792
  timeoutErrorMessage,
19617
- transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,
20793
+ transitional.clarifyTimeoutError ? AxiosError$1.ETIMEDOUT : AxiosError$1.ECONNABORTED,
19618
20794
  config,
19619
20795
  request));
19620
20796
 
@@ -19664,7 +20840,7 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
19664
20840
  if (!request) {
19665
20841
  return;
19666
20842
  }
19667
- reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);
20843
+ reject(!cancel || cancel.type ? new CanceledError$1(null, config, request) : cancel);
19668
20844
  request.abort();
19669
20845
  request = null;
19670
20846
  };
@@ -19678,7 +20854,7 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
19678
20854
  const protocol = parseProtocol(_config.url);
19679
20855
 
19680
20856
  if (protocol && platform.protocols.indexOf(protocol) === -1) {
19681
- reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));
20857
+ reject(new AxiosError$1('Unsupported protocol ' + protocol + ':', AxiosError$1.ERR_BAD_REQUEST, config));
19682
20858
  return;
19683
20859
  }
19684
20860
 
@@ -19701,13 +20877,13 @@ const composeSignals = (signals, timeout) => {
19701
20877
  aborted = true;
19702
20878
  unsubscribe();
19703
20879
  const err = reason instanceof Error ? reason : this.reason;
19704
- controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err));
20880
+ controller.abort(err instanceof AxiosError$1 ? err : new CanceledError$1(err instanceof Error ? err.message : err));
19705
20881
  }
19706
20882
  };
19707
20883
 
19708
20884
  let timer = timeout && setTimeout(() => {
19709
20885
  timer = null;
19710
- onabort(new AxiosError(`timeout ${timeout} of ms exceeded`, AxiosError.ETIMEDOUT));
20886
+ onabort(new AxiosError$1(`timeout ${timeout} of ms exceeded`, AxiosError$1.ETIMEDOUT));
19711
20887
  }, timeout);
19712
20888
 
19713
20889
  const unsubscribe = () => {
@@ -19864,7 +21040,7 @@ isFetchSupported && (((res) => {
19864
21040
  ['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => {
19865
21041
  !resolvers[type] && (resolvers[type] = utils$4.isFunction(res[type]) ? (res) => res[type]() :
19866
21042
  (_, config) => {
19867
- throw new AxiosError(`Response type '${type}' is not supported`, AxiosError.ERR_NOT_SUPPORT, config);
21043
+ throw new AxiosError$1(`Response type '${type}' is not supported`, AxiosError$1.ERR_NOT_SUPPORT, config);
19868
21044
  });
19869
21045
  });
19870
21046
  })(new Response));
@@ -20013,7 +21189,7 @@ var fetchAdapter = isFetchSupported && (async (config) => {
20013
21189
  return await new Promise((resolve, reject) => {
20014
21190
  settle(resolve, reject, {
20015
21191
  data: responseData,
20016
- headers: AxiosHeaders.from(response.headers),
21192
+ headers: AxiosHeaders$1.from(response.headers),
20017
21193
  status: response.status,
20018
21194
  statusText: response.statusText,
20019
21195
  config,
@@ -20025,14 +21201,14 @@ var fetchAdapter = isFetchSupported && (async (config) => {
20025
21201
 
20026
21202
  if (err && err.name === 'TypeError' && /fetch/i.test(err.message)) {
20027
21203
  throw Object.assign(
20028
- new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request),
21204
+ new AxiosError$1('Network Error', AxiosError$1.ERR_NETWORK, config, request),
20029
21205
  {
20030
21206
  cause: err.cause || err
20031
21207
  }
20032
21208
  )
20033
21209
  }
20034
21210
 
20035
- throw AxiosError.from(err, err && err.code, config, request);
21211
+ throw AxiosError$1.from(err, err && err.code, config, request);
20036
21212
  }
20037
21213
  });
20038
21214
 
@@ -20077,7 +21253,7 @@ var adapters = {
20077
21253
  adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
20078
21254
 
20079
21255
  if (adapter === undefined) {
20080
- throw new AxiosError(`Unknown adapter '${id}'`);
21256
+ throw new AxiosError$1(`Unknown adapter '${id}'`);
20081
21257
  }
20082
21258
  }
20083
21259
 
@@ -20099,7 +21275,7 @@ var adapters = {
20099
21275
  (reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0])) :
20100
21276
  'as no adapter specified';
20101
21277
 
20102
- throw new AxiosError(
21278
+ throw new AxiosError$1(
20103
21279
  `There is no suitable adapter to dispatch the request ` + s,
20104
21280
  'ERR_NOT_SUPPORT'
20105
21281
  );
@@ -20123,7 +21299,7 @@ function throwIfCancellationRequested(config) {
20123
21299
  }
20124
21300
 
20125
21301
  if (config.signal && config.signal.aborted) {
20126
- throw new CanceledError(null, config);
21302
+ throw new CanceledError$1(null, config);
20127
21303
  }
20128
21304
  }
20129
21305
 
@@ -20137,7 +21313,7 @@ function throwIfCancellationRequested(config) {
20137
21313
  function dispatchRequest(config) {
20138
21314
  throwIfCancellationRequested(config);
20139
21315
 
20140
- config.headers = AxiosHeaders.from(config.headers);
21316
+ config.headers = AxiosHeaders$1.from(config.headers);
20141
21317
 
20142
21318
  // Transform request data
20143
21319
  config.data = transformData.call(
@@ -20161,11 +21337,11 @@ function dispatchRequest(config) {
20161
21337
  response
20162
21338
  );
20163
21339
 
20164
- response.headers = AxiosHeaders.from(response.headers);
21340
+ response.headers = AxiosHeaders$1.from(response.headers);
20165
21341
 
20166
21342
  return response;
20167
21343
  }, function onAdapterRejection(reason) {
20168
- if (!isCancel(reason)) {
21344
+ if (!isCancel$1(reason)) {
20169
21345
  throwIfCancellationRequested(config);
20170
21346
 
20171
21347
  // Transform response data
@@ -20175,7 +21351,7 @@ function dispatchRequest(config) {
20175
21351
  config.transformResponse,
20176
21352
  reason.response
20177
21353
  );
20178
- reason.response.headers = AxiosHeaders.from(reason.response.headers);
21354
+ reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
20179
21355
  }
20180
21356
  }
20181
21357
 
@@ -20205,15 +21381,15 @@ const deprecatedWarnings = {};
20205
21381
  */
20206
21382
  validators$1.transitional = function transitional(validator, version, message) {
20207
21383
  function formatMessage(opt, desc) {
20208
- return '[Axios v' + VERSION + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : '');
21384
+ return '[Axios v' + VERSION$1 + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : '');
20209
21385
  }
20210
21386
 
20211
21387
  // eslint-disable-next-line func-names
20212
21388
  return (value, opt, opts) => {
20213
21389
  if (validator === false) {
20214
- throw new AxiosError(
21390
+ throw new AxiosError$1(
20215
21391
  formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')),
20216
- AxiosError.ERR_DEPRECATED
21392
+ AxiosError$1.ERR_DEPRECATED
20217
21393
  );
20218
21394
  }
20219
21395
 
@@ -20252,7 +21428,7 @@ validators$1.spelling = function spelling(correctSpelling) {
20252
21428
 
20253
21429
  function assertOptions(options, schema, allowUnknown) {
20254
21430
  if (typeof options !== 'object') {
20255
- throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE);
21431
+ throw new AxiosError$1('options must be an object', AxiosError$1.ERR_BAD_OPTION_VALUE);
20256
21432
  }
20257
21433
  const keys = Object.keys(options);
20258
21434
  let i = keys.length;
@@ -20263,12 +21439,12 @@ function assertOptions(options, schema, allowUnknown) {
20263
21439
  const value = options[opt];
20264
21440
  const result = value === undefined || validator(value, opt, options);
20265
21441
  if (result !== true) {
20266
- throw new AxiosError('option ' + opt + ' must be ' + result, AxiosError.ERR_BAD_OPTION_VALUE);
21442
+ throw new AxiosError$1('option ' + opt + ' must be ' + result, AxiosError$1.ERR_BAD_OPTION_VALUE);
20267
21443
  }
20268
21444
  continue;
20269
21445
  }
20270
21446
  if (allowUnknown !== true) {
20271
- throw new AxiosError('Unknown option ' + opt, AxiosError.ERR_BAD_OPTION);
21447
+ throw new AxiosError$1('Unknown option ' + opt, AxiosError$1.ERR_BAD_OPTION);
20272
21448
  }
20273
21449
  }
20274
21450
  }
@@ -20287,7 +21463,7 @@ const validators = validator$1.validators;
20287
21463
  *
20288
21464
  * @return {Axios} A new instance of Axios
20289
21465
  */
20290
- class Axios {
21466
+ let Axios$1 = class Axios {
20291
21467
  constructor(instanceConfig) {
20292
21468
  this.defaults = instanceConfig;
20293
21469
  this.interceptors = {
@@ -20341,7 +21517,7 @@ class Axios {
20341
21517
  config = configOrUrl || {};
20342
21518
  }
20343
21519
 
20344
- config = mergeConfig(this.defaults, config);
21520
+ config = mergeConfig$1(this.defaults, config);
20345
21521
 
20346
21522
  const {transitional, paramsSerializer, headers} = config;
20347
21523
 
@@ -20366,6 +21542,13 @@ class Axios {
20366
21542
  }
20367
21543
  }
20368
21544
 
21545
+ // Set config.allowAbsoluteUrls
21546
+ if (config.allowAbsoluteUrls !== undefined) ; else if (this.defaults.allowAbsoluteUrls !== undefined) {
21547
+ config.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls;
21548
+ } else {
21549
+ config.allowAbsoluteUrls = true;
21550
+ }
21551
+
20369
21552
  validator$1.assertOptions(config, {
20370
21553
  baseUrl: validators.spelling('baseURL'),
20371
21554
  withXsrfToken: validators.spelling('withXSRFToken')
@@ -20387,7 +21570,7 @@ class Axios {
20387
21570
  }
20388
21571
  );
20389
21572
 
20390
- config.headers = AxiosHeaders.concat(contextHeaders, headers);
21573
+ config.headers = AxiosHeaders$1.concat(contextHeaders, headers);
20391
21574
 
20392
21575
  // filter out skipped interceptors
20393
21576
  const requestInterceptorChain = [];
@@ -20460,17 +21643,17 @@ class Axios {
20460
21643
  }
20461
21644
 
20462
21645
  getUri(config) {
20463
- config = mergeConfig(this.defaults, config);
20464
- const fullPath = buildFullPath(config.baseURL, config.url);
21646
+ config = mergeConfig$1(this.defaults, config);
21647
+ const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
20465
21648
  return buildURL(fullPath, config.params, config.paramsSerializer);
20466
21649
  }
20467
- }
21650
+ };
20468
21651
 
20469
21652
  // Provide aliases for supported request methods
20470
21653
  utils$4.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
20471
21654
  /*eslint func-names:0*/
20472
- Axios.prototype[method] = function(url, config) {
20473
- return this.request(mergeConfig(config || {}, {
21655
+ Axios$1.prototype[method] = function(url, config) {
21656
+ return this.request(mergeConfig$1(config || {}, {
20474
21657
  method,
20475
21658
  url,
20476
21659
  data: (config || {}).data
@@ -20483,7 +21666,7 @@ utils$4.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method)
20483
21666
 
20484
21667
  function generateHTTPMethod(isForm) {
20485
21668
  return function httpMethod(url, data, config) {
20486
- return this.request(mergeConfig(config || {}, {
21669
+ return this.request(mergeConfig$1(config || {}, {
20487
21670
  method,
20488
21671
  headers: isForm ? {
20489
21672
  'Content-Type': 'multipart/form-data'
@@ -20494,9 +21677,9 @@ utils$4.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method)
20494
21677
  };
20495
21678
  }
20496
21679
 
20497
- Axios.prototype[method] = generateHTTPMethod();
21680
+ Axios$1.prototype[method] = generateHTTPMethod();
20498
21681
 
20499
- Axios.prototype[method + 'Form'] = generateHTTPMethod(true);
21682
+ Axios$1.prototype[method + 'Form'] = generateHTTPMethod(true);
20500
21683
  });
20501
21684
 
20502
21685
  /**
@@ -20506,7 +21689,7 @@ utils$4.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method)
20506
21689
  *
20507
21690
  * @returns {CancelToken}
20508
21691
  */
20509
- class CancelToken {
21692
+ let CancelToken$1 = class CancelToken {
20510
21693
  constructor(executor) {
20511
21694
  if (typeof executor !== 'function') {
20512
21695
  throw new TypeError('executor must be a function.');
@@ -20554,7 +21737,7 @@ class CancelToken {
20554
21737
  return;
20555
21738
  }
20556
21739
 
20557
- token.reason = new CanceledError(message, config, request);
21740
+ token.reason = new CanceledError$1(message, config, request);
20558
21741
  resolvePromise(token.reason);
20559
21742
  });
20560
21743
  }
@@ -20627,7 +21810,7 @@ class CancelToken {
20627
21810
  cancel
20628
21811
  };
20629
21812
  }
20630
- }
21813
+ };
20631
21814
 
20632
21815
  /**
20633
21816
  * Syntactic sugar for invoking a function and expanding an array for arguments.
@@ -20650,7 +21833,7 @@ class CancelToken {
20650
21833
  *
20651
21834
  * @returns {Function}
20652
21835
  */
20653
- function spread(callback) {
21836
+ function spread$1(callback) {
20654
21837
  return function wrap(arr) {
20655
21838
  return callback.apply(null, arr);
20656
21839
  };
@@ -20663,11 +21846,11 @@ function spread(callback) {
20663
21846
  *
20664
21847
  * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
20665
21848
  */
20666
- function isAxiosError(payload) {
21849
+ function isAxiosError$1(payload) {
20667
21850
  return utils$4.isObject(payload) && (payload.isAxiosError === true);
20668
21851
  }
20669
21852
 
20670
- const HttpStatusCode = {
21853
+ const HttpStatusCode$1 = {
20671
21854
  Continue: 100,
20672
21855
  SwitchingProtocols: 101,
20673
21856
  Processing: 102,
@@ -20733,8 +21916,8 @@ const HttpStatusCode = {
20733
21916
  NetworkAuthenticationRequired: 511,
20734
21917
  };
20735
21918
 
20736
- Object.entries(HttpStatusCode).forEach(([key, value]) => {
20737
- HttpStatusCode[value] = key;
21919
+ Object.entries(HttpStatusCode$1).forEach(([key, value]) => {
21920
+ HttpStatusCode$1[value] = key;
20738
21921
  });
20739
21922
 
20740
21923
  /**
@@ -20745,18 +21928,18 @@ Object.entries(HttpStatusCode).forEach(([key, value]) => {
20745
21928
  * @returns {Axios} A new instance of Axios
20746
21929
  */
20747
21930
  function createInstance(defaultConfig) {
20748
- const context = new Axios(defaultConfig);
20749
- const instance = bind(Axios.prototype.request, context);
21931
+ const context = new Axios$1(defaultConfig);
21932
+ const instance = bind(Axios$1.prototype.request, context);
20750
21933
 
20751
21934
  // Copy axios.prototype to instance
20752
- utils$4.extend(instance, Axios.prototype, context, {allOwnKeys: true});
21935
+ utils$4.extend(instance, Axios$1.prototype, context, {allOwnKeys: true});
20753
21936
 
20754
21937
  // Copy context to instance
20755
21938
  utils$4.extend(instance, context, null, {allOwnKeys: true});
20756
21939
 
20757
21940
  // Factory for creating new instances
20758
21941
  instance.create = function create(instanceConfig) {
20759
- return createInstance(mergeConfig(defaultConfig, instanceConfig));
21942
+ return createInstance(mergeConfig$1(defaultConfig, instanceConfig));
20760
21943
  };
20761
21944
 
20762
21945
  return instance;
@@ -20766,17 +21949,17 @@ function createInstance(defaultConfig) {
20766
21949
  const axios = createInstance(defaults);
20767
21950
 
20768
21951
  // Expose Axios class to allow class inheritance
20769
- axios.Axios = Axios;
21952
+ axios.Axios = Axios$1;
20770
21953
 
20771
21954
  // Expose Cancel & CancelToken
20772
- axios.CanceledError = CanceledError;
20773
- axios.CancelToken = CancelToken;
20774
- axios.isCancel = isCancel;
20775
- axios.VERSION = VERSION;
20776
- axios.toFormData = toFormData;
21955
+ axios.CanceledError = CanceledError$1;
21956
+ axios.CancelToken = CancelToken$1;
21957
+ axios.isCancel = isCancel$1;
21958
+ axios.VERSION = VERSION$1;
21959
+ axios.toFormData = toFormData$1;
20777
21960
 
20778
21961
  // Expose AxiosError class
20779
- axios.AxiosError = AxiosError;
21962
+ axios.AxiosError = AxiosError$1;
20780
21963
 
20781
21964
  // alias for CanceledError for backward compatibility
20782
21965
  axios.Cancel = axios.CanceledError;
@@ -20786,37 +21969,56 @@ axios.all = function all(promises) {
20786
21969
  return Promise.all(promises);
20787
21970
  };
20788
21971
 
20789
- axios.spread = spread;
21972
+ axios.spread = spread$1;
20790
21973
 
20791
21974
  // Expose isAxiosError
20792
- axios.isAxiosError = isAxiosError;
21975
+ axios.isAxiosError = isAxiosError$1;
20793
21976
 
20794
21977
  // Expose mergeConfig
20795
- axios.mergeConfig = mergeConfig;
21978
+ axios.mergeConfig = mergeConfig$1;
20796
21979
 
20797
- axios.AxiosHeaders = AxiosHeaders;
21980
+ axios.AxiosHeaders = AxiosHeaders$1;
20798
21981
 
20799
21982
  axios.formToJSON = thing => formDataToJSON(utils$4.isHTMLForm(thing) ? new FormData(thing) : thing);
20800
21983
 
20801
21984
  axios.getAdapter = adapters.getAdapter;
20802
21985
 
20803
- axios.HttpStatusCode = HttpStatusCode;
21986
+ axios.HttpStatusCode = HttpStatusCode$1;
20804
21987
 
20805
21988
  axios.default = axios;
20806
21989
 
21990
+ // This module is intended to unwrap Axios default export as named.
21991
+ // Keep top-level export same with static properties
21992
+ // so that it can keep same with es module or cjs
21993
+ const {
21994
+ Axios,
21995
+ AxiosError,
21996
+ CanceledError,
21997
+ isCancel,
21998
+ CancelToken,
21999
+ VERSION,
22000
+ all,
22001
+ Cancel,
22002
+ isAxiosError,
22003
+ spread,
22004
+ toFormData,
22005
+ AxiosHeaders,
22006
+ HttpStatusCode,
22007
+ formToJSON,
22008
+ getAdapter,
22009
+ mergeConfig
22010
+ } = axios;
22011
+
20807
22012
  const DimoEnvironment = {
20808
22013
  Production: {
20809
22014
  'Attestation': 'https://attestation-api.dimo.zone',
20810
22015
  'Auth': 'https://auth.dimo.zone',
20811
22016
  'Identity': 'https://identity-api.dimo.zone/query',
20812
22017
  'Devices': 'https://devices-api.dimo.zone',
20813
- 'DeviceData': 'https://device-data-api.dimo.zone',
20814
22018
  'DeviceDefinitions': 'https://device-definitions-api.dimo.zone',
20815
- 'Events': 'https://events-api.dimo.zone',
20816
22019
  'Telemetry': 'https://telemetry-api.dimo.zone/query',
20817
22020
  'TokenExchange': 'https://token-exchange-api.dimo.zone',
20818
22021
  'Trips': 'https://trips-api.dimo.zone',
20819
- 'User': 'https://users-api.dimo.zone',
20820
22022
  'Valuations': 'https://valuations-api.dimo.zone',
20821
22023
  'VehicleSignalDecoding': 'https://vehicle-signal-decoding.dimo.zone'
20822
22024
  },
@@ -20825,13 +22027,10 @@ const DimoEnvironment = {
20825
22027
  'Auth': 'https://auth.dev.dimo.zone',
20826
22028
  'Identity': 'https://identity-api.dev.dimo.zone/query',
20827
22029
  'Devices': 'https://devices-api.dev.dimo.zone',
20828
- 'DeviceData': 'https://device-data-api.dev.dimo.zone',
20829
22030
  'DeviceDefinitions': 'https://device-definitions-api.dev.dimo.zone',
20830
- 'Events': 'https://events-api.dev.dimo.zone',
20831
22031
  'Telemetry': 'https://telemetry-api.dev.dimo.zone/query',
20832
22032
  'TokenExchange': 'https://token-exchange-api.dev.dimo.zone',
20833
22033
  'Trips': 'https://trips-api.dev.dimo.zone',
20834
- 'User': 'https://users-api.dev.dimo.zone',
20835
22034
  'Valuations': 'https://valuations-api.dev.dimo.zone',
20836
22035
  'VehicleSignalDecoding': 'https://vehicle-signal-decoding.dev.dimo.zone'
20837
22036
  }
@@ -20865,6 +22064,101 @@ function buildMessage({ message, statusCode, body, }) {
20865
22064
  return lines.join('\n');
20866
22065
  }
20867
22066
 
22067
+ const DimoConstants = {
22068
+ Production: {
22069
+ 'NFT_address': '0xbA5738a18d83D41847dfFbDC6101d37C69c9B0cF',
22070
+ 'RPC_provider': 'https://eth.llamarpc.com',
22071
+ },
22072
+ Dev: {
22073
+ 'NFT_address': '0x45fbCD3ef7361d156e8b16F5538AE36DEdf61Da8',
22074
+ 'RPC_provider': 'https://eth.llamarpc.com',
22075
+ },
22076
+ Query: {
22077
+ 'PAGE_SIZE': 100
22078
+ }
22079
+ };
22080
+
22081
+ const pageSize = DimoConstants.Query.PAGE_SIZE;
22082
+ const paginate = async (fetchPage) => {
22083
+ let after = null;
22084
+ let result = [];
22085
+ let totalCount = null;
22086
+ let page = 0;
22087
+ while (true) {
22088
+ const response = await fetchPage(after ?? undefined);
22089
+ const { nodes, pageInfo, totalCount: responseTotalCount } = response;
22090
+ if (!nodes || !nodes.nodes) {
22091
+ console.error('Invalid response: nodes is undefined or null', response);
22092
+ throw new Error('Unexpected API response format');
22093
+ }
22094
+ // Capture totalCount from the first request
22095
+ if (totalCount === null) {
22096
+ totalCount = responseTotalCount ?? null; // Ensure fallback if totalCount is missing
22097
+ if (totalCount === null) {
22098
+ console.warn('Warning: totalCount is null. Defaulting to single page execution.');
22099
+ totalCount = pageSize; // Assume at least one page if totalCount is unknown
22100
+ }
22101
+ }
22102
+ result.push(...nodes.nodes);
22103
+ page++;
22104
+ const totalPages = Math.ceil(totalCount / pageSize);
22105
+ if (page >= totalPages || nodes.nodes.length < pageSize) {
22106
+ break;
22107
+ }
22108
+ // Update the cursor
22109
+ after = pageInfo.endCursor ?? null;
22110
+ if (after === null && page < totalPages) {
22111
+ console.warn(`Expected more pages (${page}/${totalPages}), but endCursor is null. Stopping pagination.`);
22112
+ break;
22113
+ }
22114
+ }
22115
+ return result;
22116
+ };
22117
+
22118
+ const getVehiclePrivileges = async (input, env) => {
22119
+ const sdk = new DIMO(env);
22120
+ try {
22121
+ const getSacds = async (after) => {
22122
+ const response = await sdk.identity.listSacdPerVehicleTokenId({
22123
+ tokenId: input.tokenId,
22124
+ after
22125
+ });
22126
+ const sacds = response.data?.vehicle?.sacds || [];
22127
+ const pageInfo = response.data?.vehicle?.sacds.pageInfo || { endCursor: null };
22128
+ const totalCount = response.data?.vehicle?.sacds?.totalCount || null;
22129
+ if (input.clientId) {
22130
+ const matchingSacd = sacds.nodes.find((sacd) => sacd.grantee === input.clientId);
22131
+ if (matchingSacd) {
22132
+ return {
22133
+ nodes: [matchingSacd],
22134
+ pageInfo: { endCursor: null },
22135
+ totalCount: 1
22136
+ };
22137
+ }
22138
+ }
22139
+ return {
22140
+ nodes: sacds,
22141
+ pageInfo,
22142
+ totalCount
22143
+ };
22144
+ };
22145
+ if (input.clientId) {
22146
+ const { nodes } = await getSacds(undefined);
22147
+ if (nodes.length > 0) {
22148
+ return nodes;
22149
+ }
22150
+ }
22151
+ return await paginate(getSacds);
22152
+ }
22153
+ catch (error) {
22154
+ console.error(error);
22155
+ throw new DimoError({
22156
+ message: `Error getting vehicle privileges: ${error.message || error}`,
22157
+ statusCode: 400
22158
+ });
22159
+ }
22160
+ };
22161
+
20868
22162
  const getVin = async (input, env) => {
20869
22163
  const sdk = new DIMO(env);
20870
22164
  let result;
@@ -20899,6 +22193,7 @@ const getVin = async (input, env) => {
20899
22193
 
20900
22194
  var functionIndex$1 = /*#__PURE__*/Object.freeze({
20901
22195
  __proto__: null,
22196
+ getVehiclePrivileges: getVehiclePrivileges,
20902
22197
  getVin: getVin
20903
22198
  });
20904
22199
 
@@ -20946,15 +22241,14 @@ const Query = async (resource, baseUrl, params = {}, env) => {
20946
22241
  for (const key in variables) {
20947
22242
  const placeholder = new RegExp(`\\$${key}\\b`, 'g');
20948
22243
  if (variables[key] === true) {
20949
- if (!params[key]) {
20950
- console.error(`Missing required input: ${key}`);
20951
- throw new DimoError({
20952
- message: `Missing required input: ${key}`,
20953
- statusCode: 400
20954
- });
22244
+ if (params[key] === undefined || params[key] === null) {
22245
+ // ACC-303: Replace the placeholder with null string to handle pagination
22246
+ query = query.replace(placeholder, "null");
22247
+ }
22248
+ else {
22249
+ const value = typeof params[key] === 'string' ? `"${params[key]}"` : params[key];
22250
+ query = query.replace(placeholder, value);
20955
22251
  }
20956
- const value = typeof params[key] === 'string' ? `"${params[key]}"` : params[key];
20957
- query = query.replace(placeholder, value);
20958
22252
  }
20959
22253
  }
20960
22254
  try {
@@ -21057,14 +22351,41 @@ class Identity extends Resource$1 {
21057
22351
  query: true
21058
22352
  }),
21059
22353
  this.setQueries({
21060
- countDimoVehicles: {
22354
+ getVehiclePrivileges: {
22355
+ method: 'FUNCTION',
22356
+ path: 'getVehiclePrivileges',
22357
+ },
22358
+ listSacdPerVehicleTokenId: {
22359
+ params: {
22360
+ tokenId: true,
22361
+ after: true
22362
+ },
21061
22363
  query: `
21062
- {
21063
- vehicles (first:10) {
21064
- totalCount,
21065
- }
22364
+ {
22365
+ vehicle(tokenId: $tokenId) {
22366
+ sacds(first: ${DimoConstants.Query.PAGE_SIZE}, after: $after) {
22367
+ nodes {
22368
+ permissions
22369
+ grantee
22370
+ }
22371
+ totalCount
22372
+ pageInfo {
22373
+ startCursor
22374
+ endCursor
22375
+ }
21066
22376
  }
21067
- `
22377
+ }
22378
+ }
22379
+ `
22380
+ },
22381
+ countDimoVehicles: {
22382
+ query: `
22383
+ {
22384
+ vehicles (first: ${DimoConstants.Query.PAGE_SIZE}) {
22385
+ totalCount,
22386
+ }
22387
+ }
22388
+ `
21068
22389
  },
21069
22390
  listVehicleDefinitionsPerAddress: {
21070
22391
  params: {
@@ -21072,62 +22393,30 @@ class Identity extends Resource$1 {
21072
22393
  limit: true
21073
22394
  },
21074
22395
  query: `
21075
- {
21076
- vehicles(filterBy: {owner: $address}, first: $limit) {
21077
- nodes {
21078
- aftermarketDevice {
21079
- tokenId
21080
- address
21081
- }
21082
- syntheticDevice {
21083
- address
21084
- tokenId
21085
- }
21086
- definition {
21087
- make
21088
- model
21089
- year
21090
- }
21091
- }
21092
- }
22396
+ {
22397
+ vehicles(filterBy: {owner: $address}, first: $limit) {
22398
+ nodes {
22399
+ aftermarketDevice {
22400
+ tokenId
22401
+ address
21093
22402
  }
21094
- `
22403
+ syntheticDevice {
22404
+ address
22405
+ tokenId
22406
+ }
22407
+ definition {
22408
+ make
22409
+ model
22410
+ year
22411
+ }
22412
+ }
22413
+ }
22414
+ }
22415
+ `
21095
22416
  }
21096
22417
  });
21097
22418
  }
21098
22419
  }
21099
- // export const getVehicleDetailsByTokenId = (tokenId: number) => `
21100
- // {
21101
- // vehicle (tokenId: ${tokenId}) {
21102
- // aftermarketDevice {
21103
- // tokenId
21104
- // address
21105
- // }
21106
- // syntheticDevice {
21107
- // address
21108
- // tokenId
21109
- // }
21110
- // definition {
21111
- // make
21112
- // model
21113
- // year
21114
- // }
21115
- // }
21116
- // }
21117
- // `;
21118
- // export const test = () => `
21119
- // {
21120
- // vehicles(filterBy: {owner: "0xf9D26323Ab49179A6d57C26515B01De018553787"}, first: 10) {
21121
- // nodes {
21122
- // definition {
21123
- // make
21124
- // model
21125
- // year
21126
- // }
21127
- // }
21128
- // }
21129
- // }
21130
- // `;
21131
22420
 
21132
22421
  class Telemetry extends Resource$1 {
21133
22422
  constructor(api, env) {
@@ -21230,7 +22519,7 @@ class DIMO {
21230
22519
  }
21231
22520
  const data = fs.readFileSync('.credentials.json', 'utf8');
21232
22521
  const credentials = JSON.parse(data);
21233
- const authHeader = await this.auth.getToken({
22522
+ const authHeader = await this.auth.getDeveloperJwt({
21234
22523
  client_id: credentials.client_id,
21235
22524
  domain: credentials.redirect_uri,
21236
22525
  private_key: credentials.private_key,
@@ -21248,7 +22537,7 @@ class DIMO {
21248
22537
  }
21249
22538
  }
21250
22539
 
21251
- const getToken = async (input, env) => {
22540
+ const getDeveloperJwt = async (input, env) => {
21252
22541
  const sdk = new DIMO(env);
21253
22542
  const challenge = await sdk.auth.generateChallenge({
21254
22543
  client_id: input.client_id,
@@ -21268,6 +22557,28 @@ const getToken = async (input, env) => {
21268
22557
  return submit;
21269
22558
  };
21270
22559
 
22560
+ const getVehicleJwt = async (input, env) => {
22561
+ const sdk = new DIMO(env);
22562
+ const developerJwt = input.headers.Authorization;
22563
+ if (!developerJwt || !developerJwt.startsWith('Bearer ')) {
22564
+ throw new Error('Invalid Authorization header format');
22565
+ }
22566
+ // Remove "Bearer " prefix
22567
+ const decodedToken = decodeJwt(developerJwt.slice(7));
22568
+ const clientId = decodedToken.ethereum_address;
22569
+ const privileges = await sdk.identity.getVehiclePrivileges({
22570
+ tokenId: input.tokenId,
22571
+ clientId: clientId // We want to pass in the clientId
22572
+ });
22573
+ const decodedPrivileges = decodePermissions(privileges[0].permissions);
22574
+ const vehicleJwt = await sdk.tokenexchange.exchange({
22575
+ ...input,
22576
+ privileges: decodedPrivileges,
22577
+ tokenId: input.tokenId
22578
+ });
22579
+ return vehicleJwt;
22580
+ };
22581
+
21271
22582
  /*
21272
22583
  This file is part of web3.js.
21273
22584
 
@@ -21578,7 +22889,7 @@ const ERR_RPC_INVALID_REQUEST = -32600;
21578
22889
  const ERR_RPC_INVALID_METHOD = -32601;
21579
22890
  const ERR_RPC_INVALID_PARAMS = -32602;
21580
22891
  const ERR_RPC_INTERNAL_ERROR = -32603;
21581
- const ERR_RPC_INVALID_INPUT = -32000;
22892
+ const ERR_RPC_INVALID_INPUT = -32e3;
21582
22893
  const ERR_RPC_MISSING_RESOURCE = -32001;
21583
22894
  const ERR_RPC_UNAVAILABLE_RESOURCE = -32002;
21584
22895
  const ERR_RPC_TRANSACTION_REJECTED = -32003;
@@ -23838,12 +25149,12 @@ PERFORMANCE OF THIS SOFTWARE.
23838
25149
  ***************************************************************************** */
23839
25150
 
23840
25151
  function __classPrivateFieldGet(receiver, state, kind, f) {
23841
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
25152
+ if (typeof state === "function" ? receiver !== state || true : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
23842
25153
  return state.get(receiver);
23843
25154
  }
23844
25155
 
23845
25156
  function __classPrivateFieldSet(receiver, state, value, kind, f) {
23846
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
25157
+ if (typeof state === "function" ? receiver !== state || true : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
23847
25158
  return (state.set(receiver, value)), value;
23848
25159
  }
23849
25160
 
@@ -27452,7 +28763,23 @@ ZodReadonly.create = (type, params) => {
27452
28763
  ...processCreateParams(params),
27453
28764
  });
27454
28765
  };
27455
- function custom(check, params = {},
28766
+ ////////////////////////////////////////
28767
+ ////////////////////////////////////////
28768
+ ////////// //////////
28769
+ ////////// z.custom //////////
28770
+ ////////// //////////
28771
+ ////////////////////////////////////////
28772
+ ////////////////////////////////////////
28773
+ function cleanParams(params, data) {
28774
+ const p = typeof params === "function"
28775
+ ? params(data)
28776
+ : typeof params === "string"
28777
+ ? { message: params }
28778
+ : params;
28779
+ const p2 = typeof p === "string" ? { message: p } : p;
28780
+ return p2;
28781
+ }
28782
+ function custom(check, _params = {},
27456
28783
  /**
27457
28784
  * @deprecated
27458
28785
  *
@@ -27467,16 +28794,23 @@ fatal) {
27467
28794
  if (check)
27468
28795
  return ZodAny.create().superRefine((data, ctx) => {
27469
28796
  var _a, _b;
27470
- if (!check(data)) {
27471
- const p = typeof params === "function"
27472
- ? params(data)
27473
- : typeof params === "string"
27474
- ? { message: params }
27475
- : params;
27476
- const _fatal = (_b = (_a = p.fatal) !== null && _a !== void 0 ? _a : fatal) !== null && _b !== void 0 ? _b : true;
27477
- const p2 = typeof p === "string" ? { message: p } : p;
27478
- ctx.addIssue({ code: "custom", ...p2, fatal: _fatal });
28797
+ const r = check(data);
28798
+ if (r instanceof Promise) {
28799
+ return r.then((r) => {
28800
+ var _a, _b;
28801
+ if (!r) {
28802
+ const params = cleanParams(_params, data);
28803
+ const _fatal = (_b = (_a = params.fatal) !== null && _a !== void 0 ? _a : fatal) !== null && _b !== void 0 ? _b : true;
28804
+ ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
28805
+ }
28806
+ });
28807
+ }
28808
+ if (!r) {
28809
+ const params = cleanParams(_params, data);
28810
+ const _fatal = (_b = (_a = params.fatal) !== null && _a !== void 0 ? _a : fatal) !== null && _b !== void 0 ? _b : true;
28811
+ ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
27479
28812
  }
28813
+ return;
27480
28814
  });
27481
28815
  return ZodAny.create();
27482
28816
  }
@@ -31251,7 +32585,7 @@ along with web3.js. If not, see <http://www.gnu.org/licenses/>.
31251
32585
  // check if code is a valid rpc server error code
31252
32586
  const isResponseRpcError = (rpcError) => {
31253
32587
  const errorCode = rpcError.error.code;
31254
- return rpcErrorsMap.has(errorCode) || (errorCode >= -32099 && errorCode <= -32000);
32588
+ return rpcErrorsMap.has(errorCode) || (errorCode >= -32099 && errorCode <= -32e3);
31255
32589
  };
31256
32590
  const isResponseWithResult = (response) => !Array.isArray(response) &&
31257
32591
  !!response &&
@@ -115887,7 +117221,9 @@ var hasRequiredSender;
115887
117221
  function requireSender () {
115888
117222
  if (hasRequiredSender) return sender;
115889
117223
  hasRequiredSender = 1;
115890
- const { randomFillSync } = require$$1$3;
117224
+
117225
+ const { Duplex } = Stream;
117226
+ const { randomFillSync } = crypto$2;
115891
117227
 
115892
117228
  const PerMessageDeflate = requirePermessageDeflate();
115893
117229
  const { EMPTY_BUFFER, kWebSocket, NOOP } = requireConstants();
@@ -116435,7 +117771,7 @@ function requireSender () {
116435
117771
  /**
116436
117772
  * Sends a frame.
116437
117773
  *
116438
- * @param {Buffer[]} list The frame to send
117774
+ * @param {(Buffer | String)[]} list The frame to send
116439
117775
  * @param {Function} [cb] Callback
116440
117776
  * @private
116441
117777
  */
@@ -117010,7 +118346,8 @@ function requireWebsocket () {
117010
118346
  const http$1 = http;
117011
118347
  const net = require$$3;
117012
118348
  const tls = require$$4$1;
117013
- const { randomBytes, createHash } = require$$1$3;
118349
+ const { randomBytes, createHash } = crypto$2;
118350
+ const { Duplex, Readable } = Stream;
117014
118351
  const { URL } = Url;
117015
118352
 
117016
118353
  const PerMessageDeflate = requirePermessageDeflate();
@@ -118398,6 +119735,7 @@ function requireStream () {
118398
119735
  if (hasRequiredStream) return stream;
118399
119736
  hasRequiredStream = 1;
118400
119737
 
119738
+ requireWebsocket();
118401
119739
  const { Duplex } = Stream;
118402
119740
 
118403
119741
  /**
@@ -118637,7 +119975,8 @@ function requireWebsocketServer () {
118637
119975
 
118638
119976
  const EventEmitter = require$$0$2;
118639
119977
  const http$1 = http;
118640
- const { createHash } = require$$1$3;
119978
+ const { Duplex } = Stream;
119979
+ const { createHash } = crypto$2;
118641
119980
 
118642
119981
  const extension = requireExtension();
118643
119982
  const PerMessageDeflate = requirePermessageDeflate();
@@ -133397,7 +134736,7 @@ function encodeString(_param, input) {
133397
134736
  return encodeBytes({ type: 'bytes', name: '' }, bytes);
133398
134737
  }
133399
134738
  function decodeString(_param, bytes) {
133400
- const r = decodeBytes({ type: 'bytes', name: '' }, bytes);
134739
+ const r = decodeBytes({ type: 'bytes'}, bytes);
133401
134740
  return {
133402
134741
  result: hexToUtf8(r.result),
133403
134742
  encoded: r.encoded,
@@ -133743,7 +135082,7 @@ along with web3.js. If not, see <http://www.gnu.org/licenses/>.
133743
135082
  function decodeParameters$1(abis, bytes, _loose) {
133744
135083
  const abiParams = toAbiParams(abis);
133745
135084
  const bytesArray = hexToUint8Array(bytes);
133746
- return decodeTuple({ type: 'tuple', name: '', components: abiParams }, bytesArray).result;
135085
+ return decodeTuple({ components: abiParams }, bytesArray).result;
133747
135086
  }
133748
135087
 
133749
135088
  /*
@@ -139275,9 +140614,7 @@ const interfaceIds = {
139275
140614
  const methodsInInterface = {
139276
140615
  setAddr: 'addr',
139277
140616
  addr: 'addr',
139278
- setPubkey: 'pubkey',
139279
140617
  pubkey: 'pubkey',
139280
- setContenthash: 'contenthash',
139281
140618
  contenthash: 'contenthash',
139282
140619
  text: 'text',
139283
140620
  name: 'name',
@@ -142735,17 +144072,6 @@ Web3.modules = {
142735
144072
  Personal,
142736
144073
  };
142737
144074
 
142738
- const DimoConstants = {
142739
- Production: {
142740
- 'NFT_address': '0xbA5738a18d83D41847dfFbDC6101d37C69c9B0cF',
142741
- 'RPC_provider': 'https://eth.llamarpc.com',
142742
- },
142743
- Dev: {
142744
- 'NFT_address': '0x45fbCD3ef7361d156e8b16F5538AE36DEdf61Da8',
142745
- 'RPC_provider': 'https://eth.llamarpc.com',
142746
- }
142747
- };
142748
-
142749
144075
  const signChallenge = async (input, env) => {
142750
144076
  const web3 = new Web3(DimoConstants[env].RPC_provider);
142751
144077
  const formatted_key = '0x' + Buffer.from(input.private_key, 'utf8');
@@ -142755,7 +144081,8 @@ const signChallenge = async (input, env) => {
142755
144081
 
142756
144082
  var functionIndex = /*#__PURE__*/Object.freeze({
142757
144083
  __proto__: null,
142758
- getToken: getToken,
144084
+ getDeveloperJwt: getDeveloperJwt,
144085
+ getVehicleJwt: getVehicleJwt,
142759
144086
  signChallenge: signChallenge
142760
144087
  });
142761
144088
 
@@ -142968,9 +144295,9 @@ class Auth extends Resource {
142968
144295
  },
142969
144296
  return: 'developer_jwt'
142970
144297
  },
142971
- getToken: {
144298
+ getDeveloperJwt: {
142972
144299
  method: 'FUNCTION',
142973
- path: 'getToken'
144300
+ path: 'getDeveloperJwt'
142974
144301
  }
142975
144302
  });
142976
144303
  }
@@ -143026,6 +144353,10 @@ class TokenExchange extends Resource {
143026
144353
  },
143027
144354
  auth: 'developer_jwt',
143028
144355
  return: 'vehicle_jwt'
144356
+ },
144357
+ getVehicleJwt: {
144358
+ method: 'FUNCTION',
144359
+ path: 'getVehicleJwt'
143029
144360
  }
143030
144361
  });
143031
144362
  }