@pie-element/extended-text-entry 15.1.11 → 15.2.0

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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,19 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [15.2.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/extended-text-entry@15.1.11...@pie-element/extended-text-entry@15.2.0) (2026-08-21)
7
+
8
+ ### Bug Fixes
9
+
10
+ - move [@pie-lib](https://github.com/pie-lib) deps back to latest, off next prereleases PIE-927 ([a53e012](https://github.com/pie-framework/pie-elements/commit/a53e0127eb4ac95ece54e1e2bd669ae4974f4251))
11
+ - read the prompt container by class, not by the id pie-lib removed PIE-927 ([aaaf6c2](https://github.com/pie-framework/pie-elements/commit/aaaf6c2f189de3b39f9de85969aeb2e50376c548))
12
+ - restore demo setup PIE-927 ([c1bf7f3](https://github.com/pie-framework/pie-elements/commit/c1bf7f323f5895cef8ca0d3af9dc76f20805c3da))
13
+ - **theming:** move the grey palette reads onto --pie-\* tokens PIE-856 ([d7d005b](https://github.com/pie-framework/pie-elements/commit/d7d005bf081843335b4b0377852f2ecd075cb62d)), closes [#000000](https://github.com/pie-framework/pie-elements/issues/000000) [#E0E1E6](https://github.com/pie-framework/pie-elements/issues/E0E1E6) [#646464](https://github.com/pie-framework/pie-elements/issues/646464) [#616161](https://github.com/pie-framework/pie-elements/issues/616161) [#E0E1E6](https://github.com/pie-framework/pie-elements/issues/E0E1E6) [#C0C3](https://github.com/pie-framework/pie-elements/issues/C0C3)
14
+
15
+ ### Features
16
+
17
+ - bump libs PIE-856, PIE-681, PIE-927 ([cb26d7a](https://github.com/pie-framework/pie-elements/commit/cb26d7afa6c99522533c321d5ff8ce3148a66e9e))
18
+
6
19
  ## [15.1.11](https://github.com/pie-framework/pie-elements/compare/@pie-element/extended-text-entry@15.1.10...@pie-element/extended-text-entry@15.1.11) (2026-08-19)
7
20
 
8
21
  ### Bug Fixes
@@ -3,6 +3,12 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [13.2.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/extended-text-entry-configure@13.1.11...@pie-element/extended-text-entry-configure@13.2.0) (2026-08-21)
7
+
8
+ ### Features
9
+
10
+ - bump libs PIE-856, PIE-681, PIE-927 ([cb26d7a](https://github.com/pie-framework/pie-elements/commit/cb26d7afa6c99522533c321d5ff8ce3148a66e9e))
11
+
6
12
  ## [13.1.11](https://github.com/pie-framework/pie-elements/compare/@pie-element/extended-text-entry-configure@13.1.10...@pie-element/extended-text-entry-configure@13.1.11) (2026-08-19)
7
13
 
8
14
  ### Bug Fixes
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pie-element/extended-text-entry-configure",
3
3
  "private": true,
4
- "version": "13.1.11",
4
+ "version": "13.2.0",
5
5
  "description": "",
6
6
  "main": "lib/index.js",
7
7
  "module": "src/index.js",
@@ -13,8 +13,8 @@
13
13
  "@mui/icons-material": "^7.3.4",
14
14
  "@mui/material": "^7.3.4",
15
15
  "@pie-framework/pie-configure-events": "^1.3.0",
16
- "@pie-lib/config-ui": "13.0.15",
17
- "@pie-lib/editable-html-tip-tap": "2.1.13",
16
+ "@pie-lib/config-ui": "13.0.16",
17
+ "@pie-lib/editable-html-tip-tap": "2.1.14",
18
18
  "lodash-es": "^4.17.23",
19
19
  "prop-types": "^15.8.1",
20
20
  "react": "18.3.1",
@@ -0,0 +1,170 @@
1
+ # PIE-927 — math prompt repro harness (archived)
2
+
3
+ Reported as **DNAFORM-2099**: `extended-text-entry` prompts showed their raw latex source
4
+ (`P\left(x\right)=-2x^{3}...`) instead of typeset math.
5
+
6
+ This file archives the throwaway demo harness built to reproduce it. The demo itself was reverted to
7
+ its plain single-item form once the fix landed — everything needed to rebuild the harness is below.
8
+
9
+ ## Cause and fix
10
+
11
+ The prompt container was located by a **shared DOM id**. With several items of the same element on
12
+ one page, every item resolved that id to the *first* match, so an item would request math
13
+ typesetting against another item's node — leaving its own prompt untypeset.
14
+
15
+ Fixed in two halves:
16
+
17
+ | Repo | Change |
18
+ | --- | --- |
19
+ | `pie-lib` | `fix(render-ui)!: scope PreviewPrompt to its own node instead of a shared id` — breaking, shipped in `@pie-lib/render-ui@7.0.0` |
20
+ | `pie-elements` | `fix: read the prompt container by class, not by the id pie-lib removed` |
21
+
22
+ ## Why the harness needed several items
23
+
24
+ **A single item on a page typesets fine.** The id collision cannot happen with one item, so a
25
+ one-item demo shows nothing. Any future repro must mount **more than one** item of the same element.
26
+
27
+ The harness mounted 5 items × 6 expressions = **30 tagged prompt expressions**, each prefixed with a
28
+ unique tag (`[3.E2]`) so a mis-rendered one could be named exactly. Two extra tags per item —
29
+ `[n.T1]` in teacher instructions, `[n.F1]` in feedback — need `role=instructor` (with `mode=view` or
30
+ `evaluate`) and `mode=evaluate` respectively to appear at all.
31
+
32
+ ## Expression shapes covered
33
+
34
+ The two forms below both appeared in the reported items and both must render. `E1`'s wrapper holds no
35
+ delimiters and braces its exponents; `E2`'s holds the delimiters and leaves exponents unbraced.
36
+
37
+ | Tag | Shape |
38
+ | --- | --- |
39
+ | `E1` | wrapper without delimiters, braced exponents — `P\left(x\right)=-2x^{3}-4x^{2}+18x+36` |
40
+ | `E2` | wrapper with delimiters, unbraced exponents — `P\left(x\right)=-2x^3-4x^2+18x+36` |
41
+ | `E3` | fraction and radical — `x=\frac{-b\pm\sqrt{b^{2}-4ac}}{2a}` |
42
+ | `E4` | radical, no delimiters — `\sqrt[3]{27x^{6}}=3x^{2}` |
43
+ | `E5` | series with limits — `\sum_{n=1}^{\infty}\frac{1}{n^{2}}=\frac{\pi^{2}}{6}` |
44
+ | `E6` | MathML pasted raw, no `data-latex` wrapper (exercises the other code path) |
45
+ | `T1` | teacher instructions (needs `role=instructor`) |
46
+ | `F1` | feedback (needs `mode=evaluate`) |
47
+
48
+ Two wrapper builders drove `E1`–`E5`:
49
+
50
+ ```js
51
+ // no delimiters inside the wrapper: renderMath() adds them itself, via fixMathElements()
52
+ const bare = (latex) => `<span data-latex="" data-raw="${latex}">${latex}</span>`;
53
+
54
+ // already delimited - the form that shipped in the item that failed to render
55
+ const delimited = (latex) => `<span data-latex="" data-raw="${latex}">\\(${latex}\\)</span>`;
56
+ ```
57
+
58
+ ## Rebuilding it
59
+
60
+ Run with `yarn pie-install` / the usual demo flow from `packages/extended-text-entry`. Restore these
61
+ four files, then remember that `ITEM_COUNT` drives `config.js` and `session.js` **but not**
62
+ `index.html`, which hardcodes its elements — raising the count means adding matching markup there.
63
+
64
+ ### `generate.js`
65
+
66
+ ```js
67
+ const LATEX = {
68
+ polyBraced: 'P\\left(x\\right)=-2x^{3}-4x^{2}+18x+36',
69
+ polyPlain: 'P\\left(x\\right)=-2x^3-4x^2+18x+36',
70
+ quadratic: 'x=\\frac{-b\\pm\\sqrt{b^{2}-4ac}}{2a}',
71
+ radical: '\\sqrt[3]{27x^{6}}=3x^{2}',
72
+ series: '\\sum_{n=1}^{\\infty}\\frac{1}{n^{2}}=\\frac{\\pi^{2}}{6}',
73
+ inequality: '-3\\le x\\le 2',
74
+ };
75
+
76
+ const MATHML =
77
+ '<math xmlns="http://www.w3.org/1998/Math/MathML">' +
78
+ '<mfrac><mrow><mn>3</mn><mi>x</mi></mrow><mn>4</mn></mfrac></math>';
79
+
80
+ const bare = (latex) => `<span data-latex="" data-raw="${latex}">${latex}</span>`;
81
+ const delimited = (latex) => `<span data-latex="" data-raw="${latex}">\\(${latex}\\)</span>`;
82
+ const tag = (label) => `<strong style="color:#b00020;font-family:ui-monospace,Menlo,monospace">[${label}]</strong>`;
83
+ const line = (label, note, markup) => `<div>${tag(label)} ${note}: ${markup}</div>`;
84
+
85
+ const prompt = (item) =>
86
+ [
87
+ `<p>Item ${item}. Every expression below must show as typeset math &mdash; ` +
88
+ 'if any shows its raw latex source instead, report it by its tag.</p>',
89
+ line(`${item}.E1`, 'wrapper without delimiters, braced exponents', bare(LATEX.polyBraced)),
90
+ line(`${item}.E2`, 'wrapper with delimiters, unbraced exponents', delimited(LATEX.polyPlain)),
91
+ line(`${item}.E3`, 'fraction and radical', delimited(LATEX.quadratic)),
92
+ line(`${item}.E4`, 'radical, no delimiters', bare(LATEX.radical)),
93
+ line(`${item}.E5`, 'series with limits', delimited(LATEX.series)),
94
+ line(`${item}.E6`, 'mathml, no data-latex wrapper', MATHML),
95
+ ].join('');
96
+
97
+ exports.model = (id, element) => ({
98
+ id,
99
+ element,
100
+ customKeys: ['\\square'],
101
+ feedback: {
102
+ type: 'custom',
103
+ default: 'this is default feedback',
104
+ custom: line(`${id}.F1`, 'feedback', delimited(LATEX.inequality)),
105
+ },
106
+ feedbackEnabled: true,
107
+ prompt: prompt(id),
108
+ promptEnabled: true,
109
+ teacherInstructions: line(`${id}.T1`, 'teacher instructions', delimited(LATEX.polyPlain)),
110
+ teacherInstructionsEnabled: true,
111
+ mathInput: true,
112
+ playersToolbarPosition: 'bottom',
113
+ toolbarEditorPosition: 'bottom',
114
+ spellCheckEnabled: true,
115
+ rubricEnabled: false,
116
+ annotationsEnabled: false,
117
+ });
118
+
119
+ exports.ITEM_COUNT = 5;
120
+ exports.PROMPT_EXPRESSIONS_PER_ITEM = 6;
121
+ ```
122
+
123
+ ### `config.js`
124
+
125
+ ```js
126
+ const { model, ITEM_COUNT } = require('./generate');
127
+
128
+ const ids = Array.from({ length: ITEM_COUNT }, (_, i) => `${i + 1}`);
129
+
130
+ module.exports = {
131
+ elements: {
132
+ 'extended-text-entry': '../..',
133
+ },
134
+ models: ids.map((id) => model(id, 'extended-text-entry')),
135
+ };
136
+ ```
137
+
138
+ ### `session.js`
139
+
140
+ One session per model — the player needs a session whose `id` matches each model's `id`, so this must
141
+ stay the same length as `config.js`.
142
+
143
+ ```js
144
+ const { ITEM_COUNT } = require('./generate');
145
+
146
+ module.exports = Array.from({ length: ITEM_COUNT }, (_, i) => ({
147
+ id: `${i + 1}`,
148
+ element: 'extended-text-entry',
149
+ }));
150
+ ```
151
+
152
+ ### `index.html`
153
+
154
+ Five `<extended-text-entry>` elements with `pie-id="1"`…`"5"`, each wrapped in a labelled box:
155
+
156
+ ```html
157
+ <div class="body">
158
+ <div class="math-demo-item">
159
+ <h5>item 1 &mdash; 1.E1&ndash;1.E6</h5>
160
+ <extended-text-entry pie-id="1"></extended-text-entry>
161
+ </div>
162
+ <!-- repeat for pie-id 2..5 -->
163
+ </div>
164
+ ```
165
+
166
+ ## Regression check
167
+
168
+ Nothing here is covered by the Jest suite — it needs a real browser to observe typesetting. Rebuild
169
+ this harness and eyeball all 30 tags after any change to prompt rendering or to the math-rendering
170
+ libs (`@pie-lib/render-ui`, `@pie-lib/math-rendering`, `@pie-lib/math-rendering-accessible`).
@@ -10,6 +10,7 @@ var _react = _interopRequireDefault(require("react"));
10
10
  var _propTypes = _interopRequireDefault(require("prop-types"));
11
11
  var _styles = require("@mui/material/styles");
12
12
  var _material = require("@mui/material");
13
+ var _renderUi = require("@pie-lib/render-ui");
13
14
  const StyledPopover = (0, _styles.styled)(_material.Popover)({
14
15
  '& .MuiPaper-root': {
15
16
  overflowX: 'unset',
@@ -24,47 +25,49 @@ const StyledPopover = (0, _styles.styled)(_material.Popover)({
24
25
  width: 0,
25
26
  pointerEvents: 'none',
26
27
  borderWidth: '7px',
27
- borderTopColor: 'black'
28
+ borderTopColor: _renderUi.color.border()
28
29
  }
29
30
  }
30
31
  });
31
- const MainWrapper = (0, _styles.styled)('div')(({
32
- theme
33
- }) => ({
32
+
33
+ /*
34
+ * Surface and stroke move together. Tokenising the border alone would put a scheme's
35
+ * border colour on a fixed white popover -- under white-on-black, `--pie-border` is
36
+ * #ffffff, so the outline would vanish. `--pie-white` inverts with the scheme, which
37
+ * is what `common.white` was standing in for.
38
+ */
39
+ const MainWrapper = (0, _styles.styled)('div')(() => ({
34
40
  width: '300px',
35
41
  overflow: 'hidden',
36
42
  borderRadius: '4px',
37
- backgroundColor: theme.palette.common.white,
38
- border: `2px solid ${theme.palette.grey[100]}`
43
+ backgroundColor: _renderUi.color.white(),
44
+ border: `2px solid ${_renderUi.color.border()}`
39
45
  }));
40
46
  const AnnotationsWrapper = (0, _styles.styled)('div')({
41
47
  display: 'flex',
42
48
  flexWrap: 'wrap'
43
49
  });
44
- const ControlsWrapper = (0, _styles.styled)('div')(({
45
- theme
46
- }) => ({
50
+ const ControlsWrapper = (0, _styles.styled)('div')(() => ({
47
51
  display: 'flex',
48
52
  flexWrap: 'wrap',
49
- borderTop: `2px solid ${theme.palette.grey[100]}`
53
+ borderTop: `2px solid ${_renderUi.color.border()}`
50
54
  }));
51
55
  const Button = (0, _styles.styled)('div')(({
52
- theme,
53
56
  variant
54
57
  }) => ({
55
58
  width: '22%',
56
59
  textAlign: 'center',
57
60
  padding: '4px',
58
61
  cursor: 'pointer',
59
- borderBottom: `1px solid ${theme.palette.grey[100]}`,
62
+ borderBottom: `1px solid ${_renderUi.color.border()}`,
60
63
  '&:not(:nth-child(4n))': {
61
- borderRight: `1px solid ${theme.palette.grey[100]}`
64
+ borderRight: `1px solid ${_renderUi.color.border()}`
62
65
  },
63
66
  '&:nth-child(4n)': {
64
67
  flexGrow: 1
65
68
  },
66
69
  '&:hover': {
67
- backgroundColor: theme.palette.grey[100]
70
+ backgroundColor: _renderUi.color.backgroundDark()
68
71
  },
69
72
  ...(variant === 'positive' && {
70
73
  backgroundColor: 'rgb(153, 255, 153) !important',
@@ -1 +1 @@
1
- {"version":3,"file":"annotation-menu.js","names":["_react","_interopRequireDefault","require","_propTypes","_styles","_material","StyledPopover","styled","Popover","overflowX","overflowY","marginTop","position","left","border","content","height","width","pointerEvents","borderWidth","borderTopColor","MainWrapper","theme","overflow","borderRadius","backgroundColor","palette","common","white","grey","AnnotationsWrapper","display","flexWrap","ControlsWrapper","borderTop","Button","variant","textAlign","padding","cursor","borderBottom","borderRight","flexGrow","filter","AnnotationMenu","React","Component","render","anchorEl","annotations","isNewAnnotation","onAnnotate","onClose","onEdit","onDelete","onWrite","open","props","default","createElement","elevation","transitionDuration","enter","exit","anchorOrigin","vertical","horizontal","transformOrigin","map","annotation","index","key","type","onClick","label","style","Fragment","_defineProperty2","PropTypes","object","bool","array","func","_default","exports"],"sources":["../../src/annotation/annotation-menu.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { styled } from '@mui/material/styles';\nimport { Popover } from '@mui/material';\n\nconst StyledPopover = styled(Popover)({\n '& .MuiPaper-root': {\n overflowX: 'unset',\n overflowY: 'unset',\n marginTop: '-16px',\n '&::after': {\n position: 'absolute',\n left: 'calc(50% - 7px)',\n border: 'solid transparent',\n content: '\"\"',\n height: 0,\n width: 0,\n pointerEvents: 'none',\n borderWidth: '7px',\n borderTopColor: 'black',\n },\n },\n});\n\nconst MainWrapper = styled('div')(({ theme }) => ({\n width: '300px',\n overflow: 'hidden',\n borderRadius: '4px',\n backgroundColor: theme.palette.common.white,\n border: `2px solid ${theme.palette.grey[100]}`,\n}));\n\nconst AnnotationsWrapper = styled('div')({\n display: 'flex',\n flexWrap: 'wrap',\n});\n\nconst ControlsWrapper = styled('div')(({ theme }) => ({\n display: 'flex',\n flexWrap: 'wrap',\n borderTop: `2px solid ${theme.palette.grey[100]}`,\n}));\n\nconst Button = styled('div')(({ theme, variant }) => ({\n width: '22%',\n textAlign: 'center',\n padding: '4px',\n cursor: 'pointer',\n borderBottom: `1px solid ${theme.palette.grey[100]}`,\n '&:not(:nth-child(4n))': {\n borderRight: `1px solid ${theme.palette.grey[100]}`,\n },\n '&:nth-child(4n)': {\n flexGrow: 1,\n },\n '&:hover': {\n backgroundColor: theme.palette.grey[100],\n },\n ...(variant === 'positive' && {\n backgroundColor: 'rgb(153, 255, 153) !important',\n '&:hover': {\n filter: 'brightness(85%)',\n },\n }),\n ...(variant === 'negative' && {\n backgroundColor: 'rgb(255, 204, 238) !important',\n '&:hover': {\n filter: 'brightness(85%)',\n },\n }),\n}));\n\nclass AnnotationMenu extends React.Component {\n static propTypes = {\n anchorEl: PropTypes.object,\n open: PropTypes.bool,\n annotations: PropTypes.array,\n isNewAnnotation: PropTypes.bool,\n onClose: PropTypes.func,\n onDelete: PropTypes.func,\n onEdit: PropTypes.func,\n onWrite: PropTypes.func,\n onAnnotate: PropTypes.func,\n };\n\n render() {\n const { anchorEl, annotations, isNewAnnotation, onAnnotate, onClose, onEdit, onDelete, onWrite, open } =\n this.props;\n\n return (\n <StyledPopover\n anchorEl={anchorEl}\n open={open}\n onClose={onClose}\n elevation={5}\n transitionDuration={{ enter: 225, exit: 195 }}\n anchorOrigin={{\n vertical: 'top',\n horizontal: 'center',\n }}\n transformOrigin={{\n vertical: 'bottom',\n horizontal: 'center',\n }}\n >\n <MainWrapper>\n <AnnotationsWrapper>\n {annotations.map((annotation, index) => (\n <Button\n key={`annotation-${index}`}\n variant={annotation.type}\n onClick={() => onAnnotate(annotation)}\n >\n {annotation.label}\n </Button>\n ))}\n </AnnotationsWrapper>\n <ControlsWrapper>\n <Button onClick={onClose}>\n Cancel\n </Button>\n <Button style={{ pointerEvents: 'none' }} />\n {isNewAnnotation ? (\n <React.Fragment>\n <Button variant=\"positive\" onClick={() => onWrite('positive')}>\n Write\n </Button>\n <Button variant=\"negative\" onClick={() => onWrite('negative')}>\n Write\n </Button>\n </React.Fragment>\n ) : (\n <React.Fragment>\n <Button onClick={onDelete}>\n Delete\n </Button>\n <Button onClick={onEdit}>\n Edit\n </Button>\n </React.Fragment>\n )}\n </ControlsWrapper>\n </MainWrapper>\n </StyledPopover>\n );\n }\n}\n\nexport default AnnotationMenu;\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AAEA,MAAMI,aAAa,GAAG,IAAAC,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AAAC,aAAA,CAAC3D,MAAA,CAAA0D,OAAK,CAACkB,QAAQ,qBACb5E,MAAA,CAAA0D,OAAA,CAAAC,aAAA,CAACxB,MAAM;MAACsC,OAAO,EAAEnB;IAAS,GAAC,QAEnB,CAAC,eACTtD,MAAA,CAAA0D,OAAA,CAAAC,aAAA,CAACxB,MAAM;MAACsC,OAAO,EAAEpB;IAAO,GAAC,MAEjB,CACM,CAEH,CACN,CACA,CAAC;EAEpB;AACF;AAAC,IAAAwB,gBAAA,CAAAnB,OAAA,EA1EKd,cAAc,eACC;EACjBI,QAAQ,EAAE8B,kBAAS,CAACC,MAAM;EAC1BvB,IAAI,EAAEsB,kBAAS,CAACE,IAAI;EACpB/B,WAAW,EAAE6B,kBAAS,CAACG,KAAK;EAC5B/B,eAAe,EAAE4B,kBAAS,CAACE,IAAI;EAC/B5B,OAAO,EAAE0B,kBAAS,CAACI,IAAI;EACvB5B,QAAQ,EAAEwB,kBAAS,CAACI,IAAI;EACxB7B,MAAM,EAAEyB,kBAAS,CAACI,IAAI;EACtB3B,OAAO,EAAEuB,kBAAS,CAACI,IAAI;EACvB/B,UAAU,EAAE2B,kBAAS,CAACI;AACxB,CAAC;AAAA,IAAAC,QAAA,GAAAC,OAAA,CAAA1B,OAAA,GAiEYd,cAAc","ignoreList":[]}
1
+ {"version":3,"file":"annotation-menu.js","names":["_react","_interopRequireDefault","require","_propTypes","_styles","_material","_renderUi","StyledPopover","styled","Popover","overflowX","overflowY","marginTop","position","left","border","content","height","width","pointerEvents","borderWidth","borderTopColor","color","MainWrapper","overflow","borderRadius","backgroundColor","white","AnnotationsWrapper","display","flexWrap","ControlsWrapper","borderTop","Button","variant","textAlign","padding","cursor","borderBottom","borderRight","flexGrow","backgroundDark","filter","AnnotationMenu","React","Component","render","anchorEl","annotations","isNewAnnotation","onAnnotate","onClose","onEdit","onDelete","onWrite","open","props","default","createElement","elevation","transitionDuration","enter","exit","anchorOrigin","vertical","horizontal","transformOrigin","map","annotation","index","key","type","onClick","label","style","Fragment","_defineProperty2","PropTypes","object","bool","array","func","_default","exports"],"sources":["../../src/annotation/annotation-menu.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { styled } from '@mui/material/styles';\nimport { Popover } from '@mui/material';\nimport { color } from '@pie-lib/render-ui';\n\nconst StyledPopover = styled(Popover)({\n '& .MuiPaper-root': {\n overflowX: 'unset',\n overflowY: 'unset',\n marginTop: '-16px',\n '&::after': {\n position: 'absolute',\n left: 'calc(50% - 7px)',\n border: 'solid transparent',\n content: '\"\"',\n height: 0,\n width: 0,\n pointerEvents: 'none',\n borderWidth: '7px',\n borderTopColor: color.border(),\n },\n },\n});\n\n/*\n * Surface and stroke move together. Tokenising the border alone would put a scheme's\n * border colour on a fixed white popover -- under white-on-black, `--pie-border` is\n * #ffffff, so the outline would vanish. `--pie-white` inverts with the scheme, which\n * is what `common.white` was standing in for.\n */\nconst MainWrapper = styled('div')(() => ({\n width: '300px',\n overflow: 'hidden',\n borderRadius: '4px',\n backgroundColor: color.white(),\n border: `2px solid ${color.border()}`,\n}));\n\nconst AnnotationsWrapper = styled('div')({\n display: 'flex',\n flexWrap: 'wrap',\n});\n\nconst ControlsWrapper = styled('div')(() => ({\n display: 'flex',\n flexWrap: 'wrap',\n borderTop: `2px solid ${color.border()}`,\n}));\n\nconst Button = styled('div')(({ variant }) => ({\n width: '22%',\n textAlign: 'center',\n padding: '4px',\n cursor: 'pointer',\n borderBottom: `1px solid ${color.border()}`,\n '&:not(:nth-child(4n))': {\n borderRight: `1px solid ${color.border()}`,\n },\n '&:nth-child(4n)': {\n flexGrow: 1,\n },\n '&:hover': {\n backgroundColor: color.backgroundDark(),\n },\n ...(variant === 'positive' && {\n backgroundColor: 'rgb(153, 255, 153) !important',\n '&:hover': {\n filter: 'brightness(85%)',\n },\n }),\n ...(variant === 'negative' && {\n backgroundColor: 'rgb(255, 204, 238) !important',\n '&:hover': {\n filter: 'brightness(85%)',\n },\n }),\n}));\n\nclass AnnotationMenu extends React.Component {\n static propTypes = {\n anchorEl: PropTypes.object,\n open: PropTypes.bool,\n annotations: PropTypes.array,\n isNewAnnotation: PropTypes.bool,\n onClose: PropTypes.func,\n onDelete: PropTypes.func,\n onEdit: PropTypes.func,\n onWrite: PropTypes.func,\n onAnnotate: PropTypes.func,\n };\n\n render() {\n const { anchorEl, annotations, isNewAnnotation, onAnnotate, onClose, onEdit, onDelete, onWrite, open } =\n this.props;\n\n return (\n <StyledPopover\n anchorEl={anchorEl}\n open={open}\n onClose={onClose}\n elevation={5}\n transitionDuration={{ enter: 225, exit: 195 }}\n anchorOrigin={{\n vertical: 'top',\n horizontal: 'center',\n }}\n transformOrigin={{\n vertical: 'bottom',\n horizontal: 'center',\n }}\n >\n <MainWrapper>\n <AnnotationsWrapper>\n {annotations.map((annotation, index) => (\n <Button\n key={`annotation-${index}`}\n variant={annotation.type}\n onClick={() => onAnnotate(annotation)}\n >\n {annotation.label}\n </Button>\n ))}\n </AnnotationsWrapper>\n <ControlsWrapper>\n <Button onClick={onClose}>\n Cancel\n </Button>\n <Button style={{ pointerEvents: 'none' }} />\n {isNewAnnotation ? (\n <React.Fragment>\n <Button variant=\"positive\" onClick={() => onWrite('positive')}>\n Write\n </Button>\n <Button variant=\"negative\" onClick={() => onWrite('negative')}>\n Write\n </Button>\n </React.Fragment>\n ) : (\n <React.Fragment>\n <Button onClick={onDelete}>\n Delete\n </Button>\n <Button onClick={onEdit}>\n Edit\n </Button>\n </React.Fragment>\n )}\n </ControlsWrapper>\n </MainWrapper>\n </StyledPopover>\n );\n }\n}\n\nexport default AnnotationMenu;\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AAEA,MAAMK,aAAa,GAAG,IAAAC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B,MAAM;MAACuC,OAAO,EAAEnB;IAAS,GAAC,QAEnB,CAAC,eACTrD,MAAA,CAAAyD,OAAA,CAAAC,aAAA,CAACzB,MAAM;MAACuC,OAAO,EAAEpB;IAAO,GAAC,MAEjB,CACM,CAEH,CACN,CACA,CAAC;EAEpB;AACF;AAAC,IAAAwB,gBAAA,CAAAnB,OAAA,EA1EKd,cAAc,eACC;EACjBI,QAAQ,EAAE8B,kBAAS,CAACC,MAAM;EAC1BvB,IAAI,EAAEsB,kBAAS,CAACE,IAAI;EACpB/B,WAAW,EAAE6B,kBAAS,CAACG,KAAK;EAC5B/B,eAAe,EAAE4B,kBAAS,CAACE,IAAI;EAC/B5B,OAAO,EAAE0B,kBAAS,CAACI,IAAI;EACvB5B,QAAQ,EAAEwB,kBAAS,CAACI,IAAI;EACxB7B,MAAM,EAAEyB,kBAAS,CAACI,IAAI;EACtB3B,OAAO,EAAEuB,kBAAS,CAACI,IAAI;EACvB/B,UAAU,EAAE2B,kBAAS,CAACI;AACxB,CAAC;AAAA,IAAAC,QAAA,GAAAC,OAAA,CAAA1B,OAAA,GAiEYd,cAAc","ignoreList":[]}
@@ -10,8 +10,8 @@ var _react = _interopRequireDefault(require("react"));
10
10
  var _propTypes = _interopRequireDefault(require("prop-types"));
11
11
  var _material = require("@mui/material");
12
12
  var _styles = require("@mui/material/styles");
13
+ var _renderUi = require("@pie-lib/render-ui");
13
14
  const StyledPopover = (0, _styles.styled)(_material.Popover)(({
14
- theme,
15
15
  annotationType
16
16
  }) => ({
17
17
  '& .MuiPaper-root': {
@@ -28,7 +28,7 @@ const StyledPopover = (0, _styles.styled)(_material.Popover)(({
28
28
  width: 0,
29
29
  pointerEvents: 'none',
30
30
  borderWidth: '7px',
31
- borderRightColor: theme.palette.grey[100]
31
+ borderRightColor: _renderUi.color.border()
32
32
  },
33
33
  ...(annotationType === 'negative' && {
34
34
  '&::before': {
@@ -42,15 +42,17 @@ const StyledPopover = (0, _styles.styled)(_material.Popover)(({
42
42
  })
43
43
  }
44
44
  }));
45
+
46
+ // See annotation-menu: the popover surface has to follow the scheme alongside its
47
+ // stroke, or a scheme's border colour lands on a permanently white card.
45
48
  const Wrapper = (0, _styles.styled)('div')(({
46
- theme,
47
49
  annotationType
48
50
  }) => ({
49
51
  width: '200px',
50
52
  overflow: 'hidden',
51
53
  borderRadius: '4px',
52
- backgroundColor: '#ffffff',
53
- border: `4px solid ${theme.palette.grey[100]}`,
54
+ backgroundColor: _renderUi.color.white(),
55
+ border: `4px solid ${_renderUi.color.border()}`,
54
56
  ...(annotationType === 'negative' && {
55
57
  borderColor: 'rgb(255, 204, 238) !important'
56
58
  }),
@@ -58,15 +60,12 @@ const Wrapper = (0, _styles.styled)('div')(({
58
60
  borderColor: 'rgb(153, 255, 153) !important'
59
61
  })
60
62
  }));
61
- const Holder = (0, _styles.styled)('div')(({
62
- theme
63
- }) => ({
63
+ const Holder = (0, _styles.styled)('div')(() => ({
64
64
  display: 'flex',
65
65
  flexWrap: 'wrap',
66
- borderTop: `2px solid ${theme.palette.grey[100]}`
66
+ borderTop: `2px solid ${_renderUi.color.border()}`
67
67
  }));
68
68
  const Button = (0, _styles.styled)('div')(({
69
- theme,
70
69
  variant,
71
70
  annotationType
72
71
  }) => ({
@@ -76,10 +75,10 @@ const Button = (0, _styles.styled)('div')(({
76
75
  padding: '4px',
77
76
  cursor: 'pointer',
78
77
  '&:not(:nth-child(3n))': {
79
- borderRight: `1px solid ${theme.palette.grey[100]}`
78
+ borderRight: `1px solid ${_renderUi.color.border()}`
80
79
  },
81
80
  '&:hover': {
82
- backgroundColor: theme.palette.grey[100]
81
+ backgroundColor: _renderUi.color.backgroundDark()
83
82
  },
84
83
  ...(variant === 'positive' && {
85
84
  backgroundColor: 'rgb(153, 255, 153) !important',
@@ -1 +1 @@
1
- {"version":3,"file":"freeform-editor.js","names":["_react","_interopRequireDefault","require","_propTypes","_material","_styles","StyledPopover","styled","Popover","theme","annotationType","overflowX","overflowY","marginLeft","position","right","top","border","content","height","width","pointerEvents","borderWidth","borderRightColor","palette","grey","Wrapper","overflow","borderRadius","backgroundColor","borderColor","Holder","display","flexWrap","borderTop","Button","variant","flexGrow","textAlign","padding","cursor","borderRight","filter","FreeformEditor","React","Component","constructor","props","_defineProperty2","default","event","setState","value","target","oldValue","onSave","onClose","onDelete","state","onTypeChange","UNSAFE_componentWillReceiveProps","nextProps","propsValue","render","anchorEl","offset","open","type","createElement","elevation","handleSave","style","marginTop","transition","transitionDuration","enter","exit","anchorOrigin","vertical","horizontal","transformOrigin","TextField","id","autoFocus","multiline","rows","maxRows","onChange","onValueChange","InputProps","disableUnderline","onClick","handleTypeChange","PropTypes","object","bool","number","string","func","_default","exports"],"sources":["../../src/annotation/freeform-editor.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { Popover, TextField } from '@mui/material';\nimport { styled } from '@mui/material/styles';\n\nconst StyledPopover = styled(Popover)(({ theme, annotationType }) => ({\n '& .MuiPaper-root': {\n overflowX: 'unset',\n overflowY: 'unset',\n marginLeft: '16px',\n '&::before': {\n position: 'absolute',\n right: '100%',\n top: '13px',\n border: 'solid transparent',\n content: '\"\"',\n height: 0,\n width: 0,\n pointerEvents: 'none',\n borderWidth: '7px',\n borderRightColor: theme.palette.grey[100],\n },\n ...(annotationType === 'negative' && {\n '&::before': {\n borderRightColor: 'rgb(255, 204, 238) !important',\n },\n }),\n ...(annotationType === 'positive' && {\n '&::before': {\n borderRightColor: 'rgb(153, 255, 153) !important',\n },\n }),\n },\n}));\n\nconst Wrapper = styled('div')(({ theme, annotationType }) => ({\n width: '200px',\n overflow: 'hidden',\n borderRadius: '4px',\n backgroundColor: '#ffffff',\n border: `4px solid ${theme.palette.grey[100]}`,\n ...(annotationType === 'negative' && {\n borderColor: 'rgb(255, 204, 238) !important',\n }),\n ...(annotationType === 'positive' && {\n borderColor: 'rgb(153, 255, 153) !important',\n }),\n}));\n\nconst Holder = styled('div')(({ theme }) => ({\n display: 'flex',\n flexWrap: 'wrap',\n borderTop: `2px solid ${theme.palette.grey[100]}`,\n}));\n\nconst Button = styled('div')(({ theme, variant, annotationType }) => ({\n flexGrow: 1,\n width: '28%',\n textAlign: 'center',\n padding: '4px',\n cursor: 'pointer',\n '&:not(:nth-child(3n))': {\n borderRight: `1px solid ${theme.palette.grey[100]}`,\n },\n '&:hover': {\n backgroundColor: theme.palette.grey[100],\n },\n ...(variant === 'positive' && {\n backgroundColor: 'rgb(153, 255, 153) !important',\n '&:hover': {\n filter: 'brightness(85%)',\n },\n }),\n ...(variant === 'negative' && {\n backgroundColor: 'rgb(255, 204, 238) !important',\n '&:hover': {\n filter: 'brightness(85%)',\n },\n }),\n ...(variant === 'typeChange' && annotationType === 'negative' && {\n '&:hover': {\n backgroundColor: 'rgb(153, 255, 153) !important',\n },\n }),\n ...(variant === 'typeChange' && annotationType === 'positive' && {\n '&:hover': {\n backgroundColor: 'rgb(255, 204, 238) !important',\n },\n }),\n}));\n\nclass FreeformEditor extends React.Component {\n static propTypes = {\n anchorEl: PropTypes.object,\n open: PropTypes.bool,\n offset: PropTypes.number,\n value: PropTypes.string,\n type: PropTypes.string,\n onClose: PropTypes.func,\n onDelete: PropTypes.func,\n onSave: PropTypes.func,\n onTypeChange: PropTypes.func,\n };\n\n constructor(props) {\n super(props);\n this.state = { value: props.value };\n }\n\n UNSAFE_componentWillReceiveProps(nextProps) {\n const { value } = nextProps;\n const { value: propsValue } = this.props;\n\n if (value !== propsValue) {\n this.setState({ value });\n }\n }\n\n onValueChange = (event) => this.setState({ value: event.target.value });\n\n handleSave = () => {\n const { value: oldValue, onSave, onClose, onDelete } = this.props;\n const { value } = this.state;\n\n if (value === '') {\n onDelete();\n }\n\n if (oldValue !== value) {\n onSave(oldValue, value);\n }\n\n this.setState({ value: '' });\n onClose();\n };\n\n handleTypeChange = () => {\n const { onTypeChange, onDelete } = this.props;\n const { value } = this.state;\n\n if (value === '') {\n onDelete();\n } else {\n onTypeChange(value);\n }\n\n this.setState({ value: '' });\n };\n\n render() {\n const { anchorEl, offset, onDelete, open, type } = this.props;\n const { value } = this.state;\n\n return (\n <StyledPopover\n anchorEl={anchorEl}\n elevation={2}\n open={open}\n onClose={this.handleSave}\n annotationType={type}\n style={{ marginTop: `${offset}px`, transition: 'margin-top 2s ease-out' }}\n transitionDuration={{ enter: 225, exit: 195 }}\n anchorOrigin={{\n vertical: 'top',\n horizontal: 'right',\n }}\n transformOrigin={{\n vertical: 'top',\n horizontal: 'left',\n }}\n >\n <Wrapper annotationType={type}>\n <TextField\n id=\"annotation-editor\"\n style={{\n padding: '2px 5px',\n width: '95%',\n }}\n autoFocus\n multiline\n rows={1}\n maxRows={4}\n value={value}\n onChange={this.onValueChange}\n InputProps={{ disableUnderline: true }}\n />\n <Holder>\n <Button onClick={onDelete}>\n Delete\n </Button>\n <Button variant=\"typeChange\" annotationType={type} onClick={this.handleTypeChange}>\n {type === 'negative' ? 'Green' : 'Pink'}\n </Button>\n <Button onClick={this.handleSave}>\n Save\n </Button>\n </Holder>\n </Wrapper>\n </StyledPopover>\n );\n }\n}\n\nexport default FreeformEditor;\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AAEA,MAAMI,aAAa,GAAG,IAAAC,cAAM,EAACC,iBAAO,CAAC,CAAC,CAAC;EAAEC,KAAK;EAAEC;AAAe,CAAC,MAAM;EACpE,kBAAkB,EAAE;IAClBC,SAAS,EAAE,OAAO;IAClBC,SAAS,EAAE,OAAO;IAClBC,UAAU,EAAE,MAAM;IAClB,WAAW,EAAE;MACXC,QAAQ,EAAE,UAAU;MACpBC,KAAK,EAAE,MAAM;MACbC,GAAG,EAAE,MAAM;MACXC,MAAM,EAAE,mBAAmB;MAC3BC,OAAO,EAAE,IAAI;MACbC,MAAM,EAAE,CAAC;MACTC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,IAAK;MAACwB,OAAO,EAAE,IAAI,CAACC;IAAiB,GAC/EzB,IAAI,KAAK,UAAU,GAAG,OAAO,GAAG,MAC3B,CAAC,eACTnE,MAAA,CAAAiD,OAAA,CAAAmB,aAAA,CAACjC,MAAM;MAACwD,OAAO,EAAE,IAAI,CAACrB;IAAW,GAAC,MAE1B,CACF,CACD,CACI,CAAC;EAEpB;AACF;AAAC,IAAAtB,gBAAA,CAAAC,OAAA,EA9GKN,cAAc,eACC;EACjBqB,QAAQ,EAAE6B,kBAAS,CAACC,MAAM;EAC1B5B,IAAI,EAAE2B,kBAAS,CAACE,IAAI;EACpB9B,MAAM,EAAE4B,kBAAS,CAACG,MAAM;EACxB5C,KAAK,EAAEyC,kBAAS,CAACI,MAAM;EACvB9B,IAAI,EAAE0B,kBAAS,CAACI,MAAM;EACtBzC,OAAO,EAAEqC,kBAAS,CAACK,IAAI;EACvBzC,QAAQ,EAAEoC,kBAAS,CAACK,IAAI;EACxB3C,MAAM,EAAEsC,kBAAS,CAACK,IAAI;EACtBvC,YAAY,EAAEkC,kBAAS,CAACK;AAC1B,CAAC;AAAA,IAAAC,QAAA,GAAAC,OAAA,CAAAnD,OAAA,GAqGYN,cAAc","ignoreList":[]}
1
+ {"version":3,"file":"freeform-editor.js","names":["_react","_interopRequireDefault","require","_propTypes","_material","_styles","_renderUi","StyledPopover","styled","Popover","annotationType","overflowX","overflowY","marginLeft","position","right","top","border","content","height","width","pointerEvents","borderWidth","borderRightColor","color","Wrapper","overflow","borderRadius","backgroundColor","white","borderColor","Holder","display","flexWrap","borderTop","Button","variant","flexGrow","textAlign","padding","cursor","borderRight","backgroundDark","filter","FreeformEditor","React","Component","constructor","props","_defineProperty2","default","event","setState","value","target","oldValue","onSave","onClose","onDelete","state","onTypeChange","UNSAFE_componentWillReceiveProps","nextProps","propsValue","render","anchorEl","offset","open","type","createElement","elevation","handleSave","style","marginTop","transition","transitionDuration","enter","exit","anchorOrigin","vertical","horizontal","transformOrigin","TextField","id","autoFocus","multiline","rows","maxRows","onChange","onValueChange","InputProps","disableUnderline","onClick","handleTypeChange","PropTypes","object","bool","number","string","func","_default","exports"],"sources":["../../src/annotation/freeform-editor.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { Popover, TextField } from '@mui/material';\nimport { styled } from '@mui/material/styles';\nimport { color } from '@pie-lib/render-ui';\n\nconst StyledPopover = styled(Popover)(({ annotationType }) => ({\n '& .MuiPaper-root': {\n overflowX: 'unset',\n overflowY: 'unset',\n marginLeft: '16px',\n '&::before': {\n position: 'absolute',\n right: '100%',\n top: '13px',\n border: 'solid transparent',\n content: '\"\"',\n height: 0,\n width: 0,\n pointerEvents: 'none',\n borderWidth: '7px',\n borderRightColor: color.border(),\n },\n ...(annotationType === 'negative' && {\n '&::before': {\n borderRightColor: 'rgb(255, 204, 238) !important',\n },\n }),\n ...(annotationType === 'positive' && {\n '&::before': {\n borderRightColor: 'rgb(153, 255, 153) !important',\n },\n }),\n },\n}));\n\n// See annotation-menu: the popover surface has to follow the scheme alongside its\n// stroke, or a scheme's border colour lands on a permanently white card.\nconst Wrapper = styled('div')(({ annotationType }) => ({\n width: '200px',\n overflow: 'hidden',\n borderRadius: '4px',\n backgroundColor: color.white(),\n border: `4px solid ${color.border()}`,\n ...(annotationType === 'negative' && {\n borderColor: 'rgb(255, 204, 238) !important',\n }),\n ...(annotationType === 'positive' && {\n borderColor: 'rgb(153, 255, 153) !important',\n }),\n}));\n\nconst Holder = styled('div')(() => ({\n display: 'flex',\n flexWrap: 'wrap',\n borderTop: `2px solid ${color.border()}`,\n}));\n\nconst Button = styled('div')(({ variant, annotationType }) => ({\n flexGrow: 1,\n width: '28%',\n textAlign: 'center',\n padding: '4px',\n cursor: 'pointer',\n '&:not(:nth-child(3n))': {\n borderRight: `1px solid ${color.border()}`,\n },\n '&:hover': {\n backgroundColor: color.backgroundDark(),\n },\n ...(variant === 'positive' && {\n backgroundColor: 'rgb(153, 255, 153) !important',\n '&:hover': {\n filter: 'brightness(85%)',\n },\n }),\n ...(variant === 'negative' && {\n backgroundColor: 'rgb(255, 204, 238) !important',\n '&:hover': {\n filter: 'brightness(85%)',\n },\n }),\n ...(variant === 'typeChange' && annotationType === 'negative' && {\n '&:hover': {\n backgroundColor: 'rgb(153, 255, 153) !important',\n },\n }),\n ...(variant === 'typeChange' && annotationType === 'positive' && {\n '&:hover': {\n backgroundColor: 'rgb(255, 204, 238) !important',\n },\n }),\n}));\n\nclass FreeformEditor extends React.Component {\n static propTypes = {\n anchorEl: PropTypes.object,\n open: PropTypes.bool,\n offset: PropTypes.number,\n value: PropTypes.string,\n type: PropTypes.string,\n onClose: PropTypes.func,\n onDelete: PropTypes.func,\n onSave: PropTypes.func,\n onTypeChange: PropTypes.func,\n };\n\n constructor(props) {\n super(props);\n this.state = { value: props.value };\n }\n\n UNSAFE_componentWillReceiveProps(nextProps) {\n const { value } = nextProps;\n const { value: propsValue } = this.props;\n\n if (value !== propsValue) {\n this.setState({ value });\n }\n }\n\n onValueChange = (event) => this.setState({ value: event.target.value });\n\n handleSave = () => {\n const { value: oldValue, onSave, onClose, onDelete } = this.props;\n const { value } = this.state;\n\n if (value === '') {\n onDelete();\n }\n\n if (oldValue !== value) {\n onSave(oldValue, value);\n }\n\n this.setState({ value: '' });\n onClose();\n };\n\n handleTypeChange = () => {\n const { onTypeChange, onDelete } = this.props;\n const { value } = this.state;\n\n if (value === '') {\n onDelete();\n } else {\n onTypeChange(value);\n }\n\n this.setState({ value: '' });\n };\n\n render() {\n const { anchorEl, offset, onDelete, open, type } = this.props;\n const { value } = this.state;\n\n return (\n <StyledPopover\n anchorEl={anchorEl}\n elevation={2}\n open={open}\n onClose={this.handleSave}\n annotationType={type}\n style={{ marginTop: `${offset}px`, transition: 'margin-top 2s ease-out' }}\n transitionDuration={{ enter: 225, exit: 195 }}\n anchorOrigin={{\n vertical: 'top',\n horizontal: 'right',\n }}\n transformOrigin={{\n vertical: 'top',\n horizontal: 'left',\n }}\n >\n <Wrapper annotationType={type}>\n <TextField\n id=\"annotation-editor\"\n style={{\n padding: '2px 5px',\n width: '95%',\n }}\n autoFocus\n multiline\n rows={1}\n maxRows={4}\n value={value}\n onChange={this.onValueChange}\n InputProps={{ disableUnderline: true }}\n />\n <Holder>\n <Button onClick={onDelete}>\n Delete\n </Button>\n <Button variant=\"typeChange\" annotationType={type} onClick={this.handleTypeChange}>\n {type === 'negative' ? 'Green' : 'Pink'}\n </Button>\n <Button onClick={this.handleSave}>\n Save\n </Button>\n </Holder>\n </Wrapper>\n </StyledPopover>\n );\n }\n}\n\nexport default FreeformEditor;\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AAEA,MAAMK,aAAa,GAAG,IAAAC,cAAM,EAACC,iBAAO,CAAC,CAAC,CAAC;EAAEC;AAAe,CAAC,MAAM;EAC7D,kBAAkB,EAAE;IAClBC,SAAS,EAAE,OAAO;IAClBC,SAAS,EAAE,OAAO;IAClBC,UAAU,EAAE,MAAM;IAClB,WAAW,EAAE;MACXC,QAAQ,EAAE,UAAU;MACpBC,KAAK,EAAE,MAAM;MACbC,GAAG,EAAE,MAAM;MACXC,MAAM,EAAE,mBAAmB;MAC3BC,OAAO,EAAE,IAAI;MACbC,MAAM,EAAE,CAAC;MACTC,KAAK,EAAE,CAAC;MACRC,aAAa,EAAE,MAAM;MACrBC,WAAW,EAAE,KAAK;MAClBC,gBAAgB,EAAEC,eAAK,CAACP,MAAM,CAAC;IACjC,CAAC;IACD,IAAIP,cAAc,KAAK,UAAU,IAAI;MACnC,WAAW,EAAE;QACXa,gBAAgB,EAAE;MACpB;IACF,CAAC,CAAC;IACF,IAAIb,cAAc,KAAK,UAAU,IAAI;MACnC,WAAW,EAAE;QAC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ACpB9B,MAAM,EAAE4B,kBAAS,CAACG,MAAM;EACxB5C,KAAK,EAAEyC,kBAAS,CAACI,MAAM;EACvB9B,IAAI,EAAE0B,kBAAS,CAACI,MAAM;EACtBzC,OAAO,EAAEqC,kBAAS,CAACK,IAAI;EACvBzC,QAAQ,EAAEoC,kBAAS,CAACK,IAAI;EACxB3C,MAAM,EAAEsC,kBAAS,CAACK,IAAI;EACtBvC,YAAY,EAAEkC,kBAAS,CAACK;AAC1B,CAAC;AAAA,IAAAC,QAAA,GAAAC,OAAA,CAAAnD,OAAA,GAqGYN,cAAc","ignoreList":[]}
@@ -1 +1 @@
1
- import{_dll_react as e,_dll_prop_types as t,_dll_mui__material as n,_dll_mui__material_styles as i,_dll_react_dom_client as a}from"../../../@pie-lib/shared-module@^5.2.14/module/index.js";import{_dll_pie_lib__config_ui as s}from"../../../@pie-lib/config-module@^4.0.19/module/index.js";import{_dll_pie_lib__editable_html_tip_tap as o}from"../../../@pie-lib/editable-html-module@^7.1.16/module/index.js";var l={};Object.defineProperty(l,"__esModule",{value:!0});class r extends CustomEvent{constructor(e,t=!1){super(r.TYPE,{bubbles:!0,detail:{update:e,reset:t}}),this.update=e,this.reset=t}}r.TYPE="model.updated";var d=l.ModelUpdatedEvent=r;class c extends CustomEvent{constructor(e,t){super(c.TYPE,{bubbles:!0,detail:{src:e,done:t}}),this.src=e,this.done=t}}c.TYPE="delete.image";var p=l.DeleteImageEvent=c;class u extends CustomEvent{constructor(e){super(u.TYPE,{bubbles:!0,detail:e}),this.handler=e}}u.TYPE="insert.image";var h=l.InsertImageEvent=u;class g extends CustomEvent{constructor(e,t){super(g.TYPE,{bubbles:!0,detail:{src:e,done:t}}),this.src=e,this.done=t}}g.TYPE="delete.sound";var b=l.DeleteSoundEvent=g;class m extends CustomEvent{constructor(e){super(m.TYPE,{bubbles:!0,detail:e}),this.handler=e}}m.TYPE="insert.sound";var _=l.InsertSoundEvent=m;const E=e,f=t,{Typography:C}=n,{styled:I}=i,{FeedbackSelector:v}=s,{InputContainer:S}=s,{settings:x}=s,{layout:y}=s,k=o,{ALL_PLUGINS:P}=o;function w(e){let t,n=e[0],i=1;for(;i<e.length;){const a=e[i],s=e[i+1];if(i+=2,("optionalAccess"===a||"optionalCall"===a)&&null==n)return;"access"===a||"optionalAccess"===a?(t=n,n=s(n)):"call"!==a&&"optionalCall"!==a||(n=s((...e)=>n.call(t,...e)),t=void 0)}return n}const{Panel:M,toggle:T,numberFields:A,dropdown:D}=x,R={type:"default",default:"Your answer has been submitted"},q=I(C)(({theme:e})=>({paddingBottom:e.spacing(1)})),Y=I(S)(({theme:e})=>({paddingTop:e.spacing(1),marginTop:e.spacing(2),marginBottom:e.spacing(2),width:"100%"})),O=I("div")(({theme:e})=>({fontSize:e.typography.fontSize-2,color:e.palette.error.main,paddingTop:e.spacing(1)}));class j extends E.Component{static __initStatic(){this.propTypes={onModelChanged:f.func.isRequired,onConfigurationChanged:f.func,model:f.object.isRequired,configuration:f.object.isRequired,imageSupport:f.object.isRequired,uploadSoundSupport:f.object.isRequired}}constructor(e){super(e),j.prototype.__init.call(this),j.prototype.__init2.call(this),j.prototype.__init3.call(this),this.state={setDimensions:!0}}__init(){this.onPromptChange=e=>{const{onModelChanged:t,model:n}=this.props;t({...n,prompt:e})}}__init2(){this.changeFeedback=e=>{const{model:t,onModelChanged:n}=this.props;n({...t,feedback:e})}}__init3(){this.changeTeacherInstructions=e=>{const{model:t,onModelChanged:n}=this.props;n({...t,teacherInstructions:e})}}render(){const{model:e,configuration:t,imageSupport:n,onConfigurationChanged:i,onModelChanged:a,uploadSoundSupport:s}=this.props,{annotations:o={},contentDimensions:l={},dimensions:r={},equationEditor:d={},feedback:c={},playerSpellCheck:p={},prompt:u={},settingsPanelDisabled:h,spanishInput:g={},specialInput:b={},spellCheck:m={},studentInstructions:_={},teacherInstructions:f={},mathInput:C={},maxImageWidth:I={},maxImageHeight:S={},multiple:x={},withRubric:j={},mathMlOptions:H={},baseInputConfiguration:F={}}=t||{},{errors:G={},extraCSSRules:W,feedbackEnabled:L,promptEnabled:z,spellCheckEnabled:N,teacherInstructionsEnabled:B,toolbarEditorPosition:U}=e||{},{prompt:J,teacherInstructions:K}=G,Q=I&&I.prompt,V=S&&S.prompt,X={position:"top"===U?"top":"bottom"},Z={mathInput:C.settings&&T(C.label),equationEditor:d.enabled&&e.mathInput&&D(d.label,["non-negative-integers","integers","decimals","fractions","Grade 1 - 2","Grade 3 - 5","Grade 6 - 7","Grade 8 - HS","geometry","advanced-algebra","statistics","item-authoring"]),spanishInput:g.settings&&T(g.label),specialInput:b.settings&&T(b.label),dimensions:r.settings&&A(r.label,{width:{label:"Width (px)",suffix:"px",min:100,max:1200},height:{label:"Height (px)",suffix:"px",min:100,max:500}}),"multiple.enabled":x.settings&&T(x.label,!0),promptEnabled:u.settings&&T(u.label),feedbackEnabled:c.settings&&T(c.label),annotationsEnabled:o.settings&&T(o.label),spellCheckEnabled:m.settings&&T(m.label),playerSpellCheckDisabled:p.settings&&T(p.label)},$={teacherInstructionsEnabled:f.settings&&T(f.label),studentInstructionsEnabled:_.settings&&T(_.label),rubricEnabled:w([j,"optionalAccess",e=>e.settings])&&T(w([j,"optionalAccess",e=>e.label]))},ee=e=>Object.assign({...F},e||{});return E.createElement(y.ConfigLayout,{extraCSSRules:W,dimensions:l,hideSettings:h,settings:E.createElement(M,{model:e,configuration:t,onChangeModel:e=>a(e),onChangeConfiguration:e=>i(e),groups:{Settings:Z,Properties:$}})},B&&E.createElement(Y,{label:f.label},E.createElement(k,{className:"prompt",markup:e.teacherInstructions||"",onChange:this.changeTeacherInstructions,imageSupport:n,nonEmpty:!1,error:K,toolbarOpts:X,spellCheck:N,maxImageWidth:I&&I.teacherInstructions||Q,maxImageHeight:S&&S.teacherInstructions||V,uploadSoundSupport:s,languageCharactersProps:[{language:"spanish"},{language:"special"}],mathMlOptions:H,pluginProps:ee(w([f,"optionalAccess",e=>e.inputConfiguration]))}),K&&E.createElement(O,null,K)),z&&E.createElement(Y,{label:u.label},E.createElement(k,{activePlugins:P,className:"prompt",markup:e.prompt||"",onChange:this.onPromptChange,imageSupport:n,nonEmpty:!1,error:J,toolbarOpts:X,spellCheck:N,maxImageWidth:Q,maxImageHeight:V,uploadSoundSupport:s,languageCharactersProps:[{language:"spanish"},{language:"special"}],mathMlOptions:H,pluginProps:ee(w([u,"optionalAccess",e=>e.inputConfiguration]))}),J&&E.createElement(O,null,J)),L&&E.createElement(E.Fragment,null,E.createElement(q,{variant:"h6"},"Feedback"),E.createElement(v,{label:"When submitted, show",feedback:e.feedback||R,onChange:this.changeFeedback,toolbarOpts:X})))}}j.__initStatic();var H={annotationsEnabled:!1,dimensions:{height:100,width:500},equationEditor:"Grade 8 - HS",feedbackEnabled:!1,mathInput:!1,playerSpellCheckDisabled:!0,predefinedAnnotations:[{label:"good",text:"good",type:"positive"},{label:"★",text:"★",type:"positive"},{label:":-)",text:":-)",type:"positive"},{label:"creative",text:"creative",type:"positive"},{label:"run-on",text:"run-on",type:"negative"},{label:"frag",text:"fragment",type:"negative"},{label:"tran",text:"transition",type:"negative"},{label:"supp",text:"support needed",type:"negative"},{label:"punc",text:"punctuation",type:"negative"},{label:"agr",text:"agreement wrong",type:"negative"},{label:"unclear",text:"unclear",type:"negative"},{label:"cut",text:"cut",type:"negative"},{label:"sp",text:"spelling",type:"negative"},{label:"cap",text:"capitalization",type:"negative"},{label:"inf",text:"informal",type:"negative"},{label:"awk",text:"awkward",type:"negative"}],prompt:"",promptEnabled:!0,rationale:"",rationaleEnabled:!0,spanishInput:!1,specialInput:!1,spellCheckEnabled:!0,studentInstructionsEnabled:!0,teacherInstructions:"",teacherInstructionsEnabled:!0,toolbarEditorPosition:"bottom"},F={annotations:{settings:!1,label:"Annotations"},baseInputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1},h3:{disabled:!0},blockquote:{disabled:!0},textAlign:{disabled:!0},showParagraphs:{disabled:!1},separateParagraphs:{disabled:!0}},dimensions:{settings:!0,label:"Text-Entry Display Size"},spellCheck:{label:"Spellcheck",settings:!1,enabled:!0},playerSpellCheck:{label:"Disable Student Spellcheck",settings:!0,enabled:!0},equationEditor:{settings:!1,label:"Equation Editor",enabled:!0},feedback:{settings:!0,label:"Feedback"},mathInput:{settings:!0,label:"Student response can include math notation",enabled:!1},settingsPanelDisabled:!1,spanishInput:{settings:!0,label:"Students can insert Spanish",enabled:!1},specialInput:{settings:!0,label:"Students can insert Special Characters",enabled:!1},multiple:{settings:!1,label:"Multiple Parts",enabled:!1},studentInstructions:{settings:!1,label:"Student Instructions"},prompt:{settings:!0,label:"Prompt",inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1}},required:!1},teacherInstructions:{settings:!0,label:"Teacher Instructions",inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1}},required:!1},maxImageWidth:{teacherInstructions:300,prompt:300},maxImageHeight:{teacherInstructions:300,prompt:300},withRubric:{settings:!1,label:"Add Rubric"},mathMlOptions:{mmlOutput:!1,mmlEditing:!1}};const G=e,{createRoot:W}=a;function L(e){let t,n=e[0],i=1;for(;i<e.length;){const a=e[i],s=e[i+1];if(i+=2,("optionalAccess"===a||"optionalCall"===a)&&null==n)return;"access"===a||"optionalAccess"===a?(t=n,n=s(n)):"call"!==a&&"optionalCall"!==a||(n=s((...e)=>n.call(t,...e)),t=void 0)}return n}class z extends HTMLElement{static __initStatic(){this.createDefaultModel=(e={},t)=>{const n={...H,...e};return L([t,"optionalAccess",e=>e.withRubric,"optionalAccess",e=>e.forceEnabled])&&!n.rubricEnabled&&(n.rubricEnabled=!0),n}}constructor(){super(),this._root=null,this._configuration=F,L([this,"access",e=>e._configuration,"access",e=>e.withRubric,"optionalAccess",e=>e.forceEnabled])&&(this._configuration.withRubric.settings=!1),this._model=z.createDefaultModel({},this._configuration)}set model(e){this._model=z.createDefaultModel(e,this._configuration),this.render()}set configuration(e){this._configuration={...F,...e};const{withRubric:t={}}=e||{};L([t,"optionalAccess",e=>e.forceEnabled])&&(this._configuration.withRubric.settings=!1,this._model.rubricEnabled||(this._model.rubricEnabled=!0)),this.render()}onModelChanged(e){this._model=e,this.render(),this.dispatchEvent(new d(this._model,!1))}onConfigurationChanged(e){this._configuration={...F,...e},this._model&&this.onModelChanged(this._model),this.render()}insertImage(e){this.dispatchEvent(new h(e))}onDeleteImage(e,t){this.dispatchEvent(new p(e,t))}insertSound(e){this.dispatchEvent(new _(e))}onDeleteSound(e,t){this.dispatchEvent(new b(e,t))}render(){if(this._model){const e=G.createElement(j,{model:this._model,configuration:this._configuration,onModelChanged:this.onModelChanged.bind(this),onConfigurationChanged:this.onConfigurationChanged.bind(this),imageSupport:{add:this.insertImage.bind(this),delete:this.onDeleteImage.bind(this)},uploadSoundSupport:{add:this.insertSound.bind(this),delete:this.onDeleteSound.bind(this)}});this._root||(this._root=W(this)),this._root.render(e)}}connectedCallback(){this.render()}disconnectedCallback(){this._root&&(this._root.unmount(),this._root=null)}}z.__initStatic();export{z as default};
1
+ import{_dll_react as e,_dll_prop_types as t,_dll_mui__material as n,_dll_mui__material_styles as i,_dll_react_dom_client as a}from"../../../@pie-lib/shared-module@6.0.0/module/index.js";import{_dll_pie_lib__config_ui as s}from"../../../@pie-lib/config-module@5.0.0/module/index.js";import{_dll_pie_lib__editable_html_tip_tap as o}from"../../../@pie-lib/editable-html-module@8.0.0/module/index.js";var l={};Object.defineProperty(l,"__esModule",{value:!0});class r extends CustomEvent{constructor(e,t=!1){super(r.TYPE,{bubbles:!0,detail:{update:e,reset:t}}),this.update=e,this.reset=t}}r.TYPE="model.updated";var d=l.ModelUpdatedEvent=r;class c extends CustomEvent{constructor(e,t){super(c.TYPE,{bubbles:!0,detail:{src:e,done:t}}),this.src=e,this.done=t}}c.TYPE="delete.image";var p=l.DeleteImageEvent=c;class u extends CustomEvent{constructor(e){super(u.TYPE,{bubbles:!0,detail:e}),this.handler=e}}u.TYPE="insert.image";var h=l.InsertImageEvent=u;class g extends CustomEvent{constructor(e,t){super(g.TYPE,{bubbles:!0,detail:{src:e,done:t}}),this.src=e,this.done=t}}g.TYPE="delete.sound";var b=l.DeleteSoundEvent=g;class m extends CustomEvent{constructor(e){super(m.TYPE,{bubbles:!0,detail:e}),this.handler=e}}m.TYPE="insert.sound";var _=l.InsertSoundEvent=m;const E=e,f=t,{Typography:C}=n,{styled:I}=i,{FeedbackSelector:v}=s,{InputContainer:S}=s,{settings:x}=s,{layout:y}=s,k=o,{ALL_PLUGINS:P}=o;function w(e){let t,n=e[0],i=1;for(;i<e.length;){const a=e[i],s=e[i+1];if(i+=2,("optionalAccess"===a||"optionalCall"===a)&&null==n)return;"access"===a||"optionalAccess"===a?(t=n,n=s(n)):"call"!==a&&"optionalCall"!==a||(n=s((...e)=>n.call(t,...e)),t=void 0)}return n}const{Panel:M,toggle:T,numberFields:A,dropdown:D}=x,R={type:"default",default:"Your answer has been submitted"},q=I(C)(({theme:e})=>({paddingBottom:e.spacing(1)})),Y=I(S)(({theme:e})=>({paddingTop:e.spacing(1),marginTop:e.spacing(2),marginBottom:e.spacing(2),width:"100%"})),O=I("div")(({theme:e})=>({fontSize:e.typography.fontSize-2,color:e.palette.error.main,paddingTop:e.spacing(1)}));class j extends E.Component{static __initStatic(){this.propTypes={onModelChanged:f.func.isRequired,onConfigurationChanged:f.func,model:f.object.isRequired,configuration:f.object.isRequired,imageSupport:f.object.isRequired,uploadSoundSupport:f.object.isRequired}}constructor(e){super(e),j.prototype.__init.call(this),j.prototype.__init2.call(this),j.prototype.__init3.call(this),this.state={setDimensions:!0}}__init(){this.onPromptChange=e=>{const{onModelChanged:t,model:n}=this.props;t({...n,prompt:e})}}__init2(){this.changeFeedback=e=>{const{model:t,onModelChanged:n}=this.props;n({...t,feedback:e})}}__init3(){this.changeTeacherInstructions=e=>{const{model:t,onModelChanged:n}=this.props;n({...t,teacherInstructions:e})}}render(){const{model:e,configuration:t,imageSupport:n,onConfigurationChanged:i,onModelChanged:a,uploadSoundSupport:s}=this.props,{annotations:o={},contentDimensions:l={},dimensions:r={},equationEditor:d={},feedback:c={},playerSpellCheck:p={},prompt:u={},settingsPanelDisabled:h,spanishInput:g={},specialInput:b={},spellCheck:m={},studentInstructions:_={},teacherInstructions:f={},mathInput:C={},maxImageWidth:I={},maxImageHeight:S={},multiple:x={},withRubric:j={},mathMlOptions:H={},baseInputConfiguration:F={}}=t||{},{errors:G={},extraCSSRules:W,feedbackEnabled:L,promptEnabled:z,spellCheckEnabled:N,teacherInstructionsEnabled:B,toolbarEditorPosition:U}=e||{},{prompt:J,teacherInstructions:K}=G,Q=I&&I.prompt,V=S&&S.prompt,X={position:"top"===U?"top":"bottom"},Z={mathInput:C.settings&&T(C.label),equationEditor:d.enabled&&e.mathInput&&D(d.label,["non-negative-integers","integers","decimals","fractions","Grade 1 - 2","Grade 3 - 5","Grade 6 - 7","Grade 8 - HS","geometry","advanced-algebra","statistics","item-authoring"]),spanishInput:g.settings&&T(g.label),specialInput:b.settings&&T(b.label),dimensions:r.settings&&A(r.label,{width:{label:"Width (px)",suffix:"px",min:100,max:1200},height:{label:"Height (px)",suffix:"px",min:100,max:500}}),"multiple.enabled":x.settings&&T(x.label,!0),promptEnabled:u.settings&&T(u.label),feedbackEnabled:c.settings&&T(c.label),annotationsEnabled:o.settings&&T(o.label),spellCheckEnabled:m.settings&&T(m.label),playerSpellCheckDisabled:p.settings&&T(p.label)},$={teacherInstructionsEnabled:f.settings&&T(f.label),studentInstructionsEnabled:_.settings&&T(_.label),rubricEnabled:w([j,"optionalAccess",e=>e.settings])&&T(w([j,"optionalAccess",e=>e.label]))},ee=e=>Object.assign({...F},e||{});return E.createElement(y.ConfigLayout,{extraCSSRules:W,dimensions:l,hideSettings:h,settings:E.createElement(M,{model:e,configuration:t,onChangeModel:e=>a(e),onChangeConfiguration:e=>i(e),groups:{Settings:Z,Properties:$}})},B&&E.createElement(Y,{label:f.label},E.createElement(k,{className:"prompt",markup:e.teacherInstructions||"",onChange:this.changeTeacherInstructions,imageSupport:n,nonEmpty:!1,error:K,toolbarOpts:X,spellCheck:N,maxImageWidth:I&&I.teacherInstructions||Q,maxImageHeight:S&&S.teacherInstructions||V,uploadSoundSupport:s,languageCharactersProps:[{language:"spanish"},{language:"special"}],mathMlOptions:H,pluginProps:ee(w([f,"optionalAccess",e=>e.inputConfiguration]))}),K&&E.createElement(O,null,K)),z&&E.createElement(Y,{label:u.label},E.createElement(k,{activePlugins:P,className:"prompt",markup:e.prompt||"",onChange:this.onPromptChange,imageSupport:n,nonEmpty:!1,error:J,toolbarOpts:X,spellCheck:N,maxImageWidth:Q,maxImageHeight:V,uploadSoundSupport:s,languageCharactersProps:[{language:"spanish"},{language:"special"}],mathMlOptions:H,pluginProps:ee(w([u,"optionalAccess",e=>e.inputConfiguration]))}),J&&E.createElement(O,null,J)),L&&E.createElement(E.Fragment,null,E.createElement(q,{variant:"h6"},"Feedback"),E.createElement(v,{label:"When submitted, show",feedback:e.feedback||R,onChange:this.changeFeedback,toolbarOpts:X})))}}j.__initStatic();var H={annotationsEnabled:!1,dimensions:{height:100,width:500},equationEditor:"Grade 8 - HS",feedbackEnabled:!1,mathInput:!1,playerSpellCheckDisabled:!0,predefinedAnnotations:[{label:"good",text:"good",type:"positive"},{label:"★",text:"★",type:"positive"},{label:":-)",text:":-)",type:"positive"},{label:"creative",text:"creative",type:"positive"},{label:"run-on",text:"run-on",type:"negative"},{label:"frag",text:"fragment",type:"negative"},{label:"tran",text:"transition",type:"negative"},{label:"supp",text:"support needed",type:"negative"},{label:"punc",text:"punctuation",type:"negative"},{label:"agr",text:"agreement wrong",type:"negative"},{label:"unclear",text:"unclear",type:"negative"},{label:"cut",text:"cut",type:"negative"},{label:"sp",text:"spelling",type:"negative"},{label:"cap",text:"capitalization",type:"negative"},{label:"inf",text:"informal",type:"negative"},{label:"awk",text:"awkward",type:"negative"}],prompt:"",promptEnabled:!0,rationale:"",rationaleEnabled:!0,spanishInput:!1,specialInput:!1,spellCheckEnabled:!0,studentInstructionsEnabled:!0,teacherInstructions:"",teacherInstructionsEnabled:!0,toolbarEditorPosition:"bottom"},F={annotations:{settings:!1,label:"Annotations"},baseInputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1},h3:{disabled:!0},blockquote:{disabled:!0},textAlign:{disabled:!0},showParagraphs:{disabled:!1},separateParagraphs:{disabled:!0}},dimensions:{settings:!0,label:"Text-Entry Display Size"},spellCheck:{label:"Spellcheck",settings:!1,enabled:!0},playerSpellCheck:{label:"Disable Student Spellcheck",settings:!0,enabled:!0},equationEditor:{settings:!1,label:"Equation Editor",enabled:!0},feedback:{settings:!0,label:"Feedback"},mathInput:{settings:!0,label:"Student response can include math notation",enabled:!1},settingsPanelDisabled:!1,spanishInput:{settings:!0,label:"Students can insert Spanish",enabled:!1},specialInput:{settings:!0,label:"Students can insert Special Characters",enabled:!1},multiple:{settings:!1,label:"Multiple Parts",enabled:!1},studentInstructions:{settings:!1,label:"Student Instructions"},prompt:{settings:!0,label:"Prompt",inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1}},required:!1},teacherInstructions:{settings:!0,label:"Teacher Instructions",inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1}},required:!1},maxImageWidth:{teacherInstructions:300,prompt:300},maxImageHeight:{teacherInstructions:300,prompt:300},withRubric:{settings:!1,label:"Add Rubric"},mathMlOptions:{mmlOutput:!1,mmlEditing:!1}};const G=e,{createRoot:W}=a;function L(e){let t,n=e[0],i=1;for(;i<e.length;){const a=e[i],s=e[i+1];if(i+=2,("optionalAccess"===a||"optionalCall"===a)&&null==n)return;"access"===a||"optionalAccess"===a?(t=n,n=s(n)):"call"!==a&&"optionalCall"!==a||(n=s((...e)=>n.call(t,...e)),t=void 0)}return n}class z extends HTMLElement{static __initStatic(){this.createDefaultModel=(e={},t)=>{const n={...H,...e};return L([t,"optionalAccess",e=>e.withRubric,"optionalAccess",e=>e.forceEnabled])&&!n.rubricEnabled&&(n.rubricEnabled=!0),n}}constructor(){super(),this._root=null,this._configuration=F,L([this,"access",e=>e._configuration,"access",e=>e.withRubric,"optionalAccess",e=>e.forceEnabled])&&(this._configuration.withRubric.settings=!1),this._model=z.createDefaultModel({},this._configuration)}set model(e){this._model=z.createDefaultModel(e,this._configuration),this.render()}set configuration(e){this._configuration={...F,...e};const{withRubric:t={}}=e||{};L([t,"optionalAccess",e=>e.forceEnabled])&&(this._configuration.withRubric.settings=!1,this._model.rubricEnabled||(this._model.rubricEnabled=!0)),this.render()}onModelChanged(e){this._model=e,this.render(),this.dispatchEvent(new d(this._model,!1))}onConfigurationChanged(e){this._configuration={...F,...e},this._model&&this.onModelChanged(this._model),this.render()}insertImage(e){this.dispatchEvent(new h(e))}onDeleteImage(e,t){this.dispatchEvent(new p(e,t))}insertSound(e){this.dispatchEvent(new _(e))}onDeleteSound(e,t){this.dispatchEvent(new b(e,t))}render(){if(this._model){const e=G.createElement(j,{model:this._model,configuration:this._configuration,onModelChanged:this.onModelChanged.bind(this),onConfigurationChanged:this.onConfigurationChanged.bind(this),imageSupport:{add:this.insertImage.bind(this),delete:this.onDeleteImage.bind(this)},uploadSoundSupport:{add:this.insertSound.bind(this),delete:this.onDeleteSound.bind(this)}});this._root||(this._root=W(this)),this._root.render(e)}}connectedCallback(){this.render()}disconnectedCallback(){this._root&&(this._root.unmount(),this._root=null)}}z.__initStatic();export{z as default};
package/module/element.js CHANGED
@@ -1 +1 @@
1
- import{_dll_react as e,_dll_prop_types as t,_dll_mui__material as n,_dll_mui__material_styles as o,_dll_debug as i,_dll_pie_lib__render_ui as s,_dll_react_dom_client as a}from"../../../@pie-lib/shared-module@^5.2.14/module/index.js";import{_dll_pie_lib__math_rendering as r}from"../../../@pie-lib/math-rendering-module@^5.1.4/module/index.js";import{_dll_pie_lib__editable_html_tip_tap as l}from"../../../@pie-lib/editable-html-module@^7.1.16/module/index.js";import{_dll_pie_lib__config_ui as d}from"../../../@pie-lib/config-module@^4.0.19/module/index.js";var c="object"==typeof global&&global&&global.Object===Object&&global,p="object"==typeof self&&self&&self.Object===Object&&self,h=c||p||Function("return this")(),u=h.Symbol,m=Object.prototype,g=m.hasOwnProperty,f=m.toString,b=u?u.toStringTag:void 0;var y=Object.prototype.toString;var v=u?u.toStringTag:void 0;function C(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":v&&v in Object(e)?function(e){var t=g.call(e,b),n=e[b];try{e[b]=void 0;var o=!0}catch(e){}var i=f.call(e);return o&&(t?e[b]=n:delete e[b]),i}(e):function(e){return y.call(e)}(e)}var x=/\s/;var _=/^\s+/;function E(e){return e?e.slice(0,function(e){for(var t=e.length;t--&&x.test(e.charAt(t)););return t}(e)+1).replace(_,""):e}function w(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}var S=/^[-+]0x[0-9a-f]+$/i,A=/^0b[01]+$/i,k=/^0o[0-7]+$/i,T=parseInt;function R(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return null!=e&&"object"==typeof e}(e)&&"[object Symbol]"==C(e)}(e))return NaN;if(w(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=w(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=E(e);var n=A.test(e);return n||k.test(e)?T(e.slice(2),n?2:8):S.test(e)?NaN:+e}var M=function(){return h.Date.now()},L=Math.max,P=Math.min;function N(e,t,n){var o,i,s,a,r,l,d=0,c=!1,p=!1,h=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function u(t){var n=o,s=i;return o=i=void 0,d=t,a=e.apply(s,n)}function m(e){var n=e-l;return void 0===l||n>=t||n<0||p&&e-d>=s}function g(){var e=M();if(m(e))return f(e);r=setTimeout(g,function(e){var n=t-(e-l);return p?P(n,s-(e-d)):n}(e))}function f(e){return r=void 0,h&&o?u(e):(o=i=void 0,a)}function b(){var e=M(),n=m(e);if(o=arguments,i=this,l=e,n){if(void 0===r)return function(e){return d=e,r=setTimeout(g,t),c?u(e):a}(l);if(p)return clearTimeout(r),r=setTimeout(g,t),u(l)}return void 0===r&&(r=setTimeout(g,t)),a}return t=R(t)||0,w(n)&&(c=!!n.leading,s=(p="maxWait"in n)?L(R(n.maxWait)||0,t):s,h="trailing"in n?!!n.trailing:h),b.cancel=function(){void 0!==r&&clearTimeout(r),d=0,o=l=i=r=void 0},b.flush=function(){return void 0===r?a:f(M())},b}const I=(e,t,n)=>{const o=n||[],i=o.reduce((e,t)=>e+t.textContent.length,0);let s=!0;if(i>t)return!1;for(e&&(3===e.nodeType&&e.parentNode&&!e.parentNode.hasAttribute("data-ann-id")&&o.push(e),e=e.firstChild);e&&s;)s=I(e,t,o),e=e.nextSibling;return o},D=e=>{const{commonAncestorContainer:t,startContainer:n,endContainer:o,startOffset:i,endOffset:s}=e,a=[];let r=!1,l=!1,d="";const c=e=>{const{nodeValue:t,childNodes:p}=e;e===n&&e===o?(t&&(d+=t.substring(i,s)),r=l=!0):e===n?(t&&(d+=t.substring(i)),r=!0):e===o?(t&&(d+=t.substring(0,s)),l=!0):e&&3===e.nodeType&&e.parentNode&&!e.parentNode.hasAttribute("data-ann-id")&&t&&r&&!l&&(d+=t,a.push(e)),p.forEach(e=>{l||c(e)})};return c(t),[a,d]},j=e=>{const t=document.createElement("SPAN");return e.surroundContents(t),t},O=e=>{if(e.startContainer===e.endContainer)return[j(e)];const[t]=D(e),n=document.createRange();n.selectNodeContents(e.startContainer),n.setStart(e.startContainer,e.startOffset);const o=j(n),i=document.createRange();i.selectNode(e.endContainer),i.setEnd(e.endContainer,e.endOffset);const s=j(i);return[o,...t.map(e=>{const t=document.createElement("SPAN");return e.parentNode.insertBefore(t,e),t.appendChild(e),t}),s]},W=(e,t)=>{(e||[]).forEach(e=>{const t=e.parentNode,n=e.childNodes,o=n.length;if(o>0)for(let i=0;i<o;i++)t.insertBefore(n[0],e);else t.insertBefore(document.createTextNode(e.textContent),e);t.removeChild(e)}),t.normalize()},$=()=>{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()},H=e=>e.length>=20||-1!==e.search(/\n|\r|\r\n/),z=e=>Array.from(document.querySelectorAll(`[data-id='${e}']`)),q=e=>document.querySelector(`[data-ann-id='${e}']`),B=e,F=t,{Popover:K}=n,{TextField:U}=n,{styled:V}=o,Y=V(K)(({theme:e,annotationType:t})=>({"& .MuiPaper-root":{overflowX:"unset",overflowY:"unset",marginLeft:"16px","&::before":{position:"absolute",right:"100%",top:"13px",border:"solid transparent",content:'""',height:0,width:0,pointerEvents:"none",borderWidth:"7px",borderRightColor:e.palette.grey[100]},..."negative"===t&&{"&::before":{borderRightColor:"rgb(255, 204, 238) !important"}},..."positive"===t&&{"&::before":{borderRightColor:"rgb(153, 255, 153) !important"}}}})),G=V("div")(({theme:e,annotationType:t})=>({width:"200px",overflow:"hidden",borderRadius:"4px",backgroundColor:"#ffffff",border:`4px solid ${e.palette.grey[100]}`,..."negative"===t&&{borderColor:"rgb(255, 204, 238) !important"},..."positive"===t&&{borderColor:"rgb(153, 255, 153) !important"}})),X=V("div")(({theme:e})=>({display:"flex",flexWrap:"wrap",borderTop:`2px solid ${e.palette.grey[100]}`})),Q=V("div")(({theme:e,variant:t,annotationType:n})=>({flexGrow:1,width:"28%",textAlign:"center",padding:"4px",cursor:"pointer","&:not(:nth-child(3n))":{borderRight:`1px solid ${e.palette.grey[100]}`},"&:hover":{backgroundColor:e.palette.grey[100]},..."positive"===t&&{backgroundColor:"rgb(153, 255, 153) !important","&:hover":{filter:"brightness(85%)"}},..."negative"===t&&{backgroundColor:"rgb(255, 204, 238) !important","&:hover":{filter:"brightness(85%)"}},..."typeChange"===t&&"negative"===n&&{"&:hover":{backgroundColor:"rgb(153, 255, 153) !important"}},..."typeChange"===t&&"positive"===n&&{"&:hover":{backgroundColor:"rgb(255, 204, 238) !important"}}}));class J extends B.Component{static __initStatic(){this.propTypes={anchorEl:F.object,open:F.bool,offset:F.number,value:F.string,type:F.string,onClose:F.func,onDelete:F.func,onSave:F.func,onTypeChange:F.func}}constructor(e){super(e),J.prototype.__init.call(this),J.prototype.__init2.call(this),J.prototype.__init3.call(this),this.state={value:e.value}}UNSAFE_componentWillReceiveProps(e){const{value:t}=e,{value:n}=this.props;t!==n&&this.setState({value:t})}__init(){this.onValueChange=e=>this.setState({value:e.target.value})}__init2(){this.handleSave=()=>{const{value:e,onSave:t,onClose:n,onDelete:o}=this.props,{value:i}=this.state;""===i&&o(),e!==i&&t(e,i),this.setState({value:""}),n()}}__init3(){this.handleTypeChange=()=>{const{onTypeChange:e,onDelete:t}=this.props,{value:n}=this.state;""===n?t():e(n),this.setState({value:""})}}render(){const{anchorEl:e,offset:t,onDelete:n,open:o,type:i}=this.props,{value:s}=this.state;return B.createElement(Y,{anchorEl:e,elevation:2,open:o,onClose:this.handleSave,annotationType:i,style:{marginTop:`${t}px`,transition:"margin-top 2s ease-out"},transitionDuration:{enter:225,exit:195},anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"left"}},B.createElement(G,{annotationType:i},B.createElement(U,{id:"annotation-editor",style:{padding:"2px 5px",width:"95%"},autoFocus:!0,multiline:!0,rows:1,maxRows:4,value:s,onChange:this.onValueChange,InputProps:{disableUnderline:!0}}),B.createElement(X,null,B.createElement(Q,{onClick:n},"Delete"),B.createElement(Q,{variant:"typeChange",annotationType:i,onClick:this.handleTypeChange},"negative"===i?"Green":"Pink"),B.createElement(Q,{onClick:this.handleSave},"Save"))))}}J.__initStatic();const Z=e,ee=t,{styled:te}=o,{Popover:ne}=n,oe=te(ne)({"& .MuiPaper-root":{overflowX:"unset",overflowY:"unset",marginTop:"-16px","&::after":{position:"absolute",left:"calc(50% - 7px)",border:"solid transparent",content:'""',height:0,width:0,pointerEvents:"none",borderWidth:"7px",borderTopColor:"black"}}}),ie=te("div")(({theme:e})=>({width:"300px",overflow:"hidden",borderRadius:"4px",backgroundColor:e.palette.common.white,border:`2px solid ${e.palette.grey[100]}`})),se=te("div")({display:"flex",flexWrap:"wrap"}),ae=te("div")(({theme:e})=>({display:"flex",flexWrap:"wrap",borderTop:`2px solid ${e.palette.grey[100]}`})),re=te("div")(({theme:e,variant:t})=>({width:"22%",textAlign:"center",padding:"4px",cursor:"pointer",borderBottom:`1px solid ${e.palette.grey[100]}`,"&:not(:nth-child(4n))":{borderRight:`1px solid ${e.palette.grey[100]}`},"&:nth-child(4n)":{flexGrow:1},"&:hover":{backgroundColor:e.palette.grey[100]},..."positive"===t&&{backgroundColor:"rgb(153, 255, 153) !important","&:hover":{filter:"brightness(85%)"}},..."negative"===t&&{backgroundColor:"rgb(255, 204, 238) !important","&:hover":{filter:"brightness(85%)"}}}));class le extends Z.Component{static __initStatic(){this.propTypes={anchorEl:ee.object,open:ee.bool,annotations:ee.array,isNewAnnotation:ee.bool,onClose:ee.func,onDelete:ee.func,onEdit:ee.func,onWrite:ee.func,onAnnotate:ee.func}}render(){const{anchorEl:e,annotations:t,isNewAnnotation:n,onAnnotate:o,onClose:i,onEdit:s,onDelete:a,onWrite:r,open:l}=this.props;return Z.createElement(oe,{anchorEl:e,open:l,onClose:i,elevation:5,transitionDuration:{enter:225,exit:195},anchorOrigin:{vertical:"top",horizontal:"center"},transformOrigin:{vertical:"bottom",horizontal:"center"}},Z.createElement(ie,null,Z.createElement(se,null,t.map((e,t)=>Z.createElement(re,{key:`annotation-${t}`,variant:e.type,onClick:()=>o(e)},e.label))),Z.createElement(ae,null,Z.createElement(re,{onClick:i},"Cancel"),Z.createElement(re,{style:{pointerEvents:"none"}}),n?Z.createElement(Z.Fragment,null,Z.createElement(re,{variant:"positive",onClick:()=>r("positive")},"Write"),Z.createElement(re,{variant:"negative",onClick:()=>r("negative")},"Write")):Z.createElement(Z.Fragment,null,Z.createElement(re,{onClick:a},"Delete"),Z.createElement(re,{onClick:s},"Edit")))))}}le.__initStatic();const de=e,{styled:ce}=o,pe=t,he=l,{InputContainer:ue}=d,me=ce("div")({padding:"10px 120px 10px 16px",backgroundColor:"rgba(0, 0, 0, 0.06)",border:"1px solid #ccc",borderRadius:"4px",overflowY:"scroll",lineHeight:"36px",whiteSpace:"pre-wrap",overflowWrap:"break-word","& p":{margin:0},"& span[data-latex]":{userSelect:"none","-webkit-user-select":"none","-moz-user-select":"none","-ms-user-select":"none"}}),ge=ce("div")({width:"230px"}),fe=ce("div")({position:"relative",overflowX:"hidden",display:"flex"}),be=ce(ue)(({theme:e})=>({paddingTop:e.spacing(2),marginBottom:e.spacing(2),marginTop:e.spacing(2),width:"100%"}));if(!document.getElementById("annotation-editor-styles")){const e=document.createElement("style");e.id="annotation-editor-styles",e.textContent='\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',document.head.appendChild(e)}class ye extends de.Component{static __initStatic(){this.propTypes={text:pe.string,comment:pe.string,annotations:pe.array,predefinedAnnotations:pe.array,onChange:pe.func.isRequired,onCommentChange:pe.func.isRequired,width:pe.number,height:pe.number,maxHeight:pe.string,disabled:pe.bool,disabledMath:pe.bool,customKeys:pe.array,keypadMode:pe.string}}constructor(e){super(e),ye.prototype.__init.call(this),ye.prototype.__init2.call(this),ye.prototype.__init3.call(this),ye.prototype.__init4.call(this),ye.prototype.__init5.call(this),ye.prototype.__init6.call(this),ye.prototype.__init7.call(this),ye.prototype.__init8.call(this),ye.prototype.__init9.call(this),ye.prototype.__init10.call(this),ye.prototype.__init11.call(this),ye.prototype.__init12.call(this),ye.prototype.__init13.call(this),ye.prototype.__init14.call(this),ye.prototype.__init15.call(this),this.state={anchorEl:null,openedMenu:!1,openedEditor:!1,selectedElems:[],labelElem:null,selectionDetails:null,annotation:null,annotationIndex:null}}componentDidMount(){const{annotations:e,text:t}=this.props;t&&e.forEach(e=>{const[t,n]=((e,t,n)=>{const o=I(n,t),i=[];let s=0;return o.forEach(n=>{const o=s+n.textContent.length;[e,t].forEach(e=>{s<=e&&e<o&&i.push({node:n,offset:e-s})}),s=o}),i})(e.start,e.end,this.textRef);if(t&&n){const o=document.createRange();o.setStart(t.node,t.offset),o.setEnd(n.node,n.offset);const i=O(o);this.createDOMAnnotation(i,e)}}),this.textRef&&(this.adjustAnnotationsPosition(),this.textRef.addEventListener("scroll",this.adjustAnnotationsPosition))}__init(){this.adjustAnnotationsPosition=()=>{if(this.textRef&&this.labelsRef){const e=this.textRef.offsetLeft+this.textRef.offsetWidth+8;Array.from(this.labelsRef.children).forEach(t=>{const n=z(t.dataset.annId),o=(n[0].offsetTop?n[0].offsetTop:n[0].offsetParent.offsetTop)-this.textRef.scrollTop-6;t.style.top=`${o}px`,t.style.left=`${e}px`})}}}__init2(){this.handleClick=e=>{const{annotations:t}=this.props,{selectionDetails:n}=this.state;if(n)return;const{id:o,annId:i}=e.target.dataset,s=o||i,a=z(s),r=q(s),l=t.findIndex(e=>e.id===s),d=r.hasAttribute("data-freeform");d&&(r.style.zIndex="10"),this.setState({anchorEl:a[0],openedMenu:!!o||!!i&&!d,openedEditor:!!i&&d,selectedElems:a,labelElem:r,annotationIndex:l,annotation:t[l],selectionDetails:null})}}__init3(){this.handleHover=e=>{const{id:t,annId:n}=e.target.dataset,o=t||n,i=z(o),s=q(o),a=s.hasAttribute("data-freeform");i.forEach(e=>{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)")}),a?(s.style.zIndex="20",s.classList.contains("positive")?(s.style.backgroundColor="rgb(128, 255, 128)",s.style.setProperty("--before-border-color","rgb(153, 255, 153)")):s.classList.contains("negative")&&(s.style.backgroundColor="rgb(255, 179, 230)",s.style.setProperty("--before-border-color","rgb(255, 179, 230)"))):(s.style.zIndex="20",s.classList.contains("positive")?s.style.color="rgb(0, 77, 0)":s.classList.contains("negative")&&(s.style.color="rgb(153, 0, 102)"))}}__init4(){this.handleCancelHover=e=>{const{id:t,annId:n}=e.target.dataset,o=t||n,i=z(o),s=q(o),a=s.hasAttribute("data-freeform");i.forEach(e=>{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)")}),a?(s.style.zIndex="",s.classList.contains("positive")?(s.style.backgroundColor="rgb(153, 255, 153)",s.style.removeProperty("--before-border-color")):s.classList.contains("negative")&&(s.style.backgroundColor="rgb(255, 204, 238)",s.style.removeProperty("--before-border-color"))):(s.style.zIndex="",s.classList.contains("positive")?s.style.color="rgb(0, 128, 0)":s.classList.contains("negative")&&(s.style.color="rgb(204, 0, 136)"))}}__init5(){this.handleClose=e=>{const{selectedElems:t,labelElem:n}=this.state;t.length&&!t[0].hasAttribute("data-id")&&W(t,this.textRef),n&&(n.style.zIndex=""),this.setState({anchorEl:null,openedMenu:!1,openedEditor:!1,selectedElems:[],labelElem:null,selectionDetails:null,annotationIndex:null,annotation:null}),$()}}__init6(){this.handleSelection=e=>{const t=window.getSelection();if(e.detail>2)$();else if(t&&t.rangeCount>0){const e=t.getRangeAt(0),n=e.toString(),o=this.textRef.contains(e.commonAncestorContainer);if(!t.isCollapsed&&""!==n&&o){const t=((e,t)=>{const n=document.createRange();n.setStart(t,0),n.setEnd(e.startContainer,e.startOffset);const[,o]=D(n),[,i]=D(e),s=o.length;return{quote:i,start:s,end:s+i.length}})(e,this.textRef),n=O(e);this.setState({anchorEl:n[0],openedMenu:!0,selectedElems:n,selectionDetails:t})}}}}__init7(){this.deleteAnnotation=()=>{const{annotations:e,onChange:t}=this.props,{selectedElems:n,labelElem:o,annotationIndex:i,annotation:s}=this.state;(H(s.label)?this.labelsRef:n[0]).removeChild(o),W(n,this.textRef),e.splice(i,1),t(e),this.handleClose()}}__init8(){this.createDOMAnnotation=(e,t)=>{const{disabled:n}=this.props,{id:o,label:i,type:s}=t;(e||[]).forEach(e=>{e.dataset.id=o,e.className=`annotation ${s}`,e.style.position="relative",e.style.cursor="pointer","positive"===s?e.style.backgroundColor="rgb(51, 255, 51, 0.5)":"negative"===s&&(e.style.backgroundColor="rgba(255, 102, 204, 0.4)"),e.onclick=!n&&this.handleClick,e.onmouseover=this.handleHover,e.onmouseout=this.handleCancelHover});const a=e&&e[0]||{},r=document.createElement("SPAN");if(r.dataset.annId=o,r.innerHTML=i,r.onclick=!n&&this.handleClick,r.onmouseover=this.handleHover,r.onmouseout=this.handleCancelHover,H(i)){const e=(a.offsetTop?a.offsetTop:a.offsetParent.offsetTop)-this.textRef.scrollTop,t=this.textRef.offsetLeft+this.textRef.offsetWidth+8;r.dataset.freeform=!0,r.className=`sideAnnotation ${s}`,r.style.position="absolute",r.style.padding="4px",r.style.borderRadius="4px",r.style.marginLeft="8px",r.style.width="180px",r.style.whiteSpace="pre-wrap",r.style.wordBreak="break-word",r.style.border="2px solid #ffffff",r.style.fontSize="14px",r.style.fontStyle="normal",r.style.fontWeight="normal",r.style.top=`${e}px`,r.style.left=`${t}px`,"negative"===s?r.style.backgroundColor="rgb(255, 204, 238)":"positive"===s&&(r.style.backgroundColor="rgb(153, 255, 153)"),r.style.setProperty("--before-border-width","7px"),r.style.setProperty("--before-top","5px"),r.style.setProperty("--before-right","100%"),"negative"===s?r.style.setProperty("--before-border-color","rgb(255, 204, 238)"):"positive"===s&&r.style.setProperty("--before-border-color","rgb(153, 255, 153)"),this.labelsRef.appendChild(r)}else r.className=`annotationLabel ${s}`,r.style.backgroundColor="rgb(242, 242, 242)",r.style.padding="2px",r.style.position="absolute",r.style.userSelect="none",r.style.whiteSpace="nowrap",r.style.top="-10px",r.style.left="-2px",r.style.fontSize="12px",r.style.fontStyle="normal",r.style.fontWeight="normal",r.style.lineHeight="6px",r.style.webkitUserSelect="none",r.style.mozUserSelect="none",r.style.msUserSelect="none","positive"===s?r.style.color="rgb(0, 128, 0)":"negative"===s&&(r.style.color="rgb(204, 0, 136)"),a.appendChild(r)}}__init9(){this.createNewAnnotation=(e,t)=>{const{selectedElems:n,selectionDetails:o}=this.state,i={id:[o.start,o.end,(new Date).getTime()].join("-"),label:e,type:t,...o};return this.createDOMAnnotation(n,i),i}}__init10(){this.handleMenuClick=e=>{const{annotations:t,onChange:n}=this.props,{annotation:o,annotationIndex:i}=this.state,{type:s,text:a}=e;if(o){const e={...o,label:a,type:s},{type:n,label:r}=o;this.updateLabel(r,e,s!==n&&n),t.splice(i,1,e)}else{const e=this.createNewAnnotation(a,s);t.push(e)}n(t),this.handleClose()}}__init11(){this.editAnnotation=()=>{this.setState({openedMenu:!1,openedEditor:!0})}}__init12(){this.addAnnotation=e=>{const{annotations:t,onChange:n}=this.props,o=this.createNewAnnotation("",e),i=q(o.id);t.push(o),this.setState({openedMenu:!1,openedEditor:!0,annotationIndex:t.length-1,annotation:o,labelElem:i}),n(t)}}__init13(){this.updateLabel=(e,t,n)=>{const{selectedElems:o,labelElem:i}=this.state,{label:s,type:a}=t;H(s)&&H(e)||!H(s)&&!H(e)?(i.innerHTML=s,n&&(i.classList.remove(n),i.classList.add(a),o.forEach(e=>{e.classList.remove(n),e.classList.add(a)}))):H(s)&&!H(e)?(o[0].removeChild(i),this.createDOMAnnotation(o,t)):!H(s)&&H(e)&&(this.labelsRef.removeChild(i),this.createDOMAnnotation(o,t))}}__init14(){this.changeAnnotationType=e=>{const{annotations:t,onChange:n}=this.props,{annotationIndex:o,selectedElems:i}=this.state,{type:s,label:a}=t[o],r="positive"===s?"negative":"positive",l={...t[o],type:r,label:e};i.forEach(e=>{e.classList.remove(s),e.classList.add(r)}),this.updateLabel(a,l,s),t.splice(o,1,l),n(t),this.handleClose()}}__init15(){this.updateAnnotation=(e,t)=>{const{annotations:n,onChange:o}=this.props,{annotationIndex:i}=this.state,s={...n[i],label:t};this.updateLabel(e,s),n.splice(i,1,s),o(n)}}componentWillUnmount(){this.textRef.removeEventListener("scroll",this.adjustAnnotationsPosition)}render(){const{comment:e,customKeys:t,disabled:n,disabledMath:o,keypadMode:i,height:s,width:a,maxHeight:r,onCommentChange:l,predefinedAnnotations:d,text:c}=this.props,{anchorEl:p,annotation:h,openedMenu:u,openedEditor:m,selectionDetails:g}=this.state,f=p&&(p.offsetTop?p.offsetTop:p.offsetParent.offsetTop),b=this.textRef&&f?f-this.textRef.scrollTop-8:0;return de.createElement("div",null,de.createElement(fe,null,de.createElement(me,{style:{width:a-34,minHeight:s,maxHeight:r},ref:e=>this.textRef=e,onMouseDown:n?()=>{}:$,onMouseUp:n?()=>{}:this.handleSelection,dangerouslySetInnerHTML:{__html:c}}),de.createElement(ge,{ref:e=>this.labelsRef=e})),de.createElement(be,{label:"Comment"},de.createElement(he,{className:"prompt",markup:e||"",onChange:l,width:a&&(a+104).toString(),disabled:n,pluginProps:{math:{disabled:o,customKeys:t,keypadMode:i,controlledKeypadMode:!1},video:{disabled:!0},audio:{disabled:!0},textAlign:{disabled:!0},h3:{disabled:!0}}})),de.createElement(le,{anchorEl:p,open:u&&!n,annotations:d,isNewAnnotation:!!g,onClose:this.handleClose,onDelete:this.deleteAnnotation,onEdit:this.editAnnotation,onWrite:this.addAnnotation,onAnnotate:this.handleMenuClick}),de.createElement(J,{anchorEl:this.textRef,open:m&&!n,offset:b,value:h&&h.label||"",type:h&&h.type,onClose:this.handleClose,onDelete:this.deleteAnnotation,onSave:this.updateAnnotation,onTypeChange:this.changeAnnotationType}))}}ye.__initStatic();const ve=e,Ce=t,xe=i,{Typography:_e}=n,{styled:Ee}=o,{color:we}=s,{Feedback:Se}=s,{Collapsible:Ae}=s,{PreviewPrompt:ke}=s,{UiLayout:Te}=s,Re=l,Me=xe("@pie-ui:extended-text-entry"),Le=Ee(Te)({backgroundColor:we.background(),color:we.text()}),Pe=Ee(_e)(({theme:e})=>({width:"100%",color:we.text(),marginBottom:e.spacing(2),fontSize:"inherit",display:"block"})),Ne=Ee("div")(({theme:e})=>({marginBottom:e.spacing(2)})),Ie=Ee(Re)(({theme:e})=>({marginBottom:e.spacing(2),borderRadius:"4px"})),De=Ee("h2")({position:"absolute",left:"-10000px",top:"auto",width:"1px",height:"1px",overflow:"hidden"});class je extends ve.Component{constructor(...e){super(...e),je.prototype.__init.call(this),je.prototype.__init2.call(this)}static __initStatic(){this.propTypes={onValueChange:Ce.func.isRequired,onAnnotationsChange:Ce.func.isRequired,onCommentChange:Ce.func.isRequired,model:Ce.object,session:Ce.shape({value:Ce.string,annotations:Ce.array,comment:Ce.string}).isRequired}}__init(){this.changeSessionValue=N(this.props.onValueChange,1500)}__init2(){this.changeSessionComment=N(this.props.onCommentChange,1500)}render(){const{model:e,session:t,onAnnotationsChange:n}=this.props,{animationsDisabled:o,annotatorMode:i,customKeys:s,dimensions:a,disabled:r,disabledAnnotator:l,equationEditor:d,extraCSSRules:c,feedback:p,mathInput:h,playersToolbarPosition:u,predefinedAnnotations:m,prompt:g,spanishInput:f,specialInput:b,spellCheckEnabled:y,teacherInstructions:v}=e,{annotations:C,comment:x,value:_}=t,{width:E,height:w}=a||{},S="40vh",A={position:"top"===u?"top":"bottom"};Me("[render] disabled? ",r);const k=ve.createElement(ke,{defaultClassName:"teacher-instructions",prompt:v}),T=[];return f&&T.push({language:"spanish"}),b&&T.push({language:"special"}),ve.createElement(Le,{extraCSSRules:c,ref:e=>{this.containerRef=e}},ve.createElement(De,null,"Constructed Response Question"),v&&ve.createElement(Ne,null,o?k:ve.createElement(Ae,{labels:{hidden:"Show Teacher Instructions",visible:"Hide Teacher Instructions"}},k)),g&&ve.createElement(Pe,{component:"span"},ve.createElement(ke,{defaultClassName:"prompt",prompt:e.prompt})),i?ve.createElement(ye,{text:_||"",annotations:C||[],comment:x||"",predefinedAnnotations:m||[],onChange:n,onCommentChange:this.changeSessionComment,width:E,height:w,maxHeight:S,disabled:l,disabledMath:!h,customKeys:s,keypadMode:d}):ve.createElement(Ie,{className:"response-area-editor",onChange:this.changeSessionValue,markup:_||"",maxWidth:E&&E.toString(),minWidth:"100px",minHeight:w&&w.toString(),maxHeight:S,disabled:r,highlightShape:!0,toolbarOpts:A,spellCheck:y,charactersLimit:5e4,autoWidthToolbar:!0,pluginProps:{math:{disabled:!h,customKeys:this.props.model.customKeys,keypadMode:this.props.model.equationEditor,controlledKeypadMode:!1},video:{disabled:!0},audio:{disabled:!0},table:{disabled:!0},textAlign:{disabled:!0},h3:{disabled:!0},separateParagraphs:{disabled:!1},ul_list:{disabled:!0},ol_list:{disabled:!0}},languageCharactersProps:T}),p&&ve.createElement(Se,{correctness:"correct",feedback:p}))}}je.__initStatic();var Oe={};Object.defineProperty(Oe,"__esModule",{value:!0});class We extends CustomEvent{constructor(e,t,n){super(We.TYPE,{bubbles:!0,composed:!0,detail:{complete:t,component:e,hasModel:n}}),this.component=e,this.complete=t}}We.TYPE="model-set";var $e=Oe.ModelSetEvent=We;class He extends CustomEvent{constructor(e,t){super(He.TYPE,{bubbles:!0,composed:!0,detail:{complete:t,component:e}}),this.component=e,this.complete=t}}He.TYPE="session-changed";var ze=Oe.SessionChangedEvent=He;const qe=e,{createRoot:Be}=a,Fe=i,{renderMath:Ke}=r,Ue=Fe("@pie-elements:extended-text-entry"),Ve=void 0!==typeof window?new DOMParser:{parseFromString:e=>e};function Ye(e){if("string"==typeof e)try{const t=Ve.parseFromString(e,"text/html");return t.body.textContent}catch(t){return Ue("tried to parse as dom and failed",e),e}}function Ge(e){const t=Ye(e);return void 0!==t&&t.length>0}class Xe extends HTMLElement{constructor(){super(),this._model=null,this._session=null,this._root=null}setLangAttribute(){const e=this._model&&(this._model.language,1)?this._model.language:"",t=e?e.slice(0,2):"en";this.setAttribute("lang",t)}set model(e){this._model=e,this.dispatchEvent(new $e(this.tagName.toLowerCase(),!1,!!this._model)),this.render()}set session(e){this._session=e,this.render()}get session(){return this._session}valueChange(e){this._session.value=e,this.dispatchEvent(new ze(this.tagName.toLowerCase(),Ge(e))),this.render()}annotationsChange(e){this._session.annotations=e,this.dispatchEvent(new ze(this.tagName.toLowerCase(),!0)),this.render()}commentChange(e){this._session.comment=e,this.dispatchEvent(new ze(this.tagName.toLowerCase(),Ge(e))),this.render()}connectedCallback(){this.setAttribute("aria-label","Written Response Question"),this.setAttribute("role","region"),this.render()}render(){if(this._model&&this._session){let e=qe.createElement(je,{model:this._model,session:this._session,onValueChange:this.valueChange.bind(this),onAnnotationsChange:this.annotationsChange.bind(this),onCommentChange:this.commentChange.bind(this)});this.setLangAttribute(),this._root||(this._root=Be(this)),this._root.render(e),queueMicrotask(()=>{Ke(this)})}}disconnectedCallback(){this._root&&(this._root.unmount(),this._root=null)}}export{Xe as default,Ge as isComplete,Ye as textContent};
1
+ import{_dll_react as e,_dll_prop_types as t,_dll_mui__material as n,_dll_mui__material_styles as o,_dll_pie_lib__render_ui as i,_dll_debug as s,_dll_react_dom_client as a}from"../../../@pie-lib/shared-module@6.0.0/module/index.js";import{_dll_pie_lib__math_rendering as r}from"../../../@pie-lib/math-rendering-module@6.0.0/module/index.js";import{_dll_pie_lib__editable_html_tip_tap as l}from"../../../@pie-lib/editable-html-module@8.0.0/module/index.js";import{_dll_pie_lib__config_ui as d}from"../../../@pie-lib/config-module@5.0.0/module/index.js";var c="object"==typeof global&&global&&global.Object===Object&&global,h="object"==typeof self&&self&&self.Object===Object&&self,p=c||h||Function("return this")(),u=p.Symbol,m=Object.prototype,g=m.hasOwnProperty,b=m.toString,f=u?u.toStringTag:void 0;var y=Object.prototype.toString;var v=u?u.toStringTag:void 0;function C(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":v&&v in Object(e)?function(e){var t=g.call(e,f),n=e[f];try{e[f]=void 0;var o=!0}catch(e){}var i=b.call(e);return o&&(t?e[f]=n:delete e[f]),i}(e):function(e){return y.call(e)}(e)}var x=/\s/;var _=/^\s+/;function E(e){return e?e.slice(0,function(e){for(var t=e.length;t--&&x.test(e.charAt(t)););return t}(e)+1).replace(_,""):e}function w(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}var S=/^[-+]0x[0-9a-f]+$/i,k=/^0b[01]+$/i,A=/^0o[0-7]+$/i,T=parseInt;function R(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return null!=e&&"object"==typeof e}(e)&&"[object Symbol]"==C(e)}(e))return NaN;if(w(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=w(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=E(e);var n=k.test(e);return n||A.test(e)?T(e.slice(2),n?2:8):S.test(e)?NaN:+e}var M=function(){return p.Date.now()},L=Math.max,P=Math.min;function N(e,t,n){var o,i,s,a,r,l,d=0,c=!1,h=!1,p=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function u(t){var n=o,s=i;return o=i=void 0,d=t,a=e.apply(s,n)}function m(e){var n=e-l;return void 0===l||n>=t||n<0||h&&e-d>=s}function g(){var e=M();if(m(e))return b(e);r=setTimeout(g,function(e){var n=t-(e-l);return h?P(n,s-(e-d)):n}(e))}function b(e){return r=void 0,p&&o?u(e):(o=i=void 0,a)}function f(){var e=M(),n=m(e);if(o=arguments,i=this,l=e,n){if(void 0===r)return function(e){return d=e,r=setTimeout(g,t),c?u(e):a}(l);if(h)return clearTimeout(r),r=setTimeout(g,t),u(l)}return void 0===r&&(r=setTimeout(g,t)),a}return t=R(t)||0,w(n)&&(c=!!n.leading,s=(h="maxWait"in n)?L(R(n.maxWait)||0,t):s,p="trailing"in n?!!n.trailing:p),f.cancel=function(){void 0!==r&&clearTimeout(r),d=0,o=l=i=r=void 0},f.flush=function(){return void 0===r?a:b(M())},f}const I=(e,t,n)=>{const o=n||[],i=o.reduce((e,t)=>e+t.textContent.length,0);let s=!0;if(i>t)return!1;for(e&&(3===e.nodeType&&e.parentNode&&!e.parentNode.hasAttribute("data-ann-id")&&o.push(e),e=e.firstChild);e&&s;)s=I(e,t,o),e=e.nextSibling;return o},D=e=>{const{commonAncestorContainer:t,startContainer:n,endContainer:o,startOffset:i,endOffset:s}=e,a=[];let r=!1,l=!1,d="";const c=e=>{const{nodeValue:t,childNodes:h}=e;e===n&&e===o?(t&&(d+=t.substring(i,s)),r=l=!0):e===n?(t&&(d+=t.substring(i)),r=!0):e===o?(t&&(d+=t.substring(0,s)),l=!0):e&&3===e.nodeType&&e.parentNode&&!e.parentNode.hasAttribute("data-ann-id")&&t&&r&&!l&&(d+=t,a.push(e)),h.forEach(e=>{l||c(e)})};return c(t),[a,d]},j=e=>{const t=document.createElement("SPAN");return e.surroundContents(t),t},O=e=>{if(e.startContainer===e.endContainer)return[j(e)];const[t]=D(e),n=document.createRange();n.selectNodeContents(e.startContainer),n.setStart(e.startContainer,e.startOffset);const o=j(n),i=document.createRange();i.selectNode(e.endContainer),i.setEnd(e.endContainer,e.endOffset);const s=j(i);return[o,...t.map(e=>{const t=document.createElement("SPAN");return e.parentNode.insertBefore(t,e),t.appendChild(e),t}),s]},W=(e,t)=>{(e||[]).forEach(e=>{const t=e.parentNode,n=e.childNodes,o=n.length;if(o>0)for(let i=0;i<o;i++)t.insertBefore(n[0],e);else t.insertBefore(document.createTextNode(e.textContent),e);t.removeChild(e)}),t.normalize()},$=()=>{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()},H=e=>e.length>=20||-1!==e.search(/\n|\r|\r\n/),z=e=>Array.from(document.querySelectorAll(`[data-id='${e}']`)),q=e=>document.querySelector(`[data-ann-id='${e}']`),B=e,F=t,{Popover:K}=n,{TextField:U}=n,{styled:V}=o,{color:Y}=i,G=V(K)(({annotationType:e})=>({"& .MuiPaper-root":{overflowX:"unset",overflowY:"unset",marginLeft:"16px","&::before":{position:"absolute",right:"100%",top:"13px",border:"solid transparent",content:'""',height:0,width:0,pointerEvents:"none",borderWidth:"7px",borderRightColor:Y.border()},..."negative"===e&&{"&::before":{borderRightColor:"rgb(255, 204, 238) !important"}},..."positive"===e&&{"&::before":{borderRightColor:"rgb(153, 255, 153) !important"}}}})),X=V("div")(({annotationType:e})=>({width:"200px",overflow:"hidden",borderRadius:"4px",backgroundColor:Y.white(),border:`4px solid ${Y.border()}`,..."negative"===e&&{borderColor:"rgb(255, 204, 238) !important"},..."positive"===e&&{borderColor:"rgb(153, 255, 153) !important"}})),Q=V("div")(()=>({display:"flex",flexWrap:"wrap",borderTop:`2px solid ${Y.border()}`})),J=V("div")(({variant:e,annotationType:t})=>({flexGrow:1,width:"28%",textAlign:"center",padding:"4px",cursor:"pointer","&:not(:nth-child(3n))":{borderRight:`1px solid ${Y.border()}`},"&:hover":{backgroundColor:Y.backgroundDark()},..."positive"===e&&{backgroundColor:"rgb(153, 255, 153) !important","&:hover":{filter:"brightness(85%)"}},..."negative"===e&&{backgroundColor:"rgb(255, 204, 238) !important","&:hover":{filter:"brightness(85%)"}},..."typeChange"===e&&"negative"===t&&{"&:hover":{backgroundColor:"rgb(153, 255, 153) !important"}},..."typeChange"===e&&"positive"===t&&{"&:hover":{backgroundColor:"rgb(255, 204, 238) !important"}}}));class Z extends B.Component{static __initStatic(){this.propTypes={anchorEl:F.object,open:F.bool,offset:F.number,value:F.string,type:F.string,onClose:F.func,onDelete:F.func,onSave:F.func,onTypeChange:F.func}}constructor(e){super(e),Z.prototype.__init.call(this),Z.prototype.__init2.call(this),Z.prototype.__init3.call(this),this.state={value:e.value}}UNSAFE_componentWillReceiveProps(e){const{value:t}=e,{value:n}=this.props;t!==n&&this.setState({value:t})}__init(){this.onValueChange=e=>this.setState({value:e.target.value})}__init2(){this.handleSave=()=>{const{value:e,onSave:t,onClose:n,onDelete:o}=this.props,{value:i}=this.state;""===i&&o(),e!==i&&t(e,i),this.setState({value:""}),n()}}__init3(){this.handleTypeChange=()=>{const{onTypeChange:e,onDelete:t}=this.props,{value:n}=this.state;""===n?t():e(n),this.setState({value:""})}}render(){const{anchorEl:e,offset:t,onDelete:n,open:o,type:i}=this.props,{value:s}=this.state;return B.createElement(G,{anchorEl:e,elevation:2,open:o,onClose:this.handleSave,annotationType:i,style:{marginTop:`${t}px`,transition:"margin-top 2s ease-out"},transitionDuration:{enter:225,exit:195},anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"left"}},B.createElement(X,{annotationType:i},B.createElement(U,{id:"annotation-editor",style:{padding:"2px 5px",width:"95%"},autoFocus:!0,multiline:!0,rows:1,maxRows:4,value:s,onChange:this.onValueChange,InputProps:{disableUnderline:!0}}),B.createElement(Q,null,B.createElement(J,{onClick:n},"Delete"),B.createElement(J,{variant:"typeChange",annotationType:i,onClick:this.handleTypeChange},"negative"===i?"Green":"Pink"),B.createElement(J,{onClick:this.handleSave},"Save"))))}}Z.__initStatic();const ee=e,te=t,{styled:ne}=o,{Popover:oe}=n,{color:ie}=i,se=ne(oe)({"& .MuiPaper-root":{overflowX:"unset",overflowY:"unset",marginTop:"-16px","&::after":{position:"absolute",left:"calc(50% - 7px)",border:"solid transparent",content:'""',height:0,width:0,pointerEvents:"none",borderWidth:"7px",borderTopColor:ie.border()}}}),ae=ne("div")(()=>({width:"300px",overflow:"hidden",borderRadius:"4px",backgroundColor:ie.white(),border:`2px solid ${ie.border()}`})),re=ne("div")({display:"flex",flexWrap:"wrap"}),le=ne("div")(()=>({display:"flex",flexWrap:"wrap",borderTop:`2px solid ${ie.border()}`})),de=ne("div")(({variant:e})=>({width:"22%",textAlign:"center",padding:"4px",cursor:"pointer",borderBottom:`1px solid ${ie.border()}`,"&:not(:nth-child(4n))":{borderRight:`1px solid ${ie.border()}`},"&:nth-child(4n)":{flexGrow:1},"&:hover":{backgroundColor:ie.backgroundDark()},..."positive"===e&&{backgroundColor:"rgb(153, 255, 153) !important","&:hover":{filter:"brightness(85%)"}},..."negative"===e&&{backgroundColor:"rgb(255, 204, 238) !important","&:hover":{filter:"brightness(85%)"}}}));class ce extends ee.Component{static __initStatic(){this.propTypes={anchorEl:te.object,open:te.bool,annotations:te.array,isNewAnnotation:te.bool,onClose:te.func,onDelete:te.func,onEdit:te.func,onWrite:te.func,onAnnotate:te.func}}render(){const{anchorEl:e,annotations:t,isNewAnnotation:n,onAnnotate:o,onClose:i,onEdit:s,onDelete:a,onWrite:r,open:l}=this.props;return ee.createElement(se,{anchorEl:e,open:l,onClose:i,elevation:5,transitionDuration:{enter:225,exit:195},anchorOrigin:{vertical:"top",horizontal:"center"},transformOrigin:{vertical:"bottom",horizontal:"center"}},ee.createElement(ae,null,ee.createElement(re,null,t.map((e,t)=>ee.createElement(de,{key:`annotation-${t}`,variant:e.type,onClick:()=>o(e)},e.label))),ee.createElement(le,null,ee.createElement(de,{onClick:i},"Cancel"),ee.createElement(de,{style:{pointerEvents:"none"}}),n?ee.createElement(ee.Fragment,null,ee.createElement(de,{variant:"positive",onClick:()=>r("positive")},"Write"),ee.createElement(de,{variant:"negative",onClick:()=>r("negative")},"Write")):ee.createElement(ee.Fragment,null,ee.createElement(de,{onClick:a},"Delete"),ee.createElement(de,{onClick:s},"Edit")))))}}ce.__initStatic();const he=e,{styled:pe}=o,ue=t,me=l,{InputContainer:ge}=d,be=pe("div")({padding:"10px 120px 10px 16px",backgroundColor:"rgba(0, 0, 0, 0.06)",border:"1px solid #ccc",borderRadius:"4px",overflowY:"scroll",lineHeight:"36px",whiteSpace:"pre-wrap",overflowWrap:"break-word","& p":{margin:0},"& span[data-latex]":{userSelect:"none","-webkit-user-select":"none","-moz-user-select":"none","-ms-user-select":"none"}}),fe=pe("div")({width:"230px"}),ye=pe("div")({position:"relative",overflowX:"hidden",display:"flex"}),ve=pe(ge)(({theme:e})=>({paddingTop:e.spacing(2),marginBottom:e.spacing(2),marginTop:e.spacing(2),width:"100%"}));if(!document.getElementById("annotation-editor-styles")){const e=document.createElement("style");e.id="annotation-editor-styles",e.textContent='\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',document.head.appendChild(e)}class Ce extends he.Component{static __initStatic(){this.propTypes={text:ue.string,comment:ue.string,annotations:ue.array,predefinedAnnotations:ue.array,onChange:ue.func.isRequired,onCommentChange:ue.func.isRequired,width:ue.number,height:ue.number,maxHeight:ue.string,disabled:ue.bool,disabledMath:ue.bool,customKeys:ue.array,keypadMode:ue.string}}constructor(e){super(e),Ce.prototype.__init.call(this),Ce.prototype.__init2.call(this),Ce.prototype.__init3.call(this),Ce.prototype.__init4.call(this),Ce.prototype.__init5.call(this),Ce.prototype.__init6.call(this),Ce.prototype.__init7.call(this),Ce.prototype.__init8.call(this),Ce.prototype.__init9.call(this),Ce.prototype.__init10.call(this),Ce.prototype.__init11.call(this),Ce.prototype.__init12.call(this),Ce.prototype.__init13.call(this),Ce.prototype.__init14.call(this),Ce.prototype.__init15.call(this),this.state={anchorEl:null,openedMenu:!1,openedEditor:!1,selectedElems:[],labelElem:null,selectionDetails:null,annotation:null,annotationIndex:null}}componentDidMount(){const{annotations:e,text:t}=this.props;t&&e.forEach(e=>{const[t,n]=((e,t,n)=>{const o=I(n,t),i=[];let s=0;return o.forEach(n=>{const o=s+n.textContent.length;[e,t].forEach(e=>{s<=e&&e<o&&i.push({node:n,offset:e-s})}),s=o}),i})(e.start,e.end,this.textRef);if(t&&n){const o=document.createRange();o.setStart(t.node,t.offset),o.setEnd(n.node,n.offset);const i=O(o);this.createDOMAnnotation(i,e)}}),this.textRef&&(this.adjustAnnotationsPosition(),this.textRef.addEventListener("scroll",this.adjustAnnotationsPosition))}__init(){this.adjustAnnotationsPosition=()=>{if(this.textRef&&this.labelsRef){const e=this.textRef.offsetLeft+this.textRef.offsetWidth+8;Array.from(this.labelsRef.children).forEach(t=>{const n=z(t.dataset.annId),o=(n[0].offsetTop?n[0].offsetTop:n[0].offsetParent.offsetTop)-this.textRef.scrollTop-6;t.style.top=`${o}px`,t.style.left=`${e}px`})}}}__init2(){this.handleClick=e=>{const{annotations:t}=this.props,{selectionDetails:n}=this.state;if(n)return;const{id:o,annId:i}=e.target.dataset,s=o||i,a=z(s),r=q(s),l=t.findIndex(e=>e.id===s),d=r.hasAttribute("data-freeform");d&&(r.style.zIndex="10"),this.setState({anchorEl:a[0],openedMenu:!!o||!!i&&!d,openedEditor:!!i&&d,selectedElems:a,labelElem:r,annotationIndex:l,annotation:t[l],selectionDetails:null})}}__init3(){this.handleHover=e=>{const{id:t,annId:n}=e.target.dataset,o=t||n,i=z(o),s=q(o),a=s.hasAttribute("data-freeform");i.forEach(e=>{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)")}),a?(s.style.zIndex="20",s.classList.contains("positive")?(s.style.backgroundColor="rgb(128, 255, 128)",s.style.setProperty("--before-border-color","rgb(153, 255, 153)")):s.classList.contains("negative")&&(s.style.backgroundColor="rgb(255, 179, 230)",s.style.setProperty("--before-border-color","rgb(255, 179, 230)"))):(s.style.zIndex="20",s.classList.contains("positive")?s.style.color="rgb(0, 77, 0)":s.classList.contains("negative")&&(s.style.color="rgb(153, 0, 102)"))}}__init4(){this.handleCancelHover=e=>{const{id:t,annId:n}=e.target.dataset,o=t||n,i=z(o),s=q(o),a=s.hasAttribute("data-freeform");i.forEach(e=>{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)")}),a?(s.style.zIndex="",s.classList.contains("positive")?(s.style.backgroundColor="rgb(153, 255, 153)",s.style.removeProperty("--before-border-color")):s.classList.contains("negative")&&(s.style.backgroundColor="rgb(255, 204, 238)",s.style.removeProperty("--before-border-color"))):(s.style.zIndex="",s.classList.contains("positive")?s.style.color="rgb(0, 128, 0)":s.classList.contains("negative")&&(s.style.color="rgb(204, 0, 136)"))}}__init5(){this.handleClose=e=>{const{selectedElems:t,labelElem:n}=this.state;t.length&&!t[0].hasAttribute("data-id")&&W(t,this.textRef),n&&(n.style.zIndex=""),this.setState({anchorEl:null,openedMenu:!1,openedEditor:!1,selectedElems:[],labelElem:null,selectionDetails:null,annotationIndex:null,annotation:null}),$()}}__init6(){this.handleSelection=e=>{const t=window.getSelection();if(e.detail>2)$();else if(t&&t.rangeCount>0){const e=t.getRangeAt(0),n=e.toString(),o=this.textRef.contains(e.commonAncestorContainer);if(!t.isCollapsed&&""!==n&&o){const t=((e,t)=>{const n=document.createRange();n.setStart(t,0),n.setEnd(e.startContainer,e.startOffset);const[,o]=D(n),[,i]=D(e),s=o.length;return{quote:i,start:s,end:s+i.length}})(e,this.textRef),n=O(e);this.setState({anchorEl:n[0],openedMenu:!0,selectedElems:n,selectionDetails:t})}}}}__init7(){this.deleteAnnotation=()=>{const{annotations:e,onChange:t}=this.props,{selectedElems:n,labelElem:o,annotationIndex:i,annotation:s}=this.state;(H(s.label)?this.labelsRef:n[0]).removeChild(o),W(n,this.textRef),e.splice(i,1),t(e),this.handleClose()}}__init8(){this.createDOMAnnotation=(e,t)=>{const{disabled:n}=this.props,{id:o,label:i,type:s}=t;(e||[]).forEach(e=>{e.dataset.id=o,e.className=`annotation ${s}`,e.style.position="relative",e.style.cursor="pointer","positive"===s?e.style.backgroundColor="rgb(51, 255, 51, 0.5)":"negative"===s&&(e.style.backgroundColor="rgba(255, 102, 204, 0.4)"),e.onclick=!n&&this.handleClick,e.onmouseover=this.handleHover,e.onmouseout=this.handleCancelHover});const a=e&&e[0]||{},r=document.createElement("SPAN");if(r.dataset.annId=o,r.innerHTML=i,r.onclick=!n&&this.handleClick,r.onmouseover=this.handleHover,r.onmouseout=this.handleCancelHover,H(i)){const e=(a.offsetTop?a.offsetTop:a.offsetParent.offsetTop)-this.textRef.scrollTop,t=this.textRef.offsetLeft+this.textRef.offsetWidth+8;r.dataset.freeform=!0,r.className=`sideAnnotation ${s}`,r.style.position="absolute",r.style.padding="4px",r.style.borderRadius="4px",r.style.marginLeft="8px",r.style.width="180px",r.style.whiteSpace="pre-wrap",r.style.wordBreak="break-word",r.style.border="2px solid #ffffff",r.style.fontSize="14px",r.style.fontStyle="normal",r.style.fontWeight="normal",r.style.top=`${e}px`,r.style.left=`${t}px`,"negative"===s?r.style.backgroundColor="rgb(255, 204, 238)":"positive"===s&&(r.style.backgroundColor="rgb(153, 255, 153)"),r.style.setProperty("--before-border-width","7px"),r.style.setProperty("--before-top","5px"),r.style.setProperty("--before-right","100%"),"negative"===s?r.style.setProperty("--before-border-color","rgb(255, 204, 238)"):"positive"===s&&r.style.setProperty("--before-border-color","rgb(153, 255, 153)"),this.labelsRef.appendChild(r)}else r.className=`annotationLabel ${s}`,r.style.backgroundColor="rgb(242, 242, 242)",r.style.padding="2px",r.style.position="absolute",r.style.userSelect="none",r.style.whiteSpace="nowrap",r.style.top="-10px",r.style.left="-2px",r.style.fontSize="12px",r.style.fontStyle="normal",r.style.fontWeight="normal",r.style.lineHeight="6px",r.style.webkitUserSelect="none",r.style.mozUserSelect="none",r.style.msUserSelect="none","positive"===s?r.style.color="rgb(0, 128, 0)":"negative"===s&&(r.style.color="rgb(204, 0, 136)"),a.appendChild(r)}}__init9(){this.createNewAnnotation=(e,t)=>{const{selectedElems:n,selectionDetails:o}=this.state,i={id:[o.start,o.end,(new Date).getTime()].join("-"),label:e,type:t,...o};return this.createDOMAnnotation(n,i),i}}__init10(){this.handleMenuClick=e=>{const{annotations:t,onChange:n}=this.props,{annotation:o,annotationIndex:i}=this.state,{type:s,text:a}=e;if(o){const e={...o,label:a,type:s},{type:n,label:r}=o;this.updateLabel(r,e,s!==n&&n),t.splice(i,1,e)}else{const e=this.createNewAnnotation(a,s);t.push(e)}n(t),this.handleClose()}}__init11(){this.editAnnotation=()=>{this.setState({openedMenu:!1,openedEditor:!0})}}__init12(){this.addAnnotation=e=>{const{annotations:t,onChange:n}=this.props,o=this.createNewAnnotation("",e),i=q(o.id);t.push(o),this.setState({openedMenu:!1,openedEditor:!0,annotationIndex:t.length-1,annotation:o,labelElem:i}),n(t)}}__init13(){this.updateLabel=(e,t,n)=>{const{selectedElems:o,labelElem:i}=this.state,{label:s,type:a}=t;H(s)&&H(e)||!H(s)&&!H(e)?(i.innerHTML=s,n&&(i.classList.remove(n),i.classList.add(a),o.forEach(e=>{e.classList.remove(n),e.classList.add(a)}))):H(s)&&!H(e)?(o[0].removeChild(i),this.createDOMAnnotation(o,t)):!H(s)&&H(e)&&(this.labelsRef.removeChild(i),this.createDOMAnnotation(o,t))}}__init14(){this.changeAnnotationType=e=>{const{annotations:t,onChange:n}=this.props,{annotationIndex:o,selectedElems:i}=this.state,{type:s,label:a}=t[o],r="positive"===s?"negative":"positive",l={...t[o],type:r,label:e};i.forEach(e=>{e.classList.remove(s),e.classList.add(r)}),this.updateLabel(a,l,s),t.splice(o,1,l),n(t),this.handleClose()}}__init15(){this.updateAnnotation=(e,t)=>{const{annotations:n,onChange:o}=this.props,{annotationIndex:i}=this.state,s={...n[i],label:t};this.updateLabel(e,s),n.splice(i,1,s),o(n)}}componentWillUnmount(){this.textRef.removeEventListener("scroll",this.adjustAnnotationsPosition)}render(){const{comment:e,customKeys:t,disabled:n,disabledMath:o,keypadMode:i,height:s,width:a,maxHeight:r,onCommentChange:l,predefinedAnnotations:d,text:c}=this.props,{anchorEl:h,annotation:p,openedMenu:u,openedEditor:m,selectionDetails:g}=this.state,b=h&&(h.offsetTop?h.offsetTop:h.offsetParent.offsetTop),f=this.textRef&&b?b-this.textRef.scrollTop-8:0;return he.createElement("div",null,he.createElement(ye,null,he.createElement(be,{style:{width:a-34,minHeight:s,maxHeight:r},ref:e=>this.textRef=e,onMouseDown:n?()=>{}:$,onMouseUp:n?()=>{}:this.handleSelection,dangerouslySetInnerHTML:{__html:c}}),he.createElement(fe,{ref:e=>this.labelsRef=e})),he.createElement(ve,{label:"Comment"},he.createElement(me,{className:"prompt",markup:e||"",onChange:l,width:a&&(a+104).toString(),disabled:n,pluginProps:{math:{disabled:o,customKeys:t,keypadMode:i,controlledKeypadMode:!1},video:{disabled:!0},audio:{disabled:!0},textAlign:{disabled:!0},h3:{disabled:!0}}})),he.createElement(ce,{anchorEl:h,open:u&&!n,annotations:d,isNewAnnotation:!!g,onClose:this.handleClose,onDelete:this.deleteAnnotation,onEdit:this.editAnnotation,onWrite:this.addAnnotation,onAnnotate:this.handleMenuClick}),he.createElement(Z,{anchorEl:this.textRef,open:m&&!n,offset:f,value:p&&p.label||"",type:p&&p.type,onClose:this.handleClose,onDelete:this.deleteAnnotation,onSave:this.updateAnnotation,onTypeChange:this.changeAnnotationType}))}}Ce.__initStatic();const xe=e,_e=t,Ee=s,{Typography:we}=n,{styled:Se}=o,{color:ke}=i,{Feedback:Ae}=i,{Collapsible:Te}=i,{PreviewPrompt:Re}=i,{UiLayout:Me}=i,Le=l,Pe=Ee("@pie-ui:extended-text-entry"),Ne=Se(Me)({backgroundColor:ke.background(),color:ke.text()}),Ie=Se(we)(({theme:e})=>({width:"100%",color:ke.text(),marginBottom:e.spacing(2),fontSize:"inherit",display:"block"})),De=Se("div")(({theme:e})=>({marginBottom:e.spacing(2)})),je=Se(Le)(({theme:e})=>({marginBottom:e.spacing(2),borderRadius:"4px"})),Oe=Se("h2")({position:"absolute",left:"-10000px",top:"auto",width:"1px",height:"1px",overflow:"hidden"});class We extends xe.Component{constructor(...e){super(...e),We.prototype.__init.call(this),We.prototype.__init2.call(this)}static __initStatic(){this.propTypes={onValueChange:_e.func.isRequired,onAnnotationsChange:_e.func.isRequired,onCommentChange:_e.func.isRequired,model:_e.object,session:_e.shape({value:_e.string,annotations:_e.array,comment:_e.string}).isRequired}}__init(){this.changeSessionValue=N(this.props.onValueChange,1500)}__init2(){this.changeSessionComment=N(this.props.onCommentChange,1500)}render(){const{model:e,session:t,onAnnotationsChange:n}=this.props,{animationsDisabled:o,annotatorMode:i,customKeys:s,dimensions:a,disabled:r,disabledAnnotator:l,equationEditor:d,extraCSSRules:c,feedback:h,mathInput:p,playersToolbarPosition:u,predefinedAnnotations:m,prompt:g,spanishInput:b,specialInput:f,spellCheckEnabled:y,teacherInstructions:v}=e,{annotations:C,comment:x,value:_}=t,{width:E,height:w}=a||{},S="40vh",k={position:"top"===u?"top":"bottom"};Pe("[render] disabled? ",r);const A=xe.createElement(Re,{defaultClassName:"teacher-instructions",prompt:v}),T=[];return b&&T.push({language:"spanish"}),f&&T.push({language:"special"}),xe.createElement(Ne,{extraCSSRules:c,ref:e=>{this.containerRef=e}},xe.createElement(Oe,null,"Constructed Response Question"),v&&xe.createElement(De,null,o?A:xe.createElement(Te,{labels:{hidden:"Show Teacher Instructions",visible:"Hide Teacher Instructions"}},A)),g&&xe.createElement(Ie,{component:"span"},xe.createElement(Re,{defaultClassName:"prompt",prompt:e.prompt})),i?xe.createElement(Ce,{text:_||"",annotations:C||[],comment:x||"",predefinedAnnotations:m||[],onChange:n,onCommentChange:this.changeSessionComment,width:E,height:w,maxHeight:S,disabled:l,disabledMath:!p,customKeys:s,keypadMode:d}):xe.createElement(je,{className:"response-area-editor",onChange:this.changeSessionValue,markup:_||"",maxWidth:E&&E.toString(),minWidth:"100px",minHeight:w&&w.toString(),maxHeight:S,disabled:r,highlightShape:!0,toolbarOpts:k,spellCheck:y,charactersLimit:5e4,autoWidthToolbar:!0,pluginProps:{math:{disabled:!p,customKeys:this.props.model.customKeys,keypadMode:this.props.model.equationEditor,controlledKeypadMode:!1},video:{disabled:!0},audio:{disabled:!0},table:{disabled:!0},textAlign:{disabled:!0},h3:{disabled:!0},separateParagraphs:{disabled:!1},ul_list:{disabled:!0},ol_list:{disabled:!0}},languageCharactersProps:T}),h&&xe.createElement(Ae,{correctness:"correct",feedback:h}))}}We.__initStatic();var $e={};Object.defineProperty($e,"__esModule",{value:!0});class He extends CustomEvent{constructor(e,t,n){super(He.TYPE,{bubbles:!0,composed:!0,detail:{complete:t,component:e,hasModel:n}}),this.component=e,this.complete=t}}He.TYPE="model-set";var ze=$e.ModelSetEvent=He;class qe extends CustomEvent{constructor(e,t){super(qe.TYPE,{bubbles:!0,composed:!0,detail:{complete:t,component:e}}),this.component=e,this.complete=t}}qe.TYPE="session-changed";var Be=$e.SessionChangedEvent=qe;const Fe=e,{createRoot:Ke}=a,Ue=s,{renderMath:Ve}=r,Ye=Ue("@pie-elements:extended-text-entry"),Ge=void 0!==typeof window?new DOMParser:{parseFromString:e=>e};function Xe(e){if("string"==typeof e)try{const t=Ge.parseFromString(e,"text/html");return t.body.textContent}catch(t){return Ye("tried to parse as dom and failed",e),e}}function Qe(e){const t=Xe(e);return void 0!==t&&t.length>0}class Je extends HTMLElement{constructor(){super(),this._model=null,this._session=null,this._root=null}setLangAttribute(){const e=this._model&&(this._model.language,1)?this._model.language:"",t=e?e.slice(0,2):"en";this.setAttribute("lang",t)}set model(e){this._model=e,this.dispatchEvent(new ze(this.tagName.toLowerCase(),!1,!!this._model)),this.render()}set session(e){this._session=e,this.render()}get session(){return this._session}valueChange(e){this._session.value=e,this.dispatchEvent(new Be(this.tagName.toLowerCase(),Qe(e))),this.render()}annotationsChange(e){this._session.annotations=e,this.dispatchEvent(new Be(this.tagName.toLowerCase(),!0)),this.render()}commentChange(e){this._session.comment=e,this.dispatchEvent(new Be(this.tagName.toLowerCase(),Qe(e))),this.render()}connectedCallback(){this.setAttribute("aria-label","Written Response Question"),this.setAttribute("role","region"),this.render()}render(){if(this._model&&this._session){let e=Fe.createElement(We,{model:this._model,session:this._session,onValueChange:this.valueChange.bind(this),onAnnotationsChange:this.annotationsChange.bind(this),onCommentChange:this.commentChange.bind(this)});this.setLangAttribute(),this._root||(this._root=Ke(this)),this._root.render(e),queueMicrotask(()=>{Ve(this)})}}disconnectedCallback(){this._root&&(this._root.unmount(),this._root=null)}}export{Je as default,Qe as isComplete,Xe as textContent};
package/module/index.html CHANGED
@@ -2,7 +2,7 @@
2
2
  <!doctype html>
3
3
  <html>
4
4
  <head>
5
- <title>@pie-element/extended-text-entry@15.1.10</title>
5
+ <title>@pie-element/extended-text-entry@15.1.11</title>
6
6
  <script
7
7
  type="module"
8
8
  src="https://cdn.jsdelivr.net/npm/@pslb/demo-el@^1.0.0/dist/demo-el/demo-el.esm.js"></script>
@@ -1,22 +1,22 @@
1
1
  {
2
2
  "name": "@pie-element/extended-text-entry",
3
- "version": "15.1.10",
3
+ "version": "15.1.11",
4
4
  "modules": [
5
5
  {
6
6
  "name": "@pie-lib/shared-module",
7
- "version": "^5.2.14"
7
+ "version": "6.0.0"
8
8
  },
9
9
  {
10
10
  "name": "@pie-lib/math-rendering-module",
11
- "version": "^5.1.4"
11
+ "version": "6.0.0"
12
12
  },
13
13
  {
14
14
  "name": "@pie-lib/editable-html-module",
15
- "version": "^7.1.16"
15
+ "version": "8.0.0"
16
16
  },
17
17
  {
18
18
  "name": "@pie-lib/config-module",
19
- "version": "^4.0.19"
19
+ "version": "5.0.0"
20
20
  }
21
21
  ]
22
22
  }
package/module/print.html CHANGED
@@ -2,7 +2,7 @@
2
2
  <!doctype html>
3
3
  <html>
4
4
  <head>
5
- <title>@pie-element/extended-text-entry@15.1.10</title>
5
+ <title>@pie-element/extended-text-entry@15.1.11</title>
6
6
  <link
7
7
  href="https://fonts.googleapis.com/css?family=Roboto&display=swap"
8
8
  rel="stylesheet"
package/module/print.js CHANGED
@@ -1 +1 @@
1
- import{_dll_react as t,_dll_prop_types as e,_dll_mui__material as n,_dll_mui__material_styles as o,_dll_debug as r,_dll_pie_lib__render_ui as i,_dll_react_dom_client as a}from"../../../@pie-lib/shared-module@^5.2.14/module/index.js";import{_dll_pie_lib__math_rendering as s}from"../../../@pie-lib/math-rendering-module@^5.1.4/module/index.js";import{_dll_pie_lib__editable_html_tip_tap as l}from"../../../@pie-lib/editable-html-module@^7.1.16/module/index.js";import{_dll_pie_lib__config_ui as c}from"../../../@pie-lib/config-module@^4.0.19/module/index.js";var d="object"==typeof global&&global&&global.Object===Object&&global,p="object"==typeof self&&self&&self.Object===Object&&self,u=d||p||Function("return this")(),h=u.Symbol,f=Object.prototype,b=f.hasOwnProperty,y=f.toString,m=h?h.toStringTag:void 0;var g=Object.prototype.toString;var v=h?h.toStringTag:void 0;function _(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":v&&v in Object(t)?function(t){var e=b.call(t,m),n=t[m];try{t[m]=void 0;var o=!0}catch(t){}var r=y.call(t);return o&&(e?t[m]=n:delete t[m]),r}(t):function(t){return g.call(t)}(t)}function x(t){return null!=t&&"object"==typeof t}var C=Array.isArray,j=/\s/;var w=/^\s+/;function E(t){return t?t.slice(0,function(t){for(var e=t.length;e--&&j.test(t.charAt(e)););return e}(t)+1).replace(w,""):t}function A(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}var S=/^[-+]0x[0-9a-f]+$/i,k=/^0b[01]+$/i,O=/^0o[0-7]+$/i,T=parseInt;function R(t){if("number"==typeof t)return t;if(function(t){return"symbol"==typeof t||x(t)&&"[object Symbol]"==_(t)}(t))return NaN;if(A(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=A(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=E(t);var n=k.test(t);return n||O.test(t)?T(t.slice(2),n?2:8):S.test(t)?NaN:+t}function P(t){if(!A(t))return!1;var e=_(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}var I,M=u["__core-js_shared__"],z=(I=/[^.]+$/.exec(M&&M.keys&&M.keys.IE_PROTO||""))?"Symbol(src)_1."+I:"";var D=Function.prototype.toString;function L(t){if(null!=t){try{return D.call(t)}catch(t){}try{return t+""}catch(t){}}return""}var N=/^\[object .+?Constructor\]$/,$=Function.prototype,W=Object.prototype,U=$.toString,F=W.hasOwnProperty,B=RegExp("^"+U.call(F).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function H(t){return!(!A(t)||(e=t,z&&z in e))&&(P(t)?B:N).test(L(t));var e}function q(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return H(n)?n:void 0}var V=q(u,"WeakMap"),K=Object.create,G=function(){function t(){}return function(e){if(!A(e))return{};if(K)return K(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}();var X=function(){try{var t=q(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();var Y=/^(?:0|[1-9]\d*)$/;function Q(t,e){var n=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==n||"symbol"!=n&&Y.test(t))&&t>-1&&t%1==0&&t<e}function J(t,e,n){"__proto__"==e&&X?X(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}function Z(t,e){return t===e||t!=t&&e!=e}var tt=Object.prototype.hasOwnProperty;function et(t,e,n){var o=t[e];tt.call(t,e)&&Z(o,n)&&(void 0!==n||e in t)||J(t,e,n)}function nt(t,e,n,o){var r=!n;n||(n={});for(var i=-1,a=e.length;++i<a;){var s=e[i],l=o?o(n[s],t[s],s,n,t):void 0;void 0===l&&(l=t[s]),r?J(n,s,l):et(n,s,l)}return n}function ot(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}function rt(t){return null!=t&&ot(t.length)&&!P(t)}var it=Object.prototype;function at(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||it)}function st(t){return x(t)&&"[object Arguments]"==_(t)}var lt=Object.prototype,ct=lt.hasOwnProperty,dt=lt.propertyIsEnumerable,pt=st(function(){return arguments}())?st:function(t){return x(t)&&ct.call(t,"callee")&&!dt.call(t,"callee")};var ut="object"==typeof exports&&exports&&!exports.nodeType&&exports,ht=ut&&"object"==typeof module&&module&&!module.nodeType&&module,ft=ht&&ht.exports===ut?u.Buffer:void 0,bt=(ft?ft.isBuffer:void 0)||function(){return!1},yt={};function mt(t){return function(e){return t(e)}}yt["[object Float32Array]"]=yt["[object Float64Array]"]=yt["[object Int8Array]"]=yt["[object Int16Array]"]=yt["[object Int32Array]"]=yt["[object Uint8Array]"]=yt["[object Uint8ClampedArray]"]=yt["[object Uint16Array]"]=yt["[object Uint32Array]"]=!0,yt["[object Arguments]"]=yt["[object Array]"]=yt["[object ArrayBuffer]"]=yt["[object Boolean]"]=yt["[object DataView]"]=yt["[object Date]"]=yt["[object Error]"]=yt["[object Function]"]=yt["[object Map]"]=yt["[object Number]"]=yt["[object Object]"]=yt["[object RegExp]"]=yt["[object Set]"]=yt["[object String]"]=yt["[object WeakMap]"]=!1;var gt="object"==typeof exports&&exports&&!exports.nodeType&&exports,vt=gt&&"object"==typeof module&&module&&!module.nodeType&&module,_t=vt&&vt.exports===gt&&d.process,xt=function(){try{var t=vt&&vt.require&&vt.require("util").types;return t||_t&&_t.binding&&_t.binding("util")}catch(t){}}(),Ct=xt&&xt.isTypedArray,jt=Ct?mt(Ct):function(t){return x(t)&&ot(t.length)&&!!yt[_(t)]},wt=Object.prototype.hasOwnProperty;function Et(t,e){var n=C(t),o=!n&&pt(t),r=!n&&!o&&bt(t),i=!n&&!o&&!r&&jt(t),a=n||o||r||i,s=a?function(t,e){for(var n=-1,o=Array(t);++n<t;)o[n]=e(n);return o}(t.length,String):[],l=s.length;for(var c in t)!e&&!wt.call(t,c)||a&&("length"==c||r&&("offset"==c||"parent"==c)||i&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||Q(c,l))||s.push(c);return s}function At(t,e){return function(n){return t(e(n))}}var St=At(Object.keys,Object),kt=Object.prototype.hasOwnProperty;function Ot(t){return rt(t)?Et(t):function(t){if(!at(t))return St(t);var e=[];for(var n in Object(t))kt.call(t,n)&&"constructor"!=n&&e.push(n);return e}(t)}var Tt=Object.prototype.hasOwnProperty;function Rt(t){if(!A(t))return function(t){var e=[];if(null!=t)for(var n in Object(t))e.push(n);return e}(t);var e=at(t),n=[];for(var o in t)("constructor"!=o||!e&&Tt.call(t,o))&&n.push(o);return n}function Pt(t){return rt(t)?Et(t,!0):Rt(t)}var It=q(Object,"create");var Mt=Object.prototype.hasOwnProperty;var zt=Object.prototype.hasOwnProperty;function Dt(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var o=t[e];this.set(o[0],o[1])}}function Lt(t,e){for(var n=t.length;n--;)if(Z(t[n][0],e))return n;return-1}Dt.prototype.clear=function(){this.__data__=It?It(null):{},this.size=0},Dt.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},Dt.prototype.get=function(t){var e=this.__data__;if(It){var n=e[t];return"__lodash_hash_undefined__"===n?void 0:n}return Mt.call(e,t)?e[t]:void 0},Dt.prototype.has=function(t){var e=this.__data__;return It?void 0!==e[t]:zt.call(e,t)},Dt.prototype.set=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=It&&void 0===e?"__lodash_hash_undefined__":e,this};var Nt=Array.prototype.splice;function $t(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var o=t[e];this.set(o[0],o[1])}}$t.prototype.clear=function(){this.__data__=[],this.size=0},$t.prototype.delete=function(t){var e=this.__data__,n=Lt(e,t);return!(n<0)&&(n==e.length-1?e.pop():Nt.call(e,n,1),--this.size,!0)},$t.prototype.get=function(t){var e=this.__data__,n=Lt(e,t);return n<0?void 0:e[n][1]},$t.prototype.has=function(t){return Lt(this.__data__,t)>-1},$t.prototype.set=function(t,e){var n=this.__data__,o=Lt(n,t);return o<0?(++this.size,n.push([t,e])):n[o][1]=e,this};var Wt=q(u,"Map");function Ut(t,e){var n,o,r=t.__data__;return("string"==(o=typeof(n=e))||"number"==o||"symbol"==o||"boolean"==o?"__proto__"!==n:null===n)?r["string"==typeof e?"string":"hash"]:r.map}function Ft(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var o=t[e];this.set(o[0],o[1])}}function Bt(t,e){for(var n=-1,o=e.length,r=t.length;++n<o;)t[r+n]=e[n];return t}Ft.prototype.clear=function(){this.size=0,this.__data__={hash:new Dt,map:new(Wt||$t),string:new Dt}},Ft.prototype.delete=function(t){var e=Ut(this,t).delete(t);return this.size-=e?1:0,e},Ft.prototype.get=function(t){return Ut(this,t).get(t)},Ft.prototype.has=function(t){return Ut(this,t).has(t)},Ft.prototype.set=function(t,e){var n=Ut(this,t),o=n.size;return n.set(t,e),this.size+=n.size==o?0:1,this};var Ht=At(Object.getPrototypeOf,Object);function qt(t){var e=this.__data__=new $t(t);this.size=e.size}qt.prototype.clear=function(){this.__data__=new $t,this.size=0},qt.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},qt.prototype.get=function(t){return this.__data__.get(t)},qt.prototype.has=function(t){return this.__data__.has(t)},qt.prototype.set=function(t,e){var n=this.__data__;if(n instanceof $t){var o=n.__data__;if(!Wt||o.length<199)return o.push([t,e]),this.size=++n.size,this;n=this.__data__=new Ft(o)}return n.set(t,e),this.size=n.size,this};var Vt="object"==typeof exports&&exports&&!exports.nodeType&&exports,Kt=Vt&&"object"==typeof module&&module&&!module.nodeType&&module,Gt=Kt&&Kt.exports===Vt?u.Buffer:void 0,Xt=Gt?Gt.allocUnsafe:void 0;function Yt(){return[]}var Qt=Object.prototype.propertyIsEnumerable,Jt=Object.getOwnPropertySymbols,Zt=Jt?function(t){return null==t?[]:(t=Object(t),function(t,e){for(var n=-1,o=null==t?0:t.length,r=0,i=[];++n<o;){var a=t[n];e(a,n,t)&&(i[r++]=a)}return i}(Jt(t),function(e){return Qt.call(t,e)}))}:Yt;var te=Object.getOwnPropertySymbols?function(t){for(var e=[];t;)Bt(e,Zt(t)),t=Ht(t);return e}:Yt;function ee(t,e,n){var o=e(t);return C(t)?o:Bt(o,n(t))}function ne(t){return ee(t,Ot,Zt)}function oe(t){return ee(t,Pt,te)}var re=q(u,"DataView"),ie=q(u,"Promise"),ae=q(u,"Set"),se="[object Map]",le="[object Promise]",ce="[object Set]",de="[object WeakMap]",pe="[object DataView]",ue=L(re),he=L(Wt),fe=L(ie),be=L(ae),ye=L(V),me=_;(re&&me(new re(new ArrayBuffer(1)))!=pe||Wt&&me(new Wt)!=se||ie&&me(ie.resolve())!=le||ae&&me(new ae)!=ce||V&&me(new V)!=de)&&(me=function(t){var e=_(t),n="[object Object]"==e?t.constructor:void 0,o=n?L(n):"";if(o)switch(o){case ue:return pe;case he:return se;case fe:return le;case be:return ce;case ye:return de}return e});var ge=me,ve=Object.prototype.hasOwnProperty;var _e=u.Uint8Array;function xe(t){var e=new t.constructor(t.byteLength);return new _e(e).set(new _e(t)),e}var Ce=/\w*$/;var je=h?h.prototype:void 0,we=je?je.valueOf:void 0;function Ee(t,e,n){var o,r,i,a=t.constructor;switch(e){case"[object ArrayBuffer]":return xe(t);case"[object Boolean]":case"[object Date]":return new a(+t);case"[object DataView]":return function(t,e){var n=e?xe(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}(t,n);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return function(t,e){var n=e?xe(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}(t,n);case"[object Map]":case"[object Set]":return new a;case"[object Number]":case"[object String]":return new a(t);case"[object RegExp]":return(i=new(r=t).constructor(r.source,Ce.exec(r))).lastIndex=r.lastIndex,i;case"[object Symbol]":return o=t,we?Object(we.call(o)):{}}}var Ae=xt&&xt.isMap,Se=Ae?mt(Ae):function(t){return x(t)&&"[object Map]"==ge(t)};var ke=xt&&xt.isSet,Oe=ke?mt(ke):function(t){return x(t)&&"[object Set]"==ge(t)},Te="[object Arguments]",Re="[object Function]",Pe="[object Object]",Ie={};function Me(t,e,n,o,r,i){var a,s=1&e,l=2&e,c=4&e;if(n&&(a=r?n(t,o,r,i):n(t)),void 0!==a)return a;if(!A(t))return t;var d=C(t);if(d){if(a=function(t){var e=t.length,n=new t.constructor(e);return e&&"string"==typeof t[0]&&ve.call(t,"index")&&(n.index=t.index,n.input=t.input),n}(t),!s)return function(t,e){var n=-1,o=t.length;for(e||(e=Array(o));++n<o;)e[n]=t[n];return e}(t,a)}else{var p=ge(t),u=p==Re||"[object GeneratorFunction]"==p;if(bt(t))return function(t,e){if(e)return t.slice();var n=t.length,o=Xt?Xt(n):new t.constructor(n);return t.copy(o),o}(t,s);if(p==Pe||p==Te||u&&!r){if(a=l||u?{}:function(t){return"function"!=typeof t.constructor||at(t)?{}:G(Ht(t))}(t),!s)return l?function(t,e){return nt(t,te(t),e)}(t,function(t,e){return t&&nt(e,Pt(e),t)}(a,t)):function(t,e){return nt(t,Zt(t),e)}(t,function(t,e){return t&&nt(e,Ot(e),t)}(a,t))}else{if(!Ie[p])return r?t:{};a=Ee(t,p,s)}}i||(i=new qt);var h=i.get(t);if(h)return h;i.set(t,a),Oe(t)?t.forEach(function(o){a.add(Me(o,e,n,o,t,i))}):Se(t)&&t.forEach(function(o,r){a.set(r,Me(o,e,n,r,t,i))});var f=d?void 0:(c?l?oe:ne:l?Pt:Ot)(t);return function(t,e){for(var n=-1,o=null==t?0:t.length;++n<o&&!1!==e(t[n],n,t););}(f||t,function(o,r){f&&(o=t[r=o]),et(a,r,Me(o,e,n,r,t,i))}),a}Ie[Te]=Ie["[object Array]"]=Ie["[object ArrayBuffer]"]=Ie["[object DataView]"]=Ie["[object Boolean]"]=Ie["[object Date]"]=Ie["[object Float32Array]"]=Ie["[object Float64Array]"]=Ie["[object Int8Array]"]=Ie["[object Int16Array]"]=Ie["[object Int32Array]"]=Ie["[object Map]"]=Ie["[object Number]"]=Ie[Pe]=Ie["[object RegExp]"]=Ie["[object Set]"]=Ie["[object String]"]=Ie["[object Symbol]"]=Ie["[object Uint8Array]"]=Ie["[object Uint8ClampedArray]"]=Ie["[object Uint16Array]"]=Ie["[object Uint32Array]"]=!0,Ie["[object Error]"]=Ie[Re]=Ie["[object WeakMap]"]=!1;var ze=function(){return u.Date.now()},De=Math.max,Le=Math.min;function Ne(t,e,n){var o,r,i,a,s,l,c=0,d=!1,p=!1,u=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function h(e){var n=o,i=r;return o=r=void 0,c=e,a=t.apply(i,n)}function f(t){var n=t-l;return void 0===l||n>=e||n<0||p&&t-c>=i}function b(){var t=ze();if(f(t))return y(t);s=setTimeout(b,function(t){var n=e-(t-l);return p?Le(n,i-(t-c)):n}(t))}function y(t){return s=void 0,u&&o?h(t):(o=r=void 0,a)}function m(){var t=ze(),n=f(t);if(o=arguments,r=this,l=t,n){if(void 0===s)return function(t){return c=t,s=setTimeout(b,e),d?h(t):a}(l);if(p)return clearTimeout(s),s=setTimeout(b,e),h(l)}return void 0===s&&(s=setTimeout(b,e)),a}return e=R(e)||0,A(n)&&(d=!!n.leading,i=(p="maxWait"in n)?De(R(n.maxWait)||0,e):i,u="trailing"in n?!!n.trailing:u),m.cancel=function(){void 0!==s&&clearTimeout(s),c=0,o=l=r=s=void 0},m.flush=function(){return void 0===s?a:y(ze())},m}const $e=(t,e,n)=>{const o=n||[],r=o.reduce((t,e)=>t+e.textContent.length,0);let i=!0;if(r>e)return!1;for(t&&(3===t.nodeType&&t.parentNode&&!t.parentNode.hasAttribute("data-ann-id")&&o.push(t),t=t.firstChild);t&&i;)i=$e(t,e,o),t=t.nextSibling;return o},We=t=>{const{commonAncestorContainer:e,startContainer:n,endContainer:o,startOffset:r,endOffset:i}=t,a=[];let s=!1,l=!1,c="";const d=t=>{const{nodeValue:e,childNodes:p}=t;t===n&&t===o?(e&&(c+=e.substring(r,i)),s=l=!0):t===n?(e&&(c+=e.substring(r)),s=!0):t===o?(e&&(c+=e.substring(0,i)),l=!0):t&&3===t.nodeType&&t.parentNode&&!t.parentNode.hasAttribute("data-ann-id")&&e&&s&&!l&&(c+=e,a.push(t)),p.forEach(t=>{l||d(t)})};return d(e),[a,c]},Ue=t=>{const e=document.createElement("SPAN");return t.surroundContents(e),e},Fe=t=>{if(t.startContainer===t.endContainer)return[Ue(t)];const[e]=We(t),n=document.createRange();n.selectNodeContents(t.startContainer),n.setStart(t.startContainer,t.startOffset);const o=Ue(n),r=document.createRange();r.selectNode(t.endContainer),r.setEnd(t.endContainer,t.endOffset);const i=Ue(r);return[o,...e.map(t=>{const e=document.createElement("SPAN");return t.parentNode.insertBefore(e,t),e.appendChild(t),e}),i]},Be=(t,e)=>{(t||[]).forEach(t=>{const e=t.parentNode,n=t.childNodes,o=n.length;if(o>0)for(let r=0;r<o;r++)e.insertBefore(n[0],t);else e.insertBefore(document.createTextNode(t.textContent),t);e.removeChild(t)}),e.normalize()},He=()=>{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()},qe=t=>t.length>=20||-1!==t.search(/\n|\r|\r\n/),Ve=t=>Array.from(document.querySelectorAll(`[data-id='${t}']`)),Ke=t=>document.querySelector(`[data-ann-id='${t}']`),Ge=t,Xe=e,{Popover:Ye}=n,{TextField:Qe}=n,{styled:Je}=o,Ze=Je(Ye)(({theme:t,annotationType:e})=>({"& .MuiPaper-root":{overflowX:"unset",overflowY:"unset",marginLeft:"16px","&::before":{position:"absolute",right:"100%",top:"13px",border:"solid transparent",content:'""',height:0,width:0,pointerEvents:"none",borderWidth:"7px",borderRightColor:t.palette.grey[100]},..."negative"===e&&{"&::before":{borderRightColor:"rgb(255, 204, 238) !important"}},..."positive"===e&&{"&::before":{borderRightColor:"rgb(153, 255, 153) !important"}}}})),tn=Je("div")(({theme:t,annotationType:e})=>({width:"200px",overflow:"hidden",borderRadius:"4px",backgroundColor:"#ffffff",border:`4px solid ${t.palette.grey[100]}`,..."negative"===e&&{borderColor:"rgb(255, 204, 238) !important"},..."positive"===e&&{borderColor:"rgb(153, 255, 153) !important"}})),en=Je("div")(({theme:t})=>({display:"flex",flexWrap:"wrap",borderTop:`2px solid ${t.palette.grey[100]}`})),nn=Je("div")(({theme:t,variant:e,annotationType:n})=>({flexGrow:1,width:"28%",textAlign:"center",padding:"4px",cursor:"pointer","&:not(:nth-child(3n))":{borderRight:`1px solid ${t.palette.grey[100]}`},"&:hover":{backgroundColor:t.palette.grey[100]},..."positive"===e&&{backgroundColor:"rgb(153, 255, 153) !important","&:hover":{filter:"brightness(85%)"}},..."negative"===e&&{backgroundColor:"rgb(255, 204, 238) !important","&:hover":{filter:"brightness(85%)"}},..."typeChange"===e&&"negative"===n&&{"&:hover":{backgroundColor:"rgb(153, 255, 153) !important"}},..."typeChange"===e&&"positive"===n&&{"&:hover":{backgroundColor:"rgb(255, 204, 238) !important"}}}));class on extends Ge.Component{static __initStatic(){this.propTypes={anchorEl:Xe.object,open:Xe.bool,offset:Xe.number,value:Xe.string,type:Xe.string,onClose:Xe.func,onDelete:Xe.func,onSave:Xe.func,onTypeChange:Xe.func}}constructor(t){super(t),on.prototype.__init.call(this),on.prototype.__init2.call(this),on.prototype.__init3.call(this),this.state={value:t.value}}UNSAFE_componentWillReceiveProps(t){const{value:e}=t,{value:n}=this.props;e!==n&&this.setState({value:e})}__init(){this.onValueChange=t=>this.setState({value:t.target.value})}__init2(){this.handleSave=()=>{const{value:t,onSave:e,onClose:n,onDelete:o}=this.props,{value:r}=this.state;""===r&&o(),t!==r&&e(t,r),this.setState({value:""}),n()}}__init3(){this.handleTypeChange=()=>{const{onTypeChange:t,onDelete:e}=this.props,{value:n}=this.state;""===n?e():t(n),this.setState({value:""})}}render(){const{anchorEl:t,offset:e,onDelete:n,open:o,type:r}=this.props,{value:i}=this.state;return Ge.createElement(Ze,{anchorEl:t,elevation:2,open:o,onClose:this.handleSave,annotationType:r,style:{marginTop:`${e}px`,transition:"margin-top 2s ease-out"},transitionDuration:{enter:225,exit:195},anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"left"}},Ge.createElement(tn,{annotationType:r},Ge.createElement(Qe,{id:"annotation-editor",style:{padding:"2px 5px",width:"95%"},autoFocus:!0,multiline:!0,rows:1,maxRows:4,value:i,onChange:this.onValueChange,InputProps:{disableUnderline:!0}}),Ge.createElement(en,null,Ge.createElement(nn,{onClick:n},"Delete"),Ge.createElement(nn,{variant:"typeChange",annotationType:r,onClick:this.handleTypeChange},"negative"===r?"Green":"Pink"),Ge.createElement(nn,{onClick:this.handleSave},"Save"))))}}on.__initStatic();const rn=t,an=e,{styled:sn}=o,{Popover:ln}=n,cn=sn(ln)({"& .MuiPaper-root":{overflowX:"unset",overflowY:"unset",marginTop:"-16px","&::after":{position:"absolute",left:"calc(50% - 7px)",border:"solid transparent",content:'""',height:0,width:0,pointerEvents:"none",borderWidth:"7px",borderTopColor:"black"}}}),dn=sn("div")(({theme:t})=>({width:"300px",overflow:"hidden",borderRadius:"4px",backgroundColor:t.palette.common.white,border:`2px solid ${t.palette.grey[100]}`})),pn=sn("div")({display:"flex",flexWrap:"wrap"}),un=sn("div")(({theme:t})=>({display:"flex",flexWrap:"wrap",borderTop:`2px solid ${t.palette.grey[100]}`})),hn=sn("div")(({theme:t,variant:e})=>({width:"22%",textAlign:"center",padding:"4px",cursor:"pointer",borderBottom:`1px solid ${t.palette.grey[100]}`,"&:not(:nth-child(4n))":{borderRight:`1px solid ${t.palette.grey[100]}`},"&:nth-child(4n)":{flexGrow:1},"&:hover":{backgroundColor:t.palette.grey[100]},..."positive"===e&&{backgroundColor:"rgb(153, 255, 153) !important","&:hover":{filter:"brightness(85%)"}},..."negative"===e&&{backgroundColor:"rgb(255, 204, 238) !important","&:hover":{filter:"brightness(85%)"}}}));class fn extends rn.Component{static __initStatic(){this.propTypes={anchorEl:an.object,open:an.bool,annotations:an.array,isNewAnnotation:an.bool,onClose:an.func,onDelete:an.func,onEdit:an.func,onWrite:an.func,onAnnotate:an.func}}render(){const{anchorEl:t,annotations:e,isNewAnnotation:n,onAnnotate:o,onClose:r,onEdit:i,onDelete:a,onWrite:s,open:l}=this.props;return rn.createElement(cn,{anchorEl:t,open:l,onClose:r,elevation:5,transitionDuration:{enter:225,exit:195},anchorOrigin:{vertical:"top",horizontal:"center"},transformOrigin:{vertical:"bottom",horizontal:"center"}},rn.createElement(dn,null,rn.createElement(pn,null,e.map((t,e)=>rn.createElement(hn,{key:`annotation-${e}`,variant:t.type,onClick:()=>o(t)},t.label))),rn.createElement(un,null,rn.createElement(hn,{onClick:r},"Cancel"),rn.createElement(hn,{style:{pointerEvents:"none"}}),n?rn.createElement(rn.Fragment,null,rn.createElement(hn,{variant:"positive",onClick:()=>s("positive")},"Write"),rn.createElement(hn,{variant:"negative",onClick:()=>s("negative")},"Write")):rn.createElement(rn.Fragment,null,rn.createElement(hn,{onClick:a},"Delete"),rn.createElement(hn,{onClick:i},"Edit")))))}}fn.__initStatic();const bn=t,{styled:yn}=o,mn=e,gn=l,{InputContainer:vn}=c,_n=yn("div")({padding:"10px 120px 10px 16px",backgroundColor:"rgba(0, 0, 0, 0.06)",border:"1px solid #ccc",borderRadius:"4px",overflowY:"scroll",lineHeight:"36px",whiteSpace:"pre-wrap",overflowWrap:"break-word","& p":{margin:0},"& span[data-latex]":{userSelect:"none","-webkit-user-select":"none","-moz-user-select":"none","-ms-user-select":"none"}}),xn=yn("div")({width:"230px"}),Cn=yn("div")({position:"relative",overflowX:"hidden",display:"flex"}),jn=yn(vn)(({theme:t})=>({paddingTop:t.spacing(2),marginBottom:t.spacing(2),marginTop:t.spacing(2),width:"100%"}));if(!document.getElementById("annotation-editor-styles")){const t=document.createElement("style");t.id="annotation-editor-styles",t.textContent='\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',document.head.appendChild(t)}class wn extends bn.Component{static __initStatic(){this.propTypes={text:mn.string,comment:mn.string,annotations:mn.array,predefinedAnnotations:mn.array,onChange:mn.func.isRequired,onCommentChange:mn.func.isRequired,width:mn.number,height:mn.number,maxHeight:mn.string,disabled:mn.bool,disabledMath:mn.bool,customKeys:mn.array,keypadMode:mn.string}}constructor(t){super(t),wn.prototype.__init.call(this),wn.prototype.__init2.call(this),wn.prototype.__init3.call(this),wn.prototype.__init4.call(this),wn.prototype.__init5.call(this),wn.prototype.__init6.call(this),wn.prototype.__init7.call(this),wn.prototype.__init8.call(this),wn.prototype.__init9.call(this),wn.prototype.__init10.call(this),wn.prototype.__init11.call(this),wn.prototype.__init12.call(this),wn.prototype.__init13.call(this),wn.prototype.__init14.call(this),wn.prototype.__init15.call(this),this.state={anchorEl:null,openedMenu:!1,openedEditor:!1,selectedElems:[],labelElem:null,selectionDetails:null,annotation:null,annotationIndex:null}}componentDidMount(){const{annotations:t,text:e}=this.props;e&&t.forEach(t=>{const[e,n]=((t,e,n)=>{const o=$e(n,e),r=[];let i=0;return o.forEach(n=>{const o=i+n.textContent.length;[t,e].forEach(t=>{i<=t&&t<o&&r.push({node:n,offset:t-i})}),i=o}),r})(t.start,t.end,this.textRef);if(e&&n){const o=document.createRange();o.setStart(e.node,e.offset),o.setEnd(n.node,n.offset);const r=Fe(o);this.createDOMAnnotation(r,t)}}),this.textRef&&(this.adjustAnnotationsPosition(),this.textRef.addEventListener("scroll",this.adjustAnnotationsPosition))}__init(){this.adjustAnnotationsPosition=()=>{if(this.textRef&&this.labelsRef){const t=this.textRef.offsetLeft+this.textRef.offsetWidth+8;Array.from(this.labelsRef.children).forEach(e=>{const n=Ve(e.dataset.annId),o=(n[0].offsetTop?n[0].offsetTop:n[0].offsetParent.offsetTop)-this.textRef.scrollTop-6;e.style.top=`${o}px`,e.style.left=`${t}px`})}}}__init2(){this.handleClick=t=>{const{annotations:e}=this.props,{selectionDetails:n}=this.state;if(n)return;const{id:o,annId:r}=t.target.dataset,i=o||r,a=Ve(i),s=Ke(i),l=e.findIndex(t=>t.id===i),c=s.hasAttribute("data-freeform");c&&(s.style.zIndex="10"),this.setState({anchorEl:a[0],openedMenu:!!o||!!r&&!c,openedEditor:!!r&&c,selectedElems:a,labelElem:s,annotationIndex:l,annotation:e[l],selectionDetails:null})}}__init3(){this.handleHover=t=>{const{id:e,annId:n}=t.target.dataset,o=e||n,r=Ve(o),i=Ke(o),a=i.hasAttribute("data-freeform");r.forEach(t=>{t.style.zIndex="20",t.classList.contains("positive")?t.style.backgroundColor="rgb(51, 255, 51, 0.7)":t.classList.contains("negative")&&(t.style.backgroundColor="rgba(255, 102, 204, 0.55)")}),a?(i.style.zIndex="20",i.classList.contains("positive")?(i.style.backgroundColor="rgb(128, 255, 128)",i.style.setProperty("--before-border-color","rgb(153, 255, 153)")):i.classList.contains("negative")&&(i.style.backgroundColor="rgb(255, 179, 230)",i.style.setProperty("--before-border-color","rgb(255, 179, 230)"))):(i.style.zIndex="20",i.classList.contains("positive")?i.style.color="rgb(0, 77, 0)":i.classList.contains("negative")&&(i.style.color="rgb(153, 0, 102)"))}}__init4(){this.handleCancelHover=t=>{const{id:e,annId:n}=t.target.dataset,o=e||n,r=Ve(o),i=Ke(o),a=i.hasAttribute("data-freeform");r.forEach(t=>{t.style.zIndex="",t.classList.contains("positive")?t.style.backgroundColor="rgb(51, 255, 51, 0.5)":t.classList.contains("negative")&&(t.style.backgroundColor="rgba(255, 102, 204, 0.4)")}),a?(i.style.zIndex="",i.classList.contains("positive")?(i.style.backgroundColor="rgb(153, 255, 153)",i.style.removeProperty("--before-border-color")):i.classList.contains("negative")&&(i.style.backgroundColor="rgb(255, 204, 238)",i.style.removeProperty("--before-border-color"))):(i.style.zIndex="",i.classList.contains("positive")?i.style.color="rgb(0, 128, 0)":i.classList.contains("negative")&&(i.style.color="rgb(204, 0, 136)"))}}__init5(){this.handleClose=t=>{const{selectedElems:e,labelElem:n}=this.state;e.length&&!e[0].hasAttribute("data-id")&&Be(e,this.textRef),n&&(n.style.zIndex=""),this.setState({anchorEl:null,openedMenu:!1,openedEditor:!1,selectedElems:[],labelElem:null,selectionDetails:null,annotationIndex:null,annotation:null}),He()}}__init6(){this.handleSelection=t=>{const e=window.getSelection();if(t.detail>2)He();else if(e&&e.rangeCount>0){const t=e.getRangeAt(0),n=t.toString(),o=this.textRef.contains(t.commonAncestorContainer);if(!e.isCollapsed&&""!==n&&o){const e=((t,e)=>{const n=document.createRange();n.setStart(e,0),n.setEnd(t.startContainer,t.startOffset);const[,o]=We(n),[,r]=We(t),i=o.length;return{quote:r,start:i,end:i+r.length}})(t,this.textRef),n=Fe(t);this.setState({anchorEl:n[0],openedMenu:!0,selectedElems:n,selectionDetails:e})}}}}__init7(){this.deleteAnnotation=()=>{const{annotations:t,onChange:e}=this.props,{selectedElems:n,labelElem:o,annotationIndex:r,annotation:i}=this.state;(qe(i.label)?this.labelsRef:n[0]).removeChild(o),Be(n,this.textRef),t.splice(r,1),e(t),this.handleClose()}}__init8(){this.createDOMAnnotation=(t,e)=>{const{disabled:n}=this.props,{id:o,label:r,type:i}=e;(t||[]).forEach(t=>{t.dataset.id=o,t.className=`annotation ${i}`,t.style.position="relative",t.style.cursor="pointer","positive"===i?t.style.backgroundColor="rgb(51, 255, 51, 0.5)":"negative"===i&&(t.style.backgroundColor="rgba(255, 102, 204, 0.4)"),t.onclick=!n&&this.handleClick,t.onmouseover=this.handleHover,t.onmouseout=this.handleCancelHover});const a=t&&t[0]||{},s=document.createElement("SPAN");if(s.dataset.annId=o,s.innerHTML=r,s.onclick=!n&&this.handleClick,s.onmouseover=this.handleHover,s.onmouseout=this.handleCancelHover,qe(r)){const t=(a.offsetTop?a.offsetTop:a.offsetParent.offsetTop)-this.textRef.scrollTop,e=this.textRef.offsetLeft+this.textRef.offsetWidth+8;s.dataset.freeform=!0,s.className=`sideAnnotation ${i}`,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=`${t}px`,s.style.left=`${e}px`,"negative"===i?s.style.backgroundColor="rgb(255, 204, 238)":"positive"===i&&(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%"),"negative"===i?s.style.setProperty("--before-border-color","rgb(255, 204, 238)"):"positive"===i&&s.style.setProperty("--before-border-color","rgb(153, 255, 153)"),this.labelsRef.appendChild(s)}else s.className=`annotationLabel ${i}`,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","positive"===i?s.style.color="rgb(0, 128, 0)":"negative"===i&&(s.style.color="rgb(204, 0, 136)"),a.appendChild(s)}}__init9(){this.createNewAnnotation=(t,e)=>{const{selectedElems:n,selectionDetails:o}=this.state,r={id:[o.start,o.end,(new Date).getTime()].join("-"),label:t,type:e,...o};return this.createDOMAnnotation(n,r),r}}__init10(){this.handleMenuClick=t=>{const{annotations:e,onChange:n}=this.props,{annotation:o,annotationIndex:r}=this.state,{type:i,text:a}=t;if(o){const t={...o,label:a,type:i},{type:n,label:s}=o;this.updateLabel(s,t,i!==n&&n),e.splice(r,1,t)}else{const t=this.createNewAnnotation(a,i);e.push(t)}n(e),this.handleClose()}}__init11(){this.editAnnotation=()=>{this.setState({openedMenu:!1,openedEditor:!0})}}__init12(){this.addAnnotation=t=>{const{annotations:e,onChange:n}=this.props,o=this.createNewAnnotation("",t),r=Ke(o.id);e.push(o),this.setState({openedMenu:!1,openedEditor:!0,annotationIndex:e.length-1,annotation:o,labelElem:r}),n(e)}}__init13(){this.updateLabel=(t,e,n)=>{const{selectedElems:o,labelElem:r}=this.state,{label:i,type:a}=e;qe(i)&&qe(t)||!qe(i)&&!qe(t)?(r.innerHTML=i,n&&(r.classList.remove(n),r.classList.add(a),o.forEach(t=>{t.classList.remove(n),t.classList.add(a)}))):qe(i)&&!qe(t)?(o[0].removeChild(r),this.createDOMAnnotation(o,e)):!qe(i)&&qe(t)&&(this.labelsRef.removeChild(r),this.createDOMAnnotation(o,e))}}__init14(){this.changeAnnotationType=t=>{const{annotations:e,onChange:n}=this.props,{annotationIndex:o,selectedElems:r}=this.state,{type:i,label:a}=e[o],s="positive"===i?"negative":"positive",l={...e[o],type:s,label:t};r.forEach(t=>{t.classList.remove(i),t.classList.add(s)}),this.updateLabel(a,l,i),e.splice(o,1,l),n(e),this.handleClose()}}__init15(){this.updateAnnotation=(t,e)=>{const{annotations:n,onChange:o}=this.props,{annotationIndex:r}=this.state,i={...n[r],label:e};this.updateLabel(t,i),n.splice(r,1,i),o(n)}}componentWillUnmount(){this.textRef.removeEventListener("scroll",this.adjustAnnotationsPosition)}render(){const{comment:t,customKeys:e,disabled:n,disabledMath:o,keypadMode:r,height:i,width:a,maxHeight:s,onCommentChange:l,predefinedAnnotations:c,text:d}=this.props,{anchorEl:p,annotation:u,openedMenu:h,openedEditor:f,selectionDetails:b}=this.state,y=p&&(p.offsetTop?p.offsetTop:p.offsetParent.offsetTop),m=this.textRef&&y?y-this.textRef.scrollTop-8:0;return bn.createElement("div",null,bn.createElement(Cn,null,bn.createElement(_n,{style:{width:a-34,minHeight:i,maxHeight:s},ref:t=>this.textRef=t,onMouseDown:n?()=>{}:He,onMouseUp:n?()=>{}:this.handleSelection,dangerouslySetInnerHTML:{__html:d}}),bn.createElement(xn,{ref:t=>this.labelsRef=t})),bn.createElement(jn,{label:"Comment"},bn.createElement(gn,{className:"prompt",markup:t||"",onChange:l,width:a&&(a+104).toString(),disabled:n,pluginProps:{math:{disabled:o,customKeys:e,keypadMode:r,controlledKeypadMode:!1},video:{disabled:!0},audio:{disabled:!0},textAlign:{disabled:!0},h3:{disabled:!0}}})),bn.createElement(fn,{anchorEl:p,open:h&&!n,annotations:c,isNewAnnotation:!!b,onClose:this.handleClose,onDelete:this.deleteAnnotation,onEdit:this.editAnnotation,onWrite:this.addAnnotation,onAnnotate:this.handleMenuClick}),bn.createElement(on,{anchorEl:this.textRef,open:f&&!n,offset:m,value:u&&u.label||"",type:u&&u.type,onClose:this.handleClose,onDelete:this.deleteAnnotation,onSave:this.updateAnnotation,onTypeChange:this.changeAnnotationType}))}}wn.__initStatic();const En=t,An=e,Sn=r,{Typography:kn}=n,{styled:On}=o,{color:Tn}=i,{Feedback:Rn}=i,{Collapsible:Pn}=i,{PreviewPrompt:In}=i,{UiLayout:Mn}=i,zn=l,Dn=Sn("@pie-ui:extended-text-entry"),Ln=On(Mn)({backgroundColor:Tn.background(),color:Tn.text()}),Nn=On(kn)(({theme:t})=>({width:"100%",color:Tn.text(),marginBottom:t.spacing(2),fontSize:"inherit",display:"block"})),$n=On("div")(({theme:t})=>({marginBottom:t.spacing(2)})),Wn=On(zn)(({theme:t})=>({marginBottom:t.spacing(2),borderRadius:"4px"})),Un=On("h2")({position:"absolute",left:"-10000px",top:"auto",width:"1px",height:"1px",overflow:"hidden"});class Fn extends En.Component{constructor(...t){super(...t),Fn.prototype.__init.call(this),Fn.prototype.__init2.call(this)}static __initStatic(){this.propTypes={onValueChange:An.func.isRequired,onAnnotationsChange:An.func.isRequired,onCommentChange:An.func.isRequired,model:An.object,session:An.shape({value:An.string,annotations:An.array,comment:An.string}).isRequired}}__init(){this.changeSessionValue=Ne(this.props.onValueChange,1500)}__init2(){this.changeSessionComment=Ne(this.props.onCommentChange,1500)}render(){const{model:t,session:e,onAnnotationsChange:n}=this.props,{animationsDisabled:o,annotatorMode:r,customKeys:i,dimensions:a,disabled:s,disabledAnnotator:l,equationEditor:c,extraCSSRules:d,feedback:p,mathInput:u,playersToolbarPosition:h,predefinedAnnotations:f,prompt:b,spanishInput:y,specialInput:m,spellCheckEnabled:g,teacherInstructions:v}=t,{annotations:_,comment:x,value:C}=e,{width:j,height:w}=a||{},E="40vh",A={position:"top"===h?"top":"bottom"};Dn("[render] disabled? ",s);const S=En.createElement(In,{defaultClassName:"teacher-instructions",prompt:v}),k=[];return y&&k.push({language:"spanish"}),m&&k.push({language:"special"}),En.createElement(Ln,{extraCSSRules:d,ref:t=>{this.containerRef=t}},En.createElement(Un,null,"Constructed Response Question"),v&&En.createElement($n,null,o?S:En.createElement(Pn,{labels:{hidden:"Show Teacher Instructions",visible:"Hide Teacher Instructions"}},S)),b&&En.createElement(Nn,{component:"span"},En.createElement(In,{defaultClassName:"prompt",prompt:t.prompt})),r?En.createElement(wn,{text:C||"",annotations:_||[],comment:x||"",predefinedAnnotations:f||[],onChange:n,onCommentChange:this.changeSessionComment,width:j,height:w,maxHeight:E,disabled:l,disabledMath:!u,customKeys:i,keypadMode:c}):En.createElement(Wn,{className:"response-area-editor",onChange:this.changeSessionValue,markup:C||"",maxWidth:j&&j.toString(),minWidth:"100px",minHeight:w&&w.toString(),maxHeight:E,disabled:s,highlightShape:!0,toolbarOpts:A,spellCheck:g,charactersLimit:5e4,autoWidthToolbar:!0,pluginProps:{math:{disabled:!u,customKeys:this.props.model.customKeys,keypadMode:this.props.model.equationEditor,controlledKeypadMode:!1},video:{disabled:!0},audio:{disabled:!0},table:{disabled:!0},textAlign:{disabled:!0},h3:{disabled:!0},separateParagraphs:{disabled:!1},ul_list:{disabled:!0},ol_list:{disabled:!0}},languageCharactersProps:k}),p&&En.createElement(Rn,{correctness:"correct",feedback:p}))}}Fn.__initStatic();const Bn=t,{createRoot:Hn}=a,qn=r,{renderMath:Vn}=s,Kn=qn("pie-element:extended-text-entry:print"),Gn=(t,e)=>{const n="instructor"===e.role,o=Me(t,5);o.prompt=!1!==o.promptEnabled?o.prompt:void 0,o.teacherInstructions=n&&!1!==o.teacherInstructionsEnabled?o.teacherInstructions:void 0,o.showTeacherInstructions=n,o.mode=n?"evaluate":o.mode;return o.dimensions={height:100,width:500,...o.dimensions},o.disabled=!0,o.feedback=void 0,o.animationsDisabled=!0,o};class Xn extends HTMLElement{constructor(){super(),this._options=null,this._model=null,this._session=[],this._root=null,this._rerender=Ne(()=>{if(this._model&&this._session&&this._options){const t=Gn(this._model,this._options),e=Bn.createElement(Fn,{model:t,session:{},onChange:()=>{},onValueChange:()=>{},onAnnotationsChange:()=>{},onCommentChange:()=>{}});this._root||(this._root=Hn(this)),this._root.render(e),queueMicrotask(()=>{Kn("render complete - render math"),Vn(this)})}else Kn("skip")},50,{leading:!1,trailing:!0})}set options(t){this._options=t,this._rerender()}set model(t){this._model=t,this._rerender()}connectedCallback(){}disconnectedCallback(){this._root&&this._root.unmount()}}export{Xn as default};
1
+ import{_dll_react as t,_dll_prop_types as e,_dll_mui__material as n,_dll_mui__material_styles as o,_dll_pie_lib__render_ui as r,_dll_debug as i,_dll_react_dom_client as a}from"../../../@pie-lib/shared-module@6.0.0/module/index.js";import{_dll_pie_lib__math_rendering as s}from"../../../@pie-lib/math-rendering-module@6.0.0/module/index.js";import{_dll_pie_lib__editable_html_tip_tap as l}from"../../../@pie-lib/editable-html-module@8.0.0/module/index.js";import{_dll_pie_lib__config_ui as c}from"../../../@pie-lib/config-module@5.0.0/module/index.js";var d="object"==typeof global&&global&&global.Object===Object&&global,p="object"==typeof self&&self&&self.Object===Object&&self,u=d||p||Function("return this")(),h=u.Symbol,f=Object.prototype,b=f.hasOwnProperty,y=f.toString,g=h?h.toStringTag:void 0;var m=Object.prototype.toString;var v=h?h.toStringTag:void 0;function _(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":v&&v in Object(t)?function(t){var e=b.call(t,g),n=t[g];try{t[g]=void 0;var o=!0}catch(t){}var r=y.call(t);return o&&(e?t[g]=n:delete t[g]),r}(t):function(t){return m.call(t)}(t)}function x(t){return null!=t&&"object"==typeof t}var C=Array.isArray,j=/\s/;var w=/^\s+/;function E(t){return t?t.slice(0,function(t){for(var e=t.length;e--&&j.test(t.charAt(e)););return e}(t)+1).replace(w,""):t}function A(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}var S=/^[-+]0x[0-9a-f]+$/i,k=/^0b[01]+$/i,O=/^0o[0-7]+$/i,T=parseInt;function R(t){if("number"==typeof t)return t;if(function(t){return"symbol"==typeof t||x(t)&&"[object Symbol]"==_(t)}(t))return NaN;if(A(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=A(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=E(t);var n=k.test(t);return n||O.test(t)?T(t.slice(2),n?2:8):S.test(t)?NaN:+t}function P(t){if(!A(t))return!1;var e=_(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}var I,M=u["__core-js_shared__"],D=(I=/[^.]+$/.exec(M&&M.keys&&M.keys.IE_PROTO||""))?"Symbol(src)_1."+I:"";var z=Function.prototype.toString;function L(t){if(null!=t){try{return z.call(t)}catch(t){}try{return t+""}catch(t){}}return""}var N=/^\[object .+?Constructor\]$/,$=Function.prototype,W=Object.prototype,U=$.toString,F=W.hasOwnProperty,B=RegExp("^"+U.call(F).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function H(t){return!(!A(t)||(e=t,D&&D in e))&&(P(t)?B:N).test(L(t));var e}function q(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return H(n)?n:void 0}var V=q(u,"WeakMap"),K=Object.create,G=function(){function t(){}return function(e){if(!A(e))return{};if(K)return K(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}();var X=function(){try{var t=q(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();var Y=/^(?:0|[1-9]\d*)$/;function Q(t,e){var n=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==n||"symbol"!=n&&Y.test(t))&&t>-1&&t%1==0&&t<e}function J(t,e,n){"__proto__"==e&&X?X(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}function Z(t,e){return t===e||t!=t&&e!=e}var tt=Object.prototype.hasOwnProperty;function et(t,e,n){var o=t[e];tt.call(t,e)&&Z(o,n)&&(void 0!==n||e in t)||J(t,e,n)}function nt(t,e,n,o){var r=!n;n||(n={});for(var i=-1,a=e.length;++i<a;){var s=e[i],l=o?o(n[s],t[s],s,n,t):void 0;void 0===l&&(l=t[s]),r?J(n,s,l):et(n,s,l)}return n}function ot(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}function rt(t){return null!=t&&ot(t.length)&&!P(t)}var it=Object.prototype;function at(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||it)}function st(t){return x(t)&&"[object Arguments]"==_(t)}var lt=Object.prototype,ct=lt.hasOwnProperty,dt=lt.propertyIsEnumerable,pt=st(function(){return arguments}())?st:function(t){return x(t)&&ct.call(t,"callee")&&!dt.call(t,"callee")};var ut="object"==typeof exports&&exports&&!exports.nodeType&&exports,ht=ut&&"object"==typeof module&&module&&!module.nodeType&&module,ft=ht&&ht.exports===ut?u.Buffer:void 0,bt=(ft?ft.isBuffer:void 0)||function(){return!1},yt={};function gt(t){return function(e){return t(e)}}yt["[object Float32Array]"]=yt["[object Float64Array]"]=yt["[object Int8Array]"]=yt["[object Int16Array]"]=yt["[object Int32Array]"]=yt["[object Uint8Array]"]=yt["[object Uint8ClampedArray]"]=yt["[object Uint16Array]"]=yt["[object Uint32Array]"]=!0,yt["[object Arguments]"]=yt["[object Array]"]=yt["[object ArrayBuffer]"]=yt["[object Boolean]"]=yt["[object DataView]"]=yt["[object Date]"]=yt["[object Error]"]=yt["[object Function]"]=yt["[object Map]"]=yt["[object Number]"]=yt["[object Object]"]=yt["[object RegExp]"]=yt["[object Set]"]=yt["[object String]"]=yt["[object WeakMap]"]=!1;var mt="object"==typeof exports&&exports&&!exports.nodeType&&exports,vt=mt&&"object"==typeof module&&module&&!module.nodeType&&module,_t=vt&&vt.exports===mt&&d.process,xt=function(){try{var t=vt&&vt.require&&vt.require("util").types;return t||_t&&_t.binding&&_t.binding("util")}catch(t){}}(),Ct=xt&&xt.isTypedArray,jt=Ct?gt(Ct):function(t){return x(t)&&ot(t.length)&&!!yt[_(t)]},wt=Object.prototype.hasOwnProperty;function Et(t,e){var n=C(t),o=!n&&pt(t),r=!n&&!o&&bt(t),i=!n&&!o&&!r&&jt(t),a=n||o||r||i,s=a?function(t,e){for(var n=-1,o=Array(t);++n<t;)o[n]=e(n);return o}(t.length,String):[],l=s.length;for(var c in t)!e&&!wt.call(t,c)||a&&("length"==c||r&&("offset"==c||"parent"==c)||i&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||Q(c,l))||s.push(c);return s}function At(t,e){return function(n){return t(e(n))}}var St=At(Object.keys,Object),kt=Object.prototype.hasOwnProperty;function Ot(t){return rt(t)?Et(t):function(t){if(!at(t))return St(t);var e=[];for(var n in Object(t))kt.call(t,n)&&"constructor"!=n&&e.push(n);return e}(t)}var Tt=Object.prototype.hasOwnProperty;function Rt(t){if(!A(t))return function(t){var e=[];if(null!=t)for(var n in Object(t))e.push(n);return e}(t);var e=at(t),n=[];for(var o in t)("constructor"!=o||!e&&Tt.call(t,o))&&n.push(o);return n}function Pt(t){return rt(t)?Et(t,!0):Rt(t)}var It=q(Object,"create");var Mt=Object.prototype.hasOwnProperty;var Dt=Object.prototype.hasOwnProperty;function zt(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var o=t[e];this.set(o[0],o[1])}}function Lt(t,e){for(var n=t.length;n--;)if(Z(t[n][0],e))return n;return-1}zt.prototype.clear=function(){this.__data__=It?It(null):{},this.size=0},zt.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},zt.prototype.get=function(t){var e=this.__data__;if(It){var n=e[t];return"__lodash_hash_undefined__"===n?void 0:n}return Mt.call(e,t)?e[t]:void 0},zt.prototype.has=function(t){var e=this.__data__;return It?void 0!==e[t]:Dt.call(e,t)},zt.prototype.set=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=It&&void 0===e?"__lodash_hash_undefined__":e,this};var Nt=Array.prototype.splice;function $t(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var o=t[e];this.set(o[0],o[1])}}$t.prototype.clear=function(){this.__data__=[],this.size=0},$t.prototype.delete=function(t){var e=this.__data__,n=Lt(e,t);return!(n<0)&&(n==e.length-1?e.pop():Nt.call(e,n,1),--this.size,!0)},$t.prototype.get=function(t){var e=this.__data__,n=Lt(e,t);return n<0?void 0:e[n][1]},$t.prototype.has=function(t){return Lt(this.__data__,t)>-1},$t.prototype.set=function(t,e){var n=this.__data__,o=Lt(n,t);return o<0?(++this.size,n.push([t,e])):n[o][1]=e,this};var Wt=q(u,"Map");function Ut(t,e){var n,o,r=t.__data__;return("string"==(o=typeof(n=e))||"number"==o||"symbol"==o||"boolean"==o?"__proto__"!==n:null===n)?r["string"==typeof e?"string":"hash"]:r.map}function Ft(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var o=t[e];this.set(o[0],o[1])}}function Bt(t,e){for(var n=-1,o=e.length,r=t.length;++n<o;)t[r+n]=e[n];return t}Ft.prototype.clear=function(){this.size=0,this.__data__={hash:new zt,map:new(Wt||$t),string:new zt}},Ft.prototype.delete=function(t){var e=Ut(this,t).delete(t);return this.size-=e?1:0,e},Ft.prototype.get=function(t){return Ut(this,t).get(t)},Ft.prototype.has=function(t){return Ut(this,t).has(t)},Ft.prototype.set=function(t,e){var n=Ut(this,t),o=n.size;return n.set(t,e),this.size+=n.size==o?0:1,this};var Ht=At(Object.getPrototypeOf,Object);function qt(t){var e=this.__data__=new $t(t);this.size=e.size}qt.prototype.clear=function(){this.__data__=new $t,this.size=0},qt.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},qt.prototype.get=function(t){return this.__data__.get(t)},qt.prototype.has=function(t){return this.__data__.has(t)},qt.prototype.set=function(t,e){var n=this.__data__;if(n instanceof $t){var o=n.__data__;if(!Wt||o.length<199)return o.push([t,e]),this.size=++n.size,this;n=this.__data__=new Ft(o)}return n.set(t,e),this.size=n.size,this};var Vt="object"==typeof exports&&exports&&!exports.nodeType&&exports,Kt=Vt&&"object"==typeof module&&module&&!module.nodeType&&module,Gt=Kt&&Kt.exports===Vt?u.Buffer:void 0,Xt=Gt?Gt.allocUnsafe:void 0;function Yt(){return[]}var Qt=Object.prototype.propertyIsEnumerable,Jt=Object.getOwnPropertySymbols,Zt=Jt?function(t){return null==t?[]:(t=Object(t),function(t,e){for(var n=-1,o=null==t?0:t.length,r=0,i=[];++n<o;){var a=t[n];e(a,n,t)&&(i[r++]=a)}return i}(Jt(t),function(e){return Qt.call(t,e)}))}:Yt;var te=Object.getOwnPropertySymbols?function(t){for(var e=[];t;)Bt(e,Zt(t)),t=Ht(t);return e}:Yt;function ee(t,e,n){var o=e(t);return C(t)?o:Bt(o,n(t))}function ne(t){return ee(t,Ot,Zt)}function oe(t){return ee(t,Pt,te)}var re=q(u,"DataView"),ie=q(u,"Promise"),ae=q(u,"Set"),se="[object Map]",le="[object Promise]",ce="[object Set]",de="[object WeakMap]",pe="[object DataView]",ue=L(re),he=L(Wt),fe=L(ie),be=L(ae),ye=L(V),ge=_;(re&&ge(new re(new ArrayBuffer(1)))!=pe||Wt&&ge(new Wt)!=se||ie&&ge(ie.resolve())!=le||ae&&ge(new ae)!=ce||V&&ge(new V)!=de)&&(ge=function(t){var e=_(t),n="[object Object]"==e?t.constructor:void 0,o=n?L(n):"";if(o)switch(o){case ue:return pe;case he:return se;case fe:return le;case be:return ce;case ye:return de}return e});var me=ge,ve=Object.prototype.hasOwnProperty;var _e=u.Uint8Array;function xe(t){var e=new t.constructor(t.byteLength);return new _e(e).set(new _e(t)),e}var Ce=/\w*$/;var je=h?h.prototype:void 0,we=je?je.valueOf:void 0;function Ee(t,e,n){var o,r,i,a=t.constructor;switch(e){case"[object ArrayBuffer]":return xe(t);case"[object Boolean]":case"[object Date]":return new a(+t);case"[object DataView]":return function(t,e){var n=e?xe(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}(t,n);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return function(t,e){var n=e?xe(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}(t,n);case"[object Map]":case"[object Set]":return new a;case"[object Number]":case"[object String]":return new a(t);case"[object RegExp]":return(i=new(r=t).constructor(r.source,Ce.exec(r))).lastIndex=r.lastIndex,i;case"[object Symbol]":return o=t,we?Object(we.call(o)):{}}}var Ae=xt&&xt.isMap,Se=Ae?gt(Ae):function(t){return x(t)&&"[object Map]"==me(t)};var ke=xt&&xt.isSet,Oe=ke?gt(ke):function(t){return x(t)&&"[object Set]"==me(t)},Te="[object Arguments]",Re="[object Function]",Pe="[object Object]",Ie={};function Me(t,e,n,o,r,i){var a,s=1&e,l=2&e,c=4&e;if(n&&(a=r?n(t,o,r,i):n(t)),void 0!==a)return a;if(!A(t))return t;var d=C(t);if(d){if(a=function(t){var e=t.length,n=new t.constructor(e);return e&&"string"==typeof t[0]&&ve.call(t,"index")&&(n.index=t.index,n.input=t.input),n}(t),!s)return function(t,e){var n=-1,o=t.length;for(e||(e=Array(o));++n<o;)e[n]=t[n];return e}(t,a)}else{var p=me(t),u=p==Re||"[object GeneratorFunction]"==p;if(bt(t))return function(t,e){if(e)return t.slice();var n=t.length,o=Xt?Xt(n):new t.constructor(n);return t.copy(o),o}(t,s);if(p==Pe||p==Te||u&&!r){if(a=l||u?{}:function(t){return"function"!=typeof t.constructor||at(t)?{}:G(Ht(t))}(t),!s)return l?function(t,e){return nt(t,te(t),e)}(t,function(t,e){return t&&nt(e,Pt(e),t)}(a,t)):function(t,e){return nt(t,Zt(t),e)}(t,function(t,e){return t&&nt(e,Ot(e),t)}(a,t))}else{if(!Ie[p])return r?t:{};a=Ee(t,p,s)}}i||(i=new qt);var h=i.get(t);if(h)return h;i.set(t,a),Oe(t)?t.forEach(function(o){a.add(Me(o,e,n,o,t,i))}):Se(t)&&t.forEach(function(o,r){a.set(r,Me(o,e,n,r,t,i))});var f=d?void 0:(c?l?oe:ne:l?Pt:Ot)(t);return function(t,e){for(var n=-1,o=null==t?0:t.length;++n<o&&!1!==e(t[n],n,t););}(f||t,function(o,r){f&&(o=t[r=o]),et(a,r,Me(o,e,n,r,t,i))}),a}Ie[Te]=Ie["[object Array]"]=Ie["[object ArrayBuffer]"]=Ie["[object DataView]"]=Ie["[object Boolean]"]=Ie["[object Date]"]=Ie["[object Float32Array]"]=Ie["[object Float64Array]"]=Ie["[object Int8Array]"]=Ie["[object Int16Array]"]=Ie["[object Int32Array]"]=Ie["[object Map]"]=Ie["[object Number]"]=Ie[Pe]=Ie["[object RegExp]"]=Ie["[object Set]"]=Ie["[object String]"]=Ie["[object Symbol]"]=Ie["[object Uint8Array]"]=Ie["[object Uint8ClampedArray]"]=Ie["[object Uint16Array]"]=Ie["[object Uint32Array]"]=!0,Ie["[object Error]"]=Ie[Re]=Ie["[object WeakMap]"]=!1;var De=function(){return u.Date.now()},ze=Math.max,Le=Math.min;function Ne(t,e,n){var o,r,i,a,s,l,c=0,d=!1,p=!1,u=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function h(e){var n=o,i=r;return o=r=void 0,c=e,a=t.apply(i,n)}function f(t){var n=t-l;return void 0===l||n>=e||n<0||p&&t-c>=i}function b(){var t=De();if(f(t))return y(t);s=setTimeout(b,function(t){var n=e-(t-l);return p?Le(n,i-(t-c)):n}(t))}function y(t){return s=void 0,u&&o?h(t):(o=r=void 0,a)}function g(){var t=De(),n=f(t);if(o=arguments,r=this,l=t,n){if(void 0===s)return function(t){return c=t,s=setTimeout(b,e),d?h(t):a}(l);if(p)return clearTimeout(s),s=setTimeout(b,e),h(l)}return void 0===s&&(s=setTimeout(b,e)),a}return e=R(e)||0,A(n)&&(d=!!n.leading,i=(p="maxWait"in n)?ze(R(n.maxWait)||0,e):i,u="trailing"in n?!!n.trailing:u),g.cancel=function(){void 0!==s&&clearTimeout(s),c=0,o=l=r=s=void 0},g.flush=function(){return void 0===s?a:y(De())},g}const $e=(t,e,n)=>{const o=n||[],r=o.reduce((t,e)=>t+e.textContent.length,0);let i=!0;if(r>e)return!1;for(t&&(3===t.nodeType&&t.parentNode&&!t.parentNode.hasAttribute("data-ann-id")&&o.push(t),t=t.firstChild);t&&i;)i=$e(t,e,o),t=t.nextSibling;return o},We=t=>{const{commonAncestorContainer:e,startContainer:n,endContainer:o,startOffset:r,endOffset:i}=t,a=[];let s=!1,l=!1,c="";const d=t=>{const{nodeValue:e,childNodes:p}=t;t===n&&t===o?(e&&(c+=e.substring(r,i)),s=l=!0):t===n?(e&&(c+=e.substring(r)),s=!0):t===o?(e&&(c+=e.substring(0,i)),l=!0):t&&3===t.nodeType&&t.parentNode&&!t.parentNode.hasAttribute("data-ann-id")&&e&&s&&!l&&(c+=e,a.push(t)),p.forEach(t=>{l||d(t)})};return d(e),[a,c]},Ue=t=>{const e=document.createElement("SPAN");return t.surroundContents(e),e},Fe=t=>{if(t.startContainer===t.endContainer)return[Ue(t)];const[e]=We(t),n=document.createRange();n.selectNodeContents(t.startContainer),n.setStart(t.startContainer,t.startOffset);const o=Ue(n),r=document.createRange();r.selectNode(t.endContainer),r.setEnd(t.endContainer,t.endOffset);const i=Ue(r);return[o,...e.map(t=>{const e=document.createElement("SPAN");return t.parentNode.insertBefore(e,t),e.appendChild(t),e}),i]},Be=(t,e)=>{(t||[]).forEach(t=>{const e=t.parentNode,n=t.childNodes,o=n.length;if(o>0)for(let r=0;r<o;r++)e.insertBefore(n[0],t);else e.insertBefore(document.createTextNode(t.textContent),t);e.removeChild(t)}),e.normalize()},He=()=>{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()},qe=t=>t.length>=20||-1!==t.search(/\n|\r|\r\n/),Ve=t=>Array.from(document.querySelectorAll(`[data-id='${t}']`)),Ke=t=>document.querySelector(`[data-ann-id='${t}']`),Ge=t,Xe=e,{Popover:Ye}=n,{TextField:Qe}=n,{styled:Je}=o,{color:Ze}=r,tn=Je(Ye)(({annotationType:t})=>({"& .MuiPaper-root":{overflowX:"unset",overflowY:"unset",marginLeft:"16px","&::before":{position:"absolute",right:"100%",top:"13px",border:"solid transparent",content:'""',height:0,width:0,pointerEvents:"none",borderWidth:"7px",borderRightColor:Ze.border()},..."negative"===t&&{"&::before":{borderRightColor:"rgb(255, 204, 238) !important"}},..."positive"===t&&{"&::before":{borderRightColor:"rgb(153, 255, 153) !important"}}}})),en=Je("div")(({annotationType:t})=>({width:"200px",overflow:"hidden",borderRadius:"4px",backgroundColor:Ze.white(),border:`4px solid ${Ze.border()}`,..."negative"===t&&{borderColor:"rgb(255, 204, 238) !important"},..."positive"===t&&{borderColor:"rgb(153, 255, 153) !important"}})),nn=Je("div")(()=>({display:"flex",flexWrap:"wrap",borderTop:`2px solid ${Ze.border()}`})),on=Je("div")(({variant:t,annotationType:e})=>({flexGrow:1,width:"28%",textAlign:"center",padding:"4px",cursor:"pointer","&:not(:nth-child(3n))":{borderRight:`1px solid ${Ze.border()}`},"&:hover":{backgroundColor:Ze.backgroundDark()},..."positive"===t&&{backgroundColor:"rgb(153, 255, 153) !important","&:hover":{filter:"brightness(85%)"}},..."negative"===t&&{backgroundColor:"rgb(255, 204, 238) !important","&:hover":{filter:"brightness(85%)"}},..."typeChange"===t&&"negative"===e&&{"&:hover":{backgroundColor:"rgb(153, 255, 153) !important"}},..."typeChange"===t&&"positive"===e&&{"&:hover":{backgroundColor:"rgb(255, 204, 238) !important"}}}));class rn extends Ge.Component{static __initStatic(){this.propTypes={anchorEl:Xe.object,open:Xe.bool,offset:Xe.number,value:Xe.string,type:Xe.string,onClose:Xe.func,onDelete:Xe.func,onSave:Xe.func,onTypeChange:Xe.func}}constructor(t){super(t),rn.prototype.__init.call(this),rn.prototype.__init2.call(this),rn.prototype.__init3.call(this),this.state={value:t.value}}UNSAFE_componentWillReceiveProps(t){const{value:e}=t,{value:n}=this.props;e!==n&&this.setState({value:e})}__init(){this.onValueChange=t=>this.setState({value:t.target.value})}__init2(){this.handleSave=()=>{const{value:t,onSave:e,onClose:n,onDelete:o}=this.props,{value:r}=this.state;""===r&&o(),t!==r&&e(t,r),this.setState({value:""}),n()}}__init3(){this.handleTypeChange=()=>{const{onTypeChange:t,onDelete:e}=this.props,{value:n}=this.state;""===n?e():t(n),this.setState({value:""})}}render(){const{anchorEl:t,offset:e,onDelete:n,open:o,type:r}=this.props,{value:i}=this.state;return Ge.createElement(tn,{anchorEl:t,elevation:2,open:o,onClose:this.handleSave,annotationType:r,style:{marginTop:`${e}px`,transition:"margin-top 2s ease-out"},transitionDuration:{enter:225,exit:195},anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"left"}},Ge.createElement(en,{annotationType:r},Ge.createElement(Qe,{id:"annotation-editor",style:{padding:"2px 5px",width:"95%"},autoFocus:!0,multiline:!0,rows:1,maxRows:4,value:i,onChange:this.onValueChange,InputProps:{disableUnderline:!0}}),Ge.createElement(nn,null,Ge.createElement(on,{onClick:n},"Delete"),Ge.createElement(on,{variant:"typeChange",annotationType:r,onClick:this.handleTypeChange},"negative"===r?"Green":"Pink"),Ge.createElement(on,{onClick:this.handleSave},"Save"))))}}rn.__initStatic();const an=t,sn=e,{styled:ln}=o,{Popover:cn}=n,{color:dn}=r,pn=ln(cn)({"& .MuiPaper-root":{overflowX:"unset",overflowY:"unset",marginTop:"-16px","&::after":{position:"absolute",left:"calc(50% - 7px)",border:"solid transparent",content:'""',height:0,width:0,pointerEvents:"none",borderWidth:"7px",borderTopColor:dn.border()}}}),un=ln("div")(()=>({width:"300px",overflow:"hidden",borderRadius:"4px",backgroundColor:dn.white(),border:`2px solid ${dn.border()}`})),hn=ln("div")({display:"flex",flexWrap:"wrap"}),fn=ln("div")(()=>({display:"flex",flexWrap:"wrap",borderTop:`2px solid ${dn.border()}`})),bn=ln("div")(({variant:t})=>({width:"22%",textAlign:"center",padding:"4px",cursor:"pointer",borderBottom:`1px solid ${dn.border()}`,"&:not(:nth-child(4n))":{borderRight:`1px solid ${dn.border()}`},"&:nth-child(4n)":{flexGrow:1},"&:hover":{backgroundColor:dn.backgroundDark()},..."positive"===t&&{backgroundColor:"rgb(153, 255, 153) !important","&:hover":{filter:"brightness(85%)"}},..."negative"===t&&{backgroundColor:"rgb(255, 204, 238) !important","&:hover":{filter:"brightness(85%)"}}}));class yn extends an.Component{static __initStatic(){this.propTypes={anchorEl:sn.object,open:sn.bool,annotations:sn.array,isNewAnnotation:sn.bool,onClose:sn.func,onDelete:sn.func,onEdit:sn.func,onWrite:sn.func,onAnnotate:sn.func}}render(){const{anchorEl:t,annotations:e,isNewAnnotation:n,onAnnotate:o,onClose:r,onEdit:i,onDelete:a,onWrite:s,open:l}=this.props;return an.createElement(pn,{anchorEl:t,open:l,onClose:r,elevation:5,transitionDuration:{enter:225,exit:195},anchorOrigin:{vertical:"top",horizontal:"center"},transformOrigin:{vertical:"bottom",horizontal:"center"}},an.createElement(un,null,an.createElement(hn,null,e.map((t,e)=>an.createElement(bn,{key:`annotation-${e}`,variant:t.type,onClick:()=>o(t)},t.label))),an.createElement(fn,null,an.createElement(bn,{onClick:r},"Cancel"),an.createElement(bn,{style:{pointerEvents:"none"}}),n?an.createElement(an.Fragment,null,an.createElement(bn,{variant:"positive",onClick:()=>s("positive")},"Write"),an.createElement(bn,{variant:"negative",onClick:()=>s("negative")},"Write")):an.createElement(an.Fragment,null,an.createElement(bn,{onClick:a},"Delete"),an.createElement(bn,{onClick:i},"Edit")))))}}yn.__initStatic();const gn=t,{styled:mn}=o,vn=e,_n=l,{InputContainer:xn}=c,Cn=mn("div")({padding:"10px 120px 10px 16px",backgroundColor:"rgba(0, 0, 0, 0.06)",border:"1px solid #ccc",borderRadius:"4px",overflowY:"scroll",lineHeight:"36px",whiteSpace:"pre-wrap",overflowWrap:"break-word","& p":{margin:0},"& span[data-latex]":{userSelect:"none","-webkit-user-select":"none","-moz-user-select":"none","-ms-user-select":"none"}}),jn=mn("div")({width:"230px"}),wn=mn("div")({position:"relative",overflowX:"hidden",display:"flex"}),En=mn(xn)(({theme:t})=>({paddingTop:t.spacing(2),marginBottom:t.spacing(2),marginTop:t.spacing(2),width:"100%"}));if(!document.getElementById("annotation-editor-styles")){const t=document.createElement("style");t.id="annotation-editor-styles",t.textContent='\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',document.head.appendChild(t)}class An extends gn.Component{static __initStatic(){this.propTypes={text:vn.string,comment:vn.string,annotations:vn.array,predefinedAnnotations:vn.array,onChange:vn.func.isRequired,onCommentChange:vn.func.isRequired,width:vn.number,height:vn.number,maxHeight:vn.string,disabled:vn.bool,disabledMath:vn.bool,customKeys:vn.array,keypadMode:vn.string}}constructor(t){super(t),An.prototype.__init.call(this),An.prototype.__init2.call(this),An.prototype.__init3.call(this),An.prototype.__init4.call(this),An.prototype.__init5.call(this),An.prototype.__init6.call(this),An.prototype.__init7.call(this),An.prototype.__init8.call(this),An.prototype.__init9.call(this),An.prototype.__init10.call(this),An.prototype.__init11.call(this),An.prototype.__init12.call(this),An.prototype.__init13.call(this),An.prototype.__init14.call(this),An.prototype.__init15.call(this),this.state={anchorEl:null,openedMenu:!1,openedEditor:!1,selectedElems:[],labelElem:null,selectionDetails:null,annotation:null,annotationIndex:null}}componentDidMount(){const{annotations:t,text:e}=this.props;e&&t.forEach(t=>{const[e,n]=((t,e,n)=>{const o=$e(n,e),r=[];let i=0;return o.forEach(n=>{const o=i+n.textContent.length;[t,e].forEach(t=>{i<=t&&t<o&&r.push({node:n,offset:t-i})}),i=o}),r})(t.start,t.end,this.textRef);if(e&&n){const o=document.createRange();o.setStart(e.node,e.offset),o.setEnd(n.node,n.offset);const r=Fe(o);this.createDOMAnnotation(r,t)}}),this.textRef&&(this.adjustAnnotationsPosition(),this.textRef.addEventListener("scroll",this.adjustAnnotationsPosition))}__init(){this.adjustAnnotationsPosition=()=>{if(this.textRef&&this.labelsRef){const t=this.textRef.offsetLeft+this.textRef.offsetWidth+8;Array.from(this.labelsRef.children).forEach(e=>{const n=Ve(e.dataset.annId),o=(n[0].offsetTop?n[0].offsetTop:n[0].offsetParent.offsetTop)-this.textRef.scrollTop-6;e.style.top=`${o}px`,e.style.left=`${t}px`})}}}__init2(){this.handleClick=t=>{const{annotations:e}=this.props,{selectionDetails:n}=this.state;if(n)return;const{id:o,annId:r}=t.target.dataset,i=o||r,a=Ve(i),s=Ke(i),l=e.findIndex(t=>t.id===i),c=s.hasAttribute("data-freeform");c&&(s.style.zIndex="10"),this.setState({anchorEl:a[0],openedMenu:!!o||!!r&&!c,openedEditor:!!r&&c,selectedElems:a,labelElem:s,annotationIndex:l,annotation:e[l],selectionDetails:null})}}__init3(){this.handleHover=t=>{const{id:e,annId:n}=t.target.dataset,o=e||n,r=Ve(o),i=Ke(o),a=i.hasAttribute("data-freeform");r.forEach(t=>{t.style.zIndex="20",t.classList.contains("positive")?t.style.backgroundColor="rgb(51, 255, 51, 0.7)":t.classList.contains("negative")&&(t.style.backgroundColor="rgba(255, 102, 204, 0.55)")}),a?(i.style.zIndex="20",i.classList.contains("positive")?(i.style.backgroundColor="rgb(128, 255, 128)",i.style.setProperty("--before-border-color","rgb(153, 255, 153)")):i.classList.contains("negative")&&(i.style.backgroundColor="rgb(255, 179, 230)",i.style.setProperty("--before-border-color","rgb(255, 179, 230)"))):(i.style.zIndex="20",i.classList.contains("positive")?i.style.color="rgb(0, 77, 0)":i.classList.contains("negative")&&(i.style.color="rgb(153, 0, 102)"))}}__init4(){this.handleCancelHover=t=>{const{id:e,annId:n}=t.target.dataset,o=e||n,r=Ve(o),i=Ke(o),a=i.hasAttribute("data-freeform");r.forEach(t=>{t.style.zIndex="",t.classList.contains("positive")?t.style.backgroundColor="rgb(51, 255, 51, 0.5)":t.classList.contains("negative")&&(t.style.backgroundColor="rgba(255, 102, 204, 0.4)")}),a?(i.style.zIndex="",i.classList.contains("positive")?(i.style.backgroundColor="rgb(153, 255, 153)",i.style.removeProperty("--before-border-color")):i.classList.contains("negative")&&(i.style.backgroundColor="rgb(255, 204, 238)",i.style.removeProperty("--before-border-color"))):(i.style.zIndex="",i.classList.contains("positive")?i.style.color="rgb(0, 128, 0)":i.classList.contains("negative")&&(i.style.color="rgb(204, 0, 136)"))}}__init5(){this.handleClose=t=>{const{selectedElems:e,labelElem:n}=this.state;e.length&&!e[0].hasAttribute("data-id")&&Be(e,this.textRef),n&&(n.style.zIndex=""),this.setState({anchorEl:null,openedMenu:!1,openedEditor:!1,selectedElems:[],labelElem:null,selectionDetails:null,annotationIndex:null,annotation:null}),He()}}__init6(){this.handleSelection=t=>{const e=window.getSelection();if(t.detail>2)He();else if(e&&e.rangeCount>0){const t=e.getRangeAt(0),n=t.toString(),o=this.textRef.contains(t.commonAncestorContainer);if(!e.isCollapsed&&""!==n&&o){const e=((t,e)=>{const n=document.createRange();n.setStart(e,0),n.setEnd(t.startContainer,t.startOffset);const[,o]=We(n),[,r]=We(t),i=o.length;return{quote:r,start:i,end:i+r.length}})(t,this.textRef),n=Fe(t);this.setState({anchorEl:n[0],openedMenu:!0,selectedElems:n,selectionDetails:e})}}}}__init7(){this.deleteAnnotation=()=>{const{annotations:t,onChange:e}=this.props,{selectedElems:n,labelElem:o,annotationIndex:r,annotation:i}=this.state;(qe(i.label)?this.labelsRef:n[0]).removeChild(o),Be(n,this.textRef),t.splice(r,1),e(t),this.handleClose()}}__init8(){this.createDOMAnnotation=(t,e)=>{const{disabled:n}=this.props,{id:o,label:r,type:i}=e;(t||[]).forEach(t=>{t.dataset.id=o,t.className=`annotation ${i}`,t.style.position="relative",t.style.cursor="pointer","positive"===i?t.style.backgroundColor="rgb(51, 255, 51, 0.5)":"negative"===i&&(t.style.backgroundColor="rgba(255, 102, 204, 0.4)"),t.onclick=!n&&this.handleClick,t.onmouseover=this.handleHover,t.onmouseout=this.handleCancelHover});const a=t&&t[0]||{},s=document.createElement("SPAN");if(s.dataset.annId=o,s.innerHTML=r,s.onclick=!n&&this.handleClick,s.onmouseover=this.handleHover,s.onmouseout=this.handleCancelHover,qe(r)){const t=(a.offsetTop?a.offsetTop:a.offsetParent.offsetTop)-this.textRef.scrollTop,e=this.textRef.offsetLeft+this.textRef.offsetWidth+8;s.dataset.freeform=!0,s.className=`sideAnnotation ${i}`,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=`${t}px`,s.style.left=`${e}px`,"negative"===i?s.style.backgroundColor="rgb(255, 204, 238)":"positive"===i&&(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%"),"negative"===i?s.style.setProperty("--before-border-color","rgb(255, 204, 238)"):"positive"===i&&s.style.setProperty("--before-border-color","rgb(153, 255, 153)"),this.labelsRef.appendChild(s)}else s.className=`annotationLabel ${i}`,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","positive"===i?s.style.color="rgb(0, 128, 0)":"negative"===i&&(s.style.color="rgb(204, 0, 136)"),a.appendChild(s)}}__init9(){this.createNewAnnotation=(t,e)=>{const{selectedElems:n,selectionDetails:o}=this.state,r={id:[o.start,o.end,(new Date).getTime()].join("-"),label:t,type:e,...o};return this.createDOMAnnotation(n,r),r}}__init10(){this.handleMenuClick=t=>{const{annotations:e,onChange:n}=this.props,{annotation:o,annotationIndex:r}=this.state,{type:i,text:a}=t;if(o){const t={...o,label:a,type:i},{type:n,label:s}=o;this.updateLabel(s,t,i!==n&&n),e.splice(r,1,t)}else{const t=this.createNewAnnotation(a,i);e.push(t)}n(e),this.handleClose()}}__init11(){this.editAnnotation=()=>{this.setState({openedMenu:!1,openedEditor:!0})}}__init12(){this.addAnnotation=t=>{const{annotations:e,onChange:n}=this.props,o=this.createNewAnnotation("",t),r=Ke(o.id);e.push(o),this.setState({openedMenu:!1,openedEditor:!0,annotationIndex:e.length-1,annotation:o,labelElem:r}),n(e)}}__init13(){this.updateLabel=(t,e,n)=>{const{selectedElems:o,labelElem:r}=this.state,{label:i,type:a}=e;qe(i)&&qe(t)||!qe(i)&&!qe(t)?(r.innerHTML=i,n&&(r.classList.remove(n),r.classList.add(a),o.forEach(t=>{t.classList.remove(n),t.classList.add(a)}))):qe(i)&&!qe(t)?(o[0].removeChild(r),this.createDOMAnnotation(o,e)):!qe(i)&&qe(t)&&(this.labelsRef.removeChild(r),this.createDOMAnnotation(o,e))}}__init14(){this.changeAnnotationType=t=>{const{annotations:e,onChange:n}=this.props,{annotationIndex:o,selectedElems:r}=this.state,{type:i,label:a}=e[o],s="positive"===i?"negative":"positive",l={...e[o],type:s,label:t};r.forEach(t=>{t.classList.remove(i),t.classList.add(s)}),this.updateLabel(a,l,i),e.splice(o,1,l),n(e),this.handleClose()}}__init15(){this.updateAnnotation=(t,e)=>{const{annotations:n,onChange:o}=this.props,{annotationIndex:r}=this.state,i={...n[r],label:e};this.updateLabel(t,i),n.splice(r,1,i),o(n)}}componentWillUnmount(){this.textRef.removeEventListener("scroll",this.adjustAnnotationsPosition)}render(){const{comment:t,customKeys:e,disabled:n,disabledMath:o,keypadMode:r,height:i,width:a,maxHeight:s,onCommentChange:l,predefinedAnnotations:c,text:d}=this.props,{anchorEl:p,annotation:u,openedMenu:h,openedEditor:f,selectionDetails:b}=this.state,y=p&&(p.offsetTop?p.offsetTop:p.offsetParent.offsetTop),g=this.textRef&&y?y-this.textRef.scrollTop-8:0;return gn.createElement("div",null,gn.createElement(wn,null,gn.createElement(Cn,{style:{width:a-34,minHeight:i,maxHeight:s},ref:t=>this.textRef=t,onMouseDown:n?()=>{}:He,onMouseUp:n?()=>{}:this.handleSelection,dangerouslySetInnerHTML:{__html:d}}),gn.createElement(jn,{ref:t=>this.labelsRef=t})),gn.createElement(En,{label:"Comment"},gn.createElement(_n,{className:"prompt",markup:t||"",onChange:l,width:a&&(a+104).toString(),disabled:n,pluginProps:{math:{disabled:o,customKeys:e,keypadMode:r,controlledKeypadMode:!1},video:{disabled:!0},audio:{disabled:!0},textAlign:{disabled:!0},h3:{disabled:!0}}})),gn.createElement(yn,{anchorEl:p,open:h&&!n,annotations:c,isNewAnnotation:!!b,onClose:this.handleClose,onDelete:this.deleteAnnotation,onEdit:this.editAnnotation,onWrite:this.addAnnotation,onAnnotate:this.handleMenuClick}),gn.createElement(rn,{anchorEl:this.textRef,open:f&&!n,offset:g,value:u&&u.label||"",type:u&&u.type,onClose:this.handleClose,onDelete:this.deleteAnnotation,onSave:this.updateAnnotation,onTypeChange:this.changeAnnotationType}))}}An.__initStatic();const Sn=t,kn=e,On=i,{Typography:Tn}=n,{styled:Rn}=o,{color:Pn}=r,{Feedback:In}=r,{Collapsible:Mn}=r,{PreviewPrompt:Dn}=r,{UiLayout:zn}=r,Ln=l,Nn=On("@pie-ui:extended-text-entry"),$n=Rn(zn)({backgroundColor:Pn.background(),color:Pn.text()}),Wn=Rn(Tn)(({theme:t})=>({width:"100%",color:Pn.text(),marginBottom:t.spacing(2),fontSize:"inherit",display:"block"})),Un=Rn("div")(({theme:t})=>({marginBottom:t.spacing(2)})),Fn=Rn(Ln)(({theme:t})=>({marginBottom:t.spacing(2),borderRadius:"4px"})),Bn=Rn("h2")({position:"absolute",left:"-10000px",top:"auto",width:"1px",height:"1px",overflow:"hidden"});class Hn extends Sn.Component{constructor(...t){super(...t),Hn.prototype.__init.call(this),Hn.prototype.__init2.call(this)}static __initStatic(){this.propTypes={onValueChange:kn.func.isRequired,onAnnotationsChange:kn.func.isRequired,onCommentChange:kn.func.isRequired,model:kn.object,session:kn.shape({value:kn.string,annotations:kn.array,comment:kn.string}).isRequired}}__init(){this.changeSessionValue=Ne(this.props.onValueChange,1500)}__init2(){this.changeSessionComment=Ne(this.props.onCommentChange,1500)}render(){const{model:t,session:e,onAnnotationsChange:n}=this.props,{animationsDisabled:o,annotatorMode:r,customKeys:i,dimensions:a,disabled:s,disabledAnnotator:l,equationEditor:c,extraCSSRules:d,feedback:p,mathInput:u,playersToolbarPosition:h,predefinedAnnotations:f,prompt:b,spanishInput:y,specialInput:g,spellCheckEnabled:m,teacherInstructions:v}=t,{annotations:_,comment:x,value:C}=e,{width:j,height:w}=a||{},E="40vh",A={position:"top"===h?"top":"bottom"};Nn("[render] disabled? ",s);const S=Sn.createElement(Dn,{defaultClassName:"teacher-instructions",prompt:v}),k=[];return y&&k.push({language:"spanish"}),g&&k.push({language:"special"}),Sn.createElement($n,{extraCSSRules:d,ref:t=>{this.containerRef=t}},Sn.createElement(Bn,null,"Constructed Response Question"),v&&Sn.createElement(Un,null,o?S:Sn.createElement(Mn,{labels:{hidden:"Show Teacher Instructions",visible:"Hide Teacher Instructions"}},S)),b&&Sn.createElement(Wn,{component:"span"},Sn.createElement(Dn,{defaultClassName:"prompt",prompt:t.prompt})),r?Sn.createElement(An,{text:C||"",annotations:_||[],comment:x||"",predefinedAnnotations:f||[],onChange:n,onCommentChange:this.changeSessionComment,width:j,height:w,maxHeight:E,disabled:l,disabledMath:!u,customKeys:i,keypadMode:c}):Sn.createElement(Fn,{className:"response-area-editor",onChange:this.changeSessionValue,markup:C||"",maxWidth:j&&j.toString(),minWidth:"100px",minHeight:w&&w.toString(),maxHeight:E,disabled:s,highlightShape:!0,toolbarOpts:A,spellCheck:m,charactersLimit:5e4,autoWidthToolbar:!0,pluginProps:{math:{disabled:!u,customKeys:this.props.model.customKeys,keypadMode:this.props.model.equationEditor,controlledKeypadMode:!1},video:{disabled:!0},audio:{disabled:!0},table:{disabled:!0},textAlign:{disabled:!0},h3:{disabled:!0},separateParagraphs:{disabled:!1},ul_list:{disabled:!0},ol_list:{disabled:!0}},languageCharactersProps:k}),p&&Sn.createElement(In,{correctness:"correct",feedback:p}))}}Hn.__initStatic();const qn=t,{createRoot:Vn}=a,Kn=i,{renderMath:Gn}=s,Xn=Kn("pie-element:extended-text-entry:print"),Yn=(t,e)=>{const n="instructor"===e.role,o=Me(t,5);o.prompt=!1!==o.promptEnabled?o.prompt:void 0,o.teacherInstructions=n&&!1!==o.teacherInstructionsEnabled?o.teacherInstructions:void 0,o.showTeacherInstructions=n,o.mode=n?"evaluate":o.mode;return o.dimensions={height:100,width:500,...o.dimensions},o.disabled=!0,o.feedback=void 0,o.animationsDisabled=!0,o};class Qn extends HTMLElement{constructor(){super(),this._options=null,this._model=null,this._session=[],this._root=null,this._rerender=Ne(()=>{if(this._model&&this._session&&this._options){const t=Yn(this._model,this._options),e=qn.createElement(Hn,{model:t,session:{},onChange:()=>{},onValueChange:()=>{},onAnnotationsChange:()=>{},onCommentChange:()=>{}});this._root||(this._root=Vn(this)),this._root.render(e),queueMicrotask(()=>{Xn("render complete - render math"),Gn(this)})}else Xn("skip")},50,{leading:!1,trailing:!0})}set options(t){this._options=t,this._rerender()}set model(t){this._model=t,this._rerender()}connectedCallback(){}disconnectedCallback(){this._root&&this._root.unmount()}}export{Qn as default};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pie-element/extended-text-entry",
3
3
  "repository": "pie-framework/pie-elements",
4
- "version": "15.1.11",
4
+ "version": "15.2.0",
5
5
  "description": "",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -14,10 +14,10 @@
14
14
  "@mui/icons-material": "^7.3.4",
15
15
  "@mui/material": "^7.3.4",
16
16
  "@pie-framework/pie-player-events": "^0.1.0",
17
- "@pie-lib/config-ui": "13.0.15",
18
- "@pie-lib/editable-html-tip-tap": "2.1.13",
17
+ "@pie-lib/config-ui": "13.0.16",
18
+ "@pie-lib/editable-html-tip-tap": "2.1.14",
19
19
  "@pie-lib/math-rendering": "5.1.0",
20
- "@pie-lib/render-ui": "6.1.3",
20
+ "@pie-lib/render-ui": "7.0.0",
21
21
  "classnames": "^2.2.6",
22
22
  "debug": "^4.1.1",
23
23
  "lodash.throttle": "^4.1.1",
@@ -25,7 +25,7 @@
25
25
  "react": "18.3.1",
26
26
  "react-dom": "18.3.1"
27
27
  },
28
- "gitHead": "0f939adae5927fe0a54d21a4a98e224775562406",
28
+ "gitHead": "e299866c75466c3c3f12469e783c129c800f24fb",
29
29
  "scripts": {
30
30
  "postpublish": "../../scripts/postpublish"
31
31
  },