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