@argent/x-shared 1.66.5 → 1.66.7

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.
Files changed (31) hide show
  1. package/dist/index.cjs +1 -1
  2. package/dist/index.js +472 -463
  3. package/dist/src/chains/starknet/address.cjs +1 -1
  4. package/dist/src/chains/starknet/address.d.ts +19 -0
  5. package/dist/src/chains/starknet/address.js +81 -48
  6. package/dist/src/transactions/transactionExecuteTypes.cjs +1 -1
  7. package/dist/src/transactions/transactionExecuteTypes.d.ts +8 -8
  8. package/dist/src/transactions/transactionExecuteTypes.js +1 -1
  9. package/package.json +1 -1
  10. package/dist/node_modules/.pnpm/i18next@24.2.3_typescript@5.7.3/node_modules/i18next/dist/esm/i18next.cjs +0 -1
  11. package/dist/node_modules/.pnpm/i18next@24.2.3_typescript@5.7.3/node_modules/i18next/dist/esm/i18next.js +0 -1393
  12. package/dist/node_modules/.pnpm/react-i18next@15.4.1_i18next@24.2.3_typescript@5.7.3__react@19.1.0/node_modules/react-i18next/dist/es/defaults.cjs +0 -1
  13. package/dist/node_modules/.pnpm/react-i18next@15.4.1_i18next@24.2.3_typescript@5.7.3__react@19.1.0/node_modules/react-i18next/dist/es/defaults.js +0 -20
  14. package/dist/node_modules/.pnpm/react-i18next@15.4.1_i18next@24.2.3_typescript@5.7.3__react@19.1.0/node_modules/react-i18next/dist/es/initReactI18next.cjs +0 -1
  15. package/dist/node_modules/.pnpm/react-i18next@15.4.1_i18next@24.2.3_typescript@5.7.3__react@19.1.0/node_modules/react-i18next/dist/es/initReactI18next.js +0 -10
  16. package/dist/node_modules/.pnpm/react-i18next@15.4.1_i18next@24.2.3_typescript@5.7.3__react@19.1.0/node_modules/react-i18next/dist/es/unescape.cjs +0 -1
  17. package/dist/node_modules/.pnpm/react-i18next@15.4.1_i18next@24.2.3_typescript@5.7.3__react@19.1.0/node_modules/react-i18next/dist/es/unescape.js +0 -25
  18. package/dist/src/locales/en/translation.json.cjs +0 -1
  19. package/dist/src/locales/en/translation.json.js +0 -7
  20. package/dist/src/locales/ru/translation.json.cjs +0 -1
  21. package/dist/src/locales/ru/translation.json.js +0 -7
  22. package/dist/src/locales/tr/translation.json.cjs +0 -1
  23. package/dist/src/locales/tr/translation.json.js +0 -7
  24. package/dist/src/locales/uk/translation.json.cjs +0 -1
  25. package/dist/src/locales/uk/translation.json.js +0 -7
  26. package/dist/src/locales/vi/translation.json.cjs +0 -1
  27. package/dist/src/locales/vi/translation.json.js +0 -7
  28. package/dist/src/locales/zh_CN/translation.json.cjs +0 -1
  29. package/dist/src/locales/zh_CN/translation.json.js +0 -7
  30. package/dist/src/utils/i18n.cjs +0 -1
  31. package/dist/src/utils/i18n.js +0 -41
