@pie-element/charting 12.1.2-next.1 → 12.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 (79) hide show
  1. package/CHANGELOG.json +487 -0
  2. package/CHANGELOG.md +2001 -0
  3. package/LICENSE.md +5 -0
  4. package/README.md +1 -0
  5. package/configure/CHANGELOG.json +292 -0
  6. package/configure/CHANGELOG.md +1768 -0
  7. package/configure/lib/charting-config.js +192 -0
  8. package/configure/lib/charting-config.js.map +1 -0
  9. package/configure/lib/configure.js +312 -0
  10. package/configure/lib/configure.js.map +1 -0
  11. package/configure/lib/correct-response.js +244 -0
  12. package/configure/lib/correct-response.js.map +1 -0
  13. package/configure/lib/defaults.js +233 -0
  14. package/configure/lib/defaults.js.map +1 -0
  15. package/configure/lib/index.js +120 -0
  16. package/configure/lib/index.js.map +1 -0
  17. package/configure/lib/utils.js +80 -0
  18. package/configure/lib/utils.js.map +1 -0
  19. package/configure/package.json +29 -0
  20. package/controller/CHANGELOG.json +262 -0
  21. package/controller/CHANGELOG.md +1212 -0
  22. package/controller/lib/defaults.js +42 -0
  23. package/controller/lib/defaults.js.map +1 -0
  24. package/controller/lib/index.js +434 -0
  25. package/controller/lib/index.js.map +1 -0
  26. package/controller/package.json +24 -0
  27. package/docs/config-schema.json +2440 -0
  28. package/docs/config-schema.json.md +1802 -0
  29. package/docs/demo/config.js +8 -0
  30. package/docs/demo/generate.js +63 -0
  31. package/docs/demo/index.html +1 -0
  32. package/docs/demo/session.js +26 -0
  33. package/docs/pie-schema.json +1731 -0
  34. package/docs/pie-schema.json.md +945 -0
  35. package/lib/index.js +78 -0
  36. package/lib/index.js.map +1 -0
  37. package/lib/main.js +167 -0
  38. package/lib/main.js.map +1 -0
  39. package/package.json +21 -86
  40. package/configure.js +0 -2
  41. package/controller.js +0 -1
  42. package/dist/author/charting-config.d.ts +0 -30
  43. package/dist/author/charting-config.js +0 -126
  44. package/dist/author/configure.d.ts +0 -29
  45. package/dist/author/configure.js +0 -205
  46. package/dist/author/correct-response.d.ts +0 -27
  47. package/dist/author/correct-response.js +0 -115
  48. package/dist/author/defaults.d.ts +0 -229
  49. package/dist/author/defaults.js +0 -186
  50. package/dist/author/index.d.ts +0 -51
  51. package/dist/author/index.js +0 -74
  52. package/dist/author/utils.d.ts +0 -42
  53. package/dist/author/utils.js +0 -244
  54. package/dist/browser/author/index.js +0 -1242
  55. package/dist/browser/author/index.js.map +0 -1
  56. package/dist/browser/chart-AvFvbpGV.js +0 -58913
  57. package/dist/browser/chart-AvFvbpGV.js.map +0 -1
  58. package/dist/browser/charting.css +0 -2
  59. package/dist/browser/controller/index.js +0 -194
  60. package/dist/browser/controller/index.js.map +0 -1
  61. package/dist/browser/delivery/index.js +0 -517
  62. package/dist/browser/delivery/index.js.map +0 -1
  63. package/dist/browser/dist-CA-Ok7CW.js +0 -330
  64. package/dist/browser/dist-CA-Ok7CW.js.map +0 -1
  65. package/dist/charting.css +0 -2
  66. package/dist/controller/defaults.d.ts +0 -44
  67. package/dist/controller/defaults.js +0 -33
  68. package/dist/controller/index.d.ts +0 -28
  69. package/dist/controller/index.js +0 -153
  70. package/dist/delivery/index.d.ts +0 -21
  71. package/dist/delivery/index.js +0 -46
  72. package/dist/delivery/main.d.ts +0 -23
  73. package/dist/delivery/main.js +0 -128
  74. package/dist/index.d.ts +0 -1
  75. package/dist/index.iife.d.ts +0 -8
  76. package/dist/index.iife.js +0 -395
  77. package/dist/index.js +0 -2
  78. package/dist/runtime-support.d.ts +0 -12
  79. package/dist/runtime-support.js +0 -12
