@hortiview/default-components 1.0.1 → 1.2.0
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/README.md +22 -0
- package/dist/HealthCheckFailed-BfzG8Esl.js +46 -0
- package/dist/Iconify-DQUxnnUE.js +81 -0
- package/dist/{LoadingSpinner-BxqY1o89.js → LoadingSpinner-BCdWKiWZ.js} +8 -7
- package/dist/assets/GenericTable.css +1 -0
- package/dist/{component-DsB0poTj-B4NF-JCy.js → component-DsB0poTj-CmUZ4Kqw.js} +113 -73
- package/dist/components/DefaultFormNumber/DefaultFormNumber.js +527 -3443
- package/dist/components/DefaultLoadingSpinner/DefaultLoadingSpinner.js +5 -5
- package/dist/components/GenericTable/GenericTable.d.ts +12 -0
- package/dist/components/GenericTable/GenericTable.js +29900 -0
- package/dist/components/HealthChecks/DataBaseHealthCheck.js +4 -4
- package/dist/components/HealthChecks/DefaultHealthCheck.js +6 -6
- package/dist/components/HealthChecks/HealthCheck.test.js +5960 -7065
- package/dist/components/HealthChecks/IotServiceHealthCheck.js +4 -4
- package/dist/components/HealthChecks/PlatformHealthCheck.js +4 -4
- package/dist/components/ImpatienceLoadingSpinner/ImpatienceLoadingSpinner.js +6 -6
- package/dist/components/InternationalizationWrapper/InternationalizationWrapper.js +24 -6
- package/dist/context-f4Bcf4Hs.js +19 -0
- package/dist/{i18n-DIprVS_u.js → i18n-BhmFdUcK.js} +208 -250
- package/dist/i18n.js +3 -2
- package/dist/i18nInstance-l1IFPZ5d.js +48 -0
- package/dist/index.es-25EARqhH-By1Ap282.js +2944 -0
- package/dist/{HealthCheckFailed-j1XFU5px.js → index.es-6TJ1S8Jr-BFJPMGBn.js} +224 -257
- package/dist/index.es-D-CKRzIB-C6Z-ohcV.js +959 -0
- package/dist/locales/en-US.js +10 -8
- package/dist/locales/en-US.json.d.ts +15 -10
- package/dist/locales/es-MX.js +8 -6
- package/dist/locales/es-MX.json.d.ts +5 -2
- package/dist/locales/tr-TR.js +9 -7
- package/dist/locales/tr-TR.json.d.ts +5 -2
- package/dist/main.d.ts +1 -0
- package/dist/main.js +14 -12
- package/dist/{useTranslation-Bh0VR1ML.js → useTranslation-B6E1rHIA.js} +1259 -1106
- package/package.json +12 -12
- package/dist/InternationalizationWrapper-BtWuzVFG.js +0 -41
- package/dist/index.es-D-CKRzIB-Cv9zF1oG.js +0 -1029
- /package/dist/assets/{index.css → Iconify.css} +0 -0
- /package/dist/assets/{i18n.css → i18nInstance.css} +0 -0
|
@@ -1,84 +1,44 @@
|
|
|
1
|
+
import { s as ke, a as $e } from "./i18nInstance-l1IFPZ5d.js";
|
|
1
2
|
import Re from "./locales/en-US.js";
|
|
2
3
|
import Pe from "./locales/es-MX.js";
|
|
3
4
|
import Ne from "./locales/tr-TR.js";
|
|
4
|
-
|
|
5
|
+
const Ee = [
|
|
5
6
|
"en",
|
|
6
7
|
"es",
|
|
7
8
|
"tr"
|
|
8
9
|
// 'de' currently not supported
|
|
9
|
-
],
|
|
10
|
+
], pt = {
|
|
10
11
|
en: "en-US",
|
|
11
12
|
es: "es-MX",
|
|
12
13
|
tr: "tr-TR"
|
|
13
|
-
}, Fe =
|
|
14
|
-
"&": "&",
|
|
15
|
-
"&": "&",
|
|
16
|
-
"<": "<",
|
|
17
|
-
"<": "<",
|
|
18
|
-
">": ">",
|
|
19
|
-
">": ">",
|
|
20
|
-
"'": "'",
|
|
21
|
-
"'": "'",
|
|
22
|
-
""": '"',
|
|
23
|
-
""": '"',
|
|
24
|
-
" ": " ",
|
|
25
|
-
" ": " ",
|
|
26
|
-
"©": "©",
|
|
27
|
-
"©": "©",
|
|
28
|
-
"®": "®",
|
|
29
|
-
"®": "®",
|
|
30
|
-
"…": "…",
|
|
31
|
-
"…": "…",
|
|
32
|
-
"/": "/",
|
|
33
|
-
"/": "/"
|
|
34
|
-
}, Ie = (r) => De[r], je = (r) => r.replace(Fe, Ie);
|
|
35
|
-
let _ = {
|
|
36
|
-
bindI18n: "languageChanged",
|
|
37
|
-
bindI18nStore: "",
|
|
38
|
-
transEmptyNodeValue: "",
|
|
39
|
-
transSupportBasicHtmlNodes: !0,
|
|
40
|
-
transWrapTextNodes: "",
|
|
41
|
-
transKeepBasicHtmlNodesFor: ["br", "strong", "i", "p"],
|
|
42
|
-
useSuspense: !0,
|
|
43
|
-
unescape: je
|
|
44
|
-
};
|
|
45
|
-
const Ae = (r = {}) => {
|
|
46
|
-
_ = {
|
|
47
|
-
..._,
|
|
48
|
-
...r
|
|
49
|
-
};
|
|
50
|
-
}, wt = () => _;
|
|
51
|
-
let Oe;
|
|
52
|
-
const Te = (r) => {
|
|
53
|
-
Oe = r;
|
|
54
|
-
}, Ot = () => Oe, Ve = {
|
|
14
|
+
}, Fe = {
|
|
55
15
|
type: "3rdParty",
|
|
56
16
|
init(r) {
|
|
57
|
-
|
|
17
|
+
ke(r.options.react), $e(r);
|
|
58
18
|
}
|
|
59
|
-
},
|
|
19
|
+
}, c = (r) => typeof r == "string", H = () => {
|
|
60
20
|
let r, e;
|
|
61
21
|
const t = new Promise((n, s) => {
|
|
62
22
|
r = n, e = s;
|
|
63
23
|
});
|
|
64
24
|
return t.resolve = r, t.reject = e, t;
|
|
65
|
-
},
|
|
25
|
+
}, ie = (r) => r == null ? "" : "" + r, De = (r, e, t) => {
|
|
66
26
|
r.forEach((n) => {
|
|
67
27
|
e[n] && (t[n] = e[n]);
|
|
68
28
|
});
|
|
69
|
-
},
|
|
70
|
-
const n =
|
|
29
|
+
}, je = /###/g, re = (r) => r && r.indexOf("###") > -1 ? r.replace(je, ".") : r, ae = (r) => !r || c(r), z = (r, e, t) => {
|
|
30
|
+
const n = c(e) ? e.split(".") : e;
|
|
71
31
|
let s = 0;
|
|
72
32
|
for (; s < n.length - 1; ) {
|
|
73
|
-
if (
|
|
74
|
-
const i =
|
|
33
|
+
if (ae(r)) return {};
|
|
34
|
+
const i = re(n[s]);
|
|
75
35
|
!r[i] && t && (r[i] = new t()), Object.prototype.hasOwnProperty.call(r, i) ? r = r[i] : r = {}, ++s;
|
|
76
36
|
}
|
|
77
|
-
return
|
|
37
|
+
return ae(r) ? {} : {
|
|
78
38
|
obj: r,
|
|
79
|
-
k:
|
|
39
|
+
k: re(n[s])
|
|
80
40
|
};
|
|
81
|
-
},
|
|
41
|
+
}, oe = (r, e, t) => {
|
|
82
42
|
const {
|
|
83
43
|
obj: n,
|
|
84
44
|
k: s
|
|
@@ -91,7 +51,7 @@ const Te = (r) => {
|
|
|
91
51
|
for (; l.obj === void 0 && a.length; )
|
|
92
52
|
i = `${a[a.length - 1]}.${i}`, a = a.slice(0, a.length - 1), l = z(r, a, Object), l != null && l.obj && typeof l.obj[`${l.k}.${i}`] < "u" && (l.obj = void 0);
|
|
93
53
|
l.obj[`${l.k}.${i}`] = t;
|
|
94
|
-
},
|
|
54
|
+
}, Ie = (r, e, t, n) => {
|
|
95
55
|
const {
|
|
96
56
|
obj: s,
|
|
97
57
|
k: i
|
|
@@ -104,15 +64,15 @@ const Te = (r) => {
|
|
|
104
64
|
} = z(r, e);
|
|
105
65
|
if (t && Object.prototype.hasOwnProperty.call(t, n))
|
|
106
66
|
return t[n];
|
|
107
|
-
},
|
|
67
|
+
}, Ae = (r, e, t) => {
|
|
108
68
|
const n = Q(r, t);
|
|
109
69
|
return n !== void 0 ? n : Q(e, t);
|
|
110
|
-
},
|
|
70
|
+
}, we = (r, e, t) => {
|
|
111
71
|
for (const n in e)
|
|
112
|
-
n !== "__proto__" && n !== "constructor" && (n in r ?
|
|
72
|
+
n !== "__proto__" && n !== "constructor" && (n in r ? c(r[n]) || r[n] instanceof String || c(e[n]) || e[n] instanceof String ? t && (r[n] = e[n]) : we(r[n], e[n], t) : r[n] = e[n]);
|
|
113
73
|
return r;
|
|
114
|
-
},
|
|
115
|
-
var
|
|
74
|
+
}, j = (r) => r.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
|
|
75
|
+
var Te = {
|
|
116
76
|
"&": "&",
|
|
117
77
|
"<": "<",
|
|
118
78
|
">": ">",
|
|
@@ -120,8 +80,8 @@ var ze = {
|
|
|
120
80
|
"'": "'",
|
|
121
81
|
"/": "/"
|
|
122
82
|
};
|
|
123
|
-
const
|
|
124
|
-
class
|
|
83
|
+
const Ve = (r) => c(r) ? r.replace(/[&<>"'\/]/g, (e) => Te[e]) : r;
|
|
84
|
+
class Ue {
|
|
125
85
|
constructor(e) {
|
|
126
86
|
this.capacity = e, this.regExpMap = /* @__PURE__ */ new Map(), this.regExpQueue = [];
|
|
127
87
|
}
|
|
@@ -133,18 +93,18 @@ class Je {
|
|
|
133
93
|
return this.regExpQueue.length === this.capacity && this.regExpMap.delete(this.regExpQueue.shift()), this.regExpMap.set(e, n), this.regExpQueue.push(e), n;
|
|
134
94
|
}
|
|
135
95
|
}
|
|
136
|
-
const
|
|
96
|
+
const Ke = [" ", ",", "?", "!", ";"], Me = new Ue(20), He = (r, e, t) => {
|
|
137
97
|
e = e || "", t = t || "";
|
|
138
|
-
const n =
|
|
98
|
+
const n = Ke.filter((a) => e.indexOf(a) < 0 && t.indexOf(a) < 0);
|
|
139
99
|
if (n.length === 0) return !0;
|
|
140
|
-
const s =
|
|
100
|
+
const s = Me.getRegExp(`(${n.map((a) => a === "?" ? "\\?" : a).join("|")})`);
|
|
141
101
|
let i = !s.test(r);
|
|
142
102
|
if (!i) {
|
|
143
103
|
const a = r.indexOf(t);
|
|
144
104
|
a > 0 && !s.test(r.substring(0, a)) && (i = !0);
|
|
145
105
|
}
|
|
146
106
|
return i;
|
|
147
|
-
},
|
|
107
|
+
}, _ = function(r, e) {
|
|
148
108
|
let t = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : ".";
|
|
149
109
|
if (!r) return;
|
|
150
110
|
if (r[e])
|
|
@@ -165,7 +125,7 @@ const We = [" ", ",", "?", "!", ";"], Qe = new Je(20), qe = (r, e, t) => {
|
|
|
165
125
|
s = a;
|
|
166
126
|
}
|
|
167
127
|
return s;
|
|
168
|
-
},
|
|
128
|
+
}, Y = (r) => r == null ? void 0 : r.replace("_", "-"), ze = {
|
|
169
129
|
type: "logger",
|
|
170
130
|
log(r) {
|
|
171
131
|
this.output("log", r);
|
|
@@ -181,14 +141,14 @@ const We = [" ", ",", "?", "!", ";"], Qe = new Je(20), qe = (r, e, t) => {
|
|
|
181
141
|
(n = (t = console == null ? void 0 : console[r]) == null ? void 0 : t.apply) == null || n.call(t, console, e);
|
|
182
142
|
}
|
|
183
143
|
};
|
|
184
|
-
class
|
|
144
|
+
class q {
|
|
185
145
|
constructor(e) {
|
|
186
146
|
let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
187
147
|
this.init(e, t);
|
|
188
148
|
}
|
|
189
149
|
init(e) {
|
|
190
150
|
let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
191
|
-
this.prefix = t.prefix || "i18next:", this.logger = e ||
|
|
151
|
+
this.prefix = t.prefix || "i18next:", this.logger = e || ze, this.options = t, this.debug = t.debug;
|
|
192
152
|
}
|
|
193
153
|
log() {
|
|
194
154
|
for (var e = arguments.length, t = new Array(e), n = 0; n < e; n++)
|
|
@@ -211,19 +171,19 @@ class Y {
|
|
|
211
171
|
return this.forward(t, "warn", "WARNING DEPRECATED: ", !0);
|
|
212
172
|
}
|
|
213
173
|
forward(e, t, n, s) {
|
|
214
|
-
return s && !this.debug ? null : (
|
|
174
|
+
return s && !this.debug ? null : (c(e[0]) && (e[0] = `${n}${this.prefix} ${e[0]}`), this.logger[t](e));
|
|
215
175
|
}
|
|
216
176
|
create(e) {
|
|
217
|
-
return new
|
|
177
|
+
return new q(this.logger, {
|
|
218
178
|
prefix: `${this.prefix}:${e}:`,
|
|
219
179
|
...this.options
|
|
220
180
|
});
|
|
221
181
|
}
|
|
222
182
|
clone(e) {
|
|
223
|
-
return e = e || this.options, e.prefix = e.prefix || this.prefix, new
|
|
183
|
+
return e = e || this.options, e.prefix = e.prefix || this.prefix, new q(this.logger, e);
|
|
224
184
|
}
|
|
225
185
|
}
|
|
226
|
-
var P = new
|
|
186
|
+
var P = new q();
|
|
227
187
|
class Z {
|
|
228
188
|
constructor() {
|
|
229
189
|
this.observers = {};
|
|
@@ -258,7 +218,7 @@ class Z {
|
|
|
258
218
|
});
|
|
259
219
|
}
|
|
260
220
|
}
|
|
261
|
-
class
|
|
221
|
+
class le extends Z {
|
|
262
222
|
constructor(e) {
|
|
263
223
|
let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
|
|
264
224
|
ns: ["translation"],
|
|
@@ -278,9 +238,9 @@ class ue extends Z {
|
|
|
278
238
|
let s = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
|
|
279
239
|
const i = s.keySeparator !== void 0 ? s.keySeparator : this.options.keySeparator, a = s.ignoreJSONStructure !== void 0 ? s.ignoreJSONStructure : this.options.ignoreJSONStructure;
|
|
280
240
|
let l;
|
|
281
|
-
e.indexOf(".") > -1 ? l = e.split(".") : (l = [e, t], n && (Array.isArray(n) ? l.push(...n) :
|
|
241
|
+
e.indexOf(".") > -1 ? l = e.split(".") : (l = [e, t], n && (Array.isArray(n) ? l.push(...n) : c(n) && i ? l.push(...n.split(i)) : l.push(n)));
|
|
282
242
|
const o = Q(this.data, l);
|
|
283
|
-
return !o && !t && !n && e.indexOf(".") > -1 && (e = l[0], t = l[1], n = l.slice(2).join(".")), o || !a || !
|
|
243
|
+
return !o && !t && !n && e.indexOf(".") > -1 && (e = l[0], t = l[1], n = l.slice(2).join(".")), o || !a || !c(n) ? o : _((d = (u = this.data) == null ? void 0 : u[e]) == null ? void 0 : d[t], n, i);
|
|
284
244
|
}
|
|
285
245
|
addResource(e, t, n, s) {
|
|
286
246
|
let i = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : {
|
|
@@ -288,14 +248,14 @@ class ue extends Z {
|
|
|
288
248
|
};
|
|
289
249
|
const a = i.keySeparator !== void 0 ? i.keySeparator : this.options.keySeparator;
|
|
290
250
|
let l = [e, t];
|
|
291
|
-
n && (l = l.concat(a ? n.split(a) : n)), e.indexOf(".") > -1 && (l = e.split("."), s = t, t = l[1]), this.addNamespaces(t),
|
|
251
|
+
n && (l = l.concat(a ? n.split(a) : n)), e.indexOf(".") > -1 && (l = e.split("."), s = t, t = l[1]), this.addNamespaces(t), oe(this.data, l, s), i.silent || this.emit("added", e, t, n, s);
|
|
292
252
|
}
|
|
293
253
|
addResources(e, t, n) {
|
|
294
254
|
let s = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {
|
|
295
255
|
silent: !1
|
|
296
256
|
};
|
|
297
257
|
for (const i in n)
|
|
298
|
-
(
|
|
258
|
+
(c(n[i]) || Array.isArray(n[i])) && this.addResource(e, t, i, n[i], {
|
|
299
259
|
silent: !0
|
|
300
260
|
});
|
|
301
261
|
s.silent || this.emit("added", e, t, n);
|
|
@@ -307,10 +267,10 @@ class ue extends Z {
|
|
|
307
267
|
}, l = [e, t];
|
|
308
268
|
e.indexOf(".") > -1 && (l = e.split("."), s = n, n = t, t = l[1]), this.addNamespaces(t);
|
|
309
269
|
let o = Q(this.data, l) || {};
|
|
310
|
-
a.skipCopy || (n = JSON.parse(JSON.stringify(n))), s ?
|
|
270
|
+
a.skipCopy || (n = JSON.parse(JSON.stringify(n))), s ? we(o, n, i) : o = {
|
|
311
271
|
...o,
|
|
312
272
|
...n
|
|
313
|
-
},
|
|
273
|
+
}, oe(this.data, l, o), a.silent || this.emit("added", e, t, n);
|
|
314
274
|
}
|
|
315
275
|
removeResourceBundle(e, t) {
|
|
316
276
|
this.hasResourceBundle(e, t) && delete this.data[e][t], this.removeNamespaces(t), this.emit("removed", e, t);
|
|
@@ -332,7 +292,7 @@ class ue extends Z {
|
|
|
332
292
|
return this.data;
|
|
333
293
|
}
|
|
334
294
|
}
|
|
335
|
-
var
|
|
295
|
+
var Oe = {
|
|
336
296
|
processors: {},
|
|
337
297
|
addPostProcessor(r) {
|
|
338
298
|
this.processors[r.name] = r;
|
|
@@ -344,11 +304,11 @@ var ve = {
|
|
|
344
304
|
}), e;
|
|
345
305
|
}
|
|
346
306
|
};
|
|
347
|
-
const
|
|
307
|
+
const ue = {}, fe = (r) => !c(r) && typeof r != "boolean" && typeof r != "number";
|
|
348
308
|
class G extends Z {
|
|
349
309
|
constructor(e) {
|
|
350
310
|
let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
351
|
-
super(),
|
|
311
|
+
super(), De(["resourceStore", "languageUtils", "pluralResolver", "interpolator", "backendConnector", "i18nFormat", "utils"], e, this), this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.logger = P.create("translator");
|
|
352
312
|
}
|
|
353
313
|
changeLanguage(e) {
|
|
354
314
|
e && (this.language = e);
|
|
@@ -367,20 +327,20 @@ class G extends Z {
|
|
|
367
327
|
n === void 0 && (n = ":");
|
|
368
328
|
const s = t.keySeparator !== void 0 ? t.keySeparator : this.options.keySeparator;
|
|
369
329
|
let i = t.ns || this.options.defaultNS || [];
|
|
370
|
-
const a = n && e.indexOf(n) > -1, l = !this.options.userDefinedKeySeparator && !t.keySeparator && !this.options.userDefinedNsSeparator && !t.nsSeparator && !
|
|
330
|
+
const a = n && e.indexOf(n) > -1, l = !this.options.userDefinedKeySeparator && !t.keySeparator && !this.options.userDefinedNsSeparator && !t.nsSeparator && !He(e, n, s);
|
|
371
331
|
if (a && !l) {
|
|
372
332
|
const o = e.match(this.interpolator.nestingRegexp);
|
|
373
333
|
if (o && o.length > 0)
|
|
374
334
|
return {
|
|
375
335
|
key: e,
|
|
376
|
-
namespaces:
|
|
336
|
+
namespaces: c(i) ? [i] : i
|
|
377
337
|
};
|
|
378
338
|
const u = e.split(n);
|
|
379
339
|
(n !== s || n === s && this.options.ns.indexOf(u[0]) > -1) && (i = u.shift()), e = u.join(s);
|
|
380
340
|
}
|
|
381
341
|
return {
|
|
382
342
|
key: e,
|
|
383
|
-
namespaces:
|
|
343
|
+
namespaces: c(i) ? [i] : i
|
|
384
344
|
};
|
|
385
345
|
}
|
|
386
346
|
translate(e, t, n) {
|
|
@@ -413,31 +373,31 @@ class G extends Z {
|
|
|
413
373
|
usedParams: this.getUsedParamsDetails(t)
|
|
414
374
|
} : a;
|
|
415
375
|
}
|
|
416
|
-
const
|
|
417
|
-
let f =
|
|
418
|
-
const m = (
|
|
376
|
+
const h = this.resolve(e, t);
|
|
377
|
+
let f = h == null ? void 0 : h.res;
|
|
378
|
+
const m = (h == null ? void 0 : h.usedKey) || a, g = (h == null ? void 0 : h.exactUsedKey) || a, p = ["[object Number]", "[object Function]", "[object RegExp]"], x = t.joinArrays !== void 0 ? t.joinArrays : this.options.joinArrays, b = !this.i18nFormat || this.i18nFormat.handleAsObject, w = t.count !== void 0 && !c(t.count), $ = G.hasDefaultValue(t), C = w ? this.pluralResolver.getSuffix(u, t.count, t) : "", V = t.ordinal && w ? this.pluralResolver.getSuffix(u, t.count, {
|
|
419
379
|
ordinal: !1
|
|
420
380
|
}) : "", U = w && !t.ordinal && t.count === 0, y = U && t[`defaultValue${this.options.pluralSeparator}zero`] || t[`defaultValue${C}`] || t[`defaultValue${V}`] || t.defaultValue;
|
|
421
381
|
let O = f;
|
|
422
382
|
b && !f && $ && (O = y);
|
|
423
|
-
const F =
|
|
424
|
-
if (b && O && F && p.indexOf(D) < 0 && !(
|
|
383
|
+
const F = fe(O), D = Object.prototype.toString.apply(O);
|
|
384
|
+
if (b && O && F && p.indexOf(D) < 0 && !(c(x) && Array.isArray(O))) {
|
|
425
385
|
if (!t.returnObjects && !this.options.returnObjects) {
|
|
426
386
|
this.options.returnedObjectHandler || this.logger.warn("accessing an object - but returnObjects options is not enabled!");
|
|
427
387
|
const L = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(m, O, {
|
|
428
388
|
...t,
|
|
429
389
|
ns: l
|
|
430
390
|
}) : `key '${a} (${this.language})' returned an object instead of string.`;
|
|
431
|
-
return s ? (
|
|
391
|
+
return s ? (h.res = L, h.usedParams = this.getUsedParamsDetails(t), h) : L;
|
|
432
392
|
}
|
|
433
393
|
if (i) {
|
|
434
|
-
const L = Array.isArray(O), k = L ? [] : {},
|
|
394
|
+
const L = Array.isArray(O), k = L ? [] : {}, ee = L ? g : m;
|
|
435
395
|
for (const R in O)
|
|
436
396
|
if (Object.prototype.hasOwnProperty.call(O, R)) {
|
|
437
|
-
const N = `${
|
|
397
|
+
const N = `${ee}${i}${R}`;
|
|
438
398
|
$ && !f ? k[R] = this.translate(N, {
|
|
439
399
|
...t,
|
|
440
|
-
defaultValue:
|
|
400
|
+
defaultValue: fe(y) ? y[R] : void 0,
|
|
441
401
|
joinArrays: !1,
|
|
442
402
|
ns: l
|
|
443
403
|
}) : k[R] = this.translate(N, {
|
|
@@ -448,7 +408,7 @@ class G extends Z {
|
|
|
448
408
|
}
|
|
449
409
|
f = k;
|
|
450
410
|
}
|
|
451
|
-
} else if (b &&
|
|
411
|
+
} else if (b && c(x) && Array.isArray(f))
|
|
452
412
|
f = f.join(x), f && (f = this.extendTranslation(f, e, t, n));
|
|
453
413
|
else {
|
|
454
414
|
let L = !1, k = !1;
|
|
@@ -468,21 +428,21 @@ class G extends Z {
|
|
|
468
428
|
for (let v = 0; v < J.length; v++)
|
|
469
429
|
K.push(J[v]);
|
|
470
430
|
else this.options.saveMissingTo === "all" ? K = this.languageUtils.toResolveHierarchy(t.lng || this.language) : K.push(t.lng || this.language);
|
|
471
|
-
const
|
|
472
|
-
var
|
|
473
|
-
const
|
|
474
|
-
this.options.missingKeyHandler ? this.options.missingKeyHandler(v, o, E,
|
|
431
|
+
const te = (v, E, M) => {
|
|
432
|
+
var se;
|
|
433
|
+
const ne = $ && M !== f ? M : R;
|
|
434
|
+
this.options.missingKeyHandler ? this.options.missingKeyHandler(v, o, E, ne, N, t) : (se = this.backendConnector) != null && se.saveMissing && this.backendConnector.saveMissing(v, o, E, ne, N, t), this.emit("missingKey", v, o, E, f);
|
|
475
435
|
};
|
|
476
436
|
this.options.saveMissing && (this.options.saveMissingPlurals && w ? K.forEach((v) => {
|
|
477
437
|
const E = this.pluralResolver.getSuffixes(v, t);
|
|
478
438
|
U && t[`defaultValue${this.options.pluralSeparator}zero`] && E.indexOf(`${this.options.pluralSeparator}zero`) < 0 && E.push(`${this.options.pluralSeparator}zero`), E.forEach((M) => {
|
|
479
|
-
|
|
439
|
+
te([v], a + M, t[`defaultValue${M}`] || y);
|
|
480
440
|
});
|
|
481
|
-
}) :
|
|
441
|
+
}) : te(K, a, y));
|
|
482
442
|
}
|
|
483
|
-
f = this.extendTranslation(f, e, t,
|
|
443
|
+
f = this.extendTranslation(f, e, t, h, n), k && f === a && this.options.appendNamespaceToMissingKey && (f = `${o}:${a}`), (k || L) && this.options.parseMissingKeyHandler && (f = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${o}:${a}` : a, L ? f : void 0));
|
|
484
444
|
}
|
|
485
|
-
return s ? (
|
|
445
|
+
return s ? (h.res = f, h.usedParams = this.getUsedParamsDetails(t), h) : f;
|
|
486
446
|
}
|
|
487
447
|
extendTranslation(e, t, n, s, i) {
|
|
488
448
|
var u, d;
|
|
@@ -502,17 +462,17 @@ class G extends Z {
|
|
|
502
462
|
...n.interpolation
|
|
503
463
|
}
|
|
504
464
|
});
|
|
505
|
-
const
|
|
465
|
+
const h = c(e) && (((d = n == null ? void 0 : n.interpolation) == null ? void 0 : d.skipOnVariables) !== void 0 ? n.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables);
|
|
506
466
|
let f;
|
|
507
|
-
if (
|
|
467
|
+
if (h) {
|
|
508
468
|
const g = e.match(this.interpolator.nestingRegexp);
|
|
509
469
|
f = g && g.length;
|
|
510
470
|
}
|
|
511
|
-
let m = n.replace && !
|
|
471
|
+
let m = n.replace && !c(n.replace) ? n.replace : n;
|
|
512
472
|
if (this.options.interpolation.defaultVariables && (m = {
|
|
513
473
|
...this.options.interpolation.defaultVariables,
|
|
514
474
|
...m
|
|
515
|
-
}), e = this.interpolator.interpolate(e, m, n.lng || this.language || s.usedLng, n),
|
|
475
|
+
}), e = this.interpolator.interpolate(e, m, n.lng || this.language || s.usedLng, n), h) {
|
|
516
476
|
const g = e.match(this.interpolator.nestingRegexp), p = g && g.length;
|
|
517
477
|
f < p && (n.nest = !1);
|
|
518
478
|
}
|
|
@@ -522,8 +482,8 @@ class G extends Z {
|
|
|
522
482
|
return (i == null ? void 0 : i[0]) === p[0] && !n.context ? (a.logger.warn(`It seems you are nesting recursively key: ${p[0]} in key: ${t[0]}`), null) : a.translate(...p, t);
|
|
523
483
|
}, n)), n.interpolation && this.interpolator.reset();
|
|
524
484
|
}
|
|
525
|
-
const l = n.postProcess || this.options.postProcess, o =
|
|
526
|
-
return e != null && (o != null && o.length) && n.applyPostProcessor !== !1 && (e =
|
|
485
|
+
const l = n.postProcess || this.options.postProcess, o = c(l) ? [l] : l;
|
|
486
|
+
return e != null && (o != null && o.length) && n.applyPostProcessor !== !1 && (e = Oe.handle(o, e, t, this.options && this.options.postProcessPassResolved ? {
|
|
527
487
|
i18nResolved: {
|
|
528
488
|
...s,
|
|
529
489
|
usedParams: this.getUsedParamsDetails(n)
|
|
@@ -533,16 +493,16 @@ class G extends Z {
|
|
|
533
493
|
}
|
|
534
494
|
resolve(e) {
|
|
535
495
|
let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, n, s, i, a, l;
|
|
536
|
-
return
|
|
496
|
+
return c(e) && (e = [e]), e.forEach((o) => {
|
|
537
497
|
if (this.isValidLookup(n)) return;
|
|
538
498
|
const u = this.extractFromKey(o, t), d = u.key;
|
|
539
499
|
s = d;
|
|
540
|
-
let
|
|
541
|
-
this.options.fallbackNS && (
|
|
542
|
-
const f = t.count !== void 0 && !
|
|
543
|
-
|
|
500
|
+
let h = u.namespaces;
|
|
501
|
+
this.options.fallbackNS && (h = h.concat(this.options.fallbackNS));
|
|
502
|
+
const f = t.count !== void 0 && !c(t.count), m = f && !t.ordinal && t.count === 0, g = t.context !== void 0 && (c(t.context) || typeof t.context == "number") && t.context !== "", p = t.lngs ? t.lngs : this.languageUtils.toResolveHierarchy(t.lng || this.language, t.fallbackLng);
|
|
503
|
+
h.forEach((x) => {
|
|
544
504
|
var b, w;
|
|
545
|
-
this.isValidLookup(n) || (l = x, !
|
|
505
|
+
this.isValidLookup(n) || (l = x, !ue[`${p[0]}-${x}`] && ((b = this.utils) != null && b.hasLoadedNamespace) && !((w = this.utils) != null && w.hasLoadedNamespace(l)) && (ue[`${p[0]}-${x}`] = !0, this.logger.warn(`key "${s}" for languages "${p.join(", ")}" won't get resolved as namespace "${l}" 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(($) => {
|
|
546
506
|
var U;
|
|
547
507
|
if (this.isValidLookup(n)) return;
|
|
548
508
|
a = $;
|
|
@@ -581,7 +541,7 @@ class G extends Z {
|
|
|
581
541
|
}
|
|
582
542
|
getUsedParamsDetails() {
|
|
583
543
|
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
584
|
-
const t = ["defaultValue", "ordinal", "context", "replace", "lng", "lngs", "fallbackLng", "ns", "keySeparator", "nsSeparator", "returnObjects", "returnDetails", "joinArrays", "postProcess", "interpolation"], n = e.replace && !
|
|
544
|
+
const t = ["defaultValue", "ordinal", "context", "replace", "lng", "lngs", "fallbackLng", "ns", "keySeparator", "nsSeparator", "returnObjects", "returnDetails", "joinArrays", "postProcess", "interpolation"], n = e.replace && !c(e.replace);
|
|
585
545
|
let s = n ? e.replace : e;
|
|
586
546
|
if (n && typeof e.count < "u" && (s.count = e.count), this.options.interpolation.defaultVariables && (s = {
|
|
587
547
|
...this.options.interpolation.defaultVariables,
|
|
@@ -603,22 +563,22 @@ class G extends Z {
|
|
|
603
563
|
return !1;
|
|
604
564
|
}
|
|
605
565
|
}
|
|
606
|
-
class
|
|
566
|
+
class de {
|
|
607
567
|
constructor(e) {
|
|
608
568
|
this.options = e, this.supportedLngs = this.options.supportedLngs || !1, this.logger = P.create("languageUtils");
|
|
609
569
|
}
|
|
610
570
|
getScriptPartFromCode(e) {
|
|
611
|
-
if (e =
|
|
571
|
+
if (e = Y(e), !e || e.indexOf("-") < 0) return null;
|
|
612
572
|
const t = e.split("-");
|
|
613
573
|
return t.length === 2 || (t.pop(), t[t.length - 1].toLowerCase() === "x") ? null : this.formatLanguageCode(t.join("-"));
|
|
614
574
|
}
|
|
615
575
|
getLanguagePartFromCode(e) {
|
|
616
|
-
if (e =
|
|
576
|
+
if (e = Y(e), !e || e.indexOf("-") < 0) return e;
|
|
617
577
|
const t = e.split("-");
|
|
618
578
|
return this.formatLanguageCode(t[0]);
|
|
619
579
|
}
|
|
620
580
|
formatLanguageCode(e) {
|
|
621
|
-
if (
|
|
581
|
+
if (c(e) && e.indexOf("-") > -1) {
|
|
622
582
|
let t;
|
|
623
583
|
try {
|
|
624
584
|
t = Intl.getCanonicalLocales(e)[0];
|
|
@@ -651,7 +611,7 @@ class ce {
|
|
|
651
611
|
}
|
|
652
612
|
getFallbackCodes(e, t) {
|
|
653
613
|
if (!e) return [];
|
|
654
|
-
if (typeof e == "function" && (e = e(t)),
|
|
614
|
+
if (typeof e == "function" && (e = e(t)), c(e) && (e = [e]), Array.isArray(e)) return e;
|
|
655
615
|
if (!t) return e.default || [];
|
|
656
616
|
let n = e[t];
|
|
657
617
|
return n || (n = e[this.getScriptPartFromCode(t)]), n || (n = e[this.formatLanguageCode(t)]), n || (n = e[this.getLanguagePartFromCode(t)]), n || (n = e.default), n || [];
|
|
@@ -660,25 +620,25 @@ class ce {
|
|
|
660
620
|
const n = this.getFallbackCodes(t || this.options.fallbackLng || [], e), s = [], i = (a) => {
|
|
661
621
|
a && (this.isSupportedCode(a) ? s.push(a) : this.logger.warn(`rejecting language code not found in supportedLngs: ${a}`));
|
|
662
622
|
};
|
|
663
|
-
return
|
|
623
|
+
return c(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))) : c(e) && i(this.formatLanguageCode(e)), n.forEach((a) => {
|
|
664
624
|
s.indexOf(a) < 0 && i(this.formatLanguageCode(a));
|
|
665
625
|
}), s;
|
|
666
626
|
}
|
|
667
627
|
}
|
|
668
|
-
const
|
|
628
|
+
const he = {
|
|
669
629
|
zero: 0,
|
|
670
630
|
one: 1,
|
|
671
631
|
two: 2,
|
|
672
632
|
few: 3,
|
|
673
633
|
many: 4,
|
|
674
634
|
other: 5
|
|
675
|
-
},
|
|
635
|
+
}, ge = {
|
|
676
636
|
select: (r) => r === 1 ? "one" : "other",
|
|
677
637
|
resolvedOptions: () => ({
|
|
678
638
|
pluralCategories: ["one", "other"]
|
|
679
639
|
})
|
|
680
640
|
};
|
|
681
|
-
class
|
|
641
|
+
class Be {
|
|
682
642
|
constructor(e) {
|
|
683
643
|
let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
684
644
|
this.languageUtils = e, this.options = t, this.logger = P.create("pluralResolver"), this.pluralRulesCache = {};
|
|
@@ -691,7 +651,7 @@ class Ge {
|
|
|
691
651
|
}
|
|
692
652
|
getRule(e) {
|
|
693
653
|
let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
694
|
-
const n =
|
|
654
|
+
const n = Y(e === "dev" ? "en" : e), s = t.ordinal ? "ordinal" : "cardinal", i = JSON.stringify({
|
|
695
655
|
cleanedCode: n,
|
|
696
656
|
type: s
|
|
697
657
|
});
|
|
@@ -704,8 +664,8 @@ class Ge {
|
|
|
704
664
|
});
|
|
705
665
|
} catch {
|
|
706
666
|
if (!Intl)
|
|
707
|
-
return this.logger.error("No Intl support, please use an Intl polyfill!"),
|
|
708
|
-
if (!e.match(/-|_/)) return
|
|
667
|
+
return this.logger.error("No Intl support, please use an Intl polyfill!"), ge;
|
|
668
|
+
if (!e.match(/-|_/)) return ge;
|
|
709
669
|
const o = this.languageUtils.getLanguagePartFromCode(e);
|
|
710
670
|
a = this.getRule(o, t);
|
|
711
671
|
}
|
|
@@ -721,7 +681,7 @@ class Ge {
|
|
|
721
681
|
}
|
|
722
682
|
getSuffixes(e) {
|
|
723
683
|
let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, n = this.getRule(e, t);
|
|
724
|
-
return n || (n = this.getRule("dev", t)), n ? n.resolvedOptions().pluralCategories.sort((s, i) =>
|
|
684
|
+
return n || (n = this.getRule("dev", t)), n ? n.resolvedOptions().pluralCategories.sort((s, i) => he[s] - he[i]).map((s) => `${this.options.prepend}${t.ordinal ? `ordinal${this.options.prepend}` : ""}${s}`) : [];
|
|
725
685
|
}
|
|
726
686
|
getSuffix(e, t) {
|
|
727
687
|
let n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
@@ -729,11 +689,11 @@ class Ge {
|
|
|
729
689
|
return s ? `${this.options.prepend}${n.ordinal ? `ordinal${this.options.prepend}` : ""}${s.select(t)}` : (this.logger.warn(`no plural rule found for: ${e}`), this.getSuffix("dev", t, n));
|
|
730
690
|
}
|
|
731
691
|
}
|
|
732
|
-
const
|
|
733
|
-
let n = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : ".", s = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : !0, i =
|
|
734
|
-
return !i && s &&
|
|
692
|
+
const ce = function(r, e, t) {
|
|
693
|
+
let n = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : ".", s = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : !0, i = Ae(r, e, t);
|
|
694
|
+
return !i && s && c(t) && (i = _(r, t, n), i === void 0 && (i = _(e, t, n))), i;
|
|
735
695
|
}, X = (r) => r.replace(/\$/g, "$$$$");
|
|
736
|
-
class
|
|
696
|
+
class Je {
|
|
737
697
|
constructor() {
|
|
738
698
|
var t;
|
|
739
699
|
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
@@ -754,7 +714,7 @@ class Ze {
|
|
|
754
714
|
suffixEscaped: o,
|
|
755
715
|
formatSeparator: u,
|
|
756
716
|
unescapeSuffix: d,
|
|
757
|
-
unescapePrefix:
|
|
717
|
+
unescapePrefix: h,
|
|
758
718
|
nestingPrefix: f,
|
|
759
719
|
nestingPrefixEscaped: m,
|
|
760
720
|
nestingSuffix: g,
|
|
@@ -763,7 +723,7 @@ class Ze {
|
|
|
763
723
|
maxReplaces: b,
|
|
764
724
|
alwaysFormat: w
|
|
765
725
|
} = e.interpolation;
|
|
766
|
-
this.escape = t !== void 0 ? t :
|
|
726
|
+
this.escape = t !== void 0 ? t : Ve, this.escapeValue = n !== void 0 ? n : !0, this.useRawValueToEscape = s !== void 0 ? s : !1, this.prefix = i ? j(i) : a || "{{", this.suffix = l ? j(l) : o || "}}", this.formatSeparator = u || ",", this.unescapePrefix = d ? "" : h || "-", this.unescapeSuffix = this.unescapePrefix ? "" : d || "", this.nestingPrefix = f ? j(f) : m || j("$t("), this.nestingSuffix = g ? j(g) : p || j(")"), this.nestingOptionsSeparator = x || ",", this.maxReplaces = b || 1e3, this.alwaysFormat = w !== void 0 ? w : !1, this.resetRegExp();
|
|
767
727
|
}
|
|
768
728
|
reset() {
|
|
769
729
|
this.options && this.init(this.options);
|
|
@@ -777,7 +737,7 @@ class Ze {
|
|
|
777
737
|
let i, a, l;
|
|
778
738
|
const o = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {}, u = (g) => {
|
|
779
739
|
if (g.indexOf(this.formatSeparator) < 0) {
|
|
780
|
-
const w =
|
|
740
|
+
const w = ce(t, o, g, this.options.keySeparator, this.options.ignoreJSONStructure);
|
|
781
741
|
return this.alwaysFormat ? this.format(w, void 0, n, {
|
|
782
742
|
...s,
|
|
783
743
|
...t,
|
|
@@ -785,14 +745,14 @@ class Ze {
|
|
|
785
745
|
}) : w;
|
|
786
746
|
}
|
|
787
747
|
const p = g.split(this.formatSeparator), x = p.shift().trim(), b = p.join(this.formatSeparator).trim();
|
|
788
|
-
return this.format(
|
|
748
|
+
return this.format(ce(t, o, x, this.options.keySeparator, this.options.ignoreJSONStructure), b, n, {
|
|
789
749
|
...s,
|
|
790
750
|
...t,
|
|
791
751
|
interpolationkey: x
|
|
792
752
|
});
|
|
793
753
|
};
|
|
794
754
|
this.resetRegExp();
|
|
795
|
-
const d = (s == null ? void 0 : s.missingInterpolationHandler) || this.options.missingInterpolationHandler,
|
|
755
|
+
const d = (s == null ? void 0 : s.missingInterpolationHandler) || this.options.missingInterpolationHandler, h = ((m = s == null ? void 0 : s.interpolation) == null ? void 0 : m.skipOnVariables) !== void 0 ? s.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables;
|
|
796
756
|
return [{
|
|
797
757
|
regex: this.regexpUnescape,
|
|
798
758
|
safeValue: (g) => X(g)
|
|
@@ -805,17 +765,17 @@ class Ze {
|
|
|
805
765
|
if (a = u(p), a === void 0)
|
|
806
766
|
if (typeof d == "function") {
|
|
807
767
|
const b = d(e, i, s);
|
|
808
|
-
a =
|
|
768
|
+
a = c(b) ? b : "";
|
|
809
769
|
} else if (s && Object.prototype.hasOwnProperty.call(s, p))
|
|
810
770
|
a = "";
|
|
811
|
-
else if (
|
|
771
|
+
else if (h) {
|
|
812
772
|
a = i[0];
|
|
813
773
|
continue;
|
|
814
774
|
} else
|
|
815
775
|
this.logger.warn(`missed to pass in variable ${p} for interpolating ${e}`), a = "";
|
|
816
|
-
else !
|
|
776
|
+
else !c(a) && !this.useRawValueToEscape && (a = ie(a));
|
|
817
777
|
const x = g.safeValue(a);
|
|
818
|
-
if (e = e.replace(i[0], x),
|
|
778
|
+
if (e = e.replace(i[0], x), h ? (g.regex.lastIndex += a.length, g.regex.lastIndex -= i[0].length) : g.regex.lastIndex = 0, l++, l >= this.maxReplaces)
|
|
819
779
|
break;
|
|
820
780
|
}
|
|
821
781
|
}), e;
|
|
@@ -825,9 +785,9 @@ class Ze {
|
|
|
825
785
|
const l = (o, u) => {
|
|
826
786
|
const d = this.nestingOptionsSeparator;
|
|
827
787
|
if (o.indexOf(d) < 0) return o;
|
|
828
|
-
const
|
|
829
|
-
let f = `{${
|
|
830
|
-
o =
|
|
788
|
+
const h = o.split(new RegExp(`${d}[ ]*{`));
|
|
789
|
+
let f = `{${h[1]}`;
|
|
790
|
+
o = h[0], f = this.interpolate(f, a);
|
|
831
791
|
const m = f.match(/'/g), g = f.match(/"/g);
|
|
832
792
|
(((m == null ? void 0 : m.length) ?? 0) % 2 === 0 && !g || g.length % 2 !== 0) && (f = f.replace(/'/g, '"'));
|
|
833
793
|
try {
|
|
@@ -844,14 +804,14 @@ class Ze {
|
|
|
844
804
|
let o = [];
|
|
845
805
|
a = {
|
|
846
806
|
...n
|
|
847
|
-
}, a = a.replace && !
|
|
807
|
+
}, a = a.replace && !c(a.replace) ? a.replace : a, a.applyPostProcessor = !1, delete a.defaultValue;
|
|
848
808
|
let u = !1;
|
|
849
809
|
if (s[0].indexOf(this.formatSeparator) !== -1 && !/{.*}/.test(s[1])) {
|
|
850
|
-
const d = s[1].split(this.formatSeparator).map((
|
|
810
|
+
const d = s[1].split(this.formatSeparator).map((h) => h.trim());
|
|
851
811
|
s[1] = d.shift(), o = d, u = !0;
|
|
852
812
|
}
|
|
853
|
-
if (i = t(l.call(this, s[1].trim(), a), a), i && s[0] === e && !
|
|
854
|
-
|
|
813
|
+
if (i = t(l.call(this, s[1].trim(), a), a), i && s[0] === e && !c(i)) return i;
|
|
814
|
+
c(i) || (i = ie(i)), i || (this.logger.warn(`missed to resolve ${s[1]} for nesting ${e}`), i = ""), u && (i = o.reduce((d, h) => this.format(d, h, n.lng, {
|
|
855
815
|
...n,
|
|
856
816
|
interpolationkey: s[1].trim()
|
|
857
817
|
}), i.trim())), e = e.replace(s[0], i), this.regexp.lastIndex = 0;
|
|
@@ -859,7 +819,7 @@ class Ze {
|
|
|
859
819
|
return e;
|
|
860
820
|
}
|
|
861
821
|
}
|
|
862
|
-
const
|
|
822
|
+
const We = (r) => {
|
|
863
823
|
let e = r.toLowerCase().trim();
|
|
864
824
|
const t = {};
|
|
865
825
|
if (r.indexOf("(") > -1) {
|
|
@@ -877,7 +837,7 @@ const Xe = (r) => {
|
|
|
877
837
|
formatName: e,
|
|
878
838
|
formatOptions: t
|
|
879
839
|
};
|
|
880
|
-
},
|
|
840
|
+
}, I = (r) => {
|
|
881
841
|
const e = {};
|
|
882
842
|
return (t, n, s) => {
|
|
883
843
|
let i = s;
|
|
@@ -887,39 +847,39 @@ const Xe = (r) => {
|
|
|
887
847
|
});
|
|
888
848
|
const a = n + JSON.stringify(i);
|
|
889
849
|
let l = e[a];
|
|
890
|
-
return l || (l = r(
|
|
850
|
+
return l || (l = r(Y(n), s), e[a] = l), l(t);
|
|
891
851
|
};
|
|
892
852
|
};
|
|
893
|
-
class
|
|
853
|
+
class Qe {
|
|
894
854
|
constructor() {
|
|
895
855
|
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
896
856
|
this.logger = P.create("formatter"), this.options = e, this.formats = {
|
|
897
|
-
number:
|
|
857
|
+
number: I((t, n) => {
|
|
898
858
|
const s = new Intl.NumberFormat(t, {
|
|
899
859
|
...n
|
|
900
860
|
});
|
|
901
861
|
return (i) => s.format(i);
|
|
902
862
|
}),
|
|
903
|
-
currency:
|
|
863
|
+
currency: I((t, n) => {
|
|
904
864
|
const s = new Intl.NumberFormat(t, {
|
|
905
865
|
...n,
|
|
906
866
|
style: "currency"
|
|
907
867
|
});
|
|
908
868
|
return (i) => s.format(i);
|
|
909
869
|
}),
|
|
910
|
-
datetime:
|
|
870
|
+
datetime: I((t, n) => {
|
|
911
871
|
const s = new Intl.DateTimeFormat(t, {
|
|
912
872
|
...n
|
|
913
873
|
});
|
|
914
874
|
return (i) => s.format(i);
|
|
915
875
|
}),
|
|
916
|
-
relativetime:
|
|
876
|
+
relativetime: I((t, n) => {
|
|
917
877
|
const s = new Intl.RelativeTimeFormat(t, {
|
|
918
878
|
...n
|
|
919
879
|
});
|
|
920
880
|
return (i) => s.format(i, n.range || "day");
|
|
921
881
|
}),
|
|
922
|
-
list:
|
|
882
|
+
list: I((t, n) => {
|
|
923
883
|
const s = new Intl.ListFormat(t, {
|
|
924
884
|
...n
|
|
925
885
|
});
|
|
@@ -937,7 +897,7 @@ class _e {
|
|
|
937
897
|
this.formats[e.toLowerCase().trim()] = t;
|
|
938
898
|
}
|
|
939
899
|
addCached(e, t) {
|
|
940
|
-
this.formats[e.toLowerCase().trim()] =
|
|
900
|
+
this.formats[e.toLowerCase().trim()] = I(t);
|
|
941
901
|
}
|
|
942
902
|
format(e, t, n) {
|
|
943
903
|
let s = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
|
|
@@ -947,15 +907,15 @@ class _e {
|
|
|
947
907
|
i[0] = [i[0], ...i.splice(1, l)].join(this.formatSeparator);
|
|
948
908
|
}
|
|
949
909
|
return i.reduce((l, o) => {
|
|
950
|
-
var
|
|
910
|
+
var h;
|
|
951
911
|
const {
|
|
952
912
|
formatName: u,
|
|
953
913
|
formatOptions: d
|
|
954
|
-
} =
|
|
914
|
+
} = We(o);
|
|
955
915
|
if (this.formats[u]) {
|
|
956
916
|
let f = l;
|
|
957
917
|
try {
|
|
958
|
-
const m = ((
|
|
918
|
+
const m = ((h = s == null ? void 0 : s.formatParams) == null ? void 0 : h[s.interpolationkey]) || {}, g = m.locale || m.lng || s.locale || s.lng || n;
|
|
959
919
|
f = this.formats[u](l, g, {
|
|
960
920
|
...d,
|
|
961
921
|
...s,
|
|
@@ -971,10 +931,10 @@ class _e {
|
|
|
971
931
|
}, e);
|
|
972
932
|
}
|
|
973
933
|
}
|
|
974
|
-
const
|
|
934
|
+
const Ye = (r, e) => {
|
|
975
935
|
r.pending[e] !== void 0 && (delete r.pending[e], r.pendingCount--);
|
|
976
936
|
};
|
|
977
|
-
class
|
|
937
|
+
class qe extends Z {
|
|
978
938
|
constructor(e, t, n) {
|
|
979
939
|
var i, a;
|
|
980
940
|
let s = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
|
|
@@ -984,9 +944,9 @@ class tt extends Z {
|
|
|
984
944
|
const i = {}, a = {}, l = {}, o = {};
|
|
985
945
|
return e.forEach((u) => {
|
|
986
946
|
let d = !0;
|
|
987
|
-
t.forEach((
|
|
988
|
-
const f = `${u}|${
|
|
989
|
-
!n.reload && this.store.hasResourceBundle(u,
|
|
947
|
+
t.forEach((h) => {
|
|
948
|
+
const f = `${u}|${h}`;
|
|
949
|
+
!n.reload && this.store.hasResourceBundle(u, h) ? this.state[f] = 2 : this.state[f] < 0 || (this.state[f] === 1 ? a[f] === void 0 && (a[f] = !0) : (this.state[f] = 1, d = !1, a[f] === void 0 && (a[f] = !0), i[f] === void 0 && (i[f] = !0), o[h] === void 0 && (o[h] = !0)));
|
|
990
950
|
}), d || (l[u] = !0);
|
|
991
951
|
}), (Object.keys(i).length || Object.keys(a).length) && this.queue.push({
|
|
992
952
|
pending: a,
|
|
@@ -1008,11 +968,11 @@ class tt extends Z {
|
|
|
1008
968
|
}), this.state[e] = t ? -1 : 2, t && n && (this.state[e] = 0);
|
|
1009
969
|
const l = {};
|
|
1010
970
|
this.queue.forEach((o) => {
|
|
1011
|
-
|
|
971
|
+
Ie(o.loaded, [i], a), Ye(o, e), t && o.errors.push(t), o.pendingCount === 0 && !o.done && (Object.keys(o.loaded).forEach((u) => {
|
|
1012
972
|
l[u] || (l[u] = {});
|
|
1013
973
|
const d = o.loaded[u];
|
|
1014
|
-
d.length && d.forEach((
|
|
1015
|
-
l[u][
|
|
974
|
+
d.length && d.forEach((h) => {
|
|
975
|
+
l[u][h] === void 0 && (l[u][h] = !0);
|
|
1016
976
|
});
|
|
1017
977
|
}), o.done = !0, o.errors.length ? o.callback(o.errors) : o.callback());
|
|
1018
978
|
}), this.emit("loaded", l), this.queue = this.queue.filter((o) => !o.done);
|
|
@@ -1034,8 +994,8 @@ class tt extends Z {
|
|
|
1034
994
|
this.readingCalls++;
|
|
1035
995
|
const l = (u, d) => {
|
|
1036
996
|
if (this.readingCalls--, this.waitingReads.length > 0) {
|
|
1037
|
-
const
|
|
1038
|
-
this.read(
|
|
997
|
+
const h = this.waitingReads.shift();
|
|
998
|
+
this.read(h.lng, h.ns, h.fcName, h.tried, h.wait, h.callback);
|
|
1039
999
|
}
|
|
1040
1000
|
if (u && d && s < this.maxRetries) {
|
|
1041
1001
|
setTimeout(() => {
|
|
@@ -1060,7 +1020,7 @@ class tt extends Z {
|
|
|
1060
1020
|
let n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, s = arguments.length > 3 ? arguments[3] : void 0;
|
|
1061
1021
|
if (!this.backend)
|
|
1062
1022
|
return this.logger.warn("No backend was added via i18next.use. Will not load resources."), s && s();
|
|
1063
|
-
|
|
1023
|
+
c(e) && (e = this.languageUtils.toResolveHierarchy(e)), c(t) && (t = [t]);
|
|
1064
1024
|
const i = this.queueLoad(e, t, n, s);
|
|
1065
1025
|
if (!i.toLoad.length)
|
|
1066
1026
|
return i.pending.length || s(), null;
|
|
@@ -1084,10 +1044,10 @@ class tt extends Z {
|
|
|
1084
1044
|
});
|
|
1085
1045
|
}
|
|
1086
1046
|
saveMissing(e, t, n, s, i) {
|
|
1087
|
-
var o, u, d,
|
|
1047
|
+
var o, u, d, h, f;
|
|
1088
1048
|
let a = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : {}, l = arguments.length > 6 && arguments[6] !== void 0 ? arguments[6] : () => {
|
|
1089
1049
|
};
|
|
1090
|
-
if ((u = (o = this.services) == null ? void 0 : o.utils) != null && u.hasLoadedNamespace && !((
|
|
1050
|
+
if ((u = (o = this.services) == null ? void 0 : o.utils) != null && u.hasLoadedNamespace && !((h = (d = this.services) == null ? void 0 : d.utils) != null && h.hasLoadedNamespace(t))) {
|
|
1091
1051
|
this.logger.warn(`did not save key "${n}" as the namespace "${t}" was not yet loaded`, "This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");
|
|
1092
1052
|
return;
|
|
1093
1053
|
}
|
|
@@ -1111,7 +1071,7 @@ class tt extends Z {
|
|
|
1111
1071
|
}
|
|
1112
1072
|
}
|
|
1113
1073
|
}
|
|
1114
|
-
const
|
|
1074
|
+
const pe = () => ({
|
|
1115
1075
|
debug: !1,
|
|
1116
1076
|
initAsync: !0,
|
|
1117
1077
|
ns: ["translation"],
|
|
@@ -1146,7 +1106,7 @@ const me = () => ({
|
|
|
1146
1106
|
appendNamespaceToCIMode: !1,
|
|
1147
1107
|
overloadTranslationOptionHandler: (r) => {
|
|
1148
1108
|
let e = {};
|
|
1149
|
-
if (typeof r[1] == "object" && (e = r[1]),
|
|
1109
|
+
if (typeof r[1] == "object" && (e = r[1]), c(r[1]) && (e.defaultValue = r[1]), c(r[2]) && (e.tDescription = r[2]), typeof r[2] == "object" || typeof r[3] == "object") {
|
|
1150
1110
|
const t = r[3] || r[2];
|
|
1151
1111
|
Object.keys(t).forEach((n) => {
|
|
1152
1112
|
e[n] = t[n];
|
|
@@ -1167,11 +1127,11 @@ const me = () => ({
|
|
|
1167
1127
|
maxReplaces: 1e3,
|
|
1168
1128
|
skipOnVariables: !0
|
|
1169
1129
|
}
|
|
1170
|
-
}),
|
|
1130
|
+
}), me = (r) => {
|
|
1171
1131
|
var e, t;
|
|
1172
|
-
return
|
|
1132
|
+
return c(r.ns) && (r.ns = [r.ns]), c(r.fallbackLng) && (r.fallbackLng = [r.fallbackLng]), c(r.fallbackNS) && (r.fallbackNS = [r.fallbackNS]), ((t = (e = r.supportedLngs) == null ? void 0 : e.indexOf) == null ? void 0 : t.call(e, "cimode")) < 0 && (r.supportedLngs = r.supportedLngs.concat(["cimode"])), typeof r.initImmediate == "boolean" && (r.initAsync = r.initImmediate), r;
|
|
1173
1133
|
}, W = () => {
|
|
1174
|
-
},
|
|
1134
|
+
}, Ge = (r) => {
|
|
1175
1135
|
Object.getOwnPropertyNames(Object.getPrototypeOf(r)).forEach((t) => {
|
|
1176
1136
|
typeof r[t] == "function" && (r[t] = r[t].bind(r));
|
|
1177
1137
|
});
|
|
@@ -1179,9 +1139,9 @@ const me = () => ({
|
|
|
1179
1139
|
class B extends Z {
|
|
1180
1140
|
constructor() {
|
|
1181
1141
|
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, t = arguments.length > 1 ? arguments[1] : void 0;
|
|
1182
|
-
if (super(), this.options =
|
|
1142
|
+
if (super(), this.options = me(e), this.services = {}, this.logger = P, this.modules = {
|
|
1183
1143
|
external: []
|
|
1184
|
-
},
|
|
1144
|
+
}, Ge(this), t && !this.isInitialized && !e.isClone) {
|
|
1185
1145
|
if (!this.options.initAsync)
|
|
1186
1146
|
return this.init(e, t), this;
|
|
1187
1147
|
setTimeout(() => {
|
|
@@ -1192,12 +1152,12 @@ class B extends Z {
|
|
|
1192
1152
|
init() {
|
|
1193
1153
|
var e = this;
|
|
1194
1154
|
let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, n = arguments.length > 1 ? arguments[1] : void 0;
|
|
1195
|
-
this.isInitializing = !0, typeof t == "function" && (n = t, t = {}), t.defaultNS == null && t.ns && (
|
|
1196
|
-
const s =
|
|
1155
|
+
this.isInitializing = !0, typeof t == "function" && (n = t, t = {}), t.defaultNS == null && t.ns && (c(t.ns) ? t.defaultNS = t.ns : t.ns.indexOf("translation") < 0 && (t.defaultNS = t.ns[0]));
|
|
1156
|
+
const s = pe();
|
|
1197
1157
|
this.options = {
|
|
1198
1158
|
...s,
|
|
1199
1159
|
...this.options,
|
|
1200
|
-
...
|
|
1160
|
+
...me(t)
|
|
1201
1161
|
}, this.options.interpolation = {
|
|
1202
1162
|
...s.interpolation,
|
|
1203
1163
|
...this.options.interpolation
|
|
@@ -1206,16 +1166,16 @@ class B extends Z {
|
|
|
1206
1166
|
if (!this.options.isClone) {
|
|
1207
1167
|
this.modules.logger ? P.init(i(this.modules.logger), this.options) : P.init(null, this.options);
|
|
1208
1168
|
let d;
|
|
1209
|
-
this.modules.formatter ? d = this.modules.formatter : d =
|
|
1210
|
-
const
|
|
1211
|
-
this.store = new
|
|
1169
|
+
this.modules.formatter ? d = this.modules.formatter : d = Qe;
|
|
1170
|
+
const h = new de(this.options);
|
|
1171
|
+
this.store = new le(this.options.resources, this.options);
|
|
1212
1172
|
const f = this.services;
|
|
1213
|
-
f.logger = P, f.resourceStore = this.store, f.languageUtils =
|
|
1173
|
+
f.logger = P, f.resourceStore = this.store, f.languageUtils = h, f.pluralResolver = new Be(h, {
|
|
1214
1174
|
prepend: this.options.pluralSeparator,
|
|
1215
1175
|
simplifyPluralSuffix: this.options.simplifyPluralSuffix
|
|
1216
|
-
}), d && (!this.options.interpolation.format || this.options.interpolation.format === s.interpolation.format) && (f.formatter = i(d), f.formatter.init(f, this.options), this.options.interpolation.format = f.formatter.format.bind(f.formatter)), f.interpolator = new
|
|
1176
|
+
}), d && (!this.options.interpolation.format || this.options.interpolation.format === s.interpolation.format) && (f.formatter = i(d), f.formatter.init(f, this.options), this.options.interpolation.format = f.formatter.format.bind(f.formatter)), f.interpolator = new Je(this.options), f.utils = {
|
|
1217
1177
|
hasLoadedNamespace: this.hasLoadedNamespace.bind(this)
|
|
1218
|
-
}, f.backendConnector = new
|
|
1178
|
+
}, f.backendConnector = new qe(i(this.modules.backend), f.resourceStore, f, this.options), f.backendConnector.on("*", function(m) {
|
|
1219
1179
|
for (var g = arguments.length, p = new Array(g > 1 ? g - 1 : 0), x = 1; x < g; x++)
|
|
1220
1180
|
p[x - 1] = arguments[x];
|
|
1221
1181
|
e.emit(m, ...p);
|
|
@@ -1241,8 +1201,8 @@ class B extends Z {
|
|
|
1241
1201
|
};
|
|
1242
1202
|
});
|
|
1243
1203
|
const o = H(), u = () => {
|
|
1244
|
-
const d = (
|
|
1245
|
-
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), o.resolve(f), n(
|
|
1204
|
+
const d = (h, f) => {
|
|
1205
|
+
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), o.resolve(f), n(h, f);
|
|
1246
1206
|
};
|
|
1247
1207
|
if (this.languages && !this.isInitialized) return d(null, this.t.bind(this));
|
|
1248
1208
|
this.changeLanguage(this.options.lng, d);
|
|
@@ -1252,13 +1212,13 @@ class B extends Z {
|
|
|
1252
1212
|
loadResources(e) {
|
|
1253
1213
|
var i, a;
|
|
1254
1214
|
let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : W;
|
|
1255
|
-
const s =
|
|
1215
|
+
const s = c(e) ? e : this.language;
|
|
1256
1216
|
if (typeof e == "function" && (n = e), !this.options.resources || this.options.partialBundledLanguages) {
|
|
1257
1217
|
if ((s == null ? void 0 : s.toLowerCase()) === "cimode" && (!this.options.preload || this.options.preload.length === 0)) return n();
|
|
1258
1218
|
const l = [], o = (u) => {
|
|
1259
1219
|
if (!u || u === "cimode") return;
|
|
1260
|
-
this.services.languageUtils.toResolveHierarchy(u).forEach((
|
|
1261
|
-
|
|
1220
|
+
this.services.languageUtils.toResolveHierarchy(u).forEach((h) => {
|
|
1221
|
+
h !== "cimode" && l.indexOf(h) < 0 && l.push(h);
|
|
1262
1222
|
});
|
|
1263
1223
|
};
|
|
1264
1224
|
s ? o(s) : this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach((d) => o(d)), (a = (i = this.options.preload) == null ? void 0 : i.forEach) == null || a.call(i, (u) => o(u)), this.services.backendConnector.load(l, this.options.ns, (u) => {
|
|
@@ -1276,7 +1236,7 @@ class B extends Z {
|
|
|
1276
1236
|
use(e) {
|
|
1277
1237
|
if (!e) throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");
|
|
1278
1238
|
if (!e.type) throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");
|
|
1279
|
-
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" &&
|
|
1239
|
+
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" && Oe.addPostProcessor(e), e.type === "formatter" && (this.modules.formatter = e), e.type === "3rdParty" && this.modules.external.push(e), this;
|
|
1280
1240
|
}
|
|
1281
1241
|
setResolvedLanguage(e) {
|
|
1282
1242
|
if (!(!e || !this.languages) && !(["cimode", "dev"].indexOf(e) > -1))
|
|
@@ -1302,10 +1262,10 @@ class B extends Z {
|
|
|
1302
1262
|
return n.t(...arguments);
|
|
1303
1263
|
});
|
|
1304
1264
|
}, l = (o) => {
|
|
1305
|
-
var d,
|
|
1265
|
+
var d, h;
|
|
1306
1266
|
!e && !o && this.services.languageDetector && (o = []);
|
|
1307
|
-
const u =
|
|
1308
|
-
u && (this.language || i(u), this.translator.language || this.translator.changeLanguage(u), (
|
|
1267
|
+
const u = c(o) ? o : this.services.languageUtils.getBestMatchFromCodes(o);
|
|
1268
|
+
u && (this.language || i(u), this.translator.language || this.translator.changeLanguage(u), (h = (d = this.services.languageDetector) == null ? void 0 : d.cacheUserLanguage) == null || h.call(d, u)), this.loadResources(u, (f) => {
|
|
1309
1269
|
a(f, u);
|
|
1310
1270
|
});
|
|
1311
1271
|
};
|
|
@@ -1316,8 +1276,8 @@ class B extends Z {
|
|
|
1316
1276
|
const i = function(a, l) {
|
|
1317
1277
|
let o;
|
|
1318
1278
|
if (typeof l != "object") {
|
|
1319
|
-
for (var u = arguments.length, d = new Array(u > 2 ? u - 2 : 0),
|
|
1320
|
-
d[
|
|
1279
|
+
for (var u = arguments.length, d = new Array(u > 2 ? u - 2 : 0), h = 2; h < u; h++)
|
|
1280
|
+
d[h - 2] = arguments[h];
|
|
1321
1281
|
o = s.options.overloadTranslationOptionHandler([a, l].concat(d));
|
|
1322
1282
|
} else
|
|
1323
1283
|
o = {
|
|
@@ -1328,7 +1288,7 @@ class B extends Z {
|
|
|
1328
1288
|
let m;
|
|
1329
1289
|
return o.keyPrefix && Array.isArray(a) ? m = a.map((g) => `${o.keyPrefix}${f}${g}`) : m = o.keyPrefix ? `${o.keyPrefix}${f}${a}` : a, s.t(m, o);
|
|
1330
1290
|
};
|
|
1331
|
-
return
|
|
1291
|
+
return c(e) ? i.lng = e : i.lngs = e, i.ns = t, i.keyPrefix = n, i;
|
|
1332
1292
|
}
|
|
1333
1293
|
t() {
|
|
1334
1294
|
var s;
|
|
@@ -1365,7 +1325,7 @@ class B extends Z {
|
|
|
1365
1325
|
}
|
|
1366
1326
|
loadNamespaces(e, t) {
|
|
1367
1327
|
const n = H();
|
|
1368
|
-
return this.options.ns ? (
|
|
1328
|
+
return this.options.ns ? (c(e) && (e = [e]), e.forEach((s) => {
|
|
1369
1329
|
this.options.ns.indexOf(s) < 0 && this.options.ns.push(s);
|
|
1370
1330
|
}), this.loadResources((s) => {
|
|
1371
1331
|
n.resolve(), t && t(s);
|
|
@@ -1373,7 +1333,7 @@ class B extends Z {
|
|
|
1373
1333
|
}
|
|
1374
1334
|
loadLanguages(e, t) {
|
|
1375
1335
|
const n = H();
|
|
1376
|
-
|
|
1336
|
+
c(e) && (e = [e]);
|
|
1377
1337
|
const s = this.options.preload || [], i = e.filter((a) => s.indexOf(a) < 0 && this.services.languageUtils.isSupportedCode(a));
|
|
1378
1338
|
return i.length ? (this.options.preload = s.concat(i), this.loadResources((a) => {
|
|
1379
1339
|
n.resolve(), t && t(a);
|
|
@@ -1382,7 +1342,7 @@ class B extends Z {
|
|
|
1382
1342
|
dir(e) {
|
|
1383
1343
|
var s, i;
|
|
1384
1344
|
if (e || (e = this.resolvedLanguage || (((s = this.languages) == null ? void 0 : s.length) > 0 ? this.languages[0] : this.language)), !e) return "rtl";
|
|
1385
|
-
const t = ["ar", "shu", "sqr", "ssh", "xaa", "yhd", "yud", "aao", "abh", "abv", "acm", "acq", "acw", "acx", "acy", "adf", "ads", "aeb", "aec", "afb", "ajp", "apc", "apd", "arb", "arq", "ars", "ary", "arz", "auz", "avl", "ayh", "ayl", "ayn", "ayp", "bbz", "pga", "he", "iw", "ps", "pbt", "pbu", "pst", "prp", "prd", "ug", "ur", "ydd", "yds", "yih", "ji", "yi", "hbo", "men", "xmn", "fa", "jpr", "peo", "pes", "prs", "dv", "sam", "ckb"], n = ((i = this.services) == null ? void 0 : i.languageUtils) || new
|
|
1345
|
+
const t = ["ar", "shu", "sqr", "ssh", "xaa", "yhd", "yud", "aao", "abh", "abv", "acm", "acq", "acw", "acx", "acy", "adf", "ads", "aeb", "aec", "afb", "ajp", "apc", "apd", "arb", "arq", "ars", "ary", "arz", "auz", "avl", "ayh", "ayl", "ayn", "ayp", "bbz", "pga", "he", "iw", "ps", "pbt", "pbu", "pst", "prp", "prd", "ug", "ur", "ydd", "yds", "yih", "ji", "yi", "hbo", "men", "xmn", "fa", "jpr", "peo", "pes", "prs", "dv", "sam", "ckb"], n = ((i = this.services) == null ? void 0 : i.languageUtils) || new de(pe());
|
|
1386
1346
|
return t.indexOf(n.getLanguagePartFromCode(e)) > -1 || e.toLowerCase().indexOf("-arab") > 1 ? "rtl" : "ltr";
|
|
1387
1347
|
}
|
|
1388
1348
|
static createInstance() {
|
|
@@ -1407,10 +1367,10 @@ class B extends Z {
|
|
|
1407
1367
|
}, n) {
|
|
1408
1368
|
const l = Object.keys(this.store.data).reduce((o, u) => (o[u] = {
|
|
1409
1369
|
...this.store.data[u]
|
|
1410
|
-
}, Object.keys(o[u]).reduce((d,
|
|
1411
|
-
...o[u][
|
|
1370
|
+
}, Object.keys(o[u]).reduce((d, h) => (d[h] = {
|
|
1371
|
+
...o[u][h]
|
|
1412
1372
|
}, d), {})), {});
|
|
1413
|
-
i.store = new
|
|
1373
|
+
i.store = new le(l, s), i.services.resourceStore = i.store;
|
|
1414
1374
|
}
|
|
1415
1375
|
return i.translator = new G(i.services, s), i.translator.on("*", function(l) {
|
|
1416
1376
|
for (var o = arguments.length, u = new Array(o > 1 ? o - 1 : 0), d = 1; d < o; d++)
|
|
@@ -1447,17 +1407,17 @@ S.hasLoadedNamespace;
|
|
|
1447
1407
|
S.loadNamespaces;
|
|
1448
1408
|
S.loadLanguages;
|
|
1449
1409
|
const {
|
|
1450
|
-
slice:
|
|
1451
|
-
forEach:
|
|
1410
|
+
slice: Ze,
|
|
1411
|
+
forEach: Xe
|
|
1452
1412
|
} = [];
|
|
1453
|
-
function
|
|
1454
|
-
return
|
|
1413
|
+
function _e(r) {
|
|
1414
|
+
return Xe.call(Ze.call(arguments, 1), (e) => {
|
|
1455
1415
|
if (e)
|
|
1456
1416
|
for (const t in e)
|
|
1457
1417
|
r[t] === void 0 && (r[t] = e[t]);
|
|
1458
1418
|
}), r;
|
|
1459
1419
|
}
|
|
1460
|
-
const
|
|
1420
|
+
const xe = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/, et = function(r, e) {
|
|
1461
1421
|
const n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {
|
|
1462
1422
|
path: "/"
|
|
1463
1423
|
}, s = encodeURIComponent(e);
|
|
@@ -1468,12 +1428,12 @@ const ye = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/, at = function(r, e) {
|
|
|
1468
1428
|
i += `; Max-Age=${Math.floor(a)}`;
|
|
1469
1429
|
}
|
|
1470
1430
|
if (n.domain) {
|
|
1471
|
-
if (!
|
|
1431
|
+
if (!xe.test(n.domain))
|
|
1472
1432
|
throw new TypeError("option domain is invalid");
|
|
1473
1433
|
i += `; Domain=${n.domain}`;
|
|
1474
1434
|
}
|
|
1475
1435
|
if (n.path) {
|
|
1476
|
-
if (!
|
|
1436
|
+
if (!xe.test(n.path))
|
|
1477
1437
|
throw new TypeError("option path is invalid");
|
|
1478
1438
|
i += `; Path=${n.path}`;
|
|
1479
1439
|
}
|
|
@@ -1500,13 +1460,13 @@ const ye = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/, at = function(r, e) {
|
|
|
1500
1460
|
throw new TypeError("option sameSite is invalid");
|
|
1501
1461
|
}
|
|
1502
1462
|
return i;
|
|
1503
|
-
},
|
|
1463
|
+
}, ye = {
|
|
1504
1464
|
create(r, e, t, n) {
|
|
1505
1465
|
let s = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : {
|
|
1506
1466
|
path: "/",
|
|
1507
1467
|
sameSite: "strict"
|
|
1508
1468
|
};
|
|
1509
|
-
t && (s.expires = /* @__PURE__ */ new Date(), s.expires.setTime(s.expires.getTime() + t * 60 * 1e3)), n && (s.domain = n), document.cookie =
|
|
1469
|
+
t && (s.expires = /* @__PURE__ */ new Date(), s.expires.setTime(s.expires.getTime() + t * 60 * 1e3)), n && (s.domain = n), document.cookie = et(r, encodeURIComponent(e), s);
|
|
1510
1470
|
},
|
|
1511
1471
|
read(r) {
|
|
1512
1472
|
const e = `${r}=`, t = document.cookie.split(";");
|
|
@@ -1521,7 +1481,7 @@ const ye = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/, at = function(r, e) {
|
|
|
1521
1481
|
this.create(r, "", -1);
|
|
1522
1482
|
}
|
|
1523
1483
|
};
|
|
1524
|
-
var
|
|
1484
|
+
var tt = {
|
|
1525
1485
|
name: "cookie",
|
|
1526
1486
|
// Deconstruct the options object and extract the lookupCookie property
|
|
1527
1487
|
lookup(r) {
|
|
@@ -1529,7 +1489,7 @@ var ot = {
|
|
|
1529
1489
|
lookupCookie: e
|
|
1530
1490
|
} = r;
|
|
1531
1491
|
if (e && typeof document < "u")
|
|
1532
|
-
return
|
|
1492
|
+
return ye.read(e) || void 0;
|
|
1533
1493
|
},
|
|
1534
1494
|
// Deconstruct the options object and extract the lookupCookie, cookieMinutes, cookieDomain, and cookieOptions properties
|
|
1535
1495
|
cacheUserLanguage(r, e) {
|
|
@@ -1539,9 +1499,9 @@ var ot = {
|
|
|
1539
1499
|
cookieDomain: s,
|
|
1540
1500
|
cookieOptions: i
|
|
1541
1501
|
} = e;
|
|
1542
|
-
t && typeof document < "u" &&
|
|
1502
|
+
t && typeof document < "u" && ye.create(t, r, n, s, i);
|
|
1543
1503
|
}
|
|
1544
|
-
},
|
|
1504
|
+
}, nt = {
|
|
1545
1505
|
name: "querystring",
|
|
1546
1506
|
// Deconstruct the options object and extract the lookupQuerystring property
|
|
1547
1507
|
lookup(r) {
|
|
@@ -1564,7 +1524,7 @@ var ot = {
|
|
|
1564
1524
|
}
|
|
1565
1525
|
};
|
|
1566
1526
|
let A = null;
|
|
1567
|
-
const
|
|
1527
|
+
const Se = () => {
|
|
1568
1528
|
if (A !== null) return A;
|
|
1569
1529
|
try {
|
|
1570
1530
|
if (A = typeof window < "u" && window.localStorage !== null, !A)
|
|
@@ -1576,14 +1536,14 @@ const be = () => {
|
|
|
1576
1536
|
}
|
|
1577
1537
|
return A;
|
|
1578
1538
|
};
|
|
1579
|
-
var
|
|
1539
|
+
var st = {
|
|
1580
1540
|
name: "localStorage",
|
|
1581
1541
|
// Deconstruct the options object and extract the lookupLocalStorage property
|
|
1582
1542
|
lookup(r) {
|
|
1583
1543
|
let {
|
|
1584
1544
|
lookupLocalStorage: e
|
|
1585
1545
|
} = r;
|
|
1586
|
-
if (e &&
|
|
1546
|
+
if (e && Se())
|
|
1587
1547
|
return window.localStorage.getItem(e) || void 0;
|
|
1588
1548
|
},
|
|
1589
1549
|
// Deconstruct the options object and extract the lookupLocalStorage property
|
|
@@ -1591,11 +1551,11 @@ var ut = {
|
|
|
1591
1551
|
let {
|
|
1592
1552
|
lookupLocalStorage: t
|
|
1593
1553
|
} = e;
|
|
1594
|
-
t &&
|
|
1554
|
+
t && Se() && window.localStorage.setItem(t, r);
|
|
1595
1555
|
}
|
|
1596
1556
|
};
|
|
1597
1557
|
let T = null;
|
|
1598
|
-
const
|
|
1558
|
+
const be = () => {
|
|
1599
1559
|
if (T !== null) return T;
|
|
1600
1560
|
try {
|
|
1601
1561
|
if (T = typeof window < "u" && window.sessionStorage !== null, !T)
|
|
@@ -1607,22 +1567,22 @@ const we = () => {
|
|
|
1607
1567
|
}
|
|
1608
1568
|
return T;
|
|
1609
1569
|
};
|
|
1610
|
-
var
|
|
1570
|
+
var it = {
|
|
1611
1571
|
name: "sessionStorage",
|
|
1612
1572
|
lookup(r) {
|
|
1613
1573
|
let {
|
|
1614
1574
|
lookupSessionStorage: e
|
|
1615
1575
|
} = r;
|
|
1616
|
-
if (e &&
|
|
1576
|
+
if (e && be())
|
|
1617
1577
|
return window.sessionStorage.getItem(e) || void 0;
|
|
1618
1578
|
},
|
|
1619
1579
|
cacheUserLanguage(r, e) {
|
|
1620
1580
|
let {
|
|
1621
1581
|
lookupSessionStorage: t
|
|
1622
1582
|
} = e;
|
|
1623
|
-
t &&
|
|
1583
|
+
t && be() && window.sessionStorage.setItem(t, r);
|
|
1624
1584
|
}
|
|
1625
|
-
},
|
|
1585
|
+
}, rt = {
|
|
1626
1586
|
name: "navigator",
|
|
1627
1587
|
lookup(r) {
|
|
1628
1588
|
const e = [];
|
|
@@ -1639,7 +1599,7 @@ var ft = {
|
|
|
1639
1599
|
}
|
|
1640
1600
|
return e.length > 0 ? e : void 0;
|
|
1641
1601
|
}
|
|
1642
|
-
},
|
|
1602
|
+
}, at = {
|
|
1643
1603
|
name: "htmlTag",
|
|
1644
1604
|
// Deconstruct the options object and extract the htmlTag property
|
|
1645
1605
|
lookup(r) {
|
|
@@ -1649,7 +1609,7 @@ var ft = {
|
|
|
1649
1609
|
const n = e || (typeof document < "u" ? document.documentElement : null);
|
|
1650
1610
|
return n && typeof n.getAttribute == "function" && (t = n.getAttribute("lang")), t;
|
|
1651
1611
|
}
|
|
1652
|
-
},
|
|
1612
|
+
}, ot = {
|
|
1653
1613
|
name: "path",
|
|
1654
1614
|
// Deconstruct the options object and extract the lookupFromPathIndex property
|
|
1655
1615
|
lookup(r) {
|
|
@@ -1661,7 +1621,7 @@ var ft = {
|
|
|
1661
1621
|
const t = window.location.pathname.match(/\/([a-zA-Z-]*)/g);
|
|
1662
1622
|
return Array.isArray(t) ? (s = t[typeof e == "number" ? e : 0]) == null ? void 0 : s.replace("/", "") : void 0;
|
|
1663
1623
|
}
|
|
1664
|
-
},
|
|
1624
|
+
}, lt = {
|
|
1665
1625
|
name: "subdomain",
|
|
1666
1626
|
lookup(r) {
|
|
1667
1627
|
var s, i;
|
|
@@ -1673,15 +1633,15 @@ var ft = {
|
|
|
1673
1633
|
return n[t];
|
|
1674
1634
|
}
|
|
1675
1635
|
};
|
|
1676
|
-
let
|
|
1636
|
+
let Le = !1;
|
|
1677
1637
|
try {
|
|
1678
|
-
document.cookie,
|
|
1638
|
+
document.cookie, Le = !0;
|
|
1679
1639
|
} catch {
|
|
1680
1640
|
}
|
|
1681
|
-
const
|
|
1682
|
-
|
|
1683
|
-
const
|
|
1684
|
-
order:
|
|
1641
|
+
const ve = ["querystring", "cookie", "localStorage", "sessionStorage", "navigator", "htmlTag"];
|
|
1642
|
+
Le || ve.splice(1, 1);
|
|
1643
|
+
const ut = () => ({
|
|
1644
|
+
order: ve,
|
|
1685
1645
|
lookupQuerystring: "lng",
|
|
1686
1646
|
lookupCookie: "i18next",
|
|
1687
1647
|
lookupLocalStorage: "i18nextLng",
|
|
@@ -1693,7 +1653,7 @@ const pt = () => ({
|
|
|
1693
1653
|
// cookieDomain: 'myDomain'
|
|
1694
1654
|
convertDetectedLanguage: (r) => r
|
|
1695
1655
|
});
|
|
1696
|
-
class
|
|
1656
|
+
class Ce {
|
|
1697
1657
|
constructor(e) {
|
|
1698
1658
|
let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
1699
1659
|
this.type = "languageDetector", this.detectors = {}, this.init(e, t);
|
|
@@ -1702,7 +1662,7 @@ class $e {
|
|
|
1702
1662
|
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {
|
|
1703
1663
|
languageUtils: {}
|
|
1704
1664
|
}, t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
1705
|
-
this.services = e, this.options =
|
|
1665
|
+
this.services = e, this.options = _e(t, this.options || {}, ut()), typeof this.options.convertDetectedLanguage == "string" && this.options.convertDetectedLanguage.indexOf("15897") > -1 && (this.options.convertDetectedLanguage = (s) => s.replace("-", "_")), this.options.lookupFromUrlIndex && (this.options.lookupFromPathIndex = this.options.lookupFromUrlIndex), this.i18nOptions = n, this.addDetector(tt), this.addDetector(nt), this.addDetector(st), this.addDetector(it), this.addDetector(rt), this.addDetector(at), this.addDetector(ot), this.addDetector(lt);
|
|
1706
1666
|
}
|
|
1707
1667
|
addDetector(e) {
|
|
1708
1668
|
return this.detectors[e.name] = e, this;
|
|
@@ -1723,9 +1683,9 @@ class $e {
|
|
|
1723
1683
|
}));
|
|
1724
1684
|
}
|
|
1725
1685
|
}
|
|
1726
|
-
|
|
1727
|
-
const
|
|
1728
|
-
|
|
1686
|
+
Ce.type = "languageDetector";
|
|
1687
|
+
const ft = S.createInstance();
|
|
1688
|
+
ft.use(Ce).use(Fe).init({
|
|
1729
1689
|
lng: "en",
|
|
1730
1690
|
fallbackLng: Ee,
|
|
1731
1691
|
debug: !0,
|
|
@@ -1742,8 +1702,6 @@ mt.use($e).use(Ve).init({
|
|
|
1742
1702
|
}
|
|
1743
1703
|
});
|
|
1744
1704
|
export {
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
mt as i,
|
|
1748
|
-
bt as t
|
|
1705
|
+
ft as i,
|
|
1706
|
+
pt as t
|
|
1749
1707
|
};
|