@jnrs/vue-core 1.2.2 → 1.2.4

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