@imtbl/sdk 0.4.2 → 0.4.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,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
3
  var coreSdk = require('@imtbl/core-sdk');
4
+ var globalAxios$1 = require('axios');
4
5
  var oidcClientTs = require('oidc-client-ts');
5
- var axios$2 = require('axios');
6
6
  var jwt_decode = require('jwt-decode');
7
7
  var crypto = require('crypto');
8
8
  var magicSdk = require('magic-sdk');
@@ -564,3214 +564,6 @@ class ImmutableXClient {
564
564
  }
565
565
  }
566
566
 
567
- function bind$1(fn, thisArg) {
568
- return function wrap() {
569
- return fn.apply(thisArg, arguments);
570
- };
571
- }
572
-
573
- // utils is a library of generic helper functions non-specific to axios
574
-
575
- const {toString: toString$1} = Object.prototype;
576
- const {getPrototypeOf: getPrototypeOf$1} = Object;
577
-
578
- const kindOf$1 = (cache => thing => {
579
- const str = toString$1.call(thing);
580
- return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
581
- })(Object.create(null));
582
-
583
- const kindOfTest$1 = (type) => {
584
- type = type.toLowerCase();
585
- return (thing) => kindOf$1(thing) === type
586
- };
587
-
588
- const typeOfTest$1 = type => thing => typeof thing === type;
589
-
590
- /**
591
- * Determine if a value is an Array
592
- *
593
- * @param {Object} val The value to test
594
- *
595
- * @returns {boolean} True if value is an Array, otherwise false
596
- */
597
- const {isArray: isArray$1} = Array;
598
-
599
- /**
600
- * Determine if a value is undefined
601
- *
602
- * @param {*} val The value to test
603
- *
604
- * @returns {boolean} True if the value is undefined, otherwise false
605
- */
606
- const isUndefined$1 = typeOfTest$1('undefined');
607
-
608
- /**
609
- * Determine if a value is a Buffer
610
- *
611
- * @param {*} val The value to test
612
- *
613
- * @returns {boolean} True if value is a Buffer, otherwise false
614
- */
615
- function isBuffer$1(val) {
616
- return val !== null && !isUndefined$1(val) && val.constructor !== null && !isUndefined$1(val.constructor)
617
- && isFunction$1(val.constructor.isBuffer) && val.constructor.isBuffer(val);
618
- }
619
-
620
- /**
621
- * Determine if a value is an ArrayBuffer
622
- *
623
- * @param {*} val The value to test
624
- *
625
- * @returns {boolean} True if value is an ArrayBuffer, otherwise false
626
- */
627
- const isArrayBuffer$1 = kindOfTest$1('ArrayBuffer');
628
-
629
-
630
- /**
631
- * Determine if a value is a view on an ArrayBuffer
632
- *
633
- * @param {*} val The value to test
634
- *
635
- * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
636
- */
637
- function isArrayBufferView$1(val) {
638
- let result;
639
- if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
640
- result = ArrayBuffer.isView(val);
641
- } else {
642
- result = (val) && (val.buffer) && (isArrayBuffer$1(val.buffer));
643
- }
644
- return result;
645
- }
646
-
647
- /**
648
- * Determine if a value is a String
649
- *
650
- * @param {*} val The value to test
651
- *
652
- * @returns {boolean} True if value is a String, otherwise false
653
- */
654
- const isString$1 = typeOfTest$1('string');
655
-
656
- /**
657
- * Determine if a value is a Function
658
- *
659
- * @param {*} val The value to test
660
- * @returns {boolean} True if value is a Function, otherwise false
661
- */
662
- const isFunction$1 = typeOfTest$1('function');
663
-
664
- /**
665
- * Determine if a value is a Number
666
- *
667
- * @param {*} val The value to test
668
- *
669
- * @returns {boolean} True if value is a Number, otherwise false
670
- */
671
- const isNumber$1 = typeOfTest$1('number');
672
-
673
- /**
674
- * Determine if a value is an Object
675
- *
676
- * @param {*} thing The value to test
677
- *
678
- * @returns {boolean} True if value is an Object, otherwise false
679
- */
680
- const isObject$1 = (thing) => thing !== null && typeof thing === 'object';
681
-
682
- /**
683
- * Determine if a value is a Boolean
684
- *
685
- * @param {*} thing The value to test
686
- * @returns {boolean} True if value is a Boolean, otherwise false
687
- */
688
- const isBoolean$1 = thing => thing === true || thing === false;
689
-
690
- /**
691
- * Determine if a value is a plain Object
692
- *
693
- * @param {*} val The value to test
694
- *
695
- * @returns {boolean} True if value is a plain Object, otherwise false
696
- */
697
- const isPlainObject$1 = (val) => {
698
- if (kindOf$1(val) !== 'object') {
699
- return false;
700
- }
701
-
702
- const prototype = getPrototypeOf$1(val);
703
- return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val);
704
- };
705
-
706
- /**
707
- * Determine if a value is a Date
708
- *
709
- * @param {*} val The value to test
710
- *
711
- * @returns {boolean} True if value is a Date, otherwise false
712
- */
713
- const isDate$1 = kindOfTest$1('Date');
714
-
715
- /**
716
- * Determine if a value is a File
717
- *
718
- * @param {*} val The value to test
719
- *
720
- * @returns {boolean} True if value is a File, otherwise false
721
- */
722
- const isFile$1 = kindOfTest$1('File');
723
-
724
- /**
725
- * Determine if a value is a Blob
726
- *
727
- * @param {*} val The value to test
728
- *
729
- * @returns {boolean} True if value is a Blob, otherwise false
730
- */
731
- const isBlob$1 = kindOfTest$1('Blob');
732
-
733
- /**
734
- * Determine if a value is a FileList
735
- *
736
- * @param {*} val The value to test
737
- *
738
- * @returns {boolean} True if value is a File, otherwise false
739
- */
740
- const isFileList$1 = kindOfTest$1('FileList');
741
-
742
- /**
743
- * Determine if a value is a Stream
744
- *
745
- * @param {*} val The value to test
746
- *
747
- * @returns {boolean} True if value is a Stream, otherwise false
748
- */
749
- const isStream$1 = (val) => isObject$1(val) && isFunction$1(val.pipe);
750
-
751
- /**
752
- * Determine if a value is a FormData
753
- *
754
- * @param {*} thing The value to test
755
- *
756
- * @returns {boolean} True if value is an FormData, otherwise false
757
- */
758
- const isFormData$1 = (thing) => {
759
- let kind;
760
- return thing && (
761
- (typeof FormData === 'function' && thing instanceof FormData) || (
762
- isFunction$1(thing.append) && (
763
- (kind = kindOf$1(thing)) === 'formdata' ||
764
- // detect form-data instance
765
- (kind === 'object' && isFunction$1(thing.toString) && thing.toString() === '[object FormData]')
766
- )
767
- )
768
- )
769
- };
770
-
771
- /**
772
- * Determine if a value is a URLSearchParams object
773
- *
774
- * @param {*} val The value to test
775
- *
776
- * @returns {boolean} True if value is a URLSearchParams object, otherwise false
777
- */
778
- const isURLSearchParams$1 = kindOfTest$1('URLSearchParams');
779
-
780
- /**
781
- * Trim excess whitespace off the beginning and end of a string
782
- *
783
- * @param {String} str The String to trim
784
- *
785
- * @returns {String} The String freed of excess whitespace
786
- */
787
- const trim$1 = (str) => str.trim ?
788
- str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
789
-
790
- /**
791
- * Iterate over an Array or an Object invoking a function for each item.
792
- *
793
- * If `obj` is an Array callback will be called passing
794
- * the value, index, and complete array for each item.
795
- *
796
- * If 'obj' is an Object callback will be called passing
797
- * the value, key, and complete object for each property.
798
- *
799
- * @param {Object|Array} obj The object to iterate
800
- * @param {Function} fn The callback to invoke for each item
801
- *
802
- * @param {Boolean} [allOwnKeys = false]
803
- * @returns {any}
804
- */
805
- function forEach$1(obj, fn, {allOwnKeys = false} = {}) {
806
- // Don't bother if no value provided
807
- if (obj === null || typeof obj === 'undefined') {
808
- return;
809
- }
810
-
811
- let i;
812
- let l;
813
-
814
- // Force an array if not already something iterable
815
- if (typeof obj !== 'object') {
816
- /*eslint no-param-reassign:0*/
817
- obj = [obj];
818
- }
819
-
820
- if (isArray$1(obj)) {
821
- // Iterate over array values
822
- for (i = 0, l = obj.length; i < l; i++) {
823
- fn.call(null, obj[i], i, obj);
824
- }
825
- } else {
826
- // Iterate over object keys
827
- const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
828
- const len = keys.length;
829
- let key;
830
-
831
- for (i = 0; i < len; i++) {
832
- key = keys[i];
833
- fn.call(null, obj[key], key, obj);
834
- }
835
- }
836
- }
837
-
838
- function findKey$1(obj, key) {
839
- key = key.toLowerCase();
840
- const keys = Object.keys(obj);
841
- let i = keys.length;
842
- let _key;
843
- while (i-- > 0) {
844
- _key = keys[i];
845
- if (key === _key.toLowerCase()) {
846
- return _key;
847
- }
848
- }
849
- return null;
850
- }
851
-
852
- const _global$1 = (() => {
853
- /*eslint no-undef:0*/
854
- if (typeof globalThis !== "undefined") return globalThis;
855
- return typeof self !== "undefined" ? self : (typeof window !== 'undefined' ? window : global)
856
- })();
857
-
858
- const isContextDefined$1 = (context) => !isUndefined$1(context) && context !== _global$1;
859
-
860
- /**
861
- * Accepts varargs expecting each argument to be an object, then
862
- * immutably merges the properties of each object and returns result.
863
- *
864
- * When multiple objects contain the same key the later object in
865
- * the arguments list will take precedence.
866
- *
867
- * Example:
868
- *
869
- * ```js
870
- * var result = merge({foo: 123}, {foo: 456});
871
- * console.log(result.foo); // outputs 456
872
- * ```
873
- *
874
- * @param {Object} obj1 Object to merge
875
- *
876
- * @returns {Object} Result of all merge properties
877
- */
878
- function merge$1(/* obj1, obj2, obj3, ... */) {
879
- const {caseless} = isContextDefined$1(this) && this || {};
880
- const result = {};
881
- const assignValue = (val, key) => {
882
- const targetKey = caseless && findKey$1(result, key) || key;
883
- if (isPlainObject$1(result[targetKey]) && isPlainObject$1(val)) {
884
- result[targetKey] = merge$1(result[targetKey], val);
885
- } else if (isPlainObject$1(val)) {
886
- result[targetKey] = merge$1({}, val);
887
- } else if (isArray$1(val)) {
888
- result[targetKey] = val.slice();
889
- } else {
890
- result[targetKey] = val;
891
- }
892
- };
893
-
894
- for (let i = 0, l = arguments.length; i < l; i++) {
895
- arguments[i] && forEach$1(arguments[i], assignValue);
896
- }
897
- return result;
898
- }
899
-
900
- /**
901
- * Extends object a by mutably adding to it the properties of object b.
902
- *
903
- * @param {Object} a The object to be extended
904
- * @param {Object} b The object to copy properties from
905
- * @param {Object} thisArg The object to bind function to
906
- *
907
- * @param {Boolean} [allOwnKeys]
908
- * @returns {Object} The resulting value of object a
909
- */
910
- const extend$1 = (a, b, thisArg, {allOwnKeys}= {}) => {
911
- forEach$1(b, (val, key) => {
912
- if (thisArg && isFunction$1(val)) {
913
- a[key] = bind$1(val, thisArg);
914
- } else {
915
- a[key] = val;
916
- }
917
- }, {allOwnKeys});
918
- return a;
919
- };
920
-
921
- /**
922
- * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
923
- *
924
- * @param {string} content with BOM
925
- *
926
- * @returns {string} content value without BOM
927
- */
928
- const stripBOM$1 = (content) => {
929
- if (content.charCodeAt(0) === 0xFEFF) {
930
- content = content.slice(1);
931
- }
932
- return content;
933
- };
934
-
935
- /**
936
- * Inherit the prototype methods from one constructor into another
937
- * @param {function} constructor
938
- * @param {function} superConstructor
939
- * @param {object} [props]
940
- * @param {object} [descriptors]
941
- *
942
- * @returns {void}
943
- */
944
- const inherits$1 = (constructor, superConstructor, props, descriptors) => {
945
- constructor.prototype = Object.create(superConstructor.prototype, descriptors);
946
- constructor.prototype.constructor = constructor;
947
- Object.defineProperty(constructor, 'super', {
948
- value: superConstructor.prototype
949
- });
950
- props && Object.assign(constructor.prototype, props);
951
- };
952
-
953
- /**
954
- * Resolve object with deep prototype chain to a flat object
955
- * @param {Object} sourceObj source object
956
- * @param {Object} [destObj]
957
- * @param {Function|Boolean} [filter]
958
- * @param {Function} [propFilter]
959
- *
960
- * @returns {Object}
961
- */
962
- const toFlatObject$1 = (sourceObj, destObj, filter, propFilter) => {
963
- let props;
964
- let i;
965
- let prop;
966
- const merged = {};
967
-
968
- destObj = destObj || {};
969
- // eslint-disable-next-line no-eq-null,eqeqeq
970
- if (sourceObj == null) return destObj;
971
-
972
- do {
973
- props = Object.getOwnPropertyNames(sourceObj);
974
- i = props.length;
975
- while (i-- > 0) {
976
- prop = props[i];
977
- if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
978
- destObj[prop] = sourceObj[prop];
979
- merged[prop] = true;
980
- }
981
- }
982
- sourceObj = filter !== false && getPrototypeOf$1(sourceObj);
983
- } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);
984
-
985
- return destObj;
986
- };
987
-
988
- /**
989
- * Determines whether a string ends with the characters of a specified string
990
- *
991
- * @param {String} str
992
- * @param {String} searchString
993
- * @param {Number} [position= 0]
994
- *
995
- * @returns {boolean}
996
- */
997
- const endsWith$1 = (str, searchString, position) => {
998
- str = String(str);
999
- if (position === undefined || position > str.length) {
1000
- position = str.length;
1001
- }
1002
- position -= searchString.length;
1003
- const lastIndex = str.indexOf(searchString, position);
1004
- return lastIndex !== -1 && lastIndex === position;
1005
- };
1006
-
1007
-
1008
- /**
1009
- * Returns new array from array like object or null if failed
1010
- *
1011
- * @param {*} [thing]
1012
- *
1013
- * @returns {?Array}
1014
- */
1015
- const toArray$1 = (thing) => {
1016
- if (!thing) return null;
1017
- if (isArray$1(thing)) return thing;
1018
- let i = thing.length;
1019
- if (!isNumber$1(i)) return null;
1020
- const arr = new Array(i);
1021
- while (i-- > 0) {
1022
- arr[i] = thing[i];
1023
- }
1024
- return arr;
1025
- };
1026
-
1027
- /**
1028
- * Checking if the Uint8Array exists and if it does, it returns a function that checks if the
1029
- * thing passed in is an instance of Uint8Array
1030
- *
1031
- * @param {TypedArray}
1032
- *
1033
- * @returns {Array}
1034
- */
1035
- // eslint-disable-next-line func-names
1036
- const isTypedArray$1 = (TypedArray => {
1037
- // eslint-disable-next-line func-names
1038
- return thing => {
1039
- return TypedArray && thing instanceof TypedArray;
1040
- };
1041
- })(typeof Uint8Array !== 'undefined' && getPrototypeOf$1(Uint8Array));
1042
-
1043
- /**
1044
- * For each entry in the object, call the function with the key and value.
1045
- *
1046
- * @param {Object<any, any>} obj - The object to iterate over.
1047
- * @param {Function} fn - The function to call for each entry.
1048
- *
1049
- * @returns {void}
1050
- */
1051
- const forEachEntry$1 = (obj, fn) => {
1052
- const generator = obj && obj[Symbol.iterator];
1053
-
1054
- const iterator = generator.call(obj);
1055
-
1056
- let result;
1057
-
1058
- while ((result = iterator.next()) && !result.done) {
1059
- const pair = result.value;
1060
- fn.call(obj, pair[0], pair[1]);
1061
- }
1062
- };
1063
-
1064
- /**
1065
- * It takes a regular expression and a string, and returns an array of all the matches
1066
- *
1067
- * @param {string} regExp - The regular expression to match against.
1068
- * @param {string} str - The string to search.
1069
- *
1070
- * @returns {Array<boolean>}
1071
- */
1072
- const matchAll$1 = (regExp, str) => {
1073
- let matches;
1074
- const arr = [];
1075
-
1076
- while ((matches = regExp.exec(str)) !== null) {
1077
- arr.push(matches);
1078
- }
1079
-
1080
- return arr;
1081
- };
1082
-
1083
- /* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */
1084
- const isHTMLForm$1 = kindOfTest$1('HTMLFormElement');
1085
-
1086
- const toCamelCase$1 = str => {
1087
- return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,
1088
- function replacer(m, p1, p2) {
1089
- return p1.toUpperCase() + p2;
1090
- }
1091
- );
1092
- };
1093
-
1094
- /* Creating a function that will check if an object has a property. */
1095
- const hasOwnProperty$1 = (({hasOwnProperty}) => (obj, prop) => hasOwnProperty.call(obj, prop))(Object.prototype);
1096
-
1097
- /**
1098
- * Determine if a value is a RegExp object
1099
- *
1100
- * @param {*} val The value to test
1101
- *
1102
- * @returns {boolean} True if value is a RegExp object, otherwise false
1103
- */
1104
- const isRegExp$1 = kindOfTest$1('RegExp');
1105
-
1106
- const reduceDescriptors$1 = (obj, reducer) => {
1107
- const descriptors = Object.getOwnPropertyDescriptors(obj);
1108
- const reducedDescriptors = {};
1109
-
1110
- forEach$1(descriptors, (descriptor, name) => {
1111
- if (reducer(descriptor, name, obj) !== false) {
1112
- reducedDescriptors[name] = descriptor;
1113
- }
1114
- });
1115
-
1116
- Object.defineProperties(obj, reducedDescriptors);
1117
- };
1118
-
1119
- /**
1120
- * Makes all methods read-only
1121
- * @param {Object} obj
1122
- */
1123
-
1124
- const freezeMethods$1 = (obj) => {
1125
- reduceDescriptors$1(obj, (descriptor, name) => {
1126
- // skip restricted props in strict mode
1127
- if (isFunction$1(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
1128
- return false;
1129
- }
1130
-
1131
- const value = obj[name];
1132
-
1133
- if (!isFunction$1(value)) return;
1134
-
1135
- descriptor.enumerable = false;
1136
-
1137
- if ('writable' in descriptor) {
1138
- descriptor.writable = false;
1139
- return;
1140
- }
1141
-
1142
- if (!descriptor.set) {
1143
- descriptor.set = () => {
1144
- throw Error('Can not rewrite read-only method \'' + name + '\'');
1145
- };
1146
- }
1147
- });
1148
- };
1149
-
1150
- const toObjectSet$1 = (arrayOrString, delimiter) => {
1151
- const obj = {};
1152
-
1153
- const define = (arr) => {
1154
- arr.forEach(value => {
1155
- obj[value] = true;
1156
- });
1157
- };
1158
-
1159
- isArray$1(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));
1160
-
1161
- return obj;
1162
- };
1163
-
1164
- const noop$1 = () => {};
1165
-
1166
- const toFiniteNumber$1 = (value, defaultValue) => {
1167
- value = +value;
1168
- return Number.isFinite(value) ? value : defaultValue;
1169
- };
1170
-
1171
- const ALPHA$1 = 'abcdefghijklmnopqrstuvwxyz';
1172
-
1173
- const DIGIT$1 = '0123456789';
1174
-
1175
- const ALPHABET$1 = {
1176
- DIGIT: DIGIT$1,
1177
- ALPHA: ALPHA$1,
1178
- ALPHA_DIGIT: ALPHA$1 + ALPHA$1.toUpperCase() + DIGIT$1
1179
- };
1180
-
1181
- const generateString$1 = (size = 16, alphabet = ALPHABET$1.ALPHA_DIGIT) => {
1182
- let str = '';
1183
- const {length} = alphabet;
1184
- while (size--) {
1185
- str += alphabet[Math.random() * length|0];
1186
- }
1187
-
1188
- return str;
1189
- };
1190
-
1191
- /**
1192
- * If the thing is a FormData object, return true, otherwise return false.
1193
- *
1194
- * @param {unknown} thing - The thing to check.
1195
- *
1196
- * @returns {boolean}
1197
- */
1198
- function isSpecCompliantForm$1(thing) {
1199
- return !!(thing && isFunction$1(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator]);
1200
- }
1201
-
1202
- const toJSONObject$1 = (obj) => {
1203
- const stack = new Array(10);
1204
-
1205
- const visit = (source, i) => {
1206
-
1207
- if (isObject$1(source)) {
1208
- if (stack.indexOf(source) >= 0) {
1209
- return;
1210
- }
1211
-
1212
- if(!('toJSON' in source)) {
1213
- stack[i] = source;
1214
- const target = isArray$1(source) ? [] : {};
1215
-
1216
- forEach$1(source, (value, key) => {
1217
- const reducedValue = visit(value, i + 1);
1218
- !isUndefined$1(reducedValue) && (target[key] = reducedValue);
1219
- });
1220
-
1221
- stack[i] = undefined;
1222
-
1223
- return target;
1224
- }
1225
- }
1226
-
1227
- return source;
1228
- };
1229
-
1230
- return visit(obj, 0);
1231
- };
1232
-
1233
- const isAsyncFn$1 = kindOfTest$1('AsyncFunction');
1234
-
1235
- const isThenable$1 = (thing) =>
1236
- thing && (isObject$1(thing) || isFunction$1(thing)) && isFunction$1(thing.then) && isFunction$1(thing.catch);
1237
-
1238
- var utils$1 = {
1239
- isArray: isArray$1,
1240
- isArrayBuffer: isArrayBuffer$1,
1241
- isBuffer: isBuffer$1,
1242
- isFormData: isFormData$1,
1243
- isArrayBufferView: isArrayBufferView$1,
1244
- isString: isString$1,
1245
- isNumber: isNumber$1,
1246
- isBoolean: isBoolean$1,
1247
- isObject: isObject$1,
1248
- isPlainObject: isPlainObject$1,
1249
- isUndefined: isUndefined$1,
1250
- isDate: isDate$1,
1251
- isFile: isFile$1,
1252
- isBlob: isBlob$1,
1253
- isRegExp: isRegExp$1,
1254
- isFunction: isFunction$1,
1255
- isStream: isStream$1,
1256
- isURLSearchParams: isURLSearchParams$1,
1257
- isTypedArray: isTypedArray$1,
1258
- isFileList: isFileList$1,
1259
- forEach: forEach$1,
1260
- merge: merge$1,
1261
- extend: extend$1,
1262
- trim: trim$1,
1263
- stripBOM: stripBOM$1,
1264
- inherits: inherits$1,
1265
- toFlatObject: toFlatObject$1,
1266
- kindOf: kindOf$1,
1267
- kindOfTest: kindOfTest$1,
1268
- endsWith: endsWith$1,
1269
- toArray: toArray$1,
1270
- forEachEntry: forEachEntry$1,
1271
- matchAll: matchAll$1,
1272
- isHTMLForm: isHTMLForm$1,
1273
- hasOwnProperty: hasOwnProperty$1,
1274
- hasOwnProp: hasOwnProperty$1, // an alias to avoid ESLint no-prototype-builtins detection
1275
- reduceDescriptors: reduceDescriptors$1,
1276
- freezeMethods: freezeMethods$1,
1277
- toObjectSet: toObjectSet$1,
1278
- toCamelCase: toCamelCase$1,
1279
- noop: noop$1,
1280
- toFiniteNumber: toFiniteNumber$1,
1281
- findKey: findKey$1,
1282
- global: _global$1,
1283
- isContextDefined: isContextDefined$1,
1284
- ALPHABET: ALPHABET$1,
1285
- generateString: generateString$1,
1286
- isSpecCompliantForm: isSpecCompliantForm$1,
1287
- toJSONObject: toJSONObject$1,
1288
- isAsyncFn: isAsyncFn$1,
1289
- isThenable: isThenable$1
1290
- };
1291
-
1292
- /**
1293
- * Create an Error with the specified message, config, error code, request and response.
1294
- *
1295
- * @param {string} message The error message.
1296
- * @param {string} [code] The error code (for example, 'ECONNABORTED').
1297
- * @param {Object} [config] The config.
1298
- * @param {Object} [request] The request.
1299
- * @param {Object} [response] The response.
1300
- *
1301
- * @returns {Error} The created error.
1302
- */
1303
- function AxiosError$1(message, code, config, request, response) {
1304
- Error.call(this);
1305
-
1306
- if (Error.captureStackTrace) {
1307
- Error.captureStackTrace(this, this.constructor);
1308
- } else {
1309
- this.stack = (new Error()).stack;
1310
- }
1311
-
1312
- this.message = message;
1313
- this.name = 'AxiosError';
1314
- code && (this.code = code);
1315
- config && (this.config = config);
1316
- request && (this.request = request);
1317
- response && (this.response = response);
1318
- }
1319
-
1320
- utils$1.inherits(AxiosError$1, Error, {
1321
- toJSON: function toJSON() {
1322
- return {
1323
- // Standard
1324
- message: this.message,
1325
- name: this.name,
1326
- // Microsoft
1327
- description: this.description,
1328
- number: this.number,
1329
- // Mozilla
1330
- fileName: this.fileName,
1331
- lineNumber: this.lineNumber,
1332
- columnNumber: this.columnNumber,
1333
- stack: this.stack,
1334
- // Axios
1335
- config: utils$1.toJSONObject(this.config),
1336
- code: this.code,
1337
- status: this.response && this.response.status ? this.response.status : null
1338
- };
1339
- }
1340
- });
1341
-
1342
- const prototype$1$1 = AxiosError$1.prototype;
1343
- const descriptors$1 = {};
1344
-
1345
- [
1346
- 'ERR_BAD_OPTION_VALUE',
1347
- 'ERR_BAD_OPTION',
1348
- 'ECONNABORTED',
1349
- 'ETIMEDOUT',
1350
- 'ERR_NETWORK',
1351
- 'ERR_FR_TOO_MANY_REDIRECTS',
1352
- 'ERR_DEPRECATED',
1353
- 'ERR_BAD_RESPONSE',
1354
- 'ERR_BAD_REQUEST',
1355
- 'ERR_CANCELED',
1356
- 'ERR_NOT_SUPPORT',
1357
- 'ERR_INVALID_URL'
1358
- // eslint-disable-next-line func-names
1359
- ].forEach(code => {
1360
- descriptors$1[code] = {value: code};
1361
- });
1362
-
1363
- Object.defineProperties(AxiosError$1, descriptors$1);
1364
- Object.defineProperty(prototype$1$1, 'isAxiosError', {value: true});
1365
-
1366
- // eslint-disable-next-line func-names
1367
- AxiosError$1.from = (error, code, config, request, response, customProps) => {
1368
- const axiosError = Object.create(prototype$1$1);
1369
-
1370
- utils$1.toFlatObject(error, axiosError, function filter(obj) {
1371
- return obj !== Error.prototype;
1372
- }, prop => {
1373
- return prop !== 'isAxiosError';
1374
- });
1375
-
1376
- AxiosError$1.call(axiosError, error.message, code, config, request, response);
1377
-
1378
- axiosError.cause = error;
1379
-
1380
- axiosError.name = error.name;
1381
-
1382
- customProps && Object.assign(axiosError, customProps);
1383
-
1384
- return axiosError;
1385
- };
1386
-
1387
- // eslint-disable-next-line strict
1388
- var httpAdapter$1 = null;
1389
-
1390
- /**
1391
- * Determines if the given thing is a array or js object.
1392
- *
1393
- * @param {string} thing - The object or array to be visited.
1394
- *
1395
- * @returns {boolean}
1396
- */
1397
- function isVisitable$1(thing) {
1398
- return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
1399
- }
1400
-
1401
- /**
1402
- * It removes the brackets from the end of a string
1403
- *
1404
- * @param {string} key - The key of the parameter.
1405
- *
1406
- * @returns {string} the key without the brackets.
1407
- */
1408
- function removeBrackets$1(key) {
1409
- return utils$1.endsWith(key, '[]') ? key.slice(0, -2) : key;
1410
- }
1411
-
1412
- /**
1413
- * It takes a path, a key, and a boolean, and returns a string
1414
- *
1415
- * @param {string} path - The path to the current key.
1416
- * @param {string} key - The key of the current object being iterated over.
1417
- * @param {string} dots - If true, the key will be rendered with dots instead of brackets.
1418
- *
1419
- * @returns {string} The path to the current key.
1420
- */
1421
- function renderKey$1(path, key, dots) {
1422
- if (!path) return key;
1423
- return path.concat(key).map(function each(token, i) {
1424
- // eslint-disable-next-line no-param-reassign
1425
- token = removeBrackets$1(token);
1426
- return !dots && i ? '[' + token + ']' : token;
1427
- }).join(dots ? '.' : '');
1428
- }
1429
-
1430
- /**
1431
- * If the array is an array and none of its elements are visitable, then it's a flat array.
1432
- *
1433
- * @param {Array<any>} arr - The array to check
1434
- *
1435
- * @returns {boolean}
1436
- */
1437
- function isFlatArray$1(arr) {
1438
- return utils$1.isArray(arr) && !arr.some(isVisitable$1);
1439
- }
1440
-
1441
- const predicates$1 = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) {
1442
- return /^is[A-Z]/.test(prop);
1443
- });
1444
-
1445
- /**
1446
- * Convert a data object to FormData
1447
- *
1448
- * @param {Object} obj
1449
- * @param {?Object} [formData]
1450
- * @param {?Object} [options]
1451
- * @param {Function} [options.visitor]
1452
- * @param {Boolean} [options.metaTokens = true]
1453
- * @param {Boolean} [options.dots = false]
1454
- * @param {?Boolean} [options.indexes = false]
1455
- *
1456
- * @returns {Object}
1457
- **/
1458
-
1459
- /**
1460
- * It converts an object into a FormData object
1461
- *
1462
- * @param {Object<any, any>} obj - The object to convert to form data.
1463
- * @param {string} formData - The FormData object to append to.
1464
- * @param {Object<string, any>} options
1465
- *
1466
- * @returns
1467
- */
1468
- function toFormData$1(obj, formData, options) {
1469
- if (!utils$1.isObject(obj)) {
1470
- throw new TypeError('target must be an object');
1471
- }
1472
-
1473
- // eslint-disable-next-line no-param-reassign
1474
- formData = formData || new (FormData)();
1475
-
1476
- // eslint-disable-next-line no-param-reassign
1477
- options = utils$1.toFlatObject(options, {
1478
- metaTokens: true,
1479
- dots: false,
1480
- indexes: false
1481
- }, false, function defined(option, source) {
1482
- // eslint-disable-next-line no-eq-null,eqeqeq
1483
- return !utils$1.isUndefined(source[option]);
1484
- });
1485
-
1486
- const metaTokens = options.metaTokens;
1487
- // eslint-disable-next-line no-use-before-define
1488
- const visitor = options.visitor || defaultVisitor;
1489
- const dots = options.dots;
1490
- const indexes = options.indexes;
1491
- const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
1492
- const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
1493
-
1494
- if (!utils$1.isFunction(visitor)) {
1495
- throw new TypeError('visitor must be a function');
1496
- }
1497
-
1498
- function convertValue(value) {
1499
- if (value === null) return '';
1500
-
1501
- if (utils$1.isDate(value)) {
1502
- return value.toISOString();
1503
- }
1504
-
1505
- if (!useBlob && utils$1.isBlob(value)) {
1506
- throw new AxiosError$1('Blob is not supported. Use a Buffer instead.');
1507
- }
1508
-
1509
- if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
1510
- return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
1511
- }
1512
-
1513
- return value;
1514
- }
1515
-
1516
- /**
1517
- * Default visitor.
1518
- *
1519
- * @param {*} value
1520
- * @param {String|Number} key
1521
- * @param {Array<String|Number>} path
1522
- * @this {FormData}
1523
- *
1524
- * @returns {boolean} return true to visit the each prop of the value recursively
1525
- */
1526
- function defaultVisitor(value, key, path) {
1527
- let arr = value;
1528
-
1529
- if (value && !path && typeof value === 'object') {
1530
- if (utils$1.endsWith(key, '{}')) {
1531
- // eslint-disable-next-line no-param-reassign
1532
- key = metaTokens ? key : key.slice(0, -2);
1533
- // eslint-disable-next-line no-param-reassign
1534
- value = JSON.stringify(value);
1535
- } else if (
1536
- (utils$1.isArray(value) && isFlatArray$1(value)) ||
1537
- ((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value))
1538
- )) {
1539
- // eslint-disable-next-line no-param-reassign
1540
- key = removeBrackets$1(key);
1541
-
1542
- arr.forEach(function each(el, index) {
1543
- !(utils$1.isUndefined(el) || el === null) && formData.append(
1544
- // eslint-disable-next-line no-nested-ternary
1545
- indexes === true ? renderKey$1([key], index, dots) : (indexes === null ? key : key + '[]'),
1546
- convertValue(el)
1547
- );
1548
- });
1549
- return false;
1550
- }
1551
- }
1552
-
1553
- if (isVisitable$1(value)) {
1554
- return true;
1555
- }
1556
-
1557
- formData.append(renderKey$1(path, key, dots), convertValue(value));
1558
-
1559
- return false;
1560
- }
1561
-
1562
- const stack = [];
1563
-
1564
- const exposedHelpers = Object.assign(predicates$1, {
1565
- defaultVisitor,
1566
- convertValue,
1567
- isVisitable: isVisitable$1
1568
- });
1569
-
1570
- function build(value, path) {
1571
- if (utils$1.isUndefined(value)) return;
1572
-
1573
- if (stack.indexOf(value) !== -1) {
1574
- throw Error('Circular reference detected in ' + path.join('.'));
1575
- }
1576
-
1577
- stack.push(value);
1578
-
1579
- utils$1.forEach(value, function each(el, key) {
1580
- const result = !(utils$1.isUndefined(el) || el === null) && visitor.call(
1581
- formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers
1582
- );
1583
-
1584
- if (result === true) {
1585
- build(el, path ? path.concat(key) : [key]);
1586
- }
1587
- });
1588
-
1589
- stack.pop();
1590
- }
1591
-
1592
- if (!utils$1.isObject(obj)) {
1593
- throw new TypeError('data must be an object');
1594
- }
1595
-
1596
- build(obj);
1597
-
1598
- return formData;
1599
- }
1600
-
1601
- /**
1602
- * It encodes a string by replacing all characters that are not in the unreserved set with
1603
- * their percent-encoded equivalents
1604
- *
1605
- * @param {string} str - The string to encode.
1606
- *
1607
- * @returns {string} The encoded string.
1608
- */
1609
- function encode$1$1(str) {
1610
- const charMap = {
1611
- '!': '%21',
1612
- "'": '%27',
1613
- '(': '%28',
1614
- ')': '%29',
1615
- '~': '%7E',
1616
- '%20': '+',
1617
- '%00': '\x00'
1618
- };
1619
- return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
1620
- return charMap[match];
1621
- });
1622
- }
1623
-
1624
- /**
1625
- * It takes a params object and converts it to a FormData object
1626
- *
1627
- * @param {Object<string, any>} params - The parameters to be converted to a FormData object.
1628
- * @param {Object<string, any>} options - The options object passed to the Axios constructor.
1629
- *
1630
- * @returns {void}
1631
- */
1632
- function AxiosURLSearchParams$1(params, options) {
1633
- this._pairs = [];
1634
-
1635
- params && toFormData$1(params, this, options);
1636
- }
1637
-
1638
- const prototype$2 = AxiosURLSearchParams$1.prototype;
1639
-
1640
- prototype$2.append = function append(name, value) {
1641
- this._pairs.push([name, value]);
1642
- };
1643
-
1644
- prototype$2.toString = function toString(encoder) {
1645
- const _encode = encoder ? function(value) {
1646
- return encoder.call(this, value, encode$1$1);
1647
- } : encode$1$1;
1648
-
1649
- return this._pairs.map(function each(pair) {
1650
- return _encode(pair[0]) + '=' + _encode(pair[1]);
1651
- }, '').join('&');
1652
- };
1653
-
1654
- /**
1655
- * It replaces all instances of the characters `:`, `$`, `,`, `+`, `[`, and `]` with their
1656
- * URI encoded counterparts
1657
- *
1658
- * @param {string} val The value to be encoded.
1659
- *
1660
- * @returns {string} The encoded value.
1661
- */
1662
- function encode$2(val) {
1663
- return encodeURIComponent(val).
1664
- replace(/%3A/gi, ':').
1665
- replace(/%24/g, '$').
1666
- replace(/%2C/gi, ',').
1667
- replace(/%20/g, '+').
1668
- replace(/%5B/gi, '[').
1669
- replace(/%5D/gi, ']');
1670
- }
1671
-
1672
- /**
1673
- * Build a URL by appending params to the end
1674
- *
1675
- * @param {string} url The base of the url (e.g., http://www.google.com)
1676
- * @param {object} [params] The params to be appended
1677
- * @param {?object} options
1678
- *
1679
- * @returns {string} The formatted url
1680
- */
1681
- function buildURL$1(url, params, options) {
1682
- /*eslint no-param-reassign:0*/
1683
- if (!params) {
1684
- return url;
1685
- }
1686
-
1687
- const _encode = options && options.encode || encode$2;
1688
-
1689
- const serializeFn = options && options.serialize;
1690
-
1691
- let serializedParams;
1692
-
1693
- if (serializeFn) {
1694
- serializedParams = serializeFn(params, options);
1695
- } else {
1696
- serializedParams = utils$1.isURLSearchParams(params) ?
1697
- params.toString() :
1698
- new AxiosURLSearchParams$1(params, options).toString(_encode);
1699
- }
1700
-
1701
- if (serializedParams) {
1702
- const hashmarkIndex = url.indexOf("#");
1703
-
1704
- if (hashmarkIndex !== -1) {
1705
- url = url.slice(0, hashmarkIndex);
1706
- }
1707
- url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
1708
- }
1709
-
1710
- return url;
1711
- }
1712
-
1713
- let InterceptorManager$2 = class InterceptorManager {
1714
- constructor() {
1715
- this.handlers = [];
1716
- }
1717
-
1718
- /**
1719
- * Add a new interceptor to the stack
1720
- *
1721
- * @param {Function} fulfilled The function to handle `then` for a `Promise`
1722
- * @param {Function} rejected The function to handle `reject` for a `Promise`
1723
- *
1724
- * @return {Number} An ID used to remove interceptor later
1725
- */
1726
- use(fulfilled, rejected, options) {
1727
- this.handlers.push({
1728
- fulfilled,
1729
- rejected,
1730
- synchronous: options ? options.synchronous : false,
1731
- runWhen: options ? options.runWhen : null
1732
- });
1733
- return this.handlers.length - 1;
1734
- }
1735
-
1736
- /**
1737
- * Remove an interceptor from the stack
1738
- *
1739
- * @param {Number} id The ID that was returned by `use`
1740
- *
1741
- * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
1742
- */
1743
- eject(id) {
1744
- if (this.handlers[id]) {
1745
- this.handlers[id] = null;
1746
- }
1747
- }
1748
-
1749
- /**
1750
- * Clear all interceptors from the stack
1751
- *
1752
- * @returns {void}
1753
- */
1754
- clear() {
1755
- if (this.handlers) {
1756
- this.handlers = [];
1757
- }
1758
- }
1759
-
1760
- /**
1761
- * Iterate over all the registered interceptors
1762
- *
1763
- * This method is particularly useful for skipping over any
1764
- * interceptors that may have become `null` calling `eject`.
1765
- *
1766
- * @param {Function} fn The function to call for each interceptor
1767
- *
1768
- * @returns {void}
1769
- */
1770
- forEach(fn) {
1771
- utils$1.forEach(this.handlers, function forEachHandler(h) {
1772
- if (h !== null) {
1773
- fn(h);
1774
- }
1775
- });
1776
- }
1777
- };
1778
-
1779
- var InterceptorManager$1$1 = InterceptorManager$2;
1780
-
1781
- var transitionalDefaults$1 = {
1782
- silentJSONParsing: true,
1783
- forcedJSONParsing: true,
1784
- clarifyTimeoutError: false
1785
- };
1786
-
1787
- var URLSearchParams$1$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams$1;
1788
-
1789
- var FormData$1$1 = typeof FormData !== 'undefined' ? FormData : null;
1790
-
1791
- var Blob$1$1 = typeof Blob !== 'undefined' ? Blob : null;
1792
-
1793
- /**
1794
- * Determine if we're running in a standard browser environment
1795
- *
1796
- * This allows axios to run in a web worker, and react-native.
1797
- * Both environments support XMLHttpRequest, but not fully standard globals.
1798
- *
1799
- * web workers:
1800
- * typeof window -> undefined
1801
- * typeof document -> undefined
1802
- *
1803
- * react-native:
1804
- * navigator.product -> 'ReactNative'
1805
- * nativescript
1806
- * navigator.product -> 'NativeScript' or 'NS'
1807
- *
1808
- * @returns {boolean}
1809
- */
1810
- const isStandardBrowserEnv$1 = (() => {
1811
- let product;
1812
- if (typeof navigator !== 'undefined' && (
1813
- (product = navigator.product) === 'ReactNative' ||
1814
- product === 'NativeScript' ||
1815
- product === 'NS')
1816
- ) {
1817
- return false;
1818
- }
1819
-
1820
- return typeof window !== 'undefined' && typeof document !== 'undefined';
1821
- })();
1822
-
1823
- /**
1824
- * Determine if we're running in a standard browser webWorker environment
1825
- *
1826
- * Although the `isStandardBrowserEnv` method indicates that
1827
- * `allows axios to run in a web worker`, the WebWorker will still be
1828
- * filtered out due to its judgment standard
1829
- * `typeof window !== 'undefined' && typeof document !== 'undefined'`.
1830
- * This leads to a problem when axios post `FormData` in webWorker
1831
- */
1832
- const isStandardBrowserWebWorkerEnv$1 = (() => {
1833
- return (
1834
- typeof WorkerGlobalScope !== 'undefined' &&
1835
- // eslint-disable-next-line no-undef
1836
- self instanceof WorkerGlobalScope &&
1837
- typeof self.importScripts === 'function'
1838
- );
1839
- })();
1840
-
1841
-
1842
- var platform$1 = {
1843
- isBrowser: true,
1844
- classes: {
1845
- URLSearchParams: URLSearchParams$1$1,
1846
- FormData: FormData$1$1,
1847
- Blob: Blob$1$1
1848
- },
1849
- isStandardBrowserEnv: isStandardBrowserEnv$1,
1850
- isStandardBrowserWebWorkerEnv: isStandardBrowserWebWorkerEnv$1,
1851
- protocols: ['http', 'https', 'file', 'blob', 'url', 'data']
1852
- };
1853
-
1854
- function toURLEncodedForm$1(data, options) {
1855
- return toFormData$1(data, new platform$1.classes.URLSearchParams(), Object.assign({
1856
- visitor: function(value, key, path, helpers) {
1857
- if (platform$1.isNode && utils$1.isBuffer(value)) {
1858
- this.append(key, value.toString('base64'));
1859
- return false;
1860
- }
1861
-
1862
- return helpers.defaultVisitor.apply(this, arguments);
1863
- }
1864
- }, options));
1865
- }
1866
-
1867
- /**
1868
- * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']
1869
- *
1870
- * @param {string} name - The name of the property to get.
1871
- *
1872
- * @returns An array of strings.
1873
- */
1874
- function parsePropPath$1(name) {
1875
- // foo[x][y][z]
1876
- // foo.x.y.z
1877
- // foo-x-y-z
1878
- // foo x y z
1879
- return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map(match => {
1880
- return match[0] === '[]' ? '' : match[1] || match[0];
1881
- });
1882
- }
1883
-
1884
- /**
1885
- * Convert an array to an object.
1886
- *
1887
- * @param {Array<any>} arr - The array to convert to an object.
1888
- *
1889
- * @returns An object with the same keys and values as the array.
1890
- */
1891
- function arrayToObject$1(arr) {
1892
- const obj = {};
1893
- const keys = Object.keys(arr);
1894
- let i;
1895
- const len = keys.length;
1896
- let key;
1897
- for (i = 0; i < len; i++) {
1898
- key = keys[i];
1899
- obj[key] = arr[key];
1900
- }
1901
- return obj;
1902
- }
1903
-
1904
- /**
1905
- * It takes a FormData object and returns a JavaScript object
1906
- *
1907
- * @param {string} formData The FormData object to convert to JSON.
1908
- *
1909
- * @returns {Object<string, any> | null} The converted object.
1910
- */
1911
- function formDataToJSON$1(formData) {
1912
- function buildPath(path, value, target, index) {
1913
- let name = path[index++];
1914
- const isNumericKey = Number.isFinite(+name);
1915
- const isLast = index >= path.length;
1916
- name = !name && utils$1.isArray(target) ? target.length : name;
1917
-
1918
- if (isLast) {
1919
- if (utils$1.hasOwnProp(target, name)) {
1920
- target[name] = [target[name], value];
1921
- } else {
1922
- target[name] = value;
1923
- }
1924
-
1925
- return !isNumericKey;
1926
- }
1927
-
1928
- if (!target[name] || !utils$1.isObject(target[name])) {
1929
- target[name] = [];
1930
- }
1931
-
1932
- const result = buildPath(path, value, target[name], index);
1933
-
1934
- if (result && utils$1.isArray(target[name])) {
1935
- target[name] = arrayToObject$1(target[name]);
1936
- }
1937
-
1938
- return !isNumericKey;
1939
- }
1940
-
1941
- if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {
1942
- const obj = {};
1943
-
1944
- utils$1.forEachEntry(formData, (name, value) => {
1945
- buildPath(parsePropPath$1(name), value, obj, 0);
1946
- });
1947
-
1948
- return obj;
1949
- }
1950
-
1951
- return null;
1952
- }
1953
-
1954
- const DEFAULT_CONTENT_TYPE$1 = {
1955
- 'Content-Type': undefined
1956
- };
1957
-
1958
- /**
1959
- * It takes a string, tries to parse it, and if it fails, it returns the stringified version
1960
- * of the input
1961
- *
1962
- * @param {any} rawValue - The value to be stringified.
1963
- * @param {Function} parser - A function that parses a string into a JavaScript object.
1964
- * @param {Function} encoder - A function that takes a value and returns a string.
1965
- *
1966
- * @returns {string} A stringified version of the rawValue.
1967
- */
1968
- function stringifySafely$1(rawValue, parser, encoder) {
1969
- if (utils$1.isString(rawValue)) {
1970
- try {
1971
- (parser || JSON.parse)(rawValue);
1972
- return utils$1.trim(rawValue);
1973
- } catch (e) {
1974
- if (e.name !== 'SyntaxError') {
1975
- throw e;
1976
- }
1977
- }
1978
- }
1979
-
1980
- return (encoder || JSON.stringify)(rawValue);
1981
- }
1982
-
1983
- const defaults$2 = {
1984
-
1985
- transitional: transitionalDefaults$1,
1986
-
1987
- adapter: ['xhr', 'http'],
1988
-
1989
- transformRequest: [function transformRequest(data, headers) {
1990
- const contentType = headers.getContentType() || '';
1991
- const hasJSONContentType = contentType.indexOf('application/json') > -1;
1992
- const isObjectPayload = utils$1.isObject(data);
1993
-
1994
- if (isObjectPayload && utils$1.isHTMLForm(data)) {
1995
- data = new FormData(data);
1996
- }
1997
-
1998
- const isFormData = utils$1.isFormData(data);
1999
-
2000
- if (isFormData) {
2001
- if (!hasJSONContentType) {
2002
- return data;
2003
- }
2004
- return hasJSONContentType ? JSON.stringify(formDataToJSON$1(data)) : data;
2005
- }
2006
-
2007
- if (utils$1.isArrayBuffer(data) ||
2008
- utils$1.isBuffer(data) ||
2009
- utils$1.isStream(data) ||
2010
- utils$1.isFile(data) ||
2011
- utils$1.isBlob(data)
2012
- ) {
2013
- return data;
2014
- }
2015
- if (utils$1.isArrayBufferView(data)) {
2016
- return data.buffer;
2017
- }
2018
- if (utils$1.isURLSearchParams(data)) {
2019
- headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
2020
- return data.toString();
2021
- }
2022
-
2023
- let isFileList;
2024
-
2025
- if (isObjectPayload) {
2026
- if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
2027
- return toURLEncodedForm$1(data, this.formSerializer).toString();
2028
- }
2029
-
2030
- if ((isFileList = utils$1.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
2031
- const _FormData = this.env && this.env.FormData;
2032
-
2033
- return toFormData$1(
2034
- isFileList ? {'files[]': data} : data,
2035
- _FormData && new _FormData(),
2036
- this.formSerializer
2037
- );
2038
- }
2039
- }
2040
-
2041
- if (isObjectPayload || hasJSONContentType ) {
2042
- headers.setContentType('application/json', false);
2043
- return stringifySafely$1(data);
2044
- }
2045
-
2046
- return data;
2047
- }],
2048
-
2049
- transformResponse: [function transformResponse(data) {
2050
- const transitional = this.transitional || defaults$2.transitional;
2051
- const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
2052
- const JSONRequested = this.responseType === 'json';
2053
-
2054
- if (data && utils$1.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
2055
- const silentJSONParsing = transitional && transitional.silentJSONParsing;
2056
- const strictJSONParsing = !silentJSONParsing && JSONRequested;
2057
-
2058
- try {
2059
- return JSON.parse(data);
2060
- } catch (e) {
2061
- if (strictJSONParsing) {
2062
- if (e.name === 'SyntaxError') {
2063
- throw AxiosError$1.from(e, AxiosError$1.ERR_BAD_RESPONSE, this, null, this.response);
2064
- }
2065
- throw e;
2066
- }
2067
- }
2068
- }
2069
-
2070
- return data;
2071
- }],
2072
-
2073
- /**
2074
- * A timeout in milliseconds to abort a request. If set to 0 (default) a
2075
- * timeout is not created.
2076
- */
2077
- timeout: 0,
2078
-
2079
- xsrfCookieName: 'XSRF-TOKEN',
2080
- xsrfHeaderName: 'X-XSRF-TOKEN',
2081
-
2082
- maxContentLength: -1,
2083
- maxBodyLength: -1,
2084
-
2085
- env: {
2086
- FormData: platform$1.classes.FormData,
2087
- Blob: platform$1.classes.Blob
2088
- },
2089
-
2090
- validateStatus: function validateStatus(status) {
2091
- return status >= 200 && status < 300;
2092
- },
2093
-
2094
- headers: {
2095
- common: {
2096
- 'Accept': 'application/json, text/plain, */*'
2097
- }
2098
- }
2099
- };
2100
-
2101
- utils$1.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
2102
- defaults$2.headers[method] = {};
2103
- });
2104
-
2105
- utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
2106
- defaults$2.headers[method] = utils$1.merge(DEFAULT_CONTENT_TYPE$1);
2107
- });
2108
-
2109
- var defaults$1$1 = defaults$2;
2110
-
2111
- // RawAxiosHeaders whose duplicates are ignored by node
2112
- // c.f. https://nodejs.org/api/http.html#http_message_headers
2113
- const ignoreDuplicateOf$1 = utils$1.toObjectSet([
2114
- 'age', 'authorization', 'content-length', 'content-type', 'etag',
2115
- 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
2116
- 'last-modified', 'location', 'max-forwards', 'proxy-authorization',
2117
- 'referer', 'retry-after', 'user-agent'
2118
- ]);
2119
-
2120
- /**
2121
- * Parse headers into an object
2122
- *
2123
- * ```
2124
- * Date: Wed, 27 Aug 2014 08:58:49 GMT
2125
- * Content-Type: application/json
2126
- * Connection: keep-alive
2127
- * Transfer-Encoding: chunked
2128
- * ```
2129
- *
2130
- * @param {String} rawHeaders Headers needing to be parsed
2131
- *
2132
- * @returns {Object} Headers parsed into an object
2133
- */
2134
- var parseHeaders$1 = rawHeaders => {
2135
- const parsed = {};
2136
- let key;
2137
- let val;
2138
- let i;
2139
-
2140
- rawHeaders && rawHeaders.split('\n').forEach(function parser(line) {
2141
- i = line.indexOf(':');
2142
- key = line.substring(0, i).trim().toLowerCase();
2143
- val = line.substring(i + 1).trim();
2144
-
2145
- if (!key || (parsed[key] && ignoreDuplicateOf$1[key])) {
2146
- return;
2147
- }
2148
-
2149
- if (key === 'set-cookie') {
2150
- if (parsed[key]) {
2151
- parsed[key].push(val);
2152
- } else {
2153
- parsed[key] = [val];
2154
- }
2155
- } else {
2156
- parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
2157
- }
2158
- });
2159
-
2160
- return parsed;
2161
- };
2162
-
2163
- const $internals$1 = Symbol('internals');
2164
-
2165
- function normalizeHeader$1(header) {
2166
- return header && String(header).trim().toLowerCase();
2167
- }
2168
-
2169
- function normalizeValue$1(value) {
2170
- if (value === false || value == null) {
2171
- return value;
2172
- }
2173
-
2174
- return utils$1.isArray(value) ? value.map(normalizeValue$1) : String(value);
2175
- }
2176
-
2177
- function parseTokens$1(str) {
2178
- const tokens = Object.create(null);
2179
- const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
2180
- let match;
2181
-
2182
- while ((match = tokensRE.exec(str))) {
2183
- tokens[match[1]] = match[2];
2184
- }
2185
-
2186
- return tokens;
2187
- }
2188
-
2189
- const isValidHeaderName$1 = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
2190
-
2191
- function matchHeaderValue$1(context, value, header, filter, isHeaderNameFilter) {
2192
- if (utils$1.isFunction(filter)) {
2193
- return filter.call(this, value, header);
2194
- }
2195
-
2196
- if (isHeaderNameFilter) {
2197
- value = header;
2198
- }
2199
-
2200
- if (!utils$1.isString(value)) return;
2201
-
2202
- if (utils$1.isString(filter)) {
2203
- return value.indexOf(filter) !== -1;
2204
- }
2205
-
2206
- if (utils$1.isRegExp(filter)) {
2207
- return filter.test(value);
2208
- }
2209
- }
2210
-
2211
- function formatHeader$1(header) {
2212
- return header.trim()
2213
- .toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => {
2214
- return char.toUpperCase() + str;
2215
- });
2216
- }
2217
-
2218
- function buildAccessors$1(obj, header) {
2219
- const accessorName = utils$1.toCamelCase(' ' + header);
2220
-
2221
- ['get', 'set', 'has'].forEach(methodName => {
2222
- Object.defineProperty(obj, methodName + accessorName, {
2223
- value: function(arg1, arg2, arg3) {
2224
- return this[methodName].call(this, header, arg1, arg2, arg3);
2225
- },
2226
- configurable: true
2227
- });
2228
- });
2229
- }
2230
-
2231
- let AxiosHeaders$2 = class AxiosHeaders {
2232
- constructor(headers) {
2233
- headers && this.set(headers);
2234
- }
2235
-
2236
- set(header, valueOrRewrite, rewrite) {
2237
- const self = this;
2238
-
2239
- function setHeader(_value, _header, _rewrite) {
2240
- const lHeader = normalizeHeader$1(_header);
2241
-
2242
- if (!lHeader) {
2243
- throw new Error('header name must be a non-empty string');
2244
- }
2245
-
2246
- const key = utils$1.findKey(self, lHeader);
2247
-
2248
- if(!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) {
2249
- self[key || _header] = normalizeValue$1(_value);
2250
- }
2251
- }
2252
-
2253
- const setHeaders = (headers, _rewrite) =>
2254
- utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
2255
-
2256
- if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
2257
- setHeaders(header, valueOrRewrite);
2258
- } else if(utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName$1(header)) {
2259
- setHeaders(parseHeaders$1(header), valueOrRewrite);
2260
- } else {
2261
- header != null && setHeader(valueOrRewrite, header, rewrite);
2262
- }
2263
-
2264
- return this;
2265
- }
2266
-
2267
- get(header, parser) {
2268
- header = normalizeHeader$1(header);
2269
-
2270
- if (header) {
2271
- const key = utils$1.findKey(this, header);
2272
-
2273
- if (key) {
2274
- const value = this[key];
2275
-
2276
- if (!parser) {
2277
- return value;
2278
- }
2279
-
2280
- if (parser === true) {
2281
- return parseTokens$1(value);
2282
- }
2283
-
2284
- if (utils$1.isFunction(parser)) {
2285
- return parser.call(this, value, key);
2286
- }
2287
-
2288
- if (utils$1.isRegExp(parser)) {
2289
- return parser.exec(value);
2290
- }
2291
-
2292
- throw new TypeError('parser must be boolean|regexp|function');
2293
- }
2294
- }
2295
- }
2296
-
2297
- has(header, matcher) {
2298
- header = normalizeHeader$1(header);
2299
-
2300
- if (header) {
2301
- const key = utils$1.findKey(this, header);
2302
-
2303
- return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue$1(this, this[key], key, matcher)));
2304
- }
2305
-
2306
- return false;
2307
- }
2308
-
2309
- delete(header, matcher) {
2310
- const self = this;
2311
- let deleted = false;
2312
-
2313
- function deleteHeader(_header) {
2314
- _header = normalizeHeader$1(_header);
2315
-
2316
- if (_header) {
2317
- const key = utils$1.findKey(self, _header);
2318
-
2319
- if (key && (!matcher || matchHeaderValue$1(self, self[key], key, matcher))) {
2320
- delete self[key];
2321
-
2322
- deleted = true;
2323
- }
2324
- }
2325
- }
2326
-
2327
- if (utils$1.isArray(header)) {
2328
- header.forEach(deleteHeader);
2329
- } else {
2330
- deleteHeader(header);
2331
- }
2332
-
2333
- return deleted;
2334
- }
2335
-
2336
- clear(matcher) {
2337
- const keys = Object.keys(this);
2338
- let i = keys.length;
2339
- let deleted = false;
2340
-
2341
- while (i--) {
2342
- const key = keys[i];
2343
- if(!matcher || matchHeaderValue$1(this, this[key], key, matcher, true)) {
2344
- delete this[key];
2345
- deleted = true;
2346
- }
2347
- }
2348
-
2349
- return deleted;
2350
- }
2351
-
2352
- normalize(format) {
2353
- const self = this;
2354
- const headers = {};
2355
-
2356
- utils$1.forEach(this, (value, header) => {
2357
- const key = utils$1.findKey(headers, header);
2358
-
2359
- if (key) {
2360
- self[key] = normalizeValue$1(value);
2361
- delete self[header];
2362
- return;
2363
- }
2364
-
2365
- const normalized = format ? formatHeader$1(header) : String(header).trim();
2366
-
2367
- if (normalized !== header) {
2368
- delete self[header];
2369
- }
2370
-
2371
- self[normalized] = normalizeValue$1(value);
2372
-
2373
- headers[normalized] = true;
2374
- });
2375
-
2376
- return this;
2377
- }
2378
-
2379
- concat(...targets) {
2380
- return this.constructor.concat(this, ...targets);
2381
- }
2382
-
2383
- toJSON(asStrings) {
2384
- const obj = Object.create(null);
2385
-
2386
- utils$1.forEach(this, (value, header) => {
2387
- value != null && value !== false && (obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value);
2388
- });
2389
-
2390
- return obj;
2391
- }
2392
-
2393
- [Symbol.iterator]() {
2394
- return Object.entries(this.toJSON())[Symbol.iterator]();
2395
- }
2396
-
2397
- toString() {
2398
- return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\n');
2399
- }
2400
-
2401
- get [Symbol.toStringTag]() {
2402
- return 'AxiosHeaders';
2403
- }
2404
-
2405
- static from(thing) {
2406
- return thing instanceof this ? thing : new this(thing);
2407
- }
2408
-
2409
- static concat(first, ...targets) {
2410
- const computed = new this(first);
2411
-
2412
- targets.forEach((target) => computed.set(target));
2413
-
2414
- return computed;
2415
- }
2416
-
2417
- static accessor(header) {
2418
- const internals = this[$internals$1] = (this[$internals$1] = {
2419
- accessors: {}
2420
- });
2421
-
2422
- const accessors = internals.accessors;
2423
- const prototype = this.prototype;
2424
-
2425
- function defineAccessor(_header) {
2426
- const lHeader = normalizeHeader$1(_header);
2427
-
2428
- if (!accessors[lHeader]) {
2429
- buildAccessors$1(prototype, _header);
2430
- accessors[lHeader] = true;
2431
- }
2432
- }
2433
-
2434
- utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
2435
-
2436
- return this;
2437
- }
2438
- };
2439
-
2440
- AxiosHeaders$2.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);
2441
-
2442
- utils$1.freezeMethods(AxiosHeaders$2.prototype);
2443
- utils$1.freezeMethods(AxiosHeaders$2);
2444
-
2445
- var AxiosHeaders$1$1 = AxiosHeaders$2;
2446
-
2447
- /**
2448
- * Transform the data for a request or a response
2449
- *
2450
- * @param {Array|Function} fns A single function or Array of functions
2451
- * @param {?Object} response The response object
2452
- *
2453
- * @returns {*} The resulting transformed data
2454
- */
2455
- function transformData$1(fns, response) {
2456
- const config = this || defaults$1$1;
2457
- const context = response || config;
2458
- const headers = AxiosHeaders$1$1.from(context.headers);
2459
- let data = context.data;
2460
-
2461
- utils$1.forEach(fns, function transform(fn) {
2462
- data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);
2463
- });
2464
-
2465
- headers.normalize();
2466
-
2467
- return data;
2468
- }
2469
-
2470
- function isCancel$1(value) {
2471
- return !!(value && value.__CANCEL__);
2472
- }
2473
-
2474
- /**
2475
- * A `CanceledError` is an object that is thrown when an operation is canceled.
2476
- *
2477
- * @param {string=} message The message.
2478
- * @param {Object=} config The config.
2479
- * @param {Object=} request The request.
2480
- *
2481
- * @returns {CanceledError} The created error.
2482
- */
2483
- function CanceledError$1(message, config, request) {
2484
- // eslint-disable-next-line no-eq-null,eqeqeq
2485
- AxiosError$1.call(this, message == null ? 'canceled' : message, AxiosError$1.ERR_CANCELED, config, request);
2486
- this.name = 'CanceledError';
2487
- }
2488
-
2489
- utils$1.inherits(CanceledError$1, AxiosError$1, {
2490
- __CANCEL__: true
2491
- });
2492
-
2493
- /**
2494
- * Resolve or reject a Promise based on response status.
2495
- *
2496
- * @param {Function} resolve A function that resolves the promise.
2497
- * @param {Function} reject A function that rejects the promise.
2498
- * @param {object} response The response.
2499
- *
2500
- * @returns {object} The response.
2501
- */
2502
- function settle$1(resolve, reject, response) {
2503
- const validateStatus = response.config.validateStatus;
2504
- if (!response.status || !validateStatus || validateStatus(response.status)) {
2505
- resolve(response);
2506
- } else {
2507
- reject(new AxiosError$1(
2508
- 'Request failed with status code ' + response.status,
2509
- [AxiosError$1.ERR_BAD_REQUEST, AxiosError$1.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
2510
- response.config,
2511
- response.request,
2512
- response
2513
- ));
2514
- }
2515
- }
2516
-
2517
- var cookies$1 = platform$1.isStandardBrowserEnv ?
2518
-
2519
- // Standard browser envs support document.cookie
2520
- (function standardBrowserEnv() {
2521
- return {
2522
- write: function write(name, value, expires, path, domain, secure) {
2523
- const cookie = [];
2524
- cookie.push(name + '=' + encodeURIComponent(value));
2525
-
2526
- if (utils$1.isNumber(expires)) {
2527
- cookie.push('expires=' + new Date(expires).toGMTString());
2528
- }
2529
-
2530
- if (utils$1.isString(path)) {
2531
- cookie.push('path=' + path);
2532
- }
2533
-
2534
- if (utils$1.isString(domain)) {
2535
- cookie.push('domain=' + domain);
2536
- }
2537
-
2538
- if (secure === true) {
2539
- cookie.push('secure');
2540
- }
2541
-
2542
- document.cookie = cookie.join('; ');
2543
- },
2544
-
2545
- read: function read(name) {
2546
- const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
2547
- return (match ? decodeURIComponent(match[3]) : null);
2548
- },
2549
-
2550
- remove: function remove(name) {
2551
- this.write(name, '', Date.now() - 86400000);
2552
- }
2553
- };
2554
- })() :
2555
-
2556
- // Non standard browser env (web workers, react-native) lack needed support.
2557
- (function nonStandardBrowserEnv() {
2558
- return {
2559
- write: function write() {},
2560
- read: function read() { return null; },
2561
- remove: function remove() {}
2562
- };
2563
- })();
2564
-
2565
- /**
2566
- * Determines whether the specified URL is absolute
2567
- *
2568
- * @param {string} url The URL to test
2569
- *
2570
- * @returns {boolean} True if the specified URL is absolute, otherwise false
2571
- */
2572
- function isAbsoluteURL$1(url) {
2573
- // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
2574
- // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
2575
- // by any combination of letters, digits, plus, period, or hyphen.
2576
- return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
2577
- }
2578
-
2579
- /**
2580
- * Creates a new URL by combining the specified URLs
2581
- *
2582
- * @param {string} baseURL The base URL
2583
- * @param {string} relativeURL The relative URL
2584
- *
2585
- * @returns {string} The combined URL
2586
- */
2587
- function combineURLs$1(baseURL, relativeURL) {
2588
- return relativeURL
2589
- ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
2590
- : baseURL;
2591
- }
2592
-
2593
- /**
2594
- * Creates a new URL by combining the baseURL with the requestedURL,
2595
- * only when the requestedURL is not already an absolute URL.
2596
- * If the requestURL is absolute, this function returns the requestedURL untouched.
2597
- *
2598
- * @param {string} baseURL The base URL
2599
- * @param {string} requestedURL Absolute or relative URL to combine
2600
- *
2601
- * @returns {string} The combined full path
2602
- */
2603
- function buildFullPath$1(baseURL, requestedURL) {
2604
- if (baseURL && !isAbsoluteURL$1(requestedURL)) {
2605
- return combineURLs$1(baseURL, requestedURL);
2606
- }
2607
- return requestedURL;
2608
- }
2609
-
2610
- var isURLSameOrigin$1 = platform$1.isStandardBrowserEnv ?
2611
-
2612
- // Standard browser envs have full support of the APIs needed to test
2613
- // whether the request URL is of the same origin as current location.
2614
- (function standardBrowserEnv() {
2615
- const msie = /(msie|trident)/i.test(navigator.userAgent);
2616
- const urlParsingNode = document.createElement('a');
2617
- let originURL;
2618
-
2619
- /**
2620
- * Parse a URL to discover it's components
2621
- *
2622
- * @param {String} url The URL to be parsed
2623
- * @returns {Object}
2624
- */
2625
- function resolveURL(url) {
2626
- let href = url;
2627
-
2628
- if (msie) {
2629
- // IE needs attribute set twice to normalize properties
2630
- urlParsingNode.setAttribute('href', href);
2631
- href = urlParsingNode.href;
2632
- }
2633
-
2634
- urlParsingNode.setAttribute('href', href);
2635
-
2636
- // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
2637
- return {
2638
- href: urlParsingNode.href,
2639
- protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
2640
- host: urlParsingNode.host,
2641
- search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
2642
- hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
2643
- hostname: urlParsingNode.hostname,
2644
- port: urlParsingNode.port,
2645
- pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
2646
- urlParsingNode.pathname :
2647
- '/' + urlParsingNode.pathname
2648
- };
2649
- }
2650
-
2651
- originURL = resolveURL(window.location.href);
2652
-
2653
- /**
2654
- * Determine if a URL shares the same origin as the current location
2655
- *
2656
- * @param {String} requestURL The URL to test
2657
- * @returns {boolean} True if URL shares the same origin, otherwise false
2658
- */
2659
- return function isURLSameOrigin(requestURL) {
2660
- const parsed = (utils$1.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
2661
- return (parsed.protocol === originURL.protocol &&
2662
- parsed.host === originURL.host);
2663
- };
2664
- })() :
2665
-
2666
- // Non standard browser envs (web workers, react-native) lack needed support.
2667
- (function nonStandardBrowserEnv() {
2668
- return function isURLSameOrigin() {
2669
- return true;
2670
- };
2671
- })();
2672
-
2673
- function parseProtocol$1(url) {
2674
- const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
2675
- return match && match[1] || '';
2676
- }
2677
-
2678
- /**
2679
- * Calculate data maxRate
2680
- * @param {Number} [samplesCount= 10]
2681
- * @param {Number} [min= 1000]
2682
- * @returns {Function}
2683
- */
2684
- function speedometer$1(samplesCount, min) {
2685
- samplesCount = samplesCount || 10;
2686
- const bytes = new Array(samplesCount);
2687
- const timestamps = new Array(samplesCount);
2688
- let head = 0;
2689
- let tail = 0;
2690
- let firstSampleTS;
2691
-
2692
- min = min !== undefined ? min : 1000;
2693
-
2694
- return function push(chunkLength) {
2695
- const now = Date.now();
2696
-
2697
- const startedAt = timestamps[tail];
2698
-
2699
- if (!firstSampleTS) {
2700
- firstSampleTS = now;
2701
- }
2702
-
2703
- bytes[head] = chunkLength;
2704
- timestamps[head] = now;
2705
-
2706
- let i = tail;
2707
- let bytesCount = 0;
2708
-
2709
- while (i !== head) {
2710
- bytesCount += bytes[i++];
2711
- i = i % samplesCount;
2712
- }
2713
-
2714
- head = (head + 1) % samplesCount;
2715
-
2716
- if (head === tail) {
2717
- tail = (tail + 1) % samplesCount;
2718
- }
2719
-
2720
- if (now - firstSampleTS < min) {
2721
- return;
2722
- }
2723
-
2724
- const passed = startedAt && now - startedAt;
2725
-
2726
- return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
2727
- };
2728
- }
2729
-
2730
- function progressEventReducer$1(listener, isDownloadStream) {
2731
- let bytesNotified = 0;
2732
- const _speedometer = speedometer$1(50, 250);
2733
-
2734
- return e => {
2735
- const loaded = e.loaded;
2736
- const total = e.lengthComputable ? e.total : undefined;
2737
- const progressBytes = loaded - bytesNotified;
2738
- const rate = _speedometer(progressBytes);
2739
- const inRange = loaded <= total;
2740
-
2741
- bytesNotified = loaded;
2742
-
2743
- const data = {
2744
- loaded,
2745
- total,
2746
- progress: total ? (loaded / total) : undefined,
2747
- bytes: progressBytes,
2748
- rate: rate ? rate : undefined,
2749
- estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
2750
- event: e
2751
- };
2752
-
2753
- data[isDownloadStream ? 'download' : 'upload'] = true;
2754
-
2755
- listener(data);
2756
- };
2757
- }
2758
-
2759
- const isXHRAdapterSupported$1 = typeof XMLHttpRequest !== 'undefined';
2760
-
2761
- var xhrAdapter$1 = isXHRAdapterSupported$1 && function (config) {
2762
- return new Promise(function dispatchXhrRequest(resolve, reject) {
2763
- let requestData = config.data;
2764
- const requestHeaders = AxiosHeaders$1$1.from(config.headers).normalize();
2765
- const responseType = config.responseType;
2766
- let onCanceled;
2767
- function done() {
2768
- if (config.cancelToken) {
2769
- config.cancelToken.unsubscribe(onCanceled);
2770
- }
2771
-
2772
- if (config.signal) {
2773
- config.signal.removeEventListener('abort', onCanceled);
2774
- }
2775
- }
2776
-
2777
- if (utils$1.isFormData(requestData)) {
2778
- if (platform$1.isStandardBrowserEnv || platform$1.isStandardBrowserWebWorkerEnv) {
2779
- requestHeaders.setContentType(false); // Let the browser set it
2780
- } else {
2781
- requestHeaders.setContentType('multipart/form-data;', false); // mobile/desktop app frameworks
2782
- }
2783
- }
2784
-
2785
- let request = new XMLHttpRequest();
2786
-
2787
- // HTTP basic authentication
2788
- if (config.auth) {
2789
- const username = config.auth.username || '';
2790
- const password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';
2791
- requestHeaders.set('Authorization', 'Basic ' + btoa(username + ':' + password));
2792
- }
2793
-
2794
- const fullPath = buildFullPath$1(config.baseURL, config.url);
2795
-
2796
- request.open(config.method.toUpperCase(), buildURL$1(fullPath, config.params, config.paramsSerializer), true);
2797
-
2798
- // Set the request timeout in MS
2799
- request.timeout = config.timeout;
2800
-
2801
- function onloadend() {
2802
- if (!request) {
2803
- return;
2804
- }
2805
- // Prepare the response
2806
- const responseHeaders = AxiosHeaders$1$1.from(
2807
- 'getAllResponseHeaders' in request && request.getAllResponseHeaders()
2808
- );
2809
- const responseData = !responseType || responseType === 'text' || responseType === 'json' ?
2810
- request.responseText : request.response;
2811
- const response = {
2812
- data: responseData,
2813
- status: request.status,
2814
- statusText: request.statusText,
2815
- headers: responseHeaders,
2816
- config,
2817
- request
2818
- };
2819
-
2820
- settle$1(function _resolve(value) {
2821
- resolve(value);
2822
- done();
2823
- }, function _reject(err) {
2824
- reject(err);
2825
- done();
2826
- }, response);
2827
-
2828
- // Clean up request
2829
- request = null;
2830
- }
2831
-
2832
- if ('onloadend' in request) {
2833
- // Use onloadend if available
2834
- request.onloadend = onloadend;
2835
- } else {
2836
- // Listen for ready state to emulate onloadend
2837
- request.onreadystatechange = function handleLoad() {
2838
- if (!request || request.readyState !== 4) {
2839
- return;
2840
- }
2841
-
2842
- // The request errored out and we didn't get a response, this will be
2843
- // handled by onerror instead
2844
- // With one exception: request that using file: protocol, most browsers
2845
- // will return status as 0 even though it's a successful request
2846
- if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
2847
- return;
2848
- }
2849
- // readystate handler is calling before onerror or ontimeout handlers,
2850
- // so we should call onloadend on the next 'tick'
2851
- setTimeout(onloadend);
2852
- };
2853
- }
2854
-
2855
- // Handle browser request cancellation (as opposed to a manual cancellation)
2856
- request.onabort = function handleAbort() {
2857
- if (!request) {
2858
- return;
2859
- }
2860
-
2861
- reject(new AxiosError$1('Request aborted', AxiosError$1.ECONNABORTED, config, request));
2862
-
2863
- // Clean up request
2864
- request = null;
2865
- };
2866
-
2867
- // Handle low level network errors
2868
- request.onerror = function handleError() {
2869
- // Real errors are hidden from us by the browser
2870
- // onerror should only fire if it's a network error
2871
- reject(new AxiosError$1('Network Error', AxiosError$1.ERR_NETWORK, config, request));
2872
-
2873
- // Clean up request
2874
- request = null;
2875
- };
2876
-
2877
- // Handle timeout
2878
- request.ontimeout = function handleTimeout() {
2879
- let timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';
2880
- const transitional = config.transitional || transitionalDefaults$1;
2881
- if (config.timeoutErrorMessage) {
2882
- timeoutErrorMessage = config.timeoutErrorMessage;
2883
- }
2884
- reject(new AxiosError$1(
2885
- timeoutErrorMessage,
2886
- transitional.clarifyTimeoutError ? AxiosError$1.ETIMEDOUT : AxiosError$1.ECONNABORTED,
2887
- config,
2888
- request));
2889
-
2890
- // Clean up request
2891
- request = null;
2892
- };
2893
-
2894
- // Add xsrf header
2895
- // This is only done if running in a standard browser environment.
2896
- // Specifically not if we're in a web worker, or react-native.
2897
- if (platform$1.isStandardBrowserEnv) {
2898
- // Add xsrf header
2899
- const xsrfValue = (config.withCredentials || isURLSameOrigin$1(fullPath))
2900
- && config.xsrfCookieName && cookies$1.read(config.xsrfCookieName);
2901
-
2902
- if (xsrfValue) {
2903
- requestHeaders.set(config.xsrfHeaderName, xsrfValue);
2904
- }
2905
- }
2906
-
2907
- // Remove Content-Type if data is undefined
2908
- requestData === undefined && requestHeaders.setContentType(null);
2909
-
2910
- // Add headers to the request
2911
- if ('setRequestHeader' in request) {
2912
- utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
2913
- request.setRequestHeader(key, val);
2914
- });
2915
- }
2916
-
2917
- // Add withCredentials to request if needed
2918
- if (!utils$1.isUndefined(config.withCredentials)) {
2919
- request.withCredentials = !!config.withCredentials;
2920
- }
2921
-
2922
- // Add responseType to request if needed
2923
- if (responseType && responseType !== 'json') {
2924
- request.responseType = config.responseType;
2925
- }
2926
-
2927
- // Handle progress if needed
2928
- if (typeof config.onDownloadProgress === 'function') {
2929
- request.addEventListener('progress', progressEventReducer$1(config.onDownloadProgress, true));
2930
- }
2931
-
2932
- // Not all browsers support upload events
2933
- if (typeof config.onUploadProgress === 'function' && request.upload) {
2934
- request.upload.addEventListener('progress', progressEventReducer$1(config.onUploadProgress));
2935
- }
2936
-
2937
- if (config.cancelToken || config.signal) {
2938
- // Handle cancellation
2939
- // eslint-disable-next-line func-names
2940
- onCanceled = cancel => {
2941
- if (!request) {
2942
- return;
2943
- }
2944
- reject(!cancel || cancel.type ? new CanceledError$1(null, config, request) : cancel);
2945
- request.abort();
2946
- request = null;
2947
- };
2948
-
2949
- config.cancelToken && config.cancelToken.subscribe(onCanceled);
2950
- if (config.signal) {
2951
- config.signal.aborted ? onCanceled() : config.signal.addEventListener('abort', onCanceled);
2952
- }
2953
- }
2954
-
2955
- const protocol = parseProtocol$1(fullPath);
2956
-
2957
- if (protocol && platform$1.protocols.indexOf(protocol) === -1) {
2958
- reject(new AxiosError$1('Unsupported protocol ' + protocol + ':', AxiosError$1.ERR_BAD_REQUEST, config));
2959
- return;
2960
- }
2961
-
2962
-
2963
- // Send the request
2964
- request.send(requestData || null);
2965
- });
2966
- };
2967
-
2968
- const knownAdapters$1 = {
2969
- http: httpAdapter$1,
2970
- xhr: xhrAdapter$1
2971
- };
2972
-
2973
- utils$1.forEach(knownAdapters$1, (fn, value) => {
2974
- if(fn) {
2975
- try {
2976
- Object.defineProperty(fn, 'name', {value});
2977
- } catch (e) {
2978
- // eslint-disable-next-line no-empty
2979
- }
2980
- Object.defineProperty(fn, 'adapterName', {value});
2981
- }
2982
- });
2983
-
2984
- var adapters$1 = {
2985
- getAdapter: (adapters) => {
2986
- adapters = utils$1.isArray(adapters) ? adapters : [adapters];
2987
-
2988
- const {length} = adapters;
2989
- let nameOrAdapter;
2990
- let adapter;
2991
-
2992
- for (let i = 0; i < length; i++) {
2993
- nameOrAdapter = adapters[i];
2994
- if((adapter = utils$1.isString(nameOrAdapter) ? knownAdapters$1[nameOrAdapter.toLowerCase()] : nameOrAdapter)) {
2995
- break;
2996
- }
2997
- }
2998
-
2999
- if (!adapter) {
3000
- if (adapter === false) {
3001
- throw new AxiosError$1(
3002
- `Adapter ${nameOrAdapter} is not supported by the environment`,
3003
- 'ERR_NOT_SUPPORT'
3004
- );
3005
- }
3006
-
3007
- throw new Error(
3008
- utils$1.hasOwnProp(knownAdapters$1, nameOrAdapter) ?
3009
- `Adapter '${nameOrAdapter}' is not available in the build` :
3010
- `Unknown adapter '${nameOrAdapter}'`
3011
- );
3012
- }
3013
-
3014
- if (!utils$1.isFunction(adapter)) {
3015
- throw new TypeError('adapter is not a function');
3016
- }
3017
-
3018
- return adapter;
3019
- },
3020
- adapters: knownAdapters$1
3021
- };
3022
-
3023
- /**
3024
- * Throws a `CanceledError` if cancellation has been requested.
3025
- *
3026
- * @param {Object} config The config that is to be used for the request
3027
- *
3028
- * @returns {void}
3029
- */
3030
- function throwIfCancellationRequested$1(config) {
3031
- if (config.cancelToken) {
3032
- config.cancelToken.throwIfRequested();
3033
- }
3034
-
3035
- if (config.signal && config.signal.aborted) {
3036
- throw new CanceledError$1(null, config);
3037
- }
3038
- }
3039
-
3040
- /**
3041
- * Dispatch a request to the server using the configured adapter.
3042
- *
3043
- * @param {object} config The config that is to be used for the request
3044
- *
3045
- * @returns {Promise} The Promise to be fulfilled
3046
- */
3047
- function dispatchRequest$1(config) {
3048
- throwIfCancellationRequested$1(config);
3049
-
3050
- config.headers = AxiosHeaders$1$1.from(config.headers);
3051
-
3052
- // Transform request data
3053
- config.data = transformData$1.call(
3054
- config,
3055
- config.transformRequest
3056
- );
3057
-
3058
- if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {
3059
- config.headers.setContentType('application/x-www-form-urlencoded', false);
3060
- }
3061
-
3062
- const adapter = adapters$1.getAdapter(config.adapter || defaults$1$1.adapter);
3063
-
3064
- return adapter(config).then(function onAdapterResolution(response) {
3065
- throwIfCancellationRequested$1(config);
3066
-
3067
- // Transform response data
3068
- response.data = transformData$1.call(
3069
- config,
3070
- config.transformResponse,
3071
- response
3072
- );
3073
-
3074
- response.headers = AxiosHeaders$1$1.from(response.headers);
3075
-
3076
- return response;
3077
- }, function onAdapterRejection(reason) {
3078
- if (!isCancel$1(reason)) {
3079
- throwIfCancellationRequested$1(config);
3080
-
3081
- // Transform response data
3082
- if (reason && reason.response) {
3083
- reason.response.data = transformData$1.call(
3084
- config,
3085
- config.transformResponse,
3086
- reason.response
3087
- );
3088
- reason.response.headers = AxiosHeaders$1$1.from(reason.response.headers);
3089
- }
3090
- }
3091
-
3092
- return Promise.reject(reason);
3093
- });
3094
- }
3095
-
3096
- const headersToObject$1 = (thing) => thing instanceof AxiosHeaders$1$1 ? thing.toJSON() : thing;
3097
-
3098
- /**
3099
- * Config-specific merge-function which creates a new config-object
3100
- * by merging two configuration objects together.
3101
- *
3102
- * @param {Object} config1
3103
- * @param {Object} config2
3104
- *
3105
- * @returns {Object} New object resulting from merging config2 to config1
3106
- */
3107
- function mergeConfig$1(config1, config2) {
3108
- // eslint-disable-next-line no-param-reassign
3109
- config2 = config2 || {};
3110
- const config = {};
3111
-
3112
- function getMergedValue(target, source, caseless) {
3113
- if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
3114
- return utils$1.merge.call({caseless}, target, source);
3115
- } else if (utils$1.isPlainObject(source)) {
3116
- return utils$1.merge({}, source);
3117
- } else if (utils$1.isArray(source)) {
3118
- return source.slice();
3119
- }
3120
- return source;
3121
- }
3122
-
3123
- // eslint-disable-next-line consistent-return
3124
- function mergeDeepProperties(a, b, caseless) {
3125
- if (!utils$1.isUndefined(b)) {
3126
- return getMergedValue(a, b, caseless);
3127
- } else if (!utils$1.isUndefined(a)) {
3128
- return getMergedValue(undefined, a, caseless);
3129
- }
3130
- }
3131
-
3132
- // eslint-disable-next-line consistent-return
3133
- function valueFromConfig2(a, b) {
3134
- if (!utils$1.isUndefined(b)) {
3135
- return getMergedValue(undefined, b);
3136
- }
3137
- }
3138
-
3139
- // eslint-disable-next-line consistent-return
3140
- function defaultToConfig2(a, b) {
3141
- if (!utils$1.isUndefined(b)) {
3142
- return getMergedValue(undefined, b);
3143
- } else if (!utils$1.isUndefined(a)) {
3144
- return getMergedValue(undefined, a);
3145
- }
3146
- }
3147
-
3148
- // eslint-disable-next-line consistent-return
3149
- function mergeDirectKeys(a, b, prop) {
3150
- if (prop in config2) {
3151
- return getMergedValue(a, b);
3152
- } else if (prop in config1) {
3153
- return getMergedValue(undefined, a);
3154
- }
3155
- }
3156
-
3157
- const mergeMap = {
3158
- url: valueFromConfig2,
3159
- method: valueFromConfig2,
3160
- data: valueFromConfig2,
3161
- baseURL: defaultToConfig2,
3162
- transformRequest: defaultToConfig2,
3163
- transformResponse: defaultToConfig2,
3164
- paramsSerializer: defaultToConfig2,
3165
- timeout: defaultToConfig2,
3166
- timeoutMessage: defaultToConfig2,
3167
- withCredentials: defaultToConfig2,
3168
- adapter: defaultToConfig2,
3169
- responseType: defaultToConfig2,
3170
- xsrfCookieName: defaultToConfig2,
3171
- xsrfHeaderName: defaultToConfig2,
3172
- onUploadProgress: defaultToConfig2,
3173
- onDownloadProgress: defaultToConfig2,
3174
- decompress: defaultToConfig2,
3175
- maxContentLength: defaultToConfig2,
3176
- maxBodyLength: defaultToConfig2,
3177
- beforeRedirect: defaultToConfig2,
3178
- transport: defaultToConfig2,
3179
- httpAgent: defaultToConfig2,
3180
- httpsAgent: defaultToConfig2,
3181
- cancelToken: defaultToConfig2,
3182
- socketPath: defaultToConfig2,
3183
- responseEncoding: defaultToConfig2,
3184
- validateStatus: mergeDirectKeys,
3185
- headers: (a, b) => mergeDeepProperties(headersToObject$1(a), headersToObject$1(b), true)
3186
- };
3187
-
3188
- utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
3189
- const merge = mergeMap[prop] || mergeDeepProperties;
3190
- const configValue = merge(config1[prop], config2[prop], prop);
3191
- (utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
3192
- });
3193
-
3194
- return config;
3195
- }
3196
-
3197
- const VERSION$1 = "1.4.0";
3198
-
3199
- const validators$1$1 = {};
3200
-
3201
- // eslint-disable-next-line func-names
3202
- ['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach((type, i) => {
3203
- validators$1$1[type] = function validator(thing) {
3204
- return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type;
3205
- };
3206
- });
3207
-
3208
- const deprecatedWarnings$1 = {};
3209
-
3210
- /**
3211
- * Transitional option validator
3212
- *
3213
- * @param {function|boolean?} validator - set to false if the transitional option has been removed
3214
- * @param {string?} version - deprecated version / removed since version
3215
- * @param {string?} message - some message with additional info
3216
- *
3217
- * @returns {function}
3218
- */
3219
- validators$1$1.transitional = function transitional(validator, version, message) {
3220
- function formatMessage(opt, desc) {
3221
- return '[Axios v' + VERSION$1 + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : '');
3222
- }
3223
-
3224
- // eslint-disable-next-line func-names
3225
- return (value, opt, opts) => {
3226
- if (validator === false) {
3227
- throw new AxiosError$1(
3228
- formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')),
3229
- AxiosError$1.ERR_DEPRECATED
3230
- );
3231
- }
3232
-
3233
- if (version && !deprecatedWarnings$1[opt]) {
3234
- deprecatedWarnings$1[opt] = true;
3235
- // eslint-disable-next-line no-console
3236
- console.warn(
3237
- formatMessage(
3238
- opt,
3239
- ' has been deprecated since v' + version + ' and will be removed in the near future'
3240
- )
3241
- );
3242
- }
3243
-
3244
- return validator ? validator(value, opt, opts) : true;
3245
- };
3246
- };
3247
-
3248
- /**
3249
- * Assert object's properties type
3250
- *
3251
- * @param {object} options
3252
- * @param {object} schema
3253
- * @param {boolean?} allowUnknown
3254
- *
3255
- * @returns {object}
3256
- */
3257
-
3258
- function assertOptions$1(options, schema, allowUnknown) {
3259
- if (typeof options !== 'object') {
3260
- throw new AxiosError$1('options must be an object', AxiosError$1.ERR_BAD_OPTION_VALUE);
3261
- }
3262
- const keys = Object.keys(options);
3263
- let i = keys.length;
3264
- while (i-- > 0) {
3265
- const opt = keys[i];
3266
- const validator = schema[opt];
3267
- if (validator) {
3268
- const value = options[opt];
3269
- const result = value === undefined || validator(value, opt, options);
3270
- if (result !== true) {
3271
- throw new AxiosError$1('option ' + opt + ' must be ' + result, AxiosError$1.ERR_BAD_OPTION_VALUE);
3272
- }
3273
- continue;
3274
- }
3275
- if (allowUnknown !== true) {
3276
- throw new AxiosError$1('Unknown option ' + opt, AxiosError$1.ERR_BAD_OPTION);
3277
- }
3278
- }
3279
- }
3280
-
3281
- var validator$1 = {
3282
- assertOptions: assertOptions$1,
3283
- validators: validators$1$1
3284
- };
3285
-
3286
- const validators$2 = validator$1.validators;
3287
-
3288
- /**
3289
- * Create a new instance of Axios
3290
- *
3291
- * @param {Object} instanceConfig The default config for the instance
3292
- *
3293
- * @return {Axios} A new instance of Axios
3294
- */
3295
- let Axios$2 = class Axios {
3296
- constructor(instanceConfig) {
3297
- this.defaults = instanceConfig;
3298
- this.interceptors = {
3299
- request: new InterceptorManager$1$1(),
3300
- response: new InterceptorManager$1$1()
3301
- };
3302
- }
3303
-
3304
- /**
3305
- * Dispatch a request
3306
- *
3307
- * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
3308
- * @param {?Object} config
3309
- *
3310
- * @returns {Promise} The Promise to be fulfilled
3311
- */
3312
- request(configOrUrl, config) {
3313
- /*eslint no-param-reassign:0*/
3314
- // Allow for axios('example/url'[, config]) a la fetch API
3315
- if (typeof configOrUrl === 'string') {
3316
- config = config || {};
3317
- config.url = configOrUrl;
3318
- } else {
3319
- config = configOrUrl || {};
3320
- }
3321
-
3322
- config = mergeConfig$1(this.defaults, config);
3323
-
3324
- const {transitional, paramsSerializer, headers} = config;
3325
-
3326
- if (transitional !== undefined) {
3327
- validator$1.assertOptions(transitional, {
3328
- silentJSONParsing: validators$2.transitional(validators$2.boolean),
3329
- forcedJSONParsing: validators$2.transitional(validators$2.boolean),
3330
- clarifyTimeoutError: validators$2.transitional(validators$2.boolean)
3331
- }, false);
3332
- }
3333
-
3334
- if (paramsSerializer != null) {
3335
- if (utils$1.isFunction(paramsSerializer)) {
3336
- config.paramsSerializer = {
3337
- serialize: paramsSerializer
3338
- };
3339
- } else {
3340
- validator$1.assertOptions(paramsSerializer, {
3341
- encode: validators$2.function,
3342
- serialize: validators$2.function
3343
- }, true);
3344
- }
3345
- }
3346
-
3347
- // Set config.method
3348
- config.method = (config.method || this.defaults.method || 'get').toLowerCase();
3349
-
3350
- let contextHeaders;
3351
-
3352
- // Flatten headers
3353
- contextHeaders = headers && utils$1.merge(
3354
- headers.common,
3355
- headers[config.method]
3356
- );
3357
-
3358
- contextHeaders && utils$1.forEach(
3359
- ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
3360
- (method) => {
3361
- delete headers[method];
3362
- }
3363
- );
3364
-
3365
- config.headers = AxiosHeaders$1$1.concat(contextHeaders, headers);
3366
-
3367
- // filter out skipped interceptors
3368
- const requestInterceptorChain = [];
3369
- let synchronousRequestInterceptors = true;
3370
- this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
3371
- if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {
3372
- return;
3373
- }
3374
-
3375
- synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
3376
-
3377
- requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
3378
- });
3379
-
3380
- const responseInterceptorChain = [];
3381
- this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
3382
- responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
3383
- });
3384
-
3385
- let promise;
3386
- let i = 0;
3387
- let len;
3388
-
3389
- if (!synchronousRequestInterceptors) {
3390
- const chain = [dispatchRequest$1.bind(this), undefined];
3391
- chain.unshift.apply(chain, requestInterceptorChain);
3392
- chain.push.apply(chain, responseInterceptorChain);
3393
- len = chain.length;
3394
-
3395
- promise = Promise.resolve(config);
3396
-
3397
- while (i < len) {
3398
- promise = promise.then(chain[i++], chain[i++]);
3399
- }
3400
-
3401
- return promise;
3402
- }
3403
-
3404
- len = requestInterceptorChain.length;
3405
-
3406
- let newConfig = config;
3407
-
3408
- i = 0;
3409
-
3410
- while (i < len) {
3411
- const onFulfilled = requestInterceptorChain[i++];
3412
- const onRejected = requestInterceptorChain[i++];
3413
- try {
3414
- newConfig = onFulfilled(newConfig);
3415
- } catch (error) {
3416
- onRejected.call(this, error);
3417
- break;
3418
- }
3419
- }
3420
-
3421
- try {
3422
- promise = dispatchRequest$1.call(this, newConfig);
3423
- } catch (error) {
3424
- return Promise.reject(error);
3425
- }
3426
-
3427
- i = 0;
3428
- len = responseInterceptorChain.length;
3429
-
3430
- while (i < len) {
3431
- promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);
3432
- }
3433
-
3434
- return promise;
3435
- }
3436
-
3437
- getUri(config) {
3438
- config = mergeConfig$1(this.defaults, config);
3439
- const fullPath = buildFullPath$1(config.baseURL, config.url);
3440
- return buildURL$1(fullPath, config.params, config.paramsSerializer);
3441
- }
3442
- };
3443
-
3444
- // Provide aliases for supported request methods
3445
- utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
3446
- /*eslint func-names:0*/
3447
- Axios$2.prototype[method] = function(url, config) {
3448
- return this.request(mergeConfig$1(config || {}, {
3449
- method,
3450
- url,
3451
- data: (config || {}).data
3452
- }));
3453
- };
3454
- });
3455
-
3456
- utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
3457
- /*eslint func-names:0*/
3458
-
3459
- function generateHTTPMethod(isForm) {
3460
- return function httpMethod(url, data, config) {
3461
- return this.request(mergeConfig$1(config || {}, {
3462
- method,
3463
- headers: isForm ? {
3464
- 'Content-Type': 'multipart/form-data'
3465
- } : {},
3466
- url,
3467
- data
3468
- }));
3469
- };
3470
- }
3471
-
3472
- Axios$2.prototype[method] = generateHTTPMethod();
3473
-
3474
- Axios$2.prototype[method + 'Form'] = generateHTTPMethod(true);
3475
- });
3476
-
3477
- var Axios$1$1 = Axios$2;
3478
-
3479
- /**
3480
- * A `CancelToken` is an object that can be used to request cancellation of an operation.
3481
- *
3482
- * @param {Function} executor The executor function.
3483
- *
3484
- * @returns {CancelToken}
3485
- */
3486
- let CancelToken$2 = class CancelToken {
3487
- constructor(executor) {
3488
- if (typeof executor !== 'function') {
3489
- throw new TypeError('executor must be a function.');
3490
- }
3491
-
3492
- let resolvePromise;
3493
-
3494
- this.promise = new Promise(function promiseExecutor(resolve) {
3495
- resolvePromise = resolve;
3496
- });
3497
-
3498
- const token = this;
3499
-
3500
- // eslint-disable-next-line func-names
3501
- this.promise.then(cancel => {
3502
- if (!token._listeners) return;
3503
-
3504
- let i = token._listeners.length;
3505
-
3506
- while (i-- > 0) {
3507
- token._listeners[i](cancel);
3508
- }
3509
- token._listeners = null;
3510
- });
3511
-
3512
- // eslint-disable-next-line func-names
3513
- this.promise.then = onfulfilled => {
3514
- let _resolve;
3515
- // eslint-disable-next-line func-names
3516
- const promise = new Promise(resolve => {
3517
- token.subscribe(resolve);
3518
- _resolve = resolve;
3519
- }).then(onfulfilled);
3520
-
3521
- promise.cancel = function reject() {
3522
- token.unsubscribe(_resolve);
3523
- };
3524
-
3525
- return promise;
3526
- };
3527
-
3528
- executor(function cancel(message, config, request) {
3529
- if (token.reason) {
3530
- // Cancellation has already been requested
3531
- return;
3532
- }
3533
-
3534
- token.reason = new CanceledError$1(message, config, request);
3535
- resolvePromise(token.reason);
3536
- });
3537
- }
3538
-
3539
- /**
3540
- * Throws a `CanceledError` if cancellation has been requested.
3541
- */
3542
- throwIfRequested() {
3543
- if (this.reason) {
3544
- throw this.reason;
3545
- }
3546
- }
3547
-
3548
- /**
3549
- * Subscribe to the cancel signal
3550
- */
3551
-
3552
- subscribe(listener) {
3553
- if (this.reason) {
3554
- listener(this.reason);
3555
- return;
3556
- }
3557
-
3558
- if (this._listeners) {
3559
- this._listeners.push(listener);
3560
- } else {
3561
- this._listeners = [listener];
3562
- }
3563
- }
3564
-
3565
- /**
3566
- * Unsubscribe from the cancel signal
3567
- */
3568
-
3569
- unsubscribe(listener) {
3570
- if (!this._listeners) {
3571
- return;
3572
- }
3573
- const index = this._listeners.indexOf(listener);
3574
- if (index !== -1) {
3575
- this._listeners.splice(index, 1);
3576
- }
3577
- }
3578
-
3579
- /**
3580
- * Returns an object that contains a new `CancelToken` and a function that, when called,
3581
- * cancels the `CancelToken`.
3582
- */
3583
- static source() {
3584
- let cancel;
3585
- const token = new CancelToken(function executor(c) {
3586
- cancel = c;
3587
- });
3588
- return {
3589
- token,
3590
- cancel
3591
- };
3592
- }
3593
- };
3594
-
3595
- var CancelToken$1$1 = CancelToken$2;
3596
-
3597
- /**
3598
- * Syntactic sugar for invoking a function and expanding an array for arguments.
3599
- *
3600
- * Common use case would be to use `Function.prototype.apply`.
3601
- *
3602
- * ```js
3603
- * function f(x, y, z) {}
3604
- * var args = [1, 2, 3];
3605
- * f.apply(null, args);
3606
- * ```
3607
- *
3608
- * With `spread` this example can be re-written.
3609
- *
3610
- * ```js
3611
- * spread(function(x, y, z) {})([1, 2, 3]);
3612
- * ```
3613
- *
3614
- * @param {Function} callback
3615
- *
3616
- * @returns {Function}
3617
- */
3618
- function spread$1(callback) {
3619
- return function wrap(arr) {
3620
- return callback.apply(null, arr);
3621
- };
3622
- }
3623
-
3624
- /**
3625
- * Determines whether the payload is an error thrown by Axios
3626
- *
3627
- * @param {*} payload The value to test
3628
- *
3629
- * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
3630
- */
3631
- function isAxiosError$1(payload) {
3632
- return utils$1.isObject(payload) && (payload.isAxiosError === true);
3633
- }
3634
-
3635
- const HttpStatusCode$2 = {
3636
- Continue: 100,
3637
- SwitchingProtocols: 101,
3638
- Processing: 102,
3639
- EarlyHints: 103,
3640
- Ok: 200,
3641
- Created: 201,
3642
- Accepted: 202,
3643
- NonAuthoritativeInformation: 203,
3644
- NoContent: 204,
3645
- ResetContent: 205,
3646
- PartialContent: 206,
3647
- MultiStatus: 207,
3648
- AlreadyReported: 208,
3649
- ImUsed: 226,
3650
- MultipleChoices: 300,
3651
- MovedPermanently: 301,
3652
- Found: 302,
3653
- SeeOther: 303,
3654
- NotModified: 304,
3655
- UseProxy: 305,
3656
- Unused: 306,
3657
- TemporaryRedirect: 307,
3658
- PermanentRedirect: 308,
3659
- BadRequest: 400,
3660
- Unauthorized: 401,
3661
- PaymentRequired: 402,
3662
- Forbidden: 403,
3663
- NotFound: 404,
3664
- MethodNotAllowed: 405,
3665
- NotAcceptable: 406,
3666
- ProxyAuthenticationRequired: 407,
3667
- RequestTimeout: 408,
3668
- Conflict: 409,
3669
- Gone: 410,
3670
- LengthRequired: 411,
3671
- PreconditionFailed: 412,
3672
- PayloadTooLarge: 413,
3673
- UriTooLong: 414,
3674
- UnsupportedMediaType: 415,
3675
- RangeNotSatisfiable: 416,
3676
- ExpectationFailed: 417,
3677
- ImATeapot: 418,
3678
- MisdirectedRequest: 421,
3679
- UnprocessableEntity: 422,
3680
- Locked: 423,
3681
- FailedDependency: 424,
3682
- TooEarly: 425,
3683
- UpgradeRequired: 426,
3684
- PreconditionRequired: 428,
3685
- TooManyRequests: 429,
3686
- RequestHeaderFieldsTooLarge: 431,
3687
- UnavailableForLegalReasons: 451,
3688
- InternalServerError: 500,
3689
- NotImplemented: 501,
3690
- BadGateway: 502,
3691
- ServiceUnavailable: 503,
3692
- GatewayTimeout: 504,
3693
- HttpVersionNotSupported: 505,
3694
- VariantAlsoNegotiates: 506,
3695
- InsufficientStorage: 507,
3696
- LoopDetected: 508,
3697
- NotExtended: 510,
3698
- NetworkAuthenticationRequired: 511,
3699
- };
3700
-
3701
- Object.entries(HttpStatusCode$2).forEach(([key, value]) => {
3702
- HttpStatusCode$2[value] = key;
3703
- });
3704
-
3705
- var HttpStatusCode$1$1 = HttpStatusCode$2;
3706
-
3707
- /**
3708
- * Create an instance of Axios
3709
- *
3710
- * @param {Object} defaultConfig The default config for the instance
3711
- *
3712
- * @returns {Axios} A new instance of Axios
3713
- */
3714
- function createInstance$1(defaultConfig) {
3715
- const context = new Axios$1$1(defaultConfig);
3716
- const instance = bind$1(Axios$1$1.prototype.request, context);
3717
-
3718
- // Copy axios.prototype to instance
3719
- utils$1.extend(instance, Axios$1$1.prototype, context, {allOwnKeys: true});
3720
-
3721
- // Copy context to instance
3722
- utils$1.extend(instance, context, null, {allOwnKeys: true});
3723
-
3724
- // Factory for creating new instances
3725
- instance.create = function create(instanceConfig) {
3726
- return createInstance$1(mergeConfig$1(defaultConfig, instanceConfig));
3727
- };
3728
-
3729
- return instance;
3730
- }
3731
-
3732
- // Create the default instance to be exported
3733
- const axios$1 = createInstance$1(defaults$1$1);
3734
-
3735
- // Expose Axios class to allow class inheritance
3736
- axios$1.Axios = Axios$1$1;
3737
-
3738
- // Expose Cancel & CancelToken
3739
- axios$1.CanceledError = CanceledError$1;
3740
- axios$1.CancelToken = CancelToken$1$1;
3741
- axios$1.isCancel = isCancel$1;
3742
- axios$1.VERSION = VERSION$1;
3743
- axios$1.toFormData = toFormData$1;
3744
-
3745
- // Expose AxiosError class
3746
- axios$1.AxiosError = AxiosError$1;
3747
-
3748
- // alias for CanceledError for backward compatibility
3749
- axios$1.Cancel = axios$1.CanceledError;
3750
-
3751
- // Expose all/spread
3752
- axios$1.all = function all(promises) {
3753
- return Promise.all(promises);
3754
- };
3755
-
3756
- axios$1.spread = spread$1;
3757
-
3758
- // Expose isAxiosError
3759
- axios$1.isAxiosError = isAxiosError$1;
3760
-
3761
- // Expose mergeConfig
3762
- axios$1.mergeConfig = mergeConfig$1;
3763
-
3764
- axios$1.AxiosHeaders = AxiosHeaders$1$1;
3765
-
3766
- axios$1.formToJSON = thing => formDataToJSON$1(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
3767
-
3768
- axios$1.HttpStatusCode = HttpStatusCode$1$1;
3769
-
3770
- axios$1.default = axios$1;
3771
-
3772
- // this module should only have a default export
3773
- var globalAxios$1 = axios$1;
3774
-
3775
567
  /* tslint:disable */
3776
568
  /* eslint-disable */
3777
569
  /**
@@ -3863,7 +655,7 @@ let Configuration$1 = class Configuration {
3863
655
  /* tslint:disable */
3864
656
  /* eslint-disable */
3865
657
  /**
3866
- * Immutable X API
658
+ * Immutable zkEVM API
3867
659
  * Immutable Multi Rollup API
3868
660
  *
3869
661
  * The version of the OpenAPI document: 1.0.0
@@ -3875,7 +667,7 @@ let Configuration$1 = class Configuration {
3875
667
  */
3876
668
  // Some imports not used depending on template conditions
3877
669
  // @ts-ignore
3878
- const BASE_PATH$1 = "https://indexer-mr.sandbox.imtbl.com".replace(/\/+$/, "");
670
+ const BASE_PATH$1 = "https://api.sandbox.immutable.com".replace(/\/+$/, "");
3879
671
  /**
3880
672
  *
3881
673
  * @export
@@ -3912,7 +704,7 @@ let RequiredError$1 = class RequiredError extends Error {
3912
704
  /* tslint:disable */
3913
705
  /* eslint-disable */
3914
706
  /**
3915
- * Immutable X API
707
+ * Immutable zkEVM API
3916
708
  * Immutable Multi Rollup API
3917
709
  *
3918
710
  * The version of the OpenAPI document: 1.0.0
@@ -4010,7 +802,7 @@ const createRequestFunction$1 = function (axiosArgs, globalAxios, BASE_PATH, con
4010
802
  /* tslint:disable */
4011
803
  /* eslint-disable */
4012
804
  /**
4013
- * Immutable X API
805
+ * Immutable zkEVM API
4014
806
  * Immutable Multi Rollup API
4015
807
  *
4016
808
  * The version of the OpenAPI document: 1.0.0
@@ -4205,7 +997,7 @@ class ActivitiesApi extends BaseAPI$1 {
4205
997
  /* tslint:disable */
4206
998
  /* eslint-disable */
4207
999
  /**
4208
- * Immutable X API
1000
+ * Immutable zkEVM API
4209
1001
  * Immutable Multi Rollup API
4210
1002
  *
4211
1003
  * The version of the OpenAPI document: 1.0.0
@@ -4300,7 +1092,7 @@ class ChainsApi extends BaseAPI$1 {
4300
1092
  /* tslint:disable */
4301
1093
  /* eslint-disable */
4302
1094
  /**
4303
- * Immutable X API
1095
+ * Immutable zkEVM API
4304
1096
  * Immutable Multi Rollup API
4305
1097
  *
4306
1098
  * The version of the OpenAPI document: 1.0.0
@@ -4456,7 +1248,7 @@ class CollectionsApi extends BaseAPI$1 {
4456
1248
  /* tslint:disable */
4457
1249
  /* eslint-disable */
4458
1250
  /**
4459
- * Immutable X API
1251
+ * Immutable zkEVM API
4460
1252
  * Immutable Multi Rollup API
4461
1253
  *
4462
1254
  * The version of the OpenAPI document: 1.0.0
@@ -4566,7 +1358,7 @@ class NftOwnersApi extends BaseAPI$1 {
4566
1358
  /* tslint:disable */
4567
1359
  /* eslint-disable */
4568
1360
  /**
4569
- * Immutable X API
1361
+ * Immutable zkEVM API
4570
1362
  * Immutable Multi Rollup API
4571
1363
  *
4572
1364
  * The version of the OpenAPI document: 1.0.0
@@ -4803,7 +1595,7 @@ class NftsApi extends BaseAPI$1 {
4803
1595
  /* tslint:disable */
4804
1596
  /* eslint-disable */
4805
1597
  /**
4806
- * Immutable X API
1598
+ * Immutable zkEVM API
4807
1599
  * Immutable Multi Rollup API
4808
1600
  *
4809
1601
  * The version of the OpenAPI document: 1.0.0
@@ -4853,6 +1645,40 @@ const OrdersApiAxiosParamCreator = function (configuration) {
4853
1645
  options: localVarRequestOptions,
4854
1646
  };
4855
1647
  },
1648
+ /**
1649
+ * Retrieve signed fulfillment data based on the list of order IDs and corresponding fees.
1650
+ * @summary Retrieve fulfillment data for orders
1651
+ * @param {string} chainName
1652
+ * @param {Array<FulfillmentDataRequestInner>} fulfillmentDataRequestInner
1653
+ * @param {*} [options] Override http request option.
1654
+ * @throws {RequiredError}
1655
+ */
1656
+ fulfillmentData: async (chainName, fulfillmentDataRequestInner, options = {}) => {
1657
+ // verify required parameter 'chainName' is not null or undefined
1658
+ assertParamExists$1('fulfillmentData', 'chainName', chainName);
1659
+ // verify required parameter 'fulfillmentDataRequestInner' is not null or undefined
1660
+ assertParamExists$1('fulfillmentData', 'fulfillmentDataRequestInner', fulfillmentDataRequestInner);
1661
+ const localVarPath = `/v1/chains/{chain_name}/orders/fulfillment_data`
1662
+ .replace(`{${"chain_name"}}`, encodeURIComponent(String(chainName)));
1663
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1664
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL$1);
1665
+ let baseOptions;
1666
+ if (configuration) {
1667
+ baseOptions = configuration.baseOptions;
1668
+ }
1669
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
1670
+ const localVarHeaderParameter = {};
1671
+ const localVarQueryParameter = {};
1672
+ localVarHeaderParameter['Content-Type'] = 'application/json';
1673
+ setSearchParams$1(localVarUrlObj, localVarQueryParameter);
1674
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1675
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
1676
+ localVarRequestOptions.data = serializeDataIfNeeded$1(fulfillmentDataRequestInner, localVarRequestOptions, configuration);
1677
+ return {
1678
+ url: toPathString$1(localVarUrlObj),
1679
+ options: localVarRequestOptions,
1680
+ };
1681
+ },
4856
1682
  /**
4857
1683
  * Get a single listing by ID
4858
1684
  * @summary Get a single listing by ID
@@ -4968,6 +1794,18 @@ const OrdersApiFp = function (configuration) {
4968
1794
  const localVarAxiosArgs = await localVarAxiosParamCreator.createListing(chainName, createListingRequestBody, options);
4969
1795
  return createRequestFunction$1(localVarAxiosArgs, globalAxios$1, BASE_PATH$1, configuration);
4970
1796
  },
1797
+ /**
1798
+ * Retrieve signed fulfillment data based on the list of order IDs and corresponding fees.
1799
+ * @summary Retrieve fulfillment data for orders
1800
+ * @param {string} chainName
1801
+ * @param {Array<FulfillmentDataRequestInner>} fulfillmentDataRequestInner
1802
+ * @param {*} [options] Override http request option.
1803
+ * @throws {RequiredError}
1804
+ */
1805
+ async fulfillmentData(chainName, fulfillmentDataRequestInner, options) {
1806
+ const localVarAxiosArgs = await localVarAxiosParamCreator.fulfillmentData(chainName, fulfillmentDataRequestInner, options);
1807
+ return createRequestFunction$1(localVarAxiosArgs, globalAxios$1, BASE_PATH$1, configuration);
1808
+ },
4971
1809
  /**
4972
1810
  * Get a single listing by ID
4973
1811
  * @summary Get a single listing by ID
@@ -5019,6 +1857,17 @@ class OrdersApi extends BaseAPI$1 {
5019
1857
  createListing(requestParameters, options) {
5020
1858
  return OrdersApiFp(this.configuration).createListing(requestParameters.chainName, requestParameters.createListingRequestBody, options).then((request) => request(this.axios, this.basePath));
5021
1859
  }
1860
+ /**
1861
+ * Retrieve signed fulfillment data based on the list of order IDs and corresponding fees.
1862
+ * @summary Retrieve fulfillment data for orders
1863
+ * @param {OrdersApiFulfillmentDataRequest} requestParameters Request parameters.
1864
+ * @param {*} [options] Override http request option.
1865
+ * @throws {RequiredError}
1866
+ * @memberof OrdersApi
1867
+ */
1868
+ fulfillmentData(requestParameters, options) {
1869
+ return OrdersApiFp(this.configuration).fulfillmentData(requestParameters.chainName, requestParameters.fulfillmentDataRequestInner, options).then((request) => request(this.axios, this.basePath));
1870
+ }
5022
1871
  /**
5023
1872
  * Get a single listing by ID
5024
1873
  * @summary Get a single listing by ID
@@ -5046,7 +1895,7 @@ class OrdersApi extends BaseAPI$1 {
5046
1895
  /* tslint:disable */
