vbss-translator 1.0.2 → 1.1.0
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/README.md +541 -171
- package/dist/cli/index.js +64 -0
- package/dist/generator.cjs +32 -0
- package/dist/generator.d.ts +19 -0
- package/dist/generator.js +360 -0
- package/dist/vbss-translator.d.ts +118 -5
- package/dist/vbss-translator.js +2959 -418
- package/dist/vbss-translator.umd.cjs +15 -10
- package/package.json +40 -3
package/dist/vbss-translator.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
var
|
|
1
|
+
var Zr = Object.defineProperty;
|
|
2
|
+
var en = (t, e, r) => e in t ? Zr(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
|
|
3
|
+
var te = (t, e, r) => en(t, typeof e != "symbol" ? e + "" : e, r);
|
|
4
|
+
import sr, { createContext as tn, useContext as rn, useMemo as ce, useState as Be, useEffect as lt, useCallback as $e, useRef as nn, startTransition as sn } from "react";
|
|
5
|
+
var qe = { exports: {} }, Ae = {};
|
|
3
6
|
/**
|
|
4
7
|
* @license React
|
|
5
8
|
* react-jsx-runtime.production.min.js
|
|
@@ -9,21 +12,21 @@ var J = { exports: {} }, $ = {};
|
|
|
9
12
|
* This source code is licensed under the MIT license found in the
|
|
10
13
|
* LICENSE file in the root directory of this source tree.
|
|
11
14
|
*/
|
|
12
|
-
var
|
|
13
|
-
function
|
|
14
|
-
if (
|
|
15
|
-
|
|
16
|
-
var
|
|
17
|
-
function
|
|
18
|
-
var
|
|
19
|
-
|
|
20
|
-
for (
|
|
21
|
-
if (
|
|
22
|
-
return { $$typeof:
|
|
23
|
-
}
|
|
24
|
-
return
|
|
25
|
-
}
|
|
26
|
-
var
|
|
15
|
+
var Nt;
|
|
16
|
+
function on() {
|
|
17
|
+
if (Nt) return Ae;
|
|
18
|
+
Nt = 1;
|
|
19
|
+
var t = sr, e = Symbol.for("react.element"), r = Symbol.for("react.fragment"), n = Object.prototype.hasOwnProperty, s = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, i = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
20
|
+
function a(l, g, f) {
|
|
21
|
+
var u, h = {}, x = null, F = null;
|
|
22
|
+
f !== void 0 && (x = "" + f), g.key !== void 0 && (x = "" + g.key), g.ref !== void 0 && (F = g.ref);
|
|
23
|
+
for (u in g) n.call(g, u) && !i.hasOwnProperty(u) && (h[u] = g[u]);
|
|
24
|
+
if (l && l.defaultProps) for (u in g = l.defaultProps, g) h[u] === void 0 && (h[u] = g[u]);
|
|
25
|
+
return { $$typeof: e, type: l, key: x, ref: F, props: h, _owner: s.current };
|
|
26
|
+
}
|
|
27
|
+
return Ae.Fragment = r, Ae.jsx = a, Ae.jsxs = a, Ae;
|
|
28
|
+
}
|
|
29
|
+
var Ce = {};
|
|
27
30
|
/**
|
|
28
31
|
* @license React
|
|
29
32
|
* react-jsx-runtime.development.js
|
|
@@ -33,91 +36,91 @@ var W = {};
|
|
|
33
36
|
* This source code is licensed under the MIT license found in the
|
|
34
37
|
* LICENSE file in the root directory of this source tree.
|
|
35
38
|
*/
|
|
36
|
-
var
|
|
37
|
-
function
|
|
38
|
-
return
|
|
39
|
-
var
|
|
40
|
-
function
|
|
41
|
-
if (
|
|
39
|
+
var Ut;
|
|
40
|
+
function an() {
|
|
41
|
+
return Ut || (Ut = 1, process.env.NODE_ENV !== "production" && function() {
|
|
42
|
+
var t = sr, e = Symbol.for("react.element"), r = Symbol.for("react.portal"), n = Symbol.for("react.fragment"), s = Symbol.for("react.strict_mode"), i = Symbol.for("react.profiler"), a = Symbol.for("react.provider"), l = Symbol.for("react.context"), g = Symbol.for("react.forward_ref"), f = Symbol.for("react.suspense"), u = Symbol.for("react.suspense_list"), h = Symbol.for("react.memo"), x = Symbol.for("react.lazy"), F = Symbol.for("react.offscreen"), d = Symbol.iterator, E = "@@iterator";
|
|
43
|
+
function b(o) {
|
|
44
|
+
if (o === null || typeof o != "object")
|
|
42
45
|
return null;
|
|
43
|
-
var
|
|
44
|
-
return typeof
|
|
46
|
+
var p = d && o[d] || o[E];
|
|
47
|
+
return typeof p == "function" ? p : null;
|
|
45
48
|
}
|
|
46
|
-
var
|
|
47
|
-
function
|
|
49
|
+
var P = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
50
|
+
function A(o) {
|
|
48
51
|
{
|
|
49
|
-
for (var
|
|
50
|
-
|
|
51
|
-
|
|
52
|
+
for (var p = arguments.length, m = new Array(p > 1 ? p - 1 : 0), v = 1; v < p; v++)
|
|
53
|
+
m[v - 1] = arguments[v];
|
|
54
|
+
L("error", o, m);
|
|
52
55
|
}
|
|
53
56
|
}
|
|
54
|
-
function
|
|
57
|
+
function L(o, p, m) {
|
|
55
58
|
{
|
|
56
|
-
var
|
|
57
|
-
|
|
58
|
-
var
|
|
59
|
-
return String(
|
|
59
|
+
var v = P.ReactDebugCurrentFrame, C = v.getStackAddendum();
|
|
60
|
+
C !== "" && (p += "%s", m = m.concat([C]));
|
|
61
|
+
var k = m.map(function(O) {
|
|
62
|
+
return String(O);
|
|
60
63
|
});
|
|
61
|
-
|
|
64
|
+
k.unshift("Warning: " + p), Function.prototype.apply.call(console[o], console, k);
|
|
62
65
|
}
|
|
63
66
|
}
|
|
64
|
-
var
|
|
65
|
-
|
|
66
|
-
function
|
|
67
|
-
return !!(typeof
|
|
67
|
+
var j = !1, V = !1, ne = !1, $ = !1, Q = !1, Z;
|
|
68
|
+
Z = Symbol.for("react.module.reference");
|
|
69
|
+
function fe(o) {
|
|
70
|
+
return !!(typeof o == "string" || typeof o == "function" || o === n || o === i || Q || o === s || o === f || o === u || $ || o === F || j || V || ne || typeof o == "object" && o !== null && (o.$$typeof === x || o.$$typeof === h || o.$$typeof === a || o.$$typeof === l || o.$$typeof === g || // This needs to include all possible module reference object
|
|
68
71
|
// types supported by any Flight configuration anywhere since
|
|
69
72
|
// we don't know which Flight build this will end up being used
|
|
70
73
|
// with.
|
|
71
|
-
|
|
74
|
+
o.$$typeof === Z || o.getModuleId !== void 0));
|
|
72
75
|
}
|
|
73
|
-
function
|
|
74
|
-
var
|
|
75
|
-
if (
|
|
76
|
-
return
|
|
77
|
-
var
|
|
78
|
-
return
|
|
76
|
+
function le(o, p, m) {
|
|
77
|
+
var v = o.displayName;
|
|
78
|
+
if (v)
|
|
79
|
+
return v;
|
|
80
|
+
var C = p.displayName || p.name || "";
|
|
81
|
+
return C !== "" ? m + "(" + C + ")" : m;
|
|
79
82
|
}
|
|
80
|
-
function
|
|
81
|
-
return
|
|
83
|
+
function ae(o) {
|
|
84
|
+
return o.displayName || "Context";
|
|
82
85
|
}
|
|
83
|
-
function
|
|
84
|
-
if (
|
|
86
|
+
function B(o) {
|
|
87
|
+
if (o == null)
|
|
85
88
|
return null;
|
|
86
|
-
if (typeof
|
|
87
|
-
return
|
|
88
|
-
if (typeof
|
|
89
|
-
return
|
|
90
|
-
switch (
|
|
91
|
-
case
|
|
89
|
+
if (typeof o.tag == "number" && A("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof o == "function")
|
|
90
|
+
return o.displayName || o.name || null;
|
|
91
|
+
if (typeof o == "string")
|
|
92
|
+
return o;
|
|
93
|
+
switch (o) {
|
|
94
|
+
case n:
|
|
92
95
|
return "Fragment";
|
|
93
|
-
case
|
|
96
|
+
case r:
|
|
94
97
|
return "Portal";
|
|
95
|
-
case
|
|
98
|
+
case i:
|
|
96
99
|
return "Profiler";
|
|
97
|
-
case
|
|
100
|
+
case s:
|
|
98
101
|
return "StrictMode";
|
|
99
|
-
case
|
|
102
|
+
case f:
|
|
100
103
|
return "Suspense";
|
|
101
|
-
case
|
|
104
|
+
case u:
|
|
102
105
|
return "SuspenseList";
|
|
103
106
|
}
|
|
104
|
-
if (typeof
|
|
105
|
-
switch (
|
|
106
|
-
case
|
|
107
|
-
var
|
|
108
|
-
return
|
|
109
|
-
case
|
|
110
|
-
var
|
|
111
|
-
return
|
|
112
|
-
case
|
|
113
|
-
return
|
|
114
|
-
case
|
|
115
|
-
var
|
|
116
|
-
return
|
|
117
|
-
case
|
|
118
|
-
var
|
|
107
|
+
if (typeof o == "object")
|
|
108
|
+
switch (o.$$typeof) {
|
|
109
|
+
case l:
|
|
110
|
+
var p = o;
|
|
111
|
+
return ae(p) + ".Consumer";
|
|
112
|
+
case a:
|
|
113
|
+
var m = o;
|
|
114
|
+
return ae(m._context) + ".Provider";
|
|
115
|
+
case g:
|
|
116
|
+
return le(o, o.render, "ForwardRef");
|
|
117
|
+
case h:
|
|
118
|
+
var v = o.displayName || null;
|
|
119
|
+
return v !== null ? v : B(o.type) || "Memo";
|
|
120
|
+
case x: {
|
|
121
|
+
var C = o, k = C._payload, O = C._init;
|
|
119
122
|
try {
|
|
120
|
-
return
|
|
123
|
+
return B(O(k));
|
|
121
124
|
} catch {
|
|
122
125
|
return null;
|
|
123
126
|
}
|
|
@@ -125,541 +128,3079 @@ function hr() {
|
|
|
125
128
|
}
|
|
126
129
|
return null;
|
|
127
130
|
}
|
|
128
|
-
var
|
|
129
|
-
function
|
|
131
|
+
var q = Object.assign, y = 0, T, R, w, D, se, K, M;
|
|
132
|
+
function z() {
|
|
130
133
|
}
|
|
131
|
-
|
|
132
|
-
function
|
|
134
|
+
z.__reactDisabledLog = !0;
|
|
135
|
+
function ue() {
|
|
133
136
|
{
|
|
134
|
-
if (
|
|
135
|
-
|
|
136
|
-
var
|
|
137
|
+
if (y === 0) {
|
|
138
|
+
T = console.log, R = console.info, w = console.warn, D = console.error, se = console.group, K = console.groupCollapsed, M = console.groupEnd;
|
|
139
|
+
var o = {
|
|
137
140
|
configurable: !0,
|
|
138
141
|
enumerable: !0,
|
|
139
|
-
value:
|
|
142
|
+
value: z,
|
|
140
143
|
writable: !0
|
|
141
144
|
};
|
|
142
145
|
Object.defineProperties(console, {
|
|
143
|
-
info:
|
|
144
|
-
log:
|
|
145
|
-
warn:
|
|
146
|
-
error:
|
|
147
|
-
group:
|
|
148
|
-
groupCollapsed:
|
|
149
|
-
groupEnd:
|
|
146
|
+
info: o,
|
|
147
|
+
log: o,
|
|
148
|
+
warn: o,
|
|
149
|
+
error: o,
|
|
150
|
+
group: o,
|
|
151
|
+
groupCollapsed: o,
|
|
152
|
+
groupEnd: o
|
|
150
153
|
});
|
|
151
154
|
}
|
|
152
|
-
|
|
155
|
+
y++;
|
|
153
156
|
}
|
|
154
157
|
}
|
|
155
|
-
function
|
|
158
|
+
function de() {
|
|
156
159
|
{
|
|
157
|
-
if (
|
|
158
|
-
var
|
|
160
|
+
if (y--, y === 0) {
|
|
161
|
+
var o = {
|
|
159
162
|
configurable: !0,
|
|
160
163
|
enumerable: !0,
|
|
161
164
|
writable: !0
|
|
162
165
|
};
|
|
163
166
|
Object.defineProperties(console, {
|
|
164
|
-
log:
|
|
165
|
-
value:
|
|
167
|
+
log: q({}, o, {
|
|
168
|
+
value: T
|
|
166
169
|
}),
|
|
167
|
-
info:
|
|
168
|
-
value:
|
|
170
|
+
info: q({}, o, {
|
|
171
|
+
value: R
|
|
169
172
|
}),
|
|
170
|
-
warn:
|
|
171
|
-
value:
|
|
173
|
+
warn: q({}, o, {
|
|
174
|
+
value: w
|
|
172
175
|
}),
|
|
173
|
-
error:
|
|
174
|
-
value:
|
|
176
|
+
error: q({}, o, {
|
|
177
|
+
value: D
|
|
175
178
|
}),
|
|
176
|
-
group:
|
|
179
|
+
group: q({}, o, {
|
|
177
180
|
value: se
|
|
178
181
|
}),
|
|
179
|
-
groupCollapsed:
|
|
180
|
-
value:
|
|
182
|
+
groupCollapsed: q({}, o, {
|
|
183
|
+
value: K
|
|
181
184
|
}),
|
|
182
|
-
groupEnd:
|
|
183
|
-
value:
|
|
185
|
+
groupEnd: q({}, o, {
|
|
186
|
+
value: M
|
|
184
187
|
})
|
|
185
188
|
});
|
|
186
189
|
}
|
|
187
|
-
|
|
190
|
+
y < 0 && A("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
188
191
|
}
|
|
189
192
|
}
|
|
190
|
-
var
|
|
191
|
-
function
|
|
193
|
+
var Ne = P.ReactCurrentDispatcher, xe;
|
|
194
|
+
function be(o, p, m) {
|
|
192
195
|
{
|
|
193
|
-
if (
|
|
196
|
+
if (xe === void 0)
|
|
194
197
|
try {
|
|
195
198
|
throw Error();
|
|
196
|
-
} catch (
|
|
197
|
-
var
|
|
198
|
-
|
|
199
|
+
} catch (C) {
|
|
200
|
+
var v = C.stack.trim().match(/\n( *(at )?)/);
|
|
201
|
+
xe = v && v[1] || "";
|
|
199
202
|
}
|
|
200
203
|
return `
|
|
201
|
-
` +
|
|
204
|
+
` + xe + o;
|
|
202
205
|
}
|
|
203
206
|
}
|
|
204
|
-
var
|
|
207
|
+
var ee = !1, he;
|
|
205
208
|
{
|
|
206
|
-
var
|
|
207
|
-
|
|
209
|
+
var Ue = typeof WeakMap == "function" ? WeakMap : Map;
|
|
210
|
+
he = new Ue();
|
|
208
211
|
}
|
|
209
|
-
function
|
|
210
|
-
if (!
|
|
212
|
+
function Ee(o, p) {
|
|
213
|
+
if (!o || ee)
|
|
211
214
|
return "";
|
|
212
215
|
{
|
|
213
|
-
var
|
|
214
|
-
if (
|
|
215
|
-
return
|
|
216
|
+
var m = he.get(o);
|
|
217
|
+
if (m !== void 0)
|
|
218
|
+
return m;
|
|
216
219
|
}
|
|
217
|
-
var
|
|
218
|
-
|
|
219
|
-
var
|
|
220
|
+
var v;
|
|
221
|
+
ee = !0;
|
|
222
|
+
var C = Error.prepareStackTrace;
|
|
220
223
|
Error.prepareStackTrace = void 0;
|
|
221
|
-
var
|
|
222
|
-
|
|
224
|
+
var k;
|
|
225
|
+
k = Ne.current, Ne.current = null, ue();
|
|
223
226
|
try {
|
|
224
|
-
if (
|
|
225
|
-
var
|
|
227
|
+
if (p) {
|
|
228
|
+
var O = function() {
|
|
226
229
|
throw Error();
|
|
227
230
|
};
|
|
228
|
-
if (Object.defineProperty(
|
|
231
|
+
if (Object.defineProperty(O.prototype, "props", {
|
|
229
232
|
set: function() {
|
|
230
233
|
throw Error();
|
|
231
234
|
}
|
|
232
235
|
}), typeof Reflect == "object" && Reflect.construct) {
|
|
233
236
|
try {
|
|
234
|
-
Reflect.construct(
|
|
235
|
-
} catch (
|
|
236
|
-
|
|
237
|
+
Reflect.construct(O, []);
|
|
238
|
+
} catch (J) {
|
|
239
|
+
v = J;
|
|
237
240
|
}
|
|
238
|
-
Reflect.construct(
|
|
241
|
+
Reflect.construct(o, [], O);
|
|
239
242
|
} else {
|
|
240
243
|
try {
|
|
241
|
-
|
|
242
|
-
} catch (
|
|
243
|
-
|
|
244
|
+
O.call();
|
|
245
|
+
} catch (J) {
|
|
246
|
+
v = J;
|
|
244
247
|
}
|
|
245
|
-
|
|
248
|
+
o.call(O.prototype);
|
|
246
249
|
}
|
|
247
250
|
} else {
|
|
248
251
|
try {
|
|
249
252
|
throw Error();
|
|
250
|
-
} catch (
|
|
251
|
-
|
|
253
|
+
} catch (J) {
|
|
254
|
+
v = J;
|
|
252
255
|
}
|
|
253
|
-
|
|
256
|
+
o();
|
|
254
257
|
}
|
|
255
|
-
} catch (
|
|
256
|
-
if (
|
|
257
|
-
for (var
|
|
258
|
-
`),
|
|
259
|
-
`),
|
|
260
|
-
|
|
261
|
-
for (;
|
|
262
|
-
if (
|
|
263
|
-
if (
|
|
258
|
+
} catch (J) {
|
|
259
|
+
if (J && v && typeof J.stack == "string") {
|
|
260
|
+
for (var S = J.stack.split(`
|
|
261
|
+
`), W = v.stack.split(`
|
|
262
|
+
`), N = S.length - 1, I = W.length - 1; N >= 1 && I >= 0 && S[N] !== W[I]; )
|
|
263
|
+
I--;
|
|
264
|
+
for (; N >= 1 && I >= 0; N--, I--)
|
|
265
|
+
if (S[N] !== W[I]) {
|
|
266
|
+
if (N !== 1 || I !== 1)
|
|
264
267
|
do
|
|
265
|
-
if (
|
|
266
|
-
var
|
|
267
|
-
` +
|
|
268
|
-
return
|
|
268
|
+
if (N--, I--, I < 0 || S[N] !== W[I]) {
|
|
269
|
+
var re = `
|
|
270
|
+
` + S[N].replace(" at new ", " at ");
|
|
271
|
+
return o.displayName && re.includes("<anonymous>") && (re = re.replace("<anonymous>", o.displayName)), typeof o == "function" && he.set(o, re), re;
|
|
269
272
|
}
|
|
270
|
-
while (
|
|
273
|
+
while (N >= 1 && I >= 0);
|
|
271
274
|
break;
|
|
272
275
|
}
|
|
273
276
|
}
|
|
274
277
|
} finally {
|
|
275
|
-
|
|
278
|
+
ee = !1, Ne.current = k, de(), Error.prepareStackTrace = C;
|
|
276
279
|
}
|
|
277
|
-
var
|
|
278
|
-
return typeof
|
|
280
|
+
var ve = o ? o.displayName || o.name : "", pe = ve ? be(ve) : "";
|
|
281
|
+
return typeof o == "function" && he.set(o, pe), pe;
|
|
279
282
|
}
|
|
280
|
-
function
|
|
281
|
-
return
|
|
283
|
+
function tt(o, p, m) {
|
|
284
|
+
return Ee(o, !1);
|
|
282
285
|
}
|
|
283
|
-
function
|
|
284
|
-
var
|
|
285
|
-
return !!(
|
|
286
|
+
function Pr(o) {
|
|
287
|
+
var p = o.prototype;
|
|
288
|
+
return !!(p && p.isReactComponent);
|
|
286
289
|
}
|
|
287
|
-
function
|
|
288
|
-
if (
|
|
290
|
+
function Me(o, p, m) {
|
|
291
|
+
if (o == null)
|
|
289
292
|
return "";
|
|
290
|
-
if (typeof
|
|
291
|
-
return
|
|
292
|
-
if (typeof
|
|
293
|
-
return
|
|
294
|
-
switch (
|
|
295
|
-
case
|
|
296
|
-
return
|
|
297
|
-
case
|
|
298
|
-
return
|
|
299
|
-
}
|
|
300
|
-
if (typeof
|
|
301
|
-
switch (
|
|
302
|
-
case
|
|
303
|
-
return
|
|
304
|
-
case
|
|
305
|
-
return
|
|
306
|
-
case
|
|
307
|
-
var
|
|
293
|
+
if (typeof o == "function")
|
|
294
|
+
return Ee(o, Pr(o));
|
|
295
|
+
if (typeof o == "string")
|
|
296
|
+
return be(o);
|
|
297
|
+
switch (o) {
|
|
298
|
+
case f:
|
|
299
|
+
return be("Suspense");
|
|
300
|
+
case u:
|
|
301
|
+
return be("SuspenseList");
|
|
302
|
+
}
|
|
303
|
+
if (typeof o == "object")
|
|
304
|
+
switch (o.$$typeof) {
|
|
305
|
+
case g:
|
|
306
|
+
return tt(o.render);
|
|
307
|
+
case h:
|
|
308
|
+
return Me(o.type, p, m);
|
|
309
|
+
case x: {
|
|
310
|
+
var v = o, C = v._payload, k = v._init;
|
|
308
311
|
try {
|
|
309
|
-
return
|
|
312
|
+
return Me(k(C), p, m);
|
|
310
313
|
} catch {
|
|
311
314
|
}
|
|
312
315
|
}
|
|
313
316
|
}
|
|
314
317
|
return "";
|
|
315
318
|
}
|
|
316
|
-
var
|
|
317
|
-
function
|
|
318
|
-
if (
|
|
319
|
-
var
|
|
320
|
-
|
|
319
|
+
var Se = Object.prototype.hasOwnProperty, Tt = {}, _t = P.ReactDebugCurrentFrame;
|
|
320
|
+
function Ie(o) {
|
|
321
|
+
if (o) {
|
|
322
|
+
var p = o._owner, m = Me(o.type, o._source, p ? p.type : null);
|
|
323
|
+
_t.setExtraStackFrame(m);
|
|
321
324
|
} else
|
|
322
|
-
|
|
325
|
+
_t.setExtraStackFrame(null);
|
|
323
326
|
}
|
|
324
|
-
function
|
|
327
|
+
function kr(o, p, m, v, C) {
|
|
325
328
|
{
|
|
326
|
-
var
|
|
327
|
-
for (var
|
|
328
|
-
if (
|
|
329
|
-
var
|
|
329
|
+
var k = Function.call.bind(Se);
|
|
330
|
+
for (var O in o)
|
|
331
|
+
if (k(o, O)) {
|
|
332
|
+
var S = void 0;
|
|
330
333
|
try {
|
|
331
|
-
if (typeof
|
|
332
|
-
var
|
|
333
|
-
throw
|
|
334
|
+
if (typeof o[O] != "function") {
|
|
335
|
+
var W = Error((v || "React class") + ": " + m + " type `" + O + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof o[O] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
336
|
+
throw W.name = "Invariant Violation", W;
|
|
334
337
|
}
|
|
335
|
-
|
|
336
|
-
} catch (
|
|
337
|
-
|
|
338
|
+
S = o[O](p, O, v, m, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
339
|
+
} catch (N) {
|
|
340
|
+
S = N;
|
|
338
341
|
}
|
|
339
|
-
|
|
342
|
+
S && !(S instanceof Error) && (Ie(C), A("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", v || "React class", m, O, typeof S), Ie(null)), S instanceof Error && !(S.message in Tt) && (Tt[S.message] = !0, Ie(C), A("Failed %s type: %s", m, S.message), Ie(null));
|
|
340
343
|
}
|
|
341
344
|
}
|
|
342
345
|
}
|
|
343
|
-
var
|
|
344
|
-
function
|
|
345
|
-
return
|
|
346
|
+
var Lr = Array.isArray;
|
|
347
|
+
function rt(o) {
|
|
348
|
+
return Lr(o);
|
|
346
349
|
}
|
|
347
|
-
function
|
|
350
|
+
function Fr(o) {
|
|
348
351
|
{
|
|
349
|
-
var
|
|
350
|
-
return
|
|
352
|
+
var p = typeof Symbol == "function" && Symbol.toStringTag, m = p && o[Symbol.toStringTag] || o.constructor.name || "Object";
|
|
353
|
+
return m;
|
|
351
354
|
}
|
|
352
355
|
}
|
|
353
|
-
function
|
|
356
|
+
function jr(o) {
|
|
354
357
|
try {
|
|
355
|
-
return
|
|
358
|
+
return xt(o), !1;
|
|
356
359
|
} catch {
|
|
357
360
|
return !0;
|
|
358
361
|
}
|
|
359
362
|
}
|
|
360
|
-
function
|
|
361
|
-
return "" +
|
|
363
|
+
function xt(o) {
|
|
364
|
+
return "" + o;
|
|
362
365
|
}
|
|
363
|
-
function
|
|
364
|
-
if (
|
|
365
|
-
return
|
|
366
|
+
function St(o) {
|
|
367
|
+
if (jr(o))
|
|
368
|
+
return A("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Fr(o)), xt(o);
|
|
366
369
|
}
|
|
367
|
-
var
|
|
370
|
+
var Oe = P.ReactCurrentOwner, Dr = {
|
|
368
371
|
key: !0,
|
|
369
372
|
ref: !0,
|
|
370
373
|
__self: !0,
|
|
371
374
|
__source: !0
|
|
372
|
-
},
|
|
373
|
-
|
|
374
|
-
function
|
|
375
|
-
if (
|
|
376
|
-
var
|
|
377
|
-
if (
|
|
375
|
+
}, Ot, At, nt;
|
|
376
|
+
nt = {};
|
|
377
|
+
function Nr(o) {
|
|
378
|
+
if (Se.call(o, "ref")) {
|
|
379
|
+
var p = Object.getOwnPropertyDescriptor(o, "ref").get;
|
|
380
|
+
if (p && p.isReactWarning)
|
|
378
381
|
return !1;
|
|
379
382
|
}
|
|
380
|
-
return
|
|
383
|
+
return o.ref !== void 0;
|
|
381
384
|
}
|
|
382
|
-
function
|
|
383
|
-
if (
|
|
384
|
-
var
|
|
385
|
-
if (
|
|
385
|
+
function Ur(o) {
|
|
386
|
+
if (Se.call(o, "key")) {
|
|
387
|
+
var p = Object.getOwnPropertyDescriptor(o, "key").get;
|
|
388
|
+
if (p && p.isReactWarning)
|
|
386
389
|
return !1;
|
|
387
390
|
}
|
|
388
|
-
return
|
|
391
|
+
return o.key !== void 0;
|
|
389
392
|
}
|
|
390
|
-
function
|
|
391
|
-
if (typeof
|
|
392
|
-
var
|
|
393
|
-
|
|
393
|
+
function Mr(o, p) {
|
|
394
|
+
if (typeof o.ref == "string" && Oe.current && p && Oe.current.stateNode !== p) {
|
|
395
|
+
var m = B(Oe.current.type);
|
|
396
|
+
nt[m] || (A('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', B(Oe.current.type), o.ref), nt[m] = !0);
|
|
394
397
|
}
|
|
395
398
|
}
|
|
396
|
-
function
|
|
399
|
+
function Ir(o, p) {
|
|
397
400
|
{
|
|
398
|
-
var
|
|
399
|
-
|
|
401
|
+
var m = function() {
|
|
402
|
+
Ot || (Ot = !0, A("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", p));
|
|
400
403
|
};
|
|
401
|
-
|
|
402
|
-
get:
|
|
404
|
+
m.isReactWarning = !0, Object.defineProperty(o, "key", {
|
|
405
|
+
get: m,
|
|
403
406
|
configurable: !0
|
|
404
407
|
});
|
|
405
408
|
}
|
|
406
409
|
}
|
|
407
|
-
function
|
|
410
|
+
function Br(o, p) {
|
|
408
411
|
{
|
|
409
|
-
var
|
|
410
|
-
|
|
412
|
+
var m = function() {
|
|
413
|
+
At || (At = !0, A("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", p));
|
|
411
414
|
};
|
|
412
|
-
|
|
413
|
-
get:
|
|
415
|
+
m.isReactWarning = !0, Object.defineProperty(o, "ref", {
|
|
416
|
+
get: m,
|
|
414
417
|
configurable: !0
|
|
415
418
|
});
|
|
416
419
|
}
|
|
417
420
|
}
|
|
418
|
-
var
|
|
419
|
-
var
|
|
421
|
+
var $r = function(o, p, m, v, C, k, O) {
|
|
422
|
+
var S = {
|
|
420
423
|
// This tag allows us to uniquely identify this as a React Element
|
|
421
|
-
$$typeof:
|
|
424
|
+
$$typeof: e,
|
|
422
425
|
// Built-in properties that belong on the element
|
|
423
|
-
type:
|
|
424
|
-
key:
|
|
425
|
-
ref:
|
|
426
|
-
props:
|
|
426
|
+
type: o,
|
|
427
|
+
key: p,
|
|
428
|
+
ref: m,
|
|
429
|
+
props: O,
|
|
427
430
|
// Record the component responsible for creating this element.
|
|
428
|
-
_owner:
|
|
431
|
+
_owner: k
|
|
429
432
|
};
|
|
430
|
-
return
|
|
433
|
+
return S._store = {}, Object.defineProperty(S._store, "validated", {
|
|
431
434
|
configurable: !1,
|
|
432
435
|
enumerable: !1,
|
|
433
436
|
writable: !0,
|
|
434
437
|
value: !1
|
|
435
|
-
}), Object.defineProperty(
|
|
438
|
+
}), Object.defineProperty(S, "_self", {
|
|
436
439
|
configurable: !1,
|
|
437
440
|
enumerable: !1,
|
|
438
441
|
writable: !1,
|
|
439
|
-
value:
|
|
440
|
-
}), Object.defineProperty(
|
|
442
|
+
value: v
|
|
443
|
+
}), Object.defineProperty(S, "_source", {
|
|
441
444
|
configurable: !1,
|
|
442
445
|
enumerable: !1,
|
|
443
446
|
writable: !1,
|
|
444
|
-
value:
|
|
445
|
-
}), Object.freeze && (Object.freeze(
|
|
447
|
+
value: C
|
|
448
|
+
}), Object.freeze && (Object.freeze(S.props), Object.freeze(S)), S;
|
|
446
449
|
};
|
|
447
|
-
function
|
|
450
|
+
function qr(o, p, m, v, C) {
|
|
448
451
|
{
|
|
449
|
-
var
|
|
450
|
-
|
|
451
|
-
for (
|
|
452
|
-
|
|
453
|
-
if (
|
|
454
|
-
var
|
|
455
|
-
for (
|
|
456
|
-
|
|
452
|
+
var k, O = {}, S = null, W = null;
|
|
453
|
+
m !== void 0 && (St(m), S = "" + m), Ur(p) && (St(p.key), S = "" + p.key), Nr(p) && (W = p.ref, Mr(p, C));
|
|
454
|
+
for (k in p)
|
|
455
|
+
Se.call(p, k) && !Dr.hasOwnProperty(k) && (O[k] = p[k]);
|
|
456
|
+
if (o && o.defaultProps) {
|
|
457
|
+
var N = o.defaultProps;
|
|
458
|
+
for (k in N)
|
|
459
|
+
O[k] === void 0 && (O[k] = N[k]);
|
|
457
460
|
}
|
|
458
|
-
if (
|
|
459
|
-
var
|
|
460
|
-
|
|
461
|
+
if (S || W) {
|
|
462
|
+
var I = typeof o == "function" ? o.displayName || o.name || "Unknown" : o;
|
|
463
|
+
S && Ir(O, I), W && Br(O, I);
|
|
461
464
|
}
|
|
462
|
-
return
|
|
465
|
+
return $r(o, S, W, C, v, Oe.current, O);
|
|
463
466
|
}
|
|
464
467
|
}
|
|
465
|
-
var
|
|
466
|
-
function
|
|
467
|
-
if (
|
|
468
|
-
var
|
|
469
|
-
|
|
468
|
+
var st = P.ReactCurrentOwner, Ct = P.ReactDebugCurrentFrame;
|
|
469
|
+
function we(o) {
|
|
470
|
+
if (o) {
|
|
471
|
+
var p = o._owner, m = Me(o.type, o._source, p ? p.type : null);
|
|
472
|
+
Ct.setExtraStackFrame(m);
|
|
470
473
|
} else
|
|
471
|
-
|
|
474
|
+
Ct.setExtraStackFrame(null);
|
|
472
475
|
}
|
|
473
|
-
var
|
|
474
|
-
|
|
475
|
-
function
|
|
476
|
-
return typeof
|
|
476
|
+
var ot;
|
|
477
|
+
ot = !1;
|
|
478
|
+
function at(o) {
|
|
479
|
+
return typeof o == "object" && o !== null && o.$$typeof === e;
|
|
477
480
|
}
|
|
478
|
-
function
|
|
481
|
+
function Pt() {
|
|
479
482
|
{
|
|
480
|
-
if (
|
|
481
|
-
var
|
|
482
|
-
if (
|
|
483
|
+
if (st.current) {
|
|
484
|
+
var o = B(st.current.type);
|
|
485
|
+
if (o)
|
|
483
486
|
return `
|
|
484
487
|
|
|
485
|
-
Check the render method of \`` +
|
|
488
|
+
Check the render method of \`` + o + "`.";
|
|
486
489
|
}
|
|
487
490
|
return "";
|
|
488
491
|
}
|
|
489
492
|
}
|
|
490
|
-
function
|
|
493
|
+
function Kr(o) {
|
|
491
494
|
return "";
|
|
492
495
|
}
|
|
493
|
-
var
|
|
494
|
-
function
|
|
496
|
+
var kt = {};
|
|
497
|
+
function Hr(o) {
|
|
495
498
|
{
|
|
496
|
-
var
|
|
497
|
-
if (!
|
|
498
|
-
var
|
|
499
|
-
|
|
499
|
+
var p = Pt();
|
|
500
|
+
if (!p) {
|
|
501
|
+
var m = typeof o == "string" ? o : o.displayName || o.name;
|
|
502
|
+
m && (p = `
|
|
500
503
|
|
|
501
|
-
Check the top-level render call using <` +
|
|
504
|
+
Check the top-level render call using <` + m + ">.");
|
|
502
505
|
}
|
|
503
|
-
return
|
|
506
|
+
return p;
|
|
504
507
|
}
|
|
505
508
|
}
|
|
506
|
-
function
|
|
509
|
+
function Lt(o, p) {
|
|
507
510
|
{
|
|
508
|
-
if (!
|
|
511
|
+
if (!o._store || o._store.validated || o.key != null)
|
|
509
512
|
return;
|
|
510
|
-
|
|
511
|
-
var
|
|
512
|
-
if (
|
|
513
|
+
o._store.validated = !0;
|
|
514
|
+
var m = Hr(p);
|
|
515
|
+
if (kt[m])
|
|
513
516
|
return;
|
|
514
|
-
|
|
515
|
-
var
|
|
516
|
-
|
|
517
|
+
kt[m] = !0;
|
|
518
|
+
var v = "";
|
|
519
|
+
o && o._owner && o._owner !== st.current && (v = " It was passed a child from " + B(o._owner.type) + "."), we(o), A('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', m, v), we(null);
|
|
517
520
|
}
|
|
518
521
|
}
|
|
519
|
-
function
|
|
522
|
+
function Ft(o, p) {
|
|
520
523
|
{
|
|
521
|
-
if (typeof
|
|
524
|
+
if (typeof o != "object")
|
|
522
525
|
return;
|
|
523
|
-
if (
|
|
524
|
-
for (var
|
|
525
|
-
var
|
|
526
|
-
|
|
526
|
+
if (rt(o))
|
|
527
|
+
for (var m = 0; m < o.length; m++) {
|
|
528
|
+
var v = o[m];
|
|
529
|
+
at(v) && Lt(v, p);
|
|
527
530
|
}
|
|
528
|
-
else if (
|
|
529
|
-
|
|
530
|
-
else if (
|
|
531
|
-
var
|
|
532
|
-
if (typeof
|
|
533
|
-
for (var
|
|
534
|
-
|
|
531
|
+
else if (at(o))
|
|
532
|
+
o._store && (o._store.validated = !0);
|
|
533
|
+
else if (o) {
|
|
534
|
+
var C = b(o);
|
|
535
|
+
if (typeof C == "function" && C !== o.entries)
|
|
536
|
+
for (var k = C.call(o), O; !(O = k.next()).done; )
|
|
537
|
+
at(O.value) && Lt(O.value, p);
|
|
535
538
|
}
|
|
536
539
|
}
|
|
537
540
|
}
|
|
538
|
-
function
|
|
541
|
+
function Vr(o) {
|
|
539
542
|
{
|
|
540
|
-
var
|
|
541
|
-
if (
|
|
543
|
+
var p = o.type;
|
|
544
|
+
if (p == null || typeof p == "string")
|
|
542
545
|
return;
|
|
543
|
-
var
|
|
544
|
-
if (typeof
|
|
545
|
-
|
|
546
|
-
else if (typeof
|
|
546
|
+
var m;
|
|
547
|
+
if (typeof p == "function")
|
|
548
|
+
m = p.propTypes;
|
|
549
|
+
else if (typeof p == "object" && (p.$$typeof === g || // Note: Memo only checks outer props here.
|
|
547
550
|
// Inner props are checked in the reconciler.
|
|
548
|
-
|
|
549
|
-
|
|
551
|
+
p.$$typeof === h))
|
|
552
|
+
m = p.propTypes;
|
|
550
553
|
else
|
|
551
554
|
return;
|
|
552
|
-
if (
|
|
553
|
-
var
|
|
554
|
-
|
|
555
|
-
} else if (
|
|
556
|
-
|
|
557
|
-
var
|
|
558
|
-
|
|
555
|
+
if (m) {
|
|
556
|
+
var v = B(p);
|
|
557
|
+
kr(m, o.props, "prop", v, o);
|
|
558
|
+
} else if (p.PropTypes !== void 0 && !ot) {
|
|
559
|
+
ot = !0;
|
|
560
|
+
var C = B(p);
|
|
561
|
+
A("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", C || "Unknown");
|
|
559
562
|
}
|
|
560
|
-
typeof
|
|
563
|
+
typeof p.getDefaultProps == "function" && !p.getDefaultProps.isReactClassApproved && A("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
561
564
|
}
|
|
562
565
|
}
|
|
563
|
-
function
|
|
566
|
+
function Wr(o) {
|
|
564
567
|
{
|
|
565
|
-
for (var
|
|
566
|
-
var
|
|
567
|
-
if (
|
|
568
|
-
|
|
568
|
+
for (var p = Object.keys(o.props), m = 0; m < p.length; m++) {
|
|
569
|
+
var v = p[m];
|
|
570
|
+
if (v !== "children" && v !== "key") {
|
|
571
|
+
we(o), A("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", v), we(null);
|
|
569
572
|
break;
|
|
570
573
|
}
|
|
571
574
|
}
|
|
572
|
-
|
|
575
|
+
o.ref !== null && (we(o), A("Invalid attribute `ref` supplied to `React.Fragment`."), we(null));
|
|
573
576
|
}
|
|
574
577
|
}
|
|
575
|
-
var
|
|
576
|
-
function
|
|
578
|
+
var jt = {};
|
|
579
|
+
function Dt(o, p, m, v, C, k) {
|
|
577
580
|
{
|
|
578
|
-
var
|
|
579
|
-
if (!
|
|
580
|
-
var
|
|
581
|
-
(
|
|
582
|
-
var
|
|
583
|
-
|
|
584
|
-
var
|
|
585
|
-
|
|
581
|
+
var O = fe(o);
|
|
582
|
+
if (!O) {
|
|
583
|
+
var S = "";
|
|
584
|
+
(o === void 0 || typeof o == "object" && o !== null && Object.keys(o).length === 0) && (S += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
585
|
+
var W = Kr();
|
|
586
|
+
W ? S += W : S += Pt();
|
|
587
|
+
var N;
|
|
588
|
+
o === null ? N = "null" : rt(o) ? N = "array" : o !== void 0 && o.$$typeof === e ? (N = "<" + (B(o.type) || "Unknown") + " />", S = " Did you accidentally export a JSX literal instead of a component?") : N = typeof o, A("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", N, S);
|
|
586
589
|
}
|
|
587
|
-
var
|
|
588
|
-
if (
|
|
589
|
-
return
|
|
590
|
-
if (
|
|
591
|
-
var
|
|
592
|
-
if (
|
|
593
|
-
if (
|
|
594
|
-
if (
|
|
595
|
-
for (var
|
|
596
|
-
|
|
597
|
-
Object.freeze && Object.freeze(
|
|
590
|
+
var I = qr(o, p, m, C, k);
|
|
591
|
+
if (I == null)
|
|
592
|
+
return I;
|
|
593
|
+
if (O) {
|
|
594
|
+
var re = p.children;
|
|
595
|
+
if (re !== void 0)
|
|
596
|
+
if (v)
|
|
597
|
+
if (rt(re)) {
|
|
598
|
+
for (var ve = 0; ve < re.length; ve++)
|
|
599
|
+
Ft(re[ve], o);
|
|
600
|
+
Object.freeze && Object.freeze(re);
|
|
598
601
|
} else
|
|
599
|
-
|
|
602
|
+
A("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
600
603
|
else
|
|
601
|
-
|
|
604
|
+
Ft(re, o);
|
|
602
605
|
}
|
|
603
|
-
if (
|
|
604
|
-
var
|
|
605
|
-
return
|
|
606
|
-
}),
|
|
607
|
-
if (!
|
|
608
|
-
var
|
|
609
|
-
|
|
606
|
+
if (Se.call(p, "key")) {
|
|
607
|
+
var pe = B(o), J = Object.keys(p).filter(function(Qr) {
|
|
608
|
+
return Qr !== "key";
|
|
609
|
+
}), it = J.length > 0 ? "{key: someKey, " + J.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
610
|
+
if (!jt[pe + it]) {
|
|
611
|
+
var Xr = J.length > 0 ? "{" + J.join(": ..., ") + ": ...}" : "{}";
|
|
612
|
+
A(`A props object containing a "key" prop is being spread into JSX:
|
|
610
613
|
let props = %s;
|
|
611
614
|
<%s {...props} />
|
|
612
615
|
React keys must be passed directly to JSX without using spread:
|
|
613
616
|
let props = %s;
|
|
614
|
-
<%s key={someKey} {...props} />`,
|
|
617
|
+
<%s key={someKey} {...props} />`, it, pe, Xr, pe), jt[pe + it] = !0;
|
|
615
618
|
}
|
|
616
619
|
}
|
|
617
|
-
return
|
|
618
|
-
}
|
|
619
|
-
}
|
|
620
|
-
function
|
|
621
|
-
return
|
|
622
|
-
}
|
|
623
|
-
function
|
|
624
|
-
return
|
|
625
|
-
}
|
|
626
|
-
var
|
|
627
|
-
|
|
628
|
-
}()),
|
|
629
|
-
}
|
|
630
|
-
var
|
|
631
|
-
function
|
|
632
|
-
return
|
|
633
|
-
}
|
|
634
|
-
var
|
|
635
|
-
const
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
}
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
}
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
620
|
+
return o === n ? Wr(I) : Vr(I), I;
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
function zr(o, p, m) {
|
|
624
|
+
return Dt(o, p, m, !0);
|
|
625
|
+
}
|
|
626
|
+
function Jr(o, p, m) {
|
|
627
|
+
return Dt(o, p, m, !1);
|
|
628
|
+
}
|
|
629
|
+
var Yr = Jr, Gr = zr;
|
|
630
|
+
Ce.Fragment = n, Ce.jsx = Yr, Ce.jsxs = Gr;
|
|
631
|
+
}()), Ce;
|
|
632
|
+
}
|
|
633
|
+
var Mt;
|
|
634
|
+
function ln() {
|
|
635
|
+
return Mt || (Mt = 1, process.env.NODE_ENV === "production" ? qe.exports = on() : qe.exports = an()), qe.exports;
|
|
636
|
+
}
|
|
637
|
+
var cn = ln();
|
|
638
|
+
const or = tn(
|
|
639
|
+
null
|
|
640
|
+
), un = () => {
|
|
641
|
+
const t = rn(or);
|
|
642
|
+
if (!t)
|
|
643
|
+
throw new Error(
|
|
644
|
+
"useTranslatorContext must be used within a TranslatorProvider"
|
|
645
|
+
);
|
|
646
|
+
return t;
|
|
647
|
+
};
|
|
648
|
+
class It extends Error {
|
|
649
|
+
constructor(r) {
|
|
650
|
+
super(r);
|
|
651
|
+
te(this, "code", "timeout");
|
|
652
|
+
this.name = "ExternalTranslationTimeoutError";
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
const fn = "auto", Ke = (t) => typeof t == "number" && Number.isFinite(t) && t > 0, dn = (t) => {
|
|
656
|
+
const e = Object.entries(t).sort(([r], [n]) => r === n ? 0 : r < n ? -1 : 1);
|
|
657
|
+
return Object.fromEntries(e);
|
|
658
|
+
};
|
|
659
|
+
class hn {
|
|
660
|
+
constructor(e) {
|
|
661
|
+
te(this, "provider");
|
|
662
|
+
te(this, "config");
|
|
663
|
+
te(this, "cache");
|
|
664
|
+
te(this, "logger");
|
|
665
|
+
te(this, "inFlight", /* @__PURE__ */ new Map());
|
|
666
|
+
this.provider = e.provider, this.config = e.config, this.cache = e.cache, this.logger = e.logger;
|
|
667
|
+
}
|
|
668
|
+
isEnabled() {
|
|
669
|
+
return this.config.enabled;
|
|
670
|
+
}
|
|
671
|
+
async translate(e) {
|
|
672
|
+
if (!this.isEnabled()) {
|
|
673
|
+
this.debug("external_translation_disabled", {
|
|
674
|
+
key: e.key,
|
|
675
|
+
targetLanguage: e.targetLanguage
|
|
676
|
+
});
|
|
677
|
+
return;
|
|
678
|
+
}
|
|
679
|
+
const r = this.normalizeRequest(e);
|
|
680
|
+
if (!await this.shouldTranslate(r.externalRequest)) {
|
|
681
|
+
this.debug("external_translation_skipped", {
|
|
682
|
+
key: r.externalRequest.key,
|
|
683
|
+
targetLanguage: r.externalRequest.targetLanguage
|
|
684
|
+
});
|
|
685
|
+
return;
|
|
686
|
+
}
|
|
687
|
+
const n = this.readFromCache(r.cacheKey);
|
|
688
|
+
if (n)
|
|
689
|
+
return this.debug("external_translation_cache_hit", {
|
|
690
|
+
key: r.externalRequest.key,
|
|
691
|
+
cacheKey: r.cacheKey
|
|
692
|
+
}), n;
|
|
693
|
+
const s = this.inFlight.get(r.cacheKey);
|
|
694
|
+
if (s)
|
|
695
|
+
return this.debug("external_translation_deduped", {
|
|
696
|
+
key: r.externalRequest.key,
|
|
697
|
+
cacheKey: r.cacheKey
|
|
698
|
+
}), s;
|
|
699
|
+
const i = this.executeTranslation(r);
|
|
700
|
+
return this.inFlight.set(r.cacheKey, i), i;
|
|
701
|
+
}
|
|
702
|
+
normalizeRequest(e) {
|
|
703
|
+
const r = e.sourceLanguage ?? fn, n = {
|
|
704
|
+
text: e.text,
|
|
705
|
+
sourceLanguage: r,
|
|
706
|
+
targetLanguage: e.targetLanguage,
|
|
707
|
+
glossary: e.glossary
|
|
708
|
+
}, s = this.createCacheKey(n), i = Ke(e.timeoutMs) ? e.timeoutMs : this.config.timeoutMs;
|
|
709
|
+
return {
|
|
710
|
+
externalRequest: {
|
|
711
|
+
key: e.key,
|
|
712
|
+
text: e.text,
|
|
713
|
+
targetLanguage: e.targetLanguage,
|
|
714
|
+
sourceLanguage: r
|
|
715
|
+
},
|
|
716
|
+
translateRequest: n,
|
|
717
|
+
cacheKey: s,
|
|
718
|
+
timeoutMs: i,
|
|
719
|
+
signal: e.signal
|
|
720
|
+
};
|
|
721
|
+
}
|
|
722
|
+
async shouldTranslate(e) {
|
|
723
|
+
if (!this.config.shouldTranslate)
|
|
724
|
+
return !0;
|
|
725
|
+
try {
|
|
726
|
+
return this.config.shouldTranslate(e);
|
|
727
|
+
} catch (r) {
|
|
728
|
+
return this.warn("external_translation_should_translate_error", {
|
|
729
|
+
key: e.key,
|
|
730
|
+
language: e.targetLanguage,
|
|
731
|
+
error: r
|
|
732
|
+
}), !0;
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
async executeTranslation(e) {
|
|
736
|
+
try {
|
|
737
|
+
if (!await this.invokeExternalTranslationHook(e.externalRequest)) {
|
|
738
|
+
this.debug("external_translation_vetoed", {
|
|
739
|
+
key: e.externalRequest.key,
|
|
740
|
+
targetLanguage: e.externalRequest.targetLanguage
|
|
741
|
+
});
|
|
742
|
+
return;
|
|
743
|
+
}
|
|
744
|
+
this.debug("external_translation_started", {
|
|
745
|
+
key: e.externalRequest.key,
|
|
746
|
+
cacheKey: e.cacheKey
|
|
747
|
+
});
|
|
748
|
+
const r = await this.translateWithTimeout(
|
|
749
|
+
e.translateRequest,
|
|
750
|
+
e.timeoutMs,
|
|
751
|
+
e.signal
|
|
752
|
+
);
|
|
753
|
+
return this.writeToCache(e.cacheKey, r), this.notifyTranslationComplete(r), this.debug("external_translation_succeeded", {
|
|
754
|
+
key: e.externalRequest.key,
|
|
755
|
+
cacheKey: e.cacheKey
|
|
756
|
+
}), r;
|
|
757
|
+
} catch (r) {
|
|
758
|
+
const n = this.normalizeError(r);
|
|
759
|
+
this.handleTranslationError(e, n);
|
|
760
|
+
return;
|
|
761
|
+
} finally {
|
|
762
|
+
this.inFlight.delete(e.cacheKey);
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
async invokeExternalTranslationHook(e) {
|
|
766
|
+
const r = this.config.onExternalTranslation;
|
|
767
|
+
if (!r)
|
|
768
|
+
return !0;
|
|
769
|
+
try {
|
|
770
|
+
const n = await r(e);
|
|
771
|
+
return typeof n == "boolean" ? n : !0;
|
|
772
|
+
} catch (n) {
|
|
773
|
+
return this.warn("external_translation_hook_error", {
|
|
774
|
+
key: e.key,
|
|
775
|
+
language: e.targetLanguage,
|
|
776
|
+
error: n
|
|
777
|
+
}), !0;
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
async translateWithTimeout(e, r, n) {
|
|
781
|
+
if (!(typeof AbortController == "function"))
|
|
782
|
+
return this.provider.translate(e, {
|
|
783
|
+
timeoutMs: Ke(r) ? r : void 0,
|
|
784
|
+
signal: n
|
|
785
|
+
});
|
|
786
|
+
const i = new AbortController();
|
|
787
|
+
let a = !1, l;
|
|
788
|
+
n && (n.aborted ? i.abort() : (l = () => {
|
|
789
|
+
i.abort();
|
|
790
|
+
}, n.addEventListener("abort", l, { once: !0 })));
|
|
791
|
+
const g = Ke(r) && r ? setTimeout(() => {
|
|
792
|
+
a = !0, i.abort();
|
|
793
|
+
}, r) : void 0;
|
|
794
|
+
try {
|
|
795
|
+
return await this.provider.translate(e, {
|
|
796
|
+
timeoutMs: Ke(r) ? r : void 0,
|
|
797
|
+
signal: i.signal
|
|
798
|
+
});
|
|
799
|
+
} catch (f) {
|
|
800
|
+
throw a ? new It(
|
|
801
|
+
`External translation timed out after ${r}ms`
|
|
802
|
+
) : (i.signal.aborted && !a, f);
|
|
803
|
+
} finally {
|
|
804
|
+
g && clearTimeout(g), l && n && n.removeEventListener("abort", l);
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
readFromCache(e) {
|
|
808
|
+
var r;
|
|
809
|
+
return (r = this.cache) == null ? void 0 : r.get(e);
|
|
810
|
+
}
|
|
811
|
+
writeToCache(e, r) {
|
|
812
|
+
var n;
|
|
813
|
+
(n = this.cache) == null || n.set(e, r);
|
|
814
|
+
}
|
|
815
|
+
handleTranslationError(e, r) {
|
|
816
|
+
const n = {
|
|
817
|
+
key: e.externalRequest.key,
|
|
818
|
+
language: e.externalRequest.targetLanguage,
|
|
819
|
+
originalText: e.externalRequest.text,
|
|
820
|
+
error: r
|
|
821
|
+
};
|
|
822
|
+
this.notifyTranslationError(n), this.warn("external_fallback_failed", {
|
|
823
|
+
provider: this.provider.type,
|
|
824
|
+
key: n.key,
|
|
825
|
+
language: n.language,
|
|
826
|
+
errorCode: r.code,
|
|
827
|
+
retryable: r.retryable,
|
|
828
|
+
message: r.message,
|
|
829
|
+
details: r.details
|
|
830
|
+
});
|
|
831
|
+
}
|
|
832
|
+
normalizeError(e) {
|
|
833
|
+
return this.provider.normalizeError ? this.provider.normalizeError(e) : e instanceof It ? {
|
|
834
|
+
code: "timeout",
|
|
835
|
+
message: e.message,
|
|
836
|
+
retryable: !0,
|
|
837
|
+
details: e
|
|
838
|
+
} : e instanceof Error ? {
|
|
839
|
+
code: e.name || "unknown_error",
|
|
840
|
+
message: e.message,
|
|
841
|
+
retryable: !1,
|
|
842
|
+
details: e
|
|
843
|
+
} : {
|
|
844
|
+
code: "unknown_error",
|
|
845
|
+
message: "Unknown provider error",
|
|
846
|
+
retryable: !1,
|
|
847
|
+
details: e
|
|
848
|
+
};
|
|
849
|
+
}
|
|
850
|
+
createCacheKey(e) {
|
|
851
|
+
return [
|
|
852
|
+
e.sourceLanguage,
|
|
853
|
+
e.targetLanguage,
|
|
854
|
+
this.hashText(e.text, e.glossary)
|
|
855
|
+
].join("|");
|
|
856
|
+
}
|
|
857
|
+
hashText(e, r) {
|
|
858
|
+
let n = 2166136261;
|
|
859
|
+
const s = r && Object.keys(r).length > 0 ? `${e}|${JSON.stringify(dn(r))}` : e;
|
|
860
|
+
for (let i = 0; i < s.length; i += 1)
|
|
861
|
+
n ^= s.charCodeAt(i), n += (n << 1) + (n << 4) + (n << 7) + (n << 8) + (n << 24);
|
|
862
|
+
return (n >>> 0).toString(16);
|
|
863
|
+
}
|
|
864
|
+
warn(e, r) {
|
|
865
|
+
const n = {
|
|
866
|
+
scope: "translator",
|
|
867
|
+
event: e,
|
|
868
|
+
...r
|
|
869
|
+
};
|
|
870
|
+
if (this.logger) {
|
|
871
|
+
this.logger.warn(e, n);
|
|
872
|
+
return;
|
|
873
|
+
}
|
|
874
|
+
console.warn("[vbss-translator]", n);
|
|
875
|
+
}
|
|
876
|
+
debug(e, r) {
|
|
877
|
+
var s;
|
|
878
|
+
if (!this.config.debug)
|
|
879
|
+
return;
|
|
880
|
+
const n = {
|
|
881
|
+
scope: "translator",
|
|
882
|
+
event: e,
|
|
883
|
+
...r
|
|
884
|
+
};
|
|
885
|
+
if ((s = this.logger) != null && s.debug) {
|
|
886
|
+
this.logger.debug(e, n);
|
|
887
|
+
return;
|
|
888
|
+
}
|
|
889
|
+
console.debug("[vbss-translator]", n);
|
|
890
|
+
}
|
|
891
|
+
notifyTranslationComplete(e) {
|
|
892
|
+
const r = this.config.onTranslationComplete;
|
|
893
|
+
if (r)
|
|
894
|
+
try {
|
|
895
|
+
r(e);
|
|
896
|
+
} catch (n) {
|
|
897
|
+
this.warn("external_translation_complete_callback_error", {
|
|
898
|
+
provider: this.provider.type,
|
|
899
|
+
error: n
|
|
900
|
+
});
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
notifyTranslationError(e) {
|
|
904
|
+
const r = this.config.onTranslationError;
|
|
905
|
+
if (r)
|
|
906
|
+
try {
|
|
907
|
+
r(e);
|
|
908
|
+
} catch (n) {
|
|
909
|
+
this.warn("external_translation_error_callback_error", {
|
|
910
|
+
provider: this.provider.type,
|
|
911
|
+
key: e.key,
|
|
912
|
+
language: e.language,
|
|
913
|
+
error: n
|
|
914
|
+
});
|
|
915
|
+
}
|
|
916
|
+
}
|
|
917
|
+
}
|
|
918
|
+
const ct = () => Date.now(), He = (t) => typeof t == "number" && Number.isFinite(t) && t > 0;
|
|
919
|
+
class pn {
|
|
920
|
+
constructor(e) {
|
|
921
|
+
te(this, "store", /* @__PURE__ */ new Map());
|
|
922
|
+
te(this, "enabled");
|
|
923
|
+
te(this, "ttlMs");
|
|
924
|
+
te(this, "maxEntries");
|
|
925
|
+
this.enabled = e.enabled, this.ttlMs = Math.max(0, e.ttlMs), this.maxEntries = e.maxEntries;
|
|
926
|
+
}
|
|
927
|
+
isEnabled() {
|
|
928
|
+
return this.enabled;
|
|
929
|
+
}
|
|
930
|
+
setEnabled(e) {
|
|
931
|
+
e || this.clear(), this.enabled = e;
|
|
932
|
+
}
|
|
933
|
+
setTtl(e) {
|
|
934
|
+
this.ttlMs = Math.max(0, e);
|
|
935
|
+
}
|
|
936
|
+
size() {
|
|
937
|
+
return this.store.size;
|
|
938
|
+
}
|
|
939
|
+
clear() {
|
|
940
|
+
this.store.clear();
|
|
941
|
+
}
|
|
942
|
+
get(e) {
|
|
943
|
+
if (!this.enabled)
|
|
944
|
+
return;
|
|
945
|
+
const r = this.store.get(e);
|
|
946
|
+
if (r) {
|
|
947
|
+
if (this.isExpired(r)) {
|
|
948
|
+
this.store.delete(e);
|
|
949
|
+
return;
|
|
950
|
+
}
|
|
951
|
+
return r.value;
|
|
952
|
+
}
|
|
953
|
+
}
|
|
954
|
+
set(e, r, n) {
|
|
955
|
+
if (!this.enabled)
|
|
956
|
+
return;
|
|
957
|
+
const s = He(n) ? n : this.ttlMs, i = He(s) ? ct() + s : void 0;
|
|
958
|
+
this.store.set(e, {
|
|
959
|
+
value: r,
|
|
960
|
+
expiresAt: i,
|
|
961
|
+
insertedAt: ct()
|
|
962
|
+
}), this.enforceMaxEntries();
|
|
963
|
+
}
|
|
964
|
+
delete(e) {
|
|
965
|
+
this.store.delete(e);
|
|
966
|
+
}
|
|
967
|
+
has(e) {
|
|
968
|
+
if (!this.enabled)
|
|
969
|
+
return !1;
|
|
970
|
+
const r = this.store.get(e);
|
|
971
|
+
return r ? this.isExpired(r) ? (this.store.delete(e), !1) : !0 : !1;
|
|
972
|
+
}
|
|
973
|
+
entries() {
|
|
974
|
+
const e = [];
|
|
975
|
+
for (const [r, n] of this.store.entries()) {
|
|
976
|
+
if (this.isExpired(n)) {
|
|
977
|
+
this.store.delete(r);
|
|
978
|
+
continue;
|
|
979
|
+
}
|
|
980
|
+
e.push({
|
|
981
|
+
key: r,
|
|
982
|
+
result: n.value,
|
|
983
|
+
expiresAt: n.expiresAt
|
|
984
|
+
});
|
|
985
|
+
}
|
|
986
|
+
return e;
|
|
987
|
+
}
|
|
988
|
+
prune() {
|
|
989
|
+
for (const [e, r] of this.store.entries())
|
|
990
|
+
this.isExpired(r) && this.store.delete(e);
|
|
991
|
+
}
|
|
992
|
+
enforceMaxEntries() {
|
|
993
|
+
if (!He(this.maxEntries))
|
|
994
|
+
return;
|
|
995
|
+
const e = this.maxEntries;
|
|
996
|
+
for (; this.store.size > e; ) {
|
|
997
|
+
const r = this.findOldestKey();
|
|
998
|
+
if (!r)
|
|
999
|
+
break;
|
|
1000
|
+
this.store.delete(r);
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
1003
|
+
findOldestKey() {
|
|
1004
|
+
let e, r = Number.POSITIVE_INFINITY;
|
|
1005
|
+
for (const [n, s] of this.store.entries())
|
|
1006
|
+
s.insertedAt < r && (e = n, r = s.insertedAt);
|
|
1007
|
+
return e;
|
|
1008
|
+
}
|
|
1009
|
+
isExpired(e) {
|
|
1010
|
+
return He(e.expiresAt) ? e.expiresAt <= ct() : !1;
|
|
1011
|
+
}
|
|
1012
|
+
}
|
|
1013
|
+
function ar(t, e) {
|
|
1014
|
+
return function() {
|
|
1015
|
+
return t.apply(e, arguments);
|
|
659
1016
|
};
|
|
660
|
-
|
|
661
|
-
},
|
|
1017
|
+
}
|
|
1018
|
+
const { toString: gn } = Object.prototype, { getPrototypeOf: bt } = Object, { iterator: Ge, toStringTag: ir } = Symbol, Xe = /* @__PURE__ */ ((t) => (e) => {
|
|
1019
|
+
const r = gn.call(e);
|
|
1020
|
+
return t[r] || (t[r] = r.slice(8, -1).toLowerCase());
|
|
1021
|
+
})(/* @__PURE__ */ Object.create(null)), oe = (t) => (t = t.toLowerCase(), (e) => Xe(e) === t), Qe = (t) => (e) => typeof e === t, { isArray: Te } = Array, Re = Qe("undefined");
|
|
1022
|
+
function Le(t) {
|
|
1023
|
+
return t !== null && !Re(t) && t.constructor !== null && !Re(t.constructor) && G(t.constructor.isBuffer) && t.constructor.isBuffer(t);
|
|
1024
|
+
}
|
|
1025
|
+
const lr = oe("ArrayBuffer");
|
|
1026
|
+
function mn(t) {
|
|
1027
|
+
let e;
|
|
1028
|
+
return typeof ArrayBuffer < "u" && ArrayBuffer.isView ? e = ArrayBuffer.isView(t) : e = t && t.buffer && lr(t.buffer), e;
|
|
1029
|
+
}
|
|
1030
|
+
const yn = Qe("string"), G = Qe("function"), cr = Qe("number"), Fe = (t) => t !== null && typeof t == "object", bn = (t) => t === !0 || t === !1, We = (t) => {
|
|
1031
|
+
if (Xe(t) !== "object")
|
|
1032
|
+
return !1;
|
|
1033
|
+
const e = bt(t);
|
|
1034
|
+
return (e === null || e === Object.prototype || Object.getPrototypeOf(e) === null) && !(ir in t) && !(Ge in t);
|
|
1035
|
+
}, En = (t) => {
|
|
1036
|
+
if (!Fe(t) || Le(t))
|
|
1037
|
+
return !1;
|
|
1038
|
+
try {
|
|
1039
|
+
return Object.keys(t).length === 0 && Object.getPrototypeOf(t) === Object.prototype;
|
|
1040
|
+
} catch {
|
|
1041
|
+
return !1;
|
|
1042
|
+
}
|
|
1043
|
+
}, wn = oe("Date"), vn = oe("File"), Rn = oe("Blob"), Tn = oe("FileList"), _n = (t) => Fe(t) && G(t.pipe), xn = (t) => {
|
|
1044
|
+
let e;
|
|
1045
|
+
return t && (typeof FormData == "function" && t instanceof FormData || G(t.append) && ((e = Xe(t)) === "formdata" || // detect form-data instance
|
|
1046
|
+
e === "object" && G(t.toString) && t.toString() === "[object FormData]"));
|
|
1047
|
+
}, Sn = oe("URLSearchParams"), [On, An, Cn, Pn] = ["ReadableStream", "Request", "Response", "Headers"].map(oe), kn = (t) => t.trim ? t.trim() : t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
|
|
1048
|
+
function je(t, e, { allOwnKeys: r = !1 } = {}) {
|
|
1049
|
+
if (t === null || typeof t > "u")
|
|
1050
|
+
return;
|
|
1051
|
+
let n, s;
|
|
1052
|
+
if (typeof t != "object" && (t = [t]), Te(t))
|
|
1053
|
+
for (n = 0, s = t.length; n < s; n++)
|
|
1054
|
+
e.call(null, t[n], n, t);
|
|
1055
|
+
else {
|
|
1056
|
+
if (Le(t))
|
|
1057
|
+
return;
|
|
1058
|
+
const i = r ? Object.getOwnPropertyNames(t) : Object.keys(t), a = i.length;
|
|
1059
|
+
let l;
|
|
1060
|
+
for (n = 0; n < a; n++)
|
|
1061
|
+
l = i[n], e.call(null, t[l], l, t);
|
|
1062
|
+
}
|
|
1063
|
+
}
|
|
1064
|
+
function ur(t, e) {
|
|
1065
|
+
if (Le(t))
|
|
1066
|
+
return null;
|
|
1067
|
+
e = e.toLowerCase();
|
|
1068
|
+
const r = Object.keys(t);
|
|
1069
|
+
let n = r.length, s;
|
|
1070
|
+
for (; n-- > 0; )
|
|
1071
|
+
if (s = r[n], e === s.toLowerCase())
|
|
1072
|
+
return s;
|
|
1073
|
+
return null;
|
|
1074
|
+
}
|
|
1075
|
+
const ge = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : global, fr = (t) => !Re(t) && t !== ge;
|
|
1076
|
+
function pt() {
|
|
1077
|
+
const { caseless: t, skipUndefined: e } = fr(this) && this || {}, r = {}, n = (s, i) => {
|
|
1078
|
+
const a = t && ur(r, i) || i;
|
|
1079
|
+
We(r[a]) && We(s) ? r[a] = pt(r[a], s) : We(s) ? r[a] = pt({}, s) : Te(s) ? r[a] = s.slice() : (!e || !Re(s)) && (r[a] = s);
|
|
1080
|
+
};
|
|
1081
|
+
for (let s = 0, i = arguments.length; s < i; s++)
|
|
1082
|
+
arguments[s] && je(arguments[s], n);
|
|
1083
|
+
return r;
|
|
1084
|
+
}
|
|
1085
|
+
const Ln = (t, e, r, { allOwnKeys: n } = {}) => (je(e, (s, i) => {
|
|
1086
|
+
r && G(s) ? t[i] = ar(s, r) : t[i] = s;
|
|
1087
|
+
}, { allOwnKeys: n }), t), Fn = (t) => (t.charCodeAt(0) === 65279 && (t = t.slice(1)), t), jn = (t, e, r, n) => {
|
|
1088
|
+
t.prototype = Object.create(e.prototype, n), t.prototype.constructor = t, Object.defineProperty(t, "super", {
|
|
1089
|
+
value: e.prototype
|
|
1090
|
+
}), r && Object.assign(t.prototype, r);
|
|
1091
|
+
}, Dn = (t, e, r, n) => {
|
|
1092
|
+
let s, i, a;
|
|
1093
|
+
const l = {};
|
|
1094
|
+
if (e = e || {}, t == null) return e;
|
|
1095
|
+
do {
|
|
1096
|
+
for (s = Object.getOwnPropertyNames(t), i = s.length; i-- > 0; )
|
|
1097
|
+
a = s[i], (!n || n(a, t, e)) && !l[a] && (e[a] = t[a], l[a] = !0);
|
|
1098
|
+
t = r !== !1 && bt(t);
|
|
1099
|
+
} while (t && (!r || r(t, e)) && t !== Object.prototype);
|
|
1100
|
+
return e;
|
|
1101
|
+
}, Nn = (t, e, r) => {
|
|
1102
|
+
t = String(t), (r === void 0 || r > t.length) && (r = t.length), r -= e.length;
|
|
1103
|
+
const n = t.indexOf(e, r);
|
|
1104
|
+
return n !== -1 && n === r;
|
|
1105
|
+
}, Un = (t) => {
|
|
1106
|
+
if (!t) return null;
|
|
1107
|
+
if (Te(t)) return t;
|
|
1108
|
+
let e = t.length;
|
|
1109
|
+
if (!cr(e)) return null;
|
|
1110
|
+
const r = new Array(e);
|
|
1111
|
+
for (; e-- > 0; )
|
|
1112
|
+
r[e] = t[e];
|
|
1113
|
+
return r;
|
|
1114
|
+
}, Mn = /* @__PURE__ */ ((t) => (e) => t && e instanceof t)(typeof Uint8Array < "u" && bt(Uint8Array)), In = (t, e) => {
|
|
1115
|
+
const n = (t && t[Ge]).call(t);
|
|
1116
|
+
let s;
|
|
1117
|
+
for (; (s = n.next()) && !s.done; ) {
|
|
1118
|
+
const i = s.value;
|
|
1119
|
+
e.call(t, i[0], i[1]);
|
|
1120
|
+
}
|
|
1121
|
+
}, Bn = (t, e) => {
|
|
1122
|
+
let r;
|
|
1123
|
+
const n = [];
|
|
1124
|
+
for (; (r = t.exec(e)) !== null; )
|
|
1125
|
+
n.push(r);
|
|
1126
|
+
return n;
|
|
1127
|
+
}, $n = oe("HTMLFormElement"), qn = (t) => t.toLowerCase().replace(
|
|
1128
|
+
/[-_\s]([a-z\d])(\w*)/g,
|
|
1129
|
+
function(r, n, s) {
|
|
1130
|
+
return n.toUpperCase() + s;
|
|
1131
|
+
}
|
|
1132
|
+
), Bt = (({ hasOwnProperty: t }) => (e, r) => t.call(e, r))(Object.prototype), Kn = oe("RegExp"), dr = (t, e) => {
|
|
1133
|
+
const r = Object.getOwnPropertyDescriptors(t), n = {};
|
|
1134
|
+
je(r, (s, i) => {
|
|
1135
|
+
let a;
|
|
1136
|
+
(a = e(s, i, t)) !== !1 && (n[i] = a || s);
|
|
1137
|
+
}), Object.defineProperties(t, n);
|
|
1138
|
+
}, Hn = (t) => {
|
|
1139
|
+
dr(t, (e, r) => {
|
|
1140
|
+
if (G(t) && ["arguments", "caller", "callee"].indexOf(r) !== -1)
|
|
1141
|
+
return !1;
|
|
1142
|
+
const n = t[r];
|
|
1143
|
+
if (G(n)) {
|
|
1144
|
+
if (e.enumerable = !1, "writable" in e) {
|
|
1145
|
+
e.writable = !1;
|
|
1146
|
+
return;
|
|
1147
|
+
}
|
|
1148
|
+
e.set || (e.set = () => {
|
|
1149
|
+
throw Error("Can not rewrite read-only method '" + r + "'");
|
|
1150
|
+
});
|
|
1151
|
+
}
|
|
1152
|
+
});
|
|
1153
|
+
}, Vn = (t, e) => {
|
|
1154
|
+
const r = {}, n = (s) => {
|
|
1155
|
+
s.forEach((i) => {
|
|
1156
|
+
r[i] = !0;
|
|
1157
|
+
});
|
|
1158
|
+
};
|
|
1159
|
+
return Te(t) ? n(t) : n(String(t).split(e)), r;
|
|
1160
|
+
}, Wn = () => {
|
|
1161
|
+
}, zn = (t, e) => t != null && Number.isFinite(t = +t) ? t : e;
|
|
1162
|
+
function Jn(t) {
|
|
1163
|
+
return !!(t && G(t.append) && t[ir] === "FormData" && t[Ge]);
|
|
1164
|
+
}
|
|
1165
|
+
const Yn = (t) => {
|
|
1166
|
+
const e = new Array(10), r = (n, s) => {
|
|
1167
|
+
if (Fe(n)) {
|
|
1168
|
+
if (e.indexOf(n) >= 0)
|
|
1169
|
+
return;
|
|
1170
|
+
if (Le(n))
|
|
1171
|
+
return n;
|
|
1172
|
+
if (!("toJSON" in n)) {
|
|
1173
|
+
e[s] = n;
|
|
1174
|
+
const i = Te(n) ? [] : {};
|
|
1175
|
+
return je(n, (a, l) => {
|
|
1176
|
+
const g = r(a, s + 1);
|
|
1177
|
+
!Re(g) && (i[l] = g);
|
|
1178
|
+
}), e[s] = void 0, i;
|
|
1179
|
+
}
|
|
1180
|
+
}
|
|
1181
|
+
return n;
|
|
1182
|
+
};
|
|
1183
|
+
return r(t, 0);
|
|
1184
|
+
}, Gn = oe("AsyncFunction"), Xn = (t) => t && (Fe(t) || G(t)) && G(t.then) && G(t.catch), hr = ((t, e) => t ? setImmediate : e ? ((r, n) => (ge.addEventListener("message", ({ source: s, data: i }) => {
|
|
1185
|
+
s === ge && i === r && n.length && n.shift()();
|
|
1186
|
+
}, !1), (s) => {
|
|
1187
|
+
n.push(s), ge.postMessage(r, "*");
|
|
1188
|
+
}))(`axios@${Math.random()}`, []) : (r) => setTimeout(r))(
|
|
1189
|
+
typeof setImmediate == "function",
|
|
1190
|
+
G(ge.postMessage)
|
|
1191
|
+
), Qn = typeof queueMicrotask < "u" ? queueMicrotask.bind(ge) : typeof process < "u" && process.nextTick || hr, Zn = (t) => t != null && G(t[Ge]), c = {
|
|
1192
|
+
isArray: Te,
|
|
1193
|
+
isArrayBuffer: lr,
|
|
1194
|
+
isBuffer: Le,
|
|
1195
|
+
isFormData: xn,
|
|
1196
|
+
isArrayBufferView: mn,
|
|
1197
|
+
isString: yn,
|
|
1198
|
+
isNumber: cr,
|
|
1199
|
+
isBoolean: bn,
|
|
1200
|
+
isObject: Fe,
|
|
1201
|
+
isPlainObject: We,
|
|
1202
|
+
isEmptyObject: En,
|
|
1203
|
+
isReadableStream: On,
|
|
1204
|
+
isRequest: An,
|
|
1205
|
+
isResponse: Cn,
|
|
1206
|
+
isHeaders: Pn,
|
|
1207
|
+
isUndefined: Re,
|
|
1208
|
+
isDate: wn,
|
|
1209
|
+
isFile: vn,
|
|
1210
|
+
isBlob: Rn,
|
|
1211
|
+
isRegExp: Kn,
|
|
1212
|
+
isFunction: G,
|
|
1213
|
+
isStream: _n,
|
|
1214
|
+
isURLSearchParams: Sn,
|
|
1215
|
+
isTypedArray: Mn,
|
|
1216
|
+
isFileList: Tn,
|
|
1217
|
+
forEach: je,
|
|
1218
|
+
merge: pt,
|
|
1219
|
+
extend: Ln,
|
|
1220
|
+
trim: kn,
|
|
1221
|
+
stripBOM: Fn,
|
|
1222
|
+
inherits: jn,
|
|
1223
|
+
toFlatObject: Dn,
|
|
1224
|
+
kindOf: Xe,
|
|
1225
|
+
kindOfTest: oe,
|
|
1226
|
+
endsWith: Nn,
|
|
1227
|
+
toArray: Un,
|
|
1228
|
+
forEachEntry: In,
|
|
1229
|
+
matchAll: Bn,
|
|
1230
|
+
isHTMLForm: $n,
|
|
1231
|
+
hasOwnProperty: Bt,
|
|
1232
|
+
hasOwnProp: Bt,
|
|
1233
|
+
// an alias to avoid ESLint no-prototype-builtins detection
|
|
1234
|
+
reduceDescriptors: dr,
|
|
1235
|
+
freezeMethods: Hn,
|
|
1236
|
+
toObjectSet: Vn,
|
|
1237
|
+
toCamelCase: qn,
|
|
1238
|
+
noop: Wn,
|
|
1239
|
+
toFiniteNumber: zn,
|
|
1240
|
+
findKey: ur,
|
|
1241
|
+
global: ge,
|
|
1242
|
+
isContextDefined: fr,
|
|
1243
|
+
isSpecCompliantForm: Jn,
|
|
1244
|
+
toJSONObject: Yn,
|
|
1245
|
+
isAsyncFn: Gn,
|
|
1246
|
+
isThenable: Xn,
|
|
1247
|
+
setImmediate: hr,
|
|
1248
|
+
asap: Qn,
|
|
1249
|
+
isIterable: Zn
|
|
1250
|
+
};
|
|
1251
|
+
function _(t, e, r, n, s) {
|
|
1252
|
+
Error.call(this), Error.captureStackTrace ? Error.captureStackTrace(this, this.constructor) : this.stack = new Error().stack, this.message = t, this.name = "AxiosError", e && (this.code = e), r && (this.config = r), n && (this.request = n), s && (this.response = s, this.status = s.status ? s.status : null);
|
|
1253
|
+
}
|
|
1254
|
+
c.inherits(_, Error, {
|
|
1255
|
+
toJSON: function() {
|
|
1256
|
+
return {
|
|
1257
|
+
// Standard
|
|
1258
|
+
message: this.message,
|
|
1259
|
+
name: this.name,
|
|
1260
|
+
// Microsoft
|
|
1261
|
+
description: this.description,
|
|
1262
|
+
number: this.number,
|
|
1263
|
+
// Mozilla
|
|
1264
|
+
fileName: this.fileName,
|
|
1265
|
+
lineNumber: this.lineNumber,
|
|
1266
|
+
columnNumber: this.columnNumber,
|
|
1267
|
+
stack: this.stack,
|
|
1268
|
+
// Axios
|
|
1269
|
+
config: c.toJSONObject(this.config),
|
|
1270
|
+
code: this.code,
|
|
1271
|
+
status: this.status
|
|
1272
|
+
};
|
|
1273
|
+
}
|
|
1274
|
+
});
|
|
1275
|
+
const pr = _.prototype, gr = {};
|
|
1276
|
+
[
|
|
1277
|
+
"ERR_BAD_OPTION_VALUE",
|
|
1278
|
+
"ERR_BAD_OPTION",
|
|
1279
|
+
"ECONNABORTED",
|
|
1280
|
+
"ETIMEDOUT",
|
|
1281
|
+
"ERR_NETWORK",
|
|
1282
|
+
"ERR_FR_TOO_MANY_REDIRECTS",
|
|
1283
|
+
"ERR_DEPRECATED",
|
|
1284
|
+
"ERR_BAD_RESPONSE",
|
|
1285
|
+
"ERR_BAD_REQUEST",
|
|
1286
|
+
"ERR_CANCELED",
|
|
1287
|
+
"ERR_NOT_SUPPORT",
|
|
1288
|
+
"ERR_INVALID_URL"
|
|
1289
|
+
// eslint-disable-next-line func-names
|
|
1290
|
+
].forEach((t) => {
|
|
1291
|
+
gr[t] = { value: t };
|
|
1292
|
+
});
|
|
1293
|
+
Object.defineProperties(_, gr);
|
|
1294
|
+
Object.defineProperty(pr, "isAxiosError", { value: !0 });
|
|
1295
|
+
_.from = (t, e, r, n, s, i) => {
|
|
1296
|
+
const a = Object.create(pr);
|
|
1297
|
+
c.toFlatObject(t, a, function(u) {
|
|
1298
|
+
return u !== Error.prototype;
|
|
1299
|
+
}, (f) => f !== "isAxiosError");
|
|
1300
|
+
const l = t && t.message ? t.message : "Error", g = e == null && t ? t.code : e;
|
|
1301
|
+
return _.call(a, l, g, r, n, s), t && a.cause == null && Object.defineProperty(a, "cause", { value: t, configurable: !0 }), a.name = t && t.name || "Error", i && Object.assign(a, i), a;
|
|
1302
|
+
};
|
|
1303
|
+
const es = null;
|
|
1304
|
+
function gt(t) {
|
|
1305
|
+
return c.isPlainObject(t) || c.isArray(t);
|
|
1306
|
+
}
|
|
1307
|
+
function mr(t) {
|
|
1308
|
+
return c.endsWith(t, "[]") ? t.slice(0, -2) : t;
|
|
1309
|
+
}
|
|
1310
|
+
function $t(t, e, r) {
|
|
1311
|
+
return t ? t.concat(e).map(function(s, i) {
|
|
1312
|
+
return s = mr(s), !r && i ? "[" + s + "]" : s;
|
|
1313
|
+
}).join(r ? "." : "") : e;
|
|
1314
|
+
}
|
|
1315
|
+
function ts(t) {
|
|
1316
|
+
return c.isArray(t) && !t.some(gt);
|
|
1317
|
+
}
|
|
1318
|
+
const rs = c.toFlatObject(c, {}, null, function(e) {
|
|
1319
|
+
return /^is[A-Z]/.test(e);
|
|
1320
|
+
});
|
|
1321
|
+
function Ze(t, e, r) {
|
|
1322
|
+
if (!c.isObject(t))
|
|
1323
|
+
throw new TypeError("target must be an object");
|
|
1324
|
+
e = e || new FormData(), r = c.toFlatObject(r, {
|
|
1325
|
+
metaTokens: !0,
|
|
1326
|
+
dots: !1,
|
|
1327
|
+
indexes: !1
|
|
1328
|
+
}, !1, function(E, b) {
|
|
1329
|
+
return !c.isUndefined(b[E]);
|
|
1330
|
+
});
|
|
1331
|
+
const n = r.metaTokens, s = r.visitor || u, i = r.dots, a = r.indexes, g = (r.Blob || typeof Blob < "u" && Blob) && c.isSpecCompliantForm(e);
|
|
1332
|
+
if (!c.isFunction(s))
|
|
1333
|
+
throw new TypeError("visitor must be a function");
|
|
1334
|
+
function f(d) {
|
|
1335
|
+
if (d === null) return "";
|
|
1336
|
+
if (c.isDate(d))
|
|
1337
|
+
return d.toISOString();
|
|
1338
|
+
if (c.isBoolean(d))
|
|
1339
|
+
return d.toString();
|
|
1340
|
+
if (!g && c.isBlob(d))
|
|
1341
|
+
throw new _("Blob is not supported. Use a Buffer instead.");
|
|
1342
|
+
return c.isArrayBuffer(d) || c.isTypedArray(d) ? g && typeof Blob == "function" ? new Blob([d]) : Buffer.from(d) : d;
|
|
1343
|
+
}
|
|
1344
|
+
function u(d, E, b) {
|
|
1345
|
+
let P = d;
|
|
1346
|
+
if (d && !b && typeof d == "object") {
|
|
1347
|
+
if (c.endsWith(E, "{}"))
|
|
1348
|
+
E = n ? E : E.slice(0, -2), d = JSON.stringify(d);
|
|
1349
|
+
else if (c.isArray(d) && ts(d) || (c.isFileList(d) || c.endsWith(E, "[]")) && (P = c.toArray(d)))
|
|
1350
|
+
return E = mr(E), P.forEach(function(L, j) {
|
|
1351
|
+
!(c.isUndefined(L) || L === null) && e.append(
|
|
1352
|
+
// eslint-disable-next-line no-nested-ternary
|
|
1353
|
+
a === !0 ? $t([E], j, i) : a === null ? E : E + "[]",
|
|
1354
|
+
f(L)
|
|
1355
|
+
);
|
|
1356
|
+
}), !1;
|
|
1357
|
+
}
|
|
1358
|
+
return gt(d) ? !0 : (e.append($t(b, E, i), f(d)), !1);
|
|
1359
|
+
}
|
|
1360
|
+
const h = [], x = Object.assign(rs, {
|
|
1361
|
+
defaultVisitor: u,
|
|
1362
|
+
convertValue: f,
|
|
1363
|
+
isVisitable: gt
|
|
1364
|
+
});
|
|
1365
|
+
function F(d, E) {
|
|
1366
|
+
if (!c.isUndefined(d)) {
|
|
1367
|
+
if (h.indexOf(d) !== -1)
|
|
1368
|
+
throw Error("Circular reference detected in " + E.join("."));
|
|
1369
|
+
h.push(d), c.forEach(d, function(P, A) {
|
|
1370
|
+
(!(c.isUndefined(P) || P === null) && s.call(
|
|
1371
|
+
e,
|
|
1372
|
+
P,
|
|
1373
|
+
c.isString(A) ? A.trim() : A,
|
|
1374
|
+
E,
|
|
1375
|
+
x
|
|
1376
|
+
)) === !0 && F(P, E ? E.concat(A) : [A]);
|
|
1377
|
+
}), h.pop();
|
|
1378
|
+
}
|
|
1379
|
+
}
|
|
1380
|
+
if (!c.isObject(t))
|
|
1381
|
+
throw new TypeError("data must be an object");
|
|
1382
|
+
return F(t), e;
|
|
1383
|
+
}
|
|
1384
|
+
function qt(t) {
|
|
1385
|
+
const e = {
|
|
1386
|
+
"!": "%21",
|
|
1387
|
+
"'": "%27",
|
|
1388
|
+
"(": "%28",
|
|
1389
|
+
")": "%29",
|
|
1390
|
+
"~": "%7E",
|
|
1391
|
+
"%20": "+",
|
|
1392
|
+
"%00": "\0"
|
|
1393
|
+
};
|
|
1394
|
+
return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g, function(n) {
|
|
1395
|
+
return e[n];
|
|
1396
|
+
});
|
|
1397
|
+
}
|
|
1398
|
+
function Et(t, e) {
|
|
1399
|
+
this._pairs = [], t && Ze(t, this, e);
|
|
1400
|
+
}
|
|
1401
|
+
const yr = Et.prototype;
|
|
1402
|
+
yr.append = function(e, r) {
|
|
1403
|
+
this._pairs.push([e, r]);
|
|
1404
|
+
};
|
|
1405
|
+
yr.toString = function(e) {
|
|
1406
|
+
const r = e ? function(n) {
|
|
1407
|
+
return e.call(this, n, qt);
|
|
1408
|
+
} : qt;
|
|
1409
|
+
return this._pairs.map(function(s) {
|
|
1410
|
+
return r(s[0]) + "=" + r(s[1]);
|
|
1411
|
+
}, "").join("&");
|
|
1412
|
+
};
|
|
1413
|
+
function ns(t) {
|
|
1414
|
+
return encodeURIComponent(t).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+");
|
|
1415
|
+
}
|
|
1416
|
+
function br(t, e, r) {
|
|
1417
|
+
if (!e)
|
|
1418
|
+
return t;
|
|
1419
|
+
const n = r && r.encode || ns;
|
|
1420
|
+
c.isFunction(r) && (r = {
|
|
1421
|
+
serialize: r
|
|
1422
|
+
});
|
|
1423
|
+
const s = r && r.serialize;
|
|
1424
|
+
let i;
|
|
1425
|
+
if (s ? i = s(e, r) : i = c.isURLSearchParams(e) ? e.toString() : new Et(e, r).toString(n), i) {
|
|
1426
|
+
const a = t.indexOf("#");
|
|
1427
|
+
a !== -1 && (t = t.slice(0, a)), t += (t.indexOf("?") === -1 ? "?" : "&") + i;
|
|
1428
|
+
}
|
|
1429
|
+
return t;
|
|
1430
|
+
}
|
|
1431
|
+
class Kt {
|
|
1432
|
+
constructor() {
|
|
1433
|
+
this.handlers = [];
|
|
1434
|
+
}
|
|
1435
|
+
/**
|
|
1436
|
+
* Add a new interceptor to the stack
|
|
1437
|
+
*
|
|
1438
|
+
* @param {Function} fulfilled The function to handle `then` for a `Promise`
|
|
1439
|
+
* @param {Function} rejected The function to handle `reject` for a `Promise`
|
|
1440
|
+
*
|
|
1441
|
+
* @return {Number} An ID used to remove interceptor later
|
|
1442
|
+
*/
|
|
1443
|
+
use(e, r, n) {
|
|
1444
|
+
return this.handlers.push({
|
|
1445
|
+
fulfilled: e,
|
|
1446
|
+
rejected: r,
|
|
1447
|
+
synchronous: n ? n.synchronous : !1,
|
|
1448
|
+
runWhen: n ? n.runWhen : null
|
|
1449
|
+
}), this.handlers.length - 1;
|
|
1450
|
+
}
|
|
1451
|
+
/**
|
|
1452
|
+
* Remove an interceptor from the stack
|
|
1453
|
+
*
|
|
1454
|
+
* @param {Number} id The ID that was returned by `use`
|
|
1455
|
+
*
|
|
1456
|
+
* @returns {void}
|
|
1457
|
+
*/
|
|
1458
|
+
eject(e) {
|
|
1459
|
+
this.handlers[e] && (this.handlers[e] = null);
|
|
1460
|
+
}
|
|
1461
|
+
/**
|
|
1462
|
+
* Clear all interceptors from the stack
|
|
1463
|
+
*
|
|
1464
|
+
* @returns {void}
|
|
1465
|
+
*/
|
|
1466
|
+
clear() {
|
|
1467
|
+
this.handlers && (this.handlers = []);
|
|
1468
|
+
}
|
|
1469
|
+
/**
|
|
1470
|
+
* Iterate over all the registered interceptors
|
|
1471
|
+
*
|
|
1472
|
+
* This method is particularly useful for skipping over any
|
|
1473
|
+
* interceptors that may have become `null` calling `eject`.
|
|
1474
|
+
*
|
|
1475
|
+
* @param {Function} fn The function to call for each interceptor
|
|
1476
|
+
*
|
|
1477
|
+
* @returns {void}
|
|
1478
|
+
*/
|
|
1479
|
+
forEach(e) {
|
|
1480
|
+
c.forEach(this.handlers, function(n) {
|
|
1481
|
+
n !== null && e(n);
|
|
1482
|
+
});
|
|
1483
|
+
}
|
|
1484
|
+
}
|
|
1485
|
+
const Er = {
|
|
1486
|
+
silentJSONParsing: !0,
|
|
1487
|
+
forcedJSONParsing: !0,
|
|
1488
|
+
clarifyTimeoutError: !1
|
|
1489
|
+
}, ss = typeof URLSearchParams < "u" ? URLSearchParams : Et, os = typeof FormData < "u" ? FormData : null, as = typeof Blob < "u" ? Blob : null, is = {
|
|
1490
|
+
isBrowser: !0,
|
|
1491
|
+
classes: {
|
|
1492
|
+
URLSearchParams: ss,
|
|
1493
|
+
FormData: os,
|
|
1494
|
+
Blob: as
|
|
1495
|
+
},
|
|
1496
|
+
protocols: ["http", "https", "file", "blob", "url", "data"]
|
|
1497
|
+
}, wt = typeof window < "u" && typeof document < "u", mt = typeof navigator == "object" && navigator || void 0, ls = wt && (!mt || ["ReactNative", "NativeScript", "NS"].indexOf(mt.product) < 0), cs = typeof WorkerGlobalScope < "u" && // eslint-disable-next-line no-undef
|
|
1498
|
+
self instanceof WorkerGlobalScope && typeof self.importScripts == "function", us = wt && window.location.href || "http://localhost", fs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1499
|
+
__proto__: null,
|
|
1500
|
+
hasBrowserEnv: wt,
|
|
1501
|
+
hasStandardBrowserEnv: ls,
|
|
1502
|
+
hasStandardBrowserWebWorkerEnv: cs,
|
|
1503
|
+
navigator: mt,
|
|
1504
|
+
origin: us
|
|
1505
|
+
}, Symbol.toStringTag, { value: "Module" })), H = {
|
|
1506
|
+
...fs,
|
|
1507
|
+
...is
|
|
1508
|
+
};
|
|
1509
|
+
function ds(t, e) {
|
|
1510
|
+
return Ze(t, new H.classes.URLSearchParams(), {
|
|
1511
|
+
visitor: function(r, n, s, i) {
|
|
1512
|
+
return H.isNode && c.isBuffer(r) ? (this.append(n, r.toString("base64")), !1) : i.defaultVisitor.apply(this, arguments);
|
|
1513
|
+
},
|
|
1514
|
+
...e
|
|
1515
|
+
});
|
|
1516
|
+
}
|
|
1517
|
+
function hs(t) {
|
|
1518
|
+
return c.matchAll(/\w+|\[(\w*)]/g, t).map((e) => e[0] === "[]" ? "" : e[1] || e[0]);
|
|
1519
|
+
}
|
|
1520
|
+
function ps(t) {
|
|
1521
|
+
const e = {}, r = Object.keys(t);
|
|
1522
|
+
let n;
|
|
1523
|
+
const s = r.length;
|
|
1524
|
+
let i;
|
|
1525
|
+
for (n = 0; n < s; n++)
|
|
1526
|
+
i = r[n], e[i] = t[i];
|
|
1527
|
+
return e;
|
|
1528
|
+
}
|
|
1529
|
+
function wr(t) {
|
|
1530
|
+
function e(r, n, s, i) {
|
|
1531
|
+
let a = r[i++];
|
|
1532
|
+
if (a === "__proto__") return !0;
|
|
1533
|
+
const l = Number.isFinite(+a), g = i >= r.length;
|
|
1534
|
+
return a = !a && c.isArray(s) ? s.length : a, g ? (c.hasOwnProp(s, a) ? s[a] = [s[a], n] : s[a] = n, !l) : ((!s[a] || !c.isObject(s[a])) && (s[a] = []), e(r, n, s[a], i) && c.isArray(s[a]) && (s[a] = ps(s[a])), !l);
|
|
1535
|
+
}
|
|
1536
|
+
if (c.isFormData(t) && c.isFunction(t.entries)) {
|
|
1537
|
+
const r = {};
|
|
1538
|
+
return c.forEachEntry(t, (n, s) => {
|
|
1539
|
+
e(hs(n), s, r, 0);
|
|
1540
|
+
}), r;
|
|
1541
|
+
}
|
|
1542
|
+
return null;
|
|
1543
|
+
}
|
|
1544
|
+
function gs(t, e, r) {
|
|
1545
|
+
if (c.isString(t))
|
|
1546
|
+
try {
|
|
1547
|
+
return (e || JSON.parse)(t), c.trim(t);
|
|
1548
|
+
} catch (n) {
|
|
1549
|
+
if (n.name !== "SyntaxError")
|
|
1550
|
+
throw n;
|
|
1551
|
+
}
|
|
1552
|
+
return (0, JSON.stringify)(t);
|
|
1553
|
+
}
|
|
1554
|
+
const De = {
|
|
1555
|
+
transitional: Er,
|
|
1556
|
+
adapter: ["xhr", "http", "fetch"],
|
|
1557
|
+
transformRequest: [function(e, r) {
|
|
1558
|
+
const n = r.getContentType() || "", s = n.indexOf("application/json") > -1, i = c.isObject(e);
|
|
1559
|
+
if (i && c.isHTMLForm(e) && (e = new FormData(e)), c.isFormData(e))
|
|
1560
|
+
return s ? JSON.stringify(wr(e)) : e;
|
|
1561
|
+
if (c.isArrayBuffer(e) || c.isBuffer(e) || c.isStream(e) || c.isFile(e) || c.isBlob(e) || c.isReadableStream(e))
|
|
1562
|
+
return e;
|
|
1563
|
+
if (c.isArrayBufferView(e))
|
|
1564
|
+
return e.buffer;
|
|
1565
|
+
if (c.isURLSearchParams(e))
|
|
1566
|
+
return r.setContentType("application/x-www-form-urlencoded;charset=utf-8", !1), e.toString();
|
|
1567
|
+
let l;
|
|
1568
|
+
if (i) {
|
|
1569
|
+
if (n.indexOf("application/x-www-form-urlencoded") > -1)
|
|
1570
|
+
return ds(e, this.formSerializer).toString();
|
|
1571
|
+
if ((l = c.isFileList(e)) || n.indexOf("multipart/form-data") > -1) {
|
|
1572
|
+
const g = this.env && this.env.FormData;
|
|
1573
|
+
return Ze(
|
|
1574
|
+
l ? { "files[]": e } : e,
|
|
1575
|
+
g && new g(),
|
|
1576
|
+
this.formSerializer
|
|
1577
|
+
);
|
|
1578
|
+
}
|
|
1579
|
+
}
|
|
1580
|
+
return i || s ? (r.setContentType("application/json", !1), gs(e)) : e;
|
|
1581
|
+
}],
|
|
1582
|
+
transformResponse: [function(e) {
|
|
1583
|
+
const r = this.transitional || De.transitional, n = r && r.forcedJSONParsing, s = this.responseType === "json";
|
|
1584
|
+
if (c.isResponse(e) || c.isReadableStream(e))
|
|
1585
|
+
return e;
|
|
1586
|
+
if (e && c.isString(e) && (n && !this.responseType || s)) {
|
|
1587
|
+
const a = !(r && r.silentJSONParsing) && s;
|
|
1588
|
+
try {
|
|
1589
|
+
return JSON.parse(e, this.parseReviver);
|
|
1590
|
+
} catch (l) {
|
|
1591
|
+
if (a)
|
|
1592
|
+
throw l.name === "SyntaxError" ? _.from(l, _.ERR_BAD_RESPONSE, this, null, this.response) : l;
|
|
1593
|
+
}
|
|
1594
|
+
}
|
|
1595
|
+
return e;
|
|
1596
|
+
}],
|
|
1597
|
+
/**
|
|
1598
|
+
* A timeout in milliseconds to abort a request. If set to 0 (default) a
|
|
1599
|
+
* timeout is not created.
|
|
1600
|
+
*/
|
|
1601
|
+
timeout: 0,
|
|
1602
|
+
xsrfCookieName: "XSRF-TOKEN",
|
|
1603
|
+
xsrfHeaderName: "X-XSRF-TOKEN",
|
|
1604
|
+
maxContentLength: -1,
|
|
1605
|
+
maxBodyLength: -1,
|
|
1606
|
+
env: {
|
|
1607
|
+
FormData: H.classes.FormData,
|
|
1608
|
+
Blob: H.classes.Blob
|
|
1609
|
+
},
|
|
1610
|
+
validateStatus: function(e) {
|
|
1611
|
+
return e >= 200 && e < 300;
|
|
1612
|
+
},
|
|
1613
|
+
headers: {
|
|
1614
|
+
common: {
|
|
1615
|
+
Accept: "application/json, text/plain, */*",
|
|
1616
|
+
"Content-Type": void 0
|
|
1617
|
+
}
|
|
1618
|
+
}
|
|
1619
|
+
};
|
|
1620
|
+
c.forEach(["delete", "get", "head", "post", "put", "patch"], (t) => {
|
|
1621
|
+
De.headers[t] = {};
|
|
1622
|
+
});
|
|
1623
|
+
const ms = c.toObjectSet([
|
|
1624
|
+
"age",
|
|
1625
|
+
"authorization",
|
|
1626
|
+
"content-length",
|
|
1627
|
+
"content-type",
|
|
1628
|
+
"etag",
|
|
1629
|
+
"expires",
|
|
1630
|
+
"from",
|
|
1631
|
+
"host",
|
|
1632
|
+
"if-modified-since",
|
|
1633
|
+
"if-unmodified-since",
|
|
1634
|
+
"last-modified",
|
|
1635
|
+
"location",
|
|
1636
|
+
"max-forwards",
|
|
1637
|
+
"proxy-authorization",
|
|
1638
|
+
"referer",
|
|
1639
|
+
"retry-after",
|
|
1640
|
+
"user-agent"
|
|
1641
|
+
]), ys = (t) => {
|
|
1642
|
+
const e = {};
|
|
1643
|
+
let r, n, s;
|
|
1644
|
+
return t && t.split(`
|
|
1645
|
+
`).forEach(function(a) {
|
|
1646
|
+
s = a.indexOf(":"), r = a.substring(0, s).trim().toLowerCase(), n = a.substring(s + 1).trim(), !(!r || e[r] && ms[r]) && (r === "set-cookie" ? e[r] ? e[r].push(n) : e[r] = [n] : e[r] = e[r] ? e[r] + ", " + n : n);
|
|
1647
|
+
}), e;
|
|
1648
|
+
}, Ht = Symbol("internals");
|
|
1649
|
+
function Pe(t) {
|
|
1650
|
+
return t && String(t).trim().toLowerCase();
|
|
1651
|
+
}
|
|
1652
|
+
function ze(t) {
|
|
1653
|
+
return t === !1 || t == null ? t : c.isArray(t) ? t.map(ze) : String(t);
|
|
1654
|
+
}
|
|
1655
|
+
function bs(t) {
|
|
1656
|
+
const e = /* @__PURE__ */ Object.create(null), r = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
|
|
1657
|
+
let n;
|
|
1658
|
+
for (; n = r.exec(t); )
|
|
1659
|
+
e[n[1]] = n[2];
|
|
1660
|
+
return e;
|
|
1661
|
+
}
|
|
1662
|
+
const Es = (t) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());
|
|
1663
|
+
function ut(t, e, r, n, s) {
|
|
1664
|
+
if (c.isFunction(n))
|
|
1665
|
+
return n.call(this, e, r);
|
|
1666
|
+
if (s && (e = r), !!c.isString(e)) {
|
|
1667
|
+
if (c.isString(n))
|
|
1668
|
+
return e.indexOf(n) !== -1;
|
|
1669
|
+
if (c.isRegExp(n))
|
|
1670
|
+
return n.test(e);
|
|
1671
|
+
}
|
|
1672
|
+
}
|
|
1673
|
+
function ws(t) {
|
|
1674
|
+
return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (e, r, n) => r.toUpperCase() + n);
|
|
1675
|
+
}
|
|
1676
|
+
function vs(t, e) {
|
|
1677
|
+
const r = c.toCamelCase(" " + e);
|
|
1678
|
+
["get", "set", "has"].forEach((n) => {
|
|
1679
|
+
Object.defineProperty(t, n + r, {
|
|
1680
|
+
value: function(s, i, a) {
|
|
1681
|
+
return this[n].call(this, e, s, i, a);
|
|
1682
|
+
},
|
|
1683
|
+
configurable: !0
|
|
1684
|
+
});
|
|
1685
|
+
});
|
|
1686
|
+
}
|
|
1687
|
+
class X {
|
|
1688
|
+
constructor(e) {
|
|
1689
|
+
e && this.set(e);
|
|
1690
|
+
}
|
|
1691
|
+
set(e, r, n) {
|
|
1692
|
+
const s = this;
|
|
1693
|
+
function i(l, g, f) {
|
|
1694
|
+
const u = Pe(g);
|
|
1695
|
+
if (!u)
|
|
1696
|
+
throw new Error("header name must be a non-empty string");
|
|
1697
|
+
const h = c.findKey(s, u);
|
|
1698
|
+
(!h || s[h] === void 0 || f === !0 || f === void 0 && s[h] !== !1) && (s[h || g] = ze(l));
|
|
1699
|
+
}
|
|
1700
|
+
const a = (l, g) => c.forEach(l, (f, u) => i(f, u, g));
|
|
1701
|
+
if (c.isPlainObject(e) || e instanceof this.constructor)
|
|
1702
|
+
a(e, r);
|
|
1703
|
+
else if (c.isString(e) && (e = e.trim()) && !Es(e))
|
|
1704
|
+
a(ys(e), r);
|
|
1705
|
+
else if (c.isObject(e) && c.isIterable(e)) {
|
|
1706
|
+
let l = {}, g, f;
|
|
1707
|
+
for (const u of e) {
|
|
1708
|
+
if (!c.isArray(u))
|
|
1709
|
+
throw TypeError("Object iterator must return a key-value pair");
|
|
1710
|
+
l[f = u[0]] = (g = l[f]) ? c.isArray(g) ? [...g, u[1]] : [g, u[1]] : u[1];
|
|
1711
|
+
}
|
|
1712
|
+
a(l, r);
|
|
1713
|
+
} else
|
|
1714
|
+
e != null && i(r, e, n);
|
|
1715
|
+
return this;
|
|
1716
|
+
}
|
|
1717
|
+
get(e, r) {
|
|
1718
|
+
if (e = Pe(e), e) {
|
|
1719
|
+
const n = c.findKey(this, e);
|
|
1720
|
+
if (n) {
|
|
1721
|
+
const s = this[n];
|
|
1722
|
+
if (!r)
|
|
1723
|
+
return s;
|
|
1724
|
+
if (r === !0)
|
|
1725
|
+
return bs(s);
|
|
1726
|
+
if (c.isFunction(r))
|
|
1727
|
+
return r.call(this, s, n);
|
|
1728
|
+
if (c.isRegExp(r))
|
|
1729
|
+
return r.exec(s);
|
|
1730
|
+
throw new TypeError("parser must be boolean|regexp|function");
|
|
1731
|
+
}
|
|
1732
|
+
}
|
|
1733
|
+
}
|
|
1734
|
+
has(e, r) {
|
|
1735
|
+
if (e = Pe(e), e) {
|
|
1736
|
+
const n = c.findKey(this, e);
|
|
1737
|
+
return !!(n && this[n] !== void 0 && (!r || ut(this, this[n], n, r)));
|
|
1738
|
+
}
|
|
1739
|
+
return !1;
|
|
1740
|
+
}
|
|
1741
|
+
delete(e, r) {
|
|
1742
|
+
const n = this;
|
|
1743
|
+
let s = !1;
|
|
1744
|
+
function i(a) {
|
|
1745
|
+
if (a = Pe(a), a) {
|
|
1746
|
+
const l = c.findKey(n, a);
|
|
1747
|
+
l && (!r || ut(n, n[l], l, r)) && (delete n[l], s = !0);
|
|
1748
|
+
}
|
|
1749
|
+
}
|
|
1750
|
+
return c.isArray(e) ? e.forEach(i) : i(e), s;
|
|
1751
|
+
}
|
|
1752
|
+
clear(e) {
|
|
1753
|
+
const r = Object.keys(this);
|
|
1754
|
+
let n = r.length, s = !1;
|
|
1755
|
+
for (; n--; ) {
|
|
1756
|
+
const i = r[n];
|
|
1757
|
+
(!e || ut(this, this[i], i, e, !0)) && (delete this[i], s = !0);
|
|
1758
|
+
}
|
|
1759
|
+
return s;
|
|
1760
|
+
}
|
|
1761
|
+
normalize(e) {
|
|
1762
|
+
const r = this, n = {};
|
|
1763
|
+
return c.forEach(this, (s, i) => {
|
|
1764
|
+
const a = c.findKey(n, i);
|
|
1765
|
+
if (a) {
|
|
1766
|
+
r[a] = ze(s), delete r[i];
|
|
1767
|
+
return;
|
|
1768
|
+
}
|
|
1769
|
+
const l = e ? ws(i) : String(i).trim();
|
|
1770
|
+
l !== i && delete r[i], r[l] = ze(s), n[l] = !0;
|
|
1771
|
+
}), this;
|
|
1772
|
+
}
|
|
1773
|
+
concat(...e) {
|
|
1774
|
+
return this.constructor.concat(this, ...e);
|
|
1775
|
+
}
|
|
1776
|
+
toJSON(e) {
|
|
1777
|
+
const r = /* @__PURE__ */ Object.create(null);
|
|
1778
|
+
return c.forEach(this, (n, s) => {
|
|
1779
|
+
n != null && n !== !1 && (r[s] = e && c.isArray(n) ? n.join(", ") : n);
|
|
1780
|
+
}), r;
|
|
1781
|
+
}
|
|
1782
|
+
[Symbol.iterator]() {
|
|
1783
|
+
return Object.entries(this.toJSON())[Symbol.iterator]();
|
|
1784
|
+
}
|
|
1785
|
+
toString() {
|
|
1786
|
+
return Object.entries(this.toJSON()).map(([e, r]) => e + ": " + r).join(`
|
|
1787
|
+
`);
|
|
1788
|
+
}
|
|
1789
|
+
getSetCookie() {
|
|
1790
|
+
return this.get("set-cookie") || [];
|
|
1791
|
+
}
|
|
1792
|
+
get [Symbol.toStringTag]() {
|
|
1793
|
+
return "AxiosHeaders";
|
|
1794
|
+
}
|
|
1795
|
+
static from(e) {
|
|
1796
|
+
return e instanceof this ? e : new this(e);
|
|
1797
|
+
}
|
|
1798
|
+
static concat(e, ...r) {
|
|
1799
|
+
const n = new this(e);
|
|
1800
|
+
return r.forEach((s) => n.set(s)), n;
|
|
1801
|
+
}
|
|
1802
|
+
static accessor(e) {
|
|
1803
|
+
const n = (this[Ht] = this[Ht] = {
|
|
1804
|
+
accessors: {}
|
|
1805
|
+
}).accessors, s = this.prototype;
|
|
1806
|
+
function i(a) {
|
|
1807
|
+
const l = Pe(a);
|
|
1808
|
+
n[l] || (vs(s, a), n[l] = !0);
|
|
1809
|
+
}
|
|
1810
|
+
return c.isArray(e) ? e.forEach(i) : i(e), this;
|
|
1811
|
+
}
|
|
1812
|
+
}
|
|
1813
|
+
X.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]);
|
|
1814
|
+
c.reduceDescriptors(X.prototype, ({ value: t }, e) => {
|
|
1815
|
+
let r = e[0].toUpperCase() + e.slice(1);
|
|
1816
|
+
return {
|
|
1817
|
+
get: () => t,
|
|
1818
|
+
set(n) {
|
|
1819
|
+
this[r] = n;
|
|
1820
|
+
}
|
|
1821
|
+
};
|
|
1822
|
+
});
|
|
1823
|
+
c.freezeMethods(X);
|
|
1824
|
+
function ft(t, e) {
|
|
1825
|
+
const r = this || De, n = e || r, s = X.from(n.headers);
|
|
1826
|
+
let i = n.data;
|
|
1827
|
+
return c.forEach(t, function(l) {
|
|
1828
|
+
i = l.call(r, i, s.normalize(), e ? e.status : void 0);
|
|
1829
|
+
}), s.normalize(), i;
|
|
1830
|
+
}
|
|
1831
|
+
function vr(t) {
|
|
1832
|
+
return !!(t && t.__CANCEL__);
|
|
1833
|
+
}
|
|
1834
|
+
function _e(t, e, r) {
|
|
1835
|
+
_.call(this, t ?? "canceled", _.ERR_CANCELED, e, r), this.name = "CanceledError";
|
|
1836
|
+
}
|
|
1837
|
+
c.inherits(_e, _, {
|
|
1838
|
+
__CANCEL__: !0
|
|
1839
|
+
});
|
|
1840
|
+
function Rr(t, e, r) {
|
|
1841
|
+
const n = r.config.validateStatus;
|
|
1842
|
+
!r.status || !n || n(r.status) ? t(r) : e(new _(
|
|
1843
|
+
"Request failed with status code " + r.status,
|
|
1844
|
+
[_.ERR_BAD_REQUEST, _.ERR_BAD_RESPONSE][Math.floor(r.status / 100) - 4],
|
|
1845
|
+
r.config,
|
|
1846
|
+
r.request,
|
|
1847
|
+
r
|
|
1848
|
+
));
|
|
1849
|
+
}
|
|
1850
|
+
function Rs(t) {
|
|
1851
|
+
const e = /^([-+\w]{1,25})(:?\/\/|:)/.exec(t);
|
|
1852
|
+
return e && e[1] || "";
|
|
1853
|
+
}
|
|
1854
|
+
function Ts(t, e) {
|
|
1855
|
+
t = t || 10;
|
|
1856
|
+
const r = new Array(t), n = new Array(t);
|
|
1857
|
+
let s = 0, i = 0, a;
|
|
1858
|
+
return e = e !== void 0 ? e : 1e3, function(g) {
|
|
1859
|
+
const f = Date.now(), u = n[i];
|
|
1860
|
+
a || (a = f), r[s] = g, n[s] = f;
|
|
1861
|
+
let h = i, x = 0;
|
|
1862
|
+
for (; h !== s; )
|
|
1863
|
+
x += r[h++], h = h % t;
|
|
1864
|
+
if (s = (s + 1) % t, s === i && (i = (i + 1) % t), f - a < e)
|
|
1865
|
+
return;
|
|
1866
|
+
const F = u && f - u;
|
|
1867
|
+
return F ? Math.round(x * 1e3 / F) : void 0;
|
|
1868
|
+
};
|
|
1869
|
+
}
|
|
1870
|
+
function _s(t, e) {
|
|
1871
|
+
let r = 0, n = 1e3 / e, s, i;
|
|
1872
|
+
const a = (f, u = Date.now()) => {
|
|
1873
|
+
r = u, s = null, i && (clearTimeout(i), i = null), t(...f);
|
|
1874
|
+
};
|
|
1875
|
+
return [(...f) => {
|
|
1876
|
+
const u = Date.now(), h = u - r;
|
|
1877
|
+
h >= n ? a(f, u) : (s = f, i || (i = setTimeout(() => {
|
|
1878
|
+
i = null, a(s);
|
|
1879
|
+
}, n - h)));
|
|
1880
|
+
}, () => s && a(s)];
|
|
1881
|
+
}
|
|
1882
|
+
const Ye = (t, e, r = 3) => {
|
|
1883
|
+
let n = 0;
|
|
1884
|
+
const s = Ts(50, 250);
|
|
1885
|
+
return _s((i) => {
|
|
1886
|
+
const a = i.loaded, l = i.lengthComputable ? i.total : void 0, g = a - n, f = s(g), u = a <= l;
|
|
1887
|
+
n = a;
|
|
1888
|
+
const h = {
|
|
1889
|
+
loaded: a,
|
|
1890
|
+
total: l,
|
|
1891
|
+
progress: l ? a / l : void 0,
|
|
1892
|
+
bytes: g,
|
|
1893
|
+
rate: f || void 0,
|
|
1894
|
+
estimated: f && l && u ? (l - a) / f : void 0,
|
|
1895
|
+
event: i,
|
|
1896
|
+
lengthComputable: l != null,
|
|
1897
|
+
[e ? "download" : "upload"]: !0
|
|
1898
|
+
};
|
|
1899
|
+
t(h);
|
|
1900
|
+
}, r);
|
|
1901
|
+
}, Vt = (t, e) => {
|
|
1902
|
+
const r = t != null;
|
|
1903
|
+
return [(n) => e[0]({
|
|
1904
|
+
lengthComputable: r,
|
|
1905
|
+
total: t,
|
|
1906
|
+
loaded: n
|
|
1907
|
+
}), e[1]];
|
|
1908
|
+
}, Wt = (t) => (...e) => c.asap(() => t(...e)), xs = H.hasStandardBrowserEnv ? /* @__PURE__ */ ((t, e) => (r) => (r = new URL(r, H.origin), t.protocol === r.protocol && t.host === r.host && (e || t.port === r.port)))(
|
|
1909
|
+
new URL(H.origin),
|
|
1910
|
+
H.navigator && /(msie|trident)/i.test(H.navigator.userAgent)
|
|
1911
|
+
) : () => !0, Ss = H.hasStandardBrowserEnv ? (
|
|
1912
|
+
// Standard browser envs support document.cookie
|
|
1913
|
+
{
|
|
1914
|
+
write(t, e, r, n, s, i, a) {
|
|
1915
|
+
if (typeof document > "u") return;
|
|
1916
|
+
const l = [`${t}=${encodeURIComponent(e)}`];
|
|
1917
|
+
c.isNumber(r) && l.push(`expires=${new Date(r).toUTCString()}`), c.isString(n) && l.push(`path=${n}`), c.isString(s) && l.push(`domain=${s}`), i === !0 && l.push("secure"), c.isString(a) && l.push(`SameSite=${a}`), document.cookie = l.join("; ");
|
|
1918
|
+
},
|
|
1919
|
+
read(t) {
|
|
1920
|
+
if (typeof document > "u") return null;
|
|
1921
|
+
const e = document.cookie.match(new RegExp("(?:^|; )" + t + "=([^;]*)"));
|
|
1922
|
+
return e ? decodeURIComponent(e[1]) : null;
|
|
1923
|
+
},
|
|
1924
|
+
remove(t) {
|
|
1925
|
+
this.write(t, "", Date.now() - 864e5, "/");
|
|
1926
|
+
}
|
|
1927
|
+
}
|
|
1928
|
+
) : (
|
|
1929
|
+
// Non-standard browser env (web workers, react-native) lack needed support.
|
|
1930
|
+
{
|
|
1931
|
+
write() {
|
|
1932
|
+
},
|
|
1933
|
+
read() {
|
|
1934
|
+
return null;
|
|
1935
|
+
},
|
|
1936
|
+
remove() {
|
|
1937
|
+
}
|
|
1938
|
+
}
|
|
1939
|
+
);
|
|
1940
|
+
function Os(t) {
|
|
1941
|
+
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(t);
|
|
1942
|
+
}
|
|
1943
|
+
function As(t, e) {
|
|
1944
|
+
return e ? t.replace(/\/?\/$/, "") + "/" + e.replace(/^\/+/, "") : t;
|
|
1945
|
+
}
|
|
1946
|
+
function Tr(t, e, r) {
|
|
1947
|
+
let n = !Os(e);
|
|
1948
|
+
return t && (n || r == !1) ? As(t, e) : e;
|
|
1949
|
+
}
|
|
1950
|
+
const zt = (t) => t instanceof X ? { ...t } : t;
|
|
1951
|
+
function ye(t, e) {
|
|
1952
|
+
e = e || {};
|
|
1953
|
+
const r = {};
|
|
1954
|
+
function n(f, u, h, x) {
|
|
1955
|
+
return c.isPlainObject(f) && c.isPlainObject(u) ? c.merge.call({ caseless: x }, f, u) : c.isPlainObject(u) ? c.merge({}, u) : c.isArray(u) ? u.slice() : u;
|
|
1956
|
+
}
|
|
1957
|
+
function s(f, u, h, x) {
|
|
1958
|
+
if (c.isUndefined(u)) {
|
|
1959
|
+
if (!c.isUndefined(f))
|
|
1960
|
+
return n(void 0, f, h, x);
|
|
1961
|
+
} else return n(f, u, h, x);
|
|
1962
|
+
}
|
|
1963
|
+
function i(f, u) {
|
|
1964
|
+
if (!c.isUndefined(u))
|
|
1965
|
+
return n(void 0, u);
|
|
1966
|
+
}
|
|
1967
|
+
function a(f, u) {
|
|
1968
|
+
if (c.isUndefined(u)) {
|
|
1969
|
+
if (!c.isUndefined(f))
|
|
1970
|
+
return n(void 0, f);
|
|
1971
|
+
} else return n(void 0, u);
|
|
1972
|
+
}
|
|
1973
|
+
function l(f, u, h) {
|
|
1974
|
+
if (h in e)
|
|
1975
|
+
return n(f, u);
|
|
1976
|
+
if (h in t)
|
|
1977
|
+
return n(void 0, f);
|
|
1978
|
+
}
|
|
1979
|
+
const g = {
|
|
1980
|
+
url: i,
|
|
1981
|
+
method: i,
|
|
1982
|
+
data: i,
|
|
1983
|
+
baseURL: a,
|
|
1984
|
+
transformRequest: a,
|
|
1985
|
+
transformResponse: a,
|
|
1986
|
+
paramsSerializer: a,
|
|
1987
|
+
timeout: a,
|
|
1988
|
+
timeoutMessage: a,
|
|
1989
|
+
withCredentials: a,
|
|
1990
|
+
withXSRFToken: a,
|
|
1991
|
+
adapter: a,
|
|
1992
|
+
responseType: a,
|
|
1993
|
+
xsrfCookieName: a,
|
|
1994
|
+
xsrfHeaderName: a,
|
|
1995
|
+
onUploadProgress: a,
|
|
1996
|
+
onDownloadProgress: a,
|
|
1997
|
+
decompress: a,
|
|
1998
|
+
maxContentLength: a,
|
|
1999
|
+
maxBodyLength: a,
|
|
2000
|
+
beforeRedirect: a,
|
|
2001
|
+
transport: a,
|
|
2002
|
+
httpAgent: a,
|
|
2003
|
+
httpsAgent: a,
|
|
2004
|
+
cancelToken: a,
|
|
2005
|
+
socketPath: a,
|
|
2006
|
+
responseEncoding: a,
|
|
2007
|
+
validateStatus: l,
|
|
2008
|
+
headers: (f, u, h) => s(zt(f), zt(u), h, !0)
|
|
2009
|
+
};
|
|
2010
|
+
return c.forEach(Object.keys({ ...t, ...e }), function(u) {
|
|
2011
|
+
const h = g[u] || s, x = h(t[u], e[u], u);
|
|
2012
|
+
c.isUndefined(x) && h !== l || (r[u] = x);
|
|
2013
|
+
}), r;
|
|
2014
|
+
}
|
|
2015
|
+
const _r = (t) => {
|
|
2016
|
+
const e = ye({}, t);
|
|
2017
|
+
let { data: r, withXSRFToken: n, xsrfHeaderName: s, xsrfCookieName: i, headers: a, auth: l } = e;
|
|
2018
|
+
if (e.headers = a = X.from(a), e.url = br(Tr(e.baseURL, e.url, e.allowAbsoluteUrls), t.params, t.paramsSerializer), l && a.set(
|
|
2019
|
+
"Authorization",
|
|
2020
|
+
"Basic " + btoa((l.username || "") + ":" + (l.password ? unescape(encodeURIComponent(l.password)) : ""))
|
|
2021
|
+
), c.isFormData(r)) {
|
|
2022
|
+
if (H.hasStandardBrowserEnv || H.hasStandardBrowserWebWorkerEnv)
|
|
2023
|
+
a.setContentType(void 0);
|
|
2024
|
+
else if (c.isFunction(r.getHeaders)) {
|
|
2025
|
+
const g = r.getHeaders(), f = ["content-type", "content-length"];
|
|
2026
|
+
Object.entries(g).forEach(([u, h]) => {
|
|
2027
|
+
f.includes(u.toLowerCase()) && a.set(u, h);
|
|
2028
|
+
});
|
|
2029
|
+
}
|
|
2030
|
+
}
|
|
2031
|
+
if (H.hasStandardBrowserEnv && (n && c.isFunction(n) && (n = n(e)), n || n !== !1 && xs(e.url))) {
|
|
2032
|
+
const g = s && i && Ss.read(i);
|
|
2033
|
+
g && a.set(s, g);
|
|
2034
|
+
}
|
|
2035
|
+
return e;
|
|
2036
|
+
}, Cs = typeof XMLHttpRequest < "u", Ps = Cs && function(t) {
|
|
2037
|
+
return new Promise(function(r, n) {
|
|
2038
|
+
const s = _r(t);
|
|
2039
|
+
let i = s.data;
|
|
2040
|
+
const a = X.from(s.headers).normalize();
|
|
2041
|
+
let { responseType: l, onUploadProgress: g, onDownloadProgress: f } = s, u, h, x, F, d;
|
|
2042
|
+
function E() {
|
|
2043
|
+
F && F(), d && d(), s.cancelToken && s.cancelToken.unsubscribe(u), s.signal && s.signal.removeEventListener("abort", u);
|
|
2044
|
+
}
|
|
2045
|
+
let b = new XMLHttpRequest();
|
|
2046
|
+
b.open(s.method.toUpperCase(), s.url, !0), b.timeout = s.timeout;
|
|
2047
|
+
function P() {
|
|
2048
|
+
if (!b)
|
|
2049
|
+
return;
|
|
2050
|
+
const L = X.from(
|
|
2051
|
+
"getAllResponseHeaders" in b && b.getAllResponseHeaders()
|
|
2052
|
+
), V = {
|
|
2053
|
+
data: !l || l === "text" || l === "json" ? b.responseText : b.response,
|
|
2054
|
+
status: b.status,
|
|
2055
|
+
statusText: b.statusText,
|
|
2056
|
+
headers: L,
|
|
2057
|
+
config: t,
|
|
2058
|
+
request: b
|
|
2059
|
+
};
|
|
2060
|
+
Rr(function($) {
|
|
2061
|
+
r($), E();
|
|
2062
|
+
}, function($) {
|
|
2063
|
+
n($), E();
|
|
2064
|
+
}, V), b = null;
|
|
2065
|
+
}
|
|
2066
|
+
"onloadend" in b ? b.onloadend = P : b.onreadystatechange = function() {
|
|
2067
|
+
!b || b.readyState !== 4 || b.status === 0 && !(b.responseURL && b.responseURL.indexOf("file:") === 0) || setTimeout(P);
|
|
2068
|
+
}, b.onabort = function() {
|
|
2069
|
+
b && (n(new _("Request aborted", _.ECONNABORTED, t, b)), b = null);
|
|
2070
|
+
}, b.onerror = function(j) {
|
|
2071
|
+
const V = j && j.message ? j.message : "Network Error", ne = new _(V, _.ERR_NETWORK, t, b);
|
|
2072
|
+
ne.event = j || null, n(ne), b = null;
|
|
2073
|
+
}, b.ontimeout = function() {
|
|
2074
|
+
let j = s.timeout ? "timeout of " + s.timeout + "ms exceeded" : "timeout exceeded";
|
|
2075
|
+
const V = s.transitional || Er;
|
|
2076
|
+
s.timeoutErrorMessage && (j = s.timeoutErrorMessage), n(new _(
|
|
2077
|
+
j,
|
|
2078
|
+
V.clarifyTimeoutError ? _.ETIMEDOUT : _.ECONNABORTED,
|
|
2079
|
+
t,
|
|
2080
|
+
b
|
|
2081
|
+
)), b = null;
|
|
2082
|
+
}, i === void 0 && a.setContentType(null), "setRequestHeader" in b && c.forEach(a.toJSON(), function(j, V) {
|
|
2083
|
+
b.setRequestHeader(V, j);
|
|
2084
|
+
}), c.isUndefined(s.withCredentials) || (b.withCredentials = !!s.withCredentials), l && l !== "json" && (b.responseType = s.responseType), f && ([x, d] = Ye(f, !0), b.addEventListener("progress", x)), g && b.upload && ([h, F] = Ye(g), b.upload.addEventListener("progress", h), b.upload.addEventListener("loadend", F)), (s.cancelToken || s.signal) && (u = (L) => {
|
|
2085
|
+
b && (n(!L || L.type ? new _e(null, t, b) : L), b.abort(), b = null);
|
|
2086
|
+
}, s.cancelToken && s.cancelToken.subscribe(u), s.signal && (s.signal.aborted ? u() : s.signal.addEventListener("abort", u)));
|
|
2087
|
+
const A = Rs(s.url);
|
|
2088
|
+
if (A && H.protocols.indexOf(A) === -1) {
|
|
2089
|
+
n(new _("Unsupported protocol " + A + ":", _.ERR_BAD_REQUEST, t));
|
|
2090
|
+
return;
|
|
2091
|
+
}
|
|
2092
|
+
b.send(i || null);
|
|
2093
|
+
});
|
|
2094
|
+
}, ks = (t, e) => {
|
|
2095
|
+
const { length: r } = t = t ? t.filter(Boolean) : [];
|
|
2096
|
+
if (e || r) {
|
|
2097
|
+
let n = new AbortController(), s;
|
|
2098
|
+
const i = function(f) {
|
|
2099
|
+
if (!s) {
|
|
2100
|
+
s = !0, l();
|
|
2101
|
+
const u = f instanceof Error ? f : this.reason;
|
|
2102
|
+
n.abort(u instanceof _ ? u : new _e(u instanceof Error ? u.message : u));
|
|
2103
|
+
}
|
|
2104
|
+
};
|
|
2105
|
+
let a = e && setTimeout(() => {
|
|
2106
|
+
a = null, i(new _(`timeout ${e} of ms exceeded`, _.ETIMEDOUT));
|
|
2107
|
+
}, e);
|
|
2108
|
+
const l = () => {
|
|
2109
|
+
t && (a && clearTimeout(a), a = null, t.forEach((f) => {
|
|
2110
|
+
f.unsubscribe ? f.unsubscribe(i) : f.removeEventListener("abort", i);
|
|
2111
|
+
}), t = null);
|
|
2112
|
+
};
|
|
2113
|
+
t.forEach((f) => f.addEventListener("abort", i));
|
|
2114
|
+
const { signal: g } = n;
|
|
2115
|
+
return g.unsubscribe = () => c.asap(l), g;
|
|
2116
|
+
}
|
|
2117
|
+
}, Ls = function* (t, e) {
|
|
2118
|
+
let r = t.byteLength;
|
|
2119
|
+
if (r < e) {
|
|
2120
|
+
yield t;
|
|
2121
|
+
return;
|
|
2122
|
+
}
|
|
2123
|
+
let n = 0, s;
|
|
2124
|
+
for (; n < r; )
|
|
2125
|
+
s = n + e, yield t.slice(n, s), n = s;
|
|
2126
|
+
}, Fs = async function* (t, e) {
|
|
2127
|
+
for await (const r of js(t))
|
|
2128
|
+
yield* Ls(r, e);
|
|
2129
|
+
}, js = async function* (t) {
|
|
2130
|
+
if (t[Symbol.asyncIterator]) {
|
|
2131
|
+
yield* t;
|
|
2132
|
+
return;
|
|
2133
|
+
}
|
|
2134
|
+
const e = t.getReader();
|
|
2135
|
+
try {
|
|
2136
|
+
for (; ; ) {
|
|
2137
|
+
const { done: r, value: n } = await e.read();
|
|
2138
|
+
if (r)
|
|
2139
|
+
break;
|
|
2140
|
+
yield n;
|
|
2141
|
+
}
|
|
2142
|
+
} finally {
|
|
2143
|
+
await e.cancel();
|
|
2144
|
+
}
|
|
2145
|
+
}, Jt = (t, e, r, n) => {
|
|
2146
|
+
const s = Fs(t, e);
|
|
2147
|
+
let i = 0, a, l = (g) => {
|
|
2148
|
+
a || (a = !0, n && n(g));
|
|
2149
|
+
};
|
|
2150
|
+
return new ReadableStream({
|
|
2151
|
+
async pull(g) {
|
|
2152
|
+
try {
|
|
2153
|
+
const { done: f, value: u } = await s.next();
|
|
2154
|
+
if (f) {
|
|
2155
|
+
l(), g.close();
|
|
2156
|
+
return;
|
|
2157
|
+
}
|
|
2158
|
+
let h = u.byteLength;
|
|
2159
|
+
if (r) {
|
|
2160
|
+
let x = i += h;
|
|
2161
|
+
r(x);
|
|
2162
|
+
}
|
|
2163
|
+
g.enqueue(new Uint8Array(u));
|
|
2164
|
+
} catch (f) {
|
|
2165
|
+
throw l(f), f;
|
|
2166
|
+
}
|
|
2167
|
+
},
|
|
2168
|
+
cancel(g) {
|
|
2169
|
+
return l(g), s.return();
|
|
2170
|
+
}
|
|
2171
|
+
}, {
|
|
2172
|
+
highWaterMark: 2
|
|
2173
|
+
});
|
|
2174
|
+
}, Yt = 64 * 1024, { isFunction: Ve } = c, Ds = (({ Request: t, Response: e }) => ({
|
|
2175
|
+
Request: t,
|
|
2176
|
+
Response: e
|
|
2177
|
+
}))(c.global), {
|
|
2178
|
+
ReadableStream: Gt,
|
|
2179
|
+
TextEncoder: Xt
|
|
2180
|
+
} = c.global, Qt = (t, ...e) => {
|
|
2181
|
+
try {
|
|
2182
|
+
return !!t(...e);
|
|
2183
|
+
} catch {
|
|
2184
|
+
return !1;
|
|
2185
|
+
}
|
|
2186
|
+
}, Ns = (t) => {
|
|
2187
|
+
t = c.merge.call({
|
|
2188
|
+
skipUndefined: !0
|
|
2189
|
+
}, Ds, t);
|
|
2190
|
+
const { fetch: e, Request: r, Response: n } = t, s = e ? Ve(e) : typeof fetch == "function", i = Ve(r), a = Ve(n);
|
|
2191
|
+
if (!s)
|
|
2192
|
+
return !1;
|
|
2193
|
+
const l = s && Ve(Gt), g = s && (typeof Xt == "function" ? /* @__PURE__ */ ((d) => (E) => d.encode(E))(new Xt()) : async (d) => new Uint8Array(await new r(d).arrayBuffer())), f = i && l && Qt(() => {
|
|
2194
|
+
let d = !1;
|
|
2195
|
+
const E = new r(H.origin, {
|
|
2196
|
+
body: new Gt(),
|
|
2197
|
+
method: "POST",
|
|
2198
|
+
get duplex() {
|
|
2199
|
+
return d = !0, "half";
|
|
2200
|
+
}
|
|
2201
|
+
}).headers.has("Content-Type");
|
|
2202
|
+
return d && !E;
|
|
2203
|
+
}), u = a && l && Qt(() => c.isReadableStream(new n("").body)), h = {
|
|
2204
|
+
stream: u && ((d) => d.body)
|
|
2205
|
+
};
|
|
2206
|
+
s && ["text", "arrayBuffer", "blob", "formData", "stream"].forEach((d) => {
|
|
2207
|
+
!h[d] && (h[d] = (E, b) => {
|
|
2208
|
+
let P = E && E[d];
|
|
2209
|
+
if (P)
|
|
2210
|
+
return P.call(E);
|
|
2211
|
+
throw new _(`Response type '${d}' is not supported`, _.ERR_NOT_SUPPORT, b);
|
|
2212
|
+
});
|
|
2213
|
+
});
|
|
2214
|
+
const x = async (d) => {
|
|
2215
|
+
if (d == null)
|
|
2216
|
+
return 0;
|
|
2217
|
+
if (c.isBlob(d))
|
|
2218
|
+
return d.size;
|
|
2219
|
+
if (c.isSpecCompliantForm(d))
|
|
2220
|
+
return (await new r(H.origin, {
|
|
2221
|
+
method: "POST",
|
|
2222
|
+
body: d
|
|
2223
|
+
}).arrayBuffer()).byteLength;
|
|
2224
|
+
if (c.isArrayBufferView(d) || c.isArrayBuffer(d))
|
|
2225
|
+
return d.byteLength;
|
|
2226
|
+
if (c.isURLSearchParams(d) && (d = d + ""), c.isString(d))
|
|
2227
|
+
return (await g(d)).byteLength;
|
|
2228
|
+
}, F = async (d, E) => {
|
|
2229
|
+
const b = c.toFiniteNumber(d.getContentLength());
|
|
2230
|
+
return b ?? x(E);
|
|
2231
|
+
};
|
|
2232
|
+
return async (d) => {
|
|
2233
|
+
let {
|
|
2234
|
+
url: E,
|
|
2235
|
+
method: b,
|
|
2236
|
+
data: P,
|
|
2237
|
+
signal: A,
|
|
2238
|
+
cancelToken: L,
|
|
2239
|
+
timeout: j,
|
|
2240
|
+
onDownloadProgress: V,
|
|
2241
|
+
onUploadProgress: ne,
|
|
2242
|
+
responseType: $,
|
|
2243
|
+
headers: Q,
|
|
2244
|
+
withCredentials: Z = "same-origin",
|
|
2245
|
+
fetchOptions: fe
|
|
2246
|
+
} = _r(d), le = e || fetch;
|
|
2247
|
+
$ = $ ? ($ + "").toLowerCase() : "text";
|
|
2248
|
+
let ae = ks([A, L && L.toAbortSignal()], j), B = null;
|
|
2249
|
+
const q = ae && ae.unsubscribe && (() => {
|
|
2250
|
+
ae.unsubscribe();
|
|
2251
|
+
});
|
|
2252
|
+
let y;
|
|
2253
|
+
try {
|
|
2254
|
+
if (ne && f && b !== "get" && b !== "head" && (y = await F(Q, P)) !== 0) {
|
|
2255
|
+
let K = new r(E, {
|
|
2256
|
+
method: "POST",
|
|
2257
|
+
body: P,
|
|
2258
|
+
duplex: "half"
|
|
2259
|
+
}), M;
|
|
2260
|
+
if (c.isFormData(P) && (M = K.headers.get("content-type")) && Q.setContentType(M), K.body) {
|
|
2261
|
+
const [z, ue] = Vt(
|
|
2262
|
+
y,
|
|
2263
|
+
Ye(Wt(ne))
|
|
2264
|
+
);
|
|
2265
|
+
P = Jt(K.body, Yt, z, ue);
|
|
2266
|
+
}
|
|
2267
|
+
}
|
|
2268
|
+
c.isString(Z) || (Z = Z ? "include" : "omit");
|
|
2269
|
+
const T = i && "credentials" in r.prototype, R = {
|
|
2270
|
+
...fe,
|
|
2271
|
+
signal: ae,
|
|
2272
|
+
method: b.toUpperCase(),
|
|
2273
|
+
headers: Q.normalize().toJSON(),
|
|
2274
|
+
body: P,
|
|
2275
|
+
duplex: "half",
|
|
2276
|
+
credentials: T ? Z : void 0
|
|
2277
|
+
};
|
|
2278
|
+
B = i && new r(E, R);
|
|
2279
|
+
let w = await (i ? le(B, fe) : le(E, R));
|
|
2280
|
+
const D = u && ($ === "stream" || $ === "response");
|
|
2281
|
+
if (u && (V || D && q)) {
|
|
2282
|
+
const K = {};
|
|
2283
|
+
["status", "statusText", "headers"].forEach((de) => {
|
|
2284
|
+
K[de] = w[de];
|
|
2285
|
+
});
|
|
2286
|
+
const M = c.toFiniteNumber(w.headers.get("content-length")), [z, ue] = V && Vt(
|
|
2287
|
+
M,
|
|
2288
|
+
Ye(Wt(V), !0)
|
|
2289
|
+
) || [];
|
|
2290
|
+
w = new n(
|
|
2291
|
+
Jt(w.body, Yt, z, () => {
|
|
2292
|
+
ue && ue(), q && q();
|
|
2293
|
+
}),
|
|
2294
|
+
K
|
|
2295
|
+
);
|
|
2296
|
+
}
|
|
2297
|
+
$ = $ || "text";
|
|
2298
|
+
let se = await h[c.findKey(h, $) || "text"](w, d);
|
|
2299
|
+
return !D && q && q(), await new Promise((K, M) => {
|
|
2300
|
+
Rr(K, M, {
|
|
2301
|
+
data: se,
|
|
2302
|
+
headers: X.from(w.headers),
|
|
2303
|
+
status: w.status,
|
|
2304
|
+
statusText: w.statusText,
|
|
2305
|
+
config: d,
|
|
2306
|
+
request: B
|
|
2307
|
+
});
|
|
2308
|
+
});
|
|
2309
|
+
} catch (T) {
|
|
2310
|
+
throw q && q(), T && T.name === "TypeError" && /Load failed|fetch/i.test(T.message) ? Object.assign(
|
|
2311
|
+
new _("Network Error", _.ERR_NETWORK, d, B),
|
|
2312
|
+
{
|
|
2313
|
+
cause: T.cause || T
|
|
2314
|
+
}
|
|
2315
|
+
) : _.from(T, T && T.code, d, B);
|
|
2316
|
+
}
|
|
2317
|
+
};
|
|
2318
|
+
}, Us = /* @__PURE__ */ new Map(), xr = (t) => {
|
|
2319
|
+
let e = t && t.env || {};
|
|
2320
|
+
const { fetch: r, Request: n, Response: s } = e, i = [
|
|
2321
|
+
n,
|
|
2322
|
+
s,
|
|
2323
|
+
r
|
|
2324
|
+
];
|
|
2325
|
+
let a = i.length, l = a, g, f, u = Us;
|
|
2326
|
+
for (; l--; )
|
|
2327
|
+
g = i[l], f = u.get(g), f === void 0 && u.set(g, f = l ? /* @__PURE__ */ new Map() : Ns(e)), u = f;
|
|
2328
|
+
return f;
|
|
2329
|
+
};
|
|
2330
|
+
xr();
|
|
2331
|
+
const vt = {
|
|
2332
|
+
http: es,
|
|
2333
|
+
xhr: Ps,
|
|
2334
|
+
fetch: {
|
|
2335
|
+
get: xr
|
|
2336
|
+
}
|
|
2337
|
+
};
|
|
2338
|
+
c.forEach(vt, (t, e) => {
|
|
2339
|
+
if (t) {
|
|
2340
|
+
try {
|
|
2341
|
+
Object.defineProperty(t, "name", { value: e });
|
|
2342
|
+
} catch {
|
|
2343
|
+
}
|
|
2344
|
+
Object.defineProperty(t, "adapterName", { value: e });
|
|
2345
|
+
}
|
|
2346
|
+
});
|
|
2347
|
+
const Zt = (t) => `- ${t}`, Ms = (t) => c.isFunction(t) || t === null || t === !1;
|
|
2348
|
+
function Is(t, e) {
|
|
2349
|
+
t = c.isArray(t) ? t : [t];
|
|
2350
|
+
const { length: r } = t;
|
|
2351
|
+
let n, s;
|
|
2352
|
+
const i = {};
|
|
2353
|
+
for (let a = 0; a < r; a++) {
|
|
2354
|
+
n = t[a];
|
|
2355
|
+
let l;
|
|
2356
|
+
if (s = n, !Ms(n) && (s = vt[(l = String(n)).toLowerCase()], s === void 0))
|
|
2357
|
+
throw new _(`Unknown adapter '${l}'`);
|
|
2358
|
+
if (s && (c.isFunction(s) || (s = s.get(e))))
|
|
2359
|
+
break;
|
|
2360
|
+
i[l || "#" + a] = s;
|
|
2361
|
+
}
|
|
2362
|
+
if (!s) {
|
|
2363
|
+
const a = Object.entries(i).map(
|
|
2364
|
+
([g, f]) => `adapter ${g} ` + (f === !1 ? "is not supported by the environment" : "is not available in the build")
|
|
2365
|
+
);
|
|
2366
|
+
let l = r ? a.length > 1 ? `since :
|
|
2367
|
+
` + a.map(Zt).join(`
|
|
2368
|
+
`) : " " + Zt(a[0]) : "as no adapter specified";
|
|
2369
|
+
throw new _(
|
|
2370
|
+
"There is no suitable adapter to dispatch the request " + l,
|
|
2371
|
+
"ERR_NOT_SUPPORT"
|
|
2372
|
+
);
|
|
2373
|
+
}
|
|
2374
|
+
return s;
|
|
2375
|
+
}
|
|
2376
|
+
const Sr = {
|
|
2377
|
+
/**
|
|
2378
|
+
* Resolve an adapter from a list of adapter names or functions.
|
|
2379
|
+
* @type {Function}
|
|
2380
|
+
*/
|
|
2381
|
+
getAdapter: Is,
|
|
2382
|
+
/**
|
|
2383
|
+
* Exposes all known adapters
|
|
2384
|
+
* @type {Object<string, Function|Object>}
|
|
2385
|
+
*/
|
|
2386
|
+
adapters: vt
|
|
2387
|
+
};
|
|
2388
|
+
function dt(t) {
|
|
2389
|
+
if (t.cancelToken && t.cancelToken.throwIfRequested(), t.signal && t.signal.aborted)
|
|
2390
|
+
throw new _e(null, t);
|
|
2391
|
+
}
|
|
2392
|
+
function er(t) {
|
|
2393
|
+
return dt(t), t.headers = X.from(t.headers), t.data = ft.call(
|
|
2394
|
+
t,
|
|
2395
|
+
t.transformRequest
|
|
2396
|
+
), ["post", "put", "patch"].indexOf(t.method) !== -1 && t.headers.setContentType("application/x-www-form-urlencoded", !1), Sr.getAdapter(t.adapter || De.adapter, t)(t).then(function(n) {
|
|
2397
|
+
return dt(t), n.data = ft.call(
|
|
2398
|
+
t,
|
|
2399
|
+
t.transformResponse,
|
|
2400
|
+
n
|
|
2401
|
+
), n.headers = X.from(n.headers), n;
|
|
2402
|
+
}, function(n) {
|
|
2403
|
+
return vr(n) || (dt(t), n && n.response && (n.response.data = ft.call(
|
|
2404
|
+
t,
|
|
2405
|
+
t.transformResponse,
|
|
2406
|
+
n.response
|
|
2407
|
+
), n.response.headers = X.from(n.response.headers))), Promise.reject(n);
|
|
2408
|
+
});
|
|
2409
|
+
}
|
|
2410
|
+
const Or = "1.13.2", et = {};
|
|
2411
|
+
["object", "boolean", "number", "function", "string", "symbol"].forEach((t, e) => {
|
|
2412
|
+
et[t] = function(n) {
|
|
2413
|
+
return typeof n === t || "a" + (e < 1 ? "n " : " ") + t;
|
|
2414
|
+
};
|
|
2415
|
+
});
|
|
2416
|
+
const tr = {};
|
|
2417
|
+
et.transitional = function(e, r, n) {
|
|
2418
|
+
function s(i, a) {
|
|
2419
|
+
return "[Axios v" + Or + "] Transitional option '" + i + "'" + a + (n ? ". " + n : "");
|
|
2420
|
+
}
|
|
2421
|
+
return (i, a, l) => {
|
|
2422
|
+
if (e === !1)
|
|
2423
|
+
throw new _(
|
|
2424
|
+
s(a, " has been removed" + (r ? " in " + r : "")),
|
|
2425
|
+
_.ERR_DEPRECATED
|
|
2426
|
+
);
|
|
2427
|
+
return r && !tr[a] && (tr[a] = !0, console.warn(
|
|
2428
|
+
s(
|
|
2429
|
+
a,
|
|
2430
|
+
" has been deprecated since v" + r + " and will be removed in the near future"
|
|
2431
|
+
)
|
|
2432
|
+
)), e ? e(i, a, l) : !0;
|
|
2433
|
+
};
|
|
2434
|
+
};
|
|
2435
|
+
et.spelling = function(e) {
|
|
2436
|
+
return (r, n) => (console.warn(`${n} is likely a misspelling of ${e}`), !0);
|
|
2437
|
+
};
|
|
2438
|
+
function Bs(t, e, r) {
|
|
2439
|
+
if (typeof t != "object")
|
|
2440
|
+
throw new _("options must be an object", _.ERR_BAD_OPTION_VALUE);
|
|
2441
|
+
const n = Object.keys(t);
|
|
2442
|
+
let s = n.length;
|
|
2443
|
+
for (; s-- > 0; ) {
|
|
2444
|
+
const i = n[s], a = e[i];
|
|
2445
|
+
if (a) {
|
|
2446
|
+
const l = t[i], g = l === void 0 || a(l, i, t);
|
|
2447
|
+
if (g !== !0)
|
|
2448
|
+
throw new _("option " + i + " must be " + g, _.ERR_BAD_OPTION_VALUE);
|
|
2449
|
+
continue;
|
|
2450
|
+
}
|
|
2451
|
+
if (r !== !0)
|
|
2452
|
+
throw new _("Unknown option " + i, _.ERR_BAD_OPTION);
|
|
2453
|
+
}
|
|
2454
|
+
}
|
|
2455
|
+
const Je = {
|
|
2456
|
+
assertOptions: Bs,
|
|
2457
|
+
validators: et
|
|
2458
|
+
}, ie = Je.validators;
|
|
2459
|
+
class me {
|
|
2460
|
+
constructor(e) {
|
|
2461
|
+
this.defaults = e || {}, this.interceptors = {
|
|
2462
|
+
request: new Kt(),
|
|
2463
|
+
response: new Kt()
|
|
2464
|
+
};
|
|
2465
|
+
}
|
|
2466
|
+
/**
|
|
2467
|
+
* Dispatch a request
|
|
2468
|
+
*
|
|
2469
|
+
* @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
|
|
2470
|
+
* @param {?Object} config
|
|
2471
|
+
*
|
|
2472
|
+
* @returns {Promise} The Promise to be fulfilled
|
|
2473
|
+
*/
|
|
2474
|
+
async request(e, r) {
|
|
2475
|
+
try {
|
|
2476
|
+
return await this._request(e, r);
|
|
2477
|
+
} catch (n) {
|
|
2478
|
+
if (n instanceof Error) {
|
|
2479
|
+
let s = {};
|
|
2480
|
+
Error.captureStackTrace ? Error.captureStackTrace(s) : s = new Error();
|
|
2481
|
+
const i = s.stack ? s.stack.replace(/^.+\n/, "") : "";
|
|
2482
|
+
try {
|
|
2483
|
+
n.stack ? i && !String(n.stack).endsWith(i.replace(/^.+\n.+\n/, "")) && (n.stack += `
|
|
2484
|
+
` + i) : n.stack = i;
|
|
2485
|
+
} catch {
|
|
2486
|
+
}
|
|
2487
|
+
}
|
|
2488
|
+
throw n;
|
|
2489
|
+
}
|
|
2490
|
+
}
|
|
2491
|
+
_request(e, r) {
|
|
2492
|
+
typeof e == "string" ? (r = r || {}, r.url = e) : r = e || {}, r = ye(this.defaults, r);
|
|
2493
|
+
const { transitional: n, paramsSerializer: s, headers: i } = r;
|
|
2494
|
+
n !== void 0 && Je.assertOptions(n, {
|
|
2495
|
+
silentJSONParsing: ie.transitional(ie.boolean),
|
|
2496
|
+
forcedJSONParsing: ie.transitional(ie.boolean),
|
|
2497
|
+
clarifyTimeoutError: ie.transitional(ie.boolean)
|
|
2498
|
+
}, !1), s != null && (c.isFunction(s) ? r.paramsSerializer = {
|
|
2499
|
+
serialize: s
|
|
2500
|
+
} : Je.assertOptions(s, {
|
|
2501
|
+
encode: ie.function,
|
|
2502
|
+
serialize: ie.function
|
|
2503
|
+
}, !0)), r.allowAbsoluteUrls !== void 0 || (this.defaults.allowAbsoluteUrls !== void 0 ? r.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls : r.allowAbsoluteUrls = !0), Je.assertOptions(r, {
|
|
2504
|
+
baseUrl: ie.spelling("baseURL"),
|
|
2505
|
+
withXsrfToken: ie.spelling("withXSRFToken")
|
|
2506
|
+
}, !0), r.method = (r.method || this.defaults.method || "get").toLowerCase();
|
|
2507
|
+
let a = i && c.merge(
|
|
2508
|
+
i.common,
|
|
2509
|
+
i[r.method]
|
|
2510
|
+
);
|
|
2511
|
+
i && c.forEach(
|
|
2512
|
+
["delete", "get", "head", "post", "put", "patch", "common"],
|
|
2513
|
+
(d) => {
|
|
2514
|
+
delete i[d];
|
|
2515
|
+
}
|
|
2516
|
+
), r.headers = X.concat(a, i);
|
|
2517
|
+
const l = [];
|
|
2518
|
+
let g = !0;
|
|
2519
|
+
this.interceptors.request.forEach(function(E) {
|
|
2520
|
+
typeof E.runWhen == "function" && E.runWhen(r) === !1 || (g = g && E.synchronous, l.unshift(E.fulfilled, E.rejected));
|
|
2521
|
+
});
|
|
2522
|
+
const f = [];
|
|
2523
|
+
this.interceptors.response.forEach(function(E) {
|
|
2524
|
+
f.push(E.fulfilled, E.rejected);
|
|
2525
|
+
});
|
|
2526
|
+
let u, h = 0, x;
|
|
2527
|
+
if (!g) {
|
|
2528
|
+
const d = [er.bind(this), void 0];
|
|
2529
|
+
for (d.unshift(...l), d.push(...f), x = d.length, u = Promise.resolve(r); h < x; )
|
|
2530
|
+
u = u.then(d[h++], d[h++]);
|
|
2531
|
+
return u;
|
|
2532
|
+
}
|
|
2533
|
+
x = l.length;
|
|
2534
|
+
let F = r;
|
|
2535
|
+
for (; h < x; ) {
|
|
2536
|
+
const d = l[h++], E = l[h++];
|
|
2537
|
+
try {
|
|
2538
|
+
F = d(F);
|
|
2539
|
+
} catch (b) {
|
|
2540
|
+
E.call(this, b);
|
|
2541
|
+
break;
|
|
2542
|
+
}
|
|
2543
|
+
}
|
|
2544
|
+
try {
|
|
2545
|
+
u = er.call(this, F);
|
|
2546
|
+
} catch (d) {
|
|
2547
|
+
return Promise.reject(d);
|
|
2548
|
+
}
|
|
2549
|
+
for (h = 0, x = f.length; h < x; )
|
|
2550
|
+
u = u.then(f[h++], f[h++]);
|
|
2551
|
+
return u;
|
|
2552
|
+
}
|
|
2553
|
+
getUri(e) {
|
|
2554
|
+
e = ye(this.defaults, e);
|
|
2555
|
+
const r = Tr(e.baseURL, e.url, e.allowAbsoluteUrls);
|
|
2556
|
+
return br(r, e.params, e.paramsSerializer);
|
|
2557
|
+
}
|
|
2558
|
+
}
|
|
2559
|
+
c.forEach(["delete", "get", "head", "options"], function(e) {
|
|
2560
|
+
me.prototype[e] = function(r, n) {
|
|
2561
|
+
return this.request(ye(n || {}, {
|
|
2562
|
+
method: e,
|
|
2563
|
+
url: r,
|
|
2564
|
+
data: (n || {}).data
|
|
2565
|
+
}));
|
|
2566
|
+
};
|
|
2567
|
+
});
|
|
2568
|
+
c.forEach(["post", "put", "patch"], function(e) {
|
|
2569
|
+
function r(n) {
|
|
2570
|
+
return function(i, a, l) {
|
|
2571
|
+
return this.request(ye(l || {}, {
|
|
2572
|
+
method: e,
|
|
2573
|
+
headers: n ? {
|
|
2574
|
+
"Content-Type": "multipart/form-data"
|
|
2575
|
+
} : {},
|
|
2576
|
+
url: i,
|
|
2577
|
+
data: a
|
|
2578
|
+
}));
|
|
2579
|
+
};
|
|
2580
|
+
}
|
|
2581
|
+
me.prototype[e] = r(), me.prototype[e + "Form"] = r(!0);
|
|
2582
|
+
});
|
|
2583
|
+
class Rt {
|
|
2584
|
+
constructor(e) {
|
|
2585
|
+
if (typeof e != "function")
|
|
2586
|
+
throw new TypeError("executor must be a function.");
|
|
2587
|
+
let r;
|
|
2588
|
+
this.promise = new Promise(function(i) {
|
|
2589
|
+
r = i;
|
|
2590
|
+
});
|
|
2591
|
+
const n = this;
|
|
2592
|
+
this.promise.then((s) => {
|
|
2593
|
+
if (!n._listeners) return;
|
|
2594
|
+
let i = n._listeners.length;
|
|
2595
|
+
for (; i-- > 0; )
|
|
2596
|
+
n._listeners[i](s);
|
|
2597
|
+
n._listeners = null;
|
|
2598
|
+
}), this.promise.then = (s) => {
|
|
2599
|
+
let i;
|
|
2600
|
+
const a = new Promise((l) => {
|
|
2601
|
+
n.subscribe(l), i = l;
|
|
2602
|
+
}).then(s);
|
|
2603
|
+
return a.cancel = function() {
|
|
2604
|
+
n.unsubscribe(i);
|
|
2605
|
+
}, a;
|
|
2606
|
+
}, e(function(i, a, l) {
|
|
2607
|
+
n.reason || (n.reason = new _e(i, a, l), r(n.reason));
|
|
2608
|
+
});
|
|
2609
|
+
}
|
|
2610
|
+
/**
|
|
2611
|
+
* Throws a `CanceledError` if cancellation has been requested.
|
|
2612
|
+
*/
|
|
2613
|
+
throwIfRequested() {
|
|
2614
|
+
if (this.reason)
|
|
2615
|
+
throw this.reason;
|
|
2616
|
+
}
|
|
2617
|
+
/**
|
|
2618
|
+
* Subscribe to the cancel signal
|
|
2619
|
+
*/
|
|
2620
|
+
subscribe(e) {
|
|
2621
|
+
if (this.reason) {
|
|
2622
|
+
e(this.reason);
|
|
2623
|
+
return;
|
|
2624
|
+
}
|
|
2625
|
+
this._listeners ? this._listeners.push(e) : this._listeners = [e];
|
|
2626
|
+
}
|
|
2627
|
+
/**
|
|
2628
|
+
* Unsubscribe from the cancel signal
|
|
2629
|
+
*/
|
|
2630
|
+
unsubscribe(e) {
|
|
2631
|
+
if (!this._listeners)
|
|
2632
|
+
return;
|
|
2633
|
+
const r = this._listeners.indexOf(e);
|
|
2634
|
+
r !== -1 && this._listeners.splice(r, 1);
|
|
2635
|
+
}
|
|
2636
|
+
toAbortSignal() {
|
|
2637
|
+
const e = new AbortController(), r = (n) => {
|
|
2638
|
+
e.abort(n);
|
|
2639
|
+
};
|
|
2640
|
+
return this.subscribe(r), e.signal.unsubscribe = () => this.unsubscribe(r), e.signal;
|
|
2641
|
+
}
|
|
2642
|
+
/**
|
|
2643
|
+
* Returns an object that contains a new `CancelToken` and a function that, when called,
|
|
2644
|
+
* cancels the `CancelToken`.
|
|
2645
|
+
*/
|
|
2646
|
+
static source() {
|
|
2647
|
+
let e;
|
|
2648
|
+
return {
|
|
2649
|
+
token: new Rt(function(s) {
|
|
2650
|
+
e = s;
|
|
2651
|
+
}),
|
|
2652
|
+
cancel: e
|
|
2653
|
+
};
|
|
2654
|
+
}
|
|
2655
|
+
}
|
|
2656
|
+
function $s(t) {
|
|
2657
|
+
return function(r) {
|
|
2658
|
+
return t.apply(null, r);
|
|
2659
|
+
};
|
|
2660
|
+
}
|
|
2661
|
+
function qs(t) {
|
|
2662
|
+
return c.isObject(t) && t.isAxiosError === !0;
|
|
2663
|
+
}
|
|
2664
|
+
const yt = {
|
|
2665
|
+
Continue: 100,
|
|
2666
|
+
SwitchingProtocols: 101,
|
|
2667
|
+
Processing: 102,
|
|
2668
|
+
EarlyHints: 103,
|
|
2669
|
+
Ok: 200,
|
|
2670
|
+
Created: 201,
|
|
2671
|
+
Accepted: 202,
|
|
2672
|
+
NonAuthoritativeInformation: 203,
|
|
2673
|
+
NoContent: 204,
|
|
2674
|
+
ResetContent: 205,
|
|
2675
|
+
PartialContent: 206,
|
|
2676
|
+
MultiStatus: 207,
|
|
2677
|
+
AlreadyReported: 208,
|
|
2678
|
+
ImUsed: 226,
|
|
2679
|
+
MultipleChoices: 300,
|
|
2680
|
+
MovedPermanently: 301,
|
|
2681
|
+
Found: 302,
|
|
2682
|
+
SeeOther: 303,
|
|
2683
|
+
NotModified: 304,
|
|
2684
|
+
UseProxy: 305,
|
|
2685
|
+
Unused: 306,
|
|
2686
|
+
TemporaryRedirect: 307,
|
|
2687
|
+
PermanentRedirect: 308,
|
|
2688
|
+
BadRequest: 400,
|
|
2689
|
+
Unauthorized: 401,
|
|
2690
|
+
PaymentRequired: 402,
|
|
2691
|
+
Forbidden: 403,
|
|
2692
|
+
NotFound: 404,
|
|
2693
|
+
MethodNotAllowed: 405,
|
|
2694
|
+
NotAcceptable: 406,
|
|
2695
|
+
ProxyAuthenticationRequired: 407,
|
|
2696
|
+
RequestTimeout: 408,
|
|
2697
|
+
Conflict: 409,
|
|
2698
|
+
Gone: 410,
|
|
2699
|
+
LengthRequired: 411,
|
|
2700
|
+
PreconditionFailed: 412,
|
|
2701
|
+
PayloadTooLarge: 413,
|
|
2702
|
+
UriTooLong: 414,
|
|
2703
|
+
UnsupportedMediaType: 415,
|
|
2704
|
+
RangeNotSatisfiable: 416,
|
|
2705
|
+
ExpectationFailed: 417,
|
|
2706
|
+
ImATeapot: 418,
|
|
2707
|
+
MisdirectedRequest: 421,
|
|
2708
|
+
UnprocessableEntity: 422,
|
|
2709
|
+
Locked: 423,
|
|
2710
|
+
FailedDependency: 424,
|
|
2711
|
+
TooEarly: 425,
|
|
2712
|
+
UpgradeRequired: 426,
|
|
2713
|
+
PreconditionRequired: 428,
|
|
2714
|
+
TooManyRequests: 429,
|
|
2715
|
+
RequestHeaderFieldsTooLarge: 431,
|
|
2716
|
+
UnavailableForLegalReasons: 451,
|
|
2717
|
+
InternalServerError: 500,
|
|
2718
|
+
NotImplemented: 501,
|
|
2719
|
+
BadGateway: 502,
|
|
2720
|
+
ServiceUnavailable: 503,
|
|
2721
|
+
GatewayTimeout: 504,
|
|
2722
|
+
HttpVersionNotSupported: 505,
|
|
2723
|
+
VariantAlsoNegotiates: 506,
|
|
2724
|
+
InsufficientStorage: 507,
|
|
2725
|
+
LoopDetected: 508,
|
|
2726
|
+
NotExtended: 510,
|
|
2727
|
+
NetworkAuthenticationRequired: 511,
|
|
2728
|
+
WebServerIsDown: 521,
|
|
2729
|
+
ConnectionTimedOut: 522,
|
|
2730
|
+
OriginIsUnreachable: 523,
|
|
2731
|
+
TimeoutOccurred: 524,
|
|
2732
|
+
SslHandshakeFailed: 525,
|
|
2733
|
+
InvalidSslCertificate: 526
|
|
2734
|
+
};
|
|
2735
|
+
Object.entries(yt).forEach(([t, e]) => {
|
|
2736
|
+
yt[e] = t;
|
|
2737
|
+
});
|
|
2738
|
+
function Ar(t) {
|
|
2739
|
+
const e = new me(t), r = ar(me.prototype.request, e);
|
|
2740
|
+
return c.extend(r, me.prototype, e, { allOwnKeys: !0 }), c.extend(r, e, null, { allOwnKeys: !0 }), r.create = function(s) {
|
|
2741
|
+
return Ar(ye(t, s));
|
|
2742
|
+
}, r;
|
|
2743
|
+
}
|
|
2744
|
+
const U = Ar(De);
|
|
2745
|
+
U.Axios = me;
|
|
2746
|
+
U.CanceledError = _e;
|
|
2747
|
+
U.CancelToken = Rt;
|
|
2748
|
+
U.isCancel = vr;
|
|
2749
|
+
U.VERSION = Or;
|
|
2750
|
+
U.toFormData = Ze;
|
|
2751
|
+
U.AxiosError = _;
|
|
2752
|
+
U.Cancel = U.CanceledError;
|
|
2753
|
+
U.all = function(e) {
|
|
2754
|
+
return Promise.all(e);
|
|
2755
|
+
};
|
|
2756
|
+
U.spread = $s;
|
|
2757
|
+
U.isAxiosError = qs;
|
|
2758
|
+
U.mergeConfig = ye;
|
|
2759
|
+
U.AxiosHeaders = X;
|
|
2760
|
+
U.formToJSON = (t) => wr(c.isHTMLForm(t) ? new FormData(t) : t);
|
|
2761
|
+
U.getAdapter = Sr.getAdapter;
|
|
2762
|
+
U.HttpStatusCode = yt;
|
|
2763
|
+
U.default = U;
|
|
2764
|
+
const rr = "https://translation.googleapis.com/language/translate/v2", Ks = /* @__PURE__ */ new Set([408, 425, 429, 500, 502, 503, 504]), Hs = (t) => !!t, Vs = (t) => U.isAxiosError(t);
|
|
2765
|
+
class Ws {
|
|
2766
|
+
constructor(e) {
|
|
2767
|
+
te(this, "type", "google");
|
|
2768
|
+
te(this, "axios");
|
|
2769
|
+
this.config = e, this.axios = U.create({
|
|
2770
|
+
baseURL: e.endpoint ?? rr,
|
|
2771
|
+
headers: {
|
|
2772
|
+
"Content-Type": "application/json",
|
|
2773
|
+
...e.headers
|
|
2774
|
+
}
|
|
2775
|
+
});
|
|
2776
|
+
}
|
|
2777
|
+
isAvailable() {
|
|
2778
|
+
return this.config.apiKey || Hs(this.config.headers) ? { available: !0 } : {
|
|
2779
|
+
available: !0
|
|
2780
|
+
};
|
|
2781
|
+
}
|
|
2782
|
+
async translate(e, r) {
|
|
2783
|
+
var g, f, u;
|
|
2784
|
+
const n = {
|
|
2785
|
+
q: e.text,
|
|
2786
|
+
target: e.targetLanguage,
|
|
2787
|
+
format: "text"
|
|
2788
|
+
};
|
|
2789
|
+
e.sourceLanguage && e.sourceLanguage !== "auto" && (n.source = e.sourceLanguage), e.glossary && Object.keys(e.glossary).length > 0 && (n.glossaryConfig = {
|
|
2790
|
+
glossaryData: {
|
|
2791
|
+
languagePair: {
|
|
2792
|
+
sourceLanguageCode: e.sourceLanguage ?? "auto",
|
|
2793
|
+
targetLanguageCode: e.targetLanguage
|
|
2794
|
+
},
|
|
2795
|
+
terms: Object.entries(e.glossary).map(([h, x]) => ({
|
|
2796
|
+
sourceText: h,
|
|
2797
|
+
targetText: x
|
|
2798
|
+
}))
|
|
2799
|
+
}
|
|
2800
|
+
});
|
|
2801
|
+
const s = {
|
|
2802
|
+
...this.config.headers,
|
|
2803
|
+
...r == null ? void 0 : r.headers
|
|
2804
|
+
}, a = (u = (f = (g = (await this.axios.post(
|
|
2805
|
+
"",
|
|
2806
|
+
n,
|
|
2807
|
+
{
|
|
2808
|
+
headers: s,
|
|
2809
|
+
params: this.createQueryParams(),
|
|
2810
|
+
timeout: r == null ? void 0 : r.timeoutMs,
|
|
2811
|
+
signal: r == null ? void 0 : r.signal
|
|
2812
|
+
}
|
|
2813
|
+
)).data) == null ? void 0 : g.data) == null ? void 0 : f.translations) == null ? void 0 : u[0];
|
|
2814
|
+
if (!(a != null && a.translatedText))
|
|
2815
|
+
throw new Error(
|
|
2816
|
+
"Google Translate response did not include translatedText"
|
|
2817
|
+
);
|
|
2818
|
+
const l = {
|
|
2819
|
+
endpoint: this.config.endpoint ?? rr
|
|
2820
|
+
};
|
|
2821
|
+
return a.model && (l.model = a.model), this.config.projectId && (l.projectId = this.config.projectId), this.config.region && (l.region = this.config.region), {
|
|
2822
|
+
translatedText: a.translatedText,
|
|
2823
|
+
detectedSourceLanguage: a.detectedSourceLanguage,
|
|
2824
|
+
providerMetadata: l
|
|
2825
|
+
};
|
|
2826
|
+
}
|
|
2827
|
+
normalizeError(e) {
|
|
2828
|
+
var r, n, s, i, a;
|
|
2829
|
+
if (Vs(e)) {
|
|
2830
|
+
const l = (r = e.response) == null ? void 0 : r.status, g = ((n = e.response) == null ? void 0 : n.data) ?? {}, f = ((s = g.error) == null ? void 0 : s.message) ?? e.message ?? "Google Translate request failed";
|
|
2831
|
+
return {
|
|
2832
|
+
code: String(((i = g.error) == null ? void 0 : i.code) ?? l ?? "E_GOOGLE"),
|
|
2833
|
+
message: f,
|
|
2834
|
+
retryable: l ? Ks.has(l) : !1,
|
|
2835
|
+
details: {
|
|
2836
|
+
status: l,
|
|
2837
|
+
data: g,
|
|
2838
|
+
headers: (a = e.response) == null ? void 0 : a.headers
|
|
2839
|
+
}
|
|
2840
|
+
};
|
|
2841
|
+
}
|
|
2842
|
+
return e instanceof Error ? {
|
|
2843
|
+
code: e.name || "unknown_error",
|
|
2844
|
+
message: e.message,
|
|
2845
|
+
retryable: !1,
|
|
2846
|
+
details: e
|
|
2847
|
+
} : {
|
|
2848
|
+
code: "unknown_error",
|
|
2849
|
+
message: "Unknown provider error",
|
|
2850
|
+
retryable: !1,
|
|
2851
|
+
details: e
|
|
2852
|
+
};
|
|
2853
|
+
}
|
|
2854
|
+
createQueryParams() {
|
|
2855
|
+
if (this.config.apiKey)
|
|
2856
|
+
return {
|
|
2857
|
+
key: this.config.apiKey
|
|
2858
|
+
};
|
|
2859
|
+
}
|
|
2860
|
+
}
|
|
2861
|
+
const ht = (t) => {
|
|
2862
|
+
if (!t)
|
|
2863
|
+
throw new Error("Provider instance is null or undefined");
|
|
2864
|
+
if (!t.type)
|
|
2865
|
+
throw new Error("Provider missing required 'type' property");
|
|
2866
|
+
if (typeof t.translate != "function")
|
|
2867
|
+
throw new Error("Provider missing required 'translate' method");
|
|
2868
|
+
if (t.isAvailable && typeof t.isAvailable != "function")
|
|
2869
|
+
throw new Error("Provider 'isAvailable' must be a function");
|
|
2870
|
+
if (t.normalizeError && typeof t.normalizeError != "function")
|
|
2871
|
+
throw new Error("Provider 'normalizeError' must be a function");
|
|
2872
|
+
}, zs = (t) => {
|
|
2873
|
+
if (t.id === "google") {
|
|
2874
|
+
const e = new Ws(t);
|
|
2875
|
+
return ht(e), e;
|
|
2876
|
+
}
|
|
2877
|
+
if (t.implementation)
|
|
2878
|
+
return ht(t.implementation), t.implementation;
|
|
2879
|
+
if (t.factory) {
|
|
2880
|
+
const e = t.factory();
|
|
2881
|
+
return ht(e), e;
|
|
2882
|
+
}
|
|
2883
|
+
throw new Error(
|
|
2884
|
+
"Custom provider configuration must include either 'implementation' or 'factory'"
|
|
2885
|
+
);
|
|
2886
|
+
}, Js = "translator", Ys = 5e3, nr = 3e4, Gs = "::", Xs = (t) => {
|
|
2887
|
+
var r, n;
|
|
2888
|
+
return ((n = (r = navigator == null ? void 0 : navigator.language) == null ? void 0 : r.split("-")) == null ? void 0 : n[0]) || t;
|
|
2889
|
+
}, Qs = (t) => localStorage.getItem(t), Zs = (t, e) => {
|
|
2890
|
+
localStorage.setItem(t, e);
|
|
2891
|
+
}, eo = (t) => t ? t instanceof Set ? new Set(t) : new Set(t) : /* @__PURE__ */ new Set(), Cr = (t, e) => ({
|
|
2892
|
+
scope: Js,
|
|
2893
|
+
event: t,
|
|
2894
|
+
...e
|
|
2895
|
+
}), ke = (t, e) => {
|
|
2896
|
+
console.warn("[vbss-translator]", Cr(t, e));
|
|
2897
|
+
}, Y = (t, e) => {
|
|
2898
|
+
console.debug("[vbss-translator]", Cr(t, e));
|
|
2899
|
+
}, to = () => ({
|
|
2900
|
+
warn: (t, e) => {
|
|
2901
|
+
ke(t, e ?? {});
|
|
2902
|
+
},
|
|
2903
|
+
debug: (t, e) => {
|
|
2904
|
+
Y(t, e ?? {});
|
|
2905
|
+
}
|
|
2906
|
+
}), ro = (t) => {
|
|
2907
|
+
const {
|
|
2908
|
+
provider: e,
|
|
2909
|
+
cache: r,
|
|
2910
|
+
alwaysExternalKeys: n,
|
|
2911
|
+
enabled: s,
|
|
2912
|
+
timeoutMs: i,
|
|
2913
|
+
debug: a,
|
|
2914
|
+
...l
|
|
2915
|
+
} = t ?? {};
|
|
2916
|
+
return {
|
|
2917
|
+
enabled: s ?? !1,
|
|
2918
|
+
timeoutMs: i ?? Ys,
|
|
2919
|
+
debug: a ?? !1,
|
|
2920
|
+
provider: {
|
|
2921
|
+
...no,
|
|
2922
|
+
...e
|
|
2923
|
+
},
|
|
2924
|
+
cache: {
|
|
2925
|
+
...so,
|
|
2926
|
+
...r
|
|
2927
|
+
},
|
|
2928
|
+
alwaysExternalKeys: eo(n),
|
|
2929
|
+
...l
|
|
2930
|
+
};
|
|
2931
|
+
}, no = {
|
|
2932
|
+
id: "google"
|
|
2933
|
+
}, so = {
|
|
2934
|
+
enabled: !1,
|
|
2935
|
+
ttlMs: 36e5
|
|
2936
|
+
}, oo = (t, e) => `${t}${Gs}${e}`, ao = (t) => t ? new Map(t) : /* @__PURE__ */ new Map(), io = (t, e) => {
|
|
2937
|
+
const r = t.toLocaleLowerCase();
|
|
2938
|
+
return e.find(
|
|
2939
|
+
(n) => Object.values(n).some(
|
|
2940
|
+
(s) => s.toLocaleLowerCase() === r
|
|
2941
|
+
)
|
|
2942
|
+
);
|
|
2943
|
+
}, uo = ({
|
|
2944
|
+
children: t,
|
|
2945
|
+
translations: e,
|
|
2946
|
+
defaultLanguage: r = "en",
|
|
2947
|
+
persist: n = !1,
|
|
2948
|
+
persistKey: s = "language",
|
|
2949
|
+
autoDetectLanguage: i = !1,
|
|
2950
|
+
externalTranslation: a
|
|
2951
|
+
}) => {
|
|
2952
|
+
const l = ce(
|
|
2953
|
+
() => ro(a),
|
|
2954
|
+
[a]
|
|
2955
|
+
), [g, f] = Be(
|
|
2956
|
+
() => new Set(l.alwaysExternalKeys)
|
|
2957
|
+
);
|
|
2958
|
+
lt(() => {
|
|
2959
|
+
f((y) => {
|
|
2960
|
+
const T = new Set(l.alwaysExternalKeys);
|
|
2961
|
+
return y.forEach((R) => T.add(R)), T;
|
|
2962
|
+
});
|
|
2963
|
+
}, [l]);
|
|
2964
|
+
const u = $e((y) => {
|
|
2965
|
+
f((T) => {
|
|
2966
|
+
if (T.has(y))
|
|
2967
|
+
return T;
|
|
2968
|
+
const R = new Set(T);
|
|
2969
|
+
return R.add(y), R;
|
|
2970
|
+
});
|
|
2971
|
+
}, []), h = ce(
|
|
2972
|
+
() => ({
|
|
2973
|
+
...l,
|
|
2974
|
+
alwaysExternalKeys: g
|
|
2975
|
+
}),
|
|
2976
|
+
[l, g]
|
|
2977
|
+
), x = n ? Qs(s) : null, F = i ? Xs(r) : null, [d, E] = Be(
|
|
2978
|
+
x ?? F ?? r
|
|
2979
|
+
);
|
|
2980
|
+
lt(() => {
|
|
2981
|
+
n && Zs(s, d);
|
|
2982
|
+
}, [d, n, s]);
|
|
2983
|
+
const b = ce(
|
|
2984
|
+
() => Object.keys(e[0] || {}),
|
|
2985
|
+
[e]
|
|
2986
|
+
), P = ce(() => to(), []), A = ce(
|
|
2987
|
+
() => new pn(h.cache),
|
|
2988
|
+
[h.cache]
|
|
2989
|
+
), L = ce(() => {
|
|
2990
|
+
let y;
|
|
2991
|
+
try {
|
|
2992
|
+
if (y = zs(h.provider), h.debug && Y("TranslatorProvider_provider_created", {
|
|
2993
|
+
providerType: y.type,
|
|
2994
|
+
providerId: h.provider.id,
|
|
2995
|
+
timestamp: Date.now()
|
|
2996
|
+
}), y.isAvailable) {
|
|
2997
|
+
const T = y.isAvailable();
|
|
2998
|
+
T.available ? h.debug && Y("TranslatorProvider_provider_available", {
|
|
2999
|
+
providerType: y.type,
|
|
3000
|
+
providerId: h.provider.id,
|
|
3001
|
+
timestamp: Date.now()
|
|
3002
|
+
}) : ke("TranslatorProvider_provider_unavailable", {
|
|
3003
|
+
providerType: y.type,
|
|
3004
|
+
providerId: h.provider.id,
|
|
3005
|
+
reason: T.reason,
|
|
3006
|
+
timestamp: Date.now()
|
|
3007
|
+
});
|
|
3008
|
+
}
|
|
3009
|
+
} catch (T) {
|
|
3010
|
+
throw ke("TranslatorProvider_provider_creation_failed", {
|
|
3011
|
+
providerId: h.provider.id,
|
|
3012
|
+
error: T instanceof Error ? T.message : "Unknown error",
|
|
3013
|
+
timestamp: Date.now()
|
|
3014
|
+
}), T;
|
|
3015
|
+
}
|
|
3016
|
+
return new hn({
|
|
3017
|
+
provider: y,
|
|
3018
|
+
config: h,
|
|
3019
|
+
cache: h.cache.enabled ? A : void 0,
|
|
3020
|
+
logger: P
|
|
3021
|
+
});
|
|
3022
|
+
}, [h, P, A]), [j, V] = Be(
|
|
3023
|
+
() => /* @__PURE__ */ new Map()
|
|
3024
|
+
), [ne, $] = Be(0), Q = nn(!0);
|
|
3025
|
+
lt(() => (h.debug && Y("TranslatorProvider_mounted", {
|
|
3026
|
+
timestamp: Date.now()
|
|
3027
|
+
}), Q.current = !0, () => {
|
|
3028
|
+
h.debug && Y("TranslatorProvider_unmounting", {
|
|
3029
|
+
timestamp: Date.now()
|
|
3030
|
+
}), Q.current = !1;
|
|
3031
|
+
}), [h]);
|
|
3032
|
+
const Z = $e(
|
|
3033
|
+
(y, T, R) => {
|
|
3034
|
+
var se;
|
|
3035
|
+
h.debug && R && Y("setExternalStateEntry_called", {
|
|
3036
|
+
targetLanguage: y,
|
|
3037
|
+
key: T,
|
|
3038
|
+
status: R.status,
|
|
3039
|
+
value: R.value,
|
|
3040
|
+
isMounted: Q.current
|
|
3041
|
+
});
|
|
3042
|
+
const w = () => {
|
|
3043
|
+
V((K) => {
|
|
3044
|
+
const M = new Map(K), z = ao(M.get(y));
|
|
3045
|
+
return R ? (z.set(T, R), M.set(y, z)) : (z.delete(T), z.size > 0 ? M.set(y, z) : M.delete(y)), M;
|
|
3046
|
+
}), (R == null ? void 0 : R.status) === "resolved" && (h.debug && Y("forceUpdate_triggered", {
|
|
3047
|
+
targetLanguage: y,
|
|
3048
|
+
key: T
|
|
3049
|
+
}), $((K) => K + 1));
|
|
3050
|
+
};
|
|
3051
|
+
typeof process < "u" && ((se = process.env) == null ? void 0 : se.NODE_ENV) === "test" ? w() : sn(() => {
|
|
3052
|
+
w();
|
|
3053
|
+
});
|
|
3054
|
+
},
|
|
3055
|
+
[h, $]
|
|
3056
|
+
), fe = $e(
|
|
3057
|
+
(y) => {
|
|
3058
|
+
var T;
|
|
3059
|
+
L.isEnabled() && (Z(y.targetLanguage, y.key, {
|
|
3060
|
+
status: "pending",
|
|
3061
|
+
value: y.displayValue
|
|
3062
|
+
}), L.translate({
|
|
3063
|
+
key: y.key,
|
|
3064
|
+
text: y.originalText,
|
|
3065
|
+
targetLanguage: y.targetLanguage,
|
|
3066
|
+
sourceLanguage: y.sourceLanguage,
|
|
3067
|
+
signal: (T = y.options) == null ? void 0 : T.signal
|
|
3068
|
+
}).then((R) => {
|
|
3069
|
+
if (h.debug && Y("translation_promise_resolved", {
|
|
3070
|
+
key: y.key,
|
|
3071
|
+
targetLanguage: y.targetLanguage,
|
|
3072
|
+
isMounted: Q.current,
|
|
3073
|
+
hasResult: !!R,
|
|
3074
|
+
hasTranslatedText: !!(R && R.translatedText),
|
|
3075
|
+
translatedText: R == null ? void 0 : R.translatedText
|
|
3076
|
+
}), R && R.translatedText) {
|
|
3077
|
+
h.debug && Y("translation_applying_resolved", {
|
|
3078
|
+
key: y.key,
|
|
3079
|
+
targetLanguage: y.targetLanguage,
|
|
3080
|
+
isMounted: Q.current,
|
|
3081
|
+
translatedText: R.translatedText
|
|
3082
|
+
}), Z(y.targetLanguage, y.key, {
|
|
3083
|
+
status: "resolved",
|
|
3084
|
+
value: R.translatedText
|
|
3085
|
+
});
|
|
3086
|
+
return;
|
|
3087
|
+
}
|
|
3088
|
+
h.debug && Y("translation_invalid_result", {
|
|
3089
|
+
key: y.key,
|
|
3090
|
+
result: R
|
|
3091
|
+
}), Z(y.targetLanguage, y.key, {
|
|
3092
|
+
status: "error",
|
|
3093
|
+
value: y.displayValue,
|
|
3094
|
+
retryAt: Date.now() + nr
|
|
3095
|
+
});
|
|
3096
|
+
}).catch((R) => {
|
|
3097
|
+
h.debug && Y("translation_promise_rejected", {
|
|
3098
|
+
key: y.key,
|
|
3099
|
+
targetLanguage: y.targetLanguage,
|
|
3100
|
+
isMounted: Q.current,
|
|
3101
|
+
error: (R == null ? void 0 : R.message) || String(R)
|
|
3102
|
+
}), ke("external_translation_unexpected_rejection", {
|
|
3103
|
+
key: y.key,
|
|
3104
|
+
language: y.targetLanguage,
|
|
3105
|
+
error: R,
|
|
3106
|
+
isMounted: Q.current
|
|
3107
|
+
}), Z(y.targetLanguage, y.key, {
|
|
3108
|
+
status: "error",
|
|
3109
|
+
value: y.displayValue,
|
|
3110
|
+
error: R,
|
|
3111
|
+
retryAt: Date.now() + nr
|
|
3112
|
+
});
|
|
3113
|
+
}));
|
|
3114
|
+
},
|
|
3115
|
+
[h, Z, L]
|
|
3116
|
+
), le = ce(() => {
|
|
3117
|
+
const y = {};
|
|
3118
|
+
return j.forEach((T, R) => {
|
|
3119
|
+
T.forEach((w, D) => {
|
|
3120
|
+
y[oo(D, R)] = w.status === "pending";
|
|
3121
|
+
});
|
|
3122
|
+
}), h.debug && Y("isTranslatingRecord_recalculated", {
|
|
3123
|
+
recordSize: Object.keys(y).length,
|
|
3124
|
+
record: { ...y }
|
|
3125
|
+
}), y;
|
|
3126
|
+
}, [j, h]), ae = ce(
|
|
3127
|
+
() => Object.values(le).some(Boolean),
|
|
3128
|
+
[le]
|
|
3129
|
+
), B = $e(
|
|
3130
|
+
(y, T = {}) => {
|
|
3131
|
+
var he;
|
|
3132
|
+
const R = j.get(d), w = R == null ? void 0 : R.get(y);
|
|
3133
|
+
if (h.debug && T.preferExternal && Y("t_called", {
|
|
3134
|
+
text: y,
|
|
3135
|
+
language: d,
|
|
3136
|
+
hasStateForLanguage: !!R,
|
|
3137
|
+
existingStateStatus: w == null ? void 0 : w.status,
|
|
3138
|
+
existingStateValue: w == null ? void 0 : w.value,
|
|
3139
|
+
preferExternal: T.preferExternal
|
|
3140
|
+
}), (w == null ? void 0 : w.status) === "resolved" && w.value)
|
|
3141
|
+
return h.debug && Y("t_returning_resolved", {
|
|
3142
|
+
text: y,
|
|
3143
|
+
value: w.value
|
|
3144
|
+
}), w.value;
|
|
3145
|
+
const D = io(y, e), se = D == null ? void 0 : D[d], K = D ? Object.values(D).find((Ue) => !!Ue) : void 0, M = T.fallbackValue ?? (w == null ? void 0 : w.value) ?? se ?? K ?? y, z = T.preferExternal === !0 || h.alwaysExternalKeys.has(y), ue = L.isEnabled(), de = typeof se == "string";
|
|
3146
|
+
if (de || ke("missing_translation", {
|
|
3147
|
+
key: y,
|
|
3148
|
+
language: d
|
|
3149
|
+
}), !(ue && (z || !de)))
|
|
3150
|
+
return (w == null ? void 0 : w.status) === "pending" && w.value ? w.value : se ?? M;
|
|
3151
|
+
const xe = Date.now(), be = (w == null ? void 0 : w.status) === "error" && (!w.retryAt || w.retryAt <= xe);
|
|
3152
|
+
if (!w || be) {
|
|
3153
|
+
const Ee = T.sourceLanguage ?? (D && D[r] ? r : void 0), tt = (Ee && (D == null ? void 0 : D[Ee])) ?? (D == null ? void 0 : D[r]) ?? y;
|
|
3154
|
+
fe({
|
|
3155
|
+
key: y,
|
|
3156
|
+
targetLanguage: d,
|
|
3157
|
+
originalText: tt,
|
|
3158
|
+
displayValue: (w == null ? void 0 : w.value) ?? M,
|
|
3159
|
+
sourceLanguage: Ee,
|
|
3160
|
+
options: T
|
|
3161
|
+
});
|
|
3162
|
+
}
|
|
3163
|
+
const ee = ((he = j.get(d)) == null ? void 0 : he.get(y)) ?? w;
|
|
3164
|
+
return (ee == null ? void 0 : ee.status) === "resolved" && ee.value ? ee.value : (ee == null ? void 0 : ee.status) === "pending" ? ee.value ?? M : M;
|
|
3165
|
+
},
|
|
3166
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3167
|
+
[
|
|
3168
|
+
r,
|
|
3169
|
+
h.alwaysExternalKeys,
|
|
3170
|
+
j,
|
|
3171
|
+
d,
|
|
3172
|
+
fe,
|
|
3173
|
+
L,
|
|
3174
|
+
e
|
|
3175
|
+
]
|
|
3176
|
+
), q = ce(
|
|
3177
|
+
() => ({
|
|
3178
|
+
t: B,
|
|
3179
|
+
language: d,
|
|
3180
|
+
languages: b,
|
|
3181
|
+
setLanguage: E,
|
|
3182
|
+
isTranslating: le,
|
|
3183
|
+
isTranslatingAny: ae,
|
|
3184
|
+
registerExternalKey: u,
|
|
3185
|
+
externalConfig: h
|
|
3186
|
+
}),
|
|
3187
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3188
|
+
[
|
|
3189
|
+
B,
|
|
3190
|
+
d,
|
|
3191
|
+
b,
|
|
3192
|
+
E,
|
|
3193
|
+
le,
|
|
3194
|
+
ae,
|
|
3195
|
+
u,
|
|
3196
|
+
h,
|
|
3197
|
+
ne
|
|
3198
|
+
]
|
|
3199
|
+
);
|
|
3200
|
+
return /* @__PURE__ */ cn.jsx(or.Provider, { value: q, children: t });
|
|
3201
|
+
}, fo = () => un();
|
|
662
3202
|
export {
|
|
663
|
-
|
|
664
|
-
|
|
3203
|
+
uo as TranslatorProvider,
|
|
3204
|
+
zs as createTranslationProvider,
|
|
3205
|
+
fo as useTranslator
|
|
665
3206
|
};
|