@pie-element/graphing-solution-set 6.1.2-next.1 → 6.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 (88) hide show
  1. package/CHANGELOG.json +1 -0
  2. package/CHANGELOG.md +856 -0
  3. package/LICENSE.md +5 -0
  4. package/README.md +20 -0
  5. package/configure/CHANGELOG.json +1 -0
  6. package/configure/CHANGELOG.md +816 -0
  7. package/configure/lib/configure.js +312 -0
  8. package/configure/lib/configure.js.map +1 -0
  9. package/configure/lib/correct-response.js +435 -0
  10. package/configure/lib/correct-response.js.map +1 -0
  11. package/configure/lib/defaults.js +357 -0
  12. package/configure/lib/defaults.js.map +1 -0
  13. package/configure/lib/graphing-config.js +408 -0
  14. package/configure/lib/graphing-config.js.map +1 -0
  15. package/configure/lib/index.js +163 -0
  16. package/configure/lib/index.js.map +1 -0
  17. package/configure/lib/utils.js +630 -0
  18. package/configure/lib/utils.js.map +1 -0
  19. package/configure/package.json +29 -0
  20. package/controller/CHANGELOG.json +1 -0
  21. package/controller/CHANGELOG.md +675 -0
  22. package/controller/lib/defaults.js +69 -0
  23. package/controller/lib/defaults.js.map +1 -0
  24. package/controller/lib/index.js +351 -0
  25. package/controller/lib/index.js.map +1 -0
  26. package/controller/lib/utils.js +212 -0
  27. package/controller/lib/utils.js.map +1 -0
  28. package/controller/package.json +22 -0
  29. package/demo-gss.gif +0 -0
  30. package/docs/config-schema.json +1560 -0
  31. package/docs/config-schema.json.md +1114 -0
  32. package/docs/demo/config.js +8 -0
  33. package/docs/demo/generate.js +54 -0
  34. package/docs/demo/index.html +1 -0
  35. package/docs/demo/session.js +6 -0
  36. package/docs/pie-schema.json +1800 -0
  37. package/docs/pie-schema.json.md +952 -0
  38. package/lib/index.js +164 -0
  39. package/lib/index.js.map +1 -0
  40. package/lib/main.js +355 -0
  41. package/lib/main.js.map +1 -0
  42. package/lib/utils.js +515 -0
  43. package/lib/utils.js.map +1 -0
  44. package/package.json +23 -86
  45. package/configure.js +0 -2
  46. package/controller.js +0 -1
  47. package/dist/author/configure.d.ts +0 -26
  48. package/dist/author/configure.js +0 -190
  49. package/dist/author/correct-response.d.ts +0 -33
  50. package/dist/author/correct-response.js +0 -206
  51. package/dist/author/defaults.d.ts +0 -238
  52. package/dist/author/defaults.js +0 -339
  53. package/dist/author/graphing-config.d.ts +0 -33
  54. package/dist/author/graphing-config.js +0 -237
  55. package/dist/author/index.d.ts +0 -62
  56. package/dist/author/index.js +0 -87
  57. package/dist/author/utils.d.ts +0 -46
  58. package/dist/author/utils.js +0 -474
  59. package/dist/browser/author/index.js +0 -1942
  60. package/dist/browser/author/index.js.map +0 -1
  61. package/dist/browser/browser-pUycHh7Y.js +0 -348
  62. package/dist/browser/browser-pUycHh7Y.js.map +0 -1
  63. package/dist/browser/controller/index.js +0 -193
  64. package/dist/browser/controller/index.js.map +0 -1
  65. package/dist/browser/delivery/index.js +0 -782
  66. package/dist/browser/delivery/index.js.map +0 -1
  67. package/dist/browser/dist-BxTk7Laj.js +0 -57671
  68. package/dist/browser/dist-BxTk7Laj.js.map +0 -1
  69. package/dist/browser/graphing-solution-set.css +0 -2
  70. package/dist/controller/defaults.d.ts +0 -64
  71. package/dist/controller/defaults.js +0 -54
  72. package/dist/controller/index.d.ts +0 -24
  73. package/dist/controller/index.js +0 -110
  74. package/dist/controller/utils.d.ts +0 -20
  75. package/dist/controller/utils.js +0 -39
  76. package/dist/delivery/index.d.ts +0 -22
  77. package/dist/delivery/index.js +0 -62
  78. package/dist/delivery/main.d.ts +0 -31
  79. package/dist/delivery/main.js +0 -198
  80. package/dist/delivery/utils.d.ts +0 -12
  81. package/dist/delivery/utils.js +0 -220
  82. package/dist/graphing-solution-set.css +0 -2
  83. package/dist/index.d.ts +0 -1
  84. package/dist/index.iife.d.ts +0 -8
  85. package/dist/index.iife.js +0 -405
  86. package/dist/index.js +0 -2
  87. package/dist/runtime-support.d.ts +0 -12
  88. package/dist/runtime-support.js +0 -12
