@pie-element/simple-cloze 0.1.4-next.19 → 0.1.4-next.20
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 +1 -0
- package/dist/author/index.js.map +1 -1
- package/dist/browser/author/index.js +1 -0
- package/dist/browser/author/index.js.map +1 -1
- package/dist/browser/delivery/index.js +1 -1
- package/dist/browser/editor-runtime/author/index.js +1 -0
- package/dist/browser/editor-runtime/author/index.js.map +1 -1
- package/dist/browser/editor-runtime/delivery/index.js +1 -1
- package/dist/browser/editor-runtime/{i18n-CBClmRAq.js → i18n-BTsdzpBv.js} +220 -213
- package/dist/browser/editor-runtime/i18n-BTsdzpBv.js.map +1 -0
- package/dist/browser/editor-runtime/print/index.js +1 -1
- package/dist/browser/{i18n-CBClmRAq.js → i18n-BTsdzpBv.js} +220 -213
- package/dist/browser/i18n-BTsdzpBv.js.map +1 -0
- package/dist/browser/print/index.js +1 -1
- package/dist/delivery/index.js +64 -56
- package/dist/delivery/index.js.map +1 -1
- package/dist/index.iife.js +2 -2
- package/dist/print/index.js +64 -56
- package/dist/print/index.js.map +1 -1
- package/module/print.js +203 -196
- package/module/print.js.map +1 -1
- package/package.json +1 -1
- package/dist/browser/editor-runtime/i18n-CBClmRAq.js.map +0 -1
- package/dist/browser/i18n-CBClmRAq.js.map +0 -1
|
@@ -41,22 +41,29 @@ function _() {
|
|
|
41
41
|
return window.MathJax;
|
|
42
42
|
}
|
|
43
43
|
function v(e) {
|
|
44
|
-
let t
|
|
45
|
-
|
|
46
|
-
return t;
|
|
44
|
+
for (let [t, n] of u) if (e.startsWith(t) && e.endsWith(n)) return e.substring(t.length, e.length - n.length);
|
|
45
|
+
return e;
|
|
47
46
|
}
|
|
48
47
|
function y(e) {
|
|
48
|
+
return v(e.includes("\\displaystyle") ? e.replace("\\displaystyle", "").trim() : e);
|
|
49
|
+
}
|
|
50
|
+
var b = "mathjax_ignore", x = "mathjax_process";
|
|
51
|
+
function S(e, t) {
|
|
52
|
+
let n = e.closest(`.${b}, .${x}`);
|
|
53
|
+
return n !== null && t.contains(n) && !n.classList.contains(x);
|
|
54
|
+
}
|
|
55
|
+
function C(e) {
|
|
49
56
|
for (let t of e.querySelectorAll("[data-latex]")) {
|
|
50
|
-
if (t.dataset.mathHandled || t.closest("mjx-container")) continue;
|
|
51
|
-
let
|
|
52
|
-
|
|
57
|
+
if (t.dataset.mathHandled || t.closest("mjx-container") || S(t, e)) continue;
|
|
58
|
+
let n = t.textContent;
|
|
59
|
+
n && (t.textContent = `\\(${y(n)}\\)`.replace(l, "\\newline "), t.dataset.mathHandled = "true");
|
|
53
60
|
}
|
|
54
61
|
}
|
|
55
|
-
function
|
|
62
|
+
function w(e, t) {
|
|
56
63
|
for (let t of e.querySelectorAll("math")) if (!t.closest("mjx-assistive-mml")) return !0;
|
|
57
64
|
return (t ? c : s).test(e.textContent ?? "");
|
|
58
65
|
}
|
|
59
|
-
function
|
|
66
|
+
function T(e) {
|
|
60
67
|
return new Promise((t, n) => {
|
|
61
68
|
let { useSingleDollar: r = !1, accessibility: s = !0, loadFonts: c = !0, srcUrl: l } = e, u = {
|
|
62
69
|
loader: {
|
|
@@ -67,7 +74,7 @@ function x(e) {
|
|
|
67
74
|
typeset: !1,
|
|
68
75
|
ready: () => {
|
|
69
76
|
let e = _(), r = e?.startup, i = !!e?.version?.startsWith("4.");
|
|
70
|
-
i &&
|
|
77
|
+
i && E(e), r?.defaultReady?.(), i && D(r?.document), Promise.resolve(r?.promise).then(() => t(), n);
|
|
71
78
|
}
|
|
72
79
|
},
|
|
73
80
|
tex: { macros: { ...a } },
|
|
@@ -85,11 +92,11 @@ function x(e) {
|
|
|
85
92
|
d.src = l || i, d.async = !0, d.onerror = () => n(/* @__PURE__ */ Error("Failed to load MathJax")), document.head.appendChild(d);
|
|
86
93
|
});
|
|
87
94
|
}
|
|
88
|
-
function
|
|
95
|
+
function E(e) {
|
|
89
96
|
let t = e?._?.output?.chtml_ts?.CHTML;
|
|
90
97
|
t && (t.STYLESHEETID = f);
|
|
91
98
|
}
|
|
92
|
-
function
|
|
99
|
+
function D(e) {
|
|
93
100
|
if (!e) return;
|
|
94
101
|
let t = /* @__PURE__ */ new WeakSet(), n = (e) => {
|
|
95
102
|
let n = e.typesetRoot;
|
|
@@ -103,32 +110,32 @@ function C(e) {
|
|
|
103
110
|
return t && g(t), !1;
|
|
104
111
|
});
|
|
105
112
|
let r = e.outputJax?.chtmlStyles;
|
|
106
|
-
r?.id === p && (r.id = f),
|
|
113
|
+
r?.id === p && (r.id = f), ee();
|
|
107
114
|
}
|
|
108
|
-
function
|
|
115
|
+
function O(e) {
|
|
109
116
|
return e instanceof HTMLStyleElement && m.includes(e.id);
|
|
110
117
|
}
|
|
111
|
-
function
|
|
118
|
+
function k(e) {
|
|
112
119
|
n("foreign-output-stylesheet", `another MathJax added <style id="${e.id}"> to <head>`);
|
|
113
120
|
}
|
|
114
|
-
function
|
|
115
|
-
let e = document.head, t = [...e.children].find(
|
|
121
|
+
function ee() {
|
|
122
|
+
let e = document.head, t = [...e.children].find(O);
|
|
116
123
|
if (t) {
|
|
117
|
-
|
|
124
|
+
k(t);
|
|
118
125
|
return;
|
|
119
126
|
}
|
|
120
127
|
let n = new MutationObserver((e) => {
|
|
121
128
|
for (let t of e) {
|
|
122
|
-
let e = [...t.addedNodes].find(
|
|
129
|
+
let e = [...t.addedNodes].find(O);
|
|
123
130
|
if (e) {
|
|
124
|
-
|
|
131
|
+
k(e), n.disconnect();
|
|
125
132
|
return;
|
|
126
133
|
}
|
|
127
134
|
}
|
|
128
135
|
});
|
|
129
136
|
n.observe(e, { childList: !0 });
|
|
130
137
|
}
|
|
131
|
-
function
|
|
138
|
+
function te(e) {
|
|
132
139
|
return new Promise((t, n) => {
|
|
133
140
|
let r = e.startup ?? {};
|
|
134
141
|
e.startup = r;
|
|
@@ -139,27 +146,27 @@ function D(e) {
|
|
|
139
146
|
};
|
|
140
147
|
});
|
|
141
148
|
}
|
|
142
|
-
function
|
|
149
|
+
function ne(e) {
|
|
143
150
|
let t = _();
|
|
144
|
-
return t ? t.version ? t.startup?.promise ? Promise.resolve(t.startup.promise).then(() => void 0) : Promise.resolve() :
|
|
151
|
+
return t ? t.version ? t.startup?.promise ? Promise.resolve(t.startup.promise).then(() => void 0) : Promise.resolve() : te(t) : T(e);
|
|
145
152
|
}
|
|
146
|
-
function
|
|
147
|
-
return
|
|
153
|
+
function re(e) {
|
|
154
|
+
return ne(e).then(() => {
|
|
148
155
|
typeof _()?.typesetPromise != "function" && console.warn("[mathjax-renderer] MathJax on this page has no typesetPromise; math stays untypeset.");
|
|
149
156
|
});
|
|
150
157
|
}
|
|
151
|
-
function
|
|
158
|
+
function ie(e) {
|
|
152
159
|
let t = globalThis, n = t[d];
|
|
153
|
-
return n || (n =
|
|
160
|
+
return n || (n = re(e), t[d] = n), n;
|
|
154
161
|
}
|
|
155
|
-
function
|
|
162
|
+
function ae(e = {}) {
|
|
156
163
|
let t = e.useSingleDollar ?? !1;
|
|
157
164
|
return async (i) => {
|
|
158
165
|
if (typeof window > "u") return;
|
|
159
166
|
let a = r();
|
|
160
|
-
a && n("mathjax-3-global", `window.MathJax is MathJax ${a}`),
|
|
161
|
-
let o =
|
|
162
|
-
if (!
|
|
167
|
+
a && n("mathjax-3-global", `window.MathJax is MathJax ${a}`), C(i);
|
|
168
|
+
let o = ie(e);
|
|
169
|
+
if (!w(i, t)) {
|
|
163
170
|
o.catch(() => {});
|
|
164
171
|
return;
|
|
165
172
|
}
|
|
@@ -168,50 +175,50 @@ function ne(e = {}) {
|
|
|
168
175
|
await s?.startup?.promise, typeof s?.typesetPromise == "function" && (await s.typesetPromise([i]), g(i));
|
|
169
176
|
};
|
|
170
177
|
}
|
|
171
|
-
var
|
|
172
|
-
function
|
|
173
|
-
return !!window[
|
|
178
|
+
var oe = "@pie-lib/math-rendering", se = "@pie-lib/math-rendering@2", ce = "pie-print", le = 50, ue = 1e4, de = null;
|
|
179
|
+
function fe() {
|
|
180
|
+
return !!window[se]?.opts?.useSingleDollar;
|
|
174
181
|
}
|
|
175
|
-
function
|
|
176
|
-
return
|
|
182
|
+
function pe() {
|
|
183
|
+
return de ||= ae({ useSingleDollar: fe() }), de;
|
|
177
184
|
}
|
|
178
|
-
function
|
|
185
|
+
function me() {
|
|
179
186
|
if (typeof window > "u") return null;
|
|
180
|
-
let e = window[
|
|
181
|
-
return typeof e?.renderMath == "function" ? e : null;
|
|
187
|
+
let e = window[oe];
|
|
188
|
+
return typeof e?.renderMath == "function" && e.renderMath !== j ? e : null;
|
|
182
189
|
}
|
|
183
|
-
function
|
|
190
|
+
function he(e) {
|
|
184
191
|
let t = e;
|
|
185
192
|
for (; t;) {
|
|
186
|
-
if (t instanceof Element && t.localName ===
|
|
193
|
+
if (t instanceof Element && t.localName === ce) return t;
|
|
187
194
|
t = t instanceof ShadowRoot ? t.host : t.parentNode;
|
|
188
195
|
}
|
|
189
196
|
return null;
|
|
190
197
|
}
|
|
191
|
-
function
|
|
198
|
+
function A() {
|
|
192
199
|
let e = window.renderMath;
|
|
193
200
|
return typeof e == "function" ? e : null;
|
|
194
201
|
}
|
|
195
|
-
async function
|
|
196
|
-
let t =
|
|
202
|
+
async function ge(e) {
|
|
203
|
+
let t = he(e);
|
|
197
204
|
if (!t) return null;
|
|
198
|
-
let n =
|
|
205
|
+
let n = A();
|
|
199
206
|
if (n || t.mathRenderingModuleUrlImported !== !0) return n;
|
|
200
|
-
let r = Date.now() +
|
|
207
|
+
let r = Date.now() + ue;
|
|
201
208
|
for (; Date.now() < r;) {
|
|
202
|
-
await new Promise((e) => setTimeout(e,
|
|
203
|
-
let e =
|
|
209
|
+
await new Promise((e) => setTimeout(e, le));
|
|
210
|
+
let e = A();
|
|
204
211
|
if (e) return e;
|
|
205
212
|
}
|
|
206
213
|
return null;
|
|
207
214
|
}
|
|
208
|
-
var
|
|
215
|
+
var j = async (e) => {
|
|
209
216
|
if (typeof window > "u") return;
|
|
210
217
|
let t = typeof e == "string", n;
|
|
211
218
|
t ? (n = document.createElement("div"), n.innerHTML = e) : n = e || document.body;
|
|
212
|
-
let r =
|
|
213
|
-
return r ? await r.renderMath?.(n) : i ? await i(n) : await
|
|
214
|
-
},
|
|
219
|
+
let r = me(), i = r || t ? null : await ge(n);
|
|
220
|
+
return r ? await r.renderMath?.(n) : i && i !== j ? await i(n) : await pe()(n), t ? n.innerHTML : void 0;
|
|
221
|
+
}, _e = {
|
|
215
222
|
translation: {
|
|
216
223
|
categorize: {
|
|
217
224
|
limitMaxChoicesPerCategory: "You've reached the limit of {{maxChoicesPerCategory}} responses per area. To add another response, one must first be removed.",
|
|
@@ -351,7 +358,7 @@ var me = async (e) => {
|
|
|
351
358
|
hideNote: "Hide Note",
|
|
352
359
|
cancel: "Cancel"
|
|
353
360
|
}
|
|
354
|
-
},
|
|
361
|
+
}, ve = {
|
|
355
362
|
translation: {
|
|
356
363
|
categorize: {
|
|
357
364
|
limitMaxChoicesPerCategory: "Has alcanzado el límite de {{maxChoicesPerCategory}} respuestas por área. Para agregar otra respuesta, primero se debe eliminar una respuesta.",
|
|
@@ -491,55 +498,55 @@ var me = async (e) => {
|
|
|
491
498
|
hideNote: "Ocultar Nota",
|
|
492
499
|
cancel: "Cancelar"
|
|
493
500
|
}
|
|
494
|
-
},
|
|
501
|
+
}, M = (e) => typeof e == "string", N = () => {
|
|
495
502
|
let e, t, n = new Promise((n, r) => {
|
|
496
503
|
e = n, t = r;
|
|
497
504
|
});
|
|
498
505
|
return n.resolve = e, n.reject = t, n;
|
|
499
|
-
},
|
|
506
|
+
}, P = (e) => e == null ? "" : "" + e, ye = (e, t, n) => {
|
|
500
507
|
e.forEach((e) => {
|
|
501
508
|
t[e] && (n[e] = t[e]);
|
|
502
509
|
});
|
|
503
|
-
},
|
|
504
|
-
let r =
|
|
510
|
+
}, be = /###/g, F = (e) => e && e.indexOf("###") > -1 ? e.replace(be, ".") : e, I = (e) => !e || M(e), L = (e, t, n) => {
|
|
511
|
+
let r = M(t) ? t.split(".") : t, i = 0;
|
|
505
512
|
for (; i < r.length - 1;) {
|
|
506
|
-
if (
|
|
507
|
-
let t =
|
|
513
|
+
if (I(e)) return {};
|
|
514
|
+
let t = F(r[i]);
|
|
508
515
|
!e[t] && n && (e[t] = new n()), e = Object.prototype.hasOwnProperty.call(e, t) ? e[t] : {}, ++i;
|
|
509
516
|
}
|
|
510
|
-
return
|
|
517
|
+
return I(e) ? {} : {
|
|
511
518
|
obj: e,
|
|
512
|
-
k:
|
|
519
|
+
k: F(r[i])
|
|
513
520
|
};
|
|
514
|
-
},
|
|
515
|
-
let { obj: r, k: i } =
|
|
521
|
+
}, R = (e, t, n) => {
|
|
522
|
+
let { obj: r, k: i } = L(e, t, Object);
|
|
516
523
|
if (r !== void 0 || t.length === 1) {
|
|
517
524
|
r[i] = n;
|
|
518
525
|
return;
|
|
519
526
|
}
|
|
520
|
-
let a = t[t.length - 1], o = t.slice(0, t.length - 1), s =
|
|
521
|
-
for (; s.obj === void 0 && o.length;) a = `${o[o.length - 1]}.${a}`, o = o.slice(0, o.length - 1), s =
|
|
527
|
+
let a = t[t.length - 1], o = t.slice(0, t.length - 1), s = L(e, o, Object);
|
|
528
|
+
for (; s.obj === void 0 && o.length;) a = `${o[o.length - 1]}.${a}`, o = o.slice(0, o.length - 1), s = L(e, o, Object), s?.obj && s.obj[`${s.k}.${a}`] !== void 0 && (s.obj = void 0);
|
|
522
529
|
s.obj[`${s.k}.${a}`] = n;
|
|
523
|
-
},
|
|
524
|
-
let { obj: i, k: a } =
|
|
530
|
+
}, xe = (e, t, n, r) => {
|
|
531
|
+
let { obj: i, k: a } = L(e, t, Object);
|
|
525
532
|
i[a] = i[a] || [], i[a].push(n);
|
|
526
|
-
},
|
|
527
|
-
let { obj: n, k: r } =
|
|
533
|
+
}, z = (e, t) => {
|
|
534
|
+
let { obj: n, k: r } = L(e, t);
|
|
528
535
|
if (n && Object.prototype.hasOwnProperty.call(n, r)) return n[r];
|
|
529
|
-
},
|
|
530
|
-
let r =
|
|
531
|
-
return r === void 0 ?
|
|
532
|
-
},
|
|
533
|
-
for (let r in t) r !== "__proto__" && r !== "constructor" && (r in e ?
|
|
536
|
+
}, Se = (e, t, n) => {
|
|
537
|
+
let r = z(e, n);
|
|
538
|
+
return r === void 0 ? z(t, n) : r;
|
|
539
|
+
}, B = (e, t, n) => {
|
|
540
|
+
for (let r in t) r !== "__proto__" && r !== "constructor" && (r in e ? M(e[r]) || e[r] instanceof String || M(t[r]) || t[r] instanceof String ? n && (e[r] = t[r]) : B(e[r], t[r], n) : e[r] = t[r]);
|
|
534
541
|
return e;
|
|
535
|
-
},
|
|
542
|
+
}, V = (e) => e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"), Ce = {
|
|
536
543
|
"&": "&",
|
|
537
544
|
"<": "<",
|
|
538
545
|
">": ">",
|
|
539
546
|
"\"": """,
|
|
540
547
|
"'": "'",
|
|
541
548
|
"/": "/"
|
|
542
|
-
},
|
|
549
|
+
}, we = (e) => M(e) ? e.replace(/[&<>"'\/]/g, (e) => Ce[e]) : e, Te = class {
|
|
543
550
|
constructor(e) {
|
|
544
551
|
this.capacity = e, this.regExpMap = /* @__PURE__ */ new Map(), this.regExpQueue = [];
|
|
545
552
|
}
|
|
@@ -549,23 +556,23 @@ var me = async (e) => {
|
|
|
549
556
|
let n = new RegExp(e);
|
|
550
557
|
return this.regExpQueue.length === this.capacity && this.regExpMap.delete(this.regExpQueue.shift()), this.regExpMap.set(e, n), this.regExpQueue.push(e), n;
|
|
551
558
|
}
|
|
552
|
-
},
|
|
559
|
+
}, Ee = [
|
|
553
560
|
" ",
|
|
554
561
|
",",
|
|
555
562
|
"?",
|
|
556
563
|
"!",
|
|
557
564
|
";"
|
|
558
|
-
],
|
|
565
|
+
], De = new Te(20), Oe = (e, t, n) => {
|
|
559
566
|
t ||= "", n ||= "";
|
|
560
|
-
let r =
|
|
567
|
+
let r = Ee.filter((e) => t.indexOf(e) < 0 && n.indexOf(e) < 0);
|
|
561
568
|
if (r.length === 0) return !0;
|
|
562
|
-
let i =
|
|
569
|
+
let i = De.getRegExp(`(${r.map((e) => e === "?" ? "\\?" : e).join("|")})`), a = !i.test(e);
|
|
563
570
|
if (!a) {
|
|
564
571
|
let t = e.indexOf(n);
|
|
565
572
|
t > 0 && !i.test(e.substring(0, t)) && (a = !0);
|
|
566
573
|
}
|
|
567
574
|
return a;
|
|
568
|
-
},
|
|
575
|
+
}, H = (e, t, n = ".") => {
|
|
569
576
|
if (!e) return;
|
|
570
577
|
if (e[t]) return Object.prototype.hasOwnProperty.call(e, t) ? e[t] : void 0;
|
|
571
578
|
let r = t.split(n), i = e;
|
|
@@ -584,7 +591,7 @@ var me = async (e) => {
|
|
|
584
591
|
i = t;
|
|
585
592
|
}
|
|
586
593
|
return i;
|
|
587
|
-
},
|
|
594
|
+
}, U = (e) => e?.replace(/_/g, "-"), ke = {
|
|
588
595
|
type: "logger",
|
|
589
596
|
log(e) {
|
|
590
597
|
this.output("log", e);
|
|
@@ -598,12 +605,12 @@ var me = async (e) => {
|
|
|
598
605
|
output(e, t) {
|
|
599
606
|
console?.[e]?.apply?.(console, t);
|
|
600
607
|
}
|
|
601
|
-
},
|
|
608
|
+
}, W = new class e {
|
|
602
609
|
constructor(e, t = {}) {
|
|
603
610
|
this.init(e, t);
|
|
604
611
|
}
|
|
605
612
|
init(e, t = {}) {
|
|
606
|
-
this.prefix = t.prefix || "i18next:", this.logger = e ||
|
|
613
|
+
this.prefix = t.prefix || "i18next:", this.logger = e || ke, this.options = t, this.debug = t.debug;
|
|
607
614
|
}
|
|
608
615
|
log(...e) {
|
|
609
616
|
return this.forward(e, "log", "", !0);
|
|
@@ -618,7 +625,7 @@ var me = async (e) => {
|
|
|
618
625
|
return this.forward(e, "warn", "WARNING DEPRECATED: ", !0);
|
|
619
626
|
}
|
|
620
627
|
forward(e, t, n, r) {
|
|
621
|
-
return r && !this.debug ? null : (
|
|
628
|
+
return r && !this.debug ? null : (M(e[0]) && (e[0] = `${n}${this.prefix} ${e[0]}`), this.logger[t](e));
|
|
622
629
|
}
|
|
623
630
|
create(t) {
|
|
624
631
|
return new e(this.logger, {
|
|
@@ -629,7 +636,7 @@ var me = async (e) => {
|
|
|
629
636
|
clone(t) {
|
|
630
637
|
return t ||= this.options, t.prefix = t.prefix || this.prefix, new e(this.logger, t);
|
|
631
638
|
}
|
|
632
|
-
}(),
|
|
639
|
+
}(), G = class {
|
|
633
640
|
constructor() {
|
|
634
641
|
this.observers = {};
|
|
635
642
|
}
|
|
@@ -656,7 +663,7 @@ var me = async (e) => {
|
|
|
656
663
|
for (let i = 0; i < r; i++) n.apply(n, [e, ...t]);
|
|
657
664
|
});
|
|
658
665
|
}
|
|
659
|
-
},
|
|
666
|
+
}, K = class extends G {
|
|
660
667
|
constructor(e, t = {
|
|
661
668
|
ns: ["translation"],
|
|
662
669
|
defaultNS: "translation"
|
|
@@ -672,16 +679,16 @@ var me = async (e) => {
|
|
|
672
679
|
}
|
|
673
680
|
getResource(e, t, n, r = {}) {
|
|
674
681
|
let i = r.keySeparator === void 0 ? this.options.keySeparator : r.keySeparator, a = r.ignoreJSONStructure === void 0 ? this.options.ignoreJSONStructure : r.ignoreJSONStructure, o;
|
|
675
|
-
e.indexOf(".") > -1 ? o = e.split(".") : (o = [e, t], n && (Array.isArray(n) ? o.push(...n) :
|
|
676
|
-
let s =
|
|
677
|
-
return !s && !t && !n && e.indexOf(".") > -1 && (e = o[0], t = o[1], n = o.slice(2).join(".")), s || !a || !
|
|
682
|
+
e.indexOf(".") > -1 ? o = e.split(".") : (o = [e, t], n && (Array.isArray(n) ? o.push(...n) : M(n) && i ? o.push(...n.split(i)) : o.push(n)));
|
|
683
|
+
let s = z(this.data, o);
|
|
684
|
+
return !s && !t && !n && e.indexOf(".") > -1 && (e = o[0], t = o[1], n = o.slice(2).join(".")), s || !a || !M(n) ? s : H(this.data?.[e]?.[t], n, i);
|
|
678
685
|
}
|
|
679
686
|
addResource(e, t, n, r, i = { silent: !1 }) {
|
|
680
687
|
let a = i.keySeparator === void 0 ? this.options.keySeparator : i.keySeparator, o = [e, t];
|
|
681
|
-
n && (o = o.concat(a ? n.split(a) : n)), e.indexOf(".") > -1 && (o = e.split("."), r = t, t = o[1]), this.addNamespaces(t),
|
|
688
|
+
n && (o = o.concat(a ? n.split(a) : n)), e.indexOf(".") > -1 && (o = e.split("."), r = t, t = o[1]), this.addNamespaces(t), R(this.data, o, r), i.silent || this.emit("added", e, t, n, r);
|
|
682
689
|
}
|
|
683
690
|
addResources(e, t, n, r = { silent: !1 }) {
|
|
684
|
-
for (let r in n) (
|
|
691
|
+
for (let r in n) (M(n[r]) || Array.isArray(n[r])) && this.addResource(e, t, r, n[r], { silent: !0 });
|
|
685
692
|
r.silent || this.emit("added", e, t, n);
|
|
686
693
|
}
|
|
687
694
|
addResourceBundle(e, t, n, r, i, a = {
|
|
@@ -690,11 +697,11 @@ var me = async (e) => {
|
|
|
690
697
|
}) {
|
|
691
698
|
let o = [e, t];
|
|
692
699
|
e.indexOf(".") > -1 && (o = e.split("."), r = n, n = t, t = o[1]), this.addNamespaces(t);
|
|
693
|
-
let s =
|
|
694
|
-
a.skipCopy || (n = JSON.parse(JSON.stringify(n))), r ?
|
|
700
|
+
let s = z(this.data, o) || {};
|
|
701
|
+
a.skipCopy || (n = JSON.parse(JSON.stringify(n))), r ? B(s, n, i) : s = {
|
|
695
702
|
...s,
|
|
696
703
|
...n
|
|
697
|
-
},
|
|
704
|
+
}, R(this.data, o, s), a.silent || this.emit("added", e, t, n);
|
|
698
705
|
}
|
|
699
706
|
removeResourceBundle(e, t) {
|
|
700
707
|
this.hasResourceBundle(e, t) && delete this.data[e][t], this.removeNamespaces(t), this.emit("removed", e, t);
|
|
@@ -715,7 +722,7 @@ var me = async (e) => {
|
|
|
715
722
|
toJSON() {
|
|
716
723
|
return this.data;
|
|
717
724
|
}
|
|
718
|
-
},
|
|
725
|
+
}, Ae = {
|
|
719
726
|
processors: {},
|
|
720
727
|
addPostProcessor(e) {
|
|
721
728
|
this.processors[e.name] = e;
|
|
@@ -725,22 +732,22 @@ var me = async (e) => {
|
|
|
725
732
|
t = this.processors[e]?.process(t, n, r, i) ?? t;
|
|
726
733
|
}), t;
|
|
727
734
|
}
|
|
728
|
-
},
|
|
729
|
-
function
|
|
735
|
+
}, je = Symbol("i18next/PATH_KEY");
|
|
736
|
+
function Me() {
|
|
730
737
|
let e = [], t = Object.create(null), n;
|
|
731
|
-
return t.get = (r, i) => (n?.revoke?.(), i ===
|
|
738
|
+
return t.get = (r, i) => (n?.revoke?.(), i === je ? e : (e.push(i), n = Proxy.revocable(r, t), n.proxy)), Proxy.revocable(Object.create(null), t).proxy;
|
|
732
739
|
}
|
|
733
740
|
function q(e, t) {
|
|
734
|
-
let { [
|
|
741
|
+
let { [je]: n } = e(Me()), r = t?.keySeparator ?? ".", i = t?.nsSeparator ?? ":";
|
|
735
742
|
if (n.length > 1 && i) {
|
|
736
743
|
let e = t?.ns, a = Array.isArray(e) ? e : null;
|
|
737
744
|
if (a && a.length > 1 && a.slice(1).includes(n[0])) return `${n[0]}${i}${n.slice(1).join(r)}`;
|
|
738
745
|
}
|
|
739
746
|
return n.join(r);
|
|
740
747
|
}
|
|
741
|
-
var
|
|
748
|
+
var Ne = {}, J = (e) => !M(e) && typeof e != "boolean" && typeof e != "number", Pe = class e extends G {
|
|
742
749
|
constructor(e, t = {}) {
|
|
743
|
-
super(),
|
|
750
|
+
super(), ye([
|
|
744
751
|
"resourceStore",
|
|
745
752
|
"languageUtils",
|
|
746
753
|
"pluralResolver",
|
|
@@ -748,7 +755,7 @@ var J = {}, Y = (e) => !A(e) && typeof e != "boolean" && typeof e != "number", k
|
|
|
748
755
|
"backendConnector",
|
|
749
756
|
"i18nFormat",
|
|
750
757
|
"utils"
|
|
751
|
-
], e, this), this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.logger =
|
|
758
|
+
], e, this), this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.logger = W.create("translator");
|
|
752
759
|
}
|
|
753
760
|
changeLanguage(e) {
|
|
754
761
|
e && (this.language = e);
|
|
@@ -758,25 +765,25 @@ var J = {}, Y = (e) => !A(e) && typeof e != "boolean" && typeof e != "number", k
|
|
|
758
765
|
if (e == null) return !1;
|
|
759
766
|
let r = this.resolve(e, n);
|
|
760
767
|
if (r?.res === void 0) return !1;
|
|
761
|
-
let i =
|
|
768
|
+
let i = J(r.res);
|
|
762
769
|
return !(n.returnObjects === !1 && i);
|
|
763
770
|
}
|
|
764
771
|
extractFromKey(e, t) {
|
|
765
772
|
let n = t.nsSeparator === void 0 ? this.options.nsSeparator : t.nsSeparator;
|
|
766
773
|
n === void 0 && (n = ":");
|
|
767
|
-
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 && !
|
|
774
|
+
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 && !Oe(e, n, r);
|
|
768
775
|
if (a && !o) {
|
|
769
776
|
let t = e.match(this.interpolator.nestingRegexp);
|
|
770
777
|
if (t && t.length > 0) return {
|
|
771
778
|
key: e,
|
|
772
|
-
namespaces:
|
|
779
|
+
namespaces: M(i) ? [i] : i
|
|
773
780
|
};
|
|
774
781
|
let a = e.split(n);
|
|
775
782
|
(n !== r || n === r && this.options.ns.indexOf(a[0]) > -1) && (i = a.shift()), e = a.join(r);
|
|
776
783
|
}
|
|
777
784
|
return {
|
|
778
785
|
key: e,
|
|
779
|
-
namespaces:
|
|
786
|
+
namespaces: M(i) ? [i] : i
|
|
780
787
|
};
|
|
781
788
|
}
|
|
782
789
|
translate(t, n, r) {
|
|
@@ -811,10 +818,10 @@ var J = {}, Y = (e) => !A(e) && typeof e != "boolean" && typeof e != "number", k
|
|
|
811
818
|
"[object Number]",
|
|
812
819
|
"[object Function]",
|
|
813
820
|
"[object RegExp]"
|
|
814
|
-
], v = i.joinArrays === void 0 ? this.options.joinArrays : i.joinArrays, y = !this.i18nFormat || this.i18nFormat.handleAsObject, b = i.count !== void 0 && !
|
|
821
|
+
], v = i.joinArrays === void 0 ? this.options.joinArrays : i.joinArrays, y = !this.i18nFormat || this.i18nFormat.handleAsObject, b = i.count !== void 0 && !M(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;
|
|
815
822
|
y && !m && x && (E = T);
|
|
816
|
-
let D =
|
|
817
|
-
if (y && E && D && _.indexOf(O) < 0 && !(
|
|
823
|
+
let D = J(E), O = Object.prototype.toString.apply(E);
|
|
824
|
+
if (y && E && D && _.indexOf(O) < 0 && !(M(v) && Array.isArray(E))) {
|
|
818
825
|
if (!i.returnObjects && !this.options.returnObjects) {
|
|
819
826
|
this.options.returnedObjectHandler || this.logger.warn("accessing an object - but returnObjects options is not enabled!");
|
|
820
827
|
let e = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(h, E, {
|
|
@@ -829,7 +836,7 @@ var J = {}, Y = (e) => !A(e) && typeof e != "boolean" && typeof e != "number", k
|
|
|
829
836
|
let r = `${n}${o}${e}`;
|
|
830
837
|
x && !m ? t[e] = this.translate(r, {
|
|
831
838
|
...i,
|
|
832
|
-
defaultValue:
|
|
839
|
+
defaultValue: J(T) ? T[e] : void 0,
|
|
833
840
|
joinArrays: !1,
|
|
834
841
|
ns: c
|
|
835
842
|
}) : t[e] = this.translate(r, {
|
|
@@ -840,7 +847,7 @@ var J = {}, Y = (e) => !A(e) && typeof e != "boolean" && typeof e != "number", k
|
|
|
840
847
|
}
|
|
841
848
|
m = t;
|
|
842
849
|
}
|
|
843
|
-
} else if (y &&
|
|
850
|
+
} else if (y && M(v) && Array.isArray(m)) m = m.join(v), m &&= this.extendTranslation(m, t, i, r);
|
|
844
851
|
else {
|
|
845
852
|
let e = !1, n = !1;
|
|
846
853
|
!this.isValidLookup(m) && x && (e = !0, m = T), this.isValidLookup(m) || (n = !0, m = s);
|
|
@@ -884,12 +891,12 @@ var J = {}, Y = (e) => !A(e) && typeof e != "boolean" && typeof e != "number", k
|
|
|
884
891
|
...n.interpolation
|
|
885
892
|
}
|
|
886
893
|
});
|
|
887
|
-
let a =
|
|
894
|
+
let a = M(e) && (n?.interpolation?.skipOnVariables === void 0 ? this.options.interpolation.skipOnVariables : n.interpolation.skipOnVariables), o;
|
|
888
895
|
if (a) {
|
|
889
896
|
let t = e.match(this.interpolator.nestingRegexp);
|
|
890
897
|
o = t && t.length;
|
|
891
898
|
}
|
|
892
|
-
let s = n.replace && !
|
|
899
|
+
let s = n.replace && !M(n.replace) ? n.replace : n;
|
|
893
900
|
if (this.options.interpolation.defaultVariables && (s = {
|
|
894
901
|
...this.options.interpolation.defaultVariables,
|
|
895
902
|
...s
|
|
@@ -899,8 +906,8 @@ var J = {}, Y = (e) => !A(e) && typeof e != "boolean" && typeof e != "number", k
|
|
|
899
906
|
}
|
|
900
907
|
!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();
|
|
901
908
|
}
|
|
902
|
-
let a = n.postProcess || this.options.postProcess, o =
|
|
903
|
-
return e != null && o?.length && n.applyPostProcessor !== !1 && (e =
|
|
909
|
+
let a = n.postProcess || this.options.postProcess, o = M(a) ? [a] : a;
|
|
910
|
+
return e != null && o?.length && n.applyPostProcessor !== !1 && (e = Ae.handle(o, e, t, this.options && this.options.postProcessPassResolved ? {
|
|
904
911
|
i18nResolved: {
|
|
905
912
|
...r,
|
|
906
913
|
usedParams: this.getUsedParamsDetails(n)
|
|
@@ -910,7 +917,7 @@ var J = {}, Y = (e) => !A(e) && typeof e != "boolean" && typeof e != "number", k
|
|
|
910
917
|
}
|
|
911
918
|
resolve(e, t = {}) {
|
|
912
919
|
let n, r, i, a, o;
|
|
913
|
-
return
|
|
920
|
+
return M(e) && (e = [e]), Array.isArray(e) && (e = e.map((e) => typeof e == "function" ? q(e, {
|
|
914
921
|
...this.options,
|
|
915
922
|
...t
|
|
916
923
|
}) : e)), e.forEach((e) => {
|
|
@@ -919,9 +926,9 @@ var J = {}, Y = (e) => !A(e) && typeof e != "boolean" && typeof e != "number", k
|
|
|
919
926
|
r = c;
|
|
920
927
|
let l = s.namespaces;
|
|
921
928
|
this.options.fallbackNS && (l = l.concat(this.options.fallbackNS));
|
|
922
|
-
let u = t.count !== void 0 && !
|
|
929
|
+
let u = t.count !== void 0 && !M(t.count), d = u && !t.ordinal && t.count === 0, f = t.context !== void 0 && (M(t.context) || typeof t.context == "number") && t.context !== "", p = t.lngs ? t.lngs : this.languageUtils.toResolveHierarchy(t.lng || this.language, t.fallbackLng);
|
|
923
930
|
l.forEach((e) => {
|
|
924
|
-
this.isValidLookup(n) || (o = e, !
|
|
931
|
+
this.isValidLookup(n) || (o = e, !Ne[`${p[0]}-${e}`] && this.utils?.hasLoadedNamespace && !this.utils?.hasLoadedNamespace(o) && (Ne[`${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) => {
|
|
925
932
|
if (this.isValidLookup(n)) return;
|
|
926
933
|
a = r;
|
|
927
934
|
let o = [c];
|
|
@@ -970,7 +977,7 @@ var J = {}, Y = (e) => !A(e) && typeof e != "boolean" && typeof e != "number", k
|
|
|
970
977
|
"joinArrays",
|
|
971
978
|
"postProcess",
|
|
972
979
|
"interpolation"
|
|
973
|
-
], n = e.replace && !
|
|
980
|
+
], n = e.replace && !M(e.replace), r = n ? e.replace : e;
|
|
974
981
|
if (n && e.count !== void 0 && (r.count = e.count), this.options.interpolation.defaultVariables && (r = {
|
|
975
982
|
...this.options.interpolation.defaultVariables,
|
|
976
983
|
...r
|
|
@@ -984,22 +991,22 @@ var J = {}, Y = (e) => !A(e) && typeof e != "boolean" && typeof e != "number", k
|
|
|
984
991
|
for (let t in e) if (Object.prototype.hasOwnProperty.call(e, t) && t.substring(0, 12) === "defaultValue" && e[t] !== void 0) return !0;
|
|
985
992
|
return !1;
|
|
986
993
|
}
|
|
987
|
-
},
|
|
994
|
+
}, Fe = class {
|
|
988
995
|
constructor(e) {
|
|
989
|
-
this.options = e, this.supportedLngs = this.options.supportedLngs || !1, this.logger =
|
|
996
|
+
this.options = e, this.supportedLngs = this.options.supportedLngs || !1, this.logger = W.create("languageUtils");
|
|
990
997
|
}
|
|
991
998
|
getScriptPartFromCode(e) {
|
|
992
|
-
if (e =
|
|
999
|
+
if (e = U(e), !e || e.indexOf("-") < 0) return null;
|
|
993
1000
|
let t = e.split("-");
|
|
994
1001
|
return t.length === 2 || (t.pop(), t[t.length - 1].toLowerCase() === "x") ? null : this.formatLanguageCode(t.join("-"));
|
|
995
1002
|
}
|
|
996
1003
|
getLanguagePartFromCode(e) {
|
|
997
|
-
if (e =
|
|
1004
|
+
if (e = U(e), !e || e.indexOf("-") < 0) return e;
|
|
998
1005
|
let t = e.split("-");
|
|
999
1006
|
return this.formatLanguageCode(t[0]);
|
|
1000
1007
|
}
|
|
1001
1008
|
formatLanguageCode(e) {
|
|
1002
|
-
if (
|
|
1009
|
+
if (M(e) && e.indexOf("-") > -1) {
|
|
1003
1010
|
let t;
|
|
1004
1011
|
try {
|
|
1005
1012
|
t = Intl.getCanonicalLocales(e)[0];
|
|
@@ -1031,7 +1038,7 @@ var J = {}, Y = (e) => !A(e) && typeof e != "boolean" && typeof e != "number", k
|
|
|
1031
1038
|
}
|
|
1032
1039
|
getFallbackCodes(e, t) {
|
|
1033
1040
|
if (!e) return [];
|
|
1034
|
-
if (typeof e == "function" && (e = e(t)),
|
|
1041
|
+
if (typeof e == "function" && (e = e(t)), M(e) && (e = [e]), Array.isArray(e)) return e;
|
|
1035
1042
|
if (!t) return e.default || [];
|
|
1036
1043
|
let n = e[t];
|
|
1037
1044
|
return n ||= e[this.getScriptPartFromCode(t)], n ||= e[this.formatLanguageCode(t)], n ||= e[this.getLanguagePartFromCode(t)], n ||= e.default, n || [];
|
|
@@ -1040,29 +1047,29 @@ var J = {}, Y = (e) => !A(e) && typeof e != "boolean" && typeof e != "number", k
|
|
|
1040
1047
|
let n = this.getFallbackCodes((t === !1 ? [] : t) || this.options.fallbackLng || [], e), r = [], i = (e) => {
|
|
1041
1048
|
e && (this.isSupportedCode(e) ? r.push(e) : this.logger.warn(`rejecting language code not found in supportedLngs: ${e}`));
|
|
1042
1049
|
};
|
|
1043
|
-
return
|
|
1050
|
+
return M(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))) : M(e) && i(this.formatLanguageCode(e)), n.forEach((e) => {
|
|
1044
1051
|
r.indexOf(e) < 0 && i(this.formatLanguageCode(e));
|
|
1045
1052
|
}), r;
|
|
1046
1053
|
}
|
|
1047
|
-
},
|
|
1054
|
+
}, Ie = {
|
|
1048
1055
|
zero: 0,
|
|
1049
1056
|
one: 1,
|
|
1050
1057
|
two: 2,
|
|
1051
1058
|
few: 3,
|
|
1052
1059
|
many: 4,
|
|
1053
1060
|
other: 5
|
|
1054
|
-
},
|
|
1061
|
+
}, Le = {
|
|
1055
1062
|
select: (e) => e === 1 ? "one" : "other",
|
|
1056
1063
|
resolvedOptions: () => ({ pluralCategories: ["one", "other"] })
|
|
1057
|
-
},
|
|
1064
|
+
}, Re = class {
|
|
1058
1065
|
constructor(e, t = {}) {
|
|
1059
|
-
this.languageUtils = e, this.options = t, this.logger =
|
|
1066
|
+
this.languageUtils = e, this.options = t, this.logger = W.create("pluralResolver"), this.pluralRulesCache = {};
|
|
1060
1067
|
}
|
|
1061
1068
|
clearCache() {
|
|
1062
1069
|
this.pluralRulesCache = {};
|
|
1063
1070
|
}
|
|
1064
1071
|
getRule(e, t = {}) {
|
|
1065
|
-
let n =
|
|
1072
|
+
let n = U(e === "dev" ? "en" : e), r = t.ordinal ? "ordinal" : "cardinal", i = JSON.stringify({
|
|
1066
1073
|
cleanedCode: n,
|
|
1067
1074
|
type: r
|
|
1068
1075
|
});
|
|
@@ -1071,8 +1078,8 @@ var J = {}, Y = (e) => !A(e) && typeof e != "boolean" && typeof e != "number", k
|
|
|
1071
1078
|
try {
|
|
1072
1079
|
a = new Intl.PluralRules(n, { type: r });
|
|
1073
1080
|
} catch {
|
|
1074
|
-
if (typeof Intl > "u") return this.logger.error("No Intl support, please use an Intl polyfill!"),
|
|
1075
|
-
if (!e.match(/-|_/)) return
|
|
1081
|
+
if (typeof Intl > "u") return this.logger.error("No Intl support, please use an Intl polyfill!"), Le;
|
|
1082
|
+
if (!e.match(/-|_/)) return Le;
|
|
1076
1083
|
let n = this.languageUtils.getLanguagePartFromCode(e);
|
|
1077
1084
|
a = this.getRule(n, t);
|
|
1078
1085
|
}
|
|
@@ -1087,23 +1094,23 @@ var J = {}, Y = (e) => !A(e) && typeof e != "boolean" && typeof e != "number", k
|
|
|
1087
1094
|
}
|
|
1088
1095
|
getSuffixes(e, t = {}) {
|
|
1089
1096
|
let n = this.getRule(e, t);
|
|
1090
|
-
return n ||= this.getRule("dev", t), n ? n.resolvedOptions().pluralCategories.sort((e, t) =>
|
|
1097
|
+
return n ||= this.getRule("dev", t), n ? n.resolvedOptions().pluralCategories.sort((e, t) => Ie[e] - Ie[t]).map((e) => `${this.options.prepend}${t.ordinal ? `ordinal${this.options.prepend}` : ""}${e}`) : [];
|
|
1091
1098
|
}
|
|
1092
1099
|
getSuffix(e, t, n = {}) {
|
|
1093
1100
|
let r = this.getRule(e, n);
|
|
1094
1101
|
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));
|
|
1095
1102
|
}
|
|
1096
|
-
},
|
|
1097
|
-
let a =
|
|
1098
|
-
return !a && i &&
|
|
1099
|
-
},
|
|
1103
|
+
}, ze = (e, t, n, r = ".", i = !0) => {
|
|
1104
|
+
let a = Se(e, t, n);
|
|
1105
|
+
return !a && i && M(n) && (a = H(e, n, r), a === void 0 && (a = H(t, n, r))), a;
|
|
1106
|
+
}, Y = (e) => e.replace(/\$/g, "$$$$"), Be = class {
|
|
1100
1107
|
constructor(e = {}) {
|
|
1101
|
-
this.logger =
|
|
1108
|
+
this.logger = W.create("interpolator"), this.options = e, this.format = e?.interpolation?.format || ((e) => e), this.init(e);
|
|
1102
1109
|
}
|
|
1103
1110
|
init(e = {}) {
|
|
1104
1111
|
e.interpolation ||= { escapeValue: !0 };
|
|
1105
1112
|
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;
|
|
1106
|
-
this.escape = t === void 0 ?
|
|
1113
|
+
this.escape = t === void 0 ? we : t, this.escapeValue = n === void 0 || n, this.useRawValueToEscape = r !== void 0 && r, this.prefix = i ? V(i) : a || "{{", this.suffix = o ? V(o) : s || "}}", this.formatSeparator = c || ",", this.unescapePrefix = l ? "" : u || "-", this.unescapeSuffix = this.unescapePrefix ? "" : l || "", this.nestingPrefix = d ? V(d) : f || V("$t("), this.nestingSuffix = p ? V(p) : m || V(")"), this.nestingOptionsSeparator = h || ",", this.maxReplaces = g || 1e3, this.alwaysFormat = _ !== void 0 && _, this.resetRegExp();
|
|
1107
1114
|
}
|
|
1108
1115
|
reset() {
|
|
1109
1116
|
this.options && this.init(this.options);
|
|
@@ -1115,7 +1122,7 @@ var J = {}, Y = (e) => !A(e) && typeof e != "boolean" && typeof e != "number", k
|
|
|
1115
1122
|
interpolate(e, t, n, r) {
|
|
1116
1123
|
let i, a, o, s = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {}, c = (e) => {
|
|
1117
1124
|
if (e.indexOf(this.formatSeparator) < 0) {
|
|
1118
|
-
let i =
|
|
1125
|
+
let i = ze(t, s, e, this.options.keySeparator, this.options.ignoreJSONStructure);
|
|
1119
1126
|
return this.alwaysFormat ? this.format(i, void 0, n, {
|
|
1120
1127
|
...r,
|
|
1121
1128
|
...t,
|
|
@@ -1123,7 +1130,7 @@ var J = {}, Y = (e) => !A(e) && typeof e != "boolean" && typeof e != "number", k
|
|
|
1123
1130
|
}) : i;
|
|
1124
1131
|
}
|
|
1125
1132
|
let i = e.split(this.formatSeparator), a = i.shift().trim(), o = i.join(this.formatSeparator).trim();
|
|
1126
|
-
return this.format(
|
|
1133
|
+
return this.format(ze(t, s, a, this.options.keySeparator, this.options.ignoreJSONStructure), o, n, {
|
|
1127
1134
|
...r,
|
|
1128
1135
|
...t,
|
|
1129
1136
|
interpolationkey: a
|
|
@@ -1133,22 +1140,22 @@ var J = {}, Y = (e) => !A(e) && typeof e != "boolean" && typeof e != "number", k
|
|
|
1133
1140
|
let l = r?.missingInterpolationHandler || this.options.missingInterpolationHandler, u = r?.interpolation?.skipOnVariables === void 0 ? this.options.interpolation.skipOnVariables : r.interpolation.skipOnVariables;
|
|
1134
1141
|
return [{
|
|
1135
1142
|
regex: this.regexpUnescape,
|
|
1136
|
-
safeValue: (e) =>
|
|
1143
|
+
safeValue: (e) => Y(e)
|
|
1137
1144
|
}, {
|
|
1138
1145
|
regex: this.regexp,
|
|
1139
|
-
safeValue: (e) => this.escapeValue ?
|
|
1146
|
+
safeValue: (e) => this.escapeValue ? Y(this.escape(e)) : Y(e)
|
|
1140
1147
|
}].forEach((t) => {
|
|
1141
1148
|
for (o = 0; i = t.regex.exec(e);) {
|
|
1142
1149
|
let n = i[1].trim();
|
|
1143
1150
|
if (a = c(n), a === void 0) if (typeof l == "function") {
|
|
1144
1151
|
let t = l(e, i, r);
|
|
1145
|
-
a =
|
|
1152
|
+
a = M(t) ? t : "";
|
|
1146
1153
|
} else if (r && Object.prototype.hasOwnProperty.call(r, n)) a = "";
|
|
1147
1154
|
else if (u) {
|
|
1148
1155
|
a = i[0];
|
|
1149
1156
|
continue;
|
|
1150
1157
|
} else this.logger.warn(`missed to pass in variable ${n} for interpolating ${e}`), a = "";
|
|
1151
|
-
else !
|
|
1158
|
+
else !M(a) && !this.useRawValueToEscape && (a = P(a));
|
|
1152
1159
|
let s = t.safeValue(a);
|
|
1153
1160
|
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;
|
|
1154
1161
|
}
|
|
@@ -1158,7 +1165,7 @@ var J = {}, Y = (e) => !A(e) && typeof e != "boolean" && typeof e != "number", k
|
|
|
1158
1165
|
let r, i, a, o = (e, t) => {
|
|
1159
1166
|
let n = this.nestingOptionsSeparator;
|
|
1160
1167
|
if (e.indexOf(n) < 0) return e;
|
|
1161
|
-
let r = e.split(RegExp(`${
|
|
1168
|
+
let r = e.split(RegExp(`${V(n)}[ ]*{`)), i = `{${r[1]}`;
|
|
1162
1169
|
e = r[0], i = this.interpolate(i, a);
|
|
1163
1170
|
let o = i.match(/'/g), s = i.match(/"/g);
|
|
1164
1171
|
((o?.length ?? 0) % 2 == 0 && !s || (s?.length ?? 0) % 2 != 0) && (i = i.replace(/'/g, "\""));
|
|
@@ -1174,17 +1181,17 @@ var J = {}, Y = (e) => !A(e) && typeof e != "boolean" && typeof e != "number", k
|
|
|
1174
1181
|
};
|
|
1175
1182
|
for (; r = this.nestingRegexp.exec(e);) {
|
|
1176
1183
|
let s = [];
|
|
1177
|
-
a = { ...n }, a = a.replace && !
|
|
1184
|
+
a = { ...n }, a = a.replace && !M(a.replace) ? a.replace : a, a.applyPostProcessor = !1, delete a.defaultValue;
|
|
1178
1185
|
let c = /{.*}/.test(r[1]) ? r[1].lastIndexOf("}") + 1 : r[1].indexOf(this.formatSeparator);
|
|
1179
|
-
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 && !
|
|
1180
|
-
|
|
1186
|
+
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 && !M(i)) return i;
|
|
1187
|
+
M(i) || (i = P(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, {
|
|
1181
1188
|
...n,
|
|
1182
1189
|
interpolationkey: r[1].trim()
|
|
1183
1190
|
}), i.trim())), e = e.replace(r[0], i), this.regexp.lastIndex = 0;
|
|
1184
1191
|
}
|
|
1185
1192
|
return e;
|
|
1186
1193
|
}
|
|
1187
|
-
},
|
|
1194
|
+
}, Ve = (e) => {
|
|
1188
1195
|
let t = e.toLowerCase().trim(), n = {};
|
|
1189
1196
|
if (e.indexOf("(") > -1) {
|
|
1190
1197
|
let r = e.split("(");
|
|
@@ -1201,7 +1208,7 @@ var J = {}, Y = (e) => !A(e) && typeof e != "boolean" && typeof e != "number", k
|
|
|
1201
1208
|
formatName: t,
|
|
1202
1209
|
formatOptions: n
|
|
1203
1210
|
};
|
|
1204
|
-
},
|
|
1211
|
+
}, He = (e) => {
|
|
1205
1212
|
let t = {};
|
|
1206
1213
|
return (n, r, i) => {
|
|
1207
1214
|
let a = i;
|
|
@@ -1210,15 +1217,15 @@ var J = {}, Y = (e) => !A(e) && typeof e != "boolean" && typeof e != "number", k
|
|
|
1210
1217
|
[i.interpolationkey]: void 0
|
|
1211
1218
|
});
|
|
1212
1219
|
let o = r + JSON.stringify(a), s = t[o];
|
|
1213
|
-
return s || (s = e(
|
|
1220
|
+
return s || (s = e(U(r), i), t[o] = s), s(n);
|
|
1214
1221
|
};
|
|
1215
|
-
},
|
|
1222
|
+
}, Ue = (e) => (t, n, r) => e(U(n), r)(t), We = class {
|
|
1216
1223
|
constructor(e = {}) {
|
|
1217
|
-
this.logger =
|
|
1224
|
+
this.logger = W.create("formatter"), this.options = e, this.init(e);
|
|
1218
1225
|
}
|
|
1219
1226
|
init(e, t = { interpolation: {} }) {
|
|
1220
1227
|
this.formatSeparator = t.interpolation.formatSeparator || ",";
|
|
1221
|
-
let n = t.cacheInBuiltFormats ?
|
|
1228
|
+
let n = t.cacheInBuiltFormats ? He : Ue;
|
|
1222
1229
|
this.formats = {
|
|
1223
1230
|
number: n((e, t) => {
|
|
1224
1231
|
let n = new Intl.NumberFormat(e, { ...t });
|
|
@@ -1249,7 +1256,7 @@ var J = {}, Y = (e) => !A(e) && typeof e != "boolean" && typeof e != "number", k
|
|
|
1249
1256
|
this.formats[e.toLowerCase().trim()] = t;
|
|
1250
1257
|
}
|
|
1251
1258
|
addCached(e, t) {
|
|
1252
|
-
this.formats[e.toLowerCase().trim()] =
|
|
1259
|
+
this.formats[e.toLowerCase().trim()] = He(t);
|
|
1253
1260
|
}
|
|
1254
1261
|
format(e, t, n, r = {}) {
|
|
1255
1262
|
let i = t.split(this.formatSeparator);
|
|
@@ -1258,7 +1265,7 @@ var J = {}, Y = (e) => !A(e) && typeof e != "boolean" && typeof e != "number", k
|
|
|
1258
1265
|
i[0] = [i[0], ...i.splice(1, e)].join(this.formatSeparator);
|
|
1259
1266
|
}
|
|
1260
1267
|
return i.reduce((e, t) => {
|
|
1261
|
-
let { formatName: i, formatOptions: a } =
|
|
1268
|
+
let { formatName: i, formatOptions: a } = Ve(t);
|
|
1262
1269
|
if (this.formats[i]) {
|
|
1263
1270
|
let t = e;
|
|
1264
1271
|
try {
|
|
@@ -1276,11 +1283,11 @@ var J = {}, Y = (e) => !A(e) && typeof e != "boolean" && typeof e != "number", k
|
|
|
1276
1283
|
return e;
|
|
1277
1284
|
}, e);
|
|
1278
1285
|
}
|
|
1279
|
-
},
|
|
1286
|
+
}, Ge = (e, t) => {
|
|
1280
1287
|
e.pending[t] !== void 0 && (delete e.pending[t], e.pendingCount--);
|
|
1281
|
-
},
|
|
1288
|
+
}, Ke = class extends G {
|
|
1282
1289
|
constructor(e, t, n, r = {}) {
|
|
1283
|
-
super(), this.backend = e, this.store = t, this.services = n, this.languageUtils = n.languageUtils, this.options = r, this.logger =
|
|
1290
|
+
super(), this.backend = e, this.store = t, this.services = n, this.languageUtils = n.languageUtils, this.options = r, this.logger = W.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);
|
|
1284
1291
|
}
|
|
1285
1292
|
queueLoad(e, t, n, r) {
|
|
1286
1293
|
let i = {}, a = {}, o = {}, s = {};
|
|
@@ -1308,7 +1315,7 @@ var J = {}, Y = (e) => !A(e) && typeof e != "boolean" && typeof e != "number", k
|
|
|
1308
1315
|
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);
|
|
1309
1316
|
let o = {};
|
|
1310
1317
|
this.queue.forEach((n) => {
|
|
1311
|
-
|
|
1318
|
+
xe(n.loaded, [i], a), Ge(n, e), t && n.errors.push(t), n.pendingCount === 0 && !n.done && (Object.keys(n.loaded).forEach((e) => {
|
|
1312
1319
|
o[e] || (o[e] = {});
|
|
1313
1320
|
let t = n.loaded[e];
|
|
1314
1321
|
t.length && t.forEach((t) => {
|
|
@@ -1357,7 +1364,7 @@ var J = {}, Y = (e) => !A(e) && typeof e != "boolean" && typeof e != "number", k
|
|
|
1357
1364
|
}
|
|
1358
1365
|
prepareLoading(e, t, n = {}, r) {
|
|
1359
1366
|
if (!this.backend) return this.logger.warn("No backend was added via i18next.use. Will not load resources."), r && r();
|
|
1360
|
-
|
|
1367
|
+
M(e) && (e = this.languageUtils.toResolveHierarchy(e)), M(t) && (t = [t]);
|
|
1361
1368
|
let i = this.queueLoad(e, t, n, r);
|
|
1362
1369
|
if (!i.toLoad.length) return i.pending.length || r(), null;
|
|
1363
1370
|
i.toLoad.forEach((e) => {
|
|
@@ -1398,7 +1405,7 @@ var J = {}, Y = (e) => !A(e) && typeof e != "boolean" && typeof e != "number", k
|
|
|
1398
1405
|
!e || !e[0] || this.store.addResource(e[0], t, n, r);
|
|
1399
1406
|
}
|
|
1400
1407
|
}
|
|
1401
|
-
},
|
|
1408
|
+
}, X = () => ({
|
|
1402
1409
|
debug: !1,
|
|
1403
1410
|
initAsync: !0,
|
|
1404
1411
|
ns: ["translation"],
|
|
@@ -1433,7 +1440,7 @@ var J = {}, Y = (e) => !A(e) && typeof e != "boolean" && typeof e != "number", k
|
|
|
1433
1440
|
appendNamespaceToCIMode: !1,
|
|
1434
1441
|
overloadTranslationOptionHandler: (e) => {
|
|
1435
1442
|
let t = {};
|
|
1436
|
-
if (typeof e[1] == "object" && (t = e[1]),
|
|
1443
|
+
if (typeof e[1] == "object" && (t = e[1]), M(e[1]) && (t.defaultValue = e[1]), M(e[2]) && (t.tDescription = e[2]), typeof e[2] == "object" || typeof e[3] == "object") {
|
|
1437
1444
|
let n = e[3] || e[2];
|
|
1438
1445
|
Object.keys(n).forEach((e) => {
|
|
1439
1446
|
t[e] = n[e];
|
|
@@ -1455,15 +1462,15 @@ var J = {}, Y = (e) => !A(e) && typeof e != "boolean" && typeof e != "number", k
|
|
|
1455
1462
|
skipOnVariables: !0
|
|
1456
1463
|
},
|
|
1457
1464
|
cacheInBuiltFormats: !0
|
|
1458
|
-
}),
|
|
1465
|
+
}), qe = (e) => (M(e.ns) && (e.ns = [e.ns]), M(e.fallbackLng) && (e.fallbackLng = [e.fallbackLng]), M(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), Z = () => {}, Je = (e) => {
|
|
1459
1466
|
Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach((t) => {
|
|
1460
1467
|
typeof e[t] == "function" && (e[t] = e[t].bind(e));
|
|
1461
1468
|
});
|
|
1462
|
-
},
|
|
1463
|
-
typeof globalThis < "u" && (globalThis[
|
|
1464
|
-
},
|
|
1469
|
+
}, Ye = "__i18next_supportNoticeShown", Xe = () => !!(typeof globalThis < "u" && globalThis[Ye] || typeof process < "u" && process.env && process.env.I18NEXT_NO_SUPPORT_NOTICE || typeof process < "u" && process.env), Ze = () => {
|
|
1470
|
+
typeof globalThis < "u" && (globalThis[Ye] = !0);
|
|
1471
|
+
}, Qe = (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)), Q = class e extends G {
|
|
1465
1472
|
constructor(e = {}, t) {
|
|
1466
|
-
if (super(), this.options =
|
|
1473
|
+
if (super(), this.options = qe(e), this.services = {}, this.logger = W, this.modules = { external: [] }, Je(this), t && !this.isInitialized && !e.isClone) {
|
|
1467
1474
|
if (!this.options.initAsync) return this.init(e, t), this;
|
|
1468
1475
|
setTimeout(() => {
|
|
1469
1476
|
this.init(e, t);
|
|
@@ -1471,36 +1478,36 @@ var J = {}, Y = (e) => !A(e) && typeof e != "boolean" && typeof e != "number", k
|
|
|
1471
1478
|
}
|
|
1472
1479
|
}
|
|
1473
1480
|
init(e = {}, t) {
|
|
1474
|
-
this.isInitializing = !0, typeof e == "function" && (t = e, e = {}), e.defaultNS == null && e.ns && (
|
|
1475
|
-
let n =
|
|
1481
|
+
this.isInitializing = !0, typeof e == "function" && (t = e, e = {}), e.defaultNS == null && e.ns && (M(e.ns) ? e.defaultNS = e.ns : e.ns.indexOf("translation") < 0 && (e.defaultNS = e.ns[0]));
|
|
1482
|
+
let n = X();
|
|
1476
1483
|
this.options = {
|
|
1477
1484
|
...n,
|
|
1478
1485
|
...this.options,
|
|
1479
|
-
...
|
|
1486
|
+
...qe(e)
|
|
1480
1487
|
}, this.options.interpolation = {
|
|
1481
1488
|
...n.interpolation,
|
|
1482
1489
|
...this.options.interpolation
|
|
1483
|
-
}, 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 && !
|
|
1490
|
+
}, 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 && !Qe(this) && !Xe() && (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 💙"), Ze());
|
|
1484
1491
|
let r = (e) => e ? typeof e == "function" ? new e() : e : null;
|
|
1485
1492
|
if (!this.options.isClone) {
|
|
1486
|
-
this.modules.logger ?
|
|
1493
|
+
this.modules.logger ? W.init(r(this.modules.logger), this.options) : W.init(null, this.options);
|
|
1487
1494
|
let e;
|
|
1488
|
-
e = this.modules.formatter ? this.modules.formatter :
|
|
1489
|
-
let t = new
|
|
1490
|
-
this.store = new
|
|
1495
|
+
e = this.modules.formatter ? this.modules.formatter : We;
|
|
1496
|
+
let t = new Fe(this.options);
|
|
1497
|
+
this.store = new K(this.options.resources, this.options);
|
|
1491
1498
|
let i = this.services;
|
|
1492
|
-
i.logger =
|
|
1499
|
+
i.logger = W, i.resourceStore = this.store, i.languageUtils = t, i.pluralResolver = new Re(t, {
|
|
1493
1500
|
prepend: this.options.pluralSeparator,
|
|
1494
1501
|
simplifyPluralSuffix: this.options.simplifyPluralSuffix
|
|
1495
|
-
}), 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
|
|
1502
|
+
}), 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 Be(this.options), i.utils = { hasLoadedNamespace: this.hasLoadedNamespace.bind(this) }, i.backendConnector = new Ke(r(this.modules.backend), i.resourceStore, i, this.options), i.backendConnector.on("*", (e, ...t) => {
|
|
1496
1503
|
this.emit(e, ...t);
|
|
1497
|
-
}), 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
|
|
1504
|
+
}), 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 Pe(this.services, this.options), this.translator.on("*", (e, ...t) => {
|
|
1498
1505
|
this.emit(e, ...t);
|
|
1499
1506
|
}), this.modules.external.forEach((e) => {
|
|
1500
1507
|
e.init && e.init(this);
|
|
1501
1508
|
});
|
|
1502
1509
|
}
|
|
1503
|
-
if (this.format = this.options.interpolation.format, t ||=
|
|
1510
|
+
if (this.format = this.options.interpolation.format, t ||= Z, this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) {
|
|
1504
1511
|
let e = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
|
|
1505
1512
|
e.length > 0 && e[0] !== "dev" && (this.options.lng = e[0]);
|
|
1506
1513
|
}
|
|
@@ -1519,7 +1526,7 @@ var J = {}, Y = (e) => !A(e) && typeof e != "boolean" && typeof e != "number", k
|
|
|
1519
1526
|
].forEach((e) => {
|
|
1520
1527
|
this[e] = (...t) => (this.store[e](...t), this);
|
|
1521
1528
|
});
|
|
1522
|
-
let i =
|
|
1529
|
+
let i = N(), a = () => {
|
|
1523
1530
|
let e = (e, n) => {
|
|
1524
1531
|
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);
|
|
1525
1532
|
};
|
|
@@ -1528,8 +1535,8 @@ var J = {}, Y = (e) => !A(e) && typeof e != "boolean" && typeof e != "number", k
|
|
|
1528
1535
|
};
|
|
1529
1536
|
return this.options.resources || !this.options.initAsync ? a() : setTimeout(a, 0), i;
|
|
1530
1537
|
}
|
|
1531
|
-
loadResources(e, t =
|
|
1532
|
-
let n = t, r =
|
|
1538
|
+
loadResources(e, t = Z) {
|
|
1539
|
+
let n = t, r = M(e) ? e : this.language;
|
|
1533
1540
|
if (typeof e == "function" && (n = e), !this.options.resources || this.options.partialBundledLanguages) {
|
|
1534
1541
|
if (r?.toLowerCase() === "cimode" && (!this.options.preload || this.options.preload.length === 0)) return n();
|
|
1535
1542
|
let e = [], t = (t) => {
|
|
@@ -1543,15 +1550,15 @@ var J = {}, Y = (e) => !A(e) && typeof e != "boolean" && typeof e != "number", k
|
|
|
1543
1550
|
} else n(null);
|
|
1544
1551
|
}
|
|
1545
1552
|
reloadResources(e, t, n) {
|
|
1546
|
-
let r =
|
|
1547
|
-
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 ||=
|
|
1553
|
+
let r = N();
|
|
1554
|
+
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 ||= Z, this.services.backendConnector.reload(e, t, (e) => {
|
|
1548
1555
|
r.resolve(), n(e);
|
|
1549
1556
|
}), r;
|
|
1550
1557
|
}
|
|
1551
1558
|
use(e) {
|
|
1552
1559
|
if (!e) throw Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");
|
|
1553
1560
|
if (!e.type) throw Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");
|
|
1554
|
-
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" &&
|
|
1561
|
+
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" && Ae.addPostProcessor(e), e.type === "formatter" && (this.modules.formatter = e), e.type === "3rdParty" && this.modules.external.push(e), this;
|
|
1555
1562
|
}
|
|
1556
1563
|
setResolvedLanguage(e) {
|
|
1557
1564
|
if (!(!e || !this.languages) && !(["cimode", "dev"].indexOf(e) > -1)) {
|
|
@@ -1567,7 +1574,7 @@ var J = {}, Y = (e) => !A(e) && typeof e != "boolean" && typeof e != "number", k
|
|
|
1567
1574
|
}
|
|
1568
1575
|
changeLanguage(e, t) {
|
|
1569
1576
|
this.isLanguageChangingTo = e;
|
|
1570
|
-
let n =
|
|
1577
|
+
let n = N();
|
|
1571
1578
|
this.emit("languageChanging", e);
|
|
1572
1579
|
let r = (e) => {
|
|
1573
1580
|
this.language = e, this.languages = this.services.languageUtils.toResolveHierarchy(e), this.resolvedLanguage = void 0, this.setResolvedLanguage(e);
|
|
@@ -1575,7 +1582,7 @@ var J = {}, Y = (e) => !A(e) && typeof e != "boolean" && typeof e != "number", k
|
|
|
1575
1582
|
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));
|
|
1576
1583
|
}, a = (t) => {
|
|
1577
1584
|
!e && !t && this.services.languageDetector && (t = []);
|
|
1578
|
-
let n =
|
|
1585
|
+
let n = M(t) ? t : t && t[0], a = this.store.hasLanguageSomeTranslations(n) ? n : this.services.languageUtils.getBestMatchFromCodes(M(t) ? [t] : t);
|
|
1579
1586
|
a && (this.language || r(a), this.translator.language || this.translator.changeLanguage(a), this.services.languageDetector?.cacheUserLanguage?.(a)), this.loadResources(a, (e) => {
|
|
1580
1587
|
i(e, a);
|
|
1581
1588
|
});
|
|
@@ -1594,7 +1601,7 @@ var J = {}, Y = (e) => !A(e) && typeof e != "boolean" && typeof e != "number", k
|
|
|
1594
1601
|
let s = this.options.keySeparator || ".", c;
|
|
1595
1602
|
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);
|
|
1596
1603
|
};
|
|
1597
|
-
return
|
|
1604
|
+
return M(e) ? r.lng = e : r.lngs = e, r.ns = t, r.keyPrefix = n, r;
|
|
1598
1605
|
}
|
|
1599
1606
|
t(...e) {
|
|
1600
1607
|
return this.translator?.translate(...e);
|
|
@@ -1621,16 +1628,16 @@ var J = {}, Y = (e) => !A(e) && typeof e != "boolean" && typeof e != "number", k
|
|
|
1621
1628
|
return !!(this.hasResourceBundle(n, e) || !this.services.backendConnector.backend || this.options.resources && !this.options.partialBundledLanguages || a(n, e) && (!r || a(i, e)));
|
|
1622
1629
|
}
|
|
1623
1630
|
loadNamespaces(e, t) {
|
|
1624
|
-
let n =
|
|
1625
|
-
return this.options.ns ? (
|
|
1631
|
+
let n = N();
|
|
1632
|
+
return this.options.ns ? (M(e) && (e = [e]), e.forEach((e) => {
|
|
1626
1633
|
this.options.ns.indexOf(e) < 0 && this.options.ns.push(e);
|
|
1627
1634
|
}), this.loadResources((e) => {
|
|
1628
1635
|
n.resolve(), t && t(e);
|
|
1629
1636
|
}), n) : (t && t(), Promise.resolve());
|
|
1630
1637
|
}
|
|
1631
1638
|
loadLanguages(e, t) {
|
|
1632
|
-
let n =
|
|
1633
|
-
|
|
1639
|
+
let n = N();
|
|
1640
|
+
M(e) && (e = [e]);
|
|
1634
1641
|
let r = this.options.preload || [], i = e.filter((e) => r.indexOf(e) < 0 && this.services.languageUtils.isSupportedCode(e));
|
|
1635
1642
|
return i.length ? (this.options.preload = r.concat(i), this.loadResources((e) => {
|
|
1636
1643
|
n.resolve(), t && t(e);
|
|
@@ -1645,14 +1652,14 @@ var J = {}, Y = (e) => !A(e) && typeof e != "boolean" && typeof e != "number", k
|
|
|
1645
1652
|
if (e && e.direction) return e.direction;
|
|
1646
1653
|
}
|
|
1647
1654
|
} catch {}
|
|
1648
|
-
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
|
|
1655
|
+
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 Fe(X());
|
|
1649
1656
|
return e.toLowerCase().indexOf("-latn") > 1 ? "ltr" : t.indexOf(n.getLanguagePartFromCode(e)) > -1 || e.toLowerCase().indexOf("-arab") > 1 ? "rtl" : "ltr";
|
|
1650
1657
|
}
|
|
1651
1658
|
static createInstance(t = {}, n) {
|
|
1652
1659
|
let r = new e(t, n);
|
|
1653
1660
|
return r.createInstance = e.createInstance, r;
|
|
1654
1661
|
}
|
|
1655
|
-
cloneInstance(t = {}, n =
|
|
1662
|
+
cloneInstance(t = {}, n = Z) {
|
|
1656
1663
|
let r = t.forkResourceStore;
|
|
1657
1664
|
r && delete t.forkResourceStore;
|
|
1658
1665
|
let i = {
|
|
@@ -1666,18 +1673,18 @@ var J = {}, Y = (e) => !A(e) && typeof e != "boolean" && typeof e != "number", k
|
|
|
1666
1673
|
"language"
|
|
1667
1674
|
].forEach((e) => {
|
|
1668
1675
|
a[e] = this[e];
|
|
1669
|
-
}), a.services = { ...this.services }, a.services.utils = { hasLoadedNamespace: a.hasLoadedNamespace.bind(a) }, r && (a.store = new
|
|
1676
|
+
}), a.services = { ...this.services }, a.services.utils = { hasLoadedNamespace: a.hasLoadedNamespace.bind(a) }, r && (a.store = new K(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) {
|
|
1670
1677
|
let e = {
|
|
1671
|
-
...
|
|
1678
|
+
...X().interpolation,
|
|
1672
1679
|
...this.options.interpolation,
|
|
1673
1680
|
...t.interpolation
|
|
1674
1681
|
}, n = {
|
|
1675
1682
|
...i,
|
|
1676
1683
|
interpolation: e
|
|
1677
1684
|
};
|
|
1678
|
-
a.services.interpolator = new
|
|
1685
|
+
a.services.interpolator = new Be(n);
|
|
1679
1686
|
}
|
|
1680
|
-
return a.translator = new
|
|
1687
|
+
return a.translator = new Pe(a.services, i), a.translator.on("*", (e, ...t) => {
|
|
1681
1688
|
a.emit(e, ...t);
|
|
1682
1689
|
}), a.init(i, n), a.translator.options = i, a.translator.backendConnector.services.utils = { hasLoadedNamespace: a.hasLoadedNamespace.bind(a) }, a;
|
|
1683
1690
|
}
|
|
@@ -1693,20 +1700,20 @@ var J = {}, Y = (e) => !A(e) && typeof e != "boolean" && typeof e != "number", k
|
|
|
1693
1700
|
}.createInstance();
|
|
1694
1701
|
//#endregion
|
|
1695
1702
|
//#region ../../shared/translator/dist/index.js
|
|
1696
|
-
|
|
1703
|
+
Q.createInstance, Q.dir, Q.init, Q.loadResources, Q.reloadResources, Q.use, Q.changeLanguage, Q.getFixedT, Q.t, Q.exists, Q.setDefaultNamespace, Q.hasLoadedNamespace, Q.loadNamespaces, Q.loadLanguages, Q.init({
|
|
1697
1704
|
fallbackLng: "en",
|
|
1698
1705
|
lng: "en",
|
|
1699
1706
|
showSupportNotice: !1,
|
|
1700
1707
|
resources: {
|
|
1701
|
-
en:
|
|
1702
|
-
es:
|
|
1708
|
+
en: _e,
|
|
1709
|
+
es: ve
|
|
1703
1710
|
}
|
|
1704
1711
|
});
|
|
1705
1712
|
//#endregion
|
|
1706
1713
|
//#region src/i18n.ts
|
|
1707
|
-
var { translator:
|
|
1714
|
+
var { translator: $ } = {
|
|
1708
1715
|
translator: {
|
|
1709
|
-
|
|
1716
|
+
...Q,
|
|
1710
1717
|
t: (e, t) => {
|
|
1711
1718
|
let { lng: n } = t;
|
|
1712
1719
|
switch (n) {
|
|
@@ -1722,7 +1729,7 @@ var { translator: Je } = {
|
|
|
1722
1729
|
break;
|
|
1723
1730
|
default: break;
|
|
1724
1731
|
}
|
|
1725
|
-
return
|
|
1732
|
+
return Q.t(e, {
|
|
1726
1733
|
lng: n,
|
|
1727
1734
|
...t
|
|
1728
1735
|
});
|
|
@@ -1736,13 +1743,13 @@ var { translator: Je } = {
|
|
|
1736
1743
|
label: "Spanish"
|
|
1737
1744
|
}]
|
|
1738
1745
|
};
|
|
1739
|
-
function
|
|
1740
|
-
return
|
|
1746
|
+
function $e(e, t) {
|
|
1747
|
+
return $.t(`translation:simpleCloze:${e}`, { lng: t });
|
|
1741
1748
|
}
|
|
1742
|
-
function
|
|
1743
|
-
return
|
|
1749
|
+
function et(e, t) {
|
|
1750
|
+
return $.t(`common:${e}`, { lng: t });
|
|
1744
1751
|
}
|
|
1745
1752
|
//#endregion
|
|
1746
|
-
export {
|
|
1753
|
+
export { et as n, j as r, $e as t };
|
|
1747
1754
|
|
|
1748
|
-
//# sourceMappingURL=i18n-
|
|
1755
|
+
//# sourceMappingURL=i18n-BTsdzpBv.js.map
|