@pie-element/simple-cloze 0.1.4-next.6 → 0.1.4-next.8

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.
Files changed (39) hide show
  1. package/author.js +2 -0
  2. package/dist/author/index.d.ts +8 -0
  3. package/dist/author/index.js +181 -242
  4. package/dist/author/index.js.map +1 -1
  5. package/dist/browser/author/index.js +3136 -3044
  6. package/dist/browser/author/index.js.map +1 -1
  7. package/dist/browser/{client-Dt8SOe5Z.js → client-BSTc3boO.js} +650 -755
  8. package/dist/browser/client-BSTc3boO.js.map +1 -0
  9. package/dist/browser/controller/index.js +42 -32
  10. package/dist/browser/controller/index.js.map +1 -1
  11. package/dist/browser/delivery/index.js +205 -156
  12. package/dist/browser/delivery/index.js.map +1 -1
  13. package/dist/browser/i18n-BaF24Jzw.js +1610 -0
  14. package/dist/browser/i18n-BaF24Jzw.js.map +1 -0
  15. package/dist/browser/plain-text-iaQZhkGe.js +53 -0
  16. package/dist/browser/plain-text-iaQZhkGe.js.map +1 -0
  17. package/dist/browser/print/index.js +64 -21
  18. package/dist/browser/print/index.js.map +1 -1
  19. package/dist/controller/defaults.d.ts +1 -0
  20. package/dist/controller/index.d.ts +51 -8
  21. package/dist/controller/index.js +121 -29
  22. package/dist/controller/index.js.map +1 -1
  23. package/dist/controller/plain-text.d.ts +11 -0
  24. package/dist/delivery/index.d.ts +2 -20
  25. package/dist/delivery/index.js +2896 -392
  26. package/dist/delivery/index.js.map +1 -1
  27. package/dist/i18n.d.ts +7 -0
  28. package/dist/index.iife.js +9 -3
  29. package/dist/index.js +2 -4912
  30. package/dist/print/index.d.ts +7 -0
  31. package/dist/print/index.js +2773 -28
  32. package/dist/print/index.js.map +1 -1
  33. package/dist/runtime-support.js +5 -5
  34. package/dist/runtime-support.js.map +1 -1
  35. package/module/print.js +2381 -600
  36. package/module/print.js.map +1 -1
  37. package/package.json +3 -4
  38. package/dist/browser/client-Dt8SOe5Z.js.map +0 -1
  39. package/dist/index.js.map +0 -1
