@pie-element/categorize 13.1.2-next.5 → 13.1.3

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 (158) hide show
  1. package/CHANGELOG.json +1637 -0
  2. package/CHANGELOG.md +2550 -0
  3. package/LICENSE.md +5 -0
  4. package/README.md +5 -0
  5. package/configure/CHANGELOG.json +1202 -0
  6. package/configure/CHANGELOG.md +2131 -0
  7. package/configure/lib/defaults.js +222 -0
  8. package/configure/lib/defaults.js.map +1 -0
  9. package/configure/lib/design/builder.js +55 -0
  10. package/configure/lib/design/builder.js.map +1 -0
  11. package/configure/lib/design/buttons.js +59 -0
  12. package/configure/lib/design/buttons.js.map +1 -0
  13. package/configure/lib/design/categories/RowLabel.js +66 -0
  14. package/configure/lib/design/categories/RowLabel.js.map +1 -0
  15. package/configure/lib/design/categories/alternateResponses.js +116 -0
  16. package/configure/lib/design/categories/alternateResponses.js.map +1 -0
  17. package/configure/lib/design/categories/category.js +153 -0
  18. package/configure/lib/design/categories/category.js.map +1 -0
  19. package/configure/lib/design/categories/choice-preview.js +79 -0
  20. package/configure/lib/design/categories/choice-preview.js.map +1 -0
  21. package/configure/lib/design/categories/droppable-placeholder.js +93 -0
  22. package/configure/lib/design/categories/droppable-placeholder.js.map +1 -0
  23. package/configure/lib/design/categories/index.js +256 -0
  24. package/configure/lib/design/categories/index.js.map +1 -0
  25. package/configure/lib/design/choices/choice.js +187 -0
  26. package/configure/lib/design/choices/choice.js.map +1 -0
  27. package/configure/lib/design/choices/config.js +58 -0
  28. package/configure/lib/design/choices/config.js.map +1 -0
  29. package/configure/lib/design/choices/index.js +197 -0
  30. package/configure/lib/design/choices/index.js.map +1 -0
  31. package/configure/lib/design/header.js +71 -0
  32. package/configure/lib/design/header.js.map +1 -0
  33. package/configure/lib/design/index.js +727 -0
  34. package/configure/lib/design/index.js.map +1 -0
  35. package/configure/lib/design/input-header.js +105 -0
  36. package/configure/lib/design/input-header.js.map +1 -0
  37. package/configure/lib/design/utils.js +12 -0
  38. package/configure/lib/design/utils.js.map +1 -0
  39. package/configure/lib/index.js +147 -0
  40. package/configure/lib/index.js.map +1 -0
  41. package/configure/lib/main.js +44 -0
  42. package/configure/lib/main.js.map +1 -0
  43. package/configure/lib/utils.js +43 -0
  44. package/configure/lib/utils.js.map +1 -0
  45. package/configure/package.json +32 -0
  46. package/controller/CHANGELOG.json +452 -0
  47. package/controller/CHANGELOG.md +1384 -0
  48. package/controller/lib/defaults.js +33 -0
  49. package/controller/lib/defaults.js.map +1 -0
  50. package/controller/lib/index.js +493 -0
  51. package/controller/lib/index.js.map +1 -0
  52. package/controller/lib/utils.js +69 -0
  53. package/controller/lib/utils.js.map +1 -0
  54. package/controller/package.json +18 -0
  55. package/docs/config-schema.json +2897 -0
  56. package/docs/config-schema.json.md +2138 -0
  57. package/docs/demo/config.js +8 -0
  58. package/docs/demo/generate.js +357 -0
  59. package/docs/demo/index.html +1 -0
  60. package/docs/demo/session.js +12 -0
  61. package/docs/pie-schema.json +1784 -0
  62. package/docs/pie-schema.json.md +1046 -0
  63. package/lib/categorize/categories.js +135 -0
  64. package/lib/categorize/categories.js.map +1 -0
  65. package/lib/categorize/category.js +67 -0
  66. package/lib/categorize/category.js.map +1 -0
  67. package/lib/categorize/choice.js +140 -0
  68. package/lib/categorize/choice.js.map +1 -0
  69. package/lib/categorize/choices.js +99 -0
  70. package/lib/categorize/choices.js.map +1 -0
  71. package/lib/categorize/droppable-placeholder.js +84 -0
  72. package/lib/categorize/droppable-placeholder.js.map +1 -0
  73. package/lib/categorize/grid-content.js +55 -0
  74. package/lib/categorize/grid-content.js.map +1 -0
  75. package/lib/categorize/index.js +450 -0
  76. package/lib/categorize/index.js.map +1 -0
  77. package/lib/index.js +316 -0
  78. package/lib/index.js.map +1 -0
  79. package/package.json +22 -85
  80. package/configure.js +0 -2
  81. package/controller.js +0 -1
  82. package/dist/author/defaults.d.ts +0 -223
  83. package/dist/author/defaults.js +0 -170
  84. package/dist/author/design/builder.d.ts +0 -10
  85. package/dist/author/design/builder.js +0 -24
  86. package/dist/author/design/buttons.d.ts +0 -28
  87. package/dist/author/design/buttons.js +0 -36
  88. package/dist/author/design/categories/RowLabel.d.ts +0 -23
  89. package/dist/author/design/categories/RowLabel.js +0 -47
  90. package/dist/author/design/categories/alternateResponses.d.ts +0 -31
  91. package/dist/author/design/categories/alternateResponses.js +0 -62
  92. package/dist/author/design/categories/category.d.ts +0 -44
  93. package/dist/author/design/categories/category.js +0 -98
  94. package/dist/author/design/categories/choice-preview.d.ts +0 -25
  95. package/dist/author/design/categories/choice-preview.js +0 -60
  96. package/dist/author/design/categories/droppable-placeholder.d.ts +0 -11
  97. package/dist/author/design/categories/droppable-placeholder.js +0 -71
  98. package/dist/author/design/categories/index.d.ts +0 -41
  99. package/dist/author/design/categories/index.js +0 -146
  100. package/dist/author/design/choices/choice.d.ts +0 -11
  101. package/dist/author/design/choices/choice.js +0 -129
  102. package/dist/author/design/choices/config.d.ts +0 -21
  103. package/dist/author/design/choices/config.js +0 -33
  104. package/dist/author/design/choices/index.d.ts +0 -41
  105. package/dist/author/design/choices/index.js +0 -110
  106. package/dist/author/design/header.d.ts +0 -24
  107. package/dist/author/design/header.js +0 -49
  108. package/dist/author/design/index.d.ts +0 -52
  109. package/dist/author/design/index.js +0 -417
  110. package/dist/author/design/input-header.d.ts +0 -39
  111. package/dist/author/design/input-header.js +0 -69
  112. package/dist/author/design/utils.d.ts +0 -9
  113. package/dist/author/design/utils.js +0 -7
  114. package/dist/author/index.d.ts +0 -51
  115. package/dist/author/index.js +0 -87
  116. package/dist/author/main.d.ts +0 -23
  117. package/dist/author/main.js +0 -30
  118. package/dist/author/utils.d.ts +0 -16
  119. package/dist/author/utils.js +0 -17
  120. package/dist/browser/author/index.js +0 -2041
  121. package/dist/browser/author/index.js.map +0 -1
  122. package/dist/browser/categorize.css +0 -2
  123. package/dist/browser/controller/index.js +0 -299
  124. package/dist/browser/controller/index.js.map +0 -1
  125. package/dist/browser/delivery/index.js +0 -1051
  126. package/dist/browser/delivery/index.js.map +0 -1
  127. package/dist/browser/dist-7UsF60Ks.js +0 -55705
  128. package/dist/browser/dist-7UsF60Ks.js.map +0 -1
  129. package/dist/browser/dist-DnGF41FP.js +0 -1958
  130. package/dist/browser/dist-DnGF41FP.js.map +0 -1
  131. package/dist/controller/defaults.d.ts +0 -34
  132. package/dist/controller/defaults.js +0 -29
  133. package/dist/controller/index.d.ts +0 -61
  134. package/dist/controller/index.js +0 -155
  135. package/dist/controller/utils.d.ts +0 -20
  136. package/dist/controller/utils.js +0 -35
  137. package/dist/delivery/categorize/categories.d.ts +0 -34
  138. package/dist/delivery/categorize/categories.js +0 -66
  139. package/dist/delivery/categorize/category.d.ts +0 -28
  140. package/dist/delivery/categorize/category.js +0 -48
  141. package/dist/delivery/categorize/choice.d.ts +0 -27
  142. package/dist/delivery/categorize/choice.js +0 -94
  143. package/dist/delivery/categorize/choices.d.ts +0 -39
  144. package/dist/delivery/categorize/choices.js +0 -51
  145. package/dist/delivery/categorize/droppable-placeholder.d.ts +0 -32
  146. package/dist/delivery/categorize/droppable-placeholder.js +0 -64
  147. package/dist/delivery/categorize/grid-content.d.ts +0 -25
  148. package/dist/delivery/categorize/grid-content.js +0 -39
  149. package/dist/delivery/categorize/index.d.ts +0 -57
  150. package/dist/delivery/categorize/index.js +0 -260
  151. package/dist/delivery/index.d.ts +0 -27
  152. package/dist/delivery/index.js +0 -152
  153. package/dist/index.d.ts +0 -1
  154. package/dist/index.iife.d.ts +0 -8
  155. package/dist/index.iife.js +0 -152
  156. package/dist/index.js +0 -2
  157. package/dist/runtime-support.d.ts +0 -12
  158. package/dist/runtime-support.js +0 -12
