@pie-element/inline-dropdown 10.1.2-next.2 → 10.1.2

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 (86) hide show
  1. package/CHANGELOG.json +1082 -0
  2. package/CHANGELOG.md +2192 -0
  3. package/LICENSE.md +5 -0
  4. package/README.md +1 -0
  5. package/configure/CHANGELOG.json +647 -0
  6. package/configure/CHANGELOG.md +1949 -0
  7. package/configure/lib/defaults.js +192 -0
  8. package/configure/lib/defaults.js.map +1 -0
  9. package/configure/lib/index.js +135 -0
  10. package/configure/lib/index.js.map +1 -0
  11. package/configure/lib/inline-dropdown-toolbar.js +456 -0
  12. package/configure/lib/inline-dropdown-toolbar.js.map +1 -0
  13. package/configure/lib/main.js +612 -0
  14. package/configure/lib/main.js.map +1 -0
  15. package/configure/lib/markupUtils.js +50 -0
  16. package/configure/lib/markupUtils.js.map +1 -0
  17. package/configure/lib/response-area.js +48 -0
  18. package/configure/lib/response-area.js.map +1 -0
  19. package/configure/lib/utils.js +22 -0
  20. package/configure/lib/utils.js.map +1 -0
  21. package/configure/package.json +24 -0
  22. package/controller/CHANGELOG.json +467 -0
  23. package/controller/CHANGELOG.md +1283 -0
  24. package/controller/lib/defaults.js +25 -0
  25. package/controller/lib/defaults.js.map +1 -0
  26. package/controller/lib/index.js +295 -0
  27. package/controller/lib/index.js.map +1 -0
  28. package/controller/lib/utils.js +32 -0
  29. package/controller/lib/utils.js.map +1 -0
  30. package/controller/package.json +16 -0
  31. package/docs/config-schema.json +2854 -0
  32. package/docs/config-schema.json.md +2106 -0
  33. package/docs/demo/config.js +8 -0
  34. package/docs/demo/generate.js +76 -0
  35. package/docs/demo/index.html +1 -0
  36. package/docs/demo/session.js +11 -0
  37. package/docs/pie-schema.json +1152 -0
  38. package/docs/pie-schema.json.md +814 -0
  39. package/lib/index.js +85 -0
  40. package/lib/index.js.map +1 -0
  41. package/lib/inline-dropdown.js +176 -0
  42. package/lib/inline-dropdown.js.map +1 -0
  43. package/package.json +21 -85
  44. package/configure.js +0 -2
  45. package/controller.js +0 -1
  46. package/dist/author/defaults.d.ts +0 -194
  47. package/dist/author/defaults.js +0 -130
  48. package/dist/author/index.d.ts +0 -43
  49. package/dist/author/index.js +0 -83
  50. package/dist/author/inline-dropdown-toolbar.d.ts +0 -48
  51. package/dist/author/inline-dropdown-toolbar.js +0 -268
  52. package/dist/author/main.d.ts +0 -49
  53. package/dist/author/main.js +0 -379
  54. package/dist/author/markupUtils.d.ts +0 -12
  55. package/dist/author/markupUtils.js +0 -23
  56. package/dist/author/response-area.d.ts +0 -20
  57. package/dist/author/response-area.js +0 -32
  58. package/dist/author/utils.d.ts +0 -10
  59. package/dist/author/utils.js +0 -10
  60. package/dist/browser/Close-ihSzAQyP.js +0 -9031
  61. package/dist/browser/Close-ihSzAQyP.js.map +0 -1
  62. package/dist/browser/author/index.js +0 -40578
  63. package/dist/browser/author/index.js.map +0 -1
  64. package/dist/browser/controller/index.js +0 -196
  65. package/dist/browser/controller/index.js.map +0 -1
  66. package/dist/browser/delivery/index.js +0 -2714
  67. package/dist/browser/delivery/index.js.map +0 -1
  68. package/dist/browser/dist-CAsDMEWi.js +0 -133
  69. package/dist/browser/dist-CAsDMEWi.js.map +0 -1
  70. package/dist/browser/inline-dropdown.css +0 -2
  71. package/dist/controller/defaults.d.ts +0 -27
  72. package/dist/controller/defaults.js +0 -21
  73. package/dist/controller/index.d.ts +0 -54
  74. package/dist/controller/index.js +0 -124
  75. package/dist/controller/utils.d.ts +0 -12
  76. package/dist/controller/utils.js +0 -13
  77. package/dist/delivery/index.d.ts +0 -20
  78. package/dist/delivery/index.js +0 -60
  79. package/dist/delivery/inline-dropdown.d.ts +0 -38
  80. package/dist/delivery/inline-dropdown.js +0 -109
  81. package/dist/index.d.ts +0 -1
  82. package/dist/index.iife.d.ts +0 -8
  83. package/dist/index.iife.js +0 -148
  84. package/dist/index.js +0 -2
  85. package/dist/runtime-support.d.ts +0 -12
  86. package/dist/runtime-support.js +0 -12