5047
1896
  /* eslint-disable */
5048
1897
  /**
5049
- * Immutable X API
1898
+ * Immutable zkEVM API
5050
1899
  * Immutable Multi Rollup API
5051
1900
  *
5052
1901
  * The version of the OpenAPI document: 1.0.0
@@ -9157,7 +6006,7 @@ class AuthManager {
9157
6006
  }
9158
6007
  async loginWithDeviceFlow() {
9159
6008
  return withPassportError(async () => {
9160
- const response = await axios$2.post(`${this.config.authenticationDomain}/oauth/device/code`, {
6009
+ const response = await globalAxios$1.post(`${this.config.authenticationDomain}/oauth/device/code`, {
9161
6010
  client_id: this.config.oidcConfiguration.clientId,
9162
6011
  scope: this.config.oidcConfiguration.scope,
9163
6012
  audience: this.config.oidcConfiguration.audience,
@@ -9190,7 +6039,7 @@ class AuthManager {
9190
6039
  return user;
9191
6040
  }
9192
6041
  catch (error) {
9193
- if (axios$2.isAxiosError(error)) {
6042
+ if (globalAxios$1.isAxiosError(error)) {
9194
6043
  const responseError = error.response?.data;
9195
6044
  switch (responseError.error) {
9196
6045
  case 'authorization_pending':
@@ -9215,7 +6064,7 @@ class AuthManager {
9215
6064
  }
9216
6065
  /* eslint-enable no-await-in-loop */
