diff --git a/migrations/Version202209151238261465_qtiItemPci.php b/migrations/Version202209151238261465_qtiItemPci.php new file mode 100644 index 00000000..186d7820 --- /dev/null +++ b/migrations/Version202209151238261465_qtiItemPci.php @@ -0,0 +1,42 @@ +addReport( + $this->propagate( + new RegisterPciMathEntry() + )( + ['2.0.3'] + ) + ); + + } + + public function down(Schema $schema): void + { + throw new IrreversibleMigration( + 'In order to undo this migration, please revert the client-side changes and run ' . RegisterPciMathEntry::class + ); + + } +} diff --git a/views/js/pciCreator/ims/mathEntryInteraction/creator/widget/states/Map.js b/views/js/pciCreator/ims/mathEntryInteraction/creator/widget/states/Map.js index 870d8da5..187dd4a5 100644 --- a/views/js/pciCreator/ims/mathEntryInteraction/creator/widget/states/Map.js +++ b/views/js/pciCreator/ims/mathEntryInteraction/creator/widget/states/Map.js @@ -303,10 +303,9 @@ define([ } MathEntryInteractionStateResponse.prototype.inGapMode = function inGapMode() { - var self = this, - interaction = self.widget.element; - - return interaction.prop('useGapExpression'); + var interaction = this.widget.element; + var useGapExpression = interaction.prop('useGapExpression'); + return useGapExpression && useGapExpression !== 'false' || false; } return MathEntryInteractionStateResponse; diff --git a/views/js/pciCreator/ims/mathEntryInteraction/imsPciCreator.json b/views/js/pciCreator/ims/mathEntryInteraction/imsPciCreator.json index e766da5a..298b78d8 100644 --- a/views/js/pciCreator/ims/mathEntryInteraction/imsPciCreator.json +++ b/views/js/pciCreator/ims/mathEntryInteraction/imsPciCreator.json @@ -8,7 +8,7 @@ "label": "Math entry", "short": "Math entry", "description": "Allow test taker to type math formulas", - "version": "2.0.2", + "version": "2.0.3", "author": "Christophe Noël", "email": "christophe@taotesting.com", "tags": [ diff --git a/views/js/pciCreator/ims/mathEntryInteraction/imsPciCreator.min.js b/views/js/pciCreator/ims/mathEntryInteraction/imsPciCreator.min.js index 639ebccf..fe6ce7fa 100644 --- a/views/js/pciCreator/ims/mathEntryInteraction/imsPciCreator.min.js +++ b/views/js/pciCreator/ims/mathEntryInteraction/imsPciCreator.min.js @@ -1 +1,1274 @@ -function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_typeof(obj)}define("tpl!mathEntryInteraction/creator/tpl/propertiesForm",["handlebars"],function(hb){return hb.template(function(Handlebars,depth0,helpers,partials,data){function program1(){return"checked=\"checked\""}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var stack1,helper,options,buffer="",helperMissing=helpers.helperMissing,escapeExpression=this.escapeExpression,self=this;return buffer+="
\n \n \n
"+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"The identifier of the choice. This identifier must not be used by any other response or item variable. An identifier is a string of characters that must start with a Letter or an underscore (\"_\") and contain only Letters, underscores, hyphens (\"-\"), period (\".\", a.k.a. full-stop), Digits, CombiningChars and Extenders.",options):helperMissing.call(depth0,"__","The identifier of the choice. This identifier must not be used by any other response or item variable. An identifier is a string of characters that must start with a Letter or an underscore (\"_\") and contain only Letters, underscores, hyphens (\"-\"), period (\".\", a.k.a. full-stop), Digits, CombiningChars and Extenders.",options)))+"
\n\n \n
\n\n
\n\n

"+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"Options",options):helperMissing.call(depth0,"__","Options",options)))+"

\n\n
\n \n \n
\n \n \n
\n
\n\n
\n\n

"+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"Functions",options):helperMissing.call(depth0,"__","Functions",options)))+"

\n\n
\n \n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n \n
\n\n
\n

"+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"Symbols",options):helperMissing.call(depth0,"__","Symbols",options)))+"

\n\n
\n \n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n \n
\n\n
\n

"+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"Geometry",options):helperMissing.call(depth0,"__","Geometry",options)))+"

\n\n
\n \n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n \n
\n\n
\n

"+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"Trigonometry",options):helperMissing.call(depth0,"__","Trigonometry",options)))+"

\n\n
\n \n
\n
\n \n
\n
\n \n
\n\n
\n

"+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"Comparison",options):helperMissing.call(depth0,"__","Comparison",options)))+"

\n\n
\n \n
\n
\n \n
\n
\n \n
\n
\n \n
\n\n
\n

"+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"Operands",options):helperMissing.call(depth0,"__","Operands",options)))+"

\n\n
\n \n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n \n
\n\n
\n\n

"+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"Experimental only",options):helperMissing.call(depth0,"__","Experimental only",options)))+"

\n\n
\n \n
\n
\n \n
",buffer})}),define("tpl!mathEntryInteraction/creator/tpl/addGapBtn",["handlebars"],function(hb){return hb.template(function(Handlebars,depth0,helpers,partials,data){this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var helper,options,buffer="",helperMissing=helpers.helperMissing,escapeExpression=this.escapeExpression;return buffer+="
\n "+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"Add gap",options):helperMissing.call(depth0,"__","Add gap",options)))+"\n
",buffer})}),define("mathEntryInteraction/creator/helper/mathInPrompt",["core/moduleLoader"],function(moduleLoader){"use strict";function load(){return loaded?Promise.resolve():moduleLoader([],function(){return!0}).add({module:"mathJax",category:"mathEntryInteraction"}).load().then(function(loadedModule){loaded=!0,MathJax=loadedModule&&loadedModule.length?loadedModule[0]:void 0,MathJax&&MathJax.Hub&&(MathJax.Hub.processSectionDelay=0)})}var MathJax,loaded=!1;return{postRender:function postRender($element){return 0===$element.find("math").length?Promise.resolve():load().then(function(){MathJax&&MathJax.Hub&&"function"==typeof MathJax.Hub.Queue&&(!window.MathJax&&(window.MathJax=MathJax),$element.length&&MathJax.Hub.Queue(["Typeset",MathJax.Hub,$element[0]]))})}}}),define("mathEntryInteraction/creator/widget/states/Question",["jquery","i18n","taoQtiItem/qtiCreator/widgets/states/factory","taoQtiItem/qtiCreator/widgets/interactions/states/Question","taoQtiItem/qtiCreator/widgets/helpers/formElement","taoQtiItem/qtiCreator/editor/simpleContentEditableElement","taoQtiItem/qtiCreator/editor/containerEditor","tpl!mathEntryInteraction/creator/tpl/propertiesForm","tpl!mathEntryInteraction/creator/tpl/addGapBtn","mathEntryInteraction/creator/helper/mathInPrompt"],function($,__,stateFactory,Question,formElement,simpleEditor,containerEditor,formTpl,addGapBtnTpl,mathInPrompt){"use strict";function toBoolean(value,defaultValue){return"undefined"==typeof value?defaultValue:!0===value||"true"===value}function configChangeCallBack(interaction,value,name){interaction.prop(name,value),interaction.triggerPci("configChange",[interaction.getProperties()])}var $addGapBtn=$(addGapBtnTpl()),MathEntryInteractionStateQuestion=stateFactory.extend(Question,function create(){var $container=this.widget.$container,$prompt=$container.find(".prompt"),interaction=this.widget.element;containerEditor.create($prompt,{change:function change(text){interaction.data("prompt",text),interaction.updateMarkup(),$prompt.is("[data-html-editable-container=\"true\"]")||mathInPrompt.postRender($prompt)},markup:interaction.markup,markupSelector:".prompt",related:interaction,areaBroker:this.widget.getAreaBroker()}),toBoolean(interaction.prop("useGapExpression"),!1)&&this.createAddGapBtn(),this.addMathFieldListener()},function exit(){var $container=this.widget.$container,$prompt=$container.find(".prompt");simpleEditor.destroy($container),containerEditor.destroy($prompt),this.removeAddGapBtn()});return MathEntryInteractionStateQuestion.prototype.initForm=function initForm(){var $gapStyleBox,$gapStyleSelector,self=this,_widget=this.widget,$form=_widget.$form,interaction=_widget.element,response=interaction.getResponseDeclaration();$form.html(formTpl({serial:response.serial,identifier:interaction.attr("responseIdentifier"),authorizeWhiteSpace:toBoolean(interaction.prop("authorizeWhiteSpace"),!1),useGapExpression:toBoolean(interaction.prop("useGapExpression"),!1),focusOnDenominator:toBoolean(interaction.prop("focusOnDenominator"),!1),tool_frac:toBoolean(interaction.prop("tool_frac"),!0),tool_sqrt:toBoolean(interaction.prop("tool_sqrt"),!0),tool_exp:toBoolean(interaction.prop("tool_exp"),!0),tool_log:toBoolean(interaction.prop("tool_log"),!0),tool_ln:toBoolean(interaction.prop("tool_ln"),!0),tool_e:toBoolean(interaction.prop("tool_e"),!0),tool_infinity:toBoolean(interaction.prop("tool_infinity"),!0),squarebkts:toBoolean(interaction.prop("tool_rbrack"),!0)&&toBoolean(interaction.prop("tool_lbrack"),!0),tool_pi:toBoolean(interaction.prop("tool_pi"),!0),tool_cos:toBoolean(interaction.prop("tool_cos"),!0),tool_sin:toBoolean(interaction.prop("tool_sin"),!0),tool_lte:toBoolean(interaction.prop("tool_lte"),!0),tool_gte:toBoolean(interaction.prop("tool_gte"),!0),tool_times:toBoolean(interaction.prop("tool_times"),!0),tool_divide:toBoolean(interaction.prop("tool_divide"),!0),tool_plusminus:toBoolean(interaction.prop("tool_plusminus"),!0),roundbkts:toBoolean(interaction.prop("tool_rparen"),!0)&&toBoolean(interaction.prop("tool_lparen"),!0),curlybkts:toBoolean(interaction.prop("tool_rbrace"),!0)&&toBoolean(interaction.prop("tool_lbrace"),!0),tool_angle:toBoolean(interaction.prop("tool_angle"),!0),tool_minus:toBoolean(interaction.prop("tool_minus"),!0),tool_plus:toBoolean(interaction.prop("tool_plus"),!0),tool_equal:toBoolean(interaction.prop("tool_equal"),!0),tool_lower:toBoolean(interaction.prop("tool_lower"),!0),tool_greater:toBoolean(interaction.prop("tool_greater"),!0),tool_subscript:toBoolean(interaction.prop("tool_subscript"),!0),tool_integral:toBoolean(interaction.prop("tool_integral"),!0),tool_timesdot:toBoolean(interaction.prop("tool_timesdot"),!0),tool_triangle:toBoolean(interaction.prop("tool_triangle"),!0),tool_similar:toBoolean(interaction.prop("tool_similar"),!0),tool_paral:toBoolean(interaction.prop("tool_paral"),!0),tool_perp:toBoolean(interaction.prop("tool_perp"),!0),tool_inmem:toBoolean(interaction.prop("tool_inmem"),!0),tool_ninmem:toBoolean(interaction.prop("tool_ninmem"),!0),tool_union:toBoolean(interaction.prop("tool_union"),!0),tool_intersec:toBoolean(interaction.prop("tool_intersec"),!0),allowNewLine:toBoolean(interaction.prop("allowNewLine"),!1),enableAutoWrap:toBoolean(interaction.prop("enableAutoWrap"),!1)})),formElement.initWidget($form),formElement.setChangeCallbacks($form,interaction,{identifier:function identifier(i,value){response.id(value),interaction.attr("responseIdentifier",value)},useGapExpression:function gapChangeCallback(i,value){toBoolean(value,!1)?(self.createAddGapBtn(),$gapStyleBox.show()):(i.prop("gapExpression",""),self.removeAddGapBtn(),$gapStyleBox.hide()),response.attr("cardinality","single"),configChangeCallBack(i,value,"useGapExpression")},gapStyle:function gapStyleChangeCallback(i,newStyle){i.prop("gapStyle",newStyle),configChangeCallBack(i,newStyle,"gapStyle")},authorizeWhiteSpace:configChangeCallBack,focusOnDenominator:configChangeCallBack,tool_frac:configChangeCallBack,tool_sqrt:configChangeCallBack,tool_exp:configChangeCallBack,tool_log:configChangeCallBack,tool_ln:configChangeCallBack,tool_e:configChangeCallBack,tool_infinity:configChangeCallBack,tool_pi:configChangeCallBack,tool_cos:configChangeCallBack,tool_sin:configChangeCallBack,tool_lte:configChangeCallBack,tool_gte:configChangeCallBack,tool_times:configChangeCallBack,tool_divide:configChangeCallBack,tool_plusminus:configChangeCallBack,tool_angle:configChangeCallBack,tool_minus:configChangeCallBack,tool_plus:configChangeCallBack,tool_equal:configChangeCallBack,tool_lower:configChangeCallBack,tool_greater:configChangeCallBack,tool_subscript:configChangeCallBack,tool_integral:configChangeCallBack,tool_timesdot:configChangeCallBack,tool_triangle:configChangeCallBack,tool_similar:configChangeCallBack,tool_paral:configChangeCallBack,tool_perp:configChangeCallBack,tool_inmem:configChangeCallBack,tool_ninmem:configChangeCallBack,tool_union:configChangeCallBack,tool_intersec:configChangeCallBack,squarebkts:function squarebktsChangeCallBack(i,value){i.prop("tool_lbrack",value),i.prop("tool_rbrack",value),i.triggerPci("configChange",[i.getProperties()])},roundbkts:function roundbktsChangeCallBack(i,value){i.prop("tool_lparen",value),i.prop("tool_rparen",value),i.triggerPci("configChange",[i.getProperties()])},curlybkts:function curlybktsChangeCallBack(i,value){i.prop("tool_lbrace",value),i.prop("tool_rbrace",value),i.triggerPci("configChange",[i.getProperties()])},allowNewLine:configChangeCallBack,enableAutoWrap:configChangeCallBack}),$gapStyleBox=$form.find(".mathgap-style-box"),$gapStyleSelector=$gapStyleBox.find("[data-mathgap-style]"),$gapStyleSelector.select2({width:"100%",minimumResultsForSearch:1/0}).val(interaction.prop("gapStyle")).trigger("change")},MathEntryInteractionStateQuestion.prototype.addMathFieldListener=function addMathFieldListener(){var _widget=this.widget,interaction=_widget.element;interaction.onPci("responseChange",function(latex){toBoolean(interaction.prop("useGapExpression"),!1)?interaction.prop("gapExpression",latex):interaction.prop("gapExpression","")})},MathEntryInteractionStateQuestion.prototype.createAddGapBtn=function createAddGapBtn(){var _widget=this.widget,$container=_widget.$container,$toolbar=$container.find(".toolbar"),interaction=_widget.element;$toolbar.length&&($toolbar.after($addGapBtn),$addGapBtn.on("click",function(){interaction.getResponseDeclaration().removeMapEntries(),interaction.triggerPci("addGap")}))},MathEntryInteractionStateQuestion.prototype.removeAddGapBtn=function removeAddGapBtn(){$addGapBtn.off("click"),$addGapBtn.remove()},MathEntryInteractionStateQuestion}),define("mathEntryInteraction/creator/widget/states/Correct",["taoQtiItem/qtiCreator/widgets/states/factory","taoQtiItem/qtiCreator/widgets/states/Correct"],function(stateFactory,Correct){"use strict";var InteractionStateCorrect=stateFactory.create(Correct,function init(){this.widget.element.getResponseDeclaration().setTemplate("MAP_RESPONSE"),this.widget.changeState("map")},function exit(){});return InteractionStateCorrect}),define("tpl!mathEntryInteraction/creator/tpl/answerForm",["handlebars"],function(hb){return hb.template(function(Handlebars,depth0,helpers,partials,data){function program1(depth0,data){var stack1,helper,options,buffer="";return buffer+="\n
\n

"+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"Correct answer option",options):helperMissing.call(depth0,"__","Correct answer option",options)))+" "+escapeExpression((helper=helpers.increaseIndex||depth0&&depth0.increaseIndex,options={hash:{},data:data},helper?helper.call(depth0,null==data||!1===data?data:data.index,options):helperMissing.call(depth0,"increaseIndex",null==data||!1===data?data:data.index,options)))+"

\n \n \n "+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"edit the answer",options):helperMissing.call(depth0,"__","edit the answer",options)))+"\n \n\n
\n\n \n \n "+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"delete the answer",options):helperMissing.call(depth0,"__","delete the answer",options)))+"\n \n
\n
\n ",buffer}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var stack1,helper,options,buffer="",functionType="function",escapeExpression=this.escapeExpression,helperMissing=helpers.helperMissing,self=this;return buffer+="
\n
\n

"+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"Define correct responses",options):helperMissing.call(depth0,"__","Define correct responses",options)))+":

\n
\n
\n
\n ",stack1=helpers.each.call(depth0,depth0&&depth0.correctAnswerEntries,{hash:{},inverse:self.noop,fn:self.program(1,program1,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n
\n
\n\n
\n\n
",buffer})}),define("tpl!mathEntryInteraction/creator/tpl/addAnswerOption",["handlebars"],function(hb){return hb.template(function(Handlebars,depth0,helpers,partials,data){this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var helper,options,buffer="",helperMissing=helpers.helperMissing,escapeExpression=this.escapeExpression;return buffer+="",buffer})}),define("mathEntryInteraction/creator/widget/states/Map",["handlebars","i18n","lodash","jquery","taoQtiItem/qtiCreator/widgets/states/factory","taoQtiItem/qtiCreator/widgets/states/Map","taoQtiItem/qtiCreator/widgets/helpers/formElement","tpl!mathEntryInteraction/creator/tpl/answerForm","tpl!mathEntryInteraction/creator/tpl/addAnswerOption"],function(hb,__,_,$,stateFactory,Map,formElement,answerFormTpl,addAnswerOptionBtn){"use strict";var CORRECT_ANSWER_VALUE=1;hb.registerHelper("increaseIndex",function(value,options){return parseInt(value)+1});var MathEntryInteractionStateResponse=stateFactory.create(Map,function init(){this.initGlobalVariables(),this.initForm()},function exit(){this.emptyGapFields(),this.toggleResponseMode(!1),this.saveAnswers(),this.removeResponseChangeEventListener(),this.removeEditDeleteListeners(),this.removeAddButtonListener(),this.destroyForm()});return MathEntryInteractionStateResponse.prototype.initGlobalVariables=function initGlobalVariables(){var self=this,interaction=self.widget.element;self.activeEditId=null,self.correctResponses=[],!0===this.inGapMode(self)&&(interaction=self.widget.element,self.gapTemplate=interaction.prop("gapExpression"))},MathEntryInteractionStateResponse.prototype.initForm=function initForm(){var self=this,interaction=self.widget.element,$responseForm=self.widget.$responseForm;this.initResponseChangeEventListener(),self.correctResponses=this.getExistingCorrectAnswerOptions(),$responseForm.html(addAnswerOptionBtn()),this.initAddAnswerButton(),this.renderForm(self.correctResponses)},MathEntryInteractionStateResponse.prototype.initAddAnswerButton=function initAddAnswerButton(){var self=this,interaction=self.widget.element,$responseForm=self.widget.$responseForm,$addAnswerBtn=$responseForm.find($(".add-answer-option"));$addAnswerBtn.on("click",function(){var newCorrectAnswer;if(!0===self.inGapMode()){self.emptyGapFields();var gapExpression=interaction.prop("gapExpression"),gapCount=(gapExpression.match(/\\taoGap/g)||[]).length;if(0= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var stack1,helper,buffer="",functionType="function";return buffer+="
\n
",(helper=helpers.prompt)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.prompt,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),(stack1||0===stack1)&&(buffer+=stack1),buffer+="
\n
\n
\n
\n \n
\n
\n
",buffer})}),define("mathEntryInteraction/imsPciCreator",["lodash","mathEntryInteraction/creator/widget/Widget","tpl!mathEntryInteraction/creator/tpl/markup"],function(_,Widget,markupTpl){"use strict";var _typeIdentifier="mathEntryInteraction",mathEntryInteractionCreator={getTypeIdentifier:function getTypeIdentifier(){return"mathEntryInteraction"},getWidget:function getWidget(){return Widget},getDefaultProperties:function getDefaultProperties(){return{authorizeWhiteSpace:"false",useGapExpression:"false",inResponseState:"false",gapExpression:"",gapStyle:"",focusOnDenominator:!1,tool_frac:"true",tool_sqrt:"true",tool_exp:"true",tool_log:"true",tool_ln:"true",tool_e:"true",tool_infinity:"true",tool_lbrack:"true",tool_rbrack:"true",tool_pi:"true",tool_cos:"true",tool_sin:"true",tool_lte:"true",tool_gte:"true",tool_times:"true",tool_divide:"true",tool_plusminus:"true",tool_angle:"true",tool_minus:"true",tool_plus:"true",tool_equal:"true",tool_lower:"true",tool_greater:"true",tool_subscript:"true",tool_lbrace:"true",tool_rbrace:"true",tool_lparen:"true",tool_rparen:"true",tool_integral:"true",tool_timesdot:"true",tool_triangle:"true",tool_similar:"true",tool_paral:"true",tool_perp:"true",tool_inmem:"true",tool_ninmem:"true",tool_union:"true",tool_intersec:"true",allowNewLine:"false",enableAutoWrap:"false"}},afterCreate:function afterCreate(pci){},getMarkupTemplate:function getMarkupTemplate(){return markupTpl},getMarkupData:function getMarkupData(pci,defaultData){return defaultData.prompt=pci.data("prompt"),defaultData}};return mathEntryInteractionCreator}),define(["mathEntryInteraction/imsPciCreator"],function(IMSPCI){return IMSPCI}); \ No newline at end of file + + +define('tpl!mathEntryInteraction/creator/tpl/propertiesForm', ['handlebars'], function(hb){ +return hb.template(function (Handlebars,depth0,helpers,partials,data) { + this.compilerInfo = [4,'>= 1.0.0']; +helpers = this.merge(helpers, Handlebars.helpers); data = data || {}; + var buffer = "", stack1, helper, options, helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, functionType="function", self=this; + +function program1(depth0,data) { + + + return "checked=\"checked\""; + } + +function program3(depth0,data) { + + + return "style=\"display:none\""; + } + + buffer += "
\n \n \n
" + + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, "The identifier of the choice. This identifier must not be used by any other response or item variable. An identifier is a string of characters that must start with a Letter or an underscore (\"_\") and contain only Letters, underscores, hyphens (\"-\"), period (\".\", a.k.a. full-stop), Digits, CombiningChars and Extenders.", options) : helperMissing.call(depth0, "__", "The identifier of the choice. This identifier must not be used by any other response or item variable. An identifier is a string of characters that must start with a Letter or an underscore (\"_\") and contain only Letters, underscores, hyphens (\"-\"), period (\".\", a.k.a. full-stop), Digits, CombiningChars and Extenders.", options))) + + "
\n\n \n
\n\n
\n\n

" + + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, "Options", options) : helperMissing.call(depth0, "__", "Options", options))) + + "

\n\n
\n \n \n
" + + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, "Gap size", options) : helperMissing.call(depth0, "__", "Gap size", options))) + + "\n \n
\n
\n\n
\n\n

" + + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, "Functions", options) : helperMissing.call(depth0, "__", "Functions", options))) + + "

\n\n
\n \n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n \n
\n\n
\n

" + + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, "Symbols", options) : helperMissing.call(depth0, "__", "Symbols", options))) + + "

\n\n
\n \n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n \n
\n\n
\n

" + + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, "Geometry", options) : helperMissing.call(depth0, "__", "Geometry", options))) + + "

\n\n
\n \n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n \n
\n\n
\n

" + + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, "Trigonometry", options) : helperMissing.call(depth0, "__", "Trigonometry", options))) + + "

\n\n
\n \n
\n
\n \n
\n
\n \n
\n\n
\n

" + + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, "Comparison", options) : helperMissing.call(depth0, "__", "Comparison", options))) + + "

\n\n
\n \n
\n
\n \n
\n
\n \n
\n
\n \n
\n\n
\n

" + + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, "Operands", options) : helperMissing.call(depth0, "__", "Operands", options))) + + "

\n\n
\n \n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n \n
\n\n
\n\n

" + + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, "Experimental only", options) : helperMissing.call(depth0, "__", "Experimental only", options))) + + "

\n\n
\n \n
\n
\n \n
"; + return buffer; + }); +}); + + +define('tpl!mathEntryInteraction/creator/tpl/addGapBtn', ['handlebars'], function(hb){ +return hb.template(function (Handlebars,depth0,helpers,partials,data) { + this.compilerInfo = [4,'>= 1.0.0']; +helpers = this.merge(helpers, Handlebars.helpers); data = data || {}; + var buffer = "", helper, options, helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression; + + + buffer += "
\n " + + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, "Add gap", options) : helperMissing.call(depth0, "__", "Add gap", options))) + + "\n
"; + return buffer; + }); +}); + +/** + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; under version 2 + * of the License (non-upgradable). + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Copyright (c) 2022 (original work) Open Assessment Technologies SA; + */ +define('mathEntryInteraction/creator/helper/mathInPrompt',['core/moduleLoader'], function (moduleLoader) { + 'use strict'; + + let MathJax; + let loaded = false; + + /*** + * lazy-load MathJax dependency + * @returns {Promise} + */ + function load() { + if (loaded) { + return Promise.resolve(); + } + return moduleLoader([], () => true) + .add({ module: 'mathJax', category: 'mathEntryInteraction' }) + .load() + .then(loadedModule => { + loaded = true; + MathJax = loadedModule && loadedModule.length ? loadedModule[0] : void 0; + + /** + * Do not wait between rendering each individual math element + * http://docs.mathjax.org/en/latest/api/hub.html + * @see https://github.com/oat-sa/tao-item-runner-qti-fe/blob/master/src/qtiCommonRenderer/renderers/Math.js + */ + if (MathJax && MathJax.Hub) { + MathJax.Hub.processSectionDelay = 0; + } + }); + } + + const mathInPrompt = { + /** + * On dom element containing `...` MathML markup, + * run MathJax renderer ("typeset" it) + * @param {Object} $element + * @returns {Promise} + */ + postRender: function postRender($element) { + if ($element.find('math').length === 0) { + return Promise.resolve(); + } + return load().then(() => { + if (MathJax && MathJax.Hub && typeof MathJax.Hub.Queue === 'function') { + /** + * MathJax needs to be exported globally to integrate with tools like TTS, it's weird... + * @see https://github.com/oat-sa/tao-item-runner-qti-fe/blob/master/src/qtiCommonRenderer/renderers/Math.js + */ + if (!window.MathJax) { + window.MathJax = MathJax; + } + if ($element.length) { + MathJax.Hub.Queue(['Typeset', MathJax.Hub, $element[0]]); + } + } + }); + } + }; + + return mathInPrompt; +}); + +/** + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; under version 2 + * of the License (non-upgradable). + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Copyright (c) 2016-2017 (original work) Open Assessment Technologies SA; + */ + +define('mathEntryInteraction/creator/widget/states/Question',[ + 'jquery', + 'i18n', + 'taoQtiItem/qtiCreator/widgets/states/factory', + 'taoQtiItem/qtiCreator/widgets/interactions/states/Question', + 'taoQtiItem/qtiCreator/widgets/helpers/formElement', + 'taoQtiItem/qtiCreator/editor/simpleContentEditableElement', + 'taoQtiItem/qtiCreator/editor/containerEditor', + 'tpl!mathEntryInteraction/creator/tpl/propertiesForm', + 'tpl!mathEntryInteraction/creator/tpl/addGapBtn', + 'mathEntryInteraction/creator/helper/mathInPrompt' +], function($, __, stateFactory, Question, formElement, simpleEditor, containerEditor, formTpl, addGapBtnTpl, mathInPrompt){ + 'use strict'; + + var $addGapBtn = $(addGapBtnTpl()); + + var MathEntryInteractionStateQuestion = stateFactory.extend(Question, function create(){ + var $container = this.widget.$container, + $prompt = $container.find('.prompt'), + interaction = this.widget.element; + + containerEditor.create($prompt, { + change : function(text){ + interaction.data('prompt', text); + interaction.updateMarkup(); + + if (!$prompt.is('[data-html-editable-container="true"]')) { + mathInPrompt.postRender($prompt); + } + }, + markup : interaction.markup, + markupSelector : '.prompt', + related : interaction, + areaBroker: this.widget.getAreaBroker() + }); + + if (toBoolean(interaction.prop('useGapExpression'), false)) { + this.createAddGapBtn(); + } + + this.addMathFieldListener(); + + }, function exit(){ + var $container = this.widget.$container, + $prompt = $container.find('.prompt'); + + simpleEditor.destroy($container); + containerEditor.destroy($prompt); + + this.removeAddGapBtn(); + }); + + function toBoolean(value, defaultValue) { + if (typeof(value) === "undefined") { + return defaultValue; + } else { + return (value === true || value === "true"); + } + } + /** + * Callback for configuration change + * @param {Object} interaction - the current interaction + * @param {String} value - new value of the changed property + * @param {String} name - changed property + */ + function configChangeCallBack(interaction, value, name) { + interaction.prop(name, value); + interaction.triggerPci('configChange', [interaction.getProperties()]); + } + + MathEntryInteractionStateQuestion.prototype.initForm = function initForm(){ + + var self = this, + _widget = this.widget, + $form = _widget.$form, + interaction = _widget.element, + response = interaction.getResponseDeclaration(), + $gapStyleBox, + $gapStyleSelector; + + //render the form using the form template + $form.html(formTpl({ + serial : response.serial, + identifier : interaction.attr('responseIdentifier'), + + authorizeWhiteSpace: toBoolean(interaction.prop('authorizeWhiteSpace'), false), + useGapExpression: toBoolean(interaction.prop('useGapExpression'), false), + focusOnDenominator: toBoolean(interaction.prop('focusOnDenominator'), false), + + tool_frac: toBoolean(interaction.prop('tool_frac'), true), + tool_sqrt: toBoolean(interaction.prop('tool_sqrt'), true), + tool_exp: toBoolean(interaction.prop('tool_exp'), true), + tool_log: toBoolean(interaction.prop('tool_log'), true), + tool_ln: toBoolean(interaction.prop('tool_ln'), true), + tool_e: toBoolean(interaction.prop('tool_e'), true), + tool_infinity: toBoolean(interaction.prop('tool_infinity'),true), + squarebkts: toBoolean(interaction.prop('tool_rbrack'), true) && toBoolean(interaction.prop('tool_lbrack'), true), + tool_pi: toBoolean(interaction.prop('tool_pi'), true), + tool_cos: toBoolean(interaction.prop('tool_cos'), true), + tool_sin: toBoolean(interaction.prop('tool_sin'), true), + tool_lte: toBoolean(interaction.prop('tool_lte'), true), + tool_gte: toBoolean(interaction.prop('tool_gte'), true), + tool_times: toBoolean(interaction.prop('tool_times'), true), + tool_divide: toBoolean(interaction.prop('tool_divide'), true), + tool_plusminus: toBoolean(interaction.prop('tool_plusminus'),true), + roundbkts: toBoolean(interaction.prop('tool_rparen'), true) && toBoolean(interaction.prop('tool_lparen'), true), + curlybkts: toBoolean(interaction.prop('tool_rbrace'), true) && toBoolean(interaction.prop('tool_lbrace'), true), + tool_angle: toBoolean(interaction.prop('tool_angle'), true), + tool_minus: toBoolean(interaction.prop('tool_minus'), true), + tool_plus: toBoolean(interaction.prop('tool_plus'), true), + tool_equal: toBoolean(interaction.prop('tool_equal'), true), + tool_lower: toBoolean(interaction.prop('tool_lower'), true), + tool_greater: toBoolean(interaction.prop('tool_greater'), true), + tool_subscript: toBoolean(interaction.prop('tool_subscript'),true), + tool_integral: toBoolean(interaction.prop('tool_integral'),true), + tool_timesdot: toBoolean(interaction.prop('tool_timesdot'),true), + tool_triangle: toBoolean(interaction.prop('tool_triangle'),true), + tool_similar: toBoolean(interaction.prop('tool_similar'), true), + tool_paral: toBoolean(interaction.prop('tool_paral'), true), + tool_perp: toBoolean(interaction.prop('tool_perp'), true), + tool_inmem: toBoolean(interaction.prop('tool_inmem'), true), + tool_ninmem: toBoolean(interaction.prop('tool_ninmem'), true), + tool_union: toBoolean(interaction.prop('tool_union'), true), + tool_intersec: toBoolean(interaction.prop('tool_intersec'),true), + allowNewLine: toBoolean(interaction.prop('allowNewLine'), false), + enableAutoWrap: toBoolean(interaction.prop('enableAutoWrap'), false) + })); + + //init form javascript + formElement.initWidget($form); + + //init data change callbacks + formElement.setChangeCallbacks($form, interaction, { + identifier: function(i, value){ + response.id(value); + interaction.attr('responseIdentifier', value); + }, + useGapExpression: function gapChangeCallback(i, value) { + if (toBoolean(value, false)) { + self.createAddGapBtn(); + $gapStyleBox.show(); + } else { + i.prop('gapExpression', ''); + self.removeAddGapBtn(); + $gapStyleBox.hide(); + } + + response.attr('cardinality', 'single'); + configChangeCallBack(i, value, 'useGapExpression'); + }, + gapStyle: function gapStyleChangeCallback(i, newStyle) { + + i.prop('gapStyle', newStyle); + + configChangeCallBack(i, newStyle, 'gapStyle'); + }, + authorizeWhiteSpace: configChangeCallBack, + focusOnDenominator: configChangeCallBack, + + tool_frac: configChangeCallBack, + tool_sqrt: configChangeCallBack, + tool_exp: configChangeCallBack, + tool_log: configChangeCallBack, + tool_ln: configChangeCallBack, + tool_e: configChangeCallBack, + tool_infinity: configChangeCallBack, + tool_pi: configChangeCallBack, + tool_cos: configChangeCallBack, + tool_sin: configChangeCallBack, + tool_lte: configChangeCallBack, + tool_gte: configChangeCallBack, + tool_times: configChangeCallBack, + tool_divide: configChangeCallBack, + tool_plusminus: configChangeCallBack, + tool_angle: configChangeCallBack, + tool_minus: configChangeCallBack, + tool_plus: configChangeCallBack, + tool_equal: configChangeCallBack, + tool_lower: configChangeCallBack, + tool_greater: configChangeCallBack, + tool_subscript: configChangeCallBack, + tool_integral: configChangeCallBack, + tool_timesdot: configChangeCallBack, + tool_triangle: configChangeCallBack, + tool_similar: configChangeCallBack, + tool_paral: configChangeCallBack, + tool_perp: configChangeCallBack, + tool_inmem: configChangeCallBack, + tool_ninmem: configChangeCallBack, + tool_union: configChangeCallBack, + tool_intersec: configChangeCallBack, + + squarebkts: function squarebktsChangeCallBack(i, value) { + i.prop('tool_lbrack', value); + i.prop('tool_rbrack', value); + i.triggerPci('configChange', [i.getProperties()]); + }, + roundbkts: function roundbktsChangeCallBack(i, value) { + i.prop('tool_lparen', value); + i.prop('tool_rparen', value); + i.triggerPci('configChange', [i.getProperties()]); + }, + curlybkts: function curlybktsChangeCallBack(i, value) { + i.prop('tool_lbrace', value); + i.prop('tool_rbrace', value); + i.triggerPci('configChange', [i.getProperties()]); + }, + + allowNewLine: configChangeCallBack, + enableAutoWrap: configChangeCallBack + }); + + + $gapStyleBox = $form.find('.mathgap-style-box'); + $gapStyleSelector = $gapStyleBox.find('[data-mathgap-style]'); + + $gapStyleSelector.select2({ + width: '100%', + minimumResultsForSearch: Infinity + }) + .val(interaction.prop('gapStyle')) + .trigger('change'); + }; + + /** + * Change callback for editable math field + */ + + MathEntryInteractionStateQuestion.prototype.addMathFieldListener = function addMathFieldListener() { + var _widget = this.widget, + interaction = _widget.element; + + interaction.onPci('responseChange', function(latex) { + if (toBoolean(interaction.prop('useGapExpression'), false)) { + interaction.prop('gapExpression', latex); + } else { + interaction.prop('gapExpression', ''); + } + }); + }; + + /** + * Display the "Add Gap" button + */ + MathEntryInteractionStateQuestion.prototype.createAddGapBtn = function createAddGapBtn() { + var _widget = this.widget, + $container = _widget.$container, + $toolbar = $container.find('.toolbar'), + interaction =_widget.element; + + if ($toolbar.length) { + $toolbar.after($addGapBtn); + $addGapBtn.on('click', function() { + interaction.getResponseDeclaration().removeMapEntries(); + interaction.triggerPci('addGap'); + }); + } + }; + + /** + * Remove the "Add Gap" button from the DOM + */ + MathEntryInteractionStateQuestion.prototype.removeAddGapBtn = function removeAddGapBtn() { + $addGapBtn.off('click'); + $addGapBtn.remove(); + }; + + return MathEntryInteractionStateQuestion; +}); + +/** + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; under version 2 + * of the License (non-upgradable). + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Copyright (c) 2021 (original work) Open Assessment Technologies SA; + */ +define('mathEntryInteraction/creator/widget/states/Correct',[ + 'taoQtiItem/qtiCreator/widgets/states/factory', + 'taoQtiItem/qtiCreator/widgets/states/Correct' +], function (stateFactory, Correct) { + 'use strict'; + + var InteractionStateCorrect = stateFactory.create( + Correct, + function init() { + this.widget.element.getResponseDeclaration().setTemplate('MAP_RESPONSE'); + this.widget.changeState('map'); + }, + function exit() { + } + ); + + return InteractionStateCorrect; +}); + + +define('tpl!mathEntryInteraction/creator/tpl/answerForm', ['handlebars'], function(hb){ +return hb.template(function (Handlebars,depth0,helpers,partials,data) { + this.compilerInfo = [4,'>= 1.0.0']; +helpers = this.merge(helpers, Handlebars.helpers); data = data || {}; + var buffer = "", stack1, helper, options, functionType="function", escapeExpression=this.escapeExpression, helperMissing=helpers.helperMissing, self=this; + +function program1(depth0,data) { + + var buffer = "", stack1, helper, options; + buffer += "\n
\n

" + + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, "Correct answer option", options) : helperMissing.call(depth0, "__", "Correct answer option", options))) + + " " + + escapeExpression((helper = helpers.increaseIndex || (depth0 && depth0.increaseIndex),options={hash:{},data:data},helper ? helper.call(depth0, (data == null || data === false ? data : data.index), options) : helperMissing.call(depth0, "increaseIndex", (data == null || data === false ? data : data.index), options))) + + "

\n \n \n " + + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, "edit the answer", options) : helperMissing.call(depth0, "__", "edit the answer", options))) + + "\n \n\n
\n\n \n \n " + + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, "delete the answer", options) : helperMissing.call(depth0, "__", "delete the answer", options))) + + "\n \n
\n
\n "; + return buffer; + } + + buffer += "
\n
\n

" + + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, "Define correct responses", options) : helperMissing.call(depth0, "__", "Define correct responses", options))) + + ":

\n
\n
\n
\n "; + stack1 = helpers.each.call(depth0, (depth0 && depth0.correctAnswerEntries), {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data}); + if(stack1 || stack1 === 0) { buffer += stack1; } + buffer += "\n
\n
\n\n
\n\n
"; + return buffer; + }); +}); + + +define('tpl!mathEntryInteraction/creator/tpl/addAnswerOption', ['handlebars'], function(hb){ +return hb.template(function (Handlebars,depth0,helpers,partials,data) { + this.compilerInfo = [4,'>= 1.0.0']; +helpers = this.merge(helpers, Handlebars.helpers); data = data || {}; + var buffer = "", helper, options, helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression; + + + buffer += ""; + return buffer; + }); +}); + +/** + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; under version 2 + * of the License (non-upgradable). + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Copyright (c) 2021 (original work) Open Assessment Technologies SA; + */ +define('mathEntryInteraction/creator/widget/states/Map',[ + 'handlebars', + 'i18n', + 'lodash', + 'jquery', + 'taoQtiItem/qtiCreator/widgets/states/factory', + 'taoQtiItem/qtiCreator/widgets/states/Map', + 'taoQtiItem/qtiCreator/widgets/helpers/formElement', + 'tpl!mathEntryInteraction/creator/tpl/answerForm', + 'tpl!mathEntryInteraction/creator/tpl/addAnswerOption', +], function ( + hb, + __, + _, + $, + stateFactory, + Map, + formElement, + answerFormTpl, + addAnswerOptionBtn +) { + 'use strict'; + var CORRECT_ANSWER_VALUE = 1; + hb.registerHelper('increaseIndex', function (value, options) { + return parseInt(value) + 1; + }); + + var MathEntryInteractionStateResponse = stateFactory.create( + Map, + function init() { + this.initGlobalVariables(); + this.initForm(); + }, + function exit() { + this.emptyGapFields(); + this.toggleResponseMode(false); + this.saveAnswers(); + this.removeResponseChangeEventListener(); + this.removeEditDeleteListeners(); + this.removeAddButtonListener(); + this.destroyForm(); + } + ); + + + MathEntryInteractionStateResponse.prototype.initGlobalVariables = function initGlobalVariables() { + var self = this, + interaction = self.widget.element; + self.activeEditId = null; + self.correctResponses = []; + + if (this.inGapMode(self) === true) { + interaction = self.widget.element; + self.gapTemplate = interaction.prop('gapExpression'); + } + } + + MathEntryInteractionStateResponse.prototype.initForm = function initForm() { + var self = this, + interaction = self.widget.element, + $responseForm = self.widget.$responseForm; + + this.initResponseChangeEventListener(); + self.correctResponses = this.getExistingCorrectAnswerOptions(); + $responseForm.html(addAnswerOptionBtn()); + this.initAddAnswerButton(); + this.renderForm(self.correctResponses); + } + + MathEntryInteractionStateResponse.prototype.initAddAnswerButton = function initAddAnswerButton() { + var self = this, + interaction = self.widget.element, + $responseForm = self.widget.$responseForm, + $addAnswerBtn = $responseForm.find($('.add-answer-option')); + + $addAnswerBtn.on('click', function () { + var newCorrectAnswer; + + if (self.inGapMode() === true) { + self.emptyGapFields(); + var gapExpression = interaction.prop('gapExpression'); + var gapCount = (gapExpression.match(/\\taoGap/g) || []).length; + if (gapCount > 0) { + newCorrectAnswer = []; + for (var i = 0; i < gapCount; i++) { + newCorrectAnswer.push(' '); + } + + newCorrectAnswer = newCorrectAnswer.join(','); + } else { + newCorrectAnswer = ''; + } + } else { + newCorrectAnswer = ''; + self.toggleResponseMode(false); + } + + self.correctResponses.push(newCorrectAnswer); + self.renderForm(self.correctResponses); + }); + } + + MathEntryInteractionStateResponse.prototype.getExistingCorrectAnswerOptions = function getExistingCorrectAnswerOptions() { + var self = this, + interaction = self.widget.element; + + var mapEntries = interaction.getResponseDeclaration().getMapEntries(); + return _.keys(mapEntries) || []; + } + + MathEntryInteractionStateResponse.prototype.initResponseChangeEventListener = function initResponseChangeEventListener() { + var self = this, + interaction = self.widget.element; + + interaction.onPci('responseChange', function (latex) { + if (self.inGapMode(self) === false && self.activeEditId !== null) { + self.correctResponses[self.activeEditId] = latex; + } else if (self.inGapMode(self) === true && self.activeEditId !== null) { + var response = interaction.getResponse(); + if (response !== null) { + self.correctResponses[self.activeEditId] = response.base.string; + } + } + }); + } + + MathEntryInteractionStateResponse.prototype.removeResponseChangeEventListener = function removeResponseChangeEventListener() { + var self = this, + interaction = self.widget.element; + + interaction.offPci('responseChange'); + } + + MathEntryInteractionStateResponse.prototype.initEditingOptions = function initEditingOptions() { + var self = this, + interaction = self.widget.element, + $responseForm = self.widget.$responseForm, + $entryConfig = $responseForm.find('.entry-config'), + $editButtons = $entryConfig.find('.answer-edit'); + + $editButtons.click(function (e) { + e.preventDefault(); + e.stopImmediatePropagation(); + self.toggleResponseMode(true); + var selectedEditId = parseInt($(e.target).closest('div').attr('data-index')); + + if (self.activeEditId !== selectedEditId) { + + if (self.inGapMode() === true) { + self.activeEditId = selectedEditId; + var response = self.getGapResponseObject(self.correctResponses[self.activeEditId]); + interaction.triggerPci('latexGapInput', [response]); + } else { + self.activeEditId = selectedEditId; + interaction.triggerPci('latexInput', [self.correctResponses[self.activeEditId]]); + } + } else { + self.emptyGapFields(); + } + }); + } + + // forming gap response object to be further processed by the latexGapInput event + MathEntryInteractionStateResponse.prototype.getGapResponseObject = function getGapResponseObject(response) { + return { + base: { + string: response.split(',') + } + } + } + + // removing all saved map entries + MathEntryInteractionStateResponse.prototype.clearMapEntries = function clearMapEntries() { + var self = this, + interaction = self.widget.element, + response = interaction.getResponseDeclaration(), + mapEntries = response.getMapEntries(); + + _.keys(mapEntries).forEach(function (mapKey) { + response.removeMapEntry(mapKey, true); + }); + } + + MathEntryInteractionStateResponse.prototype.initDeletingOptions = function initDeletingOptions() { + var self = this, + interaction = self.widget.element, + $responseForm = self.widget.$responseForm, + $entryConfig = $responseForm.find('.entry-config'), + $deleteButtons = $entryConfig.find('.answer-delete'); + + $deleteButtons.click(function (e) { + e.preventDefault(); + e.stopImmediatePropagation(); + var id = parseInt($(e.target).closest('div').attr('data-index')); + + if (self.inGapMode() === true) { + self.activeEditId = id; + self.emptyGapFields(); + } else { + self.activeEditId = null; + self.toggleResponseMode(false); + } + + self.correctResponses.splice(id, 1); + self.renderForm(self.correctResponses); + }); + } + + MathEntryInteractionStateResponse.prototype.renderForm = function renderForm(correctAnswerOptions) { + var self = this, + $responseForm = self.widget.$responseForm; + + this.removeEditDeleteListeners(); + $responseForm.find('.mathEntryInteraction').remove(); + $responseForm.append(answerFormTpl({correctAnswerEntries: correctAnswerOptions})); + this.initDeletingOptions(); + this.initEditingOptions(); + } + + /** + * remove all event listeners to avoid any potential memory leaks + */ + MathEntryInteractionStateResponse.prototype.removeEditDeleteListeners = function removeEditDeleteListeners() { + var self = this, + $entryConfig = self.widget.$responseForm.find('.entry-config'); + + $entryConfig.find('.answer-edit').off('click'); + $entryConfig.find('.answer-delete').off('click'); + } + + MathEntryInteractionStateResponse.prototype.removeAddButtonListener = function removeAddButtonListener() { + var self = this, + $responseForm = self.widget.$responseForm; + + $responseForm.find($('.add-answer-option')).off('click'); + } + + MathEntryInteractionStateResponse.prototype.destroyForm = function destroyForm() { + var self = this, + $responseForm = self.widget.$responseForm; + + $responseForm.find('.mathEntryInteraction').remove(); + } + + MathEntryInteractionStateResponse.prototype.saveAnswers = function saveAnswers() { + var self = this, + interaction = self.widget.element, + responseDeclaration = interaction.getResponseDeclaration(); + + this.clearMapEntries(); + + if (this.inGapMode() === true) { + self.correctResponses = self.correctResponses.filter(function (response) { + return response.split(',').indexOf('') === -1; + }); + } + + self.correctResponses.forEach(function (response) { + responseDeclaration.setMapEntry(response, CORRECT_ANSWER_VALUE, false); + }); + } + + /** + * if in gap mode: will empty all the gap fields + */ + MathEntryInteractionStateResponse.prototype.emptyGapFields = function emptyGapFields() { + var self = this, + interaction = self.widget.element; + + if (this.inGapMode() === true) { + self.activeEditId = null; + + interaction.prop('gapExpression', self.gapTemplate); + this.toggleResponseMode(false); + } + } + + MathEntryInteractionStateResponse.prototype.toggleResponseMode = function toggleResponseMode(value) { + var self = this, + interaction = self.widget.element; + + if (interaction.prop('inResponseState') !== value) { + interaction.prop('inResponseState', value); + interaction.triggerPci('configChange', [interaction.getProperties()]); + } + } + + MathEntryInteractionStateResponse.prototype.inGapMode = function inGapMode() { + var interaction = this.widget.element; + var useGapExpression = interaction.prop('useGapExpression'); + return useGapExpression && useGapExpression !== 'false' || false; + } + + return MathEntryInteractionStateResponse; +}); + +/** + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; under version 2 + * of the License (non-upgradable). + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Copyright (c) 2016 (original work) Open Assessment Technologies SA; + */ + +define('mathEntryInteraction/creator/widget/states/states',[ + 'taoQtiItem/qtiCreator/widgets/states/factory', + 'taoQtiItem/qtiCreator/widgets/interactions/customInteraction/states/states', + 'mathEntryInteraction/creator/widget/states/Question', + 'mathEntryInteraction/creator/widget/states/Correct', + 'mathEntryInteraction/creator/widget/states/Map' +], function(factory, states){ + 'use strict'; + + return factory.createBundle(states, arguments); +}); + +/** + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; under version 2 + * of the License (non-upgradable). + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Copyright (c) 2016 (original work) Open Assessment Technologies SA; + */ + +define('mathEntryInteraction/creator/widget/Widget',[ + 'taoQtiItem/qtiCreator/widgets/interactions/customInteraction/Widget', + 'mathEntryInteraction/creator/widget/states/states' +], function(Widget, states){ + 'use strict'; + + var MathEntryInteractionWidget = Widget.clone(); + + MathEntryInteractionWidget.initCreator = function initCreator() { + var $interaction; + + this.registerStates(states); + + Widget.initCreator.call(this); + + $interaction = this.$container.find('.mathEntryInteraction'); + if ($interaction.length) { + $interaction.addClass('tao-qti-creator-context'); + } + }; + + return MathEntryInteractionWidget; +}); + +define('tpl!mathEntryInteraction/creator/tpl/markup', ['handlebars'], function(hb){ +return hb.template(function (Handlebars,depth0,helpers,partials,data) { + this.compilerInfo = [4,'>= 1.0.0']; +helpers = this.merge(helpers, Handlebars.helpers); data = data || {}; + var buffer = "", stack1, helper, functionType="function"; + + + buffer += "
\n
"; + if (helper = helpers.prompt) { stack1 = helper.call(depth0, {hash:{},data:data}); } + else { helper = (depth0 && depth0.prompt); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; } + if(stack1 || stack1 === 0) { buffer += stack1; } + buffer += "
\n
\n
\n
\n \n
\n
\n
"; + return buffer; + }); +}); + +/** + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; under version 2 + * of the License (non-upgradable). + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Copyright (c) 2016-2021 (original work) Open Assessment Technologies SA; + * + * @author Christophe Noël + * + */ + +define('mathEntryInteraction/imsPciCreator',[ + 'lodash', + 'mathEntryInteraction/creator/widget/Widget', + 'tpl!mathEntryInteraction/creator/tpl/markup' +], function (_, Widget, markupTpl) { + 'use strict'; + + var _typeIdentifier = 'mathEntryInteraction'; + + var mathEntryInteractionCreator = { + /** + * (required) Get the typeIdentifier of the custom interaction + * + * @returns {String} + */ + getTypeIdentifier: function getTypeIdentifier() { + return _typeIdentifier; + }, + /** + * (required) Get the widget prototype + * Used in the renderer + * + * @returns {Object} Widget + */ + getWidget: function getWidget() { + return Widget; + }, + /** + * (optional) Get the default properties values of the pci. + * Used on new pci instance creation + * + * @returns {Object} + */ + getDefaultProperties: function getDefaultProperties() { + return { + authorizeWhiteSpace: 'false', + useGapExpression: 'false', + inResponseState: 'false', + gapExpression: '', + gapStyle: '', + focusOnDenominator: false, + + tool_frac: 'true', + tool_sqrt: 'true', + tool_exp: 'true', + tool_log: 'true', + tool_ln: 'true', + tool_e: 'true', + tool_infinity: 'true', + tool_lbrack: 'true', + tool_rbrack: 'true', + tool_pi: 'true', + tool_cos: 'true', + tool_sin: 'true', + tool_lte: 'true', + tool_gte: 'true', + tool_times: 'true', + tool_divide: 'true', + tool_plusminus: 'true', + tool_angle: 'true', + tool_minus: 'true', + tool_plus: 'true', + tool_equal: 'true', + tool_lower: 'true', + tool_greater: 'true', + tool_subscript: 'true', + tool_lbrace: 'true', + tool_rbrace: 'true', + tool_lparen: 'true', + tool_rparen: 'true', + tool_integral: 'true', + tool_timesdot: 'true', + tool_triangle: 'true', + tool_similar: 'true', + tool_paral: 'true', + tool_perp: 'true', + tool_inmem: 'true', + tool_ninmem: 'true', + tool_union: 'true', + tool_intersec: 'true', + allowNewLine: 'false', + enableAutoWrap: 'false' + }; + }, + /** + * (optional) Callback to execute on the + * Used on new pci instance creation + * + * @returns {Object} + */ + afterCreate: function afterCreate(pci) { + //do some stuff + }, + /** + * (required) Gives the qti pci xml template + * + * @returns {function} handlebar template + */ + getMarkupTemplate: function getMarkupTemplate() { + return markupTpl; + }, + /** + * (optional) Allows passing additional data to xml template + * + * @returns {function} handlebar template + */ + getMarkupData: function getMarkupData(pci, defaultData) { + defaultData.prompt = pci.data('prompt'); + return defaultData; + } + }; + + //since we assume we are in a tao context, there is no use to expose the a global object for lib registration + //all libs should be declared here + return mathEntryInteractionCreator; +}); + +define(['mathEntryInteraction/imsPciCreator'],function(IMSPCI){return IMSPCI}); + +//# sourceMappingURL=imsPciCreator.min.js.map \ No newline at end of file diff --git a/views/js/pciCreator/ims/mathEntryInteraction/imsPciCreator.min.js.map b/views/js/pciCreator/ims/mathEntryInteraction/imsPciCreator.min.js.map index 48635938..d48fbfac 100644 --- a/views/js/pciCreator/ims/mathEntryInteraction/imsPciCreator.min.js.map +++ b/views/js/pciCreator/ims/mathEntryInteraction/imsPciCreator.min.js.map @@ -1 +1,38 @@ -{"version":3,"mappings":"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","names":["define","helpers","data","buffer","escapeExpression","helper","stack1","loaded","Promise","moduleLoader","add","load","then","MathJax","postRender","window","$element","defaultValue","interaction","$addGapBtn","MathEntryInteractionStateQuestion","$prompt","containerEditor","change","mathInPrompt","markup","markupSelector","related","areaBroker","toBoolean","simpleEditor","$gapStyleBox","$gapStyleSelector","_widget","$form","response","serial","identifier","authorizeWhiteSpace","useGapExpression","focusOnDenominator","tool_frac","tool_sqrt","tool_exp","tool_log","tool_ln","tool_e","tool_infinity","squarebkts","tool_pi","tool_cos","tool_sin","tool_lte","tool_gte","tool_times","tool_divide","tool_plusminus","roundbkts","curlybkts","tool_angle","tool_minus","tool_plus","tool_equal","tool_lower","tool_greater","tool_subscript","tool_integral","tool_timesdot","tool_triangle","tool_similar","tool_paral","tool_perp","tool_inmem","tool_ninmem","tool_union","tool_intersec","allowNewLine","enableAutoWrap","formElement","self","i","configChangeCallBack","gapStyle","width","minimumResultsForSearch","val","trigger","$container","$toolbar","Correct","hb","__","_","$","stateFactory","Map","answerFormTpl","addAnswerOptionBtn","MathEntryInteractionStateResponse","$responseForm","$addAnswerBtn","gapExpression","gapCount","newCorrectAnswer","mapEntries","$entryConfig","$editButtons","e","base","string","$deleteButtons","responseDeclaration","MathEntryInteractionWidget","Widget","$interaction","_typeIdentifier","mathEntryInteractionCreator","getTypeIdentifier","getWidget","getDefaultProperties","inResponseState","tool_lbrack","tool_rbrack","tool_lbrace","tool_rbrace","tool_lparen","tool_rparen","afterCreate","getMarkupTemplate","getMarkupData","defaultData"],"sources":["../../../qtiItemPci/views/js/pciCreator/ims/mathEntryInteraction/creator/tpl/propertiesForm!tpl","../../../qtiItemPci/views/js/pciCreator/ims/mathEntryInteraction/creator/tpl/addGapBtn!tpl","../../../qtiItemPci/views/js/pciCreator/ims/mathEntryInteraction/creator/helper/mathInPrompt.js","../../../qtiItemPci/views/js/pciCreator/ims/mathEntryInteraction/creator/widget/states/Question.js","../../../qtiItemPci/views/js/pciCreator/ims/mathEntryInteraction/creator/widget/states/Correct.js","../../../qtiItemPci/views/js/pciCreator/ims/mathEntryInteraction/creator/tpl/answerForm!tpl","../../../qtiItemPci/views/js/pciCreator/ims/mathEntryInteraction/creator/tpl/addAnswerOption!tpl","../../../qtiItemPci/views/js/pciCreator/ims/mathEntryInteraction/creator/widget/states/Map.js","../../../qtiItemPci/views/js/pciCreator/ims/mathEntryInteraction/creator/widget/states/states.js","../../../qtiItemPci/views/js/pciCreator/ims/mathEntryInteraction/creator/widget/Widget.js","../../../qtiItemPci/views/js/pciCreator/ims/mathEntryInteraction/creator/tpl/markup!tpl","../../../qtiItemPci/views/js/pciCreator/ims/mathEntryInteraction/imsPciCreator.js","../build/config-wrap-end-default.js"],"sourcesContent":["\ndefine('tpl!mathEntryInteraction/creator/tpl/propertiesForm', ['handlebars'], function(hb){ \nreturn hb.template(function (Handlebars,depth0,helpers,partials,data) {\n this.compilerInfo = [4,'>= 1.0.0'];\nhelpers = this.merge(helpers, Handlebars.helpers); data = data || {};\n var buffer = \"\", stack1, helper, options, helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, functionType=\"function\", self=this;\n\nfunction program1(depth0,data) {\n \n \n return \"checked=\\\"checked\\\"\";\n }\n\nfunction program3(depth0,data) {\n \n \n return \"style=\\\"display:none\\\"\";\n }\n\n buffer += \"
\\n \\n \\n
\"\n + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, \"The identifier of the choice. This identifier must not be used by any other response or item variable. An identifier is a string of characters that must start with a Letter or an underscore (\\\"_\\\") and contain only Letters, underscores, hyphens (\\\"-\\\"), period (\\\".\\\", a.k.a. full-stop), Digits, CombiningChars and Extenders.\", options) : helperMissing.call(depth0, \"__\", \"The identifier of the choice. This identifier must not be used by any other response or item variable. An identifier is a string of characters that must start with a Letter or an underscore (\\\"_\\\") and contain only Letters, underscores, hyphens (\\\"-\\\"), period (\\\".\\\", a.k.a. full-stop), Digits, CombiningChars and Extenders.\", options)))\n + \"
\\n\\n \\n
\\n\\n
\\n\\n

\"\n + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, \"Options\", options) : helperMissing.call(depth0, \"__\", \"Options\", options)))\n + \"

\\n\\n
\\n \\n \\n
\\n \\n \\n
\\n
\\n\\n
\\n\\n

\"\n + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, \"Functions\", options) : helperMissing.call(depth0, \"__\", \"Functions\", options)))\n + \"

\\n\\n
\\n \\n
\\n
\\n \\n
\\n
\\n \\n
\\n
\\n \\n
\\n
\\n \\n
\\n
\\n \\n
\\n\\n
\\n

\"\n + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, \"Symbols\", options) : helperMissing.call(depth0, \"__\", \"Symbols\", options)))\n + \"

\\n\\n
\\n \\n
\\n
\\n \\n
\\n
\\n \\n
\\n
\\n \\n
\\n
\\n \\n
\\n
\\n \\n
\\n\\n
\\n

\"\n + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, \"Geometry\", options) : helperMissing.call(depth0, \"__\", \"Geometry\", options)))\n + \"

\\n\\n
\\n \\n
\\n
\\n \\n
\\n
\\n \\n
\\n
\\n \\n
\\n
\\n \\n
\\n
\\n \\n
\\n\\n
\\n

\"\n + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, \"Trigonometry\", options) : helperMissing.call(depth0, \"__\", \"Trigonometry\", options)))\n + \"

\\n\\n
\\n \\n
\\n
\\n \\n
\\n
\\n \\n
\\n\\n
\\n

\"\n + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, \"Comparison\", options) : helperMissing.call(depth0, \"__\", \"Comparison\", options)))\n + \"

\\n\\n
\\n \\n
\\n
\\n \\n
\\n
\\n \\n
\\n
\\n \\n
\\n\\n
\\n

\"\n + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, \"Operands\", options) : helperMissing.call(depth0, \"__\", \"Operands\", options)))\n + \"

\\n\\n
\\n \\n
\\n
\\n \\n
\\n
\\n \\n
\\n
\\n \\n
\\n
\\n \\n
\\n
\\n \\n
\\n
\\n \\n
\\n
\\n \\n
\\n
\\n \\n
\\n
\\n \\n
\\n
\\n \\n
\\n\\n
\\n\\n

\"\n + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, \"Experimental only\", options) : helperMissing.call(depth0, \"__\", \"Experimental only\", options)))\n + \"

\\n\\n
\\n \\n
\\n
\\n \\n
\";\n return buffer;\n });\n});\n\n","\ndefine('tpl!mathEntryInteraction/creator/tpl/addGapBtn', ['handlebars'], function(hb){ \nreturn hb.template(function (Handlebars,depth0,helpers,partials,data) {\n this.compilerInfo = [4,'>= 1.0.0'];\nhelpers = this.merge(helpers, Handlebars.helpers); data = data || {};\n var buffer = \"\", helper, options, helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;\n\n\n buffer += \"
\\n \"\n + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, \"Add gap\", options) : helperMissing.call(depth0, \"__\", \"Add gap\", options)))\n + \"\\n
\";\n return buffer;\n });\n});\n\n","/**\n * This program is free software; you can redistribute it and/or\n * modify it under the terms of the GNU General Public License\n * as published by the Free Software Foundation; under version 2\n * of the License (non-upgradable).\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program; if not, write to the Free Software\n * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\n *\n * Copyright (c) 2022 (original work) Open Assessment Technologies SA;\n */\ndefine('mathEntryInteraction/creator/helper/mathInPrompt',['core/moduleLoader'], function (moduleLoader) {\n 'use strict';\n\n let MathJax;\n let loaded = false;\n\n /***\n * lazy-load MathJax dependency\n * @returns {Promise}\n */\n function load() {\n if (loaded) {\n return Promise.resolve();\n }\n return moduleLoader([], () => true)\n .add({ module: 'mathJax', category: 'mathEntryInteraction' })\n .load()\n .then(loadedModule => {\n loaded = true;\n MathJax = loadedModule && loadedModule.length ? loadedModule[0] : void 0;\n\n /**\n * Do not wait between rendering each individual math element\n * http://docs.mathjax.org/en/latest/api/hub.html\n * @see https://github.com/oat-sa/tao-item-runner-qti-fe/blob/master/src/qtiCommonRenderer/renderers/Math.js\n */\n if (MathJax && MathJax.Hub) {\n MathJax.Hub.processSectionDelay = 0;\n }\n });\n }\n\n const mathInPrompt = {\n /**\n * On dom element containing `...` MathML markup,\n * run MathJax renderer (\"typeset\" it)\n * @param {Object} $element\n * @returns {Promise}\n */\n postRender: function postRender($element) {\n if ($element.find('math').length === 0) {\n return Promise.resolve();\n }\n return load().then(() => {\n if (MathJax && MathJax.Hub && typeof MathJax.Hub.Queue === 'function') {\n /**\n * MathJax needs to be exported globally to integrate with tools like TTS, it's weird...\n * @see https://github.com/oat-sa/tao-item-runner-qti-fe/blob/master/src/qtiCommonRenderer/renderers/Math.js\n */\n if (!window.MathJax) {\n window.MathJax = MathJax;\n }\n if ($element.length) {\n MathJax.Hub.Queue(['Typeset', MathJax.Hub, $element[0]]);\n }\n }\n });\n }\n };\n\n return mathInPrompt;\n});\n\n","/**\n * This program is free software; you can redistribute it and/or\n * modify it under the terms of the GNU General Public License\n * as published by the Free Software Foundation; under version 2\n * of the License (non-upgradable).\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program; if not, write to the Free Software\n * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\n *\n * Copyright (c) 2016-2017 (original work) Open Assessment Technologies SA;\n */\n\ndefine('mathEntryInteraction/creator/widget/states/Question',[\n 'jquery',\n 'i18n',\n 'taoQtiItem/qtiCreator/widgets/states/factory',\n 'taoQtiItem/qtiCreator/widgets/interactions/states/Question',\n 'taoQtiItem/qtiCreator/widgets/helpers/formElement',\n 'taoQtiItem/qtiCreator/editor/simpleContentEditableElement',\n 'taoQtiItem/qtiCreator/editor/containerEditor',\n 'tpl!mathEntryInteraction/creator/tpl/propertiesForm',\n 'tpl!mathEntryInteraction/creator/tpl/addGapBtn',\n 'mathEntryInteraction/creator/helper/mathInPrompt'\n], function($, __, stateFactory, Question, formElement, simpleEditor, containerEditor, formTpl, addGapBtnTpl, mathInPrompt){\n 'use strict';\n\n var $addGapBtn = $(addGapBtnTpl());\n\n var MathEntryInteractionStateQuestion = stateFactory.extend(Question, function create(){\n var $container = this.widget.$container,\n $prompt = $container.find('.prompt'),\n interaction = this.widget.element;\n\n containerEditor.create($prompt, {\n change : function(text){\n interaction.data('prompt', text);\n interaction.updateMarkup();\n\n if (!$prompt.is('[data-html-editable-container=\"true\"]')) {\n mathInPrompt.postRender($prompt);\n }\n },\n markup : interaction.markup,\n markupSelector : '.prompt',\n related : interaction,\n areaBroker: this.widget.getAreaBroker()\n });\n\n if (toBoolean(interaction.prop('useGapExpression'), false)) {\n this.createAddGapBtn();\n }\n\n this.addMathFieldListener();\n\n }, function exit(){\n var $container = this.widget.$container,\n $prompt = $container.find('.prompt');\n\n simpleEditor.destroy($container);\n containerEditor.destroy($prompt);\n\n this.removeAddGapBtn();\n });\n\n function toBoolean(value, defaultValue) {\n if (typeof(value) === \"undefined\") {\n return defaultValue;\n } else {\n return (value === true || value === \"true\");\n }\n }\n /**\n * Callback for configuration change\n * @param {Object} interaction - the current interaction\n * @param {String} value - new value of the changed property\n * @param {String} name - changed property\n */\n function configChangeCallBack(interaction, value, name) {\n interaction.prop(name, value);\n interaction.triggerPci('configChange', [interaction.getProperties()]);\n }\n\n MathEntryInteractionStateQuestion.prototype.initForm = function initForm(){\n\n var self = this,\n _widget = this.widget,\n $form = _widget.$form,\n interaction = _widget.element,\n response = interaction.getResponseDeclaration(),\n $gapStyleBox,\n $gapStyleSelector;\n\n //render the form using the form template\n $form.html(formTpl({\n serial : response.serial,\n identifier : interaction.attr('responseIdentifier'),\n\n authorizeWhiteSpace: toBoolean(interaction.prop('authorizeWhiteSpace'), false),\n useGapExpression: toBoolean(interaction.prop('useGapExpression'), false),\n focusOnDenominator: toBoolean(interaction.prop('focusOnDenominator'), false),\n\n tool_frac: toBoolean(interaction.prop('tool_frac'), true),\n tool_sqrt: toBoolean(interaction.prop('tool_sqrt'), true),\n tool_exp: toBoolean(interaction.prop('tool_exp'), true),\n tool_log: toBoolean(interaction.prop('tool_log'), true),\n tool_ln: toBoolean(interaction.prop('tool_ln'), true),\n tool_e: toBoolean(interaction.prop('tool_e'), true),\n tool_infinity: toBoolean(interaction.prop('tool_infinity'),true),\n squarebkts: toBoolean(interaction.prop('tool_rbrack'), true) && toBoolean(interaction.prop('tool_lbrack'), true),\n tool_pi: toBoolean(interaction.prop('tool_pi'), true),\n tool_cos: toBoolean(interaction.prop('tool_cos'), true),\n tool_sin: toBoolean(interaction.prop('tool_sin'), true),\n tool_lte: toBoolean(interaction.prop('tool_lte'), true),\n tool_gte: toBoolean(interaction.prop('tool_gte'), true),\n tool_times: toBoolean(interaction.prop('tool_times'), true),\n tool_divide: toBoolean(interaction.prop('tool_divide'), true),\n tool_plusminus: toBoolean(interaction.prop('tool_plusminus'),true),\n roundbkts: toBoolean(interaction.prop('tool_rparen'), true) && toBoolean(interaction.prop('tool_lparen'), true),\n curlybkts: toBoolean(interaction.prop('tool_rbrace'), true) && toBoolean(interaction.prop('tool_lbrace'), true),\n tool_angle: toBoolean(interaction.prop('tool_angle'), true),\n tool_minus: toBoolean(interaction.prop('tool_minus'), true),\n tool_plus: toBoolean(interaction.prop('tool_plus'), true),\n tool_equal: toBoolean(interaction.prop('tool_equal'), true),\n tool_lower: toBoolean(interaction.prop('tool_lower'), true),\n tool_greater: toBoolean(interaction.prop('tool_greater'), true),\n tool_subscript: toBoolean(interaction.prop('tool_subscript'),true),\n tool_integral: toBoolean(interaction.prop('tool_integral'),true),\n tool_timesdot: toBoolean(interaction.prop('tool_timesdot'),true),\n tool_triangle: toBoolean(interaction.prop('tool_triangle'),true),\n tool_similar: toBoolean(interaction.prop('tool_similar'), true),\n tool_paral: toBoolean(interaction.prop('tool_paral'), true),\n tool_perp: toBoolean(interaction.prop('tool_perp'), true),\n tool_inmem: toBoolean(interaction.prop('tool_inmem'), true),\n tool_ninmem: toBoolean(interaction.prop('tool_ninmem'), true),\n tool_union: toBoolean(interaction.prop('tool_union'), true),\n tool_intersec: toBoolean(interaction.prop('tool_intersec'),true),\n allowNewLine: toBoolean(interaction.prop('allowNewLine'), false),\n enableAutoWrap: toBoolean(interaction.prop('enableAutoWrap'), false)\n }));\n\n //init form javascript\n formElement.initWidget($form);\n\n //init data change callbacks\n formElement.setChangeCallbacks($form, interaction, {\n identifier: function(i, value){\n response.id(value);\n interaction.attr('responseIdentifier', value);\n },\n useGapExpression: function gapChangeCallback(i, value) {\n if (toBoolean(value, false)) {\n self.createAddGapBtn();\n $gapStyleBox.show();\n } else {\n i.prop('gapExpression', '');\n self.removeAddGapBtn();\n $gapStyleBox.hide();\n }\n\n response.attr('cardinality', 'single');\n configChangeCallBack(i, value, 'useGapExpression');\n },\n gapStyle: function gapStyleChangeCallback(i, newStyle) {\n\n i.prop('gapStyle', newStyle);\n\n configChangeCallBack(i, newStyle, 'gapStyle');\n },\n authorizeWhiteSpace: configChangeCallBack,\n focusOnDenominator: configChangeCallBack,\n\n tool_frac: configChangeCallBack,\n tool_sqrt: configChangeCallBack,\n tool_exp: configChangeCallBack,\n tool_log: configChangeCallBack,\n tool_ln: configChangeCallBack,\n tool_e: configChangeCallBack,\n tool_infinity: configChangeCallBack,\n tool_pi: configChangeCallBack,\n tool_cos: configChangeCallBack,\n tool_sin: configChangeCallBack,\n tool_lte: configChangeCallBack,\n tool_gte: configChangeCallBack,\n tool_times: configChangeCallBack,\n tool_divide: configChangeCallBack,\n tool_plusminus: configChangeCallBack,\n tool_angle: configChangeCallBack,\n tool_minus: configChangeCallBack,\n tool_plus: configChangeCallBack,\n tool_equal: configChangeCallBack,\n tool_lower: configChangeCallBack,\n tool_greater: configChangeCallBack,\n tool_subscript: configChangeCallBack,\n tool_integral: configChangeCallBack,\n tool_timesdot: configChangeCallBack,\n tool_triangle: configChangeCallBack,\n tool_similar: configChangeCallBack,\n tool_paral: configChangeCallBack,\n tool_perp: configChangeCallBack,\n tool_inmem: configChangeCallBack,\n tool_ninmem: configChangeCallBack,\n tool_union: configChangeCallBack,\n tool_intersec: configChangeCallBack,\n\n squarebkts: function squarebktsChangeCallBack(i, value) {\n i.prop('tool_lbrack', value);\n i.prop('tool_rbrack', value);\n i.triggerPci('configChange', [i.getProperties()]);\n },\n roundbkts: function roundbktsChangeCallBack(i, value) {\n i.prop('tool_lparen', value);\n i.prop('tool_rparen', value);\n i.triggerPci('configChange', [i.getProperties()]);\n },\n curlybkts: function curlybktsChangeCallBack(i, value) {\n i.prop('tool_lbrace', value);\n i.prop('tool_rbrace', value);\n i.triggerPci('configChange', [i.getProperties()]);\n },\n\n allowNewLine: configChangeCallBack,\n enableAutoWrap: configChangeCallBack\n });\n\n\n $gapStyleBox = $form.find('.mathgap-style-box');\n $gapStyleSelector = $gapStyleBox.find('[data-mathgap-style]');\n\n $gapStyleSelector.select2({\n width: '100%',\n minimumResultsForSearch: Infinity\n })\n .val(interaction.prop('gapStyle'))\n .trigger('change');\n };\n\n /**\n * Change callback for editable math field\n */\n\n MathEntryInteractionStateQuestion.prototype.addMathFieldListener = function addMathFieldListener() {\n var _widget = this.widget,\n interaction = _widget.element;\n\n interaction.onPci('responseChange', function(latex) {\n if (toBoolean(interaction.prop('useGapExpression'), false)) {\n interaction.prop('gapExpression', latex);\n } else {\n interaction.prop('gapExpression', '');\n }\n });\n };\n\n /**\n * Display the \"Add Gap\" button\n */\n MathEntryInteractionStateQuestion.prototype.createAddGapBtn = function createAddGapBtn() {\n var _widget = this.widget,\n $container = _widget.$container,\n $toolbar = $container.find('.toolbar'),\n interaction =_widget.element;\n\n if ($toolbar.length) {\n $toolbar.after($addGapBtn);\n $addGapBtn.on('click', function() {\n interaction.getResponseDeclaration().removeMapEntries();\n interaction.triggerPci('addGap');\n });\n }\n };\n\n /**\n * Remove the \"Add Gap\" button from the DOM\n */\n MathEntryInteractionStateQuestion.prototype.removeAddGapBtn = function removeAddGapBtn() {\n $addGapBtn.off('click');\n $addGapBtn.remove();\n };\n\n return MathEntryInteractionStateQuestion;\n});\n\n","/**\n * This program is free software; you can redistribute it and/or\n * modify it under the terms of the GNU General Public License\n * as published by the Free Software Foundation; under version 2\n * of the License (non-upgradable).\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program; if not, write to the Free Software\n * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\n *\n * Copyright (c) 2021 (original work) Open Assessment Technologies SA;\n */\ndefine('mathEntryInteraction/creator/widget/states/Correct',[\n 'taoQtiItem/qtiCreator/widgets/states/factory',\n 'taoQtiItem/qtiCreator/widgets/states/Correct'\n], function (stateFactory, Correct) {\n 'use strict';\n\n var InteractionStateCorrect = stateFactory.create(\n Correct,\n function init() {\n this.widget.element.getResponseDeclaration().setTemplate('MAP_RESPONSE');\n this.widget.changeState('map');\n },\n function exit() {\n }\n );\n\n return InteractionStateCorrect;\n});\n\n","\ndefine('tpl!mathEntryInteraction/creator/tpl/answerForm', ['handlebars'], function(hb){ \nreturn hb.template(function (Handlebars,depth0,helpers,partials,data) {\n this.compilerInfo = [4,'>= 1.0.0'];\nhelpers = this.merge(helpers, Handlebars.helpers); data = data || {};\n var buffer = \"\", stack1, helper, options, functionType=\"function\", escapeExpression=this.escapeExpression, helperMissing=helpers.helperMissing, self=this;\n\nfunction program1(depth0,data) {\n \n var buffer = \"\", stack1, helper, options;\n buffer += \"\\n
\\n

\"\n + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, \"Correct answer option\", options) : helperMissing.call(depth0, \"__\", \"Correct answer option\", options)))\n + \" \"\n + escapeExpression((helper = helpers.increaseIndex || (depth0 && depth0.increaseIndex),options={hash:{},data:data},helper ? helper.call(depth0, (data == null || data === false ? data : data.index), options) : helperMissing.call(depth0, \"increaseIndex\", (data == null || data === false ? data : data.index), options)))\n + \"

\\n \\n \\n \"\n + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, \"edit the answer\", options) : helperMissing.call(depth0, \"__\", \"edit the answer\", options)))\n + \"\\n \\n\\n
\\n\\n \\n \\n \"\n + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, \"delete the answer\", options) : helperMissing.call(depth0, \"__\", \"delete the answer\", options)))\n + \"\\n \\n
\\n
\\n \";\n return buffer;\n }\n\n buffer += \"
\\n
\\n

\"\n + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, \"Define correct responses\", options) : helperMissing.call(depth0, \"__\", \"Define correct responses\", options)))\n + \":

\\n
\\n
\\n
\\n \";\n stack1 = helpers.each.call(depth0, (depth0 && depth0.correctAnswerEntries), {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data});\n if(stack1 || stack1 === 0) { buffer += stack1; }\n buffer += \"\\n
\\n
\\n\\n
\\n\\n
\";\n return buffer;\n });\n});\n\n","\ndefine('tpl!mathEntryInteraction/creator/tpl/addAnswerOption', ['handlebars'], function(hb){ \nreturn hb.template(function (Handlebars,depth0,helpers,partials,data) {\n this.compilerInfo = [4,'>= 1.0.0'];\nhelpers = this.merge(helpers, Handlebars.helpers); data = data || {};\n var buffer = \"\", helper, options, helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;\n\n\n buffer += \"\";\n return buffer;\n });\n});\n\n","/**\n * This program is free software; you can redistribute it and/or\n * modify it under the terms of the GNU General Public License\n * as published by the Free Software Foundation; under version 2\n * of the License (non-upgradable).\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program; if not, write to the Free Software\n * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\n *\n * Copyright (c) 2021 (original work) Open Assessment Technologies SA;\n */\ndefine('mathEntryInteraction/creator/widget/states/Map',[\n 'handlebars',\n 'i18n',\n 'lodash',\n 'jquery',\n 'taoQtiItem/qtiCreator/widgets/states/factory',\n 'taoQtiItem/qtiCreator/widgets/states/Map',\n 'taoQtiItem/qtiCreator/widgets/helpers/formElement',\n 'tpl!mathEntryInteraction/creator/tpl/answerForm',\n 'tpl!mathEntryInteraction/creator/tpl/addAnswerOption',\n], function (\n hb,\n __,\n _,\n $,\n stateFactory,\n Map,\n formElement,\n answerFormTpl,\n addAnswerOptionBtn\n) {\n 'use strict';\n var CORRECT_ANSWER_VALUE = 1;\n hb.registerHelper('increaseIndex', function (value, options) {\n return parseInt(value) + 1;\n });\n\n var MathEntryInteractionStateResponse = stateFactory.create(\n Map,\n function init() {\n this.initGlobalVariables();\n this.initForm();\n },\n function exit() {\n this.emptyGapFields();\n this.toggleResponseMode(false);\n this.saveAnswers();\n this.removeResponseChangeEventListener();\n this.removeEditDeleteListeners();\n this.removeAddButtonListener();\n this.destroyForm();\n }\n );\n\n\n MathEntryInteractionStateResponse.prototype.initGlobalVariables = function initGlobalVariables() {\n var self = this,\n interaction = self.widget.element;\n self.activeEditId = null;\n self.correctResponses = [];\n\n if (this.inGapMode(self) === true) {\n interaction = self.widget.element;\n self.gapTemplate = interaction.prop('gapExpression');\n }\n }\n\n MathEntryInteractionStateResponse.prototype.initForm = function initForm() {\n var self = this,\n interaction = self.widget.element,\n $responseForm = self.widget.$responseForm;\n\n this.initResponseChangeEventListener();\n self.correctResponses = this.getExistingCorrectAnswerOptions();\n $responseForm.html(addAnswerOptionBtn());\n this.initAddAnswerButton();\n this.renderForm(self.correctResponses);\n }\n\n MathEntryInteractionStateResponse.prototype.initAddAnswerButton = function initAddAnswerButton() {\n var self = this,\n interaction = self.widget.element,\n $responseForm = self.widget.$responseForm,\n $addAnswerBtn = $responseForm.find($('.add-answer-option'));\n\n $addAnswerBtn.on('click', function () {\n var newCorrectAnswer;\n\n if (self.inGapMode() === true) {\n self.emptyGapFields();\n var gapExpression = interaction.prop('gapExpression');\n var gapCount = (gapExpression.match(/\\\\taoGap/g) || []).length;\n if (gapCount > 0) {\n newCorrectAnswer = [];\n for (var i = 0; i < gapCount; i++) {\n newCorrectAnswer.push(' ');\n }\n\n newCorrectAnswer = newCorrectAnswer.join(',');\n } else {\n newCorrectAnswer = '';\n }\n } else {\n newCorrectAnswer = '';\n self.toggleResponseMode(false);\n }\n\n self.correctResponses.push(newCorrectAnswer);\n self.renderForm(self.correctResponses);\n });\n }\n\n MathEntryInteractionStateResponse.prototype.getExistingCorrectAnswerOptions = function getExistingCorrectAnswerOptions() {\n var self = this,\n interaction = self.widget.element;\n\n var mapEntries = interaction.getResponseDeclaration().getMapEntries();\n return _.keys(mapEntries) || [];\n }\n\n MathEntryInteractionStateResponse.prototype.initResponseChangeEventListener = function initResponseChangeEventListener() {\n var self = this,\n interaction = self.widget.element;\n\n interaction.onPci('responseChange', function (latex) {\n if (self.inGapMode(self) === false && self.activeEditId !== null) {\n self.correctResponses[self.activeEditId] = latex;\n } else if (self.inGapMode(self) === true && self.activeEditId !== null) {\n var response = interaction.getResponse();\n if (response !== null) {\n self.correctResponses[self.activeEditId] = response.base.string;\n }\n }\n });\n }\n\n MathEntryInteractionStateResponse.prototype.removeResponseChangeEventListener = function removeResponseChangeEventListener() {\n var self = this,\n interaction = self.widget.element;\n\n interaction.offPci('responseChange');\n }\n\n MathEntryInteractionStateResponse.prototype.initEditingOptions = function initEditingOptions() {\n var self = this,\n interaction = self.widget.element,\n $responseForm = self.widget.$responseForm,\n $entryConfig = $responseForm.find('.entry-config'),\n $editButtons = $entryConfig.find('.answer-edit');\n\n $editButtons.click(function (e) {\n e.preventDefault();\n e.stopImmediatePropagation();\n self.toggleResponseMode(true);\n var selectedEditId = parseInt($(e.target).closest('div').attr('data-index'));\n\n if (self.activeEditId !== selectedEditId) {\n\n if (self.inGapMode() === true) {\n self.activeEditId = selectedEditId;\n var response = self.getGapResponseObject(self.correctResponses[self.activeEditId]);\n interaction.triggerPci('latexGapInput', [response]);\n } else {\n self.activeEditId = selectedEditId;\n interaction.triggerPci('latexInput', [self.correctResponses[self.activeEditId]]);\n }\n } else {\n self.emptyGapFields();\n }\n });\n }\n\n // forming gap response object to be further processed by the latexGapInput event\n MathEntryInteractionStateResponse.prototype.getGapResponseObject = function getGapResponseObject(response) {\n return {\n base: {\n string: response.split(',')\n }\n }\n }\n\n // removing all saved map entries\n MathEntryInteractionStateResponse.prototype.clearMapEntries = function clearMapEntries() {\n var self = this,\n interaction = self.widget.element,\n response = interaction.getResponseDeclaration(),\n mapEntries = response.getMapEntries();\n\n _.keys(mapEntries).forEach(function (mapKey) {\n response.removeMapEntry(mapKey, true);\n });\n }\n\n MathEntryInteractionStateResponse.prototype.initDeletingOptions = function initDeletingOptions() {\n var self = this,\n interaction = self.widget.element,\n $responseForm = self.widget.$responseForm,\n $entryConfig = $responseForm.find('.entry-config'),\n $deleteButtons = $entryConfig.find('.answer-delete');\n\n $deleteButtons.click(function (e) {\n e.preventDefault();\n e.stopImmediatePropagation();\n var id = parseInt($(e.target).closest('div').attr('data-index'));\n\n if (self.inGapMode() === true) {\n self.activeEditId = id;\n self.emptyGapFields();\n } else {\n self.activeEditId = null;\n self.toggleResponseMode(false);\n }\n\n self.correctResponses.splice(id, 1);\n self.renderForm(self.correctResponses);\n });\n }\n\n MathEntryInteractionStateResponse.prototype.renderForm = function renderForm(correctAnswerOptions) {\n var self = this,\n $responseForm = self.widget.$responseForm;\n\n this.removeEditDeleteListeners();\n $responseForm.find('.mathEntryInteraction').remove();\n $responseForm.append(answerFormTpl({correctAnswerEntries: correctAnswerOptions}));\n this.initDeletingOptions();\n this.initEditingOptions();\n }\n\n /**\n * remove all event listeners to avoid any potential memory leaks\n */\n MathEntryInteractionStateResponse.prototype.removeEditDeleteListeners = function removeEditDeleteListeners() {\n var self = this,\n $entryConfig = self.widget.$responseForm.find('.entry-config');\n\n $entryConfig.find('.answer-edit').off('click');\n $entryConfig.find('.answer-delete').off('click');\n }\n\n MathEntryInteractionStateResponse.prototype.removeAddButtonListener = function removeAddButtonListener() {\n var self = this,\n $responseForm = self.widget.$responseForm;\n\n $responseForm.find($('.add-answer-option')).off('click');\n }\n\n MathEntryInteractionStateResponse.prototype.destroyForm = function destroyForm() {\n var self = this,\n $responseForm = self.widget.$responseForm;\n\n $responseForm.find('.mathEntryInteraction').remove();\n }\n\n MathEntryInteractionStateResponse.prototype.saveAnswers = function saveAnswers() {\n var self = this,\n interaction = self.widget.element,\n responseDeclaration = interaction.getResponseDeclaration();\n\n this.clearMapEntries();\n\n if (this.inGapMode() === true) {\n self.correctResponses = self.correctResponses.filter(function (response) {\n return response.split(',').indexOf('') === -1;\n });\n }\n\n self.correctResponses.forEach(function (response) {\n responseDeclaration.setMapEntry(response, CORRECT_ANSWER_VALUE, false);\n });\n }\n\n /**\n * if in gap mode: will empty all the gap fields\n */\n MathEntryInteractionStateResponse.prototype.emptyGapFields = function emptyGapFields() {\n var self = this,\n interaction = self.widget.element;\n\n if (this.inGapMode() === true) {\n self.activeEditId = null;\n\n interaction.prop('gapExpression', self.gapTemplate);\n this.toggleResponseMode(false);\n }\n }\n\n MathEntryInteractionStateResponse.prototype.toggleResponseMode = function toggleResponseMode(value) {\n var self = this,\n interaction = self.widget.element;\n\n if (interaction.prop('inResponseState') !== value) {\n interaction.prop('inResponseState', value);\n interaction.triggerPci('configChange', [interaction.getProperties()]);\n }\n }\n\n MathEntryInteractionStateResponse.prototype.inGapMode = function inGapMode() {\n var self = this,\n interaction = self.widget.element;\n\n return interaction.prop('useGapExpression');\n }\n\n return MathEntryInteractionStateResponse;\n});\n\n","/**\n * This program is free software; you can redistribute it and/or\n * modify it under the terms of the GNU General Public License\n * as published by the Free Software Foundation; under version 2\n * of the License (non-upgradable).\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program; if not, write to the Free Software\n * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\n *\n * Copyright (c) 2016 (original work) Open Assessment Technologies SA;\n */\n\ndefine('mathEntryInteraction/creator/widget/states/states',[\n 'taoQtiItem/qtiCreator/widgets/states/factory',\n 'taoQtiItem/qtiCreator/widgets/interactions/customInteraction/states/states',\n 'mathEntryInteraction/creator/widget/states/Question',\n 'mathEntryInteraction/creator/widget/states/Correct',\n 'mathEntryInteraction/creator/widget/states/Map'\n], function(factory, states){\n 'use strict';\n\n return factory.createBundle(states, arguments);\n});\n\n","/**\n * This program is free software; you can redistribute it and/or\n * modify it under the terms of the GNU General Public License\n * as published by the Free Software Foundation; under version 2\n * of the License (non-upgradable).\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program; if not, write to the Free Software\n * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\n *\n * Copyright (c) 2016 (original work) Open Assessment Technologies SA;\n */\n\ndefine('mathEntryInteraction/creator/widget/Widget',[\n 'taoQtiItem/qtiCreator/widgets/interactions/customInteraction/Widget',\n 'mathEntryInteraction/creator/widget/states/states'\n], function(Widget, states){\n 'use strict';\n\n var MathEntryInteractionWidget = Widget.clone();\n\n MathEntryInteractionWidget.initCreator = function initCreator() {\n var $interaction;\n\n this.registerStates(states);\n\n Widget.initCreator.call(this);\n\n $interaction = this.$container.find('.mathEntryInteraction');\n if ($interaction.length) {\n $interaction.addClass('tao-qti-creator-context');\n }\n };\n\n return MathEntryInteractionWidget;\n});\n","\ndefine('tpl!mathEntryInteraction/creator/tpl/markup', ['handlebars'], function(hb){ \nreturn hb.template(function (Handlebars,depth0,helpers,partials,data) {\n this.compilerInfo = [4,'>= 1.0.0'];\nhelpers = this.merge(helpers, Handlebars.helpers); data = data || {};\n var buffer = \"\", stack1, helper, functionType=\"function\";\n\n\n buffer += \"
\\n
\";\n if (helper = helpers.prompt) { stack1 = helper.call(depth0, {hash:{},data:data}); }\n else { helper = (depth0 && depth0.prompt); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }\n if(stack1 || stack1 === 0) { buffer += stack1; }\n buffer += \"
\\n
\\n
\\n
\\n \\n
\\n
\\n
\";\n return buffer;\n });\n});\n\n","/**\n * This program is free software; you can redistribute it and/or\n * modify it under the terms of the GNU General Public License\n * as published by the Free Software Foundation; under version 2\n * of the License (non-upgradable).\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program; if not, write to the Free Software\n * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\n *\n * Copyright (c) 2016-2021 (original work) Open Assessment Technologies SA;\n *\n * @author Christophe Noël \n *\n */\n\ndefine('mathEntryInteraction/imsPciCreator',[\n 'lodash',\n 'mathEntryInteraction/creator/widget/Widget',\n 'tpl!mathEntryInteraction/creator/tpl/markup'\n], function (_, Widget, markupTpl) {\n 'use strict';\n\n var _typeIdentifier = 'mathEntryInteraction';\n\n var mathEntryInteractionCreator = {\n /**\n * (required) Get the typeIdentifier of the custom interaction\n *\n * @returns {String}\n */\n getTypeIdentifier: function getTypeIdentifier() {\n return _typeIdentifier;\n },\n /**\n * (required) Get the widget prototype\n * Used in the renderer\n *\n * @returns {Object} Widget\n */\n getWidget: function getWidget() {\n return Widget;\n },\n /**\n * (optional) Get the default properties values of the pci.\n * Used on new pci instance creation\n *\n * @returns {Object}\n */\n getDefaultProperties: function getDefaultProperties() {\n return {\n authorizeWhiteSpace: 'false',\n useGapExpression: 'false',\n inResponseState: 'false',\n gapExpression: '',\n gapStyle: '',\n focusOnDenominator: false,\n\n tool_frac: 'true',\n tool_sqrt: 'true',\n tool_exp: 'true',\n tool_log: 'true',\n tool_ln: 'true',\n tool_e: 'true',\n tool_infinity: 'true',\n tool_lbrack: 'true',\n tool_rbrack: 'true',\n tool_pi: 'true',\n tool_cos: 'true',\n tool_sin: 'true',\n tool_lte: 'true',\n tool_gte: 'true',\n tool_times: 'true',\n tool_divide: 'true',\n tool_plusminus: 'true',\n tool_angle: 'true',\n tool_minus: 'true',\n tool_plus: 'true',\n tool_equal: 'true',\n tool_lower: 'true',\n tool_greater: 'true',\n tool_subscript: 'true',\n tool_lbrace: 'true',\n tool_rbrace: 'true',\n tool_lparen: 'true',\n tool_rparen: 'true',\n tool_integral: 'true',\n tool_timesdot: 'true',\n tool_triangle: 'true',\n tool_similar: 'true',\n tool_paral: 'true',\n tool_perp: 'true',\n tool_inmem: 'true',\n tool_ninmem: 'true',\n tool_union: 'true',\n tool_intersec: 'true',\n allowNewLine: 'false',\n enableAutoWrap: 'false'\n };\n },\n /**\n * (optional) Callback to execute on the\n * Used on new pci instance creation\n *\n * @returns {Object}\n */\n afterCreate: function afterCreate(pci) {\n //do some stuff\n },\n /**\n * (required) Gives the qti pci xml template\n *\n * @returns {function} handlebar template\n */\n getMarkupTemplate: function getMarkupTemplate() {\n return markupTpl;\n },\n /**\n * (optional) Allows passing additional data to xml template\n *\n * @returns {function} handlebar template\n */\n getMarkupData: function getMarkupData(pci, defaultData) {\n defaultData.prompt = pci.data('prompt');\n return defaultData;\n }\n };\n\n //since we assume we are in a tao context, there is no use to expose the a global object for lib registration\n //all libs should be declared here\n return mathEntryInteractionCreator;\n});\n\n","define(['mathEntryInteraction/imsPciCreator'],function(IMSPCI){return IMSPCI});\n"]} \ No newline at end of file +{ + "version": 3, + "sources": [ + "../build/config-wrap-start-default.js", + "../../../qtiItemPci/views/js/pciCreator/ims/mathEntryInteraction/creator/tpl/propertiesForm!tpl", + "../../../qtiItemPci/views/js/pciCreator/ims/mathEntryInteraction/creator/tpl/addGapBtn!tpl", + "../../../qtiItemPci/views/js/pciCreator/ims/mathEntryInteraction/creator/helper/mathInPrompt.js", + "../../../qtiItemPci/views/js/pciCreator/ims/mathEntryInteraction/creator/widget/states/Question.js", + "../../../qtiItemPci/views/js/pciCreator/ims/mathEntryInteraction/creator/widget/states/Correct.js", + "../../../qtiItemPci/views/js/pciCreator/ims/mathEntryInteraction/creator/tpl/answerForm!tpl", + "../../../qtiItemPci/views/js/pciCreator/ims/mathEntryInteraction/creator/tpl/addAnswerOption!tpl", + "../../../qtiItemPci/views/js/pciCreator/ims/mathEntryInteraction/creator/widget/states/Map.js", + "../../../qtiItemPci/views/js/pciCreator/ims/mathEntryInteraction/creator/widget/states/states.js", + "../../../qtiItemPci/views/js/pciCreator/ims/mathEntryInteraction/creator/widget/Widget.js", + "../../../qtiItemPci/views/js/pciCreator/ims/mathEntryInteraction/creator/tpl/markup!tpl", + "../../../qtiItemPci/views/js/pciCreator/ims/mathEntryInteraction/imsPciCreator.js", + "../build/config-wrap-end-default.js" + ], + "names": [], + "mappings": "AAAA;AACA,ACDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACrQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACfA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,AChFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,AChSA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACpCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACpCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACfA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACzTA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,AC9BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACzCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACjBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,AC1IA;AACA", + "file": "imsPciCreator.min.js", + "sourcesContent": [ + "\n", + "\ndefine('tpl!mathEntryInteraction/creator/tpl/propertiesForm', ['handlebars'], function(hb){ \nreturn hb.template(function (Handlebars,depth0,helpers,partials,data) {\n this.compilerInfo = [4,'>= 1.0.0'];\nhelpers = this.merge(helpers, Handlebars.helpers); data = data || {};\n var buffer = \"\", stack1, helper, options, helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, functionType=\"function\", self=this;\n\nfunction program1(depth0,data) {\n \n \n return \"checked=\\\"checked\\\"\";\n }\n\nfunction program3(depth0,data) {\n \n \n return \"style=\\\"display:none\\\"\";\n }\n\n buffer += \"
\\n \\n \\n
\"\n + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, \"The identifier of the choice. This identifier must not be used by any other response or item variable. An identifier is a string of characters that must start with a Letter or an underscore (\\\"_\\\") and contain only Letters, underscores, hyphens (\\\"-\\\"), period (\\\".\\\", a.k.a. full-stop), Digits, CombiningChars and Extenders.\", options) : helperMissing.call(depth0, \"__\", \"The identifier of the choice. This identifier must not be used by any other response or item variable. An identifier is a string of characters that must start with a Letter or an underscore (\\\"_\\\") and contain only Letters, underscores, hyphens (\\\"-\\\"), period (\\\".\\\", a.k.a. full-stop), Digits, CombiningChars and Extenders.\", options)))\n + \"
\\n\\n \\n
\\n\\n
\\n\\n

\"\n + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, \"Options\", options) : helperMissing.call(depth0, \"__\", \"Options\", options)))\n + \"

\\n\\n
\\n \\n \\n
\\n \\n \\n
\\n
\\n\\n
\\n\\n

\"\n + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, \"Functions\", options) : helperMissing.call(depth0, \"__\", \"Functions\", options)))\n + \"

\\n\\n
\\n \\n
\\n
\\n \\n
\\n
\\n \\n
\\n
\\n \\n
\\n
\\n \\n
\\n
\\n \\n
\\n\\n
\\n

\"\n + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, \"Symbols\", options) : helperMissing.call(depth0, \"__\", \"Symbols\", options)))\n + \"

\\n\\n
\\n \\n
\\n
\\n \\n
\\n
\\n \\n
\\n
\\n \\n
\\n
\\n \\n
\\n
\\n \\n
\\n\\n
\\n

\"\n + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, \"Geometry\", options) : helperMissing.call(depth0, \"__\", \"Geometry\", options)))\n + \"

\\n\\n
\\n \\n
\\n
\\n \\n
\\n
\\n \\n
\\n
\\n \\n
\\n
\\n \\n
\\n
\\n \\n
\\n\\n
\\n

\"\n + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, \"Trigonometry\", options) : helperMissing.call(depth0, \"__\", \"Trigonometry\", options)))\n + \"

\\n\\n
\\n \\n
\\n
\\n \\n
\\n
\\n \\n
\\n\\n
\\n

\"\n + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, \"Comparison\", options) : helperMissing.call(depth0, \"__\", \"Comparison\", options)))\n + \"

\\n\\n
\\n \\n
\\n
\\n \\n
\\n
\\n \\n
\\n
\\n \\n
\\n\\n
\\n

\"\n + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, \"Operands\", options) : helperMissing.call(depth0, \"__\", \"Operands\", options)))\n + \"

\\n\\n
\\n \\n
\\n
\\n \\n
\\n
\\n \\n
\\n
\\n \\n
\\n
\\n \\n
\\n
\\n \\n
\\n
\\n \\n
\\n
\\n \\n
\\n
\\n \\n
\\n
\\n \\n
\\n
\\n \\n
\\n\\n
\\n\\n

\"\n + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, \"Experimental only\", options) : helperMissing.call(depth0, \"__\", \"Experimental only\", options)))\n + \"

\\n\\n
\\n \\n
\\n
\\n \\n
\";\n return buffer;\n });\n});\n\n", + "\ndefine('tpl!mathEntryInteraction/creator/tpl/addGapBtn', ['handlebars'], function(hb){ \nreturn hb.template(function (Handlebars,depth0,helpers,partials,data) {\n this.compilerInfo = [4,'>= 1.0.0'];\nhelpers = this.merge(helpers, Handlebars.helpers); data = data || {};\n var buffer = \"\", helper, options, helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;\n\n\n buffer += \"
\\n \"\n + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, \"Add gap\", options) : helperMissing.call(depth0, \"__\", \"Add gap\", options)))\n + \"\\n
\";\n return buffer;\n });\n});\n\n", + "/**\n * This program is free software; you can redistribute it and/or\n * modify it under the terms of the GNU General Public License\n * as published by the Free Software Foundation; under version 2\n * of the License (non-upgradable).\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program; if not, write to the Free Software\n * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\n *\n * Copyright (c) 2022 (original work) Open Assessment Technologies SA;\n */\ndefine('mathEntryInteraction/creator/helper/mathInPrompt',['core/moduleLoader'], function (moduleLoader) {\n 'use strict';\n\n let MathJax;\n let loaded = false;\n\n /***\n * lazy-load MathJax dependency\n * @returns {Promise}\n */\n function load() {\n if (loaded) {\n return Promise.resolve();\n }\n return moduleLoader([], () => true)\n .add({ module: 'mathJax', category: 'mathEntryInteraction' })\n .load()\n .then(loadedModule => {\n loaded = true;\n MathJax = loadedModule && loadedModule.length ? loadedModule[0] : void 0;\n\n /**\n * Do not wait between rendering each individual math element\n * http://docs.mathjax.org/en/latest/api/hub.html\n * @see https://github.com/oat-sa/tao-item-runner-qti-fe/blob/master/src/qtiCommonRenderer/renderers/Math.js\n */\n if (MathJax && MathJax.Hub) {\n MathJax.Hub.processSectionDelay = 0;\n }\n });\n }\n\n const mathInPrompt = {\n /**\n * On dom element containing `...` MathML markup,\n * run MathJax renderer (\"typeset\" it)\n * @param {Object} $element\n * @returns {Promise}\n */\n postRender: function postRender($element) {\n if ($element.find('math').length === 0) {\n return Promise.resolve();\n }\n return load().then(() => {\n if (MathJax && MathJax.Hub && typeof MathJax.Hub.Queue === 'function') {\n /**\n * MathJax needs to be exported globally to integrate with tools like TTS, it's weird...\n * @see https://github.com/oat-sa/tao-item-runner-qti-fe/blob/master/src/qtiCommonRenderer/renderers/Math.js\n */\n if (!window.MathJax) {\n window.MathJax = MathJax;\n }\n if ($element.length) {\n MathJax.Hub.Queue(['Typeset', MathJax.Hub, $element[0]]);\n }\n }\n });\n }\n };\n\n return mathInPrompt;\n});\n\n", + "/**\n * This program is free software; you can redistribute it and/or\n * modify it under the terms of the GNU General Public License\n * as published by the Free Software Foundation; under version 2\n * of the License (non-upgradable).\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program; if not, write to the Free Software\n * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\n *\n * Copyright (c) 2016-2017 (original work) Open Assessment Technologies SA;\n */\n\ndefine('mathEntryInteraction/creator/widget/states/Question',[\n 'jquery',\n 'i18n',\n 'taoQtiItem/qtiCreator/widgets/states/factory',\n 'taoQtiItem/qtiCreator/widgets/interactions/states/Question',\n 'taoQtiItem/qtiCreator/widgets/helpers/formElement',\n 'taoQtiItem/qtiCreator/editor/simpleContentEditableElement',\n 'taoQtiItem/qtiCreator/editor/containerEditor',\n 'tpl!mathEntryInteraction/creator/tpl/propertiesForm',\n 'tpl!mathEntryInteraction/creator/tpl/addGapBtn',\n 'mathEntryInteraction/creator/helper/mathInPrompt'\n], function($, __, stateFactory, Question, formElement, simpleEditor, containerEditor, formTpl, addGapBtnTpl, mathInPrompt){\n 'use strict';\n\n var $addGapBtn = $(addGapBtnTpl());\n\n var MathEntryInteractionStateQuestion = stateFactory.extend(Question, function create(){\n var $container = this.widget.$container,\n $prompt = $container.find('.prompt'),\n interaction = this.widget.element;\n\n containerEditor.create($prompt, {\n change : function(text){\n interaction.data('prompt', text);\n interaction.updateMarkup();\n\n if (!$prompt.is('[data-html-editable-container=\"true\"]')) {\n mathInPrompt.postRender($prompt);\n }\n },\n markup : interaction.markup,\n markupSelector : '.prompt',\n related : interaction,\n areaBroker: this.widget.getAreaBroker()\n });\n\n if (toBoolean(interaction.prop('useGapExpression'), false)) {\n this.createAddGapBtn();\n }\n\n this.addMathFieldListener();\n\n }, function exit(){\n var $container = this.widget.$container,\n $prompt = $container.find('.prompt');\n\n simpleEditor.destroy($container);\n containerEditor.destroy($prompt);\n\n this.removeAddGapBtn();\n });\n\n function toBoolean(value, defaultValue) {\n if (typeof(value) === \"undefined\") {\n return defaultValue;\n } else {\n return (value === true || value === \"true\");\n }\n }\n /**\n * Callback for configuration change\n * @param {Object} interaction - the current interaction\n * @param {String} value - new value of the changed property\n * @param {String} name - changed property\n */\n function configChangeCallBack(interaction, value, name) {\n interaction.prop(name, value);\n interaction.triggerPci('configChange', [interaction.getProperties()]);\n }\n\n MathEntryInteractionStateQuestion.prototype.initForm = function initForm(){\n\n var self = this,\n _widget = this.widget,\n $form = _widget.$form,\n interaction = _widget.element,\n response = interaction.getResponseDeclaration(),\n $gapStyleBox,\n $gapStyleSelector;\n\n //render the form using the form template\n $form.html(formTpl({\n serial : response.serial,\n identifier : interaction.attr('responseIdentifier'),\n\n authorizeWhiteSpace: toBoolean(interaction.prop('authorizeWhiteSpace'), false),\n useGapExpression: toBoolean(interaction.prop('useGapExpression'), false),\n focusOnDenominator: toBoolean(interaction.prop('focusOnDenominator'), false),\n\n tool_frac: toBoolean(interaction.prop('tool_frac'), true),\n tool_sqrt: toBoolean(interaction.prop('tool_sqrt'), true),\n tool_exp: toBoolean(interaction.prop('tool_exp'), true),\n tool_log: toBoolean(interaction.prop('tool_log'), true),\n tool_ln: toBoolean(interaction.prop('tool_ln'), true),\n tool_e: toBoolean(interaction.prop('tool_e'), true),\n tool_infinity: toBoolean(interaction.prop('tool_infinity'),true),\n squarebkts: toBoolean(interaction.prop('tool_rbrack'), true) && toBoolean(interaction.prop('tool_lbrack'), true),\n tool_pi: toBoolean(interaction.prop('tool_pi'), true),\n tool_cos: toBoolean(interaction.prop('tool_cos'), true),\n tool_sin: toBoolean(interaction.prop('tool_sin'), true),\n tool_lte: toBoolean(interaction.prop('tool_lte'), true),\n tool_gte: toBoolean(interaction.prop('tool_gte'), true),\n tool_times: toBoolean(interaction.prop('tool_times'), true),\n tool_divide: toBoolean(interaction.prop('tool_divide'), true),\n tool_plusminus: toBoolean(interaction.prop('tool_plusminus'),true),\n roundbkts: toBoolean(interaction.prop('tool_rparen'), true) && toBoolean(interaction.prop('tool_lparen'), true),\n curlybkts: toBoolean(interaction.prop('tool_rbrace'), true) && toBoolean(interaction.prop('tool_lbrace'), true),\n tool_angle: toBoolean(interaction.prop('tool_angle'), true),\n tool_minus: toBoolean(interaction.prop('tool_minus'), true),\n tool_plus: toBoolean(interaction.prop('tool_plus'), true),\n tool_equal: toBoolean(interaction.prop('tool_equal'), true),\n tool_lower: toBoolean(interaction.prop('tool_lower'), true),\n tool_greater: toBoolean(interaction.prop('tool_greater'), true),\n tool_subscript: toBoolean(interaction.prop('tool_subscript'),true),\n tool_integral: toBoolean(interaction.prop('tool_integral'),true),\n tool_timesdot: toBoolean(interaction.prop('tool_timesdot'),true),\n tool_triangle: toBoolean(interaction.prop('tool_triangle'),true),\n tool_similar: toBoolean(interaction.prop('tool_similar'), true),\n tool_paral: toBoolean(interaction.prop('tool_paral'), true),\n tool_perp: toBoolean(interaction.prop('tool_perp'), true),\n tool_inmem: toBoolean(interaction.prop('tool_inmem'), true),\n tool_ninmem: toBoolean(interaction.prop('tool_ninmem'), true),\n tool_union: toBoolean(interaction.prop('tool_union'), true),\n tool_intersec: toBoolean(interaction.prop('tool_intersec'),true),\n allowNewLine: toBoolean(interaction.prop('allowNewLine'), false),\n enableAutoWrap: toBoolean(interaction.prop('enableAutoWrap'), false)\n }));\n\n //init form javascript\n formElement.initWidget($form);\n\n //init data change callbacks\n formElement.setChangeCallbacks($form, interaction, {\n identifier: function(i, value){\n response.id(value);\n interaction.attr('responseIdentifier', value);\n },\n useGapExpression: function gapChangeCallback(i, value) {\n if (toBoolean(value, false)) {\n self.createAddGapBtn();\n $gapStyleBox.show();\n } else {\n i.prop('gapExpression', '');\n self.removeAddGapBtn();\n $gapStyleBox.hide();\n }\n\n response.attr('cardinality', 'single');\n configChangeCallBack(i, value, 'useGapExpression');\n },\n gapStyle: function gapStyleChangeCallback(i, newStyle) {\n\n i.prop('gapStyle', newStyle);\n\n configChangeCallBack(i, newStyle, 'gapStyle');\n },\n authorizeWhiteSpace: configChangeCallBack,\n focusOnDenominator: configChangeCallBack,\n\n tool_frac: configChangeCallBack,\n tool_sqrt: configChangeCallBack,\n tool_exp: configChangeCallBack,\n tool_log: configChangeCallBack,\n tool_ln: configChangeCallBack,\n tool_e: configChangeCallBack,\n tool_infinity: configChangeCallBack,\n tool_pi: configChangeCallBack,\n tool_cos: configChangeCallBack,\n tool_sin: configChangeCallBack,\n tool_lte: configChangeCallBack,\n tool_gte: configChangeCallBack,\n tool_times: configChangeCallBack,\n tool_divide: configChangeCallBack,\n tool_plusminus: configChangeCallBack,\n tool_angle: configChangeCallBack,\n tool_minus: configChangeCallBack,\n tool_plus: configChangeCallBack,\n tool_equal: configChangeCallBack,\n tool_lower: configChangeCallBack,\n tool_greater: configChangeCallBack,\n tool_subscript: configChangeCallBack,\n tool_integral: configChangeCallBack,\n tool_timesdot: configChangeCallBack,\n tool_triangle: configChangeCallBack,\n tool_similar: configChangeCallBack,\n tool_paral: configChangeCallBack,\n tool_perp: configChangeCallBack,\n tool_inmem: configChangeCallBack,\n tool_ninmem: configChangeCallBack,\n tool_union: configChangeCallBack,\n tool_intersec: configChangeCallBack,\n\n squarebkts: function squarebktsChangeCallBack(i, value) {\n i.prop('tool_lbrack', value);\n i.prop('tool_rbrack', value);\n i.triggerPci('configChange', [i.getProperties()]);\n },\n roundbkts: function roundbktsChangeCallBack(i, value) {\n i.prop('tool_lparen', value);\n i.prop('tool_rparen', value);\n i.triggerPci('configChange', [i.getProperties()]);\n },\n curlybkts: function curlybktsChangeCallBack(i, value) {\n i.prop('tool_lbrace', value);\n i.prop('tool_rbrace', value);\n i.triggerPci('configChange', [i.getProperties()]);\n },\n\n allowNewLine: configChangeCallBack,\n enableAutoWrap: configChangeCallBack\n });\n\n\n $gapStyleBox = $form.find('.mathgap-style-box');\n $gapStyleSelector = $gapStyleBox.find('[data-mathgap-style]');\n\n $gapStyleSelector.select2({\n width: '100%',\n minimumResultsForSearch: Infinity\n })\n .val(interaction.prop('gapStyle'))\n .trigger('change');\n };\n\n /**\n * Change callback for editable math field\n */\n\n MathEntryInteractionStateQuestion.prototype.addMathFieldListener = function addMathFieldListener() {\n var _widget = this.widget,\n interaction = _widget.element;\n\n interaction.onPci('responseChange', function(latex) {\n if (toBoolean(interaction.prop('useGapExpression'), false)) {\n interaction.prop('gapExpression', latex);\n } else {\n interaction.prop('gapExpression', '');\n }\n });\n };\n\n /**\n * Display the \"Add Gap\" button\n */\n MathEntryInteractionStateQuestion.prototype.createAddGapBtn = function createAddGapBtn() {\n var _widget = this.widget,\n $container = _widget.$container,\n $toolbar = $container.find('.toolbar'),\n interaction =_widget.element;\n\n if ($toolbar.length) {\n $toolbar.after($addGapBtn);\n $addGapBtn.on('click', function() {\n interaction.getResponseDeclaration().removeMapEntries();\n interaction.triggerPci('addGap');\n });\n }\n };\n\n /**\n * Remove the \"Add Gap\" button from the DOM\n */\n MathEntryInteractionStateQuestion.prototype.removeAddGapBtn = function removeAddGapBtn() {\n $addGapBtn.off('click');\n $addGapBtn.remove();\n };\n\n return MathEntryInteractionStateQuestion;\n});\n\n", + "/**\n * This program is free software; you can redistribute it and/or\n * modify it under the terms of the GNU General Public License\n * as published by the Free Software Foundation; under version 2\n * of the License (non-upgradable).\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program; if not, write to the Free Software\n * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\n *\n * Copyright (c) 2021 (original work) Open Assessment Technologies SA;\n */\ndefine('mathEntryInteraction/creator/widget/states/Correct',[\n 'taoQtiItem/qtiCreator/widgets/states/factory',\n 'taoQtiItem/qtiCreator/widgets/states/Correct'\n], function (stateFactory, Correct) {\n 'use strict';\n\n var InteractionStateCorrect = stateFactory.create(\n Correct,\n function init() {\n this.widget.element.getResponseDeclaration().setTemplate('MAP_RESPONSE');\n this.widget.changeState('map');\n },\n function exit() {\n }\n );\n\n return InteractionStateCorrect;\n});\n\n", + "\ndefine('tpl!mathEntryInteraction/creator/tpl/answerForm', ['handlebars'], function(hb){ \nreturn hb.template(function (Handlebars,depth0,helpers,partials,data) {\n this.compilerInfo = [4,'>= 1.0.0'];\nhelpers = this.merge(helpers, Handlebars.helpers); data = data || {};\n var buffer = \"\", stack1, helper, options, functionType=\"function\", escapeExpression=this.escapeExpression, helperMissing=helpers.helperMissing, self=this;\n\nfunction program1(depth0,data) {\n \n var buffer = \"\", stack1, helper, options;\n buffer += \"\\n
\\n

\"\n + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, \"Correct answer option\", options) : helperMissing.call(depth0, \"__\", \"Correct answer option\", options)))\n + \" \"\n + escapeExpression((helper = helpers.increaseIndex || (depth0 && depth0.increaseIndex),options={hash:{},data:data},helper ? helper.call(depth0, (data == null || data === false ? data : data.index), options) : helperMissing.call(depth0, \"increaseIndex\", (data == null || data === false ? data : data.index), options)))\n + \"

\\n \\n \\n \"\n + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, \"edit the answer\", options) : helperMissing.call(depth0, \"__\", \"edit the answer\", options)))\n + \"\\n \\n\\n
\\n\\n \\n \\n \"\n + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, \"delete the answer\", options) : helperMissing.call(depth0, \"__\", \"delete the answer\", options)))\n + \"\\n \\n
\\n
\\n \";\n return buffer;\n }\n\n buffer += \"
\\n
\\n

\"\n + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, \"Define correct responses\", options) : helperMissing.call(depth0, \"__\", \"Define correct responses\", options)))\n + \":

\\n
\\n
\\n
\\n \";\n stack1 = helpers.each.call(depth0, (depth0 && depth0.correctAnswerEntries), {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data});\n if(stack1 || stack1 === 0) { buffer += stack1; }\n buffer += \"\\n
\\n
\\n\\n
\\n\\n
\";\n return buffer;\n });\n});\n\n", + "\ndefine('tpl!mathEntryInteraction/creator/tpl/addAnswerOption', ['handlebars'], function(hb){ \nreturn hb.template(function (Handlebars,depth0,helpers,partials,data) {\n this.compilerInfo = [4,'>= 1.0.0'];\nhelpers = this.merge(helpers, Handlebars.helpers); data = data || {};\n var buffer = \"\", helper, options, helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;\n\n\n buffer += \"\";\n return buffer;\n });\n});\n\n", + "/**\n * This program is free software; you can redistribute it and/or\n * modify it under the terms of the GNU General Public License\n * as published by the Free Software Foundation; under version 2\n * of the License (non-upgradable).\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program; if not, write to the Free Software\n * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\n *\n * Copyright (c) 2021 (original work) Open Assessment Technologies SA;\n */\ndefine('mathEntryInteraction/creator/widget/states/Map',[\n 'handlebars',\n 'i18n',\n 'lodash',\n 'jquery',\n 'taoQtiItem/qtiCreator/widgets/states/factory',\n 'taoQtiItem/qtiCreator/widgets/states/Map',\n 'taoQtiItem/qtiCreator/widgets/helpers/formElement',\n 'tpl!mathEntryInteraction/creator/tpl/answerForm',\n 'tpl!mathEntryInteraction/creator/tpl/addAnswerOption',\n], function (\n hb,\n __,\n _,\n $,\n stateFactory,\n Map,\n formElement,\n answerFormTpl,\n addAnswerOptionBtn\n) {\n 'use strict';\n var CORRECT_ANSWER_VALUE = 1;\n hb.registerHelper('increaseIndex', function (value, options) {\n return parseInt(value) + 1;\n });\n\n var MathEntryInteractionStateResponse = stateFactory.create(\n Map,\n function init() {\n this.initGlobalVariables();\n this.initForm();\n },\n function exit() {\n this.emptyGapFields();\n this.toggleResponseMode(false);\n this.saveAnswers();\n this.removeResponseChangeEventListener();\n this.removeEditDeleteListeners();\n this.removeAddButtonListener();\n this.destroyForm();\n }\n );\n\n\n MathEntryInteractionStateResponse.prototype.initGlobalVariables = function initGlobalVariables() {\n var self = this,\n interaction = self.widget.element;\n self.activeEditId = null;\n self.correctResponses = [];\n\n if (this.inGapMode(self) === true) {\n interaction = self.widget.element;\n self.gapTemplate = interaction.prop('gapExpression');\n }\n }\n\n MathEntryInteractionStateResponse.prototype.initForm = function initForm() {\n var self = this,\n interaction = self.widget.element,\n $responseForm = self.widget.$responseForm;\n\n this.initResponseChangeEventListener();\n self.correctResponses = this.getExistingCorrectAnswerOptions();\n $responseForm.html(addAnswerOptionBtn());\n this.initAddAnswerButton();\n this.renderForm(self.correctResponses);\n }\n\n MathEntryInteractionStateResponse.prototype.initAddAnswerButton = function initAddAnswerButton() {\n var self = this,\n interaction = self.widget.element,\n $responseForm = self.widget.$responseForm,\n $addAnswerBtn = $responseForm.find($('.add-answer-option'));\n\n $addAnswerBtn.on('click', function () {\n var newCorrectAnswer;\n\n if (self.inGapMode() === true) {\n self.emptyGapFields();\n var gapExpression = interaction.prop('gapExpression');\n var gapCount = (gapExpression.match(/\\\\taoGap/g) || []).length;\n if (gapCount > 0) {\n newCorrectAnswer = [];\n for (var i = 0; i < gapCount; i++) {\n newCorrectAnswer.push(' ');\n }\n\n newCorrectAnswer = newCorrectAnswer.join(',');\n } else {\n newCorrectAnswer = '';\n }\n } else {\n newCorrectAnswer = '';\n self.toggleResponseMode(false);\n }\n\n self.correctResponses.push(newCorrectAnswer);\n self.renderForm(self.correctResponses);\n });\n }\n\n MathEntryInteractionStateResponse.prototype.getExistingCorrectAnswerOptions = function getExistingCorrectAnswerOptions() {\n var self = this,\n interaction = self.widget.element;\n\n var mapEntries = interaction.getResponseDeclaration().getMapEntries();\n return _.keys(mapEntries) || [];\n }\n\n MathEntryInteractionStateResponse.prototype.initResponseChangeEventListener = function initResponseChangeEventListener() {\n var self = this,\n interaction = self.widget.element;\n\n interaction.onPci('responseChange', function (latex) {\n if (self.inGapMode(self) === false && self.activeEditId !== null) {\n self.correctResponses[self.activeEditId] = latex;\n } else if (self.inGapMode(self) === true && self.activeEditId !== null) {\n var response = interaction.getResponse();\n if (response !== null) {\n self.correctResponses[self.activeEditId] = response.base.string;\n }\n }\n });\n }\n\n MathEntryInteractionStateResponse.prototype.removeResponseChangeEventListener = function removeResponseChangeEventListener() {\n var self = this,\n interaction = self.widget.element;\n\n interaction.offPci('responseChange');\n }\n\n MathEntryInteractionStateResponse.prototype.initEditingOptions = function initEditingOptions() {\n var self = this,\n interaction = self.widget.element,\n $responseForm = self.widget.$responseForm,\n $entryConfig = $responseForm.find('.entry-config'),\n $editButtons = $entryConfig.find('.answer-edit');\n\n $editButtons.click(function (e) {\n e.preventDefault();\n e.stopImmediatePropagation();\n self.toggleResponseMode(true);\n var selectedEditId = parseInt($(e.target).closest('div').attr('data-index'));\n\n if (self.activeEditId !== selectedEditId) {\n\n if (self.inGapMode() === true) {\n self.activeEditId = selectedEditId;\n var response = self.getGapResponseObject(self.correctResponses[self.activeEditId]);\n interaction.triggerPci('latexGapInput', [response]);\n } else {\n self.activeEditId = selectedEditId;\n interaction.triggerPci('latexInput', [self.correctResponses[self.activeEditId]]);\n }\n } else {\n self.emptyGapFields();\n }\n });\n }\n\n // forming gap response object to be further processed by the latexGapInput event\n MathEntryInteractionStateResponse.prototype.getGapResponseObject = function getGapResponseObject(response) {\n return {\n base: {\n string: response.split(',')\n }\n }\n }\n\n // removing all saved map entries\n MathEntryInteractionStateResponse.prototype.clearMapEntries = function clearMapEntries() {\n var self = this,\n interaction = self.widget.element,\n response = interaction.getResponseDeclaration(),\n mapEntries = response.getMapEntries();\n\n _.keys(mapEntries).forEach(function (mapKey) {\n response.removeMapEntry(mapKey, true);\n });\n }\n\n MathEntryInteractionStateResponse.prototype.initDeletingOptions = function initDeletingOptions() {\n var self = this,\n interaction = self.widget.element,\n $responseForm = self.widget.$responseForm,\n $entryConfig = $responseForm.find('.entry-config'),\n $deleteButtons = $entryConfig.find('.answer-delete');\n\n $deleteButtons.click(function (e) {\n e.preventDefault();\n e.stopImmediatePropagation();\n var id = parseInt($(e.target).closest('div').attr('data-index'));\n\n if (self.inGapMode() === true) {\n self.activeEditId = id;\n self.emptyGapFields();\n } else {\n self.activeEditId = null;\n self.toggleResponseMode(false);\n }\n\n self.correctResponses.splice(id, 1);\n self.renderForm(self.correctResponses);\n });\n }\n\n MathEntryInteractionStateResponse.prototype.renderForm = function renderForm(correctAnswerOptions) {\n var self = this,\n $responseForm = self.widget.$responseForm;\n\n this.removeEditDeleteListeners();\n $responseForm.find('.mathEntryInteraction').remove();\n $responseForm.append(answerFormTpl({correctAnswerEntries: correctAnswerOptions}));\n this.initDeletingOptions();\n this.initEditingOptions();\n }\n\n /**\n * remove all event listeners to avoid any potential memory leaks\n */\n MathEntryInteractionStateResponse.prototype.removeEditDeleteListeners = function removeEditDeleteListeners() {\n var self = this,\n $entryConfig = self.widget.$responseForm.find('.entry-config');\n\n $entryConfig.find('.answer-edit').off('click');\n $entryConfig.find('.answer-delete').off('click');\n }\n\n MathEntryInteractionStateResponse.prototype.removeAddButtonListener = function removeAddButtonListener() {\n var self = this,\n $responseForm = self.widget.$responseForm;\n\n $responseForm.find($('.add-answer-option')).off('click');\n }\n\n MathEntryInteractionStateResponse.prototype.destroyForm = function destroyForm() {\n var self = this,\n $responseForm = self.widget.$responseForm;\n\n $responseForm.find('.mathEntryInteraction').remove();\n }\n\n MathEntryInteractionStateResponse.prototype.saveAnswers = function saveAnswers() {\n var self = this,\n interaction = self.widget.element,\n responseDeclaration = interaction.getResponseDeclaration();\n\n this.clearMapEntries();\n\n if (this.inGapMode() === true) {\n self.correctResponses = self.correctResponses.filter(function (response) {\n return response.split(',').indexOf('') === -1;\n });\n }\n\n self.correctResponses.forEach(function (response) {\n responseDeclaration.setMapEntry(response, CORRECT_ANSWER_VALUE, false);\n });\n }\n\n /**\n * if in gap mode: will empty all the gap fields\n */\n MathEntryInteractionStateResponse.prototype.emptyGapFields = function emptyGapFields() {\n var self = this,\n interaction = self.widget.element;\n\n if (this.inGapMode() === true) {\n self.activeEditId = null;\n\n interaction.prop('gapExpression', self.gapTemplate);\n this.toggleResponseMode(false);\n }\n }\n\n MathEntryInteractionStateResponse.prototype.toggleResponseMode = function toggleResponseMode(value) {\n var self = this,\n interaction = self.widget.element;\n\n if (interaction.prop('inResponseState') !== value) {\n interaction.prop('inResponseState', value);\n interaction.triggerPci('configChange', [interaction.getProperties()]);\n }\n }\n\n MathEntryInteractionStateResponse.prototype.inGapMode = function inGapMode() {\n var interaction = this.widget.element;\n var useGapExpression = interaction.prop('useGapExpression');\n return useGapExpression && useGapExpression !== 'false' || false;\n }\n\n return MathEntryInteractionStateResponse;\n});\n\n", + "/**\n * This program is free software; you can redistribute it and/or\n * modify it under the terms of the GNU General Public License\n * as published by the Free Software Foundation; under version 2\n * of the License (non-upgradable).\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program; if not, write to the Free Software\n * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\n *\n * Copyright (c) 2016 (original work) Open Assessment Technologies SA;\n */\n\ndefine('mathEntryInteraction/creator/widget/states/states',[\n 'taoQtiItem/qtiCreator/widgets/states/factory',\n 'taoQtiItem/qtiCreator/widgets/interactions/customInteraction/states/states',\n 'mathEntryInteraction/creator/widget/states/Question',\n 'mathEntryInteraction/creator/widget/states/Correct',\n 'mathEntryInteraction/creator/widget/states/Map'\n], function(factory, states){\n 'use strict';\n\n return factory.createBundle(states, arguments);\n});\n\n", + "/**\n * This program is free software; you can redistribute it and/or\n * modify it under the terms of the GNU General Public License\n * as published by the Free Software Foundation; under version 2\n * of the License (non-upgradable).\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program; if not, write to the Free Software\n * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\n *\n * Copyright (c) 2016 (original work) Open Assessment Technologies SA;\n */\n\ndefine('mathEntryInteraction/creator/widget/Widget',[\n 'taoQtiItem/qtiCreator/widgets/interactions/customInteraction/Widget',\n 'mathEntryInteraction/creator/widget/states/states'\n], function(Widget, states){\n 'use strict';\n\n var MathEntryInteractionWidget = Widget.clone();\n\n MathEntryInteractionWidget.initCreator = function initCreator() {\n var $interaction;\n\n this.registerStates(states);\n\n Widget.initCreator.call(this);\n\n $interaction = this.$container.find('.mathEntryInteraction');\n if ($interaction.length) {\n $interaction.addClass('tao-qti-creator-context');\n }\n };\n\n return MathEntryInteractionWidget;\n});\n", + "\ndefine('tpl!mathEntryInteraction/creator/tpl/markup', ['handlebars'], function(hb){ \nreturn hb.template(function (Handlebars,depth0,helpers,partials,data) {\n this.compilerInfo = [4,'>= 1.0.0'];\nhelpers = this.merge(helpers, Handlebars.helpers); data = data || {};\n var buffer = \"\", stack1, helper, functionType=\"function\";\n\n\n buffer += \"
\\n
\";\n if (helper = helpers.prompt) { stack1 = helper.call(depth0, {hash:{},data:data}); }\n else { helper = (depth0 && depth0.prompt); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }\n if(stack1 || stack1 === 0) { buffer += stack1; }\n buffer += \"
\\n
\\n
\\n
\\n \\n
\\n
\\n
\";\n return buffer;\n });\n});\n\n", + "/**\n * This program is free software; you can redistribute it and/or\n * modify it under the terms of the GNU General Public License\n * as published by the Free Software Foundation; under version 2\n * of the License (non-upgradable).\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program; if not, write to the Free Software\n * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\n *\n * Copyright (c) 2016-2021 (original work) Open Assessment Technologies SA;\n *\n * @author Christophe Noël \n *\n */\n\ndefine('mathEntryInteraction/imsPciCreator',[\n 'lodash',\n 'mathEntryInteraction/creator/widget/Widget',\n 'tpl!mathEntryInteraction/creator/tpl/markup'\n], function (_, Widget, markupTpl) {\n 'use strict';\n\n var _typeIdentifier = 'mathEntryInteraction';\n\n var mathEntryInteractionCreator = {\n /**\n * (required) Get the typeIdentifier of the custom interaction\n *\n * @returns {String}\n */\n getTypeIdentifier: function getTypeIdentifier() {\n return _typeIdentifier;\n },\n /**\n * (required) Get the widget prototype\n * Used in the renderer\n *\n * @returns {Object} Widget\n */\n getWidget: function getWidget() {\n return Widget;\n },\n /**\n * (optional) Get the default properties values of the pci.\n * Used on new pci instance creation\n *\n * @returns {Object}\n */\n getDefaultProperties: function getDefaultProperties() {\n return {\n authorizeWhiteSpace: 'false',\n useGapExpression: 'false',\n inResponseState: 'false',\n gapExpression: '',\n gapStyle: '',\n focusOnDenominator: false,\n\n tool_frac: 'true',\n tool_sqrt: 'true',\n tool_exp: 'true',\n tool_log: 'true',\n tool_ln: 'true',\n tool_e: 'true',\n tool_infinity: 'true',\n tool_lbrack: 'true',\n tool_rbrack: 'true',\n tool_pi: 'true',\n tool_cos: 'true',\n tool_sin: 'true',\n tool_lte: 'true',\n tool_gte: 'true',\n tool_times: 'true',\n tool_divide: 'true',\n tool_plusminus: 'true',\n tool_angle: 'true',\n tool_minus: 'true',\n tool_plus: 'true',\n tool_equal: 'true',\n tool_lower: 'true',\n tool_greater: 'true',\n tool_subscript: 'true',\n tool_lbrace: 'true',\n tool_rbrace: 'true',\n tool_lparen: 'true',\n tool_rparen: 'true',\n tool_integral: 'true',\n tool_timesdot: 'true',\n tool_triangle: 'true',\n tool_similar: 'true',\n tool_paral: 'true',\n tool_perp: 'true',\n tool_inmem: 'true',\n tool_ninmem: 'true',\n tool_union: 'true',\n tool_intersec: 'true',\n allowNewLine: 'false',\n enableAutoWrap: 'false'\n };\n },\n /**\n * (optional) Callback to execute on the\n * Used on new pci instance creation\n *\n * @returns {Object}\n */\n afterCreate: function afterCreate(pci) {\n //do some stuff\n },\n /**\n * (required) Gives the qti pci xml template\n *\n * @returns {function} handlebar template\n */\n getMarkupTemplate: function getMarkupTemplate() {\n return markupTpl;\n },\n /**\n * (optional) Allows passing additional data to xml template\n *\n * @returns {function} handlebar template\n */\n getMarkupData: function getMarkupData(pci, defaultData) {\n defaultData.prompt = pci.data('prompt');\n return defaultData;\n }\n };\n\n //since we assume we are in a tao context, there is no use to expose the a global object for lib registration\n //all libs should be declared here\n return mathEntryInteractionCreator;\n});\n\n", + "define(['mathEntryInteraction/imsPciCreator'],function(IMSPCI){return IMSPCI});\n" + ] +} \ No newline at end of file diff --git a/views/js/pciCreator/ims/mathEntryInteraction/runtime/mathEntryInteraction.min.js b/views/js/pciCreator/ims/mathEntryInteraction/runtime/mathEntryInteraction.min.js index b0be1bad..37c0206b 100644 --- a/views/js/pciCreator/ims/mathEntryInteraction/runtime/mathEntryInteraction.min.js +++ b/views/js/pciCreator/ims/mathEntryInteraction/runtime/mathEntryInteraction.min.js @@ -1 +1,15599 @@ -function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_typeof(obj)}define("taoQtiItem/portableLib/jquery_2_1_1",[],function(){var _StringfromCharCode=String.fromCharCode,_Mathmax=Math.max;return function(global,factory){"object"===("undefined"==typeof module?"undefined":_typeof(module))&&"object"===_typeof(module.exports)?module.exports=global.document?factory(global,!0):function(w){if(!w.document)throw new Error("jQuery requires a window with a document");return factory(w)}:factory(global)}("undefined"==typeof window?this:window,function(window,noGlobal){function isArraylike(obj){var length=obj.length,type=jQuery.type(obj);return!("function"===type||jQuery.isWindow(obj))&&(!!(1===obj.nodeType&&length)||"array"===type||0===length||"number"==typeof length&&0")).appendTo(doc.documentElement),doc=iframe[0].contentDocument,doc.write(),doc.close(),display=actualDisplay(nodeName,doc),iframe.detach()),elemdisplay[nodeName]=display),display}function curCSS(elem,name,computed){var style=elem.style,width,minWidth,maxWidth,ret;return computed=computed||getStyles(elem),computed&&(ret=computed.getPropertyValue(name)||computed[name]),computed&&(""===ret&&!jQuery.contains(elem.ownerDocument,elem)&&(ret=jQuery.style(elem,name)),rnumnonpx.test(ret)&&rmargin.test(name)&&(width=style.width,minWidth=style.minWidth,maxWidth=style.maxWidth,style.minWidth=style.maxWidth=style.width=ret,ret=computed.width,style.width=width,style.minWidth=minWidth,style.maxWidth=maxWidth)),void 0===ret?ret:ret+""}function addGetHookIf(conditionFn,hookFn){return{get:function get(){return conditionFn()?void delete this.get:(this.get=hookFn).apply(this,arguments)}}}function vendorPropName(style,name){if(name in style)return name;for(var capName=name[0].toUpperCase()+name.slice(1),origName=name,i=cssPrefixes.length;i--;)if(name=cssPrefixes[i]+capName,name in style)return name;return origName}function setPositiveNumber(elem,value,subtract){var matches=rnumsplit.exec(value);return matches?_Mathmax(0,matches[1]-(subtract||0))+(matches[2]||"px"):value}function augmentWidthOrHeight(elem,name,extra,isBorderBox,styles){for(var i=extra===(isBorderBox?"border":"content")?4:"width"===name?1:0,val=0;4>i;i+=2)"margin"===extra&&(val+=jQuery.css(elem,extra+cssExpand[i],!0,styles)),isBorderBox?("content"===extra&&(val-=jQuery.css(elem,"padding"+cssExpand[i],!0,styles)),"margin"!==extra&&(val-=jQuery.css(elem,"border"+cssExpand[i]+"Width",!0,styles))):(val+=jQuery.css(elem,"padding"+cssExpand[i],!0,styles),"padding"!==extra&&(val+=jQuery.css(elem,"border"+cssExpand[i]+"Width",!0,styles)));return val}function getWidthOrHeight(elem,name,extra){var valueIsBorderBox=!0,val="width"===name?elem.offsetWidth:elem.offsetHeight,styles=getStyles(elem),isBorderBox="border-box"===jQuery.css(elem,"boxSizing",!1,styles);if(0>=val||null==val){if(val=curCSS(elem,name,styles),(0>val||null==val)&&(val=elem.style[name]),rnumnonpx.test(val))return val;valueIsBorderBox=isBorderBox&&(support.boxSizingReliable()||val===elem.style[name]),val=parseFloat(val)||0}return val+augmentWidthOrHeight(elem,name,extra||(isBorderBox?"border":"content"),valueIsBorderBox,styles)+"px"}function showHide(elements,show){for(var values=[],index=0,length=elements.length,display,elem,hidden;indexi;i+=2-includeWidth)which=cssExpand[i],attrs["margin"+which]=attrs["padding"+which]=type;return includeWidth&&(attrs.opacity=attrs.width=type),attrs}function createTween(value,prop,animation){for(var collection=(tweeners[prop]||[]).concat(tweeners["*"]),index=0,length=collection.length,tween;indexpercent&&length?remaining:(deferred.resolveWith(elem,[animation]),!1)},animation=deferred.promise({elem:elem,props:jQuery.extend({},properties),opts:jQuery.extend(!0,{specialEasing:{}},options),originalProperties:properties,originalOptions:options,startTime:fxNow||createFxNow(),duration:options.duration,tweens:[],createTween:function(prop,end){var tween=jQuery.Tween(elem,animation.opts,prop,end,animation.opts.specialEasing[prop]||animation.opts.easing);return animation.tweens.push(tween),tween},stop:function stop(gotoEnd){var index=0,length=gotoEnd?animation.tweens.length:0;if(stopped)return this;for(stopped=!0;indexnum?this[num+this.length]:this[num]},pushStack:function pushStack(elems){var ret=jQuery.merge(this.constructor(),elems);return ret.prevObject=this,ret.context=this.context,ret},each:function each(callback,args){return jQuery.each(this,callback,args)},map:function map(callback){return this.pushStack(jQuery.map(this,function(elem,i){return callback.call(elem,i,elem)}))},slice:function slice(){return this.pushStack(_slice.apply(this,arguments))},first:function first(){return this.eq(0)},last:function last(){return this.eq(-1)},eq:function eq(i){var len=this.length,j=+i+(0>i?len:0);return this.pushStack(0<=j&&jExpr.cacheLength&&delete cache[keys.shift()],cache[key+" "]=value}var keys=[];return cache}function markFunction(fn){return fn[expando]=!0,fn}function assert(fn){var div=document.createElement("div");try{return!!fn(div)}catch(e){return!1}finally{div.parentNode&&div.parentNode.removeChild(div),div=null}}function addHandle(attrs,handler){for(var arr=attrs.split("|"),i=attrs.length;i--;)Expr.attrHandle[arr[i]]=handler}function siblingCheck(a,b){var cur=b&&a,diff=cur&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||-2147483648)-(~a.sourceIndex||-2147483648);if(diff)return diff;if(cur)for(;cur=cur.nextSibling;)if(cur===b)return-1;return a?1:-1}function createInputPseudo(type){return function(elem){var name=elem.nodeName.toLowerCase();return"input"===name&&elem.type===type}}function createButtonPseudo(type){return function(elem){var name=elem.nodeName.toLowerCase();return("input"===name||"button"===name)&&elem.type===type}}function createPositionalPseudo(fn){return markFunction(function(argument){return argument=+argument,markFunction(function(seed,matches){for(var matchIndexes=fn([],seed.length,argument),i=matchIndexes.length,j;i--;)seed[j=matchIndexes[i]]&&(seed[j]=!(matches[j]=seed[j]))})})}function testContext(context){return context&&"undefined"!==_typeof(context.getElementsByTagName)&&context}function setFilters(){}function toSelector(tokens){for(var i=0,len=tokens.length,selector="";i+~]|[\x20\t\r\n\f])[\x20\t\r\n\f]*/,rattributeQuotes=/=[\x20\t\r\n\f]*([^\]'"]*?)[\x20\t\r\n\f]*\]/g,rpseudo=/:((?:\\.|[\w-]|[^\x00-\xa0])+)(?:\((('((?:\\.|[^\\'])*)'|"((?:\\.|[^\\"])*)")|((?:\\.|[^\\()[\]]|\[[\x20\t\r\n\f]*((?:\\.|[\w-]|[^\x00-\xa0])+)(?:[\x20\t\r\n\f]*([*^$|!~]?=)[\x20\t\r\n\f]*(?:'((?:\\.|[^\\'])*)'|"((?:\\.|[^\\"])*)"|((?:\\.|[\w#-]|[^\x00-\xa0])+))|)[\x20\t\r\n\f]*\])*)|.*)\)|)/,ridentifier=/^(?:\\.|[\w#-]|[^\x00-\xa0])+$/,matchExpr={ID:/^#((?:\\.|[\w-]|[^\x00-\xa0])+)/,CLASS:/^\.((?:\\.|[\w-]|[^\x00-\xa0])+)/,TAG:/^((?:\\.|[\w*-]|[^\x00-\xa0])+)/,ATTR:/^\[[\x20\t\r\n\f]*((?:\\.|[\w-]|[^\x00-\xa0])+)(?:[\x20\t\r\n\f]*([*^$|!~]?=)[\x20\t\r\n\f]*(?:'((?:\\.|[^\\'])*)'|"((?:\\.|[^\\"])*)"|((?:\\.|[\w#-]|[^\x00-\xa0])+))|)[\x20\t\r\n\f]*\]/,PSEUDO:/^:((?:\\.|[\w-]|[^\x00-\xa0])+)(?:\((('((?:\\.|[^\\'])*)'|"((?:\\.|[^\\"])*)")|((?:\\.|[^\\()[\]]|\[[\x20\t\r\n\f]*((?:\\.|[\w-]|[^\x00-\xa0])+)(?:[\x20\t\r\n\f]*([*^$|!~]?=)[\x20\t\r\n\f]*(?:'((?:\\.|[^\\'])*)'|"((?:\\.|[^\\"])*)"|((?:\\.|[\w#-]|[^\x00-\xa0])+))|)[\x20\t\r\n\f]*\])*)|.*)\)|)/,CHILD:/^:(only|first|last|nth|nth-last)-(child|of-type)(?:\([\x20\t\r\n\f]*(even|odd|(([+-]|)(\d*)n|)[\x20\t\r\n\f]*(?:([+-]|)[\x20\t\r\n\f]*(\d+)|))[\x20\t\r\n\f]*\)|)/i,bool:/^(?:checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped)$/i,needsContext:/^[\x20\t\r\n\f]*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\([\x20\t\r\n\f]*((?:-\d)?\d*)[\x20\t\r\n\f]*\)|)(?=[^-]|$)/i},rinputs=/^(?:input|select|textarea|button)$/i,rheader=/^h\d$/i,rnative=/^[^{]+\{\s*\[native \w/,rquickExpr=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,rsibling=/[+~]/,rescape=/'|\\/g,runescape=/\\([\da-f]{1,6}[\x20\t\r\n\f]?|([\x20\t\r\n\f])|.)/ig,funescape=function(_,escaped,escapedWhitespace){var high="0x"+escaped-65536;return high!=high||escapedWhitespace?escaped:0>high?_StringfromCharCode(high+65536):_StringfromCharCode(55296|high>>10,56320|1023&high)},i,support,Expr,getText,isXML,tokenize,compile,select,outermostContext,sortInput,hasDuplicate,setDocument,document,docElem,documentIsHTML,rbuggyQSA,rbuggyMatches,matches,contains;try{push.apply(arr=slice.call(preferredDoc.childNodes),preferredDoc.childNodes),arr[preferredDoc.childNodes.length].nodeType}catch(e){push={apply:arr.length?function(target,els){push_native.apply(target,slice.call(els))}:function(target,els){for(var j=target.length,i=0;target[j++]=els[i++];);target.length=j-1}}}for(i in support=Sizzle.support={},isXML=Sizzle.isXML=function(elem){var documentElement=elem&&(elem.ownerDocument||elem).documentElement;return!!documentElement&&"HTML"!==documentElement.nodeName},setDocument=Sizzle.setDocument=function(node){var doc=node?node.ownerDocument||node:preferredDoc,parent=doc.defaultView,hasCompare;return doc!==document&&9===doc.nodeType&&doc.documentElement?(document=doc,docElem=doc.documentElement,documentIsHTML=!isXML(doc),parent&&parent!==parent.top&&(parent.addEventListener?parent.addEventListener("unload",function(){setDocument()},!1):parent.attachEvent&&parent.attachEvent("onunload",function(){setDocument()})),support.attributes=assert(function(div){return div.className="i",!div.getAttribute("className")}),support.getElementsByTagName=assert(function(div){return div.appendChild(doc.createComment("")),!div.getElementsByTagName("*").length}),support.getElementsByClassName=rnative.test(doc.getElementsByClassName)&&assert(function(div){return div.innerHTML="
",div.firstChild.className="i",2===div.getElementsByClassName("i").length}),support.getById=assert(function(div){return docElem.appendChild(div).id=expando,!doc.getElementsByName||!doc.getElementsByName(expando).length}),support.getById?(Expr.find.ID=function(id,context){if("undefined"!==_typeof(context.getElementById)&&documentIsHTML){var m=context.getElementById(id);return m&&m.parentNode?[m]:[]}},Expr.filter.ID=function(id){var attrId=id.replace(runescape,funescape);return function(elem){return elem.getAttribute("id")===attrId}}):(delete Expr.find.ID,Expr.filter.ID=function(id){var attrId=id.replace(runescape,funescape);return function(elem){var node="undefined"!==_typeof(elem.getAttributeNode)&&elem.getAttributeNode("id");return node&&node.value===attrId}}),Expr.find.TAG=support.getElementsByTagName?function(tag,context){if("undefined"!==_typeof(context.getElementsByTagName))return context.getElementsByTagName(tag)}:function(tag,context){var tmp=[],i=0,results=context.getElementsByTagName(tag),elem;if("*"===tag){for(;elem=results[i++];)1===elem.nodeType&&tmp.push(elem);return tmp}return results},Expr.find.CLASS=support.getElementsByClassName&&function(className,context){if("undefined"!==_typeof(context.getElementsByClassName)&&documentIsHTML)return context.getElementsByClassName(className)},rbuggyMatches=[],rbuggyQSA=[],(support.qsa=rnative.test(doc.querySelectorAll))&&(assert(function(div){div.innerHTML="",div.querySelectorAll("[msallowclip^='']").length&&rbuggyQSA.push("[*^$]=[\\x20\\t\\r\\n\\f]*(?:''|\"\")"),div.querySelectorAll("[selected]").length||rbuggyQSA.push("\\[[\\x20\\t\\r\\n\\f]*(?:value|checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped)"),div.querySelectorAll(":checked").length||rbuggyQSA.push(":checked")}),assert(function(div){var input=doc.createElement("input");input.setAttribute("type","hidden"),div.appendChild(input).setAttribute("name","D"),div.querySelectorAll("[name=d]").length&&rbuggyQSA.push("name[\\x20\\t\\r\\n\\f]*[*^$|!~]?="),div.querySelectorAll(":enabled").length||rbuggyQSA.push(":enabled",":disabled"),div.querySelectorAll("*,:x"),rbuggyQSA.push(",.*:")})),(support.matchesSelector=rnative.test(matches=docElem.matches||docElem.webkitMatchesSelector||docElem.mozMatchesSelector||docElem.oMatchesSelector||docElem.msMatchesSelector))&&assert(function(div){support.disconnectedMatch=matches.call(div,"div"),matches.call(div,"[s!='']:x"),rbuggyMatches.push("!=",":((?:\\\\.|[\\w-]|[^\\x00-\\xa0])+)(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|\\[[\\x20\\t\\r\\n\\f]*((?:\\\\.|[\\w-]|[^\\x00-\\xa0])+)(?:[\\x20\\t\\r\\n\\f]*([*^$|!~]?=)[\\x20\\t\\r\\n\\f]*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|((?:\\\\.|[\\w#-]|[^\\x00-\\xa0])+))|)[\\x20\\t\\r\\n\\f]*\\])*)|.*)\\)|)")}),rbuggyQSA=rbuggyQSA.length&&new RegExp(rbuggyQSA.join("|")),rbuggyMatches=rbuggyMatches.length&&new RegExp(rbuggyMatches.join("|")),hasCompare=rnative.test(docElem.compareDocumentPosition),contains=hasCompare||rnative.test(docElem.contains)?function(a,b){var adown=9===a.nodeType?a.documentElement:a,bup=b&&b.parentNode;return a===bup||!!(bup&&1===bup.nodeType&&(adown.contains?adown.contains(bup):a.compareDocumentPosition&&16&a.compareDocumentPosition(bup)))}:function(a,b){if(b)for(;b=b.parentNode;)if(b===a)return!0;return!1},sortOrder=hasCompare?function(a,b){if(a===b)return hasDuplicate=!0,0;var compare=!a.compareDocumentPosition-!b.compareDocumentPosition;return compare?compare:(compare=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&compare||!support.sortDetached&&b.compareDocumentPosition(a)===compare?a===doc||a.ownerDocument===preferredDoc&&contains(preferredDoc,a)?-1:b===doc||b.ownerDocument===preferredDoc&&contains(preferredDoc,b)?1:sortInput?indexOf.call(sortInput,a)-indexOf.call(sortInput,b):0:4&compare?-1:1)}:function(a,b){if(a===b)return hasDuplicate=!0,0;var i=0,aup=a.parentNode,bup=b.parentNode,ap=[a],bp=[b],cur;if(!aup||!bup)return a===doc?-1:b===doc?1:aup?-1:bup?1:sortInput?indexOf.call(sortInput,a)-indexOf.call(sortInput,b):0;if(aup===bup)return siblingCheck(a,b);for(cur=a;cur=cur.parentNode;)ap.unshift(cur);for(cur=b;cur=cur.parentNode;)bp.unshift(cur);for(;ap[i]===bp[i];)i++;return i?siblingCheck(ap[i],bp[i]):ap[i]===preferredDoc?-1:bp[i]===preferredDoc?1:0},doc):document},Sizzle.matches=function(expr,elements){return Sizzle(expr,null,null,elements)},Sizzle.matchesSelector=function(elem,expr){if((elem.ownerDocument||elem)!==document&&setDocument(elem),expr=expr.replace(rattributeQuotes,"='$1']"),support.matchesSelector&&documentIsHTML&&(!rbuggyMatches||!rbuggyMatches.test(expr))&&(!rbuggyQSA||!rbuggyQSA.test(expr)))try{var ret=matches.call(elem,expr);if(ret||support.disconnectedMatch||elem.document&&11!==elem.document.nodeType)return ret}catch(e){}return 0":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function ATTR(match){return match[1]=match[1].replace(runescape,funescape),match[3]=(match[3]||match[4]||match[5]||"").replace(runescape,funescape),"~="===match[2]&&(match[3]=" "+match[3]+" "),match.slice(0,4)},CHILD:function CHILD(match){return match[1]=match[1].toLowerCase(),"nth"===match[1].slice(0,3)?(!match[3]&&Sizzle.error(match[0]),match[4]=+(match[4]?match[5]+(match[6]||1):2*("even"===match[3]||"odd"===match[3])),match[5]=+(match[7]+match[8]||"odd"===match[3])):match[3]&&Sizzle.error(match[0]),match},PSEUDO:function PSEUDO(match){var unquoted=!match[6]&&match[2],excess;return matchExpr.CHILD.test(match[0])?null:(match[3]?match[2]=match[4]||match[5]||"":unquoted&&rpseudo.test(unquoted)&&(excess=tokenize(unquoted,!0))&&(excess=unquoted.indexOf(")",unquoted.length-excess)-unquoted.length)&&(match[0]=match[0].slice(0,excess),match[2]=unquoted.slice(0,excess)),match.slice(0,3))}},filter:{TAG:function TAG(nodeNameSelector){var nodeName=nodeNameSelector.replace(runescape,funescape).toLowerCase();return"*"===nodeNameSelector?function(){return!0}:function(elem){return elem.nodeName&&elem.nodeName.toLowerCase()===nodeName}},CLASS:function CLASS(className){var pattern=classCache[className+" "];return pattern||(pattern=new RegExp("(^|[\\x20\\t\\r\\n\\f])"+className+"([\\x20\\t\\r\\n\\f]|$)"))&&classCache(className,function(elem){return pattern.test("string"==typeof elem.className&&elem.className||"undefined"!==_typeof(elem.getAttribute)&&elem.getAttribute("class")||"")})},ATTR:function ATTR(name,operator,check){return function(elem){var result=Sizzle.attr(elem,name);return null==result?"!="===operator:!operator||(result+="","="===operator?result===check:"!="===operator?result!==check:"^="===operator?check&&0===result.indexOf(check):"*="===operator?check&&-1elem.nodeType)return!1;return!0},parent:function parent(elem){return!Expr.pseudos.empty(elem)},header:function header(elem){return rheader.test(elem.nodeName)},input:function input(elem){return rinputs.test(elem.nodeName)},button:function button(elem){var name=elem.nodeName.toLowerCase();return"input"===name&&"button"===elem.type||"button"===name},text:function text(elem){var attr;return"input"===elem.nodeName.toLowerCase()&&"text"===elem.type&&(null==(attr=elem.getAttribute("type"))||"text"===attr.toLowerCase())},first:createPositionalPseudo(function(){return[0]}),last:createPositionalPseudo(function(matchIndexes,length){return[length-1]}),eq:createPositionalPseudo(function(matchIndexes,length,argument){return[0>argument?argument+length:argument]}),even:createPositionalPseudo(function(matchIndexes,length){for(var i=0;iargument?argument+length:argument;0<=--i;)matchIndexes.push(i);return matchIndexes}),gt:createPositionalPseudo(function(matchIndexes,length,argument){for(var i=0>argument?argument+length:argument;++i(?:<\/\1>|)$/,risSimple=/^.[^:#\[\.,]*$/;jQuery.filter=function(expr,elems,not){var elem=elems[0];return not&&(expr=":not("+expr+")"),1===elems.length&&1===elem.nodeType?jQuery.find.matchesSelector(elem,expr)?[elem]:[]:jQuery.find.matches(expr,jQuery.grep(elems,function(elem){return 1===elem.nodeType}))},jQuery.fn.extend({find:function find(selector){var len=this.length,ret=[],self=this,i;if("string"!=typeof selector)return this.pushStack(jQuery(selector).filter(function(){for(i=0;i)[^>]*|#([\w-]*))$/,init=jQuery.fn.init=function(selector,context){var match,elem;if(!selector)return this;if("string"==typeof selector){if(match="<"===selector[0]&&">"===selector[selector.length-1]&&3<=selector.length?[null,selector,null]:rquickExpr.exec(selector),match&&(match[1]||!context)){if(match[1]){if(context=context instanceof jQuery?context[0]:context,jQuery.merge(this,jQuery.parseHTML(match[1],context&&context.nodeType?context.ownerDocument||context:document,!0)),rsingleTag.test(match[1])&&jQuery.isPlainObject(context))for(match in context)jQuery.isFunction(this[match])?this[match](context[match]):this.attr(match,context[match]);return this}return elem=document.getElementById(match[2]),elem&&elem.parentNode&&(this.length=1,this[0]=elem),this.context=document,this.selector=selector,this}return!context||context.jquery?(context||rootjQuery).find(selector):this.constructor(context).find(selector)}return selector.nodeType?(this.context=this[0]=selector,this.length=1,this):jQuery.isFunction(selector)?"undefined"==typeof rootjQuery.ready?selector(jQuery):rootjQuery.ready(selector):(void 0!==selector.selector&&(this.selector=selector.selector,this.context=selector.context),jQuery.makeArray(selector,this))},rootjQuery;init.prototype=jQuery.fn,rootjQuery=jQuery(document);var rparentsprev=/^(?:parents|prev(?:Until|All))/,guaranteedUnique={children:!0,contents:!0,next:!0,prev:!0};jQuery.extend({dir:function(_dir){function dir(){return _dir.apply(this,arguments)}return dir.toString=function(){return _dir.toString()},dir}(function(elem,dir,until){for(var matched=[];(elem=elem[dir])&&9!==elem.nodeType;)if(1===elem.nodeType){if(void 0!==until&&jQuery(elem).is(until))break;matched.push(elem)}return matched}),sibling:function(n,elem){for(var matched=[];n;n=n.nextSibling)1===n.nodeType&&n!==elem&&matched.push(n);return matched}}),jQuery.fn.extend({has:function has(target){var targets=jQuery(target,this),l=targets.length;return this.filter(function(){for(var i=0;icur.nodeType&&(pos?-1x",support.noCloneChecked=!!div.cloneNode(!0).lastChild.defaultValue})();0?_typeof(void 0):"undefined";support.focusinBubbles="onfocusin"in window;var rkeyEvent=/^key/,rmouseEvent=/^(?:mouse|pointer|contextmenu)|click/,rfocusMorph=/^(?:focusinfocus|focusoutblur)$/,rtypenamespace=/^([^.]*)(?:\.(.+)|)$/;jQuery.event={global:{},add:function add(elem,types,handler,data,selector){var elemData=data_priv.get(elem),handleObjIn,eventHandle,tmp,events,t,handleObj,special,handlers,type,namespaces,origType;if(elemData)for(handler.handler&&(handleObjIn=handler,handler=handleObjIn.handler,selector=handleObjIn.selector),handler.guid||(handler.guid=jQuery.guid++),(events=elemData.events)||(events=elemData.events={}),(eventHandle=elemData.handle)||(eventHandle=elemData.handle=function(e){return"undefined"!==_typeof(jQuery)&&jQuery.event.triggered!==e.type?jQuery.event.dispatch.apply(elem,arguments):void 0}),types=(types||"").match(rnotwhite)||[""],t=types.length;t--;)(tmp=rtypenamespace.exec(types[t])||[],type=origType=tmp[1],namespaces=(tmp[2]||"").split(".").sort(),!!type)&&(special=jQuery.event.special[type]||{},type=(selector?special.delegateType:special.bindType)||type,special=jQuery.event.special[type]||{},handleObj=jQuery.extend({type:type,origType:origType,data:data,handler:handler,guid:handler.guid,selector:selector,needsContext:selector&&jQuery.expr.match.needsContext.test(selector),namespace:namespaces.join(".")},handleObjIn),(handlers=events[type])||(handlers=events[type]=[],handlers.delegateCount=0,(!special.setup||!1===special.setup.call(elem,data,namespaces,eventHandle))&&elem.addEventListener&&elem.addEventListener(type,eventHandle,!1)),special.add&&(special.add.call(elem,handleObj),!handleObj.handler.guid&&(handleObj.handler.guid=handler.guid)),selector?handlers.splice(handlers.delegateCount++,0,handleObj):handlers.push(handleObj),jQuery.event.global[type]=!0)},remove:function remove(elem,types,handler,selector,mappedTypes){var elemData=data_priv.hasData(elem)&&data_priv.get(elem),j,origCount,tmp,events,t,handleObj,special,handlers,type,namespaces,origType;if(elemData&&(events=elemData.events)){for(types=(types||"").match(rnotwhite)||[""],t=types.length;t--;){if(tmp=rtypenamespace.exec(types[t])||[],type=origType=tmp[1],namespaces=(tmp[2]||"").split(".").sort(),!type){for(type in events)jQuery.event.remove(elem,type+types[t],handler,selector,!0);continue}for(special=jQuery.event.special[type]||{},type=(selector?special.delegateType:special.bindType)||type,handlers=events[type]||[],tmp=tmp[2]&&new RegExp("(^|\\.)"+namespaces.join("\\.(?:.*\\.|)")+"(\\.|$)"),origCount=j=handlers.length;j--;)handleObj=handlers[j],(mappedTypes||origType===handleObj.origType)&&(!handler||handler.guid===handleObj.guid)&&(!tmp||tmp.test(handleObj.namespace))&&(!selector||selector===handleObj.selector||"**"===selector&&handleObj.selector)&&(handlers.splice(j,1),handleObj.selector&&handlers.delegateCount--,special.remove&&special.remove.call(elem,handleObj));origCount&&!handlers.length&&((!special.teardown||!1===special.teardown.call(elem,namespaces,elemData.handle))&&jQuery.removeEvent(elem,type,elemData.handle),delete events[type])}jQuery.isEmptyObject(events)&&(delete elemData.handle,data_priv.remove(elem,"events"))}},trigger:function trigger(event,data,elem,onlyHandlers){var eventPath=[elem||document],type=hasOwn.call(event,"type")?event.type:event,namespaces=hasOwn.call(event,"namespace")?event.namespace.split("."):[],i,cur,tmp,bubbleType,ontype,handle,special;if((cur=tmp=elem=elem||document,3!==elem.nodeType&&8!==elem.nodeType)&&!rfocusMorph.test(type+jQuery.event.triggered)&&(0<=type.indexOf(".")&&(namespaces=type.split("."),type=namespaces.shift(),namespaces.sort()),ontype=0>type.indexOf(":")&&"on"+type,event=event[jQuery.expando]?event:new jQuery.Event(type,"object"===_typeof(event)&&event),event.isTrigger=onlyHandlers?2:3,event.namespace=namespaces.join("."),event.namespace_re=event.namespace?new RegExp("(^|\\.)"+namespaces.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,event.result=void 0,event.target||(event.target=elem),data=null==data?[event]:jQuery.makeArray(data,[event]),special=jQuery.event.special[type]||{},onlyHandlers||!special.trigger||!1!==special.trigger.apply(elem,data))){if(!onlyHandlers&&!special.noBubble&&!jQuery.isWindow(elem)){for(bubbleType=special.delegateType||type,rfocusMorph.test(bubbleType+type)||(cur=cur.parentNode);cur;cur=cur.parentNode)eventPath.push(cur),tmp=cur;tmp===(elem.ownerDocument||document)&&eventPath.push(tmp.defaultView||tmp.parentWindow||window)}for(i=0;(cur=eventPath[i++])&&!event.isPropagationStopped();)event.type=1]*)\/>/gi,rtagName=/<([\w:]+)/,rhtml=/<|&#?\w+;/,rnoInnerhtml=/<(?:script|style|link)/i,rchecked=/checked\s*(?:[^=]|=\s*.checked.)/i,rscriptType=/^$|\/(?:java|ecma)script/i,rscriptTypeMasked=/^true\/(.*)/,rcleanScript=/^\s*\s*$/g,wrapMap={option:[1,""],thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};wrapMap.optgroup=wrapMap.option,wrapMap.tbody=wrapMap.tfoot=wrapMap.colgroup=wrapMap.caption=wrapMap.thead,wrapMap.th=wrapMap.td,jQuery.extend({clone:function clone(elem,dataAndEvents,deepDataAndEvents){var clone=elem.cloneNode(!0),inPage=jQuery.contains(elem.ownerDocument,elem),i,l,srcElements,destElements;if(!support.noCloneChecked&&(1===elem.nodeType||11===elem.nodeType)&&!jQuery.isXMLDoc(elem))for(destElements=getAll(clone),srcElements=getAll(elem),(i=0,l=srcElements.length);i")+wrap[2],j=wrap[0];j--;)tmp=tmp.lastChild;jQuery.merge(nodes,tmp.childNodes),tmp=fragment.firstChild,tmp.textContent=""}for(fragment.textContent="",i=0;elem=nodes[i++];)if(!(selection&&-1!==jQuery.inArray(elem,selection))&&(contains=jQuery.contains(elem.ownerDocument,elem),tmp=getAll(fragment.appendChild(elem),"script"),contains&&setGlobalEval(tmp),scripts))for(j=0;elem=tmp[j++];)rscriptType.test(elem.type||"")&&scripts.push(elem);return fragment},cleanData:function cleanData(elems){for(var special=jQuery.event.special,i=0,data,elem,type,key;void 0!==(elem=elems[i]);i++){if(jQuery.acceptData(elem)&&(key=elem[data_priv.expando],key&&(data=data_priv.cache[key]))){if(data.events)for(type in data.events)special[type]?jQuery.event.remove(elem,type):jQuery.removeEvent(elem,type,data.handle);data_priv.cache[key]&&delete data_priv.cache[key]}delete data_user.cache[elem[data_user.expando]]}}}),jQuery.fn.extend({text:function text(value){return access(this,function(value){return void 0===value?jQuery.text(this):this.empty().each(function(){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&(this.textContent=value)})},null,value,arguments.length)},append:function append(){return this.domManip(arguments,function(elem){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var target=manipulationTarget(this,elem);target.appendChild(elem)}})},prepend:function prepend(){return this.domManip(arguments,function(elem){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var target=manipulationTarget(this,elem);target.insertBefore(elem,target.firstChild)}})},before:function before(){return this.domManip(arguments,function(elem){this.parentNode&&this.parentNode.insertBefore(elem,this)})},after:function after(){return this.domManip(arguments,function(elem){this.parentNode&&this.parentNode.insertBefore(elem,this.nextSibling)})},remove:function remove(selector,keepData){for(var elems=selector?jQuery.filter(selector,this):this,i=0,elem;null!=(elem=elems[i]);i++)keepData||1!==elem.nodeType||jQuery.cleanData(getAll(elem)),elem.parentNode&&(keepData&&jQuery.contains(elem.ownerDocument,elem)&&setGlobalEval(getAll(elem,"script")),elem.parentNode.removeChild(elem));return this},empty:function empty(){for(var i=0,elem;null!=(elem=this[i]);i++)1===elem.nodeType&&(jQuery.cleanData(getAll(elem,!1)),elem.textContent="");return this},clone:function clone(dataAndEvents,deepDataAndEvents){return dataAndEvents=null!=dataAndEvents&&dataAndEvents,deepDataAndEvents=null==deepDataAndEvents?dataAndEvents:deepDataAndEvents,this.map(function(){return jQuery.clone(this,dataAndEvents,deepDataAndEvents)})},html:function html(value){return access(this,function(value){var elem=this[0]||{},i=0,l=this.length;if(void 0===value&&1===elem.nodeType)return elem.innerHTML;if("string"==typeof value&&!rnoInnerhtml.test(value)&&!wrapMap[(rtagName.exec(value)||["",""])[1].toLowerCase()]){value=value.replace(rxhtmlTag,"<$1>");try{for(;ii;i++)expanded[prefix+cssExpand[i]+suffix]=parts[i]||parts[i-2]||parts[0];return expanded}},rmargin.test(prefix)||(jQuery.cssHooks[prefix+suffix].set=setPositiveNumber)}),jQuery.fn.extend({css:function css(name,value){return access(this,function(elem,name,value){var map={},i=0,styles,len;if(jQuery.isArray(name)){for(styles=getStyles(elem),len=name.length;icur.indexOf(" "+clazz+" ")&&(cur+=clazz+" ");finalValue=jQuery.trim(cur),elem.className!==finalValue&&(elem.className=finalValue)}return this},removeClass:function removeClass(value){var proceed=0===arguments.length||"string"==typeof value&&value,i=0,len=this.length,classes,elem,cur,clazz,j,finalValue;if(jQuery.isFunction(value))return this.each(function(j){jQuery(this).removeClass(value.call(this,j,this.className))});if(proceed)for(classes=(value||"").match(rnotwhite)||[];iindex,values=one?null:[],max=one?index+1:options.length,i=0>index?max:one?index:0,value,option;istatus||304===status,responses&&(response=ajaxHandleResponses(s,jqXHR,responses)),response=ajaxConvert(s,response,jqXHR,isSuccess),isSuccess?(s.ifModified&&(modified=jqXHR.getResponseHeader("Last-Modified"),modified&&(jQuery.lastModified[cacheURL]=modified),modified=jqXHR.getResponseHeader("etag"),modified&&(jQuery.etag[cacheURL]=modified)),204===status||"HEAD"===s.type?statusText="nocontent":304===status?statusText="notmodified":(statusText=response.state,success=response.data,error=response.error,isSuccess=!error)):(error=statusText,(status||!statusText)&&(statusText="error",0>status&&(status=0))),jqXHR.status=status,jqXHR.statusText=(nativeStatusText||statusText)+"",isSuccess?deferred.resolveWith(callbackContext,[success,statusText,jqXHR]):deferred.rejectWith(callbackContext,[jqXHR,statusText,error]),jqXHR.statusCode(_statusCode),_statusCode=void 0,fireGlobals&&globalEventContext.trigger(isSuccess?"ajaxSuccess":"ajaxError",[jqXHR,s,isSuccess?success:error]),completeDeferred.fireWith(callbackContext,[jqXHR,statusText]),fireGlobals&&(globalEventContext.trigger("ajaxComplete",[jqXHR,s]),! --jQuery.active&&jQuery.event.trigger("ajaxStop")))}"object"===_typeof(url)&&(options=url,url=void 0),options=options||{};var s=jQuery.ajaxSetup({},options),callbackContext=s.context||s,globalEventContext=s.context&&(callbackContext.nodeType||callbackContext.jquery)?jQuery(callbackContext):jQuery.event,deferred=jQuery.Deferred(),completeDeferred=jQuery.Callbacks("once memory"),_statusCode=s.statusCode||{},requestHeaders={},requestHeadersNames={},state=0,strAbort="canceled",jqXHR={readyState:0,getResponseHeader:function getResponseHeader(key){var match;if(2===state){if(!responseHeaders)for(responseHeaders={};match=rheaders.exec(responseHeadersString);)responseHeaders[match[1].toLowerCase()]=match[2];match=responseHeaders[key.toLowerCase()]}return null==match?null:match},getAllResponseHeaders:function getAllResponseHeaders(){return 2===state?responseHeadersString:null},setRequestHeader:function setRequestHeader(name,value){var lname=name.toLowerCase();return state||(name=requestHeadersNames[lname]=requestHeadersNames[lname]||name,requestHeaders[name]=value),this},overrideMimeType:function overrideMimeType(type){return state||(s.mimeType=type),this},statusCode:function statusCode(map){var code;if(map)if(2>state)for(code in map)_statusCode[code]=[_statusCode[code],map[code]];else jqXHR.always(map[jqXHR.status]);return this},abort:function abort(statusText){var finalText=statusText||strAbort;return transport&&transport.abort(finalText),done(0,finalText),this}},transport,cacheURL,responseHeadersString,responseHeaders,timeoutTimer,parts,fireGlobals,i;if(deferred.promise(jqXHR).complete=completeDeferred.add,jqXHR.success=jqXHR.done,jqXHR.error=jqXHR.fail,s.url=((url||s.url||ajaxLocation)+"").replace(rhash,"").replace(rprotocol,ajaxLocParts[1]+"//"),s.type=options.method||options.type||s.method||s.type,s.dataTypes=jQuery.trim(s.dataType||"*").toLowerCase().match(rnotwhite)||[""],null==s.crossDomain&&(parts=rurl.exec(s.url.toLowerCase()),s.crossDomain=!!(parts&&(parts[1]!==ajaxLocParts[1]||parts[2]!==ajaxLocParts[2]||(parts[3]||("http:"===parts[1]?"80":"443"))!==(ajaxLocParts[3]||("http:"===ajaxLocParts[1]?"80":"443"))))),s.data&&s.processData&&"string"!=typeof s.data&&(s.data=jQuery.param(s.data,s.traditional)),inspectPrefiltersOrTransports(prefilters,s,options,jqXHR),2==state)return jqXHR;for(i in fireGlobals=s.global,fireGlobals&&0==jQuery.active++&&jQuery.event.trigger("ajaxStart"),s.type=s.type.toUpperCase(),s.hasContent=!rnoContent.test(s.type),cacheURL=s.url,s.hasContent||(s.data&&(cacheURL=s.url+=(rquery.test(cacheURL)?"&":"?")+s.data,delete s.data),!1===s.cache&&(s.url=rts.test(cacheURL)?cacheURL.replace(rts,"$1_="+nonce++):cacheURL+(rquery.test(cacheURL)?"&":"?")+"_="+nonce++)),s.ifModified&&(jQuery.lastModified[cacheURL]&&jqXHR.setRequestHeader("If-Modified-Since",jQuery.lastModified[cacheURL]),jQuery.etag[cacheURL]&&jqXHR.setRequestHeader("If-None-Match",jQuery.etag[cacheURL])),(s.data&&s.hasContent&&!1!==s.contentType||options.contentType)&&jqXHR.setRequestHeader("Content-Type",s.contentType),jqXHR.setRequestHeader("Accept",s.dataTypes[0]&&s.accepts[s.dataTypes[0]]?s.accepts[s.dataTypes[0]]+("*"===s.dataTypes[0]?"":", */*; q=0.01"):s.accepts["*"]),s.headers)jqXHR.setRequestHeader(i,s.headers[i]);if(s.beforeSend&&(!1===s.beforeSend.call(callbackContext,jqXHR,s)||2===state))return jqXHR.abort();for(i in strAbort="abort",{success:1,error:1,complete:1})jqXHR[i](s[i]);if(transport=inspectPrefiltersOrTransports(transports,s,options,jqXHR),!transport)done(-1,"No Transport");else{jqXHR.readyState=1,fireGlobals&&globalEventContext.trigger("ajaxSend",[jqXHR,s]),s.async&&0state)done(-1,e);else throw e}}return jqXHR},getJSON:function getJSON(url,data,callback){return jQuery.get(url,data,callback,"json")},getScript:function getScript(url,callback){return jQuery.get(url,void 0,callback,"script")}}),jQuery.each(["get","post"],function(i,method){jQuery[method]=function(url,data,callback,type){return jQuery.isFunction(data)&&(type=type||callback,callback=data,data=void 0),jQuery.ajax({url:url,type:method,dataType:type,data:data,success:callback})}}),jQuery.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(i,type){jQuery.fn[type]=function(fn){return this.on(type,fn)}}),jQuery._evalUrl=function(url){return jQuery.ajax({url:url,type:"GET",dataType:"script",async:!1,global:!1,throws:!0})},jQuery.fn.extend({wrapAll:function wrapAll(html){var wrap;return jQuery.isFunction(html)?this.each(function(i){jQuery(this).wrapAll(html.call(this,i))}):(this[0]&&(wrap=jQuery(html,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&wrap.insertBefore(this[0]),wrap.map(function(){for(var elem=this;elem.firstElementChild;)elem=elem.firstElementChild;return elem}).append(this)),this)},wrapInner:function wrapInner(html){return jQuery.isFunction(html)?this.each(function(i){jQuery(this).wrapInner(html.call(this,i))}):this.each(function(){var self=jQuery(this),contents=self.contents();contents.length?contents.wrapAll(html):self.append(html)})},wrap:function wrap(html){var isFunction=jQuery.isFunction(html);return this.each(function(i){jQuery(this).wrapAll(isFunction?html.call(this,i):html)})},unwrap:function unwrap(){return this.parent().each(function(){jQuery.nodeName(this,"body")||jQuery(this).replaceWith(this.childNodes)}).end()}}),jQuery.expr.filters.hidden=function(elem){return 0>=elem.offsetWidth&&0>=elem.offsetHeight},jQuery.expr.filters.visible=function(elem){return!jQuery.expr.filters.hidden(elem)};var r20=/%20/g,rbracket=/\[\]$/,rCRLF=/\r?\n/g,rsubmitterTypes=/^(?:submit|button|image|reset|file)$/i,rsubmittable=/^(?:input|select|textarea|keygen)/i;jQuery.param=function(a,traditional){var s=[],add=function add(key,value){value=jQuery.isFunction(value)?value():null==value?"":value,s[s.length]=encodeURIComponent(key)+"="+encodeURIComponent(value)},prefix;if(void 0===traditional&&(traditional=jQuery.ajaxSettings&&jQuery.ajaxSettings.traditional),jQuery.isArray(a)||a.jquery&&!jQuery.isPlainObject(a))jQuery.each(a,function(){add(this.name,this.value)});else for(prefix in a)buildParams(prefix,a[prefix],traditional,add);return s.join("&").replace(r20,"+")},jQuery.fn.extend({serialize:function serialize(){return jQuery.param(this.serializeArray())},serializeArray:function serializeArray(){return this.map(function(){var elements=jQuery.prop(this,"elements");return elements?jQuery.makeArray(elements):this}).filter(function(){var type=this.type;return this.name&&!jQuery(this).is(":disabled")&&rsubmittable.test(this.nodeName)&&!rsubmitterTypes.test(type)&&(this.checked||!rcheckableType.test(type))}).map(function(i,elem){var val=jQuery(this).val();return null==val?null:jQuery.isArray(val)?jQuery.map(val,function(val){return{name:elem.name,value:val.replace(rCRLF,"\r\n")}}):{name:elem.name,value:val.replace(rCRLF,"\r\n")}}).get()}}),jQuery.ajaxSettings.xhr=function(){try{return new XMLHttpRequest}catch(e){}};var xhrId=0,xhrCallbacks={},xhrSuccessStatus={0:200,1223:204},xhrSupported=jQuery.ajaxSettings.xhr();window.ActiveXObject&&jQuery(window).on("unload",function(){for(var key in xhrCallbacks)xhrCallbacks[key]()}),support.cors=!!xhrSupported&&"withCredentials"in xhrSupported,support.ajax=xhrSupported=!!xhrSupported,jQuery.ajaxTransport(function(options){var _callback;if(support.cors||xhrSupported&&!options.crossDomain)return{send:function send(headers,complete){var xhr=options.xhr(),id=++xhrId,i;if(xhr.open(options.type,options.url,options.async,options.username,options.password),options.xhrFields)for(i in options.xhrFields)xhr[i]=options.xhrFields[i];for(i in options.mimeType&&xhr.overrideMimeType&&xhr.overrideMimeType(options.mimeType),options.crossDomain||headers["X-Requested-With"]||(headers["X-Requested-With"]="XMLHttpRequest"),headers)xhr.setRequestHeader(i,headers[i]);_callback=function callback(type){return function(){_callback&&(delete xhrCallbacks[id],_callback=xhr.onload=xhr.onerror=null,"abort"===type?xhr.abort():"error"===type?complete(xhr.status,xhr.statusText):complete(xhrSuccessStatus[xhr.status]||xhr.status,xhr.statusText,"string"==typeof xhr.responseText?{text:xhr.responseText}:void 0,xhr.getAllResponseHeaders()))}},xhr.onload=_callback(),xhr.onerror=_callback("error"),_callback=xhrCallbacks[id]=_callback("abort");try{xhr.send(options.hasContent&&options.data||null)}catch(e){if(_callback)throw e}},abort:function abort(){_callback&&_callback()}}}),jQuery.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function textScript(text){return jQuery.globalEval(text),text}}}),jQuery.ajaxPrefilter("script",function(s){void 0===s.cache&&(s.cache=!1),s.crossDomain&&(s.type="GET")}),jQuery.ajaxTransport("script",function(s){if(s.crossDomain){var script,_callback2;return{send:function send(_,complete){script=jQuery("