2 lines
105 KiB
JavaScript
2 lines
105 KiB
JavaScript
function _toConsumableArray(arr){return _arrayWithoutHoles(arr)||_iterableToArray(arr)||_unsupportedIterableToArray(arr)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _iterableToArray(iter){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(iter))return Array.from(iter)}function _arrayWithoutHoles(arr){if(Array.isArray(arr))return _arrayLikeToArray(arr)}function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_unsupportedIterableToArray(arr,i)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(o,minLen){if(o){if("string"==typeof o)return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);return"Object"===n&&o.constructor&&(n=o.constructor.name),"Map"===n||"Set"===n?Array.from(o):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(o,minLen):void 0}}function _arrayLikeToArray(arr,len){(null==len||len>arr.length)&&(len=arr.length);for(var i=0,arr2=Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _iterableToArrayLimit(arr,i){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(arr)){var _arr=[],_n=!0,_d=!1,_e=void 0;try{for(var _s,_i=arr[Symbol.iterator]();!(_n=(_s=_i.next()).done)&&(_arr.push(_s.value),!(i&&_arr.length===i));_n=!0);}catch(err){_d=!0,_e=err}finally{try{_n||null==_i["return"]||_i["return"]()}finally{if(_d)throw _e}}return _arr}}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr}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)}(function(){'use strict';var loaderScript=document.getElementById("amd-loader"),configUrl=loaderScript.getAttribute("data-config"),bundle=loaderScript.getAttribute("data-bundle"),loadController=function(){var controllerOptions={},controllerPath=loaderScript.getAttribute("data-controller"),params=loaderScript.getAttribute("data-params");try{controllerOptions=JSON.parse(params)}catch(err){controllerOptions={}}window.require([controllerPath],function(controller){var startController=function(){window.started||(window.started=!0,controller.start(controllerOptions))};document.addEventListener("readystatechange",startController,!1),"complete"===document.readyState&&startController()})};window.require([configUrl],function(){window.loadBundles||(window.loaded={},window.loadBundles=function(bundles){bundles=bundles||[],bundles=bundles.concat(window.bundles),bundles=bundles.filter(function(item,index){return item&&bundles.indexOf(item)===index&&!0!==window.loaded[item]}),require(bundles,function(){bundles.forEach(function(item){window.loaded[item]=!0}),loadController()})}),bundle||window.bundles&&window.bundles.length?window.loadBundles([bundle]):loadController()})})(),define("loader/bootstrap",function(){}),define("taoQtiItem/qtiItem/core/qtiClasses",[],function(){'use strict';return{_container:"taoQtiItem/qtiItem/core/Container",assessmentItem:"taoQtiItem/qtiItem/core/Item",responseProcessing:"taoQtiItem/qtiItem/core/ResponseProcessing",_simpleFeedbackRule:"taoQtiItem/qtiItem/core/response/SimpleFeedbackRule",stylesheet:"taoQtiItem/qtiItem/core/Stylesheet",math:"taoQtiItem/qtiItem/core/Math",img:"taoQtiItem/qtiItem/core/Img",object:"taoQtiItem/qtiItem/core/Object",outcomeDeclaration:"taoQtiItem/qtiItem/core/variables/OutcomeDeclaration",responseDeclaration:"taoQtiItem/qtiItem/core/variables/ResponseDeclaration",rubricBlock:"taoQtiItem/qtiItem/core/RubricBlock",associableHotspot:"taoQtiItem/qtiItem/core/choices/AssociableHotspot",gap:"taoQtiItem/qtiItem/core/choices/Gap",gapImg:"taoQtiItem/qtiItem/core/choices/GapImg",gapText:"taoQtiItem/qtiItem/core/choices/GapText",hotspotChoice:"taoQtiItem/qtiItem/core/choices/HotspotChoice",hottext:"taoQtiItem/qtiItem/core/choices/Hottext",inlineChoice:"taoQtiItem/qtiItem/core/choices/InlineChoice",simpleAssociableChoice:"taoQtiItem/qtiItem/core/choices/SimpleAssociableChoice",simpleChoice:"taoQtiItem/qtiItem/core/choices/SimpleChoice",associateInteraction:"taoQtiItem/qtiItem/core/interactions/AssociateInteraction",choiceInteraction:"taoQtiItem/qtiItem/core/interactions/ChoiceInteraction",endAttemptInteraction:"taoQtiItem/qtiItem/core/interactions/EndAttemptInteraction",extendedTextInteraction:"taoQtiItem/qtiItem/core/interactions/ExtendedTextInteraction",gapMatchInteraction:"taoQtiItem/qtiItem/core/interactions/GapMatchInteraction",graphicAssociateInteraction:"taoQtiItem/qtiItem/core/interactions/GraphicAssociateInteraction",graphicGapMatchInteraction:"taoQtiItem/qtiItem/core/interactions/GraphicGapMatchInteraction",graphicOrderInteraction:"taoQtiItem/qtiItem/core/interactions/GraphicOrderInteraction",hotspotInteraction:"taoQtiItem/qtiItem/core/interactions/HotspotInteraction",hottextInteraction:"taoQtiItem/qtiItem/core/interactions/HottextInteraction",inlineChoiceInteraction:"taoQtiItem/qtiItem/core/interactions/InlineChoiceInteraction",matchInteraction:"taoQtiItem/qtiItem/core/interactions/MatchInteraction",mediaInteraction:"taoQtiItem/qtiItem/core/interactions/MediaInteraction",orderInteraction:"taoQtiItem/qtiItem/core/interactions/OrderInteraction",prompt:"taoQtiItem/qtiItem/core/interactions/Prompt",selectPointInteraction:"taoQtiItem/qtiItem/core/interactions/SelectPointInteraction",sliderInteraction:"taoQtiItem/qtiItem/core/interactions/SliderInteraction",textEntryInteraction:"taoQtiItem/qtiItem/core/interactions/TextEntryInteraction",uploadInteraction:"taoQtiItem/qtiItem/core/interactions/UploadInteraction",feedbackBlock:"taoQtiItem/qtiItem/core/feedbacks/FeedbackBlock",feedbackInline:"taoQtiItem/qtiItem/core/feedbacks/FeedbackInline",modalFeedback:"taoQtiItem/qtiItem/core/feedbacks/ModalFeedback",customInteraction:"taoQtiItem/qtiItem/core/interactions/CustomInteraction",infoControl:"taoQtiItem/qtiItem/core/PortableInfoControl",include:"taoQtiItem/qtiItem/core/Include",table:"taoQtiItem/qtiItem/core/Table",printedVariable:"taoQtiItem/qtiItem/core/PrintedVariable",_tooltip:"taoQtiItem/qtiItem/core/Tooltip"}}),define("taoQtiItem/qtiItem/helper/util",["lodash"],function(_){'use strict';_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_;return{buildSerial:function(prefix){for(var id=prefix||"",chars="abcdefghijklmnopqrstuvwxyz0123456789",i=0;22>i;i++)id+=chars.charAt(Math.floor(Math.random()*chars.length));return id},buildId:function(item,prefix){var id,usedIds,i=1,suffix="",exists=!1;if(!item)throw new TypeError("A item is required to generate a unique identifier");usedIds=item.getUsedIds();do exists=!1,id=prefix+suffix,_.contains(usedIds,id)&&(exists=!0,suffix="_"+i,i++);while(exists);return id},buildIdentifier:function(item,prefix,useSuffix){var id,usedIds,suffix="",i=1,exists=!1;if(!item)throw new TypeError("A item is required to generate a unique identifier");if(!prefix)throw new TypeError("Prefix is required to build an identifier");usedIds=item.getUsedIdentifiers(),useSuffix=!!_.isUndefined(useSuffix)||useSuffix,prefix&&(prefix=prefix.replace(/_[0-9]+$/gi,"_").replace(/[^a-zA-Z0-9_]/gi,"_").replace(/(_)+/gi,"_"),useSuffix&&(suffix="_"+i));do exists=!1,id=prefix+suffix,usedIds[id]&&(exists=!0,suffix="_"+i,i++);while(exists);return id},findInCollection:function(element,collectionNames,searchedSerial){var found=null;if(_.isString(collectionNames)&&(collectionNames=[collectionNames]),_.isArray(collectionNames))_.each(collectionNames,function(collectionName){var collection=element;_.each(collectionName.split("."),function(nameToken){collection=collection[nameToken]});var elt=collection[searchedSerial];return elt?(found={parent:element,element:elt},!1):(_.each(collection,function(elt){if(_.isFunction(elt.find)&&(found=elt.find(searchedSerial),found))return!1}),!found)&&void 0});else throw new Error("invalid argument : collectionNames must be an array or a string");return found},addMarkupNamespace:function(markup,ns){return ns?(markup=markup.replace(/<(\/)?([a-z:]+)(\s?)([^><]*)>/g,function($0,$1,$2,$3,$4){return 0<$2.indexOf(":")?$0:($1=$1||"",$3=$3||"","<"+$1+ns+":"+$2+$3+$4+">")}),markup):markup},removeMarkupNamespaces:function(markup){return markup.replace(/<(\/)?(\w*):([^>]*)>/g,"<$1$3>")},getMarkupUsedNamespaces:function(markup){var namespaces=[];return markup.replace(/<(\/)?(\w*):([^>]*)>/g,function(original,slash,ns,node){return namespaces.push(ns),"<"+slash+node+">"}),_.uniq(namespaces)}}}),define("taoQtiItem/qtiItem/helper/rendererConfig",["lodash","jquery"],function(_,$){'use strict';_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,$=$&&Object.prototype.hasOwnProperty.call($,"default")?$["default"]:$;return{getOptionsFromArguments:function(args){var options={data:{},placeholder:null,subclass:"",renderer:null};return _.each(args,function(arg){arg&&(arg.isRenderer?options.renderer=arg:arg instanceof $&&arg.length?options.placeholder=arg:_.isString(arg)?options.subclass=arg:_.isPlainObject(arg)?options.data=arg:console.log("invalid arg",arg,args))}),options}}}),define("taoQtiItem/qtiItem/core/Element",["jquery","lodash","class","core/logger","taoQtiItem/qtiItem/helper/util","taoQtiItem/qtiItem/helper/rendererConfig"],function($,_,_class,loggerFactory,util,rendererConfig){'use strict';$=$&&Object.prototype.hasOwnProperty.call($,"default")?$["default"]:$,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,loggerFactory=loggerFactory&&Object.prototype.hasOwnProperty.call(loggerFactory,"default")?loggerFactory["default"]:loggerFactory,util=util&&Object.prototype.hasOwnProperty.call(util,"default")?util["default"]:util,rendererConfig=rendererConfig&&Object.prototype.hasOwnProperty.call(rendererConfig,"default")?rendererConfig["default"]:rendererConfig;var _instances={},logger=loggerFactory("taoQtiItem/qtiItem/core/Element"),Element=Class.extend({qtiClass:"",serial:"",rootElement:null,init:function init(serial,attributes){if(this.attributes={},this.metaData={},"object"===_typeof(serial)&&(attributes=serial,serial=""),serial||(serial=util.buildSerial(this.qtiClass+"_")),serial&&("string"!=typeof serial||!serial.match(/^[a-z_0-9]*$/i)))throw"invalid QTI serial : ("+_typeof(serial)+") "+serial;if(!_instances[serial])_instances[serial]=this,this.serial=serial,this.setAttributes(attributes||{});else throw"a QTI Element with the same serial already exists "+serial;"function"==typeof this.initContainer&&this.initContainer(arguments[2]||""),"function"==typeof this.initObject&&this.initObject()},is:function is(qtiClass){return qtiClass===this.qtiClass},placeholder:function placeholder(){return"{{"+this.serial+"}}"},getSerial:function getSerial(){return this.serial},getUsedIdentifiers:function getUsedIdentifiers(){var usedIds={},elts=this.getComposingElements();for(var i in elts){var elt=elts[i],id=elt.attr("identifier");id&&(usedIds[id]=elt)}return usedIds},getUsedIds:function(){var usedIds=[];return _.forEach(this.getComposingElements(),function(elt){var id=elt.attr("id");id&&!_.contains(usedIds,id)&&usedIds.push(id)}),usedIds},attr:function attr(name,value){if(name)if(void 0!==value)this.attributes[name]=value;else if("object"===_typeof(name))for(var prop in name)this.attr(prop,name[prop]);else if("string"==typeof name)return void 0===this.attributes[name]?void 0:this.attributes[name];return this},data:function data(name,value){if(name)if(void 0!==value)this.metaData[name]=value,$(document).trigger("metaChange.qti-widget",{element:this,key:name,value:value});else if("object"===_typeof(name))for(var prop in name)this.data(prop,name[prop]);else if("string"==typeof name)return void 0===this.metaData[name]?void 0:this.metaData[name];return this},removeData:function removeData(name){return delete this.metaData[name],this},removeAttr:function removeAttr(name){return this.removeAttributes(name)},setAttributes:function setAttributes(attributes){return _.isPlainObject(attributes)||logger.warn("attributes should be a plain object"),this.attributes=attributes,this},getAttributes:function getAttributes(){return _.clone(this.attributes)},removeAttributes:function removeAttributes(attrNames){for(var i in"string"==typeof attrNames&&(attrNames=[attrNames]),attrNames)delete this.attributes[attrNames[i]];return this},getComposingElements:function getComposingElements(){function append(element){elts[element.getSerial()]=element,elts=_.extend(elts,element.getComposingElements())}var elts={};return"function"==typeof this.initContainer&&append(this.getBody()),"function"==typeof this.initObject&&append(this.getObject()),_.each(this.metaData,function(v){Element.isA(v,"_container")?append(v):_.isArray(v)&&_.each(v,function(v){Element.isA(v,"_container")&&append(v)})}),elts},getUsedClasses:function getUsedClasses(){var ret=[this.qtiClass],composingElts=this.getComposingElements();return _.each(composingElts,function(elt){ret.push(elt.qtiClass)}),_.uniq(ret)},find:function find(serial){var object,body,found=null;return"function"==typeof this.initObject&&(object=this.getObject(),object.serial===serial&&(found={parent:this,element:object,location:"object"})),found||"function"!=typeof this.initContainer||(body=this.getBody(),found=body.serial===serial?{parent:this,element:body,location:"body"}:this.getBody().find(serial,this)),found},parent:function parent(){var item=this.getRootElement();if(item){var found=item.find(this.getSerial());if(found)return found.parent}return null},setRelatedItem:function setRelatedItem(item){logger.warn("Deprecated use of setRelatedItem()"),this.setRootElement(item)},setRootElement:function setRootElement(item){var composingElts,i;if(Element.isA(item,"assessmentItem"))for(i in this.rootElement=item,composingElts=this.getComposingElements(),composingElts)composingElts[i].setRootElement(item)},getRelatedItem:function getRelatedItem(){return logger.warn("Deprecated use of getRelatedItem()"),this.getRootElement()},getRootElement:function getRootElement(){var ret=null;return Element.isA(this.rootElement,"assessmentItem")&&(ret=this.rootElement),ret},setRenderer:function setRenderer(renderer){if(renderer&&renderer.isRenderer){this.renderer=renderer;var elts=this.getComposingElements();for(var serial in elts)elts[serial].setRenderer(renderer)}else throw"invalid qti rendering engine"},getRenderer:function getRenderer(){return this.renderer},render:function(){var rendering,args=rendererConfig.getOptionsFromArguments(arguments),_renderer=args.renderer||this.getRenderer(),tplData={},defaultData={tag:this.qtiClass,serial:this.serial,attributes:this.getAttributes()};if(!_renderer)throw new Error("render: no renderer found for the element "+this.qtiClass+":"+this.serial);return"function"==typeof this.initContainer&&(defaultData.body=this.getBody().render(args.renderer)),"function"==typeof this.initObject&&(defaultData.object={attributes:this.object.getAttributes()},defaultData.object.attributes.data=_renderer.resolveUrl(this.object.attr("data"))),tplData=_.merge(defaultData,args.data||{}),tplData=_renderer.getData(this,tplData,args.subclass),rendering=_renderer.renderTpl(this,tplData,args.subclass),args.placeholder&&args.placeholder.replaceWith(rendering),rendering},postRender:function postRender(data,altClassName,renderer){var postRenderers=[],_renderer=renderer||this.getRenderer();if("function"==typeof this.initContainer&&(postRenderers=this.getBody().postRender(data,"",renderer)),_renderer)postRenderers.push(_renderer.postRender(this,data,altClassName));else throw"postRender: no renderer found for the element "+this.qtiClass+":"+this.serial;return _.compact(postRenderers)},getContainer:function getContainer($scope,subclass){var renderer=this.getRenderer();if(renderer)return renderer.getContainer(this,$scope,subclass);throw"getContainer: no renderer found for the element "+this.qtiClass+":"+this.serial},toArray:function toArray(){var arr={serial:this.serial,type:this.qtiClass,attributes:this.getAttributes()};return"function"==typeof this.initContainer&&(arr.body=this.getBody().toArray()),"function"==typeof this.initObject&&(arr.object=this.object.toArray()),arr},isEmpty:function isEmpty(){return!1},addClass:function addClass(className){var clazz=this.attr("class")||"";_containClass(clazz,className)||this.attr("class",clazz+(clazz.length?" ":"")+className)},hasClass:function hasClass(className){return _containClass(this.attr("class"),className)},removeClass:function removeClass(className){var clazz=this.attr("class")||"";if(clazz){var regex=new RegExp("(?:^|\\s)"+className+"(?:\\s|$)");clazz=clazz.replace(regex," ").trim(),clazz?this.attr("class",clazz):this.removeAttr("class")}},toggleClass:function toggleClass(className,state){return"boolean"==typeof state?state?this.addClass(className):this.removeClass(className):this.hasClass(className)?this.removeClass(className):this.addClass(className)},isset:function isset(){return Element.issetElement(this.serial)},unset:function unset(){return Element.unsetElement(this.serial)}}),_containClass=function(allClassStr,className){var regex=new RegExp("(?:^|\\s)"+className+"(?:\\s|$)","");return allClassStr&®ex.test(allClassStr)};return Element.isA=function(qtiElement,qtiClass){return qtiElement instanceof Element&&qtiElement.is(qtiClass)},Element.getElementBySerial=function(serial){return _instances[serial]},Element.issetElement=function(serial){return!!_instances[serial]},Element.unsetElement=function(serial){var element=Element.getElementBySerial(serial);if(element){var composingElements=element.getComposingElements();return _.each(composingElements,function(elt){delete _instances[elt.serial]}),delete _instances[element.serial],!0}return!1},Element}),define("taoQtiItem/qtiItem/helper/xmlNsHandler",[],function(){'use strict';function getPrefix(namespaces,html5Ns){for(var key in namespaces)if(namespaces[key]===html5Ns)return key;return"qh5"}return{stripNs:function(body){return body.replace(/(<([\w]+)\:(article|aside|bdi|figure|footer|header|nav|rb|rp|rt|rtc|ruby|section))/gi,"<$3").replace(/(<\/([\w]+)\:(article|aside|bdi|figure|footer|header|nav|rb|rp|rt|rtc|ruby|section)>)/gi,"</$3>")},restoreNs:function(xml,namespaces){var tagMatch,xmlMatch=xml.match(/(<(article|aside|bdi|figure|footer|header|nav|rb|rp|rt|rtc|ruby|section)[^>]*>|<\/(article|aside|bdi|figure|footer|header|nav|rb|rp|rt|rtc|ruby|section)>)/gi),imsXsd="http://www.imsglobal.org/xsd",html5Ns=imsXsd+"/imsqtiv2p2_html5_v1p0",prefix=getPrefix(namespaces,html5Ns),prefixAtt="xmlns:"+prefix+"=\""+html5Ns+"\"",i=xmlMatch?xmlMatch.length:0;if(!xmlMatch)return xml;for(;i--;)tagMatch=xmlMatch[i].match(/((<)(article|aside|bdi|figure|footer|header|nav|rb|rp|rt|rtc|ruby|section)([^>]*)(>)|(<\/)(article|aside|bdi|figure|footer|header|nav|rb|rp|rt|rtc|ruby|section)(>))/i),xml=xml.replace(xmlMatch[i],tagMatch[5]?"<"+prefix+":"+tagMatch[3]+tagMatch[4]+">":"</"+prefix+":"+tagMatch[7]+">");return xmlMatch.length&&-1===xml.indexOf(prefixAtt)&&(xml=xml.replace("<assessmentItem","<assessmentItem "+prefixAtt)),xml=xml.replace("xmlns=\""+imsXsd+"/imsqti_v2p1\"","xmlns=\""+imsXsd+"/imsqti_v2p2\""),xml=xml.replace("xsi:schemaLocation=\""+imsXsd+"/imsqti_v2p1 imsqti_v2p1.xsd\"","xsi:schemaLocation=\""+imsXsd+"/imsqti_v2p2 "+imsXsd+"/qti/qtiv2p2/imsqti_v2p2.xsd\""),xml}}}),define("taoQtiItem/qtiItem/helper/responseRules",[],function(){'use strict';return{MATCH_CORRECT:function MATCH_CORRECT(responseIdentifier,outcomeIdentifier){return{qtiClass:"responseCondition",responseIf:{qtiClass:"responseIf",expression:{qtiClass:"match",expressions:[{qtiClass:"variable",attributes:{identifier:responseIdentifier}},{qtiClass:"correct",attributes:{identifier:responseIdentifier}}]},responseRules:[{qtiClass:"setOutcomeValue",attributes:{identifier:outcomeIdentifier},expression:{qtiClass:"sum",expressions:[{qtiClass:"variable",attributes:{identifier:outcomeIdentifier}},{qtiClass:"baseValue",attributes:{baseType:"integer"},value:"1"}]}}]}}},MAP_RESPONSE:function MAP_RESPONSE(responseIdentifier,outcomeIdentifier){return{qtiClass:"responseCondition",responseIf:{qtiClass:"responseIf",expression:{qtiClass:"not",expressions:[{qtiClass:"isNull",expressions:[{qtiClass:"variable",attributes:{identifier:responseIdentifier}}]}]},responseRules:[{qtiClass:"setOutcomeValue",attributes:{identifier:outcomeIdentifier},expression:{qtiClass:"sum",expressions:[{qtiClass:"variable",attributes:{identifier:outcomeIdentifier}},{qtiClass:"mapResponse",attributes:{identifier:responseIdentifier}}]}}]}}},MAP_RESPONSE_POINT:function MAP_RESPONSE_POINT(responseIdentifier,outcomeIdentifier){return{qtiClass:"responseCondition",responseIf:{qtiClass:"responseIf",expression:{qtiClass:"not",expressions:[{qtiClass:"isNull",expressions:[{qtiClass:"variable",attributes:{identifier:responseIdentifier}}]}]},responseRules:[{qtiClass:"setOutcomeValue",attributes:{identifier:outcomeIdentifier},expression:{qtiClass:"sum",expressions:[{qtiClass:"variable",attributes:{identifier:outcomeIdentifier}},{qtiClass:"mapResponsePoint",attributes:{identifier:responseIdentifier}}]}}]}}}}}),define("taoQtiItem/qtiItem/helper/response",["lodash","taoQtiItem/qtiItem/helper/responseRules"],function(_,responseRulesHelper){'use strict';_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,responseRulesHelper=responseRulesHelper&&Object.prototype.hasOwnProperty.call(responseRulesHelper,"default")?responseRulesHelper["default"]:responseRulesHelper;var _templateNames={MATCH_CORRECT:"http://www.imsglobal.org/question/qti_v2p1/rptemplates/match_correct",MAP_RESPONSE:"http://www.imsglobal.org/question/qti_v2p1/rptemplates/map_response",MAP_RESPONSE_POINT:"http://www.imsglobal.org/question/qti_v2p1/rptemplates/map_response_point",NONE:"no_response_processing"};return{isUsingTemplate:function isUsingTemplate(response,tpl){return!!(_.isString(tpl)&&(tpl===response.template||_templateNames[tpl]===response.template))},isValidTemplateName:function isValidTemplateName(tplName){return!!this.getTemplateUriFromName(tplName)},getTemplateUriFromName:function getTemplateUriFromName(tplName){return _templateNames[tplName]||""},getTemplateNameFromUri:function getTemplateNameFromUri(tplUri){var tplName="";return _.forIn(_templateNames,function(uri,name){if(uri===tplUri)return tplName=name,!1}),tplName},getTemplateNameFromResponseRules:function getTemplateNameFromResponseRules(responseIdentifier,responseRules){if(!responseRules)return"NONE";var _responseRules$respon=responseRules.responseIf;_responseRules$respon=void 0===_responseRules$respon?{}:_responseRules$respon;var _responseRules$respon2=_responseRules$respon.responseRules;_responseRules$respon2=void 0===_responseRules$respon2?[]:_responseRules$respon2;var _responseRules$respon3=_slicedToArray(_responseRules$respon2,1),_responseRules$respon4=_responseRules$respon3[0],outcomeRules=void 0===_responseRules$respon4?{}:_responseRules$respon4,_outcomeRules$attribu=outcomeRules.attributes;_outcomeRules$attribu=void 0===_outcomeRules$attribu?{}:_outcomeRules$attribu;var outcomeIdentifier=_outcomeRules$attribu.identifier;return outcomeIdentifier?Object.keys(responseRulesHelper).find(function(key){return _.isEqual(responseRules,responseRulesHelper[key](responseIdentifier,outcomeIdentifier))}):""}}}),define("taoQtiItem/qtiItem/helper/itemScore",[],function(){'use strict';return function itemScore(responseIdentifiers){var outcomeExpressions=responseIdentifiers.map(function(outcomeIdentifier){return{qtiClass:"variable",attributes:{identifier:"SCORE_".concat(outcomeIdentifier)}}});return{qtiClass:"setOutcomeValue",attributes:{identifier:"SCORE"},expression:{qtiClass:"sum",expressions:outcomeExpressions}}}}),define("taoQtiItem/qtiItem/core/Loader",["lodash","class","taoQtiItem/qtiItem/core/qtiClasses","taoQtiItem/qtiItem/core/Element","taoQtiItem/qtiItem/helper/xmlNsHandler","core/moduleLoader","taoQtiItem/qtiItem/helper/response","taoQtiItem/qtiItem/helper/itemScore"],function(_,_class,qtiClasses,Element,xmlNsHandler,moduleLoader,responseHelper,itemScoreHelper){'use strict';_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,qtiClasses=qtiClasses&&Object.prototype.hasOwnProperty.call(qtiClasses,"default")?qtiClasses["default"]:qtiClasses,Element=Element&&Object.prototype.hasOwnProperty.call(Element,"default")?Element["default"]:Element,xmlNsHandler=xmlNsHandler&&Object.prototype.hasOwnProperty.call(xmlNsHandler,"default")?xmlNsHandler["default"]:xmlNsHandler,moduleLoader=moduleLoader&&Object.prototype.hasOwnProperty.call(moduleLoader,"default")?moduleLoader["default"]:moduleLoader,responseHelper=responseHelper&&Object.prototype.hasOwnProperty.call(responseHelper,"default")?responseHelper["default"]:responseHelper,itemScoreHelper=itemScoreHelper&&Object.prototype.hasOwnProperty.call(itemScoreHelper,"default")?itemScoreHelper["default"]:itemScoreHelper;var loadPortableCustomElementProperties=function(portableElement,rawProperties){var properties={};_.forOwn(rawProperties,function(value,key){try{properties[key]=JSON.parse(value)}catch(e){properties[key]=value}}),portableElement.properties=properties},loadPortableCustomElementData=function(portableElement,data){portableElement.typeIdentifier=data.typeIdentifier,portableElement.markup=data.markup,portableElement.entryPoint=data.entryPoint,portableElement.libraries=data.libraries,portableElement.setNamespace("",data.xmlns),loadPortableCustomElementProperties(portableElement,data.properties)},Loader=Class.extend({init:function init(item,classesLocation){this.qti={},this.classesLocation={},this.item=item||null,this.setClassesLocation(classesLocation||qtiClasses)},setClassesLocation:function setClassesLocation(qtiClassesList){return _.extend(this.classesLocation,qtiClassesList),this},getRequiredClasses:function getRequiredClasses(data){var ret=[];for(var i in data)"qtiClass"==i&&"_container"!==data[i]&&"rootElement"!==i?ret.push(data[i]):"object"===_typeof(data[i])&&"responseRules"!==i&&(ret=_.union(ret,this.getRequiredClasses(data[i])));return ret},loadRequiredClasses:function loadRequiredClasses(data,callback,reload){var requiredClass,_this2=this,requiredClasses=this.getRequiredClasses(data,reload),required=[];for(var i in requiredClasses)if(requiredClass=requiredClasses[i],this.classesLocation[requiredClass])required.push({module:this.classesLocation[requiredClass],category:"qti"});else throw new Error("missing qti class location declaration : ".concat(requiredClass));moduleLoader([],function(){return!0}).addList(required).load().then(function(loadeded){loadeded.forEach(function(QtiClass){_this2.qti[QtiClass.prototype.qtiClass]=QtiClass}),callback.call(_this2,_this2.qti)})},getLoadedClasses:function getLoadedClasses(){return _.keys(this.qti)},loadItemData:function loadItemData(data,callback){var _this3=this;this.loadRequiredClasses(data,function(Qti){"object"===_typeof(data)&&"assessmentItem"===data.qtiClass&&function(){for(var i in data.serial&&Element.unsetElement(data.serial),_this3.item=new Qti.assessmentItem(data.serial,data.attributes||{}),_this3.loadContainer(_this3.item.getBody(),data.body),data.outcomes){var outcome=_this3.buildOutcome(data.outcomes[i]);outcome&&_this3.item.addOutcomeDeclaration(outcome)}for(var _i2 in data.feedbacks){var feedback=_this3.buildElement(data.feedbacks[_i2]);feedback&&_this3.item.addModalFeedback(feedback)}for(var _i3 in data.stylesheets){var stylesheet=_this3.buildElement(data.stylesheets[_i3]);stylesheet&&_this3.item.addStylesheet(stylesheet)}var responseRules=data.responseProcessing&&data.responseProcessing.responseRules?_toConsumableArray(data.responseProcessing.responseRules):[],_loop=function(_i4){var responseIdentifier=data.responses[_i4].identifier,responseRuleItemIndex=responseRules.findIndex(function(_ref){var _ref$responseIf=_ref.responseIf;_ref$responseIf=void 0===_ref$responseIf?{}:_ref$responseIf;var _ref$responseIf$expre=_ref$responseIf.expression;_ref$responseIf$expre=void 0===_ref$responseIf$expre?{}:_ref$responseIf$expre;var _ref$responseIf$expre2=_ref$responseIf$expre.expressions;_ref$responseIf$expre2=void 0===_ref$responseIf$expre2?[]:_ref$responseIf$expre2;var _ref$responseIf$expre3=_slicedToArray(_ref$responseIf$expre2,1),_ref$responseIf$expre4=_ref$responseIf$expre3[0],expression=void 0===_ref$responseIf$expre4?{}:_ref$responseIf$expre4;return expression.attributes&&expression.attributes.identifier===responseIdentifier||expression.expressions&&expression.expressions[0]&&expression.expressions[0].attributes&&expression.expressions[0].attributes.identifier===responseIdentifier}),_ref2=-1===responseRuleItemIndex?[]:responseRules.splice(responseRuleItemIndex,1),_ref3=_slicedToArray(_ref2,1),responseRule=_ref3[0],response=_this3.buildResponse(data.responses[_i4],responseRule);if(response){_this3.item.addResponseDeclaration(response);var feedbackRules=data.responses[_i4].feedbackRules;feedbackRules&&_.forIn(feedbackRules,function(fbData,serial){var _ref4=data.outcomes[fbData.feedbackOutcome]||{},_ref4$attributes=_ref4.attributes;_ref4$attributes=void 0===_ref4$attributes?{}:_ref4$attributes;var feedbackOutcomeIdentifier=_ref4$attributes.identifier;response.feedbackRules[serial]=_this3.buildSimpleFeedbackRule(fbData,response);var feedbackResponseRuleIndex=responseRules.findIndex(function(_ref5){var _ref5$responseIf=_ref5.responseIf;_ref5$responseIf=void 0===_ref5$responseIf?{}:_ref5$responseIf;var _ref5$responseIf$resp=_ref5$responseIf.responseRules;_ref5$responseIf$resp=void 0===_ref5$responseIf$resp?[]:_ref5$responseIf$resp;var _ref5$responseIf$resp2=_slicedToArray(_ref5$responseIf$resp,1),_ref5$responseIf$resp3=_ref5$responseIf$resp2[0],setOutcomeResponseRule=void 0===_ref5$responseIf$resp3?{}:_ref5$responseIf$resp3,_setOutcomeResponseRu=setOutcomeResponseRule.attributes,attributes=void 0===_setOutcomeResponseRu?{}:_setOutcomeResponseRu,qtiClass=setOutcomeResponseRule.qtiClass,outcomeIdentifier=attributes.identifier;return feedbackOutcomeIdentifier===outcomeIdentifier&&"setOutcomeValue"===qtiClass});-1!==feedbackResponseRuleIndex&&responseRules.splice(feedbackResponseRuleIndex,1)})}};for(var _i4 in data.responses)_loop(_i4);var responseIdentifiers=Object.keys(_this3.item.responses||{}).map(function(responseKey){return _this3.item.responses[responseKey].attributes.identifier});if(data.responseProcessing){var customResponseProcessing=0<responseRules.length&&!(1===responseRules.length&&_.isEqual(responseRules[0],itemScoreHelper(responseIdentifiers)))||_this3.item.responses&&Object.keys(_this3.item.responses).some(function(responseKey){return!_this3.item.responses[responseKey].template});_this3.item.setResponseProcessing(_this3.buildResponseProcessing(data.responseProcessing,customResponseProcessing))}_this3.item.setNamespaces(data.namespaces),_this3.item.setSchemaLocations(data.schemaLocations),_this3.item.setApipAccessibility(data.apipAccessibility)}(),"function"==typeof callback&&callback.call(_this3,_this3.item)})},loadAndBuildElement:function loadAndBuildElement(data,callback){var _this4=this;this.loadRequiredClasses(data,function(){var element=_this4.buildElement(data);"function"==typeof callback&&callback.call(_this4,element)})},loadElement:function loadElement(element,data,callback){var _this5=this;this.loadRequiredClasses(data,function(){_this5.loadElementData(element,data),"function"==typeof callback&&callback.call(_this5,element)})},loadElements:function loadElements(data,callback){var _this6=this;if(!this.item)throw new Error("QtiLoader : cannot load elements in empty item");this.loadRequiredClasses(data,function(){var allElements=_this6.item.getComposingElements();for(var i in data){var elementData=data[i];elementData&&elementData.qtiClass&&elementData.serial&&allElements[elementData.serial]&&_this6.loadElementData(allElements[elementData.serial],elementData)}"function"==typeof callback&&callback.call(_this6,_this6.item)})},buildResponse:function buildResponse(data,responseRule){var response=this.buildElement(data);return response.template=responseHelper.getTemplateUriFromName(responseHelper.getTemplateNameFromResponseRules(data.identifier,responseRule))||data.howMatch||null,response.defaultValue=data.defaultValue||null,response.correctResponse=data.correctResponses||null,response.mapEntries=_.size(data.mapping)?data.mapping:_.size(data.areaMapping)?data.areaMapping:{},response.mappingAttributes=data.mappingAttributes||{},response},buildSimpleFeedbackRule:function buildSimpleFeedbackRule(data,response){var feedbackRule=this.buildElement(data);feedbackRule.setCondition(response,data.condition,data.comparedValue||null),feedbackRule.feedbackOutcome=this.item.outcomes[data.feedbackOutcome]||null,feedbackRule.feedbackThen=this.item.modalFeedbacks[data.feedbackThen]||null,feedbackRule.feedbackElse=this.item.modalFeedbacks[data.feedbackElse]||null;var comparedOutcome=feedbackRule.comparedOutcome;return feedbackRule.feedbackThen&&feedbackRule.feedbackThen.data("relatedResponse",comparedOutcome),feedbackRule.feedbackElse&&feedbackRule.feedbackElse.data("relatedResponse",comparedOutcome),feedbackRule},buildOutcome:function buildOutcome(data){var outcome=this.buildElement(data);return outcome.defaultValue=data.defaultValue||null,outcome},buildResponseProcessing:function buildResponseProcessing(data,customResponseProcessing){var rp=this.buildElement(data);return customResponseProcessing?(rp.xml=data.data,rp.processingType="custom"):rp.processingType="templateDriven",rp},loadContainer:function loadContainer(bodyObject,bodyData){if(!Element.isA(bodyObject,"_container"))throw new Error("bodyObject must be a QTI Container");if(!(bodyData&&"string"==typeof bodyData.body&&"object"===_typeof(bodyData.elements)))throw new Error("wrong bodydata format");for(var serial in bodyData.elements){var eltData=bodyData.elements[serial],element=this.buildElement(eltData);element&&bodyObject.setElement(element,bodyData.body)}bodyObject.body(xmlNsHandler.stripNs(bodyData.body))},buildElement:function buildElement(elementData){if(!(elementData&&elementData.qtiClass&&elementData.serial))throw new Error("wrong elementData format");var className=elementData.qtiClass;if(!this.qti[className])throw new Error("the qti element class does not exist: ".concat(className));var elt=new this.qti[className](elementData.serial);return this.loadElementData(elt,elementData),elt},loadElementData:function loadElementData(element,data){var attributes=_.defaults(data.attributes||{},element.attributes||{});return element.setAttributes(attributes),element.body&&data.body&&element.bdy&&this.loadContainer(element.getBody(),data.body),element.object&&data.object&&element.object&&this.loadObjectData(element.object,data.object),Element.isA(element,"interaction")?this.loadInteractionData(element,data):Element.isA(element,"choice")?this.loadChoiceData(element,data):Element.isA(element,"math")?this.loadMathData(element,data):Element.isA(element,"infoControl")?this.loadPicData(element,data):Element.isA(element,"_tooltip")&&this.loadTooltipData(element,data),element},loadInteractionData:function loadInteractionData(interaction,data){Element.isA(interaction,"blockInteraction")&&data.prompt&&this.loadContainer(interaction.prompt.getBody(),data.prompt),this.buildInteractionChoices(interaction,data),Element.isA(interaction,"customInteraction")&&this.loadPciData(interaction,data)},buildInteractionChoices:function buildInteractionChoices(interaction,data){if(data.choices){if(Element.isA(interaction,"matchInteraction"))for(var set=0;2>set;set++){if(!data.choices[set])throw new Error("missing match set #".concat(set));var matchSet=data.choices[set];for(var serial in matchSet){var choice=this.buildElement(matchSet[serial]);choice&&interaction.addChoice(choice,set)}}else for(var _serial in data.choices){var _choice=this.buildElement(data.choices[_serial]);_choice&&interaction.addChoice(_choice)}if(Element.isA(interaction,"graphicGapMatchInteraction")&&data.gapImgs)for(var _serial2 in data.gapImgs){var gapImg=this.buildElement(data.gapImgs[_serial2]);gapImg&&interaction.addGapImg(gapImg)}}},loadChoiceData:function loadChoiceData(choice,data){if(Element.isA(choice,"textVariableChoice"))choice.val(data.text);else if(Element.isA(choice,"gapImg"));else if(Element.isA(choice,"gapText"))choice.body()||choice.body(data.text);else if(Element.isA(choice,"containerChoice"));},loadObjectData:function loadObjectData(object,data){object.setAttributes(data.attributes),data._alt&&("object"===data._alt.qtiClass?object._alt=Loader.buildElement(data._alt):object._alt=data._alt)},loadMathData:function loadMathData(math,data){math.ns=data.ns||{},math.setMathML(data.mathML||""),_.forIn(data.annotations||{},function(value,encoding){math.setAnnotation(encoding,value)})},loadTooltipData:function loadTooltipData(tooltip,data){tooltip.content(data.content)},loadPciData:function loadPciData(pci,data){loadPortableCustomElementData(pci,data)},loadPicData:function loadPicData(pic,data){loadPortableCustomElementData(pic,data)}});return Loader}),define("taoQtiItem/qtiItem/helper/pci",["lodash"],function(_){'use strict';_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_;return{getRawValues:function getRawValues(pciVar){if(_.isPlainObject(pciVar)){if(pciVar.base!==void 0)return _.values(pciVar.base);if(pciVar.list)return _.values(pciVar.list)}throw"unsupported type "}}}),define("taoQtiItem/qtiItem/helper/container",["lodash","jquery"],function(_,$){'use strict';function _checkContainerType(element){if(_.isFunction(element.initContainer)&&_.isFunction(element.body))return!0;throw"the element is not of a container type"}function _getBodyDom(element){if(_checkContainerType(element))return $("<div>").html(element.body()).find(".x-tao-wrapper")}function _setBodyDomClass(element,newClass,oldClass){if(_checkContainerType(element)&&(oldClass||newClass)){var $wrapper=$("<div>").html(element.body());_setDomClass($wrapper,newClass,oldClass),element.body($wrapper.html())}}function _setDomClass($wrapper,newClass,oldClass){var $bodyDom=$wrapper.find(".x-tao-wrapper");$bodyDom.length||($wrapper.wrapInner("<div class=\"x-tao-wrapper\">"),$bodyDom=$wrapper.find(".x-tao-wrapper")),oldClass&&$bodyDom.removeClass(oldClass),newClass&&$bodyDom.addClass(newClass)}function _getEncodedDataString(dataName,value){return dataName&&value?"x-tao-"+dataName+"-"+value:""}function getEncodedData(element,dataName){var regex,matches,$body=_getBodyDom(element);if(dataName&&$body&&$body.length&&$body.attr("class")&&(regex=new RegExp("x-tao-"+dataName+"-([a-zA-Z0-9-._]*)"),matches=$body.attr("class").match(regex),matches))return matches[1]}_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,$=$&&Object.prototype.hasOwnProperty.call($,"default")?$["default"]:$;return{setEncodedData:function(element,dataName,newValue){var oldValue=getEncodedData(element,dataName);return _setBodyDomClass(element,_getEncodedDataString(dataName,newValue),_getEncodedDataString(dataName,oldValue))},hasEncodedData:function(element,dataName,value){var $body=_getBodyDom(element);return!!($body&&$body.length&&dataName&&value)&&$body.hasClass(_getEncodedDataString(dataName,value))},getEncodedData:getEncodedData,removeEncodedData:function(element,dataName){var oldValue=getEncodedData(element,dataName);dataName&&oldValue&&_setBodyDomClass(element,"",_getEncodedDataString(dataName,oldValue))},setEncodedDataToDom:function($wrapper,dataName,newValue,oldValue){_setDomClass($wrapper,_getEncodedDataString(dataName,newValue),_getEncodedDataString(dataName,oldValue))}}}),define("taoQtiItem/qtiRunner/modalFeedback/inlineRenderer",["lodash","jquery","context","taoQtiItem/qtiItem/helper/pci","taoQtiItem/qtiItem/helper/container","handlebars","i18n","lib/dompurify/purify","iframeNotifier"],function(_,$$1,context,pci,containerHelper,Handlebars,__,DOMPurify,iframeNotifier){'use strict';function previewOkBtn(data,options,asString){var html=Template(data,options);return asString||!0?html:$(html)}function deliveryOkBtn(data,options,asString){var html=Template$1(data,options);return asString||!0?html:$(html)}function showFeedbacks(item,loader,renderer,itemSession,onCloseCallback,onShowCallback){var firstFeedback,interactionsDisplayInfo=getInteractionsDisplayInfo(item),messages={},renderedFeebacks=[],renderingQueue=[],$itemContainer=item.getContainer(),$itemBody=$itemContainer.children(".qti-itemBody");return _.each(item.modalFeedbacks,function(feedback){var feedbackIds,message,$container,comparedOutcome,_currentMessageGroupId,interactionInfo,outcomeIdentifier=feedback.attr("outcomeIdentifier"),order=-1;if(itemSession[outcomeIdentifier]){if(feedbackIds=pci.getRawValues(itemSession[outcomeIdentifier]),-1===_.indexOf(feedbackIds,feedback.id()))return!0;if(message=getFeedbackMessageSignature(feedback),comparedOutcome=containerHelper.getEncodedData(feedback,"relatedOutcome"),interactionInfo=_.find(interactionsDisplayInfo,{responseIdentifier:comparedOutcome}),comparedOutcome&&interactionInfo?($container=interactionInfo.displayContainer,_currentMessageGroupId=interactionInfo.messageGroupId,order=interactionInfo.order):($container=$itemBody,_currentMessageGroupId="__item__"),messages[_currentMessageGroupId]||(messages[_currentMessageGroupId]=[]),0<=_.indexOf(messages[_currentMessageGroupId],message))return!0;messages[_currentMessageGroupId].push(message),renderingQueue.push({feedback:feedback,$container:$container,order:order})}}),renderingQueue.length&&(renderingQueue=_.sortBy(renderingQueue,"order"),clearModalFeedbacks($itemContainer),_.each(renderingQueue,function(renderingToken){renderModalFeedback(renderingToken.feedback,loader,renderer,renderingToken.$container,$itemContainer,function(renderingData){firstFeedback||(firstFeedback=$$1(renderingData.dom)),$$1("img",renderingData.dom).on("load",function(){iframeNotifier.parent("itemcontentchange")}),renderedFeebacks.push(renderingData),renderedFeebacks.length===renderingQueue.length&&(iframeNotifier.parent("itemcontentchange"),firstFeedback&&autoscroll(firstFeedback),_.isFunction(onShowCallback)&&onShowCallback())})}),replaceControl(renderedFeebacks,$itemContainer,onCloseCallback)),renderingQueue.length}function getQtiContainer(){for(var me=window,$container=null,max=10;me&&me.__knownParent__&&max--;)if(me=me.parent,me&&me.$&&($container=me.$("#qti-content"),$container.length))return $container;return null}function autoscroll(element){var currentScrollTop,minScrollTop,maxScrollTop,scrollTop,$element=$$1(element),$container=getQtiContainer();$element.length&&$container&&(currentScrollTop=$container.scrollTop(),maxScrollTop=$element.offset().top,minScrollTop=maxScrollTop-$container.height()+$element.outerHeight(),scrollTop=Math.max(Math.min(maxScrollTop,currentScrollTop),minScrollTop),scrollTop!==currentScrollTop&&$container.animate({scrollTop:scrollTop}))}function extractDisplayInfo(interaction){var messageGroupId,$displayContainer,$interactionContainer=interaction.getContainer(),responseIdentifier=interaction.attr("responseIdentifier");return interaction.is("inlineInteraction")?($displayContainer=$interactionContainer.closest("[class*=\" col-\"], [class^=\"col-\"]"),messageGroupId=$displayContainer.attr("data-messageGroupId"),!messageGroupId&&(messageGroupId=_.uniqueId("inline_message_group_"),$displayContainer.attr("data-messageGroupId",messageGroupId))):(messageGroupId=responseIdentifier,$displayContainer=$interactionContainer),{responseIdentifier:responseIdentifier,interactionContainer:$interactionContainer,displayContainer:$displayContainer,messageGroupId:messageGroupId,order:-1}}function getInteractionsDisplayInfo(item){var interactionsDisplayInfo=[],$itemContainer=item.getContainer(),interactionOrder=0;return _.each(item.getComposingElements(),function(element){var responseIdentifier;element.is("interaction")&&(responseIdentifier=element.attr("responseIdentifier"),interactionsDisplayInfo.push(extractDisplayInfo(element)))}),$itemContainer.find(".qti-interaction").each(function(){var interactionContainer=this;_.each(interactionsDisplayInfo,function(_interactionInfo){if(_interactionInfo.interactionContainer[0]===interactionContainer)return _interactionInfo.order=interactionOrder,!1}),interactionOrder++}),interactionsDisplayInfo=_.sortBy(interactionsDisplayInfo,"order"),interactionsDisplayInfo}function clearModalFeedbacks($itemContainer){$itemContainer.find(".qti-modalFeedback").remove()}function renderModalFeedback(feedback,loader,renderer,$container,$itemContainer,renderedCallback){renderer.load(function(){var $modalFeedback=$$1(feedback.render({inline:!0})),done=function(){renderedCallback({identifier:feedback.id(),serial:feedback.getSerial(),dom:$modalFeedback})};$container.append($modalFeedback),Promise.race([Promise.all(_.map(feedback.getComposingElements(),function(elt){return elt.postRender({},"",renderer).pop()})),new Promise(function(resolve,reject){_.delay(reject,timeout,new Error("Post rendering ran out of time."))})]).then(done).catch(function(err){throw done(),new Error("Error in post rendering : "+err)})},loader.getLoadedClasses())}function replaceControl(renderedFeebacks,$itemContainer,callback){var $scope,$controls,$toggleContainer;window.parent&&window.parent.parent&&window.parent.parent.$?$itemContainer.parents(".tao-preview-scope").length?($scope=window.parent.parent.$("#preview-console"),$controls=$scope.find(".preview-console-header .action-bar li:visible"),$toggleContainer=$scope.find(".console-button-action-bar"),initControlToggle(renderedFeebacks,$itemContainer,$controls,$toggleContainer,previewOkBtn,callback)):($scope=window.parent.parent.$("body.qti-test-scope .bottom-action-bar"),$controls=$scope.find("li:visible"),$toggleContainer=$scope.find(".navi-box-list"),initControlToggle(renderedFeebacks,$itemContainer,$controls,$toggleContainer,deliveryOkBtn,callback)):($scope=$itemContainer.find("#modalFeedbacks"),initControlToggle(renderedFeebacks,$itemContainer,$$1(),$scope,previewOkBtn,callback))}function initControlToggle(renderedFeebacks,$itemContainer,$controls,$toggleContainer,toggleButtonTemplate,callback){var $ok=$$1(toggleButtonTemplate()).click(function(){_.each(renderedFeebacks,function(fb){fb.dom.hide()}),uncover([$itemContainer]),$ok.remove(),$controls.show(),callback()});$controls.hide(),$toggleContainer.append($ok),cover([$itemContainer])}function cover(interactionContainers){var $cover=$$1("<div class=\"interaction-cover modal-bg\">");_.each(interactionContainers,function($interaction){$interaction.append($cover)})}function uncover(interactionContainers){_.each(interactionContainers,function($interaction){$interaction.find(".interaction-cover").remove()})}function getFeedbackMessageSignature(feedback){return(""+feedback.body()+feedback.attr("title")).toLowerCase().trim().replace(/x-tao-[a-zA-Z0-9\-._\s]*/g,"")}_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,$$1=$$1&&Object.prototype.hasOwnProperty.call($$1,"default")?$$1["default"]:$$1,context=context&&Object.prototype.hasOwnProperty.call(context,"default")?context["default"]:context,pci=pci&&Object.prototype.hasOwnProperty.call(pci,"default")?pci["default"]:pci,containerHelper=containerHelper&&Object.prototype.hasOwnProperty.call(containerHelper,"default")?containerHelper["default"]:containerHelper,Handlebars=Handlebars&&Object.prototype.hasOwnProperty.call(Handlebars,"default")?Handlebars["default"]:Handlebars,__=__&&Object.prototype.hasOwnProperty.call(__,"default")?__["default"]:__,DOMPurify=DOMPurify&&Object.prototype.hasOwnProperty.call(DOMPurify,"default")?DOMPurify["default"]:DOMPurify,iframeNotifier=iframeNotifier&&Object.prototype.hasOwnProperty.call(iframeNotifier,"default")?iframeNotifier["default"]:iframeNotifier;var Helpers0=function(hb){hb.registerHelper("__",function(key){return __(key)}),hb.registerHelper("dompurify",function(context){return DOMPurify.sanitize(context)}),hb.registerHelper("join",function(arr,keyValueGlue,fragmentGlue,wrapper){var fragments=[];return keyValueGlue="string"==typeof keyValueGlue?keyValueGlue:void 0,fragmentGlue="string"==typeof fragmentGlue?fragmentGlue:" ",wrapper="string"==typeof wrapper?wrapper:"\"",_.forIn(arr,function(value,key){var fragment="";null!==value||void 0!==value?"boolean"==typeof value?value=value?"true":"false":"object"===_typeof(value)&&(value=_.values(value).join(" ")):value="",void 0!==keyValueGlue&&(fragment+=key+keyValueGlue),fragment+=wrapper+value+wrapper,fragments.push(fragment)}),fragments.join(fragmentGlue)}),hb.registerHelper("for",function(startIndex,stopIndex,increment,options){var ret="";startIndex=parseInt(startIndex),stopIndex=parseInt(stopIndex),increment=parseInt(increment);for(var i=startIndex;i<stopIndex;i+=increment)ret+=options.fn(_.extend({},this,{i:i}));return ret}),hb.registerHelper("equal",function(var1,var2,options){return var1==var2?options.fn(this):options.inverse(this)}),hb.registerHelper("property",function(name,context){return context[name]||""}),hb.registerHelper("includes",function(haystack,needle,options){if(_.contains(haystack,needle))return options.fn(this)})};Helpers0.__initialized||(Helpers0(Handlebars),Helpers0.__initialized=!0);var Template=Handlebars.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+="<li class=\"small btn-info action action-button rgt\" id=\"preview-feedback-ok-button\">\n <a class=\"li-inner\" href=\"#\">\n <span class=\"label\">"+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"OK",options):helperMissing.call(depth0,"__","OK",options)))+"</span>\n </a>\n</li>",buffer});Helpers0.__initialized||(Helpers0(Handlebars),Helpers0.__initialized=!0);var Template$1=Handlebars.template(function(Handlebars,depth0,helpers){return this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),"<li data-control=\"feedback-ok\" class=\"small btn-info action forward\" title=\"Feedback ok and ready to proceed.\">\n <a class=\"li-inner\" href=\"#\">\n <span class=\"icon-result-ok\"></span>\n <span class=\"text\">OK</span>\n </a>\n</li>"}),timeout=1e3*(0<context.timeout?context.timeout+1:30);return{showFeedbacks:showFeedbacks}}),define("taoQtiItem/qtiRunner/modalFeedback/modalRenderer",["lodash","jquery","async","taoQtiItem/qtiItem/helper/pci"],function(_,$,async,pci){'use strict';function showFeedbacks(item,loader,renderer,itemSession,onCloseCallback,onShowCallback){var count,messages=[],feedbacksToBeDisplayed=[];if(_.each(item.modalFeedbacks,function(feedback){var feedbackIds,message,outcomeIdentifier=feedback.attr("outcomeIdentifier");itemSession[outcomeIdentifier]&&(feedbackIds=pci.getRawValues(itemSession[outcomeIdentifier]),message=getFeedbackMessageSignature(feedback),0<=_.indexOf(feedbackIds,feedback.id())&&-1===_.indexOf(messages,message)&&(feedbacksToBeDisplayed.push(feedback),messages.push(message)))}),count=feedbacksToBeDisplayed.length,count){var callstack=[];_.eachRight(feedbacksToBeDisplayed,function(feedback){var endCallback;0===callstack.length&&(endCallback=function(){onCloseCallback()}),callstack.push(function(cb){renderModalFeedback(feedback,loader,renderer,function(){cb(null)},endCallback)})}),async.series(callstack,function(){_.isFunction(onShowCallback)&&onShowCallback()})}return count}function renderModalFeedback(feedback,loader,renderer,renderedCallback,closeCallback){var $feedback,$feedbackBox=$("#modalFeedbacks");feedback.is("modalFeedback")&&renderer.load(function(){$feedback=$feedbackBox.find("#"+feedback.getSerial()),$feedback.length?$feedback.modal():($feedback=feedback.render(),$feedbackBox.append($feedback)),renderedCallback(),feedback.postRender({callback:closeCallback})},loader.getLoadedClasses())}function getFeedbackMessageSignature(feedback){return(""+feedback.body()+feedback.attr("title")).toLowerCase().trim().replace(/x-tao-[a-zA-Z0-9\-._\s]*/g,"")}_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,$=$&&Object.prototype.hasOwnProperty.call($,"default")?$["default"]:$,async=async&&Object.prototype.hasOwnProperty.call(async,"default")?async["default"]:async,pci=pci&&Object.prototype.hasOwnProperty.call(pci,"default")?pci["default"]:pci;return{showFeedbacks:showFeedbacks}}),define("taoQtiItem/qtiRunner/core/QtiRunner",["jquery","lodash","context","module","iframeNotifier","taoQtiItem/qtiItem/core/Loader","taoQtiItem/qtiRunner/modalFeedback/inlineRenderer","taoQtiItem/qtiRunner/modalFeedback/modalRenderer"],function($,_,context,module,iframeNotifier,ItemLoader,modalFeedbackInline,modalFeedbackModal){'use strict';$=$&&Object.prototype.hasOwnProperty.call($,"default")?$["default"]:$,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,context=context&&Object.prototype.hasOwnProperty.call(context,"default")?context["default"]:context,module=module&&Object.prototype.hasOwnProperty.call(module,"default")?module["default"]:module,iframeNotifier=iframeNotifier&&Object.prototype.hasOwnProperty.call(iframeNotifier,"default")?iframeNotifier["default"]:iframeNotifier,ItemLoader=ItemLoader&&Object.prototype.hasOwnProperty.call(ItemLoader,"default")?ItemLoader["default"]:ItemLoader,modalFeedbackInline=modalFeedbackInline&&Object.prototype.hasOwnProperty.call(modalFeedbackInline,"default")?modalFeedbackInline["default"]:modalFeedbackInline,modalFeedbackModal=modalFeedbackModal&&Object.prototype.hasOwnProperty.call(modalFeedbackModal,"default")?modalFeedbackModal["default"]:modalFeedbackModal;var timeout=1e3*(0<context.timeout?context.timeout+1:30),QtiRunner=function(){this.item=null,this.rpEngine=null,this.renderer=null,this.loader=null,this.itemApi=void 0};return QtiRunner.prototype.updateItemApi=function(){var responses=this.getResponses(),states=this.getStates(),variables=[];for(var key in states){var value=states[key];if(value.response&&"undefined"!=typeof value.response.base)for(var property in value.response.base)if("file"==property){var file=value.response.base.file;value.response={base:{file:{name:file.name,mime:"qti+application/octet-stream",data:"cXRpX2ZpbGVfZGF0YXR5cGVfcGxhY2Vob2xkZXJfZGF0YQ=="}}}}variables[key]=value}this.itemApi.setVariables(variables),this.itemApi.saveResponses(responses),this.itemApi.resultApi.setQtiRunner(this)},QtiRunner.prototype.setItemApi=function(itemApi){this.itemApi=itemApi;var that=this,oldStateVariables=JSON.stringify(itemApi.stateVariables);itemApi.onKill(function(killCallback){that.updateItemApi();var newStateVariables=JSON.stringify(itemApi.stateVariables);oldStateVariables!==newStateVariables||itemApi.serviceApi.getHasBeenPaused()?itemApi.submit(function(){itemApi.serviceApi.setHasBeenPaused(!1),killCallback(0)}):killCallback(0)})},QtiRunner.prototype.setRenderer=function(renderer){if(renderer.isRenderer)this.renderer=renderer;else throw"invalid renderer"},QtiRunner.prototype.getLoader=function(){return this.loader||(this.loader=new ItemLoader),this.loader},QtiRunner.prototype.loadItemData=function(data,callback){var self=this;this.getLoader().loadItemData(data,function(item){self.item=item,callback(self.item)})},QtiRunner.prototype.loadElements=function(elements,callback){if(this.getLoader().item)this.getLoader().loadElements(elements,callback);else throw"QtiRunner : cannot load elements in empty item"},QtiRunner.prototype.renderItem=function(data,done){var self=this;done=_.isFunction(done)?done:_.noop;var render=function(){if(!self.item)throw"cannot render item: empty item";if(self.renderer)self.renderer.load(function(){self.item.setRenderer(self.renderer),self.item.render({},$("#qti_item")),Promise.race([Promise.all(self.item.postRender()),new Promise(function(resolve,reject){_.delay(reject,timeout,new Error("Post rendering ran out of time."))})]).then(function(){self.item.getContainer().on("responseChange",function(e,data){data.interaction&&data.interaction.attr("responseIdentifier")&&data.response&&iframeNotifier.parent("responsechange",[data.interaction.attr("responseIdentifier"),data.response])}),self.initInteractionsResponse(),self.listenForThemeChange(),done()}).catch(function(err){throw done(),new Error("Error in post rendering : "+err)})},self.getLoader().getLoadedClasses());else throw"cannot render item: no rendered set"};"object"===_typeof(data)?this.loadItemData(data,render):render()},QtiRunner.prototype.initInteractionsResponse=function(){var self=this;if(self.item){var interactions=self.item.getInteractions();for(var i in interactions){var interaction=interactions[i],responseId=interaction.attr("responseIdentifier");self.itemApi.getVariable(responseId,function(values){if(values)interaction.setState(values),iframeNotifier.parent("stateready",[responseId,values]);else{var states=self.getStates();_.indexOf(states,responseId)&&(self.itemApi.setVariable(responseId,states[responseId]),interaction.setState(states[responseId]),iframeNotifier.parent("stateready",[responseId,states[responseId]]))}})}}},QtiRunner.prototype.listenForThemeChange=function(){var self=this,$container=this.renderer.getContainer(this.item);$container.length||($container=$(".qti-item")),$container.off("themechange").on("themechange",function(e,themeName){var themeLoader=self.renderer.getThemeLoader();themeName=themeName||e.originalEvent.detail,themeLoader&&themeLoader.change(themeName)})},QtiRunner.prototype.validate=function(){this.updateItemApi(),this.itemApi.finish()},QtiRunner.prototype.getResponses=function(){var responses={},interactions=this.item.getInteractions();return _.forEach(interactions,function(interaction){var response={};try{response=interaction.getResponse()}catch(e){console.error(e)}responses[interaction.attr("responseIdentifier")]=response}),responses},QtiRunner.prototype.getStates=function(){var states={},interactions=this.item.getInteractions();return _.forEach(interactions,function(interaction){var state={};try{state=interaction.getState()}catch(e){console.error(e)}states[interaction.attr("responseIdentifier")]=state}),states},QtiRunner.prototype.setResponseProcessing=function(callback){this.rpEngine=callback},QtiRunner.prototype.showFeedbacks=function(itemSession,callback,onShowCallback){var inlineDisplay=!!module.config().inlineModalFeedback;return inlineDisplay?modalFeedbackInline.showFeedbacks(this.item,this.getLoader(),this.renderer,itemSession,callback,onShowCallback):modalFeedbackModal.showFeedbacks(this.item,this.getLoader(),this.renderer,itemSession,callback,onShowCallback)},QtiRunner}),define("taoQtiItem/qtiItem/helper/interactionHelper",["lodash","taoQtiItem/qtiItem/core/Element"],function(_,Element){'use strict';var _Mathfloor=Math.floor;_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,Element=Element&&Object.prototype.hasOwnProperty.call(Element,"default")?Element["default"]:Element;return{convertChoices:function convertChoices(choices,outputType){var ret=[],_this=this;return _.each(choices,function(c){Element.isA(c,"choice")?"serial"===outputType?ret.push(c.getSerial()):"identifier"===outputType?ret.push(c.id()):ret.push(c):_.isArray(c)&&ret.push(_this.convertChoices(c,outputType))}),ret},findChoices:function findChoices(interaction,choices,inputType){var ret=[],_this=this;return _.each(choices,function(c){var choice;_.isString(c)?"serial"===inputType?(choice=interaction.getChoice(c),choice&&ret.push(choice)):"identifier"===inputType?(choice=interaction.getChoiceByIdentifier(c),choice&&ret.push(choice)):ret.push(c):_.isArray(c)?ret.push(_this.findChoices(interaction,c,inputType)):ret.push(c)}),ret},shuffleChoices:function shuffleChoices(choices){var r=[],f={},j=0;for(var i in choices)if(Element.isA(choices[i],"choice")){var choice=choices[i];choice.attr("fixed")&&(f[j]=choice),r.push(choice),j++}else throw"invalid element in array: is not a qti choice";for(var n=0;n<r.length-1;n++)if(!f[n]){var k=-1;do k=n+_Mathfloor(Math.random()*(r.length-n));while(f[k]);var tmp=r[k];r[k]=r[n],r[n]=tmp}return r},serialToIdentifier:function serialToIdentifier(interaction,choiceSerial){var choice=interaction.getChoice(choiceSerial);return choice?choice.id():""}}}),define("taoQtiItem/qtiRunner/core/Renderer",["lodash","jquery","taoQtiItem/qtiItem/core/Element","taoQtiItem/qtiItem/helper/interactionHelper","ui/themeLoader","ui/themes","core/moduleLoader","handlebars"],function(_,$,Element,interactionHelper,themeLoader,themesHelper,moduleLoader,Handlebars){'use strict';function getDocumentBaseUrl(){return window.location.protocol+"//"+window.location.host+window.location.pathname.replace(/([^\/]*)$/,"")}_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,$=$&&Object.prototype.hasOwnProperty.call($,"default")?$["default"]:$,Element=Element&&Object.prototype.hasOwnProperty.call(Element,"default")?Element["default"]:Element,interactionHelper=interactionHelper&&Object.prototype.hasOwnProperty.call(interactionHelper,"default")?interactionHelper["default"]:interactionHelper,themeLoader=themeLoader&&Object.prototype.hasOwnProperty.call(themeLoader,"default")?themeLoader["default"]:themeLoader,themesHelper=themesHelper&&Object.prototype.hasOwnProperty.call(themesHelper,"default")?themesHelper["default"]:themesHelper,moduleLoader=moduleLoader&&Object.prototype.hasOwnProperty.call(moduleLoader,"default")?moduleLoader["default"]:moduleLoader,Handlebars=Handlebars&&Object.prototype.hasOwnProperty.call(Handlebars,"default")?Handlebars["default"]:Handlebars;var hb=Handlebars;"function"!=typeof hb.compile&&(hb=require("handlebars"));var _isValidRenderer=function(renderer){var valid=!0;if("object"!==_typeof(renderer))return!1;var classCorrect=!1;if(renderer.qtiClass)if(0<=_.indexOf(_renderableClasses,renderer.qtiClass))classCorrect=!0;else{var pos=renderer.qtiClass.indexOf(".");if(0<pos){var qtiClass=renderer.qtiClass.slice(0,pos),subClass=renderer.qtiClass.slice(pos+1);_renderableSubclasses[qtiClass]&&0<=_.indexOf(_renderableSubclasses[qtiClass],subClass)&&(classCorrect=!0)}}if(!classCorrect)throw valid=!1,new Error("invalid qti class name in renderer declaration : "+renderer.qtiClass);if(!renderer.template)throw valid=!1,new Error("missing template in renderer declaration : "+renderer.qtiClass);return valid},_renderableClasses=["_container","assessmentItem","stylesheet","responseDeclaration","outcomeDeclaration","responseProcessing","_simpleFeedbackRule","_tooltip","img","math","object","table","modalFeedback","rubricBlock","associateInteraction","choiceInteraction","extendedTextInteraction","gapMatchInteraction","graphicAssociateInteraction","graphicGapMatchInteraction","graphicOrderInteraction","hotspotInteraction","hottextInteraction","inlineChoiceInteraction","matchInteraction","mediaInteraction","orderInteraction","selectPointInteraction","sliderInteraction","textEntryInteraction","uploadInteraction","endAttemptInteraction","customInteraction","prompt","associableHotspot","gap","gapImg","gapText","hotspotChoice","hottext","inlineChoice","simpleAssociableChoice","simpleChoice","infoControl","include","printedVariable"],_dependencies={assessmentItem:["stylesheet","_container","prompt","modalFeedback"],rubricBlock:["_container"],associateInteraction:["simpleAssociableChoice"],choiceInteraction:["simpleChoice"],gapMatchInteraction:["gap","gapText"],graphicAssociateInteraction:["associableHotspot"],graphicGapMatchInteraction:["associableHotspot","gapImg"],graphicOrderInteraction:["hotspotChoice"],hotspotInteraction:["hotspotChoice"],hottextInteraction:["hottext"],inlineChoiceInteraction:["inlineChoice"],matchInteraction:["simpleAssociableChoice"],orderInteraction:["simpleChoice"]},_renderableSubclasses={simpleAssociableChoice:["associateInteraction","matchInteraction"],simpleChoice:["choiceInteraction","orderInteraction"]},_defaults={shuffleChoices:!0},Renderer=function(options){function registerRendererClass(qtiClass,list){var success=!1;return!1===_locations[qtiClass]?(_renderers[qtiClass]=!1,success=!0):_locations[qtiClass]&&(list.push(_locations[qtiClass]),success=!0),success}var _locations={},_renderers={};options=_.defaults(options||{},_defaults),this.isRenderer=!0,this.name="",this.shuffledChoices=[];var _getClassRenderer=function(qtiClass){var ret=null;if(_renderers[qtiClass])ret=_renderers[qtiClass];else{var pos=qtiClass.indexOf(".");0<pos&&(qtiClass=qtiClass.slice(0,pos),_renderers[qtiClass]&&(ret=_renderers[qtiClass]))}return ret};this.setOption=function(key,value){return"string"==typeof key&&(options[key]=value),this},this.setOptions=function(opts){return options=_.extend(options,opts),this},this.getOption=function(key){return"string"==typeof key&&options[key]?options[key]:null},this.getCustomMessage=function(elementName,messageKey){var messages=this.getOption("messages");return messages&&elementName&&messages[elementName]&&_.isString(messages[elementName][messageKey])?hb.compile(messages[elementName][messageKey]):null},this.getAssetManager=function(){return options.assetManager},this.getThemeLoader=function(){return this.themeLoader},this.renderTpl=function(element,data,qtiSubclass){var res,ret="",qtiClass=qtiSubclass||element.qtiClass,renderer=_getClassRenderer(qtiClass),decorators=this.getOption("decorators");if(!renderer||!_.isFunction(renderer.template))throw new Error("no renderer template loaded under the class name : "+qtiClass);return _.isObject(decorators)&&_.isFunction(decorators.before)&&(res=decorators.before(element,qtiSubclass),_.isString(res)&&(ret+=res)),ret+=renderer.template(data),_.isObject(decorators)&&_.isFunction(decorators.after)&&(res=decorators.after(element,qtiSubclass),_.isString(res)&&(ret+=res)),ret},this.getData=function(element,data,qtiSubclass){var ret=data,qtiClass=qtiSubclass||element.qtiClass,renderer=_getClassRenderer(qtiClass);return renderer&&"function"==typeof renderer.getData&&(ret=renderer.getData.call(this,element,data)),ret},this.renderDirect=function(tpl,data){return hb.compile(tpl)(data)},this.getContainer=function(qtiElement,$scope,qtiSubclass){var ret=null,qtiClass=qtiSubclass||qtiElement.qtiClass,renderer=_getClassRenderer(qtiClass);if(renderer)ret=renderer.getContainer(qtiElement,$scope);else throw"no renderer found for the class : "+qtiElement.qtiClass;return ret},this.postRender=function(qtiElement,data,qtiSubclass){var qtiClass=qtiSubclass||qtiElement.qtiClass,renderer=_getClassRenderer(qtiClass);if(renderer&&"function"==typeof renderer.render)return renderer.render.call(this,qtiElement,data)},this.setResponse=function(qtiInteraction,response,qtiSubclass){var ret=!1,qtiClass=qtiSubclass||qtiInteraction.qtiClass,renderer=_getClassRenderer(qtiClass);if(!renderer)throw"no renderer registered under the name : "+qtiClass;else if("function"==typeof renderer.setResponse){ret=renderer.setResponse.call(this,qtiInteraction,response);var $container=renderer.getContainer.call(this,qtiInteraction);$container instanceof $&&$container.length&&$container.trigger("responseSet",[qtiInteraction,response])}return ret},this.getResponse=function(qtiInteraction,qtiSubclass){var ret=!1,qtiClass=qtiSubclass||qtiInteraction.qtiClass,renderer=_getClassRenderer(qtiClass);if(renderer)"function"==typeof renderer.getResponse&&(ret=renderer.getResponse.call(this,qtiInteraction));else throw"no renderer registered under the name : "+qtiClass;return ret},this.resetResponse=function(qtiInteraction,qtiSubclass){var ret=!1,qtiClass=qtiSubclass||qtiInteraction.qtiClass,renderer=_getClassRenderer(qtiClass);if(renderer)"function"==typeof renderer.resetResponse&&(ret=renderer.resetResponse.call(this,qtiInteraction));else throw"no renderer registered under the name : "+qtiClass;return ret},this.getState=function(qtiInteraction,qtiSubclass){var ret=!1,qtiClass=qtiSubclass||qtiInteraction.qtiClass,renderer=_getClassRenderer(qtiClass);if(renderer)ret=_.isFunction(renderer.getState)?renderer.getState.call(this,qtiInteraction):renderer.getResponse.call(this,qtiInteraction);else throw"no renderer registered under the name : "+qtiClass;return ret},this.setState=function(qtiInteraction,state,qtiSubclass){var qtiClass=qtiSubclass||qtiInteraction.qtiClass,renderer=_getClassRenderer(qtiClass);if(renderer)_.isFunction(renderer.setState)?renderer.setState.call(this,qtiInteraction,state):(renderer.resetResponse.call(this,qtiInteraction),renderer.setResponse.call(this,qtiInteraction,state));else throw"no renderer registered under the name : "+qtiClass},this.destroy=function(qtiInteraction,qtiSubclass){var ret=!1,qtiClass=qtiSubclass||qtiInteraction.qtiClass,renderer=_getClassRenderer(qtiClass);if(renderer)_.isFunction(renderer.destroy)&&(ret=renderer.destroy.call(this,qtiInteraction));else throw"no renderer registered under the name : "+qtiClass;return ret},this.getLoadedRenderers=function(){return _renderers},this.register=function(renderersLocations){_.extend(_locations,renderersLocations)},this.load=function(callback,requiredClasses){var self=this,required=[],themeData=themesHelper.getCurrentThemeData();if(themeData&&(options.themes=themeData),options.themes&&(options.themes.base=this.resolveUrl(options.themes.base),_.forEach(options.themes.available,function(theme,index){options.themes.available[index].path=self.resolveUrl(theme.path)}),this.themeLoader=themeLoader(options.themes).load(options.preload)),!requiredClasses)required=_.values(_locations);else if(_.isArray(requiredClasses))requiredClasses=_.intersection(requiredClasses,_renderableClasses),_.each(requiredClasses,function(reqClass){var deps=_dependencies[reqClass];deps&&(requiredClasses=_.union(requiredClasses,deps))}),_.forEach(requiredClasses,function(qtiClass){var requiredSubClasses;if(_renderableSubclasses[qtiClass])requiredSubClasses=_.intersection(requiredClasses,_renderableSubclasses[qtiClass]),_.each(requiredSubClasses,function(subclass){if(!registerRendererClass(qtiClass+"."+subclass,required)&&!registerRendererClass(qtiClass,required))throw new Error(self.name+" : missing qti class location declaration: "+qtiClass+", subclass: "+subclass)});else if(!registerRendererClass(qtiClass,required))throw new Error(self.name+" : missing qti class location declaration: "+qtiClass)});else throw new Error("invalid argument type: expected array for arg \"requireClasses\"");return moduleLoader([],function(){return!0}).addList(required.map(function(module){return{module:module,category:"qti"}})).load().then(function(loaded){loaded.forEach(function(clazz){_isValidRenderer(clazz)&&(_renderers[clazz.qtiClass]=clazz)}),"function"==typeof callback&&callback.call(self,_renderers)}),this},this.unload=function(){return this.themeLoader&&themeLoader(options.themes).unload(),this},this.setShuffledChoices=function(interaction,choices,identificationType){Element.isA(interaction,"interaction")&&(this.shuffledChoices[interaction.getSerial()]=_.pluck(interactionHelper.findChoices(interaction,choices,identificationType),"serial"))},this.getShuffledChoices=function(interaction,reshuffle,returnedType){var serial,i,choices=[];if(Element.isA(interaction,"interaction")){if(serial=interaction.getSerial(),this.shuffledChoices[serial]&&!reshuffle)Element.isA(interaction,"matchInteraction")?_.forEach(choices,function(choice,index){2>index&&_.forEach(this.shuffledChoices[serial][i],function(choiceSerial){choice.push(interaction.getChoice(choiceSerial))})}):_.forEach(this.shuffledChoices[serial],function(choiceSerial){choices.push(interaction.getChoice(choiceSerial))});else if(Element.isA(interaction,"matchInteraction"))for(this.shuffledChoices[serial]=[],i=0;2>i;i++)choices[i]=interactionHelper.shuffleChoices(interaction.getChoices(i)),this.shuffledChoices[serial][i]=_.pluck(choices[i],"serial");else choices=interactionHelper.shuffleChoices(interaction.getChoices()),this.shuffledChoices[serial]=_.pluck(choices,"serial");return"serial"===returnedType||"identifier"===returnedType?interactionHelper.convertChoices(choices,returnedType):_.clone(choices)}return[]},this.getRenderers=function(){return _renderers},this.getLocations=function(){return _locations},this.resolveUrl=function(url){return options.assetManager?"string"==typeof url&&0<url.length?options.assetManager.resolve(url):void 0:url},this.getAbsoluteUrl=function(relUrl){if(console.warn("DEPRECATED used getAbsoluteUrl with ",arguments),this.getOption("userRelativeUrl"))return relUrl.replace(/^\.?\//,"");if(/^http(s)?:\/\//i.test(relUrl)||/^data:[^\/]+\/[^;]+(;charset=[\w]+)?;base64,/.test(relUrl))return relUrl;var absUrl="",runtimeLocations=this.getOption("runtimeLocations");if(runtimeLocations&&_.size(runtimeLocations)&&_.forIn(runtimeLocations,function(runtimeLocation,typeIdentifier){if(0===relUrl.indexOf(typeIdentifier))return absUrl=relUrl.replace(typeIdentifier,runtimeLocation),!1}),absUrl)return absUrl;var baseUrl=this.getOption("baseUrl")||getDocumentBaseUrl();return baseUrl+relUrl},this.setAreaBroker=function(areaBroker){this._areaBroker=areaBroker},this.getAreaBroker=function(){if(this._areaBroker)return this._areaBroker},this.getItemCreator=function(){return this.getOption("itemCreator")}};return{build:function build(renderersLocations,name,defaultOptions){var NewRenderer=function(){var options=_.isPlainObject(arguments[0])?arguments[0]:{};Renderer.apply(this),this.register(renderersLocations),this.name=name||"",this.setOptions(_.defaults(options,defaultOptions||{}))};return NewRenderer.prototype=Renderer.prototype,NewRenderer}}}),define("taoQtiItem/portableElementRegistry/factory/factory",["lodash","core/promise","core/eventifier"],function(_,Promise,eventifier){'use strict';var _requirejs=window.require,_defaultLoadingOptions={reload:!1},loadModuleConfig=function(manifest){return new Promise(function(resolve,reject){var baseUrl,requireConfigAliases={},reqConfigs=[],modules={};return manifest&&manifest.runtime?void(baseUrl=manifest.baseUrl,_.isArray(manifest.runtime.config)&&manifest.runtime.config.length&&_.forEach(manifest.runtime.config,function(pciConfig){_.isString(pciConfig)?reqConfigs.push("json!"+baseUrl+"/"+pciConfig):pciConfig.data?modules=_.defaults(modules,pciConfig.data.paths||{}):pciConfig.file&&reqConfigs.push("json!"+baseUrl+"/"+pciConfig.file)}),require(reqConfigs,function(){var runtimeModules={};requireConfigAliases[manifest.typeIdentifier]=baseUrl,"IMSPCI"===manifest.model&&(modules=_.reduce(arguments,function(acc,conf){return _.defaults(acc,conf.paths||{})},modules),_.forEach(manifest.runtime.modules||{},function(paths,id){paths&&(_.isString(paths)||_.isArray(paths)&&paths.length)&&(runtimeModules[id]=paths)}),modules=_.merge(modules,runtimeModules),_.forEach(modules,function(paths,id){paths=_.isArray(paths)?paths:[paths],requireConfigAliases[id]=_.map(paths,function(path){return baseUrl+"/"+path.replace(/\.js$/,"")})})),resolve(requireConfigAliases)},reject)):reject("invalid manifest")})},isPortableElementProvider=function(provider){return provider&&_.isFunction(provider.load)};return function(methods){var _loaded=!1,__providers={};return eventifier(_.defaults(methods||{},{_registry:{},get:function(typeIdentifier,version){if(this._registry[typeIdentifier])return version?_.find(this._registry[typeIdentifier],{version:version}):_.last(this._registry[typeIdentifier])},registerProvider:function(moduleName,provider){return __providers[moduleName]=isPortableElementProvider(provider)?provider:null,_loaded=!1,this},resetProviders:function(){return __providers={},_loaded=!1,this},loadProviders:function(options){var loadPromise,self=this;return loadPromise=_loaded&&!options.reload?Promise.resolve([]):new Promise(function(resolve,reject){var providerLoadingStack=[];_.forIn(__providers,function(provider,id){null===provider&&providerLoadingStack.push(id)}),_requirejs(providerLoadingStack,function(){_.each([].slice.call(arguments),function(provider){isPortableElementProvider(provider)&&(__providers[providerLoadingStack.shift()]=provider)}),resolve(__providers),_loaded=!0,self.trigger("providersloaded",__providers)},reject)}),loadPromise},getAllVersions:function(){var all={};return _.forIn(this._registry,function(versions,id){all[id]=_.map(versions,"version")}),all},getRuntime:function(typeIdentifier,version){var portableElement=this.get(typeIdentifier,version);return portableElement?_.assign(portableElement.runtime,{id:portableElement.typeIdentifier,label:portableElement.label,baseUrl:portableElement.baseUrl,model:portableElement.model}):void this.trigger("error",{message:"no portable element runtime found",typeIdentifier:typeIdentifier,version:version})},getCreator:function(typeIdentifier,version){var portableElement=this.get(typeIdentifier,version);return portableElement&&portableElement.creator?_.assign(portableElement.creator,{id:portableElement.typeIdentifier,label:portableElement.label,baseUrl:portableElement.baseUrl,response:portableElement.response,model:portableElement.model,xmlns:portableElement.xmlns}):void this.trigger("error",{message:"no portable element runtime found",typeIdentifier:typeIdentifier,version:version})},getLatestCreators:function(){var all={};return _.forIn(this._registry,function(versions,id){var lastVersion=_.last(versions);lastVersion.creator&&lastVersion.creator.hook&&lastVersion.enabled&&(all[id]=lastVersion)}),all},getBaseUrl:function(typeIdentifier,version){var runtime=this.get(typeIdentifier,version);return runtime?runtime.baseUrl:""},loadRuntimes:function(options){var loadPromise,self=this;return options=_.defaults(options||{},_defaultLoadingOptions),loadPromise=self.loadProviders(options).then(function(providers){var loadStack=[];return _.forEach(providers,function(provider){provider&&loadStack.push(provider.load())}),Promise.all(loadStack).then(function(results){var configLoadingStack=[];return self._registry=_.reduce(results,function(acc,_pcis){return _.merge(acc,_pcis)},self._registry||{}),_.forIn(self._registry,function(versions,typeIdentifier){return!!(_.isArray(options.include)&&0>_.indexOf(options.include,typeIdentifier))||void configLoadingStack.push(loadModuleConfig(self.get(typeIdentifier)))}),Promise.all(configLoadingStack).then(function(moduleConfigs){var requireConfigAliases=_.reduce(moduleConfigs,function(acc,paths){return _.merge(acc,paths)},{});_requirejs.config({paths:requireConfigAliases})})})}),loadPromise.then(function(){self.trigger("runtimesloaded")}).catch(function(err){self.trigger("error",err)}),loadPromise},loadCreators:function(options){var loadPromise,self=this;return options=_.defaults(options||{},_defaultLoadingOptions),loadPromise=self.loadRuntimes(options).then(function(){var requiredCreatorHooks=[];return _.forIn(self._registry,function(versions,typeIdentifier){var portableElementModel=self.get(typeIdentifier);if(portableElementModel.creator&&portableElementModel.creator.hook){if(portableElementModel.enabled){if(_.isArray(options.include)&&0>_.indexOf(options.include,typeIdentifier))return!0;}else if(!_.isArray(options.include)||0>_.indexOf(options.include,typeIdentifier))return!0;requiredCreatorHooks.push(portableElementModel.creator.hook.replace(/\.js$/,""))}}),requiredCreatorHooks.length?new Promise(function(resolve,reject){_requirejs(requiredCreatorHooks,function(){var creators={};_.each(arguments,function(creatorHook){var id=creatorHook.getTypeIdentifier(),portableElementModel=self.get(id),i=_.findIndex(self._registry[id],{version:portableElementModel.version});0>i?self.trigger("error","no creator found for id/version "+id+"/"+portableElementModel.version):(self._registry[id][i].creator.module=creatorHook,creators[id]=creatorHook)}),resolve(creators)},reject)}):Promise.resolve({})}),loadPromise.then(function(creators){return self.trigger("creatorsloaded",creators),creators}).catch(function(err){self.trigger("error",err)}),loadPromise},enable:function(typeIdentifier,version){var portableElement=this.get(typeIdentifier,version);return portableElement&&(portableElement.enabled=!0),this},disable:function(typeIdentifier,version){var portableElement=this.get(typeIdentifier,version);return portableElement&&(portableElement.enabled=!1),this},isEnabled:function(typeIdentifier,version){var portableElement=this.get(typeIdentifier,version);return portableElement&&!0===portableElement.enabled}}))}}),define("taoQtiItem/qtiCreator/helper/qtiElements",["jquery","lodash","i18n"],function($,_,__){"use strict";var QtiElements={};return QtiElements.classes={itemBody:{parents:["bodyElement"],contains:["block"],abstract:!0},atomicBlock:{parents:["blockStatic","bodyElement","flowStatic"],contains:["inline"],abstract:!0},atomicInline:{parents:["bodyElement","flowStatic","inlineStatic"],contains:["inline"],abstract:!0},simpleBlock:{parents:["blockStatic","bodyElement","flowStatic"],contains:["block"],abstract:!0},simpleInline:{parents:["bodyElement","flowStatic","inlineStatic"],contains:["inline"],abstract:!0},flowStatic:{parents:["flow"],abstract:!0},blockStatic:{parents:["block"],abstract:!0},inlineStatic:{parents:["inline"],abstract:!0},flow:{parents:["objectFlow"],abstract:!0},tableCell:{parents:["bodyElement"],contains:["flow"],abstract:!0},caption:{parents:["bodyElement"],contains:["inline"],xhtml:!0},col:{parents:["bodyElement"],xhtml:!0},colgroup:{parents:["bodyElement"],contains:["col"],xhtml:!0},div:{parents:["blockStatic","bodyElement","flowStatic"],contains:["flow"],xhtml:!0},dl:{parents:["blockStatic","bodyElement","flowStatic"],contains:["dlElement"],xhtml:!0},dt:{parents:["dlElement"],contains:["inline"],xhtml:!0},dd:{parents:["dlElement"],contains:["flow"],xhtml:!0},hr:{parents:["blockStatic","bodyElement","flowStatic"],xhtml:!0},math:{parents:["blockStatic","flowStatic","inlineStatic"],xhtml:!0},li:{parents:["bodyElement"],contains:["flow"],xhtml:!0},ol:{parents:["blockStatic","bodyElement","flowStatic"],contains:["li"],xhtml:!0},ul:{parents:["blockStatic","bodyElement","flowStatic"],contains:["li"],xhtml:!0},object:{parents:["bodyElement","flowStatic","inlineStatic"],contains:["objectFlow"],xhtml:!0},param:{parents:["objectFlow"],xhtml:!0},table:{parents:["blockStatic","bodyElement","flowStatic"],contains:["caption","col","colgroup","thead","tfoot","tbody"],xhtml:!0},tbody:{parents:["bodyElement"],contains:["tr"],xhtml:!0},tfoot:{parents:["bodyElement"],contains:["tr"],xhtml:!0},thead:{parents:["bodyElement"],contains:["tr"],xhtml:!0},td:{parents:["tableCell"],xhtml:!0},th:{parents:["tableCell"],xhtml:!0},tr:{parents:["bodyElement"],contains:["tableCell"],xhtml:!0},a:{parents:["simpleInline"],xhtml:!0},abbr:{parents:["simpleInline"],xhtml:!0},acronym:{parents:["simpleInline"],xhtml:!0},b:{parents:["simpleInline"],xhtml:!0},big:{parents:["simpleInline"],xhtml:!0},cite:{parents:["simpleInline"],xhtml:!0},code:{parents:["simpleInline"],xhtml:!0},dfn:{parents:["simpleInline"],xhtml:!0},em:{parents:["simpleInline"],xhtml:!0},i:{parents:["simpleInline"],xhtml:!0},kbd:{parents:["simpleInline"],xhtml:!0},q:{parents:["simpleInline"],xhtml:!0},samp:{parents:["simpleInline"],xhtml:!0},small:{parents:["simpleInline"],xhtml:!0},span:{parents:["simpleInline"],xhtml:!0},strong:{parents:["simpleInline"],xhtml:!0},sub:{parents:["simpleInline"],xhtml:!0},sup:{parents:["simpleInline"],xhtml:!0},tt:{parents:["simpleInline"],xhtml:!0},var:{parents:["simpleInline"],xhtml:!0},blockquote:{parents:["simpleBlock"],xhtml:!0},address:{parents:["atomicBlock"],xhtml:!0},h1:{parents:["atomicBlock"],xhtml:!0},h2:{parents:["atomicBlock"],xhtml:!0},h3:{parents:["atomicBlock"],xhtml:!0},h4:{parents:["atomicBlock"],xhtml:!0},h5:{parents:["atomicBlock"],xhtml:!0},h6:{parents:["atomicBlock"],xhtml:!0},p:{parents:["atomicBlock"],xhtml:!0},pre:{parents:["atomicBlock"],xhtml:!0},img:{parents:["atomicInline"],xhtml:!0,attributes:["src","alt","longdesc","height","width"]},br:{parents:["atomicInline"],xhtml:!0},infoControl:{parents:["blockStatic","bodyElement","flowStatic"],qti:!0},textRun:{parents:["inlineStatic","flowstatic"],qti:!0},feedbackInline:{parents:["simpleInline","feedbackElement"],qti:!0},feedbackBlock:{parents:["simpleBlock"],qti:!0},rubricBlock:{parents:["simpleBlock"],qti:!0},blockInteraction:{parents:["block","flow","interaction"],qti:!0},inlineInteraction:{parents:["inline","flow","interaction"],qti:!0},gap:{parents:["inlineStatic"],qti:!0},hottext:{parents:["flowstatic","inlineStatic"],contains:["inlineStatic"],qti:!0},printedVariable:{parents:["bodyElement","flowStatic","inlineStatic","textOrVariable"],qti:!0},prompt:{parents:["bodyElement"],contains:["inlineStatic"],qti:!0},templateElement:{parents:["bodyElement"],qti:!0},templateBlock:{parents:["blockStatic","flowStatic","templateElement"],contains:["blockStatic"],qti:!0},templateInline:{parents:["inlineStatic","flowStatic","templateElement"],contains:["inlineStatic"],qti:!0},choiceInteraction:{parents:["blockInteraction"],qti:!0},associateInteraction:{parents:["blockInteraction"],qti:!0},orderInteraction:{parents:["blockInteraction"],qti:!0},matchInteraction:{parents:["blockInteraction"],qti:!0},hottextInteraction:{parents:["blockInteraction"],qti:!0},gapMatchInteraction:{parents:["blockInteraction"],qti:!0},mediaInteraction:{parents:["blockInteraction"],qti:!0},sliderInteraction:{parents:["blockInteraction"],qti:!0},uploadInteraction:{parents:["blockInteraction"],qti:!0},drawingInteraction:{parents:["blockInteraction"],qti:!0},graphicInteraction:{parents:["blockInteraction"],qti:!0},hotspotInteraction:{parents:["graphicInteraction"],qti:!0},graphicAssociateInteraction:{parents:["graphicInteraction"],qti:!0},graphicOrderInteraction:{parents:["graphicInteraction"],qti:!0},graphicGapMatchInteraction:{parents:["graphicInteraction"],qti:!0},selectPointInteraction:{parents:["graphicInteraction"],qti:!0},textEntryInteraction:{parents:["stringInteraction","inlineInteraction"],qti:!0},extendedTextInteraction:{parents:["stringInteraction","blockInteraction"],qti:!0},inlineChoiceInteraction:{parents:["inlineInteraction"],qti:!0},endAttemptInteraction:{parents:["inlineInteraction"],qti:!0},customInteraction:{parents:["block","flow","interaction"],qti:!0},_container:{parents:["block"],qti:!0}},QtiElements.cache={containable:{},children:{},parents:{}},QtiElements.getAllowedContainersElements=function(qtiClass,$container){var classes=QtiElements.getAllowedContainers(qtiClass),jqSelector="";for(var i in classes)classes[i].qti||(jqSelector+=classes[i]+", ");return jqSelector&&(jqSelector=jqSelector.substring(0,jqSelector.length-2)),$(jqSelector,$container?$container:$(document)).filter(":not([data-qti-type])")},QtiElements.getAllowedContainers=function(qtiClass){var ret;if(QtiElements.cache.containable[qtiClass])ret=QtiElements.cache.containable[qtiClass];else{ret=[];var parents=QtiElements.getParentClasses(qtiClass,!0);for(var aClass in QtiElements.classes){var model=QtiElements.classes[aClass];if(model.contains){var intersect=_.intersection(model.contains,parents);intersect.length&&(!model.abstract&&ret.push(aClass),ret=_.union(ret,QtiElements.getChildClasses(aClass,!0)))}}QtiElements.cache.containable[qtiClass]=ret}return ret},QtiElements.getAllowedContents=function(qtiClass,recursive,checked){var ret=[];checked=checked||{};var model=QtiElements.classes[qtiClass];if(model&&model.contains)for(var i in model.contains){var contain=model.contains[i];if(!checked[contain]){checked[contain]=!0,ret.push(contain);var children=QtiElements.getChildClasses(contain,!0);for(var i in children){var child=children[i];checked[child]||(checked[child]=!0,ret.push(child),recursive&&(ret=_.union(ret,QtiElements.getAllowedContents(child,!0,checked))))}recursive&&(ret=_.union(ret,QtiElements.getAllowedContents(contain,!0,checked)))}}var parents=QtiElements.getParentClasses(qtiClass,!0);for(var i in parents)ret=_.union(ret,QtiElements.getAllowedContents(parents[i],recursive,checked));return _.uniq(ret,!1)},QtiElements.isAllowedClass=function(qtiContainerClass,qtiContentClass){var allowedClasses=QtiElements.getAllowedContents(qtiContainerClass);return 0<=_.indexOf(allowedClasses,qtiContentClass)},QtiElements.getParentClasses=function(qtiClass,recursive){var ret;if(recursive&&QtiElements.cache.parents[qtiClass])ret=QtiElements.cache.parents[qtiClass];else{if(ret=[],QtiElements.classes[qtiClass]&&(ret=QtiElements.classes[qtiClass].parents,recursive)){for(var i in ret)ret=_.union(ret,QtiElements.getParentClasses(ret[i],recursive));ret=_.uniq(ret,!1)}QtiElements.cache.parents[qtiClass]=ret}return ret},QtiElements.getChildClasses=function(qtiClass,recursive,type){var ret,cacheType=type?type:"all";if(recursive&&QtiElements.cache.children[qtiClass]&&QtiElements.cache.children[qtiClass][cacheType])ret=QtiElements.cache.children[qtiClass][cacheType];else{for(var aClass in ret=[],QtiElements.classes){var model=QtiElements.classes[aClass];0<=_.indexOf(model.parents,qtiClass)&&(type?model[type]&&ret.push(aClass):ret.push(aClass),recursive&&(ret=_.union(ret,QtiElements.getChildClasses(aClass,recursive,type))))}QtiElements.cache.children[qtiClass]||(QtiElements.cache.children[qtiClass]={}),QtiElements.cache.children[qtiClass][cacheType]=ret}return ret},QtiElements.isBlock=function(qtiClass){return QtiElements.is(qtiClass,"block")},QtiElements.isInline=function(qtiClass){return QtiElements.is(qtiClass,"inline")},QtiElements.is=function(qtiClass,topClass){if(qtiClass===topClass)return!0;var parents=QtiElements.getParentClasses(qtiClass,!0);return 0<=_.indexOf(parents,topClass)},QtiElements.getAvailableAuthoringElements=function(){var tagTitles={commonInteractions:__("Common Interactions"),inlineInteractions:__("Inline Interactions"),graphicInteractions:__("Graphic Interactions")};return{choiceInteraction:{label:__("Choice Interaction"),description:__("Select a single (radio buttons) or multiple (check boxes) responses among a set of choices."),icon:"icon-choice",short:__("Choice"),qtiClass:"choiceInteraction",tags:[tagTitles.commonInteractions,"mcq"],group:"common-interactions"},orderInteraction:{label:__("Order Interaction"),icon:"icon-order",description:__("Arrange a list of choices in the correct order."),short:__("Order"),qtiClass:"orderInteraction",tags:[tagTitles.commonInteractions,"ordering"],group:"common-interactions"},associateInteraction:{label:__("Associate Interaction"),icon:"icon-associate",description:__("Create pair(s) from a series of choices."),short:__("Associate"),qtiClass:"associateInteraction",tags:[tagTitles.commonInteractions,"association"],group:"common-interactions"},matchInteraction:{label:__("Match Interaction"),icon:"icon-match",description:__("Create association(s) between two sets of choices displayed in a table (row and column)."),short:__("Match"),qtiClass:"matchInteraction",tags:[tagTitles.commonInteractions,"association"],group:"common-interactions"},hottextInteraction:{label:__("Hottext Interaction"),icon:"icon-hottext",description:__("Select one or more text parts (hottext) within a text."),short:__("Hottext"),qtiClass:"hottextInteraction",tags:[tagTitles.commonInteractions,"text"],group:"common-interactions"},gapMatchInteraction:{label:__("Gap Match Interaction"),icon:"icon-gap-match",description:__(" Fill in the gaps in a text from a set of choices."),short:__("Gap Match"),qtiClass:"gapMatchInteraction",tags:[tagTitles.commonInteractions,"text","association"],group:"common-interactions"},sliderInteraction:{label:__("Slider Interaction"),icon:"icon-slider",description:__("Select a value within a numerical range."),short:__("Slider"),qtiClass:"sliderInteraction",tags:[tagTitles.commonInteractions,"special"],group:"common-interactions"},extendedTextInteraction:{label:__("Extended Text Interaction"),icon:"icon-extended-text",description:__("Collect open-ended information in one or more text area(s) (strings or numeric values)."),short:__("Extended Text"),qtiClass:"extendedTextInteraction",tags:[tagTitles.commonInteractions,"text"],group:"common-interactions"},uploadInteraction:{label:__("File Upload Interaction"),icon:"icon-upload",description:__("Upload a file (e.g. document, picture...) as a response."),short:__("File Upload"),qtiClass:"uploadInteraction",tags:[tagTitles.commonInteractions,"special"],group:"common-interactions"},mediaInteraction:{label:__("Media Interaction"),icon:"icon-media",description:__("Control the playing parameters (auto-start, loop) of a video or audio file and report the number of time it has been played."),short:__("Media"),qtiClass:"mediaInteraction",tags:[tagTitles.commonInteractions,"media"],group:"common-interactions"},_container:{label:__("Text Block"),icon:"icon-font",description:__("Block contains the content (stimulus) of the item such as text or image. It is also required for Inline Interactions."),short:__("Block"),qtiClass:"_container",tags:[tagTitles.inlineInteractions,"text"],group:"inline-interactions"},inlineChoiceInteraction:{label:__("Inline Choice Interaction"),icon:"icon-inline-choice",description:__("Select a choice from a drop-down list."),short:__("Inline Choice"),qtiClass:"inlineChoiceInteraction",tags:[tagTitles.inlineInteractions,"inline-interactions","mcq"],group:"inline-interactions"},textEntryInteraction:{label:__("Text Entry Interaction"),icon:"icon-text-entry",description:__("Collect open-ended information in a short text input (strings or numeric values)."),short:__("Text Entry"),qtiClass:"textEntryInteraction",tags:[tagTitles.inlineInteractions,"inline-interactions","text"],group:"inline-interactions"},endAttemptInteraction:{label:__("End Attempt Interaction"),icon:"icon-end-attempt",description:__("Trigger the end of the item attempt."),short:__("End Attempt"),qtiClass:"endAttemptInteraction",tags:[tagTitles.inlineInteractions,"inline-interactions","button","submit"],group:"inline-interactions"},hotspotInteraction:{label:__("Hotspot Interaction"),icon:"icon-hotspot",description:__("Select one or more areas (hotspots) displayed on an picture."),short:__("Hotspot"),qtiClass:"hotspotInteraction",tags:[tagTitles.graphicInteractions,"mcq"],group:"graphic-interactions"},graphicOrderInteraction:{label:__("Graphic Order Interaction"),icon:"icon-graphic-order",description:__("Order the areas (hotspots) displayed on a picture."),short:__("Order"),qtiClass:"graphicOrderInteraction",tags:[tagTitles.graphicInteractions,"ordering"],group:"graphic-interactions"},graphicAssociateInteraction:{label:__("Graphic Associate Interaction"),icon:"icon-graphic-associate",description:__("Create association(s) between areas (hotspots) displayed on a picture."),short:__("Associate"),qtiClass:"graphicAssociateInteraction",tags:[tagTitles.graphicInteractions,"association"],group:"graphic-interactions"},graphicGapMatchInteraction:{label:__("Graphic Gap Match Interaction"),icon:"icon-graphic-gap",description:__("Fill in the gaps on a picture with a set of image choices."),short:__("Gap Match"),qtiClass:"graphicGapMatchInteraction",tags:[tagTitles.graphicInteractions,"association"],group:"graphic-interactions"},selectPointInteraction:{label:__("Select Point Interaction"),icon:"icon-select-point",description:__("Position one or more points on a picture (response areas are not displayed)."),short:__("Select Point"),qtiClass:"selectPointInteraction",tags:[tagTitles.graphicInteractions],group:"graphic-interactions"}}},QtiElements}),define("taoQtiItem/portableElementRegistry/factory/ciRegistry",["lodash","taoQtiItem/portableElementRegistry/factory/factory","taoQtiItem/qtiCreator/helper/qtiElements"],function(_,portableElementRegistry,qtiElements){'use strict';return function(){return portableElementRegistry({getAuthoringData:function(typeIdentifier,options){var pciModel;if(options=_.defaults(options||{},{version:0,enabledOnly:!1}),pciModel=this.get(typeIdentifier,options.version),pciModel&&pciModel.creator&&pciModel.creator.hook&&pciModel.creator.icon&&(pciModel.enabled||!options.enabledOnly))return{label:pciModel.label,icon:pciModel.creator.icon.replace(new RegExp("^"+typeIdentifier+"/"),pciModel.baseUrl),short:pciModel.short,description:pciModel.description,qtiClass:"customInteraction."+pciModel.typeIdentifier,tags:_.union(["Custom Interactions"],pciModel.tags),group:"custom-interactions"}}}).on("creatorsloaded",function(){var creators=this.getLatestCreators();_.forEach(creators,function(creator,typeIdentifier){qtiElements.classes["customInteraction."+typeIdentifier]={parents:["customInteraction"],qti:!0}})})}}),define("taoQtiItem/portableElementRegistry/ciRegistry",["lodash","taoQtiItem/portableElementRegistry/factory/ciRegistry","module"],function(_,ciRegistry,module){'use strict';var registry=ciRegistry(),providers=[],config=module.config();return config&&config.providers&&(providers=config.providers),_.each(providers,function(provider){provider.name&&provider.module&®istry.registerProvider(provider.module)}),registry}),define("taoQtiItem/portableElementRegistry/factory/icRegistry",["lodash","taoQtiItem/portableElementRegistry/factory/factory"],function(_,portableElementRegistry){'use strict';return function(){return portableElementRegistry()}}),define("taoQtiItem/portableElementRegistry/icRegistry",["lodash","taoQtiItem/portableElementRegistry/factory/icRegistry","module"],function(_,icRegistry,module){'use strict';var registry=icRegistry(),providers=[],config=module.config();return config&&config.providers&&(providers=config.providers),_.each(providers,function(provider){provider.name&&provider.module&®istry.registerProvider(provider.module)}),registry}),define("taoQtiItem/portableElementRegistry/assetManager/portableAssetStrategy",["taoQtiItem/portableElementRegistry/ciRegistry","taoQtiItem/portableElementRegistry/icRegistry"],function(ciRegistry,icRegistry){'use strict';function getBaseUrlByIdentifier(typeIdentifier){return ciRegistry.get(typeIdentifier)?ciRegistry.getBaseUrl(typeIdentifier):icRegistry.get(typeIdentifier)?icRegistry.getBaseUrl(typeIdentifier):typeIdentifier}return{name:"portableElementLocation",handle:function(url){if(url.file===url.path)return getBaseUrlByIdentifier(url.file);return url.source===url.relative?url.relative.replace(/^(\.\/)?([a-z_0-9]+)\/(.*)/i,function(fullmatch,$1,typeIdentifier,relPath){var runtimeLocation=getBaseUrlByIdentifier(typeIdentifier);return runtimeLocation?runtimeLocation+"/"+relPath:fullmatch}):void 0}}}),define("taoQtiItem/qtiCommonRenderer/renderers/config",["lodash","context","ui/themes","taoItems/assets/manager","taoItems/assets/strategies","module","taoQtiItem/portableElementRegistry/assetManager/portableAssetStrategy"],function(_,context,themes,assetManagerFactory,assetStrategies,module,portableAssetStrategy){'use strict';_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,context=context&&Object.prototype.hasOwnProperty.call(context,"default")?context["default"]:context,themes=themes&&Object.prototype.hasOwnProperty.call(themes,"default")?themes["default"]:themes,assetManagerFactory=assetManagerFactory&&Object.prototype.hasOwnProperty.call(assetManagerFactory,"default")?assetManagerFactory["default"]:assetManagerFactory,assetStrategies=assetStrategies&&Object.prototype.hasOwnProperty.call(assetStrategies,"default")?assetStrategies["default"]:assetStrategies,module=module&&Object.prototype.hasOwnProperty.call(module,"default")?module["default"]:module,portableAssetStrategy=portableAssetStrategy&&Object.prototype.hasOwnProperty.call(portableAssetStrategy,"default")?portableAssetStrategy["default"]:portableAssetStrategy;var itemThemes=themes.get("items"),moduleConfig=module.config(),assetManager=assetManagerFactory([{name:"theme",handle:function(url){if(itemThemes&&url.path&&(url.path===itemThemes.base||_.contains(_.pluck(itemThemes.available,"path"),url.path)))return context.root_url+url.toString()}},assetStrategies.taomedia,assetStrategies.external,assetStrategies.base64,assetStrategies.itemCssNoCache,assetStrategies.baseUrl,portableAssetStrategy],{baseUrl:""}),config={name:"commonRenderer",locations:{assessmentItem:"taoQtiItem/qtiCommonRenderer/renderers/Item",_container:"taoQtiItem/qtiCommonRenderer/renderers/Container",_simpleFeedbackRule:!1,_tooltip:"taoQtiItem/qtiCommonRenderer/renderers/Tooltip",stylesheet:"taoQtiItem/qtiCommonRenderer/renderers/Stylesheet",outcomeDeclaration:!1,responseDeclaration:!1,responseProcessing:!1,img:"taoQtiItem/qtiCommonRenderer/renderers/Img",math:"taoQtiItem/qtiCommonRenderer/renderers/Math",object:"taoQtiItem/qtiCommonRenderer/renderers/Object",table:"taoQtiItem/qtiCommonRenderer/renderers/Table",printedVariable:"taoQtiItem/qtiCommonRenderer/renderers/PrintedVariable",rubricBlock:"taoQtiItem/qtiCommonRenderer/renderers/RubricBlock",modalFeedback:"taoQtiItem/qtiCommonRenderer/renderers/ModalFeedback",prompt:"taoQtiItem/qtiCommonRenderer/renderers/interactions/Prompt",choiceInteraction:"taoQtiItem/qtiCommonRenderer/renderers/interactions/ChoiceInteraction",extendedTextInteraction:"taoQtiItem/qtiCommonRenderer/renderers/interactions/ExtendedTextInteraction",orderInteraction:"taoQtiItem/qtiCommonRenderer/renderers/interactions/OrderInteraction",associateInteraction:"taoQtiItem/qtiCommonRenderer/renderers/interactions/AssociateInteraction",matchInteraction:"taoQtiItem/qtiCommonRenderer/renderers/interactions/MatchInteraction",textEntryInteraction:"taoQtiItem/qtiCommonRenderer/renderers/interactions/TextEntryInteraction",sliderInteraction:"taoQtiItem/qtiCommonRenderer/renderers/interactions/SliderInteraction",inlineChoiceInteraction:"taoQtiItem/qtiCommonRenderer/renderers/interactions/InlineChoiceInteraction","simpleChoice.choiceInteraction":"taoQtiItem/qtiCommonRenderer/renderers/choices/SimpleChoice.ChoiceInteraction","simpleChoice.orderInteraction":"taoQtiItem/qtiCommonRenderer/renderers/choices/SimpleChoice.OrderInteraction",hottext:"taoQtiItem/qtiCommonRenderer/renderers/choices/Hottext",gap:"taoQtiItem/qtiCommonRenderer/renderers/choices/Gap",gapText:"taoQtiItem/qtiCommonRenderer/renderers/choices/GapText","simpleAssociableChoice.matchInteraction":"taoQtiItem/qtiCommonRenderer/renderers/choices/SimpleAssociableChoice.MatchInteraction","simpleAssociableChoice.associateInteraction":"taoQtiItem/qtiCommonRenderer/renderers/choices/SimpleAssociableChoice.AssociateInteraction",inlineChoice:"taoQtiItem/qtiCommonRenderer/renderers/choices/InlineChoice",hottextInteraction:"taoQtiItem/qtiCommonRenderer/renderers/interactions/HottextInteraction",hotspotInteraction:"taoQtiItem/qtiCommonRenderer/renderers/interactions/HotspotInteraction",hotspotChoice:!1,gapMatchInteraction:"taoQtiItem/qtiCommonRenderer/renderers/interactions/GapMatchInteraction",selectPointInteraction:"taoQtiItem/qtiCommonRenderer/renderers/interactions/SelectPointInteraction",graphicOrderInteraction:"taoQtiItem/qtiCommonRenderer/renderers/interactions/GraphicOrderInteraction",mediaInteraction:"taoQtiItem/qtiCommonRenderer/renderers/interactions/MediaInteraction",uploadInteraction:"taoQtiItem/qtiCommonRenderer/renderers/interactions/UploadInteraction",graphicGapMatchInteraction:"taoQtiItem/qtiCommonRenderer/renderers/interactions/GraphicGapMatchInteraction",gapImg:"taoQtiItem/qtiCommonRenderer/renderers/choices/GapImg",graphicAssociateInteraction:"taoQtiItem/qtiCommonRenderer/renderers/interactions/GraphicAssociateInteraction",associableHotspot:!1,customInteraction:"taoQtiItem/qtiCommonRenderer/renderers/interactions/PortableCustomInteraction",infoControl:"taoQtiItem/qtiCommonRenderer/renderers/PortableInfoControl",include:"taoQtiItem/qtiCommonRenderer/renderers/Include",endAttemptInteraction:"taoQtiItem/qtiCommonRenderer/renderers/interactions/EndAttemptInteraction"},options:{assetManager:assetManager,themes:itemThemes,enableDragAndDrop:{associate:!!moduleConfig.associateDragAndDrop,gapMatch:!!moduleConfig.gapMatchDragAndDrop,graphicGapMatch:!!moduleConfig.graphicGapMatchDragAndDrop,order:!!moduleConfig.orderDragAndDrop},messages:moduleConfig.messages}};return config}),define("taoQtiItem/qtiCommonRenderer/renderers/Renderer",["taoQtiItem/qtiRunner/core/Renderer","taoQtiItem/qtiCommonRenderer/renderers/config"],function(Renderer$1,config){'use strict';Renderer$1=Renderer$1&&Object.prototype.hasOwnProperty.call(Renderer$1,"default")?Renderer$1["default"]:Renderer$1,config=config&&Object.prototype.hasOwnProperty.call(config,"default")?config["default"]:config;var Renderer=Renderer$1.build(config.locations,config.name,config.options);return Renderer}),define("taoQtiItem/runner/provider/manager/userModules",["lodash","module"],function(_,module){'use strict';_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,module=module&&Object.prototype.hasOwnProperty.call(module,"default")?module["default"]:module;return{load:function(userModules){var config=module.config();return userModules&&_.isArray(userModules)||(config&&config.userModules&&_.isArray(config.userModules)?userModules=config.userModules:userModules=[]),userModules.length?new Promise(function(resolve,reject){window.require(userModules,function(){_.forEach(arguments,function(dependency){dependency&&_.isFunction(dependency.exec)&&dependency.exec()}),resolve()},function(err){reject(err.message)})}):Promise.resolve()}}}),define("taoQtiItem/runtime/qtiBootstrap",["jquery","lodash","module","taoQtiItem/qtiRunner/core/QtiRunner","taoQtiItem/qtiCommonRenderer/renderers/Renderer","iframeNotifier","core/history","taoQtiItem/runner/provider/manager/userModules"],function($,_,module,QtiRunner,Renderer,iframeNotifier,history,userModules){'use strict';return history.fixBrokenBrowsers(),function(runnerContext){window.onItemApiReady=function(itemApi){var qtiRunner=new QtiRunner,coreItemData=runnerContext.itemData,variableElementsData=_.merge(runnerContext.variableElements,itemApi.params.contentVariables||{}),renderer=new Renderer;window.qtiRunner=qtiRunner,qtiRunner.setItemApi(itemApi),qtiRunner.setRenderer(renderer),qtiRunner.loadItemData(coreItemData,function(){qtiRunner.loadElements(variableElementsData,function(){qtiRunner.renderItem(void 0,function(){var userModulesOverride,config=module.config();config&&config.userModules&&_.isArray(config.userModules)&&0<config.userModules.length&&(userModulesOverride=config.userModules),userModules.load(userModulesOverride).then(function(){_.isArray(runnerContext.userScripts)&&require(runnerContext.userScripts,function(){_.forEach(arguments,function(dependency){_.isFunction(dependency.exec)&&dependency.exec.call(null,runnerContext.userVars)})}),iframeNotifier.parent("itemloaded"),_.defer(function(){window.focus()})}).catch(function(err){throw new Error("Error in user modules : "+err.message)})})})})},_.defer(function(){iframeNotifier.parent("itemready")})}}),define("taoQtiItem/runtime/qtiLoader",["taoQtiItem/runtime/qtiBootstrap","css!taoCss/tao-main-style"],function(qtiBootstrap){'use strict';return{start:function(){var runnerContext=window.tao.qtiRunnerContext;qtiBootstrap(runnerContext)}}}),define("taoQtiItem/loader/qtiLoader.bundle",function(){}),window.bundles=(window.bundles||[]).concat(["taoQtiItem/loader/taoQtiItem.min"]);
|
|
//# sourceMappingURL=qtiLoader.min.js.map
|