@pie-element/math-inline 11.0.0-beta.1 → 11.0.0-next.43

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/module/demo.js ADDED
@@ -0,0 +1,66 @@
1
+ import Configure from './configure.js';
2
+ import Element from './element.js';
3
+ import * as controller from './controller.js';
4
+
5
+ var generate = {};
6
+
7
+ /* const initialModel = {
8
+ customKeys: [],
9
+ equationEditor: 'geometry',
10
+ responseType: 'Advanced Multi',
11
+ expression: '{{response}}',
12
+ responses: [
13
+ {
14
+ answer: 'r=\\sqrt{\\frac{V}{7\\pi}}',
15
+ id: '1',
16
+ alternates: {},
17
+ validation: 'literal',
18
+ },
19
+ ],
20
+ 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.',
21
+ rationale:
22
+ '<p>The correct answer is:</p><ul><li><math xmlns="http://www.w3.org/1998/Math/MathML"><mi>r</mi><mo>=</mo><msqrt><mfrac><mi>V</mi><mrow><mn>7</mn><mi>&#960;</mi></mrow></mfrac></msqrt></math></li></ul>',
23
+ }; */
24
+
25
+ const E262456 = {
26
+ equationEditor: 3,
27
+ toolbarEditorPosition: 'bottom',
28
+ prompt:
29
+ '<p><strong>B.</strong> Find the value of the expression that you wrote in part A to find how much money the band members made.</p>\n\n<p>Use the on-screen keyboard to type your answer in the box below.</p>\n',
30
+ expression: '${{response}}',
31
+ responses: [
32
+ {
33
+ allowSpaces: true,
34
+ // 'validation': 'symbolic',
35
+ answer: '$410',
36
+ id: '1',
37
+ },
38
+ ],
39
+ responseType: 'Advanced Multi',
40
+ };
41
+
42
+ generate.model = (id, element) => ({
43
+ id,
44
+ element,
45
+ ...E262456,
46
+ rubricEnabled: false,
47
+ });
48
+
49
+ const { model } = generate;
50
+
51
+ var config = {
52
+ elements: {
53
+ 'math-inline': '../..',
54
+ },
55
+ models: [model('1', 'math-inline')],
56
+ };
57
+
58
+ //Note: demo-el is a custom element loaded in the markup.
59
+ customElements.whenDefined("demo-el").then(() => {
60
+ config.models.forEach((m) => {
61
+ const de = document.createElement("demo-el");
62
+ document.body.appendChild(de);
63
+ de.def = { tagName: m.element, Element, Configure, controller };
64
+ de.model = m;
65
+ });
66
+ });
@@ -0,0 +1 @@
1
+ import{_dll_react_dom as e,_dll_react as t,_dll_mui__material_styles as s,_dll_prop_types as o,_dll_pie_lib__render_ui as n,_dll_pie_lib__correct_answer_toggle as i,_dll_mui__material as a,_dll_lodash as r,_dll_debug as l}from"../../../@pie-lib/shared-module@^3.0.5/module/index.js";import{_dll_pie_lib__math_toolbar as c,_dll_pie_lib__math_input as p,_dll_pie_framework__mathquill as d}from"../../../@pie-lib/math-edit-module@^3.0.5/module/index.js";import{_dll_pie_lib__math_rendering as h}from"../../../@pie-lib/math-rendering-module@^4.0.5/module/index.js";var u,g=e;u=g.createRoot,g.hydrateRoot;var m={};Object.defineProperty(m,"__esModule",{value:!0});class f extends CustomEvent{constructor(e,t,s){super(f.TYPE,{bubbles:!0,composed:!0,detail:{complete:t,component:e,hasModel:s}}),this.component=e,this.complete=t}}f.TYPE="model-set";var y=m.ModelSetEvent=f;class b extends CustomEvent{constructor(e,t){super(b.TYPE,{bubbles:!0,composed:!0,detail:{complete:t,component:e}}),this.component=e,this.complete=t}}b.TYPE="session-changed";var x=m.SessionChangedEvent=b,v={},S={};Object.defineProperty(S,"__esModule",{value:!0}),S.getPluginProps=S.generateValidationMessage=S.ResponseTypes=void 0,S.ResponseTypes={advanced:"Advanced Multi",simple:"Simple"};S.generateValidationMessage=(e={},t={})=>{const{maxResponseAreas:s}=t,{responseType:o}=e;let n="";return"Advanced Multi"===o&&(n="\nThere should be at least 1 "+(s?`and at most ${s} `:"")+"response area"+(s?"s":"")+" defined."),"Validation requirements:\nAll correct answers (the primary and any alternates) should not be empty and should be unique."+n};S.getPluginProps=(e={},t={})=>({...t,...e}),Object.defineProperty(v,"__esModule",{value:!0});var w=v.default=void 0,k=S;w=v.default={model:{allowTrailingZerosDefault:!1,customKeys:[],equationEditor:"8",expression:"",feedback:{correct:{default:"Correct",type:"none"},incorrect:{default:"Incorrect",type:"none"},partial:{default:"Nearly",type:"none"}},feedbackEnabled:!1,ignoreOrderDefault:!1,partialScoring:!0,prompt:"",promptEnabled:!0,rationale:"",rationaleEnabled:!0,responseType:k.ResponseTypes.advanced,responses:[],scoringType:"auto",studentInstructionsEnabled:!0,teacherInstructions:"",teacherInstructionsEnabled:!0,toolbarEditorPosition:"bottom",validationDefault:"literal"},configuration:{baseInputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1},textAlign:{disabled:!0},showParagraphs:{disabled:!1},separateParagraphs:{disabled:!0}},prompt:{settings:!0,label:"Prompt",inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1}},required:!1},feedback:{settings:!0,label:"Feedback"},responseType:{settings:!0,label:"Response type"},rationale:{settings:!0,label:"Rationale",inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1}},required:!1},settingsPanelDisabled:!1,spellCheck:{label:"Spellcheck",settings:!1,enabled:!0},scoringType:{settings:!1,label:"Scoring Type"},studentInstructions:{settings:!1,label:"Student Instructions"},teacherInstructions:{settings:!0,label:"Teacher Instructions",inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1}},required:!1},partialScoring:{settings:!1,label:"Allow Partial Scoring"},ignoreOrder:{settings:!1,label:"Ignore Order",enabled:!0},allowTrailingZeros:{settings:!1,label:"Allow Trailing Zeros",enabled:!0},maxImageWidth:{teacherInstructions:300,prompt:300,rationale:300},maxImageHeight:{teacherInstructions:300,prompt:300,rationale:300},withRubric:{settings:!1,label:"Add Rubric"},mathMlOptions:{mmlOutput:!1,mmlEditing:!1},language:{settings:!1,label:"Specify Language",enabled:!1},languageChoices:{label:"Language Choices",options:[]}}};const C="Advanced Multi",A="Simple",L=t,{styled:E}=s,O=o,{color:R}=n,{MathToolbar:_}=c,{mq:$}=p,P=E("div")(({theme:e})=>({marginTop:e.spacing(2),marginBottom:e.spacing(2),padding:e.spacing(1)})),N=E("div",{shouldForwardProp:e=>!["isCorrect","isIncorrect"].includes(e)})(({theme:e,isCorrect:t,isIncorrect:s})=>({color:R.text(),background:R.background(),border:t?`2px solid ${R.correct()} !important`:s?`2px solid ${R.incorrect()} !important`:`1px solid ${R.primaryLight()}`,width:"fit-content",fontSize:"1rem",padding:t||s?e.spacing(1):e.spacing(.5),letterSpacing:t||s?"0.5px":"normal","& > .mq-math-mode":{"& > .mq-hasCursor":{"& > .mq-cursor":{display:"none"}}}}));if("undefined"!=typeof document){const e="math-inline-simple-question-styles";if(!document.getElementById(e)){const t=document.createElement("style");t.id=e,t.textContent=`\n .response-editor {\n display: flex;\n justify-content: center;\n width: auto;\n max-width: fit-content;\n height: auto;\n text-align: left;\n padding: 8px;\n }\n .response-editor.mq-math-mode {\n border: 1px solid ${R.primaryLight()};\n }\n `,document.head.appendChild(t)}}class T extends L.Component{static __initStatic(){this.propTypes={onSimpleResponseChange:O.func,model:O.object.isRequired,emptyResponse:O.bool,session:O.object.isRequired,showCorrect:O.bool,onSubFieldFocus:O.func.isRequired,showKeypad:O.bool.isRequired}}constructor(e){super(e),T.prototype.__init.call(this),T.prototype.__init2.call(this),T.prototype.__init3.call(this),this.mathToolBarId=`math-toolbar-${(new Date).getTime()}`}__init(){this.mathToolBarContainsTarget=e=>document.getElementById(this.mathToolBarId).contains(e.target)}__init2(){this.handleClick=e=>{try{this.mathToolBarContainsTarget(e)||this.setState({showKeypad:!1})}catch(e){}}}__init3(){this.onFocus=()=>{const{onSubFieldFocus:e}=this.props;e(this.mathToolBarId)}}render(){const{model:e,showCorrect:t,session:s,emptyResponse:o,onSimpleResponseChange:n,showKeypad:i}=this.props,{config:a,disabled:r,correctness:l}=e||{};if(!a)return;const c=l&&l.correct,{responses:p,equationEditor:d}=a;return L.createElement(P,{"data-keypad":!0},t||r?L.createElement(N,{isIncorrect:!o&&!c&&!t,isCorrect:!o&&(c||t)},L.createElement($.Static,{latex:t?p&&p.length&&p[0].answer:s.response||""})):L.createElement("div",{id:this.mathToolBarId},L.createElement(_,{classNames:{editor:"response-editor"},latex:s.response,keypadMode:d,onChange:n,onDone:()=>{},onFocus:this.onFocus,controlledKeypad:!0,showKeypad:i,hideDoneButton:!0})))}}function j(e,t){return null!=e?e:t()}function I(e){let t,s=e[0],o=1;for(;o<e.length;){const n=e[o],i=e[o+1];if(o+=2,("optionalAccess"===n||"optionalCall"===n)&&null==s)return;"access"===n||"optionalAccess"===n?(t=s,s=i(s)):"call"!==n&&"optionalCall"!==n||(s=i((...e)=>s.call(t,...e)),t=void 0)}return s}T.__initStatic();const F=e=>"string"==typeof e,D=()=>{let e,t;const s=new Promise((s,o)=>{e=s,t=o});return s.resolve=e,s.reject=t,s},q=e=>null==e?"":""+e,M=/###/g,B=e=>e&&e.indexOf("###")>-1?e.replace(M,"."):e,V=e=>!e||F(e),K=(e,t,s)=>{const o=F(t)?t.split("."):t;let n=0;for(;n<o.length-1;){if(V(e))return{};const t=B(o[n]);!e[t]&&s&&(e[t]=new s),e=Object.prototype.hasOwnProperty.call(e,t)?e[t]:{},++n}return V(e)?{}:{obj:e,k:B(o[n])}},U=(e,t,s)=>{const{obj:o,k:n}=K(e,t,Object);if(void 0!==o||1===t.length)return void(o[n]=s);let i=t[t.length-1],a=t.slice(0,t.length-1),r=K(e,a,Object);for(;void 0===r.obj&&a.length;)i=`${a[a.length-1]}.${i}`,a=a.slice(0,a.length-1),r=K(e,a,Object),I([r,"optionalAccess",e=>e.obj])&&void 0!==r.obj[`${r.k}.${i}`]&&(r.obj=void 0);r.obj[`${r.k}.${i}`]=s},H=(e,t)=>{const{obj:s,k:o}=K(e,t);if(s&&Object.prototype.hasOwnProperty.call(s,o))return s[o]},z=(e,t,s)=>{for(const o in t)"__proto__"!==o&&"constructor"!==o&&(o in e?F(e[o])||e[o]instanceof String||F(t[o])||t[o]instanceof String?s&&(e[o]=t[o]):z(e[o],t[o],s):e[o]=t[o]);return e},W=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var J={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};const Y=e=>F(e)?e.replace(/[&<>"'\/]/g,e=>J[e]):e;const Q=[" ",",","?","!",";"],G=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 s=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,s),this.regExpQueue.push(e),s}}(20),X=(e,t,s=".")=>{if(!e)return;if(e[t]){if(!Object.prototype.hasOwnProperty.call(e,t))return;return e[t]}const o=t.split(s);let n=e;for(let e=0;e<o.length;){if(!n||"object"!=typeof n)return;let t,i="";for(let a=e;a<o.length;++a)if(a!==e&&(i+=s),i+=o[a],t=n[i],void 0!==t){if(["string","number","boolean"].indexOf(typeof t)>-1&&a<o.length-1)continue;e+=a-e+1;break}n=t}return n},Z=e=>I([e,"optionalAccess",e=>e.replace,"call",e=>e("_","-")]),ee={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){I([console,"optionalAccess",t=>t[e],"optionalAccess",e=>e.apply,"optionalCall",e=>e(console,t)])}};class te{constructor(e,t={}){this.init(e,t)}init(e,t={}){this.prefix=t.prefix||"i18next:",this.logger=e||ee,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,s,o){return o&&!this.debug?null:(F(e[0])&&(e[0]=`${s}${this.prefix} ${e[0]}`),this.logger[t](e))}create(e){return new te(this.logger,{prefix:`${this.prefix}:${e}:`,...this.options})}clone(e){return(e=e||this.options).prefix=e.prefix||this.prefix,new te(this.logger,e)}}var se=new te;class oe{constructor(){this.observers={}}on(e,t){return e.split(" ").forEach(e=>{this.observers[e]||(this.observers[e]=new Map);const s=this.observers[e].get(t)||0;this.observers[e].set(t,s+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,s])=>{for(let o=0;o<s;o++)e(...t)})}if(this.observers["*"]){Array.from(this.observers["*"].entries()).forEach(([s,o])=>{for(let n=0;n<o;n++)s.apply(s,[e,...t])})}}}class ne extends oe{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,s,o={}){const n=void 0!==o.keySeparator?o.keySeparator:this.options.keySeparator,i=void 0!==o.ignoreJSONStructure?o.ignoreJSONStructure:this.options.ignoreJSONStructure;let a;e.indexOf(".")>-1?a=e.split("."):(a=[e,t],s&&(Array.isArray(s)?a.push(...s):F(s)&&n?a.push(...s.split(n)):a.push(s)));const r=H(this.data,a);return!r&&!t&&!s&&e.indexOf(".")>-1&&(e=a[0],t=a[1],s=a.slice(2).join(".")),!r&&i&&F(s)?X(I([this,"access",e=>e.data,"optionalAccess",t=>t[e],"optionalAccess",e=>e[t]]),s,n):r}addResource(e,t,s,o,n={silent:!1}){const i=void 0!==n.keySeparator?n.keySeparator:this.options.keySeparator;let a=[e,t];s&&(a=a.concat(i?s.split(i):s)),e.indexOf(".")>-1&&(a=e.split("."),o=t,t=a[1]),this.addNamespaces(t),U(this.data,a,o),n.silent||this.emit("added",e,t,s,o)}addResources(e,t,s,o={silent:!1}){for(const o in s)(F(s[o])||Array.isArray(s[o]))&&this.addResource(e,t,o,s[o],{silent:!0});o.silent||this.emit("added",e,t,s)}addResourceBundle(e,t,s,o,n,i={silent:!1,skipCopy:!1}){let a=[e,t];e.indexOf(".")>-1&&(a=e.split("."),o=s,s=t,t=a[1]),this.addNamespaces(t);let r=H(this.data,a)||{};i.skipCopy||(s=JSON.parse(JSON.stringify(s))),o?z(r,s,n):r={...r,...s},U(this.data,a,r),i.silent||this.emit("added",e,t,s)}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 ie={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,s,o,n){return e.forEach(e=>{t=j(I([this,"access",e=>e.processors,"access",t=>t[e],"optionalAccess",e=>e.process,"call",e=>e(t,s,o,n)]),()=>t)}),t}};const ae=Symbol("i18next/PATH_KEY");function re(e,t){const{[ae]:s}=e(function(){const e=[],t=Object.create(null);let s;return t.get=(o,n)=>(I([s,"optionalAccess",e=>e.revoke,"optionalCall",e=>e()]),n===ae?e:(e.push(n),s=Proxy.revocable(o,t),s.proxy)),Proxy.revocable(Object.create(null),t).proxy}());return s.join(j(I([t,"optionalAccess",e=>e.keySeparator]),()=>"."))}const le={},ce=e=>!F(e)&&"boolean"!=typeof e&&"number"!=typeof e;class pe extends oe{constructor(e,t={}){var s,o;super(),s=e,o=this,["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"].forEach(e=>{s[e]&&(o[e]=s[e])}),this.options=t,void 0===this.options.keySeparator&&(this.options.keySeparator="."),this.logger=se.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e,t={interpolation:{}}){const s={...t};if(null==e)return!1;const o=this.resolve(e,s);if(void 0===I([o,"optionalAccess",e=>e.res]))return!1;const n=ce(o.res);return!1!==s.returnObjects||!n}extractFromKey(e,t){let s=void 0!==t.nsSeparator?t.nsSeparator:this.options.nsSeparator;void 0===s&&(s=":");const o=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator;let n=t.ns||this.options.defaultNS||[];const i=s&&e.indexOf(s)>-1,a=!(this.options.userDefinedKeySeparator||t.keySeparator||this.options.userDefinedNsSeparator||t.nsSeparator||((e,t,s)=>{t=t||"",s=s||"";const o=Q.filter(e=>t.indexOf(e)<0&&s.indexOf(e)<0);if(0===o.length)return!0;const n=G.getRegExp(`(${o.map(e=>"?"===e?"\\?":e).join("|")})`);let i=!n.test(e);if(!i){const t=e.indexOf(s);t>0&&!n.test(e.substring(0,t))&&(i=!0)}return i})(e,s,o));if(i&&!a){const t=e.match(this.interpolator.nestingRegexp);if(t&&t.length>0)return{key:e,namespaces:F(n)?[n]:n};const i=e.split(s);(s!==o||s===o&&this.options.ns.indexOf(i[0])>-1)&&(n=i.shift()),e=i.join(o)}return{key:e,namespaces:F(n)?[n]:n}}translate(e,t,s){let o="object"==typeof t?{...t}:t;if("object"!=typeof o&&this.options.overloadTranslationOptionHandler&&(o=this.options.overloadTranslationOptionHandler(arguments)),"object"==typeof o&&(o={...o}),o||(o={}),null==e)return"";"function"==typeof e&&(e=re(e,{...this.options,...o})),Array.isArray(e)||(e=[String(e)]);const n=void 0!==o.returnDetails?o.returnDetails:this.options.returnDetails,i=void 0!==o.keySeparator?o.keySeparator:this.options.keySeparator,{key:a,namespaces:r}=this.extractFromKey(e[e.length-1],o),l=r[r.length-1];let c=void 0!==o.nsSeparator?o.nsSeparator:this.options.nsSeparator;void 0===c&&(c=":");const p=o.lng||this.language,d=o.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if("cimode"===I([p,"optionalAccess",e=>e.toLowerCase,"call",e=>e()]))return d?n?{res:`${l}${c}${a}`,usedKey:a,exactUsedKey:a,usedLng:p,usedNS:l,usedParams:this.getUsedParamsDetails(o)}:`${l}${c}${a}`:n?{res:a,usedKey:a,exactUsedKey:a,usedLng:p,usedNS:l,usedParams:this.getUsedParamsDetails(o)}:a;const h=this.resolve(e,o);let u=I([h,"optionalAccess",e=>e.res]);const g=I([h,"optionalAccess",e=>e.usedKey])||a,m=I([h,"optionalAccess",e=>e.exactUsedKey])||a,f=void 0!==o.joinArrays?o.joinArrays:this.options.joinArrays,y=!this.i18nFormat||this.i18nFormat.handleAsObject,b=void 0!==o.count&&!F(o.count),x=pe.hasDefaultValue(o),v=b?this.pluralResolver.getSuffix(p,o.count,o):"",S=o.ordinal&&b?this.pluralResolver.getSuffix(p,o.count,{ordinal:!1}):"",w=b&&!o.ordinal&&0===o.count,k=w&&o[`defaultValue${this.options.pluralSeparator}zero`]||o[`defaultValue${v}`]||o[`defaultValue${S}`]||o.defaultValue;let C=u;y&&!u&&x&&(C=k);const A=ce(C),L=Object.prototype.toString.apply(C);if(!(y&&C&&A&&["[object Number]","[object Function]","[object RegExp]"].indexOf(L)<0)||F(f)&&Array.isArray(C))if(y&&F(f)&&Array.isArray(u))u=u.join(f),u&&(u=this.extendTranslation(u,e,o,s));else{let t=!1,n=!1;!this.isValidLookup(u)&&x&&(t=!0,u=k),this.isValidLookup(u)||(n=!0,u=a);const r=(o.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&n?void 0:u,d=x&&k!==u&&this.options.updateMissing;if(n||t||d){if(this.logger.log(d?"updateKey":"missingKey",p,l,a,d?k:u),i){const e=this.resolve(a,{...o,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,o.lng||this.language);if("fallback"===this.options.saveMissingTo&&t&&t[0])for(let s=0;s<t.length;s++)e.push(t[s]);else"all"===this.options.saveMissingTo?e=this.languageUtils.toResolveHierarchy(o.lng||this.language):e.push(o.lng||this.language);const s=(e,t,s)=>{const n=x&&s!==u?s:r;this.options.missingKeyHandler?this.options.missingKeyHandler(e,l,t,n,d,o):I([this,"access",e=>e.backendConnector,"optionalAccess",e=>e.saveMissing])&&this.backendConnector.saveMissing(e,l,t,n,d,o),this.emit("missingKey",e,l,t,u)};this.options.saveMissing&&(this.options.saveMissingPlurals&&b?e.forEach(e=>{const t=this.pluralResolver.getSuffixes(e,o);w&&o[`defaultValue${this.options.pluralSeparator}zero`]&&t.indexOf(`${this.options.pluralSeparator}zero`)<0&&t.push(`${this.options.pluralSeparator}zero`),t.forEach(t=>{s([e],a+t,o[`defaultValue${t}`]||k)})}):s(e,a,k))}u=this.extendTranslation(u,e,o,h,s),n&&u===a&&this.options.appendNamespaceToMissingKey&&(u=`${l}${c}${a}`),(n||t)&&this.options.parseMissingKeyHandler&&(u=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${l}${c}${a}`:a,t?u:void 0,o))}else{if(!o.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,C,{...o,ns:r}):`key '${a} (${this.language})' returned an object instead of string.`;return n?(h.res=e,h.usedParams=this.getUsedParamsDetails(o),h):e}if(i){const e=Array.isArray(C),t=e?[]:{},s=e?m:g;for(const e in C)if(Object.prototype.hasOwnProperty.call(C,e)){const n=`${s}${i}${e}`;t[e]=x&&!u?this.translate(n,{...o,defaultValue:ce(k)?k[e]:void 0,joinArrays:!1,ns:r}):this.translate(n,{...o,joinArrays:!1,ns:r}),t[e]===n&&(t[e]=C[e])}u=t}}return n?(h.res=u,h.usedParams=this.getUsedParamsDetails(o),h):u}extendTranslation(e,t,s,o,n){if(I([this,"access",e=>e.i18nFormat,"optionalAccess",e=>e.parse]))e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...s},s.lng||this.language||o.usedLng,o.usedNS,o.usedKey,{resolved:o});else if(!s.skipInterpolation){s.interpolation&&this.interpolator.init({...s,interpolation:{...this.options.interpolation,...s.interpolation}});const i=F(e)&&(void 0!==I([s,"optionalAccess",e=>e.interpolation,"optionalAccess",e=>e.skipOnVariables])?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let a;if(i){const t=e.match(this.interpolator.nestingRegexp);a=t&&t.length}let r=s.replace&&!F(s.replace)?s.replace:s;if(this.options.interpolation.defaultVariables&&(r={...this.options.interpolation.defaultVariables,...r}),e=this.interpolator.interpolate(e,r,s.lng||this.language||o.usedLng,s),i){const t=e.match(this.interpolator.nestingRegexp);a<(t&&t.length)&&(s.nest=!1)}!s.lng&&o&&o.res&&(s.lng=this.language||o.usedLng),!1!==s.nest&&(e=this.interpolator.nest(e,(...e)=>I([n,"optionalAccess",e=>e[0]])!==e[0]||s.context?this.translate(...e,t):(this.logger.warn(`It seems you are nesting recursively key: ${e[0]} in key: ${t[0]}`),null),s)),s.interpolation&&this.interpolator.reset()}const i=s.postProcess||this.options.postProcess,a=F(i)?[i]:i;return null!=e&&I([a,"optionalAccess",e=>e.length])&&!1!==s.applyPostProcessor&&(e=ie.handle(a,e,t,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...o,usedParams:this.getUsedParamsDetails(s)},...s}:s,this)),e}resolve(e,t={}){let s,o,n,i,a;return F(e)&&(e=[e]),e.forEach(e=>{if(this.isValidLookup(s))return;const r=this.extractFromKey(e,t),l=r.key;o=l;let c=r.namespaces;this.options.fallbackNS&&(c=c.concat(this.options.fallbackNS));const p=void 0!==t.count&&!F(t.count),d=p&&!t.ordinal&&0===t.count,h=void 0!==t.context&&(F(t.context)||"number"==typeof t.context)&&""!==t.context,u=t.lngs?t.lngs:this.languageUtils.toResolveHierarchy(t.lng||this.language,t.fallbackLng);c.forEach(e=>{this.isValidLookup(s)||(a=e,le[`${u[0]}-${e}`]||!I([this,"access",e=>e.utils,"optionalAccess",e=>e.hasLoadedNamespace])||I([this,"access",e=>e.utils,"optionalAccess",e=>e.hasLoadedNamespace,"call",e=>e(a)])||(le[`${u[0]}-${e}`]=!0,this.logger.warn(`key "${o}" for languages "${u.join(", ")}" won't get resolved as namespace "${a}" 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!!!")),u.forEach(o=>{if(this.isValidLookup(s))return;i=o;const a=[l];if(I([this,"access",e=>e.i18nFormat,"optionalAccess",e=>e.addLookupKeys]))this.i18nFormat.addLookupKeys(a,l,o,e,t);else{let e;p&&(e=this.pluralResolver.getSuffix(o,t.count,t));const s=`${this.options.pluralSeparator}zero`,n=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(p&&(t.ordinal&&0===e.indexOf(n)&&a.push(l+e.replace(n,this.options.pluralSeparator)),a.push(l+e),d&&a.push(l+s)),h){const o=`${l}${this.options.contextSeparator||"_"}${t.context}`;a.push(o),p&&(t.ordinal&&0===e.indexOf(n)&&a.push(o+e.replace(n,this.options.pluralSeparator)),a.push(o+e),d&&a.push(o+s))}}let r;for(;r=a.pop();)this.isValidLookup(s)||(n=r,s=this.getResource(o,e,r,t))}))})}),{res:s,usedKey:o,exactUsedKey:n,usedLng:i,usedNS:a}}isValidLookup(e){return!(void 0===e||!this.options.returnNull&&null===e||!this.options.returnEmptyString&&""===e)}getResource(e,t,s,o={}){return I([this,"access",e=>e.i18nFormat,"optionalAccess",e=>e.getResource])?this.i18nFormat.getResource(e,t,s,o):this.resourceStore.getResource(e,t,s,o)}getUsedParamsDetails(e={}){const t=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],s=e.replace&&!F(e.replace);let o=s?e.replace:e;if(s&&void 0!==e.count&&(o.count=e.count),this.options.interpolation.defaultVariables&&(o={...this.options.interpolation.defaultVariables,...o}),!s){o={...o};for(const e of t)delete o[e]}return o}static hasDefaultValue(e){const t="defaultValue";for(const s in e)if(Object.prototype.hasOwnProperty.call(e,s)&&t===s.substring(0,12)&&void 0!==e[s])return!0;return!1}}class de{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=se.create("languageUtils")}getScriptPartFromCode(e){if(!(e=Z(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=Z(e))||e.indexOf("-")<0)return e;const t=e.split("-");return this.formatLanguageCode(t[0])}formatLanguageCode(e){if(F(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 s=this.formatLanguageCode(e);this.options.supportedLngs&&!this.isSupportedCode(s)||(t=s)}),!t&&this.options.supportedLngs&&e.forEach(e=>{if(t)return;const s=this.getScriptPartFromCode(e);if(this.isSupportedCode(s))return t=s;const o=this.getLanguagePartFromCode(e);if(this.isSupportedCode(o))return t=o;t=this.options.supportedLngs.find(e=>e===o?e:e.indexOf("-")<0&&o.indexOf("-")<0?void 0:e.indexOf("-")>0&&o.indexOf("-")<0&&e.substring(0,e.indexOf("-"))===o||0===e.indexOf(o)&&o.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)),F(e)&&(e=[e]),Array.isArray(e))return e;if(!t)return e.default||[];let s=e[t];return s||(s=e[this.getScriptPartFromCode(t)]),s||(s=e[this.formatLanguageCode(t)]),s||(s=e[this.getLanguagePartFromCode(t)]),s||(s=e.default),s||[]}toResolveHierarchy(e,t){const s=this.getFallbackCodes((!1===t?[]:t)||this.options.fallbackLng||[],e),o=[],n=e=>{e&&(this.isSupportedCode(e)?o.push(e):this.logger.warn(`rejecting language code not found in supportedLngs: ${e}`))};return F(e)&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?("languageOnly"!==this.options.load&&n(this.formatLanguageCode(e)),"languageOnly"!==this.options.load&&"currentOnly"!==this.options.load&&n(this.getScriptPartFromCode(e)),"currentOnly"!==this.options.load&&n(this.getLanguagePartFromCode(e))):F(e)&&n(this.formatLanguageCode(e)),s.forEach(e=>{o.indexOf(e)<0&&n(this.formatLanguageCode(e))}),o}}const he={zero:0,one:1,two:2,few:3,many:4,other:5},ue={select:e=>1===e?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class ge{constructor(e,t={}){this.languageUtils=e,this.options=t,this.logger=se.create("pluralResolver"),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(e,t={}){const s=Z("dev"===e?"en":e),o=t.ordinal?"ordinal":"cardinal",n=JSON.stringify({cleanedCode:s,type:o});if(n in this.pluralRulesCache)return this.pluralRulesCache[n];let i;try{i=new Intl.PluralRules(s,{type:o})}catch(s){if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),ue;if(!e.match(/-|_/))return ue;const o=this.languageUtils.getLanguagePartFromCode(e);i=this.getRule(o,t)}return this.pluralRulesCache[n]=i,i}needsPlural(e,t={}){let s=this.getRule(e,t);return s||(s=this.getRule("dev",t)),I([s,"optionalAccess",e=>e.resolvedOptions,"call",e=>e(),"access",e=>e.pluralCategories,"access",e=>e.length])>1}getPluralFormsOfKey(e,t,s={}){return this.getSuffixes(e,s).map(e=>`${t}${e}`)}getSuffixes(e,t={}){let s=this.getRule(e,t);return s||(s=this.getRule("dev",t)),s?s.resolvedOptions().pluralCategories.sort((e,t)=>he[e]-he[t]).map(e=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:""}${e}`):[]}getSuffix(e,t,s={}){const o=this.getRule(e,s);return o?`${this.options.prepend}${s.ordinal?`ordinal${this.options.prepend}`:""}${o.select(t)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix("dev",t,s))}}const me=(e,t,s,o=".",n=!0)=>{let i=((e,t,s)=>{const o=H(e,s);return void 0!==o?o:H(t,s)})(e,t,s);return!i&&n&&F(s)&&(i=X(e,s,o),void 0===i&&(i=X(t,s,o))),i},fe=e=>e.replace(/\$/g,"$$$$");class ye{constructor(e={}){this.logger=se.create("interpolator"),this.options=e,this.format=I([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:s,useRawValueToEscape:o,prefix:n,prefixEscaped:i,suffix:a,suffixEscaped:r,formatSeparator:l,unescapeSuffix:c,unescapePrefix:p,nestingPrefix:d,nestingPrefixEscaped:h,nestingSuffix:u,nestingSuffixEscaped:g,nestingOptionsSeparator:m,maxReplaces:f,alwaysFormat:y}=e.interpolation;this.escape=void 0!==t?t:Y,this.escapeValue=void 0===s||s,this.useRawValueToEscape=void 0!==o&&o,this.prefix=n?W(n):i||"{{",this.suffix=a?W(a):r||"}}",this.formatSeparator=l||",",this.unescapePrefix=c?"":p||"-",this.unescapeSuffix=this.unescapePrefix?"":c||"",this.nestingPrefix=d?W(d):h||W("$t("),this.nestingSuffix=u?W(u):g||W(")"),this.nestingOptionsSeparator=m||",",this.maxReplaces=f||1e3,this.alwaysFormat=void 0!==y&&y,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=(e,t)=>I([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,s,o){let n,i,a;const r=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},l=e=>{if(e.indexOf(this.formatSeparator)<0){const n=me(t,r,e,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(n,void 0,s,{...o,...t,interpolationkey:e}):n}const n=e.split(this.formatSeparator),i=n.shift().trim(),a=n.join(this.formatSeparator).trim();return this.format(me(t,r,i,this.options.keySeparator,this.options.ignoreJSONStructure),a,s,{...o,...t,interpolationkey:i})};this.resetRegExp();const c=I([o,"optionalAccess",e=>e.missingInterpolationHandler])||this.options.missingInterpolationHandler,p=void 0!==I([o,"optionalAccess",e=>e.interpolation,"optionalAccess",e=>e.skipOnVariables])?o.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:e=>fe(e)},{regex:this.regexp,safeValue:e=>this.escapeValue?fe(this.escape(e)):fe(e)}].forEach(t=>{for(a=0;n=t.regex.exec(e);){const s=n[1].trim();if(i=l(s),void 0===i)if("function"==typeof c){const t=c(e,n,o);i=F(t)?t:""}else if(o&&Object.prototype.hasOwnProperty.call(o,s))i="";else{if(p){i=n[0];continue}this.logger.warn(`missed to pass in variable ${s} for interpolating ${e}`),i=""}else F(i)||this.useRawValueToEscape||(i=q(i));const r=t.safeValue(i);if(e=e.replace(n[0],r),p?(t.regex.lastIndex+=i.length,t.regex.lastIndex-=n[0].length):t.regex.lastIndex=0,a++,a>=this.maxReplaces)break}}),e}nest(e,t,s={}){let o,n,i;const a=(e,t)=>{const s=this.nestingOptionsSeparator;if(e.indexOf(s)<0)return e;const o=e.split(new RegExp(`${s}[ ]*{`));let n=`{${o[1]}`;e=o[0],n=this.interpolate(n,i);const a=n.match(/'/g),r=n.match(/"/g);(j(I([a,"optionalAccess",e=>e.length]),()=>0)%2==0&&!r||r.length%2!=0)&&(n=n.replace(/'/g,'"'));try{i=JSON.parse(n),t&&(i={...t,...i})}catch(t){return this.logger.warn(`failed parsing options string in nesting for key ${e}`,t),`${e}${s}${n}`}return i.defaultValue&&i.defaultValue.indexOf(this.prefix)>-1&&delete i.defaultValue,e};for(;o=this.nestingRegexp.exec(e);){let r=[];i={...s},i=i.replace&&!F(i.replace)?i.replace:i,i.applyPostProcessor=!1,delete i.defaultValue;const l=/{.*}/.test(o[1])?o[1].lastIndexOf("}")+1:o[1].indexOf(this.formatSeparator);if(-1!==l&&(r=o[1].slice(l).split(this.formatSeparator).map(e=>e.trim()).filter(Boolean),o[1]=o[1].slice(0,l)),n=t(a.call(this,o[1].trim(),i),i),n&&o[0]===e&&!F(n))return n;F(n)||(n=q(n)),n||(this.logger.warn(`missed to resolve ${o[1]} for nesting ${e}`),n=""),r.length&&(n=r.reduce((e,t)=>this.format(e,t,s.lng,{...s,interpolationkey:o[1].trim()}),n.trim())),e=e.replace(o[0],n),this.regexp.lastIndex=0}return e}}const be=e=>{const t={};return(s,o,n)=>{let i=n;n&&n.interpolationkey&&n.formatParams&&n.formatParams[n.interpolationkey]&&n[n.interpolationkey]&&(i={...i,[n.interpolationkey]:void 0});const a=o+JSON.stringify(i);let r=t[a];return r||(r=e(Z(o),n),t[a]=r),r(s)}},xe=e=>(t,s,o)=>e(Z(s),o)(t);class ve{constructor(e={}){this.logger=se.create("formatter"),this.options=e,this.init(e)}init(e,t={interpolation:{}}){this.formatSeparator=t.interpolation.formatSeparator||",";const s=t.cacheInBuiltFormats?be:xe;this.formats={number:s((e,t)=>{const s=new Intl.NumberFormat(e,{...t});return e=>s.format(e)}),currency:s((e,t)=>{const s=new Intl.NumberFormat(e,{...t,style:"currency"});return e=>s.format(e)}),datetime:s((e,t)=>{const s=new Intl.DateTimeFormat(e,{...t});return e=>s.format(e)}),relativetime:s((e,t)=>{const s=new Intl.RelativeTimeFormat(e,{...t});return e=>s.format(e,t.range||"day")}),list:s((e,t)=>{const s=new Intl.ListFormat(e,{...t});return e=>s.format(e)})}}add(e,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=be(t)}format(e,t,s,o={}){const n=t.split(this.formatSeparator);if(n.length>1&&n[0].indexOf("(")>1&&n[0].indexOf(")")<0&&n.find(e=>e.indexOf(")")>-1)){const e=n.findIndex(e=>e.indexOf(")")>-1);n[0]=[n[0],...n.splice(1,e)].join(this.formatSeparator)}return n.reduce((e,t)=>{const{formatName:n,formatOptions:i}=(e=>{let t=e.toLowerCase().trim();const s={};if(e.indexOf("(")>-1){const o=e.split("(");t=o[0].toLowerCase().trim();const n=o[1].substring(0,o[1].length-1);"currency"===t&&n.indexOf(":")<0?s.currency||(s.currency=n.trim()):"relativetime"===t&&n.indexOf(":")<0?s.range||(s.range=n.trim()):n.split(";").forEach(e=>{if(e){const[t,...o]=e.split(":"),n=o.join(":").trim().replace(/^'+|'+$/g,""),i=t.trim();s[i]||(s[i]=n),"false"===n&&(s[i]=!1),"true"===n&&(s[i]=!0),isNaN(n)||(s[i]=parseInt(n,10))}})}return{formatName:t,formatOptions:s}})(t);if(this.formats[n]){let t=e;try{const a=I([o,"optionalAccess",e=>e.formatParams,"optionalAccess",e=>e[o.interpolationkey]])||{},r=a.locale||a.lng||o.locale||o.lng||s;t=this.formats[n](e,r,{...i,...o,...a})}catch(e){this.logger.warn(e)}return t}return this.logger.warn(`there was no format function for ${n}`),e},e)}}class Se extends oe{constructor(e,t,s,o={}){super(),this.backend=e,this.store=t,this.services=s,this.languageUtils=s.languageUtils,this.options=o,this.logger=se.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=o.maxParallelReads||10,this.readingCalls=0,this.maxRetries=o.maxRetries>=0?o.maxRetries:5,this.retryTimeout=o.retryTimeout>=1?o.retryTimeout:350,this.state={},this.queue=[],I([this,"access",e=>e.backend,"optionalAccess",e=>e.init,"optionalCall",e=>e(s,o.backend,o)])}queueLoad(e,t,s,o){const n={},i={},a={},r={};return e.forEach(e=>{let o=!0;t.forEach(t=>{const a=`${e}|${t}`;!s.reload&&this.store.hasResourceBundle(e,t)?this.state[a]=2:this.state[a]<0||(1===this.state[a]?void 0===i[a]&&(i[a]=!0):(this.state[a]=1,o=!1,void 0===i[a]&&(i[a]=!0),void 0===n[a]&&(n[a]=!0),void 0===r[t]&&(r[t]=!0)))}),o||(a[e]=!0)}),(Object.keys(n).length||Object.keys(i).length)&&this.queue.push({pending:i,pendingCount:Object.keys(i).length,loaded:{},errors:[],callback:o}),{toLoad:Object.keys(n),pending:Object.keys(i),toLoadLanguages:Object.keys(a),toLoadNamespaces:Object.keys(r)}}loaded(e,t,s){const o=e.split("|"),n=o[0],i=o[1];t&&this.emit("failedLoading",n,i,t),!t&&s&&this.store.addResourceBundle(n,i,s,void 0,void 0,{skipCopy:!0}),this.state[e]=t?-1:2,t&&s&&(this.state[e]=0);const a={};this.queue.forEach(s=>{((e,t,s)=>{const{obj:o,k:n}=K(e,t,Object);o[n]=o[n]||[],o[n].push(s)})(s.loaded,[n],i),((e,t)=>{void 0!==e.pending[t]&&(delete e.pending[t],e.pendingCount--)})(s,e),t&&s.errors.push(t),0!==s.pendingCount||s.done||(Object.keys(s.loaded).forEach(e=>{a[e]||(a[e]={});const t=s.loaded[e];t.length&&t.forEach(t=>{void 0===a[e][t]&&(a[e][t]=!0)})}),s.done=!0,s.errors.length?s.callback(s.errors):s.callback())}),this.emit("loaded",a),this.queue=this.queue.filter(e=>!e.done)}read(e,t,s,o=0,n=this.retryTimeout,i){if(!e.length)return i(null,{});if(this.readingCalls>=this.maxParallelReads)return void this.waitingReads.push({lng:e,ns:t,fcName:s,tried:o,wait:n,callback:i});this.readingCalls++;const a=(a,r)=>{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)}a&&r&&o<this.maxRetries?setTimeout(()=>{this.read.call(this,e,t,s,o+1,2*n,i)},n):i(a,r)},r=this.backend[s].bind(this.backend);if(2!==r.length)return r(e,t,a);try{const s=r(e,t);s&&"function"==typeof s.then?s.then(e=>a(null,e)).catch(a):a(null,s)}catch(e){a(e)}}prepareLoading(e,t,s={},o){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),o&&o();F(e)&&(e=this.languageUtils.toResolveHierarchy(e)),F(t)&&(t=[t]);const n=this.queueLoad(e,t,s,o);if(!n.toLoad.length)return n.pending.length||o(),null;n.toLoad.forEach(e=>{this.loadOne(e)})}load(e,t,s){this.prepareLoading(e,t,{},s)}reload(e,t,s){this.prepareLoading(e,t,{reload:!0},s)}loadOne(e,t=""){const s=e.split("|"),o=s[0],n=s[1];this.read(o,n,"read",void 0,void 0,(s,i)=>{s&&this.logger.warn(`${t}loading namespace ${n} for language ${o} failed`,s),!s&&i&&this.logger.log(`${t}loaded namespace ${n} for language ${o}`,i),this.loaded(e,s,i)})}saveMissing(e,t,s,o,n,i={},a=()=>{}){if(!I([this,"access",e=>e.services,"optionalAccess",e=>e.utils,"optionalAccess",e=>e.hasLoadedNamespace])||I([this,"access",e=>e.services,"optionalAccess",e=>e.utils,"optionalAccess",e=>e.hasLoadedNamespace,"call",e=>e(t)])){if(null!=s&&""!==s){if(I([this,"access",e=>e.backend,"optionalAccess",e=>e.create])){const r={...i,isUpdate:n},l=this.backend.create.bind(this.backend);if(l.length<6)try{let n;n=5===l.length?l(e,t,s,o,r):l(e,t,s,o),n&&"function"==typeof n.then?n.then(e=>a(null,e)).catch(a):a(null,n)}catch(e){a(e)}else l(e,t,s,o,a,r)}e&&e[0]&&this.store.addResource(e[0],t,s,o)}}else this.logger.warn(`did not save key "${s}" 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 we=()=>({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]),F(e[1])&&(t.defaultValue=e[1]),F(e[2])&&(t.tDescription=e[2]),"object"==typeof e[2]||"object"==typeof e[3]){const s=e[3]||e[2];Object.keys(s).forEach(e=>{t[e]=s[e]})}return t},interpolation:{escapeValue:!0,format:e=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),ke=e=>(F(e.ns)&&(e.ns=[e.ns]),F(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),F(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),I([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),Ce=()=>{};class Ae extends oe{constructor(e={},t){var s;if(super(),this.options=ke(e),this.services={},this.logger=se,this.modules={external:[]},s=this,Object.getOwnPropertyNames(Object.getPrototypeOf(s)).forEach(e=>{"function"==typeof s[e]&&(s[e]=s[e].bind(s))}),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&&(F(e.ns)?e.defaultNS=e.ns:e.ns.indexOf("translation")<0&&(e.defaultNS=e.ns[0]));const s=we();var o;this.options={...s,...this.options,...ke(e)},this.options.interpolation={...s.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=s.overloadTranslationOptionHandler),!1===this.options.showSupportNotice||(I([o=this,"optionalAccess",e=>e.modules,"optionalAccess",e=>e.backend,"optionalAccess",e=>e.name,"optionalAccess",e=>e.indexOf,"call",e=>e("Locize")])>0||I([o,"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||I([o,"optionalAccess",e=>e.options,"optionalAccess",e=>e.backend,"optionalAccess",e=>e.backends])&&o.options.backend.backends.some(e=>I([e,"optionalAccess",e=>e.name,"access",e=>e.indexOf,"call",e=>e("Locize")])>0||I([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 n=e=>e?"function"==typeof e?new e:e:null;if(!this.options.isClone){let e;this.modules.logger?se.init(n(this.modules.logger),this.options):se.init(null,this.options),e=this.modules.formatter?this.modules.formatter:ve;const t=new de(this.options);this.store=new ne(this.options.resources,this.options);const o=this.services;o.logger=se,o.resourceStore=this.store,o.languageUtils=t,o.pluralResolver=new ge(t,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix});this.options.interpolation.format&&this.options.interpolation.format!==s.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!==s.interpolation.format||(o.formatter=n(e),o.formatter.init&&o.formatter.init(o,this.options),this.options.interpolation.format=o.formatter.format.bind(o.formatter)),o.interpolator=new ye(this.options),o.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},o.backendConnector=new Se(n(this.modules.backend),o.resourceStore,o,this.options),o.backendConnector.on("*",(e,...t)=>{this.emit(e,...t)}),this.modules.languageDetector&&(o.languageDetector=n(this.modules.languageDetector),o.languageDetector.init&&o.languageDetector.init(o,this.options.detection,this.options)),this.modules.i18nFormat&&(o.i18nFormat=n(this.modules.i18nFormat),o.i18nFormat.init&&o.i18nFormat.init(this)),this.translator=new pe(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=Ce),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 i=D(),a=()=>{const e=(e,s)=>{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),i.resolve(s),t(e,s)};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?a():setTimeout(a,0),i}loadResources(e,t=Ce){let s=t;const o=F(e)?e:this.language;if("function"==typeof e&&(s=e),!this.options.resources||this.options.partialBundledLanguages){if("cimode"===I([o,"optionalAccess",e=>e.toLowerCase,"call",e=>e()])&&(!this.options.preload||0===this.options.preload.length))return s();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(o)t(o);else{this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(e=>t(e))}I([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),s(e)})}else s(null)}reloadResources(e,t,s){const o=D();return"function"==typeof e&&(s=e,e=void 0),"function"==typeof t&&(s=t,t=void 0),e||(e=this.languages),t||(t=this.options.ns),s||(s=Ce),this.services.backendConnector.reload(e,t,e=>{o.resolve(),s(e)}),o}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&&ie.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 s=D();this.emit("languageChanging",e);const o=e=>{this.language=e,this.languages=this.services.languageUtils.toResolveHierarchy(e),this.resolvedLanguage=void 0,this.setResolvedLanguage(e)},n=(n,i)=>{i?this.isLanguageChangingTo===e&&(o(i),this.translator.changeLanguage(i),this.isLanguageChangingTo=void 0,this.emit("languageChanged",i),this.logger.log("languageChanged",i)):this.isLanguageChangingTo=void 0,s.resolve((...e)=>this.t(...e)),t&&t(n,(...e)=>this.t(...e))},i=t=>{e||t||!this.services.languageDetector||(t=[]);const s=F(t)?t:t&&t[0],i=this.store.hasLanguageSomeTranslations(s)?s:this.services.languageUtils.getBestMatchFromCodes(F(t)?[t]:t);i&&(this.language||o(i),this.translator.language||this.translator.changeLanguage(i),I([this,"access",e=>e.services,"access",e=>e.languageDetector,"optionalAccess",e=>e.cacheUserLanguage,"optionalCall",e=>e(i)])),this.loadResources(i,e=>{n(e,i)})};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(i):this.services.languageDetector.detect(i):i(e):i(this.services.languageDetector.detect()),s}getFixedT(e,t,s){const o=(e,t,...n)=>{let i;i="object"!=typeof t?this.options.overloadTranslationOptionHandler([e,t].concat(n)):{...t},i.lng=i.lng||o.lng,i.lngs=i.lngs||o.lngs,i.ns=i.ns||o.ns,""!==i.keyPrefix&&(i.keyPrefix=i.keyPrefix||s||o.keyPrefix);const a=this.options.keySeparator||".";let r;return i.keyPrefix&&Array.isArray(e)?r=e.map(e=>("function"==typeof e&&(e=re(e,{...this.options,...t})),`${i.keyPrefix}${a}${e}`)):("function"==typeof e&&(e=re(e,{...this.options,...t})),r=i.keyPrefix?`${i.keyPrefix}${a}${e}`:e),this.t(r,i)};return F(e)?o.lng=e:o.lngs=e,o.ns=t,o.keyPrefix=s,o}t(...e){return I([this,"access",e=>e.translator,"optionalAccess",e=>e.translate,"call",t=>t(...e)])}exists(...e){return I([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 s=t.lng||this.resolvedLanguage||this.languages[0],o=!!this.options&&this.options.fallbackLng,n=this.languages[this.languages.length-1];if("cimode"===s.toLowerCase())return!0;const i=(e,t)=>{const s=this.services.backendConnector.state[`${e}|${t}`];return-1===s||0===s||2===s};if(t.precheck){const e=t.precheck(this,i);if(void 0!==e)return e}return!!this.hasResourceBundle(s,e)||(!(this.services.backendConnector.backend&&(!this.options.resources||this.options.partialBundledLanguages))||!(!i(s,e)||o&&!i(n,e)))}loadNamespaces(e,t){const s=D();return this.options.ns?(F(e)&&(e=[e]),e.forEach(e=>{this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}),this.loadResources(e=>{s.resolve(),t&&t(e)}),s):(t&&t(),Promise.resolve())}loadLanguages(e,t){const s=D();F(e)&&(e=[e]);const o=this.options.preload||[],n=e.filter(e=>o.indexOf(e)<0&&this.services.languageUtils.isSupportedCode(e));return n.length?(this.options.preload=o.concat(n),this.loadResources(e=>{s.resolve(),t&&t(e)}),s):(t&&t(),Promise.resolve())}dir(e){if(e||(e=this.resolvedLanguage||(I([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=I([this,"access",e=>e.services,"optionalAccess",e=>e.languageUtils])||new de(we());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 s=new Ae(e,t);return s.createInstance=Ae.createInstance,s}cloneInstance(e={},t=Ce){const s=e.forkResourceStore;s&&delete e.forkResourceStore;const o={...this.options,...e,isClone:!0},n=new Ae(o);void 0===e.debug&&void 0===e.prefix||(n.logger=n.logger.clone(e));if(["store","services","language"].forEach(e=>{n[e]=this[e]}),n.services={...this.services},n.services.utils={hasLoadedNamespace:n.hasLoadedNamespace.bind(n)},s){const e=Object.keys(this.store.data).reduce((e,t)=>(e[t]={...this.store.data[t]},e[t]=Object.keys(e[t]).reduce((s,o)=>(s[o]={...e[t][o]},s),e[t]),e),{});n.store=new ne(e,o),n.services.resourceStore=n.store}if(e.interpolation){const t={...we().interpolation,...this.options.interpolation,...e.interpolation},s={...o,interpolation:t};n.services.interpolator=new ye(s)}return n.translator=new pe(n.services,o),n.translator.on("*",(e,...t)=>{n.emit(e,...t)}),n.init(o,t),n.translator.options=o,n.translator.backendConnector.services.utils={hasLoadedNamespace:n.hasLoadedNamespace.bind(n)},n}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const Le=Ae.createInstance();Le.createInstance,Le.dir,Le.init,Le.loadResources,Le.reloadResources,Le.use,Le.changeLanguage,Le.getFixedT,Le.t,Le.exists,Le.setDefaultNamespace,Le.hasLoadedNamespace,Le.loadNamespaces,Le.loadLanguages;Le.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 Ee={translator:{...Le,t:(e,t)=>{const{lng:s}=t;switch(s){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 Le.t(e,{lng:s,...t})}},languageOptions:[{value:"en_US",label:"English (US)"},{value:"es_ES",label:"Spanish"}]};const Oe=t,Re=o,_e=i,{Feedback:$e}=n,{Collapsible:Pe}=n,{Readable:Ne}=n,{hasText:Te}=n,{hasMedia:je}=n,{PreviewPrompt:Ie}=n,{UiLayout:Fe}=n,{color:De}=n,{styled:qe}=s,{Tooltip:Me}=a,{isEqual:Be}=r,{isEmpty:Ve}=r,Ke=e,{mq:Ue}=p,{HorizontalKeypad:He}=p,{updateSpans:ze}=p,We=d,{renderMath:Je}=h;function Ye(e){let t,s=e[0],o=1;for(;o<e.length;){const n=e[o],i=e[o+1];if(o+=2,("optionalAccess"===n||"optionalCall"===n)&&null==s)return;"access"===n||"optionalAccess"===n?(t=s,s=i(s)):"call"!==n&&"optionalCall"!==n||(s=i((...e)=>s.call(t,...e)),t=void 0)}return s}const{translator:Qe}=Ee;let Ge=!1;const Xe=/\\newline/g,Ze=/{{response}}/gm,et=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);function tt(e=[],t){return 30*Math.floor(e.length/5)+("miscellaneous"===t?600:500)}function st(e,t){const s={};if(t.config&&t.config.expression){let o=1;(t.config.expression||"").replace(Ze,()=>{s[`r${o}`]={value:e&&e.answers&&e.answers[`r${o}`]&&e.answers[`r${o}`].value||""},o+=1})}return s}class ot extends Oe.Component{static __initStatic(){this.propTypes={session:Re.object.isRequired,onSessionChange:Re.func,model:Re.object.isRequired}}constructor(e){super(e),ot.prototype.__init.call(this),ot.prototype.__init2.call(this),ot.prototype.__init3.call(this),ot.prototype.__init4.call(this),ot.prototype.__init5.call(this),ot.prototype.__init6.call(this),ot.prototype.__init7.call(this),ot.prototype.__init8.call(this),ot.prototype.__init9.call(this),ot.prototype.__init10.call(this),ot.prototype.__init11.call(this),ot.prototype.__init12.call(this),ot.prototype.__init13.call(this),ot.prototype.__init14.call(this),ot.prototype.__init15.call(this),ot.prototype.__init16.call(this);const{model:t,session:s}=e,o=st(s,t);this.state={session:{...e.session,answers:o},activeAnswerBlock:"",showCorrect:this.props.model.config.alwaysShowCorrect||!1,tooltipContainerRef:Oe.createRef()}}UNSAFE_componentWillMount(){if("undefined"!=typeof window){let e=We.getInterface(2);Ge||(e.registerEmbed("answerBlock",e=>{const t=nt();return{htmlString:`<div class="${t.blockContainer}">\n <div class="${t.blockResponse}" id="${e}Index">R</div>\n <div class="${t.blockMath}">\n <span id="${e}"></span>\n </div>\n </div>`,text:()=>"text",latex:()=>`\\embed{answerBlock}[${e}]`}}),Ge=!0)}}__init(){this.handleAnswerBlockDomUpdate=()=>{const{model:e}=this.props,{session:t,showCorrect:s}=this.state,o=t.answers;this.root&&e.disabled&&!s&&Object.keys(o).forEach(t=>{const s=this.root.querySelector(`#${t}`),n=this.root.querySelector(`#${t}Index`);if(s){let i=We.getInterface(2);const a=o[t];s.textContent=a&&a.value||"",e.view&&(s.parentElement.parentElement.classList.remove("correct"),s.parentElement.parentElement.classList.remove("incorrect")),i.StaticMath(s),n.textContent="R"}}),Je(this.root)}}countResponseOccurrences(e){const t=/\{\{response\}\}/g,s=Ye([e,"optionalAccess",e=>e.match,"call",e=>e(t)]);return s?s.length:0}UNSAFE_componentWillReceiveProps(e){const{config:t}=this.props.model,{config:s={}}=e.model||{},{session:o}=this.props,{session:n={}}=e||{};if(o&&n&&!Be(o.answers,n.answers)&&this.setState({session:{...n,answers:st(n,this.props.model)}}),t.note&&t.language&&t.language!==s.language&&t.note===Qe.t("mathInline.primaryCorrectWithAlternates",{lng:t.language})&&(t.note=Qe.t("mathInline.primaryCorrectWithAlternates",{lng:s.language})),(t.env&&"evaluate"!==t.env.mode||s.env&&"evaluate"!==s.env.mode)&&this.setState({...this.state.session,showCorrect:!1}),s.alwaysShowCorrect&&this.setState({showCorrect:!0}),this.countResponseOccurrences(t.expression)<this.countResponseOccurrences(s.expression)&&setTimeout(()=>this.updateAria(),100),t&&t.responses&&t.responses.length!==s.responses.length||!t&&s&&s.responses||t&&s&&t.expression!==s.expression){const e={},t=this.state.session.answers;let o=1;(s.expression||"").replace(Ze,()=>{e[`r${o}`]={value:t&&t[`r${o}`]&&t[`r${o}`].value||""},o++}),this.setState(t=>({session:{...t.session,completeAnswer:this.mqStatic&&this.mqStatic.mathField.latex(),answers:e}}),this.handleAnswerBlockDomUpdate)}}shouldComponentUpdate(e,t){const s=Be(this.props.model,e.model),o=Be(this.state,t);return!s||!o}componentDidMount(){this.handleAnswerBlockDomUpdate(),this.updateAria(),setTimeout(()=>Je(this.root),100)}componentDidUpdate(e,t){this.handleAnswerBlockDomUpdate();Ye([e,"access",e=>e.model,"optionalAccess",e=>e.config,"optionalAccess",e=>e.responseType])!==Ye([this,"access",e=>e.props,"access",e=>e.model,"optionalAccess",e=>e.config,"optionalAccess",e=>e.responseType])&&this.updateAria()}__init2(){this.updateAria=()=>{if(this.root){this.root.querySelectorAll(".mq-selectable").forEach(e=>e.setAttribute("aria-hidden","true"));this.root.querySelectorAll("textarea").forEach((e,t)=>{e.setAttribute("aria-label","Enter answer.");const s=`instructions-${t}`,o=e.closest(".mq-textarea");if(o){let t=o.querySelector(`#${s}`);t||(t=document.createElement("span"),t.id=s,t.className="sr-only",t.textContent="This field supports both keypad and keyboard input. Use the keyboard to access and interact with the on-screen math keypad, which accepts LaTeX markup. Use the down arrow key to open the keypad and navigate its buttons. Use the escape key to close the keypad and return to the input field.",o.insertBefore(t,e)),e.setAttribute("aria-describedby",s)}})}}}__init3(){this.focusFirstKeypadElement=()=>{setTimeout(()=>{const e=document.querySelector("[data-keypad]");if(e){const t=e.querySelector("button, [role='button']");t&&t.focus()}},0)}}__init4(){this.handleKeyDown=(e,t)=>{const s=function(e,t){let s=e;for(;null!==s;){if(t&&s===t)return!0;s=s.parentNode}return!1}(e.target,this.root),o=this.mqStatic&&Ye([this,"access",e=>e.mqStatic,"access",e=>e.inputRef,"optionalAccess",e=>e.current])?Ye([this,"access",e=>e.mqStatic,"access",e=>e.inputRef,"optionalAccess",e=>e.current,"access",e=>e.contains,"call",e=>e(document.activeElement)]):"Enter answer."===Ye([document,"access",e=>e.activeElement,"optionalAccess",e=>e.getAttribute,"call",e=>e("aria-label")]),{key:n,type:i}=e;o&&("ArrowDown"===n||("click"===i||"touchstart"===i))?this.state.activeAnswerBlock!==t&&s&&(this.cleanupKeyDownListener(),this.setState({activeAnswerBlock:t},()=>{this.onSubFieldFocus(t),"ArrowDown"===n&&this.focusFirstKeypadElement()})):"Escape"===e.key&&this.setState({activeAnswerBlock:""})}}__init5(){this.onSubFieldFocus=e=>{this.handleEvent||(this.handleEvent=t=>{this.handleKeyDown(t,e)},document.addEventListener("keydown",this.handleEvent),document.addEventListener("click",this.handleEvent),document.addEventListener("touchstart",this.handleEvent))}}__init6(){this.cleanupKeyDownListener=()=>{this.handleEvent&&(document.removeEventListener("keydown",this.handleEvent),document.removeEventListener("click",this.handleEvent),document.removeEventListener("touchstart",this.handleEvent),this.handleEvent=null)}}componentWillUnmount(){this.cleanupKeyDownListener&&this.cleanupKeyDownListener()}__init7(){this.onDone=()=>{}}__init8(){this.onSimpleResponseChange=e=>{this.setState(t=>({session:{...t.session,response:e}}),this.callOnSessionChange)}}__init9(){this.toNodeData=e=>{if(!e)return;const{type:t,value:s}=e;return"command"===t||"cursor"===t?e:"answer"===t?{type:"answer",...e}:"clear"===s?{type:"clear"}:{type:"write",value:s}}}__init10(){this.setInput=e=>{this.input=e}}__init11(){this.onClick=e=>{const t=this.toNodeData(e);"clear"===t.type?this.input.clear():"command"===t.type?Array.isArray(t.value)?t.value.forEach(e=>{this.input.cmd(e)}):this.input.cmd(t.value):"cursor"===t.type?this.input.keystroke(t.value):this.input.write(t.value),this.input.focus()}}__init12(){this.callOnSessionChange=()=>{const{onSessionChange:e}=this.props;e&&e(this.state.session)}}__init13(){this.toggleShowCorrect=e=>{this.setState({showCorrect:e},this.handleAnswerBlockDomUpdate)}}__init14(){this.subFieldChanged=(e,t)=>{ze(),e&&this.setState(s=>({session:{...s.session,completeAnswer:this.mqStatic&&this.mqStatic.mathField.latex(),answers:{...s.session.answers,[e]:{value:t}}}}),this.callOnSessionChange)}}__init15(){this.getFieldName=(e,t)=>{const{answers:s}=this.state.session;if(Object.keys(s||{}).length){return Object.keys(s).find(s=>{const o=t[s];return o&&o.id==e.id})}}}__init16(){this.onBlur=e=>{const{relatedTarget:t,currentTarget:s}=e||{},o=s&&s.closest("[role=tooltip]");const n=function e(t,s=0){if(!t||s>=16)return null;const o=t.offsetParent;return o?"tooltip"===o.getAttribute("role")?o:e(o,s+1):null}(t),i=n?function e(t,s=0){if(!t||s>=4)return null;const o=Ye([t,"optionalAccess",e=>e.children,"optionalAccess",e=>e[0]]);return o?o.attributes&&o.attributes["data-keypad"]?o:e(o,s+1):null}(n):null;t&&s&&Ye([i,"optionalAccess",e=>e.attributes,"access",e=>e["data-keypad"]])||o||this.setState({activeAnswerBlock:""})}}setTooltipRef(e){setTimeout(()=>{if(e&&et){const e=document.querySelector("[role='tooltip']");if(e){e.firstChild.setAttribute("tabindex","-1")}}},1)}render(){const{model:e}=this.props,{activeAnswerBlock:t,showCorrect:s,session:o,tooltipContainerRef:n}=this.state,{config:i,correctness:a,disabled:r,extraCSSRules:l,view:c,teacherInstructions:p,rationale:d,feedback:h,animationsDisabled:u,printMode:g,alwaysShowCorrect:m,language:f}=e||{};if(!i)return null;const{showNote:y,note:b,prompt:x,responses:v,responseType:S,equationEditor:w,customKeys:k,id:L,env:{mode:E,role:O}={}}=i||{},R=(s||"view"===E&&"instructor"===O)&&y&&b,_=Ve(v),$=!_&&a&&"correct"!==a.correctness,P=r&&a,N=function(e=[]){return e.map(e=>({name:e,latex:e,write:e,label:e}))}(k),j=a&&a.correct,I=function(e,t){const{config:s,disabled:o}=e||{},{expression:n,responses:i,printMode:a,alwaysShowCorrect:r}=s||{};if(s&&n){const e=n;if(t.showCorrect)return i&&i.length&&i[0].answer;let s=1;return(e||"").replace(Ze,function(){const e=t.session.answers[`r${s}`];if(a&&!r){const e="\\ \\ ".repeat(30)+"\\newline ";return`\\MathQuillMathField[r${s++}]{${e.repeat(3)}}`}return o?`\\embed{answerBlock}[r${s++}]`:`\\MathQuillMathField[r${s++}]{${e&&e.value||""}}`}).replace(Xe,"\\embed{newLine}[]")}}(e,this.state)||"",F=r&&!a,D=g&&!m,q=d&&(Te(d)||je(d)),M=p&&(Te(p)||je(p)),B=Oe.createElement(gt,null,Oe.createElement(Ue.Static,{className:"static-math",ref:e=>{e&&(this.mqStatic=e)},latex:I,onSubFieldChange:this.subFieldChanged,getFieldName:this.getFieldName,setInput:this.setInput,onSubFieldFocus:this.onSubFieldFocus,onBlur:this.onBlur})),V=Oe.createElement(lt,null,"gather"===E&&Oe.createElement(mt,null,"Math Equation Response Question"),F&&M&&(u?Oe.createElement("div",{dangerouslySetInnerHTML:{__html:p}}):Oe.createElement(pt,{labels:{hidden:"Show Teacher Instructions",visible:"Hide Teacher Instructions"}},Oe.createElement("div",{dangerouslySetInnerHTML:{__html:p}}))),x&&Oe.createElement(rt,null,Oe.createElement(Ie,{prompt:x})),D?B:Oe.createElement(Ne,{false:!0},Oe.createElement(ut,{tabIndex:0},S===A&&Oe.createElement(T,{onSimpleResponseChange:this.onSimpleResponseChange,showCorrect:s,emptyResponse:_,model:e,session:o,onSubFieldFocus:this.onSubFieldFocus,showKeypad:!!t}),S===C&&Oe.createElement(ht,{ref:n,isIncorrect:!_&&!j&&!s,isCorrect:!_&&(j||s),showCorrectness:!_&&r&&a&&!c,correctAnswerShown:s,printCorrect:g&&m},Oe.createElement(Me,{ref:e=>this.setTooltipRef(e),enterTouchDelay:0,interactive:!0,open:!!t,slotProps:{popper:{container:Ye([n,"optionalAccess",e=>e.current])||void 0,placement:"bottom-start",sx:{backgroundColor:"transparent",width:"650px",opacity:1,"& .MuiTooltip-arrow":{display:"none"}},modifiers:[{name:"offset",options:{offset:[0,8]}},{name:"preventOverflow",enabled:!0,options:{boundary:"viewport",padding:8}},{name:"computeStyles",options:{adaptive:!0,gpuAcceleration:!0}},{name:"flip",enabled:!1}]},tooltip:{sx:{fontSize:"initial",backgroundColor:"transparent",width:"600px",marginTop:0,paddingTop:0,boxShadow:"none"}}},title:Object.keys(o.answers).map(e=>e===t&&!(s||r)&&Oe.createElement(dt,{"data-keypad":!0,key:e,style:{width:tt(N,w)}},Oe.createElement(He,{additionalKeys:N,mode:w||6,onClick:this.onClick}))||null)},Oe.createElement("div",null,Oe.createElement(Ue.Static,{className:"static-math",ref:e=>{e&&(this.mqStatic=e)},latex:I,onSubFieldChange:this.subFieldChanged,getFieldName:this.getFieldName,setInput:this.setInput,onSubFieldFocus:this.onSubFieldFocus,onBlur:this.onBlur})))))),F&&R&&Oe.createElement(ct,{dangerouslySetInnerHTML:{__html:`<strong>Note:</strong> ${b}`}}),F&&q&&(u?Oe.createElement("div",{dangerouslySetInnerHTML:{__html:d}}):Oe.createElement(Pe,{labels:{hidden:"Show Rationale",visible:"Hide Rationale"}},Oe.createElement("div",{dangerouslySetInnerHTML:{__html:d}}))));return P&&($||M||q||h)?Oe.createElement(Fe,{extraCSSRules:l},Oe.createElement(at,{interactive:!0,enterTouchDelay:0,placement:"bottom-start",slotProps:{tooltip:{sx:e=>({background:`${De.primaryLight()} !important`,color:De.text(),padding:e.spacing(2),border:`1px solid ${De.secondary()}`,fontSize:"16px","& :not(.MathJax) > table tr":{"&:nth-child(2n)":{backgroundColor:"unset !important"}}})},popper:{sx:{opacity:1},modifiers:[{name:"offset",options:{offset:[0,2]}}]}},title:Oe.createElement("div",null,Oe.createElement(lt,null,$&&Oe.createElement(ft,{language:f,show:!0,toggled:s,onToggle:this.toggleShowCorrect})),M&&Oe.createElement(pt,{key:"collapsible-teacher-instructions",labels:{hidden:"Show Teacher Instructions",visible:"Hide Teacher Instructions"}},Oe.createElement(Ie,{prompt:p})),R&&Te(b)&&Oe.createElement(pt,{key:"collapsible-note",labels:{hidden:Qe.t("common:showNote",{lng:f}),visible:Qe.t("common:hideNote",{lng:f})}},Oe.createElement(Ie,{prompt:b})),q&&Oe.createElement(pt,{key:"collapsible-rationale",labels:{hidden:"Show Rationale",visible:"Hide Rationale"}},Oe.createElement(Ie,{prompt:d})),h&&Oe.createElement($e,{correctness:a.correctness,feedback:h}))},Oe.createElement(it,{ref:e=>this.root=e||this.root},V))):Oe.createElement(Fe,{id:L,extraCSSRules:l,ref:e=>{const t=Ke.findDOMNode(e);this.root=t||this.root}},Oe.createElement(it,null,V))}}ot.__initStatic();const nt=()=>({blockContainer:"block-container",blockResponse:"block-response",blockMath:"block-math"});if("undefined"!=typeof document){const e="math-inline-block-styles";if(!document.getElementById(e)){const t=document.createElement("style");t.id=e,t.textContent=`\n .block-container {\n margin: 8px !important;\n display: inline-flex;\n border: 2px solid grey !important;\n }\n .block-response {\n color: grey;\n background: #f5f5f5;\n font-size: 0.8rem !important;\n padding: 4px !important;\n display: flex;\n align-items: center;\n justify-content: center;\n border-right: 2px solid #bdbdbd !important;\n flex-shrink: 0;\n flex-grow: 0;\n flex-basis: auto;\n }\n .block-math {\n color: ${De.text()};\n background-color: ${De.background()};\n padding: 4px !important;\n display: flex;\n align-items: center;\n justify-content: center;\n flex-grow: 1;\n }\n .block-math > .mq-math-mode > .mq-hasCursor > .mq-cursor {\n display: none;\n }\n .sr-only {\n position: absolute;\n left: -10000px;\n top: auto;\n width: 1px;\n height: 1px;\n overflow: hidden;\n }\n .static-math > .mq-root-block > .mq-editable-field {\n border-color: ${De.text()};\n }\n `,document.head.appendChild(t)}}const it=qe("div")({color:De.text(),backgroundColor:De.background(),display:"inline-block"}),at=qe(Me)({}),rt=qe("div")(({theme:e})=>({marginBottom:e.spacing(2)})),lt=qe("div")({width:"100%",position:"relative",backgroundColor:De.background(),color:De.text()}),ct=qe("div")(({theme:e})=>({paddingBottom:e.spacing(2)})),pt=qe(Pe)(({theme:e})=>({marginBottom:e.spacing(2)})),dt=qe("div")(({theme:e})=>({zIndex:10,minWidth:"400px",marginTop:e.spacing(2)})),ht=qe("div",{shouldForwardProp:e=>!["isIncorrect","isCorrect","showCorrectness","correctAnswerShown","printCorrect"].includes(e)})(({theme:e,isIncorrect:t,isCorrect:s,showCorrectness:o,correctAnswerShown:n,printCorrect:i})=>{const a=t?De.incorrect():s?De.correct():void 0;return{maxWidth:"fit-content",padding:e.spacing(.25),...o&&{border:a?`2px solid ${a} !important`:"2px solid"},...!o&&a&&{borderColor:`${a} !important`},...n&&{padding:e.spacing(1),letterSpacing:"0.5px"},...i&&{border:`2px solid ${De.correct()} !important`},"& > .mq-math-mode":{"& > .mq-root-block":{paddingRight:"0 !important",paddingLeft:"0 !important","& > .mq-editable-field":{minWidth:"10px",padding:e.spacing(.25)}},"& sup":{top:0}}}}),ut=qe("div")({position:"relative","& .mq-overarrow-inner":{border:"none !important",padding:"0 !important"},"& .mq-overarrow-inner-right":{display:"none !important"},"& .mq-overarrow-inner-left":{display:"none !important"},"& .mq-overarrow.mq-arrow-both":{minWidth:"1.23em","& *":{lineHeight:"1 !important"},"&:before":{top:"-0.4em",left:"-1px"},"&:after":{top:"-2.4em",right:"-1px"},"&.mq-empty:after":{top:"-0.45em"}},"& .mq-overarrow.mq-arrow-right":{"&:before":{top:"-0.4em",right:"-1px"}},"& .mq-longdiv-inner":{borderTop:"1px solid !important",paddingTop:"1.5px !important"},"& .mq-parallelogram":{lineHeight:.85}}),gt=qe("div")(({theme:e})=>({marginBottom:e.spacing(1),pointerEvents:"none"})),mt=qe("h2")({position:"absolute",left:"-10000px",top:"auto",width:"1px",height:"1px",overflow:"hidden"}),ft=qe(_e)(({theme:e})=>({color:De.text(),marginBottom:e.spacing(2)})),yt=t,bt=r,xt=l("pie-ui:math-inline");class vt extends HTMLElement{constructor(){super(),this._root=null,this._configuration=w.configuration,this.sessionChangedEventCaller=bt.debounce(()=>{this.dispatchEvent(new x(this.tagName.toLowerCase(),!0))},1e3)}setLangAttribute(){const e=this._model&&(this._model.language,1)?this._model.language:"",t=e?e.slice(0,2):"en";this.setAttribute("lang",t);const s=this.closest(".player-container");s&&s.setAttribute("lang",t)}set model(e){this._model=e,this.dispatchEvent(new y(this._model,!0,!!this._model)),this.setLangAttribute(),this._render()}set session(e){this._session=e,this._render()}get session(){return this._session}set configuration(e){this._configuration=e,this._render()}sessionChanged(e){Object.keys(e).map(t=>{this._session[t]=e[t]}),this.sessionChangedEventCaller(),xt("session: ",this._session)}connectedCallback(){this.setAttribute("aria-label","Math Response Question"),this.setAttribute("role","region"),this._render()}_render(){if(!this._model||!this._session)return;const e=yt.createElement(ot,{model:this._model,session:this._session,configuration:this._configuration,onSessionChange:this.sessionChanged.bind(this)});this._root||(this._root=u(this)),this._root.render(e)}disconnectedCallback(){this._root&&this._root.unmount()}}export{ot as Component,vt as default};
@@ -0,0 +1,21 @@
1
+
2
+ <!doctype html>
3
+ <html>
4
+ <head>
5
+ <title>@pie-element/math-inline@11.0.0-beta.1</title>
6
+ <script
7
+ type="module"
8
+ src="https://cdn.jsdelivr.net/npm/@pslb/demo-el@^1.0.0/dist/demo-el/demo-el.esm.js"></script>
9
+
10
+ <link
11
+ href="https://fonts.googleapis.com/css?family=Roboto&display=swap"
12
+ rel="stylesheet"
13
+ />
14
+ <style>
15
+ html, body {
16
+ font-family: 'Roboto', sans-serif;
17
+ }
18
+ </style>
19
+ <script type="module" src="./demo.js"></script>
20
+ </head>
21
+ </html>
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "@pie-element/math-inline",
3
+ "version": "11.0.0-beta.1",
4
+ "modules": [
5
+ {
6
+ "name": "@pie-lib/shared-module",
7
+ "version": "^3.0.5"
8
+ },
9
+ {
10
+ "name": "@pie-lib/math-rendering-module",
11
+ "version": "^4.0.5"
12
+ },
13
+ {
14
+ "name": "@pie-lib/math-edit-module",
15
+ "version": "^3.0.5"
16
+ }
17
+ ]
18
+ }
@@ -0,0 +1,104 @@
1
+ import PrintElement from './print.js';
2
+
3
+ var generate = {};
4
+
5
+ /* const initialModel = {
6
+ customKeys: [],
7
+ equationEditor: 'geometry',
8
+ responseType: 'Advanced Multi',
9
+ expression: '{{response}}',
10
+ responses: [
11
+ {
12
+ answer: 'r=\\sqrt{\\frac{V}{7\\pi}}',
13
+ id: '1',
14
+ alternates: {},
15
+ validation: 'literal',
16
+ },
17
+ ],
18
+ 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.',
19
+ rationale:
20
+ '<p>The correct answer is:</p><ul><li><math xmlns="http://www.w3.org/1998/Math/MathML"><mi>r</mi><mo>=</mo><msqrt><mfrac><mi>V</mi><mrow><mn>7</mn><mi>&#960;</mi></mrow></mfrac></msqrt></math></li></ul>',
21
+ }; */
22
+
23
+ const E262456 = {
24
+ equationEditor: 3,
25
+ toolbarEditorPosition: 'bottom',
26
+ prompt:
27
+ '<p><strong>B.</strong> Find the value of the expression that you wrote in part A to find how much money the band members made.</p>\n\n<p>Use the on-screen keyboard to type your answer in the box below.</p>\n',
28
+ expression: '${{response}}',
29
+ responses: [
30
+ {
31
+ allowSpaces: true,
32
+ // 'validation': 'symbolic',
33
+ answer: '$410',
34
+ id: '1',
35
+ },
36
+ ],
37
+ responseType: 'Advanced Multi',
38
+ };
39
+
40
+ generate.model = (id, element) => ({
41
+ id,
42
+ element,
43
+ ...E262456,
44
+ rubricEnabled: false,
45
+ });
46
+
47
+ const { model } = generate;
48
+
49
+ var config = {
50
+ elements: {
51
+ 'math-inline': '../..',
52
+ },
53
+ models: [model('1', 'math-inline')],
54
+ };
55
+
56
+ // new init - just shows off print!
57
+
58
+ const init = async () => {
59
+ console.log('define the element...');
60
+ await Promise.all(
61
+ config.models.map(async (m) => {
62
+ try {
63
+ const printTag = `${m.element}-print`;
64
+ if (customElements.get(printTag)) {
65
+ return true;
66
+ } else {
67
+ customElements.define(printTag, PrintElement);
68
+ await customElements.whenDefined(printTag);
69
+ return true;
70
+ }
71
+ } catch (e) {
72
+ return false;
73
+ }
74
+ })
75
+ );
76
+
77
+ console.log('now apply the model...');
78
+ config.models.forEach((m) => {
79
+ const printTag = `${m.element}-print`;
80
+ const h3s = document.createElement('h3');
81
+ h3s.textContent = 'student mode';
82
+ document.body.appendChild(h3s);
83
+ const de = document.createElement(printTag);
84
+ document.body.appendChild(de);
85
+ de.options = {};
86
+ de.model = m;
87
+
88
+ const h3 = document.createElement('h3');
89
+ h3.textContent = 'instructor mode';
90
+ document.body.appendChild(h3);
91
+ const instr = document.createElement(printTag);
92
+ document.body.appendChild(instr);
93
+ instr.options = { mode: 'instructor' };
94
+ instr.model = JSON.parse(JSON.stringify(m));
95
+ });
96
+ };
97
+
98
+ init()
99
+ .then(() => {
100
+ console.log('ready');
101
+ })
102
+ .catch((e) => {
103
+ console.error(e);
104
+ });
@@ -0,0 +1,18 @@
1
+
2
+ <!doctype html>
3
+ <html>
4
+ <head>
5
+ <title>@pie-element/math-inline@11.0.0-beta.1</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>