@@ -1,1958 +0,0 @@
1
- import * as __pieBrowserCjsReactRequire from "react";
2
- const __pieBrowserCjsRequire = (specifier) => {
3
- switch (specifier) {
4
- case "react": return __pieBrowserCjsReactRequire;
5
-
6
-
7
-
8
-
9
- default:
10
- throw new Error(`Unsupported browser CJS require: ${specifier}`);
11
- }
12
- };
13
- //#region \0rolldown/runtime.js
14
- var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescriptor, r = Object.getOwnPropertyNames, i = Object.getPrototypeOf, a = Object.prototype.hasOwnProperty, o = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), s = (e, n) => {
15
- let r = {};
16
- for (var i in e) t(r, i, {
17
- get: e[i],
18
- enumerable: !0
19
- });
20
- return n || t(r, Symbol.toStringTag, { value: "Module" }), r;
21
- }, c = (e, i, o, s) => {
22
- if (i && typeof i == "object" || typeof i == "function") for (var c = r(i), l = 0, u = c.length, d; l < u; l++) d = c[l], !a.call(e, d) && d !== o && t(e, d, {
23
- get: ((e) => i[e]).bind(null, d),
24
- enumerable: !(s = n(i, d)) || s.enumerable
25
- });
26
- return e;
27
- }, l = (n, r, a) => (a = n == null ? {} : e(i(n)), c(r || !n || !n.__esModule ? t(a, "default", {
28
- value: n,
29
- enumerable: !0
30
- }) : a, n)), u = __pieBrowserCjsRequire, d = /* @__PURE__ */ o(((e, t) => {
31
- var n = 1e3, r = n * 60, i = r * 60, a = i * 24, o = a * 7, s = a * 365.25;
32
- t.exports = function(e, t) {
33
- t ||= {};
34
- var n = typeof e;
35
- if (n === "string" && e.length > 0) return c(e);
36
- if (n === "number" && isFinite(e)) return t.long ? u(e) : l(e);
37
- throw Error("val is not a non-empty string or a valid number. val=" + JSON.stringify(e));
38
- };
39
- function c(e) {
40
- if (e = String(e), !(e.length > 100)) {
41
- var t = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);
42
- if (t) {
43
- var c = parseFloat(t[1]);
44
- switch ((t[2] || "ms").toLowerCase()) {
45
- case "years":
46
- case "year":
47
- case "yrs":
48
- case "yr":
49
- case "y": return c * s;
50
- case "weeks":
51
- case "week":
52
- case "w": return c * o;
53
- case "days":
54
- case "day":
55
- case "d": return c * a;
56
- case "hours":
57
- case "hour":
58
- case "hrs":
59
- case "hr":
60
- case "h": return c * i;
61
- case "minutes":
62
- case "minute":
63
- case "mins":
64
- case "min":
65
- case "m": return c * r;
66
- case "seconds":
67
- case "second":
68
- case "secs":
69
- case "sec":
70
- case "s": return c * n;
71
- case "milliseconds":
72
- case "millisecond":
73
- case "msecs":
74
- case "msec":
75
- case "ms": return c;
76
- default: return;
77
- }
78
- }
79
- }
80
- }
81
- function l(e) {
82
- var t = Math.abs(e);
83
- return t >= a ? Math.round(e / a) + "d" : t >= i ? Math.round(e / i) + "h" : t >= r ? Math.round(e / r) + "m" : t >= n ? Math.round(e / n) + "s" : e + "ms";
84
- }
85
- function u(e) {
86
- var t = Math.abs(e);
87
- return t >= a ? d(e, t, a, "day") : t >= i ? d(e, t, i, "hour") : t >= r ? d(e, t, r, "minute") : t >= n ? d(e, t, n, "second") : e + " ms";
88
- }
89
- function d(e, t, n, r) {
90
- var i = t >= n * 1.5;
91
- return Math.round(e / n) + " " + r + (i ? "s" : "");
92
- }
93
- })), f = /* @__PURE__ */ o(((e, t) => {
94
- function n(e) {
95
- n.debug = n, n.default = n, n.coerce = c, n.disable = o, n.enable = i, n.enabled = s, n.humanize = d(), n.destroy = l, Object.keys(e).forEach((t) => {
96
- n[t] = e[t];
97
- }), n.names = [], n.skips = [], n.formatters = {};
98
- function t(e) {
99
- let t = 0;
100
- for (let n = 0; n < e.length; n++) t = (t << 5) - t + e.charCodeAt(n), t |= 0;
101
- return n.colors[Math.abs(t) % n.colors.length];
102
- }
103
- n.selectColor = t;
104
- function n(e) {
105
- let t, i = null, a, o;
106
- function s(...e) {
107
- if (!s.enabled) return;
108
- let r = s, i = Number(/* @__PURE__ */ new Date());
109
- r.diff = i - (t || i), r.prev = t, r.curr = i, t = i, e[0] = n.coerce(e[0]), typeof e[0] != "string" && e.unshift("%O");
110
- let a = 0;
111
- e[0] = e[0].replace(/%([a-zA-Z%])/g, (t, i) => {
112
- if (t === "%%") return "%";
113
- a++;
114
- let o = n.formatters[i];
115
- if (typeof o == "function") {
116
- let n = e[a];
117
- t = o.call(r, n), e.splice(a, 1), a--;
118
- }
119
- return t;
120
- }), n.formatArgs.call(r, e), (r.log || n.log).apply(r, e);
121
- }
122
- return s.namespace = e, s.useColors = n.useColors(), s.color = n.selectColor(e), s.extend = r, s.destroy = n.destroy, Object.defineProperty(s, "enabled", {
123
- enumerable: !0,
124
- configurable: !1,
125
- get: () => i === null ? (a !== n.namespaces && (a = n.namespaces, o = n.enabled(e)), o) : i,
126
- set: (e) => {
127
- i = e;
128
- }
129
- }), typeof n.init == "function" && n.init(s), s;
130
- }
131
- function r(e, t) {
132
- let r = n(this.namespace + (t === void 0 ? ":" : t) + e);
133
- return r.log = this.log, r;
134
- }
135
- function i(e) {
136
- n.save(e), n.namespaces = e, n.names = [], n.skips = [];
137
- let t = (typeof e == "string" ? e : "").trim().replace(/\s+/g, ",").split(",").filter(Boolean);
138
- for (let e of t) e[0] === "-" ? n.skips.push(e.slice(1)) : n.names.push(e);
139
- }
140
- function a(e, t) {
141
- let n = 0, r = 0, i = -1, a = 0;
142
- for (; n < e.length;) if (r < t.length && (t[r] === e[n] || t[r] === "*")) t[r] === "*" ? (i = r, a = n, r++) : (n++, r++);
143
- else if (i !== -1) r = i + 1, a++, n = a;
144
- else return !1;
145
- for (; r < t.length && t[r] === "*";) r++;
146
- return r === t.length;
147
- }
148
- function o() {
149
- let e = [...n.names, ...n.skips.map((e) => "-" + e)].join(",");
150
- return n.enable(""), e;
151
- }
152
- function s(e) {
153
- for (let t of n.skips) if (a(e, t)) return !1;
154
- for (let t of n.names) if (a(e, t)) return !0;
155
- return !1;
156
- }
157
- function c(e) {
158
- return e instanceof Error ? e.stack || e.message : e;
159
- }
160
- function l() {
161
- console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
162
- }
163
- return n.enable(n.load()), n;
164
- }
165
- t.exports = n;
166
- })), p = /* @__PURE__ */ o(((e, t) => {
167
- e.formatArgs = r, e.save = i, e.load = a, e.useColors = n, e.storage = o(), e.destroy = (() => {
168
- let e = !1;
169
- return () => {
170
- e || (e = !0, console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."));
171
- };
172
- })(), e.colors = /* @__PURE__ */ "#0000CC.#0000FF.#0033CC.#0033FF.#0066CC.#0066FF.#0099CC.#0099FF.#00CC00.#00CC33.#00CC66.#00CC99.#00CCCC.#00CCFF.#3300CC.#3300FF.#3333CC.#3333FF.#3366CC.#3366FF.#3399CC.#3399FF.#33CC00.#33CC33.#33CC66.#33CC99.#33CCCC.#33CCFF.#6600CC.#6600FF.#6633CC.#6633FF.#66CC00.#66CC33.#9900CC.#9900FF.#9933CC.#9933FF.#99CC00.#99CC33.#CC0000.#CC0033.#CC0066.#CC0099.#CC00CC.#CC00FF.#CC3300.#CC3333.#CC3366.#CC3399.#CC33CC.#CC33FF.#CC6600.#CC6633.#CC9900.#CC9933.#CCCC00.#CCCC33.#FF0000.#FF0033.#FF0066.#FF0099.#FF00CC.#FF00FF.#FF3300.#FF3333.#FF3366.#FF3399.#FF33CC.#FF33FF.#FF6600.#FF6633.#FF9900.#FF9933.#FFCC00.#FFCC33".split(".");
173
- function n() {
174
- if (typeof window < "u" && window.process && (window.process.type === "renderer" || window.process.__nwjs)) return !0;
175
- if (typeof navigator < "u" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) return !1;
176
- let e;
177
- return typeof document < "u" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || typeof window < "u" && window.console && (window.console.firebug || window.console.exception && window.console.table) || typeof navigator < "u" && navigator.userAgent && (e = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(e[1], 10) >= 31 || typeof navigator < "u" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
178
- }
179
- function r(e) {
180
- if (e[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + e[0] + (this.useColors ? "%c " : " ") + "+" + t.exports.humanize(this.diff), !this.useColors) return;
181
- let n = "color: " + this.color;
182
- e.splice(1, 0, n, "color: inherit");
183
- let r = 0, i = 0;
184
- e[0].replace(/%[a-zA-Z%]/g, (e) => {
185
- e !== "%%" && (r++, e === "%c" && (i = r));
186
- }), e.splice(i, 0, n);
187
- }
188
- e.log = console.debug || console.log || (() => {});
189
- function i(t) {
190
- try {
191
- t ? e.storage.setItem("debug", t) : e.storage.removeItem("debug");
192
- } catch {}
193
- }
194
- function a() {
195
- let t;
196
- try {
197
- t = e.storage.getItem("debug") || e.storage.getItem("DEBUG");
198
- } catch {}
199
- return !t && typeof process < "u" && "env" in process && (t = process.env.DEBUG), t;
200
- }
201
- function o() {
202
- try {
203
- return localStorage;
204
- } catch {}
205
- }
206
- t.exports = f()(e);
207
- var { formatters: s } = t.exports;
208
- s.j = function(e) {
209
- try {
210
- return JSON.stringify(e);
211
- } catch (e) {
212
- return "[UnexpectedJSONParseError]: " + e.message;
213
- }
214
- };
215
- })), m = {
216
- translation: {
217
- categorize: {
218
- limitMaxChoicesPerCategory: "You've reached the limit of {{maxChoicesPerCategory}} responses per area. To add another response, one must first be removed.",
219
- maxChoicesPerCategoryRestriction: "To change this value to {{maxChoicesPerCategory}}, each category must have {{maxChoicesPerCategory}} or fewer answer choice[s]."
220
- },
221
- ebsr: { part: "Part {{index}}" },
222
- numberLine: {
223
- addElementLimit_one: "You can only add {{count}} element",
224
- addElementLimit_other: "You can only add {{count}} elements",
225
- clearAll: "Clear all"
226
- },
227
- imageClozeAssociation: {
228
- reachedLimit_one: "You’ve reached the limit of {{count}} response per area. To add another response, one must first be removed.",
229
- reachedLimit_other: "Full"
230
- },
231
- drawingResponse: {
232
- fillColor: "Fill color",
233
- outlineColor: "Outline color",
234
- noFill: "No fill",
235
- lightblue: "Light blue",
236
- lightyellow: "Light yellow",
237
- red: "Red",
238
- orange: "Orange",
239
- yellow: "Yellow",
240
- violet: "Violet",
241
- blue: "Blue",
242
- green: "Green",
243
- white: "White",
244
- black: "Black",
245
- onDoubleClick: "Double click to edit this text. Press Enter to submit."
246
- },
247
- charting: {
248
- addCategory: "Add category",
249
- actions: "Actions",
250
- add: "Add",
251
- delete: "Delete",
252
- newLabel: "New label",
253
- reachedLimit_other: "There can't be more than {{count}} categories.",
254
- keyLegend: {
255
- incorrectAnswer: "Student incorrect answer",
256
- correctAnswer: "Student correct answer",
257
- correctKeyAnswer: "Answer key correct"
258
- }
259
- },
260
- graphing: {
261
- point: "Point",
262
- circle: "Circle",
263
- line: "Line",
264
- parabola: "Parabola",
265
- absolute: "Absolute Value",
266
- exponential: "Exponential",
267
- polygon: "Polygon",
268
- ray: "Ray",
269
- segment: "Segment",
270
- sine: "Sine",
271
- vector: "Vector",
272
- label: "Label",
273
- redo: "Redo",
274
- reset: "Reset"
275
- },
276
- 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." },
277
- multipleChoice: {
278
- minSelections: "Select at least {{minSelections}}.",
279
- maxSelections_one: "Only {{maxSelections}} answer is allowed.",
280
- maxSelections_other: "Only {{maxSelections}} answers are allowed.",
281
- minmaxSelections_equal: "Select {{minSelections}}.",
282
- minmaxSelections_range: "Select between {{minSelections}} and {{maxSelections}}."
283
- },
284
- selectText: {
285
- correctAnswerSelected: "Correct",
286
- correctAnswerNotSelected: "Correct Answer Not Selected",
287
- incorrectSelection: "Incorrect Selection",
288
- key: "Key"
289
- }
290
- },
291
- common: {
292
- undo: "Undo",
293
- clearAll: "Clear all",
294
- correct: "Correct",
295
- incorrect: "Incorrect",
296
- showCorrectAnswer: "Show correct answer",
297
- hideCorrectAnswer: "Hide correct answer",
298
- 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.",
299
- warning: "Warning",
300
- showNote: "Show Note",
301
- hideNote: "Hide Note",
302
- cancel: "Cancel"
303
- }
304
- }, h = {
305
- translation: {
306
- categorize: {
307
- limitMaxChoicesPerCategory: "Has alcanzado el límite de {{maxChoicesPerCategory}} respuestas por área. Para agregar otra respuesta, primero se debe eliminar una respuesta.",
308
- maxChoicesPerCategoryRestriction: "Para cambiar este valor a {{maxChoicesPerCategory}}, cada categoría debe tener {{maxChoicesPerCategory}} o menos opciones de respuesta"
309
- },
310
- ebsr: { part: "Parte {{index}}" },
311
- numberLine: {
312
- addElementLimit_one: "Solo puedes agregar {{count}} elemento",
313
- addElementLimit_other: "Solo puedes agregar {{count}} elementos",
314
- clearAll: "Borrar todo"
315
- },
316
- imageClozeAssociation: {
317
- reachedLimit_one: "Has alcanzado el límite de {{count}} respuesta por área. Para agregar otra respuesta, primero se debe eliminar una respuesta.",
318
- reachedLimit_other: "Lleno"
319
- },
320
- drawingResponse: {
321
- fillColor: "Color de relleno",
322
- outlineColor: "Color del contorno",
323
- noFill: "Sin relleno",
324
- lightblue: "Azul claro",
325
- lightyellow: "Amarillo claro",
326
- red: "Rojo",
327
- orange: "Naranja",
328
- yellow: "Amarillo",
329
- violet: "Violeta",
330
- blue: "Azul",
331
- green: "Verde",
332
- white: "Blanco",
333
- black: "Negro",
334
- onDoubleClick: "Haz doble clic para revisar este texto. Presiona el botón de ingreso para enviar"
335
- },
336
- charting: {
337
- addCategory: "Añadir categoría",
338
- actions: "Acciones",
339
- add: "Añadir",
340
- delete: "Eliminar",
341
- newLabel: "Nueva etiqueta",
342
- reachedLimit_other: "No puede haber más de {{count}} categorías.",
343
- keyLegend: {
344
- incorrectAnswer: "Respuesta incorrecta del estudiante",
345
- correctAnswer: "Respuesta correcta del estudiante",
346
- correctKeyAnswer: "Clave de respuesta correcta"
347
- }
348
- },
349
- graphing: {
350
- point: "Punto",
351
- circle: "Circulo",
352
- line: "Línea",
353
- parabola: "Parábola",
354
- absolute: "Valor absoluto",
355
- exponential: "Exponencial",
356
- polygon: "Polígono",
357
- ray: "Semirrecta",
358
- segment: "Segmento ",
359
- sine: "Seno",
360
- vector: "Vector",
361
- label: "Etiqueta",
362
- redo: "Rehacer",
363
- reset: "Reiniciar"
364
- },
365
- 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." },
366
- multipleChoice: {
367
- minSelections: "Seleccione al menos {{minSelections}}.",
368
- maxSelections_one: "Sólo se permite {{maxSelections}} respuesta.",
369
- maxSelections_other: "Sólo se permiten {{maxSelections}} respuestas.",
370
- minmaxSelections_equal: "Seleccione {{minSelections}}.",
371
- minmaxSelections_range: "Seleccione entre {{minSelections}} y {{maxSelections}}."
372
- },
373
- selectText: {
374
- correctAnswerSelected: "Respuesta Correcta",
375
- correctAnswerNotSelected: "Respuesta Correcta No Seleccionada",
376
- incorrectSelection: "Selección Incorrecta",
377
- key: "Clave"
378
- }
379
- },
380
- common: {
381
- undo: "Deshacer",
382
- clearAll: "Borrar todo",
383
- correct: "Correct",
384
- incorrect: "Incorrect",
385
- showCorrectAnswer: "Mostrar respuesta correcta",
386
- hideCorrectAnswer: "Ocultar respuesta correcta",
387
- commonCorrectAnswerWithAlternates: "Nota: La respuesta que se muestra arriba es la respuesta correcta más común para esta pregunta. También se definen una o más respuestas correctas adicionales, y también se reconocerán como correctas.",
388
- warning: "Advertencia",
389
- showNote: "Mostrar Nota",
390
- hideNote: "Ocultar Nota",
391
- cancel: "Cancelar"
392
- }
393
- }, g = (e) => typeof e == "string", _ = () => {
394
- let e, t, n = new Promise((n, r) => {
395
- e = n, t = r;
396
- });
397
- return n.resolve = e, n.reject = t, n;
398
- }, v = (e) => e == null ? "" : "" + e, y = (e, t, n) => {
399
- e.forEach((e) => {
400
- t[e] && (n[e] = t[e]);
401
- });
402
- }, b = /###/g, x = (e) => e && e.indexOf("###") > -1 ? e.replace(b, ".") : e, S = (e) => !e || g(e), C = (e, t, n) => {
403
- let r = g(t) ? t.split(".") : t, i = 0;
404
- for (; i < r.length - 1;) {
405
- if (S(e)) return {};
406
- let t = x(r[i]);
407
- !e[t] && n && (e[t] = new n()), e = Object.prototype.hasOwnProperty.call(e, t) ? e[t] : {}, ++i;
408
- }
409
- return S(e) ? {} : {
410
- obj: e,
411
- k: x(r[i])
412
- };
413
- }, w = (e, t, n) => {
414
- let { obj: r, k: i } = C(e, t, Object);
415
- if (r !== void 0 || t.length === 1) {
416
- r[i] = n;
417
- return;
418
- }
419
- let a = t[t.length - 1], o = t.slice(0, t.length - 1), s = C(e, o, Object);
420
- for (; s.obj === void 0 && o.length;) a = `${o[o.length - 1]}.${a}`, o = o.slice(0, o.length - 1), s = C(e, o, Object), s?.obj && s.obj[`${s.k}.${a}`] !== void 0 && (s.obj = void 0);
421
- s.obj[`${s.k}.${a}`] = n;
422
- }, T = (e, t, n, r) => {
423
- let { obj: i, k: a } = C(e, t, Object);
424
- i[a] = i[a] || [], i[a].push(n);
425
- }, E = (e, t) => {
426
- let { obj: n, k: r } = C(e, t);
427
- if (n && Object.prototype.hasOwnProperty.call(n, r)) return n[r];
428
- }, D = (e, t, n) => {
429
- let r = E(e, n);
430
- return r === void 0 ? E(t, n) : r;
431
- }, O = (e, t, n) => {
432
- for (let r in t) r !== "__proto__" && r !== "constructor" && (r in e ? g(e[r]) || e[r] instanceof String || g(t[r]) || t[r] instanceof String ? n && (e[r] = t[r]) : O(e[r], t[r], n) : e[r] = t[r]);
433
- return e;
434
- }, k = (e) => e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"), ee = {
435
- "&": "&amp;",
436
- "<": "&lt;",
437
- ">": "&gt;",
438
- "\"": "&quot;",
439
- "'": "&#39;",
440
- "/": "&#x2F;"
441
- }, te = (e) => g(e) ? e.replace(/[&<>"'\/]/g, (e) => ee[e]) : e, ne = class {
442
- constructor(e) {
443
- this.capacity = e, this.regExpMap = /* @__PURE__ */ new Map(), this.regExpQueue = [];
444
- }
445
- getRegExp(e) {
446
- let t = this.regExpMap.get(e);
447
- if (t !== void 0) return t;
448
- let n = new RegExp(e);
449
- return this.regExpQueue.length === this.capacity && this.regExpMap.delete(this.regExpQueue.shift()), this.regExpMap.set(e, n), this.regExpQueue.push(e), n;
450
- }
451
- }, re = [
452
- " ",
453
- ",",
454
- "?",
455
- "!",
456
- ";"
457
- ], ie = new ne(20), ae = (e, t, n) => {
458
- t ||= "", n ||= "";
459
- let r = re.filter((e) => t.indexOf(e) < 0 && n.indexOf(e) < 0);
460
- if (r.length === 0) return !0;
461
- let i = ie.getRegExp(`(${r.map((e) => e === "?" ? "\\?" : e).join("|")})`), a = !i.test(e);
462
- if (!a) {
463
- let t = e.indexOf(n);
464
- t > 0 && !i.test(e.substring(0, t)) && (a = !0);
465
- }
466
- return a;
467
- }, A = (e, t, n = ".") => {
468
- if (!e) return;
469
- if (e[t]) return Object.prototype.hasOwnProperty.call(e, t) ? e[t] : void 0;
470
- let r = t.split(n), i = e;
471
- for (let e = 0; e < r.length;) {
472
- if (!i || typeof i != "object") return;
473
- let t, a = "";
474
- for (let o = e; o < r.length; ++o) if (o !== e && (a += n), a += r[o], t = i[a], t !== void 0) {
475
- if ([
476
- "string",
477
- "number",
478
- "boolean"
479
- ].indexOf(typeof t) > -1 && o < r.length - 1) continue;
480
- e += o - e + 1;
481
- break;
482
- }
483
- i = t;
484
- }
485
- return i;
486
- }, j = (e) => e?.replace(/_/g, "-"), oe = {
487
- type: "logger",
488
- log(e) {
489
- this.output("log", e);
490
- },
491
- warn(e) {
492
- this.output("warn", e);
493
- },
494
- error(e) {
495
- this.output("error", e);
496
- },
497
- output(e, t) {
498
- console?.[e]?.apply?.(console, t);
499
- }
500
- }, M = new class e {
501
- constructor(e, t = {}) {
502
- this.init(e, t);
503
- }
504
- init(e, t = {}) {
505
- this.prefix = t.prefix || "i18next:", this.logger = e || oe, this.options = t, this.debug = t.debug;
506
- }
507
- log(...e) {
508
- return this.forward(e, "log", "", !0);
509
- }
510
- warn(...e) {
511
- return this.forward(e, "warn", "", !0);
512
- }
513
- error(...e) {
514
- return this.forward(e, "error", "");
515
- }
516
- deprecate(...e) {
517
- return this.forward(e, "warn", "WARNING DEPRECATED: ", !0);
518
- }
519
- forward(e, t, n, r) {
520
- return r && !this.debug ? null : (g(e[0]) && (e[0] = `${n}${this.prefix} ${e[0]}`), this.logger[t](e));
521
- }
522
- create(t) {
523
- return new e(this.logger, {
524
- prefix: `${this.prefix}:${t}:`,
525
- ...this.options
526
- });
527
- }
528
- clone(t) {
529
- return t ||= this.options, t.prefix = t.prefix || this.prefix, new e(this.logger, t);
530
- }
531
- }(), N = class {
532
- constructor() {
533
- this.observers = {};
534
- }
535
- on(e, t) {
536
- return e.split(" ").forEach((e) => {
537
- this.observers[e] || (this.observers[e] = /* @__PURE__ */ new Map());
538
- let n = this.observers[e].get(t) || 0;
539
- this.observers[e].set(t, n + 1);
540
- }), this;
541
- }
542
- off(e, t) {
543
- if (this.observers[e]) {
544
- if (!t) {
545
- delete this.observers[e];
546
- return;
547
- }
548
- this.observers[e].delete(t);
549
- }
550
- }
551
- emit(e, ...t) {
552
- this.observers[e] && Array.from(this.observers[e].entries()).forEach(([e, n]) => {
553
- for (let r = 0; r < n; r++) e(...t);
554
- }), this.observers["*"] && Array.from(this.observers["*"].entries()).forEach(([n, r]) => {
555
- for (let i = 0; i < r; i++) n.apply(n, [e, ...t]);
556
- });
557
- }
558
- }, se = class extends N {
559
- constructor(e, t = {
560
- ns: ["translation"],
561
- defaultNS: "translation"
562
- }) {
563
- super(), this.data = e || {}, this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.options.ignoreJSONStructure === void 0 && (this.options.ignoreJSONStructure = !0);
564
- }
565
- addNamespaces(e) {
566
- this.options.ns.indexOf(e) < 0 && this.options.ns.push(e);
567
- }
568
- removeNamespaces(e) {
569
- let t = this.options.ns.indexOf(e);
570
- t > -1 && this.options.ns.splice(t, 1);
571
- }
572
- getResource(e, t, n, r = {}) {
573
- let i = r.keySeparator === void 0 ? this.options.keySeparator : r.keySeparator, a = r.ignoreJSONStructure === void 0 ? this.options.ignoreJSONStructure : r.ignoreJSONStructure, o;
574
- e.indexOf(".") > -1 ? o = e.split(".") : (o = [e, t], n && (Array.isArray(n) ? o.push(...n) : g(n) && i ? o.push(...n.split(i)) : o.push(n)));
575
- let s = E(this.data, o);
576
- return !s && !t && !n && e.indexOf(".") > -1 && (e = o[0], t = o[1], n = o.slice(2).join(".")), s || !a || !g(n) ? s : A(this.data?.[e]?.[t], n, i);
577
- }
578
- addResource(e, t, n, r, i = { silent: !1 }) {
579
- let a = i.keySeparator === void 0 ? this.options.keySeparator : i.keySeparator, o = [e, t];
580
- n && (o = o.concat(a ? n.split(a) : n)), e.indexOf(".") > -1 && (o = e.split("."), r = t, t = o[1]), this.addNamespaces(t), w(this.data, o, r), i.silent || this.emit("added", e, t, n, r);
581
- }
582
- addResources(e, t, n, r = { silent: !1 }) {
583
- for (let r in n) (g(n[r]) || Array.isArray(n[r])) && this.addResource(e, t, r, n[r], { silent: !0 });
584
- r.silent || this.emit("added", e, t, n);
585
- }
586
- addResourceBundle(e, t, n, r, i, a = {
587
- silent: !1,
588
- skipCopy: !1
589
- }) {
590
- let o = [e, t];
591
- e.indexOf(".") > -1 && (o = e.split("."), r = n, n = t, t = o[1]), this.addNamespaces(t);
592
- let s = E(this.data, o) || {};
593
- a.skipCopy || (n = JSON.parse(JSON.stringify(n))), r ? O(s, n, i) : s = {
594
- ...s,
595
- ...n
596
- }, w(this.data, o, s), a.silent || this.emit("added", e, t, n);
597
- }
598
- removeResourceBundle(e, t) {
599
- this.hasResourceBundle(e, t) && delete this.data[e][t], this.removeNamespaces(t), this.emit("removed", e, t);
600
- }
601
- hasResourceBundle(e, t) {
602
- return this.getResource(e, t) !== void 0;
603
- }
604
- getResourceBundle(e, t) {
605
- return t ||= this.options.defaultNS, this.getResource(e, t);
606
- }
607
- getDataByLanguage(e) {
608
- return this.data[e];
609
- }
610
- hasLanguageSomeTranslations(e) {
611
- let t = this.getDataByLanguage(e);
612
- return !!(t && Object.keys(t) || []).find((e) => t[e] && Object.keys(t[e]).length > 0);
613
- }
614
- toJSON() {
615
- return this.data;
616
- }
617
- }, P = {
618
- processors: {},
619
- addPostProcessor(e) {
620
- this.processors[e.name] = e;
621
- },
622
- handle(e, t, n, r, i) {
623
- return e.forEach((e) => {
624
- t = this.processors[e]?.process(t, n, r, i) ?? t;
625
- }), t;
626
- }
627
- }, ce = Symbol("i18next/PATH_KEY");
628
- function le() {
629
- let e = [], t = Object.create(null), n;
630
- return t.get = (r, i) => (n?.revoke?.(), i === ce ? e : (e.push(i), n = Proxy.revocable(r, t), n.proxy)), Proxy.revocable(Object.create(null), t).proxy;
631
- }
632
- function F(e, t) {
633
- let { [ce]: n } = e(le()), r = t?.keySeparator ?? ".", i = t?.nsSeparator ?? ":";
634
- if (n.length > 1 && i) {
635
- let e = t?.ns, a = Array.isArray(e) ? e : null;
636
- if (a && a.length > 1 && a.slice(1).includes(n[0])) return `${n[0]}${i}${n.slice(1).join(r)}`;
637
- }
638
- return n.join(r);
639
- }
640
- var ue = {}, I = (e) => !g(e) && typeof e != "boolean" && typeof e != "number", L = class e extends N {
641
- constructor(e, t = {}) {
642
- super(), y([
643
- "resourceStore",
644
- "languageUtils",
645
- "pluralResolver",
646
- "interpolator",
647
- "backendConnector",
648
- "i18nFormat",
649
- "utils"
650
- ], e, this), this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.logger = M.create("translator");
651
- }
652
- changeLanguage(e) {
653
- e && (this.language = e);
654
- }
655
- exists(e, t = { interpolation: {} }) {
656
- let n = { ...t };
657
- if (e == null) return !1;
658
- let r = this.resolve(e, n);
659
- if (r?.res === void 0) return !1;
660
- let i = I(r.res);
661
- return !(n.returnObjects === !1 && i);
662
- }
663
- extractFromKey(e, t) {
664
- let n = t.nsSeparator === void 0 ? this.options.nsSeparator : t.nsSeparator;
665
- n === void 0 && (n = ":");
666
- let r = t.keySeparator === void 0 ? this.options.keySeparator : t.keySeparator, i = t.ns || this.options.defaultNS || [], a = n && e.indexOf(n) > -1, o = !this.options.userDefinedKeySeparator && !t.keySeparator && !this.options.userDefinedNsSeparator && !t.nsSeparator && !ae(e, n, r);
667
- if (a && !o) {
668
- let t = e.match(this.interpolator.nestingRegexp);
669
- if (t && t.length > 0) return {
670
- key: e,
671
- namespaces: g(i) ? [i] : i
672
- };
673
- let a = e.split(n);
674
- (n !== r || n === r && this.options.ns.indexOf(a[0]) > -1) && (i = a.shift()), e = a.join(r);
675
- }
676
- return {
677
- key: e,
678
- namespaces: g(i) ? [i] : i
679
- };
680
- }
681
- translate(t, n, r) {
682
- let i = typeof n == "object" ? { ...n } : n;
683
- if (typeof i != "object" && this.options.overloadTranslationOptionHandler && (i = this.options.overloadTranslationOptionHandler(arguments)), typeof i == "object" && (i = { ...i }), i ||= {}, t == null) return "";
684
- typeof t == "function" && (t = F(t, {
685
- ...this.options,
686
- ...i
687
- })), Array.isArray(t) || (t = [String(t)]), t = t.map((e) => typeof e == "function" ? F(e, {
688
- ...this.options,
689
- ...i
690
- }) : String(e));
691
- let a = i.returnDetails === void 0 ? this.options.returnDetails : i.returnDetails, o = i.keySeparator === void 0 ? this.options.keySeparator : i.keySeparator, { key: s, namespaces: c } = this.extractFromKey(t[t.length - 1], i), l = c[c.length - 1], u = i.nsSeparator === void 0 ? this.options.nsSeparator : i.nsSeparator;
692
- u === void 0 && (u = ":");
693
- let d = i.lng || this.language, f = i.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;
694
- if (d?.toLowerCase() === "cimode") return f ? a ? {
695
- res: `${l}${u}${s}`,
696
- usedKey: s,
697
- exactUsedKey: s,
698
- usedLng: d,
699
- usedNS: l,
700
- usedParams: this.getUsedParamsDetails(i)
701
- } : `${l}${u}${s}` : a ? {
702
- res: s,
703
- usedKey: s,
704
- exactUsedKey: s,
705
- usedLng: d,
706
- usedNS: l,
707
- usedParams: this.getUsedParamsDetails(i)
708
- } : s;
709
- let p = this.resolve(t, i), m = p?.res, h = p?.usedKey || s, _ = p?.exactUsedKey || s, v = [
710
- "[object Number]",
711
- "[object Function]",
712
- "[object RegExp]"
713
- ], y = i.joinArrays === void 0 ? this.options.joinArrays : i.joinArrays, b = !this.i18nFormat || this.i18nFormat.handleAsObject, x = i.count !== void 0 && !g(i.count), S = e.hasDefaultValue(i), C = x ? this.pluralResolver.getSuffix(d, i.count, i) : "", w = i.ordinal && x ? this.pluralResolver.getSuffix(d, i.count, { ordinal: !1 }) : "", T = x && !i.ordinal && i.count === 0, E = T && i[`defaultValue${this.options.pluralSeparator}zero`] || i[`defaultValue${C}`] || i[`defaultValue${w}`] || i.defaultValue, D = m;
714
- b && !m && S && (D = E);
715
- let O = I(D), k = Object.prototype.toString.apply(D);
716
- if (b && D && O && v.indexOf(k) < 0 && !(g(y) && Array.isArray(D))) {
717
- if (!i.returnObjects && !this.options.returnObjects) {
718
- this.options.returnedObjectHandler || this.logger.warn("accessing an object - but returnObjects options is not enabled!");
719
- let e = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(h, D, {
720
- ...i,
721
- ns: c
722
- }) : `key '${s} (${this.language})' returned an object instead of string.`;
723
- return a ? (p.res = e, p.usedParams = this.getUsedParamsDetails(i), p) : e;
724
- }
725
- if (o) {
726
- let e = Array.isArray(D), t = e ? [] : {}, n = e ? _ : h;
727
- for (let e in D) if (Object.prototype.hasOwnProperty.call(D, e)) {
728
- let r = `${n}${o}${e}`;
729
- S && !m ? t[e] = this.translate(r, {
730
- ...i,
731
- defaultValue: I(E) ? E[e] : void 0,
732
- joinArrays: !1,
733
- ns: c
734
- }) : t[e] = this.translate(r, {
735
- ...i,
736
- joinArrays: !1,
737
- ns: c
738
- }), t[e] === r && (t[e] = D[e]);
739
- }
740
- m = t;
741
- }
742
- } else if (b && g(y) && Array.isArray(m)) m = m.join(y), m &&= this.extendTranslation(m, t, i, r);
743
- else {
744
- let e = !1, n = !1;
745
- !this.isValidLookup(m) && S && (e = !0, m = E), this.isValidLookup(m) || (n = !0, m = s);
746
- let a = (i.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && n ? void 0 : m, c = S && E !== m && this.options.updateMissing;
747
- if (n || e || c) {
748
- if (this.logger.log(c ? "updateKey" : "missingKey", d, l, s, c ? E : m), o) {
749
- let e = this.resolve(s, {
750
- ...i,
751
- keySeparator: !1
752
- });
753
- e && e.res && this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.");
754
- }
755
- let e = [], t = this.languageUtils.getFallbackCodes(this.options.fallbackLng, i.lng || this.language);
756
- if (this.options.saveMissingTo === "fallback" && t && t[0]) for (let n = 0; n < t.length; n++) e.push(t[n]);
757
- else this.options.saveMissingTo === "all" ? e = this.languageUtils.toResolveHierarchy(i.lng || this.language) : e.push(i.lng || this.language);
758
- let n = (e, t, n) => {
759
- let r = S && n !== m ? n : a;
760
- this.options.missingKeyHandler ? this.options.missingKeyHandler(e, l, t, r, c, i) : this.backendConnector?.saveMissing && this.backendConnector.saveMissing(e, l, t, r, c, i), this.emit("missingKey", e, l, t, m);
761
- };
762
- this.options.saveMissing && (this.options.saveMissingPlurals && x ? e.forEach((e) => {
763
- let t = this.pluralResolver.getSuffixes(e, i);
764
- T && i[`defaultValue${this.options.pluralSeparator}zero`] && t.indexOf(`${this.options.pluralSeparator}zero`) < 0 && t.push(`${this.options.pluralSeparator}zero`), t.forEach((t) => {
765
- n([e], s + t, i[`defaultValue${t}`] || E);
766
- });
767
- }) : n(e, s, E));
768
- }
769
- m = this.extendTranslation(m, t, i, p, r), n && m === s && this.options.appendNamespaceToMissingKey && (m = `${l}${u}${s}`), (n || e) && this.options.parseMissingKeyHandler && (m = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${l}${u}${s}` : s, e ? m : void 0, i));
770
- }
771
- return a ? (p.res = m, p.usedParams = this.getUsedParamsDetails(i), p) : m;
772
- }
773
- extendTranslation(e, t, n, r, i) {
774
- if (this.i18nFormat?.parse) e = this.i18nFormat.parse(e, {
775
- ...this.options.interpolation.defaultVariables,
776
- ...n
777
- }, n.lng || this.language || r.usedLng, r.usedNS, r.usedKey, { resolved: r });
778
- else if (!n.skipInterpolation) {
779
- n.interpolation && this.interpolator.init({
780
- ...n,
781
- interpolation: {
782
- ...this.options.interpolation,
783
- ...n.interpolation
784
- }
785
- });
786
- let a = g(e) && (n?.interpolation?.skipOnVariables === void 0 ? this.options.interpolation.skipOnVariables : n.interpolation.skipOnVariables), o;
787
- if (a) {
788
- let t = e.match(this.interpolator.nestingRegexp);
789
- o = t && t.length;
790
- }
791
- let s = n.replace && !g(n.replace) ? n.replace : n;
792
- if (this.options.interpolation.defaultVariables && (s = {
793
- ...this.options.interpolation.defaultVariables,
794
- ...s
795
- }), e = this.interpolator.interpolate(e, s, n.lng || this.language || r.usedLng, n), a) {
796
- let t = e.match(this.interpolator.nestingRegexp), r = t && t.length;
797
- o < r && (n.nest = !1);
798
- }
799
- !n.lng && r && r.res && (n.lng = this.language || r.usedLng), n.nest !== !1 && (e = this.interpolator.nest(e, (...e) => i?.[0] === e[0] && !n.context ? (this.logger.warn(`It seems you are nesting recursively key: ${e[0]} in key: ${t[0]}`), null) : this.translate(...e, t), n)), n.interpolation && this.interpolator.reset();
800
- }
801
- let a = n.postProcess || this.options.postProcess, o = g(a) ? [a] : a;
802
- return e != null && o?.length && n.applyPostProcessor !== !1 && (e = P.handle(o, e, t, this.options && this.options.postProcessPassResolved ? {
803
- i18nResolved: {
804
- ...r,
805
- usedParams: this.getUsedParamsDetails(n)
806
- },
807
- ...n
808
- } : n, this)), e;
809
- }
810
- resolve(e, t = {}) {
811
- let n, r, i, a, o;
812
- return g(e) && (e = [e]), Array.isArray(e) && (e = e.map((e) => typeof e == "function" ? F(e, {
813
- ...this.options,
814
- ...t
815
- }) : e)), e.forEach((e) => {
816
- if (this.isValidLookup(n)) return;
817
- let s = this.extractFromKey(e, t), c = s.key;
818
- r = c;
819
- let l = s.namespaces;
820
- this.options.fallbackNS && (l = l.concat(this.options.fallbackNS));
821
- let u = t.count !== void 0 && !g(t.count), d = u && !t.ordinal && t.count === 0, f = t.context !== void 0 && (g(t.context) || typeof t.context == "number") && t.context !== "", p = t.lngs ? t.lngs : this.languageUtils.toResolveHierarchy(t.lng || this.language, t.fallbackLng);
822
- l.forEach((e) => {
823
- this.isValidLookup(n) || (o = e, !ue[`${p[0]}-${e}`] && this.utils?.hasLoadedNamespace && !this.utils?.hasLoadedNamespace(o) && (ue[`${p[0]}-${e}`] = !0, this.logger.warn(`key "${r}" for languages "${p.join(", ")}" won't get resolved as namespace "${o}" was not yet loaded`, "This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")), p.forEach((r) => {
824
- if (this.isValidLookup(n)) return;
825
- a = r;
826
- let o = [c];
827
- if (this.i18nFormat?.addLookupKeys) this.i18nFormat.addLookupKeys(o, c, r, e, t);
828
- else {
829
- let e;
830
- u && (e = this.pluralResolver.getSuffix(r, t.count, t));
831
- let n = `${this.options.pluralSeparator}zero`, i = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;
832
- if (u && (t.ordinal && e.indexOf(i) === 0 && o.push(c + e.replace(i, this.options.pluralSeparator)), o.push(c + e), d && o.push(c + n)), f) {
833
- let r = `${c}${this.options.contextSeparator || "_"}${t.context}`;
834
- o.push(r), u && (t.ordinal && e.indexOf(i) === 0 && o.push(r + e.replace(i, this.options.pluralSeparator)), o.push(r + e), d && o.push(r + n));
835
- }
836
- }
837
- let s;
838
- for (; s = o.pop();) this.isValidLookup(n) || (i = s, n = this.getResource(r, e, s, t));
839
- }));
840
- });
841
- }), {
842
- res: n,
843
- usedKey: r,
844
- exactUsedKey: i,
845
- usedLng: a,
846
- usedNS: o
847
- };
848
- }
849
- isValidLookup(e) {
850
- return e !== void 0 && !(!this.options.returnNull && e === null) && !(!this.options.returnEmptyString && e === "");
851
- }
852
- getResource(e, t, n, r = {}) {
853
- return this.i18nFormat?.getResource ? this.i18nFormat.getResource(e, t, n, r) : this.resourceStore.getResource(e, t, n, r);
854
- }
855
- getUsedParamsDetails(e = {}) {
856
- let t = [
857
- "defaultValue",
858
- "ordinal",
859
- "context",
860
- "replace",
861
- "lng",
862
- "lngs",
863
- "fallbackLng",
864
- "ns",
865
- "keySeparator",
866
- "nsSeparator",
867
- "returnObjects",
868
- "returnDetails",
869
- "joinArrays",
870
- "postProcess",
871
- "interpolation"
872
- ], n = e.replace && !g(e.replace), r = n ? e.replace : e;
873
- if (n && e.count !== void 0 && (r.count = e.count), this.options.interpolation.defaultVariables && (r = {
874
- ...this.options.interpolation.defaultVariables,
875
- ...r
876
- }), !n) {
877
- r = { ...r };
878
- for (let e of t) delete r[e];
879
- }
880
- return r;
881
- }
882
- static hasDefaultValue(e) {
883
- for (let t in e) if (Object.prototype.hasOwnProperty.call(e, t) && t.substring(0, 12) === "defaultValue" && e[t] !== void 0) return !0;
884
- return !1;
885
- }
886
- }, R = class {
887
- constructor(e) {
888
- this.options = e, this.supportedLngs = this.options.supportedLngs || !1, this.logger = M.create("languageUtils");
889
- }
890
- getScriptPartFromCode(e) {
891
- if (e = j(e), !e || e.indexOf("-") < 0) return null;
892
- let t = e.split("-");
893
- return t.length === 2 || (t.pop(), t[t.length - 1].toLowerCase() === "x") ? null : this.formatLanguageCode(t.join("-"));
894
- }
895
- getLanguagePartFromCode(e) {
896
- if (e = j(e), !e || e.indexOf("-") < 0) return e;
897
- let t = e.split("-");
898
- return this.formatLanguageCode(t[0]);
899
- }
900
- formatLanguageCode(e) {
901
- if (g(e) && e.indexOf("-") > -1) {
902
- let t;
903
- try {
904
- t = Intl.getCanonicalLocales(e)[0];
905
- } catch {}
906
- return t && this.options.lowerCaseLng && (t = t.toLowerCase()), t || (this.options.lowerCaseLng ? e.toLowerCase() : e);
907
- }
908
- return this.options.cleanCode || this.options.lowerCaseLng ? e.toLowerCase() : e;
909
- }
910
- isSupportedCode(e) {
911
- return (this.options.load === "languageOnly" || this.options.nonExplicitSupportedLngs) && (e = this.getLanguagePartFromCode(e)), !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.indexOf(e) > -1;
912
- }
913
- getBestMatchFromCodes(e) {
914
- if (!e) return null;
915
- let t;
916
- return e.forEach((e) => {
917
- if (t) return;
918
- let n = this.formatLanguageCode(e);
919
- (!this.options.supportedLngs || this.isSupportedCode(n)) && (t = n);
920
- }), !t && this.options.supportedLngs && e.forEach((e) => {
921
- if (t) return;
922
- let n = this.getScriptPartFromCode(e);
923
- if (this.isSupportedCode(n)) return t = n;
924
- let r = this.getLanguagePartFromCode(e);
925
- if (this.isSupportedCode(r)) return t = r;
926
- t = this.options.supportedLngs.find((e) => {
927
- if (e === r || !(e.indexOf("-") < 0 && r.indexOf("-") < 0) && (e.indexOf("-") > 0 && r.indexOf("-") < 0 && e.substring(0, e.indexOf("-")) === r || e.indexOf(r) === 0 && r.length > 1)) return e;
928
- });
929
- }), t ||= this.getFallbackCodes(this.options.fallbackLng)[0], t;
930
- }
931
- getFallbackCodes(e, t) {
932
- if (!e) return [];
933
- if (typeof e == "function" && (e = e(t)), g(e) && (e = [e]), Array.isArray(e)) return e;
934
- if (!t) return e.default || [];
935
- let n = e[t];
936
- return n ||= e[this.getScriptPartFromCode(t)], n ||= e[this.formatLanguageCode(t)], n ||= e[this.getLanguagePartFromCode(t)], n ||= e.default, n || [];
937
- }
938
- toResolveHierarchy(e, t) {
939
- let n = this.getFallbackCodes((t === !1 ? [] : t) || this.options.fallbackLng || [], e), r = [], i = (e) => {
940
- e && (this.isSupportedCode(e) ? r.push(e) : this.logger.warn(`rejecting language code not found in supportedLngs: ${e}`));
941
- };
942
- return g(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))) : g(e) && i(this.formatLanguageCode(e)), n.forEach((e) => {
943
- r.indexOf(e) < 0 && i(this.formatLanguageCode(e));
944
- }), r;
945
- }
946
- }, z = {
947
- zero: 0,
948
- one: 1,
949
- two: 2,
950
- few: 3,
951
- many: 4,
952
- other: 5
953
- }, B = {
954
- select: (e) => e === 1 ? "one" : "other",
955
- resolvedOptions: () => ({ pluralCategories: ["one", "other"] })
956
- }, de = class {
957
- constructor(e, t = {}) {
958
- this.languageUtils = e, this.options = t, this.logger = M.create("pluralResolver"), this.pluralRulesCache = {};
959
- }
960
- clearCache() {
961
- this.pluralRulesCache = {};
962
- }
963
- getRule(e, t = {}) {
964
- let n = j(e === "dev" ? "en" : e), r = t.ordinal ? "ordinal" : "cardinal", i = JSON.stringify({
965
- cleanedCode: n,
966
- type: r
967
- });
968
- if (i in this.pluralRulesCache) return this.pluralRulesCache[i];
969
- let a;
970
- try {
971
- a = new Intl.PluralRules(n, { type: r });
972
- } catch {
973
- if (typeof Intl > "u") return this.logger.error("No Intl support, please use an Intl polyfill!"), B;
974
- if (!e.match(/-|_/)) return B;
975
- let n = this.languageUtils.getLanguagePartFromCode(e);
976
- a = this.getRule(n, t);
977
- }
978
- return this.pluralRulesCache[i] = a, a;
979
- }
980
- needsPlural(e, t = {}) {
981
- let n = this.getRule(e, t);
982
- return n ||= this.getRule("dev", t), n?.resolvedOptions().pluralCategories.length > 1;
983
- }
984
- getPluralFormsOfKey(e, t, n = {}) {
985
- return this.getSuffixes(e, n).map((e) => `${t}${e}`);
986
- }
987
- getSuffixes(e, t = {}) {
988
- let n = this.getRule(e, t);
989
- return n ||= this.getRule("dev", t), n ? n.resolvedOptions().pluralCategories.sort((e, t) => z[e] - z[t]).map((e) => `${this.options.prepend}${t.ordinal ? `ordinal${this.options.prepend}` : ""}${e}`) : [];
990
- }
991
- getSuffix(e, t, n = {}) {
992
- let r = this.getRule(e, n);
993
- return r ? `${this.options.prepend}${n.ordinal ? `ordinal${this.options.prepend}` : ""}${r.select(t)}` : (this.logger.warn(`no plural rule found for: ${e}`), this.getSuffix("dev", t, n));
994
- }
995
- }, V = (e, t, n, r = ".", i = !0) => {
996
- let a = D(e, t, n);
997
- return !a && i && g(n) && (a = A(e, n, r), a === void 0 && (a = A(t, n, r))), a;
998
- }, H = (e) => e.replace(/\$/g, "$$$$"), U = class {
999
- constructor(e = {}) {
1000
- this.logger = M.create("interpolator"), this.options = e, this.format = e?.interpolation?.format || ((e) => e), this.init(e);
1001
- }
1002
- init(e = {}) {
1003
- e.interpolation ||= { escapeValue: !0 };
1004
- let { escape: t, escapeValue: n, useRawValueToEscape: r, prefix: i, prefixEscaped: a, suffix: o, suffixEscaped: s, formatSeparator: c, unescapeSuffix: l, unescapePrefix: u, nestingPrefix: d, nestingPrefixEscaped: f, nestingSuffix: p, nestingSuffixEscaped: m, nestingOptionsSeparator: h, maxReplaces: g, alwaysFormat: _ } = e.interpolation;
1005
- this.escape = t === void 0 ? te : t, this.escapeValue = n === void 0 ? !0 : n, this.useRawValueToEscape = r === void 0 ? !1 : r, this.prefix = i ? k(i) : a || "{{", this.suffix = o ? k(o) : s || "}}", this.formatSeparator = c || ",", this.unescapePrefix = l ? "" : u || "-", this.unescapeSuffix = this.unescapePrefix ? "" : l || "", this.nestingPrefix = d ? k(d) : f || k("$t("), this.nestingSuffix = p ? k(p) : m || k(")"), this.nestingOptionsSeparator = h || ",", this.maxReplaces = g || 1e3, this.alwaysFormat = _ === void 0 ? !1 : _, this.resetRegExp();
1006
- }
1007
- reset() {
1008
- this.options && this.init(this.options);
1009
- }
1010
- resetRegExp() {
1011
- let e = (e, t) => e?.source === t ? (e.lastIndex = 0, e) : new RegExp(t, "g");
1012
- this.regexp = e(this.regexp, `${this.prefix}(.+?)${this.suffix}`), this.regexpUnescape = e(this.regexpUnescape, `${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`), this.nestingRegexp = e(this.nestingRegexp, `${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`);
1013
- }
1014
- interpolate(e, t, n, r) {
1015
- let i, a, o, s = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {}, c = (e) => {
1016
- if (e.indexOf(this.formatSeparator) < 0) {
1017
- let i = V(t, s, e, this.options.keySeparator, this.options.ignoreJSONStructure);
1018
- return this.alwaysFormat ? this.format(i, void 0, n, {
1019
- ...r,
1020
- ...t,
1021
- interpolationkey: e
1022
- }) : i;
1023
- }
1024
- let i = e.split(this.formatSeparator), a = i.shift().trim(), o = i.join(this.formatSeparator).trim();
1025
- return this.format(V(t, s, a, this.options.keySeparator, this.options.ignoreJSONStructure), o, n, {
1026
- ...r,
1027
- ...t,
1028
- interpolationkey: a
1029
- });
1030
- };
1031
- this.resetRegExp();
1032
- let l = r?.missingInterpolationHandler || this.options.missingInterpolationHandler, u = r?.interpolation?.skipOnVariables === void 0 ? this.options.interpolation.skipOnVariables : r.interpolation.skipOnVariables;
1033
- return [{
1034
- regex: this.regexpUnescape,
1035
- safeValue: (e) => H(e)
1036
- }, {
1037
- regex: this.regexp,
1038
- safeValue: (e) => this.escapeValue ? H(this.escape(e)) : H(e)
1039
- }].forEach((t) => {
1040
- for (o = 0; i = t.regex.exec(e);) {
1041
- let n = i[1].trim();
1042
- if (a = c(n), a === void 0) if (typeof l == "function") {
1043
- let t = l(e, i, r);
1044
- a = g(t) ? t : "";
1045
- } else if (r && Object.prototype.hasOwnProperty.call(r, n)) a = "";
1046
- else if (u) {
1047
- a = i[0];
1048
- continue;
1049
- } else this.logger.warn(`missed to pass in variable ${n} for interpolating ${e}`), a = "";
1050
- else !g(a) && !this.useRawValueToEscape && (a = v(a));
1051
- let s = t.safeValue(a);
1052
- if (e = e.replace(i[0], s), u ? (t.regex.lastIndex += a.length, t.regex.lastIndex -= i[0].length) : t.regex.lastIndex = 0, o++, o >= this.maxReplaces) break;
1053
- }
1054
- }), e;
1055
- }
1056
- nest(e, t, n = {}) {
1057
- let r, i, a, o = (e, t) => {
1058
- let n = this.nestingOptionsSeparator;
1059
- if (e.indexOf(n) < 0) return e;
1060
- let r = e.split(RegExp(`${k(n)}[ ]*{`)), i = `{${r[1]}`;
1061
- e = r[0], i = this.interpolate(i, a);
1062
- let o = i.match(/'/g), s = i.match(/"/g);
1063
- ((o?.length ?? 0) % 2 == 0 && !s || (s?.length ?? 0) % 2 != 0) && (i = i.replace(/'/g, "\""));
1064
- try {
1065
- a = JSON.parse(i), t && (a = {
1066
- ...t,
1067
- ...a
1068
- });
1069
- } catch (t) {
1070
- return this.logger.warn(`failed parsing options string in nesting for key ${e}`, t), `${e}${n}${i}`;
1071
- }
1072
- return a.defaultValue && a.defaultValue.indexOf(this.prefix) > -1 && delete a.defaultValue, e;
1073
- };
1074
- for (; r = this.nestingRegexp.exec(e);) {
1075
- let s = [];
1076
- a = { ...n }, a = a.replace && !g(a.replace) ? a.replace : a, a.applyPostProcessor = !1, delete a.defaultValue;
1077
- let c = /{.*}/.test(r[1]) ? r[1].lastIndexOf("}") + 1 : r[1].indexOf(this.formatSeparator);
1078
- if (c !== -1 && (s = r[1].slice(c).split(this.formatSeparator).map((e) => e.trim()).filter(Boolean), r[1] = r[1].slice(0, c)), i = t(o.call(this, r[1].trim(), a), a), i && r[0] === e && !g(i)) return i;
1079
- g(i) || (i = v(i)), i ||= (this.logger.warn(`missed to resolve ${r[1]} for nesting ${e}`), ""), s.length && (i = s.reduce((e, t) => this.format(e, t, n.lng, {
1080
- ...n,
1081
- interpolationkey: r[1].trim()
1082
- }), i.trim())), e = e.replace(r[0], i), this.regexp.lastIndex = 0;
1083
- }
1084
- return e;
1085
- }
1086
- }, fe = (e) => {
1087
- let t = e.toLowerCase().trim(), n = {};
1088
- if (e.indexOf("(") > -1) {
1089
- let r = e.split("(");
1090
- t = r[0].toLowerCase().trim();
1091
- let i = r[1].substring(0, r[1].length - 1);
1092
- t === "currency" && i.indexOf(":") < 0 ? n.currency ||= i.trim() : t === "relativetime" && i.indexOf(":") < 0 ? n.range ||= i.trim() : i.split(";").forEach((e) => {
1093
- if (e) {
1094
- let [t, ...r] = e.split(":"), i = r.join(":").trim().replace(/^'+|'+$/g, ""), a = t.trim();
1095
- n[a] || (n[a] = i), i === "false" && (n[a] = !1), i === "true" && (n[a] = !0), isNaN(i) || (n[a] = parseInt(i, 10));
1096
- }
1097
- });
1098
- }
1099
- return {
1100
- formatName: t,
1101
- formatOptions: n
1102
- };
1103
- }, W = (e) => {
1104
- let t = {};
1105
- return (n, r, i) => {
1106
- let a = i;
1107
- i && i.interpolationkey && i.formatParams && i.formatParams[i.interpolationkey] && i[i.interpolationkey] && (a = {
1108
- ...a,
1109
- [i.interpolationkey]: void 0
1110
- });
1111
- let o = r + JSON.stringify(a), s = t[o];
1112
- return s || (s = e(j(r), i), t[o] = s), s(n);
1113
- };
1114
- }, pe = (e) => (t, n, r) => e(j(n), r)(t), me = class {
1115
- constructor(e = {}) {
1116
- this.logger = M.create("formatter"), this.options = e, this.init(e);
1117
- }
1118
- init(e, t = { interpolation: {} }) {
1119
- this.formatSeparator = t.interpolation.formatSeparator || ",";
1120
- let n = t.cacheInBuiltFormats ? W : pe;
1121
- this.formats = {
1122
- number: n((e, t) => {
1123
- let n = new Intl.NumberFormat(e, { ...t });
1124
- return (e) => n.format(e);
1125
- }),
1126
- currency: n((e, t) => {
1127
- let n = new Intl.NumberFormat(e, {
1128
- ...t,
1129
- style: "currency"
1130
- });
1131
- return (e) => n.format(e);
1132
- }),
1133
- datetime: n((e, t) => {
1134
- let n = new Intl.DateTimeFormat(e, { ...t });
1135
- return (e) => n.format(e);
1136
- }),
1137
- relativetime: n((e, t) => {
1138
- let n = new Intl.RelativeTimeFormat(e, { ...t });
1139
- return (e) => n.format(e, t.range || "day");
1140
- }),
1141
- list: n((e, t) => {
1142
- let n = new Intl.ListFormat(e, { ...t });
1143
- return (e) => n.format(e);
1144
- })
1145
- };
1146
- }
1147
- add(e, t) {
1148
- this.formats[e.toLowerCase().trim()] = t;
1149
- }
1150
- addCached(e, t) {
1151
- this.formats[e.toLowerCase().trim()] = W(t);
1152
- }
1153
- format(e, t, n, r = {}) {
1154
- let i = t.split(this.formatSeparator);
1155
- if (i.length > 1 && i[0].indexOf("(") > 1 && i[0].indexOf(")") < 0 && i.find((e) => e.indexOf(")") > -1)) {
1156
- let e = i.findIndex((e) => e.indexOf(")") > -1);
1157
- i[0] = [i[0], ...i.splice(1, e)].join(this.formatSeparator);
1158
- }
1159
- return i.reduce((e, t) => {
1160
- let { formatName: i, formatOptions: a } = fe(t);
1161
- if (this.formats[i]) {
1162
- let t = e;
1163
- try {
1164
- let o = r?.formatParams?.[r.interpolationkey] || {}, s = o.locale || o.lng || r.locale || r.lng || n;
1165
- t = this.formats[i](e, s, {
1166
- ...a,
1167
- ...r,
1168
- ...o
1169
- });
1170
- } catch (e) {
1171
- this.logger.warn(e);
1172
- }
1173
- return t;
1174
- } else this.logger.warn(`there was no format function for ${i}`);
1175
- return e;
1176
- }, e);
1177
- }
1178
- }, he = (e, t) => {
1179
- e.pending[t] !== void 0 && (delete e.pending[t], e.pendingCount--);
1180
- }, ge = class extends N {
1181
- constructor(e, t, n, r = {}) {
1182
- super(), this.backend = e, this.store = t, this.services = n, this.languageUtils = n.languageUtils, this.options = r, this.logger = M.create("backendConnector"), this.waitingReads = [], this.maxParallelReads = r.maxParallelReads || 10, this.readingCalls = 0, this.maxRetries = r.maxRetries >= 0 ? r.maxRetries : 5, this.retryTimeout = r.retryTimeout >= 1 ? r.retryTimeout : 350, this.state = {}, this.queue = [], this.backend?.init?.(n, r.backend, r);
1183
- }
1184
- queueLoad(e, t, n, r) {
1185
- let i = {}, a = {}, o = {}, s = {};
1186
- return e.forEach((e) => {
1187
- let r = !0;
1188
- t.forEach((t) => {
1189
- let o = `${e}|${t}`;
1190
- !n.reload && this.store.hasResourceBundle(e, t) ? this.state[o] = 2 : this.state[o] < 0 || (this.state[o] === 1 ? a[o] === void 0 && (a[o] = !0) : (this.state[o] = 1, r = !1, a[o] === void 0 && (a[o] = !0), i[o] === void 0 && (i[o] = !0), s[t] === void 0 && (s[t] = !0)));
1191
- }), r || (o[e] = !0);
1192
- }), (Object.keys(i).length || Object.keys(a).length) && this.queue.push({
1193
- pending: a,
1194
- pendingCount: Object.keys(a).length,
1195
- loaded: {},
1196
- errors: [],
1197
- callback: r
1198
- }), {
1199
- toLoad: Object.keys(i),
1200
- pending: Object.keys(a),
1201
- toLoadLanguages: Object.keys(o),
1202
- toLoadNamespaces: Object.keys(s)
1203
- };
1204
- }
1205
- loaded(e, t, n) {
1206
- let r = e.split("|"), i = r[0], a = r[1];
1207
- t && this.emit("failedLoading", i, a, t), !t && n && this.store.addResourceBundle(i, a, n, void 0, void 0, { skipCopy: !0 }), this.state[e] = t ? -1 : 2, t && n && (this.state[e] = 0);
1208
- let o = {};
1209
- this.queue.forEach((n) => {
1210
- T(n.loaded, [i], a), he(n, e), t && n.errors.push(t), n.pendingCount === 0 && !n.done && (Object.keys(n.loaded).forEach((e) => {
1211
- o[e] || (o[e] = {});
1212
- let t = n.loaded[e];
1213
- t.length && t.forEach((t) => {
1214
- o[e][t] === void 0 && (o[e][t] = !0);
1215
- });
1216
- }), n.done = !0, n.errors.length ? n.callback(n.errors) : n.callback());
1217
- }), this.emit("loaded", o), this.queue = this.queue.filter((e) => !e.done);
1218
- }
1219
- read(e, t, n, r = 0, i = this.retryTimeout, a) {
1220
- if (!e.length) return a(null, {});
1221
- if (this.readingCalls >= this.maxParallelReads) {
1222
- this.waitingReads.push({
1223
- lng: e,
1224
- ns: t,
1225
- fcName: n,
1226
- tried: r,
1227
- wait: i,
1228
- callback: a
1229
- });
1230
- return;
1231
- }
1232
- this.readingCalls++;
1233
- let o = (o, s) => {
1234
- if (this.readingCalls--, this.waitingReads.length > 0) {
1235
- let e = this.waitingReads.shift();
1236
- this.read(e.lng, e.ns, e.fcName, e.tried, e.wait, e.callback);
1237
- }
1238
- if (o && s && r < this.maxRetries) {
1239
- setTimeout(() => {
1240
- this.read.call(this, e, t, n, r + 1, i * 2, a);
1241
- }, i);
1242
- return;
1243
- }
1244
- a(o, s);
1245
- }, s = this.backend[n].bind(this.backend);
1246
- if (s.length === 2) {
1247
- try {
1248
- let n = s(e, t);
1249
- n && typeof n.then == "function" ? n.then((e) => o(null, e)).catch(o) : o(null, n);
1250
- } catch (e) {
1251
- o(e);
1252
- }
1253
- return;
1254
- }
1255
- return s(e, t, o);
1256
- }
1257
- prepareLoading(e, t, n = {}, r) {
1258
- if (!this.backend) return this.logger.warn("No backend was added via i18next.use. Will not load resources."), r && r();
1259
- g(e) && (e = this.languageUtils.toResolveHierarchy(e)), g(t) && (t = [t]);
1260
- let i = this.queueLoad(e, t, n, r);
1261
- if (!i.toLoad.length) return i.pending.length || r(), null;
1262
- i.toLoad.forEach((e) => {
1263
- this.loadOne(e);
1264
- });
1265
- }
1266
- load(e, t, n) {
1267
- this.prepareLoading(e, t, {}, n);
1268
- }
1269
- reload(e, t, n) {
1270
- this.prepareLoading(e, t, { reload: !0 }, n);
1271
- }
1272
- loadOne(e, t = "") {
1273
- let n = e.split("|"), r = n[0], i = n[1];
1274
- this.read(r, i, "read", void 0, void 0, (n, a) => {
1275
- n && this.logger.warn(`${t}loading namespace ${i} for language ${r} failed`, n), !n && a && this.logger.log(`${t}loaded namespace ${i} for language ${r}`, a), this.loaded(e, n, a);
1276
- });
1277
- }
1278
- saveMissing(e, t, n, r, i, a = {}, o = () => {}) {
1279
- if (this.services?.utils?.hasLoadedNamespace && !this.services?.utils?.hasLoadedNamespace(t)) {
1280
- this.logger.warn(`did not save key "${n}" as the namespace "${t}" was not yet loaded`, "This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");
1281
- return;
1282
- }
1283
- if (!(n == null || n === "")) {
1284
- if (this.backend?.create) {
1285
- let s = {
1286
- ...a,
1287
- isUpdate: i
1288
- }, c = this.backend.create.bind(this.backend);
1289
- if (c.length < 6) try {
1290
- let i;
1291
- i = c.length === 5 ? c(e, t, n, r, s) : c(e, t, n, r), i && typeof i.then == "function" ? i.then((e) => o(null, e)).catch(o) : o(null, i);
1292
- } catch (e) {
1293
- o(e);
1294
- }
1295
- else c(e, t, n, r, o, s);
1296
- }
1297
- !e || !e[0] || this.store.addResource(e[0], t, n, r);
1298
- }
1299
- }
1300
- }, G = () => ({
1301
- debug: !1,
1302
- initAsync: !0,
1303
- ns: ["translation"],
1304
- defaultNS: ["translation"],
1305
- fallbackLng: ["dev"],
1306
- fallbackNS: !1,
1307
- supportedLngs: !1,
1308
- nonExplicitSupportedLngs: !1,
1309
- load: "all",
1310
- preload: !1,
1311
- simplifyPluralSuffix: !0,
1312
- keySeparator: ".",
1313
- nsSeparator: ":",
1314
- pluralSeparator: "_",
1315
- contextSeparator: "_",
1316
- partialBundledLanguages: !1,
1317
- saveMissing: !1,
1318
- updateMissing: !1,
1319
- saveMissingTo: "fallback",
1320
- saveMissingPlurals: !0,
1321
- missingKeyHandler: !1,
1322
- missingInterpolationHandler: !1,
1323
- postProcess: !1,
1324
- postProcessPassResolved: !1,
1325
- returnNull: !1,
1326
- returnEmptyString: !0,
1327
- returnObjects: !1,
1328
- joinArrays: !1,
1329
- returnedObjectHandler: !1,
1330
- parseMissingKeyHandler: !1,
1331
- appendNamespaceToMissingKey: !1,
1332
- appendNamespaceToCIMode: !1,
1333
- overloadTranslationOptionHandler: (e) => {
1334
- let t = {};
1335
- if (typeof e[1] == "object" && (t = e[1]), g(e[1]) && (t.defaultValue = e[1]), g(e[2]) && (t.tDescription = e[2]), typeof e[2] == "object" || typeof e[3] == "object") {
1336
- let n = e[3] || e[2];
1337
- Object.keys(n).forEach((e) => {
1338
- t[e] = n[e];
1339
- });
1340
- }
1341
- return t;
1342
- },
1343
- interpolation: {
1344
- escapeValue: !0,
1345
- format: (e) => e,
1346
- prefix: "{{",
1347
- suffix: "}}",
1348
- formatSeparator: ",",
1349
- unescapePrefix: "-",
1350
- nestingPrefix: "$t(",
1351
- nestingSuffix: ")",
1352
- nestingOptionsSeparator: ",",
1353
- maxReplaces: 1e3,
1354
- skipOnVariables: !0
1355
- },
1356
- cacheInBuiltFormats: !0
1357
- }), K = (e) => (g(e.ns) && (e.ns = [e.ns]), g(e.fallbackLng) && (e.fallbackLng = [e.fallbackLng]), g(e.fallbackNS) && (e.fallbackNS = [e.fallbackNS]), e.supportedLngs?.indexOf?.("cimode") < 0 && (e.supportedLngs = e.supportedLngs.concat(["cimode"])), typeof e.initImmediate == "boolean" && (e.initAsync = e.initImmediate), e), q = () => {}, _e = (e) => {
1358
- Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach((t) => {
1359
- typeof e[t] == "function" && (e[t] = e[t].bind(e));
1360
- });
1361
- }, ve = "__i18next_supportNoticeShown", ye = () => !!(typeof globalThis < "u" && globalThis[ve] || typeof process < "u" && process.env && process.env.I18NEXT_NO_SUPPORT_NOTICE || typeof process < "u" && process.env), be = () => {
1362
- typeof globalThis < "u" && (globalThis[ve] = !0);
1363
- }, xe = (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)), J = class e extends N {
1364
- constructor(e = {}, t) {
1365
- if (super(), this.options = K(e), this.services = {}, this.logger = M, this.modules = { external: [] }, _e(this), t && !this.isInitialized && !e.isClone) {
1366
- if (!this.options.initAsync) return this.init(e, t), this;
1367
- setTimeout(() => {
1368
- this.init(e, t);
1369
- }, 0);
1370
- }
1371
- }
1372
- init(e = {}, t) {
1373
- this.isInitializing = !0, typeof e == "function" && (t = e, e = {}), e.defaultNS == null && e.ns && (g(e.ns) ? e.defaultNS = e.ns : e.ns.indexOf("translation") < 0 && (e.defaultNS = e.ns[0]));
1374
- let n = G();
1375
- this.options = {
1376
- ...n,
1377
- ...this.options,
1378
- ...K(e)
1379
- }, this.options.interpolation = {
1380
- ...n.interpolation,
1381
- ...this.options.interpolation
1382
- }, e.keySeparator !== void 0 && (this.options.userDefinedKeySeparator = e.keySeparator), e.nsSeparator !== void 0 && (this.options.userDefinedNsSeparator = e.nsSeparator), typeof this.options.overloadTranslationOptionHandler != "function" && (this.options.overloadTranslationOptionHandler = n.overloadTranslationOptionHandler), this.options.showSupportNotice !== !1 && !xe(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 💙"), be());
1383
- let r = (e) => e ? typeof e == "function" ? new e() : e : null;
1384
- if (!this.options.isClone) {
1385
- this.modules.logger ? M.init(r(this.modules.logger), this.options) : M.init(null, this.options);
1386
- let e;
1387
- e = this.modules.formatter ? this.modules.formatter : me;
1388
- let t = new R(this.options);
1389
- this.store = new se(this.options.resources, this.options);
1390
- let i = this.services;
1391
- i.logger = M, i.resourceStore = this.store, i.languageUtils = t, i.pluralResolver = new de(t, {
1392
- prepend: this.options.pluralSeparator,
1393
- simplifyPluralSuffix: this.options.simplifyPluralSuffix
1394
- }), this.options.interpolation.format && this.options.interpolation.format !== n.interpolation.format && this.logger.deprecate("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"), e && (!this.options.interpolation.format || this.options.interpolation.format === n.interpolation.format) && (i.formatter = r(e), i.formatter.init && i.formatter.init(i, this.options), this.options.interpolation.format = i.formatter.format.bind(i.formatter)), i.interpolator = new U(this.options), i.utils = { hasLoadedNamespace: this.hasLoadedNamespace.bind(this) }, i.backendConnector = new ge(r(this.modules.backend), i.resourceStore, i, this.options), i.backendConnector.on("*", (e, ...t) => {
1395
- this.emit(e, ...t);
1396
- }), this.modules.languageDetector && (i.languageDetector = r(this.modules.languageDetector), i.languageDetector.init && i.languageDetector.init(i, this.options.detection, this.options)), this.modules.i18nFormat && (i.i18nFormat = r(this.modules.i18nFormat), i.i18nFormat.init && i.i18nFormat.init(this)), this.translator = new L(this.services, this.options), this.translator.on("*", (e, ...t) => {
1397
- this.emit(e, ...t);
1398
- }), this.modules.external.forEach((e) => {
1399
- e.init && e.init(this);
1400
- });
1401
- }
1402
- if (this.format = this.options.interpolation.format, t ||= q, this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) {
1403
- let e = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
1404
- e.length > 0 && e[0] !== "dev" && (this.options.lng = e[0]);
1405
- }
1406
- !this.services.languageDetector && !this.options.lng && this.logger.warn("init: no languageDetector is used and no lng is defined"), [
1407
- "getResource",
1408
- "hasResourceBundle",
1409
- "getResourceBundle",
1410
- "getDataByLanguage"
1411
- ].forEach((e) => {
1412
- this[e] = (...t) => this.store[e](...t);
1413
- }), [
1414
- "addResource",
1415
- "addResources",
1416
- "addResourceBundle",
1417
- "removeResourceBundle"
1418
- ].forEach((e) => {
1419
- this[e] = (...t) => (this.store[e](...t), this);
1420
- });
1421
- let i = _(), a = () => {
1422
- let e = (e, n) => {
1423
- this.isInitializing = !1, this.isInitialized && !this.initializedStoreOnce && this.logger.warn("init: i18next is already initialized. You should call init just once!"), this.isInitialized = !0, this.options.isClone || this.logger.log("initialized", this.options), this.emit("initialized", this.options), i.resolve(n), t(e, n);
1424
- };
1425
- if (this.languages && !this.isInitialized) return e(null, this.t.bind(this));
1426
- this.changeLanguage(this.options.lng, e);
1427
- };
1428
- return this.options.resources || !this.options.initAsync ? a() : setTimeout(a, 0), i;
1429
- }
1430
- loadResources(e, t = q) {
1431
- let n = t, r = g(e) ? e : this.language;
1432
- if (typeof e == "function" && (n = e), !this.options.resources || this.options.partialBundledLanguages) {
1433
- if (r?.toLowerCase() === "cimode" && (!this.options.preload || this.options.preload.length === 0)) return n();
1434
- let e = [], t = (t) => {
1435
- t && t !== "cimode" && this.services.languageUtils.toResolveHierarchy(t).forEach((t) => {
1436
- t !== "cimode" && e.indexOf(t) < 0 && e.push(t);
1437
- });
1438
- };
1439
- r ? t(r) : this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach((e) => t(e)), this.options.preload?.forEach?.((e) => t(e)), this.services.backendConnector.load(e, this.options.ns, (e) => {
1440
- !e && !this.resolvedLanguage && this.language && this.setResolvedLanguage(this.language), n(e);
1441
- });
1442
- } else n(null);
1443
- }
1444
- reloadResources(e, t, n) {
1445
- let r = _();
1446
- return typeof e == "function" && (n = e, e = void 0), typeof t == "function" && (n = t, t = void 0), e ||= this.languages, t ||= this.options.ns, n ||= q, this.services.backendConnector.reload(e, t, (e) => {
1447
- r.resolve(), n(e);
1448
- }), r;
1449
- }
1450
- use(e) {
1451
- if (!e) throw Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");
1452
- if (!e.type) throw Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");
1453
- return e.type === "backend" && (this.modules.backend = e), (e.type === "logger" || e.log && e.warn && e.error) && (this.modules.logger = e), e.type === "languageDetector" && (this.modules.languageDetector = e), e.type === "i18nFormat" && (this.modules.i18nFormat = e), e.type === "postProcessor" && P.addPostProcessor(e), e.type === "formatter" && (this.modules.formatter = e), e.type === "3rdParty" && this.modules.external.push(e), this;
1454
- }
1455
- setResolvedLanguage(e) {
1456
- if (!(!e || !this.languages) && !(["cimode", "dev"].indexOf(e) > -1)) {
1457
- for (let e = 0; e < this.languages.length; e++) {
1458
- let t = this.languages[e];
1459
- if (!(["cimode", "dev"].indexOf(t) > -1) && this.store.hasLanguageSomeTranslations(t)) {
1460
- this.resolvedLanguage = t;
1461
- break;
1462
- }
1463
- }
1464
- !this.resolvedLanguage && this.languages.indexOf(e) < 0 && this.store.hasLanguageSomeTranslations(e) && (this.resolvedLanguage = e, this.languages.unshift(e));
1465
- }
1466
- }
1467
- changeLanguage(e, t) {
1468
- this.isLanguageChangingTo = e;
1469
- let n = _();
1470
- this.emit("languageChanging", e);
1471
- let r = (e) => {
1472
- this.language = e, this.languages = this.services.languageUtils.toResolveHierarchy(e), this.resolvedLanguage = void 0, this.setResolvedLanguage(e);
1473
- }, i = (i, a) => {
1474
- a ? this.isLanguageChangingTo === e && (r(a), this.translator.changeLanguage(a), this.isLanguageChangingTo = void 0, this.emit("languageChanged", a), this.logger.log("languageChanged", a)) : this.isLanguageChangingTo = void 0, n.resolve((...e) => this.t(...e)), t && t(i, (...e) => this.t(...e));
1475
- }, a = (t) => {
1476
- !e && !t && this.services.languageDetector && (t = []);
1477
- let n = g(t) ? t : t && t[0], a = this.store.hasLanguageSomeTranslations(n) ? n : this.services.languageUtils.getBestMatchFromCodes(g(t) ? [t] : t);
1478
- a && (this.language || r(a), this.translator.language || this.translator.changeLanguage(a), this.services.languageDetector?.cacheUserLanguage?.(a)), this.loadResources(a, (e) => {
1479
- i(e, a);
1480
- });
1481
- };
1482
- return !e && this.services.languageDetector && !this.services.languageDetector.async ? a(this.services.languageDetector.detect()) : !e && this.services.languageDetector && this.services.languageDetector.async ? this.services.languageDetector.detect.length === 0 ? this.services.languageDetector.detect().then(a) : this.services.languageDetector.detect(a) : a(e), n;
1483
- }
1484
- getFixedT(e, t, n) {
1485
- let r = (e, t, ...i) => {
1486
- let a;
1487
- a = typeof t == "object" ? { ...t } : this.options.overloadTranslationOptionHandler([e, t].concat(i)), a.lng = a.lng || r.lng, a.lngs = a.lngs || r.lngs, a.ns = a.ns || r.ns, a.keyPrefix !== "" && (a.keyPrefix = a.keyPrefix || n || r.keyPrefix);
1488
- let o = {
1489
- ...this.options,
1490
- ...a
1491
- };
1492
- typeof a.keyPrefix == "function" && (a.keyPrefix = F(a.keyPrefix, o));
1493
- let s = this.options.keySeparator || ".", c;
1494
- return a.keyPrefix && Array.isArray(e) ? c = e.map((e) => (typeof e == "function" && (e = F(e, o)), `${a.keyPrefix}${s}${e}`)) : (typeof e == "function" && (e = F(e, o)), c = a.keyPrefix ? `${a.keyPrefix}${s}${e}` : e), this.t(c, a);
1495
- };
1496
- return g(e) ? r.lng = e : r.lngs = e, r.ns = t, r.keyPrefix = n, r;
1497
- }
1498
- t(...e) {
1499
- return this.translator?.translate(...e);
1500
- }
1501
- exists(...e) {
1502
- return this.translator?.exists(...e);
1503
- }
1504
- setDefaultNamespace(e) {
1505
- this.options.defaultNS = e;
1506
- }
1507
- hasLoadedNamespace(e, t = {}) {
1508
- if (!this.isInitialized) return this.logger.warn("hasLoadedNamespace: i18next was not initialized", this.languages), !1;
1509
- if (!this.languages || !this.languages.length) return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty", this.languages), !1;
1510
- let n = t.lng || this.resolvedLanguage || this.languages[0], r = this.options ? this.options.fallbackLng : !1, i = this.languages[this.languages.length - 1];
1511
- if (n.toLowerCase() === "cimode") return !0;
1512
- let a = (e, t) => {
1513
- let n = this.services.backendConnector.state[`${e}|${t}`];
1514
- return n === -1 || n === 0 || n === 2;
1515
- };
1516
- if (t.precheck) {
1517
- let e = t.precheck(this, a);
1518
- if (e !== void 0) return e;
1519
- }
1520
- return !!(this.hasResourceBundle(n, e) || !this.services.backendConnector.backend || this.options.resources && !this.options.partialBundledLanguages || a(n, e) && (!r || a(i, e)));
1521
- }
1522
- loadNamespaces(e, t) {
1523
- let n = _();
1524
- return this.options.ns ? (g(e) && (e = [e]), e.forEach((e) => {
1525
- this.options.ns.indexOf(e) < 0 && this.options.ns.push(e);
1526
- }), this.loadResources((e) => {
1527
- n.resolve(), t && t(e);
1528
- }), n) : (t && t(), Promise.resolve());
1529
- }
1530
- loadLanguages(e, t) {
1531
- let n = _();
1532
- g(e) && (e = [e]);
1533
- let r = this.options.preload || [], i = e.filter((e) => r.indexOf(e) < 0 && this.services.languageUtils.isSupportedCode(e));
1534
- return i.length ? (this.options.preload = r.concat(i), this.loadResources((e) => {
1535
- n.resolve(), t && t(e);
1536
- }), n) : (t && t(), Promise.resolve());
1537
- }
1538
- dir(e) {
1539
- if (e ||= this.resolvedLanguage || (this.languages?.length > 0 ? this.languages[0] : this.language), !e) return "rtl";
1540
- try {
1541
- let t = new Intl.Locale(e);
1542
- if (t && t.getTextInfo) {
1543
- let e = t.getTextInfo();
1544
- if (e && e.direction) return e.direction;
1545
- }
1546
- } catch {}
1547
- let t = /* @__PURE__ */ "ar.shu.sqr.ssh.xaa.yhd.yud.aao.abh.abv.acm.acq.acw.acx.acy.adf.ads.aeb.aec.afb.ajp.apc.apd.arb.arq.ars.ary.arz.auz.avl.ayh.ayl.ayn.ayp.bbz.pga.he.iw.ps.pbt.pbu.pst.prp.prd.ug.ur.ydd.yds.yih.ji.yi.hbo.men.xmn.fa.jpr.peo.pes.prs.dv.sam.ckb".split("."), n = this.services?.languageUtils || new R(G());
1548
- return e.toLowerCase().indexOf("-latn") > 1 ? "ltr" : t.indexOf(n.getLanguagePartFromCode(e)) > -1 || e.toLowerCase().indexOf("-arab") > 1 ? "rtl" : "ltr";
1549
- }
1550
- static createInstance(t = {}, n) {
1551
- let r = new e(t, n);
1552
- return r.createInstance = e.createInstance, r;
1553
- }
1554
- cloneInstance(t = {}, n = q) {
1555
- let r = t.forkResourceStore;
1556
- r && delete t.forkResourceStore;
1557
- let i = {
1558
- ...this.options,
1559
- ...t,
1560
- isClone: !0
1561
- }, a = new e(i);
1562
- if ((t.debug !== void 0 || t.prefix !== void 0) && (a.logger = a.logger.clone(t)), [
1563
- "store",
1564
- "services",
1565
- "language"
1566
- ].forEach((e) => {
1567
- a[e] = this[e];
1568
- }), a.services = { ...this.services }, a.services.utils = { hasLoadedNamespace: a.hasLoadedNamespace.bind(a) }, r && (a.store = new se(Object.keys(this.store.data).reduce((e, t) => (e[t] = { ...this.store.data[t] }, e[t] = Object.keys(e[t]).reduce((n, r) => (n[r] = { ...e[t][r] }, n), e[t]), e), {}), i), a.services.resourceStore = a.store), t.interpolation) {
1569
- let e = {
1570
- ...G().interpolation,
1571
- ...this.options.interpolation,
1572
- ...t.interpolation
1573
- }, n = {
1574
- ...i,
1575
- interpolation: e
1576
- };
1577
- a.services.interpolator = new U(n);
1578
- }
1579
- return a.translator = new L(a.services, i), a.translator.on("*", (e, ...t) => {
1580
- a.emit(e, ...t);
1581
- }), a.init(i, n), a.translator.options = i, a.translator.backendConnector.services.utils = { hasLoadedNamespace: a.hasLoadedNamespace.bind(a) }, a;
1582
- }
1583
- toJSON() {
1584
- return {
1585
- options: this.options,
1586
- store: this.store,
1587
- language: this.language,
1588
- languages: this.languages,
1589
- resolvedLanguage: this.resolvedLanguage
1590
- };
1591
- }
1592
- }.createInstance();
1593
- //#endregion
1594
- //#region ../../lib-react/translator/dist/index.js
1595
- J.createInstance, J.dir, J.init, J.loadResources, J.reloadResources, J.use, J.changeLanguage, J.getFixedT, J.t, J.exists, J.setDefaultNamespace, J.hasLoadedNamespace, J.loadNamespaces, J.loadLanguages, J.init({
1596
- fallbackLng: "en",
1597
- lng: "en",
1598
- debug: !0,
1599
- resources: {
1600
- en: m,
1601
- es: h
1602
- }
1603
- });
1604
- var Se = {
1605
- translator: {
1606
- ...J,
1607
- t: (e, t) => {
1608
- let { lng: n } = t;
1609
- switch (n) {
1610
- case "en_US":
1611
- case "en-US":
1612
- t.lng = "en";
1613
- break;
1614
- case "es_ES":
1615
- case "es-ES":
1616
- case "es_MX":
1617
- case "es-MX":
1618
- t.lng = "es";
1619
- break;
1620
- default: break;
1621
- }
1622
- return J.t(e, {
1623
- lng: n,
1624
- ...t
1625
- });
1626
- }
1627
- },
1628
- languageOptions: [{
1629
- value: "en_US",
1630
- label: "English (US)"
1631
- }, {
1632
- value: "es_ES",
1633
- label: "Spanish"
1634
- }]
1635
- }, Ce = /* @__PURE__ */ l(p(), 1), Y = (0, Ce.default)("@pie-lib:categorize:scoring"), we = (e) => !e || !e.weighting ? [] : e.weighting.enabled && e.weighting && e.weighting.rules || [], Te = (e, t) => {
1636
- if (Y("partial? ", e), !(!e || !e.enabled)) {
1637
- let n = e.rules.find((e) => e.category === t);
1638
- return n && n.rules || [];
1639
- }
1640
- }, Ee = (e, t) => new Promise((n) => {
1641
- Y("categories: ", e, "scoring: ", t);
1642
- let r = we(t), i = e.map((e) => ({
1643
- ...r.find((t) => t.category === e.id) || { points: 1 },
1644
- category: e.id
1645
- }));
1646
- Y("weights: ", i);
1647
- let a = e.reduce((e, t) => {
1648
- let n = i.find((e) => e.category === t.id);
1649
- return e += n.points;
1650
- }, 0);
1651
- Y("total: ", a);
1652
- let o = e.map((e) => {
1653
- let n = i.find((t) => t.category === e.id).points;
1654
- if (Y("category: ", e), e.correct === !0) return {
1655
- category: e.id,
1656
- score: n,
1657
- points: n
1658
- };
1659
- {
1660
- let r = Te(t.partial, e.id);
1661
- if (Y("partial rules for category: ", r), r) {
1662
- let t = (e.choices || []).filter((e) => e.correct).length;
1663
- Y("correctCount: ", t);
1664
- let i = r.find((e) => e.count === t);
1665
- Y("rule: ", i), i ||= {
1666
- percent: 0,
1667
- count: t
1668
- };
1669
- let a = n * (i.percent / 100);
1670
- return {
1671
- category: e.id,
1672
- score: a,
1673
- points: n,
1674
- partial: {
1675
- correctChoices: t,
1676
- rule: i
1677
- }
1678
- };
1679
- } else return {
1680
- category: e.id,
1681
- score: 0,
1682
- points: n
1683
- };
1684
- }
1685
- }), s = o.reduce((e, t) => e += t.score, 0);
1686
- Y("weightedScore: ", s), n({
1687
- score: parseFloat((s / a).toFixed(2), 10),
1688
- details: {
1689
- weighted: {
1690
- total: a,
1691
- score: s
1692
- },
1693
- categories: o
1694
- }
1695
- });
1696
- }), De = Object.prototype;
1697
- function X(e) {
1698
- return typeof e == "object" && !!e;
1699
- }
1700
- function Oe(e) {
1701
- return Array.isArray(e) ? e : typeof e == "number" ? [e] : e.replace(/\[(\d+)\]/g, ".$1").split(".").filter(Boolean);
1702
- }
1703
- function ke(e) {
1704
- return (t) => Ie(t, e);
1705
- }
1706
- function Ae(e) {
1707
- return (t) => X(t) ? Object.entries(e).every(([e, n]) => ze(t[e], n)) : !1;
1708
- }
1709
- function je(e) {
1710
- return typeof e == "function" ? e : typeof e == "string" ? ke(e) : X(e) ? Ae(e) : ((e) => e);
1711
- }
1712
- function Me(e) {
1713
- return Array.isArray(e) ? e.slice() : X(e) ? { ...e } : e;
1714
- }
1715
- function Z(e) {
1716
- if (!X(e)) return e;
1717
- if (e instanceof Date) return new Date(e.getTime());
1718
- if (Array.isArray(e)) return e.map((e) => Z(e));
1719
- let t = {};
1720
- for (let [n, r] of Object.entries(e)) t[n] = Z(r);
1721
- return t;
1722
- }
1723
- function Ne(e) {
1724
- return (e ?? []).filter(Boolean);
1725
- }
1726
- function Pe(e, t = 0, n = {}) {
1727
- let r, i, a, o, s, c = n.leading === !0, l = n.trailing !== !1, u = () => {
1728
- if (!a) return s;
1729
- let t = a, n = o;
1730
- return a = void 0, o = void 0, s = e.apply(n, t), s;
1731
- }, d = () => {
1732
- r && clearTimeout(r), i && clearTimeout(i), r = void 0, i = void 0, a = void 0, o = void 0;
1733
- }, f = function(...e) {
1734
- let d = c && !r;
1735
- return a = e, o = this, d && u(), r && clearTimeout(r), r = setTimeout(() => {
1736
- r = void 0, i &&= (clearTimeout(i), void 0), l ? u() : (a = void 0, o = void 0);
1737
- }, t), n.maxWait !== void 0 && !i && (i = setTimeout(() => {
1738
- r && clearTimeout(r), r = void 0, i = void 0, l || !c ? u() : (a = void 0, o = void 0);
1739
- }, n.maxWait)), s;
1740
- };
1741
- return f.cancel = d, f.flush = () => (r &&= (clearTimeout(r), void 0), i &&= (clearTimeout(i), void 0), u()), f;
1742
- }
1743
- function Fe(e) {
1744
- let t = [];
1745
- for (let n of e ?? []) Array.isArray(n) ? t.push(...n) : t.push(n);
1746
- return t;
1747
- }
1748
- function Ie(e, t, n) {
1749
- if (!Array.isArray(t) && e != null && Object.prototype.hasOwnProperty.call(Object(e), t)) {
1750
- let r = e[t];
1751
- return r === void 0 ? n : r;
1752
- }
1753
- let r = e;
1754
- for (let e of Oe(t)) {
1755
- if (r == null) return n;
1756
- r = r[e];
1757
- }
1758
- return r === void 0 ? n : r;
1759
- }
1760
- function Le(e, t) {
1761
- return typeof e == "string" ? e.includes(String(t)) : Array.isArray(e) ? e.includes(t) : Object.values(e ?? {}).includes(t);
1762
- }
1763
- function Re(e) {
1764
- return e == null ? !0 : typeof e == "string" || Array.isArray(e) ? e.length === 0 : e instanceof Map || e instanceof Set ? e.size === 0 : X(e) ? Object.keys(e).length === 0 : !0;
1765
- }
1766
- function Q(e, t, n) {
1767
- let r = n?.(e, t);
1768
- if (r !== void 0) return !!r;
1769
- if (Object.is(e, t)) return !0;
1770
- if (!X(e) || !X(t)) return !1;
1771
- if (e instanceof Date || t instanceof Date) return e instanceof Date && t instanceof Date && e.getTime() === t.getTime();
1772
- if (Array.isArray(e) || Array.isArray(t)) return Array.isArray(e) && Array.isArray(t) && e.length === t.length && e.every((e, r) => Q(e, t[r], n));
1773
- let i = Object.keys(e), a = Object.keys(t);
1774
- return i.length === a.length && i.every((r) => De.hasOwnProperty.call(t, r) && Q(e[r], t[r], n));
1775
- }
1776
- function ze(e, t) {
1777
- return Q(e, t);
1778
- }
1779
- function Be(e) {
1780
- return Number.isFinite(e);
1781
- }
1782
- function Ve(e, ...t) {
1783
- for (let n of t) if (n) for (let [t, r] of Object.entries(n)) X(r) && !Array.isArray(r) && X(e[t]) ? Ve(e[t], r) : e[t] = Z(r);
1784
- return e;
1785
- }
1786
- function He(e, t) {
1787
- let n = { ...e ?? {} };
1788
- for (let e of Array.isArray(t) ? t : [t]) delete n[e];
1789
- return n;
1790
- }
1791
- function Ue(e, t) {
1792
- let n = je(t), r = [];
1793
- for (let t = e.length - 1; t >= 0; t--) n(e[t], t, e) && r.unshift(...e.splice(t, 1));
1794
- return r;
1795
- }
1796
- function We(e, t, n) {
1797
- let r = Oe(t), i = e;
1798
- return r.forEach((e, t) => {
1799
- if (t === r.length - 1) {
1800
- i[e] = n;
1801
- return;
1802
- }
1803
- let a = r[t + 1];
1804
- i[e] ??= typeof a == "number" || /^\d+$/.test(String(a)) ? [] : {}, i = i[e];
1805
- }), e;
1806
- }
1807
- function Ge(e, t) {
1808
- let n = t ?? ((e) => e);
1809
- return Array.from({ length: Math.max(0, e) }, (e, t) => n(t));
1810
- }
1811
- function Ke(...e) {
1812
- let t = Math.max(0, ...e.map((e) => e.length));
1813
- return Array.from({ length: t }, (t, n) => e.map((e) => e[n]));
1814
- }
1815
- //#endregion
1816
- //#region ../../lib-react/categorize/dist/index.js
1817
- var $ = (0, Ce.default)("@pie-lib:categorize"), qe = (e, t, n) => (t ||= [], t.reduce((t, r) => {
1818
- let i = Je(e, r, n - t.count);
1819
- return t.out.push(i.array), t.count += i.count || 0, t;
1820
- }, {
1821
- out: [],
1822
- count: 0
1823
- }).out), Je = (e, t, n) => {
1824
- if (t ||= [], n === 0) {
1825
- let n = t.filter((t) => t !== e);
1826
- return {
1827
- array: n,
1828
- count: t.length - n.length
1829
- };
1830
- } else {
1831
- let r = t.reduce((t, r) => (r === e ? t.count < n && (t.count += 1, t.out.push(r)) : t.out.push(r), t), {
1832
- out: [],
1833
- count: 0
1834
- });
1835
- return {
1836
- array: r.out,
1837
- count: r.count
1838
- };
1839
- }
1840
- }, Ye = (e, t) => (t ||= [], t.reduce((e, t) => {
1841
- if ($("choice: ----> ", t.id, "categoryCount: ", t.categoryCount), t.categoryCount === void 0 || t.categoryCount === 0) return e;
1842
- {
1843
- let n = e.map((e) => e.choices);
1844
- return qe(t.id, n, t.categoryCount).map((t, n) => ({
1845
- category: e[n].category,
1846
- alternateResponses: e[n].alternateResponses,
1847
- choices: t
1848
- }));
1849
- }
1850
- }, e)), Xe = (e, t) => (t ||= [], t.reduce((e, t) => {
1851
- if ($("choice: ----> ", t.id, "categoryCount: ", t.categoryCount), t.categoryCount === void 0 || t.categoryCount === 0) return e;
1852
- {
1853
- let n = {};
1854
- e.forEach((e) => (e.alternateResponses || []).forEach((e, t) => {
1855
- t in n || (n[t] = []), n[t].push(e);
1856
- }));
1857
- let r = [];
1858
- return Object.keys(n).forEach((e) => {
1859
- n[e] = qe(t.id, n[e], t.categoryCount), n[e].forEach((e, t) => {
1860
- r[t] || (r[t] = []), r[t].push(e);
1861
- });
1862
- }), e.map((e, t) => ({
1863
- category: e.category,
1864
- alternateResponses: r[t] || e.alternateResponses,
1865
- choices: e.choices
1866
- }));
1867
- }
1868
- }, e)), Ze = (e, t) => {
1869
- let n = t.reduce((t, n) => t + Qe(e, n.choices), 0);
1870
- return $("[countInAnswer] choiceId:", e, t), n;
1871
- }, Qe = (e, t) => (t || []).filter((t) => t === e).length, $e = (e, t) => !e || !e.id || !Array.isArray(t) ? 0 : t.reduce((t, n) => t + (n.choices || []).filter((t) => t && t.id === e.id).length, 0), et = (e, t) => t.filter((t) => t.category !== e), tt = (e, t, n) => t.map((t) => {
1872
- if (!n || t.category === n) {
1873
- let n = Me(t.choices);
1874
- return Ue(n, (t) => t === e), {
1875
- ...t,
1876
- choices: n
1877
- };
1878
- } else return t;
1879
- }), nt = (e, t, n) => n.map((n) => n.category === t ? (n.choices = n.choices.reduce((t, n) => (n.id === e.id ? t.findIndex((t) => t.id === e.id) === -1 && t.push(n) : t.push(n), t), []), n) : (n.choices = (n.choices || []).filter((t) => t !== e.id), n)), rt = (e, t, n, r) => ($("[removeChoiceFromCategory] choiceIndex:", n), r.map((r) => {
1880
- if (r.category === t) {
1881
- let t = Me(r.choices), i = t.findIndex((t, r) => t === e && r >= n);
1882
- return i !== -1 && t.splice(i, 1), {
1883
- ...r,
1884
- choices: t
1885
- };
1886
- } else return r;
1887
- })), it = (e, t, n, r, i) => (i || []).map((e) => {
1888
- if (e?.category === t) {
1889
- let t = (e?.alternateResponses || []).map((e, t) => (t === r && (e || []).splice(n, 1), e));
1890
- return {
1891
- ...e,
1892
- alternateResponses: t
1893
- };
1894
- }
1895
- return e;
1896
- }), at = (e, t, n, r, i) => ($("[moveChoiceToCategory] choice: ", e, "from: ", t, "to: ", n, "answers: ", i), t === n ? i : (t && (i = rt(e, t, r, i)), i.findIndex((e) => e.category === n) === -1 ? (i.push({
1897
- category: n,
1898
- choices: [e]
1899
- }), i) : i.map((t) => t.category === n ? (t.choices = t.choices || [], t.choices.push(e), t) : t))), ot = (e, t, n, r, i, a, o) => ($("[moveChoiceToAlternate] choice: ", e, "from: ", t, "to: ", n, "answers: ", i, "chocieIndex: ", r), t === n ? i : i.map((r) => (r.category === n && (o !== 0 && r.alternateResponses && (r.alternateResponses[a] = (r.alternateResponses[a] || []).filter((t) => t !== e)), r.alternateResponses || (r.alternateResponses = [], r.alternateResponses[a] = []), r.alternateResponses[a].push(e)), r.category === t && o !== 0 && r.alternateResponses && r.alternateResponses[a] && (r.alternateResponses[a] = r.alternateResponses[a].filter((t) => t !== e)), r))), st = (e, t) => e.categoryCount > 0 ? $e(e, t) < e.categoryCount : !0, ct = (e, t) => t.reduce((e, t) => {
1900
- let n = e.copyOfPossibleResponse.findIndex((e) => t && e === t.id);
1901
- return n >= 0 ? (e.builtChoices.push({
1902
- ...t,
1903
- correct: !0
1904
- }), e.copyOfPossibleResponse = [...e.copyOfPossibleResponse.slice(0, n), ...e.copyOfPossibleResponse.slice(n + 1)]) : (e.builtChoices.push({
1905
- ...t,
1906
- correct: !1
1907
- }), e.allChoicesAreCorrect = !1), e;
1908
- }, {
1909
- builtChoices: [],
1910
- copyOfPossibleResponse: [...e],
1911
- allChoicesAreCorrect: !0
1912
- }), lt = (e, t) => t.reduce((t, n) => {
1913
- let r = e[n.id] || [], i = n.choices || [], { builtChoices: a, allChoicesAreCorrect: o } = ct(r, i), s = i.length === r.length;
1914
- return t.builtCategories.push({
1915
- ...n,
1916
- correct: o && s,
1917
- choices: a
1918
- }), t.correct = t.correct && o && s, t;
1919
- }, {
1920
- builtCategories: [],
1921
- correct: !0
1922
- }), ut = (e) => e ? e.reduce((e, t) => (e[0] ? e[0][t.category] = t.choices : e.push({ [t.category]: t.choices }), t.alternateResponses && t.alternateResponses.forEach((n, r) => {
1923
- e[r + 1] ? e[r + 1][t.category] = n : e.push({ [t.category]: n });
1924
- }), e), []) : [], dt = (e, t, n) => (e ||= [], n ||= [], t ||= [], e.map((e) => {
1925
- let { choices: r = [] } = n.find((t) => t.category === e.id) || {};
1926
- return {
1927
- ...e,
1928
- choices: r.map((e) => t.find((t) => t.id === e))
1929
- };
1930
- })), ft = (e, t, n, r) => {
1931
- e ||= [], t ||= [], n ||= [];
1932
- let i = ut(r) || [], a = dt(e, t, n), o, s;
1933
- if (i.length) {
1934
- let e = i.reduce((e, t) => {
1935
- let { builtCategories: n, correct: r } = lt(t, a);
1936
- return e.bestResponse === null || !e.entirelyCorrect && r ? {
1937
- bestResponse: t,
1938
- builtCategories: n,
1939
- entirelyCorrect: r
1940
- } : e;
1941
- }, {
1942
- bestResponse: null,
1943
- builtCategories: [],
1944
- entirelyCorrect: !1
1945
- });
1946
- a = e.builtCategories, o = e.bestResponse, s = e.entirelyCorrect;
1947
- }
1948
- return {
1949
- choices: t.map((e) => st(e, a) ? e : { empty: !0 }),
1950
- categories: a,
1951
- correct: s,
1952
- bestResponse: o
1953
- };
1954
- };
1955
- //#endregion
1956
- export { s as A, Ne as C, Se as D, Ee as E, l as M, p as O, Ke as S, Fe as T, Le as _, tt as a, Z as b, Xe as c, it as d, ze as f, Re as g, Be as h, Ze as i, u as j, o as k, rt as l, We as m, nt as n, Ye as o, Ve as p, at as r, et as s, ft as t, ot as u, He as v, Ie as w, Ge as x, Pe as y };
1957
-
1958
- //# sourceMappingURL=dist-DnGF41FP.js.map