@pie-element/extended-text-entry 15.1.2-next.11 → 15.1.2-next.12

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.
@@ -1,15 +1,15 @@
1
1
  import { a as e, t } from "./browser-kkT1XVKw.js";
2
- import { A as n, F as r, K as i, S as a, Y as o, _ as s, a as c, g as l, l as u, n as d, t as f, u as p, x as m, y as h } from "./dist-dyuok0rH.js";
3
- import g from "react";
4
- import { jsx as _, jsxs as v } from "react/jsx-runtime";
2
+ import { B as n, F as r, S as i, Y as a, _ as o, a as s, g as c, l, n as u, t as d, u as f, x as p, y as m } from "./dist-CnfFKHzv.js";
3
+ import h from "react";
4
+ import { jsx as g, jsxs as _ } from "react/jsx-runtime";
5
5
  //#region src/delivery/annotation/annotation-utils.ts
6
- var y = /* @__PURE__ */ e(o(), 1), b = /* @__PURE__ */ e(t(), 1), x = (e, t, n) => {
6
+ var v = /* @__PURE__ */ e(a(), 1), y = /* @__PURE__ */ e(t(), 1), b = (e, t, n) => {
7
7
  let r = n || [], i = r.reduce((e, t) => e + t.textContent.length, 0), a = !0;
8
8
  if (i > t) return !1;
9
- for (e &&= (e.nodeType === 3 && e.parentNode && !e.parentNode.hasAttribute("data-ann-id") && r.push(e), e.firstChild); e && a;) a = x(e, t, r), e = e.nextSibling;
9
+ for (e &&= (e.nodeType === 3 && e.parentNode && !e.parentNode.hasAttribute("data-ann-id") && r.push(e), e.firstChild); e && a;) a = b(e, t, r), e = e.nextSibling;
10
10
  return r;
11
- }, S = (e, t, n) => {
12
- let r = x(n, t), i = [], a = 0;
11
+ }, x = (e, t, n) => {
12
+ let r = b(n, t), i = [], a = 0;
13
13
  return r.forEach((n) => {
14
14
  let r = a + n.textContent.length;
15
15
  [e, t].forEach((e) => {
@@ -19,7 +19,7 @@ var y = /* @__PURE__ */ e(o(), 1), b = /* @__PURE__ */ e(t(), 1), x = (e, t, n)
19
19
  });
20
20
  }), a = r;
21
21
  }), i;
