@pie-element/categorize 13.1.2-next.5 → 13.1.2-next.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/author/defaults.d.ts +0 -1
- package/dist/author/defaults.js +2 -4
- package/dist/author/design/buttons.js +3 -3
- package/dist/author/design/categories/alternateResponses.js +2 -2
- package/dist/author/design/categories/category.js +2 -2
- package/dist/author/design/categories/choice-preview.js +1 -1
- package/dist/author/design/categories/droppable-placeholder.js +1 -1
- package/dist/author/design/categories/index.js +3 -3
- package/dist/author/design/choices/choice.js +2 -2
- package/dist/author/design/choices/config.js +1 -1
- package/dist/author/design/choices/index.js +3 -3
- package/dist/author/design/header.js +1 -1
- package/dist/author/design/index.js +78 -68
- package/dist/author/design/input-header.js +1 -1
- package/dist/author/index.d.ts +0 -1
- package/dist/author/index.js +2 -2
- package/dist/author/main.js +2 -2
- package/dist/author/utils.js +1 -1
- package/dist/browser/alert-dialog-BtccZZm9.js +11509 -0
- package/dist/browser/alert-dialog-BtccZZm9.js.map +1 -0
- package/dist/browser/author/index.js +41841 -834
- package/dist/browser/author/index.js.map +1 -1
- package/dist/browser/controller/index.js +196 -123
- package/dist/browser/controller/index.js.map +1 -1
- package/dist/browser/delivery/index.js +294 -293
- package/dist/browser/delivery/index.js.map +1 -1
- package/dist/browser/{dist-DnGF41FP.js → dist-C11U2GIc.js} +301 -388
- package/dist/browser/dist-C11U2GIc.js.map +1 -0
- package/dist/browser/rolldown-runtime-CWhphoD1.js +32 -0
- package/dist/controller/defaults.d.ts +0 -1
- package/dist/controller/defaults.js +2 -4
- package/dist/controller/index.d.ts +1 -0
- package/dist/controller/index.js +92 -79
- package/dist/delivery/categorize/categories.js +3 -3
- package/dist/delivery/categorize/category.js +1 -1
- package/dist/delivery/categorize/choice.js +1 -1
- package/dist/delivery/categorize/choices.js +1 -1
- package/dist/delivery/categorize/grid-content.js +1 -1
- package/dist/delivery/categorize/index.js +3 -3
- package/dist/delivery/index.js +2 -2
- package/dist/index.iife.js +33 -33
- package/package.json +17 -10
- package/dist/browser/dist-7UsF60Ks.js +0 -55705
- package/dist/browser/dist-7UsF60Ks.js.map +0 -1
- package/dist/browser/dist-DnGF41FP.js.map +0 -1
|
@@ -1,33 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
case "react": return __pieBrowserCjsReactRequire;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
default:
|
|
10
|
-
throw new Error(`Unsupported browser CJS require: ${specifier}`);
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
|
-
//#region \0rolldown/runtime.js
|
|
14
|
-
var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescriptor, r = Object.getOwnPropertyNames, i = Object.getPrototypeOf, a = Object.prototype.hasOwnProperty, o = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), s = (e, n) => {
|
|
15
|
-
let r = {};
|
|
16
|
-
for (var i in e) t(r, i, {
|
|
17
|
-
get: e[i],
|
|
18
|
-
enumerable: !0
|
|
19
|
-
});
|
|
20
|
-
return n || t(r, Symbol.toStringTag, { value: "Module" }), r;
|
|
21
|
-
}, c = (e, i, o, s) => {
|
|
22
|
-
if (i && typeof i == "object" || typeof i == "function") for (var c = r(i), l = 0, u = c.length, d; l < u; l++) d = c[l], !a.call(e, d) && d !== o && t(e, d, {
|
|
23
|
-
get: ((e) => i[e]).bind(null, d),
|
|
24
|
-
enumerable: !(s = n(i, d)) || s.enumerable
|
|
25
|
-
});
|
|
26
|
-
return e;
|
|
27
|
-
}, l = (n, r, a) => (a = n == null ? {} : e(i(n)), c(r || !n || !n.__esModule ? t(a, "default", {
|
|
28
|
-
value: n,
|
|
29
|
-
enumerable: !0
|
|
30
|
-
}) : a, n)), u = __pieBrowserCjsRequire, d = /* @__PURE__ */ o(((e, t) => {
|
|
1
|
+
import { i as e, t } from "./rolldown-runtime-CWhphoD1.js";
|
|
2
|
+
//#region ../../../node_modules/.bun/ms@2.1.3/node_modules/ms/index.js
|
|
3
|
+
var n = /* @__PURE__ */ t(((e, t) => {
|
|
31
4
|
var n = 1e3, r = n * 60, i = r * 60, a = i * 24, o = a * 7, s = a * 365.25;
|
|
32
5
|
t.exports = function(e, t) {
|
|
33
6
|
t ||= {};
|
|
@@ -90,54 +63,54 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
|
|
|
90
63
|
var i = t >= n * 1.5;
|
|
91
64
|
return Math.round(e / n) + " " + r + (i ? "s" : "");
|
|
92
65
|
}
|
|
93
|
-
})),
|
|
94
|
-
function
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}),
|
|
66
|
+
})), r = /* @__PURE__ */ t(((e, t) => {
|
|
67
|
+
function r(e) {
|
|
68
|
+
r.debug = r, r.default = r, r.coerce = l, r.disable = s, r.enable = a, r.enabled = c, r.humanize = n(), r.destroy = u, Object.keys(e).forEach((t) => {
|
|
69
|
+
r[t] = e[t];
|
|
70
|
+
}), r.names = [], r.skips = [], r.formatters = {};
|
|
98
71
|
function t(e) {
|
|
99
72
|
let t = 0;
|
|
100
73
|
for (let n = 0; n < e.length; n++) t = (t << 5) - t + e.charCodeAt(n), t |= 0;
|
|
101
|
-
return
|
|
74
|
+
return r.colors[Math.abs(t) % r.colors.length];
|
|
102
75
|
}
|
|
103
|
-
|
|
104
|
-
function
|
|
105
|
-
let t,
|
|
76
|
+
r.selectColor = t;
|
|
77
|
+
function r(e) {
|
|
78
|
+
let t, n = null, a, o;
|
|
106
79
|
function s(...e) {
|
|
107
80
|
if (!s.enabled) return;
|
|
108
|
-
let
|
|
109
|
-
|
|
81
|
+
let n = s, i = Number(/* @__PURE__ */ new Date());
|
|
82
|
+
n.diff = i - (t || i), n.prev = t, n.curr = i, t = i, e[0] = r.coerce(e[0]), typeof e[0] != "string" && e.unshift("%O");
|
|
110
83
|
let a = 0;
|
|
111
84
|
e[0] = e[0].replace(/%([a-zA-Z%])/g, (t, i) => {
|
|
112
85
|
if (t === "%%") return "%";
|
|
113
86
|
a++;
|
|
114
|
-
let o =
|
|
87
|
+
let o = r.formatters[i];
|
|
115
88
|
if (typeof o == "function") {
|
|
116
|
-
let
|
|
117
|
-
t = o.call(
|
|
89
|
+
let r = e[a];
|
|
90
|
+
t = o.call(n, r), e.splice(a, 1), a--;
|
|
118
91
|
}
|
|
119
92
|
return t;
|
|
120
|
-
}),
|
|
93
|
+
}), r.formatArgs.call(n, e), (n.log || r.log).apply(n, e);
|
|
121
94
|
}
|
|
122
|
-
return s.namespace = e, s.useColors =
|
|
95
|
+
return s.namespace = e, s.useColors = r.useColors(), s.color = r.selectColor(e), s.extend = i, s.destroy = r.destroy, Object.defineProperty(s, "enabled", {
|
|
123
96
|
enumerable: !0,
|
|
124
97
|
configurable: !1,
|
|
125
|
-
get: () =>
|
|
98
|
+
get: () => n === null ? (a !== r.namespaces && (a = r.namespaces, o = r.enabled(e)), o) : n,
|
|
126
99
|
set: (e) => {
|
|
127
|
-
|
|
100
|
+
n = e;
|
|
128
101
|
}
|
|
129
|
-
}), typeof
|
|
102
|
+
}), typeof r.init == "function" && r.init(s), s;
|
|
130
103
|
}
|
|
131
|
-
function
|
|
132
|
-
let
|
|
133
|
-
return
|
|
104
|
+
function i(e, t) {
|
|
105
|
+
let n = r(this.namespace + (t === void 0 ? ":" : t) + e);
|
|
106
|
+
return n.log = this.log, n;
|
|
134
107
|
}
|
|
135
|
-
function
|
|
136
|
-
|
|
108
|
+
function a(e) {
|
|
109
|
+
r.save(e), r.namespaces = e, r.names = [], r.skips = [];
|
|
137
110
|
let t = (typeof e == "string" ? e : "").trim().replace(/\s+/g, ",").split(",").filter(Boolean);
|
|
138
|
-
for (let e of t) e[0] === "-" ?
|
|
111
|
+
for (let e of t) e[0] === "-" ? r.skips.push(e.slice(1)) : r.names.push(e);
|
|
139
112
|
}
|
|
140
|
-
function
|
|
113
|
+
function o(e, t) {
|
|
141
114
|
let n = 0, r = 0, i = -1, a = 0;
|
|
142
115
|
for (; n < e.length;) if (r < t.length && (t[r] === e[n] || t[r] === "*")) t[r] === "*" ? (i = r, a = n, r++) : (n++, r++);
|
|
143
116
|
else if (i !== -1) r = i + 1, a++, n = a;
|
|
@@ -145,26 +118,26 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
|
|
|
145
118
|
for (; r < t.length && t[r] === "*";) r++;
|
|
146
119
|
return r === t.length;
|
|
147
120
|
}
|
|
148
|
-
function
|
|
149
|
-
let e = [...
|
|
150
|
-
return
|
|
121
|
+
function s() {
|
|
122
|
+
let e = [...r.names, ...r.skips.map((e) => "-" + e)].join(",");
|
|
123
|
+
return r.enable(""), e;
|
|
151
124
|
}
|
|
152
|
-
function
|
|
153
|
-
for (let t of
|
|
154
|
-
for (let t of
|
|
125
|
+
function c(e) {
|
|
126
|
+
for (let t of r.skips) if (o(e, t)) return !1;
|
|
127
|
+
for (let t of r.names) if (o(e, t)) return !0;
|
|
155
128
|
return !1;
|
|
156
129
|
}
|
|
157
|
-
function
|
|
130
|
+
function l(e) {
|
|
158
131
|
return e instanceof Error ? e.stack || e.message : e;
|
|
159
132
|
}
|
|
160
|
-
function
|
|
133
|
+
function u() {
|
|
161
134
|
console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
|
|
162
135
|
}
|
|
163
|
-
return
|
|
136
|
+
return r.enable(r.load()), r;
|
|
164
137
|
}
|
|
165
|
-
t.exports =
|
|
166
|
-
})),
|
|
167
|
-
e.formatArgs =
|
|
138
|
+
t.exports = r;
|
|
139
|
+
})), i = /* @__PURE__ */ t(((e, t) => {
|
|
140
|
+
e.formatArgs = i, e.save = a, e.load = o, e.useColors = n, e.storage = s(), e.destroy = (() => {
|
|
168
141
|
let e = !1;
|
|
169
142
|
return () => {
|
|
170
143
|
e || (e = !0, console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."));
|
|
@@ -176,7 +149,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
|
|
|
176
149
|
let e;
|
|
177
150
|
return typeof document < "u" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || typeof window < "u" && window.console && (window.console.firebug || window.console.exception && window.console.table) || typeof navigator < "u" && navigator.userAgent && (e = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(e[1], 10) >= 31 || typeof navigator < "u" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
|
|
178
151
|
}
|
|
179
|
-
function
|
|
152
|
+
function i(e) {
|
|
180
153
|
if (e[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + e[0] + (this.useColors ? "%c " : " ") + "+" + t.exports.humanize(this.diff), !this.useColors) return;
|
|
181
154
|
let n = "color: " + this.color;
|
|
182
155
|
e.splice(1, 0, n, "color: inherit");
|
|
@@ -186,33 +159,33 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
|
|
|
186
159
|
}), e.splice(i, 0, n);
|
|
187
160
|
}
|
|
188
161
|
e.log = console.debug || console.log || (() => {});
|
|
189
|
-
function
|
|
162
|
+
function a(t) {
|
|
190
163
|
try {
|
|
191
164
|
t ? e.storage.setItem("debug", t) : e.storage.removeItem("debug");
|
|
192
165
|
} catch {}
|
|
193
166
|
}
|
|
194
|
-
function
|
|
167
|
+
function o() {
|
|
195
168
|
let t;
|
|
196
169
|
try {
|
|
197
170
|
t = e.storage.getItem("debug") || e.storage.getItem("DEBUG");
|
|
198
171
|
} catch {}
|
|
199
172
|
return !t && typeof process < "u" && "env" in process && (t = process.env.DEBUG), t;
|
|
200
173
|
}
|
|
201
|
-
function
|
|
174
|
+
function s() {
|
|
202
175
|
try {
|
|
203
176
|
return localStorage;
|
|
204
177
|
} catch {}
|
|
205
178
|
}
|
|
206
|
-
t.exports =
|
|
207
|
-
var { formatters:
|
|
208
|
-
|
|
179
|
+
t.exports = r()(e);
|
|
180
|
+
var { formatters: c } = t.exports;
|
|
181
|
+
c.j = function(e) {
|
|
209
182
|
try {
|
|
210
183
|
return JSON.stringify(e);
|
|
211
184
|
} catch (e) {
|
|
212
185
|
return "[UnexpectedJSONParseError]: " + e.message;
|
|
213
186
|
}
|
|
214
187
|
};
|
|
215
|
-
})),
|
|
188
|
+
})), a = {
|
|
216
189
|
translation: {
|
|
217
190
|
categorize: {
|
|
218
191
|
limitMaxChoicesPerCategory: "You've reached the limit of {{maxChoicesPerCategory}} responses per area. To add another response, one must first be removed.",
|
|
@@ -301,7 +274,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
|
|
|
301
274
|
hideNote: "Hide Note",
|
|
302
275
|
cancel: "Cancel"
|
|
303
276
|
}
|
|
304
|
-
},
|
|
277
|
+
}, o = {
|
|
305
278
|
translation: {
|
|
306
279
|
categorize: {
|
|
307
280
|
limitMaxChoicesPerCategory: "Has alcanzado el límite de {{maxChoicesPerCategory}} respuestas por área. Para agregar otra respuesta, primero se debe eliminar una respuesta.",
|
|
@@ -390,55 +363,55 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
|
|
|
390
363
|
hideNote: "Ocultar Nota",
|
|
391
364
|
cancel: "Cancelar"
|
|
392
365
|
}
|
|
393
|
-
},
|
|
366
|
+
}, s = (e) => typeof e == "string", c = () => {
|
|
394
367
|
let e, t, n = new Promise((n, r) => {
|
|
395
368
|
e = n, t = r;
|
|
396
369
|
});
|
|
397
370
|
return n.resolve = e, n.reject = t, n;
|
|
398
|
-
},
|
|
371
|
+
}, l = (e) => e == null ? "" : "" + e, u = (e, t, n) => {
|
|
399
372
|
e.forEach((e) => {
|
|
400
373
|
t[e] && (n[e] = t[e]);
|
|
401
374
|
});
|
|
402
|
-
},
|
|
403
|
-
let r =
|
|
375
|
+
}, d = /###/g, f = (e) => e && e.indexOf("###") > -1 ? e.replace(d, ".") : e, p = (e) => !e || s(e), m = (e, t, n) => {
|
|
376
|
+
let r = s(t) ? t.split(".") : t, i = 0;
|
|
404
377
|
for (; i < r.length - 1;) {
|
|
405
|
-
if (
|
|
406
|
-
let t =
|
|
378
|
+
if (p(e)) return {};
|
|
379
|
+
let t = f(r[i]);
|
|
407
380
|
!e[t] && n && (e[t] = new n()), e = Object.prototype.hasOwnProperty.call(e, t) ? e[t] : {}, ++i;
|
|
408
381
|
}
|
|
409
|
-
return
|
|
382
|
+
return p(e) ? {} : {
|
|
410
383
|
obj: e,
|
|
411
|
-
k:
|
|
384
|
+
k: f(r[i])
|
|
412
385
|
};
|
|
413
|
-
},
|
|
414
|
-
let { obj: r, k: i } =
|
|
386
|
+
}, h = (e, t, n) => {
|
|
387
|
+
let { obj: r, k: i } = m(e, t, Object);
|
|
415
388
|
if (r !== void 0 || t.length === 1) {
|
|
416
389
|
r[i] = n;
|
|
417
390
|
return;
|
|
418
391
|
}
|
|
419
|
-
let a = t[t.length - 1], o = t.slice(0, t.length - 1), s =
|
|
420
|
-
for (; s.obj === void 0 && o.length;) a = `${o[o.length - 1]}.${a}`, o = o.slice(0, o.length - 1), s =
|
|
392
|
+
let a = t[t.length - 1], o = t.slice(0, t.length - 1), s = m(e, o, Object);
|
|
393
|
+
for (; s.obj === void 0 && o.length;) a = `${o[o.length - 1]}.${a}`, o = o.slice(0, o.length - 1), s = m(e, o, Object), s?.obj && s.obj[`${s.k}.${a}`] !== void 0 && (s.obj = void 0);
|
|
421
394
|
s.obj[`${s.k}.${a}`] = n;
|
|
422
|
-
},
|
|
423
|
-
let { obj: i, k: a } =
|
|
395
|
+
}, g = (e, t, n, r) => {
|
|
396
|
+
let { obj: i, k: a } = m(e, t, Object);
|
|
424
397
|
i[a] = i[a] || [], i[a].push(n);
|
|
425
|
-
},
|
|
426
|
-
let { obj: n, k: r } =
|
|
398
|
+
}, _ = (e, t) => {
|
|
399
|
+
let { obj: n, k: r } = m(e, t);
|
|
427
400
|
if (n && Object.prototype.hasOwnProperty.call(n, r)) return n[r];
|
|
428
|
-
},
|
|
429
|
-
let r =
|
|
430
|
-
return r === void 0 ?
|
|
431
|
-
},
|
|
432
|
-
for (let r in t) r !== "__proto__" && r !== "constructor" && (r in e ?
|
|
401
|
+
}, v = (e, t, n) => {
|
|
402
|
+
let r = _(e, n);
|
|
403
|
+
return r === void 0 ? _(t, n) : r;
|
|
404
|
+
}, y = (e, t, n) => {
|
|
405
|
+
for (let r in t) r !== "__proto__" && r !== "constructor" && (r in e ? s(e[r]) || e[r] instanceof String || s(t[r]) || t[r] instanceof String ? n && (e[r] = t[r]) : y(e[r], t[r], n) : e[r] = t[r]);
|
|
433
406
|
return e;
|
|
434
|
-
},
|
|
407
|
+
}, b = (e) => e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"), x = {
|
|
435
408
|
"&": "&",
|
|
436
409
|
"<": "<",
|
|
437
410
|
">": ">",
|
|
438
411
|
"\"": """,
|
|
439
412
|
"'": "'",
|
|
440
413
|
"/": "/"
|
|
441
|
-
},
|
|
414
|
+
}, S = (e) => s(e) ? e.replace(/[&<>"'\/]/g, (e) => x[e]) : e, C = class {
|
|
442
415
|
constructor(e) {
|
|
443
416
|
this.capacity = e, this.regExpMap = /* @__PURE__ */ new Map(), this.regExpQueue = [];
|
|
444
417
|
}
|
|
@@ -448,23 +421,23 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
|
|
|
448
421
|
let n = new RegExp(e);
|
|
449
422
|
return this.regExpQueue.length === this.capacity && this.regExpMap.delete(this.regExpQueue.shift()), this.regExpMap.set(e, n), this.regExpQueue.push(e), n;
|
|
450
423
|
}
|
|
451
|
-
},
|
|
424
|
+
}, w = [
|
|
452
425
|
" ",
|
|
453
426
|
",",
|
|
454
427
|
"?",
|
|
455
428
|
"!",
|
|
456
429
|
";"
|
|
457
|
-
],
|
|
430
|
+
], T = new C(20), E = (e, t, n) => {
|
|
458
431
|
t ||= "", n ||= "";
|
|
459
|
-
let r =
|
|
432
|
+
let r = w.filter((e) => t.indexOf(e) < 0 && n.indexOf(e) < 0);
|
|
460
433
|
if (r.length === 0) return !0;
|
|
461
|
-
let i =
|
|
434
|
+
let i = T.getRegExp(`(${r.map((e) => e === "?" ? "\\?" : e).join("|")})`), a = !i.test(e);
|
|
462
435
|
if (!a) {
|
|
463
436
|
let t = e.indexOf(n);
|
|
464
437
|
t > 0 && !i.test(e.substring(0, t)) && (a = !0);
|
|
465
438
|
}
|
|
466
439
|
return a;
|
|
467
|
-
},
|
|
440
|
+
}, D = (e, t, n = ".") => {
|
|
468
441
|
if (!e) return;
|
|
469
442
|
if (e[t]) return Object.prototype.hasOwnProperty.call(e, t) ? e[t] : void 0;
|
|
470
443
|
let r = t.split(n), i = e;
|
|
@@ -483,7 +456,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
|
|
|
483
456
|
i = t;
|
|
484
457
|
}
|
|
485
458
|
return i;
|
|
486
|
-
},
|
|
459
|
+
}, O = (e) => e?.replace(/_/g, "-"), ee = {
|
|
487
460
|
type: "logger",
|
|
488
461
|
log(e) {
|
|
489
462
|
this.output("log", e);
|
|
@@ -497,12 +470,12 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
|
|
|
497
470
|
output(e, t) {
|
|
498
471
|
console?.[e]?.apply?.(console, t);
|
|
499
472
|
}
|
|
500
|
-
},
|
|
473
|
+
}, k = new class e {
|
|
501
474
|
constructor(e, t = {}) {
|
|
502
475
|
this.init(e, t);
|
|
503
476
|
}
|
|
504
477
|
init(e, t = {}) {
|
|
505
|
-
this.prefix = t.prefix || "i18next:", this.logger = e ||
|
|
478
|
+
this.prefix = t.prefix || "i18next:", this.logger = e || ee, this.options = t, this.debug = t.debug;
|
|
506
479
|
}
|
|
507
480
|
log(...e) {
|
|
508
481
|
return this.forward(e, "log", "", !0);
|
|
@@ -517,7 +490,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
|
|
|
517
490
|
return this.forward(e, "warn", "WARNING DEPRECATED: ", !0);
|
|
518
491
|
}
|
|
519
492
|
forward(e, t, n, r) {
|
|
520
|
-
return r && !this.debug ? null : (
|
|
493
|
+
return r && !this.debug ? null : (s(e[0]) && (e[0] = `${n}${this.prefix} ${e[0]}`), this.logger[t](e));
|
|
521
494
|
}
|
|
522
495
|
create(t) {
|
|
523
496
|
return new e(this.logger, {
|
|
@@ -528,7 +501,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
|
|
|
528
501
|
clone(t) {
|
|
529
502
|
return t ||= this.options, t.prefix = t.prefix || this.prefix, new e(this.logger, t);
|
|
530
503
|
}
|
|
531
|
-
}(),
|
|
504
|
+
}(), A = class {
|
|
532
505
|
constructor() {
|
|
533
506
|
this.observers = {};
|
|
534
507
|
}
|
|
@@ -555,7 +528,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
|
|
|
555
528
|
for (let i = 0; i < r; i++) n.apply(n, [e, ...t]);
|
|
556
529
|
});
|
|
557
530
|
}
|
|
558
|
-
},
|
|
531
|
+
}, j = class extends A {
|
|
559
532
|
constructor(e, t = {
|
|
560
533
|
ns: ["translation"],
|
|
561
534
|
defaultNS: "translation"
|
|
@@ -571,16 +544,16 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
|
|
|
571
544
|
}
|
|
572
545
|
getResource(e, t, n, r = {}) {
|
|
573
546
|
let i = r.keySeparator === void 0 ? this.options.keySeparator : r.keySeparator, a = r.ignoreJSONStructure === void 0 ? this.options.ignoreJSONStructure : r.ignoreJSONStructure, o;
|
|
574
|
-
e.indexOf(".") > -1 ? o = e.split(".") : (o = [e, t], n && (Array.isArray(n) ? o.push(...n) :
|
|
575
|
-
let
|
|
576
|
-
return !
|
|
547
|
+
e.indexOf(".") > -1 ? o = e.split(".") : (o = [e, t], n && (Array.isArray(n) ? o.push(...n) : s(n) && i ? o.push(...n.split(i)) : o.push(n)));
|
|
548
|
+
let c = _(this.data, o);
|
|
549
|
+
return !c && !t && !n && e.indexOf(".") > -1 && (e = o[0], t = o[1], n = o.slice(2).join(".")), c || !a || !s(n) ? c : D(this.data?.[e]?.[t], n, i);
|
|
577
550
|
}
|
|
578
551
|
addResource(e, t, n, r, i = { silent: !1 }) {
|
|
579
552
|
let a = i.keySeparator === void 0 ? this.options.keySeparator : i.keySeparator, o = [e, t];
|
|
580
|
-
n && (o = o.concat(a ? n.split(a) : n)), e.indexOf(".") > -1 && (o = e.split("."), r = t, t = o[1]), this.addNamespaces(t),
|
|
553
|
+
n && (o = o.concat(a ? n.split(a) : n)), e.indexOf(".") > -1 && (o = e.split("."), r = t, t = o[1]), this.addNamespaces(t), h(this.data, o, r), i.silent || this.emit("added", e, t, n, r);
|
|
581
554
|
}
|
|
582
555
|
addResources(e, t, n, r = { silent: !1 }) {
|
|
583
|
-
for (let r in n) (
|
|
556
|
+
for (let r in n) (s(n[r]) || Array.isArray(n[r])) && this.addResource(e, t, r, n[r], { silent: !0 });
|
|
584
557
|
r.silent || this.emit("added", e, t, n);
|
|
585
558
|
}
|
|
586
559
|
addResourceBundle(e, t, n, r, i, a = {
|
|
@@ -589,11 +562,11 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
|
|
|
589
562
|
}) {
|
|
590
563
|
let o = [e, t];
|
|
591
564
|
e.indexOf(".") > -1 && (o = e.split("."), r = n, n = t, t = o[1]), this.addNamespaces(t);
|
|
592
|
-
let s =
|
|
593
|
-
a.skipCopy || (n = JSON.parse(JSON.stringify(n))), r ?
|
|
565
|
+
let s = _(this.data, o) || {};
|
|
566
|
+
a.skipCopy || (n = JSON.parse(JSON.stringify(n))), r ? y(s, n, i) : s = {
|
|
594
567
|
...s,
|
|
595
568
|
...n
|
|
596
|
-
},
|
|
569
|
+
}, h(this.data, o, s), a.silent || this.emit("added", e, t, n);
|
|
597
570
|
}
|
|
598
571
|
removeResourceBundle(e, t) {
|
|
599
572
|
this.hasResourceBundle(e, t) && delete this.data[e][t], this.removeNamespaces(t), this.emit("removed", e, t);
|
|
@@ -614,7 +587,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
|
|
|
614
587
|
toJSON() {
|
|
615
588
|
return this.data;
|
|
616
589
|
}
|
|
617
|
-
},
|
|
590
|
+
}, M = {
|
|
618
591
|
processors: {},
|
|
619
592
|
addPostProcessor(e) {
|
|
620
593
|
this.processors[e.name] = e;
|
|
@@ -624,22 +597,22 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
|
|
|
624
597
|
t = this.processors[e]?.process(t, n, r, i) ?? t;
|
|
625
598
|
}), t;
|
|
626
599
|
}
|
|
627
|
-
},
|
|
628
|
-
function
|
|
600
|
+
}, N = Symbol("i18next/PATH_KEY");
|
|
601
|
+
function te() {
|
|
629
602
|
let e = [], t = Object.create(null), n;
|
|
630
|
-
return t.get = (r, i) => (n?.revoke?.(), i ===
|
|
603
|
+
return t.get = (r, i) => (n?.revoke?.(), i === N ? e : (e.push(i), n = Proxy.revocable(r, t), n.proxy)), Proxy.revocable(Object.create(null), t).proxy;
|
|
631
604
|
}
|
|
632
|
-
function
|
|
633
|
-
let { [
|
|
605
|
+
function P(e, t) {
|
|
606
|
+
let { [N]: n } = e(te()), r = t?.keySeparator ?? ".", i = t?.nsSeparator ?? ":";
|
|
634
607
|
if (n.length > 1 && i) {
|
|
635
608
|
let e = t?.ns, a = Array.isArray(e) ? e : null;
|
|
636
609
|
if (a && a.length > 1 && a.slice(1).includes(n[0])) return `${n[0]}${i}${n.slice(1).join(r)}`;
|
|
637
610
|
}
|
|
638
611
|
return n.join(r);
|
|
639
612
|
}
|
|
640
|
-
var
|
|
613
|
+
var F = {}, I = (e) => !s(e) && typeof e != "boolean" && typeof e != "number", L = class e extends A {
|
|
641
614
|
constructor(e, t = {}) {
|
|
642
|
-
super(),
|
|
615
|
+
super(), u([
|
|
643
616
|
"resourceStore",
|
|
644
617
|
"languageUtils",
|
|
645
618
|
"pluralResolver",
|
|
@@ -647,7 +620,7 @@ var ue = {}, I = (e) => !g(e) && typeof e != "boolean" && typeof e != "number",
|
|
|
647
620
|
"backendConnector",
|
|
648
621
|
"i18nFormat",
|
|
649
622
|
"utils"
|
|
650
|
-
], e, this), this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.logger =
|
|
623
|
+
], e, this), this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.logger = k.create("translator");
|
|
651
624
|
}
|
|
652
625
|
changeLanguage(e) {
|
|
653
626
|
e && (this.language = e);
|
|
@@ -663,90 +636,90 @@ var ue = {}, I = (e) => !g(e) && typeof e != "boolean" && typeof e != "number",
|
|
|
663
636
|
extractFromKey(e, t) {
|
|
664
637
|
let n = t.nsSeparator === void 0 ? this.options.nsSeparator : t.nsSeparator;
|
|
665
638
|
n === void 0 && (n = ":");
|
|
666
|
-
let r = t.keySeparator === void 0 ? this.options.keySeparator : t.keySeparator, i = t.ns || this.options.defaultNS || [], a = n && e.indexOf(n) > -1, o = !this.options.userDefinedKeySeparator && !t.keySeparator && !this.options.userDefinedNsSeparator && !t.nsSeparator && !
|
|
639
|
+
let r = t.keySeparator === void 0 ? this.options.keySeparator : t.keySeparator, i = t.ns || this.options.defaultNS || [], a = n && e.indexOf(n) > -1, o = !this.options.userDefinedKeySeparator && !t.keySeparator && !this.options.userDefinedNsSeparator && !t.nsSeparator && !E(e, n, r);
|
|
667
640
|
if (a && !o) {
|
|
668
641
|
let t = e.match(this.interpolator.nestingRegexp);
|
|
669
642
|
if (t && t.length > 0) return {
|
|
670
643
|
key: e,
|
|
671
|
-
namespaces:
|
|
644
|
+
namespaces: s(i) ? [i] : i
|
|
672
645
|
};
|
|
673
646
|
let a = e.split(n);
|
|
674
647
|
(n !== r || n === r && this.options.ns.indexOf(a[0]) > -1) && (i = a.shift()), e = a.join(r);
|
|
675
648
|
}
|
|
676
649
|
return {
|
|
677
650
|
key: e,
|
|
678
|
-
namespaces:
|
|
651
|
+
namespaces: s(i) ? [i] : i
|
|
679
652
|
};
|
|
680
653
|
}
|
|
681
654
|
translate(t, n, r) {
|
|
682
655
|
let i = typeof n == "object" ? { ...n } : n;
|
|
683
656
|
if (typeof i != "object" && this.options.overloadTranslationOptionHandler && (i = this.options.overloadTranslationOptionHandler(arguments)), typeof i == "object" && (i = { ...i }), i ||= {}, t == null) return "";
|
|
684
|
-
typeof t == "function" && (t =
|
|
657
|
+
typeof t == "function" && (t = P(t, {
|
|
685
658
|
...this.options,
|
|
686
659
|
...i
|
|
687
|
-
})), Array.isArray(t) || (t = [String(t)]), t = t.map((e) => typeof e == "function" ?
|
|
660
|
+
})), Array.isArray(t) || (t = [String(t)]), t = t.map((e) => typeof e == "function" ? P(e, {
|
|
688
661
|
...this.options,
|
|
689
662
|
...i
|
|
690
663
|
}) : String(e));
|
|
691
|
-
let a = i.returnDetails === void 0 ? this.options.returnDetails : i.returnDetails, o = i.keySeparator === void 0 ? this.options.keySeparator : i.keySeparator, { key:
|
|
692
|
-
|
|
693
|
-
let
|
|
694
|
-
if (
|
|
695
|
-
res: `${
|
|
696
|
-
usedKey:
|
|
697
|
-
exactUsedKey:
|
|
698
|
-
usedLng:
|
|
699
|
-
usedNS:
|
|
664
|
+
let a = i.returnDetails === void 0 ? this.options.returnDetails : i.returnDetails, o = i.keySeparator === void 0 ? this.options.keySeparator : i.keySeparator, { key: c, namespaces: l } = this.extractFromKey(t[t.length - 1], i), u = l[l.length - 1], d = i.nsSeparator === void 0 ? this.options.nsSeparator : i.nsSeparator;
|
|
665
|
+
d === void 0 && (d = ":");
|
|
666
|
+
let f = i.lng || this.language, p = i.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;
|
|
667
|
+
if (f?.toLowerCase() === "cimode") return p ? a ? {
|
|
668
|
+
res: `${u}${d}${c}`,
|
|
669
|
+
usedKey: c,
|
|
670
|
+
exactUsedKey: c,
|
|
671
|
+
usedLng: f,
|
|
672
|
+
usedNS: u,
|
|
700
673
|
usedParams: this.getUsedParamsDetails(i)
|
|
701
|
-
} : `${
|
|
702
|
-
res:
|
|
703
|
-
usedKey:
|
|
704
|
-
exactUsedKey:
|
|
705
|
-
usedLng:
|
|
706
|
-
usedNS:
|
|
674
|
+
} : `${u}${d}${c}` : a ? {
|
|
675
|
+
res: c,
|
|
676
|
+
usedKey: c,
|
|
677
|
+
exactUsedKey: c,
|
|
678
|
+
usedLng: f,
|
|
679
|
+
usedNS: u,
|
|
707
680
|
usedParams: this.getUsedParamsDetails(i)
|
|
708
|
-
} :
|
|
709
|
-
let
|
|
681
|
+
} : c;
|
|
682
|
+
let m = this.resolve(t, i), h = m?.res, g = m?.usedKey || c, _ = m?.exactUsedKey || c, v = [
|
|
710
683
|
"[object Number]",
|
|
711
684
|
"[object Function]",
|
|
712
685
|
"[object RegExp]"
|
|
713
|
-
], y = i.joinArrays === void 0 ? this.options.joinArrays : i.joinArrays, b = !this.i18nFormat || this.i18nFormat.handleAsObject, x = i.count !== void 0 && !
|
|
714
|
-
b && !
|
|
715
|
-
let O = I(D),
|
|
716
|
-
if (b && D && O && v.indexOf(
|
|
686
|
+
], y = i.joinArrays === void 0 ? this.options.joinArrays : i.joinArrays, b = !this.i18nFormat || this.i18nFormat.handleAsObject, x = i.count !== void 0 && !s(i.count), S = e.hasDefaultValue(i), C = x ? this.pluralResolver.getSuffix(f, i.count, i) : "", w = i.ordinal && x ? this.pluralResolver.getSuffix(f, i.count, { ordinal: !1 }) : "", T = x && !i.ordinal && i.count === 0, E = T && i[`defaultValue${this.options.pluralSeparator}zero`] || i[`defaultValue${C}`] || i[`defaultValue${w}`] || i.defaultValue, D = h;
|
|
687
|
+
b && !h && S && (D = E);
|
|
688
|
+
let O = I(D), ee = Object.prototype.toString.apply(D);
|
|
689
|
+
if (b && D && O && v.indexOf(ee) < 0 && !(s(y) && Array.isArray(D))) {
|
|
717
690
|
if (!i.returnObjects && !this.options.returnObjects) {
|
|
718
691
|
this.options.returnedObjectHandler || this.logger.warn("accessing an object - but returnObjects options is not enabled!");
|
|
719
|
-
let e = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(
|
|
692
|
+
let e = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(g, D, {
|
|
720
693
|
...i,
|
|
721
|
-
ns:
|
|
722
|
-
}) : `key '${
|
|
723
|
-
return a ? (
|
|
694
|
+
ns: l
|
|
695
|
+
}) : `key '${c} (${this.language})' returned an object instead of string.`;
|
|
696
|
+
return a ? (m.res = e, m.usedParams = this.getUsedParamsDetails(i), m) : e;
|
|
724
697
|
}
|
|
725
698
|
if (o) {
|
|
726
|
-
let e = Array.isArray(D), t = e ? [] : {}, n = e ? _ :
|
|
699
|
+
let e = Array.isArray(D), t = e ? [] : {}, n = e ? _ : g;
|
|
727
700
|
for (let e in D) if (Object.prototype.hasOwnProperty.call(D, e)) {
|
|
728
701
|
let r = `${n}${o}${e}`;
|
|
729
|
-
S && !
|
|
702
|
+
S && !h ? t[e] = this.translate(r, {
|
|
730
703
|
...i,
|
|
731
704
|
defaultValue: I(E) ? E[e] : void 0,
|
|
732
705
|
joinArrays: !1,
|
|
733
|
-
ns:
|
|
706
|
+
ns: l
|
|
734
707
|
}) : t[e] = this.translate(r, {
|
|
735
708
|
...i,
|
|
736
709
|
joinArrays: !1,
|
|
737
|
-
ns:
|
|
710
|
+
ns: l
|
|
738
711
|
}), t[e] === r && (t[e] = D[e]);
|
|
739
712
|
}
|
|
740
|
-
|
|
713
|
+
h = t;
|
|
741
714
|
}
|
|
742
|
-
} else if (b &&
|
|
715
|
+
} else if (b && s(y) && Array.isArray(h)) h = h.join(y), h &&= this.extendTranslation(h, t, i, r);
|
|
743
716
|
else {
|
|
744
717
|
let e = !1, n = !1;
|
|
745
|
-
!this.isValidLookup(
|
|
746
|
-
let a = (i.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && n ? void 0 :
|
|
747
|
-
if (n || e ||
|
|
748
|
-
if (this.logger.log(
|
|
749
|
-
let e = this.resolve(
|
|
718
|
+
!this.isValidLookup(h) && S && (e = !0, h = E), this.isValidLookup(h) || (n = !0, h = c);
|
|
719
|
+
let a = (i.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && n ? void 0 : h, s = S && E !== h && this.options.updateMissing;
|
|
720
|
+
if (n || e || s) {
|
|
721
|
+
if (this.logger.log(s ? "updateKey" : "missingKey", f, u, c, s ? E : h), o) {
|
|
722
|
+
let e = this.resolve(c, {
|
|
750
723
|
...i,
|
|
751
724
|
keySeparator: !1
|
|
752
725
|
});
|
|
@@ -756,19 +729,19 @@ var ue = {}, I = (e) => !g(e) && typeof e != "boolean" && typeof e != "number",
|
|
|
756
729
|
if (this.options.saveMissingTo === "fallback" && t && t[0]) for (let n = 0; n < t.length; n++) e.push(t[n]);
|
|
757
730
|
else this.options.saveMissingTo === "all" ? e = this.languageUtils.toResolveHierarchy(i.lng || this.language) : e.push(i.lng || this.language);
|
|
758
731
|
let n = (e, t, n) => {
|
|
759
|
-
let r = S && n !==
|
|
760
|
-
this.options.missingKeyHandler ? this.options.missingKeyHandler(e,
|
|
732
|
+
let r = S && n !== h ? n : a;
|
|
733
|
+
this.options.missingKeyHandler ? this.options.missingKeyHandler(e, u, t, r, s, i) : this.backendConnector?.saveMissing && this.backendConnector.saveMissing(e, u, t, r, s, i), this.emit("missingKey", e, u, t, h);
|
|
761
734
|
};
|
|
762
735
|
this.options.saveMissing && (this.options.saveMissingPlurals && x ? e.forEach((e) => {
|
|
763
736
|
let t = this.pluralResolver.getSuffixes(e, i);
|
|
764
737
|
T && i[`defaultValue${this.options.pluralSeparator}zero`] && t.indexOf(`${this.options.pluralSeparator}zero`) < 0 && t.push(`${this.options.pluralSeparator}zero`), t.forEach((t) => {
|
|
765
|
-
n([e],
|
|
738
|
+
n([e], c + t, i[`defaultValue${t}`] || E);
|
|
766
739
|
});
|
|
767
|
-
}) : n(e,
|
|
740
|
+
}) : n(e, c, E));
|
|
768
741
|
}
|
|
769
|
-
|
|
742
|
+
h = this.extendTranslation(h, t, i, m, r), n && h === c && this.options.appendNamespaceToMissingKey && (h = `${u}${d}${c}`), (n || e) && this.options.parseMissingKeyHandler && (h = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${u}${d}${c}` : c, e ? h : void 0, i));
|
|
770
743
|
}
|
|
771
|
-
return a ? (
|
|
744
|
+
return a ? (m.res = h, m.usedParams = this.getUsedParamsDetails(i), m) : h;
|
|
772
745
|
}
|
|
773
746
|
extendTranslation(e, t, n, r, i) {
|
|
774
747
|
if (this.i18nFormat?.parse) e = this.i18nFormat.parse(e, {
|
|
@@ -783,23 +756,23 @@ var ue = {}, I = (e) => !g(e) && typeof e != "boolean" && typeof e != "number",
|
|
|
783
756
|
...n.interpolation
|
|
784
757
|
}
|
|
785
758
|
});
|
|
786
|
-
let a =
|
|
759
|
+
let a = s(e) && (n?.interpolation?.skipOnVariables === void 0 ? this.options.interpolation.skipOnVariables : n.interpolation.skipOnVariables), o;
|
|
787
760
|
if (a) {
|
|
788
761
|
let t = e.match(this.interpolator.nestingRegexp);
|
|
789
762
|
o = t && t.length;
|
|
790
763
|
}
|
|
791
|
-
let
|
|
792
|
-
if (this.options.interpolation.defaultVariables && (
|
|
764
|
+
let c = n.replace && !s(n.replace) ? n.replace : n;
|
|
765
|
+
if (this.options.interpolation.defaultVariables && (c = {
|
|
793
766
|
...this.options.interpolation.defaultVariables,
|
|
794
|
-
...
|
|
795
|
-
}), e = this.interpolator.interpolate(e,
|
|
767
|
+
...c
|
|
768
|
+
}), e = this.interpolator.interpolate(e, c, n.lng || this.language || r.usedLng, n), a) {
|
|
796
769
|
let t = e.match(this.interpolator.nestingRegexp), r = t && t.length;
|
|
797
770
|
o < r && (n.nest = !1);
|
|
798
771
|
}
|
|
799
772
|
!n.lng && r && r.res && (n.lng = this.language || r.usedLng), n.nest !== !1 && (e = this.interpolator.nest(e, (...e) => i?.[0] === e[0] && !n.context ? (this.logger.warn(`It seems you are nesting recursively key: ${e[0]} in key: ${t[0]}`), null) : this.translate(...e, t), n)), n.interpolation && this.interpolator.reset();
|
|
800
773
|
}
|
|
801
|
-
let a = n.postProcess || this.options.postProcess, o =
|
|
802
|
-
return e != null && o?.length && n.applyPostProcessor !== !1 && (e =
|
|
774
|
+
let a = n.postProcess || this.options.postProcess, o = s(a) ? [a] : a;
|
|
775
|
+
return e != null && o?.length && n.applyPostProcessor !== !1 && (e = M.handle(o, e, t, this.options && this.options.postProcessPassResolved ? {
|
|
803
776
|
i18nResolved: {
|
|
804
777
|
...r,
|
|
805
778
|
usedParams: this.getUsedParamsDetails(n)
|
|
@@ -809,29 +782,29 @@ var ue = {}, I = (e) => !g(e) && typeof e != "boolean" && typeof e != "number",
|
|
|
809
782
|
}
|
|
810
783
|
resolve(e, t = {}) {
|
|
811
784
|
let n, r, i, a, o;
|
|
812
|
-
return
|
|
785
|
+
return s(e) && (e = [e]), Array.isArray(e) && (e = e.map((e) => typeof e == "function" ? P(e, {
|
|
813
786
|
...this.options,
|
|
814
787
|
...t
|
|
815
788
|
}) : e)), e.forEach((e) => {
|
|
816
789
|
if (this.isValidLookup(n)) return;
|
|
817
|
-
let
|
|
818
|
-
r =
|
|
819
|
-
let
|
|
820
|
-
this.options.fallbackNS && (
|
|
821
|
-
let
|
|
822
|
-
|
|
823
|
-
this.isValidLookup(n) || (o = e, !
|
|
790
|
+
let c = this.extractFromKey(e, t), l = c.key;
|
|
791
|
+
r = l;
|
|
792
|
+
let u = c.namespaces;
|
|
793
|
+
this.options.fallbackNS && (u = u.concat(this.options.fallbackNS));
|
|
794
|
+
let d = t.count !== void 0 && !s(t.count), f = d && !t.ordinal && t.count === 0, p = t.context !== void 0 && (s(t.context) || typeof t.context == "number") && t.context !== "", m = t.lngs ? t.lngs : this.languageUtils.toResolveHierarchy(t.lng || this.language, t.fallbackLng);
|
|
795
|
+
u.forEach((e) => {
|
|
796
|
+
this.isValidLookup(n) || (o = e, !F[`${m[0]}-${e}`] && this.utils?.hasLoadedNamespace && !this.utils?.hasLoadedNamespace(o) && (F[`${m[0]}-${e}`] = !0, this.logger.warn(`key "${r}" for languages "${m.join(", ")}" won't get resolved as namespace "${o}" was not yet loaded`, "This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")), m.forEach((r) => {
|
|
824
797
|
if (this.isValidLookup(n)) return;
|
|
825
798
|
a = r;
|
|
826
|
-
let o = [
|
|
827
|
-
if (this.i18nFormat?.addLookupKeys) this.i18nFormat.addLookupKeys(o,
|
|
799
|
+
let o = [l];
|
|
800
|
+
if (this.i18nFormat?.addLookupKeys) this.i18nFormat.addLookupKeys(o, l, r, e, t);
|
|
828
801
|
else {
|
|
829
802
|
let e;
|
|
830
|
-
|
|
803
|
+
d && (e = this.pluralResolver.getSuffix(r, t.count, t));
|
|
831
804
|
let n = `${this.options.pluralSeparator}zero`, i = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;
|
|
832
|
-
if (
|
|
833
|
-
let r = `${
|
|
834
|
-
o.push(r),
|
|
805
|
+
if (d && (t.ordinal && e.indexOf(i) === 0 && o.push(l + e.replace(i, this.options.pluralSeparator)), o.push(l + e), f && o.push(l + n)), p) {
|
|
806
|
+
let r = `${l}${this.options.contextSeparator || "_"}${t.context}`;
|
|
807
|
+
o.push(r), d && (t.ordinal && e.indexOf(i) === 0 && o.push(r + e.replace(i, this.options.pluralSeparator)), o.push(r + e), f && o.push(r + n));
|
|
835
808
|
}
|
|
836
809
|
}
|
|
837
810
|
let s;
|
|
@@ -869,7 +842,7 @@ var ue = {}, I = (e) => !g(e) && typeof e != "boolean" && typeof e != "number",
|
|
|
869
842
|
"joinArrays",
|
|
870
843
|
"postProcess",
|
|
871
844
|
"interpolation"
|
|
872
|
-
], n = e.replace && !
|
|
845
|
+
], n = e.replace && !s(e.replace), r = n ? e.replace : e;
|
|
873
846
|
if (n && e.count !== void 0 && (r.count = e.count), this.options.interpolation.defaultVariables && (r = {
|
|
874
847
|
...this.options.interpolation.defaultVariables,
|
|
875
848
|
...r
|
|
@@ -885,20 +858,20 @@ var ue = {}, I = (e) => !g(e) && typeof e != "boolean" && typeof e != "number",
|
|
|
885
858
|
}
|
|
886
859
|
}, R = class {
|
|
887
860
|
constructor(e) {
|
|
888
|
-
this.options = e, this.supportedLngs = this.options.supportedLngs || !1, this.logger =
|
|
861
|
+
this.options = e, this.supportedLngs = this.options.supportedLngs || !1, this.logger = k.create("languageUtils");
|
|
889
862
|
}
|
|
890
863
|
getScriptPartFromCode(e) {
|
|
891
|
-
if (e =
|
|
864
|
+
if (e = O(e), !e || e.indexOf("-") < 0) return null;
|
|
892
865
|
let t = e.split("-");
|
|
893
866
|
return t.length === 2 || (t.pop(), t[t.length - 1].toLowerCase() === "x") ? null : this.formatLanguageCode(t.join("-"));
|
|
894
867
|
}
|
|
895
868
|
getLanguagePartFromCode(e) {
|
|
896
|
-
if (e =
|
|
869
|
+
if (e = O(e), !e || e.indexOf("-") < 0) return e;
|
|
897
870
|
let t = e.split("-");
|
|
898
871
|
return this.formatLanguageCode(t[0]);
|
|
899
872
|
}
|
|
900
873
|
formatLanguageCode(e) {
|
|
901
|
-
if (
|
|
874
|
+
if (s(e) && e.indexOf("-") > -1) {
|
|
902
875
|
let t;
|
|
903
876
|
try {
|
|
904
877
|
t = Intl.getCanonicalLocales(e)[0];
|
|
@@ -930,7 +903,7 @@ var ue = {}, I = (e) => !g(e) && typeof e != "boolean" && typeof e != "number",
|
|
|
930
903
|
}
|
|
931
904
|
getFallbackCodes(e, t) {
|
|
932
905
|
if (!e) return [];
|
|
933
|
-
if (typeof e == "function" && (e = e(t)),
|
|
906
|
+
if (typeof e == "function" && (e = e(t)), s(e) && (e = [e]), Array.isArray(e)) return e;
|
|
934
907
|
if (!t) return e.default || [];
|
|
935
908
|
let n = e[t];
|
|
936
909
|
return n ||= e[this.getScriptPartFromCode(t)], n ||= e[this.formatLanguageCode(t)], n ||= e[this.getLanguagePartFromCode(t)], n ||= e.default, n || [];
|
|
@@ -939,7 +912,7 @@ var ue = {}, I = (e) => !g(e) && typeof e != "boolean" && typeof e != "number",
|
|
|
939
912
|
let n = this.getFallbackCodes((t === !1 ? [] : t) || this.options.fallbackLng || [], e), r = [], i = (e) => {
|
|
940
913
|
e && (this.isSupportedCode(e) ? r.push(e) : this.logger.warn(`rejecting language code not found in supportedLngs: ${e}`));
|
|
941
914
|
};
|
|
942
|
-
return
|
|
915
|
+
return s(e) && (e.indexOf("-") > -1 || e.indexOf("_") > -1) ? (this.options.load !== "languageOnly" && i(this.formatLanguageCode(e)), this.options.load !== "languageOnly" && this.options.load !== "currentOnly" && i(this.getScriptPartFromCode(e)), this.options.load !== "currentOnly" && i(this.getLanguagePartFromCode(e))) : s(e) && i(this.formatLanguageCode(e)), n.forEach((e) => {
|
|
943
916
|
r.indexOf(e) < 0 && i(this.formatLanguageCode(e));
|
|
944
917
|
}), r;
|
|
945
918
|
}
|
|
@@ -953,15 +926,15 @@ var ue = {}, I = (e) => !g(e) && typeof e != "boolean" && typeof e != "number",
|
|
|
953
926
|
}, B = {
|
|
954
927
|
select: (e) => e === 1 ? "one" : "other",
|
|
955
928
|
resolvedOptions: () => ({ pluralCategories: ["one", "other"] })
|
|
956
|
-
},
|
|
929
|
+
}, ne = class {
|
|
957
930
|
constructor(e, t = {}) {
|
|
958
|
-
this.languageUtils = e, this.options = t, this.logger =
|
|
931
|
+
this.languageUtils = e, this.options = t, this.logger = k.create("pluralResolver"), this.pluralRulesCache = {};
|
|
959
932
|
}
|
|
960
933
|
clearCache() {
|
|
961
934
|
this.pluralRulesCache = {};
|
|
962
935
|
}
|
|
963
936
|
getRule(e, t = {}) {
|
|
964
|
-
let n =
|
|
937
|
+
let n = O(e === "dev" ? "en" : e), r = t.ordinal ? "ordinal" : "cardinal", i = JSON.stringify({
|
|
965
938
|
cleanedCode: n,
|
|
966
939
|
type: r
|
|
967
940
|
});
|
|
@@ -993,16 +966,16 @@ var ue = {}, I = (e) => !g(e) && typeof e != "boolean" && typeof e != "number",
|
|
|
993
966
|
return r ? `${this.options.prepend}${n.ordinal ? `ordinal${this.options.prepend}` : ""}${r.select(t)}` : (this.logger.warn(`no plural rule found for: ${e}`), this.getSuffix("dev", t, n));
|
|
994
967
|
}
|
|
995
968
|
}, V = (e, t, n, r = ".", i = !0) => {
|
|
996
|
-
let a =
|
|
997
|
-
return !a && i &&
|
|
969
|
+
let a = v(e, t, n);
|
|
970
|
+
return !a && i && s(n) && (a = D(e, n, r), a === void 0 && (a = D(t, n, r))), a;
|
|
998
971
|
}, H = (e) => e.replace(/\$/g, "$$$$"), U = class {
|
|
999
972
|
constructor(e = {}) {
|
|
1000
|
-
this.logger =
|
|
973
|
+
this.logger = k.create("interpolator"), this.options = e, this.format = e?.interpolation?.format || ((e) => e), this.init(e);
|
|
1001
974
|
}
|
|
1002
975
|
init(e = {}) {
|
|
1003
976
|
e.interpolation ||= { escapeValue: !0 };
|
|
1004
977
|
let { escape: t, escapeValue: n, useRawValueToEscape: r, prefix: i, prefixEscaped: a, suffix: o, suffixEscaped: s, formatSeparator: c, unescapeSuffix: l, unescapePrefix: u, nestingPrefix: d, nestingPrefixEscaped: f, nestingSuffix: p, nestingSuffixEscaped: m, nestingOptionsSeparator: h, maxReplaces: g, alwaysFormat: _ } = e.interpolation;
|
|
1005
|
-
this.escape = t === void 0 ?
|
|
978
|
+
this.escape = t === void 0 ? S : t, this.escapeValue = n === void 0 || n, this.useRawValueToEscape = r !== void 0 && r, this.prefix = i ? b(i) : a || "{{", this.suffix = o ? b(o) : s || "}}", this.formatSeparator = c || ",", this.unescapePrefix = l ? "" : u || "-", this.unescapeSuffix = this.unescapePrefix ? "" : l || "", this.nestingPrefix = d ? b(d) : f || b("$t("), this.nestingSuffix = p ? b(p) : m || b(")"), this.nestingOptionsSeparator = h || ",", this.maxReplaces = g || 1e3, this.alwaysFormat = _ !== void 0 && _, this.resetRegExp();
|
|
1006
979
|
}
|
|
1007
980
|
reset() {
|
|
1008
981
|
this.options && this.init(this.options);
|
|
@@ -1012,9 +985,9 @@ var ue = {}, I = (e) => !g(e) && typeof e != "boolean" && typeof e != "number",
|
|
|
1012
985
|
this.regexp = e(this.regexp, `${this.prefix}(.+?)${this.suffix}`), this.regexpUnescape = e(this.regexpUnescape, `${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`), this.nestingRegexp = e(this.nestingRegexp, `${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`);
|
|
1013
986
|
}
|
|
1014
987
|
interpolate(e, t, n, r) {
|
|
1015
|
-
let i, a, o,
|
|
988
|
+
let i, a, o, c = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {}, u = (e) => {
|
|
1016
989
|
if (e.indexOf(this.formatSeparator) < 0) {
|
|
1017
|
-
let i = V(t,
|
|
990
|
+
let i = V(t, c, e, this.options.keySeparator, this.options.ignoreJSONStructure);
|
|
1018
991
|
return this.alwaysFormat ? this.format(i, void 0, n, {
|
|
1019
992
|
...r,
|
|
1020
993
|
...t,
|
|
@@ -1022,14 +995,14 @@ var ue = {}, I = (e) => !g(e) && typeof e != "boolean" && typeof e != "number",
|
|
|
1022
995
|
}) : i;
|
|
1023
996
|
}
|
|
1024
997
|
let i = e.split(this.formatSeparator), a = i.shift().trim(), o = i.join(this.formatSeparator).trim();
|
|
1025
|
-
return this.format(V(t,
|
|
998
|
+
return this.format(V(t, c, a, this.options.keySeparator, this.options.ignoreJSONStructure), o, n, {
|
|
1026
999
|
...r,
|
|
1027
1000
|
...t,
|
|
1028
1001
|
interpolationkey: a
|
|
1029
1002
|
});
|
|
1030
1003
|
};
|
|
1031
1004
|
this.resetRegExp();
|
|
1032
|
-
let
|
|
1005
|
+
let d = r?.missingInterpolationHandler || this.options.missingInterpolationHandler, f = r?.interpolation?.skipOnVariables === void 0 ? this.options.interpolation.skipOnVariables : r.interpolation.skipOnVariables;
|
|
1033
1006
|
return [{
|
|
1034
1007
|
regex: this.regexpUnescape,
|
|
1035
1008
|
safeValue: (e) => H(e)
|
|
@@ -1039,17 +1012,17 @@ var ue = {}, I = (e) => !g(e) && typeof e != "boolean" && typeof e != "number",
|
|
|
1039
1012
|
}].forEach((t) => {
|
|
1040
1013
|
for (o = 0; i = t.regex.exec(e);) {
|
|
1041
1014
|
let n = i[1].trim();
|
|
1042
|
-
if (a =
|
|
1043
|
-
let t =
|
|
1044
|
-
a =
|
|
1015
|
+
if (a = u(n), a === void 0) if (typeof d == "function") {
|
|
1016
|
+
let t = d(e, i, r);
|
|
1017
|
+
a = s(t) ? t : "";
|
|
1045
1018
|
} else if (r && Object.prototype.hasOwnProperty.call(r, n)) a = "";
|
|
1046
|
-
else if (
|
|
1019
|
+
else if (f) {
|
|
1047
1020
|
a = i[0];
|
|
1048
1021
|
continue;
|
|
1049
1022
|
} else this.logger.warn(`missed to pass in variable ${n} for interpolating ${e}`), a = "";
|
|
1050
|
-
else !
|
|
1051
|
-
let
|
|
1052
|
-
if (e = e.replace(i[0],
|
|
1023
|
+
else !s(a) && !this.useRawValueToEscape && (a = l(a));
|
|
1024
|
+
let c = t.safeValue(a);
|
|
1025
|
+
if (e = e.replace(i[0], c), f ? (t.regex.lastIndex += a.length, t.regex.lastIndex -= i[0].length) : t.regex.lastIndex = 0, o++, o >= this.maxReplaces) break;
|
|
1053
1026
|
}
|
|
1054
1027
|
}), e;
|
|
1055
1028
|
}
|
|
@@ -1057,7 +1030,7 @@ var ue = {}, I = (e) => !g(e) && typeof e != "boolean" && typeof e != "number",
|
|
|
1057
1030
|
let r, i, a, o = (e, t) => {
|
|
1058
1031
|
let n = this.nestingOptionsSeparator;
|
|
1059
1032
|
if (e.indexOf(n) < 0) return e;
|
|
1060
|
-
let r = e.split(RegExp(`${
|
|
1033
|
+
let r = e.split(RegExp(`${b(n)}[ ]*{`)), i = `{${r[1]}`;
|
|
1061
1034
|
e = r[0], i = this.interpolate(i, a);
|
|
1062
1035
|
let o = i.match(/'/g), s = i.match(/"/g);
|
|
1063
1036
|
((o?.length ?? 0) % 2 == 0 && !s || (s?.length ?? 0) % 2 != 0) && (i = i.replace(/'/g, "\""));
|
|
@@ -1072,18 +1045,18 @@ var ue = {}, I = (e) => !g(e) && typeof e != "boolean" && typeof e != "number",
|
|
|
1072
1045
|
return a.defaultValue && a.defaultValue.indexOf(this.prefix) > -1 && delete a.defaultValue, e;
|
|
1073
1046
|
};
|
|
1074
1047
|
for (; r = this.nestingRegexp.exec(e);) {
|
|
1075
|
-
let
|
|
1076
|
-
a = { ...n }, a = a.replace && !
|
|
1077
|
-
let
|
|
1078
|
-
if (
|
|
1079
|
-
|
|
1048
|
+
let c = [];
|
|
1049
|
+
a = { ...n }, a = a.replace && !s(a.replace) ? a.replace : a, a.applyPostProcessor = !1, delete a.defaultValue;
|
|
1050
|
+
let u = /{.*}/.test(r[1]) ? r[1].lastIndexOf("}") + 1 : r[1].indexOf(this.formatSeparator);
|
|
1051
|
+
if (u !== -1 && (c = r[1].slice(u).split(this.formatSeparator).map((e) => e.trim()).filter(Boolean), r[1] = r[1].slice(0, u)), i = t(o.call(this, r[1].trim(), a), a), i && r[0] === e && !s(i)) return i;
|
|
1052
|
+
s(i) || (i = l(i)), i ||= (this.logger.warn(`missed to resolve ${r[1]} for nesting ${e}`), ""), c.length && (i = c.reduce((e, t) => this.format(e, t, n.lng, {
|
|
1080
1053
|
...n,
|
|
1081
1054
|
interpolationkey: r[1].trim()
|
|
1082
1055
|
}), i.trim())), e = e.replace(r[0], i), this.regexp.lastIndex = 0;
|
|
1083
1056
|
}
|
|
1084
1057
|
return e;
|
|
1085
1058
|
}
|
|
1086
|
-
},
|
|
1059
|
+
}, re = (e) => {
|
|
1087
1060
|
let t = e.toLowerCase().trim(), n = {};
|
|
1088
1061
|
if (e.indexOf("(") > -1) {
|
|
1089
1062
|
let r = e.split("(");
|
|
@@ -1109,15 +1082,15 @@ var ue = {}, I = (e) => !g(e) && typeof e != "boolean" && typeof e != "number",
|
|
|
1109
1082
|
[i.interpolationkey]: void 0
|
|
1110
1083
|
});
|
|
1111
1084
|
let o = r + JSON.stringify(a), s = t[o];
|
|
1112
|
-
return s || (s = e(
|
|
1085
|
+
return s || (s = e(O(r), i), t[o] = s), s(n);
|
|
1113
1086
|
};
|
|
1114
|
-
},
|
|
1087
|
+
}, ie = (e) => (t, n, r) => e(O(n), r)(t), ae = class {
|
|
1115
1088
|
constructor(e = {}) {
|
|
1116
|
-
this.logger =
|
|
1089
|
+
this.logger = k.create("formatter"), this.options = e, this.init(e);
|
|
1117
1090
|
}
|
|
1118
1091
|
init(e, t = { interpolation: {} }) {
|
|
1119
1092
|
this.formatSeparator = t.interpolation.formatSeparator || ",";
|
|
1120
|
-
let n = t.cacheInBuiltFormats ? W :
|
|
1093
|
+
let n = t.cacheInBuiltFormats ? W : ie;
|
|
1121
1094
|
this.formats = {
|
|
1122
1095
|
number: n((e, t) => {
|
|
1123
1096
|
let n = new Intl.NumberFormat(e, { ...t });
|
|
@@ -1157,7 +1130,7 @@ var ue = {}, I = (e) => !g(e) && typeof e != "boolean" && typeof e != "number",
|
|
|
1157
1130
|
i[0] = [i[0], ...i.splice(1, e)].join(this.formatSeparator);
|
|
1158
1131
|
}
|
|
1159
1132
|
return i.reduce((e, t) => {
|
|
1160
|
-
let { formatName: i, formatOptions: a } =
|
|
1133
|
+
let { formatName: i, formatOptions: a } = re(t);
|
|
1161
1134
|
if (this.formats[i]) {
|
|
1162
1135
|
let t = e;
|
|
1163
1136
|
try {
|
|
@@ -1175,11 +1148,11 @@ var ue = {}, I = (e) => !g(e) && typeof e != "boolean" && typeof e != "number",
|
|
|
1175
1148
|
return e;
|
|
1176
1149
|
}, e);
|
|
1177
1150
|
}
|
|
1178
|
-
},
|
|
1151
|
+
}, oe = (e, t) => {
|
|
1179
1152
|
e.pending[t] !== void 0 && (delete e.pending[t], e.pendingCount--);
|
|
1180
|
-
},
|
|
1153
|
+
}, se = class extends A {
|
|
1181
1154
|
constructor(e, t, n, r = {}) {
|
|
1182
|
-
super(), this.backend = e, this.store = t, this.services = n, this.languageUtils = n.languageUtils, this.options = r, this.logger =
|
|
1155
|
+
super(), this.backend = e, this.store = t, this.services = n, this.languageUtils = n.languageUtils, this.options = r, this.logger = k.create("backendConnector"), this.waitingReads = [], this.maxParallelReads = r.maxParallelReads || 10, this.readingCalls = 0, this.maxRetries = r.maxRetries >= 0 ? r.maxRetries : 5, this.retryTimeout = r.retryTimeout >= 1 ? r.retryTimeout : 350, this.state = {}, this.queue = [], this.backend?.init?.(n, r.backend, r);
|
|
1183
1156
|
}
|
|
1184
1157
|
queueLoad(e, t, n, r) {
|
|
1185
1158
|
let i = {}, a = {}, o = {}, s = {};
|
|
@@ -1207,7 +1180,7 @@ var ue = {}, I = (e) => !g(e) && typeof e != "boolean" && typeof e != "number",
|
|
|
1207
1180
|
t && this.emit("failedLoading", i, a, t), !t && n && this.store.addResourceBundle(i, a, n, void 0, void 0, { skipCopy: !0 }), this.state[e] = t ? -1 : 2, t && n && (this.state[e] = 0);
|
|
1208
1181
|
let o = {};
|
|
1209
1182
|
this.queue.forEach((n) => {
|
|
1210
|
-
|
|
1183
|
+
g(n.loaded, [i], a), oe(n, e), t && n.errors.push(t), n.pendingCount === 0 && !n.done && (Object.keys(n.loaded).forEach((e) => {
|
|
1211
1184
|
o[e] || (o[e] = {});
|
|
1212
1185
|
let t = n.loaded[e];
|
|
1213
1186
|
t.length && t.forEach((t) => {
|
|
@@ -1256,7 +1229,7 @@ var ue = {}, I = (e) => !g(e) && typeof e != "boolean" && typeof e != "number",
|
|
|
1256
1229
|
}
|
|
1257
1230
|
prepareLoading(e, t, n = {}, r) {
|
|
1258
1231
|
if (!this.backend) return this.logger.warn("No backend was added via i18next.use. Will not load resources."), r && r();
|
|
1259
|
-
|
|
1232
|
+
s(e) && (e = this.languageUtils.toResolveHierarchy(e)), s(t) && (t = [t]);
|
|
1260
1233
|
let i = this.queueLoad(e, t, n, r);
|
|
1261
1234
|
if (!i.toLoad.length) return i.pending.length || r(), null;
|
|
1262
1235
|
i.toLoad.forEach((e) => {
|
|
@@ -1332,7 +1305,7 @@ var ue = {}, I = (e) => !g(e) && typeof e != "boolean" && typeof e != "number",
|
|
|
1332
1305
|
appendNamespaceToCIMode: !1,
|
|
1333
1306
|
overloadTranslationOptionHandler: (e) => {
|
|
1334
1307
|
let t = {};
|
|
1335
|
-
if (typeof e[1] == "object" && (t = e[1]),
|
|
1308
|
+
if (typeof e[1] == "object" && (t = e[1]), s(e[1]) && (t.defaultValue = e[1]), s(e[2]) && (t.tDescription = e[2]), typeof e[2] == "object" || typeof e[3] == "object") {
|
|
1336
1309
|
let n = e[3] || e[2];
|
|
1337
1310
|
Object.keys(n).forEach((e) => {
|
|
1338
1311
|
t[e] = n[e];
|
|
@@ -1354,15 +1327,15 @@ var ue = {}, I = (e) => !g(e) && typeof e != "boolean" && typeof e != "number",
|
|
|
1354
1327
|
skipOnVariables: !0
|
|
1355
1328
|
},
|
|
1356
1329
|
cacheInBuiltFormats: !0
|
|
1357
|
-
}), K = (e) => (
|
|
1330
|
+
}), K = (e) => (s(e.ns) && (e.ns = [e.ns]), s(e.fallbackLng) && (e.fallbackLng = [e.fallbackLng]), s(e.fallbackNS) && (e.fallbackNS = [e.fallbackNS]), e.supportedLngs?.indexOf?.("cimode") < 0 && (e.supportedLngs = e.supportedLngs.concat(["cimode"])), typeof e.initImmediate == "boolean" && (e.initAsync = e.initImmediate), e), q = () => {}, ce = (e) => {
|
|
1358
1331
|
Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach((t) => {
|
|
1359
1332
|
typeof e[t] == "function" && (e[t] = e[t].bind(e));
|
|
1360
1333
|
});
|
|
1361
|
-
},
|
|
1362
|
-
typeof globalThis < "u" && (globalThis[
|
|
1363
|
-
},
|
|
1334
|
+
}, J = "__i18next_supportNoticeShown", le = () => !!(typeof globalThis < "u" && globalThis[J] || typeof process < "u" && process.env && process.env.I18NEXT_NO_SUPPORT_NOTICE || typeof process < "u" && process.env), ue = () => {
|
|
1335
|
+
typeof globalThis < "u" && (globalThis[J] = !0);
|
|
1336
|
+
}, de = (e) => !!(e?.modules?.backend?.name?.indexOf("Locize") > 0 || e?.modules?.backend?.constructor?.name?.indexOf("Locize") > 0 || e?.options?.backend?.backends && e.options.backend.backends.some((e) => e?.name?.indexOf("Locize") > 0 || e?.constructor?.name?.indexOf("Locize") > 0) || e?.options?.backend?.projectId || e?.options?.backend?.backendOptions && e.options.backend.backendOptions.some((e) => e?.projectId)), Y = class e extends A {
|
|
1364
1337
|
constructor(e = {}, t) {
|
|
1365
|
-
if (super(), this.options = K(e), this.services = {}, this.logger =
|
|
1338
|
+
if (super(), this.options = K(e), this.services = {}, this.logger = k, this.modules = { external: [] }, ce(this), t && !this.isInitialized && !e.isClone) {
|
|
1366
1339
|
if (!this.options.initAsync) return this.init(e, t), this;
|
|
1367
1340
|
setTimeout(() => {
|
|
1368
1341
|
this.init(e, t);
|
|
@@ -1370,7 +1343,7 @@ var ue = {}, I = (e) => !g(e) && typeof e != "boolean" && typeof e != "number",
|
|
|
1370
1343
|
}
|
|
1371
1344
|
}
|
|
1372
1345
|
init(e = {}, t) {
|
|
1373
|
-
this.isInitializing = !0, typeof e == "function" && (t = e, e = {}), e.defaultNS == null && e.ns && (
|
|
1346
|
+
this.isInitializing = !0, typeof e == "function" && (t = e, e = {}), e.defaultNS == null && e.ns && (s(e.ns) ? e.defaultNS = e.ns : e.ns.indexOf("translation") < 0 && (e.defaultNS = e.ns[0]));
|
|
1374
1347
|
let n = G();
|
|
1375
1348
|
this.options = {
|
|
1376
1349
|
...n,
|
|
@@ -1379,19 +1352,19 @@ var ue = {}, I = (e) => !g(e) && typeof e != "boolean" && typeof e != "number",
|
|
|
1379
1352
|
}, this.options.interpolation = {
|
|
1380
1353
|
...n.interpolation,
|
|
1381
1354
|
...this.options.interpolation
|
|
1382
|
-
}, e.keySeparator !== void 0 && (this.options.userDefinedKeySeparator = e.keySeparator), e.nsSeparator !== void 0 && (this.options.userDefinedNsSeparator = e.nsSeparator), typeof this.options.overloadTranslationOptionHandler != "function" && (this.options.overloadTranslationOptionHandler = n.overloadTranslationOptionHandler), this.options.showSupportNotice !== !1 && !
|
|
1355
|
+
}, e.keySeparator !== void 0 && (this.options.userDefinedKeySeparator = e.keySeparator), e.nsSeparator !== void 0 && (this.options.userDefinedNsSeparator = e.nsSeparator), typeof this.options.overloadTranslationOptionHandler != "function" && (this.options.overloadTranslationOptionHandler = n.overloadTranslationOptionHandler), this.options.showSupportNotice !== !1 && !de(this) && !le() && (typeof console < "u" && console.info !== void 0 && console.info("🌐 i18next is made possible by our own product, Locize — consider powering your project with managed localization (AI, CDN, integrations): https://locize.com 💙"), ue());
|
|
1383
1356
|
let r = (e) => e ? typeof e == "function" ? new e() : e : null;
|
|
1384
1357
|
if (!this.options.isClone) {
|
|
1385
|
-
this.modules.logger ?
|
|
1358
|
+
this.modules.logger ? k.init(r(this.modules.logger), this.options) : k.init(null, this.options);
|
|
1386
1359
|
let e;
|
|
1387
|
-
e = this.modules.formatter ? this.modules.formatter :
|
|
1360
|
+
e = this.modules.formatter ? this.modules.formatter : ae;
|
|
1388
1361
|
let t = new R(this.options);
|
|
1389
|
-
this.store = new
|
|
1362
|
+
this.store = new j(this.options.resources, this.options);
|
|
1390
1363
|
let i = this.services;
|
|
1391
|
-
i.logger =
|
|
1364
|
+
i.logger = k, i.resourceStore = this.store, i.languageUtils = t, i.pluralResolver = new ne(t, {
|
|
1392
1365
|
prepend: this.options.pluralSeparator,
|
|
1393
1366
|
simplifyPluralSuffix: this.options.simplifyPluralSuffix
|
|
1394
|
-
}), this.options.interpolation.format && this.options.interpolation.format !== n.interpolation.format && this.logger.deprecate("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"), e && (!this.options.interpolation.format || this.options.interpolation.format === n.interpolation.format) && (i.formatter = r(e), i.formatter.init && i.formatter.init(i, this.options), this.options.interpolation.format = i.formatter.format.bind(i.formatter)), i.interpolator = new U(this.options), i.utils = { hasLoadedNamespace: this.hasLoadedNamespace.bind(this) }, i.backendConnector = new
|
|
1367
|
+
}), this.options.interpolation.format && this.options.interpolation.format !== n.interpolation.format && this.logger.deprecate("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"), e && (!this.options.interpolation.format || this.options.interpolation.format === n.interpolation.format) && (i.formatter = r(e), i.formatter.init && i.formatter.init(i, this.options), this.options.interpolation.format = i.formatter.format.bind(i.formatter)), i.interpolator = new U(this.options), i.utils = { hasLoadedNamespace: this.hasLoadedNamespace.bind(this) }, i.backendConnector = new se(r(this.modules.backend), i.resourceStore, i, this.options), i.backendConnector.on("*", (e, ...t) => {
|
|
1395
1368
|
this.emit(e, ...t);
|
|
1396
1369
|
}), this.modules.languageDetector && (i.languageDetector = r(this.modules.languageDetector), i.languageDetector.init && i.languageDetector.init(i, this.options.detection, this.options)), this.modules.i18nFormat && (i.i18nFormat = r(this.modules.i18nFormat), i.i18nFormat.init && i.i18nFormat.init(this)), this.translator = new L(this.services, this.options), this.translator.on("*", (e, ...t) => {
|
|
1397
1370
|
this.emit(e, ...t);
|
|
@@ -1418,7 +1391,7 @@ var ue = {}, I = (e) => !g(e) && typeof e != "boolean" && typeof e != "number",
|
|
|
1418
1391
|
].forEach((e) => {
|
|
1419
1392
|
this[e] = (...t) => (this.store[e](...t), this);
|
|
1420
1393
|
});
|
|
1421
|
-
let i =
|
|
1394
|
+
let i = c(), a = () => {
|
|
1422
1395
|
let e = (e, n) => {
|
|
1423
1396
|
this.isInitializing = !1, this.isInitialized && !this.initializedStoreOnce && this.logger.warn("init: i18next is already initialized. You should call init just once!"), this.isInitialized = !0, this.options.isClone || this.logger.log("initialized", this.options), this.emit("initialized", this.options), i.resolve(n), t(e, n);
|
|
1424
1397
|
};
|
|
@@ -1428,7 +1401,7 @@ var ue = {}, I = (e) => !g(e) && typeof e != "boolean" && typeof e != "number",
|
|
|
1428
1401
|
return this.options.resources || !this.options.initAsync ? a() : setTimeout(a, 0), i;
|
|
1429
1402
|
}
|
|
1430
1403
|
loadResources(e, t = q) {
|
|
1431
|
-
let n = t, r =
|
|
1404
|
+
let n = t, r = s(e) ? e : this.language;
|
|
1432
1405
|
if (typeof e == "function" && (n = e), !this.options.resources || this.options.partialBundledLanguages) {
|
|
1433
1406
|
if (r?.toLowerCase() === "cimode" && (!this.options.preload || this.options.preload.length === 0)) return n();
|
|
1434
1407
|
let e = [], t = (t) => {
|
|
@@ -1442,7 +1415,7 @@ var ue = {}, I = (e) => !g(e) && typeof e != "boolean" && typeof e != "number",
|
|
|
1442
1415
|
} else n(null);
|
|
1443
1416
|
}
|
|
1444
1417
|
reloadResources(e, t, n) {
|
|
1445
|
-
let r =
|
|
1418
|
+
let r = c();
|
|
1446
1419
|
return typeof e == "function" && (n = e, e = void 0), typeof t == "function" && (n = t, t = void 0), e ||= this.languages, t ||= this.options.ns, n ||= q, this.services.backendConnector.reload(e, t, (e) => {
|
|
1447
1420
|
r.resolve(), n(e);
|
|
1448
1421
|
}), r;
|
|
@@ -1450,7 +1423,7 @@ var ue = {}, I = (e) => !g(e) && typeof e != "boolean" && typeof e != "number",
|
|
|
1450
1423
|
use(e) {
|
|
1451
1424
|
if (!e) throw Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");
|
|
1452
1425
|
if (!e.type) throw Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");
|
|
1453
|
-
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" &&
|
|
1426
|
+
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" && M.addPostProcessor(e), e.type === "formatter" && (this.modules.formatter = e), e.type === "3rdParty" && this.modules.external.push(e), this;
|
|
1454
1427
|
}
|
|
1455
1428
|
setResolvedLanguage(e) {
|
|
1456
1429
|
if (!(!e || !this.languages) && !(["cimode", "dev"].indexOf(e) > -1)) {
|
|
@@ -1466,7 +1439,7 @@ var ue = {}, I = (e) => !g(e) && typeof e != "boolean" && typeof e != "number",
|
|
|
1466
1439
|
}
|
|
1467
1440
|
changeLanguage(e, t) {
|
|
1468
1441
|
this.isLanguageChangingTo = e;
|
|
1469
|
-
let n =
|
|
1442
|
+
let n = c();
|
|
1470
1443
|
this.emit("languageChanging", e);
|
|
1471
1444
|
let r = (e) => {
|
|
1472
1445
|
this.language = e, this.languages = this.services.languageUtils.toResolveHierarchy(e), this.resolvedLanguage = void 0, this.setResolvedLanguage(e);
|
|
@@ -1474,7 +1447,7 @@ var ue = {}, I = (e) => !g(e) && typeof e != "boolean" && typeof e != "number",
|
|
|
1474
1447
|
a ? this.isLanguageChangingTo === e && (r(a), this.translator.changeLanguage(a), this.isLanguageChangingTo = void 0, this.emit("languageChanged", a), this.logger.log("languageChanged", a)) : this.isLanguageChangingTo = void 0, n.resolve((...e) => this.t(...e)), t && t(i, (...e) => this.t(...e));
|
|
1475
1448
|
}, a = (t) => {
|
|
1476
1449
|
!e && !t && this.services.languageDetector && (t = []);
|
|
1477
|
-
let n =
|
|
1450
|
+
let n = s(t) ? t : t && t[0], a = this.store.hasLanguageSomeTranslations(n) ? n : this.services.languageUtils.getBestMatchFromCodes(s(t) ? [t] : t);
|
|
1478
1451
|
a && (this.language || r(a), this.translator.language || this.translator.changeLanguage(a), this.services.languageDetector?.cacheUserLanguage?.(a)), this.loadResources(a, (e) => {
|
|
1479
1452
|
i(e, a);
|
|
1480
1453
|
});
|
|
@@ -1489,11 +1462,11 @@ var ue = {}, I = (e) => !g(e) && typeof e != "boolean" && typeof e != "number",
|
|
|
1489
1462
|
...this.options,
|
|
1490
1463
|
...a
|
|
1491
1464
|
};
|
|
1492
|
-
typeof a.keyPrefix == "function" && (a.keyPrefix =
|
|
1465
|
+
typeof a.keyPrefix == "function" && (a.keyPrefix = P(a.keyPrefix, o));
|
|
1493
1466
|
let s = this.options.keySeparator || ".", c;
|
|
1494
|
-
return a.keyPrefix && Array.isArray(e) ? c = e.map((e) => (typeof e == "function" && (e =
|
|
1467
|
+
return a.keyPrefix && Array.isArray(e) ? c = e.map((e) => (typeof e == "function" && (e = P(e, o)), `${a.keyPrefix}${s}${e}`)) : (typeof e == "function" && (e = P(e, o)), c = a.keyPrefix ? `${a.keyPrefix}${s}${e}` : e), this.t(c, a);
|
|
1495
1468
|
};
|
|
1496
|
-
return
|
|
1469
|
+
return s(e) ? r.lng = e : r.lngs = e, r.ns = t, r.keyPrefix = n, r;
|
|
1497
1470
|
}
|
|
1498
1471
|
t(...e) {
|
|
1499
1472
|
return this.translator?.translate(...e);
|
|
@@ -1520,16 +1493,16 @@ var ue = {}, I = (e) => !g(e) && typeof e != "boolean" && typeof e != "number",
|
|
|
1520
1493
|
return !!(this.hasResourceBundle(n, e) || !this.services.backendConnector.backend || this.options.resources && !this.options.partialBundledLanguages || a(n, e) && (!r || a(i, e)));
|
|
1521
1494
|
}
|
|
1522
1495
|
loadNamespaces(e, t) {
|
|
1523
|
-
let n =
|
|
1524
|
-
return this.options.ns ? (
|
|
1496
|
+
let n = c();
|
|
1497
|
+
return this.options.ns ? (s(e) && (e = [e]), e.forEach((e) => {
|
|
1525
1498
|
this.options.ns.indexOf(e) < 0 && this.options.ns.push(e);
|
|
1526
1499
|
}), this.loadResources((e) => {
|
|
1527
1500
|
n.resolve(), t && t(e);
|
|
1528
1501
|
}), n) : (t && t(), Promise.resolve());
|
|
1529
1502
|
}
|
|
1530
1503
|
loadLanguages(e, t) {
|
|
1531
|
-
let n =
|
|
1532
|
-
|
|
1504
|
+
let n = c();
|
|
1505
|
+
s(e) && (e = [e]);
|
|
1533
1506
|
let r = this.options.preload || [], i = e.filter((e) => r.indexOf(e) < 0 && this.services.languageUtils.isSupportedCode(e));
|
|
1534
1507
|
return i.length ? (this.options.preload = r.concat(i), this.loadResources((e) => {
|
|
1535
1508
|
n.resolve(), t && t(e);
|
|
@@ -1565,7 +1538,7 @@ var ue = {}, I = (e) => !g(e) && typeof e != "boolean" && typeof e != "number",
|
|
|
1565
1538
|
"language"
|
|
1566
1539
|
].forEach((e) => {
|
|
1567
1540
|
a[e] = this[e];
|
|
1568
|
-
}), a.services = { ...this.services }, a.services.utils = { hasLoadedNamespace: a.hasLoadedNamespace.bind(a) }, r && (a.store = new
|
|
1541
|
+
}), a.services = { ...this.services }, a.services.utils = { hasLoadedNamespace: a.hasLoadedNamespace.bind(a) }, r && (a.store = new j(Object.keys(this.store.data).reduce((e, t) => (e[t] = { ...this.store.data[t] }, e[t] = Object.keys(e[t]).reduce((n, r) => (n[r] = { ...e[t][r] }, n), e[t]), e), {}), i), a.services.resourceStore = a.store), t.interpolation) {
|
|
1569
1542
|
let e = {
|
|
1570
1543
|
...G().interpolation,
|
|
1571
1544
|
...this.options.interpolation,
|
|
@@ -1592,18 +1565,18 @@ var ue = {}, I = (e) => !g(e) && typeof e != "boolean" && typeof e != "number",
|
|
|
1592
1565
|
}.createInstance();
|
|
1593
1566
|
//#endregion
|
|
1594
1567
|
//#region ../../lib-react/translator/dist/index.js
|
|
1595
|
-
|
|
1568
|
+
Y.createInstance, Y.dir, Y.init, Y.loadResources, Y.reloadResources, Y.use, Y.changeLanguage, Y.getFixedT, Y.t, Y.exists, Y.setDefaultNamespace, Y.hasLoadedNamespace, Y.loadNamespaces, Y.loadLanguages, Y.init({
|
|
1596
1569
|
fallbackLng: "en",
|
|
1597
1570
|
lng: "en",
|
|
1598
1571
|
debug: !0,
|
|
1599
1572
|
resources: {
|
|
1600
|
-
en:
|
|
1601
|
-
es:
|
|
1573
|
+
en: a,
|
|
1574
|
+
es: o
|
|
1602
1575
|
}
|
|
1603
1576
|
});
|
|
1604
|
-
var
|
|
1577
|
+
var fe = {
|
|
1605
1578
|
translator: {
|
|
1606
|
-
...
|
|
1579
|
+
...Y,
|
|
1607
1580
|
t: (e, t) => {
|
|
1608
1581
|
let { lng: n } = t;
|
|
1609
1582
|
switch (n) {
|
|
@@ -1619,7 +1592,7 @@ var Se = {
|
|
|
1619
1592
|
break;
|
|
1620
1593
|
default: break;
|
|
1621
1594
|
}
|
|
1622
|
-
return
|
|
1595
|
+
return Y.t(e, {
|
|
1623
1596
|
lng: n,
|
|
1624
1597
|
...t
|
|
1625
1598
|
});
|
|
@@ -1632,84 +1605,23 @@ var Se = {
|
|
|
1632
1605
|
value: "es_ES",
|
|
1633
1606
|
label: "Spanish"
|
|
1634
1607
|
}]
|
|
1635
|
-
},
|
|
1636
|
-
if (Y("partial? ", e), !(!e || !e.enabled)) {
|
|
1637
|
-
let n = e.rules.find((e) => e.category === t);
|
|
1638
|
-
return n && n.rules || [];
|
|
1639
|
-
}
|
|
1640
|
-
}, Ee = (e, t) => new Promise((n) => {
|
|
1641
|
-
Y("categories: ", e, "scoring: ", t);
|
|
1642
|
-
let r = we(t), i = e.map((e) => ({
|
|
1643
|
-
...r.find((t) => t.category === e.id) || { points: 1 },
|
|
1644
|
-
category: e.id
|
|
1645
|
-
}));
|
|
1646
|
-
Y("weights: ", i);
|
|
1647
|
-
let a = e.reduce((e, t) => {
|
|
1648
|
-
let n = i.find((e) => e.category === t.id);
|
|
1649
|
-
return e += n.points;
|
|
1650
|
-
}, 0);
|
|
1651
|
-
Y("total: ", a);
|
|
1652
|
-
let o = e.map((e) => {
|
|
1653
|
-
let n = i.find((t) => t.category === e.id).points;
|
|
1654
|
-
if (Y("category: ", e), e.correct === !0) return {
|
|
1655
|
-
category: e.id,
|
|
1656
|
-
score: n,
|
|
1657
|
-
points: n
|
|
1658
|
-
};
|
|
1659
|
-
{
|
|
1660
|
-
let r = Te(t.partial, e.id);
|
|
1661
|
-
if (Y("partial rules for category: ", r), r) {
|
|
1662
|
-
let t = (e.choices || []).filter((e) => e.correct).length;
|
|
1663
|
-
Y("correctCount: ", t);
|
|
1664
|
-
let i = r.find((e) => e.count === t);
|
|
1665
|
-
Y("rule: ", i), i ||= {
|
|
1666
|
-
percent: 0,
|
|
1667
|
-
count: t
|
|
1668
|
-
};
|
|
1669
|
-
let a = n * (i.percent / 100);
|
|
1670
|
-
return {
|
|
1671
|
-
category: e.id,
|
|
1672
|
-
score: a,
|
|
1673
|
-
points: n,
|
|
1674
|
-
partial: {
|
|
1675
|
-
correctChoices: t,
|
|
1676
|
-
rule: i
|
|
1677
|
-
}
|
|
1678
|
-
};
|
|
1679
|
-
} else return {
|
|
1680
|
-
category: e.id,
|
|
1681
|
-
score: 0,
|
|
1682
|
-
points: n
|
|
1683
|
-
};
|
|
1684
|
-
}
|
|
1685
|
-
}), s = o.reduce((e, t) => e += t.score, 0);
|
|
1686
|
-
Y("weightedScore: ", s), n({
|
|
1687
|
-
score: parseFloat((s / a).toFixed(2), 10),
|
|
1688
|
-
details: {
|
|
1689
|
-
weighted: {
|
|
1690
|
-
total: a,
|
|
1691
|
-
score: s
|
|
1692
|
-
},
|
|
1693
|
-
categories: o
|
|
1694
|
-
}
|
|
1695
|
-
});
|
|
1696
|
-
}), De = Object.prototype;
|
|
1608
|
+
}, pe = /* @__PURE__ */ e(i(), 1), me = Object.prototype;
|
|
1697
1609
|
function X(e) {
|
|
1698
1610
|
return typeof e == "object" && !!e;
|
|
1699
1611
|
}
|
|
1700
|
-
function
|
|
1612
|
+
function he(e) {
|
|
1701
1613
|
return Array.isArray(e) ? e : typeof e == "number" ? [e] : e.replace(/\[(\d+)\]/g, ".$1").split(".").filter(Boolean);
|
|
1702
1614
|
}
|
|
1703
|
-
function
|
|
1704
|
-
return (t) =>
|
|
1615
|
+
function ge(e) {
|
|
1616
|
+
return (t) => Ce(t, e);
|
|
1705
1617
|
}
|
|
1706
|
-
function
|
|
1707
|
-
return (t) => X(t) ? Object.entries(e).every(([e, n]) =>
|
|
1618
|
+
function _e(e) {
|
|
1619
|
+
return (t) => X(t) ? Object.entries(e).every(([e, n]) => Ee(t[e], n)) : !1;
|
|
1708
1620
|
}
|
|
1709
|
-
function
|
|
1710
|
-
return typeof e == "function" ? e : typeof e == "string" ?
|
|
1621
|
+
function ve(e) {
|
|
1622
|
+
return typeof e == "function" ? e : typeof e == "string" ? ge(e) : X(e) ? _e(e) : ((e) => e);
|
|
1711
1623
|
}
|
|
1712
|
-
function
|
|
1624
|
+
function ye(e) {
|
|
1713
1625
|
return Array.isArray(e) ? e.slice() : X(e) ? { ...e } : e;
|
|
1714
1626
|
}
|
|
1715
1627
|
function Z(e) {
|
|
@@ -1720,10 +1632,10 @@ function Z(e) {
|
|
|
1720
1632
|
for (let [n, r] of Object.entries(e)) t[n] = Z(r);
|
|
1721
1633
|
return t;
|
|
1722
1634
|
}
|
|
1723
|
-
function
|
|
1635
|
+
function be(e) {
|
|
1724
1636
|
return (e ?? []).filter(Boolean);
|
|
1725
1637
|
}
|
|
1726
|
-
function
|
|
1638
|
+
function xe(e, t = 0, n = {}) {
|
|
1727
1639
|
let r, i, a, o, s, c = n.leading === !0, l = n.trailing !== !1, u = () => {
|
|
1728
1640
|
if (!a) return s;
|
|
1729
1641
|
let t = a, n = o;
|
|
@@ -1740,28 +1652,28 @@ function Pe(e, t = 0, n = {}) {
|
|
|
1740
1652
|
};
|
|
1741
1653
|
return f.cancel = d, f.flush = () => (r &&= (clearTimeout(r), void 0), i &&= (clearTimeout(i), void 0), u()), f;
|
|
1742
1654
|
}
|
|
1743
|
-
function
|
|
1655
|
+
function Se(e) {
|
|
1744
1656
|
let t = [];
|
|
1745
1657
|
for (let n of e ?? []) Array.isArray(n) ? t.push(...n) : t.push(n);
|
|
1746
1658
|
return t;
|
|
1747
1659
|
}
|
|
1748
|
-
function
|
|
1660
|
+
function Ce(e, t, n) {
|
|
1749
1661
|
if (!Array.isArray(t) && e != null && Object.prototype.hasOwnProperty.call(Object(e), t)) {
|
|
1750
1662
|
let r = e[t];
|
|
1751
1663
|
return r === void 0 ? n : r;
|
|
1752
1664
|
}
|
|
1753
1665
|
let r = e;
|
|
1754
|
-
for (let e of
|
|
1666
|
+
for (let e of he(t)) {
|
|
1755
1667
|
if (r == null) return n;
|
|
1756
1668
|
r = r[e];
|
|
1757
1669
|
}
|
|
1758
1670
|
return r === void 0 ? n : r;
|
|
1759
1671
|
}
|
|
1760
|
-
function
|
|
1672
|
+
function we(e, t) {
|
|
1761
1673
|
return typeof e == "string" ? e.includes(String(t)) : Array.isArray(e) ? e.includes(t) : Object.values(e ?? {}).includes(t);
|
|
1762
1674
|
}
|
|
1763
|
-
function
|
|
1764
|
-
return e == null ? !0 : typeof e == "string" || Array.isArray(e) ? e.length === 0 : e instanceof Map || e instanceof Set ? e.size === 0 : X(e)
|
|
1675
|
+
function Te(e) {
|
|
1676
|
+
return e == null ? !0 : typeof e == "string" || Array.isArray(e) ? e.length === 0 : e instanceof Map || e instanceof Set ? e.size === 0 : !X(e) || Object.keys(e).length === 0;
|
|
1765
1677
|
}
|
|
1766
1678
|
function Q(e, t, n) {
|
|
1767
1679
|
let r = n?.(e, t);
|
|
@@ -1771,30 +1683,30 @@ function Q(e, t, n) {
|
|
|
1771
1683
|
if (e instanceof Date || t instanceof Date) return e instanceof Date && t instanceof Date && e.getTime() === t.getTime();
|
|
1772
1684
|
if (Array.isArray(e) || Array.isArray(t)) return Array.isArray(e) && Array.isArray(t) && e.length === t.length && e.every((e, r) => Q(e, t[r], n));
|
|
1773
1685
|
let i = Object.keys(e), a = Object.keys(t);
|
|
1774
|
-
return i.length === a.length && i.every((r) =>
|
|
1686
|
+
return i.length === a.length && i.every((r) => me.hasOwnProperty.call(t, r) && Q(e[r], t[r], n));
|
|
1775
1687
|
}
|
|
1776
|
-
function
|
|
1688
|
+
function Ee(e, t) {
|
|
1777
1689
|
return Q(e, t);
|
|
1778
1690
|
}
|
|
1779
|
-
function
|
|
1691
|
+
function De(e) {
|
|
1780
1692
|
return Number.isFinite(e);
|
|
1781
1693
|
}
|
|
1782
|
-
function
|
|
1783
|
-
for (let n of t) if (n) for (let [t, r] of Object.entries(n)) X(r) && !Array.isArray(r) && X(e[t]) ?
|
|
1694
|
+
function Oe(e, ...t) {
|
|
1695
|
+
for (let n of t) if (n) for (let [t, r] of Object.entries(n)) X(r) && !Array.isArray(r) && X(e[t]) ? Oe(e[t], r) : e[t] = Z(r);
|
|
1784
1696
|
return e;
|
|
1785
1697
|
}
|
|
1786
|
-
function
|
|
1698
|
+
function ke(e, t) {
|
|
1787
1699
|
let n = { ...e ?? {} };
|
|
1788
1700
|
for (let e of Array.isArray(t) ? t : [t]) delete n[e];
|
|
1789
1701
|
return n;
|
|
1790
1702
|
}
|
|
1791
|
-
function
|
|
1792
|
-
let n =
|
|
1703
|
+
function Ae(e, t) {
|
|
1704
|
+
let n = ve(t), r = [];
|
|
1793
1705
|
for (let t = e.length - 1; t >= 0; t--) n(e[t], t, e) && r.unshift(...e.splice(t, 1));
|
|
1794
1706
|
return r;
|
|
1795
1707
|
}
|
|
1796
|
-
function
|
|
1797
|
-
let r =
|
|
1708
|
+
function je(e, t, n) {
|
|
1709
|
+
let r = he(t), i = e;
|
|
1798
1710
|
return r.forEach((e, t) => {
|
|
1799
1711
|
if (t === r.length - 1) {
|
|
1800
1712
|
i[e] = n;
|
|
@@ -1804,23 +1716,23 @@ function We(e, t, n) {
|
|
|
1804
1716
|
i[e] ??= typeof a == "number" || /^\d+$/.test(String(a)) ? [] : {}, i = i[e];
|
|
1805
1717
|
}), e;
|
|
1806
1718
|
}
|
|
1807
|
-
function
|
|
1719
|
+
function Me(e, t) {
|
|
1808
1720
|
let n = t ?? ((e) => e);
|
|
1809
1721
|
return Array.from({ length: Math.max(0, e) }, (e, t) => n(t));
|
|
1810
1722
|
}
|
|
1811
|
-
function
|
|
1723
|
+
function Ne(...e) {
|
|
1812
1724
|
let t = Math.max(0, ...e.map((e) => e.length));
|
|
1813
1725
|
return Array.from({ length: t }, (t, n) => e.map((e) => e[n]));
|
|
1814
1726
|
}
|
|
1815
1727
|
//#endregion
|
|
1816
1728
|
//#region ../../lib-react/categorize/dist/index.js
|
|
1817
|
-
var $ = (0,
|
|
1818
|
-
let i =
|
|
1729
|
+
var $ = (0, pe.default)("@pie-lib:categorize"), Pe = (e, t, n) => (t ||= [], t.reduce((t, r) => {
|
|
1730
|
+
let i = Fe(e, r, n - t.count);
|
|
1819
1731
|
return t.out.push(i.array), t.count += i.count || 0, t;
|
|
1820
1732
|
}, {
|
|
1821
1733
|
out: [],
|
|
1822
1734
|
count: 0
|
|
1823
|
-
}).out),
|
|
1735
|
+
}).out), Fe = (e, t, n) => {
|
|
1824
1736
|
if (t ||= [], n === 0) {
|
|
1825
1737
|
let n = t.filter((t) => t !== e);
|
|
1826
1738
|
return {
|
|
@@ -1837,17 +1749,17 @@ var $ = (0, Ce.default)("@pie-lib:categorize"), qe = (e, t, n) => (t ||= [], t.r
|
|
|
1837
1749
|
count: r.count
|
|
1838
1750
|
};
|
|
1839
1751
|
}
|
|
1840
|
-
},
|
|
1752
|
+
}, Ie = (e, t) => (t ||= [], t.reduce((e, t) => {
|
|
1841
1753
|
if ($("choice: ----> ", t.id, "categoryCount: ", t.categoryCount), t.categoryCount === void 0 || t.categoryCount === 0) return e;
|
|
1842
1754
|
{
|
|
1843
1755
|
let n = e.map((e) => e.choices);
|
|
1844
|
-
return
|
|
1756
|
+
return Pe(t.id, n, t.categoryCount).map((t, n) => ({
|
|
1845
1757
|
category: e[n].category,
|
|
1846
1758
|
alternateResponses: e[n].alternateResponses,
|
|
1847
1759
|
choices: t
|
|
1848
1760
|
}));
|
|
1849
1761
|
}
|
|
1850
|
-
}, e)),
|
|
1762
|
+
}, e)), Le = (e, t) => (t ||= [], t.reduce((e, t) => {
|
|
1851
1763
|
if ($("choice: ----> ", t.id, "categoryCount: ", t.categoryCount), t.categoryCount === void 0 || t.categoryCount === 0) return e;
|
|
1852
1764
|
{
|
|
1853
1765
|
let n = {};
|
|
@@ -1856,7 +1768,8 @@ var $ = (0, Ce.default)("@pie-lib:categorize"), qe = (e, t, n) => (t ||= [], t.r
|
|
|
1856
1768
|
}));
|
|
1857
1769
|
let r = [];
|
|
1858
1770
|
return Object.keys(n).forEach((e) => {
|
|
1859
|
-
|
|
1771
|
+
let i = Pe(t.id, n[e], t.categoryCount);
|
|
1772
|
+
n[e] = i, n[e].forEach((e, t) => {
|
|
1860
1773
|
r[t] || (r[t] = []), r[t].push(e);
|
|
1861
1774
|
});
|
|
1862
1775
|
}), e.map((e, t) => ({
|
|
@@ -1865,26 +1778,26 @@ var $ = (0, Ce.default)("@pie-lib:categorize"), qe = (e, t, n) => (t ||= [], t.r
|
|
|
1865
1778
|
choices: e.choices
|
|
1866
1779
|
}));
|
|
1867
1780
|
}
|
|
1868
|
-
}, e)),
|
|
1869
|
-
let n = t.reduce((t, n) => t +
|
|
1781
|
+
}, e)), Re = (e, t) => {
|
|
1782
|
+
let n = t.reduce((t, n) => t + ze(e, n.choices), 0);
|
|
1870
1783
|
return $("[countInAnswer] choiceId:", e, t), n;
|
|
1871
|
-
},
|
|
1784
|
+
}, ze = (e, t) => (t || []).filter((t) => t === e).length, Be = (e, t) => !e || !e.id || !Array.isArray(t) ? 0 : t.reduce((t, n) => t + (n.choices || []).filter((t) => t && t.id === e.id).length, 0), Ve = (e, t) => t.filter((t) => t.category !== e), He = (e, t, n) => t.map((t) => {
|
|
1872
1785
|
if (!n || t.category === n) {
|
|
1873
|
-
let n =
|
|
1874
|
-
return
|
|
1786
|
+
let n = ye(t.choices);
|
|
1787
|
+
return Ae(n, (t) => t === e), {
|
|
1875
1788
|
...t,
|
|
1876
1789
|
choices: n
|
|
1877
1790
|
};
|
|
1878
1791
|
} else return t;
|
|
1879
|
-
}),
|
|
1792
|
+
}), Ue = (e, t, n) => n.map((n) => n.category === t ? (n.choices = n.choices.reduce((t, n) => (n.id === e.id ? t.findIndex((t) => t.id === e.id) === -1 && t.push(n) : t.push(n), t), []), n) : (n.choices = (n.choices || []).filter((t) => t !== e.id), n)), We = (e, t, n, r) => ($("[removeChoiceFromCategory] choiceIndex:", n), r.map((r) => {
|
|
1880
1793
|
if (r.category === t) {
|
|
1881
|
-
let t =
|
|
1794
|
+
let t = ye(r.choices), i = t.findIndex((t, r) => t === e && r >= n);
|
|
1882
1795
|
return i !== -1 && t.splice(i, 1), {
|
|
1883
1796
|
...r,
|
|
1884
1797
|
choices: t
|
|
1885
1798
|
};
|
|
1886
1799
|
} else return r;
|
|
1887
|
-
})),
|
|
1800
|
+
})), Ge = (e, t, n, r, i) => (i || []).map((e) => {
|
|
1888
1801
|
if (e?.category === t) {
|
|
1889
1802
|
let t = (e?.alternateResponses || []).map((e, t) => (t === r && (e || []).splice(n, 1), e));
|
|
1890
1803
|
return {
|
|
@@ -1893,10 +1806,10 @@ var $ = (0, Ce.default)("@pie-lib:categorize"), qe = (e, t, n) => (t ||= [], t.r
|
|
|
1893
1806
|
};
|
|
1894
1807
|
}
|
|
1895
1808
|
return e;
|
|
1896
|
-
}),
|
|
1809
|
+
}), Ke = (e, t, n, r, i) => ($("[moveChoiceToCategory] choice: ", e, "from: ", t, "to: ", n, "answers: ", i), t === n ? i : (t && (i = We(e, t, r, i)), i.findIndex((e) => e.category === n) === -1 ? (i.push({
|
|
1897
1810
|
category: n,
|
|
1898
1811
|
choices: [e]
|
|
1899
|
-
}), i) : i.map((t) => t.category === n ? (t.choices = t.choices || [], t.choices.push(e), t) : t))),
|
|
1812
|
+
}), i) : i.map((t) => t.category === n ? (t.choices = t.choices || [], t.choices.push(e), t) : t))), qe = (e, t, n, r, i, a, o) => ($("[moveChoiceToAlternate] choice: ", e, "from: ", t, "to: ", n, "answers: ", i, "chocieIndex: ", r), t === n ? i : i.map((r) => (r.category === n && (o !== 0 && r.alternateResponses && (r.alternateResponses[a] = (r.alternateResponses[a] || []).filter((t) => t !== e)), r.alternateResponses || (r.alternateResponses = [], r.alternateResponses[a] = []), r.alternateResponses[a].push(e)), r.category === t && o !== 0 && r.alternateResponses && r.alternateResponses[a] && (r.alternateResponses[a] = r.alternateResponses[a].filter((t) => t !== e)), r))), Je = (e, t) => e.categoryCount > 0 ? Be(e, t) < e.categoryCount : !0, Ye = (e, t) => t.reduce((e, t) => {
|
|
1900
1813
|
let n = e.copyOfPossibleResponse.findIndex((e) => t && e === t.id);
|
|
1901
1814
|
return n >= 0 ? (e.builtChoices.push({
|
|
1902
1815
|
...t,
|
|
@@ -1909,8 +1822,8 @@ var $ = (0, Ce.default)("@pie-lib:categorize"), qe = (e, t, n) => (t ||= [], t.r
|
|
|
1909
1822
|
builtChoices: [],
|
|
1910
1823
|
copyOfPossibleResponse: [...e],
|
|
1911
1824
|
allChoicesAreCorrect: !0
|
|
1912
|
-
}),
|
|
1913
|
-
let r = e[n.id] || [], i = n.choices || [], { builtChoices: a, allChoicesAreCorrect: o } =
|
|
1825
|
+
}), Xe = (e, t) => t.reduce((t, n) => {
|
|
1826
|
+
let r = e[n.id] || [], i = n.choices || [], { builtChoices: a, allChoicesAreCorrect: o } = Ye(r, i), s = i.length === r.length;
|
|
1914
1827
|
return t.builtCategories.push({
|
|
1915
1828
|
...n,
|
|
1916
1829
|
correct: o && s,
|
|
@@ -1919,20 +1832,20 @@ var $ = (0, Ce.default)("@pie-lib:categorize"), qe = (e, t, n) => (t ||= [], t.r
|
|
|
1919
1832
|
}, {
|
|
1920
1833
|
builtCategories: [],
|
|
1921
1834
|
correct: !0
|
|
1922
|
-
}),
|
|
1835
|
+
}), Ze = (e) => e ? e.reduce((e, t) => (e[0] ? e[0][t.category] = t.choices : e.push({ [t.category]: t.choices }), t.alternateResponses && t.alternateResponses.forEach((n, r) => {
|
|
1923
1836
|
e[r + 1] ? e[r + 1][t.category] = n : e.push({ [t.category]: n });
|
|
1924
|
-
}), e), []) : [],
|
|
1837
|
+
}), e), []) : [], Qe = (e, t, n) => (e ||= [], n ||= [], t ||= [], e.map((e) => {
|
|
1925
1838
|
let { choices: r = [] } = n.find((t) => t.category === e.id) || {};
|
|
1926
1839
|
return {
|
|
1927
1840
|
...e,
|
|
1928
1841
|
choices: r.map((e) => t.find((t) => t.id === e))
|
|
1929
1842
|
};
|
|
1930
|
-
})),
|
|
1843
|
+
})), $e = (e, t, n, r) => {
|
|
1931
1844
|
e ||= [], t ||= [], n ||= [];
|
|
1932
|
-
let i =
|
|
1845
|
+
let i = Ze(r) || [], a = Qe(e, t, n), o, s;
|
|
1933
1846
|
if (i.length) {
|
|
1934
1847
|
let e = i.reduce((e, t) => {
|
|
1935
|
-
let { builtCategories: n, correct: r } =
|
|
1848
|
+
let { builtCategories: n, correct: r } = Xe(t, a);
|
|
1936
1849
|
return e.bestResponse === null || !e.entirelyCorrect && r ? {
|
|
1937
1850
|
bestResponse: t,
|
|
1938
1851
|
builtCategories: n,
|
|
@@ -1946,13 +1859,13 @@ var $ = (0, Ce.default)("@pie-lib:categorize"), qe = (e, t, n) => (t ||= [], t.r
|
|
|
1946
1859
|
a = e.builtCategories, o = e.bestResponse, s = e.entirelyCorrect;
|
|
1947
1860
|
}
|
|
1948
1861
|
return {
|
|
1949
|
-
choices: t.map((e) =>
|
|
1862
|
+
choices: t.map((e) => Je(e, a) ? e : { empty: !0 }),
|
|
1950
1863
|
categories: a,
|
|
1951
1864
|
correct: s,
|
|
1952
1865
|
bestResponse: o
|
|
1953
1866
|
};
|
|
1954
1867
|
};
|
|
1955
1868
|
//#endregion
|
|
1956
|
-
export {
|
|
1869
|
+
export { be as C, i as D, fe as E, Ne as S, Se as T, we as _, He as a, Z as b, Le as c, Ge as d, Ee as f, Te as g, De as h, Re as i, We as l, je as m, Ue as n, Ie as o, Oe as p, Ke as r, Ve as s, $e as t, qe as u, ke as v, Ce as w, Me as x, xe as y };
|
|
1957
1870
|
|
|
1958
|
-
//# sourceMappingURL=dist-
|
|
1871
|
+
//# sourceMappingURL=dist-C11U2GIc.js.map
|