@incodetech/web 2.0.0-alpha.1 → 2.0.0-alpha.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.
- package/dist/asset-manifest.json +18 -0
- package/dist/browser-ponyfill-B6W6hHVY.js +344 -0
- package/dist/button-DeMZ_34N.js +266 -0
- package/dist/button.css +335 -0
- package/dist/email/email.es.js +145 -0
- package/dist/email/styles.css +123 -0
- package/dist/flow/flow.es.js +9 -0
- package/dist/flow/styles.css +204 -0
- package/dist/flow-ZK6OBsa3.js +568 -0
- package/dist/incodeModule-BF5MX9GT.js +243 -0
- package/dist/incodeModule.css +119 -0
- package/dist/index.es.js +101 -0
- package/dist/otpInput-BUrV4IAF.js +151 -0
- package/dist/otpInput.css +167 -0
- package/dist/phone/phone.es.js +3442 -0
- package/dist/phone/styles.css +305 -0
- package/dist/selfie/selfie.es.js +893 -0
- package/dist/selfie/styles.css +1163 -0
- package/dist/selfieTutorial-C-u5GufD.js +29 -0
- package/dist/styles/core.css +1013 -0
- package/dist/styles/tokens.css +543 -0
- package/dist/successIcon.css +4 -0
- package/dist/title-ng7q7YDh.js +2161 -0
- package/dist/title.css +38 -0
- package/dist/types/core.d.ts +1 -0
- package/dist/types/email/email.d.ts +2 -0
- package/dist/types/email.d.ts +50 -0
- package/dist/types/flow/flow.d.ts +2 -0
- package/dist/types/flow.d.ts +46 -0
- package/dist/types/index.d.ts +223 -0
- package/dist/types/phone/phone.d.ts +2 -0
- package/dist/types/phone.d.ts +51 -0
- package/dist/types/selfie/selfie.d.ts +2 -0
- package/dist/types/selfie.d.ts +24 -0
- package/dist/types/styles/core.d.ts +1 -0
- package/dist/vendor-preact-CK0WeTOR.js +584 -0
- package/package.json +20 -17
- package/dev/README.md +0 -163
- package/dev/getToken.ts +0 -36
- package/dev/headless.html +0 -875
- package/dev/index.html +0 -366
- package/dev/main-headless.tsx +0 -1332
- package/dev/main-orchestrated-flow.tsx +0 -1158
- package/dev/main-preact.tsx +0 -323
- package/dev/main-simplified.tsx +0 -123
- package/dev/main-web-component.tsx +0 -256
- package/dev/main.tsx +0 -332
- package/dev/manual.html +0 -27
- package/dev/orchestrated-flow.html +0 -64
- package/dev/simplified.html +0 -64
- package/dev/tiktok-logo.svg +0 -7
- package/src/defineCustomElement.tsx +0 -30
- package/src/email/email.test.tsx +0 -368
- package/src/email/email.tsx +0 -255
- package/src/email/emailInput.test.tsx +0 -264
- package/src/email/emailInput.tsx +0 -85
- package/src/email/styles.css +0 -59
- package/src/flow/flow.test.tsx +0 -796
- package/src/flow/flow.tsx +0 -292
- package/src/flow/flowCompleted.css +0 -30
- package/src/flow/flowCompleted.test.tsx +0 -331
- package/src/flow/flowCompleted.tsx +0 -121
- package/src/flow/flowInit.test.ts +0 -264
- package/src/flow/flowInit.ts +0 -94
- package/src/flow/flowStart.css +0 -58
- package/src/flow/flowStart.test.tsx +0 -49
- package/src/flow/flowStart.tsx +0 -41
- package/src/flow/incode-logo.svg +0 -8
- package/src/flow/index.ts +0 -7
- package/src/flow/preloadFlow.test.ts +0 -421
- package/src/flow/preloadFlow.ts +0 -171
- package/src/flow/styles.css +0 -9
- package/src/flow/unsupportedModule.css +0 -21
- package/src/flow/unsupportedModule.tsx +0 -39
- package/src/flow/useFlowInitialization.test.tsx +0 -292
- package/src/flow/useFlowInitialization.ts +0 -128
- package/src/flow/useModuleLoader.test.tsx +0 -212
- package/src/flow/useModuleLoader.ts +0 -92
- package/src/hooks/index.ts +0 -1
- package/src/hooks/useManager.test.ts +0 -91
- package/src/hooks/useManager.ts +0 -40
- package/src/i18n/index.ts +0 -3
- package/src/i18n/instance.ts +0 -16
- package/src/i18n/setup.ts +0 -184
- package/src/i18n/useTranslation.ts +0 -42
- package/src/index.ts +0 -27
- package/src/permissions/assets/android-dots-icon.svg +0 -7
- package/src/permissions/assets/android-settings-icon.svg +0 -16
- package/src/permissions/assets/android-toggle-icon.svg +0 -20
- package/src/permissions/assets/bank-card-icon.svg +0 -14
- package/src/permissions/assets/camera-icon.svg +0 -12
- package/src/permissions/assets/camera-ios.svg +0 -53
- package/src/permissions/assets/check-icon.svg +0 -8
- package/src/permissions/assets/chrome-icon.svg +0 -43
- package/src/permissions/assets/password-icon.svg +0 -11
- package/src/permissions/assets/permissions-img.svg +0 -51
- package/src/permissions/assets/safari-icon.svg +0 -37
- package/src/permissions/assets/settings-icon.svg +0 -33
- package/src/permissions/assets/toggle-icon.svg +0 -19
- package/src/permissions/assets/warning-icon.svg +0 -6
- package/src/permissions/boldWithArrow.css +0 -9
- package/src/permissions/boldWithArrow.tsx +0 -41
- package/src/permissions/denied.css +0 -37
- package/src/permissions/denied.tsx +0 -29
- package/src/permissions/deniedAndroid.tsx +0 -56
- package/src/permissions/deniedDesktop.css +0 -9
- package/src/permissions/deniedDesktop.tsx +0 -64
- package/src/permissions/deniedIOS.tsx +0 -73
- package/src/permissions/deniedInstructions.tsx +0 -19
- package/src/permissions/iconWrapper.css +0 -9
- package/src/permissions/iconWrapper.tsx +0 -15
- package/src/permissions/learnMore.css +0 -37
- package/src/permissions/learnMore.tsx +0 -85
- package/src/permissions/numberedStep.css +0 -13
- package/src/permissions/numberedStep.tsx +0 -14
- package/src/permissions/permissions.css +0 -13
- package/src/permissions/permissions.tsx +0 -68
- package/src/phone/phone.tsx +0 -246
- package/src/phone/phoneInput.test.tsx +0 -275
- package/src/phone/phoneInput.tsx +0 -249
- package/src/phone/styles.css +0 -158
- package/src/selfie/cameraButton.css +0 -13
- package/src/selfie/cameraButton.tsx +0 -35
- package/src/selfie/capture.css +0 -57
- package/src/selfie/capture.tsx +0 -232
- package/src/selfie/errorModal.tsx +0 -218
- package/src/selfie/errorModalContent.css +0 -33
- package/src/selfie/errorModalContent.tsx +0 -44
- package/src/selfie/faceOutline.css +0 -5
- package/src/selfie/faceOutline.tsx +0 -22
- package/src/selfie/loadingBorder.css +0 -12
- package/src/selfie/loadingBorder.tsx +0 -77
- package/src/selfie/manualCaptureButton.css +0 -13
- package/src/selfie/manualCaptureButton.tsx +0 -35
- package/src/selfie/noMoreAttemptsModal.tsx +0 -44
- package/src/selfie/notification.css +0 -9
- package/src/selfie/notification.tsx +0 -36
- package/src/selfie/retryErrorModal.tsx +0 -56
- package/src/selfie/selfie.test.tsx +0 -458
- package/src/selfie/selfie.tsx +0 -83
- package/src/selfie/selfieTutorial.json +0 -2626
- package/src/selfie/styles.css +0 -1
- package/src/selfie/tutorial.test.tsx +0 -200
- package/src/selfie/tutorial.tsx +0 -43
- package/src/setup.ts +0 -33
- package/src/shared/baseTutorial/baseTutorial.css +0 -21
- package/src/shared/baseTutorial/baseTutorial.test.tsx +0 -184
- package/src/shared/baseTutorial/baseTutorial.tsx +0 -55
- package/src/shared/baseTutorial/replaceBaseTutorial.test.ts +0 -267
- package/src/shared/baseTutorial/replaceBaseTutorial.ts +0 -68
- package/src/shared/button/button.css +0 -55
- package/src/shared/button/button.test.tsx +0 -101
- package/src/shared/button/button.tsx +0 -47
- package/src/shared/componentRoot/incodeComponent.tsx +0 -12
- package/src/shared/countries/countries.test.ts +0 -75
- package/src/shared/countries/countries.ts +0 -139
- package/src/shared/countries/index.ts +0 -6
- package/src/shared/icons/chevronDown.tsx +0 -22
- package/src/shared/icons/index.ts +0 -2
- package/src/shared/icons/successIcon.css +0 -5
- package/src/shared/icons/successIcon.test.tsx +0 -40
- package/src/shared/icons/successIcon.tsx +0 -26
- package/src/shared/loader/loadingIcon.css +0 -28
- package/src/shared/loader/loadingIcon.tsx +0 -67
- package/src/shared/lottie/lottie.tsx +0 -108
- package/src/shared/otpInput/otpInput.css +0 -85
- package/src/shared/otpInput/otpInput.test.tsx +0 -356
- package/src/shared/otpInput/otpInput.tsx +0 -241
- package/src/shared/page/incode-logo.svg +0 -3
- package/src/shared/page/page.css +0 -47
- package/src/shared/page/page.test.tsx +0 -97
- package/src/shared/page/page.tsx +0 -91
- package/src/shared/page/pageUiConfig.test.ts +0 -112
- package/src/shared/page/pageUiConfig.ts +0 -64
- package/src/shared/page/verifiedByIncode.css +0 -5
- package/src/shared/page/verifiedByIncode.tsx +0 -75
- package/src/shared/spacer/spacer.css +0 -149
- package/src/shared/spacer/spacer.test.tsx +0 -143
- package/src/shared/spacer/spacer.tsx +0 -88
- package/src/shared/spinner/index.ts +0 -2
- package/src/shared/spinner/spinner.css +0 -28
- package/src/shared/spinner/spinner.test.tsx +0 -82
- package/src/shared/spinner/spinner.tsx +0 -65
- package/src/shared/title/title.css +0 -7
- package/src/shared/title/title.tsx +0 -12
- package/src/shared/uiConfig/uiConfig.ts +0 -36
- package/src/shared/webComponent/incodeModule.ts +0 -29
- package/src/shared/webComponent/registerIncodeElement.ts +0 -15
- package/src/styles/__mocks__/fetchTheme.ts +0 -19
- package/src/styles/applyTheme.ts +0 -37
- package/src/styles/cn.test.tsx +0 -57
- package/src/styles/cn.tsx +0 -21
- package/src/styles/core.css +0 -12
- package/src/styles/fetchTheme.test.ts +0 -390
- package/src/styles/fetchTheme.ts +0 -88
- package/src/styles/generatePalette.ts +0 -111
- package/src/styles/reset.css +0 -65
- package/src/styles/resolveCssVariableToHex.ts +0 -28
- package/src/styles/tailwind.css +0 -291
- package/src/styles/themeTypes.ts +0 -18
- package/src/styles/tokens/colors.css +0 -190
- package/src/styles/tokens/components.css +0 -174
- package/src/styles/tokens/index.css +0 -4
- package/src/styles/tokens/primitives.css +0 -129
- package/src/styles/tokens/semantic.css +0 -51
- package/src/svg.d.ts +0 -4
- package/src/types/assets.d.ts +0 -1
- package/src/types/custom-elements.d.ts +0 -104
- package/tsconfig.json +0 -22
- package/vite.config.ts +0 -260
- package/vitest.config.ts +0 -40
- package/vitest.setup.ts +0 -16
|
@@ -0,0 +1,2161 @@
|
|
|
1
|
+
import { d as he, y as Ye } from "./vendor-preact-CK0WeTOR.js";
|
|
2
|
+
import { u as Ze } from "./button-DeMZ_34N.js";
|
|
3
|
+
const g = (s) => typeof s == "string", q = () => {
|
|
4
|
+
let s, e;
|
|
5
|
+
const t = new Promise((n, i) => {
|
|
6
|
+
s = n, e = i;
|
|
7
|
+
});
|
|
8
|
+
return t.resolve = s, t.reject = e, t;
|
|
9
|
+
}, pe = (s) => s == null ? "" : "" + s, et = (s, e, t) => {
|
|
10
|
+
s.forEach((n) => {
|
|
11
|
+
e[n] && (t[n] = e[n]);
|
|
12
|
+
});
|
|
13
|
+
}, tt = /###/g, ge = (s) => s && s.indexOf("###") > -1 ? s.replace(tt, ".") : s, me = (s) => !s || g(s), z = (s, e, t) => {
|
|
14
|
+
const n = g(e) ? e.split(".") : e;
|
|
15
|
+
let i = 0;
|
|
16
|
+
for (; i < n.length - 1; ) {
|
|
17
|
+
if (me(s)) return {};
|
|
18
|
+
const r = ge(n[i]);
|
|
19
|
+
!s[r] && t && (s[r] = new t()), Object.prototype.hasOwnProperty.call(s, r) ? s = s[r] : s = {}, ++i;
|
|
20
|
+
}
|
|
21
|
+
return me(s) ? {} : {
|
|
22
|
+
obj: s,
|
|
23
|
+
k: ge(n[i])
|
|
24
|
+
};
|
|
25
|
+
}, ye = (s, e, t) => {
|
|
26
|
+
const {
|
|
27
|
+
obj: n,
|
|
28
|
+
k: i
|
|
29
|
+
} = z(s, e, Object);
|
|
30
|
+
if (n !== void 0 || e.length === 1) {
|
|
31
|
+
n[i] = t;
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
let r = e[e.length - 1], o = e.slice(0, e.length - 1), a = z(s, o, Object);
|
|
35
|
+
for (; a.obj === void 0 && o.length; )
|
|
36
|
+
r = `${o[o.length - 1]}.${r}`, o = o.slice(0, o.length - 1), a = z(s, o, Object), a?.obj && typeof a.obj[`${a.k}.${r}`] < "u" && (a.obj = void 0);
|
|
37
|
+
a.obj[`${a.k}.${r}`] = t;
|
|
38
|
+
}, nt = (s, e, t, n) => {
|
|
39
|
+
const {
|
|
40
|
+
obj: i,
|
|
41
|
+
k: r
|
|
42
|
+
} = z(s, e, Object);
|
|
43
|
+
i[r] = i[r] || [], i[r].push(t);
|
|
44
|
+
}, G = (s, e) => {
|
|
45
|
+
const {
|
|
46
|
+
obj: t,
|
|
47
|
+
k: n
|
|
48
|
+
} = z(s, e);
|
|
49
|
+
if (t && Object.prototype.hasOwnProperty.call(t, n))
|
|
50
|
+
return t[n];
|
|
51
|
+
}, it = (s, e, t) => {
|
|
52
|
+
const n = G(s, t);
|
|
53
|
+
return n !== void 0 ? n : G(e, t);
|
|
54
|
+
}, He = (s, e, t) => {
|
|
55
|
+
for (const n in e)
|
|
56
|
+
n !== "__proto__" && n !== "constructor" && (n in s ? g(s[n]) || s[n] instanceof String || g(e[n]) || e[n] instanceof String ? t && (s[n] = e[n]) : He(s[n], e[n], t) : s[n] = e[n]);
|
|
57
|
+
return s;
|
|
58
|
+
}, A = (s) => s.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
|
|
59
|
+
var st = {
|
|
60
|
+
"&": "&",
|
|
61
|
+
"<": "<",
|
|
62
|
+
">": ">",
|
|
63
|
+
'"': """,
|
|
64
|
+
"'": "'",
|
|
65
|
+
"/": "/"
|
|
66
|
+
};
|
|
67
|
+
const rt = (s) => g(s) ? s.replace(/[&<>"'\/]/g, (e) => st[e]) : s;
|
|
68
|
+
class ot {
|
|
69
|
+
constructor(e) {
|
|
70
|
+
this.capacity = e, this.regExpMap = /* @__PURE__ */ new Map(), this.regExpQueue = [];
|
|
71
|
+
}
|
|
72
|
+
getRegExp(e) {
|
|
73
|
+
const t = this.regExpMap.get(e);
|
|
74
|
+
if (t !== void 0)
|
|
75
|
+
return t;
|
|
76
|
+
const n = new RegExp(e);
|
|
77
|
+
return this.regExpQueue.length === this.capacity && this.regExpMap.delete(this.regExpQueue.shift()), this.regExpMap.set(e, n), this.regExpQueue.push(e), n;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
const at = [" ", ",", "?", "!", ";"], lt = new ot(20), ut = (s, e, t) => {
|
|
81
|
+
e = e || "", t = t || "";
|
|
82
|
+
const n = at.filter((o) => e.indexOf(o) < 0 && t.indexOf(o) < 0);
|
|
83
|
+
if (n.length === 0) return !0;
|
|
84
|
+
const i = lt.getRegExp(`(${n.map((o) => o === "?" ? "\\?" : o).join("|")})`);
|
|
85
|
+
let r = !i.test(s);
|
|
86
|
+
if (!r) {
|
|
87
|
+
const o = s.indexOf(t);
|
|
88
|
+
o > 0 && !i.test(s.substring(0, o)) && (r = !0);
|
|
89
|
+
}
|
|
90
|
+
return r;
|
|
91
|
+
}, re = (s, e, t = ".") => {
|
|
92
|
+
if (!s) return;
|
|
93
|
+
if (s[e])
|
|
94
|
+
return Object.prototype.hasOwnProperty.call(s, e) ? s[e] : void 0;
|
|
95
|
+
const n = e.split(t);
|
|
96
|
+
let i = s;
|
|
97
|
+
for (let r = 0; r < n.length; ) {
|
|
98
|
+
if (!i || typeof i != "object")
|
|
99
|
+
return;
|
|
100
|
+
let o, a = "";
|
|
101
|
+
for (let l = r; l < n.length; ++l)
|
|
102
|
+
if (l !== r && (a += t), a += n[l], o = i[a], o !== void 0) {
|
|
103
|
+
if (["string", "number", "boolean"].indexOf(typeof o) > -1 && l < n.length - 1)
|
|
104
|
+
continue;
|
|
105
|
+
r += l - r + 1;
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
108
|
+
i = o;
|
|
109
|
+
}
|
|
110
|
+
return i;
|
|
111
|
+
}, B = (s) => s?.replace("_", "-"), ft = {
|
|
112
|
+
type: "logger",
|
|
113
|
+
log(s) {
|
|
114
|
+
this.output("log", s);
|
|
115
|
+
},
|
|
116
|
+
warn(s) {
|
|
117
|
+
this.output("warn", s);
|
|
118
|
+
},
|
|
119
|
+
error(s) {
|
|
120
|
+
this.output("error", s);
|
|
121
|
+
},
|
|
122
|
+
output(s, e) {
|
|
123
|
+
console?.[s]?.apply?.(console, e);
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
class Y {
|
|
127
|
+
constructor(e, t = {}) {
|
|
128
|
+
this.init(e, t);
|
|
129
|
+
}
|
|
130
|
+
init(e, t = {}) {
|
|
131
|
+
this.prefix = t.prefix || "i18next:", this.logger = e || ft, this.options = t, this.debug = t.debug;
|
|
132
|
+
}
|
|
133
|
+
log(...e) {
|
|
134
|
+
return this.forward(e, "log", "", !0);
|
|
135
|
+
}
|
|
136
|
+
warn(...e) {
|
|
137
|
+
return this.forward(e, "warn", "", !0);
|
|
138
|
+
}
|
|
139
|
+
error(...e) {
|
|
140
|
+
return this.forward(e, "error", "");
|
|
141
|
+
}
|
|
142
|
+
deprecate(...e) {
|
|
143
|
+
return this.forward(e, "warn", "WARNING DEPRECATED: ", !0);
|
|
144
|
+
}
|
|
145
|
+
forward(e, t, n, i) {
|
|
146
|
+
return i && !this.debug ? null : (g(e[0]) && (e[0] = `${n}${this.prefix} ${e[0]}`), this.logger[t](e));
|
|
147
|
+
}
|
|
148
|
+
create(e) {
|
|
149
|
+
return new Y(this.logger, {
|
|
150
|
+
prefix: `${this.prefix}:${e}:`,
|
|
151
|
+
...this.options
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
clone(e) {
|
|
155
|
+
return e = e || this.options, e.prefix = e.prefix || this.prefix, new Y(this.logger, e);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
var C = new Y();
|
|
159
|
+
class te {
|
|
160
|
+
constructor() {
|
|
161
|
+
this.observers = {};
|
|
162
|
+
}
|
|
163
|
+
on(e, t) {
|
|
164
|
+
return e.split(" ").forEach((n) => {
|
|
165
|
+
this.observers[n] || (this.observers[n] = /* @__PURE__ */ new Map());
|
|
166
|
+
const i = this.observers[n].get(t) || 0;
|
|
167
|
+
this.observers[n].set(t, i + 1);
|
|
168
|
+
}), this;
|
|
169
|
+
}
|
|
170
|
+
off(e, t) {
|
|
171
|
+
if (this.observers[e]) {
|
|
172
|
+
if (!t) {
|
|
173
|
+
delete this.observers[e];
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
this.observers[e].delete(t);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
emit(e, ...t) {
|
|
180
|
+
this.observers[e] && Array.from(this.observers[e].entries()).forEach(([i, r]) => {
|
|
181
|
+
for (let o = 0; o < r; o++)
|
|
182
|
+
i(...t);
|
|
183
|
+
}), this.observers["*"] && Array.from(this.observers["*"].entries()).forEach(([i, r]) => {
|
|
184
|
+
for (let o = 0; o < r; o++)
|
|
185
|
+
i.apply(i, [e, ...t]);
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
class xe extends te {
|
|
190
|
+
constructor(e, t = {
|
|
191
|
+
ns: ["translation"],
|
|
192
|
+
defaultNS: "translation"
|
|
193
|
+
}) {
|
|
194
|
+
super(), this.data = e || {}, this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.options.ignoreJSONStructure === void 0 && (this.options.ignoreJSONStructure = !0);
|
|
195
|
+
}
|
|
196
|
+
addNamespaces(e) {
|
|
197
|
+
this.options.ns.indexOf(e) < 0 && this.options.ns.push(e);
|
|
198
|
+
}
|
|
199
|
+
removeNamespaces(e) {
|
|
200
|
+
const t = this.options.ns.indexOf(e);
|
|
201
|
+
t > -1 && this.options.ns.splice(t, 1);
|
|
202
|
+
}
|
|
203
|
+
getResource(e, t, n, i = {}) {
|
|
204
|
+
const r = i.keySeparator !== void 0 ? i.keySeparator : this.options.keySeparator, o = i.ignoreJSONStructure !== void 0 ? i.ignoreJSONStructure : this.options.ignoreJSONStructure;
|
|
205
|
+
let a;
|
|
206
|
+
e.indexOf(".") > -1 ? a = e.split(".") : (a = [e, t], n && (Array.isArray(n) ? a.push(...n) : g(n) && r ? a.push(...n.split(r)) : a.push(n)));
|
|
207
|
+
const l = G(this.data, a);
|
|
208
|
+
return !l && !t && !n && e.indexOf(".") > -1 && (e = a[0], t = a[1], n = a.slice(2).join(".")), l || !o || !g(n) ? l : re(this.data?.[e]?.[t], n, r);
|
|
209
|
+
}
|
|
210
|
+
addResource(e, t, n, i, r = {
|
|
211
|
+
silent: !1
|
|
212
|
+
}) {
|
|
213
|
+
const o = r.keySeparator !== void 0 ? r.keySeparator : this.options.keySeparator;
|
|
214
|
+
let a = [e, t];
|
|
215
|
+
n && (a = a.concat(o ? n.split(o) : n)), e.indexOf(".") > -1 && (a = e.split("."), i = t, t = a[1]), this.addNamespaces(t), ye(this.data, a, i), r.silent || this.emit("added", e, t, n, i);
|
|
216
|
+
}
|
|
217
|
+
addResources(e, t, n, i = {
|
|
218
|
+
silent: !1
|
|
219
|
+
}) {
|
|
220
|
+
for (const r in n)
|
|
221
|
+
(g(n[r]) || Array.isArray(n[r])) && this.addResource(e, t, r, n[r], {
|
|
222
|
+
silent: !0
|
|
223
|
+
});
|
|
224
|
+
i.silent || this.emit("added", e, t, n);
|
|
225
|
+
}
|
|
226
|
+
addResourceBundle(e, t, n, i, r, o = {
|
|
227
|
+
silent: !1,
|
|
228
|
+
skipCopy: !1
|
|
229
|
+
}) {
|
|
230
|
+
let a = [e, t];
|
|
231
|
+
e.indexOf(".") > -1 && (a = e.split("."), i = n, n = t, t = a[1]), this.addNamespaces(t);
|
|
232
|
+
let l = G(this.data, a) || {};
|
|
233
|
+
o.skipCopy || (n = JSON.parse(JSON.stringify(n))), i ? He(l, n, r) : l = {
|
|
234
|
+
...l,
|
|
235
|
+
...n
|
|
236
|
+
}, ye(this.data, a, l), o.silent || this.emit("added", e, t, n);
|
|
237
|
+
}
|
|
238
|
+
removeResourceBundle(e, t) {
|
|
239
|
+
this.hasResourceBundle(e, t) && delete this.data[e][t], this.removeNamespaces(t), this.emit("removed", e, t);
|
|
240
|
+
}
|
|
241
|
+
hasResourceBundle(e, t) {
|
|
242
|
+
return this.getResource(e, t) !== void 0;
|
|
243
|
+
}
|
|
244
|
+
getResourceBundle(e, t) {
|
|
245
|
+
return t || (t = this.options.defaultNS), this.getResource(e, t);
|
|
246
|
+
}
|
|
247
|
+
getDataByLanguage(e) {
|
|
248
|
+
return this.data[e];
|
|
249
|
+
}
|
|
250
|
+
hasLanguageSomeTranslations(e) {
|
|
251
|
+
const t = this.getDataByLanguage(e);
|
|
252
|
+
return !!(t && Object.keys(t) || []).find((i) => t[i] && Object.keys(t[i]).length > 0);
|
|
253
|
+
}
|
|
254
|
+
toJSON() {
|
|
255
|
+
return this.data;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
var Ke = {
|
|
259
|
+
processors: {},
|
|
260
|
+
addPostProcessor(s) {
|
|
261
|
+
this.processors[s.name] = s;
|
|
262
|
+
},
|
|
263
|
+
handle(s, e, t, n, i) {
|
|
264
|
+
return s.forEach((r) => {
|
|
265
|
+
e = this.processors[r]?.process(e, t, n, i) ?? e;
|
|
266
|
+
}), e;
|
|
267
|
+
}
|
|
268
|
+
};
|
|
269
|
+
const Ue = Symbol("i18next/PATH_KEY");
|
|
270
|
+
function ct() {
|
|
271
|
+
const s = [], e = /* @__PURE__ */ Object.create(null);
|
|
272
|
+
let t;
|
|
273
|
+
return e.get = (n, i) => (t?.revoke?.(), i === Ue ? s : (s.push(i), t = Proxy.revocable(n, e), t.proxy)), Proxy.revocable(/* @__PURE__ */ Object.create(null), e).proxy;
|
|
274
|
+
}
|
|
275
|
+
function oe(s, e) {
|
|
276
|
+
const {
|
|
277
|
+
[Ue]: t
|
|
278
|
+
} = s(ct());
|
|
279
|
+
return t.join(e?.keySeparator ?? ".");
|
|
280
|
+
}
|
|
281
|
+
const be = {}, ne = (s) => !g(s) && typeof s != "boolean" && typeof s != "number";
|
|
282
|
+
class Z extends te {
|
|
283
|
+
constructor(e, t = {}) {
|
|
284
|
+
super(), et(["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");
|
|
285
|
+
}
|
|
286
|
+
changeLanguage(e) {
|
|
287
|
+
e && (this.language = e);
|
|
288
|
+
}
|
|
289
|
+
exists(e, t = {
|
|
290
|
+
interpolation: {}
|
|
291
|
+
}) {
|
|
292
|
+
const n = {
|
|
293
|
+
...t
|
|
294
|
+
};
|
|
295
|
+
if (e == null) return !1;
|
|
296
|
+
const i = this.resolve(e, n);
|
|
297
|
+
if (i?.res === void 0) return !1;
|
|
298
|
+
const r = ne(i.res);
|
|
299
|
+
return !(n.returnObjects === !1 && r);
|
|
300
|
+
}
|
|
301
|
+
extractFromKey(e, t) {
|
|
302
|
+
let n = t.nsSeparator !== void 0 ? t.nsSeparator : this.options.nsSeparator;
|
|
303
|
+
n === void 0 && (n = ":");
|
|
304
|
+
const i = t.keySeparator !== void 0 ? t.keySeparator : this.options.keySeparator;
|
|
305
|
+
let r = t.ns || this.options.defaultNS || [];
|
|
306
|
+
const o = n && e.indexOf(n) > -1, a = !this.options.userDefinedKeySeparator && !t.keySeparator && !this.options.userDefinedNsSeparator && !t.nsSeparator && !ut(e, n, i);
|
|
307
|
+
if (o && !a) {
|
|
308
|
+
const l = e.match(this.interpolator.nestingRegexp);
|
|
309
|
+
if (l && l.length > 0)
|
|
310
|
+
return {
|
|
311
|
+
key: e,
|
|
312
|
+
namespaces: g(r) ? [r] : r
|
|
313
|
+
};
|
|
314
|
+
const u = e.split(n);
|
|
315
|
+
(n !== i || n === i && this.options.ns.indexOf(u[0]) > -1) && (r = u.shift()), e = u.join(i);
|
|
316
|
+
}
|
|
317
|
+
return {
|
|
318
|
+
key: e,
|
|
319
|
+
namespaces: g(r) ? [r] : r
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
translate(e, t, n) {
|
|
323
|
+
let i = typeof t == "object" ? {
|
|
324
|
+
...t
|
|
325
|
+
} : t;
|
|
326
|
+
if (typeof i != "object" && this.options.overloadTranslationOptionHandler && (i = this.options.overloadTranslationOptionHandler(arguments)), typeof i == "object" && (i = {
|
|
327
|
+
...i
|
|
328
|
+
}), i || (i = {}), e == null) return "";
|
|
329
|
+
typeof e == "function" && (e = oe(e, {
|
|
330
|
+
...this.options,
|
|
331
|
+
...i
|
|
332
|
+
})), Array.isArray(e) || (e = [String(e)]);
|
|
333
|
+
const r = i.returnDetails !== void 0 ? i.returnDetails : this.options.returnDetails, o = i.keySeparator !== void 0 ? i.keySeparator : this.options.keySeparator, {
|
|
334
|
+
key: a,
|
|
335
|
+
namespaces: l
|
|
336
|
+
} = this.extractFromKey(e[e.length - 1], i), u = l[l.length - 1];
|
|
337
|
+
let c = i.nsSeparator !== void 0 ? i.nsSeparator : this.options.nsSeparator;
|
|
338
|
+
c === void 0 && (c = ":");
|
|
339
|
+
const f = i.lng || this.language, p = i.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;
|
|
340
|
+
if (f?.toLowerCase() === "cimode")
|
|
341
|
+
return p ? r ? {
|
|
342
|
+
res: `${u}${c}${a}`,
|
|
343
|
+
usedKey: a,
|
|
344
|
+
exactUsedKey: a,
|
|
345
|
+
usedLng: f,
|
|
346
|
+
usedNS: u,
|
|
347
|
+
usedParams: this.getUsedParamsDetails(i)
|
|
348
|
+
} : `${u}${c}${a}` : r ? {
|
|
349
|
+
res: a,
|
|
350
|
+
usedKey: a,
|
|
351
|
+
exactUsedKey: a,
|
|
352
|
+
usedLng: f,
|
|
353
|
+
usedNS: u,
|
|
354
|
+
usedParams: this.getUsedParamsDetails(i)
|
|
355
|
+
} : a;
|
|
356
|
+
const d = this.resolve(e, i);
|
|
357
|
+
let h = d?.res;
|
|
358
|
+
const m = d?.usedKey || a, y = d?.exactUsedKey || a, w = ["[object Number]", "[object Function]", "[object RegExp]"], x = i.joinArrays !== void 0 ? i.joinArrays : this.options.joinArrays, N = !this.i18nFormat || this.i18nFormat.handleAsObject, v = i.count !== void 0 && !g(i.count), j = Z.hasDefaultValue(i), I = v ? this.pluralResolver.getSuffix(f, i.count, i) : "", D = i.ordinal && v ? this.pluralResolver.getSuffix(f, i.count, {
|
|
359
|
+
ordinal: !1
|
|
360
|
+
}) : "", ue = v && !i.ordinal && i.count === 0, $ = ue && i[`defaultValue${this.options.pluralSeparator}zero`] || i[`defaultValue${I}`] || i[`defaultValue${D}`] || i.defaultValue;
|
|
361
|
+
let L = h;
|
|
362
|
+
N && !h && j && (L = $);
|
|
363
|
+
const Qe = ne(L), Ge = Object.prototype.toString.apply(L);
|
|
364
|
+
if (N && L && Qe && w.indexOf(Ge) < 0 && !(g(x) && Array.isArray(L))) {
|
|
365
|
+
if (!i.returnObjects && !this.options.returnObjects) {
|
|
366
|
+
this.options.returnedObjectHandler || this.logger.warn("accessing an object - but returnObjects options is not enabled!");
|
|
367
|
+
const P = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(m, L, {
|
|
368
|
+
...i,
|
|
369
|
+
ns: l
|
|
370
|
+
}) : `key '${a} (${this.language})' returned an object instead of string.`;
|
|
371
|
+
return r ? (d.res = P, d.usedParams = this.getUsedParamsDetails(i), d) : P;
|
|
372
|
+
}
|
|
373
|
+
if (o) {
|
|
374
|
+
const P = Array.isArray(L), O = P ? [] : {}, fe = P ? y : m;
|
|
375
|
+
for (const k in L)
|
|
376
|
+
if (Object.prototype.hasOwnProperty.call(L, k)) {
|
|
377
|
+
const R = `${fe}${o}${k}`;
|
|
378
|
+
j && !h ? O[k] = this.translate(R, {
|
|
379
|
+
...i,
|
|
380
|
+
defaultValue: ne($) ? $[k] : void 0,
|
|
381
|
+
joinArrays: !1,
|
|
382
|
+
ns: l
|
|
383
|
+
}) : O[k] = this.translate(R, {
|
|
384
|
+
...i,
|
|
385
|
+
joinArrays: !1,
|
|
386
|
+
ns: l
|
|
387
|
+
}), O[k] === R && (O[k] = L[k]);
|
|
388
|
+
}
|
|
389
|
+
h = O;
|
|
390
|
+
}
|
|
391
|
+
} else if (N && g(x) && Array.isArray(h))
|
|
392
|
+
h = h.join(x), h && (h = this.extendTranslation(h, e, i, n));
|
|
393
|
+
else {
|
|
394
|
+
let P = !1, O = !1;
|
|
395
|
+
!this.isValidLookup(h) && j && (P = !0, h = $), this.isValidLookup(h) || (O = !0, h = a);
|
|
396
|
+
const k = (i.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && O ? void 0 : h, R = j && $ !== h && this.options.updateMissing;
|
|
397
|
+
if (O || P || R) {
|
|
398
|
+
if (this.logger.log(R ? "updateKey" : "missingKey", f, u, a, R ? $ : h), o) {
|
|
399
|
+
const S = this.resolve(a, {
|
|
400
|
+
...i,
|
|
401
|
+
keySeparator: !1
|
|
402
|
+
});
|
|
403
|
+
S && S.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.");
|
|
404
|
+
}
|
|
405
|
+
let M = [];
|
|
406
|
+
const J = this.languageUtils.getFallbackCodes(this.options.fallbackLng, i.lng || this.language);
|
|
407
|
+
if (this.options.saveMissingTo === "fallback" && J && J[0])
|
|
408
|
+
for (let S = 0; S < J.length; S++)
|
|
409
|
+
M.push(J[S]);
|
|
410
|
+
else this.options.saveMissingTo === "all" ? M = this.languageUtils.toResolveHierarchy(i.lng || this.language) : M.push(i.lng || this.language);
|
|
411
|
+
const ce = (S, F, V) => {
|
|
412
|
+
const de = j && V !== h ? V : k;
|
|
413
|
+
this.options.missingKeyHandler ? this.options.missingKeyHandler(S, u, F, de, R, i) : this.backendConnector?.saveMissing && this.backendConnector.saveMissing(S, u, F, de, R, i), this.emit("missingKey", S, u, F, h);
|
|
414
|
+
};
|
|
415
|
+
this.options.saveMissing && (this.options.saveMissingPlurals && v ? M.forEach((S) => {
|
|
416
|
+
const F = this.pluralResolver.getSuffixes(S, i);
|
|
417
|
+
ue && i[`defaultValue${this.options.pluralSeparator}zero`] && F.indexOf(`${this.options.pluralSeparator}zero`) < 0 && F.push(`${this.options.pluralSeparator}zero`), F.forEach((V) => {
|
|
418
|
+
ce([S], a + V, i[`defaultValue${V}`] || $);
|
|
419
|
+
});
|
|
420
|
+
}) : ce(M, a, $));
|
|
421
|
+
}
|
|
422
|
+
h = this.extendTranslation(h, e, i, d, n), O && h === a && this.options.appendNamespaceToMissingKey && (h = `${u}${c}${a}`), (O || P) && this.options.parseMissingKeyHandler && (h = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${u}${c}${a}` : a, P ? h : void 0, i));
|
|
423
|
+
}
|
|
424
|
+
return r ? (d.res = h, d.usedParams = this.getUsedParamsDetails(i), d) : h;
|
|
425
|
+
}
|
|
426
|
+
extendTranslation(e, t, n, i, r) {
|
|
427
|
+
if (this.i18nFormat?.parse)
|
|
428
|
+
e = this.i18nFormat.parse(e, {
|
|
429
|
+
...this.options.interpolation.defaultVariables,
|
|
430
|
+
...n
|
|
431
|
+
}, n.lng || this.language || i.usedLng, i.usedNS, i.usedKey, {
|
|
432
|
+
resolved: i
|
|
433
|
+
});
|
|
434
|
+
else if (!n.skipInterpolation) {
|
|
435
|
+
n.interpolation && this.interpolator.init({
|
|
436
|
+
...n,
|
|
437
|
+
interpolation: {
|
|
438
|
+
...this.options.interpolation,
|
|
439
|
+
...n.interpolation
|
|
440
|
+
}
|
|
441
|
+
});
|
|
442
|
+
const l = g(e) && (n?.interpolation?.skipOnVariables !== void 0 ? n.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables);
|
|
443
|
+
let u;
|
|
444
|
+
if (l) {
|
|
445
|
+
const f = e.match(this.interpolator.nestingRegexp);
|
|
446
|
+
u = f && f.length;
|
|
447
|
+
}
|
|
448
|
+
let c = n.replace && !g(n.replace) ? n.replace : n;
|
|
449
|
+
if (this.options.interpolation.defaultVariables && (c = {
|
|
450
|
+
...this.options.interpolation.defaultVariables,
|
|
451
|
+
...c
|
|
452
|
+
}), e = this.interpolator.interpolate(e, c, n.lng || this.language || i.usedLng, n), l) {
|
|
453
|
+
const f = e.match(this.interpolator.nestingRegexp), p = f && f.length;
|
|
454
|
+
u < p && (n.nest = !1);
|
|
455
|
+
}
|
|
456
|
+
!n.lng && i && i.res && (n.lng = this.language || i.usedLng), n.nest !== !1 && (e = this.interpolator.nest(e, (...f) => r?.[0] === f[0] && !n.context ? (this.logger.warn(`It seems you are nesting recursively key: ${f[0]} in key: ${t[0]}`), null) : this.translate(...f, t), n)), n.interpolation && this.interpolator.reset();
|
|
457
|
+
}
|
|
458
|
+
const o = n.postProcess || this.options.postProcess, a = g(o) ? [o] : o;
|
|
459
|
+
return e != null && a?.length && n.applyPostProcessor !== !1 && (e = Ke.handle(a, e, t, this.options && this.options.postProcessPassResolved ? {
|
|
460
|
+
i18nResolved: {
|
|
461
|
+
...i,
|
|
462
|
+
usedParams: this.getUsedParamsDetails(n)
|
|
463
|
+
},
|
|
464
|
+
...n
|
|
465
|
+
} : n, this)), e;
|
|
466
|
+
}
|
|
467
|
+
resolve(e, t = {}) {
|
|
468
|
+
let n, i, r, o, a;
|
|
469
|
+
return g(e) && (e = [e]), e.forEach((l) => {
|
|
470
|
+
if (this.isValidLookup(n)) return;
|
|
471
|
+
const u = this.extractFromKey(l, t), c = u.key;
|
|
472
|
+
i = c;
|
|
473
|
+
let f = u.namespaces;
|
|
474
|
+
this.options.fallbackNS && (f = f.concat(this.options.fallbackNS));
|
|
475
|
+
const p = t.count !== void 0 && !g(t.count), d = p && !t.ordinal && t.count === 0, h = t.context !== void 0 && (g(t.context) || typeof t.context == "number") && t.context !== "", m = t.lngs ? t.lngs : this.languageUtils.toResolveHierarchy(t.lng || this.language, t.fallbackLng);
|
|
476
|
+
f.forEach((y) => {
|
|
477
|
+
this.isValidLookup(n) || (a = y, !be[`${m[0]}-${y}`] && this.utils?.hasLoadedNamespace && !this.utils?.hasLoadedNamespace(a) && (be[`${m[0]}-${y}`] = !0, this.logger.warn(`key "${i}" for languages "${m.join(", ")}" won't get resolved as namespace "${a}" 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((w) => {
|
|
478
|
+
if (this.isValidLookup(n)) return;
|
|
479
|
+
o = w;
|
|
480
|
+
const x = [c];
|
|
481
|
+
if (this.i18nFormat?.addLookupKeys)
|
|
482
|
+
this.i18nFormat.addLookupKeys(x, c, w, y, t);
|
|
483
|
+
else {
|
|
484
|
+
let v;
|
|
485
|
+
p && (v = this.pluralResolver.getSuffix(w, t.count, t));
|
|
486
|
+
const j = `${this.options.pluralSeparator}zero`, I = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;
|
|
487
|
+
if (p && (t.ordinal && v.indexOf(I) === 0 && x.push(c + v.replace(I, this.options.pluralSeparator)), x.push(c + v), d && x.push(c + j)), h) {
|
|
488
|
+
const D = `${c}${this.options.contextSeparator || "_"}${t.context}`;
|
|
489
|
+
x.push(D), p && (t.ordinal && v.indexOf(I) === 0 && x.push(D + v.replace(I, this.options.pluralSeparator)), x.push(D + v), d && x.push(D + j));
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
let N;
|
|
493
|
+
for (; N = x.pop(); )
|
|
494
|
+
this.isValidLookup(n) || (r = N, n = this.getResource(w, y, N, t));
|
|
495
|
+
}));
|
|
496
|
+
});
|
|
497
|
+
}), {
|
|
498
|
+
res: n,
|
|
499
|
+
usedKey: i,
|
|
500
|
+
exactUsedKey: r,
|
|
501
|
+
usedLng: o,
|
|
502
|
+
usedNS: a
|
|
503
|
+
};
|
|
504
|
+
}
|
|
505
|
+
isValidLookup(e) {
|
|
506
|
+
return e !== void 0 && !(!this.options.returnNull && e === null) && !(!this.options.returnEmptyString && e === "");
|
|
507
|
+
}
|
|
508
|
+
getResource(e, t, n, i = {}) {
|
|
509
|
+
return this.i18nFormat?.getResource ? this.i18nFormat.getResource(e, t, n, i) : this.resourceStore.getResource(e, t, n, i);
|
|
510
|
+
}
|
|
511
|
+
getUsedParamsDetails(e = {}) {
|
|
512
|
+
const t = ["defaultValue", "ordinal", "context", "replace", "lng", "lngs", "fallbackLng", "ns", "keySeparator", "nsSeparator", "returnObjects", "returnDetails", "joinArrays", "postProcess", "interpolation"], n = e.replace && !g(e.replace);
|
|
513
|
+
let i = n ? e.replace : e;
|
|
514
|
+
if (n && typeof e.count < "u" && (i.count = e.count), this.options.interpolation.defaultVariables && (i = {
|
|
515
|
+
...this.options.interpolation.defaultVariables,
|
|
516
|
+
...i
|
|
517
|
+
}), !n) {
|
|
518
|
+
i = {
|
|
519
|
+
...i
|
|
520
|
+
};
|
|
521
|
+
for (const r of t)
|
|
522
|
+
delete i[r];
|
|
523
|
+
}
|
|
524
|
+
return i;
|
|
525
|
+
}
|
|
526
|
+
static hasDefaultValue(e) {
|
|
527
|
+
const t = "defaultValue";
|
|
528
|
+
for (const n in e)
|
|
529
|
+
if (Object.prototype.hasOwnProperty.call(e, n) && t === n.substring(0, t.length) && e[n] !== void 0)
|
|
530
|
+
return !0;
|
|
531
|
+
return !1;
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
class Se {
|
|
535
|
+
constructor(e) {
|
|
536
|
+
this.options = e, this.supportedLngs = this.options.supportedLngs || !1, this.logger = C.create("languageUtils");
|
|
537
|
+
}
|
|
538
|
+
getScriptPartFromCode(e) {
|
|
539
|
+
if (e = B(e), !e || e.indexOf("-") < 0) return null;
|
|
540
|
+
const t = e.split("-");
|
|
541
|
+
return t.length === 2 || (t.pop(), t[t.length - 1].toLowerCase() === "x") ? null : this.formatLanguageCode(t.join("-"));
|
|
542
|
+
}
|
|
543
|
+
getLanguagePartFromCode(e) {
|
|
544
|
+
if (e = B(e), !e || e.indexOf("-") < 0) return e;
|
|
545
|
+
const t = e.split("-");
|
|
546
|
+
return this.formatLanguageCode(t[0]);
|
|
547
|
+
}
|
|
548
|
+
formatLanguageCode(e) {
|
|
549
|
+
if (g(e) && e.indexOf("-") > -1) {
|
|
550
|
+
let t;
|
|
551
|
+
try {
|
|
552
|
+
t = Intl.getCanonicalLocales(e)[0];
|
|
553
|
+
} catch {
|
|
554
|
+
}
|
|
555
|
+
return t && this.options.lowerCaseLng && (t = t.toLowerCase()), t || (this.options.lowerCaseLng ? e.toLowerCase() : e);
|
|
556
|
+
}
|
|
557
|
+
return this.options.cleanCode || this.options.lowerCaseLng ? e.toLowerCase() : e;
|
|
558
|
+
}
|
|
559
|
+
isSupportedCode(e) {
|
|
560
|
+
return (this.options.load === "languageOnly" || this.options.nonExplicitSupportedLngs) && (e = this.getLanguagePartFromCode(e)), !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.indexOf(e) > -1;
|
|
561
|
+
}
|
|
562
|
+
getBestMatchFromCodes(e) {
|
|
563
|
+
if (!e) return null;
|
|
564
|
+
let t;
|
|
565
|
+
return e.forEach((n) => {
|
|
566
|
+
if (t) return;
|
|
567
|
+
const i = this.formatLanguageCode(n);
|
|
568
|
+
(!this.options.supportedLngs || this.isSupportedCode(i)) && (t = i);
|
|
569
|
+
}), !t && this.options.supportedLngs && e.forEach((n) => {
|
|
570
|
+
if (t) return;
|
|
571
|
+
const i = this.getScriptPartFromCode(n);
|
|
572
|
+
if (this.isSupportedCode(i)) return t = i;
|
|
573
|
+
const r = this.getLanguagePartFromCode(n);
|
|
574
|
+
if (this.isSupportedCode(r)) return t = r;
|
|
575
|
+
t = this.options.supportedLngs.find((o) => {
|
|
576
|
+
if (o === r) return o;
|
|
577
|
+
if (!(o.indexOf("-") < 0 && r.indexOf("-") < 0) && (o.indexOf("-") > 0 && r.indexOf("-") < 0 && o.substring(0, o.indexOf("-")) === r || o.indexOf(r) === 0 && r.length > 1))
|
|
578
|
+
return o;
|
|
579
|
+
});
|
|
580
|
+
}), t || (t = this.getFallbackCodes(this.options.fallbackLng)[0]), t;
|
|
581
|
+
}
|
|
582
|
+
getFallbackCodes(e, t) {
|
|
583
|
+
if (!e) return [];
|
|
584
|
+
if (typeof e == "function" && (e = e(t)), g(e) && (e = [e]), Array.isArray(e)) return e;
|
|
585
|
+
if (!t) return e.default || [];
|
|
586
|
+
let n = e[t];
|
|
587
|
+
return n || (n = e[this.getScriptPartFromCode(t)]), n || (n = e[this.formatLanguageCode(t)]), n || (n = e[this.getLanguagePartFromCode(t)]), n || (n = e.default), n || [];
|
|
588
|
+
}
|
|
589
|
+
toResolveHierarchy(e, t) {
|
|
590
|
+
const n = this.getFallbackCodes((t === !1 ? [] : t) || this.options.fallbackLng || [], e), i = [], r = (o) => {
|
|
591
|
+
o && (this.isSupportedCode(o) ? i.push(o) : this.logger.warn(`rejecting language code not found in supportedLngs: ${o}`));
|
|
592
|
+
};
|
|
593
|
+
return g(e) && (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))) : g(e) && r(this.formatLanguageCode(e)), n.forEach((o) => {
|
|
594
|
+
i.indexOf(o) < 0 && r(this.formatLanguageCode(o));
|
|
595
|
+
}), i;
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
const ve = {
|
|
599
|
+
zero: 0,
|
|
600
|
+
one: 1,
|
|
601
|
+
two: 2,
|
|
602
|
+
few: 3,
|
|
603
|
+
many: 4,
|
|
604
|
+
other: 5
|
|
605
|
+
}, we = {
|
|
606
|
+
select: (s) => s === 1 ? "one" : "other",
|
|
607
|
+
resolvedOptions: () => ({
|
|
608
|
+
pluralCategories: ["one", "other"]
|
|
609
|
+
})
|
|
610
|
+
};
|
|
611
|
+
class dt {
|
|
612
|
+
constructor(e, t = {}) {
|
|
613
|
+
this.languageUtils = e, this.options = t, this.logger = C.create("pluralResolver"), this.pluralRulesCache = {};
|
|
614
|
+
}
|
|
615
|
+
addRule(e, t) {
|
|
616
|
+
this.rules[e] = t;
|
|
617
|
+
}
|
|
618
|
+
clearCache() {
|
|
619
|
+
this.pluralRulesCache = {};
|
|
620
|
+
}
|
|
621
|
+
getRule(e, t = {}) {
|
|
622
|
+
const n = B(e === "dev" ? "en" : e), i = t.ordinal ? "ordinal" : "cardinal", r = JSON.stringify({
|
|
623
|
+
cleanedCode: n,
|
|
624
|
+
type: i
|
|
625
|
+
});
|
|
626
|
+
if (r in this.pluralRulesCache)
|
|
627
|
+
return this.pluralRulesCache[r];
|
|
628
|
+
let o;
|
|
629
|
+
try {
|
|
630
|
+
o = new Intl.PluralRules(n, {
|
|
631
|
+
type: i
|
|
632
|
+
});
|
|
633
|
+
} catch {
|
|
634
|
+
if (!Intl)
|
|
635
|
+
return this.logger.error("No Intl support, please use an Intl polyfill!"), we;
|
|
636
|
+
if (!e.match(/-|_/)) return we;
|
|
637
|
+
const l = this.languageUtils.getLanguagePartFromCode(e);
|
|
638
|
+
o = this.getRule(l, t);
|
|
639
|
+
}
|
|
640
|
+
return this.pluralRulesCache[r] = o, o;
|
|
641
|
+
}
|
|
642
|
+
needsPlural(e, t = {}) {
|
|
643
|
+
let n = this.getRule(e, t);
|
|
644
|
+
return n || (n = this.getRule("dev", t)), n?.resolvedOptions().pluralCategories.length > 1;
|
|
645
|
+
}
|
|
646
|
+
getPluralFormsOfKey(e, t, n = {}) {
|
|
647
|
+
return this.getSuffixes(e, n).map((i) => `${t}${i}`);
|
|
648
|
+
}
|
|
649
|
+
getSuffixes(e, t = {}) {
|
|
650
|
+
let n = this.getRule(e, t);
|
|
651
|
+
return n || (n = this.getRule("dev", t)), n ? n.resolvedOptions().pluralCategories.sort((i, r) => ve[i] - ve[r]).map((i) => `${this.options.prepend}${t.ordinal ? `ordinal${this.options.prepend}` : ""}${i}`) : [];
|
|
652
|
+
}
|
|
653
|
+
getSuffix(e, t, n = {}) {
|
|
654
|
+
const i = this.getRule(e, n);
|
|
655
|
+
return i ? `${this.options.prepend}${n.ordinal ? `ordinal${this.options.prepend}` : ""}${i.select(t)}` : (this.logger.warn(`no plural rule found for: ${e}`), this.getSuffix("dev", t, n));
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
const Oe = (s, e, t, n = ".", i = !0) => {
|
|
659
|
+
let r = it(s, e, t);
|
|
660
|
+
return !r && i && g(t) && (r = re(s, t, n), r === void 0 && (r = re(e, t, n))), r;
|
|
661
|
+
}, ie = (s) => s.replace(/\$/g, "$$$$");
|
|
662
|
+
class Le {
|
|
663
|
+
constructor(e = {}) {
|
|
664
|
+
this.logger = C.create("interpolator"), this.options = e, this.format = e?.interpolation?.format || ((t) => t), this.init(e);
|
|
665
|
+
}
|
|
666
|
+
init(e = {}) {
|
|
667
|
+
e.interpolation || (e.interpolation = {
|
|
668
|
+
escapeValue: !0
|
|
669
|
+
});
|
|
670
|
+
const {
|
|
671
|
+
escape: t,
|
|
672
|
+
escapeValue: n,
|
|
673
|
+
useRawValueToEscape: i,
|
|
674
|
+
prefix: r,
|
|
675
|
+
prefixEscaped: o,
|
|
676
|
+
suffix: a,
|
|
677
|
+
suffixEscaped: l,
|
|
678
|
+
formatSeparator: u,
|
|
679
|
+
unescapeSuffix: c,
|
|
680
|
+
unescapePrefix: f,
|
|
681
|
+
nestingPrefix: p,
|
|
682
|
+
nestingPrefixEscaped: d,
|
|
683
|
+
nestingSuffix: h,
|
|
684
|
+
nestingSuffixEscaped: m,
|
|
685
|
+
nestingOptionsSeparator: y,
|
|
686
|
+
maxReplaces: w,
|
|
687
|
+
alwaysFormat: x
|
|
688
|
+
} = e.interpolation;
|
|
689
|
+
this.escape = t !== void 0 ? t : rt, this.escapeValue = n !== void 0 ? n : !0, this.useRawValueToEscape = i !== void 0 ? i : !1, this.prefix = r ? A(r) : o || "{{", this.suffix = a ? A(a) : l || "}}", this.formatSeparator = u || ",", this.unescapePrefix = c ? "" : f || "-", this.unescapeSuffix = this.unescapePrefix ? "" : c || "", this.nestingPrefix = p ? A(p) : d || A("$t("), this.nestingSuffix = h ? A(h) : m || A(")"), this.nestingOptionsSeparator = y || ",", this.maxReplaces = w || 1e3, this.alwaysFormat = x !== void 0 ? x : !1, this.resetRegExp();
|
|
690
|
+
}
|
|
691
|
+
reset() {
|
|
692
|
+
this.options && this.init(this.options);
|
|
693
|
+
}
|
|
694
|
+
resetRegExp() {
|
|
695
|
+
const e = (t, n) => t?.source === n ? (t.lastIndex = 0, t) : new RegExp(n, "g");
|
|
696
|
+
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}`);
|
|
697
|
+
}
|
|
698
|
+
interpolate(e, t, n, i) {
|
|
699
|
+
let r, o, a;
|
|
700
|
+
const l = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {}, u = (d) => {
|
|
701
|
+
if (d.indexOf(this.formatSeparator) < 0) {
|
|
702
|
+
const w = Oe(t, l, d, this.options.keySeparator, this.options.ignoreJSONStructure);
|
|
703
|
+
return this.alwaysFormat ? this.format(w, void 0, n, {
|
|
704
|
+
...i,
|
|
705
|
+
...t,
|
|
706
|
+
interpolationkey: d
|
|
707
|
+
}) : w;
|
|
708
|
+
}
|
|
709
|
+
const h = d.split(this.formatSeparator), m = h.shift().trim(), y = h.join(this.formatSeparator).trim();
|
|
710
|
+
return this.format(Oe(t, l, m, this.options.keySeparator, this.options.ignoreJSONStructure), y, n, {
|
|
711
|
+
...i,
|
|
712
|
+
...t,
|
|
713
|
+
interpolationkey: m
|
|
714
|
+
});
|
|
715
|
+
};
|
|
716
|
+
this.resetRegExp();
|
|
717
|
+
const c = i?.missingInterpolationHandler || this.options.missingInterpolationHandler, f = i?.interpolation?.skipOnVariables !== void 0 ? i.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables;
|
|
718
|
+
return [{
|
|
719
|
+
regex: this.regexpUnescape,
|
|
720
|
+
safeValue: (d) => ie(d)
|
|
721
|
+
}, {
|
|
722
|
+
regex: this.regexp,
|
|
723
|
+
safeValue: (d) => this.escapeValue ? ie(this.escape(d)) : ie(d)
|
|
724
|
+
}].forEach((d) => {
|
|
725
|
+
for (a = 0; r = d.regex.exec(e); ) {
|
|
726
|
+
const h = r[1].trim();
|
|
727
|
+
if (o = u(h), o === void 0)
|
|
728
|
+
if (typeof c == "function") {
|
|
729
|
+
const y = c(e, r, i);
|
|
730
|
+
o = g(y) ? y : "";
|
|
731
|
+
} else if (i && Object.prototype.hasOwnProperty.call(i, h))
|
|
732
|
+
o = "";
|
|
733
|
+
else if (f) {
|
|
734
|
+
o = r[0];
|
|
735
|
+
continue;
|
|
736
|
+
} else
|
|
737
|
+
this.logger.warn(`missed to pass in variable ${h} for interpolating ${e}`), o = "";
|
|
738
|
+
else !g(o) && !this.useRawValueToEscape && (o = pe(o));
|
|
739
|
+
const m = d.safeValue(o);
|
|
740
|
+
if (e = e.replace(r[0], m), f ? (d.regex.lastIndex += o.length, d.regex.lastIndex -= r[0].length) : d.regex.lastIndex = 0, a++, a >= this.maxReplaces)
|
|
741
|
+
break;
|
|
742
|
+
}
|
|
743
|
+
}), e;
|
|
744
|
+
}
|
|
745
|
+
nest(e, t, n = {}) {
|
|
746
|
+
let i, r, o;
|
|
747
|
+
const a = (l, u) => {
|
|
748
|
+
const c = this.nestingOptionsSeparator;
|
|
749
|
+
if (l.indexOf(c) < 0) return l;
|
|
750
|
+
const f = l.split(new RegExp(`${c}[ ]*{`));
|
|
751
|
+
let p = `{${f[1]}`;
|
|
752
|
+
l = f[0], p = this.interpolate(p, o);
|
|
753
|
+
const d = p.match(/'/g), h = p.match(/"/g);
|
|
754
|
+
((d?.length ?? 0) % 2 === 0 && !h || h.length % 2 !== 0) && (p = p.replace(/'/g, '"'));
|
|
755
|
+
try {
|
|
756
|
+
o = JSON.parse(p), u && (o = {
|
|
757
|
+
...u,
|
|
758
|
+
...o
|
|
759
|
+
});
|
|
760
|
+
} catch (m) {
|
|
761
|
+
return this.logger.warn(`failed parsing options string in nesting for key ${l}`, m), `${l}${c}${p}`;
|
|
762
|
+
}
|
|
763
|
+
return o.defaultValue && o.defaultValue.indexOf(this.prefix) > -1 && delete o.defaultValue, l;
|
|
764
|
+
};
|
|
765
|
+
for (; i = this.nestingRegexp.exec(e); ) {
|
|
766
|
+
let l = [];
|
|
767
|
+
o = {
|
|
768
|
+
...n
|
|
769
|
+
}, o = o.replace && !g(o.replace) ? o.replace : o, o.applyPostProcessor = !1, delete o.defaultValue;
|
|
770
|
+
const u = /{.*}/.test(i[1]) ? i[1].lastIndexOf("}") + 1 : i[1].indexOf(this.formatSeparator);
|
|
771
|
+
if (u !== -1 && (l = i[1].slice(u).split(this.formatSeparator).map((c) => c.trim()).filter(Boolean), i[1] = i[1].slice(0, u)), r = t(a.call(this, i[1].trim(), o), o), r && i[0] === e && !g(r)) return r;
|
|
772
|
+
g(r) || (r = pe(r)), r || (this.logger.warn(`missed to resolve ${i[1]} for nesting ${e}`), r = ""), l.length && (r = l.reduce((c, f) => this.format(c, f, n.lng, {
|
|
773
|
+
...n,
|
|
774
|
+
interpolationkey: i[1].trim()
|
|
775
|
+
}), r.trim())), e = e.replace(i[0], r), this.regexp.lastIndex = 0;
|
|
776
|
+
}
|
|
777
|
+
return e;
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
const ht = (s) => {
|
|
781
|
+
let e = s.toLowerCase().trim();
|
|
782
|
+
const t = {};
|
|
783
|
+
if (s.indexOf("(") > -1) {
|
|
784
|
+
const n = s.split("(");
|
|
785
|
+
e = n[0].toLowerCase().trim();
|
|
786
|
+
const i = n[1].substring(0, n[1].length - 1);
|
|
787
|
+
e === "currency" && i.indexOf(":") < 0 ? t.currency || (t.currency = i.trim()) : e === "relativetime" && i.indexOf(":") < 0 ? t.range || (t.range = i.trim()) : i.split(";").forEach((o) => {
|
|
788
|
+
if (o) {
|
|
789
|
+
const [a, ...l] = o.split(":"), u = l.join(":").trim().replace(/^'+|'+$/g, ""), c = a.trim();
|
|
790
|
+
t[c] || (t[c] = u), u === "false" && (t[c] = !1), u === "true" && (t[c] = !0), isNaN(u) || (t[c] = parseInt(u, 10));
|
|
791
|
+
}
|
|
792
|
+
});
|
|
793
|
+
}
|
|
794
|
+
return {
|
|
795
|
+
formatName: e,
|
|
796
|
+
formatOptions: t
|
|
797
|
+
};
|
|
798
|
+
}, Pe = (s) => {
|
|
799
|
+
const e = {};
|
|
800
|
+
return (t, n, i) => {
|
|
801
|
+
let r = i;
|
|
802
|
+
i && i.interpolationkey && i.formatParams && i.formatParams[i.interpolationkey] && i[i.interpolationkey] && (r = {
|
|
803
|
+
...r,
|
|
804
|
+
[i.interpolationkey]: void 0
|
|
805
|
+
});
|
|
806
|
+
const o = n + JSON.stringify(r);
|
|
807
|
+
let a = e[o];
|
|
808
|
+
return a || (a = s(B(n), i), e[o] = a), a(t);
|
|
809
|
+
};
|
|
810
|
+
}, pt = (s) => (e, t, n) => s(B(t), n)(e);
|
|
811
|
+
class gt {
|
|
812
|
+
constructor(e = {}) {
|
|
813
|
+
this.logger = C.create("formatter"), this.options = e, this.init(e);
|
|
814
|
+
}
|
|
815
|
+
init(e, t = {
|
|
816
|
+
interpolation: {}
|
|
817
|
+
}) {
|
|
818
|
+
this.formatSeparator = t.interpolation.formatSeparator || ",";
|
|
819
|
+
const n = t.cacheInBuiltFormats ? Pe : pt;
|
|
820
|
+
this.formats = {
|
|
821
|
+
number: n((i, r) => {
|
|
822
|
+
const o = new Intl.NumberFormat(i, {
|
|
823
|
+
...r
|
|
824
|
+
});
|
|
825
|
+
return (a) => o.format(a);
|
|
826
|
+
}),
|
|
827
|
+
currency: n((i, r) => {
|
|
828
|
+
const o = new Intl.NumberFormat(i, {
|
|
829
|
+
...r,
|
|
830
|
+
style: "currency"
|
|
831
|
+
});
|
|
832
|
+
return (a) => o.format(a);
|
|
833
|
+
}),
|
|
834
|
+
datetime: n((i, r) => {
|
|
835
|
+
const o = new Intl.DateTimeFormat(i, {
|
|
836
|
+
...r
|
|
837
|
+
});
|
|
838
|
+
return (a) => o.format(a);
|
|
839
|
+
}),
|
|
840
|
+
relativetime: n((i, r) => {
|
|
841
|
+
const o = new Intl.RelativeTimeFormat(i, {
|
|
842
|
+
...r
|
|
843
|
+
});
|
|
844
|
+
return (a) => o.format(a, r.range || "day");
|
|
845
|
+
}),
|
|
846
|
+
list: n((i, r) => {
|
|
847
|
+
const o = new Intl.ListFormat(i, {
|
|
848
|
+
...r
|
|
849
|
+
});
|
|
850
|
+
return (a) => o.format(a);
|
|
851
|
+
})
|
|
852
|
+
};
|
|
853
|
+
}
|
|
854
|
+
add(e, t) {
|
|
855
|
+
this.formats[e.toLowerCase().trim()] = t;
|
|
856
|
+
}
|
|
857
|
+
addCached(e, t) {
|
|
858
|
+
this.formats[e.toLowerCase().trim()] = Pe(t);
|
|
859
|
+
}
|
|
860
|
+
format(e, t, n, i = {}) {
|
|
861
|
+
const r = t.split(this.formatSeparator);
|
|
862
|
+
if (r.length > 1 && r[0].indexOf("(") > 1 && r[0].indexOf(")") < 0 && r.find((a) => a.indexOf(")") > -1)) {
|
|
863
|
+
const a = r.findIndex((l) => l.indexOf(")") > -1);
|
|
864
|
+
r[0] = [r[0], ...r.splice(1, a)].join(this.formatSeparator);
|
|
865
|
+
}
|
|
866
|
+
return r.reduce((a, l) => {
|
|
867
|
+
const {
|
|
868
|
+
formatName: u,
|
|
869
|
+
formatOptions: c
|
|
870
|
+
} = ht(l);
|
|
871
|
+
if (this.formats[u]) {
|
|
872
|
+
let f = a;
|
|
873
|
+
try {
|
|
874
|
+
const p = i?.formatParams?.[i.interpolationkey] || {}, d = p.locale || p.lng || i.locale || i.lng || n;
|
|
875
|
+
f = this.formats[u](a, d, {
|
|
876
|
+
...c,
|
|
877
|
+
...i,
|
|
878
|
+
...p
|
|
879
|
+
});
|
|
880
|
+
} catch (p) {
|
|
881
|
+
this.logger.warn(p);
|
|
882
|
+
}
|
|
883
|
+
return f;
|
|
884
|
+
} else
|
|
885
|
+
this.logger.warn(`there was no format function for ${u}`);
|
|
886
|
+
return a;
|
|
887
|
+
}, e);
|
|
888
|
+
}
|
|
889
|
+
}
|
|
890
|
+
const mt = (s, e) => {
|
|
891
|
+
s.pending[e] !== void 0 && (delete s.pending[e], s.pendingCount--);
|
|
892
|
+
};
|
|
893
|
+
class yt extends te {
|
|
894
|
+
constructor(e, t, n, i = {}) {
|
|
895
|
+
super(), this.backend = e, this.store = t, this.services = n, this.languageUtils = n.languageUtils, this.options = i, this.logger = C.create("backendConnector"), this.waitingReads = [], this.maxParallelReads = i.maxParallelReads || 10, this.readingCalls = 0, this.maxRetries = i.maxRetries >= 0 ? i.maxRetries : 5, this.retryTimeout = i.retryTimeout >= 1 ? i.retryTimeout : 350, this.state = {}, this.queue = [], this.backend?.init?.(n, i.backend, i);
|
|
896
|
+
}
|
|
897
|
+
queueLoad(e, t, n, i) {
|
|
898
|
+
const r = {}, o = {}, a = {}, l = {};
|
|
899
|
+
return e.forEach((u) => {
|
|
900
|
+
let c = !0;
|
|
901
|
+
t.forEach((f) => {
|
|
902
|
+
const p = `${u}|${f}`;
|
|
903
|
+
!n.reload && this.store.hasResourceBundle(u, f) ? this.state[p] = 2 : this.state[p] < 0 || (this.state[p] === 1 ? o[p] === void 0 && (o[p] = !0) : (this.state[p] = 1, c = !1, o[p] === void 0 && (o[p] = !0), r[p] === void 0 && (r[p] = !0), l[f] === void 0 && (l[f] = !0)));
|
|
904
|
+
}), c || (a[u] = !0);
|
|
905
|
+
}), (Object.keys(r).length || Object.keys(o).length) && this.queue.push({
|
|
906
|
+
pending: o,
|
|
907
|
+
pendingCount: Object.keys(o).length,
|
|
908
|
+
loaded: {},
|
|
909
|
+
errors: [],
|
|
910
|
+
callback: i
|
|
911
|
+
}), {
|
|
912
|
+
toLoad: Object.keys(r),
|
|
913
|
+
pending: Object.keys(o),
|
|
914
|
+
toLoadLanguages: Object.keys(a),
|
|
915
|
+
toLoadNamespaces: Object.keys(l)
|
|
916
|
+
};
|
|
917
|
+
}
|
|
918
|
+
loaded(e, t, n) {
|
|
919
|
+
const i = e.split("|"), r = i[0], o = i[1];
|
|
920
|
+
t && this.emit("failedLoading", r, o, t), !t && n && this.store.addResourceBundle(r, o, n, void 0, void 0, {
|
|
921
|
+
skipCopy: !0
|
|
922
|
+
}), this.state[e] = t ? -1 : 2, t && n && (this.state[e] = 0);
|
|
923
|
+
const a = {};
|
|
924
|
+
this.queue.forEach((l) => {
|
|
925
|
+
nt(l.loaded, [r], o), mt(l, e), t && l.errors.push(t), l.pendingCount === 0 && !l.done && (Object.keys(l.loaded).forEach((u) => {
|
|
926
|
+
a[u] || (a[u] = {});
|
|
927
|
+
const c = l.loaded[u];
|
|
928
|
+
c.length && c.forEach((f) => {
|
|
929
|
+
a[u][f] === void 0 && (a[u][f] = !0);
|
|
930
|
+
});
|
|
931
|
+
}), l.done = !0, l.errors.length ? l.callback(l.errors) : l.callback());
|
|
932
|
+
}), this.emit("loaded", a), this.queue = this.queue.filter((l) => !l.done);
|
|
933
|
+
}
|
|
934
|
+
read(e, t, n, i = 0, r = this.retryTimeout, o) {
|
|
935
|
+
if (!e.length) return o(null, {});
|
|
936
|
+
if (this.readingCalls >= this.maxParallelReads) {
|
|
937
|
+
this.waitingReads.push({
|
|
938
|
+
lng: e,
|
|
939
|
+
ns: t,
|
|
940
|
+
fcName: n,
|
|
941
|
+
tried: i,
|
|
942
|
+
wait: r,
|
|
943
|
+
callback: o
|
|
944
|
+
});
|
|
945
|
+
return;
|
|
946
|
+
}
|
|
947
|
+
this.readingCalls++;
|
|
948
|
+
const a = (u, c) => {
|
|
949
|
+
if (this.readingCalls--, this.waitingReads.length > 0) {
|
|
950
|
+
const f = this.waitingReads.shift();
|
|
951
|
+
this.read(f.lng, f.ns, f.fcName, f.tried, f.wait, f.callback);
|
|
952
|
+
}
|
|
953
|
+
if (u && c && i < this.maxRetries) {
|
|
954
|
+
setTimeout(() => {
|
|
955
|
+
this.read.call(this, e, t, n, i + 1, r * 2, o);
|
|
956
|
+
}, r);
|
|
957
|
+
return;
|
|
958
|
+
}
|
|
959
|
+
o(u, c);
|
|
960
|
+
}, l = this.backend[n].bind(this.backend);
|
|
961
|
+
if (l.length === 2) {
|
|
962
|
+
try {
|
|
963
|
+
const u = l(e, t);
|
|
964
|
+
u && typeof u.then == "function" ? u.then((c) => a(null, c)).catch(a) : a(null, u);
|
|
965
|
+
} catch (u) {
|
|
966
|
+
a(u);
|
|
967
|
+
}
|
|
968
|
+
return;
|
|
969
|
+
}
|
|
970
|
+
return l(e, t, a);
|
|
971
|
+
}
|
|
972
|
+
prepareLoading(e, t, n = {}, i) {
|
|
973
|
+
if (!this.backend)
|
|
974
|
+
return this.logger.warn("No backend was added via i18next.use. Will not load resources."), i && i();
|
|
975
|
+
g(e) && (e = this.languageUtils.toResolveHierarchy(e)), g(t) && (t = [t]);
|
|
976
|
+
const r = this.queueLoad(e, t, n, i);
|
|
977
|
+
if (!r.toLoad.length)
|
|
978
|
+
return r.pending.length || i(), null;
|
|
979
|
+
r.toLoad.forEach((o) => {
|
|
980
|
+
this.loadOne(o);
|
|
981
|
+
});
|
|
982
|
+
}
|
|
983
|
+
load(e, t, n) {
|
|
984
|
+
this.prepareLoading(e, t, {}, n);
|
|
985
|
+
}
|
|
986
|
+
reload(e, t, n) {
|
|
987
|
+
this.prepareLoading(e, t, {
|
|
988
|
+
reload: !0
|
|
989
|
+
}, n);
|
|
990
|
+
}
|
|
991
|
+
loadOne(e, t = "") {
|
|
992
|
+
const n = e.split("|"), i = n[0], r = n[1];
|
|
993
|
+
this.read(i, r, "read", void 0, void 0, (o, a) => {
|
|
994
|
+
o && this.logger.warn(`${t}loading namespace ${r} for language ${i} failed`, o), !o && a && this.logger.log(`${t}loaded namespace ${r} for language ${i}`, a), this.loaded(e, o, a);
|
|
995
|
+
});
|
|
996
|
+
}
|
|
997
|
+
saveMissing(e, t, n, i, r, o = {}, a = () => {
|
|
998
|
+
}) {
|
|
999
|
+
if (this.services?.utils?.hasLoadedNamespace && !this.services?.utils?.hasLoadedNamespace(t)) {
|
|
1000
|
+
this.logger.warn(`did not save key "${n}" as the namespace "${t}" was not yet loaded`, "This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");
|
|
1001
|
+
return;
|
|
1002
|
+
}
|
|
1003
|
+
if (!(n == null || n === "")) {
|
|
1004
|
+
if (this.backend?.create) {
|
|
1005
|
+
const l = {
|
|
1006
|
+
...o,
|
|
1007
|
+
isUpdate: r
|
|
1008
|
+
}, u = this.backend.create.bind(this.backend);
|
|
1009
|
+
if (u.length < 6)
|
|
1010
|
+
try {
|
|
1011
|
+
let c;
|
|
1012
|
+
u.length === 5 ? c = u(e, t, n, i, l) : c = u(e, t, n, i), c && typeof c.then == "function" ? c.then((f) => a(null, f)).catch(a) : a(null, c);
|
|
1013
|
+
} catch (c) {
|
|
1014
|
+
a(c);
|
|
1015
|
+
}
|
|
1016
|
+
else
|
|
1017
|
+
u(e, t, n, i, a, l);
|
|
1018
|
+
}
|
|
1019
|
+
!e || !e[0] || this.store.addResource(e[0], t, n, i);
|
|
1020
|
+
}
|
|
1021
|
+
}
|
|
1022
|
+
}
|
|
1023
|
+
const ke = () => ({
|
|
1024
|
+
debug: !1,
|
|
1025
|
+
initAsync: !0,
|
|
1026
|
+
ns: ["translation"],
|
|
1027
|
+
defaultNS: ["translation"],
|
|
1028
|
+
fallbackLng: ["dev"],
|
|
1029
|
+
fallbackNS: !1,
|
|
1030
|
+
supportedLngs: !1,
|
|
1031
|
+
nonExplicitSupportedLngs: !1,
|
|
1032
|
+
load: "all",
|
|
1033
|
+
preload: !1,
|
|
1034
|
+
simplifyPluralSuffix: !0,
|
|
1035
|
+
keySeparator: ".",
|
|
1036
|
+
nsSeparator: ":",
|
|
1037
|
+
pluralSeparator: "_",
|
|
1038
|
+
contextSeparator: "_",
|
|
1039
|
+
partialBundledLanguages: !1,
|
|
1040
|
+
saveMissing: !1,
|
|
1041
|
+
updateMissing: !1,
|
|
1042
|
+
saveMissingTo: "fallback",
|
|
1043
|
+
saveMissingPlurals: !0,
|
|
1044
|
+
missingKeyHandler: !1,
|
|
1045
|
+
missingInterpolationHandler: !1,
|
|
1046
|
+
postProcess: !1,
|
|
1047
|
+
postProcessPassResolved: !1,
|
|
1048
|
+
returnNull: !1,
|
|
1049
|
+
returnEmptyString: !0,
|
|
1050
|
+
returnObjects: !1,
|
|
1051
|
+
joinArrays: !1,
|
|
1052
|
+
returnedObjectHandler: !1,
|
|
1053
|
+
parseMissingKeyHandler: !1,
|
|
1054
|
+
appendNamespaceToMissingKey: !1,
|
|
1055
|
+
appendNamespaceToCIMode: !1,
|
|
1056
|
+
overloadTranslationOptionHandler: (s) => {
|
|
1057
|
+
let e = {};
|
|
1058
|
+
if (typeof s[1] == "object" && (e = s[1]), g(s[1]) && (e.defaultValue = s[1]), g(s[2]) && (e.tDescription = s[2]), typeof s[2] == "object" || typeof s[3] == "object") {
|
|
1059
|
+
const t = s[3] || s[2];
|
|
1060
|
+
Object.keys(t).forEach((n) => {
|
|
1061
|
+
e[n] = t[n];
|
|
1062
|
+
});
|
|
1063
|
+
}
|
|
1064
|
+
return e;
|
|
1065
|
+
},
|
|
1066
|
+
interpolation: {
|
|
1067
|
+
escapeValue: !0,
|
|
1068
|
+
format: (s) => s,
|
|
1069
|
+
prefix: "{{",
|
|
1070
|
+
suffix: "}}",
|
|
1071
|
+
formatSeparator: ",",
|
|
1072
|
+
unescapePrefix: "-",
|
|
1073
|
+
nestingPrefix: "$t(",
|
|
1074
|
+
nestingSuffix: ")",
|
|
1075
|
+
nestingOptionsSeparator: ",",
|
|
1076
|
+
maxReplaces: 1e3,
|
|
1077
|
+
skipOnVariables: !0
|
|
1078
|
+
},
|
|
1079
|
+
cacheInBuiltFormats: !0
|
|
1080
|
+
}), Ce = (s) => (g(s.ns) && (s.ns = [s.ns]), g(s.fallbackLng) && (s.fallbackLng = [s.fallbackLng]), g(s.fallbackNS) && (s.fallbackNS = [s.fallbackNS]), s.supportedLngs?.indexOf?.("cimode") < 0 && (s.supportedLngs = s.supportedLngs.concat(["cimode"])), typeof s.initImmediate == "boolean" && (s.initAsync = s.initImmediate), s), W = () => {
|
|
1081
|
+
}, xt = (s) => {
|
|
1082
|
+
Object.getOwnPropertyNames(Object.getPrototypeOf(s)).forEach((t) => {
|
|
1083
|
+
typeof s[t] == "function" && (s[t] = s[t].bind(s));
|
|
1084
|
+
});
|
|
1085
|
+
};
|
|
1086
|
+
class _ extends te {
|
|
1087
|
+
constructor(e = {}, t) {
|
|
1088
|
+
if (super(), this.options = Ce(e), this.services = {}, this.logger = C, this.modules = {
|
|
1089
|
+
external: []
|
|
1090
|
+
}, xt(this), t && !this.isInitialized && !e.isClone) {
|
|
1091
|
+
if (!this.options.initAsync)
|
|
1092
|
+
return this.init(e, t), this;
|
|
1093
|
+
setTimeout(() => {
|
|
1094
|
+
this.init(e, t);
|
|
1095
|
+
}, 0);
|
|
1096
|
+
}
|
|
1097
|
+
}
|
|
1098
|
+
init(e = {}, t) {
|
|
1099
|
+
this.isInitializing = !0, typeof e == "function" && (t = e, e = {}), e.defaultNS == null && e.ns && (g(e.ns) ? e.defaultNS = e.ns : e.ns.indexOf("translation") < 0 && (e.defaultNS = e.ns[0]));
|
|
1100
|
+
const n = ke();
|
|
1101
|
+
this.options = {
|
|
1102
|
+
...n,
|
|
1103
|
+
...this.options,
|
|
1104
|
+
...Ce(e)
|
|
1105
|
+
}, this.options.interpolation = {
|
|
1106
|
+
...n.interpolation,
|
|
1107
|
+
...this.options.interpolation
|
|
1108
|
+
}, e.keySeparator !== void 0 && (this.options.userDefinedKeySeparator = e.keySeparator), e.nsSeparator !== void 0 && (this.options.userDefinedNsSeparator = e.nsSeparator);
|
|
1109
|
+
const i = (u) => u ? typeof u == "function" ? new u() : u : null;
|
|
1110
|
+
if (!this.options.isClone) {
|
|
1111
|
+
this.modules.logger ? C.init(i(this.modules.logger), this.options) : C.init(null, this.options);
|
|
1112
|
+
let u;
|
|
1113
|
+
this.modules.formatter ? u = this.modules.formatter : u = gt;
|
|
1114
|
+
const c = new Se(this.options);
|
|
1115
|
+
this.store = new xe(this.options.resources, this.options);
|
|
1116
|
+
const f = this.services;
|
|
1117
|
+
f.logger = C, f.resourceStore = this.store, f.languageUtils = c, f.pluralResolver = new dt(c, {
|
|
1118
|
+
prepend: this.options.pluralSeparator,
|
|
1119
|
+
simplifyPluralSuffix: this.options.simplifyPluralSuffix
|
|
1120
|
+
}), this.options.interpolation.format && this.options.interpolation.format !== n.interpolation.format && this.logger.deprecate("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"), u && (!this.options.interpolation.format || this.options.interpolation.format === n.interpolation.format) && (f.formatter = i(u), f.formatter.init && f.formatter.init(f, this.options), this.options.interpolation.format = f.formatter.format.bind(f.formatter)), f.interpolator = new Le(this.options), f.utils = {
|
|
1121
|
+
hasLoadedNamespace: this.hasLoadedNamespace.bind(this)
|
|
1122
|
+
}, f.backendConnector = new yt(i(this.modules.backend), f.resourceStore, f, this.options), f.backendConnector.on("*", (d, ...h) => {
|
|
1123
|
+
this.emit(d, ...h);
|
|
1124
|
+
}), this.modules.languageDetector && (f.languageDetector = i(this.modules.languageDetector), f.languageDetector.init && f.languageDetector.init(f, this.options.detection, this.options)), this.modules.i18nFormat && (f.i18nFormat = i(this.modules.i18nFormat), f.i18nFormat.init && f.i18nFormat.init(this)), this.translator = new Z(this.services, this.options), this.translator.on("*", (d, ...h) => {
|
|
1125
|
+
this.emit(d, ...h);
|
|
1126
|
+
}), this.modules.external.forEach((d) => {
|
|
1127
|
+
d.init && d.init(this);
|
|
1128
|
+
});
|
|
1129
|
+
}
|
|
1130
|
+
if (this.format = this.options.interpolation.format, t || (t = W), this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) {
|
|
1131
|
+
const u = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
|
|
1132
|
+
u.length > 0 && u[0] !== "dev" && (this.options.lng = u[0]);
|
|
1133
|
+
}
|
|
1134
|
+
!this.services.languageDetector && !this.options.lng && this.logger.warn("init: no languageDetector is used and no lng is defined"), ["getResource", "hasResourceBundle", "getResourceBundle", "getDataByLanguage"].forEach((u) => {
|
|
1135
|
+
this[u] = (...c) => this.store[u](...c);
|
|
1136
|
+
}), ["addResource", "addResources", "addResourceBundle", "removeResourceBundle"].forEach((u) => {
|
|
1137
|
+
this[u] = (...c) => (this.store[u](...c), this);
|
|
1138
|
+
});
|
|
1139
|
+
const a = q(), l = () => {
|
|
1140
|
+
const u = (c, f) => {
|
|
1141
|
+
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), a.resolve(f), t(c, f);
|
|
1142
|
+
};
|
|
1143
|
+
if (this.languages && !this.isInitialized) return u(null, this.t.bind(this));
|
|
1144
|
+
this.changeLanguage(this.options.lng, u);
|
|
1145
|
+
};
|
|
1146
|
+
return this.options.resources || !this.options.initAsync ? l() : setTimeout(l, 0), a;
|
|
1147
|
+
}
|
|
1148
|
+
loadResources(e, t = W) {
|
|
1149
|
+
let n = t;
|
|
1150
|
+
const i = g(e) ? e : this.language;
|
|
1151
|
+
if (typeof e == "function" && (n = e), !this.options.resources || this.options.partialBundledLanguages) {
|
|
1152
|
+
if (i?.toLowerCase() === "cimode" && (!this.options.preload || this.options.preload.length === 0)) return n();
|
|
1153
|
+
const r = [], o = (a) => {
|
|
1154
|
+
if (!a || a === "cimode") return;
|
|
1155
|
+
this.services.languageUtils.toResolveHierarchy(a).forEach((u) => {
|
|
1156
|
+
u !== "cimode" && r.indexOf(u) < 0 && r.push(u);
|
|
1157
|
+
});
|
|
1158
|
+
};
|
|
1159
|
+
i ? o(i) : this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach((l) => o(l)), this.options.preload?.forEach?.((a) => o(a)), this.services.backendConnector.load(r, this.options.ns, (a) => {
|
|
1160
|
+
!a && !this.resolvedLanguage && this.language && this.setResolvedLanguage(this.language), n(a);
|
|
1161
|
+
});
|
|
1162
|
+
} else
|
|
1163
|
+
n(null);
|
|
1164
|
+
}
|
|
1165
|
+
reloadResources(e, t, n) {
|
|
1166
|
+
const i = q();
|
|
1167
|
+
return typeof e == "function" && (n = e, e = void 0), typeof t == "function" && (n = t, t = void 0), e || (e = this.languages), t || (t = this.options.ns), n || (n = W), this.services.backendConnector.reload(e, t, (r) => {
|
|
1168
|
+
i.resolve(), n(r);
|
|
1169
|
+
}), i;
|
|
1170
|
+
}
|
|
1171
|
+
use(e) {
|
|
1172
|
+
if (!e) throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");
|
|
1173
|
+
if (!e.type) throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");
|
|
1174
|
+
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" && Ke.addPostProcessor(e), e.type === "formatter" && (this.modules.formatter = e), e.type === "3rdParty" && this.modules.external.push(e), this;
|
|
1175
|
+
}
|
|
1176
|
+
setResolvedLanguage(e) {
|
|
1177
|
+
if (!(!e || !this.languages) && !(["cimode", "dev"].indexOf(e) > -1)) {
|
|
1178
|
+
for (let t = 0; t < this.languages.length; t++) {
|
|
1179
|
+
const n = this.languages[t];
|
|
1180
|
+
if (!(["cimode", "dev"].indexOf(n) > -1) && this.store.hasLanguageSomeTranslations(n)) {
|
|
1181
|
+
this.resolvedLanguage = n;
|
|
1182
|
+
break;
|
|
1183
|
+
}
|
|
1184
|
+
}
|
|
1185
|
+
!this.resolvedLanguage && this.languages.indexOf(e) < 0 && this.store.hasLanguageSomeTranslations(e) && (this.resolvedLanguage = e, this.languages.unshift(e));
|
|
1186
|
+
}
|
|
1187
|
+
}
|
|
1188
|
+
changeLanguage(e, t) {
|
|
1189
|
+
this.isLanguageChangingTo = e;
|
|
1190
|
+
const n = q();
|
|
1191
|
+
this.emit("languageChanging", e);
|
|
1192
|
+
const i = (a) => {
|
|
1193
|
+
this.language = a, this.languages = this.services.languageUtils.toResolveHierarchy(a), this.resolvedLanguage = void 0, this.setResolvedLanguage(a);
|
|
1194
|
+
}, r = (a, l) => {
|
|
1195
|
+
l ? this.isLanguageChangingTo === e && (i(l), this.translator.changeLanguage(l), this.isLanguageChangingTo = void 0, this.emit("languageChanged", l), this.logger.log("languageChanged", l)) : this.isLanguageChangingTo = void 0, n.resolve((...u) => this.t(...u)), t && t(a, (...u) => this.t(...u));
|
|
1196
|
+
}, o = (a) => {
|
|
1197
|
+
!e && !a && this.services.languageDetector && (a = []);
|
|
1198
|
+
const l = g(a) ? a : a && a[0], u = this.store.hasLanguageSomeTranslations(l) ? l : this.services.languageUtils.getBestMatchFromCodes(g(a) ? [a] : a);
|
|
1199
|
+
u && (this.language || i(u), this.translator.language || this.translator.changeLanguage(u), this.services.languageDetector?.cacheUserLanguage?.(u)), this.loadResources(u, (c) => {
|
|
1200
|
+
r(c, u);
|
|
1201
|
+
});
|
|
1202
|
+
};
|
|
1203
|
+
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;
|
|
1204
|
+
}
|
|
1205
|
+
getFixedT(e, t, n) {
|
|
1206
|
+
const i = (r, o, ...a) => {
|
|
1207
|
+
let l;
|
|
1208
|
+
typeof o != "object" ? l = this.options.overloadTranslationOptionHandler([r, o].concat(a)) : l = {
|
|
1209
|
+
...o
|
|
1210
|
+
}, l.lng = l.lng || i.lng, l.lngs = l.lngs || i.lngs, l.ns = l.ns || i.ns, l.keyPrefix !== "" && (l.keyPrefix = l.keyPrefix || n || i.keyPrefix);
|
|
1211
|
+
const u = this.options.keySeparator || ".";
|
|
1212
|
+
let c;
|
|
1213
|
+
return l.keyPrefix && Array.isArray(r) ? c = r.map((f) => (typeof f == "function" && (f = oe(f, {
|
|
1214
|
+
...this.options,
|
|
1215
|
+
...o
|
|
1216
|
+
})), `${l.keyPrefix}${u}${f}`)) : (typeof r == "function" && (r = oe(r, {
|
|
1217
|
+
...this.options,
|
|
1218
|
+
...o
|
|
1219
|
+
})), c = l.keyPrefix ? `${l.keyPrefix}${u}${r}` : r), this.t(c, l);
|
|
1220
|
+
};
|
|
1221
|
+
return g(e) ? i.lng = e : i.lngs = e, i.ns = t, i.keyPrefix = n, i;
|
|
1222
|
+
}
|
|
1223
|
+
t(...e) {
|
|
1224
|
+
return this.translator?.translate(...e);
|
|
1225
|
+
}
|
|
1226
|
+
exists(...e) {
|
|
1227
|
+
return this.translator?.exists(...e);
|
|
1228
|
+
}
|
|
1229
|
+
setDefaultNamespace(e) {
|
|
1230
|
+
this.options.defaultNS = e;
|
|
1231
|
+
}
|
|
1232
|
+
hasLoadedNamespace(e, t = {}) {
|
|
1233
|
+
if (!this.isInitialized)
|
|
1234
|
+
return this.logger.warn("hasLoadedNamespace: i18next was not initialized", this.languages), !1;
|
|
1235
|
+
if (!this.languages || !this.languages.length)
|
|
1236
|
+
return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty", this.languages), !1;
|
|
1237
|
+
const n = t.lng || this.resolvedLanguage || this.languages[0], i = this.options ? this.options.fallbackLng : !1, r = this.languages[this.languages.length - 1];
|
|
1238
|
+
if (n.toLowerCase() === "cimode") return !0;
|
|
1239
|
+
const o = (a, l) => {
|
|
1240
|
+
const u = this.services.backendConnector.state[`${a}|${l}`];
|
|
1241
|
+
return u === -1 || u === 0 || u === 2;
|
|
1242
|
+
};
|
|
1243
|
+
if (t.precheck) {
|
|
1244
|
+
const a = t.precheck(this, o);
|
|
1245
|
+
if (a !== void 0) return a;
|
|
1246
|
+
}
|
|
1247
|
+
return !!(this.hasResourceBundle(n, e) || !this.services.backendConnector.backend || this.options.resources && !this.options.partialBundledLanguages || o(n, e) && (!i || o(r, e)));
|
|
1248
|
+
}
|
|
1249
|
+
loadNamespaces(e, t) {
|
|
1250
|
+
const n = q();
|
|
1251
|
+
return this.options.ns ? (g(e) && (e = [e]), e.forEach((i) => {
|
|
1252
|
+
this.options.ns.indexOf(i) < 0 && this.options.ns.push(i);
|
|
1253
|
+
}), this.loadResources((i) => {
|
|
1254
|
+
n.resolve(), t && t(i);
|
|
1255
|
+
}), n) : (t && t(), Promise.resolve());
|
|
1256
|
+
}
|
|
1257
|
+
loadLanguages(e, t) {
|
|
1258
|
+
const n = q();
|
|
1259
|
+
g(e) && (e = [e]);
|
|
1260
|
+
const i = this.options.preload || [], r = e.filter((o) => i.indexOf(o) < 0 && this.services.languageUtils.isSupportedCode(o));
|
|
1261
|
+
return r.length ? (this.options.preload = i.concat(r), this.loadResources((o) => {
|
|
1262
|
+
n.resolve(), t && t(o);
|
|
1263
|
+
}), n) : (t && t(), Promise.resolve());
|
|
1264
|
+
}
|
|
1265
|
+
dir(e) {
|
|
1266
|
+
if (e || (e = this.resolvedLanguage || (this.languages?.length > 0 ? this.languages[0] : this.language)), !e) return "rtl";
|
|
1267
|
+
try {
|
|
1268
|
+
const i = new Intl.Locale(e);
|
|
1269
|
+
if (i && i.getTextInfo) {
|
|
1270
|
+
const r = i.getTextInfo();
|
|
1271
|
+
if (r && r.direction) return r.direction;
|
|
1272
|
+
}
|
|
1273
|
+
} catch {
|
|
1274
|
+
}
|
|
1275
|
+
const t = ["ar", "shu", "sqr", "ssh", "xaa", "yhd", "yud", "aao", "abh", "abv", "acm", "acq", "acw", "acx", "acy", "adf", "ads", "aeb", "aec", "afb", "ajp", "apc", "apd", "arb", "arq", "ars", "ary", "arz", "auz", "avl", "ayh", "ayl", "ayn", "ayp", "bbz", "pga", "he", "iw", "ps", "pbt", "pbu", "pst", "prp", "prd", "ug", "ur", "ydd", "yds", "yih", "ji", "yi", "hbo", "men", "xmn", "fa", "jpr", "peo", "pes", "prs", "dv", "sam", "ckb"], n = this.services?.languageUtils || new Se(ke());
|
|
1276
|
+
return e.toLowerCase().indexOf("-latn") > 1 ? "ltr" : t.indexOf(n.getLanguagePartFromCode(e)) > -1 || e.toLowerCase().indexOf("-arab") > 1 ? "rtl" : "ltr";
|
|
1277
|
+
}
|
|
1278
|
+
static createInstance(e = {}, t) {
|
|
1279
|
+
const n = new _(e, t);
|
|
1280
|
+
return n.createInstance = _.createInstance, n;
|
|
1281
|
+
}
|
|
1282
|
+
cloneInstance(e = {}, t = W) {
|
|
1283
|
+
const n = e.forkResourceStore;
|
|
1284
|
+
n && delete e.forkResourceStore;
|
|
1285
|
+
const i = {
|
|
1286
|
+
...this.options,
|
|
1287
|
+
...e,
|
|
1288
|
+
isClone: !0
|
|
1289
|
+
}, r = new _(i);
|
|
1290
|
+
if ((e.debug !== void 0 || e.prefix !== void 0) && (r.logger = r.logger.clone(e)), ["store", "services", "language"].forEach((a) => {
|
|
1291
|
+
r[a] = this[a];
|
|
1292
|
+
}), r.services = {
|
|
1293
|
+
...this.services
|
|
1294
|
+
}, r.services.utils = {
|
|
1295
|
+
hasLoadedNamespace: r.hasLoadedNamespace.bind(r)
|
|
1296
|
+
}, n) {
|
|
1297
|
+
const a = Object.keys(this.store.data).reduce((l, u) => (l[u] = {
|
|
1298
|
+
...this.store.data[u]
|
|
1299
|
+
}, l[u] = Object.keys(l[u]).reduce((c, f) => (c[f] = {
|
|
1300
|
+
...l[u][f]
|
|
1301
|
+
}, c), l[u]), l), {});
|
|
1302
|
+
r.store = new xe(a, i), r.services.resourceStore = r.store;
|
|
1303
|
+
}
|
|
1304
|
+
return e.interpolation && (r.services.interpolator = new Le(i)), r.translator = new Z(r.services, i), r.translator.on("*", (a, ...l) => {
|
|
1305
|
+
r.emit(a, ...l);
|
|
1306
|
+
}), r.init(i, t), r.translator.options = i, r.translator.backendConnector.services.utils = {
|
|
1307
|
+
hasLoadedNamespace: r.hasLoadedNamespace.bind(r)
|
|
1308
|
+
}, r;
|
|
1309
|
+
}
|
|
1310
|
+
toJSON() {
|
|
1311
|
+
return {
|
|
1312
|
+
options: this.options,
|
|
1313
|
+
store: this.store,
|
|
1314
|
+
language: this.language,
|
|
1315
|
+
languages: this.languages,
|
|
1316
|
+
resolvedLanguage: this.resolvedLanguage
|
|
1317
|
+
};
|
|
1318
|
+
}
|
|
1319
|
+
}
|
|
1320
|
+
const b = _.createInstance();
|
|
1321
|
+
b.createInstance;
|
|
1322
|
+
b.dir;
|
|
1323
|
+
b.init;
|
|
1324
|
+
b.loadResources;
|
|
1325
|
+
b.reloadResources;
|
|
1326
|
+
b.use;
|
|
1327
|
+
b.changeLanguage;
|
|
1328
|
+
b.getFixedT;
|
|
1329
|
+
b.t;
|
|
1330
|
+
b.exists;
|
|
1331
|
+
b.setDefaultNamespace;
|
|
1332
|
+
b.hasLoadedNamespace;
|
|
1333
|
+
b.loadNamespaces;
|
|
1334
|
+
b.loadLanguages;
|
|
1335
|
+
const {
|
|
1336
|
+
slice: bt,
|
|
1337
|
+
forEach: St
|
|
1338
|
+
} = [];
|
|
1339
|
+
function vt(s) {
|
|
1340
|
+
return St.call(bt.call(arguments, 1), (e) => {
|
|
1341
|
+
if (e)
|
|
1342
|
+
for (const t in e)
|
|
1343
|
+
s[t] === void 0 && (s[t] = e[t]);
|
|
1344
|
+
}), s;
|
|
1345
|
+
}
|
|
1346
|
+
function wt(s) {
|
|
1347
|
+
return typeof s != "string" ? !1 : [/<\s*script.*?>/i, /<\s*\/\s*script\s*>/i, /<\s*img.*?on\w+\s*=/i, /<\s*\w+\s*on\w+\s*=.*?>/i, /javascript\s*:/i, /vbscript\s*:/i, /expression\s*\(/i, /eval\s*\(/i, /alert\s*\(/i, /document\.cookie/i, /document\.write\s*\(/i, /window\.location/i, /innerHTML/i].some((t) => t.test(s));
|
|
1348
|
+
}
|
|
1349
|
+
const Re = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/, Ot = function(s, e) {
|
|
1350
|
+
const n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {
|
|
1351
|
+
path: "/"
|
|
1352
|
+
}, i = encodeURIComponent(e);
|
|
1353
|
+
let r = `${s}=${i}`;
|
|
1354
|
+
if (n.maxAge > 0) {
|
|
1355
|
+
const o = n.maxAge - 0;
|
|
1356
|
+
if (Number.isNaN(o)) throw new Error("maxAge should be a Number");
|
|
1357
|
+
r += `; Max-Age=${Math.floor(o)}`;
|
|
1358
|
+
}
|
|
1359
|
+
if (n.domain) {
|
|
1360
|
+
if (!Re.test(n.domain))
|
|
1361
|
+
throw new TypeError("option domain is invalid");
|
|
1362
|
+
r += `; Domain=${n.domain}`;
|
|
1363
|
+
}
|
|
1364
|
+
if (n.path) {
|
|
1365
|
+
if (!Re.test(n.path))
|
|
1366
|
+
throw new TypeError("option path is invalid");
|
|
1367
|
+
r += `; Path=${n.path}`;
|
|
1368
|
+
}
|
|
1369
|
+
if (n.expires) {
|
|
1370
|
+
if (typeof n.expires.toUTCString != "function")
|
|
1371
|
+
throw new TypeError("option expires is invalid");
|
|
1372
|
+
r += `; Expires=${n.expires.toUTCString()}`;
|
|
1373
|
+
}
|
|
1374
|
+
if (n.httpOnly && (r += "; HttpOnly"), n.secure && (r += "; Secure"), n.sameSite)
|
|
1375
|
+
switch (typeof n.sameSite == "string" ? n.sameSite.toLowerCase() : n.sameSite) {
|
|
1376
|
+
case !0:
|
|
1377
|
+
r += "; SameSite=Strict";
|
|
1378
|
+
break;
|
|
1379
|
+
case "lax":
|
|
1380
|
+
r += "; SameSite=Lax";
|
|
1381
|
+
break;
|
|
1382
|
+
case "strict":
|
|
1383
|
+
r += "; SameSite=Strict";
|
|
1384
|
+
break;
|
|
1385
|
+
case "none":
|
|
1386
|
+
r += "; SameSite=None";
|
|
1387
|
+
break;
|
|
1388
|
+
default:
|
|
1389
|
+
throw new TypeError("option sameSite is invalid");
|
|
1390
|
+
}
|
|
1391
|
+
return n.partitioned && (r += "; Partitioned"), r;
|
|
1392
|
+
}, je = {
|
|
1393
|
+
create(s, e, t, n) {
|
|
1394
|
+
let i = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : {
|
|
1395
|
+
path: "/",
|
|
1396
|
+
sameSite: "strict"
|
|
1397
|
+
};
|
|
1398
|
+
t && (i.expires = /* @__PURE__ */ new Date(), i.expires.setTime(i.expires.getTime() + t * 60 * 1e3)), n && (i.domain = n), document.cookie = Ot(s, e, i);
|
|
1399
|
+
},
|
|
1400
|
+
read(s) {
|
|
1401
|
+
const e = `${s}=`, t = document.cookie.split(";");
|
|
1402
|
+
for (let n = 0; n < t.length; n++) {
|
|
1403
|
+
let i = t[n];
|
|
1404
|
+
for (; i.charAt(0) === " "; ) i = i.substring(1, i.length);
|
|
1405
|
+
if (i.indexOf(e) === 0) return i.substring(e.length, i.length);
|
|
1406
|
+
}
|
|
1407
|
+
return null;
|
|
1408
|
+
},
|
|
1409
|
+
remove(s, e) {
|
|
1410
|
+
this.create(s, "", -1, e);
|
|
1411
|
+
}
|
|
1412
|
+
};
|
|
1413
|
+
var Lt = {
|
|
1414
|
+
name: "cookie",
|
|
1415
|
+
// Deconstruct the options object and extract the lookupCookie property
|
|
1416
|
+
lookup(s) {
|
|
1417
|
+
let {
|
|
1418
|
+
lookupCookie: e
|
|
1419
|
+
} = s;
|
|
1420
|
+
if (e && typeof document < "u")
|
|
1421
|
+
return je.read(e) || void 0;
|
|
1422
|
+
},
|
|
1423
|
+
// Deconstruct the options object and extract the lookupCookie, cookieMinutes, cookieDomain, and cookieOptions properties
|
|
1424
|
+
cacheUserLanguage(s, e) {
|
|
1425
|
+
let {
|
|
1426
|
+
lookupCookie: t,
|
|
1427
|
+
cookieMinutes: n,
|
|
1428
|
+
cookieDomain: i,
|
|
1429
|
+
cookieOptions: r
|
|
1430
|
+
} = e;
|
|
1431
|
+
t && typeof document < "u" && je.create(t, s, n, i, r);
|
|
1432
|
+
}
|
|
1433
|
+
}, Pt = {
|
|
1434
|
+
name: "querystring",
|
|
1435
|
+
// Deconstruct the options object and extract the lookupQuerystring property
|
|
1436
|
+
lookup(s) {
|
|
1437
|
+
let {
|
|
1438
|
+
lookupQuerystring: e
|
|
1439
|
+
} = s, t;
|
|
1440
|
+
if (typeof window < "u") {
|
|
1441
|
+
let {
|
|
1442
|
+
search: n
|
|
1443
|
+
} = window.location;
|
|
1444
|
+
!window.location.search && window.location.hash?.indexOf("?") > -1 && (n = window.location.hash.substring(window.location.hash.indexOf("?")));
|
|
1445
|
+
const r = n.substring(1).split("&");
|
|
1446
|
+
for (let o = 0; o < r.length; o++) {
|
|
1447
|
+
const a = r[o].indexOf("=");
|
|
1448
|
+
a > 0 && r[o].substring(0, a) === e && (t = r[o].substring(a + 1));
|
|
1449
|
+
}
|
|
1450
|
+
}
|
|
1451
|
+
return t;
|
|
1452
|
+
}
|
|
1453
|
+
}, kt = {
|
|
1454
|
+
name: "hash",
|
|
1455
|
+
// Deconstruct the options object and extract the lookupHash property and the lookupFromHashIndex property
|
|
1456
|
+
lookup(s) {
|
|
1457
|
+
let {
|
|
1458
|
+
lookupHash: e,
|
|
1459
|
+
lookupFromHashIndex: t
|
|
1460
|
+
} = s, n;
|
|
1461
|
+
if (typeof window < "u") {
|
|
1462
|
+
const {
|
|
1463
|
+
hash: i
|
|
1464
|
+
} = window.location;
|
|
1465
|
+
if (i && i.length > 2) {
|
|
1466
|
+
const r = i.substring(1);
|
|
1467
|
+
if (e) {
|
|
1468
|
+
const o = r.split("&");
|
|
1469
|
+
for (let a = 0; a < o.length; a++) {
|
|
1470
|
+
const l = o[a].indexOf("=");
|
|
1471
|
+
l > 0 && o[a].substring(0, l) === e && (n = o[a].substring(l + 1));
|
|
1472
|
+
}
|
|
1473
|
+
}
|
|
1474
|
+
if (n) return n;
|
|
1475
|
+
if (!n && t > -1) {
|
|
1476
|
+
const o = i.match(/\/([a-zA-Z-]*)/g);
|
|
1477
|
+
return Array.isArray(o) ? o[typeof t == "number" ? t : 0]?.replace("/", "") : void 0;
|
|
1478
|
+
}
|
|
1479
|
+
}
|
|
1480
|
+
}
|
|
1481
|
+
return n;
|
|
1482
|
+
}
|
|
1483
|
+
};
|
|
1484
|
+
let H = null;
|
|
1485
|
+
const $e = () => {
|
|
1486
|
+
if (H !== null) return H;
|
|
1487
|
+
try {
|
|
1488
|
+
if (H = typeof window < "u" && window.localStorage !== null, !H)
|
|
1489
|
+
return !1;
|
|
1490
|
+
const s = "i18next.translate.boo";
|
|
1491
|
+
window.localStorage.setItem(s, "foo"), window.localStorage.removeItem(s);
|
|
1492
|
+
} catch {
|
|
1493
|
+
H = !1;
|
|
1494
|
+
}
|
|
1495
|
+
return H;
|
|
1496
|
+
};
|
|
1497
|
+
var Ct = {
|
|
1498
|
+
name: "localStorage",
|
|
1499
|
+
// Deconstruct the options object and extract the lookupLocalStorage property
|
|
1500
|
+
lookup(s) {
|
|
1501
|
+
let {
|
|
1502
|
+
lookupLocalStorage: e
|
|
1503
|
+
} = s;
|
|
1504
|
+
if (e && $e())
|
|
1505
|
+
return window.localStorage.getItem(e) || void 0;
|
|
1506
|
+
},
|
|
1507
|
+
// Deconstruct the options object and extract the lookupLocalStorage property
|
|
1508
|
+
cacheUserLanguage(s, e) {
|
|
1509
|
+
let {
|
|
1510
|
+
lookupLocalStorage: t
|
|
1511
|
+
} = e;
|
|
1512
|
+
t && $e() && window.localStorage.setItem(t, s);
|
|
1513
|
+
}
|
|
1514
|
+
};
|
|
1515
|
+
let K = null;
|
|
1516
|
+
const Ee = () => {
|
|
1517
|
+
if (K !== null) return K;
|
|
1518
|
+
try {
|
|
1519
|
+
if (K = typeof window < "u" && window.sessionStorage !== null, !K)
|
|
1520
|
+
return !1;
|
|
1521
|
+
const s = "i18next.translate.boo";
|
|
1522
|
+
window.sessionStorage.setItem(s, "foo"), window.sessionStorage.removeItem(s);
|
|
1523
|
+
} catch {
|
|
1524
|
+
K = !1;
|
|
1525
|
+
}
|
|
1526
|
+
return K;
|
|
1527
|
+
};
|
|
1528
|
+
var Rt = {
|
|
1529
|
+
name: "sessionStorage",
|
|
1530
|
+
lookup(s) {
|
|
1531
|
+
let {
|
|
1532
|
+
lookupSessionStorage: e
|
|
1533
|
+
} = s;
|
|
1534
|
+
if (e && Ee())
|
|
1535
|
+
return window.sessionStorage.getItem(e) || void 0;
|
|
1536
|
+
},
|
|
1537
|
+
cacheUserLanguage(s, e) {
|
|
1538
|
+
let {
|
|
1539
|
+
lookupSessionStorage: t
|
|
1540
|
+
} = e;
|
|
1541
|
+
t && Ee() && window.sessionStorage.setItem(t, s);
|
|
1542
|
+
}
|
|
1543
|
+
}, jt = {
|
|
1544
|
+
name: "navigator",
|
|
1545
|
+
lookup(s) {
|
|
1546
|
+
const e = [];
|
|
1547
|
+
if (typeof navigator < "u") {
|
|
1548
|
+
const {
|
|
1549
|
+
languages: t,
|
|
1550
|
+
userLanguage: n,
|
|
1551
|
+
language: i
|
|
1552
|
+
} = navigator;
|
|
1553
|
+
if (t)
|
|
1554
|
+
for (let r = 0; r < t.length; r++)
|
|
1555
|
+
e.push(t[r]);
|
|
1556
|
+
n && e.push(n), i && e.push(i);
|
|
1557
|
+
}
|
|
1558
|
+
return e.length > 0 ? e : void 0;
|
|
1559
|
+
}
|
|
1560
|
+
}, $t = {
|
|
1561
|
+
name: "htmlTag",
|
|
1562
|
+
// Deconstruct the options object and extract the htmlTag property
|
|
1563
|
+
lookup(s) {
|
|
1564
|
+
let {
|
|
1565
|
+
htmlTag: e
|
|
1566
|
+
} = s, t;
|
|
1567
|
+
const n = e || (typeof document < "u" ? document.documentElement : null);
|
|
1568
|
+
return n && typeof n.getAttribute == "function" && (t = n.getAttribute("lang")), t;
|
|
1569
|
+
}
|
|
1570
|
+
}, Et = {
|
|
1571
|
+
name: "path",
|
|
1572
|
+
// Deconstruct the options object and extract the lookupFromPathIndex property
|
|
1573
|
+
lookup(s) {
|
|
1574
|
+
let {
|
|
1575
|
+
lookupFromPathIndex: e
|
|
1576
|
+
} = s;
|
|
1577
|
+
if (typeof window > "u") return;
|
|
1578
|
+
const t = window.location.pathname.match(/\/([a-zA-Z-]*)/g);
|
|
1579
|
+
return Array.isArray(t) ? t[typeof e == "number" ? e : 0]?.replace("/", "") : void 0;
|
|
1580
|
+
}
|
|
1581
|
+
}, Nt = {
|
|
1582
|
+
name: "subdomain",
|
|
1583
|
+
lookup(s) {
|
|
1584
|
+
let {
|
|
1585
|
+
lookupFromSubdomainIndex: e
|
|
1586
|
+
} = s;
|
|
1587
|
+
const t = typeof e == "number" ? e + 1 : 1, n = typeof window < "u" && window.location?.hostname?.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);
|
|
1588
|
+
if (n)
|
|
1589
|
+
return n[t];
|
|
1590
|
+
}
|
|
1591
|
+
};
|
|
1592
|
+
let Me = !1;
|
|
1593
|
+
try {
|
|
1594
|
+
document.cookie, Me = !0;
|
|
1595
|
+
} catch {
|
|
1596
|
+
}
|
|
1597
|
+
const Ve = ["querystring", "cookie", "localStorage", "sessionStorage", "navigator", "htmlTag"];
|
|
1598
|
+
Me || Ve.splice(1, 1);
|
|
1599
|
+
const Ft = () => ({
|
|
1600
|
+
order: Ve,
|
|
1601
|
+
lookupQuerystring: "lng",
|
|
1602
|
+
lookupCookie: "i18next",
|
|
1603
|
+
lookupLocalStorage: "i18nextLng",
|
|
1604
|
+
lookupSessionStorage: "i18nextLng",
|
|
1605
|
+
// cache user language
|
|
1606
|
+
caches: ["localStorage"],
|
|
1607
|
+
excludeCacheFor: ["cimode"],
|
|
1608
|
+
// cookieMinutes: 10,
|
|
1609
|
+
// cookieDomain: 'myDomain'
|
|
1610
|
+
convertDetectedLanguage: (s) => s
|
|
1611
|
+
});
|
|
1612
|
+
class qe {
|
|
1613
|
+
constructor(e) {
|
|
1614
|
+
let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
1615
|
+
this.type = "languageDetector", this.detectors = {}, this.init(e, t);
|
|
1616
|
+
}
|
|
1617
|
+
init() {
|
|
1618
|
+
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {
|
|
1619
|
+
languageUtils: {}
|
|
1620
|
+
}, t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
1621
|
+
this.services = e, this.options = vt(t, this.options || {}, Ft()), typeof this.options.convertDetectedLanguage == "string" && this.options.convertDetectedLanguage.indexOf("15897") > -1 && (this.options.convertDetectedLanguage = (i) => i.replace("-", "_")), this.options.lookupFromUrlIndex && (this.options.lookupFromPathIndex = this.options.lookupFromUrlIndex), this.i18nOptions = n, this.addDetector(Lt), this.addDetector(Pt), this.addDetector(Ct), this.addDetector(Rt), this.addDetector(jt), this.addDetector($t), this.addDetector(Et), this.addDetector(Nt), this.addDetector(kt);
|
|
1622
|
+
}
|
|
1623
|
+
addDetector(e) {
|
|
1624
|
+
return this.detectors[e.name] = e, this;
|
|
1625
|
+
}
|
|
1626
|
+
detect() {
|
|
1627
|
+
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.options.order, t = [];
|
|
1628
|
+
return e.forEach((n) => {
|
|
1629
|
+
if (this.detectors[n]) {
|
|
1630
|
+
let i = this.detectors[n].lookup(this.options);
|
|
1631
|
+
i && typeof i == "string" && (i = [i]), i && (t = t.concat(i));
|
|
1632
|
+
}
|
|
1633
|
+
}), t = t.filter((n) => n != null && !wt(n)).map((n) => this.options.convertDetectedLanguage(n)), this.services && this.services.languageUtils && this.services.languageUtils.getBestMatchFromCodes ? t : t.length > 0 ? t[0] : null;
|
|
1634
|
+
}
|
|
1635
|
+
cacheUserLanguage(e) {
|
|
1636
|
+
let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : this.options.caches;
|
|
1637
|
+
t && (this.options.excludeCacheFor && this.options.excludeCacheFor.indexOf(e) > -1 || t.forEach((n) => {
|
|
1638
|
+
this.detectors[n] && this.detectors[n].cacheUserLanguage(e, this.options);
|
|
1639
|
+
}));
|
|
1640
|
+
}
|
|
1641
|
+
}
|
|
1642
|
+
qe.type = "languageDetector";
|
|
1643
|
+
function ae(s) {
|
|
1644
|
+
"@babel/helpers - typeof";
|
|
1645
|
+
return ae = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
|
|
1646
|
+
return typeof e;
|
|
1647
|
+
} : function(e) {
|
|
1648
|
+
return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
|
|
1649
|
+
}, ae(s);
|
|
1650
|
+
}
|
|
1651
|
+
function ze() {
|
|
1652
|
+
return typeof XMLHttpRequest == "function" || (typeof XMLHttpRequest > "u" ? "undefined" : ae(XMLHttpRequest)) === "object";
|
|
1653
|
+
}
|
|
1654
|
+
function Tt(s) {
|
|
1655
|
+
return !!s && typeof s.then == "function";
|
|
1656
|
+
}
|
|
1657
|
+
function It(s) {
|
|
1658
|
+
return Tt(s) ? s : Promise.resolve(s);
|
|
1659
|
+
}
|
|
1660
|
+
function Ne(s, e) {
|
|
1661
|
+
var t = Object.keys(s);
|
|
1662
|
+
if (Object.getOwnPropertySymbols) {
|
|
1663
|
+
var n = Object.getOwnPropertySymbols(s);
|
|
1664
|
+
e && (n = n.filter(function(i) {
|
|
1665
|
+
return Object.getOwnPropertyDescriptor(s, i).enumerable;
|
|
1666
|
+
})), t.push.apply(t, n);
|
|
1667
|
+
}
|
|
1668
|
+
return t;
|
|
1669
|
+
}
|
|
1670
|
+
function Fe(s) {
|
|
1671
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
1672
|
+
var t = arguments[e] != null ? arguments[e] : {};
|
|
1673
|
+
e % 2 ? Ne(Object(t), !0).forEach(function(n) {
|
|
1674
|
+
Dt(s, n, t[n]);
|
|
1675
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(s, Object.getOwnPropertyDescriptors(t)) : Ne(Object(t)).forEach(function(n) {
|
|
1676
|
+
Object.defineProperty(s, n, Object.getOwnPropertyDescriptor(t, n));
|
|
1677
|
+
});
|
|
1678
|
+
}
|
|
1679
|
+
return s;
|
|
1680
|
+
}
|
|
1681
|
+
function Dt(s, e, t) {
|
|
1682
|
+
return (e = At(e)) in s ? Object.defineProperty(s, e, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : s[e] = t, s;
|
|
1683
|
+
}
|
|
1684
|
+
function At(s) {
|
|
1685
|
+
var e = Ht(s, "string");
|
|
1686
|
+
return T(e) == "symbol" ? e : e + "";
|
|
1687
|
+
}
|
|
1688
|
+
function Ht(s, e) {
|
|
1689
|
+
if (T(s) != "object" || !s) return s;
|
|
1690
|
+
var t = s[Symbol.toPrimitive];
|
|
1691
|
+
if (t !== void 0) {
|
|
1692
|
+
var n = t.call(s, e);
|
|
1693
|
+
if (T(n) != "object") return n;
|
|
1694
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1695
|
+
}
|
|
1696
|
+
return (e === "string" ? String : Number)(s);
|
|
1697
|
+
}
|
|
1698
|
+
function T(s) {
|
|
1699
|
+
"@babel/helpers - typeof";
|
|
1700
|
+
return T = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
|
|
1701
|
+
return typeof e;
|
|
1702
|
+
} : function(e) {
|
|
1703
|
+
return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
|
|
1704
|
+
}, T(s);
|
|
1705
|
+
}
|
|
1706
|
+
var E = typeof fetch == "function" ? fetch : void 0;
|
|
1707
|
+
typeof global < "u" && global.fetch ? E = global.fetch : typeof window < "u" && window.fetch && (E = window.fetch);
|
|
1708
|
+
var X;
|
|
1709
|
+
ze() && (typeof global < "u" && global.XMLHttpRequest ? X = global.XMLHttpRequest : typeof window < "u" && window.XMLHttpRequest && (X = window.XMLHttpRequest));
|
|
1710
|
+
var ee;
|
|
1711
|
+
typeof ActiveXObject == "function" && (typeof global < "u" && global.ActiveXObject ? ee = global.ActiveXObject : typeof window < "u" && window.ActiveXObject && (ee = window.ActiveXObject));
|
|
1712
|
+
typeof E != "function" && (E = void 0);
|
|
1713
|
+
if (!E && !X && !ee)
|
|
1714
|
+
try {
|
|
1715
|
+
import("./browser-ponyfill-B6W6hHVY.js").then((s) => s.b).then(function(s) {
|
|
1716
|
+
E = s.default;
|
|
1717
|
+
}).catch(function() {
|
|
1718
|
+
});
|
|
1719
|
+
} catch {
|
|
1720
|
+
}
|
|
1721
|
+
var le = function(e, t) {
|
|
1722
|
+
if (t && T(t) === "object") {
|
|
1723
|
+
var n = "";
|
|
1724
|
+
for (var i in t)
|
|
1725
|
+
n += "&" + encodeURIComponent(i) + "=" + encodeURIComponent(t[i]);
|
|
1726
|
+
if (!n) return e;
|
|
1727
|
+
e = e + (e.indexOf("?") !== -1 ? "&" : "?") + n.slice(1);
|
|
1728
|
+
}
|
|
1729
|
+
return e;
|
|
1730
|
+
}, Te = function(e, t, n, i) {
|
|
1731
|
+
var r = function(l) {
|
|
1732
|
+
if (!l.ok) return n(l.statusText || "Error", {
|
|
1733
|
+
status: l.status
|
|
1734
|
+
});
|
|
1735
|
+
l.text().then(function(u) {
|
|
1736
|
+
n(null, {
|
|
1737
|
+
status: l.status,
|
|
1738
|
+
data: u
|
|
1739
|
+
});
|
|
1740
|
+
}).catch(n);
|
|
1741
|
+
};
|
|
1742
|
+
if (i) {
|
|
1743
|
+
var o = i(e, t);
|
|
1744
|
+
if (o instanceof Promise) {
|
|
1745
|
+
o.then(r).catch(n);
|
|
1746
|
+
return;
|
|
1747
|
+
}
|
|
1748
|
+
}
|
|
1749
|
+
typeof fetch == "function" ? fetch(e, t).then(r).catch(n) : E(e, t).then(r).catch(n);
|
|
1750
|
+
}, Ie = !1, Kt = function(e, t, n, i) {
|
|
1751
|
+
e.queryStringParams && (t = le(t, e.queryStringParams));
|
|
1752
|
+
var r = Fe({}, typeof e.customHeaders == "function" ? e.customHeaders() : e.customHeaders);
|
|
1753
|
+
typeof window > "u" && typeof global < "u" && typeof global.process < "u" && global.process.versions && global.process.versions.node && (r["User-Agent"] = "i18next-http-backend (node/".concat(global.process.version, "; ").concat(global.process.platform, " ").concat(global.process.arch, ")")), n && (r["Content-Type"] = "application/json");
|
|
1754
|
+
var o = typeof e.requestOptions == "function" ? e.requestOptions(n) : e.requestOptions, a = Fe({
|
|
1755
|
+
method: n ? "POST" : "GET",
|
|
1756
|
+
body: n ? e.stringify(n) : void 0,
|
|
1757
|
+
headers: r
|
|
1758
|
+
}, Ie ? {} : o), l = typeof e.alternateFetch == "function" && e.alternateFetch.length >= 1 ? e.alternateFetch : void 0;
|
|
1759
|
+
try {
|
|
1760
|
+
Te(t, a, i, l);
|
|
1761
|
+
} catch (u) {
|
|
1762
|
+
if (!o || Object.keys(o).length === 0 || !u.message || u.message.indexOf("not implemented") < 0)
|
|
1763
|
+
return i(u);
|
|
1764
|
+
try {
|
|
1765
|
+
Object.keys(o).forEach(function(c) {
|
|
1766
|
+
delete a[c];
|
|
1767
|
+
}), Te(t, a, i, l), Ie = !0;
|
|
1768
|
+
} catch (c) {
|
|
1769
|
+
i(c);
|
|
1770
|
+
}
|
|
1771
|
+
}
|
|
1772
|
+
}, Ut = function(e, t, n, i) {
|
|
1773
|
+
n && T(n) === "object" && (n = le("", n).slice(1)), e.queryStringParams && (t = le(t, e.queryStringParams));
|
|
1774
|
+
try {
|
|
1775
|
+
var r = X ? new X() : new ee("MSXML2.XMLHTTP.3.0");
|
|
1776
|
+
r.open(n ? "POST" : "GET", t, 1), e.crossDomain || r.setRequestHeader("X-Requested-With", "XMLHttpRequest"), r.withCredentials = !!e.withCredentials, n && r.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"), r.overrideMimeType && r.overrideMimeType("application/json");
|
|
1777
|
+
var o = e.customHeaders;
|
|
1778
|
+
if (o = typeof o == "function" ? o() : o, o)
|
|
1779
|
+
for (var a in o)
|
|
1780
|
+
r.setRequestHeader(a, o[a]);
|
|
1781
|
+
r.onreadystatechange = function() {
|
|
1782
|
+
r.readyState > 3 && i(r.status >= 400 ? r.statusText : null, {
|
|
1783
|
+
status: r.status,
|
|
1784
|
+
data: r.responseText
|
|
1785
|
+
});
|
|
1786
|
+
}, r.send(n);
|
|
1787
|
+
} catch (l) {
|
|
1788
|
+
console && console.log(l);
|
|
1789
|
+
}
|
|
1790
|
+
}, Mt = function(e, t, n, i) {
|
|
1791
|
+
if (typeof n == "function" && (i = n, n = void 0), i = i || function() {
|
|
1792
|
+
}, E && t.indexOf("file:") !== 0)
|
|
1793
|
+
return Kt(e, t, n, i);
|
|
1794
|
+
if (ze() || typeof ActiveXObject == "function")
|
|
1795
|
+
return Ut(e, t, n, i);
|
|
1796
|
+
i(new Error("No fetch and no xhr implementation found!"));
|
|
1797
|
+
};
|
|
1798
|
+
function U(s) {
|
|
1799
|
+
"@babel/helpers - typeof";
|
|
1800
|
+
return U = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
|
|
1801
|
+
return typeof e;
|
|
1802
|
+
} : function(e) {
|
|
1803
|
+
return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
|
|
1804
|
+
}, U(s);
|
|
1805
|
+
}
|
|
1806
|
+
function De(s, e) {
|
|
1807
|
+
var t = Object.keys(s);
|
|
1808
|
+
if (Object.getOwnPropertySymbols) {
|
|
1809
|
+
var n = Object.getOwnPropertySymbols(s);
|
|
1810
|
+
e && (n = n.filter(function(i) {
|
|
1811
|
+
return Object.getOwnPropertyDescriptor(s, i).enumerable;
|
|
1812
|
+
})), t.push.apply(t, n);
|
|
1813
|
+
}
|
|
1814
|
+
return t;
|
|
1815
|
+
}
|
|
1816
|
+
function se(s) {
|
|
1817
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
1818
|
+
var t = arguments[e] != null ? arguments[e] : {};
|
|
1819
|
+
e % 2 ? De(Object(t), !0).forEach(function(n) {
|
|
1820
|
+
_e(s, n, t[n]);
|
|
1821
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(s, Object.getOwnPropertyDescriptors(t)) : De(Object(t)).forEach(function(n) {
|
|
1822
|
+
Object.defineProperty(s, n, Object.getOwnPropertyDescriptor(t, n));
|
|
1823
|
+
});
|
|
1824
|
+
}
|
|
1825
|
+
return s;
|
|
1826
|
+
}
|
|
1827
|
+
function Vt(s, e) {
|
|
1828
|
+
if (!(s instanceof e)) throw new TypeError("Cannot call a class as a function");
|
|
1829
|
+
}
|
|
1830
|
+
function qt(s, e) {
|
|
1831
|
+
for (var t = 0; t < e.length; t++) {
|
|
1832
|
+
var n = e[t];
|
|
1833
|
+
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(s, Be(n.key), n);
|
|
1834
|
+
}
|
|
1835
|
+
}
|
|
1836
|
+
function zt(s, e, t) {
|
|
1837
|
+
return e && qt(s.prototype, e), Object.defineProperty(s, "prototype", { writable: !1 }), s;
|
|
1838
|
+
}
|
|
1839
|
+
function _e(s, e, t) {
|
|
1840
|
+
return (e = Be(e)) in s ? Object.defineProperty(s, e, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : s[e] = t, s;
|
|
1841
|
+
}
|
|
1842
|
+
function Be(s) {
|
|
1843
|
+
var e = _t(s, "string");
|
|
1844
|
+
return U(e) == "symbol" ? e : e + "";
|
|
1845
|
+
}
|
|
1846
|
+
function _t(s, e) {
|
|
1847
|
+
if (U(s) != "object" || !s) return s;
|
|
1848
|
+
var t = s[Symbol.toPrimitive];
|
|
1849
|
+
if (t !== void 0) {
|
|
1850
|
+
var n = t.call(s, e);
|
|
1851
|
+
if (U(n) != "object") return n;
|
|
1852
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1853
|
+
}
|
|
1854
|
+
return String(s);
|
|
1855
|
+
}
|
|
1856
|
+
var Bt = function() {
|
|
1857
|
+
return {
|
|
1858
|
+
loadPath: "/locales/{{lng}}/{{ns}}.json",
|
|
1859
|
+
addPath: "/locales/add/{{lng}}/{{ns}}",
|
|
1860
|
+
parse: function(t) {
|
|
1861
|
+
return JSON.parse(t);
|
|
1862
|
+
},
|
|
1863
|
+
stringify: JSON.stringify,
|
|
1864
|
+
parsePayload: function(t, n, i) {
|
|
1865
|
+
return _e({}, n, i || "");
|
|
1866
|
+
},
|
|
1867
|
+
parseLoadPayload: function(t, n) {
|
|
1868
|
+
},
|
|
1869
|
+
request: Mt,
|
|
1870
|
+
reloadInterval: typeof window < "u" ? !1 : 3600 * 1e3,
|
|
1871
|
+
customHeaders: {},
|
|
1872
|
+
queryStringParams: {},
|
|
1873
|
+
crossDomain: !1,
|
|
1874
|
+
withCredentials: !1,
|
|
1875
|
+
overrideMimeType: !1,
|
|
1876
|
+
requestOptions: {
|
|
1877
|
+
mode: "cors",
|
|
1878
|
+
credentials: "same-origin",
|
|
1879
|
+
cache: "default"
|
|
1880
|
+
}
|
|
1881
|
+
};
|
|
1882
|
+
}, Xe = (function() {
|
|
1883
|
+
function s(e) {
|
|
1884
|
+
var t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
1885
|
+
Vt(this, s), this.services = e, this.options = t, this.allOptions = n, this.type = "backend", this.init(e, t, n);
|
|
1886
|
+
}
|
|
1887
|
+
return zt(s, [{
|
|
1888
|
+
key: "init",
|
|
1889
|
+
value: function(t) {
|
|
1890
|
+
var n = this, i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
1891
|
+
if (this.services = t, this.options = se(se(se({}, Bt()), this.options || {}), i), this.allOptions = r, this.services && this.options.reloadInterval) {
|
|
1892
|
+
var o = setInterval(function() {
|
|
1893
|
+
return n.reload();
|
|
1894
|
+
}, this.options.reloadInterval);
|
|
1895
|
+
U(o) === "object" && typeof o.unref == "function" && o.unref();
|
|
1896
|
+
}
|
|
1897
|
+
}
|
|
1898
|
+
}, {
|
|
1899
|
+
key: "readMulti",
|
|
1900
|
+
value: function(t, n, i) {
|
|
1901
|
+
this._readAny(t, t, n, n, i);
|
|
1902
|
+
}
|
|
1903
|
+
}, {
|
|
1904
|
+
key: "read",
|
|
1905
|
+
value: function(t, n, i) {
|
|
1906
|
+
this._readAny([t], t, [n], n, i);
|
|
1907
|
+
}
|
|
1908
|
+
}, {
|
|
1909
|
+
key: "_readAny",
|
|
1910
|
+
value: function(t, n, i, r, o) {
|
|
1911
|
+
var a = this, l = this.options.loadPath;
|
|
1912
|
+
typeof this.options.loadPath == "function" && (l = this.options.loadPath(t, i)), l = It(l), l.then(function(u) {
|
|
1913
|
+
if (!u) return o(null, {});
|
|
1914
|
+
var c = a.services.interpolator.interpolate(u, {
|
|
1915
|
+
lng: t.join("+"),
|
|
1916
|
+
ns: i.join("+")
|
|
1917
|
+
});
|
|
1918
|
+
a.loadUrl(c, o, n, r);
|
|
1919
|
+
});
|
|
1920
|
+
}
|
|
1921
|
+
}, {
|
|
1922
|
+
key: "loadUrl",
|
|
1923
|
+
value: function(t, n, i, r) {
|
|
1924
|
+
var o = this, a = typeof i == "string" ? [i] : i, l = typeof r == "string" ? [r] : r, u = this.options.parseLoadPayload(a, l);
|
|
1925
|
+
this.options.request(this.options, t, u, function(c, f) {
|
|
1926
|
+
if (f && (f.status >= 500 && f.status < 600 || !f.status)) return n("failed loading " + t + "; status code: " + f.status, !0);
|
|
1927
|
+
if (f && f.status >= 400 && f.status < 500) return n("failed loading " + t + "; status code: " + f.status, !1);
|
|
1928
|
+
if (!f && c && c.message) {
|
|
1929
|
+
var p = c.message.toLowerCase(), d = ["failed", "fetch", "network", "load"].find(function(y) {
|
|
1930
|
+
return p.indexOf(y) > -1;
|
|
1931
|
+
});
|
|
1932
|
+
if (d)
|
|
1933
|
+
return n("failed loading " + t + ": " + c.message, !0);
|
|
1934
|
+
}
|
|
1935
|
+
if (c) return n(c, !1);
|
|
1936
|
+
var h, m;
|
|
1937
|
+
try {
|
|
1938
|
+
typeof f.data == "string" ? h = o.options.parse(f.data, i, r) : h = f.data;
|
|
1939
|
+
} catch {
|
|
1940
|
+
m = "failed parsing " + t + " to json";
|
|
1941
|
+
}
|
|
1942
|
+
if (m) return n(m, !1);
|
|
1943
|
+
n(null, h);
|
|
1944
|
+
});
|
|
1945
|
+
}
|
|
1946
|
+
}, {
|
|
1947
|
+
key: "create",
|
|
1948
|
+
value: function(t, n, i, r, o) {
|
|
1949
|
+
var a = this;
|
|
1950
|
+
if (this.options.addPath) {
|
|
1951
|
+
typeof t == "string" && (t = [t]);
|
|
1952
|
+
var l = this.options.parsePayload(n, i, r), u = 0, c = [], f = [];
|
|
1953
|
+
t.forEach(function(p) {
|
|
1954
|
+
var d = a.options.addPath;
|
|
1955
|
+
typeof a.options.addPath == "function" && (d = a.options.addPath(p, n));
|
|
1956
|
+
var h = a.services.interpolator.interpolate(d, {
|
|
1957
|
+
lng: p,
|
|
1958
|
+
ns: n
|
|
1959
|
+
});
|
|
1960
|
+
a.options.request(a.options, h, l, function(m, y) {
|
|
1961
|
+
u += 1, c.push(m), f.push(y), u === t.length && typeof o == "function" && o(c, f);
|
|
1962
|
+
});
|
|
1963
|
+
});
|
|
1964
|
+
}
|
|
1965
|
+
}
|
|
1966
|
+
}, {
|
|
1967
|
+
key: "reload",
|
|
1968
|
+
value: function() {
|
|
1969
|
+
var t = this, n = this.services, i = n.backendConnector, r = n.languageUtils, o = n.logger, a = i.language;
|
|
1970
|
+
if (!(a && a.toLowerCase() === "cimode")) {
|
|
1971
|
+
var l = [], u = function(f) {
|
|
1972
|
+
var p = r.toResolveHierarchy(f);
|
|
1973
|
+
p.forEach(function(d) {
|
|
1974
|
+
l.indexOf(d) < 0 && l.push(d);
|
|
1975
|
+
});
|
|
1976
|
+
};
|
|
1977
|
+
u(a), this.allOptions.preload && this.allOptions.preload.forEach(function(c) {
|
|
1978
|
+
return u(c);
|
|
1979
|
+
}), l.forEach(function(c) {
|
|
1980
|
+
t.allOptions.ns.forEach(function(f) {
|
|
1981
|
+
i.read(c, f, "read", null, null, function(p, d) {
|
|
1982
|
+
p && o.warn("loading namespace ".concat(f, " for language ").concat(c, " failed"), p), !p && d && o.log("loaded namespace ".concat(f, " for language ").concat(c), d), i.loaded("".concat(c, "|").concat(f), p, d);
|
|
1983
|
+
});
|
|
1984
|
+
});
|
|
1985
|
+
});
|
|
1986
|
+
}
|
|
1987
|
+
}
|
|
1988
|
+
}]);
|
|
1989
|
+
})();
|
|
1990
|
+
Xe.type = "backend";
|
|
1991
|
+
const Je = [
|
|
1992
|
+
"en",
|
|
1993
|
+
"en-DG",
|
|
1994
|
+
"es",
|
|
1995
|
+
"es-ES",
|
|
1996
|
+
"sr",
|
|
1997
|
+
"sr-Latn",
|
|
1998
|
+
"fr",
|
|
1999
|
+
"pt-BR",
|
|
2000
|
+
"pt",
|
|
2001
|
+
"bn",
|
|
2002
|
+
"zh",
|
|
2003
|
+
"hi",
|
|
2004
|
+
"id",
|
|
2005
|
+
"ms",
|
|
2006
|
+
"tr",
|
|
2007
|
+
"vi",
|
|
2008
|
+
"ht",
|
|
2009
|
+
"it",
|
|
2010
|
+
"de",
|
|
2011
|
+
"nl",
|
|
2012
|
+
"tl-PH",
|
|
2013
|
+
"pl",
|
|
2014
|
+
"hu",
|
|
2015
|
+
"ro",
|
|
2016
|
+
"hmn",
|
|
2017
|
+
"so",
|
|
2018
|
+
"ca",
|
|
2019
|
+
"af-ZA",
|
|
2020
|
+
"ar",
|
|
2021
|
+
"ar-EG",
|
|
2022
|
+
"ar-AE",
|
|
2023
|
+
"zh-CN",
|
|
2024
|
+
"zh-TW",
|
|
2025
|
+
"zh-HANT",
|
|
2026
|
+
"cs-CZ",
|
|
2027
|
+
"da-DK",
|
|
2028
|
+
"fi-FI",
|
|
2029
|
+
"fr-CA",
|
|
2030
|
+
"el-GR",
|
|
2031
|
+
"he",
|
|
2032
|
+
"ja",
|
|
2033
|
+
"ja-JP",
|
|
2034
|
+
"ko-KP",
|
|
2035
|
+
"nb-NO",
|
|
2036
|
+
"fa-IR",
|
|
2037
|
+
"pt-PT",
|
|
2038
|
+
"ru-RU",
|
|
2039
|
+
"sr-YU",
|
|
2040
|
+
"es-419",
|
|
2041
|
+
"es-MX",
|
|
2042
|
+
"sv-SE",
|
|
2043
|
+
"th-TH",
|
|
2044
|
+
"uk-UA",
|
|
2045
|
+
"am",
|
|
2046
|
+
"az",
|
|
2047
|
+
"bs",
|
|
2048
|
+
"my",
|
|
2049
|
+
"ceb",
|
|
2050
|
+
"cs",
|
|
2051
|
+
"et",
|
|
2052
|
+
"ka",
|
|
2053
|
+
"el",
|
|
2054
|
+
"jv",
|
|
2055
|
+
"kk",
|
|
2056
|
+
"km",
|
|
2057
|
+
"ko",
|
|
2058
|
+
"ky",
|
|
2059
|
+
"lo",
|
|
2060
|
+
"lv",
|
|
2061
|
+
"lt",
|
|
2062
|
+
"mk",
|
|
2063
|
+
"mn",
|
|
2064
|
+
"ne",
|
|
2065
|
+
"ru",
|
|
2066
|
+
"sk",
|
|
2067
|
+
"sl",
|
|
2068
|
+
"sw",
|
|
2069
|
+
"tl",
|
|
2070
|
+
"th",
|
|
2071
|
+
"uk",
|
|
2072
|
+
"ur",
|
|
2073
|
+
"uz",
|
|
2074
|
+
"hr"
|
|
2075
|
+
], Xt = (s) => {
|
|
2076
|
+
const e = s.replace(/([A-Z])/g, " $1");
|
|
2077
|
+
return e.charAt(0).toUpperCase() + e.slice(1);
|
|
2078
|
+
}, Jt = (s) => {
|
|
2079
|
+
const e = s.split("."), t = e[e.length - 1];
|
|
2080
|
+
return Xt(t || "missing key");
|
|
2081
|
+
}, We = new qe();
|
|
2082
|
+
We.addDetector({
|
|
2083
|
+
name: "navigatorOnlyLanguage",
|
|
2084
|
+
lookup() {
|
|
2085
|
+
if (typeof navigator > "u")
|
|
2086
|
+
return "en";
|
|
2087
|
+
const s = navigator.language;
|
|
2088
|
+
return Je.includes(s) ? s : s.split("-")[0];
|
|
2089
|
+
}
|
|
2090
|
+
});
|
|
2091
|
+
const Wt = "https://api.i18nexus.com/project_resources/translations/{{lng}}/{{ns}}.json?api_key=cg41dUINoxdp8BaHDQLJhA";
|
|
2092
|
+
function Ae(s, e) {
|
|
2093
|
+
for (const [t, n] of Object.entries(e))
|
|
2094
|
+
n && s.addResourceBundle(t, "default", n, !0, !0);
|
|
2095
|
+
}
|
|
2096
|
+
function Qt(s = {}) {
|
|
2097
|
+
const { lang: e, translations: t } = s, n = b.createInstance();
|
|
2098
|
+
return n.use(Xe).use(We).init({
|
|
2099
|
+
lng: e,
|
|
2100
|
+
fallbackLng: "en",
|
|
2101
|
+
supportedLngs: Je,
|
|
2102
|
+
ns: ["default"],
|
|
2103
|
+
defaultNS: "default",
|
|
2104
|
+
partialBundledLanguages: !0,
|
|
2105
|
+
keySeparator: ".",
|
|
2106
|
+
interpolation: {
|
|
2107
|
+
escapeValue: !1
|
|
2108
|
+
},
|
|
2109
|
+
backend: {
|
|
2110
|
+
loadPath: Wt
|
|
2111
|
+
},
|
|
2112
|
+
detection: {
|
|
2113
|
+
order: [
|
|
2114
|
+
"querystring",
|
|
2115
|
+
"cookie",
|
|
2116
|
+
"localStorage",
|
|
2117
|
+
"sessionStorage",
|
|
2118
|
+
"navigatorOnlyLanguage",
|
|
2119
|
+
"htmlTag",
|
|
2120
|
+
"path",
|
|
2121
|
+
"subdomain"
|
|
2122
|
+
],
|
|
2123
|
+
lookupQuerystring: "lang"
|
|
2124
|
+
},
|
|
2125
|
+
initImmediate: !1,
|
|
2126
|
+
parseMissingKeyHandler: Jt
|
|
2127
|
+
}), t && (Ae(n, t), n.on("loaded", () => {
|
|
2128
|
+
Ae(n, t);
|
|
2129
|
+
})), n;
|
|
2130
|
+
}
|
|
2131
|
+
let Q = null;
|
|
2132
|
+
function en(s) {
|
|
2133
|
+
Q = s;
|
|
2134
|
+
}
|
|
2135
|
+
function Gt() {
|
|
2136
|
+
return Q || (Q = Qt()), Q;
|
|
2137
|
+
}
|
|
2138
|
+
function tn() {
|
|
2139
|
+
const s = Gt(), [, e] = he(0), [t, n] = he(s.isInitialized);
|
|
2140
|
+
return Ye(() => {
|
|
2141
|
+
const i = () => {
|
|
2142
|
+
e((o) => o + 1);
|
|
2143
|
+
}, r = () => {
|
|
2144
|
+
n(!0), e((o) => o + 1);
|
|
2145
|
+
};
|
|
2146
|
+
return s.on("languageChanged", i), s.on("initialized", r), s.on("loaded", i), () => {
|
|
2147
|
+
s.off("languageChanged", i), s.off("initialized", r), s.off("loaded", i);
|
|
2148
|
+
};
|
|
2149
|
+
}, [s]), {
|
|
2150
|
+
t: s.t.bind(s),
|
|
2151
|
+
ready: t,
|
|
2152
|
+
i18n: s
|
|
2153
|
+
};
|
|
2154
|
+
}
|
|
2155
|
+
const nn = ({ children: s, className: e }) => /* @__PURE__ */ Ze("h2", { class: `IncodeTitle ${e ?? ""}`, children: s });
|
|
2156
|
+
export {
|
|
2157
|
+
nn as T,
|
|
2158
|
+
Qt as c,
|
|
2159
|
+
en as s,
|
|
2160
|
+
tn as u
|
|
2161
|
+
};
|