@@ -1,1942 +0,0 @@
1
- import { E as e, g as t, o as n, r, t as i } from "../browser-pUycHh7Y.js";
2
- import { B as a, D as o, E as s, H as c, I as l, L as u, M as d, N as f, O as p, P as m, R as h, U as g, V as _, _ as v, a as y, b, c as x, d as S, f as C, g as w, h as T, i as E, j as D, m as O, n as k, o as A, p as j, r as M, s as N, t as P, u as F, v as I, x as L, y as ee, z as R } from "../dist-BxTk7Laj.js";
3
- import * as z from "react";
4
- import B from "react";
5
- import { createRoot as te } from "react-dom/client";
6
- import { Fragment as ne, jsx as V, jsxs as H } from "react/jsx-runtime";
7
- //#region ../../../node_modules/.bun/@mui+material@7.3.11+eb26afe407ed7030/node_modules/@mui/material/esm/FormGroup/formGroupClasses.js
8
- function re(e) {
9
- return a("MuiFormGroup", e);
10
- }
11
- R("MuiFormGroup", [
12
- "root",
13
- "row",
14
- "error"
15
- ]);
16
- //#endregion
17
- //#region ../../../node_modules/.bun/@mui+material@7.3.11+eb26afe407ed7030/node_modules/@mui/material/esm/FormGroup/FormGroup.js
18
- var ie = (e) => {
19
- let { classes: t, row: n, error: r } = e;
20
- return h({ root: [
21
- "root",
22
- n && "row",
23
- r && "error"
24
- ] }, re, t);
25
- }, ae = u("div", {
26
- name: "MuiFormGroup",
27
- slot: "Root",
28
- overridesResolver: (e, t) => {
29
- let { ownerState: n } = e;
30
- return [t.root, n.row && t.row];
31
- }
32
- })({
33
- display: "flex",
34
- flexDirection: "column",
35
- flexWrap: "wrap",
36
- variants: [{
37
- props: { row: !0 },
38
- style: { flexDirection: "row" }
39
- }]
40
- }), oe = /*#__PURE__*/ z.forwardRef(function(e, t) {
41
- let n = m({
42
- props: e,
43
- name: "MuiFormGroup"
44
- }), { className: r, row: i = !1, ...a } = n, s = p({
45
- props: n,
46
- muiFormControl: o(),
47
- states: ["error"]
48
- }), c = {
49
- ...n,
50
- row: i,
51
- error: s.error
52
- };
53
- return /*#__PURE__*/ V(ae, {
54
- className: _(ie(c).root, r),
55
- ownerState: c,
56
- ref: t,
57
- ...a
58
- });
59
- });
60
- //#endregion
61
- //#region ../../../node_modules/.bun/@mui+material@7.3.11+eb26afe407ed7030/node_modules/@mui/material/esm/RadioGroup/radioGroupClasses.js
62
- function se(e) {
63
- return a("MuiRadioGroup", e);
64
- }
65
- R("MuiRadioGroup", [
66
- "root",
67
- "row",
68
- "error"
69
- ]);
70
- //#endregion
71
- //#region ../../../node_modules/.bun/@mui+material@7.3.11+eb26afe407ed7030/node_modules/@mui/material/esm/RadioGroup/RadioGroup.js
72
- var ce = (e) => {
73
- let { classes: t, row: n, error: r } = e;
74
- return h({ root: [
75
- "root",
76
- n && "row",
77
- r && "error"
78
- ] }, se, t);
79
- }, le = /*#__PURE__*/ z.forwardRef(function(e, t) {
80
- let { actions: n, children: r, className: i, defaultValue: a, name: o, onChange: s, value: c, ...l } = e, u = z.useRef(null), p = ce(e), [m, h] = D({
81
- controlled: c,
82
- default: a,
83
- name: "RadioGroup"
84
- });
85
- z.useImperativeHandle(n, () => ({ focus: () => {
86
- let e = u.current.querySelector("input:not(:disabled):checked");
87
- e ||= u.current.querySelector("input:not(:disabled)"), e && e.focus();
88
- } }), []);
89
- let g = f(t, u), v = d(o), y = z.useMemo(() => ({
90
- name: v,
91
- onChange(e) {
92
- h(e.target.value), s && s(e, e.target.value);
93
- },
94
- value: m
95
- }), [
96
- v,
97
- s,
98
- h,
99
- m
100
- ]);
101
- return /*#__PURE__*/ V(S.Provider, {
102
- value: y,
103
- children: /*#__PURE__*/ V(oe, {
104
- role: "radiogroup",
105
- ref: g,
106
- className: _(p.root, i),
107
- ...l,
108
- children: r
109
- })
110
- });
111
- }), U = /* @__PURE__ */ e(c(), 1);
112
- function W(e) {
113
- return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
114
- }
115
- function ue(e, t) {
116
- return !e || W(e) ? e : W(e.default) ? e.default : t && W(e[t]) ? e[t] : t && W(e[t]?.default) ? e[t].default : e;
117
- }
118
- var de = ue(s, "InputContainer") || ue(pe.InputContainer, "InputContainer"), fe = L, G = fe.default, pe = G && typeof G == "object" ? G : fe, me = u("div")(() => ({ width: "450px" })), he = u("div")(() => ({
119
- display: "flex",
120
- flexDirection: "column",
121
- width: "100%"
122
- })), K = u("div")(() => ({
123
- display: "flex",
124
- flexDirection: "column",
125
- alignItems: "center"
126
- })), ge = u("div")(() => ({
127
- display: "flex",
128
- justifyContent: "space-around",
129
- alignItems: "center"
130
- })), _e = u("div")(({ theme: e }) => ({
131
- width: "130px",
132
- margin: `${e.spacing(1)} ${e.spacing(.5)}`
133
- })), q = u("div")(({ theme: e }) => ({
134
- width: "160px",
135
- margin: `${e.spacing(1)} ${e.spacing(.5)}`,
136
- "& .MuiFormControl-root": { width: "100%" }
137
- })), ve = u("div")(({ theme: e }) => ({
138
- width: "230px",
139
- margin: `${e.spacing(1)} ${e.spacing(.5)}`,
140
- "& .MuiFormControl-root": { width: "100%" }
141
- })), ye = u(b)(({ theme: e }) => ({
142
- fontStyle: "italic",
143
- margin: `${e.spacing(1)} 0`
144
- })), be = u("div")(() => ({
145
- display: "flex",
146
- justifyContent: "space-between",
147
- alignItems: "center"
148
- })), xe = u(b)(() => ({ color: l.disabled() })), Se = u("div")(({ theme: e }) => ({ paddingTop: e.spacing(2) })), J = (e) => {
149
- let { disabled: t, displayedFields: n, labelValue: r, labelValues: i, gridValue: a, gridValues: o, onChange: s } = e, { labelStep: c = {}, step: l = {} } = n;
150
- return /* @__PURE__ */ H(K, { children: [l && l.enabled && /* @__PURE__ */ V(q, { children: /* @__PURE__ */ V(y, {
151
- label: l.label || "",
152
- value: a,
153
- customValues: o,
154
- variant: "outlined",
155
- disabled: t,
156
- onChange: (e, t) => s("step", t)
157
- }) }), c && c.enabled && /* @__PURE__ */ V(q, { children: /* @__PURE__ */ V(y, {
158
- label: c.label || "",
159
- value: r,
160
- customValues: i,
161
- variant: "outlined",
162
- disabled: t,
163
- onChange: (e, t) => s("labelStep", t)
164
- }) })] });
165
- };
166
- J.propTypes = {
167
- disabled: U.default.bool,
168
- displayedFields: U.default.object,
169
- labelValue: U.default.number,
170
- labelValues: U.default.array,
171
- gridValue: U.default.number,
172
- gridValues: U.default.array,
173
- onChange: U.default.func
174
- };
175
- var Y = (e) => {
176
- let { disabled: t, displayedFields: n, displayHeader: r, label: i, maxValue: a, minValue: o, onChange: s, type: c } = e, { axisLabel: l = {}, min: u = {}, max: d = {} } = n;
177
- return /* @__PURE__ */ H(K, { children: [
178
- r && /* @__PURE__ */ H(b, {
179
- variant: "subtitle2",
180
- children: [/* @__PURE__ */ V("i", { children: c === "domain" ? "x" : "y" }), "-axis"]
181
- }),
182
- u && u.enabled && /* @__PURE__ */ V(q, { children: /* @__PURE__ */ V(y, {
183
- label: u.label || "",
184
- value: o,
185
- min: -1e4,
186
- max: a - .05,
187
- variant: "outlined",
188
- disabled: t,
189
- onChange: (e, t) => s("min", t)
190
- }) }),
191
- d && d.enabled && /* @__PURE__ */ V(q, { children: /* @__PURE__ */ V(y, {
192
- label: d.label || "",
193
- value: a,
194
- min: o + .05,
195
- max: 1e4,
196
- variant: "outlined",
197
- disabled: t,
198
- onChange: (e, t) => s("max", t)
199
- }) }),
200
- l && l.enabled && /* @__PURE__ */ V(q, { children: /* @__PURE__ */ V(de, {
201
- label: l.label || "",
202
- children: /* @__PURE__ */ V(Se, { children: /* @__PURE__ */ V(w, {
203
- onChange: (e) => s("axisLabel", e),
204
- markup: i || "",
205
- charactersLimit: 5,
206
- onKeyDown: (e) => e.key === "Enter",
207
- activePlugins: [
208
- "bold",
209
- "italic",
210
- "underline",
211
- "strikethrough"
212
- ]
213
- }) })
214
- }) })
215
- ] });
216
- };
217
- Y.propTypes = {
218
- disabled: U.default.bool,
219
- displayedFields: U.default.object,
220
- displayHeader: U.default.bool,
221
- label: U.default.string,
222
- maxValue: U.default.number,
223
- minValue: U.default.number,
224
- type: U.default.string,
225
- onChange: U.default.func
226
- };
227
- var Ce = (e) => {
228
- let { domain: t, displayedFields: n = {}, gridValues: r = {}, includeAxes: i, labelValues: a = {}, onChange: o, onChangeView: s, range: c, size: l, sizeConstraints: u, standardGrid: d } = e, f = {
229
- min: 2,
230
- max: 41
231
- }, { axisLabel: p = {}, dimensionsEnabled: m, includeAxesEnabled: h, labelStep: g = {}, min: _ = {}, max: v = {}, standardGridEnabled: S, step: C = {} } = n || {}, w = _.enabled || v.enabled || p.enabled || C.enabled || g.enabled, E = {
232
- step: C,
233
- labelStep: g
234
- }, D = {
235
- min: _,
236
- max: v,
237
- axisLabel: p
238
- }, k = (e) => {
239
- let n = (e) => {
240
- let n = e === "domain" ? t : c;
241
- return {
242
- min: 1,
243
- max: n.max < f.min || n.max > f.max ? 16 : n.max,
244
- step: 1,
245
- labelStep: 0
246
- };
247
- };
248
- o({
249
- includeAxes: e,
250
- range: {
251
- ...c,
252
- ...e ? { labelStep: 1 } : n("range")
253
- },
254
- domain: {
255
- ...t,
256
- ...e ? { labelStep: 1 } : n("domain")
257
- }
258
- });
259
- }, A = (e) => {
260
- o({
261
- standardGrid: e,
262
- range: {
263
- ...t,
264
- axisLabel: c.axisLabel
265
- },
266
- graph: {
267
- ...l,
268
- height: l.width
269
- }
270
- });
271
- }, N = (e, t) => {
272
- let n = {
273
- ...l,
274
- [e]: t
275
- };
276
- d && (n.height = t), o({ graph: n });
277
- }, P = (e, n) => {
278
- t[e] = n, d && e !== "axisLabel" && (c[e] = n), o({
279
- domain: t,
280
- range: c
281
- });
282
- }, F = (e, t) => {
283
- c[e] = t, o({ range: c });
284
- }, I = /* @__PURE__ */ H(ne, { children: [
285
- /* @__PURE__ */ H(ge, { children: [/* @__PURE__ */ V(Y, {
286
- displayedFields: D,
287
- displayHeader: w,
288
- type: "domain",
289
- minValue: t.min,
290
- maxValue: t.max,
291
- label: t.axisLabel,
292
- includeAxes: i,
293
- onChange: P
294
- }), /* @__PURE__ */ V(Y, {
295
- displayedFields: D,
296
- displayHeader: w,
297
- type: "range",
298
- minValue: c.min,
299
- maxValue: c.max,
300
- label: c.axisLabel,
301
- disabled: d,
302
- includeAxes: i,
303
- onChange: F
304
- })] }),
305
- (_.enabled || v.enabled) && /* @__PURE__ */ V(ye, { children: "If you want the axis to be visible, use a zero or negative Min Value, and a positive Max Value" }),
306
- (C.enabled || g.enabled) && /* @__PURE__ */ H(ge, { children: [/* @__PURE__ */ V(J, {
307
- displayedFields: E,
308
- gridValue: t.step,
309
- labelValue: t.labelStep,
310
- gridValues: r.domain || [],
311
- labelValues: a.domain || [],
312
- onChange: P
313
- }), /* @__PURE__ */ V(J, {
314
- disabled: d,
315
- displayedFields: E,
316
- gridValue: c.step,
317
- labelValue: c.labelStep,
318
- gridValues: r.range || [],
319
- labelValues: a.range || [],
320
- onChange: F
321
- })] }),
322
- g.enabled && /* @__PURE__ */ V(ye, { children: "For unnumbered gridlines, enter a label interval of 0" })
323
- ] }), L = v.enabled ? /* @__PURE__ */ H(K, { children: [/* @__PURE__ */ V(ve, { children: /* @__PURE__ */ V(y, {
324
- label: "Number of Vertical Gridlines",
325
- value: t.max,
326
- min: !i && f.min,
327
- max: !i && f.max,
328
- variant: "outlined",
329
- onChange: (e, t) => P("max", t)
330
- }) }), /* @__PURE__ */ V(ve, { children: /* @__PURE__ */ V(y, {
331
- label: "Number of Horizontal Gridlines",
332
- value: c.max,
333
- min: !i && f.min,
334
- max: !i && f.max,
335
- variant: "outlined",
336
- disabled: d,
337
- onChange: (e, t) => F("max", t)
338
- }) })] }) : null;
339
- return /* @__PURE__ */ V(me, { children: /* @__PURE__ */ H(T, {
340
- onChange: s,
341
- TransitionProps: { timeout: {
342
- enter: 225,
343
- exit: 195
344
- } },
345
- children: [/* @__PURE__ */ V(j, {
346
- expandIcon: /* @__PURE__ */ V(x, {}),
347
- children: /* @__PURE__ */ V(b, {
348
- variant: "subtitle1",
349
- children: "Customize Grid Setup"
350
- })
351
- }), /* @__PURE__ */ V(O, { children: /* @__PURE__ */ H(he, { children: [
352
- h && /* @__PURE__ */ V(M, {
353
- label: "Include axes and labels?",
354
- toggle: k,
355
- checked: i
356
- }),
357
- S && /* @__PURE__ */ V(M, {
358
- label: "Constrain to standard coordinate grid?",
359
- toggle: A,
360
- checked: d
361
- }),
362
- i ? I : L,
363
- m && /* @__PURE__ */ H(be, { children: [
364
- /* @__PURE__ */ H("div", { children: [/* @__PURE__ */ V(b, { children: "Dimensions(px)" }), /* @__PURE__ */ H(xe, { children: [
365
- "Min ",
366
- u.min,
367
- ", Max ",
368
- u.max
369
- ] })] }),
370
- /* @__PURE__ */ V(_e, { children: /* @__PURE__ */ V(y, {
371
- label: "Width",
372
- value: l.width,
373
- min: u.min,
374
- max: u.max,
375
- step: u.step,
376
- variant: "outlined",
377
- onChange: (e, t) => N("width", t)
378
- }) }),
379
- /* @__PURE__ */ V(_e, { children: /* @__PURE__ */ V(y, {
380
- label: "Height",
381
- value: l.height,
382
- min: u.min,
383
- max: u.max,
384
- step: u.step,
385
- variant: "outlined",
386
- disabled: d,
387
- onChange: (e, t) => N("height", t)
388
- }) })
389
- ] })
390
- ] }) })]
391
- }) });
392
- };
393
- Ce.propTypes = {
394
- domain: U.default.object,
395
- displayedFields: U.default.object,
396
- gridValues: U.default.object,
397
- includeAxes: U.default.bool,
398
- labelValues: U.default.object,
399
- onChange: U.default.func,
400
- onChangeView: U.default.func,
401
- range: U.default.object,
402
- size: U.default.object,
403
- sizeConstraints: U.default.object,
404
- standardGrid: U.default.bool
405
- };
406
- //#endregion
407
- //#region src/author/utils.ts
408
- var we = /* @__PURE__ */ e(i(), 1), Te = [
409
- .01,
410
- .02,
411
- .04,
412
- .05,
413
- .0625,
414
- .1,
415
- .125,
416
- .2,
417
- .25,
418
- .5,
419
- 1,
420
- 2,
421
- 3,
422
- 4,
423
- 5,
424
- 8,
425
- 10,
426
- 12,
427
- 15,
428
- 20,
429
- 40,
430
- 50,
431
- 64,
432
- 100,
433
- 500,
434
- 1e3
435
- ], Ee = [
436
- .01,
437
- .02,
438
- .05,
439
- .1,
440
- .2,
441
- .25,
442
- .5,
443
- 1,
444
- 2,
445
- 5,
446
- 10,
447
- 20,
448
- 50,
449
- 100,
450
- 500,
451
- 1e3
452
- ], De = {
453
- .01: [
454
- 0,
455
- .01,
456
- .02,
457
- .04,
458
- .05,
459
- .1
460
- ],
461
- .02: [
462
- 0,
463
- .02,
464
- .04,
465
- .1
466
- ],
467
- .04: [
468
- 0,
469
- .04,
470
- .08,
471
- .16,
472
- .2
473
- ],
474
- .05: [
475
- 0,
476
- .05,
477
- .1,
478
- .2,
479
- .25
480
- ],
481
- .0625: [
482
- 0,
483
- .0625,
484
- .125,
485
- .25,
486
- .5
487
- ],
488
- .1: [
489
- 0,
490
- .1,
491
- .2,
492
- .4,
493
- .5,
494
- 1
495
- ],
496
- .125: [
497
- 0,
498
- .125,
499
- .25,
500
- .5,
501
- 1
502
- ],
503
- .2: [
504
- 0,
505
- .2,
506
- .5,
507
- .1
508
- ],
509
- .25: [
510
- 0,
511
- .25,
512
- .5,
513
- 1,
514
- 2
515
- ],
516
- .5: [
517
- 0,
518
- .5,
519
- 1,
520
- 2
521
- ],
522
- 1: [
523
- 0,
524
- 1,
525
- 2,
526
- 4,
527
- 5,
528
- 10
529
- ],
530
- 2: [
531
- 0,
532
- 2,
533
- 4,
534
- 8,
535
- 10
536
- ],
537
- 3: [
538
- 0,
539
- 3,
540
- 6,
541
- 12,
542
- 15
543
- ],
544
- 4: [
545
- 0,
546
- 4,
547
- 8,
548
- 16,
549
- 20
550
- ],
551
- 5: [
552
- 0,
553
- 5,
554
- 10,
555
- 20,
556
- 25
557
- ],
558
- 8: [
559
- 0,
560
- 8,
561
- 16,
562
- 32,
563
- 40,
564
- 64
565
- ],
566
- 10: [
567
- 0,
568
- 10,
569
- 20,
570
- 40,
571
- 50,
572
- 100
573
- ],
574
- 12: [
575
- 0,
576
- 12,
577
- 24
578
- ],
579
- 15: [
580
- 0,
581
- 15,
582
- 30,
583
- 60
584
- ],
585
- 20: [
586
- 0,
587
- 20,
588
- 40,
589
- 80,
590
- 100
591
- ],
592
- 40: [
593
- 0,
594
- 40,
595
- 80,
596
- 160,
597
- 200
598
- ],
599
- 50: [
600
- 0,
601
- 50,
602
- 100,
603
- 200,
604
- 250
605
- ],
606
- 64: [
607
- 0,
608
- 64,
609
- 128
610
- ],
611
- 100: [
612
- 0,
613
- 100,
614
- 200,
615
- 400,
616
- 500
617
- ],
618
- 500: [
619
- 0,
620
- 500,
621
- 1e3,
622
- 2500
623
- ],
624
- 1e3: [
625
- 0,
626
- 1e3,
627
- 2e3,
628
- 4e3,
629
- 5e3
630
- ]
631
- }, X = (e, t, n = !1) => {
632
- let r = 10 * (e.max - e.min) / t, i = r * 10;
633
- return (n ? Ee : Te).filter((e) => e >= r && e <= i);
634
- }, Z = (e) => De[e] || [], Oe = (e, t, n, i) => {
635
- let a = X(e, t), o = Z(e.step);
636
- if (!r(n, a) && !a.includes(e.step)) {
637
- let n = X(e, t, !0)[0] || 1;
638
- return e.step = n, o = Z(n), o.includes(e.labelStep) || (e.labelStep = n), {
639
- gridValues: a,
640
- labelValues: o
641
- };
642
- }
643
- return !r(i, o) && !o.includes(e.labelStep) && (e.labelStep = e.step), {
644
- gridValues: a,
645
- labelValues: o
646
- };
647
- }, ke = (e) => {
648
- let t = [], n = 0;
649
- for (; n >= e.min && t.indexOf(n) < 0;) t.push(n), n = Math.round((n - e.step) * 1e4) / 1e4;
650
- for (n = Math.round(e.step * 1e4) / 1e4; n <= e.max && t.indexOf(n) < 0;) t.push(n), n = Math.round((n + e.step) * 1e4) / 1e4;
651
- return t ? t.filter((t) => t >= e.min && t <= e.max) : [];
652
- }, Ae = (e, t, n) => {
653
- let r = ke(e), i = ke(t), a = (e, t) => r.includes(e) && i.includes(t);
654
- return Object.entries(n || {}).reduce((e, [t, n]) => (e[t] = {
655
- ...n,
656
- marks: (n.marks || []).filter((e) => {
657
- if (e.type === "point") return a(e.x, e.y);
658
- if (e.type === "polygon") return !e.points.find((e) => !a(e.x, e.y));
659
- let t = e.from || e.root, n = e.to || e.edge;
660
- return e.building ? a(t.x, t.y) : a(t.x, t.y) && a(n.x, n.y);
661
- })
662
- }, e), {});
663
- }, je = (e, t) => Number(Math.sqrt((e.x - t.x) ** 2 + (e.y - t.y) ** 2).toFixed(3)), Q = (e, t) => {
664
- let n = e, r = !1, i = [...t];
665
- i.push(t[0]);
666
- for (let e = 0; e < i.length - 1; e++) {
667
- let t = i[e], a = i[e + 1];
668
- if (je(t, n) + je(n, a) === je(t, a)) {
669
- r = !0;
670
- break;
671
- }
672
- }
673
- return r;
674
- }, Me = (e, t, n, r, i, a, o, s) => {
675
- let c, l = (s - a) * (n - e) - (o - i) * (r - t);
676
- return l === 0 ? null : (c = ((o - i) * (t - a) - (s - a) * (e - i)) / l, {
677
- x: Number((e + c * (n - e)).toFixed(3)),
678
- y: Number((t + c * (r - t)).toFixed(3))
679
- });
680
- }, Ne = (e, t, n) => e.x > t.min && e.x < t.max && e.y > n.min && e.y < n.max, Pe = (e, t, n) => e.x >= t.min && e.x <= t.max && e.y >= n.min && e.y <= n.max, Fe = (e, t, n) => {
681
- let r = [], i = [
682
- [
683
- t.max,
684
- n.max,
685
- t.max,
686
- n.min
687
- ],
688
- [
689
- t.min,
690
- n.max,
691
- t.min,
692
- n.min
693
- ],
694
- [
695
- t.min,
696
- n.max,
697
- t.max,
698
- n.max
699
- ],
700
- [
701
- t.min,
702
- n.min,
703
- t.max,
704
- n.min
705
- ]
706
- ];
707
- for (let a = 0; a < i.length; a++) {
708
- let o = Me(e.from.x, e.from.y, e.to.x, e.to.y, i[a][0], i[a][1], i[a][2], i[a][3]);
709
- o && Pe(o, t, n) && r.push(o);
710
- }
711
- return r;
712
- }, Ie = (e) => {
713
- e.sort((e, t) => e.y - t.y);
714
- let t = (e[0].y + e[e.length - 1].y) / 2;
715
- e.sort((e, t) => t.x - e.x);
716
- let n = {
717
- x: (e[0].x + e[e.length - 1].x) / 2,
718
- y: t
719
- }, r;
720
- e.forEach((e) => {
721
- let t = Math.atan2(e.y - n.y, e.x - n.x);
722
- r ? t < r && (t += Math.PI * 2) : r = t, e.angle = t;
723
- }), e.sort((e, t) => e.angle - t.angle);
724
- let i = e.reverse();
725
- return i.unshift(i.pop()), i.map(({ angle: e, ...t }) => t);
726
- }, Le = (e, t) => e.x * t.x + e.y * t.y, Re = (e) => Math.sqrt(e.x * e.x + e.y * e.y), ze = (e, t) => {
727
- let n = Le(e, t), r = Re(e), i = Re(t);
728
- return Math.acos(n / (r * i));
729
- }, Be = (e, t, n, r) => {
730
- let i = {
731
- x: t.x - e.x,
732
- y: t.y - e.y
733
- }, a = {
734
- x: n.x - e.x,
735
- y: n.y - e.y
736
- }, o = {
737
- x: r.x - e.x,
738
- y: r.y - e.y
739
- }, s = ze(i, o) + ze(a, o);
740
- return Math.abs(s - ze(i, a)) < 1e-4;
741
- }, Ve = (e) => e.filter((t, n) => n === e.findIndex((e) => t.x === e.x && t.y === e.y)), He = (e) => {
742
- for (let t = 0; t < e.length; t++) e[t] = e[t].filter((n, r) => r === e[t].findIndex((e) => n.x === e.x && n.y === e.y));
743
- e = e.filter((e) => e.length > 2);
744
- for (let t = 0; t < e.length; t++) e[t] = Ie(e[t]);
745
- return e;
746
- }, Ue = (e, t, n) => {
747
- let r = [];
748
- return r.push([].concat(e)), r.push([].concat(e)), e[0].x === t.max && e[1].y === n.max || e[1].x === t.max && e[0].y === n.max ? (r[0].push({
749
- x: t.max,
750
- y: n.max
751
- }), r[1].push({
752
- x: t.min,
753
- y: n.max
754
- }, {
755
- x: t.min,
756
- y: n.min
757
- }, {
758
- x: t.max,
759
- y: n.min
760
- })) : e[0].x === t.min && e[1].y === n.max || e[1].x === t.min && e[0].y === n.max ? (r[0].push({
761
- x: t.min,
762
- y: n.max
763
- }), r[1].push({
764
- x: t.max,
765
- y: n.max
766
- }, {
767
- x: t.max,
768
- y: n.min
769
- }, {
770
- x: t.min,
771
- y: n.min
772
- })) : e[0].x === t.min && e[1].y === n.min || e[1].x === t.min && e[0].y === n.min ? (r[0].push({
773
- x: t.min,
774
- y: n.min
775
- }), r[1].push({
776
- x: t.max,
777
- y: n.min
778
- }, {
779
- x: t.max,
780
- y: n.max
781
- }, {
782
- x: t.min,
783
- y: n.max
784
- })) : e[0].x === t.max && e[1].y === n.min || e[1].x === t.max && e[0].y === n.min ? (r[0].push({
785
- x: t.max,
786
- y: n.min
787
- }), r[1].push({
788
- x: t.min,
789
- y: n.min
790
- }, {
791
- x: t.min,
792
- y: n.max
793
- }, {
794
- x: t.max,
795
- y: n.max
796
- })) : e[0].x === t.min && e[1].x === t.max || e[0].x === t.max && e[1].x === t.min ? (r[0].push({
797
- x: t.min,
798
- y: n.max
799
- }, {
800
- x: t.max,
801
- y: n.max
802
- }), r[1].push({
803
- x: t.min,
804
- y: n.min
805
- }, {
806
- x: t.max,
807
- y: n.min
808
- })) : (e[0].y === n.min && e[1].y === n.max || e[0].y === n.max && e[1].y === n.min) && (r[0].push({
809
- x: t.min,
810
- y: n.min
811
- }, {
812
- x: t.min,
813
- y: n.max
814
- }), r[1].push({
815
- x: t.max,
816
- y: n.min
817
- }, {
818
- x: t.max,
819
- y: n.max
820
- })), He(r);
821
- }, We = (e, t, n, r) => {
822
- let i = t[0], a = t[1], o = [
823
- {
824
- x: n.min,
825
- y: r.min
826
- },
827
- {
828
- x: n.min,
829
- y: r.max
830
- },
831
- {
832
- x: n.max,
833
- y: r.min
834
- },
835
- {
836
- x: n.max,
837
- y: r.max
838
- }
839
- ], s = Me(i.from.x, i.from.y, i.to.x, i.to.y, a.from.x, a.from.y, a.to.x, a.to.y), c = [], l = Fe(i, n, r);
840
- l = Ve(l);
841
- let u = Fe(a, n, r);
842
- if (u = Ve(u), s && Ne(s, n, r)) for (let e = 0; e < l.length; e++) for (let t = 0; t < u.length; t++) {
843
- let n = [], r = [];
844
- n.push(s), n.push(l[e]), n.push(u[t]);
845
- for (let i = 0; i < o.length; i++) Be(s, l[e], u[t], o[i]) ? n.push(o[i]) : r.push(o[i]);
846
- o = r, c.push(n);
847
- }
848
- else {
849
- let e = Ue(l, n, r), t = Ue(u, n, r);
850
- for (let t = 0; t < e.length; t++) Q(u[0], e[t]) && Q(u[1], e[t]) || c.push(e[t]);
851
- for (let e = 0; e < t.length; e++) Q(l[0], t[e]) && Q(l[1], t[e]) || c.push(t[e]);
852
- for (let e = 0; e < c.length; e++) o = o.filter(function(t) {
853
- return !c[e].some(function(e) {
854
- return t.x === e.x && t.y === e.y;
855
- });
856
- });
857
- let i = o.concat(l, u);
858
- c.push(i);
859
- }
860
- return He(c);
861
- }, Ge = (e, t, n, r) => (e.numberOfLines === 1 ? e.sections = Ue(Fe(t[0], n, r), n, r) : e.sections = We(e, t, n, r), e), Ke = (e, t) => {
862
- let n = t.length, r = e.x, i = e.y, a = !1, o = t[0], s;
863
- for (let e = 1; e <= n; e++) {
864
- if (s = t[e % n], i > Math.min(o.y, s.y) && i <= Math.max(o.y, s.y) && r <= Math.max(o.x, s.x)) {
865
- let e = (i - o.y) * (s.x - o.x) / (s.y - o.y) + o.x;
866
- (o.x === s.x || r <= e) && (a = !a);
867
- }
868
- o = s;
869
- }
870
- return a;
871
- }, qe = (e, t) => {
872
- if (t.length === 0) return !1;
873
- if (e.numberOfLines === 1) {
874
- if (t.length === 1) return !t[0].building;
875
- } else if (t.length !== 2) return !1;
876
- else return !t[1].building;
877
- }, Je = u("div")(({ theme: e }) => ({
878
- display: "flex",
879
- flexWrap: "wrap",
880
- marginBottom: e.spacing(2.5)
881
- })), Ye = u("div")(({ theme: e }) => ({
882
- display: "flex",
883
- flexDirection: "column",
884
- marginRight: e.spacing(3),
885
- marginBottom: e.spacing(2.5)
886
- })), Xe = u("div")({
887
- display: "flex",
888
- flexDirection: "column"
889
- }), Ze = u(b)(({ theme: e }) => ({
890
- marginTop: e.spacing(1.5),
891
- marginBottom: e.spacing(1)
892
- })), Qe = u("div")(({ theme: e }) => ({
893
- display: "flex",
894
- flexWrap: "wrap",
895
- alignItems: "center",
896
- width: "100%",
897
- marginBottom: e.spacing(2.5)
898
- })), $e = u(b)(({ theme: e }) => ({ padding: `0 ${e.spacing(1)}` })), et = u(I)({ flex: "1" }), tt = class extends z.Component {
899
- static propTypes = {
900
- availableTools: U.default.array,
901
- authoring: U.default.object,
902
- dimensionsEnabled: U.default.bool,
903
- graphDimensions: U.default.object,
904
- gridConfigurations: U.default.array,
905
- labelsPlaceholders: U.default.object,
906
- model: U.default.object.isRequired,
907
- onChange: U.default.func.isRequired,
908
- showLabels: U.default.bool,
909
- showTitle: U.default.bool,
910
- titlePlaceholder: U.default.string
911
- };
912
- constructor(e) {
913
- super(e);
914
- let { domain: t, range: n, graph: r } = e.model || {}, i = {
915
- domain: X(t, r.width, !0),
916
- range: X(n, r.height, !0)
917
- }, a = {
918
- domain: Z(t.step),
919
- range: Z(n.step)
920
- };
921
- this.state = {
922
- gridValues: i,
923
- labelValues: a,
924
- showPixelGuides: !1,
925
- dialog: { isOpened: !1 },
926
- domain: { ...t },
927
- range: { ...n }
928
- };
929
- }
930
- changeLabels = (e) => {
931
- let { model: t, onChange: n } = this.props;
932
- n({
933
- ...t,
934
- labels: e
935
- });
936
- };
937
- changeTitle = (e) => {
938
- let { model: t, onChange: n } = this.props;
939
- n({
940
- ...t,
941
- title: e
942
- });
943
- };
944
- onConfigChange = (e, n) => {
945
- let { model: i, onChange: a } = this.props, { defaultGridConfiguration: o = 0 } = i, { gridValues: s, labelValues: c, domain: l, range: u } = this.state, d = {
946
- ...i,
947
- ...e
948
- }, { answers: f, domain: p, includeAxes: m = !0, graph: h, range: g, standardGrid: _ } = d, v = {
949
- domain: [],
950
- range: []
951
- }, y = {
952
- domain: [],
953
- range: []
954
- }, b = n >= 0 ? n : o;
955
- if (m) {
956
- let e = Oe(p, h.width, s.domain, c.domain);
957
- v.domain = e.gridValues || [], y.domain = e.labelValues || [];
958
- }
959
- if (_) v.range = v.domain, y.range = y.domain, g.step = p.step, g.labelStep = p.labelStep;
960
- else if (m) {
961
- let e = Oe(g, h.height, s.range, c.range);
962
- v.range = e.gridValues || [], y.range = e.labelValues || [];
963
- }
964
- let x = t(f);
965
- x.correctAnswer.marks = f.correctAnswer.marks.filter((e) => e.type !== "polygon");
966
- let S = Ae(p, g, x);
967
- if (!r(x, S)) {
968
- this.setState({ dialog: {
969
- isOpened: !0,
970
- onClose: () => this.setState({ dialog: { isOpened: !1 } }, a({
971
- ...i,
972
- domain: l,
973
- range: u
974
- })),
975
- onConfirm: () => {
976
- d.gssLineData.sections = [], d.gssLineData.selectedTool = "lineA", this.setState({
977
- gridValues: v,
978
- labelValues: y,
979
- dialog: { isOpened: !1 },
980
- domain: { ...p },
981
- range: { ...g }
982
- }, a({
983
- ...d,
984
- answers: S,
985
- defaultGridConfiguration: b
986
- }));
987
- }
988
- } });
989
- return;
990
- }
991
- this.setState({
992
- gridValues: v,
993
- labelValues: y,
994
- domain: { ...p },
995
- range: { ...g }
996
- }), a({
997
- ...d,
998
- defaultGridConfiguration: b
999
- });
1000
- };
1001
- onChangeView = (e, t) => {
1002
- let { graphDimensions: { enabled: n } = {} } = this.props;
1003
- n && this.setState({ showPixelGuides: t });
1004
- };
1005
- changeGridConfiguration = (e) => {
1006
- let { gridConfigurations: t } = this.props, { value: n } = e.target;
1007
- this.onConfigChange(t?.[n] || {}, n);
1008
- };
1009
- render() {
1010
- let { authoring: e = {}, gridConfigurations: t = [], graphDimensions: n = {}, labelsPlaceholders: r, model: i, showLabels: a, dimensionsEnabled: o, showTitle: s, titlePlaceholder: c, mathMlOptions: l = {} } = this.props, { arrows: u, coordinatesOnHover: d, defaultGridConfiguration: f, domain: p, labels: m, range: h, standardGrid: g, title: _ } = i || {}, y = (i || {}).graph || {}, { min: x, max: S, step: C } = n || {}, { dialog: w = {}, gridValues: T, labelValues: E, showPixelGuides: D } = this.state, O = {
1011
- min: Math.max(150, x),
1012
- max: Math.min(800, S),
1013
- step: C >= 1 ? Math.min(200, C) : 20
1014
- }, k = {
1015
- axisLabel: e.axisLabel,
1016
- dimensionsEnabled: o,
1017
- includeAxesEnabled: !1,
1018
- labelStep: e.labelStep,
1019
- min: e.min,
1020
- max: e.max,
1021
- standardGridEnabled: e.standardGridEnabled,
1022
- step: e.step
1023
- }, j = e.enabled && Object.values(k).some((e) => typeof e == "object" ? e.enabled : e);
1024
- return /* @__PURE__ */ H(Je, { children: [
1025
- /* @__PURE__ */ H(Ye, { children: [t && t.length ? /* @__PURE__ */ H(Qe, { children: [/* @__PURE__ */ V($e, {
1026
- component: "div",
1027
- variant: "h6",
1028
- children: "Grid Configuration"
1029
- }), /* @__PURE__ */ V(et, {
1030
- input: /* @__PURE__ */ V(ee, { labelWidth: 10 }),
1031
- displayEmpty: !0,
1032
- onChange: this.changeGridConfiguration,
1033
- value: f,
1034
- MenuProps: { transitionDuration: {
1035
- enter: 225,
1036
- exit: 195
1037
- } },
1038
- children: (t || []).map((e, t) => /* @__PURE__ */ V(v, {
1039
- value: t,
1040
- children: e.label
1041
- }, t))
1042
- })] }) : null, j && /* @__PURE__ */ V(Ce, {
1043
- displayedFields: k,
1044
- domain: p,
1045
- gridValues: T,
1046
- includeAxes: !0,
1047
- labelValues: E,
1048
- range: h,
1049
- size: y,
1050
- sizeConstraints: O,
1051
- standardGrid: g,
1052
- onChange: this.onConfigChange,
1053
- onChangeView: this.onChangeView
1054
- })] }),
1055
- /* @__PURE__ */ H(Xe, { children: [
1056
- /* @__PURE__ */ V(b, {
1057
- component: "div",
1058
- variant: "h6",
1059
- children: "Define Graph Attributes"
1060
- }),
1061
- /* @__PURE__ */ V(Ze, {
1062
- component: "div",
1063
- variant: "body1",
1064
- children: "Use this interface to add/edit a title and/or labels"
1065
- }),
1066
- /* @__PURE__ */ V(N, {
1067
- axesSettings: { includeArrows: u },
1068
- backgroundMarks: [],
1069
- coordinatesOnHover: d,
1070
- collapsibleToolbar: !0,
1071
- collapsibleToolbarTitle: "Add Background Shapes to Graph",
1072
- domain: p,
1073
- labels: m,
1074
- labelsPlaceholders: r,
1075
- marks: [],
1076
- onChangeLabels: this.changeLabels,
1077
- onChangeTitle: this.changeTitle,
1078
- range: h,
1079
- showLabels: a,
1080
- showPixelGuides: D,
1081
- showTitle: s,
1082
- size: {
1083
- width: y.width,
1084
- height: y.height
1085
- },
1086
- title: _,
1087
- titlePlaceholder: c,
1088
- disableToolbar: !0,
1089
- mathMlOptions: l
1090
- }, "graphing-config")
1091
- ] }, "graph"),
1092
- /* @__PURE__ */ V(A, {
1093
- open: w.isOpened,
1094
- title: "Warning",
1095
- text: "This change would make it impossible for students to plot one or more graph objects in the current correct answers. If you proceed, all such graph objects will be removed from the correct answers.",
1096
- onClose: w.onClose,
1097
- onConfirm: w.onConfirm
1098
- })
1099
- ] });
1100
- }
1101
- }, nt = u(b)(({ theme: e }) => ({
1102
- marginTop: e.spacing(1.5),
1103
- marginBottom: e.spacing(1)
1104
- })), rt = u(C)({
1105
- height: "20px",
1106
- width: "fit-content",
1107
- padding: ".5rem 0"
1108
- }), it = u(F)({ color: "#000000 !important" }), at = u("div")(({ theme: e }) => ({
1109
- fontSize: e.typography.fontSize - 2,
1110
- color: e.palette.error.main,
1111
- paddingTop: e.spacing(1)
1112
- })), ot = class extends z.Component {
1113
- static propTypes = {
1114
- errors: U.default.object,
1115
- model: U.default.object.isRequired,
1116
- onChange: U.default.func.isRequired
1117
- };
1118
- state = { dialog: { open: !1 } };
1119
- handleAlertDialog = (e, t) => this.setState({ dialog: { open: e } }, t);
1120
- changeMarks = (e) => {
1121
- let { model: t, onChange: r } = this.props, { gssLineData: i } = t;
1122
- i.selectedTool === "lineA" && e.length > 0 && (e[0].fill = i.lineA.lineType), i.selectedTool === "lineB" && e.length > 1 && (e[1].fill = i.lineB.lineType), e.length === 0 && (i.selectedTool = "lineA", n(t, "gssLineData", i)), n(t, "answers.correctAnswer.marks", e), r(t);
1123
- };
1124
- onResetClick = () => {
1125
- let { model: e, onChange: t } = this.props, { gssLineData: r, answers: i } = e;
1126
- this.setState({ dialog: {
1127
- open: !0,
1128
- title: "Warning",
1129
- text: "This will remove all the elements added on the graph and reset graph to original state. Are you sure you want to continue?",
1130
- onConfirm: () => {
1131
- i.correctAnswer.marks = [], r.selectedTool = "lineA", r.lineA.lineType = "Solid", r.lineB && (r.lineB.lineType = "Solid"), n(e, "answers", i), n(e, "gssLineData", r), t(e), this.handleAlertDialog(!1);
1132
- },
1133
- onClose: () => this.handleAlertDialog(!1)
1134
- } });
1135
- };
1136
- changeNumberOfLines = (e, t) => {
1137
- let { model: n } = this.props;
1138
- n.gssLineData.selectedTool === "solutionSet" ? this.setState({ dialog: {
1139
- open: !0,
1140
- title: "Warning",
1141
- text: "Changing number of lines after adding solution set will remove added solution set. Are you sure you want to continue?",
1142
- onConfirm: () => {
1143
- this.changeLine(e, t), this.handleAlertDialog(!1);
1144
- },
1145
- onClose: () => this.handleAlertDialog(!1)
1146
- } }) : this.changeLine(e, t);
1147
- };
1148
- changeLine = (e, t) => {
1149
- let { model: r, onChange: i } = this.props, { answers: a } = r, o = r.gssLineData;
1150
- a.correctAnswer.marks = a.correctAnswer.marks.filter((e) => e.type !== "polygon"), Number.parseInt(t) === 1 ? (delete o.lineB, a.correctAnswer.marks.length > 1 && a.correctAnswer.marks.pop(), o.numberOfLines = 1, o.selectedTool = "lineA") : (o.numberOfLines = 2, a.correctAnswer.marks.length > 0 && (o.selectedTool = "lineB"), o.lineB = { lineType: "Solid" }), n(r, "answers", a), n(r, "gssLineData", o), i(r);
1151
- };
1152
- onSolutionSetSelected = (e) => {
1153
- let { model: t, onChange: r } = this.props, { answers: i, gssLineData: a } = t;
1154
- for (let t of a.sections) if (Ke(e, t)) {
1155
- let e = {
1156
- points: t,
1157
- building: !1,
1158
- type: "polygon",
1159
- closed: !0,
1160
- isSolution: !0
1161
- };
1162
- i.correctAnswer.marks = i.correctAnswer.marks.filter((e) => e.type !== "polygon"), i.correctAnswer.marks.push(e);
1163
- break;
1164
- }
1165
- n(t, "answers", i), r(t);
1166
- };
1167
- onChangeGssLineData = (e, t) => {
1168
- let { model: n } = this.props, { answers: r, domain: i, range: a } = n;
1169
- if (e.selectedTool === "solutionSet") {
1170
- let n = r.correctAnswer.marks.filter((e) => e.type !== "polygon");
1171
- if (!qe(e, n)) e.selectedTool = t, this.setState({ dialog: {
1172
- open: !0,
1173
- title: "Warning",
1174
- text: "Please define the line(s) and then select a solution set for the item.",
1175
- onConfirm: () => this.handleAlertDialog(!1)
1176
- } });
1177
- else {
1178
- let t = r.correctAnswer.marks.filter((e) => e.type !== "polygon");
1179
- e = Ge(e, t, i, a);
1180
- }
1181
- this.handleGssLineDataChange(e, r);
1182
- } else {
1183
- let n = r.correctAnswer.marks.filter((e) => e.type === "polygon");
1184
- t === "solutionSet" && n.length > 0 ? this.setState({ dialog: {
1185
- open: !0,
1186
- title: "Warning",
1187
- text: "Changing a line after adding a solution set will clear your selected solution set. Click 'Clear Solution Set' to change the line. Otherwise, click 'Cancel'.",
1188
- onConfirm: () => {
1189
- r.correctAnswer.marks = r.correctAnswer.marks.filter((e) => e.type !== "polygon"), this.handleGssLineDataChange(e, r), this.handleAlertDialog(!1);
1190
- },
1191
- onConfirmText: "CLEAR SOLUTION SET",
1192
- onClose: () => {
1193
- e.selectedTool = t, this.handleGssLineDataChange(e, r), this.handleAlertDialog(!1);
1194
- }
1195
- } }) : this.handleGssLineDataChange(e, r);
1196
- }
1197
- };
1198
- handleGssLineDataChange = (e, t) => {
1199
- let { model: r, onChange: i } = this.props;
1200
- t.correctAnswer.marks.length > 0 && t.correctAnswer.marks[0] && e.lineA && (t.correctAnswer.marks[0].fill = e.lineA.lineType), t.correctAnswer.marks.length > 1 && t.correctAnswer.marks[1] && e.lineB && (t.correctAnswer.marks[1].fill = e.lineB.lineType), (e.selectedTool === "lineB" && t.correctAnswer.marks.length === 0 || e.selectedTool === "lineB" && t.correctAnswer.marks[0].building) && (this.setState({ dialog: {
1201
- open: !0,
1202
- title: "Warning",
1203
- text: "Please add Line A to the graph before adding Line B",
1204
- onConfirm: () => this.handleAlertDialog(!1)
1205
- } }), e.selectedTool = "lineA"), e.selectedTool === "lineA" && t.correctAnswer.marks.length > 1 && t.correctAnswer.marks[1].building && (this.setState({ dialog: {
1206
- open: !0,
1207
- title: "Warning",
1208
- text: "Please add Line B to the graph before switching to Line A",
1209
- onConfirm: () => this.handleAlertDialog(!1)
1210
- } }), e.selectedTool = "lineB"), n(r, "gssLineData", e), n(r, "answers", t), i(r);
1211
- };
1212
- updateModel = (e) => {
1213
- let { model: t, onChange: n } = this.props;
1214
- n({
1215
- ...t,
1216
- ...e
1217
- });
1218
- };
1219
- render() {
1220
- let { errors: e, model: t, mathMlOptions: n = {} } = this.props, { dialog: r } = this.state, { gssLineData: i = {
1221
- numberOfLines: 1,
1222
- selectedTool: "lineA",
1223
- lineA: { lineType: "Solid" }
1224
- }, arrows: a, coordinatesOnHover: o, domain: s, graph: c = {}, labels: l, labelsEnabled: u, range: d, title: f, titleEnabled: p, answers: m } = t || {}, { correctAnswerErrors: h = "" } = e || {};
1225
- return /* @__PURE__ */ H("div", { children: [
1226
- /* @__PURE__ */ V(b, {
1227
- component: "div",
1228
- variant: "h6",
1229
- children: "Define Line Type(s) and Correct Response"
1230
- }),
1231
- /* @__PURE__ */ V(nt, {
1232
- component: "div",
1233
- variant: "body1",
1234
- children: "Use this interface to choose how many lines students will be able to draw, and to define the correct answer."
1235
- }),
1236
- /* @__PURE__ */ V(nt, {
1237
- component: "div",
1238
- variant: "body1",
1239
- children: "Choose Number of Lines"
1240
- }),
1241
- /* @__PURE__ */ H(le, {
1242
- name: "numberOfLines",
1243
- value: i.numberOfLines,
1244
- onChange: this.changeNumberOfLines,
1245
- children: [/* @__PURE__ */ V(rt, {
1246
- value: "1",
1247
- control: /* @__PURE__ */ V(it, { checked: i.numberOfLines === 1 }),
1248
- label: "One"
1249
- }), /* @__PURE__ */ V(rt, {
1250
- value: "2",
1251
- control: /* @__PURE__ */ V(it, { checked: i.numberOfLines === 2 }),
1252
- label: "Two"
1253
- })]
1254
- }),
1255
- /* @__PURE__ */ H(z.Fragment, { children: [/* @__PURE__ */ V(N, {
1256
- style: h.correctAnswer && { border: "2px solid red" },
1257
- axesSettings: { includeArrows: a },
1258
- backgroundMarks: [],
1259
- coordinatesOnHover: o,
1260
- disabledLabels: !0,
1261
- disabledTitle: !0,
1262
- domain: s,
1263
- draggableTools: !0,
1264
- labels: l,
1265
- marks: m && m.correctAnswer && m.correctAnswer.marks ? m.correctAnswer.marks : [],
1266
- onChangeMarks: (e) => this.changeMarks(e),
1267
- onCustomReset: this.onResetClick,
1268
- range: d,
1269
- showLabels: u,
1270
- showTitle: p,
1271
- size: {
1272
- width: c.width,
1273
- height: c.height
1274
- },
1275
- title: f,
1276
- gssLineData: i,
1277
- onChangeGssLineData: this.onChangeGssLineData,
1278
- onSolutionSetSelected: this.onSolutionSetSelected,
1279
- toolbarTools: ["line", "polygon"],
1280
- mathMlOptions: n
1281
- }), h.correctAnswer && /* @__PURE__ */ V(at, { children: h.correctAnswer })] }),
1282
- /* @__PURE__ */ V(A, {
1283
- open: r.open,
1284
- title: r.title,
1285
- text: r.text,
1286
- onClose: r.onClose,
1287
- onConfirm: r.onConfirm,
1288
- onConfirmText: r.onConfirmText ? r.onConfirmText : "OK"
1289
- })
1290
- ] });
1291
- }
1292
- }, { Panel: st, toggle: $, radio: ct, checkboxes: lt, textField: ut, dropdown: dt } = k;
1293
- (0, we.default)("@pie-element:graphing-solution-set:configure");
1294
- var ft = u(P)(({ theme: e }) => ({
1295
- width: "100%",
1296
- paddingTop: e.spacing(2),
1297
- marginBottom: e.spacing(2),
1298
- marginTop: e.spacing(2)
1299
- })), pt = u(b)(({ theme: e }) => ({ marginBottom: e.spacing(2.5) })), mt = class extends B.Component {
1300
- static propTypes = {
1301
- onModelChanged: U.default.func,
1302
- onConfigurationChanged: U.default.func,
1303
- imageSupport: U.default.object,
1304
- uploadSoundSupport: U.default.object,
1305
- model: U.default.object.isRequired,
1306
- configuration: U.default.object.isRequired
1307
- };
1308
- componentDidMount() {
1309
- let { configuration: e, onModelChanged: t, model: n } = this.props, { title: r, graphDimensions: i } = e || {}, { arrows: a, titleEnabled: o, dimensionsEnabled: s } = n || {};
1310
- typeof a == "boolean" && (a = a ? {
1311
- left: !0,
1312
- right: !0,
1313
- up: !0,
1314
- down: !0
1315
- } : {
1316
- left: !1,
1317
- right: !1,
1318
- up: !1,
1319
- down: !1
1320
- });
1321
- let c = o ?? r.enabled, l = s ?? i.enabled;
1322
- t && t({
1323
- ...n,
1324
- arrows: a,
1325
- titleEnabled: c,
1326
- dimensionsEnabled: l
1327
- });
1328
- }
1329
- onRationaleChange = (e) => {
1330
- let { onModelChanged: t, model: n } = this.props;
1331
- t({
1332
- ...n,
1333
- rationale: e
1334
- });
1335
- };
1336
- onPromptChange = (e) => {
1337
- let { onModelChanged: t, model: n } = this.props;
1338
- t({
1339
- ...n,
1340
- prompt: e
1341
- });
1342
- };
1343
- onTeacherInstructionsChange = (e) => {
1344
- let { onModelChanged: t, model: n } = this.props;
1345
- t({
1346
- ...n,
1347
- teacherInstructions: e
1348
- });
1349
- };
1350
- render() {
1351
- let { model: e, configuration: t, onConfigurationChanged: n, onModelChanged: r, imageSupport: i, uploadSoundSupport: a } = this.props, { arrows: o = {}, authoring: s = {}, coordinatesOnHover: c = {}, contentDimensions: l = {}, gridConfigurations: u = [], graphDimensions: d = {}, instruction: f = {}, labels: p = {}, padding: m = {}, prompt: h = {}, rationale: g = {}, scoringType: _ = {}, settingsPanelDisabled: v, spellCheck: y = {}, studentInstructions: b = {}, teacherInstructions: x = {}, title: S = {}, maxImageWidth: C = {}, maxImageHeight: T = {}, withRubric: D = {}, language: O = {}, languageChoices: k = {}, mathMlOptions: A = {} } = t || {}, { errors: j = {}, extraCSSRules: M, labelsEnabled: N, dimensionsEnabled: P, promptEnabled: F, rationaleEnabled: I, spellCheckEnabled: L, teacherInstructionsEnabled: ee, titleEnabled: R } = e || {}, z = C && C.prompt, B = T && T.prompt, te = {
1352
- top: p.top,
1353
- right: p.right,
1354
- bottom: p.bottom,
1355
- left: p.left
1356
- }, ne = {
1357
- arrows: o.settings && lt(o.label, {
1358
- left: o.left,
1359
- right: o.right,
1360
- up: o.up,
1361
- down: o.down
1362
- }),
1363
- titleEnabled: S.settings && $(S.label),
1364
- padding: m.settings && $(m.label),
1365
- labelsEnabled: p.settings && $(p.label),
1366
- "language.enabled": O.settings && $(O.label, !0),
1367
- language: O.settings && O.enabled && dt(k.label, k.options),
1368
- dimensionsEnabled: d.settings && $(d.label),
1369
- coordinatesOnHover: c.settings && $(c.label)
1370
- }, re = {
1371
- "authoring.enabled": s.settings && $(s.label, !0),
1372
- teacherInstructionsEnabled: x.settings && $(x.label),
1373
- studentInstructionsEnabled: b.settings && $(b.label),
1374
- promptEnabled: h.settings && $(h.label),
1375
- rationaleEnabled: g.settings && $(g.label),
1376
- spellCheckEnabled: y.settings && $(y.label),
1377
- scoringType: _.settings && ct(_.label, ["dichotomous", "partial scoring"]),
1378
- rubricEnabled: D?.settings && $(D?.label),
1379
- instruction: f.settings && ut(f.label)
1380
- };
1381
- return /* @__PURE__ */ H(E.ConfigLayout, {
1382
- extraCSSRules: M,
1383
- dimensions: l,
1384
- hideSettings: v,
1385
- settings: /* @__PURE__ */ V(st, {
1386
- model: e,
1387
- configuration: t,
1388
- onChangeModel: r,
1389
- onChangeConfiguration: n,
1390
- groups: {
1391
- Settings: ne,
1392
- Properties: re
1393
- }
1394
- }),
1395
- children: [
1396
- /* @__PURE__ */ V(pt, {
1397
- component: "div",
1398
- variant: "body1",
1399
- children: f?.label || ""
1400
- }),
1401
- ee && /* @__PURE__ */ V(ft, {
1402
- label: x.label,
1403
- children: /* @__PURE__ */ V(w, {
1404
- markup: e.teacherInstructions || "",
1405
- onChange: this.onTeacherInstructionsChange,
1406
- imageSupport: i,
1407
- nonEmpty: !1,
1408
- spellCheck: L,
1409
- maxImageWidth: C && C.teacherInstructions || z,
1410
- maxImageHeight: T && T.teacherInstructions || B,
1411
- uploadSoundSupport: a,
1412
- languageCharactersProps: [{ language: "spanish" }, { language: "special" }],
1413
- mathMlOptions: A
1414
- })
1415
- }),
1416
- F && /* @__PURE__ */ V(ft, {
1417
- label: h.label,
1418
- children: /* @__PURE__ */ V(w, {
1419
- markup: e.prompt,
1420
- onChange: this.onPromptChange,
1421
- imageSupport: i,
1422
- nonEmpty: !1,
1423
- spellCheck: L,
1424
- disableUnderline: !0,
1425
- maxImageWidth: z,
1426
- maxImageHeight: B,
1427
- uploadSoundSupport: a,
1428
- languageCharactersProps: [{ language: "spanish" }, { language: "special" }],
1429
- mathMlOptions: A
1430
- })
1431
- }),
1432
- /* @__PURE__ */ V(tt, {
1433
- authoring: s,
1434
- gridConfigurations: u,
1435
- graphDimensions: d,
1436
- labelsPlaceholders: te,
1437
- model: e,
1438
- showLabels: N,
1439
- dimensionsEnabled: P,
1440
- showTitle: R,
1441
- titlePlaceholder: S.placeholder,
1442
- onChange: this.props.onModelChanged,
1443
- mathMlOptions: A
1444
- }),
1445
- /* @__PURE__ */ V(ot, {
1446
- errors: j,
1447
- model: e,
1448
- onChange: this.props.onModelChanged,
1449
- mathMlOptions: A
1450
- }),
1451
- I && /* @__PURE__ */ V(ft, {
1452
- label: g.label || "Rationale",
1453
- children: /* @__PURE__ */ V(w, {
1454
- markup: e.rationale || "",
1455
- onChange: this.onRationaleChange,
1456
- imageSupport: i,
1457
- spellCheck: L,
1458
- maxImageWidth: C && C.rationale || z,
1459
- maxImageHeight: T && T.rationale || B,
1460
- uploadSoundSupport: a,
1461
- languageCharactersProps: [{ language: "spanish" }, { language: "special" }],
1462
- mathMlOptions: A
1463
- })
1464
- })
1465
- ]
1466
- });
1467
- }
1468
- }, ht = class e extends CustomEvent {
1469
- static {
1470
- this.TYPE = "model.updated";
1471
- }
1472
- constructor(t, n = !1) {
1473
- super(e.TYPE, {
1474
- bubbles: !0,
1475
- detail: {
1476
- update: t,
1477
- reset: n
1478
- }
1479
- }), this.update = t, this.reset = n;
1480
- }
1481
- }, gt = class e extends CustomEvent {
1482
- static {
1483
- this.TYPE = "delete.image";
1484
- }
1485
- constructor(t, n) {
1486
- super(e.TYPE, {
1487
- bubbles: !0,
1488
- detail: {
1489
- src: t,
1490
- done: n
1491
- }
1492
- }), this.src = t, this.done = n;
1493
- }
1494
- }, _t = class e extends CustomEvent {
1495
- static {
1496
- this.TYPE = "insert.image";
1497
- }
1498
- constructor(t) {
1499
- super(e.TYPE, {
1500
- bubbles: !0,
1501
- detail: t
1502
- }), this.handler = t;
1503
- }
1504
- }, vt = class e extends CustomEvent {
1505
- static {
1506
- this.TYPE = "delete.sound";
1507
- }
1508
- constructor(t, n) {
1509
- super(e.TYPE, {
1510
- bubbles: !0,
1511
- detail: {
1512
- src: t,
1513
- done: n
1514
- }
1515
- }), this.src = t, this.done = n;
1516
- }
1517
- }, yt = class e extends CustomEvent {
1518
- static {
1519
- this.TYPE = "insert.sound";
1520
- }
1521
- constructor(t) {
1522
- super(e.TYPE, {
1523
- bubbles: !0,
1524
- detail: t
1525
- }), this.handler = t;
1526
- }
1527
- }, bt = {
1528
- model: {
1529
- answers: { correctAnswer: {
1530
- name: "Correct Answer",
1531
- marks: []
1532
- } },
1533
- arrows: {
1534
- left: !0,
1535
- right: !0,
1536
- up: !0,
1537
- down: !0
1538
- },
1539
- marks: [],
1540
- defaultGridConfiguration: 0,
1541
- domain: {
1542
- min: -5,
1543
- max: 5,
1544
- step: 1,
1545
- labelStep: 1,
1546
- axisLabel: "x"
1547
- },
1548
- graph: {
1549
- width: 500,
1550
- height: 500
1551
- },
1552
- gssLineData: {
1553
- numberOfLines: 1,
1554
- selectedTool: "lineA",
1555
- sections: [],
1556
- lineA: { lineType: "Solid" }
1557
- },
1558
- includeAxes: !0,
1559
- labels: {},
1560
- labelsEnabled: !0,
1561
- padding: !0,
1562
- prompt: "",
1563
- range: {
1564
- min: -5,
1565
- max: 5,
1566
- step: 1,
1567
- labelStep: 1,
1568
- axisLabel: "y"
1569
- },
1570
- rationale: "",
1571
- standardGrid: !1,
1572
- title: "",
1573
- coordinatesOnHover: !1,
1574
- promptEnabled: !0,
1575
- rationaleEnabled: !0,
1576
- teacherInstructionsEnabled: !0,
1577
- studentInstructionsEnabled: !0
1578
- },
1579
- configuration: {
1580
- authoring: {
1581
- settings: !1,
1582
- label: "Customize Grid Setup",
1583
- enabled: !0,
1584
- includeAxesEnabled: !1,
1585
- standardGridEnabled: !0,
1586
- min: {
1587
- label: "Min Value",
1588
- enabled: !0
1589
- },
1590
- max: {
1591
- label: "Max Value",
1592
- enabled: !0
1593
- },
1594
- axisLabel: {
1595
- label: "Label",
1596
- enabled: !0
1597
- },
1598
- step: {
1599
- label: "Grid Interval",
1600
- enabled: !0
1601
- },
1602
- labelStep: {
1603
- label: "Label Interval",
1604
- enabled: !0
1605
- }
1606
- },
1607
- arrows: {
1608
- settings: !0,
1609
- label: "Include Arrows",
1610
- left: { label: "left" },
1611
- right: { label: "right" },
1612
- up: { label: "up" },
1613
- down: { label: "down" }
1614
- },
1615
- gridConfigurations: [
1616
- {
1617
- label: "4-quadrant coordinate grid, -10 to 10",
1618
- arrows: {
1619
- left: !0,
1620
- right: !0,
1621
- up: !0,
1622
- down: !0
1623
- },
1624
- domain: {
1625
- min: -10,
1626
- max: 10,
1627
- step: 1,
1628
- padding: 0,
1629
- labelStep: 1,
1630
- axisLabel: "<i>x</i>"
1631
- },
1632
- graph: {
1633
- width: 480,
1634
- height: 480
1635
- },
1636
- includeAxes: !0,
1637
- labels: {
1638
- top: "",
1639
- right: "",
1640
- bottom: "",
1641
- left: ""
1642
- },
1643
- padding: !0,
1644
- range: {
1645
- min: -10,
1646
- max: 10,
1647
- step: 1,
1648
- padding: 0,
1649
- labelStep: 1,
1650
- axisLabel: "<i>y</i>"
1651
- },
1652
- standardGrid: !0,
1653
- title: ""
1654
- },
1655
- {
1656
- label: "0 to 10 on both axes",
1657
- arrows: {
1658
- left: !1,
1659
- right: !0,
1660
- up: !0,
1661
- down: !1
1662
- },
1663
- domain: {
1664
- min: 0,
1665
- max: 10,
1666
- step: 1,
1667
- padding: 0,
1668
- labelStep: 1,
1669
- axisLabel: "<i>x</i>"
1670
- },
1671
- graph: {
1672
- width: 480,
1673
- height: 480
1674
- },
1675
- includeAxes: !0,
1676
- labels: {
1677
- top: "",
1678
- right: "",
1679
- bottom: "",
1680
- left: ""
1681
- },
1682
- padding: !0,
1683
- range: {
1684
- min: 0,
1685
- max: 10,
1686
- step: 1,
1687
- padding: 0,
1688
- labelStep: 1,
1689
- axisLabel: "<i>y</i>"
1690
- },
1691
- standardGrid: !0,
1692
- title: ""
1693
- },
1694
- {
1695
- label: "0 to 20 on both axes",
1696
- arrows: {
1697
- left: !1,
1698
- right: !0,
1699
- up: !0,
1700
- down: !1
1701
- },
1702
- domain: {
1703
- min: 0,
1704
- max: 20,
1705
- step: 1,
1706
- padding: 0,
1707
- labelStep: 1,
1708
- axisLabel: "<i>x</i>"
1709
- },
1710
- graph: {
1711
- width: 480,
1712
- height: 480
1713
- },
1714
- includeAxes: !0,
1715
- labels: {
1716
- top: "",
1717
- right: "",
1718
- bottom: "",
1719
- left: ""
1720
- },
1721
- padding: !0,
1722
- range: {
1723
- min: 0,
1724
- max: 20,
1725
- step: 1,
1726
- padding: 0,
1727
- labelStep: 1,
1728
- axisLabel: "<i>y</i>"
1729
- },
1730
- standardGrid: !0,
1731
- title: ""
1732
- },
1733
- {
1734
- label: "Sample Data Graph",
1735
- arrows: {
1736
- left: !1,
1737
- right: !0,
1738
- up: !0,
1739
- down: !1
1740
- },
1741
- domain: {
1742
- min: 0,
1743
- max: 30,
1744
- step: 1,
1745
- padding: 0,
1746
- labelStep: 2,
1747
- axisLabel: "<i>t</i>"
1748
- },
1749
- graph: {
1750
- width: 480,
1751
- height: 480
1752
- },
1753
- includeAxes: !0,
1754
- labels: {
1755
- top: "",
1756
- right: "",
1757
- bottom: "Time (seconds)",
1758
- left: "Distance (meters)"
1759
- },
1760
- padding: !0,
1761
- range: {
1762
- min: 0,
1763
- max: 80,
1764
- step: 5,
1765
- padding: 0,
1766
- labelStep: 10,
1767
- axisLabel: "<i>d</i>"
1768
- },
1769
- standardGrid: !1,
1770
- title: "Distance as a function of time"
1771
- }
1772
- ],
1773
- graphDimensions: {
1774
- settings: !1,
1775
- label: "Graph Dimensions",
1776
- enabled: !0,
1777
- min: 150,
1778
- max: 800,
1779
- step: 20
1780
- },
1781
- padding: {
1782
- settings: !1,
1783
- label: "Padding"
1784
- },
1785
- labels: {
1786
- settings: !0,
1787
- label: "Graph Labels",
1788
- enabled: !0,
1789
- top: "Click here to add a top label",
1790
- right: "Click here to add a right label",
1791
- bottom: "Click here to add a bottom label",
1792
- left: "Click here to add a left label"
1793
- },
1794
- prompt: {
1795
- settings: !0,
1796
- label: "Item Stem"
1797
- },
1798
- rationale: {
1799
- settings: !0,
1800
- label: "Rationale"
1801
- },
1802
- scoringType: {
1803
- settings: !1,
1804
- label: "Scoring Type"
1805
- },
1806
- studentInstructions: {
1807
- settings: !1,
1808
- label: "Student Instructions"
1809
- },
1810
- teacherInstructions: {
1811
- settings: !0,
1812
- label: "Teacher Instructions"
1813
- },
1814
- title: {
1815
- settings: !0,
1816
- label: "Graph Title",
1817
- enabled: !0,
1818
- placeholder: "Click here to add a title for this graph"
1819
- },
1820
- instruction: {
1821
- settings: !1,
1822
- label: "Graphing Solution Set items involve plotting one or two lines on a graph and then selecting the correct area that represents the solution set. To create one, first configure the grid, then select if one or two lines will be offered and if the lines should be solid or dashed. After defining the line(s), define the correct answer by clicking the area that represents the solution set."
1823
- },
1824
- settingsPanelDisabled: !1,
1825
- spellCheck: {
1826
- label: "Spellcheck",
1827
- settings: !1,
1828
- enabled: !0
1829
- },
1830
- coordinatesOnHover: {
1831
- settings: !0,
1832
- label: "Coordinates on Hover"
1833
- },
1834
- maxImageWidth: {
1835
- teacherInstructions: 300,
1836
- prompt: 300,
1837
- rationale: 300
1838
- },
1839
- maxImageHeight: {
1840
- teacherInstructions: 300,
1841
- prompt: 300,
1842
- rationale: 300
1843
- },
1844
- withRubric: {
1845
- settings: !1,
1846
- label: "Add Rubric"
1847
- },
1848
- language: {
1849
- settings: !1,
1850
- label: "Specify Language",
1851
- enabled: !1
1852
- },
1853
- languageChoices: {
1854
- label: "Language Choices",
1855
- options: []
1856
- },
1857
- mathMlOptions: {
1858
- mmlOutput: !1,
1859
- mmlEditing: !1
1860
- }
1861
- }
1862
- }, xt = (0, we.default)("pie-elements:graphing-solution-set:configure"), St = (e) => Object.keys(e || {}).sort().reduce((t, n) => (n !== "correctAnswer" && (t[n] = e[n]), t), {}), Ct = class e extends HTMLElement {
1863
- static createDefaultModel = (e = {}) => {
1864
- let t = {
1865
- ...bt.model,
1866
- ...e
1867
- }, { answers: n = {}, domain: r = {}, graph: i = {}, range: a = {}, standardGrid: o } = t;
1868
- return {
1869
- ...t,
1870
- answers: n && n.correctAnswer && {
1871
- correctAnswer: n.correctAnswer,
1872
- ...St(n)
1873
- } || n,
1874
- range: o && {
1875
- ...a,
1876
- min: r.min,
1877
- max: r.max,
1878
- step: r.step,
1879
- labelStep: r.labelStep
1880
- } || a,
1881
- graph: o && {
1882
- ...i,
1883
- height: i.width
1884
- } || i
1885
- };
1886
- };
1887
- constructor() {
1888
- super(), this._root = null, this._model = e.createDefaultModel(), this._configuration = bt.configuration;
1889
- }
1890
- set model(t) {
1891
- this._model = e.createDefaultModel(t), this._render();
1892
- }
1893
- set configuration(e) {
1894
- this._configuration = e, e.language?.enabled ? e.languageChoices?.options?.length && (this._model.language = e.languageChoices.options[0].value) : e.language.settings ? this._model.language && (this._configuration.language.enabled = !0) : delete this._model.language, this._render();
1895
- }
1896
- onModelChanged = (e) => {
1897
- this._model = e, this._render(), xt("[onModelChanged]: ", this._model), this.dispatchEvent(new ht(this._model));
1898
- };
1899
- onConfigurationChanged = (e) => {
1900
- this._configuration = e, this._render();
1901
- };
1902
- insertImage = (e) => {
1903
- this.dispatchEvent(new _t(e));
1904
- };
1905
- onDeleteImage = (e, t) => {
1906
- this.dispatchEvent(new gt(e, t));
1907
- };
1908
- insertSound(e) {
1909
- this.dispatchEvent(new yt(e));
1910
- }
1911
- onDeleteSound(e, t) {
1912
- this.dispatchEvent(new vt(e, t));
1913
- }
1914
- _render() {
1915
- if (this._model) {
1916
- let e = B.createElement(mt, {
1917
- onModelChanged: this.onModelChanged,
1918
- onConfigurationChanged: this.onConfigurationChanged,
1919
- model: this._model,
1920
- configuration: this._configuration,
1921
- imageSupport: {
1922
- add: this.insertImage,
1923
- delete: this.onDeleteImage
1924
- },
1925
- uploadSoundSupport: {
1926
- add: this.insertSound.bind(this),
1927
- delete: this.onDeleteSound.bind(this)
1928
- }
1929
- });
1930
- this._root ||= te(this), this._root.render(e), queueMicrotask(() => {
1931
- g(this);
1932
- });
1933
- }
1934
- }
1935
- disconnectedCallback() {
1936
- this._root && this._root.unmount();
1937
- }
1938
- };
1939
- //#endregion
1940
- export { Ct as default };
1941
-
1942
- //# sourceMappingURL=index.js.map