mp-front-cli 0.0.54 → 0.0.56
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/core/utils/api-request/fetch-service-be.d.ts +5 -3
- package/dist/core/utils/api-request/fetch-service-be.d.ts.map +1 -1
- package/dist/core/utils/custom-adapter.d.ts +15 -0
- package/dist/core/utils/custom-adapter.d.ts.map +1 -0
- package/dist/core/utils/custom-cache.d.ts +2 -6
- package/dist/core/utils/custom-cache.d.ts.map +1 -1
- package/dist/core/utils/custom-encrypter.d.ts.map +1 -1
- package/dist/core/utils/custom-redis.d.ts +4 -0
- package/dist/core/utils/custom-redis.d.ts.map +1 -0
- package/dist/{custom-header-eeb04e28.js → custom-header-3ba5652e.js} +94 -94
- package/dist/custom-redis-bee66564.js +11 -0
- package/dist/mp-front-cli-adapter.es.js +174 -0
- package/dist/mp-front-cli-all.es.js +16 -13
- package/dist/mp-front-cli-cache.es.js +38 -47
- package/dist/mp-front-cli-core.es.js +232 -1659
- package/dist/mp-front-cli-encoder.es.js +3704 -3
- package/dist/mp-front-cli-encrypter.es.js +51 -4
- package/dist/mp-front-cli-header.es.js +5 -4
- package/dist/stringify-788d71a0.js +9 -0
- package/package.json +11 -9
- package/dist/custom-encoder-05d6a9f1.js +0 -3712
- package/dist/custom-encrypter-1573699a.js +0 -20317
|
@@ -1,1569 +1,28 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { C as
|
|
5
|
-
import { S as ht } from "./custom-header-
|
|
6
|
-
import { MessageHandler as
|
|
7
|
-
import { RxSubjectManager as
|
|
8
|
-
import { t as
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
1
|
+
var I = Object.defineProperty;
|
|
2
|
+
var L = (s, r, t) => r in s ? I(s, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[r] = t;
|
|
3
|
+
var g = (s, r, t) => (L(s, typeof r != "symbol" ? r + "" : r, t), t);
|
|
4
|
+
import { C as M, f as y } from "./custom-header-3ba5652e.js";
|
|
5
|
+
import { S as ht } from "./custom-header-3ba5652e.js";
|
|
6
|
+
import { MessageHandler as A, LoadingHandler as p } from "./mp-front-cli-utils-rxjs.es.js";
|
|
7
|
+
import { RxSubjectManager as pt } from "./mp-front-cli-utils-rxjs.es.js";
|
|
8
|
+
import P, { t as E } from "i18next";
|
|
9
|
+
import { t as v } from "./index-df4e0539.js";
|
|
10
|
+
import { CustomLogger as J } from "./mp-front-cli-logger.es.js";
|
|
11
|
+
import { of as d, switchMap as m, forkJoin as O, catchError as D, EMPTY as N, filter as $ } from "rxjs";
|
|
12
|
+
import { CustomEncrypter as H } from "./mp-front-cli-encrypter.es.js";
|
|
13
|
+
import { CustomEncoder as T } from "./mp-front-cli-encoder.es.js";
|
|
14
|
+
import { u as j } from "./stringify-788d71a0.js";
|
|
15
|
+
import "node-jose";
|
|
13
16
|
import "crypto";
|
|
14
|
-
const
|
|
15
|
-
type: "logger",
|
|
16
|
-
log(i) {
|
|
17
|
-
this.output("log", i);
|
|
18
|
-
},
|
|
19
|
-
warn(i) {
|
|
20
|
-
this.output("warn", i);
|
|
21
|
-
},
|
|
22
|
-
error(i) {
|
|
23
|
-
this.output("error", i);
|
|
24
|
-
},
|
|
25
|
-
output(i, e) {
|
|
26
|
-
console && console[i] && console[i].apply(console, e);
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
class z {
|
|
30
|
-
constructor(e) {
|
|
31
|
-
let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
32
|
-
this.init(e, t);
|
|
33
|
-
}
|
|
34
|
-
init(e) {
|
|
35
|
-
let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
36
|
-
this.prefix = t.prefix || "i18next:", this.logger = e || Ee, this.options = t, this.debug = t.debug;
|
|
37
|
-
}
|
|
38
|
-
log() {
|
|
39
|
-
for (var e = arguments.length, t = new Array(e), s = 0; s < e; s++)
|
|
40
|
-
t[s] = arguments[s];
|
|
41
|
-
return this.forward(t, "log", "", !0);
|
|
42
|
-
}
|
|
43
|
-
warn() {
|
|
44
|
-
for (var e = arguments.length, t = new Array(e), s = 0; s < e; s++)
|
|
45
|
-
t[s] = arguments[s];
|
|
46
|
-
return this.forward(t, "warn", "", !0);
|
|
47
|
-
}
|
|
48
|
-
error() {
|
|
49
|
-
for (var e = arguments.length, t = new Array(e), s = 0; s < e; s++)
|
|
50
|
-
t[s] = arguments[s];
|
|
51
|
-
return this.forward(t, "error", "");
|
|
52
|
-
}
|
|
53
|
-
deprecate() {
|
|
54
|
-
for (var e = arguments.length, t = new Array(e), s = 0; s < e; s++)
|
|
55
|
-
t[s] = arguments[s];
|
|
56
|
-
return this.forward(t, "warn", "WARNING DEPRECATED: ", !0);
|
|
57
|
-
}
|
|
58
|
-
forward(e, t, s, n) {
|
|
59
|
-
return n && !this.debug ? null : (typeof e[0] == "string" && (e[0] = `${s}${this.prefix} ${e[0]}`), this.logger[t](e));
|
|
60
|
-
}
|
|
61
|
-
create(e) {
|
|
62
|
-
return new z(this.logger, {
|
|
63
|
-
prefix: `${this.prefix}:${e}:`,
|
|
64
|
-
...this.options
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
clone(e) {
|
|
68
|
-
return e = e || this.options, e.prefix = e.prefix || this.prefix, new z(this.logger, e);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
var P = new z();
|
|
72
|
-
class Q {
|
|
73
|
-
constructor() {
|
|
74
|
-
this.observers = {};
|
|
75
|
-
}
|
|
76
|
-
on(e, t) {
|
|
77
|
-
return e.split(" ").forEach((s) => {
|
|
78
|
-
this.observers[s] = this.observers[s] || [], this.observers[s].push(t);
|
|
79
|
-
}), this;
|
|
80
|
-
}
|
|
81
|
-
off(e, t) {
|
|
82
|
-
if (this.observers[e]) {
|
|
83
|
-
if (!t) {
|
|
84
|
-
delete this.observers[e];
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
this.observers[e] = this.observers[e].filter((s) => s !== t);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
emit(e) {
|
|
91
|
-
for (var t = arguments.length, s = new Array(t > 1 ? t - 1 : 0), n = 1; n < t; n++)
|
|
92
|
-
s[n - 1] = arguments[n];
|
|
93
|
-
this.observers[e] && [].concat(this.observers[e]).forEach((a) => {
|
|
94
|
-
a(...s);
|
|
95
|
-
}), this.observers["*"] && [].concat(this.observers["*"]).forEach((a) => {
|
|
96
|
-
a.apply(a, [e, ...s]);
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
function U() {
|
|
101
|
-
let i, e;
|
|
102
|
-
const t = new Promise((s, n) => {
|
|
103
|
-
i = s, e = n;
|
|
104
|
-
});
|
|
105
|
-
return t.resolve = i, t.reject = e, t;
|
|
106
|
-
}
|
|
107
|
-
function ae(i) {
|
|
108
|
-
return i == null ? "" : "" + i;
|
|
109
|
-
}
|
|
110
|
-
function je(i, e, t) {
|
|
111
|
-
i.forEach((s) => {
|
|
112
|
-
e[s] && (t[s] = e[s]);
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
function q(i, e, t) {
|
|
116
|
-
function s(a) {
|
|
117
|
-
return a && a.indexOf("###") > -1 ? a.replace(/###/g, ".") : a;
|
|
118
|
-
}
|
|
119
|
-
function n() {
|
|
120
|
-
return !i || typeof i == "string";
|
|
121
|
-
}
|
|
122
|
-
const r = typeof e != "string" ? [].concat(e) : e.split(".");
|
|
123
|
-
for (; r.length > 1; ) {
|
|
124
|
-
if (n())
|
|
125
|
-
return {};
|
|
126
|
-
const a = s(r.shift());
|
|
127
|
-
!i[a] && t && (i[a] = new t()), Object.prototype.hasOwnProperty.call(i, a) ? i = i[a] : i = {};
|
|
128
|
-
}
|
|
129
|
-
return n() ? {} : {
|
|
130
|
-
obj: i,
|
|
131
|
-
k: s(r.shift())
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
|
-
function oe(i, e, t) {
|
|
135
|
-
const {
|
|
136
|
-
obj: s,
|
|
137
|
-
k: n
|
|
138
|
-
} = q(i, e, Object);
|
|
139
|
-
s[n] = t;
|
|
140
|
-
}
|
|
141
|
-
function ke(i, e, t, s) {
|
|
142
|
-
const {
|
|
143
|
-
obj: n,
|
|
144
|
-
k: r
|
|
145
|
-
} = q(i, e, Object);
|
|
146
|
-
n[r] = n[r] || [], s && (n[r] = n[r].concat(t)), s || n[r].push(t);
|
|
147
|
-
}
|
|
148
|
-
function W(i, e) {
|
|
149
|
-
const {
|
|
150
|
-
obj: t,
|
|
151
|
-
k: s
|
|
152
|
-
} = q(i, e);
|
|
153
|
-
if (t)
|
|
154
|
-
return t[s];
|
|
155
|
-
}
|
|
156
|
-
function Fe(i, e, t) {
|
|
157
|
-
const s = W(i, t);
|
|
158
|
-
return s !== void 0 ? s : W(e, t);
|
|
159
|
-
}
|
|
160
|
-
function xe(i, e, t) {
|
|
161
|
-
for (const s in e)
|
|
162
|
-
s !== "__proto__" && s !== "constructor" && (s in i ? typeof i[s] == "string" || i[s] instanceof String || typeof e[s] == "string" || e[s] instanceof String ? t && (i[s] = e[s]) : xe(i[s], e[s], t) : i[s] = e[s]);
|
|
163
|
-
return i;
|
|
164
|
-
}
|
|
165
|
-
function j(i) {
|
|
166
|
-
return i.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
|
|
167
|
-
}
|
|
168
|
-
var Ae = {
|
|
169
|
-
"&": "&",
|
|
170
|
-
"<": "<",
|
|
171
|
-
">": ">",
|
|
172
|
-
'"': """,
|
|
173
|
-
"'": "'",
|
|
174
|
-
"/": "/"
|
|
175
|
-
};
|
|
176
|
-
function De(i) {
|
|
177
|
-
return typeof i == "string" ? i.replace(/[&<>"'\/]/g, (e) => Ae[e]) : i;
|
|
178
|
-
}
|
|
179
|
-
const Ie = [" ", ",", "?", "!", ";"];
|
|
180
|
-
function Ue(i, e, t) {
|
|
181
|
-
e = e || "", t = t || "";
|
|
182
|
-
const s = Ie.filter((a) => e.indexOf(a) < 0 && t.indexOf(a) < 0);
|
|
183
|
-
if (s.length === 0)
|
|
184
|
-
return !0;
|
|
185
|
-
const n = new RegExp(`(${s.map((a) => a === "?" ? "\\?" : a).join("|")})`);
|
|
186
|
-
let r = !n.test(i);
|
|
187
|
-
if (!r) {
|
|
188
|
-
const a = i.indexOf(t);
|
|
189
|
-
a > 0 && !n.test(i.substring(0, a)) && (r = !0);
|
|
190
|
-
}
|
|
191
|
-
return r;
|
|
192
|
-
}
|
|
193
|
-
function Y(i, e) {
|
|
194
|
-
let t = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : ".";
|
|
195
|
-
if (!i)
|
|
196
|
-
return;
|
|
197
|
-
if (i[e])
|
|
198
|
-
return i[e];
|
|
199
|
-
const s = e.split(t);
|
|
200
|
-
let n = i;
|
|
201
|
-
for (let r = 0; r < s.length; ++r) {
|
|
202
|
-
if (!n || typeof n[s[r]] == "string" && r + 1 < s.length)
|
|
203
|
-
return;
|
|
204
|
-
if (n[s[r]] === void 0) {
|
|
205
|
-
let a = 2, l = s.slice(r, r + a).join(t), o = n[l];
|
|
206
|
-
for (; o === void 0 && s.length > r + a; )
|
|
207
|
-
a++, l = s.slice(r, r + a).join(t), o = n[l];
|
|
208
|
-
if (o === void 0)
|
|
209
|
-
return;
|
|
210
|
-
if (o === null)
|
|
211
|
-
return null;
|
|
212
|
-
if (e.endsWith(l)) {
|
|
213
|
-
if (typeof o == "string")
|
|
214
|
-
return o;
|
|
215
|
-
if (l && typeof o[l] == "string")
|
|
216
|
-
return o[l];
|
|
217
|
-
}
|
|
218
|
-
const f = s.slice(r + a).join(t);
|
|
219
|
-
return f ? Y(o, f, t) : void 0;
|
|
220
|
-
}
|
|
221
|
-
n = n[s[r]];
|
|
222
|
-
}
|
|
223
|
-
return n;
|
|
224
|
-
}
|
|
225
|
-
function G(i) {
|
|
226
|
-
return i && i.indexOf("_") > 0 ? i.replace("_", "-") : i;
|
|
227
|
-
}
|
|
228
|
-
class le extends Q {
|
|
229
|
-
constructor(e) {
|
|
230
|
-
let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
|
|
231
|
-
ns: ["translation"],
|
|
232
|
-
defaultNS: "translation"
|
|
233
|
-
};
|
|
234
|
-
super(), this.data = e || {}, this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.options.ignoreJSONStructure === void 0 && (this.options.ignoreJSONStructure = !0);
|
|
235
|
-
}
|
|
236
|
-
addNamespaces(e) {
|
|
237
|
-
this.options.ns.indexOf(e) < 0 && this.options.ns.push(e);
|
|
238
|
-
}
|
|
239
|
-
removeNamespaces(e) {
|
|
240
|
-
const t = this.options.ns.indexOf(e);
|
|
241
|
-
t > -1 && this.options.ns.splice(t, 1);
|
|
242
|
-
}
|
|
243
|
-
getResource(e, t, s) {
|
|
244
|
-
let n = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
|
|
245
|
-
const r = n.keySeparator !== void 0 ? n.keySeparator : this.options.keySeparator, a = n.ignoreJSONStructure !== void 0 ? n.ignoreJSONStructure : this.options.ignoreJSONStructure;
|
|
246
|
-
let l = [e, t];
|
|
247
|
-
s && typeof s != "string" && (l = l.concat(s)), s && typeof s == "string" && (l = l.concat(r ? s.split(r) : s)), e.indexOf(".") > -1 && (l = e.split("."));
|
|
248
|
-
const o = W(this.data, l);
|
|
249
|
-
return o || !a || typeof s != "string" ? o : Y(this.data && this.data[e] && this.data[e][t], s, r);
|
|
250
|
-
}
|
|
251
|
-
addResource(e, t, s, n) {
|
|
252
|
-
let r = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : {
|
|
253
|
-
silent: !1
|
|
254
|
-
};
|
|
255
|
-
const a = r.keySeparator !== void 0 ? r.keySeparator : this.options.keySeparator;
|
|
256
|
-
let l = [e, t];
|
|
257
|
-
s && (l = l.concat(a ? s.split(a) : s)), e.indexOf(".") > -1 && (l = e.split("."), n = t, t = l[1]), this.addNamespaces(t), oe(this.data, l, n), r.silent || this.emit("added", e, t, s, n);
|
|
258
|
-
}
|
|
259
|
-
addResources(e, t, s) {
|
|
260
|
-
let n = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {
|
|
261
|
-
silent: !1
|
|
262
|
-
};
|
|
263
|
-
for (const r in s)
|
|
264
|
-
(typeof s[r] == "string" || Object.prototype.toString.apply(s[r]) === "[object Array]") && this.addResource(e, t, r, s[r], {
|
|
265
|
-
silent: !0
|
|
266
|
-
});
|
|
267
|
-
n.silent || this.emit("added", e, t, s);
|
|
268
|
-
}
|
|
269
|
-
addResourceBundle(e, t, s, n, r) {
|
|
270
|
-
let a = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : {
|
|
271
|
-
silent: !1
|
|
272
|
-
}, l = [e, t];
|
|
273
|
-
e.indexOf(".") > -1 && (l = e.split("."), n = s, s = t, t = l[1]), this.addNamespaces(t);
|
|
274
|
-
let o = W(this.data, l) || {};
|
|
275
|
-
n ? xe(o, s, r) : o = {
|
|
276
|
-
...o,
|
|
277
|
-
...s
|
|
278
|
-
}, oe(this.data, l, o), a.silent || this.emit("added", e, t, s);
|
|
279
|
-
}
|
|
280
|
-
removeResourceBundle(e, t) {
|
|
281
|
-
this.hasResourceBundle(e, t) && delete this.data[e][t], this.removeNamespaces(t), this.emit("removed", e, t);
|
|
282
|
-
}
|
|
283
|
-
hasResourceBundle(e, t) {
|
|
284
|
-
return this.getResource(e, t) !== void 0;
|
|
285
|
-
}
|
|
286
|
-
getResourceBundle(e, t) {
|
|
287
|
-
return t || (t = this.options.defaultNS), this.options.compatibilityAPI === "v1" ? {
|
|
288
|
-
...this.getResource(e, t)
|
|
289
|
-
} : this.getResource(e, t);
|
|
290
|
-
}
|
|
291
|
-
getDataByLanguage(e) {
|
|
292
|
-
return this.data[e];
|
|
293
|
-
}
|
|
294
|
-
hasLanguageSomeTranslations(e) {
|
|
295
|
-
const t = this.getDataByLanguage(e);
|
|
296
|
-
return !!(t && Object.keys(t) || []).find((n) => t[n] && Object.keys(t[n]).length > 0);
|
|
297
|
-
}
|
|
298
|
-
toJSON() {
|
|
299
|
-
return this.data;
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
var Se = {
|
|
303
|
-
processors: {},
|
|
304
|
-
addPostProcessor(i) {
|
|
305
|
-
this.processors[i.name] = i;
|
|
306
|
-
},
|
|
307
|
-
handle(i, e, t, s, n) {
|
|
308
|
-
return i.forEach((r) => {
|
|
309
|
-
this.processors[r] && (e = this.processors[r].process(e, t, s, n));
|
|
310
|
-
}), e;
|
|
311
|
-
}
|
|
312
|
-
};
|
|
313
|
-
const ue = {};
|
|
314
|
-
class Z extends Q {
|
|
315
|
-
constructor(e) {
|
|
316
|
-
let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
317
|
-
super(), je(["resourceStore", "languageUtils", "pluralResolver", "interpolator", "backendConnector", "i18nFormat", "utils"], e, this), this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.logger = P.create("translator");
|
|
318
|
-
}
|
|
319
|
-
changeLanguage(e) {
|
|
320
|
-
e && (this.language = e);
|
|
321
|
-
}
|
|
322
|
-
exists(e) {
|
|
323
|
-
let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
|
|
324
|
-
interpolation: {}
|
|
325
|
-
};
|
|
326
|
-
if (e == null)
|
|
327
|
-
return !1;
|
|
328
|
-
const s = this.resolve(e, t);
|
|
329
|
-
return s && s.res !== void 0;
|
|
330
|
-
}
|
|
331
|
-
extractFromKey(e, t) {
|
|
332
|
-
let s = t.nsSeparator !== void 0 ? t.nsSeparator : this.options.nsSeparator;
|
|
333
|
-
s === void 0 && (s = ":");
|
|
334
|
-
const n = t.keySeparator !== void 0 ? t.keySeparator : this.options.keySeparator;
|
|
335
|
-
let r = t.ns || this.options.defaultNS || [];
|
|
336
|
-
const a = s && e.indexOf(s) > -1, l = !this.options.userDefinedKeySeparator && !t.keySeparator && !this.options.userDefinedNsSeparator && !t.nsSeparator && !Ue(e, s, n);
|
|
337
|
-
if (a && !l) {
|
|
338
|
-
const o = e.match(this.interpolator.nestingRegexp);
|
|
339
|
-
if (o && o.length > 0)
|
|
340
|
-
return {
|
|
341
|
-
key: e,
|
|
342
|
-
namespaces: r
|
|
343
|
-
};
|
|
344
|
-
const f = e.split(s);
|
|
345
|
-
(s !== n || s === n && this.options.ns.indexOf(f[0]) > -1) && (r = f.shift()), e = f.join(n);
|
|
346
|
-
}
|
|
347
|
-
return typeof r == "string" && (r = [r]), {
|
|
348
|
-
key: e,
|
|
349
|
-
namespaces: r
|
|
350
|
-
};
|
|
351
|
-
}
|
|
352
|
-
translate(e, t, s) {
|
|
353
|
-
if (typeof t != "object" && this.options.overloadTranslationOptionHandler && (t = this.options.overloadTranslationOptionHandler(arguments)), typeof t == "object" && (t = {
|
|
354
|
-
...t
|
|
355
|
-
}), t || (t = {}), e == null)
|
|
356
|
-
return "";
|
|
357
|
-
Array.isArray(e) || (e = [String(e)]);
|
|
358
|
-
const n = t.returnDetails !== void 0 ? t.returnDetails : this.options.returnDetails, r = t.keySeparator !== void 0 ? t.keySeparator : this.options.keySeparator, {
|
|
359
|
-
key: a,
|
|
360
|
-
namespaces: l
|
|
361
|
-
} = this.extractFromKey(e[e.length - 1], t), o = l[l.length - 1], f = t.lng || this.language, g = t.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;
|
|
362
|
-
if (f && f.toLowerCase() === "cimode") {
|
|
363
|
-
if (g) {
|
|
364
|
-
const y = t.nsSeparator || this.options.nsSeparator;
|
|
365
|
-
return n ? {
|
|
366
|
-
res: `${o}${y}${a}`,
|
|
367
|
-
usedKey: a,
|
|
368
|
-
exactUsedKey: a,
|
|
369
|
-
usedLng: f,
|
|
370
|
-
usedNS: o,
|
|
371
|
-
usedParams: this.getUsedParamsDetails(t)
|
|
372
|
-
} : `${o}${y}${a}`;
|
|
373
|
-
}
|
|
374
|
-
return n ? {
|
|
375
|
-
res: a,
|
|
376
|
-
usedKey: a,
|
|
377
|
-
exactUsedKey: a,
|
|
378
|
-
usedLng: f,
|
|
379
|
-
usedNS: o,
|
|
380
|
-
usedParams: this.getUsedParamsDetails(t)
|
|
381
|
-
} : a;
|
|
382
|
-
}
|
|
383
|
-
const h = this.resolve(e, t);
|
|
384
|
-
let u = h && h.res;
|
|
385
|
-
const d = h && h.usedKey || a, c = h && h.exactUsedKey || a, p = Object.prototype.toString.apply(u), m = ["[object Number]", "[object Function]", "[object RegExp]"], L = t.joinArrays !== void 0 ? t.joinArrays : this.options.joinArrays, x = !this.i18nFormat || this.i18nFormat.handleAsObject;
|
|
386
|
-
if (x && u && (typeof u != "string" && typeof u != "boolean" && typeof u != "number") && m.indexOf(p) < 0 && !(typeof L == "string" && p === "[object Array]")) {
|
|
387
|
-
if (!t.returnObjects && !this.options.returnObjects) {
|
|
388
|
-
this.options.returnedObjectHandler || this.logger.warn("accessing an object - but returnObjects options is not enabled!");
|
|
389
|
-
const y = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(d, u, {
|
|
390
|
-
...t,
|
|
391
|
-
ns: l
|
|
392
|
-
}) : `key '${a} (${this.language})' returned an object instead of string.`;
|
|
393
|
-
return n ? (h.res = y, h.usedParams = this.getUsedParamsDetails(t), h) : y;
|
|
394
|
-
}
|
|
395
|
-
if (r) {
|
|
396
|
-
const y = p === "[object Array]", O = y ? [] : {}, R = y ? c : d;
|
|
397
|
-
for (const S in u)
|
|
398
|
-
if (Object.prototype.hasOwnProperty.call(u, S)) {
|
|
399
|
-
const K = `${R}${r}${S}`;
|
|
400
|
-
O[S] = this.translate(K, {
|
|
401
|
-
...t,
|
|
402
|
-
joinArrays: !1,
|
|
403
|
-
ns: l
|
|
404
|
-
}), O[S] === K && (O[S] = u[S]);
|
|
405
|
-
}
|
|
406
|
-
u = O;
|
|
407
|
-
}
|
|
408
|
-
} else if (x && typeof L == "string" && p === "[object Array]")
|
|
409
|
-
u = u.join(L), u && (u = this.extendTranslation(u, e, t, s));
|
|
410
|
-
else {
|
|
411
|
-
let y = !1, O = !1;
|
|
412
|
-
const R = t.count !== void 0 && typeof t.count != "string", S = Z.hasDefaultValue(t), K = R ? this.pluralResolver.getSuffix(f, t.count, t) : "", Le = t.ordinal && R ? this.pluralResolver.getSuffix(f, t.count, {
|
|
413
|
-
ordinal: !1
|
|
414
|
-
}) : "", ee = R && !t.ordinal && t.count === 0 && this.pluralResolver.shouldUseIntlApi(), F = ee && t[`defaultValue${this.options.pluralSeparator}zero`] || t[`defaultValue${K}`] || t[`defaultValue${Le}`] || t.defaultValue;
|
|
415
|
-
!this.isValidLookup(u) && S && (y = !0, u = F), this.isValidLookup(u) || (O = !0, u = a);
|
|
416
|
-
const Oe = (t.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && O ? void 0 : u, A = S && F !== u && this.options.updateMissing;
|
|
417
|
-
if (O || y || A) {
|
|
418
|
-
if (this.logger.log(A ? "updateKey" : "missingKey", f, o, a, A ? F : u), r) {
|
|
419
|
-
const v = this.resolve(a, {
|
|
420
|
-
...t,
|
|
421
|
-
keySeparator: !1
|
|
422
|
-
});
|
|
423
|
-
v && v.res && this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.");
|
|
424
|
-
}
|
|
425
|
-
let D = [];
|
|
426
|
-
const B = this.languageUtils.getFallbackCodes(this.options.fallbackLng, t.lng || this.language);
|
|
427
|
-
if (this.options.saveMissingTo === "fallback" && B && B[0])
|
|
428
|
-
for (let v = 0; v < B.length; v++)
|
|
429
|
-
D.push(B[v]);
|
|
430
|
-
else
|
|
431
|
-
this.options.saveMissingTo === "all" ? D = this.languageUtils.toResolveHierarchy(t.lng || this.language) : D.push(t.lng || this.language);
|
|
432
|
-
const te = (v, E, I) => {
|
|
433
|
-
const se = S && I !== u ? I : Oe;
|
|
434
|
-
this.options.missingKeyHandler ? this.options.missingKeyHandler(v, o, E, se, A, t) : this.backendConnector && this.backendConnector.saveMissing && this.backendConnector.saveMissing(v, o, E, se, A, t), this.emit("missingKey", v, o, E, u);
|
|
435
|
-
};
|
|
436
|
-
this.options.saveMissing && (this.options.saveMissingPlurals && R ? D.forEach((v) => {
|
|
437
|
-
const E = this.pluralResolver.getSuffixes(v, t);
|
|
438
|
-
ee && t[`defaultValue${this.options.pluralSeparator}zero`] && E.indexOf(`${this.options.pluralSeparator}zero`) < 0 && E.push(`${this.options.pluralSeparator}zero`), E.forEach((I) => {
|
|
439
|
-
te([v], a + I, t[`defaultValue${I}`] || F);
|
|
440
|
-
});
|
|
441
|
-
}) : te(D, a, F));
|
|
442
|
-
}
|
|
443
|
-
u = this.extendTranslation(u, e, t, h, s), O && u === a && this.options.appendNamespaceToMissingKey && (u = `${o}:${a}`), (O || y) && this.options.parseMissingKeyHandler && (this.options.compatibilityAPI !== "v1" ? u = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${o}:${a}` : a, y ? u : void 0) : u = this.options.parseMissingKeyHandler(u));
|
|
444
|
-
}
|
|
445
|
-
return n ? (h.res = u, h.usedParams = this.getUsedParamsDetails(t), h) : u;
|
|
446
|
-
}
|
|
447
|
-
extendTranslation(e, t, s, n, r) {
|
|
448
|
-
var a = this;
|
|
449
|
-
if (this.i18nFormat && this.i18nFormat.parse)
|
|
450
|
-
e = this.i18nFormat.parse(e, {
|
|
451
|
-
...this.options.interpolation.defaultVariables,
|
|
452
|
-
...s
|
|
453
|
-
}, s.lng || this.language || n.usedLng, n.usedNS, n.usedKey, {
|
|
454
|
-
resolved: n
|
|
455
|
-
});
|
|
456
|
-
else if (!s.skipInterpolation) {
|
|
457
|
-
s.interpolation && this.interpolator.init({
|
|
458
|
-
...s,
|
|
459
|
-
interpolation: {
|
|
460
|
-
...this.options.interpolation,
|
|
461
|
-
...s.interpolation
|
|
462
|
-
}
|
|
463
|
-
});
|
|
464
|
-
const f = typeof e == "string" && (s && s.interpolation && s.interpolation.skipOnVariables !== void 0 ? s.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables);
|
|
465
|
-
let g;
|
|
466
|
-
if (f) {
|
|
467
|
-
const u = e.match(this.interpolator.nestingRegexp);
|
|
468
|
-
g = u && u.length;
|
|
469
|
-
}
|
|
470
|
-
let h = s.replace && typeof s.replace != "string" ? s.replace : s;
|
|
471
|
-
if (this.options.interpolation.defaultVariables && (h = {
|
|
472
|
-
...this.options.interpolation.defaultVariables,
|
|
473
|
-
...h
|
|
474
|
-
}), e = this.interpolator.interpolate(e, h, s.lng || this.language, s), f) {
|
|
475
|
-
const u = e.match(this.interpolator.nestingRegexp), d = u && u.length;
|
|
476
|
-
g < d && (s.nest = !1);
|
|
477
|
-
}
|
|
478
|
-
!s.lng && this.options.compatibilityAPI !== "v1" && n && n.res && (s.lng = n.usedLng), s.nest !== !1 && (e = this.interpolator.nest(e, function() {
|
|
479
|
-
for (var u = arguments.length, d = new Array(u), c = 0; c < u; c++)
|
|
480
|
-
d[c] = arguments[c];
|
|
481
|
-
return r && r[0] === d[0] && !s.context ? (a.logger.warn(`It seems you are nesting recursively key: ${d[0]} in key: ${t[0]}`), null) : a.translate(...d, t);
|
|
482
|
-
}, s)), s.interpolation && this.interpolator.reset();
|
|
483
|
-
}
|
|
484
|
-
const l = s.postProcess || this.options.postProcess, o = typeof l == "string" ? [l] : l;
|
|
485
|
-
return e != null && o && o.length && s.applyPostProcessor !== !1 && (e = Se.handle(o, e, t, this.options && this.options.postProcessPassResolved ? {
|
|
486
|
-
i18nResolved: {
|
|
487
|
-
...n,
|
|
488
|
-
usedParams: this.getUsedParamsDetails(s)
|
|
489
|
-
},
|
|
490
|
-
...s
|
|
491
|
-
} : s, this)), e;
|
|
492
|
-
}
|
|
493
|
-
resolve(e) {
|
|
494
|
-
let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, s, n, r, a, l;
|
|
495
|
-
return typeof e == "string" && (e = [e]), e.forEach((o) => {
|
|
496
|
-
if (this.isValidLookup(s))
|
|
497
|
-
return;
|
|
498
|
-
const f = this.extractFromKey(o, t), g = f.key;
|
|
499
|
-
n = g;
|
|
500
|
-
let h = f.namespaces;
|
|
501
|
-
this.options.fallbackNS && (h = h.concat(this.options.fallbackNS));
|
|
502
|
-
const u = t.count !== void 0 && typeof t.count != "string", d = u && !t.ordinal && t.count === 0 && this.pluralResolver.shouldUseIntlApi(), c = t.context !== void 0 && (typeof t.context == "string" || typeof t.context == "number") && t.context !== "", p = t.lngs ? t.lngs : this.languageUtils.toResolveHierarchy(t.lng || this.language, t.fallbackLng);
|
|
503
|
-
h.forEach((m) => {
|
|
504
|
-
this.isValidLookup(s) || (l = m, !ue[`${p[0]}-${m}`] && this.utils && this.utils.hasLoadedNamespace && !this.utils.hasLoadedNamespace(l) && (ue[`${p[0]}-${m}`] = !0, this.logger.warn(`key "${n}" for languages "${p.join(", ")}" won't get resolved as namespace "${l}" was not yet loaded`, "This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")), p.forEach((L) => {
|
|
505
|
-
if (this.isValidLookup(s))
|
|
506
|
-
return;
|
|
507
|
-
a = L;
|
|
508
|
-
const x = [g];
|
|
509
|
-
if (this.i18nFormat && this.i18nFormat.addLookupKeys)
|
|
510
|
-
this.i18nFormat.addLookupKeys(x, g, L, m, t);
|
|
511
|
-
else {
|
|
512
|
-
let y;
|
|
513
|
-
u && (y = this.pluralResolver.getSuffix(L, t.count, t));
|
|
514
|
-
const O = `${this.options.pluralSeparator}zero`, R = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;
|
|
515
|
-
if (u && (x.push(g + y), t.ordinal && y.indexOf(R) === 0 && x.push(g + y.replace(R, this.options.pluralSeparator)), d && x.push(g + O)), c) {
|
|
516
|
-
const S = `${g}${this.options.contextSeparator}${t.context}`;
|
|
517
|
-
x.push(S), u && (x.push(S + y), t.ordinal && y.indexOf(R) === 0 && x.push(S + y.replace(R, this.options.pluralSeparator)), d && x.push(S + O));
|
|
518
|
-
}
|
|
519
|
-
}
|
|
520
|
-
let V;
|
|
521
|
-
for (; V = x.pop(); )
|
|
522
|
-
this.isValidLookup(s) || (r = V, s = this.getResource(L, m, V, t));
|
|
523
|
-
}));
|
|
524
|
-
});
|
|
525
|
-
}), {
|
|
526
|
-
res: s,
|
|
527
|
-
usedKey: n,
|
|
528
|
-
exactUsedKey: r,
|
|
529
|
-
usedLng: a,
|
|
530
|
-
usedNS: l
|
|
531
|
-
};
|
|
532
|
-
}
|
|
533
|
-
isValidLookup(e) {
|
|
534
|
-
return e !== void 0 && !(!this.options.returnNull && e === null) && !(!this.options.returnEmptyString && e === "");
|
|
535
|
-
}
|
|
536
|
-
getResource(e, t, s) {
|
|
537
|
-
let n = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
|
|
538
|
-
return this.i18nFormat && this.i18nFormat.getResource ? this.i18nFormat.getResource(e, t, s, n) : this.resourceStore.getResource(e, t, s, n);
|
|
539
|
-
}
|
|
540
|
-
getUsedParamsDetails() {
|
|
541
|
-
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
542
|
-
const t = ["defaultValue", "ordinal", "context", "replace", "lng", "lngs", "fallbackLng", "ns", "keySeparator", "nsSeparator", "returnObjects", "returnDetails", "joinArrays", "postProcess", "interpolation"], s = e.replace && typeof e.replace != "string";
|
|
543
|
-
let n = s ? e.replace : e;
|
|
544
|
-
if (s && typeof e.count < "u" && (n.count = e.count), this.options.interpolation.defaultVariables && (n = {
|
|
545
|
-
...this.options.interpolation.defaultVariables,
|
|
546
|
-
...n
|
|
547
|
-
}), !s) {
|
|
548
|
-
n = {
|
|
549
|
-
...n
|
|
550
|
-
};
|
|
551
|
-
for (const r of t)
|
|
552
|
-
delete n[r];
|
|
553
|
-
}
|
|
554
|
-
return n;
|
|
555
|
-
}
|
|
556
|
-
static hasDefaultValue(e) {
|
|
557
|
-
const t = "defaultValue";
|
|
558
|
-
for (const s in e)
|
|
559
|
-
if (Object.prototype.hasOwnProperty.call(e, s) && t === s.substring(0, t.length) && e[s] !== void 0)
|
|
560
|
-
return !0;
|
|
561
|
-
return !1;
|
|
562
|
-
}
|
|
563
|
-
}
|
|
564
|
-
function X(i) {
|
|
565
|
-
return i.charAt(0).toUpperCase() + i.slice(1);
|
|
566
|
-
}
|
|
567
|
-
class fe {
|
|
568
|
-
constructor(e) {
|
|
569
|
-
this.options = e, this.supportedLngs = this.options.supportedLngs || !1, this.logger = P.create("languageUtils");
|
|
570
|
-
}
|
|
571
|
-
getScriptPartFromCode(e) {
|
|
572
|
-
if (e = G(e), !e || e.indexOf("-") < 0)
|
|
573
|
-
return null;
|
|
574
|
-
const t = e.split("-");
|
|
575
|
-
return t.length === 2 || (t.pop(), t[t.length - 1].toLowerCase() === "x") ? null : this.formatLanguageCode(t.join("-"));
|
|
576
|
-
}
|
|
577
|
-
getLanguagePartFromCode(e) {
|
|
578
|
-
if (e = G(e), !e || e.indexOf("-") < 0)
|
|
579
|
-
return e;
|
|
580
|
-
const t = e.split("-");
|
|
581
|
-
return this.formatLanguageCode(t[0]);
|
|
582
|
-
}
|
|
583
|
-
formatLanguageCode(e) {
|
|
584
|
-
if (typeof e == "string" && e.indexOf("-") > -1) {
|
|
585
|
-
const t = ["hans", "hant", "latn", "cyrl", "cans", "mong", "arab"];
|
|
586
|
-
let s = e.split("-");
|
|
587
|
-
return this.options.lowerCaseLng ? s = s.map((n) => n.toLowerCase()) : s.length === 2 ? (s[0] = s[0].toLowerCase(), s[1] = s[1].toUpperCase(), t.indexOf(s[1].toLowerCase()) > -1 && (s[1] = X(s[1].toLowerCase()))) : s.length === 3 && (s[0] = s[0].toLowerCase(), s[1].length === 2 && (s[1] = s[1].toUpperCase()), s[0] !== "sgn" && s[2].length === 2 && (s[2] = s[2].toUpperCase()), t.indexOf(s[1].toLowerCase()) > -1 && (s[1] = X(s[1].toLowerCase())), t.indexOf(s[2].toLowerCase()) > -1 && (s[2] = X(s[2].toLowerCase()))), s.join("-");
|
|
588
|
-
}
|
|
589
|
-
return this.options.cleanCode || this.options.lowerCaseLng ? e.toLowerCase() : e;
|
|
590
|
-
}
|
|
591
|
-
isSupportedCode(e) {
|
|
592
|
-
return (this.options.load === "languageOnly" || this.options.nonExplicitSupportedLngs) && (e = this.getLanguagePartFromCode(e)), !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.indexOf(e) > -1;
|
|
593
|
-
}
|
|
594
|
-
getBestMatchFromCodes(e) {
|
|
595
|
-
if (!e)
|
|
596
|
-
return null;
|
|
597
|
-
let t;
|
|
598
|
-
return e.forEach((s) => {
|
|
599
|
-
if (t)
|
|
600
|
-
return;
|
|
601
|
-
const n = this.formatLanguageCode(s);
|
|
602
|
-
(!this.options.supportedLngs || this.isSupportedCode(n)) && (t = n);
|
|
603
|
-
}), !t && this.options.supportedLngs && e.forEach((s) => {
|
|
604
|
-
if (t)
|
|
605
|
-
return;
|
|
606
|
-
const n = this.getLanguagePartFromCode(s);
|
|
607
|
-
if (this.isSupportedCode(n))
|
|
608
|
-
return t = n;
|
|
609
|
-
t = this.options.supportedLngs.find((r) => {
|
|
610
|
-
if (r === n)
|
|
611
|
-
return r;
|
|
612
|
-
if (!(r.indexOf("-") < 0 && n.indexOf("-") < 0) && r.indexOf(n) === 0)
|
|
613
|
-
return r;
|
|
614
|
-
});
|
|
615
|
-
}), t || (t = this.getFallbackCodes(this.options.fallbackLng)[0]), t;
|
|
616
|
-
}
|
|
617
|
-
getFallbackCodes(e, t) {
|
|
618
|
-
if (!e)
|
|
619
|
-
return [];
|
|
620
|
-
if (typeof e == "function" && (e = e(t)), typeof e == "string" && (e = [e]), Object.prototype.toString.apply(e) === "[object Array]")
|
|
621
|
-
return e;
|
|
622
|
-
if (!t)
|
|
623
|
-
return e.default || [];
|
|
624
|
-
let s = e[t];
|
|
625
|
-
return s || (s = e[this.getScriptPartFromCode(t)]), s || (s = e[this.formatLanguageCode(t)]), s || (s = e[this.getLanguagePartFromCode(t)]), s || (s = e.default), s || [];
|
|
626
|
-
}
|
|
627
|
-
toResolveHierarchy(e, t) {
|
|
628
|
-
const s = this.getFallbackCodes(t || this.options.fallbackLng || [], e), n = [], r = (a) => {
|
|
629
|
-
a && (this.isSupportedCode(a) ? n.push(a) : this.logger.warn(`rejecting language code not found in supportedLngs: ${a}`));
|
|
630
|
-
};
|
|
631
|
-
return typeof e == "string" && (e.indexOf("-") > -1 || e.indexOf("_") > -1) ? (this.options.load !== "languageOnly" && r(this.formatLanguageCode(e)), this.options.load !== "languageOnly" && this.options.load !== "currentOnly" && r(this.getScriptPartFromCode(e)), this.options.load !== "currentOnly" && r(this.getLanguagePartFromCode(e))) : typeof e == "string" && r(this.formatLanguageCode(e)), s.forEach((a) => {
|
|
632
|
-
n.indexOf(a) < 0 && r(this.formatLanguageCode(a));
|
|
633
|
-
}), n;
|
|
634
|
-
}
|
|
635
|
-
}
|
|
636
|
-
let Te = [{
|
|
637
|
-
lngs: ["ach", "ak", "am", "arn", "br", "fil", "gun", "ln", "mfe", "mg", "mi", "oc", "pt", "pt-BR", "tg", "tl", "ti", "tr", "uz", "wa"],
|
|
638
|
-
nr: [1, 2],
|
|
639
|
-
fc: 1
|
|
640
|
-
}, {
|
|
641
|
-
lngs: ["af", "an", "ast", "az", "bg", "bn", "ca", "da", "de", "dev", "el", "en", "eo", "es", "et", "eu", "fi", "fo", "fur", "fy", "gl", "gu", "ha", "hi", "hu", "hy", "ia", "it", "kk", "kn", "ku", "lb", "mai", "ml", "mn", "mr", "nah", "nap", "nb", "ne", "nl", "nn", "no", "nso", "pa", "pap", "pms", "ps", "pt-PT", "rm", "sco", "se", "si", "so", "son", "sq", "sv", "sw", "ta", "te", "tk", "ur", "yo"],
|
|
642
|
-
nr: [1, 2],
|
|
643
|
-
fc: 2
|
|
644
|
-
}, {
|
|
645
|
-
lngs: ["ay", "bo", "cgg", "fa", "ht", "id", "ja", "jbo", "ka", "km", "ko", "ky", "lo", "ms", "sah", "su", "th", "tt", "ug", "vi", "wo", "zh"],
|
|
646
|
-
nr: [1],
|
|
647
|
-
fc: 3
|
|
648
|
-
}, {
|
|
649
|
-
lngs: ["be", "bs", "cnr", "dz", "hr", "ru", "sr", "uk"],
|
|
650
|
-
nr: [1, 2, 5],
|
|
651
|
-
fc: 4
|
|
652
|
-
}, {
|
|
653
|
-
lngs: ["ar"],
|
|
654
|
-
nr: [0, 1, 2, 3, 11, 100],
|
|
655
|
-
fc: 5
|
|
656
|
-
}, {
|
|
657
|
-
lngs: ["cs", "sk"],
|
|
658
|
-
nr: [1, 2, 5],
|
|
659
|
-
fc: 6
|
|
660
|
-
}, {
|
|
661
|
-
lngs: ["csb", "pl"],
|
|
662
|
-
nr: [1, 2, 5],
|
|
663
|
-
fc: 7
|
|
664
|
-
}, {
|
|
665
|
-
lngs: ["cy"],
|
|
666
|
-
nr: [1, 2, 3, 8],
|
|
667
|
-
fc: 8
|
|
668
|
-
}, {
|
|
669
|
-
lngs: ["fr"],
|
|
670
|
-
nr: [1, 2],
|
|
671
|
-
fc: 9
|
|
672
|
-
}, {
|
|
673
|
-
lngs: ["ga"],
|
|
674
|
-
nr: [1, 2, 3, 7, 11],
|
|
675
|
-
fc: 10
|
|
676
|
-
}, {
|
|
677
|
-
lngs: ["gd"],
|
|
678
|
-
nr: [1, 2, 3, 20],
|
|
679
|
-
fc: 11
|
|
680
|
-
}, {
|
|
681
|
-
lngs: ["is"],
|
|
682
|
-
nr: [1, 2],
|
|
683
|
-
fc: 12
|
|
684
|
-
}, {
|
|
685
|
-
lngs: ["jv"],
|
|
686
|
-
nr: [0, 1],
|
|
687
|
-
fc: 13
|
|
688
|
-
}, {
|
|
689
|
-
lngs: ["kw"],
|
|
690
|
-
nr: [1, 2, 3, 4],
|
|
691
|
-
fc: 14
|
|
692
|
-
}, {
|
|
693
|
-
lngs: ["lt"],
|
|
694
|
-
nr: [1, 2, 10],
|
|
695
|
-
fc: 15
|
|
696
|
-
}, {
|
|
697
|
-
lngs: ["lv"],
|
|
698
|
-
nr: [1, 2, 0],
|
|
699
|
-
fc: 16
|
|
700
|
-
}, {
|
|
701
|
-
lngs: ["mk"],
|
|
702
|
-
nr: [1, 2],
|
|
703
|
-
fc: 17
|
|
704
|
-
}, {
|
|
705
|
-
lngs: ["mnk"],
|
|
706
|
-
nr: [0, 1, 2],
|
|
707
|
-
fc: 18
|
|
708
|
-
}, {
|
|
709
|
-
lngs: ["mt"],
|
|
710
|
-
nr: [1, 2, 11, 20],
|
|
711
|
-
fc: 19
|
|
712
|
-
}, {
|
|
713
|
-
lngs: ["or"],
|
|
714
|
-
nr: [2, 1],
|
|
715
|
-
fc: 2
|
|
716
|
-
}, {
|
|
717
|
-
lngs: ["ro"],
|
|
718
|
-
nr: [1, 2, 20],
|
|
719
|
-
fc: 20
|
|
720
|
-
}, {
|
|
721
|
-
lngs: ["sl"],
|
|
722
|
-
nr: [5, 1, 2, 3],
|
|
723
|
-
fc: 21
|
|
724
|
-
}, {
|
|
725
|
-
lngs: ["he", "iw"],
|
|
726
|
-
nr: [1, 2, 20, 21],
|
|
727
|
-
fc: 22
|
|
728
|
-
}], Ve = {
|
|
729
|
-
1: function(i) {
|
|
730
|
-
return +(i > 1);
|
|
731
|
-
},
|
|
732
|
-
2: function(i) {
|
|
733
|
-
return +(i != 1);
|
|
734
|
-
},
|
|
735
|
-
3: function(i) {
|
|
736
|
-
return 0;
|
|
737
|
-
},
|
|
738
|
-
4: function(i) {
|
|
739
|
-
return i % 10 == 1 && i % 100 != 11 ? 0 : i % 10 >= 2 && i % 10 <= 4 && (i % 100 < 10 || i % 100 >= 20) ? 1 : 2;
|
|
740
|
-
},
|
|
741
|
-
5: function(i) {
|
|
742
|
-
return i == 0 ? 0 : i == 1 ? 1 : i == 2 ? 2 : i % 100 >= 3 && i % 100 <= 10 ? 3 : i % 100 >= 11 ? 4 : 5;
|
|
743
|
-
},
|
|
744
|
-
6: function(i) {
|
|
745
|
-
return i == 1 ? 0 : i >= 2 && i <= 4 ? 1 : 2;
|
|
746
|
-
},
|
|
747
|
-
7: function(i) {
|
|
748
|
-
return i == 1 ? 0 : i % 10 >= 2 && i % 10 <= 4 && (i % 100 < 10 || i % 100 >= 20) ? 1 : 2;
|
|
749
|
-
},
|
|
750
|
-
8: function(i) {
|
|
751
|
-
return i == 1 ? 0 : i == 2 ? 1 : i != 8 && i != 11 ? 2 : 3;
|
|
752
|
-
},
|
|
753
|
-
9: function(i) {
|
|
754
|
-
return +(i >= 2);
|
|
755
|
-
},
|
|
756
|
-
10: function(i) {
|
|
757
|
-
return i == 1 ? 0 : i == 2 ? 1 : i < 7 ? 2 : i < 11 ? 3 : 4;
|
|
758
|
-
},
|
|
759
|
-
11: function(i) {
|
|
760
|
-
return i == 1 || i == 11 ? 0 : i == 2 || i == 12 ? 1 : i > 2 && i < 20 ? 2 : 3;
|
|
761
|
-
},
|
|
762
|
-
12: function(i) {
|
|
763
|
-
return +(i % 10 != 1 || i % 100 == 11);
|
|
764
|
-
},
|
|
765
|
-
13: function(i) {
|
|
766
|
-
return +(i !== 0);
|
|
767
|
-
},
|
|
768
|
-
14: function(i) {
|
|
769
|
-
return i == 1 ? 0 : i == 2 ? 1 : i == 3 ? 2 : 3;
|
|
770
|
-
},
|
|
771
|
-
15: function(i) {
|
|
772
|
-
return i % 10 == 1 && i % 100 != 11 ? 0 : i % 10 >= 2 && (i % 100 < 10 || i % 100 >= 20) ? 1 : 2;
|
|
773
|
-
},
|
|
774
|
-
16: function(i) {
|
|
775
|
-
return i % 10 == 1 && i % 100 != 11 ? 0 : i !== 0 ? 1 : 2;
|
|
776
|
-
},
|
|
777
|
-
17: function(i) {
|
|
778
|
-
return i == 1 || i % 10 == 1 && i % 100 != 11 ? 0 : 1;
|
|
779
|
-
},
|
|
780
|
-
18: function(i) {
|
|
781
|
-
return i == 0 ? 0 : i == 1 ? 1 : 2;
|
|
782
|
-
},
|
|
783
|
-
19: function(i) {
|
|
784
|
-
return i == 1 ? 0 : i == 0 || i % 100 > 1 && i % 100 < 11 ? 1 : i % 100 > 10 && i % 100 < 20 ? 2 : 3;
|
|
785
|
-
},
|
|
786
|
-
20: function(i) {
|
|
787
|
-
return i == 1 ? 0 : i == 0 || i % 100 > 0 && i % 100 < 20 ? 1 : 2;
|
|
788
|
-
},
|
|
789
|
-
21: function(i) {
|
|
790
|
-
return i % 100 == 1 ? 1 : i % 100 == 2 ? 2 : i % 100 == 3 || i % 100 == 4 ? 3 : 0;
|
|
791
|
-
},
|
|
792
|
-
22: function(i) {
|
|
793
|
-
return i == 1 ? 0 : i == 2 ? 1 : (i < 0 || i > 10) && i % 10 == 0 ? 2 : 3;
|
|
794
|
-
}
|
|
795
|
-
};
|
|
796
|
-
const Ke = ["v1", "v2", "v3"], Be = ["v4"], ge = {
|
|
797
|
-
zero: 0,
|
|
798
|
-
one: 1,
|
|
799
|
-
two: 2,
|
|
800
|
-
few: 3,
|
|
801
|
-
many: 4,
|
|
802
|
-
other: 5
|
|
803
|
-
};
|
|
804
|
-
function Me() {
|
|
805
|
-
const i = {};
|
|
806
|
-
return Te.forEach((e) => {
|
|
807
|
-
e.lngs.forEach((t) => {
|
|
808
|
-
i[t] = {
|
|
809
|
-
numbers: e.nr,
|
|
810
|
-
plurals: Ve[e.fc]
|
|
811
|
-
};
|
|
812
|
-
});
|
|
813
|
-
}), i;
|
|
814
|
-
}
|
|
815
|
-
class He {
|
|
816
|
-
constructor(e) {
|
|
817
|
-
let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
818
|
-
this.languageUtils = e, this.options = t, this.logger = P.create("pluralResolver"), (!this.options.compatibilityJSON || Be.includes(this.options.compatibilityJSON)) && (typeof Intl > "u" || !Intl.PluralRules) && (this.options.compatibilityJSON = "v3", this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")), this.rules = Me();
|
|
819
|
-
}
|
|
820
|
-
addRule(e, t) {
|
|
821
|
-
this.rules[e] = t;
|
|
822
|
-
}
|
|
823
|
-
getRule(e) {
|
|
824
|
-
let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
825
|
-
if (this.shouldUseIntlApi())
|
|
826
|
-
try {
|
|
827
|
-
return new Intl.PluralRules(G(e === "dev" ? "en" : e), {
|
|
828
|
-
type: t.ordinal ? "ordinal" : "cardinal"
|
|
829
|
-
});
|
|
830
|
-
} catch {
|
|
831
|
-
return;
|
|
832
|
-
}
|
|
833
|
-
return this.rules[e] || this.rules[this.languageUtils.getLanguagePartFromCode(e)];
|
|
834
|
-
}
|
|
835
|
-
needsPlural(e) {
|
|
836
|
-
let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
837
|
-
const s = this.getRule(e, t);
|
|
838
|
-
return this.shouldUseIntlApi() ? s && s.resolvedOptions().pluralCategories.length > 1 : s && s.numbers.length > 1;
|
|
839
|
-
}
|
|
840
|
-
getPluralFormsOfKey(e, t) {
|
|
841
|
-
let s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
842
|
-
return this.getSuffixes(e, s).map((n) => `${t}${n}`);
|
|
843
|
-
}
|
|
844
|
-
getSuffixes(e) {
|
|
845
|
-
let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
846
|
-
const s = this.getRule(e, t);
|
|
847
|
-
return s ? this.shouldUseIntlApi() ? s.resolvedOptions().pluralCategories.sort((n, r) => ge[n] - ge[r]).map((n) => `${this.options.prepend}${t.ordinal ? `ordinal${this.options.prepend}` : ""}${n}`) : s.numbers.map((n) => this.getSuffix(e, n, t)) : [];
|
|
848
|
-
}
|
|
849
|
-
getSuffix(e, t) {
|
|
850
|
-
let s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
851
|
-
const n = this.getRule(e, s);
|
|
852
|
-
return n ? this.shouldUseIntlApi() ? `${this.options.prepend}${s.ordinal ? `ordinal${this.options.prepend}` : ""}${n.select(t)}` : this.getSuffixRetroCompatible(n, t) : (this.logger.warn(`no plural rule found for: ${e}`), "");
|
|
853
|
-
}
|
|
854
|
-
getSuffixRetroCompatible(e, t) {
|
|
855
|
-
const s = e.noAbs ? e.plurals(t) : e.plurals(Math.abs(t));
|
|
856
|
-
let n = e.numbers[s];
|
|
857
|
-
this.options.simplifyPluralSuffix && e.numbers.length === 2 && e.numbers[0] === 1 && (n === 2 ? n = "plural" : n === 1 && (n = ""));
|
|
858
|
-
const r = () => this.options.prepend && n.toString() ? this.options.prepend + n.toString() : n.toString();
|
|
859
|
-
return this.options.compatibilityJSON === "v1" ? n === 1 ? "" : typeof n == "number" ? `_plural_${n.toString()}` : r() : this.options.compatibilityJSON === "v2" || this.options.simplifyPluralSuffix && e.numbers.length === 2 && e.numbers[0] === 1 ? r() : this.options.prepend && s.toString() ? this.options.prepend + s.toString() : s.toString();
|
|
860
|
-
}
|
|
861
|
-
shouldUseIntlApi() {
|
|
862
|
-
return !Ke.includes(this.options.compatibilityJSON);
|
|
863
|
-
}
|
|
864
|
-
}
|
|
865
|
-
function he(i, e, t) {
|
|
866
|
-
let s = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : ".", n = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : !0, r = Fe(i, e, t);
|
|
867
|
-
return !r && n && typeof t == "string" && (r = Y(i, t, s), r === void 0 && (r = Y(e, t, s))), r;
|
|
868
|
-
}
|
|
869
|
-
class Je {
|
|
870
|
-
constructor() {
|
|
871
|
-
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
872
|
-
this.logger = P.create("interpolator"), this.options = e, this.format = e.interpolation && e.interpolation.format || ((t) => t), this.init(e);
|
|
873
|
-
}
|
|
874
|
-
init() {
|
|
875
|
-
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
876
|
-
e.interpolation || (e.interpolation = {
|
|
877
|
-
escapeValue: !0
|
|
878
|
-
});
|
|
879
|
-
const t = e.interpolation;
|
|
880
|
-
this.escape = t.escape !== void 0 ? t.escape : De, this.escapeValue = t.escapeValue !== void 0 ? t.escapeValue : !0, this.useRawValueToEscape = t.useRawValueToEscape !== void 0 ? t.useRawValueToEscape : !1, this.prefix = t.prefix ? j(t.prefix) : t.prefixEscaped || "{{", this.suffix = t.suffix ? j(t.suffix) : t.suffixEscaped || "}}", this.formatSeparator = t.formatSeparator ? t.formatSeparator : t.formatSeparator || ",", this.unescapePrefix = t.unescapeSuffix ? "" : t.unescapePrefix || "-", this.unescapeSuffix = this.unescapePrefix ? "" : t.unescapeSuffix || "", this.nestingPrefix = t.nestingPrefix ? j(t.nestingPrefix) : t.nestingPrefixEscaped || j("$t("), this.nestingSuffix = t.nestingSuffix ? j(t.nestingSuffix) : t.nestingSuffixEscaped || j(")"), this.nestingOptionsSeparator = t.nestingOptionsSeparator ? t.nestingOptionsSeparator : t.nestingOptionsSeparator || ",", this.maxReplaces = t.maxReplaces ? t.maxReplaces : 1e3, this.alwaysFormat = t.alwaysFormat !== void 0 ? t.alwaysFormat : !1, this.resetRegExp();
|
|
881
|
-
}
|
|
882
|
-
reset() {
|
|
883
|
-
this.options && this.init(this.options);
|
|
884
|
-
}
|
|
885
|
-
resetRegExp() {
|
|
886
|
-
const e = `${this.prefix}(.+?)${this.suffix}`;
|
|
887
|
-
this.regexp = new RegExp(e, "g");
|
|
888
|
-
const t = `${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`;
|
|
889
|
-
this.regexpUnescape = new RegExp(t, "g");
|
|
890
|
-
const s = `${this.nestingPrefix}(.+?)${this.nestingSuffix}`;
|
|
891
|
-
this.nestingRegexp = new RegExp(s, "g");
|
|
892
|
-
}
|
|
893
|
-
interpolate(e, t, s, n) {
|
|
894
|
-
let r, a, l;
|
|
895
|
-
const o = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {};
|
|
896
|
-
function f(c) {
|
|
897
|
-
return c.replace(/\$/g, "$$$$");
|
|
898
|
-
}
|
|
899
|
-
const g = (c) => {
|
|
900
|
-
if (c.indexOf(this.formatSeparator) < 0) {
|
|
901
|
-
const x = he(t, o, c, this.options.keySeparator, this.options.ignoreJSONStructure);
|
|
902
|
-
return this.alwaysFormat ? this.format(x, void 0, s, {
|
|
903
|
-
...n,
|
|
904
|
-
...t,
|
|
905
|
-
interpolationkey: c
|
|
906
|
-
}) : x;
|
|
907
|
-
}
|
|
908
|
-
const p = c.split(this.formatSeparator), m = p.shift().trim(), L = p.join(this.formatSeparator).trim();
|
|
909
|
-
return this.format(he(t, o, m, this.options.keySeparator, this.options.ignoreJSONStructure), L, s, {
|
|
910
|
-
...n,
|
|
911
|
-
...t,
|
|
912
|
-
interpolationkey: m
|
|
913
|
-
});
|
|
914
|
-
};
|
|
915
|
-
this.resetRegExp();
|
|
916
|
-
const h = n && n.missingInterpolationHandler || this.options.missingInterpolationHandler, u = n && n.interpolation && n.interpolation.skipOnVariables !== void 0 ? n.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables;
|
|
917
|
-
return [{
|
|
918
|
-
regex: this.regexpUnescape,
|
|
919
|
-
safeValue: (c) => f(c)
|
|
920
|
-
}, {
|
|
921
|
-
regex: this.regexp,
|
|
922
|
-
safeValue: (c) => this.escapeValue ? f(this.escape(c)) : f(c)
|
|
923
|
-
}].forEach((c) => {
|
|
924
|
-
for (l = 0; r = c.regex.exec(e); ) {
|
|
925
|
-
const p = r[1].trim();
|
|
926
|
-
if (a = g(p), a === void 0)
|
|
927
|
-
if (typeof h == "function") {
|
|
928
|
-
const L = h(e, r, n);
|
|
929
|
-
a = typeof L == "string" ? L : "";
|
|
930
|
-
} else if (n && Object.prototype.hasOwnProperty.call(n, p))
|
|
931
|
-
a = "";
|
|
932
|
-
else if (u) {
|
|
933
|
-
a = r[0];
|
|
934
|
-
continue;
|
|
935
|
-
} else
|
|
936
|
-
this.logger.warn(`missed to pass in variable ${p} for interpolating ${e}`), a = "";
|
|
937
|
-
else
|
|
938
|
-
typeof a != "string" && !this.useRawValueToEscape && (a = ae(a));
|
|
939
|
-
const m = c.safeValue(a);
|
|
940
|
-
if (e = e.replace(r[0], m), u ? (c.regex.lastIndex += a.length, c.regex.lastIndex -= r[0].length) : c.regex.lastIndex = 0, l++, l >= this.maxReplaces)
|
|
941
|
-
break;
|
|
942
|
-
}
|
|
943
|
-
}), e;
|
|
944
|
-
}
|
|
945
|
-
nest(e, t) {
|
|
946
|
-
let s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, n, r, a;
|
|
947
|
-
function l(o, f) {
|
|
948
|
-
const g = this.nestingOptionsSeparator;
|
|
949
|
-
if (o.indexOf(g) < 0)
|
|
950
|
-
return o;
|
|
951
|
-
const h = o.split(new RegExp(`${g}[ ]*{`));
|
|
952
|
-
let u = `{${h[1]}`;
|
|
953
|
-
o = h[0], u = this.interpolate(u, a);
|
|
954
|
-
const d = u.match(/'/g), c = u.match(/"/g);
|
|
955
|
-
(d && d.length % 2 === 0 && !c || c.length % 2 !== 0) && (u = u.replace(/'/g, '"'));
|
|
956
|
-
try {
|
|
957
|
-
a = JSON.parse(u), f && (a = {
|
|
958
|
-
...f,
|
|
959
|
-
...a
|
|
960
|
-
});
|
|
961
|
-
} catch (p) {
|
|
962
|
-
return this.logger.warn(`failed parsing options string in nesting for key ${o}`, p), `${o}${g}${u}`;
|
|
963
|
-
}
|
|
964
|
-
return delete a.defaultValue, o;
|
|
965
|
-
}
|
|
966
|
-
for (; n = this.nestingRegexp.exec(e); ) {
|
|
967
|
-
let o = [];
|
|
968
|
-
a = {
|
|
969
|
-
...s
|
|
970
|
-
}, a = a.replace && typeof a.replace != "string" ? a.replace : a, a.applyPostProcessor = !1, delete a.defaultValue;
|
|
971
|
-
let f = !1;
|
|
972
|
-
if (n[0].indexOf(this.formatSeparator) !== -1 && !/{.*}/.test(n[1])) {
|
|
973
|
-
const g = n[1].split(this.formatSeparator).map((h) => h.trim());
|
|
974
|
-
n[1] = g.shift(), o = g, f = !0;
|
|
975
|
-
}
|
|
976
|
-
if (r = t(l.call(this, n[1].trim(), a), a), r && n[0] === e && typeof r != "string")
|
|
977
|
-
return r;
|
|
978
|
-
typeof r != "string" && (r = ae(r)), r || (this.logger.warn(`missed to resolve ${n[1]} for nesting ${e}`), r = ""), f && (r = o.reduce((g, h) => this.format(g, h, s.lng, {
|
|
979
|
-
...s,
|
|
980
|
-
interpolationkey: n[1].trim()
|
|
981
|
-
}), r.trim())), e = e.replace(n[0], r), this.regexp.lastIndex = 0;
|
|
982
|
-
}
|
|
983
|
-
return e;
|
|
984
|
-
}
|
|
985
|
-
}
|
|
986
|
-
function ze(i) {
|
|
987
|
-
let e = i.toLowerCase().trim();
|
|
988
|
-
const t = {};
|
|
989
|
-
if (i.indexOf("(") > -1) {
|
|
990
|
-
const s = i.split("(");
|
|
991
|
-
e = s[0].toLowerCase().trim();
|
|
992
|
-
const n = s[1].substring(0, s[1].length - 1);
|
|
993
|
-
e === "currency" && n.indexOf(":") < 0 ? t.currency || (t.currency = n.trim()) : e === "relativetime" && n.indexOf(":") < 0 ? t.range || (t.range = n.trim()) : n.split(";").forEach((a) => {
|
|
994
|
-
if (!a)
|
|
995
|
-
return;
|
|
996
|
-
const [l, ...o] = a.split(":"), f = o.join(":").trim().replace(/^'+|'+$/g, "");
|
|
997
|
-
t[l.trim()] || (t[l.trim()] = f), f === "false" && (t[l.trim()] = !1), f === "true" && (t[l.trim()] = !0), isNaN(f) || (t[l.trim()] = parseInt(f, 10));
|
|
998
|
-
});
|
|
999
|
-
}
|
|
1000
|
-
return {
|
|
1001
|
-
formatName: e,
|
|
1002
|
-
formatOptions: t
|
|
1003
|
-
};
|
|
1004
|
-
}
|
|
1005
|
-
function k(i) {
|
|
1006
|
-
const e = {};
|
|
1007
|
-
return function(s, n, r) {
|
|
1008
|
-
const a = n + JSON.stringify(r);
|
|
1009
|
-
let l = e[a];
|
|
1010
|
-
return l || (l = i(G(n), r), e[a] = l), l(s);
|
|
1011
|
-
};
|
|
1012
|
-
}
|
|
1013
|
-
class We {
|
|
1014
|
-
constructor() {
|
|
1015
|
-
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
1016
|
-
this.logger = P.create("formatter"), this.options = e, this.formats = {
|
|
1017
|
-
number: k((t, s) => {
|
|
1018
|
-
const n = new Intl.NumberFormat(t, {
|
|
1019
|
-
...s
|
|
1020
|
-
});
|
|
1021
|
-
return (r) => n.format(r);
|
|
1022
|
-
}),
|
|
1023
|
-
currency: k((t, s) => {
|
|
1024
|
-
const n = new Intl.NumberFormat(t, {
|
|
1025
|
-
...s,
|
|
1026
|
-
style: "currency"
|
|
1027
|
-
});
|
|
1028
|
-
return (r) => n.format(r);
|
|
1029
|
-
}),
|
|
1030
|
-
datetime: k((t, s) => {
|
|
1031
|
-
const n = new Intl.DateTimeFormat(t, {
|
|
1032
|
-
...s
|
|
1033
|
-
});
|
|
1034
|
-
return (r) => n.format(r);
|
|
1035
|
-
}),
|
|
1036
|
-
relativetime: k((t, s) => {
|
|
1037
|
-
const n = new Intl.RelativeTimeFormat(t, {
|
|
1038
|
-
...s
|
|
1039
|
-
});
|
|
1040
|
-
return (r) => n.format(r, s.range || "day");
|
|
1041
|
-
}),
|
|
1042
|
-
list: k((t, s) => {
|
|
1043
|
-
const n = new Intl.ListFormat(t, {
|
|
1044
|
-
...s
|
|
1045
|
-
});
|
|
1046
|
-
return (r) => n.format(r);
|
|
1047
|
-
})
|
|
1048
|
-
}, this.init(e);
|
|
1049
|
-
}
|
|
1050
|
-
init(e) {
|
|
1051
|
-
const s = (arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
|
|
1052
|
-
interpolation: {}
|
|
1053
|
-
}).interpolation;
|
|
1054
|
-
this.formatSeparator = s.formatSeparator ? s.formatSeparator : s.formatSeparator || ",";
|
|
1055
|
-
}
|
|
1056
|
-
add(e, t) {
|
|
1057
|
-
this.formats[e.toLowerCase().trim()] = t;
|
|
1058
|
-
}
|
|
1059
|
-
addCached(e, t) {
|
|
1060
|
-
this.formats[e.toLowerCase().trim()] = k(t);
|
|
1061
|
-
}
|
|
1062
|
-
format(e, t, s) {
|
|
1063
|
-
let n = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
|
|
1064
|
-
return t.split(this.formatSeparator).reduce((l, o) => {
|
|
1065
|
-
const {
|
|
1066
|
-
formatName: f,
|
|
1067
|
-
formatOptions: g
|
|
1068
|
-
} = ze(o);
|
|
1069
|
-
if (this.formats[f]) {
|
|
1070
|
-
let h = l;
|
|
1071
|
-
try {
|
|
1072
|
-
const u = n && n.formatParams && n.formatParams[n.interpolationkey] || {}, d = u.locale || u.lng || n.locale || n.lng || s;
|
|
1073
|
-
h = this.formats[f](l, d, {
|
|
1074
|
-
...g,
|
|
1075
|
-
...n,
|
|
1076
|
-
...u
|
|
1077
|
-
});
|
|
1078
|
-
} catch (u) {
|
|
1079
|
-
this.logger.warn(u);
|
|
1080
|
-
}
|
|
1081
|
-
return h;
|
|
1082
|
-
} else
|
|
1083
|
-
this.logger.warn(`there was no format function for ${f}`);
|
|
1084
|
-
return l;
|
|
1085
|
-
}, e);
|
|
1086
|
-
}
|
|
1087
|
-
}
|
|
1088
|
-
function Ye(i, e) {
|
|
1089
|
-
i.pending[e] !== void 0 && (delete i.pending[e], i.pendingCount--);
|
|
1090
|
-
}
|
|
1091
|
-
class Ge extends Q {
|
|
1092
|
-
constructor(e, t, s) {
|
|
1093
|
-
let n = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
|
|
1094
|
-
super(), this.backend = e, this.store = t, this.services = s, this.languageUtils = s.languageUtils, this.options = n, this.logger = P.create("backendConnector"), this.waitingReads = [], this.maxParallelReads = n.maxParallelReads || 10, this.readingCalls = 0, this.maxRetries = n.maxRetries >= 0 ? n.maxRetries : 5, this.retryTimeout = n.retryTimeout >= 1 ? n.retryTimeout : 350, this.state = {}, this.queue = [], this.backend && this.backend.init && this.backend.init(s, n.backend, n);
|
|
1095
|
-
}
|
|
1096
|
-
queueLoad(e, t, s, n) {
|
|
1097
|
-
const r = {}, a = {}, l = {}, o = {};
|
|
1098
|
-
return e.forEach((f) => {
|
|
1099
|
-
let g = !0;
|
|
1100
|
-
t.forEach((h) => {
|
|
1101
|
-
const u = `${f}|${h}`;
|
|
1102
|
-
!s.reload && this.store.hasResourceBundle(f, h) ? this.state[u] = 2 : this.state[u] < 0 || (this.state[u] === 1 ? a[u] === void 0 && (a[u] = !0) : (this.state[u] = 1, g = !1, a[u] === void 0 && (a[u] = !0), r[u] === void 0 && (r[u] = !0), o[h] === void 0 && (o[h] = !0)));
|
|
1103
|
-
}), g || (l[f] = !0);
|
|
1104
|
-
}), (Object.keys(r).length || Object.keys(a).length) && this.queue.push({
|
|
1105
|
-
pending: a,
|
|
1106
|
-
pendingCount: Object.keys(a).length,
|
|
1107
|
-
loaded: {},
|
|
1108
|
-
errors: [],
|
|
1109
|
-
callback: n
|
|
1110
|
-
}), {
|
|
1111
|
-
toLoad: Object.keys(r),
|
|
1112
|
-
pending: Object.keys(a),
|
|
1113
|
-
toLoadLanguages: Object.keys(l),
|
|
1114
|
-
toLoadNamespaces: Object.keys(o)
|
|
1115
|
-
};
|
|
1116
|
-
}
|
|
1117
|
-
loaded(e, t, s) {
|
|
1118
|
-
const n = e.split("|"), r = n[0], a = n[1];
|
|
1119
|
-
t && this.emit("failedLoading", r, a, t), s && this.store.addResourceBundle(r, a, s), this.state[e] = t ? -1 : 2;
|
|
1120
|
-
const l = {};
|
|
1121
|
-
this.queue.forEach((o) => {
|
|
1122
|
-
ke(o.loaded, [r], a), Ye(o, e), t && o.errors.push(t), o.pendingCount === 0 && !o.done && (Object.keys(o.loaded).forEach((f) => {
|
|
1123
|
-
l[f] || (l[f] = {});
|
|
1124
|
-
const g = o.loaded[f];
|
|
1125
|
-
g.length && g.forEach((h) => {
|
|
1126
|
-
l[f][h] === void 0 && (l[f][h] = !0);
|
|
1127
|
-
});
|
|
1128
|
-
}), o.done = !0, o.errors.length ? o.callback(o.errors) : o.callback());
|
|
1129
|
-
}), this.emit("loaded", l), this.queue = this.queue.filter((o) => !o.done);
|
|
1130
|
-
}
|
|
1131
|
-
read(e, t, s) {
|
|
1132
|
-
let n = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 0, r = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : this.retryTimeout, a = arguments.length > 5 ? arguments[5] : void 0;
|
|
1133
|
-
if (!e.length)
|
|
1134
|
-
return a(null, {});
|
|
1135
|
-
if (this.readingCalls >= this.maxParallelReads) {
|
|
1136
|
-
this.waitingReads.push({
|
|
1137
|
-
lng: e,
|
|
1138
|
-
ns: t,
|
|
1139
|
-
fcName: s,
|
|
1140
|
-
tried: n,
|
|
1141
|
-
wait: r,
|
|
1142
|
-
callback: a
|
|
1143
|
-
});
|
|
1144
|
-
return;
|
|
1145
|
-
}
|
|
1146
|
-
this.readingCalls++;
|
|
1147
|
-
const l = (f, g) => {
|
|
1148
|
-
if (this.readingCalls--, this.waitingReads.length > 0) {
|
|
1149
|
-
const h = this.waitingReads.shift();
|
|
1150
|
-
this.read(h.lng, h.ns, h.fcName, h.tried, h.wait, h.callback);
|
|
1151
|
-
}
|
|
1152
|
-
if (f && g && n < this.maxRetries) {
|
|
1153
|
-
setTimeout(() => {
|
|
1154
|
-
this.read.call(this, e, t, s, n + 1, r * 2, a);
|
|
1155
|
-
}, r);
|
|
1156
|
-
return;
|
|
1157
|
-
}
|
|
1158
|
-
a(f, g);
|
|
1159
|
-
}, o = this.backend[s].bind(this.backend);
|
|
1160
|
-
if (o.length === 2) {
|
|
1161
|
-
try {
|
|
1162
|
-
const f = o(e, t);
|
|
1163
|
-
f && typeof f.then == "function" ? f.then((g) => l(null, g)).catch(l) : l(null, f);
|
|
1164
|
-
} catch (f) {
|
|
1165
|
-
l(f);
|
|
1166
|
-
}
|
|
1167
|
-
return;
|
|
1168
|
-
}
|
|
1169
|
-
return o(e, t, l);
|
|
1170
|
-
}
|
|
1171
|
-
prepareLoading(e, t) {
|
|
1172
|
-
let s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, n = arguments.length > 3 ? arguments[3] : void 0;
|
|
1173
|
-
if (!this.backend)
|
|
1174
|
-
return this.logger.warn("No backend was added via i18next.use. Will not load resources."), n && n();
|
|
1175
|
-
typeof e == "string" && (e = this.languageUtils.toResolveHierarchy(e)), typeof t == "string" && (t = [t]);
|
|
1176
|
-
const r = this.queueLoad(e, t, s, n);
|
|
1177
|
-
if (!r.toLoad.length)
|
|
1178
|
-
return r.pending.length || n(), null;
|
|
1179
|
-
r.toLoad.forEach((a) => {
|
|
1180
|
-
this.loadOne(a);
|
|
1181
|
-
});
|
|
1182
|
-
}
|
|
1183
|
-
load(e, t, s) {
|
|
1184
|
-
this.prepareLoading(e, t, {}, s);
|
|
1185
|
-
}
|
|
1186
|
-
reload(e, t, s) {
|
|
1187
|
-
this.prepareLoading(e, t, {
|
|
1188
|
-
reload: !0
|
|
1189
|
-
}, s);
|
|
1190
|
-
}
|
|
1191
|
-
loadOne(e) {
|
|
1192
|
-
let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "";
|
|
1193
|
-
const s = e.split("|"), n = s[0], r = s[1];
|
|
1194
|
-
this.read(n, r, "read", void 0, void 0, (a, l) => {
|
|
1195
|
-
a && this.logger.warn(`${t}loading namespace ${r} for language ${n} failed`, a), !a && l && this.logger.log(`${t}loaded namespace ${r} for language ${n}`, l), this.loaded(e, a, l);
|
|
1196
|
-
});
|
|
1197
|
-
}
|
|
1198
|
-
saveMissing(e, t, s, n, r) {
|
|
1199
|
-
let a = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : {}, l = arguments.length > 6 && arguments[6] !== void 0 ? arguments[6] : () => {
|
|
1200
|
-
};
|
|
1201
|
-
if (this.services.utils && this.services.utils.hasLoadedNamespace && !this.services.utils.hasLoadedNamespace(t)) {
|
|
1202
|
-
this.logger.warn(`did not save key "${s}" as the namespace "${t}" was not yet loaded`, "This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");
|
|
1203
|
-
return;
|
|
1204
|
-
}
|
|
1205
|
-
if (!(s == null || s === "")) {
|
|
1206
|
-
if (this.backend && this.backend.create) {
|
|
1207
|
-
const o = {
|
|
1208
|
-
...a,
|
|
1209
|
-
isUpdate: r
|
|
1210
|
-
}, f = this.backend.create.bind(this.backend);
|
|
1211
|
-
if (f.length < 6)
|
|
1212
|
-
try {
|
|
1213
|
-
let g;
|
|
1214
|
-
f.length === 5 ? g = f(e, t, s, n, o) : g = f(e, t, s, n), g && typeof g.then == "function" ? g.then((h) => l(null, h)).catch(l) : l(null, g);
|
|
1215
|
-
} catch (g) {
|
|
1216
|
-
l(g);
|
|
1217
|
-
}
|
|
1218
|
-
else
|
|
1219
|
-
f(e, t, s, n, l, o);
|
|
1220
|
-
}
|
|
1221
|
-
!e || !e[0] || this.store.addResource(e[0], t, s, n);
|
|
1222
|
-
}
|
|
1223
|
-
}
|
|
1224
|
-
}
|
|
1225
|
-
function ce() {
|
|
1226
|
-
return {
|
|
1227
|
-
debug: !1,
|
|
1228
|
-
initImmediate: !0,
|
|
1229
|
-
ns: ["translation"],
|
|
1230
|
-
defaultNS: ["translation"],
|
|
1231
|
-
fallbackLng: ["dev"],
|
|
1232
|
-
fallbackNS: !1,
|
|
1233
|
-
supportedLngs: !1,
|
|
1234
|
-
nonExplicitSupportedLngs: !1,
|
|
1235
|
-
load: "all",
|
|
1236
|
-
preload: !1,
|
|
1237
|
-
simplifyPluralSuffix: !0,
|
|
1238
|
-
keySeparator: ".",
|
|
1239
|
-
nsSeparator: ":",
|
|
1240
|
-
pluralSeparator: "_",
|
|
1241
|
-
contextSeparator: "_",
|
|
1242
|
-
partialBundledLanguages: !1,
|
|
1243
|
-
saveMissing: !1,
|
|
1244
|
-
updateMissing: !1,
|
|
1245
|
-
saveMissingTo: "fallback",
|
|
1246
|
-
saveMissingPlurals: !0,
|
|
1247
|
-
missingKeyHandler: !1,
|
|
1248
|
-
missingInterpolationHandler: !1,
|
|
1249
|
-
postProcess: !1,
|
|
1250
|
-
postProcessPassResolved: !1,
|
|
1251
|
-
returnNull: !1,
|
|
1252
|
-
returnEmptyString: !0,
|
|
1253
|
-
returnObjects: !1,
|
|
1254
|
-
joinArrays: !1,
|
|
1255
|
-
returnedObjectHandler: !1,
|
|
1256
|
-
parseMissingKeyHandler: !1,
|
|
1257
|
-
appendNamespaceToMissingKey: !1,
|
|
1258
|
-
appendNamespaceToCIMode: !1,
|
|
1259
|
-
overloadTranslationOptionHandler: function(e) {
|
|
1260
|
-
let t = {};
|
|
1261
|
-
if (typeof e[1] == "object" && (t = e[1]), typeof e[1] == "string" && (t.defaultValue = e[1]), typeof e[2] == "string" && (t.tDescription = e[2]), typeof e[2] == "object" || typeof e[3] == "object") {
|
|
1262
|
-
const s = e[3] || e[2];
|
|
1263
|
-
Object.keys(s).forEach((n) => {
|
|
1264
|
-
t[n] = s[n];
|
|
1265
|
-
});
|
|
1266
|
-
}
|
|
1267
|
-
return t;
|
|
1268
|
-
},
|
|
1269
|
-
interpolation: {
|
|
1270
|
-
escapeValue: !0,
|
|
1271
|
-
format: (i) => i,
|
|
1272
|
-
prefix: "{{",
|
|
1273
|
-
suffix: "}}",
|
|
1274
|
-
formatSeparator: ",",
|
|
1275
|
-
unescapePrefix: "-",
|
|
1276
|
-
nestingPrefix: "$t(",
|
|
1277
|
-
nestingSuffix: ")",
|
|
1278
|
-
nestingOptionsSeparator: ",",
|
|
1279
|
-
maxReplaces: 1e3,
|
|
1280
|
-
skipOnVariables: !0
|
|
1281
|
-
}
|
|
1282
|
-
};
|
|
1283
|
-
}
|
|
1284
|
-
function de(i) {
|
|
1285
|
-
return typeof i.ns == "string" && (i.ns = [i.ns]), typeof i.fallbackLng == "string" && (i.fallbackLng = [i.fallbackLng]), typeof i.fallbackNS == "string" && (i.fallbackNS = [i.fallbackNS]), i.supportedLngs && i.supportedLngs.indexOf("cimode") < 0 && (i.supportedLngs = i.supportedLngs.concat(["cimode"])), i;
|
|
1286
|
-
}
|
|
1287
|
-
function H() {
|
|
1288
|
-
}
|
|
1289
|
-
function Ze(i) {
|
|
1290
|
-
Object.getOwnPropertyNames(Object.getPrototypeOf(i)).forEach((t) => {
|
|
1291
|
-
typeof i[t] == "function" && (i[t] = i[t].bind(i));
|
|
1292
|
-
});
|
|
1293
|
-
}
|
|
1294
|
-
class T extends Q {
|
|
1295
|
-
constructor() {
|
|
1296
|
-
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, t = arguments.length > 1 ? arguments[1] : void 0;
|
|
1297
|
-
if (super(), this.options = de(e), this.services = {}, this.logger = P, this.modules = {
|
|
1298
|
-
external: []
|
|
1299
|
-
}, Ze(this), t && !this.isInitialized && !e.isClone) {
|
|
1300
|
-
if (!this.options.initImmediate)
|
|
1301
|
-
return this.init(e, t), this;
|
|
1302
|
-
setTimeout(() => {
|
|
1303
|
-
this.init(e, t);
|
|
1304
|
-
}, 0);
|
|
1305
|
-
}
|
|
1306
|
-
}
|
|
1307
|
-
init() {
|
|
1308
|
-
var e = this;
|
|
1309
|
-
let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, s = arguments.length > 1 ? arguments[1] : void 0;
|
|
1310
|
-
typeof t == "function" && (s = t, t = {}), !t.defaultNS && t.defaultNS !== !1 && t.ns && (typeof t.ns == "string" ? t.defaultNS = t.ns : t.ns.indexOf("translation") < 0 && (t.defaultNS = t.ns[0]));
|
|
1311
|
-
const n = ce();
|
|
1312
|
-
this.options = {
|
|
1313
|
-
...n,
|
|
1314
|
-
...this.options,
|
|
1315
|
-
...de(t)
|
|
1316
|
-
}, this.options.compatibilityAPI !== "v1" && (this.options.interpolation = {
|
|
1317
|
-
...n.interpolation,
|
|
1318
|
-
...this.options.interpolation
|
|
1319
|
-
}), t.keySeparator !== void 0 && (this.options.userDefinedKeySeparator = t.keySeparator), t.nsSeparator !== void 0 && (this.options.userDefinedNsSeparator = t.nsSeparator);
|
|
1320
|
-
function r(g) {
|
|
1321
|
-
return g ? typeof g == "function" ? new g() : g : null;
|
|
1322
|
-
}
|
|
1323
|
-
if (!this.options.isClone) {
|
|
1324
|
-
this.modules.logger ? P.init(r(this.modules.logger), this.options) : P.init(null, this.options);
|
|
1325
|
-
let g;
|
|
1326
|
-
this.modules.formatter ? g = this.modules.formatter : typeof Intl < "u" && (g = We);
|
|
1327
|
-
const h = new fe(this.options);
|
|
1328
|
-
this.store = new le(this.options.resources, this.options);
|
|
1329
|
-
const u = this.services;
|
|
1330
|
-
u.logger = P, u.resourceStore = this.store, u.languageUtils = h, u.pluralResolver = new He(h, {
|
|
1331
|
-
prepend: this.options.pluralSeparator,
|
|
1332
|
-
compatibilityJSON: this.options.compatibilityJSON,
|
|
1333
|
-
simplifyPluralSuffix: this.options.simplifyPluralSuffix
|
|
1334
|
-
}), g && (!this.options.interpolation.format || this.options.interpolation.format === n.interpolation.format) && (u.formatter = r(g), u.formatter.init(u, this.options), this.options.interpolation.format = u.formatter.format.bind(u.formatter)), u.interpolator = new Je(this.options), u.utils = {
|
|
1335
|
-
hasLoadedNamespace: this.hasLoadedNamespace.bind(this)
|
|
1336
|
-
}, u.backendConnector = new Ge(r(this.modules.backend), u.resourceStore, u, this.options), u.backendConnector.on("*", function(d) {
|
|
1337
|
-
for (var c = arguments.length, p = new Array(c > 1 ? c - 1 : 0), m = 1; m < c; m++)
|
|
1338
|
-
p[m - 1] = arguments[m];
|
|
1339
|
-
e.emit(d, ...p);
|
|
1340
|
-
}), this.modules.languageDetector && (u.languageDetector = r(this.modules.languageDetector), u.languageDetector.init && u.languageDetector.init(u, this.options.detection, this.options)), this.modules.i18nFormat && (u.i18nFormat = r(this.modules.i18nFormat), u.i18nFormat.init && u.i18nFormat.init(this)), this.translator = new Z(this.services, this.options), this.translator.on("*", function(d) {
|
|
1341
|
-
for (var c = arguments.length, p = new Array(c > 1 ? c - 1 : 0), m = 1; m < c; m++)
|
|
1342
|
-
p[m - 1] = arguments[m];
|
|
1343
|
-
e.emit(d, ...p);
|
|
1344
|
-
}), this.modules.external.forEach((d) => {
|
|
1345
|
-
d.init && d.init(this);
|
|
1346
|
-
});
|
|
1347
|
-
}
|
|
1348
|
-
if (this.format = this.options.interpolation.format, s || (s = H), this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) {
|
|
1349
|
-
const g = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
|
|
1350
|
-
g.length > 0 && g[0] !== "dev" && (this.options.lng = g[0]);
|
|
1351
|
-
}
|
|
1352
|
-
!this.services.languageDetector && !this.options.lng && this.logger.warn("init: no languageDetector is used and no lng is defined"), ["getResource", "hasResourceBundle", "getResourceBundle", "getDataByLanguage"].forEach((g) => {
|
|
1353
|
-
this[g] = function() {
|
|
1354
|
-
return e.store[g](...arguments);
|
|
1355
|
-
};
|
|
1356
|
-
}), ["addResource", "addResources", "addResourceBundle", "removeResourceBundle"].forEach((g) => {
|
|
1357
|
-
this[g] = function() {
|
|
1358
|
-
return e.store[g](...arguments), e;
|
|
1359
|
-
};
|
|
1360
|
-
});
|
|
1361
|
-
const o = U(), f = () => {
|
|
1362
|
-
const g = (h, u) => {
|
|
1363
|
-
this.isInitialized && !this.initializedStoreOnce && this.logger.warn("init: i18next is already initialized. You should call init just once!"), this.isInitialized = !0, this.options.isClone || this.logger.log("initialized", this.options), this.emit("initialized", this.options), o.resolve(u), s(h, u);
|
|
1364
|
-
};
|
|
1365
|
-
if (this.languages && this.options.compatibilityAPI !== "v1" && !this.isInitialized)
|
|
1366
|
-
return g(null, this.t.bind(this));
|
|
1367
|
-
this.changeLanguage(this.options.lng, g);
|
|
1368
|
-
};
|
|
1369
|
-
return this.options.resources || !this.options.initImmediate ? f() : setTimeout(f, 0), o;
|
|
1370
|
-
}
|
|
1371
|
-
loadResources(e) {
|
|
1372
|
-
let s = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : H;
|
|
1373
|
-
const n = typeof e == "string" ? e : this.language;
|
|
1374
|
-
if (typeof e == "function" && (s = e), !this.options.resources || this.options.partialBundledLanguages) {
|
|
1375
|
-
if (n && n.toLowerCase() === "cimode" && (!this.options.preload || this.options.preload.length === 0))
|
|
1376
|
-
return s();
|
|
1377
|
-
const r = [], a = (l) => {
|
|
1378
|
-
if (!l || l === "cimode")
|
|
1379
|
-
return;
|
|
1380
|
-
this.services.languageUtils.toResolveHierarchy(l).forEach((f) => {
|
|
1381
|
-
f !== "cimode" && r.indexOf(f) < 0 && r.push(f);
|
|
1382
|
-
});
|
|
1383
|
-
};
|
|
1384
|
-
n ? a(n) : this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach((o) => a(o)), this.options.preload && this.options.preload.forEach((l) => a(l)), this.services.backendConnector.load(r, this.options.ns, (l) => {
|
|
1385
|
-
!l && !this.resolvedLanguage && this.language && this.setResolvedLanguage(this.language), s(l);
|
|
1386
|
-
});
|
|
1387
|
-
} else
|
|
1388
|
-
s(null);
|
|
1389
|
-
}
|
|
1390
|
-
reloadResources(e, t, s) {
|
|
1391
|
-
const n = U();
|
|
1392
|
-
return e || (e = this.languages), t || (t = this.options.ns), s || (s = H), this.services.backendConnector.reload(e, t, (r) => {
|
|
1393
|
-
n.resolve(), s(r);
|
|
1394
|
-
}), n;
|
|
1395
|
-
}
|
|
1396
|
-
use(e) {
|
|
1397
|
-
if (!e)
|
|
1398
|
-
throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");
|
|
1399
|
-
if (!e.type)
|
|
1400
|
-
throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");
|
|
1401
|
-
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" && Se.addPostProcessor(e), e.type === "formatter" && (this.modules.formatter = e), e.type === "3rdParty" && this.modules.external.push(e), this;
|
|
1402
|
-
}
|
|
1403
|
-
setResolvedLanguage(e) {
|
|
1404
|
-
if (!(!e || !this.languages) && !(["cimode", "dev"].indexOf(e) > -1))
|
|
1405
|
-
for (let t = 0; t < this.languages.length; t++) {
|
|
1406
|
-
const s = this.languages[t];
|
|
1407
|
-
if (!(["cimode", "dev"].indexOf(s) > -1) && this.store.hasLanguageSomeTranslations(s)) {
|
|
1408
|
-
this.resolvedLanguage = s;
|
|
1409
|
-
break;
|
|
1410
|
-
}
|
|
1411
|
-
}
|
|
1412
|
-
}
|
|
1413
|
-
changeLanguage(e, t) {
|
|
1414
|
-
var s = this;
|
|
1415
|
-
this.isLanguageChangingTo = e;
|
|
1416
|
-
const n = U();
|
|
1417
|
-
this.emit("languageChanging", e);
|
|
1418
|
-
const r = (o) => {
|
|
1419
|
-
this.language = o, this.languages = this.services.languageUtils.toResolveHierarchy(o), this.resolvedLanguage = void 0, this.setResolvedLanguage(o);
|
|
1420
|
-
}, a = (o, f) => {
|
|
1421
|
-
f ? (r(f), this.translator.changeLanguage(f), this.isLanguageChangingTo = void 0, this.emit("languageChanged", f), this.logger.log("languageChanged", f)) : this.isLanguageChangingTo = void 0, n.resolve(function() {
|
|
1422
|
-
return s.t(...arguments);
|
|
1423
|
-
}), t && t(o, function() {
|
|
1424
|
-
return s.t(...arguments);
|
|
1425
|
-
});
|
|
1426
|
-
}, l = (o) => {
|
|
1427
|
-
!e && !o && this.services.languageDetector && (o = []);
|
|
1428
|
-
const f = typeof o == "string" ? o : this.services.languageUtils.getBestMatchFromCodes(o);
|
|
1429
|
-
f && (this.language || r(f), this.translator.language || this.translator.changeLanguage(f), this.services.languageDetector && this.services.languageDetector.cacheUserLanguage && this.services.languageDetector.cacheUserLanguage(f)), this.loadResources(f, (g) => {
|
|
1430
|
-
a(g, f);
|
|
1431
|
-
});
|
|
1432
|
-
};
|
|
1433
|
-
return !e && this.services.languageDetector && !this.services.languageDetector.async ? l(this.services.languageDetector.detect()) : !e && this.services.languageDetector && this.services.languageDetector.async ? this.services.languageDetector.detect.length === 0 ? this.services.languageDetector.detect().then(l) : this.services.languageDetector.detect(l) : l(e), n;
|
|
1434
|
-
}
|
|
1435
|
-
getFixedT(e, t, s) {
|
|
1436
|
-
var n = this;
|
|
1437
|
-
const r = function(a, l) {
|
|
1438
|
-
let o;
|
|
1439
|
-
if (typeof l != "object") {
|
|
1440
|
-
for (var f = arguments.length, g = new Array(f > 2 ? f - 2 : 0), h = 2; h < f; h++)
|
|
1441
|
-
g[h - 2] = arguments[h];
|
|
1442
|
-
o = n.options.overloadTranslationOptionHandler([a, l].concat(g));
|
|
1443
|
-
} else
|
|
1444
|
-
o = {
|
|
1445
|
-
...l
|
|
1446
|
-
};
|
|
1447
|
-
o.lng = o.lng || r.lng, o.lngs = o.lngs || r.lngs, o.ns = o.ns || r.ns, o.keyPrefix = o.keyPrefix || s || r.keyPrefix;
|
|
1448
|
-
const u = n.options.keySeparator || ".";
|
|
1449
|
-
let d;
|
|
1450
|
-
return o.keyPrefix && Array.isArray(a) ? d = a.map((c) => `${o.keyPrefix}${u}${c}`) : d = o.keyPrefix ? `${o.keyPrefix}${u}${a}` : a, n.t(d, o);
|
|
1451
|
-
};
|
|
1452
|
-
return typeof e == "string" ? r.lng = e : r.lngs = e, r.ns = t, r.keyPrefix = s, r;
|
|
1453
|
-
}
|
|
1454
|
-
t() {
|
|
1455
|
-
return this.translator && this.translator.translate(...arguments);
|
|
1456
|
-
}
|
|
1457
|
-
exists() {
|
|
1458
|
-
return this.translator && this.translator.exists(...arguments);
|
|
1459
|
-
}
|
|
1460
|
-
setDefaultNamespace(e) {
|
|
1461
|
-
this.options.defaultNS = e;
|
|
1462
|
-
}
|
|
1463
|
-
hasLoadedNamespace(e) {
|
|
1464
|
-
let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
1465
|
-
if (!this.isInitialized)
|
|
1466
|
-
return this.logger.warn("hasLoadedNamespace: i18next was not initialized", this.languages), !1;
|
|
1467
|
-
if (!this.languages || !this.languages.length)
|
|
1468
|
-
return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty", this.languages), !1;
|
|
1469
|
-
const s = t.lng || this.resolvedLanguage || this.languages[0], n = this.options ? this.options.fallbackLng : !1, r = this.languages[this.languages.length - 1];
|
|
1470
|
-
if (s.toLowerCase() === "cimode")
|
|
1471
|
-
return !0;
|
|
1472
|
-
const a = (l, o) => {
|
|
1473
|
-
const f = this.services.backendConnector.state[`${l}|${o}`];
|
|
1474
|
-
return f === -1 || f === 2;
|
|
1475
|
-
};
|
|
1476
|
-
if (t.precheck) {
|
|
1477
|
-
const l = t.precheck(this, a);
|
|
1478
|
-
if (l !== void 0)
|
|
1479
|
-
return l;
|
|
1480
|
-
}
|
|
1481
|
-
return !!(this.hasResourceBundle(s, e) || !this.services.backendConnector.backend || this.options.resources && !this.options.partialBundledLanguages || a(s, e) && (!n || a(r, e)));
|
|
1482
|
-
}
|
|
1483
|
-
loadNamespaces(e, t) {
|
|
1484
|
-
const s = U();
|
|
1485
|
-
return this.options.ns ? (typeof e == "string" && (e = [e]), e.forEach((n) => {
|
|
1486
|
-
this.options.ns.indexOf(n) < 0 && this.options.ns.push(n);
|
|
1487
|
-
}), this.loadResources((n) => {
|
|
1488
|
-
s.resolve(), t && t(n);
|
|
1489
|
-
}), s) : (t && t(), Promise.resolve());
|
|
1490
|
-
}
|
|
1491
|
-
loadLanguages(e, t) {
|
|
1492
|
-
const s = U();
|
|
1493
|
-
typeof e == "string" && (e = [e]);
|
|
1494
|
-
const n = this.options.preload || [], r = e.filter((a) => n.indexOf(a) < 0);
|
|
1495
|
-
return r.length ? (this.options.preload = n.concat(r), this.loadResources((a) => {
|
|
1496
|
-
s.resolve(), t && t(a);
|
|
1497
|
-
}), s) : (t && t(), Promise.resolve());
|
|
1498
|
-
}
|
|
1499
|
-
dir(e) {
|
|
1500
|
-
if (e || (e = this.resolvedLanguage || (this.languages && this.languages.length > 0 ? this.languages[0] : this.language)), !e)
|
|
1501
|
-
return "rtl";
|
|
1502
|
-
const t = ["ar", "shu", "sqr", "ssh", "xaa", "yhd", "yud", "aao", "abh", "abv", "acm", "acq", "acw", "acx", "acy", "adf", "ads", "aeb", "aec", "afb", "ajp", "apc", "apd", "arb", "arq", "ars", "ary", "arz", "auz", "avl", "ayh", "ayl", "ayn", "ayp", "bbz", "pga", "he", "iw", "ps", "pbt", "pbu", "pst", "prp", "prd", "ug", "ur", "ydd", "yds", "yih", "ji", "yi", "hbo", "men", "xmn", "fa", "jpr", "peo", "pes", "prs", "dv", "sam", "ckb"], s = this.services && this.services.languageUtils || new fe(ce());
|
|
1503
|
-
return t.indexOf(s.getLanguagePartFromCode(e)) > -1 || e.toLowerCase().indexOf("-arab") > 1 ? "rtl" : "ltr";
|
|
1504
|
-
}
|
|
1505
|
-
static createInstance() {
|
|
1506
|
-
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, t = arguments.length > 1 ? arguments[1] : void 0;
|
|
1507
|
-
return new T(e, t);
|
|
1508
|
-
}
|
|
1509
|
-
cloneInstance() {
|
|
1510
|
-
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : H;
|
|
1511
|
-
const s = e.forkResourceStore;
|
|
1512
|
-
s && delete e.forkResourceStore;
|
|
1513
|
-
const n = {
|
|
1514
|
-
...this.options,
|
|
1515
|
-
...e,
|
|
1516
|
-
isClone: !0
|
|
1517
|
-
}, r = new T(n);
|
|
1518
|
-
return (e.debug !== void 0 || e.prefix !== void 0) && (r.logger = r.logger.clone(e)), ["store", "services", "language"].forEach((l) => {
|
|
1519
|
-
r[l] = this[l];
|
|
1520
|
-
}), r.services = {
|
|
1521
|
-
...this.services
|
|
1522
|
-
}, r.services.utils = {
|
|
1523
|
-
hasLoadedNamespace: r.hasLoadedNamespace.bind(r)
|
|
1524
|
-
}, s && (r.store = new le(this.store.data, n), r.services.resourceStore = r.store), r.translator = new Z(r.services, n), r.translator.on("*", function(l) {
|
|
1525
|
-
for (var o = arguments.length, f = new Array(o > 1 ? o - 1 : 0), g = 1; g < o; g++)
|
|
1526
|
-
f[g - 1] = arguments[g];
|
|
1527
|
-
r.emit(l, ...f);
|
|
1528
|
-
}), r.init(n, t), r.translator.options = n, r.translator.backendConnector.services.utils = {
|
|
1529
|
-
hasLoadedNamespace: r.hasLoadedNamespace.bind(r)
|
|
1530
|
-
}, r;
|
|
1531
|
-
}
|
|
1532
|
-
toJSON() {
|
|
1533
|
-
return {
|
|
1534
|
-
options: this.options,
|
|
1535
|
-
store: this.store,
|
|
1536
|
-
language: this.language,
|
|
1537
|
-
languages: this.languages,
|
|
1538
|
-
resolvedLanguage: this.resolvedLanguage
|
|
1539
|
-
};
|
|
1540
|
-
}
|
|
1541
|
-
}
|
|
1542
|
-
const b = T.createInstance();
|
|
1543
|
-
b.createInstance = T.createInstance;
|
|
1544
|
-
b.createInstance;
|
|
1545
|
-
b.dir;
|
|
1546
|
-
b.init;
|
|
1547
|
-
b.loadResources;
|
|
1548
|
-
b.reloadResources;
|
|
1549
|
-
b.use;
|
|
1550
|
-
b.changeLanguage;
|
|
1551
|
-
b.getFixedT;
|
|
1552
|
-
const J = b.t;
|
|
1553
|
-
b.exists;
|
|
1554
|
-
b.setDefaultNamespace;
|
|
1555
|
-
b.hasLoadedNamespace;
|
|
1556
|
-
b.loadNamespaces;
|
|
1557
|
-
b.loadLanguages;
|
|
1558
|
-
const Qe = {
|
|
17
|
+
const C = {
|
|
1559
18
|
es: {
|
|
1560
19
|
translation: {
|
|
1561
|
-
...
|
|
20
|
+
...v
|
|
1562
21
|
}
|
|
1563
22
|
}
|
|
1564
23
|
};
|
|
1565
|
-
|
|
1566
|
-
resources:
|
|
24
|
+
P.init({
|
|
25
|
+
resources: C,
|
|
1567
26
|
lng: "es",
|
|
1568
27
|
// language to use, more information here: https://www.i18next.com/overview/configuration-options#languages-namespaces-resources
|
|
1569
28
|
// you can use the i18n.changeLanguage function to change the language manually: https://www.i18next.com/overview/api#changelanguage
|
|
@@ -1575,7 +34,7 @@ b.init({
|
|
|
1575
34
|
},
|
|
1576
35
|
debug: !1
|
|
1577
36
|
});
|
|
1578
|
-
const
|
|
37
|
+
const h = {
|
|
1579
38
|
// EXAMPLE ERROR
|
|
1580
39
|
"MP-001": {
|
|
1581
40
|
code: 400,
|
|
@@ -1613,36 +72,36 @@ const C = {
|
|
|
1613
72
|
level: "warning"
|
|
1614
73
|
}
|
|
1615
74
|
};
|
|
1616
|
-
class
|
|
1617
|
-
get(
|
|
1618
|
-
var
|
|
1619
|
-
if (
|
|
1620
|
-
return this.logError(
|
|
1621
|
-
...
|
|
1622
|
-
title:
|
|
1623
|
-
message:
|
|
75
|
+
class U extends J {
|
|
76
|
+
get(r = "default", t) {
|
|
77
|
+
var o, i;
|
|
78
|
+
if (r instanceof Error)
|
|
79
|
+
return this.logError(r.message), {
|
|
80
|
+
...h.internalError,
|
|
81
|
+
title: E(h.internalError.title),
|
|
82
|
+
message: E(h.internalError.message),
|
|
1624
83
|
uuid: t
|
|
1625
84
|
};
|
|
1626
|
-
const
|
|
85
|
+
const e = typeof r == "string" ? r : r.code ?? r.errorType, n = typeof r == "string" ? {} : { ...r };
|
|
1627
86
|
return {
|
|
1628
|
-
...
|
|
1629
|
-
title:
|
|
1630
|
-
((
|
|
87
|
+
...h[e] ?? h.default,
|
|
88
|
+
title: E(
|
|
89
|
+
((o = h[e]) == null ? void 0 : o.title) ?? h.default.title,
|
|
1631
90
|
n
|
|
1632
91
|
),
|
|
1633
|
-
message:
|
|
1634
|
-
((
|
|
92
|
+
message: E(
|
|
93
|
+
((i = h[e]) == null ? void 0 : i.message) ?? h.default.message,
|
|
1635
94
|
n
|
|
1636
95
|
),
|
|
1637
96
|
uuid: t
|
|
1638
97
|
};
|
|
1639
98
|
}
|
|
1640
99
|
}
|
|
1641
|
-
class
|
|
100
|
+
class ct extends H {
|
|
1642
101
|
constructor() {
|
|
1643
102
|
super(...arguments);
|
|
1644
|
-
|
|
1645
|
-
|
|
103
|
+
g(this, "uuid", "");
|
|
104
|
+
g(this, "session", null);
|
|
1646
105
|
}
|
|
1647
106
|
setSession(t) {
|
|
1648
107
|
this.session = t;
|
|
@@ -1650,92 +109,206 @@ class ot extends $e {
|
|
|
1650
109
|
getSession() {
|
|
1651
110
|
return this.session;
|
|
1652
111
|
}
|
|
1653
|
-
returnData(t,
|
|
1654
|
-
const
|
|
1655
|
-
t.status(200).json(
|
|
112
|
+
returnData(t, e, n) {
|
|
113
|
+
const o = this.encode(e, n);
|
|
114
|
+
t.status(200).json(o);
|
|
1656
115
|
}
|
|
1657
|
-
returnError(t,
|
|
1658
|
-
return
|
|
116
|
+
returnError(t, e) {
|
|
117
|
+
return e != null && e.uuid ? t.status(520).json(e) : t.status(520).json(new U().get(e, this.uuid));
|
|
1659
118
|
}
|
|
1660
119
|
get(t) {
|
|
1661
|
-
return this.logDebug("get ApiMiddleware"), (
|
|
1662
|
-
var
|
|
1663
|
-
this.logDebug("return ApiMiddleware"), this.uuid = (
|
|
1664
|
-
|
|
1665
|
-
(
|
|
1666
|
-
params:
|
|
1667
|
-
headers:
|
|
120
|
+
return this.logDebug("get ApiMiddleware"), (e, n) => {
|
|
121
|
+
var o;
|
|
122
|
+
this.logDebug("return ApiMiddleware"), this.uuid = (o = e == null ? void 0 : e.body) == null ? void 0 : o.uuid, d(e).pipe(
|
|
123
|
+
m(
|
|
124
|
+
(i) => O({
|
|
125
|
+
params: d(this.decode(i.body)),
|
|
126
|
+
headers: d(i.headers)
|
|
1668
127
|
})
|
|
1669
128
|
),
|
|
1670
|
-
|
|
1671
|
-
({ params:
|
|
1672
|
-
response: t(
|
|
1673
|
-
headers:
|
|
1674
|
-
params:
|
|
129
|
+
m(
|
|
130
|
+
({ params: i, headers: a }) => O({
|
|
131
|
+
response: t(i, this.uuid, a),
|
|
132
|
+
headers: d(a),
|
|
133
|
+
params: d(i)
|
|
1675
134
|
})
|
|
1676
135
|
),
|
|
1677
|
-
|
|
1678
|
-
`ApiMiddleware \x1B[37m <URL>: \x1B[33m ${
|
|
1679
|
-
),
|
|
1680
|
-
|
|
1681
|
-
var
|
|
136
|
+
m(({ params: i, response: a, headers: f }) => (this.logDebug(
|
|
137
|
+
`ApiMiddleware \x1B[37m <URL>: \x1B[33m ${e.url} \x1B[37m <HEADERS>: \x1B[33m ${JSON.stringify(f)} \x1B[37m <UUID> \x1B[33m ${e.body.uuid} \x1B[37m <PARAMS> \x1B[33m ${JSON.stringify(i)} \x1B[37m <RESPONSE>: \x1B[33m ${JSON.stringify(a)}`
|
|
138
|
+
), d(a))),
|
|
139
|
+
D((i) => {
|
|
140
|
+
var a;
|
|
1682
141
|
return this.logError(
|
|
1683
|
-
`ApiMiddleware <URL>: ${
|
|
1684
|
-
), this.returnError(n,
|
|
142
|
+
`ApiMiddleware <URL>: ${e == null ? void 0 : e.url} <HEADERS>: ${JSON.stringify(e == null ? void 0 : e.headers)} <UUID> ${(a = e == null ? void 0 : e.body) == null ? void 0 : a.uuid} <PARAMS> ${JSON.stringify(e == null ? void 0 : e.body)} <ERROR>: ${JSON.stringify(i)}`
|
|
143
|
+
), this.returnError(n, i), N;
|
|
1685
144
|
})
|
|
1686
145
|
).subscribe({
|
|
1687
|
-
next: (
|
|
1688
|
-
this.logDebug("ApiMiddleware subscribe next", JSON.stringify(
|
|
146
|
+
next: (i) => {
|
|
147
|
+
this.logDebug("ApiMiddleware subscribe next", JSON.stringify(i)), this.returnData(n, i, this.uuid);
|
|
1689
148
|
}
|
|
1690
149
|
});
|
|
1691
150
|
};
|
|
1692
151
|
}
|
|
1693
152
|
}
|
|
1694
|
-
|
|
1695
|
-
|
|
153
|
+
const F = process.env.ID_FRONT ?? "NOT_AVAILABLE";
|
|
154
|
+
class dt extends M {
|
|
155
|
+
constructor(t, e) {
|
|
1696
156
|
super();
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
this.apiUrl = t, this.method =
|
|
157
|
+
g(this, "apiUrl");
|
|
158
|
+
g(this, "method");
|
|
159
|
+
this.apiUrl = t, this.method = e ?? "POST";
|
|
1700
160
|
}
|
|
1701
|
-
errorHandler(t,
|
|
161
|
+
errorHandler(t, e) {
|
|
1702
162
|
if (t != null && t.errors)
|
|
1703
|
-
throw new
|
|
163
|
+
throw new U().get(t.errors[0], e);
|
|
1704
164
|
return !(t != null && t.errors);
|
|
1705
165
|
}
|
|
1706
|
-
|
|
1707
|
-
return
|
|
1708
|
-
|
|
1709
|
-
|
|
166
|
+
formatParams(t) {
|
|
167
|
+
return JSON.stringify({
|
|
168
|
+
data: {
|
|
169
|
+
type: F,
|
|
170
|
+
attributes: t
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
fetchData(t = {}, e) {
|
|
175
|
+
return this.getHeaders().pipe(
|
|
176
|
+
m(
|
|
177
|
+
(n) => y(this.apiUrl, {
|
|
178
|
+
method: "POST",
|
|
179
|
+
headers: n,
|
|
180
|
+
body: this.formatParams(t),
|
|
181
|
+
selector: (o) => o.json()
|
|
182
|
+
}).pipe(
|
|
183
|
+
m((o) => (this.logDebug(
|
|
184
|
+
`FetchServiceBE \x1B[37m <URL>: \x1B[33m ${this.apiUrl} \x1B[37m <UUID>: \x1B[33m ${e} \x1B[37m <HEADERS>: \x1B[33m ${JSON.stringify(
|
|
185
|
+
n
|
|
186
|
+
)} \x1B[37m <BODY>: \x1B[33m ${JSON.stringify(
|
|
187
|
+
this.formatParams(t)
|
|
188
|
+
)} \x1B[37m <RESPONSE>: \x1B[33m ${JSON.stringify(o)} \x1B[33m`
|
|
189
|
+
), d(o)))
|
|
190
|
+
)
|
|
1710
191
|
),
|
|
1711
|
-
|
|
1712
|
-
|
|
192
|
+
$((n) => this.errorHandler(n, e))
|
|
193
|
+
);
|
|
194
|
+
}
|
|
195
|
+
fetchCustomData(t = {}, e) {
|
|
196
|
+
return this.getHeaders().pipe(
|
|
197
|
+
m(
|
|
198
|
+
(n) => y(this.apiUrl, {
|
|
1713
199
|
method: this.method,
|
|
1714
|
-
headers:
|
|
1715
|
-
body: this.method === "GET" ? null : JSON.stringify(
|
|
1716
|
-
selector: (
|
|
200
|
+
headers: n,
|
|
201
|
+
body: this.method === "GET" ? null : JSON.stringify(t),
|
|
202
|
+
selector: (o) => o.json()
|
|
1717
203
|
}).pipe(
|
|
1718
|
-
|
|
1719
|
-
`FetchServiceBE \x1B[37m <URL>: \x1B[33m ${this.apiUrl} \x1B[37m <UUID>: \x1B[33m ${
|
|
1720
|
-
r
|
|
1721
|
-
)} \x1B[37m <BODY>: \x1B[33m ${JSON.stringify(
|
|
204
|
+
m((o) => (this.logDebug(
|
|
205
|
+
`FetchServiceBE \x1B[37m <URL>: \x1B[33m ${this.apiUrl} \x1B[37m \x1B[37m <METHOD>: \x1B[33m ${this.method} <UUID>: \x1B[33m ${e} \x1B[37m <HEADERS>: \x1B[33m ${JSON.stringify(
|
|
1722
206
|
n
|
|
1723
|
-
)} \x1B[37m <
|
|
1724
|
-
|
|
207
|
+
)} \x1B[37m <BODY>: \x1B[33m ${JSON.stringify(
|
|
208
|
+
t
|
|
209
|
+
)} \x1B[37m <RESPONSE>: \x1B[33m ${JSON.stringify(o)} \x1B[33m`
|
|
210
|
+
), d(o)))
|
|
1725
211
|
)
|
|
1726
|
-
)
|
|
1727
|
-
be((n) => this.errorHandler(n, s))
|
|
212
|
+
)
|
|
1728
213
|
);
|
|
1729
214
|
}
|
|
1730
215
|
}
|
|
1731
|
-
|
|
1732
|
-
|
|
216
|
+
const G = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
|
|
217
|
+
function Y(s) {
|
|
218
|
+
return typeof s == "string" && G.test(s);
|
|
219
|
+
}
|
|
220
|
+
function k(s) {
|
|
221
|
+
if (!Y(s))
|
|
222
|
+
throw TypeError("Invalid UUID");
|
|
223
|
+
let r;
|
|
224
|
+
const t = new Uint8Array(16);
|
|
225
|
+
return t[0] = (r = parseInt(s.slice(0, 8), 16)) >>> 24, t[1] = r >>> 16 & 255, t[2] = r >>> 8 & 255, t[3] = r & 255, t[4] = (r = parseInt(s.slice(9, 13), 16)) >>> 8, t[5] = r & 255, t[6] = (r = parseInt(s.slice(14, 18), 16)) >>> 8, t[7] = r & 255, t[8] = (r = parseInt(s.slice(19, 23), 16)) >>> 8, t[9] = r & 255, t[10] = (r = parseInt(s.slice(24, 36), 16)) / 1099511627776 & 255, t[11] = r / 4294967296 & 255, t[12] = r >>> 24 & 255, t[13] = r >>> 16 & 255, t[14] = r >>> 8 & 255, t[15] = r & 255, t;
|
|
226
|
+
}
|
|
227
|
+
function _(s) {
|
|
228
|
+
s = unescape(encodeURIComponent(s));
|
|
229
|
+
const r = [];
|
|
230
|
+
for (let t = 0; t < s.length; ++t)
|
|
231
|
+
r.push(s.charCodeAt(t));
|
|
232
|
+
return r;
|
|
233
|
+
}
|
|
234
|
+
const V = "6ba7b810-9dad-11d1-80b4-00c04fd430c8", K = "6ba7b811-9dad-11d1-80b4-00c04fd430c8";
|
|
235
|
+
function W(s, r, t) {
|
|
236
|
+
function e(n, o, i, a) {
|
|
237
|
+
var f;
|
|
238
|
+
if (typeof n == "string" && (n = _(n)), typeof o == "string" && (o = k(o)), ((f = o) === null || f === void 0 ? void 0 : f.length) !== 16)
|
|
239
|
+
throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");
|
|
240
|
+
let c = new Uint8Array(16 + n.length);
|
|
241
|
+
if (c.set(o), c.set(n, o.length), c = t(c), c[6] = c[6] & 15 | r, c[8] = c[8] & 63 | 128, i) {
|
|
242
|
+
a = a || 0;
|
|
243
|
+
for (let u = 0; u < 16; ++u)
|
|
244
|
+
i[a + u] = c[u];
|
|
245
|
+
return i;
|
|
246
|
+
}
|
|
247
|
+
return j(c);
|
|
248
|
+
}
|
|
249
|
+
try {
|
|
250
|
+
e.name = s;
|
|
251
|
+
} catch {
|
|
252
|
+
}
|
|
253
|
+
return e.DNS = V, e.URL = K, e;
|
|
254
|
+
}
|
|
255
|
+
function X(s, r, t, e) {
|
|
256
|
+
switch (s) {
|
|
257
|
+
case 0:
|
|
258
|
+
return r & t ^ ~r & e;
|
|
259
|
+
case 1:
|
|
260
|
+
return r ^ t ^ e;
|
|
261
|
+
case 2:
|
|
262
|
+
return r & t ^ r & e ^ t & e;
|
|
263
|
+
case 3:
|
|
264
|
+
return r ^ t ^ e;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
function B(s, r) {
|
|
268
|
+
return s << r | s >>> 32 - r;
|
|
269
|
+
}
|
|
270
|
+
function Z(s) {
|
|
271
|
+
const r = [1518500249, 1859775393, 2400959708, 3395469782], t = [1732584193, 4023233417, 2562383102, 271733878, 3285377520];
|
|
272
|
+
if (typeof s == "string") {
|
|
273
|
+
const i = unescape(encodeURIComponent(s));
|
|
274
|
+
s = [];
|
|
275
|
+
for (let a = 0; a < i.length; ++a)
|
|
276
|
+
s.push(i.charCodeAt(a));
|
|
277
|
+
} else
|
|
278
|
+
Array.isArray(s) || (s = Array.prototype.slice.call(s));
|
|
279
|
+
s.push(128);
|
|
280
|
+
const e = s.length / 4 + 2, n = Math.ceil(e / 16), o = new Array(n);
|
|
281
|
+
for (let i = 0; i < n; ++i) {
|
|
282
|
+
const a = new Uint32Array(16);
|
|
283
|
+
for (let f = 0; f < 16; ++f)
|
|
284
|
+
a[f] = s[i * 64 + f * 4] << 24 | s[i * 64 + f * 4 + 1] << 16 | s[i * 64 + f * 4 + 2] << 8 | s[i * 64 + f * 4 + 3];
|
|
285
|
+
o[i] = a;
|
|
286
|
+
}
|
|
287
|
+
o[n - 1][14] = (s.length - 1) * 8 / Math.pow(2, 32), o[n - 1][14] = Math.floor(o[n - 1][14]), o[n - 1][15] = (s.length - 1) * 8 & 4294967295;
|
|
288
|
+
for (let i = 0; i < n; ++i) {
|
|
289
|
+
const a = new Uint32Array(80);
|
|
290
|
+
for (let l = 0; l < 16; ++l)
|
|
291
|
+
a[l] = o[i][l];
|
|
292
|
+
for (let l = 16; l < 80; ++l)
|
|
293
|
+
a[l] = B(a[l - 3] ^ a[l - 8] ^ a[l - 14] ^ a[l - 16], 1);
|
|
294
|
+
let f = t[0], c = t[1], u = t[2], x = t[3], S = t[4];
|
|
295
|
+
for (let l = 0; l < 80; ++l) {
|
|
296
|
+
const R = Math.floor(l / 20), w = B(f, 5) + X(R, c, u, x) + S + r[R] + a[l] >>> 0;
|
|
297
|
+
S = x, x = u, u = B(c, 30) >>> 0, c = f, f = w;
|
|
298
|
+
}
|
|
299
|
+
t[0] = t[0] + f >>> 0, t[1] = t[1] + c >>> 0, t[2] = t[2] + u >>> 0, t[3] = t[3] + x >>> 0, t[4] = t[4] + S >>> 0;
|
|
300
|
+
}
|
|
301
|
+
return [t[0] >> 24 & 255, t[0] >> 16 & 255, t[0] >> 8 & 255, t[0] & 255, t[1] >> 24 & 255, t[1] >> 16 & 255, t[1] >> 8 & 255, t[1] & 255, t[2] >> 24 & 255, t[2] >> 16 & 255, t[2] >> 8 & 255, t[2] & 255, t[3] >> 24 & 255, t[3] >> 16 & 255, t[3] >> 8 & 255, t[3] & 255, t[4] >> 24 & 255, t[4] >> 16 & 255, t[4] >> 8 & 255, t[4] & 255];
|
|
302
|
+
}
|
|
303
|
+
const Q = W("v5", 80, Z), b = Q;
|
|
304
|
+
class mt extends T {
|
|
305
|
+
constructor(t, e = "POST", n = {}) {
|
|
1733
306
|
super();
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
this.apiUrl = t, this.method =
|
|
307
|
+
g(this, "apiUrl");
|
|
308
|
+
g(this, "method");
|
|
309
|
+
g(this, "headers");
|
|
310
|
+
g(this, "isLoadingEnabled", !0);
|
|
311
|
+
this.apiUrl = t, this.method = e, this.headers = {
|
|
1739
312
|
"Content-Type": "application/json",
|
|
1740
313
|
...n
|
|
1741
314
|
};
|
|
@@ -1744,37 +317,37 @@ class ut extends Ce {
|
|
|
1744
317
|
this.isLoadingEnabled = t;
|
|
1745
318
|
}
|
|
1746
319
|
errorHandler(t) {
|
|
1747
|
-
return t.code && (
|
|
320
|
+
return t.code && (A.getInstance().setSubject(t), p.getInstance().setSubject(!1)), !t.code;
|
|
1748
321
|
}
|
|
1749
322
|
fetchData(t = {}) {
|
|
1750
|
-
const
|
|
1751
|
-
|
|
1752
|
-
const
|
|
1753
|
-
return
|
|
323
|
+
const e = (/* @__PURE__ */ new Date()).toISOString(), n = b(e, b.URL), o = this.encode({ ...t }, n);
|
|
324
|
+
p.getInstance().setSubject(this.isLoadingEnabled);
|
|
325
|
+
const a = new URLSearchParams(window.location.search).get("flow") ?? "N/A";
|
|
326
|
+
return y(this.apiUrl, {
|
|
1754
327
|
method: this.method,
|
|
1755
|
-
headers: { ...this.headers, flow:
|
|
1756
|
-
body:
|
|
1757
|
-
selector: (
|
|
328
|
+
headers: { ...this.headers, flow: a },
|
|
329
|
+
body: o,
|
|
330
|
+
selector: (f) => f.json()
|
|
1758
331
|
}).pipe(
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
`FetchServiceFE <URL>: ${this.apiUrl} <HEADERS>: ${JSON.stringify(this.headers)} <PARAMS> ${JSON.stringify(t)} <BODY> ${
|
|
1762
|
-
),
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
new
|
|
1767
|
-
),
|
|
332
|
+
m((f) => d(this.decode(f))),
|
|
333
|
+
m((f) => (this.logDebug(
|
|
334
|
+
`FetchServiceFE <URL>: ${this.apiUrl} <HEADERS>: ${JSON.stringify(this.headers)} <PARAMS> ${JSON.stringify(t)} <BODY> ${o} <RESPONSE>: ${JSON.stringify(f)}`
|
|
335
|
+
), d(f))),
|
|
336
|
+
$(this.errorHandler),
|
|
337
|
+
m((f) => (p.getInstance().setSubject(!1), d(f))),
|
|
338
|
+
D((f) => (p.getInstance().setSubject(!1), A.getInstance().setSubject(
|
|
339
|
+
new U().get(f, n)
|
|
340
|
+
), N))
|
|
1768
341
|
);
|
|
1769
342
|
}
|
|
1770
343
|
}
|
|
1771
344
|
export {
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
345
|
+
ct as ApiMiddleware,
|
|
346
|
+
U as ErrorCatalog,
|
|
347
|
+
dt as FetchServiceBE,
|
|
348
|
+
mt as FetchServiceFE,
|
|
349
|
+
p as LoadingHandler,
|
|
350
|
+
A as MessageHandler,
|
|
351
|
+
pt as RxSubjectManager,
|
|
1779
352
|
ht as ServiceToken
|
|
1780
353
|
};
|