@pie-element/simple-cloze 0.1.4-next.12 → 0.1.4-next.13
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/browser/delivery/index.js +1 -1
- package/dist/browser/editor-runtime/delivery/index.js +1 -1
- package/dist/browser/editor-runtime/{i18n-BDkxR45Z.js → i18n-BgA-56QR.js} +288 -255
- package/dist/browser/editor-runtime/i18n-BgA-56QR.js.map +1 -0
- package/dist/browser/editor-runtime/print/index.js +1 -1
- package/dist/browser/{i18n-BDkxR45Z.js → i18n-BgA-56QR.js} +288 -255
- package/dist/browser/i18n-BgA-56QR.js.map +1 -0
- package/dist/browser/print/index.js +1 -1
- package/dist/delivery/index.js +103 -63
- package/dist/delivery/index.js.map +1 -1
- package/dist/index.iife.js +2 -2
- package/dist/print/index.js +103 -63
- package/dist/print/index.js.map +1 -1
- package/module/print.js +237 -204
- package/module/print.js.map +1 -1
- package/package.json +5 -1
- package/dist/browser/editor-runtime/i18n-BDkxR45Z.js.map +0 -1
- package/dist/browser/i18n-BDkxR45Z.js.map +0 -1
|
@@ -1,83 +1,116 @@
|
|
|
1
1
|
//#region ../../shared/math-rendering-mathjax/dist/index.js
|
|
2
|
-
var e =
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
2
|
+
var e = {
|
|
3
|
+
parallelogram: "\\lower.2em{\\Huge\\unicode{x25B1}}",
|
|
4
|
+
overarc: "\\overparen",
|
|
5
|
+
napprox: "\\not\\approx",
|
|
6
|
+
longdiv: "\\enclose{longdiv}",
|
|
7
|
+
abs: ["\\left|#1\\right|", 1]
|
|
8
|
+
}, t = "[math-rendering] using $ is not advisable, please use $$..$$ or \\(...\\)", n = /\\\(|\\\[|\$\$|\\\$|\\begin\{|\\(?:eq)?ref\{/, r = /\\\(|\\\[|\$|\\begin\{|\\(?:eq)?ref\{/, i = /\\embed\{newLine\}\[\]/g, a = [
|
|
9
|
+
["$$", "$$"],
|
|
10
|
+
["$", "$"],
|
|
11
|
+
["\\[", "\\]"],
|
|
12
|
+
["\\(", "\\)"]
|
|
13
|
+
], o = Symbol.for("@pie-element/shared-math-rendering-mathjax/loading");
|
|
14
|
+
function s() {
|
|
15
|
+
return window.MathJax;
|
|
16
|
+
}
|
|
17
|
+
function c(e) {
|
|
18
|
+
let t = e.includes("\\displaystyle") ? e.replace("\\displaystyle", "").trim() : e;
|
|
19
|
+
for (let [e, n] of a) if (t.startsWith(e) && t.endsWith(n)) return t.substring(e.length, t.length - n.length);
|
|
20
|
+
return t;
|
|
21
|
+
}
|
|
22
|
+
function l(e) {
|
|
23
|
+
for (let t of e.querySelectorAll("[data-latex]")) {
|
|
24
|
+
if (t.dataset.mathHandled || t.closest("mjx-container")) continue;
|
|
25
|
+
let e = t.textContent;
|
|
26
|
+
e && (t.textContent = `\\(${c(e)}\\)`.replace(i, "\\newline "), t.dataset.mathHandled = "true");
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function u(e, t) {
|
|
30
|
+
for (let t of e.querySelectorAll("math")) if (!t.closest("mjx-assistive-mml")) return !0;
|
|
31
|
+
return (t ? r : n).test(e.textContent ?? "");
|
|
32
|
+
}
|
|
33
|
+
function d(n) {
|
|
34
|
+
return new Promise((r, i) => {
|
|
35
|
+
let { useSingleDollar: a = !1, accessibility: o = !0, loadFonts: c = !0, srcUrl: l } = n, u = {
|
|
36
|
+
loader: {
|
|
37
|
+
load: o ? ["a11y/assistive-mml"] : [],
|
|
38
|
+
failed: (e) => i(e)
|
|
27
39
|
},
|
|
28
40
|
startup: {
|
|
41
|
+
typeset: !1,
|
|
29
42
|
ready: () => {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
43
|
+
let e = s()?.startup;
|
|
44
|
+
e?.defaultReady?.(), Promise.resolve(e?.promise).then(() => r(), i);
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
tex: { macros: { ...e } },
|
|
48
|
+
options: {
|
|
49
|
+
enableMenu: o,
|
|
50
|
+
menuOptions: { settings: {
|
|
51
|
+
assistiveMml: o,
|
|
52
|
+
enrich: !1,
|
|
53
|
+
inTabOrder: !1
|
|
54
|
+
} }
|
|
33
55
|
}
|
|
34
56
|
};
|
|
35
|
-
|
|
36
|
-
let
|
|
37
|
-
|
|
38
|
-
setTimeout(e, 100);
|
|
39
|
-
}, c.onerror = () => {
|
|
40
|
-
n(/* @__PURE__ */ Error("Failed to load MathJax"));
|
|
41
|
-
}, document.head.appendChild(c);
|
|
57
|
+
a && u.tex && (console.warn(t), u.tex.inlineMath = [["$", "$"], ["\\(", "\\)"]], u.tex.processEscapes = !0), c || (u.chtml = { fontURL: "" }), window.MathJax = u;
|
|
58
|
+
let d = document.createElement("script");
|
|
59
|
+
d.src = l || "https://cdn.jsdelivr.net/npm/mathjax@4.1.3/tex-mml-chtml.js", d.async = !0, d.onerror = () => i(/* @__PURE__ */ Error("Failed to load MathJax")), document.head.appendChild(d);
|
|
42
60
|
});
|
|
43
|
-
return n[e] = i, i;
|
|
44
61
|
}
|
|
45
|
-
function
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
e.
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
62
|
+
function f(e) {
|
|
63
|
+
return new Promise((t, n) => {
|
|
64
|
+
let r = e.startup ?? {};
|
|
65
|
+
e.startup = r;
|
|
66
|
+
let i = r.ready;
|
|
67
|
+
r.ready = () => {
|
|
68
|
+
let e = s()?.startup;
|
|
69
|
+
i ? i.call(r) : e?.defaultReady?.(), Promise.resolve(e?.promise).then(() => t(), n);
|
|
70
|
+
};
|
|
71
|
+
});
|
|
52
72
|
}
|
|
53
|
-
function
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
73
|
+
function p(e) {
|
|
74
|
+
let t = s();
|
|
75
|
+
return t ? t.version ? t.startup?.promise ? Promise.resolve(t.startup.promise).then(() => void 0) : Promise.resolve() : f(t) : d(e);
|
|
76
|
+
}
|
|
77
|
+
function m(e) {
|
|
78
|
+
return p(e).then(() => {
|
|
79
|
+
typeof s()?.typesetPromise != "function" && console.warn("[mathjax-renderer] MathJax on this page has no typesetPromise; math stays untypeset.");
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
function h(e) {
|
|
83
|
+
let t = globalThis, n = t[o];
|
|
84
|
+
return n || (n = m(e), t[o] = n), n;
|
|
85
|
+
}
|
|
86
|
+
function g(e = {}) {
|
|
87
|
+
let t = e.useSingleDollar ?? !1;
|
|
88
|
+
return async (n) => {
|
|
89
|
+
if (typeof window > "u" || (l(n), !u(n, t))) return;
|
|
90
|
+
await h(e);
|
|
91
|
+
let r = s();
|
|
92
|
+
await r?.startup?.promise, typeof r?.typesetPromise == "function" && await r.typesetPromise([n]);
|
|
60
93
|
};
|
|
61
94
|
}
|
|
62
|
-
var
|
|
63
|
-
function
|
|
64
|
-
return
|
|
65
|
-
accessibility: !0,
|
|
66
|
-
useSingleDollar: !0
|
|
67
|
-
}), a;
|
|
95
|
+
var _ = "@pie-lib/math-rendering", v = "@pie-lib/math-rendering@2", y = null;
|
|
96
|
+
function b() {
|
|
97
|
+
return !!window[v]?.opts?.useSingleDollar;
|
|
68
98
|
}
|
|
69
|
-
function
|
|
99
|
+
function x() {
|
|
100
|
+
return y ||= g({ useSingleDollar: b() }), y;
|
|
101
|
+
}
|
|
102
|
+
function S() {
|
|
70
103
|
if (typeof window > "u") return null;
|
|
71
|
-
let e = window[
|
|
104
|
+
let e = window[_];
|
|
72
105
|
return typeof e?.renderMath == "function" ? e : null;
|
|
73
106
|
}
|
|
74
|
-
var
|
|
107
|
+
var ee = async (e) => {
|
|
75
108
|
if (typeof window > "u") return;
|
|
76
109
|
let t = typeof e == "string", n;
|
|
77
110
|
t ? (n = document.createElement("div"), n.innerHTML = e) : n = e || document.body;
|
|
78
|
-
let r =
|
|
79
|
-
return r ? await r.renderMath?.(n) : await
|
|
80
|
-
},
|
|
111
|
+
let r = S();
|
|
112
|
+
return r ? await r.renderMath?.(n) : await x()(n), t ? n.innerHTML : void 0;
|
|
113
|
+
}, C = {
|
|
81
114
|
translation: {
|
|
82
115
|
categorize: {
|
|
83
116
|
limitMaxChoicesPerCategory: "You've reached the limit of {{maxChoicesPerCategory}} responses per area. To add another response, one must first be removed.",
|
|
@@ -217,7 +250,7 @@ var c = async (e) => {
|
|
|
217
250
|
hideNote: "Hide Note",
|
|
218
251
|
cancel: "Cancel"
|
|
219
252
|
}
|
|
220
|
-
},
|
|
253
|
+
}, w = {
|
|
221
254
|
translation: {
|
|
222
255
|
categorize: {
|
|
223
256
|
limitMaxChoicesPerCategory: "Has alcanzado el límite de {{maxChoicesPerCategory}} respuestas por área. Para agregar otra respuesta, primero se debe eliminar una respuesta.",
|
|
@@ -357,55 +390,55 @@ var c = async (e) => {
|
|
|
357
390
|
hideNote: "Ocultar Nota",
|
|
358
391
|
cancel: "Cancelar"
|
|
359
392
|
}
|
|
360
|
-
},
|
|
393
|
+
}, T = (e) => typeof e == "string", E = () => {
|
|
361
394
|
let e, t, n = new Promise((n, r) => {
|
|
362
395
|
e = n, t = r;
|
|
363
396
|
});
|
|
364
397
|
return n.resolve = e, n.reject = t, n;
|
|
365
|
-
},
|
|
398
|
+
}, D = (e) => e == null ? "" : "" + e, O = (e, t, n) => {
|
|
366
399
|
e.forEach((e) => {
|
|
367
400
|
t[e] && (n[e] = t[e]);
|
|
368
401
|
});
|
|
369
|
-
},
|
|
370
|
-
let r =
|
|
402
|
+
}, te = /###/g, k = (e) => e && e.indexOf("###") > -1 ? e.replace(te, ".") : e, ne = (e) => !e || T(e), A = (e, t, n) => {
|
|
403
|
+
let r = T(t) ? t.split(".") : t, i = 0;
|
|
371
404
|
for (; i < r.length - 1;) {
|
|
372
|
-
if (
|
|
373
|
-
let t =
|
|
405
|
+
if (ne(e)) return {};
|
|
406
|
+
let t = k(r[i]);
|
|
374
407
|
!e[t] && n && (e[t] = new n()), e = Object.prototype.hasOwnProperty.call(e, t) ? e[t] : {}, ++i;
|
|
375
408
|
}
|
|
376
|
-
return
|
|
409
|
+
return ne(e) ? {} : {
|
|
377
410
|
obj: e,
|
|
378
|
-
k:
|
|
411
|
+
k: k(r[i])
|
|
379
412
|
};
|
|
380
|
-
},
|
|
381
|
-
let { obj: r, k: i } =
|
|
413
|
+
}, re = (e, t, n) => {
|
|
414
|
+
let { obj: r, k: i } = A(e, t, Object);
|
|
382
415
|
if (r !== void 0 || t.length === 1) {
|
|
383
416
|
r[i] = n;
|
|
384
417
|
return;
|
|
385
418
|
}
|
|
386
|
-
let a = t[t.length - 1], o = t.slice(0, t.length - 1), s =
|
|
387
|
-
for (; s.obj === void 0 && o.length;) a = `${o[o.length - 1]}.${a}`, o = o.slice(0, o.length - 1), s =
|
|
419
|
+
let a = t[t.length - 1], o = t.slice(0, t.length - 1), s = A(e, o, Object);
|
|
420
|
+
for (; s.obj === void 0 && o.length;) a = `${o[o.length - 1]}.${a}`, o = o.slice(0, o.length - 1), s = A(e, o, Object), s?.obj && s.obj[`${s.k}.${a}`] !== void 0 && (s.obj = void 0);
|
|
388
421
|
s.obj[`${s.k}.${a}`] = n;
|
|
389
|
-
},
|
|
390
|
-
let { obj: i, k: a } =
|
|
422
|
+
}, ie = (e, t, n, r) => {
|
|
423
|
+
let { obj: i, k: a } = A(e, t, Object);
|
|
391
424
|
i[a] = i[a] || [], i[a].push(n);
|
|
392
|
-
},
|
|
393
|
-
let { obj: n, k: r } =
|
|
425
|
+
}, j = (e, t) => {
|
|
426
|
+
let { obj: n, k: r } = A(e, t);
|
|
394
427
|
if (n && Object.prototype.hasOwnProperty.call(n, r)) return n[r];
|
|
395
|
-
},
|
|
396
|
-
let r =
|
|
397
|
-
return r === void 0 ?
|
|
398
|
-
},
|
|
399
|
-
for (let r in t) r !== "__proto__" && r !== "constructor" && (r in e ?
|
|
428
|
+
}, ae = (e, t, n) => {
|
|
429
|
+
let r = j(e, n);
|
|
430
|
+
return r === void 0 ? j(t, n) : r;
|
|
431
|
+
}, M = (e, t, n) => {
|
|
432
|
+
for (let r in t) r !== "__proto__" && r !== "constructor" && (r in e ? T(e[r]) || e[r] instanceof String || T(t[r]) || t[r] instanceof String ? n && (e[r] = t[r]) : M(e[r], t[r], n) : e[r] = t[r]);
|
|
400
433
|
return e;
|
|
401
|
-
},
|
|
434
|
+
}, N = (e) => e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"), oe = {
|
|
402
435
|
"&": "&",
|
|
403
436
|
"<": "<",
|
|
404
437
|
">": ">",
|
|
405
438
|
"\"": """,
|
|
406
439
|
"'": "'",
|
|
407
440
|
"/": "/"
|
|
408
|
-
},
|
|
441
|
+
}, se = (e) => T(e) ? e.replace(/[&<>"'\/]/g, (e) => oe[e]) : e, ce = class {
|
|
409
442
|
constructor(e) {
|
|
410
443
|
this.capacity = e, this.regExpMap = /* @__PURE__ */ new Map(), this.regExpQueue = [];
|
|
411
444
|
}
|
|
@@ -415,23 +448,23 @@ var c = async (e) => {
|
|
|
415
448
|
let n = new RegExp(e);
|
|
416
449
|
return this.regExpQueue.length === this.capacity && this.regExpMap.delete(this.regExpQueue.shift()), this.regExpMap.set(e, n), this.regExpQueue.push(e), n;
|
|
417
450
|
}
|
|
418
|
-
},
|
|
451
|
+
}, le = [
|
|
419
452
|
" ",
|
|
420
453
|
",",
|
|
421
454
|
"?",
|
|
422
455
|
"!",
|
|
423
456
|
";"
|
|
424
|
-
],
|
|
457
|
+
], ue = new ce(20), de = (e, t, n) => {
|
|
425
458
|
t ||= "", n ||= "";
|
|
426
|
-
let r =
|
|
459
|
+
let r = le.filter((e) => t.indexOf(e) < 0 && n.indexOf(e) < 0);
|
|
427
460
|
if (r.length === 0) return !0;
|
|
428
|
-
let i =
|
|
461
|
+
let i = ue.getRegExp(`(${r.map((e) => e === "?" ? "\\?" : e).join("|")})`), a = !i.test(e);
|
|
429
462
|
if (!a) {
|
|
430
463
|
let t = e.indexOf(n);
|
|
431
464
|
t > 0 && !i.test(e.substring(0, t)) && (a = !0);
|
|
432
465
|
}
|
|
433
466
|
return a;
|
|
434
|
-
},
|
|
467
|
+
}, P = (e, t, n = ".") => {
|
|
435
468
|
if (!e) return;
|
|
436
469
|
if (e[t]) return Object.prototype.hasOwnProperty.call(e, t) ? e[t] : void 0;
|
|
437
470
|
let r = t.split(n), i = e;
|
|
@@ -450,7 +483,7 @@ var c = async (e) => {
|
|
|
450
483
|
i = t;
|
|
451
484
|
}
|
|
452
485
|
return i;
|
|
453
|
-
},
|
|
486
|
+
}, F = (e) => e?.replace(/_/g, "-"), fe = {
|
|
454
487
|
type: "logger",
|
|
455
488
|
log(e) {
|
|
456
489
|
this.output("log", e);
|
|
@@ -464,12 +497,12 @@ var c = async (e) => {
|
|
|
464
497
|
output(e, t) {
|
|
465
498
|
console?.[e]?.apply?.(console, t);
|
|
466
499
|
}
|
|
467
|
-
},
|
|
500
|
+
}, I = new class e {
|
|
468
501
|
constructor(e, t = {}) {
|
|
469
502
|
this.init(e, t);
|
|
470
503
|
}
|
|
471
504
|
init(e, t = {}) {
|
|
472
|
-
this.prefix = t.prefix || "i18next:", this.logger = e ||
|
|
505
|
+
this.prefix = t.prefix || "i18next:", this.logger = e || fe, this.options = t, this.debug = t.debug;
|
|
473
506
|
}
|
|
474
507
|
log(...e) {
|
|
475
508
|
return this.forward(e, "log", "", !0);
|
|
@@ -484,7 +517,7 @@ var c = async (e) => {
|
|
|
484
517
|
return this.forward(e, "warn", "WARNING DEPRECATED: ", !0);
|
|
485
518
|
}
|
|
486
519
|
forward(e, t, n, r) {
|
|
487
|
-
return r && !this.debug ? null : (
|
|
520
|
+
return r && !this.debug ? null : (T(e[0]) && (e[0] = `${n}${this.prefix} ${e[0]}`), this.logger[t](e));
|
|
488
521
|
}
|
|
489
522
|
create(t) {
|
|
490
523
|
return new e(this.logger, {
|
|
@@ -495,7 +528,7 @@ var c = async (e) => {
|
|
|
495
528
|
clone(t) {
|
|
496
529
|
return t ||= this.options, t.prefix = t.prefix || this.prefix, new e(this.logger, t);
|
|
497
530
|
}
|
|
498
|
-
}(),
|
|
531
|
+
}(), L = class {
|
|
499
532
|
constructor() {
|
|
500
533
|
this.observers = {};
|
|
501
534
|
}
|
|
@@ -522,7 +555,7 @@ var c = async (e) => {
|
|
|
522
555
|
for (let i = 0; i < r; i++) n.apply(n, [e, ...t]);
|
|
523
556
|
});
|
|
524
557
|
}
|
|
525
|
-
},
|
|
558
|
+
}, pe = class extends L {
|
|
526
559
|
constructor(e, t = {
|
|
527
560
|
ns: ["translation"],
|
|
528
561
|
defaultNS: "translation"
|
|
@@ -538,16 +571,16 @@ var c = async (e) => {
|
|
|
538
571
|
}
|
|
539
572
|
getResource(e, t, n, r = {}) {
|
|
540
573
|
let i = r.keySeparator === void 0 ? this.options.keySeparator : r.keySeparator, a = r.ignoreJSONStructure === void 0 ? this.options.ignoreJSONStructure : r.ignoreJSONStructure, o;
|
|
541
|
-
e.indexOf(".") > -1 ? o = e.split(".") : (o = [e, t], n && (Array.isArray(n) ? o.push(...n) :
|
|
542
|
-
let s =
|
|
543
|
-
return !s && !t && !n && e.indexOf(".") > -1 && (e = o[0], t = o[1], n = o.slice(2).join(".")), s || !a || !
|
|
574
|
+
e.indexOf(".") > -1 ? o = e.split(".") : (o = [e, t], n && (Array.isArray(n) ? o.push(...n) : T(n) && i ? o.push(...n.split(i)) : o.push(n)));
|
|
575
|
+
let s = j(this.data, o);
|
|
576
|
+
return !s && !t && !n && e.indexOf(".") > -1 && (e = o[0], t = o[1], n = o.slice(2).join(".")), s || !a || !T(n) ? s : P(this.data?.[e]?.[t], n, i);
|
|
544
577
|
}
|
|
545
578
|
addResource(e, t, n, r, i = { silent: !1 }) {
|
|
546
579
|
let a = i.keySeparator === void 0 ? this.options.keySeparator : i.keySeparator, o = [e, t];
|
|
547
|
-
n && (o = o.concat(a ? n.split(a) : n)), e.indexOf(".") > -1 && (o = e.split("."), r = t, t = o[1]), this.addNamespaces(t),
|
|
580
|
+
n && (o = o.concat(a ? n.split(a) : n)), e.indexOf(".") > -1 && (o = e.split("."), r = t, t = o[1]), this.addNamespaces(t), re(this.data, o, r), i.silent || this.emit("added", e, t, n, r);
|
|
548
581
|
}
|
|
549
582
|
addResources(e, t, n, r = { silent: !1 }) {
|
|
550
|
-
for (let r in n) (
|
|
583
|
+
for (let r in n) (T(n[r]) || Array.isArray(n[r])) && this.addResource(e, t, r, n[r], { silent: !0 });
|
|
551
584
|
r.silent || this.emit("added", e, t, n);
|
|
552
585
|
}
|
|
553
586
|
addResourceBundle(e, t, n, r, i, a = {
|
|
@@ -556,11 +589,11 @@ var c = async (e) => {
|
|
|
556
589
|
}) {
|
|
557
590
|
let o = [e, t];
|
|
558
591
|
e.indexOf(".") > -1 && (o = e.split("."), r = n, n = t, t = o[1]), this.addNamespaces(t);
|
|
559
|
-
let s =
|
|
560
|
-
a.skipCopy || (n = JSON.parse(JSON.stringify(n))), r ?
|
|
592
|
+
let s = j(this.data, o) || {};
|
|
593
|
+
a.skipCopy || (n = JSON.parse(JSON.stringify(n))), r ? M(s, n, i) : s = {
|
|
561
594
|
...s,
|
|
562
595
|
...n
|
|
563
|
-
},
|
|
596
|
+
}, re(this.data, o, s), a.silent || this.emit("added", e, t, n);
|
|
564
597
|
}
|
|
565
598
|
removeResourceBundle(e, t) {
|
|
566
599
|
this.hasResourceBundle(e, t) && delete this.data[e][t], this.removeNamespaces(t), this.emit("removed", e, t);
|
|
@@ -581,7 +614,7 @@ var c = async (e) => {
|
|
|
581
614
|
toJSON() {
|
|
582
615
|
return this.data;
|
|
583
616
|
}
|
|
584
|
-
},
|
|
617
|
+
}, R = {
|
|
585
618
|
processors: {},
|
|
586
619
|
addPostProcessor(e) {
|
|
587
620
|
this.processors[e.name] = e;
|
|
@@ -591,22 +624,22 @@ var c = async (e) => {
|
|
|
591
624
|
t = this.processors[e]?.process(t, n, r, i) ?? t;
|
|
592
625
|
}), t;
|
|
593
626
|
}
|
|
594
|
-
},
|
|
595
|
-
function
|
|
627
|
+
}, z = Symbol("i18next/PATH_KEY");
|
|
628
|
+
function me() {
|
|
596
629
|
let e = [], t = Object.create(null), n;
|
|
597
|
-
return t.get = (r, i) => (n?.revoke?.(), i ===
|
|
630
|
+
return t.get = (r, i) => (n?.revoke?.(), i === z ? e : (e.push(i), n = Proxy.revocable(r, t), n.proxy)), Proxy.revocable(Object.create(null), t).proxy;
|
|
598
631
|
}
|
|
599
|
-
function
|
|
600
|
-
let { [
|
|
632
|
+
function B(e, t) {
|
|
633
|
+
let { [z]: n } = e(me()), r = t?.keySeparator ?? ".", i = t?.nsSeparator ?? ":";
|
|
601
634
|
if (n.length > 1 && i) {
|
|
602
635
|
let e = t?.ns, a = Array.isArray(e) ? e : null;
|
|
603
636
|
if (a && a.length > 1 && a.slice(1).includes(n[0])) return `${n[0]}${i}${n.slice(1).join(r)}`;
|
|
604
637
|
}
|
|
605
638
|
return n.join(r);
|
|
606
639
|
}
|
|
607
|
-
var
|
|
640
|
+
var V = {}, H = (e) => !T(e) && typeof e != "boolean" && typeof e != "number", U = class e extends L {
|
|
608
641
|
constructor(e, t = {}) {
|
|
609
|
-
super(),
|
|
642
|
+
super(), O([
|
|
610
643
|
"resourceStore",
|
|
611
644
|
"languageUtils",
|
|
612
645
|
"pluralResolver",
|
|
@@ -614,7 +647,7 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
614
647
|
"backendConnector",
|
|
615
648
|
"i18nFormat",
|
|
616
649
|
"utils"
|
|
617
|
-
], e, this), this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.logger =
|
|
650
|
+
], e, this), this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.logger = I.create("translator");
|
|
618
651
|
}
|
|
619
652
|
changeLanguage(e) {
|
|
620
653
|
e && (this.language = e);
|
|
@@ -624,95 +657,95 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
624
657
|
if (e == null) return !1;
|
|
625
658
|
let r = this.resolve(e, n);
|
|
626
659
|
if (r?.res === void 0) return !1;
|
|
627
|
-
let i =
|
|
660
|
+
let i = H(r.res);
|
|
628
661
|
return !(n.returnObjects === !1 && i);
|
|
629
662
|
}
|
|
630
663
|
extractFromKey(e, t) {
|
|
631
664
|
let n = t.nsSeparator === void 0 ? this.options.nsSeparator : t.nsSeparator;
|
|
632
665
|
n === void 0 && (n = ":");
|
|
633
|
-
let r = t.keySeparator === void 0 ? this.options.keySeparator : t.keySeparator, i = t.ns || this.options.defaultNS || [], a = n && e.indexOf(n) > -1, o = !this.options.userDefinedKeySeparator && !t.keySeparator && !this.options.userDefinedNsSeparator && !t.nsSeparator && !
|
|
666
|
+
let r = t.keySeparator === void 0 ? this.options.keySeparator : t.keySeparator, i = t.ns || this.options.defaultNS || [], a = n && e.indexOf(n) > -1, o = !this.options.userDefinedKeySeparator && !t.keySeparator && !this.options.userDefinedNsSeparator && !t.nsSeparator && !de(e, n, r);
|
|
634
667
|
if (a && !o) {
|
|
635
668
|
let t = e.match(this.interpolator.nestingRegexp);
|
|
636
669
|
if (t && t.length > 0) return {
|
|
637
670
|
key: e,
|
|
638
|
-
namespaces:
|
|
671
|
+
namespaces: T(i) ? [i] : i
|
|
639
672
|
};
|
|
640
673
|
let a = e.split(n);
|
|
641
674
|
(n !== r || n === r && this.options.ns.indexOf(a[0]) > -1) && (i = a.shift()), e = a.join(r);
|
|
642
675
|
}
|
|
643
676
|
return {
|
|
644
677
|
key: e,
|
|
645
|
-
namespaces:
|
|
678
|
+
namespaces: T(i) ? [i] : i
|
|
646
679
|
};
|
|
647
680
|
}
|
|
648
681
|
translate(t, n, r) {
|
|
649
682
|
let i = typeof n == "object" ? { ...n } : n;
|
|
650
683
|
if (typeof i != "object" && this.options.overloadTranslationOptionHandler && (i = this.options.overloadTranslationOptionHandler(arguments)), typeof i == "object" && (i = { ...i }), i ||= {}, t == null) return "";
|
|
651
|
-
typeof t == "function" && (t =
|
|
684
|
+
typeof t == "function" && (t = B(t, {
|
|
652
685
|
...this.options,
|
|
653
686
|
...i
|
|
654
|
-
})), Array.isArray(t) || (t = [String(t)]), t = t.map((e) => typeof e == "function" ?
|
|
687
|
+
})), Array.isArray(t) || (t = [String(t)]), t = t.map((e) => typeof e == "function" ? B(e, {
|
|
655
688
|
...this.options,
|
|
656
689
|
...i
|
|
657
690
|
}) : String(e));
|
|
658
691
|
let a = i.returnDetails === void 0 ? this.options.returnDetails : i.returnDetails, o = i.keySeparator === void 0 ? this.options.keySeparator : i.keySeparator, { key: s, namespaces: c } = this.extractFromKey(t[t.length - 1], i), l = c[c.length - 1], u = i.nsSeparator === void 0 ? this.options.nsSeparator : i.nsSeparator;
|
|
659
692
|
u === void 0 && (u = ":");
|
|
660
|
-
let
|
|
661
|
-
if (
|
|
693
|
+
let d = i.lng || this.language, f = i.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;
|
|
694
|
+
if (d?.toLowerCase() === "cimode") return f ? a ? {
|
|
662
695
|
res: `${l}${u}${s}`,
|
|
663
696
|
usedKey: s,
|
|
664
697
|
exactUsedKey: s,
|
|
665
|
-
usedLng:
|
|
698
|
+
usedLng: d,
|
|
666
699
|
usedNS: l,
|
|
667
700
|
usedParams: this.getUsedParamsDetails(i)
|
|
668
701
|
} : `${l}${u}${s}` : a ? {
|
|
669
702
|
res: s,
|
|
670
703
|
usedKey: s,
|
|
671
704
|
exactUsedKey: s,
|
|
672
|
-
usedLng:
|
|
705
|
+
usedLng: d,
|
|
673
706
|
usedNS: l,
|
|
674
707
|
usedParams: this.getUsedParamsDetails(i)
|
|
675
708
|
} : s;
|
|
676
|
-
let
|
|
709
|
+
let p = this.resolve(t, i), m = p?.res, h = p?.usedKey || s, g = p?.exactUsedKey || s, _ = [
|
|
677
710
|
"[object Number]",
|
|
678
711
|
"[object Function]",
|
|
679
712
|
"[object RegExp]"
|
|
680
|
-
],
|
|
681
|
-
|
|
682
|
-
let
|
|
683
|
-
if (
|
|
713
|
+
], v = i.joinArrays === void 0 ? this.options.joinArrays : i.joinArrays, y = !this.i18nFormat || this.i18nFormat.handleAsObject, b = i.count !== void 0 && !T(i.count), x = e.hasDefaultValue(i), S = b ? this.pluralResolver.getSuffix(d, i.count, i) : "", ee = i.ordinal && b ? this.pluralResolver.getSuffix(d, i.count, { ordinal: !1 }) : "", C = b && !i.ordinal && i.count === 0, w = C && i[`defaultValue${this.options.pluralSeparator}zero`] || i[`defaultValue${S}`] || i[`defaultValue${ee}`] || i.defaultValue, E = m;
|
|
714
|
+
y && !m && x && (E = w);
|
|
715
|
+
let D = H(E), O = Object.prototype.toString.apply(E);
|
|
716
|
+
if (y && E && D && _.indexOf(O) < 0 && !(T(v) && Array.isArray(E))) {
|
|
684
717
|
if (!i.returnObjects && !this.options.returnObjects) {
|
|
685
718
|
this.options.returnedObjectHandler || this.logger.warn("accessing an object - but returnObjects options is not enabled!");
|
|
686
|
-
let e = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(
|
|
719
|
+
let e = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(h, E, {
|
|
687
720
|
...i,
|
|
688
721
|
ns: c
|
|
689
722
|
}) : `key '${s} (${this.language})' returned an object instead of string.`;
|
|
690
|
-
return a ? (
|
|
723
|
+
return a ? (p.res = e, p.usedParams = this.getUsedParamsDetails(i), p) : e;
|
|
691
724
|
}
|
|
692
725
|
if (o) {
|
|
693
|
-
let e = Array.isArray(
|
|
694
|
-
for (let e in
|
|
726
|
+
let e = Array.isArray(E), t = e ? [] : {}, n = e ? g : h;
|
|
727
|
+
for (let e in E) if (Object.prototype.hasOwnProperty.call(E, e)) {
|
|
695
728
|
let r = `${n}${o}${e}`;
|
|
696
|
-
|
|
729
|
+
x && !m ? t[e] = this.translate(r, {
|
|
697
730
|
...i,
|
|
698
|
-
defaultValue:
|
|
731
|
+
defaultValue: H(w) ? w[e] : void 0,
|
|
699
732
|
joinArrays: !1,
|
|
700
733
|
ns: c
|
|
701
734
|
}) : t[e] = this.translate(r, {
|
|
702
735
|
...i,
|
|
703
736
|
joinArrays: !1,
|
|
704
737
|
ns: c
|
|
705
|
-
}), t[e] === r && (t[e] =
|
|
738
|
+
}), t[e] === r && (t[e] = E[e]);
|
|
706
739
|
}
|
|
707
|
-
|
|
740
|
+
m = t;
|
|
708
741
|
}
|
|
709
|
-
} else if (
|
|
742
|
+
} else if (y && T(v) && Array.isArray(m)) m = m.join(v), m &&= this.extendTranslation(m, t, i, r);
|
|
710
743
|
else {
|
|
711
744
|
let e = !1, n = !1;
|
|
712
|
-
!this.isValidLookup(
|
|
713
|
-
let a = (i.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && n ? void 0 :
|
|
745
|
+
!this.isValidLookup(m) && x && (e = !0, m = w), this.isValidLookup(m) || (n = !0, m = s);
|
|
746
|
+
let a = (i.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && n ? void 0 : m, c = x && w !== m && this.options.updateMissing;
|
|
714
747
|
if (n || e || c) {
|
|
715
|
-
if (this.logger.log(c ? "updateKey" : "missingKey",
|
|
748
|
+
if (this.logger.log(c ? "updateKey" : "missingKey", d, l, s, c ? w : m), o) {
|
|
716
749
|
let e = this.resolve(s, {
|
|
717
750
|
...i,
|
|
718
751
|
keySeparator: !1
|
|
@@ -723,19 +756,19 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
723
756
|
if (this.options.saveMissingTo === "fallback" && t && t[0]) for (let n = 0; n < t.length; n++) e.push(t[n]);
|
|
724
757
|
else this.options.saveMissingTo === "all" ? e = this.languageUtils.toResolveHierarchy(i.lng || this.language) : e.push(i.lng || this.language);
|
|
725
758
|
let n = (e, t, n) => {
|
|
726
|
-
let r =
|
|
727
|
-
this.options.missingKeyHandler ? this.options.missingKeyHandler(e, l, t, r, c, i) : this.backendConnector?.saveMissing && this.backendConnector.saveMissing(e, l, t, r, c, i), this.emit("missingKey", e, l, t,
|
|
759
|
+
let r = x && n !== m ? n : a;
|
|
760
|
+
this.options.missingKeyHandler ? this.options.missingKeyHandler(e, l, t, r, c, i) : this.backendConnector?.saveMissing && this.backendConnector.saveMissing(e, l, t, r, c, i), this.emit("missingKey", e, l, t, m);
|
|
728
761
|
};
|
|
729
|
-
this.options.saveMissing && (this.options.saveMissingPlurals &&
|
|
762
|
+
this.options.saveMissing && (this.options.saveMissingPlurals && b ? e.forEach((e) => {
|
|
730
763
|
let t = this.pluralResolver.getSuffixes(e, i);
|
|
731
|
-
|
|
732
|
-
n([e], s + t, i[`defaultValue${t}`] ||
|
|
764
|
+
C && i[`defaultValue${this.options.pluralSeparator}zero`] && t.indexOf(`${this.options.pluralSeparator}zero`) < 0 && t.push(`${this.options.pluralSeparator}zero`), t.forEach((t) => {
|
|
765
|
+
n([e], s + t, i[`defaultValue${t}`] || w);
|
|
733
766
|
});
|
|
734
|
-
}) : n(e, s,
|
|
767
|
+
}) : n(e, s, w));
|
|
735
768
|
}
|
|
736
|
-
|
|
769
|
+
m = this.extendTranslation(m, t, i, p, r), n && m === s && this.options.appendNamespaceToMissingKey && (m = `${l}${u}${s}`), (n || e) && this.options.parseMissingKeyHandler && (m = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${l}${u}${s}` : s, e ? m : void 0, i));
|
|
737
770
|
}
|
|
738
|
-
return a ? (
|
|
771
|
+
return a ? (p.res = m, p.usedParams = this.getUsedParamsDetails(i), p) : m;
|
|
739
772
|
}
|
|
740
773
|
extendTranslation(e, t, n, r, i) {
|
|
741
774
|
if (this.i18nFormat?.parse) e = this.i18nFormat.parse(e, {
|
|
@@ -750,12 +783,12 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
750
783
|
...n.interpolation
|
|
751
784
|
}
|
|
752
785
|
});
|
|
753
|
-
let a =
|
|
786
|
+
let a = T(e) && (n?.interpolation?.skipOnVariables === void 0 ? this.options.interpolation.skipOnVariables : n.interpolation.skipOnVariables), o;
|
|
754
787
|
if (a) {
|
|
755
788
|
let t = e.match(this.interpolator.nestingRegexp);
|
|
756
789
|
o = t && t.length;
|
|
757
790
|
}
|
|
758
|
-
let s = n.replace && !
|
|
791
|
+
let s = n.replace && !T(n.replace) ? n.replace : n;
|
|
759
792
|
if (this.options.interpolation.defaultVariables && (s = {
|
|
760
793
|
...this.options.interpolation.defaultVariables,
|
|
761
794
|
...s
|
|
@@ -765,8 +798,8 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
765
798
|
}
|
|
766
799
|
!n.lng && r && r.res && (n.lng = this.language || r.usedLng), n.nest !== !1 && (e = this.interpolator.nest(e, (...e) => i?.[0] === e[0] && !n.context ? (this.logger.warn(`It seems you are nesting recursively key: ${e[0]} in key: ${t[0]}`), null) : this.translate(...e, t), n)), n.interpolation && this.interpolator.reset();
|
|
767
800
|
}
|
|
768
|
-
let a = n.postProcess || this.options.postProcess, o =
|
|
769
|
-
return e != null && o?.length && n.applyPostProcessor !== !1 && (e =
|
|
801
|
+
let a = n.postProcess || this.options.postProcess, o = T(a) ? [a] : a;
|
|
802
|
+
return e != null && o?.length && n.applyPostProcessor !== !1 && (e = R.handle(o, e, t, this.options && this.options.postProcessPassResolved ? {
|
|
770
803
|
i18nResolved: {
|
|
771
804
|
...r,
|
|
772
805
|
usedParams: this.getUsedParamsDetails(n)
|
|
@@ -776,7 +809,7 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
776
809
|
}
|
|
777
810
|
resolve(e, t = {}) {
|
|
778
811
|
let n, r, i, a, o;
|
|
779
|
-
return
|
|
812
|
+
return T(e) && (e = [e]), Array.isArray(e) && (e = e.map((e) => typeof e == "function" ? B(e, {
|
|
780
813
|
...this.options,
|
|
781
814
|
...t
|
|
782
815
|
}) : e)), e.forEach((e) => {
|
|
@@ -785,9 +818,9 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
785
818
|
r = c;
|
|
786
819
|
let l = s.namespaces;
|
|
787
820
|
this.options.fallbackNS && (l = l.concat(this.options.fallbackNS));
|
|
788
|
-
let u = t.count !== void 0 && !
|
|
821
|
+
let u = t.count !== void 0 && !T(t.count), d = u && !t.ordinal && t.count === 0, f = t.context !== void 0 && (T(t.context) || typeof t.context == "number") && t.context !== "", p = t.lngs ? t.lngs : this.languageUtils.toResolveHierarchy(t.lng || this.language, t.fallbackLng);
|
|
789
822
|
l.forEach((e) => {
|
|
790
|
-
this.isValidLookup(n) || (o = e, !
|
|
823
|
+
this.isValidLookup(n) || (o = e, !V[`${p[0]}-${e}`] && this.utils?.hasLoadedNamespace && !this.utils?.hasLoadedNamespace(o) && (V[`${p[0]}-${e}`] = !0, this.logger.warn(`key "${r}" for languages "${p.join(", ")}" won't get resolved as namespace "${o}" 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!!!")), p.forEach((r) => {
|
|
791
824
|
if (this.isValidLookup(n)) return;
|
|
792
825
|
a = r;
|
|
793
826
|
let o = [c];
|
|
@@ -796,9 +829,9 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
796
829
|
let e;
|
|
797
830
|
u && (e = this.pluralResolver.getSuffix(r, t.count, t));
|
|
798
831
|
let n = `${this.options.pluralSeparator}zero`, i = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;
|
|
799
|
-
if (u && (t.ordinal && e.indexOf(i) === 0 && o.push(c + e.replace(i, this.options.pluralSeparator)), o.push(c + e),
|
|
832
|
+
if (u && (t.ordinal && e.indexOf(i) === 0 && o.push(c + e.replace(i, this.options.pluralSeparator)), o.push(c + e), d && o.push(c + n)), f) {
|
|
800
833
|
let r = `${c}${this.options.contextSeparator || "_"}${t.context}`;
|
|
801
|
-
o.push(r), u && (t.ordinal && e.indexOf(i) === 0 && o.push(r + e.replace(i, this.options.pluralSeparator)), o.push(r + e),
|
|
834
|
+
o.push(r), u && (t.ordinal && e.indexOf(i) === 0 && o.push(r + e.replace(i, this.options.pluralSeparator)), o.push(r + e), d && o.push(r + n));
|
|
802
835
|
}
|
|
803
836
|
}
|
|
804
837
|
let s;
|
|
@@ -836,7 +869,7 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
836
869
|
"joinArrays",
|
|
837
870
|
"postProcess",
|
|
838
871
|
"interpolation"
|
|
839
|
-
], n = e.replace && !
|
|
872
|
+
], n = e.replace && !T(e.replace), r = n ? e.replace : e;
|
|
840
873
|
if (n && e.count !== void 0 && (r.count = e.count), this.options.interpolation.defaultVariables && (r = {
|
|
841
874
|
...this.options.interpolation.defaultVariables,
|
|
842
875
|
...r
|
|
@@ -850,22 +883,22 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
850
883
|
for (let t in e) if (Object.prototype.hasOwnProperty.call(e, t) && t.substring(0, 12) === "defaultValue" && e[t] !== void 0) return !0;
|
|
851
884
|
return !1;
|
|
852
885
|
}
|
|
853
|
-
},
|
|
886
|
+
}, W = class {
|
|
854
887
|
constructor(e) {
|
|
855
|
-
this.options = e, this.supportedLngs = this.options.supportedLngs || !1, this.logger =
|
|
888
|
+
this.options = e, this.supportedLngs = this.options.supportedLngs || !1, this.logger = I.create("languageUtils");
|
|
856
889
|
}
|
|
857
890
|
getScriptPartFromCode(e) {
|
|
858
|
-
if (e =
|
|
891
|
+
if (e = F(e), !e || e.indexOf("-") < 0) return null;
|
|
859
892
|
let t = e.split("-");
|
|
860
893
|
return t.length === 2 || (t.pop(), t[t.length - 1].toLowerCase() === "x") ? null : this.formatLanguageCode(t.join("-"));
|
|
861
894
|
}
|
|
862
895
|
getLanguagePartFromCode(e) {
|
|
863
|
-
if (e =
|
|
896
|
+
if (e = F(e), !e || e.indexOf("-") < 0) return e;
|
|
864
897
|
let t = e.split("-");
|
|
865
898
|
return this.formatLanguageCode(t[0]);
|
|
866
899
|
}
|
|
867
900
|
formatLanguageCode(e) {
|
|
868
|
-
if (
|
|
901
|
+
if (T(e) && e.indexOf("-") > -1) {
|
|
869
902
|
let t;
|
|
870
903
|
try {
|
|
871
904
|
t = Intl.getCanonicalLocales(e)[0];
|
|
@@ -897,7 +930,7 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
897
930
|
}
|
|
898
931
|
getFallbackCodes(e, t) {
|
|
899
932
|
if (!e) return [];
|
|
900
|
-
if (typeof e == "function" && (e = e(t)),
|
|
933
|
+
if (typeof e == "function" && (e = e(t)), T(e) && (e = [e]), Array.isArray(e)) return e;
|
|
901
934
|
if (!t) return e.default || [];
|
|
902
935
|
let n = e[t];
|
|
903
936
|
return n ||= e[this.getScriptPartFromCode(t)], n ||= e[this.formatLanguageCode(t)], n ||= e[this.getLanguagePartFromCode(t)], n ||= e.default, n || [];
|
|
@@ -906,29 +939,29 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
906
939
|
let n = this.getFallbackCodes((t === !1 ? [] : t) || this.options.fallbackLng || [], e), r = [], i = (e) => {
|
|
907
940
|
e && (this.isSupportedCode(e) ? r.push(e) : this.logger.warn(`rejecting language code not found in supportedLngs: ${e}`));
|
|
908
941
|
};
|
|
909
|
-
return
|
|
942
|
+
return T(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))) : T(e) && i(this.formatLanguageCode(e)), n.forEach((e) => {
|
|
910
943
|
r.indexOf(e) < 0 && i(this.formatLanguageCode(e));
|
|
911
944
|
}), r;
|
|
912
945
|
}
|
|
913
|
-
},
|
|
946
|
+
}, G = {
|
|
914
947
|
zero: 0,
|
|
915
948
|
one: 1,
|
|
916
949
|
two: 2,
|
|
917
950
|
few: 3,
|
|
918
951
|
many: 4,
|
|
919
952
|
other: 5
|
|
920
|
-
},
|
|
953
|
+
}, K = {
|
|
921
954
|
select: (e) => e === 1 ? "one" : "other",
|
|
922
955
|
resolvedOptions: () => ({ pluralCategories: ["one", "other"] })
|
|
923
|
-
},
|
|
956
|
+
}, he = class {
|
|
924
957
|
constructor(e, t = {}) {
|
|
925
|
-
this.languageUtils = e, this.options = t, this.logger =
|
|
958
|
+
this.languageUtils = e, this.options = t, this.logger = I.create("pluralResolver"), this.pluralRulesCache = {};
|
|
926
959
|
}
|
|
927
960
|
clearCache() {
|
|
928
961
|
this.pluralRulesCache = {};
|
|
929
962
|
}
|
|
930
963
|
getRule(e, t = {}) {
|
|
931
|
-
let n =
|
|
964
|
+
let n = F(e === "dev" ? "en" : e), r = t.ordinal ? "ordinal" : "cardinal", i = JSON.stringify({
|
|
932
965
|
cleanedCode: n,
|
|
933
966
|
type: r
|
|
934
967
|
});
|
|
@@ -937,8 +970,8 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
937
970
|
try {
|
|
938
971
|
a = new Intl.PluralRules(n, { type: r });
|
|
939
972
|
} catch {
|
|
940
|
-
if (typeof Intl > "u") return this.logger.error("No Intl support, please use an Intl polyfill!"),
|
|
941
|
-
if (!e.match(/-|_/)) return
|
|
973
|
+
if (typeof Intl > "u") return this.logger.error("No Intl support, please use an Intl polyfill!"), K;
|
|
974
|
+
if (!e.match(/-|_/)) return K;
|
|
942
975
|
let n = this.languageUtils.getLanguagePartFromCode(e);
|
|
943
976
|
a = this.getRule(n, t);
|
|
944
977
|
}
|
|
@@ -953,23 +986,23 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
953
986
|
}
|
|
954
987
|
getSuffixes(e, t = {}) {
|
|
955
988
|
let n = this.getRule(e, t);
|
|
956
|
-
return n ||= this.getRule("dev", t), n ? n.resolvedOptions().pluralCategories.sort((e, t) =>
|
|
989
|
+
return n ||= this.getRule("dev", t), n ? n.resolvedOptions().pluralCategories.sort((e, t) => G[e] - G[t]).map((e) => `${this.options.prepend}${t.ordinal ? `ordinal${this.options.prepend}` : ""}${e}`) : [];
|
|
957
990
|
}
|
|
958
991
|
getSuffix(e, t, n = {}) {
|
|
959
992
|
let r = this.getRule(e, n);
|
|
960
993
|
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));
|
|
961
994
|
}
|
|
962
|
-
},
|
|
963
|
-
let a =
|
|
964
|
-
return !a && i &&
|
|
965
|
-
},
|
|
995
|
+
}, q = (e, t, n, r = ".", i = !0) => {
|
|
996
|
+
let a = ae(e, t, n);
|
|
997
|
+
return !a && i && T(n) && (a = P(e, n, r), a === void 0 && (a = P(t, n, r))), a;
|
|
998
|
+
}, J = (e) => e.replace(/\$/g, "$$$$"), Y = class {
|
|
966
999
|
constructor(e = {}) {
|
|
967
|
-
this.logger =
|
|
1000
|
+
this.logger = I.create("interpolator"), this.options = e, this.format = e?.interpolation?.format || ((e) => e), this.init(e);
|
|
968
1001
|
}
|
|
969
1002
|
init(e = {}) {
|
|
970
1003
|
e.interpolation ||= { escapeValue: !0 };
|
|
971
1004
|
let { escape: t, escapeValue: n, useRawValueToEscape: r, prefix: i, prefixEscaped: a, suffix: o, suffixEscaped: s, formatSeparator: c, unescapeSuffix: l, unescapePrefix: u, nestingPrefix: d, nestingPrefixEscaped: f, nestingSuffix: p, nestingSuffixEscaped: m, nestingOptionsSeparator: h, maxReplaces: g, alwaysFormat: _ } = e.interpolation;
|
|
972
|
-
this.escape = t === void 0 ?
|
|
1005
|
+
this.escape = t === void 0 ? se : t, this.escapeValue = n === void 0 || n, this.useRawValueToEscape = r !== void 0 && r, this.prefix = i ? N(i) : a || "{{", this.suffix = o ? N(o) : s || "}}", this.formatSeparator = c || ",", this.unescapePrefix = l ? "" : u || "-", this.unescapeSuffix = this.unescapePrefix ? "" : l || "", this.nestingPrefix = d ? N(d) : f || N("$t("), this.nestingSuffix = p ? N(p) : m || N(")"), this.nestingOptionsSeparator = h || ",", this.maxReplaces = g || 1e3, this.alwaysFormat = _ !== void 0 && _, this.resetRegExp();
|
|
973
1006
|
}
|
|
974
1007
|
reset() {
|
|
975
1008
|
this.options && this.init(this.options);
|
|
@@ -981,7 +1014,7 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
981
1014
|
interpolate(e, t, n, r) {
|
|
982
1015
|
let i, a, o, s = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {}, c = (e) => {
|
|
983
1016
|
if (e.indexOf(this.formatSeparator) < 0) {
|
|
984
|
-
let i =
|
|
1017
|
+
let i = q(t, s, e, this.options.keySeparator, this.options.ignoreJSONStructure);
|
|
985
1018
|
return this.alwaysFormat ? this.format(i, void 0, n, {
|
|
986
1019
|
...r,
|
|
987
1020
|
...t,
|
|
@@ -989,7 +1022,7 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
989
1022
|
}) : i;
|
|
990
1023
|
}
|
|
991
1024
|
let i = e.split(this.formatSeparator), a = i.shift().trim(), o = i.join(this.formatSeparator).trim();
|
|
992
|
-
return this.format(
|
|
1025
|
+
return this.format(q(t, s, a, this.options.keySeparator, this.options.ignoreJSONStructure), o, n, {
|
|
993
1026
|
...r,
|
|
994
1027
|
...t,
|
|
995
1028
|
interpolationkey: a
|
|
@@ -999,22 +1032,22 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
999
1032
|
let l = r?.missingInterpolationHandler || this.options.missingInterpolationHandler, u = r?.interpolation?.skipOnVariables === void 0 ? this.options.interpolation.skipOnVariables : r.interpolation.skipOnVariables;
|
|
1000
1033
|
return [{
|
|
1001
1034
|
regex: this.regexpUnescape,
|
|
1002
|
-
safeValue: (e) =>
|
|
1035
|
+
safeValue: (e) => J(e)
|
|
1003
1036
|
}, {
|
|
1004
1037
|
regex: this.regexp,
|
|
1005
|
-
safeValue: (e) => this.escapeValue ?
|
|
1038
|
+
safeValue: (e) => this.escapeValue ? J(this.escape(e)) : J(e)
|
|
1006
1039
|
}].forEach((t) => {
|
|
1007
1040
|
for (o = 0; i = t.regex.exec(e);) {
|
|
1008
1041
|
let n = i[1].trim();
|
|
1009
1042
|
if (a = c(n), a === void 0) if (typeof l == "function") {
|
|
1010
1043
|
let t = l(e, i, r);
|
|
1011
|
-
a =
|
|
1044
|
+
a = T(t) ? t : "";
|
|
1012
1045
|
} else if (r && Object.prototype.hasOwnProperty.call(r, n)) a = "";
|
|
1013
1046
|
else if (u) {
|
|
1014
1047
|
a = i[0];
|
|
1015
1048
|
continue;
|
|
1016
1049
|
} else this.logger.warn(`missed to pass in variable ${n} for interpolating ${e}`), a = "";
|
|
1017
|
-
else !
|
|
1050
|
+
else !T(a) && !this.useRawValueToEscape && (a = D(a));
|
|
1018
1051
|
let s = t.safeValue(a);
|
|
1019
1052
|
if (e = e.replace(i[0], s), u ? (t.regex.lastIndex += a.length, t.regex.lastIndex -= i[0].length) : t.regex.lastIndex = 0, o++, o >= this.maxReplaces) break;
|
|
1020
1053
|
}
|
|
@@ -1024,7 +1057,7 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
1024
1057
|
let r, i, a, o = (e, t) => {
|
|
1025
1058
|
let n = this.nestingOptionsSeparator;
|
|
1026
1059
|
if (e.indexOf(n) < 0) return e;
|
|
1027
|
-
let r = e.split(RegExp(`${
|
|
1060
|
+
let r = e.split(RegExp(`${N(n)}[ ]*{`)), i = `{${r[1]}`;
|
|
1028
1061
|
e = r[0], i = this.interpolate(i, a);
|
|
1029
1062
|
let o = i.match(/'/g), s = i.match(/"/g);
|
|
1030
1063
|
((o?.length ?? 0) % 2 == 0 && !s || (s?.length ?? 0) % 2 != 0) && (i = i.replace(/'/g, "\""));
|
|
@@ -1040,17 +1073,17 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
1040
1073
|
};
|
|
1041
1074
|
for (; r = this.nestingRegexp.exec(e);) {
|
|
1042
1075
|
let s = [];
|
|
1043
|
-
a = { ...n }, a = a.replace && !
|
|
1076
|
+
a = { ...n }, a = a.replace && !T(a.replace) ? a.replace : a, a.applyPostProcessor = !1, delete a.defaultValue;
|
|
1044
1077
|
let c = /{.*}/.test(r[1]) ? r[1].lastIndexOf("}") + 1 : r[1].indexOf(this.formatSeparator);
|
|
1045
|
-
if (c !== -1 && (s = r[1].slice(c).split(this.formatSeparator).map((e) => e.trim()).filter(Boolean), r[1] = r[1].slice(0, c)), i = t(o.call(this, r[1].trim(), a), a), i && r[0] === e && !
|
|
1046
|
-
|
|
1078
|
+
if (c !== -1 && (s = r[1].slice(c).split(this.formatSeparator).map((e) => e.trim()).filter(Boolean), r[1] = r[1].slice(0, c)), i = t(o.call(this, r[1].trim(), a), a), i && r[0] === e && !T(i)) return i;
|
|
1079
|
+
T(i) || (i = D(i)), i ||= (this.logger.warn(`missed to resolve ${r[1]} for nesting ${e}`), ""), s.length && (i = s.reduce((e, t) => this.format(e, t, n.lng, {
|
|
1047
1080
|
...n,
|
|
1048
1081
|
interpolationkey: r[1].trim()
|
|
1049
1082
|
}), i.trim())), e = e.replace(r[0], i), this.regexp.lastIndex = 0;
|
|
1050
1083
|
}
|
|
1051
1084
|
return e;
|
|
1052
1085
|
}
|
|
1053
|
-
},
|
|
1086
|
+
}, ge = (e) => {
|
|
1054
1087
|
let t = e.toLowerCase().trim(), n = {};
|
|
1055
1088
|
if (e.indexOf("(") > -1) {
|
|
1056
1089
|
let r = e.split("(");
|
|
@@ -1067,7 +1100,7 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
1067
1100
|
formatName: t,
|
|
1068
1101
|
formatOptions: n
|
|
1069
1102
|
};
|
|
1070
|
-
},
|
|
1103
|
+
}, X = (e) => {
|
|
1071
1104
|
let t = {};
|
|
1072
1105
|
return (n, r, i) => {
|
|
1073
1106
|
let a = i;
|
|
@@ -1076,15 +1109,15 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
1076
1109
|
[i.interpolationkey]: void 0
|
|
1077
1110
|
});
|
|
1078
1111
|
let o = r + JSON.stringify(a), s = t[o];
|
|
1079
|
-
return s || (s = e(
|
|
1112
|
+
return s || (s = e(F(r), i), t[o] = s), s(n);
|
|
1080
1113
|
};
|
|
1081
|
-
},
|
|
1114
|
+
}, _e = (e) => (t, n, r) => e(F(n), r)(t), ve = class {
|
|
1082
1115
|
constructor(e = {}) {
|
|
1083
|
-
this.logger =
|
|
1116
|
+
this.logger = I.create("formatter"), this.options = e, this.init(e);
|
|
1084
1117
|
}
|
|
1085
1118
|
init(e, t = { interpolation: {} }) {
|
|
1086
1119
|
this.formatSeparator = t.interpolation.formatSeparator || ",";
|
|
1087
|
-
let n = t.cacheInBuiltFormats ?
|
|
1120
|
+
let n = t.cacheInBuiltFormats ? X : _e;
|
|
1088
1121
|
this.formats = {
|
|
1089
1122
|
number: n((e, t) => {
|
|
1090
1123
|
let n = new Intl.NumberFormat(e, { ...t });
|
|
@@ -1115,7 +1148,7 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
1115
1148
|
this.formats[e.toLowerCase().trim()] = t;
|
|
1116
1149
|
}
|
|
1117
1150
|
addCached(e, t) {
|
|
1118
|
-
this.formats[e.toLowerCase().trim()] =
|
|
1151
|
+
this.formats[e.toLowerCase().trim()] = X(t);
|
|
1119
1152
|
}
|
|
1120
1153
|
format(e, t, n, r = {}) {
|
|
1121
1154
|
let i = t.split(this.formatSeparator);
|
|
@@ -1124,7 +1157,7 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
1124
1157
|
i[0] = [i[0], ...i.splice(1, e)].join(this.formatSeparator);
|
|
1125
1158
|
}
|
|
1126
1159
|
return i.reduce((e, t) => {
|
|
1127
|
-
let { formatName: i, formatOptions: a } =
|
|
1160
|
+
let { formatName: i, formatOptions: a } = ge(t);
|
|
1128
1161
|
if (this.formats[i]) {
|
|
1129
1162
|
let t = e;
|
|
1130
1163
|
try {
|
|
@@ -1142,11 +1175,11 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
1142
1175
|
return e;
|
|
1143
1176
|
}, e);
|
|
1144
1177
|
}
|
|
1145
|
-
},
|
|
1178
|
+
}, ye = (e, t) => {
|
|
1146
1179
|
e.pending[t] !== void 0 && (delete e.pending[t], e.pendingCount--);
|
|
1147
|
-
},
|
|
1180
|
+
}, be = class extends L {
|
|
1148
1181
|
constructor(e, t, n, r = {}) {
|
|
1149
|
-
super(), this.backend = e, this.store = t, this.services = n, this.languageUtils = n.languageUtils, this.options = r, this.logger =
|
|
1182
|
+
super(), this.backend = e, this.store = t, this.services = n, this.languageUtils = n.languageUtils, this.options = r, this.logger = I.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);
|
|
1150
1183
|
}
|
|
1151
1184
|
queueLoad(e, t, n, r) {
|
|
1152
1185
|
let i = {}, a = {}, o = {}, s = {};
|
|
@@ -1174,7 +1207,7 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
1174
1207
|
t && this.emit("failedLoading", i, a, t), !t && n && this.store.addResourceBundle(i, a, n, void 0, void 0, { skipCopy: !0 }), this.state[e] = t ? -1 : 2, t && n && (this.state[e] = 0);
|
|
1175
1208
|
let o = {};
|
|
1176
1209
|
this.queue.forEach((n) => {
|
|
1177
|
-
|
|
1210
|
+
ie(n.loaded, [i], a), ye(n, e), t && n.errors.push(t), n.pendingCount === 0 && !n.done && (Object.keys(n.loaded).forEach((e) => {
|
|
1178
1211
|
o[e] || (o[e] = {});
|
|
1179
1212
|
let t = n.loaded[e];
|
|
1180
1213
|
t.length && t.forEach((t) => {
|
|
@@ -1223,7 +1256,7 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
1223
1256
|
}
|
|
1224
1257
|
prepareLoading(e, t, n = {}, r) {
|
|
1225
1258
|
if (!this.backend) return this.logger.warn("No backend was added via i18next.use. Will not load resources."), r && r();
|
|
1226
|
-
|
|
1259
|
+
T(e) && (e = this.languageUtils.toResolveHierarchy(e)), T(t) && (t = [t]);
|
|
1227
1260
|
let i = this.queueLoad(e, t, n, r);
|
|
1228
1261
|
if (!i.toLoad.length) return i.pending.length || r(), null;
|
|
1229
1262
|
i.toLoad.forEach((e) => {
|
|
@@ -1264,7 +1297,7 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
1264
1297
|
!e || !e[0] || this.store.addResource(e[0], t, n, r);
|
|
1265
1298
|
}
|
|
1266
1299
|
}
|
|
1267
|
-
},
|
|
1300
|
+
}, Z = () => ({
|
|
1268
1301
|
debug: !1,
|
|
1269
1302
|
initAsync: !0,
|
|
1270
1303
|
ns: ["translation"],
|
|
@@ -1299,7 +1332,7 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
1299
1332
|
appendNamespaceToCIMode: !1,
|
|
1300
1333
|
overloadTranslationOptionHandler: (e) => {
|
|
1301
1334
|
let t = {};
|
|
1302
|
-
if (typeof e[1] == "object" && (t = e[1]),
|
|
1335
|
+
if (typeof e[1] == "object" && (t = e[1]), T(e[1]) && (t.defaultValue = e[1]), T(e[2]) && (t.tDescription = e[2]), typeof e[2] == "object" || typeof e[3] == "object") {
|
|
1303
1336
|
let n = e[3] || e[2];
|
|
1304
1337
|
Object.keys(n).forEach((e) => {
|
|
1305
1338
|
t[e] = n[e];
|
|
@@ -1321,15 +1354,15 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
1321
1354
|
skipOnVariables: !0
|
|
1322
1355
|
},
|
|
1323
1356
|
cacheInBuiltFormats: !0
|
|
1324
|
-
}),
|
|
1357
|
+
}), xe = (e) => (T(e.ns) && (e.ns = [e.ns]), T(e.fallbackLng) && (e.fallbackLng = [e.fallbackLng]), T(e.fallbackNS) && (e.fallbackNS = [e.fallbackNS]), e.supportedLngs?.indexOf?.("cimode") < 0 && (e.supportedLngs = e.supportedLngs.concat(["cimode"])), typeof e.initImmediate == "boolean" && (e.initAsync = e.initImmediate), e), Q = () => {}, Se = (e) => {
|
|
1325
1358
|
Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach((t) => {
|
|
1326
1359
|
typeof e[t] == "function" && (e[t] = e[t].bind(e));
|
|
1327
1360
|
});
|
|
1328
|
-
},
|
|
1329
|
-
typeof globalThis < "u" && (globalThis[
|
|
1330
|
-
},
|
|
1361
|
+
}, Ce = "__i18next_supportNoticeShown", we = () => !!(typeof globalThis < "u" && globalThis[Ce] || typeof process < "u" && process.env && process.env.I18NEXT_NO_SUPPORT_NOTICE || typeof process < "u" && process.env), Te = () => {
|
|
1362
|
+
typeof globalThis < "u" && (globalThis[Ce] = !0);
|
|
1363
|
+
}, Ee = (e) => !!(e?.modules?.backend?.name?.indexOf("Locize") > 0 || e?.modules?.backend?.constructor?.name?.indexOf("Locize") > 0 || e?.options?.backend?.backends && e.options.backend.backends.some((e) => e?.name?.indexOf("Locize") > 0 || e?.constructor?.name?.indexOf("Locize") > 0) || e?.options?.backend?.projectId || e?.options?.backend?.backendOptions && e.options.backend.backendOptions.some((e) => e?.projectId)), $ = class e extends L {
|
|
1331
1364
|
constructor(e = {}, t) {
|
|
1332
|
-
if (super(), this.options =
|
|
1365
|
+
if (super(), this.options = xe(e), this.services = {}, this.logger = I, this.modules = { external: [] }, Se(this), t && !this.isInitialized && !e.isClone) {
|
|
1333
1366
|
if (!this.options.initAsync) return this.init(e, t), this;
|
|
1334
1367
|
setTimeout(() => {
|
|
1335
1368
|
this.init(e, t);
|
|
@@ -1337,36 +1370,36 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
1337
1370
|
}
|
|
1338
1371
|
}
|
|
1339
1372
|
init(e = {}, t) {
|
|
1340
|
-
this.isInitializing = !0, typeof e == "function" && (t = e, e = {}), e.defaultNS == null && e.ns && (
|
|
1341
|
-
let n =
|
|
1373
|
+
this.isInitializing = !0, typeof e == "function" && (t = e, e = {}), e.defaultNS == null && e.ns && (T(e.ns) ? e.defaultNS = e.ns : e.ns.indexOf("translation") < 0 && (e.defaultNS = e.ns[0]));
|
|
1374
|
+
let n = Z();
|
|
1342
1375
|
this.options = {
|
|
1343
1376
|
...n,
|
|
1344
1377
|
...this.options,
|
|
1345
|
-
...
|
|
1378
|
+
...xe(e)
|
|
1346
1379
|
}, this.options.interpolation = {
|
|
1347
1380
|
...n.interpolation,
|
|
1348
1381
|
...this.options.interpolation
|
|
1349
|
-
}, 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), this.options.showSupportNotice !== !1 && !
|
|
1382
|
+
}, 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), this.options.showSupportNotice !== !1 && !Ee(this) && !we() && (typeof console < "u" && console.info !== void 0 && console.info("🌐 i18next is made possible by our own product, Locize — consider powering your project with managed localization (AI, CDN, integrations): https://locize.com 💙"), Te());
|
|
1350
1383
|
let r = (e) => e ? typeof e == "function" ? new e() : e : null;
|
|
1351
1384
|
if (!this.options.isClone) {
|
|
1352
|
-
this.modules.logger ?
|
|
1385
|
+
this.modules.logger ? I.init(r(this.modules.logger), this.options) : I.init(null, this.options);
|
|
1353
1386
|
let e;
|
|
1354
|
-
e = this.modules.formatter ? this.modules.formatter :
|
|
1355
|
-
let t = new
|
|
1356
|
-
this.store = new
|
|
1387
|
+
e = this.modules.formatter ? this.modules.formatter : ve;
|
|
1388
|
+
let t = new W(this.options);
|
|
1389
|
+
this.store = new pe(this.options.resources, this.options);
|
|
1357
1390
|
let i = this.services;
|
|
1358
|
-
i.logger =
|
|
1391
|
+
i.logger = I, i.resourceStore = this.store, i.languageUtils = t, i.pluralResolver = new he(t, {
|
|
1359
1392
|
prepend: this.options.pluralSeparator,
|
|
1360
1393
|
simplifyPluralSuffix: this.options.simplifyPluralSuffix
|
|
1361
|
-
}), 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"), e && (!this.options.interpolation.format || this.options.interpolation.format === n.interpolation.format) && (i.formatter = r(e), i.formatter.init && i.formatter.init(i, this.options), this.options.interpolation.format = i.formatter.format.bind(i.formatter)), i.interpolator = new
|
|
1394
|
+
}), 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"), e && (!this.options.interpolation.format || this.options.interpolation.format === n.interpolation.format) && (i.formatter = r(e), i.formatter.init && i.formatter.init(i, this.options), this.options.interpolation.format = i.formatter.format.bind(i.formatter)), i.interpolator = new Y(this.options), i.utils = { hasLoadedNamespace: this.hasLoadedNamespace.bind(this) }, i.backendConnector = new be(r(this.modules.backend), i.resourceStore, i, this.options), i.backendConnector.on("*", (e, ...t) => {
|
|
1362
1395
|
this.emit(e, ...t);
|
|
1363
|
-
}), this.modules.languageDetector && (i.languageDetector = r(this.modules.languageDetector), i.languageDetector.init && i.languageDetector.init(i, this.options.detection, this.options)), this.modules.i18nFormat && (i.i18nFormat = r(this.modules.i18nFormat), i.i18nFormat.init && i.i18nFormat.init(this)), this.translator = new
|
|
1396
|
+
}), this.modules.languageDetector && (i.languageDetector = r(this.modules.languageDetector), i.languageDetector.init && i.languageDetector.init(i, this.options.detection, this.options)), this.modules.i18nFormat && (i.i18nFormat = r(this.modules.i18nFormat), i.i18nFormat.init && i.i18nFormat.init(this)), this.translator = new U(this.services, this.options), this.translator.on("*", (e, ...t) => {
|
|
1364
1397
|
this.emit(e, ...t);
|
|
1365
1398
|
}), this.modules.external.forEach((e) => {
|
|
1366
1399
|
e.init && e.init(this);
|
|
1367
1400
|
});
|
|
1368
1401
|
}
|
|
1369
|
-
if (this.format = this.options.interpolation.format, t ||=
|
|
1402
|
+
if (this.format = this.options.interpolation.format, t ||= Q, this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) {
|
|
1370
1403
|
let e = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
|
|
1371
1404
|
e.length > 0 && e[0] !== "dev" && (this.options.lng = e[0]);
|
|
1372
1405
|
}
|
|
@@ -1385,7 +1418,7 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
1385
1418
|
].forEach((e) => {
|
|
1386
1419
|
this[e] = (...t) => (this.store[e](...t), this);
|
|
1387
1420
|
});
|
|
1388
|
-
let i =
|
|
1421
|
+
let i = E(), a = () => {
|
|
1389
1422
|
let e = (e, n) => {
|
|
1390
1423
|
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), i.resolve(n), t(e, n);
|
|
1391
1424
|
};
|
|
@@ -1394,8 +1427,8 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
1394
1427
|
};
|
|
1395
1428
|
return this.options.resources || !this.options.initAsync ? a() : setTimeout(a, 0), i;
|
|
1396
1429
|
}
|
|
1397
|
-
loadResources(e, t =
|
|
1398
|
-
let n = t, r =
|
|
1430
|
+
loadResources(e, t = Q) {
|
|
1431
|
+
let n = t, r = T(e) ? e : this.language;
|
|
1399
1432
|
if (typeof e == "function" && (n = e), !this.options.resources || this.options.partialBundledLanguages) {
|
|
1400
1433
|
if (r?.toLowerCase() === "cimode" && (!this.options.preload || this.options.preload.length === 0)) return n();
|
|
1401
1434
|
let e = [], t = (t) => {
|
|
@@ -1409,15 +1442,15 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
1409
1442
|
} else n(null);
|
|
1410
1443
|
}
|
|
1411
1444
|
reloadResources(e, t, n) {
|
|
1412
|
-
let r =
|
|
1413
|
-
return typeof e == "function" && (n = e, e = void 0), typeof t == "function" && (n = t, t = void 0), e ||= this.languages, t ||= this.options.ns, n ||=
|
|
1445
|
+
let r = E();
|
|
1446
|
+
return typeof e == "function" && (n = e, e = void 0), typeof t == "function" && (n = t, t = void 0), e ||= this.languages, t ||= this.options.ns, n ||= Q, this.services.backendConnector.reload(e, t, (e) => {
|
|
1414
1447
|
r.resolve(), n(e);
|
|
1415
1448
|
}), r;
|
|
1416
1449
|
}
|
|
1417
1450
|
use(e) {
|
|
1418
1451
|
if (!e) throw Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");
|
|
1419
1452
|
if (!e.type) throw Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");
|
|
1420
|
-
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" &&
|
|
1453
|
+
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" && R.addPostProcessor(e), e.type === "formatter" && (this.modules.formatter = e), e.type === "3rdParty" && this.modules.external.push(e), this;
|
|
1421
1454
|
}
|
|
1422
1455
|
setResolvedLanguage(e) {
|
|
1423
1456
|
if (!(!e || !this.languages) && !(["cimode", "dev"].indexOf(e) > -1)) {
|
|
@@ -1433,7 +1466,7 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
1433
1466
|
}
|
|
1434
1467
|
changeLanguage(e, t) {
|
|
1435
1468
|
this.isLanguageChangingTo = e;
|
|
1436
|
-
let n =
|
|
1469
|
+
let n = E();
|
|
1437
1470
|
this.emit("languageChanging", e);
|
|
1438
1471
|
let r = (e) => {
|
|
1439
1472
|
this.language = e, this.languages = this.services.languageUtils.toResolveHierarchy(e), this.resolvedLanguage = void 0, this.setResolvedLanguage(e);
|
|
@@ -1441,7 +1474,7 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
1441
1474
|
a ? this.isLanguageChangingTo === e && (r(a), this.translator.changeLanguage(a), this.isLanguageChangingTo = void 0, this.emit("languageChanged", a), this.logger.log("languageChanged", a)) : this.isLanguageChangingTo = void 0, n.resolve((...e) => this.t(...e)), t && t(i, (...e) => this.t(...e));
|
|
1442
1475
|
}, a = (t) => {
|
|
1443
1476
|
!e && !t && this.services.languageDetector && (t = []);
|
|
1444
|
-
let n =
|
|
1477
|
+
let n = T(t) ? t : t && t[0], a = this.store.hasLanguageSomeTranslations(n) ? n : this.services.languageUtils.getBestMatchFromCodes(T(t) ? [t] : t);
|
|
1445
1478
|
a && (this.language || r(a), this.translator.language || this.translator.changeLanguage(a), this.services.languageDetector?.cacheUserLanguage?.(a)), this.loadResources(a, (e) => {
|
|
1446
1479
|
i(e, a);
|
|
1447
1480
|
});
|
|
@@ -1456,11 +1489,11 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
1456
1489
|
...this.options,
|
|
1457
1490
|
...a
|
|
1458
1491
|
};
|
|
1459
|
-
typeof a.keyPrefix == "function" && (a.keyPrefix =
|
|
1492
|
+
typeof a.keyPrefix == "function" && (a.keyPrefix = B(a.keyPrefix, o));
|
|
1460
1493
|
let s = this.options.keySeparator || ".", c;
|
|
1461
|
-
return a.keyPrefix && Array.isArray(e) ? c = e.map((e) => (typeof e == "function" && (e =
|
|
1494
|
+
return a.keyPrefix && Array.isArray(e) ? c = e.map((e) => (typeof e == "function" && (e = B(e, o)), `${a.keyPrefix}${s}${e}`)) : (typeof e == "function" && (e = B(e, o)), c = a.keyPrefix ? `${a.keyPrefix}${s}${e}` : e), this.t(c, a);
|
|
1462
1495
|
};
|
|
1463
|
-
return
|
|
1496
|
+
return T(e) ? r.lng = e : r.lngs = e, r.ns = t, r.keyPrefix = n, r;
|
|
1464
1497
|
}
|
|
1465
1498
|
t(...e) {
|
|
1466
1499
|
return this.translator?.translate(...e);
|
|
@@ -1487,16 +1520,16 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
1487
1520
|
return !!(this.hasResourceBundle(n, e) || !this.services.backendConnector.backend || this.options.resources && !this.options.partialBundledLanguages || a(n, e) && (!r || a(i, e)));
|
|
1488
1521
|
}
|
|
1489
1522
|
loadNamespaces(e, t) {
|
|
1490
|
-
let n =
|
|
1491
|
-
return this.options.ns ? (
|
|
1523
|
+
let n = E();
|
|
1524
|
+
return this.options.ns ? (T(e) && (e = [e]), e.forEach((e) => {
|
|
1492
1525
|
this.options.ns.indexOf(e) < 0 && this.options.ns.push(e);
|
|
1493
1526
|
}), this.loadResources((e) => {
|
|
1494
1527
|
n.resolve(), t && t(e);
|
|
1495
1528
|
}), n) : (t && t(), Promise.resolve());
|
|
1496
1529
|
}
|
|
1497
1530
|
loadLanguages(e, t) {
|
|
1498
|
-
let n =
|
|
1499
|
-
|
|
1531
|
+
let n = E();
|
|
1532
|
+
T(e) && (e = [e]);
|
|
1500
1533
|
let r = this.options.preload || [], i = e.filter((e) => r.indexOf(e) < 0 && this.services.languageUtils.isSupportedCode(e));
|
|
1501
1534
|
return i.length ? (this.options.preload = r.concat(i), this.loadResources((e) => {
|
|
1502
1535
|
n.resolve(), t && t(e);
|
|
@@ -1511,14 +1544,14 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
1511
1544
|
if (e && e.direction) return e.direction;
|
|
1512
1545
|
}
|
|
1513
1546
|
} catch {}
|
|
1514
|
-
let t = /* @__PURE__ */ "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".split("."), n = this.services?.languageUtils || new
|
|
1547
|
+
let t = /* @__PURE__ */ "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".split("."), n = this.services?.languageUtils || new W(Z());
|
|
1515
1548
|
return e.toLowerCase().indexOf("-latn") > 1 ? "ltr" : t.indexOf(n.getLanguagePartFromCode(e)) > -1 || e.toLowerCase().indexOf("-arab") > 1 ? "rtl" : "ltr";
|
|
1516
1549
|
}
|
|
1517
1550
|
static createInstance(t = {}, n) {
|
|
1518
1551
|
let r = new e(t, n);
|
|
1519
1552
|
return r.createInstance = e.createInstance, r;
|
|
1520
1553
|
}
|
|
1521
|
-
cloneInstance(t = {}, n =
|
|
1554
|
+
cloneInstance(t = {}, n = Q) {
|
|
1522
1555
|
let r = t.forkResourceStore;
|
|
1523
1556
|
r && delete t.forkResourceStore;
|
|
1524
1557
|
let i = {
|
|
@@ -1532,18 +1565,18 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
1532
1565
|
"language"
|
|
1533
1566
|
].forEach((e) => {
|
|
1534
1567
|
a[e] = this[e];
|
|
1535
|
-
}), a.services = { ...this.services }, a.services.utils = { hasLoadedNamespace: a.hasLoadedNamespace.bind(a) }, r && (a.store = new
|
|
1568
|
+
}), a.services = { ...this.services }, a.services.utils = { hasLoadedNamespace: a.hasLoadedNamespace.bind(a) }, r && (a.store = new pe(Object.keys(this.store.data).reduce((e, t) => (e[t] = { ...this.store.data[t] }, e[t] = Object.keys(e[t]).reduce((n, r) => (n[r] = { ...e[t][r] }, n), e[t]), e), {}), i), a.services.resourceStore = a.store), t.interpolation) {
|
|
1536
1569
|
let e = {
|
|
1537
|
-
...
|
|
1570
|
+
...Z().interpolation,
|
|
1538
1571
|
...this.options.interpolation,
|
|
1539
1572
|
...t.interpolation
|
|
1540
1573
|
}, n = {
|
|
1541
1574
|
...i,
|
|
1542
1575
|
interpolation: e
|
|
1543
1576
|
};
|
|
1544
|
-
a.services.interpolator = new
|
|
1577
|
+
a.services.interpolator = new Y(n);
|
|
1545
1578
|
}
|
|
1546
|
-
return a.translator = new
|
|
1579
|
+
return a.translator = new U(a.services, i), a.translator.on("*", (e, ...t) => {
|
|
1547
1580
|
a.emit(e, ...t);
|
|
1548
1581
|
}), a.init(i, n), a.translator.options = i, a.translator.backendConnector.services.utils = { hasLoadedNamespace: a.hasLoadedNamespace.bind(a) }, a;
|
|
1549
1582
|
}
|
|
@@ -1559,20 +1592,20 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
1559
1592
|
}.createInstance();
|
|
1560
1593
|
//#endregion
|
|
1561
1594
|
//#region ../../shared/translator/dist/index.js
|
|
1562
|
-
|
|
1595
|
+
$.createInstance, $.dir, $.init, $.loadResources, $.reloadResources, $.use, $.changeLanguage, $.getFixedT, $.t, $.exists, $.setDefaultNamespace, $.hasLoadedNamespace, $.loadNamespaces, $.loadLanguages, $.init({
|
|
1563
1596
|
fallbackLng: "en",
|
|
1564
1597
|
lng: "en",
|
|
1565
1598
|
showSupportNotice: !1,
|
|
1566
1599
|
resources: {
|
|
1567
|
-
en:
|
|
1568
|
-
es:
|
|
1600
|
+
en: C,
|
|
1601
|
+
es: w
|
|
1569
1602
|
}
|
|
1570
1603
|
});
|
|
1571
1604
|
//#endregion
|
|
1572
1605
|
//#region src/i18n.ts
|
|
1573
|
-
var { translator:
|
|
1606
|
+
var { translator: De } = {
|
|
1574
1607
|
translator: {
|
|
1575
|
-
|
|
1608
|
+
...$,
|
|
1576
1609
|
t: (e, t) => {
|
|
1577
1610
|
let { lng: n } = t;
|
|
1578
1611
|
switch (n) {
|
|
@@ -1588,7 +1621,7 @@ var { translator: $ } = {
|
|
|
1588
1621
|
break;
|
|
1589
1622
|
default: break;
|
|
1590
1623
|
}
|
|
1591
|
-
return
|
|
1624
|
+
return $.t(e, {
|
|
1592
1625
|
lng: n,
|
|
1593
1626
|
...t
|
|
1594
1627
|
});
|
|
@@ -1602,13 +1635,13 @@ var { translator: $ } = {
|
|
|
1602
1635
|
label: "Spanish"
|
|
1603
1636
|
}]
|
|
1604
1637
|
};
|
|
1605
|
-
function
|
|
1606
|
-
return
|
|
1638
|
+
function Oe(e, t) {
|
|
1639
|
+
return De.t(`translation:simpleCloze:${e}`, { lng: t });
|
|
1607
1640
|
}
|
|
1608
|
-
function
|
|
1609
|
-
return
|
|
1641
|
+
function ke(e, t) {
|
|
1642
|
+
return De.t(`common:${e}`, { lng: t });
|
|
1610
1643
|
}
|
|
1611
1644
|
//#endregion
|
|
1612
|
-
export {
|
|
1645
|
+
export { ke as n, ee as r, Oe as t };
|
|
1613
1646
|
|
|
1614
|
-
//# sourceMappingURL=i18n-
|
|
1647
|
+
//# sourceMappingURL=i18n-BgA-56QR.js.map
|