0){var Q=M.split("="),L=Q[0],R=Q[1];R=R.indexOf("'")>=0?R.replace(/'/g,""):parseFloat(R),A[L]=R}}}else C=j.trim();Object.keys(A).length?S.push([C,A]):S.push([C])}var z=new u.SeqBasic(S);if(S.length>1){var F=(h.attr("data-pygen-order")||"random").trim().toLowerCase();F.startsWith("random")||F.startsWith("weighted")?z=new p.SeqRandomWeighted(S,F):F.startsWith("sequence")&&(z=new f.SeqSequence(S,F))}var B=$('"),N=$('"),U=null,G=null,H=function(){B.prop("disabled",!0),V.prop("disabled",!0),W.prop("disabled",!0),N.css("display","none"),a.cfg.HAS_IAPACE&&(x=t.iapace.inference(q)),w.setLevel(x);var e=z.next();$.ajax({type:"POST",url:a.cfg.PYGEN_URL,data:JSON.stringify({activities:[e],level:x}),dataType:"json",success:function(e){if(e.msg)return U=null,b.html('
ERROR
'+JSON.stringify(e.msg)+"
"+(h.attr("data-pygen-formulation")||"")+" "+e.formulation+"
");b.append(n);var r=atob(e.mq64),s=JSON.parse(r);if(a.cfg.HAS_IAPACE){var u=t.iapace.findCreate(q);u&&(0,d.sum)(u.h)>=30&&N.css("display",null==s.comodi?"none":"")}s.category=q,s.palettes||(s.palettes="all"),s.editor==a.cfg.QTYPES.M&&(s.editor=a.cfg.QTYPES.Ms),U=s,s.initial_latex&&(s.initial_latex=(0,c.processMqIni)(s.initial_latex));var p=[];if(s.symbols)for(var f=s.symbols.split(";"),v=0,y=f.length;vERROR
'+JSON.stringify(t)+"
0){var Q=M.split("="),L=Q[0],R=Q[1];R=R.indexOf("'")>=0?R.replace(/'/g,""):parseFloat(R),A[L]=R}}}else C=j.trim();Object.keys(A).length?S.push([C,A]):S.push([C])}var z=new u.SeqBasic(S);if(S.length>1){var F=(h.attr("data-pygen-order")||"random").trim().toLowerCase();F.startsWith("random")||F.startsWith("weighted")?z=new p.SeqRandomWeighted(S,F):F.startsWith("sequence")&&(z=new f.SeqSequence(S,F))}var B=$('"),N=$('"),U=null,G=null,H=function(){B.prop("disabled",!0),V.prop("disabled",!0),W.prop("disabled",!0),N.css("display","none"),s.cfg.HAS_IAPACE&&(x=t.iapace.inference(q)),w.setLevel(x);var e=z.next();$.ajax({type:"POST",url:s.cfg.PYGEN_URL,data:JSON.stringify({activities:[e],level:x}),dataType:"json",success:function(e){if(e.msg)return U=null,b.html('
ERROR
'+JSON.stringify(e.msg)+"
"+(h.attr("data-pygen-formulation")||"")+" "+e.formulation+"
");b.append(n);var r=atob(e.mq64),a=JSON.parse(r);if(s.cfg.HAS_IAPACE){var u=t.iapace.findCreate(q);u&&(0,d.sum)(u.h)>=30&&N.css("display",null==a.comodi?"none":"")}a.category=q,a.palettes||(a.palettes="all"),a.editor==s.cfg.QTYPES.M&&(a.editor=s.cfg.QTYPES.Ms),U=a,a.initial_latex&&(a.initial_latex=(0,c.processMqIni)(a.initial_latex));var p=[];if(a.symbols)for(var f=a.symbols.split(";"),v=0,y=f.length;vERROR
'+JSON.stringify(t)+"
ERROR
' + JSON.stringify(datos.msg) + '
' + ($eg.attr('data-pygen-formulation') || '') + ' ' + datos.formulation + '
');\n centralPanel.append(pregunta);\n //TODO: How to create the input widget eficienty \n //const dynEl = $('');\n //$eg.append(dynEl);\n const json_raw = atob(datos.mq64);\n const json_obj = JSON.parse(json_raw);\n //check if contains a comodi \n //TODO: decide if can use the comodi based on performance\n if (globals_1.cfg.HAS_IAPACE) {\n const frame = IB.iapace.findCreate(category);\n if (frame) {\n if ((0, utils_1.sum)(frame.h) >= 30) {\n console.log(\"Super! Has conseguit un comodí\");\n comodiBtn.css(\"display\", json_obj.comodi == null ? \"none\" : \"\");\n }\n }\n }\n json_obj.category = category;\n if (!json_obj.palettes) {\n //use all palettes if not defined\n json_obj.palettes = 'all';\n }\n // convert qtype.M (combo) to qtype.Ms (radios)\n if (json_obj.editor == globals_1.cfg.QTYPES.M) {\n json_obj.editor = globals_1.cfg.QTYPES.Ms;\n }\n currentDatos = json_obj;\n if (json_obj.initial_latex) {\n json_obj.initial_latex = (0, mq_parsing_1.processMqIni)(json_obj.initial_latex);\n }\n const symbols = [];\n if (json_obj.symbols) {\n const parts = json_obj.symbols.split(\";\");\n for (let r = 0, lenr = parts.length; r < lenr; r++) {\n const epart = parts[r];\n if (epart.trim()) {\n symbols.push(epart.trim());\n }\n }\n }\n json_obj.symbols = symbols;\n let rules = [];\n if (json_obj.rules) {\n rules = JSON.parse(json_obj.rules);\n }\n json_obj.rules = rules;\n // It should obtain category from here?\n console.log(json_obj);\n const qid = (0, createQuill_1.createQuillFromObject)(centralPanel, gid, json_obj);\n currentEditor = globals_1.shared[gid][qid];\n currentEditor.isPigen = true; //Marker that is dynamically generated for pigen\n //TODO can support many quills\n checkBtn.off();\n const extraActions = function (score10) {\n nextButton.prop(\"disabled\", false);\n showmeBtn.prop(\"disabled\", false);\n if (globals_1.cfg.HAS_IAPACE) {\n IB.iapace.addScore(category, score10);\n IB.iapace.save(); //Persistent storage\n }\n //TODO lunch confetti if succeded\n if (goalChecker && goalChecker.reached()) {\n if (topPanel.find(\".pw-goal-reached\").length == 0) {\n topPanel.append($('' + (0, I18n_1.I18n)('goal_reached') + ' '));\n }\n //celebration?\n if ($eg.attr(\"data-pygen-celebration\") == 'confetti' && window.Confetti) {\n const c = new window.Confetti($eg[0]);\n c.play();\n }\n }\n };\n (0, actions_1.bindSubmitActionButton)(gid, checkBtn, extraActions);\n console.log(globals_1.shared[gid]);\n (0, utils_1.reflowLatex)();\n checkBtn.prop(\"disabled\", false);\n // Create the same element as a group\n //$eg.addClass(\"pw-mq-group\");\n //findQuillGroups($eg.parent());\n },\n error: function (datos) {\n currentDatos = null;\n currentEditor = null;\n console.log(\"error\", datos);\n centralPanel.html('ERROR
' + JSON.stringify(datos) + '
ERROR
' + JSON.stringify(datos.msg) + '
' + ($eg.attr('data-pygen-formulation') || '') + ' ' + datos.formulation + '
');\n centralPanel.append(pregunta);\n //TODO: How to create the input widget eficienty \n //const dynEl = $('');\n //$eg.append(dynEl);\n const json_raw = atob(datos.mq64);\n const json_obj = JSON.parse(json_raw);\n //check if contains a comodi \n //TODO: decide if can use the comodi based on performance\n if (globals_1.cfg.HAS_IAPACE) {\n const frame = IB.iapace.findCreate(category);\n if (frame) {\n if ((0, utils_1.sum)(frame.h) >= 30) {\n console.log(\"Super! Has conseguit un comodí\");\n comodiBtn.css(\"display\", json_obj.comodi == null ? \"none\" : \"\");\n }\n }\n }\n json_obj.category = category;\n if (!json_obj.palettes) {\n //use all palettes if not defined\n json_obj.palettes = 'all';\n }\n // convert qtype.M (combo) to qtype.Ms (radios)\n if (json_obj.editor == globals_1.cfg.QTYPES.M) {\n json_obj.editor = globals_1.cfg.QTYPES.Ms;\n }\n currentDatos = json_obj;\n if (json_obj.initial_latex) {\n json_obj.initial_latex = (0, mq_parsing_1.processMqIni)(json_obj.initial_latex);\n }\n const symbols = [];\n if (json_obj.symbols) {\n const parts = json_obj.symbols.split(\";\");\n for (let r = 0, lenr = parts.length; r < lenr; r++) {\n const epart = parts[r];\n if (epart.trim()) {\n symbols.push(epart.trim());\n }\n }\n }\n json_obj.symbols = symbols;\n let rules = [];\n if (json_obj.rules) {\n rules = JSON.parse(json_obj.rules);\n }\n json_obj.rules = rules;\n // It should obtain category from here?\n console.log(json_obj);\n const qid = (0, createQuill_1.createQuillFromObject)(centralPanel, gid, json_obj);\n currentEditor = globals_1.shared[gid][qid];\n currentEditor.isPigen = true; //Marker that is dynamically generated for pigen\n //TODO can support many quills\n checkBtn.off();\n const extraActions = function (score10) {\n nextButton.prop(\"disabled\", false);\n showmeBtn.prop(\"disabled\", false);\n if (globals_1.cfg.HAS_IAPACE) {\n IB.iapace.addScore(category, score10);\n IB.iapace.save(); //Persistent storage\n }\n //TODO lunch confetti if succeded\n if (goalChecker && goalChecker.reached()) {\n if (topPanel.find(\".pw-goal-reached\").length == 0) {\n topPanel.append($('' + (0, I18n_1.I18n)('goal_reached') + ' '));\n }\n //celebration?\n if ($eg.attr(\"data-pygen-celebration\") == 'confetti' && window.Confetti) {\n const c = new window.Confetti($eg[0]);\n c.play();\n }\n }\n };\n (0, actions_1.bindSubmitActionButton)(gid, checkBtn, extraActions);\n console.log(globals_1.shared[gid]);\n (0, utils_1.reflowLatex)();\n checkBtn.prop(\"disabled\", false);\n // Create the same element as a group\n //$eg.addClass(\"pw-mq-group\");\n //findQuillGroups($eg.parent());\n },\n error: function (datos) {\n currentDatos = null;\n currentEditor = null;\n console.log(\"error\", datos);\n centralPanel.html('ERROR
' + JSON.stringify(datos) + '