@pie-element/passage 7.1.1-next.17 → 7.1.1-next.174
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/configure/lib/index.js +1 -0
- package/configure/lib/index.js.map +1 -1
- package/configure/package.json +2 -2
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/stimulus-tabs.js +132 -20
- package/lib/stimulus-tabs.js.map +1 -1
- package/module/configure.js +1 -1
- package/module/element.js +1 -1
- package/module/manifest.json +5 -1
- package/module/print.js +1 -1
- package/package.json +4 -4
package/configure/lib/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_react","_interopRequireDefault","require","_client","_pieConfigureEvents","_design","_defaults","PassageConfigure","HTMLElement","constructor","_root","_model","createDefaultModel","_configuration","defaultValues","configuration","model","m","render","c","connectedCallback","modelChanged","dispatchEvent","ModelUpdatedEvent","onConfigurationChanged","insertImage","handler","InsertImageEvent","onDeleteImage","src","done","DeleteImageEvent","insertSound","InsertSoundEvent","onDeleteSound","DeleteSoundEvent","el","React","createElement","Main","onModelChanged","bind","imageSupport","add","delete","uploadSoundSupport","createRoot","disconnectedCallback","unmount","exports","default","_defineProperty2"],"sources":["../src/index.js"],"sourcesContent":["import React from 'react';\nimport { createRoot } from 'react-dom/client';\nimport {\n ModelUpdatedEvent,\n DeleteImageEvent,\n InsertImageEvent,\n InsertSoundEvent,\n DeleteSoundEvent,\n} from '@pie-framework/pie-configure-events';\n\nimport Main from './design';\nimport defaultValues from './defaults';\n\nexport default class PassageConfigure extends HTMLElement {\n static createDefaultModel = (model = {}) => ({\n ...defaultValues.model,\n ...model,\n });\n\n constructor() {\n super();\n this._root = null;\n this._model = PassageConfigure.createDefaultModel();\n this._configuration = defaultValues.configuration;\n }\n\n set model(m) {\n this._model = PassageConfigure.createDefaultModel(m);\n this.render();\n }\n\n set configuration(c) {\n this._configuration = c;\n this.render();\n }\n\n connectedCallback() {\n this.render();\n }\n\n modelChanged(m) {\n this._model = m;\n this.dispatchEvent(new ModelUpdatedEvent(this._model), true);\n this.render();\n }\n\n onConfigurationChanged(c) {\n this._configuration = c;\n\n this.render();\n }\n\n insertImage(handler) {\n this.dispatchEvent(new InsertImageEvent(handler));\n }\n\n onDeleteImage(src, done) {\n this.dispatchEvent(new DeleteImageEvent(src, done));\n }\n\n insertSound(handler) {\n this.dispatchEvent(new InsertSoundEvent(handler));\n }\n\n onDeleteSound(src, done) {\n this.dispatchEvent(new DeleteSoundEvent(src, done));\n }\n\n render() {\n if (this._model) {\n const el = React.createElement(Main, {\n model: this._model,\n configuration: this._configuration,\n onModelChanged: this.modelChanged.bind(this),\n onConfigurationChanged: this.onConfigurationChanged.bind(this),\n imageSupport: {\n add: this.insertImage.bind(this),\n delete: this.onDeleteImage.bind(this),\n },\n uploadSoundSupport: {\n add: this.insertSound.bind(this),\n delete: this.onDeleteSound.bind(this),\n },\n });\n\n if (!this._root) {\n this._root = createRoot(this);\n }\n this._root.render(el);\n }\n }\n\n disconnectedCallback() {\n if (this._root) {\n this._root.unmount();\n }\n }\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,mBAAA,GAAAF,OAAA;AAQA,IAAAG,OAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,SAAA,GAAAL,sBAAA,CAAAC,OAAA;AAEe,MAAMK,gBAAgB,SAASC,WAAW,CAAC;EAMxDC,WAAWA,CAAA,EAAG;IACZ,KAAK,CAAC,CAAC;IACP,IAAI,CAACC,KAAK,GAAG,IAAI;IACjB,IAAI,CAACC,MAAM,GAAGJ,gBAAgB,CAACK,kBAAkB,CAAC,CAAC;IACnD,IAAI,CAACC,cAAc,GAAGC,iBAAa,CAACC,aAAa;EACnD;EAEA,IAAIC,KAAKA,CAACC,CAAC,EAAE;IACX,IAAI,CAACN,MAAM,G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IAAI,CAACL,MAAM;QAClBI,aAAa,EAAE,IAAI,CAACF,cAAc;QAClC2B,cAAc,EAAE,IAAI,CAACnB,YAAY,CAACoB,IAAI,CAAC,IAAI,CAAC;QAC5CjB,sBAAsB,EAAE,IAAI,CAACA,sBAAsB,CAACiB,IAAI,CAAC,IAAI,CAAC;QAC9DC,YAAY,EAAE;UACZC,GAAG,EAAE,IAAI,CAAClB,WAAW,CAACgB,IAAI,CAAC,IAAI,CAAC;UAChCG,MAAM,EAAE,IAAI,CAAChB,aAAa,CAACa,IAAI,CAAC,IAAI;QACtC,CAAC;QACDI,kBAAkB,EAAE;UAClBF,GAAG,EAAE,IAAI,CAACX,WAAW,CAACS,IAAI,CAAC,IAAI,CAAC;UAChCG,MAAM,EAAE,IAAI,CAACV,aAAa,CAACO,IAAI,CAAC,IAAI;QACtC;MACF,CAAC,CAAC;MAEF,IAAI,CAAC,IAAI,CAAC/B,KAAK,EAAE;QACf,IAAI,CAACA,KAAK,GAAG,IAAAoC,kBAAU,EAAC,IAAI,CAAC;MAC/B;MACA,IAAI,CAACpC,KAAK,CAACQ,MAAM,CAACkB,EAAE,CAAC;IACvB;EACF;EAEAW,oBAAoBA,CAAA,EAAG;IACrB,IAAI,IAAI,CAACrC,KAAK,EAAE;MACd,IAAI,CAACA,KAAK,CAACsC,OAAO,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","names":["_react","_interopRequireDefault","require","_client","_pieConfigureEvents","_design","_defaults","PassageConfigure","HTMLElement","constructor","_root","_model","createDefaultModel","_configuration","defaultValues","configuration","model","m","render","c","connectedCallback","modelChanged","dispatchEvent","ModelUpdatedEvent","onConfigurationChanged","insertImage","handler","InsertImageEvent","onDeleteImage","src","done","DeleteImageEvent","insertSound","InsertSoundEvent","onDeleteSound","DeleteSoundEvent","el","React","createElement","Main","onModelChanged","bind","imageSupport","add","delete","uploadSoundSupport","createRoot","disconnectedCallback","unmount","exports","default","_defineProperty2"],"sources":["../src/index.js"],"sourcesContent":["import React from 'react';\nimport { createRoot } from 'react-dom/client';\nimport {\n ModelUpdatedEvent,\n DeleteImageEvent,\n InsertImageEvent,\n InsertSoundEvent,\n DeleteSoundEvent,\n} from '@pie-framework/pie-configure-events';\n\nimport Main from './design';\nimport defaultValues from './defaults';\n\nexport default class PassageConfigure extends HTMLElement {\n static createDefaultModel = (model = {}) => ({\n ...defaultValues.model,\n ...model,\n });\n\n constructor() {\n super();\n this._root = null;\n this._model = PassageConfigure.createDefaultModel();\n this._configuration = defaultValues.configuration;\n }\n\n set model(m) {\n this._model = PassageConfigure.createDefaultModel(m);\n this.render();\n }\n\n set configuration(c) {\n this._configuration = c;\n this.render();\n }\n\n connectedCallback() {\n this.render();\n }\n\n modelChanged(m) {\n this._model = m;\n this.dispatchEvent(new ModelUpdatedEvent(this._model), true);\n this.render();\n }\n\n onConfigurationChanged(c) {\n this._configuration = c;\n\n this.render();\n }\n\n insertImage(handler) {\n this.dispatchEvent(new InsertImageEvent(handler));\n }\n\n onDeleteImage(src, done) {\n this.dispatchEvent(new DeleteImageEvent(src, done));\n }\n\n insertSound(handler) {\n this.dispatchEvent(new InsertSoundEvent(handler));\n }\n\n onDeleteSound(src, done) {\n this.dispatchEvent(new DeleteSoundEvent(src, done));\n }\n\n render() {\n if (this._model) {\n const el = React.createElement(Main, {\n model: this._model,\n configuration: this._configuration,\n onModelChanged: this.modelChanged.bind(this),\n onConfigurationChanged: this.onConfigurationChanged.bind(this),\n imageSupport: {\n add: this.insertImage.bind(this),\n delete: this.onDeleteImage.bind(this),\n },\n uploadSoundSupport: {\n add: this.insertSound.bind(this),\n delete: this.onDeleteSound.bind(this),\n },\n });\n\n if (!this._root) {\n this._root = createRoot(this);\n }\n this._root.render(el);\n }\n }\n\n disconnectedCallback() {\n if (this._root) {\n this._root.unmount();\n this._root = null;\n }\n }\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA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AAI,CAACA,KAAK,CAACsC,OAAO,CAAC,CAAC;MACpB,IAAI,CAACtC,KAAK,GAAG,IAAI;IACnB;EACF;AACF;AAACuC,OAAA,CAAAC,OAAA,GAAA3C,gBAAA;AAAA,IAAA4C,gBAAA,CAAAD,OAAA,EArFoB3C,gBAAgB,wBACP,CAACS,KAAK,GAAG,CAAC,CAAC,MAAM;EAC3C,GAAGF,iBAAa,CAACE,KAAK;EACtB,GAAGA;AACL,CAAC,CAAC","ignoreList":[]}
|
package/configure/package.json
CHANGED
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
"@mui/icons-material": "^7.3.4",
|
|
14
14
|
"@mui/material": "^7.3.4",
|
|
15
15
|
"@pie-framework/pie-configure-events": "^1.3.0",
|
|
16
|
-
"@pie-lib/config-ui": "13.0.
|
|
17
|
-
"@pie-lib/editable-html-tip-tap": "2.1.
|
|
16
|
+
"@pie-lib/config-ui": "13.0.20",
|
|
17
|
+
"@pie-lib/editable-html-tip-tap": "2.1.18",
|
|
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
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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,OAAA;AAEA,SAASM,mBAAmBA,CAACC,OAAO,EAAE;EACpC,MAAMC,MAAM,GACVD,OAAO,CAACE,OAAO,CAAC,YAAY,CAAC,IAC7BF,OAAO,CAACE,OAAO,CAAC,iBAAiB,CAAC;EAEpC,IAAID,MAAM,EAAE;IACV,IAAIE,GAAG,GAAGF,MAAM,CAACG,gBAAgB;;IAEjC;IACA,IAAID,GAAG,IAAI,IAAI,EAAE;MACfA,GAAG,GACDF,MAAM,CAACI,YAAY,CAAC,oBAAoB,C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E6D,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;
|
|
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 this._root = null;\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;AAEA,SAASM,mBAAmBA,CAACC,OAAO,EAAE;EACpC,MAAMC,MAAM,GACVD,OAAO,CAACE,OAAO,CAAC,YAAY,CAAC,IAC7BF,OAAO,CAACE,OAAO,CAAC,iBAAiB,CAAC;EAEpC,IAAID,MAAM,EAAE;IACV,IAAIE,GAAG,GAAGF,MAAM,CAACG,gBAAgB;;IAEjC;IACA,IAAID,GAAG,IAAI,IAAI,EAAE;MACfA,GAAG,GACDF,MAAM,CAACI,YAAY,CAAC,oBAAoB,CAAC,IACzCJ,MAAM,CAACI,YAAY,CAAC,kBAAkB,CAAC;IAC3C;IAEA,MAAMC,WAAW,GAAGC,QAAQ,CAACJ,GAAG,EAAE,EAAE,CAAC;IAErC,IAAIK,MAAM,CAACC,QAAQ,CAACH,WAAW,CAAC,IAAIA,WAAW,IAAI,CAAC,IAAIA,WAAW,IAAI,CAAC,EAAE;MACxE,OAAOA,WAAW;IACpB;EACF;EAEA,OAAOI,SAAS;AAClB;AAEe,MAAMC,UAAU,SAASC,W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C;IAC9B,IAAI,CAAC0B,yBAAyB,CAAC,CAAC;IAChC,IAAI,IAAI,CAACpC,KAAK,EAAE;MACd,IAAI,CAACA,KAAK,CAACsC,OAAO,CAAC,CAAC;MACpB,IAAI,CAACtC,KAAK,GAAG,IAAI;IACnB;EACF;AACF;AAACuC,OAAA,CAAApD,OAAA,GAAAJ,UAAA","ignoreList":[]}
|
package/lib/stimulus-tabs.js
CHANGED
|
@@ -18,6 +18,34 @@ var _renderUi = require("@pie-lib/render-ui");
|
|
|
18
18
|
// instead of being locked to the top of the panel, so that they do not lock up
|
|
19
19
|
// space needed for the passage text (WCAG 1.4.10 Reflow, 400% zoom / 320px).
|
|
20
20
|
const STICKY_TABS_BREAKPOINT = 840;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Zoom compensation for the passage selection tabs.
|
|
24
|
+
*
|
|
25
|
+
* The tabs scale naturally with browser zoom up to 200%. Beyond 200%,
|
|
26
|
+
* we shrink their CSS size proportionally so their physical on-screen size
|
|
27
|
+
* freezes at the 200% appearance, leaving more room for passage content
|
|
28
|
+
* in high-zoom / small-window situations.
|
|
29
|
+
* The factor is min(1, 2 / zoom): exactly 1 at zoom <= 200% (component
|
|
30
|
+
* behavior unchanged), shrinking proportionally above that. A lower clamp
|
|
31
|
+
* of 0.4 guards against inflated ratios (docked devtools, browser side
|
|
32
|
+
* panels, window chrome) ever making the tabs unusably small.
|
|
33
|
+
*/
|
|
34
|
+
const MAX_TABS_ZOOM = 2;
|
|
35
|
+
const MIN_ZOOM_COMPENSATION = 0.4;
|
|
36
|
+
|
|
37
|
+
// Per-tab horizontal-space floor in CSS pixels. When the passage container is
|
|
38
|
+
// narrow enough that each tab would have at most this much room
|
|
39
|
+
// (containerWidth <= tabs.length * NUMERIC_LABEL_MIN_WIDTH_PER_TAB), tab labels
|
|
40
|
+
// fall back to "Passage 1", "Passage 2", ... so navigation stays usable instead
|
|
41
|
+
// of being dominated by aggressively truncated titles.
|
|
42
|
+
const NUMERIC_LABEL_MIN_WIDTH_PER_TAB = 170;
|
|
43
|
+
const computeZoomCompensation = () => {
|
|
44
|
+
if (typeof window === 'undefined') return 1;
|
|
45
|
+
const ratio = window.outerWidth / window.innerWidth;
|
|
46
|
+
const zoom = Number.isFinite(ratio) && ratio > 0 ? ratio : 1;
|
|
47
|
+
return Math.max(MIN_ZOOM_COMPENSATION, Math.min(1, MAX_TABS_ZOOM / zoom));
|
|
48
|
+
};
|
|
21
49
|
const PassagesContainer = (0, _styles.styled)('div')({
|
|
22
50
|
flexGrow: 1,
|
|
23
51
|
backgroundColor: _renderUi.color.background(),
|
|
@@ -55,14 +83,26 @@ const PassageAuthor = (0, _styles.styled)('div')({
|
|
|
55
83
|
const TabStyled = (0, _styles.styled)(_Tab.default)(({
|
|
56
84
|
theme
|
|
57
85
|
}) => ({
|
|
58
|
-
|
|
59
|
-
|
|
86
|
+
/*
|
|
87
|
+
* The tab carries the colour of the panel it opens, which is what makes it read as a
|
|
88
|
+
* tab rather than a button, and it has to be the themed panel colour: MUI's palette
|
|
89
|
+
* does not follow `--pie-*`, so `common.white` here left the tab white on every color
|
|
90
|
+
* scheme while the passage body beneath it went dark. The comment this replaces gated
|
|
91
|
+
* the change on PD-2801, which is about OT's `color-contrast` class -- the mechanism
|
|
92
|
+
* pie-theme superseded, and blocked since 2023.
|
|
93
|
+
*/
|
|
94
|
+
background: _renderUi.color.background(),
|
|
60
95
|
fontSize: 'inherit',
|
|
61
96
|
fontFamily: 'Roboto, sans-serif',
|
|
62
|
-
color:
|
|
63
|
-
// remove when PD-2801 is DONE
|
|
97
|
+
color: _renderUi.color.text(),
|
|
64
98
|
borderRadius: `${theme.spacing(2)} ${theme.spacing(2)} 0 0`,
|
|
65
|
-
|
|
99
|
+
/*
|
|
100
|
+
* `--pie-border-gray` is stepped to the 3:1 non-text minimum in every scheme. The
|
|
101
|
+
* literal it replaces measured about 1.2:1 against the dark schemes' surfaces, so the
|
|
102
|
+
* tab outline -- the only thing separating an unselected tab from the strip -- was
|
|
103
|
+
* invisible there.
|
|
104
|
+
*/
|
|
105
|
+
border: `1px solid ${_renderUi.color.borderGray()}`,
|
|
66
106
|
borderBottomWidth: 0,
|
|
67
107
|
minHeight: '56px',
|
|
68
108
|
padding: '8px 10px',
|
|
@@ -82,36 +122,58 @@ const TabStyled = (0, _styles.styled)(_Tab.default)(({
|
|
|
82
122
|
opacity: 0.7
|
|
83
123
|
},
|
|
84
124
|
'&.Mui-selected': {
|
|
85
|
-
color:
|
|
125
|
+
color: _renderUi.color.text(),
|
|
86
126
|
'.passage-label': {
|
|
87
127
|
opacity: 1
|
|
88
128
|
},
|
|
89
129
|
'.passage-label-underline': {
|
|
90
|
-
backgroundColor:
|
|
130
|
+
backgroundColor: _renderUi.color.tertiary()
|
|
91
131
|
}
|
|
92
132
|
},
|
|
93
133
|
'&:hover': {
|
|
94
134
|
'.passage-label-underline': {
|
|
95
|
-
backgroundColor:
|
|
135
|
+
backgroundColor: _renderUi.color.tertiaryLight()
|
|
96
136
|
}
|
|
97
137
|
},
|
|
98
138
|
'& .MuiTouchRipple-root': {
|
|
99
139
|
opacity: 0.7
|
|
100
140
|
}
|
|
101
141
|
}));
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
142
|
+
|
|
143
|
+
/*
|
|
144
|
+
* The selection indicator, one per tab. Unselected it has to disappear into the tab, so it
|
|
145
|
+
* paints the tab's own background rather than a fixed white; selected it becomes
|
|
146
|
+
* `--pie-tertiary`, which every scheme sets.
|
|
147
|
+
*/
|
|
148
|
+
const Underline = (0, _styles.styled)('div')(() => ({
|
|
105
149
|
height: '2px',
|
|
106
150
|
width: '100%',
|
|
107
151
|
marginTop: '6px',
|
|
108
|
-
background:
|
|
152
|
+
background: _renderUi.color.background()
|
|
109
153
|
}));
|
|
110
154
|
class StimulusTabs extends _react.default.Component {
|
|
111
155
|
constructor(...args) {
|
|
112
156
|
super(...args);
|
|
113
157
|
(0, _defineProperty2.default)(this, "state", {
|
|
114
|
-
activeTab: 0
|
|
158
|
+
activeTab: 0,
|
|
159
|
+
zoomCompensation: computeZoomCompensation(),
|
|
160
|
+
containerWidth: 0
|
|
161
|
+
});
|
|
162
|
+
(0, _defineProperty2.default)(this, "containerRef", /*#__PURE__*/_react.default.createRef());
|
|
163
|
+
(0, _defineProperty2.default)(this, "updateZoomCompensation", () => {
|
|
164
|
+
this.setState({
|
|
165
|
+
zoomCompensation: computeZoomCompensation()
|
|
166
|
+
});
|
|
167
|
+
});
|
|
168
|
+
(0, _defineProperty2.default)(this, "updateContainerWidth", () => {
|
|
169
|
+
const node = this.containerRef.current;
|
|
170
|
+
if (!node) return;
|
|
171
|
+
const width = node.clientWidth;
|
|
172
|
+
if (width !== this.state.containerWidth) {
|
|
173
|
+
this.setState({
|
|
174
|
+
containerWidth: width
|
|
175
|
+
});
|
|
176
|
+
}
|
|
115
177
|
});
|
|
116
178
|
(0, _defineProperty2.default)(this, "handleChange", (event, activeTab) => {
|
|
117
179
|
this.setState(() => ({
|
|
@@ -191,6 +253,23 @@ class StimulusTabs extends _react.default.Component {
|
|
|
191
253
|
return div.innerHTML;
|
|
192
254
|
});
|
|
193
255
|
}
|
|
256
|
+
componentDidMount() {
|
|
257
|
+
if (typeof window === 'undefined') return;
|
|
258
|
+
window.addEventListener('resize', this.updateZoomCompensation);
|
|
259
|
+
if (this.containerRef.current && typeof ResizeObserver !== 'undefined') {
|
|
260
|
+
this.resizeObserver = new ResizeObserver(this.updateContainerWidth);
|
|
261
|
+
this.resizeObserver.observe(this.containerRef.current);
|
|
262
|
+
}
|
|
263
|
+
this.updateContainerWidth();
|
|
264
|
+
}
|
|
265
|
+
componentWillUnmount() {
|
|
266
|
+
if (typeof window === 'undefined') return;
|
|
267
|
+
window.removeEventListener('resize', this.updateZoomCompensation);
|
|
268
|
+
if (this.resizeObserver) {
|
|
269
|
+
this.resizeObserver.disconnect();
|
|
270
|
+
this.resizeObserver = null;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
194
273
|
renderInstructions(teacherInstructions, disabledTabs = false) {
|
|
195
274
|
if (!teacherInstructions) {
|
|
196
275
|
return;
|
|
@@ -260,7 +339,9 @@ class StimulusTabs extends _react.default.Component {
|
|
|
260
339
|
disabledTabs
|
|
261
340
|
} = this.props;
|
|
262
341
|
const {
|
|
263
|
-
activeTab
|
|
342
|
+
activeTab,
|
|
343
|
+
zoomCompensation,
|
|
344
|
+
containerWidth
|
|
264
345
|
} = this.state;
|
|
265
346
|
if (!tabs?.length) {
|
|
266
347
|
return;
|
|
@@ -269,10 +350,21 @@ class StimulusTabs extends _react.default.Component {
|
|
|
269
350
|
extraCSSRules
|
|
270
351
|
} = model || {};
|
|
271
352
|
const selectedTab = (tabs || []).find(tab => tab.id === activeTab);
|
|
353
|
+
|
|
354
|
+
// cap each tab at 1/n of the passage container width so a single long
|
|
355
|
+
// title can't push other tabs off-screen. Existing two-line wrap + ellipsis
|
|
356
|
+
// on .passage-label still trims anything that doesn't fit.
|
|
357
|
+
const tabMaxWidth = containerWidth > 0 ? containerWidth / tabs.length : null;
|
|
358
|
+
// When per-tab horizontal space drops to NUMERIC_LABEL_MIN_WIDTH_PER_TAB or
|
|
359
|
+
// less, titles become unreadably truncated; swap to "Passage N" so users
|
|
360
|
+
// can still navigate. Container width is read once layout has settled
|
|
361
|
+
// (>0), so initial render uses real labels.
|
|
362
|
+
const useNumericLabels = containerWidth > 0 && containerWidth <= tabs.length * NUMERIC_LABEL_MIN_WIDTH_PER_TAB;
|
|
272
363
|
return /*#__PURE__*/_react.default.createElement(_renderUi.UiLayout, {
|
|
273
364
|
extraCSSRules: extraCSSRules
|
|
274
365
|
}, /*#__PURE__*/_react.default.createElement(PassagesContainer, {
|
|
275
|
-
className: "passages"
|
|
366
|
+
className: "passages",
|
|
367
|
+
ref: this.containerRef
|
|
276
368
|
}, disabledTabs || tabs.length === 1 ? tabs.map(tab => this.renderTab(tab, disabledTabs)) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_Tabs.default, {
|
|
277
369
|
sx: {
|
|
278
370
|
// Below the breakpoint (e.g. WCAG 400% zoom, ~320px viewport)
|
|
@@ -287,25 +379,45 @@ class StimulusTabs extends _react.default.Component {
|
|
|
287
379
|
top: 0,
|
|
288
380
|
zIndex: 1
|
|
289
381
|
},
|
|
290
|
-
background:
|
|
382
|
+
background: 'var(--pie-passage-header-background, rgba(255,255,255,0))',
|
|
291
383
|
color: _renderUi.color.text(),
|
|
292
384
|
fontFamily: 'Roboto, sans-serif',
|
|
385
|
+
// Freeze the tabs' physical size at their 200%-zoom appearance
|
|
386
|
+
// when browser zoom exceeds 200%. The factor is 1 at zoom <= 200%,
|
|
387
|
+
// so behavior below that threshold is unchanged. Using `zoom`
|
|
388
|
+
// (rather than transform: scale) shrinks the layout box itself,
|
|
389
|
+
// so the reclaimed space flows to the passage content below.
|
|
390
|
+
zoom: zoomCompensation,
|
|
293
391
|
'& .MuiTabs-list': {
|
|
294
|
-
|
|
392
|
+
/*
|
|
393
|
+
* The strip behind the tabs. A host that has opted into
|
|
394
|
+
* `--pie-passage-header-background` keeps its own colour on every
|
|
395
|
+
* scheme -- Knowledge Checks' pale green-blue is deliberate and is not
|
|
396
|
+
* a scheme's business to override. With no host colour the fallback has
|
|
397
|
+
* to be a theme token rather than a white literal, or the strip stays
|
|
398
|
+
* white over a dark passage body.
|
|
399
|
+
*/
|
|
400
|
+
backgroundColor: `var(--pie-passage-header-background, ${_renderUi.color.backgroundDark()})`,
|
|
401
|
+
borderBottom: `1px solid ${_renderUi.color.borderGray()}`
|
|
295
402
|
},
|
|
296
403
|
'& .MuiTabs-indicator': {
|
|
297
|
-
backgroundColor:
|
|
404
|
+
backgroundColor: _renderUi.color.white(),
|
|
298
405
|
marginBottom: '-1px'
|
|
299
406
|
}
|
|
300
407
|
},
|
|
301
408
|
value: activeTab,
|
|
302
409
|
onChange: this.handleChange
|
|
303
|
-
}, tabs.map(tab => /*#__PURE__*/_react.default.createElement(TabStyled, {
|
|
410
|
+
}, tabs.map((tab, index) => /*#__PURE__*/_react.default.createElement(TabStyled, {
|
|
304
411
|
key: tab.id,
|
|
305
412
|
id: `button-${tab.id}`,
|
|
413
|
+
sx: tabMaxWidth ? {
|
|
414
|
+
maxWidth: `${tabMaxWidth}px`
|
|
415
|
+
} : undefined,
|
|
306
416
|
label: /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_renderUi.Purpose, {
|
|
307
417
|
purpose: "passage-label"
|
|
308
|
-
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
418
|
+
}, useNumericLabels ? /*#__PURE__*/_react.default.createElement("span", {
|
|
419
|
+
className: "passage-label"
|
|
420
|
+
}, `Passage ${index + 1}`) : /*#__PURE__*/_react.default.createElement("span", {
|
|
309
421
|
className: "passage-label",
|
|
310
422
|
dangerouslySetInnerHTML: {
|
|
311
423
|
__html: this.parsedText(tab.label)
|
package/lib/stimulus-tabs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stimulus-tabs.js","names":["_react","_interopRequireDefault","require","_propTypes","_Tabs","_Tab","_styles","_renderUi","STICKY_TABS_BREAKPOINT","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","black","borderRadius","border","borderBottomWidth","minHeight","display","alignItems","justifyContent","textTransform","WebkitLineClamp","WebkitBoxOrient","overflow","textOverflow","whiteSpace","opacity","Underline","height","width","marginTop","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","zIndex","borderBottom","marginBottom","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\n// Must match the breakpoint Quiz Engine passes to the PIE section player for\n// switching from the side-by-side passage/question layout to the tabbed layout.\n// Below (and at) this width the passage tabs scroll with the passage content\n// instead of being locked to the top of the panel, so that they do not lock up\n// space needed for the passage text (WCAG 1.4.10 Reflow, 400% zoom / 320px).\nconst STICKY_TABS_BREAKPOINT = 840;\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 color: theme.palette.common.black, // remove when PD-2801 is DONE\n borderRadius: `${theme.spacing(2)} ${theme.spacing(2)} 0 0`,\n border: '1px solid #D9DADA',\n borderBottomWidth: 0,\n minHeight: '56px',\n padding: '8px 10px',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n margin: `0 ${theme.spacing(1)}`,\n textTransform: 'none',\n\n '.passage-label': {\n display: '-webkit-box',\n WebkitLineClamp: 2,\n WebkitBoxOrient: 'vertical',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'normal',\n margin: 'auto 0',\n opacity: 0.7,\n },\n\n '&.Mui-selected': {\n color: theme.palette.common.black,\n '.passage-label': {\n opacity: 1,\n },\n '.passage-label-underline': {\n backgroundColor: '#146EB3',\n },\n },\n\n '&:hover': {\n '.passage-label-underline': {\n backgroundColor: '#D0E2F0',\n },\n },\n\n '& .MuiTouchRipple-root': {\n opacity: 0.7,\n },\n}));\n\nconst Underline = styled('div')(({ theme }) => ({\n height: '2px',\n width: '100%',\n marginTop: '6px',\n background: theme.palette.common.white, // replace with color.background() once PD-2801 is DONE\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 // Below the breakpoint (e.g. WCAG 400% zoom, ~320px viewport)\n // the tabs are in normal flow and scroll with the passage text,\n // so they don't lock up space needed to display the passage.\n position: 'static',\n // Above the breakpoint there is adequate screen space, so the\n // tabs stay locked to the top of the panel while the passage\n // text scrolls beneath them.\n [`@media (min-width: ${STICKY_TABS_BREAKPOINT + 1}px)`]: {\n position: 'sticky',\n top: 0,\n zIndex: 1,\n },\n background: color.background(),\n color: color.text(),\n fontFamily: 'Roboto, sans-serif',\n '& .MuiTabs-list': {\n borderBottom: '1px solid #D9DADA',\n },\n '& .MuiTabs-indicator': {\n backgroundColor: '#ffffff',\n marginBottom: '-1px',\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 <>\n <Purpose purpose=\"passage-label\">\n <span\n className=\"passage-label\"\n dangerouslySetInnerHTML={{ __html: this.parsedText(tab.label) }}\n />\n </Purpose>\n <Underline className=\"passage-label-underline\" />\n </>\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,IAAAK,SAAA,GAAAL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names":["_react","_interopRequireDefault","require","_propTypes","_Tabs","_Tab","_styles","_renderUi","STICKY_TABS_BREAKPOINT","MAX_TABS_ZOOM","MIN_ZOOM_COMPENSATION","NUMERIC_LABEL_MIN_WIDTH_PER_TAB","computeZoomCompensation","window","ratio","outerWidth","innerWidth","zoom","Number","isFinite","Math","max","min","PassagesContainer","styled","flexGrow","backgroundColor","color","background","text","borderCollapse","padding","textAlign","Passage","theme","spacing","borderLeft","margin","PassageTitle","fontSize","PassageSubtitle","PassageAuthor","TabStyled","Tab","fontFamily","borderRadius","border","borderGray","borderBottomWidth","minHeight","display","alignItems","justifyContent","textTransform","WebkitLineClamp","WebkitBoxOrient","overflow","textOverflow","whiteSpace","opacity","tertiary","tertiaryLight","Underline","height","width","marginTop","StimulusTabs","React","Component","constructor","args","_defineProperty2","default","activeTab","zoomCompensation","containerWidth","createRef","setState","node","containerRef","current","clientWidth","state","event","setTimeout","tabChangeEvent","CustomEvent","detail","tab","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","componentDidMount","addEventListener","updateZoomCompensation","ResizeObserver","resizeObserver","updateContainerWidth","observe","componentWillUnmount","removeEventListener","disconnect","renderInstructions","teacherInstructions","disabledTabs","teacherInstructionsDiv","PreviewPrompt","tagName","className","defaultClassName","prompt","Collapsible","labels","hidden","visible","renderTab","baseHeadingLevel","clampedLevel","undefined","TitleTag","textLevel","role","title","Purpose","purpose","dangerouslySetInnerHTML","__html","parsedText","subtitle","author","transformDataHeadings","render","model","extraCSSRules","selectedTab","find","tabMaxWidth","useNumericLabels","UiLayout","ref","map","Fragment","sx","position","top","zIndex","backgroundDark","borderBottom","white","marginBottom","value","onChange","index","maxWidth","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\n// Must match the breakpoint Quiz Engine passes to the PIE section player for\n// switching from the side-by-side passage/question layout to the tabbed layout.\n// Below (and at) this width the passage tabs scroll with the passage content\n// instead of being locked to the top of the panel, so that they do not lock up\n// space needed for the passage text (WCAG 1.4.10 Reflow, 400% zoom / 320px).\nconst STICKY_TABS_BREAKPOINT = 840;\n\n/**\n * Zoom compensation for the passage selection tabs.\n *\n * The tabs scale naturally with browser zoom up to 200%. Beyond 200%,\n * we shrink their CSS size proportionally so their physical on-screen size\n * freezes at the 200% appearance, leaving more room for passage content\n * in high-zoom / small-window situations.\n * The factor is min(1, 2 / zoom): exactly 1 at zoom <= 200% (component\n * behavior unchanged), shrinking proportionally above that. A lower clamp\n * of 0.4 guards against inflated ratios (docked devtools, browser side\n * panels, window chrome) ever making the tabs unusably small.\n */\nconst MAX_TABS_ZOOM = 2;\nconst MIN_ZOOM_COMPENSATION = 0.4;\n\n// Per-tab horizontal-space floor in CSS pixels. When the passage container is\n// narrow enough that each tab would have at most this much room\n// (containerWidth <= tabs.length * NUMERIC_LABEL_MIN_WIDTH_PER_TAB), tab labels\n// fall back to \"Passage 1\", \"Passage 2\", ... so navigation stays usable instead\n// of being dominated by aggressively truncated titles.\nconst NUMERIC_LABEL_MIN_WIDTH_PER_TAB = 170;\n\nconst computeZoomCompensation = () => {\n if (typeof window === 'undefined') return 1;\n const ratio = window.outerWidth / window.innerWidth;\n const zoom = Number.isFinite(ratio) && ratio > 0 ? ratio : 1;\n return Math.max(MIN_ZOOM_COMPENSATION, Math.min(1, MAX_TABS_ZOOM / zoom));\n};\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 /*\n * The tab carries the colour of the panel it opens, which is what makes it read as a\n * tab rather than a button, and it has to be the themed panel colour: MUI's palette\n * does not follow `--pie-*`, so `common.white` here left the tab white on every color\n * scheme while the passage body beneath it went dark. The comment this replaces gated\n * the change on PD-2801, which is about OT's `color-contrast` class -- the mechanism\n * pie-theme superseded, and blocked since 2023.\n */\n background: color.background(),\n fontSize: 'inherit',\n fontFamily: 'Roboto, sans-serif',\n color: color.text(),\n borderRadius: `${theme.spacing(2)} ${theme.spacing(2)} 0 0`,\n /*\n * `--pie-border-gray` is stepped to the 3:1 non-text minimum in every scheme. The\n * literal it replaces measured about 1.2:1 against the dark schemes' surfaces, so the\n * tab outline -- the only thing separating an unselected tab from the strip -- was\n * invisible there.\n */\n border: `1px solid ${color.borderGray()}`,\n borderBottomWidth: 0,\n minHeight: '56px',\n padding: '8px 10px',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n margin: `0 ${theme.spacing(1)}`,\n textTransform: 'none',\n\n '.passage-label': {\n display: '-webkit-box',\n WebkitLineClamp: 2,\n WebkitBoxOrient: 'vertical',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'normal',\n margin: 'auto 0',\n opacity: 0.7,\n },\n\n '&.Mui-selected': {\n color: color.text(),\n '.passage-label': {\n opacity: 1,\n },\n '.passage-label-underline': {\n backgroundColor: color.tertiary(),\n },\n },\n\n '&:hover': {\n '.passage-label-underline': {\n backgroundColor: color.tertiaryLight(),\n },\n },\n\n '& .MuiTouchRipple-root': {\n opacity: 0.7,\n },\n}));\n\n/*\n * The selection indicator, one per tab. Unselected it has to disappear into the tab, so it\n * paints the tab's own background rather than a fixed white; selected it becomes\n * `--pie-tertiary`, which every scheme sets.\n */\nconst Underline = styled('div')(() => ({\n height: '2px',\n width: '100%',\n marginTop: '6px',\n background: color.background(),\n}));\n\nclass StimulusTabs extends React.Component {\n state = {\n activeTab: 0,\n zoomCompensation: computeZoomCompensation(),\n containerWidth: 0,\n };\n\n containerRef = React.createRef();\n\n componentDidMount() {\n if (typeof window === 'undefined') return;\n window.addEventListener('resize', this.updateZoomCompensation);\n\n if (this.containerRef.current && typeof ResizeObserver !== 'undefined') {\n this.resizeObserver = new ResizeObserver(this.updateContainerWidth);\n this.resizeObserver.observe(this.containerRef.current);\n }\n\n this.updateContainerWidth();\n }\n\n componentWillUnmount() {\n if (typeof window === 'undefined') return;\n window.removeEventListener('resize', this.updateZoomCompensation);\n\n if (this.resizeObserver) {\n this.resizeObserver.disconnect();\n this.resizeObserver = null;\n }\n }\n\n updateZoomCompensation = () => {\n this.setState({ zoomCompensation: computeZoomCompensation() });\n };\n\n updateContainerWidth = () => {\n const node = this.containerRef.current;\n if (!node) return;\n const width = node.clientWidth;\n if (width !== this.state.containerWidth) {\n this.setState({ containerWidth: width });\n }\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, zoomCompensation, containerWidth } = 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 // cap each tab at 1/n of the passage container width so a single long\n // title can't push other tabs off-screen. Existing two-line wrap + ellipsis\n // on .passage-label still trims anything that doesn't fit.\n const tabMaxWidth = containerWidth > 0 ? containerWidth / tabs.length : null;\n // When per-tab horizontal space drops to NUMERIC_LABEL_MIN_WIDTH_PER_TAB or\n // less, titles become unreadably truncated; swap to \"Passage N\" so users\n // can still navigate. Container width is read once layout has settled\n // (>0), so initial render uses real labels.\n const useNumericLabels =\n containerWidth > 0 && containerWidth <= tabs.length * NUMERIC_LABEL_MIN_WIDTH_PER_TAB;\n\n return (\n <UiLayout extraCSSRules={extraCSSRules}>\n <PassagesContainer className=\"passages\" ref={this.containerRef}>\n {disabledTabs || tabs.length === 1 ? (\n tabs.map((tab) => this.renderTab(tab, disabledTabs))\n ) : (\n <>\n <Tabs\n sx={{\n // Below the breakpoint (e.g. WCAG 400% zoom, ~320px viewport)\n // the tabs are in normal flow and scroll with the passage text,\n // so they don't lock up space needed to display the passage.\n position: 'static',\n // Above the breakpoint there is adequate screen space, so the\n // tabs stay locked to the top of the panel while the passage\n // text scrolls beneath them.\n [`@media (min-width: ${STICKY_TABS_BREAKPOINT + 1}px)`]: {\n position: 'sticky',\n top: 0,\n zIndex: 1,\n },\n background: 'var(--pie-passage-header-background, rgba(255,255,255,0))',\n color: color.text(),\n fontFamily: 'Roboto, sans-serif',\n // Freeze the tabs' physical size at their 200%-zoom appearance\n // when browser zoom exceeds 200%. The factor is 1 at zoom <= 200%,\n // so behavior below that threshold is unchanged. Using `zoom`\n // (rather than transform: scale) shrinks the layout box itself,\n // so the reclaimed space flows to the passage content below.\n zoom: zoomCompensation,\n '& .MuiTabs-list': {\n /*\n * The strip behind the tabs. A host that has opted into\n * `--pie-passage-header-background` keeps its own colour on every\n * scheme -- Knowledge Checks' pale green-blue is deliberate and is not\n * a scheme's business to override. With no host colour the fallback has\n * to be a theme token rather than a white literal, or the strip stays\n * white over a dark passage body.\n */\n backgroundColor: `var(--pie-passage-header-background, ${color.backgroundDark()})`,\n borderBottom: `1px solid ${color.borderGray()}`,\n },\n '& .MuiTabs-indicator': {\n backgroundColor: color.white(),\n marginBottom: '-1px',\n },\n }}\n value={activeTab}\n onChange={this.handleChange}\n >\n {tabs.map((tab, index) => (\n <TabStyled\n key={tab.id}\n id={`button-${tab.id}`}\n sx={tabMaxWidth ? { maxWidth: `${tabMaxWidth}px` } : undefined}\n label={\n <>\n <Purpose purpose=\"passage-label\">\n {useNumericLabels ? (\n <span className=\"passage-label\">{`Passage ${index + 1}`}</span>\n ) : (\n <span\n className=\"passage-label\"\n dangerouslySetInnerHTML={{ __html: this.parsedText(tab.label) }}\n />\n )}\n </Purpose>\n <Underline className=\"passage-label-underline\" />\n </>\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,IAAAK,SAAA,GAAAL,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA,MAAMM,sBAAsB,GAAG,GAAG;;AAElC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,aAAa,GAAG,CAAC;AACvB,MAAMC,qBAAqB,GAAG,GAAG;;AAEjC;AACA;AACA;AACA;AACA;AACA,MAA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9B,CAAC;AAAC,IAAAK,QAAA,GAAAC,OAAA,CAAAxH,OAAA,GAEaN,YAAY","ignoreList":[]}
|
package/module/configure.js
CHANGED
|
@@ -1 +1 @@
|
|
|
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@^5.2.4/module/index.js";import{_dll_pie_lib__config_ui as l}from"../../../@pie-lib/config-module@^4.0.9/module/index.js";import{_dll_pie_lib__editable_html_tip_tap as o}from"../../../@pie-lib/editable-html-module@^7.1.6/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};
|
|
1
|
+
import{_dll_prop_types as e,_dll_mui__material_styles as t,_dll_react as n,_dll_mui__material as a,_dll_mui__icons_material as i,_dll_react_dom_client as s}from"../../../@pie-lib/shared-module@6.0.0/module/index.js";import{_dll_pie_lib__config_ui as l}from"../../../@pie-lib/config-module@5.0.0/module/index.js";import{_dll_pie_lib__editable_html_tip_tap as o}from"../../../@pie-lib/editable-html-module@8.0.0/module/index.js";var 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=n,f=e,{styled:x}=t,{Button:S}=a,{Dialog:I}=a,{DialogTitle:v}=a,{DialogContent:P}=a,{DialogContentText:y}=a,{DialogActions:T}=a,{RemoveCircle:R}=i,{AddCircle:q}=i,D=x(({label:e,type:t="add",onClick:n})=>{const a="add"===t?q:R;return E.createElement(S,{color:"primary",size:"small",onClick:n},E.createElement(a,{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:n,ok:a,open:i,onOk:s,onCancel:l})=>E.createElement(I,{open:i},E.createElement(v,null,n),E.createElement(P,null,E.createElement(y,null,e)),E.createElement(T,null,s&&E.createElement(S,{onClick:s,color:"primary"},a),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=n,M=e,{styled:w}=t,{InputContainer:j}=l,O=o,{ALL_PLUGINS:Y}=o;function L(e){let t,n=e[0],a=1;for(;a<e.length;){const i=e[a],s=e[a+1];if(a+=2,("optionalAccess"===i||"optionalCall"===i)&&null==n)return;"access"===i||"optionalAccess"===i?(t=n,n=s(n)):"call"!==i&&"optionalCall"!==i||(n=s((...e)=>n.call(t,...e)),t=void 0)}return n}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:n,onModelChanged:a,passageIndex:i}=this.props;if(!n.passages||i<0||i>=n.passages.length)return;const s=[...n.passages];s[i]={...s[i],[e]:t},a({...n,passages:s})}}render(){const{model:e,configuration:t,imageSupport:n,passageIndex:a,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[a]||{},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[a].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[a].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[a].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[a].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[a].text||"",onChange:e=>this.handleChange("text",e),imageSupport:n,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=n,$=e,{styled:F}=t,{Typography:U}=a,{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,n)=>{let a=e.passages;a.splice(t,1),n({...e,passages:a}),this.setState({showConfirmationDialog:!1,indexToRemove:-1})}}__init3(){this.removeAdditionalPassage=e=>{const{model:t={},onModelChanged:n}=this.props,{passages:a=[]}=t,{teacherInstructions:i="",title:s="",subtitle:l="",author:o="",text:r=""}=a[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,n)}}__init4(){this.addAdditionalPassage=()=>{const{model:e,onModelChanged:t}=this.props,n=[...e.passages,{teacherInstructions:"",title:"",subtitle:"",author:"",text:""}];t({...e,passages:n})}}render(){const{model:e,configuration:t,imageSupport:n,onConfigurationChanged:a,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=>a(e),groups:{Settings:_,Properties:C}})},b.map((a,l)=>B.createElement(B.Fragment,{key:l},l>0&&B.createElement(V,{variant:"h5"},h.label),B.createElement(z,{imageSupport:n,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=n,{createRoot:ne}=s;class ae extends HTMLElement{static __initStatic(){this.createDefaultModel=(e={})=>({...Z,...e})}constructor(){super(),this._root=null,this._model=ae.createDefaultModel(),this._configuration=ee}set model(e){this._model=ae.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=ne(this)),this._root.render(e)}}disconnectedCallback(){this._root&&(this._root.unmount(),this._root=null)}}ae.__initStatic();export{ae as default};
|
package/module/element.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_dll_pie_lib__math_rendering as e}from"../../../@pie-lib/math-rendering-module@^5.0.9/module/index.js";import{_dll_react as t,_dll_prop_types as s,_dll_mui__material as i,_dll_mui__material_styles as a,_dll_pie_lib__render_ui as r,_dll_react_dom_client as n}from"../../../@pie-lib/shared-module@^5.2.4/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 d=o.ModelSetEvent=l;class c extends CustomEvent{constructor(e,t){super(c.TYPE,{bubbles:!0,composed:!0,detail:{complete:t,component:e}}),this.component=e,this.complete=t}}c.TYPE="session-changed",o.SessionChangedEvent=c;const h=t,p=s,{Tabs:m}=i,{Tab:b}=i,{styled:u}=a,{Collapsible:g}=r,{color:_}=r,{PreviewPrompt:v}=r,{Purpose:x}=r,{UiLayout:y}=r,{transformDataHeadings:f}=r;const E=u("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"}}),T=u("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"}})),M=u("div")({fontSize:"1.75rem"}),O=u("div")({fontSize:"1.5rem"}),k=u("div")({fontSize:"1.25rem"}),C=u(b)(({theme:e})=>({background:e.palette.common.white,fontSize:"inherit",fontFamily:"Roboto, sans-serif",color:e.palette.common.black,borderRadius:`${e.spacing(2)} ${e.spacing(2)} 0 0`,border:"1px solid #D9DADA",borderBottomWidth:0,minHeight:"56px",padding:"8px 10px",display:"flex",alignItems:"center",justifyContent:"center",margin:`0 ${e.spacing(1)}`,textTransform:"none",".passage-label":{display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"normal",margin:"auto 0",opacity:.7},"&.Mui-selected":{color:e.palette.common.black,".passage-label":{opacity:1},".passage-label-underline":{backgroundColor:"#146EB3"}},"&:hover":{".passage-label-underline":{backgroundColor:"#D0E2F0"}},"& .MuiTouchRipple-root":{opacity:.7}})),w=u("div")(({theme:e})=>({height:"2px",width:"100%",marginTop:"6px",background:e.palette.common.white}));class A extends h.Component{constructor(...e){super(...e),A.prototype.__init.call(this),A.prototype.__init2.call(this),A.prototype.__init3.call(this),A.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 a=-1;const r=i.findIndex(e=>e.id===t);switch(s){case"ArrowRight":a=(r+1)%i.length;break;case"ArrowLeft":a=(r-1+i.length)%i.length;break;case"Home":a=0;break;case"End":a=i.length-1;break;case"Enter":case" ":a=r}-1!==a&&(e.preventDefault(),e.stopPropagation(),this.handleChange(e,i[a].id),document.getElementById(`button-${i[a].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(g,{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,a=s?`h${i}`:"h2",r=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(x,{purpose:"passage-title"},h.createElement(a,null,h.createElement(M,{dangerouslySetInnerHTML:{__html:this.parsedText(e.title)}}))),e.subtitle&&h.createElement(x,{purpose:"passage-subtitle"},h.createElement(O,{dangerouslySetInnerHTML:{__html:this.parsedText(e.subtitle)}})),e.author&&h.createElement(x,{purpose:"passage-author"},h.createElement(k,{className:"author",dangerouslySetInnerHTML:{__html:this.parsedText(e.author)}})),e.text&&h.createElement(x,{purpose:"passage-text"},h.createElement("div",{key:e.id,className:"text",dangerouslySetInnerHTML:{__html:s?f(e.text,r):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 a=e[i],r=e[i+1];if(i+=2,("optionalAccess"===a||"optionalCall"===a)&&null==s)return;"access"===a||"optionalAccess"===a?(t=s,s=r(s)):"call"!==a&&"optionalCall"!==a||(s=r((...e)=>s.call(t,...e)),t=void 0)}return s}([t,"optionalAccess",e=>e.length]))return;const{extraCSSRules:a}=e||{},r=(t||[]).find(e=>e.id===i);return h.createElement(y,{extraCSSRules:a},h.createElement(E,{className:"passages"},s||1===t.length?t.map(e=>this.renderTab(e,s)):h.createElement(h.Fragment,null,h.createElement(m,{sx:{position:"static","@media (min-width: 841px)":{position:"sticky",top:0,zIndex:1},background:_.background(),color:_.text(),fontFamily:"Roboto, sans-serif","& .MuiTabs-list":{borderBottom:"1px solid #D9DADA"},"& .MuiTabs-indicator":{backgroundColor:"#ffffff",marginBottom:"-1px"}},value:i,onChange:this.handleChange},t.map(e=>h.createElement(C,{key:e.id,id:`button-${e.id}`,label:h.createElement(h.Fragment,null,h.createElement(x,{purpose:"passage-label"},h.createElement("span",{className:"passage-label",dangerouslySetInnerHTML:{__html:this.parsedText(e.label)}})),h.createElement(w,{className:"passage-label-underline"})),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)}))),r?this.renderTab(r,s):null)))}}A.propTypes={tabs:p.arrayOf(p.shape({id:p.number.isRequired,label:p.string.isRequired,title:p.string.isRequired,subtitle:p.string,author:p.string,text:p.string.isRequired,teacherInstructions:p.string}).isRequired).isRequired,disabledTabs:p.bool,model:p.object,baseHeadingLevel:p.number};const{renderMath:L}=e,R=t,{createRoot:S}=n;function P(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 a=parseInt(e,10);if(Number.isFinite(a)&&a>=1&&a<=6)return a}var s,i}class I extends HTMLElement{constructor(){super(),I.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(),L(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 d(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=R.createElement(A,{tabs:t,model:this._model,baseHeadingLevel:P(this)});this._root||(this._root=S(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{I as default};
|
|
1
|
+
import{_dll_pie_lib__math_rendering as e}from"../../../@pie-lib/math-rendering-module@6.0.0/module/index.js";import{_dll_prop_types as t,_dll_react as n,_dll_mui__material_styles as i,_dll_react_dom as r,_dll_mui__material_colors as s,_dll_mui__material as o,_dll_debug as a,_dll_mui__material_collapse as l,_dll_react_dom_client as c}from"../../../@pie-lib/shared-module@6.0.0/module/index.js";var d={};Object.defineProperty(d,"__esModule",{value:!0});class p extends CustomEvent{constructor(e,t,n){super(p.TYPE,{bubbles:!0,composed:!0,detail:{complete:t,component:e,hasModel:n}}),this.component=e,this.complete=t}}p.TYPE="model-set";var h=d.ModelSetEvent=p;class u extends CustomEvent{constructor(e,t){super(u.TYPE,{bubbles:!0,composed:!0,detail:{complete:t,component:e}}),this.component=e,this.complete=t}}u.TYPE="session-changed",d.SessionChangedEvent=u;const m=n,f=t,g=e=>"string"==typeof e?e:"number"==typeof e?`${e}px`:"30px",E=({size:e,children:t})=>{const n={height:e=g(e),width:e,display:"inline-block",position:"relative"};return m.createElement("div",{style:n},t)};E.propTypes={size:f.number,children:f.oneOfType([f.arrayOf(f.node),f.node]).isRequired};const b=n,y=t,v=({size:e,children:t,sx:n})=>b.createElement(E,{size:e},b.createElement("svg",{preserveAspectRatio:"xMinYMin meet",viewBox:"0 0 44 40",style:{enableBackground:"new 0 0 44 40",...n}},t));v.propTypes={size:y.oneOfType([y.string,y.number]),children:y.oneOfType([y.arrayOf(y.node),y.node]).isRequired,sx:y.object},y.string.isRequired;const x=({fill:e})=>b.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});x.propTypes={fill:y.string.isRequired};const C=({fill:e})=>b.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});C.propTypes={fill:y.string.isRequired};const _=({fill:e})=>b.createElement("circle",{transform:"translate(-3,0)",cx:"23",cy:"20.4",r:"16",fill:e});_.propTypes={fill:y.string.isRequired};const R=({fill:e})=>b.createElement("rect",{x:"3.6",y:"4.1",width:"32",height:"32",fill:e});R.propTypes={fill:y.string.isRequired};const k=t,O=n;var T=(e,t)=>{class n extends O.Component{static __initStatic(){this.propTypes={iconSet:k.oneOf(["emoji","check"]),shape:k.oneOf(["round","square"]),category:k.oneOf(["feedback",void 0]),open:k.bool,size:k.oneOfType([k.number,k.string]),fg:k.string,bg:k.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?O.createElement(e,{fill:a}):O.createElement(t,{fill:a}),d="check"===n?O.createElement(e,{fill:l}):O.createElement(t,{fill:l});return s?O.createElement(v,{size:o},d):O.createElement(v,{size:o},"feedback"===r?"round"===i?O.createElement(C,{fill:l}):O.createElement(x,{fill:l}):"round"===i?O.createElement(_,{fill:l}):O.createElement(R,{fill:l}),c)}}return n.__initStatic(),n.__initStatic2(),n};const S=t,A=n,M=({fill:e})=>A.createElement("g",{transform:"translate(1, 0)"},A.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}),A.createElement("rect",{x:"21.1",y:"13.1",width:"3.7",height:"4.7",fill:e}),A.createElement("rect",{x:"12.7",y:"13.1",width:"3.7",height:"4.7",fill:e}));M.propTypes={fill:S.string.isRequired};const N=({fill:e,x:t=0,y:n=0})=>A.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});N.propTypes={fill:S.string.isRequired,x:S.number,y:S.number};const D=T(N,M);D.propTypes={iconSet:S.oneOf(["emoji","check"]),shape:S.oneOf(["round","square"]),category:S.oneOf(["feedback",void 0]),open:S.bool,fg:S.string,bg:S.string,size:S.oneOfType([S.string,S.number])},D.defaultProps={iconSet:"check",shape:"round",category:void 0,open:!1,fg:"#4aaf46",bg:"#f8ffe2",size:30};const w=t,{styled:L}=i;w.string.isRequired,w.string.isRequired,w.string.isRequired,w.string.isRequired,w.string.isRequired,L("div")(({size:e})=>({width:e||"25px",height:e||"25px"})),w.bool,w.string;const F=t,B=n,I=({fill:e})=>B.createElement("g",{transform:"translate(0.5, 0.5)"},B.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}),B.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}));I.propTypes={fill:F.string.isRequired};const z=({fill:e})=>B.createElement("g",{transform:"translate(1,0)"},B.createElement("rect",{x:"21",y:"12.9",width:"3.7",height:"4.7",fill:e}),B.createElement("rect",{x:"12.7",y:"12.9",width:"3.7",height:"4.7",fill:e}),B.createElement("rect",{x:"12.2",y:"22.5",width:"13",height:"3.3",fill:e}));z.propTypes={fill:F.string.isRequired};const P=T(I,z);P.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])},P.defaultProps={iconSet:"check",shape:"round",category:void 0,open:!1,fg:"#fcb733",bg:"#fbf2e3",size:30};const q=t,j=n,H=()=>{const e={fill:"none",stroke:"#BCE2FF",strokeWidth:2,strokeMiterlimit:10};return j.createElement("g",null,j.createElement("line",{style:e,x1:"-98",y1:"142",x2:"-114.6",y2:"142"}),j.createElement("line",{style:e,x1:"-98",y1:"146.3",x2:"-114.6",y2:"146.3"}),j.createElement("line",{style:e,x1:"-104",y1:"150.7",x2:"-114.6",y2:"150.7"}))},W=({children:e,size:t})=>j.createElement(E,{size:t},j.createElement("svg",{version:"1.1",viewBox:"-128 129 31 31",style:{enableBackground:"new -128 129 31 31"}},e));W.propTypes={children:q.oneOfType([q.arrayOf(q.node),q.node]).isRequired,size:q.number};const $=()=>j.createElement("g",null,j.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"}),j.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 "}),j.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"}),j.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 "}),j.createElement("rect",{x:"-125.5",y:"134",style:{fill:"#7FABC6"},width:"4.1",height:"4.1"}),j.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 "})),Y=()=>j.createElement("g",null,j.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"}),j.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 "}),j.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"}),j.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 "}),j.createElement("rect",{x:"-125.5",y:"134",style:{fill:"#1A9CFF"},width:"4.1",height:"4.1"}),j.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 U extends j.Component{constructor(e){super(e)}render(){return!0===this.props.open?j.createElement(W,null,j.createElement($,null),j.createElement(H,null)):j.createElement(W,null,j.createElement(Y,null),j.createElement(H,null))}}U.propTypes={open:q.bool},U.defaultProps={open:!1};const G=t,K=n,J=({fill:e})=>K.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"});J.propTypes={fill:G.string};class V extends K.Component{static __initStatic(){this.propTypes={classes:G.object.isRequired,size:G.number}}render(){const{size:e}=this.props;return!0===this.props.open?K.createElement(E,{size:e},K.createElement("svg",{preserveAspectRatio:"xMinYMin meet",viewBox:"-135 129 16 32"},K.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"}),K.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"}),K.createElement(J,{fill:"#1A9CFF"}))):K.createElement(E,{size:e},K.createElement("svg",{preserveAspectRatio:"xMinYMin meet",viewBox:"-135 129 16 31"},K.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"}),K.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"}),K.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"}),",",K.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"}),K.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"}),K.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"}),K.createElement(J,{fill:"1A9CFF"})))}}V.__initStatic(),V.propTypes={open:G.bool},V.defaultProps={open:!1};const X=t,Z=n,Q=({fill:e})=>Z.createElement("g",null,Z.createElement("rect",{x:"19.3",y:"10.3",width:"4.5",height:"12.7",fill:e}),Z.createElement("rect",{x:"19.3",y:"26.2",width:"4.5",height:"4.5",fill:e}));Q.propTypes={fill:X.string.isRequired};const ee=({fill:e})=>Z.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});ee.propTypes={fill:X.string.isRequired};const te=({fill:e})=>Z.createElement("g",null,Z.createElement("rect",{x:"23.8",y:"15",width:"3.5",height:"4.4",fill:e}),Z.createElement("rect",{x:"16",y:"15",width:"3.5",height:"4.4",fill:e}),Z.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}));te.propTypes={fill:X.string.isRequired};class ne extends Z.Component{constructor(e){super(e);const{fg:t="#464146",bg:n="white"}=this.props;this.icons={check:Z.createElement(v,null,Z.createElement(ee,{fill:n}),Z.createElement(Q,{fill:t})),emoji:Z.createElement(v,null,Z.createElement(ee,{fill:n}),Z.createElement(te,{fill:t})),feedback:{check:Z.createElement(v,null,Z.createElement(ee,{fill:n}),Z.createElement(te,{fill:t})),emoji:Z.createElement(v,null,Z.createElement(ee,{fill:n}),Z.createElement(te,{fill:t})),square:{check:Z.createElement(v,null,Z.createElement(ee,{fill:n}),Z.createElement(Q,{fill:t})),emoji:Z.createElement(v,null,Z.createElement(ee,{fill:n}),Z.createElement(te,{fill:t})),open:{check:Z.createElement(v,null,Z.createElement(Q,{fill:n})),emoji:Z.createElement(v,null,Z.createElement(te,{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]}}ne.propTypes={iconSet:X.oneOf(["emoji","check",void 0]),shape:X.oneOf(["square",void 0]),category:X.oneOf(["feedback",void 0]),open:X.bool,fg:X.string,bg:X.string},ne.defaultProps={iconSet:"check",shape:void 0,category:void 0,open:!1,fg:"#464146",bg:"white"};const ie=t,re=n,se=({fill:e})=>re.createElement("g",{transform:"translate(0, 0)"},re.createElement("polygon",{points:"27.5,13.4 23.9,11.4 15.9,25.8 19.1,28.6",fill:e}),re.createElement("polygon",{points:"16.2,20.6 14.4,19.2 11.8,22.3 14.1,24.3",fill:e}));se.propTypes={fill:ie.string.isRequired};const oe=({fill:e})=>re.createElement("g",{transform:"translate(2, 0)"},re.createElement("rect",{x:"20.6",y:"11.8",width:"4",height:"5",fill:e}),re.createElement("rect",{x:"11.5",y:"11.8",width:"4",height:"5",fill:e}),re.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}));oe.propTypes={fill:ie.string.isRequired};const ae=T(se,oe);ae.propTypes={iconSet:ie.oneOf(["emoji","check"]),shape:ie.oneOf(["round","square"]),category:ie.oneOf(["feedback",void 0]),open:ie.bool,fg:ie.string,bg:ie.string,size:ie.oneOfType([ie.string,ie.number])},ae.defaultProps={iconSet:"check",shape:"round",category:void 0,open:!1,fg:"#4aaf46",bg:"#c1e1ac",size:30};const le=t,ce=n,de=({fill:e})=>ce.createElement("g",null,ce.createElement("rect",{x:"-115",y:"136.7",width:"3",height:"3",fill:e}),ce.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}));de.propTypes={fill:le.string.isRequired};const pe=({fill:e})=>ce.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});pe.propTypes={fill:le.string.isRequired};const he=({fill:e="#FFFFFF"})=>ce.createElement("g",null,ce.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"}),ce.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"}),ce.createElement("circle",{cx:"-113",cy:"144",r:"14",fill:e}));he.propTypes={fill:le.string};const ue=({children:e,size:t})=>{const n=g(t),i={height:n,width:n,display:"inline-block",position:"relative"};return ce.createElement("div",{style:i},ce.createElement("svg",{preserveAspectRatio:"xMinYMin meet",viewBox:"-129 128 34 34"},e))};ue.propTypes={children:le.oneOfType([le.arrayOf(le.node),le.node]).isRequired,size:le.oneOfType([le.string,le.number])};class me extends ce.Component{render(){const{iconSet:e,open:t,fg:n="#1a9cff",bg:i="#bce2ff",border:r="#bbe3fd"}=this.props,s=ce.createElement(de,{fill:n}),o={check:ce.createElement(ue,{size:this.props.size},ce.createElement(he,null),s,ce.createElement(pe,{fill:r})),emoji:ce.createElement(ue,{size:this.props.size},ce.createElement(he,null),s,ce.createElement(pe,{fill:r})),open:{check:ce.createElement(ue,{size:this.props.size},ce.createElement("circle",{cx:"-113",cy:"144",r:"14",fill:"#FFFFFF"}),ce.createElement(de,{fill:i}),ce.createElement(pe,{fill:"#FFFFFF"})),emoji:ce.createElement(ue,{size:this.props.size},ce.createElement("circle",{cx:"-113",cy:"144",r:"14",fill:"#FFFFFF"}),ce.createElement(de,{fill:i}),ce.createElement(pe,{fill:r}))}};return!0===t?o.open[e]:o[e]}}function fe(){return fe=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},fe.apply(null,arguments)}function ge(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 Ee(e,t){return Ee=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Ee(e,t)}function be(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Ee(e,t)}function ye(e,t){return e.replace(new RegExp("(^|\\s)"+t+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}me.propTypes={iconSet:le.oneOf(["emoji","check"]),open:le.bool,fg:le.string,bg:le.string,border:le.string,size:le.oneOfType([le.string,le.number])},me.defaultProps={iconSet:"check",open:!1,fg:"#1a9cff",bg:"#bce2ff",border:"#bbe3fd",size:30};var ve=!1;var xe=n.createContext(null),Ce=function(e){return e.scrollTop};const _e=n,Re=r;var ke="unmounted",Oe="exited",Te="entering",Se="entered",Ae="exiting",Me=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=Oe,i.appearStatus=Te):r=Se:r=t.unmountOnExit||t.mountOnEnter?ke:Oe,i.state={status:r},i.nextCallback=null,i}be(t,e),t.getDerivedStateFromProps=function(e,t){return e.in&&t.status===ke?{status:Oe}: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!==Te&&n!==Se&&(t=Te):n!==Te&&n!==Se||(t=Ae)}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===Te){if(this.props.unmountOnExit||this.props.mountOnEnter){var n=this.props.nodeRef?this.props.nodeRef.current:Re.findDOMNode(this);n&&Ce(n)}this.performEnter(e)}else this.performExit();else this.props.unmountOnExit&&this.state.status===Oe&&this.setState({status:ke})},n.performEnter=function(e){var t=this,n=this.props.enter,i=this.context?this.context.isMounting:e,r=this.props.nodeRef?[i]:[Re.findDOMNode(this),i],s=r[0],o=r[1],a=this.getTimeouts(),l=i?a.appear:a.enter;!e&&!n||ve?this.safeSetState({status:Se},function(){t.props.onEntered(s)}):(this.props.onEnter(s,o),this.safeSetState({status:Te},function(){t.props.onEntering(s,o),t.onTransitionEnd(l,function(){t.safeSetState({status:Se},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:Re.findDOMNode(this);t&&!ve?(this.props.onExit(i),this.safeSetState({status:Ae},function(){e.props.onExiting(i),e.onTransitionEnd(n.exit,function(){e.safeSetState({status:Oe},function(){e.props.onExited(i)})})})):this.safeSetState({status:Oe},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:Re.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===ke)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=ge(t,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]);return _e.createElement(xe.Provider,{value:null},"function"==typeof n?n(e,i):_e.cloneElement(_e.Children.only(n),i))},t}(_e.Component);function Ne(){}Me.contextType=xe,Me.propTypes={},Me.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:Ne,onEntering:Ne,onEntered:Ne,onExit:Ne,onExiting:Ne,onExited:Ne},Me.UNMOUNTED=ke,Me.EXITED=Oe,Me.ENTERING=Te,Me.ENTERED=Se,Me.EXITING=Ae;var De=Me;const we=n;var Le=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})},Fe=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=ye(n.className,i):n.setAttribute("class",ye(n.className&&n.className.baseVal||"",i)));var n,i})},Be=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}be(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&&Ce(e),i&&(this.appliedClasses[t][n]=i,Le(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&&Fe(e,i),r&&Fe(e,r),s&&Fe(e,s)},n.render=function(){var e=this.props;e.classNames;var t=ge(e,["classNames"]);return we.createElement(De,fe({},t,{onEnter:this.onEnter,onEntered:this.onEntered,onEntering:this.onEntering,onExit:this.onExit,onExiting:this.onExiting,onExited:this.onExited}))},t}(we.Component);Be.defaultProps={classNames:""},Be.propTypes={};var Ie=Be;const{Children:ze}=n,{cloneElement:Pe}=n,{isValidElement:qe}=n;function je(e,t){var n=Object.create(null);return e&&ze.map(e,function(e){return e}).forEach(function(e){n[e.key]=function(e){return t&&qe(e)?t(e):e}(e)}),n}function He(e,t,n){return null!=n[t]?n[t]:e.props[t]}function We(e,t,n){var i=je(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(qe(o)){var a=s in t,l=s in i,c=t[s],d=qe(c)&&!c.props.in;!l||a&&!d?l||!a||d?l&&a&&qe(c)&&(r[s]=Pe(o,{onExited:n.bind(null,o),in:c.props.in,exit:He(o,"exit",e),enter:He(o,"enter",e)})):r[s]=Pe(o,{in:!1}):r[s]=Pe(o,{onExited:n.bind(null,o),in:!0,exit:He(o,"exit",e),enter:He(o,"enter",e)})}}),r}const $e=n;var Ye=Object.values||function(e){return Object.keys(e).map(function(t){return e[t]})},Ue=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}be(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,je(n.children,function(e){return Pe(e,{onExited:i.bind(null,e),in:!0,appear:He(e,"appear",n),enter:He(e,"enter",n),exit:He(e,"exit",n)})})):We(e,r,s),firstRender:!1}},n.handleExited=function(e,t){var n=je(this.props.children);e.key in n||(e.props.onExited&&e.props.onExited(t),this.mounted&&this.setState(function(t){var n=fe({},t.children);return delete n[e.key],{children:n}}))},n.render=function(){var e=this.props,t=e.component,n=e.childFactory,i=ge(e,["component","childFactory"]),r=this.state.contextValue,s=Ye(this.state.children).map(n);return delete i.appear,delete i.enter,delete i.exit,null===t?$e.createElement(xe.Provider,{value:r},s):$e.createElement(xe.Provider,{value:r},$e.createElement(t,i,s))},t}($e.Component);Ue.propTypes={},Ue.defaultProps={component:"div",childFactory:function(e){return e}};var Ge=Ue;const{green:Ke}=s,{indigo:Je}=s,{orange:Ve}=s,{pink:Xe}=s,{red:Ze}=s,Qe={TEXT:"black",DISABLED:"grey",DISABLED_SECONDARY:"#ABABAB",CORRECT:Ke[500],CORRECT_SECONDARY:Ke[50],CORRECT_TERTIARY:"#0EA449",CORRECT_WITH_ICON:"#087D38",INCORRECT:Ve[500],INCORRECT_SECONDARY:Ze[50],INCORRECT_WITH_ICON:"#BF0D00",MISSING:Ze[700],MISSING_WITH_ICON:"#6A78A1",PRIMARY:Je[500],PRIMARY_LIGHT:Je[200],PRIMARY_DARK:Je[800],SECONDARY:Xe.A400,SECONDARY_LIGHT:Xe[200],SECONDARY_DARK:Xe[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",TABLE_GRID:"black",TABLE_GRID_LIGHT:"#dfe2e5",TABLE_STRIPE:"#f6f8fa",BLACK:"#000000",WHITE:"#ffffff",TRANSPARENT:"transparent",FOCUS_CHECKED:"#BBDEFB",FOCUS_CHECKED_BORDER:"#1565C0",FOCUS_UNCHECKED:"#E0E0E0",FOCUS_UNCHECKED_BORDER:"#757575",BUTTON_FOCUS_OUTLINE:"#3B82F6",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)",KEY_BOARD_FOCUS_INDICATOR:"#2B87FF",BUTTON_BORDER:"rgba(0, 0, 0, 0.23)",BUTTON_HOVER_BG:"rgba(0, 0, 0, 0.08)"};Object.freeze(Qe);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",Qe.TEXT),it=()=>et("background",Qe.BACKGROUND),rt=()=>et("border-gray",Qe.BORDER_GRAY),st=()=>et("table-stripe","background-dark",Qe.TABLE_STRIPE),ot=n,at=t,{styled:lt}=i,ct=lt("div")({transformOrigin:"0% 0px 0px",width:"100%",display:"block",overflow:"hidden","&.incorrect":{color:"#946202"}}),dt=lt("div")({WebkitFontSmoothing:"antialiased",backgroundColor:`var(--feedback-bg-color, ${et("disabled",Qe.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",Qe.CORRECT)})`},"&.incorrect":{backgroundColor:`var(--feedback-incorrect-bg-color, ${et("incorrect",Qe.INCORRECT)})`}}),pt=lt("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 ht extends ot.Component{constructor(...e){super(...e),ht.prototype.__init.call(this)}static __initStatic(){this.propTypes={correctness:at.string,feedback:at.string}}__init(){this.nodeRef=ot.createRef()}renderFeedback(){const{correctness:e,feedback:t}=this.props;return e&&t?ot.createElement(Ie,{key:"hasFeedback",nodeRef:this.nodeRef,timeout:{enter:500,exit:200},classNames:"feedback"},ot.createElement(pt,{ref:this.nodeRef},ot.createElement(ct,null,ot.createElement(dt,{className:e,dangerouslySetInnerHTML:{__html:t}})))):null}render(){return ot.createElement("div",null,ot.createElement(Ge,null,this.renderFeedback()))}}ht.__initStatic();const ut=n,mt=t,{Popover:ft}=o,{styled:gt}=i,Et=a("pie-libs:render-ui:response-indicators"),bt=gt("div")(({hasFeedback:e})=>({cursor:e?"pointer":"default"})),yt=gt(ft)({cursor:"pointer"}),vt=gt("div")({padding:"0",borderRadius:"4px"}),xt=(e,t)=>{class n extends ut.Component{constructor(e){super(e),n.prototype.__init.call(this),n.prototype.__init2.call(this),this.state={}}__init(){this.handlePopoverOpen=e=>{Et("[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 ut.createElement(bt,{hasFeedback:!!n},ut.createElement("span",{ref:e=>this.icon=e,onClick:this.handlePopoverOpen},ut.createElement(e,null)),n&&ut.createElement(yt,{PaperComponent:vt,open:!!i,anchorEl:i,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},onClose:this.handlePopoverClose},ut.createElement(ht,{feedback:n,correctness:t})))}}return n.propTypes={feedback:mt.string},n};xt(D,"correct"),xt(P,"incorrect"),xt(ae,"partially-correct"),xt(ne,"nothing-submitted");const Ct=n,{styled:_t}=i,Rt=l,kt=t,{renderMath:Ot}=e,Tt=_t("span")(({theme:e})=>({color:e.palette.primary.light,borderBottom:`1px dotted ${e.palette.primary.light}`,cursor:"pointer"})),St=_t(Rt)(({theme:e})=>({paddingTop:e.spacing(2)}));class At extends Ct.Component{constructor(...e){super(...e),At.prototype.__init.call(this),At.prototype.__init2.call(this)}static __initStatic(){this.propTypes={className:kt.string,children:kt.object,labels:kt.shape({visible:kt.string,hidden:kt.string})}}static __initStatic2(){this.defaultProps={labels:{}}}__init(){this.state={expanded:!1}}__init2(){this.toggleExpanded=()=>{this.setState(e=>({expanded:!e.expanded}))}}componentDidMount(){Ot(this.root)}componentDidUpdate(){Ot(this.root)}render(){const{labels:e,children:t,className:n}=this.props,i=this.state.expanded?e.visible||"Hide":e.hidden||"Show";return Ct.createElement("div",{className:n,ref:e=>this.root=e},Ct.createElement("div",{onClick:this.toggleExpanded},Ct.createElement(Tt,null,i)),Ct.createElement(St,{in:this.state.expanded,timeout:{enter:225,exit:195},unmountOnExit:!0},t))}}At.__initStatic(),At.__initStatic2();const{Button:Mt}=o,{styled:Nt}=i;Nt("div")({display:"flex",flexDirection:"column"}),Nt("div")({display:"flex",alignItems:"center",justifyContent:"center"}),Nt("div")(({theme:e})=>({width:"24px",height:"24px",color:"gray",marginRight:e.spacing(1),display:"flex",alignItems:"center"})),Nt(Mt)(({theme:e})=>({display:"flex",alignItems:"center",marginLeft:e.spacing(3),marginRight:e.spacing(3)}));const Dt=n,{createTheme:wt}=i,{styled:Lt}=i,{StyledEngineProvider:Ft}=i,{ThemeProvider:Bt}=i,It=t;const zt=wt({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"}}}}}}),Pt=Lt("div")({"& table, th, td":{fontSize:"inherit"}});class qt extends Dt.Component{static __initStatic(){this.propTypes={className:It.string,children:It.array,extraCSSRules:It.shape({names:It.arrayOf(It.string),rules:It.string}),fontSizeFactor:It.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 Dt.createElement(Ft,{injectFirst:!0},Dt.createElement(Bt,{theme:zt},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])?Dt.createElement("style",{dangerouslySetInnerHTML:{__html:`.extraCSSRules { ${r.rules} }`}}):null,Dt.createElement(Pt,{className:`${t} extraCSSRules`,...s,...o&&{style:o}},e)))}}qt.__initStatic(),qt.__initStatic2();const jt=n,{styled:Ht}=i,Wt=t,$t=Ht(qt)({display:"flex",flexDirection:"column",position:"relative"});class Yt extends jt.Component{static __initStatic(){this.propTypes={ariaLabel:Wt.string,children:Wt.oneOfType([Wt.arrayOf(Wt.node),Wt.node]).isRequired,role:Wt.string,extraCSSRules:Wt.shape({names:Wt.arrayOf(Wt.string),rules:Wt.string}),fontSizeFactor:Wt.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 jt.createElement($t,{...o,extraCSSRules:i,fontSizeFactor:r,classes:s},e)}}Yt.__initStatic();const Ut=n,Gt=t;class Kt extends Ut.Component{static __initStatic(){this.propTypes={tag:Gt.string,className:Gt.string,html:Gt.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:Jt}=o,{FormControl:Vt}=o,Xt=t,{styled:Zt}=i;Zt(Vt)(({theme:e})=>({margin:0,padding:0,flex:"1 0 auto",minWidth:e.spacing(4)})),Zt(Jt)(()=>({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)"}})),Xt.oneOfType([Xt.string,Xt.object]).isRequired,Xt.string,Xt.oneOfType([Xt.arrayOf(Xt.node),Xt.node]).isRequired;const Qt=n,{Component:en}=n,{styled:tn}=i,nn=t,{renderMath:rn}=e,sn=tn("div")(({theme:e,tagName:t})=>({'&:not(.MathJax) > table:not([role="presentation"])':{borderCollapse:"collapse"},'&:not(.MathJax) table[border]:not([role="presentation"]), &:not(.MathJax) table[border]:not([role="presentation"]) td, &:not(.MathJax) table[border]:not([role="presentation"]) th':{borderStyle:"solid",borderColor:et("table-grid","text",Qe.TABLE_GRID)},'&:not(.MathJax) > table:not([role="presentation"]):has(tbody tr > th:first-child):not(:has(tbody tr > td:first-child)) tbody td:nth-child(even)':{backgroundColor:st()},'&:not(.MathJax) > table:not([role="presentation"]):has(tbody tr > td:first-child) tbody tr:nth-child(even) td':{backgroundColor:st()},'&:not(.MathJax) table:not([role="presentation"]) td, &:not(.MathJax) table:not([role="presentation"]) 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"}}})),on=/\\embed\{newLine\}\[\]/g;class an extends en{constructor(...e){super(...e),an.prototype.__init.call(this),an.prototype.__init2.call(this)}static __initStatic(){this.propTypes={prompt:nn.string,tagName:nn.string,className:nn.string,onClick:nn.func,defaultClassName:nn.string,autoplayAudioEnabled:nn.bool,customAudioButton:{playImage:nn.string,pauseImage:nn.string}}}static __initStatic2(){this.defaultProps={onClick:()=>{}}}__init(){this.promptRef=Qt.createRef()}__init2(){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=this.promptRef.current;e&&"function"==typeof rn&&rn(e)}alignImages(){const e=this.promptRef.current;if(!e)return;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":""} preview-prompt`.trim();return Qt.createElement(sn,{as:t||"div",ref:this.promptRef,onClick:i,className:s,tagName:t,dangerouslySetInnerHTML:{__html:this.parsedText(e||"").replace(on,"\\newline ")}})}}an.__initStatic(),an.__initStatic2();const ln=t;ln.node,ln.bool;const cn=t,dn=n,pn=e=>dn.createElement(dn.Fragment,null,dn.Children.map(e.children,t=>dn.cloneElement(t,{"data-pie-purpose":e.purpose})));function hn(e="",t=2){if(!e)return e;const n=(new DOMParser).parseFromString(e,"text/html");return n.body.querySelectorAll("[data-heading]").forEach(e=>{const i=e.getAttribute("data-heading")||"",r=parseInt(i.replace("heading",""),10);if(!Number.isFinite(r))return;const s=Math.min(6,Math.max(1,t+r-1)),o=n.createElement(`h${s}`);o.setAttribute("data-heading",i),Array.from(e.attributes).forEach(e=>{"data-heading"!==e.name&&o.setAttribute(e.name,e.value)}),o.innerHTML=e.innerHTML,e.replaceWith(o)}),n.body.innerHTML}pn.propTypes={children:cn.node,purpose:cn.string},"undefined"!=typeof window&&new DOMParser,"undefined"!=typeof window&&new DOMParser;const un=n,mn=t,{Tabs:fn}=o,{Tab:gn}=o,{styled:En}=i;const bn=()=>{if("undefined"==typeof window)return 1;const e=window.outerWidth/window.innerWidth,t=Number.isFinite(e)&&e>0?e:1;return Math.max(.4,Math.min(1,2/t))},yn=En("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"}}),vn=En("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"}})),xn=En("div")({fontSize:"1.75rem"}),Cn=En("div")({fontSize:"1.5rem"}),_n=En("div")({fontSize:"1.25rem"}),Rn=En(gn)(({theme:e})=>({background:it(),fontSize:"inherit",fontFamily:"Roboto, sans-serif",color:nt(),borderRadius:`${e.spacing(2)} ${e.spacing(2)} 0 0`,border:`1px solid ${rt()}`,borderBottomWidth:0,minHeight:"56px",padding:"8px 10px",display:"flex",alignItems:"center",justifyContent:"center",margin:`0 ${e.spacing(1)}`,textTransform:"none",".passage-label":{display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"normal",margin:"auto 0",opacity:.7},"&.Mui-selected":{color:nt(),".passage-label":{opacity:1},".passage-label-underline":{backgroundColor:et("tertiary",Qe.TERTIARY)}},"&:hover":{".passage-label-underline":{backgroundColor:et("tertiary-light",Qe.TERTIARY_LIGHT)}},"& .MuiTouchRipple-root":{opacity:.7}})),kn=En("div")(()=>({height:"2px",width:"100%",marginTop:"6px",background:it()}));class On extends un.Component{constructor(...e){super(...e),On.prototype.__init.call(this),On.prototype.__init2.call(this),On.prototype.__init3.call(this),On.prototype.__init4.call(this),On.prototype.__init5.call(this),On.prototype.__init6.call(this),On.prototype.__init7.call(this)}__init(){this.state={activeTab:0,zoomCompensation:bn(),containerWidth:0}}__init2(){this.containerRef=un.createRef()}componentDidMount(){"undefined"!=typeof window&&(window.addEventListener("resize",this.updateZoomCompensation),this.containerRef.current&&"undefined"!=typeof ResizeObserver&&(this.resizeObserver=new ResizeObserver(this.updateContainerWidth),this.resizeObserver.observe(this.containerRef.current)),this.updateContainerWidth())}componentWillUnmount(){"undefined"!=typeof window&&(window.removeEventListener("resize",this.updateZoomCompensation),this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null))}__init3(){this.updateZoomCompensation=()=>{this.setState({zoomCompensation:bn()})}}__init4(){this.updateContainerWidth=()=>{const e=this.containerRef.current;if(!e)return;const t=e.clientWidth;t!==this.state.containerWidth&&this.setState({containerWidth:t})}}__init5(){this.handleChange=(e,t)=>{this.setState(()=>({activeTab:t})),setTimeout(()=>{const e=new CustomEvent("pie-ui-passage-tabChanged",{detail:{tab:t}});window.dispatchEvent(e)})}}__init6(){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())}}__init7(){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=un.createElement(an,{tagName:"div",className:"prompt",defaultClassName:"teacher-instructions",prompt:e});return t?n:un.createElement(At,{labels:{hidden:"Show Teacher Instructions",visible:"Hide Teacher Instructions"}},n)}renderTab(e,t){const{baseHeadingLevel:n}=this.props,i=n?Math.min(6,Math.max(1,n)):void 0,r=n?`h${i}`:"h2",s=n?Math.min(6,Math.max(1,i+1)):void 0;return un.createElement(vn,{key:e.id,id:`tabpanel-${e.id}`,role:"tabpanel","aria-labelledby":`button-${e.id}`},this.renderInstructions(e.teacherInstructions,t),e.title&&un.createElement(pn,{purpose:"passage-title"},un.createElement(r,null,un.createElement(xn,{dangerouslySetInnerHTML:{__html:this.parsedText(e.title)}}))),e.subtitle&&un.createElement(pn,{purpose:"passage-subtitle"},un.createElement(Cn,{dangerouslySetInnerHTML:{__html:this.parsedText(e.subtitle)}})),e.author&&un.createElement(pn,{purpose:"passage-author"},un.createElement(_n,{className:"author",dangerouslySetInnerHTML:{__html:this.parsedText(e.author)}})),e.text&&un.createElement(pn,{purpose:"passage-text"},un.createElement("div",{key:e.id,className:"text",dangerouslySetInnerHTML:{__html:n?hn(e.text,s):e.text}})))}render(){const{model:e,tabs:t,disabledTabs:n}=this.props,{activeTab:i,zoomCompensation:r,containerWidth:s}=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:o}=e||{},a=(t||[]).find(e=>e.id===i),l=s>0?s/t.length:null,c=s>0&&s<=170*t.length;return un.createElement(qt,{extraCSSRules:o},un.createElement(yn,{className:"passages",ref:this.containerRef},n||1===t.length?t.map(e=>this.renderTab(e,n)):un.createElement(un.Fragment,null,un.createElement(fn,{sx:{position:"static","@media (min-width: 841px)":{position:"sticky",top:0,zIndex:1},background:"var(--pie-passage-header-background, rgba(255,255,255,0))",color:nt(),fontFamily:"Roboto, sans-serif",zoom:r,"& .MuiTabs-list":{backgroundColor:`var(--pie-passage-header-background, ${et("background-dark",Qe.BACKGROUND_DARK)})`,borderBottom:`1px solid ${rt()}`},"& .MuiTabs-indicator":{backgroundColor:et("white",Qe.WHITE),marginBottom:"-1px"}},value:i,onChange:this.handleChange},t.map((e,t)=>un.createElement(Rn,{key:e.id,id:`button-${e.id}`,sx:l?{maxWidth:`${l}px`}:void 0,label:un.createElement(un.Fragment,null,un.createElement(pn,{purpose:"passage-label"},c?un.createElement("span",{className:"passage-label"},`Passage ${t+1}`):un.createElement("span",{className:"passage-label",dangerouslySetInnerHTML:{__html:this.parsedText(e.label)}})),un.createElement(kn,{className:"passage-label-underline"})),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)}))),a?this.renderTab(a,n):null)))}}On.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,baseHeadingLevel:mn.number};const{renderMath:Tn}=e,Sn=n,{createRoot:An}=c;function Mn(e){const t=e.closest("pie-player")||e.closest("pie-item-player");if(t){let e=t.baseHeadingLevel;null==e&&(n=t.getAttribute("base-heading-level"),i=()=>t.getAttribute("baseheadinglevel"),e=null!=n?n:i());const r=parseInt(e,10);if(Number.isFinite(r)&&r>=1&&r<=6)return r}var n,i}class Nn extends HTMLElement{constructor(){super(),Nn.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(),Tn(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 h(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})),n=Sn.createElement(On,{tabs:t,model:this._model,baseHeadingLevel:Mn(this)});this._root||(this._root=An(this)),this._root.render(n),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(),this._root=null)}}export{Nn as default};
|
package/module/manifest.json
CHANGED
package/module/print.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_dll_react as e,_dll_prop_types as t,_dll_mui__material as n,_dll_mui__material_styles as a,_dll_pie_lib__render_ui as i,_dll_debug as r,_dll_react_dom_client as o}from"../../../@pie-lib/shared-module@^5.2.4/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 g=u?u.toStringTag:void 0;function f(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":g&&g in Object(e)?function(e){var t=p.call(e,h),n=e[h];try{e[h]=void 0;var a=!0}catch(e){}var i=b.call(e);return a&&(t?e[h]=n:delete e[h]),i}(e):function(e){return m.call(e)}(e)}var v=/\s/;var x=/^\s+/;function y(e){return e?e.slice(0,function(e){for(var t=e.length;t--&&v.test(e.charAt(t)););return t}(e)+1).replace(x,""):e}function _(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,w=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]"==f(e)}(e))return NaN;if(_(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=_(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=y(e);var n=T.test(e);return n||k.test(e)?w(e.slice(2),n?2:8):E.test(e)?NaN:+e}var S=function(){return c.Date.now()},I=Math.max,M=Math.min;function j(e,t,n){var a,i,r,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=a,r=i;return a=i=void 0,c=t,o=e.apply(r,n)}function h(e){var n=e-l;return void 0===l||n>=t||n<0||d&&e-c>=r}function m(){var e=S();if(h(e))return g(e);s=setTimeout(m,function(e){var n=t-(e-l);return d?M(n,r-(e-c)):n}(e))}function g(e){return s=void 0,p&&a?b(e):(a=i=void 0,o)}function f(){var e=S(),n=h(e);if(a=arguments,i=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,_(n)&&(u=!!n.leading,r=(d="maxWait"in n)?I(C(n.maxWait)||0,t):r,p="trailing"in n?!!n.trailing:p),f.cancel=function(){void 0!==s&&clearTimeout(s),c=0,a=l=i=s=void 0},f.flush=function(){return void 0===s?o:g(S())},f}const A=e,H=t,{Tabs:L}=n,{Tab:R}=n,{styled:D}=a,{Collapsible:N}=i,{color:O}=i,{PreviewPrompt:$}=i,{Purpose:q}=i,{UiLayout:B}=i,{transformDataHeadings:F}=i;const P=D("div")({flexGrow:1,backgroundColor:O.background(),color:O.text(),"&:not(.MathJax) table":{borderCollapse:"collapse"},"&:not(.MathJax) table td, &:not(.MathJax) table th":{padding:".6em 1em",textAlign:"left"}}),z=D("div")(({theme:e})=>({backgroundColor:O.background(),color:O.text(),padding:e.spacing(2),"& blockquote":{background:"#f9f9f9",borderLeft:"5px solid #ccc",margin:"1.5em 10px",padding:".5em 10px"}})),W=D("div")({fontSize:"1.75rem"}),J=D("div")({fontSize:"1.5rem"}),K=D("div")({fontSize:"1.25rem"}),U=D(R)(({theme:e})=>({background:e.palette.common.white,fontSize:"inherit",fontFamily:"Roboto, sans-serif",color:e.palette.common.black,borderRadius:`${e.spacing(2)} ${e.spacing(2)} 0 0`,border:"1px solid #D9DADA",borderBottomWidth:0,minHeight:"56px",padding:"8px 10px",display:"flex",alignItems:"center",justifyContent:"center",margin:`0 ${e.spacing(1)}`,textTransform:"none",".passage-label":{display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"normal",margin:"auto 0",opacity:.7},"&.Mui-selected":{color:e.palette.common.black,".passage-label":{opacity:1},".passage-label-underline":{backgroundColor:"#146EB3"}},"&:hover":{".passage-label-underline":{backgroundColor:"#D0E2F0"}},"& .MuiTouchRipple-root":{opacity:.7}})),G=D("div")(({theme:e})=>({height:"2px",width:"100%",marginTop:"6px",background:e.palette.common.white}));class Q extends A.Component{constructor(...e){super(...e),Q.prototype.__init.call(this),Q.prototype.__init2.call(this),Q.prototype.__init3.call(this),Q.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:a}=this.props;let i=-1;const r=a.findIndex(e=>e.id===t);switch(n){case"ArrowRight":i=(r+1)%a.length;break;case"ArrowLeft":i=(r-1+a.length)%a.length;break;case"Home":i=0;break;case"End":i=a.length-1;break;case"Enter":case" ":i=r}-1!==i&&(e.preventDefault(),e.stopPropagation(),this.handleChange(e,a[i].id),document.getElementById(`button-${a[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=A.createElement($,{tagName:"div",className:"prompt",defaultClassName:"teacher-instructions",prompt:e});return t?n:A.createElement(N,{labels:{hidden:"Show Teacher Instructions",visible:"Hide Teacher Instructions"}},n)}renderTab(e,t){const{baseHeadingLevel:n}=this.props,a=n?Math.min(6,Math.max(1,n)):void 0,i=n?`h${a}`:"h2",r=n?Math.min(6,Math.max(1,a+1)):void 0;return A.createElement(z,{key:e.id,id:`tabpanel-${e.id}`,role:"tabpanel","aria-labelledby":`button-${e.id}`},this.renderInstructions(e.teacherInstructions,t),e.title&&A.createElement(q,{purpose:"passage-title"},A.createElement(i,null,A.createElement(W,{dangerouslySetInnerHTML:{__html:this.parsedText(e.title)}}))),e.subtitle&&A.createElement(q,{purpose:"passage-subtitle"},A.createElement(J,{dangerouslySetInnerHTML:{__html:this.parsedText(e.subtitle)}})),e.author&&A.createElement(q,{purpose:"passage-author"},A.createElement(K,{className:"author",dangerouslySetInnerHTML:{__html:this.parsedText(e.author)}})),e.text&&A.createElement(q,{purpose:"passage-text"},A.createElement("div",{key:e.id,className:"text",dangerouslySetInnerHTML:{__html:n?F(e.text,r):e.text}})))}render(){const{model:e,tabs:t,disabledTabs:n}=this.props,{activeTab:a}=this.state;if(!function(e){let t,n=e[0],a=1;for(;a<e.length;){const i=e[a],r=e[a+1];if(a+=2,("optionalAccess"===i||"optionalCall"===i)&&null==n)return;"access"===i||"optionalAccess"===i?(t=n,n=r(n)):"call"!==i&&"optionalCall"!==i||(n=r((...e)=>n.call(t,...e)),t=void 0)}return n}([t,"optionalAccess",e=>e.length]))return;const{extraCSSRules:i}=e||{},r=(t||[]).find(e=>e.id===a);return A.createElement(B,{extraCSSRules:i},A.createElement(P,{className:"passages"},n||1===t.length?t.map(e=>this.renderTab(e,n)):A.createElement(A.Fragment,null,A.createElement(L,{sx:{position:"static","@media (min-width: 841px)":{position:"sticky",top:0,zIndex:1},background:O.background(),color:O.text(),fontFamily:"Roboto, sans-serif","& .MuiTabs-list":{borderBottom:"1px solid #D9DADA"},"& .MuiTabs-indicator":{backgroundColor:"#ffffff",marginBottom:"-1px"}},value:a,onChange:this.handleChange},t.map(e=>A.createElement(U,{key:e.id,id:`button-${e.id}`,label:A.createElement(A.Fragment,null,A.createElement(q,{purpose:"passage-label"},A.createElement("span",{className:"passage-label",dangerouslySetInnerHTML:{__html:this.parsedText(e.label)}})),A.createElement(G,{className:"passage-label-underline"})),value:e.id,tabIndex:a===e.id?0:-1,"aria-controls":`tabpanel-${e.id}`,"aria-selected":a===e.id,onKeyDown:t=>this.handleKeyDown(t,e.id)}))),r?this.renderTab(r,n):null)))}}Q.propTypes={tabs:H.arrayOf(H.shape({id:H.number.isRequired,label:H.string.isRequired,title:H.string.isRequired,subtitle:H.string,author:H.string,text:H.string.isRequired,teacherInstructions:H.string}).isRequired).isRequired,disabledTabs:H.bool,model:H.object,baseHeadingLevel:H.number};const V=e,{createRoot:X}=o,Y=r("pie-element:passage:print"),Z=(e,t)=>(e=>null!=e)(e)?e:t;class ee 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,a=Z(e.teacherInstructionsEnabled,!0),i=Z(e.titleEnabled,!0),r=Z(e.authorEnabled,!1),o=Z(e.subtitleEnabled,!0),s=Z(e.textEnabled,!0);return e.passages.map((e,t)=>({id:t,teacherInstructions:Z(e.teacherInstructionsEnabled,a)&&n&&e.teacherInstructions||"",label:e.title||`Passage ${t+1}`,title:Z(e.titleEnabled,i)&&e.title||"",author:Z(e.authorEnabled,r)&&e.author||"",subtitle:Z(e.subtitleEnabled,o)&&e.subtitle||"",text:Z(e.textEnabled,s)&&e.text||""}))})(this._model,this._options),t=V.createElement(Q,{disabledTabs:!0,tabs:e});this._root||(this._root=X(this)),this._root.render(t)}}else Y("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{ee as default};
|
|
1
|
+
import{_dll_prop_types as e,_dll_react as t,_dll_mui__material_styles as n,_dll_react_dom as i,_dll_mui__material_colors as r,_dll_mui__material as o,_dll_debug as s,_dll_mui__material_collapse as a,_dll_react_dom_client as l}from"../../../@pie-lib/shared-module@6.0.0/module/index.js";import{_dll_pie_lib__math_rendering as c}from"../../../@pie-lib/math-rendering-module@6.0.0/module/index.js";var d="object"==typeof global&&global&&global.Object===Object&&global,p="object"==typeof self&&self&&self.Object===Object&&self,u=d||p||Function("return this")(),h=u.Symbol,m=Object.prototype,f=m.hasOwnProperty,g=m.toString,E=h?h.toStringTag:void 0;var b=Object.prototype.toString;var y=h?h.toStringTag:void 0;function v(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":y&&y in Object(e)?function(e){var t=f.call(e,E),n=e[E];try{e[E]=void 0;var i=!0}catch(e){}var r=g.call(e);return i&&(t?e[E]=n:delete e[E]),r}(e):function(e){return b.call(e)}(e)}var x=/\s/;var C=/^\s+/;function _(e){return e?e.slice(0,function(e){for(var t=e.length;t--&&x.test(e.charAt(t)););return t}(e)+1).replace(C,""):e}function R(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}var k=/^[-+]0x[0-9a-f]+$/i,T=/^0b[01]+$/i,S=/^0o[0-7]+$/i,O=parseInt;function A(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]"==v(e)}(e))return NaN;if(R(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=R(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=_(e);var n=T.test(e);return n||S.test(e)?O(e.slice(2),n?2:8):k.test(e)?NaN:+e}var N=function(){return u.Date.now()},M=Math.max,D=Math.min;function w(e,t,n){var i,r,o,s,a,l,c=0,d=!1,p=!1,u=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function h(t){var n=i,o=r;return i=r=void 0,c=t,s=e.apply(o,n)}function m(e){var n=e-l;return void 0===l||n>=t||n<0||p&&e-c>=o}function f(){var e=N();if(m(e))return g(e);a=setTimeout(f,function(e){var n=t-(e-l);return p?D(n,o-(e-c)):n}(e))}function g(e){return a=void 0,u&&i?h(e):(i=r=void 0,s)}function E(){var e=N(),n=m(e);if(i=arguments,r=this,l=e,n){if(void 0===a)return function(e){return c=e,a=setTimeout(f,t),d?h(e):s}(l);if(p)return clearTimeout(a),a=setTimeout(f,t),h(l)}return void 0===a&&(a=setTimeout(f,t)),s}return t=A(t)||0,R(n)&&(d=!!n.leading,o=(p="maxWait"in n)?M(A(n.maxWait)||0,t):o,u="trailing"in n?!!n.trailing:u),E.cancel=function(){void 0!==a&&clearTimeout(a),c=0,i=l=r=a=void 0},E.flush=function(){return void 0===a?s:g(N())},E}const I=t,B=e,F=e=>"string"==typeof e?e:"number"==typeof e?`${e}px`:"30px",L=({size:e,children:t})=>{const n={height:e=F(e),width:e,display:"inline-block",position:"relative"};return I.createElement("div",{style:n},t)};L.propTypes={size:B.number,children:B.oneOfType([B.arrayOf(B.node),B.node]).isRequired};const z=t,P=e,j=({size:e,children:t,sx:n})=>z.createElement(L,{size:e},z.createElement("svg",{preserveAspectRatio:"xMinYMin meet",viewBox:"0 0 44 40",style:{enableBackground:"new 0 0 44 40",...n}},t));j.propTypes={size:P.oneOfType([P.string,P.number]),children:P.oneOfType([P.arrayOf(P.node),P.node]).isRequired,sx:P.object},P.string.isRequired;const q=({fill:e})=>z.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});q.propTypes={fill:P.string.isRequired};const H=({fill:e})=>z.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});H.propTypes={fill:P.string.isRequired};const $=({fill:e})=>z.createElement("circle",{transform:"translate(-3,0)",cx:"23",cy:"20.4",r:"16",fill:e});$.propTypes={fill:P.string.isRequired};const W=({fill:e})=>z.createElement("rect",{x:"3.6",y:"4.1",width:"32",height:"32",fill:e});W.propTypes={fill:P.string.isRequired};const U=e,Y=t;var G=(e,t)=>{class n extends Y.Component{static __initStatic(){this.propTypes={iconSet:U.oneOf(["emoji","check"]),shape:U.oneOf(["round","square"]),category:U.oneOf(["feedback",void 0]),open:U.bool,size:U.oneOfType([U.number,U.string]),fg:U.string,bg:U.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:o,size:s,fg:a,bg:l}=this.props,c="check"===n?Y.createElement(e,{fill:a}):Y.createElement(t,{fill:a}),d="check"===n?Y.createElement(e,{fill:l}):Y.createElement(t,{fill:l});return o?Y.createElement(j,{size:s},d):Y.createElement(j,{size:s},"feedback"===r?"round"===i?Y.createElement(H,{fill:l}):Y.createElement(q,{fill:l}):"round"===i?Y.createElement($,{fill:l}):Y.createElement(W,{fill:l}),c)}}return n.__initStatic(),n.__initStatic2(),n};const K=e,J=t,V=({fill:e})=>J.createElement("g",{transform:"translate(1, 0)"},J.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}),J.createElement("rect",{x:"21.1",y:"13.1",width:"3.7",height:"4.7",fill:e}),J.createElement("rect",{x:"12.7",y:"13.1",width:"3.7",height:"4.7",fill:e}));V.propTypes={fill:K.string.isRequired};const X=({fill:e,x:t=0,y:n=0})=>J.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});X.propTypes={fill:K.string.isRequired,x:K.number,y:K.number};const Z=G(X,V);Z.propTypes={iconSet:K.oneOf(["emoji","check"]),shape:K.oneOf(["round","square"]),category:K.oneOf(["feedback",void 0]),open:K.bool,fg:K.string,bg:K.string,size:K.oneOfType([K.string,K.number])},Z.defaultProps={iconSet:"check",shape:"round",category:void 0,open:!1,fg:"#4aaf46",bg:"#f8ffe2",size:30};const Q=e,{styled:ee}=n;Q.string.isRequired,Q.string.isRequired,Q.string.isRequired,Q.string.isRequired,Q.string.isRequired,ee("div")(({size:e})=>({width:e||"25px",height:e||"25px"})),Q.bool,Q.string;const te=e,ne=t,ie=({fill:e})=>ne.createElement("g",{transform:"translate(0.5, 0.5)"},ne.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}),ne.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}));ie.propTypes={fill:te.string.isRequired};const re=({fill:e})=>ne.createElement("g",{transform:"translate(1,0)"},ne.createElement("rect",{x:"21",y:"12.9",width:"3.7",height:"4.7",fill:e}),ne.createElement("rect",{x:"12.7",y:"12.9",width:"3.7",height:"4.7",fill:e}),ne.createElement("rect",{x:"12.2",y:"22.5",width:"13",height:"3.3",fill:e}));re.propTypes={fill:te.string.isRequired};const oe=G(ie,re);oe.propTypes={iconSet:te.oneOf(["emoji","check"]),shape:te.oneOf(["round","square"]),category:te.oneOf(["feedback",void 0]),open:te.bool,fg:te.string,bg:te.string,size:te.oneOfType([te.string,te.number])},oe.defaultProps={iconSet:"check",shape:"round",category:void 0,open:!1,fg:"#fcb733",bg:"#fbf2e3",size:30};const se=e,ae=t,le=()=>{const e={fill:"none",stroke:"#BCE2FF",strokeWidth:2,strokeMiterlimit:10};return ae.createElement("g",null,ae.createElement("line",{style:e,x1:"-98",y1:"142",x2:"-114.6",y2:"142"}),ae.createElement("line",{style:e,x1:"-98",y1:"146.3",x2:"-114.6",y2:"146.3"}),ae.createElement("line",{style:e,x1:"-104",y1:"150.7",x2:"-114.6",y2:"150.7"}))},ce=({children:e,size:t})=>ae.createElement(L,{size:t},ae.createElement("svg",{version:"1.1",viewBox:"-128 129 31 31",style:{enableBackground:"new -128 129 31 31"}},e));ce.propTypes={children:se.oneOfType([se.arrayOf(se.node),se.node]).isRequired,size:se.number};const de=()=>ae.createElement("g",null,ae.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"}),ae.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 "}),ae.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"}),ae.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 "}),ae.createElement("rect",{x:"-125.5",y:"134",style:{fill:"#7FABC6"},width:"4.1",height:"4.1"}),ae.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 "})),pe=()=>ae.createElement("g",null,ae.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"}),ae.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 "}),ae.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"}),ae.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 "}),ae.createElement("rect",{x:"-125.5",y:"134",style:{fill:"#1A9CFF"},width:"4.1",height:"4.1"}),ae.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 ue extends ae.Component{constructor(e){super(e)}render(){return!0===this.props.open?ae.createElement(ce,null,ae.createElement(de,null),ae.createElement(le,null)):ae.createElement(ce,null,ae.createElement(pe,null),ae.createElement(le,null))}}ue.propTypes={open:se.bool},ue.defaultProps={open:!1};const he=e,me=t,fe=({fill:e})=>me.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"});fe.propTypes={fill:he.string};class ge extends me.Component{static __initStatic(){this.propTypes={classes:he.object.isRequired,size:he.number}}render(){const{size:e}=this.props;return!0===this.props.open?me.createElement(L,{size:e},me.createElement("svg",{preserveAspectRatio:"xMinYMin meet",viewBox:"-135 129 16 32"},me.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"}),me.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"}),me.createElement(fe,{fill:"#1A9CFF"}))):me.createElement(L,{size:e},me.createElement("svg",{preserveAspectRatio:"xMinYMin meet",viewBox:"-135 129 16 31"},me.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"}),me.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"}),me.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"}),",",me.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"}),me.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"}),me.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"}),me.createElement(fe,{fill:"1A9CFF"})))}}ge.__initStatic(),ge.propTypes={open:he.bool},ge.defaultProps={open:!1};const Ee=e,be=t,ye=({fill:e})=>be.createElement("g",null,be.createElement("rect",{x:"19.3",y:"10.3",width:"4.5",height:"12.7",fill:e}),be.createElement("rect",{x:"19.3",y:"26.2",width:"4.5",height:"4.5",fill:e}));ye.propTypes={fill:Ee.string.isRequired};const ve=({fill:e})=>be.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});ve.propTypes={fill:Ee.string.isRequired};const xe=({fill:e})=>be.createElement("g",null,be.createElement("rect",{x:"23.8",y:"15",width:"3.5",height:"4.4",fill:e}),be.createElement("rect",{x:"16",y:"15",width:"3.5",height:"4.4",fill:e}),be.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}));xe.propTypes={fill:Ee.string.isRequired};class Ce extends be.Component{constructor(e){super(e);const{fg:t="#464146",bg:n="white"}=this.props;this.icons={check:be.createElement(j,null,be.createElement(ve,{fill:n}),be.createElement(ye,{fill:t})),emoji:be.createElement(j,null,be.createElement(ve,{fill:n}),be.createElement(xe,{fill:t})),feedback:{check:be.createElement(j,null,be.createElement(ve,{fill:n}),be.createElement(xe,{fill:t})),emoji:be.createElement(j,null,be.createElement(ve,{fill:n}),be.createElement(xe,{fill:t})),square:{check:be.createElement(j,null,be.createElement(ve,{fill:n}),be.createElement(ye,{fill:t})),emoji:be.createElement(j,null,be.createElement(ve,{fill:n}),be.createElement(xe,{fill:t})),open:{check:be.createElement(j,null,be.createElement(ye,{fill:n})),emoji:be.createElement(j,null,be.createElement(xe,{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]}}Ce.propTypes={iconSet:Ee.oneOf(["emoji","check",void 0]),shape:Ee.oneOf(["square",void 0]),category:Ee.oneOf(["feedback",void 0]),open:Ee.bool,fg:Ee.string,bg:Ee.string},Ce.defaultProps={iconSet:"check",shape:void 0,category:void 0,open:!1,fg:"#464146",bg:"white"};const _e=e,Re=t,ke=({fill:e})=>Re.createElement("g",{transform:"translate(0, 0)"},Re.createElement("polygon",{points:"27.5,13.4 23.9,11.4 15.9,25.8 19.1,28.6",fill:e}),Re.createElement("polygon",{points:"16.2,20.6 14.4,19.2 11.8,22.3 14.1,24.3",fill:e}));ke.propTypes={fill:_e.string.isRequired};const Te=({fill:e})=>Re.createElement("g",{transform:"translate(2, 0)"},Re.createElement("rect",{x:"20.6",y:"11.8",width:"4",height:"5",fill:e}),Re.createElement("rect",{x:"11.5",y:"11.8",width:"4",height:"5",fill:e}),Re.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}));Te.propTypes={fill:_e.string.isRequired};const Se=G(ke,Te);Se.propTypes={iconSet:_e.oneOf(["emoji","check"]),shape:_e.oneOf(["round","square"]),category:_e.oneOf(["feedback",void 0]),open:_e.bool,fg:_e.string,bg:_e.string,size:_e.oneOfType([_e.string,_e.number])},Se.defaultProps={iconSet:"check",shape:"round",category:void 0,open:!1,fg:"#4aaf46",bg:"#c1e1ac",size:30};const Oe=e,Ae=t,Ne=({fill:e})=>Ae.createElement("g",null,Ae.createElement("rect",{x:"-115",y:"136.7",width:"3",height:"3",fill:e}),Ae.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}));Ne.propTypes={fill:Oe.string.isRequired};const Me=({fill:e})=>Ae.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});Me.propTypes={fill:Oe.string.isRequired};const De=({fill:e="#FFFFFF"})=>Ae.createElement("g",null,Ae.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"}),Ae.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"}),Ae.createElement("circle",{cx:"-113",cy:"144",r:"14",fill:e}));De.propTypes={fill:Oe.string};const we=({children:e,size:t})=>{const n=F(t),i={height:n,width:n,display:"inline-block",position:"relative"};return Ae.createElement("div",{style:i},Ae.createElement("svg",{preserveAspectRatio:"xMinYMin meet",viewBox:"-129 128 34 34"},e))};we.propTypes={children:Oe.oneOfType([Oe.arrayOf(Oe.node),Oe.node]).isRequired,size:Oe.oneOfType([Oe.string,Oe.number])};class Ie extends Ae.Component{render(){const{iconSet:e,open:t,fg:n="#1a9cff",bg:i="#bce2ff",border:r="#bbe3fd"}=this.props,o=Ae.createElement(Ne,{fill:n}),s={check:Ae.createElement(we,{size:this.props.size},Ae.createElement(De,null),o,Ae.createElement(Me,{fill:r})),emoji:Ae.createElement(we,{size:this.props.size},Ae.createElement(De,null),o,Ae.createElement(Me,{fill:r})),open:{check:Ae.createElement(we,{size:this.props.size},Ae.createElement("circle",{cx:"-113",cy:"144",r:"14",fill:"#FFFFFF"}),Ae.createElement(Ne,{fill:i}),Ae.createElement(Me,{fill:"#FFFFFF"})),emoji:Ae.createElement(we,{size:this.props.size},Ae.createElement("circle",{cx:"-113",cy:"144",r:"14",fill:"#FFFFFF"}),Ae.createElement(Ne,{fill:i}),Ae.createElement(Me,{fill:r}))}};return!0===t?s.open[e]:s[e]}}function Be(){return Be=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},Be.apply(null,arguments)}function Fe(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 Le(e,t){return Le=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Le(e,t)}function ze(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Le(e,t)}function Pe(e,t){return e.replace(new RegExp("(^|\\s)"+t+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}Ie.propTypes={iconSet:Oe.oneOf(["emoji","check"]),open:Oe.bool,fg:Oe.string,bg:Oe.string,border:Oe.string,size:Oe.oneOfType([Oe.string,Oe.number])},Ie.defaultProps={iconSet:"check",open:!1,fg:"#1a9cff",bg:"#bce2ff",border:"#bbe3fd",size:30};var je=!1;var qe=t.createContext(null),He=function(e){return e.scrollTop};const $e=t,We=i;var Ue="unmounted",Ye="exited",Ge="entering",Ke="entered",Je="exiting",Ve=function(e){function t(t,n){var i;i=e.call(this,t,n)||this;var r,o=n&&!n.isMounting?t.enter:t.appear;return i.appearStatus=null,t.in?o?(r=Ye,i.appearStatus=Ge):r=Ke:r=t.unmountOnExit||t.mountOnEnter?Ue:Ye,i.state={status:r},i.nextCallback=null,i}ze(t,e),t.getDerivedStateFromProps=function(e,t){return e.in&&t.status===Ue?{status:Ye}: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!==Ge&&n!==Ke&&(t=Ge):n!==Ge&&n!==Ke||(t=Je)}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===Ge){if(this.props.unmountOnExit||this.props.mountOnEnter){var n=this.props.nodeRef?this.props.nodeRef.current:We.findDOMNode(this);n&&He(n)}this.performEnter(e)}else this.performExit();else this.props.unmountOnExit&&this.state.status===Ye&&this.setState({status:Ue})},n.performEnter=function(e){var t=this,n=this.props.enter,i=this.context?this.context.isMounting:e,r=this.props.nodeRef?[i]:[We.findDOMNode(this),i],o=r[0],s=r[1],a=this.getTimeouts(),l=i?a.appear:a.enter;!e&&!n||je?this.safeSetState({status:Ke},function(){t.props.onEntered(o)}):(this.props.onEnter(o,s),this.safeSetState({status:Ge},function(){t.props.onEntering(o,s),t.onTransitionEnd(l,function(){t.safeSetState({status:Ke},function(){t.props.onEntered(o,s)})})}))},n.performExit=function(){var e=this,t=this.props.exit,n=this.getTimeouts(),i=this.props.nodeRef?void 0:We.findDOMNode(this);t&&!je?(this.props.onExit(i),this.safeSetState({status:Je},function(){e.props.onExiting(i),e.onTransitionEnd(n.exit,function(){e.safeSetState({status:Ye},function(){e.props.onExited(i)})})})):this.safeSetState({status:Ye},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:We.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],o=r[0],s=r[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===Ue)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=Fe(t,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]);return $e.createElement(qe.Provider,{value:null},"function"==typeof n?n(e,i):$e.cloneElement($e.Children.only(n),i))},t}($e.Component);function Xe(){}Ve.contextType=qe,Ve.propTypes={},Ve.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:Xe,onEntering:Xe,onEntered:Xe,onExit:Xe,onExiting:Xe,onExited:Xe},Ve.UNMOUNTED=Ue,Ve.EXITED=Ye,Ve.ENTERING=Ge,Ve.ENTERED=Ke,Ve.EXITING=Je;var Ze=Ve;const Qe=t;var et=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})},tt=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=Pe(n.className,i):n.setAttribute("class",Pe(n.className&&n.className.baseVal||"",i)));var n,i})},nt=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],o=i[1];t.removeClasses(r,"exit"),t.addClass(r,o?"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],o=i[1]?"appear":"enter";t.addClass(r,o,"active"),t.props.onEntering&&t.props.onEntering(e,n)},t.onEntered=function(e,n){var i=t.resolveArguments(e,n),r=i[0],o=i[1]?"appear":"enter";t.removeClasses(r,o),t.addClass(r,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,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}ze(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&&He(e),i&&(this.appliedClasses[t][n]=i,et(e,i))},n.removeClasses=function(e,t){var n=this.appliedClasses[t],i=n.base,r=n.active,o=n.done;this.appliedClasses[t]={},i&&tt(e,i),r&&tt(e,r),o&&tt(e,o)},n.render=function(){var e=this.props;e.classNames;var t=Fe(e,["classNames"]);return Qe.createElement(Ze,Be({},t,{onEnter:this.onEnter,onEntered:this.onEntered,onEntering:this.onEntering,onExit:this.onExit,onExiting:this.onExiting,onExited:this.onExited}))},t}(Qe.Component);nt.defaultProps={classNames:""},nt.propTypes={};var it=nt;const{Children:rt}=t,{cloneElement:ot}=t,{isValidElement:st}=t;function at(e,t){var n=Object.create(null);return e&&rt.map(e,function(e){return e}).forEach(function(e){n[e.key]=function(e){return t&&st(e)?t(e):e}(e)}),n}function lt(e,t,n){return null!=n[t]?n[t]:e.props[t]}function ct(e,t,n){var i=at(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),o=[];for(var s in e)s in t?o.length&&(r[s]=o,o=[]):o.push(s);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<o.length;i++)a[o[i]]=n(o[i]);return a}(t,i);return Object.keys(r).forEach(function(o){var s=r[o];if(st(s)){var a=o in t,l=o in i,c=t[o],d=st(c)&&!c.props.in;!l||a&&!d?l||!a||d?l&&a&&st(c)&&(r[o]=ot(s,{onExited:n.bind(null,s),in:c.props.in,exit:lt(s,"exit",e),enter:lt(s,"enter",e)})):r[o]=ot(s,{in:!1}):r[o]=ot(s,{onExited:n.bind(null,s),in:!0,exit:lt(s,"exit",e),enter:lt(s,"enter",e)})}}),r}const dt=t;var pt=Object.values||function(e){return Object.keys(e).map(function(t){return e[t]})},ut=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}ze(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,o=t.handleExited;return{children:t.firstRender?(n=e,i=o,at(n.children,function(e){return ot(e,{onExited:i.bind(null,e),in:!0,appear:lt(e,"appear",n),enter:lt(e,"enter",n),exit:lt(e,"exit",n)})})):ct(e,r,o),firstRender:!1}},n.handleExited=function(e,t){var n=at(this.props.children);e.key in n||(e.props.onExited&&e.props.onExited(t),this.mounted&&this.setState(function(t){var n=Be({},t.children);return delete n[e.key],{children:n}}))},n.render=function(){var e=this.props,t=e.component,n=e.childFactory,i=Fe(e,["component","childFactory"]),r=this.state.contextValue,o=pt(this.state.children).map(n);return delete i.appear,delete i.enter,delete i.exit,null===t?dt.createElement(qe.Provider,{value:r},o):dt.createElement(qe.Provider,{value:r},dt.createElement(t,i,o))},t}(dt.Component);ut.propTypes={},ut.defaultProps={component:"div",childFactory:function(e){return e}};var ht=ut;const{green:mt}=r,{indigo:ft}=r,{orange:gt}=r,{pink:Et}=r,{red:bt}=r,yt={TEXT:"black",DISABLED:"grey",DISABLED_SECONDARY:"#ABABAB",CORRECT:mt[500],CORRECT_SECONDARY:mt[50],CORRECT_TERTIARY:"#0EA449",CORRECT_WITH_ICON:"#087D38",INCORRECT:gt[500],INCORRECT_SECONDARY:bt[50],INCORRECT_WITH_ICON:"#BF0D00",MISSING:bt[700],MISSING_WITH_ICON:"#6A78A1",PRIMARY:ft[500],PRIMARY_LIGHT:ft[200],PRIMARY_DARK:ft[800],SECONDARY:Et.A400,SECONDARY_LIGHT:Et[200],SECONDARY_DARK:Et[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",TABLE_GRID:"black",TABLE_GRID_LIGHT:"#dfe2e5",TABLE_STRIPE:"#f6f8fa",BLACK:"#000000",WHITE:"#ffffff",TRANSPARENT:"transparent",FOCUS_CHECKED:"#BBDEFB",FOCUS_CHECKED_BORDER:"#1565C0",FOCUS_UNCHECKED:"#E0E0E0",FOCUS_UNCHECKED_BORDER:"#757575",BUTTON_FOCUS_OUTLINE:"#3B82F6",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)",KEY_BOARD_FOCUS_INDICATOR:"#2B87FF",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),Rt=()=>vt("border-gray",yt.BORDER_GRAY),kt=()=>vt("table-stripe","background-dark",yt.TABLE_STRIPE),Tt=t,St=e,{styled:Ot}=n,At=Ot("div")({transformOrigin:"0% 0px 0px",width:"100%",display:"block",overflow:"hidden","&.incorrect":{color:"#946202"}}),Nt=Ot("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)})`}}),Mt=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 Tt.Component{constructor(...e){super(...e),Dt.prototype.__init.call(this)}static __initStatic(){this.propTypes={correctness:St.string,feedback:St.string}}__init(){this.nodeRef=Tt.createRef()}renderFeedback(){const{correctness:e,feedback:t}=this.props;return e&&t?Tt.createElement(it,{key:"hasFeedback",nodeRef:this.nodeRef,timeout:{enter:500,exit:200},classNames:"feedback"},Tt.createElement(Mt,{ref:this.nodeRef},Tt.createElement(At,null,Tt.createElement(Nt,{className:e,dangerouslySetInnerHTML:{__html:t}})))):null}render(){return Tt.createElement("div",null,Tt.createElement(ht,null,this.renderFeedback()))}}Dt.__initStatic();const wt=t,It=e,{Popover:Bt}=o,{styled:Ft}=n,Lt=s("pie-libs:render-ui:response-indicators"),zt=Ft("div")(({hasFeedback:e})=>({cursor:e?"pointer":"default"})),Pt=Ft(Bt)({cursor:"pointer"}),jt=Ft("div")({padding:"0",borderRadius:"4px"}),qt=(e,t)=>{class n extends wt.Component{constructor(e){super(e),n.prototype.__init.call(this),n.prototype.__init2.call(this),this.state={}}__init(){this.handlePopoverOpen=e=>{Lt("[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 wt.createElement(zt,{hasFeedback:!!n},wt.createElement("span",{ref:e=>this.icon=e,onClick:this.handlePopoverOpen},wt.createElement(e,null)),n&&wt.createElement(Pt,{PaperComponent:jt,open:!!i,anchorEl:i,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},onClose:this.handlePopoverClose},wt.createElement(Dt,{feedback:n,correctness:t})))}}return n.propTypes={feedback:It.string},n};qt(Z,"correct"),qt(oe,"incorrect"),qt(Se,"partially-correct"),qt(Ce,"nothing-submitted");const Ht=t,{styled:$t}=n,Wt=a,Ut=e,{renderMath:Yt}=c,Gt=$t("span")(({theme:e})=>({color:e.palette.primary.light,borderBottom:`1px dotted ${e.palette.primary.light}`,cursor:"pointer"})),Kt=$t(Wt)(({theme:e})=>({paddingTop:e.spacing(2)}));class Jt extends Ht.Component{constructor(...e){super(...e),Jt.prototype.__init.call(this),Jt.prototype.__init2.call(this)}static __initStatic(){this.propTypes={className:Ut.string,children:Ut.object,labels:Ut.shape({visible:Ut.string,hidden:Ut.string})}}static __initStatic2(){this.defaultProps={labels:{}}}__init(){this.state={expanded:!1}}__init2(){this.toggleExpanded=()=>{this.setState(e=>({expanded:!e.expanded}))}}componentDidMount(){Yt(this.root)}componentDidUpdate(){Yt(this.root)}render(){const{labels:e,children:t,className:n}=this.props,i=this.state.expanded?e.visible||"Hide":e.hidden||"Show";return Ht.createElement("div",{className:n,ref:e=>this.root=e},Ht.createElement("div",{onClick:this.toggleExpanded},Ht.createElement(Gt,null,i)),Ht.createElement(Kt,{in:this.state.expanded,timeout:{enter:225,exit:195},unmountOnExit:!0},t))}}Jt.__initStatic(),Jt.__initStatic2();const{Button:Vt}=o,{styled:Xt}=n;Xt("div")({display:"flex",flexDirection:"column"}),Xt("div")({display:"flex",alignItems:"center",justifyContent:"center"}),Xt("div")(({theme:e})=>({width:"24px",height:"24px",color:"gray",marginRight:e.spacing(1),display:"flex",alignItems:"center"})),Xt(Vt)(({theme:e})=>({display:"flex",alignItems:"center",marginLeft:e.spacing(3),marginRight:e.spacing(3)}));const Zt=t,{createTheme:Qt}=n,{styled:en}=n,{StyledEngineProvider:tn}=n,{ThemeProvider:nn}=n,rn=e;const on=Qt({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"}}}}}}),sn=en("div")({"& table, th, td":{fontSize:"inherit"}});class an extends Zt.Component{static __initStatic(){this.propTypes={className:rn.string,children:rn.array,extraCSSRules:rn.shape({names:rn.arrayOf(rn.string),rules:rn.string}),fontSizeFactor:rn.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),o=null!=e&&"number"==typeof e?e:1;return 1!==o?{fontSize:r*o+"px"}:null}render(){const{children:e,className:t,fontSizeFactor:n,...i}=this.props,{extraCSSRules:r,...o}=i,s=this.computeStyle(n);return Zt.createElement(tn,{injectFirst:!0},Zt.createElement(nn,{theme:on},function(e){let t,n=e[0],i=1;for(;i<e.length;){const r=e[i],o=e[i+1];if(i+=2,("optionalAccess"===r||"optionalCall"===r)&&null==n)return;"access"===r||"optionalAccess"===r?(t=n,n=o(n)):"call"!==r&&"optionalCall"!==r||(n=o((...e)=>n.call(t,...e)),t=void 0)}return n}([r,"optionalAccess",e=>e.rules])?Zt.createElement("style",{dangerouslySetInnerHTML:{__html:`.extraCSSRules { ${r.rules} }`}}):null,Zt.createElement(sn,{className:`${t} extraCSSRules`,...o,...s&&{style:s}},e)))}}an.__initStatic(),an.__initStatic2();const ln=t,{styled:cn}=n,dn=e,pn=cn(an)({display:"flex",flexDirection:"column",position:"relative"});class un extends ln.Component{static __initStatic(){this.propTypes={ariaLabel:dn.string,children:dn.oneOfType([dn.arrayOf(dn.node),dn.node]).isRequired,role:dn.string,extraCSSRules:dn.shape({names:dn.arrayOf(dn.string),rules:dn.string}),fontSizeFactor:dn.number}}render(){const{children:e,ariaLabel:t,role:n,extraCSSRules:i,fontSizeFactor:r,classes:o}=this.props,s=t?{"aria-label":t,role:n}:{};return ln.createElement(pn,{...s,extraCSSRules:i,fontSizeFactor:r,classes:o},e)}}un.__initStatic();const hn=t,mn=e;class fn extends hn.Component{static __initStatic(){this.propTypes={tag:mn.string,className:mn.string,html:mn.string}}static __initStatic2(){this.defaultProps={tag:"div",html:""}}render(){const{tag:e,className:t,html:n}=this.props,i=e||"div";return hn.createElement(i,{ref:e=>this.node=e,className:t,dangerouslySetInnerHTML:{__html:n}})}}fn.__initStatic(),fn.__initStatic2();const{InputLabel:gn}=o,{FormControl:En}=o,bn=e,{styled:yn}=n;yn(En)(({theme:e})=>({margin:0,padding:0,flex:"1 0 auto",minWidth:e.spacing(4)})),yn(gn)(()=>({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)"}})),bn.oneOfType([bn.string,bn.object]).isRequired,bn.string,bn.oneOfType([bn.arrayOf(bn.node),bn.node]).isRequired;const vn=t,{Component:xn}=t,{styled:Cn}=n,_n=e,{renderMath:Rn}=c,kn=Cn("div")(({theme:e,tagName:t})=>({'&:not(.MathJax) > table:not([role="presentation"])':{borderCollapse:"collapse"},'&:not(.MathJax) table[border]:not([role="presentation"]), &:not(.MathJax) table[border]:not([role="presentation"]) td, &:not(.MathJax) table[border]:not([role="presentation"]) th':{borderStyle:"solid",borderColor:vt("table-grid","text",yt.TABLE_GRID)},'&:not(.MathJax) > table:not([role="presentation"]):has(tbody tr > th:first-child):not(:has(tbody tr > td:first-child)) tbody td:nth-child(even)':{backgroundColor:kt()},'&:not(.MathJax) > table:not([role="presentation"]):has(tbody tr > td:first-child) tbody tr:nth-child(even) td':{backgroundColor:kt()},'&:not(.MathJax) table:not([role="presentation"]) td, &:not(.MathJax) table:not([role="presentation"]) 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"}}})),Tn=/\\embed\{newLine\}\[\]/g;class Sn extends xn{constructor(...e){super(...e),Sn.prototype.__init.call(this),Sn.prototype.__init2.call(this)}static __initStatic(){this.propTypes={prompt:_n.string,tagName:_n.string,className:_n.string,onClick:_n.func,defaultClassName:_n.string,autoplayAudioEnabled:_n.bool,customAudioButton:{playImage:_n.string,pauseImage:_n.string}}}static __initStatic2(){this.defaultProps={onClick:()=>{}}}__init(){this.promptRef=vn.createRef()}__init2(){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",o)}).catch(e=>{console.error("Error playing audio",e)}),!n||!i||!t)return;const r=()=>{i.paused&&(n.style.backgroundImage.includes(t.pauseImage)||i.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",r),i.addEventListener("play",s),i.addEventListener("pause",a),i.addEventListener("ended",o),this._handlePlayClick=r,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=this.promptRef.current;e&&"function"==typeof Rn&&Rn(e)}alignImages(){const e=this.promptRef.current;if(!e)return;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,o=`${n||""} ${r||""} ${"legend"===t?"legend":""} preview-prompt`.trim();return vn.createElement(kn,{as:t||"div",ref:this.promptRef,onClick:i,className:o,tagName:t,dangerouslySetInnerHTML:{__html:this.parsedText(e||"").replace(Tn,"\\newline ")}})}}Sn.__initStatic(),Sn.__initStatic2();const On=e;On.node,On.bool;const An=e,Nn=t,Mn=e=>Nn.createElement(Nn.Fragment,null,Nn.Children.map(e.children,t=>Nn.cloneElement(t,{"data-pie-purpose":e.purpose})));function Dn(e="",t=2){if(!e)return e;const n=(new DOMParser).parseFromString(e,"text/html");return n.body.querySelectorAll("[data-heading]").forEach(e=>{const i=e.getAttribute("data-heading")||"",r=parseInt(i.replace("heading",""),10);if(!Number.isFinite(r))return;const o=Math.min(6,Math.max(1,t+r-1)),s=n.createElement(`h${o}`);s.setAttribute("data-heading",i),Array.from(e.attributes).forEach(e=>{"data-heading"!==e.name&&s.setAttribute(e.name,e.value)}),s.innerHTML=e.innerHTML,e.replaceWith(s)}),n.body.innerHTML}Mn.propTypes={children:An.node,purpose:An.string},"undefined"!=typeof window&&new DOMParser,"undefined"!=typeof window&&new DOMParser;const wn=t,In=e,{Tabs:Bn}=o,{Tab:Fn}=o,{styled:Ln}=n;const zn=()=>{if("undefined"==typeof window)return 1;const e=window.outerWidth/window.innerWidth,t=Number.isFinite(e)&&e>0?e:1;return Math.max(.4,Math.min(1,2/t))},Pn=Ln("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"}}),jn=Ln("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"}})),qn=Ln("div")({fontSize:"1.75rem"}),Hn=Ln("div")({fontSize:"1.5rem"}),$n=Ln("div")({fontSize:"1.25rem"}),Wn=Ln(Fn)(({theme:e})=>({background:_t(),fontSize:"inherit",fontFamily:"Roboto, sans-serif",color:Ct(),borderRadius:`${e.spacing(2)} ${e.spacing(2)} 0 0`,border:`1px solid ${Rt()}`,borderBottomWidth:0,minHeight:"56px",padding:"8px 10px",display:"flex",alignItems:"center",justifyContent:"center",margin:`0 ${e.spacing(1)}`,textTransform:"none",".passage-label":{display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"normal",margin:"auto 0",opacity:.7},"&.Mui-selected":{color:Ct(),".passage-label":{opacity:1},".passage-label-underline":{backgroundColor:vt("tertiary",yt.TERTIARY)}},"&:hover":{".passage-label-underline":{backgroundColor:vt("tertiary-light",yt.TERTIARY_LIGHT)}},"& .MuiTouchRipple-root":{opacity:.7}})),Un=Ln("div")(()=>({height:"2px",width:"100%",marginTop:"6px",background:_t()}));class Yn extends wn.Component{constructor(...e){super(...e),Yn.prototype.__init.call(this),Yn.prototype.__init2.call(this),Yn.prototype.__init3.call(this),Yn.prototype.__init4.call(this),Yn.prototype.__init5.call(this),Yn.prototype.__init6.call(this),Yn.prototype.__init7.call(this)}__init(){this.state={activeTab:0,zoomCompensation:zn(),containerWidth:0}}__init2(){this.containerRef=wn.createRef()}componentDidMount(){"undefined"!=typeof window&&(window.addEventListener("resize",this.updateZoomCompensation),this.containerRef.current&&"undefined"!=typeof ResizeObserver&&(this.resizeObserver=new ResizeObserver(this.updateContainerWidth),this.resizeObserver.observe(this.containerRef.current)),this.updateContainerWidth())}componentWillUnmount(){"undefined"!=typeof window&&(window.removeEventListener("resize",this.updateZoomCompensation),this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null))}__init3(){this.updateZoomCompensation=()=>{this.setState({zoomCompensation:zn()})}}__init4(){this.updateContainerWidth=()=>{const e=this.containerRef.current;if(!e)return;const t=e.clientWidth;t!==this.state.containerWidth&&this.setState({containerWidth:t})}}__init5(){this.handleChange=(e,t)=>{this.setState(()=>({activeTab:t})),setTimeout(()=>{const e=new CustomEvent("pie-ui-passage-tabChanged",{detail:{tab:t}});window.dispatchEvent(e)})}}__init6(){this.handleKeyDown=(e,t)=>{const{key:n}=e,{tabs:i}=this.props;let r=-1;const o=i.findIndex(e=>e.id===t);switch(n){case"ArrowRight":r=(o+1)%i.length;break;case"ArrowLeft":r=(o-1+i.length)%i.length;break;case"Home":r=0;break;case"End":r=i.length-1;break;case"Enter":case" ":r=o}-1!==r&&(e.preventDefault(),e.stopPropagation(),this.handleChange(e,i[r].id),document.getElementById(`button-${i[r].id}`).focus())}}__init7(){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=wn.createElement(Sn,{tagName:"div",className:"prompt",defaultClassName:"teacher-instructions",prompt:e});return t?n:wn.createElement(Jt,{labels:{hidden:"Show Teacher Instructions",visible:"Hide Teacher Instructions"}},n)}renderTab(e,t){const{baseHeadingLevel:n}=this.props,i=n?Math.min(6,Math.max(1,n)):void 0,r=n?`h${i}`:"h2",o=n?Math.min(6,Math.max(1,i+1)):void 0;return wn.createElement(jn,{key:e.id,id:`tabpanel-${e.id}`,role:"tabpanel","aria-labelledby":`button-${e.id}`},this.renderInstructions(e.teacherInstructions,t),e.title&&wn.createElement(Mn,{purpose:"passage-title"},wn.createElement(r,null,wn.createElement(qn,{dangerouslySetInnerHTML:{__html:this.parsedText(e.title)}}))),e.subtitle&&wn.createElement(Mn,{purpose:"passage-subtitle"},wn.createElement(Hn,{dangerouslySetInnerHTML:{__html:this.parsedText(e.subtitle)}})),e.author&&wn.createElement(Mn,{purpose:"passage-author"},wn.createElement($n,{className:"author",dangerouslySetInnerHTML:{__html:this.parsedText(e.author)}})),e.text&&wn.createElement(Mn,{purpose:"passage-text"},wn.createElement("div",{key:e.id,className:"text",dangerouslySetInnerHTML:{__html:n?Dn(e.text,o):e.text}})))}render(){const{model:e,tabs:t,disabledTabs:n}=this.props,{activeTab:i,zoomCompensation:r,containerWidth:o}=this.state;if(!function(e){let t,n=e[0],i=1;for(;i<e.length;){const r=e[i],o=e[i+1];if(i+=2,("optionalAccess"===r||"optionalCall"===r)&&null==n)return;"access"===r||"optionalAccess"===r?(t=n,n=o(n)):"call"!==r&&"optionalCall"!==r||(n=o((...e)=>n.call(t,...e)),t=void 0)}return n}([t,"optionalAccess",e=>e.length]))return;const{extraCSSRules:s}=e||{},a=(t||[]).find(e=>e.id===i),l=o>0?o/t.length:null,c=o>0&&o<=170*t.length;return wn.createElement(an,{extraCSSRules:s},wn.createElement(Pn,{className:"passages",ref:this.containerRef},n||1===t.length?t.map(e=>this.renderTab(e,n)):wn.createElement(wn.Fragment,null,wn.createElement(Bn,{sx:{position:"static","@media (min-width: 841px)":{position:"sticky",top:0,zIndex:1},background:"var(--pie-passage-header-background, rgba(255,255,255,0))",color:Ct(),fontFamily:"Roboto, sans-serif",zoom:r,"& .MuiTabs-list":{backgroundColor:`var(--pie-passage-header-background, ${vt("background-dark",yt.BACKGROUND_DARK)})`,borderBottom:`1px solid ${Rt()}`},"& .MuiTabs-indicator":{backgroundColor:vt("white",yt.WHITE),marginBottom:"-1px"}},value:i,onChange:this.handleChange},t.map((e,t)=>wn.createElement(Wn,{key:e.id,id:`button-${e.id}`,sx:l?{maxWidth:`${l}px`}:void 0,label:wn.createElement(wn.Fragment,null,wn.createElement(Mn,{purpose:"passage-label"},c?wn.createElement("span",{className:"passage-label"},`Passage ${t+1}`):wn.createElement("span",{className:"passage-label",dangerouslySetInnerHTML:{__html:this.parsedText(e.label)}})),wn.createElement(Un,{className:"passage-label-underline"})),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)}))),a?this.renderTab(a,n):null)))}}Yn.propTypes={tabs:In.arrayOf(In.shape({id:In.number.isRequired,label:In.string.isRequired,title:In.string.isRequired,subtitle:In.string,author:In.string,text:In.string.isRequired,teacherInstructions:In.string}).isRequired).isRequired,disabledTabs:In.bool,model:In.object,baseHeadingLevel:In.number};const Gn=t,{createRoot:Kn}=l,Jn=s("pie-element:passage:print"),Vn=(e,t)=>(e=>null!=e)(e)?e:t;class Xn extends HTMLElement{constructor(){super(),this._model=null,this._options=null,this._session=[],this._root=null,this._rerender=w(()=>{if(this._model&&this._session){if(this._model.passages&&this._model.passages.length>0){const e=((e,t)=>{const n="instructor"===t.role,i=Vn(e.teacherInstructionsEnabled,!0),r=Vn(e.titleEnabled,!0),o=Vn(e.authorEnabled,!1),s=Vn(e.subtitleEnabled,!0),a=Vn(e.textEnabled,!0);return e.passages.map((e,t)=>({id:t,teacherInstructions:Vn(e.teacherInstructionsEnabled,i)&&n&&e.teacherInstructions||"",label:e.title||`Passage ${t+1}`,title:Vn(e.titleEnabled,r)&&e.title||"",author:Vn(e.authorEnabled,o)&&e.author||"",subtitle:Vn(e.subtitleEnabled,s)&&e.subtitle||"",text:Vn(e.textEnabled,a)&&e.text||""}))})(this._model,this._options),t=Gn.createElement(Yn,{disabledTabs:!0,tabs:e});this._root||(this._root=Kn(this)),this._root.render(t)}}else Jn("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{Xn 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": "7.1.1-next.
|
|
4
|
+
"version": "7.1.1-next.174+106261a31",
|
|
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": "5.0
|
|
18
|
-
"@pie-lib/render-ui": "
|
|
17
|
+
"@pie-lib/math-rendering": "5.1.0",
|
|
18
|
+
"@pie-lib/render-ui": "7.0.2",
|
|
19
19
|
"prop-types": "^15.8.1",
|
|
20
20
|
"react": "18.3.1",
|
|
21
21
|
"react-dom": "18.3.1"
|
|
22
22
|
},
|
|
23
|
-
"gitHead": "
|
|
23
|
+
"gitHead": "106261a31aca5a28e612e9a2c5c94a015ab6ac00",
|
|
24
24
|
"scripts": {
|
|
25
25
|
"postpublish": "../../scripts/postpublish"
|
|
26
26
|
},
|