@@ -1,2714 +0,0 @@
1
- import { Ft as e, L as t, Nt as n, Rt as r, S as i, a, d as o, f as s, ft as c, ht as l, i as u, j as d, k as f, m as p, n as m, o as h, p as g, pt as _, t as v, v as y, w as b } from "../Close-ihSzAQyP.js";
2
- import { _ as x, o as S } from "../dist-CAsDMEWi.js";
3
- import C, { useRef as w } from "react";
4
- import { createRoot as T } from "react-dom/client";
5
- import E from "react-dom";
6
- import { Fragment as ee, jsx as D, jsxs as O } from "react/jsx-runtime";
7
- //#region ../../shared/player-events/dist/index.js
8
- var te = class e extends CustomEvent {
9
- static {
10
- this.TYPE = "model-set";
11
- }
12
- constructor(t, n, r) {
13
- super(e.TYPE, {
14
- bubbles: !0,
15
- composed: !0,
16
- detail: {
17
- complete: n,
18
- component: t,
19
- hasModel: r
20
- }
21
- }), this.component = t, this.complete = n;
22
- }
23
- }, ne = class e extends CustomEvent {
24
- static {
25
- this.TYPE = "session-changed";
26
- }
27
- constructor(t, n) {
28
- super(e.TYPE, {
29
- bubbles: !0,
30
- composed: !0,
31
- detail: {
32
- complete: n,
33
- component: t
34
- }
35
- }), this.component = t, this.complete = n;
36
- }
37
- }, k = /* @__PURE__ */ r(n(), 1), re = "height ease-in 300ms, opacity ease-in 300ms", ie = l("div")(() => ({
38
- position: "relative",
39
- height: 0,
40
- overflow: "hidden",
41
- display: "flex",
42
- visibility: "hidden",
43
- width: 0,
44
- "&.enter": {
45
- transition: re,
46
- opacity: 1,
47
- height: "auto",
48
- width: "auto",
49
- visibility: "visible",
50
- minHeight: "25px"
51
- },
52
- "&.enter-done": {
53
- height: "auto",
54
- visibility: "visible",
55
- width: "auto",
56
- minHeight: "25px"
57
- },
58
- "&.exit": {
59
- transition: re,
60
- opacity: 0,
61
- height: 0,
62
- visibility: "visible",
63
- width: 0
64
- },
65
- "&.exit-done": {
66
- opacity: 0,
67
- visibility: "hidden",
68
- height: 0,
69
- width: 0
70
- }
71
- })), ae = (e) => {
72
- let { show: t, children: n, className: r } = e, i = w(null);
73
- return /* @__PURE__ */ D(_, {
74
- nodeRef: i,
75
- in: t,
76
- appear: !0,
77
- mountOnEnter: !1,
78
- timeout: 300,
79
- classNames: {
80
- enter: "enter",
81
- enterDone: "enter-done",
82
- exit: "exit",
83
- exitDone: "exit-done"
84
- },
85
- children: /* @__PURE__ */ D(ie, {
86
- ref: i,
87
- className: r,
88
- children: n
89
- })
90
- });
91
- };
92
- ae.propTypes = {
93
- show: k.default.bool.isRequired,
94
- className: k.default.string,
95
- children: k.default.oneOfType([k.default.arrayOf(k.default.node), k.default.node]).isRequired
96
- };
97
- //#endregion
98
- //#region ../../lib-react/icons/dist/correct-response-icon.js
99
- var oe = ({ bgFill: e, fgFill: t }) => /* @__PURE__ */ O("svg", {
100
- preserveAspectRatio: "xMinYMin meet",
101
- version: "1.1",
102
- viewBox: "-283 359 34 35",
103
- style: { enableBackground: "new -283 359 34 35" },
104
- children: [
105
- /* @__PURE__ */ D("circle", {
106
- cx: "-266",
107
- cy: "375.9",
108
- r: "14",
109
- fill: e
110
- }),
111
- /* @__PURE__ */ D("path", {
112
- d: "M-280.5,375.9c0-8,6.5-14.5,14.5-14.5s14.5,6.5,14.5,14.5s-6.5,14.5-14.5,14.5S-280.5,383.9-280.5,375.9z\n M-279.5,375.9c0,7.4,6.1,13.5,13.5,13.5c7.4,0,13.5-6.1,13.5-13.5s-6.1-13.5-13.5-13.5C-273.4,362.4-279.5,368.5-279.5,375.9z",
113
- fill: e
114
- }),
115
- /* @__PURE__ */ D("polygon", {
116
- points: "-265.4,383.1 -258.6,377.2 -261.2,374.2 -264.3,376.9 -268.9,368.7 -272.4,370.6",
117
- fill: t
118
- })
119
- ]
120
- });
121
- oe.propTypes = {
122
- bgFill: k.default.string.isRequired,
123
- fgFill: k.default.string.isRequired
124
- };
125
- var se = ({ bgFill: e, fgFill: t, borderFill: n }) => /* @__PURE__ */ O("svg", {
126
- preserveAspectRatio: "xMinYMin meet",
127
- version: "1.1",
128
- viewBox: "-129.5 127 34 35",
129
- style: { enableBackground: "new -129.5 127 34 35" },
130
- children: [
131
- /* @__PURE__ */ D("path", {
132
- style: {
133
- fill: "#D0CAC5",
134
- stroke: "#E6E3E0",
135
- strokeWidth: .75,
136
- strokeMiterlimit: 10
137
- },
138
- d: "M-112.9,160.4c-8.5,0-15.5-6.9-15.5-15.5c0-8.5,6.9-15.5,15.5-15.5s15.5,6.9,15.5,15.5\n C-97.4,153.5-104.3,160.4-112.9,160.4z"
139
- }),
140
- /* @__PURE__ */ D("path", {
141
- style: {
142
- fill: "#B3ABA4",
143
- stroke: "#CDC7C2",
144
- strokeWidth: .5,
145
- strokeMiterlimit: 10
146
- },
147
- d: "M-113.2,159c-8,0-14.5-6.5-14.5-14.5s6.5-14.5,14.5-14.5s14.5,6.5,14.5,14.5S-105.2,159-113.2,159z"
148
- }),
149
- /* @__PURE__ */ D("circle", {
150
- cx: "-114.2",
151
- cy: "143.5",
152
- r: "14",
153
- fill: e
154
- }),
155
- /* @__PURE__ */ D("path", {
156
- d: "M-114.2,158c-8,0-14.5-6.5-14.5-14.5s6.5-14.5,14.5-14.5s14.5,6.5,14.5,14.5S-106.2,158-114.2,158z\n M-114.2,130c-7.4,0-13.5,6.1-13.5,13.5s6.1,13.5,13.5,13.5s13.5-6.1,13.5-13.5S-106.8,130-114.2,130z",
157
- fill: n
158
- }),
159
- /* @__PURE__ */ D("polygon", {
160
- points: "-114.8,150.7 -121.6,144.8 -119,141.8 -115.9,144.5 -111.3,136.3 -107.8,138.2",
161
- fill: t
162
- })
163
- ]
164
- });
165
- se.propTypes = {
166
- bgFill: k.default.string.isRequired,
167
- fgFill: k.default.string.isRequired,
168
- borderFill: k.default.string.isRequired
169
- };
170
- var ce = l("div")(({ size: e }) => ({
171
- width: e || "25px",
172
- height: e || "25px"
173
- })), A = ({ open: e, size: t }) => /* @__PURE__ */ D(ce, {
174
- size: t,
175
- children: e ? /* @__PURE__ */ D(oe, {
176
- bgFill: "#bce2ff",
177
- fgFill: "#1a9cff"
178
- }) : /* @__PURE__ */ D(se, {
179
- bgFill: "white",
180
- fgFill: "#1a9cff",
181
- borderFill: "#bce2ff"
182
- })
183
- });
184
- A.propTypes = {
185
- open: k.default.bool,
186
- size: k.default.string
187
- }, A.defaultProps = { open: !1 };
188
- //#endregion
189
- //#region ../../lib-react/translator/dist/en.js
190
- var le = {
191
- translation: {
192
- categorize: {
193
- limitMaxChoicesPerCategory: "You've reached the limit of {{maxChoicesPerCategory}} responses per area. To add another response, one must first be removed.",
194
- maxChoicesPerCategoryRestriction: "To change this value to {{maxChoicesPerCategory}}, each category must have {{maxChoicesPerCategory}} or fewer answer choice[s]."
195
- },
196
- ebsr: { part: "Part {{index}}" },
197
- numberLine: {
198
- addElementLimit_one: "You can only add {{count}} element",
199
- addElementLimit_other: "You can only add {{count}} elements",
200
- clearAll: "Clear all"
201
- },
202
- imageClozeAssociation: {
203
- reachedLimit_one: "You’ve reached the limit of {{count}} response per area. To add another response, one must first be removed.",
204
- reachedLimit_other: "Full"
205
- },
206
- drawingResponse: {
207
- fillColor: "Fill color",
208
- outlineColor: "Outline color",
209
- noFill: "No fill",
210
- lightblue: "Light blue",
211
- lightyellow: "Light yellow",
212
- red: "Red",
213
- orange: "Orange",
214
- yellow: "Yellow",
215
- violet: "Violet",
216
- blue: "Blue",
217
- green: "Green",
218
- white: "White",
219
- black: "Black",
220
- onDoubleClick: "Double click to edit this text. Press Enter to submit."
221
- },
222
- charting: {
223
- addCategory: "Add category",
224
- actions: "Actions",
225
- add: "Add",
226
- delete: "Delete",
227
- newLabel: "New label",
228
- reachedLimit_other: "There can't be more than {{count}} categories.",
229
- keyLegend: {
230
- incorrectAnswer: "Student incorrect answer",
231
- correctAnswer: "Student correct answer",
232
- correctKeyAnswer: "Answer key correct"
233
- }
234
- },
235
- graphing: {
236
- point: "Point",
237
- circle: "Circle",
238
- line: "Line",
239
- parabola: "Parabola",
240
- absolute: "Absolute Value",
241
- exponential: "Exponential",
242
- polygon: "Polygon",
243
- ray: "Ray",
244
- segment: "Segment",
245
- sine: "Sine",
246
- vector: "Vector",
247
- label: "Label",
248
- redo: "Redo",
249
- reset: "Reset"
250
- },
251
- 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." },
252
- multipleChoice: {
253
- minSelections: "Select at least {{minSelections}}.",
254
- maxSelections_one: "Only {{maxSelections}} answer is allowed.",
255
- maxSelections_other: "Only {{maxSelections}} answers are allowed.",
256
- minmaxSelections_equal: "Select {{minSelections}}.",
257
- minmaxSelections_range: "Select between {{minSelections}} and {{maxSelections}}."
258
- },
259
- selectText: {
260
- correctAnswerSelected: "Correct",
261
- correctAnswerNotSelected: "Correct Answer Not Selected",
262
- incorrectSelection: "Incorrect Selection",
263
- key: "Key"
264
- }
265
- },
266
- common: {
267
- undo: "Undo",
268
- clearAll: "Clear all",
269
- correct: "Correct",
270
- incorrect: "Incorrect",
271
- showCorrectAnswer: "Show correct answer",
272
- hideCorrectAnswer: "Hide correct answer",
273
- 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.",
274
- warning: "Warning",
275
- showNote: "Show Note",
276
- hideNote: "Hide Note",
277
- cancel: "Cancel"
278
- }
279
- }, ue = {
280
- translation: {
281
- categorize: {
282
- limitMaxChoicesPerCategory: "Has alcanzado el límite de {{maxChoicesPerCategory}} respuestas por área. Para agregar otra respuesta, primero se debe eliminar una respuesta.",
283
- maxChoicesPerCategoryRestriction: "Para cambiar este valor a {{maxChoicesPerCategory}}, cada categoría debe tener {{maxChoicesPerCategory}} o menos opciones de respuesta"
284
- },
285
- ebsr: { part: "Parte {{index}}" },
286
- numberLine: {
287
- addElementLimit_one: "Solo puedes agregar {{count}} elemento",
288
- addElementLimit_other: "Solo puedes agregar {{count}} elementos",
289
- clearAll: "Borrar todo"
290
- },
291
- imageClozeAssociation: {
292
- reachedLimit_one: "Has alcanzado el límite de {{count}} respuesta por área. Para agregar otra respuesta, primero se debe eliminar una respuesta.",
293
- reachedLimit_other: "Lleno"
294
- },
295
- drawingResponse: {
296
- fillColor: "Color de relleno",
297
- outlineColor: "Color del contorno",
298
- noFill: "Sin relleno",
299
- lightblue: "Azul claro",
300
- lightyellow: "Amarillo claro",
301
- red: "Rojo",
302
- orange: "Naranja",
303
- yellow: "Amarillo",
304
- violet: "Violeta",
305
- blue: "Azul",
306
- green: "Verde",
307
- white: "Blanco",
308
- black: "Negro",
309
- onDoubleClick: "Haz doble clic para revisar este texto. Presiona el botón de ingreso para enviar"
310
- },
311
- charting: {
312
- addCategory: "Añadir categoría",
313
- actions: "Acciones",
314
- add: "Añadir",
315
- delete: "Eliminar",
316
- newLabel: "Nueva etiqueta",
317
- reachedLimit_other: "No puede haber más de {{count}} categorías.",
318
- keyLegend: {
319
- incorrectAnswer: "Respuesta incorrecta del estudiante",
320
- correctAnswer: "Respuesta correcta del estudiante",
321
- correctKeyAnswer: "Clave de respuesta correcta"
322
- }
323
- },
324
- graphing: {
325
- point: "Punto",
326
- circle: "Circulo",
327
- line: "Línea",
328
- parabola: "Parábola",
329
- absolute: "Valor absoluto",
330
- exponential: "Exponencial",
331
- polygon: "Polígono",
332
- ray: "Semirrecta",
333
- segment: "Segmento ",
334
- sine: "Seno",
335
- vector: "Vector",
336
- label: "Etiqueta",
337
- redo: "Rehacer",
338
- reset: "Reiniciar"
339
- },
340
- 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." },
341
- multipleChoice: {
342
- minSelections: "Seleccione al menos {{minSelections}}.",
343
- maxSelections_one: "Sólo se permite {{maxSelections}} respuesta.",
344
- maxSelections_other: "Sólo se permiten {{maxSelections}} respuestas.",
345
- minmaxSelections_equal: "Seleccione {{minSelections}}.",
346
- minmaxSelections_range: "Seleccione entre {{minSelections}} y {{maxSelections}}."
347
- },
348
- selectText: {
349
- correctAnswerSelected: "Respuesta Correcta",
350
- correctAnswerNotSelected: "Respuesta Correcta No Seleccionada",
351
- incorrectSelection: "Selección Incorrecta",
352
- key: "Clave"
353
- }
354
- },
355
- common: {
356
- undo: "Deshacer",
357
- clearAll: "Borrar todo",
358
- correct: "Correct",
359
- incorrect: "Incorrect",
360
- showCorrectAnswer: "Mostrar respuesta correcta",
361
- hideCorrectAnswer: "Ocultar respuesta correcta",
362
- 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.",
363
- warning: "Advertencia",
364
- showNote: "Mostrar Nota",
365
- hideNote: "Ocultar Nota",
366
- cancel: "Cancelar"
367
- }
368
- }, j = (e) => typeof e == "string", M = () => {
369
- let e, t, n = new Promise((n, r) => {
370
- e = n, t = r;
371
- });
372
- return n.resolve = e, n.reject = t, n;
373
- }, de = (e) => e == null ? "" : "" + e, fe = (e, t, n) => {
374
- e.forEach((e) => {
375
- t[e] && (n[e] = t[e]);
376
- });
377
- }, pe = /###/g, me = (e) => e && e.indexOf("###") > -1 ? e.replace(pe, ".") : e, he = (e) => !e || j(e), N = (e, t, n) => {
378
- let r = j(t) ? t.split(".") : t, i = 0;
379
- for (; i < r.length - 1;) {
380
- if (he(e)) return {};
381
- let t = me(r[i]);
382
- !e[t] && n && (e[t] = new n()), e = Object.prototype.hasOwnProperty.call(e, t) ? e[t] : {}, ++i;
383
- }
384
- return he(e) ? {} : {
385
- obj: e,
386
- k: me(r[i])
387
- };
388
- }, ge = (e, t, n) => {
389
- let { obj: r, k: i } = N(e, t, Object);
390
- if (r !== void 0 || t.length === 1) {
391
- r[i] = n;
392
- return;
393
- }
394
- let a = t[t.length - 1], o = t.slice(0, t.length - 1), s = N(e, o, Object);
395
- for (; s.obj === void 0 && o.length;) a = `${o[o.length - 1]}.${a}`, o = o.slice(0, o.length - 1), s = N(e, o, Object), s?.obj && s.obj[`${s.k}.${a}`] !== void 0 && (s.obj = void 0);
396
- s.obj[`${s.k}.${a}`] = n;
397
- }, _e = (e, t, n, r) => {
398
- let { obj: i, k: a } = N(e, t, Object);
399
- i[a] = i[a] || [], i[a].push(n);
400
- }, P = (e, t) => {
401
- let { obj: n, k: r } = N(e, t);
402
- if (n && Object.prototype.hasOwnProperty.call(n, r)) return n[r];
403
- }, ve = (e, t, n) => {
404
- let r = P(e, n);
405
- return r === void 0 ? P(t, n) : r;
406
- }, ye = (e, t, n) => {
407
- for (let r in t) r !== "__proto__" && r !== "constructor" && (r in e ? j(e[r]) || e[r] instanceof String || j(t[r]) || t[r] instanceof String ? n && (e[r] = t[r]) : ye(e[r], t[r], n) : e[r] = t[r]);
408
- return e;
409
- }, F = (e) => e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"), be = {
410
- "&": "&amp;",
411
- "<": "&lt;",
412
- ">": "&gt;",
413
- "\"": "&quot;",
414
- "'": "&#39;",
415
- "/": "&#x2F;"
416
- }, xe = (e) => j(e) ? e.replace(/[&<>"'\/]/g, (e) => be[e]) : e, Se = class {
417
- constructor(e) {
418
- this.capacity = e, this.regExpMap = /* @__PURE__ */ new Map(), this.regExpQueue = [];
419
- }
420
- getRegExp(e) {
421
- let t = this.regExpMap.get(e);
422
- if (t !== void 0) return t;
423
- let n = new RegExp(e);
424
- return this.regExpQueue.length === this.capacity && this.regExpMap.delete(this.regExpQueue.shift()), this.regExpMap.set(e, n), this.regExpQueue.push(e), n;
425
- }
426
- }, Ce = [
427
- " ",
428
- ",",
429
- "?",
430
- "!",
431
- ";"
432
- ], we = new Se(20), Te = (e, t, n) => {
433
- t ||= "", n ||= "";
434
- let r = Ce.filter((e) => t.indexOf(e) < 0 && n.indexOf(e) < 0);
435
- if (r.length === 0) return !0;
436
- let i = we.getRegExp(`(${r.map((e) => e === "?" ? "\\?" : e).join("|")})`), a = !i.test(e);
437
- if (!a) {
438
- let t = e.indexOf(n);
439
- t > 0 && !i.test(e.substring(0, t)) && (a = !0);
440
- }
441
- return a;
442
- }, I = (e, t, n = ".") => {
443
- if (!e) return;
444
- if (e[t]) return Object.prototype.hasOwnProperty.call(e, t) ? e[t] : void 0;
445
- let r = t.split(n), i = e;
446
- for (let e = 0; e < r.length;) {
447
- if (!i || typeof i != "object") return;
448
- let t, a = "";
449
- for (let o = e; o < r.length; ++o) if (o !== e && (a += n), a += r[o], t = i[a], t !== void 0) {
450
- if ([
451
- "string",
452
- "number",
453
- "boolean"
454
- ].indexOf(typeof t) > -1 && o < r.length - 1) continue;
455
- e += o - e + 1;
456
- break;
457
- }
458
- i = t;
459
- }
460
- return i;
461
- }, L = (e) => e?.replace(/_/g, "-"), Ee = {
462
- type: "logger",
463
- log(e) {
464
- this.output("log", e);
465
- },
466
- warn(e) {
467
- this.output("warn", e);
468
- },
469
- error(e) {
470
- this.output("error", e);
471
- },
472
- output(e, t) {
473
- console?.[e]?.apply?.(console, t);
474
- }
475
- }, R = new class e {
476
- constructor(e, t = {}) {
477
- this.init(e, t);
478
- }
479
- init(e, t = {}) {
480
- this.prefix = t.prefix || "i18next:", this.logger = e || Ee, this.options = t, this.debug = t.debug;
481
- }
482
- log(...e) {
483
- return this.forward(e, "log", "", !0);
484
- }
485
- warn(...e) {
486
- return this.forward(e, "warn", "", !0);
487
- }
488
- error(...e) {
489
- return this.forward(e, "error", "");
490
- }
491
- deprecate(...e) {
492
- return this.forward(e, "warn", "WARNING DEPRECATED: ", !0);
493
- }
494
- forward(e, t, n, r) {
495
- return r && !this.debug ? null : (j(e[0]) && (e[0] = `${n}${this.prefix} ${e[0]}`), this.logger[t](e));
496
- }
497
- create(t) {
498
- return new e(this.logger, {
499
- prefix: `${this.prefix}:${t}:`,
500
- ...this.options
501
- });
502
- }
503
- clone(t) {
504
- return t ||= this.options, t.prefix = t.prefix || this.prefix, new e(this.logger, t);
505
- }
506
- }(), z = class {
507
- constructor() {
508
- this.observers = {};
509
- }
510
- on(e, t) {
511
- return e.split(" ").forEach((e) => {
512
- this.observers[e] || (this.observers[e] = /* @__PURE__ */ new Map());
513
- let n = this.observers[e].get(t) || 0;
514
- this.observers[e].set(t, n + 1);
515
- }), this;
516
- }
517
- off(e, t) {
518
- if (this.observers[e]) {
519
- if (!t) {
520
- delete this.observers[e];
521
- return;
522
- }
523
- this.observers[e].delete(t);
524
- }
525
- }
526
- emit(e, ...t) {
527
- this.observers[e] && Array.from(this.observers[e].entries()).forEach(([e, n]) => {
528
- for (let r = 0; r < n; r++) e(...t);
529
- }), this.observers["*"] && Array.from(this.observers["*"].entries()).forEach(([n, r]) => {
530
- for (let i = 0; i < r; i++) n.apply(n, [e, ...t]);
531
- });
532
- }
533
- }, De = class extends z {
534
- constructor(e, t = {
535
- ns: ["translation"],
536
- defaultNS: "translation"
537
- }) {
538
- super(), this.data = e || {}, this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.options.ignoreJSONStructure === void 0 && (this.options.ignoreJSONStructure = !0);
539
- }
540
- addNamespaces(e) {
541
- this.options.ns.indexOf(e) < 0 && this.options.ns.push(e);
542
- }
543
- removeNamespaces(e) {
544
- let t = this.options.ns.indexOf(e);
545
- t > -1 && this.options.ns.splice(t, 1);
546
- }
547
- getResource(e, t, n, r = {}) {
548
- let i = r.keySeparator === void 0 ? this.options.keySeparator : r.keySeparator, a = r.ignoreJSONStructure === void 0 ? this.options.ignoreJSONStructure : r.ignoreJSONStructure, o;
549
- e.indexOf(".") > -1 ? o = e.split(".") : (o = [e, t], n && (Array.isArray(n) ? o.push(...n) : j(n) && i ? o.push(...n.split(i)) : o.push(n)));
550
- let s = P(this.data, o);
551
- return !s && !t && !n && e.indexOf(".") > -1 && (e = o[0], t = o[1], n = o.slice(2).join(".")), s || !a || !j(n) ? s : I(this.data?.[e]?.[t], n, i);
552
- }
553
- addResource(e, t, n, r, i = { silent: !1 }) {
554
- let a = i.keySeparator === void 0 ? this.options.keySeparator : i.keySeparator, o = [e, t];
555
- n && (o = o.concat(a ? n.split(a) : n)), e.indexOf(".") > -1 && (o = e.split("."), r = t, t = o[1]), this.addNamespaces(t), ge(this.data, o, r), i.silent || this.emit("added", e, t, n, r);
556
- }
557
- addResources(e, t, n, r = { silent: !1 }) {
558
- for (let r in n) (j(n[r]) || Array.isArray(n[r])) && this.addResource(e, t, r, n[r], { silent: !0 });
559
- r.silent || this.emit("added", e, t, n);
560
- }
561
- addResourceBundle(e, t, n, r, i, a = {
562
- silent: !1,
563
- skipCopy: !1
564
- }) {
565
- let o = [e, t];
566
- e.indexOf(".") > -1 && (o = e.split("."), r = n, n = t, t = o[1]), this.addNamespaces(t);
567
- let s = P(this.data, o) || {};
568
- a.skipCopy || (n = JSON.parse(JSON.stringify(n))), r ? ye(s, n, i) : s = {
569
- ...s,
570
- ...n
571
- }, ge(this.data, o, s), a.silent || this.emit("added", e, t, n);
572
- }
573
- removeResourceBundle(e, t) {
574
- this.hasResourceBundle(e, t) && delete this.data[e][t], this.removeNamespaces(t), this.emit("removed", e, t);
575
- }
576
- hasResourceBundle(e, t) {
577
- return this.getResource(e, t) !== void 0;
578
- }
579
- getResourceBundle(e, t) {
580
- return t ||= this.options.defaultNS, this.getResource(e, t);
581
- }
582
- getDataByLanguage(e) {
583
- return this.data[e];
584
- }
585
- hasLanguageSomeTranslations(e) {
586
- let t = this.getDataByLanguage(e);
587
- return !!(t && Object.keys(t) || []).find((e) => t[e] && Object.keys(t[e]).length > 0);
588
- }
589
- toJSON() {
590
- return this.data;
591
- }
592
- }, Oe = {
593
- processors: {},
594
- addPostProcessor(e) {
595
- this.processors[e.name] = e;
596
- },
597
- handle(e, t, n, r, i) {
598
- return e.forEach((e) => {
599
- t = this.processors[e]?.process(t, n, r, i) ?? t;
600
- }), t;
601
- }
602
- }, ke = Symbol("i18next/PATH_KEY");
603
- function Ae() {
604
- let e = [], t = Object.create(null), n;
605
- return t.get = (r, i) => (n?.revoke?.(), i === ke ? e : (e.push(i), n = Proxy.revocable(r, t), n.proxy)), Proxy.revocable(Object.create(null), t).proxy;
606
- }
607
- function B(e, t) {
608
- let { [ke]: n } = e(Ae()), r = t?.keySeparator ?? ".", i = t?.nsSeparator ?? ":";
609
- if (n.length > 1 && i) {
610
- let e = t?.ns, a = Array.isArray(e) ? e : null;
611
- if (a && a.length > 1 && a.slice(1).includes(n[0])) return `${n[0]}${i}${n.slice(1).join(r)}`;
612
- }
613
- return n.join(r);
614
- }
615
- var je = {}, V = (e) => !j(e) && typeof e != "boolean" && typeof e != "number", Me = class e extends z {
616
- constructor(e, t = {}) {
617
- super(), fe([
618
- "resourceStore",
619
- "languageUtils",
620
- "pluralResolver",
621
- "interpolator",
622
- "backendConnector",
623
- "i18nFormat",
624
- "utils"
625
- ], e, this), this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.logger = R.create("translator");
626
- }
627
- changeLanguage(e) {
628
- e && (this.language = e);
629
- }
630
- exists(e, t = { interpolation: {} }) {
631
- let n = { ...t };
632
- if (e == null) return !1;
633
- let r = this.resolve(e, n);
634
- if (r?.res === void 0) return !1;
635
- let i = V(r.res);
636
- return !(n.returnObjects === !1 && i);
637
- }
638
- extractFromKey(e, t) {
639
- let n = t.nsSeparator === void 0 ? this.options.nsSeparator : t.nsSeparator;
640
- n === void 0 && (n = ":");
641
- 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 && !Te(e, n, r);
642
- if (a && !o) {
643
- let t = e.match(this.interpolator.nestingRegexp);
644
- if (t && t.length > 0) return {
645
- key: e,
646
- namespaces: j(i) ? [i] : i
647
- };
648
- let a = e.split(n);
649
- (n !== r || n === r && this.options.ns.indexOf(a[0]) > -1) && (i = a.shift()), e = a.join(r);
650
- }
651
- return {
652
- key: e,
653
- namespaces: j(i) ? [i] : i
654
- };
655
- }
656
- translate(t, n, r) {
657
- let i = typeof n == "object" ? { ...n } : n;
658
- if (typeof i != "object" && this.options.overloadTranslationOptionHandler && (i = this.options.overloadTranslationOptionHandler(arguments)), typeof i == "object" && (i = { ...i }), i ||= {}, t == null) return "";
659
- typeof t == "function" && (t = B(t, {
660
- ...this.options,
661
- ...i
662
- })), Array.isArray(t) || (t = [String(t)]), t = t.map((e) => typeof e == "function" ? B(e, {
663
- ...this.options,
664
- ...i
665
- }) : String(e));
666
- 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;
667
- u === void 0 && (u = ":");
668
- let d = i.lng || this.language, f = i.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;
669
- if (d?.toLowerCase() === "cimode") return f ? a ? {
670
- res: `${l}${u}${s}`,
671
- usedKey: s,
672
- exactUsedKey: s,
673
- usedLng: d,
674
- usedNS: l,
675
- usedParams: this.getUsedParamsDetails(i)
676
- } : `${l}${u}${s}` : a ? {
677
- res: s,
678
- usedKey: s,
679
- exactUsedKey: s,
680
- usedLng: d,
681
- usedNS: l,
682
- usedParams: this.getUsedParamsDetails(i)
683
- } : s;
684
- let p = this.resolve(t, i), m = p?.res, h = p?.usedKey || s, g = p?.exactUsedKey || s, _ = [
685
- "[object Number]",
686
- "[object Function]",
687
- "[object RegExp]"
688
- ], v = i.joinArrays === void 0 ? this.options.joinArrays : i.joinArrays, y = !this.i18nFormat || this.i18nFormat.handleAsObject, b = i.count !== void 0 && !j(i.count), x = e.hasDefaultValue(i), S = b ? this.pluralResolver.getSuffix(d, i.count, i) : "", C = i.ordinal && b ? this.pluralResolver.getSuffix(d, i.count, { ordinal: !1 }) : "", w = b && !i.ordinal && i.count === 0, T = w && i[`defaultValue${this.options.pluralSeparator}zero`] || i[`defaultValue${S}`] || i[`defaultValue${C}`] || i.defaultValue, E = m;
689
- y && !m && x && (E = T);
690
- let ee = V(E), D = Object.prototype.toString.apply(E);
691
- if (y && E && ee && _.indexOf(D) < 0 && !(j(v) && Array.isArray(E))) {
692
- if (!i.returnObjects && !this.options.returnObjects) {
693
- this.options.returnedObjectHandler || this.logger.warn("accessing an object - but returnObjects options is not enabled!");
694
- let e = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(h, E, {
695
- ...i,
696
- ns: c
697
- }) : `key '${s} (${this.language})' returned an object instead of string.`;
698
- return a ? (p.res = e, p.usedParams = this.getUsedParamsDetails(i), p) : e;
699
- }
700
- if (o) {
701
- let e = Array.isArray(E), t = e ? [] : {}, n = e ? g : h;
702
- for (let e in E) if (Object.prototype.hasOwnProperty.call(E, e)) {
703
- let r = `${n}${o}${e}`;
704
- x && !m ? t[e] = this.translate(r, {
705
- ...i,
706
- defaultValue: V(T) ? T[e] : void 0,
707
- joinArrays: !1,
708
- ns: c
709
- }) : t[e] = this.translate(r, {
710
- ...i,
711
- joinArrays: !1,
712
- ns: c
713
- }), t[e] === r && (t[e] = E[e]);
714
- }
715
- m = t;
716
- }
717
- } else if (y && j(v) && Array.isArray(m)) m = m.join(v), m &&= this.extendTranslation(m, t, i, r);
718
- else {
719
- let e = !1, n = !1;
720
- !this.isValidLookup(m) && x && (e = !0, m = T), this.isValidLookup(m) || (n = !0, m = s);
721
- let a = (i.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && n ? void 0 : m, c = x && T !== m && this.options.updateMissing;
722
- if (n || e || c) {
723
- if (this.logger.log(c ? "updateKey" : "missingKey", d, l, s, c ? T : m), o) {
724
- let e = this.resolve(s, {
725
- ...i,
726
- keySeparator: !1
727
- });
728
- 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.");
729
- }
730
- let e = [], t = this.languageUtils.getFallbackCodes(this.options.fallbackLng, i.lng || this.language);
731
- if (this.options.saveMissingTo === "fallback" && t && t[0]) for (let n = 0; n < t.length; n++) e.push(t[n]);
732
- else this.options.saveMissingTo === "all" ? e = this.languageUtils.toResolveHierarchy(i.lng || this.language) : e.push(i.lng || this.language);
733
- let n = (e, t, n) => {
734
- let r = x && n !== m ? n : a;
735
- 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);
736
- };
737
- this.options.saveMissing && (this.options.saveMissingPlurals && b ? e.forEach((e) => {
738
- let t = this.pluralResolver.getSuffixes(e, i);
739
- w && i[`defaultValue${this.options.pluralSeparator}zero`] && t.indexOf(`${this.options.pluralSeparator}zero`) < 0 && t.push(`${this.options.pluralSeparator}zero`), t.forEach((t) => {
740
- n([e], s + t, i[`defaultValue${t}`] || T);
741
- });
742
- }) : n(e, s, T));
743
- }
744
- 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));
745
- }
746
- return a ? (p.res = m, p.usedParams = this.getUsedParamsDetails(i), p) : m;
747
- }
748
- extendTranslation(e, t, n, r, i) {
749
- if (this.i18nFormat?.parse) e = this.i18nFormat.parse(e, {
750
- ...this.options.interpolation.defaultVariables,
751
- ...n
752
- }, n.lng || this.language || r.usedLng, r.usedNS, r.usedKey, { resolved: r });
753
- else if (!n.skipInterpolation) {
754
- n.interpolation && this.interpolator.init({
755
- ...n,
756
- interpolation: {
757
- ...this.options.interpolation,
758
- ...n.interpolation
759
- }
760
- });
761
- let a = j(e) && (n?.interpolation?.skipOnVariables === void 0 ? this.options.interpolation.skipOnVariables : n.interpolation.skipOnVariables), o;
762
- if (a) {
763
- let t = e.match(this.interpolator.nestingRegexp);
764
- o = t && t.length;
765
- }
766
- let s = n.replace && !j(n.replace) ? n.replace : n;
767
- if (this.options.interpolation.defaultVariables && (s = {
768
- ...this.options.interpolation.defaultVariables,
769
- ...s
770
- }), e = this.interpolator.interpolate(e, s, n.lng || this.language || r.usedLng, n), a) {
771
- let t = e.match(this.interpolator.nestingRegexp), r = t && t.length;
772
- o < r && (n.nest = !1);
773
- }
774
- !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();
775
- }
776
- let a = n.postProcess || this.options.postProcess, o = j(a) ? [a] : a;
777
- return e != null && o?.length && n.applyPostProcessor !== !1 && (e = Oe.handle(o, e, t, this.options && this.options.postProcessPassResolved ? {
778
- i18nResolved: {
779
- ...r,
780
- usedParams: this.getUsedParamsDetails(n)
781
- },
782
- ...n
783
- } : n, this)), e;
784
- }
785
- resolve(e, t = {}) {
786
- let n, r, i, a, o;
787
- return j(e) && (e = [e]), Array.isArray(e) && (e = e.map((e) => typeof e == "function" ? B(e, {
788
- ...this.options,
789
- ...t
790
- }) : e)), e.forEach((e) => {
791
- if (this.isValidLookup(n)) return;
792
- let s = this.extractFromKey(e, t), c = s.key;
793
- r = c;
794
- let l = s.namespaces;
795
- this.options.fallbackNS && (l = l.concat(this.options.fallbackNS));
796
- let u = t.count !== void 0 && !j(t.count), d = u && !t.ordinal && t.count === 0, f = t.context !== void 0 && (j(t.context) || typeof t.context == "number") && t.context !== "", p = t.lngs ? t.lngs : this.languageUtils.toResolveHierarchy(t.lng || this.language, t.fallbackLng);
797
- l.forEach((e) => {
798
- this.isValidLookup(n) || (o = e, !je[`${p[0]}-${e}`] && this.utils?.hasLoadedNamespace && !this.utils?.hasLoadedNamespace(o) && (je[`${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) => {
799
- if (this.isValidLookup(n)) return;
800
- a = r;
801
- let o = [c];
802
- if (this.i18nFormat?.addLookupKeys) this.i18nFormat.addLookupKeys(o, c, r, e, t);
803
- else {
804
- let e;
805
- u && (e = this.pluralResolver.getSuffix(r, t.count, t));
806
- let n = `${this.options.pluralSeparator}zero`, i = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;
807
- 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) {
808
- let r = `${c}${this.options.contextSeparator || "_"}${t.context}`;
809
- 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));
810
- }
811
- }
812
- let s;
813
- for (; s = o.pop();) this.isValidLookup(n) || (i = s, n = this.getResource(r, e, s, t));
814
- }));
815
- });
816
- }), {
817
- res: n,
818
- usedKey: r,
819
- exactUsedKey: i,
820
- usedLng: a,
821
- usedNS: o
822
- };
823
- }
824
- isValidLookup(e) {
825
- return e !== void 0 && !(!this.options.returnNull && e === null) && !(!this.options.returnEmptyString && e === "");
826
- }
827
- getResource(e, t, n, r = {}) {
828
- return this.i18nFormat?.getResource ? this.i18nFormat.getResource(e, t, n, r) : this.resourceStore.getResource(e, t, n, r);
829
- }
830
- getUsedParamsDetails(e = {}) {
831
- let t = [
832
- "defaultValue",
833
- "ordinal",
834
- "context",
835
- "replace",
836
- "lng",
837
- "lngs",
838
- "fallbackLng",
839
- "ns",
840
- "keySeparator",
841
- "nsSeparator",
842
- "returnObjects",
843
- "returnDetails",
844
- "joinArrays",
845
- "postProcess",
846
- "interpolation"
847
- ], n = e.replace && !j(e.replace), r = n ? e.replace : e;
848
- if (n && e.count !== void 0 && (r.count = e.count), this.options.interpolation.defaultVariables && (r = {
849
- ...this.options.interpolation.defaultVariables,
850
- ...r
851
- }), !n) {
852
- r = { ...r };
853
- for (let e of t) delete r[e];
854
- }
855
- return r;
856
- }
857
- static hasDefaultValue(e) {
858
- for (let t in e) if (Object.prototype.hasOwnProperty.call(e, t) && t.substring(0, 12) === "defaultValue" && e[t] !== void 0) return !0;
859
- return !1;
860
- }
861
- }, Ne = class {
862
- constructor(e) {
863
- this.options = e, this.supportedLngs = this.options.supportedLngs || !1, this.logger = R.create("languageUtils");
864
- }
865
- getScriptPartFromCode(e) {
866
- if (e = L(e), !e || e.indexOf("-") < 0) return null;
867
- let t = e.split("-");
868
- return t.length === 2 || (t.pop(), t[t.length - 1].toLowerCase() === "x") ? null : this.formatLanguageCode(t.join("-"));
869
- }
870
- getLanguagePartFromCode(e) {
871
- if (e = L(e), !e || e.indexOf("-") < 0) return e;
872
- let t = e.split("-");
873
- return this.formatLanguageCode(t[0]);
874
- }
875
- formatLanguageCode(e) {
876
- if (j(e) && e.indexOf("-") > -1) {
877
- let t;
878
- try {
879
- t = Intl.getCanonicalLocales(e)[0];
880
- } catch {}
881
- return t && this.options.lowerCaseLng && (t = t.toLowerCase()), t || (this.options.lowerCaseLng ? e.toLowerCase() : e);
882
- }
883
- return this.options.cleanCode || this.options.lowerCaseLng ? e.toLowerCase() : e;
884
- }
885
- isSupportedCode(e) {
886
- return (this.options.load === "languageOnly" || this.options.nonExplicitSupportedLngs) && (e = this.getLanguagePartFromCode(e)), !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.indexOf(e) > -1;
887
- }
888
- getBestMatchFromCodes(e) {
889
- if (!e) return null;
890
- let t;
891
- return e.forEach((e) => {
892
- if (t) return;
893
- let n = this.formatLanguageCode(e);
894
- (!this.options.supportedLngs || this.isSupportedCode(n)) && (t = n);
895
- }), !t && this.options.supportedLngs && e.forEach((e) => {
896
- if (t) return;
897
- let n = this.getScriptPartFromCode(e);
898
- if (this.isSupportedCode(n)) return t = n;
899
- let r = this.getLanguagePartFromCode(e);
900
- if (this.isSupportedCode(r)) return t = r;
901
- t = this.options.supportedLngs.find((e) => {
902
- 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;
903
- });
904
- }), t ||= this.getFallbackCodes(this.options.fallbackLng)[0], t;
905
- }
906
- getFallbackCodes(e, t) {
907
- if (!e) return [];
908
- if (typeof e == "function" && (e = e(t)), j(e) && (e = [e]), Array.isArray(e)) return e;
909
- if (!t) return e.default || [];
910
- let n = e[t];
911
- return n ||= e[this.getScriptPartFromCode(t)], n ||= e[this.formatLanguageCode(t)], n ||= e[this.getLanguagePartFromCode(t)], n ||= e.default, n || [];
912
- }
913
- toResolveHierarchy(e, t) {
914
- let n = this.getFallbackCodes((t === !1 ? [] : t) || this.options.fallbackLng || [], e), r = [], i = (e) => {
915
- e && (this.isSupportedCode(e) ? r.push(e) : this.logger.warn(`rejecting language code not found in supportedLngs: ${e}`));
916
- };
917
- return j(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))) : j(e) && i(this.formatLanguageCode(e)), n.forEach((e) => {
918
- r.indexOf(e) < 0 && i(this.formatLanguageCode(e));
919
- }), r;
920
- }
921
- }, Pe = {
922
- zero: 0,
923
- one: 1,
924
- two: 2,
925
- few: 3,
926
- many: 4,
927
- other: 5
928
- }, Fe = {
929
- select: (e) => e === 1 ? "one" : "other",
930
- resolvedOptions: () => ({ pluralCategories: ["one", "other"] })
931
- }, Ie = class {
932
- constructor(e, t = {}) {
933
- this.languageUtils = e, this.options = t, this.logger = R.create("pluralResolver"), this.pluralRulesCache = {};
934
- }
935
- clearCache() {
936
- this.pluralRulesCache = {};
937
- }
938
- getRule(e, t = {}) {
939
- let n = L(e === "dev" ? "en" : e), r = t.ordinal ? "ordinal" : "cardinal", i = JSON.stringify({
940
- cleanedCode: n,
941
- type: r
942
- });
943
- if (i in this.pluralRulesCache) return this.pluralRulesCache[i];
944
- let a;
945
- try {
946
- a = new Intl.PluralRules(n, { type: r });
947
- } catch {
948
- if (typeof Intl > "u") return this.logger.error("No Intl support, please use an Intl polyfill!"), Fe;
949
- if (!e.match(/-|_/)) return Fe;
950
- let n = this.languageUtils.getLanguagePartFromCode(e);
951
- a = this.getRule(n, t);
952
- }
953
- return this.pluralRulesCache[i] = a, a;
954
- }
955
- needsPlural(e, t = {}) {
956
- let n = this.getRule(e, t);
957
- return n ||= this.getRule("dev", t), n?.resolvedOptions().pluralCategories.length > 1;
958
- }
959
- getPluralFormsOfKey(e, t, n = {}) {
960
- return this.getSuffixes(e, n).map((e) => `${t}${e}`);
961
- }
962
- getSuffixes(e, t = {}) {
963
- let n = this.getRule(e, t);
964
- return n ||= this.getRule("dev", t), n ? n.resolvedOptions().pluralCategories.sort((e, t) => Pe[e] - Pe[t]).map((e) => `${this.options.prepend}${t.ordinal ? `ordinal${this.options.prepend}` : ""}${e}`) : [];
965
- }
966
- getSuffix(e, t, n = {}) {
967
- let r = this.getRule(e, n);
968
- 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));
969
- }
970
- }, Le = (e, t, n, r = ".", i = !0) => {
971
- let a = ve(e, t, n);
972
- return !a && i && j(n) && (a = I(e, n, r), a === void 0 && (a = I(t, n, r))), a;
973
- }, H = (e) => e.replace(/\$/g, "$$$$"), Re = class {
974
- constructor(e = {}) {
975
- this.logger = R.create("interpolator"), this.options = e, this.format = e?.interpolation?.format || ((e) => e), this.init(e);
976
- }
977
- init(e = {}) {
978
- e.interpolation ||= { escapeValue: !0 };
979
- 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;
980
- this.escape = t === void 0 ? xe : t, this.escapeValue = n === void 0 ? !0 : n, this.useRawValueToEscape = r === void 0 ? !1 : r, this.prefix = i ? F(i) : a || "{{", this.suffix = o ? F(o) : s || "}}", this.formatSeparator = c || ",", this.unescapePrefix = l ? "" : u || "-", this.unescapeSuffix = this.unescapePrefix ? "" : l || "", this.nestingPrefix = d ? F(d) : f || F("$t("), this.nestingSuffix = p ? F(p) : m || F(")"), this.nestingOptionsSeparator = h || ",", this.maxReplaces = g || 1e3, this.alwaysFormat = _ === void 0 ? !1 : _, this.resetRegExp();
981
- }
982
- reset() {
983
- this.options && this.init(this.options);
984
- }
985
- resetRegExp() {
986
- let e = (e, t) => e?.source === t ? (e.lastIndex = 0, e) : new RegExp(t, "g");
987
- 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}`);
988
- }
989
- interpolate(e, t, n, r) {
990
- let i, a, o, s = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {}, c = (e) => {
991
- if (e.indexOf(this.formatSeparator) < 0) {
992
- let i = Le(t, s, e, this.options.keySeparator, this.options.ignoreJSONStructure);
993
- return this.alwaysFormat ? this.format(i, void 0, n, {
994
- ...r,
995
- ...t,
996
- interpolationkey: e
997
- }) : i;
998
- }
999
- let i = e.split(this.formatSeparator), a = i.shift().trim(), o = i.join(this.formatSeparator).trim();
1000
- return this.format(Le(t, s, a, this.options.keySeparator, this.options.ignoreJSONStructure), o, n, {
1001
- ...r,
1002
- ...t,
1003
- interpolationkey: a
1004
- });
1005
- };
1006
- this.resetRegExp();
1007
- let l = r?.missingInterpolationHandler || this.options.missingInterpolationHandler, u = r?.interpolation?.skipOnVariables === void 0 ? this.options.interpolation.skipOnVariables : r.interpolation.skipOnVariables;
1008
- return [{
1009
- regex: this.regexpUnescape,
1010
- safeValue: (e) => H(e)
1011
- }, {
1012
- regex: this.regexp,
1013
- safeValue: (e) => this.escapeValue ? H(this.escape(e)) : H(e)
1014
- }].forEach((t) => {
1015
- for (o = 0; i = t.regex.exec(e);) {
1016
- let n = i[1].trim();
1017
- if (a = c(n), a === void 0) if (typeof l == "function") {
1018
- let t = l(e, i, r);
1019
- a = j(t) ? t : "";
1020
- } else if (r && Object.prototype.hasOwnProperty.call(r, n)) a = "";
1021
- else if (u) {
1022
- a = i[0];
1023
- continue;
1024
- } else this.logger.warn(`missed to pass in variable ${n} for interpolating ${e}`), a = "";
1025
- else !j(a) && !this.useRawValueToEscape && (a = de(a));
1026
- let s = t.safeValue(a);
1027
- 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;
1028
- }
1029
- }), e;
1030
- }
1031
- nest(e, t, n = {}) {
1032
- let r, i, a, o = (e, t) => {
1033
- let n = this.nestingOptionsSeparator;
1034
- if (e.indexOf(n) < 0) return e;
1035
- let r = e.split(RegExp(`${F(n)}[ ]*{`)), i = `{${r[1]}`;
1036
- e = r[0], i = this.interpolate(i, a);
1037
- let o = i.match(/'/g), s = i.match(/"/g);
1038
- ((o?.length ?? 0) % 2 == 0 && !s || (s?.length ?? 0) % 2 != 0) && (i = i.replace(/'/g, "\""));
1039
- try {
1040
- a = JSON.parse(i), t && (a = {
1041
- ...t,
1042
- ...a
1043
- });
1044
- } catch (t) {
1045
- return this.logger.warn(`failed parsing options string in nesting for key ${e}`, t), `${e}${n}${i}`;
1046
- }
1047
- return a.defaultValue && a.defaultValue.indexOf(this.prefix) > -1 && delete a.defaultValue, e;
1048
- };
1049
- for (; r = this.nestingRegexp.exec(e);) {
1050
- let s = [];
1051
- a = { ...n }, a = a.replace && !j(a.replace) ? a.replace : a, a.applyPostProcessor = !1, delete a.defaultValue;
1052
- let c = /{.*}/.test(r[1]) ? r[1].lastIndexOf("}") + 1 : r[1].indexOf(this.formatSeparator);
1053
- 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 && !j(i)) return i;
1054
- j(i) || (i = de(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, {
1055
- ...n,
1056
- interpolationkey: r[1].trim()
1057
- }), i.trim())), e = e.replace(r[0], i), this.regexp.lastIndex = 0;
1058
- }
1059
- return e;
1060
- }
1061
- }, ze = (e) => {
1062
- let t = e.toLowerCase().trim(), n = {};
1063
- if (e.indexOf("(") > -1) {
1064
- let r = e.split("(");
1065
- t = r[0].toLowerCase().trim();
1066
- let i = r[1].substring(0, r[1].length - 1);
1067
- t === "currency" && i.indexOf(":") < 0 ? n.currency ||= i.trim() : t === "relativetime" && i.indexOf(":") < 0 ? n.range ||= i.trim() : i.split(";").forEach((e) => {
1068
- if (e) {
1069
- let [t, ...r] = e.split(":"), i = r.join(":").trim().replace(/^'+|'+$/g, ""), a = t.trim();
1070
- n[a] || (n[a] = i), i === "false" && (n[a] = !1), i === "true" && (n[a] = !0), isNaN(i) || (n[a] = parseInt(i, 10));
1071
- }
1072
- });
1073
- }
1074
- return {
1075
- formatName: t,
1076
- formatOptions: n
1077
- };
1078
- }, Be = (e) => {
1079
- let t = {};
1080
- return (n, r, i) => {
1081
- let a = i;
1082
- i && i.interpolationkey && i.formatParams && i.formatParams[i.interpolationkey] && i[i.interpolationkey] && (a = {
1083
- ...a,
1084
- [i.interpolationkey]: void 0
1085
- });
1086
- let o = r + JSON.stringify(a), s = t[o];
1087
- return s || (s = e(L(r), i), t[o] = s), s(n);
1088
- };
1089
- }, Ve = (e) => (t, n, r) => e(L(n), r)(t), He = class {
1090
- constructor(e = {}) {
1091
- this.logger = R.create("formatter"), this.options = e, this.init(e);
1092
- }
1093
- init(e, t = { interpolation: {} }) {
1094
- this.formatSeparator = t.interpolation.formatSeparator || ",";
1095
- let n = t.cacheInBuiltFormats ? Be : Ve;
1096
- this.formats = {
1097
- number: n((e, t) => {
1098
- let n = new Intl.NumberFormat(e, { ...t });
1099
- return (e) => n.format(e);
1100
- }),
1101
- currency: n((e, t) => {
1102
- let n = new Intl.NumberFormat(e, {
1103
- ...t,
1104
- style: "currency"
1105
- });
1106
- return (e) => n.format(e);
1107
- }),
1108
- datetime: n((e, t) => {
1109
- let n = new Intl.DateTimeFormat(e, { ...t });
1110
- return (e) => n.format(e);
1111
- }),
1112
- relativetime: n((e, t) => {
1113
- let n = new Intl.RelativeTimeFormat(e, { ...t });
1114
- return (e) => n.format(e, t.range || "day");
1115
- }),
1116
- list: n((e, t) => {
1117
- let n = new Intl.ListFormat(e, { ...t });
1118
- return (e) => n.format(e);
1119
- })
1120
- };
1121
- }
1122
- add(e, t) {
1123
- this.formats[e.toLowerCase().trim()] = t;
1124
- }
1125
- addCached(e, t) {
1126
- this.formats[e.toLowerCase().trim()] = Be(t);
1127
- }
1128
- format(e, t, n, r = {}) {
1129
- let i = t.split(this.formatSeparator);
1130
- if (i.length > 1 && i[0].indexOf("(") > 1 && i[0].indexOf(")") < 0 && i.find((e) => e.indexOf(")") > -1)) {
1131
- let e = i.findIndex((e) => e.indexOf(")") > -1);
1132
- i[0] = [i[0], ...i.splice(1, e)].join(this.formatSeparator);
1133
- }
1134
- return i.reduce((e, t) => {
1135
- let { formatName: i, formatOptions: a } = ze(t);
1136
- if (this.formats[i]) {
1137
- let t = e;
1138
- try {
1139
- let o = r?.formatParams?.[r.interpolationkey] || {}, s = o.locale || o.lng || r.locale || r.lng || n;
1140
- t = this.formats[i](e, s, {
1141
- ...a,
1142
- ...r,
1143
- ...o
1144
- });
1145
- } catch (e) {
1146
- this.logger.warn(e);
1147
- }
1148
- return t;
1149
- } else this.logger.warn(`there was no format function for ${i}`);
1150
- return e;
1151
- }, e);
1152
- }
1153
- }, Ue = (e, t) => {
1154
- e.pending[t] !== void 0 && (delete e.pending[t], e.pendingCount--);
1155
- }, We = class extends z {
1156
- constructor(e, t, n, r = {}) {
1157
- super(), this.backend = e, this.store = t, this.services = n, this.languageUtils = n.languageUtils, this.options = r, this.logger = R.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);
1158
- }
1159
- queueLoad(e, t, n, r) {
1160
- let i = {}, a = {}, o = {}, s = {};
1161
- return e.forEach((e) => {
1162
- let r = !0;
1163
- t.forEach((t) => {
1164
- let o = `${e}|${t}`;
1165
- !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)));
1166
- }), r || (o[e] = !0);
1167
- }), (Object.keys(i).length || Object.keys(a).length) && this.queue.push({
1168
- pending: a,
1169
- pendingCount: Object.keys(a).length,
1170
- loaded: {},
1171
- errors: [],
1172
- callback: r
1173
- }), {
1174
- toLoad: Object.keys(i),
1175
- pending: Object.keys(a),
1176
- toLoadLanguages: Object.keys(o),
1177
- toLoadNamespaces: Object.keys(s)
1178
- };
1179
- }
1180
- loaded(e, t, n) {
1181
- let r = e.split("|"), i = r[0], a = r[1];
1182
- 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);
1183
- let o = {};
1184
- this.queue.forEach((n) => {
1185
- _e(n.loaded, [i], a), Ue(n, e), t && n.errors.push(t), n.pendingCount === 0 && !n.done && (Object.keys(n.loaded).forEach((e) => {
1186
- o[e] || (o[e] = {});
1187
- let t = n.loaded[e];
1188
- t.length && t.forEach((t) => {
1189
- o[e][t] === void 0 && (o[e][t] = !0);
1190
- });
1191
- }), n.done = !0, n.errors.length ? n.callback(n.errors) : n.callback());
1192
- }), this.emit("loaded", o), this.queue = this.queue.filter((e) => !e.done);
1193
- }
1194
- read(e, t, n, r = 0, i = this.retryTimeout, a) {
1195
- if (!e.length) return a(null, {});
1196
- if (this.readingCalls >= this.maxParallelReads) {
1197
- this.waitingReads.push({
1198
- lng: e,
1199
- ns: t,
1200
- fcName: n,
1201
- tried: r,
1202
- wait: i,
1203
- callback: a
1204
- });
1205
- return;
1206
- }
1207
- this.readingCalls++;
1208
- let o = (o, s) => {
1209
- if (this.readingCalls--, this.waitingReads.length > 0) {
1210
- let e = this.waitingReads.shift();
1211
- this.read(e.lng, e.ns, e.fcName, e.tried, e.wait, e.callback);
1212
- }
1213
- if (o && s && r < this.maxRetries) {
1214
- setTimeout(() => {
1215
- this.read.call(this, e, t, n, r + 1, i * 2, a);
1216
- }, i);
1217
- return;
1218
- }
1219
- a(o, s);
1220
- }, s = this.backend[n].bind(this.backend);
1221
- if (s.length === 2) {
1222
- try {
1223
- let n = s(e, t);
1224
- n && typeof n.then == "function" ? n.then((e) => o(null, e)).catch(o) : o(null, n);
1225
- } catch (e) {
1226
- o(e);
1227
- }
1228
- return;
1229
- }
1230
- return s(e, t, o);
1231
- }
1232
- prepareLoading(e, t, n = {}, r) {
1233
- if (!this.backend) return this.logger.warn("No backend was added via i18next.use. Will not load resources."), r && r();
1234
- j(e) && (e = this.languageUtils.toResolveHierarchy(e)), j(t) && (t = [t]);
1235
- let i = this.queueLoad(e, t, n, r);
1236
- if (!i.toLoad.length) return i.pending.length || r(), null;
1237
- i.toLoad.forEach((e) => {
1238
- this.loadOne(e);
1239
- });
1240
- }
1241
- load(e, t, n) {
1242
- this.prepareLoading(e, t, {}, n);
1243
- }
1244
- reload(e, t, n) {
1245
- this.prepareLoading(e, t, { reload: !0 }, n);
1246
- }
1247
- loadOne(e, t = "") {
1248
- let n = e.split("|"), r = n[0], i = n[1];
1249
- this.read(r, i, "read", void 0, void 0, (n, a) => {
1250
- 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);
1251
- });
1252
- }
1253
- saveMissing(e, t, n, r, i, a = {}, o = () => {}) {
1254
- if (this.services?.utils?.hasLoadedNamespace && !this.services?.utils?.hasLoadedNamespace(t)) {
1255
- 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!!!");
1256
- return;
1257
- }
1258
- if (!(n == null || n === "")) {
1259
- if (this.backend?.create) {
1260
- let s = {
1261
- ...a,
1262
- isUpdate: i
1263
- }, c = this.backend.create.bind(this.backend);
1264
- if (c.length < 6) try {
1265
- let i;
1266
- 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);
1267
- } catch (e) {
1268
- o(e);
1269
- }
1270
- else c(e, t, n, r, o, s);
1271
- }
1272
- !e || !e[0] || this.store.addResource(e[0], t, n, r);
1273
- }
1274
- }
1275
- }, Ge = () => ({
1276
- debug: !1,
1277
- initAsync: !0,
1278
- ns: ["translation"],
1279
- defaultNS: ["translation"],
1280
- fallbackLng: ["dev"],
1281
- fallbackNS: !1,
1282
- supportedLngs: !1,
1283
- nonExplicitSupportedLngs: !1,
1284
- load: "all",
1285
- preload: !1,
1286
- simplifyPluralSuffix: !0,
1287
- keySeparator: ".",
1288
- nsSeparator: ":",
1289
- pluralSeparator: "_",
1290
- contextSeparator: "_",
1291
- partialBundledLanguages: !1,
1292
- saveMissing: !1,
1293
- updateMissing: !1,
1294
- saveMissingTo: "fallback",
1295
- saveMissingPlurals: !0,
1296
- missingKeyHandler: !1,
1297
- missingInterpolationHandler: !1,
1298
- postProcess: !1,
1299
- postProcessPassResolved: !1,
1300
- returnNull: !1,
1301
- returnEmptyString: !0,
1302
- returnObjects: !1,
1303
- joinArrays: !1,
1304
- returnedObjectHandler: !1,
1305
- parseMissingKeyHandler: !1,
1306
- appendNamespaceToMissingKey: !1,
1307
- appendNamespaceToCIMode: !1,
1308
- overloadTranslationOptionHandler: (e) => {
1309
- let t = {};
1310
- if (typeof e[1] == "object" && (t = e[1]), j(e[1]) && (t.defaultValue = e[1]), j(e[2]) && (t.tDescription = e[2]), typeof e[2] == "object" || typeof e[3] == "object") {
1311
- let n = e[3] || e[2];
1312
- Object.keys(n).forEach((e) => {
1313
- t[e] = n[e];
1314
- });
1315
- }
1316
- return t;
1317
- },
1318
- interpolation: {
1319
- escapeValue: !0,
1320
- format: (e) => e,
1321
- prefix: "{{",
1322
- suffix: "}}",
1323
- formatSeparator: ",",
1324
- unescapePrefix: "-",
1325
- nestingPrefix: "$t(",
1326
- nestingSuffix: ")",
1327
- nestingOptionsSeparator: ",",
1328
- maxReplaces: 1e3,
1329
- skipOnVariables: !0
1330
- },
1331
- cacheInBuiltFormats: !0
1332
- }), Ke = (e) => (j(e.ns) && (e.ns = [e.ns]), j(e.fallbackLng) && (e.fallbackLng = [e.fallbackLng]), j(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), U = () => {}, qe = (e) => {
1333
- Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach((t) => {
1334
- typeof e[t] == "function" && (e[t] = e[t].bind(e));
1335
- });
1336
- }, Je = "__i18next_supportNoticeShown", Ye = () => !!(typeof globalThis < "u" && globalThis[Je] || typeof process < "u" && process.env && process.env.I18NEXT_NO_SUPPORT_NOTICE || typeof process < "u" && process.env), Xe = () => {
1337
- typeof globalThis < "u" && (globalThis[Je] = !0);
1338
- }, Ze = (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)), W = class e extends z {
1339
- constructor(e = {}, t) {
1340
- if (super(), this.options = Ke(e), this.services = {}, this.logger = R, this.modules = { external: [] }, qe(this), t && !this.isInitialized && !e.isClone) {
1341
- if (!this.options.initAsync) return this.init(e, t), this;
1342
- setTimeout(() => {
1343
- this.init(e, t);
1344
- }, 0);
1345
- }
1346
- }
1347
- init(e = {}, t) {
1348
- this.isInitializing = !0, typeof e == "function" && (t = e, e = {}), e.defaultNS == null && e.ns && (j(e.ns) ? e.defaultNS = e.ns : e.ns.indexOf("translation") < 0 && (e.defaultNS = e.ns[0]));
1349
- let n = Ge();
1350
- this.options = {
1351
- ...n,
1352
- ...this.options,
1353
- ...Ke(e)
1354
- }, this.options.interpolation = {
1355
- ...n.interpolation,
1356
- ...this.options.interpolation
1357
- }, 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 && !Ze(this) && !Ye() && (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 💙"), Xe());
1358
- let r = (e) => e ? typeof e == "function" ? new e() : e : null;
1359
- if (!this.options.isClone) {
1360
- this.modules.logger ? R.init(r(this.modules.logger), this.options) : R.init(null, this.options);
1361
- let e;
1362
- e = this.modules.formatter ? this.modules.formatter : He;
1363
- let t = new Ne(this.options);
1364
- this.store = new De(this.options.resources, this.options);
1365
- let i = this.services;
1366
- i.logger = R, i.resourceStore = this.store, i.languageUtils = t, i.pluralResolver = new Ie(t, {
1367
- prepend: this.options.pluralSeparator,
1368
- simplifyPluralSuffix: this.options.simplifyPluralSuffix
1369
- }), 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 Re(this.options), i.utils = { hasLoadedNamespace: this.hasLoadedNamespace.bind(this) }, i.backendConnector = new We(r(this.modules.backend), i.resourceStore, i, this.options), i.backendConnector.on("*", (e, ...t) => {
1370
- this.emit(e, ...t);
1371
- }), 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 Me(this.services, this.options), this.translator.on("*", (e, ...t) => {
1372
- this.emit(e, ...t);
1373
- }), this.modules.external.forEach((e) => {
1374
- e.init && e.init(this);
1375
- });
1376
- }
1377
- if (this.format = this.options.interpolation.format, t ||= U, this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) {
1378
- let e = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
1379
- e.length > 0 && e[0] !== "dev" && (this.options.lng = e[0]);
1380
- }
1381
- !this.services.languageDetector && !this.options.lng && this.logger.warn("init: no languageDetector is used and no lng is defined"), [
1382
- "getResource",
1383
- "hasResourceBundle",
1384
- "getResourceBundle",
1385
- "getDataByLanguage"
1386
- ].forEach((e) => {
1387
- this[e] = (...t) => this.store[e](...t);
1388
- }), [
1389
- "addResource",
1390
- "addResources",
1391
- "addResourceBundle",
1392
- "removeResourceBundle"
1393
- ].forEach((e) => {
1394
- this[e] = (...t) => (this.store[e](...t), this);
1395
- });
1396
- let i = M(), a = () => {
1397
- let e = (e, n) => {
1398
- 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);
1399
- };
1400
- if (this.languages && !this.isInitialized) return e(null, this.t.bind(this));
1401
- this.changeLanguage(this.options.lng, e);
1402
- };
1403
- return this.options.resources || !this.options.initAsync ? a() : setTimeout(a, 0), i;
1404
- }
1405
- loadResources(e, t = U) {
1406
- let n = t, r = j(e) ? e : this.language;
1407
- if (typeof e == "function" && (n = e), !this.options.resources || this.options.partialBundledLanguages) {
1408
- if (r?.toLowerCase() === "cimode" && (!this.options.preload || this.options.preload.length === 0)) return n();
1409
- let e = [], t = (t) => {
1410
- t && t !== "cimode" && this.services.languageUtils.toResolveHierarchy(t).forEach((t) => {
1411
- t !== "cimode" && e.indexOf(t) < 0 && e.push(t);
1412
- });
1413
- };
1414
- 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) => {
1415
- !e && !this.resolvedLanguage && this.language && this.setResolvedLanguage(this.language), n(e);
1416
- });
1417
- } else n(null);
1418
- }
1419
- reloadResources(e, t, n) {
1420
- let r = M();
1421
- 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 ||= U, this.services.backendConnector.reload(e, t, (e) => {
1422
- r.resolve(), n(e);
1423
- }), r;
1424
- }
1425
- use(e) {
1426
- if (!e) throw Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");
1427
- if (!e.type) throw Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");
1428
- 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" && Oe.addPostProcessor(e), e.type === "formatter" && (this.modules.formatter = e), e.type === "3rdParty" && this.modules.external.push(e), this;
1429
- }
1430
- setResolvedLanguage(e) {
1431
- if (!(!e || !this.languages) && !(["cimode", "dev"].indexOf(e) > -1)) {
1432
- for (let e = 0; e < this.languages.length; e++) {
1433
- let t = this.languages[e];
1434
- if (!(["cimode", "dev"].indexOf(t) > -1) && this.store.hasLanguageSomeTranslations(t)) {
1435
- this.resolvedLanguage = t;
1436
- break;
1437
- }
1438
- }
1439
- !this.resolvedLanguage && this.languages.indexOf(e) < 0 && this.store.hasLanguageSomeTranslations(e) && (this.resolvedLanguage = e, this.languages.unshift(e));
1440
- }
1441
- }
1442
- changeLanguage(e, t) {
1443
- this.isLanguageChangingTo = e;
1444
- let n = M();
1445
- this.emit("languageChanging", e);
1446
- let r = (e) => {
1447
- this.language = e, this.languages = this.services.languageUtils.toResolveHierarchy(e), this.resolvedLanguage = void 0, this.setResolvedLanguage(e);
1448
- }, i = (i, a) => {
1449
- 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));
1450
- }, a = (t) => {
1451
- !e && !t && this.services.languageDetector && (t = []);
1452
- let n = j(t) ? t : t && t[0], a = this.store.hasLanguageSomeTranslations(n) ? n : this.services.languageUtils.getBestMatchFromCodes(j(t) ? [t] : t);
1453
- a && (this.language || r(a), this.translator.language || this.translator.changeLanguage(a), this.services.languageDetector?.cacheUserLanguage?.(a)), this.loadResources(a, (e) => {
1454
- i(e, a);
1455
- });
1456
- };
1457
- 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;
1458
- }
1459
- getFixedT(e, t, n) {
1460
- let r = (e, t, ...i) => {
1461
- let a;
1462
- 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);
1463
- let o = {
1464
- ...this.options,
1465
- ...a
1466
- };
1467
- typeof a.keyPrefix == "function" && (a.keyPrefix = B(a.keyPrefix, o));
1468
- let s = this.options.keySeparator || ".", c;
1469
- 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);
1470
- };
1471
- return j(e) ? r.lng = e : r.lngs = e, r.ns = t, r.keyPrefix = n, r;
1472
- }
1473
- t(...e) {
1474
- return this.translator?.translate(...e);
1475
- }
1476
- exists(...e) {
1477
- return this.translator?.exists(...e);
1478
- }
1479
- setDefaultNamespace(e) {
1480
- this.options.defaultNS = e;
1481
- }
1482
- hasLoadedNamespace(e, t = {}) {
1483
- if (!this.isInitialized) return this.logger.warn("hasLoadedNamespace: i18next was not initialized", this.languages), !1;
1484
- if (!this.languages || !this.languages.length) return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty", this.languages), !1;
1485
- let n = t.lng || this.resolvedLanguage || this.languages[0], r = this.options ? this.options.fallbackLng : !1, i = this.languages[this.languages.length - 1];
1486
- if (n.toLowerCase() === "cimode") return !0;
1487
- let a = (e, t) => {
1488
- let n = this.services.backendConnector.state[`${e}|${t}`];
1489
- return n === -1 || n === 0 || n === 2;
1490
- };
1491
- if (t.precheck) {
1492
- let e = t.precheck(this, a);
1493
- if (e !== void 0) return e;
1494
- }
1495
- return !!(this.hasResourceBundle(n, e) || !this.services.backendConnector.backend || this.options.resources && !this.options.partialBundledLanguages || a(n, e) && (!r || a(i, e)));
1496
- }
1497
- loadNamespaces(e, t) {
1498
- let n = M();
1499
- return this.options.ns ? (j(e) && (e = [e]), e.forEach((e) => {
1500
- this.options.ns.indexOf(e) < 0 && this.options.ns.push(e);
1501
- }), this.loadResources((e) => {
1502
- n.resolve(), t && t(e);
1503
- }), n) : (t && t(), Promise.resolve());
1504
- }
1505
- loadLanguages(e, t) {
1506
- let n = M();
1507
- j(e) && (e = [e]);
1508
- let r = this.options.preload || [], i = e.filter((e) => r.indexOf(e) < 0 && this.services.languageUtils.isSupportedCode(e));
1509
- return i.length ? (this.options.preload = r.concat(i), this.loadResources((e) => {
1510
- n.resolve(), t && t(e);
1511
- }), n) : (t && t(), Promise.resolve());
1512
- }
1513
- dir(e) {
1514
- if (e ||= this.resolvedLanguage || (this.languages?.length > 0 ? this.languages[0] : this.language), !e) return "rtl";
1515
- try {
1516
- let t = new Intl.Locale(e);
1517
- if (t && t.getTextInfo) {
1518
- let e = t.getTextInfo();
1519
- if (e && e.direction) return e.direction;
1520
- }
1521
- } catch {}
1522
- 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 Ne(Ge());
1523
- return e.toLowerCase().indexOf("-latn") > 1 ? "ltr" : t.indexOf(n.getLanguagePartFromCode(e)) > -1 || e.toLowerCase().indexOf("-arab") > 1 ? "rtl" : "ltr";
1524
- }
1525
- static createInstance(t = {}, n) {
1526
- let r = new e(t, n);
1527
- return r.createInstance = e.createInstance, r;
1528
- }
1529
- cloneInstance(t = {}, n = U) {
1530
- let r = t.forkResourceStore;
1531
- r && delete t.forkResourceStore;
1532
- let i = {
1533
- ...this.options,
1534
- ...t,
1535
- isClone: !0
1536
- }, a = new e(i);
1537
- if ((t.debug !== void 0 || t.prefix !== void 0) && (a.logger = a.logger.clone(t)), [
1538
- "store",
1539
- "services",
1540
- "language"
1541
- ].forEach((e) => {
1542
- a[e] = this[e];
1543
- }), a.services = { ...this.services }, a.services.utils = { hasLoadedNamespace: a.hasLoadedNamespace.bind(a) }, r && (a.store = new De(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) {
1544
- let e = {
1545
- ...Ge().interpolation,
1546
- ...this.options.interpolation,
1547
- ...t.interpolation
1548
- }, n = {
1549
- ...i,
1550
- interpolation: e
1551
- };
1552
- a.services.interpolator = new Re(n);
1553
- }
1554
- return a.translator = new Me(a.services, i), a.translator.on("*", (e, ...t) => {
1555
- a.emit(e, ...t);
1556
- }), a.init(i, n), a.translator.options = i, a.translator.backendConnector.services.utils = { hasLoadedNamespace: a.hasLoadedNamespace.bind(a) }, a;
1557
- }
1558
- toJSON() {
1559
- return {
1560
- options: this.options,
1561
- store: this.store,
1562
- language: this.language,
1563
- languages: this.languages,
1564
- resolvedLanguage: this.resolvedLanguage
1565
- };
1566
- }
1567
- }.createInstance();
1568
- //#endregion
1569
- //#region ../../lib-react/translator/dist/index.js
1570
- W.createInstance, W.dir, W.init, W.loadResources, W.reloadResources, W.use, W.changeLanguage, W.getFixedT, W.t, W.exists, W.setDefaultNamespace, W.hasLoadedNamespace, W.loadNamespaces, W.loadLanguages, W.init({
1571
- fallbackLng: "en",
1572
- lng: "en",
1573
- debug: !0,
1574
- resources: {
1575
- en: le,
1576
- es: ue
1577
- }
1578
- });
1579
- var Qe = {
1580
- translator: {
1581
- ...W,
1582
- t: (e, t) => {
1583
- let { lng: n } = t;
1584
- switch (n) {
1585
- case "en_US":
1586
- case "en-US":
1587
- t.lng = "en";
1588
- break;
1589
- case "es_ES":
1590
- case "es-ES":
1591
- case "es_MX":
1592
- case "es-MX":
1593
- t.lng = "es";
1594
- break;
1595
- default: break;
1596
- }
1597
- return W.t(e, {
1598
- lng: n,
1599
- ...t
1600
- });
1601
- }
1602
- },
1603
- languageOptions: [{
1604
- value: "en_US",
1605
- label: "English (US)"
1606
- }, {
1607
- value: "es_ES",
1608
- label: "Spanish"
1609
- }]
1610
- };
1611
- //#endregion
1612
- //#region ../../lib-react/correct-answer-toggle/dist/index.js
1613
- function G(e) {
1614
- return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
1615
- }
1616
- function $e(e, t) {
1617
- return !e || G(e) ? e : G(e.default) ? e.default : t && G(e[t]) ? e[t] : t && G(e[t]?.default) ? e[t].default : e;
1618
- }
1619
- var et = $e(g, "Readable") || $e(rt.Readable, "Readable"), tt = a, nt = tt.default, rt = nt && typeof nt == "object" ? nt : tt, { translator: K } = Qe, it = {
1620
- WebkitTouchCallout: "none",
1621
- WebkitUserSelect: "none",
1622
- KhtmlUserSelect: "none",
1623
- MozUserSelect: "none",
1624
- msUserSelect: "none",
1625
- userSelect: "none"
1626
- }, at = l("div")(() => ({
1627
- width: "100%",
1628
- cursor: "pointer"
1629
- })), ot = l("div")(() => ({
1630
- margin: "0 auto",
1631
- textAlign: "center",
1632
- display: "flex"
1633
- })), st = l("div")(() => ({
1634
- width: "fit-content",
1635
- minWidth: "140px",
1636
- alignSelf: "center",
1637
- verticalAlign: "middle",
1638
- color: `var(--correct-answer-toggle-label-color, ${c.text()})`,
1639
- fontWeight: "normal",
1640
- ...it
1641
- })), ct = l("div")(() => ({
1642
- position: "absolute",
1643
- width: "25px",
1644
- "&.enter": { opacity: "0" },
1645
- "&.enter-active": {
1646
- opacity: "1",
1647
- transition: "opacity 0.3s ease-in"
1648
- },
1649
- "&.exit": { opacity: "1" },
1650
- "&.exit-active": {
1651
- opacity: "0",
1652
- transition: "opacity 0.3s ease-in"
1653
- }
1654
- })), lt = l("div")(() => ({
1655
- width: "25px",
1656
- marginRight: "5px",
1657
- display: "flex",
1658
- alignItems: "center"
1659
- })), ut = class e extends C.Component {
1660
- static propTypes = {
1661
- onToggle: k.default.func,
1662
- toggled: k.default.bool,
1663
- show: k.default.bool,
1664
- hideMessage: k.default.string,
1665
- showMessage: k.default.string,
1666
- className: k.default.string,
1667
- language: k.default.string
1668
- };
1669
- static defaultProps = {
1670
- showMessage: "Show correct answer",
1671
- hideMessage: "Hide correct answer",
1672
- show: !1,
1673
- toggled: !1
1674
- };
1675
- constructor(t) {
1676
- super(t), this.state = { show: t.show }, this.openIconRef = C.createRef(), this.closedIconRef = C.createRef(), e.defaultProps = {
1677
- ...e.defaultProps,
1678
- showMessage: K.t("common:showCorrectAnswer", { lng: t.language }),
1679
- hideMessage: K.t("common:hideCorrectAnswer", { lng: t.language })
1680
- };
1681
- }
1682
- onClick() {
1683
- this.props.onToggle(!this.props.toggled);
1684
- }
1685
- onTouch(e) {
1686
- e.preventDefault(), this.props.onToggle(!this.props.toggled);
1687
- }
1688
- UNSAFE_componentWillReceiveProps(t) {
1689
- this.setState({ show: t.show }), t.language !== this.props?.language && (e.defaultProps = {
1690
- ...e.defaultProps,
1691
- showMessage: K.t("common:showCorrectAnswer", { lng: t.language }),
1692
- hideMessage: K.t("common:hideCorrectAnswer", { lng: t.language })
1693
- });
1694
- }
1695
- render() {
1696
- let { className: e, toggled: t, hideMessage: n, showMessage: r } = this.props;
1697
- return /* @__PURE__ */ D(at, {
1698
- className: e,
1699
- children: /* @__PURE__ */ D(ae, {
1700
- show: this.state.show,
1701
- children: /* @__PURE__ */ O(ot, {
1702
- onClick: this.onClick.bind(this),
1703
- onTouchEnd: this.onTouch.bind(this),
1704
- children: [/* @__PURE__ */ O(lt, { children: [/* @__PURE__ */ D(_, {
1705
- nodeRef: this.openIconRef,
1706
- timeout: 400,
1707
- in: t,
1708
- exit: !t,
1709
- classNames: {
1710
- enter: "enter",
1711
- enterActive: "enter-active",
1712
- exit: "exit",
1713
- exitActive: "exit-active"
1714
- },
1715
- children: /* @__PURE__ */ D(ct, {
1716
- ref: this.openIconRef,
1717
- children: /* @__PURE__ */ D(A, { open: t }, "correct-open")
1718
- })
1719
- }), /* @__PURE__ */ D(_, {
1720
- nodeRef: this.closedIconRef,
1721
- timeout: 5e3,
1722
- in: !t,
1723
- exit: t,
1724
- classNames: {
1725
- enter: "enter",
1726
- enterActive: "enter-active",
1727
- exit: "exit",
1728
- exitActive: "exit-active"
1729
- },
1730
- children: /* @__PURE__ */ D(ct, {
1731
- ref: this.closedIconRef,
1732
- children: /* @__PURE__ */ D(A, { open: t }, "correct-closed")
1733
- })
1734
- })] }), /* @__PURE__ */ D(et, {
1735
- false: !0,
1736
- children: /* @__PURE__ */ D(st, {
1737
- "aria-hidden": !this.state.show,
1738
- children: t ? n : r
1739
- })
1740
- })]
1741
- })
1742
- })
1743
- });
1744
- }
1745
- }, dt = /\{\{(\d+)\}\}/g, ft = (e, t) => e ? { markup: e.replace(dt, (e, n) => `<span data-component="${t}" data-id="${n}"></span>`) } : { markup: "" }, q = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), pt = /* @__PURE__ */ q(((e, t) => {
1746
- t.exports = {
1747
- "border-radius": 1,
1748
- "border-top-left-radius": 1,
1749
- "border-top-right-radius": 1,
1750
- "border-bottom-left-radius": 1,
1751
- "border-bottom-right-radius": 1,
1752
- "box-shadow": 1,
1753
- order: 1,
1754
- flex: function(e, t) {
1755
- return [t + "box-flex"];
1756
- },
1757
- "box-flex": 1,
1758
- "box-align": 1,
1759
- animation: 1,
1760
- "animation-duration": 1,
1761
- "animation-name": 1,
1762
- transition: 1,
1763
- "transition-duration": 1,
1764
- transform: 1,
1765
- "transform-style": 1,
1766
- "transform-origin": 1,
1767
- "backface-visibility": 1,
1768
- perspective: 1,
1769
- "box-pack": 1
1770
- };
1771
- }));
1772
- pt();
1773
- //#endregion
1774
- //#region ../../lib-react/mask-markup/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/cssUnitless.js
1775
- var mt = /* @__PURE__ */ q(((e, t) => {
1776
- t.exports = {
1777
- animation: 1,
1778
- "column-count": 1,
1779
- columns: 1,
1780
- "font-weight": 1,
1781
- opacity: 1,
1782
- "order ": 1,
1783
- "z-index": 1,
1784
- zoom: 1,
1785
- flex: 1,
1786
- "box-flex": 1,
1787
- transform: 1,
1788
- perspective: 1,
1789
- "box-pack": 1,
1790
- "box-align": 1,
1791
- colspan: 1,
1792
- rowspan: 1
1793
- };
1794
- }));
1795
- mt();
1796
- //#endregion
1797
- //#region ../../lib-react/mask-markup/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/toUpperFirst.js
1798
- var ht = /* @__PURE__ */ q(((e, t) => {
1799
- t.exports = function(e) {
1800
- return e.length ? e.charAt(0).toUpperCase() + e.substring(1) : e;
1801
- };
1802
- }));
1803
- ht();
1804
- //#endregion
1805
- //#region ../../lib-react/mask-markup/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/prefixInfo.js
1806
- var gt = /* @__PURE__ */ q(((e, t) => {
1807
- var n = ht(), r = /^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/, i = typeof document > "u" ? {} : document.documentElement.style;
1808
- t.exports = (function() {
1809
- var e = (function() {
1810
- for (var e in i) if (r.test(e)) return e.match(r)[0];
1811
- return "WebkitOpacity" in i ? "Webkit" : "KhtmlOpacity" in i ? "Khtml" : "";
1812
- })();
1813
- return {
1814
- style: e,
1815
- css: "-" + e.toLowerCase() + "-",
1816
- dom: {
1817
- Webkit: "WebKit",
1818
- ms: "MS",
1819
- o: "WebKit"
1820
- }[e] || n(e)
1821
- };
1822
- })();
1823
- }));
1824
- gt();
1825
- //#endregion
1826
- //#region ../../lib-react/mask-markup/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/hyphenRe.js
1827
- var _t = /* @__PURE__ */ q(((e, t) => {
1828
- t.exports = /[-\s]+(.)?/g;
1829
- }));
1830
- _t();
1831
- //#endregion
1832
- //#region ../../lib-react/mask-markup/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/camelize.js
1833
- var vt = /* @__PURE__ */ q(((e, t) => {
1834
- var n = function(e, t) {
1835
- return t ? t.toUpperCase() : "";
1836
- }, r = _t();
1837
- t.exports = function(e) {
1838
- return e ? e.replace(r, n) : "";
1839
- };
1840
- }));
1841
- vt();
1842
- //#endregion
1843
- //#region ../../lib-react/mask-markup/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/separate.js
1844
- var yt = /* @__PURE__ */ q(((e, t) => {
1845
- var n = /::/g, r = /([A-Z]+)([A-Z][a-z])/g, i = /([a-z\d])([A-Z])/g, a = /_/g;
1846
- t.exports = function(e, t) {
1847
- return e ? e.replace(n, "/").replace(r, "$1_$2").replace(i, "$1_$2").replace(a, t || "-") : "";
1848
- };
1849
- }));
1850
- yt();
1851
- //#endregion
1852
- //#region ../../lib-react/mask-markup/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/hyphenate.js
1853
- var bt = /* @__PURE__ */ q(((e, t) => {
1854
- var n = yt();
1855
- t.exports = function(e) {
1856
- return n(e).toLowerCase();
1857
- };
1858
- }));
1859
- bt();
1860
- //#endregion
1861
- //#region ../../lib-react/mask-markup/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/toLowerFirst.js
1862
- var xt = /* @__PURE__ */ q(((e, t) => {
1863
- t.exports = function(e) {
1864
- return e.length ? e.charAt(0).toLowerCase() + e.substring(1) : e;
1865
- };
1866
- }));
1867
- xt();
1868
- //#endregion
1869
- //#region ../../lib-react/mask-markup/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/prefixer.js
1870
- var St = /* @__PURE__ */ q(((e, t) => {
1871
- var n = vt(), r = bt(), i = xt(), a = ht(), o = gt(), s = pt(), c = typeof document > "u" ? {} : document.documentElement.style;
1872
- t.exports = function(e) {
1873
- return function(t, l) {
1874
- l ||= {};
1875
- var u = i(n(t)), d = r(t), f = e ? u : d, p = o.style ? e ? o.style : o.css : "";
1876
- if (u in c) return l.asString ? f : [f];
1877
- var m = f, h = s[d], g = [];
1878
- if (e && (m = a(f)), typeof h == "function") {
1879
- var _ = h(f, p) || [];
1880
- _ && !Array.isArray(_) && (_ = [_]), _.length && (_ = _.map(function(t) {
1881
- return e ? i(n(t)) : r(t);
1882
- })), g = g.concat(_);
1883
- }
1884
- return p && g.push(p + m), g.push(f), l.asString || g.length == 1 ? g[0] : g;
1885
- };
1886
- };
1887
- }));
1888
- St();
1889
- //#endregion
1890
- //#region ../../lib-react/mask-markup/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/cssPrefix.js
1891
- var Ct = /* @__PURE__ */ q(((e, t) => {
1892
- t.exports = St()();
1893
- }));
1894
- Ct();
1895
- //#endregion
1896
- //#region ../../lib-react/mask-markup/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/hasOwn.js
1897
- var wt = /* @__PURE__ */ q(((e, t) => {
1898
- var n = Object.prototype.hasOwnProperty;
1899
- t.exports = function(e, t) {
1900
- return n.call(e, t);
1901
- };
1902
- }));
1903
- wt();
1904
- //#endregion
1905
- //#region ../../lib-react/mask-markup/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/isObject.js
1906
- var Tt = /* @__PURE__ */ q(((e, t) => {
1907
- var n = Object.prototype.toString;
1908
- t.exports = function(e) {
1909
- return !!e && n.call(e) === "[object Object]";
1910
- };
1911
- }));
1912
- Tt();
1913
- //#endregion
1914
- //#region ../../lib-react/mask-markup/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/isFunction.js
1915
- var Et = /* @__PURE__ */ q(((e, t) => {
1916
- var n = Object.prototype.toString;
1917
- t.exports = function(e) {
1918
- return n.apply(e) === "[object Function]";
1919
- };
1920
- }));
1921
- Et();
1922
- //#endregion
1923
- //#region ../../lib-react/mask-markup/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/toStyleObject.js
1924
- var Dt = /* @__PURE__ */ q(((e, t) => {
1925
- gt();
1926
- var n = Ct(), r = bt(), i = vt(), a = wt(), o = Tt(), s = Et(), c = function(e, t, r, i) {
1927
- n(t).forEach(function(t) {
1928
- e[i ? i(t) : t] = r;
1929
- });
1930
- }, l = function(e) {
1931
- e = (e || "").split(";");
1932
- var t = {};
1933
- return e.forEach(function(e) {
1934
- var n = e.split(":");
1935
- n.length == 2 && (t[n[0].trim()] = n[1].trim());
1936
- }), t;
1937
- }, u = { cssUnitless: mt() }, d = function(e, t, n, f) {
1938
- typeof e == "string" && (e = l(e)), t ||= u, t.cssUnitless = t.cssUnitless || u.cssUnitless, f ||= {};
1939
- var p = t.scope || {}, m = t.addUnits == null ? p && p.addUnits != null ? p.addUnits : !0 : t.addUnits, h = (t.cssUnitless == null ? p ? p.cssUnitless : null : t.cssUnitless) || {}, g = (t.cssUnit || p ? p.cssUnit : null) || "px", _ = t.prefixProperties || (p ? p.prefixProperties : null) || {}, v = t.camelize ? i : r, y, b, x, S, C, w, T, E;
1940
- for (x in e) if (a(e, x)) {
1941
- if (S = e[x], b = r(n ? n + x : x), y = !1, E = !1, s(S) && (T = S.call(p || e, S, x, b, e), o(T) && T.value != null ? (S = T.value, E = T.prefix, b = T.name ? r(T.name) : b) : S = T), C = typeof S, w = C == "number" || C == "string" && S != "" && S * 1 == S, S == null || b == null || b === "") continue;
1942
- if ((w || C == "string") && (y = !0), !y && S.value != null && S.prefix && (y = !0, E = S.prefix, S = S.value), y) {
1943
- if (E ||= !!_[b], w && (S = m && !(b in h) ? S + g : S + ""), (b == "border" || !b.indexOf("border") && !~b.indexOf("radius") && !~b.indexOf("width")) && w && (b += "-width"), !b.indexOf("border-radius-") && (b.replace(/border(-radius)(-(.*))/, function(e, t, n) {
1944
- var r = {
1945
- "-top": ["-top-left", "-top-right"],
1946
- "-left": ["-top-left", "-bottom-left"],
1947
- "-right": ["-top-right", "-bottom-right"],
1948
- "-bottom": ["-bottom-left", "-bottom-right"]
1949
- };
1950
- n in r ? (b = [], r[n].forEach(function(e) {
1951
- b.push("border" + e + t);
1952
- })) : b = "border" + n + t;
1953
- }), Array.isArray(b))) {
1954
- b.forEach(function(e) {
1955
- E ? c(f, e, S, v) : f[v(e)] = S;
1956
- });
1957
- continue;
1958
- }
1959
- E ? c(f, b, S, v) : f[v(b)] = S;
1960
- } else d(S, t, b + "-", f);
1961
- }
1962
- return f;
1963
- };
1964
- t.exports = d;
1965
- }));
1966
- Dt();
1967
- //#endregion
1968
- //#region ../../lib-react/mask-markup/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/toStyleString.js
1969
- var Ot = /* @__PURE__ */ q(((e, t) => {
1970
- var n = Dt(), r = wt();
1971
- t.exports = function(e, t) {
1972
- e = n(e, t);
1973
- var i = [], a;
1974
- for (a in e) r(e, a) && i.push(a + ": " + e[a]);
1975
- return i.join("; ");
1976
- };
1977
- }));
1978
- Ot();
1979
- //#endregion
1980
- //#region ../../lib-react/mask-markup/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/index.js
1981
- var kt = /* @__PURE__ */ q(((e, t) => {
1982
- t.exports = {
1983
- prefixProperties: pt(),
1984
- cssUnitless: mt(),
1985
- object: Dt(),
1986
- string: Ot()
1987
- };
1988
- }));
1989
- kt();
1990
- //#endregion
1991
- //#region ../../lib-react/mask-markup/dist/serialization.js
1992
- var At = /* @__PURE__ */ r(d(), 1), jt = kt(), Mt = (0, At.default)("@pie-lib:mask-markup:serialization"), Nt = ["span"], Pt = [
1993
- "em",
1994
- "strong",
1995
- "u"
1996
- ], Ft = 3, It = 8, Lt = 1, Rt = (e) => {
1997
- if (!e.attributes || e.attributes.length <= 0) return;
1998
- let t = {}, n;
1999
- for (n = 0; n < e.attributes.length; n++) {
2000
- let r = e.attributes[n];
2001
- t[r.name] = r.value;
2002
- }
2003
- return t;
2004
- }, zt = (e) => Nt.includes(e) ? "inline" : Pt.includes(e) ? "mark" : "block", Bt = (e) => {
2005
- let t = /([\w-]*)\s*:\s*([^;]*)/g, n, r = {};
2006
- for (; n = t.exec(e);) r[n[1]] = n[2].trim();
2007
- return r;
2008
- }, Vt = (e) => (0, jt.object)(e, {
2009
- camelize: !0,
2010
- addUnits: !1
2011
- }), Ht = (e, t) => Vt(Bt(e.getAttribute(t))), Ut = (e, t, n) => {
2012
- let r = e.getAttribute(n);
2013
- return delete t.class, r;
2014
- }, Wt = (e) => (t, n) => {
2015
- if (!e.getAttribute) return t;
2016
- if (e.getAttribute(n)) switch (n) {
2017
- case "style":
2018
- t.style = Ht(e, n);
2019
- break;
2020
- case "class":
2021
- t.className = Ut(e, t, n);
2022
- break;
2023
- default:
2024
- t[n] = e.getAttribute(n);
2025
- break;
2026
- }
2027
- return t;
2028
- }, Gt = [
2029
- "border",
2030
- "class",
2031
- "style"
2032
- ], Kt = {
2033
- b: "bold",
2034
- em: "italic",
2035
- u: "underline",
2036
- s: "strikethrough",
2037
- code: "code",
2038
- strong: "strong"
2039
- }, qt = (e, t = []) => {
2040
- if (e.nodeType === It) return null;
2041
- if (e.nodeType === Ft) {
2042
- let n = { text: e.textContent };
2043
- return t.length > 0 && (n.marks = t.map((e) => ({
2044
- type: e,
2045
- data: void 0
2046
- }))), {
2047
- object: "text",
2048
- leaves: [n]
2049
- };
2050
- }
2051
- if (e.nodeType === Lt) {
2052
- let n = e.tagName.toLowerCase(), r = Kt[n];
2053
- if (r) return Mt("[deserialize] mark: ", r), {
2054
- _flatten: !0,
2055
- nodes: Jt(e.childNodes, [...t, r])
2056
- };
2057
- if (n === "math") return {
2058
- isMath: !0,
2059
- nodes: [e]
2060
- };
2061
- let i = Rt(e) || {};
2062
- n === "audio" && i.controls === "" && (i.controls = !0);
2063
- let a = Gt.reduce(Wt(e), { ...i }), o = zt(n), s = Jt(e.childNodes, t);
2064
- return {
2065
- object: o,
2066
- type: n,
2067
- data: {
2068
- dataset: { ...e.dataset },
2069
- attributes: { ...a }
2070
- },
2071
- nodes: s
2072
- };
2073
- }
2074
- return null;
2075
- }, Jt = (e, t = []) => {
2076
- let n = [];
2077
- for (let r = 0; r < e.length; r++) {
2078
- let i = qt(e[r], t);
2079
- i !== null && (i._flatten && i.nodes ? n.push(...i.nodes) : n.push(i));
2080
- }
2081
- return n;
2082
- }, Yt = (e) => {
2083
- if (!e || !e.trim()) return {
2084
- object: "value",
2085
- document: {
2086
- object: "document",
2087
- data: {},
2088
- nodes: [{
2089
- object: "block",
2090
- type: "span",
2091
- data: {},
2092
- isVoid: !1,
2093
- nodes: []
2094
- }]
2095
- }
2096
- };
2097
- let t = Jt(new DOMParser().parseFromString(e, "text/html").body.childNodes);
2098
- return !t.some((e) => e.object === "block" || e.object === "inline") && t.length > 0 && (t = [{
2099
- object: "block",
2100
- type: "span",
2101
- data: {},
2102
- isVoid: !1,
2103
- nodes: t
2104
- }]), t.length === 0 && (t = [{
2105
- object: "block",
2106
- type: "span",
2107
- data: {},
2108
- isVoid: !1,
2109
- nodes: []
2110
- }]), {
2111
- object: "value",
2112
- document: {
2113
- object: "document",
2114
- data: {},
2115
- nodes: t
2116
- }
2117
- };
2118
- }, Xt = l("div")(({ theme: e }) => ({
2119
- paddingTop: e.spacing(.5),
2120
- paddingBottom: e.spacing(.5)
2121
- })), Zt = l("span")(() => ({
2122
- display: "inline-block",
2123
- width: ".75em"
2124
- })), Qt = ["tbody", "tr"], $t = (e, t) => {
2125
- let n = t.trim() === "", r = e && e.type;
2126
- if (!(n && Qt.includes(r))) return t;
2127
- }, en = (e) => {
2128
- let t = e.leaves.find((e) => x(e, "marks", []).length);
2129
- return t ? t.marks[0] : null;
2130
- }, tn = (e, t, n, r, i, a) => {
2131
- if (!t) return null;
2132
- let o = [];
2133
- return (e.nodes || []).forEach((e, s) => {
2134
- let c = e.type ? `${e.type}-${s}` : `${s}`;
2135
- if (e.isMath) return o.push(/* @__PURE__ */ D("span", { dangerouslySetInnerHTML: { __html: `<math displaystyle="true">${e.nodes[0].innerHTML}</math>` } })), o;
2136
- if (r) {
2137
- let i = r(e, t, n);
2138
- if (i) {
2139
- let t = e.data?.dataset?.component === "blank";
2140
- t && o.push(/* @__PURE__ */ D(Zt, {}, `spacer-${s}`)), o.push(i), t && o.push(/* @__PURE__ */ D(Zt, {}, `spacer-${s}`));
2141
- return;
2142
- }
2143
- }
2144
- if (e.object === "text") {
2145
- let t = e.leaves.reduce((e, t) => {
2146
- let n = t.text, r = $t(i, n);
2147
- return r ? e + r : e;
2148
- }, ""), n = en(e);
2149
- if (n) {
2150
- let e;
2151
- for (e in Kt) if (Kt[e] === n.type) {
2152
- let n = e;
2153
- o.push(/* @__PURE__ */ D(n, { children: t }, c));
2154
- break;
2155
- }
2156
- } else t.length > 0 && o.push(t);
2157
- } else {
2158
- let i = tn(e, t, n, r, e, a);
2159
- if (e.type === "p" || e.type === "paragraph") o.push(/* @__PURE__ */ D(Xt, { children: i }, c));
2160
- else {
2161
- let t = e.type;
2162
- e.nodes && e.nodes.length > 0 ? o.push(/* @__PURE__ */ D(t, {
2163
- ...e.data.attributes,
2164
- children: i
2165
- }, c)) : o.push(/* @__PURE__ */ D(t, { ...e.data.attributes }, c));
2166
- }
2167
- }
2168
- }), o;
2169
- }, nn = l("div")(() => ({
2170
- display: "initial",
2171
- "&:not(.MathJax) table": { borderCollapse: "collapse" },
2172
- "&:not(.MathJax) table td, &:not(.MathJax) table th": {
2173
- padding: "8px 12px",
2174
- textAlign: "left"
2175
- }
2176
- })), rn = class extends C.Component {
2177
- constructor(e) {
2178
- super(e), this.internalContainerRef = C.createRef();
2179
- }
2180
- static propTypes = {
2181
- renderChildren: k.default.func,
2182
- layout: k.default.object,
2183
- value: k.default.object,
2184
- onChange: k.default.func,
2185
- elementType: k.default.string,
2186
- containerRef: k.default.oneOfType([k.default.func, k.default.shape({ current: k.default.instanceOf(Element) })])
2187
- };
2188
- componentDidMount() {
2189
- let t = this.props.containerRef || this.internalContainerRef;
2190
- t.current && typeof e == "function" && e(t.current);
2191
- }
2192
- handleChange = (e, t) => {
2193
- let n = {
2194
- ...this.props.value,
2195
- [e]: t
2196
- };
2197
- this.props.onChange(n);
2198
- };
2199
- render() {
2200
- let { value: e, layout: t, elementType: n, containerRef: r } = this.props, i = tn(t, e, this.handleChange, this.props.renderChildren, null, n);
2201
- return /* @__PURE__ */ D(nn, {
2202
- ref: r || this.internalContainerRef,
2203
- children: i
2204
- });
2205
- }
2206
- }, an = (e, t) => {
2207
- let { markup: n } = ft(e, t);
2208
- return Yt(n).document;
2209
- }, on = (e, t) => class extends C.Component {
2210
- static propTypes = {
2211
- markup: k.default.string,
2212
- layout: k.default.object,
2213
- value: k.default.object,
2214
- onChange: k.default.func,
2215
- customMarkMarkupComponent: k.default.func,
2216
- elementType: k.default.string
2217
- };
2218
- constructor(e) {
2219
- super(e), this.containerRef = C.createRef();
2220
- }
2221
- componentDidUpdate(e) {
2222
- if (this.props.markup !== e.markup) {
2223
- let e = this.containerRef.current;
2224
- (e && e.querySelectorAll("[data-latex][data-math-handled=\"true\"]") || []).forEach((e) => {
2225
- let t = e.querySelector("mjx-container");
2226
- t && e.removeChild(t), e.innerHTML = e.getAttribute("data-raw"), e.removeAttribute("data-math-handled");
2227
- });
2228
- }
2229
- }
2230
- render() {
2231
- let { markup: n, layout: r, value: i, onChange: a, elementType: o } = this.props, s = r || an(n, e);
2232
- return /* @__PURE__ */ D(rn, {
2233
- containerRef: this.containerRef,
2234
- elementType: o,
2235
- layout: s,
2236
- value: i,
2237
- onChange: a,
2238
- renderChildren: t(this.props)
2239
- });
2240
- }
2241
- }, sn = t(/*#__PURE__*/ D("path", { d: "m7 10 5 5 5-5z" }), "ArrowDropDown"), cn = t(/*#__PURE__*/ D("path", { d: "m7 14 5-5 5 5z" }), "ArrowDropUp");
2242
- //#endregion
2243
- //#region ../../lib-react/mask-markup/dist/components/dropdown.js
2244
- function J(e) {
2245
- return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
2246
- }
2247
- function ln(e, t) {
2248
- return !e || J(e) ? e : J(e.default) ? e.default : t && J(e[t]) ? e[t] : t && J(e[t]?.default) ? e[t].default : e;
2249
- }
2250
- var un = ln(h, "InlineMenu") || ln(fn.InlineMenu, "InlineMenu"), dn = a, Y = dn.default, fn = Y && typeof Y == "object" ? Y : dn, pn = l(b)(() => ({
2251
- color: c.text(),
2252
- border: `1px solid ${c.borderGray()}`,
2253
- borderRadius: "4px",
2254
- justifyContent: "space-between",
2255
- backgroundColor: c.background(),
2256
- position: "relative",
2257
- height: "45px",
2258
- width: "fit-content",
2259
- margin: "2px",
2260
- textTransform: "none",
2261
- "& span": { paddingRight: "24px" },
2262
- "& svg": {
2263
- position: "absolute",
2264
- right: "4px",
2265
- top: "calc(50% - 12px)",
2266
- pointerEvents: "none",
2267
- color: c.text(),
2268
- marginLeft: "5px"
2269
- },
2270
- "&.Mui-focused": {
2271
- outline: `3px solid ${c.tertiary()}`,
2272
- outlineOffset: "2px",
2273
- borderWidth: "3px"
2274
- },
2275
- "&.disabledCorrect": {
2276
- borderWidth: "2px",
2277
- borderColor: c.correct(),
2278
- color: `${c.text()} !important`
2279
- },
2280
- "&.disabledIncorrect": {
2281
- borderWidth: "2px",
2282
- borderColor: c.incorrectWithIcon(),
2283
- color: `${c.text()} !important`
2284
- }
2285
- })), mn = l(un)(() => ({
2286
- backgroundColor: c.background(),
2287
- border: `1px solid ${c.correct()} !important`,
2288
- "&:hover": {
2289
- border: `1px solid ${c.text()} `,
2290
- borderColor: "initial"
2291
- },
2292
- "&:focus": {
2293
- border: `1px solid ${c.text()}`,
2294
- borderColor: "initial"
2295
- },
2296
- "& .MuiList-root": { padding: 0 }
2297
- })), hn = l(m)(() => ({
2298
- height: 24,
2299
- overflow: "hidden",
2300
- fontSize: "1rem",
2301
- fontWeight: 400,
2302
- fontFamily: "inherit",
2303
- lineHeight: "1.5em",
2304
- whiteSpace: "nowrap",
2305
- color: c.text(),
2306
- backgroundColor: c.background(),
2307
- "&.Mui-focusVisible": {
2308
- outline: `3px solid ${c.tertiary()}`,
2309
- outlineOffset: "-1px",
2310
- color: c.text(),
2311
- backgroundColor: c.background()
2312
- },
2313
- "&:hover": {
2314
- color: c.text(),
2315
- backgroundColor: c.dropdownBackground()
2316
- },
2317
- boxSizing: "border-box",
2318
- padding: "16px 8px",
2319
- borderRadius: "4px",
2320
- "&.selected": {
2321
- color: `${c.text()} !important`,
2322
- backgroundColor: `${c.background()} !important`,
2323
- "&:hover": {
2324
- color: c.text(),
2325
- backgroundColor: `${c.dropdownBackground()} !important`
2326
- }
2327
- }
2328
- })), gn = l("span")(() => ({ fontSize: "max(1rem, 14px)" })), _n = l("span")(() => ({
2329
- fontSize: "max(1rem, 14px)",
2330
- flexShrink: 0,
2331
- paddingLeft: "8px"
2332
- })), vn = l(y)(() => ({
2333
- position: "absolute",
2334
- left: "-10000px",
2335
- top: "auto",
2336
- width: "1px",
2337
- height: "1px",
2338
- overflow: "hidden"
2339
- })), yn = l(u)(() => ({
2340
- color: `${c.white()} !important`,
2341
- position: "absolute",
2342
- top: "-8px !important",
2343
- left: "-8px",
2344
- marginLeft: "0 !important",
2345
- borderRadius: "50%",
2346
- fontSize: "16px",
2347
- padding: "2px",
2348
- "&.correct": { backgroundColor: c.correct() },
2349
- "&.incorrect": { backgroundColor: c.incorrectWithIcon() }
2350
- })), bn = l(v)(() => ({
2351
- color: `${c.white()} !important`,
2352
- position: "absolute",
2353
- top: "-8px !important",
2354
- left: "-8px",
2355
- marginLeft: "0 !important",
2356
- borderRadius: "50%",
2357
- fontSize: "16px",
2358
- padding: "2px",
2359
- "&.correct": { backgroundColor: c.correct() },
2360
- "&.incorrect": { backgroundColor: c.incorrectWithIcon() }
2361
- })), xn = class extends C.Component {
2362
- static propTypes = {
2363
- id: k.default.string,
2364
- value: k.default.string,
2365
- disabled: k.default.bool,
2366
- onChange: k.default.func,
2367
- correct: k.default.bool,
2368
- choices: k.default.arrayOf(k.default.shape({
2369
- value: k.default.string,
2370
- label: k.default.string
2371
- })),
2372
- showCorrectAnswer: k.default.bool,
2373
- singleQuery: k.default.bool,
2374
- correctValue: k.default.string
2375
- };
2376
- constructor(e) {
2377
- super(e), this.state = {
2378
- anchorEl: null,
2379
- highlightedOptionId: null,
2380
- menuWidth: null,
2381
- previewValue: null
2382
- }, this.hiddenRef = C.createRef(), this.buttonRef = C.createRef(), this.previewRef = C.createRef(), this.elementRefs = [];
2383
- }
2384
- componentDidMount() {
2385
- this.hiddenRef.current && this.state.menuWidth === null && this.setState({ menuWidth: this.hiddenRef.current.clientWidth });
2386
- }
2387
- componentDidUpdate(t, n) {
2388
- let r = this.hiddenRef.current;
2389
- if (!n.anchorEl && this.state.anchorEl && this.elementRefs.forEach((t) => {
2390
- if (!t) return;
2391
- let n = t.querySelector("[data-latex], [data-raw]"), r = t.querySelector("mjx-container"), i = t.querySelector("[data-math-handled=\"true\"]");
2392
- n && (!i || !r) && e(t);
2393
- }), r) {
2394
- let t = r.clientWidth;
2395
- t !== this.state.menuWidth && (this.elementRefs.forEach((t) => {
2396
- t && e(t);
2397
- }), e(r), this.setState({ menuWidth: t }));
2398
- }
2399
- }
2400
- handleClick = (e) => {
2401
- let { id: t, value: n, choices: r } = this.props, i = null;
2402
- if (n) {
2403
- let e = (r || []).findIndex((e) => e.value === n);
2404
- e >= 0 && (i = `dropdown-option-${t}-${e}`);
2405
- }
2406
- this.setState({
2407
- anchorEl: e.currentTarget,
2408
- highlightedOptionId: i
2409
- });
2410
- };
2411
- handleClose = () => {
2412
- let { value: e } = this.props;
2413
- this.setState({
2414
- anchorEl: null,
2415
- previewValue: null,
2416
- highlightedOptionId: null
2417
- }), !e && this.previewRef.current && (this.previewRef.current.innerHTML = "");
2418
- };
2419
- handleHighlight = (e) => {
2420
- let t = { highlightedOptionId: `dropdown-option-${this.props.id}-${e}` };
2421
- this.props.value || (t.previewValue = this.props.choices[e].value), this.setState(t);
2422
- };
2423
- handleSelect = (e, t) => {
2424
- this.props.onChange(this.props.id, e), this.handleHighlight(t), this.handleClose();
2425
- };
2426
- handleHover = (e) => {
2427
- if (this.props.value) return;
2428
- let t = `dropdown-option-${this.props.id}-${e}`, n = this.state.previewValue;
2429
- this.setState({
2430
- highlightedOptionId: t,
2431
- previewValue: n
2432
- }, () => {
2433
- let t = this.elementRefs[e], n = this.previewRef.current;
2434
- t && n && (n.innerHTML = t.innerHTML);
2435
- });
2436
- };
2437
- getLabel(e, t) {
2438
- let n = (e || []).find((e) => e.value === t);
2439
- return n ? n.label.trim() : void 0;
2440
- }
2441
- render() {
2442
- let { id: e, correct: t, disabled: n, value: r, choices: i, showCorrectAnswer: a, singleQuery: o, correctValue: s } = this.props, { anchorEl: c } = this.state, l = !!c, u = `dropdown-button-${e}`, d = `dropdown-menu-${e}`, f = `dropdown-value-${e}`, p;
2443
- this.elementRefs = [], n && t !== void 0 && (p = t || a ? "disabledCorrect" : "disabledIncorrect");
2444
- let m = parseInt(e, 10) + 1, h = o ? "Query-label" : `Query-label-${m}`, g = o ? "Query" : `Query ${m}`, _ = null;
2445
- return n && t !== void 0 && (_ = t || a ? /* @__PURE__ */ D(yn, { className: "correct" }) : /* @__PURE__ */ D(bn, { className: "incorrect" })), /* @__PURE__ */ O(ee, { children: [
2446
- /* @__PURE__ */ D("div", {
2447
- ref: this.hiddenRef,
2448
- style: {
2449
- position: "absolute",
2450
- visibility: "hidden",
2451
- top: 0,
2452
- left: 0
2453
- },
2454
- tabIndex: -1,
2455
- "aria-hidden": "true",
2456
- children: (i || []).map((e, t) => /* @__PURE__ */ D(hn, {
2457
- tabIndex: -1,
2458
- "aria-hidden": "true",
2459
- children: /* @__PURE__ */ D(gn, { dangerouslySetInnerHTML: { __html: e.label } })
2460
- }, t))
2461
- }),
2462
- /* @__PURE__ */ D(vn, {
2463
- id: h,
2464
- tabIndex: -1,
2465
- "aria-hidden": "true",
2466
- children: g
2467
- }),
2468
- /* @__PURE__ */ O(pn, {
2469
- ref: this.buttonRef,
2470
- style: {
2471
- ...this.state.menuWidth && { minWidth: `calc(${this.state.menuWidth}px + 8px)` },
2472
- borderWidth: l ? "2px" : "1px",
2473
- transition: "border-width 0.2s ease-in-out"
2474
- },
2475
- "aria-controls": l ? d : void 0,
2476
- "aria-haspopup": "listbox",
2477
- "aria-expanded": l ? "true" : void 0,
2478
- "aria-activedescendant": this.state.highlightedOptionId,
2479
- onClick: this.handleClick,
2480
- className: p,
2481
- disabled: n,
2482
- id: u,
2483
- role: "combobox",
2484
- "aria-label": `Select an option for ${g}`,
2485
- "aria-labelledby": f,
2486
- children: [
2487
- _,
2488
- /* @__PURE__ */ D(gn, {
2489
- id: f,
2490
- ref: this.previewRef,
2491
- dangerouslySetInnerHTML: { __html: s || (l && this.state.previewValue ? this.getLabel(i, this.state.previewValue) : this.getLabel(i, r) || "") }
2492
- }),
2493
- D(l ? cn : sn, {})
2494
- ]
2495
- }),
2496
- /* @__PURE__ */ D(mn, {
2497
- id: d,
2498
- anchorEl: c,
2499
- keepMounted: !0,
2500
- open: l,
2501
- onClose: this.handleClose,
2502
- getContentAnchorEl: null,
2503
- anchorOrigin: {
2504
- vertical: "bottom",
2505
- horizontal: "left"
2506
- },
2507
- transformOrigin: {
2508
- vertical: "top",
2509
- horizontal: "left"
2510
- },
2511
- transitionDuration: {
2512
- enter: 225,
2513
- exit: 195
2514
- },
2515
- slotProps: {
2516
- paper: this.state.menuWidth ? { style: {
2517
- minWidth: this.state.menuWidth,
2518
- padding: "4px"
2519
- } } : void 0,
2520
- list: {
2521
- "aria-labelledby": u,
2522
- role: "listbox",
2523
- disablePadding: !0
2524
- }
2525
- },
2526
- children: (i || []).map((t, n) => {
2527
- let i = `dropdown-option-${e}-${n}`;
2528
- return /* @__PURE__ */ O(hn, {
2529
- id: i,
2530
- className: t.value === r ? "selected" : "",
2531
- selected: t.value === r,
2532
- value: t.value,
2533
- onClick: () => this.handleSelect(t.value, n),
2534
- role: "option",
2535
- "aria-selected": this.state.highlightedOptionId === i ? "true" : void 0,
2536
- onMouseOver: () => this.handleHover(n),
2537
- children: [/* @__PURE__ */ D(gn, {
2538
- ref: (e) => this.elementRefs[n] = e,
2539
- dangerouslySetInnerHTML: { __html: t.label }
2540
- }), /* @__PURE__ */ D(_n, { dangerouslySetInnerHTML: { __html: t.value === r ? " &check;" : "" } })]
2541
- }, `${t.label}-${n}`);
2542
- })
2543
- })
2544
- ] });
2545
- }
2546
- }, Sn = on("dropdown", (e) => (t, n, r) => {
2547
- let i = t.data && t.data.dataset || {};
2548
- if (i.component === "dropdown") {
2549
- let { choices: a, disabled: o, feedback: s, showCorrectAnswer: c } = e, l = a && a[i.id] && a[i.id].find((e) => e.correct), u = c ? l && l.value : n[i.id];
2550
- return /* @__PURE__ */ D(xn, {
2551
- correct: s && s[i.id] && s[i.id] === "correct",
2552
- disabled: o || c,
2553
- value: u,
2554
- correctValue: c ? l && l.label : void 0,
2555
- id: i.id,
2556
- onChange: r,
2557
- choices: a[i.id],
2558
- showCorrectAnswer: c,
2559
- singleQuery: Object.keys(a).length == 1
2560
- }, `${t.type}-dropdown-${i.id}`);
2561
- }
2562
- });
2563
- //#endregion
2564
- //#region src/delivery/inline-dropdown.tsx
2565
- function X(e) {
2566
- return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
2567
- }
2568
- function Z(e, t) {
2569
- return !e || X(e) ? e : X(e.default) ? e.default : t && X(e[t]) ? e[t] : t && X(e[t]?.default) ? e[t].default : e;
2570
- }
2571
- var Cn = Z(i, "UiLayout") || Z($.UiLayout, "UiLayout"), Q = Z(p, "PreviewPrompt") || Z($.PreviewPrompt, "PreviewPrompt"), wn = Z(f, "Collapsible") || Z($.Collapsible, "Collapsible"), Tn = a, En = Tn.default, $ = En && typeof En == "object" ? En : Tn, Dn = l(Cn)({
2572
- color: c.text(),
2573
- backgroundColor: c.background()
2574
- }), On = l(wn)(({ theme: e }) => ({ marginBottom: e.spacing(2) })), kn = l("div")(({ theme: e }) => ({ "&:not(:last-child)": { marginBottom: e.spacing(2) } })), An = l("div")({
2575
- display: "flex",
2576
- whiteSpace: "break-spaces"
2577
- }), jn = l("div")(({ correct: e }) => ({
2578
- display: "flex",
2579
- ...e ? { color: c.correct() } : { color: c.incorrectWithIcon() }
2580
- })), Mn = l("h2")({
2581
- position: "absolute",
2582
- left: "-10000px",
2583
- top: "auto",
2584
- width: "1px",
2585
- height: "1px",
2586
- overflow: "hidden"
2587
- }), Nn = class extends C.Component {
2588
- static propTypes = {
2589
- prompt: k.default.string,
2590
- disabled: k.default.bool,
2591
- markup: k.default.string,
2592
- mode: k.default.string,
2593
- displayType: k.default.string,
2594
- rationale: k.default.string,
2595
- teacherInstructions: k.default.string,
2596
- model: k.default.object.isRequired,
2597
- choices: k.default.object,
2598
- value: k.default.object,
2599
- feedback: k.default.object,
2600
- onChange: k.default.func,
2601
- language: k.default.string
2602
- };
2603
- static defaultProps = { value: {} };
2604
- state = { showCorrectAnswer: !1 };
2605
- UNSAFE_componentWillReceiveProps(e) {
2606
- S(e.feedback) && this.setState({ showCorrectAnswer: !1 });
2607
- }
2608
- componentDidUpdate() {
2609
- e(E.findDOMNode(this));
2610
- }
2611
- toggleShowCorrect = () => {
2612
- this.setState({ showCorrectAnswer: !this.state.showCorrectAnswer });
2613
- };
2614
- render() {
2615
- let { showCorrectAnswer: e } = this.state, { prompt: t, mode: n, model: r, rationale: i, teacherInstructions: a, choices: c, displayType: l, language: u } = this.props, { extraCSSRules: d } = r || {}, f = n === "evaluate", p = !1, m = i && (s(i) || o(i)), h = a && (s(a) || o(a)), g = (Object.keys(c) || []).map((e) => (c[e] || []).reduce((e, t) => (t.rationale && s(t.rationale) && (p = !0, e.push(t)), e), []));
2616
- return /* @__PURE__ */ O(Dn, {
2617
- extraCSSRules: d,
2618
- style: { display: `${l}` },
2619
- children: [
2620
- n === "gather" && /* @__PURE__ */ D(Mn, { children: "Inline Dropdown Question" }),
2621
- h && /* @__PURE__ */ D(On, {
2622
- labels: {
2623
- hidden: "Show Teacher Instructions",
2624
- visible: "Hide Teacher Instructions"
2625
- },
2626
- children: /* @__PURE__ */ D(Q, { prompt: a })
2627
- }),
2628
- t && /* @__PURE__ */ D(Q, { prompt: t }),
2629
- /* @__PURE__ */ D(ut, {
2630
- show: f,
2631
- toggled: e,
2632
- onToggle: this.toggleShowCorrect,
2633
- language: u
2634
- }),
2635
- /* @__PURE__ */ D(Sn, {
2636
- ...this.props,
2637
- showCorrectAnswer: e
2638
- }),
2639
- p && /* @__PURE__ */ D(On, {
2640
- labels: {
2641
- hidden: "Show Rationale for choices",
2642
- visible: "Hide Rationale for choices"
2643
- },
2644
- children: g.map((e, t) => /* @__PURE__ */ D(kn, { children: e?.length > 0 && e.map((e) => /* @__PURE__ */ O(An, { children: [/* @__PURE__ */ D(jn, {
2645
- correct: e.correct,
2646
- dangerouslySetInnerHTML: { __html: `${e.label}: ` }
2647
- }), /* @__PURE__ */ D(Q, { prompt: e.rationale })] }, e.label)) }, t))
2648
- }),
2649
- m && /* @__PURE__ */ D(wn, {
2650
- labels: {
2651
- hidden: "Show Rationale",
2652
- visible: "Hide Rationale"
2653
- },
2654
- children: /* @__PURE__ */ D(Q, { prompt: i })
2655
- })
2656
- ]
2657
- });
2658
- }
2659
- }, Pn = class extends HTMLElement {
2660
- constructor() {
2661
- super(), this._model = null, this._session = null, this._root = null;
2662
- }
2663
- set model(e) {
2664
- this._model = e, this.dispatchEvent(new te(this.tagName.toLowerCase(), this.session && !!this.session.value, !!this._model)), this._render();
2665
- }
2666
- set session(e) {
2667
- this._session = e, this._render();
2668
- }
2669
- get session() {
2670
- return this._session;
2671
- }
2672
- setLangAttribute() {
2673
- let e = this._model && typeof this._model.language ? this._model.language : "", t = e ? e.slice(0, 2) : "en";
2674
- this.setAttribute("lang", t);
2675
- }
2676
- _render = () => {
2677
- if (this._model && this._session) {
2678
- let t = C.createElement(Nn, {
2679
- model: this._model,
2680
- prompt: this._model.prompt,
2681
- rationale: this._model.rationale,
2682
- teacherInstructions: this._model.teacherInstructions,
2683
- disabled: this._model.disabled,
2684
- displayType: this._model.displayType,
2685
- markup: this._model.markup,
2686
- mode: this._model.mode,
2687
- choices: this._model.choices,
2688
- value: this._session.value,
2689
- feedback: this._model.feedback,
2690
- language: this._model.language,
2691
- onChange: this.changeSession
2692
- });
2693
- this.setLangAttribute(), this._root ||= T(this), this._root.render(t), queueMicrotask(() => {
2694
- e(this);
2695
- });
2696
- }
2697
- };
2698
- dispatchChangedEvent = () => {
2699
- this.dispatchEvent(new ne(this.tagName.toLowerCase(), this.session && !!this.session.value));
2700
- };
2701
- changeSession = (e) => {
2702
- this.session.value = e, this.dispatchChangedEvent(), this._render();
2703
- };
2704
- connectedCallback() {
2705
- this.setAttribute("aria-label", "Inline Dropdown Question"), this.setAttribute("role", "region"), this._render();
2706
- }
2707
- disconnectedCallback() {
2708
- this._root && this._root.unmount();
2709
- }
2710
- };
2711
- //#endregion
2712
- export { Pn as default };
2713
-
2714
- //# sourceMappingURL=index.js.map