@deriv-com/translations 1.4.2 → 1.4.3

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,52 +0,0 @@
1
- //#region node_modules/react-i18next/dist/es/unescape.js
2
- var e = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g, t = {
3
- "&": "&",
4
- "&": "&",
5
- "&lt;": "<",
6
- "&#60;": "<",
7
- "&gt;": ">",
8
- "&#62;": ">",
9
- "&apos;": "'",
10
- "&#39;": "'",
11
- "&quot;": "\"",
12
- "&#34;": "\"",
13
- "&nbsp;": " ",
14
- "&#160;": " ",
15
- "&copy;": "©",
16
- "&#169;": "©",
17
- "&reg;": "®",
18
- "&#174;": "®",
19
- "&hellip;": "…",
20
- "&#8230;": "…",
21
- "&#x2F;": "/",
22
- "&#47;": "/"
23
- }, n = (e) => t[e], r = (t) => t.replace(e, n), i = {
24
- bindI18n: "languageChanged",
25
- bindI18nStore: "",
26
- transEmptyNodeValue: "",
27
- transSupportBasicHtmlNodes: !0,
28
- transWrapTextNodes: "",
29
- transKeepBasicHtmlNodesFor: [
30
- "br",
31
- "strong",
32
- "i",
33
- "p"
34
- ],
35
- useSuspense: !0,
36
- unescape: r,
37
- transDefaultProps: void 0
38
- }, a = (e = {}) => {
39
- i = {
40
- ...i,
41
- ...e
42
- };
43
- }, o = () => i, s, c = (e) => {
44
- s = e;
45
- }, l = () => s, u = {
46
- type: "3rdParty",
47
- init(e) {
48
- a(e.options.react), c(e);
49
- }
50
- };
51
- //#endregion
52
- export { r as i, l as n, o as r, u as t };
@@ -1,366 +0,0 @@
1
- import { i as e, t } from "./chunk-DeC0fbbY.js";
2
- import { n } from "./i18next-DzZwHOzH.js";
3
- import { a as r, i, n as a, o, r as s, t as c } from "./useTranslation-Ws-GUPE_.js";
4
- import { i as l, n as u, r as d } from "./initReactI18next-AIGy7ACI.js";
5
- import { n as f, t as p } from "./jsx-runtime-BJITdUlL.js";
6
- import { Children as m, Fragment as h, cloneElement as g, createElement as _, forwardRef as v, isValidElement as y, useContext as b } from "react";
7
- //#endregion
8
- //#region node_modules/html-parse-stringify/dist/html-parse-stringify.module.js
9
- var x = /* @__PURE__ */ e((/* @__PURE__ */ t(((e, t) => {
10
- t.exports = {
11
- area: !0,
12
- base: !0,
13
- br: !0,
14
- col: !0,
15
- embed: !0,
16
- hr: !0,
17
- img: !0,
18
- input: !0,
19
- link: !0,
20
- meta: !0,
21
- param: !0,
22
- source: !0,
23
- track: !0,
24
- wbr: !0
25
- };
26
- })))()), S = /\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;
27
- function C(e) {
28
- var t = {
29
- type: "tag",
30
- name: "",
31
- voidElement: !1,
32
- attrs: {},
33
- children: []
34
- }, n = e.match(/<\/?([^\s]+?)[/\s>]/);
35
- if (n && (t.name = n[1], (x.default[n[1]] || e.charAt(e.length - 2) === "/") && (t.voidElement = !0), t.name.startsWith("!--"))) {
36
- var r = e.indexOf("-->");
37
- return {
38
- type: "comment",
39
- comment: r === -1 ? "" : e.slice(4, r)
40
- };
41
- }
42
- for (var i = new RegExp(S), a = null; (a = i.exec(e)) !== null;) if (a[0].trim()) if (a[1]) {
43
- var o = a[1].trim(), s = [o, ""];
44
- o.indexOf("=") > -1 && (s = o.split("=")), t.attrs[s[0]] = s[1], i.lastIndex--;
45
- } else a[2] && (t.attrs[a[2]] = a[3].trim().substring(1, a[3].length - 1));
46
- return t;
47
- }
48
- var w = /<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g, T = /^\s*$/, E = Object.create(null);
49
- function D(e, t) {
50
- switch (t.type) {
51
- case "text": return e + t.content;
52
- case "tag": return e += "<" + t.name + (t.attrs ? function(e) {
53
- var t = [];
54
- for (var n in e) t.push(n + "=\"" + e[n] + "\"");
55
- return t.length ? " " + t.join(" ") : "";
56
- }(t.attrs) : "") + (t.voidElement ? "/>" : ">"), t.voidElement ? e : e + t.children.reduce(D, "") + "</" + t.name + ">";
57
- case "comment": return e + "<!--" + t.comment + "-->";
58
- }
59
- }
60
- var O = {
61
- parse: function(e, t) {
62
- t ||= {}, t.components ||= E;
63
- var n, r = [], i = [], a = -1, o = !1;
64
- if (e.indexOf("<") !== 0) {
65
- var s = e.indexOf("<");
66
- r.push({
67
- type: "text",
68
- content: s === -1 ? e : e.substring(0, s)
69
- });
70
- }
71
- return e.replace(w, function(s, c) {
72
- if (o) {
73
- if (s !== "</" + n.name + ">") return;
74
- o = !1;
75
- }
76
- var l, u = s.charAt(1) !== "/", d = s.startsWith("<!--"), f = c + s.length, p = e.charAt(f);
77
- if (d) {
78
- var m = C(s);
79
- return a < 0 ? (r.push(m), r) : ((l = i[a]).children.push(m), r);
80
- }
81
- if (u && (a++, (n = C(s)).type === "tag" && t.components[n.name] && (n.type = "component", o = !0), n.voidElement || o || !p || p === "<" || n.children.push({
82
- type: "text",
83
- content: e.slice(f, e.indexOf("<", f))
84
- }), a === 0 && r.push(n), (l = i[a - 1]) && l.children.push(n), i[a] = n), (!u || n.voidElement) && (a > -1 && (n.voidElement || n.name === s.slice(2, -1)) && (a--, n = a === -1 ? r : i[a]), !o && p !== "<" && p)) {
85
- l = a === -1 ? r : i[a].children;
86
- var h = e.indexOf("<", f), g = e.slice(f, h === -1 ? void 0 : h);
87
- T.test(g) && (g = " "), (h > -1 && a + l.length >= 0 || g !== " ") && l.push({
88
- type: "text",
89
- content: g
90
- });
91
- }
92
- }), r;
93
- },
94
- stringify: function(e) {
95
- return e.reduce(function(e, t) {
96
- return e + D("", t);
97
- }, "");
98
- }
99
- }, k = (e, t) => {
100
- if (!e) return !1;
101
- let n = e.props?.children ?? e.children;
102
- return t ? n.length > 0 : !!n;
103
- }, A = (e) => {
104
- if (!e) return [];
105
- let t = e.props?.children ?? e.children;
106
- return e.props?.i18nIsDynamicList ? M(t) : t;
107
- }, j = (e) => Array.isArray(e) && e.every(y), M = (e) => Array.isArray(e) ? e : [e], N = (e, t) => {
108
- let n = { ...t };
109
- return n.props = {
110
- ...t.props,
111
- ...e.props
112
- }, n;
113
- }, P = (e) => {
114
- let t = {};
115
- if (!e) return t;
116
- let n = (e) => {
117
- M(e).forEach((e) => {
118
- i(e) || (k(e) ? n(A(e)) : s(e) && !y(e) && Object.assign(t, e));
119
- });
120
- };
121
- return n(e), t;
122
- }, F = (e, t, n, a) => {
123
- if (!e) return "";
124
- let o = "", c = M(e), l = t?.transSupportBasicHtmlNodes ? t.transKeepBasicHtmlNodesFor ?? [] : [];
125
- return c.forEach((e, c) => {
126
- if (i(e)) {
127
- o += `${e}`;
128
- return;
129
- }
130
- if (y(e)) {
131
- let { props: r, type: s } = e, u = Object.keys(r).length, d = l.indexOf(s) > -1, f = r.children;
132
- if (!f && d && !u) {
133
- o += `<${s}/>`;
134
- return;
135
- }
136
- if (!f && (!d || u) || r.i18nIsDynamicList) {
137
- o += `<${c}></${c}>`;
138
- return;
139
- }
140
- if (d && u <= 1) {
141
- let e = i(f) ? f : F(f, t, n, a);
142
- o += `<${s}>${e}</${s}>`;
143
- return;
144
- }
145
- let p = F(f, t, n, a);
146
- o += `<${c}>${p}</${c}>`;
147
- return;
148
- }
149
- if (e === null) {
150
- r(n, "TRANS_NULL_VALUE", "Passed in a null value as child", { i18nKey: a });
151
- return;
152
- }
153
- if (s(e)) {
154
- let { format: t, ...i } = e, s = Object.keys(i);
155
- if (s.length === 1) {
156
- let e = t ? `${s[0]}, ${t}` : s[0];
157
- o += `{{${e}}}`;
158
- return;
159
- }
160
- r(n, "TRANS_INVALID_OBJ", "Invalid child - Object should only have keys {{ value, format }} (format is optional).", {
161
- i18nKey: a,
162
- child: e
163
- });
164
- return;
165
- }
166
- r(n, "TRANS_INVALID_VAR", "Passed in a variable like {number} - pass variables for interpolation as full objects like {{number}}.", {
167
- i18nKey: a,
168
- child: e
169
- });
170
- }), o;
171
- }, I = (e, t = [], n = {}) => {
172
- if (!e) return e;
173
- let r = Object.keys(n), i = [...t, ...r], a = "", o = 0;
174
- for (; o < e.length;) if (e[o] === "<") {
175
- let t = !1, n = e.slice(o).match(/^<\/(\d+|[a-zA-Z][a-zA-Z0-9_-]*)>/);
176
- if (n) {
177
- let e = n[1];
178
- (/^\d+$/.test(e) || i.includes(e)) && (t = !0, a += n[0], o += n[0].length);
179
- }
180
- if (!t) {
181
- let n = e.slice(o).match(/^<(\d+|[a-zA-Z][a-zA-Z0-9_-]*)(\s+[\w-]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?)*\s*(\/)?>/);
182
- if (n) {
183
- let e = n[1];
184
- (/^\d+$/.test(e) || i.includes(e)) && (t = !0, a += n[0], o += n[0].length);
185
- }
186
- }
187
- t || (a += "&lt;", o += 1);
188
- } else a += e[o], o += 1;
189
- return a;
190
- }, L = (e, t, n, r, a, o, c) => {
191
- if (n === "") return [];
192
- let u = a.transKeepBasicHtmlNodesFor || [], f = n && new RegExp(u.map((e) => `<${e}`).join("|")).test(n);
193
- if (!e && !t && !f && !c) return [n];
194
- let p = t ?? {}, h = (e) => {
195
- M(e).forEach((e) => {
196
- i(e) || (k(e) ? h(A(e)) : s(e) && !y(e) && Object.assign(p, e));
197
- });
198
- };
199
- h(e);
200
- let v = I(n, u, p), b = O.parse(`<0>${v}</0>`), x = {
201
- ...p,
202
- ...o
203
- }, S = (e, t, n) => {
204
- let r = A(e), i = w(r, t.children, n);
205
- return j(r) && i.length === 0 || e.props?.i18nIsDynamicList ? r : i;
206
- }, C = (e, t, n, r, i) => {
207
- e.dummy ? (e.children = t, n.push(g(e, { key: r }, i ? void 0 : t))) : n.push(...m.map([e], (e) => {
208
- let n = "data-i18n-is-dynamic-list", a = {
209
- key: r,
210
- [n]: void 0
211
- };
212
- return e && e.props && Object.keys(e.props).forEach((t) => {
213
- t === "ref" || t === "children" || t === "i18nIsDynamicList" || t === n || (a[t] = e.props[t]);
214
- }), g(e, a, i ? null : t);
215
- }));
216
- }, w = (e, n, o) => {
217
- let p = M(e);
218
- return M(n).reduce((e, n, m) => {
219
- let h = n.children?.[0]?.content && r.services.interpolator.interpolate(n.children[0].content, x, r.language);
220
- if (n.type === "tag") {
221
- let d = p[parseInt(n.name, 10)];
222
- !d && t && (d = t[n.name]), o.length === 1 && !d && (d = o[0][n.name]), d ||= {};
223
- let g = { ...n.attrs };
224
- c && Object.keys(g).forEach((e) => {
225
- let t = g[e];
226
- i(t) && (g[e] = l(t));
227
- });
228
- let v = Object.keys(g).length === 0 ? d : N({ props: g }, d), b = y(v), T = b && k(n, !0) && !n.voidElement, E = f && s(v) && v.dummy && !b, D = s(t) && Object.hasOwnProperty.call(t, n.name);
229
- if (i(v)) {
230
- let t = r.services.interpolator.interpolate(v, x, r.language);
231
- e.push(t);
232
- } else if (k(v) || T) C(v, S(v, n, o), e, m);
233
- else if (E) C(v, w(p, n.children, o), e, m);
234
- else if (Number.isNaN(parseFloat(n.name))) if (D) C(v, S(v, n, o), e, m, n.voidElement);
235
- else if (a.transSupportBasicHtmlNodes && u.indexOf(n.name) > -1) if (n.voidElement) e.push(_(n.name, { key: `${n.name}-${m}` }));
236
- else {
237
- let t = w(p, n.children, o);
238
- e.push(_(n.name, { key: `${n.name}-${m}` }, t));
239
- }
240
- else if (n.voidElement) e.push(`<${n.name} />`);
241
- else {
242
- let t = w(p, n.children, o);
243
- e.push(`<${n.name}>${t}</${n.name}>`);
244
- }
245
- else if (s(v) && !b) {
246
- let t = n.children[0] ? h : null;
247
- t && e.push(t);
248
- } else C(v, h, e, m, n.children.length !== 1 || !h);
249
- } else if (n.type === "text") {
250
- let t = a.transWrapTextNodes, i = typeof a.unescape == "function" ? a.unescape : d().unescape, o = c ? i(r.services.interpolator.interpolate(n.content, x, r.language)) : r.services.interpolator.interpolate(n.content, x, r.language);
251
- t ? e.push(_(t, { key: `${n.name}-${m}` }, o)) : e.push(o);
252
- }
253
- return e;
254
- }, []);
255
- };
256
- return A(w([{
257
- dummy: !0,
258
- children: e || []
259
- }], b, M(e || []))[0]);
260
- }, R = (e, t, n) => {
261
- let r = e.key || t, i = g(e, { key: r });
262
- if (!i.props || !i.props.children || n.indexOf(`${t}/>`) < 0 && n.indexOf(`${t} />`) < 0) return i;
263
- function a() {
264
- return _(h, null, i);
265
- }
266
- return _(a, { key: r });
267
- }, z = (e, t) => e.map((e, n) => R(e, n, t)), B = (e, t) => {
268
- let n = {};
269
- return Object.keys(e).forEach((r) => {
270
- Object.assign(n, { [r]: R(e[r], r, t) });
271
- }), n;
272
- }, V = (e, t, n, r) => e ? Array.isArray(e) ? z(e, t) : s(e) ? B(e, t) : (o(n, "TRANS_INVALID_COMPONENTS", "<Trans /> \"components\" prop expects an object or array", { i18nKey: r }), null) : null, H = (e) => !s(e) || Array.isArray(e) ? !1 : Object.keys(e).reduce((e, t) => e && Number.isNaN(Number.parseFloat(t)), !0);
273
- function U({ children: e, count: t, parent: r, i18nKey: a, context: s, tOptions: c = {}, values: l, defaults: f, components: p, ns: m, i18n: h, t: g, shouldUnescape: v, ...y }) {
274
- let b = h || u();
275
- if (!b) return o(b, "NO_I18NEXT_INSTANCE", "Trans: You need to pass in an i18next instance using i18nextReactModule", { i18nKey: a }), e;
276
- let x = g || b.t.bind(b) || ((e) => e), S = {
277
- ...d(),
278
- ...b.options?.react
279
- }, C = m || x.ns || b.options?.defaultNS;
280
- C = i(C) ? [C] : C || ["translation"];
281
- let { transDefaultProps: w } = S, T = w?.tOptions ? {
282
- ...w.tOptions,
283
- ...c
284
- } : c, E = v ?? w?.shouldUnescape, D = w?.values ? {
285
- ...w.values,
286
- ...l
287
- } : l, O = w?.components ? {
288
- ...w.components,
289
- ...p
290
- } : p, k = F(e, S, b, a), A = f || T?.defaultValue || k || S.transEmptyNodeValue || (typeof a == "function" ? n(a) : a), { hashTransKey: j } = S, M = a || (j ? j(k || A) : k || A);
291
- l = b.options?.interpolation?.defaultVariables ? D && Object.keys(D).length > 0 ? {
292
- ...D,
293
- ...b.options.interpolation.defaultVariables
294
- } : { ...b.options.interpolation.defaultVariables } : D;
295
- let N = P(e);
296
- N && typeof N.count == "number" && t === void 0 && (t = N.count);
297
- let I = l || t !== void 0 && !b.options?.interpolation?.alwaysFormat || !e ? T.interpolation : { interpolation: {
298
- ...T.interpolation,
299
- prefix: "#$?",
300
- suffix: "?$#"
301
- } }, R = {
302
- ...T,
303
- context: s || T.context,
304
- count: t,
305
- ...l,
306
- ...I,
307
- defaultValue: A,
308
- ns: C
309
- }, z = M ? x(M, R) : A;
310
- z === M && A && (z = A);
311
- let B = V(O, z, b, a), U = B || e, W = null;
312
- H(B) && (W = B, U = e);
313
- let G = L(U, W, z, b, S, R, E), K = r ?? S.defaultTransParent;
314
- return K ? _(K, y, G) : G;
315
- }
316
- //#endregion
317
- //#region node_modules/react-i18next/dist/es/Trans.js
318
- function W({ children: e, count: t, parent: n, i18nKey: r, context: i, tOptions: a = {}, values: o, defaults: s, components: c, ns: l, i18n: d, t: p, shouldUnescape: m, ...h }) {
319
- let { i18n: g, defaultNS: _ } = b(f) || {}, v = d || g || u(), y = p || v?.t.bind(v);
320
- return U({
321
- children: e,
322
- count: t,
323
- parent: n,
324
- i18nKey: r,
325
- context: i,
326
- tOptions: a,
327
- values: o,
328
- defaults: s,
329
- components: c,
330
- ns: l || y?.ns || _ || v?.options?.defaultNS,
331
- i18n: v,
332
- t: p,
333
- shouldUnescape: m,
334
- ...h
335
- });
336
- }
337
- //#endregion
338
- //#region node_modules/react-i18next/dist/es/withTranslation.js
339
- var G = (e, t = {}) => function(n) {
340
- function r({ forwardedRef: r, ...i }) {
341
- let [a, o, s] = c(e, {
342
- ...i,
343
- keyPrefix: t.keyPrefix
344
- }), l = {
345
- ...i,
346
- t: a,
347
- i18n: o,
348
- tReady: s
349
- };
350
- return t.withRef && r ? l.ref = r : !t.withRef && r && (l.forwardedRef = r), _(n, l);
351
- }
352
- return r.displayName = `withI18nextTranslation(${a(n)})`, r.WrappedComponent = n, t.withRef ? v((e, t) => _(r, Object.assign({}, e, { forwardedRef: t }))) : r;
353
- }, K = p();
354
- function q({ i18n: e, i18n_default_text: t, values: n, components: r, options: i, shouldUnescape: a }) {
355
- return /* @__PURE__ */ (0, K.jsx)(W, {
356
- defaults: t,
357
- i18n: e,
358
- values: n,
359
- components: r,
360
- tOptions: i,
361
- shouldUnescape: a
362
- });
363
- }
364
- var J = G()(q);
365
- //#endregion
366
- export { J as t };
@@ -1 +0,0 @@
1
- export {};
@@ -1,34 +0,0 @@
1
- import { n as e, t } from "./jsx-runtime-BJITdUlL.js";
2
- import "./utils-17GMfKvo.js";
3
- import { LANGUAGE_KEY as n } from "./utils/constants.js";
4
- import { createContext as r, createElement as i, useEffect as a, useMemo as o, useState as s } from "react";
5
- //#region node_modules/react-i18next/dist/es/I18nextProvider.js
6
- function c({ i18n: t, defaultNS: n, children: r }) {
7
- let a = o(() => ({
8
- i18n: t,
9
- defaultNS: n
10
- }), [t, n]);
11
- return i(e.Provider, { value: a }, r);
12
- }
13
- //#endregion
14
- //#region src/provider/translation-provider.tsx
15
- var l = t(), u = r(null);
16
- function d({ defaultLang: e, i18nInstance: t, children: r }) {
17
- let [i, o] = s(e || ""), [d, f] = s(!1);
18
- return a(() => {
19
- t && (o(t.language || e || ""), f(!0));
20
- }, [t, e]), !t || !d ? null : /* @__PURE__ */ (0, l.jsx)(c, {
21
- i18n: t,
22
- children: /* @__PURE__ */ (0, l.jsx)(u.Provider, {
23
- value: {
24
- currentLang: i,
25
- switchLanguage: (e) => {
26
- t.changeLanguage(e), o(e), localStorage.setItem(n, JSON.stringify(e));
27
- }
28
- },
29
- children: r
30
- })
31
- });
32
- }
33
- //#endregion
34
- export { d as n, u as t };
@@ -1,221 +0,0 @@
1
- import { r as e, t } from "./chunk-DeC0fbbY.js";
2
- import { n, r } from "./initReactI18next-AIGy7ACI.js";
3
- import { n as i, r as a } from "./jsx-runtime-BJITdUlL.js";
4
- import { useCallback as o, useContext as s, useEffect as c, useMemo as l, useRef as u, useState as d } from "react";
5
- //#region node_modules/react-i18next/dist/es/utils.js
6
- var f = (e, t, n, r) => {
7
- let i = [n, {
8
- code: t,
9
- ...r || {}
10
- }];
11
- if (e?.services?.logger?.forward) return e.services.logger.forward(i, "warn", "react-i18next::", !0);
12
- b(i[0]) && (i[0] = `react-i18next:: ${i[0]}`), e?.services?.logger?.warn ? e.services.logger.warn(...i) : console?.warn && console.warn(...i);
13
- }, p = {}, m = (e, t, n, r) => {
14
- b(n) && p[n] || (b(n) && (p[n] = /* @__PURE__ */ new Date()), f(e, t, n, r));
15
- }, h = (e, t) => () => {
16
- if (e.isInitialized) t();
17
- else {
18
- let n = () => {
19
- setTimeout(() => {
20
- e.off("initialized", n);
21
- }, 0), t();
22
- };
23
- e.on("initialized", n);
24
- }
25
- }, g = (e, t, n) => {
26
- e.loadNamespaces(t, h(e, n));
27
- }, _ = (e, t, n, r) => {
28
- if (b(n) && (n = [n]), e.options.preload && e.options.preload.indexOf(t) > -1) return g(e, n, r);
29
- n.forEach((t) => {
30
- e.options.ns.indexOf(t) < 0 && e.options.ns.push(t);
31
- }), e.loadLanguages(t, h(e, r));
32
- }, v = (e, t, n = {}) => !t.languages || !t.languages.length ? (m(t, "NO_LANGUAGES", "i18n.languages were undefined or empty", { languages: t.languages }), !0) : t.hasLoadedNamespace(e, {
33
- lng: n.lng,
34
- precheck: (t, r) => {
35
- if (n.bindI18n && n.bindI18n.indexOf("languageChanging") > -1 && t.services.backendConnector.backend && t.isLanguageChangingTo && !r(t.isLanguageChangingTo, e)) return !1;
36
- }
37
- }), y = (e) => e.displayName || e.name || (b(e) && e.length > 0 ? e : "Unknown"), b = (e) => typeof e == "string", x = (e) => typeof e == "object" && !!e, S = /* @__PURE__ */ t(((t) => {
38
- var n = e("react");
39
- function r(e, t) {
40
- return e === t && (e !== 0 || 1 / e == 1 / t) || e !== e && t !== t;
41
- }
42
- var i = typeof Object.is == "function" ? Object.is : r, a = n.useState, o = n.useEffect, s = n.useLayoutEffect, c = n.useDebugValue;
43
- function l(e, t) {
44
- var n = t(), r = a({ inst: {
45
- value: n,
46
- getSnapshot: t
47
- } }), i = r[0].inst, l = r[1];
48
- return s(function() {
49
- i.value = n, i.getSnapshot = t, u(i) && l({ inst: i });
50
- }, [
51
- e,
52
- n,
53
- t
54
- ]), o(function() {
55
- return u(i) && l({ inst: i }), e(function() {
56
- u(i) && l({ inst: i });
57
- });
58
- }, [e]), c(n), n;
59
- }
60
- function u(e) {
61
- var t = e.getSnapshot;
62
- e = e.value;
63
- try {
64
- var n = t();
65
- return !i(e, n);
66
- } catch {
67
- return !0;
68
- }
69
- }
70
- function d(e, t) {
71
- return t();
72
- }
73
- var f = typeof window > "u" || window.document === void 0 || window.document.createElement === void 0 ? d : l;
74
- t.useSyncExternalStore = n.useSyncExternalStore === void 0 ? f : n.useSyncExternalStore;
75
- })), C = /* @__PURE__ */ t(((t) => {
76
- process.env.NODE_ENV !== "production" && (function() {
77
- function n(e, t) {
78
- return e === t && (e !== 0 || 1 / e == 1 / t) || e !== e && t !== t;
79
- }
80
- function r(e, t) {
81
- f || o.startTransition === void 0 || (f = !0, console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));
82
- var n = t();
83
- if (!p) {
84
- var r = t();
85
- s(n, r) || (console.error("The result of getSnapshot should be cached to avoid an infinite loop"), p = !0);
86
- }
87
- r = c({ inst: {
88
- value: n,
89
- getSnapshot: t
90
- } });
91
- var a = r[0].inst, m = r[1];
92
- return u(function() {
93
- a.value = n, a.getSnapshot = t, i(a) && m({ inst: a });
94
- }, [
95
- e,
96
- n,
97
- t
98
- ]), l(function() {
99
- return i(a) && m({ inst: a }), e(function() {
100
- i(a) && m({ inst: a });
101
- });
102
- }, [e]), d(n), n;
103
- }
104
- function i(e) {
105
- var t = e.getSnapshot;
106
- e = e.value;
107
- try {
108
- var n = t();
109
- return !s(e, n);
110
- } catch {
111
- return !0;
112
- }
113
- }
114
- function a(e, t) {
115
- return t();
116
- }
117
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
118
- var o = e("react"), s = typeof Object.is == "function" ? Object.is : n, c = o.useState, l = o.useEffect, u = o.useLayoutEffect, d = o.useDebugValue, f = !1, p = !1, m = typeof window > "u" || window.document === void 0 || window.document.createElement === void 0 ? a : r;
119
- t.useSyncExternalStore = o.useSyncExternalStore === void 0 ? m : o.useSyncExternalStore, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
120
- })();
121
- })), w = (/* @__PURE__ */ t(((e, t) => {
122
- process.env.NODE_ENV === "production" ? t.exports = S() : t.exports = C();
123
- })))(), T = {
124
- t: (e, t) => {
125
- if (b(t)) return t;
126
- if (x(t) && b(t.defaultValue)) return t.defaultValue;
127
- if (typeof e == "function") return "";
128
- if (Array.isArray(e)) {
129
- let t = e[e.length - 1];
130
- return typeof t == "function" ? "" : t;
131
- }
132
- return e;
133
- },
134
- ready: !1
135
- }, E = () => () => {}, D = (e, t = {}) => {
136
- let { i18n: f } = t, { i18n: p, defaultNS: h } = s(i) || {}, y = f || p || n();
137
- y && !y.reportNamespaces && (y.reportNamespaces = new a()), y || m(y, "NO_I18NEXT_INSTANCE", "useTranslation: You will need to pass in an i18next instance by using initReactI18next");
138
- let x = l(() => ({
139
- ...r(),
140
- ...y?.options?.react,
141
- ...t
142
- }), [y, t]), { useSuspense: S, keyPrefix: C } = x, D = e || h || y?.options?.defaultNS, O = b(D) ? [D] : D || ["translation"], k = l(() => O, O);
143
- y?.reportNamespaces?.addUsedNamespaces?.(k);
144
- let A = u(0), j = o((e) => {
145
- if (!y) return E;
146
- let { bindI18n: t, bindI18nStore: n } = x, r = () => {
147
- A.current += 1, e();
148
- };
149
- return t && y.on(t, r), n && y.store.on(n, r), () => {
150
- t && t.split(" ").forEach((e) => y.off(e, r)), n && n.split(" ").forEach((e) => y.store.off(e, r));
151
- };
152
- }, [y, x]), M = u(), N = o(() => {
153
- if (!y) return T;
154
- let e = !!(y.isInitialized || y.initializedStoreOnce) && k.every((e) => v(e, y, x)), n = t.lng || y.language, r = A.current, i = M.current;
155
- if (i && i.ready === e && i.lng === n && i.keyPrefix === C && i.revision === r) return i;
156
- let a = {
157
- t: y.getFixedT(n, x.nsMode === "fallback" ? k : k[0], C),
158
- ready: e,
159
- lng: n,
160
- keyPrefix: C,
161
- revision: r
162
- };
163
- return M.current = a, a;
164
- }, [
165
- y,
166
- k,
167
- C,
168
- x,
169
- t.lng
170
- ]), [P, F] = d(0), { t: I, ready: L } = (0, w.useSyncExternalStore)(j, N, N);
171
- c(() => {
172
- if (y && !L && !S) {
173
- let e = () => F((e) => e + 1);
174
- t.lng ? _(y, t.lng, k, e) : g(y, k, e);
175
- }
176
- }, [
177
- y,
178
- t.lng,
179
- k,
180
- L,
181
- S,
182
- P
183
- ]);
184
- let R = y || {}, z = u(null), B = u(), V = (e) => {
185
- let t = Object.getOwnPropertyDescriptors(e);
186
- t.__original && delete t.__original;
187
- let n = Object.create(Object.getPrototypeOf(e), t);
188
- if (!Object.prototype.hasOwnProperty.call(n, "__original")) try {
189
- Object.defineProperty(n, "__original", {
190
- value: e,
191
- writable: !1,
192
- enumerable: !1,
193
- configurable: !1
194
- });
195
- } catch {}
196
- return n;
197
- }, H = l(() => {
198
- let e = R, t = e?.language, n = e;
199
- e && (z.current && z.current.__original === e && B.current === t ? n = z.current : (n = V(e), z.current = n, B.current = t));
200
- let r = !L && !S ? (...e) => (m(y, "USE_T_BEFORE_READY", "useTranslation: t was called before ready. When using useSuspense: false, make sure to check the ready flag before using t."), I(...e)) : I, i = [
201
- r,
202
- n,
203
- L
204
- ];
205
- return i.t = r, i.i18n = n, i.ready = L, i;
206
- }, [
207
- I,
208
- R,
209
- L,
210
- R.resolvedLanguage,
211
- R.language,
212
- R.languages
213
- ]);
214
- if (y && S && !L) throw new Promise((e) => {
215
- let n = () => e();
216
- t.lng ? _(y, t.lng, k, n) : g(y, k, n);
217
- });
218
- return H;
219
- };
220
- //#endregion
221
- export { f as a, b as i, y as n, m as o, x as r, D as t };