@dartcom/ui-kit 10.1.5 → 10.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +156 -4067
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +4 -4
- package/dist/index.esm.js.map +1 -1
- package/dist/services/api/types.d.ts +0 -1
- package/dist/services/api/types.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -12,6 +12,7 @@ var FormControlLabel = require('@mui/material/FormControlLabel');
|
|
|
12
12
|
var styles$2 = require('@mui/material/styles');
|
|
13
13
|
var Typography = require('@mui/material/Typography');
|
|
14
14
|
var reactDom = require('react-dom');
|
|
15
|
+
var axios = require('axios');
|
|
15
16
|
var xDatePickers = require('@mui/x-date-pickers');
|
|
16
17
|
var AdapterDateFns = require('@mui/x-date-pickers/AdapterDateFns');
|
|
17
18
|
var DateField$1 = require('@mui/x-date-pickers/DateField');
|
|
@@ -148,12 +149,12 @@ var isDateObject = (value) => value instanceof Date;
|
|
|
148
149
|
var isNullOrUndefined = (value) => value == null;
|
|
149
150
|
|
|
150
151
|
const isObjectType = (value) => typeof value === 'object';
|
|
151
|
-
var isObject$
|
|
152
|
+
var isObject$2 = (value) => !isNullOrUndefined(value) &&
|
|
152
153
|
!Array.isArray(value) &&
|
|
153
154
|
isObjectType(value) &&
|
|
154
155
|
!isDateObject(value);
|
|
155
156
|
|
|
156
|
-
var getEventValue = (event) => isObject$
|
|
157
|
+
var getEventValue = (event) => isObject$2(event) && event.target
|
|
157
158
|
? isCheckBoxInput(event.target)
|
|
158
159
|
? event.target.checked
|
|
159
160
|
: event.target.value
|
|
@@ -163,9 +164,9 @@ var getNodeParentName = (name) => name.substring(0, name.search(/\.\d+(\.|$)/))
|
|
|
163
164
|
|
|
164
165
|
var isNameInFieldArray = (names, name) => names.has(getNodeParentName(name));
|
|
165
166
|
|
|
166
|
-
var isPlainObject$
|
|
167
|
+
var isPlainObject$2 = (tempObject) => {
|
|
167
168
|
const prototypeCopy = tempObject.constructor && tempObject.constructor.prototype;
|
|
168
|
-
return (isObject$
|
|
169
|
+
return (isObject$2(prototypeCopy) && prototypeCopy.hasOwnProperty('isPrototypeOf'));
|
|
169
170
|
};
|
|
170
171
|
|
|
171
172
|
var isWeb = typeof window !== 'undefined' &&
|
|
@@ -181,7 +182,7 @@ function cloneObject(data) {
|
|
|
181
182
|
return data;
|
|
182
183
|
}
|
|
183
184
|
const isArray = Array.isArray(data);
|
|
184
|
-
if (!isArray && !(isObject$
|
|
185
|
+
if (!isArray && !(isObject$2(data) && isPlainObject$2(data))) {
|
|
185
186
|
return data;
|
|
186
187
|
}
|
|
187
188
|
const copy = isArray ? [] : Object.create(Object.getPrototypeOf(data));
|
|
@@ -195,27 +196,27 @@ function cloneObject(data) {
|
|
|
195
196
|
|
|
196
197
|
var isKey = (value) => /^\w*$/.test(value);
|
|
197
198
|
|
|
198
|
-
var isUndefined
|
|
199
|
+
var isUndefined = (val) => val === undefined;
|
|
199
200
|
|
|
200
201
|
var compact = (value) => Array.isArray(value) ? value.filter(Boolean) : [];
|
|
201
202
|
|
|
202
203
|
var stringToPath = (input) => compact(input.replace(/["|']|\]/g, '').split(/\.|\[/));
|
|
203
204
|
|
|
204
205
|
var get = (object, path, defaultValue) => {
|
|
205
|
-
if (!path || !isObject$
|
|
206
|
+
if (!path || !isObject$2(object)) {
|
|
206
207
|
return defaultValue;
|
|
207
208
|
}
|
|
208
209
|
const result = (isKey(path) ? [path] : stringToPath(path)).reduce((result, key) => isNullOrUndefined(result) ? result : result[key], object);
|
|
209
|
-
return isUndefined
|
|
210
|
-
? isUndefined
|
|
210
|
+
return isUndefined(result) || result === object
|
|
211
|
+
? isUndefined(object[path])
|
|
211
212
|
? defaultValue
|
|
212
213
|
: object[path]
|
|
213
214
|
: result;
|
|
214
215
|
};
|
|
215
216
|
|
|
216
|
-
var isBoolean
|
|
217
|
+
var isBoolean = (value) => typeof value === 'boolean';
|
|
217
218
|
|
|
218
|
-
var isFunction$
|
|
219
|
+
var isFunction$2 = (value) => typeof value === 'function';
|
|
219
220
|
|
|
220
221
|
var set = (object, path, value) => {
|
|
221
222
|
let index = -1;
|
|
@@ -228,7 +229,7 @@ var set = (object, path, value) => {
|
|
|
228
229
|
if (index !== lastIndex) {
|
|
229
230
|
const objValue = object[key];
|
|
230
231
|
newValue =
|
|
231
|
-
isObject$
|
|
232
|
+
isObject$2(objValue) || Array.isArray(objValue)
|
|
232
233
|
? objValue
|
|
233
234
|
: !isNaN(+tempPath[index + 1])
|
|
234
235
|
? []
|
|
@@ -415,10 +416,10 @@ function useFormState(props) {
|
|
|
415
416
|
return React.useMemo(() => getProxyFormState(formState, control, _localProxyFormState.current, false), [formState, control]);
|
|
416
417
|
}
|
|
417
418
|
|
|
418
|
-
var isString
|
|
419
|
+
var isString = (value) => typeof value === 'string';
|
|
419
420
|
|
|
420
421
|
var generateWatchOutput = (names, _names, formValues, isGlobal, defaultValue) => {
|
|
421
|
-
if (isString
|
|
422
|
+
if (isString(names)) {
|
|
422
423
|
isGlobal && _names.watch.add(names);
|
|
423
424
|
return get(formValues, names, defaultValue);
|
|
424
425
|
}
|
|
@@ -457,7 +458,7 @@ function deepEqual$1(object1, object2, _internal_visited = new WeakSet()) {
|
|
|
457
458
|
if (key !== 'ref') {
|
|
458
459
|
const val2 = object2[key];
|
|
459
460
|
if ((isDateObject(val1) && isDateObject(val2)) ||
|
|
460
|
-
(isObject$
|
|
461
|
+
(isObject$2(val1) && isObject$2(val2)) ||
|
|
461
462
|
(Array.isArray(val1) && Array.isArray(val2))
|
|
462
463
|
? !deepEqual$1(val1, val2, _internal_visited)
|
|
463
464
|
: !Object.is(val1, val2)) {
|
|
@@ -599,7 +600,7 @@ function useController(props) {
|
|
|
599
600
|
const _registerProps = React.useRef(control.register(name, {
|
|
600
601
|
...props.rules,
|
|
601
602
|
value,
|
|
602
|
-
...(isBoolean
|
|
603
|
+
...(isBoolean(props.disabled) ? { disabled: props.disabled } : {}),
|
|
603
604
|
}));
|
|
604
605
|
_props.current = props;
|
|
605
606
|
const fieldState = React.useMemo(() => Object.defineProperties({}, {
|
|
@@ -642,17 +643,17 @@ function useController(props) {
|
|
|
642
643
|
const field = get(control._fields, name);
|
|
643
644
|
if (field && field._f && elm) {
|
|
644
645
|
field._f.ref = {
|
|
645
|
-
focus: () => isFunction$
|
|
646
|
-
select: () => isFunction$
|
|
647
|
-
setCustomValidity: (message) => isFunction$
|
|
648
|
-
reportValidity: () => isFunction$
|
|
646
|
+
focus: () => isFunction$2(elm.focus) && elm.focus(),
|
|
647
|
+
select: () => isFunction$2(elm.select) && elm.select(),
|
|
648
|
+
setCustomValidity: (message) => isFunction$2(elm.setCustomValidity) && elm.setCustomValidity(message),
|
|
649
|
+
reportValidity: () => isFunction$2(elm.reportValidity) && elm.reportValidity(),
|
|
649
650
|
};
|
|
650
651
|
}
|
|
651
652
|
}, [control._fields, name]);
|
|
652
653
|
const field = React.useMemo(() => ({
|
|
653
654
|
name,
|
|
654
655
|
value,
|
|
655
|
-
...(isBoolean
|
|
656
|
+
...(isBoolean(disabled) || formState.disabled
|
|
656
657
|
? { disabled: formState.disabled || disabled }
|
|
657
658
|
: {}),
|
|
658
659
|
onChange,
|
|
@@ -667,7 +668,7 @@ function useController(props) {
|
|
|
667
668
|
}
|
|
668
669
|
control.register(name, {
|
|
669
670
|
..._props.current.rules,
|
|
670
|
-
...(isBoolean
|
|
671
|
+
...(isBoolean(_props.current.disabled)
|
|
671
672
|
? { disabled: _props.current.disabled }
|
|
672
673
|
: {}),
|
|
673
674
|
});
|
|
@@ -681,7 +682,7 @@ function useController(props) {
|
|
|
681
682
|
if (_shouldUnregisterField) {
|
|
682
683
|
const value = cloneObject(get(control._options.defaultValues, name, _props.current.defaultValue));
|
|
683
684
|
set(control._defaultValues, name, value);
|
|
684
|
-
if (isUndefined
|
|
685
|
+
if (isUndefined(get(control._formValues, name))) {
|
|
685
686
|
set(control._formValues, name, value);
|
|
686
687
|
}
|
|
687
688
|
}
|
|
@@ -798,9 +799,9 @@ function extractFormValues(fieldsState, formValues) {
|
|
|
798
799
|
if (fieldsState.hasOwnProperty(key)) {
|
|
799
800
|
const fieldState = fieldsState[key];
|
|
800
801
|
const fieldValue = formValues[key];
|
|
801
|
-
if (fieldState && isObject$
|
|
802
|
+
if (fieldState && isObject$2(fieldState) && fieldValue) {
|
|
802
803
|
const nestedFieldsState = extractFormValues(fieldState, fieldValue);
|
|
803
|
-
if (isObject$
|
|
804
|
+
if (isObject$2(nestedFieldsState)) {
|
|
804
805
|
values[key] = nestedFieldsState;
|
|
805
806
|
}
|
|
806
807
|
}
|
|
@@ -812,7 +813,7 @@ function extractFormValues(fieldsState, formValues) {
|
|
|
812
813
|
return values;
|
|
813
814
|
}
|
|
814
815
|
|
|
815
|
-
var isEmptyObject
|
|
816
|
+
var isEmptyObject = (value) => isObject$2(value) && !Object.keys(value).length;
|
|
816
817
|
|
|
817
818
|
var isFileInput = (element) => element.type === 'file';
|
|
818
819
|
|
|
@@ -837,13 +838,13 @@ function baseGet(object, updatePath) {
|
|
|
837
838
|
const length = updatePath.slice(0, -1).length;
|
|
838
839
|
let index = 0;
|
|
839
840
|
while (index < length) {
|
|
840
|
-
object = isUndefined
|
|
841
|
+
object = isUndefined(object) ? index++ : object[updatePath[index++]];
|
|
841
842
|
}
|
|
842
843
|
return object;
|
|
843
844
|
}
|
|
844
845
|
function isEmptyArray(obj) {
|
|
845
846
|
for (const key in obj) {
|
|
846
|
-
if (obj.hasOwnProperty(key) && !isUndefined
|
|
847
|
+
if (obj.hasOwnProperty(key) && !isUndefined(obj[key])) {
|
|
847
848
|
return false;
|
|
848
849
|
}
|
|
849
850
|
}
|
|
@@ -862,7 +863,7 @@ function unset(object, path) {
|
|
|
862
863
|
delete childObject[key];
|
|
863
864
|
}
|
|
864
865
|
if (index !== 0 &&
|
|
865
|
-
((isObject$
|
|
866
|
+
((isObject$2(childObject) && isEmptyObject(childObject)) ||
|
|
866
867
|
(Array.isArray(childObject) && isEmptyArray(childObject)))) {
|
|
867
868
|
unset(object, paths.slice(0, -1));
|
|
868
869
|
}
|
|
@@ -871,7 +872,7 @@ function unset(object, path) {
|
|
|
871
872
|
|
|
872
873
|
var objectHasFunction = (data) => {
|
|
873
874
|
for (const key in data) {
|
|
874
|
-
if (isFunction$
|
|
875
|
+
if (isFunction$2(data[key])) {
|
|
875
876
|
return true;
|
|
876
877
|
}
|
|
877
878
|
}
|
|
@@ -879,7 +880,7 @@ var objectHasFunction = (data) => {
|
|
|
879
880
|
};
|
|
880
881
|
|
|
881
882
|
function isTraversable(value) {
|
|
882
|
-
return Array.isArray(value) || (isObject$
|
|
883
|
+
return Array.isArray(value) || (isObject$2(value) && !objectHasFunction(value));
|
|
883
884
|
}
|
|
884
885
|
function markFieldsDirty(data, fields = {}) {
|
|
885
886
|
for (const key in data) {
|
|
@@ -888,7 +889,7 @@ function markFieldsDirty(data, fields = {}) {
|
|
|
888
889
|
fields[key] = Array.isArray(value) ? [] : {};
|
|
889
890
|
markFieldsDirty(value, fields[key]);
|
|
890
891
|
}
|
|
891
|
-
else if (!isUndefined
|
|
892
|
+
else if (!isUndefined(value)) {
|
|
892
893
|
fields[key] = true;
|
|
893
894
|
}
|
|
894
895
|
}
|
|
@@ -901,7 +902,7 @@ function getDirtyFields(data, formValues, dirtyFieldsFromValues) {
|
|
|
901
902
|
for (const key in data) {
|
|
902
903
|
const value = data[key];
|
|
903
904
|
if (isTraversable(value)) {
|
|
904
|
-
if (isUndefined
|
|
905
|
+
if (isUndefined(formValues) || isPrimitive(dirtyFieldsFromValues[key])) {
|
|
905
906
|
dirtyFieldsFromValues[key] = markFieldsDirty(value, Array.isArray(value) ? [] : {});
|
|
906
907
|
}
|
|
907
908
|
else {
|
|
@@ -931,8 +932,8 @@ var getCheckboxValue = (options) => {
|
|
|
931
932
|
}
|
|
932
933
|
return options[0].checked && !options[0].disabled
|
|
933
934
|
? // @ts-expect-error expected to work in the browser
|
|
934
|
-
options[0].attributes && !isUndefined
|
|
935
|
-
? isUndefined
|
|
935
|
+
options[0].attributes && !isUndefined(options[0].attributes.value)
|
|
936
|
+
? isUndefined(options[0].value) || options[0].value === ''
|
|
936
937
|
? validResult
|
|
937
938
|
: { value: options[0].value, isValid: true }
|
|
938
939
|
: validResult
|
|
@@ -941,7 +942,7 @@ var getCheckboxValue = (options) => {
|
|
|
941
942
|
return defaultResult;
|
|
942
943
|
};
|
|
943
944
|
|
|
944
|
-
var getFieldValueAs = (value, { valueAsNumber, valueAsDate, setValueAs }) => isUndefined
|
|
945
|
+
var getFieldValueAs = (value, { valueAsNumber, valueAsDate, setValueAs }) => isUndefined(value)
|
|
945
946
|
? value
|
|
946
947
|
: valueAsNumber
|
|
947
948
|
? value === ''
|
|
@@ -949,7 +950,7 @@ var getFieldValueAs = (value, { valueAsNumber, valueAsDate, setValueAs }) => isU
|
|
|
949
950
|
: value
|
|
950
951
|
? +value
|
|
951
952
|
: value
|
|
952
|
-
: valueAsDate && isString
|
|
953
|
+
: valueAsDate && isString(value)
|
|
953
954
|
? new Date(value)
|
|
954
955
|
: setValueAs
|
|
955
956
|
? setValueAs(value)
|
|
@@ -982,7 +983,7 @@ function getFieldValue(_f) {
|
|
|
982
983
|
if (isCheckBoxInput(ref)) {
|
|
983
984
|
return getCheckboxValue(_f.refs).value;
|
|
984
985
|
}
|
|
985
|
-
return getFieldValueAs(isUndefined
|
|
986
|
+
return getFieldValueAs(isUndefined(ref.value) ? _f.ref.value : ref.value, _f);
|
|
986
987
|
}
|
|
987
988
|
|
|
988
989
|
var getResolverOptions = (fieldsNames, _fields, criteriaMode, shouldUseNativeValidation) => {
|
|
@@ -1001,11 +1002,11 @@ var getResolverOptions = (fieldsNames, _fields, criteriaMode, shouldUseNativeVal
|
|
|
1001
1002
|
|
|
1002
1003
|
var isRegex = (value) => value instanceof RegExp;
|
|
1003
1004
|
|
|
1004
|
-
var getRuleValue = (rule) => isUndefined
|
|
1005
|
+
var getRuleValue = (rule) => isUndefined(rule)
|
|
1005
1006
|
? rule
|
|
1006
1007
|
: isRegex(rule)
|
|
1007
1008
|
? rule.source
|
|
1008
|
-
: isObject$
|
|
1009
|
+
: isObject$2(rule)
|
|
1009
1010
|
? isRegex(rule.value)
|
|
1010
1011
|
? rule.value.source
|
|
1011
1012
|
: rule.value
|
|
@@ -1022,9 +1023,9 @@ var getValidationModes = (mode) => ({
|
|
|
1022
1023
|
const ASYNC_FUNCTION = 'AsyncFunction';
|
|
1023
1024
|
var hasPromiseValidation = (fieldReference) => !!fieldReference &&
|
|
1024
1025
|
!!fieldReference.validate &&
|
|
1025
|
-
!!((isFunction$
|
|
1026
|
+
!!((isFunction$2(fieldReference.validate) &&
|
|
1026
1027
|
fieldReference.validate.constructor.name === ASYNC_FUNCTION) ||
|
|
1027
|
-
(isObject$
|
|
1028
|
+
(isObject$2(fieldReference.validate) &&
|
|
1028
1029
|
Object.values(fieldReference.validate).find((validateFunction) => validateFunction.constructor.name === ASYNC_FUNCTION)));
|
|
1029
1030
|
|
|
1030
1031
|
var hasValidation = (options) => options.mount &&
|
|
@@ -1060,7 +1061,7 @@ const iterateFieldsByAction = (fields, action, fieldsNames, abortEarly) => {
|
|
|
1060
1061
|
}
|
|
1061
1062
|
}
|
|
1062
1063
|
}
|
|
1063
|
-
else if (isObject$
|
|
1064
|
+
else if (isObject$2(currentField)) {
|
|
1064
1065
|
if (iterateFieldsByAction(currentField, action)) {
|
|
1065
1066
|
break;
|
|
1066
1067
|
}
|
|
@@ -1108,7 +1109,7 @@ function schemaErrorLookup(errors, _fields, name) {
|
|
|
1108
1109
|
var shouldRenderFormState = (formStateData, _proxyFormState, updateFormState, isRoot) => {
|
|
1109
1110
|
updateFormState(formStateData);
|
|
1110
1111
|
const { name, ...formState } = formStateData;
|
|
1111
|
-
return (isEmptyObject
|
|
1112
|
+
return (isEmptyObject(formState) ||
|
|
1112
1113
|
Object.keys(formState).length >= Object.keys(_proxyFormState).length ||
|
|
1113
1114
|
Object.keys(formState).find((key) => _proxyFormState[key] ===
|
|
1114
1115
|
(!isRoot || VALIDATION_MODE.all)));
|
|
@@ -1149,18 +1150,18 @@ var updateFieldArrayRootError = (errors, error, name) => {
|
|
|
1149
1150
|
};
|
|
1150
1151
|
|
|
1151
1152
|
function getValidateError(result, ref, type = 'validate') {
|
|
1152
|
-
if (isString
|
|
1153
|
-
(Array.isArray(result) && result.every(isString
|
|
1154
|
-
(isBoolean
|
|
1153
|
+
if (isString(result) ||
|
|
1154
|
+
(Array.isArray(result) && result.every(isString)) ||
|
|
1155
|
+
(isBoolean(result) && !result)) {
|
|
1155
1156
|
return {
|
|
1156
1157
|
type,
|
|
1157
|
-
message: isString
|
|
1158
|
+
message: isString(result) ? result : '',
|
|
1158
1159
|
ref,
|
|
1159
1160
|
};
|
|
1160
1161
|
}
|
|
1161
1162
|
}
|
|
1162
1163
|
|
|
1163
|
-
var getValueAndMessage = (validationData) => isObject$
|
|
1164
|
+
var getValueAndMessage = (validationData) => isObject$2(validationData) && !isRegex(validationData)
|
|
1164
1165
|
? validationData
|
|
1165
1166
|
: {
|
|
1166
1167
|
value: validationData,
|
|
@@ -1176,7 +1177,7 @@ var validateField = async (field, disabledFieldNames, formValues, validateAllFie
|
|
|
1176
1177
|
const inputRef = refs ? refs[0] : ref;
|
|
1177
1178
|
const setCustomValidity = (message) => {
|
|
1178
1179
|
if (shouldUseNativeValidation && inputRef.reportValidity) {
|
|
1179
|
-
inputRef.setCustomValidity(isBoolean
|
|
1180
|
+
inputRef.setCustomValidity(isBoolean(message) ? '' : message || '');
|
|
1180
1181
|
inputRef.reportValidity();
|
|
1181
1182
|
}
|
|
1182
1183
|
};
|
|
@@ -1185,8 +1186,8 @@ var validateField = async (field, disabledFieldNames, formValues, validateAllFie
|
|
|
1185
1186
|
const isCheckBox = isCheckBoxInput(ref);
|
|
1186
1187
|
const isRadioOrCheckbox = isRadio || isCheckBox;
|
|
1187
1188
|
const isEmpty = ((valueAsNumber || isFileInput(ref)) &&
|
|
1188
|
-
isUndefined
|
|
1189
|
-
isUndefined
|
|
1189
|
+
isUndefined(ref.value) &&
|
|
1190
|
+
isUndefined(inputValue)) ||
|
|
1190
1191
|
(isHTMLElement$1(ref) && ref.value === '') ||
|
|
1191
1192
|
inputValue === '' ||
|
|
1192
1193
|
(Array.isArray(inputValue) && !inputValue.length);
|
|
@@ -1204,10 +1205,10 @@ var validateField = async (field, disabledFieldNames, formValues, validateAllFie
|
|
|
1204
1205
|
? !Array.isArray(inputValue) || !inputValue.length
|
|
1205
1206
|
: required &&
|
|
1206
1207
|
((!isRadioOrCheckbox && (isEmpty || isNullOrUndefined(inputValue))) ||
|
|
1207
|
-
(isBoolean
|
|
1208
|
+
(isBoolean(inputValue) && !inputValue) ||
|
|
1208
1209
|
(isCheckBox && !getCheckboxValue(refs).isValid) ||
|
|
1209
1210
|
(isRadio && !getRadioValue(refs).isValid))) {
|
|
1210
|
-
const { value, message } = isString
|
|
1211
|
+
const { value, message } = isString(required)
|
|
1211
1212
|
? { value: !!required, message: required }
|
|
1212
1213
|
: getValueAndMessage(required);
|
|
1213
1214
|
if (value) {
|
|
@@ -1243,14 +1244,14 @@ var validateField = async (field, disabledFieldNames, formValues, validateAllFie
|
|
|
1243
1244
|
const convertTimeToDate = (time) => new Date(new Date().toDateString() + ' ' + time);
|
|
1244
1245
|
const isTime = ref.type == 'time';
|
|
1245
1246
|
const isWeek = ref.type == 'week';
|
|
1246
|
-
if (isString
|
|
1247
|
+
if (isString(maxOutput.value) && inputValue) {
|
|
1247
1248
|
exceedMax = isTime
|
|
1248
1249
|
? convertTimeToDate(inputValue) > convertTimeToDate(maxOutput.value)
|
|
1249
1250
|
: isWeek
|
|
1250
1251
|
? inputValue > maxOutput.value
|
|
1251
1252
|
: valueDate > new Date(maxOutput.value);
|
|
1252
1253
|
}
|
|
1253
|
-
if (isString
|
|
1254
|
+
if (isString(minOutput.value) && inputValue) {
|
|
1254
1255
|
exceedMin = isTime
|
|
1255
1256
|
? convertTimeToDate(inputValue) < convertTimeToDate(minOutput.value)
|
|
1256
1257
|
: isWeek
|
|
@@ -1268,7 +1269,7 @@ var validateField = async (field, disabledFieldNames, formValues, validateAllFie
|
|
|
1268
1269
|
}
|
|
1269
1270
|
if ((maxLength || minLength) &&
|
|
1270
1271
|
!isEmpty &&
|
|
1271
|
-
(isString
|
|
1272
|
+
(isString(inputValue) || (isFieldArray && Array.isArray(inputValue)))) {
|
|
1272
1273
|
const maxLengthOutput = getValueAndMessage(maxLength);
|
|
1273
1274
|
const minLengthOutput = getValueAndMessage(minLength);
|
|
1274
1275
|
const exceedMax = !isNullOrUndefined(maxLengthOutput.value) &&
|
|
@@ -1283,7 +1284,7 @@ var validateField = async (field, disabledFieldNames, formValues, validateAllFie
|
|
|
1283
1284
|
}
|
|
1284
1285
|
}
|
|
1285
1286
|
}
|
|
1286
|
-
if (pattern && !isEmpty && isString
|
|
1287
|
+
if (pattern && !isEmpty && isString(inputValue)) {
|
|
1287
1288
|
const { value: patternValue, message } = getValueAndMessage(pattern);
|
|
1288
1289
|
if (isRegex(patternValue) && !inputValue.match(patternValue)) {
|
|
1289
1290
|
error[name] = {
|
|
@@ -1299,7 +1300,7 @@ var validateField = async (field, disabledFieldNames, formValues, validateAllFie
|
|
|
1299
1300
|
}
|
|
1300
1301
|
}
|
|
1301
1302
|
if (validate) {
|
|
1302
|
-
if (isFunction$
|
|
1303
|
+
if (isFunction$2(validate)) {
|
|
1303
1304
|
const result = await validate(inputValue, formValues);
|
|
1304
1305
|
const validateError = getValidateError(result, inputRef);
|
|
1305
1306
|
if (validateError) {
|
|
@@ -1313,10 +1314,10 @@ var validateField = async (field, disabledFieldNames, formValues, validateAllFie
|
|
|
1313
1314
|
}
|
|
1314
1315
|
}
|
|
1315
1316
|
}
|
|
1316
|
-
else if (isObject$
|
|
1317
|
+
else if (isObject$2(validate)) {
|
|
1317
1318
|
let validationResult = {};
|
|
1318
1319
|
for (const key in validate) {
|
|
1319
|
-
if (!isEmptyObject
|
|
1320
|
+
if (!isEmptyObject(validationResult) && !validateAllFieldCriteria) {
|
|
1320
1321
|
break;
|
|
1321
1322
|
}
|
|
1322
1323
|
const validateError = getValidateError(await validate[key](inputValue, formValues), inputRef, key);
|
|
@@ -1331,7 +1332,7 @@ var validateField = async (field, disabledFieldNames, formValues, validateAllFie
|
|
|
1331
1332
|
}
|
|
1332
1333
|
}
|
|
1333
1334
|
}
|
|
1334
|
-
if (!isEmptyObject
|
|
1335
|
+
if (!isEmptyObject(validationResult)) {
|
|
1335
1336
|
error[name] = {
|
|
1336
1337
|
ref: inputRef,
|
|
1337
1338
|
...validationResult,
|
|
@@ -1360,7 +1361,7 @@ function createFormControl(props = {}) {
|
|
|
1360
1361
|
submitCount: 0,
|
|
1361
1362
|
isDirty: false,
|
|
1362
1363
|
isReady: false,
|
|
1363
|
-
isLoading: isFunction$
|
|
1364
|
+
isLoading: isFunction$2(_options.defaultValues),
|
|
1364
1365
|
isValidating: false,
|
|
1365
1366
|
isSubmitted: false,
|
|
1366
1367
|
isSubmitting: false,
|
|
@@ -1373,7 +1374,7 @@ function createFormControl(props = {}) {
|
|
|
1373
1374
|
disabled: _options.disabled || false,
|
|
1374
1375
|
};
|
|
1375
1376
|
let _fields = {};
|
|
1376
|
-
let _defaultValues = isObject$
|
|
1377
|
+
let _defaultValues = isObject$2(_options.defaultValues) || isObject$2(_options.values)
|
|
1377
1378
|
? cloneObject(_options.defaultValues || _options.values) || {}
|
|
1378
1379
|
: {};
|
|
1379
1380
|
let _formValues = _options.shouldUnregister
|
|
@@ -1428,7 +1429,7 @@ function createFormControl(props = {}) {
|
|
|
1428
1429
|
shouldUpdateValid)) {
|
|
1429
1430
|
let isValid;
|
|
1430
1431
|
if (_options.resolver) {
|
|
1431
|
-
isValid = isEmptyObject
|
|
1432
|
+
isValid = isEmptyObject((await _runSchema()).errors);
|
|
1432
1433
|
_updateIsValidating();
|
|
1433
1434
|
}
|
|
1434
1435
|
else {
|
|
@@ -1456,7 +1457,7 @@ function createFormControl(props = {}) {
|
|
|
1456
1457
|
});
|
|
1457
1458
|
_subjects.state.next({
|
|
1458
1459
|
validatingFields: _formState.validatingFields,
|
|
1459
|
-
isValidating: !isEmptyObject
|
|
1460
|
+
isValidating: !isEmptyObject(_formState.validatingFields),
|
|
1460
1461
|
});
|
|
1461
1462
|
}
|
|
1462
1463
|
};
|
|
@@ -1511,8 +1512,8 @@ function createFormControl(props = {}) {
|
|
|
1511
1512
|
const updateValidAndValue = (name, shouldSkipSetValueAs, value, ref) => {
|
|
1512
1513
|
const field = get(_fields, name);
|
|
1513
1514
|
if (field) {
|
|
1514
|
-
const defaultValue = get(_formValues, name, isUndefined
|
|
1515
|
-
isUndefined
|
|
1515
|
+
const defaultValue = get(_formValues, name, isUndefined(value) ? get(_defaultValues, name) : value);
|
|
1516
|
+
isUndefined(defaultValue) ||
|
|
1516
1517
|
(ref && ref.defaultChecked) ||
|
|
1517
1518
|
shouldSkipSetValueAs
|
|
1518
1519
|
? set(_formValues, name, shouldSkipSetValueAs ? defaultValue : getFieldValue(field._f))
|
|
@@ -1564,7 +1565,7 @@ function createFormControl(props = {}) {
|
|
|
1564
1565
|
const shouldRenderByError = (name, isValid, error, fieldState) => {
|
|
1565
1566
|
const previousFieldError = get(_formState.errors, name);
|
|
1566
1567
|
const shouldUpdateValid = (_proxyFormState.isValid || _proxySubscribeFormState.isValid) &&
|
|
1567
|
-
isBoolean
|
|
1568
|
+
isBoolean(isValid) &&
|
|
1568
1569
|
_formState.isValid !== isValid;
|
|
1569
1570
|
if (_options.delayError && error) {
|
|
1570
1571
|
delayErrorCallback = debounce(() => updateErrors(name, error));
|
|
@@ -1578,11 +1579,11 @@ function createFormControl(props = {}) {
|
|
|
1578
1579
|
: unset(_formState.errors, name);
|
|
1579
1580
|
}
|
|
1580
1581
|
if ((error ? !deepEqual$1(previousFieldError, error) : previousFieldError) ||
|
|
1581
|
-
!isEmptyObject
|
|
1582
|
+
!isEmptyObject(fieldState) ||
|
|
1582
1583
|
shouldUpdateValid) {
|
|
1583
1584
|
const updatedFormState = {
|
|
1584
1585
|
...fieldState,
|
|
1585
|
-
...(shouldUpdateValid && isBoolean
|
|
1586
|
+
...(shouldUpdateValid && isBoolean(isValid) ? { isValid } : {}),
|
|
1586
1587
|
errors: _formState.errors,
|
|
1587
1588
|
name,
|
|
1588
1589
|
};
|
|
@@ -1644,7 +1645,7 @@ function createFormControl(props = {}) {
|
|
|
1644
1645
|
: set(_formState.errors, _f.name, fieldError[_f.name])
|
|
1645
1646
|
: unset(_formState.errors, _f.name));
|
|
1646
1647
|
}
|
|
1647
|
-
!isEmptyObject
|
|
1648
|
+
!isEmptyObject(fieldValue) &&
|
|
1648
1649
|
(await executeBuiltInValidation(fieldValue, shouldOnlyCheckValid, context));
|
|
1649
1650
|
}
|
|
1650
1651
|
}
|
|
@@ -1667,9 +1668,9 @@ function createFormControl(props = {}) {
|
|
|
1667
1668
|
const _getWatch = (names, defaultValue, isGlobal) => generateWatchOutput(names, _names, {
|
|
1668
1669
|
...(_state.mount
|
|
1669
1670
|
? _formValues
|
|
1670
|
-
: isUndefined
|
|
1671
|
+
: isUndefined(defaultValue)
|
|
1671
1672
|
? _defaultValues
|
|
1672
|
-
: isString
|
|
1673
|
+
: isString(names)
|
|
1673
1674
|
? { [names]: defaultValue }
|
|
1674
1675
|
: defaultValue),
|
|
1675
1676
|
}, isGlobal, defaultValue);
|
|
@@ -1734,7 +1735,7 @@ function createFormControl(props = {}) {
|
|
|
1734
1735
|
const fieldName = name + '.' + fieldKey;
|
|
1735
1736
|
const field = get(_fields, fieldName);
|
|
1736
1737
|
(_names.array.has(name) ||
|
|
1737
|
-
isObject$
|
|
1738
|
+
isObject$2(fieldValue) ||
|
|
1738
1739
|
(field && !field._f)) &&
|
|
1739
1740
|
!isDateObject(fieldValue)
|
|
1740
1741
|
? setValues(fieldName, fieldValue, options)
|
|
@@ -1812,7 +1813,7 @@ function createFormControl(props = {}) {
|
|
|
1812
1813
|
field._f.onChange(event);
|
|
1813
1814
|
}
|
|
1814
1815
|
const fieldState = updateTouchAndDirty(name, fieldValue, isBlurEvent);
|
|
1815
|
-
const shouldRender = !isEmptyObject
|
|
1816
|
+
const shouldRender = !isEmptyObject(fieldState) || watched;
|
|
1816
1817
|
!isBlurEvent &&
|
|
1817
1818
|
_subjects.state.next({
|
|
1818
1819
|
name,
|
|
@@ -1843,7 +1844,7 @@ function createFormControl(props = {}) {
|
|
|
1843
1844
|
const errorLookupResult = schemaErrorLookup(errors, _fields, previousErrorLookupResult.name || name);
|
|
1844
1845
|
error = errorLookupResult.error;
|
|
1845
1846
|
name = errorLookupResult.name;
|
|
1846
|
-
isValid = isEmptyObject
|
|
1847
|
+
isValid = isEmptyObject(errors);
|
|
1847
1848
|
}
|
|
1848
1849
|
}
|
|
1849
1850
|
else {
|
|
@@ -1881,8 +1882,8 @@ function createFormControl(props = {}) {
|
|
|
1881
1882
|
let validationResult;
|
|
1882
1883
|
const fieldNames = convertToArrayPayload(name);
|
|
1883
1884
|
if (_options.resolver) {
|
|
1884
|
-
const errors = await executeSchemaAndUpdateState(isUndefined
|
|
1885
|
-
isValid = isEmptyObject
|
|
1885
|
+
const errors = await executeSchemaAndUpdateState(isUndefined(name) ? name : fieldNames);
|
|
1886
|
+
isValid = isEmptyObject(errors);
|
|
1886
1887
|
validationResult = name
|
|
1887
1888
|
? !fieldNames.some((name) => get(errors, name))
|
|
1888
1889
|
: isValid;
|
|
@@ -1898,7 +1899,7 @@ function createFormControl(props = {}) {
|
|
|
1898
1899
|
validationResult = isValid = await executeBuiltInValidation(_fields);
|
|
1899
1900
|
}
|
|
1900
1901
|
_subjects.state.next({
|
|
1901
|
-
...(!isString
|
|
1902
|
+
...(!isString(name) ||
|
|
1902
1903
|
((_proxyFormState.isValid || _proxySubscribeFormState.isValid) &&
|
|
1903
1904
|
isValid !== _formState.isValid)
|
|
1904
1905
|
? {}
|
|
@@ -1918,9 +1919,9 @@ function createFormControl(props = {}) {
|
|
|
1918
1919
|
if (config) {
|
|
1919
1920
|
values = extractFormValues(config.dirtyFields ? _formState.dirtyFields : _formState.touchedFields, values);
|
|
1920
1921
|
}
|
|
1921
|
-
return isUndefined
|
|
1922
|
+
return isUndefined(fieldNames)
|
|
1922
1923
|
? values
|
|
1923
|
-
: isString
|
|
1924
|
+
: isString(fieldNames)
|
|
1924
1925
|
? get(values, fieldNames)
|
|
1925
1926
|
: fieldNames.map((name) => get(values, name));
|
|
1926
1927
|
};
|
|
@@ -1955,7 +1956,7 @@ function createFormControl(props = {}) {
|
|
|
1955
1956
|
});
|
|
1956
1957
|
options && options.shouldFocus && ref && ref.focus && ref.focus();
|
|
1957
1958
|
};
|
|
1958
|
-
const watch = (name, defaultValue) => isFunction$
|
|
1959
|
+
const watch = (name, defaultValue) => isFunction$2(name)
|
|
1959
1960
|
? _subjects.state.subscribe({
|
|
1960
1961
|
next: (payload) => 'values' in payload &&
|
|
1961
1962
|
name(_getWatch(undefined, defaultValue), payload),
|
|
@@ -2015,7 +2016,7 @@ function createFormControl(props = {}) {
|
|
|
2015
2016
|
!options.keepIsValid && _setValid();
|
|
2016
2017
|
};
|
|
2017
2018
|
const _setDisabledField = ({ disabled, name, }) => {
|
|
2018
|
-
if ((isBoolean
|
|
2019
|
+
if ((isBoolean(disabled) && _state.mount) ||
|
|
2019
2020
|
!!disabled ||
|
|
2020
2021
|
_names.disabled.has(name)) {
|
|
2021
2022
|
disabled ? _names.disabled.add(name) : _names.disabled.delete(name);
|
|
@@ -2023,7 +2024,7 @@ function createFormControl(props = {}) {
|
|
|
2023
2024
|
};
|
|
2024
2025
|
const register = (name, options = {}) => {
|
|
2025
2026
|
let field = get(_fields, name);
|
|
2026
|
-
const disabledIsDefined = isBoolean
|
|
2027
|
+
const disabledIsDefined = isBoolean(options.disabled) || isBoolean(_options.disabled);
|
|
2027
2028
|
set(_fields, name, {
|
|
2028
2029
|
...(field || {}),
|
|
2029
2030
|
_f: {
|
|
@@ -2036,7 +2037,7 @@ function createFormControl(props = {}) {
|
|
|
2036
2037
|
_names.mount.add(name);
|
|
2037
2038
|
if (field) {
|
|
2038
2039
|
_setDisabledField({
|
|
2039
|
-
disabled: isBoolean
|
|
2040
|
+
disabled: isBoolean(options.disabled)
|
|
2040
2041
|
? options.disabled
|
|
2041
2042
|
: _options.disabled,
|
|
2042
2043
|
name,
|
|
@@ -2066,7 +2067,7 @@ function createFormControl(props = {}) {
|
|
|
2066
2067
|
if (ref) {
|
|
2067
2068
|
register(name, options);
|
|
2068
2069
|
field = get(_fields, name);
|
|
2069
|
-
const fieldRef = isUndefined
|
|
2070
|
+
const fieldRef = isUndefined(ref.value)
|
|
2070
2071
|
? ref.querySelectorAll
|
|
2071
2072
|
? ref.querySelectorAll('input,select,textarea')[0] || ref
|
|
2072
2073
|
: ref
|
|
@@ -2110,7 +2111,7 @@ function createFormControl(props = {}) {
|
|
|
2110
2111
|
const _focusError = () => _options.shouldFocusError &&
|
|
2111
2112
|
iterateFieldsByAction(_fields, _focusInput, _names.mount);
|
|
2112
2113
|
const _disableForm = (disabled) => {
|
|
2113
|
-
if (isBoolean
|
|
2114
|
+
if (isBoolean(disabled)) {
|
|
2114
2115
|
_subjects.state.next({ disabled });
|
|
2115
2116
|
iterateFieldsByAction(_fields, (ref, name) => {
|
|
2116
2117
|
const currentField = get(_fields, name);
|
|
@@ -2151,7 +2152,7 @@ function createFormControl(props = {}) {
|
|
|
2151
2152
|
}
|
|
2152
2153
|
}
|
|
2153
2154
|
unset(_formState.errors, 'root');
|
|
2154
|
-
if (isEmptyObject
|
|
2155
|
+
if (isEmptyObject(_formState.errors)) {
|
|
2155
2156
|
_subjects.state.next({
|
|
2156
2157
|
errors: {},
|
|
2157
2158
|
});
|
|
@@ -2172,7 +2173,7 @@ function createFormControl(props = {}) {
|
|
|
2172
2173
|
_subjects.state.next({
|
|
2173
2174
|
isSubmitted: true,
|
|
2174
2175
|
isSubmitting: false,
|
|
2175
|
-
isSubmitSuccessful: isEmptyObject
|
|
2176
|
+
isSubmitSuccessful: isEmptyObject(_formState.errors) && !onValidError,
|
|
2176
2177
|
submitCount: _formState.submitCount + 1,
|
|
2177
2178
|
errors: _formState.errors,
|
|
2178
2179
|
});
|
|
@@ -2182,7 +2183,7 @@ function createFormControl(props = {}) {
|
|
|
2182
2183
|
};
|
|
2183
2184
|
const resetField = (name, options = {}) => {
|
|
2184
2185
|
if (get(_fields, name)) {
|
|
2185
|
-
if (isUndefined
|
|
2186
|
+
if (isUndefined(options.defaultValue)) {
|
|
2186
2187
|
setValue(name, cloneObject(get(_defaultValues, name)));
|
|
2187
2188
|
}
|
|
2188
2189
|
else {
|
|
@@ -2208,7 +2209,7 @@ function createFormControl(props = {}) {
|
|
|
2208
2209
|
const _reset = (formValues, keepStateOptions = {}) => {
|
|
2209
2210
|
const updatedValues = formValues ? cloneObject(formValues) : _defaultValues;
|
|
2210
2211
|
const cloneUpdatedValues = cloneObject(updatedValues);
|
|
2211
|
-
const isEmptyResetValues = isEmptyObject
|
|
2212
|
+
const isEmptyResetValues = isEmptyObject(formValues);
|
|
2212
2213
|
const values = isEmptyResetValues ? _defaultValues : cloneUpdatedValues;
|
|
2213
2214
|
if (!keepStateOptions.keepDefaultValues) {
|
|
2214
2215
|
_defaultValues = updatedValues;
|
|
@@ -2226,7 +2227,7 @@ function createFormControl(props = {}) {
|
|
|
2226
2227
|
}
|
|
2227
2228
|
}
|
|
2228
2229
|
else {
|
|
2229
|
-
if (isWeb && isUndefined
|
|
2230
|
+
if (isWeb && isUndefined(formValues)) {
|
|
2230
2231
|
for (const name of _names.mount) {
|
|
2231
2232
|
const field = get(_fields, name);
|
|
2232
2233
|
if (field && field._f) {
|
|
@@ -2277,7 +2278,7 @@ function createFormControl(props = {}) {
|
|
|
2277
2278
|
!_proxyFormState.isValid ||
|
|
2278
2279
|
!!keepStateOptions.keepIsValid ||
|
|
2279
2280
|
!!keepStateOptions.keepDirtyValues ||
|
|
2280
|
-
(!_options.shouldUnregister && !isEmptyObject
|
|
2281
|
+
(!_options.shouldUnregister && !isEmptyObject(values));
|
|
2281
2282
|
_state.watch = !!_options.shouldUnregister;
|
|
2282
2283
|
_state.keepIsValid = !!keepStateOptions.keepIsValid;
|
|
2283
2284
|
_state.action = false;
|
|
@@ -2322,7 +2323,7 @@ function createFormControl(props = {}) {
|
|
|
2322
2323
|
defaultValues: _defaultValues,
|
|
2323
2324
|
});
|
|
2324
2325
|
};
|
|
2325
|
-
const reset = (formValues, keepStateOptions) => _reset(isFunction$
|
|
2326
|
+
const reset = (formValues, keepStateOptions) => _reset(isFunction$2(formValues)
|
|
2326
2327
|
? formValues(_formValues)
|
|
2327
2328
|
: formValues, { ..._options.resetOptions, ...keepStateOptions });
|
|
2328
2329
|
const setFocus = (name, options = {}) => {
|
|
@@ -2338,7 +2339,7 @@ function createFormControl(props = {}) {
|
|
|
2338
2339
|
setTimeout(() => {
|
|
2339
2340
|
fieldRef.focus();
|
|
2340
2341
|
options.shouldSelect &&
|
|
2341
|
-
isFunction$
|
|
2342
|
+
isFunction$2(fieldRef.select) &&
|
|
2342
2343
|
fieldRef.select();
|
|
2343
2344
|
});
|
|
2344
2345
|
}
|
|
@@ -2350,7 +2351,7 @@ function createFormControl(props = {}) {
|
|
|
2350
2351
|
...updatedFormState,
|
|
2351
2352
|
};
|
|
2352
2353
|
};
|
|
2353
|
-
const _resetDefaultValues = () => isFunction$
|
|
2354
|
+
const _resetDefaultValues = () => isFunction$2(_options.defaultValues) &&
|
|
2354
2355
|
_options.defaultValues().then((values) => {
|
|
2355
2356
|
reset(values, _options.resetOptions);
|
|
2356
2357
|
_subjects.state.next({
|
|
@@ -2447,9 +2448,9 @@ var generateId = () => {
|
|
|
2447
2448
|
});
|
|
2448
2449
|
};
|
|
2449
2450
|
|
|
2450
|
-
var getFocusFieldName = (name, index, options = {}) => options.shouldFocus || isUndefined
|
|
2451
|
+
var getFocusFieldName = (name, index, options = {}) => options.shouldFocus || isUndefined(options.shouldFocus)
|
|
2451
2452
|
? options.focusName ||
|
|
2452
|
-
`${name}.${isUndefined
|
|
2453
|
+
`${name}.${isUndefined(options.focusIndex) ? index : options.focusIndex}.`
|
|
2453
2454
|
: '';
|
|
2454
2455
|
|
|
2455
2456
|
var appendAt = (data, value) => [
|
|
@@ -2471,7 +2472,7 @@ var moveArrayAt = (data, from, to) => {
|
|
|
2471
2472
|
if (!Array.isArray(data)) {
|
|
2472
2473
|
return [];
|
|
2473
2474
|
}
|
|
2474
|
-
if (isUndefined
|
|
2475
|
+
if (isUndefined(data[to])) {
|
|
2475
2476
|
data[to] = undefined;
|
|
2476
2477
|
}
|
|
2477
2478
|
data.splice(to, 0, data.splice(from, 1)[0]);
|
|
@@ -2492,7 +2493,7 @@ function removeAtIndexes(data, indexes) {
|
|
|
2492
2493
|
}
|
|
2493
2494
|
return compact(temp).length ? temp : [];
|
|
2494
2495
|
}
|
|
2495
|
-
var removeArrayAt = (data, index) => isUndefined
|
|
2496
|
+
var removeArrayAt = (data, index) => isUndefined(index)
|
|
2496
2497
|
? []
|
|
2497
2498
|
: removeAtIndexes(data, convertToArrayPayload(index).sort((a, b) => a - b));
|
|
2498
2499
|
|
|
@@ -2688,7 +2689,7 @@ function useFieldArray(props) {
|
|
|
2688
2689
|
field._f &&
|
|
2689
2690
|
!(getValidationModes(control._options.reValidateMode).isOnSubmit &&
|
|
2690
2691
|
getValidationModes(control._options.mode).isOnSubmit)) {
|
|
2691
|
-
validateField(field, control._names.disabled, control._formValues, control._options.criteriaMode === VALIDATION_MODE.all, control._options.shouldUseNativeValidation, true).then((error) => !isEmptyObject
|
|
2692
|
+
validateField(field, control._names.disabled, control._formValues, control._options.criteriaMode === VALIDATION_MODE.all, control._options.shouldUseNativeValidation, true).then((error) => !isEmptyObject(error) &&
|
|
2692
2693
|
control._subjects.state.next({
|
|
2693
2694
|
errors: updateFieldArrayRootError(control._formState.errors, error, name),
|
|
2694
2695
|
}));
|
|
@@ -2778,7 +2779,7 @@ function useForm(props = {}) {
|
|
|
2778
2779
|
const [formState, updateFormState] = React.useState({
|
|
2779
2780
|
isDirty: false,
|
|
2780
2781
|
isValidating: false,
|
|
2781
|
-
isLoading: isFunction$
|
|
2782
|
+
isLoading: isFunction$2(props.defaultValues),
|
|
2782
2783
|
isSubmitted: false,
|
|
2783
2784
|
isSubmitting: false,
|
|
2784
2785
|
isSubmitSuccessful: false,
|
|
@@ -2790,7 +2791,7 @@ function useForm(props = {}) {
|
|
|
2790
2791
|
errors: props.errors || {},
|
|
2791
2792
|
disabled: props.disabled || false,
|
|
2792
2793
|
isReady: false,
|
|
2793
|
-
defaultValues: isFunction$
|
|
2794
|
+
defaultValues: isFunction$2(props.defaultValues)
|
|
2794
2795
|
? undefined
|
|
2795
2796
|
: props.defaultValues,
|
|
2796
2797
|
});
|
|
@@ -2800,7 +2801,7 @@ function useForm(props = {}) {
|
|
|
2800
2801
|
...props.formControl,
|
|
2801
2802
|
formState,
|
|
2802
2803
|
};
|
|
2803
|
-
if (props.defaultValues && !isFunction$
|
|
2804
|
+
if (props.defaultValues && !isFunction$2(props.defaultValues)) {
|
|
2804
2805
|
props.formControl.reset(props.defaultValues, props.resetOptions);
|
|
2805
2806
|
}
|
|
2806
2807
|
}
|
|
@@ -3571,7 +3572,7 @@ var Action;
|
|
|
3571
3572
|
Action["UnregisterDroppable"] = "unregisterDroppable";
|
|
3572
3573
|
})(Action || (Action = {}));
|
|
3573
3574
|
|
|
3574
|
-
function noop$
|
|
3575
|
+
function noop$3() {}
|
|
3575
3576
|
|
|
3576
3577
|
function useSensor(sensor, options) {
|
|
3577
3578
|
return React.useMemo(() => ({
|
|
@@ -5779,12 +5780,12 @@ const defaultPublicContext = {
|
|
|
5779
5780
|
current: null
|
|
5780
5781
|
},
|
|
5781
5782
|
rect: null,
|
|
5782
|
-
setRef: noop$
|
|
5783
|
+
setRef: noop$3
|
|
5783
5784
|
},
|
|
5784
5785
|
scrollableAncestors: [],
|
|
5785
5786
|
scrollableAncestorRects: [],
|
|
5786
5787
|
measuringConfiguration: defaultMeasuringConfiguration,
|
|
5787
|
-
measureDroppableContainers: noop$
|
|
5788
|
+
measureDroppableContainers: noop$3,
|
|
5788
5789
|
windowRect: null,
|
|
5789
5790
|
measuringScheduled: false
|
|
5790
5791
|
};
|
|
@@ -5796,10 +5797,10 @@ const defaultInternalContext = {
|
|
|
5796
5797
|
ariaDescribedById: {
|
|
5797
5798
|
draggable: ''
|
|
5798
5799
|
},
|
|
5799
|
-
dispatch: noop$
|
|
5800
|
+
dispatch: noop$3,
|
|
5800
5801
|
draggableNodes: /*#__PURE__*/new Map(),
|
|
5801
5802
|
over: null,
|
|
5802
|
-
measureDroppableContainers: noop$
|
|
5803
|
+
measureDroppableContainers: noop$3
|
|
5803
5804
|
};
|
|
5804
5805
|
const InternalContext = /*#__PURE__*/React.createContext(defaultInternalContext);
|
|
5805
5806
|
const PublicContext = /*#__PURE__*/React.createContext(defaultPublicContext);
|
|
@@ -7542,8 +7543,8 @@ function once(func) {
|
|
|
7542
7543
|
return func.apply(this, arguments);
|
|
7543
7544
|
};
|
|
7544
7545
|
}
|
|
7545
|
-
var noop$
|
|
7546
|
-
function isFunction$
|
|
7546
|
+
var noop$2 = function noop() {};
|
|
7547
|
+
function isFunction$1(fn) {
|
|
7547
7548
|
return typeof fn === "function";
|
|
7548
7549
|
}
|
|
7549
7550
|
function isStringish(value) {
|
|
@@ -7556,11 +7557,11 @@ function isStringish(value) {
|
|
|
7556
7557
|
}
|
|
7557
7558
|
return false;
|
|
7558
7559
|
}
|
|
7559
|
-
function isObject$
|
|
7560
|
+
function isObject$1(value) {
|
|
7560
7561
|
return value !== null && typeof value === "object";
|
|
7561
7562
|
}
|
|
7562
|
-
function isPlainObject$
|
|
7563
|
-
if (!isObject$
|
|
7563
|
+
function isPlainObject$1(value) {
|
|
7564
|
+
if (!isObject$1(value)) {
|
|
7564
7565
|
return false;
|
|
7565
7566
|
}
|
|
7566
7567
|
var proto = Object.getPrototypeOf(value);
|
|
@@ -7601,7 +7602,7 @@ function createInstanceofPredicate(name, theClass) {
|
|
|
7601
7602
|
var propName = "isMobX" + name;
|
|
7602
7603
|
theClass.prototype[propName] = true;
|
|
7603
7604
|
return function (x) {
|
|
7604
|
-
return isObject$
|
|
7605
|
+
return isObject$1(x) && x[propName] === true;
|
|
7605
7606
|
};
|
|
7606
7607
|
}
|
|
7607
7608
|
/**
|
|
@@ -7912,17 +7913,17 @@ Atom.diffValueMask_ = 4;
|
|
|
7912
7913
|
var isAtom = /*#__PURE__*/createInstanceofPredicate("Atom", Atom);
|
|
7913
7914
|
function createAtom(name, onBecomeObservedHandler, onBecomeUnobservedHandler) {
|
|
7914
7915
|
if (onBecomeObservedHandler === void 0) {
|
|
7915
|
-
onBecomeObservedHandler = noop$
|
|
7916
|
+
onBecomeObservedHandler = noop$2;
|
|
7916
7917
|
}
|
|
7917
7918
|
if (onBecomeUnobservedHandler === void 0) {
|
|
7918
|
-
onBecomeUnobservedHandler = noop$
|
|
7919
|
+
onBecomeUnobservedHandler = noop$2;
|
|
7919
7920
|
}
|
|
7920
7921
|
var atom = new Atom(name);
|
|
7921
7922
|
// default `noop` listener will not initialize the hook Set
|
|
7922
|
-
if (onBecomeObservedHandler !== noop$
|
|
7923
|
+
if (onBecomeObservedHandler !== noop$2) {
|
|
7923
7924
|
onBecomeObserved(atom, onBecomeObservedHandler);
|
|
7924
7925
|
}
|
|
7925
|
-
if (onBecomeUnobservedHandler !== noop$
|
|
7926
|
+
if (onBecomeUnobservedHandler !== noop$2) {
|
|
7926
7927
|
onBecomeUnobserved(atom, onBecomeUnobservedHandler);
|
|
7927
7928
|
}
|
|
7928
7929
|
return atom;
|
|
@@ -7951,7 +7952,7 @@ function deepEnhancer(v, _, name) {
|
|
|
7951
7952
|
name: name
|
|
7952
7953
|
});
|
|
7953
7954
|
}
|
|
7954
|
-
if (isPlainObject$
|
|
7955
|
+
if (isPlainObject$1(v)) {
|
|
7955
7956
|
return observable.object(v, undefined, {
|
|
7956
7957
|
name: name
|
|
7957
7958
|
});
|
|
@@ -7988,7 +7989,7 @@ function shallowEnhancer(v, _, name) {
|
|
|
7988
7989
|
deep: false
|
|
7989
7990
|
});
|
|
7990
7991
|
}
|
|
7991
|
-
if (isPlainObject$
|
|
7992
|
+
if (isPlainObject$1(v)) {
|
|
7992
7993
|
return observable.object(v, undefined, {
|
|
7993
7994
|
name: name,
|
|
7994
7995
|
deep: false
|
|
@@ -8108,7 +8109,7 @@ function decorate_20223_$1(mthd, context) {
|
|
|
8108
8109
|
function assertActionDescriptor(adm, _ref, key, _ref2) {
|
|
8109
8110
|
var annotationType_ = _ref.annotationType_;
|
|
8110
8111
|
var value = _ref2.value;
|
|
8111
|
-
if (process.env.NODE_ENV !== "production" && !isFunction$
|
|
8112
|
+
if (process.env.NODE_ENV !== "production" && !isFunction$1(value)) {
|
|
8112
8113
|
die("Cannot apply '" + annotationType_ + "' to '" + adm.name_ + "." + key.toString() + "':" + ("\n'" + annotationType_ + "' can only be used on properties with a function value."));
|
|
8113
8114
|
}
|
|
8114
8115
|
}
|
|
@@ -8199,7 +8200,7 @@ function decorate_20223_$2(mthd, context) {
|
|
|
8199
8200
|
function assertFlowDescriptor(adm, _ref, key, _ref2) {
|
|
8200
8201
|
var annotationType_ = _ref.annotationType_;
|
|
8201
8202
|
var value = _ref2.value;
|
|
8202
|
-
if (process.env.NODE_ENV !== "production" && !isFunction$
|
|
8203
|
+
if (process.env.NODE_ENV !== "production" && !isFunction$1(value)) {
|
|
8203
8204
|
die("Cannot apply '" + annotationType_ + "' to '" + adm.name_ + "." + key.toString() + "':" + ("\n'" + annotationType_ + "' can only be used on properties with a generator function value."));
|
|
8204
8205
|
}
|
|
8205
8206
|
}
|
|
@@ -8497,7 +8498,7 @@ function createObservable(v, arg2, arg3) {
|
|
|
8497
8498
|
return v;
|
|
8498
8499
|
}
|
|
8499
8500
|
// plain object
|
|
8500
|
-
if (isPlainObject$
|
|
8501
|
+
if (isPlainObject$1(v)) {
|
|
8501
8502
|
return observable.object(v, arg2, arg3);
|
|
8502
8503
|
}
|
|
8503
8504
|
// Array
|
|
@@ -8569,20 +8570,20 @@ var computed = function computed(arg1, arg2) {
|
|
|
8569
8570
|
// @computed
|
|
8570
8571
|
return storeAnnotation(arg1, arg2, computedAnnotation);
|
|
8571
8572
|
}
|
|
8572
|
-
if (isPlainObject$
|
|
8573
|
+
if (isPlainObject$1(arg1)) {
|
|
8573
8574
|
// @computed({ options })
|
|
8574
8575
|
return createDecoratorAnnotation(createComputedAnnotation(COMPUTED, arg1));
|
|
8575
8576
|
}
|
|
8576
8577
|
// computed(expr, options?)
|
|
8577
8578
|
if (process.env.NODE_ENV !== "production") {
|
|
8578
|
-
if (!isFunction$
|
|
8579
|
+
if (!isFunction$1(arg1)) {
|
|
8579
8580
|
die("First argument to `computed` should be an expression.");
|
|
8580
8581
|
}
|
|
8581
|
-
if (isFunction$
|
|
8582
|
+
if (isFunction$1(arg2)) {
|
|
8582
8583
|
die("A setter as second argument is no longer supported, use `{ set: fn }` option instead");
|
|
8583
8584
|
}
|
|
8584
8585
|
}
|
|
8585
|
-
var opts = isPlainObject$
|
|
8586
|
+
var opts = isPlainObject$1(arg2) ? arg2 : {};
|
|
8586
8587
|
opts.get = arg1;
|
|
8587
8588
|
opts.name || (opts.name = arg1.name || ""); /* for generated name */
|
|
8588
8589
|
return new ComputedValue(opts);
|
|
@@ -8608,7 +8609,7 @@ function createAction(actionName, fn, autoAction, ref) {
|
|
|
8608
8609
|
autoAction = false;
|
|
8609
8610
|
}
|
|
8610
8611
|
if (process.env.NODE_ENV !== "production") {
|
|
8611
|
-
if (!isFunction$
|
|
8612
|
+
if (!isFunction$1(fn)) {
|
|
8612
8613
|
die("`action` can only be invoked on functions");
|
|
8613
8614
|
}
|
|
8614
8615
|
if (typeof actionName !== "string" || !actionName) {
|
|
@@ -10065,11 +10066,11 @@ var autoActionBoundAnnotation = /*#__PURE__*/createActionAnnotation(AUTOACTION_B
|
|
|
10065
10066
|
function createActionFactory(autoAction) {
|
|
10066
10067
|
var res = function action(arg1, arg2) {
|
|
10067
10068
|
// action(fn() {})
|
|
10068
|
-
if (isFunction$
|
|
10069
|
+
if (isFunction$1(arg1)) {
|
|
10069
10070
|
return createAction(arg1.name || DEFAULT_ACTION_NAME, arg1, autoAction);
|
|
10070
10071
|
}
|
|
10071
10072
|
// action("name", fn() {})
|
|
10072
|
-
if (isFunction$
|
|
10073
|
+
if (isFunction$1(arg2)) {
|
|
10073
10074
|
return createAction(arg1, arg2, autoAction);
|
|
10074
10075
|
}
|
|
10075
10076
|
// @action (2022.3 Decorators)
|
|
@@ -10100,7 +10101,7 @@ Object.assign(autoAction, autoActionAnnotation);
|
|
|
10100
10101
|
action.bound = /*#__PURE__*/createDecoratorAnnotation(actionBoundAnnotation);
|
|
10101
10102
|
autoAction.bound = /*#__PURE__*/createDecoratorAnnotation(autoActionBoundAnnotation);
|
|
10102
10103
|
function isAction(thing) {
|
|
10103
|
-
return isFunction$
|
|
10104
|
+
return isFunction$1(thing) && thing.isMobxAction === true;
|
|
10104
10105
|
}
|
|
10105
10106
|
|
|
10106
10107
|
/**
|
|
@@ -10115,7 +10116,7 @@ function autorun(view, opts) {
|
|
|
10115
10116
|
opts = EMPTY_OBJECT;
|
|
10116
10117
|
}
|
|
10117
10118
|
if (process.env.NODE_ENV !== "production") {
|
|
10118
|
-
if (!isFunction$
|
|
10119
|
+
if (!isFunction$1(view)) {
|
|
10119
10120
|
die("Autorun expects a function as first argument");
|
|
10120
10121
|
}
|
|
10121
10122
|
if (isAction(view)) {
|
|
@@ -10173,7 +10174,7 @@ function onBecomeUnobserved(thing, arg2, arg3) {
|
|
|
10173
10174
|
}
|
|
10174
10175
|
function interceptHook(hook, thing, arg2, arg3) {
|
|
10175
10176
|
var atom = getAtom(thing);
|
|
10176
|
-
var cb = isFunction$
|
|
10177
|
+
var cb = isFunction$1(arg3) ? arg3 : arg2;
|
|
10177
10178
|
var listenersKey = hook + "L";
|
|
10178
10179
|
if (atom[listenersKey]) {
|
|
10179
10180
|
atom[listenersKey].add(cb);
|
|
@@ -10237,7 +10238,7 @@ function extendObservable(target, properties, annotations, options) {
|
|
|
10237
10238
|
if (isObservableMap(target)) {
|
|
10238
10239
|
die("'extendObservable' should not be used on maps, use map.merge instead");
|
|
10239
10240
|
}
|
|
10240
|
-
if (!isPlainObject$
|
|
10241
|
+
if (!isPlainObject$1(properties)) {
|
|
10241
10242
|
die("'extendObservable' only accepts plain objects as second argument");
|
|
10242
10243
|
}
|
|
10243
10244
|
if (isObservable(properties) || isObservable(annotations)) {
|
|
@@ -10329,7 +10330,7 @@ var flow = /*#__PURE__*/Object.assign(function flow(arg1, arg2) {
|
|
|
10329
10330
|
next(ret);
|
|
10330
10331
|
}
|
|
10331
10332
|
function next(ret) {
|
|
10332
|
-
if (isFunction$
|
|
10333
|
+
if (isFunction$1(ret == null ? void 0 : ret.then)) {
|
|
10333
10334
|
// an async iterator
|
|
10334
10335
|
ret.then(next, reject);
|
|
10335
10336
|
return;
|
|
@@ -10351,7 +10352,7 @@ var flow = /*#__PURE__*/Object.assign(function flow(arg1, arg2) {
|
|
|
10351
10352
|
var _res = gen["return"](undefined);
|
|
10352
10353
|
// eat anything that promise would do, it's cancelled!
|
|
10353
10354
|
var yieldedPromise = Promise.resolve(_res.value);
|
|
10354
|
-
yieldedPromise.then(noop$
|
|
10355
|
+
yieldedPromise.then(noop$2, noop$2);
|
|
10355
10356
|
cancelPromise(yieldedPromise); // maybe it can be cancelled :)
|
|
10356
10357
|
// reject our original promise
|
|
10357
10358
|
rejector(new FlowCancellationError());
|
|
@@ -10366,7 +10367,7 @@ var flow = /*#__PURE__*/Object.assign(function flow(arg1, arg2) {
|
|
|
10366
10367
|
}, flowAnnotation);
|
|
10367
10368
|
flow.bound = /*#__PURE__*/createDecoratorAnnotation(flowBoundAnnotation);
|
|
10368
10369
|
function cancelPromise(promise) {
|
|
10369
|
-
if (isFunction$
|
|
10370
|
+
if (isFunction$1(promise.cancel)) {
|
|
10370
10371
|
promise.cancel();
|
|
10371
10372
|
}
|
|
10372
10373
|
}
|
|
@@ -10579,7 +10580,7 @@ function makeObservable(target, annotations, options) {
|
|
|
10579
10580
|
var keysSymbol = /*#__PURE__*/Symbol("mobx-keys");
|
|
10580
10581
|
function makeAutoObservable(target, overrides, options) {
|
|
10581
10582
|
if (process.env.NODE_ENV !== "production") {
|
|
10582
|
-
if (!isPlainObject$
|
|
10583
|
+
if (!isPlainObject$1(target) && !isPlainObject$1(Object.getPrototypeOf(target))) {
|
|
10583
10584
|
die("'makeAutoObservable' can only be used for classes that don't have a superclass");
|
|
10584
10585
|
}
|
|
10585
10586
|
if (isObservableObject(target)) {
|
|
@@ -10588,7 +10589,7 @@ function makeAutoObservable(target, overrides, options) {
|
|
|
10588
10589
|
}
|
|
10589
10590
|
// Optimization: avoid visiting protos
|
|
10590
10591
|
// Assumes that annotation.make_/.extend_ works the same for plain objects
|
|
10591
|
-
if (isPlainObject$
|
|
10592
|
+
if (isPlainObject$1(target)) {
|
|
10592
10593
|
return extendObservable(target, target, overrides, options);
|
|
10593
10594
|
}
|
|
10594
10595
|
initObservable(function () {
|
|
@@ -11090,7 +11091,7 @@ function reduceLikeFunc(funcName) {
|
|
|
11090
11091
|
}
|
|
11091
11092
|
var isObservableArrayAdministration = /*#__PURE__*/createInstanceofPredicate("ObservableArrayAdministration", ObservableArrayAdministration);
|
|
11092
11093
|
function isObservableArray(thing) {
|
|
11093
|
-
return isObject$
|
|
11094
|
+
return isObject$1(thing) && isObservableArrayAdministration(thing[$mobx]);
|
|
11094
11095
|
}
|
|
11095
11096
|
|
|
11096
11097
|
var ObservableMapMarker = {};
|
|
@@ -11119,7 +11120,7 @@ var ObservableMap = /*#__PURE__*/function () {
|
|
|
11119
11120
|
this.dehancer = void 0;
|
|
11120
11121
|
this.enhancer_ = enhancer_;
|
|
11121
11122
|
this.name_ = name_;
|
|
11122
|
-
if (!isFunction$
|
|
11123
|
+
if (!isFunction$1(Map)) {
|
|
11123
11124
|
die(18);
|
|
11124
11125
|
}
|
|
11125
11126
|
initObservable(function () {
|
|
@@ -11338,7 +11339,7 @@ var ObservableMap = /*#__PURE__*/function () {
|
|
|
11338
11339
|
other = new Map(other);
|
|
11339
11340
|
}
|
|
11340
11341
|
transaction(function () {
|
|
11341
|
-
if (isPlainObject$
|
|
11342
|
+
if (isPlainObject$1(other)) {
|
|
11342
11343
|
getPlainObjectKeys(other).forEach(function (key) {
|
|
11343
11344
|
return _this5.set(key, other[key]);
|
|
11344
11345
|
});
|
|
@@ -11498,7 +11499,7 @@ function convertToMap(dataStructure) {
|
|
|
11498
11499
|
return dataStructure;
|
|
11499
11500
|
} else if (Array.isArray(dataStructure)) {
|
|
11500
11501
|
return new Map(dataStructure);
|
|
11501
|
-
} else if (isPlainObject$
|
|
11502
|
+
} else if (isPlainObject$1(dataStructure)) {
|
|
11502
11503
|
var map = new Map();
|
|
11503
11504
|
for (var key in dataStructure) {
|
|
11504
11505
|
map.set(key, dataStructure[key]);
|
|
@@ -11528,7 +11529,7 @@ var ObservableSet = /*#__PURE__*/function () {
|
|
|
11528
11529
|
this.dehancer = void 0;
|
|
11529
11530
|
this.enhancer_ = void 0;
|
|
11530
11531
|
this.name_ = name_;
|
|
11531
|
-
if (!isFunction$
|
|
11532
|
+
if (!isFunction$1(Set)) {
|
|
11532
11533
|
die(22);
|
|
11533
11534
|
}
|
|
11534
11535
|
this.enhancer_ = function (newV, oldV) {
|
|
@@ -11819,7 +11820,7 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
|
|
|
11819
11820
|
this.defaultAnnotation_ = defaultAnnotation_;
|
|
11820
11821
|
this.keysAtom_ = new Atom(process.env.NODE_ENV !== "production" ? this.name_ + ".keys" : "ObservableObject.keys");
|
|
11821
11822
|
// Optimization: we use this frequently
|
|
11822
|
-
this.isPlainObject_ = isPlainObject$
|
|
11823
|
+
this.isPlainObject_ = isPlainObject$1(this.target_);
|
|
11823
11824
|
if (process.env.NODE_ENV !== "production" && !isAnnotation(this.defaultAnnotation_)) {
|
|
11824
11825
|
die("defaultAnnotation must be valid annotation");
|
|
11825
11826
|
}
|
|
@@ -12320,7 +12321,7 @@ function asObservableObject(target, options) {
|
|
|
12320
12321
|
if (process.env.NODE_ENV !== "production" && !Object.isExtensible(target)) {
|
|
12321
12322
|
die("Cannot make the designated object observable; it is not extensible");
|
|
12322
12323
|
}
|
|
12323
|
-
var name = (_options$name = options == null ? void 0 : options.name) != null ? _options$name : process.env.NODE_ENV !== "production" ? (isPlainObject$
|
|
12324
|
+
var name = (_options$name = options == null ? void 0 : options.name) != null ? _options$name : process.env.NODE_ENV !== "production" ? (isPlainObject$1(target) ? "ObservableObject" : target.constructor.name) + "@" + getNextId() : "ObservableObject";
|
|
12324
12325
|
var adm = new ObservableObjectAdministration(target, new Map(), String(name), getAnnotationFromOptions(options));
|
|
12325
12326
|
addHiddenProp(target, $mobx, adm);
|
|
12326
12327
|
return target;
|
|
@@ -12337,7 +12338,7 @@ function getCachedObservablePropDescriptor(key) {
|
|
|
12337
12338
|
});
|
|
12338
12339
|
}
|
|
12339
12340
|
function isObservableObject(thing) {
|
|
12340
|
-
if (isObject$
|
|
12341
|
+
if (isObject$1(thing)) {
|
|
12341
12342
|
return isObservableObjectAdministration(thing[$mobx]);
|
|
12342
12343
|
}
|
|
12343
12344
|
return false;
|
|
@@ -12566,7 +12567,7 @@ function getAtom(thing, property) {
|
|
|
12566
12567
|
if (isAtom(thing) || isComputedValue(thing) || isReaction(thing)) {
|
|
12567
12568
|
return thing;
|
|
12568
12569
|
}
|
|
12569
|
-
} else if (isFunction$
|
|
12570
|
+
} else if (isFunction$1(thing)) {
|
|
12570
12571
|
if (isReaction(thing[$mobx])) {
|
|
12571
12572
|
// disposer function
|
|
12572
12573
|
return thing[$mobx];
|
|
@@ -12622,7 +12623,7 @@ function initObservable(cb) {
|
|
|
12622
12623
|
}
|
|
12623
12624
|
}
|
|
12624
12625
|
|
|
12625
|
-
var toString$
|
|
12626
|
+
var toString$2 = objectPrototype.toString;
|
|
12626
12627
|
function deepEqual(a, b, depth) {
|
|
12627
12628
|
if (depth === void 0) {
|
|
12628
12629
|
depth = -1;
|
|
@@ -12653,8 +12654,8 @@ function eq(a, b, depth, aStack, bStack) {
|
|
|
12653
12654
|
return false;
|
|
12654
12655
|
}
|
|
12655
12656
|
// Compare `[[Class]]` names.
|
|
12656
|
-
var className = toString$
|
|
12657
|
-
if (className !== toString$
|
|
12657
|
+
var className = toString$2.call(a);
|
|
12658
|
+
if (className !== toString$2.call(b)) {
|
|
12658
12659
|
return false;
|
|
12659
12660
|
}
|
|
12660
12661
|
switch (className) {
|
|
@@ -12702,7 +12703,7 @@ function eq(a, b, depth, aStack, bStack) {
|
|
|
12702
12703
|
// from different frames are.
|
|
12703
12704
|
var aCtor = a.constructor,
|
|
12704
12705
|
bCtor = b.constructor;
|
|
12705
|
-
if (aCtor !== bCtor && !(isFunction$
|
|
12706
|
+
if (aCtor !== bCtor && !(isFunction$1(aCtor) && aCtor instanceof aCtor && isFunction$1(bCtor) && bCtor instanceof bCtor) && "constructor" in a && "constructor" in b) {
|
|
12706
12707
|
return false;
|
|
12707
12708
|
}
|
|
12708
12709
|
}
|
|
@@ -12789,7 +12790,7 @@ function getSelf() {
|
|
|
12789
12790
|
function isAnnotation(thing) {
|
|
12790
12791
|
return (
|
|
12791
12792
|
// Can be function
|
|
12792
|
-
thing instanceof Object && typeof thing.annotationType_ === "string" && isFunction$
|
|
12793
|
+
thing instanceof Object && typeof thing.annotationType_ === "string" && isFunction$1(thing.make_) && isFunction$1(thing.extend_)
|
|
12793
12794
|
);
|
|
12794
12795
|
}
|
|
12795
12796
|
|
|
@@ -12879,3918 +12880,6 @@ const useRootStore = () => {
|
|
|
12879
12880
|
return rootStore;
|
|
12880
12881
|
};
|
|
12881
12882
|
|
|
12882
|
-
/**
|
|
12883
|
-
* Create a bound version of a function with a specified `this` context
|
|
12884
|
-
*
|
|
12885
|
-
* @param {Function} fn - The function to bind
|
|
12886
|
-
* @param {*} thisArg - The value to be passed as the `this` parameter
|
|
12887
|
-
* @returns {Function} A new function that will call the original function with the specified `this` context
|
|
12888
|
-
*/
|
|
12889
|
-
function bind(fn, thisArg) {
|
|
12890
|
-
return function wrap() {
|
|
12891
|
-
return fn.apply(thisArg, arguments);
|
|
12892
|
-
};
|
|
12893
|
-
}
|
|
12894
|
-
|
|
12895
|
-
// utils is a library of generic helper functions non-specific to axios
|
|
12896
|
-
|
|
12897
|
-
const {toString: toString$2} = Object.prototype;
|
|
12898
|
-
const {getPrototypeOf} = Object;
|
|
12899
|
-
const {iterator, toStringTag} = Symbol;
|
|
12900
|
-
|
|
12901
|
-
const kindOf = (cache => thing => {
|
|
12902
|
-
const str = toString$2.call(thing);
|
|
12903
|
-
return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
|
|
12904
|
-
})(Object.create(null));
|
|
12905
|
-
|
|
12906
|
-
const kindOfTest = (type) => {
|
|
12907
|
-
type = type.toLowerCase();
|
|
12908
|
-
return (thing) => kindOf(thing) === type
|
|
12909
|
-
};
|
|
12910
|
-
|
|
12911
|
-
const typeOfTest = type => thing => typeof thing === type;
|
|
12912
|
-
|
|
12913
|
-
/**
|
|
12914
|
-
* Determine if a value is an Array
|
|
12915
|
-
*
|
|
12916
|
-
* @param {Object} val The value to test
|
|
12917
|
-
*
|
|
12918
|
-
* @returns {boolean} True if value is an Array, otherwise false
|
|
12919
|
-
*/
|
|
12920
|
-
const {isArray} = Array;
|
|
12921
|
-
|
|
12922
|
-
/**
|
|
12923
|
-
* Determine if a value is undefined
|
|
12924
|
-
*
|
|
12925
|
-
* @param {*} val The value to test
|
|
12926
|
-
*
|
|
12927
|
-
* @returns {boolean} True if the value is undefined, otherwise false
|
|
12928
|
-
*/
|
|
12929
|
-
const isUndefined = typeOfTest('undefined');
|
|
12930
|
-
|
|
12931
|
-
/**
|
|
12932
|
-
* Determine if a value is a Buffer
|
|
12933
|
-
*
|
|
12934
|
-
* @param {*} val The value to test
|
|
12935
|
-
*
|
|
12936
|
-
* @returns {boolean} True if value is a Buffer, otherwise false
|
|
12937
|
-
*/
|
|
12938
|
-
function isBuffer(val) {
|
|
12939
|
-
return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
|
|
12940
|
-
&& isFunction$2(val.constructor.isBuffer) && val.constructor.isBuffer(val);
|
|
12941
|
-
}
|
|
12942
|
-
|
|
12943
|
-
/**
|
|
12944
|
-
* Determine if a value is an ArrayBuffer
|
|
12945
|
-
*
|
|
12946
|
-
* @param {*} val The value to test
|
|
12947
|
-
*
|
|
12948
|
-
* @returns {boolean} True if value is an ArrayBuffer, otherwise false
|
|
12949
|
-
*/
|
|
12950
|
-
const isArrayBuffer = kindOfTest('ArrayBuffer');
|
|
12951
|
-
|
|
12952
|
-
|
|
12953
|
-
/**
|
|
12954
|
-
* Determine if a value is a view on an ArrayBuffer
|
|
12955
|
-
*
|
|
12956
|
-
* @param {*} val The value to test
|
|
12957
|
-
*
|
|
12958
|
-
* @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
|
|
12959
|
-
*/
|
|
12960
|
-
function isArrayBufferView(val) {
|
|
12961
|
-
let result;
|
|
12962
|
-
if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
|
|
12963
|
-
result = ArrayBuffer.isView(val);
|
|
12964
|
-
} else {
|
|
12965
|
-
result = (val) && (val.buffer) && (isArrayBuffer(val.buffer));
|
|
12966
|
-
}
|
|
12967
|
-
return result;
|
|
12968
|
-
}
|
|
12969
|
-
|
|
12970
|
-
/**
|
|
12971
|
-
* Determine if a value is a String
|
|
12972
|
-
*
|
|
12973
|
-
* @param {*} val The value to test
|
|
12974
|
-
*
|
|
12975
|
-
* @returns {boolean} True if value is a String, otherwise false
|
|
12976
|
-
*/
|
|
12977
|
-
const isString = typeOfTest('string');
|
|
12978
|
-
|
|
12979
|
-
/**
|
|
12980
|
-
* Determine if a value is a Function
|
|
12981
|
-
*
|
|
12982
|
-
* @param {*} val The value to test
|
|
12983
|
-
* @returns {boolean} True if value is a Function, otherwise false
|
|
12984
|
-
*/
|
|
12985
|
-
const isFunction$2 = typeOfTest('function');
|
|
12986
|
-
|
|
12987
|
-
/**
|
|
12988
|
-
* Determine if a value is a Number
|
|
12989
|
-
*
|
|
12990
|
-
* @param {*} val The value to test
|
|
12991
|
-
*
|
|
12992
|
-
* @returns {boolean} True if value is a Number, otherwise false
|
|
12993
|
-
*/
|
|
12994
|
-
const isNumber = typeOfTest('number');
|
|
12995
|
-
|
|
12996
|
-
/**
|
|
12997
|
-
* Determine if a value is an Object
|
|
12998
|
-
*
|
|
12999
|
-
* @param {*} thing The value to test
|
|
13000
|
-
*
|
|
13001
|
-
* @returns {boolean} True if value is an Object, otherwise false
|
|
13002
|
-
*/
|
|
13003
|
-
const isObject$1 = (thing) => thing !== null && typeof thing === 'object';
|
|
13004
|
-
|
|
13005
|
-
/**
|
|
13006
|
-
* Determine if a value is a Boolean
|
|
13007
|
-
*
|
|
13008
|
-
* @param {*} thing The value to test
|
|
13009
|
-
* @returns {boolean} True if value is a Boolean, otherwise false
|
|
13010
|
-
*/
|
|
13011
|
-
const isBoolean = thing => thing === true || thing === false;
|
|
13012
|
-
|
|
13013
|
-
/**
|
|
13014
|
-
* Determine if a value is a plain Object
|
|
13015
|
-
*
|
|
13016
|
-
* @param {*} val The value to test
|
|
13017
|
-
*
|
|
13018
|
-
* @returns {boolean} True if value is a plain Object, otherwise false
|
|
13019
|
-
*/
|
|
13020
|
-
const isPlainObject$1 = (val) => {
|
|
13021
|
-
if (kindOf(val) !== 'object') {
|
|
13022
|
-
return false;
|
|
13023
|
-
}
|
|
13024
|
-
|
|
13025
|
-
const prototype = getPrototypeOf(val);
|
|
13026
|
-
return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(toStringTag in val) && !(iterator in val);
|
|
13027
|
-
};
|
|
13028
|
-
|
|
13029
|
-
/**
|
|
13030
|
-
* Determine if a value is an empty object (safely handles Buffers)
|
|
13031
|
-
*
|
|
13032
|
-
* @param {*} val The value to test
|
|
13033
|
-
*
|
|
13034
|
-
* @returns {boolean} True if value is an empty object, otherwise false
|
|
13035
|
-
*/
|
|
13036
|
-
const isEmptyObject = (val) => {
|
|
13037
|
-
// Early return for non-objects or Buffers to prevent RangeError
|
|
13038
|
-
if (!isObject$1(val) || isBuffer(val)) {
|
|
13039
|
-
return false;
|
|
13040
|
-
}
|
|
13041
|
-
|
|
13042
|
-
try {
|
|
13043
|
-
return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
|
|
13044
|
-
} catch (e) {
|
|
13045
|
-
// Fallback for any other objects that might cause RangeError with Object.keys()
|
|
13046
|
-
return false;
|
|
13047
|
-
}
|
|
13048
|
-
};
|
|
13049
|
-
|
|
13050
|
-
/**
|
|
13051
|
-
* Determine if a value is a Date
|
|
13052
|
-
*
|
|
13053
|
-
* @param {*} val The value to test
|
|
13054
|
-
*
|
|
13055
|
-
* @returns {boolean} True if value is a Date, otherwise false
|
|
13056
|
-
*/
|
|
13057
|
-
const isDate$1 = kindOfTest('Date');
|
|
13058
|
-
|
|
13059
|
-
/**
|
|
13060
|
-
* Determine if a value is a File
|
|
13061
|
-
*
|
|
13062
|
-
* @param {*} val The value to test
|
|
13063
|
-
*
|
|
13064
|
-
* @returns {boolean} True if value is a File, otherwise false
|
|
13065
|
-
*/
|
|
13066
|
-
const isFile = kindOfTest('File');
|
|
13067
|
-
|
|
13068
|
-
/**
|
|
13069
|
-
* Determine if a value is a Blob
|
|
13070
|
-
*
|
|
13071
|
-
* @param {*} val The value to test
|
|
13072
|
-
*
|
|
13073
|
-
* @returns {boolean} True if value is a Blob, otherwise false
|
|
13074
|
-
*/
|
|
13075
|
-
const isBlob = kindOfTest('Blob');
|
|
13076
|
-
|
|
13077
|
-
/**
|
|
13078
|
-
* Determine if a value is a FileList
|
|
13079
|
-
*
|
|
13080
|
-
* @param {*} val The value to test
|
|
13081
|
-
*
|
|
13082
|
-
* @returns {boolean} True if value is a File, otherwise false
|
|
13083
|
-
*/
|
|
13084
|
-
const isFileList = kindOfTest('FileList');
|
|
13085
|
-
|
|
13086
|
-
/**
|
|
13087
|
-
* Determine if a value is a Stream
|
|
13088
|
-
*
|
|
13089
|
-
* @param {*} val The value to test
|
|
13090
|
-
*
|
|
13091
|
-
* @returns {boolean} True if value is a Stream, otherwise false
|
|
13092
|
-
*/
|
|
13093
|
-
const isStream = (val) => isObject$1(val) && isFunction$2(val.pipe);
|
|
13094
|
-
|
|
13095
|
-
/**
|
|
13096
|
-
* Determine if a value is a FormData
|
|
13097
|
-
*
|
|
13098
|
-
* @param {*} thing The value to test
|
|
13099
|
-
*
|
|
13100
|
-
* @returns {boolean} True if value is an FormData, otherwise false
|
|
13101
|
-
*/
|
|
13102
|
-
const isFormData = (thing) => {
|
|
13103
|
-
let kind;
|
|
13104
|
-
return thing && (
|
|
13105
|
-
(typeof FormData === 'function' && thing instanceof FormData) || (
|
|
13106
|
-
isFunction$2(thing.append) && (
|
|
13107
|
-
(kind = kindOf(thing)) === 'formdata' ||
|
|
13108
|
-
// detect form-data instance
|
|
13109
|
-
(kind === 'object' && isFunction$2(thing.toString) && thing.toString() === '[object FormData]')
|
|
13110
|
-
)
|
|
13111
|
-
)
|
|
13112
|
-
)
|
|
13113
|
-
};
|
|
13114
|
-
|
|
13115
|
-
/**
|
|
13116
|
-
* Determine if a value is a URLSearchParams object
|
|
13117
|
-
*
|
|
13118
|
-
* @param {*} val The value to test
|
|
13119
|
-
*
|
|
13120
|
-
* @returns {boolean} True if value is a URLSearchParams object, otherwise false
|
|
13121
|
-
*/
|
|
13122
|
-
const isURLSearchParams = kindOfTest('URLSearchParams');
|
|
13123
|
-
|
|
13124
|
-
const [isReadableStream, isRequest, isResponse, isHeaders] = ['ReadableStream', 'Request', 'Response', 'Headers'].map(kindOfTest);
|
|
13125
|
-
|
|
13126
|
-
/**
|
|
13127
|
-
* Trim excess whitespace off the beginning and end of a string
|
|
13128
|
-
*
|
|
13129
|
-
* @param {String} str The String to trim
|
|
13130
|
-
*
|
|
13131
|
-
* @returns {String} The String freed of excess whitespace
|
|
13132
|
-
*/
|
|
13133
|
-
const trim = (str) => str.trim ?
|
|
13134
|
-
str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
|
|
13135
|
-
|
|
13136
|
-
/**
|
|
13137
|
-
* Iterate over an Array or an Object invoking a function for each item.
|
|
13138
|
-
*
|
|
13139
|
-
* If `obj` is an Array callback will be called passing
|
|
13140
|
-
* the value, index, and complete array for each item.
|
|
13141
|
-
*
|
|
13142
|
-
* If 'obj' is an Object callback will be called passing
|
|
13143
|
-
* the value, key, and complete object for each property.
|
|
13144
|
-
*
|
|
13145
|
-
* @param {Object|Array} obj The object to iterate
|
|
13146
|
-
* @param {Function} fn The callback to invoke for each item
|
|
13147
|
-
*
|
|
13148
|
-
* @param {Boolean} [allOwnKeys = false]
|
|
13149
|
-
* @returns {any}
|
|
13150
|
-
*/
|
|
13151
|
-
function forEach$1(obj, fn, {allOwnKeys = false} = {}) {
|
|
13152
|
-
// Don't bother if no value provided
|
|
13153
|
-
if (obj === null || typeof obj === 'undefined') {
|
|
13154
|
-
return;
|
|
13155
|
-
}
|
|
13156
|
-
|
|
13157
|
-
let i;
|
|
13158
|
-
let l;
|
|
13159
|
-
|
|
13160
|
-
// Force an array if not already something iterable
|
|
13161
|
-
if (typeof obj !== 'object') {
|
|
13162
|
-
/*eslint no-param-reassign:0*/
|
|
13163
|
-
obj = [obj];
|
|
13164
|
-
}
|
|
13165
|
-
|
|
13166
|
-
if (isArray(obj)) {
|
|
13167
|
-
// Iterate over array values
|
|
13168
|
-
for (i = 0, l = obj.length; i < l; i++) {
|
|
13169
|
-
fn.call(null, obj[i], i, obj);
|
|
13170
|
-
}
|
|
13171
|
-
} else {
|
|
13172
|
-
// Buffer check
|
|
13173
|
-
if (isBuffer(obj)) {
|
|
13174
|
-
return;
|
|
13175
|
-
}
|
|
13176
|
-
|
|
13177
|
-
// Iterate over object keys
|
|
13178
|
-
const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
|
|
13179
|
-
const len = keys.length;
|
|
13180
|
-
let key;
|
|
13181
|
-
|
|
13182
|
-
for (i = 0; i < len; i++) {
|
|
13183
|
-
key = keys[i];
|
|
13184
|
-
fn.call(null, obj[key], key, obj);
|
|
13185
|
-
}
|
|
13186
|
-
}
|
|
13187
|
-
}
|
|
13188
|
-
|
|
13189
|
-
function findKey$1(obj, key) {
|
|
13190
|
-
if (isBuffer(obj)){
|
|
13191
|
-
return null;
|
|
13192
|
-
}
|
|
13193
|
-
|
|
13194
|
-
key = key.toLowerCase();
|
|
13195
|
-
const keys = Object.keys(obj);
|
|
13196
|
-
let i = keys.length;
|
|
13197
|
-
let _key;
|
|
13198
|
-
while (i-- > 0) {
|
|
13199
|
-
_key = keys[i];
|
|
13200
|
-
if (key === _key.toLowerCase()) {
|
|
13201
|
-
return _key;
|
|
13202
|
-
}
|
|
13203
|
-
}
|
|
13204
|
-
return null;
|
|
13205
|
-
}
|
|
13206
|
-
|
|
13207
|
-
const _global = (() => {
|
|
13208
|
-
/*eslint no-undef:0*/
|
|
13209
|
-
if (typeof globalThis !== "undefined") return globalThis;
|
|
13210
|
-
return typeof self !== "undefined" ? self : (typeof window !== 'undefined' ? window : global)
|
|
13211
|
-
})();
|
|
13212
|
-
|
|
13213
|
-
const isContextDefined = (context) => !isUndefined(context) && context !== _global;
|
|
13214
|
-
|
|
13215
|
-
/**
|
|
13216
|
-
* Accepts varargs expecting each argument to be an object, then
|
|
13217
|
-
* immutably merges the properties of each object and returns result.
|
|
13218
|
-
*
|
|
13219
|
-
* When multiple objects contain the same key the later object in
|
|
13220
|
-
* the arguments list will take precedence.
|
|
13221
|
-
*
|
|
13222
|
-
* Example:
|
|
13223
|
-
*
|
|
13224
|
-
* ```js
|
|
13225
|
-
* var result = merge({foo: 123}, {foo: 456});
|
|
13226
|
-
* console.log(result.foo); // outputs 456
|
|
13227
|
-
* ```
|
|
13228
|
-
*
|
|
13229
|
-
* @param {Object} obj1 Object to merge
|
|
13230
|
-
*
|
|
13231
|
-
* @returns {Object} Result of all merge properties
|
|
13232
|
-
*/
|
|
13233
|
-
function merge$1(/* obj1, obj2, obj3, ... */) {
|
|
13234
|
-
const {caseless, skipUndefined} = isContextDefined(this) && this || {};
|
|
13235
|
-
const result = {};
|
|
13236
|
-
const assignValue = (val, key) => {
|
|
13237
|
-
const targetKey = caseless && findKey$1(result, key) || key;
|
|
13238
|
-
if (isPlainObject$1(result[targetKey]) && isPlainObject$1(val)) {
|
|
13239
|
-
result[targetKey] = merge$1(result[targetKey], val);
|
|
13240
|
-
} else if (isPlainObject$1(val)) {
|
|
13241
|
-
result[targetKey] = merge$1({}, val);
|
|
13242
|
-
} else if (isArray(val)) {
|
|
13243
|
-
result[targetKey] = val.slice();
|
|
13244
|
-
} else if (!skipUndefined || !isUndefined(val)) {
|
|
13245
|
-
result[targetKey] = val;
|
|
13246
|
-
}
|
|
13247
|
-
};
|
|
13248
|
-
|
|
13249
|
-
for (let i = 0, l = arguments.length; i < l; i++) {
|
|
13250
|
-
arguments[i] && forEach$1(arguments[i], assignValue);
|
|
13251
|
-
}
|
|
13252
|
-
return result;
|
|
13253
|
-
}
|
|
13254
|
-
|
|
13255
|
-
/**
|
|
13256
|
-
* Extends object a by mutably adding to it the properties of object b.
|
|
13257
|
-
*
|
|
13258
|
-
* @param {Object} a The object to be extended
|
|
13259
|
-
* @param {Object} b The object to copy properties from
|
|
13260
|
-
* @param {Object} thisArg The object to bind function to
|
|
13261
|
-
*
|
|
13262
|
-
* @param {Boolean} [allOwnKeys]
|
|
13263
|
-
* @returns {Object} The resulting value of object a
|
|
13264
|
-
*/
|
|
13265
|
-
const extend = (a, b, thisArg, {allOwnKeys}= {}) => {
|
|
13266
|
-
forEach$1(b, (val, key) => {
|
|
13267
|
-
if (thisArg && isFunction$2(val)) {
|
|
13268
|
-
a[key] = bind(val, thisArg);
|
|
13269
|
-
} else {
|
|
13270
|
-
a[key] = val;
|
|
13271
|
-
}
|
|
13272
|
-
}, {allOwnKeys});
|
|
13273
|
-
return a;
|
|
13274
|
-
};
|
|
13275
|
-
|
|
13276
|
-
/**
|
|
13277
|
-
* Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
|
|
13278
|
-
*
|
|
13279
|
-
* @param {string} content with BOM
|
|
13280
|
-
*
|
|
13281
|
-
* @returns {string} content value without BOM
|
|
13282
|
-
*/
|
|
13283
|
-
const stripBOM = (content) => {
|
|
13284
|
-
if (content.charCodeAt(0) === 0xFEFF) {
|
|
13285
|
-
content = content.slice(1);
|
|
13286
|
-
}
|
|
13287
|
-
return content;
|
|
13288
|
-
};
|
|
13289
|
-
|
|
13290
|
-
/**
|
|
13291
|
-
* Inherit the prototype methods from one constructor into another
|
|
13292
|
-
* @param {function} constructor
|
|
13293
|
-
* @param {function} superConstructor
|
|
13294
|
-
* @param {object} [props]
|
|
13295
|
-
* @param {object} [descriptors]
|
|
13296
|
-
*
|
|
13297
|
-
* @returns {void}
|
|
13298
|
-
*/
|
|
13299
|
-
const inherits = (constructor, superConstructor, props, descriptors) => {
|
|
13300
|
-
constructor.prototype = Object.create(superConstructor.prototype, descriptors);
|
|
13301
|
-
constructor.prototype.constructor = constructor;
|
|
13302
|
-
Object.defineProperty(constructor, 'super', {
|
|
13303
|
-
value: superConstructor.prototype
|
|
13304
|
-
});
|
|
13305
|
-
props && Object.assign(constructor.prototype, props);
|
|
13306
|
-
};
|
|
13307
|
-
|
|
13308
|
-
/**
|
|
13309
|
-
* Resolve object with deep prototype chain to a flat object
|
|
13310
|
-
* @param {Object} sourceObj source object
|
|
13311
|
-
* @param {Object} [destObj]
|
|
13312
|
-
* @param {Function|Boolean} [filter]
|
|
13313
|
-
* @param {Function} [propFilter]
|
|
13314
|
-
*
|
|
13315
|
-
* @returns {Object}
|
|
13316
|
-
*/
|
|
13317
|
-
const toFlatObject = (sourceObj, destObj, filter, propFilter) => {
|
|
13318
|
-
let props;
|
|
13319
|
-
let i;
|
|
13320
|
-
let prop;
|
|
13321
|
-
const merged = {};
|
|
13322
|
-
|
|
13323
|
-
destObj = destObj || {};
|
|
13324
|
-
// eslint-disable-next-line no-eq-null,eqeqeq
|
|
13325
|
-
if (sourceObj == null) return destObj;
|
|
13326
|
-
|
|
13327
|
-
do {
|
|
13328
|
-
props = Object.getOwnPropertyNames(sourceObj);
|
|
13329
|
-
i = props.length;
|
|
13330
|
-
while (i-- > 0) {
|
|
13331
|
-
prop = props[i];
|
|
13332
|
-
if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
|
|
13333
|
-
destObj[prop] = sourceObj[prop];
|
|
13334
|
-
merged[prop] = true;
|
|
13335
|
-
}
|
|
13336
|
-
}
|
|
13337
|
-
sourceObj = filter !== false && getPrototypeOf(sourceObj);
|
|
13338
|
-
} while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);
|
|
13339
|
-
|
|
13340
|
-
return destObj;
|
|
13341
|
-
};
|
|
13342
|
-
|
|
13343
|
-
/**
|
|
13344
|
-
* Determines whether a string ends with the characters of a specified string
|
|
13345
|
-
*
|
|
13346
|
-
* @param {String} str
|
|
13347
|
-
* @param {String} searchString
|
|
13348
|
-
* @param {Number} [position= 0]
|
|
13349
|
-
*
|
|
13350
|
-
* @returns {boolean}
|
|
13351
|
-
*/
|
|
13352
|
-
const endsWith = (str, searchString, position) => {
|
|
13353
|
-
str = String(str);
|
|
13354
|
-
if (position === undefined || position > str.length) {
|
|
13355
|
-
position = str.length;
|
|
13356
|
-
}
|
|
13357
|
-
position -= searchString.length;
|
|
13358
|
-
const lastIndex = str.indexOf(searchString, position);
|
|
13359
|
-
return lastIndex !== -1 && lastIndex === position;
|
|
13360
|
-
};
|
|
13361
|
-
|
|
13362
|
-
|
|
13363
|
-
/**
|
|
13364
|
-
* Returns new array from array like object or null if failed
|
|
13365
|
-
*
|
|
13366
|
-
* @param {*} [thing]
|
|
13367
|
-
*
|
|
13368
|
-
* @returns {?Array}
|
|
13369
|
-
*/
|
|
13370
|
-
const toArray$1 = (thing) => {
|
|
13371
|
-
if (!thing) return null;
|
|
13372
|
-
if (isArray(thing)) return thing;
|
|
13373
|
-
let i = thing.length;
|
|
13374
|
-
if (!isNumber(i)) return null;
|
|
13375
|
-
const arr = new Array(i);
|
|
13376
|
-
while (i-- > 0) {
|
|
13377
|
-
arr[i] = thing[i];
|
|
13378
|
-
}
|
|
13379
|
-
return arr;
|
|
13380
|
-
};
|
|
13381
|
-
|
|
13382
|
-
/**
|
|
13383
|
-
* Checking if the Uint8Array exists and if it does, it returns a function that checks if the
|
|
13384
|
-
* thing passed in is an instance of Uint8Array
|
|
13385
|
-
*
|
|
13386
|
-
* @param {TypedArray}
|
|
13387
|
-
*
|
|
13388
|
-
* @returns {Array}
|
|
13389
|
-
*/
|
|
13390
|
-
// eslint-disable-next-line func-names
|
|
13391
|
-
const isTypedArray = (TypedArray => {
|
|
13392
|
-
// eslint-disable-next-line func-names
|
|
13393
|
-
return thing => {
|
|
13394
|
-
return TypedArray && thing instanceof TypedArray;
|
|
13395
|
-
};
|
|
13396
|
-
})(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array));
|
|
13397
|
-
|
|
13398
|
-
/**
|
|
13399
|
-
* For each entry in the object, call the function with the key and value.
|
|
13400
|
-
*
|
|
13401
|
-
* @param {Object<any, any>} obj - The object to iterate over.
|
|
13402
|
-
* @param {Function} fn - The function to call for each entry.
|
|
13403
|
-
*
|
|
13404
|
-
* @returns {void}
|
|
13405
|
-
*/
|
|
13406
|
-
const forEachEntry = (obj, fn) => {
|
|
13407
|
-
const generator = obj && obj[iterator];
|
|
13408
|
-
|
|
13409
|
-
const _iterator = generator.call(obj);
|
|
13410
|
-
|
|
13411
|
-
let result;
|
|
13412
|
-
|
|
13413
|
-
while ((result = _iterator.next()) && !result.done) {
|
|
13414
|
-
const pair = result.value;
|
|
13415
|
-
fn.call(obj, pair[0], pair[1]);
|
|
13416
|
-
}
|
|
13417
|
-
};
|
|
13418
|
-
|
|
13419
|
-
/**
|
|
13420
|
-
* It takes a regular expression and a string, and returns an array of all the matches
|
|
13421
|
-
*
|
|
13422
|
-
* @param {string} regExp - The regular expression to match against.
|
|
13423
|
-
* @param {string} str - The string to search.
|
|
13424
|
-
*
|
|
13425
|
-
* @returns {Array<boolean>}
|
|
13426
|
-
*/
|
|
13427
|
-
const matchAll = (regExp, str) => {
|
|
13428
|
-
let matches;
|
|
13429
|
-
const arr = [];
|
|
13430
|
-
|
|
13431
|
-
while ((matches = regExp.exec(str)) !== null) {
|
|
13432
|
-
arr.push(matches);
|
|
13433
|
-
}
|
|
13434
|
-
|
|
13435
|
-
return arr;
|
|
13436
|
-
};
|
|
13437
|
-
|
|
13438
|
-
/* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */
|
|
13439
|
-
const isHTMLForm = kindOfTest('HTMLFormElement');
|
|
13440
|
-
|
|
13441
|
-
const toCamelCase = str => {
|
|
13442
|
-
return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,
|
|
13443
|
-
function replacer(m, p1, p2) {
|
|
13444
|
-
return p1.toUpperCase() + p2;
|
|
13445
|
-
}
|
|
13446
|
-
);
|
|
13447
|
-
};
|
|
13448
|
-
|
|
13449
|
-
/* Creating a function that will check if an object has a property. */
|
|
13450
|
-
const hasOwnProperty = (({hasOwnProperty}) => (obj, prop) => hasOwnProperty.call(obj, prop))(Object.prototype);
|
|
13451
|
-
|
|
13452
|
-
/**
|
|
13453
|
-
* Determine if a value is a RegExp object
|
|
13454
|
-
*
|
|
13455
|
-
* @param {*} val The value to test
|
|
13456
|
-
*
|
|
13457
|
-
* @returns {boolean} True if value is a RegExp object, otherwise false
|
|
13458
|
-
*/
|
|
13459
|
-
const isRegExp = kindOfTest('RegExp');
|
|
13460
|
-
|
|
13461
|
-
const reduceDescriptors = (obj, reducer) => {
|
|
13462
|
-
const descriptors = Object.getOwnPropertyDescriptors(obj);
|
|
13463
|
-
const reducedDescriptors = {};
|
|
13464
|
-
|
|
13465
|
-
forEach$1(descriptors, (descriptor, name) => {
|
|
13466
|
-
let ret;
|
|
13467
|
-
if ((ret = reducer(descriptor, name, obj)) !== false) {
|
|
13468
|
-
reducedDescriptors[name] = ret || descriptor;
|
|
13469
|
-
}
|
|
13470
|
-
});
|
|
13471
|
-
|
|
13472
|
-
Object.defineProperties(obj, reducedDescriptors);
|
|
13473
|
-
};
|
|
13474
|
-
|
|
13475
|
-
/**
|
|
13476
|
-
* Makes all methods read-only
|
|
13477
|
-
* @param {Object} obj
|
|
13478
|
-
*/
|
|
13479
|
-
|
|
13480
|
-
const freezeMethods = (obj) => {
|
|
13481
|
-
reduceDescriptors(obj, (descriptor, name) => {
|
|
13482
|
-
// skip restricted props in strict mode
|
|
13483
|
-
if (isFunction$2(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
|
|
13484
|
-
return false;
|
|
13485
|
-
}
|
|
13486
|
-
|
|
13487
|
-
const value = obj[name];
|
|
13488
|
-
|
|
13489
|
-
if (!isFunction$2(value)) return;
|
|
13490
|
-
|
|
13491
|
-
descriptor.enumerable = false;
|
|
13492
|
-
|
|
13493
|
-
if ('writable' in descriptor) {
|
|
13494
|
-
descriptor.writable = false;
|
|
13495
|
-
return;
|
|
13496
|
-
}
|
|
13497
|
-
|
|
13498
|
-
if (!descriptor.set) {
|
|
13499
|
-
descriptor.set = () => {
|
|
13500
|
-
throw Error('Can not rewrite read-only method \'' + name + '\'');
|
|
13501
|
-
};
|
|
13502
|
-
}
|
|
13503
|
-
});
|
|
13504
|
-
};
|
|
13505
|
-
|
|
13506
|
-
const toObjectSet = (arrayOrString, delimiter) => {
|
|
13507
|
-
const obj = {};
|
|
13508
|
-
|
|
13509
|
-
const define = (arr) => {
|
|
13510
|
-
arr.forEach(value => {
|
|
13511
|
-
obj[value] = true;
|
|
13512
|
-
});
|
|
13513
|
-
};
|
|
13514
|
-
|
|
13515
|
-
isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));
|
|
13516
|
-
|
|
13517
|
-
return obj;
|
|
13518
|
-
};
|
|
13519
|
-
|
|
13520
|
-
const noop$2 = () => {};
|
|
13521
|
-
|
|
13522
|
-
const toFiniteNumber = (value, defaultValue) => {
|
|
13523
|
-
return value != null && Number.isFinite(value = +value) ? value : defaultValue;
|
|
13524
|
-
};
|
|
13525
|
-
|
|
13526
|
-
|
|
13527
|
-
|
|
13528
|
-
/**
|
|
13529
|
-
* If the thing is a FormData object, return true, otherwise return false.
|
|
13530
|
-
*
|
|
13531
|
-
* @param {unknown} thing - The thing to check.
|
|
13532
|
-
*
|
|
13533
|
-
* @returns {boolean}
|
|
13534
|
-
*/
|
|
13535
|
-
function isSpecCompliantForm(thing) {
|
|
13536
|
-
return !!(thing && isFunction$2(thing.append) && thing[toStringTag] === 'FormData' && thing[iterator]);
|
|
13537
|
-
}
|
|
13538
|
-
|
|
13539
|
-
const toJSONObject = (obj) => {
|
|
13540
|
-
const stack = new Array(10);
|
|
13541
|
-
|
|
13542
|
-
const visit = (source, i) => {
|
|
13543
|
-
|
|
13544
|
-
if (isObject$1(source)) {
|
|
13545
|
-
if (stack.indexOf(source) >= 0) {
|
|
13546
|
-
return;
|
|
13547
|
-
}
|
|
13548
|
-
|
|
13549
|
-
//Buffer check
|
|
13550
|
-
if (isBuffer(source)) {
|
|
13551
|
-
return source;
|
|
13552
|
-
}
|
|
13553
|
-
|
|
13554
|
-
if(!('toJSON' in source)) {
|
|
13555
|
-
stack[i] = source;
|
|
13556
|
-
const target = isArray(source) ? [] : {};
|
|
13557
|
-
|
|
13558
|
-
forEach$1(source, (value, key) => {
|
|
13559
|
-
const reducedValue = visit(value, i + 1);
|
|
13560
|
-
!isUndefined(reducedValue) && (target[key] = reducedValue);
|
|
13561
|
-
});
|
|
13562
|
-
|
|
13563
|
-
stack[i] = undefined;
|
|
13564
|
-
|
|
13565
|
-
return target;
|
|
13566
|
-
}
|
|
13567
|
-
}
|
|
13568
|
-
|
|
13569
|
-
return source;
|
|
13570
|
-
};
|
|
13571
|
-
|
|
13572
|
-
return visit(obj, 0);
|
|
13573
|
-
};
|
|
13574
|
-
|
|
13575
|
-
const isAsyncFn = kindOfTest('AsyncFunction');
|
|
13576
|
-
|
|
13577
|
-
const isThenable = (thing) =>
|
|
13578
|
-
thing && (isObject$1(thing) || isFunction$2(thing)) && isFunction$2(thing.then) && isFunction$2(thing.catch);
|
|
13579
|
-
|
|
13580
|
-
// original code
|
|
13581
|
-
// https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34
|
|
13582
|
-
|
|
13583
|
-
const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
|
|
13584
|
-
if (setImmediateSupported) {
|
|
13585
|
-
return setImmediate;
|
|
13586
|
-
}
|
|
13587
|
-
|
|
13588
|
-
return postMessageSupported ? ((token, callbacks) => {
|
|
13589
|
-
_global.addEventListener("message", ({source, data}) => {
|
|
13590
|
-
if (source === _global && data === token) {
|
|
13591
|
-
callbacks.length && callbacks.shift()();
|
|
13592
|
-
}
|
|
13593
|
-
}, false);
|
|
13594
|
-
|
|
13595
|
-
return (cb) => {
|
|
13596
|
-
callbacks.push(cb);
|
|
13597
|
-
_global.postMessage(token, "*");
|
|
13598
|
-
}
|
|
13599
|
-
})(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb);
|
|
13600
|
-
})(
|
|
13601
|
-
typeof setImmediate === 'function',
|
|
13602
|
-
isFunction$2(_global.postMessage)
|
|
13603
|
-
);
|
|
13604
|
-
|
|
13605
|
-
const asap = typeof queueMicrotask !== 'undefined' ?
|
|
13606
|
-
queueMicrotask.bind(_global) : ( typeof process !== 'undefined' && process.nextTick || _setImmediate);
|
|
13607
|
-
|
|
13608
|
-
// *********************
|
|
13609
|
-
|
|
13610
|
-
|
|
13611
|
-
const isIterable = (thing) => thing != null && isFunction$2(thing[iterator]);
|
|
13612
|
-
|
|
13613
|
-
|
|
13614
|
-
var utils$1 = {
|
|
13615
|
-
isArray,
|
|
13616
|
-
isArrayBuffer,
|
|
13617
|
-
isBuffer,
|
|
13618
|
-
isFormData,
|
|
13619
|
-
isArrayBufferView,
|
|
13620
|
-
isString,
|
|
13621
|
-
isNumber,
|
|
13622
|
-
isBoolean,
|
|
13623
|
-
isObject: isObject$1,
|
|
13624
|
-
isPlainObject: isPlainObject$1,
|
|
13625
|
-
isEmptyObject,
|
|
13626
|
-
isReadableStream,
|
|
13627
|
-
isRequest,
|
|
13628
|
-
isResponse,
|
|
13629
|
-
isHeaders,
|
|
13630
|
-
isUndefined,
|
|
13631
|
-
isDate: isDate$1,
|
|
13632
|
-
isFile,
|
|
13633
|
-
isBlob,
|
|
13634
|
-
isRegExp,
|
|
13635
|
-
isFunction: isFunction$2,
|
|
13636
|
-
isStream,
|
|
13637
|
-
isURLSearchParams,
|
|
13638
|
-
isTypedArray,
|
|
13639
|
-
isFileList,
|
|
13640
|
-
forEach: forEach$1,
|
|
13641
|
-
merge: merge$1,
|
|
13642
|
-
extend,
|
|
13643
|
-
trim,
|
|
13644
|
-
stripBOM,
|
|
13645
|
-
inherits,
|
|
13646
|
-
toFlatObject,
|
|
13647
|
-
kindOf,
|
|
13648
|
-
kindOfTest,
|
|
13649
|
-
endsWith,
|
|
13650
|
-
toArray: toArray$1,
|
|
13651
|
-
forEachEntry,
|
|
13652
|
-
matchAll,
|
|
13653
|
-
isHTMLForm,
|
|
13654
|
-
hasOwnProperty,
|
|
13655
|
-
hasOwnProp: hasOwnProperty, // an alias to avoid ESLint no-prototype-builtins detection
|
|
13656
|
-
reduceDescriptors,
|
|
13657
|
-
freezeMethods,
|
|
13658
|
-
toObjectSet,
|
|
13659
|
-
toCamelCase,
|
|
13660
|
-
noop: noop$2,
|
|
13661
|
-
toFiniteNumber,
|
|
13662
|
-
findKey: findKey$1,
|
|
13663
|
-
global: _global,
|
|
13664
|
-
isContextDefined,
|
|
13665
|
-
isSpecCompliantForm,
|
|
13666
|
-
toJSONObject,
|
|
13667
|
-
isAsyncFn,
|
|
13668
|
-
isThenable,
|
|
13669
|
-
setImmediate: _setImmediate,
|
|
13670
|
-
asap,
|
|
13671
|
-
isIterable
|
|
13672
|
-
};
|
|
13673
|
-
|
|
13674
|
-
/**
|
|
13675
|
-
* Create an Error with the specified message, config, error code, request and response.
|
|
13676
|
-
*
|
|
13677
|
-
* @param {string} message The error message.
|
|
13678
|
-
* @param {string} [code] The error code (for example, 'ECONNABORTED').
|
|
13679
|
-
* @param {Object} [config] The config.
|
|
13680
|
-
* @param {Object} [request] The request.
|
|
13681
|
-
* @param {Object} [response] The response.
|
|
13682
|
-
*
|
|
13683
|
-
* @returns {Error} The created error.
|
|
13684
|
-
*/
|
|
13685
|
-
function AxiosError$1(message, code, config, request, response) {
|
|
13686
|
-
Error.call(this);
|
|
13687
|
-
|
|
13688
|
-
if (Error.captureStackTrace) {
|
|
13689
|
-
Error.captureStackTrace(this, this.constructor);
|
|
13690
|
-
} else {
|
|
13691
|
-
this.stack = (new Error()).stack;
|
|
13692
|
-
}
|
|
13693
|
-
|
|
13694
|
-
this.message = message;
|
|
13695
|
-
this.name = 'AxiosError';
|
|
13696
|
-
code && (this.code = code);
|
|
13697
|
-
config && (this.config = config);
|
|
13698
|
-
request && (this.request = request);
|
|
13699
|
-
if (response) {
|
|
13700
|
-
this.response = response;
|
|
13701
|
-
this.status = response.status ? response.status : null;
|
|
13702
|
-
}
|
|
13703
|
-
}
|
|
13704
|
-
|
|
13705
|
-
utils$1.inherits(AxiosError$1, Error, {
|
|
13706
|
-
toJSON: function toJSON() {
|
|
13707
|
-
return {
|
|
13708
|
-
// Standard
|
|
13709
|
-
message: this.message,
|
|
13710
|
-
name: this.name,
|
|
13711
|
-
// Microsoft
|
|
13712
|
-
description: this.description,
|
|
13713
|
-
number: this.number,
|
|
13714
|
-
// Mozilla
|
|
13715
|
-
fileName: this.fileName,
|
|
13716
|
-
lineNumber: this.lineNumber,
|
|
13717
|
-
columnNumber: this.columnNumber,
|
|
13718
|
-
stack: this.stack,
|
|
13719
|
-
// Axios
|
|
13720
|
-
config: utils$1.toJSONObject(this.config),
|
|
13721
|
-
code: this.code,
|
|
13722
|
-
status: this.status
|
|
13723
|
-
};
|
|
13724
|
-
}
|
|
13725
|
-
});
|
|
13726
|
-
|
|
13727
|
-
const prototype$1 = AxiosError$1.prototype;
|
|
13728
|
-
const descriptors = {};
|
|
13729
|
-
|
|
13730
|
-
[
|
|
13731
|
-
'ERR_BAD_OPTION_VALUE',
|
|
13732
|
-
'ERR_BAD_OPTION',
|
|
13733
|
-
'ECONNABORTED',
|
|
13734
|
-
'ETIMEDOUT',
|
|
13735
|
-
'ERR_NETWORK',
|
|
13736
|
-
'ERR_FR_TOO_MANY_REDIRECTS',
|
|
13737
|
-
'ERR_DEPRECATED',
|
|
13738
|
-
'ERR_BAD_RESPONSE',
|
|
13739
|
-
'ERR_BAD_REQUEST',
|
|
13740
|
-
'ERR_CANCELED',
|
|
13741
|
-
'ERR_NOT_SUPPORT',
|
|
13742
|
-
'ERR_INVALID_URL'
|
|
13743
|
-
// eslint-disable-next-line func-names
|
|
13744
|
-
].forEach(code => {
|
|
13745
|
-
descriptors[code] = {value: code};
|
|
13746
|
-
});
|
|
13747
|
-
|
|
13748
|
-
Object.defineProperties(AxiosError$1, descriptors);
|
|
13749
|
-
Object.defineProperty(prototype$1, 'isAxiosError', {value: true});
|
|
13750
|
-
|
|
13751
|
-
// eslint-disable-next-line func-names
|
|
13752
|
-
AxiosError$1.from = (error, code, config, request, response, customProps) => {
|
|
13753
|
-
const axiosError = Object.create(prototype$1);
|
|
13754
|
-
|
|
13755
|
-
utils$1.toFlatObject(error, axiosError, function filter(obj) {
|
|
13756
|
-
return obj !== Error.prototype;
|
|
13757
|
-
}, prop => {
|
|
13758
|
-
return prop !== 'isAxiosError';
|
|
13759
|
-
});
|
|
13760
|
-
|
|
13761
|
-
const msg = error && error.message ? error.message : 'Error';
|
|
13762
|
-
|
|
13763
|
-
// Prefer explicit code; otherwise copy the low-level error's code (e.g. ECONNREFUSED)
|
|
13764
|
-
const errCode = code == null && error ? error.code : code;
|
|
13765
|
-
AxiosError$1.call(axiosError, msg, errCode, config, request, response);
|
|
13766
|
-
|
|
13767
|
-
// Chain the original error on the standard field; non-enumerable to avoid JSON noise
|
|
13768
|
-
if (error && axiosError.cause == null) {
|
|
13769
|
-
Object.defineProperty(axiosError, 'cause', { value: error, configurable: true });
|
|
13770
|
-
}
|
|
13771
|
-
|
|
13772
|
-
axiosError.name = (error && error.name) || 'Error';
|
|
13773
|
-
|
|
13774
|
-
customProps && Object.assign(axiosError, customProps);
|
|
13775
|
-
|
|
13776
|
-
return axiosError;
|
|
13777
|
-
};
|
|
13778
|
-
|
|
13779
|
-
// eslint-disable-next-line strict
|
|
13780
|
-
var httpAdapter = null;
|
|
13781
|
-
|
|
13782
|
-
/**
|
|
13783
|
-
* Determines if the given thing is a array or js object.
|
|
13784
|
-
*
|
|
13785
|
-
* @param {string} thing - The object or array to be visited.
|
|
13786
|
-
*
|
|
13787
|
-
* @returns {boolean}
|
|
13788
|
-
*/
|
|
13789
|
-
function isVisitable(thing) {
|
|
13790
|
-
return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
|
|
13791
|
-
}
|
|
13792
|
-
|
|
13793
|
-
/**
|
|
13794
|
-
* It removes the brackets from the end of a string
|
|
13795
|
-
*
|
|
13796
|
-
* @param {string} key - The key of the parameter.
|
|
13797
|
-
*
|
|
13798
|
-
* @returns {string} the key without the brackets.
|
|
13799
|
-
*/
|
|
13800
|
-
function removeBrackets(key) {
|
|
13801
|
-
return utils$1.endsWith(key, '[]') ? key.slice(0, -2) : key;
|
|
13802
|
-
}
|
|
13803
|
-
|
|
13804
|
-
/**
|
|
13805
|
-
* It takes a path, a key, and a boolean, and returns a string
|
|
13806
|
-
*
|
|
13807
|
-
* @param {string} path - The path to the current key.
|
|
13808
|
-
* @param {string} key - The key of the current object being iterated over.
|
|
13809
|
-
* @param {string} dots - If true, the key will be rendered with dots instead of brackets.
|
|
13810
|
-
*
|
|
13811
|
-
* @returns {string} The path to the current key.
|
|
13812
|
-
*/
|
|
13813
|
-
function renderKey(path, key, dots) {
|
|
13814
|
-
if (!path) return key;
|
|
13815
|
-
return path.concat(key).map(function each(token, i) {
|
|
13816
|
-
// eslint-disable-next-line no-param-reassign
|
|
13817
|
-
token = removeBrackets(token);
|
|
13818
|
-
return !dots && i ? '[' + token + ']' : token;
|
|
13819
|
-
}).join(dots ? '.' : '');
|
|
13820
|
-
}
|
|
13821
|
-
|
|
13822
|
-
/**
|
|
13823
|
-
* If the array is an array and none of its elements are visitable, then it's a flat array.
|
|
13824
|
-
*
|
|
13825
|
-
* @param {Array<any>} arr - The array to check
|
|
13826
|
-
*
|
|
13827
|
-
* @returns {boolean}
|
|
13828
|
-
*/
|
|
13829
|
-
function isFlatArray(arr) {
|
|
13830
|
-
return utils$1.isArray(arr) && !arr.some(isVisitable);
|
|
13831
|
-
}
|
|
13832
|
-
|
|
13833
|
-
const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) {
|
|
13834
|
-
return /^is[A-Z]/.test(prop);
|
|
13835
|
-
});
|
|
13836
|
-
|
|
13837
|
-
/**
|
|
13838
|
-
* Convert a data object to FormData
|
|
13839
|
-
*
|
|
13840
|
-
* @param {Object} obj
|
|
13841
|
-
* @param {?Object} [formData]
|
|
13842
|
-
* @param {?Object} [options]
|
|
13843
|
-
* @param {Function} [options.visitor]
|
|
13844
|
-
* @param {Boolean} [options.metaTokens = true]
|
|
13845
|
-
* @param {Boolean} [options.dots = false]
|
|
13846
|
-
* @param {?Boolean} [options.indexes = false]
|
|
13847
|
-
*
|
|
13848
|
-
* @returns {Object}
|
|
13849
|
-
**/
|
|
13850
|
-
|
|
13851
|
-
/**
|
|
13852
|
-
* It converts an object into a FormData object
|
|
13853
|
-
*
|
|
13854
|
-
* @param {Object<any, any>} obj - The object to convert to form data.
|
|
13855
|
-
* @param {string} formData - The FormData object to append to.
|
|
13856
|
-
* @param {Object<string, any>} options
|
|
13857
|
-
*
|
|
13858
|
-
* @returns
|
|
13859
|
-
*/
|
|
13860
|
-
function toFormData$1(obj, formData, options) {
|
|
13861
|
-
if (!utils$1.isObject(obj)) {
|
|
13862
|
-
throw new TypeError('target must be an object');
|
|
13863
|
-
}
|
|
13864
|
-
|
|
13865
|
-
// eslint-disable-next-line no-param-reassign
|
|
13866
|
-
formData = formData || new (FormData)();
|
|
13867
|
-
|
|
13868
|
-
// eslint-disable-next-line no-param-reassign
|
|
13869
|
-
options = utils$1.toFlatObject(options, {
|
|
13870
|
-
metaTokens: true,
|
|
13871
|
-
dots: false,
|
|
13872
|
-
indexes: false
|
|
13873
|
-
}, false, function defined(option, source) {
|
|
13874
|
-
// eslint-disable-next-line no-eq-null,eqeqeq
|
|
13875
|
-
return !utils$1.isUndefined(source[option]);
|
|
13876
|
-
});
|
|
13877
|
-
|
|
13878
|
-
const metaTokens = options.metaTokens;
|
|
13879
|
-
// eslint-disable-next-line no-use-before-define
|
|
13880
|
-
const visitor = options.visitor || defaultVisitor;
|
|
13881
|
-
const dots = options.dots;
|
|
13882
|
-
const indexes = options.indexes;
|
|
13883
|
-
const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
|
|
13884
|
-
const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
|
|
13885
|
-
|
|
13886
|
-
if (!utils$1.isFunction(visitor)) {
|
|
13887
|
-
throw new TypeError('visitor must be a function');
|
|
13888
|
-
}
|
|
13889
|
-
|
|
13890
|
-
function convertValue(value) {
|
|
13891
|
-
if (value === null) return '';
|
|
13892
|
-
|
|
13893
|
-
if (utils$1.isDate(value)) {
|
|
13894
|
-
return value.toISOString();
|
|
13895
|
-
}
|
|
13896
|
-
|
|
13897
|
-
if (utils$1.isBoolean(value)) {
|
|
13898
|
-
return value.toString();
|
|
13899
|
-
}
|
|
13900
|
-
|
|
13901
|
-
if (!useBlob && utils$1.isBlob(value)) {
|
|
13902
|
-
throw new AxiosError$1('Blob is not supported. Use a Buffer instead.');
|
|
13903
|
-
}
|
|
13904
|
-
|
|
13905
|
-
if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
|
|
13906
|
-
return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
|
|
13907
|
-
}
|
|
13908
|
-
|
|
13909
|
-
return value;
|
|
13910
|
-
}
|
|
13911
|
-
|
|
13912
|
-
/**
|
|
13913
|
-
* Default visitor.
|
|
13914
|
-
*
|
|
13915
|
-
* @param {*} value
|
|
13916
|
-
* @param {String|Number} key
|
|
13917
|
-
* @param {Array<String|Number>} path
|
|
13918
|
-
* @this {FormData}
|
|
13919
|
-
*
|
|
13920
|
-
* @returns {boolean} return true to visit the each prop of the value recursively
|
|
13921
|
-
*/
|
|
13922
|
-
function defaultVisitor(value, key, path) {
|
|
13923
|
-
let arr = value;
|
|
13924
|
-
|
|
13925
|
-
if (value && !path && typeof value === 'object') {
|
|
13926
|
-
if (utils$1.endsWith(key, '{}')) {
|
|
13927
|
-
// eslint-disable-next-line no-param-reassign
|
|
13928
|
-
key = metaTokens ? key : key.slice(0, -2);
|
|
13929
|
-
// eslint-disable-next-line no-param-reassign
|
|
13930
|
-
value = JSON.stringify(value);
|
|
13931
|
-
} else if (
|
|
13932
|
-
(utils$1.isArray(value) && isFlatArray(value)) ||
|
|
13933
|
-
((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value))
|
|
13934
|
-
)) {
|
|
13935
|
-
// eslint-disable-next-line no-param-reassign
|
|
13936
|
-
key = removeBrackets(key);
|
|
13937
|
-
|
|
13938
|
-
arr.forEach(function each(el, index) {
|
|
13939
|
-
!(utils$1.isUndefined(el) || el === null) && formData.append(
|
|
13940
|
-
// eslint-disable-next-line no-nested-ternary
|
|
13941
|
-
indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'),
|
|
13942
|
-
convertValue(el)
|
|
13943
|
-
);
|
|
13944
|
-
});
|
|
13945
|
-
return false;
|
|
13946
|
-
}
|
|
13947
|
-
}
|
|
13948
|
-
|
|
13949
|
-
if (isVisitable(value)) {
|
|
13950
|
-
return true;
|
|
13951
|
-
}
|
|
13952
|
-
|
|
13953
|
-
formData.append(renderKey(path, key, dots), convertValue(value));
|
|
13954
|
-
|
|
13955
|
-
return false;
|
|
13956
|
-
}
|
|
13957
|
-
|
|
13958
|
-
const stack = [];
|
|
13959
|
-
|
|
13960
|
-
const exposedHelpers = Object.assign(predicates, {
|
|
13961
|
-
defaultVisitor,
|
|
13962
|
-
convertValue,
|
|
13963
|
-
isVisitable
|
|
13964
|
-
});
|
|
13965
|
-
|
|
13966
|
-
function build(value, path) {
|
|
13967
|
-
if (utils$1.isUndefined(value)) return;
|
|
13968
|
-
|
|
13969
|
-
if (stack.indexOf(value) !== -1) {
|
|
13970
|
-
throw Error('Circular reference detected in ' + path.join('.'));
|
|
13971
|
-
}
|
|
13972
|
-
|
|
13973
|
-
stack.push(value);
|
|
13974
|
-
|
|
13975
|
-
utils$1.forEach(value, function each(el, key) {
|
|
13976
|
-
const result = !(utils$1.isUndefined(el) || el === null) && visitor.call(
|
|
13977
|
-
formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers
|
|
13978
|
-
);
|
|
13979
|
-
|
|
13980
|
-
if (result === true) {
|
|
13981
|
-
build(el, path ? path.concat(key) : [key]);
|
|
13982
|
-
}
|
|
13983
|
-
});
|
|
13984
|
-
|
|
13985
|
-
stack.pop();
|
|
13986
|
-
}
|
|
13987
|
-
|
|
13988
|
-
if (!utils$1.isObject(obj)) {
|
|
13989
|
-
throw new TypeError('data must be an object');
|
|
13990
|
-
}
|
|
13991
|
-
|
|
13992
|
-
build(obj);
|
|
13993
|
-
|
|
13994
|
-
return formData;
|
|
13995
|
-
}
|
|
13996
|
-
|
|
13997
|
-
/**
|
|
13998
|
-
* It encodes a string by replacing all characters that are not in the unreserved set with
|
|
13999
|
-
* their percent-encoded equivalents
|
|
14000
|
-
*
|
|
14001
|
-
* @param {string} str - The string to encode.
|
|
14002
|
-
*
|
|
14003
|
-
* @returns {string} The encoded string.
|
|
14004
|
-
*/
|
|
14005
|
-
function encode$1(str) {
|
|
14006
|
-
const charMap = {
|
|
14007
|
-
'!': '%21',
|
|
14008
|
-
"'": '%27',
|
|
14009
|
-
'(': '%28',
|
|
14010
|
-
')': '%29',
|
|
14011
|
-
'~': '%7E',
|
|
14012
|
-
'%20': '+',
|
|
14013
|
-
'%00': '\x00'
|
|
14014
|
-
};
|
|
14015
|
-
return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
|
|
14016
|
-
return charMap[match];
|
|
14017
|
-
});
|
|
14018
|
-
}
|
|
14019
|
-
|
|
14020
|
-
/**
|
|
14021
|
-
* It takes a params object and converts it to a FormData object
|
|
14022
|
-
*
|
|
14023
|
-
* @param {Object<string, any>} params - The parameters to be converted to a FormData object.
|
|
14024
|
-
* @param {Object<string, any>} options - The options object passed to the Axios constructor.
|
|
14025
|
-
*
|
|
14026
|
-
* @returns {void}
|
|
14027
|
-
*/
|
|
14028
|
-
function AxiosURLSearchParams(params, options) {
|
|
14029
|
-
this._pairs = [];
|
|
14030
|
-
|
|
14031
|
-
params && toFormData$1(params, this, options);
|
|
14032
|
-
}
|
|
14033
|
-
|
|
14034
|
-
const prototype = AxiosURLSearchParams.prototype;
|
|
14035
|
-
|
|
14036
|
-
prototype.append = function append(name, value) {
|
|
14037
|
-
this._pairs.push([name, value]);
|
|
14038
|
-
};
|
|
14039
|
-
|
|
14040
|
-
prototype.toString = function toString(encoder) {
|
|
14041
|
-
const _encode = encoder ? function(value) {
|
|
14042
|
-
return encoder.call(this, value, encode$1);
|
|
14043
|
-
} : encode$1;
|
|
14044
|
-
|
|
14045
|
-
return this._pairs.map(function each(pair) {
|
|
14046
|
-
return _encode(pair[0]) + '=' + _encode(pair[1]);
|
|
14047
|
-
}, '').join('&');
|
|
14048
|
-
};
|
|
14049
|
-
|
|
14050
|
-
/**
|
|
14051
|
-
* It replaces all instances of the characters `:`, `$`, `,`, `+`, `[`, and `]` with their
|
|
14052
|
-
* URI encoded counterparts
|
|
14053
|
-
*
|
|
14054
|
-
* @param {string} val The value to be encoded.
|
|
14055
|
-
*
|
|
14056
|
-
* @returns {string} The encoded value.
|
|
14057
|
-
*/
|
|
14058
|
-
function encode(val) {
|
|
14059
|
-
return encodeURIComponent(val).
|
|
14060
|
-
replace(/%3A/gi, ':').
|
|
14061
|
-
replace(/%24/g, '$').
|
|
14062
|
-
replace(/%2C/gi, ',').
|
|
14063
|
-
replace(/%20/g, '+');
|
|
14064
|
-
}
|
|
14065
|
-
|
|
14066
|
-
/**
|
|
14067
|
-
* Build a URL by appending params to the end
|
|
14068
|
-
*
|
|
14069
|
-
* @param {string} url The base of the url (e.g., http://www.google.com)
|
|
14070
|
-
* @param {object} [params] The params to be appended
|
|
14071
|
-
* @param {?(object|Function)} options
|
|
14072
|
-
*
|
|
14073
|
-
* @returns {string} The formatted url
|
|
14074
|
-
*/
|
|
14075
|
-
function buildURL(url, params, options) {
|
|
14076
|
-
/*eslint no-param-reassign:0*/
|
|
14077
|
-
if (!params) {
|
|
14078
|
-
return url;
|
|
14079
|
-
}
|
|
14080
|
-
|
|
14081
|
-
const _encode = options && options.encode || encode;
|
|
14082
|
-
|
|
14083
|
-
if (utils$1.isFunction(options)) {
|
|
14084
|
-
options = {
|
|
14085
|
-
serialize: options
|
|
14086
|
-
};
|
|
14087
|
-
}
|
|
14088
|
-
|
|
14089
|
-
const serializeFn = options && options.serialize;
|
|
14090
|
-
|
|
14091
|
-
let serializedParams;
|
|
14092
|
-
|
|
14093
|
-
if (serializeFn) {
|
|
14094
|
-
serializedParams = serializeFn(params, options);
|
|
14095
|
-
} else {
|
|
14096
|
-
serializedParams = utils$1.isURLSearchParams(params) ?
|
|
14097
|
-
params.toString() :
|
|
14098
|
-
new AxiosURLSearchParams(params, options).toString(_encode);
|
|
14099
|
-
}
|
|
14100
|
-
|
|
14101
|
-
if (serializedParams) {
|
|
14102
|
-
const hashmarkIndex = url.indexOf("#");
|
|
14103
|
-
|
|
14104
|
-
if (hashmarkIndex !== -1) {
|
|
14105
|
-
url = url.slice(0, hashmarkIndex);
|
|
14106
|
-
}
|
|
14107
|
-
url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
|
|
14108
|
-
}
|
|
14109
|
-
|
|
14110
|
-
return url;
|
|
14111
|
-
}
|
|
14112
|
-
|
|
14113
|
-
class InterceptorManager {
|
|
14114
|
-
constructor() {
|
|
14115
|
-
this.handlers = [];
|
|
14116
|
-
}
|
|
14117
|
-
|
|
14118
|
-
/**
|
|
14119
|
-
* Add a new interceptor to the stack
|
|
14120
|
-
*
|
|
14121
|
-
* @param {Function} fulfilled The function to handle `then` for a `Promise`
|
|
14122
|
-
* @param {Function} rejected The function to handle `reject` for a `Promise`
|
|
14123
|
-
*
|
|
14124
|
-
* @return {Number} An ID used to remove interceptor later
|
|
14125
|
-
*/
|
|
14126
|
-
use(fulfilled, rejected, options) {
|
|
14127
|
-
this.handlers.push({
|
|
14128
|
-
fulfilled,
|
|
14129
|
-
rejected,
|
|
14130
|
-
synchronous: options ? options.synchronous : false,
|
|
14131
|
-
runWhen: options ? options.runWhen : null
|
|
14132
|
-
});
|
|
14133
|
-
return this.handlers.length - 1;
|
|
14134
|
-
}
|
|
14135
|
-
|
|
14136
|
-
/**
|
|
14137
|
-
* Remove an interceptor from the stack
|
|
14138
|
-
*
|
|
14139
|
-
* @param {Number} id The ID that was returned by `use`
|
|
14140
|
-
*
|
|
14141
|
-
* @returns {void}
|
|
14142
|
-
*/
|
|
14143
|
-
eject(id) {
|
|
14144
|
-
if (this.handlers[id]) {
|
|
14145
|
-
this.handlers[id] = null;
|
|
14146
|
-
}
|
|
14147
|
-
}
|
|
14148
|
-
|
|
14149
|
-
/**
|
|
14150
|
-
* Clear all interceptors from the stack
|
|
14151
|
-
*
|
|
14152
|
-
* @returns {void}
|
|
14153
|
-
*/
|
|
14154
|
-
clear() {
|
|
14155
|
-
if (this.handlers) {
|
|
14156
|
-
this.handlers = [];
|
|
14157
|
-
}
|
|
14158
|
-
}
|
|
14159
|
-
|
|
14160
|
-
/**
|
|
14161
|
-
* Iterate over all the registered interceptors
|
|
14162
|
-
*
|
|
14163
|
-
* This method is particularly useful for skipping over any
|
|
14164
|
-
* interceptors that may have become `null` calling `eject`.
|
|
14165
|
-
*
|
|
14166
|
-
* @param {Function} fn The function to call for each interceptor
|
|
14167
|
-
*
|
|
14168
|
-
* @returns {void}
|
|
14169
|
-
*/
|
|
14170
|
-
forEach(fn) {
|
|
14171
|
-
utils$1.forEach(this.handlers, function forEachHandler(h) {
|
|
14172
|
-
if (h !== null) {
|
|
14173
|
-
fn(h);
|
|
14174
|
-
}
|
|
14175
|
-
});
|
|
14176
|
-
}
|
|
14177
|
-
}
|
|
14178
|
-
|
|
14179
|
-
var transitionalDefaults = {
|
|
14180
|
-
silentJSONParsing: true,
|
|
14181
|
-
forcedJSONParsing: true,
|
|
14182
|
-
clarifyTimeoutError: false
|
|
14183
|
-
};
|
|
14184
|
-
|
|
14185
|
-
var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
|
|
14186
|
-
|
|
14187
|
-
var FormData$1 = typeof FormData !== 'undefined' ? FormData : null;
|
|
14188
|
-
|
|
14189
|
-
var Blob$1 = typeof Blob !== 'undefined' ? Blob : null;
|
|
14190
|
-
|
|
14191
|
-
var platform$1 = {
|
|
14192
|
-
isBrowser: true,
|
|
14193
|
-
classes: {
|
|
14194
|
-
URLSearchParams: URLSearchParams$1,
|
|
14195
|
-
FormData: FormData$1,
|
|
14196
|
-
Blob: Blob$1
|
|
14197
|
-
},
|
|
14198
|
-
protocols: ['http', 'https', 'file', 'blob', 'url', 'data']
|
|
14199
|
-
};
|
|
14200
|
-
|
|
14201
|
-
const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
|
|
14202
|
-
|
|
14203
|
-
const _navigator = typeof navigator === 'object' && navigator || undefined;
|
|
14204
|
-
|
|
14205
|
-
/**
|
|
14206
|
-
* Determine if we're running in a standard browser environment
|
|
14207
|
-
*
|
|
14208
|
-
* This allows axios to run in a web worker, and react-native.
|
|
14209
|
-
* Both environments support XMLHttpRequest, but not fully standard globals.
|
|
14210
|
-
*
|
|
14211
|
-
* web workers:
|
|
14212
|
-
* typeof window -> undefined
|
|
14213
|
-
* typeof document -> undefined
|
|
14214
|
-
*
|
|
14215
|
-
* react-native:
|
|
14216
|
-
* navigator.product -> 'ReactNative'
|
|
14217
|
-
* nativescript
|
|
14218
|
-
* navigator.product -> 'NativeScript' or 'NS'
|
|
14219
|
-
*
|
|
14220
|
-
* @returns {boolean}
|
|
14221
|
-
*/
|
|
14222
|
-
const hasStandardBrowserEnv = hasBrowserEnv &&
|
|
14223
|
-
(!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);
|
|
14224
|
-
|
|
14225
|
-
/**
|
|
14226
|
-
* Determine if we're running in a standard browser webWorker environment
|
|
14227
|
-
*
|
|
14228
|
-
* Although the `isStandardBrowserEnv` method indicates that
|
|
14229
|
-
* `allows axios to run in a web worker`, the WebWorker will still be
|
|
14230
|
-
* filtered out due to its judgment standard
|
|
14231
|
-
* `typeof window !== 'undefined' && typeof document !== 'undefined'`.
|
|
14232
|
-
* This leads to a problem when axios post `FormData` in webWorker
|
|
14233
|
-
*/
|
|
14234
|
-
const hasStandardBrowserWebWorkerEnv = (() => {
|
|
14235
|
-
return (
|
|
14236
|
-
typeof WorkerGlobalScope !== 'undefined' &&
|
|
14237
|
-
// eslint-disable-next-line no-undef
|
|
14238
|
-
self instanceof WorkerGlobalScope &&
|
|
14239
|
-
typeof self.importScripts === 'function'
|
|
14240
|
-
);
|
|
14241
|
-
})();
|
|
14242
|
-
|
|
14243
|
-
const origin = hasBrowserEnv && window.location.href || 'http://localhost';
|
|
14244
|
-
|
|
14245
|
-
var utils = /*#__PURE__*/Object.freeze({
|
|
14246
|
-
__proto__: null,
|
|
14247
|
-
hasBrowserEnv: hasBrowserEnv,
|
|
14248
|
-
hasStandardBrowserEnv: hasStandardBrowserEnv,
|
|
14249
|
-
hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
|
|
14250
|
-
navigator: _navigator,
|
|
14251
|
-
origin: origin
|
|
14252
|
-
});
|
|
14253
|
-
|
|
14254
|
-
var platform = {
|
|
14255
|
-
...utils,
|
|
14256
|
-
...platform$1
|
|
14257
|
-
};
|
|
14258
|
-
|
|
14259
|
-
function toURLEncodedForm(data, options) {
|
|
14260
|
-
return toFormData$1(data, new platform.classes.URLSearchParams(), {
|
|
14261
|
-
visitor: function(value, key, path, helpers) {
|
|
14262
|
-
if (platform.isNode && utils$1.isBuffer(value)) {
|
|
14263
|
-
this.append(key, value.toString('base64'));
|
|
14264
|
-
return false;
|
|
14265
|
-
}
|
|
14266
|
-
|
|
14267
|
-
return helpers.defaultVisitor.apply(this, arguments);
|
|
14268
|
-
},
|
|
14269
|
-
...options
|
|
14270
|
-
});
|
|
14271
|
-
}
|
|
14272
|
-
|
|
14273
|
-
/**
|
|
14274
|
-
* It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']
|
|
14275
|
-
*
|
|
14276
|
-
* @param {string} name - The name of the property to get.
|
|
14277
|
-
*
|
|
14278
|
-
* @returns An array of strings.
|
|
14279
|
-
*/
|
|
14280
|
-
function parsePropPath(name) {
|
|
14281
|
-
// foo[x][y][z]
|
|
14282
|
-
// foo.x.y.z
|
|
14283
|
-
// foo-x-y-z
|
|
14284
|
-
// foo x y z
|
|
14285
|
-
return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map(match => {
|
|
14286
|
-
return match[0] === '[]' ? '' : match[1] || match[0];
|
|
14287
|
-
});
|
|
14288
|
-
}
|
|
14289
|
-
|
|
14290
|
-
/**
|
|
14291
|
-
* Convert an array to an object.
|
|
14292
|
-
*
|
|
14293
|
-
* @param {Array<any>} arr - The array to convert to an object.
|
|
14294
|
-
*
|
|
14295
|
-
* @returns An object with the same keys and values as the array.
|
|
14296
|
-
*/
|
|
14297
|
-
function arrayToObject(arr) {
|
|
14298
|
-
const obj = {};
|
|
14299
|
-
const keys = Object.keys(arr);
|
|
14300
|
-
let i;
|
|
14301
|
-
const len = keys.length;
|
|
14302
|
-
let key;
|
|
14303
|
-
for (i = 0; i < len; i++) {
|
|
14304
|
-
key = keys[i];
|
|
14305
|
-
obj[key] = arr[key];
|
|
14306
|
-
}
|
|
14307
|
-
return obj;
|
|
14308
|
-
}
|
|
14309
|
-
|
|
14310
|
-
/**
|
|
14311
|
-
* It takes a FormData object and returns a JavaScript object
|
|
14312
|
-
*
|
|
14313
|
-
* @param {string} formData The FormData object to convert to JSON.
|
|
14314
|
-
*
|
|
14315
|
-
* @returns {Object<string, any> | null} The converted object.
|
|
14316
|
-
*/
|
|
14317
|
-
function formDataToJSON(formData) {
|
|
14318
|
-
function buildPath(path, value, target, index) {
|
|
14319
|
-
let name = path[index++];
|
|
14320
|
-
|
|
14321
|
-
if (name === '__proto__') return true;
|
|
14322
|
-
|
|
14323
|
-
const isNumericKey = Number.isFinite(+name);
|
|
14324
|
-
const isLast = index >= path.length;
|
|
14325
|
-
name = !name && utils$1.isArray(target) ? target.length : name;
|
|
14326
|
-
|
|
14327
|
-
if (isLast) {
|
|
14328
|
-
if (utils$1.hasOwnProp(target, name)) {
|
|
14329
|
-
target[name] = [target[name], value];
|
|
14330
|
-
} else {
|
|
14331
|
-
target[name] = value;
|
|
14332
|
-
}
|
|
14333
|
-
|
|
14334
|
-
return !isNumericKey;
|
|
14335
|
-
}
|
|
14336
|
-
|
|
14337
|
-
if (!target[name] || !utils$1.isObject(target[name])) {
|
|
14338
|
-
target[name] = [];
|
|
14339
|
-
}
|
|
14340
|
-
|
|
14341
|
-
const result = buildPath(path, value, target[name], index);
|
|
14342
|
-
|
|
14343
|
-
if (result && utils$1.isArray(target[name])) {
|
|
14344
|
-
target[name] = arrayToObject(target[name]);
|
|
14345
|
-
}
|
|
14346
|
-
|
|
14347
|
-
return !isNumericKey;
|
|
14348
|
-
}
|
|
14349
|
-
|
|
14350
|
-
if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {
|
|
14351
|
-
const obj = {};
|
|
14352
|
-
|
|
14353
|
-
utils$1.forEachEntry(formData, (name, value) => {
|
|
14354
|
-
buildPath(parsePropPath(name), value, obj, 0);
|
|
14355
|
-
});
|
|
14356
|
-
|
|
14357
|
-
return obj;
|
|
14358
|
-
}
|
|
14359
|
-
|
|
14360
|
-
return null;
|
|
14361
|
-
}
|
|
14362
|
-
|
|
14363
|
-
/**
|
|
14364
|
-
* It takes a string, tries to parse it, and if it fails, it returns the stringified version
|
|
14365
|
-
* of the input
|
|
14366
|
-
*
|
|
14367
|
-
* @param {any} rawValue - The value to be stringified.
|
|
14368
|
-
* @param {Function} parser - A function that parses a string into a JavaScript object.
|
|
14369
|
-
* @param {Function} encoder - A function that takes a value and returns a string.
|
|
14370
|
-
*
|
|
14371
|
-
* @returns {string} A stringified version of the rawValue.
|
|
14372
|
-
*/
|
|
14373
|
-
function stringifySafely(rawValue, parser, encoder) {
|
|
14374
|
-
if (utils$1.isString(rawValue)) {
|
|
14375
|
-
try {
|
|
14376
|
-
(parser || JSON.parse)(rawValue);
|
|
14377
|
-
return utils$1.trim(rawValue);
|
|
14378
|
-
} catch (e) {
|
|
14379
|
-
if (e.name !== 'SyntaxError') {
|
|
14380
|
-
throw e;
|
|
14381
|
-
}
|
|
14382
|
-
}
|
|
14383
|
-
}
|
|
14384
|
-
|
|
14385
|
-
return (encoder || JSON.stringify)(rawValue);
|
|
14386
|
-
}
|
|
14387
|
-
|
|
14388
|
-
const defaults$1 = {
|
|
14389
|
-
|
|
14390
|
-
transitional: transitionalDefaults,
|
|
14391
|
-
|
|
14392
|
-
adapter: ['xhr', 'http', 'fetch'],
|
|
14393
|
-
|
|
14394
|
-
transformRequest: [function transformRequest(data, headers) {
|
|
14395
|
-
const contentType = headers.getContentType() || '';
|
|
14396
|
-
const hasJSONContentType = contentType.indexOf('application/json') > -1;
|
|
14397
|
-
const isObjectPayload = utils$1.isObject(data);
|
|
14398
|
-
|
|
14399
|
-
if (isObjectPayload && utils$1.isHTMLForm(data)) {
|
|
14400
|
-
data = new FormData(data);
|
|
14401
|
-
}
|
|
14402
|
-
|
|
14403
|
-
const isFormData = utils$1.isFormData(data);
|
|
14404
|
-
|
|
14405
|
-
if (isFormData) {
|
|
14406
|
-
return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
|
|
14407
|
-
}
|
|
14408
|
-
|
|
14409
|
-
if (utils$1.isArrayBuffer(data) ||
|
|
14410
|
-
utils$1.isBuffer(data) ||
|
|
14411
|
-
utils$1.isStream(data) ||
|
|
14412
|
-
utils$1.isFile(data) ||
|
|
14413
|
-
utils$1.isBlob(data) ||
|
|
14414
|
-
utils$1.isReadableStream(data)
|
|
14415
|
-
) {
|
|
14416
|
-
return data;
|
|
14417
|
-
}
|
|
14418
|
-
if (utils$1.isArrayBufferView(data)) {
|
|
14419
|
-
return data.buffer;
|
|
14420
|
-
}
|
|
14421
|
-
if (utils$1.isURLSearchParams(data)) {
|
|
14422
|
-
headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
|
|
14423
|
-
return data.toString();
|
|
14424
|
-
}
|
|
14425
|
-
|
|
14426
|
-
let isFileList;
|
|
14427
|
-
|
|
14428
|
-
if (isObjectPayload) {
|
|
14429
|
-
if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
|
|
14430
|
-
return toURLEncodedForm(data, this.formSerializer).toString();
|
|
14431
|
-
}
|
|
14432
|
-
|
|
14433
|
-
if ((isFileList = utils$1.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
|
|
14434
|
-
const _FormData = this.env && this.env.FormData;
|
|
14435
|
-
|
|
14436
|
-
return toFormData$1(
|
|
14437
|
-
isFileList ? {'files[]': data} : data,
|
|
14438
|
-
_FormData && new _FormData(),
|
|
14439
|
-
this.formSerializer
|
|
14440
|
-
);
|
|
14441
|
-
}
|
|
14442
|
-
}
|
|
14443
|
-
|
|
14444
|
-
if (isObjectPayload || hasJSONContentType ) {
|
|
14445
|
-
headers.setContentType('application/json', false);
|
|
14446
|
-
return stringifySafely(data);
|
|
14447
|
-
}
|
|
14448
|
-
|
|
14449
|
-
return data;
|
|
14450
|
-
}],
|
|
14451
|
-
|
|
14452
|
-
transformResponse: [function transformResponse(data) {
|
|
14453
|
-
const transitional = this.transitional || defaults$1.transitional;
|
|
14454
|
-
const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
|
|
14455
|
-
const JSONRequested = this.responseType === 'json';
|
|
14456
|
-
|
|
14457
|
-
if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
|
|
14458
|
-
return data;
|
|
14459
|
-
}
|
|
14460
|
-
|
|
14461
|
-
if (data && utils$1.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
|
|
14462
|
-
const silentJSONParsing = transitional && transitional.silentJSONParsing;
|
|
14463
|
-
const strictJSONParsing = !silentJSONParsing && JSONRequested;
|
|
14464
|
-
|
|
14465
|
-
try {
|
|
14466
|
-
return JSON.parse(data, this.parseReviver);
|
|
14467
|
-
} catch (e) {
|
|
14468
|
-
if (strictJSONParsing) {
|
|
14469
|
-
if (e.name === 'SyntaxError') {
|
|
14470
|
-
throw AxiosError$1.from(e, AxiosError$1.ERR_BAD_RESPONSE, this, null, this.response);
|
|
14471
|
-
}
|
|
14472
|
-
throw e;
|
|
14473
|
-
}
|
|
14474
|
-
}
|
|
14475
|
-
}
|
|
14476
|
-
|
|
14477
|
-
return data;
|
|
14478
|
-
}],
|
|
14479
|
-
|
|
14480
|
-
/**
|
|
14481
|
-
* A timeout in milliseconds to abort a request. If set to 0 (default) a
|
|
14482
|
-
* timeout is not created.
|
|
14483
|
-
*/
|
|
14484
|
-
timeout: 0,
|
|
14485
|
-
|
|
14486
|
-
xsrfCookieName: 'XSRF-TOKEN',
|
|
14487
|
-
xsrfHeaderName: 'X-XSRF-TOKEN',
|
|
14488
|
-
|
|
14489
|
-
maxContentLength: -1,
|
|
14490
|
-
maxBodyLength: -1,
|
|
14491
|
-
|
|
14492
|
-
env: {
|
|
14493
|
-
FormData: platform.classes.FormData,
|
|
14494
|
-
Blob: platform.classes.Blob
|
|
14495
|
-
},
|
|
14496
|
-
|
|
14497
|
-
validateStatus: function validateStatus(status) {
|
|
14498
|
-
return status >= 200 && status < 300;
|
|
14499
|
-
},
|
|
14500
|
-
|
|
14501
|
-
headers: {
|
|
14502
|
-
common: {
|
|
14503
|
-
'Accept': 'application/json, text/plain, */*',
|
|
14504
|
-
'Content-Type': undefined
|
|
14505
|
-
}
|
|
14506
|
-
}
|
|
14507
|
-
};
|
|
14508
|
-
|
|
14509
|
-
utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
|
|
14510
|
-
defaults$1.headers[method] = {};
|
|
14511
|
-
});
|
|
14512
|
-
|
|
14513
|
-
// RawAxiosHeaders whose duplicates are ignored by node
|
|
14514
|
-
// c.f. https://nodejs.org/api/http.html#http_message_headers
|
|
14515
|
-
const ignoreDuplicateOf = utils$1.toObjectSet([
|
|
14516
|
-
'age', 'authorization', 'content-length', 'content-type', 'etag',
|
|
14517
|
-
'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
|
|
14518
|
-
'last-modified', 'location', 'max-forwards', 'proxy-authorization',
|
|
14519
|
-
'referer', 'retry-after', 'user-agent'
|
|
14520
|
-
]);
|
|
14521
|
-
|
|
14522
|
-
/**
|
|
14523
|
-
* Parse headers into an object
|
|
14524
|
-
*
|
|
14525
|
-
* ```
|
|
14526
|
-
* Date: Wed, 27 Aug 2014 08:58:49 GMT
|
|
14527
|
-
* Content-Type: application/json
|
|
14528
|
-
* Connection: keep-alive
|
|
14529
|
-
* Transfer-Encoding: chunked
|
|
14530
|
-
* ```
|
|
14531
|
-
*
|
|
14532
|
-
* @param {String} rawHeaders Headers needing to be parsed
|
|
14533
|
-
*
|
|
14534
|
-
* @returns {Object} Headers parsed into an object
|
|
14535
|
-
*/
|
|
14536
|
-
var parseHeaders = rawHeaders => {
|
|
14537
|
-
const parsed = {};
|
|
14538
|
-
let key;
|
|
14539
|
-
let val;
|
|
14540
|
-
let i;
|
|
14541
|
-
|
|
14542
|
-
rawHeaders && rawHeaders.split('\n').forEach(function parser(line) {
|
|
14543
|
-
i = line.indexOf(':');
|
|
14544
|
-
key = line.substring(0, i).trim().toLowerCase();
|
|
14545
|
-
val = line.substring(i + 1).trim();
|
|
14546
|
-
|
|
14547
|
-
if (!key || (parsed[key] && ignoreDuplicateOf[key])) {
|
|
14548
|
-
return;
|
|
14549
|
-
}
|
|
14550
|
-
|
|
14551
|
-
if (key === 'set-cookie') {
|
|
14552
|
-
if (parsed[key]) {
|
|
14553
|
-
parsed[key].push(val);
|
|
14554
|
-
} else {
|
|
14555
|
-
parsed[key] = [val];
|
|
14556
|
-
}
|
|
14557
|
-
} else {
|
|
14558
|
-
parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
|
|
14559
|
-
}
|
|
14560
|
-
});
|
|
14561
|
-
|
|
14562
|
-
return parsed;
|
|
14563
|
-
};
|
|
14564
|
-
|
|
14565
|
-
const $internals = Symbol('internals');
|
|
14566
|
-
|
|
14567
|
-
function normalizeHeader(header) {
|
|
14568
|
-
return header && String(header).trim().toLowerCase();
|
|
14569
|
-
}
|
|
14570
|
-
|
|
14571
|
-
function normalizeValue(value) {
|
|
14572
|
-
if (value === false || value == null) {
|
|
14573
|
-
return value;
|
|
14574
|
-
}
|
|
14575
|
-
|
|
14576
|
-
return utils$1.isArray(value) ? value.map(normalizeValue) : String(value);
|
|
14577
|
-
}
|
|
14578
|
-
|
|
14579
|
-
function parseTokens(str) {
|
|
14580
|
-
const tokens = Object.create(null);
|
|
14581
|
-
const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
|
|
14582
|
-
let match;
|
|
14583
|
-
|
|
14584
|
-
while ((match = tokensRE.exec(str))) {
|
|
14585
|
-
tokens[match[1]] = match[2];
|
|
14586
|
-
}
|
|
14587
|
-
|
|
14588
|
-
return tokens;
|
|
14589
|
-
}
|
|
14590
|
-
|
|
14591
|
-
const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
|
|
14592
|
-
|
|
14593
|
-
function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
|
|
14594
|
-
if (utils$1.isFunction(filter)) {
|
|
14595
|
-
return filter.call(this, value, header);
|
|
14596
|
-
}
|
|
14597
|
-
|
|
14598
|
-
if (isHeaderNameFilter) {
|
|
14599
|
-
value = header;
|
|
14600
|
-
}
|
|
14601
|
-
|
|
14602
|
-
if (!utils$1.isString(value)) return;
|
|
14603
|
-
|
|
14604
|
-
if (utils$1.isString(filter)) {
|
|
14605
|
-
return value.indexOf(filter) !== -1;
|
|
14606
|
-
}
|
|
14607
|
-
|
|
14608
|
-
if (utils$1.isRegExp(filter)) {
|
|
14609
|
-
return filter.test(value);
|
|
14610
|
-
}
|
|
14611
|
-
}
|
|
14612
|
-
|
|
14613
|
-
function formatHeader(header) {
|
|
14614
|
-
return header.trim()
|
|
14615
|
-
.toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => {
|
|
14616
|
-
return char.toUpperCase() + str;
|
|
14617
|
-
});
|
|
14618
|
-
}
|
|
14619
|
-
|
|
14620
|
-
function buildAccessors(obj, header) {
|
|
14621
|
-
const accessorName = utils$1.toCamelCase(' ' + header);
|
|
14622
|
-
|
|
14623
|
-
['get', 'set', 'has'].forEach(methodName => {
|
|
14624
|
-
Object.defineProperty(obj, methodName + accessorName, {
|
|
14625
|
-
value: function(arg1, arg2, arg3) {
|
|
14626
|
-
return this[methodName].call(this, header, arg1, arg2, arg3);
|
|
14627
|
-
},
|
|
14628
|
-
configurable: true
|
|
14629
|
-
});
|
|
14630
|
-
});
|
|
14631
|
-
}
|
|
14632
|
-
|
|
14633
|
-
let AxiosHeaders$1 = class AxiosHeaders {
|
|
14634
|
-
constructor(headers) {
|
|
14635
|
-
headers && this.set(headers);
|
|
14636
|
-
}
|
|
14637
|
-
|
|
14638
|
-
set(header, valueOrRewrite, rewrite) {
|
|
14639
|
-
const self = this;
|
|
14640
|
-
|
|
14641
|
-
function setHeader(_value, _header, _rewrite) {
|
|
14642
|
-
const lHeader = normalizeHeader(_header);
|
|
14643
|
-
|
|
14644
|
-
if (!lHeader) {
|
|
14645
|
-
throw new Error('header name must be a non-empty string');
|
|
14646
|
-
}
|
|
14647
|
-
|
|
14648
|
-
const key = utils$1.findKey(self, lHeader);
|
|
14649
|
-
|
|
14650
|
-
if(!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) {
|
|
14651
|
-
self[key || _header] = normalizeValue(_value);
|
|
14652
|
-
}
|
|
14653
|
-
}
|
|
14654
|
-
|
|
14655
|
-
const setHeaders = (headers, _rewrite) =>
|
|
14656
|
-
utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
|
|
14657
|
-
|
|
14658
|
-
if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
|
|
14659
|
-
setHeaders(header, valueOrRewrite);
|
|
14660
|
-
} else if(utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
|
|
14661
|
-
setHeaders(parseHeaders(header), valueOrRewrite);
|
|
14662
|
-
} else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
|
|
14663
|
-
let obj = {}, dest, key;
|
|
14664
|
-
for (const entry of header) {
|
|
14665
|
-
if (!utils$1.isArray(entry)) {
|
|
14666
|
-
throw TypeError('Object iterator must return a key-value pair');
|
|
14667
|
-
}
|
|
14668
|
-
|
|
14669
|
-
obj[key = entry[0]] = (dest = obj[key]) ?
|
|
14670
|
-
(utils$1.isArray(dest) ? [...dest, entry[1]] : [dest, entry[1]]) : entry[1];
|
|
14671
|
-
}
|
|
14672
|
-
|
|
14673
|
-
setHeaders(obj, valueOrRewrite);
|
|
14674
|
-
} else {
|
|
14675
|
-
header != null && setHeader(valueOrRewrite, header, rewrite);
|
|
14676
|
-
}
|
|
14677
|
-
|
|
14678
|
-
return this;
|
|
14679
|
-
}
|
|
14680
|
-
|
|
14681
|
-
get(header, parser) {
|
|
14682
|
-
header = normalizeHeader(header);
|
|
14683
|
-
|
|
14684
|
-
if (header) {
|
|
14685
|
-
const key = utils$1.findKey(this, header);
|
|
14686
|
-
|
|
14687
|
-
if (key) {
|
|
14688
|
-
const value = this[key];
|
|
14689
|
-
|
|
14690
|
-
if (!parser) {
|
|
14691
|
-
return value;
|
|
14692
|
-
}
|
|
14693
|
-
|
|
14694
|
-
if (parser === true) {
|
|
14695
|
-
return parseTokens(value);
|
|
14696
|
-
}
|
|
14697
|
-
|
|
14698
|
-
if (utils$1.isFunction(parser)) {
|
|
14699
|
-
return parser.call(this, value, key);
|
|
14700
|
-
}
|
|
14701
|
-
|
|
14702
|
-
if (utils$1.isRegExp(parser)) {
|
|
14703
|
-
return parser.exec(value);
|
|
14704
|
-
}
|
|
14705
|
-
|
|
14706
|
-
throw new TypeError('parser must be boolean|regexp|function');
|
|
14707
|
-
}
|
|
14708
|
-
}
|
|
14709
|
-
}
|
|
14710
|
-
|
|
14711
|
-
has(header, matcher) {
|
|
14712
|
-
header = normalizeHeader(header);
|
|
14713
|
-
|
|
14714
|
-
if (header) {
|
|
14715
|
-
const key = utils$1.findKey(this, header);
|
|
14716
|
-
|
|
14717
|
-
return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
|
|
14718
|
-
}
|
|
14719
|
-
|
|
14720
|
-
return false;
|
|
14721
|
-
}
|
|
14722
|
-
|
|
14723
|
-
delete(header, matcher) {
|
|
14724
|
-
const self = this;
|
|
14725
|
-
let deleted = false;
|
|
14726
|
-
|
|
14727
|
-
function deleteHeader(_header) {
|
|
14728
|
-
_header = normalizeHeader(_header);
|
|
14729
|
-
|
|
14730
|
-
if (_header) {
|
|
14731
|
-
const key = utils$1.findKey(self, _header);
|
|
14732
|
-
|
|
14733
|
-
if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
|
|
14734
|
-
delete self[key];
|
|
14735
|
-
|
|
14736
|
-
deleted = true;
|
|
14737
|
-
}
|
|
14738
|
-
}
|
|
14739
|
-
}
|
|
14740
|
-
|
|
14741
|
-
if (utils$1.isArray(header)) {
|
|
14742
|
-
header.forEach(deleteHeader);
|
|
14743
|
-
} else {
|
|
14744
|
-
deleteHeader(header);
|
|
14745
|
-
}
|
|
14746
|
-
|
|
14747
|
-
return deleted;
|
|
14748
|
-
}
|
|
14749
|
-
|
|
14750
|
-
clear(matcher) {
|
|
14751
|
-
const keys = Object.keys(this);
|
|
14752
|
-
let i = keys.length;
|
|
14753
|
-
let deleted = false;
|
|
14754
|
-
|
|
14755
|
-
while (i--) {
|
|
14756
|
-
const key = keys[i];
|
|
14757
|
-
if(!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
|
|
14758
|
-
delete this[key];
|
|
14759
|
-
deleted = true;
|
|
14760
|
-
}
|
|
14761
|
-
}
|
|
14762
|
-
|
|
14763
|
-
return deleted;
|
|
14764
|
-
}
|
|
14765
|
-
|
|
14766
|
-
normalize(format) {
|
|
14767
|
-
const self = this;
|
|
14768
|
-
const headers = {};
|
|
14769
|
-
|
|
14770
|
-
utils$1.forEach(this, (value, header) => {
|
|
14771
|
-
const key = utils$1.findKey(headers, header);
|
|
14772
|
-
|
|
14773
|
-
if (key) {
|
|
14774
|
-
self[key] = normalizeValue(value);
|
|
14775
|
-
delete self[header];
|
|
14776
|
-
return;
|
|
14777
|
-
}
|
|
14778
|
-
|
|
14779
|
-
const normalized = format ? formatHeader(header) : String(header).trim();
|
|
14780
|
-
|
|
14781
|
-
if (normalized !== header) {
|
|
14782
|
-
delete self[header];
|
|
14783
|
-
}
|
|
14784
|
-
|
|
14785
|
-
self[normalized] = normalizeValue(value);
|
|
14786
|
-
|
|
14787
|
-
headers[normalized] = true;
|
|
14788
|
-
});
|
|
14789
|
-
|
|
14790
|
-
return this;
|
|
14791
|
-
}
|
|
14792
|
-
|
|
14793
|
-
concat(...targets) {
|
|
14794
|
-
return this.constructor.concat(this, ...targets);
|
|
14795
|
-
}
|
|
14796
|
-
|
|
14797
|
-
toJSON(asStrings) {
|
|
14798
|
-
const obj = Object.create(null);
|
|
14799
|
-
|
|
14800
|
-
utils$1.forEach(this, (value, header) => {
|
|
14801
|
-
value != null && value !== false && (obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value);
|
|
14802
|
-
});
|
|
14803
|
-
|
|
14804
|
-
return obj;
|
|
14805
|
-
}
|
|
14806
|
-
|
|
14807
|
-
[Symbol.iterator]() {
|
|
14808
|
-
return Object.entries(this.toJSON())[Symbol.iterator]();
|
|
14809
|
-
}
|
|
14810
|
-
|
|
14811
|
-
toString() {
|
|
14812
|
-
return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\n');
|
|
14813
|
-
}
|
|
14814
|
-
|
|
14815
|
-
getSetCookie() {
|
|
14816
|
-
return this.get("set-cookie") || [];
|
|
14817
|
-
}
|
|
14818
|
-
|
|
14819
|
-
get [Symbol.toStringTag]() {
|
|
14820
|
-
return 'AxiosHeaders';
|
|
14821
|
-
}
|
|
14822
|
-
|
|
14823
|
-
static from(thing) {
|
|
14824
|
-
return thing instanceof this ? thing : new this(thing);
|
|
14825
|
-
}
|
|
14826
|
-
|
|
14827
|
-
static concat(first, ...targets) {
|
|
14828
|
-
const computed = new this(first);
|
|
14829
|
-
|
|
14830
|
-
targets.forEach((target) => computed.set(target));
|
|
14831
|
-
|
|
14832
|
-
return computed;
|
|
14833
|
-
}
|
|
14834
|
-
|
|
14835
|
-
static accessor(header) {
|
|
14836
|
-
const internals = this[$internals] = (this[$internals] = {
|
|
14837
|
-
accessors: {}
|
|
14838
|
-
});
|
|
14839
|
-
|
|
14840
|
-
const accessors = internals.accessors;
|
|
14841
|
-
const prototype = this.prototype;
|
|
14842
|
-
|
|
14843
|
-
function defineAccessor(_header) {
|
|
14844
|
-
const lHeader = normalizeHeader(_header);
|
|
14845
|
-
|
|
14846
|
-
if (!accessors[lHeader]) {
|
|
14847
|
-
buildAccessors(prototype, _header);
|
|
14848
|
-
accessors[lHeader] = true;
|
|
14849
|
-
}
|
|
14850
|
-
}
|
|
14851
|
-
|
|
14852
|
-
utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
|
|
14853
|
-
|
|
14854
|
-
return this;
|
|
14855
|
-
}
|
|
14856
|
-
};
|
|
14857
|
-
|
|
14858
|
-
AxiosHeaders$1.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);
|
|
14859
|
-
|
|
14860
|
-
// reserved names hotfix
|
|
14861
|
-
utils$1.reduceDescriptors(AxiosHeaders$1.prototype, ({value}, key) => {
|
|
14862
|
-
let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
|
|
14863
|
-
return {
|
|
14864
|
-
get: () => value,
|
|
14865
|
-
set(headerValue) {
|
|
14866
|
-
this[mapped] = headerValue;
|
|
14867
|
-
}
|
|
14868
|
-
}
|
|
14869
|
-
});
|
|
14870
|
-
|
|
14871
|
-
utils$1.freezeMethods(AxiosHeaders$1);
|
|
14872
|
-
|
|
14873
|
-
/**
|
|
14874
|
-
* Transform the data for a request or a response
|
|
14875
|
-
*
|
|
14876
|
-
* @param {Array|Function} fns A single function or Array of functions
|
|
14877
|
-
* @param {?Object} response The response object
|
|
14878
|
-
*
|
|
14879
|
-
* @returns {*} The resulting transformed data
|
|
14880
|
-
*/
|
|
14881
|
-
function transformData(fns, response) {
|
|
14882
|
-
const config = this || defaults$1;
|
|
14883
|
-
const context = response || config;
|
|
14884
|
-
const headers = AxiosHeaders$1.from(context.headers);
|
|
14885
|
-
let data = context.data;
|
|
14886
|
-
|
|
14887
|
-
utils$1.forEach(fns, function transform(fn) {
|
|
14888
|
-
data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);
|
|
14889
|
-
});
|
|
14890
|
-
|
|
14891
|
-
headers.normalize();
|
|
14892
|
-
|
|
14893
|
-
return data;
|
|
14894
|
-
}
|
|
14895
|
-
|
|
14896
|
-
function isCancel$1(value) {
|
|
14897
|
-
return !!(value && value.__CANCEL__);
|
|
14898
|
-
}
|
|
14899
|
-
|
|
14900
|
-
/**
|
|
14901
|
-
* A `CanceledError` is an object that is thrown when an operation is canceled.
|
|
14902
|
-
*
|
|
14903
|
-
* @param {string=} message The message.
|
|
14904
|
-
* @param {Object=} config The config.
|
|
14905
|
-
* @param {Object=} request The request.
|
|
14906
|
-
*
|
|
14907
|
-
* @returns {CanceledError} The created error.
|
|
14908
|
-
*/
|
|
14909
|
-
function CanceledError$1(message, config, request) {
|
|
14910
|
-
// eslint-disable-next-line no-eq-null,eqeqeq
|
|
14911
|
-
AxiosError$1.call(this, message == null ? 'canceled' : message, AxiosError$1.ERR_CANCELED, config, request);
|
|
14912
|
-
this.name = 'CanceledError';
|
|
14913
|
-
}
|
|
14914
|
-
|
|
14915
|
-
utils$1.inherits(CanceledError$1, AxiosError$1, {
|
|
14916
|
-
__CANCEL__: true
|
|
14917
|
-
});
|
|
14918
|
-
|
|
14919
|
-
/**
|
|
14920
|
-
* Resolve or reject a Promise based on response status.
|
|
14921
|
-
*
|
|
14922
|
-
* @param {Function} resolve A function that resolves the promise.
|
|
14923
|
-
* @param {Function} reject A function that rejects the promise.
|
|
14924
|
-
* @param {object} response The response.
|
|
14925
|
-
*
|
|
14926
|
-
* @returns {object} The response.
|
|
14927
|
-
*/
|
|
14928
|
-
function settle(resolve, reject, response) {
|
|
14929
|
-
const validateStatus = response.config.validateStatus;
|
|
14930
|
-
if (!response.status || !validateStatus || validateStatus(response.status)) {
|
|
14931
|
-
resolve(response);
|
|
14932
|
-
} else {
|
|
14933
|
-
reject(new AxiosError$1(
|
|
14934
|
-
'Request failed with status code ' + response.status,
|
|
14935
|
-
[AxiosError$1.ERR_BAD_REQUEST, AxiosError$1.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
|
|
14936
|
-
response.config,
|
|
14937
|
-
response.request,
|
|
14938
|
-
response
|
|
14939
|
-
));
|
|
14940
|
-
}
|
|
14941
|
-
}
|
|
14942
|
-
|
|
14943
|
-
function parseProtocol(url) {
|
|
14944
|
-
const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
|
|
14945
|
-
return match && match[1] || '';
|
|
14946
|
-
}
|
|
14947
|
-
|
|
14948
|
-
/**
|
|
14949
|
-
* Calculate data maxRate
|
|
14950
|
-
* @param {Number} [samplesCount= 10]
|
|
14951
|
-
* @param {Number} [min= 1000]
|
|
14952
|
-
* @returns {Function}
|
|
14953
|
-
*/
|
|
14954
|
-
function speedometer(samplesCount, min) {
|
|
14955
|
-
samplesCount = samplesCount || 10;
|
|
14956
|
-
const bytes = new Array(samplesCount);
|
|
14957
|
-
const timestamps = new Array(samplesCount);
|
|
14958
|
-
let head = 0;
|
|
14959
|
-
let tail = 0;
|
|
14960
|
-
let firstSampleTS;
|
|
14961
|
-
|
|
14962
|
-
min = min !== undefined ? min : 1000;
|
|
14963
|
-
|
|
14964
|
-
return function push(chunkLength) {
|
|
14965
|
-
const now = Date.now();
|
|
14966
|
-
|
|
14967
|
-
const startedAt = timestamps[tail];
|
|
14968
|
-
|
|
14969
|
-
if (!firstSampleTS) {
|
|
14970
|
-
firstSampleTS = now;
|
|
14971
|
-
}
|
|
14972
|
-
|
|
14973
|
-
bytes[head] = chunkLength;
|
|
14974
|
-
timestamps[head] = now;
|
|
14975
|
-
|
|
14976
|
-
let i = tail;
|
|
14977
|
-
let bytesCount = 0;
|
|
14978
|
-
|
|
14979
|
-
while (i !== head) {
|
|
14980
|
-
bytesCount += bytes[i++];
|
|
14981
|
-
i = i % samplesCount;
|
|
14982
|
-
}
|
|
14983
|
-
|
|
14984
|
-
head = (head + 1) % samplesCount;
|
|
14985
|
-
|
|
14986
|
-
if (head === tail) {
|
|
14987
|
-
tail = (tail + 1) % samplesCount;
|
|
14988
|
-
}
|
|
14989
|
-
|
|
14990
|
-
if (now - firstSampleTS < min) {
|
|
14991
|
-
return;
|
|
14992
|
-
}
|
|
14993
|
-
|
|
14994
|
-
const passed = startedAt && now - startedAt;
|
|
14995
|
-
|
|
14996
|
-
return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
|
|
14997
|
-
};
|
|
14998
|
-
}
|
|
14999
|
-
|
|
15000
|
-
/**
|
|
15001
|
-
* Throttle decorator
|
|
15002
|
-
* @param {Function} fn
|
|
15003
|
-
* @param {Number} freq
|
|
15004
|
-
* @return {Function}
|
|
15005
|
-
*/
|
|
15006
|
-
function throttle(fn, freq) {
|
|
15007
|
-
let timestamp = 0;
|
|
15008
|
-
let threshold = 1000 / freq;
|
|
15009
|
-
let lastArgs;
|
|
15010
|
-
let timer;
|
|
15011
|
-
|
|
15012
|
-
const invoke = (args, now = Date.now()) => {
|
|
15013
|
-
timestamp = now;
|
|
15014
|
-
lastArgs = null;
|
|
15015
|
-
if (timer) {
|
|
15016
|
-
clearTimeout(timer);
|
|
15017
|
-
timer = null;
|
|
15018
|
-
}
|
|
15019
|
-
fn(...args);
|
|
15020
|
-
};
|
|
15021
|
-
|
|
15022
|
-
const throttled = (...args) => {
|
|
15023
|
-
const now = Date.now();
|
|
15024
|
-
const passed = now - timestamp;
|
|
15025
|
-
if ( passed >= threshold) {
|
|
15026
|
-
invoke(args, now);
|
|
15027
|
-
} else {
|
|
15028
|
-
lastArgs = args;
|
|
15029
|
-
if (!timer) {
|
|
15030
|
-
timer = setTimeout(() => {
|
|
15031
|
-
timer = null;
|
|
15032
|
-
invoke(lastArgs);
|
|
15033
|
-
}, threshold - passed);
|
|
15034
|
-
}
|
|
15035
|
-
}
|
|
15036
|
-
};
|
|
15037
|
-
|
|
15038
|
-
const flush = () => lastArgs && invoke(lastArgs);
|
|
15039
|
-
|
|
15040
|
-
return [throttled, flush];
|
|
15041
|
-
}
|
|
15042
|
-
|
|
15043
|
-
const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
|
|
15044
|
-
let bytesNotified = 0;
|
|
15045
|
-
const _speedometer = speedometer(50, 250);
|
|
15046
|
-
|
|
15047
|
-
return throttle(e => {
|
|
15048
|
-
const loaded = e.loaded;
|
|
15049
|
-
const total = e.lengthComputable ? e.total : undefined;
|
|
15050
|
-
const progressBytes = loaded - bytesNotified;
|
|
15051
|
-
const rate = _speedometer(progressBytes);
|
|
15052
|
-
const inRange = loaded <= total;
|
|
15053
|
-
|
|
15054
|
-
bytesNotified = loaded;
|
|
15055
|
-
|
|
15056
|
-
const data = {
|
|
15057
|
-
loaded,
|
|
15058
|
-
total,
|
|
15059
|
-
progress: total ? (loaded / total) : undefined,
|
|
15060
|
-
bytes: progressBytes,
|
|
15061
|
-
rate: rate ? rate : undefined,
|
|
15062
|
-
estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
|
|
15063
|
-
event: e,
|
|
15064
|
-
lengthComputable: total != null,
|
|
15065
|
-
[isDownloadStream ? 'download' : 'upload']: true
|
|
15066
|
-
};
|
|
15067
|
-
|
|
15068
|
-
listener(data);
|
|
15069
|
-
}, freq);
|
|
15070
|
-
};
|
|
15071
|
-
|
|
15072
|
-
const progressEventDecorator = (total, throttled) => {
|
|
15073
|
-
const lengthComputable = total != null;
|
|
15074
|
-
|
|
15075
|
-
return [(loaded) => throttled[0]({
|
|
15076
|
-
lengthComputable,
|
|
15077
|
-
total,
|
|
15078
|
-
loaded
|
|
15079
|
-
}), throttled[1]];
|
|
15080
|
-
};
|
|
15081
|
-
|
|
15082
|
-
const asyncDecorator = (fn) => (...args) => utils$1.asap(() => fn(...args));
|
|
15083
|
-
|
|
15084
|
-
var isURLSameOrigin = platform.hasStandardBrowserEnv ? ((origin, isMSIE) => (url) => {
|
|
15085
|
-
url = new URL(url, platform.origin);
|
|
15086
|
-
|
|
15087
|
-
return (
|
|
15088
|
-
origin.protocol === url.protocol &&
|
|
15089
|
-
origin.host === url.host &&
|
|
15090
|
-
(isMSIE || origin.port === url.port)
|
|
15091
|
-
);
|
|
15092
|
-
})(
|
|
15093
|
-
new URL(platform.origin),
|
|
15094
|
-
platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)
|
|
15095
|
-
) : () => true;
|
|
15096
|
-
|
|
15097
|
-
var cookies = platform.hasStandardBrowserEnv ?
|
|
15098
|
-
|
|
15099
|
-
// Standard browser envs support document.cookie
|
|
15100
|
-
{
|
|
15101
|
-
write(name, value, expires, path, domain, secure, sameSite) {
|
|
15102
|
-
if (typeof document === 'undefined') return;
|
|
15103
|
-
|
|
15104
|
-
const cookie = [`${name}=${encodeURIComponent(value)}`];
|
|
15105
|
-
|
|
15106
|
-
if (utils$1.isNumber(expires)) {
|
|
15107
|
-
cookie.push(`expires=${new Date(expires).toUTCString()}`);
|
|
15108
|
-
}
|
|
15109
|
-
if (utils$1.isString(path)) {
|
|
15110
|
-
cookie.push(`path=${path}`);
|
|
15111
|
-
}
|
|
15112
|
-
if (utils$1.isString(domain)) {
|
|
15113
|
-
cookie.push(`domain=${domain}`);
|
|
15114
|
-
}
|
|
15115
|
-
if (secure === true) {
|
|
15116
|
-
cookie.push('secure');
|
|
15117
|
-
}
|
|
15118
|
-
if (utils$1.isString(sameSite)) {
|
|
15119
|
-
cookie.push(`SameSite=${sameSite}`);
|
|
15120
|
-
}
|
|
15121
|
-
|
|
15122
|
-
document.cookie = cookie.join('; ');
|
|
15123
|
-
},
|
|
15124
|
-
|
|
15125
|
-
read(name) {
|
|
15126
|
-
if (typeof document === 'undefined') return null;
|
|
15127
|
-
const match = document.cookie.match(new RegExp('(?:^|; )' + name + '=([^;]*)'));
|
|
15128
|
-
return match ? decodeURIComponent(match[1]) : null;
|
|
15129
|
-
},
|
|
15130
|
-
|
|
15131
|
-
remove(name) {
|
|
15132
|
-
this.write(name, '', Date.now() - 86400000, '/');
|
|
15133
|
-
}
|
|
15134
|
-
}
|
|
15135
|
-
|
|
15136
|
-
:
|
|
15137
|
-
|
|
15138
|
-
// Non-standard browser env (web workers, react-native) lack needed support.
|
|
15139
|
-
{
|
|
15140
|
-
write() {},
|
|
15141
|
-
read() {
|
|
15142
|
-
return null;
|
|
15143
|
-
},
|
|
15144
|
-
remove() {}
|
|
15145
|
-
};
|
|
15146
|
-
|
|
15147
|
-
/**
|
|
15148
|
-
* Determines whether the specified URL is absolute
|
|
15149
|
-
*
|
|
15150
|
-
* @param {string} url The URL to test
|
|
15151
|
-
*
|
|
15152
|
-
* @returns {boolean} True if the specified URL is absolute, otherwise false
|
|
15153
|
-
*/
|
|
15154
|
-
function isAbsoluteURL(url) {
|
|
15155
|
-
// A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
|
|
15156
|
-
// RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
|
|
15157
|
-
// by any combination of letters, digits, plus, period, or hyphen.
|
|
15158
|
-
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
|
|
15159
|
-
}
|
|
15160
|
-
|
|
15161
|
-
/**
|
|
15162
|
-
* Creates a new URL by combining the specified URLs
|
|
15163
|
-
*
|
|
15164
|
-
* @param {string} baseURL The base URL
|
|
15165
|
-
* @param {string} relativeURL The relative URL
|
|
15166
|
-
*
|
|
15167
|
-
* @returns {string} The combined URL
|
|
15168
|
-
*/
|
|
15169
|
-
function combineURLs(baseURL, relativeURL) {
|
|
15170
|
-
return relativeURL
|
|
15171
|
-
? baseURL.replace(/\/?\/$/, '') + '/' + relativeURL.replace(/^\/+/, '')
|
|
15172
|
-
: baseURL;
|
|
15173
|
-
}
|
|
15174
|
-
|
|
15175
|
-
/**
|
|
15176
|
-
* Creates a new URL by combining the baseURL with the requestedURL,
|
|
15177
|
-
* only when the requestedURL is not already an absolute URL.
|
|
15178
|
-
* If the requestURL is absolute, this function returns the requestedURL untouched.
|
|
15179
|
-
*
|
|
15180
|
-
* @param {string} baseURL The base URL
|
|
15181
|
-
* @param {string} requestedURL Absolute or relative URL to combine
|
|
15182
|
-
*
|
|
15183
|
-
* @returns {string} The combined full path
|
|
15184
|
-
*/
|
|
15185
|
-
function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
|
|
15186
|
-
let isRelativeUrl = !isAbsoluteURL(requestedURL);
|
|
15187
|
-
if (baseURL && (isRelativeUrl || allowAbsoluteUrls == false)) {
|
|
15188
|
-
return combineURLs(baseURL, requestedURL);
|
|
15189
|
-
}
|
|
15190
|
-
return requestedURL;
|
|
15191
|
-
}
|
|
15192
|
-
|
|
15193
|
-
const headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? { ...thing } : thing;
|
|
15194
|
-
|
|
15195
|
-
/**
|
|
15196
|
-
* Config-specific merge-function which creates a new config-object
|
|
15197
|
-
* by merging two configuration objects together.
|
|
15198
|
-
*
|
|
15199
|
-
* @param {Object} config1
|
|
15200
|
-
* @param {Object} config2
|
|
15201
|
-
*
|
|
15202
|
-
* @returns {Object} New object resulting from merging config2 to config1
|
|
15203
|
-
*/
|
|
15204
|
-
function mergeConfig$1(config1, config2) {
|
|
15205
|
-
// eslint-disable-next-line no-param-reassign
|
|
15206
|
-
config2 = config2 || {};
|
|
15207
|
-
const config = {};
|
|
15208
|
-
|
|
15209
|
-
function getMergedValue(target, source, prop, caseless) {
|
|
15210
|
-
if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
|
|
15211
|
-
return utils$1.merge.call({caseless}, target, source);
|
|
15212
|
-
} else if (utils$1.isPlainObject(source)) {
|
|
15213
|
-
return utils$1.merge({}, source);
|
|
15214
|
-
} else if (utils$1.isArray(source)) {
|
|
15215
|
-
return source.slice();
|
|
15216
|
-
}
|
|
15217
|
-
return source;
|
|
15218
|
-
}
|
|
15219
|
-
|
|
15220
|
-
// eslint-disable-next-line consistent-return
|
|
15221
|
-
function mergeDeepProperties(a, b, prop, caseless) {
|
|
15222
|
-
if (!utils$1.isUndefined(b)) {
|
|
15223
|
-
return getMergedValue(a, b, prop, caseless);
|
|
15224
|
-
} else if (!utils$1.isUndefined(a)) {
|
|
15225
|
-
return getMergedValue(undefined, a, prop, caseless);
|
|
15226
|
-
}
|
|
15227
|
-
}
|
|
15228
|
-
|
|
15229
|
-
// eslint-disable-next-line consistent-return
|
|
15230
|
-
function valueFromConfig2(a, b) {
|
|
15231
|
-
if (!utils$1.isUndefined(b)) {
|
|
15232
|
-
return getMergedValue(undefined, b);
|
|
15233
|
-
}
|
|
15234
|
-
}
|
|
15235
|
-
|
|
15236
|
-
// eslint-disable-next-line consistent-return
|
|
15237
|
-
function defaultToConfig2(a, b) {
|
|
15238
|
-
if (!utils$1.isUndefined(b)) {
|
|
15239
|
-
return getMergedValue(undefined, b);
|
|
15240
|
-
} else if (!utils$1.isUndefined(a)) {
|
|
15241
|
-
return getMergedValue(undefined, a);
|
|
15242
|
-
}
|
|
15243
|
-
}
|
|
15244
|
-
|
|
15245
|
-
// eslint-disable-next-line consistent-return
|
|
15246
|
-
function mergeDirectKeys(a, b, prop) {
|
|
15247
|
-
if (prop in config2) {
|
|
15248
|
-
return getMergedValue(a, b);
|
|
15249
|
-
} else if (prop in config1) {
|
|
15250
|
-
return getMergedValue(undefined, a);
|
|
15251
|
-
}
|
|
15252
|
-
}
|
|
15253
|
-
|
|
15254
|
-
const mergeMap = {
|
|
15255
|
-
url: valueFromConfig2,
|
|
15256
|
-
method: valueFromConfig2,
|
|
15257
|
-
data: valueFromConfig2,
|
|
15258
|
-
baseURL: defaultToConfig2,
|
|
15259
|
-
transformRequest: defaultToConfig2,
|
|
15260
|
-
transformResponse: defaultToConfig2,
|
|
15261
|
-
paramsSerializer: defaultToConfig2,
|
|
15262
|
-
timeout: defaultToConfig2,
|
|
15263
|
-
timeoutMessage: defaultToConfig2,
|
|
15264
|
-
withCredentials: defaultToConfig2,
|
|
15265
|
-
withXSRFToken: defaultToConfig2,
|
|
15266
|
-
adapter: defaultToConfig2,
|
|
15267
|
-
responseType: defaultToConfig2,
|
|
15268
|
-
xsrfCookieName: defaultToConfig2,
|
|
15269
|
-
xsrfHeaderName: defaultToConfig2,
|
|
15270
|
-
onUploadProgress: defaultToConfig2,
|
|
15271
|
-
onDownloadProgress: defaultToConfig2,
|
|
15272
|
-
decompress: defaultToConfig2,
|
|
15273
|
-
maxContentLength: defaultToConfig2,
|
|
15274
|
-
maxBodyLength: defaultToConfig2,
|
|
15275
|
-
beforeRedirect: defaultToConfig2,
|
|
15276
|
-
transport: defaultToConfig2,
|
|
15277
|
-
httpAgent: defaultToConfig2,
|
|
15278
|
-
httpsAgent: defaultToConfig2,
|
|
15279
|
-
cancelToken: defaultToConfig2,
|
|
15280
|
-
socketPath: defaultToConfig2,
|
|
15281
|
-
responseEncoding: defaultToConfig2,
|
|
15282
|
-
validateStatus: mergeDirectKeys,
|
|
15283
|
-
headers: (a, b, prop) => mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true)
|
|
15284
|
-
};
|
|
15285
|
-
|
|
15286
|
-
utils$1.forEach(Object.keys({...config1, ...config2}), function computeConfigValue(prop) {
|
|
15287
|
-
const merge = mergeMap[prop] || mergeDeepProperties;
|
|
15288
|
-
const configValue = merge(config1[prop], config2[prop], prop);
|
|
15289
|
-
(utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
|
15290
|
-
});
|
|
15291
|
-
|
|
15292
|
-
return config;
|
|
15293
|
-
}
|
|
15294
|
-
|
|
15295
|
-
var resolveConfig = (config) => {
|
|
15296
|
-
const newConfig = mergeConfig$1({}, config);
|
|
15297
|
-
|
|
15298
|
-
let { data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth } = newConfig;
|
|
15299
|
-
|
|
15300
|
-
newConfig.headers = headers = AxiosHeaders$1.from(headers);
|
|
15301
|
-
|
|
15302
|
-
newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls), config.params, config.paramsSerializer);
|
|
15303
|
-
|
|
15304
|
-
// HTTP basic authentication
|
|
15305
|
-
if (auth) {
|
|
15306
|
-
headers.set('Authorization', 'Basic ' +
|
|
15307
|
-
btoa((auth.username || '') + ':' + (auth.password ? unescape(encodeURIComponent(auth.password)) : ''))
|
|
15308
|
-
);
|
|
15309
|
-
}
|
|
15310
|
-
|
|
15311
|
-
if (utils$1.isFormData(data)) {
|
|
15312
|
-
if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
|
|
15313
|
-
headers.setContentType(undefined); // browser handles it
|
|
15314
|
-
} else if (utils$1.isFunction(data.getHeaders)) {
|
|
15315
|
-
// Node.js FormData (like form-data package)
|
|
15316
|
-
const formHeaders = data.getHeaders();
|
|
15317
|
-
// Only set safe headers to avoid overwriting security headers
|
|
15318
|
-
const allowedHeaders = ['content-type', 'content-length'];
|
|
15319
|
-
Object.entries(formHeaders).forEach(([key, val]) => {
|
|
15320
|
-
if (allowedHeaders.includes(key.toLowerCase())) {
|
|
15321
|
-
headers.set(key, val);
|
|
15322
|
-
}
|
|
15323
|
-
});
|
|
15324
|
-
}
|
|
15325
|
-
}
|
|
15326
|
-
|
|
15327
|
-
// Add xsrf header
|
|
15328
|
-
// This is only done if running in a standard browser environment.
|
|
15329
|
-
// Specifically not if we're in a web worker, or react-native.
|
|
15330
|
-
|
|
15331
|
-
if (platform.hasStandardBrowserEnv) {
|
|
15332
|
-
withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
|
|
15333
|
-
|
|
15334
|
-
if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(newConfig.url))) {
|
|
15335
|
-
// Add xsrf header
|
|
15336
|
-
const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
|
|
15337
|
-
|
|
15338
|
-
if (xsrfValue) {
|
|
15339
|
-
headers.set(xsrfHeaderName, xsrfValue);
|
|
15340
|
-
}
|
|
15341
|
-
}
|
|
15342
|
-
}
|
|
15343
|
-
|
|
15344
|
-
return newConfig;
|
|
15345
|
-
};
|
|
15346
|
-
|
|
15347
|
-
const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
|
|
15348
|
-
|
|
15349
|
-
var xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
15350
|
-
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
|
15351
|
-
const _config = resolveConfig(config);
|
|
15352
|
-
let requestData = _config.data;
|
|
15353
|
-
const requestHeaders = AxiosHeaders$1.from(_config.headers).normalize();
|
|
15354
|
-
let {responseType, onUploadProgress, onDownloadProgress} = _config;
|
|
15355
|
-
let onCanceled;
|
|
15356
|
-
let uploadThrottled, downloadThrottled;
|
|
15357
|
-
let flushUpload, flushDownload;
|
|
15358
|
-
|
|
15359
|
-
function done() {
|
|
15360
|
-
flushUpload && flushUpload(); // flush events
|
|
15361
|
-
flushDownload && flushDownload(); // flush events
|
|
15362
|
-
|
|
15363
|
-
_config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
|
|
15364
|
-
|
|
15365
|
-
_config.signal && _config.signal.removeEventListener('abort', onCanceled);
|
|
15366
|
-
}
|
|
15367
|
-
|
|
15368
|
-
let request = new XMLHttpRequest();
|
|
15369
|
-
|
|
15370
|
-
request.open(_config.method.toUpperCase(), _config.url, true);
|
|
15371
|
-
|
|
15372
|
-
// Set the request timeout in MS
|
|
15373
|
-
request.timeout = _config.timeout;
|
|
15374
|
-
|
|
15375
|
-
function onloadend() {
|
|
15376
|
-
if (!request) {
|
|
15377
|
-
return;
|
|
15378
|
-
}
|
|
15379
|
-
// Prepare the response
|
|
15380
|
-
const responseHeaders = AxiosHeaders$1.from(
|
|
15381
|
-
'getAllResponseHeaders' in request && request.getAllResponseHeaders()
|
|
15382
|
-
);
|
|
15383
|
-
const responseData = !responseType || responseType === 'text' || responseType === 'json' ?
|
|
15384
|
-
request.responseText : request.response;
|
|
15385
|
-
const response = {
|
|
15386
|
-
data: responseData,
|
|
15387
|
-
status: request.status,
|
|
15388
|
-
statusText: request.statusText,
|
|
15389
|
-
headers: responseHeaders,
|
|
15390
|
-
config,
|
|
15391
|
-
request
|
|
15392
|
-
};
|
|
15393
|
-
|
|
15394
|
-
settle(function _resolve(value) {
|
|
15395
|
-
resolve(value);
|
|
15396
|
-
done();
|
|
15397
|
-
}, function _reject(err) {
|
|
15398
|
-
reject(err);
|
|
15399
|
-
done();
|
|
15400
|
-
}, response);
|
|
15401
|
-
|
|
15402
|
-
// Clean up request
|
|
15403
|
-
request = null;
|
|
15404
|
-
}
|
|
15405
|
-
|
|
15406
|
-
if ('onloadend' in request) {
|
|
15407
|
-
// Use onloadend if available
|
|
15408
|
-
request.onloadend = onloadend;
|
|
15409
|
-
} else {
|
|
15410
|
-
// Listen for ready state to emulate onloadend
|
|
15411
|
-
request.onreadystatechange = function handleLoad() {
|
|
15412
|
-
if (!request || request.readyState !== 4) {
|
|
15413
|
-
return;
|
|
15414
|
-
}
|
|
15415
|
-
|
|
15416
|
-
// The request errored out and we didn't get a response, this will be
|
|
15417
|
-
// handled by onerror instead
|
|
15418
|
-
// With one exception: request that using file: protocol, most browsers
|
|
15419
|
-
// will return status as 0 even though it's a successful request
|
|
15420
|
-
if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
|
|
15421
|
-
return;
|
|
15422
|
-
}
|
|
15423
|
-
// readystate handler is calling before onerror or ontimeout handlers,
|
|
15424
|
-
// so we should call onloadend on the next 'tick'
|
|
15425
|
-
setTimeout(onloadend);
|
|
15426
|
-
};
|
|
15427
|
-
}
|
|
15428
|
-
|
|
15429
|
-
// Handle browser request cancellation (as opposed to a manual cancellation)
|
|
15430
|
-
request.onabort = function handleAbort() {
|
|
15431
|
-
if (!request) {
|
|
15432
|
-
return;
|
|
15433
|
-
}
|
|
15434
|
-
|
|
15435
|
-
reject(new AxiosError$1('Request aborted', AxiosError$1.ECONNABORTED, config, request));
|
|
15436
|
-
|
|
15437
|
-
// Clean up request
|
|
15438
|
-
request = null;
|
|
15439
|
-
};
|
|
15440
|
-
|
|
15441
|
-
// Handle low level network errors
|
|
15442
|
-
request.onerror = function handleError(event) {
|
|
15443
|
-
// Browsers deliver a ProgressEvent in XHR onerror
|
|
15444
|
-
// (message may be empty; when present, surface it)
|
|
15445
|
-
// See https://developer.mozilla.org/docs/Web/API/XMLHttpRequest/error_event
|
|
15446
|
-
const msg = event && event.message ? event.message : 'Network Error';
|
|
15447
|
-
const err = new AxiosError$1(msg, AxiosError$1.ERR_NETWORK, config, request);
|
|
15448
|
-
// attach the underlying event for consumers who want details
|
|
15449
|
-
err.event = event || null;
|
|
15450
|
-
reject(err);
|
|
15451
|
-
request = null;
|
|
15452
|
-
};
|
|
15453
|
-
|
|
15454
|
-
// Handle timeout
|
|
15455
|
-
request.ontimeout = function handleTimeout() {
|
|
15456
|
-
let timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded';
|
|
15457
|
-
const transitional = _config.transitional || transitionalDefaults;
|
|
15458
|
-
if (_config.timeoutErrorMessage) {
|
|
15459
|
-
timeoutErrorMessage = _config.timeoutErrorMessage;
|
|
15460
|
-
}
|
|
15461
|
-
reject(new AxiosError$1(
|
|
15462
|
-
timeoutErrorMessage,
|
|
15463
|
-
transitional.clarifyTimeoutError ? AxiosError$1.ETIMEDOUT : AxiosError$1.ECONNABORTED,
|
|
15464
|
-
config,
|
|
15465
|
-
request));
|
|
15466
|
-
|
|
15467
|
-
// Clean up request
|
|
15468
|
-
request = null;
|
|
15469
|
-
};
|
|
15470
|
-
|
|
15471
|
-
// Remove Content-Type if data is undefined
|
|
15472
|
-
requestData === undefined && requestHeaders.setContentType(null);
|
|
15473
|
-
|
|
15474
|
-
// Add headers to the request
|
|
15475
|
-
if ('setRequestHeader' in request) {
|
|
15476
|
-
utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
|
|
15477
|
-
request.setRequestHeader(key, val);
|
|
15478
|
-
});
|
|
15479
|
-
}
|
|
15480
|
-
|
|
15481
|
-
// Add withCredentials to request if needed
|
|
15482
|
-
if (!utils$1.isUndefined(_config.withCredentials)) {
|
|
15483
|
-
request.withCredentials = !!_config.withCredentials;
|
|
15484
|
-
}
|
|
15485
|
-
|
|
15486
|
-
// Add responseType to request if needed
|
|
15487
|
-
if (responseType && responseType !== 'json') {
|
|
15488
|
-
request.responseType = _config.responseType;
|
|
15489
|
-
}
|
|
15490
|
-
|
|
15491
|
-
// Handle progress if needed
|
|
15492
|
-
if (onDownloadProgress) {
|
|
15493
|
-
([downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true));
|
|
15494
|
-
request.addEventListener('progress', downloadThrottled);
|
|
15495
|
-
}
|
|
15496
|
-
|
|
15497
|
-
// Not all browsers support upload events
|
|
15498
|
-
if (onUploadProgress && request.upload) {
|
|
15499
|
-
([uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress));
|
|
15500
|
-
|
|
15501
|
-
request.upload.addEventListener('progress', uploadThrottled);
|
|
15502
|
-
|
|
15503
|
-
request.upload.addEventListener('loadend', flushUpload);
|
|
15504
|
-
}
|
|
15505
|
-
|
|
15506
|
-
if (_config.cancelToken || _config.signal) {
|
|
15507
|
-
// Handle cancellation
|
|
15508
|
-
// eslint-disable-next-line func-names
|
|
15509
|
-
onCanceled = cancel => {
|
|
15510
|
-
if (!request) {
|
|
15511
|
-
return;
|
|
15512
|
-
}
|
|
15513
|
-
reject(!cancel || cancel.type ? new CanceledError$1(null, config, request) : cancel);
|
|
15514
|
-
request.abort();
|
|
15515
|
-
request = null;
|
|
15516
|
-
};
|
|
15517
|
-
|
|
15518
|
-
_config.cancelToken && _config.cancelToken.subscribe(onCanceled);
|
|
15519
|
-
if (_config.signal) {
|
|
15520
|
-
_config.signal.aborted ? onCanceled() : _config.signal.addEventListener('abort', onCanceled);
|
|
15521
|
-
}
|
|
15522
|
-
}
|
|
15523
|
-
|
|
15524
|
-
const protocol = parseProtocol(_config.url);
|
|
15525
|
-
|
|
15526
|
-
if (protocol && platform.protocols.indexOf(protocol) === -1) {
|
|
15527
|
-
reject(new AxiosError$1('Unsupported protocol ' + protocol + ':', AxiosError$1.ERR_BAD_REQUEST, config));
|
|
15528
|
-
return;
|
|
15529
|
-
}
|
|
15530
|
-
|
|
15531
|
-
|
|
15532
|
-
// Send the request
|
|
15533
|
-
request.send(requestData || null);
|
|
15534
|
-
});
|
|
15535
|
-
};
|
|
15536
|
-
|
|
15537
|
-
const composeSignals = (signals, timeout) => {
|
|
15538
|
-
const {length} = (signals = signals ? signals.filter(Boolean) : []);
|
|
15539
|
-
|
|
15540
|
-
if (timeout || length) {
|
|
15541
|
-
let controller = new AbortController();
|
|
15542
|
-
|
|
15543
|
-
let aborted;
|
|
15544
|
-
|
|
15545
|
-
const onabort = function (reason) {
|
|
15546
|
-
if (!aborted) {
|
|
15547
|
-
aborted = true;
|
|
15548
|
-
unsubscribe();
|
|
15549
|
-
const err = reason instanceof Error ? reason : this.reason;
|
|
15550
|
-
controller.abort(err instanceof AxiosError$1 ? err : new CanceledError$1(err instanceof Error ? err.message : err));
|
|
15551
|
-
}
|
|
15552
|
-
};
|
|
15553
|
-
|
|
15554
|
-
let timer = timeout && setTimeout(() => {
|
|
15555
|
-
timer = null;
|
|
15556
|
-
onabort(new AxiosError$1(`timeout ${timeout} of ms exceeded`, AxiosError$1.ETIMEDOUT));
|
|
15557
|
-
}, timeout);
|
|
15558
|
-
|
|
15559
|
-
const unsubscribe = () => {
|
|
15560
|
-
if (signals) {
|
|
15561
|
-
timer && clearTimeout(timer);
|
|
15562
|
-
timer = null;
|
|
15563
|
-
signals.forEach(signal => {
|
|
15564
|
-
signal.unsubscribe ? signal.unsubscribe(onabort) : signal.removeEventListener('abort', onabort);
|
|
15565
|
-
});
|
|
15566
|
-
signals = null;
|
|
15567
|
-
}
|
|
15568
|
-
};
|
|
15569
|
-
|
|
15570
|
-
signals.forEach((signal) => signal.addEventListener('abort', onabort));
|
|
15571
|
-
|
|
15572
|
-
const {signal} = controller;
|
|
15573
|
-
|
|
15574
|
-
signal.unsubscribe = () => utils$1.asap(unsubscribe);
|
|
15575
|
-
|
|
15576
|
-
return signal;
|
|
15577
|
-
}
|
|
15578
|
-
};
|
|
15579
|
-
|
|
15580
|
-
const streamChunk = function* (chunk, chunkSize) {
|
|
15581
|
-
let len = chunk.byteLength;
|
|
15582
|
-
|
|
15583
|
-
if (len < chunkSize) {
|
|
15584
|
-
yield chunk;
|
|
15585
|
-
return;
|
|
15586
|
-
}
|
|
15587
|
-
|
|
15588
|
-
let pos = 0;
|
|
15589
|
-
let end;
|
|
15590
|
-
|
|
15591
|
-
while (pos < len) {
|
|
15592
|
-
end = pos + chunkSize;
|
|
15593
|
-
yield chunk.slice(pos, end);
|
|
15594
|
-
pos = end;
|
|
15595
|
-
}
|
|
15596
|
-
};
|
|
15597
|
-
|
|
15598
|
-
const readBytes = async function* (iterable, chunkSize) {
|
|
15599
|
-
for await (const chunk of readStream(iterable)) {
|
|
15600
|
-
yield* streamChunk(chunk, chunkSize);
|
|
15601
|
-
}
|
|
15602
|
-
};
|
|
15603
|
-
|
|
15604
|
-
const readStream = async function* (stream) {
|
|
15605
|
-
if (stream[Symbol.asyncIterator]) {
|
|
15606
|
-
yield* stream;
|
|
15607
|
-
return;
|
|
15608
|
-
}
|
|
15609
|
-
|
|
15610
|
-
const reader = stream.getReader();
|
|
15611
|
-
try {
|
|
15612
|
-
for (;;) {
|
|
15613
|
-
const {done, value} = await reader.read();
|
|
15614
|
-
if (done) {
|
|
15615
|
-
break;
|
|
15616
|
-
}
|
|
15617
|
-
yield value;
|
|
15618
|
-
}
|
|
15619
|
-
} finally {
|
|
15620
|
-
await reader.cancel();
|
|
15621
|
-
}
|
|
15622
|
-
};
|
|
15623
|
-
|
|
15624
|
-
const trackStream = (stream, chunkSize, onProgress, onFinish) => {
|
|
15625
|
-
const iterator = readBytes(stream, chunkSize);
|
|
15626
|
-
|
|
15627
|
-
let bytes = 0;
|
|
15628
|
-
let done;
|
|
15629
|
-
let _onFinish = (e) => {
|
|
15630
|
-
if (!done) {
|
|
15631
|
-
done = true;
|
|
15632
|
-
onFinish && onFinish(e);
|
|
15633
|
-
}
|
|
15634
|
-
};
|
|
15635
|
-
|
|
15636
|
-
return new ReadableStream({
|
|
15637
|
-
async pull(controller) {
|
|
15638
|
-
try {
|
|
15639
|
-
const {done, value} = await iterator.next();
|
|
15640
|
-
|
|
15641
|
-
if (done) {
|
|
15642
|
-
_onFinish();
|
|
15643
|
-
controller.close();
|
|
15644
|
-
return;
|
|
15645
|
-
}
|
|
15646
|
-
|
|
15647
|
-
let len = value.byteLength;
|
|
15648
|
-
if (onProgress) {
|
|
15649
|
-
let loadedBytes = bytes += len;
|
|
15650
|
-
onProgress(loadedBytes);
|
|
15651
|
-
}
|
|
15652
|
-
controller.enqueue(new Uint8Array(value));
|
|
15653
|
-
} catch (err) {
|
|
15654
|
-
_onFinish(err);
|
|
15655
|
-
throw err;
|
|
15656
|
-
}
|
|
15657
|
-
},
|
|
15658
|
-
cancel(reason) {
|
|
15659
|
-
_onFinish(reason);
|
|
15660
|
-
return iterator.return();
|
|
15661
|
-
}
|
|
15662
|
-
}, {
|
|
15663
|
-
highWaterMark: 2
|
|
15664
|
-
})
|
|
15665
|
-
};
|
|
15666
|
-
|
|
15667
|
-
const DEFAULT_CHUNK_SIZE = 64 * 1024;
|
|
15668
|
-
|
|
15669
|
-
const {isFunction: isFunction$1} = utils$1;
|
|
15670
|
-
|
|
15671
|
-
const globalFetchAPI = (({Request, Response}) => ({
|
|
15672
|
-
Request, Response
|
|
15673
|
-
}))(utils$1.global);
|
|
15674
|
-
|
|
15675
|
-
const {
|
|
15676
|
-
ReadableStream: ReadableStream$1, TextEncoder
|
|
15677
|
-
} = utils$1.global;
|
|
15678
|
-
|
|
15679
|
-
|
|
15680
|
-
const test = (fn, ...args) => {
|
|
15681
|
-
try {
|
|
15682
|
-
return !!fn(...args);
|
|
15683
|
-
} catch (e) {
|
|
15684
|
-
return false
|
|
15685
|
-
}
|
|
15686
|
-
};
|
|
15687
|
-
|
|
15688
|
-
const factory = (env) => {
|
|
15689
|
-
env = utils$1.merge.call({
|
|
15690
|
-
skipUndefined: true
|
|
15691
|
-
}, globalFetchAPI, env);
|
|
15692
|
-
|
|
15693
|
-
const {fetch: envFetch, Request, Response} = env;
|
|
15694
|
-
const isFetchSupported = envFetch ? isFunction$1(envFetch) : typeof fetch === 'function';
|
|
15695
|
-
const isRequestSupported = isFunction$1(Request);
|
|
15696
|
-
const isResponseSupported = isFunction$1(Response);
|
|
15697
|
-
|
|
15698
|
-
if (!isFetchSupported) {
|
|
15699
|
-
return false;
|
|
15700
|
-
}
|
|
15701
|
-
|
|
15702
|
-
const isReadableStreamSupported = isFetchSupported && isFunction$1(ReadableStream$1);
|
|
15703
|
-
|
|
15704
|
-
const encodeText = isFetchSupported && (typeof TextEncoder === 'function' ?
|
|
15705
|
-
((encoder) => (str) => encoder.encode(str))(new TextEncoder()) :
|
|
15706
|
-
async (str) => new Uint8Array(await new Request(str).arrayBuffer())
|
|
15707
|
-
);
|
|
15708
|
-
|
|
15709
|
-
const supportsRequestStream = isRequestSupported && isReadableStreamSupported && test(() => {
|
|
15710
|
-
let duplexAccessed = false;
|
|
15711
|
-
|
|
15712
|
-
const hasContentType = new Request(platform.origin, {
|
|
15713
|
-
body: new ReadableStream$1(),
|
|
15714
|
-
method: 'POST',
|
|
15715
|
-
get duplex() {
|
|
15716
|
-
duplexAccessed = true;
|
|
15717
|
-
return 'half';
|
|
15718
|
-
},
|
|
15719
|
-
}).headers.has('Content-Type');
|
|
15720
|
-
|
|
15721
|
-
return duplexAccessed && !hasContentType;
|
|
15722
|
-
});
|
|
15723
|
-
|
|
15724
|
-
const supportsResponseStream = isResponseSupported && isReadableStreamSupported &&
|
|
15725
|
-
test(() => utils$1.isReadableStream(new Response('').body));
|
|
15726
|
-
|
|
15727
|
-
const resolvers = {
|
|
15728
|
-
stream: supportsResponseStream && ((res) => res.body)
|
|
15729
|
-
};
|
|
15730
|
-
|
|
15731
|
-
isFetchSupported && ((() => {
|
|
15732
|
-
['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => {
|
|
15733
|
-
!resolvers[type] && (resolvers[type] = (res, config) => {
|
|
15734
|
-
let method = res && res[type];
|
|
15735
|
-
|
|
15736
|
-
if (method) {
|
|
15737
|
-
return method.call(res);
|
|
15738
|
-
}
|
|
15739
|
-
|
|
15740
|
-
throw new AxiosError$1(`Response type '${type}' is not supported`, AxiosError$1.ERR_NOT_SUPPORT, config);
|
|
15741
|
-
});
|
|
15742
|
-
});
|
|
15743
|
-
})());
|
|
15744
|
-
|
|
15745
|
-
const getBodyLength = async (body) => {
|
|
15746
|
-
if (body == null) {
|
|
15747
|
-
return 0;
|
|
15748
|
-
}
|
|
15749
|
-
|
|
15750
|
-
if (utils$1.isBlob(body)) {
|
|
15751
|
-
return body.size;
|
|
15752
|
-
}
|
|
15753
|
-
|
|
15754
|
-
if (utils$1.isSpecCompliantForm(body)) {
|
|
15755
|
-
const _request = new Request(platform.origin, {
|
|
15756
|
-
method: 'POST',
|
|
15757
|
-
body,
|
|
15758
|
-
});
|
|
15759
|
-
return (await _request.arrayBuffer()).byteLength;
|
|
15760
|
-
}
|
|
15761
|
-
|
|
15762
|
-
if (utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
|
|
15763
|
-
return body.byteLength;
|
|
15764
|
-
}
|
|
15765
|
-
|
|
15766
|
-
if (utils$1.isURLSearchParams(body)) {
|
|
15767
|
-
body = body + '';
|
|
15768
|
-
}
|
|
15769
|
-
|
|
15770
|
-
if (utils$1.isString(body)) {
|
|
15771
|
-
return (await encodeText(body)).byteLength;
|
|
15772
|
-
}
|
|
15773
|
-
};
|
|
15774
|
-
|
|
15775
|
-
const resolveBodyLength = async (headers, body) => {
|
|
15776
|
-
const length = utils$1.toFiniteNumber(headers.getContentLength());
|
|
15777
|
-
|
|
15778
|
-
return length == null ? getBodyLength(body) : length;
|
|
15779
|
-
};
|
|
15780
|
-
|
|
15781
|
-
return async (config) => {
|
|
15782
|
-
let {
|
|
15783
|
-
url,
|
|
15784
|
-
method,
|
|
15785
|
-
data,
|
|
15786
|
-
signal,
|
|
15787
|
-
cancelToken,
|
|
15788
|
-
timeout,
|
|
15789
|
-
onDownloadProgress,
|
|
15790
|
-
onUploadProgress,
|
|
15791
|
-
responseType,
|
|
15792
|
-
headers,
|
|
15793
|
-
withCredentials = 'same-origin',
|
|
15794
|
-
fetchOptions
|
|
15795
|
-
} = resolveConfig(config);
|
|
15796
|
-
|
|
15797
|
-
let _fetch = envFetch || fetch;
|
|
15798
|
-
|
|
15799
|
-
responseType = responseType ? (responseType + '').toLowerCase() : 'text';
|
|
15800
|
-
|
|
15801
|
-
let composedSignal = composeSignals([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
|
|
15802
|
-
|
|
15803
|
-
let request = null;
|
|
15804
|
-
|
|
15805
|
-
const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
|
|
15806
|
-
composedSignal.unsubscribe();
|
|
15807
|
-
});
|
|
15808
|
-
|
|
15809
|
-
let requestContentLength;
|
|
15810
|
-
|
|
15811
|
-
try {
|
|
15812
|
-
if (
|
|
15813
|
-
onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' &&
|
|
15814
|
-
(requestContentLength = await resolveBodyLength(headers, data)) !== 0
|
|
15815
|
-
) {
|
|
15816
|
-
let _request = new Request(url, {
|
|
15817
|
-
method: 'POST',
|
|
15818
|
-
body: data,
|
|
15819
|
-
duplex: "half"
|
|
15820
|
-
});
|
|
15821
|
-
|
|
15822
|
-
let contentTypeHeader;
|
|
15823
|
-
|
|
15824
|
-
if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
|
|
15825
|
-
headers.setContentType(contentTypeHeader);
|
|
15826
|
-
}
|
|
15827
|
-
|
|
15828
|
-
if (_request.body) {
|
|
15829
|
-
const [onProgress, flush] = progressEventDecorator(
|
|
15830
|
-
requestContentLength,
|
|
15831
|
-
progressEventReducer(asyncDecorator(onUploadProgress))
|
|
15832
|
-
);
|
|
15833
|
-
|
|
15834
|
-
data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
|
|
15835
|
-
}
|
|
15836
|
-
}
|
|
15837
|
-
|
|
15838
|
-
if (!utils$1.isString(withCredentials)) {
|
|
15839
|
-
withCredentials = withCredentials ? 'include' : 'omit';
|
|
15840
|
-
}
|
|
15841
|
-
|
|
15842
|
-
// Cloudflare Workers throws when credentials are defined
|
|
15843
|
-
// see https://github.com/cloudflare/workerd/issues/902
|
|
15844
|
-
const isCredentialsSupported = isRequestSupported && "credentials" in Request.prototype;
|
|
15845
|
-
|
|
15846
|
-
const resolvedOptions = {
|
|
15847
|
-
...fetchOptions,
|
|
15848
|
-
signal: composedSignal,
|
|
15849
|
-
method: method.toUpperCase(),
|
|
15850
|
-
headers: headers.normalize().toJSON(),
|
|
15851
|
-
body: data,
|
|
15852
|
-
duplex: "half",
|
|
15853
|
-
credentials: isCredentialsSupported ? withCredentials : undefined
|
|
15854
|
-
};
|
|
15855
|
-
|
|
15856
|
-
request = isRequestSupported && new Request(url, resolvedOptions);
|
|
15857
|
-
|
|
15858
|
-
let response = await (isRequestSupported ? _fetch(request, fetchOptions) : _fetch(url, resolvedOptions));
|
|
15859
|
-
|
|
15860
|
-
const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
|
|
15861
|
-
|
|
15862
|
-
if (supportsResponseStream && (onDownloadProgress || (isStreamResponse && unsubscribe))) {
|
|
15863
|
-
const options = {};
|
|
15864
|
-
|
|
15865
|
-
['status', 'statusText', 'headers'].forEach(prop => {
|
|
15866
|
-
options[prop] = response[prop];
|
|
15867
|
-
});
|
|
15868
|
-
|
|
15869
|
-
const responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
|
|
15870
|
-
|
|
15871
|
-
const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
|
|
15872
|
-
responseContentLength,
|
|
15873
|
-
progressEventReducer(asyncDecorator(onDownloadProgress), true)
|
|
15874
|
-
) || [];
|
|
15875
|
-
|
|
15876
|
-
response = new Response(
|
|
15877
|
-
trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
|
|
15878
|
-
flush && flush();
|
|
15879
|
-
unsubscribe && unsubscribe();
|
|
15880
|
-
}),
|
|
15881
|
-
options
|
|
15882
|
-
);
|
|
15883
|
-
}
|
|
15884
|
-
|
|
15885
|
-
responseType = responseType || 'text';
|
|
15886
|
-
|
|
15887
|
-
let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config);
|
|
15888
|
-
|
|
15889
|
-
!isStreamResponse && unsubscribe && unsubscribe();
|
|
15890
|
-
|
|
15891
|
-
return await new Promise((resolve, reject) => {
|
|
15892
|
-
settle(resolve, reject, {
|
|
15893
|
-
data: responseData,
|
|
15894
|
-
headers: AxiosHeaders$1.from(response.headers),
|
|
15895
|
-
status: response.status,
|
|
15896
|
-
statusText: response.statusText,
|
|
15897
|
-
config,
|
|
15898
|
-
request
|
|
15899
|
-
});
|
|
15900
|
-
})
|
|
15901
|
-
} catch (err) {
|
|
15902
|
-
unsubscribe && unsubscribe();
|
|
15903
|
-
|
|
15904
|
-
if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
|
|
15905
|
-
throw Object.assign(
|
|
15906
|
-
new AxiosError$1('Network Error', AxiosError$1.ERR_NETWORK, config, request),
|
|
15907
|
-
{
|
|
15908
|
-
cause: err.cause || err
|
|
15909
|
-
}
|
|
15910
|
-
)
|
|
15911
|
-
}
|
|
15912
|
-
|
|
15913
|
-
throw AxiosError$1.from(err, err && err.code, config, request);
|
|
15914
|
-
}
|
|
15915
|
-
}
|
|
15916
|
-
};
|
|
15917
|
-
|
|
15918
|
-
const seedCache = new Map();
|
|
15919
|
-
|
|
15920
|
-
const getFetch = (config) => {
|
|
15921
|
-
let env = (config && config.env) || {};
|
|
15922
|
-
const {fetch, Request, Response} = env;
|
|
15923
|
-
const seeds = [
|
|
15924
|
-
Request, Response, fetch
|
|
15925
|
-
];
|
|
15926
|
-
|
|
15927
|
-
let len = seeds.length, i = len,
|
|
15928
|
-
seed, target, map = seedCache;
|
|
15929
|
-
|
|
15930
|
-
while (i--) {
|
|
15931
|
-
seed = seeds[i];
|
|
15932
|
-
target = map.get(seed);
|
|
15933
|
-
|
|
15934
|
-
target === undefined && map.set(seed, target = (i ? new Map() : factory(env)));
|
|
15935
|
-
|
|
15936
|
-
map = target;
|
|
15937
|
-
}
|
|
15938
|
-
|
|
15939
|
-
return target;
|
|
15940
|
-
};
|
|
15941
|
-
|
|
15942
|
-
getFetch();
|
|
15943
|
-
|
|
15944
|
-
/**
|
|
15945
|
-
* Known adapters mapping.
|
|
15946
|
-
* Provides environment-specific adapters for Axios:
|
|
15947
|
-
* - `http` for Node.js
|
|
15948
|
-
* - `xhr` for browsers
|
|
15949
|
-
* - `fetch` for fetch API-based requests
|
|
15950
|
-
*
|
|
15951
|
-
* @type {Object<string, Function|Object>}
|
|
15952
|
-
*/
|
|
15953
|
-
const knownAdapters = {
|
|
15954
|
-
http: httpAdapter,
|
|
15955
|
-
xhr: xhrAdapter,
|
|
15956
|
-
fetch: {
|
|
15957
|
-
get: getFetch,
|
|
15958
|
-
}
|
|
15959
|
-
};
|
|
15960
|
-
|
|
15961
|
-
// Assign adapter names for easier debugging and identification
|
|
15962
|
-
utils$1.forEach(knownAdapters, (fn, value) => {
|
|
15963
|
-
if (fn) {
|
|
15964
|
-
try {
|
|
15965
|
-
Object.defineProperty(fn, 'name', { value });
|
|
15966
|
-
} catch (e) {
|
|
15967
|
-
// eslint-disable-next-line no-empty
|
|
15968
|
-
}
|
|
15969
|
-
Object.defineProperty(fn, 'adapterName', { value });
|
|
15970
|
-
}
|
|
15971
|
-
});
|
|
15972
|
-
|
|
15973
|
-
/**
|
|
15974
|
-
* Render a rejection reason string for unknown or unsupported adapters
|
|
15975
|
-
*
|
|
15976
|
-
* @param {string} reason
|
|
15977
|
-
* @returns {string}
|
|
15978
|
-
*/
|
|
15979
|
-
const renderReason = (reason) => `- ${reason}`;
|
|
15980
|
-
|
|
15981
|
-
/**
|
|
15982
|
-
* Check if the adapter is resolved (function, null, or false)
|
|
15983
|
-
*
|
|
15984
|
-
* @param {Function|null|false} adapter
|
|
15985
|
-
* @returns {boolean}
|
|
15986
|
-
*/
|
|
15987
|
-
const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false;
|
|
15988
|
-
|
|
15989
|
-
/**
|
|
15990
|
-
* Get the first suitable adapter from the provided list.
|
|
15991
|
-
* Tries each adapter in order until a supported one is found.
|
|
15992
|
-
* Throws an AxiosError if no adapter is suitable.
|
|
15993
|
-
*
|
|
15994
|
-
* @param {Array<string|Function>|string|Function} adapters - Adapter(s) by name or function.
|
|
15995
|
-
* @param {Object} config - Axios request configuration
|
|
15996
|
-
* @throws {AxiosError} If no suitable adapter is available
|
|
15997
|
-
* @returns {Function} The resolved adapter function
|
|
15998
|
-
*/
|
|
15999
|
-
function getAdapter$1(adapters, config) {
|
|
16000
|
-
adapters = utils$1.isArray(adapters) ? adapters : [adapters];
|
|
16001
|
-
|
|
16002
|
-
const { length } = adapters;
|
|
16003
|
-
let nameOrAdapter;
|
|
16004
|
-
let adapter;
|
|
16005
|
-
|
|
16006
|
-
const rejectedReasons = {};
|
|
16007
|
-
|
|
16008
|
-
for (let i = 0; i < length; i++) {
|
|
16009
|
-
nameOrAdapter = adapters[i];
|
|
16010
|
-
let id;
|
|
16011
|
-
|
|
16012
|
-
adapter = nameOrAdapter;
|
|
16013
|
-
|
|
16014
|
-
if (!isResolvedHandle(nameOrAdapter)) {
|
|
16015
|
-
adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
|
|
16016
|
-
|
|
16017
|
-
if (adapter === undefined) {
|
|
16018
|
-
throw new AxiosError$1(`Unknown adapter '${id}'`);
|
|
16019
|
-
}
|
|
16020
|
-
}
|
|
16021
|
-
|
|
16022
|
-
if (adapter && (utils$1.isFunction(adapter) || (adapter = adapter.get(config)))) {
|
|
16023
|
-
break;
|
|
16024
|
-
}
|
|
16025
|
-
|
|
16026
|
-
rejectedReasons[id || '#' + i] = adapter;
|
|
16027
|
-
}
|
|
16028
|
-
|
|
16029
|
-
if (!adapter) {
|
|
16030
|
-
const reasons = Object.entries(rejectedReasons)
|
|
16031
|
-
.map(([id, state]) => `adapter ${id} ` +
|
|
16032
|
-
(state === false ? 'is not supported by the environment' : 'is not available in the build')
|
|
16033
|
-
);
|
|
16034
|
-
|
|
16035
|
-
let s = length ?
|
|
16036
|
-
(reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0])) :
|
|
16037
|
-
'as no adapter specified';
|
|
16038
|
-
|
|
16039
|
-
throw new AxiosError$1(
|
|
16040
|
-
`There is no suitable adapter to dispatch the request ` + s,
|
|
16041
|
-
'ERR_NOT_SUPPORT'
|
|
16042
|
-
);
|
|
16043
|
-
}
|
|
16044
|
-
|
|
16045
|
-
return adapter;
|
|
16046
|
-
}
|
|
16047
|
-
|
|
16048
|
-
/**
|
|
16049
|
-
* Exports Axios adapters and utility to resolve an adapter
|
|
16050
|
-
*/
|
|
16051
|
-
var adapters = {
|
|
16052
|
-
/**
|
|
16053
|
-
* Resolve an adapter from a list of adapter names or functions.
|
|
16054
|
-
* @type {Function}
|
|
16055
|
-
*/
|
|
16056
|
-
getAdapter: getAdapter$1,
|
|
16057
|
-
|
|
16058
|
-
/**
|
|
16059
|
-
* Exposes all known adapters
|
|
16060
|
-
* @type {Object<string, Function|Object>}
|
|
16061
|
-
*/
|
|
16062
|
-
adapters: knownAdapters
|
|
16063
|
-
};
|
|
16064
|
-
|
|
16065
|
-
/**
|
|
16066
|
-
* Throws a `CanceledError` if cancellation has been requested.
|
|
16067
|
-
*
|
|
16068
|
-
* @param {Object} config The config that is to be used for the request
|
|
16069
|
-
*
|
|
16070
|
-
* @returns {void}
|
|
16071
|
-
*/
|
|
16072
|
-
function throwIfCancellationRequested(config) {
|
|
16073
|
-
if (config.cancelToken) {
|
|
16074
|
-
config.cancelToken.throwIfRequested();
|
|
16075
|
-
}
|
|
16076
|
-
|
|
16077
|
-
if (config.signal && config.signal.aborted) {
|
|
16078
|
-
throw new CanceledError$1(null, config);
|
|
16079
|
-
}
|
|
16080
|
-
}
|
|
16081
|
-
|
|
16082
|
-
/**
|
|
16083
|
-
* Dispatch a request to the server using the configured adapter.
|
|
16084
|
-
*
|
|
16085
|
-
* @param {object} config The config that is to be used for the request
|
|
16086
|
-
*
|
|
16087
|
-
* @returns {Promise} The Promise to be fulfilled
|
|
16088
|
-
*/
|
|
16089
|
-
function dispatchRequest(config) {
|
|
16090
|
-
throwIfCancellationRequested(config);
|
|
16091
|
-
|
|
16092
|
-
config.headers = AxiosHeaders$1.from(config.headers);
|
|
16093
|
-
|
|
16094
|
-
// Transform request data
|
|
16095
|
-
config.data = transformData.call(
|
|
16096
|
-
config,
|
|
16097
|
-
config.transformRequest
|
|
16098
|
-
);
|
|
16099
|
-
|
|
16100
|
-
if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {
|
|
16101
|
-
config.headers.setContentType('application/x-www-form-urlencoded', false);
|
|
16102
|
-
}
|
|
16103
|
-
|
|
16104
|
-
const adapter = adapters.getAdapter(config.adapter || defaults$1.adapter, config);
|
|
16105
|
-
|
|
16106
|
-
return adapter(config).then(function onAdapterResolution(response) {
|
|
16107
|
-
throwIfCancellationRequested(config);
|
|
16108
|
-
|
|
16109
|
-
// Transform response data
|
|
16110
|
-
response.data = transformData.call(
|
|
16111
|
-
config,
|
|
16112
|
-
config.transformResponse,
|
|
16113
|
-
response
|
|
16114
|
-
);
|
|
16115
|
-
|
|
16116
|
-
response.headers = AxiosHeaders$1.from(response.headers);
|
|
16117
|
-
|
|
16118
|
-
return response;
|
|
16119
|
-
}, function onAdapterRejection(reason) {
|
|
16120
|
-
if (!isCancel$1(reason)) {
|
|
16121
|
-
throwIfCancellationRequested(config);
|
|
16122
|
-
|
|
16123
|
-
// Transform response data
|
|
16124
|
-
if (reason && reason.response) {
|
|
16125
|
-
reason.response.data = transformData.call(
|
|
16126
|
-
config,
|
|
16127
|
-
config.transformResponse,
|
|
16128
|
-
reason.response
|
|
16129
|
-
);
|
|
16130
|
-
reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
|
|
16131
|
-
}
|
|
16132
|
-
}
|
|
16133
|
-
|
|
16134
|
-
return Promise.reject(reason);
|
|
16135
|
-
});
|
|
16136
|
-
}
|
|
16137
|
-
|
|
16138
|
-
const VERSION$1 = "1.13.2";
|
|
16139
|
-
|
|
16140
|
-
const validators$1 = {};
|
|
16141
|
-
|
|
16142
|
-
// eslint-disable-next-line func-names
|
|
16143
|
-
['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach((type, i) => {
|
|
16144
|
-
validators$1[type] = function validator(thing) {
|
|
16145
|
-
return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type;
|
|
16146
|
-
};
|
|
16147
|
-
});
|
|
16148
|
-
|
|
16149
|
-
const deprecatedWarnings = {};
|
|
16150
|
-
|
|
16151
|
-
/**
|
|
16152
|
-
* Transitional option validator
|
|
16153
|
-
*
|
|
16154
|
-
* @param {function|boolean?} validator - set to false if the transitional option has been removed
|
|
16155
|
-
* @param {string?} version - deprecated version / removed since version
|
|
16156
|
-
* @param {string?} message - some message with additional info
|
|
16157
|
-
*
|
|
16158
|
-
* @returns {function}
|
|
16159
|
-
*/
|
|
16160
|
-
validators$1.transitional = function transitional(validator, version, message) {
|
|
16161
|
-
function formatMessage(opt, desc) {
|
|
16162
|
-
return '[Axios v' + VERSION$1 + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : '');
|
|
16163
|
-
}
|
|
16164
|
-
|
|
16165
|
-
// eslint-disable-next-line func-names
|
|
16166
|
-
return (value, opt, opts) => {
|
|
16167
|
-
if (validator === false) {
|
|
16168
|
-
throw new AxiosError$1(
|
|
16169
|
-
formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')),
|
|
16170
|
-
AxiosError$1.ERR_DEPRECATED
|
|
16171
|
-
);
|
|
16172
|
-
}
|
|
16173
|
-
|
|
16174
|
-
if (version && !deprecatedWarnings[opt]) {
|
|
16175
|
-
deprecatedWarnings[opt] = true;
|
|
16176
|
-
// eslint-disable-next-line no-console
|
|
16177
|
-
console.warn(
|
|
16178
|
-
formatMessage(
|
|
16179
|
-
opt,
|
|
16180
|
-
' has been deprecated since v' + version + ' and will be removed in the near future'
|
|
16181
|
-
)
|
|
16182
|
-
);
|
|
16183
|
-
}
|
|
16184
|
-
|
|
16185
|
-
return validator ? validator(value, opt, opts) : true;
|
|
16186
|
-
};
|
|
16187
|
-
};
|
|
16188
|
-
|
|
16189
|
-
validators$1.spelling = function spelling(correctSpelling) {
|
|
16190
|
-
return (value, opt) => {
|
|
16191
|
-
// eslint-disable-next-line no-console
|
|
16192
|
-
console.warn(`${opt} is likely a misspelling of ${correctSpelling}`);
|
|
16193
|
-
return true;
|
|
16194
|
-
}
|
|
16195
|
-
};
|
|
16196
|
-
|
|
16197
|
-
/**
|
|
16198
|
-
* Assert object's properties type
|
|
16199
|
-
*
|
|
16200
|
-
* @param {object} options
|
|
16201
|
-
* @param {object} schema
|
|
16202
|
-
* @param {boolean?} allowUnknown
|
|
16203
|
-
*
|
|
16204
|
-
* @returns {object}
|
|
16205
|
-
*/
|
|
16206
|
-
|
|
16207
|
-
function assertOptions(options, schema, allowUnknown) {
|
|
16208
|
-
if (typeof options !== 'object') {
|
|
16209
|
-
throw new AxiosError$1('options must be an object', AxiosError$1.ERR_BAD_OPTION_VALUE);
|
|
16210
|
-
}
|
|
16211
|
-
const keys = Object.keys(options);
|
|
16212
|
-
let i = keys.length;
|
|
16213
|
-
while (i-- > 0) {
|
|
16214
|
-
const opt = keys[i];
|
|
16215
|
-
const validator = schema[opt];
|
|
16216
|
-
if (validator) {
|
|
16217
|
-
const value = options[opt];
|
|
16218
|
-
const result = value === undefined || validator(value, opt, options);
|
|
16219
|
-
if (result !== true) {
|
|
16220
|
-
throw new AxiosError$1('option ' + opt + ' must be ' + result, AxiosError$1.ERR_BAD_OPTION_VALUE);
|
|
16221
|
-
}
|
|
16222
|
-
continue;
|
|
16223
|
-
}
|
|
16224
|
-
if (allowUnknown !== true) {
|
|
16225
|
-
throw new AxiosError$1('Unknown option ' + opt, AxiosError$1.ERR_BAD_OPTION);
|
|
16226
|
-
}
|
|
16227
|
-
}
|
|
16228
|
-
}
|
|
16229
|
-
|
|
16230
|
-
var validator = {
|
|
16231
|
-
assertOptions,
|
|
16232
|
-
validators: validators$1
|
|
16233
|
-
};
|
|
16234
|
-
|
|
16235
|
-
const validators = validator.validators;
|
|
16236
|
-
|
|
16237
|
-
/**
|
|
16238
|
-
* Create a new instance of Axios
|
|
16239
|
-
*
|
|
16240
|
-
* @param {Object} instanceConfig The default config for the instance
|
|
16241
|
-
*
|
|
16242
|
-
* @return {Axios} A new instance of Axios
|
|
16243
|
-
*/
|
|
16244
|
-
let Axios$1 = class Axios {
|
|
16245
|
-
constructor(instanceConfig) {
|
|
16246
|
-
this.defaults = instanceConfig || {};
|
|
16247
|
-
this.interceptors = {
|
|
16248
|
-
request: new InterceptorManager(),
|
|
16249
|
-
response: new InterceptorManager()
|
|
16250
|
-
};
|
|
16251
|
-
}
|
|
16252
|
-
|
|
16253
|
-
/**
|
|
16254
|
-
* Dispatch a request
|
|
16255
|
-
*
|
|
16256
|
-
* @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
|
|
16257
|
-
* @param {?Object} config
|
|
16258
|
-
*
|
|
16259
|
-
* @returns {Promise} The Promise to be fulfilled
|
|
16260
|
-
*/
|
|
16261
|
-
async request(configOrUrl, config) {
|
|
16262
|
-
try {
|
|
16263
|
-
return await this._request(configOrUrl, config);
|
|
16264
|
-
} catch (err) {
|
|
16265
|
-
if (err instanceof Error) {
|
|
16266
|
-
let dummy = {};
|
|
16267
|
-
|
|
16268
|
-
Error.captureStackTrace ? Error.captureStackTrace(dummy) : (dummy = new Error());
|
|
16269
|
-
|
|
16270
|
-
// slice off the Error: ... line
|
|
16271
|
-
const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, '') : '';
|
|
16272
|
-
try {
|
|
16273
|
-
if (!err.stack) {
|
|
16274
|
-
err.stack = stack;
|
|
16275
|
-
// match without the 2 top stack lines
|
|
16276
|
-
} else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) {
|
|
16277
|
-
err.stack += '\n' + stack;
|
|
16278
|
-
}
|
|
16279
|
-
} catch (e) {
|
|
16280
|
-
// ignore the case where "stack" is an un-writable property
|
|
16281
|
-
}
|
|
16282
|
-
}
|
|
16283
|
-
|
|
16284
|
-
throw err;
|
|
16285
|
-
}
|
|
16286
|
-
}
|
|
16287
|
-
|
|
16288
|
-
_request(configOrUrl, config) {
|
|
16289
|
-
/*eslint no-param-reassign:0*/
|
|
16290
|
-
// Allow for axios('example/url'[, config]) a la fetch API
|
|
16291
|
-
if (typeof configOrUrl === 'string') {
|
|
16292
|
-
config = config || {};
|
|
16293
|
-
config.url = configOrUrl;
|
|
16294
|
-
} else {
|
|
16295
|
-
config = configOrUrl || {};
|
|
16296
|
-
}
|
|
16297
|
-
|
|
16298
|
-
config = mergeConfig$1(this.defaults, config);
|
|
16299
|
-
|
|
16300
|
-
const {transitional, paramsSerializer, headers} = config;
|
|
16301
|
-
|
|
16302
|
-
if (transitional !== undefined) {
|
|
16303
|
-
validator.assertOptions(transitional, {
|
|
16304
|
-
silentJSONParsing: validators.transitional(validators.boolean),
|
|
16305
|
-
forcedJSONParsing: validators.transitional(validators.boolean),
|
|
16306
|
-
clarifyTimeoutError: validators.transitional(validators.boolean)
|
|
16307
|
-
}, false);
|
|
16308
|
-
}
|
|
16309
|
-
|
|
16310
|
-
if (paramsSerializer != null) {
|
|
16311
|
-
if (utils$1.isFunction(paramsSerializer)) {
|
|
16312
|
-
config.paramsSerializer = {
|
|
16313
|
-
serialize: paramsSerializer
|
|
16314
|
-
};
|
|
16315
|
-
} else {
|
|
16316
|
-
validator.assertOptions(paramsSerializer, {
|
|
16317
|
-
encode: validators.function,
|
|
16318
|
-
serialize: validators.function
|
|
16319
|
-
}, true);
|
|
16320
|
-
}
|
|
16321
|
-
}
|
|
16322
|
-
|
|
16323
|
-
// Set config.allowAbsoluteUrls
|
|
16324
|
-
if (config.allowAbsoluteUrls !== undefined) ; else if (this.defaults.allowAbsoluteUrls !== undefined) {
|
|
16325
|
-
config.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls;
|
|
16326
|
-
} else {
|
|
16327
|
-
config.allowAbsoluteUrls = true;
|
|
16328
|
-
}
|
|
16329
|
-
|
|
16330
|
-
validator.assertOptions(config, {
|
|
16331
|
-
baseUrl: validators.spelling('baseURL'),
|
|
16332
|
-
withXsrfToken: validators.spelling('withXSRFToken')
|
|
16333
|
-
}, true);
|
|
16334
|
-
|
|
16335
|
-
// Set config.method
|
|
16336
|
-
config.method = (config.method || this.defaults.method || 'get').toLowerCase();
|
|
16337
|
-
|
|
16338
|
-
// Flatten headers
|
|
16339
|
-
let contextHeaders = headers && utils$1.merge(
|
|
16340
|
-
headers.common,
|
|
16341
|
-
headers[config.method]
|
|
16342
|
-
);
|
|
16343
|
-
|
|
16344
|
-
headers && utils$1.forEach(
|
|
16345
|
-
['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
|
|
16346
|
-
(method) => {
|
|
16347
|
-
delete headers[method];
|
|
16348
|
-
}
|
|
16349
|
-
);
|
|
16350
|
-
|
|
16351
|
-
config.headers = AxiosHeaders$1.concat(contextHeaders, headers);
|
|
16352
|
-
|
|
16353
|
-
// filter out skipped interceptors
|
|
16354
|
-
const requestInterceptorChain = [];
|
|
16355
|
-
let synchronousRequestInterceptors = true;
|
|
16356
|
-
this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
|
|
16357
|
-
if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {
|
|
16358
|
-
return;
|
|
16359
|
-
}
|
|
16360
|
-
|
|
16361
|
-
synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
|
|
16362
|
-
|
|
16363
|
-
requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
|
|
16364
|
-
});
|
|
16365
|
-
|
|
16366
|
-
const responseInterceptorChain = [];
|
|
16367
|
-
this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
|
|
16368
|
-
responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
|
|
16369
|
-
});
|
|
16370
|
-
|
|
16371
|
-
let promise;
|
|
16372
|
-
let i = 0;
|
|
16373
|
-
let len;
|
|
16374
|
-
|
|
16375
|
-
if (!synchronousRequestInterceptors) {
|
|
16376
|
-
const chain = [dispatchRequest.bind(this), undefined];
|
|
16377
|
-
chain.unshift(...requestInterceptorChain);
|
|
16378
|
-
chain.push(...responseInterceptorChain);
|
|
16379
|
-
len = chain.length;
|
|
16380
|
-
|
|
16381
|
-
promise = Promise.resolve(config);
|
|
16382
|
-
|
|
16383
|
-
while (i < len) {
|
|
16384
|
-
promise = promise.then(chain[i++], chain[i++]);
|
|
16385
|
-
}
|
|
16386
|
-
|
|
16387
|
-
return promise;
|
|
16388
|
-
}
|
|
16389
|
-
|
|
16390
|
-
len = requestInterceptorChain.length;
|
|
16391
|
-
|
|
16392
|
-
let newConfig = config;
|
|
16393
|
-
|
|
16394
|
-
while (i < len) {
|
|
16395
|
-
const onFulfilled = requestInterceptorChain[i++];
|
|
16396
|
-
const onRejected = requestInterceptorChain[i++];
|
|
16397
|
-
try {
|
|
16398
|
-
newConfig = onFulfilled(newConfig);
|
|
16399
|
-
} catch (error) {
|
|
16400
|
-
onRejected.call(this, error);
|
|
16401
|
-
break;
|
|
16402
|
-
}
|
|
16403
|
-
}
|
|
16404
|
-
|
|
16405
|
-
try {
|
|
16406
|
-
promise = dispatchRequest.call(this, newConfig);
|
|
16407
|
-
} catch (error) {
|
|
16408
|
-
return Promise.reject(error);
|
|
16409
|
-
}
|
|
16410
|
-
|
|
16411
|
-
i = 0;
|
|
16412
|
-
len = responseInterceptorChain.length;
|
|
16413
|
-
|
|
16414
|
-
while (i < len) {
|
|
16415
|
-
promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);
|
|
16416
|
-
}
|
|
16417
|
-
|
|
16418
|
-
return promise;
|
|
16419
|
-
}
|
|
16420
|
-
|
|
16421
|
-
getUri(config) {
|
|
16422
|
-
config = mergeConfig$1(this.defaults, config);
|
|
16423
|
-
const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
|
|
16424
|
-
return buildURL(fullPath, config.params, config.paramsSerializer);
|
|
16425
|
-
}
|
|
16426
|
-
};
|
|
16427
|
-
|
|
16428
|
-
// Provide aliases for supported request methods
|
|
16429
|
-
utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
|
|
16430
|
-
/*eslint func-names:0*/
|
|
16431
|
-
Axios$1.prototype[method] = function(url, config) {
|
|
16432
|
-
return this.request(mergeConfig$1(config || {}, {
|
|
16433
|
-
method,
|
|
16434
|
-
url,
|
|
16435
|
-
data: (config || {}).data
|
|
16436
|
-
}));
|
|
16437
|
-
};
|
|
16438
|
-
});
|
|
16439
|
-
|
|
16440
|
-
utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
|
16441
|
-
/*eslint func-names:0*/
|
|
16442
|
-
|
|
16443
|
-
function generateHTTPMethod(isForm) {
|
|
16444
|
-
return function httpMethod(url, data, config) {
|
|
16445
|
-
return this.request(mergeConfig$1(config || {}, {
|
|
16446
|
-
method,
|
|
16447
|
-
headers: isForm ? {
|
|
16448
|
-
'Content-Type': 'multipart/form-data'
|
|
16449
|
-
} : {},
|
|
16450
|
-
url,
|
|
16451
|
-
data
|
|
16452
|
-
}));
|
|
16453
|
-
};
|
|
16454
|
-
}
|
|
16455
|
-
|
|
16456
|
-
Axios$1.prototype[method] = generateHTTPMethod();
|
|
16457
|
-
|
|
16458
|
-
Axios$1.prototype[method + 'Form'] = generateHTTPMethod(true);
|
|
16459
|
-
});
|
|
16460
|
-
|
|
16461
|
-
/**
|
|
16462
|
-
* A `CancelToken` is an object that can be used to request cancellation of an operation.
|
|
16463
|
-
*
|
|
16464
|
-
* @param {Function} executor The executor function.
|
|
16465
|
-
*
|
|
16466
|
-
* @returns {CancelToken}
|
|
16467
|
-
*/
|
|
16468
|
-
let CancelToken$1 = class CancelToken {
|
|
16469
|
-
constructor(executor) {
|
|
16470
|
-
if (typeof executor !== 'function') {
|
|
16471
|
-
throw new TypeError('executor must be a function.');
|
|
16472
|
-
}
|
|
16473
|
-
|
|
16474
|
-
let resolvePromise;
|
|
16475
|
-
|
|
16476
|
-
this.promise = new Promise(function promiseExecutor(resolve) {
|
|
16477
|
-
resolvePromise = resolve;
|
|
16478
|
-
});
|
|
16479
|
-
|
|
16480
|
-
const token = this;
|
|
16481
|
-
|
|
16482
|
-
// eslint-disable-next-line func-names
|
|
16483
|
-
this.promise.then(cancel => {
|
|
16484
|
-
if (!token._listeners) return;
|
|
16485
|
-
|
|
16486
|
-
let i = token._listeners.length;
|
|
16487
|
-
|
|
16488
|
-
while (i-- > 0) {
|
|
16489
|
-
token._listeners[i](cancel);
|
|
16490
|
-
}
|
|
16491
|
-
token._listeners = null;
|
|
16492
|
-
});
|
|
16493
|
-
|
|
16494
|
-
// eslint-disable-next-line func-names
|
|
16495
|
-
this.promise.then = onfulfilled => {
|
|
16496
|
-
let _resolve;
|
|
16497
|
-
// eslint-disable-next-line func-names
|
|
16498
|
-
const promise = new Promise(resolve => {
|
|
16499
|
-
token.subscribe(resolve);
|
|
16500
|
-
_resolve = resolve;
|
|
16501
|
-
}).then(onfulfilled);
|
|
16502
|
-
|
|
16503
|
-
promise.cancel = function reject() {
|
|
16504
|
-
token.unsubscribe(_resolve);
|
|
16505
|
-
};
|
|
16506
|
-
|
|
16507
|
-
return promise;
|
|
16508
|
-
};
|
|
16509
|
-
|
|
16510
|
-
executor(function cancel(message, config, request) {
|
|
16511
|
-
if (token.reason) {
|
|
16512
|
-
// Cancellation has already been requested
|
|
16513
|
-
return;
|
|
16514
|
-
}
|
|
16515
|
-
|
|
16516
|
-
token.reason = new CanceledError$1(message, config, request);
|
|
16517
|
-
resolvePromise(token.reason);
|
|
16518
|
-
});
|
|
16519
|
-
}
|
|
16520
|
-
|
|
16521
|
-
/**
|
|
16522
|
-
* Throws a `CanceledError` if cancellation has been requested.
|
|
16523
|
-
*/
|
|
16524
|
-
throwIfRequested() {
|
|
16525
|
-
if (this.reason) {
|
|
16526
|
-
throw this.reason;
|
|
16527
|
-
}
|
|
16528
|
-
}
|
|
16529
|
-
|
|
16530
|
-
/**
|
|
16531
|
-
* Subscribe to the cancel signal
|
|
16532
|
-
*/
|
|
16533
|
-
|
|
16534
|
-
subscribe(listener) {
|
|
16535
|
-
if (this.reason) {
|
|
16536
|
-
listener(this.reason);
|
|
16537
|
-
return;
|
|
16538
|
-
}
|
|
16539
|
-
|
|
16540
|
-
if (this._listeners) {
|
|
16541
|
-
this._listeners.push(listener);
|
|
16542
|
-
} else {
|
|
16543
|
-
this._listeners = [listener];
|
|
16544
|
-
}
|
|
16545
|
-
}
|
|
16546
|
-
|
|
16547
|
-
/**
|
|
16548
|
-
* Unsubscribe from the cancel signal
|
|
16549
|
-
*/
|
|
16550
|
-
|
|
16551
|
-
unsubscribe(listener) {
|
|
16552
|
-
if (!this._listeners) {
|
|
16553
|
-
return;
|
|
16554
|
-
}
|
|
16555
|
-
const index = this._listeners.indexOf(listener);
|
|
16556
|
-
if (index !== -1) {
|
|
16557
|
-
this._listeners.splice(index, 1);
|
|
16558
|
-
}
|
|
16559
|
-
}
|
|
16560
|
-
|
|
16561
|
-
toAbortSignal() {
|
|
16562
|
-
const controller = new AbortController();
|
|
16563
|
-
|
|
16564
|
-
const abort = (err) => {
|
|
16565
|
-
controller.abort(err);
|
|
16566
|
-
};
|
|
16567
|
-
|
|
16568
|
-
this.subscribe(abort);
|
|
16569
|
-
|
|
16570
|
-
controller.signal.unsubscribe = () => this.unsubscribe(abort);
|
|
16571
|
-
|
|
16572
|
-
return controller.signal;
|
|
16573
|
-
}
|
|
16574
|
-
|
|
16575
|
-
/**
|
|
16576
|
-
* Returns an object that contains a new `CancelToken` and a function that, when called,
|
|
16577
|
-
* cancels the `CancelToken`.
|
|
16578
|
-
*/
|
|
16579
|
-
static source() {
|
|
16580
|
-
let cancel;
|
|
16581
|
-
const token = new CancelToken(function executor(c) {
|
|
16582
|
-
cancel = c;
|
|
16583
|
-
});
|
|
16584
|
-
return {
|
|
16585
|
-
token,
|
|
16586
|
-
cancel
|
|
16587
|
-
};
|
|
16588
|
-
}
|
|
16589
|
-
};
|
|
16590
|
-
|
|
16591
|
-
/**
|
|
16592
|
-
* Syntactic sugar for invoking a function and expanding an array for arguments.
|
|
16593
|
-
*
|
|
16594
|
-
* Common use case would be to use `Function.prototype.apply`.
|
|
16595
|
-
*
|
|
16596
|
-
* ```js
|
|
16597
|
-
* function f(x, y, z) {}
|
|
16598
|
-
* var args = [1, 2, 3];
|
|
16599
|
-
* f.apply(null, args);
|
|
16600
|
-
* ```
|
|
16601
|
-
*
|
|
16602
|
-
* With `spread` this example can be re-written.
|
|
16603
|
-
*
|
|
16604
|
-
* ```js
|
|
16605
|
-
* spread(function(x, y, z) {})([1, 2, 3]);
|
|
16606
|
-
* ```
|
|
16607
|
-
*
|
|
16608
|
-
* @param {Function} callback
|
|
16609
|
-
*
|
|
16610
|
-
* @returns {Function}
|
|
16611
|
-
*/
|
|
16612
|
-
function spread$1(callback) {
|
|
16613
|
-
return function wrap(arr) {
|
|
16614
|
-
return callback.apply(null, arr);
|
|
16615
|
-
};
|
|
16616
|
-
}
|
|
16617
|
-
|
|
16618
|
-
/**
|
|
16619
|
-
* Determines whether the payload is an error thrown by Axios
|
|
16620
|
-
*
|
|
16621
|
-
* @param {*} payload The value to test
|
|
16622
|
-
*
|
|
16623
|
-
* @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
|
|
16624
|
-
*/
|
|
16625
|
-
function isAxiosError$1(payload) {
|
|
16626
|
-
return utils$1.isObject(payload) && (payload.isAxiosError === true);
|
|
16627
|
-
}
|
|
16628
|
-
|
|
16629
|
-
const HttpStatusCode$1 = {
|
|
16630
|
-
Continue: 100,
|
|
16631
|
-
SwitchingProtocols: 101,
|
|
16632
|
-
Processing: 102,
|
|
16633
|
-
EarlyHints: 103,
|
|
16634
|
-
Ok: 200,
|
|
16635
|
-
Created: 201,
|
|
16636
|
-
Accepted: 202,
|
|
16637
|
-
NonAuthoritativeInformation: 203,
|
|
16638
|
-
NoContent: 204,
|
|
16639
|
-
ResetContent: 205,
|
|
16640
|
-
PartialContent: 206,
|
|
16641
|
-
MultiStatus: 207,
|
|
16642
|
-
AlreadyReported: 208,
|
|
16643
|
-
ImUsed: 226,
|
|
16644
|
-
MultipleChoices: 300,
|
|
16645
|
-
MovedPermanently: 301,
|
|
16646
|
-
Found: 302,
|
|
16647
|
-
SeeOther: 303,
|
|
16648
|
-
NotModified: 304,
|
|
16649
|
-
UseProxy: 305,
|
|
16650
|
-
Unused: 306,
|
|
16651
|
-
TemporaryRedirect: 307,
|
|
16652
|
-
PermanentRedirect: 308,
|
|
16653
|
-
BadRequest: 400,
|
|
16654
|
-
Unauthorized: 401,
|
|
16655
|
-
PaymentRequired: 402,
|
|
16656
|
-
Forbidden: 403,
|
|
16657
|
-
NotFound: 404,
|
|
16658
|
-
MethodNotAllowed: 405,
|
|
16659
|
-
NotAcceptable: 406,
|
|
16660
|
-
ProxyAuthenticationRequired: 407,
|
|
16661
|
-
RequestTimeout: 408,
|
|
16662
|
-
Conflict: 409,
|
|
16663
|
-
Gone: 410,
|
|
16664
|
-
LengthRequired: 411,
|
|
16665
|
-
PreconditionFailed: 412,
|
|
16666
|
-
PayloadTooLarge: 413,
|
|
16667
|
-
UriTooLong: 414,
|
|
16668
|
-
UnsupportedMediaType: 415,
|
|
16669
|
-
RangeNotSatisfiable: 416,
|
|
16670
|
-
ExpectationFailed: 417,
|
|
16671
|
-
ImATeapot: 418,
|
|
16672
|
-
MisdirectedRequest: 421,
|
|
16673
|
-
UnprocessableEntity: 422,
|
|
16674
|
-
Locked: 423,
|
|
16675
|
-
FailedDependency: 424,
|
|
16676
|
-
TooEarly: 425,
|
|
16677
|
-
UpgradeRequired: 426,
|
|
16678
|
-
PreconditionRequired: 428,
|
|
16679
|
-
TooManyRequests: 429,
|
|
16680
|
-
RequestHeaderFieldsTooLarge: 431,
|
|
16681
|
-
UnavailableForLegalReasons: 451,
|
|
16682
|
-
InternalServerError: 500,
|
|
16683
|
-
NotImplemented: 501,
|
|
16684
|
-
BadGateway: 502,
|
|
16685
|
-
ServiceUnavailable: 503,
|
|
16686
|
-
GatewayTimeout: 504,
|
|
16687
|
-
HttpVersionNotSupported: 505,
|
|
16688
|
-
VariantAlsoNegotiates: 506,
|
|
16689
|
-
InsufficientStorage: 507,
|
|
16690
|
-
LoopDetected: 508,
|
|
16691
|
-
NotExtended: 510,
|
|
16692
|
-
NetworkAuthenticationRequired: 511,
|
|
16693
|
-
WebServerIsDown: 521,
|
|
16694
|
-
ConnectionTimedOut: 522,
|
|
16695
|
-
OriginIsUnreachable: 523,
|
|
16696
|
-
TimeoutOccurred: 524,
|
|
16697
|
-
SslHandshakeFailed: 525,
|
|
16698
|
-
InvalidSslCertificate: 526,
|
|
16699
|
-
};
|
|
16700
|
-
|
|
16701
|
-
Object.entries(HttpStatusCode$1).forEach(([key, value]) => {
|
|
16702
|
-
HttpStatusCode$1[value] = key;
|
|
16703
|
-
});
|
|
16704
|
-
|
|
16705
|
-
/**
|
|
16706
|
-
* Create an instance of Axios
|
|
16707
|
-
*
|
|
16708
|
-
* @param {Object} defaultConfig The default config for the instance
|
|
16709
|
-
*
|
|
16710
|
-
* @returns {Axios} A new instance of Axios
|
|
16711
|
-
*/
|
|
16712
|
-
function createInstance(defaultConfig) {
|
|
16713
|
-
const context = new Axios$1(defaultConfig);
|
|
16714
|
-
const instance = bind(Axios$1.prototype.request, context);
|
|
16715
|
-
|
|
16716
|
-
// Copy axios.prototype to instance
|
|
16717
|
-
utils$1.extend(instance, Axios$1.prototype, context, {allOwnKeys: true});
|
|
16718
|
-
|
|
16719
|
-
// Copy context to instance
|
|
16720
|
-
utils$1.extend(instance, context, null, {allOwnKeys: true});
|
|
16721
|
-
|
|
16722
|
-
// Factory for creating new instances
|
|
16723
|
-
instance.create = function create(instanceConfig) {
|
|
16724
|
-
return createInstance(mergeConfig$1(defaultConfig, instanceConfig));
|
|
16725
|
-
};
|
|
16726
|
-
|
|
16727
|
-
return instance;
|
|
16728
|
-
}
|
|
16729
|
-
|
|
16730
|
-
// Create the default instance to be exported
|
|
16731
|
-
const axios = createInstance(defaults$1);
|
|
16732
|
-
|
|
16733
|
-
// Expose Axios class to allow class inheritance
|
|
16734
|
-
axios.Axios = Axios$1;
|
|
16735
|
-
|
|
16736
|
-
// Expose Cancel & CancelToken
|
|
16737
|
-
axios.CanceledError = CanceledError$1;
|
|
16738
|
-
axios.CancelToken = CancelToken$1;
|
|
16739
|
-
axios.isCancel = isCancel$1;
|
|
16740
|
-
axios.VERSION = VERSION$1;
|
|
16741
|
-
axios.toFormData = toFormData$1;
|
|
16742
|
-
|
|
16743
|
-
// Expose AxiosError class
|
|
16744
|
-
axios.AxiosError = AxiosError$1;
|
|
16745
|
-
|
|
16746
|
-
// alias for CanceledError for backward compatibility
|
|
16747
|
-
axios.Cancel = axios.CanceledError;
|
|
16748
|
-
|
|
16749
|
-
// Expose all/spread
|
|
16750
|
-
axios.all = function all(promises) {
|
|
16751
|
-
return Promise.all(promises);
|
|
16752
|
-
};
|
|
16753
|
-
|
|
16754
|
-
axios.spread = spread$1;
|
|
16755
|
-
|
|
16756
|
-
// Expose isAxiosError
|
|
16757
|
-
axios.isAxiosError = isAxiosError$1;
|
|
16758
|
-
|
|
16759
|
-
// Expose mergeConfig
|
|
16760
|
-
axios.mergeConfig = mergeConfig$1;
|
|
16761
|
-
|
|
16762
|
-
axios.AxiosHeaders = AxiosHeaders$1;
|
|
16763
|
-
|
|
16764
|
-
axios.formToJSON = thing => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
|
|
16765
|
-
|
|
16766
|
-
axios.getAdapter = adapters.getAdapter;
|
|
16767
|
-
|
|
16768
|
-
axios.HttpStatusCode = HttpStatusCode$1;
|
|
16769
|
-
|
|
16770
|
-
axios.default = axios;
|
|
16771
|
-
|
|
16772
|
-
// This module is intended to unwrap Axios default export as named.
|
|
16773
|
-
// Keep top-level export same with static properties
|
|
16774
|
-
// so that it can keep same with es module or cjs
|
|
16775
|
-
const {
|
|
16776
|
-
Axios,
|
|
16777
|
-
AxiosError,
|
|
16778
|
-
CanceledError,
|
|
16779
|
-
isCancel,
|
|
16780
|
-
CancelToken,
|
|
16781
|
-
VERSION,
|
|
16782
|
-
all,
|
|
16783
|
-
Cancel,
|
|
16784
|
-
isAxiosError,
|
|
16785
|
-
spread,
|
|
16786
|
-
toFormData,
|
|
16787
|
-
AxiosHeaders,
|
|
16788
|
-
HttpStatusCode,
|
|
16789
|
-
formToJSON,
|
|
16790
|
-
getAdapter,
|
|
16791
|
-
mergeConfig
|
|
16792
|
-
} = axios;
|
|
16793
|
-
|
|
16794
12883
|
class ApiService {
|
|
16795
12884
|
client;
|
|
16796
12885
|
constructor(baseURL) {
|