@pie-element/simple-cloze 0.1.4-next.15 → 0.1.4-next.16
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/author/index.js +200 -171
- package/dist/author/index.js.map +1 -1
- package/dist/browser/author/index.js +2585 -2562
- package/dist/browser/author/index.js.map +1 -1
- package/dist/browser/delivery/index.js +1 -1
- package/dist/browser/editor-runtime/delivery/index.js +1 -1
- package/dist/browser/editor-runtime/{i18n-gsOjC7sf.js → i18n-C7YV9VIN.js} +291 -217
- package/dist/browser/editor-runtime/i18n-C7YV9VIN.js.map +1 -0
- package/dist/browser/editor-runtime/print/index.js +1 -1
- package/dist/browser/{i18n-gsOjC7sf.js → i18n-C7YV9VIN.js} +291 -217
- package/dist/browser/i18n-C7YV9VIN.js.map +1 -0
- package/dist/browser/print/index.js +1 -1
- package/dist/delivery/index.js +139 -58
- package/dist/delivery/index.js.map +1 -1
- package/dist/index.iife.js +2 -2
- package/dist/print/index.js +139 -58
- package/dist/print/index.js.map +1 -1
- package/module/print.js +265 -191
- package/module/print.js.map +1 -1
- package/package.json +1 -1
- package/dist/browser/editor-runtime/i18n-gsOjC7sf.js.map +0 -1
- package/dist/browser/i18n-gsOjC7sf.js.map +0 -1
|
@@ -1,122 +1,196 @@
|
|
|
1
1
|
//#region ../../shared/math-rendering-mathjax/dist/index.js
|
|
2
|
-
var e =
|
|
2
|
+
var e = "https://github.com/pie-framework/pie-players/blob/develop/docs/item-player/loading-strategies.md#one-mathjax-version-per-page", t = Symbol.for("@pie-element/shared-math-rendering-mathjax/unsupported-page");
|
|
3
|
+
function n(n, r) {
|
|
4
|
+
if (typeof window > "u") return;
|
|
5
|
+
let i = globalThis;
|
|
6
|
+
i[t] ??= {
|
|
7
|
+
logged: !1,
|
|
8
|
+
conditions: []
|
|
9
|
+
};
|
|
10
|
+
let a = i[t];
|
|
11
|
+
if (a.conditions.includes(n)) return;
|
|
12
|
+
a.conditions.push(n);
|
|
13
|
+
let o = `[math-rendering] Unsupported page (${n}): ${r}. PIE supports one MathJax major version per page; with MathJax 3 and 4 on one page, math rendering is best effort and may break. See ${e}`;
|
|
14
|
+
a.logged || (a.logged = !0, console.error(o)), window.dispatchEvent(new CustomEvent("pie-mathjax-version-conflict", { detail: {
|
|
15
|
+
condition: n,
|
|
16
|
+
message: o,
|
|
17
|
+
docsUrl: e
|
|
18
|
+
} }));
|
|
19
|
+
}
|
|
20
|
+
function r() {
|
|
21
|
+
let e = window.MathJax?.version;
|
|
22
|
+
return typeof e == "string" && e.startsWith("3.") ? e : void 0;
|
|
23
|
+
}
|
|
24
|
+
var i = "https://cdn.jsdelivr.net/npm/mathjax@4.1.3/tex-mml-chtml.js", a = {
|
|
3
25
|
parallelogram: "\\lower.2em{\\Huge\\unicode{x25B1}}",
|
|
4
26
|
overarc: "\\overparen",
|
|
5
27
|
napprox: "\\not\\approx",
|
|
6
28
|
longdiv: "\\enclose{longdiv}",
|
|
7
29
|
abs: ["\\left|#1\\right|", 1]
|
|
8
|
-
},
|
|
30
|
+
}, o = "[math-rendering] using $ is not advisable, please use $$..$$ or \\(...\\)", s = /\\\(|\\\[|\$\$|\\\$|\\begin\{|\\(?:eq)?ref\{/, c = /\\\(|\\\[|\$|\\begin\{|\\(?:eq)?ref\{/, l = /\\embed\{newLine\}\[\]/g, u = [
|
|
9
31
|
["$$", "$$"],
|
|
10
32
|
["$", "$"],
|
|
11
33
|
["\\[", "\\]"],
|
|
12
34
|
["\\(", "\\)"]
|
|
13
|
-
],
|
|
14
|
-
function
|
|
35
|
+
], d = Symbol.for("@pie-element/shared-math-rendering-mathjax/loading"), f = "PIE-MJX-CHTML-styles", p = "MJX-CHTML-styles", m = [p, "MJX-SVG-styles"], h = 201;
|
|
36
|
+
function g(e) {
|
|
37
|
+
let t = [...e.matches("mjx-container") ? [e] : [], ...e.querySelectorAll("mjx-container")];
|
|
38
|
+
for (let e of t) for (let t of [e, ...e.querySelectorAll("[data-latex],[data-latex-item]")]) t.removeAttribute("data-latex"), t.removeAttribute("data-latex-item");
|
|
39
|
+
}
|
|
40
|
+
function _() {
|
|
15
41
|
return window.MathJax;
|
|
16
42
|
}
|
|
17
|
-
function
|
|
43
|
+
function v(e) {
|
|
18
44
|
let t = e.includes("\\displaystyle") ? e.replace("\\displaystyle", "").trim() : e;
|
|
19
|
-
for (let [e, n] of
|
|
45
|
+
for (let [e, n] of u) if (t.startsWith(e) && t.endsWith(n)) return t.substring(e.length, t.length - n.length);
|
|
20
46
|
return t;
|
|
21
47
|
}
|
|
22
|
-
function
|
|
48
|
+
function y(e) {
|
|
23
49
|
for (let t of e.querySelectorAll("[data-latex]")) {
|
|
24
50
|
if (t.dataset.mathHandled || t.closest("mjx-container")) continue;
|
|
25
51
|
let e = t.textContent;
|
|
26
|
-
e && (t.textContent = `\\(${
|
|
52
|
+
e && (t.textContent = `\\(${v(e)}\\)`.replace(l, "\\newline "), t.dataset.mathHandled = "true");
|
|
27
53
|
}
|
|
28
54
|
}
|
|
29
|
-
function
|
|
55
|
+
function b(e, t) {
|
|
30
56
|
for (let t of e.querySelectorAll("math")) if (!t.closest("mjx-assistive-mml")) return !0;
|
|
31
|
-
return (t ?
|
|
57
|
+
return (t ? c : s).test(e.textContent ?? "");
|
|
32
58
|
}
|
|
33
|
-
function
|
|
34
|
-
return new Promise((
|
|
35
|
-
let { useSingleDollar:
|
|
59
|
+
function x(e) {
|
|
60
|
+
return new Promise((t, n) => {
|
|
61
|
+
let { useSingleDollar: r = !1, accessibility: s = !0, loadFonts: c = !0, srcUrl: l } = e, u = {
|
|
36
62
|
loader: {
|
|
37
|
-
load:
|
|
38
|
-
failed: (e) =>
|
|
63
|
+
load: s ? ["a11y/assistive-mml"] : [],
|
|
64
|
+
failed: (e) => n(e)
|
|
39
65
|
},
|
|
40
66
|
startup: {
|
|
41
67
|
typeset: !1,
|
|
42
68
|
ready: () => {
|
|
43
|
-
let e =
|
|
44
|
-
e?.defaultReady?.(), Promise.resolve(
|
|
69
|
+
let e = _(), r = e?.startup, i = !!e?.version?.startsWith("4.");
|
|
70
|
+
i && S(e), r?.defaultReady?.(), i && C(r?.document), Promise.resolve(r?.promise).then(() => t(), n);
|
|
45
71
|
}
|
|
46
72
|
},
|
|
47
|
-
tex: { macros: { ...
|
|
73
|
+
tex: { macros: { ...a } },
|
|
48
74
|
options: {
|
|
49
|
-
enableMenu:
|
|
75
|
+
enableMenu: s,
|
|
50
76
|
menuOptions: { settings: {
|
|
51
|
-
assistiveMml:
|
|
77
|
+
assistiveMml: s,
|
|
52
78
|
enrich: !1,
|
|
53
79
|
inTabOrder: !1
|
|
54
80
|
} }
|
|
55
81
|
}
|
|
56
82
|
};
|
|
57
|
-
|
|
83
|
+
r && u.tex && (console.warn(o), u.tex.inlineMath = [["$", "$"], ["\\(", "\\)"]], u.tex.processEscapes = !0), c || (u.chtml = { fontURL: "" }), window.MathJax = u;
|
|
58
84
|
let d = document.createElement("script");
|
|
59
|
-
d.src = l ||
|
|
85
|
+
d.src = l || i, d.async = !0, d.onerror = () => n(/* @__PURE__ */ Error("Failed to load MathJax")), document.head.appendChild(d);
|
|
60
86
|
});
|
|
61
87
|
}
|
|
62
|
-
function
|
|
88
|
+
function S(e) {
|
|
89
|
+
let t = e?._?.output?.chtml_ts?.CHTML;
|
|
90
|
+
t && (t.STYLESHEETID = f);
|
|
91
|
+
}
|
|
92
|
+
function C(e) {
|
|
93
|
+
if (!e) return;
|
|
94
|
+
let t = /* @__PURE__ */ new WeakSet(), n = (e) => {
|
|
95
|
+
let n = e.typesetRoot;
|
|
96
|
+
!n || t.has(n) || (g(n), t.add(n));
|
|
97
|
+
};
|
|
98
|
+
e.addRenderAction?.("pie-strip-latex", h, (e) => {
|
|
99
|
+
for (let t of e.math ?? []) n(t);
|
|
100
|
+
return !1;
|
|
101
|
+
}, (e) => {
|
|
102
|
+
let t = e.typesetRoot;
|
|
103
|
+
return t && g(t), !1;
|
|
104
|
+
});
|
|
105
|
+
let r = e.outputJax?.chtmlStyles;
|
|
106
|
+
r?.id === p && (r.id = f), E();
|
|
107
|
+
}
|
|
108
|
+
function w(e) {
|
|
109
|
+
return e instanceof HTMLStyleElement && m.includes(e.id);
|
|
110
|
+
}
|
|
111
|
+
function T(e) {
|
|
112
|
+
n("foreign-output-stylesheet", `another MathJax added <style id="${e.id}"> to <head>`);
|
|
113
|
+
}
|
|
114
|
+
function E() {
|
|
115
|
+
let e = document.head, t = [...e.children].find(w);
|
|
116
|
+
if (t) {
|
|
117
|
+
T(t);
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
let n = new MutationObserver((e) => {
|
|
121
|
+
for (let t of e) {
|
|
122
|
+
let e = [...t.addedNodes].find(w);
|
|
123
|
+
if (e) {
|
|
124
|
+
T(e), n.disconnect();
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
n.observe(e, { childList: !0 });
|
|
130
|
+
}
|
|
131
|
+
function D(e) {
|
|
63
132
|
return new Promise((t, n) => {
|
|
64
133
|
let r = e.startup ?? {};
|
|
65
134
|
e.startup = r;
|
|
66
135
|
let i = r.ready;
|
|
67
136
|
r.ready = () => {
|
|
68
|
-
let e =
|
|
137
|
+
let e = _()?.startup;
|
|
69
138
|
i ? i.call(r) : e?.defaultReady?.(), Promise.resolve(e?.promise).then(() => t(), n);
|
|
70
139
|
};
|
|
71
140
|
});
|
|
72
141
|
}
|
|
73
|
-
function
|
|
74
|
-
let t =
|
|
75
|
-
return t ? t.version ? t.startup?.promise ? Promise.resolve(t.startup.promise).then(() => void 0) : Promise.resolve() :
|
|
142
|
+
function O(e) {
|
|
143
|
+
let t = _();
|
|
144
|
+
return t ? t.version ? t.startup?.promise ? Promise.resolve(t.startup.promise).then(() => void 0) : Promise.resolve() : D(t) : x(e);
|
|
76
145
|
}
|
|
77
|
-
function
|
|
78
|
-
return
|
|
79
|
-
typeof
|
|
146
|
+
function ee(e) {
|
|
147
|
+
return O(e).then(() => {
|
|
148
|
+
typeof _()?.typesetPromise != "function" && console.warn("[mathjax-renderer] MathJax on this page has no typesetPromise; math stays untypeset.");
|
|
80
149
|
});
|
|
81
150
|
}
|
|
82
|
-
function
|
|
83
|
-
let t = globalThis, n = t[
|
|
84
|
-
return n || (n =
|
|
151
|
+
function te(e) {
|
|
152
|
+
let t = globalThis, n = t[d];
|
|
153
|
+
return n || (n = ee(e), t[d] = n), n;
|
|
85
154
|
}
|
|
86
|
-
function
|
|
155
|
+
function ne(e = {}) {
|
|
87
156
|
let t = e.useSingleDollar ?? !1;
|
|
88
|
-
return async (
|
|
157
|
+
return async (i) => {
|
|
89
158
|
if (typeof window > "u") return;
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
159
|
+
let a = r();
|
|
160
|
+
a && n("mathjax-3-global", `window.MathJax is MathJax ${a}`), y(i);
|
|
161
|
+
let o = te(e);
|
|
162
|
+
if (!b(i, t)) {
|
|
163
|
+
o.catch(() => {});
|
|
94
164
|
return;
|
|
95
165
|
}
|
|
96
|
-
await
|
|
97
|
-
let
|
|
98
|
-
await
|
|
166
|
+
await o;
|
|
167
|
+
let s = _();
|
|
168
|
+
await s?.startup?.promise, typeof s?.typesetPromise == "function" && (await s.typesetPromise([i]), g(i));
|
|
99
169
|
};
|
|
100
170
|
}
|
|
101
|
-
var
|
|
102
|
-
function
|
|
103
|
-
return !!window[
|
|
171
|
+
var k = "@pie-lib/math-rendering", re = "@pie-lib/math-rendering@2", A = null;
|
|
172
|
+
function ie() {
|
|
173
|
+
return !!window[re]?.opts?.useSingleDollar;
|
|
104
174
|
}
|
|
105
|
-
function
|
|
106
|
-
return
|
|
175
|
+
function ae() {
|
|
176
|
+
return A ||= ne({ useSingleDollar: ie() }), A;
|
|
107
177
|
}
|
|
108
|
-
function
|
|
178
|
+
function oe() {
|
|
109
179
|
if (typeof window > "u") return null;
|
|
110
|
-
let e = window[
|
|
180
|
+
let e = window[k];
|
|
111
181
|
return typeof e?.renderMath == "function" ? e : null;
|
|
112
182
|
}
|
|
113
|
-
|
|
183
|
+
function se() {
|
|
184
|
+
let e = r();
|
|
185
|
+
e && n("legacy-renderer-delegation", `window['${k}'] renders this element's math with MathJax ${e}`);
|
|
186
|
+
}
|
|
187
|
+
var ce = async (e) => {
|
|
114
188
|
if (typeof window > "u") return;
|
|
115
189
|
let t = typeof e == "string", n;
|
|
116
190
|
t ? (n = document.createElement("div"), n.innerHTML = e) : n = e || document.body;
|
|
117
|
-
let r =
|
|
118
|
-
return r ? await r.renderMath?.(n) : await
|
|
119
|
-
},
|
|
191
|
+
let r = oe();
|
|
192
|
+
return r ? (se(), await r.renderMath?.(n)) : await ae()(n), t ? n.innerHTML : void 0;
|
|
193
|
+
}, le = {
|
|
120
194
|
translation: {
|
|
121
195
|
categorize: {
|
|
122
196
|
limitMaxChoicesPerCategory: "You've reached the limit of {{maxChoicesPerCategory}} responses per area. To add another response, one must first be removed.",
|
|
@@ -256,7 +330,7 @@ var ee = async (e) => {
|
|
|
256
330
|
hideNote: "Hide Note",
|
|
257
331
|
cancel: "Cancel"
|
|
258
332
|
}
|
|
259
|
-
},
|
|
333
|
+
}, ue = {
|
|
260
334
|
translation: {
|
|
261
335
|
categorize: {
|
|
262
336
|
limitMaxChoicesPerCategory: "Has alcanzado el límite de {{maxChoicesPerCategory}} respuestas por área. Para agregar otra respuesta, primero se debe eliminar una respuesta.",
|
|
@@ -396,55 +470,55 @@ var ee = async (e) => {
|
|
|
396
470
|
hideNote: "Ocultar Nota",
|
|
397
471
|
cancel: "Cancelar"
|
|
398
472
|
}
|
|
399
|
-
},
|
|
473
|
+
}, j = (e) => typeof e == "string", M = () => {
|
|
400
474
|
let e, t, n = new Promise((n, r) => {
|
|
401
475
|
e = n, t = r;
|
|
402
476
|
});
|
|
403
477
|
return n.resolve = e, n.reject = t, n;
|
|
404
|
-
},
|
|
478
|
+
}, N = (e) => e == null ? "" : "" + e, de = (e, t, n) => {
|
|
405
479
|
e.forEach((e) => {
|
|
406
480
|
t[e] && (n[e] = t[e]);
|
|
407
481
|
});
|
|
408
|
-
},
|
|
409
|
-
let r =
|
|
482
|
+
}, fe = /###/g, P = (e) => e && e.indexOf("###") > -1 ? e.replace(fe, ".") : e, pe = (e) => !e || j(e), F = (e, t, n) => {
|
|
483
|
+
let r = j(t) ? t.split(".") : t, i = 0;
|
|
410
484
|
for (; i < r.length - 1;) {
|
|
411
|
-
if (
|
|
412
|
-
let t =
|
|
485
|
+
if (pe(e)) return {};
|
|
486
|
+
let t = P(r[i]);
|
|
413
487
|
!e[t] && n && (e[t] = new n()), e = Object.prototype.hasOwnProperty.call(e, t) ? e[t] : {}, ++i;
|
|
414
488
|
}
|
|
415
|
-
return
|
|
489
|
+
return pe(e) ? {} : {
|
|
416
490
|
obj: e,
|
|
417
|
-
k:
|
|
491
|
+
k: P(r[i])
|
|
418
492
|
};
|
|
419
|
-
},
|
|
420
|
-
let { obj: r, k: i } =
|
|
493
|
+
}, I = (e, t, n) => {
|
|
494
|
+
let { obj: r, k: i } = F(e, t, Object);
|
|
421
495
|
if (r !== void 0 || t.length === 1) {
|
|
422
496
|
r[i] = n;
|
|
423
497
|
return;
|
|
424
498
|
}
|
|
425
|
-
let a = t[t.length - 1], o = t.slice(0, t.length - 1), s =
|
|
426
|
-
for (; s.obj === void 0 && o.length;) a = `${o[o.length - 1]}.${a}`, o = o.slice(0, o.length - 1), s =
|
|
499
|
+
let a = t[t.length - 1], o = t.slice(0, t.length - 1), s = F(e, o, Object);
|
|
500
|
+
for (; s.obj === void 0 && o.length;) a = `${o[o.length - 1]}.${a}`, o = o.slice(0, o.length - 1), s = F(e, o, Object), s?.obj && s.obj[`${s.k}.${a}`] !== void 0 && (s.obj = void 0);
|
|
427
501
|
s.obj[`${s.k}.${a}`] = n;
|
|
428
|
-
},
|
|
429
|
-
let { obj: i, k: a } =
|
|
502
|
+
}, me = (e, t, n, r) => {
|
|
503
|
+
let { obj: i, k: a } = F(e, t, Object);
|
|
430
504
|
i[a] = i[a] || [], i[a].push(n);
|
|
431
|
-
},
|
|
432
|
-
let { obj: n, k: r } =
|
|
505
|
+
}, L = (e, t) => {
|
|
506
|
+
let { obj: n, k: r } = F(e, t);
|
|
433
507
|
if (n && Object.prototype.hasOwnProperty.call(n, r)) return n[r];
|
|
434
|
-
},
|
|
435
|
-
let r =
|
|
436
|
-
return r === void 0 ?
|
|
437
|
-
},
|
|
438
|
-
for (let r in t) r !== "__proto__" && r !== "constructor" && (r in e ?
|
|
508
|
+
}, he = (e, t, n) => {
|
|
509
|
+
let r = L(e, n);
|
|
510
|
+
return r === void 0 ? L(t, n) : r;
|
|
511
|
+
}, R = (e, t, n) => {
|
|
512
|
+
for (let r in t) r !== "__proto__" && r !== "constructor" && (r in e ? j(e[r]) || e[r] instanceof String || j(t[r]) || t[r] instanceof String ? n && (e[r] = t[r]) : R(e[r], t[r], n) : e[r] = t[r]);
|
|
439
513
|
return e;
|
|
440
|
-
},
|
|
514
|
+
}, z = (e) => e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"), ge = {
|
|
441
515
|
"&": "&",
|
|
442
516
|
"<": "<",
|
|
443
517
|
">": ">",
|
|
444
518
|
"\"": """,
|
|
445
519
|
"'": "'",
|
|
446
520
|
"/": "/"
|
|
447
|
-
},
|
|
521
|
+
}, _e = (e) => j(e) ? e.replace(/[&<>"'\/]/g, (e) => ge[e]) : e, ve = class {
|
|
448
522
|
constructor(e) {
|
|
449
523
|
this.capacity = e, this.regExpMap = /* @__PURE__ */ new Map(), this.regExpQueue = [];
|
|
450
524
|
}
|
|
@@ -454,23 +528,23 @@ var ee = async (e) => {
|
|
|
454
528
|
let n = new RegExp(e);
|
|
455
529
|
return this.regExpQueue.length === this.capacity && this.regExpMap.delete(this.regExpQueue.shift()), this.regExpMap.set(e, n), this.regExpQueue.push(e), n;
|
|
456
530
|
}
|
|
457
|
-
},
|
|
531
|
+
}, ye = [
|
|
458
532
|
" ",
|
|
459
533
|
",",
|
|
460
534
|
"?",
|
|
461
535
|
"!",
|
|
462
536
|
";"
|
|
463
|
-
],
|
|
537
|
+
], be = new ve(20), xe = (e, t, n) => {
|
|
464
538
|
t ||= "", n ||= "";
|
|
465
|
-
let r =
|
|
539
|
+
let r = ye.filter((e) => t.indexOf(e) < 0 && n.indexOf(e) < 0);
|
|
466
540
|
if (r.length === 0) return !0;
|
|
467
|
-
let i =
|
|
541
|
+
let i = be.getRegExp(`(${r.map((e) => e === "?" ? "\\?" : e).join("|")})`), a = !i.test(e);
|
|
468
542
|
if (!a) {
|
|
469
543
|
let t = e.indexOf(n);
|
|
470
544
|
t > 0 && !i.test(e.substring(0, t)) && (a = !0);
|
|
471
545
|
}
|
|
472
546
|
return a;
|
|
473
|
-
},
|
|
547
|
+
}, B = (e, t, n = ".") => {
|
|
474
548
|
if (!e) return;
|
|
475
549
|
if (e[t]) return Object.prototype.hasOwnProperty.call(e, t) ? e[t] : void 0;
|
|
476
550
|
let r = t.split(n), i = e;
|
|
@@ -489,7 +563,7 @@ var ee = async (e) => {
|
|
|
489
563
|
i = t;
|
|
490
564
|
}
|
|
491
565
|
return i;
|
|
492
|
-
},
|
|
566
|
+
}, V = (e) => e?.replace(/_/g, "-"), Se = {
|
|
493
567
|
type: "logger",
|
|
494
568
|
log(e) {
|
|
495
569
|
this.output("log", e);
|
|
@@ -503,12 +577,12 @@ var ee = async (e) => {
|
|
|
503
577
|
output(e, t) {
|
|
504
578
|
console?.[e]?.apply?.(console, t);
|
|
505
579
|
}
|
|
506
|
-
},
|
|
580
|
+
}, H = new class e {
|
|
507
581
|
constructor(e, t = {}) {
|
|
508
582
|
this.init(e, t);
|
|
509
583
|
}
|
|
510
584
|
init(e, t = {}) {
|
|
511
|
-
this.prefix = t.prefix || "i18next:", this.logger = e ||
|
|
585
|
+
this.prefix = t.prefix || "i18next:", this.logger = e || Se, this.options = t, this.debug = t.debug;
|
|
512
586
|
}
|
|
513
587
|
log(...e) {
|
|
514
588
|
return this.forward(e, "log", "", !0);
|
|
@@ -523,7 +597,7 @@ var ee = async (e) => {
|
|
|
523
597
|
return this.forward(e, "warn", "WARNING DEPRECATED: ", !0);
|
|
524
598
|
}
|
|
525
599
|
forward(e, t, n, r) {
|
|
526
|
-
return r && !this.debug ? null : (
|
|
600
|
+
return r && !this.debug ? null : (j(e[0]) && (e[0] = `${n}${this.prefix} ${e[0]}`), this.logger[t](e));
|
|
527
601
|
}
|
|
528
602
|
create(t) {
|
|
529
603
|
return new e(this.logger, {
|
|
@@ -534,7 +608,7 @@ var ee = async (e) => {
|
|
|
534
608
|
clone(t) {
|
|
535
609
|
return t ||= this.options, t.prefix = t.prefix || this.prefix, new e(this.logger, t);
|
|
536
610
|
}
|
|
537
|
-
}(),
|
|
611
|
+
}(), U = class {
|
|
538
612
|
constructor() {
|
|
539
613
|
this.observers = {};
|
|
540
614
|
}
|
|
@@ -561,7 +635,7 @@ var ee = async (e) => {
|
|
|
561
635
|
for (let i = 0; i < r; i++) n.apply(n, [e, ...t]);
|
|
562
636
|
});
|
|
563
637
|
}
|
|
564
|
-
},
|
|
638
|
+
}, W = class extends U {
|
|
565
639
|
constructor(e, t = {
|
|
566
640
|
ns: ["translation"],
|
|
567
641
|
defaultNS: "translation"
|
|
@@ -577,16 +651,16 @@ var ee = async (e) => {
|
|
|
577
651
|
}
|
|
578
652
|
getResource(e, t, n, r = {}) {
|
|
579
653
|
let i = r.keySeparator === void 0 ? this.options.keySeparator : r.keySeparator, a = r.ignoreJSONStructure === void 0 ? this.options.ignoreJSONStructure : r.ignoreJSONStructure, o;
|
|
580
|
-
e.indexOf(".") > -1 ? o = e.split(".") : (o = [e, t], n && (Array.isArray(n) ? o.push(...n) :
|
|
581
|
-
let s =
|
|
582
|
-
return !s && !t && !n && e.indexOf(".") > -1 && (e = o[0], t = o[1], n = o.slice(2).join(".")), s || !a || !
|
|
654
|
+
e.indexOf(".") > -1 ? o = e.split(".") : (o = [e, t], n && (Array.isArray(n) ? o.push(...n) : j(n) && i ? o.push(...n.split(i)) : o.push(n)));
|
|
655
|
+
let s = L(this.data, o);
|
|
656
|
+
return !s && !t && !n && e.indexOf(".") > -1 && (e = o[0], t = o[1], n = o.slice(2).join(".")), s || !a || !j(n) ? s : B(this.data?.[e]?.[t], n, i);
|
|
583
657
|
}
|
|
584
658
|
addResource(e, t, n, r, i = { silent: !1 }) {
|
|
585
659
|
let a = i.keySeparator === void 0 ? this.options.keySeparator : i.keySeparator, o = [e, t];
|
|
586
|
-
n && (o = o.concat(a ? n.split(a) : n)), e.indexOf(".") > -1 && (o = e.split("."), r = t, t = o[1]), this.addNamespaces(t),
|
|
660
|
+
n && (o = o.concat(a ? n.split(a) : n)), e.indexOf(".") > -1 && (o = e.split("."), r = t, t = o[1]), this.addNamespaces(t), I(this.data, o, r), i.silent || this.emit("added", e, t, n, r);
|
|
587
661
|
}
|
|
588
662
|
addResources(e, t, n, r = { silent: !1 }) {
|
|
589
|
-
for (let r in n) (
|
|
663
|
+
for (let r in n) (j(n[r]) || Array.isArray(n[r])) && this.addResource(e, t, r, n[r], { silent: !0 });
|
|
590
664
|
r.silent || this.emit("added", e, t, n);
|
|
591
665
|
}
|
|
592
666
|
addResourceBundle(e, t, n, r, i, a = {
|
|
@@ -595,11 +669,11 @@ var ee = async (e) => {
|
|
|
595
669
|
}) {
|
|
596
670
|
let o = [e, t];
|
|
597
671
|
e.indexOf(".") > -1 && (o = e.split("."), r = n, n = t, t = o[1]), this.addNamespaces(t);
|
|
598
|
-
let s =
|
|
599
|
-
a.skipCopy || (n = JSON.parse(JSON.stringify(n))), r ?
|
|
672
|
+
let s = L(this.data, o) || {};
|
|
673
|
+
a.skipCopy || (n = JSON.parse(JSON.stringify(n))), r ? R(s, n, i) : s = {
|
|
600
674
|
...s,
|
|
601
675
|
...n
|
|
602
|
-
},
|
|
676
|
+
}, I(this.data, o, s), a.silent || this.emit("added", e, t, n);
|
|
603
677
|
}
|
|
604
678
|
removeResourceBundle(e, t) {
|
|
605
679
|
this.hasResourceBundle(e, t) && delete this.data[e][t], this.removeNamespaces(t), this.emit("removed", e, t);
|
|
@@ -620,7 +694,7 @@ var ee = async (e) => {
|
|
|
620
694
|
toJSON() {
|
|
621
695
|
return this.data;
|
|
622
696
|
}
|
|
623
|
-
},
|
|
697
|
+
}, G = {
|
|
624
698
|
processors: {},
|
|
625
699
|
addPostProcessor(e) {
|
|
626
700
|
this.processors[e.name] = e;
|
|
@@ -630,22 +704,22 @@ var ee = async (e) => {
|
|
|
630
704
|
t = this.processors[e]?.process(t, n, r, i) ?? t;
|
|
631
705
|
}), t;
|
|
632
706
|
}
|
|
633
|
-
},
|
|
634
|
-
function
|
|
707
|
+
}, K = Symbol("i18next/PATH_KEY");
|
|
708
|
+
function Ce() {
|
|
635
709
|
let e = [], t = Object.create(null), n;
|
|
636
|
-
return t.get = (r, i) => (n?.revoke?.(), i ===
|
|
710
|
+
return t.get = (r, i) => (n?.revoke?.(), i === K ? e : (e.push(i), n = Proxy.revocable(r, t), n.proxy)), Proxy.revocable(Object.create(null), t).proxy;
|
|
637
711
|
}
|
|
638
|
-
function
|
|
639
|
-
let { [
|
|
712
|
+
function q(e, t) {
|
|
713
|
+
let { [K]: n } = e(Ce()), r = t?.keySeparator ?? ".", i = t?.nsSeparator ?? ":";
|
|
640
714
|
if (n.length > 1 && i) {
|
|
641
715
|
let e = t?.ns, a = Array.isArray(e) ? e : null;
|
|
642
716
|
if (a && a.length > 1 && a.slice(1).includes(n[0])) return `${n[0]}${i}${n.slice(1).join(r)}`;
|
|
643
717
|
}
|
|
644
718
|
return n.join(r);
|
|
645
719
|
}
|
|
646
|
-
var
|
|
720
|
+
var J = {}, Y = (e) => !j(e) && typeof e != "boolean" && typeof e != "number", we = class e extends U {
|
|
647
721
|
constructor(e, t = {}) {
|
|
648
|
-
super(),
|
|
722
|
+
super(), de([
|
|
649
723
|
"resourceStore",
|
|
650
724
|
"languageUtils",
|
|
651
725
|
"pluralResolver",
|
|
@@ -653,7 +727,7 @@ var V = {}, H = (e) => !T(e) && typeof e != "boolean" && typeof e != "number", U
|
|
|
653
727
|
"backendConnector",
|
|
654
728
|
"i18nFormat",
|
|
655
729
|
"utils"
|
|
656
|
-
], e, this), this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.logger =
|
|
730
|
+
], e, this), this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.logger = H.create("translator");
|
|
657
731
|
}
|
|
658
732
|
changeLanguage(e) {
|
|
659
733
|
e && (this.language = e);
|
|
@@ -663,34 +737,34 @@ var V = {}, H = (e) => !T(e) && typeof e != "boolean" && typeof e != "number", U
|
|
|
663
737
|
if (e == null) return !1;
|
|
664
738
|
let r = this.resolve(e, n);
|
|
665
739
|
if (r?.res === void 0) return !1;
|
|
666
|
-
let i =
|
|
740
|
+
let i = Y(r.res);
|
|
667
741
|
return !(n.returnObjects === !1 && i);
|
|
668
742
|
}
|
|
669
743
|
extractFromKey(e, t) {
|
|
670
744
|
let n = t.nsSeparator === void 0 ? this.options.nsSeparator : t.nsSeparator;
|
|
671
745
|
n === void 0 && (n = ":");
|
|
672
|
-
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 && !
|
|
746
|
+
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 && !xe(e, n, r);
|
|
673
747
|
if (a && !o) {
|
|
674
748
|
let t = e.match(this.interpolator.nestingRegexp);
|
|
675
749
|
if (t && t.length > 0) return {
|
|
676
750
|
key: e,
|
|
677
|
-
namespaces:
|
|
751
|
+
namespaces: j(i) ? [i] : i
|
|
678
752
|
};
|
|
679
753
|
let a = e.split(n);
|
|
680
754
|
(n !== r || n === r && this.options.ns.indexOf(a[0]) > -1) && (i = a.shift()), e = a.join(r);
|
|
681
755
|
}
|
|
682
756
|
return {
|
|
683
757
|
key: e,
|
|
684
|
-
namespaces:
|
|
758
|
+
namespaces: j(i) ? [i] : i
|
|
685
759
|
};
|
|
686
760
|
}
|
|
687
761
|
translate(t, n, r) {
|
|
688
762
|
let i = typeof n == "object" ? { ...n } : n;
|
|
689
763
|
if (typeof i != "object" && this.options.overloadTranslationOptionHandler && (i = this.options.overloadTranslationOptionHandler(arguments)), typeof i == "object" && (i = { ...i }), i ||= {}, t == null) return "";
|
|
690
|
-
typeof t == "function" && (t =
|
|
764
|
+
typeof t == "function" && (t = q(t, {
|
|
691
765
|
...this.options,
|
|
692
766
|
...i
|
|
693
|
-
})), Array.isArray(t) || (t = [String(t)]), t = t.map((e) => typeof e == "function" ?
|
|
767
|
+
})), Array.isArray(t) || (t = [String(t)]), t = t.map((e) => typeof e == "function" ? q(e, {
|
|
694
768
|
...this.options,
|
|
695
769
|
...i
|
|
696
770
|
}) : String(e));
|
|
@@ -716,10 +790,10 @@ var V = {}, H = (e) => !T(e) && typeof e != "boolean" && typeof e != "number", U
|
|
|
716
790
|
"[object Number]",
|
|
717
791
|
"[object Function]",
|
|
718
792
|
"[object RegExp]"
|
|
719
|
-
], v = i.joinArrays === void 0 ? this.options.joinArrays : i.joinArrays, y = !this.i18nFormat || this.i18nFormat.handleAsObject, b = i.count !== void 0 && !
|
|
720
|
-
y && !m && x && (E =
|
|
721
|
-
let D =
|
|
722
|
-
if (y && E && D && _.indexOf(O) < 0 && !(
|
|
793
|
+
], v = i.joinArrays === void 0 ? this.options.joinArrays : i.joinArrays, y = !this.i18nFormat || this.i18nFormat.handleAsObject, b = i.count !== void 0 && !j(i.count), x = e.hasDefaultValue(i), S = b ? this.pluralResolver.getSuffix(d, i.count, i) : "", C = i.ordinal && b ? this.pluralResolver.getSuffix(d, i.count, { ordinal: !1 }) : "", w = b && !i.ordinal && i.count === 0, T = w && i[`defaultValue${this.options.pluralSeparator}zero`] || i[`defaultValue${S}`] || i[`defaultValue${C}`] || i.defaultValue, E = m;
|
|
794
|
+
y && !m && x && (E = T);
|
|
795
|
+
let D = Y(E), O = Object.prototype.toString.apply(E);
|
|
796
|
+
if (y && E && D && _.indexOf(O) < 0 && !(j(v) && Array.isArray(E))) {
|
|
723
797
|
if (!i.returnObjects && !this.options.returnObjects) {
|
|
724
798
|
this.options.returnedObjectHandler || this.logger.warn("accessing an object - but returnObjects options is not enabled!");
|
|
725
799
|
let e = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(h, E, {
|
|
@@ -734,7 +808,7 @@ var V = {}, H = (e) => !T(e) && typeof e != "boolean" && typeof e != "number", U
|
|
|
734
808
|
let r = `${n}${o}${e}`;
|
|
735
809
|
x && !m ? t[e] = this.translate(r, {
|
|
736
810
|
...i,
|
|
737
|
-
defaultValue:
|
|
811
|
+
defaultValue: Y(T) ? T[e] : void 0,
|
|
738
812
|
joinArrays: !1,
|
|
739
813
|
ns: c
|
|
740
814
|
}) : t[e] = this.translate(r, {
|
|
@@ -745,13 +819,13 @@ var V = {}, H = (e) => !T(e) && typeof e != "boolean" && typeof e != "number", U
|
|
|
745
819
|
}
|
|
746
820
|
m = t;
|
|
747
821
|
}
|
|
748
|
-
} else if (y &&
|
|
822
|
+
} else if (y && j(v) && Array.isArray(m)) m = m.join(v), m &&= this.extendTranslation(m, t, i, r);
|
|
749
823
|
else {
|
|
750
824
|
let e = !1, n = !1;
|
|
751
|
-
!this.isValidLookup(m) && x && (e = !0, m =
|
|
752
|
-
let a = (i.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && n ? void 0 : m, c = x &&
|
|
825
|
+
!this.isValidLookup(m) && x && (e = !0, m = T), this.isValidLookup(m) || (n = !0, m = s);
|
|
826
|
+
let a = (i.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && n ? void 0 : m, c = x && T !== m && this.options.updateMissing;
|
|
753
827
|
if (n || e || c) {
|
|
754
|
-
if (this.logger.log(c ? "updateKey" : "missingKey", d, l, s, c ?
|
|
828
|
+
if (this.logger.log(c ? "updateKey" : "missingKey", d, l, s, c ? T : m), o) {
|
|
755
829
|
let e = this.resolve(s, {
|
|
756
830
|
...i,
|
|
757
831
|
keySeparator: !1
|
|
@@ -767,10 +841,10 @@ var V = {}, H = (e) => !T(e) && typeof e != "boolean" && typeof e != "number", U
|
|
|
767
841
|
};
|
|
768
842
|
this.options.saveMissing && (this.options.saveMissingPlurals && b ? e.forEach((e) => {
|
|
769
843
|
let t = this.pluralResolver.getSuffixes(e, i);
|
|
770
|
-
|
|
771
|
-
n([e], s + t, i[`defaultValue${t}`] ||
|
|
844
|
+
w && i[`defaultValue${this.options.pluralSeparator}zero`] && t.indexOf(`${this.options.pluralSeparator}zero`) < 0 && t.push(`${this.options.pluralSeparator}zero`), t.forEach((t) => {
|
|
845
|
+
n([e], s + t, i[`defaultValue${t}`] || T);
|
|
772
846
|
});
|
|
773
|
-
}) : n(e, s,
|
|
847
|
+
}) : n(e, s, T));
|
|
774
848
|
}
|
|
775
849
|
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));
|
|
776
850
|
}
|
|
@@ -789,12 +863,12 @@ var V = {}, H = (e) => !T(e) && typeof e != "boolean" && typeof e != "number", U
|
|
|
789
863
|
...n.interpolation
|
|
790
864
|
}
|
|
791
865
|
});
|
|
792
|
-
let a =
|
|
866
|
+
let a = j(e) && (n?.interpolation?.skipOnVariables === void 0 ? this.options.interpolation.skipOnVariables : n.interpolation.skipOnVariables), o;
|
|
793
867
|
if (a) {
|
|
794
868
|
let t = e.match(this.interpolator.nestingRegexp);
|
|
795
869
|
o = t && t.length;
|
|
796
870
|
}
|
|
797
|
-
let s = n.replace && !
|
|
871
|
+
let s = n.replace && !j(n.replace) ? n.replace : n;
|
|
798
872
|
if (this.options.interpolation.defaultVariables && (s = {
|
|
799
873
|
...this.options.interpolation.defaultVariables,
|
|
800
874
|
...s
|
|
@@ -804,8 +878,8 @@ var V = {}, H = (e) => !T(e) && typeof e != "boolean" && typeof e != "number", U
|
|
|
804
878
|
}
|
|
805
879
|
!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();
|
|
806
880
|
}
|
|
807
|
-
let a = n.postProcess || this.options.postProcess, o =
|
|
808
|
-
return e != null && o?.length && n.applyPostProcessor !== !1 && (e =
|
|
881
|
+
let a = n.postProcess || this.options.postProcess, o = j(a) ? [a] : a;
|
|
882
|
+
return e != null && o?.length && n.applyPostProcessor !== !1 && (e = G.handle(o, e, t, this.options && this.options.postProcessPassResolved ? {
|
|
809
883
|
i18nResolved: {
|
|
810
884
|
...r,
|
|
811
885
|
usedParams: this.getUsedParamsDetails(n)
|
|
@@ -815,7 +889,7 @@ var V = {}, H = (e) => !T(e) && typeof e != "boolean" && typeof e != "number", U
|
|
|
815
889
|
}
|
|
816
890
|
resolve(e, t = {}) {
|
|
817
891
|
let n, r, i, a, o;
|
|
818
|
-
return
|
|
892
|
+
return j(e) && (e = [e]), Array.isArray(e) && (e = e.map((e) => typeof e == "function" ? q(e, {
|
|
819
893
|
...this.options,
|
|
820
894
|
...t
|
|
821
895
|
}) : e)), e.forEach((e) => {
|
|
@@ -824,9 +898,9 @@ var V = {}, H = (e) => !T(e) && typeof e != "boolean" && typeof e != "number", U
|
|
|
824
898
|
r = c;
|
|
825
899
|
let l = s.namespaces;
|
|
826
900
|
this.options.fallbackNS && (l = l.concat(this.options.fallbackNS));
|
|
827
|
-
let u = t.count !== void 0 && !
|
|
901
|
+
let u = t.count !== void 0 && !j(t.count), d = u && !t.ordinal && t.count === 0, f = t.context !== void 0 && (j(t.context) || typeof t.context == "number") && t.context !== "", p = t.lngs ? t.lngs : this.languageUtils.toResolveHierarchy(t.lng || this.language, t.fallbackLng);
|
|
828
902
|
l.forEach((e) => {
|
|
829
|
-
this.isValidLookup(n) || (o = e, !
|
|
903
|
+
this.isValidLookup(n) || (o = e, !J[`${p[0]}-${e}`] && this.utils?.hasLoadedNamespace && !this.utils?.hasLoadedNamespace(o) && (J[`${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) => {
|
|
830
904
|
if (this.isValidLookup(n)) return;
|
|
831
905
|
a = r;
|
|
832
906
|
let o = [c];
|
|
@@ -875,7 +949,7 @@ var V = {}, H = (e) => !T(e) && typeof e != "boolean" && typeof e != "number", U
|
|
|
875
949
|
"joinArrays",
|
|
876
950
|
"postProcess",
|
|
877
951
|
"interpolation"
|
|
878
|
-
], n = e.replace && !
|
|
952
|
+
], n = e.replace && !j(e.replace), r = n ? e.replace : e;
|
|
879
953
|
if (n && e.count !== void 0 && (r.count = e.count), this.options.interpolation.defaultVariables && (r = {
|
|
880
954
|
...this.options.interpolation.defaultVariables,
|
|
881
955
|
...r
|
|
@@ -889,22 +963,22 @@ var V = {}, H = (e) => !T(e) && typeof e != "boolean" && typeof e != "number", U
|
|
|
889
963
|
for (let t in e) if (Object.prototype.hasOwnProperty.call(e, t) && t.substring(0, 12) === "defaultValue" && e[t] !== void 0) return !0;
|
|
890
964
|
return !1;
|
|
891
965
|
}
|
|
892
|
-
},
|
|
966
|
+
}, Te = class {
|
|
893
967
|
constructor(e) {
|
|
894
|
-
this.options = e, this.supportedLngs = this.options.supportedLngs || !1, this.logger =
|
|
968
|
+
this.options = e, this.supportedLngs = this.options.supportedLngs || !1, this.logger = H.create("languageUtils");
|
|
895
969
|
}
|
|
896
970
|
getScriptPartFromCode(e) {
|
|
897
|
-
if (e =
|
|
971
|
+
if (e = V(e), !e || e.indexOf("-") < 0) return null;
|
|
898
972
|
let t = e.split("-");
|
|
899
973
|
return t.length === 2 || (t.pop(), t[t.length - 1].toLowerCase() === "x") ? null : this.formatLanguageCode(t.join("-"));
|
|
900
974
|
}
|
|
901
975
|
getLanguagePartFromCode(e) {
|
|
902
|
-
if (e =
|
|
976
|
+
if (e = V(e), !e || e.indexOf("-") < 0) return e;
|
|
903
977
|
let t = e.split("-");
|
|
904
978
|
return this.formatLanguageCode(t[0]);
|
|
905
979
|
}
|
|
906
980
|
formatLanguageCode(e) {
|
|
907
|
-
if (
|
|
981
|
+
if (j(e) && e.indexOf("-") > -1) {
|
|
908
982
|
let t;
|
|
909
983
|
try {
|
|
910
984
|
t = Intl.getCanonicalLocales(e)[0];
|
|
@@ -936,7 +1010,7 @@ var V = {}, H = (e) => !T(e) && typeof e != "boolean" && typeof e != "number", U
|
|
|
936
1010
|
}
|
|
937
1011
|
getFallbackCodes(e, t) {
|
|
938
1012
|
if (!e) return [];
|
|
939
|
-
if (typeof e == "function" && (e = e(t)),
|
|
1013
|
+
if (typeof e == "function" && (e = e(t)), j(e) && (e = [e]), Array.isArray(e)) return e;
|
|
940
1014
|
if (!t) return e.default || [];
|
|
941
1015
|
let n = e[t];
|
|
942
1016
|
return n ||= e[this.getScriptPartFromCode(t)], n ||= e[this.formatLanguageCode(t)], n ||= e[this.getLanguagePartFromCode(t)], n ||= e.default, n || [];
|
|
@@ -945,29 +1019,29 @@ var V = {}, H = (e) => !T(e) && typeof e != "boolean" && typeof e != "number", U
|
|
|
945
1019
|
let n = this.getFallbackCodes((t === !1 ? [] : t) || this.options.fallbackLng || [], e), r = [], i = (e) => {
|
|
946
1020
|
e && (this.isSupportedCode(e) ? r.push(e) : this.logger.warn(`rejecting language code not found in supportedLngs: ${e}`));
|
|
947
1021
|
};
|
|
948
|
-
return
|
|
1022
|
+
return j(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))) : j(e) && i(this.formatLanguageCode(e)), n.forEach((e) => {
|
|
949
1023
|
r.indexOf(e) < 0 && i(this.formatLanguageCode(e));
|
|
950
1024
|
}), r;
|
|
951
1025
|
}
|
|
952
|
-
},
|
|
1026
|
+
}, Ee = {
|
|
953
1027
|
zero: 0,
|
|
954
1028
|
one: 1,
|
|
955
1029
|
two: 2,
|
|
956
1030
|
few: 3,
|
|
957
1031
|
many: 4,
|
|
958
1032
|
other: 5
|
|
959
|
-
},
|
|
1033
|
+
}, De = {
|
|
960
1034
|
select: (e) => e === 1 ? "one" : "other",
|
|
961
1035
|
resolvedOptions: () => ({ pluralCategories: ["one", "other"] })
|
|
962
|
-
},
|
|
1036
|
+
}, Oe = class {
|
|
963
1037
|
constructor(e, t = {}) {
|
|
964
|
-
this.languageUtils = e, this.options = t, this.logger =
|
|
1038
|
+
this.languageUtils = e, this.options = t, this.logger = H.create("pluralResolver"), this.pluralRulesCache = {};
|
|
965
1039
|
}
|
|
966
1040
|
clearCache() {
|
|
967
1041
|
this.pluralRulesCache = {};
|
|
968
1042
|
}
|
|
969
1043
|
getRule(e, t = {}) {
|
|
970
|
-
let n =
|
|
1044
|
+
let n = V(e === "dev" ? "en" : e), r = t.ordinal ? "ordinal" : "cardinal", i = JSON.stringify({
|
|
971
1045
|
cleanedCode: n,
|
|
972
1046
|
type: r
|
|
973
1047
|
});
|
|
@@ -976,8 +1050,8 @@ var V = {}, H = (e) => !T(e) && typeof e != "boolean" && typeof e != "number", U
|
|
|
976
1050
|
try {
|
|
977
1051
|
a = new Intl.PluralRules(n, { type: r });
|
|
978
1052
|
} catch {
|
|
979
|
-
if (typeof Intl > "u") return this.logger.error("No Intl support, please use an Intl polyfill!"),
|
|
980
|
-
if (!e.match(/-|_/)) return
|
|
1053
|
+
if (typeof Intl > "u") return this.logger.error("No Intl support, please use an Intl polyfill!"), De;
|
|
1054
|
+
if (!e.match(/-|_/)) return De;
|
|
981
1055
|
let n = this.languageUtils.getLanguagePartFromCode(e);
|
|
982
1056
|
a = this.getRule(n, t);
|
|
983
1057
|
}
|
|
@@ -992,23 +1066,23 @@ var V = {}, H = (e) => !T(e) && typeof e != "boolean" && typeof e != "number", U
|
|
|
992
1066
|
}
|
|
993
1067
|
getSuffixes(e, t = {}) {
|
|
994
1068
|
let n = this.getRule(e, t);
|
|
995
|
-
return n ||= this.getRule("dev", t), n ? n.resolvedOptions().pluralCategories.sort((e, t) =>
|
|
1069
|
+
return n ||= this.getRule("dev", t), n ? n.resolvedOptions().pluralCategories.sort((e, t) => Ee[e] - Ee[t]).map((e) => `${this.options.prepend}${t.ordinal ? `ordinal${this.options.prepend}` : ""}${e}`) : [];
|
|
996
1070
|
}
|
|
997
1071
|
getSuffix(e, t, n = {}) {
|
|
998
1072
|
let r = this.getRule(e, n);
|
|
999
1073
|
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));
|
|
1000
1074
|
}
|
|
1001
|
-
},
|
|
1002
|
-
let a =
|
|
1003
|
-
return !a && i &&
|
|
1004
|
-
},
|
|
1075
|
+
}, ke = (e, t, n, r = ".", i = !0) => {
|
|
1076
|
+
let a = he(e, t, n);
|
|
1077
|
+
return !a && i && j(n) && (a = B(e, n, r), a === void 0 && (a = B(t, n, r))), a;
|
|
1078
|
+
}, X = (e) => e.replace(/\$/g, "$$$$"), Ae = class {
|
|
1005
1079
|
constructor(e = {}) {
|
|
1006
|
-
this.logger =
|
|
1080
|
+
this.logger = H.create("interpolator"), this.options = e, this.format = e?.interpolation?.format || ((e) => e), this.init(e);
|
|
1007
1081
|
}
|
|
1008
1082
|
init(e = {}) {
|
|
1009
1083
|
e.interpolation ||= { escapeValue: !0 };
|
|
1010
1084
|
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;
|
|
1011
|
-
this.escape = t === void 0 ?
|
|
1085
|
+
this.escape = t === void 0 ? _e : t, this.escapeValue = n === void 0 || n, this.useRawValueToEscape = r !== void 0 && r, this.prefix = i ? z(i) : a || "{{", this.suffix = o ? z(o) : s || "}}", this.formatSeparator = c || ",", this.unescapePrefix = l ? "" : u || "-", this.unescapeSuffix = this.unescapePrefix ? "" : l || "", this.nestingPrefix = d ? z(d) : f || z("$t("), this.nestingSuffix = p ? z(p) : m || z(")"), this.nestingOptionsSeparator = h || ",", this.maxReplaces = g || 1e3, this.alwaysFormat = _ !== void 0 && _, this.resetRegExp();
|
|
1012
1086
|
}
|
|
1013
1087
|
reset() {
|
|
1014
1088
|
this.options && this.init(this.options);
|
|
@@ -1020,7 +1094,7 @@ var V = {}, H = (e) => !T(e) && typeof e != "boolean" && typeof e != "number", U
|
|
|
1020
1094
|
interpolate(e, t, n, r) {
|
|
1021
1095
|
let i, a, o, s = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {}, c = (e) => {
|
|
1022
1096
|
if (e.indexOf(this.formatSeparator) < 0) {
|
|
1023
|
-
let i =
|
|
1097
|
+
let i = ke(t, s, e, this.options.keySeparator, this.options.ignoreJSONStructure);
|
|
1024
1098
|
return this.alwaysFormat ? this.format(i, void 0, n, {
|
|
1025
1099
|
...r,
|
|
1026
1100
|
...t,
|
|
@@ -1028,7 +1102,7 @@ var V = {}, H = (e) => !T(e) && typeof e != "boolean" && typeof e != "number", U
|
|
|
1028
1102
|
}) : i;
|
|
1029
1103
|
}
|
|
1030
1104
|
let i = e.split(this.formatSeparator), a = i.shift().trim(), o = i.join(this.formatSeparator).trim();
|
|
1031
|
-
return this.format(
|
|
1105
|
+
return this.format(ke(t, s, a, this.options.keySeparator, this.options.ignoreJSONStructure), o, n, {
|
|
1032
1106
|
...r,
|
|
1033
1107
|
...t,
|
|
1034
1108
|
interpolationkey: a
|
|
@@ -1038,22 +1112,22 @@ var V = {}, H = (e) => !T(e) && typeof e != "boolean" && typeof e != "number", U
|
|
|
1038
1112
|
let l = r?.missingInterpolationHandler || this.options.missingInterpolationHandler, u = r?.interpolation?.skipOnVariables === void 0 ? this.options.interpolation.skipOnVariables : r.interpolation.skipOnVariables;
|
|
1039
1113
|
return [{
|
|
1040
1114
|
regex: this.regexpUnescape,
|
|
1041
|
-
safeValue: (e) =>
|
|
1115
|
+
safeValue: (e) => X(e)
|
|
1042
1116
|
}, {
|
|
1043
1117
|
regex: this.regexp,
|
|
1044
|
-
safeValue: (e) => this.escapeValue ?
|
|
1118
|
+
safeValue: (e) => this.escapeValue ? X(this.escape(e)) : X(e)
|
|
1045
1119
|
}].forEach((t) => {
|
|
1046
1120
|
for (o = 0; i = t.regex.exec(e);) {
|
|
1047
1121
|
let n = i[1].trim();
|
|
1048
1122
|
if (a = c(n), a === void 0) if (typeof l == "function") {
|
|
1049
1123
|
let t = l(e, i, r);
|
|
1050
|
-
a =
|
|
1124
|
+
a = j(t) ? t : "";
|
|
1051
1125
|
} else if (r && Object.prototype.hasOwnProperty.call(r, n)) a = "";
|
|
1052
1126
|
else if (u) {
|
|
1053
1127
|
a = i[0];
|
|
1054
1128
|
continue;
|
|
1055
1129
|
} else this.logger.warn(`missed to pass in variable ${n} for interpolating ${e}`), a = "";
|
|
1056
|
-
else !
|
|
1130
|
+
else !j(a) && !this.useRawValueToEscape && (a = N(a));
|
|
1057
1131
|
let s = t.safeValue(a);
|
|
1058
1132
|
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;
|
|
1059
1133
|
}
|
|
@@ -1063,7 +1137,7 @@ var V = {}, H = (e) => !T(e) && typeof e != "boolean" && typeof e != "number", U
|
|
|
1063
1137
|
let r, i, a, o = (e, t) => {
|
|
1064
1138
|
let n = this.nestingOptionsSeparator;
|
|
1065
1139
|
if (e.indexOf(n) < 0) return e;
|
|
1066
|
-
let r = e.split(RegExp(`${
|
|
1140
|
+
let r = e.split(RegExp(`${z(n)}[ ]*{`)), i = `{${r[1]}`;
|
|
1067
1141
|
e = r[0], i = this.interpolate(i, a);
|
|
1068
1142
|
let o = i.match(/'/g), s = i.match(/"/g);
|
|
1069
1143
|
((o?.length ?? 0) % 2 == 0 && !s || (s?.length ?? 0) % 2 != 0) && (i = i.replace(/'/g, "\""));
|
|
@@ -1079,17 +1153,17 @@ var V = {}, H = (e) => !T(e) && typeof e != "boolean" && typeof e != "number", U
|
|
|
1079
1153
|
};
|
|
1080
1154
|
for (; r = this.nestingRegexp.exec(e);) {
|
|
1081
1155
|
let s = [];
|
|
1082
|
-
a = { ...n }, a = a.replace && !
|
|
1156
|
+
a = { ...n }, a = a.replace && !j(a.replace) ? a.replace : a, a.applyPostProcessor = !1, delete a.defaultValue;
|
|
1083
1157
|
let c = /{.*}/.test(r[1]) ? r[1].lastIndexOf("}") + 1 : r[1].indexOf(this.formatSeparator);
|
|
1084
|
-
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 && !
|
|
1085
|
-
|
|
1158
|
+
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 && !j(i)) return i;
|
|
1159
|
+
j(i) || (i = N(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, {
|
|
1086
1160
|
...n,
|
|
1087
1161
|
interpolationkey: r[1].trim()
|
|
1088
1162
|
}), i.trim())), e = e.replace(r[0], i), this.regexp.lastIndex = 0;
|
|
1089
1163
|
}
|
|
1090
1164
|
return e;
|
|
1091
1165
|
}
|
|
1092
|
-
},
|
|
1166
|
+
}, je = (e) => {
|
|
1093
1167
|
let t = e.toLowerCase().trim(), n = {};
|
|
1094
1168
|
if (e.indexOf("(") > -1) {
|
|
1095
1169
|
let r = e.split("(");
|
|
@@ -1106,7 +1180,7 @@ var V = {}, H = (e) => !T(e) && typeof e != "boolean" && typeof e != "number", U
|
|
|
1106
1180
|
formatName: t,
|
|
1107
1181
|
formatOptions: n
|
|
1108
1182
|
};
|
|
1109
|
-
},
|
|
1183
|
+
}, Me = (e) => {
|
|
1110
1184
|
let t = {};
|
|
1111
1185
|
return (n, r, i) => {
|
|
1112
1186
|
let a = i;
|
|
@@ -1115,15 +1189,15 @@ var V = {}, H = (e) => !T(e) && typeof e != "boolean" && typeof e != "number", U
|
|
|
1115
1189
|
[i.interpolationkey]: void 0
|
|
1116
1190
|
});
|
|
1117
1191
|
let o = r + JSON.stringify(a), s = t[o];
|
|
1118
|
-
return s || (s = e(
|
|
1192
|
+
return s || (s = e(V(r), i), t[o] = s), s(n);
|
|
1119
1193
|
};
|
|
1120
|
-
},
|
|
1194
|
+
}, Ne = (e) => (t, n, r) => e(V(n), r)(t), Pe = class {
|
|
1121
1195
|
constructor(e = {}) {
|
|
1122
|
-
this.logger =
|
|
1196
|
+
this.logger = H.create("formatter"), this.options = e, this.init(e);
|
|
1123
1197
|
}
|
|
1124
1198
|
init(e, t = { interpolation: {} }) {
|
|
1125
1199
|
this.formatSeparator = t.interpolation.formatSeparator || ",";
|
|
1126
|
-
let n = t.cacheInBuiltFormats ?
|
|
1200
|
+
let n = t.cacheInBuiltFormats ? Me : Ne;
|
|
1127
1201
|
this.formats = {
|
|
1128
1202
|
number: n((e, t) => {
|
|
1129
1203
|
let n = new Intl.NumberFormat(e, { ...t });
|
|
@@ -1154,7 +1228,7 @@ var V = {}, H = (e) => !T(e) && typeof e != "boolean" && typeof e != "number", U
|
|
|
1154
1228
|
this.formats[e.toLowerCase().trim()] = t;
|
|
1155
1229
|
}
|
|
1156
1230
|
addCached(e, t) {
|
|
1157
|
-
this.formats[e.toLowerCase().trim()] =
|
|
1231
|
+
this.formats[e.toLowerCase().trim()] = Me(t);
|
|
1158
1232
|
}
|
|
1159
1233
|
format(e, t, n, r = {}) {
|
|
1160
1234
|
let i = t.split(this.formatSeparator);
|
|
@@ -1163,7 +1237,7 @@ var V = {}, H = (e) => !T(e) && typeof e != "boolean" && typeof e != "number", U
|
|
|
1163
1237
|
i[0] = [i[0], ...i.splice(1, e)].join(this.formatSeparator);
|
|
1164
1238
|
}
|
|
1165
1239
|
return i.reduce((e, t) => {
|
|
1166
|
-
let { formatName: i, formatOptions: a } =
|
|
1240
|
+
let { formatName: i, formatOptions: a } = je(t);
|
|
1167
1241
|
if (this.formats[i]) {
|
|
1168
1242
|
let t = e;
|
|
1169
1243
|
try {
|
|
@@ -1181,11 +1255,11 @@ var V = {}, H = (e) => !T(e) && typeof e != "boolean" && typeof e != "number", U
|
|
|
1181
1255
|
return e;
|
|
1182
1256
|
}, e);
|
|
1183
1257
|
}
|
|
1184
|
-
},
|
|
1258
|
+
}, Fe = (e, t) => {
|
|
1185
1259
|
e.pending[t] !== void 0 && (delete e.pending[t], e.pendingCount--);
|
|
1186
|
-
},
|
|
1260
|
+
}, Ie = class extends U {
|
|
1187
1261
|
constructor(e, t, n, r = {}) {
|
|
1188
|
-
super(), this.backend = e, this.store = t, this.services = n, this.languageUtils = n.languageUtils, this.options = r, this.logger =
|
|
1262
|
+
super(), this.backend = e, this.store = t, this.services = n, this.languageUtils = n.languageUtils, this.options = r, this.logger = H.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);
|
|
1189
1263
|
}
|
|
1190
1264
|
queueLoad(e, t, n, r) {
|
|
1191
1265
|
let i = {}, a = {}, o = {}, s = {};
|
|
@@ -1213,7 +1287,7 @@ var V = {}, H = (e) => !T(e) && typeof e != "boolean" && typeof e != "number", U
|
|
|
1213
1287
|
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);
|
|
1214
1288
|
let o = {};
|
|
1215
1289
|
this.queue.forEach((n) => {
|
|
1216
|
-
|
|
1290
|
+
me(n.loaded, [i], a), Fe(n, e), t && n.errors.push(t), n.pendingCount === 0 && !n.done && (Object.keys(n.loaded).forEach((e) => {
|
|
1217
1291
|
o[e] || (o[e] = {});
|
|
1218
1292
|
let t = n.loaded[e];
|
|
1219
1293
|
t.length && t.forEach((t) => {
|
|
@@ -1262,7 +1336,7 @@ var V = {}, H = (e) => !T(e) && typeof e != "boolean" && typeof e != "number", U
|
|
|
1262
1336
|
}
|
|
1263
1337
|
prepareLoading(e, t, n = {}, r) {
|
|
1264
1338
|
if (!this.backend) return this.logger.warn("No backend was added via i18next.use. Will not load resources."), r && r();
|
|
1265
|
-
|
|
1339
|
+
j(e) && (e = this.languageUtils.toResolveHierarchy(e)), j(t) && (t = [t]);
|
|
1266
1340
|
let i = this.queueLoad(e, t, n, r);
|
|
1267
1341
|
if (!i.toLoad.length) return i.pending.length || r(), null;
|
|
1268
1342
|
i.toLoad.forEach((e) => {
|
|
@@ -1338,7 +1412,7 @@ var V = {}, H = (e) => !T(e) && typeof e != "boolean" && typeof e != "number", U
|
|
|
1338
1412
|
appendNamespaceToCIMode: !1,
|
|
1339
1413
|
overloadTranslationOptionHandler: (e) => {
|
|
1340
1414
|
let t = {};
|
|
1341
|
-
if (typeof e[1] == "object" && (t = e[1]),
|
|
1415
|
+
if (typeof e[1] == "object" && (t = e[1]), j(e[1]) && (t.defaultValue = e[1]), j(e[2]) && (t.tDescription = e[2]), typeof e[2] == "object" || typeof e[3] == "object") {
|
|
1342
1416
|
let n = e[3] || e[2];
|
|
1343
1417
|
Object.keys(n).forEach((e) => {
|
|
1344
1418
|
t[e] = n[e];
|
|
@@ -1360,15 +1434,15 @@ var V = {}, H = (e) => !T(e) && typeof e != "boolean" && typeof e != "number", U
|
|
|
1360
1434
|
skipOnVariables: !0
|
|
1361
1435
|
},
|
|
1362
1436
|
cacheInBuiltFormats: !0
|
|
1363
|
-
}),
|
|
1437
|
+
}), Le = (e) => (j(e.ns) && (e.ns = [e.ns]), j(e.fallbackLng) && (e.fallbackLng = [e.fallbackLng]), j(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 = () => {}, Re = (e) => {
|
|
1364
1438
|
Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach((t) => {
|
|
1365
1439
|
typeof e[t] == "function" && (e[t] = e[t].bind(e));
|
|
1366
1440
|
});
|
|
1367
|
-
},
|
|
1368
|
-
typeof globalThis < "u" && (globalThis[
|
|
1369
|
-
},
|
|
1441
|
+
}, ze = "__i18next_supportNoticeShown", Be = () => !!(typeof globalThis < "u" && globalThis[ze] || typeof process < "u" && process.env && process.env.I18NEXT_NO_SUPPORT_NOTICE || typeof process < "u" && process.env), Ve = () => {
|
|
1442
|
+
typeof globalThis < "u" && (globalThis[ze] = !0);
|
|
1443
|
+
}, He = (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 U {
|
|
1370
1444
|
constructor(e = {}, t) {
|
|
1371
|
-
if (super(), this.options =
|
|
1445
|
+
if (super(), this.options = Le(e), this.services = {}, this.logger = H, this.modules = { external: [] }, Re(this), t && !this.isInitialized && !e.isClone) {
|
|
1372
1446
|
if (!this.options.initAsync) return this.init(e, t), this;
|
|
1373
1447
|
setTimeout(() => {
|
|
1374
1448
|
this.init(e, t);
|
|
@@ -1376,30 +1450,30 @@ var V = {}, H = (e) => !T(e) && typeof e != "boolean" && typeof e != "number", U
|
|
|
1376
1450
|
}
|
|
1377
1451
|
}
|
|
1378
1452
|
init(e = {}, t) {
|
|
1379
|
-
this.isInitializing = !0, typeof e == "function" && (t = e, e = {}), e.defaultNS == null && e.ns && (
|
|
1453
|
+
this.isInitializing = !0, typeof e == "function" && (t = e, e = {}), e.defaultNS == null && e.ns && (j(e.ns) ? e.defaultNS = e.ns : e.ns.indexOf("translation") < 0 && (e.defaultNS = e.ns[0]));
|
|
1380
1454
|
let n = Z();
|
|
1381
1455
|
this.options = {
|
|
1382
1456
|
...n,
|
|
1383
1457
|
...this.options,
|
|
1384
|
-
...
|
|
1458
|
+
...Le(e)
|
|
1385
1459
|
}, this.options.interpolation = {
|
|
1386
1460
|
...n.interpolation,
|
|
1387
1461
|
...this.options.interpolation
|
|
1388
|
-
}, 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 && !
|
|
1462
|
+
}, 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 && !He(this) && !Be() && (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 💙"), Ve());
|
|
1389
1463
|
let r = (e) => e ? typeof e == "function" ? new e() : e : null;
|
|
1390
1464
|
if (!this.options.isClone) {
|
|
1391
|
-
this.modules.logger ?
|
|
1465
|
+
this.modules.logger ? H.init(r(this.modules.logger), this.options) : H.init(null, this.options);
|
|
1392
1466
|
let e;
|
|
1393
|
-
e = this.modules.formatter ? this.modules.formatter :
|
|
1394
|
-
let t = new
|
|
1395
|
-
this.store = new
|
|
1467
|
+
e = this.modules.formatter ? this.modules.formatter : Pe;
|
|
1468
|
+
let t = new Te(this.options);
|
|
1469
|
+
this.store = new W(this.options.resources, this.options);
|
|
1396
1470
|
let i = this.services;
|
|
1397
|
-
i.logger =
|
|
1471
|
+
i.logger = H, i.resourceStore = this.store, i.languageUtils = t, i.pluralResolver = new Oe(t, {
|
|
1398
1472
|
prepend: this.options.pluralSeparator,
|
|
1399
1473
|
simplifyPluralSuffix: this.options.simplifyPluralSuffix
|
|
1400
|
-
}), 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
|
|
1474
|
+
}), 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 Ae(this.options), i.utils = { hasLoadedNamespace: this.hasLoadedNamespace.bind(this) }, i.backendConnector = new Ie(r(this.modules.backend), i.resourceStore, i, this.options), i.backendConnector.on("*", (e, ...t) => {
|
|
1401
1475
|
this.emit(e, ...t);
|
|
1402
|
-
}), 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
|
|
1476
|
+
}), 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 we(this.services, this.options), this.translator.on("*", (e, ...t) => {
|
|
1403
1477
|
this.emit(e, ...t);
|
|
1404
1478
|
}), this.modules.external.forEach((e) => {
|
|
1405
1479
|
e.init && e.init(this);
|
|
@@ -1424,7 +1498,7 @@ var V = {}, H = (e) => !T(e) && typeof e != "boolean" && typeof e != "number", U
|
|
|
1424
1498
|
].forEach((e) => {
|
|
1425
1499
|
this[e] = (...t) => (this.store[e](...t), this);
|
|
1426
1500
|
});
|
|
1427
|
-
let i =
|
|
1501
|
+
let i = M(), a = () => {
|
|
1428
1502
|
let e = (e, n) => {
|
|
1429
1503
|
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);
|
|
1430
1504
|
};
|
|
@@ -1434,7 +1508,7 @@ var V = {}, H = (e) => !T(e) && typeof e != "boolean" && typeof e != "number", U
|
|
|
1434
1508
|
return this.options.resources || !this.options.initAsync ? a() : setTimeout(a, 0), i;
|
|
1435
1509
|
}
|
|
1436
1510
|
loadResources(e, t = Q) {
|
|
1437
|
-
let n = t, r =
|
|
1511
|
+
let n = t, r = j(e) ? e : this.language;
|
|
1438
1512
|
if (typeof e == "function" && (n = e), !this.options.resources || this.options.partialBundledLanguages) {
|
|
1439
1513
|
if (r?.toLowerCase() === "cimode" && (!this.options.preload || this.options.preload.length === 0)) return n();
|
|
1440
1514
|
let e = [], t = (t) => {
|
|
@@ -1448,7 +1522,7 @@ var V = {}, H = (e) => !T(e) && typeof e != "boolean" && typeof e != "number", U
|
|
|
1448
1522
|
} else n(null);
|
|
1449
1523
|
}
|
|
1450
1524
|
reloadResources(e, t, n) {
|
|
1451
|
-
let r =
|
|
1525
|
+
let r = M();
|
|
1452
1526
|
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) => {
|
|
1453
1527
|
r.resolve(), n(e);
|
|
1454
1528
|
}), r;
|
|
@@ -1456,7 +1530,7 @@ var V = {}, H = (e) => !T(e) && typeof e != "boolean" && typeof e != "number", U
|
|
|
1456
1530
|
use(e) {
|
|
1457
1531
|
if (!e) throw Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");
|
|
1458
1532
|
if (!e.type) throw Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");
|
|
1459
|
-
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" &&
|
|
1533
|
+
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" && G.addPostProcessor(e), e.type === "formatter" && (this.modules.formatter = e), e.type === "3rdParty" && this.modules.external.push(e), this;
|
|
1460
1534
|
}
|
|
1461
1535
|
setResolvedLanguage(e) {
|
|
1462
1536
|
if (!(!e || !this.languages) && !(["cimode", "dev"].indexOf(e) > -1)) {
|
|
@@ -1472,7 +1546,7 @@ var V = {}, H = (e) => !T(e) && typeof e != "boolean" && typeof e != "number", U
|
|
|
1472
1546
|
}
|
|
1473
1547
|
changeLanguage(e, t) {
|
|
1474
1548
|
this.isLanguageChangingTo = e;
|
|
1475
|
-
let n =
|
|
1549
|
+
let n = M();
|
|
1476
1550
|
this.emit("languageChanging", e);
|
|
1477
1551
|
let r = (e) => {
|
|
1478
1552
|
this.language = e, this.languages = this.services.languageUtils.toResolveHierarchy(e), this.resolvedLanguage = void 0, this.setResolvedLanguage(e);
|
|
@@ -1480,7 +1554,7 @@ var V = {}, H = (e) => !T(e) && typeof e != "boolean" && typeof e != "number", U
|
|
|
1480
1554
|
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));
|
|
1481
1555
|
}, a = (t) => {
|
|
1482
1556
|
!e && !t && this.services.languageDetector && (t = []);
|
|
1483
|
-
let n =
|
|
1557
|
+
let n = j(t) ? t : t && t[0], a = this.store.hasLanguageSomeTranslations(n) ? n : this.services.languageUtils.getBestMatchFromCodes(j(t) ? [t] : t);
|
|
1484
1558
|
a && (this.language || r(a), this.translator.language || this.translator.changeLanguage(a), this.services.languageDetector?.cacheUserLanguage?.(a)), this.loadResources(a, (e) => {
|
|
1485
1559
|
i(e, a);
|
|
1486
1560
|
});
|
|
@@ -1495,11 +1569,11 @@ var V = {}, H = (e) => !T(e) && typeof e != "boolean" && typeof e != "number", U
|
|
|
1495
1569
|
...this.options,
|
|
1496
1570
|
...a
|
|
1497
1571
|
};
|
|
1498
|
-
typeof a.keyPrefix == "function" && (a.keyPrefix =
|
|
1572
|
+
typeof a.keyPrefix == "function" && (a.keyPrefix = q(a.keyPrefix, o));
|
|
1499
1573
|
let s = this.options.keySeparator || ".", c;
|
|
1500
|
-
return a.keyPrefix && Array.isArray(e) ? c = e.map((e) => (typeof e == "function" && (e =
|
|
1574
|
+
return a.keyPrefix && Array.isArray(e) ? c = e.map((e) => (typeof e == "function" && (e = q(e, o)), `${a.keyPrefix}${s}${e}`)) : (typeof e == "function" && (e = q(e, o)), c = a.keyPrefix ? `${a.keyPrefix}${s}${e}` : e), this.t(c, a);
|
|
1501
1575
|
};
|
|
1502
|
-
return
|
|
1576
|
+
return j(e) ? r.lng = e : r.lngs = e, r.ns = t, r.keyPrefix = n, r;
|
|
1503
1577
|
}
|
|
1504
1578
|
t(...e) {
|
|
1505
1579
|
return this.translator?.translate(...e);
|
|
@@ -1526,16 +1600,16 @@ var V = {}, H = (e) => !T(e) && typeof e != "boolean" && typeof e != "number", U
|
|
|
1526
1600
|
return !!(this.hasResourceBundle(n, e) || !this.services.backendConnector.backend || this.options.resources && !this.options.partialBundledLanguages || a(n, e) && (!r || a(i, e)));
|
|
1527
1601
|
}
|
|
1528
1602
|
loadNamespaces(e, t) {
|
|
1529
|
-
let n =
|
|
1530
|
-
return this.options.ns ? (
|
|
1603
|
+
let n = M();
|
|
1604
|
+
return this.options.ns ? (j(e) && (e = [e]), e.forEach((e) => {
|
|
1531
1605
|
this.options.ns.indexOf(e) < 0 && this.options.ns.push(e);
|
|
1532
1606
|
}), this.loadResources((e) => {
|
|
1533
1607
|
n.resolve(), t && t(e);
|
|
1534
1608
|
}), n) : (t && t(), Promise.resolve());
|
|
1535
1609
|
}
|
|
1536
1610
|
loadLanguages(e, t) {
|
|
1537
|
-
let n =
|
|
1538
|
-
|
|
1611
|
+
let n = M();
|
|
1612
|
+
j(e) && (e = [e]);
|
|
1539
1613
|
let r = this.options.preload || [], i = e.filter((e) => r.indexOf(e) < 0 && this.services.languageUtils.isSupportedCode(e));
|
|
1540
1614
|
return i.length ? (this.options.preload = r.concat(i), this.loadResources((e) => {
|
|
1541
1615
|
n.resolve(), t && t(e);
|
|
@@ -1550,7 +1624,7 @@ var V = {}, H = (e) => !T(e) && typeof e != "boolean" && typeof e != "number", U
|
|
|
1550
1624
|
if (e && e.direction) return e.direction;
|
|
1551
1625
|
}
|
|
1552
1626
|
} catch {}
|
|
1553
|
-
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
|
|
1627
|
+
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 Te(Z());
|
|
1554
1628
|
return e.toLowerCase().indexOf("-latn") > 1 ? "ltr" : t.indexOf(n.getLanguagePartFromCode(e)) > -1 || e.toLowerCase().indexOf("-arab") > 1 ? "rtl" : "ltr";
|
|
1555
1629
|
}
|
|
1556
1630
|
static createInstance(t = {}, n) {
|
|
@@ -1571,7 +1645,7 @@ var V = {}, H = (e) => !T(e) && typeof e != "boolean" && typeof e != "number", U
|
|
|
1571
1645
|
"language"
|
|
1572
1646
|
].forEach((e) => {
|
|
1573
1647
|
a[e] = this[e];
|
|
1574
|
-
}), a.services = { ...this.services }, a.services.utils = { hasLoadedNamespace: a.hasLoadedNamespace.bind(a) }, r && (a.store = new
|
|
1648
|
+
}), a.services = { ...this.services }, a.services.utils = { hasLoadedNamespace: a.hasLoadedNamespace.bind(a) }, r && (a.store = new W(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) {
|
|
1575
1649
|
let e = {
|
|
1576
1650
|
...Z().interpolation,
|
|
1577
1651
|
...this.options.interpolation,
|
|
@@ -1580,9 +1654,9 @@ var V = {}, H = (e) => !T(e) && typeof e != "boolean" && typeof e != "number", U
|
|
|
1580
1654
|
...i,
|
|
1581
1655
|
interpolation: e
|
|
1582
1656
|
};
|
|
1583
|
-
a.services.interpolator = new
|
|
1657
|
+
a.services.interpolator = new Ae(n);
|
|
1584
1658
|
}
|
|
1585
|
-
return a.translator = new
|
|
1659
|
+
return a.translator = new we(a.services, i), a.translator.on("*", (e, ...t) => {
|
|
1586
1660
|
a.emit(e, ...t);
|
|
1587
1661
|
}), a.init(i, n), a.translator.options = i, a.translator.backendConnector.services.utils = { hasLoadedNamespace: a.hasLoadedNamespace.bind(a) }, a;
|
|
1588
1662
|
}
|
|
@@ -1603,13 +1677,13 @@ $.createInstance, $.dir, $.init, $.loadResources, $.reloadResources, $.use, $.ch
|
|
|
1603
1677
|
lng: "en",
|
|
1604
1678
|
showSupportNotice: !1,
|
|
1605
1679
|
resources: {
|
|
1606
|
-
en:
|
|
1607
|
-
es:
|
|
1680
|
+
en: le,
|
|
1681
|
+
es: ue
|
|
1608
1682
|
}
|
|
1609
1683
|
});
|
|
1610
1684
|
//#endregion
|
|
1611
1685
|
//#region src/i18n.ts
|
|
1612
|
-
var { translator:
|
|
1686
|
+
var { translator: Ue } = {
|
|
1613
1687
|
translator: {
|
|
1614
1688
|
...$,
|
|
1615
1689
|
t: (e, t) => {
|
|
@@ -1641,13 +1715,13 @@ var { translator: De } = {
|
|
|
1641
1715
|
label: "Spanish"
|
|
1642
1716
|
}]
|
|
1643
1717
|
};
|
|
1644
|
-
function
|
|
1645
|
-
return
|
|
1718
|
+
function We(e, t) {
|
|
1719
|
+
return Ue.t(`translation:simpleCloze:${e}`, { lng: t });
|
|
1646
1720
|
}
|
|
1647
|
-
function
|
|
1648
|
-
return
|
|
1721
|
+
function Ge(e, t) {
|
|
1722
|
+
return Ue.t(`common:${e}`, { lng: t });
|
|
1649
1723
|
}
|
|
1650
1724
|
//#endregion
|
|
1651
|
-
export {
|
|
1725
|
+
export { Ge as n, ce as r, We as t };
|
|
1652
1726
|
|
|
1653
|
-
//# sourceMappingURL=i18n-
|
|
1727
|
+
//# sourceMappingURL=i18n-C7YV9VIN.js.map
|