9217
6066
  async getDeviceFlowToken(deviceCode) {
9218
- const response = await axios$2.post(`${this.config.authenticationDomain}/oauth/token`, {
6067
+ const response = await globalAxios$1.post(`${this.config.authenticationDomain}/oauth/token`, {
9219
6068
  client_id: this.config.oidcConfiguration.clientId,
9220
6069
  grant_type: 'urn:ietf:params:oauth:grant-type:device_code',
9221
6070
  device_code: deviceCode,
@@ -9266,7 +6115,7 @@ class AuthManager {
9266
6115
  }, PassportErrorType.AUTHENTICATION_ERROR);
9267
6116
  }
9268
6117
  async getPKCEToken(authorizationCode, codeVerifier) {
9269
- const response = await axios$2.post(`${this.config.authenticationDomain}/oauth/token`, {
6118
+ const response = await globalAxios$1.post(`${this.config.authenticationDomain}/oauth/token`, {
9270
6119
  client_id: this.config.oidcConfiguration.clientId,
9271
6120
  grant_type: 'authorization_code',
9272
6121
  code_verifier: codeVerifier,
@@ -9291,7 +6140,7 @@ class AuthManager {
9291
6140
  }, PassportErrorType.AUTHENTICATION_ERROR);
9292
6141
  }
9293
6142
  async refreshToken(refreshToken) {
9294
- const response = await axios$2.post(`${this.config.authenticationDomain}/oauth/token`, {
6143
+ const response = await globalAxios$1.post(`${this.config.authenticationDomain}/oauth/token`, {
9295
6144
  client_id: this.config.oidcConfiguration.clientId,
9296
6145
  grant_type: 'refresh_token',
9297
6146
  refresh_token: refreshToken,
@@ -9442,7 +6291,7 @@ const transformGuardianTransactions = (txs) => {
9442
6291
  gasLimit: t.gasLimit ? convertBigNumberishToString(t.gasLimit) : '0',
9443
6292
  target: t.to ?? ethers.ethers.constants.AddressZero,
9444
6293
  value: t.value ? convertBigNumberishToString(t.value) : '0',
9445
- data: t.data ? t.data.toString() : '0x00',
6294
+ data: t.data ? t.data.toString() : '0x',
9446
6295
  }));
9447
6296
  }
9448
6297
  catch (error) {
@@ -9453,6 +6302,7 @@ const transformGuardianTransactions = (txs) => {
9453
6302
  class GuardianClient {
9454
6303
  transactionAPI;
9455
6304
  confirmationScreen;
6305
+ // TODO: ID-977, make this rollup agnostic
9456
6306
  imxEtherAddress;
9457
6307
  constructor({ imxPublicApiDomain, accessToken, confirmationScreen, imxEtherAddress, }) {
9458
6308
  this.confirmationScreen = confirmationScreen;
@@ -10128,8 +6978,8 @@ class PassportConfiguration {
10128
6978
  this.magicProviderId = 'fSMzaRQ4O7p4fttl7pCyGVtJS_G70P8SNsLXtPPGHo0=';
10129
6979
  this.passportDomain = 'https://passport.sandbox.immutable.com';
10130
6980
  this.imxPublicApiDomain = 'https://api.sandbox.immutable.com';
10131
- this.zkEvmRpcUrl = 'https://zkevm-rpc.sandbox.x.immutable.com';
10132
- this.zkEvmChainId = 'eip155:13392';
6981
+ this.zkEvmRpcUrl = 'https://rpc.testnet.immutable.com';
6982
+ this.zkEvmChainId = 'eip155:13372';
10133
6983
  this.relayerUrl = 'https://api.sandbox.immutable.com/relayer-mr';
10134
6984
  this.multiRollupConfig = multiRollupConfig.getSandbox();
10135
6985
  break;
@@ -10329,8 +7179,10 @@ class TypedEventEmitter {
10329
7179
 
10330
7180
  class RelayerClient {
10331
7181
  config;
10332
- constructor({ config }) {
7182
+ user;
7183
+ constructor({ config, user }) {
10333
7184
  this.config = config;
7185
+ this.user = user;
10334
7186
  }
10335
7187
  async postToRelayer(request) {
10336
7188
  const body = {
@@ -10341,6 +7193,7 @@ class RelayerClient {
10341
7193
  const response = await fetch(`${this.config.relayerUrl}/v1/transactions`, {
10342
7194
  method: 'POST',
10343
7195
  headers: {
7196
+ Authorization: `Bearer ${this.user.accessToken}`,
10344
7197
  'Content-Type': 'application/json',
10345
7198
  },
10346
7199
  body: JSON.stringify(body),
@@ -10590,11 +7443,12 @@ class ZkEvmProvider {
10590
7443
  config;
10591
7444
  confirmationScreen;
10592
7445
  magicAdapter;
10593
- relayerClient;
10594
7446
  transactionAPI;
10595
7447
  multiRollupApiClients;
10596
7448
  jsonRpcProvider; // Used for read
10597
7449
  eventEmitter;
7450
+ guardianClient;
7451
+ relayerClient;
10598
7452
  magicProvider; // Used for signing
10599
7453
  user;
10600
7454
  constructor({ authManager, magicAdapter, config, confirmationScreen, multiRollupApiClients, }) {
@@ -10602,7 +7456,6 @@ class ZkEvmProvider {
10602
7456
  this.magicAdapter = magicAdapter;
10603
7457
  this.config = config;
10604
7458
  this.confirmationScreen = confirmationScreen;
10605
- this.relayerClient = new RelayerClient({ config });
10606
7459
  this.transactionAPI = new TransactionsApi(new Configuration({
10607
7460
  basePath: this.config.imxPublicApiDomain,
10608
7461
  }));
@@ -10610,8 +7463,12 @@ class ZkEvmProvider {
10610
7463
  this.multiRollupApiClients = multiRollupApiClients;
10611
7464
  this.eventEmitter = new TypedEventEmitter();
10612
7465
  }
7466
+ isPassport = true;
10613
7467
  isLoggedIn() {
10614
- return this.magicProvider !== undefined && this.user !== undefined;
7468
+ return this.magicProvider !== undefined
7469
+ && this.user !== undefined
7470
+ && this.relayerClient !== undefined
7471
+ && this.guardianClient !== undefined;
10615
7472
  }
10616
7473
  async performRequest(request) {
10617
7474
  switch (request.method) {
@@ -10627,6 +7484,16 @@ class ZkEvmProvider {
10627
7484
  });
10628
7485
  this.user = user;
10629
7486
  this.magicProvider = magicProvider;
7487
+ this.relayerClient = new RelayerClient({
7488
+ config: this.config,
7489
+ user: this.user,
7490
+ });
7491
+ this.guardianClient = new GuardianClient({
7492
+ imxPublicApiDomain: this.config.imxPublicApiDomain,
7493
+ accessToken: this.user.accessToken,
7494
+ confirmationScreen: this.confirmationScreen,
7495
+ imxEtherAddress: this.user.zkEvm.ethAddress,
7496
+ });
10630
7497
  this.eventEmitter.emit(exports.ProviderEvent.ACCOUNTS_CHANGED, [this.user.zkEvm.ethAddress]);
10631
7498
  return [this.user.zkEvm.ethAddress];
10632
7499
  }
@@ -10634,16 +7501,10 @@ class ZkEvmProvider {
10634
7501
  if (!this.isLoggedIn()) {
10635
7502
  throw new JsonRpcError(exports.ProviderErrorCode.UNAUTHORIZED, 'Unauthorised - call eth_requestAccounts first');
10636
7503
  }
10637
- const guardianClient = new GuardianClient({
10638
- imxPublicApiDomain: this.config.imxPublicApiDomain,
10639
- accessToken: this.user.accessToken,
10640
- confirmationScreen: this.confirmationScreen,
10641
- imxEtherAddress: this.user?.imx?.ethAddress || '',
10642
- });
10643
7504
  return sendTransaction({
10644
7505
  params: request.params || [],
10645
7506
  magicProvider: this.magicProvider,
10646
- guardianClient,
7507
+ guardianClient: this.guardianClient,
10647
7508
  jsonRpcProvider: this.jsonRpcProvider,
10648
7509
  config: this.config,
10649
7510
  relayerClient: this.relayerClient,
@@ -10824,8 +7685,10 @@ class Passport {
10824
7685
  async connectImxWithCredentials(tokenResponse) {
10825
7686
  return this.passportImxProviderFactory.getProviderWithCredentials(tokenResponse);
10826
7687
  }
10827
- // TODO ID-926 Make method public once development has been finalised
10828
7688
  connectEvm() {
7689
+ if (this.config.network === exports.Networks.PRODUCTION) {
7690
+ throw new Error('EVM is not supported on production network');
7691
+ }
10829
7692
  return new ZkEvmProvider({
10830
7693
  authManager: this.authManager,
10831
7694
  magicAdapter: this.magicAdapter,