@@ -0,0 +1,1610 @@
1
+ //#region ../../shared/math-rendering-mathjax/dist/index.js
2
+ var e = null;
3
+ function t(t) {
4
+ return typeof window > "u" || window.MathJax?.typesetPromise ? Promise.resolve() : e || (e = new Promise((e, n) => {
5
+ let { useSingleDollar: r = !1, accessibility: i = !0, loadFonts: a = !0, srcUrl: o } = t, s = {
6
+ loader: { load: i ? ["a11y/assistive-mml"] : [] },
7
+ tex: {
8
+ packages: [
9
+ "base",
10
+ "ams",
11
+ "autoload"
12
+ ],
13
+ macros: {
14
+ parallelogram: "\\lower.2em{\\Huge\\unicode{x25B1}}",
15
+ overarc: "\\overparen",
16
+ napprox: "\\not\\approx",
17
+ longdiv: "\\enclose{longdiv}"
18
+ }
19
+ },
20
+ options: {
21
+ enableMenu: i,
22
+ enableExplorer: i,
23
+ enableAssistiveMml: i
24
+ },
25
+ startup: {
26
+ ready: () => {
27
+ window.MathJax?.startup.defaultReady && (window.MathJax.startup.defaultReady(), e());
28
+ },
29
+ defaultReady: () => {}
30
+ }
31
+ };
32
+ r && s.tex && (s.tex.inlineMath = [["$", "$"], ["\\(", "\\)"]], s.tex.processEscapes = !0), a || (s.chtml = { fontURL: "" }), window.MathJax = s;
33
+ let c = document.createElement("script");
34
+ c.src = o || "https://cdn.jsdelivr.net/npm/mathjax@4/tex-chtml.js", c.async = !0, c.onload = () => {
35
+ setTimeout(e, 100);
36
+ }, c.onerror = () => {
37
+ n(/* @__PURE__ */ Error("Failed to load MathJax"));
38
+ }, document.head.appendChild(c);
39
+ }), e);
40
+ }
41
+ function n() {
42
+ let e = window.MathJax?.startup?.document;
43
+ if (typeof e?.assistiveMml == "function") try {
44
+ e.assistiveMml().updateDocument?.();
45
+ } catch (e) {
46
+ console.warn("[mathjax-renderer] Failed to attach assistive MathML:", e);
47
+ }
48
+ }
49
+ function r(e = {}) {
50
+ return async (r) => {
51
+ if (await t(e), !window.MathJax?.typesetPromise) {
52
+ console.warn("[mathjax-renderer] MathJax not loaded or missing typesetPromise.");
53
+ return;
54
+ }
55
+ await window.MathJax.typesetPromise([r]), n();
56
+ };
57
+ }
58
+ var i = null;
59
+ function a() {
60
+ return i ||= r({
61
+ accessibility: !0,
62
+ useSingleDollar: !0
63
+ }), i;
64
+ }
65
+ function o() {
66
+ if (typeof window > "u") return null;
67
+ let e = window["@pie-lib/math-rendering"];
68
+ return typeof e?.renderMath == "function" ? e : null;
69
+ }
70
+ var s = async (e) => {
71
+ if (typeof window > "u") return;
72
+ let t = typeof e == "string", n;
73
+ t ? (n = document.createElement("div"), n.innerHTML = e) : n = e || document.body;
74
+ let r = o();
75
+ return r ? await r.renderMath?.(n) : await a()(n), t ? n.innerHTML : void 0;
76
+ }, c = {
77
+ translation: {
78
+ categorize: {
79
+ limitMaxChoicesPerCategory: "You've reached the limit of {{maxChoicesPerCategory}} responses per area. To add another response, one must first be removed.",
80
+ maxChoicesPerCategoryRestriction: "To change this value to {{maxChoicesPerCategory}}, each category must have {{maxChoicesPerCategory}} or fewer answer choice[s]."
81
+ },
82
+ ebsr: { part: "Part {{index}}" },
83
+ numberLine: {
84
+ addElementLimit_one: "You can only add {{count}} element",
85
+ addElementLimit_other: "You can only add {{count}} elements",
86
+ clearAll: "Clear all"
87
+ },
88
+ imageClozeAssociation: {
89
+ reachedLimit_one: "You’ve reached the limit of {{count}} response per area. To add another response, one must first be removed.",
90
+ reachedLimit_other: "Full"
91
+ },
92
+ drawingResponse: {
93
+ fillColor: "Fill color",
94
+ outlineColor: "Outline color",
95
+ noFill: "No fill",
96
+ lightblue: "Light blue",
97
+ lightyellow: "Light yellow",
98
+ red: "Red",
99
+ orange: "Orange",
100
+ yellow: "Yellow",
101
+ violet: "Violet",
102
+ blue: "Blue",
103
+ green: "Green",
104
+ white: "White",
105
+ black: "Black",
106
+ onDoubleClick: "Double click to edit this text. Press Enter to submit."
107
+ },
108
+ charting: {
109
+ addCategory: "Add category",
110
+ actions: "Actions",
111
+ add: "Add",
112
+ delete: "Delete",
113
+ newLabel: "New label",
114
+ reachedLimit_other: "There can't be more than {{count}} categories.",
115
+ keyLegend: {
116
+ incorrectAnswer: "Student incorrect answer",
117
+ correctAnswer: "Student correct answer",
118
+ correctKeyAnswer: "Answer key correct"
119
+ }
120
+ },
121
+ graphing: {
122
+ point: "Point",
123
+ circle: "Circle",
124
+ line: "Line",
125
+ parabola: "Parabola",
126
+ absolute: "Absolute Value",
127
+ exponential: "Exponential",
128
+ polygon: "Polygon",
129
+ ray: "Ray",
130
+ segment: "Segment",
131
+ sine: "Sine",
132
+ vector: "Vector",
133
+ label: "Label",
134
+ redo: "Redo",
135
+ reset: "Reset"
136
+ },
137
+ mathInline: { primaryCorrectWithAlternates: "Note: The answer shown above is the primary correct answer specified by the author for this item, but other answers may also be recognized as correct." },
138
+ mcPopulatedBlank: {
139
+ answerChoices: "Answer choices",
140
+ blankLabel: "blank",
141
+ emptyBlank: "(blank)",
142
+ blankPreSelectionHint: "The answer you choose will appear on the blank line above.",
143
+ correctAnswerSelected: "Correct answer selected",
144
+ incorrectAnswerSelected: "Incorrect answer selected",
145
+ selectedAnswerImage: "Selected answer image",
146
+ choiceImage: "Choice {{id}}",
147
+ clickToEnableAutoplay: "Click to enable audio autoplay",
148
+ audioResourceUnavailable: "Audio is enabled but no playable audio URL is configured.",
149
+ listen: "Listen",
150
+ listenSilentAlt: "Repeat instructions",
151
+ listenPlayingAlt: "Instructions are playing",
152
+ printAudio: "Audio:",
153
+ printTranscript: "Transcript:"
154
+ },
155
+ multipleChoice: {
156
+ minSelections: "Select at least {{minSelections}}.",
157
+ maxSelections_one: "Only {{maxSelections}} answer is allowed.",
158
+ maxSelections_other: "Only {{maxSelections}} answers are allowed.",
159
+ minmaxSelections_equal: "Select {{minSelections}}.",
160
+ minmaxSelections_range: "Select between {{minSelections}} and {{maxSelections}}."
161
+ },
162
+ selectText: {
163
+ correctAnswerSelected: "Correct",
164
+ correctAnswerNotSelected: "Correct Answer Not Selected",
165
+ incorrectSelection: "Incorrect Selection",
166
+ key: "Key"
167
+ },
168
+ simpleCloze: {
169
+ correctAnswerShown: "Correct answer",
170
+ correct: "Correct",
171
+ incorrect: "Incorrect",
172
+ unanswered: "No answer",
173
+ placeholder: "Enter your answer...",
174
+ answerInput: "Your answer",
175
+ printCorrectAnswer: "Correct answer:",
176
+ printAnswerBlank: "Answer blank"
177
+ },
178
+ vennClassification: {
179
+ tray: "Tiles to classify",
180
+ unknownTarget: "unknown",
181
+ cancelled: "Cancelled",
182
+ returnedToTray: "{{name}} returned to tray",
183
+ placedIn: "{{name}} placed in {{target}}",
184
+ pickedUp: "Picked up {{name}}",
185
+ pickedUpWithKeyboard: "Picked up {{name}}, drop target: {{target}}. Use arrow keys to choose a drop target, Enter to drop, Escape to cancel.",
186
+ dropTarget: "Drop target: {{target}}",
187
+ unsupportedCircles_one: "This diagram cannot be shown: it has {{count}} circle, and only {{supported}} are supported.",
188
+ unsupportedCircles_other: "This diagram cannot be shown: it has {{count}} circles, and only {{supported}} are supported.",
189
+ setNumber: "Set {{number}}",
190
+ regionOnly: "{{set}} only",
191
+ regionNeither: "Neither {{first}} nor {{second}}",
192
+ regionNoneOf: "None of {{sets}}",
193
+ regionAndSeparator: " and ",
194
+ tileFallbackName: "Tile",
195
+ tileNotPlaced: "not placed",
196
+ tileInRegion: "in {{region}}",
197
+ tileCorrect: "correct",
198
+ tileIncorrect: "incorrect"
199
+ }
200
+ },
201
+ common: {
202
+ undo: "Undo",
203
+ clearAll: "Clear all",
204
+ correct: "Correct",
205
+ incorrect: "Incorrect",
206
+ showCorrectAnswer: "Show correct answer",
207
+ hideCorrectAnswer: "Hide correct answer",
208
+ showTeacherInstructions: "Show Teacher Instructions",
209
+ hideTeacherInstructions: "Hide Teacher Instructions",
210
+ commonCorrectAnswerWithAlternates: "Note: The answer shown above is the most common correct answer for this item. One or more additional correct answers are also defined, and will also be recognized as correct.",
211
+ warning: "Warning",
212
+ showNote: "Show Note",
213
+ hideNote: "Hide Note",
214
+ cancel: "Cancel"
215
+ }
216
+ }, l = {
217
+ translation: {
218
+ categorize: {
219
+ limitMaxChoicesPerCategory: "Has alcanzado el límite de {{maxChoicesPerCategory}} respuestas por área. Para agregar otra respuesta, primero se debe eliminar una respuesta.",
220
+ maxChoicesPerCategoryRestriction: "Para cambiar este valor a {{maxChoicesPerCategory}}, cada categoría debe tener {{maxChoicesPerCategory}} o menos opciones de respuesta"
221
+ },
222
+ ebsr: { part: "Parte {{index}}" },
223
+ numberLine: {
224
+ addElementLimit_one: "Solo puedes agregar {{count}} elemento",
225
+ addElementLimit_other: "Solo puedes agregar {{count}} elementos",
226
+ clearAll: "Borrar todo"
227
+ },
228
+ imageClozeAssociation: {
229
+ reachedLimit_one: "Has alcanzado el límite de {{count}} respuesta por área. Para agregar otra respuesta, primero se debe eliminar una respuesta.",
230
+ reachedLimit_other: "Lleno"
231
+ },
232
+ drawingResponse: {
233
+ fillColor: "Color de relleno",
234
+ outlineColor: "Color del contorno",
235
+ noFill: "Sin relleno",
236
+ lightblue: "Azul claro",
237
+ lightyellow: "Amarillo claro",
238
+ red: "Rojo",
239
+ orange: "Naranja",
240
+ yellow: "Amarillo",
241
+ violet: "Violeta",
242
+ blue: "Azul",
243
+ green: "Verde",
244
+ white: "Blanco",
245
+ black: "Negro",
246
+ onDoubleClick: "Haz doble clic para revisar este texto. Presiona el botón de ingreso para enviar"
247
+ },
248
+ charting: {
249
+ addCategory: "Añadir categoría",
250
+ actions: "Acciones",
251
+ add: "Añadir",
252
+ delete: "Eliminar",
253
+ newLabel: "Nueva etiqueta",
254
+ reachedLimit_other: "No puede haber más de {{count}} categorías.",
255
+ keyLegend: {
256
+ incorrectAnswer: "Respuesta incorrecta del estudiante",
257
+ correctAnswer: "Respuesta correcta del estudiante",
258
+ correctKeyAnswer: "Clave de respuesta correcta"
259
+ }
260
+ },
261
+ graphing: {
262
+ point: "Punto",
263
+ circle: "Circulo",
264
+ line: "Línea",
265
+ parabola: "Parábola",
266
+ absolute: "Valor absoluto",
267
+ exponential: "Exponencial",
268
+ polygon: "Polígono",
269
+ ray: "Semirrecta",
270
+ segment: "Segmento ",
271
+ sine: "Seno",
272
+ vector: "Vector",
273
+ label: "Etiqueta",
274
+ redo: "Rehacer",
275
+ reset: "Reiniciar"
276
+ },
277
+ mathInline: { primaryCorrectWithAlternates: "Nota: La respuesta que se muestra arriba es la respuesta correcta principal especificada por el autor para esta pregunta, pero también se pueden reconocer otras respuestas como correctas." },
278
+ mcPopulatedBlank: {
279
+ answerChoices: "Opciones de respuesta",
280
+ blankLabel: "espacio en blanco",
281
+ emptyBlank: "(en blanco)",
282
+ blankPreSelectionHint: "La respuesta que elijas aparecerá en la línea en blanco de arriba.",
283
+ correctAnswerSelected: "Respuesta correcta seleccionada",
284
+ incorrectAnswerSelected: "Respuesta incorrecta seleccionada",
285
+ selectedAnswerImage: "Imagen de la respuesta seleccionada",
286
+ choiceImage: "Opción {{id}}",
287
+ clickToEnableAutoplay: "Haz clic para activar la reproducción automática del audio",
288
+ audioResourceUnavailable: "El audio está activado, pero no hay una URL de audio reproducible configurada.",
289
+ listen: "Escuchar",
290
+ listenSilentAlt: "Escuchar. Repetir las instrucciones.",
291
+ listenPlayingAlt: "Escuchar. Estas son las instrucciones.",
292
+ printAudio: "Audio:",
293
+ printTranscript: "Transcripción:"
294
+ },
295
+ multipleChoice: {
296
+ minSelections: "Seleccione al menos {{minSelections}}.",
297
+ maxSelections_one: "Sólo se permite {{maxSelections}} respuesta.",
298
+ maxSelections_other: "Sólo se permiten {{maxSelections}} respuestas.",
299
+ minmaxSelections_equal: "Seleccione {{minSelections}}.",
300
+ minmaxSelections_range: "Seleccione entre {{minSelections}} y {{maxSelections}}."
301
+ },
302
+ selectText: {
303
+ correctAnswerSelected: "Respuesta Correcta",
304
+ correctAnswerNotSelected: "Respuesta Correcta No Seleccionada",
305
+ incorrectSelection: "Selección Incorrecta",
306
+ key: "Clave"
307
+ },
308
+ simpleCloze: {
309
+ correctAnswerShown: "Respuesta correcta",
310
+ correct: "Correcto",
311
+ incorrect: "Incorrecto",
312
+ unanswered: "Sin respuesta",
313
+ placeholder: "Escribe tu respuesta...",
314
+ answerInput: "Tu respuesta",
315
+ printCorrectAnswer: "Respuesta correcta:",
316
+ printAnswerBlank: "Espacio para la respuesta"
317
+ },
318
+ vennClassification: {
319
+ tray: "Fichas para clasificar",
320
+ unknownTarget: "desconocido",
321
+ cancelled: "Cancelado",
322
+ returnedToTray: "Se devolvió {{name}} a la bandeja",
323
+ placedIn: "Se colocó {{name}} en {{target}}",
324
+ pickedUp: "Se tomó {{name}}",
325
+ pickedUpWithKeyboard: "Se tomó {{name}}, destino: {{target}}. Usa las flechas para elegir un destino, Enter para soltar y Escape para cancelar.",
326
+ dropTarget: "Destino: {{target}}",
327
+ unsupportedCircles_one: "No se puede mostrar este diagrama: tiene {{count}} círculo, y solo se admiten {{supported}}.",
328
+ unsupportedCircles_other: "No se puede mostrar este diagrama: tiene {{count}} círculos, y solo se admiten {{supported}}.",
329
+ setNumber: "Conjunto {{number}}",
330
+ regionOnly: "Solo {{set}}",
331
+ regionNeither: "Ni {{first}} ni {{second}}",
332
+ regionNoneOf: "Ninguno de {{sets}}",
333
+ regionAndSeparator: " y ",
334
+ tileFallbackName: "Ficha",
335
+ tileNotPlaced: "sin colocar",
336
+ tileInRegion: "en {{region}}",
337
+ tileCorrect: "correcta",
338
+ tileIncorrect: "incorrecta"
339
+ }
340
+ },
341
+ common: {
342
+ undo: "Deshacer",
343
+ clearAll: "Borrar todo",
344
+ correct: "Correcto",
345
+ incorrect: "Incorrecto",
346
+ showCorrectAnswer: "Mostrar respuesta correcta",
347
+ hideCorrectAnswer: "Ocultar respuesta correcta",
348
+ showTeacherInstructions: "Mostrar instrucciones para el maestro",
349
+ hideTeacherInstructions: "Ocultar instrucciones para el maestro",
350
+ commonCorrectAnswerWithAlternates: "Nota: La respuesta que se muestra arriba es la respuesta correcta más común para esta pregunta. También se definen una o más respuestas correctas adicionales, y también se reconocerán como correctas.",
351
+ warning: "Advertencia",
352
+ showNote: "Mostrar Nota",
353
+ hideNote: "Ocultar Nota",
354
+ cancel: "Cancelar"
355
+ }
356
+ }, u = (e) => typeof e == "string", d = () => {
357
+ let e, t, n = new Promise((n, r) => {
358
+ e = n, t = r;
359
+ });
360
+ return n.resolve = e, n.reject = t, n;
361
+ }, f = (e) => e == null ? "" : "" + e, p = (e, t, n) => {
362
+ e.forEach((e) => {
363
+ t[e] && (n[e] = t[e]);
364
+ });
365
+ }, m = /###/g, h = (e) => e && e.indexOf("###") > -1 ? e.replace(m, ".") : e, g = (e) => !e || u(e), _ = (e, t, n) => {
366
+ let r = u(t) ? t.split(".") : t, i = 0;
367
+ for (; i < r.length - 1;) {
368
+ if (g(e)) return {};
369
+ let t = h(r[i]);
370
+ !e[t] && n && (e[t] = new n()), e = Object.prototype.hasOwnProperty.call(e, t) ? e[t] : {}, ++i;
371
+ }
372
+ return g(e) ? {} : {
373
+ obj: e,
374
+ k: h(r[i])
375
+ };
376
+ }, v = (e, t, n) => {
377
+ let { obj: r, k: i } = _(e, t, Object);
378
+ if (r !== void 0 || t.length === 1) {
379
+ r[i] = n;
380
+ return;
381
+ }
382
+ let a = t[t.length - 1], o = t.slice(0, t.length - 1), s = _(e, o, Object);
383
+ for (; s.obj === void 0 && o.length;) a = `${o[o.length - 1]}.${a}`, o = o.slice(0, o.length - 1), s = _(e, o, Object), s?.obj && s.obj[`${s.k}.${a}`] !== void 0 && (s.obj = void 0);
384
+ s.obj[`${s.k}.${a}`] = n;
385
+ }, y = (e, t, n, r) => {
386
+ let { obj: i, k: a } = _(e, t, Object);
387
+ i[a] = i[a] || [], i[a].push(n);
388
+ }, b = (e, t) => {
389
+ let { obj: n, k: r } = _(e, t);
390
+ if (n && Object.prototype.hasOwnProperty.call(n, r)) return n[r];
391
+ }, x = (e, t, n) => {
392
+ let r = b(e, n);
393
+ return r === void 0 ? b(t, n) : r;
394
+ }, S = (e, t, n) => {
395
+ for (let r in t) r !== "__proto__" && r !== "constructor" && (r in e ? u(e[r]) || e[r] instanceof String || u(t[r]) || t[r] instanceof String ? n && (e[r] = t[r]) : S(e[r], t[r], n) : e[r] = t[r]);
396
+ return e;
397
+ }, C = (e) => e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"), w = {
398
+ "&": "&amp;",
399
+ "<": "&lt;",
400
+ ">": "&gt;",
401
+ "\"": "&quot;",
402
+ "'": "&#39;",
403
+ "/": "&#x2F;"
404
+ }, T = (e) => u(e) ? e.replace(/[&<>"'\/]/g, (e) => w[e]) : e, E = class {
405
+ constructor(e) {
406
+ this.capacity = e, this.regExpMap = /* @__PURE__ */ new Map(), this.regExpQueue = [];
407
+ }
408
+ getRegExp(e) {
409
+ let t = this.regExpMap.get(e);
410
+ if (t !== void 0) return t;
411
+ let n = new RegExp(e);
412
+ return this.regExpQueue.length === this.capacity && this.regExpMap.delete(this.regExpQueue.shift()), this.regExpMap.set(e, n), this.regExpQueue.push(e), n;
413
+ }
414
+ }, D = [
415
+ " ",
416
+ ",",
417
+ "?",
418
+ "!",
419
+ ";"
420
+ ], O = new E(20), k = (e, t, n) => {
421
+ t ||= "", n ||= "";
422
+ let r = D.filter((e) => t.indexOf(e) < 0 && n.indexOf(e) < 0);
423
+ if (r.length === 0) return !0;
424
+ let i = O.getRegExp(`(${r.map((e) => e === "?" ? "\\?" : e).join("|")})`), a = !i.test(e);
425
+ if (!a) {
426
+ let t = e.indexOf(n);
427
+ t > 0 && !i.test(e.substring(0, t)) && (a = !0);
428
+ }
429
+ return a;
430
+ }, A = (e, t, n = ".") => {
431
+ if (!e) return;
432
+ if (e[t]) return Object.prototype.hasOwnProperty.call(e, t) ? e[t] : void 0;
433
+ let r = t.split(n), i = e;
434
+ for (let e = 0; e < r.length;) {
435
+ if (!i || typeof i != "object") return;
436
+ let t, a = "";
437
+ for (let o = e; o < r.length; ++o) if (o !== e && (a += n), a += r[o], t = i[a], t !== void 0) {
438
+ if ([
439
+ "string",
440
+ "number",
441
+ "boolean"
442
+ ].indexOf(typeof t) > -1 && o < r.length - 1) continue;
443
+ e += o - e + 1;
444
+ break;
445
+ }
446
+ i = t;
447
+ }
448
+ return i;
449
+ }, j = (e) => e?.replace(/_/g, "-"), ee = {
450
+ type: "logger",
451
+ log(e) {
452
+ this.output("log", e);
453
+ },
454
+ warn(e) {
455
+ this.output("warn", e);
456
+ },
457
+ error(e) {
458
+ this.output("error", e);
459
+ },
460
+ output(e, t) {
461
+ console?.[e]?.apply?.(console, t);
462
+ }
463
+ }, M = new class e {
464
+ constructor(e, t = {}) {
465
+ this.init(e, t);
466
+ }
467
+ init(e, t = {}) {
468
+ this.prefix = t.prefix || "i18next:", this.logger = e || ee, this.options = t, this.debug = t.debug;
469
+ }
470
+ log(...e) {
471
+ return this.forward(e, "log", "", !0);
472
+ }
473
+ warn(...e) {
474
+ return this.forward(e, "warn", "", !0);
475
+ }
476
+ error(...e) {
477
+ return this.forward(e, "error", "");
478
+ }
479
+ deprecate(...e) {
480
+ return this.forward(e, "warn", "WARNING DEPRECATED: ", !0);
481
+ }
482
+ forward(e, t, n, r) {
483
+ return r && !this.debug ? null : (u(e[0]) && (e[0] = `${n}${this.prefix} ${e[0]}`), this.logger[t](e));
484
+ }
485
+ create(t) {
486
+ return new e(this.logger, {
487
+ prefix: `${this.prefix}:${t}:`,
488
+ ...this.options
489
+ });
490
+ }
491
+ clone(t) {
492
+ return t ||= this.options, t.prefix = t.prefix || this.prefix, new e(this.logger, t);
493
+ }
494
+ }(), N = class {
495
+ constructor() {
496
+ this.observers = {};
497
+ }
498
+ on(e, t) {
499
+ return e.split(" ").forEach((e) => {
500
+ this.observers[e] || (this.observers[e] = /* @__PURE__ */ new Map());
501
+ let n = this.observers[e].get(t) || 0;
502
+ this.observers[e].set(t, n + 1);
503
+ }), this;
504
+ }
505
+ off(e, t) {
506
+ if (this.observers[e]) {
507
+ if (!t) {
508
+ delete this.observers[e];
509
+ return;
510
+ }
511
+ this.observers[e].delete(t);
512
+ }
513
+ }
514
+ emit(e, ...t) {
515
+ this.observers[e] && Array.from(this.observers[e].entries()).forEach(([e, n]) => {
516
+ for (let r = 0; r < n; r++) e(...t);
517
+ }), this.observers["*"] && Array.from(this.observers["*"].entries()).forEach(([n, r]) => {
518
+ for (let i = 0; i < r; i++) n.apply(n, [e, ...t]);
519
+ });
520
+ }
521
+ }, P = class extends N {
522
+ constructor(e, t = {
523
+ ns: ["translation"],
524
+ defaultNS: "translation"
525
+ }) {
526
+ super(), this.data = e || {}, this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.options.ignoreJSONStructure === void 0 && (this.options.ignoreJSONStructure = !0);
527
+ }
528
+ addNamespaces(e) {
529
+ this.options.ns.indexOf(e) < 0 && this.options.ns.push(e);
530
+ }
531
+ removeNamespaces(e) {
532
+ let t = this.options.ns.indexOf(e);
533
+ t > -1 && this.options.ns.splice(t, 1);
534
+ }
535
+ getResource(e, t, n, r = {}) {
536
+ let i = r.keySeparator === void 0 ? this.options.keySeparator : r.keySeparator, a = r.ignoreJSONStructure === void 0 ? this.options.ignoreJSONStructure : r.ignoreJSONStructure, o;
537
+ e.indexOf(".") > -1 ? o = e.split(".") : (o = [e, t], n && (Array.isArray(n) ? o.push(...n) : u(n) && i ? o.push(...n.split(i)) : o.push(n)));
538
+ let s = b(this.data, o);
539
+ return !s && !t && !n && e.indexOf(".") > -1 && (e = o[0], t = o[1], n = o.slice(2).join(".")), s || !a || !u(n) ? s : A(this.data?.[e]?.[t], n, i);
540
+ }
541
+ addResource(e, t, n, r, i = { silent: !1 }) {
542
+ let a = i.keySeparator === void 0 ? this.options.keySeparator : i.keySeparator, o = [e, t];
543
+ n && (o = o.concat(a ? n.split(a) : n)), e.indexOf(".") > -1 && (o = e.split("."), r = t, t = o[1]), this.addNamespaces(t), v(this.data, o, r), i.silent || this.emit("added", e, t, n, r);
544
+ }
545
+ addResources(e, t, n, r = { silent: !1 }) {
546
+ for (let r in n) (u(n[r]) || Array.isArray(n[r])) && this.addResource(e, t, r, n[r], { silent: !0 });
547
+ r.silent || this.emit("added", e, t, n);
548
+ }
549
+ addResourceBundle(e, t, n, r, i, a = {
550
+ silent: !1,
551
+ skipCopy: !1
552
+ }) {
553
+ let o = [e, t];
554
+ e.indexOf(".") > -1 && (o = e.split("."), r = n, n = t, t = o[1]), this.addNamespaces(t);
555
+ let s = b(this.data, o) || {};
556
+ a.skipCopy || (n = JSON.parse(JSON.stringify(n))), r ? S(s, n, i) : s = {
557
+ ...s,
558
+ ...n
559
+ }, v(this.data, o, s), a.silent || this.emit("added", e, t, n);
560
+ }
561
+ removeResourceBundle(e, t) {
562
+ this.hasResourceBundle(e, t) && delete this.data[e][t], this.removeNamespaces(t), this.emit("removed", e, t);
563
+ }
564
+ hasResourceBundle(e, t) {
565
+ return this.getResource(e, t) !== void 0;
566
+ }
567
+ getResourceBundle(e, t) {
568
+ return t ||= this.options.defaultNS, this.getResource(e, t);
569
+ }
570
+ getDataByLanguage(e) {
571
+ return this.data[e];
572
+ }
573
+ hasLanguageSomeTranslations(e) {
574
+ let t = this.getDataByLanguage(e);
575
+ return !!(t && Object.keys(t) || []).find((e) => t[e] && Object.keys(t[e]).length > 0);
576
+ }
577
+ toJSON() {
578
+ return this.data;
579
+ }
580
+ }, F = {
581
+ processors: {},
582
+ addPostProcessor(e) {
583
+ this.processors[e.name] = e;
584
+ },
585
+ handle(e, t, n, r, i) {
586
+ return e.forEach((e) => {
587
+ t = this.processors[e]?.process(t, n, r, i) ?? t;
588
+ }), t;
589
+ }
590
+ }, I = Symbol("i18next/PATH_KEY");
591
+ function te() {
592
+ let e = [], t = Object.create(null), n;
593
+ return t.get = (r, i) => (n?.revoke?.(), i === I ? e : (e.push(i), n = Proxy.revocable(r, t), n.proxy)), Proxy.revocable(Object.create(null), t).proxy;
594
+ }
595
+ function L(e, t) {
596
+ let { [I]: n } = e(te()), r = t?.keySeparator ?? ".", i = t?.nsSeparator ?? ":";
597
+ if (n.length > 1 && i) {
598
+ let e = t?.ns, a = Array.isArray(e) ? e : null;
599
+ if (a && a.length > 1 && a.slice(1).includes(n[0])) return `${n[0]}${i}${n.slice(1).join(r)}`;
600
+ }
601
+ return n.join(r);
602
+ }
603
+ var R = {}, z = (e) => !u(e) && typeof e != "boolean" && typeof e != "number", B = class e extends N {
604
+ constructor(e, t = {}) {
605
+ super(), p([
606
+ "resourceStore",
607
+ "languageUtils",
608
+ "pluralResolver",
609
+ "interpolator",
610
+ "backendConnector",
611
+ "i18nFormat",
612
+ "utils"
613
+ ], e, this), this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.logger = M.create("translator");
614
+ }
615
+ changeLanguage(e) {
616
+ e && (this.language = e);
617
+ }
618
+ exists(e, t = { interpolation: {} }) {
619
+ let n = { ...t };
620
+ if (e == null) return !1;
621
+ let r = this.resolve(e, n);
622
+ if (r?.res === void 0) return !1;
623
+ let i = z(r.res);
624
+ return !(n.returnObjects === !1 && i);
625
+ }
626
+ extractFromKey(e, t) {
627
+ let n = t.nsSeparator === void 0 ? this.options.nsSeparator : t.nsSeparator;
628
+ n === void 0 && (n = ":");
629
+ 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 && !k(e, n, r);
630
+ if (a && !o) {
631
+ let t = e.match(this.interpolator.nestingRegexp);
632
+ if (t && t.length > 0) return {
633
+ key: e,
634
+ namespaces: u(i) ? [i] : i
635
+ };
636
+ let a = e.split(n);
637
+ (n !== r || n === r && this.options.ns.indexOf(a[0]) > -1) && (i = a.shift()), e = a.join(r);
638
+ }
639
+ return {
640
+ key: e,
641
+ namespaces: u(i) ? [i] : i
642
+ };
643
+ }
644
+ translate(t, n, r) {
645
+ let i = typeof n == "object" ? { ...n } : n;
646
+ if (typeof i != "object" && this.options.overloadTranslationOptionHandler && (i = this.options.overloadTranslationOptionHandler(arguments)), typeof i == "object" && (i = { ...i }), i ||= {}, t == null) return "";
647
+ typeof t == "function" && (t = L(t, {
648
+ ...this.options,
649
+ ...i
650
+ })), Array.isArray(t) || (t = [String(t)]), t = t.map((e) => typeof e == "function" ? L(e, {
651
+ ...this.options,
652
+ ...i
653
+ }) : String(e));
654
+ let a = i.returnDetails === void 0 ? this.options.returnDetails : i.returnDetails, o = i.keySeparator === void 0 ? this.options.keySeparator : i.keySeparator, { key: s, namespaces: c } = this.extractFromKey(t[t.length - 1], i), l = c[c.length - 1], d = i.nsSeparator === void 0 ? this.options.nsSeparator : i.nsSeparator;
655
+ d === void 0 && (d = ":");
656
+ let f = i.lng || this.language, p = i.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;
657
+ if (f?.toLowerCase() === "cimode") return p ? a ? {
658
+ res: `${l}${d}${s}`,
659
+ usedKey: s,
660
+ exactUsedKey: s,
661
+ usedLng: f,
662
+ usedNS: l,
663
+ usedParams: this.getUsedParamsDetails(i)
664
+ } : `${l}${d}${s}` : a ? {
665
+ res: s,
666
+ usedKey: s,
667
+ exactUsedKey: s,
668
+ usedLng: f,
669
+ usedNS: l,
670
+ usedParams: this.getUsedParamsDetails(i)
671
+ } : s;
672
+ let m = this.resolve(t, i), h = m?.res, g = m?.usedKey || s, _ = m?.exactUsedKey || s, v = [
673
+ "[object Number]",
674
+ "[object Function]",
675
+ "[object RegExp]"
676
+ ], y = i.joinArrays === void 0 ? this.options.joinArrays : i.joinArrays, b = !this.i18nFormat || this.i18nFormat.handleAsObject, x = i.count !== void 0 && !u(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;
677
+ b && !h && S && (D = E);
678
+ let O = z(D), k = Object.prototype.toString.apply(D);
679
+ if (b && D && O && v.indexOf(k) < 0 && !(u(y) && Array.isArray(D))) {
680
+ if (!i.returnObjects && !this.options.returnObjects) {
681
+ this.options.returnedObjectHandler || this.logger.warn("accessing an object - but returnObjects options is not enabled!");
682
+ let e = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(g, D, {
683
+ ...i,
684
+ ns: c
685
+ }) : `key '${s} (${this.language})' returned an object instead of string.`;
686
+ return a ? (m.res = e, m.usedParams = this.getUsedParamsDetails(i), m) : e;
687
+ }
688
+ if (o) {
689
+ let e = Array.isArray(D), t = e ? [] : {}, n = e ? _ : g;
690
+ for (let e in D) if (Object.prototype.hasOwnProperty.call(D, e)) {
691
+ let r = `${n}${o}${e}`;
692
+ S && !h ? t[e] = this.translate(r, {
693
+ ...i,
694
+ defaultValue: z(E) ? E[e] : void 0,
695
+ joinArrays: !1,
696
+ ns: c
697
+ }) : t[e] = this.translate(r, {
698
+ ...i,
699
+ joinArrays: !1,
700
+ ns: c
701
+ }), t[e] === r && (t[e] = D[e]);
702
+ }
703
+ h = t;
704
+ }
705
+ } else if (b && u(y) && Array.isArray(h)) h = h.join(y), h &&= this.extendTranslation(h, t, i, r);
706
+ else {
707
+ let e = !1, n = !1;
708
+ !this.isValidLookup(h) && S && (e = !0, h = E), this.isValidLookup(h) || (n = !0, h = s);
709
+ let a = (i.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && n ? void 0 : h, c = S && E !== h && this.options.updateMissing;
710
+ if (n || e || c) {
711
+ if (this.logger.log(c ? "updateKey" : "missingKey", f, l, s, c ? E : h), o) {
712
+ let e = this.resolve(s, {
713
+ ...i,
714
+ keySeparator: !1
715
+ });
716
+ e && e.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.");
717
+ }
718
+ let e = [], t = this.languageUtils.getFallbackCodes(this.options.fallbackLng, i.lng || this.language);
719
+ if (this.options.saveMissingTo === "fallback" && t && t[0]) for (let n = 0; n < t.length; n++) e.push(t[n]);
720
+ else this.options.saveMissingTo === "all" ? e = this.languageUtils.toResolveHierarchy(i.lng || this.language) : e.push(i.lng || this.language);
721
+ let n = (e, t, n) => {
722
+ let r = S && n !== h ? n : a;
723
+ this.options.missingKeyHandler ? this.options.missingKeyHandler(e, l, t, r, c, i) : this.backendConnector?.saveMissing && this.backendConnector.saveMissing(e, l, t, r, c, i), this.emit("missingKey", e, l, t, h);
724
+ };
725
+ this.options.saveMissing && (this.options.saveMissingPlurals && x ? e.forEach((e) => {
726
+ let t = this.pluralResolver.getSuffixes(e, i);
727
+ T && i[`defaultValue${this.options.pluralSeparator}zero`] && t.indexOf(`${this.options.pluralSeparator}zero`) < 0 && t.push(`${this.options.pluralSeparator}zero`), t.forEach((t) => {
728
+ n([e], s + t, i[`defaultValue${t}`] || E);
729
+ });
730
+ }) : n(e, s, E));
731
+ }
732
+ h = this.extendTranslation(h, t, i, m, r), n && h === s && this.options.appendNamespaceToMissingKey && (h = `${l}${d}${s}`), (n || e) && this.options.parseMissingKeyHandler && (h = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${l}${d}${s}` : s, e ? h : void 0, i));
733
+ }
734
+ return a ? (m.res = h, m.usedParams = this.getUsedParamsDetails(i), m) : h;
735
+ }
736
+ extendTranslation(e, t, n, r, i) {
737
+ if (this.i18nFormat?.parse) e = this.i18nFormat.parse(e, {
738
+ ...this.options.interpolation.defaultVariables,
739
+ ...n
740
+ }, n.lng || this.language || r.usedLng, r.usedNS, r.usedKey, { resolved: r });
741
+ else if (!n.skipInterpolation) {
742
+ n.interpolation && this.interpolator.init({
743
+ ...n,
744
+ interpolation: {
745
+ ...this.options.interpolation,
746
+ ...n.interpolation
747
+ }
748
+ });
749
+ let a = u(e) && (n?.interpolation?.skipOnVariables === void 0 ? this.options.interpolation.skipOnVariables : n.interpolation.skipOnVariables), o;
750
+ if (a) {
751
+ let t = e.match(this.interpolator.nestingRegexp);
752
+ o = t && t.length;
753
+ }
754
+ let s = n.replace && !u(n.replace) ? n.replace : n;
755
+ if (this.options.interpolation.defaultVariables && (s = {
756
+ ...this.options.interpolation.defaultVariables,
757
+ ...s
758
+ }), e = this.interpolator.interpolate(e, s, n.lng || this.language || r.usedLng, n), a) {
759
+ let t = e.match(this.interpolator.nestingRegexp), r = t && t.length;
760
+ o < r && (n.nest = !1);
761
+ }
762
+ !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();
763
+ }
764
+ let a = n.postProcess || this.options.postProcess, o = u(a) ? [a] : a;
765
+ return e != null && o?.length && n.applyPostProcessor !== !1 && (e = F.handle(o, e, t, this.options && this.options.postProcessPassResolved ? {
766
+ i18nResolved: {
767
+ ...r,
768
+ usedParams: this.getUsedParamsDetails(n)
769
+ },
770
+ ...n
771
+ } : n, this)), e;
772
+ }
773
+ resolve(e, t = {}) {
774
+ let n, r, i, a, o;
775
+ return u(e) && (e = [e]), Array.isArray(e) && (e = e.map((e) => typeof e == "function" ? L(e, {
776
+ ...this.options,
777
+ ...t
778
+ }) : e)), e.forEach((e) => {
779
+ if (this.isValidLookup(n)) return;
780
+ let s = this.extractFromKey(e, t), c = s.key;
781
+ r = c;
782
+ let l = s.namespaces;
783
+ this.options.fallbackNS && (l = l.concat(this.options.fallbackNS));
784
+ let d = t.count !== void 0 && !u(t.count), f = d && !t.ordinal && t.count === 0, p = t.context !== void 0 && (u(t.context) || typeof t.context == "number") && t.context !== "", m = t.lngs ? t.lngs : this.languageUtils.toResolveHierarchy(t.lng || this.language, t.fallbackLng);
785
+ l.forEach((e) => {
786
+ this.isValidLookup(n) || (o = e, !R[`${m[0]}-${e}`] && this.utils?.hasLoadedNamespace && !this.utils?.hasLoadedNamespace(o) && (R[`${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) => {
787
+ if (this.isValidLookup(n)) return;
788
+ a = r;
789
+ let o = [c];
790
+ if (this.i18nFormat?.addLookupKeys) this.i18nFormat.addLookupKeys(o, c, r, e, t);
791
+ else {
792
+ let e;
793
+ d && (e = this.pluralResolver.getSuffix(r, t.count, t));
794
+ let n = `${this.options.pluralSeparator}zero`, i = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;
795
+ if (d && (t.ordinal && e.indexOf(i) === 0 && o.push(c + e.replace(i, this.options.pluralSeparator)), o.push(c + e), f && o.push(c + n)), p) {
796
+ let r = `${c}${this.options.contextSeparator || "_"}${t.context}`;
797
+ 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));
798
+ }
799
+ }
800
+ let s;
801
+ for (; s = o.pop();) this.isValidLookup(n) || (i = s, n = this.getResource(r, e, s, t));
802
+ }));
803
+ });
804
+ }), {
805
+ res: n,
806
+ usedKey: r,
807
+ exactUsedKey: i,
808
+ usedLng: a,
809
+ usedNS: o
810
+ };
811
+ }
812
+ isValidLookup(e) {
813
+ return e !== void 0 && !(!this.options.returnNull && e === null) && !(!this.options.returnEmptyString && e === "");
814
+ }
815
+ getResource(e, t, n, r = {}) {
816
+ return this.i18nFormat?.getResource ? this.i18nFormat.getResource(e, t, n, r) : this.resourceStore.getResource(e, t, n, r);
817
+ }
818
+ getUsedParamsDetails(e = {}) {
819
+ let t = [
820
+ "defaultValue",
821
+ "ordinal",
822
+ "context",
823
+ "replace",
824
+ "lng",
825
+ "lngs",
826
+ "fallbackLng",
827
+ "ns",
828
+ "keySeparator",
829
+ "nsSeparator",
830
+ "returnObjects",
831
+ "returnDetails",
832
+ "joinArrays",
833
+ "postProcess",
834
+ "interpolation"
835
+ ], n = e.replace && !u(e.replace), r = n ? e.replace : e;
836
+ if (n && e.count !== void 0 && (r.count = e.count), this.options.interpolation.defaultVariables && (r = {
837
+ ...this.options.interpolation.defaultVariables,
838
+ ...r
839
+ }), !n) {
840
+ r = { ...r };
841
+ for (let e of t) delete r[e];
842
+ }
843
+ return r;
844
+ }
845
+ static hasDefaultValue(e) {
846
+ for (let t in e) if (Object.prototype.hasOwnProperty.call(e, t) && t.substring(0, 12) === "defaultValue" && e[t] !== void 0) return !0;
847
+ return !1;
848
+ }
849
+ }, V = class {
850
+ constructor(e) {
851
+ this.options = e, this.supportedLngs = this.options.supportedLngs || !1, this.logger = M.create("languageUtils");
852
+ }
853
+ getScriptPartFromCode(e) {
854
+ if (e = j(e), !e || e.indexOf("-") < 0) return null;
855
+ let t = e.split("-");
856
+ return t.length === 2 || (t.pop(), t[t.length - 1].toLowerCase() === "x") ? null : this.formatLanguageCode(t.join("-"));
857
+ }
858
+ getLanguagePartFromCode(e) {
859
+ if (e = j(e), !e || e.indexOf("-") < 0) return e;
860
+ let t = e.split("-");
861
+ return this.formatLanguageCode(t[0]);
862
+ }
863
+ formatLanguageCode(e) {
864
+ if (u(e) && e.indexOf("-") > -1) {
865
+ let t;
866
+ try {
867
+ t = Intl.getCanonicalLocales(e)[0];
868
+ } catch {}
869
+ return t && this.options.lowerCaseLng && (t = t.toLowerCase()), t || (this.options.lowerCaseLng ? e.toLowerCase() : e);
870
+ }
871
+ return this.options.cleanCode || this.options.lowerCaseLng ? e.toLowerCase() : e;
872
+ }
873
+ isSupportedCode(e) {
874
+ return (this.options.load === "languageOnly" || this.options.nonExplicitSupportedLngs) && (e = this.getLanguagePartFromCode(e)), !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.indexOf(e) > -1;
875
+ }
876
+ getBestMatchFromCodes(e) {
877
+ if (!e) return null;
878
+ let t;
879
+ return e.forEach((e) => {
880
+ if (t) return;
881
+ let n = this.formatLanguageCode(e);
882
+ (!this.options.supportedLngs || this.isSupportedCode(n)) && (t = n);
883
+ }), !t && this.options.supportedLngs && e.forEach((e) => {
884
+ if (t) return;
885
+ let n = this.getScriptPartFromCode(e);
886
+ if (this.isSupportedCode(n)) return t = n;
887
+ let r = this.getLanguagePartFromCode(e);
888
+ if (this.isSupportedCode(r)) return t = r;
889
+ t = this.options.supportedLngs.find((e) => {
890
+ if (e === r || !(e.indexOf("-") < 0 && r.indexOf("-") < 0) && (e.indexOf("-") > 0 && r.indexOf("-") < 0 && e.substring(0, e.indexOf("-")) === r || e.indexOf(r) === 0 && r.length > 1)) return e;
891
+ });
892
+ }), t ||= this.getFallbackCodes(this.options.fallbackLng)[0], t;
893
+ }
894
+ getFallbackCodes(e, t) {
895
+ if (!e) return [];
896
+ if (typeof e == "function" && (e = e(t)), u(e) && (e = [e]), Array.isArray(e)) return e;
897
+ if (!t) return e.default || [];
898
+ let n = e[t];
899
+ return n ||= e[this.getScriptPartFromCode(t)], n ||= e[this.formatLanguageCode(t)], n ||= e[this.getLanguagePartFromCode(t)], n ||= e.default, n || [];
900
+ }
901
+ toResolveHierarchy(e, t) {
902
+ let n = this.getFallbackCodes((t === !1 ? [] : t) || this.options.fallbackLng || [], e), r = [], i = (e) => {
903
+ e && (this.isSupportedCode(e) ? r.push(e) : this.logger.warn(`rejecting language code not found in supportedLngs: ${e}`));
904
+ };
905
+ return u(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))) : u(e) && i(this.formatLanguageCode(e)), n.forEach((e) => {
906
+ r.indexOf(e) < 0 && i(this.formatLanguageCode(e));
907
+ }), r;
908
+ }
909
+ }, H = {
910
+ zero: 0,
911
+ one: 1,
912
+ two: 2,
913
+ few: 3,
914
+ many: 4,
915
+ other: 5
916
+ }, U = {
917
+ select: (e) => e === 1 ? "one" : "other",
918
+ resolvedOptions: () => ({ pluralCategories: ["one", "other"] })
919
+ }, ne = class {
920
+ constructor(e, t = {}) {
921
+ this.languageUtils = e, this.options = t, this.logger = M.create("pluralResolver"), this.pluralRulesCache = {};
922
+ }
923
+ clearCache() {
924
+ this.pluralRulesCache = {};
925
+ }
926
+ getRule(e, t = {}) {
927
+ let n = j(e === "dev" ? "en" : e), r = t.ordinal ? "ordinal" : "cardinal", i = JSON.stringify({
928
+ cleanedCode: n,
929
+ type: r
930
+ });
931
+ if (i in this.pluralRulesCache) return this.pluralRulesCache[i];
932
+ let a;
933
+ try {
934
+ a = new Intl.PluralRules(n, { type: r });
935
+ } catch {
936
+ if (typeof Intl > "u") return this.logger.error("No Intl support, please use an Intl polyfill!"), U;
937
+ if (!e.match(/-|_/)) return U;
938
+ let n = this.languageUtils.getLanguagePartFromCode(e);
939
+ a = this.getRule(n, t);
940
+ }
941
+ return this.pluralRulesCache[i] = a, a;
942
+ }
943
+ needsPlural(e, t = {}) {
944
+ let n = this.getRule(e, t);
945
+ return n ||= this.getRule("dev", t), n?.resolvedOptions().pluralCategories.length > 1;
946
+ }
947
+ getPluralFormsOfKey(e, t, n = {}) {
948
+ return this.getSuffixes(e, n).map((e) => `${t}${e}`);
949
+ }
950
+ getSuffixes(e, t = {}) {
951
+ let n = this.getRule(e, t);
952
+ return n ||= this.getRule("dev", t), n ? n.resolvedOptions().pluralCategories.sort((e, t) => H[e] - H[t]).map((e) => `${this.options.prepend}${t.ordinal ? `ordinal${this.options.prepend}` : ""}${e}`) : [];
953
+ }
954
+ getSuffix(e, t, n = {}) {
955
+ let r = this.getRule(e, n);
956
+ 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));
957
+ }
958
+ }, W = (e, t, n, r = ".", i = !0) => {
959
+ let a = x(e, t, n);
960
+ return !a && i && u(n) && (a = A(e, n, r), a === void 0 && (a = A(t, n, r))), a;
961
+ }, G = (e) => e.replace(/\$/g, "$$$$"), K = class {
962
+ constructor(e = {}) {
963
+ this.logger = M.create("interpolator"), this.options = e, this.format = e?.interpolation?.format || ((e) => e), this.init(e);
964
+ }
965
+ init(e = {}) {
966
+ e.interpolation ||= { escapeValue: !0 };
967
+ 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;
968
+ this.escape = t === void 0 ? T : t, this.escapeValue = n === void 0 || n, this.useRawValueToEscape = r !== void 0 && r, this.prefix = i ? C(i) : a || "{{", this.suffix = o ? C(o) : s || "}}", this.formatSeparator = c || ",", this.unescapePrefix = l ? "" : u || "-", this.unescapeSuffix = this.unescapePrefix ? "" : l || "", this.nestingPrefix = d ? C(d) : f || C("$t("), this.nestingSuffix = p ? C(p) : m || C(")"), this.nestingOptionsSeparator = h || ",", this.maxReplaces = g || 1e3, this.alwaysFormat = _ !== void 0 && _, this.resetRegExp();
969
+ }
970
+ reset() {
971
+ this.options && this.init(this.options);
972
+ }
973
+ resetRegExp() {
974
+ let e = (e, t) => e?.source === t ? (e.lastIndex = 0, e) : new RegExp(t, "g");
975
+ 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}`);
976
+ }
977
+ interpolate(e, t, n, r) {
978
+ let i, a, o, s = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {}, c = (e) => {
979
+ if (e.indexOf(this.formatSeparator) < 0) {
980
+ let i = W(t, s, e, this.options.keySeparator, this.options.ignoreJSONStructure);
981
+ return this.alwaysFormat ? this.format(i, void 0, n, {
982
+ ...r,
983
+ ...t,
984
+ interpolationkey: e
985
+ }) : i;
986
+ }
987
+ let i = e.split(this.formatSeparator), a = i.shift().trim(), o = i.join(this.formatSeparator).trim();
988
+ return this.format(W(t, s, a, this.options.keySeparator, this.options.ignoreJSONStructure), o, n, {
989
+ ...r,
990
+ ...t,
991
+ interpolationkey: a
992
+ });
993
+ };
994
+ this.resetRegExp();
995
+ let l = r?.missingInterpolationHandler || this.options.missingInterpolationHandler, d = r?.interpolation?.skipOnVariables === void 0 ? this.options.interpolation.skipOnVariables : r.interpolation.skipOnVariables;
996
+ return [{
997
+ regex: this.regexpUnescape,
998
+ safeValue: (e) => G(e)
999
+ }, {
1000
+ regex: this.regexp,
1001
+ safeValue: (e) => this.escapeValue ? G(this.escape(e)) : G(e)
1002
+ }].forEach((t) => {
1003
+ for (o = 0; i = t.regex.exec(e);) {
1004
+ let n = i[1].trim();
1005
+ if (a = c(n), a === void 0) if (typeof l == "function") {
1006
+ let t = l(e, i, r);
1007
+ a = u(t) ? t : "";
1008
+ } else if (r && Object.prototype.hasOwnProperty.call(r, n)) a = "";
1009
+ else if (d) {
1010
+ a = i[0];
1011
+ continue;
1012
+ } else this.logger.warn(`missed to pass in variable ${n} for interpolating ${e}`), a = "";
1013
+ else !u(a) && !this.useRawValueToEscape && (a = f(a));
1014
+ let s = t.safeValue(a);
1015
+ if (e = e.replace(i[0], s), d ? (t.regex.lastIndex += a.length, t.regex.lastIndex -= i[0].length) : t.regex.lastIndex = 0, o++, o >= this.maxReplaces) break;
1016
+ }
1017
+ }), e;
1018
+ }
1019
+ nest(e, t, n = {}) {
1020
+ let r, i, a, o = (e, t) => {
1021
+ let n = this.nestingOptionsSeparator;
1022
+ if (e.indexOf(n) < 0) return e;
1023
+ let r = e.split(RegExp(`${C(n)}[ ]*{`)), i = `{${r[1]}`;
1024
+ e = r[0], i = this.interpolate(i, a);
1025
+ let o = i.match(/'/g), s = i.match(/"/g);
1026
+ ((o?.length ?? 0) % 2 == 0 && !s || (s?.length ?? 0) % 2 != 0) && (i = i.replace(/'/g, "\""));
1027
+ try {
1028
+ a = JSON.parse(i), t && (a = {
1029
+ ...t,
1030
+ ...a
1031
+ });
1032
+ } catch (t) {
1033
+ return this.logger.warn(`failed parsing options string in nesting for key ${e}`, t), `${e}${n}${i}`;
1034
+ }
1035
+ return a.defaultValue && a.defaultValue.indexOf(this.prefix) > -1 && delete a.defaultValue, e;
1036
+ };
1037
+ for (; r = this.nestingRegexp.exec(e);) {
1038
+ let s = [];
1039
+ a = { ...n }, a = a.replace && !u(a.replace) ? a.replace : a, a.applyPostProcessor = !1, delete a.defaultValue;
1040
+ let c = /{.*}/.test(r[1]) ? r[1].lastIndexOf("}") + 1 : r[1].indexOf(this.formatSeparator);
1041
+ if (c !== -1 && (s = r[1].slice(c).split(this.formatSeparator).map((e) => e.trim()).filter(Boolean), r[1] = r[1].slice(0, c)), i = t(o.call(this, r[1].trim(), a), a), i && r[0] === e && !u(i)) return i;
1042
+ u(i) || (i = f(i)), i ||= (this.logger.warn(`missed to resolve ${r[1]} for nesting ${e}`), ""), s.length && (i = s.reduce((e, t) => this.format(e, t, n.lng, {
1043
+ ...n,
1044
+ interpolationkey: r[1].trim()
1045
+ }), i.trim())), e = e.replace(r[0], i), this.regexp.lastIndex = 0;
1046
+ }
1047
+ return e;
1048
+ }
1049
+ }, re = (e) => {
1050
+ let t = e.toLowerCase().trim(), n = {};
1051
+ if (e.indexOf("(") > -1) {
1052
+ let r = e.split("(");
1053
+ t = r[0].toLowerCase().trim();
1054
+ let i = r[1].substring(0, r[1].length - 1);
1055
+ t === "currency" && i.indexOf(":") < 0 ? n.currency ||= i.trim() : t === "relativetime" && i.indexOf(":") < 0 ? n.range ||= i.trim() : i.split(";").forEach((e) => {
1056
+ if (e) {
1057
+ let [t, ...r] = e.split(":"), i = r.join(":").trim().replace(/^'+|'+$/g, ""), a = t.trim();
1058
+ n[a] || (n[a] = i), i === "false" && (n[a] = !1), i === "true" && (n[a] = !0), isNaN(i) || (n[a] = parseInt(i, 10));
1059
+ }
1060
+ });
1061
+ }
1062
+ return {
1063
+ formatName: t,
1064
+ formatOptions: n
1065
+ };
1066
+ }, q = (e) => {
1067
+ let t = {};
1068
+ return (n, r, i) => {
1069
+ let a = i;
1070
+ i && i.interpolationkey && i.formatParams && i.formatParams[i.interpolationkey] && i[i.interpolationkey] && (a = {
1071
+ ...a,
1072
+ [i.interpolationkey]: void 0
1073
+ });
1074
+ let o = r + JSON.stringify(a), s = t[o];
1075
+ return s || (s = e(j(r), i), t[o] = s), s(n);
1076
+ };
1077
+ }, ie = (e) => (t, n, r) => e(j(n), r)(t), ae = class {
1078
+ constructor(e = {}) {
1079
+ this.logger = M.create("formatter"), this.options = e, this.init(e);
1080
+ }
1081
+ init(e, t = { interpolation: {} }) {
1082
+ this.formatSeparator = t.interpolation.formatSeparator || ",";
1083
+ let n = t.cacheInBuiltFormats ? q : ie;
1084
+ this.formats = {
1085
+ number: n((e, t) => {
1086
+ let n = new Intl.NumberFormat(e, { ...t });
1087
+ return (e) => n.format(e);
1088
+ }),
1089
+ currency: n((e, t) => {
1090
+ let n = new Intl.NumberFormat(e, {
1091
+ ...t,
1092
+ style: "currency"
1093
+ });
1094
+ return (e) => n.format(e);
1095
+ }),
1096
+ datetime: n((e, t) => {
1097
+ let n = new Intl.DateTimeFormat(e, { ...t });
1098
+ return (e) => n.format(e);
1099
+ }),
1100
+ relativetime: n((e, t) => {
1101
+ let n = new Intl.RelativeTimeFormat(e, { ...t });
1102
+ return (e) => n.format(e, t.range || "day");
1103
+ }),
1104
+ list: n((e, t) => {
1105
+ let n = new Intl.ListFormat(e, { ...t });
1106
+ return (e) => n.format(e);
1107
+ })
1108
+ };
1109
+ }
1110
+ add(e, t) {
1111
+ this.formats[e.toLowerCase().trim()] = t;
1112
+ }
1113
+ addCached(e, t) {
1114
+ this.formats[e.toLowerCase().trim()] = q(t);
1115
+ }
1116
+ format(e, t, n, r = {}) {
1117
+ let i = t.split(this.formatSeparator);
1118
+ if (i.length > 1 && i[0].indexOf("(") > 1 && i[0].indexOf(")") < 0 && i.find((e) => e.indexOf(")") > -1)) {
1119
+ let e = i.findIndex((e) => e.indexOf(")") > -1);
1120
+ i[0] = [i[0], ...i.splice(1, e)].join(this.formatSeparator);
1121
+ }
1122
+ return i.reduce((e, t) => {
1123
+ let { formatName: i, formatOptions: a } = re(t);
1124
+ if (this.formats[i]) {
1125
+ let t = e;
1126
+ try {
1127
+ let o = r?.formatParams?.[r.interpolationkey] || {}, s = o.locale || o.lng || r.locale || r.lng || n;
1128
+ t = this.formats[i](e, s, {
1129
+ ...a,
1130
+ ...r,
1131
+ ...o
1132
+ });
1133
+ } catch (e) {
1134
+ this.logger.warn(e);
1135
+ }
1136
+ return t;
1137
+ } else this.logger.warn(`there was no format function for ${i}`);
1138
+ return e;
1139
+ }, e);
1140
+ }
1141
+ }, oe = (e, t) => {
1142
+ e.pending[t] !== void 0 && (delete e.pending[t], e.pendingCount--);
1143
+ }, se = class extends N {
1144
+ constructor(e, t, n, r = {}) {
1145
+ super(), this.backend = e, this.store = t, this.services = n, this.languageUtils = n.languageUtils, this.options = r, this.logger = M.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);
1146
+ }
1147
+ queueLoad(e, t, n, r) {
1148
+ let i = {}, a = {}, o = {}, s = {};
1149
+ return e.forEach((e) => {
1150
+ let r = !0;
1151
+ t.forEach((t) => {
1152
+ let o = `${e}|${t}`;
1153
+ !n.reload && this.store.hasResourceBundle(e, t) ? this.state[o] = 2 : this.state[o] < 0 || (this.state[o] === 1 ? a[o] === void 0 && (a[o] = !0) : (this.state[o] = 1, r = !1, a[o] === void 0 && (a[o] = !0), i[o] === void 0 && (i[o] = !0), s[t] === void 0 && (s[t] = !0)));
1154
+ }), r || (o[e] = !0);
1155
+ }), (Object.keys(i).length || Object.keys(a).length) && this.queue.push({
1156
+ pending: a,
1157
+ pendingCount: Object.keys(a).length,
1158
+ loaded: {},
1159
+ errors: [],
1160
+ callback: r
1161
+ }), {
1162
+ toLoad: Object.keys(i),
1163
+ pending: Object.keys(a),
1164
+ toLoadLanguages: Object.keys(o),
1165
+ toLoadNamespaces: Object.keys(s)
1166
+ };
1167
+ }
1168
+ loaded(e, t, n) {
1169
+ let r = e.split("|"), i = r[0], a = r[1];
1170
+ 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);
1171
+ let o = {};
1172
+ this.queue.forEach((n) => {
1173
+ y(n.loaded, [i], a), oe(n, e), t && n.errors.push(t), n.pendingCount === 0 && !n.done && (Object.keys(n.loaded).forEach((e) => {
1174
+ o[e] || (o[e] = {});
1175
+ let t = n.loaded[e];
1176
+ t.length && t.forEach((t) => {
1177
+ o[e][t] === void 0 && (o[e][t] = !0);
1178
+ });
1179
+ }), n.done = !0, n.errors.length ? n.callback(n.errors) : n.callback());
1180
+ }), this.emit("loaded", o), this.queue = this.queue.filter((e) => !e.done);
1181
+ }
1182
+ read(e, t, n, r = 0, i = this.retryTimeout, a) {
1183
+ if (!e.length) return a(null, {});
1184
+ if (this.readingCalls >= this.maxParallelReads) {
1185
+ this.waitingReads.push({
1186
+ lng: e,
1187
+ ns: t,
1188
+ fcName: n,
1189
+ tried: r,
1190
+ wait: i,
1191
+ callback: a
1192
+ });
1193
+ return;
1194
+ }
1195
+ this.readingCalls++;
1196
+ let o = (o, s) => {
1197
+ if (this.readingCalls--, this.waitingReads.length > 0) {
1198
+ let e = this.waitingReads.shift();
1199
+ this.read(e.lng, e.ns, e.fcName, e.tried, e.wait, e.callback);
1200
+ }
1201
+ if (o && s && r < this.maxRetries) {
1202
+ setTimeout(() => {
1203
+ this.read.call(this, e, t, n, r + 1, i * 2, a);
1204
+ }, i);
1205
+ return;
1206
+ }
1207
+ a(o, s);
1208
+ }, s = this.backend[n].bind(this.backend);
1209
+ if (s.length === 2) {
1210
+ try {
1211
+ let n = s(e, t);
1212
+ n && typeof n.then == "function" ? n.then((e) => o(null, e)).catch(o) : o(null, n);
1213
+ } catch (e) {
1214
+ o(e);
1215
+ }
1216
+ return;
1217
+ }
1218
+ return s(e, t, o);
1219
+ }
1220
+ prepareLoading(e, t, n = {}, r) {
1221
+ if (!this.backend) return this.logger.warn("No backend was added via i18next.use. Will not load resources."), r && r();
1222
+ u(e) && (e = this.languageUtils.toResolveHierarchy(e)), u(t) && (t = [t]);
1223
+ let i = this.queueLoad(e, t, n, r);
1224
+ if (!i.toLoad.length) return i.pending.length || r(), null;
1225
+ i.toLoad.forEach((e) => {
1226
+ this.loadOne(e);
1227
+ });
1228
+ }
1229
+ load(e, t, n) {
1230
+ this.prepareLoading(e, t, {}, n);
1231
+ }
1232
+ reload(e, t, n) {
1233
+ this.prepareLoading(e, t, { reload: !0 }, n);
1234
+ }
1235
+ loadOne(e, t = "") {
1236
+ let n = e.split("|"), r = n[0], i = n[1];
1237
+ this.read(r, i, "read", void 0, void 0, (n, a) => {
1238
+ n && this.logger.warn(`${t}loading namespace ${i} for language ${r} failed`, n), !n && a && this.logger.log(`${t}loaded namespace ${i} for language ${r}`, a), this.loaded(e, n, a);
1239
+ });
1240
+ }
1241
+ saveMissing(e, t, n, r, i, a = {}, o = () => {}) {
1242
+ if (this.services?.utils?.hasLoadedNamespace && !this.services?.utils?.hasLoadedNamespace(t)) {
1243
+ this.logger.warn(`did not save key "${n}" as the namespace "${t}" was not yet loaded`, "This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");
1244
+ return;
1245
+ }
1246
+ if (!(n == null || n === "")) {
1247
+ if (this.backend?.create) {
1248
+ let s = {
1249
+ ...a,
1250
+ isUpdate: i
1251
+ }, c = this.backend.create.bind(this.backend);
1252
+ if (c.length < 6) try {
1253
+ let i;
1254
+ i = c.length === 5 ? c(e, t, n, r, s) : c(e, t, n, r), i && typeof i.then == "function" ? i.then((e) => o(null, e)).catch(o) : o(null, i);
1255
+ } catch (e) {
1256
+ o(e);
1257
+ }
1258
+ else c(e, t, n, r, o, s);
1259
+ }
1260
+ !e || !e[0] || this.store.addResource(e[0], t, n, r);
1261
+ }
1262
+ }
1263
+ }, J = () => ({
1264
+ debug: !1,
1265
+ initAsync: !0,
1266
+ ns: ["translation"],
1267
+ defaultNS: ["translation"],
1268
+ fallbackLng: ["dev"],
1269
+ fallbackNS: !1,
1270
+ supportedLngs: !1,
1271
+ nonExplicitSupportedLngs: !1,
1272
+ load: "all",
1273
+ preload: !1,
1274
+ simplifyPluralSuffix: !0,
1275
+ keySeparator: ".",
1276
+ nsSeparator: ":",
1277
+ pluralSeparator: "_",
1278
+ contextSeparator: "_",
1279
+ partialBundledLanguages: !1,
1280
+ saveMissing: !1,
1281
+ updateMissing: !1,
1282
+ saveMissingTo: "fallback",
1283
+ saveMissingPlurals: !0,
1284
+ missingKeyHandler: !1,
1285
+ missingInterpolationHandler: !1,
1286
+ postProcess: !1,
1287
+ postProcessPassResolved: !1,
1288
+ returnNull: !1,
1289
+ returnEmptyString: !0,
1290
+ returnObjects: !1,
1291
+ joinArrays: !1,
1292
+ returnedObjectHandler: !1,
1293
+ parseMissingKeyHandler: !1,
1294
+ appendNamespaceToMissingKey: !1,
1295
+ appendNamespaceToCIMode: !1,
1296
+ overloadTranslationOptionHandler: (e) => {
1297
+ let t = {};
1298
+ if (typeof e[1] == "object" && (t = e[1]), u(e[1]) && (t.defaultValue = e[1]), u(e[2]) && (t.tDescription = e[2]), typeof e[2] == "object" || typeof e[3] == "object") {
1299
+ let n = e[3] || e[2];
1300
+ Object.keys(n).forEach((e) => {
1301
+ t[e] = n[e];
1302
+ });
1303
+ }
1304
+ return t;
1305
+ },
1306
+ interpolation: {
1307
+ escapeValue: !0,
1308
+ format: (e) => e,
1309
+ prefix: "{{",
1310
+ suffix: "}}",
1311
+ formatSeparator: ",",
1312
+ unescapePrefix: "-",
1313
+ nestingPrefix: "$t(",
1314
+ nestingSuffix: ")",
1315
+ nestingOptionsSeparator: ",",
1316
+ maxReplaces: 1e3,
1317
+ skipOnVariables: !0
1318
+ },
1319
+ cacheInBuiltFormats: !0
1320
+ }), Y = (e) => (u(e.ns) && (e.ns = [e.ns]), u(e.fallbackLng) && (e.fallbackLng = [e.fallbackLng]), u(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), X = () => {}, ce = (e) => {
1321
+ Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach((t) => {
1322
+ typeof e[t] == "function" && (e[t] = e[t].bind(e));
1323
+ });
1324
+ }, Z = "__i18next_supportNoticeShown", le = () => !!(typeof globalThis < "u" && globalThis[Z] || typeof process < "u" && process.env && process.env.I18NEXT_NO_SUPPORT_NOTICE || typeof process < "u" && process.env), ue = () => {
1325
+ typeof globalThis < "u" && (globalThis[Z] = !0);
1326
+ }, 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)), Q = class e extends N {
1327
+ constructor(e = {}, t) {
1328
+ if (super(), this.options = Y(e), this.services = {}, this.logger = M, this.modules = { external: [] }, ce(this), t && !this.isInitialized && !e.isClone) {
1329
+ if (!this.options.initAsync) return this.init(e, t), this;
1330
+ setTimeout(() => {
1331
+ this.init(e, t);
1332
+ }, 0);
1333
+ }
1334
+ }
1335
+ init(e = {}, t) {
1336
+ this.isInitializing = !0, typeof e == "function" && (t = e, e = {}), e.defaultNS == null && e.ns && (u(e.ns) ? e.defaultNS = e.ns : e.ns.indexOf("translation") < 0 && (e.defaultNS = e.ns[0]));
1337
+ let n = J();
1338
+ this.options = {
1339
+ ...n,
1340
+ ...this.options,
1341
+ ...Y(e)
1342
+ }, this.options.interpolation = {
1343
+ ...n.interpolation,
1344
+ ...this.options.interpolation
1345
+ }, 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());
1346
+ let r = (e) => e ? typeof e == "function" ? new e() : e : null;
1347
+ if (!this.options.isClone) {
1348
+ this.modules.logger ? M.init(r(this.modules.logger), this.options) : M.init(null, this.options);
1349
+ let e;
1350
+ e = this.modules.formatter ? this.modules.formatter : ae;
1351
+ let t = new V(this.options);
1352
+ this.store = new P(this.options.resources, this.options);
1353
+ let i = this.services;
1354
+ i.logger = M, i.resourceStore = this.store, i.languageUtils = t, i.pluralResolver = new ne(t, {
1355
+ prepend: this.options.pluralSeparator,
1356
+ simplifyPluralSuffix: this.options.simplifyPluralSuffix
1357
+ }), 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 K(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) => {
1358
+ this.emit(e, ...t);
1359
+ }), 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 B(this.services, this.options), this.translator.on("*", (e, ...t) => {
1360
+ this.emit(e, ...t);
1361
+ }), this.modules.external.forEach((e) => {
1362
+ e.init && e.init(this);
1363
+ });
1364
+ }
1365
+ if (this.format = this.options.interpolation.format, t ||= X, this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) {
1366
+ let e = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
1367
+ e.length > 0 && e[0] !== "dev" && (this.options.lng = e[0]);
1368
+ }
1369
+ !this.services.languageDetector && !this.options.lng && this.logger.warn("init: no languageDetector is used and no lng is defined"), [
1370
+ "getResource",
1371
+ "hasResourceBundle",
1372
+ "getResourceBundle",
1373
+ "getDataByLanguage"
1374
+ ].forEach((e) => {
1375
+ this[e] = (...t) => this.store[e](...t);
1376
+ }), [
1377
+ "addResource",
1378
+ "addResources",
1379
+ "addResourceBundle",
1380
+ "removeResourceBundle"
1381
+ ].forEach((e) => {
1382
+ this[e] = (...t) => (this.store[e](...t), this);
1383
+ });
1384
+ let i = d(), a = () => {
1385
+ let e = (e, n) => {
1386
+ 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);
1387
+ };
1388
+ if (this.languages && !this.isInitialized) return e(null, this.t.bind(this));
1389
+ this.changeLanguage(this.options.lng, e);
1390
+ };
1391
+ return this.options.resources || !this.options.initAsync ? a() : setTimeout(a, 0), i;
1392
+ }
1393
+ loadResources(e, t = X) {
1394
+ let n = t, r = u(e) ? e : this.language;
1395
+ if (typeof e == "function" && (n = e), !this.options.resources || this.options.partialBundledLanguages) {
1396
+ if (r?.toLowerCase() === "cimode" && (!this.options.preload || this.options.preload.length === 0)) return n();
1397
+ let e = [], t = (t) => {
1398
+ t && t !== "cimode" && this.services.languageUtils.toResolveHierarchy(t).forEach((t) => {
1399
+ t !== "cimode" && e.indexOf(t) < 0 && e.push(t);
1400
+ });
1401
+ };
1402
+ r ? t(r) : this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach((e) => t(e)), this.options.preload?.forEach?.((e) => t(e)), this.services.backendConnector.load(e, this.options.ns, (e) => {
1403
+ !e && !this.resolvedLanguage && this.language && this.setResolvedLanguage(this.language), n(e);
1404
+ });
1405
+ } else n(null);
1406
+ }
1407
+ reloadResources(e, t, n) {
1408
+ let r = d();
1409
+ 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 ||= X, this.services.backendConnector.reload(e, t, (e) => {
1410
+ r.resolve(), n(e);
1411
+ }), r;
1412
+ }
1413
+ use(e) {
1414
+ if (!e) throw Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");
1415
+ if (!e.type) throw Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");
1416
+ 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" && F.addPostProcessor(e), e.type === "formatter" && (this.modules.formatter = e), e.type === "3rdParty" && this.modules.external.push(e), this;
1417
+ }
1418
+ setResolvedLanguage(e) {
1419
+ if (!(!e || !this.languages) && !(["cimode", "dev"].indexOf(e) > -1)) {
1420
+ for (let e = 0; e < this.languages.length; e++) {
1421
+ let t = this.languages[e];
1422
+ if (!(["cimode", "dev"].indexOf(t) > -1) && this.store.hasLanguageSomeTranslations(t)) {
1423
+ this.resolvedLanguage = t;
1424
+ break;
1425
+ }
1426
+ }
1427
+ !this.resolvedLanguage && this.languages.indexOf(e) < 0 && this.store.hasLanguageSomeTranslations(e) && (this.resolvedLanguage = e, this.languages.unshift(e));
1428
+ }
1429
+ }
1430
+ changeLanguage(e, t) {
1431
+ this.isLanguageChangingTo = e;
1432
+ let n = d();
1433
+ this.emit("languageChanging", e);
1434
+ let r = (e) => {
1435
+ this.language = e, this.languages = this.services.languageUtils.toResolveHierarchy(e), this.resolvedLanguage = void 0, this.setResolvedLanguage(e);
1436
+ }, i = (i, a) => {
1437
+ 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));
1438
+ }, a = (t) => {
1439
+ !e && !t && this.services.languageDetector && (t = []);
1440
+ let n = u(t) ? t : t && t[0], a = this.store.hasLanguageSomeTranslations(n) ? n : this.services.languageUtils.getBestMatchFromCodes(u(t) ? [t] : t);
1441
+ a && (this.language || r(a), this.translator.language || this.translator.changeLanguage(a), this.services.languageDetector?.cacheUserLanguage?.(a)), this.loadResources(a, (e) => {
1442
+ i(e, a);
1443
+ });
1444
+ };
1445
+ return !e && this.services.languageDetector && !this.services.languageDetector.async ? a(this.services.languageDetector.detect()) : !e && this.services.languageDetector && this.services.languageDetector.async ? this.services.languageDetector.detect.length === 0 ? this.services.languageDetector.detect().then(a) : this.services.languageDetector.detect(a) : a(e), n;
1446
+ }
1447
+ getFixedT(e, t, n) {
1448
+ let r = (e, t, ...i) => {
1449
+ let a;
1450
+ a = typeof t == "object" ? { ...t } : this.options.overloadTranslationOptionHandler([e, t].concat(i)), a.lng = a.lng || r.lng, a.lngs = a.lngs || r.lngs, a.ns = a.ns || r.ns, a.keyPrefix !== "" && (a.keyPrefix = a.keyPrefix || n || r.keyPrefix);
1451
+ let o = {
1452
+ ...this.options,
1453
+ ...a
1454
+ };
1455
+ typeof a.keyPrefix == "function" && (a.keyPrefix = L(a.keyPrefix, o));
1456
+ let s = this.options.keySeparator || ".", c;
1457
+ return a.keyPrefix && Array.isArray(e) ? c = e.map((e) => (typeof e == "function" && (e = L(e, o)), `${a.keyPrefix}${s}${e}`)) : (typeof e == "function" && (e = L(e, o)), c = a.keyPrefix ? `${a.keyPrefix}${s}${e}` : e), this.t(c, a);
1458
+ };
1459
+ return u(e) ? r.lng = e : r.lngs = e, r.ns = t, r.keyPrefix = n, r;
1460
+ }
1461
+ t(...e) {
1462
+ return this.translator?.translate(...e);
1463
+ }
1464
+ exists(...e) {
1465
+ return this.translator?.exists(...e);
1466
+ }
1467
+ setDefaultNamespace(e) {
1468
+ this.options.defaultNS = e;
1469
+ }
1470
+ hasLoadedNamespace(e, t = {}) {
1471
+ if (!this.isInitialized) return this.logger.warn("hasLoadedNamespace: i18next was not initialized", this.languages), !1;
1472
+ if (!this.languages || !this.languages.length) return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty", this.languages), !1;
1473
+ let n = t.lng || this.resolvedLanguage || this.languages[0], r = this.options ? this.options.fallbackLng : !1, i = this.languages[this.languages.length - 1];
1474
+ if (n.toLowerCase() === "cimode") return !0;
1475
+ let a = (e, t) => {
1476
+ let n = this.services.backendConnector.state[`${e}|${t}`];
1477
+ return n === -1 || n === 0 || n === 2;
1478
+ };
1479
+ if (t.precheck) {
1480
+ let e = t.precheck(this, a);
1481
+ if (e !== void 0) return e;
1482
+ }
1483
+ return !!(this.hasResourceBundle(n, e) || !this.services.backendConnector.backend || this.options.resources && !this.options.partialBundledLanguages || a(n, e) && (!r || a(i, e)));
1484
+ }
1485
+ loadNamespaces(e, t) {
1486
+ let n = d();
1487
+ return this.options.ns ? (u(e) && (e = [e]), e.forEach((e) => {
1488
+ this.options.ns.indexOf(e) < 0 && this.options.ns.push(e);
1489
+ }), this.loadResources((e) => {
1490
+ n.resolve(), t && t(e);
1491
+ }), n) : (t && t(), Promise.resolve());
1492
+ }
1493
+ loadLanguages(e, t) {
1494
+ let n = d();
1495
+ u(e) && (e = [e]);
1496
+ let r = this.options.preload || [], i = e.filter((e) => r.indexOf(e) < 0 && this.services.languageUtils.isSupportedCode(e));
1497
+ return i.length ? (this.options.preload = r.concat(i), this.loadResources((e) => {
1498
+ n.resolve(), t && t(e);
1499
+ }), n) : (t && t(), Promise.resolve());
1500
+ }
1501
+ dir(e) {
1502
+ if (e ||= this.resolvedLanguage || (this.languages?.length > 0 ? this.languages[0] : this.language), !e) return "rtl";
1503
+ try {
1504
+ let t = new Intl.Locale(e);
1505
+ if (t && t.getTextInfo) {
1506
+ let e = t.getTextInfo();
1507
+ if (e && e.direction) return e.direction;
1508
+ }
1509
+ } catch {}
1510
+ let t = /* @__PURE__ */ "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".split("."), n = this.services?.languageUtils || new V(J());
1511
+ return e.toLowerCase().indexOf("-latn") > 1 ? "ltr" : t.indexOf(n.getLanguagePartFromCode(e)) > -1 || e.toLowerCase().indexOf("-arab") > 1 ? "rtl" : "ltr";
1512
+ }
1513
+ static createInstance(t = {}, n) {
1514
+ let r = new e(t, n);
1515
+ return r.createInstance = e.createInstance, r;
1516
+ }
1517
+ cloneInstance(t = {}, n = X) {
1518
+ let r = t.forkResourceStore;
1519
+ r && delete t.forkResourceStore;
1520
+ let i = {
1521
+ ...this.options,
1522
+ ...t,
1523
+ isClone: !0
1524
+ }, a = new e(i);
1525
+ if ((t.debug !== void 0 || t.prefix !== void 0) && (a.logger = a.logger.clone(t)), [
1526
+ "store",
1527
+ "services",
1528
+ "language"
1529
+ ].forEach((e) => {
1530
+ a[e] = this[e];
1531
+ }), a.services = { ...this.services }, a.services.utils = { hasLoadedNamespace: a.hasLoadedNamespace.bind(a) }, r && (a.store = new P(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) {
1532
+ let e = {
1533
+ ...J().interpolation,
1534
+ ...this.options.interpolation,
1535
+ ...t.interpolation
1536
+ }, n = {
1537
+ ...i,
1538
+ interpolation: e
1539
+ };
1540
+ a.services.interpolator = new K(n);
1541
+ }
1542
+ return a.translator = new B(a.services, i), a.translator.on("*", (e, ...t) => {
1543
+ a.emit(e, ...t);
1544
+ }), a.init(i, n), a.translator.options = i, a.translator.backendConnector.services.utils = { hasLoadedNamespace: a.hasLoadedNamespace.bind(a) }, a;
1545
+ }
1546
+ toJSON() {
1547
+ return {
1548
+ options: this.options,
1549
+ store: this.store,
1550
+ language: this.language,
1551
+ languages: this.languages,
1552
+ resolvedLanguage: this.resolvedLanguage
1553
+ };
1554
+ }
1555
+ }.createInstance();
1556
+ //#endregion
1557
+ //#region ../../shared/translator/dist/index.js
1558
+ Q.createInstance, Q.dir, Q.init, Q.loadResources, Q.reloadResources, Q.use, Q.changeLanguage, Q.getFixedT, Q.t, Q.exists, Q.setDefaultNamespace, Q.hasLoadedNamespace, Q.loadNamespaces, Q.loadLanguages, Q.init({
1559
+ fallbackLng: "en",
1560
+ lng: "en",
1561
+ showSupportNotice: !1,
1562
+ resources: {
1563
+ en: c,
1564
+ es: l
1565
+ }
1566
+ });
1567
+ //#endregion
1568
+ //#region src/i18n.ts
1569
+ var { translator: $ } = {
1570
+ translator: {
1571
+ ...Q,
1572
+ t: (e, t) => {
1573
+ let { lng: n } = t;
1574
+ switch (n) {
1575
+ case "en_US":
1576
+ case "en-US":
1577
+ t.lng = "en";
1578
+ break;
1579
+ case "es_ES":
1580
+ case "es-ES":
1581
+ case "es_MX":
1582
+ case "es-MX":
1583
+ t.lng = "es";
1584
+ break;
1585
+ default: break;
1586
+ }
1587
+ return Q.t(e, {
1588
+ lng: n,
1589
+ ...t
1590
+ });
1591
+ }
1592
+ },
1593
+ languageOptions: [{
1594
+ value: "en_US",
1595
+ label: "English (US)"
1596
+ }, {
1597
+ value: "es_ES",
1598
+ label: "Spanish"
1599
+ }]
1600
+ };
1601
+ function fe(e, t) {
1602
+ return $.t(`translation:simpleCloze:${e}`, { lng: t });
1603
+ }
1604
+ function pe(e, t) {
1605
+ return $.t(`common:${e}`, { lng: t });
1606
+ }
1607
+ //#endregion
1608
+ export { pe as n, s as r, fe as t };
1609
+
1610
+ //# sourceMappingURL=i18n-BaF24Jzw.js.map