@pie-element/passage 6.2.0-next.8 → 6.2.0-next.9

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,17 @@
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
+ # [6.2.0-next.9](https://github.com/pie-framework/pie-elements/compare/@pie-element/passage@6.2.0-next.8...@pie-element/passage@6.2.0-next.9) (2026-04-24)
7
+
8
+ ### Bug Fixes
9
+
10
+ - bump dLl modules and libs PIE-171, PIE-133, PIE-151, PIE-130, PIE-147, PIE-168, PIE-425 ([6b02d2a](https://github.com/pie-framework/pie-elements/commit/6b02d2abfd4027569150d347ea9f7701ce634270))
11
+ - **stimulus-tabs:** simplify baseHeadingLevel checks in renderTab method ([500ea42](https://github.com/pie-framework/pie-elements/commit/500ea423912dc951bd517249ef3abf4c9fda463a))
12
+
13
+ ### Features
14
+
15
+ - **passage:** add heading level handling PIE-150 ([d5c95b5](https://github.com/pie-framework/pie-elements/commit/d5c95b50075df5d12f2f4fe7542028f788d7379d))
16
+
6
17
  # [6.2.0-next.8](https://github.com/pie-framework/pie-elements/compare/@pie-element/passage@6.2.0-next.7...@pie-element/passage@6.2.0-next.8) (2026-04-17)
7
18
 
8
19
  ### 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
+ # [4.2.0-next.8](https://github.com/pie-framework/pie-elements/compare/@pie-element/passage-configure@4.2.0-next.7...@pie-element/passage-configure@4.2.0-next.8) (2026-04-24)
7
+
8
+ ### Bug Fixes
9
+
10
+ - bump dLl modules and libs PIE-171, PIE-133, PIE-151, PIE-130, PIE-147, PIE-168, PIE-425 ([6b02d2a](https://github.com/pie-framework/pie-elements/commit/6b02d2abfd4027569150d347ea9f7701ce634270))
11
+
6
12
  # [4.2.0-next.7](https://github.com/pie-framework/pie-elements/compare/@pie-element/passage-configure@4.2.0-next.6...@pie-element/passage-configure@4.2.0-next.7) (2026-04-17)
7
13
 
8
14
  ### Bug Fixes
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pie-element/passage-configure",
3
3
  "private": true,
4
- "version": "4.2.0-next.7",
4
+ "version": "4.2.0-next.8",
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": "12.2.0-next.36",
17
- "@pie-lib/editable-html-tip-tap": "1.2.0-next.35",
16
+ "@pie-lib/config-ui": "12.2.0-next.37",
17
+ "@pie-lib/editable-html-tip-tap": "1.2.0-next.36",
18
18
  "lodash-es": "^4.17.23",
19
19
  "prop-types": "^15.8.1",
20
20
  "react": "18.3.1",
package/lib/index.js CHANGED
@@ -11,6 +11,22 @@ var _mathRendering = require("@pie-lib/math-rendering");
11
11
  var _react = _interopRequireDefault(require("react"));
12
12
  var _client = require("react-dom/client");
13
13
  var _stimulusTabs = _interopRequireDefault(require("./stimulus-tabs"));
14
+ function getBaseHeadingLevel(element) {
15
+ const player = element.closest('pie-player') || element.closest('pie-item-player');
16
+ if (player) {
17
+ let raw = player.baseHeadingLevel;
18
+
19
+ // fallback in case someone sets via HTML attribute manually
20
+ if (raw == null) {
21
+ raw = player.getAttribute('base-heading-level') ?? player.getAttribute('baseheadinglevel');
22
+ }
23
+ const playerLevel = parseInt(raw, 10);
24
+ if (Number.isFinite(playerLevel) && playerLevel >= 1 && playerLevel <= 6) {
25
+ return playerLevel;
26
+ }
27
+ }
28
+ return undefined;
29
+ }
14
30
  class PiePassage extends HTMLElement {
15
31
  constructor() {
16
32
  super();
@@ -40,6 +56,7 @@ class PiePassage extends HTMLElement {
40
56
  this._root = null;
41
57
  this._mathObserver = null;
42
58
  this._mathRenderPending = false;
59
+ this._playerObserver = null;
43
60
  }
44
61
  setLangAttribute() {
45
62
  const language = this._model && typeof this._model.language ? this._model.language : '';
@@ -73,6 +90,7 @@ class PiePassage extends HTMLElement {
73
90
  this.setAttribute('aria-label', 'Passage');
74
91
  this.setAttribute('role', 'region');
75
92
  this._initMathObserver();
93
+ this._initPlayerObserver();
76
94
  this._render();
77
95
  }
78
96
  _render() {
@@ -85,7 +103,9 @@ class PiePassage extends HTMLElement {
85
103
  ...passage
86
104
  }));
87
105
  const elem = /*#__PURE__*/_react.default.createElement(_stimulusTabs.default, {
88
- tabs: passagesTabs
106
+ tabs: passagesTabs,
107
+ model: this._model,
108
+ baseHeadingLevel: getBaseHeadingLevel(this)
89
109
  });
90
110
  if (!this._root) {
91
111
  this._root = (0, _client.createRoot)(this);
@@ -94,8 +114,26 @@ class PiePassage extends HTMLElement {
94
114
  this._initMathObserver();
95
115
  }
96
116
  }
117
+ _initPlayerObserver() {
118
+ const player = this.closest('pie-player') || this.closest('pie-item-player');
119
+ if (!player) return;
120
+ this._playerObserver = new MutationObserver(() => {
121
+ this._render();
122
+ });
123
+ this._playerObserver.observe(player, {
124
+ attributes: true,
125
+ attributeFilter: ['base-heading-level']
126
+ });
127
+ }
128
+ _disconnectPlayerObserver() {
129
+ if (this._playerObserver) {
130
+ this._playerObserver.disconnect();
131
+ this._playerObserver = null;
132
+ }
133
+ }
97
134
  disconnectedCallback() {
98
135
  this._disconnectMathObserver();
136
+ this._disconnectPlayerObserver();
99
137
  if (this._root) {
100
138
  this._root.unmount();
101
139
  }
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_piePlayerEvents","require","_mathRendering","_react","_interopRequireDefault","_client","_stimulusTabs","PiePassage","HTMLElement","constructor","_defineProperty2","default","_mathRenderPending","requestAnimationFrame","_mathObserver","disconnect","renderMath","setTimeout","observe","childList","subtree","_model","passages","_session","_root","setLangAttribute","language","lang","slice","setAttribute","_initMathObserver","MutationObserver","_scheduleMathRender","_disconnectMathObserver","model","s","dispatchEvent","ModelSetEvent","tagName","toLowerCase","_render","session","connectedCallback","length","passagesTabs","map","passage","index","id","elem","React","createElement","StimulusTabs","tabs","createRoot","render","disconnectedCallback","unmount","exports"],"sources":["../src/index.js"],"sourcesContent":["import { ModelSetEvent } from '@pie-framework/pie-player-events';\nimport { renderMath } from '@pie-lib/math-rendering';\nimport React from 'react';\nimport { createRoot } from 'react-dom/client';\n\nimport StimulusTabs from './stimulus-tabs';\n\nexport default class PiePassage extends HTMLElement {\n constructor() {\n super();\n this._model = {\n passages: [],\n };\n this._session = null;\n this._root = null;\n this._mathObserver = null;\n this._mathRenderPending = false;\n }\n\n setLangAttribute() {\n const language = this._model && typeof this._model.language ? this._model.language : '';\n const lang = language ? language.slice(0, 2) : 'en';\n this.setAttribute('lang', lang);\n }\n\n _scheduleMathRender = () => {\n if (this._mathRenderPending) return;\n this._mathRenderPending = true;\n\n requestAnimationFrame(() => {\n if (this._mathObserver) {\n this._mathObserver.disconnect();\n }\n renderMath(this);\n this._mathRenderPending = false;\n setTimeout(() => {\n if (this._mathObserver) {\n this._mathObserver.observe(this, { childList: true, subtree: true });\n }\n }, 50);\n });\n };\n\n _initMathObserver() {\n if (this._mathObserver) return;\n this._mathObserver = new MutationObserver(this._scheduleMathRender);\n this._mathObserver.observe(this, { childList: true, subtree: true });\n }\n\n _disconnectMathObserver() {\n if (this._mathObserver) {\n this._mathObserver.disconnect();\n this._mathObserver = null;\n }\n }\n\n set model(s) {\n this._model = s;\n this.dispatchEvent(new ModelSetEvent(this.tagName.toLowerCase(), this._session, !!this._model));\n this.setLangAttribute();\n\n this._render();\n }\n\n set session(s) {\n this._session = s;\n }\n\n connectedCallback() {\n this.setAttribute('aria-label', 'Passage');\n this.setAttribute('role', 'region');\n this._initMathObserver();\n this._render();\n }\n\n _render() {\n const { passages = [] } = this._model;\n\n if (this._model.passages.length > 0) {\n const passagesTabs = passages.map((passage, index) => ({\n id: index,\n ...passage,\n }));\n\n const elem = React.createElement(StimulusTabs, {\n tabs: passagesTabs,\n });\n\n if (!this._root) {\n this._root = createRoot(this);\n }\n this._root.render(elem);\n\n this._initMathObserver();\n }\n }\n\n disconnectedCallback() {\n this._disconnectMathObserver();\n if (this._root) {\n this._root.unmount();\n }\n }\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,gBAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAEA,IAAAK,aAAA,GAAAF,sBAAA,CAAAH,OAAA;AAEe,MAAMM,UAAU,SAASC,WAAW,CAAC;EAClDC,WAAWA,CAAA,EAAG;IACZ,KAAK,CAAC,CAAC;IAAC,IAAAC,gBAAA,CAAAC,OAAA,+BAgBY,MAAM;MAC1B,IAAI,IAAI,CAACC,kBAAkB,EAAE;MAC7B,IAAI,CAACA,kBAAkB,GAAG,IAAI;MAE9BC,qBAAqB,CAAC,MAAM;QAC1B,IAAI,IAAI,CAACC,aAAa,EAAE;UACtB,IAAI,CAACA,aAAa,CAACC,UAAU,CAAC,CAAC;QACjC;QACA,IAAAC,yBAAU,EAAC,IAAI,CAAC;QAChB,IAAI,CAACJ,kBAAkB,GAAG,KAAK;QAC/BK,UAAU,CAAC,MAAM;UACf,IAAI,IAAI,CAACH,aAAa,EAAE;YACtB,IAAI,CAACA,aAAa,CAACI,OAAO,CAAC,IAAI,EAAE;cAAEC,SAAS,EAAE,IAAI;cAAEC,OAAO,EAAE;YAAK,CAAC,CAAC;UACtE;QACF,CAAC,EAAE,EAAE,CAAC;MACR,CAAC,CAAC;IACJ,CAAC;IA/BC,IAAI,CAACC,MAAM,GAAG;MACZC,QAAQ,EAAE;IACZ,CAAC;IACD,IAAI,CAACC,QAAQ,GAAG,IAAI;IACpB,IAAI,CAACC,KAAK,GAAG,IAAI;IACjB,IAAI,CA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EACnB;EAEAO,iBAAiBA,CAAA,EAAG;IAClB,IAAI,CAACb,YAAY,CAAC,YAAY,EAAE,SAAS,CAAC;IAC1C,IAAI,CAACA,YAAY,CAAC,MAAM,EAAE,QAAQ,CAAC;IACnC,IAAI,CAACC,iBAAiB,CAAC,CAAC;IACxB,IAAI,CAACU,OAAO,CAAC,CAAC;EAChB;EAEAA,OAAOA,CAAA,EAAG;IACR,MAAM;MAAElB,QAAQ,GAAG;IAAG,CAAC,GAAG,IAAI,CAACD,MAAM;IAErC,IAAI,IAAI,CAACA,MAAM,CAACC,QAAQ,CAACqB,MAAM,GAAG,CAAC,EAAE;MACnC,MAAMC,YAAY,GAAGtB,QAAQ,CAACuB,GAAG,CAAC,CAACC,OAAO,EAAEC,KAAK,MAAM;QACrDC,EAAE,EAAED,KAAK;QACT,GAAGD;MACL,CAAC,CAAC,CAAC;MAEH,MAAMG,IAAI,gBAAGC,cAAK,CAACC,aAAa,CAACC,qBAAY,EAAE;QAC7CC,IAAI,EAAET;MACR,CAAC,CAAC;MAEF,IAAI,CAAC,IAAI,CAACpB,KAAK,EAAE;QACf,IAAI,CAACA,KAAK,GAAG,IAAA8B,kBAAU,EAAC,IAAI,CAAC;MAC/B;MACA,IAAI,CAAC9B,KAAK,CAAC+B,MAAM,CAACN,IAAI,CAAC;MAEvB,IAAI,CAACnB,iBAAiB,CAAC,CAAC;IAC1B;EACF;EAEA0B,oBAAoBA,CAAA,EAAG;IACrB,IAAI,CAACvB,uBAAuB,CAAC,CAAC;IAC9B,IAAI,IAAI,CAACT,KAAK,EAAE;MACd,IAAI,CAACA,KAAK,CAACiC,OAAO,CAAC,CAAC;IACtB;EACF;AACF;AAACC,OAAA,CAAA/C,OAAA,GAAAJ,UAAA","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["_piePlayerEvents","require","_mathRendering","_react","_interopRequireDefault","_client","_stimulusTabs","getBaseHeadingLevel","element","player","closest","raw","baseHeadingLevel","getAttribute","playerLevel","parseInt","Number","isFinite","undefined","PiePassage","HTMLElement","constructor","_defineProperty2","default","_mathRenderPending","requestAnimationFrame","_mathObserver","disconnect","renderMath","setTimeout","observe","childList","subtree","_model","passages","_session","_root","_playerObserver","setLangAttribute","language","lang","slice","setAttribute","_initMathObserver","MutationObserver","_scheduleMathRender","_disconnectMathObserver","model","s","dispatchEvent","ModelSetEvent","tagName","toLowerCase","_render","session","connectedCallback","_initPlayerObserver","length","passagesTabs","map","passage","index","id","elem","React","createElement","StimulusTabs","tabs","createRoot","render","attributes","attributeFilter","_disconnectPlayerObserver","disconnectedCallback","unmount","exports"],"sources":["../src/index.js"],"sourcesContent":["import { ModelSetEvent } from '@pie-framework/pie-player-events';\nimport { renderMath } from '@pie-lib/math-rendering';\nimport React from 'react';\nimport { createRoot } from 'react-dom/client';\n\nimport StimulusTabs from './stimulus-tabs';\n\nfunction getBaseHeadingLevel(element) {\n const player =\n element.closest('pie-player') ||\n element.closest('pie-item-player');\n\n if (player) {\n let raw = player.baseHeadingLevel;\n\n // fallback in case someone sets via HTML attribute manually\n if (raw == null) {\n raw =\n player.getAttribute('base-heading-level') ??\n player.getAttribute('baseheadinglevel');\n }\n\n const playerLevel = parseInt(raw, 10);\n\n if (Number.isFinite(playerLevel) && playerLevel >= 1 && playerLevel <= 6) {\n return playerLevel;\n }\n }\n\n return undefined;\n}\n\nexport default class PiePassage extends HTMLElement {\n constructor() {\n super();\n this._model = {\n passages: [],\n };\n this._session = null;\n this._root = null;\n this._mathObserver = null;\n this._mathRenderPending = false;\n this._playerObserver = null;\n }\n\n setLangAttribute() {\n const language = this._model && typeof this._model.language ? this._model.language : '';\n const lang = language ? language.slice(0, 2) : 'en';\n this.setAttribute('lang', lang);\n }\n\n _scheduleMathRender = () => {\n if (this._mathRenderPending) return;\n this._mathRenderPending = true;\n\n requestAnimationFrame(() => {\n if (this._mathObserver) {\n this._mathObserver.disconnect();\n }\n renderMath(this);\n this._mathRenderPending = false;\n setTimeout(() => {\n if (this._mathObserver) {\n this._mathObserver.observe(this, { childList: true, subtree: true });\n }\n }, 50);\n });\n };\n\n _initMathObserver() {\n if (this._mathObserver) return;\n this._mathObserver = new MutationObserver(this._scheduleMathRender);\n this._mathObserver.observe(this, { childList: true, subtree: true });\n }\n\n _disconnectMathObserver() {\n if (this._mathObserver) {\n this._mathObserver.disconnect();\n this._mathObserver = null;\n }\n }\n\n set model(s) {\n this._model = s;\n this.dispatchEvent(new ModelSetEvent(this.tagName.toLowerCase(), this._session, !!this._model));\n this.setLangAttribute();\n\n this._render();\n }\n\n set session(s) {\n this._session = s;\n }\n\n connectedCallback() {\n this.setAttribute('aria-label', 'Passage');\n this.setAttribute('role', 'region');\n this._initMathObserver();\n this._initPlayerObserver();\n this._render();\n }\n\n _render() {\n const { passages = [] } = this._model;\n\n if (this._model.passages.length > 0) {\n const passagesTabs = passages.map((passage, index) => ({\n id: index,\n ...passage,\n }));\n\n const elem = React.createElement(StimulusTabs, {\n tabs: passagesTabs,\n model: this._model,\n baseHeadingLevel: getBaseHeadingLevel(this),\n });\n\n if (!this._root) {\n this._root = createRoot(this);\n }\n this._root.render(elem);\n\n this._initMathObserver();\n }\n }\n\n _initPlayerObserver() {\n const player = this.closest('pie-player') || this.closest('pie-item-player');\n if (!player) return;\n\n this._playerObserver = new MutationObserver(() => {\n this._render();\n });\n this._playerObserver.observe(player, { attributes: true, attributeFilter: ['base-heading-level'] });\n }\n\n _disconnectPlayerObserver() {\n if (this._playerObserver) {\n this._playerObserver.disconnect();\n this._playerObserver = null;\n }\n }\n\n disconnectedCallback() {\n this._disconnectMathObserver();\n this._disconnectPlayerObserver();\n if (this._root) {\n this._root.unmount();\n }\n }\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,gBAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAEA,IAAAK,aAAA,GAAAF,sBAAA,CAAAH,OAA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AAG;IACpB,MAAM/C,MAAM,GAAG,IAAI,CAACC,OAAO,CAAC,YAAY,CAAC,IAAI,IAAI,CAACA,OAAO,CAAC,iBAAiB,CAAC;IAC5E,IAAI,CAACD,MAAM,EAAE;IAEb,IAAI,CAAC4B,eAAe,GAAG,IAAIO,gBAAgB,CAAC,MAAM;MAChD,IAAI,CAACS,OAAO,CAAC,CAAC;IAChB,CAAC,CAAC;IACF,IAAI,CAAChB,eAAe,CAACP,OAAO,CAACrB,MAAM,EAAE;MAAE6D,UAAU,EAAE,IAAI;MAAEC,eAAe,EAAE,CAAC,oBAAoB;IAAE,CAAC,CAAC;EACrG;EAEAC,yBAAyBA,CAAA,EAAG;IAC1B,IAAI,IAAI,CAACnC,eAAe,EAAE;MACxB,IAAI,CAACA,eAAe,CAACV,UAAU,CAAC,CAAC;MACjC,IAAI,CAACU,eAAe,GAAG,IAAI;IAC7B;EACF;EAEAoC,oBAAoBA,CAAA,EAAG;IACrB,IAAI,CAAC3B,uBAAuB,CAAC,CAAC;IAC9B,IAAI,CAAC0B,yBAAyB,CAAC,CAAC;IAChC,IAAI,IAAI,CAACpC,KAAK,EAAE;MACd,IAAI,CAACA,KAAK,CAACsC,OAAO,CAAC,CAAC;IACtB;EACF;AACF;AAACC,OAAA,CAAApD,OAAA,GAAAJ,UAAA","ignoreList":[]}
@@ -166,24 +166,31 @@ class StimulusTabs extends _react.default.Component {
166
166
  }, teacherInstructionsDiv);
167
167
  }
168
168
  renderTab(tab, disabledTabs) {
169
+ const {
170
+ baseHeadingLevel
171
+ } = this.props;
172
+ const clampedLevel = baseHeadingLevel ? Math.min(6, Math.max(1, baseHeadingLevel)) : undefined;
173
+ const TitleTag = baseHeadingLevel ? `h${clampedLevel}` : 'h2'; // default to h2 if no base level is provided - this was the previous behavior
174
+ const textLevel = baseHeadingLevel ? Math.min(6, Math.max(1, clampedLevel + 1)) : undefined; // promote text headings one level above title
175
+
169
176
  return /*#__PURE__*/_react.default.createElement(Passage, {
170
177
  key: tab.id,
171
178
  id: `tabpanel-${tab.id}`,
172
179
  role: "tabpanel",
173
180
  "aria-labelledby": `button-${tab.id}`
174
- }, this.renderInstructions(tab.teacherInstructions, disabledTabs), (tab.title || tab.subtitle) && /*#__PURE__*/_react.default.createElement("h2", null, tab.title && /*#__PURE__*/_react.default.createElement(_renderUi.Purpose, {
181
+ }, this.renderInstructions(tab.teacherInstructions, disabledTabs), tab.title && /*#__PURE__*/_react.default.createElement(_renderUi.Purpose, {
175
182
  purpose: "passage-title"
176
- }, /*#__PURE__*/_react.default.createElement(PassageTitle, {
183
+ }, /*#__PURE__*/_react.default.createElement(TitleTag, null, /*#__PURE__*/_react.default.createElement(PassageTitle, {
177
184
  dangerouslySetInnerHTML: {
178
185
  __html: this.parsedText(tab.title)
179
186
  }
180
- })), tab.subtitle && /*#__PURE__*/_react.default.createElement(_renderUi.Purpose, {
187
+ }))), tab.subtitle && /*#__PURE__*/_react.default.createElement(_renderUi.Purpose, {
181
188
  purpose: "passage-subtitle"
182
189
  }, /*#__PURE__*/_react.default.createElement(PassageSubtitle, {
183
190
  dangerouslySetInnerHTML: {
184
191
  __html: this.parsedText(tab.subtitle)
185
192
  }
186
- }))), tab.author && /*#__PURE__*/_react.default.createElement(_renderUi.Purpose, {
193
+ })), tab.author && /*#__PURE__*/_react.default.createElement(_renderUi.Purpose, {
187
194
  purpose: "passage-author"
188
195
  }, /*#__PURE__*/_react.default.createElement(PassageAuthor, {
189
196
  className: "author",
@@ -196,7 +203,7 @@ class StimulusTabs extends _react.default.Component {
196
203
  key: tab.id,
197
204
  className: "text",
198
205
  dangerouslySetInnerHTML: {
199
- __html: this.parsedText(tab.text)
206
+ __html: baseHeadingLevel ? (0, _renderUi.transformDataHeadings)(tab.text, textLevel) : tab.text
200
207
  }
201
208
  })));
202
209
  }
@@ -262,7 +269,8 @@ StimulusTabs.propTypes = {
262
269
  teacherInstructions: _propTypes.default.string
263
270
  }).isRequired).isRequired,
264
271
  disabledTabs: _propTypes.default.bool,
265
- model: _propTypes.default.object
272
+ model: _propTypes.default.object,
273
+ baseHeadingLevel: _propTypes.default.number
266
274
  };
267
275
  var _default = exports.default = StimulusTabs;
268
276
  //# sourceMappingURL=stimulus-tabs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"stimulus-tabs.js","names":["_react","_interopRequireDefault","require","_propTypes","_Tabs","_Tab","_styles","_renderUi","PassagesContainer","styled","flexGrow","backgroundColor","color","background","text","borderCollapse","padding","textAlign","Passage","theme","spacing","borderLeft","margin","PassageTitle","fontSize","PassageSubtitle","PassageAuthor","TabStyled","Tab","palette","common","white","fontFamily","opacity","black","StimulusTabs","React","Component","constructor","args","_defineProperty2","default","activeTab","event","setState","setTimeout","tabChangeEvent","CustomEvent","detail","tab","window","dispatchEvent","currentTabId","key","tabs","props","newTabIndex","currentIndex","findIndex","id","length","preventDefault","stopPropagation","handleChange","document","getElementById","focus","div","createElement","innerHTML","replace","audio","querySelector","source","setAttribute","getAttribute","removeAttribute","appendChild","renderInstructions","teacherInstructions","disabledTabs","teacherInstructionsDiv","PreviewPrompt","tagName","className","defaultClassName","prompt","Collapsible","labels","hidden","visible","renderTab","role","title","subtitle","Purpose","purpose","dangerouslySetInnerHTML","__html","parsedText","author","render","model","state","extraCSSRules","selectedTab","find","UiLayout","map","Fragment","sx","position","top","value","onChange","label","tabIndex","onKeyDown","handleKeyDown","propTypes","PropTypes","arrayOf","shape","number","isRequired","string","bool","object","_default","exports"],"sources":["../src/stimulus-tabs.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport Tabs from '@mui/material/Tabs';\nimport Tab from '@mui/material/Tab';\nimport { styled } from '@mui/material/styles';\nimport { Collapsible, color, PreviewPrompt, Purpose, UiLayout } from '@pie-lib/render-ui';\n\nconst PassagesContainer = styled('div')({\n flexGrow: 1,\n backgroundColor: color.background(),\n color: color.text(),\n '&:not(.MathJax) table': {\n borderCollapse: 'collapse',\n },\n '&:not(.MathJax) table td, &:not(.MathJax) table th': {\n padding: '.6em 1em',\n textAlign: 'left',\n },\n});\n\nconst Passage = styled('div')(({ theme }) => ({\n backgroundColor: color.background(),\n color: color.text(),\n padding: theme.spacing(2),\n '& blockquote': {\n background: '#f9f9f9',\n borderLeft: '5px solid #ccc',\n margin: '1.5em 10px',\n padding: '.5em 10px',\n },\n}));\n\nconst PassageTitle = styled('div')({\n fontSize: '1.75rem',\n});\n\nconst PassageSubtitle = styled('div')({\n fontSize: '1.5rem',\n});\n\nconst PassageAuthor = styled('div')({\n fontSize: '1.25rem',\n});\n\nconst TabStyled = styled(Tab)(({ theme }) => ({\n background: theme.palette.common.white, // replace with color.background() once PD-2801 is DONE\n fontSize: 'inherit',\n fontFamily: 'Roboto, sans-serif',\n opacity: 0.7,\n color: theme.palette.common.black, // remove when PD-2801 is DONE\n '&.Mui-selected': {\n opacity: 1,\n color: theme.palette.common.black,\n }\n}));\n\nclass StimulusTabs extends React.Component {\n state = {\n activeTab: 0,\n };\n\n handleChange = (event, activeTab) => {\n this.setState(() => ({ activeTab }));\n\n setTimeout(() => {\n const tabChangeEvent = new CustomEvent('pie-ui-passage-tabChanged', {\n detail: { tab: activeTab },\n });\n\n window.dispatchEvent(tabChangeEvent);\n });\n };\n\n handleKeyDown = (event, currentTabId) => {\n const { key } = event;\n const { tabs } = this.props;\n\n let newTabIndex = -1;\n const currentIndex = tabs.findIndex((tab) => tab.id === currentTabId);\n\n switch (key) {\n case 'ArrowRight':\n // Move to the next tab\n newTabIndex = (currentIndex + 1) % tabs.length;\n break;\n case 'ArrowLeft':\n // Move to the previous tab\n newTabIndex = (currentIndex - 1 + tabs.length) % tabs.length;\n break;\n // Commented out ArrowDown and ArrowUp for future vertical tab navigation\n // case 'ArrowDown':\n // // Move to the next tab (for vertical alignment)\n // newTabIndex = (currentIndex + 1) % tabs.length;\n // break;\n // case 'ArrowUp':\n // // Move to the previous tab (for vertical alignment)\n // newTabIndex = (currentIndex - 1 + tabs.length) % tabs.length;\n // break;\n case 'Home':\n // Move to the first tab\n newTabIndex = 0;\n break;\n case 'End':\n // Move to the last tab\n newTabIndex = tabs.length - 1;\n break;\n case 'Enter':\n case ' ':\n // Activate the current tab\n newTabIndex = currentIndex;\n break;\n default:\n break;\n }\n\n if (newTabIndex !== -1) {\n event.preventDefault();\n event.stopPropagation();\n this.handleChange(event, tabs[newTabIndex].id);\n document.getElementById(`button-${tabs[newTabIndex].id}`).focus();\n }\n };\n\n parsedText = (text = '') => {\n // fix imported audio content for Safari PD-1391\n const div = document.createElement('div');\n div.innerHTML = text.replace(/(<br\\/>\\n)/g, '<br/>');\n\n const audio = div.querySelector('audio');\n\n if (audio) {\n const source = document.createElement('source');\n\n source.setAttribute('type', 'audio/mp3');\n source.setAttribute('src', audio.getAttribute('src'));\n\n audio.removeAttribute('src');\n audio.appendChild(source);\n }\n\n return div.innerHTML;\n };\n\n renderInstructions(teacherInstructions, disabledTabs = false) {\n if (!teacherInstructions) {\n return;\n }\n\n const teacherInstructionsDiv = (\n <PreviewPrompt\n tagName=\"div\"\n className=\"prompt\"\n defaultClassName=\"teacher-instructions\"\n prompt={teacherInstructions}\n />\n );\n\n if (disabledTabs) {\n return teacherInstructionsDiv;\n }\n\n return (\n <Collapsible\n labels={{\n hidden: 'Show Teacher Instructions',\n visible: 'Hide Teacher Instructions',\n }}\n >\n {teacherInstructionsDiv}\n </Collapsible>\n );\n }\n\n renderTab(tab, disabledTabs) {\n return (\n <Passage key={tab.id} id={`tabpanel-${tab.id}`} role=\"tabpanel\" aria-labelledby={`button-${tab.id}`}>\n {this.renderInstructions(tab.teacherInstructions, disabledTabs)}\n\n {(tab.title || tab.subtitle) && (\n <h2>\n {tab.title && (\n <Purpose purpose=\"passage-title\">\n <PassageTitle dangerouslySetInnerHTML={{ __html: this.parsedText(tab.title) }}/>\n </Purpose>\n )}\n {tab.subtitle && (\n <Purpose purpose=\"passage-subtitle\">\n <PassageSubtitle dangerouslySetInnerHTML={{ __html: this.parsedText(tab.subtitle) }}\n />\n </Purpose>\n )}\n </h2>\n )}\n\n {tab.author && (\n <Purpose purpose=\"passage-author\">\n <PassageAuthor className=\"author\" dangerouslySetInnerHTML={{ __html: this.parsedText(tab.author) }}/>\n </Purpose>\n )}\n\n {tab.text && (\n <Purpose purpose=\"passage-text\">\n <div\n key={tab.id}\n className=\"text\"\n dangerouslySetInnerHTML={{ __html: this.parsedText(tab.text) }}\n />\n </Purpose>\n )}\n </Passage>\n );\n }\n\n render() {\n const { model, tabs, disabledTabs } = this.props;\n const { activeTab } = this.state;\n\n if (!tabs?.length) {\n return;\n }\n\n const { extraCSSRules } = model || {};\n const selectedTab = (tabs || []).find((tab) => tab.id === activeTab);\n\n return (\n <UiLayout extraCSSRules={extraCSSRules}>\n <PassagesContainer className=\"passages\">\n {disabledTabs || tabs.length === 1 ? (\n tabs.map((tab) => this.renderTab(tab, disabledTabs))\n ) : (\n <>\n <Tabs\n sx={{ \n position: 'sticky', \n top: 0, \n background: color.background(), \n color: color.text(),\n fontFamily: 'Roboto, sans-serif',\n '& .MuiTabs-indicator': {\n backgroundColor: '#f50057',\n }\n }}\n value={activeTab}\n onChange={this.handleChange}\n >\n {tabs.map((tab) => (\n <TabStyled\n key={tab.id}\n id={`button-${tab.id}`}\n label={\n <Purpose purpose=\"passage-label\">\n <span dangerouslySetInnerHTML={{ __html: this.parsedText(tab.label) }}/>\n </Purpose>\n }\n value={tab.id}\n tabIndex={activeTab === tab.id ? 0 : -1}\n aria-controls={`tabpanel-${tab.id}`}\n aria-selected={activeTab === tab.id}\n onKeyDown={(event) => this.handleKeyDown(event, tab.id)}\n />\n ))}\n </Tabs>\n {selectedTab ? this.renderTab(selectedTab, disabledTabs) : null}\n </>\n )}\n </PassagesContainer>\n </UiLayout>\n );\n }\n}\n\nStimulusTabs.propTypes = {\n tabs: PropTypes.arrayOf(\n PropTypes.shape({\n id: PropTypes.number.isRequired,\n label: PropTypes.string.isRequired,\n title: PropTypes.string.isRequired,\n subtitle: PropTypes.string,\n author: PropTypes.string,\n text: PropTypes.string.isRequired,\n teacherInstructions: PropTypes.string,\n }).isRequired,\n ).isRequired,\n disabledTabs: PropTypes.bool,\n model: PropTypes.object,\n};\n\nexport default StimulusTabs;\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,KAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,IAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AAEA,MAAMM,iBAAiB,GAAG,IAAAC,cAAM,EAAC,KAAK,CAAC,CAAC;EACtCC,QAAQ,EAAE,CAAC;EACXC,eAAe,EAAEC,eAAK,CAACC,UAAU,CAAC,CAAC;EACnCD,KAAK,EAAEA,eAAK,CAACE,IAAI,CAAC,CAAC;EACnB,uBAAuB,EAAE;IACvBC,cAAc,EAAE;EAClB,CAAC;EACD,oDAAoD,EAAE;IACpDC,OAAO,EAAE,UAAU;IACnBC,SAAS,EAAE;EACb;AACF,CAAC,CAAC;AAEF,MAAMC,OAAO,GAAG,IAAAT,cAAM,EAAC,KAAK,CAAC,CAAC,CAAC;EAAEU;AAAM,CAAC,MAAM;EAC5CR,eAAe,EAAEC,eAAK,CAACC,UAAU,CAAC,CAAC;EACnCD,KAAK,EAAEA,eAAK,CAACE,IAAI,CAAC,CAAC;EACnBE,OAAO,EAAEG,KAAK,CAACC,OAAO,CAAC,CAAC,CAAC;EACzB,cAAc,EAAE;IACdP,UAAU,EAAE,SAAS;IACrBQ,UAAU,EAAE,gBAAgB;IAC5BC,MAAM,EAAE,YAAY;IACpBN,OAAO,EAAE;EACX;AACF,CAAC,CAAC,CAAC;AAEH,MAAMO,YAAY,GAAG,IAAAd,cAAM,EAAC,KAAK,CAAC,CAAC;EACjCe,QAAQ,EAAE;AACZ,CAAC,CAAC;AAEF,MAAMC,eAAe,GAA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CAAC,GAAG,IAC3D,CAEa,CACX,CAAC;EAEf;AACF;AAEA7C,YAAY,CAACoF,SAAS,GAAG;EACvBjE,IAAI,EAAEkE,kBAAS,CAACC,OAAO,CACrBD,kBAAS,CAACE,KAAK,CAAC;IACd/D,EAAE,EAAE6D,kBAAS,CAACG,MAAM,CAACC,UAAU;IAC/BT,KAAK,EAAEK,kBAAS,CAACK,MAAM,CAACD,UAAU;IAClC/B,KAAK,EAAE2B,kBAAS,CAACK,MAAM,CAACD,UAAU;IAClC9B,QAAQ,EAAE0B,kBAAS,CAACK,MAAM;IAC1BzB,MAAM,EAAEoB,kBAAS,CAACK,MAAM;IACxB/G,IAAI,EAAE0G,kBAAS,CAACK,MAAM,CAACD,UAAU;IACjC7C,mBAAmB,EAAEyC,kBAAS,CAACK;EACjC,CAAC,CAAC,CAACD,UACL,CAAC,CAACA,UAAU;EACZ5C,YAAY,EAAEwC,kBAAS,CAACM,IAAI;EAC5BxB,KAAK,EAAEkB,kBAAS,CAACO;AACnB,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAxF,OAAA,GAEaN,YAAY","ignoreList":[]}
1
+ {"version":3,"file":"stimulus-tabs.js","names":["_react","_interopRequireDefault","require","_propTypes","_Tabs","_Tab","_styles","_renderUi","PassagesContainer","styled","flexGrow","backgroundColor","color","background","text","borderCollapse","padding","textAlign","Passage","theme","spacing","borderLeft","margin","PassageTitle","fontSize","PassageSubtitle","PassageAuthor","TabStyled","Tab","palette","common","white","fontFamily","opacity","black","StimulusTabs","React","Component","constructor","args","_defineProperty2","default","activeTab","event","setState","setTimeout","tabChangeEvent","CustomEvent","detail","tab","window","dispatchEvent","currentTabId","key","tabs","props","newTabIndex","currentIndex","findIndex","id","length","preventDefault","stopPropagation","handleChange","document","getElementById","focus","div","createElement","innerHTML","replace","audio","querySelector","source","setAttribute","getAttribute","removeAttribute","appendChild","renderInstructions","teacherInstructions","disabledTabs","teacherInstructionsDiv","PreviewPrompt","tagName","className","defaultClassName","prompt","Collapsible","labels","hidden","visible","renderTab","baseHeadingLevel","clampedLevel","Math","min","max","undefined","TitleTag","textLevel","role","title","Purpose","purpose","dangerouslySetInnerHTML","__html","parsedText","subtitle","author","transformDataHeadings","render","model","state","extraCSSRules","selectedTab","find","UiLayout","map","Fragment","sx","position","top","value","onChange","label","tabIndex","onKeyDown","handleKeyDown","propTypes","PropTypes","arrayOf","shape","number","isRequired","string","bool","object","_default","exports"],"sources":["../src/stimulus-tabs.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport Tabs from '@mui/material/Tabs';\nimport Tab from '@mui/material/Tab';\nimport { styled } from '@mui/material/styles';\nimport { Collapsible, color, PreviewPrompt, Purpose, UiLayout, transformDataHeadings } from '@pie-lib/render-ui';\n\nconst PassagesContainer = styled('div')({\n flexGrow: 1,\n backgroundColor: color.background(),\n color: color.text(),\n '&:not(.MathJax) table': {\n borderCollapse: 'collapse',\n },\n '&:not(.MathJax) table td, &:not(.MathJax) table th': {\n padding: '.6em 1em',\n textAlign: 'left',\n },\n});\n\nconst Passage = styled('div')(({ theme }) => ({\n backgroundColor: color.background(),\n color: color.text(),\n padding: theme.spacing(2),\n '& blockquote': {\n background: '#f9f9f9',\n borderLeft: '5px solid #ccc',\n margin: '1.5em 10px',\n padding: '.5em 10px',\n },\n}));\n\nconst PassageTitle = styled('div')({\n fontSize: '1.75rem',\n});\n\nconst PassageSubtitle = styled('div')({\n fontSize: '1.5rem',\n});\n\nconst PassageAuthor = styled('div')({\n fontSize: '1.25rem',\n});\n\nconst TabStyled = styled(Tab)(({ theme }) => ({\n background: theme.palette.common.white, // replace with color.background() once PD-2801 is DONE\n fontSize: 'inherit',\n fontFamily: 'Roboto, sans-serif',\n opacity: 0.7,\n color: theme.palette.common.black, // remove when PD-2801 is DONE\n '&.Mui-selected': {\n opacity: 1,\n color: theme.palette.common.black,\n }\n}));\n\nclass StimulusTabs extends React.Component {\n state = {\n activeTab: 0,\n };\n\n handleChange = (event, activeTab) => {\n this.setState(() => ({ activeTab }));\n\n setTimeout(() => {\n const tabChangeEvent = new CustomEvent('pie-ui-passage-tabChanged', {\n detail: { tab: activeTab },\n });\n\n window.dispatchEvent(tabChangeEvent);\n });\n };\n\n handleKeyDown = (event, currentTabId) => {\n const { key } = event;\n const { tabs } = this.props;\n\n let newTabIndex = -1;\n const currentIndex = tabs.findIndex((tab) => tab.id === currentTabId);\n\n switch (key) {\n case 'ArrowRight':\n // Move to the next tab\n newTabIndex = (currentIndex + 1) % tabs.length;\n break;\n case 'ArrowLeft':\n // Move to the previous tab\n newTabIndex = (currentIndex - 1 + tabs.length) % tabs.length;\n break;\n // Commented out ArrowDown and ArrowUp for future vertical tab navigation\n // case 'ArrowDown':\n // // Move to the next tab (for vertical alignment)\n // newTabIndex = (currentIndex + 1) % tabs.length;\n // break;\n // case 'ArrowUp':\n // // Move to the previous tab (for vertical alignment)\n // newTabIndex = (currentIndex - 1 + tabs.length) % tabs.length;\n // break;\n case 'Home':\n // Move to the first tab\n newTabIndex = 0;\n break;\n case 'End':\n // Move to the last tab\n newTabIndex = tabs.length - 1;\n break;\n case 'Enter':\n case ' ':\n // Activate the current tab\n newTabIndex = currentIndex;\n break;\n default:\n break;\n }\n\n if (newTabIndex !== -1) {\n event.preventDefault();\n event.stopPropagation();\n this.handleChange(event, tabs[newTabIndex].id);\n document.getElementById(`button-${tabs[newTabIndex].id}`).focus();\n }\n };\n\n parsedText = (text = '') => {\n // fix imported audio content for Safari PD-1391\n const div = document.createElement('div');\n div.innerHTML = text.replace(/(<br\\/>\\n)/g, '<br/>');\n\n const audio = div.querySelector('audio');\n\n if (audio) {\n const source = document.createElement('source');\n\n source.setAttribute('type', 'audio/mp3');\n source.setAttribute('src', audio.getAttribute('src'));\n\n audio.removeAttribute('src');\n audio.appendChild(source);\n }\n\n return div.innerHTML;\n };\n\n renderInstructions(teacherInstructions, disabledTabs = false) {\n if (!teacherInstructions) {\n return;\n }\n\n const teacherInstructionsDiv = (\n <PreviewPrompt\n tagName=\"div\"\n className=\"prompt\"\n defaultClassName=\"teacher-instructions\"\n prompt={teacherInstructions}\n />\n );\n\n if (disabledTabs) {\n return teacherInstructionsDiv;\n }\n\n return (\n <Collapsible\n labels={{\n hidden: 'Show Teacher Instructions',\n visible: 'Hide Teacher Instructions',\n }}\n >\n {teacherInstructionsDiv}\n </Collapsible>\n );\n }\n\n renderTab(tab, disabledTabs) {\n const { baseHeadingLevel } = this.props;\n const clampedLevel = baseHeadingLevel ? Math.min(6, Math.max(1, baseHeadingLevel)) : undefined;\n const TitleTag = baseHeadingLevel ? `h${clampedLevel}` : 'h2'; // default to h2 if no base level is provided - this was the previous behavior\n const textLevel = baseHeadingLevel ? Math.min(6, Math.max(1, clampedLevel + 1)) : undefined; // promote text headings one level above title\n\n return (\n <Passage key={tab.id} id={`tabpanel-${tab.id}`} role=\"tabpanel\" aria-labelledby={`button-${tab.id}`}>\n {this.renderInstructions(tab.teacherInstructions, disabledTabs)}\n\n {tab.title && (\n <Purpose purpose=\"passage-title\">\n <TitleTag>\n <PassageTitle dangerouslySetInnerHTML={{ __html: this.parsedText(tab.title) }} />\n </TitleTag>\n </Purpose>\n )}\n\n {tab.subtitle && (\n <Purpose purpose=\"passage-subtitle\">\n <PassageSubtitle dangerouslySetInnerHTML={{ __html: this.parsedText(tab.subtitle) }} />\n </Purpose>\n )}\n\n {tab.author && (\n <Purpose purpose=\"passage-author\">\n <PassageAuthor className=\"author\" dangerouslySetInnerHTML={{ __html: this.parsedText(tab.author) }}/>\n </Purpose>\n )}\n\n {tab.text && (\n <Purpose purpose=\"passage-text\">\n <div key={tab.id} className=\"text\" dangerouslySetInnerHTML={{ __html: baseHeadingLevel ? transformDataHeadings(tab.text, textLevel) : tab.text }} />\n </Purpose>\n )}\n </Passage>\n );\n }\n\n render() {\n const { model, tabs, disabledTabs } = this.props;\n const { activeTab } = this.state;\n\n if (!tabs?.length) {\n return;\n }\n\n const { extraCSSRules } = model || {};\n const selectedTab = (tabs || []).find((tab) => tab.id === activeTab);\n\n return (\n <UiLayout extraCSSRules={extraCSSRules}>\n <PassagesContainer className=\"passages\">\n {disabledTabs || tabs.length === 1 ? (\n tabs.map((tab) => this.renderTab(tab, disabledTabs))\n ) : (\n <>\n <Tabs\n sx={{ \n position: 'sticky', \n top: 0, \n background: color.background(), \n color: color.text(),\n fontFamily: 'Roboto, sans-serif',\n '& .MuiTabs-indicator': {\n backgroundColor: '#f50057',\n }\n }}\n value={activeTab}\n onChange={this.handleChange}\n >\n {tabs.map((tab) => (\n <TabStyled\n key={tab.id}\n id={`button-${tab.id}`}\n label={\n <Purpose purpose=\"passage-label\">\n <span dangerouslySetInnerHTML={{ __html: this.parsedText(tab.label) }}/>\n </Purpose>\n }\n value={tab.id}\n tabIndex={activeTab === tab.id ? 0 : -1}\n aria-controls={`tabpanel-${tab.id}`}\n aria-selected={activeTab === tab.id}\n onKeyDown={(event) => this.handleKeyDown(event, tab.id)}\n />\n ))}\n </Tabs>\n {selectedTab ? this.renderTab(selectedTab, disabledTabs) : null}\n </>\n )}\n </PassagesContainer>\n </UiLayout>\n );\n }\n}\n\nStimulusTabs.propTypes = {\n tabs: PropTypes.arrayOf(\n PropTypes.shape({\n id: PropTypes.number.isRequired,\n label: PropTypes.string.isRequired,\n title: PropTypes.string.isRequired,\n subtitle: PropTypes.string,\n author: PropTypes.string,\n text: PropTypes.string.isRequired,\n teacherInstructions: PropTypes.string,\n }).isRequired,\n ).isRequired,\n disabledTabs: PropTypes.bool,\n model: PropTypes.object,\n baseHeadingLevel: PropTypes.number,\n};\n\nexport default StimulusTabs;\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,KAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,IAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAA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AACpF,KAAK,EAAEM,GAAG,CAACU,EAAE;IAAE,CACzD,CACF,CACG,CAAC,EACNuD,WAAW,GAAG,IAAI,CAACvB,SAAS,CAACuB,WAAW,EAAElC,YAAY,CAAC,GAAG,IAC3D,CAEa,CACX,CAAC;EAEf;AACF;AAEA7C,YAAY,CAAC6F,SAAS,GAAG;EACvB1E,IAAI,EAAE2E,kBAAS,CAACC,OAAO,CACrBD,kBAAS,CAACE,KAAK,CAAC;IACdxE,EAAE,EAAEsE,kBAAS,CAACG,MAAM,CAACC,UAAU;IAC/BT,KAAK,EAAEK,kBAAS,CAACK,MAAM,CAACD,UAAU;IAClChC,KAAK,EAAE4B,kBAAS,CAACK,MAAM,CAACD,UAAU;IAClC1B,QAAQ,EAAEsB,kBAAS,CAACK,MAAM;IAC1B1B,MAAM,EAAEqB,kBAAS,CAACK,MAAM;IACxBxH,IAAI,EAAEmH,kBAAS,CAACK,MAAM,CAACD,UAAU;IACjCtD,mBAAmB,EAAEkD,kBAAS,CAACK;EACjC,CAAC,CAAC,CAACD,UACL,CAAC,CAACA,UAAU;EACZrD,YAAY,EAAEiD,kBAAS,CAACM,IAAI;EAC5BxB,KAAK,EAAEkB,kBAAS,CAACO,MAAM;EACvB5C,gBAAgB,EAAEqC,kBAAS,CAACG;AAC9B,CAAC;AAAC,IAAAK,QAAA,GAAAC,OAAA,CAAAjG,OAAA,GAEaN,YAAY","ignoreList":[]}
@@ -1 +1 @@
1
- import{_dll_react_dom as e,_dll_prop_types as t,_dll_mui__material_styles as a,_dll_react as n,_dll_mui__material as i,_dll_mui__icons_material as s}from"../../../@pie-lib/shared-module@^4.1.0/module/index.js";import{_dll_pie_lib__config_ui as l}from"../../../@pie-lib/config-module@^3.1.0/module/index.js";import{_dll_pie_lib__editable_html_tip_tap as o}from"../../../@pie-lib/editable-html-module@^6.2.0/module/index.js";var r,d=e;r=d.createRoot,d.hydrateRoot;var u={};Object.defineProperty(u,"__esModule",{value:!0});class c extends CustomEvent{constructor(e,t=!1){super(c.TYPE,{bubbles:!0,detail:{update:e,reset:t}}),this.update=e,this.reset=t}}c.TYPE="model.updated";var g=u.ModelUpdatedEvent=c;class p extends CustomEvent{constructor(e,t){super(p.TYPE,{bubbles:!0,detail:{src:e,done:t}}),this.src=e,this.done=t}}p.TYPE="delete.image";var h=u.DeleteImageEvent=p;class m extends CustomEvent{constructor(e){super(m.TYPE,{bubbles:!0,detail:e}),this.handler=e}}m.TYPE="insert.image";var b=u.InsertImageEvent=m;class _ extends CustomEvent{constructor(e,t){super(_.TYPE,{bubbles:!0,detail:{src:e,done:t}}),this.src=e,this.done=t}}_.TYPE="delete.sound";var C=u.DeleteSoundEvent=_;class E extends CustomEvent{constructor(e){super(E.TYPE,{bubbles:!0,detail:e}),this.handler=e}}E.TYPE="insert.sound";var f=u.InsertSoundEvent=E;const x=n,S=t,{styled:I}=a,{Button:v}=i,{Dialog:P}=i,{DialogTitle:y}=i,{DialogContent:T}=i,{DialogContentText:R}=i,{DialogActions:q}=i,{RemoveCircle:D}=s,{AddCircle:k}=s,A=I(({label:e,type:t="add",onClick:a})=>{const n="add"===t?k:D;return x.createElement(v,{color:"primary",size:"small",onClick:a},x.createElement(n,{fontSize:"small",color:"primary",style:{marginRight:4}}),e)})({textDecoration:"underline","&:hover":{textDecoration:"underline",backgroundColor:"transparent"},display:"flex",alignItems:"center"}),M=({content:e,cancel:t,title:a,ok:n,open:i,onOk:s,onCancel:l})=>x.createElement(P,{open:i},x.createElement(y,null,a),x.createElement(T,null,x.createElement(R,null,e)),x.createElement(q,null,s&&x.createElement(v,{onClick:s,color:"primary"},n),l&&x.createElement(v,{onClick:l,color:"primary"},t)));M.propTypes={content:S.string.isRequired,title:S.string.isRequired,cancel:S.string.isRequired,ok:S.string.isRequired,open:S.bool.isRequired,onCancel:S.func.isRequired,onOk:S.func.isRequired};const w=n,j=t,{styled:O}=a,{InputContainer:Y}=l,L=o,{ALL_PLUGINS:H}=o;function W(e){let t,a=e[0],n=1;for(;n<e.length;){const i=e[n],s=e[n+1];if(n+=2,("optionalAccess"===i||"optionalCall"===i)&&null==a)return;"access"===i||"optionalAccess"===i?(t=a,a=s(a)):"call"!==i&&"optionalCall"!==i||(a=s((...e)=>a.call(t,...e)),t=void 0)}return a}const z=O(Y)(({theme:e})=>({paddingTop:e.spacing(2),marginBottom:e.spacing(2),width:"100%"})),B=O("div")(({theme:e})=>({fontSize:e.typography.fontSize-2,color:e.palette.error.main,paddingTop:e.spacing(1)}));class $ extends w.Component{static __initStatic(){this.propTypes={onModelChanged:j.func.isRequired,model:j.object.isRequired,configuration:j.object.isRequired,imageSupport:j.object.isRequired,passageIndex:j.number.isRequired,uploadSoundSupport:j.object.isRequired}}static __initStatic2(){this.defaultProps={passageIndex:0}}constructor(e){super(e),$.prototype.__init.call(this)}__init(){this.handleChange=(e,t)=>{const{model:a,onModelChanged:n,passageIndex:i}=this.props;if(!a.passages||i<0||i>=a.passages.length)return;const s=[...a.passages];s[i]={...s[i],[e]:t},n({...a,passages:s})}}render(){const{model:e,configuration:t,imageSupport:a,passageIndex:n,uploadSoundSupport:i}=this.props,{maxImageWidth:s={},maxImageHeight:l={},mathMlOptions:o={},baseInputConfiguration:r={},teacherInstructions:d={},title:u={},subtitle:c={},text:g={},author:p={}}=t||{},{errors:h={},passages:m=[],teacherInstructionsEnabled:b,titleEnabled:_,subtitleEnabled:C,authorEnabled:E,textEnabled:f}=e||{},{passages:x}=h||{},{teacherInstructions:S,title:I,subtitle:v,author:P,text:y}=x&&x[n]||{},T=s&&s.prompt,R=l&&l.prompt,q=e=>({...r,...e}),D=(H||[]).filter(e=>!["math","table","bulleted-list","numbered-list"].includes(e));return w.createElement(w.Fragment,null,b&&w.createElement(z,{label:d.label},w.createElement(L,{activePlugins:H,markup:m[n].teacherInstructions||"",onChange:e=>this.handleChange("teacherInstructions",e),nonEmpty:!1,error:S,maxImageWidth:s&&s.teacherInstructions||T,maxImageHeight:l&&l.teacherInstructions||R,mathMlOptions:o,languageCharactersProps:[{language:"spanish"},{language:"special"}],pluginProps:q(W([d,"optionalAccess",e=>e.inputConfiguration]))}),S&&w.createElement(B,null,S)),_&&w.createElement(z,{label:u.label},w.createElement(L,{activePlugins:D,markup:m[n].title||"",onChange:e=>this.handleChange("title",e),nonEmpty:!1,error:I,mathMlOptions:o,languageCharactersProps:[{language:"spanish"},{language:"special"}],pluginProps:q(W([u,"optionalAccess",e=>e.inputConfiguration]))}),I&&w.createElement(B,null,I)),C&&w.createElement(z,{label:c.label},w.createElement(L,{activePlugins:D,markup:m[n].subtitle||"",onChange:e=>this.handleChange("subtitle",e),nonEmpty:!1,error:v,mathMlOptions:o,languageCharactersProps:[{language:"spanish"},{language:"special"}],pluginProps:q(W([c,"optionalAccess",e=>e.inputConfiguration]))}),v&&w.createElement(B,null,v)),E&&w.createElement(z,{label:p.label},w.createElement(L,{activePlugins:D,markup:m[n].author||"",onChange:e=>this.handleChange("author",e),nonEmpty:!1,error:P,mathMlOptions:o,languageCharactersProps:[{language:"spanish"},{language:"special"}],pluginProps:q(W([p,"optionalAccess",e=>e.inputConfiguration]))}),P&&w.createElement(B,null,P)),f&&w.createElement(z,{label:g.label},w.createElement(L,{activePlugins:H,markup:m[n].text||"",onChange:e=>this.handleChange("text",e),imageSupport:a,uploadSoundSupport:i,nonEmpty:!1,error:y,maxImageWidth:s&&s.text||T,maxImageHeight:l&&l.text||R,mathMlOptions:o,languageCharactersProps:[{language:"spanish"},{language:"special"}],pluginProps:q(W([g,"optionalAccess",e=>e.inputConfiguration]))}),y&&w.createElement(B,null,y)))}}$.__initStatic(),$.__initStatic2();const F=n,U=t,{styled:G}=a,{Typography:N}=i,{settings:J}=l,{layout:K}=l,{Panel:Q,toggle:V,dropdown:X}=J,Z=G(N)(({theme:e})=>({paddingTop:e.spacing(2),marginBottom:e.spacing(2)}));class ee extends F.Component{static __initStatic(){this.propTypes={onModelChanged:U.func.isRequired,onConfigurationChanged:U.func,model:U.object.isRequired,configuration:U.object.isRequired,imageSupport:U.object.isRequired,uploadSoundSupport:U.object.isRequired,classes:U.object.isRequired}}constructor(e){super(e),ee.prototype.__init.call(this),ee.prototype.__init2.call(this),ee.prototype.__init3.call(this),ee.prototype.__init4.call(this),this.state={showConfirmationDialog:!1,indexToRemove:-1}}__init(){this.getInnerText=e=>(e||"").replaceAll(/<[^>]*>/g,"")}__init2(){this.onDelete=(e,t,a)=>{let n=e.passages;n.splice(t,1),a({...e,passages:n}),this.setState({showConfirmationDialog:!1,indexToRemove:-1})}}__init3(){this.removeAdditionalPassage=e=>{const{model:t={},onModelChanged:a}=this.props,{passages:n=[]}=t,{teacherInstructions:i="",title:s="",subtitle:l="",author:o="",text:r=""}=n[e];this.getInnerText(i).trim()||this.getInnerText(s).trim()||this.getInnerText(l).trim()||this.getInnerText(o).trim()||this.getInnerText(r).trim()?this.setState({showConfirmationDialog:!0,indexToRemove:e}):this.onDelete(t,e,a)}}__init4(){this.addAdditionalPassage=()=>{const{model:e,onModelChanged:t}=this.props,a=[...e.passages,{teacherInstructions:"",title:"",subtitle:"",author:"",text:""}];t({...e,passages:a})}}render(){const{model:e,configuration:t,imageSupport:a,onConfigurationChanged:n,onModelChanged:i,uploadSoundSupport:s}=this.props,{settingsPanelDisabled:l,language:o={},languageChoices:r={},teacherInstructions:d={},title:u={},subtitle:c={},text:g={},author:p={},additionalPassage:h={}}=t||{},{extraCSSRules:m,passages:b}=e||{},_={titleEnabled:u&&u.settings&&V(u.label),subtitleEnabled:c&&c.settings&&V(c.label),authorEnabled:p&&p.settings&&V(p.label),textEnabled:g&&g.settings&&V(g.label),"additionalPassage.enabled":h&&h.settings&&V(h.label,!0)},C={teacherInstructionsEnabled:d&&d.settings&&V(d.label),"language.enabled":o&&o.settings&&V(o.label,!0),language:o&&o.settings&&o.enabled&&X(r.label,r.options)},E=`${h.label} will be deleted`,{indexToRemove:f,showConfirmationDialog:x}=this.state;return F.createElement(K.ConfigLayout,{extraCSSRules:m,hideSettings:l,settings:F.createElement(Q,{model:e,configuration:t,onChangeModel:e=>i(e),onChangeConfiguration:e=>n(e),groups:{Settings:_,Properties:C}})},b.map((n,l)=>F.createElement(F.Fragment,{key:l},l>0&&F.createElement(Z,{variant:"h5"},h.label),F.createElement($,{imageSupport:a,uploadSoundSupport:s,model:e,configuration:t,passageIndex:l,onModelChanged:i}),l>0&&h.enabled&&F.createElement(A,{type:"remove",label:`Remove ${h.label}`,onClick:()=>this.removeAdditionalPassage(l)}),0===l&&h.enabled&&b.length<2&&F.createElement(A,{label:`Add ${h.label}`,onClick:this.addAdditionalPassage}))),F.createElement(M,{open:x,title:"Warning",content:E,cancel:"Cancel",ok:"Ok",onCancel:()=>this.setState({showConfirmationDialog:!1}),onOk:()=>this.onDelete(e,f,i)}))}}ee.__initStatic();var te={authorEnabled:!0,passages:[{teacherInstructions:"",title:"",subtitle:"",author:"",text:""}],subtitleEnabled:!0,teacherInstructionsEnabled:!0,textEnabled:!0,titleEnabled:!0},ae={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}},settingsPanelDisabled:!1,title:{settings:!0,label:"Title",inputConfiguration:{audio:{disabled:!0},video:{disabled:!0},image:{disabled:!0},textAlign:{disabled:!1}},required:!0},subtitle:{settings:!0,label:"Subtitle",inputConfiguration:{audio:{disabled:!0},video:{disabled:!0},image:{disabled:!0},textAlign:{disabled:!1}},required:!1},author:{settings:!0,label:"Author",inputConfiguration:{audio:{disabled:!0},video:{disabled:!0},image:{disabled:!0}},required:!1},text:{settings:!0,label:"Text",inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1},h3:{disabled:!1},blockquote:{disabled:!1},textAlign:{disabled:!1}},required:!0},teacherInstructions:{settings:!0,label:"Teacher Instructions",inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1}},required:!1},maxImageWidth:{teacherInstructions:300,text:300},maxImageHeight:{teacherInstructions:300,text:300},mathMlOptions:{mmlOutput:!1,mmlEditing:!1},language:{settings:!1,label:"Specify Language",enabled:!1},languageChoices:{label:"Language Choices",options:[]},additionalPassage:{settings:!0,label:"Additional Passage",enabled:!1}};const ne=n;class ie extends HTMLElement{static __initStatic(){this.createDefaultModel=(e={})=>({...te,...e})}constructor(){super(),this._root=null,this._model=ie.createDefaultModel(),this._configuration=ae}set model(e){this._model=ie.createDefaultModel(e),this.render()}set configuration(e){this._configuration=e,this.render()}connectedCallback(){this.render()}modelChanged(e){this._model=e,this.dispatchEvent(new g(this._model),!0),this.render()}onConfigurationChanged(e){this._configuration=e,this.render()}insertImage(e){this.dispatchEvent(new b(e))}onDeleteImage(e,t){this.dispatchEvent(new h(e,t))}insertSound(e){this.dispatchEvent(new f(e))}onDeleteSound(e,t){this.dispatchEvent(new C(e,t))}render(){if(this._model){const e=ne.createElement(ee,{model:this._model,configuration:this._configuration,onModelChanged:this.modelChanged.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=r(this)),this._root.render(e)}}disconnectedCallback(){this._root&&this._root.unmount()}}ie.__initStatic();export{ie as default};
1
+ import{_dll_prop_types as e,_dll_mui__material_styles as t,_dll_react as a,_dll_mui__material as n,_dll_mui__icons_material as i,_dll_react_dom_client as s}from"../../../@pie-lib/shared-module@^4.1.3/module/index.js";import{_dll_pie_lib__config_ui as l}from"../../../@pie-lib/config-module@^3.1.3/module/index.js";import{_dll_pie_lib__editable_html_tip_tap as o}from"../../../@pie-lib/editable-html-module@^6.2.3/module/index.js";var r={};Object.defineProperty(r,"__esModule",{value:!0});class d extends CustomEvent{constructor(e,t=!1){super(d.TYPE,{bubbles:!0,detail:{update:e,reset:t}}),this.update=e,this.reset=t}}d.TYPE="model.updated";var u=r.ModelUpdatedEvent=d;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 g=r.DeleteImageEvent=c;class p extends CustomEvent{constructor(e){super(p.TYPE,{bubbles:!0,detail:e}),this.handler=e}}p.TYPE="insert.image";var h=r.InsertImageEvent=p;class m extends CustomEvent{constructor(e,t){super(m.TYPE,{bubbles:!0,detail:{src:e,done:t}}),this.src=e,this.done=t}}m.TYPE="delete.sound";var b=r.DeleteSoundEvent=m;class _ extends CustomEvent{constructor(e){super(_.TYPE,{bubbles:!0,detail:e}),this.handler=e}}_.TYPE="insert.sound";var C=r.InsertSoundEvent=_;const E=a,f=e,{styled:x}=t,{Button:S}=n,{Dialog:I}=n,{DialogTitle:v}=n,{DialogContent:P}=n,{DialogContentText:y}=n,{DialogActions:T}=n,{RemoveCircle:R}=i,{AddCircle:q}=i,D=x(({label:e,type:t="add",onClick:a})=>{const n="add"===t?q:R;return E.createElement(S,{color:"primary",size:"small",onClick:a},E.createElement(n,{fontSize:"small",color:"primary",style:{marginRight:4}}),e)})({textDecoration:"underline","&:hover":{textDecoration:"underline",backgroundColor:"transparent"},display:"flex",alignItems:"center"}),k=({content:e,cancel:t,title:a,ok:n,open:i,onOk:s,onCancel:l})=>E.createElement(I,{open:i},E.createElement(v,null,a),E.createElement(P,null,E.createElement(y,null,e)),E.createElement(T,null,s&&E.createElement(S,{onClick:s,color:"primary"},n),l&&E.createElement(S,{onClick:l,color:"primary"},t)));k.propTypes={content:f.string.isRequired,title:f.string.isRequired,cancel:f.string.isRequired,ok:f.string.isRequired,open:f.bool.isRequired,onCancel:f.func.isRequired,onOk:f.func.isRequired};const A=a,M=e,{styled:w}=t,{InputContainer:j}=l,O=o,{ALL_PLUGINS:Y}=o;function L(e){let t,a=e[0],n=1;for(;n<e.length;){const i=e[n],s=e[n+1];if(n+=2,("optionalAccess"===i||"optionalCall"===i)&&null==a)return;"access"===i||"optionalAccess"===i?(t=a,a=s(a)):"call"!==i&&"optionalCall"!==i||(a=s((...e)=>a.call(t,...e)),t=void 0)}return a}const H=w(j)(({theme:e})=>({paddingTop:e.spacing(2),marginBottom:e.spacing(2),width:"100%"})),W=w("div")(({theme:e})=>({fontSize:e.typography.fontSize-2,color:e.palette.error.main,paddingTop:e.spacing(1)}));class z extends A.Component{static __initStatic(){this.propTypes={onModelChanged:M.func.isRequired,model:M.object.isRequired,configuration:M.object.isRequired,imageSupport:M.object.isRequired,passageIndex:M.number.isRequired,uploadSoundSupport:M.object.isRequired}}static __initStatic2(){this.defaultProps={passageIndex:0}}constructor(e){super(e),z.prototype.__init.call(this)}__init(){this.handleChange=(e,t)=>{const{model:a,onModelChanged:n,passageIndex:i}=this.props;if(!a.passages||i<0||i>=a.passages.length)return;const s=[...a.passages];s[i]={...s[i],[e]:t},n({...a,passages:s})}}render(){const{model:e,configuration:t,imageSupport:a,passageIndex:n,uploadSoundSupport:i}=this.props,{maxImageWidth:s={},maxImageHeight:l={},mathMlOptions:o={},baseInputConfiguration:r={},teacherInstructions:d={},title:u={},subtitle:c={},text:g={},author:p={}}=t||{},{errors:h={},passages:m=[],teacherInstructionsEnabled:b,titleEnabled:_,subtitleEnabled:C,authorEnabled:E,textEnabled:f}=e||{},{passages:x}=h||{},{teacherInstructions:S,title:I,subtitle:v,author:P,text:y}=x&&x[n]||{},T=s&&s.prompt,R=l&&l.prompt,q=e=>({...r,...e}),D=(Y||[]).filter(e=>!["math","table","bulleted-list","numbered-list"].includes(e));return A.createElement(A.Fragment,null,b&&A.createElement(H,{label:d.label},A.createElement(O,{activePlugins:Y,markup:m[n].teacherInstructions||"",onChange:e=>this.handleChange("teacherInstructions",e),nonEmpty:!1,error:S,maxImageWidth:s&&s.teacherInstructions||T,maxImageHeight:l&&l.teacherInstructions||R,mathMlOptions:o,languageCharactersProps:[{language:"spanish"},{language:"special"}],pluginProps:q(L([d,"optionalAccess",e=>e.inputConfiguration]))}),S&&A.createElement(W,null,S)),_&&A.createElement(H,{label:u.label},A.createElement(O,{activePlugins:D,markup:m[n].title||"",onChange:e=>this.handleChange("title",e),nonEmpty:!1,error:I,mathMlOptions:o,languageCharactersProps:[{language:"spanish"},{language:"special"}],pluginProps:q(L([u,"optionalAccess",e=>e.inputConfiguration]))}),I&&A.createElement(W,null,I)),C&&A.createElement(H,{label:c.label},A.createElement(O,{activePlugins:D,markup:m[n].subtitle||"",onChange:e=>this.handleChange("subtitle",e),nonEmpty:!1,error:v,mathMlOptions:o,languageCharactersProps:[{language:"spanish"},{language:"special"}],pluginProps:q(L([c,"optionalAccess",e=>e.inputConfiguration]))}),v&&A.createElement(W,null,v)),E&&A.createElement(H,{label:p.label},A.createElement(O,{activePlugins:D,markup:m[n].author||"",onChange:e=>this.handleChange("author",e),nonEmpty:!1,error:P,mathMlOptions:o,languageCharactersProps:[{language:"spanish"},{language:"special"}],pluginProps:q(L([p,"optionalAccess",e=>e.inputConfiguration]))}),P&&A.createElement(W,null,P)),f&&A.createElement(H,{label:g.label},A.createElement(O,{activePlugins:Y,markup:m[n].text||"",onChange:e=>this.handleChange("text",e),imageSupport:a,uploadSoundSupport:i,nonEmpty:!1,error:y,maxImageWidth:s&&s.text||T,maxImageHeight:l&&l.text||R,mathMlOptions:o,languageCharactersProps:[{language:"spanish"},{language:"special"}],pluginProps:q(L([g,"optionalAccess",e=>e.inputConfiguration]))}),y&&A.createElement(W,null,y)))}}z.__initStatic(),z.__initStatic2();const B=a,$=e,{styled:F}=t,{Typography:U}=n,{settings:G}=l,{layout:N}=l,{Panel:J,toggle:K,dropdown:Q}=G,V=F(U)(({theme:e})=>({paddingTop:e.spacing(2),marginBottom:e.spacing(2)}));class X extends B.Component{static __initStatic(){this.propTypes={onModelChanged:$.func.isRequired,onConfigurationChanged:$.func,model:$.object.isRequired,configuration:$.object.isRequired,imageSupport:$.object.isRequired,uploadSoundSupport:$.object.isRequired,classes:$.object.isRequired}}constructor(e){super(e),X.prototype.__init.call(this),X.prototype.__init2.call(this),X.prototype.__init3.call(this),X.prototype.__init4.call(this),this.state={showConfirmationDialog:!1,indexToRemove:-1}}__init(){this.getInnerText=e=>(e||"").replaceAll(/<[^>]*>/g,"")}__init2(){this.onDelete=(e,t,a)=>{let n=e.passages;n.splice(t,1),a({...e,passages:n}),this.setState({showConfirmationDialog:!1,indexToRemove:-1})}}__init3(){this.removeAdditionalPassage=e=>{const{model:t={},onModelChanged:a}=this.props,{passages:n=[]}=t,{teacherInstructions:i="",title:s="",subtitle:l="",author:o="",text:r=""}=n[e];this.getInnerText(i).trim()||this.getInnerText(s).trim()||this.getInnerText(l).trim()||this.getInnerText(o).trim()||this.getInnerText(r).trim()?this.setState({showConfirmationDialog:!0,indexToRemove:e}):this.onDelete(t,e,a)}}__init4(){this.addAdditionalPassage=()=>{const{model:e,onModelChanged:t}=this.props,a=[...e.passages,{teacherInstructions:"",title:"",subtitle:"",author:"",text:""}];t({...e,passages:a})}}render(){const{model:e,configuration:t,imageSupport:a,onConfigurationChanged:n,onModelChanged:i,uploadSoundSupport:s}=this.props,{settingsPanelDisabled:l,language:o={},languageChoices:r={},teacherInstructions:d={},title:u={},subtitle:c={},text:g={},author:p={},additionalPassage:h={}}=t||{},{extraCSSRules:m,passages:b}=e||{},_={titleEnabled:u&&u.settings&&K(u.label),subtitleEnabled:c&&c.settings&&K(c.label),authorEnabled:p&&p.settings&&K(p.label),textEnabled:g&&g.settings&&K(g.label),"additionalPassage.enabled":h&&h.settings&&K(h.label,!0)},C={teacherInstructionsEnabled:d&&d.settings&&K(d.label),"language.enabled":o&&o.settings&&K(o.label,!0),language:o&&o.settings&&o.enabled&&Q(r.label,r.options)},E=`${h.label} will be deleted`,{indexToRemove:f,showConfirmationDialog:x}=this.state;return B.createElement(N.ConfigLayout,{extraCSSRules:m,hideSettings:l,settings:B.createElement(J,{model:e,configuration:t,onChangeModel:e=>i(e),onChangeConfiguration:e=>n(e),groups:{Settings:_,Properties:C}})},b.map((n,l)=>B.createElement(B.Fragment,{key:l},l>0&&B.createElement(V,{variant:"h5"},h.label),B.createElement(z,{imageSupport:a,uploadSoundSupport:s,model:e,configuration:t,passageIndex:l,onModelChanged:i}),l>0&&h.enabled&&B.createElement(D,{type:"remove",label:`Remove ${h.label}`,onClick:()=>this.removeAdditionalPassage(l)}),0===l&&h.enabled&&b.length<2&&B.createElement(D,{label:`Add ${h.label}`,onClick:this.addAdditionalPassage}))),B.createElement(k,{open:x,title:"Warning",content:E,cancel:"Cancel",ok:"Ok",onCancel:()=>this.setState({showConfirmationDialog:!1}),onOk:()=>this.onDelete(e,f,i)}))}}X.__initStatic();var Z={authorEnabled:!0,passages:[{teacherInstructions:"",title:"",subtitle:"",author:"",text:""}],subtitleEnabled:!0,teacherInstructionsEnabled:!0,textEnabled:!0,titleEnabled:!0},ee={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}},settingsPanelDisabled:!1,title:{settings:!0,label:"Title",inputConfiguration:{audio:{disabled:!0},video:{disabled:!0},image:{disabled:!0},textAlign:{disabled:!1}},required:!0},subtitle:{settings:!0,label:"Subtitle",inputConfiguration:{audio:{disabled:!0},video:{disabled:!0},image:{disabled:!0},textAlign:{disabled:!1}},required:!1},author:{settings:!0,label:"Author",inputConfiguration:{audio:{disabled:!0},video:{disabled:!0},image:{disabled:!0}},required:!1},text:{settings:!0,label:"Text",inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1},h3:{disabled:!1},blockquote:{disabled:!1},textAlign:{disabled:!1}},required:!0},teacherInstructions:{settings:!0,label:"Teacher Instructions",inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1}},required:!1},maxImageWidth:{teacherInstructions:300,text:300},maxImageHeight:{teacherInstructions:300,text:300},mathMlOptions:{mmlOutput:!1,mmlEditing:!1},language:{settings:!1,label:"Specify Language",enabled:!1},languageChoices:{label:"Language Choices",options:[]},additionalPassage:{settings:!0,label:"Additional Passage",enabled:!1}};const te=a,{createRoot:ae}=s;class ne extends HTMLElement{static __initStatic(){this.createDefaultModel=(e={})=>({...Z,...e})}constructor(){super(),this._root=null,this._model=ne.createDefaultModel(),this._configuration=ee}set model(e){this._model=ne.createDefaultModel(e),this.render()}set configuration(e){this._configuration=e,this.render()}connectedCallback(){this.render()}modelChanged(e){this._model=e,this.dispatchEvent(new u(this._model),!0),this.render()}onConfigurationChanged(e){this._configuration=e,this.render()}insertImage(e){this.dispatchEvent(new h(e))}onDeleteImage(e,t){this.dispatchEvent(new g(e,t))}insertSound(e){this.dispatchEvent(new C(e))}onDeleteSound(e,t){this.dispatchEvent(new b(e,t))}render(){if(this._model){const e=te.createElement(X,{model:this._model,configuration:this._configuration,onModelChanged:this.modelChanged.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=ae(this)),this._root.render(e)}}disconnectedCallback(){this._root&&this._root.unmount()}}ne.__initStatic();export{ne as default};
package/module/element.js CHANGED
@@ -1 +1 @@
1
- import{_dll_pie_lib__math_rendering as e}from"../../../@pie-lib/math-rendering-module@^4.1.0/module/index.js";import{_dll_react_dom as t,_dll_prop_types as n,_dll_react as i,_dll_mui__material_styles as r,_dll_mui__material as s,_dll_debug as o,_dll_mui__material_collapse as a}from"../../../@pie-lib/shared-module@^4.1.0/module/index.js";import{green as l,orange as c,red as d,indigo as p,pink as u}from"@mui/material/colors";var h={};Object.defineProperty(h,"__esModule",{value:!0});class m extends CustomEvent{constructor(e,t,n){super(m.TYPE,{bubbles:!0,composed:!0,detail:{complete:t,component:e,hasModel:n}}),this.component=e,this.complete=t}}m.TYPE="model-set";var f=h.ModelSetEvent=m;class E extends CustomEvent{constructor(e,t){super(E.TYPE,{bubbles:!0,composed:!0,detail:{complete:t,component:e}}),this.component=e,this.complete=t}}E.TYPE="session-changed",h.SessionChangedEvent=E;var g,b=t;g=b.createRoot,b.hydrateRoot;const y=i,v=n,x=e=>"string"==typeof e?e:"number"==typeof e?`${e}px`:"30px",C=({size:e,children:t})=>{const n={height:e=x(e),width:e,display:"inline-block",position:"relative"};return y.createElement("div",{style:n},t)};C.propTypes={size:v.number,children:v.oneOfType([v.arrayOf(v.node),v.node]).isRequired};const _=i,k=n,R=({size:e,children:t,sx:n})=>_.createElement(C,{size:e},_.createElement("svg",{preserveAspectRatio:"xMinYMin meet",viewBox:"0 0 44 40",style:{enableBackground:"new 0 0 44 40",...n}},t));R.propTypes={size:k.oneOfType([k.string,k.number]),children:k.oneOfType([k.arrayOf(k.node),k.node]).isRequired,sx:k.object},k.string.isRequired;const T=({fill:e})=>_.createElement("polygon",{transform:"translate(2, 0)",points:"34.1,28.6 34.1,2.2 2,2.2 2,34.3 40.1,34.3",fill:e});T.propTypes={fill:k.string.isRequired};const O=({fill:e})=>_.createElement("path",{transform:"translate(1, 0)",d:"M31.2,29.1v-0.3c2.2-2.8,3.6-6.3,3.6-10.1c0-8.9-7.2-16.1-16.1-16.1c-8.8,0.1-16,7.3-16,16.2 s7.2,16.1,16.1,16.1h18.5L31.2,29.1z",fill:e});O.propTypes={fill:k.string.isRequired};const S=({fill:e})=>_.createElement("circle",{transform:"translate(-3,0)",cx:"23",cy:"20.4",r:"16",fill:e});S.propTypes={fill:k.string.isRequired};const A=({fill:e})=>_.createElement("rect",{x:"3.6",y:"4.1",width:"32",height:"32",fill:e});A.propTypes={fill:k.string.isRequired};const N=n,M=i;var D=(e,t)=>{class n extends M.Component{static __initStatic(){this.propTypes={iconSet:N.oneOf(["emoji","check"]),shape:N.oneOf(["round","square"]),category:N.oneOf(["feedback",void 0]),open:N.bool,size:N.oneOfType([N.number,N.string]),fg:N.string,bg:N.string}}static __initStatic2(){this.defaultProps={iconSet:"check",shape:"round",category:void 0,open:!1,size:30,fg:"#4aaf46",bg:"#f8ffe2"}}render(){const{iconSet:n,shape:i,category:r,open:s,size:o,fg:a,bg:l}=this.props,c="check"===n?M.createElement(e,{fill:a}):M.createElement(t,{fill:a}),d="check"===n?M.createElement(e,{fill:l}):M.createElement(t,{fill:l});return s?M.createElement(R,{size:o},d):M.createElement(R,{size:o},"feedback"===r?"round"===i?M.createElement(O,{fill:l}):M.createElement(T,{fill:l}):"round"===i?M.createElement(S,{fill:l}):M.createElement(A,{fill:l}),c)}}return n.__initStatic(),n.__initStatic2(),n};const F=n,B=i,L=({fill:e})=>B.createElement("g",{transform:"translate(1, 0)"},B.createElement("path",{d:"M24.7,22.1c-1.5,1.7-3.6,2.7-5.8,2.7s-4.5-1.1-5.8-2.7l-2.8,1.6c2,2.7,5.2,4.2,8.7,4.2 c3.4,0,6.6-1.6,8.7-4.2L24.7,22.1z",fill:e}),B.createElement("rect",{x:"21.1",y:"13.1",width:"3.7",height:"4.7",fill:e}),B.createElement("rect",{x:"12.7",y:"13.1",width:"3.7",height:"4.7",fill:e}));L.propTypes={fill:F.string.isRequired};const w=({fill:e,x:t=0,y:n=0})=>B.createElement("polygon",{transform:`translate(${t}, ${n})`,points:"19.1,28.6 11.8,22.3 14.4,19.2 17.9,22.1 23.9,11.4 27.5,13.4",fill:e});w.propTypes={fill:F.string.isRequired,x:F.number,y:F.number};const I=D(w,L);I.propTypes={iconSet:F.oneOf(["emoji","check"]),shape:F.oneOf(["round","square"]),category:F.oneOf(["feedback",void 0]),open:F.bool,fg:F.string,bg:F.string,size:F.oneOfType([F.string,F.number])},I.defaultProps={iconSet:"check",shape:"round",category:void 0,open:!1,fg:"#4aaf46",bg:"#f8ffe2",size:30};const z=n,{styled:P}=r;z.string.isRequired,z.string.isRequired,z.string.isRequired,z.string.isRequired,z.string.isRequired,P("div")(({size:e})=>({width:e||"25px",height:e||"25px"})),z.bool,z.string;const q=n,j=i,H=({fill:e})=>j.createElement("g",{transform:"translate(0.5, 0.5)"},j.createElement("rect",{x:"11",y:"17.3",transform:"matrix(0.7071 -0.7071 0.7071 0.7071 -7.852 19.2507)",width:"16.6",height:"3.7",fill:e}),j.createElement("rect",{x:"17.4",y:"10.7",transform:"matrix(0.7071 -0.7071 0.7071 0.7071 -7.8175 19.209)",width:"3.7",height:"16.6",fill:e}));H.propTypes={fill:q.string.isRequired};const Y=({fill:e})=>j.createElement("g",{transform:"translate(1,0)"},j.createElement("rect",{x:"21",y:"12.9",width:"3.7",height:"4.7",fill:e}),j.createElement("rect",{x:"12.7",y:"12.9",width:"3.7",height:"4.7",fill:e}),j.createElement("rect",{x:"12.2",y:"22.5",width:"13",height:"3.3",fill:e}));Y.propTypes={fill:q.string.isRequired};const U=D(H,Y);U.propTypes={iconSet:q.oneOf(["emoji","check"]),shape:q.oneOf(["round","square"]),category:q.oneOf(["feedback",void 0]),open:q.bool,fg:q.string,bg:q.string,size:q.oneOfType([q.string,q.number])},U.defaultProps={iconSet:"check",shape:"round",category:void 0,open:!1,fg:"#fcb733",bg:"#fbf2e3",size:30};const $=n,K=i,W=()=>{const e={fill:"none",stroke:"#BCE2FF",strokeWidth:2,strokeMiterlimit:10};return K.createElement("g",null,K.createElement("line",{style:e,x1:"-98",y1:"142",x2:"-114.6",y2:"142"}),K.createElement("line",{style:e,x1:"-98",y1:"146.3",x2:"-114.6",y2:"146.3"}),K.createElement("line",{style:e,x1:"-104",y1:"150.7",x2:"-114.6",y2:"150.7"}))},G=({children:e,size:t})=>K.createElement(C,{size:t},K.createElement("svg",{version:"1.1",viewBox:"-128 129 31 31",style:{enableBackground:"new -128 129 31 31"}},e));G.propTypes={children:$.oneOfType([$.arrayOf($.node),$.node]).isRequired,size:$.number};const V=()=>K.createElement("g",null,K.createElement("rect",{x:"-123.9",y:"135.3",style:{fill:"#D0CAC5",stroke:"#E6E3E0",strokeWidth:.75,strokeLinejoin:"round",strokeMiterlimit:10},width:"4.1",height:"4.1"}),K.createElement("polygon",{style:{fill:"#D0CAC5",stroke:"#E6E3E0",strokeWidth:.75,strokeLinejoin:"round",strokeMiterlimit:10},points:"-119.8,150.4 -119.8,142.2 -125,142.2 -125,144.9 -122.6,144.9 -122.6,150.4 -125.6,150.4 -125.6,153.2 -116.8,153.2 -116.8,150.4 "}),K.createElement("rect",{x:"-124.7",y:"134.7",style:{fill:"#B3ABA4",stroke:"#CDC7C2",strokeWidth:.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:10},width:"4.1",height:"4.1"}),K.createElement("polygon",{style:{fill:"#B3ABA4",stroke:"#CDC7C2",strokeWidth:.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:10},points:"-120.6,149.8 -120.6,141.5 -125.8,141.5 -125.8,144.3 -123.3,144.3 -123.3,149.8 -126.4,149.8 -126.4,152.5 -117.6,152.5 -117.6,149.8 "}),K.createElement("rect",{x:"-125.5",y:"134",style:{fill:"#7FABC6"},width:"4.1",height:"4.1"}),K.createElement("polygon",{style:{fill:"#7FABC6"},points:"-121.4,149.1 -121.4,140.9 -126.5,140.9 -126.5,143.6 -124.1,143.6 -124.1,149.1 -127.1,149.1 -127.1,151.9 -118.4,151.9 -118.4,149.1 "})),J=()=>K.createElement("g",null,K.createElement("rect",{x:"-123.9",y:"135.3",style:{fill:"#D0CAC5",stroke:"#E6E3E0",strokeWidth:.75,strokeLinejoin:"round",strokeMiterlimit:10},width:"4.1",height:"4.1"}),K.createElement("polygon",{style:{fill:"#D0CAC5",stroke:"#E6E3E0",strokeWidth:.75,strokeLinejoin:"round",strokeMiterlimit:10},points:"-119.8,150.4 -119.8,142.2 -125,142.2 -125,144.9 -122.6,144.9 -122.6,150.4 -125.6,150.4 -125.6,153.2 -116.8,153.2 -116.8,150.4 "}),K.createElement("rect",{x:"-124.7",y:"134.7",style:{fill:"#B3ABA4",stroke:"#CDC7C2",strokeWidth:.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:10},width:"4.1",height:"4.1"}),K.createElement("polygon",{style:{fill:"#B3ABA4",stroke:"#CDC7C2",strokeWidth:.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:10},points:"-120.6,149.8 -120.6,141.5 -125.8,141.5 -125.8,144.3 -123.3,144.3 -123.3,149.8 -126.4,149.8 -126.4,152.5 -117.6,152.5 -117.6,149.8 "}),K.createElement("rect",{x:"-125.5",y:"134",style:{fill:"#1A9CFF"},width:"4.1",height:"4.1"}),K.createElement("polygon",{style:{fill:"#1A9CFF"},points:"-121.4,149.1 -121.4,140.9 -126.5,140.9 -126.5,143.6 -124.1,143.6 -124.1,149.1 -127.1,149.1 -127.1,151.9 -118.4,151.9 -118.4,149.1 "}));class X extends K.Component{constructor(e){super(e)}render(){return!0===this.props.open?K.createElement(G,null,K.createElement(V,null),K.createElement(W,null)):K.createElement(G,null,K.createElement(J,null),K.createElement(W,null))}}X.propTypes={open:$.bool},X.defaultProps={open:!1};const Q=n,Z=i,ee=({fill:e})=>Z.createElement("path",{fill:e,d:"M-130.4,142.1c0-2.1,1.7-3.9,3.9-3.9c0.3,0,0.5,0,0.8,0.1c-0.6-0.8-1.5-1.3-2.6-1.3c-1.8,0-3.3,1.5-3.3,3.3c0,1.1,0.5,2,1.3,2.6C-130.4,142.6-130.4,142.4-130.4,142.1z"});ee.propTypes={fill:Q.string};class te extends Z.Component{static __initStatic(){this.propTypes={classes:Q.object.isRequired,size:Q.number}}render(){const{size:e}=this.props;return!0===this.props.open?Z.createElement(C,{size:e},Z.createElement("svg",{preserveAspectRatio:"xMinYMin meet",viewBox:"-135 129 16 32"},Z.createElement("path",{fill:"#BCE2FF",d:"M-122,141.1c0-3.7-3.3-6.6-7.1-5.8c-2.4,0.5-4.3,2.4-4.7,4.8c-0.4,2.3,0.6,4.4,2.2,5.7c0.4,0.3,0.6,0.8,0.6,1.3v1.9h6.1v-1.9c0-0.5,0.2-1,0.6-1.3C-122.8,144.7-122,143-122,141.1z"}),Z.createElement("path",{fill:"#BCE2FF",d:"M-125.7,153h-4.5c-0.4,0-0.8-0.4-0.8-0.8v-1.6h6.1v1.6C-124.9,152.7-125.2,153-125.7,153z"}),Z.createElement(ee,{fill:"#1A9CFF"}))):Z.createElement(C,{size:e},Z.createElement("svg",{preserveAspectRatio:"xMinYMin meet",viewBox:"-135 129 16 31"},Z.createElement("path",{fill:"#D0CAC5",stroke:"#E6E3E0",className:"st0",d:"M-120.7,142.4c0-3.7-3.3-6.6-7.1-5.8c-2.4,0.5-4.3,2.4-4.7,4.8c-0.4,2.3,0.6,4.4,2.2,5.7c0.4,0.3,0.6,0.8,0.6,1.3v1.9h6.1v-1.9c0-0.5,0.2-1,0.6-1.3C-121.6,146-120.7,144.3-120.7,142.4z"}),Z.createElement("path",{fill:"#D0CAC5",stroke:"#E6E3E0",className:"st0",d:"M-124.4,154.3h-4.5c-0.4,0-0.8-0.4-0.8-0.8v-1.6h6.1v1.6C-123.6,153.9-123.9,154.3-124.4,154.3z"}),Z.createElement("path",{fill:"#B3ABA4",stroke:"#CDC7C2",className:"st1",d:"M-121.3,141.8c0-3.7-3.3-6.6-7.1-5.8c-2.4,0.5-4.3,2.4-4.7,4.8c-0.4,2.3,0.6,4.4,2.2,5.7c0.4,0.3,0.6,0.8,0.6,1.3v1.9h6.1v-1.9c0-0.5,0.2-1,0.6-1.3C-122.2,145.3-121.3,143.7-121.3,141.8z"}),",",Z.createElement("path",{fill:"#B3ABA4",stroke:"#CDC7C2",className:"st1",d:"M-125,153.7h-4.5c-0.4,0-0.8-0.4-0.8-0.8v-1.6h6.1v1.6C-124.2,153.3-124.6,153.7-125,153.7z"}),Z.createElement("path",{fill:"#1A9CFF",d:"M-122,141.1c0-3.7-3.3-6.6-7.1-5.8c-2.4,0.5-4.3,2.4-4.7,4.8c-0.4,2.3,0.6,4.4,2.2,5.7c0.4,0.3,0.6,0.8,0.6,1.3v1.9h6.1v-1.9c0-0.5,0.2-1,0.6-1.3C-122.8,144.7-122,143-122,141.1z"}),Z.createElement("path",{fill:"#1A9CFF",d:"M-125.7,153h-4.5c-0.4,0-0.8-0.4-0.8-0.8v-1.6h6.1v1.6C-124.9,152.7-125.2,153-125.7,153z"}),Z.createElement(ee,{fill:"1A9CFF"})))}}te.__initStatic(),te.propTypes={open:Q.bool},te.defaultProps={open:!1};const ne=n,ie=i,re=({fill:e})=>ie.createElement("g",null,ie.createElement("rect",{x:"19.3",y:"10.3",width:"4.5",height:"12.7",fill:e}),ie.createElement("rect",{x:"19.3",y:"26.2",width:"4.5",height:"4.5",fill:e}));re.propTypes={fill:ne.string.isRequired};const se=({fill:e})=>ie.createElement("polygon",{points:"14.8,4.5 5.6,13.8 5.6,27 14.8,36.5 28.1,36.5 37.6,27 37.6,13.8 28.1,4.5",fill:e});se.propTypes={fill:ne.string.isRequired};const oe=({fill:e})=>ie.createElement("g",null,ie.createElement("rect",{x:"23.8",y:"15",width:"3.5",height:"4.4",fill:e}),ie.createElement("rect",{x:"16",y:"15",width:"3.5",height:"4.4",fill:e}),ie.createElement("path",{d:"M24.2,27.1h-5.1c-0.8,0-1.5-0.7-1.5-1.5v0c0-0.8,0.7-1.5,1.5-1.5h5.1c0.8,0,1.5,0.7,1.5,1.5v0 C25.7,26.4,25,27.1,24.2,27.1z",fill:e}));oe.propTypes={fill:ne.string.isRequired};class ae extends ie.Component{constructor(e){super(e);const{fg:t="#464146",bg:n="white"}=this.props;this.icons={check:ie.createElement(R,null,ie.createElement(se,{fill:n}),ie.createElement(re,{fill:t})),emoji:ie.createElement(R,null,ie.createElement(se,{fill:n}),ie.createElement(oe,{fill:t})),feedback:{check:ie.createElement(R,null,ie.createElement(se,{fill:n}),ie.createElement(oe,{fill:t})),emoji:ie.createElement(R,null,ie.createElement(se,{fill:n}),ie.createElement(oe,{fill:t})),square:{check:ie.createElement(R,null,ie.createElement(se,{fill:n}),ie.createElement(re,{fill:t})),emoji:ie.createElement(R,null,ie.createElement(se,{fill:n}),ie.createElement(oe,{fill:t})),open:{check:ie.createElement(R,null,ie.createElement(re,{fill:n})),emoji:ie.createElement(R,null,ie.createElement(oe,{fill:n}))}}}}}render(){const{iconSet:e,category:t,shape:n,open:i}=this.props;return void 0===t?this.icons[e]:void 0===n?this.icons.feedback[e]:!0===i?this.icons.feedback.square.open[e]:this.icons.feedback.square[e]}}ae.propTypes={iconSet:ne.oneOf(["emoji","check",void 0]),shape:ne.oneOf(["square",void 0]),category:ne.oneOf(["feedback",void 0]),open:ne.bool,fg:ne.string,bg:ne.string},ae.defaultProps={iconSet:"check",shape:void 0,category:void 0,open:!1,fg:"#464146",bg:"white"};const le=n,ce=i,de=({fill:e})=>ce.createElement("g",{transform:"translate(0, 0)"},ce.createElement("polygon",{points:"27.5,13.4 23.9,11.4 15.9,25.8 19.1,28.6",fill:e}),ce.createElement("polygon",{points:"16.2,20.6 14.4,19.2 11.8,22.3 14.1,24.3",fill:e}));de.propTypes={fill:le.string.isRequired};const pe=({fill:e})=>ce.createElement("g",{transform:"translate(2, 0)"},ce.createElement("rect",{x:"20.6",y:"11.8",width:"4",height:"5",fill:e}),ce.createElement("rect",{x:"11.5",y:"11.8",width:"4",height:"5",fill:e}),ce.createElement("rect",{x:"10.9",y:"22.9",transform:"matrix(0.9794 -0.2019 0.2019 0.9794 -4.6237 4.1559)",width:"14.3",height:"3.7",fill:e}));pe.propTypes={fill:le.string.isRequired};const ue=D(de,pe);ue.propTypes={iconSet:le.oneOf(["emoji","check"]),shape:le.oneOf(["round","square"]),category:le.oneOf(["feedback",void 0]),open:le.bool,fg:le.string,bg:le.string,size:le.oneOfType([le.string,le.number])},ue.defaultProps={iconSet:"check",shape:"round",category:void 0,open:!1,fg:"#4aaf46",bg:"#c1e1ac",size:30};const he=n,me=i,fe=({fill:e})=>me.createElement("g",null,me.createElement("rect",{x:"-115",y:"136.7",width:"3",height:"3",fill:e}),me.createElement("polygon",{points:"-112,147.7 -112,141.7 -115.8,141.7 -115.8,143.7 -114,143.7 -114,147.7 -116.2,147.7 -116.2,149.7 -109.8,149.7 -109.8,147.7",fill:e}));fe.propTypes={fill:he.string.isRequired};const Ee=({fill:e})=>me.createElement("path",{d:"M-113,158.5c-8,0-14.5-6.5-14.5-14.5s6.5-14.5,14.5-14.5s14.5,6.5,14.5,14.5S-105,158.5-113,158.5z M-113,130.5c-7.4,0-13.5,6.1-13.5,13.5s6.1,13.5,13.5,13.5s13.5-6.1,13.5-13.5S-105.6,130.5-113,130.5z",fill:e});Ee.propTypes={fill:he.string.isRequired};const ge=({fill:e="#FFFFFF"})=>me.createElement("g",null,me.createElement("path",{style:{fill:"#D0CAC5",stroke:"#E6E3E0",strokeWidth:.75,strokeMiterlimit:10},d:"M-111.7,160.9c-8.5,0-15.5-6.9-15.5-15.5c0-8.5,6.9-15.5,15.5-15.5s15.5,6.9,15.5,15.5C-96.2,154-103.1,160.9-111.7,160.9z"}),me.createElement("path",{style:{fill:"#B3ABA4",stroke:"#CDC7C2",strokeWidth:.5,strokeMiterlimit:10},d:"M-112,159.5c-8,0-14.5-6.5-14.5-14.5s6.5-14.5,14.5-14.5s14.5,6.5,14.5,14.5S-104,159.5-112,159.5z"}),me.createElement("circle",{cx:"-113",cy:"144",r:"14",fill:e}));ge.propTypes={fill:he.string};const be=({children:e,size:t})=>{const n=x(t),i={height:n,width:n,display:"inline-block",position:"relative"};return me.createElement("div",{style:i},me.createElement("svg",{preserveAspectRatio:"xMinYMin meet",viewBox:"-129 128 34 34"},e))};be.propTypes={children:he.oneOfType([he.arrayOf(he.node),he.node]).isRequired,size:he.oneOfType([he.string,he.number])};class ye extends me.Component{render(){const{iconSet:e,open:t,fg:n="#1a9cff",bg:i="#bce2ff",border:r="#bbe3fd"}=this.props,s=me.createElement(fe,{fill:n}),o={check:me.createElement(be,{size:this.props.size},me.createElement(ge,null),s,me.createElement(Ee,{fill:r})),emoji:me.createElement(be,{size:this.props.size},me.createElement(ge,null),s,me.createElement(Ee,{fill:r})),open:{check:me.createElement(be,{size:this.props.size},me.createElement("circle",{cx:"-113",cy:"144",r:"14",fill:"#FFFFFF"}),me.createElement(fe,{fill:i}),me.createElement(Ee,{fill:"#FFFFFF"})),emoji:me.createElement(be,{size:this.props.size},me.createElement("circle",{cx:"-113",cy:"144",r:"14",fill:"#FFFFFF"}),me.createElement(fe,{fill:i}),me.createElement(Ee,{fill:r}))}};return!0===t?o.open[e]:o[e]}}function ve(){return ve=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},ve.apply(null,arguments)}function xe(e,t){if(null==e)return{};var n={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(-1!==t.indexOf(i))continue;n[i]=e[i]}return n}function Ce(e,t){return Ce=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Ce(e,t)}function _e(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Ce(e,t)}function ke(e,t){return e.replace(new RegExp("(^|\\s)"+t+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}ye.propTypes={iconSet:he.oneOf(["emoji","check"]),open:he.bool,fg:he.string,bg:he.string,border:he.string,size:he.oneOfType([he.string,he.number])},ye.defaultProps={iconSet:"check",open:!1,fg:"#1a9cff",bg:"#bce2ff",border:"#bbe3fd",size:30};var Re=!1;var Te=i.createContext(null),Oe=function(e){return e.scrollTop};const Se=i,Ae=t;var Ne="unmounted",Me="exited",De="entering",Fe="entered",Be="exiting",Le=function(e){function t(t,n){var i;i=e.call(this,t,n)||this;var r,s=n&&!n.isMounting?t.enter:t.appear;return i.appearStatus=null,t.in?s?(r=Me,i.appearStatus=De):r=Fe:r=t.unmountOnExit||t.mountOnEnter?Ne:Me,i.state={status:r},i.nextCallback=null,i}_e(t,e),t.getDerivedStateFromProps=function(e,t){return e.in&&t.status===Ne?{status:Me}:null};var n=t.prototype;return n.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},n.componentDidUpdate=function(e){var t=null;if(e!==this.props){var n=this.state.status;this.props.in?n!==De&&n!==Fe&&(t=De):n!==De&&n!==Fe||(t=Be)}this.updateStatus(!1,t)},n.componentWillUnmount=function(){this.cancelNextCallback()},n.getTimeouts=function(){var e,t,n,i=this.props.timeout;return e=t=n=i,null!=i&&"number"!=typeof i&&(e=i.exit,t=i.enter,n=void 0!==i.appear?i.appear:t),{exit:e,enter:t,appear:n}},n.updateStatus=function(e,t){if(void 0===e&&(e=!1),null!==t)if(this.cancelNextCallback(),t===De){if(this.props.unmountOnExit||this.props.mountOnEnter){var n=this.props.nodeRef?this.props.nodeRef.current:Ae.findDOMNode(this);n&&Oe(n)}this.performEnter(e)}else this.performExit();else this.props.unmountOnExit&&this.state.status===Me&&this.setState({status:Ne})},n.performEnter=function(e){var t=this,n=this.props.enter,i=this.context?this.context.isMounting:e,r=this.props.nodeRef?[i]:[Ae.findDOMNode(this),i],s=r[0],o=r[1],a=this.getTimeouts(),l=i?a.appear:a.enter;!e&&!n||Re?this.safeSetState({status:Fe},function(){t.props.onEntered(s)}):(this.props.onEnter(s,o),this.safeSetState({status:De},function(){t.props.onEntering(s,o),t.onTransitionEnd(l,function(){t.safeSetState({status:Fe},function(){t.props.onEntered(s,o)})})}))},n.performExit=function(){var e=this,t=this.props.exit,n=this.getTimeouts(),i=this.props.nodeRef?void 0:Ae.findDOMNode(this);t&&!Re?(this.props.onExit(i),this.safeSetState({status:Be},function(){e.props.onExiting(i),e.onTransitionEnd(n.exit,function(){e.safeSetState({status:Me},function(){e.props.onExited(i)})})})):this.safeSetState({status:Me},function(){e.props.onExited(i)})},n.cancelNextCallback=function(){null!==this.nextCallback&&(this.nextCallback.cancel(),this.nextCallback=null)},n.safeSetState=function(e,t){t=this.setNextCallback(t),this.setState(e,t)},n.setNextCallback=function(e){var t=this,n=!0;return this.nextCallback=function(i){n&&(n=!1,t.nextCallback=null,e(i))},this.nextCallback.cancel=function(){n=!1},this.nextCallback},n.onTransitionEnd=function(e,t){this.setNextCallback(t);var n=this.props.nodeRef?this.props.nodeRef.current:Ae.findDOMNode(this),i=null==e&&!this.props.addEndListener;if(n&&!i){if(this.props.addEndListener){var r=this.props.nodeRef?[this.nextCallback]:[n,this.nextCallback],s=r[0],o=r[1];this.props.addEndListener(s,o)}null!=e&&setTimeout(this.nextCallback,e)}else setTimeout(this.nextCallback,0)},n.render=function(){var e=this.state.status;if(e===Ne)return null;var t=this.props,n=t.children;t.in,t.mountOnEnter,t.unmountOnExit,t.appear,t.enter,t.exit,t.timeout,t.addEndListener,t.onEnter,t.onEntering,t.onEntered,t.onExit,t.onExiting,t.onExited,t.nodeRef;var i=xe(t,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]);return Se.createElement(Te.Provider,{value:null},"function"==typeof n?n(e,i):Se.cloneElement(Se.Children.only(n),i))},t}(Se.Component);function we(){}Le.contextType=Te,Le.propTypes={},Le.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:we,onEntering:we,onEntered:we,onExit:we,onExiting:we,onExited:we},Le.UNMOUNTED=Ne,Le.EXITED=Me,Le.ENTERING=De,Le.ENTERED=Fe,Le.EXITING=Be;var Ie=Le;const ze=i;var Pe=function(e,t){return e&&t&&t.split(" ").forEach(function(t){return i=t,void((n=e).classList?n.classList.add(i):function(e,t){return e.classList?!!t&&e.classList.contains(t):-1!==(" "+(e.className.baseVal||e.className)+" ").indexOf(" "+t+" ")}(n,i)||("string"==typeof n.className?n.className=n.className+" "+i:n.setAttribute("class",(n.className&&n.className.baseVal||"")+" "+i)));var n,i})},qe=function(e,t){return e&&t&&t.split(" ").forEach(function(t){return i=t,void((n=e).classList?n.classList.remove(i):"string"==typeof n.className?n.className=ke(n.className,i):n.setAttribute("class",ke(n.className&&n.className.baseVal||"",i)));var n,i})},je=function(e){function t(){for(var t,n=arguments.length,i=new Array(n),r=0;r<n;r++)i[r]=arguments[r];return(t=e.call.apply(e,[this].concat(i))||this).appliedClasses={appear:{},enter:{},exit:{}},t.onEnter=function(e,n){var i=t.resolveArguments(e,n),r=i[0],s=i[1];t.removeClasses(r,"exit"),t.addClass(r,s?"appear":"enter","base"),t.props.onEnter&&t.props.onEnter(e,n)},t.onEntering=function(e,n){var i=t.resolveArguments(e,n),r=i[0],s=i[1]?"appear":"enter";t.addClass(r,s,"active"),t.props.onEntering&&t.props.onEntering(e,n)},t.onEntered=function(e,n){var i=t.resolveArguments(e,n),r=i[0],s=i[1]?"appear":"enter";t.removeClasses(r,s),t.addClass(r,s,"done"),t.props.onEntered&&t.props.onEntered(e,n)},t.onExit=function(e){var n=t.resolveArguments(e)[0];t.removeClasses(n,"appear"),t.removeClasses(n,"enter"),t.addClass(n,"exit","base"),t.props.onExit&&t.props.onExit(e)},t.onExiting=function(e){var n=t.resolveArguments(e)[0];t.addClass(n,"exit","active"),t.props.onExiting&&t.props.onExiting(e)},t.onExited=function(e){var n=t.resolveArguments(e)[0];t.removeClasses(n,"exit"),t.addClass(n,"exit","done"),t.props.onExited&&t.props.onExited(e)},t.resolveArguments=function(e,n){return t.props.nodeRef?[t.props.nodeRef.current,e]:[e,n]},t.getClassNames=function(e){var n=t.props.classNames,i="string"==typeof n,r=i?""+(i&&n?n+"-":"")+e:n[e];return{baseClassName:r,activeClassName:i?r+"-active":n[e+"Active"],doneClassName:i?r+"-done":n[e+"Done"]}},t}_e(t,e);var n=t.prototype;return n.addClass=function(e,t,n){var i=this.getClassNames(t)[n+"ClassName"],r=this.getClassNames("enter").doneClassName;"appear"===t&&"done"===n&&r&&(i+=" "+r),"active"===n&&e&&Oe(e),i&&(this.appliedClasses[t][n]=i,Pe(e,i))},n.removeClasses=function(e,t){var n=this.appliedClasses[t],i=n.base,r=n.active,s=n.done;this.appliedClasses[t]={},i&&qe(e,i),r&&qe(e,r),s&&qe(e,s)},n.render=function(){var e=this.props;e.classNames;var t=xe(e,["classNames"]);return ze.createElement(Ie,ve({},t,{onEnter:this.onEnter,onEntered:this.onEntered,onEntering:this.onEntering,onExit:this.onExit,onExiting:this.onExiting,onExited:this.onExited}))},t}(ze.Component);je.defaultProps={classNames:""},je.propTypes={};var He=je;const{Children:Ye}=i,{cloneElement:Ue}=i,{isValidElement:$e}=i;function Ke(e,t){var n=Object.create(null);return e&&Ye.map(e,function(e){return e}).forEach(function(e){n[e.key]=function(e){return t&&$e(e)?t(e):e}(e)}),n}function We(e,t,n){return null!=n[t]?n[t]:e.props[t]}function Ge(e,t,n){var i=Ke(e.children),r=function(e,t){function n(n){return n in t?t[n]:e[n]}e=e||{},t=t||{};var i,r=Object.create(null),s=[];for(var o in e)o in t?s.length&&(r[o]=s,s=[]):s.push(o);var a={};for(var l in t){if(r[l])for(i=0;i<r[l].length;i++){var c=r[l][i];a[r[l][i]]=n(c)}a[l]=n(l)}for(i=0;i<s.length;i++)a[s[i]]=n(s[i]);return a}(t,i);return Object.keys(r).forEach(function(s){var o=r[s];if($e(o)){var a=s in t,l=s in i,c=t[s],d=$e(c)&&!c.props.in;!l||a&&!d?l||!a||d?l&&a&&$e(c)&&(r[s]=Ue(o,{onExited:n.bind(null,o),in:c.props.in,exit:We(o,"exit",e),enter:We(o,"enter",e)})):r[s]=Ue(o,{in:!1}):r[s]=Ue(o,{onExited:n.bind(null,o),in:!0,exit:We(o,"exit",e),enter:We(o,"enter",e)})}}),r}const Ve=i;var Je=Object.values||function(e){return Object.keys(e).map(function(t){return e[t]})},Xe=function(e){function t(t,n){var i,r=(i=e.call(this,t,n)||this).handleExited.bind(function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(i));return i.state={contextValue:{isMounting:!0},handleExited:r,firstRender:!0},i}_e(t,e);var n=t.prototype;return n.componentDidMount=function(){this.mounted=!0,this.setState({contextValue:{isMounting:!1}})},n.componentWillUnmount=function(){this.mounted=!1},t.getDerivedStateFromProps=function(e,t){var n,i,r=t.children,s=t.handleExited;return{children:t.firstRender?(n=e,i=s,Ke(n.children,function(e){return Ue(e,{onExited:i.bind(null,e),in:!0,appear:We(e,"appear",n),enter:We(e,"enter",n),exit:We(e,"exit",n)})})):Ge(e,r,s),firstRender:!1}},n.handleExited=function(e,t){var n=Ke(this.props.children);e.key in n||(e.props.onExited&&e.props.onExited(t),this.mounted&&this.setState(function(t){var n=ve({},t.children);return delete n[e.key],{children:n}}))},n.render=function(){var e=this.props,t=e.component,n=e.childFactory,i=xe(e,["component","childFactory"]),r=this.state.contextValue,s=Je(this.state.children).map(n);return delete i.appear,delete i.enter,delete i.exit,null===t?Ve.createElement(Te.Provider,{value:r},s):Ve.createElement(Te.Provider,{value:r},Ve.createElement(t,i,s))},t}(Ve.Component);Xe.propTypes={},Xe.defaultProps={component:"div",childFactory:function(e){return e}};var Qe=Xe;const Ze={TEXT:"black",DISABLED:"grey",DISABLED_SECONDARY:"#ABABAB",CORRECT:l[500],CORRECT_SECONDARY:l[50],CORRECT_TERTIARY:"#0EA449",CORRECT_WITH_ICON:"#087D38",INCORRECT:c[500],INCORRECT_SECONDARY:d[50],INCORRECT_WITH_ICON:"#BF0D00",MISSING:d[700],MISSING_WITH_ICON:"#6A78A1",PRIMARY:p[500],PRIMARY_LIGHT:p[200],PRIMARY_DARK:p[800],SECONDARY:u.A400,SECONDARY_LIGHT:u[200],SECONDARY_DARK:u[900],TERTIARY:"#146EB3",TERTIARY_LIGHT:"#D0E2F0",BACKGROUND:"rgba(255,255,255,0)",BACKGROUND_DARK:"#ECEDF1",DROPDOWN_BACKGROUND:"#E0E1E6",SECONDARY_BACKGROUND:"rgba(241,241,241,1)",BORDER:"#9A9A9A",BORDER_LIGHT:"#D1D1D1",BORDER_DARK:"#646464",BORDER_GRAY:"#7E8494",BLACK:"#000000",WHITE:"#ffffff",TRANSPARENT:"transparent",FOCUS_CHECKED:"#BBDEFB",FOCUS_CHECKED_BORDER:"#1565C0",FOCUS_UNCHECKED:"#E0E0E0",FOCUS_UNCHECKED_BORDER:"#757575",BLUE_GREY100:"#F3F5F7",BLUE_GREY300:"#C0C3CF",BLUE_GREY600:"#7E8494",BLUE_GREY900:"#152452",FADED_PRIMARY:"#DCDAFB",KEYPAD_BUTTON:"rgb(188, 194, 229)",KEYPAD_BUTTON_OPERATOR:"rgb(255, 159, 192)",KEYPAD_EMPTY_PLACEHOLDER:"rgba(245, 0, 87, 0.4)",KEYPAD_BUTTON_HOVER:"rgb(214, 218, 239)",KEYPAD_BUTTON_OPERATOR_HOVER:"rgb(255, 197, 217)",BUTTON_BORDER:"rgba(0, 0, 0, 0.23)",BUTTON_HOVER_BG:"rgba(0, 0, 0, 0.08)"};Object.freeze(Ze);const et=(tt="pie",(...e)=>{const t=e.pop();return e.reduceRight((e,t)=>`var(--${tt}-${t}, ${e})`,t)});var tt;const nt=()=>et("text",Ze.TEXT),it=()=>et("background",Ze.BACKGROUND),rt=i,st=n,{styled:ot}=r,at=ot("div")({transformOrigin:"0% 0px 0px",width:"100%",display:"block",overflow:"hidden","&.incorrect":{color:"#946202"}}),lt=ot("div")({WebkitFontSmoothing:"antialiased",backgroundColor:`var(--feedback-bg-color, ${et("disabled",Ze.DISABLED)})`,borderRadius:"4px",lineHeight:"25px",margin:"0px",padding:"10px",verticalAlign:"middle",color:"var(--feedback-color, white)","&.correct":{backgroundColor:`var(--feedback-correct-bg-color, ${et("correct",Ze.CORRECT)})`},"&.incorrect":{backgroundColor:`var(--feedback-incorrect-bg-color, ${et("incorrect",Ze.INCORRECT)})`}}),ct=ot("div")({"&.feedback-enter":{height:"1px"},"&.feedback-enter-active":{height:"45px",transition:"height 500ms"},"&.feedback-exit":{height:"45px"},"&.feedback-exit-active":{height:"1px",transition:"height 200ms"}});class dt extends rt.Component{constructor(...e){super(...e),dt.prototype.__init.call(this)}static __initStatic(){this.propTypes={correctness:st.string,feedback:st.string}}__init(){this.nodeRef=rt.createRef()}renderFeedback(){const{correctness:e,feedback:t}=this.props;return e&&t?rt.createElement(He,{key:"hasFeedback",nodeRef:this.nodeRef,timeout:{enter:500,exit:200},classNames:"feedback"},rt.createElement(ct,{ref:this.nodeRef},rt.createElement(at,null,rt.createElement(lt,{className:e,dangerouslySetInnerHTML:{__html:t}})))):null}render(){return rt.createElement("div",null,rt.createElement(Qe,null,this.renderFeedback()))}}dt.__initStatic();const pt=i,ut=n,{Popover:ht}=s,{styled:mt}=r,ft=o("pie-libs:render-ui:response-indicators"),Et=mt("div")(({hasFeedback:e})=>({cursor:e?"pointer":"default"})),gt=mt(ht)({cursor:"pointer"}),bt=mt("div")({padding:"0",borderRadius:"4px"}),yt=(e,t)=>{class n extends pt.Component{constructor(e){super(e),n.prototype.__init.call(this),n.prototype.__init2.call(this),this.state={}}__init(){this.handlePopoverOpen=e=>{ft("[handlePopoverOpen]",e.target),this.setState({anchorEl:e.target})}}__init2(){this.handlePopoverClose=()=>{this.setState({anchorEl:null})}}render(){const{feedback:n}=this.props,{anchorEl:i}=this.state;return pt.createElement(Et,{hasFeedback:!!n},pt.createElement("span",{ref:e=>this.icon=e,onClick:this.handlePopoverOpen},pt.createElement(e,null)),n&&pt.createElement(gt,{PaperComponent:bt,open:!!i,anchorEl:i,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},onClose:this.handlePopoverClose},pt.createElement(dt,{feedback:n,correctness:t})))}}return n.propTypes={feedback:ut.string},n};yt(I,"correct"),yt(U,"incorrect"),yt(ue,"partially-correct"),yt(ae,"nothing-submitted");const vt=i,{styled:xt}=r,Ct=a,_t=n,{renderMath:kt}=e,Rt=xt("span")(({theme:e})=>({color:e.palette.primary.light,borderBottom:`1px dotted ${e.palette.primary.light}`,cursor:"pointer"})),Tt=xt(Ct)(({theme:e})=>({paddingTop:e.spacing(2)}));class Ot extends vt.Component{constructor(...e){super(...e),Ot.prototype.__init.call(this),Ot.prototype.__init2.call(this)}static __initStatic(){this.propTypes={className:_t.string,children:_t.object,labels:_t.shape({visible:_t.string,hidden:_t.string})}}static __initStatic2(){this.defaultProps={labels:{}}}__init(){this.state={expanded:!1}}__init2(){this.toggleExpanded=()=>{this.setState(e=>({expanded:!e.expanded}))}}componentDidMount(){kt(this.root)}componentDidUpdate(){kt(this.root)}render(){const{labels:e,children:t,className:n}=this.props,i=this.state.expanded?e.visible||"Hide":e.hidden||"Show";return vt.createElement("div",{className:n,ref:e=>this.root=e},vt.createElement("div",{onClick:this.toggleExpanded},vt.createElement(Rt,null,i)),vt.createElement(Tt,{in:this.state.expanded,timeout:{enter:225,exit:195},unmountOnExit:!0},t))}}Ot.__initStatic(),Ot.__initStatic2();const{Button:St}=s,{styled:At}=r;At("div")({display:"flex",flexDirection:"column"}),At("div")({display:"flex",alignItems:"center",justifyContent:"center"}),At("div")(({theme:e})=>({width:"24px",height:"24px",color:"gray",marginRight:e.spacing(1),display:"flex",alignItems:"center"})),At(St)(({theme:e})=>({display:"flex",alignItems:"center",marginLeft:e.spacing(3),marginRight:e.spacing(3)}));const Nt=i,{createTheme:Mt}=r,{styled:Dt}=r,{StyledEngineProvider:Ft}=r,{ThemeProvider:Bt}=r,Lt=n;const wt=Mt({typography:{fontFamily:"inherit"},palette:{action:{disabled:"rgba(0, 0, 0, 0.54);"}},components:{MuiTypography:{styleOverrides:{root:{fontFamily:"inherit"}}},MuiButton:{styleOverrides:{contained:{backgroundColor:"#e0e0e0",color:"#000000","&:hover":{backgroundColor:"#bdbdbd"}}}}}}),It=Dt("div")({"& table, th, td":{fontSize:"inherit"}});class zt extends Nt.Component{static __initStatic(){this.propTypes={className:Lt.string,children:Lt.array,extraCSSRules:Lt.shape({names:Lt.arrayOf(Lt.string),rules:Lt.string}),fontSizeFactor:Lt.number}}static __initStatic2(){this.defaultProps={extraCSSRules:{},fontSizeFactor:1}}constructor(e){super(e),this.classesSheet=document.createElement("style")}computeStyle(e){const t=e=>parseFloat(getComputedStyle(e).fontSize),n=t(document.documentElement),i=t(document.body),r=Math.max(n,i),s=null!=e&&"number"==typeof e?e:1;return 1!==s?{fontSize:r*s+"px"}:null}render(){const{children:e,className:t,fontSizeFactor:n,...i}=this.props,{extraCSSRules:r,...s}=i,o=this.computeStyle(n);return Nt.createElement(Ft,{injectFirst:!0},Nt.createElement(Bt,{theme:wt},function(e){let t,n=e[0],i=1;for(;i<e.length;){const r=e[i],s=e[i+1];if(i+=2,("optionalAccess"===r||"optionalCall"===r)&&null==n)return;"access"===r||"optionalAccess"===r?(t=n,n=s(n)):"call"!==r&&"optionalCall"!==r||(n=s((...e)=>n.call(t,...e)),t=void 0)}return n}([r,"optionalAccess",e=>e.rules])?Nt.createElement("style",{dangerouslySetInnerHTML:{__html:`.extraCSSRules { ${r.rules} }`}}):null,Nt.createElement(It,{className:`${t} extraCSSRules`,...s,...o&&{style:o}},e)))}}zt.__initStatic(),zt.__initStatic2();const Pt=i,{styled:qt}=r,jt=n,Ht=qt(zt)({display:"flex",flexDirection:"column",position:"relative"});class Yt extends Pt.Component{static __initStatic(){this.propTypes={ariaLabel:jt.string,children:jt.oneOfType([jt.arrayOf(jt.node),jt.node]).isRequired,role:jt.string,extraCSSRules:jt.shape({names:jt.arrayOf(jt.string),rules:jt.string}),fontSizeFactor:jt.number}}render(){const{children:e,ariaLabel:t,role:n,extraCSSRules:i,fontSizeFactor:r,classes:s}=this.props,o=t?{"aria-label":t,role:n}:{};return Pt.createElement(Ht,{...o,extraCSSRules:i,fontSizeFactor:r,classes:s},e)}}Yt.__initStatic();const Ut=i,$t=n;class Kt extends Ut.Component{static __initStatic(){this.propTypes={tag:$t.string,className:$t.string,html:$t.string}}static __initStatic2(){this.defaultProps={tag:"div",html:""}}render(){const{tag:e,className:t,html:n}=this.props,i=e||"div";return Ut.createElement(i,{ref:e=>this.node=e,className:t,dangerouslySetInnerHTML:{__html:n}})}}Kt.__initStatic(),Kt.__initStatic2();const{InputLabel:Wt}=s,{FormControl:Gt}=s,Vt=n,{styled:Jt}=r;Jt(Gt)(({theme:e})=>({margin:0,padding:0,flex:"1 0 auto",minWidth:e.spacing(4)})),Jt(Wt)(()=>({fontSize:"inherit",whiteSpace:"nowrap",margin:0,padding:0,alignSelf:"flex-start",position:"absolute",top:0,left:0,transformOrigin:"top left",pointerEvents:"none","&.MuiInputLabel-shrink":{transform:"scale(0.75) translate(0, -0.75em)"},"&:not(.MuiInputLabel-shrink)":{transform:"translate(0, 0)"}})),Vt.oneOfType([Vt.string,Vt.object]).isRequired,Vt.string,Vt.oneOfType([Vt.arrayOf(Vt.node),Vt.node]).isRequired;const Xt=i,{Component:Qt}=i,{styled:Zt}=r,en=n,{renderMath:tn}=e,nn=Zt("div")(({theme:e,tagName:t})=>({"&:not(.MathJax) > table":{borderCollapse:"collapse"},"&:not(.MathJax) > table:has(tbody tr > th:first-child):not(:has(tbody tr > td:first-child)) tbody td:nth-child(even)":{backgroundColor:"#f6f8fa",color:e.palette.common.black},"&:not(.MathJax) > table:has(tbody tr > td:first-child) tbody tr:nth-child(even) td":{backgroundColor:"#f6f8fa",color:e.palette.common.black},"&:not(.MathJax) table td, &:not(.MathJax) table th":{padding:".6em 1em",textAlign:"left"},"&:not(.MathJax) > table td > p.kds-indent":{textAlign:"initial"},"&.prompt":{verticalAlign:"middle",color:nt()},"&.legend":{width:"100%",fontSize:"inherit !important"},"&.rationale":{paddingLeft:e.spacing(4),paddingBottom:e.spacing(1)},"&.prompt-label":{color:`${nt()} !important`,display:"flex",flexDirection:"column",verticalAlign:"middle",cursor:"pointer","& > p":{margin:"0 0 0 0 !important"}}})),rn=/\\embed\{newLine\}\[\]/g;class sn extends Qt{constructor(...e){super(...e),sn.prototype.__init.call(this)}static __initStatic(){this.propTypes={prompt:en.string,tagName:en.string,className:en.string,onClick:en.func,defaultClassName:en.string,autoplayAudioEnabled:en.bool,customAudioButton:{playImage:en.string,pauseImage:en.string}}}static __initStatic2(){this.defaultProps={onClick:()=>{}}}__init(){this.parsedText=e=>{const{customAudioButton:t}=this.props,n=document.createElement("div");n.innerHTML=e;const i=n.querySelector("audio");if(i){const e=document.createElement("source");if(e.setAttribute("type","audio/mp3"),e.setAttribute("src",i.getAttribute("src")),i.removeAttribute("src"),i.setAttribute("id","pie-prompt-audio-player"),i.appendChild(e),t){i.style.display="none";const e=document.createElement("div");e.id="play-audio-button",Object.assign(e.style,{cursor:"pointer",display:"block",width:"128px",height:"128px",backgroundImage:`url(${t.pauseImage})`,backgroundSize:"cover",borderRadius:"50%",border:"1px solid #326295"}),i.parentNode.insertBefore(e,i)}}return n.innerHTML}}addCustomAudioButtonControls(){const{autoplayAudioEnabled:e,customAudioButton:t}=this.props,n=document.getElementById("play-audio-button"),i=document.getElementById("pie-prompt-audio-player");if(e&&i&&i.play().then(()=>{n&&t&&i.addEventListener("ended",s)}).catch(e=>{console.error("Error playing audio",e)}),!n||!i||!t)return;const r=()=>{i.paused&&(n.style.backgroundImage.includes(t.pauseImage)||i.play())},s=()=>{n.style.backgroundImage=`url(${t.playImage})`},o=()=>{Object.assign(n.style,{backgroundImage:`url(${t.pauseImage})`,border:"1px solid #ccc"})},a=()=>{Object.assign(n.style,{backgroundImage:`url(${t.playImage})`,border:"1px solid #326295"})};n.addEventListener("click",r),i.addEventListener("play",o),i.addEventListener("pause",a),i.addEventListener("ended",s),this._handlePlayClick=r,this._handleAudioPlay=o,this._handleAudioPause=a,this._handleAudioEnded=s}removeCustomAudioButtonListeners(){const e=document.getElementById("play-audio-button"),t=document.querySelector("audio");e&&t&&(e.removeEventListener("click",this._handlePlayClick),t.removeEventListener("play",this._handleAudioPlay),t.removeEventListener("pause",this._handleAudioPause),t.removeEventListener("ended",this._handleAudioEnded))}componentDidMount(){this.alignImages(),this.addCustomAudioButtonControls(),this.setupMathRendering()}componentDidUpdate(e){this.alignImages(),e.prompt!==this.props.prompt&&this.renderMathContent()}componentWillUnmount(){this.removeCustomAudioButtonListeners()}setupMathRendering(){this.renderMathContent()}renderMathContent(){const e=document.getElementById("preview-prompt");e&&"function"==typeof tn&&tn(e)}alignImages(){document.querySelectorAll("#preview-prompt").forEach(e=>{const t=e.getElementsByTagName("img");if(t&&t.length)for(let e of t)if(e.attributes&&e.attributes.alignment&&e.attributes.alignment.value){const t=e.attributes.alignment.value,n="center"===t?"center":"right"===t?"flex-end":"flex-start",i=e.parentElement;if("DIV"===i.tagName&&"flex"===i.style.display&&"100%"===i.style.width)i.style.justifyContent=n;else{const t=document.createElement("div");t.style.display="flex",t.style.width="100%",t.style.justifyContent=n;const r=e.cloneNode(!0);t.appendChild(r),i.replaceChild(t,e)}}})}render(){const{prompt:e,tagName:t,className:n,onClick:i,defaultClassName:r}=this.props,s=`${n||""} ${r||""} ${"legend"===t?"legend":""}`.trim();return Xt.createElement(nn,{as:t||"div",id:"preview-prompt",onClick:i,className:s,tagName:t,dangerouslySetInnerHTML:{__html:this.parsedText(e||"").replace(rn,"\\newline ")}})}}sn.__initStatic(),sn.__initStatic2();const on=n;on.node,on.bool;const an=n,ln=i,cn=e=>ln.createElement(ln.Fragment,null,ln.Children.map(e.children,t=>ln.cloneElement(t,{"data-pie-purpose":e.purpose})));cn.propTypes={children:an.node,purpose:an.string},"undefined"!=typeof window&&new DOMParser,"undefined"!=typeof window&&new DOMParser;const dn=i,pn=n,{Tabs:un}=s,{Tab:hn}=s,{styled:mn}=r;const fn=mn("div")({flexGrow:1,backgroundColor:it(),color:nt(),"&:not(.MathJax) table":{borderCollapse:"collapse"},"&:not(.MathJax) table td, &:not(.MathJax) table th":{padding:".6em 1em",textAlign:"left"}}),En=mn("div")(({theme:e})=>({backgroundColor:it(),color:nt(),padding:e.spacing(2),"& blockquote":{background:"#f9f9f9",borderLeft:"5px solid #ccc",margin:"1.5em 10px",padding:".5em 10px"}})),gn=mn("div")({fontSize:"1.75rem"}),bn=mn("div")({fontSize:"1.5rem"}),yn=mn("div")({fontSize:"1.25rem"}),vn=mn(hn)(({theme:e})=>({background:e.palette.common.white,fontSize:"inherit",fontFamily:"Roboto, sans-serif",opacity:.7,color:e.palette.common.black,"&.Mui-selected":{opacity:1,color:e.palette.common.black}}));class xn extends dn.Component{constructor(...e){super(...e),xn.prototype.__init.call(this),xn.prototype.__init2.call(this),xn.prototype.__init3.call(this),xn.prototype.__init4.call(this)}__init(){this.state={activeTab:0}}__init2(){this.handleChange=(e,t)=>{this.setState(()=>({activeTab:t})),setTimeout(()=>{const e=new CustomEvent("pie-ui-passage-tabChanged",{detail:{tab:t}});window.dispatchEvent(e)})}}__init3(){this.handleKeyDown=(e,t)=>{const{key:n}=e,{tabs:i}=this.props;let r=-1;const s=i.findIndex(e=>e.id===t);switch(n){case"ArrowRight":r=(s+1)%i.length;break;case"ArrowLeft":r=(s-1+i.length)%i.length;break;case"Home":r=0;break;case"End":r=i.length-1;break;case"Enter":case" ":r=s}-1!==r&&(e.preventDefault(),e.stopPropagation(),this.handleChange(e,i[r].id),document.getElementById(`button-${i[r].id}`).focus())}}__init4(){this.parsedText=(e="")=>{const t=document.createElement("div");t.innerHTML=e.replace(/(<br\/>\n)/g,"<br/>");const n=t.querySelector("audio");if(n){const e=document.createElement("source");e.setAttribute("type","audio/mp3"),e.setAttribute("src",n.getAttribute("src")),n.removeAttribute("src"),n.appendChild(e)}return t.innerHTML}}renderInstructions(e,t=!1){if(!e)return;const n=dn.createElement(sn,{tagName:"div",className:"prompt",defaultClassName:"teacher-instructions",prompt:e});return t?n:dn.createElement(Ot,{labels:{hidden:"Show Teacher Instructions",visible:"Hide Teacher Instructions"}},n)}renderTab(e,t){return dn.createElement(En,{key:e.id,id:`tabpanel-${e.id}`,role:"tabpanel","aria-labelledby":`button-${e.id}`},this.renderInstructions(e.teacherInstructions,t),(e.title||e.subtitle)&&dn.createElement("h2",null,e.title&&dn.createElement(cn,{purpose:"passage-title"},dn.createElement(gn,{dangerouslySetInnerHTML:{__html:this.parsedText(e.title)}})),e.subtitle&&dn.createElement(cn,{purpose:"passage-subtitle"},dn.createElement(bn,{dangerouslySetInnerHTML:{__html:this.parsedText(e.subtitle)}}))),e.author&&dn.createElement(cn,{purpose:"passage-author"},dn.createElement(yn,{className:"author",dangerouslySetInnerHTML:{__html:this.parsedText(e.author)}})),e.text&&dn.createElement(cn,{purpose:"passage-text"},dn.createElement("div",{key:e.id,className:"text",dangerouslySetInnerHTML:{__html:this.parsedText(e.text)}})))}render(){const{model:e,tabs:t,disabledTabs:n}=this.props,{activeTab:i}=this.state;if(!function(e){let t,n=e[0],i=1;for(;i<e.length;){const r=e[i],s=e[i+1];if(i+=2,("optionalAccess"===r||"optionalCall"===r)&&null==n)return;"access"===r||"optionalAccess"===r?(t=n,n=s(n)):"call"!==r&&"optionalCall"!==r||(n=s((...e)=>n.call(t,...e)),t=void 0)}return n}([t,"optionalAccess",e=>e.length]))return;const{extraCSSRules:r}=e||{},s=(t||[]).find(e=>e.id===i);return dn.createElement(zt,{extraCSSRules:r},dn.createElement(fn,{className:"passages"},n||1===t.length?t.map(e=>this.renderTab(e,n)):dn.createElement(dn.Fragment,null,dn.createElement(un,{sx:{position:"sticky",top:0,background:it(),color:nt(),fontFamily:"Roboto, sans-serif","& .MuiTabs-indicator":{backgroundColor:"#f50057"}},value:i,onChange:this.handleChange},t.map(e=>dn.createElement(vn,{key:e.id,id:`button-${e.id}`,label:dn.createElement(cn,{purpose:"passage-label"},dn.createElement("span",{dangerouslySetInnerHTML:{__html:this.parsedText(e.label)}})),value:e.id,tabIndex:i===e.id?0:-1,"aria-controls":`tabpanel-${e.id}`,"aria-selected":i===e.id,onKeyDown:t=>this.handleKeyDown(t,e.id)}))),s?this.renderTab(s,n):null)))}}xn.propTypes={tabs:pn.arrayOf(pn.shape({id:pn.number.isRequired,label:pn.string.isRequired,title:pn.string.isRequired,subtitle:pn.string,author:pn.string,text:pn.string.isRequired,teacherInstructions:pn.string}).isRequired).isRequired,disabledTabs:pn.bool,model:pn.object};const{renderMath:Cn}=e,_n=i;class kn extends HTMLElement{constructor(){super(),kn.prototype.__init.call(this),this._model={passages:[]},this._session=null,this._root=null,this._mathObserver=null,this._mathRenderPending=!1}setLangAttribute(){const e=this._model&&(this._model.language,1)?this._model.language:"",t=e?e.slice(0,2):"en";this.setAttribute("lang",t)}__init(){this._scheduleMathRender=()=>{this._mathRenderPending||(this._mathRenderPending=!0,requestAnimationFrame(()=>{this._mathObserver&&this._mathObserver.disconnect(),Cn(this),this._mathRenderPending=!1,setTimeout(()=>{this._mathObserver&&this._mathObserver.observe(this,{childList:!0,subtree:!0})},50)}))}}_initMathObserver(){this._mathObserver||(this._mathObserver=new MutationObserver(this._scheduleMathRender),this._mathObserver.observe(this,{childList:!0,subtree:!0}))}_disconnectMathObserver(){this._mathObserver&&(this._mathObserver.disconnect(),this._mathObserver=null)}set model(e){this._model=e,this.dispatchEvent(new f(this.tagName.toLowerCase(),this._session,!!this._model)),this.setLangAttribute(),this._render()}set session(e){this._session=e}connectedCallback(){this.setAttribute("aria-label","Passage"),this.setAttribute("role","region"),this._initMathObserver(),this._render()}_render(){const{passages:e=[]}=this._model;if(this._model.passages.length>0){const t=e.map((e,t)=>({id:t,...e})),n=_n.createElement(xn,{tabs:t});this._root||(this._root=g(this)),this._root.render(n),this._initMathObserver()}}disconnectedCallback(){this._disconnectMathObserver(),this._root&&this._root.unmount()}}export{kn as default};
1
+ import{_dll_pie_lib__math_rendering as e}from"../../../@pie-lib/math-rendering-module@^4.1.3/module/index.js";import{_dll_react as t,_dll_prop_types as s,_dll_mui__material as i,_dll_mui__material_styles as r,_dll_pie_lib__render_ui as n,_dll_react_dom_client as a}from"../../../@pie-lib/shared-module@^4.1.3/module/index.js";var o={};Object.defineProperty(o,"__esModule",{value:!0});class l extends CustomEvent{constructor(e,t,s){super(l.TYPE,{bubbles:!0,composed:!0,detail:{complete:t,component:e,hasModel:s}}),this.component=e,this.complete=t}}l.TYPE="model-set";var c=o.ModelSetEvent=l;class d extends CustomEvent{constructor(e,t){super(d.TYPE,{bubbles:!0,composed:!0,detail:{complete:t,component:e}}),this.component=e,this.complete=t}}d.TYPE="session-changed",o.SessionChangedEvent=d;const h=t,u=s,{Tabs:b}=i,{Tab:m}=i,{styled:p}=r,{Collapsible:_}=n,{color:g}=n,{PreviewPrompt:v}=n,{Purpose:y}=n,{UiLayout:f}=n,{transformDataHeadings:E}=n;const x=p("div")({flexGrow:1,backgroundColor:g.background(),color:g.text(),"&:not(.MathJax) table":{borderCollapse:"collapse"},"&:not(.MathJax) table td, &:not(.MathJax) table th":{padding:".6em 1em",textAlign:"left"}}),T=p("div")(({theme:e})=>({backgroundColor:g.background(),color:g.text(),padding:e.spacing(2),"& blockquote":{background:"#f9f9f9",borderLeft:"5px solid #ccc",margin:"1.5em 10px",padding:".5em 10px"}})),M=p("div")({fontSize:"1.75rem"}),O=p("div")({fontSize:"1.5rem"}),C=p("div")({fontSize:"1.25rem"}),k=p(m)(({theme:e})=>({background:e.palette.common.white,fontSize:"inherit",fontFamily:"Roboto, sans-serif",opacity:.7,color:e.palette.common.black,"&.Mui-selected":{opacity:1,color:e.palette.common.black}}));class L extends h.Component{constructor(...e){super(...e),L.prototype.__init.call(this),L.prototype.__init2.call(this),L.prototype.__init3.call(this),L.prototype.__init4.call(this)}__init(){this.state={activeTab:0}}__init2(){this.handleChange=(e,t)=>{this.setState(()=>({activeTab:t})),setTimeout(()=>{const e=new CustomEvent("pie-ui-passage-tabChanged",{detail:{tab:t}});window.dispatchEvent(e)})}}__init3(){this.handleKeyDown=(e,t)=>{const{key:s}=e,{tabs:i}=this.props;let r=-1;const n=i.findIndex(e=>e.id===t);switch(s){case"ArrowRight":r=(n+1)%i.length;break;case"ArrowLeft":r=(n-1+i.length)%i.length;break;case"Home":r=0;break;case"End":r=i.length-1;break;case"Enter":case" ":r=n}-1!==r&&(e.preventDefault(),e.stopPropagation(),this.handleChange(e,i[r].id),document.getElementById(`button-${i[r].id}`).focus())}}__init4(){this.parsedText=(e="")=>{const t=document.createElement("div");t.innerHTML=e.replace(/(<br\/>\n)/g,"<br/>");const s=t.querySelector("audio");if(s){const e=document.createElement("source");e.setAttribute("type","audio/mp3"),e.setAttribute("src",s.getAttribute("src")),s.removeAttribute("src"),s.appendChild(e)}return t.innerHTML}}renderInstructions(e,t=!1){if(!e)return;const s=h.createElement(v,{tagName:"div",className:"prompt",defaultClassName:"teacher-instructions",prompt:e});return t?s:h.createElement(_,{labels:{hidden:"Show Teacher Instructions",visible:"Hide Teacher Instructions"}},s)}renderTab(e,t){const{baseHeadingLevel:s}=this.props,i=s?Math.min(6,Math.max(1,s)):void 0,r=s?`h${i}`:"h2",n=s?Math.min(6,Math.max(1,i+1)):void 0;return h.createElement(T,{key:e.id,id:`tabpanel-${e.id}`,role:"tabpanel","aria-labelledby":`button-${e.id}`},this.renderInstructions(e.teacherInstructions,t),e.title&&h.createElement(y,{purpose:"passage-title"},h.createElement(r,null,h.createElement(M,{dangerouslySetInnerHTML:{__html:this.parsedText(e.title)}}))),e.subtitle&&h.createElement(y,{purpose:"passage-subtitle"},h.createElement(O,{dangerouslySetInnerHTML:{__html:this.parsedText(e.subtitle)}})),e.author&&h.createElement(y,{purpose:"passage-author"},h.createElement(C,{className:"author",dangerouslySetInnerHTML:{__html:this.parsedText(e.author)}})),e.text&&h.createElement(y,{purpose:"passage-text"},h.createElement("div",{key:e.id,className:"text",dangerouslySetInnerHTML:{__html:s?E(e.text,n):e.text}})))}render(){const{model:e,tabs:t,disabledTabs:s}=this.props,{activeTab:i}=this.state;if(!function(e){let t,s=e[0],i=1;for(;i<e.length;){const r=e[i],n=e[i+1];if(i+=2,("optionalAccess"===r||"optionalCall"===r)&&null==s)return;"access"===r||"optionalAccess"===r?(t=s,s=n(s)):"call"!==r&&"optionalCall"!==r||(s=n((...e)=>s.call(t,...e)),t=void 0)}return s}([t,"optionalAccess",e=>e.length]))return;const{extraCSSRules:r}=e||{},n=(t||[]).find(e=>e.id===i);return h.createElement(f,{extraCSSRules:r},h.createElement(x,{className:"passages"},s||1===t.length?t.map(e=>this.renderTab(e,s)):h.createElement(h.Fragment,null,h.createElement(b,{sx:{position:"sticky",top:0,background:g.background(),color:g.text(),fontFamily:"Roboto, sans-serif","& .MuiTabs-indicator":{backgroundColor:"#f50057"}},value:i,onChange:this.handleChange},t.map(e=>h.createElement(k,{key:e.id,id:`button-${e.id}`,label:h.createElement(y,{purpose:"passage-label"},h.createElement("span",{dangerouslySetInnerHTML:{__html:this.parsedText(e.label)}})),value:e.id,tabIndex:i===e.id?0:-1,"aria-controls":`tabpanel-${e.id}`,"aria-selected":i===e.id,onKeyDown:t=>this.handleKeyDown(t,e.id)}))),n?this.renderTab(n,s):null)))}}L.propTypes={tabs:u.arrayOf(u.shape({id:u.number.isRequired,label:u.string.isRequired,title:u.string.isRequired,subtitle:u.string,author:u.string,text:u.string.isRequired,teacherInstructions:u.string}).isRequired).isRequired,disabledTabs:u.bool,model:u.object,baseHeadingLevel:u.number};const{renderMath:A}=e,P=t,{createRoot:R}=a;function S(e){const t=e.closest("pie-player")||e.closest("pie-item-player");if(t){let e=t.baseHeadingLevel;null==e&&(s=t.getAttribute("base-heading-level"),i=()=>t.getAttribute("baseheadinglevel"),e=null!=s?s:i());const r=parseInt(e,10);if(Number.isFinite(r)&&r>=1&&r<=6)return r}var s,i}class w extends HTMLElement{constructor(){super(),w.prototype.__init.call(this),this._model={passages:[]},this._session=null,this._root=null,this._mathObserver=null,this._mathRenderPending=!1,this._playerObserver=null}setLangAttribute(){const e=this._model&&(this._model.language,1)?this._model.language:"",t=e?e.slice(0,2):"en";this.setAttribute("lang",t)}__init(){this._scheduleMathRender=()=>{this._mathRenderPending||(this._mathRenderPending=!0,requestAnimationFrame(()=>{this._mathObserver&&this._mathObserver.disconnect(),A(this),this._mathRenderPending=!1,setTimeout(()=>{this._mathObserver&&this._mathObserver.observe(this,{childList:!0,subtree:!0})},50)}))}}_initMathObserver(){this._mathObserver||(this._mathObserver=new MutationObserver(this._scheduleMathRender),this._mathObserver.observe(this,{childList:!0,subtree:!0}))}_disconnectMathObserver(){this._mathObserver&&(this._mathObserver.disconnect(),this._mathObserver=null)}set model(e){this._model=e,this.dispatchEvent(new c(this.tagName.toLowerCase(),this._session,!!this._model)),this.setLangAttribute(),this._render()}set session(e){this._session=e}connectedCallback(){this.setAttribute("aria-label","Passage"),this.setAttribute("role","region"),this._initMathObserver(),this._initPlayerObserver(),this._render()}_render(){const{passages:e=[]}=this._model;if(this._model.passages.length>0){const t=e.map((e,t)=>({id:t,...e})),s=P.createElement(L,{tabs:t,model:this._model,baseHeadingLevel:S(this)});this._root||(this._root=R(this)),this._root.render(s),this._initMathObserver()}}_initPlayerObserver(){const e=this.closest("pie-player")||this.closest("pie-item-player");e&&(this._playerObserver=new MutationObserver(()=>{this._render()}),this._playerObserver.observe(e,{attributes:!0,attributeFilter:["base-heading-level"]}))}_disconnectPlayerObserver(){this._playerObserver&&(this._playerObserver.disconnect(),this._playerObserver=null)}disconnectedCallback(){this._disconnectMathObserver(),this._disconnectPlayerObserver(),this._root&&this._root.unmount()}}export{w as default};
package/module/index.html CHANGED
@@ -2,7 +2,7 @@
2
2
  <!doctype html>
