@jnrs/vue-core 1.2.8 → 1.2.10

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.
@@ -1,3386 +0,0 @@
1
- import { u as Yt, a as es } from "./index-KdP2kDTZ.js";
2
- import { h as ts } from "./index-Ci9uljtG.js";
3
- import { ElMessage as ss } from "element-plus";
4
- function Pt(s, e) {
5
- return function() {
6
- return s.apply(e, arguments);
7
- };
8
- }
9
- const { toString: ns } = Object.prototype, { getPrototypeOf: Me } = Object, { iterator: Ee, toStringTag: Ct } = Symbol, Pe = /* @__PURE__ */ ((s) => (e) => {
10
- const t = ns.call(e);
11
- return s[t] || (s[t] = t.slice(8, -1).toLowerCase());
12
- })(/* @__PURE__ */ Object.create(null)), M = (s) => (s = s.toLowerCase(), (e) => Pe(e) === s), Ce = (s) => (e) => typeof e === s, { isArray: te } = Array, ee = Ce("undefined");
13
- function ue(s) {
14
- return s !== null && !ee(s) && s.constructor !== null && !ee(s.constructor) && j(s.constructor.isBuffer) && s.constructor.isBuffer(s);
15
- }
16
- const Lt = M("ArrayBuffer");
17
- function rs(s) {
18
- let e;
19
- return typeof ArrayBuffer < "u" && ArrayBuffer.isView ? e = ArrayBuffer.isView(s) : e = s && s.buffer && Lt(s.buffer), e;
20
- }
21
- const is = Ce("string"), j = Ce("function"), Tt = Ce("number"), ce = (s) => s !== null && typeof s == "object", os = (s) => s === !0 || s === !1, ye = (s) => {
22
- if (Pe(s) !== "object")
23
- return !1;
24
- const e = Me(s);
25
- return (e === null || e === Object.prototype || Object.getPrototypeOf(e) === null) && !(Ct in s) && !(Ee in s);
26
- }, as = (s) => {
27
- if (!ce(s) || ue(s))
28
- return !1;
29
- try {
30
- return Object.keys(s).length === 0 && Object.getPrototypeOf(s) === Object.prototype;
31
- } catch {
32
- return !1;
33
- }
34
- }, ls = M("Date"), us = M("File"), cs = M("Blob"), fs = M("FileList"), ds = (s) => ce(s) && j(s.pipe), hs = (s) => {
35
- let e;
36
- return s && (typeof FormData == "function" && s instanceof FormData || j(s.append) && ((e = Pe(s)) === "formdata" || // detect form-data instance
37
- e === "object" && j(s.toString) && s.toString() === "[object FormData]"));
38
- }, ps = M("URLSearchParams"), [gs, ms, ys, bs] = ["ReadableStream", "Request", "Response", "Headers"].map(M), xs = (s) => s.trim ? s.trim() : s.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
39
- function fe(s, e, { allOwnKeys: t = !1 } = {}) {
40
- if (s === null || typeof s > "u")
41
- return;
42
- let n, r;
43
- if (typeof s != "object" && (s = [s]), te(s))
44
- for (n = 0, r = s.length; n < r; n++)
45
- e.call(null, s[n], n, s);
46
- else {
47
- if (ue(s))
48
- return;
49
- const i = t ? Object.getOwnPropertyNames(s) : Object.keys(s), o = i.length;
50
- let a;
51
- for (n = 0; n < o; n++)
52
- a = i[n], e.call(null, s[a], a, s);
53
- }
54
- }
55
- function Nt(s, e) {
56
- if (ue(s))
57
- return null;
58
- e = e.toLowerCase();
59
- const t = Object.keys(s);
60
- let n = t.length, r;
61
- for (; n-- > 0; )
62
- if (r = t[n], e === r.toLowerCase())
63
- return r;
64
- return null;
65
- }
66
- const Z = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : global, At = (s) => !ee(s) && s !== Z;
67
- function Ue() {
68
- const { caseless: s, skipUndefined: e } = At(this) && this || {}, t = {}, n = (r, i) => {
69
- const o = s && Nt(t, i) || i;
70
- ye(t[o]) && ye(r) ? t[o] = Ue(t[o], r) : ye(r) ? t[o] = Ue({}, r) : te(r) ? t[o] = r.slice() : (!e || !ee(r)) && (t[o] = r);
71
- };
72
- for (let r = 0, i = arguments.length; r < i; r++)
73
- arguments[r] && fe(arguments[r], n);
74
- return t;
75
- }
76
- const ws = (s, e, t, { allOwnKeys: n } = {}) => (fe(e, (r, i) => {
77
- t && j(r) ? s[i] = Pt(r, t) : s[i] = r;
78
- }, { allOwnKeys: n }), s), Ss = (s) => (s.charCodeAt(0) === 65279 && (s = s.slice(1)), s), Os = (s, e, t, n) => {
79
- s.prototype = Object.create(e.prototype, n), s.prototype.constructor = s, Object.defineProperty(s, "super", {
80
- value: e.prototype
81
- }), t && Object.assign(s.prototype, t);
82
- }, Rs = (s, e, t, n) => {
83
- let r, i, o;
84
- const a = {};
85
- if (e = e || {}, s == null) return e;
86
- do {
87
- for (r = Object.getOwnPropertyNames(s), i = r.length; i-- > 0; )
88
- o = r[i], (!n || n(o, s, e)) && !a[o] && (e[o] = s[o], a[o] = !0);
89
- s = t !== !1 && Me(s);
90
- } while (s && (!t || t(s, e)) && s !== Object.prototype);
91
- return e;
92
- }, Es = (s, e, t) => {
93
- s = String(s), (t === void 0 || t > s.length) && (t = s.length), t -= e.length;
94
- const n = s.indexOf(e, t);
95
- return n !== -1 && n === t;
96
- }, Ps = (s) => {
97
- if (!s) return null;
98
- if (te(s)) return s;
99
- let e = s.length;
100
- if (!Tt(e)) return null;
101
- const t = new Array(e);
102
- for (; e-- > 0; )
103
- t[e] = s[e];
104
- return t;
105
- }, Cs = /* @__PURE__ */ ((s) => (e) => s && e instanceof s)(typeof Uint8Array < "u" && Me(Uint8Array)), Ls = (s, e) => {
106
- const n = (s && s[Ee]).call(s);
107
- let r;
108
- for (; (r = n.next()) && !r.done; ) {
109
- const i = r.value;
110
- e.call(s, i[0], i[1]);
111
- }
112
- }, Ts = (s, e) => {
113
- let t;
114
- const n = [];
115
- for (; (t = s.exec(e)) !== null; )
116
- n.push(t);
117
- return n;
118
- }, Ns = M("HTMLFormElement"), As = (s) => s.toLowerCase().replace(
119
- /[-_\s]([a-z\d])(\w*)/g,
120
- function(t, n, r) {
121
- return n.toUpperCase() + r;
122
- }
123
- ), ze = (({ hasOwnProperty: s }) => (e, t) => s.call(e, t))(Object.prototype), Fs = M("RegExp"), Ft = (s, e) => {
124
- const t = Object.getOwnPropertyDescriptors(s), n = {};
125
- fe(t, (r, i) => {
126
- let o;
127
- (o = e(r, i, s)) !== !1 && (n[i] = o || r);
128
- }), Object.defineProperties(s, n);
129
- }, ks = (s) => {
130
- Ft(s, (e, t) => {
131
- if (j(s) && ["arguments", "caller", "callee"].indexOf(t) !== -1)
132
- return !1;
133
- const n = s[t];
134
- if (j(n)) {
135
- if (e.enumerable = !1, "writable" in e) {
136
- e.writable = !1;
137
- return;
138
- }
139
- e.set || (e.set = () => {
140
- throw Error("Can not rewrite read-only method '" + t + "'");
141
- });
142
- }
143
- });
144
- }, vs = (s, e) => {
145
- const t = {}, n = (r) => {
146
- r.forEach((i) => {
147
- t[i] = !0;
148
- });
149
- };
150
- return te(s) ? n(s) : n(String(s).split(e)), t;
151
- }, $s = () => {
152
- }, Us = (s, e) => s != null && Number.isFinite(s = +s) ? s : e;
153
- function js(s) {
154
- return !!(s && j(s.append) && s[Ct] === "FormData" && s[Ee]);
155
- }
156
- const Is = (s) => {
157
- const e = new Array(10), t = (n, r) => {
158
- if (ce(n)) {
159
- if (e.indexOf(n) >= 0)
160
- return;
161
- if (ue(n))
162
- return n;
163
- if (!("toJSON" in n)) {
164
- e[r] = n;
165
- const i = te(n) ? [] : {};
166
- return fe(n, (o, a) => {
167
- const l = t(o, r + 1);
168
- !ee(l) && (i[a] = l);
169
- }), e[r] = void 0, i;
170
- }
171
- }
172
- return n;
173
- };
174
- return t(s, 0);
175
- }, Ds = M("AsyncFunction"), _s = (s) => s && (ce(s) || j(s)) && j(s.then) && j(s.catch), kt = ((s, e) => s ? setImmediate : e ? ((t, n) => (Z.addEventListener("message", ({ source: r, data: i }) => {
176
- r === Z && i === t && n.length && n.shift()();
177
- }, !1), (r) => {
178
- n.push(r), Z.postMessage(t, "*");
179
- }))(`axios@${Math.random()}`, []) : (t) => setTimeout(t))(
180
- typeof setImmediate == "function",
181
- j(Z.postMessage)
182
- ), Bs = typeof queueMicrotask < "u" ? queueMicrotask.bind(Z) : typeof process < "u" && process.nextTick || kt, Ms = (s) => s != null && j(s[Ee]), d = {
183
- isArray: te,
184
- isArrayBuffer: Lt,
185
- isBuffer: ue,
186
- isFormData: hs,
187
- isArrayBufferView: rs,
188
- isString: is,
189
- isNumber: Tt,
190
- isBoolean: os,
191
- isObject: ce,
192
- isPlainObject: ye,
193
- isEmptyObject: as,
194
- isReadableStream: gs,
195
- isRequest: ms,
196
- isResponse: ys,
197
- isHeaders: bs,
198
- isUndefined: ee,
199
- isDate: ls,
200
- isFile: us,
201
- isBlob: cs,
202
- isRegExp: Fs,
203
- isFunction: j,
204
- isStream: ds,
205
- isURLSearchParams: ps,
206
- isTypedArray: Cs,
207
- isFileList: fs,
208
- forEach: fe,
209
- merge: Ue,
210
- extend: ws,
211
- trim: xs,
212
- stripBOM: Ss,
213
- inherits: Os,
214
- toFlatObject: Rs,
215
- kindOf: Pe,
216
- kindOfTest: M,
217
- endsWith: Es,
218
- toArray: Ps,
219
- forEachEntry: Ls,
220
- matchAll: Ts,
221
- isHTMLForm: Ns,
222
- hasOwnProperty: ze,
223
- hasOwnProp: ze,
224
- // an alias to avoid ESLint no-prototype-builtins detection
225
- reduceDescriptors: Ft,
226
- freezeMethods: ks,
227
- toObjectSet: vs,
228
- toCamelCase: As,
229
- noop: $s,
230
- toFiniteNumber: Us,
231
- findKey: Nt,
232
- global: Z,
233
- isContextDefined: At,
234
- isSpecCompliantForm: js,
235
- toJSONObject: Is,
236
- isAsyncFn: Ds,
237
- isThenable: _s,
238
- setImmediate: kt,
239
- asap: Bs,
240
- isIterable: Ms
241
- };
242
- function x(s, e, t, n, r) {
243
- Error.call(this), Error.captureStackTrace ? Error.captureStackTrace(this, this.constructor) : this.stack = new Error().stack, this.message = s, this.name = "AxiosError", e && (this.code = e), t && (this.config = t), n && (this.request = n), r && (this.response = r, this.status = r.status ? r.status : null);
244
- }
245
- d.inherits(x, Error, {
246
- toJSON: function() {
247
- return {
248
- // Standard
249
- message: this.message,
250
- name: this.name,
251
- // Microsoft
252
- description: this.description,
253
- number: this.number,
254
- // Mozilla
255
- fileName: this.fileName,
256
- lineNumber: this.lineNumber,
257
- columnNumber: this.columnNumber,
258
- stack: this.stack,
259
- // Axios
260
- config: d.toJSONObject(this.config),
261
- code: this.code,
262
- status: this.status
263
- };
264
- }
265
- });
266
- const vt = x.prototype, $t = {};
267
- [
268
- "ERR_BAD_OPTION_VALUE",
269
- "ERR_BAD_OPTION",
270
- "ECONNABORTED",
271
- "ETIMEDOUT",
272
- "ERR_NETWORK",
273
- "ERR_FR_TOO_MANY_REDIRECTS",
274
- "ERR_DEPRECATED",
275
- "ERR_BAD_RESPONSE",
276
- "ERR_BAD_REQUEST",
277
- "ERR_CANCELED",
278
- "ERR_NOT_SUPPORT",
279
- "ERR_INVALID_URL"
280
- // eslint-disable-next-line func-names
281
- ].forEach((s) => {
282
- $t[s] = { value: s };
283
- });
284
- Object.defineProperties(x, $t);
285
- Object.defineProperty(vt, "isAxiosError", { value: !0 });
286
- x.from = (s, e, t, n, r, i) => {
287
- const o = Object.create(vt);
288
- d.toFlatObject(s, o, function(c) {
289
- return c !== Error.prototype;
290
- }, (u) => u !== "isAxiosError");
291
- const a = s && s.message ? s.message : "Error", l = e == null && s ? s.code : e;
292
- return x.call(o, a, l, t, n, r), s && o.cause == null && Object.defineProperty(o, "cause", { value: s, configurable: !0 }), o.name = s && s.name || "Error", i && Object.assign(o, i), o;
293
- };
294
- const Hs = null;
295
- function je(s) {
296
- return d.isPlainObject(s) || d.isArray(s);
297
- }
298
- function Ut(s) {
299
- return d.endsWith(s, "[]") ? s.slice(0, -2) : s;
300
- }
301
- function Je(s, e, t) {
302
- return s ? s.concat(e).map(function(r, i) {
303
- return r = Ut(r), !t && i ? "[" + r + "]" : r;
304
- }).join(t ? "." : "") : e;
305
- }
306
- function qs(s) {
307
- return d.isArray(s) && !s.some(je);
308
- }
309
- const Vs = d.toFlatObject(d, {}, null, function(e) {
310
- return /^is[A-Z]/.test(e);
311
- });
312
- function Le(s, e, t) {
313
- if (!d.isObject(s))
314
- throw new TypeError("target must be an object");
315
- e = e || new FormData(), t = d.toFlatObject(t, {
316
- metaTokens: !0,
317
- dots: !1,
318
- indexes: !1
319
- }, !1, function(m, p) {
320
- return !d.isUndefined(p[m]);
321
- });
322
- const n = t.metaTokens, r = t.visitor || c, i = t.dots, o = t.indexes, l = (t.Blob || typeof Blob < "u" && Blob) && d.isSpecCompliantForm(e);
323
- if (!d.isFunction(r))
324
- throw new TypeError("visitor must be a function");
325
- function u(h) {
326
- if (h === null) return "";
327
- if (d.isDate(h))
328
- return h.toISOString();
329
- if (d.isBoolean(h))
330
- return h.toString();
331
- if (!l && d.isBlob(h))
332
- throw new x("Blob is not supported. Use a Buffer instead.");
333
- return d.isArrayBuffer(h) || d.isTypedArray(h) ? l && typeof Blob == "function" ? new Blob([h]) : Buffer.from(h) : h;
334
- }
335
- function c(h, m, p) {
336
- let w = h;
337
- if (h && !p && typeof h == "object") {
338
- if (d.endsWith(m, "{}"))
339
- m = n ? m : m.slice(0, -2), h = JSON.stringify(h);
340
- else if (d.isArray(h) && qs(h) || (d.isFileList(h) || d.endsWith(m, "[]")) && (w = d.toArray(h)))
341
- return m = Ut(m), w.forEach(function(R, O) {
342
- !(d.isUndefined(R) || R === null) && e.append(
343
- // eslint-disable-next-line no-nested-ternary
344
- o === !0 ? Je([m], O, i) : o === null ? m : m + "[]",
345
- u(R)
346
- );
347
- }), !1;
348
- }
349
- return je(h) ? !0 : (e.append(Je(p, m, i), u(h)), !1);
350
- }
351
- const f = [], g = Object.assign(Vs, {
352
- defaultVisitor: c,
353
- convertValue: u,
354
- isVisitable: je
355
- });
356
- function y(h, m) {
357
- if (!d.isUndefined(h)) {
358
- if (f.indexOf(h) !== -1)
359
- throw Error("Circular reference detected in " + m.join("."));
360
- f.push(h), d.forEach(h, function(w, S) {
361
- (!(d.isUndefined(w) || w === null) && r.call(
362
- e,
363
- w,
364
- d.isString(S) ? S.trim() : S,
365
- m,
366
- g
367
- )) === !0 && y(w, m ? m.concat(S) : [S]);
368
- }), f.pop();
369
- }
370
- }
371
- if (!d.isObject(s))
372
- throw new TypeError("data must be an object");
373
- return y(s), e;
374
- }
375
- function Ze(s) {
376
- const e = {
377
- "!": "%21",
378
- "'": "%27",
379
- "(": "%28",
380
- ")": "%29",
381
- "~": "%7E",
382
- "%20": "+",
383
- "%00": "\0"
384
- };
385
- return encodeURIComponent(s).replace(/[!'()~]|%20|%00/g, function(n) {
386
- return e[n];
387
- });
388
- }
389
- function He(s, e) {
390
- this._pairs = [], s && Le(s, this, e);
391
- }
392
- const jt = He.prototype;
393
- jt.append = function(e, t) {
394
- this._pairs.push([e, t]);
395
- };
396
- jt.toString = function(e) {
397
- const t = e ? function(n) {
398
- return e.call(this, n, Ze);
399
- } : Ze;
400
- return this._pairs.map(function(r) {
401
- return t(r[0]) + "=" + t(r[1]);
402
- }, "").join("&");
403
- };
404
- function Ks(s) {
405
- return encodeURIComponent(s).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+");
406
- }
407
- function It(s, e, t) {
408
- if (!e)
409
- return s;
410
- const n = t && t.encode || Ks;
411
- d.isFunction(t) && (t = {
412
- serialize: t
413
- });
414
- const r = t && t.serialize;
415
- let i;
416
- if (r ? i = r(e, t) : i = d.isURLSearchParams(e) ? e.toString() : new He(e, t).toString(n), i) {
417
- const o = s.indexOf("#");
418
- o !== -1 && (s = s.slice(0, o)), s += (s.indexOf("?") === -1 ? "?" : "&") + i;
419
- }
420
- return s;
421
- }
422
- class We {
423
- constructor() {
424
- this.handlers = [];
425
- }
426
- /**
427
- * Add a new interceptor to the stack
428
- *
429
- * @param {Function} fulfilled The function to handle `then` for a `Promise`
430
- * @param {Function} rejected The function to handle `reject` for a `Promise`
431
- *
432
- * @return {Number} An ID used to remove interceptor later
433
- */
434
- use(e, t, n) {
435
- return this.handlers.push({
436
- fulfilled: e,
437
- rejected: t,
438
- synchronous: n ? n.synchronous : !1,
439
- runWhen: n ? n.runWhen : null
440
- }), this.handlers.length - 1;
441
- }
442
- /**
443
- * Remove an interceptor from the stack
444
- *
445
- * @param {Number} id The ID that was returned by `use`
446
- *
447
- * @returns {void}
448
- */
449
- eject(e) {
450
- this.handlers[e] && (this.handlers[e] = null);
451
- }
452
- /**
453
- * Clear all interceptors from the stack
454
- *
455
- * @returns {void}
456
- */
457
- clear() {
458
- this.handlers && (this.handlers = []);
459
- }
460
- /**
461
- * Iterate over all the registered interceptors
462
- *
463
- * This method is particularly useful for skipping over any
464
- * interceptors that may have become `null` calling `eject`.
465
- *
466
- * @param {Function} fn The function to call for each interceptor
467
- *
468
- * @returns {void}
469
- */
470
- forEach(e) {
471
- d.forEach(this.handlers, function(n) {
472
- n !== null && e(n);
473
- });
474
- }
475
- }
476
- const Dt = {
477
- silentJSONParsing: !0,
478
- forcedJSONParsing: !0,
479
- clarifyTimeoutError: !1
480
- }, zs = typeof URLSearchParams < "u" ? URLSearchParams : He, Js = typeof FormData < "u" ? FormData : null, Zs = typeof Blob < "u" ? Blob : null, Ws = {
481
- isBrowser: !0,
482
- classes: {
483
- URLSearchParams: zs,
484
- FormData: Js,
485
- Blob: Zs
486
- },
487
- protocols: ["http", "https", "file", "blob", "url", "data"]
488
- }, qe = typeof window < "u" && typeof document < "u", Ie = typeof navigator == "object" && navigator || void 0, Gs = qe && (!Ie || ["ReactNative", "NativeScript", "NS"].indexOf(Ie.product) < 0), Qs = typeof WorkerGlobalScope < "u" && // eslint-disable-next-line no-undef
489
- self instanceof WorkerGlobalScope && typeof self.importScripts == "function", Xs = qe && window.location.href || "http://localhost", Ys = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
490
- __proto__: null,
491
- hasBrowserEnv: qe,
492
- hasStandardBrowserEnv: Gs,
493
- hasStandardBrowserWebWorkerEnv: Qs,
494
- navigator: Ie,
495
- origin: Xs
496
- }, Symbol.toStringTag, { value: "Module" })), F = {
497
- ...Ys,
498
- ...Ws
499
- };
500
- function en(s, e) {
501
- return Le(s, new F.classes.URLSearchParams(), {
502
- visitor: function(t, n, r, i) {
503
- return F.isNode && d.isBuffer(t) ? (this.append(n, t.toString("base64")), !1) : i.defaultVisitor.apply(this, arguments);
504
- },
505
- ...e
506
- });
507
- }
508
- function tn(s) {
509
- return d.matchAll(/\w+|\[(\w*)]/g, s).map((e) => e[0] === "[]" ? "" : e[1] || e[0]);
510
- }
511
- function sn(s) {
512
- const e = {}, t = Object.keys(s);
513
- let n;
514
- const r = t.length;
515
- let i;
516
- for (n = 0; n < r; n++)
517
- i = t[n], e[i] = s[i];
518
- return e;
519
- }
520
- function _t(s) {
521
- function e(t, n, r, i) {
522
- let o = t[i++];
523
- if (o === "__proto__") return !0;
524
- const a = Number.isFinite(+o), l = i >= t.length;
525
- return o = !o && d.isArray(r) ? r.length : o, l ? (d.hasOwnProp(r, o) ? r[o] = [r[o], n] : r[o] = n, !a) : ((!r[o] || !d.isObject(r[o])) && (r[o] = []), e(t, n, r[o], i) && d.isArray(r[o]) && (r[o] = sn(r[o])), !a);
526
- }
527
- if (d.isFormData(s) && d.isFunction(s.entries)) {
528
- const t = {};
529
- return d.forEachEntry(s, (n, r) => {
530
- e(tn(n), r, t, 0);
531
- }), t;
532
- }
533
- return null;
534
- }
535
- function nn(s, e, t) {
536
- if (d.isString(s))
537
- try {
538
- return (e || JSON.parse)(s), d.trim(s);
539
- } catch (n) {
540
- if (n.name !== "SyntaxError")
541
- throw n;
542
- }
543
- return (t || JSON.stringify)(s);
544
- }
545
- const de = {
546
- transitional: Dt,
547
- adapter: ["xhr", "http", "fetch"],
548
- transformRequest: [function(e, t) {
549
- const n = t.getContentType() || "", r = n.indexOf("application/json") > -1, i = d.isObject(e);
550
- if (i && d.isHTMLForm(e) && (e = new FormData(e)), d.isFormData(e))
551
- return r ? JSON.stringify(_t(e)) : e;
552
- if (d.isArrayBuffer(e) || d.isBuffer(e) || d.isStream(e) || d.isFile(e) || d.isBlob(e) || d.isReadableStream(e))
553
- return e;
554
- if (d.isArrayBufferView(e))
555
- return e.buffer;
556
- if (d.isURLSearchParams(e))
557
- return t.setContentType("application/x-www-form-urlencoded;charset=utf-8", !1), e.toString();
558
- let a;
559
- if (i) {
560
- if (n.indexOf("application/x-www-form-urlencoded") > -1)
561
- return en(e, this.formSerializer).toString();
562
- if ((a = d.isFileList(e)) || n.indexOf("multipart/form-data") > -1) {
563
- const l = this.env && this.env.FormData;
564
- return Le(
565
- a ? { "files[]": e } : e,
566
- l && new l(),
567
- this.formSerializer
568
- );
569
- }
570
- }
571
- return i || r ? (t.setContentType("application/json", !1), nn(e)) : e;
572
- }],
573
- transformResponse: [function(e) {
574
- const t = this.transitional || de.transitional, n = t && t.forcedJSONParsing, r = this.responseType === "json";
575
- if (d.isResponse(e) || d.isReadableStream(e))
576
- return e;
577
- if (e && d.isString(e) && (n && !this.responseType || r)) {
578
- const o = !(t && t.silentJSONParsing) && r;
579
- try {
580
- return JSON.parse(e, this.parseReviver);
581
- } catch (a) {
582
- if (o)
583
- throw a.name === "SyntaxError" ? x.from(a, x.ERR_BAD_RESPONSE, this, null, this.response) : a;
584
- }
585
- }
586
- return e;
587
- }],
588
- /**
589
- * A timeout in milliseconds to abort a request. If set to 0 (default) a
590
- * timeout is not created.
591
- */
592
- timeout: 0,
593
- xsrfCookieName: "XSRF-TOKEN",
594
- xsrfHeaderName: "X-XSRF-TOKEN",
595
- maxContentLength: -1,
596
- maxBodyLength: -1,
597
- env: {
598
- FormData: F.classes.FormData,
599
- Blob: F.classes.Blob
600
- },
601
- validateStatus: function(e) {
602
- return e >= 200 && e < 300;
603
- },
604
- headers: {
605
- common: {
606
- Accept: "application/json, text/plain, */*",
607
- "Content-Type": void 0
608
- }
609
- }
610
- };
611
- d.forEach(["delete", "get", "head", "post", "put", "patch"], (s) => {
612
- de.headers[s] = {};
613
- });
614
- const rn = d.toObjectSet([
615
- "age",
616
- "authorization",
617
- "content-length",
618
- "content-type",
619
- "etag",
620
- "expires",
621
- "from",
622
- "host",
623
- "if-modified-since",
624
- "if-unmodified-since",
625
- "last-modified",
626
- "location",
627
- "max-forwards",
628
- "proxy-authorization",
629
- "referer",
630
- "retry-after",
631
- "user-agent"
632
- ]), on = (s) => {
633
- const e = {};
634
- let t, n, r;
635
- return s && s.split(`
636
- `).forEach(function(o) {
637
- r = o.indexOf(":"), t = o.substring(0, r).trim().toLowerCase(), n = o.substring(r + 1).trim(), !(!t || e[t] && rn[t]) && (t === "set-cookie" ? e[t] ? e[t].push(n) : e[t] = [n] : e[t] = e[t] ? e[t] + ", " + n : n);
638
- }), e;
639
- }, Ge = Symbol("internals");
640
- function re(s) {
641
- return s && String(s).trim().toLowerCase();
642
- }
643
- function be(s) {
644
- return s === !1 || s == null ? s : d.isArray(s) ? s.map(be) : String(s);
645
- }
646
- function an(s) {
647
- const e = /* @__PURE__ */ Object.create(null), t = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
648
- let n;
649
- for (; n = t.exec(s); )
650
- e[n[1]] = n[2];
651
- return e;
652
- }
653
- const ln = (s) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(s.trim());
654
- function Ae(s, e, t, n, r) {
655
- if (d.isFunction(n))
656
- return n.call(this, e, t);
657
- if (r && (e = t), !!d.isString(e)) {
658
- if (d.isString(n))
659
- return e.indexOf(n) !== -1;
660
- if (d.isRegExp(n))
661
- return n.test(e);
662
- }
663
- }
664
- function un(s) {
665
- return s.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (e, t, n) => t.toUpperCase() + n);
666
- }
667
- function cn(s, e) {
668
- const t = d.toCamelCase(" " + e);
669
- ["get", "set", "has"].forEach((n) => {
670
- Object.defineProperty(s, n + t, {
671
- value: function(r, i, o) {
672
- return this[n].call(this, e, r, i, o);
673
- },
674
- configurable: !0
675
- });
676
- });
677
- }
678
- let I = class {
679
- constructor(e) {
680
- e && this.set(e);
681
- }
682
- set(e, t, n) {
683
- const r = this;
684
- function i(a, l, u) {
685
- const c = re(l);
686
- if (!c)
687
- throw new Error("header name must be a non-empty string");
688
- const f = d.findKey(r, c);
689
- (!f || r[f] === void 0 || u === !0 || u === void 0 && r[f] !== !1) && (r[f || l] = be(a));
690
- }
691
- const o = (a, l) => d.forEach(a, (u, c) => i(u, c, l));
692
- if (d.isPlainObject(e) || e instanceof this.constructor)
693
- o(e, t);
694
- else if (d.isString(e) && (e = e.trim()) && !ln(e))
695
- o(on(e), t);
696
- else if (d.isObject(e) && d.isIterable(e)) {
697
- let a = {}, l, u;
698
- for (const c of e) {
699
- if (!d.isArray(c))
700
- throw TypeError("Object iterator must return a key-value pair");
701
- a[u = c[0]] = (l = a[u]) ? d.isArray(l) ? [...l, c[1]] : [l, c[1]] : c[1];
702
- }
703
- o(a, t);
704
- } else
705
- e != null && i(t, e, n);
706
- return this;
707
- }
708
- get(e, t) {
709
- if (e = re(e), e) {
710
- const n = d.findKey(this, e);
711
- if (n) {
712
- const r = this[n];
713
- if (!t)
714
- return r;
715
- if (t === !0)
716
- return an(r);
717
- if (d.isFunction(t))
718
- return t.call(this, r, n);
719
- if (d.isRegExp(t))
720
- return t.exec(r);
721
- throw new TypeError("parser must be boolean|regexp|function");
722
- }
723
- }
724
- }
725
- has(e, t) {
726
- if (e = re(e), e) {
727
- const n = d.findKey(this, e);
728
- return !!(n && this[n] !== void 0 && (!t || Ae(this, this[n], n, t)));
729
- }
730
- return !1;
731
- }
732
- delete(e, t) {
733
- const n = this;
734
- let r = !1;
735
- function i(o) {
736
- if (o = re(o), o) {
737
- const a = d.findKey(n, o);
738
- a && (!t || Ae(n, n[a], a, t)) && (delete n[a], r = !0);
739
- }
740
- }
741
- return d.isArray(e) ? e.forEach(i) : i(e), r;
742
- }
743
- clear(e) {
744
- const t = Object.keys(this);
745
- let n = t.length, r = !1;
746
- for (; n--; ) {
747
- const i = t[n];
748
- (!e || Ae(this, this[i], i, e, !0)) && (delete this[i], r = !0);
749
- }
750
- return r;
751
- }
752
- normalize(e) {
753
- const t = this, n = {};
754
- return d.forEach(this, (r, i) => {
755
- const o = d.findKey(n, i);
756
- if (o) {
757
- t[o] = be(r), delete t[i];
758
- return;
759
- }
760
- const a = e ? un(i) : String(i).trim();
761
- a !== i && delete t[i], t[a] = be(r), n[a] = !0;
762
- }), this;
763
- }
764
- concat(...e) {
765
- return this.constructor.concat(this, ...e);
766
- }
767
- toJSON(e) {
768
- const t = /* @__PURE__ */ Object.create(null);
769
- return d.forEach(this, (n, r) => {
770
- n != null && n !== !1 && (t[r] = e && d.isArray(n) ? n.join(", ") : n);
771
- }), t;
772
- }
773
- [Symbol.iterator]() {
774
- return Object.entries(this.toJSON())[Symbol.iterator]();
775
- }
776
- toString() {
777
- return Object.entries(this.toJSON()).map(([e, t]) => e + ": " + t).join(`
778
- `);
779
- }
780
- getSetCookie() {
781
- return this.get("set-cookie") || [];
782
- }
783
- get [Symbol.toStringTag]() {
784
- return "AxiosHeaders";
785
- }
786
- static from(e) {
787
- return e instanceof this ? e : new this(e);
788
- }
789
- static concat(e, ...t) {
790
- const n = new this(e);
791
- return t.forEach((r) => n.set(r)), n;
792
- }
793
- static accessor(e) {
794
- const n = (this[Ge] = this[Ge] = {
795
- accessors: {}
796
- }).accessors, r = this.prototype;
797
- function i(o) {
798
- const a = re(o);
799
- n[a] || (cn(r, o), n[a] = !0);
800
- }
801
- return d.isArray(e) ? e.forEach(i) : i(e), this;
802
- }
803
- };
804
- I.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]);
805
- d.reduceDescriptors(I.prototype, ({ value: s }, e) => {
806
- let t = e[0].toUpperCase() + e.slice(1);
807
- return {
808
- get: () => s,
809
- set(n) {
810
- this[t] = n;
811
- }
812
- };
813
- });
814
- d.freezeMethods(I);
815
- function Fe(s, e) {
816
- const t = this || de, n = e || t, r = I.from(n.headers);
817
- let i = n.data;
818
- return d.forEach(s, function(a) {
819
- i = a.call(t, i, r.normalize(), e ? e.status : void 0);
820
- }), r.normalize(), i;
821
- }
822
- function Bt(s) {
823
- return !!(s && s.__CANCEL__);
824
- }
825
- function se(s, e, t) {
826
- x.call(this, s ?? "canceled", x.ERR_CANCELED, e, t), this.name = "CanceledError";
827
- }
828
- d.inherits(se, x, {
829
- __CANCEL__: !0
830
- });
831
- function Mt(s, e, t) {
832
- const n = t.config.validateStatus;
833
- !t.status || !n || n(t.status) ? s(t) : e(new x(
834
- "Request failed with status code " + t.status,
835
- [x.ERR_BAD_REQUEST, x.ERR_BAD_RESPONSE][Math.floor(t.status / 100) - 4],
836
- t.config,
837
- t.request,
838
- t
839
- ));
840
- }
841
- function fn(s) {
842
- const e = /^([-+\w]{1,25})(:?\/\/|:)/.exec(s);
843
- return e && e[1] || "";
844
- }
845
- function dn(s, e) {
846
- s = s || 10;
847
- const t = new Array(s), n = new Array(s);
848
- let r = 0, i = 0, o;
849
- return e = e !== void 0 ? e : 1e3, function(l) {
850
- const u = Date.now(), c = n[i];
851
- o || (o = u), t[r] = l, n[r] = u;
852
- let f = i, g = 0;
853
- for (; f !== r; )
854
- g += t[f++], f = f % s;
855
- if (r = (r + 1) % s, r === i && (i = (i + 1) % s), u - o < e)
856
- return;
857
- const y = c && u - c;
858
- return y ? Math.round(g * 1e3 / y) : void 0;
859
- };
860
- }
861
- function hn(s, e) {
862
- let t = 0, n = 1e3 / e, r, i;
863
- const o = (u, c = Date.now()) => {
864
- t = c, r = null, i && (clearTimeout(i), i = null), s(...u);
865
- };
866
- return [(...u) => {
867
- const c = Date.now(), f = c - t;
868
- f >= n ? o(u, c) : (r = u, i || (i = setTimeout(() => {
869
- i = null, o(r);
870
- }, n - f)));
871
- }, () => r && o(r)];
872
- }
873
- const we = (s, e, t = 3) => {
874
- let n = 0;
875
- const r = dn(50, 250);
876
- return hn((i) => {
877
- const o = i.loaded, a = i.lengthComputable ? i.total : void 0, l = o - n, u = r(l), c = o <= a;
878
- n = o;
879
- const f = {
880
- loaded: o,
881
- total: a,
882
- progress: a ? o / a : void 0,
883
- bytes: l,
884
- rate: u || void 0,
885
- estimated: u && a && c ? (a - o) / u : void 0,
886
- event: i,
887
- lengthComputable: a != null,
888
- [e ? "download" : "upload"]: !0
889
- };
890
- s(f);
891
- }, t);
892
- }, Qe = (s, e) => {
893
- const t = s != null;
894
- return [(n) => e[0]({
895
- lengthComputable: t,
896
- total: s,
897
- loaded: n
898
- }), e[1]];
899
- }, Xe = (s) => (...e) => d.asap(() => s(...e)), pn = F.hasStandardBrowserEnv ? /* @__PURE__ */ ((s, e) => (t) => (t = new URL(t, F.origin), s.protocol === t.protocol && s.host === t.host && (e || s.port === t.port)))(
900
- new URL(F.origin),
901
- F.navigator && /(msie|trident)/i.test(F.navigator.userAgent)
902
- ) : () => !0, gn = F.hasStandardBrowserEnv ? (
903
- // Standard browser envs support document.cookie
904
- {
905
- write(s, e, t, n, r, i, o) {
906
- if (typeof document > "u") return;
907
- const a = [`${s}=${encodeURIComponent(e)}`];
908
- d.isNumber(t) && a.push(`expires=${new Date(t).toUTCString()}`), d.isString(n) && a.push(`path=${n}`), d.isString(r) && a.push(`domain=${r}`), i === !0 && a.push("secure"), d.isString(o) && a.push(`SameSite=${o}`), document.cookie = a.join("; ");
909
- },
910
- read(s) {
911
- if (typeof document > "u") return null;
912
- const e = document.cookie.match(new RegExp("(?:^|; )" + s + "=([^;]*)"));
913
- return e ? decodeURIComponent(e[1]) : null;
914
- },
915
- remove(s) {
916
- this.write(s, "", Date.now() - 864e5, "/");
917
- }
918
- }
919
- ) : (
920
- // Non-standard browser env (web workers, react-native) lack needed support.
921
- {
922
- write() {
923
- },
924
- read() {
925
- return null;
926
- },
927
- remove() {
928
- }
929
- }
930
- );
931
- function mn(s) {
932
- return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(s);
933
- }
934
- function yn(s, e) {
935
- return e ? s.replace(/\/?\/$/, "") + "/" + e.replace(/^\/+/, "") : s;
936
- }
937
- function Ht(s, e, t) {
938
- let n = !mn(e);
939
- return s && (n || t == !1) ? yn(s, e) : e;
940
- }
941
- const Ye = (s) => s instanceof I ? { ...s } : s;
942
- function G(s, e) {
943
- e = e || {};
944
- const t = {};
945
- function n(u, c, f, g) {
946
- return d.isPlainObject(u) && d.isPlainObject(c) ? d.merge.call({ caseless: g }, u, c) : d.isPlainObject(c) ? d.merge({}, c) : d.isArray(c) ? c.slice() : c;
947
- }
948
- function r(u, c, f, g) {
949
- if (d.isUndefined(c)) {
950
- if (!d.isUndefined(u))
951
- return n(void 0, u, f, g);
952
- } else return n(u, c, f, g);
953
- }
954
- function i(u, c) {
955
- if (!d.isUndefined(c))
956
- return n(void 0, c);
957
- }
958
- function o(u, c) {
959
- if (d.isUndefined(c)) {
960
- if (!d.isUndefined(u))
961
- return n(void 0, u);
962
- } else return n(void 0, c);
963
- }
964
- function a(u, c, f) {
965
- if (f in e)
966
- return n(u, c);
967
- if (f in s)
968
- return n(void 0, u);
969
- }
970
- const l = {
971
- url: i,
972
- method: i,
973
- data: i,
974
- baseURL: o,
975
- transformRequest: o,
976
- transformResponse: o,
977
- paramsSerializer: o,
978
- timeout: o,
979
- timeoutMessage: o,
980
- withCredentials: o,
981
- withXSRFToken: o,
982
- adapter: o,
983
- responseType: o,
984
- xsrfCookieName: o,
985
- xsrfHeaderName: o,
986
- onUploadProgress: o,
987
- onDownloadProgress: o,
988
- decompress: o,
989
- maxContentLength: o,
990
- maxBodyLength: o,
991
- beforeRedirect: o,
992
- transport: o,
993
- httpAgent: o,
994
- httpsAgent: o,
995
- cancelToken: o,
996
- socketPath: o,
997
- responseEncoding: o,
998
- validateStatus: a,
999
- headers: (u, c, f) => r(Ye(u), Ye(c), f, !0)
1000
- };
1001
- return d.forEach(Object.keys({ ...s, ...e }), function(c) {
1002
- const f = l[c] || r, g = f(s[c], e[c], c);
1003
- d.isUndefined(g) && f !== a || (t[c] = g);
1004
- }), t;
1005
- }
1006
- const qt = (s) => {
1007
- const e = G({}, s);
1008
- let { data: t, withXSRFToken: n, xsrfHeaderName: r, xsrfCookieName: i, headers: o, auth: a } = e;
1009
- if (e.headers = o = I.from(o), e.url = It(Ht(e.baseURL, e.url, e.allowAbsoluteUrls), s.params, s.paramsSerializer), a && o.set(
1010
- "Authorization",
1011
- "Basic " + btoa((a.username || "") + ":" + (a.password ? unescape(encodeURIComponent(a.password)) : ""))
1012
- ), d.isFormData(t)) {
1013
- if (F.hasStandardBrowserEnv || F.hasStandardBrowserWebWorkerEnv)
1014
- o.setContentType(void 0);
1015
- else if (d.isFunction(t.getHeaders)) {
1016
- const l = t.getHeaders(), u = ["content-type", "content-length"];
1017
- Object.entries(l).forEach(([c, f]) => {
1018
- u.includes(c.toLowerCase()) && o.set(c, f);
1019
- });
1020
- }
1021
- }
1022
- if (F.hasStandardBrowserEnv && (n && d.isFunction(n) && (n = n(e)), n || n !== !1 && pn(e.url))) {
1023
- const l = r && i && gn.read(i);
1024
- l && o.set(r, l);
1025
- }
1026
- return e;
1027
- }, bn = typeof XMLHttpRequest < "u", xn = bn && function(s) {
1028
- return new Promise(function(t, n) {
1029
- const r = qt(s);
1030
- let i = r.data;
1031
- const o = I.from(r.headers).normalize();
1032
- let { responseType: a, onUploadProgress: l, onDownloadProgress: u } = r, c, f, g, y, h;
1033
- function m() {
1034
- y && y(), h && h(), r.cancelToken && r.cancelToken.unsubscribe(c), r.signal && r.signal.removeEventListener("abort", c);
1035
- }
1036
- let p = new XMLHttpRequest();
1037
- p.open(r.method.toUpperCase(), r.url, !0), p.timeout = r.timeout;
1038
- function w() {
1039
- if (!p)
1040
- return;
1041
- const R = I.from(
1042
- "getAllResponseHeaders" in p && p.getAllResponseHeaders()
1043
- ), L = {
1044
- data: !a || a === "text" || a === "json" ? p.responseText : p.response,
1045
- status: p.status,
1046
- statusText: p.statusText,
1047
- headers: R,
1048
- config: s,
1049
- request: p
1050
- };
1051
- Mt(function(T) {
1052
- t(T), m();
1053
- }, function(T) {
1054
- n(T), m();
1055
- }, L), p = null;
1056
- }
1057
- "onloadend" in p ? p.onloadend = w : p.onreadystatechange = function() {
1058
- !p || p.readyState !== 4 || p.status === 0 && !(p.responseURL && p.responseURL.indexOf("file:") === 0) || setTimeout(w);
1059
- }, p.onabort = function() {
1060
- p && (n(new x("Request aborted", x.ECONNABORTED, s, p)), p = null);
1061
- }, p.onerror = function(O) {
1062
- const L = O && O.message ? O.message : "Network Error", v = new x(L, x.ERR_NETWORK, s, p);
1063
- v.event = O || null, n(v), p = null;
1064
- }, p.ontimeout = function() {
1065
- let O = r.timeout ? "timeout of " + r.timeout + "ms exceeded" : "timeout exceeded";
1066
- const L = r.transitional || Dt;
1067
- r.timeoutErrorMessage && (O = r.timeoutErrorMessage), n(new x(
1068
- O,
1069
- L.clarifyTimeoutError ? x.ETIMEDOUT : x.ECONNABORTED,
1070
- s,
1071
- p
1072
- )), p = null;
1073
- }, i === void 0 && o.setContentType(null), "setRequestHeader" in p && d.forEach(o.toJSON(), function(O, L) {
1074
- p.setRequestHeader(L, O);
1075
- }), d.isUndefined(r.withCredentials) || (p.withCredentials = !!r.withCredentials), a && a !== "json" && (p.responseType = r.responseType), u && ([g, h] = we(u, !0), p.addEventListener("progress", g)), l && p.upload && ([f, y] = we(l), p.upload.addEventListener("progress", f), p.upload.addEventListener("loadend", y)), (r.cancelToken || r.signal) && (c = (R) => {
1076
- p && (n(!R || R.type ? new se(null, s, p) : R), p.abort(), p = null);
1077
- }, r.cancelToken && r.cancelToken.subscribe(c), r.signal && (r.signal.aborted ? c() : r.signal.addEventListener("abort", c)));
1078
- const S = fn(r.url);
1079
- if (S && F.protocols.indexOf(S) === -1) {
1080
- n(new x("Unsupported protocol " + S + ":", x.ERR_BAD_REQUEST, s));
1081
- return;
1082
- }
1083
- p.send(i || null);
1084
- });
1085
- }, wn = (s, e) => {
1086
- const { length: t } = s = s ? s.filter(Boolean) : [];
1087
- if (e || t) {
1088
- let n = new AbortController(), r;
1089
- const i = function(u) {
1090
- if (!r) {
1091
- r = !0, a();
1092
- const c = u instanceof Error ? u : this.reason;
1093
- n.abort(c instanceof x ? c : new se(c instanceof Error ? c.message : c));
1094
- }
1095
- };
1096
- let o = e && setTimeout(() => {
1097
- o = null, i(new x(`timeout ${e} of ms exceeded`, x.ETIMEDOUT));
1098
- }, e);
1099
- const a = () => {
1100
- s && (o && clearTimeout(o), o = null, s.forEach((u) => {
1101
- u.unsubscribe ? u.unsubscribe(i) : u.removeEventListener("abort", i);
1102
- }), s = null);
1103
- };
1104
- s.forEach((u) => u.addEventListener("abort", i));
1105
- const { signal: l } = n;
1106
- return l.unsubscribe = () => d.asap(a), l;
1107
- }
1108
- }, Sn = function* (s, e) {
1109
- let t = s.byteLength;
1110
- if (t < e) {
1111
- yield s;
1112
- return;
1113
- }
1114
- let n = 0, r;
1115
- for (; n < t; )
1116
- r = n + e, yield s.slice(n, r), n = r;
1117
- }, On = async function* (s, e) {
1118
- for await (const t of Rn(s))
1119
- yield* Sn(t, e);
1120
- }, Rn = async function* (s) {
1121
- if (s[Symbol.asyncIterator]) {
1122
- yield* s;
1123
- return;
1124
- }
1125
- const e = s.getReader();
1126
- try {
1127
- for (; ; ) {
1128
- const { done: t, value: n } = await e.read();
1129
- if (t)
1130
- break;
1131
- yield n;
1132
- }
1133
- } finally {
1134
- await e.cancel();
1135
- }
1136
- }, et = (s, e, t, n) => {
1137
- const r = On(s, e);
1138
- let i = 0, o, a = (l) => {
1139
- o || (o = !0, n && n(l));
1140
- };
1141
- return new ReadableStream({
1142
- async pull(l) {
1143
- try {
1144
- const { done: u, value: c } = await r.next();
1145
- if (u) {
1146
- a(), l.close();
1147
- return;
1148
- }
1149
- let f = c.byteLength;
1150
- if (t) {
1151
- let g = i += f;
1152
- t(g);
1153
- }
1154
- l.enqueue(new Uint8Array(c));
1155
- } catch (u) {
1156
- throw a(u), u;
1157
- }
1158
- },
1159
- cancel(l) {
1160
- return a(l), r.return();
1161
- }
1162
- }, {
1163
- highWaterMark: 2
1164
- });
1165
- }, tt = 64 * 1024, { isFunction: ge } = d, En = (({ Request: s, Response: e }) => ({
1166
- Request: s,
1167
- Response: e
1168
- }))(d.global), {
1169
- ReadableStream: st,
1170
- TextEncoder: nt
1171
- } = d.global, rt = (s, ...e) => {
1172
- try {
1173
- return !!s(...e);
1174
- } catch {
1175
- return !1;
1176
- }
1177
- }, Pn = (s) => {
1178
- s = d.merge.call({
1179
- skipUndefined: !0
1180
- }, En, s);
1181
- const { fetch: e, Request: t, Response: n } = s, r = e ? ge(e) : typeof fetch == "function", i = ge(t), o = ge(n);
1182
- if (!r)
1183
- return !1;
1184
- const a = r && ge(st), l = r && (typeof nt == "function" ? /* @__PURE__ */ ((h) => (m) => h.encode(m))(new nt()) : async (h) => new Uint8Array(await new t(h).arrayBuffer())), u = i && a && rt(() => {
1185
- let h = !1;
1186
- const m = new t(F.origin, {
1187
- body: new st(),
1188
- method: "POST",
1189
- get duplex() {
1190
- return h = !0, "half";
1191
- }
1192
- }).headers.has("Content-Type");
1193
- return h && !m;
1194
- }), c = o && a && rt(() => d.isReadableStream(new n("").body)), f = {
1195
- stream: c && ((h) => h.body)
1196
- };
1197
- r && ["text", "arrayBuffer", "blob", "formData", "stream"].forEach((h) => {
1198
- !f[h] && (f[h] = (m, p) => {
1199
- let w = m && m[h];
1200
- if (w)
1201
- return w.call(m);
1202
- throw new x(`Response type '${h}' is not supported`, x.ERR_NOT_SUPPORT, p);
1203
- });
1204
- });
1205
- const g = async (h) => {
1206
- if (h == null)
1207
- return 0;
1208
- if (d.isBlob(h))
1209
- return h.size;
1210
- if (d.isSpecCompliantForm(h))
1211
- return (await new t(F.origin, {
1212
- method: "POST",
1213
- body: h
1214
- }).arrayBuffer()).byteLength;
1215
- if (d.isArrayBufferView(h) || d.isArrayBuffer(h))
1216
- return h.byteLength;
1217
- if (d.isURLSearchParams(h) && (h = h + ""), d.isString(h))
1218
- return (await l(h)).byteLength;
1219
- }, y = async (h, m) => {
1220
- const p = d.toFiniteNumber(h.getContentLength());
1221
- return p ?? g(m);
1222
- };
1223
- return async (h) => {
1224
- let {
1225
- url: m,
1226
- method: p,
1227
- data: w,
1228
- signal: S,
1229
- cancelToken: R,
1230
- timeout: O,
1231
- onDownloadProgress: L,
1232
- onUploadProgress: v,
1233
- responseType: T,
1234
- headers: Q,
1235
- withCredentials: D = "same-origin",
1236
- fetchOptions: _
1237
- } = qt(h), he = e || fetch;
1238
- T = T ? (T + "").toLowerCase() : "text";
1239
- let X = wn([S, R && R.toAbortSignal()], O), A = null;
1240
- const N = X && X.unsubscribe && (() => {
1241
- X.unsubscribe();
1242
- });
1243
- let ne;
1244
- try {
1245
- if (v && u && p !== "get" && p !== "head" && (ne = await y(Q, w)) !== 0) {
1246
- let E = new t(m, {
1247
- method: "POST",
1248
- body: w,
1249
- duplex: "half"
1250
- }), U;
1251
- if (d.isFormData(w) && (U = E.headers.get("content-type")) && Q.setContentType(U), E.body) {
1252
- const [V, J] = Qe(
1253
- ne,
1254
- we(Xe(v))
1255
- );
1256
- w = et(E.body, tt, V, J);
1257
- }
1258
- }
1259
- d.isString(D) || (D = D ? "include" : "omit");
1260
- const P = i && "credentials" in t.prototype, B = {
1261
- ..._,
1262
- signal: X,
1263
- method: p.toUpperCase(),
1264
- headers: Q.normalize().toJSON(),
1265
- body: w,
1266
- duplex: "half",
1267
- credentials: P ? D : void 0
1268
- };
1269
- A = i && new t(m, B);
1270
- let $ = await (i ? he(A, _) : he(m, B));
1271
- const z = c && (T === "stream" || T === "response");
1272
- if (c && (L || z && N)) {
1273
- const E = {};
1274
- ["status", "statusText", "headers"].forEach((Ke) => {
1275
- E[Ke] = $[Ke];
1276
- });
1277
- const U = d.toFiniteNumber($.headers.get("content-length")), [V, J] = L && Qe(
1278
- U,
1279
- we(Xe(L), !0)
1280
- ) || [];
1281
- $ = new n(
1282
- et($.body, tt, V, () => {
1283
- J && J(), N && N();
1284
- }),
1285
- E
1286
- );
1287
- }
1288
- T = T || "text";
1289
- let pe = await f[d.findKey(f, T) || "text"]($, h);
1290
- return !z && N && N(), await new Promise((E, U) => {
1291
- Mt(E, U, {
1292
- data: pe,
1293
- headers: I.from($.headers),
1294
- status: $.status,
1295
- statusText: $.statusText,
1296
- config: h,
1297
- request: A
1298
- });
1299
- });
1300
- } catch (P) {
1301
- throw N && N(), P && P.name === "TypeError" && /Load failed|fetch/i.test(P.message) ? Object.assign(
1302
- new x("Network Error", x.ERR_NETWORK, h, A),
1303
- {
1304
- cause: P.cause || P
1305
- }
1306
- ) : x.from(P, P && P.code, h, A);
1307
- }
1308
- };
1309
- }, Cn = /* @__PURE__ */ new Map(), Vt = (s) => {
1310
- let e = s && s.env || {};
1311
- const { fetch: t, Request: n, Response: r } = e, i = [
1312
- n,
1313
- r,
1314
- t
1315
- ];
1316
- let o = i.length, a = o, l, u, c = Cn;
1317
- for (; a--; )
1318
- l = i[a], u = c.get(l), u === void 0 && c.set(l, u = a ? /* @__PURE__ */ new Map() : Pn(e)), c = u;
1319
- return u;
1320
- };
1321
- Vt();
1322
- const Ve = {
1323
- http: Hs,
1324
- xhr: xn,
1325
- fetch: {
1326
- get: Vt
1327
- }
1328
- };
1329
- d.forEach(Ve, (s, e) => {
1330
- if (s) {
1331
- try {
1332
- Object.defineProperty(s, "name", { value: e });
1333
- } catch {
1334
- }
1335
- Object.defineProperty(s, "adapterName", { value: e });
1336
- }
1337
- });
1338
- const it = (s) => `- ${s}`, Ln = (s) => d.isFunction(s) || s === null || s === !1;
1339
- function Tn(s, e) {
1340
- s = d.isArray(s) ? s : [s];
1341
- const { length: t } = s;
1342
- let n, r;
1343
- const i = {};
1344
- for (let o = 0; o < t; o++) {
1345
- n = s[o];
1346
- let a;
1347
- if (r = n, !Ln(n) && (r = Ve[(a = String(n)).toLowerCase()], r === void 0))
1348
- throw new x(`Unknown adapter '${a}'`);
1349
- if (r && (d.isFunction(r) || (r = r.get(e))))
1350
- break;
1351
- i[a || "#" + o] = r;
1352
- }
1353
- if (!r) {
1354
- const o = Object.entries(i).map(
1355
- ([l, u]) => `adapter ${l} ` + (u === !1 ? "is not supported by the environment" : "is not available in the build")
1356
- );
1357
- let a = t ? o.length > 1 ? `since :
1358
- ` + o.map(it).join(`
1359
- `) : " " + it(o[0]) : "as no adapter specified";
1360
- throw new x(
1361
- "There is no suitable adapter to dispatch the request " + a,
1362
- "ERR_NOT_SUPPORT"
1363
- );
1364
- }
1365
- return r;
1366
- }
1367
- const Kt = {
1368
- /**
1369
- * Resolve an adapter from a list of adapter names or functions.
1370
- * @type {Function}
1371
- */
1372
- getAdapter: Tn,
1373
- /**
1374
- * Exposes all known adapters
1375
- * @type {Object<string, Function|Object>}
1376
- */
1377
- adapters: Ve
1378
- };
1379
- function ke(s) {
1380
- if (s.cancelToken && s.cancelToken.throwIfRequested(), s.signal && s.signal.aborted)
1381
- throw new se(null, s);
1382
- }
1383
- function ot(s) {
1384
- return ke(s), s.headers = I.from(s.headers), s.data = Fe.call(
1385
- s,
1386
- s.transformRequest
1387
- ), ["post", "put", "patch"].indexOf(s.method) !== -1 && s.headers.setContentType("application/x-www-form-urlencoded", !1), Kt.getAdapter(s.adapter || de.adapter, s)(s).then(function(n) {
1388
- return ke(s), n.data = Fe.call(
1389
- s,
1390
- s.transformResponse,
1391
- n
1392
- ), n.headers = I.from(n.headers), n;
1393
- }, function(n) {
1394
- return Bt(n) || (ke(s), n && n.response && (n.response.data = Fe.call(
1395
- s,
1396
- s.transformResponse,
1397
- n.response
1398
- ), n.response.headers = I.from(n.response.headers))), Promise.reject(n);
1399
- });
1400
- }
1401
- const zt = "1.13.2", Te = {};
1402
- ["object", "boolean", "number", "function", "string", "symbol"].forEach((s, e) => {
1403
- Te[s] = function(n) {
1404
- return typeof n === s || "a" + (e < 1 ? "n " : " ") + s;
1405
- };
1406
- });
1407
- const at = {};
1408
- Te.transitional = function(e, t, n) {
1409
- function r(i, o) {
1410
- return "[Axios v" + zt + "] Transitional option '" + i + "'" + o + (n ? ". " + n : "");
1411
- }
1412
- return (i, o, a) => {
1413
- if (e === !1)
1414
- throw new x(
1415
- r(o, " has been removed" + (t ? " in " + t : "")),
1416
- x.ERR_DEPRECATED
1417
- );
1418
- return t && !at[o] && (at[o] = !0, console.warn(
1419
- r(
1420
- o,
1421
- " has been deprecated since v" + t + " and will be removed in the near future"
1422
- )
1423
- )), e ? e(i, o, a) : !0;
1424
- };
1425
- };
1426
- Te.spelling = function(e) {
1427
- return (t, n) => (console.warn(`${n} is likely a misspelling of ${e}`), !0);
1428
- };
1429
- function Nn(s, e, t) {
1430
- if (typeof s != "object")
1431
- throw new x("options must be an object", x.ERR_BAD_OPTION_VALUE);
1432
- const n = Object.keys(s);
1433
- let r = n.length;
1434
- for (; r-- > 0; ) {
1435
- const i = n[r], o = e[i];
1436
- if (o) {
1437
- const a = s[i], l = a === void 0 || o(a, i, s);
1438
- if (l !== !0)
1439
- throw new x("option " + i + " must be " + l, x.ERR_BAD_OPTION_VALUE);
1440
- continue;
1441
- }
1442
- if (t !== !0)
1443
- throw new x("Unknown option " + i, x.ERR_BAD_OPTION);
1444
- }
1445
- }
1446
- const xe = {
1447
- assertOptions: Nn,
1448
- validators: Te
1449
- }, H = xe.validators;
1450
- let W = class {
1451
- constructor(e) {
1452
- this.defaults = e || {}, this.interceptors = {
1453
- request: new We(),
1454
- response: new We()
1455
- };
1456
- }
1457
- /**
1458
- * Dispatch a request
1459
- *
1460
- * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
1461
- * @param {?Object} config
1462
- *
1463
- * @returns {Promise} The Promise to be fulfilled
1464
- */
1465
- async request(e, t) {
1466
- try {
1467
- return await this._request(e, t);
1468
- } catch (n) {
1469
- if (n instanceof Error) {
1470
- let r = {};
1471
- Error.captureStackTrace ? Error.captureStackTrace(r) : r = new Error();
1472
- const i = r.stack ? r.stack.replace(/^.+\n/, "") : "";
1473
- try {
1474
- n.stack ? i && !String(n.stack).endsWith(i.replace(/^.+\n.+\n/, "")) && (n.stack += `
1475
- ` + i) : n.stack = i;
1476
- } catch {
1477
- }
1478
- }
1479
- throw n;
1480
- }
1481
- }
1482
- _request(e, t) {
1483
- typeof e == "string" ? (t = t || {}, t.url = e) : t = e || {}, t = G(this.defaults, t);
1484
- const { transitional: n, paramsSerializer: r, headers: i } = t;
1485
- n !== void 0 && xe.assertOptions(n, {
1486
- silentJSONParsing: H.transitional(H.boolean),
1487
- forcedJSONParsing: H.transitional(H.boolean),
1488
- clarifyTimeoutError: H.transitional(H.boolean)
1489
- }, !1), r != null && (d.isFunction(r) ? t.paramsSerializer = {
1490
- serialize: r
1491
- } : xe.assertOptions(r, {
1492
- encode: H.function,
1493
- serialize: H.function
1494
- }, !0)), t.allowAbsoluteUrls !== void 0 || (this.defaults.allowAbsoluteUrls !== void 0 ? t.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls : t.allowAbsoluteUrls = !0), xe.assertOptions(t, {
1495
- baseUrl: H.spelling("baseURL"),
1496
- withXsrfToken: H.spelling("withXSRFToken")
1497
- }, !0), t.method = (t.method || this.defaults.method || "get").toLowerCase();
1498
- let o = i && d.merge(
1499
- i.common,
1500
- i[t.method]
1501
- );
1502
- i && d.forEach(
1503
- ["delete", "get", "head", "post", "put", "patch", "common"],
1504
- (h) => {
1505
- delete i[h];
1506
- }
1507
- ), t.headers = I.concat(o, i);
1508
- const a = [];
1509
- let l = !0;
1510
- this.interceptors.request.forEach(function(m) {
1511
- typeof m.runWhen == "function" && m.runWhen(t) === !1 || (l = l && m.synchronous, a.unshift(m.fulfilled, m.rejected));
1512
- });
1513
- const u = [];
1514
- this.interceptors.response.forEach(function(m) {
1515
- u.push(m.fulfilled, m.rejected);
1516
- });
1517
- let c, f = 0, g;
1518
- if (!l) {
1519
- const h = [ot.bind(this), void 0];
1520
- for (h.unshift(...a), h.push(...u), g = h.length, c = Promise.resolve(t); f < g; )
1521
- c = c.then(h[f++], h[f++]);
1522
- return c;
1523
- }
1524
- g = a.length;
1525
- let y = t;
1526
- for (; f < g; ) {
1527
- const h = a[f++], m = a[f++];
1528
- try {
1529
- y = h(y);
1530
- } catch (p) {
1531
- m.call(this, p);
1532
- break;
1533
- }
1534
- }
1535
- try {
1536
- c = ot.call(this, y);
1537
- } catch (h) {
1538
- return Promise.reject(h);
1539
- }
1540
- for (f = 0, g = u.length; f < g; )
1541
- c = c.then(u[f++], u[f++]);
1542
- return c;
1543
- }
1544
- getUri(e) {
1545
- e = G(this.defaults, e);
1546
- const t = Ht(e.baseURL, e.url, e.allowAbsoluteUrls);
1547
- return It(t, e.params, e.paramsSerializer);
1548
- }
1549
- };
1550
- d.forEach(["delete", "get", "head", "options"], function(e) {
1551
- W.prototype[e] = function(t, n) {
1552
- return this.request(G(n || {}, {
1553
- method: e,
1554
- url: t,
1555
- data: (n || {}).data
1556
- }));
1557
- };
1558
- });
1559
- d.forEach(["post", "put", "patch"], function(e) {
1560
- function t(n) {
1561
- return function(i, o, a) {
1562
- return this.request(G(a || {}, {
1563
- method: e,
1564
- headers: n ? {
1565
- "Content-Type": "multipart/form-data"
1566
- } : {},
1567
- url: i,
1568
- data: o
1569
- }));
1570
- };
1571
- }
1572
- W.prototype[e] = t(), W.prototype[e + "Form"] = t(!0);
1573
- });
1574
- let An = class Jt {
1575
- constructor(e) {
1576
- if (typeof e != "function")
1577
- throw new TypeError("executor must be a function.");
1578
- let t;
1579
- this.promise = new Promise(function(i) {
1580
- t = i;
1581
- });
1582
- const n = this;
1583
- this.promise.then((r) => {
1584
- if (!n._listeners) return;
1585
- let i = n._listeners.length;
1586
- for (; i-- > 0; )
1587
- n._listeners[i](r);
1588
- n._listeners = null;
1589
- }), this.promise.then = (r) => {
1590
- let i;
1591
- const o = new Promise((a) => {
1592
- n.subscribe(a), i = a;
1593
- }).then(r);
1594
- return o.cancel = function() {
1595
- n.unsubscribe(i);
1596
- }, o;
1597
- }, e(function(i, o, a) {
1598
- n.reason || (n.reason = new se(i, o, a), t(n.reason));
1599
- });
1600
- }
1601
- /**
1602
- * Throws a `CanceledError` if cancellation has been requested.
1603
- */
1604
- throwIfRequested() {
1605
- if (this.reason)
1606
- throw this.reason;
1607
- }
1608
- /**
1609
- * Subscribe to the cancel signal
1610
- */
1611
- subscribe(e) {
1612
- if (this.reason) {
1613
- e(this.reason);
1614
- return;
1615
- }
1616
- this._listeners ? this._listeners.push(e) : this._listeners = [e];
1617
- }
1618
- /**
1619
- * Unsubscribe from the cancel signal
1620
- */
1621
- unsubscribe(e) {
1622
- if (!this._listeners)
1623
- return;
1624
- const t = this._listeners.indexOf(e);
1625
- t !== -1 && this._listeners.splice(t, 1);
1626
- }
1627
- toAbortSignal() {
1628
- const e = new AbortController(), t = (n) => {
1629
- e.abort(n);
1630
- };
1631
- return this.subscribe(t), e.signal.unsubscribe = () => this.unsubscribe(t), e.signal;
1632
- }
1633
- /**
1634
- * Returns an object that contains a new `CancelToken` and a function that, when called,
1635
- * cancels the `CancelToken`.
1636
- */
1637
- static source() {
1638
- let e;
1639
- return {
1640
- token: new Jt(function(r) {
1641
- e = r;
1642
- }),
1643
- cancel: e
1644
- };
1645
- }
1646
- };
1647
- function Fn(s) {
1648
- return function(t) {
1649
- return s.apply(null, t);
1650
- };
1651
- }
1652
- function kn(s) {
1653
- return d.isObject(s) && s.isAxiosError === !0;
1654
- }
1655
- const De = {
1656
- Continue: 100,
1657
- SwitchingProtocols: 101,
1658
- Processing: 102,
1659
- EarlyHints: 103,
1660
- Ok: 200,
1661
- Created: 201,
1662
- Accepted: 202,
1663
- NonAuthoritativeInformation: 203,
1664
- NoContent: 204,
1665
- ResetContent: 205,
1666
- PartialContent: 206,
1667
- MultiStatus: 207,
1668
- AlreadyReported: 208,
1669
- ImUsed: 226,
1670
- MultipleChoices: 300,
1671
- MovedPermanently: 301,
1672
- Found: 302,
1673
- SeeOther: 303,
1674
- NotModified: 304,
1675
- UseProxy: 305,
1676
- Unused: 306,
1677
- TemporaryRedirect: 307,
1678
- PermanentRedirect: 308,
1679
- BadRequest: 400,
1680
- Unauthorized: 401,
1681
- PaymentRequired: 402,
1682
- Forbidden: 403,
1683
- NotFound: 404,
1684
- MethodNotAllowed: 405,
1685
- NotAcceptable: 406,
1686
- ProxyAuthenticationRequired: 407,
1687
- RequestTimeout: 408,
1688
- Conflict: 409,
1689
- Gone: 410,
1690
- LengthRequired: 411,
1691
- PreconditionFailed: 412,
1692
- PayloadTooLarge: 413,
1693
- UriTooLong: 414,
1694
- UnsupportedMediaType: 415,
1695
- RangeNotSatisfiable: 416,
1696
- ExpectationFailed: 417,
1697
- ImATeapot: 418,
1698
- MisdirectedRequest: 421,
1699
- UnprocessableEntity: 422,
1700
- Locked: 423,
1701
- FailedDependency: 424,
1702
- TooEarly: 425,
1703
- UpgradeRequired: 426,
1704
- PreconditionRequired: 428,
1705
- TooManyRequests: 429,
1706
- RequestHeaderFieldsTooLarge: 431,
1707
- UnavailableForLegalReasons: 451,
1708
- InternalServerError: 500,
1709
- NotImplemented: 501,
1710
- BadGateway: 502,
1711
- ServiceUnavailable: 503,
1712
- GatewayTimeout: 504,
1713
- HttpVersionNotSupported: 505,
1714
- VariantAlsoNegotiates: 506,
1715
- InsufficientStorage: 507,
1716
- LoopDetected: 508,
1717
- NotExtended: 510,
1718
- NetworkAuthenticationRequired: 511,
1719
- WebServerIsDown: 521,
1720
- ConnectionTimedOut: 522,
1721
- OriginIsUnreachable: 523,
1722
- TimeoutOccurred: 524,
1723
- SslHandshakeFailed: 525,
1724
- InvalidSslCertificate: 526
1725
- };
1726
- Object.entries(De).forEach(([s, e]) => {
1727
- De[e] = s;
1728
- });
1729
- function Zt(s) {
1730
- const e = new W(s), t = Pt(W.prototype.request, e);
1731
- return d.extend(t, W.prototype, e, { allOwnKeys: !0 }), d.extend(t, e, null, { allOwnKeys: !0 }), t.create = function(r) {
1732
- return Zt(G(s, r));
1733
- }, t;
1734
- }
1735
- const C = Zt(de);
1736
- C.Axios = W;
1737
- C.CanceledError = se;
1738
- C.CancelToken = An;
1739
- C.isCancel = Bt;
1740
- C.VERSION = zt;
1741
- C.toFormData = Le;
1742
- C.AxiosError = x;
1743
- C.Cancel = C.CanceledError;
1744
- C.all = function(e) {
1745
- return Promise.all(e);
1746
- };
1747
- C.spread = Fn;
1748
- C.isAxiosError = kn;
1749
- C.mergeConfig = G;
1750
- C.AxiosHeaders = I;
1751
- C.formToJSON = (s) => _t(d.isHTMLForm(s) ? new FormData(s) : s);
1752
- C.getAdapter = Kt.getAdapter;
1753
- C.HttpStatusCode = De;
1754
- C.default = C;
1755
- const {
1756
- Axios: dr,
1757
- AxiosError: hr,
1758
- CanceledError: pr,
1759
- isCancel: gr,
1760
- CancelToken: mr,
1761
- VERSION: yr,
1762
- all: br,
1763
- Cancel: xr,
1764
- isAxiosError: wr,
1765
- spread: Sr,
1766
- toFormData: Or,
1767
- AxiosHeaders: Rr,
1768
- HttpStatusCode: Er,
1769
- formToJSON: Pr,
1770
- getAdapter: Cr,
1771
- mergeConfig: Lr
1772
- } = C, vn = {
1773
- 0: "SUCCESS",
1774
- 3: "NO_AUTH"
1775
- }, lt = {
1776
- 400: "axios.defaults.400",
1777
- 401: "axios.defaults.401",
1778
- 403: "axios.defaults.403",
1779
- 404: "axios.defaults.404",
1780
- 500: "axios.defaults.500",
1781
- 501: "axios.defaults.501",
1782
- 502: "axios.defaults.502",
1783
- 503: "axios.defaults.503",
1784
- 504: "axios.defaults.504",
1785
- 505: "axios.defaults.505",
1786
- 506: "axios.defaults.506",
1787
- 507: "axios.defaults.507"
1788
- }, $n = {
1789
- baseURL: "",
1790
- timeout: 6e4,
1791
- showErrorMsg: !0,
1792
- headers: {
1793
- "Content-Type": "application/x-www-form-urlencoded"
1794
- }
1795
- }, Un = () => null, ut = () => {
1796
- }, b = (s) => typeof s == "string", ie = () => {
1797
- let s, e;
1798
- const t = new Promise((n, r) => {
1799
- s = n, e = r;
1800
- });
1801
- return t.resolve = s, t.reject = e, t;
1802
- }, ct = (s) => s == null ? "" : "" + s, jn = (s, e, t) => {
1803
- s.forEach((n) => {
1804
- e[n] && (t[n] = e[n]);
1805
- });
1806
- }, In = /###/g, ft = (s) => s && s.indexOf("###") > -1 ? s.replace(In, ".") : s, dt = (s) => !s || b(s), oe = (s, e, t) => {
1807
- const n = b(e) ? e.split(".") : e;
1808
- let r = 0;
1809
- for (; r < n.length - 1; ) {
1810
- if (dt(s)) return {};
1811
- const i = ft(n[r]);
1812
- !s[i] && t && (s[i] = new t()), Object.prototype.hasOwnProperty.call(s, i) ? s = s[i] : s = {}, ++r;
1813
- }
1814
- return dt(s) ? {} : {
1815
- obj: s,
1816
- k: ft(n[r])
1817
- };
1818
- }, ht = (s, e, t) => {
1819
- const {
1820
- obj: n,
1821
- k: r
1822
- } = oe(s, e, Object);
1823
- if (n !== void 0 || e.length === 1) {
1824
- n[r] = t;
1825
- return;
1826
- }
1827
- let i = e[e.length - 1], o = e.slice(0, e.length - 1), a = oe(s, o, Object);
1828
- for (; a.obj === void 0 && o.length; )
1829
- i = `${o[o.length - 1]}.${i}`, o = o.slice(0, o.length - 1), a = oe(s, o, Object), a?.obj && typeof a.obj[`${a.k}.${i}`] < "u" && (a.obj = void 0);
1830
- a.obj[`${a.k}.${i}`] = t;
1831
- }, Dn = (s, e, t, n) => {
1832
- const {
1833
- obj: r,
1834
- k: i
1835
- } = oe(s, e, Object);
1836
- r[i] = r[i] || [], r[i].push(t);
1837
- }, Se = (s, e) => {
1838
- const {
1839
- obj: t,
1840
- k: n
1841
- } = oe(s, e);
1842
- if (t && Object.prototype.hasOwnProperty.call(t, n))
1843
- return t[n];
1844
- }, _n = (s, e, t) => {
1845
- const n = Se(s, t);
1846
- return n !== void 0 ? n : Se(e, t);
1847
- }, Wt = (s, e, t) => {
1848
- for (const n in e)
1849
- n !== "__proto__" && n !== "constructor" && (n in s ? b(s[n]) || s[n] instanceof String || b(e[n]) || e[n] instanceof String ? t && (s[n] = e[n]) : Wt(s[n], e[n], t) : s[n] = e[n]);
1850
- return s;
1851
- }, Y = (s) => s.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
1852
- var Bn = {
1853
- "&": "&amp;",
1854
- "<": "&lt;",
1855
- ">": "&gt;",
1856
- '"': "&quot;",
1857
- "'": "&#39;",
1858
- "/": "&#x2F;"
1859
- };
1860
- const Mn = (s) => b(s) ? s.replace(/[&<>"'\/]/g, (e) => Bn[e]) : s;
1861
- class Hn {
1862
- constructor(e) {
1863
- this.capacity = e, this.regExpMap = /* @__PURE__ */ new Map(), this.regExpQueue = [];
1864
- }
1865
- getRegExp(e) {
1866
- const t = this.regExpMap.get(e);
1867
- if (t !== void 0)
1868
- return t;
1869
- const n = new RegExp(e);
1870
- return this.regExpQueue.length === this.capacity && this.regExpMap.delete(this.regExpQueue.shift()), this.regExpMap.set(e, n), this.regExpQueue.push(e), n;
1871
- }
1872
- }
1873
- const qn = [" ", ",", "?", "!", ";"], Vn = new Hn(20), Kn = (s, e, t) => {
1874
- e = e || "", t = t || "";
1875
- const n = qn.filter((o) => e.indexOf(o) < 0 && t.indexOf(o) < 0);
1876
- if (n.length === 0) return !0;
1877
- const r = Vn.getRegExp(`(${n.map((o) => o === "?" ? "\\?" : o).join("|")})`);
1878
- let i = !r.test(s);
1879
- if (!i) {
1880
- const o = s.indexOf(t);
1881
- o > 0 && !r.test(s.substring(0, o)) && (i = !0);
1882
- }
1883
- return i;
1884
- }, _e = (s, e, t = ".") => {
1885
- if (!s) return;
1886
- if (s[e])
1887
- return Object.prototype.hasOwnProperty.call(s, e) ? s[e] : void 0;
1888
- const n = e.split(t);
1889
- let r = s;
1890
- for (let i = 0; i < n.length; ) {
1891
- if (!r || typeof r != "object")
1892
- return;
1893
- let o, a = "";
1894
- for (let l = i; l < n.length; ++l)
1895
- if (l !== i && (a += t), a += n[l], o = r[a], o !== void 0) {
1896
- if (["string", "number", "boolean"].indexOf(typeof o) > -1 && l < n.length - 1)
1897
- continue;
1898
- i += l - i + 1;
1899
- break;
1900
- }
1901
- r = o;
1902
- }
1903
- return r;
1904
- }, le = (s) => s?.replace("_", "-"), zn = {
1905
- type: "logger",
1906
- log(s) {
1907
- this.output("log", s);
1908
- },
1909
- warn(s) {
1910
- this.output("warn", s);
1911
- },
1912
- error(s) {
1913
- this.output("error", s);
1914
- },
1915
- output(s, e) {
1916
- console?.[s]?.apply?.(console, e);
1917
- }
1918
- };
1919
- class Oe {
1920
- constructor(e, t = {}) {
1921
- this.init(e, t);
1922
- }
1923
- init(e, t = {}) {
1924
- this.prefix = t.prefix || "i18next:", this.logger = e || zn, this.options = t, this.debug = t.debug;
1925
- }
1926
- log(...e) {
1927
- return this.forward(e, "log", "", !0);
1928
- }
1929
- warn(...e) {
1930
- return this.forward(e, "warn", "", !0);
1931
- }
1932
- error(...e) {
1933
- return this.forward(e, "error", "");
1934
- }
1935
- deprecate(...e) {
1936
- return this.forward(e, "warn", "WARNING DEPRECATED: ", !0);
1937
- }
1938
- forward(e, t, n, r) {
1939
- return r && !this.debug ? null : (b(e[0]) && (e[0] = `${n}${this.prefix} ${e[0]}`), this.logger[t](e));
1940
- }
1941
- create(e) {
1942
- return new Oe(this.logger, {
1943
- prefix: `${this.prefix}:${e}:`,
1944
- ...this.options
1945
- });
1946
- }
1947
- clone(e) {
1948
- return e = e || this.options, e.prefix = e.prefix || this.prefix, new Oe(this.logger, e);
1949
- }
1950
- }
1951
- var q = new Oe();
1952
- class Ne {
1953
- constructor() {
1954
- this.observers = {};
1955
- }
1956
- on(e, t) {
1957
- return e.split(" ").forEach((n) => {
1958
- this.observers[n] || (this.observers[n] = /* @__PURE__ */ new Map());
1959
- const r = this.observers[n].get(t) || 0;
1960
- this.observers[n].set(t, r + 1);
1961
- }), this;
1962
- }
1963
- off(e, t) {
1964
- if (this.observers[e]) {
1965
- if (!t) {
1966
- delete this.observers[e];
1967
- return;
1968
- }
1969
- this.observers[e].delete(t);
1970
- }
1971
- }
1972
- emit(e, ...t) {
1973
- this.observers[e] && Array.from(this.observers[e].entries()).forEach(([r, i]) => {
1974
- for (let o = 0; o < i; o++)
1975
- r(...t);
1976
- }), this.observers["*"] && Array.from(this.observers["*"].entries()).forEach(([r, i]) => {
1977
- for (let o = 0; o < i; o++)
1978
- r.apply(r, [e, ...t]);
1979
- });
1980
- }
1981
- }
1982
- class pt extends Ne {
1983
- constructor(e, t = {
1984
- ns: ["translation"],
1985
- defaultNS: "translation"
1986
- }) {
1987
- super(), this.data = e || {}, this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.options.ignoreJSONStructure === void 0 && (this.options.ignoreJSONStructure = !0);
1988
- }
1989
- addNamespaces(e) {
1990
- this.options.ns.indexOf(e) < 0 && this.options.ns.push(e);
1991
- }
1992
- removeNamespaces(e) {
1993
- const t = this.options.ns.indexOf(e);
1994
- t > -1 && this.options.ns.splice(t, 1);
1995
- }
1996
- getResource(e, t, n, r = {}) {
1997
- const i = r.keySeparator !== void 0 ? r.keySeparator : this.options.keySeparator, o = r.ignoreJSONStructure !== void 0 ? r.ignoreJSONStructure : this.options.ignoreJSONStructure;
1998
- let a;
1999
- e.indexOf(".") > -1 ? a = e.split(".") : (a = [e, t], n && (Array.isArray(n) ? a.push(...n) : b(n) && i ? a.push(...n.split(i)) : a.push(n)));
2000
- const l = Se(this.data, a);
2001
- return !l && !t && !n && e.indexOf(".") > -1 && (e = a[0], t = a[1], n = a.slice(2).join(".")), l || !o || !b(n) ? l : _e(this.data?.[e]?.[t], n, i);
2002
- }
2003
- addResource(e, t, n, r, i = {
2004
- silent: !1
2005
- }) {
2006
- const o = i.keySeparator !== void 0 ? i.keySeparator : this.options.keySeparator;
2007
- let a = [e, t];
2008
- n && (a = a.concat(o ? n.split(o) : n)), e.indexOf(".") > -1 && (a = e.split("."), r = t, t = a[1]), this.addNamespaces(t), ht(this.data, a, r), i.silent || this.emit("added", e, t, n, r);
2009
- }
2010
- addResources(e, t, n, r = {
2011
- silent: !1
2012
- }) {
2013
- for (const i in n)
2014
- (b(n[i]) || Array.isArray(n[i])) && this.addResource(e, t, i, n[i], {
2015
- silent: !0
2016
- });
2017
- r.silent || this.emit("added", e, t, n);
2018
- }
2019
- addResourceBundle(e, t, n, r, i, o = {
2020
- silent: !1,
2021
- skipCopy: !1
2022
- }) {
2023
- let a = [e, t];
2024
- e.indexOf(".") > -1 && (a = e.split("."), r = n, n = t, t = a[1]), this.addNamespaces(t);
2025
- let l = Se(this.data, a) || {};
2026
- o.skipCopy || (n = JSON.parse(JSON.stringify(n))), r ? Wt(l, n, i) : l = {
2027
- ...l,
2028
- ...n
2029
- }, ht(this.data, a, l), o.silent || this.emit("added", e, t, n);
2030
- }
2031
- removeResourceBundle(e, t) {
2032
- this.hasResourceBundle(e, t) && delete this.data[e][t], this.removeNamespaces(t), this.emit("removed", e, t);
2033
- }
2034
- hasResourceBundle(e, t) {
2035
- return this.getResource(e, t) !== void 0;
2036
- }
2037
- getResourceBundle(e, t) {
2038
- return t || (t = this.options.defaultNS), this.getResource(e, t);
2039
- }
2040
- getDataByLanguage(e) {
2041
- return this.data[e];
2042
- }
2043
- hasLanguageSomeTranslations(e) {
2044
- const t = this.getDataByLanguage(e);
2045
- return !!(t && Object.keys(t) || []).find((r) => t[r] && Object.keys(t[r]).length > 0);
2046
- }
2047
- toJSON() {
2048
- return this.data;
2049
- }
2050
- }
2051
- var Gt = {
2052
- processors: {},
2053
- addPostProcessor(s) {
2054
- this.processors[s.name] = s;
2055
- },
2056
- handle(s, e, t, n, r) {
2057
- return s.forEach((i) => {
2058
- e = this.processors[i]?.process(e, t, n, r) ?? e;
2059
- }), e;
2060
- }
2061
- };
2062
- const Qt = Symbol("i18next/PATH_KEY");
2063
- function Jn() {
2064
- const s = [], e = /* @__PURE__ */ Object.create(null);
2065
- let t;
2066
- return e.get = (n, r) => (t?.revoke?.(), r === Qt ? s : (s.push(r), t = Proxy.revocable(n, e), t.proxy)), Proxy.revocable(/* @__PURE__ */ Object.create(null), e).proxy;
2067
- }
2068
- function Be(s, e) {
2069
- const {
2070
- [Qt]: t
2071
- } = s(Jn());
2072
- return t.join(e?.keySeparator ?? ".");
2073
- }
2074
- const gt = {}, ve = (s) => !b(s) && typeof s != "boolean" && typeof s != "number";
2075
- class Re extends Ne {
2076
- constructor(e, t = {}) {
2077
- super(), jn(["resourceStore", "languageUtils", "pluralResolver", "interpolator", "backendConnector", "i18nFormat", "utils"], e, this), this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.logger = q.create("translator");
2078
- }
2079
- changeLanguage(e) {
2080
- e && (this.language = e);
2081
- }
2082
- exists(e, t = {
2083
- interpolation: {}
2084
- }) {
2085
- const n = {
2086
- ...t
2087
- };
2088
- if (e == null) return !1;
2089
- const r = this.resolve(e, n);
2090
- if (r?.res === void 0) return !1;
2091
- const i = ve(r.res);
2092
- return !(n.returnObjects === !1 && i);
2093
- }
2094
- extractFromKey(e, t) {
2095
- let n = t.nsSeparator !== void 0 ? t.nsSeparator : this.options.nsSeparator;
2096
- n === void 0 && (n = ":");
2097
- const r = t.keySeparator !== void 0 ? t.keySeparator : this.options.keySeparator;
2098
- let i = t.ns || this.options.defaultNS || [];
2099
- const o = n && e.indexOf(n) > -1, a = !this.options.userDefinedKeySeparator && !t.keySeparator && !this.options.userDefinedNsSeparator && !t.nsSeparator && !Kn(e, n, r);
2100
- if (o && !a) {
2101
- const l = e.match(this.interpolator.nestingRegexp);
2102
- if (l && l.length > 0)
2103
- return {
2104
- key: e,
2105
- namespaces: b(i) ? [i] : i
2106
- };
2107
- const u = e.split(n);
2108
- (n !== r || n === r && this.options.ns.indexOf(u[0]) > -1) && (i = u.shift()), e = u.join(r);
2109
- }
2110
- return {
2111
- key: e,
2112
- namespaces: b(i) ? [i] : i
2113
- };
2114
- }
2115
- translate(e, t, n) {
2116
- let r = typeof t == "object" ? {
2117
- ...t
2118
- } : t;
2119
- if (typeof r != "object" && this.options.overloadTranslationOptionHandler && (r = this.options.overloadTranslationOptionHandler(arguments)), typeof r == "object" && (r = {
2120
- ...r
2121
- }), r || (r = {}), e == null) return "";
2122
- typeof e == "function" && (e = Be(e, {
2123
- ...this.options,
2124
- ...r
2125
- })), Array.isArray(e) || (e = [String(e)]);
2126
- const i = r.returnDetails !== void 0 ? r.returnDetails : this.options.returnDetails, o = r.keySeparator !== void 0 ? r.keySeparator : this.options.keySeparator, {
2127
- key: a,
2128
- namespaces: l
2129
- } = this.extractFromKey(e[e.length - 1], r), u = l[l.length - 1];
2130
- let c = r.nsSeparator !== void 0 ? r.nsSeparator : this.options.nsSeparator;
2131
- c === void 0 && (c = ":");
2132
- const f = r.lng || this.language, g = r.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;
2133
- if (f?.toLowerCase() === "cimode")
2134
- return g ? i ? {
2135
- res: `${u}${c}${a}`,
2136
- usedKey: a,
2137
- exactUsedKey: a,
2138
- usedLng: f,
2139
- usedNS: u,
2140
- usedParams: this.getUsedParamsDetails(r)
2141
- } : `${u}${c}${a}` : i ? {
2142
- res: a,
2143
- usedKey: a,
2144
- exactUsedKey: a,
2145
- usedLng: f,
2146
- usedNS: u,
2147
- usedParams: this.getUsedParamsDetails(r)
2148
- } : a;
2149
- const y = this.resolve(e, r);
2150
- let h = y?.res;
2151
- const m = y?.usedKey || a, p = y?.exactUsedKey || a, w = ["[object Number]", "[object Function]", "[object RegExp]"], S = r.joinArrays !== void 0 ? r.joinArrays : this.options.joinArrays, R = !this.i18nFormat || this.i18nFormat.handleAsObject, O = r.count !== void 0 && !b(r.count), L = Re.hasDefaultValue(r), v = O ? this.pluralResolver.getSuffix(f, r.count, r) : "", T = r.ordinal && O ? this.pluralResolver.getSuffix(f, r.count, {
2152
- ordinal: !1
2153
- }) : "", Q = O && !r.ordinal && r.count === 0, D = Q && r[`defaultValue${this.options.pluralSeparator}zero`] || r[`defaultValue${v}`] || r[`defaultValue${T}`] || r.defaultValue;
2154
- let _ = h;
2155
- R && !h && L && (_ = D);
2156
- const he = ve(_), X = Object.prototype.toString.apply(_);
2157
- if (R && _ && he && w.indexOf(X) < 0 && !(b(S) && Array.isArray(_))) {
2158
- if (!r.returnObjects && !this.options.returnObjects) {
2159
- this.options.returnedObjectHandler || this.logger.warn("accessing an object - but returnObjects options is not enabled!");
2160
- const A = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(m, _, {
2161
- ...r,
2162
- ns: l
2163
- }) : `key '${a} (${this.language})' returned an object instead of string.`;
2164
- return i ? (y.res = A, y.usedParams = this.getUsedParamsDetails(r), y) : A;
2165
- }
2166
- if (o) {
2167
- const A = Array.isArray(_), N = A ? [] : {}, ne = A ? p : m;
2168
- for (const P in _)
2169
- if (Object.prototype.hasOwnProperty.call(_, P)) {
2170
- const B = `${ne}${o}${P}`;
2171
- L && !h ? N[P] = this.translate(B, {
2172
- ...r,
2173
- defaultValue: ve(D) ? D[P] : void 0,
2174
- joinArrays: !1,
2175
- ns: l
2176
- }) : N[P] = this.translate(B, {
2177
- ...r,
2178
- joinArrays: !1,
2179
- ns: l
2180
- }), N[P] === B && (N[P] = _[P]);
2181
- }
2182
- h = N;
2183
- }
2184
- } else if (R && b(S) && Array.isArray(h))
2185
- h = h.join(S), h && (h = this.extendTranslation(h, e, r, n));
2186
- else {
2187
- let A = !1, N = !1;
2188
- !this.isValidLookup(h) && L && (A = !0, h = D), this.isValidLookup(h) || (N = !0, h = a);
2189
- const P = (r.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && N ? void 0 : h, B = L && D !== h && this.options.updateMissing;
2190
- if (N || A || B) {
2191
- if (this.logger.log(B ? "updateKey" : "missingKey", f, u, a, B ? D : h), o) {
2192
- const E = this.resolve(a, {
2193
- ...r,
2194
- keySeparator: !1
2195
- });
2196
- E && E.res && this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.");
2197
- }
2198
- let $ = [];
2199
- const z = this.languageUtils.getFallbackCodes(this.options.fallbackLng, r.lng || this.language);
2200
- if (this.options.saveMissingTo === "fallback" && z && z[0])
2201
- for (let E = 0; E < z.length; E++)
2202
- $.push(z[E]);
2203
- else this.options.saveMissingTo === "all" ? $ = this.languageUtils.toResolveHierarchy(r.lng || this.language) : $.push(r.lng || this.language);
2204
- const pe = (E, U, V) => {
2205
- const J = L && V !== h ? V : P;
2206
- this.options.missingKeyHandler ? this.options.missingKeyHandler(E, u, U, J, B, r) : this.backendConnector?.saveMissing && this.backendConnector.saveMissing(E, u, U, J, B, r), this.emit("missingKey", E, u, U, h);
2207
- };
2208
- this.options.saveMissing && (this.options.saveMissingPlurals && O ? $.forEach((E) => {
2209
- const U = this.pluralResolver.getSuffixes(E, r);
2210
- Q && r[`defaultValue${this.options.pluralSeparator}zero`] && U.indexOf(`${this.options.pluralSeparator}zero`) < 0 && U.push(`${this.options.pluralSeparator}zero`), U.forEach((V) => {
2211
- pe([E], a + V, r[`defaultValue${V}`] || D);
2212
- });
2213
- }) : pe($, a, D));
2214
- }
2215
- h = this.extendTranslation(h, e, r, y, n), N && h === a && this.options.appendNamespaceToMissingKey && (h = `${u}${c}${a}`), (N || A) && this.options.parseMissingKeyHandler && (h = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${u}${c}${a}` : a, A ? h : void 0, r));
2216
- }
2217
- return i ? (y.res = h, y.usedParams = this.getUsedParamsDetails(r), y) : h;
2218
- }
2219
- extendTranslation(e, t, n, r, i) {
2220
- if (this.i18nFormat?.parse)
2221
- e = this.i18nFormat.parse(e, {
2222
- ...this.options.interpolation.defaultVariables,
2223
- ...n
2224
- }, n.lng || this.language || r.usedLng, r.usedNS, r.usedKey, {
2225
- resolved: r
2226
- });
2227
- else if (!n.skipInterpolation) {
2228
- n.interpolation && this.interpolator.init({
2229
- ...n,
2230
- interpolation: {
2231
- ...this.options.interpolation,
2232
- ...n.interpolation
2233
- }
2234
- });
2235
- const l = b(e) && (n?.interpolation?.skipOnVariables !== void 0 ? n.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables);
2236
- let u;
2237
- if (l) {
2238
- const f = e.match(this.interpolator.nestingRegexp);
2239
- u = f && f.length;
2240
- }
2241
- let c = n.replace && !b(n.replace) ? n.replace : n;
2242
- if (this.options.interpolation.defaultVariables && (c = {
2243
- ...this.options.interpolation.defaultVariables,
2244
- ...c
2245
- }), e = this.interpolator.interpolate(e, c, n.lng || this.language || r.usedLng, n), l) {
2246
- const f = e.match(this.interpolator.nestingRegexp), g = f && f.length;
2247
- u < g && (n.nest = !1);
2248
- }
2249
- !n.lng && r && r.res && (n.lng = this.language || r.usedLng), n.nest !== !1 && (e = this.interpolator.nest(e, (...f) => i?.[0] === f[0] && !n.context ? (this.logger.warn(`It seems you are nesting recursively key: ${f[0]} in key: ${t[0]}`), null) : this.translate(...f, t), n)), n.interpolation && this.interpolator.reset();
2250
- }
2251
- const o = n.postProcess || this.options.postProcess, a = b(o) ? [o] : o;
2252
- return e != null && a?.length && n.applyPostProcessor !== !1 && (e = Gt.handle(a, e, t, this.options && this.options.postProcessPassResolved ? {
2253
- i18nResolved: {
2254
- ...r,
2255
- usedParams: this.getUsedParamsDetails(n)
2256
- },
2257
- ...n
2258
- } : n, this)), e;
2259
- }
2260
- resolve(e, t = {}) {
2261
- let n, r, i, o, a;
2262
- return b(e) && (e = [e]), e.forEach((l) => {
2263
- if (this.isValidLookup(n)) return;
2264
- const u = this.extractFromKey(l, t), c = u.key;
2265
- r = c;
2266
- let f = u.namespaces;
2267
- this.options.fallbackNS && (f = f.concat(this.options.fallbackNS));
2268
- const g = t.count !== void 0 && !b(t.count), y = g && !t.ordinal && t.count === 0, h = t.context !== void 0 && (b(t.context) || typeof t.context == "number") && t.context !== "", m = t.lngs ? t.lngs : this.languageUtils.toResolveHierarchy(t.lng || this.language, t.fallbackLng);
2269
- f.forEach((p) => {
2270
- this.isValidLookup(n) || (a = p, !gt[`${m[0]}-${p}`] && this.utils?.hasLoadedNamespace && !this.utils?.hasLoadedNamespace(a) && (gt[`${m[0]}-${p}`] = !0, this.logger.warn(`key "${r}" for languages "${m.join(", ")}" won't get resolved as namespace "${a}" was not yet loaded`, "This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")), m.forEach((w) => {
2271
- if (this.isValidLookup(n)) return;
2272
- o = w;
2273
- const S = [c];
2274
- if (this.i18nFormat?.addLookupKeys)
2275
- this.i18nFormat.addLookupKeys(S, c, w, p, t);
2276
- else {
2277
- let O;
2278
- g && (O = this.pluralResolver.getSuffix(w, t.count, t));
2279
- const L = `${this.options.pluralSeparator}zero`, v = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;
2280
- if (g && (t.ordinal && O.indexOf(v) === 0 && S.push(c + O.replace(v, this.options.pluralSeparator)), S.push(c + O), y && S.push(c + L)), h) {
2281
- const T = `${c}${this.options.contextSeparator || "_"}${t.context}`;
2282
- S.push(T), g && (t.ordinal && O.indexOf(v) === 0 && S.push(T + O.replace(v, this.options.pluralSeparator)), S.push(T + O), y && S.push(T + L));
2283
- }
2284
- }
2285
- let R;
2286
- for (; R = S.pop(); )
2287
- this.isValidLookup(n) || (i = R, n = this.getResource(w, p, R, t));
2288
- }));
2289
- });
2290
- }), {
2291
- res: n,
2292
- usedKey: r,
2293
- exactUsedKey: i,
2294
- usedLng: o,
2295
- usedNS: a
2296
- };
2297
- }
2298
- isValidLookup(e) {
2299
- return e !== void 0 && !(!this.options.returnNull && e === null) && !(!this.options.returnEmptyString && e === "");
2300
- }
2301
- getResource(e, t, n, r = {}) {
2302
- return this.i18nFormat?.getResource ? this.i18nFormat.getResource(e, t, n, r) : this.resourceStore.getResource(e, t, n, r);
2303
- }
2304
- getUsedParamsDetails(e = {}) {
2305
- const t = ["defaultValue", "ordinal", "context", "replace", "lng", "lngs", "fallbackLng", "ns", "keySeparator", "nsSeparator", "returnObjects", "returnDetails", "joinArrays", "postProcess", "interpolation"], n = e.replace && !b(e.replace);
2306
- let r = n ? e.replace : e;
2307
- if (n && typeof e.count < "u" && (r.count = e.count), this.options.interpolation.defaultVariables && (r = {
2308
- ...this.options.interpolation.defaultVariables,
2309
- ...r
2310
- }), !n) {
2311
- r = {
2312
- ...r
2313
- };
2314
- for (const i of t)
2315
- delete r[i];
2316
- }
2317
- return r;
2318
- }
2319
- static hasDefaultValue(e) {
2320
- const t = "defaultValue";
2321
- for (const n in e)
2322
- if (Object.prototype.hasOwnProperty.call(e, n) && t === n.substring(0, t.length) && e[n] !== void 0)
2323
- return !0;
2324
- return !1;
2325
- }
2326
- }
2327
- class mt {
2328
- constructor(e) {
2329
- this.options = e, this.supportedLngs = this.options.supportedLngs || !1, this.logger = q.create("languageUtils");
2330
- }
2331
- getScriptPartFromCode(e) {
2332
- if (e = le(e), !e || e.indexOf("-") < 0) return null;
2333
- const t = e.split("-");
2334
- return t.length === 2 || (t.pop(), t[t.length - 1].toLowerCase() === "x") ? null : this.formatLanguageCode(t.join("-"));
2335
- }
2336
- getLanguagePartFromCode(e) {
2337
- if (e = le(e), !e || e.indexOf("-") < 0) return e;
2338
- const t = e.split("-");
2339
- return this.formatLanguageCode(t[0]);
2340
- }
2341
- formatLanguageCode(e) {
2342
- if (b(e) && e.indexOf("-") > -1) {
2343
- let t;
2344
- try {
2345
- t = Intl.getCanonicalLocales(e)[0];
2346
- } catch {
2347
- }
2348
- return t && this.options.lowerCaseLng && (t = t.toLowerCase()), t || (this.options.lowerCaseLng ? e.toLowerCase() : e);
2349
- }
2350
- return this.options.cleanCode || this.options.lowerCaseLng ? e.toLowerCase() : e;
2351
- }
2352
- isSupportedCode(e) {
2353
- return (this.options.load === "languageOnly" || this.options.nonExplicitSupportedLngs) && (e = this.getLanguagePartFromCode(e)), !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.indexOf(e) > -1;
2354
- }
2355
- getBestMatchFromCodes(e) {
2356
- if (!e) return null;
2357
- let t;
2358
- return e.forEach((n) => {
2359
- if (t) return;
2360
- const r = this.formatLanguageCode(n);
2361
- (!this.options.supportedLngs || this.isSupportedCode(r)) && (t = r);
2362
- }), !t && this.options.supportedLngs && e.forEach((n) => {
2363
- if (t) return;
2364
- const r = this.getScriptPartFromCode(n);
2365
- if (this.isSupportedCode(r)) return t = r;
2366
- const i = this.getLanguagePartFromCode(n);
2367
- if (this.isSupportedCode(i)) return t = i;
2368
- t = this.options.supportedLngs.find((o) => {
2369
- if (o === i) return o;
2370
- if (!(o.indexOf("-") < 0 && i.indexOf("-") < 0) && (o.indexOf("-") > 0 && i.indexOf("-") < 0 && o.substring(0, o.indexOf("-")) === i || o.indexOf(i) === 0 && i.length > 1))
2371
- return o;
2372
- });
2373
- }), t || (t = this.getFallbackCodes(this.options.fallbackLng)[0]), t;
2374
- }
2375
- getFallbackCodes(e, t) {
2376
- if (!e) return [];
2377
- if (typeof e == "function" && (e = e(t)), b(e) && (e = [e]), Array.isArray(e)) return e;
2378
- if (!t) return e.default || [];
2379
- let n = e[t];
2380
- return n || (n = e[this.getScriptPartFromCode(t)]), n || (n = e[this.formatLanguageCode(t)]), n || (n = e[this.getLanguagePartFromCode(t)]), n || (n = e.default), n || [];
2381
- }
2382
- toResolveHierarchy(e, t) {
2383
- const n = this.getFallbackCodes((t === !1 ? [] : t) || this.options.fallbackLng || [], e), r = [], i = (o) => {
2384
- o && (this.isSupportedCode(o) ? r.push(o) : this.logger.warn(`rejecting language code not found in supportedLngs: ${o}`));
2385
- };
2386
- return b(e) && (e.indexOf("-") > -1 || e.indexOf("_") > -1) ? (this.options.load !== "languageOnly" && i(this.formatLanguageCode(e)), this.options.load !== "languageOnly" && this.options.load !== "currentOnly" && i(this.getScriptPartFromCode(e)), this.options.load !== "currentOnly" && i(this.getLanguagePartFromCode(e))) : b(e) && i(this.formatLanguageCode(e)), n.forEach((o) => {
2387
- r.indexOf(o) < 0 && i(this.formatLanguageCode(o));
2388
- }), r;
2389
- }
2390
- }
2391
- const yt = {
2392
- zero: 0,
2393
- one: 1,
2394
- two: 2,
2395
- few: 3,
2396
- many: 4,
2397
- other: 5
2398
- }, bt = {
2399
- select: (s) => s === 1 ? "one" : "other",
2400
- resolvedOptions: () => ({
2401
- pluralCategories: ["one", "other"]
2402
- })
2403
- };
2404
- class Zn {
2405
- constructor(e, t = {}) {
2406
- this.languageUtils = e, this.options = t, this.logger = q.create("pluralResolver"), this.pluralRulesCache = {};
2407
- }
2408
- addRule(e, t) {
2409
- this.rules[e] = t;
2410
- }
2411
- clearCache() {
2412
- this.pluralRulesCache = {};
2413
- }
2414
- getRule(e, t = {}) {
2415
- const n = le(e === "dev" ? "en" : e), r = t.ordinal ? "ordinal" : "cardinal", i = JSON.stringify({
2416
- cleanedCode: n,
2417
- type: r
2418
- });
2419
- if (i in this.pluralRulesCache)
2420
- return this.pluralRulesCache[i];
2421
- let o;
2422
- try {
2423
- o = new Intl.PluralRules(n, {
2424
- type: r
2425
- });
2426
- } catch {
2427
- if (!Intl)
2428
- return this.logger.error("No Intl support, please use an Intl polyfill!"), bt;
2429
- if (!e.match(/-|_/)) return bt;
2430
- const l = this.languageUtils.getLanguagePartFromCode(e);
2431
- o = this.getRule(l, t);
2432
- }
2433
- return this.pluralRulesCache[i] = o, o;
2434
- }
2435
- needsPlural(e, t = {}) {
2436
- let n = this.getRule(e, t);
2437
- return n || (n = this.getRule("dev", t)), n?.resolvedOptions().pluralCategories.length > 1;
2438
- }
2439
- getPluralFormsOfKey(e, t, n = {}) {
2440
- return this.getSuffixes(e, n).map((r) => `${t}${r}`);
2441
- }
2442
- getSuffixes(e, t = {}) {
2443
- let n = this.getRule(e, t);
2444
- return n || (n = this.getRule("dev", t)), n ? n.resolvedOptions().pluralCategories.sort((r, i) => yt[r] - yt[i]).map((r) => `${this.options.prepend}${t.ordinal ? `ordinal${this.options.prepend}` : ""}${r}`) : [];
2445
- }
2446
- getSuffix(e, t, n = {}) {
2447
- const r = this.getRule(e, n);
2448
- return r ? `${this.options.prepend}${n.ordinal ? `ordinal${this.options.prepend}` : ""}${r.select(t)}` : (this.logger.warn(`no plural rule found for: ${e}`), this.getSuffix("dev", t, n));
2449
- }
2450
- }
2451
- const xt = (s, e, t, n = ".", r = !0) => {
2452
- let i = _n(s, e, t);
2453
- return !i && r && b(t) && (i = _e(s, t, n), i === void 0 && (i = _e(e, t, n))), i;
2454
- }, $e = (s) => s.replace(/\$/g, "$$$$");
2455
- class wt {
2456
- constructor(e = {}) {
2457
- this.logger = q.create("interpolator"), this.options = e, this.format = e?.interpolation?.format || ((t) => t), this.init(e);
2458
- }
2459
- init(e = {}) {
2460
- e.interpolation || (e.interpolation = {
2461
- escapeValue: !0
2462
- });
2463
- const {
2464
- escape: t,
2465
- escapeValue: n,
2466
- useRawValueToEscape: r,
2467
- prefix: i,
2468
- prefixEscaped: o,
2469
- suffix: a,
2470
- suffixEscaped: l,
2471
- formatSeparator: u,
2472
- unescapeSuffix: c,
2473
- unescapePrefix: f,
2474
- nestingPrefix: g,
2475
- nestingPrefixEscaped: y,
2476
- nestingSuffix: h,
2477
- nestingSuffixEscaped: m,
2478
- nestingOptionsSeparator: p,
2479
- maxReplaces: w,
2480
- alwaysFormat: S
2481
- } = e.interpolation;
2482
- this.escape = t !== void 0 ? t : Mn, this.escapeValue = n !== void 0 ? n : !0, this.useRawValueToEscape = r !== void 0 ? r : !1, this.prefix = i ? Y(i) : o || "{{", this.suffix = a ? Y(a) : l || "}}", this.formatSeparator = u || ",", this.unescapePrefix = c ? "" : f || "-", this.unescapeSuffix = this.unescapePrefix ? "" : c || "", this.nestingPrefix = g ? Y(g) : y || Y("$t("), this.nestingSuffix = h ? Y(h) : m || Y(")"), this.nestingOptionsSeparator = p || ",", this.maxReplaces = w || 1e3, this.alwaysFormat = S !== void 0 ? S : !1, this.resetRegExp();
2483
- }
2484
- reset() {
2485
- this.options && this.init(this.options);
2486
- }
2487
- resetRegExp() {
2488
- const e = (t, n) => t?.source === n ? (t.lastIndex = 0, t) : new RegExp(n, "g");
2489
- this.regexp = e(this.regexp, `${this.prefix}(.+?)${this.suffix}`), this.regexpUnescape = e(this.regexpUnescape, `${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`), this.nestingRegexp = e(this.nestingRegexp, `${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`);
2490
- }
2491
- interpolate(e, t, n, r) {
2492
- let i, o, a;
2493
- const l = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {}, u = (y) => {
2494
- if (y.indexOf(this.formatSeparator) < 0) {
2495
- const w = xt(t, l, y, this.options.keySeparator, this.options.ignoreJSONStructure);
2496
- return this.alwaysFormat ? this.format(w, void 0, n, {
2497
- ...r,
2498
- ...t,
2499
- interpolationkey: y
2500
- }) : w;
2501
- }
2502
- const h = y.split(this.formatSeparator), m = h.shift().trim(), p = h.join(this.formatSeparator).trim();
2503
- return this.format(xt(t, l, m, this.options.keySeparator, this.options.ignoreJSONStructure), p, n, {
2504
- ...r,
2505
- ...t,
2506
- interpolationkey: m
2507
- });
2508
- };
2509
- this.resetRegExp();
2510
- const c = r?.missingInterpolationHandler || this.options.missingInterpolationHandler, f = r?.interpolation?.skipOnVariables !== void 0 ? r.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables;
2511
- return [{
2512
- regex: this.regexpUnescape,
2513
- safeValue: (y) => $e(y)
2514
- }, {
2515
- regex: this.regexp,
2516
- safeValue: (y) => this.escapeValue ? $e(this.escape(y)) : $e(y)
2517
- }].forEach((y) => {
2518
- for (a = 0; i = y.regex.exec(e); ) {
2519
- const h = i[1].trim();
2520
- if (o = u(h), o === void 0)
2521
- if (typeof c == "function") {
2522
- const p = c(e, i, r);
2523
- o = b(p) ? p : "";
2524
- } else if (r && Object.prototype.hasOwnProperty.call(r, h))
2525
- o = "";
2526
- else if (f) {
2527
- o = i[0];
2528
- continue;
2529
- } else
2530
- this.logger.warn(`missed to pass in variable ${h} for interpolating ${e}`), o = "";
2531
- else !b(o) && !this.useRawValueToEscape && (o = ct(o));
2532
- const m = y.safeValue(o);
2533
- if (e = e.replace(i[0], m), f ? (y.regex.lastIndex += o.length, y.regex.lastIndex -= i[0].length) : y.regex.lastIndex = 0, a++, a >= this.maxReplaces)
2534
- break;
2535
- }
2536
- }), e;
2537
- }
2538
- nest(e, t, n = {}) {
2539
- let r, i, o;
2540
- const a = (l, u) => {
2541
- const c = this.nestingOptionsSeparator;
2542
- if (l.indexOf(c) < 0) return l;
2543
- const f = l.split(new RegExp(`${c}[ ]*{`));
2544
- let g = `{${f[1]}`;
2545
- l = f[0], g = this.interpolate(g, o);
2546
- const y = g.match(/'/g), h = g.match(/"/g);
2547
- ((y?.length ?? 0) % 2 === 0 && !h || h.length % 2 !== 0) && (g = g.replace(/'/g, '"'));
2548
- try {
2549
- o = JSON.parse(g), u && (o = {
2550
- ...u,
2551
- ...o
2552
- });
2553
- } catch (m) {
2554
- return this.logger.warn(`failed parsing options string in nesting for key ${l}`, m), `${l}${c}${g}`;
2555
- }
2556
- return o.defaultValue && o.defaultValue.indexOf(this.prefix) > -1 && delete o.defaultValue, l;
2557
- };
2558
- for (; r = this.nestingRegexp.exec(e); ) {
2559
- let l = [];
2560
- o = {
2561
- ...n
2562
- }, o = o.replace && !b(o.replace) ? o.replace : o, o.applyPostProcessor = !1, delete o.defaultValue;
2563
- const u = /{.*}/.test(r[1]) ? r[1].lastIndexOf("}") + 1 : r[1].indexOf(this.formatSeparator);
2564
- if (u !== -1 && (l = r[1].slice(u).split(this.formatSeparator).map((c) => c.trim()).filter(Boolean), r[1] = r[1].slice(0, u)), i = t(a.call(this, r[1].trim(), o), o), i && r[0] === e && !b(i)) return i;
2565
- b(i) || (i = ct(i)), i || (this.logger.warn(`missed to resolve ${r[1]} for nesting ${e}`), i = ""), l.length && (i = l.reduce((c, f) => this.format(c, f, n.lng, {
2566
- ...n,
2567
- interpolationkey: r[1].trim()
2568
- }), i.trim())), e = e.replace(r[0], i), this.regexp.lastIndex = 0;
2569
- }
2570
- return e;
2571
- }
2572
- }
2573
- const Wn = (s) => {
2574
- let e = s.toLowerCase().trim();
2575
- const t = {};
2576
- if (s.indexOf("(") > -1) {
2577
- const n = s.split("(");
2578
- e = n[0].toLowerCase().trim();
2579
- const r = n[1].substring(0, n[1].length - 1);
2580
- e === "currency" && r.indexOf(":") < 0 ? t.currency || (t.currency = r.trim()) : e === "relativetime" && r.indexOf(":") < 0 ? t.range || (t.range = r.trim()) : r.split(";").forEach((o) => {
2581
- if (o) {
2582
- const [a, ...l] = o.split(":"), u = l.join(":").trim().replace(/^'+|'+$/g, ""), c = a.trim();
2583
- t[c] || (t[c] = u), u === "false" && (t[c] = !1), u === "true" && (t[c] = !0), isNaN(u) || (t[c] = parseInt(u, 10));
2584
- }
2585
- });
2586
- }
2587
- return {
2588
- formatName: e,
2589
- formatOptions: t
2590
- };
2591
- }, St = (s) => {
2592
- const e = {};
2593
- return (t, n, r) => {
2594
- let i = r;
2595
- r && r.interpolationkey && r.formatParams && r.formatParams[r.interpolationkey] && r[r.interpolationkey] && (i = {
2596
- ...i,
2597
- [r.interpolationkey]: void 0
2598
- });
2599
- const o = n + JSON.stringify(i);
2600
- let a = e[o];
2601
- return a || (a = s(le(n), r), e[o] = a), a(t);
2602
- };
2603
- }, Gn = (s) => (e, t, n) => s(le(t), n)(e);
2604
- class Qn {
2605
- constructor(e = {}) {
2606
- this.logger = q.create("formatter"), this.options = e, this.init(e);
2607
- }
2608
- init(e, t = {
2609
- interpolation: {}
2610
- }) {
2611
- this.formatSeparator = t.interpolation.formatSeparator || ",";
2612
- const n = t.cacheInBuiltFormats ? St : Gn;
2613
- this.formats = {
2614
- number: n((r, i) => {
2615
- const o = new Intl.NumberFormat(r, {
2616
- ...i
2617
- });
2618
- return (a) => o.format(a);
2619
- }),
2620
- currency: n((r, i) => {
2621
- const o = new Intl.NumberFormat(r, {
2622
- ...i,
2623
- style: "currency"
2624
- });
2625
- return (a) => o.format(a);
2626
- }),
2627
- datetime: n((r, i) => {
2628
- const o = new Intl.DateTimeFormat(r, {
2629
- ...i
2630
- });
2631
- return (a) => o.format(a);
2632
- }),
2633
- relativetime: n((r, i) => {
2634
- const o = new Intl.RelativeTimeFormat(r, {
2635
- ...i
2636
- });
2637
- return (a) => o.format(a, i.range || "day");
2638
- }),
2639
- list: n((r, i) => {
2640
- const o = new Intl.ListFormat(r, {
2641
- ...i
2642
- });
2643
- return (a) => o.format(a);
2644
- })
2645
- };
2646
- }
2647
- add(e, t) {
2648
- this.formats[e.toLowerCase().trim()] = t;
2649
- }
2650
- addCached(e, t) {
2651
- this.formats[e.toLowerCase().trim()] = St(t);
2652
- }
2653
- format(e, t, n, r = {}) {
2654
- const i = t.split(this.formatSeparator);
2655
- if (i.length > 1 && i[0].indexOf("(") > 1 && i[0].indexOf(")") < 0 && i.find((a) => a.indexOf(")") > -1)) {
2656
- const a = i.findIndex((l) => l.indexOf(")") > -1);
2657
- i[0] = [i[0], ...i.splice(1, a)].join(this.formatSeparator);
2658
- }
2659
- return i.reduce((a, l) => {
2660
- const {
2661
- formatName: u,
2662
- formatOptions: c
2663
- } = Wn(l);
2664
- if (this.formats[u]) {
2665
- let f = a;
2666
- try {
2667
- const g = r?.formatParams?.[r.interpolationkey] || {}, y = g.locale || g.lng || r.locale || r.lng || n;
2668
- f = this.formats[u](a, y, {
2669
- ...c,
2670
- ...r,
2671
- ...g
2672
- });
2673
- } catch (g) {
2674
- this.logger.warn(g);
2675
- }
2676
- return f;
2677
- } else
2678
- this.logger.warn(`there was no format function for ${u}`);
2679
- return a;
2680
- }, e);
2681
- }
2682
- }
2683
- const Xn = (s, e) => {
2684
- s.pending[e] !== void 0 && (delete s.pending[e], s.pendingCount--);
2685
- };
2686
- class Yn extends Ne {
2687
- constructor(e, t, n, r = {}) {
2688
- super(), this.backend = e, this.store = t, this.services = n, this.languageUtils = n.languageUtils, this.options = r, this.logger = q.create("backendConnector"), this.waitingReads = [], this.maxParallelReads = r.maxParallelReads || 10, this.readingCalls = 0, this.maxRetries = r.maxRetries >= 0 ? r.maxRetries : 5, this.retryTimeout = r.retryTimeout >= 1 ? r.retryTimeout : 350, this.state = {}, this.queue = [], this.backend?.init?.(n, r.backend, r);
2689
- }
2690
- queueLoad(e, t, n, r) {
2691
- const i = {}, o = {}, a = {}, l = {};
2692
- return e.forEach((u) => {
2693
- let c = !0;
2694
- t.forEach((f) => {
2695
- const g = `${u}|${f}`;
2696
- !n.reload && this.store.hasResourceBundle(u, f) ? this.state[g] = 2 : this.state[g] < 0 || (this.state[g] === 1 ? o[g] === void 0 && (o[g] = !0) : (this.state[g] = 1, c = !1, o[g] === void 0 && (o[g] = !0), i[g] === void 0 && (i[g] = !0), l[f] === void 0 && (l[f] = !0)));
2697
- }), c || (a[u] = !0);
2698
- }), (Object.keys(i).length || Object.keys(o).length) && this.queue.push({
2699
- pending: o,
2700
- pendingCount: Object.keys(o).length,
2701
- loaded: {},
2702
- errors: [],
2703
- callback: r
2704
- }), {
2705
- toLoad: Object.keys(i),
2706
- pending: Object.keys(o),
2707
- toLoadLanguages: Object.keys(a),
2708
- toLoadNamespaces: Object.keys(l)
2709
- };
2710
- }
2711
- loaded(e, t, n) {
2712
- const r = e.split("|"), i = r[0], o = r[1];
2713
- t && this.emit("failedLoading", i, o, t), !t && n && this.store.addResourceBundle(i, o, n, void 0, void 0, {
2714
- skipCopy: !0
2715
- }), this.state[e] = t ? -1 : 2, t && n && (this.state[e] = 0);
2716
- const a = {};
2717
- this.queue.forEach((l) => {
2718
- Dn(l.loaded, [i], o), Xn(l, e), t && l.errors.push(t), l.pendingCount === 0 && !l.done && (Object.keys(l.loaded).forEach((u) => {
2719
- a[u] || (a[u] = {});
2720
- const c = l.loaded[u];
2721
- c.length && c.forEach((f) => {
2722
- a[u][f] === void 0 && (a[u][f] = !0);
2723
- });
2724
- }), l.done = !0, l.errors.length ? l.callback(l.errors) : l.callback());
2725
- }), this.emit("loaded", a), this.queue = this.queue.filter((l) => !l.done);
2726
- }
2727
- read(e, t, n, r = 0, i = this.retryTimeout, o) {
2728
- if (!e.length) return o(null, {});
2729
- if (this.readingCalls >= this.maxParallelReads) {
2730
- this.waitingReads.push({
2731
- lng: e,
2732
- ns: t,
2733
- fcName: n,
2734
- tried: r,
2735
- wait: i,
2736
- callback: o
2737
- });
2738
- return;
2739
- }
2740
- this.readingCalls++;
2741
- const a = (u, c) => {
2742
- if (this.readingCalls--, this.waitingReads.length > 0) {
2743
- const f = this.waitingReads.shift();
2744
- this.read(f.lng, f.ns, f.fcName, f.tried, f.wait, f.callback);
2745
- }
2746
- if (u && c && r < this.maxRetries) {
2747
- setTimeout(() => {
2748
- this.read.call(this, e, t, n, r + 1, i * 2, o);
2749
- }, i);
2750
- return;
2751
- }
2752
- o(u, c);
2753
- }, l = this.backend[n].bind(this.backend);
2754
- if (l.length === 2) {
2755
- try {
2756
- const u = l(e, t);
2757
- u && typeof u.then == "function" ? u.then((c) => a(null, c)).catch(a) : a(null, u);
2758
- } catch (u) {
2759
- a(u);
2760
- }
2761
- return;
2762
- }
2763
- return l(e, t, a);
2764
- }
2765
- prepareLoading(e, t, n = {}, r) {
2766
- if (!this.backend)
2767
- return this.logger.warn("No backend was added via i18next.use. Will not load resources."), r && r();
2768
- b(e) && (e = this.languageUtils.toResolveHierarchy(e)), b(t) && (t = [t]);
2769
- const i = this.queueLoad(e, t, n, r);
2770
- if (!i.toLoad.length)
2771
- return i.pending.length || r(), null;
2772
- i.toLoad.forEach((o) => {
2773
- this.loadOne(o);
2774
- });
2775
- }
2776
- load(e, t, n) {
2777
- this.prepareLoading(e, t, {}, n);
2778
- }
2779
- reload(e, t, n) {
2780
- this.prepareLoading(e, t, {
2781
- reload: !0
2782
- }, n);
2783
- }
2784
- loadOne(e, t = "") {
2785
- const n = e.split("|"), r = n[0], i = n[1];
2786
- this.read(r, i, "read", void 0, void 0, (o, a) => {
2787
- o && this.logger.warn(`${t}loading namespace ${i} for language ${r} failed`, o), !o && a && this.logger.log(`${t}loaded namespace ${i} for language ${r}`, a), this.loaded(e, o, a);
2788
- });
2789
- }
2790
- saveMissing(e, t, n, r, i, o = {}, a = () => {
2791
- }) {
2792
- if (this.services?.utils?.hasLoadedNamespace && !this.services?.utils?.hasLoadedNamespace(t)) {
2793
- this.logger.warn(`did not save key "${n}" as the namespace "${t}" was not yet loaded`, "This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");
2794
- return;
2795
- }
2796
- if (!(n == null || n === "")) {
2797
- if (this.backend?.create) {
2798
- const l = {
2799
- ...o,
2800
- isUpdate: i
2801
- }, u = this.backend.create.bind(this.backend);
2802
- if (u.length < 6)
2803
- try {
2804
- let c;
2805
- u.length === 5 ? c = u(e, t, n, r, l) : c = u(e, t, n, r), c && typeof c.then == "function" ? c.then((f) => a(null, f)).catch(a) : a(null, c);
2806
- } catch (c) {
2807
- a(c);
2808
- }
2809
- else
2810
- u(e, t, n, r, a, l);
2811
- }
2812
- !e || !e[0] || this.store.addResource(e[0], t, n, r);
2813
- }
2814
- }
2815
- }
2816
- const Ot = () => ({
2817
- debug: !1,
2818
- initAsync: !0,
2819
- ns: ["translation"],
2820
- defaultNS: ["translation"],
2821
- fallbackLng: ["dev"],
2822
- fallbackNS: !1,
2823
- supportedLngs: !1,
2824
- nonExplicitSupportedLngs: !1,
2825
- load: "all",
2826
- preload: !1,
2827
- simplifyPluralSuffix: !0,
2828
- keySeparator: ".",
2829
- nsSeparator: ":",
2830
- pluralSeparator: "_",
2831
- contextSeparator: "_",
2832
- partialBundledLanguages: !1,
2833
- saveMissing: !1,
2834
- updateMissing: !1,
2835
- saveMissingTo: "fallback",
2836
- saveMissingPlurals: !0,
2837
- missingKeyHandler: !1,
2838
- missingInterpolationHandler: !1,
2839
- postProcess: !1,
2840
- postProcessPassResolved: !1,
2841
- returnNull: !1,
2842
- returnEmptyString: !0,
2843
- returnObjects: !1,
2844
- joinArrays: !1,
2845
- returnedObjectHandler: !1,
2846
- parseMissingKeyHandler: !1,
2847
- appendNamespaceToMissingKey: !1,
2848
- appendNamespaceToCIMode: !1,
2849
- overloadTranslationOptionHandler: (s) => {
2850
- let e = {};
2851
- if (typeof s[1] == "object" && (e = s[1]), b(s[1]) && (e.defaultValue = s[1]), b(s[2]) && (e.tDescription = s[2]), typeof s[2] == "object" || typeof s[3] == "object") {
2852
- const t = s[3] || s[2];
2853
- Object.keys(t).forEach((n) => {
2854
- e[n] = t[n];
2855
- });
2856
- }
2857
- return e;
2858
- },
2859
- interpolation: {
2860
- escapeValue: !0,
2861
- format: (s) => s,
2862
- prefix: "{{",
2863
- suffix: "}}",
2864
- formatSeparator: ",",
2865
- unescapePrefix: "-",
2866
- nestingPrefix: "$t(",
2867
- nestingSuffix: ")",
2868
- nestingOptionsSeparator: ",",
2869
- maxReplaces: 1e3,
2870
- skipOnVariables: !0
2871
- },
2872
- cacheInBuiltFormats: !0
2873
- }), Rt = (s) => (b(s.ns) && (s.ns = [s.ns]), b(s.fallbackLng) && (s.fallbackLng = [s.fallbackLng]), b(s.fallbackNS) && (s.fallbackNS = [s.fallbackNS]), s.supportedLngs?.indexOf?.("cimode") < 0 && (s.supportedLngs = s.supportedLngs.concat(["cimode"])), typeof s.initImmediate == "boolean" && (s.initAsync = s.initImmediate), s), me = () => {
2874
- }, er = (s) => {
2875
- Object.getOwnPropertyNames(Object.getPrototypeOf(s)).forEach((t) => {
2876
- typeof s[t] == "function" && (s[t] = s[t].bind(s));
2877
- });
2878
- };
2879
- class ae extends Ne {
2880
- constructor(e = {}, t) {
2881
- if (super(), this.options = Rt(e), this.services = {}, this.logger = q, this.modules = {
2882
- external: []
2883
- }, er(this), t && !this.isInitialized && !e.isClone) {
2884
- if (!this.options.initAsync)
2885
- return this.init(e, t), this;
2886
- setTimeout(() => {
2887
- this.init(e, t);
2888
- }, 0);
2889
- }
2890
- }
2891
- init(e = {}, t) {
2892
- this.isInitializing = !0, typeof e == "function" && (t = e, e = {}), e.defaultNS == null && e.ns && (b(e.ns) ? e.defaultNS = e.ns : e.ns.indexOf("translation") < 0 && (e.defaultNS = e.ns[0]));
2893
- const n = Ot();
2894
- this.options = {
2895
- ...n,
2896
- ...this.options,
2897
- ...Rt(e)
2898
- }, this.options.interpolation = {
2899
- ...n.interpolation,
2900
- ...this.options.interpolation
2901
- }, e.keySeparator !== void 0 && (this.options.userDefinedKeySeparator = e.keySeparator), e.nsSeparator !== void 0 && (this.options.userDefinedNsSeparator = e.nsSeparator), typeof this.options.overloadTranslationOptionHandler != "function" && (this.options.overloadTranslationOptionHandler = n.overloadTranslationOptionHandler);
2902
- const r = (u) => u ? typeof u == "function" ? new u() : u : null;
2903
- if (!this.options.isClone) {
2904
- this.modules.logger ? q.init(r(this.modules.logger), this.options) : q.init(null, this.options);
2905
- let u;
2906
- this.modules.formatter ? u = this.modules.formatter : u = Qn;
2907
- const c = new mt(this.options);
2908
- this.store = new pt(this.options.resources, this.options);
2909
- const f = this.services;
2910
- f.logger = q, f.resourceStore = this.store, f.languageUtils = c, f.pluralResolver = new Zn(c, {
2911
- prepend: this.options.pluralSeparator,
2912
- simplifyPluralSuffix: this.options.simplifyPluralSuffix
2913
- }), this.options.interpolation.format && this.options.interpolation.format !== n.interpolation.format && this.logger.deprecate("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"), u && (!this.options.interpolation.format || this.options.interpolation.format === n.interpolation.format) && (f.formatter = r(u), f.formatter.init && f.formatter.init(f, this.options), this.options.interpolation.format = f.formatter.format.bind(f.formatter)), f.interpolator = new wt(this.options), f.utils = {
2914
- hasLoadedNamespace: this.hasLoadedNamespace.bind(this)
2915
- }, f.backendConnector = new Yn(r(this.modules.backend), f.resourceStore, f, this.options), f.backendConnector.on("*", (y, ...h) => {
2916
- this.emit(y, ...h);
2917
- }), this.modules.languageDetector && (f.languageDetector = r(this.modules.languageDetector), f.languageDetector.init && f.languageDetector.init(f, this.options.detection, this.options)), this.modules.i18nFormat && (f.i18nFormat = r(this.modules.i18nFormat), f.i18nFormat.init && f.i18nFormat.init(this)), this.translator = new Re(this.services, this.options), this.translator.on("*", (y, ...h) => {
2918
- this.emit(y, ...h);
2919
- }), this.modules.external.forEach((y) => {
2920
- y.init && y.init(this);
2921
- });
2922
- }
2923
- if (this.format = this.options.interpolation.format, t || (t = me), this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) {
2924
- const u = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
2925
- u.length > 0 && u[0] !== "dev" && (this.options.lng = u[0]);
2926
- }
2927
- !this.services.languageDetector && !this.options.lng && this.logger.warn("init: no languageDetector is used and no lng is defined"), ["getResource", "hasResourceBundle", "getResourceBundle", "getDataByLanguage"].forEach((u) => {
2928
- this[u] = (...c) => this.store[u](...c);
2929
- }), ["addResource", "addResources", "addResourceBundle", "removeResourceBundle"].forEach((u) => {
2930
- this[u] = (...c) => (this.store[u](...c), this);
2931
- });
2932
- const a = ie(), l = () => {
2933
- const u = (c, f) => {
2934
- this.isInitializing = !1, this.isInitialized && !this.initializedStoreOnce && this.logger.warn("init: i18next is already initialized. You should call init just once!"), this.isInitialized = !0, this.options.isClone || this.logger.log("initialized", this.options), this.emit("initialized", this.options), a.resolve(f), t(c, f);
2935
- };
2936
- if (this.languages && !this.isInitialized) return u(null, this.t.bind(this));
2937
- this.changeLanguage(this.options.lng, u);
2938
- };
2939
- return this.options.resources || !this.options.initAsync ? l() : setTimeout(l, 0), a;
2940
- }
2941
- loadResources(e, t = me) {
2942
- let n = t;
2943
- const r = b(e) ? e : this.language;
2944
- if (typeof e == "function" && (n = e), !this.options.resources || this.options.partialBundledLanguages) {
2945
- if (r?.toLowerCase() === "cimode" && (!this.options.preload || this.options.preload.length === 0)) return n();
2946
- const i = [], o = (a) => {
2947
- if (!a || a === "cimode") return;
2948
- this.services.languageUtils.toResolveHierarchy(a).forEach((u) => {
2949
- u !== "cimode" && i.indexOf(u) < 0 && i.push(u);
2950
- });
2951
- };
2952
- r ? o(r) : this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach((l) => o(l)), this.options.preload?.forEach?.((a) => o(a)), this.services.backendConnector.load(i, this.options.ns, (a) => {
2953
- !a && !this.resolvedLanguage && this.language && this.setResolvedLanguage(this.language), n(a);
2954
- });
2955
- } else
2956
- n(null);
2957
- }
2958
- reloadResources(e, t, n) {
2959
- const r = ie();
2960
- return typeof e == "function" && (n = e, e = void 0), typeof t == "function" && (n = t, t = void 0), e || (e = this.languages), t || (t = this.options.ns), n || (n = me), this.services.backendConnector.reload(e, t, (i) => {
2961
- r.resolve(), n(i);
2962
- }), r;
2963
- }
2964
- use(e) {
2965
- if (!e) throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");
2966
- if (!e.type) throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");
2967
- return e.type === "backend" && (this.modules.backend = e), (e.type === "logger" || e.log && e.warn && e.error) && (this.modules.logger = e), e.type === "languageDetector" && (this.modules.languageDetector = e), e.type === "i18nFormat" && (this.modules.i18nFormat = e), e.type === "postProcessor" && Gt.addPostProcessor(e), e.type === "formatter" && (this.modules.formatter = e), e.type === "3rdParty" && this.modules.external.push(e), this;
2968
- }
2969
- setResolvedLanguage(e) {
2970
- if (!(!e || !this.languages) && !(["cimode", "dev"].indexOf(e) > -1)) {
2971
- for (let t = 0; t < this.languages.length; t++) {
2972
- const n = this.languages[t];
2973
- if (!(["cimode", "dev"].indexOf(n) > -1) && this.store.hasLanguageSomeTranslations(n)) {
2974
- this.resolvedLanguage = n;
2975
- break;
2976
- }
2977
- }
2978
- !this.resolvedLanguage && this.languages.indexOf(e) < 0 && this.store.hasLanguageSomeTranslations(e) && (this.resolvedLanguage = e, this.languages.unshift(e));
2979
- }
2980
- }
2981
- changeLanguage(e, t) {
2982
- this.isLanguageChangingTo = e;
2983
- const n = ie();
2984
- this.emit("languageChanging", e);
2985
- const r = (a) => {
2986
- this.language = a, this.languages = this.services.languageUtils.toResolveHierarchy(a), this.resolvedLanguage = void 0, this.setResolvedLanguage(a);
2987
- }, i = (a, l) => {
2988
- l ? this.isLanguageChangingTo === e && (r(l), this.translator.changeLanguage(l), this.isLanguageChangingTo = void 0, this.emit("languageChanged", l), this.logger.log("languageChanged", l)) : this.isLanguageChangingTo = void 0, n.resolve((...u) => this.t(...u)), t && t(a, (...u) => this.t(...u));
2989
- }, o = (a) => {
2990
- !e && !a && this.services.languageDetector && (a = []);
2991
- const l = b(a) ? a : a && a[0], u = this.store.hasLanguageSomeTranslations(l) ? l : this.services.languageUtils.getBestMatchFromCodes(b(a) ? [a] : a);
2992
- u && (this.language || r(u), this.translator.language || this.translator.changeLanguage(u), this.services.languageDetector?.cacheUserLanguage?.(u)), this.loadResources(u, (c) => {
2993
- i(c, u);
2994
- });
2995
- };
2996
- return !e && this.services.languageDetector && !this.services.languageDetector.async ? o(this.services.languageDetector.detect()) : !e && this.services.languageDetector && this.services.languageDetector.async ? this.services.languageDetector.detect.length === 0 ? this.services.languageDetector.detect().then(o) : this.services.languageDetector.detect(o) : o(e), n;
2997
- }
2998
- getFixedT(e, t, n) {
2999
- const r = (i, o, ...a) => {
3000
- let l;
3001
- typeof o != "object" ? l = this.options.overloadTranslationOptionHandler([i, o].concat(a)) : l = {
3002
- ...o
3003
- }, l.lng = l.lng || r.lng, l.lngs = l.lngs || r.lngs, l.ns = l.ns || r.ns, l.keyPrefix !== "" && (l.keyPrefix = l.keyPrefix || n || r.keyPrefix);
3004
- const u = this.options.keySeparator || ".";
3005
- let c;
3006
- return l.keyPrefix && Array.isArray(i) ? c = i.map((f) => (typeof f == "function" && (f = Be(f, {
3007
- ...this.options,
3008
- ...o
3009
- })), `${l.keyPrefix}${u}${f}`)) : (typeof i == "function" && (i = Be(i, {
3010
- ...this.options,
3011
- ...o
3012
- })), c = l.keyPrefix ? `${l.keyPrefix}${u}${i}` : i), this.t(c, l);
3013
- };
3014
- return b(e) ? r.lng = e : r.lngs = e, r.ns = t, r.keyPrefix = n, r;
3015
- }
3016
- t(...e) {
3017
- return this.translator?.translate(...e);
3018
- }
3019
- exists(...e) {
3020
- return this.translator?.exists(...e);
3021
- }
3022
- setDefaultNamespace(e) {
3023
- this.options.defaultNS = e;
3024
- }
3025
- hasLoadedNamespace(e, t = {}) {
3026
- if (!this.isInitialized)
3027
- return this.logger.warn("hasLoadedNamespace: i18next was not initialized", this.languages), !1;
3028
- if (!this.languages || !this.languages.length)
3029
- return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty", this.languages), !1;
3030
- const n = t.lng || this.resolvedLanguage || this.languages[0], r = this.options ? this.options.fallbackLng : !1, i = this.languages[this.languages.length - 1];
3031
- if (n.toLowerCase() === "cimode") return !0;
3032
- const o = (a, l) => {
3033
- const u = this.services.backendConnector.state[`${a}|${l}`];
3034
- return u === -1 || u === 0 || u === 2;
3035
- };
3036
- if (t.precheck) {
3037
- const a = t.precheck(this, o);
3038
- if (a !== void 0) return a;
3039
- }
3040
- return !!(this.hasResourceBundle(n, e) || !this.services.backendConnector.backend || this.options.resources && !this.options.partialBundledLanguages || o(n, e) && (!r || o(i, e)));
3041
- }
3042
- loadNamespaces(e, t) {
3043
- const n = ie();
3044
- return this.options.ns ? (b(e) && (e = [e]), e.forEach((r) => {
3045
- this.options.ns.indexOf(r) < 0 && this.options.ns.push(r);
3046
- }), this.loadResources((r) => {
3047
- n.resolve(), t && t(r);
3048
- }), n) : (t && t(), Promise.resolve());
3049
- }
3050
- loadLanguages(e, t) {
3051
- const n = ie();
3052
- b(e) && (e = [e]);
3053
- const r = this.options.preload || [], i = e.filter((o) => r.indexOf(o) < 0 && this.services.languageUtils.isSupportedCode(o));
3054
- return i.length ? (this.options.preload = r.concat(i), this.loadResources((o) => {
3055
- n.resolve(), t && t(o);
3056
- }), n) : (t && t(), Promise.resolve());
3057
- }
3058
- dir(e) {
3059
- if (e || (e = this.resolvedLanguage || (this.languages?.length > 0 ? this.languages[0] : this.language)), !e) return "rtl";
3060
- try {
3061
- const r = new Intl.Locale(e);
3062
- if (r && r.getTextInfo) {
3063
- const i = r.getTextInfo();
3064
- if (i && i.direction) return i.direction;
3065
- }
3066
- } catch {
3067
- }
3068
- const t = ["ar", "shu", "sqr", "ssh", "xaa", "yhd", "yud", "aao", "abh", "abv", "acm", "acq", "acw", "acx", "acy", "adf", "ads", "aeb", "aec", "afb", "ajp", "apc", "apd", "arb", "arq", "ars", "ary", "arz", "auz", "avl", "ayh", "ayl", "ayn", "ayp", "bbz", "pga", "he", "iw", "ps", "pbt", "pbu", "pst", "prp", "prd", "ug", "ur", "ydd", "yds", "yih", "ji", "yi", "hbo", "men", "xmn", "fa", "jpr", "peo", "pes", "prs", "dv", "sam", "ckb"], n = this.services?.languageUtils || new mt(Ot());
3069
- return e.toLowerCase().indexOf("-latn") > 1 ? "ltr" : t.indexOf(n.getLanguagePartFromCode(e)) > -1 || e.toLowerCase().indexOf("-arab") > 1 ? "rtl" : "ltr";
3070
- }
3071
- static createInstance(e = {}, t) {
3072
- const n = new ae(e, t);
3073
- return n.createInstance = ae.createInstance, n;
3074
- }
3075
- cloneInstance(e = {}, t = me) {
3076
- const n = e.forkResourceStore;
3077
- n && delete e.forkResourceStore;
3078
- const r = {
3079
- ...this.options,
3080
- ...e,
3081
- isClone: !0
3082
- }, i = new ae(r);
3083
- if ((e.debug !== void 0 || e.prefix !== void 0) && (i.logger = i.logger.clone(e)), ["store", "services", "language"].forEach((a) => {
3084
- i[a] = this[a];
3085
- }), i.services = {
3086
- ...this.services
3087
- }, i.services.utils = {
3088
- hasLoadedNamespace: i.hasLoadedNamespace.bind(i)
3089
- }, n) {
3090
- const a = Object.keys(this.store.data).reduce((l, u) => (l[u] = {
3091
- ...this.store.data[u]
3092
- }, l[u] = Object.keys(l[u]).reduce((c, f) => (c[f] = {
3093
- ...l[u][f]
3094
- }, c), l[u]), l), {});
3095
- i.store = new pt(a, r), i.services.resourceStore = i.store;
3096
- }
3097
- return e.interpolation && (i.services.interpolator = new wt(r)), i.translator = new Re(i.services, r), i.translator.on("*", (a, ...l) => {
3098
- i.emit(a, ...l);
3099
- }), i.init(r, t), i.translator.options = r, i.translator.backendConnector.services.utils = {
3100
- hasLoadedNamespace: i.hasLoadedNamespace.bind(i)
3101
- }, i;
3102
- }
3103
- toJSON() {
3104
- return {
3105
- options: this.options,
3106
- store: this.store,
3107
- language: this.language,
3108
- languages: this.languages,
3109
- resolvedLanguage: this.resolvedLanguage
3110
- };
3111
- }
3112
- }
3113
- const k = ae.createInstance();
3114
- k.createInstance;
3115
- k.dir;
3116
- k.init;
3117
- k.loadResources;
3118
- k.reloadResources;
3119
- k.use;
3120
- k.changeLanguage;
3121
- k.getFixedT;
3122
- k.t;
3123
- k.exists;
3124
- k.setDefaultNamespace;
3125
- k.hasLoadedNamespace;
3126
- k.loadNamespaces;
3127
- k.loadLanguages;
3128
- var tr = {
3129
- hello: "欢迎使用",
3130
- utils: {
3131
- date: {
3132
- noSupport: "@jnrs/shared/date-fns 不支持该语言. 请使用:"
3133
- },
3134
- fullscreen: {
3135
- failedIn: "进入全屏失败:",
3136
- failedOut: "退出全屏失败:"
3137
- },
3138
- validator: {
3139
- isNum: "请输入数字!",
3140
- isNumberGtZero: "数字必须大于0",
3141
- isMobile: "请输入正确的手机号码",
3142
- isPhone: "请输入正确的电话号码!",
3143
- isEmail: "请输入有效的邮箱!",
3144
- isURL: "请输入有效的URL!",
3145
- isLowerCase: "请输入小写字母!",
3146
- isUpperCase: "请输入大写字母!",
3147
- isAlphabets: "请输入大小写字母!",
3148
- isName: "请输入有效的姓名!",
3149
- isFloat: "请输入浮点数!",
3150
- isNull: "必须为空!",
3151
- isCardId: "请输入合法的身份证号!",
3152
- isIntEqZero: "请输入0!",
3153
- isIntGtZero: "整数必须大于0!",
3154
- isIntGteZero: "整数必须大于或等于0!",
3155
- isIntNEqZero: "整数必须不等于0!",
3156
- isIntLtZero: "整数必须小于0!",
3157
- isIntLteZero: "整数必须小于或等于0!",
3158
- isFloatEqZero: "浮点数必须为0!",
3159
- isFloatGtZero: "浮点数必须大于0!",
3160
- isFloatGteZero: "浮点数必须大于或等于0!",
3161
- isFloatNEqZero: "浮点数必须不等于0!",
3162
- isFloatLtZero: "浮点数必须小于0!",
3163
- isFloatLteZero: "浮点数必须小于或等于0!",
3164
- isInteger: "必须为整数!",
3165
- isNumber: "请输入数字!",
3166
- isDigits: "只能输入[0-9]数字!",
3167
- isEnglish: "只能包含英文字符。",
3168
- isTel: "请正确填写您的联系方式",
3169
- isQq: "请正确填写您QQ号码",
3170
- isZipCode: "请正确填写您的邮政编码",
3171
- isPwd: "以字母开头,长度在6-12之间,只能包含字符、数字和下划线",
3172
- isWeakPwd: "只能包含字母(大小写)、数字和特殊字符",
3173
- isStrongPwd: "最小长度 12 位,且必须包含大小写字母、数字和特殊字符",
3174
- ip: "请填写正确的IP地址。",
3175
- stringCheck: "只能包含中文、英文、数字、下划线等字符",
3176
- isChinese: "匹配汉字",
3177
- isChineseChar: "匹配中文(包括汉字和字符)",
3178
- isRightfulString: "判断是否为合法字符(a-zA-Z0-9-_ )",
3179
- isPlateNo: "请输入合法车牌号"
3180
- }
3181
- },
3182
- axios: {
3183
- create: {
3184
- errorMsg: "业务异常,请稍后重试",
3185
- errorRsp: "请求错误",
3186
- noToken: "Token 失效,请重新登录",
3187
- timeout: "请求超时,请重试",
3188
- invalidUrl: "请求地址错误,请检查后重试",
3189
- unknown: "未知错误"
3190
- },
3191
- defaults: {
3192
- 400: "客户端请求有误,请检查请求格式、参数、路径等配置",
3193
- 401: "登录状态失效,请重新登录",
3194
- 403: "无权限访问该资源,请检查权限配置",
3195
- 404: "请求的资源在服务器上不存在",
3196
- 500: "服务器内部错误,请联系管理员",
3197
- 501: "服务器不支持请求的功能",
3198
- 502: "网关错误,请检查代理服务器",
3199
- 503: "服务器暂时过载或维护,请稍后重试",
3200
- 504: "网关超时,请稍后重试",
3201
- 505: "服务器不支持请求的 HTTP 版本",
3202
- 506: "服务器不支持请求的 HTTP 升级版本",
3203
- 507: "服务器无法处理请求,请稍后重试"
3204
- }
3205
- }
3206
- }, sr = {
3207
- hello: "Welcome",
3208
- utils: {
3209
- date: {
3210
- noSupport: "@jnrs/shared/date-fns does not support this language. Please use:"
3211
- },
3212
- fullscreen: {
3213
- failedIn: "Failed to enter fullscreen:",
3214
- failedOut: "Failed to exit fullscreen:"
3215
- },
3216
- validator: {
3217
- isNum: "Please enter a number!",
3218
- isNumberGtZero: "The number must be greater than 0",
3219
- isMobile: "Please enter a valid mobile number",
3220
- isPhone: "Please enter a valid phone number!",
3221
- isEmail: "Please enter a valid email address!",
3222
- isURL: "Please enter a valid URL!",
3223
- isLowerCase: "Please enter lowercase letters only!",
3224
- isUpperCase: "Please enter uppercase letters only!",
3225
- isAlphabets: "Please enter letters (a–z, A–Z) only!",
3226
- isName: "Please enter a valid name!",
3227
- isFloat: "Please enter a floating-point number!",
3228
- isNull: "Must be empty!",
3229
- isCardId: "Please enter a valid ID card number!",
3230
- isIntEqZero: "Value must be 0!",
3231
- isIntGtZero: "Integer must be greater than 0!",
3232
- isIntGteZero: "Integer must be greater than or equal to 0!",
3233
- isIntNEqZero: "Integer must not be equal to 0!",
3234
- isIntLtZero: "Integer must be less than 0!",
3235
- isIntLteZero: "Integer must be less than or equal to 0!",
3236
- isFloatEqZero: "Floating-point number must be 0!",
3237
- isFloatGtZero: "Floating-point number must be greater than 0!",
3238
- isFloatGteZero: "Floating-point number must be greater than or equal to 0!",
3239
- isFloatNEqZero: "Floating-point number must not be equal to 0!",
3240
- isFloatLtZero: "Floating-point number must be less than 0!",
3241
- isFloatLteZero: "Floating-point number must be less than or equal to 0!",
3242
- isInteger: "Must be an integer!",
3243
- isNumber: "Please enter a number!",
3244
- isDigits: "Only digits [0–9] are allowed!",
3245
- isEnglish: "Only English characters are allowed.",
3246
- isTel: "Please provide your correct contact information",
3247
- isQq: "Please enter a valid QQ number",
3248
- isZipCode: "Please enter a valid postal code",
3249
- isPwd: "Must start with a letter, be 6–12 characters long, and contain only letters, digits, and underscores",
3250
- isWeakPwd: "Can only contain letters (uppercase/lowercase), digits, and special characters",
3251
- isStrongPwd: "Minimum 12 characters; must include uppercase letters, lowercase letters, digits, and special characters",
3252
- ip: "Please enter a valid IP address.",
3253
- stringCheck: "Only Chinese, English, digits, underscores, and similar characters are allowed",
3254
- isChinese: "Must be Chinese characters",
3255
- isChineseChar: "Must be Chinese (including characters and symbols)",
3256
- isRightfulString: "Valid characters: a–z, A–Z, 0–9, hyphen (-), underscore (_), and space",
3257
- isPlateNo: "Please enter a valid license plate number"
3258
- }
3259
- },
3260
- axios: {
3261
- create: {
3262
- errorMsg: "Service error. Please try again later.",
3263
- errorRsp: "Request failed",
3264
- noToken: "No valid token available. Please log in again.",
3265
- timeout: "Request timeout. Please try again.",
3266
- invalidUrl: "Invalid request URL. Please check and try again.",
3267
- unknown: "Unknown error"
3268
- },
3269
- defaults: {
3270
- 400: "Bad request. Please check the request format, parameters, URL, etc.",
3271
- 401: "Login session expired. Please log in again.",
3272
- 403: "Access denied. You don't have permission to access this resource.",
3273
- 404: "The requested resource was not found on the server.",
3274
- 500: "Internal server error. Please contact the administrator.",
3275
- 501: "The server does not support the requested functionality.",
3276
- 502: "Bad gateway. Please check your proxy or upstream server.",
3277
- 503: "The server is temporarily unavailable due to overload or maintenance. Please try again later.",
3278
- 504: "Gateway timeout. Please try again later.",
3279
- 505: "The server does not support the HTTP protocol version used in the request.",
3280
- 506: "The server does not support the requested HTTP upgrade version.",
3281
- 507: "The server cannot process the request. Please try again later."
3282
- }
3283
- }
3284
- };
3285
- const Xt = k.createInstance();
3286
- Xt.init({
3287
- lng: "zhCn",
3288
- fallbackLng: "en",
3289
- resources: {
3290
- zhCn: { translation: tr },
3291
- en: { translation: sr }
3292
- }
3293
- });
3294
- const K = Xt.t, nr = ({ options: s, responseMap: e, handleMessageFn: t = ut, handleGetTokenFn: n = Un, handleNoAuthFn: r = ut }) => {
3295
- const i = { ...$n, ...s }, o = { ...vn, ...e }, a = C.create(i);
3296
- return a.interceptors.request.use((l) => {
3297
- if (["get", "delete", "head"].includes(l.method?.toLowerCase() || "") && (l.params = { ...l.data, ...l.params }, delete l.data), l.noAuth === !0)
3298
- return l;
3299
- const u = n();
3300
- return u ? (l.headers.Authorization = `Bearer ${u}`, l) : (r(), l.showErrorMsg && t({
3301
- message: K("axios.create.noToken"),
3302
- type: "error",
3303
- grouping: !0,
3304
- showClose: !0,
3305
- duration: 5e3
3306
- }), Promise.reject({
3307
- message: K("axios.create.noToken")
3308
- }));
3309
- }, (l) => (t({
3310
- message: K("axios.create.errorRsp"),
3311
- type: "warning",
3312
- grouping: !0,
3313
- showClose: !0,
3314
- duration: 5e3
3315
- }), Promise.reject(l))), a.interceptors.response.use((l) => {
3316
- if (!rr(l.data) && !ir(l.data))
3317
- return l.data;
3318
- const { code: u, data: c, msg: f } = l.data;
3319
- return o[u] === "SUCCESS" ? c : (o[u] === "NO_AUTH" && r(), l.config.showErrorMsg && t({
3320
- message: f || K("axios.create.errorMsg"),
3321
- type: "warning",
3322
- grouping: !0,
3323
- showClose: !0,
3324
- duration: 5e3
3325
- }), Promise.reject(l.data));
3326
- }, (l) => {
3327
- let u = "", c = "", f = "";
3328
- if (!l.response)
3329
- l.code === "ECONNABORTED" ? u = K("axios.create.timeout") : l.code === "ERR_INVALID_URL" ? u = K("axios.create.invalidUrl") : u = `${l.message || l.code || K("axios.create.unknown")}`;
3330
- else {
3331
- const { status: g, statusText: y } = l.response;
3332
- c = g, f = y, g in lt ? u = K(lt[g]) : u = `${g} ${y}`, g === 401 && r();
3333
- }
3334
- return l.config?.showErrorMsg && t({
3335
- message: u,
3336
- type: "error",
3337
- grouping: !0,
3338
- showClose: !0,
3339
- duration: 5e3
3340
- }), Promise.reject({
3341
- fillUrl: l.config?.baseURL + l.config?.url,
3342
- message: u,
3343
- code: l.code,
3344
- status: c,
3345
- statusText: f,
3346
- response: l.response
3347
- });
3348
- }), a;
3349
- };
3350
- function rr(s) {
3351
- return s && typeof s == "object" && "code" in s && "msg" in s;
3352
- }
3353
- function ir(s) {
3354
- const e = ["<html>", "<!DOCTYPE", "<!doctype"];
3355
- if (typeof s != "string")
3356
- return !1;
3357
- const t = s;
3358
- return e.some((n) => t.includes(n));
3359
- }
3360
- const Et = nr({
3361
- handleMessageFn: ss,
3362
- handleGetTokenFn: () => {
3363
- const { token: s } = es();
3364
- return s;
3365
- },
3366
- handleNoAuthFn: () => {
3367
- ts({ name: "Login" });
3368
- }
3369
- }), or = (s) => {
3370
- if (!Et)
3371
- throw new Error("请先调用 createRequest 初始化 axios 实例");
3372
- const { isMock: e } = Yt();
3373
- return e && (s.url = s.mockUrl ? s.mockUrl : s.url.startsWith("/mock") ? s.url : "/mock" + s.url), Et(s);
3374
- };
3375
- console.log(
3376
- "%c✨ 欢迎使用 @jnrs/vue-core/request",
3377
- 'background: #42B883; color: #39495C; font-weight: bold; padding: 4px 8px; border-radius: 4px; font-family: "Helvetica Neue", sans-serif;'
3378
- );
3379
- const Tr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3380
- __proto__: null,
3381
- axiosRequest: or
3382
- }, Symbol.toStringTag, { value: "Module" }));
3383
- export {
3384
- or as a,
3385
- Tr as i
3386
- };