@pie-element/math-templated 5.3.0 → 5.3.2-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [5.3.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/math-templated@5.2.1...@pie-element/math-templated@5.3.1) (2025-10-16)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * bump pie-lib versions and pslb module versions ([393d39f](https://github.com/pie-framework/pie-elements/commit/393d39fb850ad055568f4d20464213e9043f208f))
12
+
13
+
14
+
15
+
16
+
6
17
  # [5.3.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/math-templated@5.2.0...@pie-element/math-templated@5.3.0) (2025-10-15)
7
18
 
8
19
 
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [3.3.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/math-templated-configure@3.2.1...@pie-element/math-templated-configure@3.3.1) (2025-10-16)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * bump pie-lib versions and pslb module versions ([393d39f](https://github.com/pie-framework/pie-elements/commit/393d39fb850ad055568f4d20464213e9043f208f))
12
+
13
+
14
+
15
+
16
+
6
17
  # [3.3.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/math-templated-configure@3.2.0...@pie-element/math-templated-configure@3.3.0) (2025-10-15)
7
18
 
8
19
 
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "@pie-element/math-templated-configure",
3
3
  "private": true,
4
- "version": "3.3.0",
4
+ "version": "3.3.1",
5
5
  "description": "",
6
6
  "main": "lib/index.js",
7
7
  "module": "src/index.js",
8
8
  "dependencies": {
9
9
  "@material-ui/core": "^3.9.2",
10
10
  "@pie-framework/pie-configure-events": "^1.3.0",
11
- "@pie-lib/config-ui": "^11.25.2",
12
- "@pie-lib/editable-html": "^11.17.2",
13
- "@pie-lib/math-toolbar": "^1.27.2",
14
- "@pie-lib/render-ui": "^4.31.2",
11
+ "@pie-lib/config-ui": "^11.29.0",
12
+ "@pie-lib/editable-html": "^11.21.0",
13
+ "@pie-lib/math-toolbar": "^1.31.0",
14
+ "@pie-lib/render-ui": "^4.35.0",
15
15
  "debug": "^3.1.0",
16
16
  "lodash": "^4.17.15",
17
17
  "prop-types": "^15.6.2",
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [4.3.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/math-templated-controller@4.2.0...@pie-element/math-templated-controller@4.3.1) (2025-10-16)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * bump pie-lib versions and pslb module versions ([393d39f](https://github.com/pie-framework/pie-elements/commit/393d39fb850ad055568f4d20464213e9043f208f))
12
+
13
+
14
+
15
+
16
+
6
17
  # [4.3.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/math-templated-controller@4.2.0...@pie-element/math-templated-controller@4.3.0) (2025-10-15)
7
18
 
8
19
  **Note:** Version bump only for package @pie-element/math-templated-controller
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@pie-element/math-templated-controller",
3
3
  "private": true,
4
- "version": "4.3.0",
4
+ "version": "4.3.1",
5
5
  "description": "",
6
6
  "main": "lib/index.js",
7
7
  "module": "src/index.js",
8
8
  "dependencies": {
9
9
  "@pie-framework/math-validation": "^1.4.2",
10
- "@pie-lib/controller-utils": "^0.19.4",
11
- "@pie-lib/translator": "^2.20.4",
10
+ "@pie-lib/controller-utils": "^0.22.0",
11
+ "@pie-lib/translator": "^2.23.0",
12
12
  "debug": "^3.1.0",
13
13
  "lodash": "^4.17.15"
14
14
  },
@@ -1 +1 @@
1
- import{_dll_react as e,_dll_prop_types as t,_dll_material_ui__core as n,_dll_material_ui__core_styles as a,_dll_material_ui__icons as o,_dll_pie_lib__render_ui as s,_dll_lodash as i,_dll_debug as l,_dll_react_dom as r}from"../../../@pie-lib/shared-module@^1.14.9/module/index.js";import{_dll_pie_lib__config_ui as p}from"../../../@pie-lib/config-module@^2.19.9/module/index.js";import{_dll_pie_lib__editable_html as d}from"../../../@pie-lib/editable-html-module@^5.6.9/module/index.js";import{_dll_pie_lib__math_toolbar as c}from"../../../@pie-lib/math-edit-module@^2.5.0/module/index.js";var h={};Object.defineProperty(h,"__esModule",{value:!0});class u extends CustomEvent{constructor(e,t=!1){super(u.TYPE,{bubbles:!0,detail:{update:e,reset:t}}),this.update=e,this.reset=t}}u.TYPE="model.updated";var g=h.ModelUpdatedEvent=u;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.image";var b=h.DeleteImageEvent=m;class _ extends CustomEvent{constructor(e){super(_.TYPE,{bubbles:!0,detail:e}),this.handler=e}}_.TYPE="insert.image";var C=h.InsertImageEvent=_;class y extends CustomEvent{constructor(e,t){super(y.TYPE,{bubbles:!0,detail:{src:e,done:t}}),this.src=e,this.done=t}}y.TYPE="delete.sound";var E=h.DeleteSoundEvent=y;class f extends CustomEvent{constructor(e){super(f.TYPE,{bubbles:!0,detail:e}),this.handler=e}}f.TYPE="insert.sound";var S=h.InsertSoundEvent=f;const v=e,w=t,{Card:x}=n,{CardContent:A}=n,{Button:T}=n,{FormControlLabel:I}=n,{Typography:k}=n,{InputLabel:R}=n,{Checkbox:M}=n,{Select:N}=n,{MenuItem:O}=n,{IconButton:P}=n,{withStyles:K}=a,{Delete:D}=o,{color:q}=s,{InputContainer:j}=p,{MathToolbar:B}=c;class L extends v.Component{static __initStatic(){this.propTypes={classes:w.object.isRequired,defaultResponse:w.bool,error:w.object,mode:w.oneOfType([w.string,w.number]),onResponseChange:w.func.isRequired,onResponseDone:w.func.isRequired,response:w.object.isRequired,cIgnoreOrder:w.object.isRequired,cAllowTrailingZeros:w.object.isRequired,responseKey:w.number.isRequired}}static __initStatic2(){this.defaultProps={defaultResponse:!1,mode:"8"}}constructor(e){super(e),L.prototype.__init.call(this),L.prototype.__init2.call(this),L.prototype.__init3.call(this),L.prototype.__init4.call(this),L.prototype.__init5.call(this),L.prototype.__init6.call(this),L.prototype.__init7.call(this),L.prototype.__init8.call(this),L.prototype.__init9.call(this),L.prototype.__init10.call(this),L.prototype.__init11.call(this);const{response:{alternates:t}={}}=e||{},n=Object.keys(t||{}).length;this.state={alternateIdCounter:n+1,showKeypad:{openCount:0,main:!1}}}__init(){this.onChange=e=>t=>{const{response:n,onResponseChange:a,responseKey:o}=this.props,s={...n};s[e]=t.target.value,a(s,o)}}__init2(){this.onConfigChanged=e=>t=>{const{response:n,onResponseChange:a,responseKey:o}=this.props,s={...n};s[e]=t.target.checked,a(s,o)}}__init3(){this.onLiteralOptionsChange=e=>()=>{const{response:t,onResponseChange:n,responseKey:a}=this.props,o={...t};o[e]=!t[e],n(o,a)}}__init4(){this.onAnswerChange=e=>{const{response:t,onResponseChange:n,responseKey:a}=this.props,o={...t};o.answer=e,n(o,a)}}__init5(){this.onAlternateAnswerChange=e=>t=>{const{response:n,onResponseChange:a,responseKey:o}=this.props,s={...n};s.alternates[e]=t,a(s,o)}}__init6(){this.onAddAlternate=()=>{const{response:e,onResponseChange:t,responseKey:n}=this.props,{alternateIdCounter:a}=this.state,o={...e};o.alternates||(o.alternates={}),o.alternates[a]="",t(o,n),this.setState({alternateIdCounter:a+1})}}__init7(){this.onRemoveAlternate=e=>()=>{const{response:t,onResponseChange:n,responseKey:a}=this.props,o={...t};delete o.alternates[e],n(o,a),this.setState((t=>({showKeypad:{...t.showKeypad,openCount:t.showKeypad[e]?t.showKeypad.openCount-1:t.showKeypad.openCount}})))}}__init8(){this.onDone=()=>{const{onResponseDone:e}=this.props;this.setState((e=>({showKeypad:{...e.showKeypad,openCount:e.showKeypad.openCount-1,main:!1}}))),e()}}__init9(){this.onFocus=()=>{this.setState((e=>({showKeypad:{...e.showKeypad,openCount:e.showKeypad.main?e.showKeypad.openCount:e.showKeypad.openCount+1,main:!0}})))}}__init10(){this.onAlternateFocus=e=>()=>{this.setState((t=>({showKeypad:{...t.showKeypad,openCount:t.showKeypad[e]?t.showKeypad.openCount:t.showKeypad.openCount+1,[e]:!0}})))}}__init11(){this.onAlternateDone=e=>()=>{this.setState((t=>({showKeypad:{...t.showKeypad,openCount:t.showKeypad.openCount-1,[e]:!1}})))}}render(){const{classes:e,mode:t,responseKey:n,response:a,cAllowTrailingZeros:o,cIgnoreOrder:s,error:i}=this.props,{showKeypad:l}=this.state,{validation:r,answer:p,alternates:d,ignoreOrder:c,allowTrailingZeros:h}=a,u=Object.keys(d||{}).length>0,g={editor:e.responseEditor,mathToolbar:e.mathToolbar},m={minHeight:(l.openCount>0?430:230)+"px"},b=`R ${parseInt(n)+1}`;return v.createElement(x,{className:e.responseContainer,style:m},v.createElement(A,{className:e.cardContent},v.createElement("div",{className:e.titleBar},v.createElement(k,{className:e.title,component:"div"},"Response for ",v.createElement("div",{className:e.responseBox},b)),v.createElement(j,{label:"Validation",className:e.selectContainer},v.createElement(N,{className:e.select,onChange:this.onChange("validation"),value:r||"literal"},v.createElement(O,{value:"literal"},"Literal Validation"),v.createElement(O,{value:"symbolic"},"Symbolic Validation")))),"literal"===r&&v.createElement("div",{className:e.flexContainer},o.enabled&&v.createElement(I,{label:o.label,control:v.createElement(M,{className:e.customColor,checked:h,onChange:this.onLiteralOptionsChange("allowTrailingZeros")})}),s.enabled&&v.createElement(I,{label:s.label,control:v.createElement(M,{className:e.customColor,checked:c,onChange:this.onLiteralOptionsChange("ignoreOrder")})})),v.createElement("div",{className:e.inputContainer},v.createElement(R,null,"Correct Answer"),v.createElement(B,{keypadMode:t,classNames:g,controlledKeypad:!0,showKeypad:l.main,latex:p||"",onChange:this.onAnswerChange,onFocus:this.onFocus,onDone:this.onDone,error:i&&i.answer}),i&&i.answer?v.createElement("div",{className:e.errorText},i.answer):null),u&&Object.keys(d).map(((n,a)=>v.createElement("div",{className:e.inputContainer,key:n},v.createElement(R,null,"Alternate",Object.keys(d).length>1?` ${a+1}`:""),v.createElement("div",{className:e.alternateBar},v.createElement(B,{classNames:g,controlledKeypad:!0,keypadMode:t,showKeypad:l[n]||!1,latex:d[n]||"",onChange:this.onAlternateAnswerChange(n),onFocus:this.onAlternateFocus(n),onDone:this.onAlternateDone(n),error:i&&i[n]}),v.createElement(P,{className:e.removeAlternateButton,onClick:this.onRemoveAlternate(n)},v.createElement(D,null))),i&&i[n]?v.createElement("div",{className:e.errorText},i[n]):null))),v.createElement(T,{className:e.alternateButton,type:"primary",onClick:this.onAddAlternate},"ADD ALTERNATE")))}}L.__initStatic(),L.__initStatic2();var H=K((e=>({responseContainer:{marginBottom:2.5*e.spacing.unit,width:"100%",minWidth:"548px",border:`1px solid ${e.palette.grey[700]}`,display:"flex",flexDirection:"column",justifyContent:"space-between"},cardContent:{paddingBottom:2*e.spacing.unit+"px !important"},title:{fontWeight:700,fontSize:"1.2rem",flex:3},selectContainer:{flex:2},inputContainer:{marginBottom:2*e.spacing.unit},titleBar:{display:"flex",alignItems:"center",justifyContent:"space-between"},responseEditor:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",minWidth:"500px",maxWidth:"900px",height:"auto",minHeight:"40px"},mathToolbar:{width:"100%"},alternateButton:{border:`1px solid ${e.palette.grey.A100}`},removeAlternateButton:{marginLeft:e.spacing.unit},errorText:{fontSize:e.typography.fontSize-2,color:e.palette.error.main,paddingTop:e.spacing.unit},responseBox:{background:e.palette.grey.A100,color:e.palette.grey.A700,display:"inline",minWidth:"50px",padding:"8px",border:"1px solid #C0C3CF"},alternateBar:{display:"flex",justifyContent:"space-between",alignItems:"center"},customColor:{color:`${q.tertiary()} !important`}})))(L);const Z="imes|riangle|an|heta|herefore",$="throot|parallel|cong|approx|eq|e|sim",W=new RegExp(`(\\t(?!${Z}))|(\\n(?!${$}))|(\\\\t(?!${Z}))|(\\\\n(?!${$}))`,"g"),z=e=>e.replace(W,"").replace(/\\"/g,'"').replace(/\\\//g,"/"),F=e=>{const t=((e="")=>{const t=document.createElement("div");return t.innerHTML=e.trim(),t})(z(e||"")||"");return t.querySelectorAll('[data-type="math_templated"]').forEach((e=>e.replaceWith(`{{${e.dataset.index}}}`))),t.innerHTML},Y=/\{\{(\d+)\}\}/g,G=(e,t)=>e?z(e).replace(Y,((e,n)=>{const a=function(e){let t,n=e[0],a=1;for(;a<e.length;){const o=e[a],s=e[a+1];if(a+=2,("optionalAccess"===o||"optionalCall"===o)&&null==n)return;"access"===o||"optionalAccess"===o?(t=n,n=s(n)):"call"!==o&&"optionalCall"!==o||(n=s(((...e)=>n.call(t,...e))),t=void 0)}return n}([t,"access",e=>e[n],"optionalAccess",e=>e.answer])||"";return`<span data-type="math_templated" data-index="${n}" data-value="${a}"></span>`})):"",U=e,V=t,{withStyles:J}=a,{Typography:Q}=n,{Select:X}=n,{MenuItem:ee}=n,{Tooltip:te}=n,{Info:ne}=o,{cloneDeep:ae}=i,{pick:oe}=i,{throttle:se}=i,{InputContainer:ie}=p,{settings:le}=p,{layout:re}=p,{dropdown:pe}=p,de=d,{ALL_PLUGINS:ce}=d;function he(e){let t,n=e[0],a=1;for(;a<e.length;){const o=e[a],s=e[a+1];if(a+=2,("optionalAccess"===o||"optionalCall"===o)&&null==n)return;"access"===o||"optionalAccess"===o?(t=n,n=s(n)):"call"!==o&&"optionalCall"!==o||(n=s(((...e)=>n.call(t,...e))),t=void 0)}return n}const{Panel:ue,toggle:ge}=le;class me extends U.Component{constructor(...e){super(...e),me.prototype.__init.call(this),me.prototype.__init2.call(this),me.prototype.__init3.call(this),me.prototype.__init4.call(this),me.prototype.__init5.call(this),me.prototype.__init6.call(this),me.prototype.__init7.call(this),me.prototype.__init8.call(this),me.prototype.__init9.call(this)}static __initStatic(){this.propTypes={model:V.object.isRequired,configuration:V.object.isRequired,classes:V.object.isRequired,onModelChanged:V.func.isRequired,onConfigurationChanged:V.func.isRequired,imageSupport:V.shape({add:V.func.isRequired,delete:V.func.isRequired}),uploadSoundSupport:V.object}}__init(){this.state={}}componentDidMount(){const{model:{slateMarkup:e}}=this.props;this.setState({markup:e})}__init2(){this.handleChange=(e,t)=>{const{onModelChanged:n,model:a}=this.props,o=ae(a);o[e]=t,n(o)}}__init3(){this.onResponseChange=(e,t)=>{const{model:n,onModelChanged:a}=this.props,o={...n};o.responses[t]=e,a(o)}}__init4(){this.onResponseDone=()=>{const{model:e,onModelChanged:t}=this.props;t({...e,slateMarkup:G(e.markup,e.responses)})}}__init5(){this.onChangeResponse=(e,t)=>{const{model:n,onModelChanged:a}=this.props,{responses:o}=n;o[e]?o[e][0].answer=t||"":o[e]=[{answer:t||"",id:"response"+e,allowSpaces:!0}],a({...n,responses:o})}}__init6(){this.onResponsesChanged=e=>{this.props.onModelChanged({...this.props.model,responses:e})}}__init7(){this.onChange=e=>{const{model:{responses:t,validationDefault:n,allowTrailingZerosDefault:a,ignoreOrderDefault:o},onModelChanged:s}=this.props,i={},l=(e=>{const t=document.createElement("div");return t.innerHTML=e.trim(),t})(e);l.querySelectorAll('[data-type="math_templated"]').forEach(((e,s)=>{const{value:l,index:r}=e.dataset;l||(e.dataset.value=""),i[s]=t[r]||{allowSpaces:!0,validation:n||"symbolic",allowTrailingZeros:a||!1,ignoreOrder:o||!1,answer:"",alternates:{}},e.dataset.index=s.toString()})),console.log("newResponses",i);const r=F(e);this.setState({cachedResponses:void 0},(()=>s({...this.props.model,slateMarkup:l.innerHTML,responses:i,markup:r})))}}__init8(){this.onHandleAreaChange=se((e=>{const{model:{responses:t},onModelChanged:n}=this.props,{cachedResponses:a}=this.state;if(!e)return;const o=t?ae(t):{},s=a?ae(a):{};e.forEach((e=>{const t=e.data.get("index");!o[t]&&s[t]?(Object.assign(o,oe(s,t)),s.hasOwnProperty(t)&&delete s[t]):(Object.assign(s,oe(o,t)),o.hasOwnProperty(t)&&delete o[t])})),this.setState({cachedResponses:s},(()=>n({...this.props.model,responses:o})))}),500,{trailing:!1,leading:!0})}__init9(){this.onBlur=e=>{const{relatedTarget:t,currentTarget:n}=e||{},a=function e(t,n=0){if(!t||n>=16)return null;const a=t.offsetParent;return a?"tooltip"===a.getAttribute("role")?a:e(a,n+1):null}(t),o=a?function e(t,n=0){if(!t||n>=4)return null;const a=he([t,"optionalAccess",e=>e.children,"optionalAccess",e=>e[0]]);return a?a.attributes&&a.attributes["data-keypad"]?a:e(a,n+1):null}(a):null;t&&n&&he([o,"optionalAccess",e=>e.attributes,"access",e=>e["data-keypad"]])||this.setState({activeAnswerBlock:""})}}render(){const{classes:e,configuration:t,imageSupport:n,model:a,onConfigurationChanged:o,onModelChanged:s,uploadSoundSupport:i}=this.props,{baseInputConfiguration:l={},contentDimensions:r={},prompt:p={},rationale:d={},settingsPanelDisabled:c,teacherInstructions:h={},language:u={},languageChoices:g={},spellCheck:m={},playerSpellCheck:b={},maxImageWidth:_={},maxImageHeight:C={},mathMlOptions:y={},template:E={},editSource:f={},ignoreOrder:S={},allowTrailingZeros:v={},partialScoring:w={},maxResponseAreas:x}=t||{},{errors:A,extraCSSRules:T,promptEnabled:I,rationaleEnabled:k,spellCheckEnabled:R,teacherInstructionsEnabled:M,toolbarEditorPosition:N,responses:O,equationEditor:P}=a||{},{prompt:K,rationale:D,responseAreas:q,teacherInstructions:j,responses:B={}}=A||{},L=(e=>{const{maxResponseAreas:t}=e;return"Validation requirements:\nCorrect answers should not be blank.\nEach answer defined for a response area should be unique.\nThere should be at least 1 "+(t?`and at most ${t} `:"")+"response area"+(t?"s":"")+" defined."})(t),Z={"language.enabled":u.settings&&ge(u.label,!0),language:u.settings&&u.enabled&&pe(g.label,g.options)},$={teacherInstructionsEnabled:h.settings&&ge(h.label),rationaleEnabled:d.settings&&ge(d.label),promptEnabled:p.settings&&ge(p.label),spellCheckEnabled:m.settings&&ge(m.label),playerSpellCheckEnabled:b.settings&&ge(b.label),"editSource.enabled":he([f,"optionalAccess",e=>e.settings])&&ge(f.label,!0),partialScoring:w.settings&&ge(w.label)},W=_&&_.prompt,z=C&&C.prompt,F={position:"top"===N?"top":"bottom"},Y=(e={},t={})=>({...t,...e});return U.createElement(re.ConfigLayout,{extraCSSRules:T,dimensions:r,hideSettings:c,settings:U.createElement(ue,{model:a,configuration:t,onChangeModel:e=>s(e),onChangeConfiguration:o,groups:{Settings:Z,Properties:$}})},M&&U.createElement(ie,{label:h.label,className:e.promptHolder},U.createElement(de,{className:e.prompt,markup:a.teacherInstructions||"",onChange:e=>this.handleChange("teacherInstructions",e),imageSupport:n,nonEmpty:!1,error:j,toolbarOpts:F,pluginProps:Y(he([h,"optionalAccess",e=>e.inputConfiguration]),l),spellCheck:R,maxImageWidth:_&&_.teacherInstructions||W,maxImageHeight:C&&C.teacherInstructions||z,uploadSoundSupport:i,languageCharactersProps:[{language:"spanish"},{language:"special"}],mathMlOptions:y}),j&&U.createElement("div",{className:e.errorText},j)),I&&U.createElement(ie,{label:p.label,className:e.promptHolder},U.createElement(de,{className:e.prompt,markup:a.prompt,onChange:e=>this.handleChange("prompt",e),imageSupport:n,nonEmpty:!1,disableUnderline:!0,error:K,toolbarOpts:F,pluginProps:Y(he([h,"optionalAccess",e=>e.inputConfiguration]),l),spellCheck:R,maxImageWidth:W,maxImageHeight:z,uploadSoundSupport:i,languageCharactersProps:[{language:"spanish"},{language:"special"}],mathMlOptions:y}),K&&U.createElement("div",{className:e.errorText},K)),U.createElement("div",{className:e.tooltipContainer},U.createElement(Q,{className:e.title,component:"div"},"Response Template"),U.createElement(te,{classes:{tooltip:e.tooltip},disableFocusListener:!0,disableTouchListener:!0,placement:"right",title:L},U.createElement(ne,{fontSize:"small",color:"primary"}))),U.createElement(de,{activePlugins:ce,toolbarOpts:{position:"top"},spellCheck:R,pluginProps:Y(he([E,"optionalAccess",e=>e.inputConfiguration]),l),responseAreaProps:{type:"math-templated",respAreaToolbar:null,error:()=>B,onHandleAreaChange:this.onHandleAreaChange,maxResponseAreas:x},className:e.markup,markup:a.slateMarkup,onChange:this.onChange,imageSupport:n,disableImageAlignmentButtons:!0,onBlur:this.onBlur,disabled:!1,highlightShape:!1,error:q,uploadSoundSupport:i,languageCharactersProps:[{language:"spanish"},{language:"special"}],mathMlOptions:y}),q&&U.createElement("div",{className:e.responseAreaError},q),U.createElement(Q,{className:e.title},"Define Response"),U.createElement(ie,{label:"Response Template Equation Editor",className:e.selectContainer},U.createElement(X,{className:e.select,onChange:e=>this.handleChange("equationEditor",e.target.value),value:P},U.createElement(ee,{value:"non-negative-integers"},"Numeric - Non-Negative Integers"),U.createElement(ee,{value:"integers"},"Numeric - Integers"),U.createElement(ee,{value:"decimals"},"Numeric - Decimals"),U.createElement(ee,{value:"fractions"},"Numeric - Fractions"),U.createElement(ee,{value:1},"Grade 1 - 2"),U.createElement(ee,{value:3},"Grade 3 - 5"),U.createElement(ee,{value:6},"Grade 6 - 7"),U.createElement(ee,{value:8},"Grade 8 - HS"),U.createElement(ee,{value:"geometry"},"Geometry"),U.createElement(ee,{value:"advanced-algebra"},"Advanced Algebra"),U.createElement(ee,{value:"statistics"},"Statistics"),U.createElement(ee,{value:"item-authoring"},"Item Authoring"))),Object.keys(O||{}).map(((e,t)=>{const n=O[t];return n?U.createElement(H,{key:t,responseKey:t,mode:P,response:n,onResponseChange:this.onResponseChange,onResponseDone:this.onResponseDone,index:t,cIgnoreOrder:S,cAllowTrailingZeros:v,error:B&&B[t]}):null})),k&&U.createElement(ie,{label:d.label,className:e.promptHolder},U.createElement(de,{className:e.prompt,markup:a.rationale||"",onChange:e=>this.handleChange("rationale",e),imageSupport:n,nonEmpty:!1,error:D,toolbarOpts:F,pluginProps:Y(he([d,"optionalAccess",e=>e.inputConfiguration]),{...l,math:{controlledKeypadMode:!1}}),spellCheck:R,maxImageWidth:_&&_.rationale||W,maxImageHeight:C&&C.rationale||z,uploadSoundSupport:i,languageCharactersProps:[{language:"spanish"},{language:"special"}],mathMlOptions:y}),D&&U.createElement("div",{className:e.errorText},D)))}}me.__initStatic();var be=J((e=>({promptHolder:{width:"100%",paddingTop:2*e.spacing.unit,marginBottom:2*e.spacing.unit},prompt:{width:"100%"},errorText:{color:e.palette.error.main,fontSize:"0.75rem",marginTop:e.spacing.unit},responseAreaError:{color:e.palette.error.main,fontSize:"0.75rem",marginBottom:e.spacing.unit},markup:{width:"100%",marginTop:2*e.spacing.unit,marginBottom:3*e.spacing.unit},selectContainer:{width:"100%",marginTop:2*e.spacing.unit},select:{width:"100%"},title:{fontSize:1.25*e.typography.fontSize,fontWeight:"bold"},tooltipContainer:{display:"flex",alignItems:"center",gap:"8px"},tooltip:{fontSize:e.typography.fontSize-2,whiteSpace:"pre",maxWidth:"500px"}})))(me),_e={allowTrailingZerosDefault:!1,equationEditor:"8",ignoreOrderDefault:!1,markup:"",playerSpellCheckEnabled:!0,prompt:"",promptEnabled:!0,rationale:"",rationaleEnabled:!0,responses:{},spellCheckEnabled:!0,teacherInstructions:"",teacherInstructionsEnabled:!0,toolbarEditorPosition:"bottom",validationDefault:"literal"},Ce={ignoreOrder:{settings:!1,label:"Ignore Order",enabled:!0},allowTrailingZeros:{settings:!1,label:"Allow Trailing Zeros",enabled:!0},partialScoring:{settings:!0,label:"Allow Partial Scoring"},baseInputConfiguration:{html:{disabled:!0},audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1},h3:{disabled:!0},blockquote:{disabled:!0},textAlign:{disabled:!0},showParagraphs:{disabled:!1},separateParagraphs:{disabled:!0}},prompt:{label:"Prompt",settings:!0,inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1}},required:!1},spellCheck:{label:"Spellcheck",settings:!1,enabled:!0},editSource:{label:"Edit Source",settings:!1,enabled:!1},playerSpellCheck:{label:"Student Spellcheck",settings:!0,enabled:!0},teacherInstructions:{settings:!0,label:"Teacher Instructions",inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1}},required:!1},rationale:{settings:!0,label:"Rationale",inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1}},required:!1},template:{inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1}}},maxImageWidth:{teacherInstructions:300,prompt:300,rationale:300},maxImageHeight:{teacherInstructions:300,prompt:300,rationale:300},mathMlOptions:{mmlOutput:!1,mmlEditing:!1},language:{settings:!1,label:"Specify Language",enabled:!1},languageChoices:{label:"Language Choices",options:[]},maxResponseAreas:10};const ye=e,Ee=r,fe=l,{defaults:Se}=i,{isArray:ve}=i;function we(e){let t,n=e[0],a=1;for(;a<e.length;){const o=e[a],s=e[a+1];if(a+=2,("optionalAccess"===o||"optionalCall"===o)&&null==n)return;"access"===o||"optionalAccess"===o?(t=n,n=s(n)):"call"!==o&&"optionalCall"!==o||(n=s(((...e)=>n.call(t,...e))),t=void 0)}return n}const xe=fe("math-templated:configure");class Ae extends HTMLElement{static __initStatic(){this.prepareModel=(e={})=>{const{validationDefault:t,allowTrailingZerosDefault:n,ignoreOrderDefault:a,responses:o={}}=e,s=Object.keys(o).reduce(((e,s)=>{const i=o[s];return e[s]={...i,validation:i.validation||t,allowTrailingZeros:i.allowTrailingZeros||n,ignoreOrder:i.ignoreOrder||a},e}),{}),i={..._e,...e,responses:s},l=i.slateMarkup||G(i.markup,i.responses),r=F(l);return i.responses&&Object.keys(i.responses).forEach((e=>{ve(i.responses[e])&&(i.responses[e]=(i.responses[e]||[]).map(((e,t)=>e.answer?e:(xe('Choice does not contain "answer" property, which is required.',e),{answer:`${t}`,...e}))))})),{...i,slateMarkup:l,markup:r}}}constructor(){super(),this._model=Ae.prepareModel(),this._configuration=Ce,this.onModelChanged=this.onModelChanged.bind(this),this.onConfigurationChanged=this.onConfigurationChanged.bind(this)}set model(e){this._model=Ae.prepareModel(e),this._render()}set configuration(e){this._configuration=Se(e,Ce),we([e,"access",e=>e.language,"optionalAccess",e=>e.enabled])?we([e,"access",e=>e.languageChoices,"optionalAccess",e=>e.options,"optionalAccess",e=>e.length])&&(this._model.language=e.languageChoices.options[0].value):e.language.settings&&this._model.language?(this._configuration.language.enabled=!0,this._configuration.languageChoices.options&&this._configuration.languageChoices.options.length||(this._configuration.languageChoices.options=[]),this._configuration.languageChoices.options.find((e=>e.value===this._model.language))||this._configuration.languageChoices.options.push({value:this._model.language,label:this._model.language})):delete this._model.language,this._render()}set disableSidePanel(e){this._disableSidePanel=e,this._render()}dispatchModelUpdated(e){const t=!!e;this.dispatchEvent(new g(this._model,t))}onModelChanged(e,t){this._model=Ae.prepareModel(e),this._render(),this.dispatchModelUpdated(t)}onConfigurationChanged(e){this._configuration=e,this._render()}insertImage(e){this.dispatchEvent(new C(e))}onDeleteImage(e,t){this.dispatchEvent(new b(e,t))}insertSound(e){this.dispatchEvent(new S(e))}onDeleteSound(e,t){this.dispatchEvent(new E(e,t))}_render(){xe("_render");let e=ye.createElement(be,{model:this._model,configuration:this._configuration,onModelChanged:this.onModelChanged,onConfigurationChanged:this.onConfigurationChanged,disableSidePanel:this._disableSidePanel,imageSupport:{add:this.insertImage.bind(this),delete:this.onDeleteImage.bind(this)},uploadSoundSupport:{add:this.insertSound.bind(this),delete:this.onDeleteSound.bind(this)}});Ee.render(e,this)}}Ae.__initStatic();export{Ae as default};
1
+ import{_dll_react as e,_dll_prop_types as t,_dll_material_ui__core as n,_dll_material_ui__core_styles as a,_dll_material_ui__icons as o,_dll_pie_lib__render_ui as s,_dll_lodash as i,_dll_debug as l,_dll_react_dom as r}from"../../../@pie-lib/shared-module@^1.17.0/module/index.js";import{_dll_pie_lib__config_ui as p}from"../../../@pie-lib/config-module@^2.22.0/module/index.js";import{_dll_pie_lib__editable_html as d}from"../../../@pie-lib/editable-html-module@^5.9.0/module/index.js";import{_dll_pie_lib__math_toolbar as c}from"../../../@pie-lib/math-edit-module@^2.8.0/module/index.js";var h={};Object.defineProperty(h,"__esModule",{value:!0});class u extends CustomEvent{constructor(e,t=!1){super(u.TYPE,{bubbles:!0,detail:{update:e,reset:t}}),this.update=e,this.reset=t}}u.TYPE="model.updated";var g=h.ModelUpdatedEvent=u;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.image";var b=h.DeleteImageEvent=m;class _ extends CustomEvent{constructor(e){super(_.TYPE,{bubbles:!0,detail:e}),this.handler=e}}_.TYPE="insert.image";var C=h.InsertImageEvent=_;class y extends CustomEvent{constructor(e,t){super(y.TYPE,{bubbles:!0,detail:{src:e,done:t}}),this.src=e,this.done=t}}y.TYPE="delete.sound";var E=h.DeleteSoundEvent=y;class f extends CustomEvent{constructor(e){super(f.TYPE,{bubbles:!0,detail:e}),this.handler=e}}f.TYPE="insert.sound";var S=h.InsertSoundEvent=f;const v=e,w=t,{Card:x}=n,{CardContent:A}=n,{Button:T}=n,{FormControlLabel:I}=n,{Typography:k}=n,{InputLabel:R}=n,{Checkbox:M}=n,{Select:N}=n,{MenuItem:O}=n,{IconButton:P}=n,{withStyles:K}=a,{Delete:D}=o,{color:q}=s,{InputContainer:j}=p,{MathToolbar:B}=c;class L extends v.Component{static __initStatic(){this.propTypes={classes:w.object.isRequired,defaultResponse:w.bool,error:w.object,mode:w.oneOfType([w.string,w.number]),onResponseChange:w.func.isRequired,onResponseDone:w.func.isRequired,response:w.object.isRequired,cIgnoreOrder:w.object.isRequired,cAllowTrailingZeros:w.object.isRequired,responseKey:w.number.isRequired}}static __initStatic2(){this.defaultProps={defaultResponse:!1,mode:"8"}}constructor(e){super(e),L.prototype.__init.call(this),L.prototype.__init2.call(this),L.prototype.__init3.call(this),L.prototype.__init4.call(this),L.prototype.__init5.call(this),L.prototype.__init6.call(this),L.prototype.__init7.call(this),L.prototype.__init8.call(this),L.prototype.__init9.call(this),L.prototype.__init10.call(this),L.prototype.__init11.call(this);const{response:{alternates:t}={}}=e||{},n=Object.keys(t||{}).length;this.state={alternateIdCounter:n+1,showKeypad:{openCount:0,main:!1}}}__init(){this.onChange=e=>t=>{const{response:n,onResponseChange:a,responseKey:o}=this.props,s={...n};s[e]=t.target.value,a(s,o)}}__init2(){this.onConfigChanged=e=>t=>{const{response:n,onResponseChange:a,responseKey:o}=this.props,s={...n};s[e]=t.target.checked,a(s,o)}}__init3(){this.onLiteralOptionsChange=e=>()=>{const{response:t,onResponseChange:n,responseKey:a}=this.props,o={...t};o[e]=!t[e],n(o,a)}}__init4(){this.onAnswerChange=e=>{const{response:t,onResponseChange:n,responseKey:a}=this.props,o={...t};o.answer=e,n(o,a)}}__init5(){this.onAlternateAnswerChange=e=>t=>{const{response:n,onResponseChange:a,responseKey:o}=this.props,s={...n};s.alternates[e]=t,a(s,o)}}__init6(){this.onAddAlternate=()=>{const{response:e,onResponseChange:t,responseKey:n}=this.props,{alternateIdCounter:a}=this.state,o={...e};o.alternates||(o.alternates={}),o.alternates[a]="",t(o,n),this.setState({alternateIdCounter:a+1})}}__init7(){this.onRemoveAlternate=e=>()=>{const{response:t,onResponseChange:n,responseKey:a}=this.props,o={...t};delete o.alternates[e],n(o,a),this.setState((t=>({showKeypad:{...t.showKeypad,openCount:t.showKeypad[e]?t.showKeypad.openCount-1:t.showKeypad.openCount}})))}}__init8(){this.onDone=()=>{const{onResponseDone:e}=this.props;this.setState((e=>({showKeypad:{...e.showKeypad,openCount:e.showKeypad.openCount-1,main:!1}}))),e()}}__init9(){this.onFocus=()=>{this.setState((e=>({showKeypad:{...e.showKeypad,openCount:e.showKeypad.main?e.showKeypad.openCount:e.showKeypad.openCount+1,main:!0}})))}}__init10(){this.onAlternateFocus=e=>()=>{this.setState((t=>({showKeypad:{...t.showKeypad,openCount:t.showKeypad[e]?t.showKeypad.openCount:t.showKeypad.openCount+1,[e]:!0}})))}}__init11(){this.onAlternateDone=e=>()=>{this.setState((t=>({showKeypad:{...t.showKeypad,openCount:t.showKeypad.openCount-1,[e]:!1}})))}}render(){const{classes:e,mode:t,responseKey:n,response:a,cAllowTrailingZeros:o,cIgnoreOrder:s,error:i}=this.props,{showKeypad:l}=this.state,{validation:r,answer:p,alternates:d,ignoreOrder:c,allowTrailingZeros:h}=a,u=Object.keys(d||{}).length>0,g={editor:e.responseEditor,mathToolbar:e.mathToolbar},m={minHeight:(l.openCount>0?430:230)+"px"},b=`R ${parseInt(n)+1}`;return v.createElement(x,{className:e.responseContainer,style:m},v.createElement(A,{className:e.cardContent},v.createElement("div",{className:e.titleBar},v.createElement(k,{className:e.title,component:"div"},"Response for ",v.createElement("div",{className:e.responseBox},b)),v.createElement(j,{label:"Validation",className:e.selectContainer},v.createElement(N,{className:e.select,onChange:this.onChange("validation"),value:r||"literal"},v.createElement(O,{value:"literal"},"Literal Validation"),v.createElement(O,{value:"symbolic"},"Symbolic Validation")))),"literal"===r&&v.createElement("div",{className:e.flexContainer},o.enabled&&v.createElement(I,{label:o.label,control:v.createElement(M,{className:e.customColor,checked:h,onChange:this.onLiteralOptionsChange("allowTrailingZeros")})}),s.enabled&&v.createElement(I,{label:s.label,control:v.createElement(M,{className:e.customColor,checked:c,onChange:this.onLiteralOptionsChange("ignoreOrder")})})),v.createElement("div",{className:e.inputContainer},v.createElement(R,null,"Correct Answer"),v.createElement(B,{keypadMode:t,classNames:g,controlledKeypad:!0,showKeypad:l.main,latex:p||"",onChange:this.onAnswerChange,onFocus:this.onFocus,onDone:this.onDone,error:i&&i.answer}),i&&i.answer?v.createElement("div",{className:e.errorText},i.answer):null),u&&Object.keys(d).map(((n,a)=>v.createElement("div",{className:e.inputContainer,key:n},v.createElement(R,null,"Alternate",Object.keys(d).length>1?` ${a+1}`:""),v.createElement("div",{className:e.alternateBar},v.createElement(B,{classNames:g,controlledKeypad:!0,keypadMode:t,showKeypad:l[n]||!1,latex:d[n]||"",onChange:this.onAlternateAnswerChange(n),onFocus:this.onAlternateFocus(n),onDone:this.onAlternateDone(n),error:i&&i[n]}),v.createElement(P,{className:e.removeAlternateButton,onClick:this.onRemoveAlternate(n)},v.createElement(D,null))),i&&i[n]?v.createElement("div",{className:e.errorText},i[n]):null))),v.createElement(T,{className:e.alternateButton,type:"primary",onClick:this.onAddAlternate},"ADD ALTERNATE")))}}L.__initStatic(),L.__initStatic2();var H=K((e=>({responseContainer:{marginBottom:2.5*e.spacing.unit,width:"100%",minWidth:"548px",border:`1px solid ${e.palette.grey[700]}`,display:"flex",flexDirection:"column",justifyContent:"space-between"},cardContent:{paddingBottom:2*e.spacing.unit+"px !important"},title:{fontWeight:700,fontSize:"1.2rem",flex:3},selectContainer:{flex:2},inputContainer:{marginBottom:2*e.spacing.unit},titleBar:{display:"flex",alignItems:"center",justifyContent:"space-between"},responseEditor:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",minWidth:"500px",maxWidth:"900px",height:"auto",minHeight:"40px"},mathToolbar:{width:"100%"},alternateButton:{border:`1px solid ${e.palette.grey.A100}`},removeAlternateButton:{marginLeft:e.spacing.unit},errorText:{fontSize:e.typography.fontSize-2,color:e.palette.error.main,paddingTop:e.spacing.unit},responseBox:{background:e.palette.grey.A100,color:e.palette.grey.A700,display:"inline",minWidth:"50px",padding:"8px",border:"1px solid #C0C3CF"},alternateBar:{display:"flex",justifyContent:"space-between",alignItems:"center"},customColor:{color:`${q.tertiary()} !important`}})))(L);const Z="imes|riangle|an|heta|herefore",$="throot|parallel|cong|approx|eq|e|sim",W=new RegExp(`(\\t(?!${Z}))|(\\n(?!${$}))|(\\\\t(?!${Z}))|(\\\\n(?!${$}))`,"g"),z=e=>e.replace(W,"").replace(/\\"/g,'"').replace(/\\\//g,"/"),F=e=>{const t=((e="")=>{const t=document.createElement("div");return t.innerHTML=e.trim(),t})(z(e||"")||"");return t.querySelectorAll('[data-type="math_templated"]').forEach((e=>e.replaceWith(`{{${e.dataset.index}}}`))),t.innerHTML},Y=/\{\{(\d+)\}\}/g,G=(e,t)=>e?z(e).replace(Y,((e,n)=>{const a=function(e){let t,n=e[0],a=1;for(;a<e.length;){const o=e[a],s=e[a+1];if(a+=2,("optionalAccess"===o||"optionalCall"===o)&&null==n)return;"access"===o||"optionalAccess"===o?(t=n,n=s(n)):"call"!==o&&"optionalCall"!==o||(n=s(((...e)=>n.call(t,...e))),t=void 0)}return n}([t,"access",e=>e[n],"optionalAccess",e=>e.answer])||"";return`<span data-type="math_templated" data-index="${n}" data-value="${a}"></span>`})):"",U=e,V=t,{withStyles:J}=a,{Typography:Q}=n,{Select:X}=n,{MenuItem:ee}=n,{Tooltip:te}=n,{Info:ne}=o,{cloneDeep:ae}=i,{pick:oe}=i,{throttle:se}=i,{InputContainer:ie}=p,{settings:le}=p,{layout:re}=p,{dropdown:pe}=p,de=d,{ALL_PLUGINS:ce}=d;function he(e){let t,n=e[0],a=1;for(;a<e.length;){const o=e[a],s=e[a+1];if(a+=2,("optionalAccess"===o||"optionalCall"===o)&&null==n)return;"access"===o||"optionalAccess"===o?(t=n,n=s(n)):"call"!==o&&"optionalCall"!==o||(n=s(((...e)=>n.call(t,...e))),t=void 0)}return n}const{Panel:ue,toggle:ge}=le;class me extends U.Component{constructor(...e){super(...e),me.prototype.__init.call(this),me.prototype.__init2.call(this),me.prototype.__init3.call(this),me.prototype.__init4.call(this),me.prototype.__init5.call(this),me.prototype.__init6.call(this),me.prototype.__init7.call(this),me.prototype.__init8.call(this),me.prototype.__init9.call(this)}static __initStatic(){this.propTypes={model:V.object.isRequired,configuration:V.object.isRequired,classes:V.object.isRequired,onModelChanged:V.func.isRequired,onConfigurationChanged:V.func.isRequired,imageSupport:V.shape({add:V.func.isRequired,delete:V.func.isRequired}),uploadSoundSupport:V.object}}__init(){this.state={}}componentDidMount(){const{model:{slateMarkup:e}}=this.props;this.setState({markup:e})}__init2(){this.handleChange=(e,t)=>{const{onModelChanged:n,model:a}=this.props,o=ae(a);o[e]=t,n(o)}}__init3(){this.onResponseChange=(e,t)=>{const{model:n,onModelChanged:a}=this.props,o={...n};o.responses[t]=e,a(o)}}__init4(){this.onResponseDone=()=>{const{model:e,onModelChanged:t}=this.props;t({...e,slateMarkup:G(e.markup,e.responses)})}}__init5(){this.onChangeResponse=(e,t)=>{const{model:n,onModelChanged:a}=this.props,{responses:o}=n;o[e]?o[e][0].answer=t||"":o[e]=[{answer:t||"",id:"response"+e,allowSpaces:!0}],a({...n,responses:o})}}__init6(){this.onResponsesChanged=e=>{this.props.onModelChanged({...this.props.model,responses:e})}}__init7(){this.onChange=e=>{const{model:{responses:t,validationDefault:n,allowTrailingZerosDefault:a,ignoreOrderDefault:o},onModelChanged:s}=this.props,i={},l=(e=>{const t=document.createElement("div");return t.innerHTML=e.trim(),t})(e);l.querySelectorAll('[data-type="math_templated"]').forEach(((e,s)=>{const{value:l,index:r}=e.dataset;l||(e.dataset.value=""),i[s]=t[r]||{allowSpaces:!0,validation:n||"symbolic",allowTrailingZeros:a||!1,ignoreOrder:o||!1,answer:"",alternates:{}},e.dataset.index=s.toString()})),console.log("newResponses",i);const r=F(e);this.setState({cachedResponses:void 0},(()=>s({...this.props.model,slateMarkup:l.innerHTML,responses:i,markup:r})))}}__init8(){this.onHandleAreaChange=se((e=>{const{model:{responses:t},onModelChanged:n}=this.props,{cachedResponses:a}=this.state;if(!e)return;const o=t?ae(t):{},s=a?ae(a):{};e.forEach((e=>{const t=e.data.get("index");!o[t]&&s[t]?(Object.assign(o,oe(s,t)),s.hasOwnProperty(t)&&delete s[t]):(Object.assign(s,oe(o,t)),o.hasOwnProperty(t)&&delete o[t])})),this.setState({cachedResponses:s},(()=>n({...this.props.model,responses:o})))}),500,{trailing:!1,leading:!0})}__init9(){this.onBlur=e=>{const{relatedTarget:t,currentTarget:n}=e||{},a=function e(t,n=0){if(!t||n>=16)return null;const a=t.offsetParent;return a?"tooltip"===a.getAttribute("role")?a:e(a,n+1):null}(t),o=a?function e(t,n=0){if(!t||n>=4)return null;const a=he([t,"optionalAccess",e=>e.children,"optionalAccess",e=>e[0]]);return a?a.attributes&&a.attributes["data-keypad"]?a:e(a,n+1):null}(a):null;t&&n&&he([o,"optionalAccess",e=>e.attributes,"access",e=>e["data-keypad"]])||this.setState({activeAnswerBlock:""})}}render(){const{classes:e,configuration:t,imageSupport:n,model:a,onConfigurationChanged:o,onModelChanged:s,uploadSoundSupport:i}=this.props,{baseInputConfiguration:l={},contentDimensions:r={},prompt:p={},rationale:d={},settingsPanelDisabled:c,teacherInstructions:h={},language:u={},languageChoices:g={},spellCheck:m={},playerSpellCheck:b={},maxImageWidth:_={},maxImageHeight:C={},mathMlOptions:y={},template:E={},editSource:f={},ignoreOrder:S={},allowTrailingZeros:v={},partialScoring:w={},maxResponseAreas:x}=t||{},{errors:A,extraCSSRules:T,promptEnabled:I,rationaleEnabled:k,spellCheckEnabled:R,teacherInstructionsEnabled:M,toolbarEditorPosition:N,responses:O,equationEditor:P}=a||{},{prompt:K,rationale:D,responseAreas:q,teacherInstructions:j,responses:B={}}=A||{},L=(e=>{const{maxResponseAreas:t}=e;return"Validation requirements:\nCorrect answers should not be blank.\nEach answer defined for a response area should be unique.\nThere should be at least 1 "+(t?`and at most ${t} `:"")+"response area"+(t?"s":"")+" defined."})(t),Z={"language.enabled":u.settings&&ge(u.label,!0),language:u.settings&&u.enabled&&pe(g.label,g.options)},$={teacherInstructionsEnabled:h.settings&&ge(h.label),rationaleEnabled:d.settings&&ge(d.label),promptEnabled:p.settings&&ge(p.label),spellCheckEnabled:m.settings&&ge(m.label),playerSpellCheckEnabled:b.settings&&ge(b.label),"editSource.enabled":he([f,"optionalAccess",e=>e.settings])&&ge(f.label,!0),partialScoring:w.settings&&ge(w.label)},W=_&&_.prompt,z=C&&C.prompt,F={position:"top"===N?"top":"bottom"},Y=(e={},t={})=>({...t,...e});return U.createElement(re.ConfigLayout,{extraCSSRules:T,dimensions:r,hideSettings:c,settings:U.createElement(ue,{model:a,configuration:t,onChangeModel:e=>s(e),onChangeConfiguration:o,groups:{Settings:Z,Properties:$}})},M&&U.createElement(ie,{label:h.label,className:e.promptHolder},U.createElement(de,{className:e.prompt,markup:a.teacherInstructions||"",onChange:e=>this.handleChange("teacherInstructions",e),imageSupport:n,nonEmpty:!1,error:j,toolbarOpts:F,pluginProps:Y(he([h,"optionalAccess",e=>e.inputConfiguration]),l),spellCheck:R,maxImageWidth:_&&_.teacherInstructions||W,maxImageHeight:C&&C.teacherInstructions||z,uploadSoundSupport:i,languageCharactersProps:[{language:"spanish"},{language:"special"}],mathMlOptions:y}),j&&U.createElement("div",{className:e.errorText},j)),I&&U.createElement(ie,{label:p.label,className:e.promptHolder},U.createElement(de,{className:e.prompt,markup:a.prompt,onChange:e=>this.handleChange("prompt",e),imageSupport:n,nonEmpty:!1,disableUnderline:!0,error:K,toolbarOpts:F,pluginProps:Y(he([h,"optionalAccess",e=>e.inputConfiguration]),l),spellCheck:R,maxImageWidth:W,maxImageHeight:z,uploadSoundSupport:i,languageCharactersProps:[{language:"spanish"},{language:"special"}],mathMlOptions:y}),K&&U.createElement("div",{className:e.errorText},K)),U.createElement("div",{className:e.tooltipContainer},U.createElement(Q,{className:e.title,component:"div"},"Response Template"),U.createElement(te,{classes:{tooltip:e.tooltip},disableFocusListener:!0,disableTouchListener:!0,placement:"right",title:L},U.createElement(ne,{fontSize:"small",color:"primary"}))),U.createElement(de,{activePlugins:ce,toolbarOpts:{position:"top"},spellCheck:R,pluginProps:Y(he([E,"optionalAccess",e=>e.inputConfiguration]),l),responseAreaProps:{type:"math-templated",respAreaToolbar:null,error:()=>B,onHandleAreaChange:this.onHandleAreaChange,maxResponseAreas:x},className:e.markup,markup:a.slateMarkup,onChange:this.onChange,imageSupport:n,disableImageAlignmentButtons:!0,onBlur:this.onBlur,disabled:!1,highlightShape:!1,error:q,uploadSoundSupport:i,languageCharactersProps:[{language:"spanish"},{language:"special"}],mathMlOptions:y}),q&&U.createElement("div",{className:e.responseAreaError},q),U.createElement(Q,{className:e.title},"Define Response"),U.createElement(ie,{label:"Response Template Equation Editor",className:e.selectContainer},U.createElement(X,{className:e.select,onChange:e=>this.handleChange("equationEditor",e.target.value),value:P},U.createElement(ee,{value:"non-negative-integers"},"Numeric - Non-Negative Integers"),U.createElement(ee,{value:"integers"},"Numeric - Integers"),U.createElement(ee,{value:"decimals"},"Numeric - Decimals"),U.createElement(ee,{value:"fractions"},"Numeric - Fractions"),U.createElement(ee,{value:1},"Grade 1 - 2"),U.createElement(ee,{value:3},"Grade 3 - 5"),U.createElement(ee,{value:6},"Grade 6 - 7"),U.createElement(ee,{value:8},"Grade 8 - HS"),U.createElement(ee,{value:"geometry"},"Geometry"),U.createElement(ee,{value:"advanced-algebra"},"Advanced Algebra"),U.createElement(ee,{value:"statistics"},"Statistics"),U.createElement(ee,{value:"item-authoring"},"Item Authoring"))),Object.keys(O||{}).map(((e,t)=>{const n=O[t];return n?U.createElement(H,{key:t,responseKey:t,mode:P,response:n,onResponseChange:this.onResponseChange,onResponseDone:this.onResponseDone,index:t,cIgnoreOrder:S,cAllowTrailingZeros:v,error:B&&B[t]}):null})),k&&U.createElement(ie,{label:d.label,className:e.promptHolder},U.createElement(de,{className:e.prompt,markup:a.rationale||"",onChange:e=>this.handleChange("rationale",e),imageSupport:n,nonEmpty:!1,error:D,toolbarOpts:F,pluginProps:Y(he([d,"optionalAccess",e=>e.inputConfiguration]),{...l,math:{controlledKeypadMode:!1}}),spellCheck:R,maxImageWidth:_&&_.rationale||W,maxImageHeight:C&&C.rationale||z,uploadSoundSupport:i,languageCharactersProps:[{language:"spanish"},{language:"special"}],mathMlOptions:y}),D&&U.createElement("div",{className:e.errorText},D)))}}me.__initStatic();var be=J((e=>({promptHolder:{width:"100%",paddingTop:2*e.spacing.unit,marginBottom:2*e.spacing.unit},prompt:{width:"100%"},errorText:{color:e.palette.error.main,fontSize:"0.75rem",marginTop:e.spacing.unit},responseAreaError:{color:e.palette.error.main,fontSize:"0.75rem",marginBottom:e.spacing.unit},markup:{width:"100%",marginTop:2*e.spacing.unit,marginBottom:3*e.spacing.unit},selectContainer:{width:"100%",marginTop:2*e.spacing.unit},select:{width:"100%"},title:{fontSize:1.25*e.typography.fontSize,fontWeight:"bold"},tooltipContainer:{display:"flex",alignItems:"center",gap:"8px"},tooltip:{fontSize:e.typography.fontSize-2,whiteSpace:"pre",maxWidth:"500px"}})))(me),_e={allowTrailingZerosDefault:!1,equationEditor:"8",ignoreOrderDefault:!1,markup:"",playerSpellCheckEnabled:!0,prompt:"",promptEnabled:!0,rationale:"",rationaleEnabled:!0,responses:{},spellCheckEnabled:!0,teacherInstructions:"",teacherInstructionsEnabled:!0,toolbarEditorPosition:"bottom",validationDefault:"literal"},Ce={ignoreOrder:{settings:!1,label:"Ignore Order",enabled:!0},allowTrailingZeros:{settings:!1,label:"Allow Trailing Zeros",enabled:!0},partialScoring:{settings:!0,label:"Allow Partial Scoring"},baseInputConfiguration:{html:{disabled:!0},audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1},h3:{disabled:!0},blockquote:{disabled:!0},textAlign:{disabled:!0},showParagraphs:{disabled:!1},separateParagraphs:{disabled:!0}},prompt:{label:"Prompt",settings:!0,inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1}},required:!1},spellCheck:{label:"Spellcheck",settings:!1,enabled:!0},editSource:{label:"Edit Source",settings:!1,enabled:!1},playerSpellCheck:{label:"Student Spellcheck",settings:!0,enabled:!0},teacherInstructions:{settings:!0,label:"Teacher Instructions",inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1}},required:!1},rationale:{settings:!0,label:"Rationale",inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1}},required:!1},template:{inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1}}},maxImageWidth:{teacherInstructions:300,prompt:300,rationale:300},maxImageHeight:{teacherInstructions:300,prompt:300,rationale:300},mathMlOptions:{mmlOutput:!1,mmlEditing:!1},language:{settings:!1,label:"Specify Language",enabled:!1},languageChoices:{label:"Language Choices",options:[]},maxResponseAreas:10};const ye=e,Ee=r,fe=l,{defaults:Se}=i,{isArray:ve}=i;function we(e){let t,n=e[0],a=1;for(;a<e.length;){const o=e[a],s=e[a+1];if(a+=2,("optionalAccess"===o||"optionalCall"===o)&&null==n)return;"access"===o||"optionalAccess"===o?(t=n,n=s(n)):"call"!==o&&"optionalCall"!==o||(n=s(((...e)=>n.call(t,...e))),t=void 0)}return n}const xe=fe("math-templated:configure");class Ae extends HTMLElement{static __initStatic(){this.prepareModel=(e={})=>{const{validationDefault:t,allowTrailingZerosDefault:n,ignoreOrderDefault:a,responses:o={}}=e,s=Object.keys(o).reduce(((e,s)=>{const i=o[s];return e[s]={...i,validation:i.validation||t,allowTrailingZeros:i.allowTrailingZeros||n,ignoreOrder:i.ignoreOrder||a},e}),{}),i={..._e,...e,responses:s},l=i.slateMarkup||G(i.markup,i.responses),r=F(l);return i.responses&&Object.keys(i.responses).forEach((e=>{ve(i.responses[e])&&(i.responses[e]=(i.responses[e]||[]).map(((e,t)=>e.answer?e:(xe('Choice does not contain "answer" property, which is required.',e),{answer:`${t}`,...e}))))})),{...i,slateMarkup:l,markup:r}}}constructor(){super(),this._model=Ae.prepareModel(),this._configuration=Ce,this.onModelChanged=this.onModelChanged.bind(this),this.onConfigurationChanged=this.onConfigurationChanged.bind(this)}set model(e){this._model=Ae.prepareModel(e),this._render()}set configuration(e){this._configuration=Se(e,Ce),we([e,"access",e=>e.language,"optionalAccess",e=>e.enabled])?we([e,"access",e=>e.languageChoices,"optionalAccess",e=>e.options,"optionalAccess",e=>e.length])&&(this._model.language=e.languageChoices.options[0].value):e.language.settings&&this._model.language?(this._configuration.language.enabled=!0,this._configuration.languageChoices.options&&this._configuration.languageChoices.options.length||(this._configuration.languageChoices.options=[]),this._configuration.languageChoices.options.find((e=>e.value===this._model.language))||this._configuration.languageChoices.options.push({value:this._model.language,label:this._model.language})):delete this._model.language,this._render()}set disableSidePanel(e){this._disableSidePanel=e,this._render()}dispatchModelUpdated(e){const t=!!e;this.dispatchEvent(new g(this._model,t))}onModelChanged(e,t){this._model=Ae.prepareModel(e),this._render(),this.dispatchModelUpdated(t)}onConfigurationChanged(e){this._configuration=e,this._render()}insertImage(e){this.dispatchEvent(new C(e))}onDeleteImage(e,t){this.dispatchEvent(new b(e,t))}insertSound(e){this.dispatchEvent(new S(e))}onDeleteSound(e,t){this.dispatchEvent(new E(e,t))}_render(){xe("_render");let e=ye.createElement(be,{model:this._model,configuration:this._configuration,onModelChanged:this.onModelChanged,onConfigurationChanged:this.onConfigurationChanged,disableSidePanel:this._disableSidePanel,imageSupport:{add:this.insertImage.bind(this),delete:this.onDeleteImage.bind(this)},uploadSoundSupport:{add:this.insertSound.bind(this),delete:this.onDeleteSound.bind(this)}});Ee.render(e,this)}}Ae.__initStatic();export{Ae as default};
@@ -1603,7 +1603,7 @@ function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) {
1603
1603
  function _createSuper$2(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$2(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
1604
1604
  function _isNativeReflectConstruct$2() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
1605
1605
  var checkedLoadedFor = {};
1606
- var Translator = function (_EventEmitter) {
1606
+ var Translator$1 = function (_EventEmitter) {
1607
1607
  _inherits(Translator, _EventEmitter);
1608
1608
  var _super = _createSuper$2(Translator);
1609
1609
  function Translator(services) {
@@ -3212,7 +3212,7 @@ var I18n = function (_EventEmitter) {
3212
3212
  s.i18nFormat = createClassOnDemand(this.modules.i18nFormat);
3213
3213
  if (s.i18nFormat.init) s.i18nFormat.init(this);
3214
3214
  }
3215
- this.translator = new Translator(this.services, this.options);
3215
+ this.translator = new Translator$1(this.services, this.options);
3216
3216
  this.translator.on('*', function (event) {
3217
3217
  for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
3218
3218
  args[_key2 - 1] = arguments[_key2];
@@ -3572,7 +3572,7 @@ var I18n = function (_EventEmitter) {
3572
3572
  clone.services.utils = {
3573
3573
  hasLoadedNamespace: clone.hasLoadedNamespace.bind(clone)
3574
3574
  };
3575
- clone.translator = new Translator(clone.services, clone.options);
3575
+ clone.translator = new Translator$1(clone.services, clone.options);
3576
3576
  clone.translator.on('*', function (event) {
3577
3577
  for (var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
3578
3578
  args[_key4 - 1] = arguments[_key4];
@@ -3623,41 +3623,26 @@ instance.hasLoadedNamespace;
3623
3623
  instance.loadNamespaces;
3624
3624
  instance.loadLanguages;
3625
3625
 
3626
- function _extends() {
3627
- _extends = Object.assign || function (target) {
3628
- for (var i = 1; i < arguments.length; i++) {
3629
- var source = arguments[i];
3630
-
3631
- for (var key in source) {
3632
- if (Object.prototype.hasOwnProperty.call(source, key)) {
3633
- target[key] = source[key];
3634
- }
3635
- }
3636
- }
3637
-
3638
- return target;
3639
- };
3640
-
3641
- return _extends.apply(this, arguments);
3642
- }
3643
-
3644
3626
  var en = {
3645
3627
  translation: {
3646
3628
  categorize: {
3647
- limitMaxChoicesPerCategory: "You've reached the limit of {{maxChoicesPerCategory}} responses per area. To add another response, one must first be removed.",
3648
- maxChoicesPerCategoryRestriction: 'To change this value to {{maxChoicesPerCategory}}, each category must have {{maxChoicesPerCategory}} or fewer answer choice[s].'
3629
+ limitMaxChoicesPerCategory:
3630
+ "You've reached the limit of {{maxChoicesPerCategory}} responses per area. To add another response, one must first be removed.",
3631
+ maxChoicesPerCategoryRestriction:
3632
+ 'To change this value to {{maxChoicesPerCategory}}, each category must have {{maxChoicesPerCategory}} or fewer answer choice[s].',
3649
3633
  },
3650
3634
  ebsr: {
3651
- part: 'Part {{index}}'
3635
+ part: 'Part {{index}}',
3652
3636
  },
3653
3637
  numberLine: {
3654
3638
  addElementLimit_one: 'You can only add {{count}} element',
3655
3639
  addElementLimit_other: 'You can only add {{count}} elements',
3656
- clearAll: 'Clear all'
3640
+ clearAll: 'Clear all',
3657
3641
  },
3658
3642
  imageClozeAssociation: {
3659
- reachedLimit_one: 'You’ve reached the limit of {{count}} response per area. To add another response, one must first be removed.',
3660
- reachedLimit_other: 'Full'
3643
+ reachedLimit_one:
3644
+ 'You’ve reached the limit of {{count}} response per area. To add another response, one must first be removed.',
3645
+ reachedLimit_other: 'Full',
3661
3646
  },
3662
3647
  drawingResponse: {
3663
3648
  fillColor: 'Fill color',
@@ -3673,7 +3658,7 @@ var en = {
3673
3658
  green: 'Green',
3674
3659
  white: 'White',
3675
3660
  black: 'Black',
3676
- onDoubleClick: 'Double click to edit this text. Press Enter to submit.'
3661
+ onDoubleClick: 'Double click to edit this text. Press Enter to submit.',
3677
3662
  },
3678
3663
  charting: {
3679
3664
  addCategory: 'Add category',
@@ -3685,8 +3670,8 @@ var en = {
3685
3670
  keyLegend: {
3686
3671
  incorrectAnswer: 'Student incorrect answer',
3687
3672
  correctAnswer: 'Student correct answer',
3688
- correctKeyAnswer: 'Answer key correct'
3689
- }
3673
+ correctKeyAnswer: 'Answer key correct',
3674
+ },
3690
3675
  },
3691
3676
  graphing: {
3692
3677
  point: 'Point',
@@ -3702,24 +3687,25 @@ var en = {
3702
3687
  vector: 'Vector',
3703
3688
  label: 'Label',
3704
3689
  redo: 'Redo',
3705
- reset: 'Reset'
3690
+ reset: 'Reset',
3706
3691
  },
3707
3692
  mathInline: {
3708
- primaryCorrectWithAlternates: 'Note: The answer shown above is the primary correct answer specified by the author for this item, but other answers may also be recognized as correct.'
3693
+ primaryCorrectWithAlternates:
3694
+ 'Note: The answer shown above is the primary correct answer specified by the author for this item, but other answers may also be recognized as correct.',
3709
3695
  },
3710
3696
  multipleChoice: {
3711
3697
  minSelections: 'Select at least {{minSelections}}.',
3712
3698
  maxSelections_one: 'Only {{maxSelections}} answer is allowed.',
3713
3699
  maxSelections_other: 'Only {{maxSelections}} answers are allowed.',
3714
3700
  minmaxSelections_equal: 'Select {{minSelections}}.',
3715
- minmaxSelections_range: 'Select between {{minSelections}} and {{maxSelections}}.'
3701
+ minmaxSelections_range: 'Select between {{minSelections}} and {{maxSelections}}.',
3716
3702
  },
3717
3703
  selectText: {
3718
3704
  correctAnswerSelected: 'Correct',
3719
3705
  correctAnswerNotSelected: 'Correct Answer Not Selected',
3720
3706
  incorrectSelection: 'Incorrect Selection',
3721
- key: 'Key'
3722
- }
3707
+ key: 'Key',
3708
+ },
3723
3709
  },
3724
3710
  common: {
3725
3711
  undo: 'Undo',
@@ -3728,31 +3714,35 @@ var en = {
3728
3714
  incorrect: 'Incorrect',
3729
3715
  showCorrectAnswer: 'Show correct answer',
3730
3716
  hideCorrectAnswer: 'Hide correct answer',
3731
- commonCorrectAnswerWithAlternates: 'Note: The answer shown above is the most common correct answer for this item. One or more additional correct answers are also defined, and will also be recognized as correct.',
3717
+ commonCorrectAnswerWithAlternates:
3718
+ 'Note: The answer shown above is the most common correct answer for this item. One or more additional correct answers are also defined, and will also be recognized as correct.',
3732
3719
  warning: 'Warning',
3733
3720
  showNote: 'Show Note',
3734
3721
  hideNote: 'Hide Note',
3735
- cancel: 'Cancel'
3736
- }
3722
+ cancel: 'Cancel',
3723
+ },
3737
3724
  };
3738
3725
 
3739
3726
  var es = {
3740
3727
  translation: {
3741
3728
  categorize: {
3742
- limitMaxChoicesPerCategory: 'Has alcanzado el límite de {{maxChoicesPerCategory}} respuestas por área. Para agregar otra respuesta, primero se debe eliminar una respuesta.',
3743
- maxChoicesPerCategoryRestriction: 'Para cambiar este valor a {{maxChoicesPerCategory}}, cada categoría debe tener {{maxChoicesPerCategory}} o menos opciones de respuesta'
3729
+ limitMaxChoicesPerCategory:
3730
+ 'Has alcanzado el límite de {{maxChoicesPerCategory}} respuestas por área. Para agregar otra respuesta, primero se debe eliminar una respuesta.',
3731
+ maxChoicesPerCategoryRestriction:
3732
+ 'Para cambiar este valor a {{maxChoicesPerCategory}}, cada categoría debe tener {{maxChoicesPerCategory}} o menos opciones de respuesta',
3744
3733
  },
3745
3734
  ebsr: {
3746
- part: 'Parte {{index}}'
3735
+ part: 'Parte {{index}}',
3747
3736
  },
3748
3737
  numberLine: {
3749
3738
  addElementLimit_one: 'Solo puedes agregar {{count}} elemento',
3750
3739
  addElementLimit_other: 'Solo puedes agregar {{count}} elementos',
3751
- clearAll: 'Borrar todo'
3740
+ clearAll: 'Borrar todo',
3752
3741
  },
3753
3742
  imageClozeAssociation: {
3754
- reachedLimit_one: 'Has alcanzado el límite de {{count}} respuesta por área. Para agregar otra respuesta, primero se debe eliminar una respuesta.',
3755
- reachedLimit_other: 'Lleno'
3743
+ reachedLimit_one:
3744
+ 'Has alcanzado el límite de {{count}} respuesta por área. Para agregar otra respuesta, primero se debe eliminar una respuesta.',
3745
+ reachedLimit_other: 'Lleno',
3756
3746
  },
3757
3747
  drawingResponse: {
3758
3748
  fillColor: 'Color de relleno',
@@ -3768,7 +3758,7 @@ var es = {
3768
3758
  green: 'Verde',
3769
3759
  white: 'Blanco',
3770
3760
  black: 'Negro',
3771
- onDoubleClick: 'Haz doble clic para revisar este texto. Presiona el botón de ingreso para enviar'
3761
+ onDoubleClick: 'Haz doble clic para revisar este texto. Presiona el botón de ingreso para enviar',
3772
3762
  },
3773
3763
  charting: {
3774
3764
  addCategory: 'Añadir categoría',
@@ -3780,8 +3770,8 @@ var es = {
3780
3770
  keyLegend: {
3781
3771
  incorrectAnswer: 'Respuesta incorrecta del estudiante',
3782
3772
  correctAnswer: 'Respuesta correcta del estudiante',
3783
- correctKeyAnswer: 'Clave de respuesta correcta'
3784
- }
3773
+ correctKeyAnswer: 'Clave de respuesta correcta',
3774
+ },
3785
3775
  },
3786
3776
  graphing: {
3787
3777
  point: 'Punto',
@@ -3797,24 +3787,25 @@ var es = {
3797
3787
  vector: 'Vector',
3798
3788
  label: 'Etiqueta',
3799
3789
  redo: 'Rehacer',
3800
- reset: 'Reiniciar'
3790
+ reset: 'Reiniciar',
3801
3791
  },
3802
3792
  mathInline: {
3803
- primaryCorrectWithAlternates: 'Nota: La respuesta que se muestra arriba es la respuesta correcta principal especificada por el autor para esta pregunta, pero también se pueden reconocer otras respuestas como correctas.'
3793
+ primaryCorrectWithAlternates:
3794
+ 'Nota: La respuesta que se muestra arriba es la respuesta correcta principal especificada por el autor para esta pregunta, pero también se pueden reconocer otras respuestas como correctas.',
3804
3795
  },
3805
3796
  multipleChoice: {
3806
3797
  minSelections: 'Seleccione al menos {{minSelections}}.',
3807
3798
  maxSelections_one: 'Sólo se permite {{maxSelections}} respuesta.',
3808
3799
  maxSelections_other: 'Sólo se permiten {{maxSelections}} respuestas.',
3809
3800
  minmaxSelections_equal: 'Seleccione {{minSelections}}.',
3810
- minmaxSelections_range: 'Seleccione entre {{minSelections}} y {{maxSelections}}.'
3801
+ minmaxSelections_range: 'Seleccione entre {{minSelections}} y {{maxSelections}}.',
3811
3802
  },
3812
3803
  selectText: {
3813
3804
  correctAnswerSelected: 'Respuesta Correcta',
3814
3805
  correctAnswerNotSelected: 'Respuesta Correcta No Seleccionada',
3815
3806
  incorrectSelection: 'Selección Incorrecta',
3816
- key: 'Clave'
3817
- }
3807
+ key: 'Clave',
3808
+ },
3818
3809
  },
3819
3810
  common: {
3820
3811
  undo: 'Deshacer',
@@ -3823,12 +3814,13 @@ var es = {
3823
3814
  incorrect: 'Incorrect',
3824
3815
  showCorrectAnswer: 'Mostrar respuesta correcta',
3825
3816
  hideCorrectAnswer: 'Ocultar respuesta correcta',
3826
- commonCorrectAnswerWithAlternates: 'Nota: La respuesta que se muestra arriba es la respuesta correcta más común para esta pregunta. También se definen una o más respuestas correctas adicionales, y también se reconocerán como correctas.',
3817
+ commonCorrectAnswerWithAlternates:
3818
+ 'Nota: La respuesta que se muestra arriba es la respuesta correcta más común para esta pregunta. También se definen una o más respuestas correctas adicionales, y también se reconocerán como correctas.',
3827
3819
  warning: 'Advertencia',
3828
3820
  showNote: 'Mostrar Nota',
3829
3821
  hideNote: 'Ocultar Nota',
3830
- cancel: 'Cancelar'
3831
- }
3822
+ cancel: 'Cancelar',
3823
+ },
3832
3824
  };
3833
3825
 
3834
3826
  instance.init({
@@ -3837,15 +3829,15 @@ instance.init({
3837
3829
  debug: true,
3838
3830
  resources: {
3839
3831
  en: en,
3840
- es: es
3841
- }
3832
+ es: es,
3833
+ },
3842
3834
  });
3843
- var index = {
3844
- translator: _extends({}, instance, {
3835
+
3836
+ var Translator = {
3837
+ translator: {
3838
+ ...instance,
3845
3839
  t: (key, options) => {
3846
- const {
3847
- lng
3848
- } = options;
3840
+ const { lng } = options;
3849
3841
 
3850
3842
  switch (lng) {
3851
3843
  // these keys don't work with plurals, don't know why, so I added a workaround to convert them to the correct lng
@@ -3853,7 +3845,6 @@ var index = {
3853
3845
  case 'en-US':
3854
3846
  options.lng = 'en';
3855
3847
  break;
3856
-
3857
3848
  case 'es_ES':
3858
3849
  case 'es-ES':
3859
3850
  case 'es_MX':
@@ -3861,19 +3852,13 @@ var index = {
3861
3852
  options.lng = 'es';
3862
3853
  break;
3863
3854
  }
3864
-
3865
- return instance.t(key, _extends({
3866
- lng
3867
- }, options));
3868
- }
3869
- }),
3870
- languageOptions: [{
3871
- value: 'en_US',
3872
- label: 'English (US)'
3873
- }, {
3874
- value: 'es_ES',
3875
- label: 'Spanish'
3876
- }]
3855
+ return instance.t(key, { lng, ...options });
3856
+ },
3857
+ },
3858
+ languageOptions: [
3859
+ { value: 'en_US', label: 'English (US)' },
3860
+ { value: 'es_ES', label: 'Spanish' },
3861
+ ],
3877
3862
  };
3878
3863
 
3879
3864
  // Should be exactly the same as configure/defaults.js
@@ -3898,6 +3883,26 @@ var defaults = {
3898
3883
  configuration: {},
3899
3884
  };
3900
3885
 
3886
+ const enabled = (config, env, defaultValue) => {
3887
+ // if model.partialScoring = false
3888
+ // - if env.partialScoring = false || env.partialScoring = true => use dichotomous scoring
3889
+ // else if model.partialScoring = true || undefined
3890
+ // - if env.partialScoring = false, use dichotomous scoring
3891
+ // - else if env.partialScoring = true, use partial scoring
3892
+ config = config || {};
3893
+ env = env || {};
3894
+
3895
+ if (config.partialScoring === false) {
3896
+ return false;
3897
+ }
3898
+
3899
+ if (env.partialScoring === false) {
3900
+ return false;
3901
+ }
3902
+
3903
+ return typeof defaultValue === 'boolean' ? defaultValue : true;
3904
+ };
3905
+
3901
3906
  var getNative = _getNative;
3902
3907
 
3903
3908
  /* Built-in method references that are verified to be native. */
@@ -4561,39 +4566,14 @@ var Symbol$1 = _Symbol;
4561
4566
  var symbolProto = Symbol$1 ? Symbol$1.prototype : undefined;
4562
4567
  symbolProto ? symbolProto.toString : undefined;
4563
4568
 
4564
- const enabled = (config, env, defaultValue) => {
4565
- // if model.partialScoring = false
4566
- // - if env.partialScoring = false || env.partialScoring = true => use dichotomous scoring
4567
- // else if model.partialScoring = true || undefined
4568
- // - if env.partialScoring = false, use dichotomous scoring
4569
- // - else if env.partialScoring = true, use partial scoring
4570
- config = config || {};
4571
- env = env || {};
4572
-
4573
- if (config.partialScoring === false) {
4574
- return false;
4575
- }
4576
-
4577
- if (env.partialScoring === false) {
4578
- return false;
4579
- }
4580
-
4581
- return typeof defaultValue === 'boolean' ? defaultValue : true;
4582
- };
4583
-
4584
- var partialScoring = /*#__PURE__*/Object.freeze({
4585
- __proto__: null,
4586
- enabled: enabled
4587
- });
4588
-
4589
- const lg = n => console[n].bind(console, 'controller-utils:');
4590
-
4569
+ // eslint-disable-next-line no-console
4570
+ const lg = (n) => console[n].bind(console, 'controller-utils:');
4591
4571
  lg('debug');
4592
4572
  lg('log');
4593
4573
  lg('warn');
4594
4574
  lg('error');
4595
4575
 
4596
- const { translator } = index;
4576
+ const { translator } = Translator;
4597
4577
 
4598
4578
  const getFeedback = (value) => (value ? 'correct' : 'incorrect');
4599
4579
  const getContent = (html) => (html || '').replace(/(<(?!img|iframe|source)([^>]+)>)/gi, '');
@@ -4684,7 +4664,7 @@ const outcome = (question, session, env) =>
4684
4664
  if (!session || isEmpty_1(session)) {
4685
4665
  resolve({ score: 0, empty: true });
4686
4666
  }
4687
- const partialScoringEnabled = partialScoring.enabled(question, env);
4667
+ const partialScoringEnabled = enabled(question, env);
4688
4668
  session = normalizeSession(session);
4689
4669
 
4690
4670
  if (env.mode !== 'evaluate') {