@pie-element/simple-cloze 0.1.4-next.11 → 0.1.4-next.13

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