@pie-element/math-templated 7.1.1-next.12 → 7.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/CHANGELOG.json +1 -0
  2. package/CHANGELOG.md +1144 -0
  3. package/LICENSE.md +5 -0
  4. package/README.md +0 -0
  5. package/configure/CHANGELOG.json +1 -0
  6. package/configure/CHANGELOG.md +1021 -0
  7. package/configure/lib/defaults.js +172 -0
  8. package/configure/lib/defaults.js.map +1 -0
  9. package/configure/lib/design.js +546 -0
  10. package/configure/lib/design.js.map +1 -0
  11. package/configure/lib/index.js +169 -0
  12. package/configure/lib/index.js.map +1 -0
  13. package/configure/lib/markupUtils.js +39 -0
  14. package/configure/lib/markupUtils.js.map +1 -0
  15. package/configure/lib/response.js +394 -0
  16. package/configure/lib/response.js.map +1 -0
  17. package/configure/lib/utils.js +15 -0
  18. package/configure/lib/utils.js.map +1 -0
  19. package/configure/package.json +26 -0
  20. package/controller/CHANGELOG.json +1 -0
  21. package/controller/CHANGELOG.md +874 -0
  22. package/controller/lib/defaults.js +28 -0
  23. package/controller/lib/defaults.js.map +1 -0
  24. package/controller/lib/index.js +360 -0
  25. package/controller/lib/index.js.map +1 -0
  26. package/controller/package.json +17 -0
  27. package/docs/config-schema.json +2251 -0
  28. package/docs/config-schema.json.md +1658 -0
  29. package/docs/demo/config.js +8 -0
  30. package/docs/demo/generate.js +42 -0
  31. package/docs/demo/index.html +1 -0
  32. package/docs/demo/session.js +14 -0
  33. package/docs/pie-schema.json +1231 -0
  34. package/docs/pie-schema.json.md +894 -0
  35. package/lib/index.js +76 -0
  36. package/lib/index.js.map +1 -0
  37. package/lib/main.js +877 -0
  38. package/lib/main.js.map +1 -0
  39. package/lib/print.js +88 -0
  40. package/lib/print.js.map +1 -0
  41. package/module/configure.js +1 -0
  42. package/module/controller.js +3711 -0
  43. package/module/demo.js +67 -0
  44. package/module/element.js +1 -0
  45. package/module/index.html +21 -0
  46. package/module/manifest.json +22 -0
  47. package/module/print-demo.js +105 -0
  48. package/module/print.html +18 -0
  49. package/module/print.js +1 -0
  50. package/package.json +22 -93
  51. package/configure.js +0 -2
  52. package/controller.js +0 -1
  53. package/dist/author/defaults.d.ts +0 -173
  54. package/dist/author/defaults.js +0 -123
  55. package/dist/author/design.d.ts +0 -35
  56. package/dist/author/design.js +0 -360
  57. package/dist/author/index.d.ts +0 -42
  58. package/dist/author/index.js +0 -97
  59. package/dist/author/markupUtils.d.ts +0 -11
  60. package/dist/author/markupUtils.js +0 -10
  61. package/dist/author/response.d.ts +0 -41
  62. package/dist/author/response.js +0 -238
  63. package/dist/author/utils.d.ts +0 -9
  64. package/dist/author/utils.js +0 -7
  65. package/dist/browser/author/index.js +0 -31954
  66. package/dist/browser/author/index.js.map +0 -1
  67. package/dist/browser/browser-DJA4OL8j.js +0 -331
  68. package/dist/browser/browser-DJA4OL8j.js.map +0 -1
  69. package/dist/browser/controller/index.js +0 -37731
  70. package/dist/browser/controller/index.js.map +0 -1
  71. package/dist/browser/delivery/index.js +0 -81
  72. package/dist/browser/delivery/index.js.map +0 -1
  73. package/dist/browser/dist-Csid0rBE.js +0 -17046
  74. package/dist/browser/dist-Csid0rBE.js.map +0 -1
  75. package/dist/browser/dist-D9ARZhQk.js +0 -1426
  76. package/dist/browser/dist-D9ARZhQk.js.map +0 -1
  77. package/dist/browser/main-I_wWeaur.js +0 -1274
  78. package/dist/browser/main-I_wWeaur.js.map +0 -1
  79. package/dist/browser/math-templated.css +0 -2
  80. package/dist/browser/print/index.js +0 -47
  81. package/dist/browser/print/index.js.map +0 -1
  82. package/dist/controller/defaults.d.ts +0 -29
  83. package/dist/controller/defaults.js +0 -23
  84. package/dist/controller/index.d.ts +0 -45
  85. package/dist/controller/index.js +0 -154
  86. package/dist/delivery/index.d.ts +0 -20
  87. package/dist/delivery/index.js +0 -51
  88. package/dist/delivery/main.d.ts +0 -40
  89. package/dist/delivery/main.js +0 -492
  90. package/dist/index.d.ts +0 -1
  91. package/dist/index.iife.d.ts +0 -8
  92. package/dist/index.iife.js +0 -205
  93. package/dist/index.js +0 -2
  94. package/dist/math-templated.css +0 -2
  95. package/dist/print/index.d.ts +0 -15
  96. package/dist/print/index.js +0 -47
  97. package/dist/runtime-support.d.ts +0 -12
  98. package/dist/runtime-support.js +0 -12