@@ -1,1393 +0,0 @@
1
- const c = (a) => typeof a == "string", U = () => {
2
- let a, e;
3
- const t = new Promise((s, n) => {
4
- a = s, e = n;
5
- });
6
- return t.resolve = a, t.reject = e, t;
7
- }, se = (a) => a == null ? "" : "" + a, xe = (a, e, t) => {
8
- a.forEach((s) => {
9
- e[s] && (t[s] = e[s]);
10
- });
11
- }, ye = /###/g, ne = (a) => a && a.indexOf("###") > -1 ? a.replace(ye, ".") : a, ie = (a) => !a || c(a), M = (a, e, t) => {
12
- const s = c(e) ? e.split(".") : e;
13
- let n = 0;
14
- for (; n < s.length - 1; ) {
15
- if (ie(a)) return {};
16
- const i = ne(s[n]);
17
- !a[i] && t && (a[i] = new t()), Object.prototype.hasOwnProperty.call(a, i) ? a = a[i] : a = {}, ++n;
18
- }
19
- return ie(a) ? {} : {
20
- obj: a,
21
- k: ne(s[n])
22
- };
23
- }, re = (a, e, t) => {
24
- const {
25
- obj: s,
26
- k: n
27
- } = M(a, e, Object);
28
- if (s !== void 0 || e.length === 1) {
29
- s[n] = t;
30
- return;
31
- }
32
- let i = e[e.length - 1], r = e.slice(0, e.length - 1), l = M(a, r, Object);
33
- for (; l.obj === void 0 && r.length; )
34
- i = `${r[r.length - 1]}.${i}`, r = r.slice(0, r.length - 1), l = M(a, r, Object), l != null && l.obj && typeof l.obj[`${l.k}.${i}`] < "u" && (l.obj = void 0);
35
- l.obj[`${l.k}.${i}`] = t;
36
- }, be = (a, e, t, s) => {
37
- const {
38
- obj: n,
39
- k: i
40
- } = M(a, e, Object);
41
- n[i] = n[i] || [], n[i].push(t);
42
- }, J = (a, e) => {
43
- const {
44
- obj: t,
45
- k: s
46
- } = M(a, e);
47
- if (t && Object.prototype.hasOwnProperty.call(t, s))
48
- return t[s];
49
- }, Se = (a, e, t) => {
50
- const s = J(a, t);
51
- return s !== void 0 ? s : J(e, t);
52
- }, pe = (a, e, t) => {
53
- for (const s in e)
54
- s !== "__proto__" && s !== "constructor" && (s in a ? c(a[s]) || a[s] instanceof String || c(e[s]) || e[s] instanceof String ? t && (a[s] = e[s]) : pe(a[s], e[s], t) : a[s] = e[s]);
55
- return a;
56
- }, A = (a) => a.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
57
- var Oe = {
58
- "&": "&amp;",
59
- "<": "&lt;",
60
- ">": "&gt;",
61
- '"': "&quot;",
62
- "'": "&#39;",
63
- "/": "&#x2F;"
64
- };
65
- const Le = (a) => c(a) ? a.replace(/[&<>"'\/]/g, (e) => Oe[e]) : a;
66
- class we {
67
- constructor(e) {
68
- this.capacity = e, this.regExpMap = /* @__PURE__ */ new Map(), this.regExpQueue = [];
69
- }
70
- getRegExp(e) {
71
- const t = this.regExpMap.get(e);
72
- if (t !== void 0)
73
- return t;
74
- const s = new RegExp(e);
75
- return this.regExpQueue.length === this.capacity && this.regExpMap.delete(this.regExpQueue.shift()), this.regExpMap.set(e, s), this.regExpQueue.push(e), s;
76
- }
77
- }
78
- const ve = [" ", ",", "?", "!", ";"], Re = new we(20), Ce = (a, e, t) => {
79
- e = e || "", t = t || "";
80
- const s = ve.filter((r) => e.indexOf(r) < 0 && t.indexOf(r) < 0);
81
- if (s.length === 0) return !0;
82
- const n = Re.getRegExp(`(${s.map((r) => r === "?" ? "\\?" : r).join("|")})`);
83
- let i = !n.test(a);
84
- if (!i) {
85
- const r = a.indexOf(t);
86
- r > 0 && !n.test(a.substring(0, r)) && (i = !0);
87
- }
88
- return i;
89
- }, X = function(a, e) {
90
- let t = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : ".";
91
- if (!a) return;
92
- if (a[e])
93
- return Object.prototype.hasOwnProperty.call(a, e) ? a[e] : void 0;
94
- const s = e.split(t);
95
- let n = a;
96
- for (let i = 0; i < s.length; ) {
97
- if (!n || typeof n != "object")
98
- return;
99
- let r, l = "";
100
- for (let o = i; o < s.length; ++o)
101
- if (o !== i && (l += t), l += s[o], r = n[l], r !== void 0) {
102
- if (["string", "number", "boolean"].indexOf(typeof r) > -1 && o < s.length - 1)
103
- continue;
104
- i += o - i + 1;
105
- break;
106
- }
107
- n = r;
108
- }
109
- return n;
110
- }, W = (a) => a == null ? void 0 : a.replace("_", "-"), $e = {
111
- type: "logger",
112
- log(a) {
113
- this.output("log", a);
114
- },
115
- warn(a) {
116
- this.output("warn", a);
117
- },
118
- error(a) {
119
- this.output("error", a);
120
- },
121
- output(a, e) {
122
- var t, s;
123
- (s = (t = console == null ? void 0 : console[a]) == null ? void 0 : t.apply) == null || s.call(t, console, e);
124
- }
125
- };
126
- class Y {
127
- constructor(e) {
128
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
129
- this.init(e, t);
130
- }
131
- init(e) {
132
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
133
- this.prefix = t.prefix || "i18next:", this.logger = e || $e, this.options = t, this.debug = t.debug;
134
- }
135
- log() {
136
- for (var e = arguments.length, t = new Array(e), s = 0; s < e; s++)
137
- t[s] = arguments[s];
138
- return this.forward(t, "log", "", !0);
139
- }
140
- warn() {
141
- for (var e = arguments.length, t = new Array(e), s = 0; s < e; s++)
142
- t[s] = arguments[s];
143
- return this.forward(t, "warn", "", !0);
144
- }
145
- error() {
146
- for (var e = arguments.length, t = new Array(e), s = 0; s < e; s++)
147
- t[s] = arguments[s];
148
- return this.forward(t, "error", "");
149
- }
150
- deprecate() {
151
- for (var e = arguments.length, t = new Array(e), s = 0; s < e; s++)
152
- t[s] = arguments[s];
153
- return this.forward(t, "warn", "WARNING DEPRECATED: ", !0);
154
- }
155
- forward(e, t, s, n) {
156
- return n && !this.debug ? null : (c(e[0]) && (e[0] = `${s}${this.prefix} ${e[0]}`), this.logger[t](e));
157
- }
158
- create(e) {
159
- return new Y(this.logger, {
160
- prefix: `${this.prefix}:${e}:`,
161
- ...this.options
162
- });
163
- }
164
- clone(e) {
165
- return e = e || this.options, e.prefix = e.prefix || this.prefix, new Y(this.logger, e);
166
- }
167
- }
168
- var N = new Y();
169
- class G {
170
- constructor() {
171
- this.observers = {};
172
- }
173
- on(e, t) {
174
- return e.split(" ").forEach((s) => {
175
- this.observers[s] || (this.observers[s] = /* @__PURE__ */ new Map());
176
- const n = this.observers[s].get(t) || 0;
177
- this.observers[s].set(t, n + 1);
178
- }), this;
179
- }
180
- off(e, t) {
181
- if (this.observers[e]) {
182
- if (!t) {
183
- delete this.observers[e];
184
- return;
185
- }
186
- this.observers[e].delete(t);
187
- }
188
- }
189
- emit(e) {
190
- for (var t = arguments.length, s = new Array(t > 1 ? t - 1 : 0), n = 1; n < t; n++)
191
- s[n - 1] = arguments[n];
192
- this.observers[e] && Array.from(this.observers[e].entries()).forEach((r) => {
193
- let [l, o] = r;
194
- for (let u = 0; u < o; u++)
195
- l(...s);
196
- }), this.observers["*"] && Array.from(this.observers["*"].entries()).forEach((r) => {
197
- let [l, o] = r;
198
- for (let u = 0; u < o; u++)
199
- l.apply(l, [e, ...s]);
200
- });
201
- }
202
- }
203
- class ae extends G {
204
- constructor(e) {
205
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
206
- ns: ["translation"],
207
- defaultNS: "translation"
208
- };
209
- super(), this.data = e || {}, this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.options.ignoreJSONStructure === void 0 && (this.options.ignoreJSONStructure = !0);
210
- }
211
- addNamespaces(e) {
212
- this.options.ns.indexOf(e) < 0 && this.options.ns.push(e);
213
- }
214
- removeNamespaces(e) {
215
- const t = this.options.ns.indexOf(e);
216
- t > -1 && this.options.ns.splice(t, 1);
217
- }
218
- getResource(e, t, s) {
219
- var u, h;
220
- let n = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
221
- const i = n.keySeparator !== void 0 ? n.keySeparator : this.options.keySeparator, r = n.ignoreJSONStructure !== void 0 ? n.ignoreJSONStructure : this.options.ignoreJSONStructure;
222
- let l;
223
- e.indexOf(".") > -1 ? l = e.split(".") : (l = [e, t], s && (Array.isArray(s) ? l.push(...s) : c(s) && i ? l.push(...s.split(i)) : l.push(s)));
224
- const o = J(this.data, l);
225
- return !o && !t && !s && e.indexOf(".") > -1 && (e = l[0], t = l[1], s = l.slice(2).join(".")), o || !r || !c(s) ? o : X((h = (u = this.data) == null ? void 0 : u[e]) == null ? void 0 : h[t], s, i);
226
- }
227
- addResource(e, t, s, n) {
228
- let i = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : {
229
- silent: !1
230
- };
231
- const r = i.keySeparator !== void 0 ? i.keySeparator : this.options.keySeparator;
232
- let l = [e, t];
233
- s && (l = l.concat(r ? s.split(r) : s)), e.indexOf(".") > -1 && (l = e.split("."), n = t, t = l[1]), this.addNamespaces(t), re(this.data, l, n), i.silent || this.emit("added", e, t, s, n);
234
- }
235
- addResources(e, t, s) {
236
- let n = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {
237
- silent: !1
238
- };
239
- for (const i in s)
240
- (c(s[i]) || Array.isArray(s[i])) && this.addResource(e, t, i, s[i], {
241
- silent: !0
242
- });
243
- n.silent || this.emit("added", e, t, s);
244
- }
245
- addResourceBundle(e, t, s, n, i) {
246
- let r = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : {
247
- silent: !1,
248
- skipCopy: !1
249
- }, l = [e, t];
250
- e.indexOf(".") > -1 && (l = e.split("."), n = s, s = t, t = l[1]), this.addNamespaces(t);
251
- let o = J(this.data, l) || {};
252
- r.skipCopy || (s = JSON.parse(JSON.stringify(s))), n ? pe(o, s, i) : o = {
253
- ...o,
254
- ...s
255
- }, re(this.data, l, o), r.silent || this.emit("added", e, t, s);
256
- }
257
- removeResourceBundle(e, t) {
258
- this.hasResourceBundle(e, t) && delete this.data[e][t], this.removeNamespaces(t), this.emit("removed", e, t);
259
- }
260
- hasResourceBundle(e, t) {
261
- return this.getResource(e, t) !== void 0;
262
- }
263
- getResourceBundle(e, t) {
264
- return t || (t = this.options.defaultNS), this.getResource(e, t);
265
- }
266
- getDataByLanguage(e) {
267
- return this.data[e];
268
- }
269
- hasLanguageSomeTranslations(e) {
270
- const t = this.getDataByLanguage(e);
271
- return !!(t && Object.keys(t) || []).find((n) => t[n] && Object.keys(t[n]).length > 0);
272
- }
273
- toJSON() {
274
- return this.data;
275
- }
276
- }
277
- var me = {
278
- processors: {},
279
- addPostProcessor(a) {
280
- this.processors[a.name] = a;
281
- },
282
- handle(a, e, t, s, n) {
283
- return a.forEach((i) => {
284
- var r;
285
- e = ((r = this.processors[i]) == null ? void 0 : r.process(e, t, s, n)) ?? e;
286
- }), e;
287
- }
288
- };
289
- const oe = {}, le = (a) => !c(a) && typeof a != "boolean" && typeof a != "number";
290
- class Q extends G {
291
- constructor(e) {
292
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
293
- super(), xe(["resourceStore", "languageUtils", "pluralResolver", "interpolator", "backendConnector", "i18nFormat", "utils"], e, this), this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.logger = N.create("translator");
294
- }
295
- changeLanguage(e) {
296
- e && (this.language = e);
297
- }
298
- exists(e) {
299
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
300
- interpolation: {}
301
- };
302
- if (e == null)
303
- return !1;
304
- const s = this.resolve(e, t);
305
- return (s == null ? void 0 : s.res) !== void 0;
306
- }
307
- extractFromKey(e, t) {
308
- let s = t.nsSeparator !== void 0 ? t.nsSeparator : this.options.nsSeparator;
309
- s === void 0 && (s = ":");
310
- const n = t.keySeparator !== void 0 ? t.keySeparator : this.options.keySeparator;
311
- let i = t.ns || this.options.defaultNS || [];
312
- const r = s && e.indexOf(s) > -1, l = !this.options.userDefinedKeySeparator && !t.keySeparator && !this.options.userDefinedNsSeparator && !t.nsSeparator && !Ce(e, s, n);
313
- if (r && !l) {
314
- const o = e.match(this.interpolator.nestingRegexp);
315
- if (o && o.length > 0)
316
- return {
317
- key: e,
318
- namespaces: c(i) ? [i] : i
319
- };
320
- const u = e.split(s);
321
- (s !== n || s === n && this.options.ns.indexOf(u[0]) > -1) && (i = u.shift()), e = u.join(n);
322
- }
323
- return {
324
- key: e,
325
- namespaces: c(i) ? [i] : i
326
- };
327
- }
328
- translate(e, t, s) {
329
- if (typeof t != "object" && this.options.overloadTranslationOptionHandler && (t = this.options.overloadTranslationOptionHandler(arguments)), typeof t == "object" && (t = {
330
- ...t
331
- }), t || (t = {}), e == null) return "";
332
- Array.isArray(e) || (e = [String(e)]);
333
- const n = t.returnDetails !== void 0 ? t.returnDetails : this.options.returnDetails, i = t.keySeparator !== void 0 ? t.keySeparator : this.options.keySeparator, {
334
- key: r,
335
- namespaces: l
336
- } = this.extractFromKey(e[e.length - 1], t), o = l[l.length - 1], u = t.lng || this.language, h = t.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;
337
- if ((u == null ? void 0 : u.toLowerCase()) === "cimode") {
338
- if (h) {
339
- const w = t.nsSeparator || this.options.nsSeparator;
340
- return n ? {
341
- res: `${o}${w}${r}`,
342
- usedKey: r,
343
- exactUsedKey: r,
344
- usedLng: u,
345
- usedNS: o,
346
- usedParams: this.getUsedParamsDetails(t)
347
- } : `${o}${w}${r}`;
348
- }
349
- return n ? {
350
- res: r,
351
- usedKey: r,
352
- exactUsedKey: r,
353
- usedLng: u,
354
- usedNS: o,
355
- usedParams: this.getUsedParamsDetails(t)
356
- } : r;
357
- }
358
- const g = this.resolve(e, t);
359
- let f = g == null ? void 0 : g.res;
360
- const m = (g == null ? void 0 : g.usedKey) || r, d = (g == null ? void 0 : g.exactUsedKey) || r, p = ["[object Number]", "[object Function]", "[object RegExp]"], x = t.joinArrays !== void 0 ? t.joinArrays : this.options.joinArrays, S = !this.i18nFormat || this.i18nFormat.handleAsObject, O = t.count !== void 0 && !c(t.count), $ = Q.hasDefaultValue(t), R = O ? this.pluralResolver.getSuffix(u, t.count, t) : "", V = t.ordinal && O ? this.pluralResolver.getSuffix(u, t.count, {
361
- ordinal: !1
362
- }) : "", I = O && !t.ordinal && t.count === 0, y = I && t[`defaultValue${this.options.pluralSeparator}zero`] || t[`defaultValue${R}`] || t[`defaultValue${V}`] || t.defaultValue;
363
- let L = f;
364
- S && !f && $ && (L = y);
365
- const F = le(L), E = Object.prototype.toString.apply(L);
366
- if (S && L && F && p.indexOf(E) < 0 && !(c(x) && Array.isArray(L))) {
367
- if (!t.returnObjects && !this.options.returnObjects) {
368
- this.options.returnedObjectHandler || this.logger.warn("accessing an object - but returnObjects options is not enabled!");
369
- const w = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(m, L, {
370
- ...t,
371
- ns: l
372
- }) : `key '${r} (${this.language})' returned an object instead of string.`;
373
- return n ? (g.res = w, g.usedParams = this.getUsedParamsDetails(t), g) : w;
374
- }
375
- if (i) {
376
- const w = Array.isArray(L), C = w ? [] : {}, q = w ? d : m;
377
- for (const P in L)
378
- if (Object.prototype.hasOwnProperty.call(L, P)) {
379
- const k = `${q}${i}${P}`;
380
- $ && !f ? C[P] = this.translate(k, {
381
- ...t,
382
- defaultValue: le(y) ? y[P] : void 0,
383
- joinArrays: !1,
384
- ns: l
385
- }) : C[P] = this.translate(k, {
386
- ...t,
387
- joinArrays: !1,
388
- ns: l
389
- }), C[P] === k && (C[P] = L[P]);
390
- }
391
- f = C;
392
- }
393
- } else if (S && c(x) && Array.isArray(f))
394
- f = f.join(x), f && (f = this.extendTranslation(f, e, t, s));
395
- else {
396
- let w = !1, C = !1;
397
- !this.isValidLookup(f) && $ && (w = !0, f = y), this.isValidLookup(f) || (C = !0, f = r);
398
- const P = (t.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && C ? void 0 : f, k = $ && y !== f && this.options.updateMissing;
399
- if (C || w || k) {
400
- if (this.logger.log(k ? "updateKey" : "missingKey", u, o, r, k ? y : f), i) {
401
- const v = this.resolve(r, {
402
- ...t,
403
- keySeparator: !1
404
- });
405
- v && v.res && this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.");
406
- }
407
- let T = [];
408
- const z = this.languageUtils.getFallbackCodes(this.options.fallbackLng, t.lng || this.language);
409
- if (this.options.saveMissingTo === "fallback" && z && z[0])
410
- for (let v = 0; v < z.length; v++)
411
- T.push(z[v]);
412
- else this.options.saveMissingTo === "all" ? T = this.languageUtils.toResolveHierarchy(t.lng || this.language) : T.push(t.lng || this.language);
413
- const _ = (v, j, K) => {
414
- var te;
415
- const ee = $ && K !== f ? K : P;
416
- this.options.missingKeyHandler ? this.options.missingKeyHandler(v, o, j, ee, k, t) : (te = this.backendConnector) != null && te.saveMissing && this.backendConnector.saveMissing(v, o, j, ee, k, t), this.emit("missingKey", v, o, j, f);
417
- };
418
- this.options.saveMissing && (this.options.saveMissingPlurals && O ? T.forEach((v) => {
419
- const j = this.pluralResolver.getSuffixes(v, t);
420
- I && t[`defaultValue${this.options.pluralSeparator}zero`] && j.indexOf(`${this.options.pluralSeparator}zero`) < 0 && j.push(`${this.options.pluralSeparator}zero`), j.forEach((K) => {
421
- _([v], r + K, t[`defaultValue${K}`] || y);
422
- });
423
- }) : _(T, r, y));
424
- }
425
- f = this.extendTranslation(f, e, t, g, s), C && f === r && this.options.appendNamespaceToMissingKey && (f = `${o}:${r}`), (C || w) && this.options.parseMissingKeyHandler && (f = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${o}:${r}` : r, w ? f : void 0));
426
- }
427
- return n ? (g.res = f, g.usedParams = this.getUsedParamsDetails(t), g) : f;
428
- }
429
- extendTranslation(e, t, s, n, i) {
430
- var u, h;
431
- var r = this;
432
- if ((u = this.i18nFormat) != null && u.parse)
433
- e = this.i18nFormat.parse(e, {
434
- ...this.options.interpolation.defaultVariables,
435
- ...s
436
- }, s.lng || this.language || n.usedLng, n.usedNS, n.usedKey, {
437
- resolved: n
438
- });
439
- else if (!s.skipInterpolation) {
440
- s.interpolation && this.interpolator.init({
441
- ...s,
442
- interpolation: {
443
- ...this.options.interpolation,
444
- ...s.interpolation
445
- }
446
- });
447
- const g = c(e) && (((h = s == null ? void 0 : s.interpolation) == null ? void 0 : h.skipOnVariables) !== void 0 ? s.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables);
448
- let f;
449
- if (g) {
450
- const d = e.match(this.interpolator.nestingRegexp);
451
- f = d && d.length;
452
- }
453
- let m = s.replace && !c(s.replace) ? s.replace : s;
454
- if (this.options.interpolation.defaultVariables && (m = {
455
- ...this.options.interpolation.defaultVariables,
456
- ...m
457
- }), e = this.interpolator.interpolate(e, m, s.lng || this.language || n.usedLng, s), g) {
458
- const d = e.match(this.interpolator.nestingRegexp), p = d && d.length;
459
- f < p && (s.nest = !1);
460
- }
461
- !s.lng && n && n.res && (s.lng = this.language || n.usedLng), s.nest !== !1 && (e = this.interpolator.nest(e, function() {
462
- for (var d = arguments.length, p = new Array(d), x = 0; x < d; x++)
463
- p[x] = arguments[x];
464
- return (i == null ? void 0 : i[0]) === p[0] && !s.context ? (r.logger.warn(`It seems you are nesting recursively key: ${p[0]} in key: ${t[0]}`), null) : r.translate(...p, t);
465
- }, s)), s.interpolation && this.interpolator.reset();
466
- }
467
- const l = s.postProcess || this.options.postProcess, o = c(l) ? [l] : l;
468
- return e != null && (o != null && o.length) && s.applyPostProcessor !== !1 && (e = me.handle(o, e, t, this.options && this.options.postProcessPassResolved ? {
469
- i18nResolved: {
470
- ...n,
471
- usedParams: this.getUsedParamsDetails(s)
472
- },
473
- ...s
474
- } : s, this)), e;
475
- }
476
- resolve(e) {
477
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, s, n, i, r, l;
478
- return c(e) && (e = [e]), e.forEach((o) => {
479
- if (this.isValidLookup(s)) return;
480
- const u = this.extractFromKey(o, t), h = u.key;
481
- n = h;
482
- let g = u.namespaces;
483
- this.options.fallbackNS && (g = g.concat(this.options.fallbackNS));
484
- const f = t.count !== void 0 && !c(t.count), m = f && !t.ordinal && t.count === 0, d = 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);
485
- g.forEach((x) => {
486
- var S, O;
487
- this.isValidLookup(s) || (l = x, !oe[`${p[0]}-${x}`] && ((S = this.utils) != null && S.hasLoadedNamespace) && !((O = this.utils) != null && O.hasLoadedNamespace(l)) && (oe[`${p[0]}-${x}`] = !0, this.logger.warn(`key "${n}" 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(($) => {
488
- var I;
489
- if (this.isValidLookup(s)) return;
490
- r = $;
491
- const R = [h];
492
- if ((I = this.i18nFormat) != null && I.addLookupKeys)
493
- this.i18nFormat.addLookupKeys(R, h, $, x, t);
494
- else {
495
- let y;
496
- f && (y = this.pluralResolver.getSuffix($, t.count, t));
497
- const L = `${this.options.pluralSeparator}zero`, F = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;
498
- if (f && (R.push(h + y), t.ordinal && y.indexOf(F) === 0 && R.push(h + y.replace(F, this.options.pluralSeparator)), m && R.push(h + L)), d) {
499
- const E = `${h}${this.options.contextSeparator}${t.context}`;
500
- R.push(E), f && (R.push(E + y), t.ordinal && y.indexOf(F) === 0 && R.push(E + y.replace(F, this.options.pluralSeparator)), m && R.push(E + L));
501
- }
502
- }
503
- let V;
504
- for (; V = R.pop(); )
505
- this.isValidLookup(s) || (i = V, s = this.getResource($, x, V, t));
506
- }));
507
- });
508
- }), {
509
- res: s,
510
- usedKey: n,
511
- exactUsedKey: i,
512
- usedLng: r,
513
- usedNS: l
514
- };
515
- }
516
- isValidLookup(e) {
517
- return e !== void 0 && !(!this.options.returnNull && e === null) && !(!this.options.returnEmptyString && e === "");
518
- }
519
- getResource(e, t, s) {
520
- var i;
521
- let n = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
522
- return (i = this.i18nFormat) != null && i.getResource ? this.i18nFormat.getResource(e, t, s, n) : this.resourceStore.getResource(e, t, s, n);
523
- }
524
- getUsedParamsDetails() {
525
- let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
526
- const t = ["defaultValue", "ordinal", "context", "replace", "lng", "lngs", "fallbackLng", "ns", "keySeparator", "nsSeparator", "returnObjects", "returnDetails", "joinArrays", "postProcess", "interpolation"], s = e.replace && !c(e.replace);
527
- let n = s ? e.replace : e;
528
- if (s && typeof e.count < "u" && (n.count = e.count), this.options.interpolation.defaultVariables && (n = {
529
- ...this.options.interpolation.defaultVariables,
530
- ...n
531
- }), !s) {
532
- n = {
533
- ...n
534
- };
535
- for (const i of t)
536
- delete n[i];
537
- }
538
- return n;
539
- }
540
- static hasDefaultValue(e) {
541
- const t = "defaultValue";
542
- for (const s in e)
543
- if (Object.prototype.hasOwnProperty.call(e, s) && t === s.substring(0, t.length) && e[s] !== void 0)
544
- return !0;
545
- return !1;
546
- }
547
- }
548
- class ue {
549
- constructor(e) {
550
- this.options = e, this.supportedLngs = this.options.supportedLngs || !1, this.logger = N.create("languageUtils");
551
- }
552
- getScriptPartFromCode(e) {
553
- if (e = W(e), !e || e.indexOf("-") < 0) return null;
554
- const t = e.split("-");
555
- return t.length === 2 || (t.pop(), t[t.length - 1].toLowerCase() === "x") ? null : this.formatLanguageCode(t.join("-"));
556
- }
557
- getLanguagePartFromCode(e) {
558
- if (e = W(e), !e || e.indexOf("-") < 0) return e;
559
- const t = e.split("-");
560
- return this.formatLanguageCode(t[0]);
561
- }
562
- formatLanguageCode(e) {
563
- if (c(e) && e.indexOf("-") > -1) {
564
- let t;
565
- try {
566
- t = Intl.getCanonicalLocales(e)[0];
567
- } catch {
568
- }
569
- return t && this.options.lowerCaseLng && (t = t.toLowerCase()), t || (this.options.lowerCaseLng ? e.toLowerCase() : e);
570
- }
571
- return this.options.cleanCode || this.options.lowerCaseLng ? e.toLowerCase() : e;
572
- }
573
- isSupportedCode(e) {
574
- return (this.options.load === "languageOnly" || this.options.nonExplicitSupportedLngs) && (e = this.getLanguagePartFromCode(e)), !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.indexOf(e) > -1;
575
- }
576
- getBestMatchFromCodes(e) {
577
- if (!e) return null;
578
- let t;
579
- return e.forEach((s) => {
580
- if (t) return;
581
- const n = this.formatLanguageCode(s);
582
- (!this.options.supportedLngs || this.isSupportedCode(n)) && (t = n);
583
- }), !t && this.options.supportedLngs && e.forEach((s) => {
584
- if (t) return;
585
- const n = this.getLanguagePartFromCode(s);
586
- if (this.isSupportedCode(n)) return t = n;
587
- t = this.options.supportedLngs.find((i) => {
588
- if (i === n) return i;
589
- if (!(i.indexOf("-") < 0 && n.indexOf("-") < 0) && (i.indexOf("-") > 0 && n.indexOf("-") < 0 && i.substring(0, i.indexOf("-")) === n || i.indexOf(n) === 0 && n.length > 1))
590
- return i;
591
- });
592
- }), t || (t = this.getFallbackCodes(this.options.fallbackLng)[0]), t;
593
- }
594
- getFallbackCodes(e, t) {
595
- if (!e) return [];
596
- if (typeof e == "function" && (e = e(t)), c(e) && (e = [e]), Array.isArray(e)) return e;
597
- if (!t) return e.default || [];
598
- let s = e[t];
599
- return s || (s = e[this.getScriptPartFromCode(t)]), s || (s = e[this.formatLanguageCode(t)]), s || (s = e[this.getLanguagePartFromCode(t)]), s || (s = e.default), s || [];
600
- }
601
- toResolveHierarchy(e, t) {
602
- const s = this.getFallbackCodes(t || this.options.fallbackLng || [], e), n = [], i = (r) => {
603
- r && (this.isSupportedCode(r) ? n.push(r) : this.logger.warn(`rejecting language code not found in supportedLngs: ${r}`));
604
- };
605
- 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)), s.forEach((r) => {
606
- n.indexOf(r) < 0 && i(this.formatLanguageCode(r));
607
- }), n;
608
- }
609
- }
610
- const fe = {
611
- zero: 0,
612
- one: 1,
613
- two: 2,
614
- few: 3,
615
- many: 4,
616
- other: 5
617
- }, he = {
618
- select: (a) => a === 1 ? "one" : "other",
619
- resolvedOptions: () => ({
620
- pluralCategories: ["one", "other"]
621
- })
622
- };
623
- class Pe {
624
- constructor(e) {
625
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
626
- this.languageUtils = e, this.options = t, this.logger = N.create("pluralResolver"), this.pluralRulesCache = {};
627
- }
628
- addRule(e, t) {
629
- this.rules[e] = t;
630
- }
631
- clearCache() {
632
- this.pluralRulesCache = {};
633
- }
634
- getRule(e) {
635
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
636
- const s = W(e === "dev" ? "en" : e), n = t.ordinal ? "ordinal" : "cardinal", i = JSON.stringify({
637
- cleanedCode: s,
638
- type: n
639
- });
640
- if (i in this.pluralRulesCache)
641
- return this.pluralRulesCache[i];
642
- let r;
643
- try {
644
- r = new Intl.PluralRules(s, {
645
- type: n
646
- });
647
- } catch {
648
- if (!Intl)
649
- return this.logger.error("No Intl support, please use an Intl polyfill!"), he;
650
- if (!e.match(/-|_/)) return he;
651
- const o = this.languageUtils.getLanguagePartFromCode(e);
652
- r = this.getRule(o, t);
653
- }
654
- return this.pluralRulesCache[i] = r, r;
655
- }
656
- needsPlural(e) {
657
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, s = this.getRule(e, t);
658
- return s || (s = this.getRule("dev", t)), (s == null ? void 0 : s.resolvedOptions().pluralCategories.length) > 1;
659
- }
660
- getPluralFormsOfKey(e, t) {
661
- let s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
662
- return this.getSuffixes(e, s).map((n) => `${t}${n}`);
663
- }
664
- getSuffixes(e) {
665
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, s = this.getRule(e, t);
666
- return s || (s = this.getRule("dev", t)), s ? s.resolvedOptions().pluralCategories.sort((n, i) => fe[n] - fe[i]).map((n) => `${this.options.prepend}${t.ordinal ? `ordinal${this.options.prepend}` : ""}${n}`) : [];
667
- }
668
- getSuffix(e, t) {
669
- let s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
670
- const n = this.getRule(e, s);
671
- return n ? `${this.options.prepend}${s.ordinal ? `ordinal${this.options.prepend}` : ""}${n.select(t)}` : (this.logger.warn(`no plural rule found for: ${e}`), this.getSuffix("dev", t, s));
672
- }
673
- }
674
- const ge = function(a, e, t) {
675
- let s = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : ".", n = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : !0, i = Se(a, e, t);
676
- return !i && n && c(t) && (i = X(a, t, s), i === void 0 && (i = X(e, t, s))), i;
677
- }, Z = (a) => a.replace(/\$/g, "$$$$");
678
- class Ne {
679
- constructor() {
680
- var t;
681
- let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
682
- this.logger = N.create("interpolator"), this.options = e, this.format = ((t = e == null ? void 0 : e.interpolation) == null ? void 0 : t.format) || ((s) => s), this.init(e);
683
- }
684
- init() {
685
- let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
686
- e.interpolation || (e.interpolation = {
687
- escapeValue: !0
688
- });
689
- const {
690
- escape: t,
691
- escapeValue: s,
692
- useRawValueToEscape: n,
693
- prefix: i,
694
- prefixEscaped: r,
695
- suffix: l,
696
- suffixEscaped: o,
697
- formatSeparator: u,
698
- unescapeSuffix: h,
699
- unescapePrefix: g,
700
- nestingPrefix: f,
701
- nestingPrefixEscaped: m,
702
- nestingSuffix: d,
703
- nestingSuffixEscaped: p,
704
- nestingOptionsSeparator: x,
705
- maxReplaces: S,
706
- alwaysFormat: O
707
- } = e.interpolation;
708
- this.escape = t !== void 0 ? t : Le, this.escapeValue = s !== void 0 ? s : !0, this.useRawValueToEscape = n !== void 0 ? n : !1, this.prefix = i ? A(i) : r || "{{", this.suffix = l ? A(l) : o || "}}", this.formatSeparator = u || ",", this.unescapePrefix = h ? "" : g || "-", this.unescapeSuffix = this.unescapePrefix ? "" : h || "", this.nestingPrefix = f ? A(f) : m || A("$t("), this.nestingSuffix = d ? A(d) : p || A(")"), this.nestingOptionsSeparator = x || ",", this.maxReplaces = S || 1e3, this.alwaysFormat = O !== void 0 ? O : !1, this.resetRegExp();
709
- }
710
- reset() {
711
- this.options && this.init(this.options);
712
- }
713
- resetRegExp() {
714
- const e = (t, s) => (t == null ? void 0 : t.source) === s ? (t.lastIndex = 0, t) : new RegExp(s, "g");
715
- this.regexp = e(this.regexp, `${this.prefix}(.+?)${this.suffix}`), this.regexpUnescape = e(this.regexpUnescape, `${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`), this.nestingRegexp = e(this.nestingRegexp, `${this.nestingPrefix}(.+?)${this.nestingSuffix}`);
716
- }
717
- interpolate(e, t, s, n) {
718
- var m;
719
- let i, r, l;
720
- const o = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {}, u = (d) => {
721
- if (d.indexOf(this.formatSeparator) < 0) {
722
- const O = ge(t, o, d, this.options.keySeparator, this.options.ignoreJSONStructure);
723
- return this.alwaysFormat ? this.format(O, void 0, s, {
724
- ...n,
725
- ...t,
726
- interpolationkey: d
727
- }) : O;
728
- }
729
- const p = d.split(this.formatSeparator), x = p.shift().trim(), S = p.join(this.formatSeparator).trim();
730
- return this.format(ge(t, o, x, this.options.keySeparator, this.options.ignoreJSONStructure), S, s, {
731
- ...n,
732
- ...t,
733
- interpolationkey: x
734
- });
735
- };
736
- this.resetRegExp();
737
- const h = (n == null ? void 0 : n.missingInterpolationHandler) || this.options.missingInterpolationHandler, g = ((m = n == null ? void 0 : n.interpolation) == null ? void 0 : m.skipOnVariables) !== void 0 ? n.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables;
738
- return [{
739
- regex: this.regexpUnescape,
740
- safeValue: (d) => Z(d)
741
- }, {
742
- regex: this.regexp,
743
- safeValue: (d) => this.escapeValue ? Z(this.escape(d)) : Z(d)
744
- }].forEach((d) => {
745
- for (l = 0; i = d.regex.exec(e); ) {
746
- const p = i[1].trim();
747
- if (r = u(p), r === void 0)
748
- if (typeof h == "function") {
749
- const S = h(e, i, n);
750
- r = c(S) ? S : "";
751
- } else if (n && Object.prototype.hasOwnProperty.call(n, p))
752
- r = "";
753
- else if (g) {
754
- r = i[0];
755
- continue;
756
- } else
757
- this.logger.warn(`missed to pass in variable ${p} for interpolating ${e}`), r = "";
758
- else !c(r) && !this.useRawValueToEscape && (r = se(r));
759
- const x = d.safeValue(r);
760
- if (e = e.replace(i[0], x), g ? (d.regex.lastIndex += r.length, d.regex.lastIndex -= i[0].length) : d.regex.lastIndex = 0, l++, l >= this.maxReplaces)
761
- break;
762
- }
763
- }), e;
764
- }
765
- nest(e, t) {
766
- let s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, n, i, r;
767
- const l = (o, u) => {
768
- const h = this.nestingOptionsSeparator;
769
- if (o.indexOf(h) < 0) return o;
770
- const g = o.split(new RegExp(`${h}[ ]*{`));
771
- let f = `{${g[1]}`;
772
- o = g[0], f = this.interpolate(f, r);
773
- const m = f.match(/'/g), d = f.match(/"/g);
774
- (((m == null ? void 0 : m.length) ?? 0) % 2 === 0 && !d || d.length % 2 !== 0) && (f = f.replace(/'/g, '"'));
775
- try {
776
- r = JSON.parse(f), u && (r = {
777
- ...u,
778
- ...r
779
- });
780
- } catch (p) {
781
- return this.logger.warn(`failed parsing options string in nesting for key ${o}`, p), `${o}${h}${f}`;
782
- }
783
- return r.defaultValue && r.defaultValue.indexOf(this.prefix) > -1 && delete r.defaultValue, o;
784
- };
785
- for (; n = this.nestingRegexp.exec(e); ) {
786
- let o = [];
787
- r = {
788
- ...s
789
- }, r = r.replace && !c(r.replace) ? r.replace : r, r.applyPostProcessor = !1, delete r.defaultValue;
790
- let u = !1;
791
- if (n[0].indexOf(this.formatSeparator) !== -1 && !/{.*}/.test(n[1])) {
792
- const h = n[1].split(this.formatSeparator).map((g) => g.trim());
793
- n[1] = h.shift(), o = h, u = !0;
794
- }
795
- if (i = t(l.call(this, n[1].trim(), r), r), i && n[0] === e && !c(i)) return i;
796
- c(i) || (i = se(i)), i || (this.logger.warn(`missed to resolve ${n[1]} for nesting ${e}`), i = ""), u && (i = o.reduce((h, g) => this.format(h, g, s.lng, {
797
- ...s,
798
- interpolationkey: n[1].trim()
799
- }), i.trim())), e = e.replace(n[0], i), this.regexp.lastIndex = 0;
800
- }
801
- return e;
802
- }
803
- }
804
- const ke = (a) => {
805
- let e = a.toLowerCase().trim();
806
- const t = {};
807
- if (a.indexOf("(") > -1) {
808
- const s = a.split("(");
809
- e = s[0].toLowerCase().trim();
810
- const n = s[1].substring(0, s[1].length - 1);
811
- e === "currency" && n.indexOf(":") < 0 ? t.currency || (t.currency = n.trim()) : e === "relativetime" && n.indexOf(":") < 0 ? t.range || (t.range = n.trim()) : n.split(";").forEach((r) => {
812
- if (r) {
813
- const [l, ...o] = r.split(":"), u = o.join(":").trim().replace(/^'+|'+$/g, ""), h = l.trim();
814
- t[h] || (t[h] = u), u === "false" && (t[h] = !1), u === "true" && (t[h] = !0), isNaN(u) || (t[h] = parseInt(u, 10));
815
- }
816
- });
817
- }
818
- return {
819
- formatName: e,
820
- formatOptions: t
821
- };
822
- }, D = (a) => {
823
- const e = {};
824
- return (t, s, n) => {
825
- let i = n;
826
- n && n.interpolationkey && n.formatParams && n.formatParams[n.interpolationkey] && n[n.interpolationkey] && (i = {
827
- ...i,
828
- [n.interpolationkey]: void 0
829
- });
830
- const r = s + JSON.stringify(i);
831
- let l = e[r];
832
- return l || (l = a(W(s), n), e[r] = l), l(t);
833
- };
834
- };
835
- class je {
836
- constructor() {
837
- let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
838
- this.logger = N.create("formatter"), this.options = e, this.formats = {
839
- number: D((t, s) => {
840
- const n = new Intl.NumberFormat(t, {
841
- ...s
842
- });
843
- return (i) => n.format(i);
844
- }),
845
- currency: D((t, s) => {
846
- const n = new Intl.NumberFormat(t, {
847
- ...s,
848
- style: "currency"
849
- });
850
- return (i) => n.format(i);
851
- }),
852
- datetime: D((t, s) => {
853
- const n = new Intl.DateTimeFormat(t, {
854
- ...s
855
- });
856
- return (i) => n.format(i);
857
- }),
858
- relativetime: D((t, s) => {
859
- const n = new Intl.RelativeTimeFormat(t, {
860
- ...s
861
- });
862
- return (i) => n.format(i, s.range || "day");
863
- }),
864
- list: D((t, s) => {
865
- const n = new Intl.ListFormat(t, {
866
- ...s
867
- });
868
- return (i) => n.format(i);
869
- })
870
- }, this.init(e);
871
- }
872
- init(e) {
873
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
874
- interpolation: {}
875
- };
876
- this.formatSeparator = t.interpolation.formatSeparator || ",";
877
- }
878
- add(e, t) {
879
- this.formats[e.toLowerCase().trim()] = t;
880
- }
881
- addCached(e, t) {
882
- this.formats[e.toLowerCase().trim()] = D(t);
883
- }
884
- format(e, t, s) {
885
- let n = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
886
- const i = t.split(this.formatSeparator);
887
- if (i.length > 1 && i[0].indexOf("(") > 1 && i[0].indexOf(")") < 0 && i.find((l) => l.indexOf(")") > -1)) {
888
- const l = i.findIndex((o) => o.indexOf(")") > -1);
889
- i[0] = [i[0], ...i.splice(1, l)].join(this.formatSeparator);
890
- }
891
- return i.reduce((l, o) => {
892
- var g;
893
- const {
894
- formatName: u,
895
- formatOptions: h
896
- } = ke(o);
897
- if (this.formats[u]) {
898
- let f = l;
899
- try {
900
- const m = ((g = n == null ? void 0 : n.formatParams) == null ? void 0 : g[n.interpolationkey]) || {}, d = m.locale || m.lng || n.locale || n.lng || s;
901
- f = this.formats[u](l, d, {
902
- ...h,
903
- ...n,
904
- ...m
905
- });
906
- } catch (m) {
907
- this.logger.warn(m);
908
- }
909
- return f;
910
- } else
911
- this.logger.warn(`there was no format function for ${u}`);
912
- return l;
913
- }, e);
914
- }
915
- }
916
- const Fe = (a, e) => {
917
- a.pending[e] !== void 0 && (delete a.pending[e], a.pendingCount--);
918
- };
919
- class Ee extends G {
920
- constructor(e, t, s) {
921
- var i, r;
922
- let n = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
923
- super(), this.backend = e, this.store = t, this.services = s, this.languageUtils = s.languageUtils, this.options = n, this.logger = N.create("backendConnector"), this.waitingReads = [], this.maxParallelReads = n.maxParallelReads || 10, this.readingCalls = 0, this.maxRetries = n.maxRetries >= 0 ? n.maxRetries : 5, this.retryTimeout = n.retryTimeout >= 1 ? n.retryTimeout : 350, this.state = {}, this.queue = [], (r = (i = this.backend) == null ? void 0 : i.init) == null || r.call(i, s, n.backend, n);
924
- }
925
- queueLoad(e, t, s, n) {
926
- const i = {}, r = {}, l = {}, o = {};
927
- return e.forEach((u) => {
928
- let h = !0;
929
- t.forEach((g) => {
930
- const f = `${u}|${g}`;
931
- !s.reload && this.store.hasResourceBundle(u, g) ? this.state[f] = 2 : this.state[f] < 0 || (this.state[f] === 1 ? r[f] === void 0 && (r[f] = !0) : (this.state[f] = 1, h = !1, r[f] === void 0 && (r[f] = !0), i[f] === void 0 && (i[f] = !0), o[g] === void 0 && (o[g] = !0)));
932
- }), h || (l[u] = !0);
933
- }), (Object.keys(i).length || Object.keys(r).length) && this.queue.push({
934
- pending: r,
935
- pendingCount: Object.keys(r).length,
936
- loaded: {},
937
- errors: [],
938
- callback: n
939
- }), {
940
- toLoad: Object.keys(i),
941
- pending: Object.keys(r),
942
- toLoadLanguages: Object.keys(l),
943
- toLoadNamespaces: Object.keys(o)
944
- };
945
- }
946
- loaded(e, t, s) {
947
- const n = e.split("|"), i = n[0], r = n[1];
948
- t && this.emit("failedLoading", i, r, t), !t && s && this.store.addResourceBundle(i, r, s, void 0, void 0, {
949
- skipCopy: !0
950
- }), this.state[e] = t ? -1 : 2, t && s && (this.state[e] = 0);
951
- const l = {};
952
- this.queue.forEach((o) => {
953
- be(o.loaded, [i], r), Fe(o, e), t && o.errors.push(t), o.pendingCount === 0 && !o.done && (Object.keys(o.loaded).forEach((u) => {
954
- l[u] || (l[u] = {});
955
- const h = o.loaded[u];
956
- h.length && h.forEach((g) => {
957
- l[u][g] === void 0 && (l[u][g] = !0);
958
- });
959
- }), o.done = !0, o.errors.length ? o.callback(o.errors) : o.callback());
960
- }), this.emit("loaded", l), this.queue = this.queue.filter((o) => !o.done);
961
- }
962
- read(e, t, s) {
963
- let n = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 0, i = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : this.retryTimeout, r = arguments.length > 5 ? arguments[5] : void 0;
964
- if (!e.length) return r(null, {});
965
- if (this.readingCalls >= this.maxParallelReads) {
966
- this.waitingReads.push({
967
- lng: e,
968
- ns: t,
969
- fcName: s,
970
- tried: n,
971
- wait: i,
972
- callback: r
973
- });
974
- return;
975
- }
976
- this.readingCalls++;
977
- const l = (u, h) => {
978
- if (this.readingCalls--, this.waitingReads.length > 0) {
979
- const g = this.waitingReads.shift();
980
- this.read(g.lng, g.ns, g.fcName, g.tried, g.wait, g.callback);
981
- }
982
- if (u && h && n < this.maxRetries) {
983
- setTimeout(() => {
984
- this.read.call(this, e, t, s, n + 1, i * 2, r);
985
- }, i);
986
- return;
987
- }
988
- r(u, h);
989
- }, o = this.backend[s].bind(this.backend);
990
- if (o.length === 2) {
991
- try {
992
- const u = o(e, t);
993
- u && typeof u.then == "function" ? u.then((h) => l(null, h)).catch(l) : l(null, u);
994
- } catch (u) {
995
- l(u);
996
- }
997
- return;
998
- }
999
- return o(e, t, l);
1000
- }
1001
- prepareLoading(e, t) {
1002
- let s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, n = arguments.length > 3 ? arguments[3] : void 0;
1003
- if (!this.backend)
1004
- return this.logger.warn("No backend was added via i18next.use. Will not load resources."), n && n();
1005
- c(e) && (e = this.languageUtils.toResolveHierarchy(e)), c(t) && (t = [t]);
1006
- const i = this.queueLoad(e, t, s, n);
1007
- if (!i.toLoad.length)
1008
- return i.pending.length || n(), null;
1009
- i.toLoad.forEach((r) => {
1010
- this.loadOne(r);
1011
- });
1012
- }
1013
- load(e, t, s) {
1014
- this.prepareLoading(e, t, {}, s);
1015
- }
1016
- reload(e, t, s) {
1017
- this.prepareLoading(e, t, {
1018
- reload: !0
1019
- }, s);
1020
- }
1021
- loadOne(e) {
1022
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "";
1023
- const s = e.split("|"), n = s[0], i = s[1];
1024
- this.read(n, i, "read", void 0, void 0, (r, l) => {
1025
- r && this.logger.warn(`${t}loading namespace ${i} for language ${n} failed`, r), !r && l && this.logger.log(`${t}loaded namespace ${i} for language ${n}`, l), this.loaded(e, r, l);
1026
- });
1027
- }
1028
- saveMissing(e, t, s, n, i) {
1029
- var o, u, h, g, f;
1030
- let r = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : {}, l = arguments.length > 6 && arguments[6] !== void 0 ? arguments[6] : () => {
1031
- };
1032
- if ((u = (o = this.services) == null ? void 0 : o.utils) != null && u.hasLoadedNamespace && !((g = (h = this.services) == null ? void 0 : h.utils) != null && g.hasLoadedNamespace(t))) {
1033
- this.logger.warn(`did not save key "${s}" 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!!!");
1034
- return;
1035
- }
1036
- if (!(s == null || s === "")) {
1037
- if ((f = this.backend) != null && f.create) {
1038
- const m = {
1039
- ...r,
1040
- isUpdate: i
1041
- }, d = this.backend.create.bind(this.backend);
1042
- if (d.length < 6)
1043
- try {
1044
- let p;
1045
- d.length === 5 ? p = d(e, t, s, n, m) : p = d(e, t, s, n), p && typeof p.then == "function" ? p.then((x) => l(null, x)).catch(l) : l(null, p);
1046
- } catch (p) {
1047
- l(p);
1048
- }
1049
- else
1050
- d(e, t, s, n, l, m);
1051
- }
1052
- !e || !e[0] || this.store.addResource(e[0], t, s, n);
1053
- }
1054
- }
1055
- }
1056
- const de = () => ({
1057
- debug: !1,
1058
- initAsync: !0,
1059
- ns: ["translation"],
1060
- defaultNS: ["translation"],
1061
- fallbackLng: ["dev"],
1062
- fallbackNS: !1,
1063
- supportedLngs: !1,
1064
- nonExplicitSupportedLngs: !1,
1065
- load: "all",
1066
- preload: !1,
1067
- simplifyPluralSuffix: !0,
1068
- keySeparator: ".",
1069
- nsSeparator: ":",
1070
- pluralSeparator: "_",
1071
- contextSeparator: "_",
1072
- partialBundledLanguages: !1,
1073
- saveMissing: !1,
1074
- updateMissing: !1,
1075
- saveMissingTo: "fallback",
1076
- saveMissingPlurals: !0,
1077
- missingKeyHandler: !1,
1078
- missingInterpolationHandler: !1,
1079
- postProcess: !1,
1080
- postProcessPassResolved: !1,
1081
- returnNull: !1,
1082
- returnEmptyString: !0,
1083
- returnObjects: !1,
1084
- joinArrays: !1,
1085
- returnedObjectHandler: !1,
1086
- parseMissingKeyHandler: !1,
1087
- appendNamespaceToMissingKey: !1,
1088
- appendNamespaceToCIMode: !1,
1089
- overloadTranslationOptionHandler: (a) => {
1090
- let e = {};
1091
- if (typeof a[1] == "object" && (e = a[1]), c(a[1]) && (e.defaultValue = a[1]), c(a[2]) && (e.tDescription = a[2]), typeof a[2] == "object" || typeof a[3] == "object") {
1092
- const t = a[3] || a[2];
1093
- Object.keys(t).forEach((s) => {
1094
- e[s] = t[s];
1095
- });
1096
- }
1097
- return e;
1098
- },
1099
- interpolation: {
1100
- escapeValue: !0,
1101
- format: (a) => a,
1102
- prefix: "{{",
1103
- suffix: "}}",
1104
- formatSeparator: ",",
1105
- unescapePrefix: "-",
1106
- nestingPrefix: "$t(",
1107
- nestingSuffix: ")",
1108
- nestingOptionsSeparator: ",",
1109
- maxReplaces: 1e3,
1110
- skipOnVariables: !0
1111
- }
1112
- }), ce = (a) => {
1113
- var e, t;
1114
- return c(a.ns) && (a.ns = [a.ns]), c(a.fallbackLng) && (a.fallbackLng = [a.fallbackLng]), c(a.fallbackNS) && (a.fallbackNS = [a.fallbackNS]), ((t = (e = a.supportedLngs) == null ? void 0 : e.indexOf) == null ? void 0 : t.call(e, "cimode")) < 0 && (a.supportedLngs = a.supportedLngs.concat(["cimode"])), typeof a.initImmediate == "boolean" && (a.initAsync = a.initImmediate), a;
1115
- }, B = () => {
1116
- }, Ae = (a) => {
1117
- Object.getOwnPropertyNames(Object.getPrototypeOf(a)).forEach((t) => {
1118
- typeof a[t] == "function" && (a[t] = a[t].bind(a));
1119
- });
1120
- };
1121
- class H extends G {
1122
- constructor() {
1123
- let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, t = arguments.length > 1 ? arguments[1] : void 0;
1124
- if (super(), this.options = ce(e), this.services = {}, this.logger = N, this.modules = {
1125
- external: []
1126
- }, Ae(this), t && !this.isInitialized && !e.isClone) {
1127
- if (!this.options.initAsync)
1128
- return this.init(e, t), this;
1129
- setTimeout(() => {
1130
- this.init(e, t);
1131
- }, 0);
1132
- }
1133
- }
1134
- init() {
1135
- var e = this;
1136
- let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, s = arguments.length > 1 ? arguments[1] : void 0;
1137
- this.isInitializing = !0, typeof t == "function" && (s = t, t = {}), t.defaultNS == null && t.ns && (c(t.ns) ? t.defaultNS = t.ns : t.ns.indexOf("translation") < 0 && (t.defaultNS = t.ns[0]));
1138
- const n = de();
1139
- this.options = {
1140
- ...n,
1141
- ...this.options,
1142
- ...ce(t)
1143
- }, this.options.interpolation = {
1144
- ...n.interpolation,
1145
- ...this.options.interpolation
1146
- }, t.keySeparator !== void 0 && (this.options.userDefinedKeySeparator = t.keySeparator), t.nsSeparator !== void 0 && (this.options.userDefinedNsSeparator = t.nsSeparator);
1147
- const i = (h) => h ? typeof h == "function" ? new h() : h : null;
1148
- if (!this.options.isClone) {
1149
- this.modules.logger ? N.init(i(this.modules.logger), this.options) : N.init(null, this.options);
1150
- let h;
1151
- this.modules.formatter ? h = this.modules.formatter : h = je;
1152
- const g = new ue(this.options);
1153
- this.store = new ae(this.options.resources, this.options);
1154
- const f = this.services;
1155
- f.logger = N, f.resourceStore = this.store, f.languageUtils = g, f.pluralResolver = new Pe(g, {
1156
- prepend: this.options.pluralSeparator,
1157
- simplifyPluralSuffix: this.options.simplifyPluralSuffix
1158
- }), h && (!this.options.interpolation.format || this.options.interpolation.format === n.interpolation.format) && (f.formatter = i(h), f.formatter.init(f, this.options), this.options.interpolation.format = f.formatter.format.bind(f.formatter)), f.interpolator = new Ne(this.options), f.utils = {
1159
- hasLoadedNamespace: this.hasLoadedNamespace.bind(this)
1160
- }, f.backendConnector = new Ee(i(this.modules.backend), f.resourceStore, f, this.options), f.backendConnector.on("*", function(m) {
1161
- for (var d = arguments.length, p = new Array(d > 1 ? d - 1 : 0), x = 1; x < d; x++)
1162
- p[x - 1] = arguments[x];
1163
- e.emit(m, ...p);
1164
- }), this.modules.languageDetector && (f.languageDetector = i(this.modules.languageDetector), f.languageDetector.init && f.languageDetector.init(f, this.options.detection, this.options)), this.modules.i18nFormat && (f.i18nFormat = i(this.modules.i18nFormat), f.i18nFormat.init && f.i18nFormat.init(this)), this.translator = new Q(this.services, this.options), this.translator.on("*", function(m) {
1165
- for (var d = arguments.length, p = new Array(d > 1 ? d - 1 : 0), x = 1; x < d; x++)
1166
- p[x - 1] = arguments[x];
1167
- e.emit(m, ...p);
1168
- }), this.modules.external.forEach((m) => {
1169
- m.init && m.init(this);
1170
- });
1171
- }
1172
- if (this.format = this.options.interpolation.format, s || (s = B), this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) {
1173
- const h = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
1174
- h.length > 0 && h[0] !== "dev" && (this.options.lng = h[0]);
1175
- }
1176
- !this.services.languageDetector && !this.options.lng && this.logger.warn("init: no languageDetector is used and no lng is defined"), ["getResource", "hasResourceBundle", "getResourceBundle", "getDataByLanguage"].forEach((h) => {
1177
- this[h] = function() {
1178
- return e.store[h](...arguments);
1179
- };
1180
- }), ["addResource", "addResources", "addResourceBundle", "removeResourceBundle"].forEach((h) => {
1181
- this[h] = function() {
1182
- return e.store[h](...arguments), e;
1183
- };
1184
- });
1185
- const o = U(), u = () => {
1186
- const h = (g, f) => {
1187
- 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), s(g, f);
1188
- };
1189
- if (this.languages && !this.isInitialized) return h(null, this.t.bind(this));
1190
- this.changeLanguage(this.options.lng, h);
1191
- };
1192
- return this.options.resources || !this.options.initAsync ? u() : setTimeout(u, 0), o;
1193
- }
1194
- loadResources(e) {
1195
- var i, r;
1196
- let s = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : B;
1197
- const n = c(e) ? e : this.language;
1198
- if (typeof e == "function" && (s = e), !this.options.resources || this.options.partialBundledLanguages) {
1199
- if ((n == null ? void 0 : n.toLowerCase()) === "cimode" && (!this.options.preload || this.options.preload.length === 0)) return s();
1200
- const l = [], o = (u) => {
1201
- if (!u || u === "cimode") return;
1202
- this.services.languageUtils.toResolveHierarchy(u).forEach((g) => {
1203
- g !== "cimode" && l.indexOf(g) < 0 && l.push(g);
1204
- });
1205
- };
1206
- n ? o(n) : this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach((h) => o(h)), (r = (i = this.options.preload) == null ? void 0 : i.forEach) == null || r.call(i, (u) => o(u)), this.services.backendConnector.load(l, this.options.ns, (u) => {
1207
- !u && !this.resolvedLanguage && this.language && this.setResolvedLanguage(this.language), s(u);
1208
- });
1209
- } else
1210
- s(null);
1211
- }
1212
- reloadResources(e, t, s) {
1213
- const n = U();
1214
- return typeof e == "function" && (s = e, e = void 0), typeof t == "function" && (s = t, t = void 0), e || (e = this.languages), t || (t = this.options.ns), s || (s = B), this.services.backendConnector.reload(e, t, (i) => {
1215
- n.resolve(), s(i);
1216
- }), n;
1217
- }
1218
- use(e) {
1219
- if (!e) throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");
1220
- if (!e.type) throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");
1221
- 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" && me.addPostProcessor(e), e.type === "formatter" && (this.modules.formatter = e), e.type === "3rdParty" && this.modules.external.push(e), this;
1222
- }
1223
- setResolvedLanguage(e) {
1224
- if (!(!e || !this.languages) && !(["cimode", "dev"].indexOf(e) > -1))
1225
- for (let t = 0; t < this.languages.length; t++) {
1226
- const s = this.languages[t];
1227
- if (!(["cimode", "dev"].indexOf(s) > -1) && this.store.hasLanguageSomeTranslations(s)) {
1228
- this.resolvedLanguage = s;
1229
- break;
1230
- }
1231
- }
1232
- }
1233
- changeLanguage(e, t) {
1234
- var s = this;
1235
- this.isLanguageChangingTo = e;
1236
- const n = U();
1237
- this.emit("languageChanging", e);
1238
- const i = (o) => {
1239
- this.language = o, this.languages = this.services.languageUtils.toResolveHierarchy(o), this.resolvedLanguage = void 0, this.setResolvedLanguage(o);
1240
- }, r = (o, u) => {
1241
- u ? (i(u), this.translator.changeLanguage(u), this.isLanguageChangingTo = void 0, this.emit("languageChanged", u), this.logger.log("languageChanged", u)) : this.isLanguageChangingTo = void 0, n.resolve(function() {
1242
- return s.t(...arguments);
1243
- }), t && t(o, function() {
1244
- return s.t(...arguments);
1245
- });
1246
- }, l = (o) => {
1247
- var h, g;
1248
- !e && !o && this.services.languageDetector && (o = []);
1249
- const u = c(o) ? o : this.services.languageUtils.getBestMatchFromCodes(o);
1250
- u && (this.language || i(u), this.translator.language || this.translator.changeLanguage(u), (g = (h = this.services.languageDetector) == null ? void 0 : h.cacheUserLanguage) == null || g.call(h, u)), this.loadResources(u, (f) => {
1251
- r(f, u);
1252
- });
1253
- };
1254
- return !e && this.services.languageDetector && !this.services.languageDetector.async ? l(this.services.languageDetector.detect()) : !e && this.services.languageDetector && this.services.languageDetector.async ? this.services.languageDetector.detect.length === 0 ? this.services.languageDetector.detect().then(l) : this.services.languageDetector.detect(l) : l(e), n;
1255
- }
1256
- getFixedT(e, t, s) {
1257
- var n = this;
1258
- const i = function(r, l) {
1259
- let o;
1260
- if (typeof l != "object") {
1261
- for (var u = arguments.length, h = new Array(u > 2 ? u - 2 : 0), g = 2; g < u; g++)
1262
- h[g - 2] = arguments[g];
1263
- o = n.options.overloadTranslationOptionHandler([r, l].concat(h));
1264
- } else
1265
- o = {
1266
- ...l
1267
- };
1268
- o.lng = o.lng || i.lng, o.lngs = o.lngs || i.lngs, o.ns = o.ns || i.ns, o.keyPrefix !== "" && (o.keyPrefix = o.keyPrefix || s || i.keyPrefix);
1269
- const f = n.options.keySeparator || ".";
1270
- let m;
1271
- return o.keyPrefix && Array.isArray(r) ? m = r.map((d) => `${o.keyPrefix}${f}${d}`) : m = o.keyPrefix ? `${o.keyPrefix}${f}${r}` : r, n.t(m, o);
1272
- };
1273
- return c(e) ? i.lng = e : i.lngs = e, i.ns = t, i.keyPrefix = s, i;
1274
- }
1275
- t() {
1276
- var n;
1277
- for (var e = arguments.length, t = new Array(e), s = 0; s < e; s++)
1278
- t[s] = arguments[s];
1279
- return (n = this.translator) == null ? void 0 : n.translate(...t);
1280
- }
1281
- exists() {
1282
- var n;
1283
- for (var e = arguments.length, t = new Array(e), s = 0; s < e; s++)
1284
- t[s] = arguments[s];
1285
- return (n = this.translator) == null ? void 0 : n.exists(...t);
1286
- }
1287
- setDefaultNamespace(e) {
1288
- this.options.defaultNS = e;
1289
- }
1290
- hasLoadedNamespace(e) {
1291
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
1292
- if (!this.isInitialized)
1293
- return this.logger.warn("hasLoadedNamespace: i18next was not initialized", this.languages), !1;
1294
- if (!this.languages || !this.languages.length)
1295
- return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty", this.languages), !1;
1296
- const s = t.lng || this.resolvedLanguage || this.languages[0], n = this.options ? this.options.fallbackLng : !1, i = this.languages[this.languages.length - 1];
1297
- if (s.toLowerCase() === "cimode") return !0;
1298
- const r = (l, o) => {
1299
- const u = this.services.backendConnector.state[`${l}|${o}`];
1300
- return u === -1 || u === 0 || u === 2;
1301
- };
1302
- if (t.precheck) {
1303
- const l = t.precheck(this, r);
1304
- if (l !== void 0) return l;
1305
- }
1306
- return !!(this.hasResourceBundle(s, e) || !this.services.backendConnector.backend || this.options.resources && !this.options.partialBundledLanguages || r(s, e) && (!n || r(i, e)));
1307
- }
1308
- loadNamespaces(e, t) {
1309
- const s = U();
1310
- return this.options.ns ? (c(e) && (e = [e]), e.forEach((n) => {
1311
- this.options.ns.indexOf(n) < 0 && this.options.ns.push(n);
1312
- }), this.loadResources((n) => {
1313
- s.resolve(), t && t(n);
1314
- }), s) : (t && t(), Promise.resolve());
1315
- }
1316
- loadLanguages(e, t) {
1317
- const s = U();
1318
- c(e) && (e = [e]);
1319
- const n = this.options.preload || [], i = e.filter((r) => n.indexOf(r) < 0 && this.services.languageUtils.isSupportedCode(r));
1320
- return i.length ? (this.options.preload = n.concat(i), this.loadResources((r) => {
1321
- s.resolve(), t && t(r);
1322
- }), s) : (t && t(), Promise.resolve());
1323
- }
1324
- dir(e) {
1325
- var n, i;
1326
- if (e || (e = this.resolvedLanguage || (((n = this.languages) == null ? void 0 : n.length) > 0 ? this.languages[0] : this.language)), !e) return "rtl";
1327
- 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"], s = ((i = this.services) == null ? void 0 : i.languageUtils) || new ue(de());
1328
- return t.indexOf(s.getLanguagePartFromCode(e)) > -1 || e.toLowerCase().indexOf("-arab") > 1 ? "rtl" : "ltr";
1329
- }
1330
- static createInstance() {
1331
- let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, t = arguments.length > 1 ? arguments[1] : void 0;
1332
- return new H(e, t);
1333
- }
1334
- cloneInstance() {
1335
- let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : B;
1336
- const s = e.forkResourceStore;
1337
- s && delete e.forkResourceStore;
1338
- const n = {
1339
- ...this.options,
1340
- ...e,
1341
- isClone: !0
1342
- }, i = new H(n);
1343
- if ((e.debug !== void 0 || e.prefix !== void 0) && (i.logger = i.logger.clone(e)), ["store", "services", "language"].forEach((l) => {
1344
- i[l] = this[l];
1345
- }), i.services = {
1346
- ...this.services
1347
- }, i.services.utils = {
1348
- hasLoadedNamespace: i.hasLoadedNamespace.bind(i)
1349
- }, s) {
1350
- const l = Object.keys(this.store.data).reduce((o, u) => (o[u] = {
1351
- ...this.store.data[u]
1352
- }, Object.keys(o[u]).reduce((h, g) => (h[g] = {
1353
- ...o[u][g]
1354
- }, h), {})), {});
1355
- i.store = new ae(l, n), i.services.resourceStore = i.store;
1356
- }
1357
- return i.translator = new Q(i.services, n), i.translator.on("*", function(l) {
1358
- for (var o = arguments.length, u = new Array(o > 1 ? o - 1 : 0), h = 1; h < o; h++)
1359
- u[h - 1] = arguments[h];
1360
- i.emit(l, ...u);
1361
- }), i.init(n, t), i.translator.options = n, i.translator.backendConnector.services.utils = {
1362
- hasLoadedNamespace: i.hasLoadedNamespace.bind(i)
1363
- }, i;
1364
- }
1365
- toJSON() {
1366
- return {
1367
- options: this.options,
1368
- store: this.store,
1369
- language: this.language,
1370
- languages: this.languages,
1371
- resolvedLanguage: this.resolvedLanguage
1372
- };
1373
- }
1374
- }
1375
- const b = H.createInstance();
1376
- b.createInstance = H.createInstance;
1377
- b.createInstance;
1378
- b.dir;
1379
- b.init;
1380
- b.loadResources;
1381
- b.reloadResources;
1382
- b.use;
1383
- b.changeLanguage;
1384
- b.getFixedT;
1385
- b.t;
1386
- b.exists;
1387
- b.setDefaultNamespace;
1388
- b.hasLoadedNamespace;
1389
- b.loadNamespaces;
1390
- b.loadLanguages;
1391
- export {
1392
- b as default
1393
- };