@cccsaurora/clue-ui 1.5.0-dev.487 → 1.5.2
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/ActionForm-DyadV6i1.js +4403 -0
- package/AnnotationDetails-AnkzvxW1.js +160 -0
- package/AnnotationPreview-B72dSvQZ.js +140 -0
- package/ClueEnrichContext-A1cGLyI8.js +442 -0
- package/FlexOne-BXWFOd1T.js +6 -0
- package/_MapCache-DRK-s2eK.js +179 -0
- package/_Set-DrS_bbSV.js +6 -0
- package/_Uint8Array-D9R2N9Lp.js +98 -0
- package/_arrayIncludes-Dcl_29E6.js +25 -0
- package/_arrayPush-DBJIuK2V.js +8 -0
- package/_baseAssignValue-Bx1cxHj5.js +12 -0
- package/_baseClone-DRhywkxm.js +211 -0
- package/_baseExtremum-DodEaEyF.js +16 -0
- package/_baseFlatten-CD9NgrYE.js +72 -0
- package/_baseGet-bVwDaGrA.js +80 -0
- package/_baseGetTag-CxDaTem-.js +25 -0
- package/_baseIsEqual-C-FKsm1J.js +150 -0
- package/_baseIteratee-D0FhC5bC.js +95 -0
- package/_baseRest-D_eW2E0d.js +8 -0
- package/_baseSlice-M5RKzt1A.js +10 -0
- package/_baseSum-wEbgNeUs.js +10 -0
- package/_baseUniq-D3N8igOm.js +41 -0
- package/_cacheHas-Wgl-hw34.js +22 -0
- package/_commonjsHelpers-C6fGbg64.js +6 -0
- package/_createAggregator-BVj8IAuF.js +53 -0
- package/_defineProperty-BZU4WKA3.js +11 -0
- package/_getPrototype-BGBCg-aX.js +5 -0
- package/_getTag-B7R9qBo7.js +73 -0
- package/_isIterateeCall-Dm0VTAYy.js +13 -0
- package/_setToArray-Ck4YZu0Z.js +9 -0
- package/cloneDeep-fV59zwUf.js +8 -0
- package/components/AnnotationBody.js +35 -49
- package/components/AnnotationDetailPopover.js +30 -39
- package/components/AnnotationDetails.js +7 -7
- package/components/AnnotationEntry.js +35 -35
- package/components/AnnotationPreview.js +5 -5
- package/components/ClassificationChip.js +24 -46
- package/components/CountBadge.js +26 -31
- package/components/EnrichedCard.js +97 -110
- package/components/EnrichedChip.js +105 -130
- package/components/EnrichedTypography.js +107 -133
- package/components/ErrorBoundary.js +24 -28
- package/components/RetryFailedEnrichments.js +9 -10
- package/components/SourcePicker.js +49 -57
- package/components/actions/ActionForm.js +4 -4
- package/components/actions/ExecutePopover.js +59 -75
- package/components/actions/ResultModal.js +4 -4
- package/components/actions/form/schemaAdapter.js +23 -39
- package/components/actions/formats/FileResult.js +59 -86
- package/components/actions/formats/index.js +25 -29
- package/components/display/graph/ExpandMoreButton.js +10 -10
- package/components/display/graph/elements/NodeCard.js +86 -106
- package/components/display/graph/elements/NodeTag.js +13 -15
- package/components/display/graph/index.js +202 -261
- package/components/display/graph/visualizations/Leaf.js +70 -89
- package/components/display/graph/visualizations/cloud/index.js +82 -98
- package/components/display/graph/visualizations/icons/BaseIcon.js +21 -26
- package/components/display/graph/visualizations/icons/BugIcon.js +12 -12
- package/components/display/graph/visualizations/icons/HostIcon.js +12 -12
- package/components/display/graph/visualizations/icons/NetworkIcon.js +12 -12
- package/components/display/graph/visualizations/icons/ProcessIcon.js +12 -12
- package/components/display/graph/visualizations/icons/TargetIcon.js +12 -13
- package/components/display/graph/visualizations/icons/index.js +13 -14
- package/components/display/graph/visualizations/panels/NodePanel.js +8 -10
- package/components/display/graph/visualizations/tree/BundleLine.js +82 -108
- package/components/display/graph/visualizations/tree/Triangle.js +13 -13
- package/components/display/graph/visualizations/tree/index.js +306 -408
- package/components/display/icons/Iconified.js +12 -27
- package/components/display/json/index.js +4 -4
- package/components/display/markdown/index.js +6599 -9786
- package/components/enrichment/EnrichPopover.js +46 -54
- package/components/fetchers/Fetcher.js +123 -166
- package/components/fetchers/FetcherResultView.js +27 -31
- package/components/fetchers/PreviewModal.js +16 -17
- package/components/fetchers/StatusChip.js +17 -21
- package/components/group/Entry.js +11 -13
- package/components/group/Group.js +10 -13
- package/components/group/GroupControl.js +65 -76
- package/components/stats/QueryStatus.js +32 -45
- package/countBy-B3rNuG4T.js +8 -0
- package/d3-DXDWjYtg.js +15158 -0
- package/data/event.js +4 -6
- package/database/errors.js +11 -14
- package/database/globals.js +2 -2
- package/database/index.js +3 -3
- package/database/replication.js +4 -4
- package/get-Bil3mzRD.js +8 -0
- package/groupBy-CrJC7sGa.js +8 -0
- package/hooks/ClueActionContext.js +6 -6
- package/hooks/ClueComponentContext.js +23 -29
- package/hooks/ClueConfigProvider.js +12 -14
- package/hooks/ClueDatabaseContext.d.ts +1 -1
- package/hooks/ClueDatabaseContext.js +26 -36
- package/hooks/ClueEnrichContext.js +11 -11
- package/hooks/ClueFetcherContext.js +56 -83
- package/hooks/ClueGroupContext.js +14 -17
- package/hooks/CluePopupContext.js +5 -5
- package/hooks/ClueProvider.js +11 -13
- package/hooks/ClueUIPluginContext.js +36 -50
- package/hooks/selectors.js +7 -7
- package/hooks/useActionResult.js +3 -3
- package/hooks/useAnnotations.js +37 -48
- package/hooks/useClue.js +4 -6
- package/hooks/useClueActions.js +3 -3
- package/hooks/useClueConfig.js +4 -6
- package/hooks/useClueTypeConfig.js +24 -45
- package/hooks/useClueUIPlugins.js +7 -8
- package/hooks/useComparator.js +435 -722
- package/hooks/useErrors.js +18 -22
- package/hooks/useFetcherResult.js +24 -33
- package/hooks/useMyHighlights.js +36 -66
- package/hooks/useMyLocalStorage.js +37 -66
- package/iconify-Ptb5dTKy.js +1270 -0
- package/icons/Action.js +49 -66
- package/icons/Assessment.js +69 -85
- package/icons/Context.js +63 -77
- package/icons/Opinion.js +60 -76
- package/icons/iconMap.js +2 -2
- package/identity-ByMq8VxU.js +6 -0
- package/index-BM9Sve5T.js +571 -0
- package/index-CUZaIXbi.js +3403 -0
- package/index-Cj4d5cGz.js +357 -0
- package/index-DZAmjabe.js +977 -0
- package/index-Ds-Gm925.js +6815 -0
- package/index.css +2 -11
- package/isArguments-BWcXOE6a.js +24 -0
- package/isArray-WzO_os3q.js +4 -0
- package/isEmpty-DKxrY-_M.js +22 -0
- package/isNil-CjWwlQS3.js +6 -0
- package/isObject-B53jY8Qg.js +7 -0
- package/isObjectLike-CYbdrIBr.js +6 -0
- package/isSymbol-DE1Kcy2M.js +9 -0
- package/last-7CdUxN0r.js +7 -0
- package/main.js +64 -64
- package/maxBy-BOWDkL_D.js +8 -0
- package/package.json +34 -44
- package/plugins/ClueUIPlugin.js +96 -163
- package/plugins/file/index.js +15 -15
- package/plugins/graph/index.js +26 -29
- package/plugins/image/index.js +24 -28
- package/plugins/json/index.js +21 -21
- package/plugins/markdown/index.js +18 -18
- package/plugins/registry.js +6 -6
- package/plugins/store.js +4 -4
- package/plugins/test/index.js +17 -17
- package/plugins/utils.js +12 -13
- package/replication-DoRkIyyp.js +8556 -0
- package/sessionStorage-DFMae61b.js +90 -0
- package/sortBy-BHe812lF.js +74 -0
- package/store-D4aFUWxi.js +1169 -0
- package/sumBy-B7f_bP_k.js +8 -0
- package/text/Frequency.js +23 -42
- package/toFinite-CBrE65MP.js +14 -0
- package/toNumber-CxmWey0f.js +31 -0
- package/uniq-B4UZ671_.js +7 -0
- package/utils/chain.js +65 -92
- package/utils/classificationParser.js +256 -519
- package/utils/constants.js +11 -37
- package/utils/graph.js +45 -72
- package/utils/hashUtil.js +7 -7
- package/utils/line.js +81 -131
- package/utils/loggerUtil.js +3 -5
- package/utils/sessionStorage.js +7 -7
- package/utils/time.js +427 -447
- package/utils/typeDetection.js +7 -10
- package/utils/utils.js +10 -10
- package/utils/window.js +10 -21
- package/utils-SpTOhPYl.js +147 -0
- package/ActionForm-DxbV_aLe.js +0 -6099
- package/AnnotationDetails-EDZRnwin.js +0 -176
- package/AnnotationPreview-DfLcrcuH.js +0 -188
- package/ClueEnrichContext-DUxJFS3j.js +0 -575
- package/FlexOne-BSYAhhtG.js +0 -9
- package/_MapCache-kuEY_iOH.js +0 -220
- package/_Set-BrSMTlHn.js +0 -6
- package/_Uint8Array-OPpgYQj7.js +0 -123
- package/_arrayIncludes-BNqL-9ZP.js +0 -31
- package/_arrayPush-CBkQqaE_.js +0 -10
- package/_baseAssignValue-CNUVPOBW.js +0 -16
- package/_baseClone-9FaRd1R2.js +0 -287
- package/_baseExtremum-wOGT4Dgw.js +0 -18
- package/_baseFlatten-Co6QHDlG.js +0 -92
- package/_baseGet-Cmp6FztG.js +0 -109
- package/_baseGetTag-Hj-0NTYF.js +0 -44
- package/_baseIsEqual-1CpU47TZ.js +0 -211
- package/_baseIteratee-BN7Vbe5g.js +0 -126
- package/_baseRest-BZ_hQ9PC.js +0 -8
- package/_baseSlice-GAv_YFTT.js +0 -20
- package/_baseSum-D0WC1dN0.js +0 -13
- package/_baseUniq-BnvS3JHL.js +0 -63
- package/_cacheHas-_aF2y2Xv.js +0 -25
- package/_commonjsHelpers-CUmg6egw.js +0 -6
- package/_createAggregator-BUZrP_is.js +0 -63
- package/_defineProperty-DolZLKmv.js +0 -12
- package/_getPrototype-Bb4gm-5m.js +0 -5
- package/_getTag-CML_cXiN.js +0 -105
- package/_isIterateeCall-B1IFEqVv.js +0 -17
- package/_setToArray-CqyqC8ib.js +0 -10
- package/cloneDeep-l3UkXG5M.js +0 -8
- package/countBy-Bqcp3VCs.js +0 -14
- package/get-CdMThM8x.js +0 -8
- package/groupBy-BVV07EGQ.js +0 -14
- package/iconify-CYJTToEF.js +0 -1789
- package/identity-CPGTqrE4.js +0 -6
- package/index-C8VMJ2QX.js +0 -1172
- package/index-CARYR0Hw.js +0 -9711
- package/index-CVUD9o3t.js +0 -15768
- package/index-DUEubgWN.js +0 -464
- package/index-DcMufc6R.js +0 -4416
- package/index-_gpzM2Px.js +0 -702
- package/isArguments-CuYlEuhP.js +0 -27
- package/isArray-RJPfgWqI.js +0 -4
- package/isEmpty-BE656RUK.js +0 -30
- package/isNil-CIubwp4T.js +0 -6
- package/isObject-FTY-5JQX.js +0 -7
- package/isObjectLike-CeENW9FN.js +0 -6
- package/isSymbol-D_H4HPZQ.js +0 -9
- package/last-CUCl67Im.js +0 -7
- package/maxBy-BjjQmX5t.js +0 -8
- package/replication-DzmbOO2P.js +0 -11852
- package/sessionStorage-B68y-wnE.js +0 -140
- package/sortBy-B8JVsLQY.js +0 -95
- package/store-C0DRfMxZ.js +0 -2165
- package/sumBy-D-HCzM2i.js +0 -8
- package/toFinite-meZTg4Su.js +0 -16
- package/toNumber-B5JaA1vX.js +0 -39
- package/uniq-CahZPAwp.js +0 -7
- package/utils-CEySTPtg.js +0 -224
package/index-DcMufc6R.js
DELETED
|
@@ -1,4416 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
import { MY_LOCAL_STORAGE_PREFIX, StorageKey } from "./utils/constants.js";
|
|
5
|
-
import { i as isNil } from "./isNil-CIubwp4T.js";
|
|
6
|
-
import { g as getDefaultExportFromCjs } from "./_commonjsHelpers-CUmg6egw.js";
|
|
7
|
-
import { g as getAxiosCache, s as setAxiosCache } from "./sessionStorage-B68y-wnE.js";
|
|
8
|
-
const get$b = (actionId, taskId, options = { timeout: null }, config) => {
|
|
9
|
-
const searchParams = [];
|
|
10
|
-
if (!isNil(options.timeout)) {
|
|
11
|
-
searchParams.push(`max_timeout=${options.timeout}`);
|
|
12
|
-
}
|
|
13
|
-
return hget(
|
|
14
|
-
joinUri(uri$g(), `${actionId.replace(".", "/")}/status/${encodeURIComponent(taskId)}`),
|
|
15
|
-
searchParams.length > 0 ? new URLSearchParams(searchParams.join("&")) : null,
|
|
16
|
-
config
|
|
17
|
-
);
|
|
18
|
-
};
|
|
19
|
-
const status$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
20
|
-
__proto__: null,
|
|
21
|
-
get: get$b
|
|
22
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
23
|
-
const uri$g = () => {
|
|
24
|
-
return joinUri(uri(), "actions");
|
|
25
|
-
};
|
|
26
|
-
const get$a = (config) => {
|
|
27
|
-
return hget(uri$g(), null, config);
|
|
28
|
-
};
|
|
29
|
-
const post$4 = (actionId, selectors, params, context, options = { timeout: null }, config) => {
|
|
30
|
-
const searchParams = [];
|
|
31
|
-
if (!isNil(options.timeout)) {
|
|
32
|
-
searchParams.push(`max_timeout=${options.timeout}`);
|
|
33
|
-
}
|
|
34
|
-
const payload = { ...params };
|
|
35
|
-
if (!Array.isArray(selectors)) {
|
|
36
|
-
payload.selector = selectors;
|
|
37
|
-
payload.selectors = [];
|
|
38
|
-
} else if (selectors.length < 2) {
|
|
39
|
-
payload.selector = selectors[0];
|
|
40
|
-
payload.selectors = [];
|
|
41
|
-
} else {
|
|
42
|
-
payload.selectors = selectors;
|
|
43
|
-
}
|
|
44
|
-
payload.context = context ?? null;
|
|
45
|
-
return hpost(
|
|
46
|
-
joinUri(
|
|
47
|
-
joinUri(uri$g(), "execute"),
|
|
48
|
-
actionId.replace(".", "/"),
|
|
49
|
-
searchParams.length > 0 ? new URLSearchParams(searchParams.join("&")) : null
|
|
50
|
-
),
|
|
51
|
-
payload,
|
|
52
|
-
config
|
|
53
|
-
);
|
|
54
|
-
};
|
|
55
|
-
const actions = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
56
|
-
__proto__: null,
|
|
57
|
-
get: get$a,
|
|
58
|
-
post: post$4,
|
|
59
|
-
status: status$1,
|
|
60
|
-
uri: uri$g
|
|
61
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
62
|
-
const uri$f = (searchParams) => {
|
|
63
|
-
return joinUri(uri$e(), "login", searchParams);
|
|
64
|
-
};
|
|
65
|
-
const post$3 = (body) => {
|
|
66
|
-
return hpost(uri$f(), body);
|
|
67
|
-
};
|
|
68
|
-
const get$9 = (search) => {
|
|
69
|
-
const nonce = localStorage.getItem(`${MY_LOCAL_STORAGE_PREFIX}.${StorageKey.LOGIN_NONCE}`);
|
|
70
|
-
if (nonce) {
|
|
71
|
-
search.set("nonce", JSON.parse(nonce));
|
|
72
|
-
localStorage.removeItem(`${MY_LOCAL_STORAGE_PREFIX}.${StorageKey.LOGIN_NONCE}`);
|
|
73
|
-
}
|
|
74
|
-
return hget(uri$f(), search);
|
|
75
|
-
};
|
|
76
|
-
const login = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
77
|
-
__proto__: null,
|
|
78
|
-
get: get$9,
|
|
79
|
-
post: post$3,
|
|
80
|
-
uri: uri$f
|
|
81
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
82
|
-
const uri$e = () => {
|
|
83
|
-
return joinUri(uri(), "auth");
|
|
84
|
-
};
|
|
85
|
-
const auth = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
86
|
-
__proto__: null,
|
|
87
|
-
login,
|
|
88
|
-
uri: uri$e
|
|
89
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
90
|
-
const uri$d = () => {
|
|
91
|
-
return joinUri(uri(), "configs");
|
|
92
|
-
};
|
|
93
|
-
const get$8 = (config) => {
|
|
94
|
-
return hget(uri$d(), null, config);
|
|
95
|
-
};
|
|
96
|
-
const configs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
97
|
-
__proto__: null,
|
|
98
|
-
get: get$8,
|
|
99
|
-
uri: uri$d
|
|
100
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
101
|
-
const get$7 = (fetcherId, taskId, options = { timeout: null }, config) => {
|
|
102
|
-
const searchParams = [];
|
|
103
|
-
if (!isNil(options.timeout)) {
|
|
104
|
-
searchParams.push(`max_timeout=${options.timeout}`);
|
|
105
|
-
}
|
|
106
|
-
return hget(
|
|
107
|
-
joinUri(uri$g(), `${fetcherId.replace(".", "/")}/status/${encodeURIComponent(taskId)}`),
|
|
108
|
-
searchParams.length > 0 ? new URLSearchParams(searchParams.join("&")) : null,
|
|
109
|
-
config
|
|
110
|
-
);
|
|
111
|
-
};
|
|
112
|
-
const status = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
113
|
-
__proto__: null,
|
|
114
|
-
get: get$7
|
|
115
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
116
|
-
const uri$c = () => {
|
|
117
|
-
return joinUri(uri(), "fetchers");
|
|
118
|
-
};
|
|
119
|
-
const get$6 = (config) => {
|
|
120
|
-
return hget(uri$c(), null, config);
|
|
121
|
-
};
|
|
122
|
-
const post$2 = (fetcherId, selector, config) => {
|
|
123
|
-
return hpost(joinAllUri(uri$c(), fetcherId.replace(".", "/")), selector, config);
|
|
124
|
-
};
|
|
125
|
-
const fetchers = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
126
|
-
__proto__: null,
|
|
127
|
-
get: get$6,
|
|
128
|
-
post: post$2,
|
|
129
|
-
status,
|
|
130
|
-
uri: uri$c
|
|
131
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
132
|
-
const uri$b = () => {
|
|
133
|
-
return joinUri(uri$8(), "enrich");
|
|
134
|
-
};
|
|
135
|
-
const post$1 = (bulkData, sources = [], options = { timeout: null, includeRaw: false, noCache: false }, config) => {
|
|
136
|
-
const searchParams = [];
|
|
137
|
-
if ((sources == null ? void 0 : sources.length) > 0) {
|
|
138
|
-
searchParams.push(`sources=${sources.join()}`);
|
|
139
|
-
}
|
|
140
|
-
if (options.classification) {
|
|
141
|
-
searchParams.push(`classification=${encodeURIComponent(options.classification)}`);
|
|
142
|
-
}
|
|
143
|
-
if (!isNil(options.timeout)) {
|
|
144
|
-
searchParams.push(`max_timeout=${options.timeout}`);
|
|
145
|
-
}
|
|
146
|
-
if (options.includeRaw) {
|
|
147
|
-
searchParams.push("include_raw=true");
|
|
148
|
-
}
|
|
149
|
-
if (options.noCache) {
|
|
150
|
-
searchParams.push("no_cache=true");
|
|
151
|
-
}
|
|
152
|
-
return hpost(
|
|
153
|
-
joinUri(uri$b(), "", searchParams.length > 0 ? new URLSearchParams(searchParams.join("&")) : null),
|
|
154
|
-
bulkData,
|
|
155
|
-
config
|
|
156
|
-
);
|
|
157
|
-
};
|
|
158
|
-
const enrich = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
159
|
-
__proto__: null,
|
|
160
|
-
post: post$1,
|
|
161
|
-
uri: uri$b
|
|
162
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
163
|
-
const uri$a = () => {
|
|
164
|
-
return joinUri(uri$8(), "types");
|
|
165
|
-
};
|
|
166
|
-
const get$5 = (config) => {
|
|
167
|
-
return hget(uri$a(), null, config);
|
|
168
|
-
};
|
|
169
|
-
const types = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
170
|
-
__proto__: null,
|
|
171
|
-
get: get$5,
|
|
172
|
-
uri: uri$a
|
|
173
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
174
|
-
const uri$9 = () => {
|
|
175
|
-
return joinUri(uri$8(), "types_detection");
|
|
176
|
-
};
|
|
177
|
-
const get$4 = (config) => {
|
|
178
|
-
return hget(uri$9(), null, config);
|
|
179
|
-
};
|
|
180
|
-
const types_detection$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
181
|
-
__proto__: null,
|
|
182
|
-
get: get$4,
|
|
183
|
-
uri: uri$9
|
|
184
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
185
|
-
const uri$8 = () => {
|
|
186
|
-
return joinUri(uri(), "lookup");
|
|
187
|
-
};
|
|
188
|
-
const lookup = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
189
|
-
__proto__: null,
|
|
190
|
-
enrich,
|
|
191
|
-
types,
|
|
192
|
-
types_detection: types_detection$1,
|
|
193
|
-
uri: uri$8
|
|
194
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
195
|
-
const uri$7 = (filter2) => {
|
|
196
|
-
return joinUri(uri$5(), filter2 ? "/docs?filter=" + filter2 : "/docs");
|
|
197
|
-
};
|
|
198
|
-
const get$3 = (filter2, config) => {
|
|
199
|
-
return hget(uri$7(filter2), null, config);
|
|
200
|
-
};
|
|
201
|
-
const all_documentation = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
202
|
-
__proto__: null,
|
|
203
|
-
get: get$3,
|
|
204
|
-
uri: uri$7
|
|
205
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
206
|
-
const uri$6 = (file) => {
|
|
207
|
-
return joinAllUri(uri$5(), "docs", file);
|
|
208
|
-
};
|
|
209
|
-
const get$2 = (file, config) => {
|
|
210
|
-
return hget(uri$6(file), null, config);
|
|
211
|
-
};
|
|
212
|
-
const documentation = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
213
|
-
__proto__: null,
|
|
214
|
-
get: get$2,
|
|
215
|
-
uri: uri$6
|
|
216
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
217
|
-
const uri$5 = () => {
|
|
218
|
-
return joinUri(uri(), "static");
|
|
219
|
-
};
|
|
220
|
-
const _static = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
221
|
-
__proto__: null,
|
|
222
|
-
all_documentation,
|
|
223
|
-
documentation,
|
|
224
|
-
uri: uri$5
|
|
225
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
226
|
-
const uri$4 = () => {
|
|
227
|
-
return joinUri(uri(), "sync");
|
|
228
|
-
};
|
|
229
|
-
const get$1 = (collection, id, timestamp, omitDeleted, config) => {
|
|
230
|
-
const params = new URLSearchParams();
|
|
231
|
-
params.set("limit", "250");
|
|
232
|
-
if (!isNil(id)) {
|
|
233
|
-
params.set("id", id.toString());
|
|
234
|
-
}
|
|
235
|
-
if (!isNil(timestamp)) {
|
|
236
|
-
params.set("updated_at", timestamp.toString());
|
|
237
|
-
}
|
|
238
|
-
if (!isNil(omitDeleted) && omitDeleted) {
|
|
239
|
-
params.set("omit_deleted", "true");
|
|
240
|
-
}
|
|
241
|
-
return hget(joinAllUri(uri$4(), collection), params, config);
|
|
242
|
-
};
|
|
243
|
-
const post = (collection, payload, config) => {
|
|
244
|
-
return hpost(joinAllUri(uri$4(), collection), payload, config);
|
|
245
|
-
};
|
|
246
|
-
const sync = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
247
|
-
__proto__: null,
|
|
248
|
-
get: get$1,
|
|
249
|
-
post,
|
|
250
|
-
uri: uri$4
|
|
251
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
252
|
-
const uri$3 = () => joinUri(uri$2(), "types_detection");
|
|
253
|
-
const get = (config) => {
|
|
254
|
-
return hget(uri$3(), null, config);
|
|
255
|
-
};
|
|
256
|
-
const types_detection = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
257
|
-
__proto__: null,
|
|
258
|
-
get,
|
|
259
|
-
uri: uri$3
|
|
260
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
261
|
-
const uri$2 = () => {
|
|
262
|
-
return joinUri(uri$1(), "lookup");
|
|
263
|
-
};
|
|
264
|
-
const index = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
265
|
-
__proto__: null,
|
|
266
|
-
types_detection,
|
|
267
|
-
uri: uri$2
|
|
268
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
269
|
-
const uri$1 = () => {
|
|
270
|
-
return "/api/v2";
|
|
271
|
-
};
|
|
272
|
-
const v2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
273
|
-
__proto__: null,
|
|
274
|
-
lookup: index,
|
|
275
|
-
uri: uri$1
|
|
276
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
277
|
-
function bind(fn, thisArg) {
|
|
278
|
-
return function wrap() {
|
|
279
|
-
return fn.apply(thisArg, arguments);
|
|
280
|
-
};
|
|
281
|
-
}
|
|
282
|
-
const { toString } = Object.prototype;
|
|
283
|
-
const { getPrototypeOf } = Object;
|
|
284
|
-
const { iterator, toStringTag } = Symbol;
|
|
285
|
-
const hasOwnProperty = (({ hasOwnProperty: hasOwnProperty2 }) => (obj, prop) => hasOwnProperty2.call(obj, prop))(Object.prototype);
|
|
286
|
-
const isUnsafeObjectKey = (prop) => typeof prop === "string" && (prop === "__proto__" || prop === "constructor" || prop === "prototype");
|
|
287
|
-
const isPrototypeBoundary = (obj, prototype2, source) => obj === Object.prototype || !source && prototype2 === null;
|
|
288
|
-
const isSafeAndFullyMutable = (obj) => {
|
|
289
|
-
if (!Object.isExtensible(obj)) {
|
|
290
|
-
return false;
|
|
291
|
-
}
|
|
292
|
-
const props = Object.getOwnPropertyNames(obj);
|
|
293
|
-
if (Object.getOwnPropertySymbols) {
|
|
294
|
-
props.push(...Object.getOwnPropertySymbols(obj));
|
|
295
|
-
}
|
|
296
|
-
return props.every((prop) => {
|
|
297
|
-
if (isUnsafeObjectKey(prop)) {
|
|
298
|
-
return false;
|
|
299
|
-
}
|
|
300
|
-
const descriptor = Object.getOwnPropertyDescriptor(obj, prop);
|
|
301
|
-
return !!descriptor && descriptor.configurable && descriptor.writable === true;
|
|
302
|
-
});
|
|
303
|
-
};
|
|
304
|
-
const hasOwnInPrototypeChain = (thing, prop) => {
|
|
305
|
-
let obj = thing;
|
|
306
|
-
const seen = [];
|
|
307
|
-
while (obj != null) {
|
|
308
|
-
if (seen.indexOf(obj) !== -1) {
|
|
309
|
-
return false;
|
|
310
|
-
}
|
|
311
|
-
seen.push(obj);
|
|
312
|
-
const prototype2 = getPrototypeOf(obj);
|
|
313
|
-
if (isPrototypeBoundary(obj, prototype2, obj === thing)) {
|
|
314
|
-
return false;
|
|
315
|
-
}
|
|
316
|
-
if (hasOwnProperty(obj, prop)) {
|
|
317
|
-
return true;
|
|
318
|
-
}
|
|
319
|
-
obj = prototype2;
|
|
320
|
-
}
|
|
321
|
-
return false;
|
|
322
|
-
};
|
|
323
|
-
const getSafeProp = (obj, prop) => obj != null && hasOwnInPrototypeChain(obj, prop) ? obj[prop] : void 0;
|
|
324
|
-
const toSafeFlatObject = (thing) => {
|
|
325
|
-
if (thing == null || typeof thing !== "object" && typeof thing !== "function") {
|
|
326
|
-
return thing;
|
|
327
|
-
}
|
|
328
|
-
const sourcePrototype = getPrototypeOf(thing);
|
|
329
|
-
if (sourcePrototype === null && isSafeAndFullyMutable(thing)) {
|
|
330
|
-
return thing;
|
|
331
|
-
}
|
|
332
|
-
const result = /* @__PURE__ */ Object.create(null);
|
|
333
|
-
const merged = /* @__PURE__ */ Object.create(null);
|
|
334
|
-
const seen = [];
|
|
335
|
-
let current = thing;
|
|
336
|
-
while (current != null) {
|
|
337
|
-
if (seen.indexOf(current) !== -1) {
|
|
338
|
-
break;
|
|
339
|
-
}
|
|
340
|
-
seen.push(current);
|
|
341
|
-
const prototype2 = current === thing ? sourcePrototype : getPrototypeOf(current);
|
|
342
|
-
if (isPrototypeBoundary(current, prototype2, current === thing)) {
|
|
343
|
-
break;
|
|
344
|
-
}
|
|
345
|
-
const props = Object.getOwnPropertyNames(current);
|
|
346
|
-
if (Object.getOwnPropertySymbols) {
|
|
347
|
-
props.push(...Object.getOwnPropertySymbols(current));
|
|
348
|
-
}
|
|
349
|
-
for (const prop of props) {
|
|
350
|
-
if (isUnsafeObjectKey(prop)) {
|
|
351
|
-
continue;
|
|
352
|
-
}
|
|
353
|
-
if (!hasOwnProperty(merged, prop)) {
|
|
354
|
-
result[prop] = thing[prop];
|
|
355
|
-
merged[prop] = true;
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
current = prototype2;
|
|
359
|
-
}
|
|
360
|
-
return result;
|
|
361
|
-
};
|
|
362
|
-
const kindOf = /* @__PURE__ */ ((cache) => (thing) => {
|
|
363
|
-
const str = toString.call(thing);
|
|
364
|
-
return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
|
|
365
|
-
})(/* @__PURE__ */ Object.create(null));
|
|
366
|
-
const kindOfTest = (type) => {
|
|
367
|
-
type = type.toLowerCase();
|
|
368
|
-
return (thing) => kindOf(thing) === type;
|
|
369
|
-
};
|
|
370
|
-
const typeOfTest = (type) => (thing) => typeof thing === type;
|
|
371
|
-
const { isArray } = Array;
|
|
372
|
-
const isUndefined = typeOfTest("undefined");
|
|
373
|
-
function isBuffer(val) {
|
|
374
|
-
return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) && isFunction$1(val.constructor.isBuffer) && val.constructor.isBuffer(val);
|
|
375
|
-
}
|
|
376
|
-
const isArrayBuffer = kindOfTest("ArrayBuffer");
|
|
377
|
-
function isArrayBufferView(val) {
|
|
378
|
-
let result;
|
|
379
|
-
if (typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView) {
|
|
380
|
-
result = ArrayBuffer.isView(val);
|
|
381
|
-
} else {
|
|
382
|
-
result = val && val.buffer && isArrayBuffer(val.buffer);
|
|
383
|
-
}
|
|
384
|
-
return result;
|
|
385
|
-
}
|
|
386
|
-
const isString = typeOfTest("string");
|
|
387
|
-
const isFunction$1 = typeOfTest("function");
|
|
388
|
-
const isNumber = typeOfTest("number");
|
|
389
|
-
const isObject = (thing) => thing !== null && typeof thing === "object";
|
|
390
|
-
const isBoolean = (thing) => thing === true || thing === false;
|
|
391
|
-
const isPlainObject = (val) => {
|
|
392
|
-
if (!isObject(val)) {
|
|
393
|
-
return false;
|
|
394
|
-
}
|
|
395
|
-
const prototype2 = getPrototypeOf(val);
|
|
396
|
-
return (prototype2 === null || prototype2 === Object.prototype || getPrototypeOf(prototype2) === null) && // Treat safe own/inherited Symbol.toStringTag or Symbol.iterator members as
|
|
397
|
-
// evidence the value is tagged/iterable, while ignoring members reachable
|
|
398
|
-
// only through shared or terminal prototype boundaries.
|
|
399
|
-
!hasOwnInPrototypeChain(val, toStringTag) && !hasOwnInPrototypeChain(val, iterator);
|
|
400
|
-
};
|
|
401
|
-
const isEmptyObject = (val) => {
|
|
402
|
-
if (!isObject(val) || isBuffer(val)) {
|
|
403
|
-
return false;
|
|
404
|
-
}
|
|
405
|
-
try {
|
|
406
|
-
return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
|
|
407
|
-
} catch (e) {
|
|
408
|
-
return false;
|
|
409
|
-
}
|
|
410
|
-
};
|
|
411
|
-
const isDate = kindOfTest("Date");
|
|
412
|
-
const isFile = kindOfTest("File");
|
|
413
|
-
const isReactNativeBlob = (value) => {
|
|
414
|
-
return !!(value && typeof value.uri !== "undefined");
|
|
415
|
-
};
|
|
416
|
-
const isReactNative = (formData) => formData && typeof formData.getParts !== "undefined";
|
|
417
|
-
const isBlob = kindOfTest("Blob");
|
|
418
|
-
const isFileList = kindOfTest("FileList");
|
|
419
|
-
const isSet = kindOfTest("Set");
|
|
420
|
-
const isStream = (val) => isObject(val) && isFunction$1(val.pipe);
|
|
421
|
-
function getGlobal() {
|
|
422
|
-
if (typeof globalThis !== "undefined") return globalThis;
|
|
423
|
-
if (typeof self !== "undefined") return self;
|
|
424
|
-
if (typeof window !== "undefined") return window;
|
|
425
|
-
if (typeof global !== "undefined") return global;
|
|
426
|
-
return {};
|
|
427
|
-
}
|
|
428
|
-
const G = getGlobal();
|
|
429
|
-
const FormDataCtor = typeof G.FormData !== "undefined" ? G.FormData : void 0;
|
|
430
|
-
const isFormData = (thing) => {
|
|
431
|
-
if (!thing) return false;
|
|
432
|
-
if (FormDataCtor && thing instanceof FormDataCtor) return true;
|
|
433
|
-
const proto = getPrototypeOf(thing);
|
|
434
|
-
if (!proto || proto === Object.prototype) return false;
|
|
435
|
-
if (!isFunction$1(thing.append)) return false;
|
|
436
|
-
const kind = kindOf(thing);
|
|
437
|
-
return kind === "formdata" || // detect form-data instance
|
|
438
|
-
kind === "object" && isFunction$1(thing.toString) && thing.toString() === "[object FormData]";
|
|
439
|
-
};
|
|
440
|
-
const isURLSearchParams = kindOfTest("URLSearchParams");
|
|
441
|
-
const [isReadableStream, isRequest, isResponse, isHeaders] = [
|
|
442
|
-
"ReadableStream",
|
|
443
|
-
"Request",
|
|
444
|
-
"Response",
|
|
445
|
-
"Headers"
|
|
446
|
-
].map(kindOfTest);
|
|
447
|
-
const trim = (str) => {
|
|
448
|
-
return str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
|
|
449
|
-
};
|
|
450
|
-
function forEach(obj, fn, { allOwnKeys = false } = {}) {
|
|
451
|
-
if (obj === null || typeof obj === "undefined") {
|
|
452
|
-
return;
|
|
453
|
-
}
|
|
454
|
-
let i;
|
|
455
|
-
let l;
|
|
456
|
-
if (typeof obj !== "object") {
|
|
457
|
-
obj = [obj];
|
|
458
|
-
}
|
|
459
|
-
if (isArray(obj)) {
|
|
460
|
-
for (i = 0, l = obj.length; i < l; i++) {
|
|
461
|
-
fn.call(null, obj[i], i, obj);
|
|
462
|
-
}
|
|
463
|
-
} else {
|
|
464
|
-
if (isBuffer(obj)) {
|
|
465
|
-
return;
|
|
466
|
-
}
|
|
467
|
-
const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
|
|
468
|
-
const len = keys.length;
|
|
469
|
-
let key;
|
|
470
|
-
for (i = 0; i < len; i++) {
|
|
471
|
-
key = keys[i];
|
|
472
|
-
fn.call(null, obj[key], key, obj);
|
|
473
|
-
}
|
|
474
|
-
}
|
|
475
|
-
}
|
|
476
|
-
function findKey(obj, key) {
|
|
477
|
-
if (isBuffer(obj)) {
|
|
478
|
-
return null;
|
|
479
|
-
}
|
|
480
|
-
key = key.toLowerCase();
|
|
481
|
-
const keys = Object.keys(obj);
|
|
482
|
-
let i = keys.length;
|
|
483
|
-
let _key;
|
|
484
|
-
while (i-- > 0) {
|
|
485
|
-
_key = keys[i];
|
|
486
|
-
if (key === _key.toLowerCase()) {
|
|
487
|
-
return _key;
|
|
488
|
-
}
|
|
489
|
-
}
|
|
490
|
-
return null;
|
|
491
|
-
}
|
|
492
|
-
const _global = (() => {
|
|
493
|
-
if (typeof globalThis !== "undefined") return globalThis;
|
|
494
|
-
return typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : global;
|
|
495
|
-
})();
|
|
496
|
-
const isContextDefined = (context) => !isUndefined(context) && context !== _global;
|
|
497
|
-
function merge(...objs) {
|
|
498
|
-
const { caseless, skipUndefined } = isContextDefined(this) && this || {};
|
|
499
|
-
const result = {};
|
|
500
|
-
const assignValue = (val, key) => {
|
|
501
|
-
if (key === "__proto__" || key === "constructor" || key === "prototype") {
|
|
502
|
-
return;
|
|
503
|
-
}
|
|
504
|
-
const targetKey = caseless && typeof key === "string" && findKey(result, key) || key;
|
|
505
|
-
const existing = hasOwnProperty(result, targetKey) ? result[targetKey] : void 0;
|
|
506
|
-
if (isPlainObject(existing) && isPlainObject(val)) {
|
|
507
|
-
result[targetKey] = merge(existing, val);
|
|
508
|
-
} else if (isPlainObject(val)) {
|
|
509
|
-
result[targetKey] = merge({}, val);
|
|
510
|
-
} else if (isArray(val)) {
|
|
511
|
-
result[targetKey] = val.slice();
|
|
512
|
-
} else if (!skipUndefined || !isUndefined(val)) {
|
|
513
|
-
result[targetKey] = val;
|
|
514
|
-
}
|
|
515
|
-
};
|
|
516
|
-
for (let i = 0, l = objs.length; i < l; i++) {
|
|
517
|
-
const source = objs[i];
|
|
518
|
-
if (!source || isBuffer(source)) {
|
|
519
|
-
continue;
|
|
520
|
-
}
|
|
521
|
-
forEach(source, assignValue);
|
|
522
|
-
if (typeof source !== "object" || isArray(source)) {
|
|
523
|
-
continue;
|
|
524
|
-
}
|
|
525
|
-
const symbols = Object.getOwnPropertySymbols(source);
|
|
526
|
-
for (let j = 0; j < symbols.length; j++) {
|
|
527
|
-
const symbol = symbols[j];
|
|
528
|
-
if (propertyIsEnumerable.call(source, symbol)) {
|
|
529
|
-
assignValue(source[symbol], symbol);
|
|
530
|
-
}
|
|
531
|
-
}
|
|
532
|
-
}
|
|
533
|
-
return result;
|
|
534
|
-
}
|
|
535
|
-
const extend = (a, b, thisArg, { allOwnKeys } = {}) => {
|
|
536
|
-
forEach(
|
|
537
|
-
b,
|
|
538
|
-
(val, key) => {
|
|
539
|
-
if (thisArg && isFunction$1(val)) {
|
|
540
|
-
Object.defineProperty(a, key, {
|
|
541
|
-
// Null-proto descriptor so a polluted Object.prototype.get cannot
|
|
542
|
-
// hijack defineProperty's accessor-vs-data resolution.
|
|
543
|
-
__proto__: null,
|
|
544
|
-
value: bind(val, thisArg),
|
|
545
|
-
writable: true,
|
|
546
|
-
enumerable: true,
|
|
547
|
-
configurable: true
|
|
548
|
-
});
|
|
549
|
-
} else {
|
|
550
|
-
Object.defineProperty(a, key, {
|
|
551
|
-
__proto__: null,
|
|
552
|
-
value: val,
|
|
553
|
-
writable: true,
|
|
554
|
-
enumerable: true,
|
|
555
|
-
configurable: true
|
|
556
|
-
});
|
|
557
|
-
}
|
|
558
|
-
},
|
|
559
|
-
{ allOwnKeys }
|
|
560
|
-
);
|
|
561
|
-
return a;
|
|
562
|
-
};
|
|
563
|
-
const stripBOM = (content) => {
|
|
564
|
-
if (content.charCodeAt(0) === 65279) {
|
|
565
|
-
content = content.slice(1);
|
|
566
|
-
}
|
|
567
|
-
return content;
|
|
568
|
-
};
|
|
569
|
-
const inherits = (constructor, superConstructor, props, descriptors) => {
|
|
570
|
-
constructor.prototype = Object.create(superConstructor.prototype, descriptors);
|
|
571
|
-
Object.defineProperty(constructor.prototype, "constructor", {
|
|
572
|
-
__proto__: null,
|
|
573
|
-
value: constructor,
|
|
574
|
-
writable: true,
|
|
575
|
-
enumerable: false,
|
|
576
|
-
configurable: true
|
|
577
|
-
});
|
|
578
|
-
Object.defineProperty(constructor, "super", {
|
|
579
|
-
__proto__: null,
|
|
580
|
-
value: superConstructor.prototype
|
|
581
|
-
});
|
|
582
|
-
props && Object.assign(constructor.prototype, props);
|
|
583
|
-
};
|
|
584
|
-
const toFlatObject = (sourceObj, destObj, filter2, propFilter) => {
|
|
585
|
-
let props;
|
|
586
|
-
let i;
|
|
587
|
-
let prop;
|
|
588
|
-
const merged = {};
|
|
589
|
-
destObj = destObj || {};
|
|
590
|
-
if (sourceObj == null) return destObj;
|
|
591
|
-
do {
|
|
592
|
-
props = Object.getOwnPropertyNames(sourceObj);
|
|
593
|
-
i = props.length;
|
|
594
|
-
while (i-- > 0) {
|
|
595
|
-
prop = props[i];
|
|
596
|
-
if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
|
|
597
|
-
destObj[prop] = sourceObj[prop];
|
|
598
|
-
merged[prop] = true;
|
|
599
|
-
}
|
|
600
|
-
}
|
|
601
|
-
sourceObj = filter2 !== false && getPrototypeOf(sourceObj);
|
|
602
|
-
} while (sourceObj && (!filter2 || filter2(sourceObj, destObj)) && sourceObj !== Object.prototype);
|
|
603
|
-
return destObj;
|
|
604
|
-
};
|
|
605
|
-
const endsWith = (str, searchString, position) => {
|
|
606
|
-
str = String(str);
|
|
607
|
-
if (position === void 0 || position > str.length) {
|
|
608
|
-
position = str.length;
|
|
609
|
-
}
|
|
610
|
-
position -= searchString.length;
|
|
611
|
-
const lastIndex = str.indexOf(searchString, position);
|
|
612
|
-
return lastIndex !== -1 && lastIndex === position;
|
|
613
|
-
};
|
|
614
|
-
const toArray = (thing) => {
|
|
615
|
-
if (!thing) return null;
|
|
616
|
-
if (isArray(thing)) return thing;
|
|
617
|
-
let i = thing.length;
|
|
618
|
-
if (!isNumber(i)) return null;
|
|
619
|
-
const arr = new Array(i);
|
|
620
|
-
while (i-- > 0) {
|
|
621
|
-
arr[i] = thing[i];
|
|
622
|
-
}
|
|
623
|
-
return arr;
|
|
624
|
-
};
|
|
625
|
-
const isTypedArray = /* @__PURE__ */ ((TypedArray) => {
|
|
626
|
-
return (thing) => {
|
|
627
|
-
return TypedArray && thing instanceof TypedArray;
|
|
628
|
-
};
|
|
629
|
-
})(typeof Uint8Array !== "undefined" && getPrototypeOf(Uint8Array));
|
|
630
|
-
const forEachEntry = (obj, fn) => {
|
|
631
|
-
const generator = obj && obj[iterator];
|
|
632
|
-
const _iterator = generator.call(obj);
|
|
633
|
-
let result;
|
|
634
|
-
while ((result = _iterator.next()) && !result.done) {
|
|
635
|
-
const pair = result.value;
|
|
636
|
-
fn.call(obj, pair[0], pair[1]);
|
|
637
|
-
}
|
|
638
|
-
};
|
|
639
|
-
const matchAll = (regExp, str) => {
|
|
640
|
-
let matches;
|
|
641
|
-
const arr = [];
|
|
642
|
-
while ((matches = regExp.exec(str)) !== null) {
|
|
643
|
-
arr.push(matches);
|
|
644
|
-
}
|
|
645
|
-
return arr;
|
|
646
|
-
};
|
|
647
|
-
const isHTMLForm = kindOfTest("HTMLFormElement");
|
|
648
|
-
const toCamelCase = (str) => {
|
|
649
|
-
return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g, function replacer(m, p1, p2) {
|
|
650
|
-
return p1.toUpperCase() + p2;
|
|
651
|
-
});
|
|
652
|
-
};
|
|
653
|
-
const { propertyIsEnumerable } = Object.prototype;
|
|
654
|
-
const isRegExp = kindOfTest("RegExp");
|
|
655
|
-
const reduceDescriptors = (obj, reducer) => {
|
|
656
|
-
const descriptors = Object.getOwnPropertyDescriptors(obj);
|
|
657
|
-
const reducedDescriptors = {};
|
|
658
|
-
forEach(descriptors, (descriptor, name) => {
|
|
659
|
-
let ret;
|
|
660
|
-
if ((ret = reducer(descriptor, name, obj)) !== false) {
|
|
661
|
-
reducedDescriptors[name] = ret || descriptor;
|
|
662
|
-
}
|
|
663
|
-
});
|
|
664
|
-
Object.defineProperties(obj, reducedDescriptors);
|
|
665
|
-
};
|
|
666
|
-
const freezeMethods = (obj) => {
|
|
667
|
-
reduceDescriptors(obj, (descriptor, name) => {
|
|
668
|
-
if (isFunction$1(obj) && ["arguments", "caller", "callee"].includes(name)) {
|
|
669
|
-
return false;
|
|
670
|
-
}
|
|
671
|
-
const value = obj[name];
|
|
672
|
-
if (!isFunction$1(value)) return;
|
|
673
|
-
descriptor.enumerable = false;
|
|
674
|
-
if ("writable" in descriptor) {
|
|
675
|
-
descriptor.writable = false;
|
|
676
|
-
return;
|
|
677
|
-
}
|
|
678
|
-
if (!descriptor.set) {
|
|
679
|
-
descriptor.set = () => {
|
|
680
|
-
throw Error("Can not rewrite read-only method '" + name + "'");
|
|
681
|
-
};
|
|
682
|
-
}
|
|
683
|
-
});
|
|
684
|
-
};
|
|
685
|
-
const toObjectSet = (arrayOrString, delimiter) => {
|
|
686
|
-
const obj = {};
|
|
687
|
-
const define = (arr) => {
|
|
688
|
-
arr.forEach((value) => {
|
|
689
|
-
obj[value] = true;
|
|
690
|
-
});
|
|
691
|
-
};
|
|
692
|
-
isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));
|
|
693
|
-
return obj;
|
|
694
|
-
};
|
|
695
|
-
const noop = () => {
|
|
696
|
-
};
|
|
697
|
-
const toFiniteNumber = (value, defaultValue) => {
|
|
698
|
-
return value != null && Number.isFinite(value = +value) ? value : defaultValue;
|
|
699
|
-
};
|
|
700
|
-
function isSpecCompliantForm(thing) {
|
|
701
|
-
return !!(thing && isFunction$1(thing.append) && thing[toStringTag] === "FormData" && thing[iterator]);
|
|
702
|
-
}
|
|
703
|
-
const toJSONObject = (obj) => {
|
|
704
|
-
const visited = /* @__PURE__ */ new WeakSet();
|
|
705
|
-
const visit = (source) => {
|
|
706
|
-
if (isObject(source)) {
|
|
707
|
-
if (visited.has(source)) {
|
|
708
|
-
return;
|
|
709
|
-
}
|
|
710
|
-
if (isBuffer(source)) {
|
|
711
|
-
return source;
|
|
712
|
-
}
|
|
713
|
-
if (!("toJSON" in source)) {
|
|
714
|
-
visited.add(source);
|
|
715
|
-
let target;
|
|
716
|
-
if (isSet(source)) {
|
|
717
|
-
target = [];
|
|
718
|
-
for (const value of source) {
|
|
719
|
-
const reducedValue = visit(value);
|
|
720
|
-
!isUndefined(reducedValue) && target.push(reducedValue);
|
|
721
|
-
}
|
|
722
|
-
} else {
|
|
723
|
-
target = isArray(source) ? [] : {};
|
|
724
|
-
forEach(source, (value, key) => {
|
|
725
|
-
const reducedValue = visit(value);
|
|
726
|
-
!isUndefined(reducedValue) && (target[key] = reducedValue);
|
|
727
|
-
});
|
|
728
|
-
}
|
|
729
|
-
visited.delete(source);
|
|
730
|
-
return target;
|
|
731
|
-
}
|
|
732
|
-
}
|
|
733
|
-
return source;
|
|
734
|
-
};
|
|
735
|
-
return visit(obj);
|
|
736
|
-
};
|
|
737
|
-
const isAsyncFn = kindOfTest("AsyncFunction");
|
|
738
|
-
const isThenable = (thing) => thing && (isObject(thing) || isFunction$1(thing)) && isFunction$1(thing.then) && isFunction$1(thing.catch);
|
|
739
|
-
const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
|
|
740
|
-
if (setImmediateSupported) {
|
|
741
|
-
return setImmediate;
|
|
742
|
-
}
|
|
743
|
-
return postMessageSupported ? ((token, callbacks) => {
|
|
744
|
-
_global.addEventListener(
|
|
745
|
-
"message",
|
|
746
|
-
({ source, data }) => {
|
|
747
|
-
if (source === _global && data === token) {
|
|
748
|
-
callbacks.length && callbacks.shift()();
|
|
749
|
-
}
|
|
750
|
-
},
|
|
751
|
-
false
|
|
752
|
-
);
|
|
753
|
-
return (cb) => {
|
|
754
|
-
callbacks.push(cb);
|
|
755
|
-
_global.postMessage(token, "*");
|
|
756
|
-
};
|
|
757
|
-
})(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb);
|
|
758
|
-
})(typeof setImmediate === "function", isFunction$1(_global.postMessage));
|
|
759
|
-
const asap = typeof queueMicrotask !== "undefined" ? queueMicrotask.bind(_global) : typeof process !== "undefined" && process.nextTick || _setImmediate;
|
|
760
|
-
const isIterable = (thing) => thing != null && isFunction$1(thing[iterator]);
|
|
761
|
-
const isSafeIterable = (thing) => thing != null && hasOwnInPrototypeChain(thing, iterator) && isIterable(thing);
|
|
762
|
-
const utils$1 = {
|
|
763
|
-
isArray,
|
|
764
|
-
isArrayBuffer,
|
|
765
|
-
isBuffer,
|
|
766
|
-
isFormData,
|
|
767
|
-
isArrayBufferView,
|
|
768
|
-
isString,
|
|
769
|
-
isNumber,
|
|
770
|
-
isBoolean,
|
|
771
|
-
isObject,
|
|
772
|
-
isPlainObject,
|
|
773
|
-
isEmptyObject,
|
|
774
|
-
isReadableStream,
|
|
775
|
-
isRequest,
|
|
776
|
-
isResponse,
|
|
777
|
-
isHeaders,
|
|
778
|
-
isUndefined,
|
|
779
|
-
isDate,
|
|
780
|
-
isFile,
|
|
781
|
-
isReactNativeBlob,
|
|
782
|
-
isReactNative,
|
|
783
|
-
isBlob,
|
|
784
|
-
isRegExp,
|
|
785
|
-
isFunction: isFunction$1,
|
|
786
|
-
isStream,
|
|
787
|
-
isURLSearchParams,
|
|
788
|
-
isTypedArray,
|
|
789
|
-
isFileList,
|
|
790
|
-
forEach,
|
|
791
|
-
merge,
|
|
792
|
-
extend,
|
|
793
|
-
trim,
|
|
794
|
-
stripBOM,
|
|
795
|
-
inherits,
|
|
796
|
-
toFlatObject,
|
|
797
|
-
kindOf,
|
|
798
|
-
kindOfTest,
|
|
799
|
-
endsWith,
|
|
800
|
-
toArray,
|
|
801
|
-
forEachEntry,
|
|
802
|
-
matchAll,
|
|
803
|
-
isHTMLForm,
|
|
804
|
-
hasOwnProperty,
|
|
805
|
-
hasOwnProp: hasOwnProperty,
|
|
806
|
-
// an alias to avoid ESLint no-prototype-builtins detection
|
|
807
|
-
hasOwnInPrototypeChain,
|
|
808
|
-
getSafeProp,
|
|
809
|
-
toSafeFlatObject,
|
|
810
|
-
reduceDescriptors,
|
|
811
|
-
freezeMethods,
|
|
812
|
-
toObjectSet,
|
|
813
|
-
toCamelCase,
|
|
814
|
-
noop,
|
|
815
|
-
toFiniteNumber,
|
|
816
|
-
findKey,
|
|
817
|
-
global: _global,
|
|
818
|
-
isContextDefined,
|
|
819
|
-
isSpecCompliantForm,
|
|
820
|
-
toJSONObject,
|
|
821
|
-
isAsyncFn,
|
|
822
|
-
isThenable,
|
|
823
|
-
setImmediate: _setImmediate,
|
|
824
|
-
asap,
|
|
825
|
-
isIterable,
|
|
826
|
-
isSafeIterable
|
|
827
|
-
};
|
|
828
|
-
const ignoreDuplicateOf = utils$1.toObjectSet([
|
|
829
|
-
"age",
|
|
830
|
-
"authorization",
|
|
831
|
-
"content-length",
|
|
832
|
-
"content-type",
|
|
833
|
-
"etag",
|
|
834
|
-
"expires",
|
|
835
|
-
"from",
|
|
836
|
-
"host",
|
|
837
|
-
"if-modified-since",
|
|
838
|
-
"if-unmodified-since",
|
|
839
|
-
"last-modified",
|
|
840
|
-
"location",
|
|
841
|
-
"max-forwards",
|
|
842
|
-
"proxy-authorization",
|
|
843
|
-
"referer",
|
|
844
|
-
"retry-after",
|
|
845
|
-
"user-agent"
|
|
846
|
-
]);
|
|
847
|
-
const parseHeaders = (rawHeaders) => {
|
|
848
|
-
const parsed = {};
|
|
849
|
-
let key;
|
|
850
|
-
let val;
|
|
851
|
-
let i;
|
|
852
|
-
rawHeaders && rawHeaders.split("\n").forEach(function parser(line) {
|
|
853
|
-
i = line.indexOf(":");
|
|
854
|
-
key = line.substring(0, i).trim().toLowerCase();
|
|
855
|
-
val = line.substring(i + 1).trim();
|
|
856
|
-
const hasKey = utils$1.hasOwnProp(parsed, key);
|
|
857
|
-
if (!key || hasKey && utils$1.hasOwnProp(ignoreDuplicateOf, key)) {
|
|
858
|
-
return;
|
|
859
|
-
}
|
|
860
|
-
if (key === "set-cookie") {
|
|
861
|
-
if (hasKey) {
|
|
862
|
-
parsed[key].push(val);
|
|
863
|
-
} else {
|
|
864
|
-
parsed[key] = [val];
|
|
865
|
-
}
|
|
866
|
-
} else {
|
|
867
|
-
parsed[key] = hasKey ? parsed[key] + ", " + val : val;
|
|
868
|
-
}
|
|
869
|
-
});
|
|
870
|
-
return parsed;
|
|
871
|
-
};
|
|
872
|
-
function trimSPorHTAB(str) {
|
|
873
|
-
let start = 0;
|
|
874
|
-
let end = str.length;
|
|
875
|
-
while (start < end) {
|
|
876
|
-
const code = str.charCodeAt(start);
|
|
877
|
-
if (code !== 9 && code !== 32) {
|
|
878
|
-
break;
|
|
879
|
-
}
|
|
880
|
-
start += 1;
|
|
881
|
-
}
|
|
882
|
-
while (end > start) {
|
|
883
|
-
const code = str.charCodeAt(end - 1);
|
|
884
|
-
if (code !== 9 && code !== 32) {
|
|
885
|
-
break;
|
|
886
|
-
}
|
|
887
|
-
end -= 1;
|
|
888
|
-
}
|
|
889
|
-
return start === 0 && end === str.length ? str : str.slice(start, end);
|
|
890
|
-
}
|
|
891
|
-
const INVALID_UNICODE_HEADER_VALUE_CHARS = new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+", "g");
|
|
892
|
-
const INVALID_BYTE_STRING_HEADER_VALUE_CHARS = new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+", "g");
|
|
893
|
-
function sanitizeValue(value, invalidChars) {
|
|
894
|
-
if (utils$1.isArray(value)) {
|
|
895
|
-
return value.map((item) => sanitizeValue(item, invalidChars));
|
|
896
|
-
}
|
|
897
|
-
return trimSPorHTAB(String(value).replace(invalidChars, ""));
|
|
898
|
-
}
|
|
899
|
-
const sanitizeHeaderValue = (value) => sanitizeValue(value, INVALID_UNICODE_HEADER_VALUE_CHARS);
|
|
900
|
-
const sanitizeByteStringHeaderValue = (value) => sanitizeValue(value, INVALID_BYTE_STRING_HEADER_VALUE_CHARS);
|
|
901
|
-
function toByteStringHeaderObject(headers) {
|
|
902
|
-
const byteStringHeaders = /* @__PURE__ */ Object.create(null);
|
|
903
|
-
utils$1.forEach(headers.toJSON(), (value, header) => {
|
|
904
|
-
byteStringHeaders[header] = sanitizeByteStringHeaderValue(value);
|
|
905
|
-
});
|
|
906
|
-
return byteStringHeaders;
|
|
907
|
-
}
|
|
908
|
-
const $internals$1 = Symbol("internals");
|
|
909
|
-
function normalizeHeader(header) {
|
|
910
|
-
return header && String(header).trim().toLowerCase();
|
|
911
|
-
}
|
|
912
|
-
function normalizeValue(value) {
|
|
913
|
-
if (value === false || value == null) {
|
|
914
|
-
return value;
|
|
915
|
-
}
|
|
916
|
-
return utils$1.isArray(value) ? value.map(normalizeValue) : sanitizeHeaderValue(String(value));
|
|
917
|
-
}
|
|
918
|
-
function parseTokens(str) {
|
|
919
|
-
const tokens = /* @__PURE__ */ Object.create(null);
|
|
920
|
-
const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
|
|
921
|
-
let match;
|
|
922
|
-
while (match = tokensRE.exec(str)) {
|
|
923
|
-
tokens[match[1]] = match[2];
|
|
924
|
-
}
|
|
925
|
-
return tokens;
|
|
926
|
-
}
|
|
927
|
-
const parameterNameRE = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;
|
|
928
|
-
function trimOWS(value) {
|
|
929
|
-
let start = 0;
|
|
930
|
-
let end = value.length;
|
|
931
|
-
while (start < end) {
|
|
932
|
-
const code = value.charCodeAt(start);
|
|
933
|
-
if (code !== 9 && code !== 32) {
|
|
934
|
-
break;
|
|
935
|
-
}
|
|
936
|
-
start += 1;
|
|
937
|
-
}
|
|
938
|
-
while (end > start) {
|
|
939
|
-
const code = value.charCodeAt(end - 1);
|
|
940
|
-
if (code !== 9 && code !== 32) {
|
|
941
|
-
break;
|
|
942
|
-
}
|
|
943
|
-
end -= 1;
|
|
944
|
-
}
|
|
945
|
-
return start === 0 && end === value.length ? value : value.slice(start, end);
|
|
946
|
-
}
|
|
947
|
-
function decodeQuotedString(value) {
|
|
948
|
-
const last = value.length - 1;
|
|
949
|
-
if (last < 1 || value.charCodeAt(0) !== 34 || value.charCodeAt(last) !== 34) {
|
|
950
|
-
return value;
|
|
951
|
-
}
|
|
952
|
-
let decoded = "";
|
|
953
|
-
for (let i = 1; i < last; i++) {
|
|
954
|
-
const code = value.charCodeAt(i);
|
|
955
|
-
if (code === 34) {
|
|
956
|
-
return value;
|
|
957
|
-
}
|
|
958
|
-
if (code === 92) {
|
|
959
|
-
i += 1;
|
|
960
|
-
if (i >= last) {
|
|
961
|
-
return value;
|
|
962
|
-
}
|
|
963
|
-
}
|
|
964
|
-
decoded += value[i];
|
|
965
|
-
}
|
|
966
|
-
return decoded;
|
|
967
|
-
}
|
|
968
|
-
function parseParameters(value) {
|
|
969
|
-
const parameters = /* @__PURE__ */ Object.create(null);
|
|
970
|
-
const str = String(value);
|
|
971
|
-
let start = 0;
|
|
972
|
-
let quoted = false;
|
|
973
|
-
let escaped = false;
|
|
974
|
-
function parseParameter(end) {
|
|
975
|
-
const part = trimOWS(str.slice(start, end));
|
|
976
|
-
const equals = part.indexOf("=");
|
|
977
|
-
if (equals < 1) {
|
|
978
|
-
return;
|
|
979
|
-
}
|
|
980
|
-
const name = trimOWS(part.slice(0, equals));
|
|
981
|
-
if (!parameterNameRE.test(name)) {
|
|
982
|
-
return;
|
|
983
|
-
}
|
|
984
|
-
const normalizedName = name.toLowerCase();
|
|
985
|
-
if (normalizedName === "__proto__" || normalizedName === "constructor" || normalizedName === "prototype") {
|
|
986
|
-
return;
|
|
987
|
-
}
|
|
988
|
-
const parameterValue = trimOWS(part.slice(equals + 1));
|
|
989
|
-
parameters[normalizedName] = decodeQuotedString(parameterValue);
|
|
990
|
-
}
|
|
991
|
-
for (let i = 0; i < str.length; i++) {
|
|
992
|
-
const code = str.charCodeAt(i);
|
|
993
|
-
if (quoted) {
|
|
994
|
-
if (escaped) {
|
|
995
|
-
escaped = false;
|
|
996
|
-
} else if (code === 92) {
|
|
997
|
-
escaped = true;
|
|
998
|
-
} else if (code === 34) {
|
|
999
|
-
quoted = false;
|
|
1000
|
-
}
|
|
1001
|
-
} else if (code === 34) {
|
|
1002
|
-
quoted = true;
|
|
1003
|
-
} else if (code === 44 || code === 59) {
|
|
1004
|
-
parseParameter(i);
|
|
1005
|
-
start = i + 1;
|
|
1006
|
-
}
|
|
1007
|
-
}
|
|
1008
|
-
parseParameter(str.length);
|
|
1009
|
-
return parameters;
|
|
1010
|
-
}
|
|
1011
|
-
const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
|
|
1012
|
-
function matchHeaderValue(context, value, header, filter2, isHeaderNameFilter) {
|
|
1013
|
-
if (utils$1.isFunction(filter2)) {
|
|
1014
|
-
return filter2.call(this, value, header);
|
|
1015
|
-
}
|
|
1016
|
-
if (isHeaderNameFilter) {
|
|
1017
|
-
value = header;
|
|
1018
|
-
}
|
|
1019
|
-
if (!utils$1.isString(value)) return;
|
|
1020
|
-
if (utils$1.isString(filter2)) {
|
|
1021
|
-
return value.indexOf(filter2) !== -1;
|
|
1022
|
-
}
|
|
1023
|
-
if (utils$1.isRegExp(filter2)) {
|
|
1024
|
-
return filter2.test(value);
|
|
1025
|
-
}
|
|
1026
|
-
}
|
|
1027
|
-
function formatHeader(header) {
|
|
1028
|
-
return header.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => {
|
|
1029
|
-
return char.toUpperCase() + str;
|
|
1030
|
-
});
|
|
1031
|
-
}
|
|
1032
|
-
function buildAccessors(obj, header) {
|
|
1033
|
-
const accessorName = utils$1.toCamelCase(" " + header);
|
|
1034
|
-
["get", "set", "has"].forEach((methodName) => {
|
|
1035
|
-
Object.defineProperty(obj, methodName + accessorName, {
|
|
1036
|
-
// Null-proto descriptor so a polluted Object.prototype.get cannot turn
|
|
1037
|
-
// this data descriptor into an accessor descriptor on the way in.
|
|
1038
|
-
__proto__: null,
|
|
1039
|
-
value: function(arg1, arg2, arg3) {
|
|
1040
|
-
return this[methodName].call(this, header, arg1, arg2, arg3);
|
|
1041
|
-
},
|
|
1042
|
-
configurable: true
|
|
1043
|
-
});
|
|
1044
|
-
});
|
|
1045
|
-
}
|
|
1046
|
-
let AxiosHeaders$1 = class AxiosHeaders {
|
|
1047
|
-
constructor(headers) {
|
|
1048
|
-
headers && this.set(headers);
|
|
1049
|
-
}
|
|
1050
|
-
set(header, valueOrRewrite, rewrite) {
|
|
1051
|
-
const self2 = this;
|
|
1052
|
-
function setHeader(_value, _header, _rewrite) {
|
|
1053
|
-
const lHeader = normalizeHeader(_header);
|
|
1054
|
-
if (!lHeader) {
|
|
1055
|
-
return;
|
|
1056
|
-
}
|
|
1057
|
-
const key = utils$1.findKey(self2, lHeader);
|
|
1058
|
-
if (!key || self2[key] === void 0 || _rewrite === true || _rewrite === void 0 && self2[key] !== false) {
|
|
1059
|
-
self2[key || _header] = normalizeValue(_value);
|
|
1060
|
-
}
|
|
1061
|
-
}
|
|
1062
|
-
const setHeaders = (headers, _rewrite) => utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
|
|
1063
|
-
if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
|
|
1064
|
-
setHeaders(header, valueOrRewrite);
|
|
1065
|
-
} else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
|
|
1066
|
-
setHeaders(parseHeaders(header), valueOrRewrite);
|
|
1067
|
-
} else if (utils$1.isObject(header) && utils$1.isSafeIterable(header)) {
|
|
1068
|
-
let obj = /* @__PURE__ */ Object.create(null), dest, key;
|
|
1069
|
-
for (const entry of header) {
|
|
1070
|
-
if (!utils$1.isArray(entry)) {
|
|
1071
|
-
throw new TypeError("Object iterator must return a key-value pair");
|
|
1072
|
-
}
|
|
1073
|
-
key = entry[0];
|
|
1074
|
-
if (utils$1.hasOwnProp(obj, key)) {
|
|
1075
|
-
dest = obj[key];
|
|
1076
|
-
obj[key] = utils$1.isArray(dest) ? [...dest, entry[1]] : [dest, entry[1]];
|
|
1077
|
-
} else {
|
|
1078
|
-
obj[key] = entry[1];
|
|
1079
|
-
}
|
|
1080
|
-
}
|
|
1081
|
-
setHeaders(obj, valueOrRewrite);
|
|
1082
|
-
} else {
|
|
1083
|
-
header != null && setHeader(valueOrRewrite, header, rewrite);
|
|
1084
|
-
}
|
|
1085
|
-
return this;
|
|
1086
|
-
}
|
|
1087
|
-
get(header, parser) {
|
|
1088
|
-
header = normalizeHeader(header);
|
|
1089
|
-
if (header) {
|
|
1090
|
-
const key = utils$1.findKey(this, header);
|
|
1091
|
-
if (key) {
|
|
1092
|
-
const value = this[key];
|
|
1093
|
-
if (!parser) {
|
|
1094
|
-
return value;
|
|
1095
|
-
}
|
|
1096
|
-
if (parser === true) {
|
|
1097
|
-
return parseTokens(value);
|
|
1098
|
-
}
|
|
1099
|
-
if (utils$1.isFunction(parser)) {
|
|
1100
|
-
return parser.call(this, value, key);
|
|
1101
|
-
}
|
|
1102
|
-
if (utils$1.isRegExp(parser)) {
|
|
1103
|
-
return parser.exec(value);
|
|
1104
|
-
}
|
|
1105
|
-
throw new TypeError("parser must be boolean|regexp|function");
|
|
1106
|
-
}
|
|
1107
|
-
}
|
|
1108
|
-
}
|
|
1109
|
-
has(header, matcher) {
|
|
1110
|
-
header = normalizeHeader(header);
|
|
1111
|
-
if (header) {
|
|
1112
|
-
const key = utils$1.findKey(this, header);
|
|
1113
|
-
return !!(key && this[key] !== void 0 && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
|
|
1114
|
-
}
|
|
1115
|
-
return false;
|
|
1116
|
-
}
|
|
1117
|
-
delete(header, matcher) {
|
|
1118
|
-
const self2 = this;
|
|
1119
|
-
let deleted = false;
|
|
1120
|
-
function deleteHeader(_header) {
|
|
1121
|
-
_header = normalizeHeader(_header);
|
|
1122
|
-
if (_header) {
|
|
1123
|
-
const key = utils$1.findKey(self2, _header);
|
|
1124
|
-
if (key && (!matcher || matchHeaderValue(self2, self2[key], key, matcher))) {
|
|
1125
|
-
delete self2[key];
|
|
1126
|
-
deleted = true;
|
|
1127
|
-
}
|
|
1128
|
-
}
|
|
1129
|
-
}
|
|
1130
|
-
if (utils$1.isArray(header)) {
|
|
1131
|
-
header.forEach(deleteHeader);
|
|
1132
|
-
} else {
|
|
1133
|
-
deleteHeader(header);
|
|
1134
|
-
}
|
|
1135
|
-
return deleted;
|
|
1136
|
-
}
|
|
1137
|
-
clear(matcher) {
|
|
1138
|
-
const keys = Object.keys(this);
|
|
1139
|
-
let i = keys.length;
|
|
1140
|
-
let deleted = false;
|
|
1141
|
-
while (i--) {
|
|
1142
|
-
const key = keys[i];
|
|
1143
|
-
if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
|
|
1144
|
-
delete this[key];
|
|
1145
|
-
deleted = true;
|
|
1146
|
-
}
|
|
1147
|
-
}
|
|
1148
|
-
return deleted;
|
|
1149
|
-
}
|
|
1150
|
-
normalize(format2) {
|
|
1151
|
-
const self2 = this;
|
|
1152
|
-
const headers = {};
|
|
1153
|
-
utils$1.forEach(this, (value, header) => {
|
|
1154
|
-
const key = utils$1.findKey(headers, header);
|
|
1155
|
-
if (key) {
|
|
1156
|
-
self2[key] = normalizeValue(value);
|
|
1157
|
-
delete self2[header];
|
|
1158
|
-
return;
|
|
1159
|
-
}
|
|
1160
|
-
const normalized = format2 ? formatHeader(header) : String(header).trim();
|
|
1161
|
-
if (normalized !== header) {
|
|
1162
|
-
delete self2[header];
|
|
1163
|
-
}
|
|
1164
|
-
self2[normalized] = normalizeValue(value);
|
|
1165
|
-
headers[normalized] = true;
|
|
1166
|
-
});
|
|
1167
|
-
return this;
|
|
1168
|
-
}
|
|
1169
|
-
concat(...targets) {
|
|
1170
|
-
return this.constructor.concat(this, ...targets);
|
|
1171
|
-
}
|
|
1172
|
-
toJSON(asStrings) {
|
|
1173
|
-
const obj = /* @__PURE__ */ Object.create(null);
|
|
1174
|
-
utils$1.forEach(this, (value, header) => {
|
|
1175
|
-
value != null && value !== false && (obj[header] = asStrings && utils$1.isArray(value) ? value.join(", ") : value);
|
|
1176
|
-
});
|
|
1177
|
-
return obj;
|
|
1178
|
-
}
|
|
1179
|
-
[Symbol.iterator]() {
|
|
1180
|
-
return Object.entries(this.toJSON())[Symbol.iterator]();
|
|
1181
|
-
}
|
|
1182
|
-
toString() {
|
|
1183
|
-
return Object.entries(this.toJSON()).map(([header, value]) => header + ": " + value).join("\n");
|
|
1184
|
-
}
|
|
1185
|
-
getSetCookie() {
|
|
1186
|
-
const value = this.get("set-cookie");
|
|
1187
|
-
return utils$1.isArray(value) ? value : value == null || value === false ? [] : [value];
|
|
1188
|
-
}
|
|
1189
|
-
get [Symbol.toStringTag]() {
|
|
1190
|
-
return "AxiosHeaders";
|
|
1191
|
-
}
|
|
1192
|
-
static from(thing) {
|
|
1193
|
-
return thing instanceof this ? thing : new this(thing);
|
|
1194
|
-
}
|
|
1195
|
-
static parseParameters(value) {
|
|
1196
|
-
return parseParameters(value);
|
|
1197
|
-
}
|
|
1198
|
-
static concat(first, ...targets) {
|
|
1199
|
-
const computed = new this(first);
|
|
1200
|
-
targets.forEach((target) => computed.set(target));
|
|
1201
|
-
return computed;
|
|
1202
|
-
}
|
|
1203
|
-
static accessor(header) {
|
|
1204
|
-
const internals = this[$internals$1] = this[$internals$1] = {
|
|
1205
|
-
accessors: {}
|
|
1206
|
-
};
|
|
1207
|
-
const accessors = internals.accessors;
|
|
1208
|
-
const prototype2 = this.prototype;
|
|
1209
|
-
function defineAccessor(_header) {
|
|
1210
|
-
const lHeader = normalizeHeader(_header);
|
|
1211
|
-
if (!accessors[lHeader]) {
|
|
1212
|
-
buildAccessors(prototype2, _header);
|
|
1213
|
-
accessors[lHeader] = true;
|
|
1214
|
-
}
|
|
1215
|
-
}
|
|
1216
|
-
utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
|
|
1217
|
-
return this;
|
|
1218
|
-
}
|
|
1219
|
-
};
|
|
1220
|
-
AxiosHeaders$1.accessor([
|
|
1221
|
-
"Content-Type",
|
|
1222
|
-
"Content-Length",
|
|
1223
|
-
"Accept",
|
|
1224
|
-
"Accept-Encoding",
|
|
1225
|
-
"User-Agent",
|
|
1226
|
-
"Authorization"
|
|
1227
|
-
]);
|
|
1228
|
-
utils$1.reduceDescriptors(AxiosHeaders$1.prototype, ({ value }, key) => {
|
|
1229
|
-
let mapped = key[0].toUpperCase() + key.slice(1);
|
|
1230
|
-
return {
|
|
1231
|
-
get: () => value,
|
|
1232
|
-
set(headerValue) {
|
|
1233
|
-
this[mapped] = headerValue;
|
|
1234
|
-
}
|
|
1235
|
-
};
|
|
1236
|
-
});
|
|
1237
|
-
utils$1.freezeMethods(AxiosHeaders$1);
|
|
1238
|
-
const REDACTED = "[REDACTED ****]";
|
|
1239
|
-
function hasOwnOrPrototypeToJSON(source) {
|
|
1240
|
-
if (utils$1.hasOwnProp(source, "toJSON")) {
|
|
1241
|
-
return true;
|
|
1242
|
-
}
|
|
1243
|
-
let prototype2 = Object.getPrototypeOf(source);
|
|
1244
|
-
while (prototype2 && prototype2 !== Object.prototype) {
|
|
1245
|
-
if (utils$1.hasOwnProp(prototype2, "toJSON")) {
|
|
1246
|
-
return true;
|
|
1247
|
-
}
|
|
1248
|
-
prototype2 = Object.getPrototypeOf(prototype2);
|
|
1249
|
-
}
|
|
1250
|
-
return false;
|
|
1251
|
-
}
|
|
1252
|
-
function redactConfig(config, redactKeys) {
|
|
1253
|
-
const lowerKeys = new Set(redactKeys.map((k) => String(k).toLowerCase()));
|
|
1254
|
-
const seen = [];
|
|
1255
|
-
const visit = (source) => {
|
|
1256
|
-
if (source === null || typeof source !== "object") return source;
|
|
1257
|
-
if (utils$1.isBuffer(source)) return source;
|
|
1258
|
-
if (seen.indexOf(source) !== -1) return void 0;
|
|
1259
|
-
if (source instanceof AxiosHeaders$1) {
|
|
1260
|
-
source = source.toJSON();
|
|
1261
|
-
}
|
|
1262
|
-
seen.push(source);
|
|
1263
|
-
let result;
|
|
1264
|
-
if (utils$1.isArray(source)) {
|
|
1265
|
-
result = [];
|
|
1266
|
-
source.forEach((v, i) => {
|
|
1267
|
-
const reducedValue = visit(v);
|
|
1268
|
-
if (!utils$1.isUndefined(reducedValue)) {
|
|
1269
|
-
result[i] = reducedValue;
|
|
1270
|
-
}
|
|
1271
|
-
});
|
|
1272
|
-
} else {
|
|
1273
|
-
if (!utils$1.isPlainObject(source) && hasOwnOrPrototypeToJSON(source)) {
|
|
1274
|
-
seen.pop();
|
|
1275
|
-
return source;
|
|
1276
|
-
}
|
|
1277
|
-
result = /* @__PURE__ */ Object.create(null);
|
|
1278
|
-
for (const [key, value] of Object.entries(source)) {
|
|
1279
|
-
const reducedValue = lowerKeys.has(key.toLowerCase()) ? REDACTED : visit(value);
|
|
1280
|
-
if (!utils$1.isUndefined(reducedValue)) {
|
|
1281
|
-
result[key] = reducedValue;
|
|
1282
|
-
}
|
|
1283
|
-
}
|
|
1284
|
-
}
|
|
1285
|
-
seen.pop();
|
|
1286
|
-
return result;
|
|
1287
|
-
};
|
|
1288
|
-
return visit(config);
|
|
1289
|
-
}
|
|
1290
|
-
function stringifySafely$1(value) {
|
|
1291
|
-
try {
|
|
1292
|
-
return String(value);
|
|
1293
|
-
} catch (err) {
|
|
1294
|
-
return "";
|
|
1295
|
-
}
|
|
1296
|
-
}
|
|
1297
|
-
function aggregateErrorMessage(error) {
|
|
1298
|
-
const message = error.errors.map((entry) => {
|
|
1299
|
-
try {
|
|
1300
|
-
return entry && entry.message ? stringifySafely$1(entry.message) : stringifySafely$1(entry);
|
|
1301
|
-
} catch (err) {
|
|
1302
|
-
return "";
|
|
1303
|
-
}
|
|
1304
|
-
}).filter(Boolean).join("; ");
|
|
1305
|
-
return message || error.name || "AggregateError";
|
|
1306
|
-
}
|
|
1307
|
-
let AxiosError$1 = class AxiosError extends Error {
|
|
1308
|
-
static from(error, code, config, request, response, customProps) {
|
|
1309
|
-
let message = error.message;
|
|
1310
|
-
if (!message && utils$1.isArray(error.errors) && error.errors.length) {
|
|
1311
|
-
message = aggregateErrorMessage(error);
|
|
1312
|
-
}
|
|
1313
|
-
const axiosError = new AxiosError(message, code || error.code, config, request, response);
|
|
1314
|
-
Object.defineProperty(axiosError, "cause", {
|
|
1315
|
-
__proto__: null,
|
|
1316
|
-
value: error,
|
|
1317
|
-
writable: true,
|
|
1318
|
-
enumerable: false,
|
|
1319
|
-
configurable: true
|
|
1320
|
-
});
|
|
1321
|
-
axiosError.name = error.name;
|
|
1322
|
-
if (error.status != null && axiosError.status == null) {
|
|
1323
|
-
axiosError.status = error.status;
|
|
1324
|
-
}
|
|
1325
|
-
customProps && Object.assign(axiosError, customProps);
|
|
1326
|
-
return axiosError;
|
|
1327
|
-
}
|
|
1328
|
-
/**
|
|
1329
|
-
* Create an Error with the specified message, config, error code, request and response.
|
|
1330
|
-
*
|
|
1331
|
-
* @param {string} message The error message.
|
|
1332
|
-
* @param {string} [code] The error code (for example, 'ECONNABORTED').
|
|
1333
|
-
* @param {Object} [config] The config.
|
|
1334
|
-
* @param {Object} [request] The request.
|
|
1335
|
-
* @param {Object} [response] The response.
|
|
1336
|
-
*
|
|
1337
|
-
* @returns {Error} The created error.
|
|
1338
|
-
*/
|
|
1339
|
-
constructor(message, code, config, request, response) {
|
|
1340
|
-
super(message);
|
|
1341
|
-
Object.defineProperty(this, "message", {
|
|
1342
|
-
// Null-proto descriptor so a polluted Object.prototype.get cannot turn
|
|
1343
|
-
// this data descriptor into an accessor descriptor on the way in.
|
|
1344
|
-
__proto__: null,
|
|
1345
|
-
value: message,
|
|
1346
|
-
enumerable: true,
|
|
1347
|
-
writable: true,
|
|
1348
|
-
configurable: true
|
|
1349
|
-
});
|
|
1350
|
-
this.name = "AxiosError";
|
|
1351
|
-
this.isAxiosError = true;
|
|
1352
|
-
code && (this.code = code);
|
|
1353
|
-
config && (this.config = config);
|
|
1354
|
-
request && (this.request = request);
|
|
1355
|
-
if (response) {
|
|
1356
|
-
this.response = response;
|
|
1357
|
-
this.status = response.status;
|
|
1358
|
-
}
|
|
1359
|
-
}
|
|
1360
|
-
toJSON() {
|
|
1361
|
-
const config = this.config;
|
|
1362
|
-
const redactKeys = config && utils$1.hasOwnProp(config, "redact") ? config.redact : void 0;
|
|
1363
|
-
const serializedConfig = utils$1.isArray(redactKeys) && redactKeys.length > 0 ? redactConfig(config, redactKeys) : utils$1.toJSONObject(config);
|
|
1364
|
-
return {
|
|
1365
|
-
// Standard
|
|
1366
|
-
message: this.message,
|
|
1367
|
-
name: this.name,
|
|
1368
|
-
// Microsoft
|
|
1369
|
-
description: this.description,
|
|
1370
|
-
number: this.number,
|
|
1371
|
-
// Mozilla
|
|
1372
|
-
fileName: this.fileName,
|
|
1373
|
-
lineNumber: this.lineNumber,
|
|
1374
|
-
columnNumber: this.columnNumber,
|
|
1375
|
-
stack: this.stack,
|
|
1376
|
-
// Axios
|
|
1377
|
-
config: serializedConfig,
|
|
1378
|
-
code: this.code,
|
|
1379
|
-
status: this.status
|
|
1380
|
-
};
|
|
1381
|
-
}
|
|
1382
|
-
};
|
|
1383
|
-
AxiosError$1.ERR_BAD_OPTION_VALUE = "ERR_BAD_OPTION_VALUE";
|
|
1384
|
-
AxiosError$1.ERR_BAD_OPTION = "ERR_BAD_OPTION";
|
|
1385
|
-
AxiosError$1.ECONNABORTED = "ECONNABORTED";
|
|
1386
|
-
AxiosError$1.ETIMEDOUT = "ETIMEDOUT";
|
|
1387
|
-
AxiosError$1.ECONNREFUSED = "ECONNREFUSED";
|
|
1388
|
-
AxiosError$1.ERR_NETWORK = "ERR_NETWORK";
|
|
1389
|
-
AxiosError$1.ERR_FR_TOO_MANY_REDIRECTS = "ERR_FR_TOO_MANY_REDIRECTS";
|
|
1390
|
-
AxiosError$1.ERR_DEPRECATED = "ERR_DEPRECATED";
|
|
1391
|
-
AxiosError$1.ERR_BAD_RESPONSE = "ERR_BAD_RESPONSE";
|
|
1392
|
-
AxiosError$1.ERR_BAD_REQUEST = "ERR_BAD_REQUEST";
|
|
1393
|
-
AxiosError$1.ERR_CANCELED = "ERR_CANCELED";
|
|
1394
|
-
AxiosError$1.ERR_NOT_SUPPORT = "ERR_NOT_SUPPORT";
|
|
1395
|
-
AxiosError$1.ERR_INVALID_URL = "ERR_INVALID_URL";
|
|
1396
|
-
AxiosError$1.ERR_FORM_DATA_DEPTH_EXCEEDED = "ERR_FORM_DATA_DEPTH_EXCEEDED";
|
|
1397
|
-
const httpAdapter = null;
|
|
1398
|
-
const DEFAULT_FORM_DATA_MAX_DEPTH = 100;
|
|
1399
|
-
function isVisitable(thing) {
|
|
1400
|
-
return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
|
|
1401
|
-
}
|
|
1402
|
-
function removeBrackets(key) {
|
|
1403
|
-
return utils$1.endsWith(key, "[]") ? key.slice(0, -2) : key;
|
|
1404
|
-
}
|
|
1405
|
-
function renderKey(path, key, dots) {
|
|
1406
|
-
if (!path) return key;
|
|
1407
|
-
return path.concat(key).map(function each(token, i) {
|
|
1408
|
-
token = removeBrackets(token);
|
|
1409
|
-
return !dots && i ? "[" + token + "]" : token;
|
|
1410
|
-
}).join(dots ? "." : "");
|
|
1411
|
-
}
|
|
1412
|
-
function isFlatArray(arr) {
|
|
1413
|
-
return utils$1.isArray(arr) && !arr.some(isVisitable);
|
|
1414
|
-
}
|
|
1415
|
-
const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) {
|
|
1416
|
-
return /^is[A-Z]/.test(prop);
|
|
1417
|
-
});
|
|
1418
|
-
function toFormData$1(obj, formData, options) {
|
|
1419
|
-
if (!utils$1.isObject(obj)) {
|
|
1420
|
-
throw new TypeError("target must be an object");
|
|
1421
|
-
}
|
|
1422
|
-
formData = formData || new FormData();
|
|
1423
|
-
const option = (name, fallback) => {
|
|
1424
|
-
const value = utils$1.getSafeProp(options, name);
|
|
1425
|
-
return utils$1.isUndefined(value) ? fallback : value;
|
|
1426
|
-
};
|
|
1427
|
-
const metaTokens = option("metaTokens", true);
|
|
1428
|
-
const visitor = option("visitor") || defaultVisitor;
|
|
1429
|
-
const dots = option("dots", false);
|
|
1430
|
-
const indexes = option("indexes", false);
|
|
1431
|
-
const _Blob = option("Blob") || typeof Blob !== "undefined" && Blob;
|
|
1432
|
-
const maxDepth = option("maxDepth", DEFAULT_FORM_DATA_MAX_DEPTH);
|
|
1433
|
-
const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
|
|
1434
|
-
const stack = [];
|
|
1435
|
-
if (!utils$1.isFunction(visitor)) {
|
|
1436
|
-
throw new TypeError("visitor must be a function");
|
|
1437
|
-
}
|
|
1438
|
-
function convertValue(value) {
|
|
1439
|
-
if (value === null) return "";
|
|
1440
|
-
if (utils$1.isDate(value)) {
|
|
1441
|
-
return value.toISOString();
|
|
1442
|
-
}
|
|
1443
|
-
if (utils$1.isBoolean(value)) {
|
|
1444
|
-
return value.toString();
|
|
1445
|
-
}
|
|
1446
|
-
if (!useBlob && utils$1.isBlob(value)) {
|
|
1447
|
-
throw new AxiosError$1("Blob is not supported. Use a Buffer instead.");
|
|
1448
|
-
}
|
|
1449
|
-
if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
|
|
1450
|
-
if (useBlob && typeof _Blob === "function") {
|
|
1451
|
-
return new _Blob([value]);
|
|
1452
|
-
}
|
|
1453
|
-
throw new AxiosError$1(
|
|
1454
|
-
"Blob is not supported. Use a Buffer instead.",
|
|
1455
|
-
AxiosError$1.ERR_NOT_SUPPORT
|
|
1456
|
-
);
|
|
1457
|
-
}
|
|
1458
|
-
return value;
|
|
1459
|
-
}
|
|
1460
|
-
function throwIfMaxDepthExceeded(depth) {
|
|
1461
|
-
if (depth > maxDepth) {
|
|
1462
|
-
throw new AxiosError$1(
|
|
1463
|
-
"Object is too deeply nested (" + depth + " levels). Max depth: " + maxDepth,
|
|
1464
|
-
AxiosError$1.ERR_FORM_DATA_DEPTH_EXCEEDED
|
|
1465
|
-
);
|
|
1466
|
-
}
|
|
1467
|
-
}
|
|
1468
|
-
function stringifyWithDepthLimit(value, depth) {
|
|
1469
|
-
if (maxDepth === Infinity) {
|
|
1470
|
-
return JSON.stringify(value);
|
|
1471
|
-
}
|
|
1472
|
-
const ancestors = [];
|
|
1473
|
-
return JSON.stringify(value, function limitDepth(_key, currentValue) {
|
|
1474
|
-
if (!utils$1.isObject(currentValue)) {
|
|
1475
|
-
return currentValue;
|
|
1476
|
-
}
|
|
1477
|
-
while (ancestors.length && ancestors[ancestors.length - 1] !== this) {
|
|
1478
|
-
ancestors.pop();
|
|
1479
|
-
}
|
|
1480
|
-
ancestors.push(currentValue);
|
|
1481
|
-
throwIfMaxDepthExceeded(depth + ancestors.length - 1);
|
|
1482
|
-
return currentValue;
|
|
1483
|
-
});
|
|
1484
|
-
}
|
|
1485
|
-
function defaultVisitor(value, key, path) {
|
|
1486
|
-
let arr = value;
|
|
1487
|
-
if (utils$1.isReactNative(formData) && utils$1.isReactNativeBlob(value)) {
|
|
1488
|
-
formData.append(renderKey(path, key, dots), convertValue(value));
|
|
1489
|
-
return false;
|
|
1490
|
-
}
|
|
1491
|
-
if (value && !path && typeof value === "object") {
|
|
1492
|
-
if (utils$1.endsWith(key, "{}")) {
|
|
1493
|
-
key = metaTokens ? key : key.slice(0, -2);
|
|
1494
|
-
value = stringifyWithDepthLimit(value, 1);
|
|
1495
|
-
} else if (utils$1.isArray(value) && isFlatArray(value) || (utils$1.isFileList(value) || utils$1.endsWith(key, "[]")) && (arr = utils$1.toArray(value))) {
|
|
1496
|
-
key = removeBrackets(key);
|
|
1497
|
-
arr.forEach(function each(el, index2) {
|
|
1498
|
-
!(utils$1.isUndefined(el) || el === null) && formData.append(
|
|
1499
|
-
// eslint-disable-next-line no-nested-ternary
|
|
1500
|
-
indexes === true ? renderKey([key], index2, dots) : indexes === null ? key : key + "[]",
|
|
1501
|
-
convertValue(el)
|
|
1502
|
-
);
|
|
1503
|
-
});
|
|
1504
|
-
return false;
|
|
1505
|
-
}
|
|
1506
|
-
}
|
|
1507
|
-
if (isVisitable(value)) {
|
|
1508
|
-
return true;
|
|
1509
|
-
}
|
|
1510
|
-
formData.append(renderKey(path, key, dots), convertValue(value));
|
|
1511
|
-
return false;
|
|
1512
|
-
}
|
|
1513
|
-
const exposedHelpers = Object.assign(predicates, {
|
|
1514
|
-
defaultVisitor,
|
|
1515
|
-
convertValue,
|
|
1516
|
-
isVisitable
|
|
1517
|
-
});
|
|
1518
|
-
function build(value, path, depth = 0) {
|
|
1519
|
-
if (utils$1.isUndefined(value)) return;
|
|
1520
|
-
throwIfMaxDepthExceeded(depth);
|
|
1521
|
-
if (stack.indexOf(value) !== -1) {
|
|
1522
|
-
throw new Error("Circular reference detected in " + path.join("."));
|
|
1523
|
-
}
|
|
1524
|
-
stack.push(value);
|
|
1525
|
-
utils$1.forEach(value, function each(el, key) {
|
|
1526
|
-
const result = !(utils$1.isUndefined(el) || el === null) && visitor.call(formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers);
|
|
1527
|
-
if (result === true) {
|
|
1528
|
-
build(el, path ? path.concat(key) : [key], depth + 1);
|
|
1529
|
-
}
|
|
1530
|
-
});
|
|
1531
|
-
stack.pop();
|
|
1532
|
-
}
|
|
1533
|
-
if (!utils$1.isObject(obj)) {
|
|
1534
|
-
throw new TypeError("data must be an object");
|
|
1535
|
-
}
|
|
1536
|
-
build(obj);
|
|
1537
|
-
return formData;
|
|
1538
|
-
}
|
|
1539
|
-
function encode$1(str) {
|
|
1540
|
-
const charMap = {
|
|
1541
|
-
"!": "%21",
|
|
1542
|
-
"'": "%27",
|
|
1543
|
-
"(": "%28",
|
|
1544
|
-
")": "%29",
|
|
1545
|
-
"~": "%7E",
|
|
1546
|
-
"%20": "+"
|
|
1547
|
-
};
|
|
1548
|
-
return encodeURIComponent(str).replace(/[!'()~]|%20/g, function replacer(match) {
|
|
1549
|
-
return charMap[match];
|
|
1550
|
-
});
|
|
1551
|
-
}
|
|
1552
|
-
function AxiosURLSearchParams(params, options) {
|
|
1553
|
-
this._pairs = [];
|
|
1554
|
-
params && toFormData$1(params, this, options);
|
|
1555
|
-
}
|
|
1556
|
-
const prototype = AxiosURLSearchParams.prototype;
|
|
1557
|
-
prototype.append = function append(name, value) {
|
|
1558
|
-
this._pairs.push([name, value]);
|
|
1559
|
-
};
|
|
1560
|
-
prototype.toString = function toString2(encoder) {
|
|
1561
|
-
const _encode = encoder ? (value) => encoder.call(this, value, encode$1) : encode$1;
|
|
1562
|
-
return this._pairs.map(function each(pair) {
|
|
1563
|
-
return _encode(pair[0]) + "=" + _encode(pair[1]);
|
|
1564
|
-
}, "").join("&");
|
|
1565
|
-
};
|
|
1566
|
-
function encode(val) {
|
|
1567
|
-
return encodeURIComponent(val).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+");
|
|
1568
|
-
}
|
|
1569
|
-
function buildURL(url, params, options) {
|
|
1570
|
-
if (!params) {
|
|
1571
|
-
return url;
|
|
1572
|
-
}
|
|
1573
|
-
url = url || "";
|
|
1574
|
-
const _options = utils$1.isFunction(options) ? {
|
|
1575
|
-
serialize: options
|
|
1576
|
-
} : options;
|
|
1577
|
-
const _encode = utils$1.getSafeProp(_options, "encode") || encode;
|
|
1578
|
-
const serializeFn = utils$1.getSafeProp(_options, "serialize");
|
|
1579
|
-
let serializedParams;
|
|
1580
|
-
if (serializeFn) {
|
|
1581
|
-
serializedParams = serializeFn(params, _options);
|
|
1582
|
-
} else {
|
|
1583
|
-
serializedParams = utils$1.isURLSearchParams(params) ? params.toString() : new AxiosURLSearchParams(params, _options).toString(_encode);
|
|
1584
|
-
}
|
|
1585
|
-
if (serializedParams) {
|
|
1586
|
-
const hashmarkIndex = url.indexOf("#");
|
|
1587
|
-
if (hashmarkIndex !== -1) {
|
|
1588
|
-
url = url.slice(0, hashmarkIndex);
|
|
1589
|
-
}
|
|
1590
|
-
url += (url.indexOf("?") === -1 ? "?" : "&") + serializedParams;
|
|
1591
|
-
}
|
|
1592
|
-
return url;
|
|
1593
|
-
}
|
|
1594
|
-
const $internals = Symbol("internals");
|
|
1595
|
-
function countHandlers(handlers) {
|
|
1596
|
-
return handlers ? handlers.length : 0;
|
|
1597
|
-
}
|
|
1598
|
-
function trimHandlers(handlers) {
|
|
1599
|
-
if (!handlers) {
|
|
1600
|
-
return;
|
|
1601
|
-
}
|
|
1602
|
-
while (handlers.length && handlers[handlers.length - 1] === null) {
|
|
1603
|
-
handlers.pop();
|
|
1604
|
-
}
|
|
1605
|
-
}
|
|
1606
|
-
function syncHandlerEntries(manager, internals) {
|
|
1607
|
-
const handlers = manager.handlers;
|
|
1608
|
-
const length = countHandlers(handlers);
|
|
1609
|
-
if (handlers !== internals.handlersRef) {
|
|
1610
|
-
internals.handlersRef = handlers;
|
|
1611
|
-
internals.handlerEntries.clear();
|
|
1612
|
-
} else if (length !== internals.handlersLength) {
|
|
1613
|
-
if (!length) {
|
|
1614
|
-
internals.handlerEntries.clear();
|
|
1615
|
-
} else {
|
|
1616
|
-
internals.handlerEntries.forEach(function removeStaleEntry(entry, id) {
|
|
1617
|
-
if (handlers[entry.index] !== entry.handler) {
|
|
1618
|
-
internals.handlerEntries.delete(id);
|
|
1619
|
-
}
|
|
1620
|
-
});
|
|
1621
|
-
}
|
|
1622
|
-
}
|
|
1623
|
-
internals.handlersLength = length;
|
|
1624
|
-
}
|
|
1625
|
-
class InterceptorManager {
|
|
1626
|
-
constructor() {
|
|
1627
|
-
this.handlers = [];
|
|
1628
|
-
this[$internals] = {
|
|
1629
|
-
handlersRef: this.handlers,
|
|
1630
|
-
handlersLength: this.handlers.length,
|
|
1631
|
-
handlerEntries: /* @__PURE__ */ new Map(),
|
|
1632
|
-
iterationDepth: 0,
|
|
1633
|
-
nextId: 0
|
|
1634
|
-
};
|
|
1635
|
-
}
|
|
1636
|
-
/**
|
|
1637
|
-
* Add a new interceptor to the stack
|
|
1638
|
-
*
|
|
1639
|
-
* @param {Function} fulfilled The function to handle `then` for a `Promise`
|
|
1640
|
-
* @param {Function} rejected The function to handle `reject` for a `Promise`
|
|
1641
|
-
* @param {Object} options The options for the interceptor, synchronous and runWhen
|
|
1642
|
-
*
|
|
1643
|
-
* @return {Number} An ID used to remove interceptor later
|
|
1644
|
-
*/
|
|
1645
|
-
use(fulfilled, rejected, options) {
|
|
1646
|
-
const handler = {
|
|
1647
|
-
fulfilled,
|
|
1648
|
-
rejected,
|
|
1649
|
-
synchronous: options ? options.synchronous : false,
|
|
1650
|
-
runWhen: options ? options.runWhen : null
|
|
1651
|
-
};
|
|
1652
|
-
const internals = this[$internals];
|
|
1653
|
-
if (this.handlers == null) {
|
|
1654
|
-
this.handlers = [];
|
|
1655
|
-
}
|
|
1656
|
-
syncHandlerEntries(this, internals);
|
|
1657
|
-
const id = internals.nextId++;
|
|
1658
|
-
this.handlers.push(handler);
|
|
1659
|
-
internals.handlerEntries.set(id, {
|
|
1660
|
-
handler,
|
|
1661
|
-
index: this.handlers.length - 1
|
|
1662
|
-
});
|
|
1663
|
-
internals.handlersLength = this.handlers.length;
|
|
1664
|
-
return id;
|
|
1665
|
-
}
|
|
1666
|
-
/**
|
|
1667
|
-
* Remove an interceptor from the stack
|
|
1668
|
-
*
|
|
1669
|
-
* @param {Number} id The ID that was returned by `use`
|
|
1670
|
-
*
|
|
1671
|
-
* @returns {void}
|
|
1672
|
-
*/
|
|
1673
|
-
eject(id) {
|
|
1674
|
-
const internals = this[$internals];
|
|
1675
|
-
syncHandlerEntries(this, internals);
|
|
1676
|
-
const entry = internals.handlerEntries.get(id);
|
|
1677
|
-
if (entry) {
|
|
1678
|
-
internals.handlerEntries.delete(id);
|
|
1679
|
-
if (this.handlers[entry.index] !== entry.handler) {
|
|
1680
|
-
return;
|
|
1681
|
-
}
|
|
1682
|
-
this.handlers[entry.index] = null;
|
|
1683
|
-
if (!internals.iterationDepth) {
|
|
1684
|
-
trimHandlers(this.handlers);
|
|
1685
|
-
internals.handlersLength = this.handlers.length;
|
|
1686
|
-
}
|
|
1687
|
-
}
|
|
1688
|
-
}
|
|
1689
|
-
/**
|
|
1690
|
-
* Clear all interceptors from the stack
|
|
1691
|
-
*
|
|
1692
|
-
* @returns {void}
|
|
1693
|
-
*/
|
|
1694
|
-
clear() {
|
|
1695
|
-
if (this.handlers) {
|
|
1696
|
-
this.handlers = [];
|
|
1697
|
-
syncHandlerEntries(this, this[$internals]);
|
|
1698
|
-
}
|
|
1699
|
-
}
|
|
1700
|
-
/**
|
|
1701
|
-
* Iterate over all the registered interceptors
|
|
1702
|
-
*
|
|
1703
|
-
* This method is particularly useful for skipping over any
|
|
1704
|
-
* interceptors that may have become `null` calling `eject`.
|
|
1705
|
-
*
|
|
1706
|
-
* @param {Function} fn The function to call for each interceptor
|
|
1707
|
-
*
|
|
1708
|
-
* @returns {void}
|
|
1709
|
-
*/
|
|
1710
|
-
forEach(fn) {
|
|
1711
|
-
const internals = this[$internals];
|
|
1712
|
-
syncHandlerEntries(this, internals);
|
|
1713
|
-
internals.iterationDepth++;
|
|
1714
|
-
try {
|
|
1715
|
-
utils$1.forEach(this.handlers, function forEachHandler(h) {
|
|
1716
|
-
if (h !== null) {
|
|
1717
|
-
fn(h);
|
|
1718
|
-
}
|
|
1719
|
-
});
|
|
1720
|
-
} finally {
|
|
1721
|
-
if (!--internals.iterationDepth) {
|
|
1722
|
-
syncHandlerEntries(this, internals);
|
|
1723
|
-
trimHandlers(this.handlers);
|
|
1724
|
-
internals.handlersLength = countHandlers(this.handlers);
|
|
1725
|
-
}
|
|
1726
|
-
}
|
|
1727
|
-
}
|
|
1728
|
-
}
|
|
1729
|
-
const transitionalDefaults = {
|
|
1730
|
-
silentJSONParsing: true,
|
|
1731
|
-
forcedJSONParsing: true,
|
|
1732
|
-
clarifyTimeoutError: false,
|
|
1733
|
-
legacyInterceptorReqResOrdering: true,
|
|
1734
|
-
advertiseZstdAcceptEncoding: false,
|
|
1735
|
-
validateStatusUndefinedResolves: true
|
|
1736
|
-
};
|
|
1737
|
-
const URLSearchParams$1 = typeof URLSearchParams !== "undefined" ? URLSearchParams : AxiosURLSearchParams;
|
|
1738
|
-
const FormData$1 = typeof FormData !== "undefined" ? FormData : null;
|
|
1739
|
-
const Blob$1 = typeof Blob !== "undefined" ? Blob : null;
|
|
1740
|
-
const platform$1 = {
|
|
1741
|
-
isBrowser: true,
|
|
1742
|
-
classes: {
|
|
1743
|
-
URLSearchParams: URLSearchParams$1,
|
|
1744
|
-
FormData: FormData$1,
|
|
1745
|
-
Blob: Blob$1
|
|
1746
|
-
},
|
|
1747
|
-
protocols: ["http", "https", "file", "blob", "url", "data"]
|
|
1748
|
-
};
|
|
1749
|
-
const hasBrowserEnv = typeof window !== "undefined" && typeof document !== "undefined";
|
|
1750
|
-
const _navigator = typeof navigator === "object" && navigator || void 0;
|
|
1751
|
-
const hasStandardBrowserEnv = hasBrowserEnv && (!_navigator || ["ReactNative", "NativeScript", "NS"].indexOf(_navigator.product) < 0);
|
|
1752
|
-
const hasStandardBrowserWebWorkerEnv = (() => {
|
|
1753
|
-
return typeof WorkerGlobalScope !== "undefined" && // eslint-disable-next-line no-undef
|
|
1754
|
-
self instanceof WorkerGlobalScope && typeof self.importScripts === "function";
|
|
1755
|
-
})();
|
|
1756
|
-
const origin = hasBrowserEnv && window.location.href || "http://localhost";
|
|
1757
|
-
const utils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1758
|
-
__proto__: null,
|
|
1759
|
-
hasBrowserEnv,
|
|
1760
|
-
hasStandardBrowserEnv,
|
|
1761
|
-
hasStandardBrowserWebWorkerEnv,
|
|
1762
|
-
navigator: _navigator,
|
|
1763
|
-
origin
|
|
1764
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
1765
|
-
const platform = {
|
|
1766
|
-
...utils,
|
|
1767
|
-
...platform$1
|
|
1768
|
-
};
|
|
1769
|
-
function toURLEncodedForm(data, options) {
|
|
1770
|
-
return toFormData$1(data, new platform.classes.URLSearchParams(), {
|
|
1771
|
-
visitor: function(value, key, path, helpers) {
|
|
1772
|
-
if (platform.isNode && utils$1.isBuffer(value)) {
|
|
1773
|
-
this.append(key, value.toString("base64"));
|
|
1774
|
-
return false;
|
|
1775
|
-
}
|
|
1776
|
-
return helpers.defaultVisitor.apply(this, arguments);
|
|
1777
|
-
},
|
|
1778
|
-
...options
|
|
1779
|
-
});
|
|
1780
|
-
}
|
|
1781
|
-
const MAX_DEPTH = DEFAULT_FORM_DATA_MAX_DEPTH;
|
|
1782
|
-
function throwIfDepthExceeded(index2) {
|
|
1783
|
-
if (index2 > MAX_DEPTH) {
|
|
1784
|
-
throw new AxiosError$1(
|
|
1785
|
-
"FormData field is too deeply nested (" + index2 + " levels). Max depth: " + MAX_DEPTH,
|
|
1786
|
-
AxiosError$1.ERR_FORM_DATA_DEPTH_EXCEEDED
|
|
1787
|
-
);
|
|
1788
|
-
}
|
|
1789
|
-
}
|
|
1790
|
-
function parsePropPath(name) {
|
|
1791
|
-
const path = [];
|
|
1792
|
-
const pattern = /[^.[\]]+|\[([^.[\]]*)]/g;
|
|
1793
|
-
let match;
|
|
1794
|
-
while ((match = pattern.exec(name)) !== null) {
|
|
1795
|
-
throwIfDepthExceeded(path.length);
|
|
1796
|
-
path.push(match[0] === "[]" ? "" : match[1] || match[0]);
|
|
1797
|
-
}
|
|
1798
|
-
return path;
|
|
1799
|
-
}
|
|
1800
|
-
function arrayToObject(arr) {
|
|
1801
|
-
const obj = {};
|
|
1802
|
-
const keys = Object.keys(arr);
|
|
1803
|
-
let i;
|
|
1804
|
-
const len = keys.length;
|
|
1805
|
-
let key;
|
|
1806
|
-
for (i = 0; i < len; i++) {
|
|
1807
|
-
key = keys[i];
|
|
1808
|
-
obj[key] = arr[key];
|
|
1809
|
-
}
|
|
1810
|
-
return obj;
|
|
1811
|
-
}
|
|
1812
|
-
function formDataToJSON(formData) {
|
|
1813
|
-
function buildPath(path, value, target, index2) {
|
|
1814
|
-
throwIfDepthExceeded(index2);
|
|
1815
|
-
let name = path[index2++];
|
|
1816
|
-
if (name === "__proto__") return true;
|
|
1817
|
-
const isNumericKey = Number.isFinite(+name);
|
|
1818
|
-
const isLast = index2 >= path.length;
|
|
1819
|
-
name = !name && utils$1.isArray(target) ? target.length : name;
|
|
1820
|
-
if (isLast) {
|
|
1821
|
-
if (utils$1.hasOwnProp(target, name)) {
|
|
1822
|
-
target[name] = utils$1.isArray(target[name]) ? target[name].concat(value) : [target[name], value];
|
|
1823
|
-
} else {
|
|
1824
|
-
target[name] = value;
|
|
1825
|
-
}
|
|
1826
|
-
return !isNumericKey;
|
|
1827
|
-
}
|
|
1828
|
-
if (!utils$1.hasOwnProp(target, name) || !utils$1.isObject(target[name])) {
|
|
1829
|
-
target[name] = [];
|
|
1830
|
-
}
|
|
1831
|
-
const result = buildPath(path, value, target[name], index2);
|
|
1832
|
-
if (result && utils$1.isArray(target[name])) {
|
|
1833
|
-
target[name] = arrayToObject(target[name]);
|
|
1834
|
-
}
|
|
1835
|
-
return !isNumericKey;
|
|
1836
|
-
}
|
|
1837
|
-
if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {
|
|
1838
|
-
const obj = {};
|
|
1839
|
-
utils$1.forEachEntry(formData, (name, value) => {
|
|
1840
|
-
buildPath(parsePropPath(name), value, obj, 0);
|
|
1841
|
-
});
|
|
1842
|
-
return obj;
|
|
1843
|
-
}
|
|
1844
|
-
return null;
|
|
1845
|
-
}
|
|
1846
|
-
const methodList = Object.freeze([
|
|
1847
|
-
"get",
|
|
1848
|
-
"delete",
|
|
1849
|
-
"head",
|
|
1850
|
-
"options",
|
|
1851
|
-
"post",
|
|
1852
|
-
"put",
|
|
1853
|
-
"patch",
|
|
1854
|
-
"purge",
|
|
1855
|
-
"link",
|
|
1856
|
-
"unlink",
|
|
1857
|
-
"query"
|
|
1858
|
-
]);
|
|
1859
|
-
const own = (obj, key) => obj != null && utils$1.hasOwnProp(obj, key) ? obj[key] : void 0;
|
|
1860
|
-
function stringifySafely(rawValue, parser, encoder) {
|
|
1861
|
-
if (utils$1.isString(rawValue)) {
|
|
1862
|
-
try {
|
|
1863
|
-
(parser || JSON.parse)(rawValue);
|
|
1864
|
-
return utils$1.trim(rawValue);
|
|
1865
|
-
} catch (e) {
|
|
1866
|
-
if (e.name !== "SyntaxError") {
|
|
1867
|
-
throw e;
|
|
1868
|
-
}
|
|
1869
|
-
}
|
|
1870
|
-
}
|
|
1871
|
-
return (encoder || JSON.stringify)(rawValue);
|
|
1872
|
-
}
|
|
1873
|
-
const defaults = {
|
|
1874
|
-
transitional: transitionalDefaults,
|
|
1875
|
-
adapter: ["xhr", "http", "fetch"],
|
|
1876
|
-
transformRequest: [
|
|
1877
|
-
function transformRequest(data, headers) {
|
|
1878
|
-
const contentType = headers.getContentType() || "";
|
|
1879
|
-
const hasJSONContentType = contentType.indexOf("application/json") > -1;
|
|
1880
|
-
const isObjectPayload = utils$1.isObject(data);
|
|
1881
|
-
if (isObjectPayload && utils$1.isHTMLForm(data)) {
|
|
1882
|
-
data = new FormData(data);
|
|
1883
|
-
}
|
|
1884
|
-
const isFormData2 = utils$1.isFormData(data);
|
|
1885
|
-
if (isFormData2) {
|
|
1886
|
-
return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
|
|
1887
|
-
}
|
|
1888
|
-
if (utils$1.isArrayBuffer(data) || utils$1.isBuffer(data) || utils$1.isStream(data) || utils$1.isFile(data) || utils$1.isBlob(data) || utils$1.isReadableStream(data)) {
|
|
1889
|
-
return data;
|
|
1890
|
-
}
|
|
1891
|
-
if (utils$1.isArrayBufferView(data)) {
|
|
1892
|
-
return data.buffer;
|
|
1893
|
-
}
|
|
1894
|
-
if (utils$1.isURLSearchParams(data)) {
|
|
1895
|
-
headers.setContentType("application/x-www-form-urlencoded;charset=utf-8", false);
|
|
1896
|
-
return data.toString();
|
|
1897
|
-
}
|
|
1898
|
-
let isFileList2;
|
|
1899
|
-
if (isObjectPayload) {
|
|
1900
|
-
const formSerializer = own(this, "formSerializer");
|
|
1901
|
-
if (contentType.indexOf("application/x-www-form-urlencoded") > -1) {
|
|
1902
|
-
return toURLEncodedForm(data, formSerializer).toString();
|
|
1903
|
-
}
|
|
1904
|
-
if ((isFileList2 = utils$1.isFileList(data)) || contentType.indexOf("multipart/form-data") > -1) {
|
|
1905
|
-
const env = own(this, "env");
|
|
1906
|
-
const _FormData = env && env.FormData;
|
|
1907
|
-
return toFormData$1(
|
|
1908
|
-
isFileList2 ? { "files[]": data } : data,
|
|
1909
|
-
_FormData && new _FormData(),
|
|
1910
|
-
formSerializer
|
|
1911
|
-
);
|
|
1912
|
-
}
|
|
1913
|
-
}
|
|
1914
|
-
if (isObjectPayload || hasJSONContentType) {
|
|
1915
|
-
headers.setContentType("application/json", false);
|
|
1916
|
-
return stringifySafely(data);
|
|
1917
|
-
}
|
|
1918
|
-
return data;
|
|
1919
|
-
}
|
|
1920
|
-
],
|
|
1921
|
-
transformResponse: [
|
|
1922
|
-
function transformResponse(data) {
|
|
1923
|
-
const transitional2 = own(this, "transitional") || defaults.transitional;
|
|
1924
|
-
const forcedJSONParsing = transitional2 && transitional2.forcedJSONParsing;
|
|
1925
|
-
const responseType = own(this, "responseType");
|
|
1926
|
-
const JSONRequested = responseType === "json";
|
|
1927
|
-
if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
|
|
1928
|
-
return data;
|
|
1929
|
-
}
|
|
1930
|
-
if (data && utils$1.isString(data) && (forcedJSONParsing && !responseType || JSONRequested)) {
|
|
1931
|
-
const silentJSONParsing = transitional2 && transitional2.silentJSONParsing;
|
|
1932
|
-
const strictJSONParsing = !silentJSONParsing && JSONRequested;
|
|
1933
|
-
try {
|
|
1934
|
-
return JSON.parse(data, own(this, "parseReviver"));
|
|
1935
|
-
} catch (e) {
|
|
1936
|
-
if (strictJSONParsing) {
|
|
1937
|
-
if (e.name === "SyntaxError") {
|
|
1938
|
-
throw AxiosError$1.from(e, AxiosError$1.ERR_BAD_RESPONSE, this, null, own(this, "response"));
|
|
1939
|
-
}
|
|
1940
|
-
throw e;
|
|
1941
|
-
}
|
|
1942
|
-
}
|
|
1943
|
-
}
|
|
1944
|
-
return data;
|
|
1945
|
-
}
|
|
1946
|
-
],
|
|
1947
|
-
/**
|
|
1948
|
-
* A timeout in milliseconds to abort a request. If set to 0 (default) a
|
|
1949
|
-
* timeout is not created.
|
|
1950
|
-
*/
|
|
1951
|
-
timeout: 0,
|
|
1952
|
-
xsrfCookieName: "XSRF-TOKEN",
|
|
1953
|
-
xsrfHeaderName: "X-XSRF-TOKEN",
|
|
1954
|
-
maxContentLength: -1,
|
|
1955
|
-
maxBodyLength: -1,
|
|
1956
|
-
env: {
|
|
1957
|
-
FormData: platform.classes.FormData,
|
|
1958
|
-
Blob: platform.classes.Blob
|
|
1959
|
-
},
|
|
1960
|
-
validateStatus: function validateStatus(status2) {
|
|
1961
|
-
return status2 >= 200 && status2 < 300;
|
|
1962
|
-
},
|
|
1963
|
-
headers: {
|
|
1964
|
-
common: {
|
|
1965
|
-
Accept: "application/json, text/plain, */*",
|
|
1966
|
-
"Content-Type": void 0
|
|
1967
|
-
}
|
|
1968
|
-
}
|
|
1969
|
-
};
|
|
1970
|
-
utils$1.forEach(methodList, (method) => {
|
|
1971
|
-
defaults.headers[method] = {};
|
|
1972
|
-
});
|
|
1973
|
-
function transformData(fns, response) {
|
|
1974
|
-
const config = this || defaults;
|
|
1975
|
-
const context = response || config;
|
|
1976
|
-
const headers = AxiosHeaders$1.from(context.headers);
|
|
1977
|
-
let data = context.data;
|
|
1978
|
-
utils$1.forEach(fns, function transform(fn) {
|
|
1979
|
-
data = fn.call(config, data, headers.normalize(), response ? response.status : void 0);
|
|
1980
|
-
});
|
|
1981
|
-
headers.normalize();
|
|
1982
|
-
return data;
|
|
1983
|
-
}
|
|
1984
|
-
function isCancel$1(value) {
|
|
1985
|
-
return !!(value && value.__CANCEL__);
|
|
1986
|
-
}
|
|
1987
|
-
let CanceledError$1 = class CanceledError extends AxiosError$1 {
|
|
1988
|
-
/**
|
|
1989
|
-
* A `CanceledError` is an object that is thrown when an operation is canceled.
|
|
1990
|
-
*
|
|
1991
|
-
* @param {string=} message The message.
|
|
1992
|
-
* @param {Object=} config The config.
|
|
1993
|
-
* @param {Object=} request The request.
|
|
1994
|
-
*
|
|
1995
|
-
* @returns {CanceledError} The created error.
|
|
1996
|
-
*/
|
|
1997
|
-
constructor(message, config, request) {
|
|
1998
|
-
super(message == null ? "canceled" : message, AxiosError$1.ERR_CANCELED, config, request);
|
|
1999
|
-
this.name = "CanceledError";
|
|
2000
|
-
this.__CANCEL__ = true;
|
|
2001
|
-
}
|
|
2002
|
-
};
|
|
2003
|
-
function settle(resolve, reject, response) {
|
|
2004
|
-
const validateStatus2 = response.config.validateStatus;
|
|
2005
|
-
if (!response.status || !validateStatus2 || validateStatus2(response.status)) {
|
|
2006
|
-
resolve(response);
|
|
2007
|
-
} else {
|
|
2008
|
-
reject(new AxiosError$1(
|
|
2009
|
-
"Request failed with status code " + response.status,
|
|
2010
|
-
response.status >= 400 && response.status < 500 ? AxiosError$1.ERR_BAD_REQUEST : AxiosError$1.ERR_BAD_RESPONSE,
|
|
2011
|
-
response.config,
|
|
2012
|
-
response.request,
|
|
2013
|
-
response
|
|
2014
|
-
));
|
|
2015
|
-
}
|
|
2016
|
-
}
|
|
2017
|
-
const urlParserControlCharacters = /[\t\n\r]/g;
|
|
2018
|
-
function normalizeURLForProtocolCheck(url) {
|
|
2019
|
-
if (typeof url !== "string") {
|
|
2020
|
-
return url;
|
|
2021
|
-
}
|
|
2022
|
-
let start = 0;
|
|
2023
|
-
while (start < url.length && url.charCodeAt(start) <= 32) {
|
|
2024
|
-
start++;
|
|
2025
|
-
}
|
|
2026
|
-
return url.slice(start).replace(urlParserControlCharacters, "");
|
|
2027
|
-
}
|
|
2028
|
-
function parseProtocol(url) {
|
|
2029
|
-
const match = /^([-+\w]{1,25}):(?:\/\/)?/.exec(url);
|
|
2030
|
-
return match && match[1] || "";
|
|
2031
|
-
}
|
|
2032
|
-
function speedometer(samplesCount, min) {
|
|
2033
|
-
samplesCount = samplesCount || 10;
|
|
2034
|
-
const bytes = new Array(samplesCount);
|
|
2035
|
-
const timestamps = new Array(samplesCount);
|
|
2036
|
-
let head = 0;
|
|
2037
|
-
let tail = 0;
|
|
2038
|
-
let firstSampleTS;
|
|
2039
|
-
min = min !== void 0 ? min : 1e3;
|
|
2040
|
-
return function push(chunkLength) {
|
|
2041
|
-
const now = Date.now();
|
|
2042
|
-
const startedAt = timestamps[tail];
|
|
2043
|
-
if (!firstSampleTS) {
|
|
2044
|
-
firstSampleTS = now;
|
|
2045
|
-
}
|
|
2046
|
-
bytes[head] = chunkLength;
|
|
2047
|
-
timestamps[head] = now;
|
|
2048
|
-
let i = tail;
|
|
2049
|
-
let bytesCount = 0;
|
|
2050
|
-
while (i !== head) {
|
|
2051
|
-
bytesCount += bytes[i++];
|
|
2052
|
-
i = i % samplesCount;
|
|
2053
|
-
}
|
|
2054
|
-
head = (head + 1) % samplesCount;
|
|
2055
|
-
if (head === tail) {
|
|
2056
|
-
tail = (tail + 1) % samplesCount;
|
|
2057
|
-
}
|
|
2058
|
-
if (now - firstSampleTS < min) {
|
|
2059
|
-
return;
|
|
2060
|
-
}
|
|
2061
|
-
const passed = startedAt && now - startedAt;
|
|
2062
|
-
return passed ? Math.round(bytesCount * 1e3 / passed) : void 0;
|
|
2063
|
-
};
|
|
2064
|
-
}
|
|
2065
|
-
function throttle(fn, freq) {
|
|
2066
|
-
let timestamp = 0;
|
|
2067
|
-
let threshold = 1e3 / freq;
|
|
2068
|
-
let lastArgs;
|
|
2069
|
-
let timer;
|
|
2070
|
-
const invoke = (args, now = Date.now()) => {
|
|
2071
|
-
timestamp = now;
|
|
2072
|
-
lastArgs = null;
|
|
2073
|
-
if (timer) {
|
|
2074
|
-
clearTimeout(timer);
|
|
2075
|
-
timer = null;
|
|
2076
|
-
}
|
|
2077
|
-
fn(...args);
|
|
2078
|
-
};
|
|
2079
|
-
const throttled = (...args) => {
|
|
2080
|
-
const now = Date.now();
|
|
2081
|
-
const passed = now - timestamp;
|
|
2082
|
-
if (passed >= threshold) {
|
|
2083
|
-
invoke(args, now);
|
|
2084
|
-
} else {
|
|
2085
|
-
lastArgs = args;
|
|
2086
|
-
if (!timer) {
|
|
2087
|
-
timer = setTimeout(() => {
|
|
2088
|
-
timer = null;
|
|
2089
|
-
invoke(lastArgs);
|
|
2090
|
-
}, threshold - passed);
|
|
2091
|
-
}
|
|
2092
|
-
}
|
|
2093
|
-
};
|
|
2094
|
-
const flush = () => lastArgs && invoke(lastArgs);
|
|
2095
|
-
const flushWith = (...args) => invoke(args);
|
|
2096
|
-
return [throttled, flush, flushWith];
|
|
2097
|
-
}
|
|
2098
|
-
const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
|
|
2099
|
-
let bytesNotified = 0;
|
|
2100
|
-
const _speedometer = speedometer(50, 250);
|
|
2101
|
-
return throttle((e) => {
|
|
2102
|
-
if (!e || !utils$1.isNumber(e.loaded)) {
|
|
2103
|
-
return;
|
|
2104
|
-
}
|
|
2105
|
-
const rawLoaded = e.loaded;
|
|
2106
|
-
const total = e.lengthComputable ? e.total : void 0;
|
|
2107
|
-
const loaded = Math.max(0, total != null ? Math.min(rawLoaded, total) : rawLoaded);
|
|
2108
|
-
const progressBytes = Math.max(0, loaded - bytesNotified);
|
|
2109
|
-
const rate = _speedometer(progressBytes);
|
|
2110
|
-
bytesNotified = Math.max(bytesNotified, loaded);
|
|
2111
|
-
const data = {
|
|
2112
|
-
loaded,
|
|
2113
|
-
total,
|
|
2114
|
-
progress: total ? loaded / total : void 0,
|
|
2115
|
-
bytes: progressBytes,
|
|
2116
|
-
rate: rate ? rate : void 0,
|
|
2117
|
-
estimated: rate && total ? (total - loaded) / rate : void 0,
|
|
2118
|
-
event: e,
|
|
2119
|
-
lengthComputable: total != null,
|
|
2120
|
-
[isDownloadStream ? "download" : "upload"]: true
|
|
2121
|
-
};
|
|
2122
|
-
listener(data);
|
|
2123
|
-
}, freq);
|
|
2124
|
-
};
|
|
2125
|
-
const progressEventDecorator = (total, throttled) => {
|
|
2126
|
-
const lengthComputable = total != null;
|
|
2127
|
-
return [
|
|
2128
|
-
(loaded) => throttled[0]({
|
|
2129
|
-
lengthComputable,
|
|
2130
|
-
total,
|
|
2131
|
-
loaded
|
|
2132
|
-
}),
|
|
2133
|
-
throttled[1]
|
|
2134
|
-
];
|
|
2135
|
-
};
|
|
2136
|
-
const asyncDecorator = (fn, scheduler = utils$1.asap) => (...args) => scheduler(() => fn(...args));
|
|
2137
|
-
const isURLSameOrigin = platform.hasStandardBrowserEnv ? /* @__PURE__ */ ((origin2, isMSIE) => (url) => {
|
|
2138
|
-
url = new URL(url, platform.origin);
|
|
2139
|
-
return origin2.protocol === url.protocol && origin2.host === url.host && (isMSIE || origin2.port === url.port);
|
|
2140
|
-
})(
|
|
2141
|
-
new URL(platform.origin),
|
|
2142
|
-
platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)
|
|
2143
|
-
) : () => true;
|
|
2144
|
-
const cookies = platform.hasStandardBrowserEnv ? (
|
|
2145
|
-
// Standard browser envs support document.cookie
|
|
2146
|
-
{
|
|
2147
|
-
write(name, value, expires, path, domain, secure, sameSite) {
|
|
2148
|
-
if (typeof document === "undefined") return;
|
|
2149
|
-
const cookie = [`${name}=${encodeURIComponent(value)}`];
|
|
2150
|
-
if (utils$1.isNumber(expires)) {
|
|
2151
|
-
cookie.push(`expires=${new Date(expires).toUTCString()}`);
|
|
2152
|
-
}
|
|
2153
|
-
if (utils$1.isString(path)) {
|
|
2154
|
-
cookie.push(`path=${path}`);
|
|
2155
|
-
}
|
|
2156
|
-
if (utils$1.isString(domain)) {
|
|
2157
|
-
cookie.push(`domain=${domain}`);
|
|
2158
|
-
}
|
|
2159
|
-
if (secure === true) {
|
|
2160
|
-
cookie.push("secure");
|
|
2161
|
-
}
|
|
2162
|
-
if (utils$1.isString(sameSite)) {
|
|
2163
|
-
cookie.push(`SameSite=${sameSite}`);
|
|
2164
|
-
}
|
|
2165
|
-
document.cookie = cookie.join("; ");
|
|
2166
|
-
},
|
|
2167
|
-
read(name) {
|
|
2168
|
-
if (typeof document === "undefined") return null;
|
|
2169
|
-
const cookies2 = document.cookie.split(";");
|
|
2170
|
-
for (let i = 0; i < cookies2.length; i++) {
|
|
2171
|
-
const cookie = cookies2[i].replace(/^\s+/, "");
|
|
2172
|
-
const eq = cookie.indexOf("=");
|
|
2173
|
-
if (eq !== -1 && cookie.slice(0, eq) === name) {
|
|
2174
|
-
try {
|
|
2175
|
-
return decodeURIComponent(cookie.slice(eq + 1));
|
|
2176
|
-
} catch (e) {
|
|
2177
|
-
return cookie.slice(eq + 1);
|
|
2178
|
-
}
|
|
2179
|
-
}
|
|
2180
|
-
}
|
|
2181
|
-
return null;
|
|
2182
|
-
},
|
|
2183
|
-
remove(name) {
|
|
2184
|
-
this.write(name, "", Date.now() - 864e5, "/");
|
|
2185
|
-
}
|
|
2186
|
-
}
|
|
2187
|
-
) : (
|
|
2188
|
-
// Non-standard browser env (web workers, react-native) lack needed support.
|
|
2189
|
-
{
|
|
2190
|
-
write() {
|
|
2191
|
-
},
|
|
2192
|
-
read() {
|
|
2193
|
-
return null;
|
|
2194
|
-
},
|
|
2195
|
-
remove() {
|
|
2196
|
-
}
|
|
2197
|
-
}
|
|
2198
|
-
);
|
|
2199
|
-
function isAbsoluteURL(url) {
|
|
2200
|
-
if (typeof url !== "string") {
|
|
2201
|
-
return false;
|
|
2202
|
-
}
|
|
2203
|
-
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
|
|
2204
|
-
}
|
|
2205
|
-
function combineURLs(baseURL, relativeURL) {
|
|
2206
|
-
if (!relativeURL) {
|
|
2207
|
-
return baseURL;
|
|
2208
|
-
}
|
|
2209
|
-
let end = baseURL.length;
|
|
2210
|
-
while (end > 0 && baseURL.charCodeAt(end - 1) === 47) {
|
|
2211
|
-
end--;
|
|
2212
|
-
}
|
|
2213
|
-
return baseURL.slice(0, end) + "/" + relativeURL.replace(/^\/+/, "");
|
|
2214
|
-
}
|
|
2215
|
-
const malformedHttpProtocol = /^https?:(?!\/\/)/i;
|
|
2216
|
-
function redactFragment(fragment) {
|
|
2217
|
-
if (!fragment) {
|
|
2218
|
-
return fragment;
|
|
2219
|
-
}
|
|
2220
|
-
return fragment.replace(/(^|&)([^=&]*=)?[^&]+/g, (match, separator, parameterName = "") => {
|
|
2221
|
-
return `${separator}${parameterName}${REDACTED}`;
|
|
2222
|
-
});
|
|
2223
|
-
}
|
|
2224
|
-
function redactSensitiveURLParts(url) {
|
|
2225
|
-
const redactedURL = url.replace(/^(https?:\/{0,2})[^/?#]*@/i, `$1${REDACTED}@`);
|
|
2226
|
-
const fragmentIndex = redactedURL.indexOf("#");
|
|
2227
|
-
const urlWithoutFragment = fragmentIndex === -1 ? redactedURL : redactedURL.slice(0, fragmentIndex);
|
|
2228
|
-
const redactedURLWithoutFragment = urlWithoutFragment.replace(
|
|
2229
|
-
/([?&][^=&#]*=)[^&#]*/g,
|
|
2230
|
-
`$1${REDACTED}`
|
|
2231
|
-
);
|
|
2232
|
-
if (fragmentIndex === -1) {
|
|
2233
|
-
return redactedURLWithoutFragment;
|
|
2234
|
-
}
|
|
2235
|
-
return `${redactedURLWithoutFragment}#${redactFragment(redactedURL.slice(fragmentIndex + 1))}`;
|
|
2236
|
-
}
|
|
2237
|
-
function assertValidHttpProtocolURL(url, config) {
|
|
2238
|
-
if (typeof url === "string") {
|
|
2239
|
-
const normalizedURL = normalizeURLForProtocolCheck(url);
|
|
2240
|
-
if (malformedHttpProtocol.test(normalizedURL)) {
|
|
2241
|
-
throw new AxiosError$1(
|
|
2242
|
-
`Invalid URL ${JSON.stringify(redactSensitiveURLParts(normalizedURL))}: missing "//" after protocol`,
|
|
2243
|
-
AxiosError$1.ERR_INVALID_URL,
|
|
2244
|
-
config
|
|
2245
|
-
);
|
|
2246
|
-
}
|
|
2247
|
-
}
|
|
2248
|
-
}
|
|
2249
|
-
function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls, config) {
|
|
2250
|
-
assertValidHttpProtocolURL(requestedURL, config);
|
|
2251
|
-
let isRelativeUrl = !isAbsoluteURL(requestedURL);
|
|
2252
|
-
if (baseURL && (isRelativeUrl || allowAbsoluteUrls === false)) {
|
|
2253
|
-
assertValidHttpProtocolURL(baseURL, config);
|
|
2254
|
-
return combineURLs(baseURL, requestedURL);
|
|
2255
|
-
}
|
|
2256
|
-
return requestedURL;
|
|
2257
|
-
}
|
|
2258
|
-
const headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? { ...thing } : thing;
|
|
2259
|
-
const ownEnumerableKeys = (thing) => {
|
|
2260
|
-
if (Object.getOwnPropertySymbols && Object.getOwnPropertyDescriptor) {
|
|
2261
|
-
return Object.keys(thing).concat(
|
|
2262
|
-
Object.getOwnPropertySymbols(thing).filter(
|
|
2263
|
-
(symbol) => Object.getOwnPropertyDescriptor(thing, symbol).enumerable
|
|
2264
|
-
)
|
|
2265
|
-
);
|
|
2266
|
-
}
|
|
2267
|
-
return Object.keys(thing);
|
|
2268
|
-
};
|
|
2269
|
-
function mergeConfig$1(config1, config2) {
|
|
2270
|
-
config1 = config1 || {};
|
|
2271
|
-
config2 = config2 || {};
|
|
2272
|
-
const config = /* @__PURE__ */ Object.create(null);
|
|
2273
|
-
Object.defineProperty(config, "hasOwnProperty", {
|
|
2274
|
-
// Null-proto descriptor so a polluted Object.prototype.get cannot turn
|
|
2275
|
-
// this data descriptor into an accessor descriptor on the way in.
|
|
2276
|
-
__proto__: null,
|
|
2277
|
-
value: Object.prototype.hasOwnProperty,
|
|
2278
|
-
enumerable: false,
|
|
2279
|
-
writable: true,
|
|
2280
|
-
configurable: true
|
|
2281
|
-
});
|
|
2282
|
-
function getMergedValue(target, source, prop, caseless) {
|
|
2283
|
-
if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
|
|
2284
|
-
return utils$1.merge.call({ caseless }, target, source);
|
|
2285
|
-
} else if (utils$1.isPlainObject(source)) {
|
|
2286
|
-
return utils$1.merge({}, source);
|
|
2287
|
-
} else if (utils$1.isArray(source)) {
|
|
2288
|
-
return source.slice();
|
|
2289
|
-
}
|
|
2290
|
-
return source;
|
|
2291
|
-
}
|
|
2292
|
-
function mergeDeepProperties(a, b, prop, caseless) {
|
|
2293
|
-
if (!utils$1.isUndefined(b)) {
|
|
2294
|
-
return getMergedValue(a, b, prop, caseless);
|
|
2295
|
-
} else if (!utils$1.isUndefined(a)) {
|
|
2296
|
-
return getMergedValue(void 0, a, prop, caseless);
|
|
2297
|
-
}
|
|
2298
|
-
}
|
|
2299
|
-
function valueFromConfig2(a, b) {
|
|
2300
|
-
if (!utils$1.isUndefined(b)) {
|
|
2301
|
-
return getMergedValue(void 0, b);
|
|
2302
|
-
}
|
|
2303
|
-
}
|
|
2304
|
-
function defaultToConfig2(a, b) {
|
|
2305
|
-
if (!utils$1.isUndefined(b)) {
|
|
2306
|
-
return getMergedValue(void 0, b);
|
|
2307
|
-
} else if (!utils$1.isUndefined(a)) {
|
|
2308
|
-
return getMergedValue(void 0, a);
|
|
2309
|
-
}
|
|
2310
|
-
}
|
|
2311
|
-
function getMergedTransitionalOption(prop) {
|
|
2312
|
-
const transitional2 = utils$1.hasOwnProp(config2, "transitional") ? config2.transitional : void 0;
|
|
2313
|
-
if (!utils$1.isUndefined(transitional2)) {
|
|
2314
|
-
if (utils$1.isPlainObject(transitional2)) {
|
|
2315
|
-
if (utils$1.hasOwnProp(transitional2, prop)) {
|
|
2316
|
-
return transitional2[prop];
|
|
2317
|
-
}
|
|
2318
|
-
} else {
|
|
2319
|
-
return void 0;
|
|
2320
|
-
}
|
|
2321
|
-
}
|
|
2322
|
-
const transitional1 = utils$1.hasOwnProp(config1, "transitional") ? config1.transitional : void 0;
|
|
2323
|
-
if (utils$1.isPlainObject(transitional1) && utils$1.hasOwnProp(transitional1, prop)) {
|
|
2324
|
-
return transitional1[prop];
|
|
2325
|
-
}
|
|
2326
|
-
return void 0;
|
|
2327
|
-
}
|
|
2328
|
-
function mergeDirectKeys(a, b, prop) {
|
|
2329
|
-
if (utils$1.hasOwnProp(config2, prop)) {
|
|
2330
|
-
return getMergedValue(a, b);
|
|
2331
|
-
} else if (utils$1.hasOwnProp(config1, prop)) {
|
|
2332
|
-
return getMergedValue(void 0, a);
|
|
2333
|
-
}
|
|
2334
|
-
}
|
|
2335
|
-
const mergeMap = {
|
|
2336
|
-
url: valueFromConfig2,
|
|
2337
|
-
method: valueFromConfig2,
|
|
2338
|
-
data: valueFromConfig2,
|
|
2339
|
-
baseURL: defaultToConfig2,
|
|
2340
|
-
transformRequest: defaultToConfig2,
|
|
2341
|
-
transformResponse: defaultToConfig2,
|
|
2342
|
-
paramsSerializer: defaultToConfig2,
|
|
2343
|
-
timeout: defaultToConfig2,
|
|
2344
|
-
timeoutErrorMessage: defaultToConfig2,
|
|
2345
|
-
withCredentials: defaultToConfig2,
|
|
2346
|
-
withXSRFToken: defaultToConfig2,
|
|
2347
|
-
adapter: defaultToConfig2,
|
|
2348
|
-
responseType: defaultToConfig2,
|
|
2349
|
-
xsrfCookieName: defaultToConfig2,
|
|
2350
|
-
xsrfHeaderName: defaultToConfig2,
|
|
2351
|
-
onUploadProgress: defaultToConfig2,
|
|
2352
|
-
onDownloadProgress: defaultToConfig2,
|
|
2353
|
-
decompress: defaultToConfig2,
|
|
2354
|
-
maxContentLength: defaultToConfig2,
|
|
2355
|
-
maxBodyLength: defaultToConfig2,
|
|
2356
|
-
beforeRedirect: defaultToConfig2,
|
|
2357
|
-
transport: defaultToConfig2,
|
|
2358
|
-
httpAgent: defaultToConfig2,
|
|
2359
|
-
httpsAgent: defaultToConfig2,
|
|
2360
|
-
cancelToken: defaultToConfig2,
|
|
2361
|
-
socketPath: defaultToConfig2,
|
|
2362
|
-
allowedSocketPaths: defaultToConfig2,
|
|
2363
|
-
responseEncoding: defaultToConfig2,
|
|
2364
|
-
validateStatus: mergeDirectKeys,
|
|
2365
|
-
headers: (a, b, prop) => mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true)
|
|
2366
|
-
};
|
|
2367
|
-
utils$1.forEach(ownEnumerableKeys({ ...config1, ...config2 }), function computeConfigValue(prop) {
|
|
2368
|
-
if (prop === "__proto__" || prop === "constructor" || prop === "prototype") return;
|
|
2369
|
-
const merge2 = utils$1.hasOwnProp(mergeMap, prop) ? mergeMap[prop] : mergeDeepProperties;
|
|
2370
|
-
const a = utils$1.hasOwnProp(config1, prop) ? config1[prop] : void 0;
|
|
2371
|
-
const b = utils$1.hasOwnProp(config2, prop) ? config2[prop] : void 0;
|
|
2372
|
-
const configValue = merge2(a, b, prop);
|
|
2373
|
-
utils$1.isUndefined(configValue) && merge2 !== mergeDirectKeys || (config[prop] = configValue);
|
|
2374
|
-
});
|
|
2375
|
-
if (utils$1.hasOwnProp(config2, "validateStatus") && utils$1.isUndefined(config2.validateStatus) && getMergedTransitionalOption("validateStatusUndefinedResolves") === false) {
|
|
2376
|
-
if (utils$1.hasOwnProp(config1, "validateStatus")) {
|
|
2377
|
-
config.validateStatus = getMergedValue(void 0, config1.validateStatus);
|
|
2378
|
-
} else {
|
|
2379
|
-
delete config.validateStatus;
|
|
2380
|
-
}
|
|
2381
|
-
}
|
|
2382
|
-
return config;
|
|
2383
|
-
}
|
|
2384
|
-
const FORM_DATA_CONTENT_HEADERS = ["content-type", "content-length"];
|
|
2385
|
-
function setFormDataHeaders(headers, formHeaders, policy) {
|
|
2386
|
-
if (policy !== "content-only") {
|
|
2387
|
-
headers.set(formHeaders);
|
|
2388
|
-
return;
|
|
2389
|
-
}
|
|
2390
|
-
Object.entries(formHeaders || {}).forEach(([key, val]) => {
|
|
2391
|
-
if (FORM_DATA_CONTENT_HEADERS.includes(key.toLowerCase())) {
|
|
2392
|
-
headers.set(key, val);
|
|
2393
|
-
}
|
|
2394
|
-
});
|
|
2395
|
-
}
|
|
2396
|
-
const encodeUTF8$1 = (str) => encodeURIComponent(str).replace(
|
|
2397
|
-
/%([0-9A-F]{2})/gi,
|
|
2398
|
-
(_, hex) => String.fromCharCode(parseInt(hex, 16))
|
|
2399
|
-
);
|
|
2400
|
-
function resolveConfig(config) {
|
|
2401
|
-
const newConfig = mergeConfig$1({}, config);
|
|
2402
|
-
const own2 = (key) => utils$1.hasOwnProp(newConfig, key) ? newConfig[key] : void 0;
|
|
2403
|
-
const data = own2("data");
|
|
2404
|
-
let withXSRFToken = own2("withXSRFToken");
|
|
2405
|
-
const xsrfHeaderName = own2("xsrfHeaderName");
|
|
2406
|
-
const xsrfCookieName = own2("xsrfCookieName");
|
|
2407
|
-
let headers = own2("headers");
|
|
2408
|
-
const auth2 = own2("auth");
|
|
2409
|
-
const baseURL = own2("baseURL");
|
|
2410
|
-
const allowAbsoluteUrls = own2("allowAbsoluteUrls");
|
|
2411
|
-
const url = own2("url");
|
|
2412
|
-
newConfig.headers = headers = AxiosHeaders$1.from(headers);
|
|
2413
|
-
newConfig.url = buildURL(
|
|
2414
|
-
buildFullPath(baseURL, url, allowAbsoluteUrls, newConfig),
|
|
2415
|
-
own2("params"),
|
|
2416
|
-
own2("paramsSerializer")
|
|
2417
|
-
);
|
|
2418
|
-
if (auth2) {
|
|
2419
|
-
const username = utils$1.getSafeProp(auth2, "username") || "";
|
|
2420
|
-
const password = utils$1.getSafeProp(auth2, "password") || "";
|
|
2421
|
-
try {
|
|
2422
|
-
headers.set(
|
|
2423
|
-
"Authorization",
|
|
2424
|
-
"Basic " + btoa(username + ":" + (password ? encodeUTF8$1(password) : ""))
|
|
2425
|
-
);
|
|
2426
|
-
} catch (e) {
|
|
2427
|
-
throw AxiosError$1.from(e, AxiosError$1.ERR_BAD_OPTION_VALUE, config);
|
|
2428
|
-
}
|
|
2429
|
-
}
|
|
2430
|
-
if (utils$1.isFormData(data)) {
|
|
2431
|
-
const getHeaders = utils$1.getSafeProp(data, "getHeaders");
|
|
2432
|
-
if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv || utils$1.isReactNative(data)) {
|
|
2433
|
-
headers.setContentType(void 0);
|
|
2434
|
-
} else if (utils$1.isFunction(getHeaders)) {
|
|
2435
|
-
setFormDataHeaders(headers, getHeaders.call(data), own2("formDataHeaderPolicy"));
|
|
2436
|
-
}
|
|
2437
|
-
}
|
|
2438
|
-
if (platform.hasStandardBrowserEnv) {
|
|
2439
|
-
if (utils$1.isFunction(withXSRFToken)) {
|
|
2440
|
-
withXSRFToken = withXSRFToken(newConfig);
|
|
2441
|
-
}
|
|
2442
|
-
const shouldSendXSRF = withXSRFToken === true || withXSRFToken == null && isURLSameOrigin(newConfig.url);
|
|
2443
|
-
if (shouldSendXSRF) {
|
|
2444
|
-
const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
|
|
2445
|
-
if (xsrfValue) {
|
|
2446
|
-
headers.set(xsrfHeaderName, xsrfValue);
|
|
2447
|
-
}
|
|
2448
|
-
}
|
|
2449
|
-
}
|
|
2450
|
-
return newConfig;
|
|
2451
|
-
}
|
|
2452
|
-
const isXHRAdapterSupported = typeof XMLHttpRequest !== "undefined";
|
|
2453
|
-
const xhrAdapter = isXHRAdapterSupported && function(config) {
|
|
2454
|
-
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
|
2455
|
-
const _config = resolveConfig(config);
|
|
2456
|
-
let requestData = _config.data;
|
|
2457
|
-
const requestHeaders = AxiosHeaders$1.from(_config.headers).normalize();
|
|
2458
|
-
let { responseType, onUploadProgress, onDownloadProgress } = _config;
|
|
2459
|
-
let onCanceled;
|
|
2460
|
-
let uploadThrottled, downloadThrottled;
|
|
2461
|
-
let flushUpload, flushDownload, flushDownloadWithEvent;
|
|
2462
|
-
function done() {
|
|
2463
|
-
flushUpload && flushUpload();
|
|
2464
|
-
flushDownload && flushDownload();
|
|
2465
|
-
_config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
|
|
2466
|
-
_config.signal && _config.signal.removeEventListener("abort", onCanceled);
|
|
2467
|
-
}
|
|
2468
|
-
let request = new XMLHttpRequest();
|
|
2469
|
-
request.open(_config.method.toUpperCase(), _config.url, true);
|
|
2470
|
-
request.timeout = _config.timeout;
|
|
2471
|
-
function onloadend(event) {
|
|
2472
|
-
if (!request) {
|
|
2473
|
-
return;
|
|
2474
|
-
}
|
|
2475
|
-
if (request.status === 0 && (parseProtocol(normalizeURLForProtocolCheck(_config.url)) || parseProtocol(platform.origin)) !== "file" && !(request.responseURL && request.responseURL.startsWith("file:"))) {
|
|
2476
|
-
reject(new AxiosError$1("Request aborted", AxiosError$1.ECONNABORTED, config, request));
|
|
2477
|
-
done();
|
|
2478
|
-
request = null;
|
|
2479
|
-
return;
|
|
2480
|
-
}
|
|
2481
|
-
try {
|
|
2482
|
-
if (event) {
|
|
2483
|
-
flushDownloadWithEvent && flushDownloadWithEvent(event);
|
|
2484
|
-
} else {
|
|
2485
|
-
flushDownload && flushDownload();
|
|
2486
|
-
}
|
|
2487
|
-
} catch (err) {
|
|
2488
|
-
setTimeout(() => {
|
|
2489
|
-
throw err;
|
|
2490
|
-
});
|
|
2491
|
-
}
|
|
2492
|
-
if (!request) {
|
|
2493
|
-
return;
|
|
2494
|
-
}
|
|
2495
|
-
const responseHeaders = AxiosHeaders$1.from(
|
|
2496
|
-
"getAllResponseHeaders" in request && request.getAllResponseHeaders()
|
|
2497
|
-
);
|
|
2498
|
-
const responseData = !responseType || responseType === "text" || responseType === "json" ? request.responseText : request.response;
|
|
2499
|
-
const response = {
|
|
2500
|
-
data: responseData,
|
|
2501
|
-
status: request.status,
|
|
2502
|
-
statusText: request.statusText,
|
|
2503
|
-
headers: responseHeaders,
|
|
2504
|
-
config,
|
|
2505
|
-
request
|
|
2506
|
-
};
|
|
2507
|
-
settle(
|
|
2508
|
-
function _resolve(value) {
|
|
2509
|
-
resolve(value);
|
|
2510
|
-
done();
|
|
2511
|
-
},
|
|
2512
|
-
function _reject(err) {
|
|
2513
|
-
reject(err);
|
|
2514
|
-
done();
|
|
2515
|
-
},
|
|
2516
|
-
response
|
|
2517
|
-
);
|
|
2518
|
-
request = null;
|
|
2519
|
-
}
|
|
2520
|
-
if ("onloadend" in request) {
|
|
2521
|
-
request.onloadend = onloadend;
|
|
2522
|
-
} else {
|
|
2523
|
-
request.onreadystatechange = function handleLoad() {
|
|
2524
|
-
if (!request || request.readyState !== 4) {
|
|
2525
|
-
return;
|
|
2526
|
-
}
|
|
2527
|
-
if (request.status === 0 && !(request.responseURL && request.responseURL.startsWith("file:"))) {
|
|
2528
|
-
return;
|
|
2529
|
-
}
|
|
2530
|
-
setTimeout(onloadend);
|
|
2531
|
-
};
|
|
2532
|
-
}
|
|
2533
|
-
request.onabort = function handleAbort() {
|
|
2534
|
-
if (!request) {
|
|
2535
|
-
return;
|
|
2536
|
-
}
|
|
2537
|
-
reject(new AxiosError$1("Request aborted", AxiosError$1.ECONNABORTED, config, request));
|
|
2538
|
-
done();
|
|
2539
|
-
request = null;
|
|
2540
|
-
};
|
|
2541
|
-
request.onerror = function handleError(event) {
|
|
2542
|
-
const msg = event && event.message ? event.message : "Network Error";
|
|
2543
|
-
const err = new AxiosError$1(msg, AxiosError$1.ERR_NETWORK, config, request);
|
|
2544
|
-
err.event = event || null;
|
|
2545
|
-
reject(err);
|
|
2546
|
-
done();
|
|
2547
|
-
request = null;
|
|
2548
|
-
};
|
|
2549
|
-
request.ontimeout = function handleTimeout() {
|
|
2550
|
-
let timeoutErrorMessage = _config.timeout ? "timeout of " + _config.timeout + "ms exceeded" : "timeout exceeded";
|
|
2551
|
-
const transitional2 = _config.transitional || transitionalDefaults;
|
|
2552
|
-
if (_config.timeoutErrorMessage) {
|
|
2553
|
-
timeoutErrorMessage = _config.timeoutErrorMessage;
|
|
2554
|
-
}
|
|
2555
|
-
reject(
|
|
2556
|
-
new AxiosError$1(
|
|
2557
|
-
timeoutErrorMessage,
|
|
2558
|
-
transitional2.clarifyTimeoutError ? AxiosError$1.ETIMEDOUT : AxiosError$1.ECONNABORTED,
|
|
2559
|
-
config,
|
|
2560
|
-
request
|
|
2561
|
-
)
|
|
2562
|
-
);
|
|
2563
|
-
done();
|
|
2564
|
-
request = null;
|
|
2565
|
-
};
|
|
2566
|
-
requestData === void 0 && requestHeaders.setContentType(null);
|
|
2567
|
-
if ("setRequestHeader" in request) {
|
|
2568
|
-
utils$1.forEach(toByteStringHeaderObject(requestHeaders), function setRequestHeader(val, key) {
|
|
2569
|
-
request.setRequestHeader(key, val);
|
|
2570
|
-
});
|
|
2571
|
-
}
|
|
2572
|
-
if (!utils$1.isUndefined(_config.withCredentials)) {
|
|
2573
|
-
request.withCredentials = !!_config.withCredentials;
|
|
2574
|
-
}
|
|
2575
|
-
if (responseType && responseType !== "json") {
|
|
2576
|
-
request.responseType = _config.responseType;
|
|
2577
|
-
}
|
|
2578
|
-
if (onDownloadProgress) {
|
|
2579
|
-
[downloadThrottled, flushDownload, flushDownloadWithEvent] = progressEventReducer(
|
|
2580
|
-
onDownloadProgress,
|
|
2581
|
-
true
|
|
2582
|
-
);
|
|
2583
|
-
request.addEventListener("progress", downloadThrottled);
|
|
2584
|
-
}
|
|
2585
|
-
if (onUploadProgress && request.upload) {
|
|
2586
|
-
[uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress);
|
|
2587
|
-
request.upload.addEventListener("progress", uploadThrottled);
|
|
2588
|
-
request.upload.addEventListener("loadend", flushUpload);
|
|
2589
|
-
}
|
|
2590
|
-
if (_config.cancelToken || _config.signal) {
|
|
2591
|
-
onCanceled = (cancel) => {
|
|
2592
|
-
if (!request) {
|
|
2593
|
-
return;
|
|
2594
|
-
}
|
|
2595
|
-
reject(!cancel || cancel.type ? new CanceledError$1(null, config, request) : cancel);
|
|
2596
|
-
request.abort();
|
|
2597
|
-
done();
|
|
2598
|
-
request = null;
|
|
2599
|
-
};
|
|
2600
|
-
_config.cancelToken && _config.cancelToken.subscribe(onCanceled);
|
|
2601
|
-
if (_config.signal) {
|
|
2602
|
-
_config.signal.aborted ? onCanceled() : _config.signal.addEventListener("abort", onCanceled);
|
|
2603
|
-
}
|
|
2604
|
-
}
|
|
2605
|
-
const protocol = parseProtocol(_config.url);
|
|
2606
|
-
if (protocol && !platform.protocols.includes(protocol)) {
|
|
2607
|
-
reject(
|
|
2608
|
-
new AxiosError$1(
|
|
2609
|
-
"Unsupported protocol " + protocol + ":",
|
|
2610
|
-
AxiosError$1.ERR_BAD_REQUEST,
|
|
2611
|
-
config
|
|
2612
|
-
)
|
|
2613
|
-
);
|
|
2614
|
-
done();
|
|
2615
|
-
return;
|
|
2616
|
-
}
|
|
2617
|
-
request.send(requestData || null);
|
|
2618
|
-
});
|
|
2619
|
-
};
|
|
2620
|
-
const composeSignals = (signals, timeout) => {
|
|
2621
|
-
signals = signals ? signals.filter(Boolean) : [];
|
|
2622
|
-
if (!timeout && !signals.length) {
|
|
2623
|
-
return;
|
|
2624
|
-
}
|
|
2625
|
-
const controller = new AbortController();
|
|
2626
|
-
let aborted = false;
|
|
2627
|
-
const onabort = function(reason) {
|
|
2628
|
-
if (!aborted) {
|
|
2629
|
-
aborted = true;
|
|
2630
|
-
unsubscribe();
|
|
2631
|
-
const err = reason instanceof Error ? reason : this.reason;
|
|
2632
|
-
controller.abort(
|
|
2633
|
-
err instanceof AxiosError$1 ? err : new CanceledError$1(err instanceof Error ? err.message : err)
|
|
2634
|
-
);
|
|
2635
|
-
}
|
|
2636
|
-
};
|
|
2637
|
-
let timer = timeout && setTimeout(() => {
|
|
2638
|
-
timer = null;
|
|
2639
|
-
onabort(new AxiosError$1(`timeout of ${timeout}ms exceeded`, AxiosError$1.ETIMEDOUT));
|
|
2640
|
-
}, timeout);
|
|
2641
|
-
const unsubscribe = () => {
|
|
2642
|
-
if (!signals) {
|
|
2643
|
-
return;
|
|
2644
|
-
}
|
|
2645
|
-
timer && clearTimeout(timer);
|
|
2646
|
-
timer = null;
|
|
2647
|
-
signals.forEach((signal2) => {
|
|
2648
|
-
signal2.unsubscribe ? signal2.unsubscribe(onabort) : signal2.removeEventListener("abort", onabort);
|
|
2649
|
-
});
|
|
2650
|
-
signals = null;
|
|
2651
|
-
};
|
|
2652
|
-
signals.forEach((signal2) => {
|
|
2653
|
-
if (aborted) {
|
|
2654
|
-
return;
|
|
2655
|
-
}
|
|
2656
|
-
if (signal2.aborted) {
|
|
2657
|
-
onabort.call(signal2);
|
|
2658
|
-
return;
|
|
2659
|
-
}
|
|
2660
|
-
signal2.addEventListener("abort", onabort, { once: true });
|
|
2661
|
-
});
|
|
2662
|
-
const { signal } = controller;
|
|
2663
|
-
signal.unsubscribe = () => utils$1.asap(unsubscribe);
|
|
2664
|
-
return signal;
|
|
2665
|
-
};
|
|
2666
|
-
const streamChunk = function* (chunk, chunkSize) {
|
|
2667
|
-
let len = chunk.byteLength;
|
|
2668
|
-
if (len < chunkSize) {
|
|
2669
|
-
yield chunk;
|
|
2670
|
-
return;
|
|
2671
|
-
}
|
|
2672
|
-
let pos = 0;
|
|
2673
|
-
let end;
|
|
2674
|
-
while (pos < len) {
|
|
2675
|
-
end = pos + chunkSize;
|
|
2676
|
-
yield chunk.slice(pos, end);
|
|
2677
|
-
pos = end;
|
|
2678
|
-
}
|
|
2679
|
-
};
|
|
2680
|
-
const readBytes = async function* (iterable, chunkSize) {
|
|
2681
|
-
for await (const chunk of readStream(iterable)) {
|
|
2682
|
-
yield* streamChunk(chunk, chunkSize);
|
|
2683
|
-
}
|
|
2684
|
-
};
|
|
2685
|
-
const readStream = async function* (stream) {
|
|
2686
|
-
if (stream[Symbol.asyncIterator]) {
|
|
2687
|
-
yield* stream;
|
|
2688
|
-
return;
|
|
2689
|
-
}
|
|
2690
|
-
const reader = stream.getReader();
|
|
2691
|
-
try {
|
|
2692
|
-
for (; ; ) {
|
|
2693
|
-
const { done, value } = await reader.read();
|
|
2694
|
-
if (done) {
|
|
2695
|
-
break;
|
|
2696
|
-
}
|
|
2697
|
-
yield value;
|
|
2698
|
-
}
|
|
2699
|
-
} finally {
|
|
2700
|
-
await reader.cancel();
|
|
2701
|
-
}
|
|
2702
|
-
};
|
|
2703
|
-
const trackStream = (stream, chunkSize, onProgress, onFinish) => {
|
|
2704
|
-
const iterator2 = readBytes(stream, chunkSize);
|
|
2705
|
-
let bytes = 0;
|
|
2706
|
-
let done;
|
|
2707
|
-
let _onFinish = (e) => {
|
|
2708
|
-
if (!done) {
|
|
2709
|
-
done = true;
|
|
2710
|
-
onFinish && onFinish(e);
|
|
2711
|
-
}
|
|
2712
|
-
};
|
|
2713
|
-
return new ReadableStream(
|
|
2714
|
-
{
|
|
2715
|
-
async pull(controller) {
|
|
2716
|
-
try {
|
|
2717
|
-
const { done: done2, value } = await iterator2.next();
|
|
2718
|
-
if (done2) {
|
|
2719
|
-
_onFinish();
|
|
2720
|
-
controller.close();
|
|
2721
|
-
return;
|
|
2722
|
-
}
|
|
2723
|
-
let len = value.byteLength;
|
|
2724
|
-
if (onProgress) {
|
|
2725
|
-
let loadedBytes = bytes += len;
|
|
2726
|
-
onProgress(loadedBytes);
|
|
2727
|
-
}
|
|
2728
|
-
controller.enqueue(new Uint8Array(value));
|
|
2729
|
-
} catch (err) {
|
|
2730
|
-
_onFinish(err);
|
|
2731
|
-
throw err;
|
|
2732
|
-
}
|
|
2733
|
-
},
|
|
2734
|
-
cancel(reason) {
|
|
2735
|
-
_onFinish(reason);
|
|
2736
|
-
return iterator2.return();
|
|
2737
|
-
}
|
|
2738
|
-
},
|
|
2739
|
-
{
|
|
2740
|
-
highWaterMark: 2
|
|
2741
|
-
}
|
|
2742
|
-
);
|
|
2743
|
-
};
|
|
2744
|
-
const isHexDigit = (charCode) => charCode >= 48 && charCode <= 57 || charCode >= 65 && charCode <= 70 || charCode >= 97 && charCode <= 102;
|
|
2745
|
-
const isPercentEncodedByte = (str, i, len) => i + 2 < len && isHexDigit(str.charCodeAt(i + 1)) && isHexDigit(str.charCodeAt(i + 2));
|
|
2746
|
-
const hexValue = (charCode) => charCode <= 57 ? charCode - 48 : (charCode & 223) - 55;
|
|
2747
|
-
const isBase64Char = (charCode) => charCode >= 65 && charCode <= 90 || // A-Z
|
|
2748
|
-
charCode >= 97 && charCode <= 122 || // a-z
|
|
2749
|
-
charCode >= 48 && charCode <= 57 || // 0-9
|
|
2750
|
-
charCode === 43 || // +
|
|
2751
|
-
charCode === 47 || // /
|
|
2752
|
-
charCode === 45 || // - (base64url)
|
|
2753
|
-
charCode === 95;
|
|
2754
|
-
const isBase64Whitespace = (charCode) => charCode === 9 || charCode === 10 || charCode === 12 || charCode === 13 || charCode === 32;
|
|
2755
|
-
const base64Bytes = (significant) => {
|
|
2756
|
-
const groups = Math.floor(significant / 4);
|
|
2757
|
-
const remainder = significant % 4;
|
|
2758
|
-
return groups * 3 + (remainder === 2 ? 1 : remainder === 3 ? 2 : 0);
|
|
2759
|
-
};
|
|
2760
|
-
const estimateBase64BufferAllocation = (body) => {
|
|
2761
|
-
const len = body.length;
|
|
2762
|
-
let padding = 0;
|
|
2763
|
-
if (len > 0 && body.charCodeAt(len - 1) === 61) {
|
|
2764
|
-
padding++;
|
|
2765
|
-
if (len > 1 && body.charCodeAt(len - 2) === 61) {
|
|
2766
|
-
padding++;
|
|
2767
|
-
}
|
|
2768
|
-
}
|
|
2769
|
-
return Math.floor((len - padding) * 3 / 4);
|
|
2770
|
-
};
|
|
2771
|
-
const estimatePercentDecodedBase64Bytes = (body) => {
|
|
2772
|
-
const len = body.length;
|
|
2773
|
-
let significant = 0;
|
|
2774
|
-
let padding = 0;
|
|
2775
|
-
let invalid = false;
|
|
2776
|
-
for (let i = 0; i < len; i++) {
|
|
2777
|
-
let code = body.charCodeAt(i);
|
|
2778
|
-
if (code === 37 && isPercentEncodedByte(body, i, len)) {
|
|
2779
|
-
code = hexValue(body.charCodeAt(i + 1)) * 16 + hexValue(body.charCodeAt(i + 2));
|
|
2780
|
-
i += 2;
|
|
2781
|
-
}
|
|
2782
|
-
if (isBase64Whitespace(code)) {
|
|
2783
|
-
continue;
|
|
2784
|
-
}
|
|
2785
|
-
if (code === 61) {
|
|
2786
|
-
padding++;
|
|
2787
|
-
continue;
|
|
2788
|
-
}
|
|
2789
|
-
if (!isBase64Char(code) || padding > 0) {
|
|
2790
|
-
invalid = true;
|
|
2791
|
-
continue;
|
|
2792
|
-
}
|
|
2793
|
-
significant++;
|
|
2794
|
-
}
|
|
2795
|
-
if (invalid || padding > 2 || padding > 0 && (significant + padding) % 4 !== 0 || significant % 4 === 1) {
|
|
2796
|
-
return estimateBase64BufferAllocation(body);
|
|
2797
|
-
}
|
|
2798
|
-
return base64Bytes(significant);
|
|
2799
|
-
};
|
|
2800
|
-
const estimateDataURLBytes = (url, estimateBase64) => {
|
|
2801
|
-
if (!url || typeof url !== "string") return 0;
|
|
2802
|
-
if (!url.startsWith("data:")) return 0;
|
|
2803
|
-
const comma = url.indexOf(",");
|
|
2804
|
-
if (comma < 0) return 0;
|
|
2805
|
-
const meta = url.slice(5, comma);
|
|
2806
|
-
const body = url.slice(comma + 1);
|
|
2807
|
-
const isBase64 = /;base64/i.test(meta);
|
|
2808
|
-
if (isBase64) {
|
|
2809
|
-
return estimateBase64(body);
|
|
2810
|
-
}
|
|
2811
|
-
let bytes = 0;
|
|
2812
|
-
for (let i = 0, len = body.length; i < len; i++) {
|
|
2813
|
-
const c = body.charCodeAt(i);
|
|
2814
|
-
if (c === 37 && isPercentEncodedByte(body, i, len)) {
|
|
2815
|
-
bytes += 1;
|
|
2816
|
-
i += 2;
|
|
2817
|
-
} else if (c < 128) {
|
|
2818
|
-
bytes += 1;
|
|
2819
|
-
} else if (c < 2048) {
|
|
2820
|
-
bytes += 2;
|
|
2821
|
-
} else if (c >= 55296 && c <= 56319 && i + 1 < len) {
|
|
2822
|
-
const next = body.charCodeAt(i + 1);
|
|
2823
|
-
if (next >= 56320 && next <= 57343) {
|
|
2824
|
-
bytes += 4;
|
|
2825
|
-
i++;
|
|
2826
|
-
} else {
|
|
2827
|
-
bytes += 3;
|
|
2828
|
-
}
|
|
2829
|
-
} else {
|
|
2830
|
-
bytes += 3;
|
|
2831
|
-
}
|
|
2832
|
-
}
|
|
2833
|
-
return bytes;
|
|
2834
|
-
};
|
|
2835
|
-
function estimateDataURLDecodedBytes(url) {
|
|
2836
|
-
const fragmentIndex = typeof url === "string" ? url.indexOf("#") : -1;
|
|
2837
|
-
return estimateDataURLBytes(
|
|
2838
|
-
fragmentIndex === -1 ? url : url.slice(0, fragmentIndex),
|
|
2839
|
-
estimatePercentDecodedBase64Bytes
|
|
2840
|
-
);
|
|
2841
|
-
}
|
|
2842
|
-
const VERSION$1 = "1.20.0";
|
|
2843
|
-
const DEFAULT_CHUNK_SIZE = 64 * 1024;
|
|
2844
|
-
const DEFAULT_REQUEST_OPTIONS = {
|
|
2845
|
-
cache: "default",
|
|
2846
|
-
redirect: "follow",
|
|
2847
|
-
referrer: "about:client",
|
|
2848
|
-
referrerPolicy: "",
|
|
2849
|
-
mode: "cors",
|
|
2850
|
-
integrity: "",
|
|
2851
|
-
keepalive: false,
|
|
2852
|
-
priority: "auto",
|
|
2853
|
-
window: null
|
|
2854
|
-
};
|
|
2855
|
-
const { isFunction } = utils$1;
|
|
2856
|
-
const encodeUTF8 = (str) => encodeURIComponent(str).replace(
|
|
2857
|
-
/%([0-9A-F]{2})/gi,
|
|
2858
|
-
(_, hex) => String.fromCharCode(parseInt(hex, 16))
|
|
2859
|
-
);
|
|
2860
|
-
const decodeURIComponentSafe = (value) => {
|
|
2861
|
-
if (!utils$1.isString(value)) {
|
|
2862
|
-
return value;
|
|
2863
|
-
}
|
|
2864
|
-
try {
|
|
2865
|
-
return decodeURIComponent(value);
|
|
2866
|
-
} catch (error) {
|
|
2867
|
-
return value;
|
|
2868
|
-
}
|
|
2869
|
-
};
|
|
2870
|
-
const test = (fn, ...args) => {
|
|
2871
|
-
try {
|
|
2872
|
-
return !!fn(...args);
|
|
2873
|
-
} catch (e) {
|
|
2874
|
-
return false;
|
|
2875
|
-
}
|
|
2876
|
-
};
|
|
2877
|
-
const maybeWithAuthCredentials = (url) => {
|
|
2878
|
-
const protocolIndex = url.indexOf("://");
|
|
2879
|
-
let urlToCheck = url;
|
|
2880
|
-
if (protocolIndex !== -1) {
|
|
2881
|
-
urlToCheck = urlToCheck.slice(protocolIndex + 3);
|
|
2882
|
-
}
|
|
2883
|
-
return urlToCheck.includes("@") || urlToCheck.includes(":");
|
|
2884
|
-
};
|
|
2885
|
-
const factory = (env) => {
|
|
2886
|
-
const globalObject = utils$1.global !== void 0 && utils$1.global !== null ? utils$1.global : globalThis;
|
|
2887
|
-
const { ReadableStream: ReadableStream2, TextEncoder } = globalObject;
|
|
2888
|
-
env = utils$1.merge.call(
|
|
2889
|
-
{
|
|
2890
|
-
skipUndefined: true
|
|
2891
|
-
},
|
|
2892
|
-
{
|
|
2893
|
-
Request: globalObject.Request,
|
|
2894
|
-
Response: globalObject.Response
|
|
2895
|
-
},
|
|
2896
|
-
env
|
|
2897
|
-
);
|
|
2898
|
-
const { fetch: envFetch, Request, Response } = env;
|
|
2899
|
-
const isFetchSupported = envFetch ? isFunction(envFetch) : typeof fetch === "function";
|
|
2900
|
-
const isRequestSupported = isFunction(Request);
|
|
2901
|
-
const isResponseSupported = isFunction(Response);
|
|
2902
|
-
if (!isFetchSupported) {
|
|
2903
|
-
return false;
|
|
2904
|
-
}
|
|
2905
|
-
const isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream2);
|
|
2906
|
-
const encodeText = isFetchSupported && (typeof TextEncoder === "function" ? /* @__PURE__ */ ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) : async (str) => new Uint8Array(await new Request(str).arrayBuffer()));
|
|
2907
|
-
const supportsRequestStream = isRequestSupported && isReadableStreamSupported && test(() => {
|
|
2908
|
-
let duplexAccessed = false;
|
|
2909
|
-
const request = new Request(platform.origin, {
|
|
2910
|
-
body: new ReadableStream2(),
|
|
2911
|
-
method: "POST",
|
|
2912
|
-
get duplex() {
|
|
2913
|
-
duplexAccessed = true;
|
|
2914
|
-
return "half";
|
|
2915
|
-
}
|
|
2916
|
-
});
|
|
2917
|
-
const hasContentType = request.headers.has("Content-Type");
|
|
2918
|
-
if (request.body != null) {
|
|
2919
|
-
request.body.cancel();
|
|
2920
|
-
}
|
|
2921
|
-
return duplexAccessed && !hasContentType;
|
|
2922
|
-
});
|
|
2923
|
-
const supportsResponseStream = isResponseSupported && isReadableStreamSupported && test(() => utils$1.isReadableStream(new Response("").body));
|
|
2924
|
-
const resolvers = {
|
|
2925
|
-
stream: supportsResponseStream && ((res) => res.body)
|
|
2926
|
-
};
|
|
2927
|
-
isFetchSupported && (() => {
|
|
2928
|
-
["text", "arrayBuffer", "blob", "formData", "stream"].forEach((type) => {
|
|
2929
|
-
!resolvers[type] && (resolvers[type] = (res, config) => {
|
|
2930
|
-
let method = res && res[type];
|
|
2931
|
-
if (method) {
|
|
2932
|
-
return method.call(res);
|
|
2933
|
-
}
|
|
2934
|
-
throw new AxiosError$1(
|
|
2935
|
-
`Response type '${type}' is not supported`,
|
|
2936
|
-
AxiosError$1.ERR_NOT_SUPPORT,
|
|
2937
|
-
config
|
|
2938
|
-
);
|
|
2939
|
-
});
|
|
2940
|
-
});
|
|
2941
|
-
})();
|
|
2942
|
-
const getBodyLength = async (body) => {
|
|
2943
|
-
if (body == null) {
|
|
2944
|
-
return 0;
|
|
2945
|
-
}
|
|
2946
|
-
if (utils$1.isBlob(body)) {
|
|
2947
|
-
return body.size;
|
|
2948
|
-
}
|
|
2949
|
-
if (utils$1.isSpecCompliantForm(body)) {
|
|
2950
|
-
const _request = new Request(platform.origin, {
|
|
2951
|
-
method: "POST",
|
|
2952
|
-
body
|
|
2953
|
-
});
|
|
2954
|
-
return (await _request.arrayBuffer()).byteLength;
|
|
2955
|
-
}
|
|
2956
|
-
if (utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
|
|
2957
|
-
return body.byteLength;
|
|
2958
|
-
}
|
|
2959
|
-
if (utils$1.isURLSearchParams(body)) {
|
|
2960
|
-
body = body + "";
|
|
2961
|
-
}
|
|
2962
|
-
if (utils$1.isString(body)) {
|
|
2963
|
-
return (await encodeText(body)).byteLength;
|
|
2964
|
-
}
|
|
2965
|
-
};
|
|
2966
|
-
const resolveBodyLength = async (headers, body) => {
|
|
2967
|
-
const length = utils$1.toFiniteNumber(headers.getContentLength());
|
|
2968
|
-
return length == null ? getBodyLength(body) : length;
|
|
2969
|
-
};
|
|
2970
|
-
return async (config) => {
|
|
2971
|
-
let {
|
|
2972
|
-
url,
|
|
2973
|
-
method,
|
|
2974
|
-
data,
|
|
2975
|
-
signal,
|
|
2976
|
-
cancelToken,
|
|
2977
|
-
timeout,
|
|
2978
|
-
onDownloadProgress,
|
|
2979
|
-
onUploadProgress,
|
|
2980
|
-
responseType,
|
|
2981
|
-
headers,
|
|
2982
|
-
withCredentials = "same-origin",
|
|
2983
|
-
fetchOptions,
|
|
2984
|
-
maxContentLength,
|
|
2985
|
-
maxBodyLength,
|
|
2986
|
-
maxRedirects
|
|
2987
|
-
} = resolveConfig(config);
|
|
2988
|
-
const hasMaxContentLength = utils$1.isNumber(maxContentLength) && maxContentLength > -1;
|
|
2989
|
-
const hasMaxBodyLength = utils$1.isNumber(maxBodyLength) && maxBodyLength > -1;
|
|
2990
|
-
const own2 = (key) => utils$1.hasOwnProp(config, key) ? config[key] : void 0;
|
|
2991
|
-
let _fetch = envFetch || fetch;
|
|
2992
|
-
responseType = responseType ? (responseType + "").toLowerCase() : "text";
|
|
2993
|
-
let composedSignal = composeSignals(
|
|
2994
|
-
[signal, cancelToken && cancelToken.toAbortSignal()],
|
|
2995
|
-
timeout
|
|
2996
|
-
);
|
|
2997
|
-
let request = null;
|
|
2998
|
-
const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
|
|
2999
|
-
composedSignal.unsubscribe();
|
|
3000
|
-
});
|
|
3001
|
-
let requestContentLength;
|
|
3002
|
-
let pendingBodyError = null;
|
|
3003
|
-
const maxBodyLengthError = () => new AxiosError$1(
|
|
3004
|
-
"Request body larger than maxBodyLength limit",
|
|
3005
|
-
AxiosError$1.ERR_BAD_REQUEST,
|
|
3006
|
-
config,
|
|
3007
|
-
request
|
|
3008
|
-
);
|
|
3009
|
-
try {
|
|
3010
|
-
let auth2 = void 0;
|
|
3011
|
-
const configAuth = own2("auth");
|
|
3012
|
-
if (configAuth) {
|
|
3013
|
-
const username = utils$1.getSafeProp(configAuth, "username") || "";
|
|
3014
|
-
const password = utils$1.getSafeProp(configAuth, "password") || "";
|
|
3015
|
-
auth2 = {
|
|
3016
|
-
username,
|
|
3017
|
-
password
|
|
3018
|
-
};
|
|
3019
|
-
}
|
|
3020
|
-
if (maybeWithAuthCredentials(url)) {
|
|
3021
|
-
const parsedURL = new URL(url, platform.origin);
|
|
3022
|
-
if (!auth2 && (parsedURL.username || parsedURL.password)) {
|
|
3023
|
-
const urlUsername = decodeURIComponentSafe(parsedURL.username);
|
|
3024
|
-
const urlPassword = decodeURIComponentSafe(parsedURL.password);
|
|
3025
|
-
auth2 = {
|
|
3026
|
-
username: urlUsername,
|
|
3027
|
-
password: urlPassword
|
|
3028
|
-
};
|
|
3029
|
-
}
|
|
3030
|
-
if (parsedURL.username || parsedURL.password) {
|
|
3031
|
-
parsedURL.username = "";
|
|
3032
|
-
parsedURL.password = "";
|
|
3033
|
-
url = parsedURL.href;
|
|
3034
|
-
}
|
|
3035
|
-
}
|
|
3036
|
-
if (auth2) {
|
|
3037
|
-
headers.delete("authorization");
|
|
3038
|
-
headers.set(
|
|
3039
|
-
"Authorization",
|
|
3040
|
-
"Basic " + btoa(encodeUTF8((auth2.username || "") + ":" + (auth2.password || "")))
|
|
3041
|
-
);
|
|
3042
|
-
}
|
|
3043
|
-
if (hasMaxContentLength && typeof url === "string" && url.startsWith("data:")) {
|
|
3044
|
-
const estimated = estimateDataURLDecodedBytes(url);
|
|
3045
|
-
if (estimated > maxContentLength) {
|
|
3046
|
-
throw new AxiosError$1(
|
|
3047
|
-
"maxContentLength size of " + maxContentLength + " exceeded",
|
|
3048
|
-
AxiosError$1.ERR_BAD_RESPONSE,
|
|
3049
|
-
config,
|
|
3050
|
-
request
|
|
3051
|
-
);
|
|
3052
|
-
}
|
|
3053
|
-
}
|
|
3054
|
-
if (hasMaxBodyLength && method !== "get" && method !== "head") {
|
|
3055
|
-
const outboundLength = await getBodyLength(data);
|
|
3056
|
-
if (typeof outboundLength === "number" && isFinite(outboundLength)) {
|
|
3057
|
-
requestContentLength = outboundLength;
|
|
3058
|
-
if (outboundLength > maxBodyLength) {
|
|
3059
|
-
throw maxBodyLengthError();
|
|
3060
|
-
}
|
|
3061
|
-
}
|
|
3062
|
-
}
|
|
3063
|
-
const mustEnforceStreamBody = hasMaxBodyLength && (utils$1.isReadableStream(data) || utils$1.isStream(data));
|
|
3064
|
-
const trackRequestStream = (stream, onProgress, flush) => trackStream(
|
|
3065
|
-
stream,
|
|
3066
|
-
DEFAULT_CHUNK_SIZE,
|
|
3067
|
-
(loadedBytes) => {
|
|
3068
|
-
if (hasMaxBodyLength && loadedBytes > maxBodyLength) {
|
|
3069
|
-
throw pendingBodyError = maxBodyLengthError();
|
|
3070
|
-
}
|
|
3071
|
-
onProgress && onProgress(loadedBytes);
|
|
3072
|
-
},
|
|
3073
|
-
flush
|
|
3074
|
-
);
|
|
3075
|
-
if (supportsRequestStream && method !== "get" && method !== "head" && (onUploadProgress || mustEnforceStreamBody)) {
|
|
3076
|
-
requestContentLength = requestContentLength == null ? await resolveBodyLength(headers, data) : requestContentLength;
|
|
3077
|
-
if (requestContentLength !== 0 || mustEnforceStreamBody) {
|
|
3078
|
-
let _request = new Request(url, {
|
|
3079
|
-
method: "POST",
|
|
3080
|
-
body: data,
|
|
3081
|
-
duplex: "half"
|
|
3082
|
-
});
|
|
3083
|
-
let contentTypeHeader;
|
|
3084
|
-
if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get("content-type"))) {
|
|
3085
|
-
headers.setContentType(contentTypeHeader);
|
|
3086
|
-
}
|
|
3087
|
-
if (_request.body) {
|
|
3088
|
-
const [onProgress, flush] = onUploadProgress && progressEventDecorator(
|
|
3089
|
-
requestContentLength,
|
|
3090
|
-
progressEventReducer(asyncDecorator(onUploadProgress))
|
|
3091
|
-
) || [];
|
|
3092
|
-
data = trackRequestStream(_request.body, onProgress, flush);
|
|
3093
|
-
}
|
|
3094
|
-
}
|
|
3095
|
-
} else if (mustEnforceStreamBody && !isRequestSupported && isReadableStreamSupported && method !== "get" && method !== "head") {
|
|
3096
|
-
data = trackRequestStream(data);
|
|
3097
|
-
} else if (mustEnforceStreamBody && isRequestSupported && !supportsRequestStream && method !== "get" && method !== "head") {
|
|
3098
|
-
throw new AxiosError$1(
|
|
3099
|
-
"Stream request bodies are not supported by the current fetch implementation",
|
|
3100
|
-
AxiosError$1.ERR_NOT_SUPPORT,
|
|
3101
|
-
config,
|
|
3102
|
-
request
|
|
3103
|
-
);
|
|
3104
|
-
}
|
|
3105
|
-
if (!utils$1.isString(withCredentials)) {
|
|
3106
|
-
withCredentials = withCredentials ? "include" : "omit";
|
|
3107
|
-
}
|
|
3108
|
-
const isCredentialsSupported = isRequestSupported && "credentials" in Request.prototype;
|
|
3109
|
-
if (utils$1.isFormData(data)) {
|
|
3110
|
-
const contentType = headers.getContentType();
|
|
3111
|
-
if (contentType && /^multipart\/form-data/i.test(contentType) && !/boundary=/i.test(contentType)) {
|
|
3112
|
-
headers.delete("content-type");
|
|
3113
|
-
}
|
|
3114
|
-
}
|
|
3115
|
-
headers.set("User-Agent", "axios/" + VERSION$1, false);
|
|
3116
|
-
const safeFetchOptions = fetchOptions == null ? fetchOptions : Object.assign(/* @__PURE__ */ Object.create(null), fetchOptions);
|
|
3117
|
-
if (safeFetchOptions) {
|
|
3118
|
-
delete safeFetchOptions.body;
|
|
3119
|
-
delete safeFetchOptions.headers;
|
|
3120
|
-
delete safeFetchOptions.method;
|
|
3121
|
-
delete safeFetchOptions.signal;
|
|
3122
|
-
delete safeFetchOptions.duplex;
|
|
3123
|
-
delete safeFetchOptions.credentials;
|
|
3124
|
-
}
|
|
3125
|
-
const resolvedOptions = Object.assign(/* @__PURE__ */ Object.create(null), safeFetchOptions, {
|
|
3126
|
-
signal: composedSignal,
|
|
3127
|
-
method: method.toUpperCase(),
|
|
3128
|
-
headers: toByteStringHeaderObject(headers.normalize()),
|
|
3129
|
-
body: data,
|
|
3130
|
-
duplex: "half",
|
|
3131
|
-
credentials: isCredentialsSupported ? withCredentials : void 0
|
|
3132
|
-
});
|
|
3133
|
-
if (isRequestSupported) {
|
|
3134
|
-
utils$1.forEach(DEFAULT_REQUEST_OPTIONS, (value, key) => {
|
|
3135
|
-
if (resolvedOptions[key] === void 0) {
|
|
3136
|
-
resolvedOptions[key] = value;
|
|
3137
|
-
}
|
|
3138
|
-
});
|
|
3139
|
-
if (resolvedOptions.signal === void 0) {
|
|
3140
|
-
resolvedOptions.signal = null;
|
|
3141
|
-
}
|
|
3142
|
-
if (resolvedOptions.body === void 0) {
|
|
3143
|
-
resolvedOptions.body = null;
|
|
3144
|
-
}
|
|
3145
|
-
}
|
|
3146
|
-
if (maxRedirects === 0) {
|
|
3147
|
-
resolvedOptions.redirect = "manual";
|
|
3148
|
-
if (safeFetchOptions) {
|
|
3149
|
-
safeFetchOptions.redirect = "manual";
|
|
3150
|
-
}
|
|
3151
|
-
}
|
|
3152
|
-
request = isRequestSupported && new Request(url, resolvedOptions);
|
|
3153
|
-
let response = await (isRequestSupported ? _fetch(request, safeFetchOptions) : _fetch(url, resolvedOptions));
|
|
3154
|
-
const responseHeaders = AxiosHeaders$1.from(response.headers);
|
|
3155
|
-
if (hasMaxContentLength) {
|
|
3156
|
-
const declaredLength = utils$1.toFiniteNumber(responseHeaders.getContentLength());
|
|
3157
|
-
if (declaredLength != null && declaredLength > maxContentLength) {
|
|
3158
|
-
throw new AxiosError$1(
|
|
3159
|
-
"maxContentLength size of " + maxContentLength + " exceeded",
|
|
3160
|
-
AxiosError$1.ERR_BAD_RESPONSE,
|
|
3161
|
-
config,
|
|
3162
|
-
request
|
|
3163
|
-
);
|
|
3164
|
-
}
|
|
3165
|
-
}
|
|
3166
|
-
const isStreamResponse = supportsResponseStream && (responseType === "stream" || responseType === "response");
|
|
3167
|
-
if (supportsResponseStream && response.body && (onDownloadProgress || hasMaxContentLength || isStreamResponse && unsubscribe)) {
|
|
3168
|
-
const options = {};
|
|
3169
|
-
["status", "statusText", "headers"].forEach((prop) => {
|
|
3170
|
-
options[prop] = response[prop];
|
|
3171
|
-
});
|
|
3172
|
-
const responseContentLength = utils$1.toFiniteNumber(responseHeaders.getContentLength());
|
|
3173
|
-
const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
|
|
3174
|
-
responseContentLength,
|
|
3175
|
-
progressEventReducer(asyncDecorator(onDownloadProgress), true)
|
|
3176
|
-
) || [];
|
|
3177
|
-
let bytesRead = 0;
|
|
3178
|
-
const onChunkProgress = (loadedBytes) => {
|
|
3179
|
-
if (hasMaxContentLength) {
|
|
3180
|
-
bytesRead = loadedBytes;
|
|
3181
|
-
if (bytesRead > maxContentLength) {
|
|
3182
|
-
throw new AxiosError$1(
|
|
3183
|
-
"maxContentLength size of " + maxContentLength + " exceeded",
|
|
3184
|
-
AxiosError$1.ERR_BAD_RESPONSE,
|
|
3185
|
-
config,
|
|
3186
|
-
request
|
|
3187
|
-
);
|
|
3188
|
-
}
|
|
3189
|
-
}
|
|
3190
|
-
onProgress && onProgress(loadedBytes);
|
|
3191
|
-
};
|
|
3192
|
-
response = new Response(
|
|
3193
|
-
trackStream(response.body, DEFAULT_CHUNK_SIZE, onChunkProgress, () => {
|
|
3194
|
-
flush && flush();
|
|
3195
|
-
unsubscribe && unsubscribe();
|
|
3196
|
-
}),
|
|
3197
|
-
options
|
|
3198
|
-
);
|
|
3199
|
-
}
|
|
3200
|
-
responseType = responseType || "text";
|
|
3201
|
-
let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || "text"](
|
|
3202
|
-
response,
|
|
3203
|
-
config
|
|
3204
|
-
);
|
|
3205
|
-
if (hasMaxContentLength && !supportsResponseStream && !isStreamResponse) {
|
|
3206
|
-
let materializedSize;
|
|
3207
|
-
if (responseData != null) {
|
|
3208
|
-
if (typeof responseData.byteLength === "number") {
|
|
3209
|
-
materializedSize = responseData.byteLength;
|
|
3210
|
-
} else if (typeof responseData.size === "number") {
|
|
3211
|
-
materializedSize = responseData.size;
|
|
3212
|
-
} else if (typeof responseData === "string") {
|
|
3213
|
-
materializedSize = typeof TextEncoder === "function" ? new TextEncoder().encode(responseData).byteLength : responseData.length;
|
|
3214
|
-
}
|
|
3215
|
-
}
|
|
3216
|
-
if (typeof materializedSize === "number" && materializedSize > maxContentLength) {
|
|
3217
|
-
throw new AxiosError$1(
|
|
3218
|
-
"maxContentLength size of " + maxContentLength + " exceeded",
|
|
3219
|
-
AxiosError$1.ERR_BAD_RESPONSE,
|
|
3220
|
-
config,
|
|
3221
|
-
request
|
|
3222
|
-
);
|
|
3223
|
-
}
|
|
3224
|
-
}
|
|
3225
|
-
!isStreamResponse && unsubscribe && unsubscribe();
|
|
3226
|
-
return await new Promise((resolve, reject) => {
|
|
3227
|
-
settle(resolve, reject, {
|
|
3228
|
-
data: responseData,
|
|
3229
|
-
headers: AxiosHeaders$1.from(response.headers),
|
|
3230
|
-
status: response.status,
|
|
3231
|
-
statusText: response.statusText,
|
|
3232
|
-
config,
|
|
3233
|
-
request
|
|
3234
|
-
});
|
|
3235
|
-
});
|
|
3236
|
-
} catch (err) {
|
|
3237
|
-
unsubscribe && unsubscribe();
|
|
3238
|
-
if (composedSignal && composedSignal.aborted && composedSignal.reason instanceof AxiosError$1) {
|
|
3239
|
-
const canceledError = composedSignal.reason;
|
|
3240
|
-
canceledError.config = config;
|
|
3241
|
-
request && (canceledError.request = request);
|
|
3242
|
-
if (err !== canceledError) {
|
|
3243
|
-
Object.defineProperty(canceledError, "cause", {
|
|
3244
|
-
__proto__: null,
|
|
3245
|
-
value: err,
|
|
3246
|
-
writable: true,
|
|
3247
|
-
enumerable: false,
|
|
3248
|
-
configurable: true
|
|
3249
|
-
});
|
|
3250
|
-
}
|
|
3251
|
-
throw canceledError;
|
|
3252
|
-
}
|
|
3253
|
-
if (pendingBodyError) {
|
|
3254
|
-
request && !pendingBodyError.request && (pendingBodyError.request = request);
|
|
3255
|
-
throw pendingBodyError;
|
|
3256
|
-
}
|
|
3257
|
-
if (err instanceof AxiosError$1) {
|
|
3258
|
-
request && !err.request && (err.request = request);
|
|
3259
|
-
throw err;
|
|
3260
|
-
}
|
|
3261
|
-
if (err && err.name === "TypeError" && /Load failed|fetch/i.test(err.message)) {
|
|
3262
|
-
const networkError = new AxiosError$1(
|
|
3263
|
-
"Network Error",
|
|
3264
|
-
AxiosError$1.ERR_NETWORK,
|
|
3265
|
-
config,
|
|
3266
|
-
request,
|
|
3267
|
-
err && err.response
|
|
3268
|
-
);
|
|
3269
|
-
Object.defineProperty(networkError, "cause", {
|
|
3270
|
-
__proto__: null,
|
|
3271
|
-
value: err.cause || err,
|
|
3272
|
-
writable: true,
|
|
3273
|
-
enumerable: false,
|
|
3274
|
-
configurable: true
|
|
3275
|
-
});
|
|
3276
|
-
throw networkError;
|
|
3277
|
-
}
|
|
3278
|
-
throw AxiosError$1.from(err, err && err.code, config, request, err && err.response);
|
|
3279
|
-
}
|
|
3280
|
-
};
|
|
3281
|
-
};
|
|
3282
|
-
const seedCache = /* @__PURE__ */ new Map();
|
|
3283
|
-
const getFetch = (config) => {
|
|
3284
|
-
let env = config && config.env || {};
|
|
3285
|
-
const { fetch: fetch2, Request, Response } = env;
|
|
3286
|
-
const seeds = [Request, Response, fetch2];
|
|
3287
|
-
let len = seeds.length, i = len, seed, target, map = seedCache;
|
|
3288
|
-
while (i--) {
|
|
3289
|
-
seed = seeds[i];
|
|
3290
|
-
target = map.get(seed);
|
|
3291
|
-
target === void 0 && map.set(seed, target = i ? /* @__PURE__ */ new Map() : factory(env));
|
|
3292
|
-
map = target;
|
|
3293
|
-
}
|
|
3294
|
-
return target;
|
|
3295
|
-
};
|
|
3296
|
-
getFetch();
|
|
3297
|
-
const knownAdapters = {
|
|
3298
|
-
http: httpAdapter,
|
|
3299
|
-
xhr: xhrAdapter,
|
|
3300
|
-
fetch: {
|
|
3301
|
-
get: getFetch
|
|
3302
|
-
}
|
|
3303
|
-
};
|
|
3304
|
-
utils$1.forEach(knownAdapters, (fn, value) => {
|
|
3305
|
-
if (fn) {
|
|
3306
|
-
try {
|
|
3307
|
-
Object.defineProperty(fn, "name", { __proto__: null, value });
|
|
3308
|
-
} catch (e) {
|
|
3309
|
-
}
|
|
3310
|
-
Object.defineProperty(fn, "adapterName", { __proto__: null, value });
|
|
3311
|
-
}
|
|
3312
|
-
});
|
|
3313
|
-
const renderReason = (reason) => `- ${reason}`;
|
|
3314
|
-
const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false;
|
|
3315
|
-
function getAdapter$1(adapters2, config) {
|
|
3316
|
-
adapters2 = utils$1.isArray(adapters2) ? adapters2 : [adapters2];
|
|
3317
|
-
const { length } = adapters2;
|
|
3318
|
-
let nameOrAdapter;
|
|
3319
|
-
let adapter;
|
|
3320
|
-
const rejectedReasons = {};
|
|
3321
|
-
for (let i = 0; i < length; i++) {
|
|
3322
|
-
nameOrAdapter = adapters2[i];
|
|
3323
|
-
let id;
|
|
3324
|
-
adapter = nameOrAdapter;
|
|
3325
|
-
if (!isResolvedHandle(nameOrAdapter)) {
|
|
3326
|
-
adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
|
|
3327
|
-
if (adapter === void 0) {
|
|
3328
|
-
throw new AxiosError$1(`Unknown adapter '${id}'`);
|
|
3329
|
-
}
|
|
3330
|
-
}
|
|
3331
|
-
if (adapter && (utils$1.isFunction(adapter) || (adapter = adapter.get(config)))) {
|
|
3332
|
-
break;
|
|
3333
|
-
}
|
|
3334
|
-
rejectedReasons[id || "#" + i] = adapter;
|
|
3335
|
-
}
|
|
3336
|
-
if (!adapter) {
|
|
3337
|
-
const reasons = Object.entries(rejectedReasons).map(
|
|
3338
|
-
([id, state]) => `adapter ${id} ` + (state === false ? "is not supported by the environment" : "is not available in the build")
|
|
3339
|
-
);
|
|
3340
|
-
let s = length ? reasons.length > 1 ? "since :\n" + reasons.map(renderReason).join("\n") : " " + renderReason(reasons[0]) : "as no adapter specified";
|
|
3341
|
-
throw new AxiosError$1(
|
|
3342
|
-
`There is no suitable adapter to dispatch the request ` + s,
|
|
3343
|
-
AxiosError$1.ERR_NOT_SUPPORT
|
|
3344
|
-
);
|
|
3345
|
-
}
|
|
3346
|
-
return adapter;
|
|
3347
|
-
}
|
|
3348
|
-
const adapters = {
|
|
3349
|
-
/**
|
|
3350
|
-
* Resolve an adapter from a list of adapter names or functions.
|
|
3351
|
-
* @type {Function}
|
|
3352
|
-
*/
|
|
3353
|
-
getAdapter: getAdapter$1,
|
|
3354
|
-
/**
|
|
3355
|
-
* Exposes all known adapters
|
|
3356
|
-
* @type {Object<string, Function|Object>}
|
|
3357
|
-
*/
|
|
3358
|
-
adapters: knownAdapters
|
|
3359
|
-
};
|
|
3360
|
-
function throwIfCancellationRequested(config) {
|
|
3361
|
-
if (config.cancelToken) {
|
|
3362
|
-
config.cancelToken.throwIfRequested();
|
|
3363
|
-
}
|
|
3364
|
-
if (config.signal && config.signal.aborted) {
|
|
3365
|
-
throw new CanceledError$1(null, config);
|
|
3366
|
-
}
|
|
3367
|
-
}
|
|
3368
|
-
function dispatchRequest(_config) {
|
|
3369
|
-
const config = utils$1.toSafeFlatObject(_config);
|
|
3370
|
-
throwIfCancellationRequested(config);
|
|
3371
|
-
config.headers = AxiosHeaders$1.from(utils$1.getSafeProp(config, "headers"));
|
|
3372
|
-
config.data = transformData.call(config, config.transformRequest);
|
|
3373
|
-
if (["post", "put", "patch"].indexOf(config.method) !== -1) {
|
|
3374
|
-
config.headers.setContentType("application/x-www-form-urlencoded", false);
|
|
3375
|
-
}
|
|
3376
|
-
const adapter = adapters.getAdapter(config.adapter || defaults.adapter, config);
|
|
3377
|
-
return adapter(config).then(
|
|
3378
|
-
function onAdapterResolution(response) {
|
|
3379
|
-
throwIfCancellationRequested(config);
|
|
3380
|
-
config.response = response;
|
|
3381
|
-
try {
|
|
3382
|
-
response.data = transformData.call(config, config.transformResponse, response);
|
|
3383
|
-
} finally {
|
|
3384
|
-
delete config.response;
|
|
3385
|
-
}
|
|
3386
|
-
response.headers = AxiosHeaders$1.from(response.headers);
|
|
3387
|
-
return response;
|
|
3388
|
-
},
|
|
3389
|
-
function onAdapterRejection(reason) {
|
|
3390
|
-
if (!isCancel$1(reason)) {
|
|
3391
|
-
throwIfCancellationRequested(config);
|
|
3392
|
-
if (reason && reason.response) {
|
|
3393
|
-
config.response = reason.response;
|
|
3394
|
-
try {
|
|
3395
|
-
reason.response.data = transformData.call(
|
|
3396
|
-
config,
|
|
3397
|
-
config.transformResponse,
|
|
3398
|
-
reason.response
|
|
3399
|
-
);
|
|
3400
|
-
} finally {
|
|
3401
|
-
delete config.response;
|
|
3402
|
-
}
|
|
3403
|
-
reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
|
|
3404
|
-
}
|
|
3405
|
-
}
|
|
3406
|
-
return Promise.reject(reason);
|
|
3407
|
-
}
|
|
3408
|
-
);
|
|
3409
|
-
}
|
|
3410
|
-
const validators$1 = {};
|
|
3411
|
-
["object", "boolean", "number", "function", "string", "symbol"].forEach((type, i) => {
|
|
3412
|
-
validators$1[type] = function validator2(thing) {
|
|
3413
|
-
return typeof thing === type || "a" + (i < 1 ? "n " : " ") + type;
|
|
3414
|
-
};
|
|
3415
|
-
});
|
|
3416
|
-
const deprecatedWarnings = {};
|
|
3417
|
-
validators$1.transitional = function transitional(validator2, version, message) {
|
|
3418
|
-
function formatMessage(opt, desc) {
|
|
3419
|
-
return "[Axios v" + VERSION$1 + "] Transitional option '" + opt + "'" + desc + (message ? ". " + message : "");
|
|
3420
|
-
}
|
|
3421
|
-
return (value, opt, opts) => {
|
|
3422
|
-
if (validator2 === false) {
|
|
3423
|
-
throw new AxiosError$1(
|
|
3424
|
-
formatMessage(opt, " has been removed" + (version ? " in " + version : "")),
|
|
3425
|
-
AxiosError$1.ERR_DEPRECATED
|
|
3426
|
-
);
|
|
3427
|
-
}
|
|
3428
|
-
if (version && !deprecatedWarnings[opt]) {
|
|
3429
|
-
deprecatedWarnings[opt] = true;
|
|
3430
|
-
console.warn(
|
|
3431
|
-
formatMessage(
|
|
3432
|
-
opt,
|
|
3433
|
-
" has been deprecated since v" + version + " and will be removed in the near future"
|
|
3434
|
-
)
|
|
3435
|
-
);
|
|
3436
|
-
}
|
|
3437
|
-
return validator2 ? validator2(value, opt, opts) : true;
|
|
3438
|
-
};
|
|
3439
|
-
};
|
|
3440
|
-
validators$1.spelling = function spelling(correctSpelling) {
|
|
3441
|
-
return (value, opt) => {
|
|
3442
|
-
console.warn(`${opt} is likely a misspelling of ${correctSpelling}`);
|
|
3443
|
-
return true;
|
|
3444
|
-
};
|
|
3445
|
-
};
|
|
3446
|
-
function assertOptions(options, schema, allowUnknown) {
|
|
3447
|
-
if (typeof options !== "object" || options === null) {
|
|
3448
|
-
throw new AxiosError$1("options must be an object", AxiosError$1.ERR_BAD_OPTION_VALUE);
|
|
3449
|
-
}
|
|
3450
|
-
const keys = Object.keys(options);
|
|
3451
|
-
let i = keys.length;
|
|
3452
|
-
while (i-- > 0) {
|
|
3453
|
-
const opt = keys[i];
|
|
3454
|
-
const validator2 = Object.prototype.hasOwnProperty.call(schema, opt) ? schema[opt] : void 0;
|
|
3455
|
-
if (validator2) {
|
|
3456
|
-
const value = options[opt];
|
|
3457
|
-
const result = value === void 0 || validator2(value, opt, options);
|
|
3458
|
-
if (result !== true) {
|
|
3459
|
-
throw new AxiosError$1(
|
|
3460
|
-
"option " + opt + " must be " + result,
|
|
3461
|
-
AxiosError$1.ERR_BAD_OPTION_VALUE
|
|
3462
|
-
);
|
|
3463
|
-
}
|
|
3464
|
-
continue;
|
|
3465
|
-
}
|
|
3466
|
-
if (allowUnknown !== true) {
|
|
3467
|
-
throw new AxiosError$1("Unknown option " + opt, AxiosError$1.ERR_BAD_OPTION);
|
|
3468
|
-
}
|
|
3469
|
-
}
|
|
3470
|
-
}
|
|
3471
|
-
const validator = {
|
|
3472
|
-
assertOptions,
|
|
3473
|
-
validators: validators$1
|
|
3474
|
-
};
|
|
3475
|
-
const validators = validator.validators;
|
|
3476
|
-
let Axios$1 = class Axios {
|
|
3477
|
-
constructor(instanceConfig) {
|
|
3478
|
-
this.defaults = instanceConfig || {};
|
|
3479
|
-
this.interceptors = {
|
|
3480
|
-
request: new InterceptorManager(),
|
|
3481
|
-
response: new InterceptorManager()
|
|
3482
|
-
};
|
|
3483
|
-
}
|
|
3484
|
-
/**
|
|
3485
|
-
* Dispatch a request
|
|
3486
|
-
*
|
|
3487
|
-
* @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
|
|
3488
|
-
* @param {?Object} config
|
|
3489
|
-
*
|
|
3490
|
-
* @returns {Promise} The Promise to be fulfilled
|
|
3491
|
-
*/
|
|
3492
|
-
async request(configOrUrl, config) {
|
|
3493
|
-
try {
|
|
3494
|
-
return await this._request(configOrUrl, config);
|
|
3495
|
-
} catch (err) {
|
|
3496
|
-
if (err instanceof Error) {
|
|
3497
|
-
try {
|
|
3498
|
-
let dummy = {};
|
|
3499
|
-
Error.captureStackTrace ? Error.captureStackTrace(dummy) : dummy = new Error();
|
|
3500
|
-
const dummyStack = dummy.stack;
|
|
3501
|
-
let stack = "";
|
|
3502
|
-
if (typeof dummyStack === "string") {
|
|
3503
|
-
const firstNewlineIndex = dummyStack.indexOf("\n");
|
|
3504
|
-
stack = firstNewlineIndex === -1 ? "" : dummyStack.slice(firstNewlineIndex + 1);
|
|
3505
|
-
}
|
|
3506
|
-
if (!err.stack) {
|
|
3507
|
-
err.stack = stack;
|
|
3508
|
-
} else if (stack) {
|
|
3509
|
-
const firstNewlineIndex = stack.indexOf("\n");
|
|
3510
|
-
const secondNewlineIndex = firstNewlineIndex === -1 ? -1 : stack.indexOf("\n", firstNewlineIndex + 1);
|
|
3511
|
-
const stackWithoutTwoTopLines = secondNewlineIndex === -1 ? "" : stack.slice(secondNewlineIndex + 1);
|
|
3512
|
-
if (!String(err.stack).endsWith(stackWithoutTwoTopLines)) {
|
|
3513
|
-
err.stack += "\n" + stack;
|
|
3514
|
-
}
|
|
3515
|
-
}
|
|
3516
|
-
} catch (e) {
|
|
3517
|
-
}
|
|
3518
|
-
}
|
|
3519
|
-
throw err;
|
|
3520
|
-
}
|
|
3521
|
-
}
|
|
3522
|
-
_request(configOrUrl, config) {
|
|
3523
|
-
if (typeof configOrUrl === "string") {
|
|
3524
|
-
config = config || {};
|
|
3525
|
-
config.url = configOrUrl;
|
|
3526
|
-
} else {
|
|
3527
|
-
config = configOrUrl || {};
|
|
3528
|
-
}
|
|
3529
|
-
config = mergeConfig$1(this.defaults, config);
|
|
3530
|
-
const { transitional: transitional2, paramsSerializer, headers } = config;
|
|
3531
|
-
if (transitional2 !== void 0) {
|
|
3532
|
-
validator.assertOptions(
|
|
3533
|
-
transitional2,
|
|
3534
|
-
{
|
|
3535
|
-
silentJSONParsing: validators.transitional(validators.boolean),
|
|
3536
|
-
forcedJSONParsing: validators.transitional(validators.boolean),
|
|
3537
|
-
clarifyTimeoutError: validators.transitional(validators.boolean),
|
|
3538
|
-
legacyInterceptorReqResOrdering: validators.transitional(validators.boolean),
|
|
3539
|
-
advertiseZstdAcceptEncoding: validators.transitional(validators.boolean),
|
|
3540
|
-
validateStatusUndefinedResolves: validators.transitional(validators.boolean)
|
|
3541
|
-
},
|
|
3542
|
-
false
|
|
3543
|
-
);
|
|
3544
|
-
}
|
|
3545
|
-
if (paramsSerializer != null) {
|
|
3546
|
-
if (utils$1.isFunction(paramsSerializer)) {
|
|
3547
|
-
config.paramsSerializer = {
|
|
3548
|
-
serialize: paramsSerializer
|
|
3549
|
-
};
|
|
3550
|
-
} else {
|
|
3551
|
-
validator.assertOptions(
|
|
3552
|
-
paramsSerializer,
|
|
3553
|
-
{
|
|
3554
|
-
encode: validators.function,
|
|
3555
|
-
serialize: validators.function
|
|
3556
|
-
},
|
|
3557
|
-
true
|
|
3558
|
-
);
|
|
3559
|
-
}
|
|
3560
|
-
}
|
|
3561
|
-
if (config.allowAbsoluteUrls !== void 0) ;
|
|
3562
|
-
else if (this.defaults.allowAbsoluteUrls !== void 0) {
|
|
3563
|
-
config.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls;
|
|
3564
|
-
} else {
|
|
3565
|
-
config.allowAbsoluteUrls = true;
|
|
3566
|
-
}
|
|
3567
|
-
validator.assertOptions(
|
|
3568
|
-
config,
|
|
3569
|
-
{
|
|
3570
|
-
baseUrl: validators.spelling("baseURL"),
|
|
3571
|
-
withXsrfToken: validators.spelling("withXSRFToken")
|
|
3572
|
-
},
|
|
3573
|
-
true
|
|
3574
|
-
);
|
|
3575
|
-
config.method = (utils$1.getSafeProp(config, "method") || utils$1.getSafeProp(this.defaults, "method") || "get").toLowerCase();
|
|
3576
|
-
let contextHeaders = headers && utils$1.merge(headers.common, headers[config.method]);
|
|
3577
|
-
headers && utils$1.forEach(methodList.concat("common"), (method) => {
|
|
3578
|
-
delete headers[method];
|
|
3579
|
-
});
|
|
3580
|
-
config.headers = AxiosHeaders$1.concat(contextHeaders, headers);
|
|
3581
|
-
const requestInterceptorChain = [];
|
|
3582
|
-
let synchronousRequestInterceptors = true;
|
|
3583
|
-
this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
|
|
3584
|
-
if (typeof interceptor.runWhen === "function" && interceptor.runWhen(config) === false) {
|
|
3585
|
-
return;
|
|
3586
|
-
}
|
|
3587
|
-
synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
|
|
3588
|
-
const transitional3 = config.transitional || transitionalDefaults;
|
|
3589
|
-
const legacyInterceptorReqResOrdering = transitional3 && transitional3.legacyInterceptorReqResOrdering;
|
|
3590
|
-
if (legacyInterceptorReqResOrdering) {
|
|
3591
|
-
requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
|
|
3592
|
-
} else {
|
|
3593
|
-
requestInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
|
|
3594
|
-
}
|
|
3595
|
-
});
|
|
3596
|
-
const responseInterceptorChain = [];
|
|
3597
|
-
this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
|
|
3598
|
-
responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
|
|
3599
|
-
});
|
|
3600
|
-
let promise;
|
|
3601
|
-
let i = 0;
|
|
3602
|
-
let len;
|
|
3603
|
-
if (!synchronousRequestInterceptors) {
|
|
3604
|
-
const chain = [dispatchRequest.bind(this), void 0];
|
|
3605
|
-
chain.unshift(...requestInterceptorChain);
|
|
3606
|
-
chain.push(...responseInterceptorChain);
|
|
3607
|
-
len = chain.length;
|
|
3608
|
-
promise = Promise.resolve(config);
|
|
3609
|
-
while (i < len) {
|
|
3610
|
-
promise = promise.then(chain[i++], chain[i++]);
|
|
3611
|
-
}
|
|
3612
|
-
return promise;
|
|
3613
|
-
}
|
|
3614
|
-
len = requestInterceptorChain.length;
|
|
3615
|
-
let newConfig = config;
|
|
3616
|
-
while (i < len) {
|
|
3617
|
-
const onFulfilled = requestInterceptorChain[i++];
|
|
3618
|
-
const onRejected = requestInterceptorChain[i++];
|
|
3619
|
-
try {
|
|
3620
|
-
newConfig = onFulfilled ? onFulfilled(newConfig) : newConfig;
|
|
3621
|
-
} catch (error) {
|
|
3622
|
-
if (!onRejected) {
|
|
3623
|
-
promise = Promise.reject(error);
|
|
3624
|
-
break;
|
|
3625
|
-
}
|
|
3626
|
-
try {
|
|
3627
|
-
const rejectedResult = onRejected.call(this, error);
|
|
3628
|
-
if (utils$1.isThenable(rejectedResult)) {
|
|
3629
|
-
promise = Promise.resolve(rejectedResult).then(
|
|
3630
|
-
() => dispatchRequest.call(this, newConfig)
|
|
3631
|
-
);
|
|
3632
|
-
}
|
|
3633
|
-
} catch (rejectedError) {
|
|
3634
|
-
promise = Promise.reject(rejectedError);
|
|
3635
|
-
}
|
|
3636
|
-
break;
|
|
3637
|
-
}
|
|
3638
|
-
}
|
|
3639
|
-
if (!promise) {
|
|
3640
|
-
try {
|
|
3641
|
-
promise = dispatchRequest.call(this, newConfig);
|
|
3642
|
-
} catch (error) {
|
|
3643
|
-
promise = Promise.reject(error);
|
|
3644
|
-
}
|
|
3645
|
-
}
|
|
3646
|
-
i = 0;
|
|
3647
|
-
len = responseInterceptorChain.length;
|
|
3648
|
-
while (i < len) {
|
|
3649
|
-
promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);
|
|
3650
|
-
}
|
|
3651
|
-
return promise;
|
|
3652
|
-
}
|
|
3653
|
-
getUri(config) {
|
|
3654
|
-
config = mergeConfig$1(this.defaults, config);
|
|
3655
|
-
const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls, config);
|
|
3656
|
-
return buildURL(fullPath, config.params, config.paramsSerializer);
|
|
3657
|
-
}
|
|
3658
|
-
};
|
|
3659
|
-
utils$1.forEach(["delete", "get", "head", "options"], function forEachMethodNoData(method) {
|
|
3660
|
-
Axios$1.prototype[method] = function(url, config) {
|
|
3661
|
-
return this.request(
|
|
3662
|
-
mergeConfig$1(config || {}, {
|
|
3663
|
-
method,
|
|
3664
|
-
url,
|
|
3665
|
-
data: config && utils$1.hasOwnProp(config, "data") ? config.data : void 0
|
|
3666
|
-
})
|
|
3667
|
-
);
|
|
3668
|
-
};
|
|
3669
|
-
});
|
|
3670
|
-
utils$1.forEach(["post", "put", "patch", "query"], function forEachMethodWithData(method) {
|
|
3671
|
-
function generateHTTPMethod(isForm) {
|
|
3672
|
-
return function httpMethod(url, data, config) {
|
|
3673
|
-
return this.request(
|
|
3674
|
-
mergeConfig$1(config || {}, {
|
|
3675
|
-
method,
|
|
3676
|
-
headers: isForm ? {
|
|
3677
|
-
"Content-Type": "multipart/form-data"
|
|
3678
|
-
} : {},
|
|
3679
|
-
url,
|
|
3680
|
-
data
|
|
3681
|
-
})
|
|
3682
|
-
);
|
|
3683
|
-
};
|
|
3684
|
-
}
|
|
3685
|
-
Axios$1.prototype[method] = generateHTTPMethod();
|
|
3686
|
-
if (method !== "query") {
|
|
3687
|
-
Axios$1.prototype[method + "Form"] = generateHTTPMethod(true);
|
|
3688
|
-
}
|
|
3689
|
-
});
|
|
3690
|
-
let CancelToken$1 = class CancelToken {
|
|
3691
|
-
constructor(executor) {
|
|
3692
|
-
if (typeof executor !== "function") {
|
|
3693
|
-
throw new TypeError("executor must be a function.");
|
|
3694
|
-
}
|
|
3695
|
-
let resolvePromise;
|
|
3696
|
-
this.promise = new Promise(function promiseExecutor(resolve) {
|
|
3697
|
-
resolvePromise = resolve;
|
|
3698
|
-
});
|
|
3699
|
-
const token = this;
|
|
3700
|
-
this.promise.then((cancel) => {
|
|
3701
|
-
if (!token._listeners) return;
|
|
3702
|
-
let i = token._listeners.length;
|
|
3703
|
-
while (i-- > 0) {
|
|
3704
|
-
token._listeners[i](cancel);
|
|
3705
|
-
}
|
|
3706
|
-
token._listeners = null;
|
|
3707
|
-
});
|
|
3708
|
-
this.promise.then = (onfulfilled) => {
|
|
3709
|
-
let _resolve;
|
|
3710
|
-
const promise = new Promise((resolve) => {
|
|
3711
|
-
token.subscribe(resolve);
|
|
3712
|
-
_resolve = resolve;
|
|
3713
|
-
}).then(onfulfilled);
|
|
3714
|
-
promise.cancel = function reject() {
|
|
3715
|
-
token.unsubscribe(_resolve);
|
|
3716
|
-
};
|
|
3717
|
-
return promise;
|
|
3718
|
-
};
|
|
3719
|
-
executor(function cancel(message, config, request) {
|
|
3720
|
-
if (token.reason) {
|
|
3721
|
-
return;
|
|
3722
|
-
}
|
|
3723
|
-
token.reason = new CanceledError$1(message, config, request);
|
|
3724
|
-
resolvePromise(token.reason);
|
|
3725
|
-
});
|
|
3726
|
-
}
|
|
3727
|
-
/**
|
|
3728
|
-
* Throws a `CanceledError` if cancellation has been requested.
|
|
3729
|
-
*/
|
|
3730
|
-
throwIfRequested() {
|
|
3731
|
-
if (this.reason) {
|
|
3732
|
-
throw this.reason;
|
|
3733
|
-
}
|
|
3734
|
-
}
|
|
3735
|
-
/**
|
|
3736
|
-
* Subscribe to the cancel signal
|
|
3737
|
-
*/
|
|
3738
|
-
subscribe(listener) {
|
|
3739
|
-
if (this.reason) {
|
|
3740
|
-
listener(this.reason);
|
|
3741
|
-
return;
|
|
3742
|
-
}
|
|
3743
|
-
if (this._listeners) {
|
|
3744
|
-
this._listeners.push(listener);
|
|
3745
|
-
} else {
|
|
3746
|
-
this._listeners = [listener];
|
|
3747
|
-
}
|
|
3748
|
-
}
|
|
3749
|
-
/**
|
|
3750
|
-
* Unsubscribe from the cancel signal
|
|
3751
|
-
*/
|
|
3752
|
-
unsubscribe(listener) {
|
|
3753
|
-
if (!this._listeners) {
|
|
3754
|
-
return;
|
|
3755
|
-
}
|
|
3756
|
-
const index2 = this._listeners.indexOf(listener);
|
|
3757
|
-
if (index2 !== -1) {
|
|
3758
|
-
this._listeners.splice(index2, 1);
|
|
3759
|
-
}
|
|
3760
|
-
}
|
|
3761
|
-
toAbortSignal() {
|
|
3762
|
-
const controller = new AbortController();
|
|
3763
|
-
const abort = (err) => {
|
|
3764
|
-
controller.abort(err);
|
|
3765
|
-
};
|
|
3766
|
-
this.subscribe(abort);
|
|
3767
|
-
controller.signal.unsubscribe = () => this.unsubscribe(abort);
|
|
3768
|
-
return controller.signal;
|
|
3769
|
-
}
|
|
3770
|
-
/**
|
|
3771
|
-
* Returns an object that contains a new `CancelToken` and a function that, when called,
|
|
3772
|
-
* cancels the `CancelToken`.
|
|
3773
|
-
*/
|
|
3774
|
-
static source() {
|
|
3775
|
-
let cancel;
|
|
3776
|
-
const token = new CancelToken(function executor(c) {
|
|
3777
|
-
cancel = c;
|
|
3778
|
-
});
|
|
3779
|
-
return {
|
|
3780
|
-
token,
|
|
3781
|
-
cancel
|
|
3782
|
-
};
|
|
3783
|
-
}
|
|
3784
|
-
};
|
|
3785
|
-
function spread$1(callback) {
|
|
3786
|
-
return function wrap(arr) {
|
|
3787
|
-
return callback.apply(null, arr);
|
|
3788
|
-
};
|
|
3789
|
-
}
|
|
3790
|
-
function isAxiosError$1(payload) {
|
|
3791
|
-
return utils$1.isObject(payload) && payload.isAxiosError === true;
|
|
3792
|
-
}
|
|
3793
|
-
const HttpStatusCode$1 = {
|
|
3794
|
-
Continue: 100,
|
|
3795
|
-
SwitchingProtocols: 101,
|
|
3796
|
-
Processing: 102,
|
|
3797
|
-
EarlyHints: 103,
|
|
3798
|
-
Ok: 200,
|
|
3799
|
-
Created: 201,
|
|
3800
|
-
Accepted: 202,
|
|
3801
|
-
NonAuthoritativeInformation: 203,
|
|
3802
|
-
NoContent: 204,
|
|
3803
|
-
ResetContent: 205,
|
|
3804
|
-
PartialContent: 206,
|
|
3805
|
-
MultiStatus: 207,
|
|
3806
|
-
AlreadyReported: 208,
|
|
3807
|
-
ImUsed: 226,
|
|
3808
|
-
MultipleChoices: 300,
|
|
3809
|
-
MovedPermanently: 301,
|
|
3810
|
-
Found: 302,
|
|
3811
|
-
SeeOther: 303,
|
|
3812
|
-
NotModified: 304,
|
|
3813
|
-
UseProxy: 305,
|
|
3814
|
-
Unused: 306,
|
|
3815
|
-
TemporaryRedirect: 307,
|
|
3816
|
-
PermanentRedirect: 308,
|
|
3817
|
-
BadRequest: 400,
|
|
3818
|
-
Unauthorized: 401,
|
|
3819
|
-
PaymentRequired: 402,
|
|
3820
|
-
Forbidden: 403,
|
|
3821
|
-
NotFound: 404,
|
|
3822
|
-
MethodNotAllowed: 405,
|
|
3823
|
-
NotAcceptable: 406,
|
|
3824
|
-
ProxyAuthenticationRequired: 407,
|
|
3825
|
-
RequestTimeout: 408,
|
|
3826
|
-
Conflict: 409,
|
|
3827
|
-
Gone: 410,
|
|
3828
|
-
LengthRequired: 411,
|
|
3829
|
-
PreconditionFailed: 412,
|
|
3830
|
-
/**
|
|
3831
|
-
* @deprecated Use `ContentTooLarge` instead.
|
|
3832
|
-
*/
|
|
3833
|
-
PayloadTooLarge: 413,
|
|
3834
|
-
ContentTooLarge: 413,
|
|
3835
|
-
UriTooLong: 414,
|
|
3836
|
-
UnsupportedMediaType: 415,
|
|
3837
|
-
RangeNotSatisfiable: 416,
|
|
3838
|
-
ExpectationFailed: 417,
|
|
3839
|
-
ImATeapot: 418,
|
|
3840
|
-
MisdirectedRequest: 421,
|
|
3841
|
-
/**
|
|
3842
|
-
* @deprecated Use `UnprocessableContent` instead.
|
|
3843
|
-
*/
|
|
3844
|
-
UnprocessableEntity: 422,
|
|
3845
|
-
UnprocessableContent: 422,
|
|
3846
|
-
Locked: 423,
|
|
3847
|
-
FailedDependency: 424,
|
|
3848
|
-
TooEarly: 425,
|
|
3849
|
-
UpgradeRequired: 426,
|
|
3850
|
-
PreconditionRequired: 428,
|
|
3851
|
-
TooManyRequests: 429,
|
|
3852
|
-
RequestHeaderFieldsTooLarge: 431,
|
|
3853
|
-
UnavailableForLegalReasons: 451,
|
|
3854
|
-
InternalServerError: 500,
|
|
3855
|
-
NotImplemented: 501,
|
|
3856
|
-
BadGateway: 502,
|
|
3857
|
-
ServiceUnavailable: 503,
|
|
3858
|
-
GatewayTimeout: 504,
|
|
3859
|
-
HttpVersionNotSupported: 505,
|
|
3860
|
-
VariantAlsoNegotiates: 506,
|
|
3861
|
-
InsufficientStorage: 507,
|
|
3862
|
-
LoopDetected: 508,
|
|
3863
|
-
NotExtended: 510,
|
|
3864
|
-
NetworkAuthenticationRequired: 511,
|
|
3865
|
-
WebServerReturnsAnUnknownError: 520,
|
|
3866
|
-
WebServerIsDown: 521,
|
|
3867
|
-
ConnectionTimedOut: 522,
|
|
3868
|
-
OriginIsUnreachable: 523,
|
|
3869
|
-
TimeoutOccurred: 524,
|
|
3870
|
-
SslHandshakeFailed: 525,
|
|
3871
|
-
InvalidSslCertificate: 526
|
|
3872
|
-
};
|
|
3873
|
-
Object.entries(HttpStatusCode$1).forEach(([key, value]) => {
|
|
3874
|
-
if (HttpStatusCode$1[value] === void 0) {
|
|
3875
|
-
HttpStatusCode$1[value] = key;
|
|
3876
|
-
}
|
|
3877
|
-
});
|
|
3878
|
-
function createInstance(defaultConfig) {
|
|
3879
|
-
const context = new Axios$1(defaultConfig);
|
|
3880
|
-
const instance = bind(Axios$1.prototype.request, context);
|
|
3881
|
-
utils$1.extend(instance, Axios$1.prototype, context, { allOwnKeys: true });
|
|
3882
|
-
utils$1.extend(instance, context, null, { allOwnKeys: true });
|
|
3883
|
-
instance.create = function create2(instanceConfig) {
|
|
3884
|
-
return createInstance(mergeConfig$1(defaultConfig, instanceConfig));
|
|
3885
|
-
};
|
|
3886
|
-
return instance;
|
|
3887
|
-
}
|
|
3888
|
-
const axios = createInstance(defaults);
|
|
3889
|
-
axios.Axios = Axios$1;
|
|
3890
|
-
axios.CanceledError = CanceledError$1;
|
|
3891
|
-
axios.CancelToken = CancelToken$1;
|
|
3892
|
-
axios.isCancel = isCancel$1;
|
|
3893
|
-
axios.VERSION = VERSION$1;
|
|
3894
|
-
axios.toFormData = toFormData$1;
|
|
3895
|
-
axios.AxiosError = AxiosError$1;
|
|
3896
|
-
axios.Cancel = axios.CanceledError;
|
|
3897
|
-
axios.all = function all(promises) {
|
|
3898
|
-
return Promise.all(promises);
|
|
3899
|
-
};
|
|
3900
|
-
axios.spread = spread$1;
|
|
3901
|
-
axios.isAxiosError = isAxiosError$1;
|
|
3902
|
-
axios.mergeConfig = mergeConfig$1;
|
|
3903
|
-
axios.AxiosHeaders = AxiosHeaders$1;
|
|
3904
|
-
axios.formToJSON = (thing) => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
|
|
3905
|
-
axios.getAdapter = adapters.getAdapter;
|
|
3906
|
-
axios.HttpStatusCode = HttpStatusCode$1;
|
|
3907
|
-
axios.default = axios;
|
|
3908
|
-
const {
|
|
3909
|
-
Axios: Axios2,
|
|
3910
|
-
AxiosError: AxiosError2,
|
|
3911
|
-
CanceledError: CanceledError2,
|
|
3912
|
-
isCancel,
|
|
3913
|
-
CancelToken: CancelToken2,
|
|
3914
|
-
VERSION,
|
|
3915
|
-
all: all2,
|
|
3916
|
-
Cancel,
|
|
3917
|
-
isAxiosError,
|
|
3918
|
-
spread,
|
|
3919
|
-
toFormData,
|
|
3920
|
-
AxiosHeaders: AxiosHeaders2,
|
|
3921
|
-
HttpStatusCode,
|
|
3922
|
-
formToJSON,
|
|
3923
|
-
getAdapter,
|
|
3924
|
-
mergeConfig,
|
|
3925
|
-
create
|
|
3926
|
-
} = axios;
|
|
3927
|
-
var isRetryAllowed$1;
|
|
3928
|
-
var hasRequiredIsRetryAllowed;
|
|
3929
|
-
function requireIsRetryAllowed() {
|
|
3930
|
-
if (hasRequiredIsRetryAllowed) return isRetryAllowed$1;
|
|
3931
|
-
hasRequiredIsRetryAllowed = 1;
|
|
3932
|
-
const denyList = /* @__PURE__ */ new Set([
|
|
3933
|
-
"ENOTFOUND",
|
|
3934
|
-
"ENETUNREACH",
|
|
3935
|
-
// SSL errors from https://github.com/nodejs/node/blob/fc8e3e2cdc521978351de257030db0076d79e0ab/src/crypto/crypto_common.cc#L301-L328
|
|
3936
|
-
"UNABLE_TO_GET_ISSUER_CERT",
|
|
3937
|
-
"UNABLE_TO_GET_CRL",
|
|
3938
|
-
"UNABLE_TO_DECRYPT_CERT_SIGNATURE",
|
|
3939
|
-
"UNABLE_TO_DECRYPT_CRL_SIGNATURE",
|
|
3940
|
-
"UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY",
|
|
3941
|
-
"CERT_SIGNATURE_FAILURE",
|
|
3942
|
-
"CRL_SIGNATURE_FAILURE",
|
|
3943
|
-
"CERT_NOT_YET_VALID",
|
|
3944
|
-
"CERT_HAS_EXPIRED",
|
|
3945
|
-
"CRL_NOT_YET_VALID",
|
|
3946
|
-
"CRL_HAS_EXPIRED",
|
|
3947
|
-
"ERROR_IN_CERT_NOT_BEFORE_FIELD",
|
|
3948
|
-
"ERROR_IN_CERT_NOT_AFTER_FIELD",
|
|
3949
|
-
"ERROR_IN_CRL_LAST_UPDATE_FIELD",
|
|
3950
|
-
"ERROR_IN_CRL_NEXT_UPDATE_FIELD",
|
|
3951
|
-
"OUT_OF_MEM",
|
|
3952
|
-
"DEPTH_ZERO_SELF_SIGNED_CERT",
|
|
3953
|
-
"SELF_SIGNED_CERT_IN_CHAIN",
|
|
3954
|
-
"UNABLE_TO_GET_ISSUER_CERT_LOCALLY",
|
|
3955
|
-
"UNABLE_TO_VERIFY_LEAF_SIGNATURE",
|
|
3956
|
-
"CERT_CHAIN_TOO_LONG",
|
|
3957
|
-
"CERT_REVOKED",
|
|
3958
|
-
"INVALID_CA",
|
|
3959
|
-
"PATH_LENGTH_EXCEEDED",
|
|
3960
|
-
"INVALID_PURPOSE",
|
|
3961
|
-
"CERT_UNTRUSTED",
|
|
3962
|
-
"CERT_REJECTED",
|
|
3963
|
-
"HOSTNAME_MISMATCH"
|
|
3964
|
-
]);
|
|
3965
|
-
isRetryAllowed$1 = (error) => !denyList.has(error && error.code);
|
|
3966
|
-
return isRetryAllowed$1;
|
|
3967
|
-
}
|
|
3968
|
-
var isRetryAllowedExports = requireIsRetryAllowed();
|
|
3969
|
-
const isRetryAllowed = /* @__PURE__ */ getDefaultExportFromCjs(isRetryAllowedExports);
|
|
3970
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
3971
|
-
try {
|
|
3972
|
-
var info = gen[key](arg);
|
|
3973
|
-
var value = info.value;
|
|
3974
|
-
} catch (error) {
|
|
3975
|
-
reject(error);
|
|
3976
|
-
return;
|
|
3977
|
-
}
|
|
3978
|
-
if (info.done) {
|
|
3979
|
-
resolve(value);
|
|
3980
|
-
} else {
|
|
3981
|
-
Promise.resolve(value).then(_next, _throw);
|
|
3982
|
-
}
|
|
3983
|
-
}
|
|
3984
|
-
function _asyncToGenerator(fn) {
|
|
3985
|
-
return function() {
|
|
3986
|
-
var self2 = this, args = arguments;
|
|
3987
|
-
return new Promise(function(resolve, reject) {
|
|
3988
|
-
var gen = fn.apply(self2, args);
|
|
3989
|
-
function _next(value) {
|
|
3990
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
3991
|
-
}
|
|
3992
|
-
function _throw(err) {
|
|
3993
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
3994
|
-
}
|
|
3995
|
-
_next(void 0);
|
|
3996
|
-
});
|
|
3997
|
-
};
|
|
3998
|
-
}
|
|
3999
|
-
function ownKeys(object, enumerableOnly) {
|
|
4000
|
-
var keys = Object.keys(object);
|
|
4001
|
-
if (Object.getOwnPropertySymbols) {
|
|
4002
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
4003
|
-
if (enumerableOnly) {
|
|
4004
|
-
symbols = symbols.filter(function(sym) {
|
|
4005
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
4006
|
-
});
|
|
4007
|
-
}
|
|
4008
|
-
keys.push.apply(keys, symbols);
|
|
4009
|
-
}
|
|
4010
|
-
return keys;
|
|
4011
|
-
}
|
|
4012
|
-
function _objectSpread(target) {
|
|
4013
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
4014
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
|
4015
|
-
if (i % 2) {
|
|
4016
|
-
ownKeys(Object(source), true).forEach(function(key) {
|
|
4017
|
-
_defineProperty(target, key, source[key]);
|
|
4018
|
-
});
|
|
4019
|
-
} else if (Object.getOwnPropertyDescriptors) {
|
|
4020
|
-
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
4021
|
-
} else {
|
|
4022
|
-
ownKeys(Object(source)).forEach(function(key) {
|
|
4023
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
4024
|
-
});
|
|
4025
|
-
}
|
|
4026
|
-
}
|
|
4027
|
-
return target;
|
|
4028
|
-
}
|
|
4029
|
-
function _defineProperty(obj, key, value) {
|
|
4030
|
-
if (key in obj) {
|
|
4031
|
-
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
|
|
4032
|
-
} else {
|
|
4033
|
-
obj[key] = value;
|
|
4034
|
-
}
|
|
4035
|
-
return obj;
|
|
4036
|
-
}
|
|
4037
|
-
var namespace = "axios-retry";
|
|
4038
|
-
function isNetworkError(error) {
|
|
4039
|
-
var CODE_EXCLUDE_LIST = ["ERR_CANCELED", "ECONNABORTED"];
|
|
4040
|
-
return !error.response && Boolean(error.code) && // Prevents retrying cancelled requests
|
|
4041
|
-
!CODE_EXCLUDE_LIST.includes(error.code) && // Prevents retrying timed out & cancelled requests
|
|
4042
|
-
isRetryAllowed(error);
|
|
4043
|
-
}
|
|
4044
|
-
var SAFE_HTTP_METHODS = ["get", "head", "options"];
|
|
4045
|
-
var IDEMPOTENT_HTTP_METHODS = SAFE_HTTP_METHODS.concat(["put", "delete"]);
|
|
4046
|
-
function isRetryableError(error) {
|
|
4047
|
-
return error.code !== "ECONNABORTED" && (!error.response || error.response.status >= 500 && error.response.status <= 599);
|
|
4048
|
-
}
|
|
4049
|
-
function isSafeRequestError(error) {
|
|
4050
|
-
if (!error.config) {
|
|
4051
|
-
return false;
|
|
4052
|
-
}
|
|
4053
|
-
return isRetryableError(error) && SAFE_HTTP_METHODS.indexOf(error.config.method) !== -1;
|
|
4054
|
-
}
|
|
4055
|
-
function isIdempotentRequestError(error) {
|
|
4056
|
-
if (!error.config) {
|
|
4057
|
-
return false;
|
|
4058
|
-
}
|
|
4059
|
-
return isRetryableError(error) && IDEMPOTENT_HTTP_METHODS.indexOf(error.config.method) !== -1;
|
|
4060
|
-
}
|
|
4061
|
-
function isNetworkOrIdempotentRequestError(error) {
|
|
4062
|
-
return isNetworkError(error) || isIdempotentRequestError(error);
|
|
4063
|
-
}
|
|
4064
|
-
function noDelay() {
|
|
4065
|
-
return 0;
|
|
4066
|
-
}
|
|
4067
|
-
function exponentialDelay() {
|
|
4068
|
-
var retryNumber = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0;
|
|
4069
|
-
var delayFactor = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 100;
|
|
4070
|
-
var delay = Math.pow(2, retryNumber) * delayFactor;
|
|
4071
|
-
var randomSum = delay * 0.2 * Math.random();
|
|
4072
|
-
return delay + randomSum;
|
|
4073
|
-
}
|
|
4074
|
-
var DEFAULT_OPTIONS = {
|
|
4075
|
-
retries: 3,
|
|
4076
|
-
retryCondition: isNetworkOrIdempotentRequestError,
|
|
4077
|
-
retryDelay: noDelay,
|
|
4078
|
-
shouldResetTimeout: false,
|
|
4079
|
-
onRetry: () => {
|
|
4080
|
-
}
|
|
4081
|
-
};
|
|
4082
|
-
function getRequestOptions(config, defaultOptions) {
|
|
4083
|
-
return _objectSpread(_objectSpread(_objectSpread({}, DEFAULT_OPTIONS), defaultOptions), config[namespace]);
|
|
4084
|
-
}
|
|
4085
|
-
function getCurrentState(config, defaultOptions) {
|
|
4086
|
-
var currentState = getRequestOptions(config, defaultOptions);
|
|
4087
|
-
currentState.retryCount = currentState.retryCount || 0;
|
|
4088
|
-
config[namespace] = currentState;
|
|
4089
|
-
return currentState;
|
|
4090
|
-
}
|
|
4091
|
-
function fixConfig(axios2, config) {
|
|
4092
|
-
if (axios2.defaults.agent === config.agent) {
|
|
4093
|
-
delete config.agent;
|
|
4094
|
-
}
|
|
4095
|
-
if (axios2.defaults.httpAgent === config.httpAgent) {
|
|
4096
|
-
delete config.httpAgent;
|
|
4097
|
-
}
|
|
4098
|
-
if (axios2.defaults.httpsAgent === config.httpsAgent) {
|
|
4099
|
-
delete config.httpsAgent;
|
|
4100
|
-
}
|
|
4101
|
-
}
|
|
4102
|
-
function shouldRetry(_x, _x2) {
|
|
4103
|
-
return _shouldRetry.apply(this, arguments);
|
|
4104
|
-
}
|
|
4105
|
-
function _shouldRetry() {
|
|
4106
|
-
_shouldRetry = _asyncToGenerator(function* (currentState, error) {
|
|
4107
|
-
var {
|
|
4108
|
-
retries,
|
|
4109
|
-
retryCondition
|
|
4110
|
-
} = currentState;
|
|
4111
|
-
var shouldRetryOrPromise = currentState.retryCount < retries && retryCondition(error);
|
|
4112
|
-
if (typeof shouldRetryOrPromise === "object") {
|
|
4113
|
-
try {
|
|
4114
|
-
var shouldRetryPromiseResult = yield shouldRetryOrPromise;
|
|
4115
|
-
return shouldRetryPromiseResult !== false;
|
|
4116
|
-
} catch (_err) {
|
|
4117
|
-
return false;
|
|
4118
|
-
}
|
|
4119
|
-
}
|
|
4120
|
-
return shouldRetryOrPromise;
|
|
4121
|
-
});
|
|
4122
|
-
return _shouldRetry.apply(this, arguments);
|
|
4123
|
-
}
|
|
4124
|
-
function axiosRetry(axios2, defaultOptions) {
|
|
4125
|
-
var requestInterceptorId = axios2.interceptors.request.use((config) => {
|
|
4126
|
-
var currentState = getCurrentState(config, defaultOptions);
|
|
4127
|
-
currentState.lastRequestTime = Date.now();
|
|
4128
|
-
return config;
|
|
4129
|
-
});
|
|
4130
|
-
var responseInterceptorId = axios2.interceptors.response.use(null, /* @__PURE__ */ (function() {
|
|
4131
|
-
var _ref = _asyncToGenerator(function* (error) {
|
|
4132
|
-
var {
|
|
4133
|
-
config
|
|
4134
|
-
} = error;
|
|
4135
|
-
if (!config) {
|
|
4136
|
-
return Promise.reject(error);
|
|
4137
|
-
}
|
|
4138
|
-
var currentState = getCurrentState(config, defaultOptions);
|
|
4139
|
-
if (yield shouldRetry(currentState, error)) {
|
|
4140
|
-
currentState.retryCount += 1;
|
|
4141
|
-
var {
|
|
4142
|
-
retryDelay,
|
|
4143
|
-
shouldResetTimeout,
|
|
4144
|
-
onRetry
|
|
4145
|
-
} = currentState;
|
|
4146
|
-
var delay = retryDelay(currentState.retryCount, error);
|
|
4147
|
-
fixConfig(axios2, config);
|
|
4148
|
-
if (!shouldResetTimeout && config.timeout && currentState.lastRequestTime) {
|
|
4149
|
-
var lastRequestDuration = Date.now() - currentState.lastRequestTime;
|
|
4150
|
-
var timeout = config.timeout - lastRequestDuration - delay;
|
|
4151
|
-
if (timeout <= 0) {
|
|
4152
|
-
return Promise.reject(error);
|
|
4153
|
-
}
|
|
4154
|
-
config.timeout = timeout;
|
|
4155
|
-
}
|
|
4156
|
-
config.transformRequest = [(data) => data];
|
|
4157
|
-
yield onRetry(currentState.retryCount, error, config);
|
|
4158
|
-
return new Promise((resolve) => setTimeout(() => resolve(axios2(config)), delay));
|
|
4159
|
-
}
|
|
4160
|
-
return Promise.reject(error);
|
|
4161
|
-
});
|
|
4162
|
-
return function(_x3) {
|
|
4163
|
-
return _ref.apply(this, arguments);
|
|
4164
|
-
};
|
|
4165
|
-
})());
|
|
4166
|
-
return {
|
|
4167
|
-
requestInterceptorId,
|
|
4168
|
-
responseInterceptorId
|
|
4169
|
-
};
|
|
4170
|
-
}
|
|
4171
|
-
axiosRetry.isNetworkError = isNetworkError;
|
|
4172
|
-
axiosRetry.isSafeRequestError = isSafeRequestError;
|
|
4173
|
-
axiosRetry.isIdempotentRequestError = isIdempotentRequestError;
|
|
4174
|
-
axiosRetry.isNetworkOrIdempotentRequestError = isNetworkOrIdempotentRequestError;
|
|
4175
|
-
axiosRetry.exponentialDelay = exponentialDelay;
|
|
4176
|
-
axiosRetry.isRetryableError = isRetryableError;
|
|
4177
|
-
class AxiosCache {
|
|
4178
|
-
constructor(_axios) {
|
|
4179
|
-
_axios.interceptors.response.use(async (res) => {
|
|
4180
|
-
const cache = getAxiosCache();
|
|
4181
|
-
if (res.status >= 200 && res.status < 300 && res.headers.etag) {
|
|
4182
|
-
setAxiosCache(res.headers.etag, res.data);
|
|
4183
|
-
}
|
|
4184
|
-
if (res.status === 304) {
|
|
4185
|
-
const etag = res.config.headers["If-Match"];
|
|
4186
|
-
if (etag) {
|
|
4187
|
-
res.data = cache[etag];
|
|
4188
|
-
}
|
|
4189
|
-
}
|
|
4190
|
-
return res;
|
|
4191
|
-
});
|
|
4192
|
-
}
|
|
4193
|
-
}
|
|
4194
|
-
class AxiosClient {
|
|
4195
|
-
constructor() {
|
|
4196
|
-
__publicField(this, "client");
|
|
4197
|
-
this.client = axios.create({
|
|
4198
|
-
validateStatus: (status2) => status2 >= 200 && status2 < 300 || status2 === 304
|
|
4199
|
-
});
|
|
4200
|
-
new AxiosCache(this.client);
|
|
4201
|
-
axiosRetry(this.client, {
|
|
4202
|
-
retries: 3,
|
|
4203
|
-
retryCondition: (err) => {
|
|
4204
|
-
var _a, _b, _c;
|
|
4205
|
-
return (
|
|
4206
|
-
// Don't retry 502s, as we assume the server handles retries in those cases
|
|
4207
|
-
isNetworkError(err) || ((_a = err == null ? void 0 : err.response) == null ? void 0 : _a.status) >= 500 && ((_b = err == null ? void 0 : err.response) == null ? void 0 : _b.status) !== 502 || ((_c = err == null ? void 0 : err.response) == null ? void 0 : _c.status) === 429
|
|
4208
|
-
);
|
|
4209
|
-
},
|
|
4210
|
-
retryDelay: exponentialDelay
|
|
4211
|
-
});
|
|
4212
|
-
}
|
|
4213
|
-
async fetch(url, method = "get", body, params, axiosConfig) {
|
|
4214
|
-
var _a;
|
|
4215
|
-
const config = {
|
|
4216
|
-
url,
|
|
4217
|
-
params,
|
|
4218
|
-
method,
|
|
4219
|
-
withCredentials: true,
|
|
4220
|
-
data: JSON.stringify(body),
|
|
4221
|
-
...axiosConfig ?? {}
|
|
4222
|
-
};
|
|
4223
|
-
try {
|
|
4224
|
-
const response = await this.client(config);
|
|
4225
|
-
return [response.data, response.status, response.headers];
|
|
4226
|
-
} catch (e) {
|
|
4227
|
-
if (e instanceof AxiosError2 && ((_a = e.response) == null ? void 0 : _a.data)) {
|
|
4228
|
-
return [e.response.data, e.response.status, e.response.headers];
|
|
4229
|
-
}
|
|
4230
|
-
throw e;
|
|
4231
|
-
}
|
|
4232
|
-
}
|
|
4233
|
-
}
|
|
4234
|
-
function normalize(strArray) {
|
|
4235
|
-
var resultArray = [];
|
|
4236
|
-
if (strArray.length === 0) {
|
|
4237
|
-
return "";
|
|
4238
|
-
}
|
|
4239
|
-
if (typeof strArray[0] !== "string") {
|
|
4240
|
-
throw new TypeError("Url must be a string. Received " + strArray[0]);
|
|
4241
|
-
}
|
|
4242
|
-
if (strArray[0].match(/^[^/:]+:\/*$/) && strArray.length > 1) {
|
|
4243
|
-
var first = strArray.shift();
|
|
4244
|
-
strArray[0] = first + strArray[0];
|
|
4245
|
-
}
|
|
4246
|
-
if (strArray[0].match(/^file:\/\/\//)) {
|
|
4247
|
-
strArray[0] = strArray[0].replace(/^([^/:]+):\/*/, "$1:///");
|
|
4248
|
-
} else {
|
|
4249
|
-
strArray[0] = strArray[0].replace(/^([^/:]+):\/*/, "$1://");
|
|
4250
|
-
}
|
|
4251
|
-
for (var i = 0; i < strArray.length; i++) {
|
|
4252
|
-
var component = strArray[i];
|
|
4253
|
-
if (typeof component !== "string") {
|
|
4254
|
-
throw new TypeError("Url must be a string. Received " + component);
|
|
4255
|
-
}
|
|
4256
|
-
if (component === "") {
|
|
4257
|
-
continue;
|
|
4258
|
-
}
|
|
4259
|
-
if (i > 0) {
|
|
4260
|
-
component = component.replace(/^[\/]+/, "");
|
|
4261
|
-
}
|
|
4262
|
-
if (i < strArray.length - 1) {
|
|
4263
|
-
component = component.replace(/[\/]+$/, "");
|
|
4264
|
-
} else {
|
|
4265
|
-
component = component.replace(/[\/]+$/, "/");
|
|
4266
|
-
}
|
|
4267
|
-
resultArray.push(component);
|
|
4268
|
-
}
|
|
4269
|
-
var str = resultArray.join("/");
|
|
4270
|
-
str = str.replace(/\/(\?|&|#[^!])/g, "$1");
|
|
4271
|
-
var parts = str.split("?");
|
|
4272
|
-
str = parts.shift() + (parts.length > 0 ? "?" : "") + parts.join("&");
|
|
4273
|
-
return str;
|
|
4274
|
-
}
|
|
4275
|
-
function urlJoin() {
|
|
4276
|
-
var input;
|
|
4277
|
-
if (typeof arguments[0] === "object") {
|
|
4278
|
-
input = arguments[0];
|
|
4279
|
-
} else {
|
|
4280
|
-
input = [].slice.call(arguments);
|
|
4281
|
-
}
|
|
4282
|
-
return normalize(input);
|
|
4283
|
-
}
|
|
4284
|
-
const buildName = (name) => `${MY_LOCAL_STORAGE_PREFIX}.${name}`;
|
|
4285
|
-
const removeStored = (name) => {
|
|
4286
|
-
localStorage.removeItem(buildName(name));
|
|
4287
|
-
};
|
|
4288
|
-
const setStored = (name, item) => {
|
|
4289
|
-
localStorage.setItem(buildName(name), JSON.stringify(item));
|
|
4290
|
-
};
|
|
4291
|
-
const getStored = (name) => {
|
|
4292
|
-
try {
|
|
4293
|
-
return JSON.parse(localStorage.getItem(buildName(name)));
|
|
4294
|
-
} catch {
|
|
4295
|
-
return localStorage.getItem(buildName(name));
|
|
4296
|
-
}
|
|
4297
|
-
};
|
|
4298
|
-
const saveLoginCredential = (loginRes) => {
|
|
4299
|
-
if (loginRes == null ? void 0 : loginRes.app_token) {
|
|
4300
|
-
setStored(StorageKey.APP_TOKEN, loginRes.app_token);
|
|
4301
|
-
if (loginRes.refresh_token) {
|
|
4302
|
-
setStored(StorageKey.REFRESH_TOKEN, loginRes.refresh_token);
|
|
4303
|
-
setStored(StorageKey.PROVIDER, loginRes.provider);
|
|
4304
|
-
}
|
|
4305
|
-
return true;
|
|
4306
|
-
}
|
|
4307
|
-
removeStored(StorageKey.REFRESH_TOKEN);
|
|
4308
|
-
removeStored(StorageKey.APP_TOKEN);
|
|
4309
|
-
removeStored(StorageKey.PROVIDER);
|
|
4310
|
-
return false;
|
|
4311
|
-
};
|
|
4312
|
-
const getXSRFCookie = () => {
|
|
4313
|
-
if (document.cookie !== void 0) {
|
|
4314
|
-
try {
|
|
4315
|
-
return document.cookie.split("; ").find((row) => row.startsWith("XSRF-TOKEN")).split("=")[1];
|
|
4316
|
-
} catch {
|
|
4317
|
-
}
|
|
4318
|
-
}
|
|
4319
|
-
return null;
|
|
4320
|
-
};
|
|
4321
|
-
const client = new AxiosClient();
|
|
4322
|
-
const api = {
|
|
4323
|
-
auth,
|
|
4324
|
-
configs,
|
|
4325
|
-
lookup,
|
|
4326
|
-
actions,
|
|
4327
|
-
fetchers,
|
|
4328
|
-
sync,
|
|
4329
|
-
_static,
|
|
4330
|
-
v2
|
|
4331
|
-
};
|
|
4332
|
-
const uri = () => {
|
|
4333
|
-
return "/api/v1";
|
|
4334
|
-
};
|
|
4335
|
-
const format = (_uri, baseURL) => {
|
|
4336
|
-
const path = _uri.startsWith("/api") ? _uri : `${uri()}/${_uri.replace(/\/$/, "")}`.replace("//", "/");
|
|
4337
|
-
return baseURL ? baseURL + path : path;
|
|
4338
|
-
};
|
|
4339
|
-
const joinParams = (_uri, searchParams) => {
|
|
4340
|
-
return `${_uri}${searchParams ? `${_uri.indexOf("?") > 0 ? "&" : "?"}${searchParams.toString()}` : ""}`;
|
|
4341
|
-
};
|
|
4342
|
-
const joinUri = (uri1, uri2, searchParams) => {
|
|
4343
|
-
const _uri = format(urlJoin(uri1, uri2));
|
|
4344
|
-
return searchParams ? joinParams(_uri, searchParams) : _uri;
|
|
4345
|
-
};
|
|
4346
|
-
const joinAllUri = (...urlParts) => {
|
|
4347
|
-
return urlJoin(...urlParts);
|
|
4348
|
-
};
|
|
4349
|
-
const hfetch = async (_uri, method = "get", body, searchParams, axiosConfig) => {
|
|
4350
|
-
const authToken = getStored(StorageKey.APP_TOKEN);
|
|
4351
|
-
const config = {
|
|
4352
|
-
...axiosConfig ?? {},
|
|
4353
|
-
headers: {
|
|
4354
|
-
...(axiosConfig == null ? void 0 : axiosConfig.headers) ?? {},
|
|
4355
|
-
"Content-Type": "application/json",
|
|
4356
|
-
"X-XSRF-TOKEN": getXSRFCookie()
|
|
4357
|
-
}
|
|
4358
|
-
};
|
|
4359
|
-
if (authToken && !config.headers.Authorization) {
|
|
4360
|
-
config.headers.Authorization = `Bearer ${authToken}`;
|
|
4361
|
-
}
|
|
4362
|
-
const [json, statusCode] = await client.fetch(
|
|
4363
|
-
format(_uri, config.baseURL),
|
|
4364
|
-
method,
|
|
4365
|
-
body,
|
|
4366
|
-
searchParams,
|
|
4367
|
-
config
|
|
4368
|
-
);
|
|
4369
|
-
if (!json) {
|
|
4370
|
-
return null;
|
|
4371
|
-
}
|
|
4372
|
-
if (statusCode < 300 || statusCode === 304) {
|
|
4373
|
-
return json.api_response;
|
|
4374
|
-
}
|
|
4375
|
-
if (statusCode === 401) {
|
|
4376
|
-
if (!getStored(StorageKey.NEXT_LOCATION)) {
|
|
4377
|
-
setStored(StorageKey.NEXT_LOCATION, window.location.pathname);
|
|
4378
|
-
setStored(StorageKey.NEXT_SEARCH, window.location.search);
|
|
4379
|
-
}
|
|
4380
|
-
if (!_uri.includes("/auth/login") && getStored(StorageKey.REFRESH_TOKEN)) {
|
|
4381
|
-
const refreshToken = getStored(StorageKey.REFRESH_TOKEN);
|
|
4382
|
-
const provider = getStored(StorageKey.PROVIDER);
|
|
4383
|
-
const refreshResponse = await api.auth.login.post({
|
|
4384
|
-
refresh_token: refreshToken,
|
|
4385
|
-
provider
|
|
4386
|
-
});
|
|
4387
|
-
if (refreshResponse) {
|
|
4388
|
-
saveLoginCredential(refreshResponse);
|
|
4389
|
-
const result = await hfetch(_uri, method, body, searchParams);
|
|
4390
|
-
removeStored(StorageKey.NEXT_LOCATION);
|
|
4391
|
-
removeStored(StorageKey.NEXT_SEARCH);
|
|
4392
|
-
return result;
|
|
4393
|
-
}
|
|
4394
|
-
}
|
|
4395
|
-
saveLoginCredential({});
|
|
4396
|
-
return;
|
|
4397
|
-
}
|
|
4398
|
-
throw new Error(
|
|
4399
|
-
json.api_error_message || json || `Error while fetching ${_uri} - ${method.toUpperCase()}`,
|
|
4400
|
-
{
|
|
4401
|
-
cause: json
|
|
4402
|
-
}
|
|
4403
|
-
);
|
|
4404
|
-
};
|
|
4405
|
-
const hget = (_uri, searchParams, config = {}) => {
|
|
4406
|
-
return hfetch(_uri, "get", null, searchParams, config);
|
|
4407
|
-
};
|
|
4408
|
-
const hpost = (_uri, body, config = {}) => {
|
|
4409
|
-
return hfetch(_uri, "post", body, void 0, config);
|
|
4410
|
-
};
|
|
4411
|
-
export {
|
|
4412
|
-
api as a,
|
|
4413
|
-
joinAllUri as j,
|
|
4414
|
-
post$1 as p,
|
|
4415
|
-
uri$4 as u
|
|
4416
|
-
};
|