@@ -1,1274 +0,0 @@
1
- import { C as e, g as t, n, o as r, t as i } from "./browser-DJA4OL8j.js";
2
- import { At as a, J as o, M as s, S as c, a as l, b as u, d, f, ft as p, i as m, it as h, l as g, n as _, q as v, r as y, t as b, u as x, w as S } from "./dist-Csid0rBE.js";
3
- import { t as C } from "./dist-D9ARZhQk.js";
4
- import w, { useRef as T } from "react";
5
- import { jsx as E, jsxs as D } from "react/jsx-runtime";
6
- import ee from "react-dom";
7
- //#region ../../lib-react/icons/dist/correct-response-icon.js
8
- var O = /* @__PURE__ */ e(a(), 1), te = ({ bgFill: e, fgFill: t }) => /* @__PURE__ */ D("svg", {
9
- preserveAspectRatio: "xMinYMin meet",
10
- version: "1.1",
11
- viewBox: "-283 359 34 35",
12
- style: { enableBackground: "new -283 359 34 35" },
13
- children: [
14
- /* @__PURE__ */ E("circle", {
15
- cx: "-266",
16
- cy: "375.9",
17
- r: "14",
18
- fill: e
19
- }),
20
- /* @__PURE__ */ E("path", {
21
- d: "M-280.5,375.9c0-8,6.5-14.5,14.5-14.5s14.5,6.5,14.5,14.5s-6.5,14.5-14.5,14.5S-280.5,383.9-280.5,375.9z\n M-279.5,375.9c0,7.4,6.1,13.5,13.5,13.5c7.4,0,13.5-6.1,13.5-13.5s-6.1-13.5-13.5-13.5C-273.4,362.4-279.5,368.5-279.5,375.9z",
22
- fill: e
23
- }),
24
- /* @__PURE__ */ E("polygon", {
25
- points: "-265.4,383.1 -258.6,377.2 -261.2,374.2 -264.3,376.9 -268.9,368.7 -272.4,370.6",
26
- fill: t
27
- })
28
- ]
29
- });
30
- te.propTypes = {
31
- bgFill: O.default.string.isRequired,
32
- fgFill: O.default.string.isRequired
33
- };
34
- var k = ({ bgFill: e, fgFill: t, borderFill: n }) => /* @__PURE__ */ D("svg", {
35
- preserveAspectRatio: "xMinYMin meet",
36
- version: "1.1",
37
- viewBox: "-129.5 127 34 35",
38
- style: { enableBackground: "new -129.5 127 34 35" },
39
- children: [
40
- /* @__PURE__ */ E("path", {
41
- style: {
42
- fill: "#D0CAC5",
43
- stroke: "#E6E3E0",
44
- strokeWidth: .75,
45
- strokeMiterlimit: 10
46
- },
47
- d: "M-112.9,160.4c-8.5,0-15.5-6.9-15.5-15.5c0-8.5,6.9-15.5,15.5-15.5s15.5,6.9,15.5,15.5\n C-97.4,153.5-104.3,160.4-112.9,160.4z"
48
- }),
49
- /* @__PURE__ */ E("path", {
50
- style: {
51
- fill: "#B3ABA4",
52
- stroke: "#CDC7C2",
53
- strokeWidth: .5,
54
- strokeMiterlimit: 10
55
- },
56
- d: "M-113.2,159c-8,0-14.5-6.5-14.5-14.5s6.5-14.5,14.5-14.5s14.5,6.5,14.5,14.5S-105.2,159-113.2,159z"
57
- }),
58
- /* @__PURE__ */ E("circle", {
59
- cx: "-114.2",
60
- cy: "143.5",
61
- r: "14",
62
- fill: e
63
- }),
64
- /* @__PURE__ */ E("path", {
65
- d: "M-114.2,158c-8,0-14.5-6.5-14.5-14.5s6.5-14.5,14.5-14.5s14.5,6.5,14.5,14.5S-106.2,158-114.2,158z\n M-114.2,130c-7.4,0-13.5,6.1-13.5,13.5s6.1,13.5,13.5,13.5s13.5-6.1,13.5-13.5S-106.8,130-114.2,130z",
66
- fill: n
67
- }),
68
- /* @__PURE__ */ E("polygon", {
69
- points: "-114.8,150.7 -121.6,144.8 -119,141.8 -115.9,144.5 -111.3,136.3 -107.8,138.2",
70
- fill: t
71
- })
72
- ]
73
- });
74
- k.propTypes = {
75
- bgFill: O.default.string.isRequired,
76
- fgFill: O.default.string.isRequired,
77
- borderFill: O.default.string.isRequired
78
- };
79
- var ne = p("div")(({ size: e }) => ({
80
- width: e || "25px",
81
- height: e || "25px"
82
- })), A = ({ open: e, size: t }) => /* @__PURE__ */ E(ne, {
83
- size: t,
84
- children: e ? /* @__PURE__ */ E(te, {
85
- bgFill: "#bce2ff",
86
- fgFill: "#1a9cff"
87
- }) : /* @__PURE__ */ E(k, {
88
- bgFill: "white",
89
- fgFill: "#1a9cff",
90
- borderFill: "#bce2ff"
91
- })
92
- });
93
- A.propTypes = {
94
- open: O.default.bool,
95
- size: O.default.string
96
- }, A.defaultProps = { open: !1 };
97
- //#endregion
98
- //#region ../../lib-react/mask-markup/dist/componentize.js
99
- var re = /* @__PURE__ */ e(i(), 1), ie = /\{\{(\d+)\}\}/g, ae = (e, t) => e ? { markup: e.replace(ie, (e, n) => `<span data-component="${t}" data-id="${n}"></span>`) } : { markup: "" }, j = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), M = /* @__PURE__ */ j(((e, t) => {
100
- t.exports = {
101
- "border-radius": 1,
102
- "border-top-left-radius": 1,
103
- "border-top-right-radius": 1,
104
- "border-bottom-left-radius": 1,
105
- "border-bottom-right-radius": 1,
106
- "box-shadow": 1,
107
- order: 1,
108
- flex: function(e, t) {
109
- return [t + "box-flex"];
110
- },
111
- "box-flex": 1,
112
- "box-align": 1,
113
- animation: 1,
114
- "animation-duration": 1,
115
- "animation-name": 1,
116
- transition: 1,
117
- "transition-duration": 1,
118
- transform: 1,
119
- "transform-style": 1,
120
- "transform-origin": 1,
121
- "backface-visibility": 1,
122
- perspective: 1,
123
- "box-pack": 1
124
- };
125
- }));
126
- M();
127
- //#endregion
128
- //#region ../../lib-react/mask-markup/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/cssUnitless.js
129
- var N = /* @__PURE__ */ j(((e, t) => {
130
- t.exports = {
131
- animation: 1,
132
- "column-count": 1,
133
- columns: 1,
134
- "font-weight": 1,
135
- opacity: 1,
136
- "order ": 1,
137
- "z-index": 1,
138
- zoom: 1,
139
- flex: 1,
140
- "box-flex": 1,
141
- transform: 1,
142
- perspective: 1,
143
- "box-pack": 1,
144
- "box-align": 1,
145
- colspan: 1,
146
- rowspan: 1
147
- };
148
- }));
149
- N();
150
- //#endregion
151
- //#region ../../lib-react/mask-markup/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/toUpperFirst.js
152
- var P = /* @__PURE__ */ j(((e, t) => {
153
- t.exports = function(e) {
154
- return e.length ? e.charAt(0).toUpperCase() + e.substring(1) : e;
155
- };
156
- }));
157
- P();
158
- //#endregion
159
- //#region ../../lib-react/mask-markup/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/prefixInfo.js
160
- var F = /* @__PURE__ */ j(((e, t) => {
161
- var n = P(), r = /^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/, i = typeof document > "u" ? {} : document.documentElement.style;
162
- t.exports = (function() {
163
- var e = (function() {
164
- for (var e in i) if (r.test(e)) return e.match(r)[0];
165
- return "WebkitOpacity" in i ? "Webkit" : "KhtmlOpacity" in i ? "Khtml" : "";
166
- })();
167
- return {
168
- style: e,
169
- css: "-" + e.toLowerCase() + "-",
170
- dom: {
171
- Webkit: "WebKit",
172
- ms: "MS",
173
- o: "WebKit"
174
- }[e] || n(e)
175
- };
176
- })();
177
- }));
178
- F();
179
- //#endregion
180
- //#region ../../lib-react/mask-markup/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/hyphenRe.js
181
- var oe = /* @__PURE__ */ j(((e, t) => {
182
- t.exports = /[-\s]+(.)?/g;
183
- }));
184
- oe();
185
- //#endregion
186
- //#region ../../lib-react/mask-markup/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/camelize.js
187
- var I = /* @__PURE__ */ j(((e, t) => {
188
- var n = function(e, t) {
189
- return t ? t.toUpperCase() : "";
190
- }, r = oe();
191
- t.exports = function(e) {
192
- return e ? e.replace(r, n) : "";
193
- };
194
- }));
195
- I();
196
- //#endregion
197
- //#region ../../lib-react/mask-markup/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/separate.js
198
- var se = /* @__PURE__ */ j(((e, t) => {
199
- var n = /::/g, r = /([A-Z]+)([A-Z][a-z])/g, i = /([a-z\d])([A-Z])/g, a = /_/g;
200
- t.exports = function(e, t) {
201
- return e ? e.replace(n, "/").replace(r, "$1_$2").replace(i, "$1_$2").replace(a, t || "-") : "";
202
- };
203
- }));
204
- se();
205
- //#endregion
206
- //#region ../../lib-react/mask-markup/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/hyphenate.js
207
- var L = /* @__PURE__ */ j(((e, t) => {
208
- var n = se();
209
- t.exports = function(e) {
210
- return n(e).toLowerCase();
211
- };
212
- }));
213
- L();
214
- //#endregion
215
- //#region ../../lib-react/mask-markup/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/toLowerFirst.js
216
- var ce = /* @__PURE__ */ j(((e, t) => {
217
- t.exports = function(e) {
218
- return e.length ? e.charAt(0).toLowerCase() + e.substring(1) : e;
219
- };
220
- }));
221
- ce();
222
- //#endregion
223
- //#region ../../lib-react/mask-markup/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/prefixer.js
224
- var le = /* @__PURE__ */ j(((e, t) => {
225
- var n = I(), r = L(), i = ce(), a = P(), o = F(), s = M(), c = typeof document > "u" ? {} : document.documentElement.style;
226
- t.exports = function(e) {
227
- return function(t, l) {
228
- l ||= {};
229
- var u = i(n(t)), d = r(t), f = e ? u : d, p = o.style ? e ? o.style : o.css : "";
230
- if (u in c) return l.asString ? f : [f];
231
- var m = f, h = s[d], g = [];
232
- if (e && (m = a(f)), typeof h == "function") {
233
- var _ = h(f, p) || [];
234
- _ && !Array.isArray(_) && (_ = [_]), _.length && (_ = _.map(function(t) {
235
- return e ? i(n(t)) : r(t);
236
- })), g = g.concat(_);
237
- }
238
- return p && g.push(p + m), g.push(f), l.asString || g.length == 1 ? g[0] : g;
239
- };
240
- };
241
- }));
242
- le();
243
- //#endregion
244
- //#region ../../lib-react/mask-markup/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/cssPrefix.js
245
- var ue = /* @__PURE__ */ j(((e, t) => {
246
- t.exports = le()();
247
- }));
248
- ue();
249
- //#endregion
250
- //#region ../../lib-react/mask-markup/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/hasOwn.js
251
- var R = /* @__PURE__ */ j(((e, t) => {
252
- var n = Object.prototype.hasOwnProperty;
253
- t.exports = function(e, t) {
254
- return n.call(e, t);
255
- };
256
- }));
257
- R();
258
- //#endregion
259
- //#region ../../lib-react/mask-markup/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/isObject.js
260
- var de = /* @__PURE__ */ j(((e, t) => {
261
- var n = Object.prototype.toString;
262
- t.exports = function(e) {
263
- return !!e && n.call(e) === "[object Object]";
264
- };
265
- }));
266
- de();
267
- //#endregion
268
- //#region ../../lib-react/mask-markup/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/isFunction.js
269
- var fe = /* @__PURE__ */ j(((e, t) => {
270
- var n = Object.prototype.toString;
271
- t.exports = function(e) {
272
- return n.apply(e) === "[object Function]";
273
- };
274
- }));
275
- fe();
276
- //#endregion
277
- //#region ../../lib-react/mask-markup/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/toStyleObject.js
278
- var z = /* @__PURE__ */ j(((e, t) => {
279
- F();
280
- var n = ue(), r = L(), i = I(), a = R(), o = de(), s = fe(), c = function(e, t, r, i) {
281
- n(t).forEach(function(t) {
282
- e[i ? i(t) : t] = r;
283
- });
284
- }, l = function(e) {
285
- e = (e || "").split(";");
286
- var t = {};
287
- return e.forEach(function(e) {
288
- var n = e.split(":");
289
- n.length == 2 && (t[n[0].trim()] = n[1].trim());
290
- }), t;
291
- }, u = { cssUnitless: N() }, d = function(e, t, n, f) {
292
- typeof e == "string" && (e = l(e)), t ||= u, t.cssUnitless = t.cssUnitless || u.cssUnitless, f ||= {};
293
- var p = t.scope || {}, m = t.addUnits == null ? p && p.addUnits != null ? p.addUnits : !0 : t.addUnits, h = (t.cssUnitless == null ? p ? p.cssUnitless : null : t.cssUnitless) || {}, g = (t.cssUnit || p ? p.cssUnit : null) || "px", _ = t.prefixProperties || (p ? p.prefixProperties : null) || {}, v = t.camelize ? i : r, y, b, x, S, C, w, T, E;
294
- for (x in e) if (a(e, x)) {
295
- if (S = e[x], b = r(n ? n + x : x), y = !1, E = !1, s(S) && (T = S.call(p || e, S, x, b, e), o(T) && T.value != null ? (S = T.value, E = T.prefix, b = T.name ? r(T.name) : b) : S = T), C = typeof S, w = C == "number" || C == "string" && S != "" && S * 1 == S, S == null || b == null || b === "") continue;
296
- if ((w || C == "string") && (y = !0), !y && S.value != null && S.prefix && (y = !0, E = S.prefix, S = S.value), y) {
297
- if (E ||= !!_[b], w && (S = m && !(b in h) ? S + g : S + ""), (b == "border" || !b.indexOf("border") && !~b.indexOf("radius") && !~b.indexOf("width")) && w && (b += "-width"), !b.indexOf("border-radius-") && (b.replace(/border(-radius)(-(.*))/, function(e, t, n) {
298
- var r = {
299
- "-top": ["-top-left", "-top-right"],
300
- "-left": ["-top-left", "-bottom-left"],
301
- "-right": ["-top-right", "-bottom-right"],
302
- "-bottom": ["-bottom-left", "-bottom-right"]
303
- };
304
- n in r ? (b = [], r[n].forEach(function(e) {
305
- b.push("border" + e + t);
306
- })) : b = "border" + n + t;
307
- }), Array.isArray(b))) {
308
- b.forEach(function(e) {
309
- E ? c(f, e, S, v) : f[v(e)] = S;
310
- });
311
- continue;
312
- }
313
- E ? c(f, b, S, v) : f[v(b)] = S;
314
- } else d(S, t, b + "-", f);
315
- }
316
- return f;
317
- };
318
- t.exports = d;
319
- }));
320
- z();
321
- //#endregion
322
- //#region ../../lib-react/mask-markup/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/toStyleString.js
323
- var pe = /* @__PURE__ */ j(((e, t) => {
324
- var n = z(), r = R();
325
- t.exports = function(e, t) {
326
- e = n(e, t);
327
- var i = [], a;
328
- for (a in e) r(e, a) && i.push(a + ": " + e[a]);
329
- return i.join("; ");
330
- };
331
- }));
332
- pe();
333
- //#endregion
334
- //#region ../../lib-react/mask-markup/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/index.js
335
- var me = /* @__PURE__ */ j(((e, t) => {
336
- t.exports = {
337
- prefixProperties: M(),
338
- cssUnitless: N(),
339
- object: z(),
340
- string: pe()
341
- };
342
- }));
343
- me();
344
- //#endregion
345
- //#region ../../lib-react/mask-markup/dist/serialization.js
346
- var he = me(), ge = (0, re.default)("@pie-lib:mask-markup:serialization"), _e = ["span"], ve = [
347
- "em",
348
- "strong",
349
- "u"
350
- ], ye = 3, be = 8, xe = 1, Se = (e) => {
351
- if (!e.attributes || e.attributes.length <= 0) return;
352
- let t = {}, n;
353
- for (n = 0; n < e.attributes.length; n++) {
354
- let r = e.attributes[n];
355
- t[r.name] = r.value;
356
- }
357
- return t;
358
- }, Ce = (e) => _e.includes(e) ? "inline" : ve.includes(e) ? "mark" : "block", we = (e) => {
359
- let t = /([\w-]*)\s*:\s*([^;]*)/g, n, r = {};
360
- for (; n = t.exec(e);) r[n[1]] = n[2].trim();
361
- return r;
362
- }, Te = (e) => (0, he.object)(e, {
363
- camelize: !0,
364
- addUnits: !1
365
- }), Ee = (e, t) => Te(we(e.getAttribute(t))), De = (e, t, n) => {
366
- let r = e.getAttribute(n);
367
- return delete t.class, r;
368
- }, Oe = (e) => (t, n) => {
369
- if (!e.getAttribute) return t;
370
- if (e.getAttribute(n)) switch (n) {
371
- case "style":
372
- t.style = Ee(e, n);
373
- break;
374
- case "class":
375
- t.className = De(e, t, n);
376
- break;
377
- default:
378
- t[n] = e.getAttribute(n);
379
- break;
380
- }
381
- return t;
382
- }, ke = [
383
- "border",
384
- "class",
385
- "style"
386
- ], B = {
387
- b: "bold",
388
- em: "italic",
389
- u: "underline",
390
- s: "strikethrough",
391
- code: "code",
392
- strong: "strong"
393
- }, Ae = (e, t = []) => {
394
- if (e.nodeType === be) return null;
395
- if (e.nodeType === ye) {
396
- let n = { text: e.textContent };
397
- return t.length > 0 && (n.marks = t.map((e) => ({
398
- type: e,
399
- data: void 0
400
- }))), {
401
- object: "text",
402
- leaves: [n]
403
- };
404
- }
405
- if (e.nodeType === xe) {
406
- let n = e.tagName.toLowerCase(), r = B[n];
407
- if (r) return ge("[deserialize] mark: ", r), {
408
- _flatten: !0,
409
- nodes: V(e.childNodes, [...t, r])
410
- };
411
- if (n === "math") return {
412
- isMath: !0,
413
- nodes: [e]
414
- };
415
- let i = Se(e) || {};
416
- n === "audio" && i.controls === "" && (i.controls = !0);
417
- let a = ke.reduce(Oe(e), { ...i }), o = Ce(n), s = V(e.childNodes, t);
418
- return {
419
- object: o,
420
- type: n,
421
- data: {
422
- dataset: { ...e.dataset },
423
- attributes: { ...a }
424
- },
425
- nodes: s
426
- };
427
- }
428
- return null;
429
- }, V = (e, t = []) => {
430
- let n = [];
431
- for (let r = 0; r < e.length; r++) {
432
- let i = Ae(e[r], t);
433
- i !== null && (i._flatten && i.nodes ? n.push(...i.nodes) : n.push(i));
434
- }
435
- return n;
436
- }, je = (e) => {
437
- if (!e || !e.trim()) return {
438
- object: "value",
439
- document: {
440
- object: "document",
441
- data: {},
442
- nodes: [{
443
- object: "block",
444
- type: "span",
445
- data: {},
446
- isVoid: !1,
447
- nodes: []
448
- }]
449
- }
450
- };
451
- let t = V(new DOMParser().parseFromString(e, "text/html").body.childNodes);
452
- return !t.some((e) => e.object === "block" || e.object === "inline") && t.length > 0 && (t = [{
453
- object: "block",
454
- type: "span",
455
- data: {},
456
- isVoid: !1,
457
- nodes: t
458
- }]), t.length === 0 && (t = [{
459
- object: "block",
460
- type: "span",
461
- data: {},
462
- isVoid: !1,
463
- nodes: []
464
- }]), {
465
- object: "value",
466
- document: {
467
- object: "document",
468
- data: {},
469
- nodes: t
470
- }
471
- };
472
- }, Me = p("div")(({ theme: e }) => ({
473
- paddingTop: e.spacing(.5),
474
- paddingBottom: e.spacing(.5)
475
- })), H = p("span")(() => ({
476
- display: "inline-block",
477
- width: ".75em"
478
- })), Ne = ["tbody", "tr"], Pe = (e, t) => {
479
- let n = t.trim() === "", r = e && e.type;
480
- if (!(n && Ne.includes(r))) return t;
481
- }, Fe = (e) => {
482
- let n = e.leaves.find((e) => t(e, "marks", []).length);
483
- return n ? n.marks[0] : null;
484
- }, U = (e, t, n, r, i, a) => {
485
- if (!t) return null;
486
- let o = [];
487
- return (e.nodes || []).forEach((e, s) => {
488
- let c = e.type ? `${e.type}-${s}` : `${s}`;
489
- if (e.isMath) return o.push(/* @__PURE__ */ E("span", { dangerouslySetInnerHTML: { __html: `<math displaystyle="true">${e.nodes[0].innerHTML}</math>` } })), o;
490
- if (r) {
491
- let i = r(e, t, n);
492
- if (i) {
493
- let t = e.data?.dataset?.component === "blank";
494
- t && o.push(/* @__PURE__ */ E(H, {}, `spacer-${s}`)), o.push(i), t && o.push(/* @__PURE__ */ E(H, {}, `spacer-${s}`));
495
- return;
496
- }
497
- }
498
- if (e.object === "text") {
499
- let t = e.leaves.reduce((e, t) => {
500
- let n = t.text, r = Pe(i, n);
501
- return r ? e + r : e;
502
- }, ""), n = Fe(e);
503
- if (n) {
504
- let e;
505
- for (e in B) if (B[e] === n.type) {
506
- let n = e;
507
- o.push(/* @__PURE__ */ E(n, { children: t }, c));
508
- break;
509
- }
510
- } else t.length > 0 && o.push(t);
511
- } else {
512
- let i = U(e, t, n, r, e, a);
513
- if (e.type === "p" || e.type === "paragraph") o.push(/* @__PURE__ */ E(Me, { children: i }, c));
514
- else {
515
- let t = e.type;
516
- e.nodes && e.nodes.length > 0 ? o.push(/* @__PURE__ */ E(t, {
517
- ...e.data.attributes,
518
- children: i
519
- }, c)) : o.push(/* @__PURE__ */ E(t, { ...e.data.attributes }, c));
520
- }
521
- }
522
- }), o;
523
- }, Ie = p("div")(() => ({
524
- display: "initial",
525
- "&:not(.MathJax) table": { borderCollapse: "collapse" },
526
- "&:not(.MathJax) table td, &:not(.MathJax) table th": {
527
- padding: "8px 12px",
528
- textAlign: "left"
529
- }
530
- })), Le = class extends w.Component {
531
- constructor(e) {
532
- super(e), this.internalContainerRef = w.createRef();
533
- }
534
- static propTypes = {
535
- renderChildren: O.default.func,
536
- layout: O.default.object,
537
- value: O.default.object,
538
- onChange: O.default.func,
539
- elementType: O.default.string,
540
- containerRef: O.default.oneOfType([O.default.func, O.default.shape({ current: O.default.instanceOf(Element) })])
541
- };
542
- componentDidMount() {
543
- let e = this.props.containerRef || this.internalContainerRef;
544
- e.current && typeof S == "function" && S(e.current);
545
- }
546
- handleChange = (e, t) => {
547
- let n = {
548
- ...this.props.value,
549
- [e]: t
550
- };
551
- this.props.onChange(n);
552
- };
553
- render() {
554
- let { value: e, layout: t, elementType: n, containerRef: r } = this.props, i = U(t, e, this.handleChange, this.props.renderChildren, null, n);
555
- return /* @__PURE__ */ E(Ie, {
556
- ref: r || this.internalContainerRef,
557
- children: i
558
- });
559
- }
560
- }, Re = (e, t) => {
561
- let { markup: n } = ae(e, t);
562
- return je(n).document;
563
- }, ze = ((e, t) => class extends w.Component {
564
- static propTypes = {
565
- markup: O.default.string,
566
- layout: O.default.object,
567
- value: O.default.object,
568
- onChange: O.default.func,
569
- customMarkMarkupComponent: O.default.func,
570
- elementType: O.default.string
571
- };
572
- constructor(e) {
573
- super(e), this.containerRef = w.createRef();
574
- }
575
- componentDidUpdate(e) {
576
- if (this.props.markup !== e.markup) {
577
- let e = this.containerRef.current;
578
- (e && e.querySelectorAll("[data-latex][data-math-handled=\"true\"]") || []).forEach((e) => {
579
- let t = e.querySelector("mjx-container");
580
- t && e.removeChild(t), e.innerHTML = e.getAttribute("data-raw"), e.removeAttribute("data-math-handled");
581
- });
582
- }
583
- }
584
- render() {
585
- let { markup: n, layout: r, value: i, onChange: a, elementType: o } = this.props, s = r || Re(n, e);
586
- return /* @__PURE__ */ E(Le, {
587
- containerRef: this.containerRef,
588
- elementType: o,
589
- layout: s,
590
- value: i,
591
- onChange: a,
592
- renderChildren: t(this.props)
593
- });
594
- }
595
- })("input", (e) => (t, n, r) => {
596
- let i = t.data && t.data.dataset || {};
597
- if (i.component === "input") return e.customMarkMarkupComponent(i.id);
598
- }), W = "height ease-in 300ms, opacity ease-in 300ms", Be = p("div")(() => ({
599
- position: "relative",
600
- height: 0,
601
- overflow: "hidden",
602
- display: "flex",
603
- visibility: "hidden",
604
- width: 0,
605
- "&.enter": {
606
- transition: W,
607
- opacity: 1,
608
- height: "auto",
609
- width: "auto",
610
- visibility: "visible",
611
- minHeight: "25px"
612
- },
613
- "&.enter-done": {
614
- height: "auto",
615
- visibility: "visible",
616
- width: "auto",
617
- minHeight: "25px"
618
- },
619
- "&.exit": {
620
- transition: W,
621
- opacity: 0,
622
- height: 0,
623
- visibility: "visible",
624
- width: 0
625
- },
626
- "&.exit-done": {
627
- opacity: 0,
628
- visibility: "hidden",
629
- height: 0,
630
- width: 0
631
- }
632
- })), Ve = (e) => {
633
- let { show: t, children: n, className: r } = e, i = T(null);
634
- return /* @__PURE__ */ E(h, {
635
- nodeRef: i,
636
- in: t,
637
- appear: !0,
638
- mountOnEnter: !1,
639
- timeout: 300,
640
- classNames: {
641
- enter: "enter",
642
- enterDone: "enter-done",
643
- exit: "exit",
644
- exitDone: "exit-done"
645
- },
646
- children: /* @__PURE__ */ E(Be, {
647
- ref: i,
648
- className: r,
649
- children: n
650
- })
651
- });
652
- };
653
- Ve.propTypes = {
654
- show: O.default.bool.isRequired,
655
- className: O.default.string,
656
- children: O.default.oneOfType([O.default.arrayOf(O.default.node), O.default.node]).isRequired
657
- };
658
- //#endregion
659
- //#region ../../lib-react/correct-answer-toggle/dist/index.js
660
- function G(e) {
661
- return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
662
- }
663
- function He(e, t) {
664
- return !e || G(e) ? e : G(e.default) ? e.default : t && G(e[t]) ? e[t] : t && G(e[t]?.default) ? e[t].default : e;
665
- }
666
- var Ue = He(d, "Readable") || He(Ge.Readable, "Readable"), We = l, K = We.default, Ge = K && typeof K == "object" ? K : We, { translator: q } = C, Ke = {
667
- WebkitTouchCallout: "none",
668
- WebkitUserSelect: "none",
669
- KhtmlUserSelect: "none",
670
- MozUserSelect: "none",
671
- msUserSelect: "none",
672
- userSelect: "none"
673
- }, qe = p("div")(() => ({
674
- width: "100%",
675
- cursor: "pointer"
676
- })), Je = p("div")(() => ({
677
- margin: "0 auto",
678
- textAlign: "center",
679
- display: "flex"
680
- })), Ye = p("div")(() => ({
681
- width: "fit-content",
682
- minWidth: "140px",
683
- alignSelf: "center",
684
- verticalAlign: "middle",
685
- color: `var(--correct-answer-toggle-label-color, ${s.text()})`,
686
- fontWeight: "normal",
687
- ...Ke
688
- })), Xe = p("div")(() => ({
689
- position: "absolute",
690
- width: "25px",
691
- "&.enter": { opacity: "0" },
692
- "&.enter-active": {
693
- opacity: "1",
694
- transition: "opacity 0.3s ease-in"
695
- },
696
- "&.exit": { opacity: "1" },
697
- "&.exit-active": {
698
- opacity: "0",
699
- transition: "opacity 0.3s ease-in"
700
- }
701
- })), Ze = p("div")(() => ({
702
- width: "25px",
703
- marginRight: "5px",
704
- display: "flex",
705
- alignItems: "center"
706
- })), Qe = class e extends w.Component {
707
- static propTypes = {
708
- onToggle: O.default.func,
709
- toggled: O.default.bool,
710
- show: O.default.bool,
711
- hideMessage: O.default.string,
712
- showMessage: O.default.string,
713
- className: O.default.string,
714
- language: O.default.string
715
- };
716
- static defaultProps = {
717
- showMessage: "Show correct answer",
718
- hideMessage: "Hide correct answer",
719
- show: !1,
720
- toggled: !1
721
- };
722
- constructor(t) {
723
- super(t), this.state = { show: t.show }, this.openIconRef = w.createRef(), this.closedIconRef = w.createRef(), e.defaultProps = {
724
- ...e.defaultProps,
725
- showMessage: q.t("common:showCorrectAnswer", { lng: t.language }),
726
- hideMessage: q.t("common:hideCorrectAnswer", { lng: t.language })
727
- };
728
- }
729
- onClick() {
730
- this.props.onToggle(!this.props.toggled);
731
- }
732
- onTouch(e) {
733
- e.preventDefault(), this.props.onToggle(!this.props.toggled);
734
- }
735
- UNSAFE_componentWillReceiveProps(t) {
736
- this.setState({ show: t.show }), t.language !== this.props?.language && (e.defaultProps = {
737
- ...e.defaultProps,
738
- showMessage: q.t("common:showCorrectAnswer", { lng: t.language }),
739
- hideMessage: q.t("common:hideCorrectAnswer", { lng: t.language })
740
- });
741
- }
742
- render() {
743
- let { className: e, toggled: t, hideMessage: n, showMessage: r } = this.props;
744
- return /* @__PURE__ */ E(qe, {
745
- className: e,
746
- children: /* @__PURE__ */ E(Ve, {
747
- show: this.state.show,
748
- children: /* @__PURE__ */ D(Je, {
749
- onClick: this.onClick.bind(this),
750
- onTouchEnd: this.onTouch.bind(this),
751
- children: [/* @__PURE__ */ D(Ze, { children: [/* @__PURE__ */ E(h, {
752
- nodeRef: this.openIconRef,
753
- timeout: 400,
754
- in: t,
755
- exit: !t,
756
- classNames: {
757
- enter: "enter",
758
- enterActive: "enter-active",
759
- exit: "exit",
760
- exitActive: "exit-active"
761
- },
762
- children: /* @__PURE__ */ E(Xe, {
763
- ref: this.openIconRef,
764
- children: /* @__PURE__ */ E(A, { open: t }, "correct-open")
765
- })
766
- }), /* @__PURE__ */ E(h, {
767
- nodeRef: this.closedIconRef,
768
- timeout: 5e3,
769
- in: !t,
770
- exit: t,
771
- classNames: {
772
- enter: "enter",
773
- enterActive: "enter-active",
774
- exit: "exit",
775
- exitActive: "exit-active"
776
- },
777
- children: /* @__PURE__ */ E(Xe, {
778
- ref: this.closedIconRef,
779
- children: /* @__PURE__ */ E(A, { open: t }, "correct-closed")
780
- })
781
- })] }), /* @__PURE__ */ E(Ue, {
782
- false: !0,
783
- children: /* @__PURE__ */ E(Ye, {
784
- "aria-hidden": !this.state.show,
785
- children: t ? n : r
786
- })
787
- })]
788
- })
789
- })
790
- });
791
- }
792
- };
793
- //#endregion
794
- //#region src/delivery/main.tsx
795
- function J(e) {
796
- return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
797
- }
798
- function Y(e, t) {
799
- return !e || J(e) ? e : J(e.default) ? e.default : t && J(e[t]) ? e[t] : t && J(e[t]?.default) ? e[t].default : e;
800
- }
801
- var $e = Y(u, "UiLayout") || Y(Q.UiLayout, "UiLayout"), X = Y(f, "PreviewPrompt") || Y(Q.PreviewPrompt, "PreviewPrompt"), et = Y(d, "Readable") || Y(Q.Readable, "Readable"), tt = Y(c, "Collapsible") || Y(Q.Collapsible, "Collapsible"), nt = l, Z = nt.default, Q = Z && typeof Z == "object" ? Z : nt, rt = p($e)({
802
- color: s.text(),
803
- backgroundColor: s.background(),
804
- display: "inline-block"
805
- }), it = p("div")({
806
- width: "100%",
807
- position: "relative",
808
- backgroundColor: s.background(),
809
- color: s.text()
810
- }), at = p("div")(({ theme: e }) => ({ marginBottom: e.spacing(2) })), ot = p("div")(({ theme: e }) => ({ marginBottom: e.spacing(2) })), st = p("div")({
811
- position: "relative",
812
- "& > div > div": {
813
- display: "flex",
814
- alignItems: "baseline",
815
- flexWrap: "wrap"
816
- },
817
- "& .mq-overarrow-inner": {
818
- border: "none !important",
819
- padding: "0 !important"
820
- },
821
- "& .mq-overarrow-inner-right": { display: "none !important" },
822
- "& .mq-overarrow-inner-left": { display: "none !important" },
823
- "& .mq-overarrow.mq-arrow-both": {
824
- minWidth: "1.23em",
825
- "& *": { lineHeight: "1 !important" },
826
- "&:before": {
827
- top: "-0.4em",
828
- left: "-1px"
829
- },
830
- "&:after": {
831
- top: "-2.4em",
832
- right: "-1px"
833
- },
834
- "&.mq-empty:after": { top: "-0.45em" }
835
- },
836
- "& .mq-overarrow.mq-arrow-right": { "&:before": {
837
- top: "-0.4em",
838
- right: "-1px"
839
- } },
840
- "& .mq-longdiv-inner": {
841
- borderTop: "1px solid !important",
842
- paddingTop: "1.5px !important"
843
- },
844
- "& .mq-parallelogram": { lineHeight: .85 }
845
- }), ct = p("div")(({ theme: e, $incorrect: t, $correct: n, $showCorrectness: r, $correctAnswerShown: i }) => ({
846
- maxWidth: "fit-content",
847
- ...t && { borderColor: `${s.incorrect()} !important` },
848
- ...n && { borderColor: `${s.correct()} !important` },
849
- ...r && { border: "2px solid" },
850
- ...i && {
851
- padding: e.spacing(1),
852
- letterSpacing: "0.5px"
853
- },
854
- "& > .mq-math-mode": {
855
- "& > .mq-root-block": { "& > .mq-editable-field": {
856
- minWidth: "10px",
857
- padding: e.spacing(.25)
858
- } },
859
- "& sup": { top: 0 }
860
- }
861
- })), lt = p(y.Static)({ "& > .mq-root-block": { "& > .mq-editable-field": { borderColor: s.text() } } }), ut = p("div")(({ theme: e }) => ({
862
- zIndex: 10,
863
- minWidth: "400px",
864
- marginTop: e.spacing(2)
865
- })), dt = p("div")(({ theme: e }) => ({
866
- marginBottom: e.spacing(1),
867
- pointerEvents: "none"
868
- })), ft = p("h2")({
869
- position: "absolute",
870
- left: "-10000px",
871
- top: "auto",
872
- width: "1px",
873
- height: "1px",
874
- overflow: "hidden"
875
- }), pt = p("div")(({ theme: e }) => ({ marginBottom: e.spacing(2) })), mt = p(Qe)(({ theme: e }) => ({
876
- color: s.text(),
877
- marginBottom: e.spacing(2)
878
- }));
879
- if (typeof document < "u") {
880
- let e = "math-templated-main-styles";
881
- if (!document.getElementById(e)) {
882
- let t = document.createElement("style");
883
- t.id = e, t.textContent = `
884
- .block-container {
885
- margin: 8px !important;
886
- display: inline-flex;
887
- border: 2px solid grey !important;
888
- }
889
- .block-response {
890
- flex: 2;
891
- color: grey;
892
- background: rgba(0, 0, 0, 0.04);
893
- font-size: 0.8rem !important;
894
- padding: 4px !important;
895
- display: flex;
896
- align-items: center;
897
- justify-content: center;
898
- border-right: 2px solid #bdbdbd !important;
899
- }
900
- .block-math {
901
- color: ${s.text()};
902
- background-color: ${s.background()};
903
- padding: 4px !important;
904
- display: flex;
905
- align-items: center;
906
- justify-content: center;
907
- flex: 8;
908
- }
909
- .block-math > .mq-math-mode > .mq-hasCursor > .mq-cursor {
910
- display: none;
911
- }
912
- .correct {
913
- border-color: ${s.correct()} !important;
914
- }
915
- .incorrect {
916
- border-color: ${s.incorrect()} !important;
917
- }
918
- `, document.head.appendChild(t);
919
- }
920
- }
921
- var ht = !1, $ = /(\{\{\d+\}\})/gm, gt = 6, _t = 8, vt = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
922
- function yt(e = []) {
923
- return e.map((e) => ({
924
- name: e,
925
- latex: e,
926
- write: e,
927
- label: e
928
- }));
929
- }
930
- function bt(e = [], t) {
931
- return Math.floor(e.length / 5) * 30 + (t === "miscellaneous" ? 600 : 500);
932
- }
933
- function xt(e) {
934
- return e.split($).filter((e) => e);
935
- }
936
- function St(e, t) {
937
- let { responses: n, disabled: r, markup: i, printMode: a, alwaysShowCorrect: o } = e || {};
938
- if (i) return t.showCorrect ? Object.keys(n || {}).reduce((e, t) => (e[t] = n?.[t]?.answer, e), {}) : xt(i).reduce((e, n) => {
939
- if (n.match($)) {
940
- let i = wt.getResponseKey(n), s = t.session.answers[`r${i}`];
941
- if (a && !o) {
942
- let t = "\\ \\ ".repeat(30) + "\\embed{newLine}[] ";
943
- return {
944
- ...e,
945
- [i]: `\\MathQuillMathField[r${i}]{${t.repeat(3)}}`
946
- };
947
- }
948
- return r ? {
949
- ...e,
950
- [i]: `\\embed{answerBlock}[r${i}]`
951
- } : {
952
- ...e,
953
- [i]: `\\MathQuillMathField[r${i}]{${s && s.value || ""}}`
954
- };
955
- }
956
- return e;
957
- }, {});
958
- }
959
- var Ct = {
960
- name: "smartHorizontalPlacement",
961
- enabled: !0,
962
- phase: "main",
963
- requires: ["popperOffsets"],
964
- fn: ({ state: e }) => {
965
- let t = e.modifiersData.popperOffsets;
966
- if (!t) return;
967
- let n = window.innerWidth || document.documentElement.clientWidth, r = e.rects.popper.width, i = e.elements.reference.getBoundingClientRect().left, a = e.elements.popper?.offsetParent, o = a?.getBoundingClientRect?.() || { left: 0 }, s = a?.scrollLeft || 0, c = i - o.left + s, l = c - i, u = l + _t, d = l + n - r - _t;
968
- i + r <= n ? t.x = c : t.x = c - r, d < u ? t.x = u : t.x = Math.min(Math.max(t.x, u), d);
969
- }
970
- }, wt = class e extends w.Component {
971
- static getResponseKey = (e) => (e || "").replaceAll("{{", "").replaceAll("}}", "");
972
- static propTypes = {
973
- session: O.default.object.isRequired,
974
- onSessionChange: O.default.func,
975
- model: O.default.object.isRequired
976
- };
977
- constructor(t) {
978
- super(t);
979
- let n = {}, { model: r, session: i } = t || {}, { markup: a, alwaysShowCorrect: o } = r || {}, { answers: s } = i || {};
980
- a && (a || "").replace($, (t) => {
981
- let r = e.getResponseKey(t), i = s && s[`r${r}`];
982
- n[`r${r}`] = { value: i?.value || "" };
983
- }), this.state = {
984
- session: {
985
- ...t.session,
986
- answers: n
987
- },
988
- activeAnswerBlock: "",
989
- showCorrect: o || !1,
990
- tooltipContainerRef: w.createRef()
991
- };
992
- }
993
- UNSAFE_componentWillMount() {
994
- typeof window < "u" && (ht ||= (_("answerBlock", (e) => ({
995
- htmlString: `<div class="block-container">
996
- <div class="block-response" id="${e}Index">R</div>
997
- <div class="block-math">
998
- <span id="${e}"></span>
999
- </div>
1000
- </div>`,
1001
- text: () => "text",
1002
- latex: () => `\\embed{answerBlock}[${e}]`
1003
- })), !0));
1004
- }
1005
- handleAnswerBlockDomUpdate = () => {
1006
- let { model: e } = this.props, { session: t, showCorrect: n } = this.state, r = t.answers;
1007
- this.root && e.disabled && !n && Object.keys(r).forEach((t) => {
1008
- let n = this.root.querySelector(`#${t}`), i = this.root.querySelector(`#${t}Index`);
1009
- if (n) {
1010
- let a = r[t];
1011
- b(n, a && a.value || ""), e.view && (n.parentElement.parentElement.classList.remove("correct"), n.parentElement.parentElement.classList.remove("incorrect")), i.textContent = "R";
1012
- }
1013
- }), S(this.root);
1014
- };
1015
- UNSAFE_componentWillReceiveProps(t) {
1016
- let { model: r } = this.props, { model: i = {} } = t || {}, { markup: a = "", env: o = {} } = r || {}, { markup: s = "", env: c = {}, alwaysShowCorrect: l = !1 } = i, u = (e) => e && e.mode === "evaluate";
1017
- (!u(o) || !u(c)) && this.setState((e) => ({
1018
- ...e.session,
1019
- showCorrect: !1
1020
- })), l && this.setState({ showCorrect: !0 });
1021
- let d = a.match($), f = s.match($);
1022
- if (!n(d, f)) {
1023
- let t = {}, n = this.state.session.answers;
1024
- (f || []).forEach((r) => {
1025
- let i = e.getResponseKey(r), a = n && n[`r${i}`];
1026
- t[`r${i}`] = { value: a?.value || "" };
1027
- }), this.setState((e) => ({ session: {
1028
- ...e.session,
1029
- answers: t
1030
- } }), () => {
1031
- this.props.onSessionChange(this.state.session), this.handleAnswerBlockDomUpdate();
1032
- });
1033
- }
1034
- }
1035
- shouldComponentUpdate(e, t) {
1036
- let r = n(this.props.model, e.model), i = n(this.state, t);
1037
- return !r || !i;
1038
- }
1039
- componentDidMount() {
1040
- this.handleAnswerBlockDomUpdate(), setTimeout(() => S(this.root), 100);
1041
- }
1042
- componentDidUpdate() {
1043
- this.handleAnswerBlockDomUpdate();
1044
- }
1045
- onSubFieldFocus = (e) => {
1046
- let t = Array.from(this.root?.querySelectorAll(".mq-editable-field") || []).map((e) => ({
1047
- el: e,
1048
- left: e.scrollLeft,
1049
- top: e.scrollTop
1050
- })), n = () => {
1051
- t.forEach(({ el: e, left: t, top: n }) => {
1052
- e.scrollLeft = t, e.scrollTop = n;
1053
- });
1054
- };
1055
- this.setState({ activeAnswerBlock: e }, () => {
1056
- n(), requestAnimationFrame(n), setTimeout(n, 0);
1057
- });
1058
- };
1059
- toNodeData = (e) => {
1060
- if (!e) return;
1061
- let { type: t, value: n } = e;
1062
- return t === "command" || t === "cursor" ? e : t === "answer" ? {
1063
- type: "answer",
1064
- ...e
1065
- } : n === "clear" ? { type: "clear" } : {
1066
- type: "write",
1067
- value: n
1068
- };
1069
- };
1070
- setInput = (e) => {
1071
- this.input = e;
1072
- };
1073
- onClick = (e) => {
1074
- let t = this.toNodeData(e);
1075
- t.type === "clear" ? this.input.clear() : t.type === "command" ? Array.isArray(t.value) ? t.value.forEach((e) => {
1076
- this.input.cmd(e);
1077
- }) : this.input.cmd(t.value) : t.type === "cursor" ? this.input.keystroke(t.value) : this.input.write(t.value);
1078
- let n = this.input?.el?.() || this.root, r = [], i = n;
1079
- for (; i && i !== document.body && i !== document.documentElement;) (i.scrollWidth > i.clientWidth || i.scrollHeight > i.clientHeight) && r.push(i), i = i.parentElement;
1080
- document.scrollingElement && r.push(document.scrollingElement);
1081
- let a = r.map((e) => ({
1082
- el: e,
1083
- left: e.scrollLeft,
1084
- top: e.scrollTop
1085
- })), o = {
1086
- x: window.scrollX,
1087
- y: window.scrollY
1088
- }, s = () => {
1089
- a.forEach(({ el: e, left: t, top: n }) => {
1090
- e.scrollLeft = t, e.scrollTop = n;
1091
- }), window.scrollTo(o.x, o.y);
1092
- };
1093
- this.input.focus(), s(), requestAnimationFrame(s), setTimeout(s, 0);
1094
- };
1095
- callOnSessionChange = () => {
1096
- let { onSessionChange: e } = this.props;
1097
- e && e(this.state.session);
1098
- };
1099
- toggleShowCorrect = (e) => {
1100
- this.setState({ showCorrect: e }, this.handleAnswerBlockDomUpdate);
1101
- };
1102
- subFieldChanged = (e, t) => {
1103
- v(), e && this.setState((n) => ({ session: {
1104
- ...n.session,
1105
- answers: {
1106
- ...n.session.answers,
1107
- [e]: { value: t }
1108
- }
1109
- } }), this.callOnSessionChange);
1110
- };
1111
- getFieldName = (e, t) => {
1112
- let { answers: n } = this.state.session;
1113
- if (Object.keys(n || {}).length) return Object.keys(n).find((n) => {
1114
- let r = t[n];
1115
- return r && r.id == e.id;
1116
- });
1117
- };
1118
- onBlur = (e) => {
1119
- let { relatedTarget: t, currentTarget: n } = e || {};
1120
- function r(e, t = 0) {
1121
- if (!e || t >= 16) return null;
1122
- let n = e.offsetParent;
1123
- return n ? n.getAttribute("role") === "tooltip" ? n : r(n, t + 1) : null;
1124
- }
1125
- function i(e, t = 0) {
1126
- if (!e || t >= 4) return null;
1127
- let n = e?.children?.[0];
1128
- return n ? n.attributes && n.attributes["data-keypad"] ? n : i(n, t + 1) : null;
1129
- }
1130
- let a = r(t), o = a ? i(a) : null;
1131
- (!t || !n || !o?.attributes["data-keypad"]) && this.setState({ activeAnswerBlock: "" });
1132
- };
1133
- setTooltipRef(e) {
1134
- setTimeout(() => {
1135
- if (e && vt) {
1136
- let e = document.querySelector("[role='tooltip']");
1137
- e && e.firstChild.setAttribute("tabindex", "-1");
1138
- }
1139
- }, 1);
1140
- }
1141
- renderTeacherInstructions = () => {
1142
- let { model: e } = this.props, { teacherInstructions: t, animationsDisabled: n } = e || {}, r = t && (x(t) || g(t)), i = /* @__PURE__ */ E(X, {
1143
- defaultClassName: "teacher-instructions",
1144
- prompt: t
1145
- });
1146
- return r && /* @__PURE__ */ E(ot, { children: n ? i : /* @__PURE__ */ E(tt, {
1147
- labels: {
1148
- hidden: "Show Teacher Instructions",
1149
- visible: "Hide Teacher Instructions"
1150
- },
1151
- children: i
1152
- }) });
1153
- };
1154
- renderRationale = () => {
1155
- let { model: e } = this.props, { rationale: t, animationsDisabled: n } = e || {}, r = /* @__PURE__ */ E(X, { prompt: t });
1156
- return t && (x(t) || g(t)) && /* @__PURE__ */ E(ot, { children: n ? r : /* @__PURE__ */ E(tt, {
1157
- labels: {
1158
- hidden: "Show Rationale",
1159
- visible: "Hide Rationale"
1160
- },
1161
- children: r
1162
- }) });
1163
- };
1164
- renderPlayerContent = () => {
1165
- let { model: e } = this.props, { activeAnswerBlock: t, showCorrect: n, session: i, tooltipContainerRef: a } = this.state, { correctness: s, disabled: c, view: l, responses: u, equationEditor: d, customKeys: f, feedback: p, env: { mode: h } = {}, printMode: g, alwaysShowCorrect: _ } = e || {}, v = r(u), y = yt(f), b = St(e, this.state) || "", x = g && !_;
1166
- return /* @__PURE__ */ E(st, { children: /* @__PURE__ */ E(ze, {
1167
- disabled: c,
1168
- markup: e.markup,
1169
- value: {},
1170
- customMarkMarkupComponent: (e) => {
1171
- let r = h === "evaluate" && p && p[e], u = /* @__PURE__ */ E(lt, {
1172
- ref: (e) => {
1173
- this.mqStatic = e || this.mqStatic;
1174
- },
1175
- latex: b[e],
1176
- onSubFieldChange: this.subFieldChanged,
1177
- getFieldName: this.getFieldName,
1178
- setInput: this.setInput,
1179
- onSubFieldFocus: this.onSubFieldFocus,
1180
- onBlur: this.onBlur
1181
- });
1182
- return /* @__PURE__ */ E(ct, {
1183
- ref: a,
1184
- $incorrect: !v && !r && !n,
1185
- $correct: !v && (r || n),
1186
- $showCorrectness: !v && c && s && !l,
1187
- $correctAnswerShown: n,
1188
- children: /* @__PURE__ */ E(o, {
1189
- ref: (e) => this.setTooltipRef(e),
1190
- enterTouchDelay: 0,
1191
- interactive: !0,
1192
- open: t === `r${e}`,
1193
- slotProps: {
1194
- popper: {
1195
- container: a?.current || void 0,
1196
- placement: "bottom-start",
1197
- sx: {
1198
- backgroundColor: "transparent",
1199
- width: "auto",
1200
- opacity: 1,
1201
- "& .MuiTooltip-arrow": { display: "none" }
1202
- },
1203
- modifiers: [
1204
- {
1205
- name: "preventOverflow",
1206
- enabled: !1
1207
- },
1208
- {
1209
- name: "flip",
1210
- enabled: !1
1211
- },
1212
- Ct
1213
- ]
1214
- },
1215
- tooltip: { sx: {
1216
- fontSize: "initial",
1217
- backgroundColor: "transparent",
1218
- width: "auto",
1219
- maxWidth: "none",
1220
- marginTop: 0,
1221
- paddingTop: 0,
1222
- boxShadow: "none"
1223
- } }
1224
- },
1225
- title: Object.keys(i.answers).map((e) => e === t && !(n || c) && /* @__PURE__ */ E(ut, {
1226
- "data-keypad": !0,
1227
- style: { width: bt(y, d) },
1228
- children: /* @__PURE__ */ E(m, {
1229
- additionalKeys: y,
1230
- mode: d || gt,
1231
- onClick: this.onClick
1232
- })
1233
- }, e) || null),
1234
- children: E(x ? dt : "div", { children: u })
1235
- })
1236
- });
1237
- }
1238
- }) });
1239
- };
1240
- render() {
1241
- let { model: e } = this.props, { showCorrect: t } = this.state, { prompt: n, env: { mode: i, role: a } = {}, extraCSSRules: o, correctness: s, responses: c, language: l, showNote: u, note: d } = e || {}, f = !r(c) && s && s.correctness !== "correct", p = (t || i === "view" && a === "instructor") && u && d;
1242
- return /* @__PURE__ */ E(rt, {
1243
- extraCSSRules: o,
1244
- ref: (e) => {
1245
- let t = ee.findDOMNode(e);
1246
- this.root = t || this.root;
1247
- },
1248
- children: /* @__PURE__ */ D(it, { children: [
1249
- i === "gather" && /* @__PURE__ */ E(ft, { children: "Math Equation Response Question" }),
1250
- /* @__PURE__ */ E(it, { children: f && /* @__PURE__ */ E(mt, {
1251
- language: l,
1252
- show: !0,
1253
- toggled: t,
1254
- onToggle: this.toggleShowCorrect
1255
- }) }),
1256
- this.renderTeacherInstructions(),
1257
- n && /* @__PURE__ */ E(at, { children: /* @__PURE__ */ E(X, { prompt: n }) }),
1258
- /* @__PURE__ */ E(et, {
1259
- false: !0,
1260
- children: this.renderPlayerContent()
1261
- }),
1262
- p && /* @__PURE__ */ E(pt, {
1263
- className: "note",
1264
- dangerouslySetInnerHTML: { __html: d }
1265
- }),
1266
- this.renderRationale()
1267
- ] })
1268
- });
1269
- }
1270
- };
1271
- //#endregion
1272
- export { wt as t };
1273
-
1274
- //# sourceMappingURL=main-I_wWeaur.js.map