@@ -1,1242 +0,0 @@
1
- import { S as e, f as t, t as n, v as r } from "../dist-CA-Ok7CW.js";
2
- import { D as i, O as a, S as o, T as s, a as c, c as l, d as u, f as d, i as f, k as p, l as m, m as h, o as g, p as _, r as v, s as y, t as b, x } from "../chart-AvFvbpGV.js";
3
- import * as S from "react";
4
- import C, { useEffect as ee, useState as w } from "react";
5
- import { createRoot as T } from "react-dom/client";
6
- import { jsx as E, jsxs as D } from "react/jsx-runtime";
7
- //#region ../../lib-react/charting/dist/chart-type.js
8
- var O = /* @__PURE__ */ e(p(), 1), k = a("div")(() => ({ width: "160px" })), A = a(x)(() => ({ width: "160px" })), j = a(o)(() => ({ backgroundColor: "transparent" })), M = ({ onChange: e, value: t, availableChartTypes: n, chartTypeLabel: r }) => /* @__PURE__ */ E(k, { children: /* @__PURE__ */ D(A, {
9
- variant: "outlined",
10
- children: [/* @__PURE__ */ E(j, {
11
- id: "type-helper-label",
12
- children: r
13
- }), /* @__PURE__ */ D(_, {
14
- labelId: "type-helper-label",
15
- id: "type-helper-label-select",
16
- name: "chartType",
17
- value: t,
18
- onChange: e,
19
- label: r,
20
- MenuProps: { transitionDuration: {
21
- enter: 225,
22
- exit: 195
23
- } },
24
- children: [
25
- n?.histogram && /* @__PURE__ */ E(d, {
26
- value: "histogram",
27
- children: n.histogram
28
- }),
29
- n?.bar && /* @__PURE__ */ E(d, {
30
- value: "bar",
31
- children: n.bar
32
- }),
33
- n?.lineDot && /* @__PURE__ */ E(d, {
34
- value: "lineDot",
35
- children: n.lineDot
36
- }),
37
- n?.lineCross && /* @__PURE__ */ E(d, {
38
- value: "lineCross",
39
- children: n.lineCross
40
- }),
41
- n?.dotPlot && /* @__PURE__ */ E(d, {
42
- value: "dotPlot",
43
- children: n.dotPlot
44
- }),
45
- n?.linePlot && /* @__PURE__ */ E(d, {
46
- value: "linePlot",
47
- children: n.linePlot
48
- })
49
- ]
50
- })]
51
- }) });
52
- M.propTypes = {
53
- onChange: O.default.func.isRequired,
54
- value: O.default.string.isRequired,
55
- availableChartTypes: O.default.shape({
56
- histogram: O.default.string,
57
- bar: O.default.string,
58
- lineDot: O.default.string,
59
- lineCross: O.default.string,
60
- dotPlot: O.default.string,
61
- linePlot: O.default.string
62
- }),
63
- chartTypeLabel: O.default.string
64
- };
65
- //#endregion
66
- //#region ../../lib-react/charting/dist/chart-setup.js
67
- var N = (e, t, n, r, i) => {
68
- (e || []).forEach((e) => {
69
- let t = Math.round(e.value * 10) % Math.round(n.step * 10) / 10;
70
- (e.value > n.max || t !== 0) && (e.value = 0);
71
- }), t && r({
72
- ...i,
73
- data: e
74
- });
75
- }, te = a("div")(() => ({ width: "450px" })), ne = a("div")(({ theme: e }) => ({
76
- display: "flex",
77
- flexDirection: "column",
78
- width: "100%",
79
- marginTop: e.spacing(3)
80
- })), P = a("div")(() => ({
81
- display: "flex",
82
- flexDirection: "column",
83
- alignItems: "center"
84
- })), re = a("div")(() => ({
85
- display: "flex",
86
- justifyContent: "space-around",
87
- alignItems: "center"
88
- })), F = a(g)(({ theme: e }) => ({
89
- width: "130px",
90
- margin: `${e.spacing(1)} ${e.spacing(.5)}`
91
- })), I = a(g)(({ theme: e }) => ({
92
- width: "160px",
93
- margin: `${e.spacing(1)} ${e.spacing(.5)}`
94
- })), L = a("div")(({ theme: e }) => ({
95
- display: "flex",
96
- justifyContent: "space-between",
97
- alignItems: "center",
98
- margin: `${e.spacing(3)} 0`
99
- })), ie = a(h)(() => ({ color: i.disabled() })), R = (e) => {
100
- let { model: t, onChange: n, chartDimensions: r, gridValues: i = {}, labelValues: a = {}, studentNewCategoryDefaultLabel: o = {}, availableChartTypes: s = {}, chartTypeLabel: c } = e, [l, u] = w({
101
- open: !1,
102
- title: "",
103
- text: "",
104
- onClose: null,
105
- onConfirm: null
106
- }), [d, f] = w(!1), [p, m] = w(""), [g, _] = w(0), { range: v = {}, correctAnswer: b, changeInteractiveEnabled: x, changeEditableEnabled: S } = t, C = t.graph, { showInConfigPanel: T, width: O, height: k } = r || {}, A = {
107
- min: O?.min ? Math.max(50, O.min) : 50,
108
- max: O?.max ? Math.min(700, O.max) : 700,
109
- step: O?.step >= 1 ? Math.min(200, O.step) : 20
110
- }, j = {
111
- min: k?.min ? Math.max(400, k.min) : 400,
112
- max: k?.max ? Math.min(700, k.max) : 700,
113
- step: k?.step >= 1 ? Math.min(200, k.step) : 20
114
- }, R = i && i.range ? { customValues: i.range } : {
115
- min: 0,
116
- max: 1e4
117
- }, z = a && a.range ? { customValues: a.range } : {
118
- min: 0,
119
- max: 1e4
120
- }, B = /* @__PURE__ */ D(re, { children: [/* @__PURE__ */ E(I, {
121
- label: "Grid Interval",
122
- value: v.step,
123
- variant: "outlined",
124
- onChange: (e, t) => J("step", t, e),
125
- ...R
126
- }), /* @__PURE__ */ E(I, {
127
- label: "Label Interval",
128
- value: v.labelStep,
129
- variant: "outlined",
130
- onChange: (e, t) => J("labelStep", t, e),
131
- ...z
132
- })] }), V = (e) => {
133
- u((t) => ({
134
- ...t,
135
- open: e
136
- })), f(e);
137
- }, H = (e, t) => e.map((e) => (Object.prototype.hasOwnProperty.call(e, t) && (e[t] = t == "interactive"), e)), U = (e) => {
138
- let { correctAnswer: r, data: i } = t;
139
- x === !1 && H(i, "interactive"), S === !1 && H(i, "editable"), N(i, e, v, n, t), N(r.data, !1, v, n, t);
140
- }, W = () => {
141
- let e = o?.label;
142
- n({
143
- ...t,
144
- studentCategoryDefaultLabel: e
145
- });
146
- }, G = (e) => e.includes("Plot") ? {
147
- min: 3,
148
- max: 10
149
- } : {
150
- min: .05,
151
- max: 1e4
152
- }, K = (e, r) => {
153
- let i = {
154
- ...C,
155
- [e]: r
156
- };
157
- n({
158
- ...t,
159
- graph: i
160
- });
161
- }, q = (e, t) => (e || []).find((e) => e.value > t.max || e.value - t.step * Math.floor(e.value / t.step) !== 0), J = (e, r, i) => {
162
- _(v[e]), m(e), v[e] = r, (e === "max" || e === "step") && (q(t.data, v) || q(t.correctAnswer.data, v)) && i?.target ? f(!0) : n({
163
- ...t,
164
- range: v
165
- });
166
- };
167
- ee(() => {
168
- U(!0), W();
169
- }, []), ee(() => {
170
- d && u({
171
- open: !0,
172
- title: "Warning",
173
- text: "This change will remove values defined for one or more categories",
174
- onConfirm: () => {
175
- U(), V(!1), n({
176
- ...t,
177
- range: v,
178
- correctAnswer: b
179
- });
180
- },
181
- onClose: () => {
182
- v[p] = g, V(!1);
183
- }
184
- });
185
- }, [d]);
186
- let Y = v.step === 1 && v.labelStep === 1 && 3 <= v.max && v.max <= 10, ae = () => {
187
- G.min = 3, G.max = 10, v.max = 10, v.step = 1, v.labelStep = 1, n({
188
- ...t,
189
- range: v
190
- });
191
- }, X = (e) => {
192
- if (e.includes("Plot")) {
193
- if (!Y) {
194
- u({
195
- open: !0,
196
- title: "Warning",
197
- text: "The selected chart type does not support the current chart configuration. Reset chart configuration?",
198
- onConfirm: () => {
199
- ae(), U(), V(!1), n({
200
- ...t,
201
- range: v,
202
- chartType: e
203
- });
204
- },
205
- onClose: () => {
206
- V(!1);
207
- }
208
- });
209
- return;
210
- }
211
- G.min = 3, G.max = 10, n({
212
- ...t,
213
- chartType: e
214
- });
215
- return;
216
- }
217
- n({
218
- ...t,
219
- chartType: e
220
- });
221
- };
222
- return /* @__PURE__ */ D(te, { children: [
223
- /* @__PURE__ */ E(h, {
224
- variant: "subtitle1",
225
- children: "Configure Chart"
226
- }),
227
- /* @__PURE__ */ D(ne, { children: [
228
- /* @__PURE__ */ D(re, { children: [/* @__PURE__ */ E(M, {
229
- value: t.chartType,
230
- onChange: (e) => X(e.target.value),
231
- availableChartTypes: s,
232
- chartTypeLabel: c
233
- }), /* @__PURE__ */ E(I, {
234
- label: "Max Value",
235
- value: v.max,
236
- min: G(t.chartType).min,
237
- max: G(t.chartType).max,
238
- variant: "outlined",
239
- onChange: (e, t) => J("max", t, e)
240
- })] }),
241
- !t.chartType.includes("Plot") && B,
242
- T && /* @__PURE__ */ D(L, { children: [
243
- /* @__PURE__ */ E("div", { children: /* @__PURE__ */ E(h, { children: "Dimensions(px)" }) }),
244
- /* @__PURE__ */ D(P, { children: [/* @__PURE__ */ E(F, {
245
- label: "Width",
246
- value: C.width,
247
- min: A.min,
248
- max: A.max,
249
- step: A.step,
250
- variant: "outlined",
251
- onChange: (e, t) => K("width", t)
252
- }), /* @__PURE__ */ E(ie, { children: "Min 50, Max 700" })] }),
253
- /* @__PURE__ */ D(P, { children: [/* @__PURE__ */ E(F, {
254
- label: "Height",
255
- value: C.height,
256
- min: j.min,
257
- max: j.max,
258
- step: j.step,
259
- variant: "outlined",
260
- onChange: (e, t) => K("height", t)
261
- }), /* @__PURE__ */ E(ie, { children: "Min 400, Max 700" })] })
262
- ] })
263
- ] }),
264
- /* @__PURE__ */ E(y, {
265
- open: l.open,
266
- title: l.title,
267
- text: l.text,
268
- onClose: l.onClose,
269
- onConfirm: l.onConfirm
270
- })
271
- ] });
272
- };
273
- R.propTypes = {
274
- chartDimensions: O.default.object,
275
- domain: O.default.object,
276
- gridValues: O.default.object,
277
- labelValues: O.default.object,
278
- model: O.default.object,
279
- onChange: O.default.func,
280
- range: O.default.object,
281
- chartDimension: O.default.object,
282
- size: O.default.object,
283
- studentNewCategoryDefaultLabel: O.default.object,
284
- availableChartTypes: O.default.object,
285
- chartTypeLabel: O.default.string
286
- };
287
- //#endregion
288
- //#region ../../shared/configure-events/dist/index.js
289
- var z = class e extends CustomEvent {
290
- static {
291
- this.TYPE = "model.updated";
292
- }
293
- constructor(t, n = !1) {
294
- super(e.TYPE, {
295
- bubbles: !0,
296
- detail: {
297
- update: t,
298
- reset: n
299
- }
300
- }), this.update = t, this.reset = n;
301
- }
302
- }, B = class e extends CustomEvent {
303
- static {
304
- this.TYPE = "delete.image";
305
- }
306
- constructor(t, n) {
307
- super(e.TYPE, {
308
- bubbles: !0,
309
- detail: {
310
- src: t,
311
- done: n
312
- }
313
- }), this.src = t, this.done = n;
314
- }
315
- }, V = class e extends CustomEvent {
316
- static {
317
- this.TYPE = "insert.image";
318
- }
319
- constructor(t) {
320
- super(e.TYPE, {
321
- bubbles: !0,
322
- detail: t
323
- }), this.handler = t;
324
- }
325
- }, H = class e extends CustomEvent {
326
- static {
327
- this.TYPE = "delete.sound";
328
- }
329
- constructor(t, n) {
330
- super(e.TYPE, {
331
- bubbles: !0,
332
- detail: {
333
- src: t,
334
- done: n
335
- }
336
- }), this.src = t, this.done = n;
337
- }
338
- }, U = class e extends CustomEvent {
339
- static {
340
- this.TYPE = "insert.sound";
341
- }
342
- constructor(t) {
343
- super(e.TYPE, {
344
- bubbles: !0,
345
- detail: t
346
- }), this.handler = t;
347
- }
348
- }, W = /* @__PURE__ */ e(r(), 1), G = a("div")(({ theme: e }) => ({
349
- marginBottom: e.spacing(2.5),
350
- display: "flex",
351
- flex: 1
352
- })), K = a("div")(({ theme: e }) => ({ marginBottom: e.spacing(1) })), q = a("div")({ flex: 1 }), J = a(l)({ color: `${i.tertiary()} !important` }), Y = (e, t) => {
353
- if (!e) return t;
354
- let n = [];
355
- return (t || []).forEach((t, r) => {
356
- let { editable: i, interactive: a } = t;
357
- n[r] = {
358
- label: i && e[r]?.label ? e[r].label : t.label,
359
- value: a && e[r]?.value ? e[r].value : t.value,
360
- editable: t.editable,
361
- interactive: t.interactive
362
- };
363
- }), n;
364
- }, ae = class extends S.Component {
365
- static propTypes = {
366
- model: O.default.object.isRequired,
367
- onChange: O.default.func.isRequired,
368
- charts: O.default.array,
369
- labelsPlaceholders: O.default.object,
370
- titlePlaceholder: O.default.object,
371
- showPixelGuides: O.default.bool,
372
- authorNewCategoryDefaults: O.default.object,
373
- chartingOptions: O.default.object
374
- };
375
- constructor(e) {
376
- super(e), this.state = { dialog: { open: !1 } };
377
- }
378
- handleAlertDialog = (e, t) => this.setState({ dialog: { open: e } }, t);
379
- changeData = (e) => this.props.onChange({
380
- ...this.props.model,
381
- data: e
382
- });
383
- changeAddRemoveEnabled = (e) => {
384
- let { model: t } = this.props, n = Y(t.correctAnswer.data, t.data);
385
- e ? this.props.onChange({
386
- ...this.props.model,
387
- addCategoryEnabled: e
388
- }) : this.setState({ dialog: {
389
- open: !0,
390
- title: "Warning",
391
- text: "This change will remove any correct answer categories that are not part of the initial item configuration.",
392
- onConfirm: () => this.handleAlertDialog(!1, this.props.onChange({
393
- ...this.props.model,
394
- addCategoryEnabled: e,
395
- correctAnswer: { data: n }
396
- })),
397
- onClose: () => this.handleAlertDialog(!1)
398
- } });
399
- };
400
- changeTitle = (e) => this.props.onChange({
401
- ...this.props.model,
402
- title: e
403
- });
404
- changeLabel = (e, t) => this.props.onChange({
405
- ...this.props.model,
406
- [e]: {
407
- ...this.props.model[e],
408
- label: t
409
- }
410
- });
411
- render() {
412
- let { model: e, charts: t, labelsPlaceholders: n, titlePlaceholder: r, showPixelGuides: i, authorNewCategoryDefaults: a, chartingOptions: o, mathMlOptions: s = {}, labelsCharactersLimit: c } = this.props, { dialog: l } = this.state, { domain: u = {}, range: d = {} } = e || {};
413
- return /* @__PURE__ */ D("div", { children: [/* @__PURE__ */ E(K, { children: "Define Initial Chart Attributes" }), /* @__PURE__ */ E(G, { children: /* @__PURE__ */ D(q, { children: [
414
- /* @__PURE__ */ E(h, {
415
- component: "div",
416
- type: "body1",
417
- children: /* @__PURE__ */ E("span", { children: "Use the tools below to set up the chart as it will initially appear to students." })
418
- }),
419
- /* @__PURE__ */ E(b, {
420
- defineChart: !0,
421
- chartingOptions: o,
422
- showPixelGuides: i,
423
- chartType: e.chartType,
424
- size: e.graph,
425
- domain: u,
426
- range: d,
427
- charts: t,
428
- data: e.data.map((e, t) => ({
429
- ...e,
430
- index: t
431
- })),
432
- title: e.title,
433
- onDataChange: this.changeData,
434
- onChangeTitle: this.changeTitle,
435
- onChangeLabels: this.changeLabel,
436
- addCategoryEnabled: !0,
437
- changeInteractiveEnabled: e.changeInteractiveEnabled,
438
- changeEditableEnabled: e.changeEditableEnabled,
439
- categoryDefaultLabel: a?.label,
440
- categoryDefaults: a,
441
- labelsPlaceholders: n,
442
- titlePlaceholder: r?.label,
443
- mathMlOptions: s,
444
- labelsCharactersLimit: c
445
- }),
446
- e.changeAddCategoryEnabled && /* @__PURE__ */ D("div", { children: [/* @__PURE__ */ E(J, {
447
- checked: e.addCategoryEnabled,
448
- onChange: (e) => {
449
- this.changeAddRemoveEnabled(e.target.checked);
450
- }
451
- }), o?.addCategory?.authoringLabel] }),
452
- /* @__PURE__ */ E(y, {
453
- open: l.open,
454
- title: l.title,
455
- text: l.text,
456
- onClose: l.onClose,
457
- onConfirm: l.onConfirm
458
- })
459
- ] }, "graph") })] });
460
- }
461
- }, X = a("div")(({ theme: e }) => ({
462
- marginBottom: e.spacing(2.5),
463
- display: "flex",
464
- flex: 1
465
- })), oe = a("div")({ flex: 1 }), se = a("div")(({ theme: e }) => ({ border: `2px solid ${e.palette.error.main}` })), ce = a(h)(({ theme: e }) => ({
466
- fontSize: e.typography.fontSize - 2,
467
- color: e.palette.error.main,
468
- paddingTop: e.spacing(1)
469
- })), le = a("div")(({ theme: e }) => ({ marginBottom: e.spacing(1) })), Z = (e, t) => e.map((e, n) => ({
470
- ...e,
471
- editable: n < t.length ? t[n].editable : !0,
472
- interactive: n < t.length ? t[n].interactive : !0,
473
- deletable: n >= t.length
474
- })), ue = (e, t) => {
475
- if (!e) return t;
476
- let n = [...e], r = [];
477
- if ((t || []).forEach((t, n) => {
478
- let i = t.editable, a = t.interactive;
479
- r[n] = {
480
- label: i && e[n]?.label ? e[n].label : t.label,
481
- value: a && e[n]?.value || a && e[n]?.value == 0 ? e[n].value : t.value,
482
- editable: t.editable,
483
- interactive: t.interactive
484
- };
485
- }), r.length < e.length) {
486
- let i = (n || []).slice(r.length, e.length);
487
- return Z((r || []).concat(i), t);
488
- }
489
- return r;
490
- }, de = (e, t) => {
491
- let n = t.length - 1, { editable: r, interactive: i, deletable: a, ...o } = t[t.length - 1];
492
- return (e || []).splice(n, 0, o), Z([...e], t);
493
- }, fe = (e, t, n) => ((e || []).splice(n, 1), Z([...e], t)), pe = (e, n, r) => {
494
- let i = e && e.model && e.model.data || [], a = n && n.model && n.model.data || [], o = t(e && e.model && e.model.correctAnswer && e.model.correctAnswer.data || []), s = t(r ? r.categories : []), c = [];
495
- if (i.length > a.length) return c = de(o, i), c;
496
- if (i.length < a.length) {
497
- let e = i.length;
498
- for (let t = 0; t < i.length; t++) if (i[t].index !== t) {
499
- e = t;
500
- break;
501
- }
502
- return c = fe(s, i, e), c;
503
- }
504
- return c = ue(o, i), c;
505
- }, me = class extends S.Component {
506
- static propTypes = {
507
- correctAnswerErrors: O.default.object,
508
- studentNewCategoryDefaultLabel: O.default.string,
509
- model: O.default.object.isRequired,
510
- onChange: O.default.func.isRequired,
511
- charts: O.default.array,
512
- error: O.default.string
513
- };
514
- constructor(e) {
515
- super(e), this.state = { categories: [] };
516
- }
517
- changeData = (e) => {
518
- let { model: t, onChange: n } = this.props, { correctAnswer: r } = t || {};
519
- n({
520
- ...t,
521
- correctAnswer: {
522
- ...r,
523
- data: e.map(({ interactive: e, editable: t, index: n, ...r }) => r)
524
- }
525
- });
526
- };
527
- componentDidMount() {
528
- let e = pe(this.props, this.props, null);
529
- this.setState({ categories: e || ue(this.props.model.correctAnswer.data, this.props.model.data) });
530
- }
531
- componentDidUpdate(e, t) {
532
- let r = pe(this.props, e, t);
533
- r && !n(r, this.state.categories) && (this.changeData(r), this.setState({ categories: r }));
534
- }
535
- render() {
536
- let { model: e, charts: t, error: n, studentNewCategoryDefaultLabel: r, correctAnswerErrors: i, mathMlOptions: a = {}, labelsPlaceholders: o = {} } = this.props, { categories: s } = this.state, { domain: c = {}, range: l = {} } = e || {}, { identicalError: u, categoriesError: d } = i || {};
537
- return /* @__PURE__ */ D("div", { children: [/* @__PURE__ */ E(le, { children: "Define Correct Response" }), /* @__PURE__ */ E(X, { children: /* @__PURE__ */ D(oe, { children: [
538
- /* @__PURE__ */ E(h, {
539
- component: "div",
540
- type: "body1",
541
- children: /* @__PURE__ */ E("span", { children: "Use the tools below to define the correct answer." })
542
- }),
543
- E(u || d ? se : "div", { children: /* @__PURE__ */ E(b, {
544
- chartType: e.chartType,
545
- size: e.graph,
546
- domain: c,
547
- range: l,
548
- charts: t,
549
- data: s,
550
- title: e.title,
551
- onDataChange: this.changeData,
552
- addCategoryEnabled: e.addCategoryEnabled,
553
- categoryDefaultLabel: r,
554
- error: n,
555
- mathMlOptions: a,
556
- labelsPlaceholders: o
557
- }) }, `correct-response-graph-${e.correctAnswer.name}`),
558
- (u || d) && /* @__PURE__ */ E(ce, {
559
- component: "div",
560
- type: "body1",
561
- children: /* @__PURE__ */ E("span", { children: u || d })
562
- })
563
- ] }, "graph") })] });
564
- }
565
- }, he = [
566
- .01,
567
- .02,
568
- .04,
569
- .05,
570
- .0625,
571
- .1,
572
- .125,
573
- .2,
574
- .25,
575
- .5,
576
- 1,
577
- 2,
578
- 3,
579
- 4,
580
- 5,
581
- 8,
582
- 10,
583
- 12,
584
- 15,
585
- 20,
586
- 40,
587
- 50,
588
- 64,
589
- 100,
590
- 500,
591
- 1e3
592
- ], ge = [
593
- .01,
594
- .02,
595
- .05,
596
- .1,
597
- .2,
598
- .25,
599
- .5,
600
- 1,
601
- 2,
602
- 5,
603
- 10,
604
- 20,
605
- 50,
606
- 100,
607
- 500,
608
- 1e3
609
- ], _e = {
610
- .01: [
611
- 0,
612
- .01,
613
- .02,
614
- .04,
615
- .05,
616
- .1
617
- ],
618
- .02: [
619
- 0,
620
- .02,
621
- .04,
622
- .1
623
- ],
624
- .04: [
625
- 0,
626
- .04,
627
- .08,
628
- .16,
629
- .2
630
- ],
631
- .05: [
632
- 0,
633
- .05,
634
- .1,
635
- .2,
636
- .25
637
- ],
638
- .0625: [
639
- 0,
640
- .0625,
641
- .125,
642
- .25,
643
- .5
644
- ],
645
- .1: [
646
- 0,
647
- .1,
648
- .2,
649
- .4,
650
- .5,
651
- 1
652
- ],
653
- .125: [
654
- 0,
655
- .125,
656
- .25,
657
- .5,
658
- 1
659
- ],
660
- .2: [
661
- 0,
662
- .2,
663
- .5,
664
- .1
665
- ],
666
- .25: [
667
- 0,
668
- .25,
669
- .5,
670
- 1,
671
- 2
672
- ],
673
- .5: [
674
- 0,
675
- .5,
676
- 1,
677
- 2
678
- ],
679
- 1: [
680
- 0,
681
- 1,
682
- 2,
683
- 4,
684
- 5,
685
- 10
686
- ],
687
- 2: [
688
- 0,
689
- 2,
690
- 4,
691
- 8,
692
- 10
693
- ],
694
- 3: [
695
- 0,
696
- 3,
697
- 6,
698
- 12,
699
- 15
700
- ],
701
- 4: [
702
- 0,
703
- 4,
704
- 8,
705
- 16,
706
- 20
707
- ],
708
- 5: [
709
- 0,
710
- 5,
711
- 10,
712
- 20,
713
- 25
714
- ],
715
- 8: [
716
- 0,
717
- 8,
718
- 16,
719
- 32,
720
- 40,
721
- 64
722
- ],
723
- 10: [
724
- 0,
725
- 10,
726
- 20,
727
- 40,
728
- 50,
729
- 100
730
- ],
731
- 12: [
732
- 0,
733
- 12,
734
- 24
735
- ],
736
- 15: [
737
- 0,
738
- 15,
739
- 30,
740
- 60
741
- ],
742
- 20: [
743
- 0,
744
- 20,
745
- 40,
746
- 80,
747
- 100
748
- ],
749
- 40: [
750
- 0,
751
- 40,
752
- 80,
753
- 160,
754
- 200
755
- ],
756
- 50: [
757
- 0,
758
- 50,
759
- 100,
760
- 200,
761
- 250
762
- ],
763
- 64: [
764
- 0,
765
- 64,
766
- 128
767
- ],
768
- 100: [
769
- 0,
770
- 100,
771
- 200,
772
- 400,
773
- 500
774
- ],
775
- 500: [
776
- 0,
777
- 500,
778
- 1e3,
779
- 2500
780
- ],
781
- 1e3: [
782
- 0,
783
- 1e3,
784
- 2e3,
785
- 4e3,
786
- 5e3
787
- ]
788
- }, ve = (e, t, n = !1) => {
789
- let r = 10 * (e.max - e.min) / t, i = r * 10, a = n && !ge.includes(e.step) && he.includes(e.step);
790
- return (!n || a ? he : ge).filter((e) => e >= r && e <= i);
791
- }, ye = (e) => _e[e] || [], be = (e, t, r, i) => {
792
- let a = ve(e, t), o = ye(e.step || 1);
793
- if (!n(r, a) && !a.includes(e.step)) {
794
- let n = ve(e, t, !0)[0] || 1;
795
- return e.step = n, o = ye(n), o.includes(e.labelStep) || (e.labelStep = n), {
796
- gridValues: a,
797
- labelValues: o
798
- };
799
- }
800
- return !n(i, o) && !o.includes(e.labelStep) && (e.labelStep = e.step), {
801
- gridValues: a,
802
- labelValues: o
803
- };
804
- }, xe = (0, W.default)("@pie-element:graphing:configure"), { Panel: Se, toggle: Q, radio: Ce, dropdown: we, textField: Te } = f, Ee = a(v)(({ theme: e }) => ({
805
- width: "100%",
806
- paddingTop: e.spacing(2),
807
- marginBottom: e.spacing(2)
808
- })), De = a(h)(({ theme: e }) => ({ marginBottom: e.spacing(2.5) })), $ = a("div")(({ theme: e }) => ({
809
- fontSize: e.typography.fontSize - 2,
810
- color: e.palette.error.main,
811
- paddingTop: e.spacing(1)
812
- })), Oe = [
813
- m.Bar(),
814
- m.Histogram(),
815
- m.LineDot(),
816
- m.LineCross(),
817
- m.DotPlot(),
818
- m.LinePlot()
819
- ], ke = class extends C.Component {
820
- static propTypes = {
821
- onModelChanged: O.default.func,
822
- onConfigurationChanged: O.default.func,
823
- imageSupport: O.default.object,
824
- uploadSoundSupport: O.default.object,
825
- model: O.default.object.isRequired,
826
- configuration: O.default.object.isRequired,
827
- chartingOptions: O.default.object
828
- };
829
- constructor(e) {
830
- super(e);
831
- let { range: t = {}, graph: n } = e.model || {}, r = { range: ve(t, n.height, !0) }, i = { range: ye(t.step || 1) };
832
- this.state = {
833
- gridValues: r,
834
- labelValues: i
835
- };
836
- }
837
- onRationaleChange = (e) => this.props.onModelChanged({
838
- ...this.props.model,
839
- rationale: e
840
- });
841
- onPromptChange = (e) => this.props.onModelChanged({
842
- ...this.props.model,
843
- prompt: e
844
- });
845
- onTeacherInstructionsChange = (e) => this.props.onModelChanged({
846
- ...this.props.model,
847
- teacherInstructions: e
848
- });
849
- onChartTypeChange = (e) => this.props.onModelChanged({
850
- ...this.props.model,
851
- chartType: e
852
- });
853
- onConfigChange = (e) => {
854
- let { model: t, onModelChanged: n } = this.props, { gridValues: r, labelValues: i } = this.state, a = {
855
- ...t,
856
- ...e
857
- }, { graph: o, range: s } = a, c = {}, l = {}, u = be(s, o.height, r.range, i.range);
858
- c.range = u.gridValues, l.range = u.labelValues, this.setState({
859
- gridValues: c,
860
- labelValues: l
861
- }), n(a);
862
- };
863
- render() {
864
- let { configuration: e, imageSupport: t, model: n, onConfigurationChanged: r, onModelChanged: i, uploadSoundSupport: a } = this.props;
865
- xe("[render] model", n);
866
- let { graph: o } = n, { baseInputConfiguration: s = {}, contentDimensions: l = {}, chartDimensions: d = {}, authorNewCategoryDefaults: f = {}, labelsPlaceholders: p = {}, instruction: m = {}, maxImageWidth: h = {}, maxImageHeight: g = {}, prompt: _ = {}, rationale: v = {}, scoringType: y = {}, settingsPanelDisabled: b, spellCheck: x = {}, studentInstructions: S = {}, teacherInstructions: C = {}, titlePlaceholder: ee = {}, withRubric: w = {}, chartingOptions: T = {}, availableChartTypes: O = {}, mathMlOptions: k = {}, chartTypeLabel: A, language: j = {}, languageChoices: M = {}, labelsCharactersLimit: N } = e || {}, { errors: te, extraCSSRules: ne, promptEnabled: P, rationaleEnabled: re, spellCheckEnabled: F, teacherInstructionsEnabled: I, studentNewCategoryDefaultLabel: L } = n || {}, { categoryErrors: ie, correctAnswerErrors: z, prompt: B, rationale: V, teacherInstructions: H } = te || {}, { gridValues: U, labelValues: W } = this.state, G = d.showInConfigPanel || !0, K = h && h.prompt, q = g && g.prompt, J = {
867
- changeInteractiveEnabled: T.changeInteractive?.settings && Q(T.changeInteractive.settingsLabel),
868
- changeEditableEnabled: T.changeEditable?.settings && Q(T.changeEditable.settingsLabel),
869
- changeAddCategoryEnabled: T.addCategory?.settings && Q(T.addCategory.settingsLabel)
870
- }, Y = {
871
- teacherInstructionsEnabled: C.settings && Q(C.label),
872
- studentInstructionsEnabled: S.settings && Q(S.label),
873
- rationaleEnabled: v.settings && Q(v.label),
874
- spellCheckEnabled: x.settings && Q(x.label),
875
- promptEnabled: _.settings && Q(_.label),
876
- scoringType: y.settings && Ce(y.label, ["all or nothing", "partial scoring"]),
877
- rubricEnabled: w?.settings && Q(w?.label),
878
- "language.enabled": j.settings && Q(j.label, !0),
879
- language: j.settings && j.enabled && we(M.label, M.options),
880
- instruction: m.settings && Te(m.label)
881
- }, X = (e = {}) => ({
882
- ...s,
883
- ...e
884
- });
885
- return /* @__PURE__ */ D(c.ConfigLayout, {
886
- extraCSSRules: ne,
887
- dimensions: l,
888
- hideSettings: b,
889
- settings: /* @__PURE__ */ E(Se, {
890
- model: n,
891
- configuration: e,
892
- onChangeModel: i,
893
- onChangeConfiguration: r,
894
- groups: {
895
- Settings: J,
896
- Properties: Y
897
- }
898
- }),
899
- children: [
900
- /* @__PURE__ */ E(De, {
901
- component: "div",
902
- type: "body1",
903
- children: m?.label || ""
904
- }),
905
- I && /* @__PURE__ */ D(Ee, {
906
- label: C.label,
907
- children: [/* @__PURE__ */ E(u, {
908
- markup: n.teacherInstructions || "",
909
- onChange: this.onTeacherInstructionsChange,
910
- imageSupport: t,
911
- nonEmpty: !1,
912
- error: H,
913
- spellCheck: F,
914
- pluginProps: X(C?.inputConfiguration),
915
- maxImageWidth: h && h.teacherInstructions || K,
916
- maxImageHeight: g && g.teacherInstructions || q,
917
- uploadSoundSupport: a,
918
- languageCharactersProps: [{ language: "spanish" }, { language: "special" }],
919
- mathMlOptions: k
920
- }), H && /* @__PURE__ */ E($, { children: H })]
921
- }),
922
- P && /* @__PURE__ */ D(Ee, {
923
- label: _.label,
924
- children: [/* @__PURE__ */ E(u, {
925
- markup: n.prompt,
926
- onChange: this.onPromptChange,
927
- imageSupport: t,
928
- nonEmpty: !1,
929
- error: B,
930
- spellCheck: F,
931
- disableUnderline: !0,
932
- pluginProps: X(_?.inputConfiguration),
933
- maxImageWidth: K,
934
- maxImageHeight: q,
935
- uploadSoundSupport: a,
936
- languageCharactersProps: [{ language: "spanish" }, { language: "special" }],
937
- mathMlOptions: k
938
- }), B && /* @__PURE__ */ E($, { children: B })]
939
- }),
940
- /* @__PURE__ */ E(R, {
941
- model: n,
942
- onChange: this.onConfigChange,
943
- gridValues: U,
944
- labelValues: W,
945
- chartDimensions: d,
946
- charts: Oe,
947
- studentNewCategoryDefaultLabel: L,
948
- availableChartTypes: O,
949
- chartTypeLabel: A
950
- }),
951
- /* @__PURE__ */ E(ae, {
952
- model: n,
953
- onChange: i,
954
- charts: Oe,
955
- labelsPlaceholders: p,
956
- titlePlaceholder: ee,
957
- showPixelGuides: G,
958
- authorNewCategoryDefaults: f,
959
- chartingOptions: T,
960
- mathMlOptions: k,
961
- labelsCharactersLimit: N
962
- }),
963
- /* @__PURE__ */ E(me, {
964
- config: o,
965
- model: n,
966
- onChange: i,
967
- charts: Oe,
968
- error: ie,
969
- correctAnswerErrors: z,
970
- studentNewCategoryDefaultLabel: L,
971
- mathMlOptions: k,
972
- labelsPlaceholders: p
973
- }),
974
- re && /* @__PURE__ */ D(Ee, {
975
- label: v.label || "Rationale",
976
- children: [/* @__PURE__ */ E(u, {
977
- markup: n.rationale || "",
978
- onChange: this.onRationaleChange,
979
- imageSupport: t,
980
- error: V,
981
- spellCheck: F,
982
- pluginProps: X(v?.inputConfiguration),
983
- maxImageWidth: h && h.rationale || K,
984
- maxImageHeight: g && g.rationale || q,
985
- uploadSoundSupport: a,
986
- languageCharactersProps: [{ language: "spanish" }, { language: "special" }],
987
- mathMlOptions: k
988
- }), V && /* @__PURE__ */ E($, { children: V })]
989
- })
990
- ]
991
- });
992
- }
993
- }, Ae = {
994
- model: {
995
- addCategoryEnabled: !0,
996
- changeAddCategoryEnabled: !1,
997
- changeEditableEnabled: !1,
998
- changeInteractiveEnabled: !1,
999
- chartType: "lineCross",
1000
- correctAnswer: {},
1001
- data: [],
1002
- domain: {},
1003
- graph: {
1004
- width: 480,
1005
- height: 480
1006
- },
1007
- prompt: "",
1008
- promptEnabled: !0,
1009
- range: {
1010
- label: "",
1011
- max: 1,
1012
- min: 0,
1013
- labelStep: 1
1014
- },
1015
- rationale: "",
1016
- rationaleEnabled: !0,
1017
- scoringType: "all or nothing",
1018
- studentInstructionsEnabled: !0,
1019
- studentNewCategoryDefaultLabel: "New Category",
1020
- teacherInstructions: "",
1021
- teacherInstructionsEnabled: !0,
1022
- title: ""
1023
- },
1024
- configuration: {
1025
- baseInputConfiguration: {
1026
- h3: { disabled: !0 },
1027
- audio: { disabled: !1 },
1028
- video: { disabled: !1 },
1029
- image: { disabled: !1 },
1030
- textAlign: { disabled: !0 },
1031
- showParagraphs: { disabled: !1 },
1032
- separateParagraphs: { disabled: !0 }
1033
- },
1034
- spellCheck: {
1035
- label: "Spellcheck",
1036
- settings: !1,
1037
- enabled: !0
1038
- },
1039
- chartDimensions: {
1040
- settings: !1,
1041
- label: "Chart Dimensions",
1042
- showInConfigPanel: !0,
1043
- width: {
1044
- min: 50,
1045
- max: 700,
1046
- step: 20
1047
- },
1048
- height: {
1049
- min: 400,
1050
- max: 700,
1051
- step: 20
1052
- }
1053
- },
1054
- authorNewCategoryDefaults: {
1055
- settings: !1,
1056
- label: "Category",
1057
- interactive: !0,
1058
- editable: !1
1059
- },
1060
- availableChartTypes: {
1061
- bar: "Bar Chart",
1062
- histogram: "Histogram",
1063
- lineDot: "Line Chart ●",
1064
- lineCross: "Line Chart x",
1065
- dotPlot: "Dot/Line Plot ⬤",
1066
- linePlot: "Dot/Line Plot X"
1067
- },
1068
- chartTypeLabel: "ChartType",
1069
- studentNewCategoryDefaultLabel: {
1070
- settings: !1,
1071
- label: "Category"
1072
- },
1073
- prompt: {
1074
- settings: !0,
1075
- label: "Item Stem",
1076
- required: !1,
1077
- inputConfiguration: {
1078
- audio: { disabled: !1 },
1079
- video: { disabled: !1 },
1080
- image: { disabled: !1 }
1081
- }
1082
- },
1083
- rationale: {
1084
- settings: !0,
1085
- label: "Rationale",
1086
- required: !1,
1087
- inputConfiguration: {
1088
- audio: { disabled: !1 },
1089
- video: { disabled: !1 },
1090
- image: { disabled: !1 }
1091
- }
1092
- },
1093
- scoringType: {
1094
- settings: !1,
1095
- label: "Scoring Type"
1096
- },
1097
- settingsPanelDisabled: !1,
1098
- studentInstructions: {
1099
- settings: !1,
1100
- label: "Student Instructions"
1101
- },
1102
- teacherInstructions: {
1103
- settings: !0,
1104
- label: "Teacher Instructions",
1105
- required: !1,
1106
- inputConfiguration: {
1107
- audio: { disabled: !1 },
1108
- video: { disabled: !1 },
1109
- image: { disabled: !1 }
1110
- }
1111
- },
1112
- title: {
1113
- settings: !1,
1114
- label: "Chart Title"
1115
- },
1116
- instruction: {
1117
- settings: !1,
1118
- label: "This item type provides various types of interactive charts. Depending upon how an item is configured,\n students can change the heights of bars (or other similar chart elements) created by the author; relabel bars\n created by the author; and/or add new bars, label them, and set their heights."
1119
- },
1120
- titlePlaceholder: {
1121
- settings: !1,
1122
- label: "Click here to add a title"
1123
- },
1124
- labelsPlaceholders: {
1125
- left: "Click here to add a label for this axis",
1126
- right: "",
1127
- top: "",
1128
- bottom: "Click here to add a label for this axis"
1129
- },
1130
- maxImageWidth: {
1131
- teacherInstructions: 300,
1132
- prompt: 300,
1133
- rationale: 300
1134
- },
1135
- maxImageHeight: {
1136
- teacherInstructions: 300,
1137
- prompt: 300,
1138
- rationale: 300
1139
- },
1140
- withRubric: {
1141
- settings: !1,
1142
- label: "Add Rubric"
1143
- },
1144
- language: {
1145
- settings: !1,
1146
- label: "Specify Language",
1147
- enabled: !1
1148
- },
1149
- languageChoices: {
1150
- label: "Language Choices",
1151
- options: []
1152
- },
1153
- chartingOptions: {
1154
- changeInteractive: {
1155
- settings: !1,
1156
- authoringLabel: "Student can set value",
1157
- settingsLabel: "Allow non-interactive categories"
1158
- },
1159
- changeEditable: {
1160
- settings: !1,
1161
- authoringLabel: "Student can edit name",
1162
- settingsLabel: "Allow editable category names"
1163
- },
1164
- addCategory: {
1165
- settings: !1,
1166
- authoringLabel: "Student can add categories",
1167
- settingsLabel: "Allow changes to whether students can add categories"
1168
- },
1169
- mathMlOptions: {
1170
- mmlOutput: !1,
1171
- mmlEditing: !1
1172
- }
1173
- }
1174
- }
1175
- }, je = (0, W.default)("pie-elements:graphing:configure"), Me = class e extends HTMLElement {
1176
- static createDefaultModel = (e = {}) => ({
1177
- ...Ae.model,
1178
- ...e
1179
- });
1180
- constructor() {
1181
- super(), this._root = null, this._model = e.createDefaultModel(), this._configuration = Ae.configuration;
1182
- }
1183
- set model(t) {
1184
- this._model = e.createDefaultModel(t), this._render();
1185
- }
1186
- set configuration(e) {
1187
- let t = {
1188
- ...Ae.configuration,
1189
- ...e
1190
- };
1191
- this._configuration = t, t?.language?.enabled ? t?.languageChoices?.options?.length && (this._model.language = t?.languageChoices.options[0].value) : t.language.settings && this._model.language ? (this._configuration.language.enabled = !0, (!this._configuration.languageChoices.options || !this._configuration.languageChoices.options.length) && (this._configuration.languageChoices.options = []), this._configuration.languageChoices.options.find((e) => e.value === this._model.language) || this._configuration.languageChoices.options.push({
1192
- value: this._model.language,
1193
- label: this._model.language
1194
- })) : delete this._model.language, this._render();
1195
- }
1196
- onModelChanged(e) {
1197
- this._model = e, this._render(), je("[onModelChanged]: ", this._model), this.dispatchEvent(new z(this._model));
1198
- }
1199
- onConfigurationChanged(e) {
1200
- this._configuration = e, this._render();
1201
- }
1202
- insertImage(e) {
1203
- this.dispatchEvent(new V(e));
1204
- }
1205
- onDeleteImage(e, t) {
1206
- this.dispatchEvent(new B(e, t));
1207
- }
1208
- insertSound(e) {
1209
- this.dispatchEvent(new U(e));
1210
- }
1211
- onDeleteSound(e, t) {
1212
- this.dispatchEvent(new H(e, t));
1213
- }
1214
- _render() {
1215
- if (this._model) {
1216
- let e = C.createElement(ke, {
1217
- onModelChanged: this.onModelChanged.bind(this),
1218
- onConfigurationChanged: this.onConfigurationChanged.bind(this),
1219
- model: this._model,
1220
- configuration: this._configuration,
1221
- imageSupport: {
1222
- add: this.insertImage.bind(this),
1223
- delete: this.onDeleteImage.bind(this)
1224
- },
1225
- uploadSoundSupport: {
1226
- add: this.insertSound.bind(this),
1227
- delete: this.onDeleteSound.bind(this)
1228
- }
1229
- });
1230
- this._root ||= T(this), this._root.render(e), queueMicrotask(() => {
1231
- s(this);
1232
- });
1233
- }
1234
- }
1235
- disconnectedCallback() {
1236
- this._root && this._root.unmount();
1237
- }
1238
- };
1239
- //#endregion
1240
- export { Me as default };
1241
-
1242
- //# sourceMappingURL=index.js.map