22
- }, C = (e) => {
22
+ }, S = (e) => {
23
23
  let { commonAncestorContainer: t, startContainer: n, endContainer: r, startOffset: i, endOffset: a } = e, o = [], s = !1, c = !1, l = "", u = (e) => {
24
24
  let { nodeValue: t, childNodes: d } = e;
25
25
  e === n && e === r ? (t && (l += t.substring(i, a)), s = c = !0) : e === n ? (t && (l += t.substring(i)), s = !0) : e === r ? (t && (l += t.substring(0, a)), c = !0) : e && e.nodeType === 3 && e.parentNode && !e.parentNode.hasAttribute("data-ann-id") && t && s && !c && (l += t, o.push(e)), d.forEach((e) => {
@@ -28,16 +28,16 @@ var y = /* @__PURE__ */ e(o(), 1), b = /* @__PURE__ */ e(t(), 1), x = (e, t, n)
28
28
  });
29
29
  };
30
30
  return u(t), [o, l];
31
- }, w = (e) => {
31
+ }, C = (e) => {
32
32
  let t = document.createElement("SPAN");
33
33
  return e.surroundContents(t), t;
34
- }, T = (e) => {
35
- if (e.startContainer === e.endContainer) return [w(e)];
36
- let [t] = C(e), n = document.createRange();
34
+ }, w = (e) => {
35
+ if (e.startContainer === e.endContainer) return [C(e)];
36
+ let [t] = S(e), n = document.createRange();
37
37
  n.selectNodeContents(e.startContainer), n.setStart(e.startContainer, e.startOffset);
38
- let r = w(n), i = document.createRange();
38
+ let r = C(n), i = document.createRange();
39
39
  i.selectNode(e.endContainer), i.setEnd(e.endContainer, e.endOffset);
40
- let a = w(i);
40
+ let a = C(i);
41
41
  return [
42
42
  r,
43
43
  ...t.map((e) => {
@@ -46,25 +46,25 @@ var y = /* @__PURE__ */ e(o(), 1), b = /* @__PURE__ */ e(t(), 1), x = (e, t, n)
46
46
  }),
47
47
  a
48
48
  ];
49
- }, E = (e, t) => {
49
+ }, T = (e, t) => {
50
50
  let n = document.createRange();
51
51
  n.setStart(t, 0), n.setEnd(e.startContainer, e.startOffset);
52
- let [, r] = C(n), [, i] = C(e), a = r.length;
52
+ let [, r] = S(n), [, i] = S(e), a = r.length;
53
53
  return {
54
54
  quote: i,
55
55
  start: a,
56
56
  end: a + i.length
57
57
  };
58
- }, D = (e, t) => {
58
+ }, E = (e, t) => {
59
59
  (e || []).forEach((e) => {
60
60
  let t = e.parentNode, n = e.childNodes, r = n.length;
61
61
  if (r > 0) for (let i = 0; i < r; i++) t.insertBefore(n[0], e);
62
62
  else t.insertBefore(document.createTextNode(e.textContent), e);
63
63
  t.removeChild(e);
64
64
  }), t.normalize();
65
- }, O = () => {
65
+ }, D = () => {
66
66
  document.getSelection ? (document.getSelection().removeAllRanges(), document.getSelection().addRange(document.createRange())) : window.getSelection ? window.getSelection().removeAllRanges ? (window.getSelection().removeAllRanges(), window.getSelection().addRange(document.createRange())) : window.getSelection().empty && window.getSelection().empty() : document.selection && document.selection.empty();
67
- }, k = (e) => e.length >= 20 || e.search(/\n|\r|\r\n/) !== -1, A = (e) => Array.from(document.querySelectorAll(`[data-id='${e}']`)), j = (e) => document.querySelector(`[data-ann-id='${e}']`), M = r(h)(({ annotationType: e }) => ({ "& .MuiPaper-root": {
67
+ }, O = (e) => e.length >= 20 || e.search(/\n|\r|\r\n/) !== -1, k = (e) => Array.from(document.querySelectorAll(`[data-id='${e}']`)), A = (e) => document.querySelector(`[data-ann-id='${e}']`), j = n(m)(({ annotationType: e }) => ({ "& .MuiPaper-root": {
68
68
  overflowX: "unset",
69
69
  overflowY: "unset",
70
70
  marginLeft: "16px",
@@ -78,30 +78,30 @@ var y = /* @__PURE__ */ e(o(), 1), b = /* @__PURE__ */ e(t(), 1), x = (e, t, n)
78
78
  width: 0,
79
79
  pointerEvents: "none",
80
80
  borderWidth: "7px",
81
- borderRightColor: a.border()
81
+ borderRightColor: i.border()
82
82
  },
83
83
  ...e === "negative" && { "&::before": { borderRightColor: "rgb(255, 204, 238) !important" } },
84
84
  ...e === "positive" && { "&::before": { borderRightColor: "rgb(153, 255, 153) !important" } }
85
- } })), N = r("div")(({ annotationType: e }) => ({
85
+ } })), M = n("div")(({ annotationType: e }) => ({
86
86
  width: "200px",
87
87
  overflow: "hidden",
88
88
  borderRadius: "4px",
89
- backgroundColor: a.white(),
90
- border: `4px solid ${a.border()}`,
89
+ backgroundColor: i.white(),
90
+ border: `4px solid ${i.border()}`,
91
91
  ...e === "negative" && { borderColor: "rgb(255, 204, 238) !important" },
92
92
  ...e === "positive" && { borderColor: "rgb(153, 255, 153) !important" }
93
- })), P = r("div")(() => ({
93
+ })), ee = n("div")(() => ({
94
94
  display: "flex",
95
95
  flexWrap: "wrap",
96
- borderTop: `2px solid ${a.border()}`
97
- })), F = r("div")(({ variant: e, annotationType: t }) => ({
96
+ borderTop: `2px solid ${i.border()}`
97
+ })), N = n("div")(({ variant: e, annotationType: t }) => ({
98
98
  flexGrow: 1,
99
99
  width: "28%",
100
100
  textAlign: "center",
101
101
  padding: "4px",
102
102
  cursor: "pointer",
103
- "&:not(:nth-child(3n))": { borderRight: `1px solid ${a.border()}` },
104
- "&:hover": { backgroundColor: a.backgroundDark() },
103
+ "&:not(:nth-child(3n))": { borderRight: `1px solid ${i.border()}` },
104
+ "&:hover": { backgroundColor: i.backgroundDark() },
105
105
  ...e === "positive" && {
106
106
  backgroundColor: "rgb(153, 255, 153) !important",
107
107
  "&:hover": { filter: "brightness(85%)" }
@@ -112,17 +112,17 @@ var y = /* @__PURE__ */ e(o(), 1), b = /* @__PURE__ */ e(t(), 1), x = (e, t, n)
112
112
  },
113
113
  ...e === "typeChange" && t === "negative" && { "&:hover": { backgroundColor: "rgb(153, 255, 153) !important" } },
114
114
  ...e === "typeChange" && t === "positive" && { "&:hover": { backgroundColor: "rgb(255, 204, 238) !important" } }
115
- })), I = class extends g.Component {
115
+ })), P = class extends h.Component {
116
116
  static propTypes = {
117
- anchorEl: y.default.object,
118
- open: y.default.bool,
119
- offset: y.default.number,
120
- value: y.default.string,
121
- type: y.default.string,
122
- onClose: y.default.func,
123
- onDelete: y.default.func,
124
- onSave: y.default.func,
125
- onTypeChange: y.default.func
117
+ anchorEl: v.default.object,
118
+ open: v.default.bool,
119
+ offset: v.default.number,
120
+ value: v.default.string,
121
+ type: v.default.string,
122
+ onClose: v.default.func,
123
+ onDelete: v.default.func,
124
+ onSave: v.default.func,
125
+ onTypeChange: v.default.func
126
126
  };
127
127
  constructor(e) {
128
128
  super(e), this.state = { value: e.value };
@@ -142,7 +142,7 @@ var y = /* @__PURE__ */ e(o(), 1), b = /* @__PURE__ */ e(t(), 1), x = (e, t, n)
142
142
  };
143
143
  render() {
144
144
  let { anchorEl: e, offset: t, onDelete: n, open: r, type: i } = this.props, { value: a } = this.state;
145
- return /* @__PURE__ */ _(M, {
145
+ return /* @__PURE__ */ g(j, {
146
146
  anchorEl: e,
147
147
  elevation: 2,
148
148
  open: r,
@@ -164,9 +164,9 @@ var y = /* @__PURE__ */ e(o(), 1), b = /* @__PURE__ */ e(t(), 1), x = (e, t, n)
164
164
  vertical: "top",
165
165
  horizontal: "left"
166
166
  },
167
- children: /* @__PURE__ */ v(N, {
167
+ children: /* @__PURE__ */ _(M, {
168
168
  annotationType: i,
169
- children: [/* @__PURE__ */ _(c, {
169
+ children: [/* @__PURE__ */ g(s, {
170
170
  id: "annotation-editor",
171
171
  style: {
172
172
  padding: "2px 5px",
@@ -179,18 +179,18 @@ var y = /* @__PURE__ */ e(o(), 1), b = /* @__PURE__ */ e(t(), 1), x = (e, t, n)
179
179
  value: a,
180
180
  onChange: this.onValueChange,
181
181
  InputProps: { disableUnderline: !0 }
182
- }), /* @__PURE__ */ v(P, { children: [
183
- /* @__PURE__ */ _(F, {
182
+ }), /* @__PURE__ */ _(ee, { children: [
183
+ /* @__PURE__ */ g(N, {
184
184
  onClick: n,
185
185
  children: "Delete"
186
186
  }),
187
- /* @__PURE__ */ _(F, {
187
+ /* @__PURE__ */ g(N, {
188
188
  variant: "typeChange",
189
189
  annotationType: i,
190
190
  onClick: this.handleTypeChange,
191
191
  children: i === "negative" ? "Green" : "Pink"
192
192
  }),
193
- /* @__PURE__ */ _(F, {
193
+ /* @__PURE__ */ g(N, {
194
194
  onClick: this.handleSave,
195
195
  children: "Save"
196
196
  })
@@ -198,7 +198,7 @@ var y = /* @__PURE__ */ e(o(), 1), b = /* @__PURE__ */ e(t(), 1), x = (e, t, n)
198
198
  })
199
199
  });
200
200
  }
201
- }, ee = r(h)({ "& .MuiPaper-root": {
201
+ }, F = n(m)({ "& .MuiPaper-root": {
202
202
  overflowX: "unset",
203
203
  overflowY: "unset",
204
204
  marginTop: "-16px",
@@ -211,30 +211,30 @@ var y = /* @__PURE__ */ e(o(), 1), b = /* @__PURE__ */ e(t(), 1), x = (e, t, n)
211
211
  width: 0,
212
212
  pointerEvents: "none",
213
213
  borderWidth: "7px",
214
- borderTopColor: a.border()
214
+ borderTopColor: i.border()
215
215
  }
216
- } }), te = r("div")(() => ({
216
+ } }), I = n("div")(() => ({
217
217
  width: "300px",
218
218
  overflow: "hidden",
219
219
  borderRadius: "4px",
220
- backgroundColor: a.white(),
221
- border: `2px solid ${a.border()}`
222
- })), ne = r("div")({
220
+ backgroundColor: i.white(),
221
+ border: `2px solid ${i.border()}`
222
+ })), te = n("div")({
223
223
  display: "flex",
224
224
  flexWrap: "wrap"
225
- }), re = r("div")(() => ({
225
+ }), ne = n("div")(() => ({
226
226
  display: "flex",
227
227
  flexWrap: "wrap",
228
- borderTop: `2px solid ${a.border()}`
229
- })), L = r("div")(({ variant: e }) => ({
228
+ borderTop: `2px solid ${i.border()}`
229
+ })), L = n("div")(({ variant: e }) => ({
230
230
  width: "22%",
231
231
  textAlign: "center",
232
232
  padding: "4px",
233
233
  cursor: "pointer",
234
- borderBottom: `1px solid ${a.border()}`,
235
- "&:not(:nth-child(4n))": { borderRight: `1px solid ${a.border()}` },
234
+ borderBottom: `1px solid ${i.border()}`,
235
+ "&:not(:nth-child(4n))": { borderRight: `1px solid ${i.border()}` },
236
236
  "&:nth-child(4n)": { flexGrow: 1 },
237
- "&:hover": { backgroundColor: a.backgroundDark() },
237
+ "&:hover": { backgroundColor: i.backgroundDark() },
238
238
  ...e === "positive" && {
239
239
  backgroundColor: "rgb(153, 255, 153) !important",
240
240
  "&:hover": { filter: "brightness(85%)" }
@@ -243,21 +243,21 @@ var y = /* @__PURE__ */ e(o(), 1), b = /* @__PURE__ */ e(t(), 1), x = (e, t, n)
243
243
  backgroundColor: "rgb(255, 204, 238) !important",
244
244
  "&:hover": { filter: "brightness(85%)" }
245
245
  }
246
- })), R = class extends g.Component {
246
+ })), re = class extends h.Component {
247
247
  static propTypes = {
248
- anchorEl: y.default.object,
249
- open: y.default.bool,
250
- annotations: y.default.array,
251
- isNewAnnotation: y.default.bool,
252
- onClose: y.default.func,
253
- onDelete: y.default.func,
254
- onEdit: y.default.func,
255
- onWrite: y.default.func,
256
- onAnnotate: y.default.func
248
+ anchorEl: v.default.object,
249
+ open: v.default.bool,
250
+ annotations: v.default.array,
251
+ isNewAnnotation: v.default.bool,
252
+ onClose: v.default.func,
253
+ onDelete: v.default.func,
254
+ onEdit: v.default.func,
255
+ onWrite: v.default.func,
256
+ onAnnotate: v.default.func
257
257
  };
258
258
  render() {
259
259
  let { anchorEl: e, annotations: t, isNewAnnotation: n, onAnnotate: r, onClose: i, onEdit: a, onDelete: o, onWrite: s, open: c } = this.props;
260
- return /* @__PURE__ */ _(ee, {
260
+ return /* @__PURE__ */ g(F, {
261
261
  anchorEl: e,
262
262
  open: c,
263
263
  onClose: i,
@@ -274,35 +274,35 @@ var y = /* @__PURE__ */ e(o(), 1), b = /* @__PURE__ */ e(t(), 1), x = (e, t, n)
274
274
  vertical: "bottom",
275
275
  horizontal: "center"
276
276
  },
277
- children: /* @__PURE__ */ v(te, { children: [/* @__PURE__ */ _(ne, { children: t.map((e, t) => /* @__PURE__ */ _(L, {
277
+ children: /* @__PURE__ */ _(I, { children: [/* @__PURE__ */ g(te, { children: t.map((e, t) => /* @__PURE__ */ g(L, {
278
278
  variant: e.type,
279
279
  onClick: () => r(e),
280
280
  children: e.label
281
- }, `annotation-${t}`)) }), /* @__PURE__ */ v(re, { children: [
282
- /* @__PURE__ */ _(L, {
281
+ }, `annotation-${t}`)) }), /* @__PURE__ */ _(ne, { children: [
282
+ /* @__PURE__ */ g(L, {
283
283
  onClick: i,
284
284
  children: "Cancel"
285
285
  }),
286
- /* @__PURE__ */ _(L, { style: { pointerEvents: "none" } }),
287
- n ? /* @__PURE__ */ v(g.Fragment, { children: [/* @__PURE__ */ _(L, {
286
+ /* @__PURE__ */ g(L, { style: { pointerEvents: "none" } }),
287
+ n ? /* @__PURE__ */ _(h.Fragment, { children: [/* @__PURE__ */ g(L, {
288
288
  variant: "positive",
289
289
  onClick: () => s("positive"),
290
290
  children: "Write"
291
- }), /* @__PURE__ */ _(L, {
291
+ }), /* @__PURE__ */ g(L, {
292
292
  variant: "negative",
293
293
  onClick: () => s("negative"),
294
294
  children: "Write"
295
- })] }) : /* @__PURE__ */ v(g.Fragment, { children: [/* @__PURE__ */ _(L, {
295
+ })] }) : /* @__PURE__ */ _(h.Fragment, { children: [/* @__PURE__ */ g(L, {
296
296
  onClick: o,
297
297
  children: "Delete"
298
- }), /* @__PURE__ */ _(L, {
298
+ }), /* @__PURE__ */ g(L, {
299
299
  onClick: a,
300
300
  children: "Edit"
301
301
  })] })
302
302
  ] })] })
303
303
  });
304
304
  }
305
- }, z = r("div")({
305
+ }, R = n("div")({
306
306
  padding: "10px 120px 10px 16px",
307
307
  backgroundColor: "rgba(0, 0, 0, 0.06)",
308
308
  border: "1px solid #ccc",
@@ -318,35 +318,35 @@ var y = /* @__PURE__ */ e(o(), 1), b = /* @__PURE__ */ e(t(), 1), x = (e, t, n)
318
318
  "-moz-user-select": "none",
319
319
  "-ms-user-select": "none"
320
320
  }
321
- }), B = r("div")({ width: "230px" }), V = r("div")({
321
+ }), z = n("div")({ width: "230px" }), B = n("div")({
322
322
  position: "relative",
323
323
  overflowX: "hidden",
324
324
  display: "flex"
325
- }), H = r(f)(({ theme: e }) => ({
325
+ }), V = n(d)(({ theme: e }) => ({
326
326
  paddingTop: e.spacing(2),
327
327
  marginBottom: e.spacing(2),
328
328
  marginTop: e.spacing(2),
329
329
  width: "100%"
330
- })), U = "\n .sideAnnotation:before {\n position: absolute;\n right: var(--before-right, 100%);\n top: var(--before-top, 5px);\n border: solid transparent;\n content: \"\";\n height: 0;\n width: 0;\n pointer-events: none;\n border-width: var(--before-border-width, 7px);\n border-right-color: var(--before-border-color, rgb(153, 255, 153));\n }\n";
330
+ })), H = "\n .sideAnnotation:before {\n position: absolute;\n right: var(--before-right, 100%);\n top: var(--before-top, 5px);\n border: solid transparent;\n content: \"\";\n height: 0;\n width: 0;\n pointer-events: none;\n border-width: var(--before-border-width, 7px);\n border-right-color: var(--before-border-color, rgb(153, 255, 153));\n }\n";
331
331
  if (!document.getElementById("annotation-editor-styles")) {
332
332
  let e = document.createElement("style");
333
- e.id = "annotation-editor-styles", e.textContent = U, document.head.appendChild(e);
333
+ e.id = "annotation-editor-styles", e.textContent = H, document.head.appendChild(e);
334
334
  }
335
- var W = class extends g.Component {
335
+ var U = class extends h.Component {
336
336
  static propTypes = {
337
- text: y.default.string,
338
- comment: y.default.string,
339
- annotations: y.default.array,
340
- predefinedAnnotations: y.default.array,
341
- onChange: y.default.func.isRequired,
342
- onCommentChange: y.default.func.isRequired,
343
- width: y.default.number,
344
- height: y.default.number,
345
- maxHeight: y.default.string,
346
- disabled: y.default.bool,
347
- disabledMath: y.default.bool,
348
- customKeys: y.default.array,
349
- keypadMode: y.default.string
337
+ text: v.default.string,
338
+ comment: v.default.string,
339
+ annotations: v.default.array,
340
+ predefinedAnnotations: v.default.array,
341
+ onChange: v.default.func.isRequired,
342
+ onCommentChange: v.default.func.isRequired,
343
+ width: v.default.number,
344
+ height: v.default.number,
345
+ maxHeight: v.default.string,
346
+ disabled: v.default.bool,
347
+ disabledMath: v.default.bool,
348
+ customKeys: v.default.array,
349
+ keypadMode: v.default.string
350
350
  };
351
351
  constructor(e) {
352
352
  super(e), this.state = {
@@ -363,11 +363,11 @@ var W = class extends g.Component {
363
363
  componentDidMount() {
364
364
  let { annotations: e, text: t } = this.props;
365
365
  t && e.forEach((e) => {
366
- let [t, n] = S(e.start, e.end, this.textRef);
366
+ let [t, n] = x(e.start, e.end, this.textRef);
367
367
  if (t && n) {
368
368
  let r = document.createRange();
369
369
  r.setStart(t.node, t.offset), r.setEnd(n.node, n.offset);
370
- let i = T(r);
370
+ let i = w(r);
371
371
  this.createDOMAnnotation(i, e);
372
372
  }
373
373
  }), this.textRef && (this.adjustAnnotationsPosition(), this.textRef.addEventListener("scroll", this.adjustAnnotationsPosition));
@@ -376,7 +376,7 @@ var W = class extends g.Component {
376
376
  if (this.textRef && this.labelsRef) {
377
377
  let e = this.textRef.offsetLeft + this.textRef.offsetWidth + 8;
378
378
  Array.from(this.labelsRef.children).forEach((t) => {
379
- let n = A(t.dataset.annId), r = (n[0].offsetTop ? n[0].offsetTop : n[0].offsetParent.offsetTop) - this.textRef.scrollTop - 6;
379
+ let n = k(t.dataset.annId), r = (n[0].offsetTop ? n[0].offsetTop : n[0].offsetParent.offsetTop) - this.textRef.scrollTop - 6;
380
380
  t.style.top = `${r}px`, t.style.left = `${e}px`;
381
381
  });
382
382
  }
@@ -384,7 +384,7 @@ var W = class extends g.Component {
384
384
  handleClick = (e) => {
385
385
  let { annotations: t } = this.props, { selectionDetails: n } = this.state;
386
386
  if (n) return;
387
- let { id: r, annId: i } = e.target.dataset, a = r || i, o = A(a), s = j(a), c = t.findIndex((e) => e.id === a), l = s.hasAttribute("data-freeform");
387
+ let { id: r, annId: i } = e.target.dataset, a = r || i, o = k(a), s = A(a), c = t.findIndex((e) => e.id === a), l = s.hasAttribute("data-freeform");
388
388
  l && (s.style.zIndex = "10"), this.setState({
389
389
  anchorEl: o[0],
390
390
  openedMenu: !!r || !!i && !l,
@@ -397,20 +397,20 @@ var W = class extends g.Component {
397
397
  });
398
398
  };
399
399
  handleHover = (e) => {
400
- let { id: t, annId: n } = e.target.dataset, r = t || n, i = A(r), a = j(r), o = a.hasAttribute("data-freeform");
400
+ let { id: t, annId: n } = e.target.dataset, r = t || n, i = k(r), a = A(r), o = a.hasAttribute("data-freeform");
401
401
  i.forEach((e) => {
402
402
  e.style.zIndex = "20", e.classList.contains("positive") ? e.style.backgroundColor = "rgb(51, 255, 51, 0.7)" : e.classList.contains("negative") && (e.style.backgroundColor = "rgba(255, 102, 204, 0.55)");
403
403
  }), o ? (a.style.zIndex = "20", a.classList.contains("positive") ? (a.style.backgroundColor = "rgb(128, 255, 128)", a.style.setProperty("--before-border-color", "rgb(153, 255, 153)")) : a.classList.contains("negative") && (a.style.backgroundColor = "rgb(255, 179, 230)", a.style.setProperty("--before-border-color", "rgb(255, 179, 230)"))) : (a.style.zIndex = "20", a.classList.contains("positive") ? a.style.color = "rgb(0, 77, 0)" : a.classList.contains("negative") && (a.style.color = "rgb(153, 0, 102)"));
404
404
  };
405
405
  handleCancelHover = (e) => {
406
- let { id: t, annId: n } = e.target.dataset, r = t || n, i = A(r), a = j(r), o = a.hasAttribute("data-freeform");
406
+ let { id: t, annId: n } = e.target.dataset, r = t || n, i = k(r), a = A(r), o = a.hasAttribute("data-freeform");
407
407
  i.forEach((e) => {
408
408
  e.style.zIndex = "", e.classList.contains("positive") ? e.style.backgroundColor = "rgb(51, 255, 51, 0.5)" : e.classList.contains("negative") && (e.style.backgroundColor = "rgba(255, 102, 204, 0.4)");
409
409
  }), o ? (a.style.zIndex = "", a.classList.contains("positive") ? (a.style.backgroundColor = "rgb(153, 255, 153)", a.style.removeProperty("--before-border-color")) : a.classList.contains("negative") && (a.style.backgroundColor = "rgb(255, 204, 238)", a.style.removeProperty("--before-border-color"))) : (a.style.zIndex = "", a.classList.contains("positive") ? a.style.color = "rgb(0, 128, 0)" : a.classList.contains("negative") && (a.style.color = "rgb(204, 0, 136)"));
410
410
  };
411
411
  handleClose = (e) => {
412
412
  let { selectedElems: t, labelElem: n } = this.state;
413
- t.length && !t[0].hasAttribute("data-id") && D(t, this.textRef), n && (n.style.zIndex = ""), this.setState({
413
+ t.length && !t[0].hasAttribute("data-id") && E(t, this.textRef), n && (n.style.zIndex = ""), this.setState({
414
414
  anchorEl: null,
415
415
  openedMenu: !1,
416
416
  openedEditor: !1,
@@ -419,18 +419,18 @@ var W = class extends g.Component {
419
419
  selectionDetails: null,
420
420
  annotationIndex: null,
421
421
  annotation: null
422
- }), O();
422
+ }), D();
423
423
  };
424
424
  handleSelection = (e) => {
425
425
  let t = window.getSelection();
426
426
  if (e.detail > 2) {
427
- O();
427
+ D();
428
428
  return;
429
429
  }
430
430
  if (t && t.rangeCount > 0) {
431
431
  let e = t.getRangeAt(0), n = e.toString(), r = this.textRef.contains(e.commonAncestorContainer);
432
432
  if (!t.isCollapsed && n !== "" && r) {
433
- let t = E(e, this.textRef), n = T(e);
433
+ let t = T(e, this.textRef), n = w(e);
434
434
  this.setState({
435
435
  anchorEl: n[0],
436
436
  openedMenu: !0,
@@ -442,7 +442,7 @@ var W = class extends g.Component {
442
442
  };
443
443
  deleteAnnotation = () => {
444
444
  let { annotations: e, onChange: t } = this.props, { selectedElems: n, labelElem: r, annotationIndex: i, annotation: a } = this.state;
445
- (k(a.label) ? this.labelsRef : n[0]).removeChild(r), D(n, this.textRef), e.splice(i, 1), t(e), this.handleClose();
445
+ (O(a.label) ? this.labelsRef : n[0]).removeChild(r), E(n, this.textRef), e.splice(i, 1), t(e), this.handleClose();
446
446
  };
447
447
  createDOMAnnotation = (e, t) => {
448
448
  let { disabled: n } = this.props, { id: r, label: i, type: a } = t;
@@ -450,7 +450,7 @@ var W = class extends g.Component {
450
450
  e.dataset.id = r, e.className = `annotation ${a}`, e.style.position = "relative", e.style.cursor = "pointer", a === "positive" ? e.style.backgroundColor = "rgb(51, 255, 51, 0.5)" : a === "negative" && (e.style.backgroundColor = "rgba(255, 102, 204, 0.4)"), e.onclick = !n && this.handleClick, e.onmouseover = this.handleHover, e.onmouseout = this.handleCancelHover;
451
451
  });
452
452
  let o = e && e[0] || {}, s = document.createElement("SPAN");
453
- if (s.dataset.annId = r, s.innerHTML = i, s.onclick = !n && this.handleClick, s.onmouseover = this.handleHover, s.onmouseout = this.handleCancelHover, k(i)) {
453
+ if (s.dataset.annId = r, s.innerHTML = i, s.onclick = !n && this.handleClick, s.onmouseover = this.handleHover, s.onmouseout = this.handleCancelHover, O(i)) {
454
454
  let e = (o.offsetTop ? o.offsetTop : o.offsetParent.offsetTop) - this.textRef.scrollTop, t = this.textRef.offsetLeft + this.textRef.offsetWidth + 8;
455
455
  s.dataset.freeform = !0, s.className = `sideAnnotation ${a}`, s.style.position = "absolute", s.style.padding = "4px", s.style.borderRadius = "4px", s.style.marginLeft = "8px", s.style.width = "180px", s.style.whiteSpace = "pre-wrap", s.style.wordBreak = "break-word", s.style.border = "2px solid #ffffff", s.style.fontSize = "14px", s.style.fontStyle = "normal", s.style.fontWeight = "normal", s.style.top = `${e}px`, s.style.left = `${t}px`, a === "negative" ? s.style.backgroundColor = "rgb(255, 204, 238)" : a === "positive" && (s.style.backgroundColor = "rgb(153, 255, 153)"), s.style.setProperty("--before-border-width", "7px"), s.style.setProperty("--before-top", "5px"), s.style.setProperty("--before-right", "100%"), a === "negative" ? s.style.setProperty("--before-border-color", "rgb(255, 204, 238)") : a === "positive" && s.style.setProperty("--before-border-color", "rgb(153, 255, 153)"), this.labelsRef.appendChild(s);
456
456
  } else s.className = `annotationLabel ${a}`, s.style.backgroundColor = "rgb(242, 242, 242)", s.style.padding = "2px", s.style.position = "absolute", s.style.userSelect = "none", s.style.whiteSpace = "nowrap", s.style.top = "-10px", s.style.left = "-2px", s.style.fontSize = "12px", s.style.fontStyle = "normal", s.style.fontWeight = "normal", s.style.lineHeight = "6px", s.style.webkitUserSelect = "none", s.style.mozUserSelect = "none", s.style.msUserSelect = "none", a === "positive" ? s.style.color = "rgb(0, 128, 0)" : a === "negative" && (s.style.color = "rgb(204, 0, 136)"), o.appendChild(s);
@@ -490,7 +490,7 @@ var W = class extends g.Component {
490
490
  });
491
491
  };
492
492
  addAnnotation = (e) => {
493
- let { annotations: t, onChange: n } = this.props, r = this.createNewAnnotation("", e), i = j(r.id);
493
+ let { annotations: t, onChange: n } = this.props, r = this.createNewAnnotation("", e), i = A(r.id);
494
494
  t.push(r), this.setState({
495
495
  openedMenu: !1,
496
496
  openedEditor: !0,
@@ -501,9 +501,9 @@ var W = class extends g.Component {
501
501
  };
502
502
  updateLabel = (e, t, n) => {
503
503
  let { selectedElems: r, labelElem: i } = this.state, { label: a, type: o } = t;
504
- k(a) && k(e) || !k(a) && !k(e) ? (i.innerHTML = a, n && (i.classList.remove(n), i.classList.add(o), r.forEach((e) => {
504
+ O(a) && O(e) || !O(a) && !O(e) ? (i.innerHTML = a, n && (i.classList.remove(n), i.classList.add(o), r.forEach((e) => {
505
505
  e.classList.remove(n), e.classList.add(o);
506
- }))) : k(a) && !k(e) ? (r[0].removeChild(i), this.createDOMAnnotation(r, t)) : !k(a) && k(e) && (this.labelsRef.removeChild(i), this.createDOMAnnotation(r, t));
506
+ }))) : O(a) && !O(e) ? (r[0].removeChild(i), this.createDOMAnnotation(r, t)) : !O(a) && O(e) && (this.labelsRef.removeChild(i), this.createDOMAnnotation(r, t));
507
507
  };
508
508
  changeAnnotationType = (e) => {
509
509
  let { annotations: t, onChange: n } = this.props, { annotationIndex: r, selectedElems: i } = this.state, { type: a, label: o } = t[r], s = a === "positive" ? "negative" : "positive", c = {
@@ -526,22 +526,22 @@ var W = class extends g.Component {
526
526
  this.textRef.removeEventListener("scroll", this.adjustAnnotationsPosition);
527
527
  }
528
528
  render() {
529
- let { comment: e, customKeys: t, disabled: n, disabledMath: r, keypadMode: i, height: a, width: o, maxHeight: s, onCommentChange: c, predefinedAnnotations: l, text: u } = this.props, { anchorEl: f, annotation: p, openedMenu: m, openedEditor: h, selectionDetails: g } = this.state, y = f && (f.offsetTop ? f.offsetTop : f.offsetParent.offsetTop), b = this.textRef && y ? y - this.textRef.scrollTop - 8 : 0;
530
- return /* @__PURE__ */ v("div", { children: [
531
- /* @__PURE__ */ v(V, { children: [/* @__PURE__ */ _(z, {
529
+ let { comment: e, customKeys: t, disabled: n, disabledMath: r, keypadMode: i, height: a, width: o, maxHeight: s, onCommentChange: c, predefinedAnnotations: l, text: d } = this.props, { anchorEl: f, annotation: p, openedMenu: m, openedEditor: h, selectionDetails: v } = this.state, y = f && (f.offsetTop ? f.offsetTop : f.offsetParent.offsetTop), b = this.textRef && y ? y - this.textRef.scrollTop - 8 : 0;
530
+ return /* @__PURE__ */ _("div", { children: [
531
+ /* @__PURE__ */ _(B, { children: [/* @__PURE__ */ g(R, {
532
532
  style: {
533
533
  width: o - 34,
534
534
  minHeight: a,
535
535
  maxHeight: s
536
536
  },
537
537
  ref: (e) => this.textRef = e,
538
- onMouseDown: n ? () => {} : O,
538
+ onMouseDown: n ? () => {} : D,
539
539
  onMouseUp: n ? () => {} : this.handleSelection,
540
- dangerouslySetInnerHTML: { __html: u }
541
- }), /* @__PURE__ */ _(B, { ref: (e) => this.labelsRef = e })] }),
542
- /* @__PURE__ */ _(H, {
540
+ dangerouslySetInnerHTML: { __html: d }
541
+ }), /* @__PURE__ */ g(z, { ref: (e) => this.labelsRef = e })] }),
542
+ /* @__PURE__ */ g(V, {
543
543
  label: "Comment",
544
- children: /* @__PURE__ */ _(d, {
544
+ children: /* @__PURE__ */ g(u, {
545
545
  className: "prompt",
546
546
  markup: e || "",
547
547
  onChange: c,
@@ -561,18 +561,18 @@ var W = class extends g.Component {
561
561
  }
562
562
  })
563
563
  }),
564
- /* @__PURE__ */ _(R, {
564
+ /* @__PURE__ */ g(re, {
565
565
  anchorEl: f,
566
566
  open: m && !n,
567
567
  annotations: l,
568
- isNewAnnotation: !!g,
568
+ isNewAnnotation: !!v,
569
569
  onClose: this.handleClose,
570
570
  onDelete: this.deleteAnnotation,
571
571
  onEdit: this.editAnnotation,
572
572
  onWrite: this.addAnnotation,
573
573
  onAnnotate: this.handleMenuClick
574
574
  }),
575
- /* @__PURE__ */ _(I, {
575
+ /* @__PURE__ */ g(P, {
576
576
  anchorEl: this.textRef,
577
577
  open: h && !n,
578
578
  offset: b,
@@ -588,104 +588,102 @@ var W = class extends g.Component {
588
588
  };
589
589
  //#endregion
590
590
  //#region src/delivery/main.tsx
591
- function G(e) {
591
+ function W(e) {
592
592
  return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
593
593
  }
594
- function K(e, t) {
595
- return !e || G(e) ? e : G(e.default) ? e.default : t && G(e[t]) ? e[t] : t && G(e[t]?.default) ? e[t].default : e;
594
+ function G(e, t) {
595
+ 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;
596
596
  }
597
- var q = K(l, "UiLayout") || K(Q.UiLayout, "UiLayout"), J = K(p, "PreviewPrompt") || K(Q.PreviewPrompt, "PreviewPrompt"), Y = K(s, "Collapsible") || K(Q.Collapsible, "Collapsible"), ie = K(m, "Feedback") || K(Q.Feedback, "Feedback"), X = u, Z = X.default, Q = Z && typeof Z == "object" ? Z : X, ae = (0, b.default)("@pie-ui:extended-text-entry"), oe = r(q)({
598
- backgroundColor: a.background(),
599
- color: a.text()
600
- }), se = r(n)(({ theme: e }) => ({
597
+ var K = G(c, "UiLayout") || G(Q.UiLayout, "UiLayout"), q = G(f, "PreviewPrompt") || G(Q.PreviewPrompt, "PreviewPrompt"), J = G(o, "Collapsible") || G(Q.Collapsible, "Collapsible"), Y = G(p, "Feedback") || G(Q.Feedback, "Feedback"), X = l, Z = X.default, Q = Z && typeof Z == "object" ? Z : X, ie = (0, y.default)("@pie-ui:extended-text-entry"), ae = n(K)({
598
+ backgroundColor: i.background(),
599
+ color: i.text()
600
+ }), oe = n(r)(({ theme: e }) => ({
601
601
  width: "100%",
602
- color: a.text(),
602
+ color: i.text(),
603
603
  marginBottom: e.spacing(2),
604
604
  fontSize: "inherit",
605
605
  display: "block"
606
- })), ce = r("div")(({ theme: e }) => ({ marginBottom: e.spacing(2) })), le = r(d)(({ theme: e }) => ({
606
+ })), se = n("div")(({ theme: e }) => ({ marginBottom: e.spacing(2) })), ce = n(u)(({ theme: e }) => ({
607
607
  marginBottom: e.spacing(2),
608
608
  borderRadius: "4px"
609
- })), $ = r("h2")({
609
+ })), le = n("h2")({
610
610
  position: "absolute",
611
611
  left: "-10000px",
612
612
  top: "auto",
613
613
  width: "1px",
614
614
  height: "1px",
615
615
  overflow: "hidden"
616
- }), ue = class extends g.Component {
616
+ }), $ = class extends h.Component {
617
617
  static propTypes = {
618
- onValueChange: y.default.func.isRequired,
619
- onAnnotationsChange: y.default.func.isRequired,
620
- onCommentChange: y.default.func.isRequired,
621
- model: y.default.object,
622
- session: y.default.shape({
623
- value: y.default.string,
624
- annotations: y.default.array,
625
- comment: y.default.string
618
+ onValueChange: v.default.func.isRequired,
619
+ onAnnotationsChange: v.default.func.isRequired,
620
+ onCommentChange: v.default.func.isRequired,
621
+ model: v.default.object,
622
+ session: v.default.shape({
623
+ value: v.default.string,
624
+ annotations: v.default.array,
625
+ comment: v.default.string
626
626
  }).isRequired
627
627
  };
628
- changeSessionValue = i(this.props.onValueChange, 1500);
629
- changeSessionComment = i(this.props.onCommentChange, 1500);
630
628
  render() {
631
- let { model: e, session: t, onAnnotationsChange: n } = this.props, { animationsDisabled: r, annotatorMode: i, customKeys: a, dimensions: o, disabled: s, disabledAnnotator: c, equationEditor: l, extraCSSRules: u, feedback: d, mathInput: f, playersToolbarPosition: p, predefinedAnnotations: m, prompt: h, spanishInput: g, specialInput: y, spellCheckEnabled: b, teacherInstructions: x } = e, { annotations: S, comment: C, value: w } = t, { width: T, height: E } = o || {}, D = "40vh", O = { position: p === "top" ? "top" : "bottom" };
632
- ae("[render] disabled? ", s);
633
- let k = /* @__PURE__ */ _(J, {
629
+ let { model: e, session: t, onAnnotationsChange: n, onCommentChange: r, onValueChange: i } = this.props, { animationsDisabled: a, annotatorMode: o, customKeys: s, dimensions: c, disabled: l, disabledAnnotator: u, equationEditor: d, extraCSSRules: f, feedback: p, mathInput: m, playersToolbarPosition: h, predefinedAnnotations: v, prompt: y, spanishInput: b, specialInput: x, spellCheckEnabled: S, teacherInstructions: C } = e, { annotations: w, comment: T, value: E } = t, { width: D, height: O } = c || {}, k = "40vh", A = { position: h === "top" ? "top" : "bottom" };
630
+ ie("[render] disabled? ", l);
631
+ let j = /* @__PURE__ */ g(q, {
634
632
  defaultClassName: "teacher-instructions",
635
- prompt: x
636
- }), A = [];
637
- return g && A.push({ language: "spanish" }), y && A.push({ language: "special" }), /* @__PURE__ */ v(oe, {
638
- extraCSSRules: u,
633
+ prompt: C
634
+ }), M = [];
635
+ return b && M.push({ language: "spanish" }), x && M.push({ language: "special" }), /* @__PURE__ */ _(ae, {
636
+ extraCSSRules: f,
639
637
  ref: (e) => {
640
638
  this.containerRef = e;
641
639
  },
642
640
  children: [
643
- /* @__PURE__ */ _($, { children: "Constructed Response Question" }),
644
- x && /* @__PURE__ */ _(ce, { children: r ? k : /* @__PURE__ */ _(Y, {
641
+ /* @__PURE__ */ g(le, { children: "Constructed Response Question" }),
642
+ C && /* @__PURE__ */ g(se, { children: a ? j : /* @__PURE__ */ g(J, {
645
643
  labels: {
646
644
  hidden: "Show Teacher Instructions",
647
645
  visible: "Hide Teacher Instructions"
648
646
  },
649
- children: k
647
+ children: j
650
648
  }) }),
651
- h && /* @__PURE__ */ _(se, {
649
+ y && /* @__PURE__ */ g(oe, {
652
650
  component: "span",
653
- children: /* @__PURE__ */ _(J, {
651
+ children: /* @__PURE__ */ g(q, {
654
652
  defaultClassName: "prompt",
655
653
  prompt: e.prompt
656
654
  })
657
655
  }),
658
- i ? /* @__PURE__ */ _(W, {
659
- text: w || "",
660
- annotations: S || [],
661
- comment: C || "",
662
- predefinedAnnotations: m || [],
656
+ o ? /* @__PURE__ */ g(U, {
657
+ text: E || "",
658
+ annotations: w || [],
659
+ comment: T || "",
660
+ predefinedAnnotations: v || [],
663
661
  onChange: n,
664
- onCommentChange: this.changeSessionComment,
665
- width: T,
666
- height: E,
667
- maxHeight: D,
668
- disabled: c,
669
- disabledMath: !f,
670
- customKeys: a,
671
- keypadMode: l
672
- }) : /* @__PURE__ */ _(le, {
662
+ onCommentChange: r,
663
+ width: D,
664
+ height: O,
665
+ maxHeight: k,
666
+ disabled: u,
667
+ disabledMath: !m,
668
+ customKeys: s,
669
+ keypadMode: d
670
+ }) : /* @__PURE__ */ g(ce, {
673
671
  className: "response-area-editor",
674
- onChange: this.changeSessionValue,
675
- markup: w || "",
676
- maxWidth: T && T.toString(),
672
+ onChange: i,
673
+ markup: E || "",
674
+ maxWidth: D && D.toString(),
677
675
  minWidth: "100px",
678
- minHeight: E && E.toString(),
679
- maxHeight: D,
680
- disabled: s,
676
+ minHeight: O && O.toString(),
677
+ maxHeight: k,
678
+ disabled: l,
681
679
  highlightShape: !0,
682
- toolbarOpts: O,
683
- spellCheck: b,
680
+ toolbarOpts: A,
681
+ spellCheck: S,
684
682
  charactersLimit: 5e4,
685
683
  autoWidthToolbar: !0,
686
684
  pluginProps: {
687
685
  math: {
688
- disabled: !f,
686
+ disabled: !m,
689
687
  customKeys: this.props.model.customKeys,
690
688
  keypadMode: this.props.model.equationEditor,
691
689
  controlledKeypadMode: !1
@@ -699,17 +697,17 @@ var q = K(l, "UiLayout") || K(Q.UiLayout, "UiLayout"), J = K(p, "PreviewPrompt")
699
697
  ul_list: { disabled: !0 },
700
698
  ol_list: { disabled: !0 }
701
699
  },
702
- languageCharactersProps: A
700
+ languageCharactersProps: M
703
701
  }),
704
- d && /* @__PURE__ */ _(ie, {
702
+ p && /* @__PURE__ */ g(Y, {
705
703
  correctness: "correct",
706
- feedback: d
704
+ feedback: p
707
705
  })
708
706
  ]
709
707
  });
710
708
  }
711
709
  };
712
710
  //#endregion
713
- export { ue as t };
711
+ export { $ as t };
714
712
 
715
- //# sourceMappingURL=main-KQeC5IX0.js.map
713
+ //# sourceMappingURL=main-C6TaNfom.js.map