@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 +6 -0
- package/configure/CHANGELOG.md +6 -0
- package/configure/package.json +3 -3
- package/module/configure.js +1 -0
- package/module/controller.js +3045 -0
- package/module/demo.js +86 -0
- package/module/element.js +1 -0
- package/module/index.html +21 -0
- package/module/manifest.json +14 -0
- package/module/print-demo.js +124 -0
- package/module/print.html +18 -0
- package/module/print.js +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import PrintElement from './print.js';
|
|
2
|
+
|
|
3
|
+
var generate = {};
|
|
4
|
+
|
|
5
|
+
generate.model = (id, element) => ({
|
|
6
|
+
id,
|
|
7
|
+
element,
|
|
8
|
+
choiceMode: 'checkbox',
|
|
9
|
+
choicePrefix: 'numbers',
|
|
10
|
+
choices: [
|
|
11
|
+
{
|
|
12
|
+
correct: true,
|
|
13
|
+
value: 'sweden',
|
|
14
|
+
label: 'Sweden',
|
|
15
|
+
feedback: {
|
|
16
|
+
type: 'none',
|
|
17
|
+
value: '',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
value: 'iceland',
|
|
22
|
+
label: 'Iceland',
|
|
23
|
+
feedback: {
|
|
24
|
+
type: 'none',
|
|
25
|
+
value: '',
|
|
26
|
+
},
|
|
27
|
+
rationale: 'Rationale for Iceland',
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
value: 'norway',
|
|
31
|
+
label: 'Norway',
|
|
32
|
+
feedback: {
|
|
33
|
+
type: 'none',
|
|
34
|
+
value: '',
|
|
35
|
+
},
|
|
36
|
+
rationale: 'Rationale for Norway',
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
correct: true,
|
|
40
|
+
value: 'finland',
|
|
41
|
+
label: 'Finland',
|
|
42
|
+
feedback: {
|
|
43
|
+
type: 'none',
|
|
44
|
+
value: '',
|
|
45
|
+
},
|
|
46
|
+
rationale: 'Rationale for Finland',
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
extraCSSRules: {
|
|
50
|
+
names: ['red', 'blue'],
|
|
51
|
+
rules: `
|
|
52
|
+
.red {
|
|
53
|
+
color: red !important;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.blue {
|
|
57
|
+
color: blue !important;
|
|
58
|
+
}
|
|
59
|
+
`,
|
|
60
|
+
},
|
|
61
|
+
prompt: '',
|
|
62
|
+
promptEnabled: true,
|
|
63
|
+
toolbarEditorPosition: 'bottom',
|
|
64
|
+
rubricEnabled: false,
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
const { model } = generate;
|
|
68
|
+
|
|
69
|
+
var config = {
|
|
70
|
+
elements: {
|
|
71
|
+
'multiple-choice': '../..',
|
|
72
|
+
},
|
|
73
|
+
models: [model('1', 'multiple-choice')],
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
// new init - just shows off print!
|
|
77
|
+
|
|
78
|
+
const init = async () => {
|
|
79
|
+
console.log('define the element...');
|
|
80
|
+
await Promise.all(
|
|
81
|
+
config.models.map(async (m) => {
|
|
82
|
+
try {
|
|
83
|
+
const printTag = `${m.element}-print`;
|
|
84
|
+
if (customElements.get(printTag)) {
|
|
85
|
+
return true;
|
|
86
|
+
} else {
|
|
87
|
+
customElements.define(printTag, PrintElement);
|
|
88
|
+
await customElements.whenDefined(printTag);
|
|
89
|
+
return true;
|
|
90
|
+
}
|
|
91
|
+
} catch (e) {
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
})
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
console.log('now apply the model...');
|
|
98
|
+
config.models.forEach((m) => {
|
|
99
|
+
const printTag = `${m.element}-print`;
|
|
100
|
+
const h3s = document.createElement('h3');
|
|
101
|
+
h3s.textContent = 'student mode';
|
|
102
|
+
document.body.appendChild(h3s);
|
|
103
|
+
const de = document.createElement(printTag);
|
|
104
|
+
document.body.appendChild(de);
|
|
105
|
+
de.options = {};
|
|
106
|
+
de.model = m;
|
|
107
|
+
|
|
108
|
+
const h3 = document.createElement('h3');
|
|
109
|
+
h3.textContent = 'instructor mode';
|
|
110
|
+
document.body.appendChild(h3);
|
|
111
|
+
const instr = document.createElement(printTag);
|
|
112
|
+
document.body.appendChild(instr);
|
|
113
|
+
instr.options = { mode: 'instructor' };
|
|
114
|
+
instr.model = JSON.parse(JSON.stringify(m));
|
|
115
|
+
});
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
init()
|
|
119
|
+
.then(() => {
|
|
120
|
+
console.log('ready');
|
|
121
|
+
})
|
|
122
|
+
.catch((e) => {
|
|
123
|
+
console.error(e);
|
|
124
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
|
|
2
|
+
<!doctype html>
|
|
3
|
+
<html>
|
|
4
|
+
<head>
|
|
5
|
+
<title>@pie-element/multiple-choice@12.2.0-next.6</title>
|
|
6
|
+
<link
|
|
7
|
+
href="https://fonts.googleapis.com/css?family=Roboto&display=swap"
|
|
8
|
+
rel="stylesheet"
|
|
9
|
+
/>
|
|
10
|
+
<style>
|
|
11
|
+
html, body {
|
|
12
|
+
font-family: 'Roboto', sans-serif;
|
|
13
|
+
}
|
|
14
|
+
</style>
|
|
15
|
+
<script type="module" src="./print-demo.js"></script>
|
|
16
|
+
</head>
|
|
17
|
+
<body></body>
|
|
18
|
+
</html>
|
package/module/print.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{_dll_react_dom as e,_dll_react as t,_dll_mui__material_styles as o,_dll_mui__material as n,_dll_prop_types as r,_dll_pie_lib__render_ui as s,_dll_classnames as i,_dll_pie_lib__correct_answer_toggle as a,_dll_debug as c}from"../../../@pie-lib/shared-module@^4.1.0/module/index.js";import{_dll_pie_lib__math_rendering as l}from"../../../@pie-lib/math-rendering-module@^4.1.0/module/index.js";var u,p=e;u=p.createRoot,p.hydrateRoot;var h="object"==typeof global&&global&&global.Object===Object&&global,d="object"==typeof self&&self&&self.Object===Object&&self,g=h||d||Function("return this")(),f=g.Symbol,m=Object.prototype,b=m.hasOwnProperty,y=m.toString,v=f?f.toStringTag:void 0;var x=Object.prototype.toString;var S=f?f.toStringTag:void 0;function C(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":S&&S in Object(e)?function(e){var t=b.call(e,v),o=e[v];try{e[v]=void 0;var n=!0}catch(e){}var r=y.call(e);return n&&(t?e[v]=o:delete e[v]),r}(e):function(e){return x.call(e)}(e)}function k(e){return null!=e&&"object"==typeof e}var w=Array.isArray,E=/\s/;var O=/^\s+/;function A(e){return e?e.slice(0,function(e){for(var t=e.length;t--&&E.test(e.charAt(t)););return t}(e)+1).replace(O,""):e}function _(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}var j=/^[-+]0x[0-9a-f]+$/i,L=/^0b[01]+$/i,N=/^0o[0-7]+$/i,R=parseInt;function P(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||k(e)&&"[object Symbol]"==C(e)}(e))return NaN;if(_(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=_(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=A(e);var o=L.test(e);return o||N.test(e)?R(e.slice(2),o?2:8):j.test(e)?NaN:+e}function $(e){if(!_(e))return!1;var t=C(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}var T,I=g["__core-js_shared__"],M=(T=/[^.]+$/.exec(I&&I.keys&&I.keys.IE_PROTO||""))?"Symbol(src)_1."+T:"";var F=Function.prototype.toString;function B(e){if(null!=e){try{return F.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var D=/^\[object .+?Constructor\]$/,V=Function.prototype,z=Object.prototype,U=V.toString,K=z.hasOwnProperty,H=RegExp("^"+U.call(K).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function W(e){return!(!_(e)||(t=e,M&&M in t))&&($(e)?H:D).test(B(e));var t}function q(e,t){var o=function(e,t){return null==e?void 0:e[t]}(e,t);return W(o)?o:void 0}var J=q(g,"WeakMap"),Y=Object.create,G=function(){function e(){}return function(t){if(!_(t))return{};if(Y)return Y(t);e.prototype=t;var o=new e;return e.prototype=void 0,o}}();var Q=function(){try{var e=q(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();var X=/^(?:0|[1-9]\d*)$/;function Z(e,t){var o=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==o||"symbol"!=o&&X.test(e))&&e>-1&&e%1==0&&e<t}function ee(e,t,o){"__proto__"==t&&Q?Q(e,t,{configurable:!0,enumerable:!0,value:o,writable:!0}):e[t]=o}function te(e,t){return e===t||e!=e&&t!=t}var oe=Object.prototype.hasOwnProperty;function ne(e,t,o){var n=e[t];oe.call(e,t)&&te(n,o)&&(void 0!==o||t in e)||ee(e,t,o)}function re(e,t,o,n){var r=!o;o||(o={});for(var s=-1,i=t.length;++s<i;){var a=t[s],c=n?n(o[a],e[a],a,o,e):void 0;void 0===c&&(c=e[a]),r?ee(o,a,c):ne(o,a,c)}return o}function se(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function ie(e){return null!=e&&se(e.length)&&!$(e)}var ae=Object.prototype;function ce(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||ae)}function le(e){return k(e)&&"[object Arguments]"==C(e)}var ue=Object.prototype,pe=ue.hasOwnProperty,he=ue.propertyIsEnumerable,de=le(function(){return arguments}())?le:function(e){return k(e)&&pe.call(e,"callee")&&!he.call(e,"callee")};var ge="object"==typeof exports&&exports&&!exports.nodeType&&exports,fe=ge&&"object"==typeof module&&module&&!module.nodeType&&module,me=fe&&fe.exports===ge?g.Buffer:void 0,be=(me?me.isBuffer:void 0)||function(){return!1},ye={};function ve(e){return function(t){return e(t)}}ye["[object Float32Array]"]=ye["[object Float64Array]"]=ye["[object Int8Array]"]=ye["[object Int16Array]"]=ye["[object Int32Array]"]=ye["[object Uint8Array]"]=ye["[object Uint8ClampedArray]"]=ye["[object Uint16Array]"]=ye["[object Uint32Array]"]=!0,ye["[object Arguments]"]=ye["[object Array]"]=ye["[object ArrayBuffer]"]=ye["[object Boolean]"]=ye["[object DataView]"]=ye["[object Date]"]=ye["[object Error]"]=ye["[object Function]"]=ye["[object Map]"]=ye["[object Number]"]=ye["[object Object]"]=ye["[object RegExp]"]=ye["[object Set]"]=ye["[object String]"]=ye["[object WeakMap]"]=!1;var xe="object"==typeof exports&&exports&&!exports.nodeType&&exports,Se=xe&&"object"==typeof module&&module&&!module.nodeType&&module,Ce=Se&&Se.exports===xe&&h.process,ke=function(){try{var e=Se&&Se.require&&Se.require("util").types;return e||Ce&&Ce.binding&&Ce.binding("util")}catch(e){}}(),we=ke&&ke.isTypedArray,Ee=we?ve(we):function(e){return k(e)&&se(e.length)&&!!ye[C(e)]},Oe=Object.prototype.hasOwnProperty;function Ae(e,t){var o=w(e),n=!o&&de(e),r=!o&&!n&&be(e),s=!o&&!n&&!r&&Ee(e),i=o||n||r||s,a=i?function(e,t){for(var o=-1,n=Array(e);++o<e;)n[o]=t(o);return n}(e.length,String):[],c=a.length;for(var l in e)!t&&!Oe.call(e,l)||i&&("length"==l||r&&("offset"==l||"parent"==l)||s&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||Z(l,c))||a.push(l);return a}function _e(e,t){return function(o){return e(t(o))}}var je=_e(Object.keys,Object),Le=Object.prototype.hasOwnProperty;function Ne(e){return ie(e)?Ae(e):function(e){if(!ce(e))return je(e);var t=[];for(var o in Object(e))Le.call(e,o)&&"constructor"!=o&&t.push(o);return t}(e)}var Re=Object.prototype.hasOwnProperty;function Pe(e){if(!_(e))return function(e){var t=[];if(null!=e)for(var o in Object(e))t.push(o);return t}(e);var t=ce(e),o=[];for(var n in e)("constructor"!=n||!t&&Re.call(e,n))&&o.push(n);return o}function $e(e){return ie(e)?Ae(e,!0):Pe(e)}var Te=q(Object,"create");var Ie=Object.prototype.hasOwnProperty;var Me=Object.prototype.hasOwnProperty;function Fe(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 Be(e,t){for(var o=e.length;o--;)if(te(e[o][0],t))return o;return-1}Fe.prototype.clear=function(){this.__data__=Te?Te(null):{},this.size=0},Fe.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Fe.prototype.get=function(e){var t=this.__data__;if(Te){var o=t[e];return"__lodash_hash_undefined__"===o?void 0:o}return Ie.call(t,e)?t[e]:void 0},Fe.prototype.has=function(e){var t=this.__data__;return Te?void 0!==t[e]:Me.call(t,e)},Fe.prototype.set=function(e,t){var o=this.__data__;return this.size+=this.has(e)?0:1,o[e]=Te&&void 0===t?"__lodash_hash_undefined__":t,this};var De=Array.prototype.splice;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.__data__=[],this.size=0},Ve.prototype.delete=function(e){var t=this.__data__,o=Be(t,e);return!(o<0)&&(o==t.length-1?t.pop():De.call(t,o,1),--this.size,!0)},Ve.prototype.get=function(e){var t=this.__data__,o=Be(t,e);return o<0?void 0:t[o][1]},Ve.prototype.has=function(e){return Be(this.__data__,e)>-1},Ve.prototype.set=function(e,t){var o=this.__data__,n=Be(o,e);return n<0?(++this.size,o.push([e,t])):o[n][1]=t,this};var ze=q(g,"Map");function Ue(e,t){var o,n,r=e.__data__;return("string"==(n=typeof(o=t))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==o:null===o)?r["string"==typeof t?"string":"hash"]:r.map}function Ke(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 He(e,t){for(var o=-1,n=t.length,r=e.length;++o<n;)e[r+o]=t[o];return e}Ke.prototype.clear=function(){this.size=0,this.__data__={hash:new Fe,map:new(ze||Ve),string:new Fe}},Ke.prototype.delete=function(e){var t=Ue(this,e).delete(e);return this.size-=t?1:0,t},Ke.prototype.get=function(e){return Ue(this,e).get(e)},Ke.prototype.has=function(e){return Ue(this,e).has(e)},Ke.prototype.set=function(e,t){var o=Ue(this,e),n=o.size;return o.set(e,t),this.size+=o.size==n?0:1,this};var We=_e(Object.getPrototypeOf,Object);function qe(e){var t=this.__data__=new Ve(e);this.size=t.size}qe.prototype.clear=function(){this.__data__=new Ve,this.size=0},qe.prototype.delete=function(e){var t=this.__data__,o=t.delete(e);return this.size=t.size,o},qe.prototype.get=function(e){return this.__data__.get(e)},qe.prototype.has=function(e){return this.__data__.has(e)},qe.prototype.set=function(e,t){var o=this.__data__;if(o instanceof Ve){var n=o.__data__;if(!ze||n.length<199)return n.push([e,t]),this.size=++o.size,this;o=this.__data__=new Ke(n)}return o.set(e,t),this.size=o.size,this};var Je="object"==typeof exports&&exports&&!exports.nodeType&&exports,Ye=Je&&"object"==typeof module&&module&&!module.nodeType&&module,Ge=Ye&&Ye.exports===Je?g.Buffer:void 0,Qe=Ge?Ge.allocUnsafe:void 0;function Xe(){return[]}var Ze=Object.prototype.propertyIsEnumerable,et=Object.getOwnPropertySymbols,tt=et?function(e){return null==e?[]:(e=Object(e),function(e,t){for(var o=-1,n=null==e?0:e.length,r=0,s=[];++o<n;){var i=e[o];t(i,o,e)&&(s[r++]=i)}return s}(et(e),function(t){return Ze.call(e,t)}))}:Xe;var ot=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)He(t,tt(e)),e=We(e);return t}:Xe;function nt(e,t,o){var n=t(e);return w(e)?n:He(n,o(e))}function rt(e){return nt(e,Ne,tt)}function st(e){return nt(e,$e,ot)}var it=q(g,"DataView"),at=q(g,"Promise"),ct=q(g,"Set"),lt="[object Map]",ut="[object Promise]",pt="[object Set]",ht="[object WeakMap]",dt="[object DataView]",gt=B(it),ft=B(ze),mt=B(at),bt=B(ct),yt=B(J),vt=C;(it&&vt(new it(new ArrayBuffer(1)))!=dt||ze&&vt(new ze)!=lt||at&&vt(at.resolve())!=ut||ct&&vt(new ct)!=pt||J&&vt(new J)!=ht)&&(vt=function(e){var t=C(e),o="[object Object]"==t?e.constructor:void 0,n=o?B(o):"";if(n)switch(n){case gt:return dt;case ft:return lt;case mt:return ut;case bt:return pt;case yt:return ht}return t});var xt=vt,St=Object.prototype.hasOwnProperty;var Ct=g.Uint8Array;function kt(e){var t=new e.constructor(e.byteLength);return new Ct(t).set(new Ct(e)),t}var wt=/\w*$/;var Et=f?f.prototype:void 0,Ot=Et?Et.valueOf:void 0;function At(e,t,o){var n,r,s,i=e.constructor;switch(t){case"[object ArrayBuffer]":return kt(e);case"[object Boolean]":case"[object Date]":return new i(+e);case"[object DataView]":return function(e,t){var o=t?kt(e.buffer):e.buffer;return new e.constructor(o,e.byteOffset,e.byteLength)}(e,o);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return function(e,t){var o=t?kt(e.buffer):e.buffer;return new e.constructor(o,e.byteOffset,e.length)}(e,o);case"[object Map]":case"[object Set]":return new i;case"[object Number]":case"[object String]":return new i(e);case"[object RegExp]":return(s=new(r=e).constructor(r.source,wt.exec(r))).lastIndex=r.lastIndex,s;case"[object Symbol]":return n=e,Ot?Object(Ot.call(n)):{}}}var _t=ke&&ke.isMap,jt=_t?ve(_t):function(e){return k(e)&&"[object Map]"==xt(e)};var Lt=ke&&ke.isSet,Nt=Lt?ve(Lt):function(e){return k(e)&&"[object Set]"==xt(e)},Rt="[object Arguments]",Pt="[object Function]",$t="[object Object]",Tt={};function It(e,t,o,n,r,s){var i,a=1&t,c=2&t,l=4&t;if(o&&(i=r?o(e,n,r,s):o(e)),void 0!==i)return i;if(!_(e))return e;var u=w(e);if(u){if(i=function(e){var t=e.length,o=new e.constructor(t);return t&&"string"==typeof e[0]&&St.call(e,"index")&&(o.index=e.index,o.input=e.input),o}(e),!a)return function(e,t){var o=-1,n=e.length;for(t||(t=Array(n));++o<n;)t[o]=e[o];return t}(e,i)}else{var p=xt(e),h=p==Pt||"[object GeneratorFunction]"==p;if(be(e))return function(e,t){if(t)return e.slice();var o=e.length,n=Qe?Qe(o):new e.constructor(o);return e.copy(n),n}(e,a);if(p==$t||p==Rt||h&&!r){if(i=c||h?{}:function(e){return"function"!=typeof e.constructor||ce(e)?{}:G(We(e))}(e),!a)return c?function(e,t){return re(e,ot(e),t)}(e,function(e,t){return e&&re(t,$e(t),e)}(i,e)):function(e,t){return re(e,tt(e),t)}(e,function(e,t){return e&&re(t,Ne(t),e)}(i,e))}else{if(!Tt[p])return r?e:{};i=At(e,p,a)}}s||(s=new qe);var d=s.get(e);if(d)return d;s.set(e,i),Nt(e)?e.forEach(function(n){i.add(It(n,t,o,n,e,s))}):jt(e)&&e.forEach(function(n,r){i.set(r,It(n,t,o,r,e,s))});var g=u?void 0:(l?c?st:rt:c?$e:Ne)(e);return function(e,t){for(var o=-1,n=null==e?0:e.length;++o<n&&!1!==t(e[o],o,e););}(g||e,function(n,r){g&&(n=e[r=n]),ne(i,r,It(n,t,o,r,e,s))}),i}Tt[Rt]=Tt["[object Array]"]=Tt["[object ArrayBuffer]"]=Tt["[object DataView]"]=Tt["[object Boolean]"]=Tt["[object Date]"]=Tt["[object Float32Array]"]=Tt["[object Float64Array]"]=Tt["[object Int8Array]"]=Tt["[object Int16Array]"]=Tt["[object Int32Array]"]=Tt["[object Map]"]=Tt["[object Number]"]=Tt[$t]=Tt["[object RegExp]"]=Tt["[object Set]"]=Tt["[object String]"]=Tt["[object Symbol]"]=Tt["[object Uint8Array]"]=Tt["[object Uint8ClampedArray]"]=Tt["[object Uint16Array]"]=Tt["[object Uint32Array]"]=!0,Tt["[object Error]"]=Tt[Pt]=Tt["[object WeakMap]"]=!1;var Mt=function(){return g.Date.now()},Ft=Math.max,Bt=Math.min;function Dt(e,t,o){var n,r,s,i,a,c,l=0,u=!1,p=!1,h=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function d(t){var o=n,s=r;return n=r=void 0,l=t,i=e.apply(s,o)}function g(e){var o=e-c;return void 0===c||o>=t||o<0||p&&e-l>=s}function f(){var e=Mt();if(g(e))return m(e);a=setTimeout(f,function(e){var o=t-(e-c);return p?Bt(o,s-(e-l)):o}(e))}function m(e){return a=void 0,h&&n?d(e):(n=r=void 0,i)}function b(){var e=Mt(),o=g(e);if(n=arguments,r=this,c=e,o){if(void 0===a)return function(e){return l=e,a=setTimeout(f,t),u?d(e):i}(c);if(p)return clearTimeout(a),a=setTimeout(f,t),d(c)}return void 0===a&&(a=setTimeout(f,t)),i}return t=P(t)||0,_(o)&&(u=!!o.leading,s=(p="maxWait"in o)?Ft(P(o.maxWait)||0,t):s,h="trailing"in o?!!o.trailing:h),b.cancel=function(){void 0!==a&&clearTimeout(a),l=0,n=c=r=a=void 0},b.flush=function(){return void 0===a?i:m(Mt())},b}function Vt(e,t){return null!=e?e:t()}function zt(e){let t,o=e[0],n=1;for(;n<e.length;){const r=e[n],s=e[n+1];if(n+=2,("optionalAccess"===r||"optionalCall"===r)&&null==o)return;"access"===r||"optionalAccess"===r?(t=o,o=s(o)):"call"!==r&&"optionalCall"!==r||(o=s((...e)=>o.call(t,...e)),t=void 0)}return o}const Ut=e=>"string"==typeof e,Kt=()=>{let e,t;const o=new Promise((o,n)=>{e=o,t=n});return o.resolve=e,o.reject=t,o},Ht=e=>null==e?"":""+e,Wt=/###/g,qt=e=>e&&e.indexOf("###")>-1?e.replace(Wt,"."):e,Jt=e=>!e||Ut(e),Yt=(e,t,o)=>{const n=Ut(t)?t.split("."):t;let r=0;for(;r<n.length-1;){if(Jt(e))return{};const t=qt(n[r]);!e[t]&&o&&(e[t]=new o),e=Object.prototype.hasOwnProperty.call(e,t)?e[t]:{},++r}return Jt(e)?{}:{obj:e,k:qt(n[r])}},Gt=(e,t,o)=>{const{obj:n,k:r}=Yt(e,t,Object);if(void 0!==n||1===t.length)return void(n[r]=o);let s=t[t.length-1],i=t.slice(0,t.length-1),a=Yt(e,i,Object);for(;void 0===a.obj&&i.length;)s=`${i[i.length-1]}.${s}`,i=i.slice(0,i.length-1),a=Yt(e,i,Object),zt([a,"optionalAccess",e=>e.obj])&&void 0!==a.obj[`${a.k}.${s}`]&&(a.obj=void 0);a.obj[`${a.k}.${s}`]=o},Qt=(e,t)=>{const{obj:o,k:n}=Yt(e,t);if(o&&Object.prototype.hasOwnProperty.call(o,n))return o[n]},Xt=(e,t,o)=>{for(const n in t)"__proto__"!==n&&"constructor"!==n&&(n in e?Ut(e[n])||e[n]instanceof String||Ut(t[n])||t[n]instanceof String?o&&(e[n]=t[n]):Xt(e[n],t[n],o):e[n]=t[n]);return e},Zt=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var eo={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const to=e=>Ut(e)?e.replace(/[&<>"'\/]/g,e=>eo[e]):e;const oo=[" ",",","?","!",";"],no=new class{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){const t=this.regExpMap.get(e);if(void 0!==t)return t;const o=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,o),this.regExpQueue.push(e),o}}(20),ro=(e,t,o=".")=>{if(!e)return;if(e[t]){if(!Object.prototype.hasOwnProperty.call(e,t))return;return e[t]}const n=t.split(o);let r=e;for(let e=0;e<n.length;){if(!r||"object"!=typeof r)return;let t,s="";for(let i=e;i<n.length;++i)if(i!==e&&(s+=o),s+=n[i],t=r[s],void 0!==t){if(["string","number","boolean"].indexOf(typeof t)>-1&&i<n.length-1)continue;e+=i-e+1;break}r=t}return r},so=e=>zt([e,"optionalAccess",e=>e.replace,"call",e=>e("_","-")]),io={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){zt([console,"optionalAccess",t=>t[e],"optionalAccess",e=>e.apply,"optionalCall",e=>e(console,t)])}};class ao{constructor(e,t={}){this.init(e,t)}init(e,t={}){this.prefix=t.prefix||"i18next:",this.logger=e||io,this.options=t,this.debug=t.debug}log(...e){return this.forward(e,"log","",!0)}warn(...e){return this.forward(e,"warn","",!0)}error(...e){return this.forward(e,"error","")}deprecate(...e){return this.forward(e,"warn","WARNING DEPRECATED: ",!0)}forward(e,t,o,n){return n&&!this.debug?null:(Ut(e[0])&&(e[0]=`${o}${this.prefix} ${e[0]}`),this.logger[t](e))}create(e){return new ao(this.logger,{prefix:`${this.prefix}:${e}:`,...this.options})}clone(e){return(e=e||this.options).prefix=e.prefix||this.prefix,new ao(this.logger,e)}}var co=new ao;class lo{constructor(){this.observers={}}on(e,t){return e.split(" ").forEach(e=>{this.observers[e]||(this.observers[e]=new Map);const o=this.observers[e].get(t)||0;this.observers[e].set(t,o+1)}),this}off(e,t){this.observers[e]&&(t?this.observers[e].delete(t):delete this.observers[e])}emit(e,...t){if(this.observers[e]){Array.from(this.observers[e].entries()).forEach(([e,o])=>{for(let n=0;n<o;n++)e(...t)})}if(this.observers["*"]){Array.from(this.observers["*"].entries()).forEach(([o,n])=>{for(let r=0;r<n;r++)o.apply(o,[e,...t])})}}}class uo extends lo{constructor(e,t={ns:["translation"],defaultNS:"translation"}){super(),this.data=e||{},this.options=t,void 0===this.options.keySeparator&&(this.options.keySeparator="."),void 0===this.options.ignoreJSONStructure&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}removeNamespaces(e){const t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}getResource(e,t,o,n={}){const r=void 0!==n.keySeparator?n.keySeparator:this.options.keySeparator,s=void 0!==n.ignoreJSONStructure?n.ignoreJSONStructure:this.options.ignoreJSONStructure;let i;e.indexOf(".")>-1?i=e.split("."):(i=[e,t],o&&(Array.isArray(o)?i.push(...o):Ut(o)&&r?i.push(...o.split(r)):i.push(o)));const a=Qt(this.data,i);return!a&&!t&&!o&&e.indexOf(".")>-1&&(e=i[0],t=i[1],o=i.slice(2).join(".")),!a&&s&&Ut(o)?ro(zt([this,"access",e=>e.data,"optionalAccess",t=>t[e],"optionalAccess",e=>e[t]]),o,r):a}addResource(e,t,o,n,r={silent:!1}){const s=void 0!==r.keySeparator?r.keySeparator:this.options.keySeparator;let i=[e,t];o&&(i=i.concat(s?o.split(s):o)),e.indexOf(".")>-1&&(i=e.split("."),n=t,t=i[1]),this.addNamespaces(t),Gt(this.data,i,n),r.silent||this.emit("added",e,t,o,n)}addResources(e,t,o,n={silent:!1}){for(const n in o)(Ut(o[n])||Array.isArray(o[n]))&&this.addResource(e,t,n,o[n],{silent:!0});n.silent||this.emit("added",e,t,o)}addResourceBundle(e,t,o,n,r,s={silent:!1,skipCopy:!1}){let i=[e,t];e.indexOf(".")>-1&&(i=e.split("."),n=o,o=t,t=i[1]),this.addNamespaces(t);let a=Qt(this.data,i)||{};s.skipCopy||(o=JSON.parse(JSON.stringify(o))),n?Xt(a,o,r):a={...a,...o},Gt(this.data,i,a),s.silent||this.emit("added",e,t,o)}removeResourceBundle(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}hasResourceBundle(e,t){return void 0!==this.getResource(e,t)}getResourceBundle(e,t){return t||(t=this.options.defaultNS),this.getResource(e,t)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){const t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find(e=>t[e]&&Object.keys(t[e]).length>0)}toJSON(){return this.data}}var po={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,o,n,r){return e.forEach(e=>{t=Vt(zt([this,"access",e=>e.processors,"access",t=>t[e],"optionalAccess",e=>e.process,"call",e=>e(t,o,n,r)]),()=>t)}),t}};const ho=Symbol("i18next/PATH_KEY");function go(e,t){const{[ho]:o}=e(function(){const e=[],t=Object.create(null);let o;return t.get=(n,r)=>(zt([o,"optionalAccess",e=>e.revoke,"optionalCall",e=>e()]),r===ho?e:(e.push(r),o=Proxy.revocable(n,t),o.proxy)),Proxy.revocable(Object.create(null),t).proxy}());return o.join(Vt(zt([t,"optionalAccess",e=>e.keySeparator]),()=>"."))}const fo={},mo=e=>!Ut(e)&&"boolean"!=typeof e&&"number"!=typeof e;class bo extends lo{constructor(e,t={}){var o,n;super(),o=e,n=this,["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"].forEach(e=>{o[e]&&(n[e]=o[e])}),this.options=t,void 0===this.options.keySeparator&&(this.options.keySeparator="."),this.logger=co.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e,t={interpolation:{}}){const o={...t};if(null==e)return!1;const n=this.resolve(e,o);if(void 0===zt([n,"optionalAccess",e=>e.res]))return!1;const r=mo(n.res);return!1!==o.returnObjects||!r}extractFromKey(e,t){let o=void 0!==t.nsSeparator?t.nsSeparator:this.options.nsSeparator;void 0===o&&(o=":");const n=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator;let r=t.ns||this.options.defaultNS||[];const s=o&&e.indexOf(o)>-1,i=!(this.options.userDefinedKeySeparator||t.keySeparator||this.options.userDefinedNsSeparator||t.nsSeparator||((e,t,o)=>{t=t||"",o=o||"";const n=oo.filter(e=>t.indexOf(e)<0&&o.indexOf(e)<0);if(0===n.length)return!0;const r=no.getRegExp(`(${n.map(e=>"?"===e?"\\?":e).join("|")})`);let s=!r.test(e);if(!s){const t=e.indexOf(o);t>0&&!r.test(e.substring(0,t))&&(s=!0)}return s})(e,o,n));if(s&&!i){const t=e.match(this.interpolator.nestingRegexp);if(t&&t.length>0)return{key:e,namespaces:Ut(r)?[r]:r};const s=e.split(o);(o!==n||o===n&&this.options.ns.indexOf(s[0])>-1)&&(r=s.shift()),e=s.join(n)}return{key:e,namespaces:Ut(r)?[r]:r}}translate(e,t,o){let n="object"==typeof t?{...t}:t;if("object"!=typeof n&&this.options.overloadTranslationOptionHandler&&(n=this.options.overloadTranslationOptionHandler(arguments)),"object"==typeof n&&(n={...n}),n||(n={}),null==e)return"";"function"==typeof e&&(e=go(e,{...this.options,...n})),Array.isArray(e)||(e=[String(e)]);const r=void 0!==n.returnDetails?n.returnDetails:this.options.returnDetails,s=void 0!==n.keySeparator?n.keySeparator:this.options.keySeparator,{key:i,namespaces:a}=this.extractFromKey(e[e.length-1],n),c=a[a.length-1];let l=void 0!==n.nsSeparator?n.nsSeparator:this.options.nsSeparator;void 0===l&&(l=":");const u=n.lng||this.language,p=n.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if("cimode"===zt([u,"optionalAccess",e=>e.toLowerCase,"call",e=>e()]))return p?r?{res:`${c}${l}${i}`,usedKey:i,exactUsedKey:i,usedLng:u,usedNS:c,usedParams:this.getUsedParamsDetails(n)}:`${c}${l}${i}`:r?{res:i,usedKey:i,exactUsedKey:i,usedLng:u,usedNS:c,usedParams:this.getUsedParamsDetails(n)}:i;const h=this.resolve(e,n);let d=zt([h,"optionalAccess",e=>e.res]);const g=zt([h,"optionalAccess",e=>e.usedKey])||i,f=zt([h,"optionalAccess",e=>e.exactUsedKey])||i,m=void 0!==n.joinArrays?n.joinArrays:this.options.joinArrays,b=!this.i18nFormat||this.i18nFormat.handleAsObject,y=void 0!==n.count&&!Ut(n.count),v=bo.hasDefaultValue(n),x=y?this.pluralResolver.getSuffix(u,n.count,n):"",S=n.ordinal&&y?this.pluralResolver.getSuffix(u,n.count,{ordinal:!1}):"",C=y&&!n.ordinal&&0===n.count,k=C&&n[`defaultValue${this.options.pluralSeparator}zero`]||n[`defaultValue${x}`]||n[`defaultValue${S}`]||n.defaultValue;let w=d;b&&!d&&v&&(w=k);const E=mo(w),O=Object.prototype.toString.apply(w);if(!(b&&w&&E&&["[object Number]","[object Function]","[object RegExp]"].indexOf(O)<0)||Ut(m)&&Array.isArray(w))if(b&&Ut(m)&&Array.isArray(d))d=d.join(m),d&&(d=this.extendTranslation(d,e,n,o));else{let t=!1,r=!1;!this.isValidLookup(d)&&v&&(t=!0,d=k),this.isValidLookup(d)||(r=!0,d=i);const a=(n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&r?void 0:d,p=v&&k!==d&&this.options.updateMissing;if(r||t||p){if(this.logger.log(p?"updateKey":"missingKey",u,c,i,p?k:d),s){const e=this.resolve(i,{...n,keySeparator:!1});e&&e.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let e=[];const t=this.languageUtils.getFallbackCodes(this.options.fallbackLng,n.lng||this.language);if("fallback"===this.options.saveMissingTo&&t&&t[0])for(let o=0;o<t.length;o++)e.push(t[o]);else"all"===this.options.saveMissingTo?e=this.languageUtils.toResolveHierarchy(n.lng||this.language):e.push(n.lng||this.language);const o=(e,t,o)=>{const r=v&&o!==d?o:a;this.options.missingKeyHandler?this.options.missingKeyHandler(e,c,t,r,p,n):zt([this,"access",e=>e.backendConnector,"optionalAccess",e=>e.saveMissing])&&this.backendConnector.saveMissing(e,c,t,r,p,n),this.emit("missingKey",e,c,t,d)};this.options.saveMissing&&(this.options.saveMissingPlurals&&y?e.forEach(e=>{const t=this.pluralResolver.getSuffixes(e,n);C&&n[`defaultValue${this.options.pluralSeparator}zero`]&&t.indexOf(`${this.options.pluralSeparator}zero`)<0&&t.push(`${this.options.pluralSeparator}zero`),t.forEach(t=>{o([e],i+t,n[`defaultValue${t}`]||k)})}):o(e,i,k))}d=this.extendTranslation(d,e,n,h,o),r&&d===i&&this.options.appendNamespaceToMissingKey&&(d=`${c}${l}${i}`),(r||t)&&this.options.parseMissingKeyHandler&&(d=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${c}${l}${i}`:i,t?d:void 0,n))}else{if(!n.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const e=this.options.returnedObjectHandler?this.options.returnedObjectHandler(g,w,{...n,ns:a}):`key '${i} (${this.language})' returned an object instead of string.`;return r?(h.res=e,h.usedParams=this.getUsedParamsDetails(n),h):e}if(s){const e=Array.isArray(w),t=e?[]:{},o=e?f:g;for(const e in w)if(Object.prototype.hasOwnProperty.call(w,e)){const r=`${o}${s}${e}`;t[e]=v&&!d?this.translate(r,{...n,defaultValue:mo(k)?k[e]:void 0,joinArrays:!1,ns:a}):this.translate(r,{...n,joinArrays:!1,ns:a}),t[e]===r&&(t[e]=w[e])}d=t}}return r?(h.res=d,h.usedParams=this.getUsedParamsDetails(n),h):d}extendTranslation(e,t,o,n,r){if(zt([this,"access",e=>e.i18nFormat,"optionalAccess",e=>e.parse]))e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...o},o.lng||this.language||n.usedLng,n.usedNS,n.usedKey,{resolved:n});else if(!o.skipInterpolation){o.interpolation&&this.interpolator.init({...o,interpolation:{...this.options.interpolation,...o.interpolation}});const s=Ut(e)&&(void 0!==zt([o,"optionalAccess",e=>e.interpolation,"optionalAccess",e=>e.skipOnVariables])?o.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let i;if(s){const t=e.match(this.interpolator.nestingRegexp);i=t&&t.length}let a=o.replace&&!Ut(o.replace)?o.replace:o;if(this.options.interpolation.defaultVariables&&(a={...this.options.interpolation.defaultVariables,...a}),e=this.interpolator.interpolate(e,a,o.lng||this.language||n.usedLng,o),s){const t=e.match(this.interpolator.nestingRegexp);i<(t&&t.length)&&(o.nest=!1)}!o.lng&&n&&n.res&&(o.lng=this.language||n.usedLng),!1!==o.nest&&(e=this.interpolator.nest(e,(...e)=>zt([r,"optionalAccess",e=>e[0]])!==e[0]||o.context?this.translate(...e,t):(this.logger.warn(`It seems you are nesting recursively key: ${e[0]} in key: ${t[0]}`),null),o)),o.interpolation&&this.interpolator.reset()}const s=o.postProcess||this.options.postProcess,i=Ut(s)?[s]:s;return null!=e&&zt([i,"optionalAccess",e=>e.length])&&!1!==o.applyPostProcessor&&(e=po.handle(i,e,t,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...n,usedParams:this.getUsedParamsDetails(o)},...o}:o,this)),e}resolve(e,t={}){let o,n,r,s,i;return Ut(e)&&(e=[e]),e.forEach(e=>{if(this.isValidLookup(o))return;const a=this.extractFromKey(e,t),c=a.key;n=c;let l=a.namespaces;this.options.fallbackNS&&(l=l.concat(this.options.fallbackNS));const u=void 0!==t.count&&!Ut(t.count),p=u&&!t.ordinal&&0===t.count,h=void 0!==t.context&&(Ut(t.context)||"number"==typeof t.context)&&""!==t.context,d=t.lngs?t.lngs:this.languageUtils.toResolveHierarchy(t.lng||this.language,t.fallbackLng);l.forEach(e=>{this.isValidLookup(o)||(i=e,fo[`${d[0]}-${e}`]||!zt([this,"access",e=>e.utils,"optionalAccess",e=>e.hasLoadedNamespace])||zt([this,"access",e=>e.utils,"optionalAccess",e=>e.hasLoadedNamespace,"call",e=>e(i)])||(fo[`${d[0]}-${e}`]=!0,this.logger.warn(`key "${n}" for languages "${d.join(", ")}" won't get resolved as namespace "${i}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),d.forEach(n=>{if(this.isValidLookup(o))return;s=n;const i=[c];if(zt([this,"access",e=>e.i18nFormat,"optionalAccess",e=>e.addLookupKeys]))this.i18nFormat.addLookupKeys(i,c,n,e,t);else{let e;u&&(e=this.pluralResolver.getSuffix(n,t.count,t));const o=`${this.options.pluralSeparator}zero`,r=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(u&&(t.ordinal&&0===e.indexOf(r)&&i.push(c+e.replace(r,this.options.pluralSeparator)),i.push(c+e),p&&i.push(c+o)),h){const n=`${c}${this.options.contextSeparator||"_"}${t.context}`;i.push(n),u&&(t.ordinal&&0===e.indexOf(r)&&i.push(n+e.replace(r,this.options.pluralSeparator)),i.push(n+e),p&&i.push(n+o))}}let a;for(;a=i.pop();)this.isValidLookup(o)||(r=a,o=this.getResource(n,e,a,t))}))})}),{res:o,usedKey:n,exactUsedKey:r,usedLng:s,usedNS:i}}isValidLookup(e){return!(void 0===e||!this.options.returnNull&&null===e||!this.options.returnEmptyString&&""===e)}getResource(e,t,o,n={}){return zt([this,"access",e=>e.i18nFormat,"optionalAccess",e=>e.getResource])?this.i18nFormat.getResource(e,t,o,n):this.resourceStore.getResource(e,t,o,n)}getUsedParamsDetails(e={}){const t=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],o=e.replace&&!Ut(e.replace);let n=o?e.replace:e;if(o&&void 0!==e.count&&(n.count=e.count),this.options.interpolation.defaultVariables&&(n={...this.options.interpolation.defaultVariables,...n}),!o){n={...n};for(const e of t)delete n[e]}return n}static hasDefaultValue(e){const t="defaultValue";for(const o in e)if(Object.prototype.hasOwnProperty.call(e,o)&&t===o.substring(0,12)&&void 0!==e[o])return!0;return!1}}class yo{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=co.create("languageUtils")}getScriptPartFromCode(e){if(!(e=so(e))||e.indexOf("-")<0)return null;const t=e.split("-");return 2===t.length?null:(t.pop(),"x"===t[t.length-1].toLowerCase()?null:this.formatLanguageCode(t.join("-")))}getLanguagePartFromCode(e){if(!(e=so(e))||e.indexOf("-")<0)return e;const t=e.split("-");return this.formatLanguageCode(t[0])}formatLanguageCode(e){if(Ut(e)&&e.indexOf("-")>-1){let t;try{t=Intl.getCanonicalLocales(e)[0]}catch(e){}return t&&this.options.lowerCaseLng&&(t=t.toLowerCase()),t||(this.options.lowerCaseLng?e.toLowerCase():e)}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return("languageOnly"===this.options.load||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){if(!e)return null;let t;return e.forEach(e=>{if(t)return;const o=this.formatLanguageCode(e);this.options.supportedLngs&&!this.isSupportedCode(o)||(t=o)}),!t&&this.options.supportedLngs&&e.forEach(e=>{if(t)return;const o=this.getScriptPartFromCode(e);if(this.isSupportedCode(o))return t=o;const n=this.getLanguagePartFromCode(e);if(this.isSupportedCode(n))return t=n;t=this.options.supportedLngs.find(e=>e===n?e:e.indexOf("-")<0&&n.indexOf("-")<0?void 0:e.indexOf("-")>0&&n.indexOf("-")<0&&e.substring(0,e.indexOf("-"))===n||0===e.indexOf(n)&&n.length>1?e:void 0)}),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t}getFallbackCodes(e,t){if(!e)return[];if("function"==typeof e&&(e=e(t)),Ut(e)&&(e=[e]),Array.isArray(e))return e;if(!t)return e.default||[];let o=e[t];return o||(o=e[this.getScriptPartFromCode(t)]),o||(o=e[this.formatLanguageCode(t)]),o||(o=e[this.getLanguagePartFromCode(t)]),o||(o=e.default),o||[]}toResolveHierarchy(e,t){const o=this.getFallbackCodes((!1===t?[]:t)||this.options.fallbackLng||[],e),n=[],r=e=>{e&&(this.isSupportedCode(e)?n.push(e):this.logger.warn(`rejecting language code not found in supportedLngs: ${e}`))};return Ut(e)&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?("languageOnly"!==this.options.load&&r(this.formatLanguageCode(e)),"languageOnly"!==this.options.load&&"currentOnly"!==this.options.load&&r(this.getScriptPartFromCode(e)),"currentOnly"!==this.options.load&&r(this.getLanguagePartFromCode(e))):Ut(e)&&r(this.formatLanguageCode(e)),o.forEach(e=>{n.indexOf(e)<0&&r(this.formatLanguageCode(e))}),n}}const vo={zero:0,one:1,two:2,few:3,many:4,other:5},xo={select:e=>1===e?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class So{constructor(e,t={}){this.languageUtils=e,this.options=t,this.logger=co.create("pluralResolver"),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(e,t={}){const o=so("dev"===e?"en":e),n=t.ordinal?"ordinal":"cardinal",r=JSON.stringify({cleanedCode:o,type:n});if(r in this.pluralRulesCache)return this.pluralRulesCache[r];let s;try{s=new Intl.PluralRules(o,{type:n})}catch(o){if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),xo;if(!e.match(/-|_/))return xo;const n=this.languageUtils.getLanguagePartFromCode(e);s=this.getRule(n,t)}return this.pluralRulesCache[r]=s,s}needsPlural(e,t={}){let o=this.getRule(e,t);return o||(o=this.getRule("dev",t)),zt([o,"optionalAccess",e=>e.resolvedOptions,"call",e=>e(),"access",e=>e.pluralCategories,"access",e=>e.length])>1}getPluralFormsOfKey(e,t,o={}){return this.getSuffixes(e,o).map(e=>`${t}${e}`)}getSuffixes(e,t={}){let o=this.getRule(e,t);return o||(o=this.getRule("dev",t)),o?o.resolvedOptions().pluralCategories.sort((e,t)=>vo[e]-vo[t]).map(e=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:""}${e}`):[]}getSuffix(e,t,o={}){const n=this.getRule(e,o);return n?`${this.options.prepend}${o.ordinal?`ordinal${this.options.prepend}`:""}${n.select(t)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix("dev",t,o))}}const Co=(e,t,o,n=".",r=!0)=>{let s=((e,t,o)=>{const n=Qt(e,o);return void 0!==n?n:Qt(t,o)})(e,t,o);return!s&&r&&Ut(o)&&(s=ro(e,o,n),void 0===s&&(s=ro(t,o,n))),s},ko=e=>e.replace(/\$/g,"$$$$");class wo{constructor(e={}){this.logger=co.create("interpolator"),this.options=e,this.format=zt([e,"optionalAccess",e=>e.interpolation,"optionalAccess",e=>e.format])||(e=>e),this.init(e)}init(e={}){e.interpolation||(e.interpolation={escapeValue:!0});const{escape:t,escapeValue:o,useRawValueToEscape:n,prefix:r,prefixEscaped:s,suffix:i,suffixEscaped:a,formatSeparator:c,unescapeSuffix:l,unescapePrefix:u,nestingPrefix:p,nestingPrefixEscaped:h,nestingSuffix:d,nestingSuffixEscaped:g,nestingOptionsSeparator:f,maxReplaces:m,alwaysFormat:b}=e.interpolation;this.escape=void 0!==t?t:to,this.escapeValue=void 0===o||o,this.useRawValueToEscape=void 0!==n&&n,this.prefix=r?Zt(r):s||"{{",this.suffix=i?Zt(i):a||"}}",this.formatSeparator=c||",",this.unescapePrefix=l?"":u||"-",this.unescapeSuffix=this.unescapePrefix?"":l||"",this.nestingPrefix=p?Zt(p):h||Zt("$t("),this.nestingSuffix=d?Zt(d):g||Zt(")"),this.nestingOptionsSeparator=f||",",this.maxReplaces=m||1e3,this.alwaysFormat=void 0!==b&&b,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=(e,t)=>zt([e,"optionalAccess",e=>e.source])===t?(e.lastIndex=0,e):new RegExp(t,"g");this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(e,t,o,n){let r,s,i;const a=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},c=e=>{if(e.indexOf(this.formatSeparator)<0){const r=Co(t,a,e,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(r,void 0,o,{...n,...t,interpolationkey:e}):r}const r=e.split(this.formatSeparator),s=r.shift().trim(),i=r.join(this.formatSeparator).trim();return this.format(Co(t,a,s,this.options.keySeparator,this.options.ignoreJSONStructure),i,o,{...n,...t,interpolationkey:s})};this.resetRegExp();const l=zt([n,"optionalAccess",e=>e.missingInterpolationHandler])||this.options.missingInterpolationHandler,u=void 0!==zt([n,"optionalAccess",e=>e.interpolation,"optionalAccess",e=>e.skipOnVariables])?n.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:e=>ko(e)},{regex:this.regexp,safeValue:e=>this.escapeValue?ko(this.escape(e)):ko(e)}].forEach(t=>{for(i=0;r=t.regex.exec(e);){const o=r[1].trim();if(s=c(o),void 0===s)if("function"==typeof l){const t=l(e,r,n);s=Ut(t)?t:""}else if(n&&Object.prototype.hasOwnProperty.call(n,o))s="";else{if(u){s=r[0];continue}this.logger.warn(`missed to pass in variable ${o} for interpolating ${e}`),s=""}else Ut(s)||this.useRawValueToEscape||(s=Ht(s));const a=t.safeValue(s);if(e=e.replace(r[0],a),u?(t.regex.lastIndex+=s.length,t.regex.lastIndex-=r[0].length):t.regex.lastIndex=0,i++,i>=this.maxReplaces)break}}),e}nest(e,t,o={}){let n,r,s;const i=(e,t)=>{const o=this.nestingOptionsSeparator;if(e.indexOf(o)<0)return e;const n=e.split(new RegExp(`${o}[ ]*{`));let r=`{${n[1]}`;e=n[0],r=this.interpolate(r,s);const i=r.match(/'/g),a=r.match(/"/g);(Vt(zt([i,"optionalAccess",e=>e.length]),()=>0)%2==0&&!a||a.length%2!=0)&&(r=r.replace(/'/g,'"'));try{s=JSON.parse(r),t&&(s={...t,...s})}catch(t){return this.logger.warn(`failed parsing options string in nesting for key ${e}`,t),`${e}${o}${r}`}return s.defaultValue&&s.defaultValue.indexOf(this.prefix)>-1&&delete s.defaultValue,e};for(;n=this.nestingRegexp.exec(e);){let a=[];s={...o},s=s.replace&&!Ut(s.replace)?s.replace:s,s.applyPostProcessor=!1,delete s.defaultValue;const c=/{.*}/.test(n[1])?n[1].lastIndexOf("}")+1:n[1].indexOf(this.formatSeparator);if(-1!==c&&(a=n[1].slice(c).split(this.formatSeparator).map(e=>e.trim()).filter(Boolean),n[1]=n[1].slice(0,c)),r=t(i.call(this,n[1].trim(),s),s),r&&n[0]===e&&!Ut(r))return r;Ut(r)||(r=Ht(r)),r||(this.logger.warn(`missed to resolve ${n[1]} for nesting ${e}`),r=""),a.length&&(r=a.reduce((e,t)=>this.format(e,t,o.lng,{...o,interpolationkey:n[1].trim()}),r.trim())),e=e.replace(n[0],r),this.regexp.lastIndex=0}return e}}const Eo=e=>{const t={};return(o,n,r)=>{let s=r;r&&r.interpolationkey&&r.formatParams&&r.formatParams[r.interpolationkey]&&r[r.interpolationkey]&&(s={...s,[r.interpolationkey]:void 0});const i=n+JSON.stringify(s);let a=t[i];return a||(a=e(so(n),r),t[i]=a),a(o)}},Oo=e=>(t,o,n)=>e(so(o),n)(t);class Ao{constructor(e={}){this.logger=co.create("formatter"),this.options=e,this.init(e)}init(e,t={interpolation:{}}){this.formatSeparator=t.interpolation.formatSeparator||",";const o=t.cacheInBuiltFormats?Eo:Oo;this.formats={number:o((e,t)=>{const o=new Intl.NumberFormat(e,{...t});return e=>o.format(e)}),currency:o((e,t)=>{const o=new Intl.NumberFormat(e,{...t,style:"currency"});return e=>o.format(e)}),datetime:o((e,t)=>{const o=new Intl.DateTimeFormat(e,{...t});return e=>o.format(e)}),relativetime:o((e,t)=>{const o=new Intl.RelativeTimeFormat(e,{...t});return e=>o.format(e,t.range||"day")}),list:o((e,t)=>{const o=new Intl.ListFormat(e,{...t});return e=>o.format(e)})}}add(e,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=Eo(t)}format(e,t,o,n={}){const r=t.split(this.formatSeparator);if(r.length>1&&r[0].indexOf("(")>1&&r[0].indexOf(")")<0&&r.find(e=>e.indexOf(")")>-1)){const e=r.findIndex(e=>e.indexOf(")")>-1);r[0]=[r[0],...r.splice(1,e)].join(this.formatSeparator)}return r.reduce((e,t)=>{const{formatName:r,formatOptions:s}=(e=>{let t=e.toLowerCase().trim();const o={};if(e.indexOf("(")>-1){const n=e.split("(");t=n[0].toLowerCase().trim();const r=n[1].substring(0,n[1].length-1);"currency"===t&&r.indexOf(":")<0?o.currency||(o.currency=r.trim()):"relativetime"===t&&r.indexOf(":")<0?o.range||(o.range=r.trim()):r.split(";").forEach(e=>{if(e){const[t,...n]=e.split(":"),r=n.join(":").trim().replace(/^'+|'+$/g,""),s=t.trim();o[s]||(o[s]=r),"false"===r&&(o[s]=!1),"true"===r&&(o[s]=!0),isNaN(r)||(o[s]=parseInt(r,10))}})}return{formatName:t,formatOptions:o}})(t);if(this.formats[r]){let t=e;try{const i=zt([n,"optionalAccess",e=>e.formatParams,"optionalAccess",e=>e[n.interpolationkey]])||{},a=i.locale||i.lng||n.locale||n.lng||o;t=this.formats[r](e,a,{...s,...n,...i})}catch(e){this.logger.warn(e)}return t}return this.logger.warn(`there was no format function for ${r}`),e},e)}}class _o extends lo{constructor(e,t,o,n={}){super(),this.backend=e,this.store=t,this.services=o,this.languageUtils=o.languageUtils,this.options=n,this.logger=co.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=n.maxParallelReads||10,this.readingCalls=0,this.maxRetries=n.maxRetries>=0?n.maxRetries:5,this.retryTimeout=n.retryTimeout>=1?n.retryTimeout:350,this.state={},this.queue=[],zt([this,"access",e=>e.backend,"optionalAccess",e=>e.init,"optionalCall",e=>e(o,n.backend,n)])}queueLoad(e,t,o,n){const r={},s={},i={},a={};return e.forEach(e=>{let n=!0;t.forEach(t=>{const i=`${e}|${t}`;!o.reload&&this.store.hasResourceBundle(e,t)?this.state[i]=2:this.state[i]<0||(1===this.state[i]?void 0===s[i]&&(s[i]=!0):(this.state[i]=1,n=!1,void 0===s[i]&&(s[i]=!0),void 0===r[i]&&(r[i]=!0),void 0===a[t]&&(a[t]=!0)))}),n||(i[e]=!0)}),(Object.keys(r).length||Object.keys(s).length)&&this.queue.push({pending:s,pendingCount:Object.keys(s).length,loaded:{},errors:[],callback:n}),{toLoad:Object.keys(r),pending:Object.keys(s),toLoadLanguages:Object.keys(i),toLoadNamespaces:Object.keys(a)}}loaded(e,t,o){const n=e.split("|"),r=n[0],s=n[1];t&&this.emit("failedLoading",r,s,t),!t&&o&&this.store.addResourceBundle(r,s,o,void 0,void 0,{skipCopy:!0}),this.state[e]=t?-1:2,t&&o&&(this.state[e]=0);const i={};this.queue.forEach(o=>{((e,t,o)=>{const{obj:n,k:r}=Yt(e,t,Object);n[r]=n[r]||[],n[r].push(o)})(o.loaded,[r],s),((e,t)=>{void 0!==e.pending[t]&&(delete e.pending[t],e.pendingCount--)})(o,e),t&&o.errors.push(t),0!==o.pendingCount||o.done||(Object.keys(o.loaded).forEach(e=>{i[e]||(i[e]={});const t=o.loaded[e];t.length&&t.forEach(t=>{void 0===i[e][t]&&(i[e][t]=!0)})}),o.done=!0,o.errors.length?o.callback(o.errors):o.callback())}),this.emit("loaded",i),this.queue=this.queue.filter(e=>!e.done)}read(e,t,o,n=0,r=this.retryTimeout,s){if(!e.length)return s(null,{});if(this.readingCalls>=this.maxParallelReads)return void this.waitingReads.push({lng:e,ns:t,fcName:o,tried:n,wait:r,callback:s});this.readingCalls++;const i=(i,a)=>{if(this.readingCalls--,this.waitingReads.length>0){const e=this.waitingReads.shift();this.read(e.lng,e.ns,e.fcName,e.tried,e.wait,e.callback)}i&&a&&n<this.maxRetries?setTimeout(()=>{this.read.call(this,e,t,o,n+1,2*r,s)},r):s(i,a)},a=this.backend[o].bind(this.backend);if(2!==a.length)return a(e,t,i);try{const o=a(e,t);o&&"function"==typeof o.then?o.then(e=>i(null,e)).catch(i):i(null,o)}catch(e){i(e)}}prepareLoading(e,t,o={},n){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),n&&n();Ut(e)&&(e=this.languageUtils.toResolveHierarchy(e)),Ut(t)&&(t=[t]);const r=this.queueLoad(e,t,o,n);if(!r.toLoad.length)return r.pending.length||n(),null;r.toLoad.forEach(e=>{this.loadOne(e)})}load(e,t,o){this.prepareLoading(e,t,{},o)}reload(e,t,o){this.prepareLoading(e,t,{reload:!0},o)}loadOne(e,t=""){const o=e.split("|"),n=o[0],r=o[1];this.read(n,r,"read",void 0,void 0,(o,s)=>{o&&this.logger.warn(`${t}loading namespace ${r} for language ${n} failed`,o),!o&&s&&this.logger.log(`${t}loaded namespace ${r} for language ${n}`,s),this.loaded(e,o,s)})}saveMissing(e,t,o,n,r,s={},i=()=>{}){if(!zt([this,"access",e=>e.services,"optionalAccess",e=>e.utils,"optionalAccess",e=>e.hasLoadedNamespace])||zt([this,"access",e=>e.services,"optionalAccess",e=>e.utils,"optionalAccess",e=>e.hasLoadedNamespace,"call",e=>e(t)])){if(null!=o&&""!==o){if(zt([this,"access",e=>e.backend,"optionalAccess",e=>e.create])){const a={...s,isUpdate:r},c=this.backend.create.bind(this.backend);if(c.length<6)try{let r;r=5===c.length?c(e,t,o,n,a):c(e,t,o,n),r&&"function"==typeof r.then?r.then(e=>i(null,e)).catch(i):i(null,r)}catch(e){i(e)}else c(e,t,o,n,i,a)}e&&e[0]&&this.store.addResource(e[0],t,o,n)}}else this.logger.warn(`did not save key "${o}" as the namespace "${t}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")}}const jo=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let t={};if("object"==typeof e[1]&&(t=e[1]),Ut(e[1])&&(t.defaultValue=e[1]),Ut(e[2])&&(t.tDescription=e[2]),"object"==typeof e[2]||"object"==typeof e[3]){const o=e[3]||e[2];Object.keys(o).forEach(e=>{t[e]=o[e]})}return t},interpolation:{escapeValue:!0,format:e=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),Lo=e=>(Ut(e.ns)&&(e.ns=[e.ns]),Ut(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),Ut(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),zt([e,"access",e=>e.supportedLngs,"optionalAccess",e=>e.indexOf,"optionalCall",e=>e("cimode")])<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),"boolean"==typeof e.initImmediate&&(e.initAsync=e.initImmediate),e),No=()=>{};class Ro extends lo{constructor(e={},t){var o;if(super(),this.options=Lo(e),this.services={},this.logger=co,this.modules={external:[]},o=this,Object.getOwnPropertyNames(Object.getPrototypeOf(o)).forEach(e=>{"function"==typeof o[e]&&(o[e]=o[e].bind(o))}),t&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,t),this;setTimeout(()=>{this.init(e,t)},0)}}init(e={},t){this.isInitializing=!0,"function"==typeof e&&(t=e,e={}),null==e.defaultNS&&e.ns&&(Ut(e.ns)?e.defaultNS=e.ns:e.ns.indexOf("translation")<0&&(e.defaultNS=e.ns[0]));const o=jo();var n;this.options={...o,...this.options,...Lo(e)},this.options.interpolation={...o.interpolation,...this.options.interpolation},void 0!==e.keySeparator&&(this.options.userDefinedKeySeparator=e.keySeparator),void 0!==e.nsSeparator&&(this.options.userDefinedNsSeparator=e.nsSeparator),"function"!=typeof this.options.overloadTranslationOptionHandler&&(this.options.overloadTranslationOptionHandler=o.overloadTranslationOptionHandler),!1===this.options.showSupportNotice||(zt([n=this,"optionalAccess",e=>e.modules,"optionalAccess",e=>e.backend,"optionalAccess",e=>e.name,"optionalAccess",e=>e.indexOf,"call",e=>e("Locize")])>0||zt([n,"optionalAccess",e=>e.modules,"optionalAccess",e=>e.backend,"optionalAccess",e=>e.constructor,"optionalAccess",e=>e.name,"optionalAccess",e=>e.indexOf,"call",e=>e("Locize")])>0||zt([n,"optionalAccess",e=>e.options,"optionalAccess",e=>e.backend,"optionalAccess",e=>e.backends])&&n.options.backend.backends.some(e=>zt([e,"optionalAccess",e=>e.name,"access",e=>e.indexOf,"call",e=>e("Locize")])>0||zt([e,"optionalAccess",e=>e.constructor,"optionalAccess",e=>e.name,"access",e=>e.indexOf,"call",e=>e("Locize")])>0))||"undefined"!=typeof console&&void 0!==console.info&&console.info("🌐 i18next is maintained with support from locize.com — consider powering your project with managed localization (AI, CDN, integrations): https://locize.com 💙");const r=e=>e?"function"==typeof e?new e:e:null;if(!this.options.isClone){let e;this.modules.logger?co.init(r(this.modules.logger),this.options):co.init(null,this.options),e=this.modules.formatter?this.modules.formatter:Ao;const t=new yo(this.options);this.store=new uo(this.options.resources,this.options);const n=this.services;n.logger=co,n.resourceStore=this.store,n.languageUtils=t,n.pluralResolver=new So(t,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix});this.options.interpolation.format&&this.options.interpolation.format!==o.interpolation.format&&this.logger.deprecate("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"),!e||this.options.interpolation.format&&this.options.interpolation.format!==o.interpolation.format||(n.formatter=r(e),n.formatter.init&&n.formatter.init(n,this.options),this.options.interpolation.format=n.formatter.format.bind(n.formatter)),n.interpolator=new wo(this.options),n.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},n.backendConnector=new _o(r(this.modules.backend),n.resourceStore,n,this.options),n.backendConnector.on("*",(e,...t)=>{this.emit(e,...t)}),this.modules.languageDetector&&(n.languageDetector=r(this.modules.languageDetector),n.languageDetector.init&&n.languageDetector.init(n,this.options.detection,this.options)),this.modules.i18nFormat&&(n.i18nFormat=r(this.modules.i18nFormat),n.i18nFormat.init&&n.i18nFormat.init(this)),this.translator=new bo(this.services,this.options),this.translator.on("*",(e,...t)=>{this.emit(e,...t)}),this.modules.external.forEach(e=>{e.init&&e.init(this)})}if(this.format=this.options.interpolation.format,t||(t=No),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const e=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);e.length>0&&"dev"!==e[0]&&(this.options.lng=e[0])}this.services.languageDetector||this.options.lng||this.logger.warn("init: no languageDetector is used and no lng is defined");["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(e=>{this[e]=(...t)=>this.store[e](...t)});["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(e=>{this[e]=(...t)=>(this.store[e](...t),this)});const s=Kt(),i=()=>{const e=(e,o)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),s.resolve(o),t(e,o)};if(this.languages&&!this.isInitialized)return e(null,this.t.bind(this));this.changeLanguage(this.options.lng,e)};return this.options.resources||!this.options.initAsync?i():setTimeout(i,0),s}loadResources(e,t=No){let o=t;const n=Ut(e)?e:this.language;if("function"==typeof e&&(o=e),!this.options.resources||this.options.partialBundledLanguages){if("cimode"===zt([n,"optionalAccess",e=>e.toLowerCase,"call",e=>e()])&&(!this.options.preload||0===this.options.preload.length))return o();const e=[],t=t=>{if(!t)return;if("cimode"===t)return;this.services.languageUtils.toResolveHierarchy(t).forEach(t=>{"cimode"!==t&&e.indexOf(t)<0&&e.push(t)})};if(n)t(n);else{this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(e=>t(e))}zt([this,"access",e=>e.options,"access",e=>e.preload,"optionalAccess",e=>e.forEach,"optionalCall",e=>e(e=>t(e))]),this.services.backendConnector.load(e,this.options.ns,e=>{e||this.resolvedLanguage||!this.language||this.setResolvedLanguage(this.language),o(e)})}else o(null)}reloadResources(e,t,o){const n=Kt();return"function"==typeof e&&(o=e,e=void 0),"function"==typeof t&&(o=t,t=void 0),e||(e=this.languages),t||(t=this.options.ns),o||(o=No),this.services.backendConnector.reload(e,t,e=>{n.resolve(),o(e)}),n}use(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return"backend"===e.type&&(this.modules.backend=e),("logger"===e.type||e.log&&e.warn&&e.error)&&(this.modules.logger=e),"languageDetector"===e.type&&(this.modules.languageDetector=e),"i18nFormat"===e.type&&(this.modules.i18nFormat=e),"postProcessor"===e.type&&po.addPostProcessor(e),"formatter"===e.type&&(this.modules.formatter=e),"3rdParty"===e.type&&this.modules.external.push(e),this}setResolvedLanguage(e){if(e&&this.languages&&!(["cimode","dev"].indexOf(e)>-1)){for(let e=0;e<this.languages.length;e++){const t=this.languages[e];if(!(["cimode","dev"].indexOf(t)>-1)&&this.store.hasLanguageSomeTranslations(t)){this.resolvedLanguage=t;break}}!this.resolvedLanguage&&this.languages.indexOf(e)<0&&this.store.hasLanguageSomeTranslations(e)&&(this.resolvedLanguage=e,this.languages.unshift(e))}}changeLanguage(e,t){this.isLanguageChangingTo=e;const o=Kt();this.emit("languageChanging",e);const n=e=>{this.language=e,this.languages=this.services.languageUtils.toResolveHierarchy(e),this.resolvedLanguage=void 0,this.setResolvedLanguage(e)},r=(r,s)=>{s?this.isLanguageChangingTo===e&&(n(s),this.translator.changeLanguage(s),this.isLanguageChangingTo=void 0,this.emit("languageChanged",s),this.logger.log("languageChanged",s)):this.isLanguageChangingTo=void 0,o.resolve((...e)=>this.t(...e)),t&&t(r,(...e)=>this.t(...e))},s=t=>{e||t||!this.services.languageDetector||(t=[]);const o=Ut(t)?t:t&&t[0],s=this.store.hasLanguageSomeTranslations(o)?o:this.services.languageUtils.getBestMatchFromCodes(Ut(t)?[t]:t);s&&(this.language||n(s),this.translator.language||this.translator.changeLanguage(s),zt([this,"access",e=>e.services,"access",e=>e.languageDetector,"optionalAccess",e=>e.cacheUserLanguage,"optionalCall",e=>e(s)])),this.loadResources(s,e=>{r(e,s)})};return e||!this.services.languageDetector||this.services.languageDetector.async?!e&&this.services.languageDetector&&this.services.languageDetector.async?0===this.services.languageDetector.detect.length?this.services.languageDetector.detect().then(s):this.services.languageDetector.detect(s):s(e):s(this.services.languageDetector.detect()),o}getFixedT(e,t,o){const n=(e,t,...r)=>{let s;s="object"!=typeof t?this.options.overloadTranslationOptionHandler([e,t].concat(r)):{...t},s.lng=s.lng||n.lng,s.lngs=s.lngs||n.lngs,s.ns=s.ns||n.ns,""!==s.keyPrefix&&(s.keyPrefix=s.keyPrefix||o||n.keyPrefix);const i=this.options.keySeparator||".";let a;return s.keyPrefix&&Array.isArray(e)?a=e.map(e=>("function"==typeof e&&(e=go(e,{...this.options,...t})),`${s.keyPrefix}${i}${e}`)):("function"==typeof e&&(e=go(e,{...this.options,...t})),a=s.keyPrefix?`${s.keyPrefix}${i}${e}`:e),this.t(a,s)};return Ut(e)?n.lng=e:n.lngs=e,n.ns=t,n.keyPrefix=o,n}t(...e){return zt([this,"access",e=>e.translator,"optionalAccess",e=>e.translate,"call",t=>t(...e)])}exists(...e){return zt([this,"access",e=>e.translator,"optionalAccess",e=>e.exists,"call",t=>t(...e)])}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e,t={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const o=t.lng||this.resolvedLanguage||this.languages[0],n=!!this.options&&this.options.fallbackLng,r=this.languages[this.languages.length-1];if("cimode"===o.toLowerCase())return!0;const s=(e,t)=>{const o=this.services.backendConnector.state[`${e}|${t}`];return-1===o||0===o||2===o};if(t.precheck){const e=t.precheck(this,s);if(void 0!==e)return e}return!!this.hasResourceBundle(o,e)||(!(this.services.backendConnector.backend&&(!this.options.resources||this.options.partialBundledLanguages))||!(!s(o,e)||n&&!s(r,e)))}loadNamespaces(e,t){const o=Kt();return this.options.ns?(Ut(e)&&(e=[e]),e.forEach(e=>{this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}),this.loadResources(e=>{o.resolve(),t&&t(e)}),o):(t&&t(),Promise.resolve())}loadLanguages(e,t){const o=Kt();Ut(e)&&(e=[e]);const n=this.options.preload||[],r=e.filter(e=>n.indexOf(e)<0&&this.services.languageUtils.isSupportedCode(e));return r.length?(this.options.preload=n.concat(r),this.loadResources(e=>{o.resolve(),t&&t(e)}),o):(t&&t(),Promise.resolve())}dir(e){if(e||(e=this.resolvedLanguage||(zt([this,"access",e=>e.languages,"optionalAccess",e=>e.length])>0?this.languages[0]:this.language)),!e)return"rtl";try{const t=new Intl.Locale(e);if(t&&t.getTextInfo){const e=t.getTextInfo();if(e&&e.direction)return e.direction}}catch(e){}const t=zt([this,"access",e=>e.services,"optionalAccess",e=>e.languageUtils])||new yo(jo());return e.toLowerCase().indexOf("-latn")>1?"ltr":["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"].indexOf(t.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(e={},t){const o=new Ro(e,t);return o.createInstance=Ro.createInstance,o}cloneInstance(e={},t=No){const o=e.forkResourceStore;o&&delete e.forkResourceStore;const n={...this.options,...e,isClone:!0},r=new Ro(n);void 0===e.debug&&void 0===e.prefix||(r.logger=r.logger.clone(e));if(["store","services","language"].forEach(e=>{r[e]=this[e]}),r.services={...this.services},r.services.utils={hasLoadedNamespace:r.hasLoadedNamespace.bind(r)},o){const e=Object.keys(this.store.data).reduce((e,t)=>(e[t]={...this.store.data[t]},e[t]=Object.keys(e[t]).reduce((o,n)=>(o[n]={...e[t][n]},o),e[t]),e),{});r.store=new uo(e,n),r.services.resourceStore=r.store}if(e.interpolation){const t={...jo().interpolation,...this.options.interpolation,...e.interpolation},o={...n,interpolation:t};r.services.interpolator=new wo(o)}return r.translator=new bo(r.services,n),r.translator.on("*",(e,...t)=>{r.emit(e,...t)}),r.init(n,t),r.translator.options=n,r.translator.backendConnector.services.utils={hasLoadedNamespace:r.hasLoadedNamespace.bind(r)},r}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const Po=Ro.createInstance();Po.createInstance,Po.dir,Po.init,Po.loadResources,Po.reloadResources,Po.use,Po.changeLanguage,Po.getFixedT,Po.t,Po.exists,Po.setDefaultNamespace,Po.hasLoadedNamespace,Po.loadNamespaces,Po.loadLanguages;Po.init({fallbackLng:"en",lng:"en",debug:!0,resources:{en:{translation:{categorize:{limitMaxChoicesPerCategory:"You've reached the limit of {{maxChoicesPerCategory}} responses per area. To add another response, one must first be removed.",maxChoicesPerCategoryRestriction:"To change this value to {{maxChoicesPerCategory}}, each category must have {{maxChoicesPerCategory}} or fewer answer choice[s]."},ebsr:{part:"Part {{index}}"},numberLine:{addElementLimit_one:"You can only add {{count}} element",addElementLimit_other:"You can only add {{count}} elements",clearAll:"Clear all"},imageClozeAssociation:{reachedLimit_one:"You’ve reached the limit of {{count}} response per area. To add another response, one must first be removed.",reachedLimit_other:"Full"},drawingResponse:{fillColor:"Fill color",outlineColor:"Outline color",noFill:"No fill",lightblue:"Light blue",lightyellow:"Light yellow",red:"Red",orange:"Orange",yellow:"Yellow",violet:"Violet",blue:"Blue",green:"Green",white:"White",black:"Black",onDoubleClick:"Double click to edit this text. Press Enter to submit."},charting:{addCategory:"Add category",actions:"Actions",add:"Add",delete:"Delete",newLabel:"New label",reachedLimit_other:"There can't be more than {{count}} categories.",keyLegend:{incorrectAnswer:"Student incorrect answer",correctAnswer:"Student correct answer",correctKeyAnswer:"Answer key correct"}},graphing:{point:"Point",circle:"Circle",line:"Line",parabola:"Parabola",absolute:"Absolute Value",exponential:"Exponential",polygon:"Polygon",ray:"Ray",segment:"Segment",sine:"Sine",vector:"Vector",label:"Label",redo:"Redo",reset:"Reset"},mathInline:{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."},multipleChoice:{minSelections:"Select at least {{minSelections}}.",maxSelections_one:"Only {{maxSelections}} answer is allowed.",maxSelections_other:"Only {{maxSelections}} answers are allowed.",minmaxSelections_equal:"Select {{minSelections}}.",minmaxSelections_range:"Select between {{minSelections}} and {{maxSelections}}."},selectText:{correctAnswerSelected:"Correct",correctAnswerNotSelected:"Correct Answer Not Selected",incorrectSelection:"Incorrect Selection",key:"Key"}},common:{undo:"Undo",clearAll:"Clear all",correct:"Correct",incorrect:"Incorrect",showCorrectAnswer:"Show correct answer",hideCorrectAnswer:"Hide correct answer",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.",warning:"Warning",showNote:"Show Note",hideNote:"Hide Note",cancel:"Cancel"}},es:{translation:{categorize:{limitMaxChoicesPerCategory:"Has alcanzado el límite de {{maxChoicesPerCategory}} respuestas por área. Para agregar otra respuesta, primero se debe eliminar una respuesta.",maxChoicesPerCategoryRestriction:"Para cambiar este valor a {{maxChoicesPerCategory}}, cada categoría debe tener {{maxChoicesPerCategory}} o menos opciones de respuesta"},ebsr:{part:"Parte {{index}}"},numberLine:{addElementLimit_one:"Solo puedes agregar {{count}} elemento",addElementLimit_other:"Solo puedes agregar {{count}} elementos",clearAll:"Borrar todo"},imageClozeAssociation:{reachedLimit_one:"Has alcanzado el límite de {{count}} respuesta por área. Para agregar otra respuesta, primero se debe eliminar una respuesta.",reachedLimit_other:"Lleno"},drawingResponse:{fillColor:"Color de relleno",outlineColor:"Color del contorno",noFill:"Sin relleno",lightblue:"Azul claro",lightyellow:"Amarillo claro",red:"Rojo",orange:"Naranja",yellow:"Amarillo",violet:"Violeta",blue:"Azul",green:"Verde",white:"Blanco",black:"Negro",onDoubleClick:"Haz doble clic para revisar este texto. Presiona el botón de ingreso para enviar"},charting:{addCategory:"Añadir categoría",actions:"Acciones",add:"Añadir",delete:"Eliminar",newLabel:"Nueva etiqueta",reachedLimit_other:"No puede haber más de {{count}} categorías.",keyLegend:{incorrectAnswer:"Respuesta incorrecta del estudiante",correctAnswer:"Respuesta correcta del estudiante",correctKeyAnswer:"Clave de respuesta correcta"}},graphing:{point:"Punto",circle:"Circulo",line:"Línea",parabola:"Parábola",absolute:"Valor absoluto",exponential:"Exponencial",polygon:"Polígono",ray:"Semirrecta",segment:"Segmento ",sine:"Seno",vector:"Vector",label:"Etiqueta",redo:"Rehacer",reset:"Reiniciar"},mathInline:{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."},multipleChoice:{minSelections:"Seleccione al menos {{minSelections}}.",maxSelections_one:"Sólo se permite {{maxSelections}} respuesta.",maxSelections_other:"Sólo se permiten {{maxSelections}} respuestas.",minmaxSelections_equal:"Seleccione {{minSelections}}.",minmaxSelections_range:"Seleccione entre {{minSelections}} y {{maxSelections}}."},selectText:{correctAnswerSelected:"Respuesta Correcta",correctAnswerNotSelected:"Respuesta Correcta No Seleccionada",incorrectSelection:"Selección Incorrecta",key:"Clave"}},common:{undo:"Deshacer",clearAll:"Borrar todo",correct:"Correct",incorrect:"Incorrect",showCorrectAnswer:"Mostrar respuesta correcta",hideCorrectAnswer:"Ocultar respuesta correcta",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.",warning:"Advertencia",showNote:"Mostrar Nota",hideNote:"Ocultar Nota",cancel:"Cancelar"}}}});var $o={translator:{...Po,t:(e,t)=>{const{lng:o}=t;switch(o){case"en_US":case"en-US":t.lng="en";break;case"es_ES":case"es-ES":case"es_MX":case"es-MX":t.lng="es"}return Po.t(e,{lng:o,...t})}},languageOptions:[{value:"en_US",label:"English (US)"},{value:"es_ES",label:"Spanish"}]};function To(){return To=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var n in o)({}).hasOwnProperty.call(o,n)&&(e[n]=o[n])}return e},To.apply(null,arguments)}function Io(e,t){if(null==e)return{};var o={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(-1!==t.indexOf(n))continue;o[n]=e[n]}return o}function Mo(e,t){return Mo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Mo(e,t)}function Fo(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Mo(e,t)}function Bo(e,t){return e.replace(new RegExp("(^|\\s)"+t+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}var Do=!1;var Vo=t.createContext(null),zo=function(e){return e.scrollTop};const Uo=t,Ko=e;var Ho="unmounted",Wo="exited",qo="entering",Jo="entered",Yo="exiting",Go=function(e){function t(t,o){var n;n=e.call(this,t,o)||this;var r,s=o&&!o.isMounting?t.enter:t.appear;return n.appearStatus=null,t.in?s?(r=Wo,n.appearStatus=qo):r=Jo:r=t.unmountOnExit||t.mountOnEnter?Ho:Wo,n.state={status:r},n.nextCallback=null,n}Fo(t,e),t.getDerivedStateFromProps=function(e,t){return e.in&&t.status===Ho?{status:Wo}:null};var o=t.prototype;return o.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},o.componentDidUpdate=function(e){var t=null;if(e!==this.props){var o=this.state.status;this.props.in?o!==qo&&o!==Jo&&(t=qo):o!==qo&&o!==Jo||(t=Yo)}this.updateStatus(!1,t)},o.componentWillUnmount=function(){this.cancelNextCallback()},o.getTimeouts=function(){var e,t,o,n=this.props.timeout;return e=t=o=n,null!=n&&"number"!=typeof n&&(e=n.exit,t=n.enter,o=void 0!==n.appear?n.appear:t),{exit:e,enter:t,appear:o}},o.updateStatus=function(e,t){if(void 0===e&&(e=!1),null!==t)if(this.cancelNextCallback(),t===qo){if(this.props.unmountOnExit||this.props.mountOnEnter){var o=this.props.nodeRef?this.props.nodeRef.current:Ko.findDOMNode(this);o&&zo(o)}this.performEnter(e)}else this.performExit();else this.props.unmountOnExit&&this.state.status===Wo&&this.setState({status:Ho})},o.performEnter=function(e){var t=this,o=this.props.enter,n=this.context?this.context.isMounting:e,r=this.props.nodeRef?[n]:[Ko.findDOMNode(this),n],s=r[0],i=r[1],a=this.getTimeouts(),c=n?a.appear:a.enter;!e&&!o||Do?this.safeSetState({status:Jo},function(){t.props.onEntered(s)}):(this.props.onEnter(s,i),this.safeSetState({status:qo},function(){t.props.onEntering(s,i),t.onTransitionEnd(c,function(){t.safeSetState({status:Jo},function(){t.props.onEntered(s,i)})})}))},o.performExit=function(){var e=this,t=this.props.exit,o=this.getTimeouts(),n=this.props.nodeRef?void 0:Ko.findDOMNode(this);t&&!Do?(this.props.onExit(n),this.safeSetState({status:Yo},function(){e.props.onExiting(n),e.onTransitionEnd(o.exit,function(){e.safeSetState({status:Wo},function(){e.props.onExited(n)})})})):this.safeSetState({status:Wo},function(){e.props.onExited(n)})},o.cancelNextCallback=function(){null!==this.nextCallback&&(this.nextCallback.cancel(),this.nextCallback=null)},o.safeSetState=function(e,t){t=this.setNextCallback(t),this.setState(e,t)},o.setNextCallback=function(e){var t=this,o=!0;return this.nextCallback=function(n){o&&(o=!1,t.nextCallback=null,e(n))},this.nextCallback.cancel=function(){o=!1},this.nextCallback},o.onTransitionEnd=function(e,t){this.setNextCallback(t);var o=this.props.nodeRef?this.props.nodeRef.current:Ko.findDOMNode(this),n=null==e&&!this.props.addEndListener;if(o&&!n){if(this.props.addEndListener){var r=this.props.nodeRef?[this.nextCallback]:[o,this.nextCallback],s=r[0],i=r[1];this.props.addEndListener(s,i)}null!=e&&setTimeout(this.nextCallback,e)}else setTimeout(this.nextCallback,0)},o.render=function(){var e=this.state.status;if(e===Ho)return null;var t=this.props,o=t.children;t.in,t.mountOnEnter,t.unmountOnExit,t.appear,t.enter,t.exit,t.timeout,t.addEndListener,t.onEnter,t.onEntering,t.onEntered,t.onExit,t.onExiting,t.onExited,t.nodeRef;var n=Io(t,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]);return Uo.createElement(Vo.Provider,{value:null},"function"==typeof o?o(e,n):Uo.cloneElement(Uo.Children.only(o),n))},t}(Uo.Component);function Qo(){}Go.contextType=Vo,Go.propTypes={},Go.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:Qo,onEntering:Qo,onEntered:Qo,onExit:Qo,onExiting:Qo,onExited:Qo},Go.UNMOUNTED=Ho,Go.EXITED=Wo,Go.ENTERING=qo,Go.ENTERED=Jo,Go.EXITING=Yo;var Xo=Go;const Zo=t;var en=function(e,t){return e&&t&&t.split(" ").forEach(function(t){return n=t,void((o=e).classList?o.classList.add(n):function(e,t){return e.classList?!!t&&e.classList.contains(t):-1!==(" "+(e.className.baseVal||e.className)+" ").indexOf(" "+t+" ")}(o,n)||("string"==typeof o.className?o.className=o.className+" "+n:o.setAttribute("class",(o.className&&o.className.baseVal||"")+" "+n)));var o,n})},tn=function(e,t){return e&&t&&t.split(" ").forEach(function(t){return n=t,void((o=e).classList?o.classList.remove(n):"string"==typeof o.className?o.className=Bo(o.className,n):o.setAttribute("class",Bo(o.className&&o.className.baseVal||"",n)));var o,n})},on=function(e){function t(){for(var t,o=arguments.length,n=new Array(o),r=0;r<o;r++)n[r]=arguments[r];return(t=e.call.apply(e,[this].concat(n))||this).appliedClasses={appear:{},enter:{},exit:{}},t.onEnter=function(e,o){var n=t.resolveArguments(e,o),r=n[0],s=n[1];t.removeClasses(r,"exit"),t.addClass(r,s?"appear":"enter","base"),t.props.onEnter&&t.props.onEnter(e,o)},t.onEntering=function(e,o){var n=t.resolveArguments(e,o),r=n[0],s=n[1]?"appear":"enter";t.addClass(r,s,"active"),t.props.onEntering&&t.props.onEntering(e,o)},t.onEntered=function(e,o){var n=t.resolveArguments(e,o),r=n[0],s=n[1]?"appear":"enter";t.removeClasses(r,s),t.addClass(r,s,"done"),t.props.onEntered&&t.props.onEntered(e,o)},t.onExit=function(e){var o=t.resolveArguments(e)[0];t.removeClasses(o,"appear"),t.removeClasses(o,"enter"),t.addClass(o,"exit","base"),t.props.onExit&&t.props.onExit(e)},t.onExiting=function(e){var o=t.resolveArguments(e)[0];t.addClass(o,"exit","active"),t.props.onExiting&&t.props.onExiting(e)},t.onExited=function(e){var o=t.resolveArguments(e)[0];t.removeClasses(o,"exit"),t.addClass(o,"exit","done"),t.props.onExited&&t.props.onExited(e)},t.resolveArguments=function(e,o){return t.props.nodeRef?[t.props.nodeRef.current,e]:[e,o]},t.getClassNames=function(e){var o=t.props.classNames,n="string"==typeof o,r=n?""+(n&&o?o+"-":"")+e:o[e];return{baseClassName:r,activeClassName:n?r+"-active":o[e+"Active"],doneClassName:n?r+"-done":o[e+"Done"]}},t}Fo(t,e);var o=t.prototype;return o.addClass=function(e,t,o){var n=this.getClassNames(t)[o+"ClassName"],r=this.getClassNames("enter").doneClassName;"appear"===t&&"done"===o&&r&&(n+=" "+r),"active"===o&&e&&zo(e),n&&(this.appliedClasses[t][o]=n,en(e,n))},o.removeClasses=function(e,t){var o=this.appliedClasses[t],n=o.base,r=o.active,s=o.done;this.appliedClasses[t]={},n&&tn(e,n),r&&tn(e,r),s&&tn(e,s)},o.render=function(){var e=this.props;e.classNames;var t=Io(e,["classNames"]);return Zo.createElement(Xo,To({},t,{onEnter:this.onEnter,onEntered:this.onEntered,onEntering:this.onEntering,onExit:this.onExit,onExiting:this.onExiting,onExited:this.onExited}))},t}(Zo.Component);on.defaultProps={classNames:""},on.propTypes={};var nn=on;const{Children:rn}=t,{cloneElement:sn}=t,{isValidElement:an}=t;function cn(e,t){var o=Object.create(null);return e&&rn.map(e,function(e){return e}).forEach(function(e){o[e.key]=function(e){return t&&an(e)?t(e):e}(e)}),o}function ln(e,t,o){return null!=o[t]?o[t]:e.props[t]}function un(e,t,o){var n=cn(e.children),r=function(e,t){function o(o){return o in t?t[o]:e[o]}e=e||{},t=t||{};var n,r=Object.create(null),s=[];for(var i in e)i in t?s.length&&(r[i]=s,s=[]):s.push(i);var a={};for(var c in t){if(r[c])for(n=0;n<r[c].length;n++){var l=r[c][n];a[r[c][n]]=o(l)}a[c]=o(c)}for(n=0;n<s.length;n++)a[s[n]]=o(s[n]);return a}(t,n);return Object.keys(r).forEach(function(s){var i=r[s];if(an(i)){var a=s in t,c=s in n,l=t[s],u=an(l)&&!l.props.in;!c||a&&!u?c||!a||u?c&&a&&an(l)&&(r[s]=sn(i,{onExited:o.bind(null,i),in:l.props.in,exit:ln(i,"exit",e),enter:ln(i,"enter",e)})):r[s]=sn(i,{in:!1}):r[s]=sn(i,{onExited:o.bind(null,i),in:!0,exit:ln(i,"exit",e),enter:ln(i,"enter",e)})}}),r}const pn=t;var hn=Object.values||function(e){return Object.keys(e).map(function(t){return e[t]})},dn=function(e){function t(t,o){var n,r=(n=e.call(this,t,o)||this).handleExited.bind(function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n));return n.state={contextValue:{isMounting:!0},handleExited:r,firstRender:!0},n}Fo(t,e);var o=t.prototype;return o.componentDidMount=function(){this.mounted=!0,this.setState({contextValue:{isMounting:!1}})},o.componentWillUnmount=function(){this.mounted=!1},t.getDerivedStateFromProps=function(e,t){var o,n,r=t.children,s=t.handleExited;return{children:t.firstRender?(o=e,n=s,cn(o.children,function(e){return sn(e,{onExited:n.bind(null,e),in:!0,appear:ln(e,"appear",o),enter:ln(e,"enter",o),exit:ln(e,"exit",o)})})):un(e,r,s),firstRender:!1}},o.handleExited=function(e,t){var o=cn(this.props.children);e.key in o||(e.props.onExited&&e.props.onExited(t),this.mounted&&this.setState(function(t){var o=To({},t.children);return delete o[e.key],{children:o}}))},o.render=function(){var e=this.props,t=e.component,o=e.childFactory,n=Io(e,["component","childFactory"]),r=this.state.contextValue,s=hn(this.state.children).map(o);return delete n.appear,delete n.enter,delete n.exit,null===t?pn.createElement(Vo.Provider,{value:r},s):pn.createElement(Vo.Provider,{value:r},pn.createElement(t,n,s))},t}(pn.Component);dn.propTypes={},dn.defaultProps={component:"div",childFactory:function(e){return e}};var gn=dn;const fn=t,{styled:mn}=o,{Box:bn}=n,yn=r,{color:vn}=s,xn=mn(bn)({width:"33px",height:"33px","& svg":{position:"absolute",display:"inline-block",width:"33px",height:"33px",verticalAlign:"middle","& hide":{display:"none"}}}),Sn=mn("svg")({"& .incorrect-fill":{fill:`var(--feedback-incorrect-bg-color, ${vn.incorrect()})`},"& .correct-fill":{fill:`var(--feedback-correct-bg-color, ${vn.correct()})`}}),Cn=mn("div")({position:"relative","&.feedback-tick-enter":{opacity:"0",left:"-50px"},"&.feedback-tick-enter-active":{opacity:"1",left:"0px",transition:"left 500ms ease-in 200ms, opacity 500ms linear 200ms"},"&.feedback-tick-exit":{opacity:"1",left:"0px"},"&.feedback-tick-exit-active":{opacity:"0",left:"-50px",transition:"left 300ms ease-in, opacity 300ms"}});class kn extends fn.Component{static __initStatic(){this.propTypes={correctness:yn.string}}constructor(e){super(e),kn.prototype.__init.call(this),kn.prototype.__init2.call(this),this.nodeRef=fn.createRef()}__init(){this.getIncorrectIcon=()=>fn.createElement(Sn,{key:"1",preserveAspectRatio:"xMinYMin meet",x:"0px",y:"0px",viewBox:"0 0 44 40",style:{enableBackground:"new 0 0 44 40"}},fn.createElement("g",null,fn.createElement("rect",{x:"11",y:"17.3",transform:"matrix(0.7071 -0.7071 0.7071 0.7071 -7.852 19.2507)",className:"incorrect-fill",width:"16.6",height:"3.7"}),fn.createElement("rect",{x:"17.4",y:"10.7",transform:"matrix(0.7071 -0.7071 0.7071 0.7071 -7.8175 19.209)",className:"incorrect-fill",width:"3.7",height:"16.6"})))}__init2(){this.getCorrectIcon=()=>fn.createElement(Sn,{key:"2",preserveAspectRatio:"xMinYMin meet",version:"1.1",x:"0px",y:"0px",viewBox:"0 0 44 40",style:{enableBackground:"new 0 0 44 40"}},fn.createElement("polygon",{className:"correct-fill",points:"19.1,28.6 11.8,22.3 14.4,19.2 17.9,22.1 23.9,11.4 27.5,13.4"}))}render(){const{correctness:e}=this.props,t=(()=>"incorrect"===e?this.getIncorrectIcon():"correct"===e?this.getCorrectIcon():null)();return fn.createElement(xn,null,fn.createElement(gn,null,e&&fn.createElement(nn,{nodeRef:this.nodeRef,classNames:{enter:"feedback-tick-enter",enterActive:"feedback-tick-enter-active",exit:"feedback-tick-exit",exitActive:"feedback-tick-exit-active"},timeout:{enter:700,exit:300}},fn.createElement(Cn,{ref:this.nodeRef},t))))}}kn.__initStatic();const{FormControlLabel:wn}=n,{Box:En}=n,{Checkbox:On}=n,{Radio:An}=n,_n=t,jn=r,{styled:Ln}=o,{Feedback:Nn}=s,{color:Rn}=s,{PreviewPrompt:Pn}=s,$n=i,Tn="multiple-choice-component",In=Ln(En)({display:"flex",alignItems:"center",backgroundColor:Rn.background()}),Mn=Ln(En)({display:"flex",alignItems:"center",backgroundColor:Rn.background(),flex:1,"& .MuiFormControlLabel-root":{marginLeft:"-14px"},"& label":{color:Rn.text(),"& > span":{fontSize:"inherit"},"& > .MuiButtonBase-root":{padding:"12px"}}}),Fn=Ln("span")(({theme:e})=>({display:"flex",alignItems:"center","& > span":{marginLeft:`-${e.spacing(1)}px`}})),Bn=Ln("span")({position:"absolute",left:"-10000px",top:"auto",width:"1px",height:"1px",overflow:"hidden"}),Dn=Ln(wn)({"& .MuiFormControlLabel-label":{color:`${Rn.text()} !important`,backgroundColor:Rn.background(),letterSpacing:"normal"},"&.Mui-disabled *":{cursor:"not-allowed !important"}}),Vn=(e,t)=>({[`&.${Tn}`]:{color:`var(--choice-input-${e}, ${t}) !important`}}),zn=e=>{const t=t=>e?`${e}-${t}`:t;return{[t("root")]:{...Vn("color",Rn.text()),...e?{}:{"&:hover":{color:`${Rn.primaryLight()} !important`}},..."correct"===e?Vn("correct-color",Rn.text()):{},..."incorrect"===e?Vn("incorrect-color",Rn.incorrect()):{}},[t("checked")]:{..."correct"===e?Vn("correct-selected-color",Rn.correct()):{},..."incorrect"===e?Vn("incorrect-checked",Rn.incorrect()):{},...e?{}:Vn("selected-color",Rn.primary())},[t("disabled")]:{...Vn("disabled-color",Rn.text()),..."correct"===e?Vn("correct-disabled-color",Rn.disabled()):{},..."incorrect"===e?Vn("incorrect-disabled-color",Rn.disabled()):{},opacity:.6,cursor:"not-allowed !important",pointerEvents:"initial !important"},focusVisibleUnchecked:{outline:`2px solid ${Rn.focusUncheckedBorder()}`,backgroundColor:Rn.focusUnchecked()},focusVisibleChecked:{outline:`2px solid ${Rn.focusCheckedBorder()}`,backgroundColor:Rn.focusChecked()}}},Un=Ln(On,{shouldForwardProp:e=>"correctness"!==e})(({correctness:e})=>{const t=zn(e),o=t=>e?`${e}-${t}`:t;return{[`&.${Tn}`]:{...t[o("root")],"&.Mui-checked":t[o("checked")],"&.Mui-disabled":e?{}:t[o("disabled")]},"&.Mui-focusVisible":{"&:not(.Mui-checked)":t.focusVisibleUnchecked,"&.Mui-checked":t.focusVisibleChecked}}}),Kn=e=>{const{correctness:t,checked:o,onChange:n,disabled:r,value:s,id:i,onKeyDown:a,inputRef:c}=e,l={checked:o,onChange:n,disabled:r,value:s};return _n.createElement(Un,{id:i,slotProps:{input:{ref:c}},onKeyDown:a,disableRipple:!0,...l,correctness:t,className:Tn})},Hn=Ln(An,{shouldForwardProp:e=>"correctness"!==e})(({correctness:e})=>{const t=zn(e),o=t=>e?`${e}-${t}`:t;return{[`&.${Tn}`]:{...t[o("root")],"&.Mui-checked":t[o("checked")],"&.Mui-disabled":e?{}:t[o("disabled")]},"&.Mui-focusVisible":{"&:not(.Mui-checked)":t.focusVisibleUnchecked,"&.Mui-checked":t.focusVisibleChecked}}}),Wn=e=>{const{correctness:t,checked:o,onChange:n,disabled:r,value:s,id:i,tagName:a,inputRef:c}=e,l={checked:o,onChange:n,disabled:r,value:s};return _n.createElement(Hn,{id:i,slotProps:{input:{ref:c}},disableRipple:!0,...l,correctness:t,className:Tn,name:a})};class qn extends _n.Component{static __initStatic(){this.propTypes={choiceMode:jn.oneOf(["radio","checkbox"]),displayKey:jn.string,checked:jn.bool.isRequired,correctness:jn.string,disabled:jn.bool.isRequired,feedback:jn.string,label:jn.string.isRequired,rationale:jn.string,onChange:jn.func.isRequired,value:jn.string.isRequired,className:jn.string,tagName:jn.string,hideTick:jn.bool,isEvaluateMode:jn.bool,choicesLayout:jn.oneOf(["vertical","grid","horizontal"]),isSelectionButtonBelow:jn.bool}}static __initStatic2(){this.defaultProps={rationale:null,checked:!1,isEvaluateMode:!1}}constructor(e){super(e),qn.prototype.__init.call(this),this.onToggleChoice=this.onToggleChoice.bind(this),this.choiceId=this.generateChoiceId(),this.descId=`${this.choiceId}-desc`}onToggleChoice(e){this.props.onChange(e)}generateChoiceId(){return"choice-"+(1e4*Math.random()).toFixed()}__init(){this.handleKeyDown=e=>{const{choiceMode:t}=this.props;if("checkbox"!==t)return;const o="ArrowDown"===e.key,n="ArrowUp"===e.key;if(!o&&!n)return;e.preventDefault();const r=document.getElementById(this.choiceId);if(!r)return;const s=r.closest("fieldset");if(!s)return;const i=Array.from(s.querySelectorAll('input[type="checkbox"]')),a=i.findIndex(e=>e===r);if(-1===a)return;const c=i[o?a+1:a-1];c&&c.focus()}}render(){const{choiceMode:e,disabled:t,displayKey:o,feedback:n,label:r,correctness:s,className:i,rationale:a,hideTick:c,isEvaluateMode:l,choicesLayout:u,value:p,checked:h,tagName:d,isSelectionButtonBelow:g}=this.props,f="checkbox"===e?Kn:Wn,m="checkbox"===e?"checkbox":"radio-button",b={..."horizontal"===u&&{[`& .${Tn}`]:{padding:"8px",margin:"4px 0 4px 4px"}},...g&&"grid"!==u&&{"& > label":{alignItems:"flex-start"}},...g&&"grid"===u&&{justifyContent:"center","& > label":{alignItems:"center"}}},y=_n.createElement(_n.Fragment,null,o&&!g?_n.createElement(In,{component:"span"},o,"."," ",_n.createElement(Pn,{className:"prompt-label",prompt:r,tagName:"span"})):_n.createElement(Pn,{className:"prompt-label",prompt:r,tagName:"span"})),v=_n.createElement(Bn,{id:this.descId},"checkbox"===e?"Checkbox to select the answer below":"Radio button to select the answer below"),x={disabled:t,checked:h,correctness:s,tagName:d,value:p,id:this.choiceId,onChange:this.onToggleChoice,onKeyDown:this.handleKeyDown,"aria-describedby":this.descId},S="string"==typeof r&&(r.includes("<math")||r.includes("\\(")||r.includes("\\[")||r.includes("<img")||r.includes("data-latex")||r.includes("data-raw")||r.includes("<mjx-container")),C=g?_n.createElement(Fn,null,S&&v,_n.createElement(f,{...x,style:{padding:0}}),o?`${o}.`:""):_n.createElement(_n.Fragment,null,S&&v,_n.createElement(f,{...x,slotProps:{input:{ref:this.props.autoFocusRef}}}));return _n.createElement("div",{className:$n(i,"corespring-"+m,"choice-input")},_n.createElement(In,null,!c&&l&&_n.createElement(kn,{correctness:s}),_n.createElement(Mn,{className:"checkbox-holder",sx:b},_n.createElement(Dn,{label:y,value:p,htmlFor:this.choiceId,labelPlacement:g?"top":void 0,control:C}))),a&&_n.createElement(Pn,{className:"rationale",defaultClassName:"rationale",prompt:a}),_n.createElement(Nn,{feedback:n,correctness:s}))}}qn.__initStatic(),qn.__initStatic2();const Jn=t,Yn=r,{styled:Gn}=o,{Box:Qn}=n,Xn=Gn(Qn,{shouldForwardProp:e=>"noBorder"!==e&&"horizontalLayout"!==e})(({theme:e,noBorder:t,horizontalLayout:o})=>({paddingTop:e.spacing(2.5),paddingBottom:`calc(${e.spacing(1)} + 2px)`,paddingLeft:`calc(${e.spacing(1)} + 2px)`,paddingRight:`calc(${e.spacing(1)} + 2px)`,borderBottom:t?"none":`1px solid ${e.palette.grey[300]}`,...o&&{paddingRight:e.spacing(2.5),"& label":{marginRight:e.spacing(1)}}}));class Zn extends Jn.Component{constructor(...e){super(...e),Zn.prototype.__init.call(this),Zn.prototype.__init2.call(this),Zn.prototype.__init3.call(this),Zn.prototype.__init4.call(this)}static __initStatic(){this.propTypes={}}__init(){this.state={isHovered:!1}}__init2(){this.handleMouseEnter=()=>{const{disabled:e,checked:t}=this.props;e||t||this.setState({isHovered:!0})}}__init3(){this.handleMouseLeave=()=>{this.setState({isHovered:!1})}}__init4(){this.onChange=e=>{const{disabled:t,onChoiceChanged:o}=this.props;t||o(e)}}render(){const{choice:e,index:t,choicesLength:o,showCorrect:n,isEvaluateMode:r,choiceMode:s,disabled:i,checked:a,correctness:c,displayKey:l,choicesLayout:u,gridColumns:p,isSelectionButtonBelow:h,selectedAnswerBackgroundColor:d,selectedAnswerStrokeColor:g,selectedAnswerStrokeWidth:f,hoverAnswerBackgroundColor:m,hoverAnswerStrokeColor:b,hoverAnswerStrokeWidth:y,autoFocusRef:v,tagName:x}=this.props,{isHovered:S}=this.state,C="choice"+(t===o-1?" last":""),k=!r||n?"":e.feedback,w={...e,checked:a,choiceMode:s,disabled:i,feedback:k,correctness:c,displayKey:l,index:t,choicesLayout:u,gridColumns:p,onChange:this.onChange,isEvaluateMode:r,isSelectionButtonBelow:h,selectedAnswerStrokeColor:g,selectedAnswerStrokeWidth:f,tagName:x},E=g&&"initial"!==g,O=b&&"initial"!==b;let A="transparent",_="2px",j="initial";(E||O)&&(a&&E?(A=g,_=f):S&&!i&&O&&(A=b,_=y)),a&&d&&"initial"!==d?j=d:S&&!i&&m&&"initial"!==m&&(j=m);const L=E||O,N=L?{border:`${(e=>{if(!e)return"2px";const t=String(e).trim();return/^\d+(\.\d+)?$/.test(t)?`${t}px`:t})(_)} solid ${A}`,borderRadius:"8px"}:{},R=t===o-1||"vertical"!==u||L,P="horizontal"===u,$="initial"!==j?j:"initial";return Jn.createElement("div",{className:C,key:t,style:{backgroundColor:$,...N},onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave},Jn.createElement(Xn,{component:"div",noBorder:R,horizontalLayout:P},Jn.createElement(qn,{...w,autoFocusRef:v})))}}Zn.__initStatic(),Zn.propTypes={choiceMode:Yn.oneOf(["radio","checkbox"]),choice:Yn.object,disabled:Yn.bool.isRequired,onChoiceChanged:Yn.func,index:Yn.number,choicesLength:Yn.number,showCorrect:Yn.bool,isEvaluateMode:Yn.bool,checked:Yn.bool,correctness:Yn.string,displayKey:Yn.string,choicesLayout:Yn.oneOf(["vertical","grid","horizontal"]),gridColumns:Yn.string,selectedAnswerBackgroundColor:Yn.string,selectedAnswerStrokeColor:Yn.string,selectedAnswerStrokeWidth:Yn.string,hoverAnswerBackgroundColor:Yn.string,hoverAnswerStrokeColor:Yn.string,hoverAnswerStrokeWidth:Yn.string,tagName:Yn.string,isSelectionButtonBelow:Yn.bool,autoFocusRef:Yn.object};const er=t,tr=r,or=a,nr=i,{styled:rr}=o,{Box:sr}=n,{color:ir}=s,{Collapsible:ar}=s,{PreviewPrompt:cr}=s;const{translator:lr}=$o,ur=rr(sr)({color:ir.text(),backgroundColor:ir.background(),"& *":{"-webkit-font-smoothing":"antialiased"},position:"relative","& legend":{border:"none !important"}}),pr=rr("h2")(({theme:e})=>({display:"block",fontSize:"inherit",margin:"0",fontWeight:"normal",paddingBottom:e.spacing(2)})),hr=rr(sr)(({theme:e})=>({marginBottom:e.spacing(2)})),dr=rr(sr)({display:"flex",flexDirection:"row",flexWrap:"wrap"}),gr=rr(sr)({display:"grid"}),fr=rr("fieldset")({border:"0px",padding:"0.01em 0 0 0",margin:"0px",minWidth:"0px","&:focus":{outline:"none"}}),mr=rr("h3")({position:"absolute",left:"-10000px",top:"auto",width:"1px",height:"1px",overflow:"hidden"}),br=rr("div")(({theme:e})=>({fontSize:e.typography.fontSize-2,color:e.palette.error.main,paddingTop:e.spacing(1)}));class yr extends er.Component{static __initStatic(){this.propTypes={className:tr.string,mode:tr.oneOf(["gather","view","evaluate"]),choiceMode:tr.oneOf(["radio","checkbox"]),keyMode:tr.oneOf(["numbers","letters","none"]),choices:tr.array,partLabel:tr.string,prompt:tr.string,teacherInstructions:tr.string,session:tr.object,disabled:tr.bool,onChoiceChanged:tr.func,responseCorrect:tr.bool,correctResponse:tr.array,choicesLayout:tr.oneOf(["vertical","grid","horizontal"]),gridColumns:tr.string,alwaysShowCorrect:tr.bool,animationsDisabled:tr.bool,language:tr.string,selectedAnswerBackgroundColor:tr.string,selectedAnswerStrokeColor:tr.string,selectedAnswerStrokeWidth:tr.string,hoverAnswerBackgroundColor:tr.string,hoverAnswerStrokeColor:tr.string,hoverAnswerStrokeWidth:tr.string,onShowCorrectToggle:tr.func,isSelectionButtonBelow:tr.bool,minSelections:tr.number,maxSelections:tr.number,autoplayAudioEnabled:tr.bool,customAudioButton:{playImage:tr.string,pauseImage:tr.string},options:tr.object}}constructor(e){super(e),yr.prototype.__init.call(this),yr.prototype.__init2.call(this),yr.prototype.__init3.call(this),yr.prototype.__init4.call(this),this.state={showCorrect:this.props.options&&this.props.alwaysShowCorrect||!1,maxSelectionsErrorState:!1},this.onToggle=this.onToggle.bind(this),this.firstInputRef=er.createRef()}isSelected(e){const t=this.props.session&&this.props.session.value;return t&&t.indexOf&&t.indexOf(e)>=0}__init(){this.handleChange=e=>{const{value:t,checked:o}=e.target,{maxSelections:n,onChoiceChanged:r,session:s}=this.props;s.value&&s.value.length>=n&&(this.setState({maxSelectionsErrorState:o}),o)||r({value:t,selected:o,selector:"Mouse"})}}__init2(){this.onToggle=()=>{"evaluate"===this.props.mode&&this.setState({showCorrect:!this.state.showCorrect},()=>{this.props.onShowCorrectToggle&&this.props.onShowCorrectToggle()})}}UNSAFE_componentWillReceiveProps(e){e.correctResponse||!1===this.state.showCorrect||this.setState({showCorrect:!1},()=>{this.props.onShowCorrectToggle&&this.props.onShowCorrectToggle()}),e.options&&e.alwaysShowCorrect&&!0!==this.state.showCorrect&&this.setState({showCorrect:!0},()=>{this.props.onShowCorrectToggle&&this.props.onShowCorrectToggle()})}indexToSymbol(e){return"numbers"===this.props.keyMode?`${e+1}`:"letters"===this.props.keyMode?String.fromCharCode(97+e).toUpperCase():""}__init3(){this.getCorrectness=(e={})=>{const t=e.correct,o=this.isSelected(e.value);return this.state.showCorrect?t?"correct":void 0:t?o?"correct":"incorrect":o?"incorrect":void 0}}getChecked(e){if(this.props.options&&this.props.alwaysShowCorrect)return e.correct||!1;return this.state.showCorrect&&"evaluate"===this.props.mode?e.correct||!1:this.isSelected(e.value)}renderHeading(){const{mode:e,choiceMode:t}=this.props;return"gather"!==e?null:"radio"===t?er.createElement(mr,null,"Multiple Choice Question"):er.createElement(mr,null,"Multiple Select Question")}__init4(){this.handleGroupFocus=e=>{const t=e.currentTarget,o=document.activeElement;t.contains(o)&&o!==t||(!e.relatedTarget||t.compareDocumentPosition(e.relatedTarget)&Node.DOCUMENT_POSITION_PRECEDING)&&function(e){let t,o=e[0],n=1;for(;n<e.length;){const r=e[n],s=e[n+1];if(n+=2,("optionalAccess"===r||"optionalCall"===r)&&null==o)return;"access"===r||"optionalAccess"===r?(t=o,o=s(o)):"call"!==r&&"optionalCall"!==r||(o=s((...e)=>o.call(t,...e)),t=void 0)}return o}([this,"access",e=>e.firstInputRef,"optionalAccess",e=>e.current])&&this.firstInputRef.current.focus()}}render(){const{mode:e,disabled:t,className:o,choices:n=[],choiceMode:r,gridColumns:s,partLabel:i,prompt:a,responseCorrect:c,teacherInstructions:l,alwaysShowCorrect:u,animationsDisabled:p,language:h,isSelectionButtonBelow:d,minSelections:g,maxSelections:f,autoplayAudioEnabled:m,session:b,customAudioButton:y,options:v}=this.props,{showCorrect:x,maxSelectionsErrorState:S}=this.state,C="evaluate"===e,k=C&&!c,w=s>1?{gridTemplateColumns:`repeat(${s}, 1fr)`}:void 0,E=b.value&&b.value.length||0,O=er.createElement(cr,{tagName:"div",className:"prompt",defaultClassName:"teacher-instructions",prompt:l}),A="grid"===this.props.choicesLayout?gr:"horizontal"===this.props.choicesLayout?dr:sr;return er.createElement(ur,{id:"main-container",className:nr(o,"multiple-choice")},i&&er.createElement(pr,null,i),this.renderHeading(),l&&er.createElement(hr,null,p?O:er.createElement(ar,{labels:{hidden:"Show Teacher Instructions",visible:"Hide Teacher Instructions"}},O)),er.createElement(fr,{tabIndex:0,onFocus:this.handleGroupFocus,role:"radio"===r?"radiogroup":"group"},er.createElement(cr,{className:"prompt",defaultClassName:"prompt",prompt:a,tagName:"legend",autoplayAudioEnabled:m,customAudioButton:y}),!(v&&u)&&er.createElement(or,{show:k,toggled:x,onToggle:this.onToggle.bind(this),language:h}),er.createElement(A,{style:w},n.map((e,o)=>er.createElement(Zn,{autoFocusRef:0===o?this.firstInputRef:null,choicesLayout:this.props.choicesLayout,selectedAnswerBackgroundColor:this.props.selectedAnswerBackgroundColor,selectedAnswerStrokeColor:this.props.selectedAnswerStrokeColor,selectedAnswerStrokeWidth:this.props.selectedAnswerStrokeWidth,hoverAnswerBackgroundColor:this.props.hoverAnswerBackgroundColor,hoverAnswerStrokeColor:this.props.hoverAnswerStrokeColor,hoverAnswerStrokeWidth:this.props.hoverAnswerStrokeWidth,gridColumns:s,key:`choice-${o}`,choice:e,index:o,choicesLength:n.length,showCorrect:x,isEvaluateMode:C,choiceMode:r,disabled:t,tagName:i?`group-${i}`:"group",onChoiceChanged:this.handleChange,hideTick:e.hideTick,checked:this.getChecked(e),correctness:C?this.getCorrectness(e):void 0,displayKey:this.indexToSymbol(o),isSelectionButtonBelow:d})))),"checkbox"===r&&E<g&&er.createElement(br,null,g&&f?g===f?lr.t("translation:multipleChoice:minmaxSelections_equal",{lng:h,minSelections:g}):lr.t("translation:multipleChoice:minmaxSelections_range",{lng:h,minSelections:g,maxSelections:f}):g?lr.t("translation:multipleChoice:minSelections",{lng:h,minSelections:g}):""),"checkbox"===r&&S&&er.createElement(br,null,lr.t("translation:multipleChoice:maxSelections_"+(1===f?"one":"other"),{lng:h,maxSelections:f})))}}yr.__initStatic(),yr.defaultProps={session:{value:[]}};const vr=t,xr=r,{PreviewLayout:Sr}=s;class Cr extends vr.Component{static __initStatic(){this.propTypes={model:xr.object,session:xr.object,options:xr.object,onChoiceChanged:xr.func,onShowCorrectToggle:xr.func,extraCSSRules:xr.shape({names:xr.arrayOf(xr.string),rules:xr.string})}}static __initStatic2(){this.defaultProps={model:{},session:{}}}render(){const{model:e,onChoiceChanged:t,session:o,onShowCorrectToggle:n,options:r}=this.props,{extraCSSRules:s,fontSizeFactor:i}=e;return vr.createElement(Sr,{extraCSSRules:s,fontSizeFactor:i,classes:{}},vr.createElement(yr,{...e,options:r,session:o,onChoiceChanged:t,onShowCorrectToggle:n}))}}Cr.__initStatic(),Cr.__initStatic2();const kr=t,wr=c,{renderMath:Er}=l,Or=wr("pie-element:multiple-choice:print"),Ar=(e,t)=>{const o="instructor"===t.role;e.prompt=!1!==e.promptEnabled?e.prompt:void 0,e.teacherInstructions=o&&!1!==e.teacherInstructionsEnabled?e.teacherInstructions:void 0,e.showTeacherInstructions=o,e.alwaysShowCorrect=o,e.mode=o?"evaluate":e.mode,e.disabled=!0,e.animationsDisabled=!0,e.lockChoiceOrder=!0,e.choicesLayout=e.choicesLayout||"vertical";const n=It(e.choices,5);return e.choices=n.map(t=>(t.rationale=o&&!1!==e.rationaleEnabled?t.rationale:void 0,t.hideTick=o,t.feedback=void 0,t)),e.keyMode=e.choicePrefix||"letters",e};class _r extends HTMLElement{constructor(){super(),this._options=null,this._model=null,this._session=[],this._root=null,this._rerender=Dt(()=>{if(this._model&&this._session){const e=Ar(this._model,this._options),t=this._options&&kr.createElement(Cr,{model:e,session:{},options:this._options});this._root||(this._root=u(this)),this._root.render(t),requestAnimationFrame(()=>{requestAnimationFrame(()=>{Or("render complete - render math"),Er(this)})})}else Or("skip")},50,{leading:!1,trailing:!0})}set options(e){this._options=e}set model(e){this._model=e,this._rerender()}connectedCallback(){}disconnectedCallback(){this._root&&this._root.unmount()}}export{_r as default};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/multiple-choice",
|
|
3
3
|
"repository": "pie-framework/pie-elements",
|
|
4
|
-
"version": "12.2.0-next.
|
|
4
|
+
"version": "12.2.0-next.7",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"react-dom": "18.3.1",
|
|
24
24
|
"react-transition-group": "^4.4.5"
|
|
25
25
|
},
|
|
26
|
-
"gitHead": "
|
|
26
|
+
"gitHead": "e9c9eb021e31f961170c60e147b17fc6a9f56957",
|
|
27
27
|
"scripts": {
|
|
28
28
|
"postpublish": "../../scripts/postpublish"
|
|
29
29
|
},
|