3
3
  <html>
4
4
  <head>
5
- <title>@pie-element/passage@6.2.0-next.7</title>
5
+ <title>@pie-element/passage@6.2.0-next.8</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,14 +1,10 @@
1
1
  {
2
2
  "name": "@pie-element/passage",
3
- "version": "6.2.0-next.7",
3
+ "version": "6.2.0-next.8",
4
4
  "modules": [
5
5
  {
6
6
  "name": "@pie-lib/shared-module",
7
- "version": "^4.1.0"
8
- },
9
- {
10
- "name": "@pie-lib/math-rendering-module",
11
- "version": "^4.1.0"
7
+ "version": "^4.1.3"
12
8
  }
13
9
  ]
14
10
  }
package/module/print.html CHANGED
@@ -2,7 +2,7 @@
2
2
  <!doctype html>
3
3
  <html>
4
4
  <head>
5
- <title>@pie-element/passage@6.2.0-next.7</title>
5
+ <title>@pie-element/passage@6.2.0-next.8</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_dom as e,_dll_prop_types as t,_dll_react as n,_dll_mui__material_styles as r,_dll_mui__material as i,_dll_debug as o,_dll_mui__material_collapse as s}from"../../../@pie-lib/shared-module@^4.1.0/module/index.js";import{green as a,orange as l,red as c,indigo as p,pink as d}from"@mui/material/colors";import{_dll_pie_lib__math_rendering as u}from"../../../@pie-lib/math-rendering-module@^4.1.0/module/index.js";var h,m=e;h=m.createRoot,m.hydrateRoot;var f="object"==typeof global&&global&&global.Object===Object&&global,E="object"==typeof self&&self&&self.Object===Object&&self,g=f||E||Function("return this")(),b=g.Symbol,y=Object.prototype,v=y.hasOwnProperty,x=y.toString,C=b?b.toStringTag:void 0;var _=Object.prototype.toString;var k=b?b.toStringTag:void 0;function T(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":k&&k in Object(e)?function(e){var t=v.call(e,C),n=e[C];try{e[C]=void 0;var r=!0}catch(e){}var i=x.call(e);return r&&(t?e[C]=n:delete e[C]),i}(e):function(e){return _.call(e)}(e)}var R=/\s/;var S=/^\s+/;function O(e){return e?e.slice(0,function(e){for(var t=e.length;t--&&R.test(e.charAt(t)););return t}(e)+1).replace(S,""):e}function A(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}var N=/^[-+]0x[0-9a-f]+$/i,M=/^0b[01]+$/i,D=/^0o[0-7]+$/i,F=parseInt;function I(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]"==T(e)}(e))return NaN;if(A(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=A(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=O(e);var n=M.test(e);return n||D.test(e)?F(e.slice(2),n?2:8):N.test(e)?NaN:+e}var B=function(){return g.Date.now()},w=Math.max,L=Math.min;function z(e,t,n){var r,i,o,s,a,l,c=0,p=!1,d=!1,u=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function h(t){var n=r,o=i;return r=i=void 0,c=t,s=e.apply(o,n)}function m(e){var n=e-l;return void 0===l||n>=t||n<0||d&&e-c>=o}function f(){var e=B();if(m(e))return E(e);a=setTimeout(f,function(e){var n=t-(e-l);return d?L(n,o-(e-c)):n}(e))}function E(e){return a=void 0,u&&r?h(e):(r=i=void 0,s)}function g(){var e=B(),n=m(e);if(r=arguments,i=this,l=e,n){if(void 0===a)return function(e){return c=e,a=setTimeout(f,t),p?h(e):s}(l);if(d)return clearTimeout(a),a=setTimeout(f,t),h(l)}return void 0===a&&(a=setTimeout(f,t)),s}return t=I(t)||0,A(n)&&(p=!!n.leading,o=(d="maxWait"in n)?w(I(n.maxWait)||0,t):o,u="trailing"in n?!!n.trailing:u),g.cancel=function(){void 0!==a&&clearTimeout(a),c=0,r=l=i=a=void 0},g.flush=function(){return void 0===a?s:E(B())},g}const j=n,P=t,q=e=>"string"==typeof e?e:"number"==typeof e?`${e}px`:"30px",H=({size:e,children:t})=>{const n={height:e=q(e),width:e,display:"inline-block",position:"relative"};return j.createElement("div",{style:n},t)};H.propTypes={size:P.number,children:P.oneOfType([P.arrayOf(P.node),P.node]).isRequired};const $=n,U=t,Y=({size:e,children:t,sx:n})=>$.createElement(H,{size:e},$.createElement("svg",{preserveAspectRatio:"xMinYMin meet",viewBox:"0 0 44 40",style:{enableBackground:"new 0 0 44 40",...n}},t));Y.propTypes={size:U.oneOfType([U.string,U.number]),children:U.oneOfType([U.arrayOf(U.node),U.node]).isRequired,sx:U.object},U.string.isRequired;const W=({fill:e})=>$.createElement("polygon",{transform:"translate(2, 0)",points:"34.1,28.6 34.1,2.2 2,2.2 2,34.3 40.1,34.3",fill:e});W.propTypes={fill:U.string.isRequired};const K=({fill:e})=>$.createElement("path",{transform:"translate(1, 0)",d:"M31.2,29.1v-0.3c2.2-2.8,3.6-6.3,3.6-10.1c0-8.9-7.2-16.1-16.1-16.1c-8.8,0.1-16,7.3-16,16.2 s7.2,16.1,16.1,16.1h18.5L31.2,29.1z",fill:e});K.propTypes={fill:U.string.isRequired};const G=({fill:e})=>$.createElement("circle",{transform:"translate(-3,0)",cx:"23",cy:"20.4",r:"16",fill:e});G.propTypes={fill:U.string.isRequired};const V=({fill:e})=>$.createElement("rect",{x:"3.6",y:"4.1",width:"32",height:"32",fill:e});V.propTypes={fill:U.string.isRequired};const J=t,X=n;var Q=(e,t)=>{class n extends X.Component{static __initStatic(){this.propTypes={iconSet:J.oneOf(["emoji","check"]),shape:J.oneOf(["round","square"]),category:J.oneOf(["feedback",void 0]),open:J.bool,size:J.oneOfType([J.number,J.string]),fg:J.string,bg:J.string}}static __initStatic2(){this.defaultProps={iconSet:"check",shape:"round",category:void 0,open:!1,size:30,fg:"#4aaf46",bg:"#f8ffe2"}}render(){const{iconSet:n,shape:r,category:i,open:o,size:s,fg:a,bg:l}=this.props,c="check"===n?X.createElement(e,{fill:a}):X.createElement(t,{fill:a}),p="check"===n?X.createElement(e,{fill:l}):X.createElement(t,{fill:l});return o?X.createElement(Y,{size:s},p):X.createElement(Y,{size:s},"feedback"===i?"round"===r?X.createElement(K,{fill:l}):X.createElement(W,{fill:l}):"round"===r?X.createElement(G,{fill:l}):X.createElement(V,{fill:l}),c)}}return n.__initStatic(),n.__initStatic2(),n};const Z=t,ee=n,te=({fill:e})=>ee.createElement("g",{transform:"translate(1, 0)"},ee.createElement("path",{d:"M24.7,22.1c-1.5,1.7-3.6,2.7-5.8,2.7s-4.5-1.1-5.8-2.7l-2.8,1.6c2,2.7,5.2,4.2,8.7,4.2 c3.4,0,6.6-1.6,8.7-4.2L24.7,22.1z",fill:e}),ee.createElement("rect",{x:"21.1",y:"13.1",width:"3.7",height:"4.7",fill:e}),ee.createElement("rect",{x:"12.7",y:"13.1",width:"3.7",height:"4.7",fill:e}));te.propTypes={fill:Z.string.isRequired};const ne=({fill:e,x:t=0,y:n=0})=>ee.createElement("polygon",{transform:`translate(${t}, ${n})`,points:"19.1,28.6 11.8,22.3 14.4,19.2 17.9,22.1 23.9,11.4 27.5,13.4",fill:e});ne.propTypes={fill:Z.string.isRequired,x:Z.number,y:Z.number};const re=Q(ne,te);re.propTypes={iconSet:Z.oneOf(["emoji","check"]),shape:Z.oneOf(["round","square"]),category:Z.oneOf(["feedback",void 0]),open:Z.bool,fg:Z.string,bg:Z.string,size:Z.oneOfType([Z.string,Z.number])},re.defaultProps={iconSet:"check",shape:"round",category:void 0,open:!1,fg:"#4aaf46",bg:"#f8ffe2",size:30};const ie=t,{styled:oe}=r;ie.string.isRequired,ie.string.isRequired,ie.string.isRequired,ie.string.isRequired,ie.string.isRequired,oe("div")(({size:e})=>({width:e||"25px",height:e||"25px"})),ie.bool,ie.string;const se=t,ae=n,le=({fill:e})=>ae.createElement("g",{transform:"translate(0.5, 0.5)"},ae.createElement("rect",{x:"11",y:"17.3",transform:"matrix(0.7071 -0.7071 0.7071 0.7071 -7.852 19.2507)",width:"16.6",height:"3.7",fill:e}),ae.createElement("rect",{x:"17.4",y:"10.7",transform:"matrix(0.7071 -0.7071 0.7071 0.7071 -7.8175 19.209)",width:"3.7",height:"16.6",fill:e}));le.propTypes={fill:se.string.isRequired};const ce=({fill:e})=>ae.createElement("g",{transform:"translate(1,0)"},ae.createElement("rect",{x:"21",y:"12.9",width:"3.7",height:"4.7",fill:e}),ae.createElement("rect",{x:"12.7",y:"12.9",width:"3.7",height:"4.7",fill:e}),ae.createElement("rect",{x:"12.2",y:"22.5",width:"13",height:"3.3",fill:e}));ce.propTypes={fill:se.string.isRequired};const pe=Q(le,ce);pe.propTypes={iconSet:se.oneOf(["emoji","check"]),shape:se.oneOf(["round","square"]),category:se.oneOf(["feedback",void 0]),open:se.bool,fg:se.string,bg:se.string,size:se.oneOfType([se.string,se.number])},pe.defaultProps={iconSet:"check",shape:"round",category:void 0,open:!1,fg:"#fcb733",bg:"#fbf2e3",size:30};const de=t,ue=n,he=()=>{const e={fill:"none",stroke:"#BCE2FF",strokeWidth:2,strokeMiterlimit:10};return ue.createElement("g",null,ue.createElement("line",{style:e,x1:"-98",y1:"142",x2:"-114.6",y2:"142"}),ue.createElement("line",{style:e,x1:"-98",y1:"146.3",x2:"-114.6",y2:"146.3"}),ue.createElement("line",{style:e,x1:"-104",y1:"150.7",x2:"-114.6",y2:"150.7"}))},me=({children:e,size:t})=>ue.createElement(H,{size:t},ue.createElement("svg",{version:"1.1",viewBox:"-128 129 31 31",style:{enableBackground:"new -128 129 31 31"}},e));me.propTypes={children:de.oneOfType([de.arrayOf(de.node),de.node]).isRequired,size:de.number};const fe=()=>ue.createElement("g",null,ue.createElement("rect",{x:"-123.9",y:"135.3",style:{fill:"#D0CAC5",stroke:"#E6E3E0",strokeWidth:.75,strokeLinejoin:"round",strokeMiterlimit:10},width:"4.1",height:"4.1"}),ue.createElement("polygon",{style:{fill:"#D0CAC5",stroke:"#E6E3E0",strokeWidth:.75,strokeLinejoin:"round",strokeMiterlimit:10},points:"-119.8,150.4 -119.8,142.2 -125,142.2 -125,144.9 -122.6,144.9 -122.6,150.4 -125.6,150.4 -125.6,153.2 -116.8,153.2 -116.8,150.4 "}),ue.createElement("rect",{x:"-124.7",y:"134.7",style:{fill:"#B3ABA4",stroke:"#CDC7C2",strokeWidth:.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:10},width:"4.1",height:"4.1"}),ue.createElement("polygon",{style:{fill:"#B3ABA4",stroke:"#CDC7C2",strokeWidth:.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:10},points:"-120.6,149.8 -120.6,141.5 -125.8,141.5 -125.8,144.3 -123.3,144.3 -123.3,149.8 -126.4,149.8 -126.4,152.5 -117.6,152.5 -117.6,149.8 "}),ue.createElement("rect",{x:"-125.5",y:"134",style:{fill:"#7FABC6"},width:"4.1",height:"4.1"}),ue.createElement("polygon",{style:{fill:"#7FABC6"},points:"-121.4,149.1 -121.4,140.9 -126.5,140.9 -126.5,143.6 -124.1,143.6 -124.1,149.1 -127.1,149.1 -127.1,151.9 -118.4,151.9 -118.4,149.1 "})),Ee=()=>ue.createElement("g",null,ue.createElement("rect",{x:"-123.9",y:"135.3",style:{fill:"#D0CAC5",stroke:"#E6E3E0",strokeWidth:.75,strokeLinejoin:"round",strokeMiterlimit:10},width:"4.1",height:"4.1"}),ue.createElement("polygon",{style:{fill:"#D0CAC5",stroke:"#E6E3E0",strokeWidth:.75,strokeLinejoin:"round",strokeMiterlimit:10},points:"-119.8,150.4 -119.8,142.2 -125,142.2 -125,144.9 -122.6,144.9 -122.6,150.4 -125.6,150.4 -125.6,153.2 -116.8,153.2 -116.8,150.4 "}),ue.createElement("rect",{x:"-124.7",y:"134.7",style:{fill:"#B3ABA4",stroke:"#CDC7C2",strokeWidth:.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:10},width:"4.1",height:"4.1"}),ue.createElement("polygon",{style:{fill:"#B3ABA4",stroke:"#CDC7C2",strokeWidth:.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:10},points:"-120.6,149.8 -120.6,141.5 -125.8,141.5 -125.8,144.3 -123.3,144.3 -123.3,149.8 -126.4,149.8 -126.4,152.5 -117.6,152.5 -117.6,149.8 "}),ue.createElement("rect",{x:"-125.5",y:"134",style:{fill:"#1A9CFF"},width:"4.1",height:"4.1"}),ue.createElement("polygon",{style:{fill:"#1A9CFF"},points:"-121.4,149.1 -121.4,140.9 -126.5,140.9 -126.5,143.6 -124.1,143.6 -124.1,149.1 -127.1,149.1 -127.1,151.9 -118.4,151.9 -118.4,149.1 "}));class ge extends ue.Component{constructor(e){super(e)}render(){return!0===this.props.open?ue.createElement(me,null,ue.createElement(fe,null),ue.createElement(he,null)):ue.createElement(me,null,ue.createElement(Ee,null),ue.createElement(he,null))}}ge.propTypes={open:de.bool},ge.defaultProps={open:!1};const be=t,ye=n,ve=({fill:e})=>ye.createElement("path",{fill:e,d:"M-130.4,142.1c0-2.1,1.7-3.9,3.9-3.9c0.3,0,0.5,0,0.8,0.1c-0.6-0.8-1.5-1.3-2.6-1.3c-1.8,0-3.3,1.5-3.3,3.3c0,1.1,0.5,2,1.3,2.6C-130.4,142.6-130.4,142.4-130.4,142.1z"});ve.propTypes={fill:be.string};class xe extends ye.Component{static __initStatic(){this.propTypes={classes:be.object.isRequired,size:be.number}}render(){const{size:e}=this.props;return!0===this.props.open?ye.createElement(H,{size:e},ye.createElement("svg",{preserveAspectRatio:"xMinYMin meet",viewBox:"-135 129 16 32"},ye.createElement("path",{fill:"#BCE2FF",d:"M-122,141.1c0-3.7-3.3-6.6-7.1-5.8c-2.4,0.5-4.3,2.4-4.7,4.8c-0.4,2.3,0.6,4.4,2.2,5.7c0.4,0.3,0.6,0.8,0.6,1.3v1.9h6.1v-1.9c0-0.5,0.2-1,0.6-1.3C-122.8,144.7-122,143-122,141.1z"}),ye.createElement("path",{fill:"#BCE2FF",d:"M-125.7,153h-4.5c-0.4,0-0.8-0.4-0.8-0.8v-1.6h6.1v1.6C-124.9,152.7-125.2,153-125.7,153z"}),ye.createElement(ve,{fill:"#1A9CFF"}))):ye.createElement(H,{size:e},ye.createElement("svg",{preserveAspectRatio:"xMinYMin meet",viewBox:"-135 129 16 31"},ye.createElement("path",{fill:"#D0CAC5",stroke:"#E6E3E0",className:"st0",d:"M-120.7,142.4c0-3.7-3.3-6.6-7.1-5.8c-2.4,0.5-4.3,2.4-4.7,4.8c-0.4,2.3,0.6,4.4,2.2,5.7c0.4,0.3,0.6,0.8,0.6,1.3v1.9h6.1v-1.9c0-0.5,0.2-1,0.6-1.3C-121.6,146-120.7,144.3-120.7,142.4z"}),ye.createElement("path",{fill:"#D0CAC5",stroke:"#E6E3E0",className:"st0",d:"M-124.4,154.3h-4.5c-0.4,0-0.8-0.4-0.8-0.8v-1.6h6.1v1.6C-123.6,153.9-123.9,154.3-124.4,154.3z"}),ye.createElement("path",{fill:"#B3ABA4",stroke:"#CDC7C2",className:"st1",d:"M-121.3,141.8c0-3.7-3.3-6.6-7.1-5.8c-2.4,0.5-4.3,2.4-4.7,4.8c-0.4,2.3,0.6,4.4,2.2,5.7c0.4,0.3,0.6,0.8,0.6,1.3v1.9h6.1v-1.9c0-0.5,0.2-1,0.6-1.3C-122.2,145.3-121.3,143.7-121.3,141.8z"}),",",ye.createElement("path",{fill:"#B3ABA4",stroke:"#CDC7C2",className:"st1",d:"M-125,153.7h-4.5c-0.4,0-0.8-0.4-0.8-0.8v-1.6h6.1v1.6C-124.2,153.3-124.6,153.7-125,153.7z"}),ye.createElement("path",{fill:"#1A9CFF",d:"M-122,141.1c0-3.7-3.3-6.6-7.1-5.8c-2.4,0.5-4.3,2.4-4.7,4.8c-0.4,2.3,0.6,4.4,2.2,5.7c0.4,0.3,0.6,0.8,0.6,1.3v1.9h6.1v-1.9c0-0.5,0.2-1,0.6-1.3C-122.8,144.7-122,143-122,141.1z"}),ye.createElement("path",{fill:"#1A9CFF",d:"M-125.7,153h-4.5c-0.4,0-0.8-0.4-0.8-0.8v-1.6h6.1v1.6C-124.9,152.7-125.2,153-125.7,153z"}),ye.createElement(ve,{fill:"1A9CFF"})))}}xe.__initStatic(),xe.propTypes={open:be.bool},xe.defaultProps={open:!1};const Ce=t,_e=n,ke=({fill:e})=>_e.createElement("g",null,_e.createElement("rect",{x:"19.3",y:"10.3",width:"4.5",height:"12.7",fill:e}),_e.createElement("rect",{x:"19.3",y:"26.2",width:"4.5",height:"4.5",fill:e}));ke.propTypes={fill:Ce.string.isRequired};const Te=({fill:e})=>_e.createElement("polygon",{points:"14.8,4.5 5.6,13.8 5.6,27 14.8,36.5 28.1,36.5 37.6,27 37.6,13.8 28.1,4.5",fill:e});Te.propTypes={fill:Ce.string.isRequired};const Re=({fill:e})=>_e.createElement("g",null,_e.createElement("rect",{x:"23.8",y:"15",width:"3.5",height:"4.4",fill:e}),_e.createElement("rect",{x:"16",y:"15",width:"3.5",height:"4.4",fill:e}),_e.createElement("path",{d:"M24.2,27.1h-5.1c-0.8,0-1.5-0.7-1.5-1.5v0c0-0.8,0.7-1.5,1.5-1.5h5.1c0.8,0,1.5,0.7,1.5,1.5v0 C25.7,26.4,25,27.1,24.2,27.1z",fill:e}));Re.propTypes={fill:Ce.string.isRequired};class Se extends _e.Component{constructor(e){super(e);const{fg:t="#464146",bg:n="white"}=this.props;this.icons={check:_e.createElement(Y,null,_e.createElement(Te,{fill:n}),_e.createElement(ke,{fill:t})),emoji:_e.createElement(Y,null,_e.createElement(Te,{fill:n}),_e.createElement(Re,{fill:t})),feedback:{check:_e.createElement(Y,null,_e.createElement(Te,{fill:n}),_e.createElement(Re,{fill:t})),emoji:_e.createElement(Y,null,_e.createElement(Te,{fill:n}),_e.createElement(Re,{fill:t})),square:{check:_e.createElement(Y,null,_e.createElement(Te,{fill:n}),_e.createElement(ke,{fill:t})),emoji:_e.createElement(Y,null,_e.createElement(Te,{fill:n}),_e.createElement(Re,{fill:t})),open:{check:_e.createElement(Y,null,_e.createElement(ke,{fill:n})),emoji:_e.createElement(Y,null,_e.createElement(Re,{fill:n}))}}}}}render(){const{iconSet:e,category:t,shape:n,open:r}=this.props;return void 0===t?this.icons[e]:void 0===n?this.icons.feedback[e]:!0===r?this.icons.feedback.square.open[e]:this.icons.feedback.square[e]}}Se.propTypes={iconSet:Ce.oneOf(["emoji","check",void 0]),shape:Ce.oneOf(["square",void 0]),category:Ce.oneOf(["feedback",void 0]),open:Ce.bool,fg:Ce.string,bg:Ce.string},Se.defaultProps={iconSet:"check",shape:void 0,category:void 0,open:!1,fg:"#464146",bg:"white"};const Oe=t,Ae=n,Ne=({fill:e})=>Ae.createElement("g",{transform:"translate(0, 0)"},Ae.createElement("polygon",{points:"27.5,13.4 23.9,11.4 15.9,25.8 19.1,28.6",fill:e}),Ae.createElement("polygon",{points:"16.2,20.6 14.4,19.2 11.8,22.3 14.1,24.3",fill:e}));Ne.propTypes={fill:Oe.string.isRequired};const Me=({fill:e})=>Ae.createElement("g",{transform:"translate(2, 0)"},Ae.createElement("rect",{x:"20.6",y:"11.8",width:"4",height:"5",fill:e}),Ae.createElement("rect",{x:"11.5",y:"11.8",width:"4",height:"5",fill:e}),Ae.createElement("rect",{x:"10.9",y:"22.9",transform:"matrix(0.9794 -0.2019 0.2019 0.9794 -4.6237 4.1559)",width:"14.3",height:"3.7",fill:e}));Me.propTypes={fill:Oe.string.isRequired};const De=Q(Ne,Me);De.propTypes={iconSet:Oe.oneOf(["emoji","check"]),shape:Oe.oneOf(["round","square"]),category:Oe.oneOf(["feedback",void 0]),open:Oe.bool,fg:Oe.string,bg:Oe.string,size:Oe.oneOfType([Oe.string,Oe.number])},De.defaultProps={iconSet:"check",shape:"round",category:void 0,open:!1,fg:"#4aaf46",bg:"#c1e1ac",size:30};const Fe=t,Ie=n,Be=({fill:e})=>Ie.createElement("g",null,Ie.createElement("rect",{x:"-115",y:"136.7",width:"3",height:"3",fill:e}),Ie.createElement("polygon",{points:"-112,147.7 -112,141.7 -115.8,141.7 -115.8,143.7 -114,143.7 -114,147.7 -116.2,147.7 -116.2,149.7 -109.8,149.7 -109.8,147.7",fill:e}));Be.propTypes={fill:Fe.string.isRequired};const we=({fill:e})=>Ie.createElement("path",{d:"M-113,158.5c-8,0-14.5-6.5-14.5-14.5s6.5-14.5,14.5-14.5s14.5,6.5,14.5,14.5S-105,158.5-113,158.5z M-113,130.5c-7.4,0-13.5,6.1-13.5,13.5s6.1,13.5,13.5,13.5s13.5-6.1,13.5-13.5S-105.6,130.5-113,130.5z",fill:e});we.propTypes={fill:Fe.string.isRequired};const Le=({fill:e="#FFFFFF"})=>Ie.createElement("g",null,Ie.createElement("path",{style:{fill:"#D0CAC5",stroke:"#E6E3E0",strokeWidth:.75,strokeMiterlimit:10},d:"M-111.7,160.9c-8.5,0-15.5-6.9-15.5-15.5c0-8.5,6.9-15.5,15.5-15.5s15.5,6.9,15.5,15.5C-96.2,154-103.1,160.9-111.7,160.9z"}),Ie.createElement("path",{style:{fill:"#B3ABA4",stroke:"#CDC7C2",strokeWidth:.5,strokeMiterlimit:10},d:"M-112,159.5c-8,0-14.5-6.5-14.5-14.5s6.5-14.5,14.5-14.5s14.5,6.5,14.5,14.5S-104,159.5-112,159.5z"}),Ie.createElement("circle",{cx:"-113",cy:"144",r:"14",fill:e}));Le.propTypes={fill:Fe.string};const ze=({children:e,size:t})=>{const n=q(t),r={height:n,width:n,display:"inline-block",position:"relative"};return Ie.createElement("div",{style:r},Ie.createElement("svg",{preserveAspectRatio:"xMinYMin meet",viewBox:"-129 128 34 34"},e))};ze.propTypes={children:Fe.oneOfType([Fe.arrayOf(Fe.node),Fe.node]).isRequired,size:Fe.oneOfType([Fe.string,Fe.number])};class je extends Ie.Component{render(){const{iconSet:e,open:t,fg:n="#1a9cff",bg:r="#bce2ff",border:i="#bbe3fd"}=this.props,o=Ie.createElement(Be,{fill:n}),s={check:Ie.createElement(ze,{size:this.props.size},Ie.createElement(Le,null),o,Ie.createElement(we,{fill:i})),emoji:Ie.createElement(ze,{size:this.props.size},Ie.createElement(Le,null),o,Ie.createElement(we,{fill:i})),open:{check:Ie.createElement(ze,{size:this.props.size},Ie.createElement("circle",{cx:"-113",cy:"144",r:"14",fill:"#FFFFFF"}),Ie.createElement(Be,{fill:r}),Ie.createElement(we,{fill:"#FFFFFF"})),emoji:Ie.createElement(ze,{size:this.props.size},Ie.createElement("circle",{cx:"-113",cy:"144",r:"14",fill:"#FFFFFF"}),Ie.createElement(Be,{fill:r}),Ie.createElement(we,{fill:i}))}};return!0===t?s.open[e]:s[e]}}function Pe(){return Pe=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Pe.apply(null,arguments)}function qe(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}function He(e,t){return He=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},He(e,t)}function $e(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,He(e,t)}function Ue(e,t){return e.replace(new RegExp("(^|\\s)"+t+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}je.propTypes={iconSet:Fe.oneOf(["emoji","check"]),open:Fe.bool,fg:Fe.string,bg:Fe.string,border:Fe.string,size:Fe.oneOfType([Fe.string,Fe.number])},je.defaultProps={iconSet:"check",open:!1,fg:"#1a9cff",bg:"#bce2ff",border:"#bbe3fd",size:30};var Ye=!1;var We=n.createContext(null),Ke=function(e){return e.scrollTop};const Ge=n,Ve=e;var Je="unmounted",Xe="exited",Qe="entering",Ze="entered",et="exiting",tt=function(e){function t(t,n){var r;r=e.call(this,t,n)||this;var i,o=n&&!n.isMounting?t.enter:t.appear;return r.appearStatus=null,t.in?o?(i=Xe,r.appearStatus=Qe):i=Ze:i=t.unmountOnExit||t.mountOnEnter?Je:Xe,r.state={status:i},r.nextCallback=null,r}$e(t,e),t.getDerivedStateFromProps=function(e,t){return e.in&&t.status===Je?{status:Xe}:null};var n=t.prototype;return n.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},n.componentDidUpdate=function(e){var t=null;if(e!==this.props){var n=this.state.status;this.props.in?n!==Qe&&n!==Ze&&(t=Qe):n!==Qe&&n!==Ze||(t=et)}this.updateStatus(!1,t)},n.componentWillUnmount=function(){this.cancelNextCallback()},n.getTimeouts=function(){var e,t,n,r=this.props.timeout;return e=t=n=r,null!=r&&"number"!=typeof r&&(e=r.exit,t=r.enter,n=void 0!==r.appear?r.appear:t),{exit:e,enter:t,appear:n}},n.updateStatus=function(e,t){if(void 0===e&&(e=!1),null!==t)if(this.cancelNextCallback(),t===Qe){if(this.props.unmountOnExit||this.props.mountOnEnter){var n=this.props.nodeRef?this.props.nodeRef.current:Ve.findDOMNode(this);n&&Ke(n)}this.performEnter(e)}else this.performExit();else this.props.unmountOnExit&&this.state.status===Xe&&this.setState({status:Je})},n.performEnter=function(e){var t=this,n=this.props.enter,r=this.context?this.context.isMounting:e,i=this.props.nodeRef?[r]:[Ve.findDOMNode(this),r],o=i[0],s=i[1],a=this.getTimeouts(),l=r?a.appear:a.enter;!e&&!n||Ye?this.safeSetState({status:Ze},function(){t.props.onEntered(o)}):(this.props.onEnter(o,s),this.safeSetState({status:Qe},function(){t.props.onEntering(o,s),t.onTransitionEnd(l,function(){t.safeSetState({status:Ze},function(){t.props.onEntered(o,s)})})}))},n.performExit=function(){var e=this,t=this.props.exit,n=this.getTimeouts(),r=this.props.nodeRef?void 0:Ve.findDOMNode(this);t&&!Ye?(this.props.onExit(r),this.safeSetState({status:et},function(){e.props.onExiting(r),e.onTransitionEnd(n.exit,function(){e.safeSetState({status:Xe},function(){e.props.onExited(r)})})})):this.safeSetState({status:Xe},function(){e.props.onExited(r)})},n.cancelNextCallback=function(){null!==this.nextCallback&&(this.nextCallback.cancel(),this.nextCallback=null)},n.safeSetState=function(e,t){t=this.setNextCallback(t),this.setState(e,t)},n.setNextCallback=function(e){var t=this,n=!0;return this.nextCallback=function(r){n&&(n=!1,t.nextCallback=null,e(r))},this.nextCallback.cancel=function(){n=!1},this.nextCallback},n.onTransitionEnd=function(e,t){this.setNextCallback(t);var n=this.props.nodeRef?this.props.nodeRef.current:Ve.findDOMNode(this),r=null==e&&!this.props.addEndListener;if(n&&!r){if(this.props.addEndListener){var i=this.props.nodeRef?[this.nextCallback]:[n,this.nextCallback],o=i[0],s=i[1];this.props.addEndListener(o,s)}null!=e&&setTimeout(this.nextCallback,e)}else setTimeout(this.nextCallback,0)},n.render=function(){var e=this.state.status;if(e===Je)return null;var t=this.props,n=t.children;t.in,t.mountOnEnter,t.unmountOnExit,t.appear,t.enter,t.exit,t.timeout,t.addEndListener,t.onEnter,t.onEntering,t.onEntered,t.onExit,t.onExiting,t.onExited,t.nodeRef;var r=qe(t,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]);return Ge.createElement(We.Provider,{value:null},"function"==typeof n?n(e,r):Ge.cloneElement(Ge.Children.only(n),r))},t}(Ge.Component);function nt(){}tt.contextType=We,tt.propTypes={},tt.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:nt,onEntering:nt,onEntered:nt,onExit:nt,onExiting:nt,onExited:nt},tt.UNMOUNTED=Je,tt.EXITED=Xe,tt.ENTERING=Qe,tt.ENTERED=Ze,tt.EXITING=et;var rt=tt;const it=n;var ot=function(e,t){return e&&t&&t.split(" ").forEach(function(t){return r=t,void((n=e).classList?n.classList.add(r):function(e,t){return e.classList?!!t&&e.classList.contains(t):-1!==(" "+(e.className.baseVal||e.className)+" ").indexOf(" "+t+" ")}(n,r)||("string"==typeof n.className?n.className=n.className+" "+r:n.setAttribute("class",(n.className&&n.className.baseVal||"")+" "+r)));var n,r})},st=function(e,t){return e&&t&&t.split(" ").forEach(function(t){return r=t,void((n=e).classList?n.classList.remove(r):"string"==typeof n.className?n.className=Ue(n.className,r):n.setAttribute("class",Ue(n.className&&n.className.baseVal||"",r)));var n,r})},at=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(t=e.call.apply(e,[this].concat(r))||this).appliedClasses={appear:{},enter:{},exit:{}},t.onEnter=function(e,n){var r=t.resolveArguments(e,n),i=r[0],o=r[1];t.removeClasses(i,"exit"),t.addClass(i,o?"appear":"enter","base"),t.props.onEnter&&t.props.onEnter(e,n)},t.onEntering=function(e,n){var r=t.resolveArguments(e,n),i=r[0],o=r[1]?"appear":"enter";t.addClass(i,o,"active"),t.props.onEntering&&t.props.onEntering(e,n)},t.onEntered=function(e,n){var r=t.resolveArguments(e,n),i=r[0],o=r[1]?"appear":"enter";t.removeClasses(i,o),t.addClass(i,o,"done"),t.props.onEntered&&t.props.onEntered(e,n)},t.onExit=function(e){var n=t.resolveArguments(e)[0];t.removeClasses(n,"appear"),t.removeClasses(n,"enter"),t.addClass(n,"exit","base"),t.props.onExit&&t.props.onExit(e)},t.onExiting=function(e){var n=t.resolveArguments(e)[0];t.addClass(n,"exit","active"),t.props.onExiting&&t.props.onExiting(e)},t.onExited=function(e){var n=t.resolveArguments(e)[0];t.removeClasses(n,"exit"),t.addClass(n,"exit","done"),t.props.onExited&&t.props.onExited(e)},t.resolveArguments=function(e,n){return t.props.nodeRef?[t.props.nodeRef.current,e]:[e,n]},t.getClassNames=function(e){var n=t.props.classNames,r="string"==typeof n,i=r?""+(r&&n?n+"-":"")+e:n[e];return{baseClassName:i,activeClassName:r?i+"-active":n[e+"Active"],doneClassName:r?i+"-done":n[e+"Done"]}},t}$e(t,e);var n=t.prototype;return n.addClass=function(e,t,n){var r=this.getClassNames(t)[n+"ClassName"],i=this.getClassNames("enter").doneClassName;"appear"===t&&"done"===n&&i&&(r+=" "+i),"active"===n&&e&&Ke(e),r&&(this.appliedClasses[t][n]=r,ot(e,r))},n.removeClasses=function(e,t){var n=this.appliedClasses[t],r=n.base,i=n.active,o=n.done;this.appliedClasses[t]={},r&&st(e,r),i&&st(e,i),o&&st(e,o)},n.render=function(){var e=this.props;e.classNames;var t=qe(e,["classNames"]);return it.createElement(rt,Pe({},t,{onEnter:this.onEnter,onEntered:this.onEntered,onEntering:this.onEntering,onExit:this.onExit,onExiting:this.onExiting,onExited:this.onExited}))},t}(it.Component);at.defaultProps={classNames:""},at.propTypes={};var lt=at;const{Children:ct}=n,{cloneElement:pt}=n,{isValidElement:dt}=n;function ut(e,t){var n=Object.create(null);return e&&ct.map(e,function(e){return e}).forEach(function(e){n[e.key]=function(e){return t&&dt(e)?t(e):e}(e)}),n}function ht(e,t,n){return null!=n[t]?n[t]:e.props[t]}function mt(e,t,n){var r=ut(e.children),i=function(e,t){function n(n){return n in t?t[n]:e[n]}e=e||{},t=t||{};var r,i=Object.create(null),o=[];for(var s in e)s in t?o.length&&(i[s]=o,o=[]):o.push(s);var a={};for(var l in t){if(i[l])for(r=0;r<i[l].length;r++){var c=i[l][r];a[i[l][r]]=n(c)}a[l]=n(l)}for(r=0;r<o.length;r++)a[o[r]]=n(o[r]);return a}(t,r);return Object.keys(i).forEach(function(o){var s=i[o];if(dt(s)){var a=o in t,l=o in r,c=t[o],p=dt(c)&&!c.props.in;!l||a&&!p?l||!a||p?l&&a&&dt(c)&&(i[o]=pt(s,{onExited:n.bind(null,s),in:c.props.in,exit:ht(s,"exit",e),enter:ht(s,"enter",e)})):i[o]=pt(s,{in:!1}):i[o]=pt(s,{onExited:n.bind(null,s),in:!0,exit:ht(s,"exit",e),enter:ht(s,"enter",e)})}}),i}const ft=n;var Et=Object.values||function(e){return Object.keys(e).map(function(t){return e[t]})},gt=function(e){function t(t,n){var r,i=(r=e.call(this,t,n)||this).handleExited.bind(function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(r));return r.state={contextValue:{isMounting:!0},handleExited:i,firstRender:!0},r}$e(t,e);var n=t.prototype;return n.componentDidMount=function(){this.mounted=!0,this.setState({contextValue:{isMounting:!1}})},n.componentWillUnmount=function(){this.mounted=!1},t.getDerivedStateFromProps=function(e,t){var n,r,i=t.children,o=t.handleExited;return{children:t.firstRender?(n=e,r=o,ut(n.children,function(e){return pt(e,{onExited:r.bind(null,e),in:!0,appear:ht(e,"appear",n),enter:ht(e,"enter",n),exit:ht(e,"exit",n)})})):mt(e,i,o),firstRender:!1}},n.handleExited=function(e,t){var n=ut(this.props.children);e.key in n||(e.props.onExited&&e.props.onExited(t),this.mounted&&this.setState(function(t){var n=Pe({},t.children);return delete n[e.key],{children:n}}))},n.render=function(){var e=this.props,t=e.component,n=e.childFactory,r=qe(e,["component","childFactory"]),i=this.state.contextValue,o=Et(this.state.children).map(n);return delete r.appear,delete r.enter,delete r.exit,null===t?ft.createElement(We.Provider,{value:i},o):ft.createElement(We.Provider,{value:i},ft.createElement(t,r,o))},t}(ft.Component);gt.propTypes={},gt.defaultProps={component:"div",childFactory:function(e){return e}};var bt=gt;const yt={TEXT:"black",DISABLED:"grey",DISABLED_SECONDARY:"#ABABAB",CORRECT:a[500],CORRECT_SECONDARY:a[50],CORRECT_TERTIARY:"#0EA449",CORRECT_WITH_ICON:"#087D38",INCORRECT:l[500],INCORRECT_SECONDARY:c[50],INCORRECT_WITH_ICON:"#BF0D00",MISSING:c[700],MISSING_WITH_ICON:"#6A78A1",PRIMARY:p[500],PRIMARY_LIGHT:p[200],PRIMARY_DARK:p[800],SECONDARY:d.A400,SECONDARY_LIGHT:d[200],SECONDARY_DARK:d[900],TERTIARY:"#146EB3",TERTIARY_LIGHT:"#D0E2F0",BACKGROUND:"rgba(255,255,255,0)",BACKGROUND_DARK:"#ECEDF1",DROPDOWN_BACKGROUND:"#E0E1E6",SECONDARY_BACKGROUND:"rgba(241,241,241,1)",BORDER:"#9A9A9A",BORDER_LIGHT:"#D1D1D1",BORDER_DARK:"#646464",BORDER_GRAY:"#7E8494",BLACK:"#000000",WHITE:"#ffffff",TRANSPARENT:"transparent",FOCUS_CHECKED:"#BBDEFB",FOCUS_CHECKED_BORDER:"#1565C0",FOCUS_UNCHECKED:"#E0E0E0",FOCUS_UNCHECKED_BORDER:"#757575",BLUE_GREY100:"#F3F5F7",BLUE_GREY300:"#C0C3CF",BLUE_GREY600:"#7E8494",BLUE_GREY900:"#152452",FADED_PRIMARY:"#DCDAFB",KEYPAD_BUTTON:"rgb(188, 194, 229)",KEYPAD_BUTTON_OPERATOR:"rgb(255, 159, 192)",KEYPAD_EMPTY_PLACEHOLDER:"rgba(245, 0, 87, 0.4)",KEYPAD_BUTTON_HOVER:"rgb(214, 218, 239)",KEYPAD_BUTTON_OPERATOR_HOVER:"rgb(255, 197, 217)",BUTTON_BORDER:"rgba(0, 0, 0, 0.23)",BUTTON_HOVER_BG:"rgba(0, 0, 0, 0.08)"};Object.freeze(yt);const vt=(xt="pie",(...e)=>{const t=e.pop();return e.reduceRight((e,t)=>`var(--${xt}-${t}, ${e})`,t)});var xt;const Ct=()=>vt("text",yt.TEXT),_t=()=>vt("background",yt.BACKGROUND),kt=n,Tt=t,{styled:Rt}=r,St=Rt("div")({transformOrigin:"0% 0px 0px",width:"100%",display:"block",overflow:"hidden","&.incorrect":{color:"#946202"}}),Ot=Rt("div")({WebkitFontSmoothing:"antialiased",backgroundColor:`var(--feedback-bg-color, ${vt("disabled",yt.DISABLED)})`,borderRadius:"4px",lineHeight:"25px",margin:"0px",padding:"10px",verticalAlign:"middle",color:"var(--feedback-color, white)","&.correct":{backgroundColor:`var(--feedback-correct-bg-color, ${vt("correct",yt.CORRECT)})`},"&.incorrect":{backgroundColor:`var(--feedback-incorrect-bg-color, ${vt("incorrect",yt.INCORRECT)})`}}),At=Rt("div")({"&.feedback-enter":{height:"1px"},"&.feedback-enter-active":{height:"45px",transition:"height 500ms"},"&.feedback-exit":{height:"45px"},"&.feedback-exit-active":{height:"1px",transition:"height 200ms"}});class Nt extends kt.Component{constructor(...e){super(...e),Nt.prototype.__init.call(this)}static __initStatic(){this.propTypes={correctness:Tt.string,feedback:Tt.string}}__init(){this.nodeRef=kt.createRef()}renderFeedback(){const{correctness:e,feedback:t}=this.props;return e&&t?kt.createElement(lt,{key:"hasFeedback",nodeRef:this.nodeRef,timeout:{enter:500,exit:200},classNames:"feedback"},kt.createElement(At,{ref:this.nodeRef},kt.createElement(St,null,kt.createElement(Ot,{className:e,dangerouslySetInnerHTML:{__html:t}})))):null}render(){return kt.createElement("div",null,kt.createElement(bt,null,this.renderFeedback()))}}Nt.__initStatic();const Mt=n,Dt=t,{Popover:Ft}=i,{styled:It}=r,Bt=o("pie-libs:render-ui:response-indicators"),wt=It("div")(({hasFeedback:e})=>({cursor:e?"pointer":"default"})),Lt=It(Ft)({cursor:"pointer"}),zt=It("div")({padding:"0",borderRadius:"4px"}),jt=(e,t)=>{class n extends Mt.Component{constructor(e){super(e),n.prototype.__init.call(this),n.prototype.__init2.call(this),this.state={}}__init(){this.handlePopoverOpen=e=>{Bt("[handlePopoverOpen]",e.target),this.setState({anchorEl:e.target})}}__init2(){this.handlePopoverClose=()=>{this.setState({anchorEl:null})}}render(){const{feedback:n}=this.props,{anchorEl:r}=this.state;return Mt.createElement(wt,{hasFeedback:!!n},Mt.createElement("span",{ref:e=>this.icon=e,onClick:this.handlePopoverOpen},Mt.createElement(e,null)),n&&Mt.createElement(Lt,{PaperComponent:zt,open:!!r,anchorEl:r,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},onClose:this.handlePopoverClose},Mt.createElement(Nt,{feedback:n,correctness:t})))}}return n.propTypes={feedback:Dt.string},n};jt(re,"correct"),jt(pe,"incorrect"),jt(De,"partially-correct"),jt(Se,"nothing-submitted");const Pt=n,{styled:qt}=r,Ht=s,$t=t,{renderMath:Ut}=u,Yt=qt("span")(({theme:e})=>({color:e.palette.primary.light,borderBottom:`1px dotted ${e.palette.primary.light}`,cursor:"pointer"})),Wt=qt(Ht)(({theme:e})=>({paddingTop:e.spacing(2)}));class Kt extends Pt.Component{constructor(...e){super(...e),Kt.prototype.__init.call(this),Kt.prototype.__init2.call(this)}static __initStatic(){this.propTypes={className:$t.string,children:$t.object,labels:$t.shape({visible:$t.string,hidden:$t.string})}}static __initStatic2(){this.defaultProps={labels:{}}}__init(){this.state={expanded:!1}}__init2(){this.toggleExpanded=()=>{this.setState(e=>({expanded:!e.expanded}))}}componentDidMount(){Ut(this.root)}componentDidUpdate(){Ut(this.root)}render(){const{labels:e,children:t,className:n}=this.props,r=this.state.expanded?e.visible||"Hide":e.hidden||"Show";return Pt.createElement("div",{className:n,ref:e=>this.root=e},Pt.createElement("div",{onClick:this.toggleExpanded},Pt.createElement(Yt,null,r)),Pt.createElement(Wt,{in:this.state.expanded,timeout:{enter:225,exit:195},unmountOnExit:!0},t))}}Kt.__initStatic(),Kt.__initStatic2();const{Button:Gt}=i,{styled:Vt}=r;Vt("div")({display:"flex",flexDirection:"column"}),Vt("div")({display:"flex",alignItems:"center",justifyContent:"center"}),Vt("div")(({theme:e})=>({width:"24px",height:"24px",color:"gray",marginRight:e.spacing(1),display:"flex",alignItems:"center"})),Vt(Gt)(({theme:e})=>({display:"flex",alignItems:"center",marginLeft:e.spacing(3),marginRight:e.spacing(3)}));const Jt=n,{createTheme:Xt}=r,{styled:Qt}=r,{StyledEngineProvider:Zt}=r,{ThemeProvider:en}=r,tn=t;const nn=Xt({typography:{fontFamily:"inherit"},palette:{action:{disabled:"rgba(0, 0, 0, 0.54);"}},components:{MuiTypography:{styleOverrides:{root:{fontFamily:"inherit"}}},MuiButton:{styleOverrides:{contained:{backgroundColor:"#e0e0e0",color:"#000000","&:hover":{backgroundColor:"#bdbdbd"}}}}}}),rn=Qt("div")({"& table, th, td":{fontSize:"inherit"}});class on extends Jt.Component{static __initStatic(){this.propTypes={className:tn.string,children:tn.array,extraCSSRules:tn.shape({names:tn.arrayOf(tn.string),rules:tn.string}),fontSizeFactor:tn.number}}static __initStatic2(){this.defaultProps={extraCSSRules:{},fontSizeFactor:1}}constructor(e){super(e),this.classesSheet=document.createElement("style")}computeStyle(e){const t=e=>parseFloat(getComputedStyle(e).fontSize),n=t(document.documentElement),r=t(document.body),i=Math.max(n,r),o=null!=e&&"number"==typeof e?e:1;return 1!==o?{fontSize:i*o+"px"}:null}render(){const{children:e,className:t,fontSizeFactor:n,...r}=this.props,{extraCSSRules:i,...o}=r,s=this.computeStyle(n);return Jt.createElement(Zt,{injectFirst:!0},Jt.createElement(en,{theme:nn},function(e){let t,n=e[0],r=1;for(;r<e.length;){const i=e[r],o=e[r+1];if(r+=2,("optionalAccess"===i||"optionalCall"===i)&&null==n)return;"access"===i||"optionalAccess"===i?(t=n,n=o(n)):"call"!==i&&"optionalCall"!==i||(n=o((...e)=>n.call(t,...e)),t=void 0)}return n}([i,"optionalAccess",e=>e.rules])?Jt.createElement("style",{dangerouslySetInnerHTML:{__html:`.extraCSSRules { ${i.rules} }`}}):null,Jt.createElement(rn,{className:`${t} extraCSSRules`,...o,...s&&{style:s}},e)))}}on.__initStatic(),on.__initStatic2();const sn=n,{styled:an}=r,ln=t,cn=an(on)({display:"flex",flexDirection:"column",position:"relative"});class pn extends sn.Component{static __initStatic(){this.propTypes={ariaLabel:ln.string,children:ln.oneOfType([ln.arrayOf(ln.node),ln.node]).isRequired,role:ln.string,extraCSSRules:ln.shape({names:ln.arrayOf(ln.string),rules:ln.string}),fontSizeFactor:ln.number}}render(){const{children:e,ariaLabel:t,role:n,extraCSSRules:r,fontSizeFactor:i,classes:o}=this.props,s=t?{"aria-label":t,role:n}:{};return sn.createElement(cn,{...s,extraCSSRules:r,fontSizeFactor:i,classes:o},e)}}pn.__initStatic();const dn=n,un=t;class hn extends dn.Component{static __initStatic(){this.propTypes={tag:un.string,className:un.string,html:un.string}}static __initStatic2(){this.defaultProps={tag:"div",html:""}}render(){const{tag:e,className:t,html:n}=this.props,r=e||"div";return dn.createElement(r,{ref:e=>this.node=e,className:t,dangerouslySetInnerHTML:{__html:n}})}}hn.__initStatic(),hn.__initStatic2();const{InputLabel:mn}=i,{FormControl:fn}=i,En=t,{styled:gn}=r;gn(fn)(({theme:e})=>({margin:0,padding:0,flex:"1 0 auto",minWidth:e.spacing(4)})),gn(mn)(()=>({fontSize:"inherit",whiteSpace:"nowrap",margin:0,padding:0,alignSelf:"flex-start",position:"absolute",top:0,left:0,transformOrigin:"top left",pointerEvents:"none","&.MuiInputLabel-shrink":{transform:"scale(0.75) translate(0, -0.75em)"},"&:not(.MuiInputLabel-shrink)":{transform:"translate(0, 0)"}})),En.oneOfType([En.string,En.object]).isRequired,En.string,En.oneOfType([En.arrayOf(En.node),En.node]).isRequired;const bn=n,{Component:yn}=n,{styled:vn}=r,xn=t,{renderMath:Cn}=u,_n=vn("div")(({theme:e,tagName:t})=>({"&:not(.MathJax) > table":{borderCollapse:"collapse"},"&:not(.MathJax) > table:has(tbody tr > th:first-child):not(:has(tbody tr > td:first-child)) tbody td:nth-child(even)":{backgroundColor:"#f6f8fa",color:e.palette.common.black},"&:not(.MathJax) > table:has(tbody tr > td:first-child) tbody tr:nth-child(even) td":{backgroundColor:"#f6f8fa",color:e.palette.common.black},"&:not(.MathJax) table td, &:not(.MathJax) table th":{padding:".6em 1em",textAlign:"left"},"&:not(.MathJax) > table td > p.kds-indent":{textAlign:"initial"},"&.prompt":{verticalAlign:"middle",color:Ct()},"&.legend":{width:"100%",fontSize:"inherit !important"},"&.rationale":{paddingLeft:e.spacing(4),paddingBottom:e.spacing(1)},"&.prompt-label":{color:`${Ct()} !important`,display:"flex",flexDirection:"column",verticalAlign:"middle",cursor:"pointer","& > p":{margin:"0 0 0 0 !important"}}})),kn=/\\embed\{newLine\}\[\]/g;class Tn extends yn{constructor(...e){super(...e),Tn.prototype.__init.call(this)}static __initStatic(){this.propTypes={prompt:xn.string,tagName:xn.string,className:xn.string,onClick:xn.func,defaultClassName:xn.string,autoplayAudioEnabled:xn.bool,customAudioButton:{playImage:xn.string,pauseImage:xn.string}}}static __initStatic2(){this.defaultProps={onClick:()=>{}}}__init(){this.parsedText=e=>{const{customAudioButton:t}=this.props,n=document.createElement("div");n.innerHTML=e;const r=n.querySelector("audio");if(r){const e=document.createElement("source");if(e.setAttribute("type","audio/mp3"),e.setAttribute("src",r.getAttribute("src")),r.removeAttribute("src"),r.setAttribute("id","pie-prompt-audio-player"),r.appendChild(e),t){r.style.display="none";const e=document.createElement("div");e.id="play-audio-button",Object.assign(e.style,{cursor:"pointer",display:"block",width:"128px",height:"128px",backgroundImage:`url(${t.pauseImage})`,backgroundSize:"cover",borderRadius:"50%",border:"1px solid #326295"}),r.parentNode.insertBefore(e,r)}}return n.innerHTML}}addCustomAudioButtonControls(){const{autoplayAudioEnabled:e,customAudioButton:t}=this.props,n=document.getElementById("play-audio-button"),r=document.getElementById("pie-prompt-audio-player");if(e&&r&&r.play().then(()=>{n&&t&&r.addEventListener("ended",o)}).catch(e=>{console.error("Error playing audio",e)}),!n||!r||!t)return;const i=()=>{r.paused&&(n.style.backgroundImage.includes(t.pauseImage)||r.play())},o=()=>{n.style.backgroundImage=`url(${t.playImage})`},s=()=>{Object.assign(n.style,{backgroundImage:`url(${t.pauseImage})`,border:"1px solid #ccc"})},a=()=>{Object.assign(n.style,{backgroundImage:`url(${t.playImage})`,border:"1px solid #326295"})};n.addEventListener("click",i),r.addEventListener("play",s),r.addEventListener("pause",a),r.addEventListener("ended",o),this._handlePlayClick=i,this._handleAudioPlay=s,this._handleAudioPause=a,this._handleAudioEnded=o}removeCustomAudioButtonListeners(){const e=document.getElementById("play-audio-button"),t=document.querySelector("audio");e&&t&&(e.removeEventListener("click",this._handlePlayClick),t.removeEventListener("play",this._handleAudioPlay),t.removeEventListener("pause",this._handleAudioPause),t.removeEventListener("ended",this._handleAudioEnded))}componentDidMount(){this.alignImages(),this.addCustomAudioButtonControls(),this.setupMathRendering()}componentDidUpdate(e){this.alignImages(),e.prompt!==this.props.prompt&&this.renderMathContent()}componentWillUnmount(){this.removeCustomAudioButtonListeners()}setupMathRendering(){this.renderMathContent()}renderMathContent(){const e=document.getElementById("preview-prompt");e&&"function"==typeof Cn&&Cn(e)}alignImages(){document.querySelectorAll("#preview-prompt").forEach(e=>{const t=e.getElementsByTagName("img");if(t&&t.length)for(let e of t)if(e.attributes&&e.attributes.alignment&&e.attributes.alignment.value){const t=e.attributes.alignment.value,n="center"===t?"center":"right"===t?"flex-end":"flex-start",r=e.parentElement;if("DIV"===r.tagName&&"flex"===r.style.display&&"100%"===r.style.width)r.style.justifyContent=n;else{const t=document.createElement("div");t.style.display="flex",t.style.width="100%",t.style.justifyContent=n;const i=e.cloneNode(!0);t.appendChild(i),r.replaceChild(t,e)}}})}render(){const{prompt:e,tagName:t,className:n,onClick:r,defaultClassName:i}=this.props,o=`${n||""} ${i||""} ${"legend"===t?"legend":""}`.trim();return bn.createElement(_n,{as:t||"div",id:"preview-prompt",onClick:r,className:o,tagName:t,dangerouslySetInnerHTML:{__html:this.parsedText(e||"").replace(kn,"\\newline ")}})}}Tn.__initStatic(),Tn.__initStatic2();const Rn=t;Rn.node,Rn.bool;const Sn=t,On=n,An=e=>On.createElement(On.Fragment,null,On.Children.map(e.children,t=>On.cloneElement(t,{"data-pie-purpose":e.purpose})));An.propTypes={children:Sn.node,purpose:Sn.string},"undefined"!=typeof window&&new DOMParser,"undefined"!=typeof window&&new DOMParser;const Nn=n,Mn=t,{Tabs:Dn}=i,{Tab:Fn}=i,{styled:In}=r;const Bn=In("div")({flexGrow:1,backgroundColor:_t(),color:Ct(),"&:not(.MathJax) table":{borderCollapse:"collapse"},"&:not(.MathJax) table td, &:not(.MathJax) table th":{padding:".6em 1em",textAlign:"left"}}),wn=In("div")(({theme:e})=>({backgroundColor:_t(),color:Ct(),padding:e.spacing(2),"& blockquote":{background:"#f9f9f9",borderLeft:"5px solid #ccc",margin:"1.5em 10px",padding:".5em 10px"}})),Ln=In("div")({fontSize:"1.75rem"}),zn=In("div")({fontSize:"1.5rem"}),jn=In("div")({fontSize:"1.25rem"}),Pn=In(Fn)(({theme:e})=>({background:e.palette.common.white,fontSize:"inherit",fontFamily:"Roboto, sans-serif",opacity:.7,color:e.palette.common.black,"&.Mui-selected":{opacity:1,color:e.palette.common.black}}));class qn extends Nn.Component{constructor(...e){super(...e),qn.prototype.__init.call(this),qn.prototype.__init2.call(this),qn.prototype.__init3.call(this),qn.prototype.__init4.call(this)}__init(){this.state={activeTab:0}}__init2(){this.handleChange=(e,t)=>{this.setState(()=>({activeTab:t})),setTimeout(()=>{const e=new CustomEvent("pie-ui-passage-tabChanged",{detail:{tab:t}});window.dispatchEvent(e)})}}__init3(){this.handleKeyDown=(e,t)=>{const{key:n}=e,{tabs:r}=this.props;let i=-1;const o=r.findIndex(e=>e.id===t);switch(n){case"ArrowRight":i=(o+1)%r.length;break;case"ArrowLeft":i=(o-1+r.length)%r.length;break;case"Home":i=0;break;case"End":i=r.length-1;break;case"Enter":case" ":i=o}-1!==i&&(e.preventDefault(),e.stopPropagation(),this.handleChange(e,r[i].id),document.getElementById(`button-${r[i].id}`).focus())}}__init4(){this.parsedText=(e="")=>{const t=document.createElement("div");t.innerHTML=e.replace(/(<br\/>\n)/g,"<br/>");const n=t.querySelector("audio");if(n){const e=document.createElement("source");e.setAttribute("type","audio/mp3"),e.setAttribute("src",n.getAttribute("src")),n.removeAttribute("src"),n.appendChild(e)}return t.innerHTML}}renderInstructions(e,t=!1){if(!e)return;const n=Nn.createElement(Tn,{tagName:"div",className:"prompt",defaultClassName:"teacher-instructions",prompt:e});return t?n:Nn.createElement(Kt,{labels:{hidden:"Show Teacher Instructions",visible:"Hide Teacher Instructions"}},n)}renderTab(e,t){return Nn.createElement(wn,{key:e.id,id:`tabpanel-${e.id}`,role:"tabpanel","aria-labelledby":`button-${e.id}`},this.renderInstructions(e.teacherInstructions,t),(e.title||e.subtitle)&&Nn.createElement("h2",null,e.title&&Nn.createElement(An,{purpose:"passage-title"},Nn.createElement(Ln,{dangerouslySetInnerHTML:{__html:this.parsedText(e.title)}})),e.subtitle&&Nn.createElement(An,{purpose:"passage-subtitle"},Nn.createElement(zn,{dangerouslySetInnerHTML:{__html:this.parsedText(e.subtitle)}}))),e.author&&Nn.createElement(An,{purpose:"passage-author"},Nn.createElement(jn,{className:"author",dangerouslySetInnerHTML:{__html:this.parsedText(e.author)}})),e.text&&Nn.createElement(An,{purpose:"passage-text"},Nn.createElement("div",{key:e.id,className:"text",dangerouslySetInnerHTML:{__html:this.parsedText(e.text)}})))}render(){const{model:e,tabs:t,disabledTabs:n}=this.props,{activeTab:r}=this.state;if(!function(e){let t,n=e[0],r=1;for(;r<e.length;){const i=e[r],o=e[r+1];if(r+=2,("optionalAccess"===i||"optionalCall"===i)&&null==n)return;"access"===i||"optionalAccess"===i?(t=n,n=o(n)):"call"!==i&&"optionalCall"!==i||(n=o((...e)=>n.call(t,...e)),t=void 0)}return n}([t,"optionalAccess",e=>e.length]))return;const{extraCSSRules:i}=e||{},o=(t||[]).find(e=>e.id===r);return Nn.createElement(on,{extraCSSRules:i},Nn.createElement(Bn,{className:"passages"},n||1===t.length?t.map(e=>this.renderTab(e,n)):Nn.createElement(Nn.Fragment,null,Nn.createElement(Dn,{sx:{position:"sticky",top:0,background:_t(),color:Ct(),fontFamily:"Roboto, sans-serif","& .MuiTabs-indicator":{backgroundColor:"#f50057"}},value:r,onChange:this.handleChange},t.map(e=>Nn.createElement(Pn,{key:e.id,id:`button-${e.id}`,label:Nn.createElement(An,{purpose:"passage-label"},Nn.createElement("span",{dangerouslySetInnerHTML:{__html:this.parsedText(e.label)}})),value:e.id,tabIndex:r===e.id?0:-1,"aria-controls":`tabpanel-${e.id}`,"aria-selected":r===e.id,onKeyDown:t=>this.handleKeyDown(t,e.id)}))),o?this.renderTab(o,n):null)))}}qn.propTypes={tabs:Mn.arrayOf(Mn.shape({id:Mn.number.isRequired,label:Mn.string.isRequired,title:Mn.string.isRequired,subtitle:Mn.string,author:Mn.string,text:Mn.string.isRequired,teacherInstructions:Mn.string}).isRequired).isRequired,disabledTabs:Mn.bool,model:Mn.object};const Hn=n,$n=o("pie-element:passage:print"),Un=(e,t)=>(e=>null!=e)(e)?e:t;class Yn extends HTMLElement{constructor(){super(),this._model=null,this._options=null,this._session=[],this._root=null,this._rerender=z(()=>{if(this._model&&this._session){if(this._model.passages&&this._model.passages.length>0){const e=((e,t)=>{const n="instructor"===t.role,r=Un(e.teacherInstructionsEnabled,!0),i=Un(e.titleEnabled,!0),o=Un(e.authorEnabled,!1),s=Un(e.subtitleEnabled,!0),a=Un(e.textEnabled,!0);return e.passages.map((e,t)=>({id:t,teacherInstructions:Un(e.teacherInstructionsEnabled,r)&&n&&e.teacherInstructions||"",label:e.title||`Passage ${t+1}`,title:Un(e.titleEnabled,i)&&e.title||"",author:Un(e.authorEnabled,o)&&e.author||"",subtitle:Un(e.subtitleEnabled,s)&&e.subtitle||"",text:Un(e.textEnabled,a)&&e.text||""}))})(this._model,this._options),t=Hn.createElement(qn,{disabledTabs:!0,tabs:e});this._root||(this._root=h(this)),this._root.render(t)}}else $n("skip")},50,{leading:!1,trailing:!0})}set model(e){this._model=e,this._rerender()}set options(e){this._options=e}connectedCallback(){}disconnectedCallback(){this._root&&this._root.unmount()}}export{Yn as default};
1
+ import{_dll_react as e,_dll_prop_types as t,_dll_mui__material as n,_dll_mui__material_styles as r,_dll_pie_lib__render_ui as a,_dll_debug as i,_dll_react_dom_client as o}from"../../../@pie-lib/shared-module@^4.1.3/module/index.js";var s="object"==typeof global&&global&&global.Object===Object&&global,l="object"==typeof self&&self&&self.Object===Object&&self,c=s||l||Function("return this")(),u=c.Symbol,d=Object.prototype,p=d.hasOwnProperty,b=d.toString,h=u?u.toStringTag:void 0;var m=Object.prototype.toString;var f=u?u.toStringTag:void 0;function g(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":f&&f in Object(e)?function(e){var t=p.call(e,h),n=e[h];try{e[h]=void 0;var r=!0}catch(e){}var a=b.call(e);return r&&(t?e[h]=n:delete e[h]),a}(e):function(e){return m.call(e)}(e)}var v=/\s/;var y=/^\s+/;function _(e){return e?e.slice(0,function(e){for(var t=e.length;t--&&v.test(e.charAt(t)););return t}(e)+1).replace(y,""):e}function x(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}var E=/^[-+]0x[0-9a-f]+$/i,T=/^0b[01]+$/i,k=/^0o[0-7]+$/i,S=parseInt;function C(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]"==g(e)}(e))return NaN;if(x(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=x(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=_(e);var n=T.test(e);return n||k.test(e)?S(e.slice(2),n?2:8):E.test(e)?NaN:+e}var I=function(){return c.Date.now()},M=Math.max,w=Math.min;function j(e,t,n){var r,a,i,o,s,l,c=0,u=!1,d=!1,p=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function b(t){var n=r,i=a;return r=a=void 0,c=t,o=e.apply(i,n)}function h(e){var n=e-l;return void 0===l||n>=t||n<0||d&&e-c>=i}function m(){var e=I();if(h(e))return f(e);s=setTimeout(m,function(e){var n=t-(e-l);return d?w(n,i-(e-c)):n}(e))}function f(e){return s=void 0,p&&r?b(e):(r=a=void 0,o)}function g(){var e=I(),n=h(e);if(r=arguments,a=this,l=e,n){if(void 0===s)return function(e){return c=e,s=setTimeout(m,t),u?b(e):o}(l);if(d)return clearTimeout(s),s=setTimeout(m,t),b(l)}return void 0===s&&(s=setTimeout(m,t)),o}return t=C(t)||0,x(n)&&(u=!!n.leading,i=(d="maxWait"in n)?M(C(n.maxWait)||0,t):i,p="trailing"in n?!!n.trailing:p),g.cancel=function(){void 0!==s&&clearTimeout(s),c=0,r=l=a=s=void 0},g.flush=function(){return void 0===s?o:f(I())},g}const H=e,L=t,{Tabs:R}=n,{Tab:A}=n,{styled:N}=r,{Collapsible:O}=a,{color:$}=a,{PreviewPrompt:q}=a,{Purpose:D}=a,{UiLayout:P}=a,{transformDataHeadings:z}=a;const F=N("div")({flexGrow:1,backgroundColor:$.background(),color:$.text(),"&:not(.MathJax) table":{borderCollapse:"collapse"},"&:not(.MathJax) table td, &:not(.MathJax) table th":{padding:".6em 1em",textAlign:"left"}}),J=N("div")(({theme:e})=>({backgroundColor:$.background(),color:$.text(),padding:e.spacing(2),"& blockquote":{background:"#f9f9f9",borderLeft:"5px solid #ccc",margin:"1.5em 10px",padding:".5em 10px"}})),K=N("div")({fontSize:"1.75rem"}),U=N("div")({fontSize:"1.5rem"}),W=N("div")({fontSize:"1.25rem"}),B=N(A)(({theme:e})=>({background:e.palette.common.white,fontSize:"inherit",fontFamily:"Roboto, sans-serif",opacity:.7,color:e.palette.common.black,"&.Mui-selected":{opacity:1,color:e.palette.common.black}}));class G extends H.Component{constructor(...e){super(...e),G.prototype.__init.call(this),G.prototype.__init2.call(this),G.prototype.__init3.call(this),G.prototype.__init4.call(this)}__init(){this.state={activeTab:0}}__init2(){this.handleChange=(e,t)=>{this.setState(()=>({activeTab:t})),setTimeout(()=>{const e=new CustomEvent("pie-ui-passage-tabChanged",{detail:{tab:t}});window.dispatchEvent(e)})}}__init3(){this.handleKeyDown=(e,t)=>{const{key:n}=e,{tabs:r}=this.props;let a=-1;const i=r.findIndex(e=>e.id===t);switch(n){case"ArrowRight":a=(i+1)%r.length;break;case"ArrowLeft":a=(i-1+r.length)%r.length;break;case"Home":a=0;break;case"End":a=r.length-1;break;case"Enter":case" ":a=i}-1!==a&&(e.preventDefault(),e.stopPropagation(),this.handleChange(e,r[a].id),document.getElementById(`button-${r[a].id}`).focus())}}__init4(){this.parsedText=(e="")=>{const t=document.createElement("div");t.innerHTML=e.replace(/(<br\/>\n)/g,"<br/>");const n=t.querySelector("audio");if(n){const e=document.createElement("source");e.setAttribute("type","audio/mp3"),e.setAttribute("src",n.getAttribute("src")),n.removeAttribute("src"),n.appendChild(e)}return t.innerHTML}}renderInstructions(e,t=!1){if(!e)return;const n=H.createElement(q,{tagName:"div",className:"prompt",defaultClassName:"teacher-instructions",prompt:e});return t?n:H.createElement(O,{labels:{hidden:"Show Teacher Instructions",visible:"Hide Teacher Instructions"}},n)}renderTab(e,t){const{baseHeadingLevel:n}=this.props,r=n?Math.min(6,Math.max(1,n)):void 0,a=n?`h${r}`:"h2",i=n?Math.min(6,Math.max(1,r+1)):void 0;return H.createElement(J,{key:e.id,id:`tabpanel-${e.id}`,role:"tabpanel","aria-labelledby":`button-${e.id}`},this.renderInstructions(e.teacherInstructions,t),e.title&&H.createElement(D,{purpose:"passage-title"},H.createElement(a,null,H.createElement(K,{dangerouslySetInnerHTML:{__html:this.parsedText(e.title)}}))),e.subtitle&&H.createElement(D,{purpose:"passage-subtitle"},H.createElement(U,{dangerouslySetInnerHTML:{__html:this.parsedText(e.subtitle)}})),e.author&&H.createElement(D,{purpose:"passage-author"},H.createElement(W,{className:"author",dangerouslySetInnerHTML:{__html:this.parsedText(e.author)}})),e.text&&H.createElement(D,{purpose:"passage-text"},H.createElement("div",{key:e.id,className:"text",dangerouslySetInnerHTML:{__html:n?z(e.text,i):e.text}})))}render(){const{model:e,tabs:t,disabledTabs:n}=this.props,{activeTab:r}=this.state;if(!function(e){let t,n=e[0],r=1;for(;r<e.length;){const a=e[r],i=e[r+1];if(r+=2,("optionalAccess"===a||"optionalCall"===a)&&null==n)return;"access"===a||"optionalAccess"===a?(t=n,n=i(n)):"call"!==a&&"optionalCall"!==a||(n=i((...e)=>n.call(t,...e)),t=void 0)}return n}([t,"optionalAccess",e=>e.length]))return;const{extraCSSRules:a}=e||{},i=(t||[]).find(e=>e.id===r);return H.createElement(P,{extraCSSRules:a},H.createElement(F,{className:"passages"},n||1===t.length?t.map(e=>this.renderTab(e,n)):H.createElement(H.Fragment,null,H.createElement(R,{sx:{position:"sticky",top:0,background:$.background(),color:$.text(),fontFamily:"Roboto, sans-serif","& .MuiTabs-indicator":{backgroundColor:"#f50057"}},value:r,onChange:this.handleChange},t.map(e=>H.createElement(B,{key:e.id,id:`button-${e.id}`,label:H.createElement(D,{purpose:"passage-label"},H.createElement("span",{dangerouslySetInnerHTML:{__html:this.parsedText(e.label)}})),value:e.id,tabIndex:r===e.id?0:-1,"aria-controls":`tabpanel-${e.id}`,"aria-selected":r===e.id,onKeyDown:t=>this.handleKeyDown(t,e.id)}))),i?this.renderTab(i,n):null)))}}G.propTypes={tabs:L.arrayOf(L.shape({id:L.number.isRequired,label:L.string.isRequired,title:L.string.isRequired,subtitle:L.string,author:L.string,text:L.string.isRequired,teacherInstructions:L.string}).isRequired).isRequired,disabledTabs:L.bool,model:L.object,baseHeadingLevel:L.number};const Q=e,{createRoot:V}=o,X=i("pie-element:passage:print"),Y=(e,t)=>(e=>null!=e)(e)?e:t;class Z extends HTMLElement{constructor(){super(),this._model=null,this._options=null,this._session=[],this._root=null,this._rerender=j(()=>{if(this._model&&this._session){if(this._model.passages&&this._model.passages.length>0){const e=((e,t)=>{const n="instructor"===t.role,r=Y(e.teacherInstructionsEnabled,!0),a=Y(e.titleEnabled,!0),i=Y(e.authorEnabled,!1),o=Y(e.subtitleEnabled,!0),s=Y(e.textEnabled,!0);return e.passages.map((e,t)=>({id:t,teacherInstructions:Y(e.teacherInstructionsEnabled,r)&&n&&e.teacherInstructions||"",label:e.title||`Passage ${t+1}`,title:Y(e.titleEnabled,a)&&e.title||"",author:Y(e.authorEnabled,i)&&e.author||"",subtitle:Y(e.subtitleEnabled,o)&&e.subtitle||"",text:Y(e.textEnabled,s)&&e.text||""}))})(this._model,this._options),t=Q.createElement(G,{disabledTabs:!0,tabs:e});this._root||(this._root=V(this)),this._root.render(t)}}else X("skip")},50,{leading:!1,trailing:!0})}set model(e){this._model=e,this._rerender()}set options(e){this._options=e}connectedCallback(){}disconnectedCallback(){this._root&&this._root.unmount()}}export{Z as default};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pie-element/passage",
3
3
  "repository": "pie-framework/pie-elements",
4
- "version": "6.2.0-next.8",
4
+ "version": "6.2.0-next.9",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -14,13 +14,13 @@
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/math-rendering": "4.2.0-next.3",
18
- "@pie-lib/render-ui": "5.2.0-next.8",
17
+ "@pie-lib/math-rendering": "4.2.0-next.4",
18
+ "@pie-lib/render-ui": "5.2.0-next.9",
19
19
  "prop-types": "^15.8.1",
20
20
  "react": "18.3.1",
21
21
  "react-dom": "18.3.1"
22
22
  },
23
- "gitHead": "8c88ef381fb968e335518ffdc7f37790859ee415",
23
+ "gitHead": "f5114ccf4572d5dbf15c5175000fd06116878af8",
24
24
  "scripts": {
25
25
  "postpublish": "../../scripts/postpublish"
26
26
  },