@producteca/producteca-ui-kit 0.0.5 → 0.0.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.
@@ -1,1726 +0,0 @@
1
- import { jsx as O, jsxs as U } from "react/jsx-runtime";
2
- const Qe = ({ type: i = "button", variant: e = "primary", size: t = "lg", label: s, outline: n, ...r }) => /* @__PURE__ */ O("button", { type: i, className: `btn ${t} ${e} ${n ? "outline" : ""} `, ...r, children: s }), de = {
3
- type: "logger",
4
- log(i) {
5
- this.output("log", i);
6
- },
7
- warn(i) {
8
- this.output("warn", i);
9
- },
10
- error(i) {
11
- this.output("error", i);
12
- },
13
- output(i, e) {
14
- console && console[i] && console[i].apply(console, e);
15
- }
16
- };
17
- class z {
18
- constructor(e) {
19
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
20
- this.init(e, t);
21
- }
22
- init(e) {
23
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
24
- this.prefix = t.prefix || "i18next:", this.logger = e || de, this.options = t, this.debug = t.debug;
25
- }
26
- log() {
27
- for (var e = arguments.length, t = new Array(e), s = 0; s < e; s++)
28
- t[s] = arguments[s];
29
- return this.forward(t, "log", "", !0);
30
- }
31
- warn() {
32
- for (var e = arguments.length, t = new Array(e), s = 0; s < e; s++)
33
- t[s] = arguments[s];
34
- return this.forward(t, "warn", "", !0);
35
- }
36
- error() {
37
- for (var e = arguments.length, t = new Array(e), s = 0; s < e; s++)
38
- t[s] = arguments[s];
39
- return this.forward(t, "error", "");
40
- }
41
- deprecate() {
42
- for (var e = arguments.length, t = new Array(e), s = 0; s < e; s++)
43
- t[s] = arguments[s];
44
- return this.forward(t, "warn", "WARNING DEPRECATED: ", !0);
45
- }
46
- forward(e, t, s, n) {
47
- return n && !this.debug ? null : (typeof e[0] == "string" && (e[0] = `${s}${this.prefix} ${e[0]}`), this.logger[t](e));
48
- }
49
- create(e) {
50
- return new z(this.logger, {
51
- prefix: `${this.prefix}:${e}:`,
52
- ...this.options
53
- });
54
- }
55
- clone(e) {
56
- return e = e || this.options, e.prefix = e.prefix || this.prefix, new z(this.logger, e);
57
- }
58
- }
59
- var C = new z();
60
- class Z {
61
- constructor() {
62
- this.observers = {};
63
- }
64
- on(e, t) {
65
- return e.split(" ").forEach((s) => {
66
- this.observers[s] || (this.observers[s] = /* @__PURE__ */ new Map());
67
- const n = this.observers[s].get(t) || 0;
68
- this.observers[s].set(t, n + 1);
69
- }), this;
70
- }
71
- off(e, t) {
72
- if (this.observers[e]) {
73
- if (!t) {
74
- delete this.observers[e];
75
- return;
76
- }
77
- this.observers[e].delete(t);
78
- }
79
- }
80
- emit(e) {
81
- for (var t = arguments.length, s = new Array(t > 1 ? t - 1 : 0), n = 1; n < t; n++)
82
- s[n - 1] = arguments[n];
83
- this.observers[e] && Array.from(this.observers[e].entries()).forEach((a) => {
84
- let [o, l] = a;
85
- for (let f = 0; f < l; f++)
86
- o(...s);
87
- }), this.observers["*"] && Array.from(this.observers["*"].entries()).forEach((a) => {
88
- let [o, l] = a;
89
- for (let f = 0; f < l; f++)
90
- o.apply(o, [e, ...s]);
91
- });
92
- }
93
- }
94
- function T() {
95
- let i, e;
96
- const t = new Promise((s, n) => {
97
- i = s, e = n;
98
- });
99
- return t.resolve = i, t.reject = e, t;
100
- }
101
- function X(i) {
102
- return i == null ? "" : "" + i;
103
- }
104
- function ce(i, e, t) {
105
- i.forEach((s) => {
106
- e[s] && (t[s] = e[s]);
107
- });
108
- }
109
- const pe = /###/g;
110
- function j(i, e, t) {
111
- function s(o) {
112
- return o && o.indexOf("###") > -1 ? o.replace(pe, ".") : o;
113
- }
114
- function n() {
115
- return !i || typeof i == "string";
116
- }
117
- const r = typeof e != "string" ? e : e.split(".");
118
- let a = 0;
119
- for (; a < r.length - 1; ) {
120
- if (n()) return {};
121
- const o = s(r[a]);
122
- !i[o] && t && (i[o] = new t()), Object.prototype.hasOwnProperty.call(i, o) ? i = i[o] : i = {}, ++a;
123
- }
124
- return n() ? {} : {
125
- obj: i,
126
- k: s(r[a])
127
- };
128
- }
129
- function _(i, e, t) {
130
- const {
131
- obj: s,
132
- k: n
133
- } = j(i, e, Object);
134
- if (s !== void 0 || e.length === 1) {
135
- s[n] = t;
136
- return;
137
- }
138
- let r = e[e.length - 1], a = e.slice(0, e.length - 1), o = j(i, a, Object);
139
- for (; o.obj === void 0 && a.length; )
140
- r = `${a[a.length - 1]}.${r}`, a = a.slice(0, a.length - 1), o = j(i, a, Object), o && o.obj && typeof o.obj[`${o.k}.${r}`] < "u" && (o.obj = void 0);
141
- o.obj[`${o.k}.${r}`] = t;
142
- }
143
- function me(i, e, t, s) {
144
- const {
145
- obj: n,
146
- k: r
147
- } = j(i, e, Object);
148
- n[r] = n[r] || [], n[r].push(t);
149
- }
150
- function H(i, e) {
151
- const {
152
- obj: t,
153
- k: s
154
- } = j(i, e);
155
- if (t)
156
- return t[s];
157
- }
158
- function ye(i, e, t) {
159
- const s = H(i, t);
160
- return s !== void 0 ? s : H(e, t);
161
- }
162
- function ue(i, e, t) {
163
- for (const s in e)
164
- s !== "__proto__" && s !== "constructor" && (s in i ? typeof i[s] == "string" || i[s] instanceof String || typeof e[s] == "string" || e[s] instanceof String ? t && (i[s] = e[s]) : ue(i[s], e[s], t) : i[s] = e[s]);
165
- return i;
166
- }
167
- function P(i) {
168
- return i.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
169
- }
170
- var be = {
171
- "&": "&amp;",
172
- "<": "&lt;",
173
- ">": "&gt;",
174
- '"': "&quot;",
175
- "'": "&#39;",
176
- "/": "&#x2F;"
177
- };
178
- function xe(i) {
179
- return typeof i == "string" ? i.replace(/[&<>"'\/]/g, (e) => be[e]) : i;
180
- }
181
- class Se {
182
- constructor(e) {
183
- this.capacity = e, this.regExpMap = /* @__PURE__ */ new Map(), this.regExpQueue = [];
184
- }
185
- getRegExp(e) {
186
- const t = this.regExpMap.get(e);
187
- if (t !== void 0)
188
- return t;
189
- const s = new RegExp(e);
190
- return this.regExpQueue.length === this.capacity && this.regExpMap.delete(this.regExpQueue.shift()), this.regExpMap.set(e, s), this.regExpQueue.push(e), s;
191
- }
192
- }
193
- const ve = [" ", ",", "?", "!", ";"], Oe = new Se(20);
194
- function Le(i, e, t) {
195
- e = e || "", t = t || "";
196
- const s = ve.filter((a) => e.indexOf(a) < 0 && t.indexOf(a) < 0);
197
- if (s.length === 0) return !0;
198
- const n = Oe.getRegExp(`(${s.map((a) => a === "?" ? "\\?" : a).join("|")})`);
199
- let r = !n.test(i);
200
- if (!r) {
201
- const a = i.indexOf(t);
202
- a > 0 && !n.test(i.substring(0, a)) && (r = !0);
203
- }
204
- return r;
205
- }
206
- function Q(i, e) {
207
- let t = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : ".";
208
- if (!i) return;
209
- if (i[e]) return i[e];
210
- const s = e.split(t);
211
- let n = i;
212
- for (let r = 0; r < s.length; ) {
213
- if (!n || typeof n != "object")
214
- return;
215
- let a, o = "";
216
- for (let l = r; l < s.length; ++l)
217
- if (l !== r && (o += t), o += s[l], a = n[o], a !== void 0) {
218
- if (["string", "number", "boolean"].indexOf(typeof a) > -1 && l < s.length - 1)
219
- continue;
220
- r += l - r + 1;
221
- break;
222
- }
223
- n = a;
224
- }
225
- return n;
226
- }
227
- function B(i) {
228
- return i && i.indexOf("_") > 0 ? i.replace("_", "-") : i;
229
- }
230
- class ee extends Z {
231
- constructor(e) {
232
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
233
- ns: ["translation"],
234
- defaultNS: "translation"
235
- };
236
- super(), this.data = e || {}, this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.options.ignoreJSONStructure === void 0 && (this.options.ignoreJSONStructure = !0);
237
- }
238
- addNamespaces(e) {
239
- this.options.ns.indexOf(e) < 0 && this.options.ns.push(e);
240
- }
241
- removeNamespaces(e) {
242
- const t = this.options.ns.indexOf(e);
243
- t > -1 && this.options.ns.splice(t, 1);
244
- }
245
- getResource(e, t, s) {
246
- let n = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
247
- const r = n.keySeparator !== void 0 ? n.keySeparator : this.options.keySeparator, a = n.ignoreJSONStructure !== void 0 ? n.ignoreJSONStructure : this.options.ignoreJSONStructure;
248
- let o;
249
- e.indexOf(".") > -1 ? o = e.split(".") : (o = [e, t], s && (Array.isArray(s) ? o.push(...s) : typeof s == "string" && r ? o.push(...s.split(r)) : o.push(s)));
250
- const l = H(this.data, o);
251
- return !l && !t && !s && e.indexOf(".") > -1 && (e = o[0], t = o[1], s = o.slice(2).join(".")), l || !a || typeof s != "string" ? l : Q(this.data && this.data[e] && this.data[e][t], s, r);
252
- }
253
- addResource(e, t, s, n) {
254
- let r = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : {
255
- silent: !1
256
- };
257
- const a = r.keySeparator !== void 0 ? r.keySeparator : this.options.keySeparator;
258
- let o = [e, t];
259
- s && (o = o.concat(a ? s.split(a) : s)), e.indexOf(".") > -1 && (o = e.split("."), n = t, t = o[1]), this.addNamespaces(t), _(this.data, o, n), r.silent || this.emit("added", e, t, s, n);
260
- }
261
- addResources(e, t, s) {
262
- let n = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {
263
- silent: !1
264
- };
265
- for (const r in s)
266
- (typeof s[r] == "string" || Array.isArray(s[r])) && this.addResource(e, t, r, s[r], {
267
- silent: !0
268
- });
269
- n.silent || this.emit("added", e, t, s);
270
- }
271
- addResourceBundle(e, t, s, n, r) {
272
- let a = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : {
273
- silent: !1,
274
- skipCopy: !1
275
- }, o = [e, t];
276
- e.indexOf(".") > -1 && (o = e.split("."), n = s, s = t, t = o[1]), this.addNamespaces(t);
277
- let l = H(this.data, o) || {};
278
- a.skipCopy || (s = JSON.parse(JSON.stringify(s))), n ? ue(l, s, r) : l = {
279
- ...l,
280
- ...s
281
- }, _(this.data, o, l), a.silent || this.emit("added", e, t, s);
282
- }
283
- removeResourceBundle(e, t) {
284
- this.hasResourceBundle(e, t) && delete this.data[e][t], this.removeNamespaces(t), this.emit("removed", e, t);
285
- }
286
- hasResourceBundle(e, t) {
287
- return this.getResource(e, t) !== void 0;
288
- }
289
- getResourceBundle(e, t) {
290
- return t || (t = this.options.defaultNS), this.options.compatibilityAPI === "v1" ? {
291
- ...this.getResource(e, t)
292
- } : this.getResource(e, t);
293
- }
294
- getDataByLanguage(e) {
295
- return this.data[e];
296
- }
297
- hasLanguageSomeTranslations(e) {
298
- const t = this.getDataByLanguage(e);
299
- return !!(t && Object.keys(t) || []).find((n) => t[n] && Object.keys(t[n]).length > 0);
300
- }
301
- toJSON() {
302
- return this.data;
303
- }
304
- }
305
- var fe = {
306
- processors: {},
307
- addPostProcessor(i) {
308
- this.processors[i.name] = i;
309
- },
310
- handle(i, e, t, s, n) {
311
- return i.forEach((r) => {
312
- this.processors[r] && (e = this.processors[r].process(e, t, s, n));
313
- }), e;
314
- }
315
- };
316
- const te = {};
317
- class J extends Z {
318
- constructor(e) {
319
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
320
- super(), ce(["resourceStore", "languageUtils", "pluralResolver", "interpolator", "backendConnector", "i18nFormat", "utils"], e, this), this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.logger = C.create("translator");
321
- }
322
- changeLanguage(e) {
323
- e && (this.language = e);
324
- }
325
- exists(e) {
326
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
327
- interpolation: {}
328
- };
329
- if (e == null)
330
- return !1;
331
- const s = this.resolve(e, t);
332
- return s && s.res !== void 0;
333
- }
334
- extractFromKey(e, t) {
335
- let s = t.nsSeparator !== void 0 ? t.nsSeparator : this.options.nsSeparator;
336
- s === void 0 && (s = ":");
337
- const n = t.keySeparator !== void 0 ? t.keySeparator : this.options.keySeparator;
338
- let r = t.ns || this.options.defaultNS || [];
339
- const a = s && e.indexOf(s) > -1, o = !this.options.userDefinedKeySeparator && !t.keySeparator && !this.options.userDefinedNsSeparator && !t.nsSeparator && !Le(e, s, n);
340
- if (a && !o) {
341
- const l = e.match(this.interpolator.nestingRegexp);
342
- if (l && l.length > 0)
343
- return {
344
- key: e,
345
- namespaces: r
346
- };
347
- const f = e.split(s);
348
- (s !== n || s === n && this.options.ns.indexOf(f[0]) > -1) && (r = f.shift()), e = f.join(n);
349
- }
350
- return typeof r == "string" && (r = [r]), {
351
- key: e,
352
- namespaces: r
353
- };
354
- }
355
- translate(e, t, s) {
356
- if (typeof t != "object" && this.options.overloadTranslationOptionHandler && (t = this.options.overloadTranslationOptionHandler(arguments)), typeof t == "object" && (t = {
357
- ...t
358
- }), t || (t = {}), e == null) return "";
359
- Array.isArray(e) || (e = [String(e)]);
360
- const n = t.returnDetails !== void 0 ? t.returnDetails : this.options.returnDetails, r = t.keySeparator !== void 0 ? t.keySeparator : this.options.keySeparator, {
361
- key: a,
362
- namespaces: o
363
- } = this.extractFromKey(e[e.length - 1], t), l = o[o.length - 1], f = t.lng || this.language, h = t.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;
364
- if (f && f.toLowerCase() === "cimode") {
365
- if (h) {
366
- const y = t.nsSeparator || this.options.nsSeparator;
367
- return n ? {
368
- res: `${l}${y}${a}`,
369
- usedKey: a,
370
- exactUsedKey: a,
371
- usedLng: f,
372
- usedNS: l,
373
- usedParams: this.getUsedParamsDetails(t)
374
- } : `${l}${y}${a}`;
375
- }
376
- return n ? {
377
- res: a,
378
- usedKey: a,
379
- exactUsedKey: a,
380
- usedLng: f,
381
- usedNS: l,
382
- usedParams: this.getUsedParamsDetails(t)
383
- } : a;
384
- }
385
- const g = this.resolve(e, t);
386
- let u = g && g.res;
387
- const c = g && g.usedKey || a, d = g && g.exactUsedKey || a, m = Object.prototype.toString.apply(u), p = ["[object Number]", "[object Function]", "[object RegExp]"], S = t.joinArrays !== void 0 ? t.joinArrays : this.options.joinArrays, b = !this.i18nFormat || this.i18nFormat.handleAsObject;
388
- if (b && u && (typeof u != "string" && typeof u != "boolean" && typeof u != "number") && p.indexOf(m) < 0 && !(typeof S == "string" && Array.isArray(u))) {
389
- if (!t.returnObjects && !this.options.returnObjects) {
390
- this.options.returnedObjectHandler || this.logger.warn("accessing an object - but returnObjects options is not enabled!");
391
- const y = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(c, u, {
392
- ...t,
393
- ns: o
394
- }) : `key '${a} (${this.language})' returned an object instead of string.`;
395
- return n ? (g.res = y, g.usedParams = this.getUsedParamsDetails(t), g) : y;
396
- }
397
- if (r) {
398
- const y = Array.isArray(u), L = y ? [] : {}, N = y ? d : c;
399
- for (const v in u)
400
- if (Object.prototype.hasOwnProperty.call(u, v)) {
401
- const D = `${N}${r}${v}`;
402
- L[v] = this.translate(D, {
403
- ...t,
404
- joinArrays: !1,
405
- ns: o
406
- }), L[v] === D && (L[v] = u[v]);
407
- }
408
- u = L;
409
- }
410
- } else if (b && typeof S == "string" && Array.isArray(u))
411
- u = u.join(S), u && (u = this.extendTranslation(u, e, t, s));
412
- else {
413
- let y = !1, L = !1;
414
- const N = t.count !== void 0 && typeof t.count != "string", v = J.hasDefaultValue(t), D = N ? this.pluralResolver.getSuffix(f, t.count, t) : "", he = t.ordinal && N ? this.pluralResolver.getSuffix(f, t.count, {
415
- ordinal: !1
416
- }) : "", q = N && !t.ordinal && t.count === 0 && this.pluralResolver.shouldUseIntlApi(), k = q && t[`defaultValue${this.options.pluralSeparator}zero`] || t[`defaultValue${D}`] || t[`defaultValue${he}`] || t.defaultValue;
417
- !this.isValidLookup(u) && v && (y = !0, u = k), this.isValidLookup(u) || (L = !0, u = a);
418
- const ge = (t.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && L ? void 0 : u, A = v && k !== u && this.options.updateMissing;
419
- if (L || y || A) {
420
- if (this.logger.log(A ? "updateKey" : "missingKey", f, l, a, A ? k : u), r) {
421
- const w = this.resolve(a, {
422
- ...t,
423
- keySeparator: !1
424
- });
425
- w && w.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.");
426
- }
427
- let E = [];
428
- const K = this.languageUtils.getFallbackCodes(this.options.fallbackLng, t.lng || this.language);
429
- if (this.options.saveMissingTo === "fallback" && K && K[0])
430
- for (let w = 0; w < K.length; w++)
431
- E.push(K[w]);
432
- else this.options.saveMissingTo === "all" ? E = this.languageUtils.toResolveHierarchy(t.lng || this.language) : E.push(t.lng || this.language);
433
- const Y = (w, R, F) => {
434
- const G = v && F !== u ? F : ge;
435
- this.options.missingKeyHandler ? this.options.missingKeyHandler(w, l, R, G, A, t) : this.backendConnector && this.backendConnector.saveMissing && this.backendConnector.saveMissing(w, l, R, G, A, t), this.emit("missingKey", w, l, R, u);
436
- };
437
- this.options.saveMissing && (this.options.saveMissingPlurals && N ? E.forEach((w) => {
438
- const R = this.pluralResolver.getSuffixes(w, t);
439
- q && t[`defaultValue${this.options.pluralSeparator}zero`] && R.indexOf(`${this.options.pluralSeparator}zero`) < 0 && R.push(`${this.options.pluralSeparator}zero`), R.forEach((F) => {
440
- Y([w], a + F, t[`defaultValue${F}`] || k);
441
- });
442
- }) : Y(E, a, k));
443
- }
444
- u = this.extendTranslation(u, e, t, g, s), L && u === a && this.options.appendNamespaceToMissingKey && (u = `${l}:${a}`), (L || y) && this.options.parseMissingKeyHandler && (this.options.compatibilityAPI !== "v1" ? u = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${l}:${a}` : a, y ? u : void 0) : u = this.options.parseMissingKeyHandler(u));
445
- }
446
- return n ? (g.res = u, g.usedParams = this.getUsedParamsDetails(t), g) : u;
447
- }
448
- extendTranslation(e, t, s, n, r) {
449
- var a = this;
450
- if (this.i18nFormat && this.i18nFormat.parse)
451
- e = this.i18nFormat.parse(e, {
452
- ...this.options.interpolation.defaultVariables,
453
- ...s
454
- }, s.lng || this.language || n.usedLng, n.usedNS, n.usedKey, {
455
- resolved: n
456
- });
457
- else if (!s.skipInterpolation) {
458
- s.interpolation && this.interpolator.init({
459
- ...s,
460
- interpolation: {
461
- ...this.options.interpolation,
462
- ...s.interpolation
463
- }
464
- });
465
- const f = typeof e == "string" && (s && s.interpolation && s.interpolation.skipOnVariables !== void 0 ? s.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables);
466
- let h;
467
- if (f) {
468
- const u = e.match(this.interpolator.nestingRegexp);
469
- h = u && u.length;
470
- }
471
- let g = s.replace && typeof s.replace != "string" ? s.replace : s;
472
- if (this.options.interpolation.defaultVariables && (g = {
473
- ...this.options.interpolation.defaultVariables,
474
- ...g
475
- }), e = this.interpolator.interpolate(e, g, s.lng || this.language, s), f) {
476
- const u = e.match(this.interpolator.nestingRegexp), c = u && u.length;
477
- h < c && (s.nest = !1);
478
- }
479
- !s.lng && this.options.compatibilityAPI !== "v1" && n && n.res && (s.lng = n.usedLng), s.nest !== !1 && (e = this.interpolator.nest(e, function() {
480
- for (var u = arguments.length, c = new Array(u), d = 0; d < u; d++)
481
- c[d] = arguments[d];
482
- return r && r[0] === c[0] && !s.context ? (a.logger.warn(`It seems you are nesting recursively key: ${c[0]} in key: ${t[0]}`), null) : a.translate(...c, t);
483
- }, s)), s.interpolation && this.interpolator.reset();
484
- }
485
- const o = s.postProcess || this.options.postProcess, l = typeof o == "string" ? [o] : o;
486
- return e != null && l && l.length && s.applyPostProcessor !== !1 && (e = fe.handle(l, e, t, this.options && this.options.postProcessPassResolved ? {
487
- i18nResolved: {
488
- ...n,
489
- usedParams: this.getUsedParamsDetails(s)
490
- },
491
- ...s
492
- } : s, this)), e;
493
- }
494
- resolve(e) {
495
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, s, n, r, a, o;
496
- return typeof e == "string" && (e = [e]), e.forEach((l) => {
497
- if (this.isValidLookup(s)) return;
498
- const f = this.extractFromKey(l, t), h = f.key;
499
- n = h;
500
- let g = f.namespaces;
501
- this.options.fallbackNS && (g = g.concat(this.options.fallbackNS));
502
- const u = t.count !== void 0 && typeof t.count != "string", c = u && !t.ordinal && t.count === 0 && this.pluralResolver.shouldUseIntlApi(), d = t.context !== void 0 && (typeof t.context == "string" || typeof t.context == "number") && t.context !== "", m = t.lngs ? t.lngs : this.languageUtils.toResolveHierarchy(t.lng || this.language, t.fallbackLng);
503
- g.forEach((p) => {
504
- this.isValidLookup(s) || (o = p, !te[`${m[0]}-${p}`] && this.utils && this.utils.hasLoadedNamespace && !this.utils.hasLoadedNamespace(o) && (te[`${m[0]}-${p}`] = !0, this.logger.warn(`key "${n}" for languages "${m.join(", ")}" won't get resolved as namespace "${o}" was not yet loaded`, "This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")), m.forEach((S) => {
505
- if (this.isValidLookup(s)) return;
506
- a = S;
507
- const b = [h];
508
- if (this.i18nFormat && this.i18nFormat.addLookupKeys)
509
- this.i18nFormat.addLookupKeys(b, h, S, p, t);
510
- else {
511
- let y;
512
- u && (y = this.pluralResolver.getSuffix(S, t.count, t));
513
- const L = `${this.options.pluralSeparator}zero`, N = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;
514
- if (u && (b.push(h + y), t.ordinal && y.indexOf(N) === 0 && b.push(h + y.replace(N, this.options.pluralSeparator)), c && b.push(h + L)), d) {
515
- const v = `${h}${this.options.contextSeparator}${t.context}`;
516
- b.push(v), u && (b.push(v + y), t.ordinal && y.indexOf(N) === 0 && b.push(v + y.replace(N, this.options.pluralSeparator)), c && b.push(v + L));
517
- }
518
- }
519
- let V;
520
- for (; V = b.pop(); )
521
- this.isValidLookup(s) || (r = V, s = this.getResource(S, p, V, t));
522
- }));
523
- });
524
- }), {
525
- res: s,
526
- usedKey: n,
527
- exactUsedKey: r,
528
- usedLng: a,
529
- usedNS: o
530
- };
531
- }
532
- isValidLookup(e) {
533
- return e !== void 0 && !(!this.options.returnNull && e === null) && !(!this.options.returnEmptyString && e === "");
534
- }
535
- getResource(e, t, s) {
536
- let n = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
537
- return this.i18nFormat && this.i18nFormat.getResource ? this.i18nFormat.getResource(e, t, s, n) : this.resourceStore.getResource(e, t, s, n);
538
- }
539
- getUsedParamsDetails() {
540
- let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
541
- const t = ["defaultValue", "ordinal", "context", "replace", "lng", "lngs", "fallbackLng", "ns", "keySeparator", "nsSeparator", "returnObjects", "returnDetails", "joinArrays", "postProcess", "interpolation"], s = e.replace && typeof e.replace != "string";
542
- let n = s ? e.replace : e;
543
- if (s && typeof e.count < "u" && (n.count = e.count), this.options.interpolation.defaultVariables && (n = {
544
- ...this.options.interpolation.defaultVariables,
545
- ...n
546
- }), !s) {
547
- n = {
548
- ...n
549
- };
550
- for (const r of t)
551
- delete n[r];
552
- }
553
- return n;
554
- }
555
- static hasDefaultValue(e) {
556
- const t = "defaultValue";
557
- for (const s in e)
558
- if (Object.prototype.hasOwnProperty.call(e, s) && t === s.substring(0, t.length) && e[s] !== void 0)
559
- return !0;
560
- return !1;
561
- }
562
- }
563
- function W(i) {
564
- return i.charAt(0).toUpperCase() + i.slice(1);
565
- }
566
- class se {
567
- constructor(e) {
568
- this.options = e, this.supportedLngs = this.options.supportedLngs || !1, this.logger = C.create("languageUtils");
569
- }
570
- getScriptPartFromCode(e) {
571
- if (e = B(e), !e || e.indexOf("-") < 0) return null;
572
- const t = e.split("-");
573
- return t.length === 2 || (t.pop(), t[t.length - 1].toLowerCase() === "x") ? null : this.formatLanguageCode(t.join("-"));
574
- }
575
- getLanguagePartFromCode(e) {
576
- if (e = B(e), !e || e.indexOf("-") < 0) return e;
577
- const t = e.split("-");
578
- return this.formatLanguageCode(t[0]);
579
- }
580
- formatLanguageCode(e) {
581
- if (typeof e == "string" && e.indexOf("-") > -1) {
582
- const t = ["hans", "hant", "latn", "cyrl", "cans", "mong", "arab"];
583
- let s = e.split("-");
584
- return this.options.lowerCaseLng ? s = s.map((n) => n.toLowerCase()) : s.length === 2 ? (s[0] = s[0].toLowerCase(), s[1] = s[1].toUpperCase(), t.indexOf(s[1].toLowerCase()) > -1 && (s[1] = W(s[1].toLowerCase()))) : s.length === 3 && (s[0] = s[0].toLowerCase(), s[1].length === 2 && (s[1] = s[1].toUpperCase()), s[0] !== "sgn" && s[2].length === 2 && (s[2] = s[2].toUpperCase()), t.indexOf(s[1].toLowerCase()) > -1 && (s[1] = W(s[1].toLowerCase())), t.indexOf(s[2].toLowerCase()) > -1 && (s[2] = W(s[2].toLowerCase()))), s.join("-");
585
- }
586
- return this.options.cleanCode || this.options.lowerCaseLng ? e.toLowerCase() : e;
587
- }
588
- isSupportedCode(e) {
589
- return (this.options.load === "languageOnly" || this.options.nonExplicitSupportedLngs) && (e = this.getLanguagePartFromCode(e)), !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.indexOf(e) > -1;
590
- }
591
- getBestMatchFromCodes(e) {
592
- if (!e) return null;
593
- let t;
594
- return e.forEach((s) => {
595
- if (t) return;
596
- const n = this.formatLanguageCode(s);
597
- (!this.options.supportedLngs || this.isSupportedCode(n)) && (t = n);
598
- }), !t && this.options.supportedLngs && e.forEach((s) => {
599
- if (t) return;
600
- const n = this.getLanguagePartFromCode(s);
601
- if (this.isSupportedCode(n)) return t = n;
602
- t = this.options.supportedLngs.find((r) => {
603
- if (r === n) return r;
604
- if (!(r.indexOf("-") < 0 && n.indexOf("-") < 0) && (r.indexOf("-") > 0 && n.indexOf("-") < 0 && r.substring(0, r.indexOf("-")) === n || r.indexOf(n) === 0 && n.length > 1))
605
- return r;
606
- });
607
- }), t || (t = this.getFallbackCodes(this.options.fallbackLng)[0]), t;
608
- }
609
- getFallbackCodes(e, t) {
610
- if (!e) return [];
611
- if (typeof e == "function" && (e = e(t)), typeof e == "string" && (e = [e]), Array.isArray(e)) return e;
612
- if (!t) return e.default || [];
613
- let s = e[t];
614
- return s || (s = e[this.getScriptPartFromCode(t)]), s || (s = e[this.formatLanguageCode(t)]), s || (s = e[this.getLanguagePartFromCode(t)]), s || (s = e.default), s || [];
615
- }
616
- toResolveHierarchy(e, t) {
617
- const s = this.getFallbackCodes(t || this.options.fallbackLng || [], e), n = [], r = (a) => {
618
- a && (this.isSupportedCode(a) ? n.push(a) : this.logger.warn(`rejecting language code not found in supportedLngs: ${a}`));
619
- };
620
- return typeof e == "string" && (e.indexOf("-") > -1 || e.indexOf("_") > -1) ? (this.options.load !== "languageOnly" && r(this.formatLanguageCode(e)), this.options.load !== "languageOnly" && this.options.load !== "currentOnly" && r(this.getScriptPartFromCode(e)), this.options.load !== "currentOnly" && r(this.getLanguagePartFromCode(e))) : typeof e == "string" && r(this.formatLanguageCode(e)), s.forEach((a) => {
621
- n.indexOf(a) < 0 && r(this.formatLanguageCode(a));
622
- }), n;
623
- }
624
- }
625
- let we = [{
626
- lngs: ["ach", "ak", "am", "arn", "br", "fil", "gun", "ln", "mfe", "mg", "mi", "oc", "pt", "pt-BR", "tg", "tl", "ti", "tr", "uz", "wa"],
627
- nr: [1, 2],
628
- fc: 1
629
- }, {
630
- lngs: ["af", "an", "ast", "az", "bg", "bn", "ca", "da", "de", "dev", "el", "en", "eo", "es", "et", "eu", "fi", "fo", "fur", "fy", "gl", "gu", "ha", "hi", "hu", "hy", "ia", "it", "kk", "kn", "ku", "lb", "mai", "ml", "mn", "mr", "nah", "nap", "nb", "ne", "nl", "nn", "no", "nso", "pa", "pap", "pms", "ps", "pt-PT", "rm", "sco", "se", "si", "so", "son", "sq", "sv", "sw", "ta", "te", "tk", "ur", "yo"],
631
- nr: [1, 2],
632
- fc: 2
633
- }, {
634
- lngs: ["ay", "bo", "cgg", "fa", "ht", "id", "ja", "jbo", "ka", "km", "ko", "ky", "lo", "ms", "sah", "su", "th", "tt", "ug", "vi", "wo", "zh"],
635
- nr: [1],
636
- fc: 3
637
- }, {
638
- lngs: ["be", "bs", "cnr", "dz", "hr", "ru", "sr", "uk"],
639
- nr: [1, 2, 5],
640
- fc: 4
641
- }, {
642
- lngs: ["ar"],
643
- nr: [0, 1, 2, 3, 11, 100],
644
- fc: 5
645
- }, {
646
- lngs: ["cs", "sk"],
647
- nr: [1, 2, 5],
648
- fc: 6
649
- }, {
650
- lngs: ["csb", "pl"],
651
- nr: [1, 2, 5],
652
- fc: 7
653
- }, {
654
- lngs: ["cy"],
655
- nr: [1, 2, 3, 8],
656
- fc: 8
657
- }, {
658
- lngs: ["fr"],
659
- nr: [1, 2],
660
- fc: 9
661
- }, {
662
- lngs: ["ga"],
663
- nr: [1, 2, 3, 7, 11],
664
- fc: 10
665
- }, {
666
- lngs: ["gd"],
667
- nr: [1, 2, 3, 20],
668
- fc: 11
669
- }, {
670
- lngs: ["is"],
671
- nr: [1, 2],
672
- fc: 12
673
- }, {
674
- lngs: ["jv"],
675
- nr: [0, 1],
676
- fc: 13
677
- }, {
678
- lngs: ["kw"],
679
- nr: [1, 2, 3, 4],
680
- fc: 14
681
- }, {
682
- lngs: ["lt"],
683
- nr: [1, 2, 10],
684
- fc: 15
685
- }, {
686
- lngs: ["lv"],
687
- nr: [1, 2, 0],
688
- fc: 16
689
- }, {
690
- lngs: ["mk"],
691
- nr: [1, 2],
692
- fc: 17
693
- }, {
694
- lngs: ["mnk"],
695
- nr: [0, 1, 2],
696
- fc: 18
697
- }, {
698
- lngs: ["mt"],
699
- nr: [1, 2, 11, 20],
700
- fc: 19
701
- }, {
702
- lngs: ["or"],
703
- nr: [2, 1],
704
- fc: 2
705
- }, {
706
- lngs: ["ro"],
707
- nr: [1, 2, 20],
708
- fc: 20
709
- }, {
710
- lngs: ["sl"],
711
- nr: [5, 1, 2, 3],
712
- fc: 21
713
- }, {
714
- lngs: ["he", "iw"],
715
- nr: [1, 2, 20, 21],
716
- fc: 22
717
- }], Ne = {
718
- 1: function(i) {
719
- return +(i > 1);
720
- },
721
- 2: function(i) {
722
- return +(i != 1);
723
- },
724
- 3: function(i) {
725
- return 0;
726
- },
727
- 4: function(i) {
728
- return i % 10 == 1 && i % 100 != 11 ? 0 : i % 10 >= 2 && i % 10 <= 4 && (i % 100 < 10 || i % 100 >= 20) ? 1 : 2;
729
- },
730
- 5: function(i) {
731
- return i == 0 ? 0 : i == 1 ? 1 : i == 2 ? 2 : i % 100 >= 3 && i % 100 <= 10 ? 3 : i % 100 >= 11 ? 4 : 5;
732
- },
733
- 6: function(i) {
734
- return i == 1 ? 0 : i >= 2 && i <= 4 ? 1 : 2;
735
- },
736
- 7: function(i) {
737
- return i == 1 ? 0 : i % 10 >= 2 && i % 10 <= 4 && (i % 100 < 10 || i % 100 >= 20) ? 1 : 2;
738
- },
739
- 8: function(i) {
740
- return i == 1 ? 0 : i == 2 ? 1 : i != 8 && i != 11 ? 2 : 3;
741
- },
742
- 9: function(i) {
743
- return +(i >= 2);
744
- },
745
- 10: function(i) {
746
- return i == 1 ? 0 : i == 2 ? 1 : i < 7 ? 2 : i < 11 ? 3 : 4;
747
- },
748
- 11: function(i) {
749
- return i == 1 || i == 11 ? 0 : i == 2 || i == 12 ? 1 : i > 2 && i < 20 ? 2 : 3;
750
- },
751
- 12: function(i) {
752
- return +(i % 10 != 1 || i % 100 == 11);
753
- },
754
- 13: function(i) {
755
- return +(i !== 0);
756
- },
757
- 14: function(i) {
758
- return i == 1 ? 0 : i == 2 ? 1 : i == 3 ? 2 : 3;
759
- },
760
- 15: function(i) {
761
- return i % 10 == 1 && i % 100 != 11 ? 0 : i % 10 >= 2 && (i % 100 < 10 || i % 100 >= 20) ? 1 : 2;
762
- },
763
- 16: function(i) {
764
- return i % 10 == 1 && i % 100 != 11 ? 0 : i !== 0 ? 1 : 2;
765
- },
766
- 17: function(i) {
767
- return i == 1 || i % 10 == 1 && i % 100 != 11 ? 0 : 1;
768
- },
769
- 18: function(i) {
770
- return i == 0 ? 0 : i == 1 ? 1 : 2;
771
- },
772
- 19: function(i) {
773
- return i == 1 ? 0 : i == 0 || i % 100 > 1 && i % 100 < 11 ? 1 : i % 100 > 10 && i % 100 < 20 ? 2 : 3;
774
- },
775
- 20: function(i) {
776
- return i == 1 ? 0 : i == 0 || i % 100 > 0 && i % 100 < 20 ? 1 : 2;
777
- },
778
- 21: function(i) {
779
- return i % 100 == 1 ? 1 : i % 100 == 2 ? 2 : i % 100 == 3 || i % 100 == 4 ? 3 : 0;
780
- },
781
- 22: function(i) {
782
- return i == 1 ? 0 : i == 2 ? 1 : (i < 0 || i > 10) && i % 10 == 0 ? 2 : 3;
783
- }
784
- };
785
- const Ce = ["v1", "v2", "v3"], Re = ["v4"], ne = {
786
- zero: 0,
787
- one: 1,
788
- two: 2,
789
- few: 3,
790
- many: 4,
791
- other: 5
792
- };
793
- function Pe() {
794
- const i = {};
795
- return we.forEach((e) => {
796
- e.lngs.forEach((t) => {
797
- i[t] = {
798
- numbers: e.nr,
799
- plurals: Ne[e.fc]
800
- };
801
- });
802
- }), i;
803
- }
804
- class $e {
805
- constructor(e) {
806
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
807
- this.languageUtils = e, this.options = t, this.logger = C.create("pluralResolver"), (!this.options.compatibilityJSON || Re.includes(this.options.compatibilityJSON)) && (typeof Intl > "u" || !Intl.PluralRules) && (this.options.compatibilityJSON = "v3", this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")), this.rules = Pe();
808
- }
809
- addRule(e, t) {
810
- this.rules[e] = t;
811
- }
812
- getRule(e) {
813
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
814
- if (this.shouldUseIntlApi())
815
- try {
816
- return new Intl.PluralRules(B(e === "dev" ? "en" : e), {
817
- type: t.ordinal ? "ordinal" : "cardinal"
818
- });
819
- } catch {
820
- return;
821
- }
822
- return this.rules[e] || this.rules[this.languageUtils.getLanguagePartFromCode(e)];
823
- }
824
- needsPlural(e) {
825
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
826
- const s = this.getRule(e, t);
827
- return this.shouldUseIntlApi() ? s && s.resolvedOptions().pluralCategories.length > 1 : s && s.numbers.length > 1;
828
- }
829
- getPluralFormsOfKey(e, t) {
830
- let s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
831
- return this.getSuffixes(e, s).map((n) => `${t}${n}`);
832
- }
833
- getSuffixes(e) {
834
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
835
- const s = this.getRule(e, t);
836
- return s ? this.shouldUseIntlApi() ? s.resolvedOptions().pluralCategories.sort((n, r) => ne[n] - ne[r]).map((n) => `${this.options.prepend}${t.ordinal ? `ordinal${this.options.prepend}` : ""}${n}`) : s.numbers.map((n) => this.getSuffix(e, n, t)) : [];
837
- }
838
- getSuffix(e, t) {
839
- let s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
840
- const n = this.getRule(e, s);
841
- return n ? this.shouldUseIntlApi() ? `${this.options.prepend}${s.ordinal ? `ordinal${this.options.prepend}` : ""}${n.select(t)}` : this.getSuffixRetroCompatible(n, t) : (this.logger.warn(`no plural rule found for: ${e}`), "");
842
- }
843
- getSuffixRetroCompatible(e, t) {
844
- const s = e.noAbs ? e.plurals(t) : e.plurals(Math.abs(t));
845
- let n = e.numbers[s];
846
- this.options.simplifyPluralSuffix && e.numbers.length === 2 && e.numbers[0] === 1 && (n === 2 ? n = "plural" : n === 1 && (n = ""));
847
- const r = () => this.options.prepend && n.toString() ? this.options.prepend + n.toString() : n.toString();
848
- return this.options.compatibilityJSON === "v1" ? n === 1 ? "" : typeof n == "number" ? `_plural_${n.toString()}` : r() : this.options.compatibilityJSON === "v2" || this.options.simplifyPluralSuffix && e.numbers.length === 2 && e.numbers[0] === 1 ? r() : this.options.prepend && s.toString() ? this.options.prepend + s.toString() : s.toString();
849
- }
850
- shouldUseIntlApi() {
851
- return !Ce.includes(this.options.compatibilityJSON);
852
- }
853
- }
854
- function ie(i, e, t) {
855
- let s = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : ".", n = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : !0, r = ye(i, e, t);
856
- return !r && n && typeof t == "string" && (r = Q(i, t, s), r === void 0 && (r = Q(e, t, s))), r;
857
- }
858
- class ke {
859
- constructor() {
860
- let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
861
- this.logger = C.create("interpolator"), this.options = e, this.format = e.interpolation && e.interpolation.format || ((t) => t), this.init(e);
862
- }
863
- init() {
864
- let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
865
- e.interpolation || (e.interpolation = {
866
- escapeValue: !0
867
- });
868
- const {
869
- escape: t,
870
- escapeValue: s,
871
- useRawValueToEscape: n,
872
- prefix: r,
873
- prefixEscaped: a,
874
- suffix: o,
875
- suffixEscaped: l,
876
- formatSeparator: f,
877
- unescapeSuffix: h,
878
- unescapePrefix: g,
879
- nestingPrefix: u,
880
- nestingPrefixEscaped: c,
881
- nestingSuffix: d,
882
- nestingSuffixEscaped: m,
883
- nestingOptionsSeparator: p,
884
- maxReplaces: S,
885
- alwaysFormat: b
886
- } = e.interpolation;
887
- this.escape = t !== void 0 ? t : xe, this.escapeValue = s !== void 0 ? s : !0, this.useRawValueToEscape = n !== void 0 ? n : !1, this.prefix = r ? P(r) : a || "{{", this.suffix = o ? P(o) : l || "}}", this.formatSeparator = f || ",", this.unescapePrefix = h ? "" : g || "-", this.unescapeSuffix = this.unescapePrefix ? "" : h || "", this.nestingPrefix = u ? P(u) : c || P("$t("), this.nestingSuffix = d ? P(d) : m || P(")"), this.nestingOptionsSeparator = p || ",", this.maxReplaces = S || 1e3, this.alwaysFormat = b !== void 0 ? b : !1, this.resetRegExp();
888
- }
889
- reset() {
890
- this.options && this.init(this.options);
891
- }
892
- resetRegExp() {
893
- const e = (t, s) => t && t.source === s ? (t.lastIndex = 0, t) : new RegExp(s, "g");
894
- 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}`);
895
- }
896
- interpolate(e, t, s, n) {
897
- let r, a, o;
898
- const l = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {};
899
- function f(d) {
900
- return d.replace(/\$/g, "$$$$");
901
- }
902
- const h = (d) => {
903
- if (d.indexOf(this.formatSeparator) < 0) {
904
- const b = ie(t, l, d, this.options.keySeparator, this.options.ignoreJSONStructure);
905
- return this.alwaysFormat ? this.format(b, void 0, s, {
906
- ...n,
907
- ...t,
908
- interpolationkey: d
909
- }) : b;
910
- }
911
- const m = d.split(this.formatSeparator), p = m.shift().trim(), S = m.join(this.formatSeparator).trim();
912
- return this.format(ie(t, l, p, this.options.keySeparator, this.options.ignoreJSONStructure), S, s, {
913
- ...n,
914
- ...t,
915
- interpolationkey: p
916
- });
917
- };
918
- this.resetRegExp();
919
- const g = n && n.missingInterpolationHandler || this.options.missingInterpolationHandler, u = n && n.interpolation && n.interpolation.skipOnVariables !== void 0 ? n.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables;
920
- return [{
921
- regex: this.regexpUnescape,
922
- safeValue: (d) => f(d)
923
- }, {
924
- regex: this.regexp,
925
- safeValue: (d) => this.escapeValue ? f(this.escape(d)) : f(d)
926
- }].forEach((d) => {
927
- for (o = 0; r = d.regex.exec(e); ) {
928
- const m = r[1].trim();
929
- if (a = h(m), a === void 0)
930
- if (typeof g == "function") {
931
- const S = g(e, r, n);
932
- a = typeof S == "string" ? S : "";
933
- } else if (n && Object.prototype.hasOwnProperty.call(n, m))
934
- a = "";
935
- else if (u) {
936
- a = r[0];
937
- continue;
938
- } else
939
- this.logger.warn(`missed to pass in variable ${m} for interpolating ${e}`), a = "";
940
- else typeof a != "string" && !this.useRawValueToEscape && (a = X(a));
941
- const p = d.safeValue(a);
942
- if (e = e.replace(r[0], p), u ? (d.regex.lastIndex += a.length, d.regex.lastIndex -= r[0].length) : d.regex.lastIndex = 0, o++, o >= this.maxReplaces)
943
- break;
944
- }
945
- }), e;
946
- }
947
- nest(e, t) {
948
- let s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, n, r, a;
949
- function o(l, f) {
950
- const h = this.nestingOptionsSeparator;
951
- if (l.indexOf(h) < 0) return l;
952
- const g = l.split(new RegExp(`${h}[ ]*{`));
953
- let u = `{${g[1]}`;
954
- l = g[0], u = this.interpolate(u, a);
955
- const c = u.match(/'/g), d = u.match(/"/g);
956
- (c && c.length % 2 === 0 && !d || d.length % 2 !== 0) && (u = u.replace(/'/g, '"'));
957
- try {
958
- a = JSON.parse(u), f && (a = {
959
- ...f,
960
- ...a
961
- });
962
- } catch (m) {
963
- return this.logger.warn(`failed parsing options string in nesting for key ${l}`, m), `${l}${h}${u}`;
964
- }
965
- return a.defaultValue && a.defaultValue.indexOf(this.prefix) > -1 && delete a.defaultValue, l;
966
- }
967
- for (; n = this.nestingRegexp.exec(e); ) {
968
- let l = [];
969
- a = {
970
- ...s
971
- }, a = a.replace && typeof a.replace != "string" ? a.replace : a, a.applyPostProcessor = !1, delete a.defaultValue;
972
- let f = !1;
973
- if (n[0].indexOf(this.formatSeparator) !== -1 && !/{.*}/.test(n[1])) {
974
- const h = n[1].split(this.formatSeparator).map((g) => g.trim());
975
- n[1] = h.shift(), l = h, f = !0;
976
- }
977
- if (r = t(o.call(this, n[1].trim(), a), a), r && n[0] === e && typeof r != "string") return r;
978
- typeof r != "string" && (r = X(r)), r || (this.logger.warn(`missed to resolve ${n[1]} for nesting ${e}`), r = ""), f && (r = l.reduce((h, g) => this.format(h, g, s.lng, {
979
- ...s,
980
- interpolationkey: n[1].trim()
981
- }), r.trim())), e = e.replace(n[0], r), this.regexp.lastIndex = 0;
982
- }
983
- return e;
984
- }
985
- }
986
- function Ae(i) {
987
- let e = i.toLowerCase().trim();
988
- const t = {};
989
- if (i.indexOf("(") > -1) {
990
- const s = i.split("(");
991
- e = s[0].toLowerCase().trim();
992
- const n = s[1].substring(0, s[1].length - 1);
993
- 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((a) => {
994
- if (a) {
995
- const [o, ...l] = a.split(":"), f = l.join(":").trim().replace(/^'+|'+$/g, ""), h = o.trim();
996
- t[h] || (t[h] = f), f === "false" && (t[h] = !1), f === "true" && (t[h] = !0), isNaN(f) || (t[h] = parseInt(f, 10));
997
- }
998
- });
999
- }
1000
- return {
1001
- formatName: e,
1002
- formatOptions: t
1003
- };
1004
- }
1005
- function $(i) {
1006
- const e = {};
1007
- return function(s, n, r) {
1008
- const a = n + JSON.stringify(r);
1009
- let o = e[a];
1010
- return o || (o = i(B(n), r), e[a] = o), o(s);
1011
- };
1012
- }
1013
- class Ee {
1014
- constructor() {
1015
- let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
1016
- this.logger = C.create("formatter"), this.options = e, this.formats = {
1017
- number: $((t, s) => {
1018
- const n = new Intl.NumberFormat(t, {
1019
- ...s
1020
- });
1021
- return (r) => n.format(r);
1022
- }),
1023
- currency: $((t, s) => {
1024
- const n = new Intl.NumberFormat(t, {
1025
- ...s,
1026
- style: "currency"
1027
- });
1028
- return (r) => n.format(r);
1029
- }),
1030
- datetime: $((t, s) => {
1031
- const n = new Intl.DateTimeFormat(t, {
1032
- ...s
1033
- });
1034
- return (r) => n.format(r);
1035
- }),
1036
- relativetime: $((t, s) => {
1037
- const n = new Intl.RelativeTimeFormat(t, {
1038
- ...s
1039
- });
1040
- return (r) => n.format(r, s.range || "day");
1041
- }),
1042
- list: $((t, s) => {
1043
- const n = new Intl.ListFormat(t, {
1044
- ...s
1045
- });
1046
- return (r) => n.format(r);
1047
- })
1048
- }, this.init(e);
1049
- }
1050
- init(e) {
1051
- const s = (arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
1052
- interpolation: {}
1053
- }).interpolation;
1054
- this.formatSeparator = s.formatSeparator ? s.formatSeparator : s.formatSeparator || ",";
1055
- }
1056
- add(e, t) {
1057
- this.formats[e.toLowerCase().trim()] = t;
1058
- }
1059
- addCached(e, t) {
1060
- this.formats[e.toLowerCase().trim()] = $(t);
1061
- }
1062
- format(e, t, s) {
1063
- let n = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
1064
- return t.split(this.formatSeparator).reduce((o, l) => {
1065
- const {
1066
- formatName: f,
1067
- formatOptions: h
1068
- } = Ae(l);
1069
- if (this.formats[f]) {
1070
- let g = o;
1071
- try {
1072
- const u = n && n.formatParams && n.formatParams[n.interpolationkey] || {}, c = u.locale || u.lng || n.locale || n.lng || s;
1073
- g = this.formats[f](o, c, {
1074
- ...h,
1075
- ...n,
1076
- ...u
1077
- });
1078
- } catch (u) {
1079
- this.logger.warn(u);
1080
- }
1081
- return g;
1082
- } else
1083
- this.logger.warn(`there was no format function for ${f}`);
1084
- return o;
1085
- }, e);
1086
- }
1087
- }
1088
- function Fe(i, e) {
1089
- i.pending[e] !== void 0 && (delete i.pending[e], i.pendingCount--);
1090
- }
1091
- class Te extends Z {
1092
- constructor(e, t, s) {
1093
- let n = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
1094
- super(), this.backend = e, this.store = t, this.services = s, this.languageUtils = s.languageUtils, this.options = n, this.logger = C.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 = [], this.backend && this.backend.init && this.backend.init(s, n.backend, n);
1095
- }
1096
- queueLoad(e, t, s, n) {
1097
- const r = {}, a = {}, o = {}, l = {};
1098
- return e.forEach((f) => {
1099
- let h = !0;
1100
- t.forEach((g) => {
1101
- const u = `${f}|${g}`;
1102
- !s.reload && this.store.hasResourceBundle(f, g) ? this.state[u] = 2 : this.state[u] < 0 || (this.state[u] === 1 ? a[u] === void 0 && (a[u] = !0) : (this.state[u] = 1, h = !1, a[u] === void 0 && (a[u] = !0), r[u] === void 0 && (r[u] = !0), l[g] === void 0 && (l[g] = !0)));
1103
- }), h || (o[f] = !0);
1104
- }), (Object.keys(r).length || Object.keys(a).length) && this.queue.push({
1105
- pending: a,
1106
- pendingCount: Object.keys(a).length,
1107
- loaded: {},
1108
- errors: [],
1109
- callback: n
1110
- }), {
1111
- toLoad: Object.keys(r),
1112
- pending: Object.keys(a),
1113
- toLoadLanguages: Object.keys(o),
1114
- toLoadNamespaces: Object.keys(l)
1115
- };
1116
- }
1117
- loaded(e, t, s) {
1118
- const n = e.split("|"), r = n[0], a = n[1];
1119
- t && this.emit("failedLoading", r, a, t), s && this.store.addResourceBundle(r, a, s, void 0, void 0, {
1120
- skipCopy: !0
1121
- }), this.state[e] = t ? -1 : 2;
1122
- const o = {};
1123
- this.queue.forEach((l) => {
1124
- me(l.loaded, [r], a), Fe(l, e), t && l.errors.push(t), l.pendingCount === 0 && !l.done && (Object.keys(l.loaded).forEach((f) => {
1125
- o[f] || (o[f] = {});
1126
- const h = l.loaded[f];
1127
- h.length && h.forEach((g) => {
1128
- o[f][g] === void 0 && (o[f][g] = !0);
1129
- });
1130
- }), l.done = !0, l.errors.length ? l.callback(l.errors) : l.callback());
1131
- }), this.emit("loaded", o), this.queue = this.queue.filter((l) => !l.done);
1132
- }
1133
- read(e, t, s) {
1134
- let n = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 0, r = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : this.retryTimeout, a = arguments.length > 5 ? arguments[5] : void 0;
1135
- if (!e.length) return a(null, {});
1136
- if (this.readingCalls >= this.maxParallelReads) {
1137
- this.waitingReads.push({
1138
- lng: e,
1139
- ns: t,
1140
- fcName: s,
1141
- tried: n,
1142
- wait: r,
1143
- callback: a
1144
- });
1145
- return;
1146
- }
1147
- this.readingCalls++;
1148
- const o = (f, h) => {
1149
- if (this.readingCalls--, this.waitingReads.length > 0) {
1150
- const g = this.waitingReads.shift();
1151
- this.read(g.lng, g.ns, g.fcName, g.tried, g.wait, g.callback);
1152
- }
1153
- if (f && h && n < this.maxRetries) {
1154
- setTimeout(() => {
1155
- this.read.call(this, e, t, s, n + 1, r * 2, a);
1156
- }, r);
1157
- return;
1158
- }
1159
- a(f, h);
1160
- }, l = this.backend[s].bind(this.backend);
1161
- if (l.length === 2) {
1162
- try {
1163
- const f = l(e, t);
1164
- f && typeof f.then == "function" ? f.then((h) => o(null, h)).catch(o) : o(null, f);
1165
- } catch (f) {
1166
- o(f);
1167
- }
1168
- return;
1169
- }
1170
- return l(e, t, o);
1171
- }
1172
- prepareLoading(e, t) {
1173
- let s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, n = arguments.length > 3 ? arguments[3] : void 0;
1174
- if (!this.backend)
1175
- return this.logger.warn("No backend was added via i18next.use. Will not load resources."), n && n();
1176
- typeof e == "string" && (e = this.languageUtils.toResolveHierarchy(e)), typeof t == "string" && (t = [t]);
1177
- const r = this.queueLoad(e, t, s, n);
1178
- if (!r.toLoad.length)
1179
- return r.pending.length || n(), null;
1180
- r.toLoad.forEach((a) => {
1181
- this.loadOne(a);
1182
- });
1183
- }
1184
- load(e, t, s) {
1185
- this.prepareLoading(e, t, {}, s);
1186
- }
1187
- reload(e, t, s) {
1188
- this.prepareLoading(e, t, {
1189
- reload: !0
1190
- }, s);
1191
- }
1192
- loadOne(e) {
1193
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "";
1194
- const s = e.split("|"), n = s[0], r = s[1];
1195
- this.read(n, r, "read", void 0, void 0, (a, o) => {
1196
- a && this.logger.warn(`${t}loading namespace ${r} for language ${n} failed`, a), !a && o && this.logger.log(`${t}loaded namespace ${r} for language ${n}`, o), this.loaded(e, a, o);
1197
- });
1198
- }
1199
- saveMissing(e, t, s, n, r) {
1200
- let a = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : {}, o = arguments.length > 6 && arguments[6] !== void 0 ? arguments[6] : () => {
1201
- };
1202
- if (this.services.utils && this.services.utils.hasLoadedNamespace && !this.services.utils.hasLoadedNamespace(t)) {
1203
- 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!!!");
1204
- return;
1205
- }
1206
- if (!(s == null || s === "")) {
1207
- if (this.backend && this.backend.create) {
1208
- const l = {
1209
- ...a,
1210
- isUpdate: r
1211
- }, f = this.backend.create.bind(this.backend);
1212
- if (f.length < 6)
1213
- try {
1214
- let h;
1215
- f.length === 5 ? h = f(e, t, s, n, l) : h = f(e, t, s, n), h && typeof h.then == "function" ? h.then((g) => o(null, g)).catch(o) : o(null, h);
1216
- } catch (h) {
1217
- o(h);
1218
- }
1219
- else
1220
- f(e, t, s, n, o, l);
1221
- }
1222
- !e || !e[0] || this.store.addResource(e[0], t, s, n);
1223
- }
1224
- }
1225
- }
1226
- function re() {
1227
- return {
1228
- debug: !1,
1229
- initImmediate: !0,
1230
- ns: ["translation"],
1231
- defaultNS: ["translation"],
1232
- fallbackLng: ["dev"],
1233
- fallbackNS: !1,
1234
- supportedLngs: !1,
1235
- nonExplicitSupportedLngs: !1,
1236
- load: "all",
1237
- preload: !1,
1238
- simplifyPluralSuffix: !0,
1239
- keySeparator: ".",
1240
- nsSeparator: ":",
1241
- pluralSeparator: "_",
1242
- contextSeparator: "_",
1243
- partialBundledLanguages: !1,
1244
- saveMissing: !1,
1245
- updateMissing: !1,
1246
- saveMissingTo: "fallback",
1247
- saveMissingPlurals: !0,
1248
- missingKeyHandler: !1,
1249
- missingInterpolationHandler: !1,
1250
- postProcess: !1,
1251
- postProcessPassResolved: !1,
1252
- returnNull: !1,
1253
- returnEmptyString: !0,
1254
- returnObjects: !1,
1255
- joinArrays: !1,
1256
- returnedObjectHandler: !1,
1257
- parseMissingKeyHandler: !1,
1258
- appendNamespaceToMissingKey: !1,
1259
- appendNamespaceToCIMode: !1,
1260
- overloadTranslationOptionHandler: function(e) {
1261
- let t = {};
1262
- if (typeof e[1] == "object" && (t = e[1]), typeof e[1] == "string" && (t.defaultValue = e[1]), typeof e[2] == "string" && (t.tDescription = e[2]), typeof e[2] == "object" || typeof e[3] == "object") {
1263
- const s = e[3] || e[2];
1264
- Object.keys(s).forEach((n) => {
1265
- t[n] = s[n];
1266
- });
1267
- }
1268
- return t;
1269
- },
1270
- interpolation: {
1271
- escapeValue: !0,
1272
- format: (i) => i,
1273
- prefix: "{{",
1274
- suffix: "}}",
1275
- formatSeparator: ",",
1276
- unescapePrefix: "-",
1277
- nestingPrefix: "$t(",
1278
- nestingSuffix: ")",
1279
- nestingOptionsSeparator: ",",
1280
- maxReplaces: 1e3,
1281
- skipOnVariables: !0
1282
- }
1283
- };
1284
- }
1285
- function ae(i) {
1286
- return typeof i.ns == "string" && (i.ns = [i.ns]), typeof i.fallbackLng == "string" && (i.fallbackLng = [i.fallbackLng]), typeof i.fallbackNS == "string" && (i.fallbackNS = [i.fallbackNS]), i.supportedLngs && i.supportedLngs.indexOf("cimode") < 0 && (i.supportedLngs = i.supportedLngs.concat(["cimode"])), i;
1287
- }
1288
- function M() {
1289
- }
1290
- function je(i) {
1291
- Object.getOwnPropertyNames(Object.getPrototypeOf(i)).forEach((t) => {
1292
- typeof i[t] == "function" && (i[t] = i[t].bind(i));
1293
- });
1294
- }
1295
- class I extends Z {
1296
- constructor() {
1297
- let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, t = arguments.length > 1 ? arguments[1] : void 0;
1298
- if (super(), this.options = ae(e), this.services = {}, this.logger = C, this.modules = {
1299
- external: []
1300
- }, je(this), t && !this.isInitialized && !e.isClone) {
1301
- if (!this.options.initImmediate)
1302
- return this.init(e, t), this;
1303
- setTimeout(() => {
1304
- this.init(e, t);
1305
- }, 0);
1306
- }
1307
- }
1308
- init() {
1309
- var e = this;
1310
- let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, s = arguments.length > 1 ? arguments[1] : void 0;
1311
- this.isInitializing = !0, typeof t == "function" && (s = t, t = {}), !t.defaultNS && t.defaultNS !== !1 && t.ns && (typeof t.ns == "string" ? t.defaultNS = t.ns : t.ns.indexOf("translation") < 0 && (t.defaultNS = t.ns[0]));
1312
- const n = re();
1313
- this.options = {
1314
- ...n,
1315
- ...this.options,
1316
- ...ae(t)
1317
- }, this.options.compatibilityAPI !== "v1" && (this.options.interpolation = {
1318
- ...n.interpolation,
1319
- ...this.options.interpolation
1320
- }), t.keySeparator !== void 0 && (this.options.userDefinedKeySeparator = t.keySeparator), t.nsSeparator !== void 0 && (this.options.userDefinedNsSeparator = t.nsSeparator);
1321
- function r(h) {
1322
- return h ? typeof h == "function" ? new h() : h : null;
1323
- }
1324
- if (!this.options.isClone) {
1325
- this.modules.logger ? C.init(r(this.modules.logger), this.options) : C.init(null, this.options);
1326
- let h;
1327
- this.modules.formatter ? h = this.modules.formatter : typeof Intl < "u" && (h = Ee);
1328
- const g = new se(this.options);
1329
- this.store = new ee(this.options.resources, this.options);
1330
- const u = this.services;
1331
- u.logger = C, u.resourceStore = this.store, u.languageUtils = g, u.pluralResolver = new $e(g, {
1332
- prepend: this.options.pluralSeparator,
1333
- compatibilityJSON: this.options.compatibilityJSON,
1334
- simplifyPluralSuffix: this.options.simplifyPluralSuffix
1335
- }), h && (!this.options.interpolation.format || this.options.interpolation.format === n.interpolation.format) && (u.formatter = r(h), u.formatter.init(u, this.options), this.options.interpolation.format = u.formatter.format.bind(u.formatter)), u.interpolator = new ke(this.options), u.utils = {
1336
- hasLoadedNamespace: this.hasLoadedNamespace.bind(this)
1337
- }, u.backendConnector = new Te(r(this.modules.backend), u.resourceStore, u, this.options), u.backendConnector.on("*", function(c) {
1338
- for (var d = arguments.length, m = new Array(d > 1 ? d - 1 : 0), p = 1; p < d; p++)
1339
- m[p - 1] = arguments[p];
1340
- e.emit(c, ...m);
1341
- }), this.modules.languageDetector && (u.languageDetector = r(this.modules.languageDetector), u.languageDetector.init && u.languageDetector.init(u, this.options.detection, this.options)), this.modules.i18nFormat && (u.i18nFormat = r(this.modules.i18nFormat), u.i18nFormat.init && u.i18nFormat.init(this)), this.translator = new J(this.services, this.options), this.translator.on("*", function(c) {
1342
- for (var d = arguments.length, m = new Array(d > 1 ? d - 1 : 0), p = 1; p < d; p++)
1343
- m[p - 1] = arguments[p];
1344
- e.emit(c, ...m);
1345
- }), this.modules.external.forEach((c) => {
1346
- c.init && c.init(this);
1347
- });
1348
- }
1349
- if (this.format = this.options.interpolation.format, s || (s = M), this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) {
1350
- const h = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
1351
- h.length > 0 && h[0] !== "dev" && (this.options.lng = h[0]);
1352
- }
1353
- !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) => {
1354
- this[h] = function() {
1355
- return e.store[h](...arguments);
1356
- };
1357
- }), ["addResource", "addResources", "addResourceBundle", "removeResourceBundle"].forEach((h) => {
1358
- this[h] = function() {
1359
- return e.store[h](...arguments), e;
1360
- };
1361
- });
1362
- const l = T(), f = () => {
1363
- const h = (g, u) => {
1364
- 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), l.resolve(u), s(g, u);
1365
- };
1366
- if (this.languages && this.options.compatibilityAPI !== "v1" && !this.isInitialized) return h(null, this.t.bind(this));
1367
- this.changeLanguage(this.options.lng, h);
1368
- };
1369
- return this.options.resources || !this.options.initImmediate ? f() : setTimeout(f, 0), l;
1370
- }
1371
- loadResources(e) {
1372
- let s = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : M;
1373
- const n = typeof e == "string" ? e : this.language;
1374
- if (typeof e == "function" && (s = e), !this.options.resources || this.options.partialBundledLanguages) {
1375
- if (n && n.toLowerCase() === "cimode" && (!this.options.preload || this.options.preload.length === 0)) return s();
1376
- const r = [], a = (o) => {
1377
- if (!o || o === "cimode") return;
1378
- this.services.languageUtils.toResolveHierarchy(o).forEach((f) => {
1379
- f !== "cimode" && r.indexOf(f) < 0 && r.push(f);
1380
- });
1381
- };
1382
- n ? a(n) : this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach((l) => a(l)), this.options.preload && this.options.preload.forEach((o) => a(o)), this.services.backendConnector.load(r, this.options.ns, (o) => {
1383
- !o && !this.resolvedLanguage && this.language && this.setResolvedLanguage(this.language), s(o);
1384
- });
1385
- } else
1386
- s(null);
1387
- }
1388
- reloadResources(e, t, s) {
1389
- const n = T();
1390
- return e || (e = this.languages), t || (t = this.options.ns), s || (s = M), this.services.backendConnector.reload(e, t, (r) => {
1391
- n.resolve(), s(r);
1392
- }), n;
1393
- }
1394
- use(e) {
1395
- if (!e) throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");
1396
- if (!e.type) throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");
1397
- 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" && fe.addPostProcessor(e), e.type === "formatter" && (this.modules.formatter = e), e.type === "3rdParty" && this.modules.external.push(e), this;
1398
- }
1399
- setResolvedLanguage(e) {
1400
- if (!(!e || !this.languages) && !(["cimode", "dev"].indexOf(e) > -1))
1401
- for (let t = 0; t < this.languages.length; t++) {
1402
- const s = this.languages[t];
1403
- if (!(["cimode", "dev"].indexOf(s) > -1) && this.store.hasLanguageSomeTranslations(s)) {
1404
- this.resolvedLanguage = s;
1405
- break;
1406
- }
1407
- }
1408
- }
1409
- changeLanguage(e, t) {
1410
- var s = this;
1411
- this.isLanguageChangingTo = e;
1412
- const n = T();
1413
- this.emit("languageChanging", e);
1414
- const r = (l) => {
1415
- this.language = l, this.languages = this.services.languageUtils.toResolveHierarchy(l), this.resolvedLanguage = void 0, this.setResolvedLanguage(l);
1416
- }, a = (l, f) => {
1417
- f ? (r(f), this.translator.changeLanguage(f), this.isLanguageChangingTo = void 0, this.emit("languageChanged", f), this.logger.log("languageChanged", f)) : this.isLanguageChangingTo = void 0, n.resolve(function() {
1418
- return s.t(...arguments);
1419
- }), t && t(l, function() {
1420
- return s.t(...arguments);
1421
- });
1422
- }, o = (l) => {
1423
- !e && !l && this.services.languageDetector && (l = []);
1424
- const f = typeof l == "string" ? l : this.services.languageUtils.getBestMatchFromCodes(l);
1425
- f && (this.language || r(f), this.translator.language || this.translator.changeLanguage(f), this.services.languageDetector && this.services.languageDetector.cacheUserLanguage && this.services.languageDetector.cacheUserLanguage(f)), this.loadResources(f, (h) => {
1426
- a(h, f);
1427
- });
1428
- };
1429
- return !e && this.services.languageDetector && !this.services.languageDetector.async ? o(this.services.languageDetector.detect()) : !e && this.services.languageDetector && this.services.languageDetector.async ? this.services.languageDetector.detect.length === 0 ? this.services.languageDetector.detect().then(o) : this.services.languageDetector.detect(o) : o(e), n;
1430
- }
1431
- getFixedT(e, t, s) {
1432
- var n = this;
1433
- const r = function(a, o) {
1434
- let l;
1435
- if (typeof o != "object") {
1436
- for (var f = arguments.length, h = new Array(f > 2 ? f - 2 : 0), g = 2; g < f; g++)
1437
- h[g - 2] = arguments[g];
1438
- l = n.options.overloadTranslationOptionHandler([a, o].concat(h));
1439
- } else
1440
- l = {
1441
- ...o
1442
- };
1443
- l.lng = l.lng || r.lng, l.lngs = l.lngs || r.lngs, l.ns = l.ns || r.ns, l.keyPrefix = l.keyPrefix || s || r.keyPrefix;
1444
- const u = n.options.keySeparator || ".";
1445
- let c;
1446
- return l.keyPrefix && Array.isArray(a) ? c = a.map((d) => `${l.keyPrefix}${u}${d}`) : c = l.keyPrefix ? `${l.keyPrefix}${u}${a}` : a, n.t(c, l);
1447
- };
1448
- return typeof e == "string" ? r.lng = e : r.lngs = e, r.ns = t, r.keyPrefix = s, r;
1449
- }
1450
- t() {
1451
- return this.translator && this.translator.translate(...arguments);
1452
- }
1453
- exists() {
1454
- return this.translator && this.translator.exists(...arguments);
1455
- }
1456
- setDefaultNamespace(e) {
1457
- this.options.defaultNS = e;
1458
- }
1459
- hasLoadedNamespace(e) {
1460
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
1461
- if (!this.isInitialized)
1462
- return this.logger.warn("hasLoadedNamespace: i18next was not initialized", this.languages), !1;
1463
- if (!this.languages || !this.languages.length)
1464
- return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty", this.languages), !1;
1465
- const s = t.lng || this.resolvedLanguage || this.languages[0], n = this.options ? this.options.fallbackLng : !1, r = this.languages[this.languages.length - 1];
1466
- if (s.toLowerCase() === "cimode") return !0;
1467
- const a = (o, l) => {
1468
- const f = this.services.backendConnector.state[`${o}|${l}`];
1469
- return f === -1 || f === 2;
1470
- };
1471
- if (t.precheck) {
1472
- const o = t.precheck(this, a);
1473
- if (o !== void 0) return o;
1474
- }
1475
- return !!(this.hasResourceBundle(s, e) || !this.services.backendConnector.backend || this.options.resources && !this.options.partialBundledLanguages || a(s, e) && (!n || a(r, e)));
1476
- }
1477
- loadNamespaces(e, t) {
1478
- const s = T();
1479
- return this.options.ns ? (typeof e == "string" && (e = [e]), e.forEach((n) => {
1480
- this.options.ns.indexOf(n) < 0 && this.options.ns.push(n);
1481
- }), this.loadResources((n) => {
1482
- s.resolve(), t && t(n);
1483
- }), s) : (t && t(), Promise.resolve());
1484
- }
1485
- loadLanguages(e, t) {
1486
- const s = T();
1487
- typeof e == "string" && (e = [e]);
1488
- const n = this.options.preload || [], r = e.filter((a) => n.indexOf(a) < 0 && this.services.languageUtils.isSupportedCode(a));
1489
- return r.length ? (this.options.preload = n.concat(r), this.loadResources((a) => {
1490
- s.resolve(), t && t(a);
1491
- }), s) : (t && t(), Promise.resolve());
1492
- }
1493
- dir(e) {
1494
- if (e || (e = this.resolvedLanguage || (this.languages && this.languages.length > 0 ? this.languages[0] : this.language)), !e) return "rtl";
1495
- 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 = this.services && this.services.languageUtils || new se(re());
1496
- return t.indexOf(s.getLanguagePartFromCode(e)) > -1 || e.toLowerCase().indexOf("-arab") > 1 ? "rtl" : "ltr";
1497
- }
1498
- static createInstance() {
1499
- let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, t = arguments.length > 1 ? arguments[1] : void 0;
1500
- return new I(e, t);
1501
- }
1502
- cloneInstance() {
1503
- let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : M;
1504
- const s = e.forkResourceStore;
1505
- s && delete e.forkResourceStore;
1506
- const n = {
1507
- ...this.options,
1508
- ...e,
1509
- isClone: !0
1510
- }, r = new I(n);
1511
- return (e.debug !== void 0 || e.prefix !== void 0) && (r.logger = r.logger.clone(e)), ["store", "services", "language"].forEach((o) => {
1512
- r[o] = this[o];
1513
- }), r.services = {
1514
- ...this.services
1515
- }, r.services.utils = {
1516
- hasLoadedNamespace: r.hasLoadedNamespace.bind(r)
1517
- }, s && (r.store = new ee(this.store.data, n), r.services.resourceStore = r.store), r.translator = new J(r.services, n), r.translator.on("*", function(o) {
1518
- for (var l = arguments.length, f = new Array(l > 1 ? l - 1 : 0), h = 1; h < l; h++)
1519
- f[h - 1] = arguments[h];
1520
- r.emit(o, ...f);
1521
- }), r.init(n, t), r.translator.options = n, r.translator.backendConnector.services.utils = {
1522
- hasLoadedNamespace: r.hasLoadedNamespace.bind(r)
1523
- }, r;
1524
- }
1525
- toJSON() {
1526
- return {
1527
- options: this.options,
1528
- store: this.store,
1529
- language: this.language,
1530
- languages: this.languages,
1531
- resolvedLanguage: this.resolvedLanguage
1532
- };
1533
- }
1534
- }
1535
- const x = I.createInstance();
1536
- x.createInstance = I.createInstance;
1537
- x.createInstance;
1538
- x.dir;
1539
- x.init;
1540
- x.loadResources;
1541
- x.reloadResources;
1542
- x.use;
1543
- x.changeLanguage;
1544
- x.getFixedT;
1545
- x.t;
1546
- x.exists;
1547
- x.setDefaultNamespace;
1548
- x.hasLoadedNamespace;
1549
- x.loadNamespaces;
1550
- x.loadLanguages;
1551
- const Ie = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g, Ve = {
1552
- "&amp;": "&",
1553
- "&#38;": "&",
1554
- "&lt;": "<",
1555
- "&#60;": "<",
1556
- "&gt;": ">",
1557
- "&#62;": ">",
1558
- "&apos;": "'",
1559
- "&#39;": "'",
1560
- "&quot;": '"',
1561
- "&#34;": '"',
1562
- "&nbsp;": " ",
1563
- "&#160;": " ",
1564
- "&copy;": "©",
1565
- "&#169;": "©",
1566
- "&reg;": "®",
1567
- "&#174;": "®",
1568
- "&hellip;": "…",
1569
- "&#8230;": "…",
1570
- "&#x2F;": "/",
1571
- "&#47;": "/"
1572
- }, De = (i) => Ve[i], Ke = (i) => i.replace(Ie, De);
1573
- let oe = {
1574
- bindI18n: "languageChanged",
1575
- bindI18nStore: "",
1576
- transEmptyNodeValue: "",
1577
- transSupportBasicHtmlNodes: !0,
1578
- transWrapTextNodes: "",
1579
- transKeepBasicHtmlNodesFor: ["br", "strong", "i", "p"],
1580
- useSuspense: !0,
1581
- unescape: Ke
1582
- };
1583
- function Me() {
1584
- let i = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
1585
- oe = {
1586
- ...oe,
1587
- ...i
1588
- };
1589
- }
1590
- const Ue = {
1591
- type: "3rdParty",
1592
- init(i) {
1593
- Me(i.options.react);
1594
- }
1595
- }, ze = {
1596
- noResultsFound: "No se encontraron resultados",
1597
- reloadPage: "Recargar página"
1598
- }, He = {
1599
- en: {
1600
- translation: {}
1601
- },
1602
- es: {
1603
- translation: ze
1604
- }
1605
- };
1606
- x.use(Ue).init({
1607
- resources: He,
1608
- lng: "es",
1609
- interpolation: {
1610
- escapeValue: !1
1611
- },
1612
- debug: !0
1613
- });
1614
- const le = x.t, Be = ({ size: i = 100, color: e = "#D4D9D8" }) => /* @__PURE__ */ O("svg", { id: "Capa_1", "data-name": "Capa 1", xmlns: "http://www.w3.org/2000/svg", width: i, height: i, viewBox: "0 0 95 95", children: /* @__PURE__ */ U("g", { id: "Grupo_1315", "data-name": "Grupo 1315", children: [
1615
- /* @__PURE__ */ O(
1616
- "path",
1617
- {
1618
- id: "Trazado_2280",
1619
- "data-name": "Trazado 2280",
1620
- style: { fill: e },
1621
- d: "M0,13.62c.09-.37.16-.76.26-1.14a7.22,7.22,0,0,1,7-5.28H24.3c.23,0,.3,0,.29-.29a7,7,0,0,1,.58-3.25A6.37,6.37,0,0,1,33.63.6a6.47,6.47,0,0,1,1.75,1.22,6.2,6.2,0,0,1,1.89,4.53c0,.22,0,.43,0,.65s0,.2.21.2H54.63a7.21,7.21,0,0,1,7.24,7.18V34.23a1.45,1.45,0,0,1-1.33,1.55h-.16A1.44,1.44,0,0,1,59,34.5c0-.12,0-.25,0-.37V14.55a4.33,4.33,0,0,0-4.2-4.46H7.4A4.34,4.34,0,0,0,3,13.44a4.07,4.07,0,0,0-.12,1V79.22a4.33,4.33,0,0,0,4.32,4.32H54.44a1.5,1.5,0,0,1,1.49.83,1.45,1.45,0,0,1-.68,1.93,1.39,1.39,0,0,1-.53.14,2.62,2.62,0,0,1-.28,0H7.29A7.25,7.25,0,0,1,.06,80.26c0-.1,0-.21-.06-.3ZM30.91,7.2h3.23c.17,0,.23,0,.22-.22s0-.47,0-.7A3.43,3.43,0,0,0,28,4.62a4.27,4.27,0,0,0-.45,2.3c0,.22,0,.29.27.29,1,0,2.09,0,3.14,0Z"
1622
- }
1623
- ),
1624
- /* @__PURE__ */ O(
1625
- "path",
1626
- {
1627
- id: "Trazado_2281",
1628
- "data-name": "Trazado 2281",
1629
- style: { fill: e },
1630
- d: "M54.79,38.4c8.35-.94,15.22,1.7,20.36,8.46A19.94,19.94,0,0,1,79.1,57a20.86,20.86,0,0,1-2,11.63.24.24,0,0,0,.05.34h0L92.23,82.66a5.82,5.82,0,1,1-7.83,8.62l-.07-.06Q76.76,84.37,69.2,77.47c-.15-.13-.23-.09-.37,0a21.24,21.24,0,0,1-7,2.6,21.08,21.08,0,0,1-21-8.55,20.4,20.4,0,0,1-3.79-10A21.15,21.15,0,0,1,51.26,39.31,23.75,23.75,0,0,1,54.79,38.4Zm21.72,18A18.62,18.62,0,1,0,61,77.68h0A18.64,18.64,0,0,0,76.51,56.39Zm15.08,30a3.31,3.31,0,0,0-1.12-2L75.89,71.17c-.16-.14-.23-.14-.36,0a20.4,20.4,0,0,1-4.16,4.49c-.2.15-.19.23,0,.39,1.78,1.6,3.56,3.22,5.34,4.84l9.39,8.52a3.32,3.32,0,0,0,5.5-3Z"
1631
- }
1632
- ),
1633
- /* @__PURE__ */ O(
1634
- "path",
1635
- {
1636
- id: "Trazado_2282",
1637
- "data-name": "Trazado 2282",
1638
- style: { fill: e },
1639
- d: "M31,19.9H20.38A5.76,5.76,0,0,1,14.57,15a3.12,3.12,0,0,1,0-1.1,1.45,1.45,0,0,1,2.88.22,2.85,2.85,0,0,0,1.74,2.68A2.54,2.54,0,0,0,20.3,17H42a2.9,2.9,0,0,0,2.89-2.85,1.46,1.46,0,0,1,2.91-.07v.1a5.8,5.8,0,0,1-5.72,5.72Z"
1640
- }
1641
- ),
1642
- /* @__PURE__ */ O(
1643
- "path",
1644
- {
1645
- id: "Trazado_2283",
1646
- "data-name": "Trazado 2283",
1647
- style: { fill: e },
1648
- d: "M13.22,68V66.07A1.86,1.86,0,0,1,15,64.15c1.36,0,2.73,0,4.09,0A1.86,1.86,0,0,1,20.88,66q0,2,0,3.93A1.91,1.91,0,0,1,19,71.83c-1.28,0-2.57,0-3.85,0a1.91,1.91,0,0,1-1.91-1.9V68Zm2.24,0v.76a.77.77,0,0,0,.71.85.28.28,0,0,0,.13,0c.5,0,1,0,1.49,0a.78.78,0,0,0,.85-.73v-.09c0-.51,0-1,0-1.54a.76.76,0,0,0-.72-.8h0a12.2,12.2,0,0,0-1.71,0,.76.76,0,0,0-.72.79h0V68Z"
1649
- }
1650
- ),
1651
- /* @__PURE__ */ O(
1652
- "path",
1653
- {
1654
- id: "Trazado_2284",
1655
- "data-name": "Trazado 2284",
1656
- style: { fill: e },
1657
- d: "M13.22,52.67V50.75a1.87,1.87,0,0,1,1.83-1.9q2,0,4,0a1.88,1.88,0,0,1,1.84,1.81c0,1.35,0,2.71,0,4.06a1.84,1.84,0,0,1-1.77,1.79,39.85,39.85,0,0,1-4.09,0,1.85,1.85,0,0,1-1.81-1.89.19.19,0,0,1,0-.08ZM17,54.27h.76a.79.79,0,0,0,.84-.73v-.07c0-.52,0-1,0-1.57a.76.76,0,0,0-.71-.79c-.6,0-1.2,0-1.79,0a.74.74,0,0,0-.68.75q0,.83,0,1.65a.77.77,0,0,0,.77.75Z"
1658
- }
1659
- ),
1660
- /* @__PURE__ */ O(
1661
- "path",
1662
- {
1663
- id: "Trazado_2285",
1664
- "data-name": "Trazado 2285",
1665
- style: { fill: e },
1666
- d: "M13.22,37.38v-2a1.88,1.88,0,0,1,1.86-1.87q2,0,3.93,0a1.85,1.85,0,0,1,1.86,1.78c0,1.37,0,2.74,0,4.12A1.85,1.85,0,0,1,19,41.23q-2,0-4,0a1.88,1.88,0,0,1-1.85-1.9ZM17.05,39h.75a.8.8,0,0,0,.84-.74v-.06c0-.53,0-1,0-1.57a.77.77,0,0,0-.75-.8H16.2a.77.77,0,0,0-.74.76c0,.55,0,1.1,0,1.66a.77.77,0,0,0,.77.75c.27,0,.54,0,.81,0Z"
1667
- }
1668
- ),
1669
- /* @__PURE__ */ O(
1670
- "path",
1671
- {
1672
- id: "Trazado_2286",
1673
- "data-name": "Trazado 2286",
1674
- style: { fill: e },
1675
- d: "M30.54,38.84h-5a1.45,1.45,0,0,1-1.47-1.43A1.48,1.48,0,0,1,25.26,36a2,2,0,0,1,.35,0h9.87a1.45,1.45,0,0,1,.11,2.9H30.54Z"
1676
- }
1677
- ),
1678
- /* @__PURE__ */ O(
1679
- "path",
1680
- {
1681
- id: "Trazado_2287",
1682
- "data-name": "Trazado 2287",
1683
- style: { fill: e },
1684
- d: "M28.44,54.14H25.59a1.44,1.44,0,0,1-1.49-1.39s0,0,0-.06a1.48,1.48,0,0,1,1.47-1.46h5.73a1.45,1.45,0,0,1,1.52,1.38,1.44,1.44,0,0,1-1.37,1.52h-3Z"
1685
- }
1686
- ),
1687
- /* @__PURE__ */ O(
1688
- "path",
1689
- {
1690
- id: "Trazado_2288",
1691
- "data-name": "Trazado 2288",
1692
- style: { fill: e },
1693
- d: "M27.36,66.54c.63,0,1.26,0,1.9,0a1.44,1.44,0,0,1,1.36,1.27,1.47,1.47,0,0,1-1,1.56,1.6,1.6,0,0,1-.54.07H25.64a1.46,1.46,0,0,1-.17-2.91.43.43,0,0,1,.16,0h1.73Z"
1694
- }
1695
- ),
1696
- /* @__PURE__ */ O(
1697
- "path",
1698
- {
1699
- id: "Trazado_2289",
1700
- "data-name": "Trazado 2289",
1701
- style: { fill: e },
1702
- d: "M54.49,47.45a13.8,13.8,0,0,1,8.82,1.95,12.64,12.64,0,0,1,4.62,5.36,18.36,18.36,0,0,1,1.44,4.33,1.24,1.24,0,0,1-1,1.45h0A1.22,1.22,0,0,1,67,59.63a16.4,16.4,0,0,0-1.56-4.37A9.91,9.91,0,0,0,57,49.91a11.82,11.82,0,0,0-2.59.08,1.23,1.23,0,0,1-1.47-.94v0a1.23,1.23,0,0,1,1-1.47H54Z"
1703
- }
1704
- )
1705
- ] }) }), Je = /* @__PURE__ */ O(Be, {}), qe = ({
1706
- onActionClick: i,
1707
- icon: e = Je,
1708
- actionTex: t = le("reloadPage"),
1709
- text: s = le("noResultsFound")
1710
- }) => /* @__PURE__ */ U("div", { className: "empty-state-container", children: [
1711
- e,
1712
- /* @__PURE__ */ U("div", { className: "link-container", children: [
1713
- /* @__PURE__ */ U("span", { children: [
1714
- " ",
1715
- s,
1716
- " "
1717
- ] }),
1718
- i && /* @__PURE__ */ O("a", { onClick: i, children: t })
1719
- ] })
1720
- ] }), Ye = ({ size: i = 40 }) => /* @__PURE__ */ O("div", { style: { width: i, height: i }, className: "loader" });
1721
- export {
1722
- Qe as Button,
1723
- qe as EmptyState,
1724
- Be as SearchPublication,
1725
- Ye as Spinner
1726
- };