@pie-element/multiple-choice 12.2.0-next.6 → 12.2.0-next.7

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,12 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [12.2.0-next.7](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice@12.2.0-next.6...@pie-element/multiple-choice@12.2.0-next.7) (2026-04-13)
7
+
8
+ ### Bug Fixes
9
+
10
+ - bump libs PIE-34 ([9f8b35a](https://github.com/pie-framework/pie-elements/commit/9f8b35a856ca1eba67d5630a358b96226cfca984))
11
+
6
12
  # [12.2.0-next.6](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice@12.2.0-next.5...@pie-element/multiple-choice@12.2.0-next.6) (2026-04-10)
7
13
 
8
14
  ### Bug Fixes
@@ -3,6 +3,12 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [9.2.0-next.5](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-configure@9.2.0-next.4...@pie-element/multiple-choice-configure@9.2.0-next.5) (2026-04-13)
7
+
8
+ ### Bug Fixes
9
+
10
+ - bump libs PIE-34 ([9f8b35a](https://github.com/pie-framework/pie-elements/commit/9f8b35a856ca1eba67d5630a358b96226cfca984))
11
+
6
12
  # [9.2.0-next.4](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-configure@9.2.0-next.3...@pie-element/multiple-choice-configure@9.2.0-next.4) (2026-04-10)
7
13
 
8
14
  ### Features
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pie-element/multiple-choice-configure",
3
- "version": "9.2.0-next.4",
3
+ "version": "9.2.0-next.5",
4
4
  "private": true,
5
5
  "main": "lib/index.js",
6
6
  "module": "src/index.js",
@@ -10,8 +10,8 @@
10
10
  "@mui/icons-material": "^7.3.4",
11
11
  "@mui/material": "^7.3.4",
12
12
  "@pie-framework/pie-configure-events": "^1.3.0",
13
- "@pie-lib/config-ui": "12.2.0-next.28",
14
- "@pie-lib/editable-html-tip-tap": "1.2.0-next.27",
13
+ "@pie-lib/config-ui": "12.2.0-next.29",
14
+ "@pie-lib/editable-html-tip-tap": "1.2.0-next.28",
15
15
  "@pie-lib/render-ui": "5.2.0-next.7",
16
16
  "debug": "^4.1.1",
17
17
  "lodash-es": "^4.17.23",
@@ -0,0 +1 @@
1
+ import{_dll_react_dom as e,_dll_react as t,_dll_prop_types as o,_dll_mui__material_styles as n,_dll_pie_lib__render_ui as i,_dll_mui__material as r,_dll_mui__icons_material as a,_dll_debug as s}from"../../../@pie-lib/shared-module@^4.1.0/module/index.js";import{_dll_pie_lib__config_ui as l}from"../../../@pie-lib/config-module@^3.1.0/module/index.js";import{_dll_pie_lib__editable_html_tip_tap as c}from"../../../@pie-lib/editable-html-module@^6.2.0/module/index.js";var u,d=e;u=d.createRoot,d.hydrateRoot;var h={};Object.defineProperty(h,"__esModule",{value:!0});class p extends CustomEvent{constructor(e,t=!1){super(p.TYPE,{bubbles:!0,detail:{update:e,reset:t}}),this.update=e,this.reset=t}}p.TYPE="model.updated";var g=h.ModelUpdatedEvent=p;class f extends CustomEvent{constructor(e,t){super(f.TYPE,{bubbles:!0,detail:{src:e,done:t}}),this.src=e,this.done=t}}f.TYPE="delete.image";var b=h.DeleteImageEvent=f;class m extends CustomEvent{constructor(e){super(m.TYPE,{bubbles:!0,detail:e}),this.handler=e}}m.TYPE="insert.image";var _=h.InsertImageEvent=m;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.sound";var y=h.DeleteSoundEvent=C;class v extends CustomEvent{constructor(e){super(v.TYPE,{bubbles:!0,detail:e}),this.handler=e}}v.TYPE="insert.sound";var E=h.InsertSoundEvent=v,j="object"==typeof global&&global&&global.Object===Object&&global,S="object"==typeof self&&self&&self.Object===Object&&self,A=j||S||Function("return this")(),x=A.Symbol,w=Object.prototype,O=w.hasOwnProperty,P=w.toString,k=x?x.toStringTag:void 0,I=Object.prototype.toString,M=x?x.toStringTag:void 0;function T(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":M&&M in Object(e)?function(e){var t=O.call(e,k),o=e[k];try{e[k]=void 0;var n=!0}catch(e){}var i=P.call(e);return n&&(t?e[k]=o:delete e[k]),i}(e):function(e){return I.call(e)}(e)}function R(e){return null!=e&&"object"==typeof e}var z=Array.isArray;function L(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function D(e){return e}function U(e){if(!L(e))return!1;var t=T(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}var q,F=A["__core-js_shared__"],$=(q=/[^.]+$/.exec(F&&F.keys&&F.keys.IE_PROTO||""))?"Symbol(src)_1."+q:"",B=Function.prototype.toString,W=/^\[object .+?Constructor\]$/,Y=Function.prototype,H=Object.prototype,N=Y.toString,G=H.hasOwnProperty,V=RegExp("^"+N.call(G).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function J(e,t){var o=function(e,t){return null==e?void 0:e[t]}(e,t);return function(e){return!(!L(e)||(t=e,$&&$ in t))&&(U(e)?V:W).test(function(e){if(null!=e){try{return B.call(e)}catch(e){}try{return e+""}catch(e){}}return""}(e));var t}(o)?o:void 0}var K,Q,X,Z=Object.create,ee=function(){function e(){}return function(t){if(!L(t))return{};if(Z)return Z(t);e.prototype=t;var o=new e;return e.prototype=void 0,o}}(),te=Date.now,oe=function(){try{var e=J(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),ne=oe,ie=ne?function(e,t){return ne(e,"toString",{configurable:!0,enumerable:!1,value:(o=t,function(){return o}),writable:!0});var o}:D,re=(K=ie,Q=0,X=0,function(){var e=te(),t=16-(e-X);if(X=e,t>0){if(++Q>=800)return arguments[0]}else Q=0;return K.apply(void 0,arguments)}),ae=/^(?:0|[1-9]\d*)$/;function se(e,t){var o=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==o||"symbol"!=o&&ae.test(e))&&e>-1&&e%1==0&&e<t}function le(e,t,o){"__proto__"==t&&ne?ne(e,t,{configurable:!0,enumerable:!0,value:o,writable:!0}):e[t]=o}function ce(e,t){return e===t||e!=e&&t!=t}var ue=Object.prototype.hasOwnProperty;function de(e,t,o){var n=e[t];ue.call(e,t)&&ce(n,o)&&(void 0!==o||t in e)||le(e,t,o)}var he=Math.max;function pe(e,t){return re(function(e,t,o){return t=he(void 0===t?e.length-1:t,0),function(){for(var n=arguments,i=-1,r=he(n.length-t,0),a=Array(r);++i<r;)a[i]=n[t+i];i=-1;for(var s=Array(t+1);++i<t;)s[i]=n[i];return s[t]=o(a),function(e,t,o){switch(o.length){case 0:return e.call(t);case 1:return e.call(t,o[0]);case 2:return e.call(t,o[0],o[1]);case 3:return e.call(t,o[0],o[1],o[2])}return e.apply(t,o)}(e,this,s)}}(e,t,D),e+"")}function ge(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function fe(e){return null!=e&&ge(e.length)&&!U(e)}function be(e,t,o){if(!L(o))return!1;var n=typeof t;return!!("number"==n?fe(o)&&se(t,o.length):"string"==n&&t in o)&&ce(o[t],e)}var me=Object.prototype;function _e(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||me)}function Ce(e){return R(e)&&"[object Arguments]"==T(e)}var ye=Object.prototype,ve=ye.hasOwnProperty,Ee=ye.propertyIsEnumerable,je=Ce(function(){return arguments}())?Ce:function(e){return R(e)&&ve.call(e,"callee")&&!Ee.call(e,"callee")},Se="object"==typeof exports&&exports&&!exports.nodeType&&exports,Ae=Se&&"object"==typeof module&&module&&!module.nodeType&&module,xe=Ae&&Ae.exports===Se?A.Buffer:void 0,we=(xe?xe.isBuffer:void 0)||function(){return!1},Oe={};Oe["[object Float32Array]"]=Oe["[object Float64Array]"]=Oe["[object Int8Array]"]=Oe["[object Int16Array]"]=Oe["[object Int32Array]"]=Oe["[object Uint8Array]"]=Oe["[object Uint8ClampedArray]"]=Oe["[object Uint16Array]"]=Oe["[object Uint32Array]"]=!0,Oe["[object Arguments]"]=Oe["[object Array]"]=Oe["[object ArrayBuffer]"]=Oe["[object Boolean]"]=Oe["[object DataView]"]=Oe["[object Date]"]=Oe["[object Error]"]=Oe["[object Function]"]=Oe["[object Map]"]=Oe["[object Number]"]=Oe["[object Object]"]=Oe["[object RegExp]"]=Oe["[object Set]"]=Oe["[object String]"]=Oe["[object WeakMap]"]=!1;var Pe="object"==typeof exports&&exports&&!exports.nodeType&&exports,ke=Pe&&"object"==typeof module&&module&&!module.nodeType&&module,Ie=ke&&ke.exports===Pe&&j.process,Me=function(){try{return ke&&ke.require&&ke.require("util").types||Ie&&Ie.binding&&Ie.binding("util")}catch(e){}}(),Te=Me&&Me.isTypedArray,Re=Te?function(e){return function(t){return e(t)}}(Te):function(e){return R(e)&&ge(e.length)&&!!Oe[T(e)]},ze=Re,Le=Object.prototype.hasOwnProperty;var De=Object.prototype.hasOwnProperty;function Ue(e){return fe(e)?function(e,t){var o=z(e),n=!o&&je(e),i=!o&&!n&&we(e),r=!o&&!n&&!i&&ze(e),a=o||n||i||r,s=a?function(e,t){for(var o=-1,n=Array(e);++o<e;)n[o]=t(o);return n}(e.length,String):[],l=s.length;for(var c in e)!t&&!Le.call(e,c)||a&&("length"==c||i&&("offset"==c||"parent"==c)||r&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||se(c,l))||s.push(c);return s}(e,!0):function(e){if(!L(e))return function(e){var t=[];if(null!=e)for(var o in Object(e))t.push(o);return t}(e);var t=_e(e),o=[];for(var n in e)("constructor"!=n||!t&&De.call(e,n))&&o.push(n);return o}(e)}var qe=J(Object,"create"),Fe=Object.prototype.hasOwnProperty,$e=Object.prototype.hasOwnProperty;function Be(e){var t=-1,o=null==e?0:e.length;for(this.clear();++t<o;){var n=e[t];this.set(n[0],n[1])}}function We(e,t){for(var o=e.length;o--;)if(ce(e[o][0],t))return o;return-1}Be.prototype.clear=function(){this.__data__=qe?qe(null):{},this.size=0},Be.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Be.prototype.get=function(e){var t=this.__data__;if(qe){var o=t[e];return"__lodash_hash_undefined__"===o?void 0:o}return Fe.call(t,e)?t[e]:void 0},Be.prototype.has=function(e){var t=this.__data__;return qe?void 0!==t[e]:$e.call(t,e)},Be.prototype.set=function(e,t){var o=this.__data__;return this.size+=this.has(e)?0:1,o[e]=qe&&void 0===t?"__lodash_hash_undefined__":t,this};var Ye=Array.prototype.splice;function He(e){var t=-1,o=null==e?0:e.length;for(this.clear();++t<o;){var n=e[t];this.set(n[0],n[1])}}He.prototype.clear=function(){this.__data__=[],this.size=0},He.prototype.delete=function(e){var t=this.__data__,o=We(t,e);return!(o<0||(o==t.length-1?t.pop():Ye.call(t,o,1),--this.size,0))},He.prototype.get=function(e){var t=this.__data__,o=We(t,e);return o<0?void 0:t[o][1]},He.prototype.has=function(e){return We(this.__data__,e)>-1},He.prototype.set=function(e,t){var o=this.__data__,n=We(o,e);return n<0?(++this.size,o.push([e,t])):o[n][1]=t,this};var Ne=J(A,"Map");function Ge(e,t){var o,n,i=e.__data__;return("string"==(n=typeof(o=t))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==o:null===o)?i["string"==typeof t?"string":"hash"]:i.map}function Ve(e){var t=-1,o=null==e?0:e.length;for(this.clear();++t<o;){var n=e[t];this.set(n[0],n[1])}}Ve.prototype.clear=function(){this.size=0,this.__data__={hash:new Be,map:new(Ne||He),string:new Be}},Ve.prototype.delete=function(e){var t=Ge(this,e).delete(e);return this.size-=t?1:0,t},Ve.prototype.get=function(e){return Ge(this,e).get(e)},Ve.prototype.has=function(e){return Ge(this,e).has(e)},Ve.prototype.set=function(e,t){var o=Ge(this,e),n=o.size;return o.set(e,t),this.size+=o.size==n?0:1,this};var Je=function(e,t){return function(o){return e(t(o))}}(Object.getPrototypeOf,Object),Ke=Je,Qe=Function.prototype,Xe=Object.prototype,Ze=Qe.toString,et=Xe.hasOwnProperty,tt=Ze.call(Object);function ot(e){var t=this.__data__=new He(e);this.size=t.size}ot.prototype.clear=function(){this.__data__=new He,this.size=0},ot.prototype.delete=function(e){var t=this.__data__,o=t.delete(e);return this.size=t.size,o},ot.prototype.get=function(e){return this.__data__.get(e)},ot.prototype.has=function(e){return this.__data__.has(e)},ot.prototype.set=function(e,t){var o=this.__data__;if(o instanceof He){var n=o.__data__;if(!Ne||n.length<199)return n.push([e,t]),this.size=++o.size,this;o=this.__data__=new Ve(n)}return o.set(e,t),this.size=o.size,this};var nt="object"==typeof exports&&exports&&!exports.nodeType&&exports,it=nt&&"object"==typeof module&&module&&!module.nodeType&&module,rt=it&&it.exports===nt?A.Buffer:void 0,at=(rt&&rt.allocUnsafe,A.Uint8Array);var st=Object.prototype,lt=st.hasOwnProperty,ct=pe(function(e,t){e=Object(e);var o=-1,n=t.length,i=n>2?t[2]:void 0;for(i&&be(t[0],t[1],i)&&(n=1);++o<n;)for(var r=t[o],a=Ue(r),s=-1,l=a.length;++s<l;){var c=a[s],u=e[c];(void 0===u||ce(u,st[c])&&!lt.call(e,c))&&(e[c]=r[c])}return e});function ut(e,t,o){(void 0!==o&&!ce(e[t],o)||void 0===o&&!(t in e))&&le(e,t,o)}function dt(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}function ht(e,t,o,n,i,r,a){var s=dt(e,o),l=dt(t,o),c=a.get(l);if(c)ut(e,o,c);else{var u,d=r?r(s,l,o+"",e,t,a):void 0,h=void 0===d;if(h){var p=z(l),g=!p&&we(l),f=!p&&!g&&ze(l);d=l,p||g||f?z(s)?d=s:R(u=s)&&fe(u)?d=function(e,t){var o=-1,n=e.length;for(t||(t=Array(n));++o<n;)t[o]=e[o];return t}(s):g?(h=!1,d=function(e){return e.slice()}(l)):f?(h=!1,d=function(e,t){var o,n,i=t?(n=new(o=e.buffer).constructor(o.byteLength),new at(n).set(new at(o)),n):e.buffer;return new e.constructor(i,e.byteOffset,e.length)}(l,!0)):d=[]:function(e){if(!R(e)||"[object Object]"!=T(e))return!1;var t=Ke(e);if(null===t)return!0;var o=et.call(t,"constructor")&&t.constructor;return"function"==typeof o&&o instanceof o&&Ze.call(o)==tt}(l)||je(l)?(d=s,je(s)?d=function(e){return function(e,t,o){var n=!o;o||(o={});for(var i=-1,r=t.length;++i<r;){var a=t[i],s=void 0;void 0===s&&(s=e[a]),n?le(o,a,s):de(o,a,s)}return o}(e,Ue(e))}(s):L(s)&&!U(s)||(d=function(e){return"function"!=typeof e.constructor||_e(e)?{}:ee(Ke(e))}(l))):h=!1}h&&(a.set(l,d),i(d,l,n,r,a),a.delete(l)),ut(e,o,d)}}function pt(e,t,o,n,i){e!==t&&function(e,t,o){for(var n=-1,i=Object(e),r=o(e),a=r.length;a--;){var s=r[++n];if(!1===t(i[s],s,i))break}}(t,function(r,a){if(i||(i=new ot),L(r))ht(e,t,a,o,pt,n,i);else{var s=n?n(dt(e,a),r,a+"",e,t,i):void 0;void 0===s&&(s=r),ut(e,a,s)}},Ue)}var gt,ft=(gt=function(e,t,o){pt(e,t,o)},pe(function(e,t){var o=-1,n=t.length,i=n>1?t[n-1]:void 0,r=n>2?t[2]:void 0;for(i=gt.length>3&&"function"==typeof i?(n--,i):void 0,r&&be(t[0],t[1],r)&&(i=n<3?void 0:i,n=1),e=Object(e);++o<n;){var a=t[o];a&&gt(e,a,o)}return e}));const bt=t,mt=o,{styled:_t}=n,{color:Ct}=i,{Button:yt}=r,{Tooltip:vt}=r,{Typography:Et}=r,{Box:jt}=r,{Info:St}=a,At=c,{AlertDialog:xt}=l,{InputContainer:wt}=l,{ChoiceConfiguration:Ot}=l,{settings:Pt}=l,{layout:kt}=l,{choiceUtils:It}=l;function Mt(e){let t,o=e[0],n=1;for(;n<e.length;){const i=e[n],r=e[n+1];if(n+=2,("optionalAccess"===i||"optionalCall"===i)&&null==o)return;"access"===i||"optionalAccess"===i?(t=o,o=r(o)):"call"!==i&&"optionalCall"!==i||(o=r((...e)=>o.call(t,...e)),t=void 0)}return o}const{Panel:Tt,toggle:Rt,radio:zt,dropdown:Lt}=Pt,Dt=_t(wt)(({theme:e})=>({width:"100%",paddingTop:e.spacing(2),marginBottom:e.spacing(2)})),Ut=_t(wt)(({theme:e})=>({flex:1,marginTop:e.spacing(1.5),paddingTop:e.spacing(2),marginLeft:e.spacing(3.5)})),qt=_t(wt)(({theme:e})=>({display:"flex",flexDirection:"column",marginBottom:e.spacing(1),width:"100%"})),Ft=_t(yt)(({theme:e})=>({marginTop:e.spacing(1),float:"right"})),$t=_t(Ft)({cursor:"not-allowed",pointerEvents:"all",backgroundColor:Ct.disabled(),"&:hover":{backgroundColor:Ct.disabled()},"&:focus":{backgroundColor:Ct.disabled()}}),Bt=_t(jt)({display:"flex",alignItems:"center"}),Wt=_t(Et)(({theme:e})=>({fontSize:e.typography.fontSize+2,marginRight:e.spacing(1)})),Yt=_t(vt)(({theme:e})=>({"& .MuiTooltip-tooltip":{fontSize:e.typography.fontSize-2,whiteSpace:"pre",maxWidth:"500px"}})),Ht=_t("div")(({theme:e})=>({fontSize:e.typography.fontSize-2,color:e.palette.error.main,paddingTop:e.spacing(1)})),Nt=e=>{const{model:t,configuration:o,onPromptChanged:n,onChoiceChanged:i,onRemoveChoice:r,onAddChoice:a,imageSupport:s,uploadSoundSupport:l,onChangeModel:c,onConfigurationChanged:u,onTeacherInstructionsChanged:d}=e,{addChoiceButton:h={},contentDimensions:p={},feedback:g={},deleteChoice:f={},choiceMode:b={},choicePrefix:m={},partialScoring:_={},lockChoiceOrder:C={},teacherInstructions:y={},studentInstructions:v={},rationale:E={},scoringType:j={},sequentialChoiceLabels:S={},settingsPanelDisabled:A,choicesLayout:x,spellCheck:w={},gridColumns:O,maxImageWidth:P={},maxImageHeight:k={},prompt:I={},withRubric:M={},mathMlOptions:T={},language:R={},languageChoices:z={}}=o||{};let{maxAnswerChoices:L}=o||{};const{limitChoicesNumber:D,teacherInstructionsEnabled:U,rationaleEnabled:q,feedbackEnabled:F,promptEnabled:$,spellCheckEnabled:B,choices:W,errors:Y,toolbarEditorPosition:H,extraCSSRules:N}=t||{},{answerChoices:G,choices:V,correctResponse:J,prompt:K,rationale:Q,teacherInstructions:X}=Y||{},Z=Mt([W,"optionalAccess",e=>e.length])?Array.from({length:W.length},(e,t)=>`${t+1}`):[],{baseInputConfiguration:ee={}}=o,te={position:"top"===H?"top":"bottom"};D&&(L=9);const oe=(e={})=>({...ee,...e}),ne=(e=>{const{minAnswerChoices:t,maxAnswerChoices:o}=e;return`Validation requirements:\nThere should be at least ${t} `+(o?`and at most ${o} `:"")+"answer choices defined.\nEvery answer choice should be non-blank and unique.\nA correct answer must be defined."})(o),ie=P&&P.prompt,re=k&&k.prompt,ae=L&&Mt([W,"optionalAccess",e=>e.length])>=L?`Only ${L} allowed maximum`:"",se={choiceMode:b.settings&&zt(b.label,["checkbox","radio"]),"sequentialChoiceLabels.enabled":S.settings&&Rt(S.label,!0),choicePrefix:m.settings&&zt(m.label,["numbers","letters"]),partialScoring:_.settings&&Rt(_.label),lockChoiceOrder:C.settings&&Rt(C.label),feedbackEnabled:g.settings&&Rt(g.label),choicesLayout:x.settings&&Lt(x.label,["vertical","grid","horizontal"]),gridColumns:x.settings&&"grid"===t.choicesLayout&&Z.length>0&&Lt(O.label,Z),"language.enabled":R.settings&&Rt(R.label,!0),language:R.settings&&R.enabled&&Lt(z.label,z.options)},le={teacherInstructionsEnabled:y.settings&&Rt(y.label),studentInstructionsEnabled:v.settings&&Rt(v.label),promptEnabled:I.settings&&Rt(I.label),rationaleEnabled:E.settings&&Rt(E.label),spellCheckEnabled:w.settings&&Rt(w.label),scoringType:j.settings&&zt(j.label,["auto","rubric"]),rubricEnabled:Mt([M,"optionalAccess",e=>e.settings])&&Rt(Mt([M,"optionalAccess",e=>e.label]))};return bt.createElement(kt.ConfigLayout,{dimensions:p,hideSettings:A,extraCSSRules:N,classes:{},settings:bt.createElement(Tt,{model:t,onChangeModel:c,configuration:o,onChangeConfiguration:u,groups:{Settings:se,Properties:le}})},U&&bt.createElement(Dt,{label:y.label},bt.createElement(At,{markup:t.teacherInstructions||"",onChange:d,imageSupport:s,nonEmpty:!1,disableUnderline:!0,error:X,toolbarOpts:te,pluginProps:oe(Mt([o,"optionalAccess",e=>e.teacherInstructions,"optionalAccess",e=>e.inputConfiguration])),spellCheck:B,maxImageWidth:P&&P.teacherInstructions||ie,maxImageHeight:k&&k.teacherInstructions||re,uploadSoundSupport:l,languageCharactersProps:[{language:"spanish"},{language:"special"}],mathMlOptions:T}),X&&bt.createElement(Ht,null,X)),$&&bt.createElement(Dt,{label:I.label},bt.createElement(At,{markup:t.prompt,onChange:n,imageSupport:s,nonEmpty:!1,disableUnderline:!0,error:K,toolbarOpts:te,pluginProps:oe(Mt([o,"optionalAccess",e=>e.prompt,"optionalAccess",e=>e.inputConfiguration])),spellCheck:B,maxImageWidth:P&&P.prompt,maxImageHeight:k&&k.prompt,uploadSoundSupport:l,languageCharactersProps:[{language:"spanish"},{language:"special"}],mathMlOptions:T}),K&&bt.createElement(Ht,null,K)),bt.createElement(Bt,null,bt.createElement(Wt,{component:"div"},"Choices"),bt.createElement(Yt,{disableFocusListener:!0,disableTouchListener:!0,placement:"right",title:ne},bt.createElement(St,{fontSize:"small",color:"primary"}))),W.map((e,n)=>bt.createElement(qt,{key:`choice-${n}`},bt.createElement(Ot,{key:n,index:n+1,useLetterOrdering:"letters"===t.choicePrefix,mode:t.choiceMode,data:e,defaultFeedback:{},imageSupport:s,disableImageAlignmentButtons:!0,onDelete:()=>r(n),onChange:e=>i(n,e),allowFeedBack:F,allowDelete:f.settings,noLabels:!0,pluginOpts:oe(Mt([o,"optionalAccess",e=>e.choices,"optionalAccess",e=>e.inputConfiguration])),toolbarOpts:te,spellCheck:B,error:Mt([V,"optionalAccess",t=>t[e.value]])||null,noCorrectAnswerError:J,maxImageWidth:P&&P.choices||ie,maxImageHeight:k&&k.choices||re,uploadSoundSupport:l,mathMlOptions:T}),q&&bt.createElement(Ut,{key:`rationale-${n}`,label:E.label},bt.createElement(At,{markup:e.rationale||"",onChange:t=>i(n,{...e,rationale:t}),imageSupport:s,error:Mt([Q,"optionalAccess",t=>t[e.value]])||null,toolbarOpts:te,pluginProps:oe(Mt([o,"optionalAccess",e=>e.rationale,"optionalAccess",e=>e.inputConfiguration])),spellCheck:B,maxImageWidth:P&&P.rationale||ie,maxImageHeight:k&&k.rationale||re,uploadSoundSupport:l,languageCharactersProps:[{language:"spanish"},{language:"special"}],mathMlOptions:T}),Mt([Q,"optionalAccess",t=>t[e.value]])&&bt.createElement(Ht,null,Mt([Q,"optionalAccess",t=>t[e.value]]))))),J&&bt.createElement(Ht,null,J),G&&bt.createElement(Ht,null,G),h.settings&&bt.createElement(Yt,{title:ae},L&&Mt([W,"optionalAccess",e=>e.length])>=L?bt.createElement($t,{variant:"contained",color:"primary",onClick:a,disabled:!0},h.label):bt.createElement(Ft,{variant:"contained",color:"primary",onClick:a},h.label)))};class Gt extends bt.Component{constructor(...e){super(...e),Gt.prototype.__init.call(this),Gt.prototype.__init2.call(this),Gt.prototype.__init3.call(this),Gt.prototype.__init4.call(this),Gt.prototype.__init5.call(this),Gt.prototype.__init6.call(this),Gt.prototype.__init7.call(this)}static __initStatic(){this.propTypes={model:mt.object.isRequired,configuration:mt.object.isRequired,disableSidePanel:mt.bool,onModelChanged:mt.func.isRequired,onConfigurationChanged:mt.func.isRequired,imageSupport:mt.shape({add:mt.func.isRequired,delete:mt.func.isRequired})}}__init(){this.state={showWarning:!1}}__init2(){this.onRemoveChoice=e=>{const{model:t,configuration:o,onModelChanged:n}=this.props,{minAnswerChoices:i}=o||{};i&&t.choices.length===i?this.setState({showWarning:!0}):(t.choices.splice(e,1),n(t))}}__init3(){this.onAddChoice=()=>{const{model:e,configuration:t,onModelChanged:o}=this.props;let{maxAnswerChoices:n}=t||{};const{limitChoicesNumber:i}=e||{};i&&(n=9),n&&e.choices.length>=n||(e.choices.push({label:"",value:It.firstAvailableIndex(e.choices.map(e=>e.value),0),feedback:{type:"none"}}),o(e))}}__init4(){this.onChoiceChanged=(e,t)=>{const{model:o,onModelChanged:n}=this.props;t.correct&&"radio"===o.choiceMode&&(o.choices=o.choices.map(e=>ft({},e,{correct:!1}))),o.choices.splice(e,1,t),n(o)}}__init5(){this.onPromptChanged=e=>{this.props.onModelChanged({...this.props.model,prompt:e})}}__init6(){this.onTeacherInstructionsChanged=e=>{this.props.onModelChanged({...this.props.model,teacherInstructions:e})}}__init7(){this.onModelChanged=(e,t)=>{const{onModelChanged:o}=this.props;if("choiceMode"===t){if("radio"===e.choiceMode){let t=!1;e.choices=e.choices.map(e=>t?(e.correct=!1,e):(e.correct&&(t=!0),e))}o(e,!0)}else o(e)}}render(){const{configuration:{minAnswerChoices:e}={}}=this.props,{showWarning:t}=this.state;return bt.createElement(bt.Fragment,null,bt.createElement(xt,{open:t,title:"Warning",text:`There can't be less than ${e||0} choices.`,onConfirm:()=>this.setState({showWarning:!1})}),bt.createElement(Nt,{...this.props,onChangeModel:this.onModelChanged,onRemoveChoice:this.onRemoveChoice,onChoiceChanged:this.onChoiceChanged,onAddChoice:this.onAddChoice,onPromptChanged:this.onPromptChanged,onTeacherInstructionsChanged:this.onTeacherInstructionsChanged}))}}Gt.__initStatic();var Vt={choiceMode:"checkbox",choicePrefix:"letters",choices:[],choicesLayout:"vertical",feedbackEnabled:!1,gridColumns:2,lockChoiceOrder:!0,partialScoring:!0,prompt:"",promptEnabled:!0,rationale:"",rationaleEnabled:!0,scoringType:"auto",studentInstructionsEnabled:!0,teacherInstructions:"",teacherInstructionsEnabled:!0,toolbarEditorPosition:"bottom",selectedAnswerBackgroundColor:"initial",keyboardEventsEnabled:!1},Jt={baseInputConfiguration:{h3:{disabled:!0},audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1},textAlign:{disabled:!0},showParagraphs:{disabled:!1},separateParagraphs:{disabled:!0}},choices:{inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1}}},spellCheck:{label:"Spellcheck",settings:!1,enabled:!0},choicesLayout:{settings:!1,label:"Choices Layout"},gridColumns:{label:"Grid columns"},answerChoiceCount:0,addChoiceButton:{settings:!0,label:"Add a Choice"},choiceMode:{settings:!0,label:"Response Type"},choicePrefix:{settings:!0,label:"Choice Labels"},deleteChoice:{settings:!0},feedback:{settings:!0,label:"Feedback"},prompt:{settings:!0,label:"Prompt",inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1}},required:!1},lockChoiceOrder:{settings:!0,label:"Lock Choice Order"},partialScoring:{settings:!1,label:"Allow Partial Scoring"},rationale:{settings:!0,label:"Rationale",inputConfiguration:{audio:{disabled:!0},video:{disabled:!0},image:{disabled:!1}},required:!1},scoringType:{settings:!1,label:"Scoring Type"},studentInstructions:{settings:!1,label:"Student Instructions"},teacherInstructions:{settings:!0,label:"Teacher Instructions",inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1}},required:!1},toolbarEditorPosition:{settings:!1,label:"Toolbar Editor Position"},minAnswerChoices:2,maxAnswerChoices:5,maxImageWidth:{teacherInstructions:300,prompt:300,rationale:636,choices:900},maxImageHeight:{teacherInstructions:300,prompt:300,rationale:300,choices:300},withRubric:{settings:!1,label:"Add Rubric"},mathMlOptions:{mmlOutput:!1,mmlEditing:!1},language:{settings:!1,label:"Specify Language",enabled:!1},languageChoices:{label:"Language Choices",options:[]}};const Kt=t,Qt=s,{choiceUtils:Xt}=l;function Zt(e){let t,o=e[0],n=1;for(;n<e.length;){const i=e[n],r=e[n+1];if(n+=2,("optionalAccess"===i||"optionalCall"===i)&&null==o)return;"access"===i||"optionalAccess"===i?(t=o,o=r(o)):"call"!==i&&"optionalCall"!==i||(o=r((...e)=>o.call(t,...e)),t=void 0)}return o}const eo=Qt("multiple-choice:configure"),to=(e,t=0)=>{if(!e||0===e.length){let e=[];for(let o=0;o<t;o++)e.push({value:`${o}`,label:"",feedback:{type:"none",value:""}});return e}return e},oo=(e,t)=>{const o=ct(e,Jt);return{configuration:o,model:{...t,choices:to(t&&t.choices||[],o&&o.answerChoiceCount)}}};class no extends HTMLElement{static __initStatic(){this.createDefaultModel=(e={})=>{const t=Xt.normalizeChoices({...Vt,...e,choices:to(e&&e.choices||[])});return t.choicesLayout=e.choicesLayout||!1===e.verticalMode&&"horizontal"||Vt.choicesLayout,t}}constructor(){super(),this._root=null,this._reactContainer=null,this._model=no.createDefaultModel(),this._configuration=Jt,this.onModelChanged=this.onModelChanged.bind(this),this.onConfigurationChanged=this.onConfigurationChanged.bind(this)}set model(e){this._model=no.createDefaultModel(e),this._render()}set configuration(e){const t=oo(e,this._model);this.onModelChanged(t.model);const o={...Jt,...t.configuration};this._configuration=o,Zt([o,"optionalAccess",e=>e.language,"optionalAccess",e=>e.enabled])?Zt([o,"optionalAccess",e=>e.languageChoices,"optionalAccess",e=>e.options,"optionalAccess",e=>e.length])&&(this._model.language=Zt([o,"optionalAccess",e=>e.languageChoices,"access",e=>e.options,"access",e=>e[0],"access",e=>e.value])):o.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=e,this._render(),this.dispatchModelUpdated(t)}onConfigurationChanged(e){this._configuration=oo(e,this._model).configuration,this._model&&this.onModelChanged(this._model),this._render()}insertImage(e){this.dispatchEvent(new _(e))}onDeleteImage(e,t){this.dispatchEvent(new b(e,t))}insertSound(e){this.dispatchEvent(new E(e))}onDeleteSound(e,t){this.dispatchEvent(new y(e,t))}_render(){console.log("🔧 [multiple-choice-configure] _render - Starting render"),console.log("🔧 [multiple-choice-configure] _render - Model:",this._model?"present":"missing"),console.log("🔧 [multiple-choice-configure] _render - Configuration:",this._configuration?"present":"missing"),console.log("🔧 [multiple-choice-configure] _render - Root exists:",!!this._root),eo("_render - Starting render"),eo("_render - Model:",this._model?"present":"missing"),eo("_render - Configuration:",this._configuration?"present":"missing"),eo("_render - Root exists:",!!this._root);try{let e=Kt.createElement(Gt,{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)}});this._root||(console.log("🔧 [multiple-choice-configure] _render - Creating React container"),eo("_render - Creating React container"),this._reactContainer=document.createElement("div"),this._reactContainer.className="pie-configure-wrapper",this.appendChild(this._reactContainer),console.log("🔧 [multiple-choice-configure] _render - Creating new React root"),eo("_render - Creating new React root"),this._root=u(this._reactContainer),console.log("✅ [multiple-choice-configure] _render - React root created successfully"),eo("_render - React root created successfully")),console.log("🔧 [multiple-choice-configure] _render - Calling root.render()"),eo("_render - Calling root.render()"),this._root.render(e),console.log("✅ [multiple-choice-configure] _render - Render completed successfully"),eo("_render - Render completed successfully")}catch(e){throw console.error("❌ [multiple-choice-configure] Render error:",e),console.error("Error stack:",e.stack),e}}connectedCallback(){console.log("🔧 [multiple-choice-configure] connectedCallback - Component connected to DOM"),eo("connectedCallback - Component connected to DOM"),eo("connectedCallback - Model:",this._model?"present":"missing"),eo("connectedCallback - Configuration:",this._configuration?"present":"missing")}disconnectedCallback(){console.log("🔧 [multiple-choice-configure] disconnectedCallback - Component disconnected from DOM"),eo("disconnectedCallback - Component disconnected from DOM"),this._root&&(console.log("🔧 [multiple-choice-configure] disconnectedCallback - Unmounting React root"),eo("disconnectedCallback - Unmounting React root"),this._root.unmount(),this._root=null),this._reactContainer&&(this._reactContainer=null)}}no.__initStatic();export{no as default};