tao-test/app/taoQtiItem/views/js/loader/taoQtiItemRunner.min.js

2 lines
605 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 _i=arr[Symbol.iterator](),_s;!(_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)}define("taoQtiItem/qtiCommonRenderer/helpers/ckConfigurator",["ui/ckeditor/ckConfigurator"],function(ckConfigurator$1){'use strict';ckConfigurator$1=ckConfigurator$1&&Object.prototype.hasOwnProperty.call(ckConfigurator$1,"default")?ckConfigurator$1["default"]:ckConfigurator$1;var getConfig=function(editor,toolbarType,options){return options=options||{},options.underline=!0,ckConfigurator$1.getConfig(editor,toolbarType,options)};return{getConfig:getConfig}}),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 i=1,suffix="",exists=!1,id,usedIds;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 suffix="",i=1,exists=!1,id,usedIds;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 found=null,object,body;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 args=rendererConfig.getOptionsFromArguments(arguments),_renderer=args.renderer||this.getRenderer(),tplData={},defaultData={tag:this.qtiClass,serial:this.serial,attributes:this.getAttributes()},rendering;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&&regex.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/qtiCommonRenderer/helpers/container",["lodash","jquery","taoQtiItem/qtiItem/core/Element"],function(_,$,Element){'use strict';_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,$=$&&Object.prototype.hasOwnProperty.call($,"default")?$["default"]:$,Element=Element&&Object.prototype.hasOwnProperty.call(Element,"default")?Element["default"]:Element;var _containers={},_$containerContext=$(),_getSelector=function(element){var serial=element.getSerial(),selector="[data-serial=".concat(serial,"]");return Element.isA(element,"choice")?selector=".qti-choice".concat(selector):Element.isA(element,"interaction")&&(selector=".qti-interaction".concat(selector)),selector};return{setContext:function setContext($scope){_$containerContext=$scope},getContext:function getContext(){return _$containerContext},get:function get(element,$scope){var serial=element.getSerial();return $scope instanceof $&&$scope.length?$scope.find(_getSelector(element)):_$containerContext instanceof $&&_$containerContext.length?_$containerContext.find(_getSelector(element)):(_containers[serial]&&_containers[serial].length||(_containers[serial]=$(_getSelector(element))),_containers[serial])},reset:function reset(element){element instanceof Element&&_containers[element.getSerial()]&&(_containers=_.omit(_containers,element.getSerial()))},clear:function clear(){_containers={},_$containerContext=$()},trigger:function trigger(eventType,element,data){eventType&&(data&&!_.isArray(data)&&(data=[data]),this.get(element).trigger(eventType,data))},triggerResponseChangeEvent:function triggerResponseChangeEvent(interaction,extraData){this.trigger("responseChange",interaction,[{interaction:interaction,response:interaction.getResponse()},extraData])},targetBlank:function targetBlank($container){$container.on("click","a",function(e){e.preventDefault();var href=$(this).attr("href");href&&href.match(/^http/i)&&window.open(href,"_blank")})}}}),define("taoQtiItem/qtiCommonRenderer/helpers/Graphic",["jquery","lodash","raphael","scale.raphael"],function($,_,raphael,scaleRaphael){'use strict';var _Mathround=Math.round,_Mathfloor=Math.floor;$=$&&Object.prototype.hasOwnProperty.call($,"default")?$["default"]:$,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,raphael=raphael&&Object.prototype.hasOwnProperty.call(raphael,"default")?raphael["default"]:raphael,scaleRaphael=scaleRaphael&&Object.prototype.hasOwnProperty.call(scaleRaphael,"default")?scaleRaphael["default"]:scaleRaphael;var gstyle={basic:{stroke:"#8D949E","stroke-width":2,"stroke-dasharray":"","stroke-linejoin":"round",fill:"#cccccc","fill-opacity":.5,cursor:"pointer"},hover:{stroke:"#3E7DA7",fill:"#0E5D91","fill-opacity":.3},selectable:{"stroke-dasharray":"-",stroke:"#3E7DA7",fill:"#cccccc","fill-opacity":.5},active:{stroke:"#3E7DA7","stroke-dasharray":"",fill:"#0E5D91","fill-opacity":.5},error:{stroke:"#C74155","stroke-dasharray":"","fill-opacity":.5,fill:"#661728"},success:{stroke:"#C74155","stroke-dasharray":"",fill:"#0E914B","fill-opacity":.5},layer:{fill:"#ffffff",opacity:0,cursor:"pointer"},creator:{"fill-opacity":.5,stroke:"#3E7DA7","stroke-dasharray":"",fill:"#0E5D91",cursor:"pointer"},"imageset-rect-stroke":{fill:"#ffffff",stroke:"#666666","stroke-width":1,"stroke-linejoin":"round",cursor:"pointer"},"imageset-rect-no-stroke":{fill:"#ffffff",stroke:"#ffffff","stroke-width":2,"stroke-linejoin":"round",cursor:"pointer"},"imageset-img":{cursor:"pointer"},"order-text":{fill:"#ffffff",stroke:"#000000","stroke-width":.7,"font-family":"sans-serif","font-weight":"bold","font-size":22,cursor:"pointer"},"score-text-default":{stroke:"#444444","stroke-width":.5,"font-family":"sans-serif","font-weight":"normal","font-size":20,cursor:"pointer"},"score-text":{stroke:"#000000","stroke-width":.5,"font-family":"sans-serif","font-weight":"normal","font-size":20,cursor:"pointer"},"small-text":{stroke:"#000000","stroke-width":.5,"font-family":"sans-serif","font-weight":"normal","font-size":16,cursor:"pointer"},"layer-pos-text":{stroke:"#333","stroke-width":.5,"font-family":"sans-serif","font-weight":"normal","font-size":14},target:{path:"m 18,8.4143672 -1.882582,0 C 15.801891,4.9747852 13.071059,2.2344961 9.63508,1.9026738 L 9.63508,0 8.2305176,0 l 0,1.9026387 C 4.7947148,2.2343027 2.0637246,4.9746621 1.7481973,8.4143672 l -1.7481973,0 0,1.4045625 1.754877,0 c 0.3460429,3.4066753 3.0632871,6.1119843 6.4756406,6.4413813 l 0,1.739689 1.4045624,0 0,-1.739725 c 3.412547,-0.329537 6.129633,-3.034793 6.475641,-6.4413453 l 1.889279,0 z m -8.36492,6.5188648 0,-4.064673 -1.4045624,0 0,4.063882 C 5.5511016,14.612555 3.4232695,12.494619 3.0864551,9.8189297 l 4.0449512,0 0,-1.4045625 -4.0546368,0 C 3.3788672,5.6984941 5.5228887,3.5393379 8.2305176,3.2161113 l 0,3.9153125 1.4045624,0 0,-3.9160859 c 2.711162,0.3203965 4.858576,2.4808887 5.160955,5.1990293 l -3.927441,0 0,1.4045625 3.917773,0 C 14.449289,12.496957 12.318363,14.616158 9.63508,14.933232 z",fill:"#0E914B",width:1,"stroke-width":0,cursor:"pointer"},"target-hover":{fill:"#3E7DA7","fill-opacity":1},"target-success":{fill:"#0E914B","fill-opacity":1},assoc:{"stroke-width":2,"stroke-linecap":"round",cursor:"pointer"},"assoc-layer":{"stroke-width":12,cursor:"pointer","stroke-opacity":0},"assoc-bullet":{fill:"#000000"},close:{path:"m 8.9997236,18.000001 c -4.9703918,0 -8.99972284217367,-4.02901 -8.99972284217367,-9 C 7.5782633e-7,4.029011 4.0293108,9.8531742e-7 8.9997236,9.8531742e-7 13.970691,9.8531742e-7 18.000001,4.029011 18.000001,9.000001 c 0,4.97099 -4.02931,9 -9.0002774,9 z m 0.0045,-16.37151 c -4.06191,0 -7.35492,3.29635 -7.35492,7.36251 0,4.06562 3.292989,7.36255 7.35492,7.36255 4.0630384,0 7.3554334,-3.29693 7.3554334,-7.36255 0,-4.06614 -3.292969,-7.36251 -7.3554334,-7.36251 v 0 z m 3.1314894,9.31167 -1.953823,-1.94014 1.953843,-1.94018 c 0.08964,-0.089 0.134622,-0.19099 0.135073,-0.30584 4.31e-4,-0.11488 -0.04383,-0.21712 -0.132838,-0.30681 l -0.54267,-0.54685 c -0.08898,-0.0897 -0.190903,-0.13473 -0.305719,-0.13514 -0.114837,-4.4e-4 -0.217064,0.0439 -0.306703,0.1329 l -1.9623724,1.94865 -1.962395,-1.94865 c -0.08964,-0.089 -0.191845,-0.13336 -0.306702,-0.1329 -0.114837,4.3e-4 -0.216736,0.0455 -0.305719,0.13514 l -0.54265,0.54685 c -0.08902,0.0897 -0.133269,0.19193 -0.132838,0.30681 4.3e-4,0.11485 0.04543,0.21681 0.135073,0.30584 l 1.953823,1.94018 -1.953782,1.94014 c -0.0896,0.089 -0.134684,0.19094 -0.135114,0.3058 -4.31e-4,0.11486 0.04386,0.21716 0.132838,0.30681 l 0.542671,0.54687 c 0.08896,0.0897 0.190923,0.13467 0.305718,0.13516 0.114857,3.9e-4 0.217105,-0.0439 0.306724,-0.13288 l 1.962332,-1.94863 1.9623324,1.94863 c 0.08962,0.089 0.191886,0.13323 0.306744,0.13288 0.114836,-4.5e-4 0.216736,-0.0455 0.305698,-0.13516 l 0.542691,-0.54687 c 0.089,-0.0897 0.133227,-0.19193 0.132838,-0.30681 -3.9e-4,-0.1149 -0.0455,-0.21683 -0.135073,-0.3058 z",fill:"#0E5D91",width:1,opacity:0,"stroke-width":0,cursor:"pointer"},"close-bg":{fill:"#ffffff",stroke:"none",cursor:"pointer",opacity:0},"touch-circle":{fill:"none",stroke:"#3E7DA7","stroke-width":2}},shapeMap={default:"rect",poly:"path"},coordsValidator={rect:4,ellipse:4,circle:3,poly:6,default:0},qti2raphCoordsMapper={rect:function rect(coords){return[coords[0],coords[1],coords[2]-coords[0],coords[3]-coords[1]]},default:function _default(paper){return[0,0,paper.width,paper.height]},poly:function poly(coords){var size=coords.length,a;for(coords[0]!==coords[size-2]&&coords[1]!==coords[size-1]&&(coords.push(coords[0]),coords.push(coords[1])),coords[0]="M"+coords[0],a=1;a<size;a++)0==a%2&&(coords[a]="L"+coords[a]);return[coords.join(" ")]}},raph2qtiCoordsMapper={rect:function rect(attr){return[attr.x,attr.y,attr.x+attr.width,attr.y+attr.height]},circle:function circle(attr){return[attr.cx,attr.cy,attr.r]},ellipse:function ellipse(attr){return[attr.cx,attr.cy,attr.rx,attr.ry]},default:function _default(attr){return this.rect(attr)},path:function path(attr){var poly=[],i;if(_.isArray(attr.path))for(i=1;i<attr.path.length;i++)3===attr.path[i].length&&(poly.push(attr.path[i][1]),poly.push(attr.path[i][2]));return poly}};return{_style:gstyle,setStyle:function setStyle(element,name){element&&gstyle[name]&&element.attr(gstyle[name])},responsivePaper:function responsivePaper(id,serial,options){function resizePaper(e,givenWidth){var diff,maxWidth,containerWidth,containerHeight,factor;e&&e.stopPropagation(),diff=$editor.outerWidth()-$editor.width()+($container.outerWidth()-$container.width())+1,maxWidth=$body.width(),containerWidth=$container.innerWidth(),(0<containerWidth||0<givenWidth)&&(givenWidth<containerWidth&&givenWidth<maxWidth?containerWidth=givenWidth-diff:containerWidth>maxWidth?containerWidth=maxWidth-diff:containerWidth-=diff,factor=containerWidth/imgWidth,containerHeight=imgHeight*factor,0<containerWidth&&paper.changeSize(containerWidth,containerHeight,!1,!1),"function"==typeof options.resize&&options.resize(containerWidth,factor),$container.trigger("resized.qti-widget"))}var $container=options.container||$("#"+id).parent(),$editor=$(".image-editor",$container),$body=$container.closest(".qti-itemBody"),resizer=_.throttle(resizePaper,10),imgWidth=options.width||$container.innerWidth(),imgHeight=options.height||$container.innerHeight(),paper,image;return paper=scaleRaphael(id,imgWidth,imgHeight),image=paper.image(options.img,0,0,imgWidth,imgHeight),image.id=options.imgId||image.id,paper.setViewBox(0,0,imgWidth,imgHeight),resizer(),$(image.node).attr("externalResourcesRequired","true").on("load",resizer),"SVG"===raphael.type?($(window).on("resize.qti-widget."+serial,resizer),$container.on("resize.qti-widget."+serial,resizer),$(document).on("customcssloaded.styleeditor",resizer)):($container.find(".main-image-box").width(imgWidth),"function"==typeof options.resize&&options.resize(imgWidth,1)),paper},createElement:function createElement(paper,type,coords,options){var self=this,shaper=shapeMap[type]?paper[shapeMap[type]]:paper[type],shapeCoords=!1===options.qtiCoords?coords:self.raphaelCoords(paper,type,coords),element;if("function"==typeof shaper)element=shaper.apply(paper,shapeCoords),element&&(options.id&&(element.id=options.id),options.title&&element.attr("title",options.title),element.attr(gstyle[options.style||"basic"]).toFront(),$(element.node).removeAttr("stroke-dasharray"),!1!==options.hover&&element.hover(function(){element.flashing||self.updateElementState(this,"hover")},function(){element.flashing||self.updateElementState(this,this.active?"active":this.selectable?"selectable":"basic")}),!1!==options.touchEffect&&element.touchstart(function(){self.createTouchCircle(paper,element.getBBox())}));else throw new Error("Unable to find method "+type+" on paper");return element},createTarget:function(paper,options){var baseSize,count,factor,half,hover,layer,point,self,tBBox,targetSize,x,y,target;return options=options||{},self=this,point=options.point||{x:0,y:0},factor=0===paper.w?1:paper.width/paper.w,hover="undefined"==typeof options.hover||!!options.hover,baseSize=18,half=baseSize/2,x=point.x-half,y=point.y-half,targetSize=0===factor?2:2/factor,target=paper.path(gstyle.target.path).transform("t"+x+","+y+"s"+targetSize).attr(gstyle.target).attr("title",_("Click again to remove")),options.id?target.id=options.id:(count=0,paper.forEach(function(element){element.data("target")&&count++}),target.id="target-"+count),tBBox=target.getBBox(),layer=paper.rect(tBBox.x,tBBox.y,tBBox.width,tBBox.height).attr(gstyle.layer).click(function(){var id=target.id,p=this.data("point");_.isFunction(options.select)&&options.select(target,p,this),_.isFunction(options.remove)&&(this.remove(),target.remove(),options.remove(id,p))}),hover&&layer.hover(function(){target.flashing||self.setStyle(target,"target-hover")},function(){target.flashing||self.setStyle(target,"target-success")}),layer.id="layer-"+target.id,layer.data("point",point),target.data("target",point),_.isFunction(options.create)&&options.create(target),target},raphaelCoords:function(paper,type,coords){var shapeCoords;if(_.isString(coords)&&(coords=_.map(coords.split(","),function(coord){return parseInt(coord,10)})),!_.isArray(coords)||coords.length<coordsValidator[type])throw new Error("Invalid coords "+JSON.stringify(coords)+" for type "+type);return shapeCoords="rect"===type?qti2raphCoordsMapper.rect(coords):"default"===type?qti2raphCoordsMapper["default"].call(null,paper):"poly"===type?qti2raphCoordsMapper.poly(coords):coords,shapeCoords},qtiCoords:function(element){var mapper=raph2qtiCoordsMapper[element.type],result="";return _.isFunction(mapper)&&(result=_.map(mapper.call(raph2qtiCoordsMapper,element.attr()),function(coord){return _.parseInt(coord)}).join(",")),result},createTouchCircle:function createTouchCircle(paper,bbox){var radius=bbox.width>bbox.height?bbox.width:bbox.height,tCircle=paper.circle(bbox.x+bbox.width/2,bbox.y+bbox.height/2,radius);tCircle.attr(gstyle["touch-circle"]),_.defer(function(){tCircle.animate({r:radius+5,opacity:.7},300,function(){tCircle.remove()})})},createText:function createText(paper,options){var top=options.top||0,left=options.left||0,content=options.content||"",style=options.style||"small-text",title=options.title||"",factor=1,fontSize,scaledFontSize,text;return paper.width&&paper.w&&(factor=paper.width/paper.w),text=paper.text(left,top,content).toFront(),options.id&&(text.id=options.id),options.hide&&text.hide(),text.attr(gstyle[style]),"undefined"!=typeof factor&&1!==factor&&(fontSize=parseInt(text.attr("font-size"),10),scaledFontSize=_Mathfloor(fontSize/factor)+1,text.attr("font-size",scaledFontSize)),title&&this.updateTitle(text,title),text},createShapeText:function createShapeText(paper,shape,options){var self=this,bbox=shape.getBBox(),text=this.createText(paper,_.merge({left:bbox.x+bbox.width/2,top:bbox.y+bbox.height/2},options));return options.shapeClick&&text.click(function(){self.trigger(shape,"click")}),text},createBorderedImage:function createBorderedImage(paper,options){var padding=0<=options.padding?options.padding:6,halfPad=padding/2,rx=options.left,ry=options.top,rw=options.width+padding,rh=options.height+padding,ix=options.left+halfPad,iy=options.top+halfPad,iw=options.width,ih=options.height,set=paper.set(),rect=paper.rect(rx,ry,rw,rh).attr(options.border?gstyle["imageset-rect-stroke"]:gstyle["imageset-rect-no-stroke"]),image=paper.image(options.url,ix,iy,iw,ih).attr(gstyle["imageset-img"]);return options.shadow&&set.push(rect.glow({width:2,offsetx:1,offsety:1})),set.push(rect,image),set.move=function(x,y,duration){var animation=raphael.animation({x:x,y:y},duration||400),elt=rect.animate(animation);return image.animateWith(elt,animation,{x:x+halfPad,y:y+halfPad},duration||400),set},set},updateElementState:function updateElementState(element,state,title){element&&element.animate&&(element.animate(gstyle[state],200,"linear",function(){element.attr(gstyle[state]),$(element.node).removeAttr("stroke-dasharray")}),title&&this.updateTitle(element,title))},updateTitle:function updateTitle(element,title){element&&element.node&&(_.forEach(element.node.children,function(child){"title"===child.nodeName.toLowerCase()&&element.node.removeChild(child)}),element.attr("title",title))},highlightError:function highlightError(element,restoredState){var self=this;element&&(element.flashing=!0,self.updateElementState(element,"error"),_.delay(function(){self.updateElementState(element,restoredState||"basic"),element.flashing=!1},800))},trigger:function trigger(element,event){var evt=_.where(element.events,{name:event});evt.length&&evt[0]&&"function"==typeof evt[0].f&&evt[0].f.apply(element,Array.prototype.slice.call(arguments,2))},getPoint:function(event,paper,$container){var point=this.clickPoint($container,event),rect=$container.get(0).getBoundingClientRect(),factor=paper.w/rect.width;return point.x=_Mathround(point.x*factor),point.y=_Mathround(point.y*factor),point},position:function position($container,paper){var pw=parseInt(paper.w||paper.width,10),cw=parseInt($container.width(),10),ph=parseInt(paper.w||paper.width,10),ch=parseInt($container.height(),10);return{left:(cw-pw)/2,top:(ch-ph)/2}},clickPoint:function clickPoint($container,event){var offset=$container.offset(),x,y;return event.pageX||event.pageY?(x=event.pageX-offset.left,y=event.pageY-offset.top):(event.clientX||event.clientY)&&(x=event.clientX+document.body.scrollLeft+document.documentElement.scrollLeft-offset.left,y=event.clientY+document.body.scrollTop+document.documentElement.scrollTop-offset.top),{x:x,y:y}}}}),define("taoQtiItem/qtiCommonRenderer/helpers/instructions/Instruction",["lodash","taoQtiItem/qtiItem/helper/util","handlebars","i18n","lib/dompurify/purify"],function(_,util,Handlebars,__,DOMPurify){'use strict';function instructionTpl(data,options,asString){var html=Template(data,options);return asString||!0?html:$(html)}_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,util=util&&Object.prototype.hasOwnProperty.call(util,"default")?util["default"]:util,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;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){function program1(depth0){var buffer="",stack1;return buffer+=" lang=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"",buffer}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,self=this,stack1,helper;return buffer+="<div id=\"",(helper=helpers.serial)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.serial,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\" class=\"small feedback-info item-instruction\"",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),{hash:{},inverse:self.noop,fn:self.program(1,program1,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+=">\n <span class=\"icon-info icon\"></span><span class=\"instruction-message\">",(helper=helpers.message)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.message,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"</span>\n</div>",buffer}),_notificationLevels=["info","warning","error","success"],Instruction=function(interaction,message,callback){this.interaction=interaction,this.defaultMessage=message||"",this.currentMessage="",this.level="info",this.serial=util.buildSerial("instruction_"),this.callback=callback,this.$dom=null,this.state=!1};return Instruction.isValidLevel=function(level){return 0<=_.indexOf(_notificationLevels,level)},Instruction.prototype.setState=function(state){this.state=state},Instruction.prototype.checkState=function(state){return this.state===state},Instruction.prototype.getId=function(){return this.serial},Instruction.prototype.create=function($container){$container.append(instructionTpl({message:this.defaultMessage,serial:this.serial})),this.$dom=$container.find("#"+this.serial)},Instruction.prototype.update=function(options){var level=options&&options.level?options.level:"",message=options&&options.message?options.message:"",timeout=options&&options.timeout?options.timeout:0,start=options&&"function"==typeof options.start?options.start:null,stop=options&&"function"==typeof options.stop?options.stop:null;if(level&&Instruction.isValidLevel(level)&&(this.$dom.removeClass("feedback-"+this.level).addClass("feedback-"+level),this.$dom.find(".icon").removeClass("icon-"+this.level).addClass("icon-"+level),this.level=level),message&&(this.$dom.find(".instruction-message").html(message),this.currentMessage=message),timeout){var _this=this;start&&start.call(_this),_this.timer=setTimeout(function(){stop&&stop.call(_this),_this.timer=null},timeout)}},Instruction.prototype.setLevel=function(level,timeout){var options={level:level};timeout&&(options.timeout=parseInt(timeout),options.stop=function(){this.setLevel("info")}),this.update(options)},Instruction.prototype.getLevel=function(){return this.level},Instruction.prototype.setMessage=function(message,timeout){this.update({message:message,timeout:timeout})},Instruction.prototype.reset=function(){this.update({level:"info",message:this.defaultMessage}),this.state=!1},Instruction.prototype.validate=function(data){"function"==typeof this.callback&&this.callback.call(this,data)},Instruction}),define("taoQtiItem/qtiCommonRenderer/helpers/instructions/instructionManager",["lodash","jquery","i18n","taoQtiItem/qtiCommonRenderer/helpers/container","taoQtiItem/qtiCommonRenderer/helpers/instructions/Instruction","handlebars","lib/dompurify/purify"],function(_,$$1,__,containerHelper,Instruction,Handlebars,DOMPurify){'use strict';function notifTpl(data,options,asString){var html=Template(data,options);return asString||!0?html:$(html)}_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,$$1=$$1&&Object.prototype.hasOwnProperty.call($$1,"default")?$$1["default"]:$$1,__=__&&Object.prototype.hasOwnProperty.call(__,"default")?__["default"]:__,containerHelper=containerHelper&&Object.prototype.hasOwnProperty.call(containerHelper,"default")?containerHelper["default"]:containerHelper,Instruction=Instruction&&Object.prototype.hasOwnProperty.call(Instruction,"default")?Instruction["default"]:Instruction,Handlebars=Handlebars&&Object.prototype.hasOwnProperty.call(Handlebars,"default")?Handlebars["default"]:Handlebars,DOMPurify=DOMPurify&&Object.prototype.hasOwnProperty.call(DOMPurify,"default")?DOMPurify["default"]:DOMPurify;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){function program1(depth0){var buffer="",stack1;return buffer+=" lang=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"",buffer}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,self=this,helperMissing=helpers.helperMissing,stack1,helper,options;return buffer+="<div class=\"small feedback-",(helper=helpers.level)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.level,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+" item-notification\"",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),{hash:{},inverse:self.noop,fn:self.program(1,program1,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+=">\n <span class=\"icon-",(helper=helpers.level)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.level,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\"></span><span class=\"feedback-message\">",(helper=helpers.message)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.message,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"</span>\n <span title=\""+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"Remove Message",options):helperMissing.call(depth0,"__","Remove Message",options)))+"\" class=\"icon-close close-trigger\"></span>\n</div>\n",buffer}),_instructions={};return{validateInstructions:function validateInstructions(element,data){var serial=element.getSerial();_instructions[serial]&&_.each(_instructions[serial],function(instruction){instruction.validate(data||{})})},appendInstruction:function appendInstruction(element,message,validateCallback){var serial=element.getSerial(),instruction=new Instruction(element,message,validateCallback);return _instructions[serial]||(_instructions[serial]={}),_instructions[serial][instruction.getId()]=instruction,instruction.create($$1(".instruction-container",containerHelper.get(element))),instruction},removeInstructions:function removeInstructions(element){_instructions[element.getSerial()]={},containerHelper.get(element).find(".instruction-container").empty()},resetInstructions:function resetInstructions(element){var serial=element.getSerial();_instructions[serial]&&_.each(_instructions[serial],function(instruction){instruction.reset()})},minMaxChoiceInstructions:function minMaxChoiceInstructions(interaction,options){var self=this,min=options.min||0,max=options.max||0,getResponse=options.getResponse,onError=options.onError||_.noop(),choiceCount=!1!==options.choiceCount&&_.size(interaction.getChoices()),minInstructionSet=!1,msg;if(!_.isFunction(getResponse))throw"invalid parameter getResponse";0<max&&(!1===choiceCount||max<choiceCount)&&(max===min?(minInstructionSet=!0,msg=1>=max?__("You must select exactly %d choice",max):__("You must select exactly %d choices",max),self.appendInstruction(interaction,msg,function(data){getResponse(interaction).length>=max?(this.setLevel("success"),this.checkState("fulfilled")&&this.update({level:"warning",message:__("Maximum choices reached"),timeout:2e3,start:function start(){onError(data)},stop:function stop(){this.update({level:"success",message:msg})}}),this.setState("fulfilled")):this.reset()})):max>min&&(msg=1>=max?__("You can select maximum %d choice",max):__("You can select maximum %d choices",max),self.appendInstruction(interaction,msg,function(data){getResponse(interaction).length>=max?(this.setLevel("success"),this.setMessage(__("Maximum choices reached")),this.checkState("fulfilled")&&this.update({level:"warning",timeout:2e3,start:function start(){onError(data)},stop:function stop(){this.setLevel("info")}}),this.setState("fulfilled")):this.reset()}))),!minInstructionSet&&0<min&&(!1===choiceCount||min<choiceCount)&&(msg=1>=min?__("You must select at least %d choice",min):__("You must select at least %d choices",min),self.appendInstruction(interaction,msg,function(){getResponse(interaction).length>=min?this.setLevel("success"):this.reset()}))},appendNotification:function appendNotification(element,message,level){if(level=level||"info",Instruction.isValidLevel(level)){var $container=containerHelper.get(element);$container.find(".notification-container").prepend(notifTpl({level:level,message:message}));var $notif=$container.find(".item-notification:first"),_remove=function(){$notif.fadeOut()};return $notif.find(".close-trigger").on("click",_remove),setTimeout(_remove,2e3),$notif}},removeNotifications:function removeNotifications(element){containerHelper.get(element).find(".item-notification").remove()}}}),define("taoQtiItem/qtiCommonRenderer/helpers/itemStylesheetHandler",["jquery","lodash"],function($,_){'use strict';$=$&&Object.prototype.hasOwnProperty.call($,"default")?$["default"]:$,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_;var informLoaded=_.throttle(function(){$(document).trigger("customcssloaded.styleeditor",[{}])},10,{leading:!1}),attach=function(stylesheets){var $head=$("head");$head.length||($head=$("body")),_(stylesheets).forEach(function(stylesheet){var $link,href;stylesheet.attr("href")&&($link=$(stylesheet.render()),href=$link.attr("href"),$link.removeAttr("href").attr("href",href),$link.one("load",informLoaded).appendTo($head))})},detach=function(stylesheets){_(stylesheets).forEach(function(stylesheet){stylesheet.serial&&$("link[data-serial=\""+stylesheet.serial+"\"]").remove()})};return{attach:attach,detach:detach}}),define("taoQtiItem/qtiCommonRenderer/helpers/patternMask",[],function(){'use strict';return{parsePattern:function(pattern,type){if(pattern===void 0||null===pattern)return null;if("words"===type){var result=pattern.match(/\^\(\?\:\(\?\:\[\^\\s\\:\\!\\\?\\\;\\\…\\\€\]\+\)\[\\s\\:\\!\\\?\\;\\\…\\\€\]\*\)\{\d+\,(\d+)\}\$/);return null!==result&&1<result.length?result[1]:null}if("chars"===type){var result=pattern.match(/\^\[\\s\\S\]\{\d+\,(\d+)\}\$/);return null!==result&&1<result.length?result[1]:null}return null},createMaxWordPattern:function(max){return"^(?:(?:[^\\s\\:\\!\\?\\;\\\u2026\\\u20AC]+)[\\s\\:\\!\\?\\;\\\u2026\\\u20AC]*){0,"+max.toString()+"}$"},createMaxCharPattern:function(max){return"^[\\s\\S]{0,"+max.toString()+"}$"}}}),define("taoQtiItem/qtiCommonRenderer/helpers/PciPrettyPrint",["lodash"],function(_){'use strict';function printBase(value,withType){var print="",base=value.base;if(withType="undefined"==typeof withType||withType,base)return _.forIn(_formatters,function(formatter,baseType){if(void 0!==base[baseType])return print+=withType?"("+baseType+") ":"",print+=formatter(base[baseType]),!1}),print}function printList(value,withType){var print="",list=value.list;if(withType="undefined"==typeof withType||withType,list)return _.forIn(_formatters,function(formatter,baseType){if(void 0!==list[baseType])return print+=withType?"("+baseType+") ":"",print+="[",_.each(list[baseType],function(value){print+=formatter(value)+", "}),_.size(list[baseType])&&(print=print.substring(0,print.length-2)),print+="]",!1}),print}_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_;var _formatters={boolean:function boolean(value){return value?"true":"false"},integer:function integer(value){return value},float:function float(value){return value},string:function string(value){return""===value?"NULL":"\""+value+"\""},point:function point(value){return"["+value[0]+", "+value[1]+"]"},pair:function pair(value){return"["+value[0]+", "+value[1]+"]"},directedPair:function directedPair(value){return"["+value[0]+", "+value[1]+"]"},duration:function duration(value){return value},file:function file(){return"binary data"},uri:function uri(value){return value},intOrIdentifier:function intOrIdentifier(value){return value},identifier:function identifier(value){return value}};return{printBase:printBase,printList:printList,printRecord:function(value){return value&&value.record?"(record) "+JSON.stringify(value.record):""}}}),define("taoQtiItem/qtiCommonRenderer/helpers/PciResponse",["lodash","taoQtiItem/qtiCommonRenderer/helpers/PciPrettyPrint"],function(_,pciPrettyPrint){'use strict';_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,pciPrettyPrint=pciPrettyPrint&&Object.prototype.hasOwnProperty.call(pciPrettyPrint,"default")?pciPrettyPrint["default"]:pciPrettyPrint;var _qtiModelPciResponseCardinalities={single:"base",multiple:"list",ordered:"list",record:"record"};return{unserialize:function unserialize(response,interaction){var ret=[],responseDeclaration=interaction.getResponseDeclaration(),baseType=responseDeclaration.attr("baseType"),cardinality=responseDeclaration.attr("cardinality"),mappedCardinality;if(_qtiModelPciResponseCardinalities[cardinality]){mappedCardinality=_qtiModelPciResponseCardinalities[cardinality];var responseValues=response[mappedCardinality];if(null===responseValues)ret=[];else if(!_.isObject(responseValues))throw"invalid response cardinality, expected "+cardinality+" ("+mappedCardinality+")";else if(void 0!==responseValues[baseType])ret=responseValues[baseType],ret=_.isArray(ret)?ret:[ret];else throw"invalid response baseType"}else throw"unknown cardinality in the responseDeclaration of the interaction";return ret},serialize:function serialize(responseValues,interaction){if(!_.isArray(responseValues))throw"invalid argument : responseValues must be an Array";var response={},responseDeclaration=interaction.getResponseDeclaration(),baseType=responseDeclaration.attr("baseType"),cardinality=responseDeclaration.attr("cardinality"),mappedCardinality;if(responseValues=_.map(responseValues||[],function(v){return"boolean"===baseType?!0===v||"true"===v:v}),_qtiModelPciResponseCardinalities[cardinality])mappedCardinality=_qtiModelPciResponseCardinalities[cardinality],"base"===mappedCardinality?0===responseValues.length?response.base=null:(response.base={},response.base[baseType]=responseValues[0]):(response[mappedCardinality]={},response[mappedCardinality][baseType]=responseValues);else throw"unknown cardinality in the responseDeclaration of the interaction";return response},isEmpty:function isEmpty(response){return null===response||_.isEmpty(response)||null===response.base||_.isArray(response.list)&&_.isEmpty(response.list)||_.isArray(response.record)&&_.isEmpty(response.record)},prettyPrint:function prettyPrint(response){var print="";if("undefined"!=typeof response.base)print+=pciPrettyPrint.printBase(response,!0);else if("undefined"!=typeof response.list)print+=pciPrettyPrint.printList(response,!0);else if("undefined"!=typeof response.record)print+=pciPrettyPrint.printRecord(response,!0);else throw"Not a valid PCI JSON Response";return print}}}),define("taoQtiItem/qtiCommonRenderer/helpers/PortableElement",[],function(){'use strict';return{fixMarkupMediaSources:function(html,renderer){return html=html||"",html.replace(/(<img[^>]*src=["'])([^"']+)(["'])/gi,function(substr,$1,$2,$3){var resolved=renderer.resolveUrl($2)||$2;return $1+resolved+$3})}}}),define("taoQtiItem/qtiCommonRenderer/helpers/sizeAdapter",["jquery","util/adaptSize","ui/waitForMedia"],function($,_adaptSize){'use strict';$=$&&Object.prototype.hasOwnProperty.call($,"default")?$["default"]:$,_adaptSize=_adaptSize&&Object.prototype.hasOwnProperty.call(_adaptSize,"default")?_adaptSize["default"]:_adaptSize;return{adaptSize:function adaptSize(target){var $elements,$container;switch(!0){case"undefined"!=typeof target.$container:$elements=target.$container.find(".add-option, .result-area .target, .choice-area .qti-choice"),$container=target.$container;break;default:$elements=target,$container=$($elements).first().parent();}$container.waitForMedia(function(){_adaptSize.height($elements),document.addEventListener("load",function(e){e.target&&"stylesheet"===e.target.rel&&_adaptSize.height($elements)},!0)})}}}),define("taoQtiItem/qtiCommonRenderer/helpers/uploadMime",["lodash","i18n","core/mimetype/definitions"],function(_,__,mimeTypes){'use strict';_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,__=__&&Object.prototype.hasOwnProperty.call(__,"default")?__["default"]:__,mimeTypes=mimeTypes&&Object.prototype.hasOwnProperty.call(mimeTypes,"default")?mimeTypes["default"]:mimeTypes;var uploadMime={getMimeTypes:function(){return mimeTypes.getList(__)},setExpectedTypes:function(interaction,types){var classes=interaction.attr("class")||"";classes=classes.replace(/x-tao-upload-type-[-_a-zA-Z+.0-9]*/g,"").trim(),interaction.attr("class",classes),interaction.removeAttr("type");types&&(1===types.length?"any/kind"!==types[0]&&interaction.attr("type",types[0]):(interaction.attr("class",_.reduce(types,function(acc,selectedType){return acc+" x-tao-upload-type-"+selectedType.replace("/","_")},classes).trim()),interaction.attr("type",types.join(" "))))},getExpectedTypes:function(interaction,includeEquivalents){var equivalents=[],types=[],mimes;return interaction.attr("type")&&(types=interaction.attr("type").split(" ")),!0===includeEquivalents&&(mimes=uploadMime.getMimeTypes(),_.forEach(types,function(mime){var mimeData=_.find(mimes,{mime:mime});mimeData&&_.isArray(mimeData.equivalent)&&(equivalents=_.union(equivalents,mimeData.equivalent))})),_.union(types,equivalents)}};return uploadMime}),define("taoQtiItem/qtiCommonRenderer/renderers/choices/Gap",["handlebars","i18n","lodash","lib/dompurify/purify","taoQtiItem/qtiCommonRenderer/helpers/container"],function(Handlebars,__,_,DOMPurify,containerHelper){'use strict';Handlebars=Handlebars&&Object.prototype.hasOwnProperty.call(Handlebars,"default")?Handlebars["default"]:Handlebars,__=__&&Object.prototype.hasOwnProperty.call(__,"default")?__["default"]:__,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,DOMPurify=DOMPurify&&Object.prototype.hasOwnProperty.call(DOMPurify,"default")?DOMPurify["default"]:DOMPurify,containerHelper=containerHelper&&Object.prototype.hasOwnProperty.call(containerHelper,"default")?containerHelper["default"]:containerHelper;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){function program1(depth0){var buffer="",stack1;return buffer+=" lang=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"",buffer}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,self=this,stack1,helper;return buffer+="<span class=\"qti-choice qti-gap\" data-identifier=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.identifier),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\" data-serial=\"",(helper=helpers.serial)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.serial,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\"",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),{hash:{},inverse:self.noop,fn:self.program(1,program1,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+=">\r\n <span data-identifier=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.identifier),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\" class=\"gapmatch-content\">&nbsp;</span>\r\n</span>",buffer}),Gap={qtiClass:"gap",getContainer:containerHelper.get,template:function(data,options,asString){var html=Template(data,options);return asString||!0?html:$(html)}};return Gap}),define("taoQtiItem/qtiCommonRenderer/renderers/choices/GapImg",["handlebars","i18n","lodash","lib/dompurify/purify","taoQtiItem/qtiCommonRenderer/helpers/container"],function(Handlebars,__,_,DOMPurify,containerHelper){'use strict';Handlebars=Handlebars&&Object.prototype.hasOwnProperty.call(Handlebars,"default")?Handlebars["default"]:Handlebars,__=__&&Object.prototype.hasOwnProperty.call(__,"default")?__["default"]:__,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,DOMPurify=DOMPurify&&Object.prototype.hasOwnProperty.call(DOMPurify,"default")?DOMPurify["default"]:DOMPurify,containerHelper=containerHelper&&Object.prototype.hasOwnProperty.call(containerHelper,"default")?containerHelper["default"]:containerHelper;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){function program1(depth0){var buffer="",stack1;return buffer+=" lang=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"",buffer}function program3(depth0){var buffer="",stack1;return buffer+="alt=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.objetLabel),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\" ",buffer}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,self=this,stack1,helper;return buffer+="<li class=\"qti-choice qti-gapImg selectable\" data-identifier=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.identifier),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\" data-serial=\"",(helper=helpers.serial)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.serial,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\"",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),{hash:{},inverse:self.noop,fn:self.program(1,program1,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+=">\n <img src=\""+escapeExpression((stack1=(stack1=(stack1=depth0&&depth0.object,null==stack1||!1===stack1?stack1:stack1.attributes),null==stack1||!1===stack1?stack1:stack1.data),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\" \n width=\""+escapeExpression((stack1=(stack1=(stack1=depth0&&depth0.object,null==stack1||!1===stack1?stack1:stack1.attributes),null==stack1||!1===stack1?stack1:stack1.width),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"\n height=\""+escapeExpression((stack1=(stack1=(stack1=depth0&&depth0.object,null==stack1||!1===stack1?stack1:stack1.attributes),null==stack1||!1===stack1?stack1:stack1.height),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"\n ",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.objectLabel),{hash:{},inverse:self.noop,fn:self.program(3,program3,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n />\n</li>",buffer}),GapImg={qtiClass:"gapImg",getContainer:containerHelper.get,template:function(data,options,asString){var html=Template(data,options);return asString||!0?html:$(html)}};return GapImg}),define("taoQtiItem/qtiCommonRenderer/renderers/choices/GapText",["handlebars","i18n","lodash","lib/dompurify/purify","taoQtiItem/qtiCommonRenderer/helpers/container"],function(Handlebars,__,_,DOMPurify,containerHelper){'use strict';Handlebars=Handlebars&&Object.prototype.hasOwnProperty.call(Handlebars,"default")?Handlebars["default"]:Handlebars,__=__&&Object.prototype.hasOwnProperty.call(__,"default")?__["default"]:__,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,DOMPurify=DOMPurify&&Object.prototype.hasOwnProperty.call(DOMPurify,"default")?DOMPurify["default"]:DOMPurify,containerHelper=containerHelper&&Object.prototype.hasOwnProperty.call(containerHelper,"default")?containerHelper["default"]:containerHelper;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){function program1(depth0){var buffer="",stack1;return buffer+=" lang=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"",buffer}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,self=this,stack1,helper;return buffer+="<li class=\"qti-choice\" data-identifier=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.identifier),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\" data-serial=\"",(helper=helpers.serial)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.serial,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\"",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),{hash:{},inverse:self.noop,fn:self.program(1,program1,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+=">\n ",(helper=helpers.body)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.body,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n</li>",buffer}),GapText={qtiClass:"gapText",getContainer:containerHelper.get,template:function(data,options,asString){var html=Template(data,options);return asString||!0?html:$(html)}};return GapText}),define("taoQtiItem/qtiCommonRenderer/renderers/choices/Hottext",["handlebars","i18n","lodash","lib/dompurify/purify","taoQtiItem/qtiCommonRenderer/helpers/container"],function(Handlebars,__,_,DOMPurify,containerHelper){'use strict';Handlebars=Handlebars&&Object.prototype.hasOwnProperty.call(Handlebars,"default")?Handlebars["default"]:Handlebars,__=__&&Object.prototype.hasOwnProperty.call(__,"default")?__["default"]:__,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,DOMPurify=DOMPurify&&Object.prototype.hasOwnProperty.call(DOMPurify,"default")?DOMPurify["default"]:DOMPurify,containerHelper=containerHelper&&Object.prototype.hasOwnProperty.call(containerHelper,"default")?containerHelper["default"]:containerHelper;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){function program1(depth0){var buffer="",stack1;return buffer+=" lang=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"",buffer}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,self=this,stack1,helper;return buffer+="<span class=\"qti-choice qti-hottext hottext\" data-identifier=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.identifier),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\" data-serial=\"",(helper=helpers.serial)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.serial,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\"",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),{hash:{},inverse:self.noop,fn:self.program(1,program1,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+=">\r\n <label class=\"hottext-checkmark\">\r\n <input type=\"checkbox\" value=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.identifier),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\">\r\n <span class=\"icon-checkbox small\"></span>\r\n </label>\r\n <span class=\"hottext-content\">",(helper=helpers.body)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.body,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),(stack1||0===stack1)&&(buffer+=stack1),buffer+="</span>\r\n</span>",buffer}),Hottext={qtiClass:"hottext",getContainer:containerHelper.get,template:function(data,options,asString){var html=Template(data,options);return asString||!0?html:$(html)}};return Hottext}),define("taoQtiItem/qtiCommonRenderer/renderers/choices/InlineChoice",["lodash","handlebars","i18n","lib/dompurify/purify","taoQtiItem/qtiCommonRenderer/helpers/container"],function(_,Handlebars,__,DOMPurify,containerHelper){'use strict';_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,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,containerHelper=containerHelper&&Object.prototype.hasOwnProperty.call(containerHelper,"default")?containerHelper["default"]:containerHelper;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){function program1(depth0){var buffer="",stack1;return buffer+=" lang=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"",buffer}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,self=this,stack1,helper;return buffer+="<option data-identifier=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.identifier),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\" data-serial=\"",(helper=helpers.serial)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.serial,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\" value=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.identifier),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),{hash:{},inverse:self.noop,fn:self.program(1,program1,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+=">\n ",(helper=helpers.body)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.body,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\n</option>",buffer}),InlineChoice={qtiClass:"inlineChoice",getContainer:containerHelper.get,template:function(data,options,asString){var html=Template(data,options);return asString||!0?html:$(html)},getData:function(choice,data){return data.body=_.unescape(data.body),data}};return InlineChoice}),define("taoQtiItem/qtiCommonRenderer/renderers/choices/SimpleAssociableChoice.AssociateInteraction",["handlebars","i18n","lodash","lib/dompurify/purify","taoQtiItem/qtiCommonRenderer/helpers/container"],function(Handlebars,__,_,DOMPurify,containerHelper){'use strict';Handlebars=Handlebars&&Object.prototype.hasOwnProperty.call(Handlebars,"default")?Handlebars["default"]:Handlebars,__=__&&Object.prototype.hasOwnProperty.call(__,"default")?__["default"]:__,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,DOMPurify=DOMPurify&&Object.prototype.hasOwnProperty.call(DOMPurify,"default")?DOMPurify["default"]:DOMPurify,containerHelper=containerHelper&&Object.prototype.hasOwnProperty.call(containerHelper,"default")?containerHelper["default"]:containerHelper;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){function program1(depth0){var buffer="",stack1;return buffer+=" lang=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"",buffer}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,self=this,stack1,helper;return buffer+="<li class=\"qti-choice\" data-identifier=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.identifier),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\" data-serial=\"",(helper=helpers.serial)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.serial,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\"",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),{hash:{},inverse:self.noop,fn:self.program(1,program1,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+=">\n ",(helper=helpers.body)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.body,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n</li>",buffer}),SimpleAssociableChoice_AssociateInteraction={qtiClass:"simpleAssociableChoice.associateInteraction",getContainer:containerHelper.get,template:function(data,options,asString){var html=Template(data,options);return asString||!0?html:$(html)}};return SimpleAssociableChoice_AssociateInteraction}),define("taoQtiItem/qtiCommonRenderer/renderers/choices/SimpleAssociableChoice.MatchInteraction",["handlebars","i18n","lodash","lib/dompurify/purify","taoQtiItem/qtiCommonRenderer/helpers/container"],function(Handlebars,__,_,DOMPurify,containerHelper){'use strict';Handlebars=Handlebars&&Object.prototype.hasOwnProperty.call(Handlebars,"default")?Handlebars["default"]:Handlebars,__=__&&Object.prototype.hasOwnProperty.call(__,"default")?__["default"]:__,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,DOMPurify=DOMPurify&&Object.prototype.hasOwnProperty.call(DOMPurify,"default")?DOMPurify["default"]:DOMPurify,containerHelper=containerHelper&&Object.prototype.hasOwnProperty.call(containerHelper,"default")?containerHelper["default"]:containerHelper;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){function program1(depth0){var buffer="",stack1;return buffer+=" lang=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"",buffer}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,self=this,stack1,helper;return buffer+="<th class=\"qti-choice qti-associableChoice qti-simpleAssociableChoice\" data-identifier=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.identifier),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\" data-serial=\"",(helper=helpers.serial)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.serial,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\"",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),{hash:{},inverse:self.noop,fn:self.program(1,program1,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+=">\n ",(helper=helpers.body)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.body,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n</th>",buffer}),SimpleAssociableChoice_MatchInteraction={qtiClass:"simpleAssociableChoice.matchInteraction",getContainer:containerHelper.get,template:function(data,options,asString){var html=Template(data,options);return asString||!0?html:$(html)}};return SimpleAssociableChoice_MatchInteraction}),define("taoQtiItem/qtiCommonRenderer/renderers/choices/SimpleChoice.ChoiceInteraction",["handlebars","i18n","lodash","lib/dompurify/purify","taoQtiItem/qtiCommonRenderer/helpers/container"],function(Handlebars,__,_,DOMPurify,containerHelper){'use strict';Handlebars=Handlebars&&Object.prototype.hasOwnProperty.call(Handlebars,"default")?Handlebars["default"]:Handlebars,__=__&&Object.prototype.hasOwnProperty.call(__,"default")?__["default"]:__,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,DOMPurify=DOMPurify&&Object.prototype.hasOwnProperty.call(DOMPurify,"default")?DOMPurify["default"]:DOMPurify,containerHelper=containerHelper&&Object.prototype.hasOwnProperty.call(containerHelper,"default")?containerHelper["default"]:containerHelper;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){function program1(depth0){var buffer="",stack1;return buffer+=" lang=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"",buffer}function program3(depth0){var buffer="",stack1;return buffer+="\n <input\n type=\"radio\"\n name=\"response-"+escapeExpression((stack1=(stack1=depth0&&depth0.interaction,null==stack1||!1===stack1?stack1:stack1.serial),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"\n value=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.identifier),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"\n tabindex=\"1\"\n >\n <span class=\"icon-radio\"></span>\n ",buffer}function program5(depth0){var buffer="",stack1;return buffer+="\n <input\n type=\"checkbox\"\n name=\"response-"+escapeExpression((stack1=(stack1=depth0&&depth0.interaction,null==stack1||!1===stack1?stack1:stack1.serial),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"\n value=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.identifier),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"\n tabindex=\"1\"\n >\n <span class=\"icon-checkbox\"></span>\n ",buffer}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,self=this,helperMissing=helpers.helperMissing,stack1,helper,options;return buffer+="<li class=\"qti-choice qti-simpleChoice\" data-identifier=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.identifier),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\" data-serial=\"",(helper=helpers.serial)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.serial,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\"",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),{hash:{},inverse:self.noop,fn:self.program(1,program1,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+=">\n <div class=\"pseudo-label-box\">\n <label class=\"real-label\">\n ",stack1=helpers["if"].call(depth0,depth0&&depth0.unique,{hash:{},inverse:self.program(5,program5,data),fn:self.program(3,program3,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n </label>\n <div class=\"label-box\">\n <div class=\"label-content clear\" contenteditable=\"false\" id=\"choice-"+escapeExpression((stack1=(stack1=depth0&&depth0.interaction,null==stack1||!1===stack1?stack1:stack1.serial),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"-"+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.identifier),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\">\n ",(helper=helpers.body)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.body,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n <svg class=\"overlay-answer-eliminator\">\n <line x1=\"0\" y1=\"100%\" x2=\"100%\" y2=\"0\"/>\n <line x1=\"0\" y1=\"0\" x2=\"100%\" y2=\"100%\"/>\n </svg>\n </div>\n </div>\n </div>\n <label data-eliminable=\"container\" data-label=\""+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"Eliminate",options):helperMissing.call(depth0,"__","Eliminate",options)))+"\">\n <span data-eliminable=\"trigger\" class=\"icon-checkbox\"></span>\n </label>\n</li>\n",buffer}),SimpleChoice_ChoiceInteraction={qtiClass:"simpleChoice.choiceInteraction",getContainer:containerHelper.get,getData:function getData(choice,data){return data.unique=1===parseInt(data.interaction.attributes.maxChoices),data},template:function(data,options,asString){var html=Template(data,options);return asString||!0?html:$(html)}};return SimpleChoice_ChoiceInteraction}),define("taoQtiItem/qtiCommonRenderer/renderers/choices/SimpleChoice.OrderInteraction",["handlebars","i18n","lodash","lib/dompurify/purify","taoQtiItem/qtiCommonRenderer/helpers/container"],function(Handlebars,__,_,DOMPurify,containerHelper){'use strict';Handlebars=Handlebars&&Object.prototype.hasOwnProperty.call(Handlebars,"default")?Handlebars["default"]:Handlebars,__=__&&Object.prototype.hasOwnProperty.call(__,"default")?__["default"]:__,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,DOMPurify=DOMPurify&&Object.prototype.hasOwnProperty.call(DOMPurify,"default")?DOMPurify["default"]:DOMPurify,containerHelper=containerHelper&&Object.prototype.hasOwnProperty.call(containerHelper,"default")?containerHelper["default"]:containerHelper;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){function program1(depth0){var buffer="",stack1;return buffer+=" lang=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"",buffer}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,self=this,stack1,helper;return buffer+="<li class=\"qti-choice\" data-identifier=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.identifier),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\" data-serial=\"",(helper=helpers.serial)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.serial,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\"",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),{hash:{},inverse:self.noop,fn:self.program(1,program1,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+=">\n ",(helper=helpers.body)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.body,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n</li>",buffer}),SimpleChoice_OrderInteraction={qtiClass:"simpleChoice.orderInteraction",getContainer:containerHelper.get,template:function(data,options,asString){var html=Template(data,options);return asString||!0?html:$(html)}};return SimpleChoice_OrderInteraction}),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 requireConfigAliases={},reqConfigs=[],modules={},baseUrl;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 self=this,loadPromise;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 self=this,loadPromise;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 self=this,loadPromise;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 cacheType=type?type:"all",ret;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&&registry.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&&registry.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/Container",["handlebars","i18n","lodash","lib/dompurify/purify"],function(Handlebars,__,_,DOMPurify){'use strict';Handlebars=Handlebars&&Object.prototype.hasOwnProperty.call(Handlebars,"default")?Handlebars["default"]:Handlebars,__=__&&Object.prototype.hasOwnProperty.call(__,"default")?__["default"]:__,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,DOMPurify=DOMPurify&&Object.prototype.hasOwnProperty.call(DOMPurify,"default")?DOMPurify["default"]:DOMPurify;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){function program1(depth0,data){var buffer="",stack1,helper;return buffer+="<div class=\"qti-block\"",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),{hash:{},inverse:self.noop,fn:self.program(2,program2,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+=">",(helper=helpers.body)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.body,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),(stack1||0===stack1)&&(buffer+=stack1),buffer+="</div>",buffer}function program2(depth0){var buffer="",stack1;return buffer+=" lang=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"",buffer}function program4(depth0,data){var buffer="",stack1,helper;return(helper=helpers.body)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.body,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),(stack1||0===stack1)&&(buffer+=stack1),buffer}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var escapeExpression=this.escapeExpression,self=this,helperMissing=helpers.helperMissing,stack1,helper,options;return stack1=(helper=helpers.equal||depth0&&depth0.equal,options={hash:{},inverse:self.program(4,program4,data),fn:self.program(1,program1,data),data:data},helper?helper.call(depth0,depth0&&depth0.contentModel,"blockStatic",options):helperMissing.call(depth0,"equal",depth0&&depth0.contentModel,"blockStatic",options)),stack1||0===stack1?stack1:""});return{qtiClass:"_container",template:function(data,options,asString){var html=Template(data,options);return asString||!0?html:$(html)}}}),define("taoQtiItem/qtiCommonRenderer/renderers/Img",["ui/waitForMedia","handlebars","i18n","lodash","lib/dompurify/purify","taoQtiItem/qtiCommonRenderer/helpers/container"],function(waitForMedia,Handlebars,__,_,DOMPurify,containerHelper){'use strict';Handlebars=Handlebars&&Object.prototype.hasOwnProperty.call(Handlebars,"default")?Handlebars["default"]:Handlebars,__=__&&Object.prototype.hasOwnProperty.call(__,"default")?__["default"]:__,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,DOMPurify=DOMPurify&&Object.prototype.hasOwnProperty.call(DOMPurify,"default")?DOMPurify["default"]:DOMPurify,containerHelper=containerHelper&&Object.prototype.hasOwnProperty.call(containerHelper,"default")?containerHelper["default"]:containerHelper;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){function program1(depth0){var buffer="",stack1;return buffer+="id=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.id),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"",buffer}function program3(depth0){var buffer="",stack1;return buffer+="class=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["class"]),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"",buffer}function program5(depth0){var buffer="",stack1;return buffer+="height=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.height),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\" ",buffer}function program7(depth0){var buffer="",stack1;return buffer+="width=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.width),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\" ",buffer}function program9(depth0){var buffer="",stack1;return buffer+=" lang=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"",buffer}function program11(depth0){var buffer="",stack1;return buffer+=" aria-describedby=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["aria-describedby"]),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"",buffer}function program13(depth0){var buffer="",stack1;return buffer+=" aria-hidden=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["aria-hidden"]),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"",buffer}function program15(depth0){var buffer="",stack1;return buffer+=" aria-label=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["aria-label"]),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"",buffer}function program17(depth0){var buffer="",stack1;return buffer+=" aria-labelledby=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["aria-labelledby"]),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"",buffer}function program19(depth0){var buffer="",stack1;return buffer+=" aria-live=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["aria-live"]),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"",buffer}function program21(depth0){var buffer="",stack1;return buffer+=" role=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.role),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"",buffer}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,self=this,stack1,helper;return buffer+="<img\n data-serial=\"",(helper=helpers.serial)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.serial,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\"\n data-qti-class=\"img\"\n src=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.src),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"\n alt=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.alt),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"\n ",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.id),{hash:{},inverse:self.noop,fn:self.program(1,program1,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n ",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["class"]),{hash:{},inverse:self.noop,fn:self.program(3,program3,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n ",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.height),{hash:{},inverse:self.noop,fn:self.program(5,program5,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n ",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.width),{hash:{},inverse:self.noop,fn:self.program(7,program7,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n ",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),{hash:{},inverse:self.noop,fn:self.program(9,program9,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n ",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["aria-describedby"]),{hash:{},inverse:self.noop,fn:self.program(11,program11,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n ",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["aria-hidden"]),{hash:{},inverse:self.noop,fn:self.program(13,program13,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n ",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["aria-label"]),{hash:{},inverse:self.noop,fn:self.program(15,program15,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n ",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["aria-labelledby"]),{hash:{},inverse:self.noop,fn:self.program(17,program17,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n ",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["aria-live"]),{hash:{},inverse:self.noop,fn:self.program(19,program19,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n ",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.role),{hash:{},inverse:self.noop,fn:self.program(21,program21,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n />\n",buffer}),Img={qtiClass:"img",template:function(data,options,asString){var html=Template(data,options);return asString||!0?html:$(html)},getContainer:containerHelper.get,render:function(img){return new Promise(function(resolve){containerHelper.get(img).waitForMedia(resolve)})}};return Img}),define("taoQtiItem/qtiCommonRenderer/renderers/Include",["handlebars","i18n","lodash","lib/dompurify/purify"],function(Handlebars,__,_,DOMPurify){'use strict';Handlebars=Handlebars&&Object.prototype.hasOwnProperty.call(Handlebars,"default")?Handlebars["default"]:Handlebars,__=__&&Object.prototype.hasOwnProperty.call(__,"default")?__["default"]:__,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,DOMPurify=DOMPurify&&Object.prototype.hasOwnProperty.call(DOMPurify,"default")?DOMPurify["default"]:DOMPurify;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 buffer="",escapeExpression=this.escapeExpression,stack1,helper;return buffer+="<div class=\"qti-include\" data-href=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.href),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\">\n ",(helper=helpers.body)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.body,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n</div>",buffer});return{qtiClass:"include",template:function(data,options,asString){var html=Template(data,options);return asString||!0?html:$(html)}}}),define("taoQtiItem/qtiCommonRenderer/renderers/interactions/AssociateInteraction",["jquery","lodash","i18n","ui/hider","handlebars","lib/dompurify/purify","taoQtiItem/qtiCommonRenderer/helpers/container","taoQtiItem/qtiCommonRenderer/helpers/instructions/instructionManager","taoQtiItem/qtiCommonRenderer/helpers/PciResponse","taoQtiItem/qtiCommonRenderer/helpers/sizeAdapter","interact","ui/interactUtils"],function($$1,_,__,hider,Handlebars,DOMPurify,containerHelper,instructionMgr,pciResponse,sizeAdapter,interact,interactUtils){'use strict';function pairTpl(data,options,asString){var html=Template$1(data,options);return asString||!0?html:$(html)}$$1=$$1&&Object.prototype.hasOwnProperty.call($$1,"default")?$$1["default"]:$$1,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,__=__&&Object.prototype.hasOwnProperty.call(__,"default")?__["default"]:__,hider=hider&&Object.prototype.hasOwnProperty.call(hider,"default")?hider["default"]:hider,Handlebars=Handlebars&&Object.prototype.hasOwnProperty.call(Handlebars,"default")?Handlebars["default"]:Handlebars,DOMPurify=DOMPurify&&Object.prototype.hasOwnProperty.call(DOMPurify,"default")?DOMPurify["default"]:DOMPurify,containerHelper=containerHelper&&Object.prototype.hasOwnProperty.call(containerHelper,"default")?containerHelper["default"]:containerHelper,instructionMgr=instructionMgr&&Object.prototype.hasOwnProperty.call(instructionMgr,"default")?instructionMgr["default"]:instructionMgr,pciResponse=pciResponse&&Object.prototype.hasOwnProperty.call(pciResponse,"default")?pciResponse["default"]:pciResponse,sizeAdapter=sizeAdapter&&Object.prototype.hasOwnProperty.call(sizeAdapter,"default")?sizeAdapter["default"]:sizeAdapter,interact=interact&&Object.prototype.hasOwnProperty.call(interact,"default")?interact["default"]:interact,interactUtils=interactUtils&&Object.prototype.hasOwnProperty.call(interactUtils,"default")?interactUtils["default"]:interactUtils;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){function program1(depth0){var buffer="",stack1;return buffer+="id=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.id),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"",buffer}function program3(depth0){var buffer="",stack1;return buffer+=" "+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["class"]),"function"===_typeof(stack1)?stack1.apply(depth0):stack1)),buffer}function program5(depth0){var buffer="",stack1;return buffer+=" lang=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"",buffer}function program7(depth0,data){var stack1,helper;return(helper=helpers.prompt)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.prompt,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),stack1||0===stack1?stack1:""}function program9(depth0){var stack1;return stack1="function"===_typeof(depth0)?depth0.apply(depth0):depth0,stack1||0===stack1?stack1:""}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,self=this,blockHelperMissing=helpers.blockHelperMissing,stack1,helper,options;return buffer+="<div\n ",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.id),{hash:{},inverse:self.noop,fn:self.program(1,program1,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n class=\"qti-interaction qti-blockInteraction qti-associateInteraction",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["class"]),{hash:{},inverse:self.noop,fn:self.program(3,program3,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\"\n data-serial=\"",(helper=helpers.serial)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.serial,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\"\n data-qti-class=\"associateInteraction\"\n ",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),{hash:{},inverse:self.noop,fn:self.program(5,program5,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n>\n ",stack1=helpers["if"].call(depth0,depth0&&depth0.prompt,{hash:{},inverse:self.noop,fn:self.program(7,program7,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n <div class=\"instruction-container\"></div>\n <ul class=\"choice-area clearfix none block-listing solid horizontal source\">\n ",options={hash:{},inverse:self.noop,fn:self.program(9,program9,data),data:data},(helper=helpers.choices)?stack1=helper.call(depth0,options):(helper=depth0&&depth0.choices,stack1="function"===_typeof(helper)?helper.call(depth0,options):helper),helpers.choices||(stack1=blockHelperMissing.call(depth0,stack1,{hash:{},inverse:self.noop,fn:self.program(9,program9,data),data:data})),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n </ul>\n <ul class=\"result-area none target clearfix\">\n </ul>\n <div class=\"notification-container\"></div>\n</div>\n",buffer});Helpers0.__initialized||(Helpers0(Handlebars),Helpers0.__initialized=!0);var Template$1=Handlebars.template(function(Handlebars,depth0,helpers,partials,data){function program3(depth0){var buffer="",stack1;return buffer+=" lang=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"",buffer}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,self=this,stack1;return buffer+="<li class=\"",stack1=helpers["if"].call(depth0,depth0&&depth0.empty,{hash:{},inverse:self.noop,fn:self.program(1,function(){return"hidden incomplete-pair"},data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\"",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),{hash:{},inverse:self.noop,fn:self.program(3,program3,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+=">\n <div class=\"target lft\"></div>\n <div class=\"target rgt\"></div>\n</li>\n",buffer}),setChoice=function(interaction,$choice,$target){var $container=containerHelper.get(interaction),choiceSerial=$choice.data("serial"),usage=$choice.data("usage")||0,choice=interaction.getChoice(choiceSerial);if(!choiceSerial)throw"empty choice serial";usage++,$choice.data("usage",usage);var _setChoice=function(){$target.data("serial",choiceSerial).html($choice.html()).addClass("filled"),!interaction.responseMappingMode&&choice.attr("matchMax")&&usage>=choice.attr("matchMax")&&$choice.addClass("deactivated")};if($target.siblings("div").hasClass("filled")){var $resultArea=$$1(".result-area",$container),$pair=$target.parent(),thisPairSerial=[$target.siblings("div").data("serial"),choiceSerial],$otherRepeatedPair=$$1();$resultArea.children().not($pair).each(function(){var $otherPair=$$1(this).children(".filled");if(2===$otherPair.length){var otherPairSerial=[$$1($otherPair[0]).data("serial"),$$1($otherPair[1]).data("serial")];if(2===_.intersection(thisPairSerial,otherPairSerial).length)return $otherRepeatedPair=$otherPair,!1}}),0===$otherRepeatedPair.length?(_setChoice(),containerHelper.triggerResponseChangeEvent(interaction,{type:"added",$pair:$pair,choices:thisPairSerial}),instructionMgr.validateInstructions(interaction,{choice:$choice,target:$target}),(interaction.responseMappingMode||0===parseInt(interaction.attr("maxAssociations")))&&($pair.removeClass("incomplete-pair"),!$resultArea.children(".incomplete-pair").length&&($resultArea.append(pairTpl({empty:!0})),$resultArea.children(".incomplete-pair").fadeIn(600,function(){hider.show(this)})))):($otherRepeatedPair.css("border","1px solid orange"),$target.html(__("identical pair already exists")).css({color:"orange",border:"1px solid orange"}),setTimeout(function(){$otherRepeatedPair.removeAttr("style"),$target.empty().css({color:"",border:""})},2e3))}else _setChoice()},unsetChoice=function(interaction,$filledChoice,animate,triggerChange){var $container=containerHelper.get(interaction),choiceSerial=$filledChoice.data("serial"),$choice=$container.find(".choice-area [data-serial="+choiceSerial+"]"),usage=$choice.data("usage")||0,$parent=$filledChoice.parent(),$sibling=$container.find(".choice-area [data-serial="+$filledChoice.siblings(".target").data("serial")+"]"),isNumberOfMaxAssociationsZero=0===parseInt(interaction.attr("maxAssociations"));usage--,$choice.data("usage",usage).removeClass("deactivated"),$filledChoice.removeClass("filled").removeData("serial").empty(),interaction.swapping||(!1!==triggerChange&&(containerHelper.triggerResponseChangeEvent(interaction,{type:"removed",$pair:$filledChoice.parent()}),instructionMgr.validateInstructions(interaction,{choice:$choice})),isNumberOfMaxAssociationsZero&&$sibling.data("usage",$sibling.data("usage")-1).removeClass("deactivated"),!$choice.siblings("div").hasClass("filled")&&(isNumberOfMaxAssociationsZero||interaction.responseMappingMode)&&!$parent.hasClass("incomplete-pair")&&(animate?$parent.addClass("removing").fadeOut(500,function(){$$1(this).remove()}):$parent.remove()))},getChoice=function(interaction,identifier){var $container=containerHelper.get(interaction),choice=interaction.getChoiceByIdentifier(identifier);if(!choice)throw new Error("cannot find a choice with the identifier : "+identifier);return $$1(".choice-area [data-serial="+choice.getSerial()+"]",$container)},renderEmptyPairs=function(interaction){var $container=containerHelper.get(interaction),max=parseInt(interaction.attr("maxAssociations")),$resultArea=$$1(".result-area",$container);if(interaction.responseMappingMode||0===max)$resultArea.append(pairTpl({empty:!0})),hider.show($resultArea.children(".incomplete-pair"));else for(var i=0;i<max;i++)$resultArea.append(pairTpl())},scrollObserverFactory=function($scrollContainer){function resetScrollObserver(){currentDraggable=null,beforeY=0,beforeX=0,afterY=0,afterX=0}function onScrollCb(){var x,y;currentDraggable&&(beforeY=afterY,beforeX=afterX,0===afterY&&0===beforeY&&(beforeY=this.scrollTop),0===afterX&&0===beforeX&&(beforeX=this.scrollLeft),afterY=this.scrollTop,afterX=this.scrollLeft,y=(parseInt(currentDraggable.getAttribute("data-y"),10)||0)+(afterY-beforeY),x=(parseInt(currentDraggable.getAttribute("data-x"),10)||0)+(afterX-beforeX),currentDraggable.style.webkitTransform=currentDraggable.style.transform="translate("+x+"px, "+y+"px)",currentDraggable.setAttribute("data-x",x),currentDraggable.setAttribute("data-y",y))}var currentDraggable=null,beforeY=0,beforeX=0,afterY=0,afterX=0;return $scrollContainer.parents().each(function(){var $el=$$1(this),ovf=$el.css("overflow");if("hidden"!==ovf&&"visible"!==ovf)return $scrollContainer=$el,!1}),interact.dynamicDrop(!0),{getScrollContainer:function(){return $scrollContainer},start:function(draggedElement){resetScrollObserver(),currentDraggable=draggedElement instanceof $$1?draggedElement.get(0):draggedElement,$scrollContainer.on("scroll.scrollObserver",_.throttle(onScrollCb,50))},stop:function(){$scrollContainer.off(".scrollObserver"),resetScrollObserver()}}},_setInstructions=function(interaction){var min=parseInt(interaction.attr("minAssociations"),10),max=parseInt(interaction.attr("maxAssociations"),10);if(0===min)0===max&&instructionMgr.appendInstruction(interaction,__("You may make as many association pairs as you want."));else{0===max&&instructionMgr.appendInstruction(interaction,__("The maximum number of association is unlimited."));var msg=__("You need to make")+" ";msg+=1<min?__("at least")+" "+min+" "+__("association pairs"):__("one association pair"),instructionMgr.appendInstruction(interaction,msg,function(){_getRawResponse(interaction).length>=min?this.setLevel("success"):this.reset()})}},resetResponse=function(interaction){var $container=containerHelper.get(interaction);$container.find(".result-area .active").each(function(){interactUtils.tapOn(this)}),$$1(".result-area>li>div",$container).each(function(){unsetChoice(interaction,$$1(this),!1,!1)}),containerHelper.triggerResponseChangeEvent(interaction),instructionMgr.validateInstructions(interaction)},_setPairs=function(interaction,pairs){var $container=containerHelper.get(interaction),addedPairs=0,$emptyPair=$$1(".result-area>li:first",$container);return pairs&&"single"===interaction.getResponseDeclaration().attr("cardinality")&&pairs.length&&(pairs=[pairs]),_.each(pairs,function(pair){if($emptyPair.length){var $divs=$emptyPair.children("div");setChoice(interaction,getChoice(interaction,pair[0]),$$1($divs[0])),setChoice(interaction,getChoice(interaction,pair[1]),$$1($divs[1])),addedPairs++,$emptyPair=$emptyPair.next("li")}else return!1}),addedPairs},setResponse=function(interaction,response){_setPairs(interaction,pciResponse.unserialize(response,interaction))},_getRawResponse=function(interaction){var response=[],$container=containerHelper.get(interaction);return $$1(".result-area>li",$container).each(function(){var pair=[];$$1(this).find("div").each(function(){var serial=$$1(this).data("serial");serial&&pair.push(interaction.getChoice(serial).id())}),2===pair.length&&response.push(pair)}),response},getResponse=function(interaction){return pciResponse.serialize(_getRawResponse(interaction),interaction)},destroy=function(interaction){var $container=containerHelper.get(interaction);interact($container.selector).unset(),interact($container.find(".choice-area").selector+" >li").unset(),interact($container.find(".result-area").selector+" >li>div").unset(),interact($container.find(".remove-choice").selector).unset(),instructionMgr.removeInstructions(interaction),$$1(".result-area",$container).empty(),containerHelper.reset(interaction)},setState=function(interaction,state){var $container;_.isObject(state)&&(state.response&&(interaction.resetResponse(),interaction.setResponse(state.response)),_.isArray(state.order)&&state.order.length===_.size(interaction.getChoices())&&($container=containerHelper.get(interaction),$$1(".choice-area .qti-choice",$container).sort(function(a,b){var aIndex=_.indexOf(state.order,$$1(a).data("identifier")),bIndex=_.indexOf(state.order,$$1(b).data("identifier"));return aIndex>bIndex?1:aIndex<bIndex?-1:0}).detach().appendTo($$1(".choice-area",$container))))},getState=function(interaction){var state={},response=interaction.getResponse(),$container;return response&&(state.response=response),!0===interaction.attr("shuffle")&&($container=containerHelper.get(interaction),state.order=[],$$1(".choice-area .qti-choice",$container).each(function(){state.order.push($$1(this).data("identifier"))})),state},AssociateInteraction={qtiClass:"associateInteraction",template:function(data,options,asString){var html=Template(data,options);return asString||!0?html:$(html)},render:function render(interaction){var self=this;return new Promise(function(resolve){function _iFrameDragFix(draggableSelector,target){interactUtils.iFrameDragFixOn(function(){var $activeDrop=$$1(resultSelector+".dropzone");$activeDrop.length&&interact(resultSelector).fire({type:"drop",target:$activeDrop.eq(0),relatedTarget:target}),$activeDrop=$$1(choiceSelector+".dropzone"),$activeDrop.length&&interact(choiceSelector+".empty").fire({type:"drop",target:$activeDrop.eq(0),relatedTarget:target}),interact(draggableSelector).fire({type:"dragend",target:target})})}var $container=containerHelper.get(interaction),$choiceArea=$container.find(".choice-area"),$resultArea=$container.find(".result-area"),$activeChoice=null,scrollObserver=null,$bin=$$1("<span>",{class:"icon-undo remove-choice",title:__("remove")}),choiceSelector=$choiceArea.selector+" >li",resultSelector=$resultArea.selector+" >li>div",binSelector=$container.selector+" .remove-choice",_getChoice=function(serial){return $choiceArea.find("[data-serial="+serial+"]")},_setChoice=function($choice,$target){setChoice(interaction,$choice,$target),sizeAdapter.adaptSize($$1(".result-area .target, .choice-area .qti-choice",containerHelper.get(interaction)))},_resetSelection=function(){$activeChoice&&($resultArea.find(".remove-choice").remove(),$activeChoice.removeClass("active"),$container.find(".empty").removeClass("empty"),$activeChoice=null)},_unsetChoice=function($choice){unsetChoice(interaction,$choice,!0),sizeAdapter.adaptSize($$1(".result-area .target, .choice-area .qti-choice",containerHelper.get(interaction)))},_isInsertionMode=function(){return $activeChoice&&$activeChoice.data("identifier")},_isModeEditing=function(){return $activeChoice&&!$activeChoice.data("identifier")},_handleChoiceActivate=function($target){$target.hasClass("deactivated")||(_isModeEditing()?(interaction.swapping=!0,_unsetChoice($activeChoice),_setChoice($target,$activeChoice),_resetSelection(),interaction.swapping=!1):$target.hasClass("active")?_resetSelection():_activateChoice($target))},_activateChoice=function($choice){_resetSelection(),$activeChoice=$choice,$choice.addClass("active"),$resultArea.find(">li>.target").addClass("empty")},_handleResultActivate=function($target){var targetSerial=$target.data("serial"),choiceSerial;_isInsertionMode()?(choiceSerial=$activeChoice.data("serial"),targetSerial!==choiceSerial&&($target.hasClass("filled")&&(interaction.swapping=!0),targetSerial&&_unsetChoice($target),_setChoice($activeChoice,$target),interaction.swapping=!1),_resetSelection()):_isModeEditing()?(choiceSerial=$activeChoice.data("serial"),targetSerial!==choiceSerial&&(($target.hasClass("filled")||$activeChoice.siblings("div")[0]===$target[0])&&(interaction.swapping=!0),_unsetChoice($activeChoice),targetSerial&&(_unsetChoice($target),_setChoice(_getChoice(targetSerial),$activeChoice)),_setChoice(_getChoice(choiceSerial),$target),interaction.swapping=!1),_resetSelection()):targetSerial&&(_activateResult($target),$target.append($bin))},_activateResult=function($target){var targetSerial=$target.data("serial");$activeChoice=$target,$activeChoice.addClass("active"),$resultArea.find(">li>.target").filter(function(){return $$1(this).data("serial")!==targetSerial}).addClass("empty"),$choiceArea.find(">li:not(.deactivated)").filter(function(){return $$1(this).data("serial")!==targetSerial}).addClass("empty")},isDragAndDropEnabled,dragOptions,dropOptions,scaleX,scaleY;interact($container.selector).on("tap",function(e){$$1(e.currentTarget).closest(".qti-item").hasClass("prevent-click-handler")||_resetSelection()}),interact($choiceArea.selector+" >li").on("tap",function(e){var $target=$$1(e.currentTarget);$target.closest(".qti-item").hasClass("prevent-click-handler")||(e.stopPropagation(),_handleChoiceActivate($target),e.preventDefault())}),interact($resultArea.selector+" >li>div").on("tap",function(e){var $target=$$1(e.currentTarget);$target.closest(".qti-item").hasClass("prevent-click-handler")||(e.stopPropagation(),_handleResultActivate($target),e.preventDefault())}),interact(binSelector).on("tap",function(e){$$1(e.currentTarget).closest(".qti-item").hasClass("prevent-click-handler")||(e.stopPropagation(),_unsetChoice($activeChoice),_resetSelection(),e.preventDefault())}),interaction.responseMappingMode||_setInstructions(interaction),self.getOption&&self.getOption("enableDragAndDrop")&&self.getOption("enableDragAndDrop").associate&&(isDragAndDropEnabled=self.getOption("enableDragAndDrop").associate),isDragAndDropEnabled&&(scrollObserver=scrollObserverFactory($container),dragOptions={inertia:!1,autoScroll:{container:scrollObserver.getScrollContainer().get(0)},restrict:{restriction:".qti-interaction",endOnly:!1,elementRect:{top:0,left:0,bottom:1,right:1}}},interact(choiceSelector+":not(.deactivated)").draggable(_.defaults({onstart:function onstart(e){var $target=$$1(e.target),scale;$target.addClass("dragged"),_activateChoice($target),_iFrameDragFix(choiceSelector+":not(.deactivated)",e.target),scale=interactUtils.calculateScale(e.target),scaleX=scale[0],scaleY=scale[1],scrollObserver.start($activeChoice)},onmove:function onmove(e){interactUtils.moveElement(e.target,e.dx/scaleX,e.dy/scaleY)},onend:function onend(e){var $target=$$1(e.target);$target.removeClass("dragged"),_.delay(function(){_resetSelection()}),interactUtils.restoreOriginalPosition($target),interactUtils.iFrameDragFixOff(),scrollObserver.stop()}},dragOptions)).styleCursor(!1),interact(resultSelector+".filled").draggable(_.defaults({onstart:function onstart(e){var $target=$$1(e.target),scale;$target.addClass("dragged"),_resetSelection(),_activateResult($target),_iFrameDragFix(resultSelector+".filled",e.target),scale=interactUtils.calculateScale(e.target),scaleX=scale[0],scaleY=scale[1],scrollObserver.start($activeChoice)},onmove:function onmove(e){interactUtils.moveElement(e.target,e.dx/scaleX,e.dy/scaleY)},onend:function onend(e){var $target=$$1(e.target);$target.removeClass("dragged"),interactUtils.restoreOriginalPosition($target),$activeChoice&&_unsetChoice($activeChoice),_resetSelection(),interactUtils.iFrameDragFixOff(),scrollObserver.stop()}},dragOptions)).styleCursor(!1),dropOptions={overlap:.15,ondragenter:function ondragenter(e){$$1(e.target).addClass("dropzone"),$$1(e.relatedTarget).addClass("droppable")},ondragleave:function ondragleave(e){$$1(e.target).removeClass("dropzone"),$$1(e.relatedTarget).removeClass("droppable")}},interact(resultSelector).dropzone(_.defaults({ondrop:function ondrop(e){this.ondragleave(e),_handleResultActivate($$1(e.target))}},dropOptions)),interact(choiceSelector+".empty").dropzone(_.defaults({ondrop:function ondrop(e){this.ondragleave(e),_handleChoiceActivate($$1(e.target))}},dropOptions))),renderEmptyPairs(interaction),sizeAdapter.adaptSize($$1(".result-area .target, .choice-area .qti-choice",$container)),resolve()})},getContainer:containerHelper.get,setResponse:setResponse,getResponse:getResponse,resetResponse:resetResponse,destroy:destroy,setState:setState,getState:getState,renderEmptyPairs:renderEmptyPairs};return AssociateInteraction}),define("taoQtiItem/qtiCommonRenderer/renderers/interactions/ChoiceInteraction",["lodash","jquery","i18n","handlebars","lib/dompurify/purify","taoQtiItem/qtiCommonRenderer/helpers/container","taoQtiItem/qtiCommonRenderer/helpers/instructions/instructionManager","taoQtiItem/qtiCommonRenderer/helpers/PciResponse","taoQtiItem/qtiCommonRenderer/helpers/sizeAdapter","util/adaptSize"],function(_,$$1,__,Handlebars,DOMPurify,containerHelper,instructionMgr,pciResponse,sizeAdapter,adaptSize){'use strict';_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,$$1=$$1&&Object.prototype.hasOwnProperty.call($$1,"default")?$$1["default"]:$$1,__=__&&Object.prototype.hasOwnProperty.call(__,"default")?__["default"]:__,Handlebars=Handlebars&&Object.prototype.hasOwnProperty.call(Handlebars,"default")?Handlebars["default"]:Handlebars,DOMPurify=DOMPurify&&Object.prototype.hasOwnProperty.call(DOMPurify,"default")?DOMPurify["default"]:DOMPurify,containerHelper=containerHelper&&Object.prototype.hasOwnProperty.call(containerHelper,"default")?containerHelper["default"]:containerHelper,instructionMgr=instructionMgr&&Object.prototype.hasOwnProperty.call(instructionMgr,"default")?instructionMgr["default"]:instructionMgr,pciResponse=pciResponse&&Object.prototype.hasOwnProperty.call(pciResponse,"default")?pciResponse["default"]:pciResponse,sizeAdapter=sizeAdapter&&Object.prototype.hasOwnProperty.call(sizeAdapter,"default")?sizeAdapter["default"]:sizeAdapter,adaptSize=adaptSize&&Object.prototype.hasOwnProperty.call(adaptSize,"default")?adaptSize["default"]:adaptSize;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){function program1(depth0){var buffer="",stack1;return buffer+="id=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.id),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"",buffer}function program3(depth0){var buffer="",stack1;return buffer+=" "+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["class"]),"function"===_typeof(stack1)?stack1.apply(depth0):stack1)),buffer}function program5(depth0){var buffer="",stack1;return buffer+=" lang=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"",buffer}function program7(depth0,data){var stack1,helper;return(helper=helpers.prompt)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.prompt,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),stack1||0===stack1?stack1:""}function program11(depth0,data){var stack1,helper;return(helper=helpers.listStyle)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.listStyle,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),stack1||0===stack1?stack1:""}function program13(depth0){var stack1;return stack1="function"===_typeof(depth0)?depth0.apply(depth0):depth0,stack1||0===stack1?stack1:""}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,self=this,blockHelperMissing=helpers.blockHelperMissing,stack1,helper,options;return buffer+="<div\n ",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.id),{hash:{},inverse:self.noop,fn:self.program(1,program1,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n class=\"qti-interaction qti-blockInteraction qti-choiceInteraction",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["class"]),{hash:{},inverse:self.noop,fn:self.program(3,program3,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\"\n data-serial=\"",(helper=helpers.serial)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.serial,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\"\n data-qti-class=\"choiceInteraction\"\n ",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),{hash:{},inverse:self.noop,fn:self.program(5,program5,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n>\n ",stack1=helpers["if"].call(depth0,depth0&&depth0.prompt,{hash:{},inverse:self.noop,fn:self.program(7,program7,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n <div class=\"instruction-container\"></div>\n <ol\n class=\"plain block-listing solid choice-area",stack1=helpers["if"].call(depth0,depth0&&depth0.horizontal,{hash:{},inverse:self.noop,fn:self.program(9,function(){return" horizontal"},data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+=" ",stack1=helpers["if"].call(depth0,depth0&&depth0.listStyle,{hash:{},inverse:self.noop,fn:self.program(11,program11,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\"\n aria-labelledby=\"",(helper=helpers.promptId)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.promptId,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\"\n >\n ",options={hash:{},inverse:self.noop,fn:self.program(13,program13,data),data:data},(helper=helpers.choices)?stack1=helper.call(depth0,options):(helper=depth0&&depth0.choices,stack1="function"===_typeof(helper)?helper.call(depth0,options):helper),helpers.choices||(stack1=blockHelperMissing.call(depth0,stack1,{hash:{},inverse:self.noop,fn:self.program(13,program13,data),data:data})),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n </ol>\n <div class=\"notification-container\"></div>\n</div>\n",buffer}),_triggerInput=function($choiceBox,state){var $input=$choiceBox.find("input:radio,input:checkbox").not("[disabled]").not(".disabled"),$choiceBoxes=$choiceBox.add($choiceBox.siblings());$input.length&&(!_.isBoolean(state)&&(state=!$input.prop("checked")),$input.prop("checked",state),$input.trigger("change"),$choiceBoxes.removeClass("user-selected"),$choiceBoxes.find("input:checked").not("[disabled]").not(".disabled").parents(".qti-choice").addClass("user-selected"))},_pseudoLabel=function(interaction,$container){$container.off(".commonRenderer"),$container.on("keydown.commonRenderer.keyNavigation",".qti-choice input:radio:not([disabled]):not(.disabled), .qti-choice input:checkbox:not([disabled]):not(.disabled)",function(e){var $qtiChoice=$$1(this).closest(".qti-choice"),keyCode=e.keyCode?e.keyCode:e.charCode;keyCode===38||keyCode===37?(e.preventDefault(),e.stopPropagation(),$qtiChoice.prev(".qti-choice").find("input:radio,input:checkbox").not("[disabled]").not(".disabled").focus()):(keyCode===40||keyCode===39)&&(e.preventDefault(),e.stopPropagation(),$qtiChoice.next(".qti-choice").find("input:radio,input:checkbox").not("[disabled]").not(".disabled").focus())}).on("keyup.commonRenderer.keyNavigation",".qti-choice input:radio:not([disabled]):not(.disabled), .qti-choice input:checkbox:not([disabled]):not(.disabled)",function(e){var keyCode=e.keyCode?e.keyCode:e.charCode;(keyCode===32||keyCode===13)&&(e.preventDefault(),e.stopPropagation(),_triggerInput($$1(this).closest(".qti-choice")))}),$container.on("click.commonRenderer",".qti-choice",function(e){var $choiceBox=$$1(this),eliminator=e.target.dataset&&e.target.dataset.eliminable,input=this.querySelector(".real-label > input"),state;e.originalEvent&&$$1(e.originalEvent.target).is("input")||$choiceBox.closest(".qti-item").hasClass("prevent-click-handler")||(e.preventDefault(),e.stopPropagation(),!_.isUndefined(eliminator)&&(state=!1,"trigger"===eliminator&&this.classList.toggle("eliminated")),_triggerInput($choiceBox,state),this.classList.contains("eliminated")?input.setAttribute("disabled","disabled"):input.removeAttribute("disabled"),instructionMgr.validateInstructions(interaction,{choice:$choiceBox}),containerHelper.triggerResponseChangeEvent(interaction),$$1(input).focus())})},_getRawResponse=function(interaction){var values=[],$container=containerHelper.get(interaction);return $$1(".real-label > input[name=response-"+interaction.getSerial()+"]:checked",$container).each(function(){values.push($$1(this).val())}),values},_setInstructions=function(interaction){var min=interaction.attr("minChoices"),max=interaction.attr("maxChoices"),choiceCount=_.size(interaction.getChoices()),minInstructionSet=!1,highlightInvalidInput=function($choice){var $input=$choice.find(".real-label > input"),$li=$choice.css("color","#BA122B"),$icon=$choice.find(".real-label > span").css("color","#BA122B").addClass("cross error"),timeout=interaction.data("__instructionTimeout");timeout&&clearTimeout(timeout),timeout=setTimeout(function(){$input.prop("checked",!1),$li.removeAttr("style"),$icon.removeAttr("style").removeClass("cross"),$li.toggleClass("user-selected",!1),containerHelper.triggerResponseChangeEvent(interaction)},150),interaction.data("__instructionTimeout",timeout)},msg;1<max&&max<choiceCount&&(max===min?(minInstructionSet=!0,msg=__("You must select exactly %s choices",max),instructionMgr.appendInstruction(interaction,msg,function(data){_getRawResponse(interaction).length>=max?(this.setLevel("success"),this.checkState("fulfilled")&&this.update({level:"warning",message:__("Maximum choices reached"),timeout:2e3,start:function start(){data&&data.choice&&highlightInvalidInput(data.choice)},stop:function stop(){this.update({level:"success",message:msg})}}),this.setState("fulfilled")):this.reset()})):max>min&&(msg=1===max?__("You can select maximum of 1 choice"):__("You can select maximum of %s choices",max),instructionMgr.appendInstruction(interaction,msg,function(data){_getRawResponse(interaction).length>=max?(this.setMessage(__("Maximum choices reached")),this.checkState("fulfilled")&&this.update({level:"warning",timeout:2e3,start:function start(){data&&data.choice&&highlightInvalidInput(data.choice)},stop:function stop(){this.setLevel("info")}}),this.setState("fulfilled")):this.reset()}))),!minInstructionSet&&0<min&&min<choiceCount&&(msg=1===min?__("You must select at least 1 choice"):__("You must select at least %s choices",min),instructionMgr.appendInstruction(interaction,msg,function(){_getRawResponse(interaction).length>=min?this.setLevel("success"):this.reset()}))},render=function(interaction){var $container=containerHelper.get(interaction);if(_pseudoLabel(interaction,$container),_setInstructions(interaction),"horizontal"===interaction.attr("orientation")){var $elements=$$1(".add-option, .result-area .target, .choice-area .qti-choice",$container);sizeAdapter.adaptSize($elements),$$1(document).on("themeapplied.choiceInteraction",function(){return adaptSize.height($elements)})}},resetResponse=function(interaction){var $container=containerHelper.get(interaction);$$1(".real-label > input",$container).prop("checked",!1)},setResponse=function(interaction,response){var $container=containerHelper.get(interaction);try{_.forEach(pciResponse.unserialize(response,interaction),function(identifier){var $input=$container.find(".real-label > input[value=\""+identifier+"\"]").prop("checked",!0);$input.closest(".qti-choice").toggleClass("user-selected",!0)}),instructionMgr.validateInstructions(interaction)}catch(e){throw new Error("wrong response format in argument : "+e)}},getResponse=function(interaction){return pciResponse.serialize(_getRawResponse(interaction),interaction)},isEliminable=function(interaction){return /\beliminable\b/.test(interaction.attr("class"))},getCustomData=function(interaction,data){var listStyles=(interaction.attr("class")||"").match(/\blist-style-[\w-]+/)||[];return _.merge(data||{},{horizontal:"horizontal"===interaction.attr("orientation"),listStyle:listStyles.pop(),eliminable:isEliminable(interaction)})},destroy=function(interaction){var $container=containerHelper.get(interaction),timeout=interaction.data("__instructionTimeout");timeout&&clearTimeout(timeout),$container.off(".commonRenderer"),$$1(document).off(".commonRenderer").off(".choiceInteraction"),instructionMgr.removeInstructions(interaction),containerHelper.reset(interaction)},setState=function(interaction,state){var $container;_.isObject(state)&&(state.response&&(interaction.resetResponse(),interaction.setResponse(state.response)),$container=containerHelper.get(interaction),_.isArray(state.order)&&state.order.length===_.size(interaction.getChoices())&&$$1(".qti-simpleChoice",$container).sort(function(a,b){var aIndex=_.indexOf(state.order,$$1(a).data("identifier")),bIndex=_.indexOf(state.order,$$1(b).data("identifier"));return aIndex>bIndex?1:aIndex<bIndex?-1:0}).detach().appendTo($$1(".choice-area",$container)),isEliminable(interaction)&&_.isArray(state.eliminated)&&state.eliminated.length&&_.forEach(state.eliminated,function(identifier){$container.find(".qti-simpleChoice[data-identifier=\""+identifier+"\"]").addClass("eliminated")}))},getState=function(interaction){var $container=containerHelper.get(interaction),state={},response=interaction.getResponse();return response&&(state.response=response),!0===interaction.attr("shuffle")&&(state.order=[],$$1(".qti-simpleChoice",$container).each(function(){state.order.push($$1(this).data("identifier"))})),isEliminable(interaction)&&(state.eliminated=[],$container.find(".qti-simpleChoice.eliminated").each(function(){state.eliminated.push($$1(this).data("identifier"))})),state},ChoiceInteraction={qtiClass:"choiceInteraction",template:function(data,options,asString){var html=Template(data,options);return asString||!0?html:$(html)},getData:getCustomData,render:render,getContainer:containerHelper.get,setResponse:setResponse,getResponse:getResponse,resetResponse:resetResponse,destroy:destroy,setState:setState,getState:getState};return ChoiceInteraction}),define("taoQtiItem/qtiCommonRenderer/renderers/interactions/EndAttemptInteraction",["lodash","handlebars","i18n","lib/dompurify/purify","taoQtiItem/qtiCommonRenderer/helpers/container","taoQtiItem/qtiCommonRenderer/helpers/PciResponse"],function(_,Handlebars,__,DOMPurify,containerHelper,pciResponse){'use strict';function render(interaction){var $container=containerHelper.get(interaction);$container.on("click.commonRenderer",function(e){$(e.currentTarget).closest(".qti-item").hasClass("prevent-click-handler")||($container.val(!0),containerHelper.triggerResponseChangeEvent(interaction),$container.trigger("endattempt",[interaction.attr("responseIdentifier")]))})}function setResponse(interaction,response){_setVal(interaction,pciResponse.unserialize(response,interaction)[0])}function getResponse(interaction){var val=containerHelper.get(interaction).val();return val=val&&"false"!==val&&"0"!==val,pciResponse.serialize([val],interaction)}function setState(interaction,state){_.isObject(state)&&state.response&&(interaction.resetResponse(),interaction.setResponse(state.response))}function _setVal(interaction,val){containerHelper.get(interaction).val(val).change()}function destroy(interaction){containerHelper.get(interaction).off(".commonRenderer")}function getCustomData(interaction,data){return data.attributes.title||(data.attributes.title=__("End Attempt")),data}_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,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,containerHelper=containerHelper&&Object.prototype.hasOwnProperty.call(containerHelper,"default")?containerHelper["default"]:containerHelper,pciResponse=pciResponse&&Object.prototype.hasOwnProperty.call(pciResponse,"default")?pciResponse["default"]:pciResponse;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){function program1(depth0){var buffer="",stack1;return buffer+=" lang=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"",buffer}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,self=this,stack1,helper;return buffer+="<a class=\"qti-interaction qti-inlineInteraction qti-endAttemptInteraction btn small btn-info\"\n data-serial=\"",(helper=helpers.serial)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.serial,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\" \n data-qti-class=\"endAttemptInteraction\"\n value=\"false\"\n tabindex=\"0\"\n ",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),{hash:{},inverse:self.noop,fn:self.program(1,program1,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+=">\n "+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.title),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\n</a>\n",buffer}),EndAttemptInteraction={qtiClass:"endAttemptInteraction",template:function(data,options,asString){var html=Template(data,options);return asString||!0?html:$(html)},getData:getCustomData,render:render,getContainer:containerHelper.get,setResponse:setResponse,getResponse:getResponse,resetResponse:function(interaction){_setVal(interaction,!1)},destroy:destroy,setState:setState,getState:function(interaction){var state={},response=interaction.getResponse();return response&&(state.response=response),state}};return EndAttemptInteraction}),define("taoQtiItem/qtiCommonRenderer/renderers/interactions/ExtendedTextInteraction",["jquery","lodash","i18n","util/strLimiter","handlebars","lib/dompurify/purify","taoQtiItem/qtiCommonRenderer/helpers/container","taoQtiItem/qtiCommonRenderer/helpers/instructions/instructionManager","ckeditor","taoQtiItem/qtiCommonRenderer/helpers/ckConfigurator","taoQtiItem/qtiCommonRenderer/helpers/patternMask","ui/tooltip","core/logger"],function($$1,_,__,strLimiter,Handlebars,DOMPurify,containerHelper,instructionMgr,ckEditor,ckConfigurator,patternMaskHelper,tooltip,loggerFactory){'use strict';function inputLimiter(interaction){var $container=containerHelper.get(interaction),expectedLength=interaction.attr("expectedLength"),expectedLines=interaction.attr("expectedLines"),patternMask=interaction.attr("patternMask"),enabled=!1,patternRegEx,$textarea,$charsCounter,$wordsCounter,maxWords,maxLength,$maxLengthCounter,$maxWordsCounter;(expectedLength||expectedLines||patternMask)&&(enabled=!0,$textarea=$$1(".text-container",$container),$charsCounter=$$1(".count-chars",$container),$wordsCounter=$$1(".count-words",$container),$maxLengthCounter=$$1(".count-max-length",$container),$maxWordsCounter=$$1(".count-max-words",$container),""!==patternMask&&(maxWords=patternMaskHelper.parsePattern(patternMask,"words"),maxLength=patternMaskHelper.parsePattern(patternMask,"chars"),maxWords=_.isNaN(maxWords)?0:maxWords,maxLength=_.isNaN(maxLength)?0:maxLength,!maxLength&&!maxWords&&(patternRegEx=new RegExp(patternMask)),$maxLengthCounter.text(maxLength),$maxWordsCounter.text(maxWords)));var limiter={enabled:enabled,listenTextInput:function(){var _this2=this,ignoreKeyCodes=[8,13,16,17,46,37,38,39,40,35,36,1114177,3342401,1114181,3342405,2228232,2228261,4456485,2228262,2228263,4456487,2228264,2228237,1114120,1114177,1114202,1114200],triggerKeyCodes=[32,13,2228237],invalidToolip=tooltip.error($container,__("This is not a valid answer"),{position:"bottom",trigger:"manual"}),patternHandler=function(e){var isCke="xhtml"===_getFormat(interaction),newValue;if(patternRegEx){if(newValue=isCke?this.getData():e.currentTarget.value,!newValue)return!1;_.debounce(function(){patternRegEx.test(newValue)?($container.removeClass("invalid"),invalidToolip.dispose()):($container.addClass("invalid"),$container.show(),invalidToolip.show(),containerHelper.triggerResponseChangeEvent(interaction))},400)()}},keyLimitHandler=function(e){var keyCode=e&&e.data?e.data.keyCode:e.which;return!_.contains(ignoreKeyCodes,keyCode)&&(maxWords&&_this2.getWordsCount()>=maxWords&&_.contains(triggerKeyCodes,keyCode)||maxLength&&_this2.getCharsCount()>=maxLength)?(e.cancel?e.cancel():(e.preventDefault(),e.stopImmediatePropagation()),!1):void _.defer(function(){return _this2.updateCounter()})},nonKeyLimitHandler=function(e){var isCke="xhtml"===_getFormat(interaction),newValue;if(newValue="string"==typeof $$1(e.target).attr("data-clipboard")?$$1(e.target).attr("data-clipboard"):isCke?e.data.dataValue:e.originalEvent.clipboardData?e.originalEvent.clipboardData.getData("text"):e.originalEvent.dataTransfer.getData("text")||e.originalEvent.dataTransfer.getData("text/plain")||"",e.cancel?e.cancel():(e.preventDefault(),e.stopImmediatePropagation()),!newValue)return!1;if(_.isNull(maxWords)?!_.isNull(maxLength)&&(newValue=strLimiter.limitByCharCount(newValue,maxLength-_this2.getCharsCount())):newValue=strLimiter.limitByWordCount(newValue,maxWords-_this2.getWordsCount()),isCke)_getCKEditor(interaction).insertHtml(newValue);else{var elements=containerHelper.get(interaction).find("textarea"),el=elements[0],start=el.selectionStart,end=el.selectionEnd,text=el.value;elements.val(text.substring(0,start)+newValue+text.substring(end,text.length)),el.focus(),el.selectionStart=start+newValue.length,el.selectionEnd=el.selectionStart}_.defer(function(){return _this2.updateCounter()})},cke;"xhtml"===_getFormat(interaction)?(cke=_getCKEditor(interaction),cke.on("key",keyLimitHandler),cke.on("change",patternHandler),cke.on("paste",nonKeyLimitHandler)):$textarea.on("keyup.commonRenderer",patternHandler).on("keydown.commonRenderer",keyLimitHandler).on("paste.commonRenderer drop.commonRenderer",nonKeyLimitHandler)},getWordsCount:function(){var value=_getTextareaValue(interaction)||"";return _.isEmpty(value)?0:value.trim().replace(/\s+/gi," ").split(" ").length},getCharsCount:function(){var value=_getTextareaValue(interaction)||"";return value.replace(/[\r\n]{1}\xA0[\r\n]{1}/gm,"\r").replace(/[\r\n]+/gm,"").length},updateCounter:function(){$charsCounter.text(this.getCharsCount()),$wordsCounter.text(this.getWordsCount())}};return limiter}function _getTextareaValue(interaction,raw){return"xhtml"===_getFormat(interaction)?_ckEditorData(interaction,raw):containerHelper.get(interaction).find("textarea").val()}function _setPattern($element,pattern){var patt=new RegExp(pattern);$element.on("keyup.commonRenderer",function(){$element.removeClass("field-error"),patt.test($element.val())||$element.addClass("field-error")})}function _isMultiple(interaction){var attributes=interaction.getAttributes(),response=interaction.getResponseDeclaration();return!!(attributes.maxStrings&&("multiple"===response.attr("cardinality")||"ordered"===response.attr("cardinality")))}function _setUpCKEditor(interaction,options){var $container=containerHelper.get(interaction),editor=ckEditor.replace($container.find(".text-container")[0],options||{});if(editor)return $container.data("editor",editor.name),editor}function _destroyCkEditor(interaction){var $container=containerHelper.get(interaction),name=$container.data("editor"),editor;name&&(editor=ckEditor.instances[name]),editor&&(editor.destroy(),$container.removeData("editor"))}function _getCKEditor(interaction){var $container=containerHelper.get(interaction),name=$container.data("editor");return ckEditor.instances[name]}function _ckEditorData(interaction,raw){var editor=_getCKEditor(interaction),data=editor&&editor.getData()||"";return raw||(data=_stripTags(data)),data}function _stripTags(str){var tempNode=document.createElement("div");return tempNode.innerHTML=str,tempNode.textContent}function _getFormat(interaction){var format=interaction.attr("format");return _.contains(["plain","xhtml","preformatted"],format)?format:"plain"}function enable(interaction){var $container=containerHelper.get(interaction),editor;$container.find("input, textarea").removeAttr("disabled"),"xhtml"===_getFormat(interaction)&&(editor=_getCKEditor(interaction),editor&&("ready"===editor.status?editor.setReadOnly(!1):editor.readOnly=!1))}function disable(interaction){var $container=containerHelper.get(interaction),editor;$container.find("input, textarea").attr("disabled","disabled"),"xhtml"===_getFormat(interaction)&&(editor=_getCKEditor(interaction),editor&&("ready"===editor.status?editor.setReadOnly(!0):editor.readOnly=!0))}function setText(interaction,text){var limiter=inputLimiter(interaction);if("xhtml"===_getFormat(interaction))try{_getCKEditor(interaction).setData(text,function(){limiter.enabled&&limiter.updateCounter()})}catch(e){logger.warn("setText error ".concat(e,"!"))}else containerHelper.get(interaction).find("textarea").val(text),limiter.enabled&&limiter.updateCounter()}function destroy(interaction){var $container=containerHelper.get(interaction),$el=$container.find("input, textarea");"xhtml"===_getFormat(interaction)&&_destroyCkEditor(interaction),$el.off(".commonRenderer"),$$1(document).off(".commonRenderer"),instructionMgr.removeInstructions(interaction),containerHelper.reset(interaction)}function setState(interaction,state){if(_.isObject(state)&&state.response)try{interaction.setResponse(state.response)}catch(e){throw interaction.resetResponse(),e}}function getCustomData(interaction,data){var pattern=interaction.attr("patternMask"),maxWords=parseInt(patternMaskHelper.parsePattern(pattern,"words")),maxLength=parseInt(patternMaskHelper.parsePattern(pattern,"chars")),expectedLength=parseInt(interaction.attr("expectedLines"),10);return _.merge(data||{},{maxWords:isNaN(maxWords)?0:maxWords,maxLength:isNaN(maxLength)?0:maxLength,attributes:isNaN(expectedLength)?void 0:{expectedLength:72*expectedLength}})}$$1=$$1&&Object.prototype.hasOwnProperty.call($$1,"default")?$$1["default"]:$$1,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,__=__&&Object.prototype.hasOwnProperty.call(__,"default")?__["default"]:__,strLimiter=strLimiter&&Object.prototype.hasOwnProperty.call(strLimiter,"default")?strLimiter["default"]:strLimiter,Handlebars=Handlebars&&Object.prototype.hasOwnProperty.call(Handlebars,"default")?Handlebars["default"]:Handlebars,DOMPurify=DOMPurify&&Object.prototype.hasOwnProperty.call(DOMPurify,"default")?DOMPurify["default"]:DOMPurify,containerHelper=containerHelper&&Object.prototype.hasOwnProperty.call(containerHelper,"default")?containerHelper["default"]:containerHelper,instructionMgr=instructionMgr&&Object.prototype.hasOwnProperty.call(instructionMgr,"default")?instructionMgr["default"]:instructionMgr,ckEditor=ckEditor&&Object.prototype.hasOwnProperty.call(ckEditor,"default")?ckEditor["default"]:ckEditor,ckConfigurator=ckConfigurator&&Object.prototype.hasOwnProperty.call(ckConfigurator,"default")?ckConfigurator["default"]:ckConfigurator,patternMaskHelper=patternMaskHelper&&Object.prototype.hasOwnProperty.call(patternMaskHelper,"default")?patternMaskHelper["default"]:patternMaskHelper,tooltip=tooltip&&Object.prototype.hasOwnProperty.call(tooltip,"default")?tooltip["default"]:tooltip,loggerFactory=loggerFactory&&Object.prototype.hasOwnProperty.call(loggerFactory,"default")?loggerFactory["default"]:loggerFactory;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){function program1(depth0){var buffer="",stack1;return buffer+="id=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.id),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"",buffer}function program3(depth0){var buffer="",stack1;return buffer+=" "+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["class"]),"function"===_typeof(stack1)?stack1.apply(depth0):stack1)),buffer}function program5(depth0){var buffer="",stack1;return buffer+=" lang=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"",buffer}function program7(depth0,data){var stack1,helper;return(helper=helpers.prompt)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.prompt,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),stack1||0===stack1?stack1:""}function program9(depth0,data){var buffer="",stack1,helper,options;return buffer+="\n ",stack1=(helper=helpers.equal||depth0&&depth0.equal,options={hash:{},inverse:self.program(14,program14,data),fn:self.program(10,program10,data),data:data},helper?helper.call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.format),"xhtml",options):helperMissing.call(depth0,"equal",(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.format),"xhtml",options)),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n ",buffer}function program10(depth0,data){var buffer="",stack1;return buffer+="\n ",stack1=helpers.each.call(depth0,depth0&&depth0.maxStringLoop,{hash:{},inverse:self.noop,fn:self.program(11,program11,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n ",buffer}function program11(depth0,data){var buffer="",stack1;return buffer+="\n <div class=\"text-container text-"+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.format),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+" solid",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["class"]),{hash:{},inverse:self.noop,fn:self.program(12,program12,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\" name=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.identifier),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"_"+escapeExpression("function"===_typeof(depth0)?depth0.apply(depth0):depth0)+"\" contenteditable></div>\n ",buffer}function program12(){return" attributes.class"}function program14(depth0,data){var buffer="",stack1;return buffer+="\n ",stack1=helpers.each.call(depth0,depth0&&depth0.maxStringLoop,{hash:{},inverse:self.noop,fn:self.program(15,program15,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n ",buffer}function program15(depth0,data){var buffer="",stack1,helper;return buffer+="\n <textarea\n class=\"text-container text-"+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.format),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+" solid",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["class"]),{hash:{},inverse:self.noop,fn:self.program(12,program12,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\"\n name=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.identifier),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"_"+escapeExpression("function"===_typeof(depth0)?depth0.apply(depth0):depth0)+"\"\n ",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.patternMask),{hash:{},inverse:self.noop,fn:self.program(16,program16,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n aria-labelledby=\"",(helper=helpers.promptId)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.promptId,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\"\n ></textarea>\n ",buffer}function program16(depth0){var buffer="",stack1;return buffer+="pattern=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.patternMask),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"",buffer}function program18(depth0,data){var buffer="",stack1,helper,options;return buffer+="\n ",stack1=(helper=helpers.equal||depth0&&depth0.equal,options={hash:{},inverse:self.program(21,program21,data),fn:self.program(19,program19,data),data:data},helper?helper.call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.format),depth0&&depth0.xhtml,options):helperMissing.call(depth0,"equal",(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.format),depth0&&depth0.xhtml,options)),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n ",buffer}function program19(depth0,data){var buffer="",stack1;return buffer+="\n <div class=\"text-container text-"+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.format),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+" solid",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["class"]),{hash:{},inverse:self.noop,fn:self.program(12,program12,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\" contenteditable></div>\n ",buffer}function program21(depth0,data){var buffer="",stack1,helper;return buffer+="\n <textarea\n class=\"text-container text-"+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.format),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+" solid",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["class"]),{hash:{},inverse:self.noop,fn:self.program(12,program12,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\"\n ",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.patternMask),{hash:{},inverse:self.noop,fn:self.program(16,program16,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n aria-labelledby=\"",(helper=helpers.promptId)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.promptId,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\"\n ></textarea>\n ",buffer}function program23(depth0,data){var buffer="",stack1,helper,options;return buffer+="\n <span class=\"count-chars\">0</span> "+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"of",options):helperMissing.call(depth0,"__","of",options)))+" <span class=\"count-expected-length\">"+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.expectedLength),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"</span> "+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"characters",options):helperMissing.call(depth0,"__","characters",options)))+" "+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"recommended",options):helperMissing.call(depth0,"__","recommended",options)))+".\n ",buffer}function program25(depth0,data){var buffer="",stack1;return buffer+="\n ",stack1=helpers["if"].call(depth0,depth0&&depth0.maxLength,{hash:{},inverse:self.program(28,program28,data),fn:self.program(26,program26,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n ",stack1=helpers["if"].call(depth0,depth0&&depth0.maxWords,{hash:{},inverse:self.program(32,program32,data),fn:self.program(30,program30,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n ",buffer}function program26(depth0,data){var buffer="",stack1,helper,options;return buffer+="\n <span class=\"text-counter-chars\"><span class=\"count-chars\">0</span> "+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"of",options):helperMissing.call(depth0,"__","of",options)))+" <span class=\"count-max-length\">",(helper=helpers.maxLength)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.maxLength,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"</span> "+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"characters",options):helperMissing.call(depth0,"__","characters",options)))+" "+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"maximum",options):helperMissing.call(depth0,"__","maximum",options)))+".</span>\n ",buffer}function program28(depth0,data){var buffer="",stack1,helper,options;return buffer+="\n <span class=\"text-counter-chars\" style=\"display: none\"><span class=\"count-chars\">0</span> "+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"of",options):helperMissing.call(depth0,"__","of",options)))+" <span class=\"count-max-length\">",(helper=helpers.maxLength)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.maxLength,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"</span> "+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"characters",options):helperMissing.call(depth0,"__","characters",options)))+" "+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"maximum",options):helperMissing.call(depth0,"__","maximum",options)))+".</span>\n ",buffer}function program30(depth0,data){var buffer="",stack1,helper,options;return buffer+="\n <span class=\"text-counter-words\"><span class=\"count-words\">0</span> "+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"of",options):helperMissing.call(depth0,"__","of",options)))+" <span class=\"count-max-words\">",(helper=helpers.maxWords)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.maxWords,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"</span> "+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"words",options):helperMissing.call(depth0,"__","words",options)))+" "+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"maximum",options):helperMissing.call(depth0,"__","maximum",options)))+".</span>\n ",buffer}function program32(depth0,data){var buffer="",stack1,helper,options;return buffer+="\n <span class=\"text-counter-words\" style=\"display: none\"><span class=\"count-words\">0</span> "+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"of",options):helperMissing.call(depth0,"__","of",options)))+" <span class=\"count-max-words\">",(helper=helpers.maxWords)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.maxWords,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"</span> "+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"words",options):helperMissing.call(depth0,"__","words",options)))+" "+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"maximum",options):helperMissing.call(depth0,"__","maximum",options)))+".</span>\n ",buffer}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,self=this,helperMissing=helpers.helperMissing,stack1,helper;return buffer+="<div ",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.id),{hash:{},inverse:self.noop,fn:self.program(1,program1,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+=" class=\"qti-interaction qti-blockInteraction qti-extendedTextInteraction",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["class"]),{hash:{},inverse:self.noop,fn:self.program(3,program3,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\" data-serial=\"",(helper=helpers.serial)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.serial,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\" data-qti-class=\"extendedTextInteraction\"",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),{hash:{},inverse:self.noop,fn:self.program(5,program5,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+=">\n ",stack1=helpers["if"].call(depth0,depth0&&depth0.prompt,{hash:{},inverse:self.noop,fn:self.program(7,program7,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n <div class=\"instruction-container\"></div>\n ",stack1=helpers["if"].call(depth0,depth0&&depth0.multiple,{hash:{},inverse:self.program(18,program18,data),fn:self.program(9,program9,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n <div class=\"text-counter\">\n ",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.expectedLength),{hash:{},inverse:self.program(25,program25,data),fn:self.program(23,program23,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n </div>\n</div>\n",buffer}),logger=loggerFactory("taoQtiItem/qtiCommonRenderer/renderers/interactions/ExtendedTextInteraction.js"),resetResponse=function(interaction){"xhtml"===_getFormat(interaction)?_getCKEditor(interaction).setData(""):containerHelper.get(interaction).find("input, textarea").val("")},getResponse=function(interaction){var $container=containerHelper.get(interaction),attributes=interaction.getAttributes(),responseDeclaration=interaction.getResponseDeclaration(),baseType=responseDeclaration.attr("baseType"),numericBase=attributes.base||10,multiple=!!(attributes.maxStrings&&("multiple"===responseDeclaration.attr("cardinality")||"ordered"===responseDeclaration.attr("cardinality"))),ret=multiple?{list:{}}:{base:{}},value="",values;return multiple?(values=[],$container.find("input").each(function(i){var $el=$$1(this);attributes.placeholderText&&$el.val()===attributes.placeholderText?values[i]="":"integer"===baseType?(values[i]=parseInt($el.val(),numericBase),values[i]=isNaN(values[i])?"":values[i]):"float"===baseType?(values[i]=parseFloat($el.val()),values[i]=isNaN(values[i])?"":values[i]):"string"===baseType&&(values[i]=$el.val())}),ret.list[baseType]=values):(attributes.placeholderText&&_getTextareaValue(interaction)===attributes.placeholderText?value="":"integer"===baseType?value=parseInt(_getTextareaValue(interaction),numericBase):"float"===baseType?value=parseFloat(_getTextareaValue(interaction)):"string"===baseType&&(value=_getTextareaValue(interaction,!0)),ret.base[baseType]=isNaN(value)&&"number"==typeof value?"":value),ret},ExtendedTextInteraction={qtiClass:"extendedTextInteraction",template:function(data,options,asString){var html=Template(data,options);return asString||!0?html:$(html)},render:function(interaction){return new Promise(function(resolve,reject){var $container=containerHelper.get(interaction),multiple=_isMultiple(interaction),limiter=inputLimiter(interaction),placeholderText=interaction.attr("placeholderText"),ckOptions={resize_enabled:!0,secure:"https:"===location.protocol,forceCustomDomain:!0,language:function getItemLanguage(){var itemLang=$container.closest(".qti-item").attr("lang"),itemLocale=itemLang&&itemLang.split("-")[0];return itemLocale||(itemLang=window.document.documentElement.getAttribute("lang"),itemLocale=itemLang&&itemLang.split("-")[0]),itemLocale}()},$el,expectedLength,minStrings,patternMask,placeholderType,editor,_styleUpdater,themeLoaded,_getNumStrings;multiple?($el=$container.find("input"),minStrings=interaction.attr("minStrings"),expectedLength=interaction.attr("expectedLength"),patternMask=interaction.attr("patternMask"),minStrings&&(_getNumStrings=function($element){var num=0;return $element.each(function(){""!==$$1(this).val()&&num++}),num},minStrings=parseInt(minStrings,10),0<minStrings&&$el.on("blur.commonRenderer",function(){setTimeout(function(){!$el.is(":focus")&&_getNumStrings($el)<minStrings&&instructionMgr.appendNotification(interaction,"".concat(__("The minimum number of answers is ")," : ").concat(minStrings),"warning")},100)})),expectedLength&&(expectedLength=parseInt(expectedLength,10),0<expectedLength&&$el.each(function(){$$1(this).css("width","".concat(expectedLength,"em"))})),patternMask&&$el.each(function(){_setPattern($$1(this),patternMask)}),placeholderText&&(placeholderType="first","multiple"===placeholderType?$el.each(function(){$$1(this).attr("placeholder",placeholderText)}):"first"==placeholderType&&$el.first().attr("placeholder",placeholderText)),resolve()):($el=$container.find("textarea"),placeholderText&&$el.attr("placeholder",placeholderText),"xhtml"===_getFormat(interaction)?(_styleUpdater=function(){var qtiItemStyle,$editorBody,qtiItem;editor.document&&(qtiItem=$$1(".qti-item").get(0),qtiItemStyle=qtiItem.currentStyle||window.getComputedStyle(qtiItem),$editorBody=editor.document.$&&editor.document.$.body?$$1(editor.document.$.body):$$1(editor.document.getBody().$),$editorBody.css({"background-color":"transparent",color:qtiItemStyle.color}))},themeLoaded=function(){_styleUpdater()},editor=_setUpCKEditor(interaction,ckOptions),!editor&&reject("Unable to instantiate ckEditor"),editor.on("instanceReady",function(){_styleUpdater(),editor.container&&editor.container.$&&$$1(editor.container.$).addClass("no-key-navigation"),_.delay(resolve,300)}),("ready"===editor.status||"loaded"===editor.status)&&_.defer(resolve),editor.on("configLoaded",function(){editor.config=ckConfigurator.getConfig(editor,"extendedText",ckOptions),limiter.enabled&&limiter.listenTextInput()}),editor.on("change",function(){containerHelper.triggerResponseChangeEvent(interaction,{})}),$$1(document).on("themechange.themeloader",themeLoaded)):($el.on("keyup.commonRenderer change.commonRenderer",function(){containerHelper.triggerResponseChangeEvent(interaction,{})}),limiter.enabled&&limiter.listenTextInput(),resolve()))})},getContainer:containerHelper.get,setResponse:function setResponse(interaction,response){var _setMultipleVal=function(identifier,value){interaction.getContainer().find("#".concat(identifier)).val(value)},baseType=interaction.getResponseDeclaration().attr("baseType");if(null===response.base&&1===Object.keys(response).length&&(response={base:{string:""}}),response.base&&"undefined"!=typeof response.base[baseType])setText(interaction,response.base[baseType]);else if(response.list&&response.list[baseType])for(var i in response.list[baseType]){var serial="undefined"==typeof response.list.serial?"":response.list.serial[i];_setMultipleVal("".concat(serial,"_").concat(i),response.list[baseType][i])}else throw new Error("wrong response format in argument.")},getResponse:getResponse,getData:getCustomData,resetResponse:resetResponse,destroy:destroy,getState:function(interaction){var state={},response=interaction.getResponse();return response&&(state.response=response),state},setState:setState,enable:enable,disable:disable,clearText:function(interaction){setText(interaction,"")},setText:setText,inputLimiter:inputLimiter};return ExtendedTextInteraction}),define("taoQtiItem/qtiCommonRenderer/renderers/interactions/GapMatchInteraction",["lodash","i18n","jquery","handlebars","lib/dompurify/purify","taoQtiItem/qtiCommonRenderer/helpers/container","taoQtiItem/qtiCommonRenderer/helpers/PciResponse","interact","ui/interactUtils"],function(_,__,$$1,Handlebars,DOMPurify,containerHelper,pciResponse,interact,interactUtils){'use strict';_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,__=__&&Object.prototype.hasOwnProperty.call(__,"default")?__["default"]:__,$$1=$$1&&Object.prototype.hasOwnProperty.call($$1,"default")?$$1["default"]:$$1,Handlebars=Handlebars&&Object.prototype.hasOwnProperty.call(Handlebars,"default")?Handlebars["default"]:Handlebars,DOMPurify=DOMPurify&&Object.prototype.hasOwnProperty.call(DOMPurify,"default")?DOMPurify["default"]:DOMPurify,containerHelper=containerHelper&&Object.prototype.hasOwnProperty.call(containerHelper,"default")?containerHelper["default"]:containerHelper,pciResponse=pciResponse&&Object.prototype.hasOwnProperty.call(pciResponse,"default")?pciResponse["default"]:pciResponse,interact=interact&&Object.prototype.hasOwnProperty.call(interact,"default")?interact["default"]:interact,interactUtils=interactUtils&&Object.prototype.hasOwnProperty.call(interactUtils,"default")?interactUtils["default"]:interactUtils;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){function program1(depth0){var buffer="",stack1;return buffer+="id=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.id),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"",buffer}function program3(depth0){var buffer="",stack1;return buffer+=" "+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["class"]),"function"===_typeof(stack1)?stack1.apply(depth0):stack1)),buffer}function program5(depth0){var buffer="",stack1;return buffer+=" lang=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"",buffer}function program7(depth0,data){var stack1,helper;return(helper=helpers.prompt)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.prompt,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),stack1||0===stack1?stack1:""}function program9(depth0){var stack1;return stack1="function"===_typeof(depth0)?depth0.apply(depth0):depth0,stack1||0===stack1?stack1:""}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,self=this,blockHelperMissing=helpers.blockHelperMissing,stack1,helper,options;return buffer+="<div ",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.id),{hash:{},inverse:self.noop,fn:self.program(1,program1,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+=" class=\"qti-interaction qti-blockInteraction qti-gapMatchInteraction",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["class"]),{hash:{},inverse:self.noop,fn:self.program(3,program3,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\" data-serial=\"",(helper=helpers.serial)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.serial,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\" data-qti-class=\"gapMatchInteraction\"",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),{hash:{},inverse:self.noop,fn:self.program(5,program5,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+=">\n ",stack1=helpers["if"].call(depth0,depth0&&depth0.prompt,{hash:{},inverse:self.noop,fn:self.program(7,program7,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n <ul class=\"choice-area none block-listing solid horizontal source\">\n ",options={hash:{},inverse:self.noop,fn:self.program(9,program9,data),data:data},(helper=helpers.choices)?stack1=helper.call(depth0,options):(helper=depth0&&depth0.choices,stack1="function"===_typeof(helper)?helper.call(depth0,options):helper),helpers.choices||(stack1=blockHelperMissing.call(depth0,stack1,{hash:{},inverse:self.noop,fn:self.program(9,program9,data),data:data})),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n </ul>\n <div class=\"instruction-container\"></div>\n <div class=\"qti-flow-container\">",(helper=helpers.body)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.body,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),(stack1||0===stack1)&&(buffer+=stack1),buffer+="</div>\n</div>\n",buffer}),_choiceUsages={},setChoice=function(interaction,$choice,$target){var choiceSerial=$choice.data("serial"),choice=interaction.getChoice(choiceSerial);_choiceUsages[choiceSerial]||(_choiceUsages[choiceSerial]=0),_choiceUsages[choiceSerial]++,$target.data("serial",choiceSerial).html($choice.html()).addClass("filled"),!interaction.responseMappingMode&&choice.attr("matchMax")&&_choiceUsages[choiceSerial]>=choice.attr("matchMax")&&$choice.attr("class","deactivated"),containerHelper.triggerResponseChangeEvent(interaction)},unsetChoice=function(interaction,$choice){var serial=$choice.data("serial"),$container=containerHelper.get(interaction);$container.find(".choice-area [data-serial="+serial+"]").removeClass().addClass("qti-choice"),_choiceUsages[serial]--,$choice.removeClass("filled").removeData("serial").empty(),interaction.swapping||containerHelper.triggerResponseChangeEvent(interaction)},getChoice=function(interaction,identifier){var $container=containerHelper.get(interaction);return $$1(".choice-area [data-identifier=\""+identifier+"\"]",$container)},getGap=function(interaction,identifier){var $container=containerHelper.get(interaction);return $$1(".qti-flow-container [data-identifier=\""+identifier+"\"]",$container)},render=function(interaction){function _iFrameDragFix(draggableSelector,target){interactUtils.iFrameDragFixOn(function(){$activeDrop&&interact(gapSelector).fire({type:"drop",target:$activeDrop.eq(0),relatedTarget:target}),interact(draggableSelector).fire({type:"dragend",target:target})})}function _handleChoiceSelect($target){$activeChoice&&$target.hasClass("active")||$target.hasClass("deactivated")||(_resetSelection(),$activeChoice=$target.addClass("active"),$$1(gapSelector).addClass("empty"))}function _handleFilledGapSelect($target){$activeChoice=$target,$$1(gapSelector).addClass("active")}function _handleGapSelect($target){var choiceSerial,targetSerial;_isInsertionMode()?(choiceSerial=$activeChoice.data("serial"),targetSerial=$target.data("serial"),targetSerial!==choiceSerial&&(targetSerial&&_unsetChoice($target),_setChoice($activeChoice,$target)),$activeChoice.removeClass("active"),$container.find(".empty").removeClass("empty"),$activeChoice=null):_isModeEditing()?(choiceSerial=$activeChoice.data("serial"),targetSerial=$target.data("serial"),targetSerial!==choiceSerial&&(_unsetChoice($activeChoice),targetSerial&&(_unsetChoice($target),_setChoice(_getChoice(targetSerial),$activeChoice)),_setChoice(_getChoice(choiceSerial),$target)),_resetSelection()):$target.data("serial")&&$target.hasClass("filled")&&(targetSerial=$target.data("serial"),$activeChoice=$target,$activeChoice.addClass("active"),$flowContainer.find(">li>div").filter(function(){return $target.data("serial")!==targetSerial}).addClass("empty"),$choiceArea.find(">li:not(.deactivated)").filter(function(){return $target.data("serial")!==targetSerial}).addClass("empty"),$target.append($bin))}var $container=containerHelper.get(interaction),$choiceArea=$container.find(".choice-area"),$flowContainer=$container.find(".qti-flow-container"),$activeChoice=null,$activeDrop=null,$bin=$$1("<span>",{class:"icon-undo remove-choice",title:__("remove")}),choiceSelector=$choiceArea.selector+" .qti-choice",gapSelector=$flowContainer.selector+" .gapmatch-content",filledGapSelector=gapSelector+".filled",binSelector=$container.selector+" .remove-choice",_getChoice=function(serial){return $choiceArea.find("[data-serial="+serial+"]")},_setChoice=function($choice,$target){return setChoice(interaction,$choice,$target)},_resetSelection=function(){$activeChoice&&($flowContainer.find(".remove-choice").remove(),$activeChoice.removeClass("deactivated active"),$container.find(".empty").removeClass("empty"),$activeChoice=null)},_unsetChoice=function($choice){return unsetChoice(interaction,$choice)},_isInsertionMode=function(){return $activeChoice&&!$activeChoice.hasClass("filled")},_isModeEditing=function(){return $activeChoice&&$activeChoice.hasClass("filled")},isDragAndDropEnabled,dragOptions,scaleX,scaleY;this.getOption&&this.getOption("enableDragAndDrop")&&this.getOption("enableDragAndDrop").gapMatch&&(isDragAndDropEnabled=this.getOption("enableDragAndDrop").gapMatch),isDragAndDropEnabled&&(dragOptions={inertia:!1,autoScroll:!0,restrict:{restriction:".qti-interaction",endOnly:!1,elementRect:{top:0,left:1,bottom:1,right:1}}},interact(choiceSelector).draggable(_.assign({},dragOptions,{onstart:function onstart(e){var $target=$$1(e.target),scale;$target.addClass("dragged"),_handleChoiceSelect($target),_iFrameDragFix(choiceSelector,e.target),scale=interactUtils.calculateScale(e.target),scaleX=scale[0],scaleY=scale[1]},onmove:function onmove(e){interactUtils.moveElement(e.target,e.dx/scaleX,e.dy/scaleY)},onend:function onend(e){var $target=$$1(e.target);$target.removeClass("dragged"),interactUtils.restoreOriginalPosition($target),interactUtils.iFrameDragFixOff()}})).styleCursor(!1),interact(filledGapSelector).draggable(_.assign({},dragOptions,{onstart:function onstart(e){var $target=$$1(e.target),scale;$target.addClass("dragged"),_handleFilledGapSelect($target),_iFrameDragFix(filledGapSelector,e.target),scale=interactUtils.calculateScale(e.target),scaleX=scale[0],scaleY=scale[1]},onmove:function onmove(e){interactUtils.moveElement(e.target,e.dx/scaleX,e.dy/scaleY)},onend:function onend(e){var $target=$$1(e.target);$target.removeClass("dragged"),interactUtils.restoreOriginalPosition($target),$activeChoice&&(_unsetChoice($activeChoice),_resetSelection()),interactUtils.iFrameDragFixOff()}})).styleCursor(!1),interact(gapSelector).dropzone({overlap:.05,ondragenter:function ondragenter(e){var $target=$$1(e.target),$dragged=$$1(e.relatedTarget);$activeDrop=$target,$target.addClass("dropzone"),$dragged.addClass("droppable")},ondrop:function ondrop(e){_handleGapSelect($$1(e.target)),this.ondragleave(e)},ondragleave:function ondragleave(e){var $target=$$1(e.target),$dragged=$$1(e.relatedTarget);$target.removeClass("dropzone"),$dragged.removeClass("droppable"),$activeDrop=null}})),interact($container.selector).on("tap",function(e){e.stopPropagation(),_resetSelection()}),interact(choiceSelector).on("tap",function(e){e.stopPropagation(),_handleChoiceSelect($$1(e.currentTarget)),e.preventDefault()}),interact(gapSelector).on("tap",function(e){e.stopPropagation(),_handleGapSelect($$1(e.currentTarget)),e.preventDefault()}),interact(binSelector).on("tap",function(e){e.stopPropagation(),_unsetChoice($activeChoice),_resetSelection(),e.preventDefault()})},resetResponse=function(interaction){var $container=containerHelper.get(interaction);$$1(".gapmatch-content.active",$container).removeClass("active"),$$1(".gapmatch-content",$container).each(function(){unsetChoice(interaction,$$1(this))})},_setPairs=function(interaction,pair){pair&&pair.length&&setChoice(interaction,getChoice(interaction,pair[0]),getGap(interaction,pair[1]).find(".gapmatch-content"))},setResponse=function(interaction,response){resetResponse(interaction);var pairs=pciResponse.unserialize(response,interaction);_.isArray(pairs)&&_.isArray(pairs[0])?_.forEach(pairs,function(pair){return _setPairs(interaction,pair)}):_setPairs(interaction,pairs)},_getRawResponse=function(interaction){var response=[],$container=containerHelper.get(interaction);return $$1(".gapmatch-content",$container).each(function(){var choiceSerial=$$1(this).data("serial"),pair=[];choiceSerial&&pair.push(interaction.getChoice(choiceSerial).attr("identifier")),pair.push($$1(this).data("identifier")),2===pair.length&&response.push(pair)}),response},getResponse=function(interaction){return pciResponse.serialize(_getRawResponse(interaction),interaction)},destroy=function(interaction){var $container=containerHelper.get(interaction);interact($container.selector).unset(),interact($container.find(".choice-area").selector+" .qti-choice").unset(),interact($container.find(".qti-flow-container").selector+" .gapmatch-content").unset(),interact($container.find(".remove-choice").selector).unset(),$container.find(".gapmatch-content").empty(),$container.find(".active").removeClass("active"),$container.find(".remove-choice").remove(),$container.find(".empty").removeClass("empty"),containerHelper.reset(interaction)},setState=function(interaction,state){var $container;_.isObject(state)&&(state.response&&(interaction.resetResponse(),interaction.setResponse(state.response)),_.isArray(state.order)&&state.order.length===_.size(interaction.getChoices())&&($container=containerHelper.get(interaction),$$1(".choice-area .qti-choice",$container).sort(function(a,b){var aIndex=_.indexOf(state.order,$$1(a).data("identifier")),bIndex=_.indexOf(state.order,$$1(b).data("identifier"));return aIndex>bIndex?1:aIndex<bIndex?-1:0}).detach().appendTo($$1(".choice-area",$container))))},getState=function(interaction){var state={},response=interaction.getResponse(),$container;return response&&(state.response=response),!0===interaction.attr("shuffle")&&($container=containerHelper.get(interaction),state.order=[],$$1(".choice-area .qti-choice",$container).each(function(){state.order.push($$1(this).data("identifier"))})),state},GapMatchInteraction={qtiClass:"gapMatchInteraction",template:function(data,options,asString){var html=Template(data,options);return asString||!0?html:$(html)},render:render,getContainer:containerHelper.get,setResponse:setResponse,getResponse:getResponse,resetResponse:resetResponse,destroy:destroy,setState:setState,getState:getState};return GapMatchInteraction}),define("taoQtiItem/qtiCommonRenderer/renderers/interactions/GraphicAssociateInteraction",["jquery","lodash","i18n","handlebars","lib/dompurify/purify","taoQtiItem/qtiCommonRenderer/helpers/Graphic","taoQtiItem/qtiCommonRenderer/helpers/PciResponse","taoQtiItem/qtiCommonRenderer/helpers/container","taoQtiItem/qtiCommonRenderer/helpers/instructions/instructionManager"],function($$1,_,__,Handlebars,DOMPurify,graphic,pciResponse,containerHelper,instructionMgr){'use strict';$$1=$$1&&Object.prototype.hasOwnProperty.call($$1,"default")?$$1["default"]:$$1,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,__=__&&Object.prototype.hasOwnProperty.call(__,"default")?__["default"]:__,Handlebars=Handlebars&&Object.prototype.hasOwnProperty.call(Handlebars,"default")?Handlebars["default"]:Handlebars,DOMPurify=DOMPurify&&Object.prototype.hasOwnProperty.call(DOMPurify,"default")?DOMPurify["default"]:DOMPurify,graphic=graphic&&Object.prototype.hasOwnProperty.call(graphic,"default")?graphic["default"]:graphic,pciResponse=pciResponse&&Object.prototype.hasOwnProperty.call(pciResponse,"default")?pciResponse["default"]:pciResponse,containerHelper=containerHelper&&Object.prototype.hasOwnProperty.call(containerHelper,"default")?containerHelper["default"]:containerHelper,instructionMgr=instructionMgr&&Object.prototype.hasOwnProperty.call(instructionMgr,"default")?instructionMgr["default"]:instructionMgr;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){function program1(depth0){var buffer="",stack1;return buffer+="id=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.id),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"",buffer}function program3(depth0){var buffer="",stack1;return buffer+=" "+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["class"]),"function"===_typeof(stack1)?stack1.apply(depth0):stack1)),buffer}function program5(depth0){var buffer="",stack1;return buffer+=" lang=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"",buffer}function program7(depth0,data){var stack1,helper;return(helper=helpers.prompt)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.prompt,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),stack1||0===stack1?stack1:""}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,self=this,stack1,helper;return buffer+="<div ",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.id),{hash:{},inverse:self.noop,fn:self.program(1,program1,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+=" class=\"qti-interaction qti-blockInteraction qti-graphicInteraction qti-graphicAssociateInteraction clearfix",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["class"]),{hash:{},inverse:self.noop,fn:self.program(3,program3,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\" data-serial=\"",(helper=helpers.serial)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.serial,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\"",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),{hash:{},inverse:self.noop,fn:self.program(5,program5,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+=">\n ",stack1=helpers["if"].call(depth0,depth0&&depth0.prompt,{hash:{},inverse:self.noop,fn:self.program(7,program7,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n <div class=\"instruction-container\"></div>\n <div class=\"image-editor solid\">\n <div id='graphic-paper-",(helper=helpers.serial)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.serial,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"' class=\"main-image-box\"></div>\n </div>\n</div>\n",buffer}),_renderChoice=function(interaction,choice){var shape=choice.attr("shape"),coords=choice.attr("coords"),maxAssociations=interaction.attr("maxAssociations"),rElement=graphic.createElement(interaction.paper,shape,coords,{id:choice.serial,title:__("Select this area to start an association")}).data("max",choice.attr("matchMax")).data("matching",0).removeData("assocs").click(function(){var self=this,active,assocs;return 0<maxAssociations&&_getRawResponse(interaction).length>=maxAssociations?(_shapesUnSelectable(interaction),void instructionMgr.validateInstructions(interaction,{choice:choice,target:this})):void(active=_getActiveElement(interaction),this.selectable?(active&&(active.data("matching",active.data("matching")+1),this.data("matching",this.data("matching")+1),assocs=active.data("assocs")||[],assocs.push(choice.id()),active.data("assocs",assocs),_createPath(interaction,active,this,function(){active.data("matching",active.data("matching")-1),self.data("matching",self.data("matching")-1),active.data("assocs",_.pull(active.data("assocs")||[],choice.id())),containerHelper.triggerResponseChangeEvent(interaction),instructionMgr.validateInstructions(interaction,{choice:choice,target:self})})),_shapesUnSelectable(interaction)):this.active?_shapesUnSelectable(interaction):_isMatchable(this)&&(active&&_shapesUnSelectable(interaction),graphic.updateElementState(this,"active",__("Select this area to start an association")),this.active=!0,_shapesSelectable(interaction,this)),containerHelper.triggerResponseChangeEvent(interaction),instructionMgr.validateInstructions(interaction,{choice:choice,target:this}))})},_paperUnSelect=function(interaction){var $container=containerHelper.get(interaction),image=interaction.paper.getById("bg-image-"+interaction.serial);image&&image.click(function(){_shapesUnSelectable(interaction),$container.trigger("unselect.graphicassociate")})},_getActiveElement=function(interaction){var active;return _.forEach(interaction.getChoices(),function(choice){var element=interaction.paper.getById(choice.serial);if(element&&!0===element.active)return active=element,!1}),active},_createPath=function(interaction,srcElement,destElement,onRemove){function showCloser(){closerBg.toFront().animate({opacity:.8},300).click(removeSet),closer.toFront().animate({opacity:1},300).click(removeSet)}function hideCloser(){closerBg&&closerBg.type&&(closerBg.animate({opacity:0},300,function(){closerBg.toBack()}).unclick(),closer.animate({opacity:0},300,function(){closer.toBack()}).unclick())}function removeSet(){_.invoke(vset,"remove"),interaction._vsets=_.without(interaction._vsets,vset),"function"==typeof onRemove&&onRemove()}var $container=containerHelper.get(interaction),vset=[],src=srcElement.getBBox(),sx=src.x+src.width/2,sy=src.y+src.height/2,dest=destElement.getBBox(),dx=dest.x+dest.width/2,dy=dest.y+dest.height/2,srcBullet=interaction.paper.circle(sx,sy,3).attr(graphic._style["assoc-bullet"]),destBullet=interaction.paper.circle(dx,dy,3).attr(graphic._style["assoc-bullet"]),path=interaction.paper.path("M"+sx+","+sy+"L"+sx+","+sy).attr(graphic._style.assoc).animate({path:"M"+sx+","+sy+"L"+dx+","+dy},300),layer=interaction.paper.path("M"+sx+","+sy+"L"+dx+","+dy).attr(graphic._style["assoc-layer"]),midPath=layer.getPointAtLength(layer.getTotalLength()/2),closerBg=interaction.paper.circle(midPath.x,midPath.y,9).attr(graphic._style["close-bg"]).toBack(),closer=interaction.paper.path(graphic._style.close.path).attr(graphic._style.close).transform("T"+(midPath.x-9)+","+(midPath.y-9)).attr("title",_("Click again to remove")).toBack();srcElement.toFront(),destElement.toFront(),vset=[srcBullet,path,destBullet,layer,closerBg,closer],interaction._vsets.push(vset),_.invoke(vset,"data","assoc-path",!0),layer.click(function(){0===closer.attrs.opacity?showCloser():hideCloser()}),$container.on("unselect.graphicassociate",function(){hideCloser()})},_shapesSelectable=function(interaction,active){var assocs=active.data("assocs")||[],choices=interaction.getChoices(),activeChoice=choices[active.id];_.forEach(choices,function(choice){var element,assocsElement;_.contains(assocs,choice.id())||(element=interaction.paper.getById(choice.serial),assocsElement=element.data("assocs")||[],!element.active&&element.id!==active.id&&_isMatchable(element)&&!_.contains(assocsElement,activeChoice.id())&&(element.selectable=!0,graphic.updateElementState(element,"selectable")))})},_shapesUnSelectable=function(interaction){_.forEach(interaction.getChoices(),function(choice){var element=interaction.paper.getById(choice.serial);element&&(element.selectable=!1,element.active=!1,graphic.updateElementState(element,"basic"))})},_isMatchable=function(element){var matchable=!1,matching,matchMax;return element&&(matchMax=element.data("max")||0,matching=element.data("matching")||0,matchable=0===matchMax||matchMax>matching),matchable},_getRawResponse=function(interaction){var responses=[];return _.forEach(interaction.getChoices(),function(choice){var element=interaction.paper.getById(choice.serial),assocs=element.data("assocs");element&&assocs&&(responses=responses.concat(_.map(assocs,function(id){return[choice.id(),id]})))}),responses},setResponse=function(interaction,response){var responseValues,map;if(response&&interaction.paper){try{responseValues=pciResponse.unserialize(response,interaction),2!==responseValues.length||Array.isArray(responseValues[0])||Array.isArray(responseValues[1])||(responseValues=[responseValues])}catch(e){}_.isArray(responseValues)&&(map=_.transform(interaction.getChoices(),function(res,choice){res[choice.id()]=interaction.paper.getById(choice.serial)}),_.forEach(responseValues,function(responseValue){var el1,el2;_.isArray(responseValue)&&2===responseValue.length&&(el1=map[responseValue[0]],el2=map[responseValue[1]],el1&&el2&&(graphic.trigger(el1,"click"),graphic.trigger(el2,"click")))}))}},resetResponse=function(interaction){var toRemove=[];_.forEach(interaction.getChoices(),function(choice){var element=interaction.paper.getById(choice.serial);element&&element.data({max:choice.attr("matchMax"),matching:0,assocs:[]})}),interaction&&interaction.paper&&interaction.paper.forEach(function(elt){elt.data("assoc-path")&&toRemove.push(elt)}),_.invoke(toRemove,"remove")},getResponse=function(interaction){var raw=_getRawResponse(interaction),response=pciResponse.serialize(raw,interaction);return response},destroy=function(interaction){var $container;interaction.paper&&($container=containerHelper.get(interaction),$$1(window).off("resize.qti-widget."+interaction.serial),$container.off("resize.qti-widget."+interaction.serial),interaction.paper.clear(),instructionMgr.removeInstructions(interaction),$container.off(".graphicassociate"),$$1(".main-image-box",$container).empty().removeAttr("style"),$$1(".image-editor",$container).removeAttr("style"),$$1("ul",$container).empty()),containerHelper.reset(interaction)},setState=function(interaction,state){_.isObject(state)&&state.response&&(interaction.resetResponse(),interaction.setResponse(state.response))},GraphicAssociateInteraction={qtiClass:"graphicAssociateInteraction",template:function(data,options,asString){var html=Template(data,options);return asString||!0?html:$(html)},render:function(interaction){var self=this;return new Promise(function(resolve){var $container=containerHelper.get(interaction),background=interaction.object.attributes;interaction._vsets=[],$container.off("resized.qti-widget.resolve").one("resized.qti-widget.resolve",resolve),interaction.paper=graphic.responsivePaper("graphic-paper-"+interaction.serial,interaction.serial,{width:background.width,height:background.height,img:self.resolveUrl(background.data),imgId:"bg-image-"+interaction.serial,container:$container}),_.forEach(interaction.getChoices(),_.partial(_renderChoice,interaction)),_paperUnSelect(interaction),instructionMgr.minMaxChoiceInstructions(interaction,{min:interaction.attr("minAssociations"),max:interaction.attr("maxAssociations"),getResponse:_getRawResponse,onError:function onError(data){data&&data.target&&graphic.highlightError(data.target)}})})},getContainer:containerHelper.get,setResponse:setResponse,getResponse:getResponse,resetResponse:resetResponse,destroy:destroy,setState:setState,getState:function(interaction){var state={},response=interaction.getResponse();return response&&(state.response=response),state}};return GraphicAssociateInteraction}),define("taoQtiItem/qtiCommonRenderer/renderers/interactions/GraphicGapMatchInteraction",["jquery","lodash","i18n","module","core/mouseEvent","handlebars","lib/dompurify/purify","taoQtiItem/qtiCommonRenderer/helpers/Graphic","taoQtiItem/qtiCommonRenderer/helpers/PciResponse","taoQtiItem/qtiCommonRenderer/helpers/container","taoQtiItem/qtiCommonRenderer/helpers/instructions/instructionManager","interact","ui/interactUtils"],function($$1,_,__,module,mouseEvent,Handlebars,DOMPurify,graphic,pciResponse,containerHelper,instructionMgr,interact,interactUtils){'use strict';$$1=$$1&&Object.prototype.hasOwnProperty.call($$1,"default")?$$1["default"]:$$1,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,__=__&&Object.prototype.hasOwnProperty.call(__,"default")?__["default"]:__,module=module&&Object.prototype.hasOwnProperty.call(module,"default")?module["default"]:module,Handlebars=Handlebars&&Object.prototype.hasOwnProperty.call(Handlebars,"default")?Handlebars["default"]:Handlebars,DOMPurify=DOMPurify&&Object.prototype.hasOwnProperty.call(DOMPurify,"default")?DOMPurify["default"]:DOMPurify,graphic=graphic&&Object.prototype.hasOwnProperty.call(graphic,"default")?graphic["default"]:graphic,pciResponse=pciResponse&&Object.prototype.hasOwnProperty.call(pciResponse,"default")?pciResponse["default"]:pciResponse,containerHelper=containerHelper&&Object.prototype.hasOwnProperty.call(containerHelper,"default")?containerHelper["default"]:containerHelper,instructionMgr=instructionMgr&&Object.prototype.hasOwnProperty.call(instructionMgr,"default")?instructionMgr["default"]:instructionMgr,interact=interact&&Object.prototype.hasOwnProperty.call(interact,"default")?interact["default"]:interact,interactUtils=interactUtils&&Object.prototype.hasOwnProperty.call(interactUtils,"default")?interactUtils["default"]:interactUtils;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){function program1(depth0){var buffer="",stack1;return buffer+="id=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.id),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"",buffer}function program3(depth0){var buffer="",stack1;return buffer+=" "+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["class"]),"function"===_typeof(stack1)?stack1.apply(depth0):stack1)),buffer}function program5(depth0){var buffer="",stack1;return buffer+=" lang=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"",buffer}function program7(depth0,data){var stack1,helper;return(helper=helpers.prompt)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.prompt,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),stack1||0===stack1?stack1:""}function program9(depth0){var stack1;return stack1="function"===_typeof(depth0)?depth0.apply(depth0):depth0,stack1||0===stack1?stack1:""}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,self=this,blockHelperMissing=helpers.blockHelperMissing,stack1,helper,options;return buffer+="<div ",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.id),{hash:{},inverse:self.noop,fn:self.program(1,program1,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+=" class=\"qti-interaction qti-blockInteraction qti-graphicInteraction qti-graphicGapMatchInteraction clearfix",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["class"]),{hash:{},inverse:self.noop,fn:self.program(3,program3,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\" data-serial=\"",(helper=helpers.serial)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.serial,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\"",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),{hash:{},inverse:self.noop,fn:self.program(5,program5,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+=">\n ",stack1=helpers["if"].call(depth0,depth0&&depth0.prompt,{hash:{},inverse:self.noop,fn:self.program(7,program7,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n <div class=\"instruction-container\"></div>\n <div class=\"image-editor solid\">\n <div id='graphic-paper-",(helper=helpers.serial)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.serial,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"' class=\"main-image-box\"></div>\n <div class=\"clearfix\"></div>\n <ul class=\"none block-listing horizontal source\">\n ",options={hash:{},inverse:self.noop,fn:self.program(9,program9,data),data:data},(helper=helpers.gapImgs)?stack1=helper.call(depth0,options):(helper=depth0&&depth0.gapImgs,stack1="function"===_typeof(helper)?helper.call(depth0,options):helper),helpers.gapImgs||(stack1=blockHelperMissing.call(depth0,stack1,{hash:{},inverse:self.noop,fn:self.program(9,program9,data),data:data})),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n </ul>\n </div>\n</div>\n",buffer}),activeDrop=null,_choiceUsages={},isDirectedPairFlipped=module.config().flipDirectedPair,_isMatchable=function(element){var matchable=!1,matching,matchMax;return element&&(matchMax=element.data("max")||0,matching=element.data("matching")||[],matchable=0===matchMax||matchMax>matching.length),matchable},_shapesSelectable=function(interaction){var tooltip=__("Select the area to add an image");_.forEach(interaction.getChoices(),function(choice){var element=interaction.paper.getById(choice.serial);_isMatchable(element)&&(element.selectable=!0,graphic.setStyle(element,"selectable"),graphic.updateTitle(element,tooltip))}),_.forEach(interaction.gapFillers,function(gapFiller){gapFiller.forEach(function(element){graphic.updateTitle(element,tooltip)})})},_shapesUnSelectable=function(interaction){_.forEach(interaction.getChoices(),function(choice){var element=interaction.paper.getById(choice.serial);element&&(element.selectable=!1,graphic.setStyle(element,"basic"),graphic.updateTitle(element,__("Select an image first")))}),_.forEach(interaction.gapFillers,function(gapFiller){gapFiller.forEach(function(element){graphic.updateTitle(element,__("Remove"))})})},_paperUnSelect=function(interaction){var $container=containerHelper.get(interaction),$gapImages=$$1("ul > li",$container),bgImage=interaction.paper.getById("bg-image-"+interaction.serial);bgImage&&interact(bgImage.node).on("tap",function(){_shapesUnSelectable(interaction),$gapImages.removeClass("active")})},_setChoice=function(interaction,$choice){var choiceSerial=$choice.data("serial"),choice=interaction.getGapImg(choiceSerial),matchMax,usages;_choiceUsages[choiceSerial]||(_choiceUsages[choiceSerial]=0),_choiceUsages[choiceSerial]++,!interaction.responseMappingMode&&choice.attr("matchMax")&&(matchMax=+choice.attr("matchMax"),usages=+_choiceUsages[choiceSerial],0!==matchMax&&matchMax<=usages&&(interact($choice.get(0)).draggable(!1),$choice.addClass("disabled"),$choice.removeClass("selectable")))},_unsetChoice=function(interaction,$choice){var choiceSerial=$choice.data("serial");_choiceUsages[choiceSerial]--,$choice.removeClass("disabled"),$choice.addClass("selectable"),interact($choice.get(0)).draggable(!0)},_selectShape=function(interaction,element){var $container=containerHelper.get(interaction),$gapList=$$1("ul",$container),$active=$gapList.find(".active:first"),$imageBox=$$1(".main-image-box",$container),boxOffset=$imageBox.offset(),$img,$clone,gapFiller,id,bbox,shapeOffset,activeOffset,matching,currentCount;$active.length&&(id=$active.data("identifier"),matching=element.data("matching")||[],matching.push(id),element.data("matching",matching),currentCount=matching.length,$img=$active.find("img"),_shapesUnSelectable(interaction),$gapList.children().removeClass("active"),_setChoice(interaction,$active),$clone=$img.clone(),shapeOffset=$$1(element.node).offset(),activeOffset=$active.offset(),$clone.css({position:"absolute",display:"block","z-index":1e4,opacity:.8,top:activeOffset.top-boxOffset.top,left:activeOffset.left-boxOffset.left}),$clone.appendTo($imageBox),$clone.animate({top:shapeOffset.top-boxOffset.top,left:shapeOffset.left-boxOffset.left},200,function(){var gapFillerImage;$clone.remove(),bbox=element.getBBox(),gapFiller=graphic.createBorderedImage(interaction.paper,{url:$img.attr("src"),left:bbox.x+8*(currentCount-1),top:bbox.y+8*(currentCount-1),width:parseInt($img.attr("width"),10),height:parseInt($img.attr("height"),10),padding:0,border:!1,shadow:!0}).data("identifier",id).toFront(),gapFillerImage=gapFiller[2].node,interact(gapFillerImage).on("tap",function(e){var target=e.currentTarget,rElement=interaction.paper.getById(target.raphaelid);e.preventDefault(),e.stopPropagation(),0<$gapList.find(".active").length?interactUtils.tapOn(element.node):(element.data("matching",_.without(element.data("matching")||[],rElement.data("identifier"))),interaction.gapFillers=_.without(interaction.gapFillers,gapFiller),gapFiller.remove(),_unsetChoice(interaction,$active),containerHelper.triggerResponseChangeEvent(interaction))}),interaction.gapFillers.push(gapFiller),containerHelper.triggerResponseChangeEvent(interaction)}))},_renderChoice=function(interaction,choice){function handleShapeSelect(){_isMatchable(rElement)&&!0===rElement.selectable&&_selectShape(interaction,rElement)}var rElement=graphic.createElement(interaction.paper,choice.attr("shape"),choice.attr("coords"),{id:choice.serial,title:__("Select an image first"),hover:!1}).data("max",choice.attr("matchMax")).data("matching",[]);interact(rElement.node).on("tap",function(){handleShapeSelect()}),isDragAndDropEnabled&&interact(rElement.node).dropzone({overlap:.15,ondragenter:function ondragenter(){_isMatchable(rElement)&&(graphic.setStyle(rElement,"hover"),activeDrop=rElement.node)},ondrop:function ondrop(){_isMatchable(rElement)&&(graphic.setStyle(rElement,"selectable"),handleShapeSelect(),activeDrop=null)},ondragleave:function ondragleave(){_isMatchable(rElement)&&(graphic.setStyle(rElement,"selectable"),activeDrop=null)}})},_iFrameDragFix=function(draggableSelector,target){interactUtils.iFrameDragFixOn(function(){activeDrop&&interact(activeDrop).fire({type:"drop",target:activeDrop,relatedTarget:target}),interact(draggableSelector).fire({type:"dragend",target:target})})},_renderGapList=function(interaction,$gapList){function toggleActiveGapState($target){$target.hasClass("disabled")||($target.hasClass("active")?_setInactiveGapState($target):_setActiveGapState($target))}function _setActiveGapState($target){$gapList.children("li").removeClass("active"),$target.addClass("active"),_shapesSelectable(interaction)}function _setInactiveGapState($target){$target.removeClass("active"),_shapesUnSelectable(interaction)}var gapFillersSelector=$gapList.selector+" li",dragOptions,scaleX,scaleY;interact(gapFillersSelector).on("tap",function(e){e.stopPropagation(),e.preventDefault(),toggleActiveGapState($$1(e.currentTarget))}),isDragAndDropEnabled&&(dragOptions={inertia:!1,autoScroll:!0,restrict:{restriction:".qti-interaction",endOnly:!1,elementRect:{top:0,left:0,bottom:1,right:1}}},$$1(gapFillersSelector).each(function(index,gap){interact(gap).draggable(_.assign({},dragOptions,{onstart:function onstart(e){var $target=$$1(e.target),scale;_setActiveGapState($target),$target.addClass("dragged"),_iFrameDragFix(gapFillersSelector,e.target),scale=interactUtils.calculateScale(e.target),scaleX=scale[0],scaleY=scale[1]},onmove:function onmove(e){interactUtils.moveElement(e.target,e.dx/scaleX,e.dy/scaleY)},onend:function onend(e){_.defer(function(){var $target=$$1(e.target);_setInactiveGapState($target),$target.removeClass("dragged"),interactUtils.restoreOriginalPosition($target),interactUtils.iFrameDragFixOff()})}})).styleCursor(!1)}))},_getRawResponse=function(interaction){var pairs=[];return _.forEach(interaction.getChoices(),function(choice){var element=interaction.paper.getById(choice.serial);element&&_.isArray(element.data("matching"))&&_.forEach(element.data("matching"),function(gapImg){isDirectedPairFlipped?pairs.push([choice.id(),gapImg]):pairs.push([gapImg,choice.id()])})}),_.sortBy(pairs,[0,1])},setResponse=function(interaction,response){var $container=containerHelper.get(interaction),responseValues;if(response&&interaction.paper){try{responseValues=pciResponse.unserialize(response,interaction)}catch(e){responseValues=null}_.isArray(responseValues)&&_.forEach(interaction.getChoices(),function(choice){var element=interaction.paper.getById(choice.serial);element&&_.forEach(responseValues,function(pair){var responseChoice,responseGap;2===pair.length&&(responseChoice=isDirectedPairFlipped?pair[0]:pair[1],responseGap=isDirectedPairFlipped?pair[1]:pair[0],responseChoice===choice.id()&&($$1("[data-identifier=\""+responseGap+"\"]",$container).addClass("active"),_selectShape(interaction,element)))})})}},resetResponse=function(interaction){_shapesUnSelectable(interaction),_.forEach(interaction.gapFillers,function(gapFiller){interactUtils.tapOn(gapFiller.items[2][0])})},getResponse=function(interaction){var raw=_getRawResponse(interaction);return pciResponse.serialize(raw,interaction)},destroy=function(interaction){var $container;interaction.paper&&($container=containerHelper.get(interaction),$$1(window).off("resize.qti-widget."+interaction.serial),$container.off("resize.qti-widget."+interaction.serial),interaction.paper.clear(),instructionMgr.removeInstructions(interaction),$$1(".main-image-box",$container).empty().removeAttr("style"),$$1(".image-editor",$container).removeAttr("style"),$$1("ul",$container).empty(),interact($container.find("ul.source li").selector).unset(),interact($container.find(".main-image-box rect").selector).unset()),containerHelper.reset(interaction)},setState=function(interaction,state){_.isObject(state)&&state.response&&(interaction.resetResponse(),interaction.setResponse(state.response))},GraphicGapMatchInteraction={qtiClass:"graphicGapMatchInteraction",template:function(data,options,asString){var html=Template(data,options);return asString||!0?html:$(html)},render:function(interaction){var self=this;return new Promise(function(resolve){var $container=containerHelper.get(interaction),$gapList=$$1("ul.source",$container),background=interaction.object.attributes;interaction.gapFillers=[],self.getOption&&self.getOption("enableDragAndDrop")&&self.getOption("enableDragAndDrop").graphicGapMatch&&(isDragAndDropEnabled=self.getOption("enableDragAndDrop").graphicGapMatch),$container.off("resized.qti-widget.resolve").one("resized.qti-widget.resolve",resolve),interaction.paper=graphic.responsivePaper("graphic-paper-"+interaction.serial,interaction.serial,{width:background.width,height:background.height,img:self.resolveUrl(background.data),imgId:"bg-image-"+interaction.serial,container:$container,resize:function resize(newSize,factor){$gapList.css("max-width",newSize+"px"),1!==factor&&$gapList.find("img").each(function(){var $img=$$1(this);$img.width($img.attr("width")*factor),$img.height($img.attr("height")*factor)})}}),_.forEach(interaction.getChoices(),_.partial(_renderChoice,interaction)),_renderGapList(interaction,$gapList),_paperUnSelect(interaction)})},getContainer:containerHelper.get,setResponse:setResponse,getResponse:getResponse,resetResponse:resetResponse,destroy:destroy,setState:setState,getState:function(interaction){var state={},response=interaction.getResponse();return response&&(state.response=response),state},isDirectedPairFlipped:isDirectedPairFlipped},isDragAndDropEnabled;return GraphicGapMatchInteraction}),define("taoQtiItem/qtiCommonRenderer/renderers/interactions/GraphicOrderInteraction",["jquery","lodash","i18n","handlebars","lib/dompurify/purify","taoQtiItem/qtiCommonRenderer/helpers/Graphic","taoQtiItem/qtiCommonRenderer/helpers/PciResponse","taoQtiItem/qtiCommonRenderer/helpers/container","taoQtiItem/qtiCommonRenderer/helpers/instructions/instructionManager"],function($$1,_,__,Handlebars,DOMPurify,graphic,pciResponse,containerHelper,instructionMgr){'use strict';$$1=$$1&&Object.prototype.hasOwnProperty.call($$1,"default")?$$1["default"]:$$1,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,__=__&&Object.prototype.hasOwnProperty.call(__,"default")?__["default"]:__,Handlebars=Handlebars&&Object.prototype.hasOwnProperty.call(Handlebars,"default")?Handlebars["default"]:Handlebars,DOMPurify=DOMPurify&&Object.prototype.hasOwnProperty.call(DOMPurify,"default")?DOMPurify["default"]:DOMPurify,graphic=graphic&&Object.prototype.hasOwnProperty.call(graphic,"default")?graphic["default"]:graphic,pciResponse=pciResponse&&Object.prototype.hasOwnProperty.call(pciResponse,"default")?pciResponse["default"]:pciResponse,containerHelper=containerHelper&&Object.prototype.hasOwnProperty.call(containerHelper,"default")?containerHelper["default"]:containerHelper,instructionMgr=instructionMgr&&Object.prototype.hasOwnProperty.call(instructionMgr,"default")?instructionMgr["default"]:instructionMgr;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){function program1(depth0){var buffer="",stack1;return buffer+="id=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.id),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"",buffer}function program3(depth0){var buffer="",stack1;return buffer+=" "+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["class"]),"function"===_typeof(stack1)?stack1.apply(depth0):stack1)),buffer}function program5(depth0){var buffer="",stack1;return buffer+=" lang=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"",buffer}function program7(depth0,data){var stack1,helper;return(helper=helpers.prompt)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.prompt,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),stack1||0===stack1?stack1:""}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,self=this,stack1,helper;return buffer+="<div ",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.id),{hash:{},inverse:self.noop,fn:self.program(1,program1,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+=" class=\"qti-interaction qti-blockInteraction qti-graphicInteraction qti-graphicOrderInteraction clearfix",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["class"]),{hash:{},inverse:self.noop,fn:self.program(3,program3,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\" data-serial=\"",(helper=helpers.serial)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.serial,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\"",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),{hash:{},inverse:self.noop,fn:self.program(5,program5,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+=">\n ",stack1=helpers["if"].call(depth0,depth0&&depth0.prompt,{hash:{},inverse:self.noop,fn:self.program(7,program7,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n <div class=\"instruction-container\"></div>\n <div class=\"image-editor solid\">\n <div id='graphic-paper-",(helper=helpers.serial)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.serial,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"' class=\"main-image-box\"></div>\n <div class=\"clearfix\"></div>\n <ul class=\"none block-listing horizontal ordinals\"></ul>\n </div>\n</div>\n",buffer}),_renderChoice=function(interaction,$orderList,choice){graphic.createElement(interaction.paper,choice.attr("shape"),choice.attr("coords"),{id:choice.serial,title:__("Select this area")}).click(function(e){$$1(e.currentTarget).closest(".qti-item").hasClass("prevent-click-handler")||(this.active?_unselectShape(interaction.paper,this,$orderList):_selectShape(interaction.paper,this,$orderList),containerHelper.triggerResponseChangeEvent(interaction),instructionMgr.validateInstructions(interaction,{choice:choice}))})},_renderOrderList=function(interaction,$orderList){var size=_.size(interaction.getChoices()),min=interaction.attr("minChoices"),max=interaction.attr("maxChoices"),$orderers;0<max&&max<=size?size=max:0<min&&min<=size&&(size=min),_.times(size,function(index){var position=index+1,$orderer=$$1("<li class=\"selectable\" data-number=\""+position+"\">"+position+"</li>");0===index&&$orderer.addClass("active"),$orderList.append($orderer)}),_createTexts(interaction.paper,size),$orderers=$orderList.children("li"),$orderers.click(function(e){e.preventDefault();var $orderer=$$1(this);$orderer.hasClass("active")||$orderer.hasClass("disabled")||($orderers.removeClass("active"),$orderer.addClass("active"))})},_selectShape=function(paper,element,$orderList){var $active=$orderList.find(".active:first");$active.length&&0<$active.data("number")&&(element.data("number",$active.data("number")),element.active=!0,_showText(paper,element),graphic.updateElementState(element,"active"),$active.toggleClass("active disabled").siblings(":not(.disabled)").first().toggleClass("active"))},_unselectShape=function(paper,element,$orderList){var number=element.data("number");element.active=!1,_hideText(paper,element),element.removeData("number"),graphic.updateElementState(element,"basic"),$orderList.children().removeClass("active").filter("[data-number="+number+"]").removeClass("disabled").addClass("active")},_createTexts=function(paper,size){var texts=[];return _.times(size,function(index){var number=index+1,text=graphic.createText(paper,{id:"text-"+number,content:number,title:__("Remove"),style:"order-text",hide:!0});text.click(function(){paper.forEach(function(element){if(element.data("number")===number&&element.events){var evt=_.where(element.events,{name:"click"});evt.length&&evt[0]&&"function"==typeof evt[0].f&&evt[0].f.call(element)}})}),texts.push(text)}),texts},_showText=function(paper,element){var bbox=element.getBBox(),text=paper.getById("text-"+element.data("number")),transf;text&&(transf="T"+(bbox.x+bbox.width/2)+","+(bbox.y+bbox.height/2),text.transform(transf).show().toFront())},_hideText=function(paper,element){var text=paper.getById("text-"+element.data("number"));text&&text.hide()},_getRawResponse=function(interaction){var response=[];return _.forEach(interaction.getChoices(),function(choice){var elt=interaction.paper.getById(choice.serial);elt&&elt.data("number")&&response.push({index:elt.data("number"),id:choice.id()})}),_(response).sortBy("index").map("id").value()},setResponse=function(interaction,response){var $container=containerHelper.get(interaction),$orderList=$$1("ul",$container),responseValues;if(response&&interaction.paper){try{responseValues=pciResponse.unserialize(response,interaction)}catch(e){}_.isArray(responseValues)&&_.forEach(responseValues,function(responseValue,index){var choice=_(interaction.getChoices()).where({attributes:{identifier:responseValue}}).first(),element;choice&&(element=interaction.paper.getById(choice.serial),element&&($orderList.children("[data-number="+(index+1)+"]").addClass("active"),_selectShape(interaction.paper,element,$orderList)))})}},resetResponse=function(interaction){var $container=containerHelper.get(interaction),$orderList=$$1("ul",$container);_.forEach(interaction.getChoices(),function(choice){var element=interaction.paper.getById(choice.serial);element&&_unselectShape(interaction.paper,element,$orderList)}),$orderList.children("li").removeClass("active disabled").first().addClass("active")},getResponse=function(interaction){return pciResponse.serialize(_getRawResponse(interaction),interaction)},destroy=function(interaction){var $container;interaction.paper&&($container=containerHelper.get(interaction),$$1(window).off("resize.qti-widget."+interaction.serial),$container.off("resize.qti-widget."+interaction.serial),interaction.paper.clear(),instructionMgr.removeInstructions(interaction),$$1(".main-image-box",$container).empty().removeAttr("style"),$$1(".image-editor",$container).removeAttr("style"),$$1("ul",$container).empty()),containerHelper.reset(interaction)},setState=function(interaction,state){_.isObject(state)&&state.response&&(interaction.resetResponse(),interaction.setResponse(state.response))},GraphicOrderInteraction={qtiClass:"graphicOrderInteraction",template:function(data,options,asString){var html=Template(data,options);return asString||!0?html:$(html)},render:function(interaction){var self=this;return new Promise(function(resolve){var $container=containerHelper.get(interaction),$orderList=$$1("ul",$container),background=interaction.object.attributes;$container.off("resized.qti-widget.resolve").one("resized.qti-widget.resolve",resolve),interaction.paper=graphic.responsivePaper("graphic-paper-"+interaction.serial,interaction.serial,{width:background.width,height:background.height,img:self.resolveUrl(background.data),imgId:"bg-image-"+interaction.serial,container:$container}),_renderOrderList(interaction,$orderList),_.forEach(interaction.getChoices(),_.partial(_renderChoice,interaction,$orderList)),instructionMgr.minMaxChoiceInstructions(interaction,{min:interaction.attr("minChoices"),max:interaction.attr("maxChoices"),getResponse:_getRawResponse,onError:function onError(data){graphic.highlightError(data.target)}})})},getContainer:containerHelper.get,setResponse:setResponse,getResponse:getResponse,resetResponse:resetResponse,destroy:destroy,setState:setState,getState:function(interaction){var state={},response=interaction.getResponse();return response&&(state.response=response),state}};return GraphicOrderInteraction}),define("taoQtiItem/qtiCommonRenderer/renderers/interactions/HotspotInteraction",["jquery","lodash","i18n","handlebars","lib/dompurify/purify","taoQtiItem/qtiCommonRenderer/helpers/Graphic","taoQtiItem/qtiCommonRenderer/helpers/PciResponse","taoQtiItem/qtiCommonRenderer/helpers/container","taoQtiItem/qtiCommonRenderer/helpers/instructions/instructionManager"],function($$1,_,__,Handlebars,DOMPurify,graphic,pciResponse,containerHelper,instructionMgr){'use strict';$$1=$$1&&Object.prototype.hasOwnProperty.call($$1,"default")?$$1["default"]:$$1,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,__=__&&Object.prototype.hasOwnProperty.call(__,"default")?__["default"]:__,Handlebars=Handlebars&&Object.prototype.hasOwnProperty.call(Handlebars,"default")?Handlebars["default"]:Handlebars,DOMPurify=DOMPurify&&Object.prototype.hasOwnProperty.call(DOMPurify,"default")?DOMPurify["default"]:DOMPurify,graphic=graphic&&Object.prototype.hasOwnProperty.call(graphic,"default")?graphic["default"]:graphic,pciResponse=pciResponse&&Object.prototype.hasOwnProperty.call(pciResponse,"default")?pciResponse["default"]:pciResponse,containerHelper=containerHelper&&Object.prototype.hasOwnProperty.call(containerHelper,"default")?containerHelper["default"]:containerHelper,instructionMgr=instructionMgr&&Object.prototype.hasOwnProperty.call(instructionMgr,"default")?instructionMgr["default"]:instructionMgr;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){function program1(depth0){var buffer="",stack1;return buffer+="id=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.id),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"",buffer}function program3(depth0){var buffer="",stack1;return buffer+=" "+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["class"]),"function"===_typeof(stack1)?stack1.apply(depth0):stack1)),buffer}function program5(depth0){var buffer="",stack1;return buffer+=" lang=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"",buffer}function program7(depth0,data){var stack1,helper;return(helper=helpers.prompt)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.prompt,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),stack1||0===stack1?stack1:""}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,self=this,stack1,helper;return buffer+="<div ",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.id),{hash:{},inverse:self.noop,fn:self.program(1,program1,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+=" class=\"qti-interaction qti-blockInteraction qti-graphicInteraction qti-hotspotInteraction clearfix",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["class"]),{hash:{},inverse:self.noop,fn:self.program(3,program3,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\" data-serial=\"",(helper=helpers.serial)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.serial,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\"",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),{hash:{},inverse:self.noop,fn:self.program(5,program5,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+=">\n ",stack1=helpers["if"].call(depth0,depth0&&depth0.prompt,{hash:{},inverse:self.noop,fn:self.program(7,program7,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n <div class=\"instruction-container\"></div>\n <div class=\"image-editor solid\">\n <div id='graphic-paper-",(helper=helpers.serial)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.serial,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"' class=\"main-image-box\"></div>\n </div>\n</div>\n",buffer}),_renderChoice=function(interaction,choice){var $container=containerHelper.get(interaction),rElement=graphic.createElement(interaction.paper,choice.attr("shape"),choice.attr("coords"),{id:choice.serial,title:__("Select this area")}).click(function(){this.active?(graphic.updateElementState(this,"basic",__("Select this area")),this.active=!1,$container.trigger("inactiveChoice.qti-widget",[choice,this])):(graphic.updateElementState(this,"active",__("Click again to remove")),this.active=!0,$container.trigger("activeChoice.qti-widget",[choice,this])),containerHelper.triggerResponseChangeEvent(interaction),instructionMgr.validateInstructions(interaction,{choice:choice,target:this})})},_getRawResponse=function(interaction){return _(interaction.getChoices()).map(function(choice){var rElement=interaction.paper.getById(choice.serial);return!!(rElement&&!0===rElement.active)&&choice.id()}).filter(_.isString).value()},setResponse=function(interaction,response){var responseValues;if(response&&interaction.paper){try{responseValues=pciResponse.unserialize(response,interaction)}catch(e){}_.isArray(responseValues)&&_.forEach(interaction.getChoices(),function(choice){var rElement;_.contains(responseValues,choice.attributes.identifier)&&(rElement=interaction.paper.getById(choice.serial),rElement&&(rElement.active=!0,graphic.updateElementState(rElement,"active",__("Click again to remove")),instructionMgr.validateInstructions(interaction,{choice:choice,target:rElement})))})}},resetResponse=function(interaction){_.forEach(interaction.getChoices(),function(choice){var element=interaction.paper.getById(choice.serial);element&&(element.active=!1,graphic.updateElementState(element,"basic"))}),instructionMgr.resetInstructions(interaction)},getResponse=function(interaction){var raw=_getRawResponse(interaction),response=pciResponse.serialize(_getRawResponse(interaction),interaction);return response},destroy=function(interaction){var $container;interaction.paper&&($container=containerHelper.get(interaction),$$1(window).off("resize.qti-widget."+interaction.serial),$container.off("resize.qti-widget."+interaction.serial),interaction.paper.clear(),instructionMgr.removeInstructions(interaction),$$1(".main-image-box",$container).empty().removeAttr("style"),$$1(".image-editor",$container).removeAttr("style")),containerHelper.reset(interaction)},setState=function(interaction,state){_.isObject(state)&&state.response&&(interaction.resetResponse(),interaction.setResponse(state.response))},HotspotInteraction={qtiClass:"hotspotInteraction",template:function(data,options,asString){var html=Template(data,options);return asString||!0?html:$(html)},render:function(interaction){var self=this;return new Promise(function(resolve){var $container=containerHelper.get(interaction),background=interaction.object.attributes;$container.off("resized.qti-widget.resolve").one("resized.qti-widget.resolve",resolve),interaction.paper=graphic.responsivePaper("graphic-paper-"+interaction.serial,interaction.serial,{width:background.width,height:background.height,img:self.resolveUrl(background.data),container:$container}),_.forEach(interaction.getChoices(),_.partial(_renderChoice,interaction)),instructionMgr.minMaxChoiceInstructions(interaction,{min:interaction.attr("minChoices"),max:interaction.attr("maxChoices"),getResponse:_getRawResponse,onError:function onError(data){data.target.active&&(data.target.active=!1,graphic.updateElementState(this,"basic",__("Select this area")),graphic.highlightError(data.target),containerHelper.triggerResponseChangeEvent(interaction),$container.trigger("inactiveChoice.qti-widget",[data.choice,data.target]))}})})},getContainer:containerHelper.get,setResponse:setResponse,getResponse:getResponse,resetResponse:resetResponse,destroy:destroy,setState:setState,getState:function(interaction){var state={},response=interaction.getResponse();return response&&(state.response=response),state}};return HotspotInteraction}),define("taoQtiItem/qtiCommonRenderer/renderers/interactions/HottextInteraction",["jquery","lodash","handlebars","i18n","lib/dompurify/purify","taoQtiItem/qtiCommonRenderer/helpers/container","taoQtiItem/qtiCommonRenderer/helpers/instructions/instructionManager","taoQtiItem/qtiCommonRenderer/helpers/PciResponse"],function($$1,_,Handlebars,__,DOMPurify,containerHelper,instructionMgr,pciResponse){'use strict';$$1=$$1&&Object.prototype.hasOwnProperty.call($$1,"default")?$$1["default"]:$$1,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,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,containerHelper=containerHelper&&Object.prototype.hasOwnProperty.call(containerHelper,"default")?containerHelper["default"]:containerHelper,instructionMgr=instructionMgr&&Object.prototype.hasOwnProperty.call(instructionMgr,"default")?instructionMgr["default"]:instructionMgr,pciResponse=pciResponse&&Object.prototype.hasOwnProperty.call(pciResponse,"default")?pciResponse["default"]:pciResponse;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){function program1(depth0){var buffer="",stack1;return buffer+="id=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.id),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"",buffer}function program3(depth0){var buffer="",stack1;return buffer+=" "+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["class"]),"function"===_typeof(stack1)?stack1.apply(depth0):stack1)),buffer}function program5(depth0){var buffer="",stack1;return buffer+=" lang=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"",buffer}function program7(depth0,data){var stack1,helper;return(helper=helpers.prompt)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.prompt,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),stack1||0===stack1?stack1:""}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,self=this,stack1,helper;return buffer+="<div ",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.id),{hash:{},inverse:self.noop,fn:self.program(1,program1,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+=" class=\"qti-interaction qti-blockInteraction qti-hottextInteraction",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["class"]),{hash:{},inverse:self.noop,fn:self.program(3,program3,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\" data-serial=\"",(helper=helpers.serial)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.serial,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\" data-qti-class=\"hottextInteraction\"",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),{hash:{},inverse:self.noop,fn:self.program(5,program5,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+=">\n ",stack1=helpers["if"].call(depth0,depth0&&depth0.prompt,{hash:{},inverse:self.noop,fn:self.program(7,program7,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n <div class=\"instruction-container\"></div>\n <div class=\"qti-flow-container\">",(helper=helpers.body)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.body,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),(stack1||0===stack1)&&(buffer+=stack1),buffer+="</div>\n</div>\n",buffer}),pseudoLabel=function(interaction){var $container=containerHelper.get(interaction),setChoice=function($choice,interaction){var $inupt=$choice.find("input");if($inupt.prop("checked")||$inupt.hasClass("disabled"))$inupt.prop("checked",!1);else{var maxChoices=parseInt(interaction.attr("maxChoices")),currentChoices=_.values(_getRawResponse(interaction)).length;(currentChoices<maxChoices||0===maxChoices)&&$inupt.prop("checked",!0)}containerHelper.triggerResponseChangeEvent(interaction),instructionMgr.validateInstructions(interaction,{choice:$choice})};$$1(".hottext",$container).on("click",function(e){e.preventDefault(),setChoice($$1(this),interaction)})},render=function(interaction){pseudoLabel(interaction),instructionMgr.minMaxChoiceInstructions(interaction,{min:interaction.attr("minChoices"),max:interaction.attr("maxChoices"),getResponse:_getRawResponse,onError:function onError(data){var $input,$choice,$icon;data.choice&&data.choice.length&&($choice=data.choice.addClass("error"),$input=$choice.find("input"),$icon=$choice.find(" > label > span").addClass("error cross"),setTimeout(function(){$input.prop("checked",!1),$choice.removeClass("error"),$icon.removeClass("error cross")},350))}})},resetResponse=function(interaction){var $container=containerHelper.get(interaction);$$1("input",$container).prop("checked",!1)},setResponse=function(interaction,response){var $container=containerHelper.get(interaction);try{_.each(pciResponse.unserialize(response,interaction),function(identifier){$container.find("input[value=\""+identifier+"\"]").prop("checked",!0)}),instructionMgr.validateInstructions(interaction)}catch(e){throw new Error("wrong response format in argument : "+e)}},_getRawResponse=function(interaction){var values=[],$container=containerHelper.get(interaction);return $$1("input:checked",$container).each(function(){values.push($$1(this).val())}),values},getResponse=function(interaction){return pciResponse.serialize(_getRawResponse(interaction),interaction)},destroy=function(interaction){var $container=containerHelper.get(interaction);$container.find(".hottext").off("click"),containerHelper.reset(interaction)},setState=function(interaction,state){_.isObject(state)&&state.response&&(interaction.resetResponse(),interaction.setResponse(state.response))},HottextInteraction={qtiClass:"hottextInteraction",template:function(data,options,asString){var html=Template(data,options);return asString||!0?html:$(html)},render:render,getContainer:containerHelper.get,setResponse:setResponse,getResponse:getResponse,resetResponse:resetResponse,destroy:destroy,setState:setState,getState:function(interaction){var state={},response=interaction.getResponse();return response&&(state.response=response),state}};return HottextInteraction}),define("taoQtiItem/qtiCommonRenderer/renderers/interactions/InlineChoiceInteraction",["jquery","lodash","i18n","handlebars","lib/dompurify/purify","taoQtiItem/qtiCommonRenderer/helpers/container","taoQtiItem/qtiCommonRenderer/helpers/instructions/instructionManager","taoQtiItem/qtiCommonRenderer/helpers/PciResponse","ui/tooltip","select2"],function($$1,_,__,Handlebars,DOMPurify,containerHelper,instructionMgr,pciResponse,tooltip){'use strict';$$1=$$1&&Object.prototype.hasOwnProperty.call($$1,"default")?$$1["default"]:$$1,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,__=__&&Object.prototype.hasOwnProperty.call(__,"default")?__["default"]:__,Handlebars=Handlebars&&Object.prototype.hasOwnProperty.call(Handlebars,"default")?Handlebars["default"]:Handlebars,DOMPurify=DOMPurify&&Object.prototype.hasOwnProperty.call(DOMPurify,"default")?DOMPurify["default"]:DOMPurify,containerHelper=containerHelper&&Object.prototype.hasOwnProperty.call(containerHelper,"default")?containerHelper["default"]:containerHelper,instructionMgr=instructionMgr&&Object.prototype.hasOwnProperty.call(instructionMgr,"default")?instructionMgr["default"]:instructionMgr,pciResponse=pciResponse&&Object.prototype.hasOwnProperty.call(pciResponse,"default")?pciResponse["default"]:pciResponse,tooltip=tooltip&&Object.prototype.hasOwnProperty.call(tooltip,"default")?tooltip["default"]:tooltip;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){function program1(depth0){var buffer="",stack1;return buffer+="id=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.id),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"",buffer}function program3(depth0){var buffer="",stack1;return buffer+=" "+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["class"]),"function"===_typeof(stack1)?stack1.apply(depth0):stack1)),buffer}function program5(depth0){var buffer="",stack1;return buffer+=" lang=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"",buffer}function program7(depth0){var stack1;return stack1="function"===_typeof(depth0)?depth0.apply(depth0):depth0,stack1||0===stack1?stack1:""}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,self=this,blockHelperMissing=helpers.blockHelperMissing,stack1,helper,options;return buffer+="<select ",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.id),{hash:{},inverse:self.noop,fn:self.program(1,program1,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+=" class=\"qti-interaction qti-inlineInteraction qti-inlineChoiceInteraction",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["class"]),{hash:{},inverse:self.noop,fn:self.program(3,program3,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\"\n data-serial=\"",(helper=helpers.serial)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.serial,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\"\n data-qti-class=\"inlineChoiceInteraction\"\n data-has-search=\"false\"\n ",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),{hash:{},inverse:self.noop,fn:self.program(5,program5,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n>\n <option></option> \n <option value=\"empty\"></option>\n ",options={hash:{},inverse:self.noop,fn:self.program(7,program7,data),data:data},(helper=helpers.choices)?stack1=helper.call(depth0,options):(helper=depth0&&depth0.choices,stack1="function"===_typeof(helper)?helper.call(depth0,options):helper),helpers.choices||(stack1=blockHelperMissing.call(depth0,stack1,{hash:{},inverse:self.noop,fn:self.program(7,program7,data),data:data})),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n</select>\n",buffer}),_emptyValue="empty",_defaultOptions={allowEmpty:!0,placeholderText:__("select a choice")},render=function(interaction,options){var opts=_.clone(_defaultOptions),required=!!interaction.attr("required"),$container=containerHelper.get(interaction),choiceTooltip;_.extend(opts,options),opts.allowEmpty&&!required?$container.find("option[value="+_emptyValue+"]").text("--- "+__("leave empty")+" ---"):$container.find("option[value="+_emptyValue+"]").remove(),$container.select2({width:"element",placeholder:opts.placeholderText,minimumResultsForSearch:-1,dropdownCssClass:"qti-inlineChoiceInteraction-dropdown"});var $el=$container.select2("container");required&&(choiceTooltip=tooltip.warning($el,__("A choice must be selected")),""===$container.val()&&choiceTooltip.show()),$container.on("change",function(e){if($$1(e.currentTarget).closest(".qti-item").hasClass("prevent-click-handler")){var $selectedIndex=$$1(e.currentTarget)[0].options.selectedIndex?$$1(e.currentTarget)[0].options.selectedIndex:null;$container.find("option").one("click",function(e){e.stopPropagation()}),$container.find("option").eq($selectedIndex).trigger("click")}required&&""!==$container.val()&&choiceTooltip.hide(),containerHelper.triggerResponseChangeEvent(interaction)}).on("select2-open",function(){required&&choiceTooltip.hide()}).on("select2-close",function(){required&&""===$container.val()&&choiceTooltip.show()})},_setVal=function(interaction,choiceIdentifier){containerHelper.get(interaction).val(choiceIdentifier).select2("val",choiceIdentifier)},setResponse=function(interaction,response){_setVal(interaction,pciResponse.unserialize(response,interaction)[0])},_getRawResponse=function(interaction){var value=containerHelper.get(interaction).val();return value&&value!==_emptyValue?[value]:[]},getResponse=function(interaction){return pciResponse.serialize(_getRawResponse(interaction),interaction)},destroy=function(interaction){var $container=containerHelper.get(interaction);$$1(document).off(".commonRenderer"),$container.select2("destroy"),instructionMgr.removeInstructions(interaction),containerHelper.reset(interaction)},setState=function(interaction,state){var $container;_.isObject(state)&&(state.response&&(interaction.resetResponse(),interaction.setResponse(state.response)),_.isArray(state.order)&&state.order.length===_.size(interaction.getChoices())&&($container=containerHelper.get(interaction),$container.select2("disable").select2("close"),$$1("option[data-identifier]",$container).sort(function(a,b){var aIndex=_.indexOf(state.order,$$1(a).data("identifier")),bIndex=_.indexOf(state.order,$$1(b).data("identifier"));return aIndex>bIndex?1:aIndex<bIndex?-1:0}).detach().appendTo($container),$container.select2("enable")))},getState=function(interaction){var state={},response=interaction.getResponse(),$container;return response&&(state.response=response),!0===interaction.attr("shuffle")&&($container=containerHelper.get(interaction),state.order=[],$$1("option[data-identifier]",$container).each(function(){state.order.push($$1(this).data("identifier"))})),state},InlineChoiceInteraction={qtiClass:"inlineChoiceInteraction",template:function(data,options,asString){var html=Template(data,options);return asString||!0?html:$(html)},render:render,getContainer:containerHelper.get,setResponse:setResponse,getResponse:getResponse,resetResponse:function resetResponse(interaction){_setVal(interaction,_emptyValue)},destroy:destroy,setState:setState,getState:getState};return InlineChoiceInteraction}),define("taoQtiItem/qtiCommonRenderer/renderers/interactions/MatchInteraction",["jquery","lodash","i18n","handlebars","lib/dompurify/purify","taoQtiItem/qtiCommonRenderer/helpers/container","taoQtiItem/qtiCommonRenderer/helpers/instructions/instructionManager","taoQtiItem/qtiCommonRenderer/helpers/PciResponse"],function($$1,_,__,Handlebars,DOMPurify,containerHelper,instructionMgr,pciResponse){'use strict';$$1=$$1&&Object.prototype.hasOwnProperty.call($$1,"default")?$$1["default"]:$$1,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,__=__&&Object.prototype.hasOwnProperty.call(__,"default")?__["default"]:__,Handlebars=Handlebars&&Object.prototype.hasOwnProperty.call(Handlebars,"default")?Handlebars["default"]:Handlebars,DOMPurify=DOMPurify&&Object.prototype.hasOwnProperty.call(DOMPurify,"default")?DOMPurify["default"]:DOMPurify,containerHelper=containerHelper&&Object.prototype.hasOwnProperty.call(containerHelper,"default")?containerHelper["default"]:containerHelper,instructionMgr=instructionMgr&&Object.prototype.hasOwnProperty.call(instructionMgr,"default")?instructionMgr["default"]:instructionMgr,pciResponse=pciResponse&&Object.prototype.hasOwnProperty.call(pciResponse,"default")?pciResponse["default"]:pciResponse;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){function program1(depth0){var buffer="",stack1;return buffer+="id=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.id),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"",buffer}function program3(depth0){var buffer="",stack1;return buffer+=" "+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["class"]),"function"===_typeof(stack1)?stack1.apply(depth0):stack1)),buffer}function program5(depth0){var buffer="",stack1;return buffer+=" lang=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"",buffer}function program7(depth0,data){var stack1,helper;return(helper=helpers.prompt)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.prompt,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),stack1||0===stack1?stack1:""}function program9(depth0){var stack1;return stack1="function"===_typeof(depth0)?depth0.apply(depth0):depth0,stack1||0===stack1?stack1:""}function program11(depth0,data,depth1){var buffer="",stack1;return buffer+="\n <tr>\n ",stack1="function"===_typeof(depth0)?depth0.apply(depth0):depth0,(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n ",stack1=helpers.each.call(depth0,depth1&&depth1.matchSet1,{hash:{},inverse:self.noop,fn:self.program(12,program12,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n </tr>\n ",buffer}function program12(){return"\n <td>\n <label>\n <input type=\"checkbox\" >\n <span class=\"icon-checkbox cross\"></span>\n </label>\n </td>\n "}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,self=this,blockHelperMissing=helpers.blockHelperMissing,stack1,helper,options;return buffer+="<div ",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.id),{hash:{},inverse:self.noop,fn:self.program(1,program1,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+=" class=\"qti-interaction qti-blockInteraction qti-matchInteraction",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["class"]),{hash:{},inverse:self.noop,fn:self.program(3,program3,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\" data-serial=\"",(helper=helpers.serial)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.serial,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\" data-qti-class=\"matchInteraction\"",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),{hash:{},inverse:self.noop,fn:self.program(5,program5,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+=">\n ",stack1=helpers["if"].call(depth0,depth0&&depth0.prompt,{hash:{},inverse:self.noop,fn:self.program(7,program7,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n <div class=\"instruction-container\"></div>\n <div class=\"match-interaction-area\">\n <table class=\"matrix\">\n <thead>\n <tr>\n <th> </th>\n ",options={hash:{},inverse:self.noop,fn:self.program(9,program9,data),data:data},(helper=helpers.matchSet1)?stack1=helper.call(depth0,options):(helper=depth0&&depth0.matchSet1,stack1="function"===_typeof(helper)?helper.call(depth0,options):helper),helpers.matchSet1||(stack1=blockHelperMissing.call(depth0,stack1,{hash:{},inverse:self.noop,fn:self.program(9,program9,data),data:data})),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n </tr>\n </thead>\n <tbody>\n ",options={hash:{},inverse:self.noop,fn:self.programWithDepth(11,program11,data,depth0),data:data},(helper=helpers.matchSet2)?stack1=helper.call(depth0,options):(helper=depth0&&depth0.matchSet2,stack1="function"===_typeof(helper)?helper.call(depth0,options):helper),helpers.matchSet2||(stack1=blockHelperMissing.call(depth0,stack1,{hash:{},inverse:self.noop,fn:self.programWithDepth(11,program11,data,depth0),data:data})),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n </tbody>\n </table>\n </div>\n <div class=\"notification-container\"></div>\n</div>\n",buffer}),inWarning=!1,render=function(interaction){var $container=containerHelper.get(interaction);_setInstructions(interaction),$container.on("click.commonRenderer","input[type=checkbox]",function(e){_onCheckboxSelected(interaction,e)}),instructionMgr.validateInstructions(interaction)},setResponse=function(interaction,response){var $container=containerHelper.get(interaction);response=_filterResponse(response),"undefined"!=typeof response.list&&"undefined"!=typeof response.list.directedPair&&_(response.list.directedPair).forEach(function(directedPair){var x=$$1("th[data-identifier=\""+directedPair[0]+"\"]",$container).index()-1,y=$$1("th[data-identifier=\""+directedPair[1]+"\"]",$container).parent().index();$$1(".matrix > tbody tr",$container).eq(y).find("input[type=checkbox]").eq(x).prop("checked",!0)}),instructionMgr.validateInstructions(interaction)},getResponse=function(interaction){var response=pciResponse.serialize(_getRawResponse(interaction),interaction);return response},resetResponse=function(interaction){var $container=containerHelper.get(interaction);$$1("input[type=checkbox]:checked",$container).each(function(){$$1(this).prop("checked",!1)}),instructionMgr.validateInstructions(interaction)},_filterResponse=function(response){if("undefined"==typeof response.list){if("undefined"==typeof response.base)throw"The given response is not compliant with PCI JSON representation.";else{if(null===response.base)return{list:{directedPair:[]}};if("undefined"==typeof response.base.directedPair)throw"The matchInteraction only accepts directedPair values as responses.";else return{list:{directedPair:[response.base.directedPair]}}}}else if("undefined"==typeof response.list.directedPair)throw"The matchInteraction only accept directedPair values as responses.";else return response},_getRawResponse=function(interaction){var $container=containerHelper.get(interaction),values=[];return $container.find("input[type=checkbox]:checked").each(function(){values.push(_inferValue(this))}),values},_inferValue=function(element){var $element=$$1(element),$container=$element.closest(".match-interaction-area"),y=$element.closest("tr").index(),x=$element.closest("td").index(),firstId=$$1(".matrix > thead th",$container).eq(x).data("identifier"),secondId=$$1(".matrix > tbody th",$container).eq(y).data("identifier");return[firstId,secondId]},_onCheckboxSelected=function(interaction,e){var currentResponse=_getRawResponse(interaction),minAssociations=interaction.attr("minAssociations"),maxAssociations=interaction.attr("maxAssociations"),choice;0===maxAssociations&&(maxAssociations=_countChoices(interaction)),_.size(currentResponse)>maxAssociations?(e.preventDefault(),instructionMgr.validateInstructions(interaction)):!1===(choice=_maxMatchReached(interaction,e.target))?(containerHelper.triggerResponseChangeEvent(interaction,{}),instructionMgr.validateInstructions(interaction)):(e.preventDefault(),instructionMgr.validateInstructions(interaction,choice))},_maxMatchReached=function(interaction,input){var association=_inferValue(input),overflow=!1;return _(association).forEach(function(identifier){var choice=_getChoiceDefinitionByIdentifier(interaction,identifier),matchMin=choice.attributes.matchMin,matchMax=choice.attributes.matchMax,assoc=_countAssociations(interaction,choice);0<matchMax&&assoc>matchMax&&(overflow=choice)}),overflow},_countAssociations=function(interaction,choice){var rawResponse=_getRawResponse(interaction),count=0;return _(rawResponse).forEach(function(response){(response[0]===choice.attributes.identifier||response[1]===choice.attributes.identifier)&&count++}),count},_countChoices=function(interaction){var $container=containerHelper.get(interaction);return $container.find("input[type=checkbox]").length},_getChoiceDefinitionByIdentifier=function(interaction,identifier){var rawChoices=_getRawChoices(interaction);return rawChoices[identifier]},_getRawChoices=function(interaction){var rawChoices={};return _(interaction.choices).forEach(function(matchset){_(matchset).forEach(function(choice){rawChoices[choice.attributes.identifier]=choice})}),rawChoices},_setInstructions=function(interaction){var minAssociations=interaction.attr("minAssociations"),maxAssociations=interaction.attr("maxAssociations"),choiceCount=_countChoices(interaction),superClosure=function(){var onMaxChoicesReached=function(report,msg){!1===inWarning&&(inWarning=!0,report.update({level:"warning",message:__("Maximum number of choices reached."),timeout:2e3,stop:function stop(){report.update({level:"success",message:msg}),inWarning=!1}}))},onMatchMaxReached=function(interaction,choice,report,msg,level){var $container=containerHelper.get(interaction);if(!1===inWarning){inWarning=!0;var $choice=$container.find(".qti-simpleAssociableChoice[data-identifier=\""+choice.attributes.identifier+"\"]"),originalBackgroundColor=$choice.css("background-color"),originalColor=$choice.css("color");report.update({level:"warning",message:__("The highlighted choice cannot be associated more than %d time(s).").replace("%d",choice.attributes.matchMax),timeout:3e3,start:function start(){$choice.animate({backgroundColor:"#fff",color:"#ba122b"},250,function(){$choice.animate({backgroundColor:"#ba122b",color:"#fff"},250)})},stop:function stop(){$choice.animate({backgroundColor:originalBackgroundColor,color:originalColor},500),report.update({level:level,message:msg}),inWarning=!1}})}};0===minAssociations&&0<maxAssociations?(msg=__("You must select 0 to %d choices.").replace("%d",maxAssociations),instructionMgr.appendInstruction(interaction,msg,function(choice){var responseCount=_.size(_getRawResponse(interaction));choice&&choice.attributes&&0<choice.attributes.matchMax&&_countAssociations(interaction,choice)>choice.attributes.matchMax?onMatchMaxReached(interaction,choice,this,msg,this.getLevel()):responseCount<=maxAssociations?this.setLevel("success"):responseCount>maxAssociations?onMaxChoicesReached(this,msg):this.reset()})):0===minAssociations&&0===maxAssociations?(msg=__("You must select 0 to %d choices.").replace("%d",choiceCount),instructionMgr.appendInstruction(interaction,msg,function(choice){choice&&choice.attributes&&0<choice.attributes.matchMax&&_countAssociations(interaction,choice)>choice.attributes.matchMax?onMatchMaxReached(interaction,choice,this,msg,this.getLevel()):this.setLevel("success")})):0<minAssociations&&0===maxAssociations?(msg=__("You must select %1$d to %2$d choices."),msg=msg.replace("%1$d",minAssociations),msg=msg.replace("%2$d",choiceCount),instructionMgr.appendInstruction(interaction,msg,function(choice){var responseCount=_.size(_getRawResponse(interaction));choice&&choice.attributes&&0<choice.attributes.matchMax&&_countAssociations(interaction,choice)>choice.attributes.matchMax?onMatchMaxReached(interaction,choice,this,msg,this.getLevel()):responseCount<minAssociations?this.setLevel("info"):responseCount>choiceCount?onMaxChoicesReached(this,msg):this.setLevel("success")})):0<minAssociations&&0<maxAssociations&&(minAssociations===maxAssociations?(msg=__("You must select exactly %d choice(s)."),msg=msg.replace("%d",minAssociations)):(msg=__("You must select %1$d to %2$d choices."),msg=msg.replace("%1$d",minAssociations),msg=msg.replace("%2$d",maxAssociations)),instructionMgr.appendInstruction(interaction,msg,function(choice){var responseCount=_.size(_getRawResponse(interaction));choice&&choice.attributes&&0<choice.attributes.matchMax&&_countAssociations(interaction,choice)>choice.attributes.matchMax?onMatchMaxReached(interaction,choice,this,msg,this.getLevel()):responseCount<minAssociations?this.setLevel("info"):responseCount>maxAssociations?onMaxChoicesReached(this,msg):responseCount>=minAssociations&&responseCount<=maxAssociations&&this.setLevel("success")}))},msg;superClosure()},destroy=function(interaction){var $container=containerHelper.get(interaction);$container.off(".commonRenderer"),instructionMgr.removeInstructions(interaction),containerHelper.reset(interaction)},setState=function(interaction,state){var $container;_.isObject(state)&&(_.isArray(state.order)&&2===state.order.length&&($container=containerHelper.get(interaction),$$1("thead .qti-choice",$container).sort(function(a,b){var aIndex=_.indexOf(state.order[0],$$1(a).data("identifier")),bIndex=_.indexOf(state.order[0],$$1(b).data("identifier"));return aIndex>bIndex?1:aIndex<bIndex?-1:0}).detach().appendTo($$1("thead tr",$container)),$$1("tbody .qti-choice",$container).sort(function(a,b){var aIndex=_.indexOf(state.order[1],$$1(a).data("identifier")),bIndex=_.indexOf(state.order[1],$$1(b).data("identifier"));return aIndex>bIndex?1:aIndex<bIndex?-1:0}).detach().each(function(index,elt){$$1(elt).prependTo($$1("tbody tr",$container).eq(index))})),state.response&&(interaction.resetResponse(),interaction.setResponse(state.response)))},getState=function(interaction){var state={},response=interaction.getResponse(),$container;return response&&(state.response=response),!0===interaction.attr("shuffle")&&($container=containerHelper.get(interaction),state.order=[[],[]],$$1("thead .qti-choice",$container).each(function(){state.order[0].push($$1(this).data("identifier"))}),$$1("tbody .qti-choice",$container).each(function(){state.order[1].push($$1(this).data("identifier"))})),state},MatchInteraction={qtiClass:"matchInteraction",template:function(data,options,asString){var html=Template(data,options);return asString||!0?html:$(html)},render:render,getContainer:containerHelper.get,setResponse:setResponse,getResponse:getResponse,resetResponse:resetResponse,destroy:destroy,setState:setState,getState:getState,inferValue:_inferValue};return MatchInteraction}),define("taoQtiItem/qtiCommonRenderer/renderers/interactions/MediaInteraction",["jquery","lodash","handlebars","i18n","lib/dompurify/purify","taoQtiItem/qtiCommonRenderer/helpers/PciResponse","taoQtiItem/qtiCommonRenderer/helpers/container","ui/mediaplayer"],function($$1,_,Handlebars,__,DOMPurify,pciResponse,containerHelper,mediaplayer){'use strict';function canPreviewMedia(type,url){var firefox=reFirefoxVersion.exec(navigator.userAgent),webm=reWebM.test(url);return!(webm&&firefox&&87<=parseFloat(firefox[1]))}function destroy(interaction){var $container=getContainer(interaction);interaction.mediaElement&&(interaction.mediaElement.destroy(),interaction.mediaElement=null),$$1(".instruction-container",$container).empty(),$$1(".media-container",$container).empty(),$container.removeData("timesPlayed"),$$1(window).off("resize.video"),containerHelper.reset(interaction)}function _getRawResponse(interaction){return[getContainer(interaction).data("timesPlayed")||0]}function setResponse(interaction,response){if(response)try{var maxPlays=parseInt(interaction.attr("maxPlays"),10)||0,responseValues=pciResponse.unserialize(response,interaction),timesPlayed=parseInt(responseValues[0],10);getContainer(interaction).data("timesPlayed",timesPlayed),interaction.mediaElement&&(0!==maxPlays&&maxPlays<=timesPlayed?interaction.mediaElement.disable():interaction.mediaElement.is("disabled")&&interaction.mediaElement.enable())}catch(e){}}function getResponse(interaction){return pciResponse.serialize(_getRawResponse(interaction),interaction)}function setState(interaction,state){var restorePlayerState=function(playerState){playerState&&interaction.mediaElement&&(_.isNumber(playerState.volume)&&interaction.mediaElement.setVolume(playerState.volume),_.isBoolean(playerState.muted)&&(interaction.mediaElement.mute(playerState.muted),interaction.mediaElement.startMuted=playerState.muted),playerState.position&&0<playerState.position&&(interaction.mediaElement.seek(playerState.position),!interaction.attr("autostart")&&interaction.mediaElement.pause()))};_.isObject(state)&&(state.response&&(interaction.resetResponse(),interaction.setResponse(state.response)),_.isPlainObject(state.player)&&interaction.mediaElement&&(interaction.mediaElement.is("ready")?restorePlayerState(state.player):interaction.mediaElement.on("ready.state",function(){interaction.mediaElement.off("ready.state"),restorePlayerState(state.player)})))}$$1=$$1&&Object.prototype.hasOwnProperty.call($$1,"default")?$$1["default"]:$$1,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,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,pciResponse=pciResponse&&Object.prototype.hasOwnProperty.call(pciResponse,"default")?pciResponse["default"]:pciResponse,containerHelper=containerHelper&&Object.prototype.hasOwnProperty.call(containerHelper,"default")?containerHelper["default"]:containerHelper,mediaplayer=mediaplayer&&Object.prototype.hasOwnProperty.call(mediaplayer,"default")?mediaplayer["default"]:mediaplayer;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){function program1(depth0){var buffer="",stack1;return buffer+="id=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.id),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"",buffer}function program3(depth0){var buffer="",stack1;return buffer+=" "+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["class"]),"function"===_typeof(stack1)?stack1.apply(depth0):stack1)),buffer}function program5(depth0){var buffer="",stack1;return buffer+=" lang=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"",buffer}function program7(depth0,data){var stack1,helper;return(helper=helpers.prompt)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.prompt,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),stack1||0===stack1?stack1:""}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,self=this,stack1,helper;return buffer+="<div ",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.id),{hash:{},inverse:self.noop,fn:self.program(1,program1,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+=" class=\"qti-interaction qti-blockInteraction qti-mediaInteraction",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["class"]),{hash:{},inverse:self.noop,fn:self.program(3,program3,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\" data-serial=\"",(helper=helpers.serial)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.serial,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\"",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),{hash:{},inverse:self.noop,fn:self.program(5,program5,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+=">\n ",stack1=helpers["if"].call(depth0,depth0&&depth0.prompt,{hash:{},inverse:self.noop,fn:self.program(7,program7,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n <div class=\"instruction-container\"></div>\n <div class=\"media-container\"></div>\n</div>\n",buffer}),getContainer=containerHelper.get,defaults={type:"video/mp4"},reWebM=/.*\.webm/i,reFirefoxVersion=/firefox\/([0-9]+\.*[0-9]*)/i;return{qtiClass:"mediaInteraction",template:function(data,options,asString){var html=Template(data,options);return asString||!0?html:$(html)},render:function(interaction){var _this3=this;return new Promise(function(resolve){var $container=getContainer(interaction),media=interaction.object,$item=$container.parents(".qti-item"),maxPlays=parseInt(interaction.attr("maxPlays"),10)||0,canBePlayed=function(){return 0===maxPlays||maxPlays>parseInt($container.data("timesPlayed"),10)},resize=_.debounce(function(){if(interaction.mediaElement){var height=$container.find(".media-container").height(),width=$container.find(".media-container").width();interaction.mediaElement.resize(width,height)}},200),initMediaPlayer=function(){if(!interaction.mediaElement){var type=media.attr("type")||defaults.type,mediaUrl=media.attr("data")||"",url=mediaUrl&&_this3.resolveUrl(mediaUrl),preview=canPreviewMedia(type,url);interaction.mediaElement=mediaplayer({url:url,type:type,preview:preview,canPause:$container.hasClass("pause"),maxPlays:maxPlays,canSeek:!maxPlays,width:media.attr("width"),height:media.attr("height"),volume:100,autoStart:!!interaction.attr("autostart")&&canBePlayed(),loop:!!interaction.attr("loop"),renderTo:$$1(".media-container",$container)}).on("render",function(){media.attr("width")&&!/%/.test(media.attr("width"))&&(resize(),$$1(window).off("resize.mediaInteraction").on("resize.mediaInteraction",resize),$item.off("resize.gridEdit").on("resize.gridEdit",resize)),$container.trigger("playerrendered")}).on("ready",function(){$container.trigger("playerready"),canBePlayed()||this.disable(),resolve()}).on("update",_.throttle(function(){return containerHelper.triggerResponseChangeEvent(interaction)},1e3)).on("ended",function(){$container.data("timesPlayed",$container.data("timesPlayed")+1),containerHelper.triggerResponseChangeEvent(interaction),canBePlayed()||this.disable()})}};$container.data("timesPlayed")||$container.data("timesPlayed",0),$container.on("responseSet",initMediaPlayer),initMediaPlayer()})},getContainer:getContainer,setResponse:setResponse,getResponse:getResponse,resetResponse:function(interaction){getContainer(interaction).data("timesPlayed",0)},destroy:destroy,setState:setState,getState:function(interaction){var state={},response=interaction.getResponse();return response&&(state.response=response),interaction.mediaElement&&(state.player={position:interaction.mediaElement.getPosition(),muted:interaction.mediaElement.is("muted"),volume:interaction.mediaElement.getVolume()}),state}}}),define("taoQtiItem/qtiCommonRenderer/renderers/interactions/OrderInteraction",["lodash","jquery","i18n","core/mouseEvent","handlebars","lib/dompurify/purify","taoQtiItem/qtiCommonRenderer/helpers/container","taoQtiItem/qtiCommonRenderer/helpers/instructions/instructionManager","taoQtiItem/qtiCommonRenderer/helpers/PciResponse","interact","ui/interactUtils"],function(_,$$1,__,mouseEvent,Handlebars,DOMPurify,containerHelper,instructionMgr,pciResponse,interact,interactUtils){'use strict';_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,$$1=$$1&&Object.prototype.hasOwnProperty.call($$1,"default")?$$1["default"]:$$1,__=__&&Object.prototype.hasOwnProperty.call(__,"default")?__["default"]:__,Handlebars=Handlebars&&Object.prototype.hasOwnProperty.call(Handlebars,"default")?Handlebars["default"]:Handlebars,DOMPurify=DOMPurify&&Object.prototype.hasOwnProperty.call(DOMPurify,"default")?DOMPurify["default"]:DOMPurify,containerHelper=containerHelper&&Object.prototype.hasOwnProperty.call(containerHelper,"default")?containerHelper["default"]:containerHelper,instructionMgr=instructionMgr&&Object.prototype.hasOwnProperty.call(instructionMgr,"default")?instructionMgr["default"]:instructionMgr,pciResponse=pciResponse&&Object.prototype.hasOwnProperty.call(pciResponse,"default")?pciResponse["default"]:pciResponse,interact=interact&&Object.prototype.hasOwnProperty.call(interact,"default")?interact["default"]:interact,interactUtils=interactUtils&&Object.prototype.hasOwnProperty.call(interactUtils,"default")?interactUtils["default"]:interactUtils;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){function program1(depth0){var buffer="",stack1;return buffer+="id=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.id),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"",buffer}function program7(depth0){var buffer="",stack1;return buffer+=" "+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["class"]),"function"===_typeof(stack1)?stack1.apply(depth0):stack1)),buffer}function program9(){return"horizontal"}function program13(depth0){var buffer="",stack1;return buffer+=" lang=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"",buffer}function program15(depth0,data){var stack1,helper;return(helper=helpers.prompt)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.prompt,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),stack1||0===stack1?stack1:""}function program17(depth0){var stack1;return stack1="function"===_typeof(depth0)?depth0.apply(depth0):depth0,stack1||0===stack1?stack1:""}function program19(){return"icon-down"}function program21(){return"icon-right"}function program23(){return"icon-up"}function program25(){return"icon-left"}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,self=this,blockHelperMissing=helpers.blockHelperMissing,stack1,helper,options;return buffer+="<div ",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.id),{hash:{},inverse:self.noop,fn:self.program(1,program1,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+=" class=\"qti-interaction qti-blockInteraction qti-orderInteraction",stack1=helpers["if"].call(depth0,depth0&&depth0.horizontal,{hash:{},inverse:self.program(5,function(){return" qti-vertical"},data),fn:self.program(3,function(){return" qti-horizontal"},data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["class"]),{hash:{},inverse:self.noop,fn:self.program(7,program7,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\"\n data-serial=\"",(helper=helpers.serial)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.serial,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\"\n data-qti-class=\"orderInteraction\"\n data-orientation=\"",stack1=helpers["if"].call(depth0,depth0&&depth0.horizontal,{hash:{},inverse:self.program(11,function(){return"vertical"},data),fn:self.program(9,program9,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\"",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),{hash:{},inverse:self.noop,fn:self.program(13,program13,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+=">\n ",stack1=helpers["if"].call(depth0,depth0&&depth0.prompt,{hash:{},inverse:self.noop,fn:self.program(15,program15,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n <div class=\"instruction-container\"></div>\n <div class=\"order-interaction-area\">\n <ul class=\"choice-area square source solid block-listing ",stack1=helpers["if"].call(depth0,depth0&&depth0.horizontal,{hash:{},inverse:self.noop,fn:self.program(9,program9,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\">\n ",options={hash:{},inverse:self.noop,fn:self.program(17,program17,data),data:data},(helper=helpers.choices)?stack1=helper.call(depth0,options):(helper=depth0&&depth0.choices,stack1="function"===_typeof(helper)?helper.call(depth0,options):helper),helpers.choices||(stack1=blockHelperMissing.call(depth0,stack1,{hash:{},inverse:self.noop,fn:self.program(17,program17,data),data:data})),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n </ul>\n <div class=\"arrow-bar middle\">\n <span class=\"icon-add-to-selection ",stack1=helpers["if"].call(depth0,depth0&&depth0.horizontal,{hash:{},inverse:self.program(21,program21,data),fn:self.program(19,program19,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\"></span>\n <span class=\"icon-remove-from-selection ",stack1=helpers["if"].call(depth0,depth0&&depth0.horizontal,{hash:{},inverse:self.program(25,program25,data),fn:self.program(23,program23,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+=" inactive\"></span>\n </div>\n <ul class=\"drag-container block-listing\"></ul>\n <ul class=\"result-area decimal target solid block-listing ",stack1=helpers["if"].call(depth0,depth0&&depth0.horizontal,{hash:{},inverse:self.noop,fn:self.program(9,program9,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\">\n </ul>\n <div class=\"arrow-bar\">\n <span class=\"icon-move-before ",stack1=helpers["if"].call(depth0,depth0&&depth0.horizontal,{hash:{},inverse:self.program(23,program23,data),fn:self.program(25,program25,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+=" inactive\"></span>\n <span class=\"icon-move-after ",stack1=helpers["if"].call(depth0,depth0&&depth0.horizontal,{hash:{},inverse:self.program(19,program19,data),fn:self.program(21,program21,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+=" inactive\"></span>\n </div>\n </div>\n <div class=\"notification-container\"></div>\n</div>\n",buffer}),_freezeSize=function($container){var $orderArea=$container.find(".order-interaction-area");$orderArea.height($orderArea.height())},_setInstructions=function(interaction){var $container=containerHelper.get(interaction),$choiceArea=$$1(".choice-area",$container),$resultArea=$$1(".result-area",$container),min=parseInt(interaction.attr("minChoices"),10),max=parseInt(interaction.attr("maxChoices"),10);if(min&&instructionMgr.appendInstruction(interaction,__("You must use at least %d choices",min),function(){$resultArea.find(">li").length>=min?this.setLevel("success"):this.reset()}),max&&max<_.size(interaction.getChoices())){var instructionMax=instructionMgr.appendInstruction(interaction,__("You can use maximum %d choices",max),function(){$resultArea.find(">li").length>=max?($choiceArea.find(">li").addClass("deactivated"),this.setMessage(__("Maximum choices reached"))):($choiceArea.find(">li").removeClass("deactivated"),this.reset())});interact("".concat($choiceArea.selector," >li.deactivated")).on("tap",function(e){var $target=$$1(e.currentTarget);$target.addClass("brd-error"),instructionMax.setLevel("warning",2e3),setTimeout(function(){$target.removeClass("brd-error")},150)}),interact("".concat($choiceArea.selector," >li.deactivated")).draggable({onstart:function onstart(e){var $target=$$1(e.target);$target.addClass("brd-error"),instructionMax.setLevel("warning")},onend:function onend(e){var $target=$$1(e.target);$target.removeClass("brd-error"),instructionMax.setLevel("info")}}).styleCursor(!1)}},resetResponse=function(interaction){var $container=containerHelper.get(interaction),initialOrder=_.keys(interaction.getChoices()),$choiceArea=$$1(".choice-area",$container).append($$1(".result-area>li",$container)),$choices=$choiceArea.children(".qti-choice");$container.find(".qti-choice.active").each(function(){interactUtils.tapOn(this)}),$choices.detach().sort(function(choice1,choice2){return _.indexOf(initialOrder,$$1(choice1).data("serial"))-_.indexOf(initialOrder,$$1(choice2).data("serial"))}),$choiceArea.prepend($choices)},render=function(interaction){function _iFrameDragFix(draggableSelector,target){interactUtils.iFrameDragFixOn(function(){_isDropzoneVisible()&&interact($resultArea.selector).fire({type:"drop",target:$dropzoneElement.eq(0),relatedTarget:target}),interact(draggableSelector).fire({type:"dragend",target:target})})}function _isDropzoneVisible(){return $$1.contains($container.get(0),$dropzoneElement.get(0))}function _insertDropzone($dragged){var draggedMiddle=_getMiddleOf($dragged),previousMiddle={x:0,y:0},insertPosition;$$1(resultSelector).each(function(index){var currentMiddle=_getMiddleOf($$1(this));if("horizontal"!==orientation){if(draggedMiddle.y>previousMiddle.y&&draggedMiddle.y<currentMiddle.y)return insertPosition=index,!1;previousMiddle.y=currentMiddle.y}else{if(draggedMiddle.x>previousMiddle.x&&draggedMiddle.x<currentMiddle.x)return insertPosition=index,!1;previousMiddle.x=currentMiddle.x}}),"undefined"==typeof insertPosition?$resultArea.append($dropzoneElement):$$1(resultSelector).eq(insertPosition).before($dropzoneElement),$dropzoneElement.height($dragged.height()),$dropzoneElement.find("div").text($dragged.text())}function _adjustDropzonePosition($dragged){var draggedBox=$dragged.get(0).getBoundingClientRect(),$prevResult=$dropzoneElement.prev(".qti-choice"),$nextResult=$dropzoneElement.next(".qti-choice"),prevMiddle=!!(0<$prevResult.length)&&_getMiddleOf($prevResult),nextMiddle=!!(0<$nextResult.length)&&_getMiddleOf($nextResult);"horizontal"===orientation?(prevMiddle&&draggedBox.left<prevMiddle.x&&$prevResult.before($dropzoneElement),nextMiddle&&draggedBox.right>nextMiddle.x&&$nextResult.after($dropzoneElement)):(prevMiddle&&draggedBox.top<prevMiddle.y&&$prevResult.before($dropzoneElement),nextMiddle&&draggedBox.bottom>nextMiddle.y&&$nextResult.after($dropzoneElement))}function _getMiddleOf($element){var elementBox=$element.get(0).getBoundingClientRect();return{x:elementBox.left+elementBox.width/2,y:elementBox.top+elementBox.height/2}}var $container=containerHelper.get(interaction),$choiceArea=$container.find(".choice-area"),$resultArea=$container.find(".result-area"),$iconAdd=$container.find(".icon-add-to-selection"),$iconRemove=$container.find(".icon-remove-from-selection"),$iconBefore=$container.find(".icon-move-before"),$iconAfter=$container.find(".icon-move-after"),choiceSelector="".concat($choiceArea.selector," >li:not(.deactivated)"),resultSelector="".concat($resultArea.selector," >li"),$dragContainer=$container.find(".drag-container"),orientation=interaction.attr("orientation")?interaction.attr("orientation"):"vertical",$activeChoice=null,_activeControls=function(){$iconAdd.addClass("inactive"),$iconRemove.removeClass("inactive").addClass("active"),$iconBefore.removeClass("inactive").addClass("active"),$iconAfter.removeClass("inactive").addClass("active")},_resetControls=function(){$iconAdd.removeClass("inactive"),$iconRemove.removeClass("active").addClass("inactive"),$iconBefore.removeClass("active").addClass("inactive"),$iconAfter.removeClass("active").addClass("inactive")},_setSelection=function($choice){$activeChoice&&$activeChoice.removeClass("active"),$activeChoice=$choice,$activeChoice.addClass("active")},_resetSelection=function(){$activeChoice&&($activeChoice.removeClass("active"),$activeChoice=null),_resetControls()},_addChoiceToSelection=function($target,position){var $results=$$1(resultSelector);_resetSelection(),"undefined"!=typeof position&&position<$results.length?$results.eq(position).before($target):$resultArea.append($target),containerHelper.triggerResponseChangeEvent(interaction),instructionMgr.validateInstructions(interaction)},_toggleResultSelection=function($target){$target.hasClass("active")?_resetSelection():(_setSelection($target),_activeControls())},_removeChoice=function(){$activeChoice&&($choiceArea.append($activeChoice),containerHelper.triggerResponseChangeEvent(interaction),instructionMgr.validateInstructions(interaction)),_resetSelection()},_moveResultBefore=function(){var $prev=$activeChoice.prev();$prev.length&&($prev.before($activeChoice),containerHelper.triggerResponseChangeEvent(interaction))},_moveResultAfter=function(){var $next=$activeChoice.next();$next.length&&($next.after($activeChoice),containerHelper.triggerResponseChangeEvent(interaction))},scaleX,scaleY,isDragAndDropEnabled,dragOptions,$dropzoneElement;interact($container.selector).on("tap",function(){_resetSelection()}),interact(choiceSelector).on("tap",function(e){var $target=$$1(e.currentTarget);$target.closest(".qti-item").hasClass("prevent-click-handler")||(e.stopPropagation(),$iconAdd.addClass("triggered"),setTimeout(function(){$iconAdd.removeClass("triggered")},150),_addChoiceToSelection($target))}),interact(resultSelector).on("tap",function(e){var $target=$$1(e.currentTarget);$target.closest(".qti-item").hasClass("prevent-click-handler")||(e.stopPropagation(),_toggleResultSelection($target))}),interact($iconRemove.selector).on("tap",function(e){$$1(e.currentTarget).closest(".qti-item").hasClass("prevent-click-handler")||(e.stopPropagation(),_removeChoice())}),interact($iconBefore.selector).on("tap",function(e){$$1(e.currentTarget).closest(".qti-item").hasClass("prevent-click-handler")||(e.stopPropagation(),_moveResultBefore())}),interact($iconAfter.selector).on("tap",function(e){$$1(e.currentTarget).closest(".qti-item").hasClass("prevent-click-handler")||(e.stopPropagation(),_moveResultAfter())}),this.getOption&&this.getOption("enableDragAndDrop")&&this.getOption("enableDragAndDrop").order&&(isDragAndDropEnabled=this.getOption("enableDragAndDrop").order),isDragAndDropEnabled&&($dropzoneElement=$$1("<li>",{class:"dropzone qti-choice"}),$$1("<div>",{class:"qti-block"}).appendTo($dropzoneElement),dragOptions={inertia:!1,autoScroll:!0,restrict:{restriction:".qti-interaction",endOnly:!1,elementRect:{top:0,left:0,bottom:1,right:1}}},interact(choiceSelector).draggable(_.assign({},dragOptions,{onstart:function onstart(e){var $target=$$1(e.target),scale;$target.addClass("dragged"),_iFrameDragFix(choiceSelector,e.target),scale=interactUtils.calculateScale(e.target),scaleX=scale[0],scaleY=scale[1]},onmove:function onmove(e){var $target=$$1(e.target);interactUtils.moveElement(e.target,e.dx/scaleX,e.dy/scaleY),_isDropzoneVisible()&&_adjustDropzonePosition($target)},onend:function onend(e){var $target=$$1(e.target);$target.removeClass("dragged"),interactUtils.restoreOriginalPosition($target),interactUtils.iFrameDragFixOff()}})).styleCursor(!1),interact(resultSelector).draggable(_.assign({},dragOptions,{onstart:function onstart(e){var $target=$$1(e.target),scale;$target.addClass("dragged"),_setSelection($target),$dragContainer.show(),$dragContainer.offset($target.offset()),"horizontal"===orientation?$dragContainer.width($$1(e.currentTarget).width()):$dragContainer.width($target.parent().width()),$dragContainer.append($target),_iFrameDragFix(resultSelector,e.target),scale=interactUtils.calculateScale(e.target),scaleX=scale[0],scaleY=scale[1]},onmove:function onmove(e){var $target=$$1(e.target);interactUtils.moveElement(e.target,e.dx/scaleX,e.dy/scaleY),_isDropzoneVisible()&&_adjustDropzonePosition($target)},onend:function onend(e){var $target=$$1(e.target),hasBeenDroppedInResultArea=$target.parent===$resultArea;$target.removeClass("dragged"),$dragContainer.hide(),hasBeenDroppedInResultArea||_removeChoice(),interactUtils.restoreOriginalPosition($target),interactUtils.iFrameDragFixOff()}})).styleCursor(!1),interact($resultArea.selector).dropzone({overlap:.5,ondragenter:function ondragenter(e){var $dragged=$$1(e.relatedTarget);_insertDropzone($dragged),$dragged.addClass("droppable")},ondrop:function ondrop(e){var $dragged=$$1(e.relatedTarget),dropzoneIndex=$$1(resultSelector).index($dropzoneElement);this.ondragleave(e),_addChoiceToSelection($dragged,dropzoneIndex),interactUtils.restoreOriginalPosition($dragged)},ondragleave:function ondragleave(e){var $dragged=$$1(e.relatedTarget);$dropzoneElement.remove(),$dragged.removeClass("droppable")}})),_setInstructions(interaction),$$1(document).on("attributeChange.qti-widget.commonRenderer",function(e,data){data.element.getSerial()===interaction.getSerial()&&("maxChoices"===data.key||"minChoices"===data.key)&&(instructionMgr.removeInstructions(interaction),_setInstructions(interaction),instructionMgr.validateInstructions(interaction))}),_freezeSize($container)},setResponse=function(interaction,response){var $container=containerHelper.get(interaction),$choiceArea=$$1(".choice-area",$container),$resultArea=$$1(".result-area",$container);if(null===response||_.isEmpty(response))resetResponse(interaction);else try{_.each(pciResponse.unserialize(response,interaction),function(identifier){$resultArea.append($choiceArea.find("[data-identifier=\"".concat(identifier,"\"]")))})}catch(e){throw new Error("wrong response format in argument : ".concat(e))}instructionMgr.validateInstructions(interaction)},_getRawResponse=function(interaction){var $container=containerHelper.get(interaction),response=[];return $$1(".result-area>li",$container).each(function(){response.push($$1(this).data("identifier"))}),response},getResponse=function(interaction){return pciResponse.serialize(_getRawResponse(interaction),interaction)},getCustomData=function(interaction,data){return _.merge(data||{},{horizontal:"horizontal"===interaction.attr("orientation")})},destroy=function(interaction){var $container=containerHelper.get(interaction);[".choice-area >li:not(.deactivated)",".result-area >li",".icon-add-to-selection",".icon-remove-from-selection",".icon-move-before",".icon-move-after"].forEach(function(selector){interact($container.find(selector).selector).unset()}),$$1(document).off(".commonRenderer"),$container.find(".order-interaction-area").removeAttr("style"),instructionMgr.removeInstructions(interaction),containerHelper.reset(interaction)},setState=function(interaction,state){if(_.isObject(state)&&(state.response&&(interaction.resetResponse(),interaction.setResponse(state.response)),_.isArray(state.order)&&state.order.length===_.size(interaction.getChoices()))){var $container=containerHelper.get(interaction);$$1(".choice-area .qti-choice",$container).sort(function(a,b){var aIndex=_.indexOf(state.order,$$1(a).data("identifier")),bIndex=_.indexOf(state.order,$$1(b).data("identifier"));return aIndex>bIndex?1:aIndex<bIndex?-1:0}).detach().appendTo($$1(".choice-area",$container))}},getState=function(interaction){var state={},response=interaction.getResponse();if(response&&(state.response=response),!0===interaction.attr("shuffle")){var $container=containerHelper.get(interaction);state.order=[],$$1(".choice-area .qti-choice",$container).each(function(){state.order.push($$1(this).data("identifier"))})}return state},OrderInteraction={qtiClass:"orderInteraction",getData:getCustomData,template:function(data,options,asString){var html=Template(data,options);return asString||!0?html:$(html)},render:render,getContainer:containerHelper.get,setResponse:setResponse,getResponse:getResponse,resetResponse:resetResponse,destroy:destroy,setState:setState,getState:getState};return OrderInteraction}),define("qtiCustomInteractionContext",["lodash"],function(_){'use strict';return window._pciHooks=window._pciHooks||{},{register:function register(pciHook){var typeIdentifier="function"==typeof pciHook.getTypeIdentifier?pciHook.getTypeIdentifier():pciHook.typeIdentifier;if(typeIdentifier)window._pciHooks[typeIdentifier]=pciHook;else throw new Error("invalid PCI hook")},notifyReady:function notifyReady(){},notifyDone:function notifyDone(){},onready:function onready(){},ondone:function ondone(){},createPciInstance:function createPciInstance(pciTypeIdentifier){var registeredPCI=window._pciHooks[pciTypeIdentifier];if(!registeredPCI)throw new Error("no portable custom interaction hook found with the id "+pciTypeIdentifier);return _.cloneDeep(registeredPCI)}}}),define("taoQtiItem/qtiCommonRenderer/renderers/interactions/pci/instanciator",["qtiCustomInteractionContext"],function(qtiCustomInteractionContext){'use strict';qtiCustomInteractionContext=qtiCustomInteractionContext&&Object.prototype.hasOwnProperty.call(qtiCustomInteractionContext,"default")?qtiCustomInteractionContext["default"]:qtiCustomInteractionContext;return{getPci:function getPci(interaction){var pci=interaction.data("pci"),pciTypeIdentifier;if(!pci)if(pciTypeIdentifier=interaction.typeIdentifier,pci=qtiCustomInteractionContext.createPciInstance(pciTypeIdentifier),pci)interaction.data("pci",pci),pci._taoCustomInteraction=interaction;else throw new Error("no custom interaction hook found for the type "+pciTypeIdentifier);return pci},setPci:function setPci(interaction,instance){interaction.data("pci",instance)}}}),define("taoQtiItem/qtiCommonRenderer/renderers/interactions/pci/common",["lodash","taoQtiItem/qtiCommonRenderer/helpers/container","taoQtiItem/qtiCommonRenderer/renderers/interactions/pci/instanciator"],function(_,containerHelper,instanciator){'use strict';return _=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,containerHelper=containerHelper&&Object.prototype.hasOwnProperty.call(containerHelper,"default")?containerHelper["default"]:containerHelper,instanciator=instanciator&&Object.prototype.hasOwnProperty.call(instanciator,"default")?instanciator["default"]:instanciator,function(runtime){return{getRequiredModules:function(){var requireEntries=[];return runtime.hook&&requireEntries.push(runtime.hook.replace(/\.js$/,"")),_.forEach(runtime.libraries,function(lib){requireEntries.push(lib.replace(/\.js$/,""))}),_.forEach(runtime.stylesheets,function(stylesheet){requireEntries.push("css!"+stylesheet.replace(/\.css$/,""))}),requireEntries},createInstance:function createInstance(interaction,context){var id=interaction.attr("responseIdentifier"),pci=instanciator.getPci(interaction),properties=_.clone(interaction.properties),assetManager=context.assetManager;return pci.initialize(id,containerHelper.get(interaction).children().get(0),properties,{resolve:function(url){var resolved=assetManager.resolveBy("portableElementLocation",url);return resolved===url||_.isUndefined(resolved)?assetManager.resolve(url):resolved}}),Promise.resolve(pci)},destroy:function(interaction){return instanciator.getPci(interaction).destroy()},setState:function(interaction,state){instanciator.getPci(interaction).setSerializedState(state)},getState:function(interaction){return instanciator.getPci(interaction).getSerializedState()}}}}),define("taoQtiItem/qtiCommonRenderer/renderers/interactions/pci/ims",["lodash","core/logger","taoQtiItem/qtiCommonRenderer/helpers/container","taoQtiItem/qtiCommonRenderer/renderers/interactions/pci/instanciator"],function(_,loggerFactory,containerHelper,instanciator){'use strict';function defaultPciRenderer(runtime){return{getRequiredModules:function getRequiredModules(){var requireEntries=[];return _.forEach(runtime.modules,function(module,name){requireEntries.push(name)}),requireEntries},setPCIConstructor:function setPCIConstructor(interaction,pciConstructor){interaction.data("pciConstructor",pciConstructor)},getPCIConstructor:function getPCIConstructor(interaction){return interaction.data("pciConstructor")},createInstance:function createInstance(interaction,context){var pciConstructor=this.getPCIConstructor(interaction),properties=_.clone(interaction.properties);pciConstructor||(pciConstructor=instanciator.getPci(interaction),this.setPCIConstructor(interaction,pciConstructor)),_.forOwn(properties,function(propVal,propKey){properties[propKey]=_.isArray(propVal)||_.isObject(propVal)?JSON.stringify(propVal):propVal});var readyPromise=new Promise(function(resolve){pciReadyCallback=resolve}),config={properties:properties,templateVariables:{},boundTo:context.response||{},onready:pciReadyCallback,ondone:pciDoneCallback,status:"interacting"},pciReadyCallback;return pciConstructor.getInstance(containerHelper.get(interaction).get(0),config,context.state),readyPromise.then(function(instance){return instanciator.setPci(interaction,instance),instance})},destroy:function(interaction){instanciator.getPci(interaction).oncompleted()},setReviewState:function setReviewState(interaction,state){return this.destroy(interaction),this.createInstance(interaction,{response:{RESPONSE:state.response}})},setState:_.noop,getState:function getState(interaction){return instanciator.getPci(interaction).getState()}}}_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,loggerFactory=loggerFactory&&Object.prototype.hasOwnProperty.call(loggerFactory,"default")?loggerFactory["default"]:loggerFactory,containerHelper=containerHelper&&Object.prototype.hasOwnProperty.call(containerHelper,"default")?containerHelper["default"]:containerHelper,instanciator=instanciator&&Object.prototype.hasOwnProperty.call(instanciator,"default")?instanciator["default"]:instanciator;var logger=loggerFactory("taoQtiItem/qtiCommonRenderer/renderers/interactions/pci/ims"),pciDoneCallback=function(pci){logger.info("pciDoneCallback called on PCI "+pci.typeIdentifier)};return defaultPciRenderer}),define("taoQtiItem/qtiCommonRenderer/renderers/interactions/PortableCustomInteraction",["lodash","handlebars","i18n","lib/dompurify/purify","taoQtiItem/qtiCommonRenderer/helpers/container","taoQtiItem/qtiCommonRenderer/helpers/PortableElement","taoQtiItem/qtiCommonRenderer/renderers/interactions/pci/instanciator","taoQtiItem/qtiCommonRenderer/renderers/interactions/pci/common","taoQtiItem/qtiCommonRenderer/renderers/interactions/pci/ims","taoQtiItem/qtiItem/helper/util","taoQtiItem/portableElementRegistry/ciRegistry"],function(_,Handlebars,__,DOMPurify,containerHelper,PortableElement,instanciator,commonPciRenderer,imsPciRenderer,util,ciRegistry){'use strict';_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,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,containerHelper=containerHelper&&Object.prototype.hasOwnProperty.call(containerHelper,"default")?containerHelper["default"]:containerHelper,PortableElement=PortableElement&&Object.prototype.hasOwnProperty.call(PortableElement,"default")?PortableElement["default"]:PortableElement,instanciator=instanciator&&Object.prototype.hasOwnProperty.call(instanciator,"default")?instanciator["default"]:instanciator,commonPciRenderer=commonPciRenderer&&Object.prototype.hasOwnProperty.call(commonPciRenderer,"default")?commonPciRenderer["default"]:commonPciRenderer,imsPciRenderer=imsPciRenderer&&Object.prototype.hasOwnProperty.call(imsPciRenderer,"default")?imsPciRenderer["default"]:imsPciRenderer,util=util&&Object.prototype.hasOwnProperty.call(util,"default")?util["default"]:util,ciRegistry=ciRegistry&&Object.prototype.hasOwnProperty.call(ciRegistry,"default")?ciRegistry["default"]:ciRegistry;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){function program1(depth0){var buffer="",stack1;return buffer+="\n lang=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\" ",buffer}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,self=this,stack1,helper;return buffer+="<div class=\"qti-interaction qti-customInteraction\" data-serial=\"",(helper=helpers.serial)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.serial,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\" ",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),{hash:{},inverse:self.noop,fn:self.program(1,program1,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+=">\n ",(helper=helpers.markup)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.markup,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n</div>",buffer}),_setPciModel=function(interaction,runtime){var pciRenderer;pciRenderer="IMSPCI"===runtime.model?imsPciRenderer(runtime):commonPciRenderer(runtime),interaction.data("pci-model",runtime.model),interaction.data("pci-renderer",pciRenderer)},_getPciRenderer=function(interaction){return interaction.data("pci-renderer")},setResponse=function(interaction,response){instanciator.getPci(interaction).setResponse(response)},getResponse=function(interaction){return instanciator.getPci(interaction).getResponse()},resetResponse=function(interaction){instanciator.getPci(interaction).resetResponse()},getData=function(customInteraction,data){var markup=data.markup;return markup=util.removeMarkupNamespaces(markup),markup=PortableElement.fixMarkupMediaSources(markup,this),data.markup=markup,data},PortableCustomInteraction={qtiClass:"customInteraction",template:function(data,options,asString){var html=Template(data,options);return asString||!0?html:$(html)},getData:getData,render:function(interaction,options){var self=this;return options=options||{},new Promise(function(resolve,reject){var id=interaction.attr("responseIdentifier"),typeIdentifier=interaction.typeIdentifier,assetManager=self.getAssetManager(),response={},state;options.state&&options.state[id]&&(state=options.state[id]),response[id]={base:null},ciRegistry.loadRuntimes({include:[typeIdentifier]}).then(function(){var runtime=ciRegistry.getRuntime(typeIdentifier),pciRenderer;return runtime?void(_setPciModel(interaction,runtime),pciRenderer=_getPciRenderer(interaction),window.require(pciRenderer.getRequiredModules(),function(){var pci=instanciator.getPci(interaction);pci?pciRenderer.createInstance(interaction,{response:response,state:state,assetManager:assetManager}).then(function(instance){_.isFunction(instance.on)&&interaction.onPci("responseChange",function(){containerHelper.triggerResponseChangeEvent(interaction)}),resolve()}):reject("Unable to initialize pci \""+id+"\"")},reject)):reject("The runtime for the pci cannot be found : "+typeIdentifier)}).catch(function(error){reject("Error loading runtime \""+id+"\": "+error)})})},getContainer:containerHelper.get,setResponse:setResponse,getResponse:getResponse,resetResponse:resetResponse,destroy:function(interaction){return _getPciRenderer(interaction).destroy(interaction)},getState:function(interaction){return _getPciRenderer(interaction).getState(interaction)},setState:function(interaction,serializedState){_getPciRenderer(interaction).setState(interaction,serializedState)}};return PortableCustomInteraction}),define("taoQtiItem/qtiCommonRenderer/renderers/interactions/Prompt",["handlebars","i18n","lodash","lib/dompurify/purify","taoQtiItem/qtiCommonRenderer/helpers/container"],function(Handlebars,__,_,DOMPurify,containerHelper){'use strict';Handlebars=Handlebars&&Object.prototype.hasOwnProperty.call(Handlebars,"default")?Handlebars["default"]:Handlebars,__=__&&Object.prototype.hasOwnProperty.call(__,"default")?__["default"]:__,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,DOMPurify=DOMPurify&&Object.prototype.hasOwnProperty.call(DOMPurify,"default")?DOMPurify["default"]:DOMPurify,containerHelper=containerHelper&&Object.prototype.hasOwnProperty.call(containerHelper,"default")?containerHelper["default"]:containerHelper;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){function program1(depth0){var buffer="",stack1;return buffer+=" lang=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"",buffer}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,self=this,stack1,helper;return buffer+="<div\n class=\"qti-prompt-container\"\n data-html-editable-container",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),{hash:{},inverse:self.noop,fn:self.program(1,program1,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n>\n <div class=\"qti-prompt\" data-serial=\"",(helper=helpers.serial)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.serial,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\" data-html-editable id=\"prompt-",(helper=helpers.serial)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.serial,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\">",(helper=helpers.body)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.body,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),(stack1||0===stack1)&&(buffer+=stack1),buffer+="</div>\n</div>\n",buffer}),Prompt={qtiClass:"prompt",template:function(data,options,asString){var html=Template(data,options);return asString||!0?html:$(html)},getContainer:containerHelper.get};return Prompt}),define("taoQtiItem/qtiCommonRenderer/renderers/interactions/SelectPointInteraction",["jquery","lodash","handlebars","i18n","lib/dompurify/purify","taoQtiItem/qtiCommonRenderer/helpers/Graphic","taoQtiItem/qtiCommonRenderer/helpers/PciResponse","taoQtiItem/qtiCommonRenderer/helpers/container","taoQtiItem/qtiCommonRenderer/helpers/instructions/instructionManager"],function($$1,_,Handlebars,__,DOMPurify,graphic,pciResponse,containerHelper,instructionMgr){'use strict';$$1=$$1&&Object.prototype.hasOwnProperty.call($$1,"default")?$$1["default"]:$$1,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,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,graphic=graphic&&Object.prototype.hasOwnProperty.call(graphic,"default")?graphic["default"]:graphic,pciResponse=pciResponse&&Object.prototype.hasOwnProperty.call(pciResponse,"default")?pciResponse["default"]:pciResponse,containerHelper=containerHelper&&Object.prototype.hasOwnProperty.call(containerHelper,"default")?containerHelper["default"]:containerHelper,instructionMgr=instructionMgr&&Object.prototype.hasOwnProperty.call(instructionMgr,"default")?instructionMgr["default"]:instructionMgr;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){function program1(depth0){var buffer="",stack1;return buffer+="id=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.id),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"",buffer}function program3(depth0){var buffer="",stack1;return buffer+=" "+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["class"]),"function"===_typeof(stack1)?stack1.apply(depth0):stack1)),buffer}function program5(depth0){var buffer="",stack1;return buffer+=" lang=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"",buffer}function program7(depth0,data){var stack1,helper;return(helper=helpers.prompt)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.prompt,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),stack1||0===stack1?stack1:""}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,self=this,stack1,helper;return buffer+="<div ",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.id),{hash:{},inverse:self.noop,fn:self.program(1,program1,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+=" class=\"qti-interaction qti-blockInteraction qti-graphicInteraction qti-selectPointInteraction clearfix",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["class"]),{hash:{},inverse:self.noop,fn:self.program(3,program3,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\" data-serial=\"",(helper=helpers.serial)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.serial,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\"",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),{hash:{},inverse:self.noop,fn:self.program(5,program5,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+=">\n ",stack1=helpers["if"].call(depth0,depth0&&depth0.prompt,{hash:{},inverse:self.noop,fn:self.program(7,program7,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n <div class=\"instruction-container\"></div>\n <div class=\"image-editor solid\">\n <div id='graphic-paper-",(helper=helpers.serial)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.serial,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"' class=\"main-image-box\"></div>\n </div>\n</div>\n",buffer}),getRawResponse=function(interaction){return interaction&&interaction.paper&&_.isArray(interaction.paper.points)?_.map(interaction.paper.points,function(point){return[point.x,point.y]}):[]},addPoint=function(interaction,point){var maxChoices=interaction.attr("maxChoices"),pointChange=function(){containerHelper.triggerResponseChangeEvent(interaction),instructionMgr.validateInstructions(interaction)};0<maxChoices&&getRawResponse(interaction).length>=maxChoices?instructionMgr.validateInstructions(interaction):(!_.isArray(interaction.paper.points)&&(interaction.paper.points=[]),graphic.createTarget(interaction.paper,{point:point,create:function(target){interaction.isTouch&&target&&target.getBBox&&graphic.createTouchCircle(interaction.paper,target.getBBox()),interaction.paper.points.push(point),pointChange()},remove:function(){_.remove(interaction.paper.points,point),pointChange()}}))},enableSelection=function(interaction){var $container=containerHelper.get(interaction),$imageBox=$container.find(".main-image-box"),isResponsive=$container.hasClass("responsive"),image=interaction.paper.getById("bg-image-"+interaction.serial);interaction.paper.isTouch=!1,image.touchstart(function(){interaction.paper.isTouch=!0,image.untouchstart()}),image.click(function(event){addPoint(interaction,graphic.getPoint(event,interaction.paper,$imageBox,isResponsive))})},setResponse=function(interaction,response){var responseValues;if(response&&interaction.paper)try{responseValues=pciResponse.unserialize(response,interaction),"single"===interaction.getResponseDeclaration().attr("cardinality")&&(responseValues=[responseValues]),_(responseValues).filter(function(point){return _.isArray(point)&&2===point.length}).forEach(function(point){addPoint(interaction,{x:point[0],y:point[1]})})}catch(err){}},getResponse=function(interaction){return pciResponse.serialize(getRawResponse(interaction),interaction)},destroy=function(interaction){var $container;interaction.paper&&($container=containerHelper.get(interaction),$$1(window).off("resize.qti-widget."+interaction.serial),$container.off("resize.qti-widget."+interaction.serial),interaction.paper.clear(),instructionMgr.removeInstructions(interaction),$$1(".main-image-box",$container).empty().removeAttr("style"),$$1(".image-editor",$container).removeAttr("style")),containerHelper.reset(interaction)},setState=function(interaction,state){_.isObject(state)&&state.response&&(interaction.resetResponse(),interaction.setResponse(state.response))},SelectPointInteraction={qtiClass:"selectPointInteraction",template:function(data,options,asString){var html=Template(data,options);return asString||!0?html:$(html)},render:function(interaction){var self=this;return new Promise(function(resolve){var $container=containerHelper.get(interaction),background=interaction.object.attributes;$container.off("resized.qti-widget.resolve").one("resized.qti-widget.resolve",resolve),interaction.paper=graphic.responsivePaper("graphic-paper-"+interaction.serial,interaction.serial,{width:background.width,height:background.height,img:self.resolveUrl(background.data),imgId:"bg-image-"+interaction.serial,container:$container}),enableSelection(interaction),instructionMgr.minMaxChoiceInstructions(interaction,{min:interaction.attr("minChoices"),max:interaction.attr("maxChoices"),choiceCount:!1,getResponse:getRawResponse,onError:function onError(data){data&&graphic.highlightError(data.target,"success")}})})},getContainer:containerHelper.get,setResponse:setResponse,getResponse:getResponse,resetResponse:function(interaction){interaction&&interaction.paper&&(interaction.paper.points=[],interaction.paper.forEach(function(element){var point=element.data("point");"object"===_typeof(point)&&graphic.trigger(element,"click")}))},destroy:destroy,setState:setState,getState:function(interaction){var state={},response=interaction.getResponse();return response&&(state.response=response),state}};return SelectPointInteraction}),define("taoQtiItem/qtiCommonRenderer/renderers/interactions/SliderInteraction",["jquery","lodash","i18n","handlebars","lib/dompurify/purify","taoQtiItem/qtiCommonRenderer/helpers/container","taoQtiItem/qtiCommonRenderer/helpers/PciResponse","nouislider"],function($$1,_,__,Handlebars,DOMPurify,containerHelper,pciResponse){'use strict';$$1=$$1&&Object.prototype.hasOwnProperty.call($$1,"default")?$$1["default"]:$$1,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,__=__&&Object.prototype.hasOwnProperty.call(__,"default")?__["default"]:__,Handlebars=Handlebars&&Object.prototype.hasOwnProperty.call(Handlebars,"default")?Handlebars["default"]:Handlebars,DOMPurify=DOMPurify&&Object.prototype.hasOwnProperty.call(DOMPurify,"default")?DOMPurify["default"]:DOMPurify,containerHelper=containerHelper&&Object.prototype.hasOwnProperty.call(containerHelper,"default")?containerHelper["default"]:containerHelper,pciResponse=pciResponse&&Object.prototype.hasOwnProperty.call(pciResponse,"default")?pciResponse["default"]:pciResponse;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){function program1(depth0){var buffer="",stack1;return buffer+="id=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.id),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"",buffer}function program3(depth0){var buffer="",stack1;return buffer+=" "+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["class"]),"function"===_typeof(stack1)?stack1.apply(depth0):stack1)),buffer}function program5(depth0){var buffer="",stack1;return buffer+=" lang=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"",buffer}function program7(depth0,data){var stack1,helper;return(helper=helpers.prompt)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.prompt,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),stack1||0===stack1?stack1:""}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,self=this,stack1,helper;return buffer+="<div ",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.id),{hash:{},inverse:self.noop,fn:self.program(1,program1,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+=" class=\"qti-interaction qti-blockInteraction qti-sliderInteraction",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["class"]),{hash:{},inverse:self.noop,fn:self.program(3,program3,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\" data-serial=\"",(helper=helpers.serial)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.serial,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\" data-qti-class=\"sliderInteraction\"",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),{hash:{},inverse:self.noop,fn:self.program(5,program5,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+=" >\r\n ",stack1=helpers["if"].call(depth0,depth0&&depth0.prompt,{hash:{},inverse:self.noop,fn:self.program(7,program7,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\r\n <div class=\"instruction-container\"></div>\r\n</div>\r\n",buffer}),_slideTo=function(options){options.sliderCurrentValue.find(".qti-slider-cur-value").text(options.value),options.sliderValue.val(options.value)},render=function(interaction){var attributes=interaction.getAttributes(),$container=interaction.getContainer(),$el=$$1("<div />").attr({id:"".concat(attributes.responseIdentifier,"-qti-slider"),class:"qti-slider"}),$sliderLabels=$$1("<div />").attr({class:"qti-slider-values"}),$sliderCurrentValue=$$1("<div />").attr({id:"".concat(attributes.responseIdentifier,"-qti-slider-cur-value"),class:"qti-slider-cur-value"}),$sliderValue=$$1("<input />").attr({type:"hidden",id:"".concat(attributes.responseIdentifier,"-qti-slider-value"),class:"qti-slider-value"}),orientation="horizontal",reverse=!!("undefined"!=typeof attributes.reverse&&attributes.reverse),min=parseInt(attributes.lowerBound),max=parseInt(attributes.upperBound),step="undefined"!=typeof attributes.step&&attributes.step?parseInt(attributes.step):1,steps=(max-min)/step;$sliderCurrentValue.append("<span class=\"qti-slider-cur-value-text\">".concat(__("Current value:"),"</span>")).append("<span class=\"qti-slider-cur-value\"></span>"),$sliderLabels.append("<span class=\"slider-min\">".concat(reverse?max:min,"</span>")).append("<span class=\"slider-max\">".concat(reverse?min:max,"</span>")),interaction.getContainer().append($el).append($sliderLabels).append($sliderCurrentValue).append($sliderValue),"undefined"!=typeof attributes.orientation&&-1<$$1.inArray(attributes.orientation,["horizontal","vertical"])&&(orientation=attributes.orientation);var sliderSize=0;if("horizontal"===orientation)$container.addClass("qti-slider-horizontal");else{sliderSize=20*steps,sliderSize>300&&(sliderSize=300),$container.addClass("qti-slider-vertical"),$el.height("".concat(sliderSize,"px")),$sliderLabels.height("".concat(sliderSize,"px"))}if("undefined"!=typeof attributes.stepLabel&&attributes.stepLabel){var middleStep=parseInt(steps/2),leftOffset=100/steps*middleStep,middleValue=reverse?max-middleStep*step:min+middleStep*step;"horizontal"===orientation?$sliderLabels.find(".slider-min").after("<span class=\"slider-middle\" style=\"left:'".concat(leftOffset,"%\">").concat(middleValue,"</span>")):$sliderLabels.find(".slider-min").after("<span class=\"slider-middle\" style=\"top:".concat(leftOffset,"%\">").concat(middleValue,"</span>"))}$el.noUiSlider({start:reverse?max:min,range:{min:min,max:max},step:step,orientation:orientation}).on("slide",function(){var val=parseInt($$1(this).val());interaction.attr("reverse")&&(val=max+min-val),val=Math.round(1e3*val)/1e3,_slideTo({value:val,sliderValue:$sliderValue,sliderCurrentValue:$sliderCurrentValue}),containerHelper.triggerResponseChangeEvent(interaction)}),_slideTo({value:min,sliderValue:$sliderValue,sliderCurrentValue:$sliderCurrentValue}),$$1(document).on("attributeChange.qti-widget.commonRenderer",function(e,data){if(data.element.getSerial()===interaction.getSerial()&&"responseIdentifier"===data.key&&data.value){var attributesNew=interaction.getAttributes();$container.find(".qti-slider").attr({id:"".concat(attributesNew.responseIdentifier,"-qti-slider")}),$container.find(".qti-slider-cur-value").attr({id:"".concat(attributesNew.responseIdentifier,"-qti-slider-cur-value")}),$container.find(".qti-slider-value").attr({id:"".concat(attributesNew.responseIdentifier,"-qti-slider-value")})}})},setResponse=function(interaction,response){var attributes=interaction.getAttributes(),$container=interaction.getContainer(),$sliderValue=$container.find("#".concat(attributes.responseIdentifier,"-qti-slider-value")),$sliderCurrentValue=$container.find("#".concat(attributes.responseIdentifier,"-qti-slider-cur-value")),$el=$container.find("#".concat(attributes.responseIdentifier,"-qti-slider")),min=parseInt(attributes.lowerBound),max=parseInt(attributes.upperBound),value;value=pciResponse.unserialize(response,interaction)[0],_slideTo({value:value,sliderValue:$sliderValue,sliderCurrentValue:$sliderCurrentValue}),$el.val(interaction.attr("reverse")?max+min-value:value)},_getRawResponse=function(interaction){var attributes=interaction.getAttributes(),baseType=interaction.getResponseDeclaration().attr("baseType"),min=parseInt(attributes.lowerBound),$container=interaction.getContainer(),$sliderValue=$container.find("#".concat(attributes.responseIdentifier,"-qti-slider-value")),value;return"integer"===baseType?value=parseInt($sliderValue.val()):"float"===baseType&&(value=parseFloat($sliderValue.val())),isNaN(value)?min:value},getResponse=function(interaction){return pciResponse.serialize([_getRawResponse(interaction)],interaction)},destroy=function(interaction){var $container=interaction.getContainer();$container.empty(),containerHelper.reset(interaction)},setState=function(interaction,state){_.isObject(state)&&state.response&&(interaction.resetResponse(),interaction.setResponse(state.response))},SliderInteraction={qtiClass:"sliderInteraction",template:function(data,options,asString){var html=Template(data,options);return asString||!0?html:$(html)},render:render,getContainer:containerHelper.get,setResponse:setResponse,getResponse:getResponse,resetResponse:function resetResponse(interaction){var attributes=interaction.getAttributes(),$container=interaction.getContainer(),$el=$container.find("#".concat(attributes.responseIdentifier,"-qti-slider")),$sliderValue=$container.find("#".concat(attributes.responseIdentifier,"-qti-slider-value")),$sliderCurrentValue=$container.find("#".concat(attributes.responseIdentifier,"-qti-slider-cur-value")),min=parseInt(attributes.lowerBound),max=parseInt(attributes.upperBound),reverse=!!("undefined"!=typeof attributes.reverse&&attributes.reverse),startValue=reverse?max:min;_slideTo({value:min,sliderValue:$sliderValue,sliderCurrentValue:$sliderCurrentValue}),$el.val(startValue)},destroy:destroy,setState:setState,getState:function(interaction){var state={},response=interaction.getResponse();return response&&(state.response=response),state}};return SliderInteraction}),define("taoQtiItem/qtiCommonRenderer/renderers/interactions/TextEntryInteraction",["jquery","lodash","i18n","handlebars","lib/dompurify/purify","taoQtiItem/qtiCommonRenderer/helpers/container","taoQtiItem/qtiCommonRenderer/helpers/instructions/instructionManager","taoQtiItem/qtiCommonRenderer/helpers/PciResponse","taoQtiItem/qtiCommonRenderer/helpers/patternMask","util/locale","ui/tooltip"],function($$1,_,__,Handlebars,DOMPurify,containerHelper,instructionMgr,pciResponse,patternMaskHelper,locale,tooltip){'use strict';$$1=$$1&&Object.prototype.hasOwnProperty.call($$1,"default")?$$1["default"]:$$1,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,__=__&&Object.prototype.hasOwnProperty.call(__,"default")?__["default"]:__,Handlebars=Handlebars&&Object.prototype.hasOwnProperty.call(Handlebars,"default")?Handlebars["default"]:Handlebars,DOMPurify=DOMPurify&&Object.prototype.hasOwnProperty.call(DOMPurify,"default")?DOMPurify["default"]:DOMPurify,containerHelper=containerHelper&&Object.prototype.hasOwnProperty.call(containerHelper,"default")?containerHelper["default"]:containerHelper,instructionMgr=instructionMgr&&Object.prototype.hasOwnProperty.call(instructionMgr,"default")?instructionMgr["default"]:instructionMgr,pciResponse=pciResponse&&Object.prototype.hasOwnProperty.call(pciResponse,"default")?pciResponse["default"]:pciResponse,patternMaskHelper=patternMaskHelper&&Object.prototype.hasOwnProperty.call(patternMaskHelper,"default")?patternMaskHelper["default"]:patternMaskHelper,locale=locale&&Object.prototype.hasOwnProperty.call(locale,"default")?locale["default"]:locale,tooltip=tooltip&&Object.prototype.hasOwnProperty.call(tooltip,"default")?tooltip["default"]:tooltip;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){function program1(depth0){var buffer="",stack1;return buffer+="id=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.id),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"",buffer}function program3(depth0){var buffer="",stack1;return buffer+=" "+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["class"]),"function"===_typeof(stack1)?stack1.apply(depth0):stack1)),buffer}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,self=this,stack1,helper;return buffer+="<input\n ",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.id),{hash:{},inverse:self.noop,fn:self.program(1,program1,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n class=\"qti-interaction qti-inlineInteraction qti-textEntryInteraction",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["class"]),{hash:{},inverse:self.noop,fn:self.program(3,program3,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\"\n data-serial=\"",(helper=helpers.serial)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.serial,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\"\n data-qti-class=\"textEntryInteraction\"\n type=\"text\"\n>",buffer}),hideTooltip=function($input){$input.data("$tooltip")&&$input.data("$tooltip").hide()},showTooltip=function($input,theme,message){if($input.data("$tooltip"))$input.data("$tooltip").updateTitleContent(message);else{var textEntryTooltip=tooltip.create($input,message,{theme:theme,trigger:"manual"});$input.data("$tooltip",textEntryTooltip)}$input.data("$tooltip").show()},render=function(interaction){var attributes=interaction.getAttributes(),baseType=interaction.getResponseDeclaration().attr("baseType"),$input=interaction.getContainer(),patternMask=interaction.attr("patternMask"),maxChars=parseInt(patternMaskHelper.parsePattern(patternMask,"chars"),10),expectedLength,updateMaxCharsTooltip,updatePatternMaskTooltip;"integer"===baseType?$input.attr("inputmode","numeric"):"float"===baseType?$input.attr("inputmode","decimal"):$input.attr("inputmode","text");attributes.expectedLength&&(expectedLength=parseInt(attributes.expectedLength)+2,$input.css("width",expectedLength+"ch"),$input.css("min-width",expectedLength+"ch")),attributes.placeholderText&&$input.attr("placeholder",attributes.placeholderText),maxChars?(updateMaxCharsTooltip=function(){var count=$input.val().length,message,messageType;message=count?__("%d/%d",count,maxChars):__("%d characters allowed",maxChars),count>=maxChars?($input.addClass("maxed"),messageType="warning"):($input.removeClass("maxed"),messageType="info"),showTooltip($input,messageType,message),count&&"warning"===messageType&&hideTooltip($input)},$input.attr("maxlength",maxChars).on("focus.commonRenderer",function(){updateMaxCharsTooltip()}).on("keyup.commonRenderer",function(){updateMaxCharsTooltip(),containerHelper.triggerResponseChangeEvent(interaction)}).on("blur.commonRenderer",function(){hideTooltip($input)})):attributes.patternMask?(updatePatternMaskTooltip=function(){var regex=new RegExp(attributes.patternMask);hideTooltip($input),$input.val()&&(regex.test($input.val())?$input.removeClass("invalid"):($input.addClass("invalid"),showTooltip($input,"error",__("This is not a valid answer"))))},$input.on("focus.commonRenderer",function(){updatePatternMaskTooltip()}).on("keyup.commonRenderer",function(){updatePatternMaskTooltip(),containerHelper.triggerResponseChangeEvent(interaction)}).on("blur.commonRenderer",function(){hideTooltip($input)})):$input.on("keyup.commonRenderer",function(){containerHelper.triggerResponseChangeEvent(interaction)})},setResponse=function(interaction,response){var responseValue;try{responseValue=pciResponse.unserialize(response,interaction)}catch(e){}responseValue&&responseValue.length&&interaction.getContainer().val(responseValue[0])},getResponse=function(interaction){var ret={base:{}},$input=interaction.getContainer(),attributes=interaction.getAttributes(),baseType=interaction.getResponseDeclaration().attr("baseType"),numericBase=attributes.base||10,value;return $input.hasClass("invalid")||attributes.placeholderText&&$input.val()===attributes.placeholderText?value="":"integer"===baseType?value=locale.parseInt($input.val(),numericBase):"float"===baseType?value=locale.parseFloat($input.val()):"string"===baseType&&(value=$input.val()),ret.base[baseType]=isNaN(value)&&"number"==typeof value?"":value,ret},destroy=function(interaction){$$1("input.qti-textEntryInteraction").each(function(index,el){var $input=$$1(el);$input.data("$tooltip")&&($input.data("$tooltip").dispose(),$input.removeData("$tooltip"))}),$$1(document).off(".commonRenderer"),containerHelper.get(interaction).off(".commonRenderer"),instructionMgr.removeInstructions(interaction),containerHelper.reset(interaction)},setState=function(interaction,state){_.isObject(state)&&state.response&&(interaction.resetResponse(),interaction.setResponse(state.response))},TextEntryInteraction={qtiClass:"textEntryInteraction",template:function(data,options,asString){var html=Template(data,options);return asString||!0?html:$(html)},render:render,getContainer:containerHelper.get,setResponse:setResponse,getResponse:getResponse,resetResponse:function(interaction){interaction.getContainer().val("")},destroy:destroy,setState:setState,getState:function(interaction){var state={},response=interaction.getResponse();return response&&(state.response=response),state}};return TextEntryInteraction}),define("taoQtiItem/qtiCommonRenderer/renderers/interactions/UploadInteraction",["jquery","lodash","i18n","core/mimetype","handlebars","lib/dompurify/purify","taoQtiItem/qtiCommonRenderer/helpers/container","taoQtiItem/qtiCommonRenderer/helpers/instructions/instructionManager","taoQtiItem/qtiCommonRenderer/helpers/uploadMime","ui/progressbar","ui/previewer","ui/modal","ui/waitForMedia"],function($$1,_,__,mimetype,Handlebars,DOMPurify,containerHelper,instructionMgr,uploadHelper){'use strict';var _Mathmin=Math.min,_Mathround2=Math.round;function resetGui(interaction){var $container=containerHelper.get(interaction);$container.find(".file-name").text(__("No file selected")),$container.find(".btn-info").text(__("Browse..."))}function callResetGui(interaction){var renderer=interaction.getRenderer();_.isFunction(renderer.resetGui)&&renderer.resetGui(interaction)}function render(interaction){var self=this,$container=containerHelper.get(interaction),changeListener,$input;if(callResetGui(interaction),instructionMgr.appendInstruction(interaction,_initialInstructions),interaction.data("_response",{base:null}),changeListener=function(e){var file=e.target.files[0];"undefined"!=typeof file&&_handleSelectedFiles(interaction,file,self.getCustomMessage("upload","wrongType"))},$input=$container.find("input"),$container.find(".progressbar").progressbar(),!window.FileReader)throw new Error("FileReader API not supported! Please use a compliant browser!");$input.bind("change",changeListener),$input.bind("mousedown",function(e){return e.preventDefault(),$$1(this).blur(),!1})}$$1=$$1&&Object.prototype.hasOwnProperty.call($$1,"default")?$$1["default"]:$$1,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,__=__&&Object.prototype.hasOwnProperty.call(__,"default")?__["default"]:__,mimetype=mimetype&&Object.prototype.hasOwnProperty.call(mimetype,"default")?mimetype["default"]:mimetype,Handlebars=Handlebars&&Object.prototype.hasOwnProperty.call(Handlebars,"default")?Handlebars["default"]:Handlebars,DOMPurify=DOMPurify&&Object.prototype.hasOwnProperty.call(DOMPurify,"default")?DOMPurify["default"]:DOMPurify,containerHelper=containerHelper&&Object.prototype.hasOwnProperty.call(containerHelper,"default")?containerHelper["default"]:containerHelper,instructionMgr=instructionMgr&&Object.prototype.hasOwnProperty.call(instructionMgr,"default")?instructionMgr["default"]:instructionMgr,uploadHelper=uploadHelper&&Object.prototype.hasOwnProperty.call(uploadHelper,"default")?uploadHelper["default"]:uploadHelper;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){function program1(depth0){var buffer="",stack1;return buffer+=" lang=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"",buffer}function program3(depth0,data){var stack1,helper;return(helper=helpers.prompt)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.prompt,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),stack1||0===stack1?stack1:""}function program5(depth0,data){var buffer="",stack1,helper;return buffer+="accept=\"",(helper=helpers.accept)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.accept,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\"",buffer}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,self=this,helperMissing=helpers.helperMissing,stack1,helper,options;return buffer+="<div class=\"qti-interaction qti-blockInteraction qti-uploadInteraction\" data-serial=\"",(helper=helpers.serial)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.serial,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\"",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),{hash:{},inverse:self.noop,fn:self.program(1,program1,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+=">\n\t",stack1=helpers["if"].call(depth0,depth0&&depth0.prompt,{hash:{},inverse:self.noop,fn:self.program(3,program3,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n\t<div class=\"instruction-container\"></div>\n <div class=\"file-upload fixed-grid-row lft\">\n <div class=\"progressbar\"></div>\n <span class=\"btn-info small col-4\">"+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"Browse...",options):helperMissing.call(depth0,"__","Browse...",options)))+"</span>\n <span class=\"file-name placeholder col-8 truncate\">"+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"No file selected",options):helperMissing.call(depth0,"__","No file selected",options)))+"</span>\n <input type=\"file\" ",stack1=helpers["if"].call(depth0,depth0&&depth0.accept,{hash:{},inverse:self.noop,fn:self.program(5,program5,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="/>\n </div>\n <div class=\"file-upload-preview lft visible-file-upload-preview runtime-visible-file-upload-preview\">\n <p class=\"nopreview\">"+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"No preview available",options):helperMissing.call(depth0,"__","No preview available",options)))+"</p>\n </div>\n <div class=\"file-upload-preview-popup modal\">\n <div class=\"modal-body\">\n </div>\n </div>\n</div>\n",buffer}),_initialInstructions=__("Browse your computer and select the appropriate file."),_readyInstructions=__("The selected file is ready to be sent."),validateFileType=function(file,interaction){var expectedTypes=uploadHelper.getExpectedTypes(interaction,!0),filetype=mimetype.getMimeType(file);return!expectedTypes.length||0<=_.indexOf(expectedTypes,filetype)},getMessageWrongType=function(interaction,userSelectedType,messageWrongType){var types=uploadHelper.getExpectedTypes(interaction),expectedTypeLabels=_.map(_.uniq(types),function(type){var mime=_.find(uploadHelper.getMimeTypes(),{mime:type});return mime?mime.label:type});return messageWrongType&&_.isFunction(messageWrongType)?messageWrongType({userSelectedType:userSelectedType,types:expectedTypeLabels}):__("Wrong type of file. Expected %s. The selected file has the mimetype \"%s\".",expectedTypeLabels.join(__(" or ")),userSelectedType)},_handleSelectedFiles=function(interaction,file,messageWrongType){var $container=containerHelper.get(interaction),filename=file.name,filetype=mimetype.getMimeType(file),reader;return instructionMgr.removeInstructions(interaction),instructionMgr.appendInstruction(interaction,_initialInstructions),validateFileType(file,interaction)?void($container.find(".file-name").empty().append(filename),reader=new FileReader,reader.onload=function(e){var base64Data,commaPosition,base64Raw,$previewArea;instructionMgr.removeInstructions(interaction),instructionMgr.appendInstruction(interaction,_readyInstructions,function(){this.setLevel("success")}),instructionMgr.validateInstructions(interaction),$container.find(".progressbar").progressbar("value",100),base64Data=e.target.result,commaPosition=base64Data.indexOf(","),base64Raw=base64Data.substring(commaPosition+1),interaction.data("_response",{base:{file:{data:base64Raw,mime:filetype,name:filename}}}),$previewArea=$container.find(".file-upload-preview"),$previewArea.previewer({url:base64Data,name:filename,mime:filetype}),$previewArea.waitForMedia(function(){var $originalImg=$previewArea.find("img"),$largeDisplay=$$1(".file-upload-preview-popup"),$item=$$1(".qti-item"),itemWidth=$item.width(),winWidth=$$1(window).width()-80,fullHeight=$$1("body").height(),imgNaturalWidth,isOversized,modalWidth;$originalImg.length&&(imgNaturalWidth=$originalImg[0].naturalWidth,isOversized=imgNaturalWidth>itemWidth,modalWidth=_Mathmin(winWidth,imgNaturalWidth),$previewArea.toggleClass("clickable",isOversized),isOversized&&$previewArea.on("click",function(){var $modalBody;$$1(".upload-ia-modal-bg").remove(),$modalBody=$largeDisplay.find(".modal-body"),$modalBody.empty().append($originalImg.clone()),$largeDisplay.on("opened.modal",function(){$$1(".tao-item-scope.tao-preview-scope").css("overflow","hidden"),$largeDisplay.css({width:modalWidth,height:fullHeight,left:(modalWidth-itemWidth-40)/-2})}).on("closed.modal",function(){$$1(".tao-item-scope.tao-preview-scope").css("overflow","auto")}).modal({modalOverlayClass:"modal-bg upload-ia-modal-bg"})}))})},reader.onloadstart=function(){instructionMgr.removeInstructions(interaction),$container.find(".progressbar").progressbar("value",0)},reader.onprogress=function(e){var _Mathceil=Math.ceil,percentProgress=_Mathceil(100*(_Mathround2(e.loaded)/_Mathround2(e.total)));$container.find(".progressbar").progressbar("value",percentProgress)},reader.readAsDataURL(file)):(instructionMgr.removeInstructions(interaction),instructionMgr.appendInstruction(interaction,getMessageWrongType(interaction,filetype,messageWrongType),function(){this.setLevel("error")}),void instructionMgr.validateInstructions(interaction))},setResponse=function(interaction,response){var $container=containerHelper.get(interaction),filename;null!==response.base&&(filename="undefined"==typeof response.base.file.name?"previously-uploaded-file":response.base.file.name,$container.find(".file-name").empty().text(filename)),interaction.data("_response",response)},destroy=function(interaction){$$1(document).off(".commonRenderer"),containerHelper.get(interaction).off(".commonRenderer"),instructionMgr.removeInstructions(interaction),containerHelper.reset(interaction)},setState=function(interaction,state){_.isObject(state)&&state.response&&(interaction.resetResponse(),interaction.setResponse(state.response))},getCustomData=function(interaction,data){return _.merge(data||{},{accept:uploadHelper.getExpectedTypes(interaction,!0).join(",")})},UploadInteraction={qtiClass:"uploadInteraction",template:function(data,options,asString){var html=Template(data,options);return asString||!0?html:$(html)},render:render,getContainer:containerHelper.get,setResponse:setResponse,getResponse:function(interaction){return interaction.data("_response")},resetResponse:function(interaction){callResetGui(interaction)},destroy:destroy,setState:setState,getState:function(interaction){var state={},response=interaction.getResponse();return response&&(state.response=response),state},getData:getCustomData,resetGui:resetGui};return UploadInteraction}),define("taoQtiItem/qtiCommonRenderer/renderers/Item",["handlebars","i18n","lodash","lib/dompurify/purify","taoQtiItem/qtiCommonRenderer/helpers/container","taoQtiItem/qtiCommonRenderer/helpers/itemStylesheetHandler"],function(Handlebars,__,_,DOMPurify,containerHelper,itemStylesheetHandler){'use strict';Handlebars=Handlebars&&Object.prototype.hasOwnProperty.call(Handlebars,"default")?Handlebars["default"]:Handlebars,__=__&&Object.prototype.hasOwnProperty.call(__,"default")?__["default"]:__,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,DOMPurify=DOMPurify&&Object.prototype.hasOwnProperty.call(DOMPurify,"default")?DOMPurify["default"]:DOMPurify,containerHelper=containerHelper&&Object.prototype.hasOwnProperty.call(containerHelper,"default")?containerHelper["default"]:containerHelper,itemStylesheetHandler=itemStylesheetHandler&&Object.prototype.hasOwnProperty.call(itemStylesheetHandler,"default")?itemStylesheetHandler["default"]:itemStylesheetHandler;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){function program1(depth0){var buffer="",stack1;return buffer+=" lang=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"",buffer}function program3(depth0){var buffer="",stack1;return buffer+=" id=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.id),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"",buffer}function program5(depth0){var buffer="",stack1;return buffer+=" "+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["class"]),"function"===_typeof(stack1)?stack1.apply(depth0):stack1)),buffer}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,self=this,stack1,helper;return buffer+="<div class=\"qti-item tao-scope runtime\" data-serial=\"",(helper=helpers.serial)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.serial,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\" data-identifier=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.identifier),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),{hash:{},inverse:self.noop,fn:self.program(1,program1,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+=">\n <div",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.id),{hash:{},inverse:self.noop,fn:self.program(3,program3,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+=" class=\"qti-itemBody ",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["class"]),{hash:{},inverse:self.noop,fn:self.program(5,program5,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\">",(helper=helpers.body)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.body,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),(stack1||0===stack1)&&(buffer+=stack1),buffer+="</div>\n <div id=\"modalFeedbacks\"></div>\n</div>\n",buffer}),Item={qtiClass:"assessmentItem",template:function(data,options,asString){var html=Template(data,options);return asString||!0?html:$(html)},getContainer:containerHelper.get,render:function(item){containerHelper.targetBlank(containerHelper.get(item)),itemStylesheetHandler.attach(item.stylesheets)},destroy:function(item){containerHelper.clear(),item.stylesheets&&itemStylesheetHandler.detach(item.stylesheets)}};return Item}),define("taoQtiItem/qtiCommonRenderer/renderers/Math",["lodash","handlebars","i18n","lib/dompurify/purify","taoQtiItem/qtiCommonRenderer/helpers/container","mathJax"],function(_,Handlebars,__,DOMPurify,containerHelper,MathJax){'use strict';_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,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,containerHelper=containerHelper&&Object.prototype.hasOwnProperty.call(containerHelper,"default")?containerHelper["default"]:containerHelper,MathJax=MathJax&&Object.prototype.hasOwnProperty.call(MathJax,"default")?MathJax["default"]:MathJax;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){function program1(depth0,data){var buffer="",stack1,helper;return buffer+="<span data-serial=\"",(helper=helpers.serial)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.serial,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\" data-qti-class=\"math\"",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),{hash:{},inverse:self.noop,fn:self.program(2,program2,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="><math display=\"block\">",(helper=helpers.raw)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.raw,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),(stack1||0===stack1)&&(buffer+=stack1),buffer+="</math></span>",buffer}function program2(depth0){var buffer="",stack1;return buffer+=" lang=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"",buffer}function program4(depth0,data){var buffer="",stack1,helper;return buffer+="<span data-serial=\"",(helper=helpers.serial)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.serial,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\" data-qti-class=\"math\"",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),{hash:{},inverse:self.noop,fn:self.program(2,program2,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="><math>",(helper=helpers.raw)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.raw,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),(stack1||0===stack1)&&(buffer+=stack1),buffer+="</math></span>",buffer}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var escapeExpression=this.escapeExpression,self=this,stack1;return stack1=helpers["if"].call(depth0,depth0&&depth0.block,{hash:{},inverse:self.program(4,program4,data),fn:self.program(1,program1,data),data:data}),stack1||0===stack1?stack1:""});"undefined"!=typeof MathJax&&MathJax&&(MathJax.Hub.processSectionDelay=0);var _Math={qtiClass:"math",template:function(data,options,asString){var html=Template(data,options);return asString||!0?html:$(html)},getContainer:containerHelper.get,render:function(math){return new Promise(function(resolve){var $item=containerHelper.get(math).closest(".qti-item");"undefined"!=typeof MathJax&&MathJax?(!window.MathJax&&(window.MathJax=MathJax),$item.length?(MathJax.Hub.Queue(["Typeset",MathJax.Hub,$item[0]]),MathJax.Hub.Queue(resolve)):resolve()):resolve()})}};return _Math}),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 $body=_getBodyDom(element),regex,matches;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/qtiCommonRenderer/renderers/ModalFeedback",["lodash","handlebars","i18n","lib/dompurify/purify","taoQtiItem/qtiCommonRenderer/helpers/container","taoQtiItem/qtiItem/helper/container","ui/waitForMedia","ui/modal"],function(_,Handlebars,__,DOMPurify,containerHelper,coreContainerHelper){'use strict';_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,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,containerHelper=containerHelper&&Object.prototype.hasOwnProperty.call(containerHelper,"default")?containerHelper["default"]:containerHelper,coreContainerHelper=coreContainerHelper&&Object.prototype.hasOwnProperty.call(coreContainerHelper,"default")?coreContainerHelper["default"]:coreContainerHelper;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){function program3(depth0){var buffer="",stack1;return buffer+=" lang=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"",buffer}function program5(depth0){var buffer="",stack1;return buffer+="<h2 class=\"qti-title modal-title\">"+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.title),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"</h2>",buffer}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,self=this,stack1,helper;return buffer+="<div id=\"",(helper=helpers.serial)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.serial,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\" data-serial=\"",(helper=helpers.serial)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.serial,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\" data-identifier=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.identifier),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\" class=\"",stack1=helpers.unless.call(depth0,depth0&&depth0.inline,{hash:{},inverse:self.noop,fn:self.program(1,function(){return"modal "},data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="qti-modalFeedback ",(helper=helpers.feedbackStyle)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.feedbackStyle,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\"",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),{hash:{},inverse:self.noop,fn:self.program(3,program3,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+=">\n ",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.title),{hash:{},inverse:self.noop,fn:self.program(5,program5,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n <div class=\"modal-body\">",(helper=helpers.body)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.body,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),(stack1||0===stack1)&&(buffer+=stack1),buffer+="</div>\n</div>",buffer}),modalFeedbackRenderer={qtiClass:"modalFeedback",template:function(data,options,asString){var html=Template(data,options);return asString||!0?html:$(html)},getContainer:containerHelper.get,width:600,getData:function getData(fb,data){return data.feedbackStyle=coreContainerHelper.getEncodedData(fb,"modalFeedback"),data},render:function render(modalFeedback,data){var $modal=containerHelper.get(modalFeedback);$modal.waitForMedia(function(){$modal.on("opened.modal",function(){var $itemBody=containerHelper.get(modalFeedback.getRootElement()).children(".qti-itemBody"),requiredHeight=$modal.outerHeight()+parseInt($modal.css("top"));requiredHeight>$itemBody.height()&&$itemBody.height(requiredHeight)}).on("closed.modal",function(){data=data||{},_.isFunction(data.callback)&&data.callback.call(this)}).modal({startClosed:!1,minHeight:modalFeedbackRenderer.minHeight,width:modalFeedbackRenderer.width})})}};return modalFeedbackRenderer}),define("taoQtiItem/qtiCommonRenderer/renderers/Object",["handlebars","i18n","lodash","lib/dompurify/purify","taoQtiItem/qtiCommonRenderer/helpers/container","ui/previewer"],function(Handlebars,__,_,DOMPurify,containerHelper){'use strict';Handlebars=Handlebars&&Object.prototype.hasOwnProperty.call(Handlebars,"default")?Handlebars["default"]:Handlebars,__=__&&Object.prototype.hasOwnProperty.call(__,"default")?__["default"]:__,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,DOMPurify=DOMPurify&&Object.prototype.hasOwnProperty.call(DOMPurify,"default")?DOMPurify["default"]:DOMPurify,containerHelper=containerHelper&&Object.prototype.hasOwnProperty.call(containerHelper,"default")?containerHelper["default"]:containerHelper;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){function program1(depth0){var buffer="",stack1;return buffer+=" lang=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"",buffer}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,self=this,stack1,helper;return buffer+="<div class=\"qti-object-container\" data-serial=\"",(helper=helpers.serial)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.serial,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\"",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),{hash:{},inverse:self.noop,fn:self.program(1,program1,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+=" >\n</div>\n",buffer}),_Object={qtiClass:"object",template:function(data,options,asString){var html=Template(data,options);return asString||!0?html:$(html)},getContainer:containerHelper.get,render:function render(obj){var $container=containerHelper.get(obj),previewOptions={url:obj.renderer.resolveUrl(obj.attr("data")),mime:obj.attr("type")};obj.attr("height")&&(previewOptions.height=obj.attr("height")),obj.attr("width")&&(previewOptions.width=obj.attr("width")),previewOptions.url&&previewOptions.mime&&$container.previewer(previewOptions)}};return _Object}),define("qtiInfoControlContext",[],function(){window._picHooks=window._picHooks||{};return{register:function register(picHook){window._picHooks[picHook.getTypeIdentifier()]=picHook},notifyReady:function notifyReady(){},createPciInstance:function createPciInstance(typeIdentifier){if(window._picHooks[typeIdentifier]){var instance={},proto=window._picHooks[typeIdentifier];for(var name in proto)instance[name]="function"==typeof proto[name]?proto[name]:null!==proto[name]&&"object"===_typeof(proto[name])?proto[name].constructor():proto[name];return instance}throw"no portable info control hook found with the id "+typeIdentifier}}}),define("taoQtiItem/qtiCommonRenderer/renderers/PortableInfoControl",["lodash","handlebars","i18n","lib/dompurify/purify","taoQtiItem/qtiCommonRenderer/helpers/container","taoQtiItem/qtiCommonRenderer/helpers/PortableElement","qtiInfoControlContext","taoQtiItem/qtiItem/helper/util","taoQtiItem/portableElementRegistry/icRegistry"],function(_,Handlebars,__,DOMPurify,containerHelper,PortableElement,qtiInfoControlContext,util,icRegistry){'use strict';_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,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,containerHelper=containerHelper&&Object.prototype.hasOwnProperty.call(containerHelper,"default")?containerHelper["default"]:containerHelper,PortableElement=PortableElement&&Object.prototype.hasOwnProperty.call(PortableElement,"default")?PortableElement["default"]:PortableElement,qtiInfoControlContext=qtiInfoControlContext&&Object.prototype.hasOwnProperty.call(qtiInfoControlContext,"default")?qtiInfoControlContext["default"]:qtiInfoControlContext,util=util&&Object.prototype.hasOwnProperty.call(util,"default")?util["default"]:util,icRegistry=icRegistry&&Object.prototype.hasOwnProperty.call(icRegistry,"default")?icRegistry["default"]:icRegistry;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){function program1(depth0){var buffer="",stack1;return buffer+=" "+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["class"]),"function"===_typeof(stack1)?stack1.apply(depth0):stack1)),buffer}function program3(depth0){var buffer="",stack1;return buffer+=" lang=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"",buffer}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,self=this,stack1,helper;return buffer+="<div class=\"qti-infoControl",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["class"]),{hash:{},inverse:self.noop,fn:self.program(1,program1,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\" data-serial=\"",(helper=helpers.serial)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.serial,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\"",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),{hash:{},inverse:self.noop,fn:self.program(3,program3,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+=">\n ",(helper=helpers.markup)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.markup,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n</div>",buffer}),_getPic=function(infoControl){var pic=infoControl.data("pic")||void 0,typeIdentifier;if(!pic)if(typeIdentifier=infoControl.typeIdentifier,pic=qtiInfoControlContext.createPciInstance(typeIdentifier),pic)infoControl.data("pic",pic),pic._taoInfoControl=infoControl;else throw"no custom infoControl hook found for the type "+typeIdentifier;return pic},PortableInfoControl={qtiClass:"infoControl",template:function(data,options,asString){var html=Template(data,options);return asString||!0?html:$(html)},getData:function getData(infoControl,data){var markup=data.markup;return markup=util.removeMarkupNamespaces(markup),markup=PortableElement.fixMarkupMediaSources(markup,this),data.markup=markup,data},render:function render(infoControl){var self=this;return new Promise(function(resolve,reject){var state={},id=infoControl.attr("id"),typeIdentifier=infoControl.typeIdentifier,config=infoControl.properties,$dom=containerHelper.get(infoControl).children(),assetManager=self.getAssetManager();icRegistry.loadRuntimes().then(function(){var requireEntries=[],runtime=icRegistry.getRuntime(typeIdentifier);return runtime?void(runtime.hook&&requireEntries.push(runtime.hook.replace(/\.js$/,"")),_.forEach(runtime.libraries,function(module){requireEntries.push(module.replace(/\.js$/,""))}),_.forEach(runtime.stylesheets,function(stylesheet){requireEntries.push("css!"+stylesheet.replace(/\.css$/,""))}),window.require(requireEntries,function(){var pic=_getPic(infoControl);return pic?(pic.initialize(id,$dom[0],config,{resolve:function(url){var resolved=assetManager.resolveBy("portableElementLocation",url);return resolved===url?assetManager.resolveBy("baseUrl",url):resolved}}),pic.setSerializedState(state),resolve()):reject("Unable to initialize pic : "+id)},reject)):reject("The runtime for the pic cannot be found : "+typeIdentifier)}).catch(function(){reject("Error loading runtime : "+id)})})},getContainer:containerHelper.get,destroy:function(infoControl){_getPic(infoControl).destroy()},getState:function(infoControl){return _getPic(infoControl).getSerializedState()},setState:function(infoControl,state){_getPic(infoControl).setSerializedState(state)}};return PortableInfoControl}),define("taoQtiItem/qtiCommonRenderer/renderers/PrintedVariable",["handlebars","i18n","lodash","lib/dompurify/purify","taoQtiItem/qtiCommonRenderer/helpers/container"],function(Handlebars,__,_,DOMPurify,containerHelper){'use strict';Handlebars=Handlebars&&Object.prototype.hasOwnProperty.call(Handlebars,"default")?Handlebars["default"]:Handlebars,__=__&&Object.prototype.hasOwnProperty.call(__,"default")?__["default"]:__,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,DOMPurify=DOMPurify&&Object.prototype.hasOwnProperty.call(DOMPurify,"default")?DOMPurify["default"]:DOMPurify,containerHelper=containerHelper&&Object.prototype.hasOwnProperty.call(containerHelper,"default")?containerHelper["default"]:containerHelper;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){function program1(depth0){var buffer="",stack1;return buffer+=" lang=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"",buffer}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,self=this,stack1,helper;return buffer+="<span data-serial=\"",(helper=helpers.serial)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.serial,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\" data-qti-class=\"printedVariable\"",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),{hash:{},inverse:self.noop,fn:self.program(1,program1,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+=">\n ",(helper=helpers.value)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.value,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\n</span>",buffer}),PrintedVariable={qtiClass:"printedVariable",template:function(data,options,asString){var html=Template(data,options);return asString||!0?html:$(html)},getContainer:containerHelper.get};return PrintedVariable}),define("taoQtiItem/qtiItem/helper/interactionHelper",["lodash","taoQtiItem/qtiItem/core/Element"],function(_,Element){'use strict';var _Mathfloor2=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+_Mathfloor2(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 ret="",qtiClass=qtiSubclass||element.qtiClass,renderer=_getClassRenderer(qtiClass),decorators=this.getOption("decorators"),res;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 choices=[],serial,i;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/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/qtiCommonRenderer/renderers/rendererProvider",["taoQtiItem/qtiCommonRenderer/renderers/Renderer"],function(QtiRenderer){'use strict';QtiRenderer=QtiRenderer&&Object.prototype.hasOwnProperty.call(QtiRenderer,"default")?QtiRenderer["default"]:QtiRenderer;return{name:"commonRenderer",init:function init(){},getRenderer:function getRenderer(){return QtiRenderer}}}),define("taoQtiItem/qtiCommonRenderer/renderers/RubricBlock",["handlebars","i18n","lodash","lib/dompurify/purify","taoQtiItem/qtiCommonRenderer/helpers/container"],function(Handlebars,__,_,DOMPurify,containerHelper){'use strict';Handlebars=Handlebars&&Object.prototype.hasOwnProperty.call(Handlebars,"default")?Handlebars["default"]:Handlebars,__=__&&Object.prototype.hasOwnProperty.call(__,"default")?__["default"]:__,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,DOMPurify=DOMPurify&&Object.prototype.hasOwnProperty.call(DOMPurify,"default")?DOMPurify["default"]:DOMPurify,containerHelper=containerHelper&&Object.prototype.hasOwnProperty.call(containerHelper,"default")?containerHelper["default"]:containerHelper;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){function program1(depth0,data){var buffer="",stack1,helper;return buffer+="\n<div class=\"grid-row qti-rubricBlock\" data-use=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.use),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\" data-serial=\"",(helper=helpers.serial)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.serial,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\" data-qti-class=\"rubricBlock\"",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),{hash:{},inverse:self.noop,fn:self.program(2,program2,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+=">\n <div class=\"col-12\">\n <div class=\"qti-rubricBlock-body\">",(helper=helpers.body)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.body,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),(stack1||0===stack1)&&(buffer+=stack1),buffer+="</div>\n </div>\n</div>\n",buffer}function program2(depth0){var buffer="",stack1;return buffer+=" lang=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"",buffer}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var escapeExpression=this.escapeExpression,self=this,stack1;return stack1=helpers.unless.call(depth0,depth0&&depth0.empty,{hash:{},inverse:self.noop,fn:self.program(1,program1,data),data:data}),stack1||0===stack1?stack1:""}),RubricBlock={qtiClass:"rubricBlock",getContainer:containerHelper.get,template:function(data,options,asString){var html=Template(data,options);return asString||!0?html:$(html)},getData:function(rubric,data){return rubric.isEmpty()&&(data.empty=!0),data}};return RubricBlock}),define("taoQtiItem/qtiCommonRenderer/renderers/Stylesheet",["handlebars","i18n","lodash","lib/dompurify/purify","taoQtiItem/qtiCommonRenderer/helpers/container"],function(Handlebars,__,_,DOMPurify,containerHelper){'use strict';Handlebars=Handlebars&&Object.prototype.hasOwnProperty.call(Handlebars,"default")?Handlebars["default"]:Handlebars,__=__&&Object.prototype.hasOwnProperty.call(__,"default")?__["default"]:__,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,DOMPurify=DOMPurify&&Object.prototype.hasOwnProperty.call(DOMPurify,"default")?DOMPurify["default"]:DOMPurify,containerHelper=containerHelper&&Object.prototype.hasOwnProperty.call(containerHelper,"default")?containerHelper["default"]:containerHelper;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){function program1(depth0){var buffer="",stack1;return buffer+="media=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.media),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"",buffer}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,self=this,stack1,helper;return buffer+="<link \n href=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.href),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\" \n type=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.type),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\" \n rel=\"stylesheet\" \n data-serial=\"",(helper=helpers.serial)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.serial,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\" \n ",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.media),{hash:{},inverse:self.noop,fn:self.program(1,program1,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n />",buffer}),Stylesheet={qtiClass:"stylesheet",template:function(data,options,asString){var html=Template(data,options);return asString||!0?html:$(html)},getContainer:containerHelper.get};return Stylesheet}),define("taoQtiItem/qtiCommonRenderer/renderers/Table",["handlebars","i18n","lodash","lib/dompurify/purify","taoQtiItem/qtiCommonRenderer/helpers/container"],function(Handlebars,__,_,DOMPurify,containerHelper){'use strict';Handlebars=Handlebars&&Object.prototype.hasOwnProperty.call(Handlebars,"default")?Handlebars["default"]:Handlebars,__=__&&Object.prototype.hasOwnProperty.call(__,"default")?__["default"]:__,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,DOMPurify=DOMPurify&&Object.prototype.hasOwnProperty.call(DOMPurify,"default")?DOMPurify["default"]:DOMPurify,containerHelper=containerHelper&&Object.prototype.hasOwnProperty.call(containerHelper,"default")?containerHelper["default"]:containerHelper;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){function program1(depth0){var buffer="",stack1;return buffer+=" "+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["class"]),"function"===_typeof(stack1)?stack1.apply(depth0):stack1)),buffer}function program3(depth0){var buffer="",stack1;return buffer+="summary=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.summary),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"",buffer}function program5(depth0){var buffer="",stack1;return buffer+=" lang=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"",buffer}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,self=this,stack1,helper;return buffer+="<table\n class=\"qti-table",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["class"]),{hash:{},inverse:self.noop,fn:self.program(1,program1,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\"\n data-qti-class=\"table\"\n data-serial=\"",(helper=helpers.serial)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.serial,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\"\n ",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.summary),{hash:{},inverse:self.noop,fn:self.program(3,program3,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n ",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),{hash:{},inverse:self.noop,fn:self.program(5,program5,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n >\n ",(helper=helpers.body)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.body,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n</table>\n",buffer}),Table={qtiClass:"table",getContainer:containerHelper.get,template:function(data,options,asString){var html=Template(data,options);return asString||!0?html:$(html)}};return Table}),define("taoQtiItem/qtiCommonRenderer/renderers/Tooltip",["handlebars","i18n","lodash","lib/dompurify/purify","taoQtiItem/qtiCommonRenderer/helpers/container","ui/tooltip"],function(Handlebars,__,_,DOMPurify,containerHelper,tooltip){'use strict';Handlebars=Handlebars&&Object.prototype.hasOwnProperty.call(Handlebars,"default")?Handlebars["default"]:Handlebars,__=__&&Object.prototype.hasOwnProperty.call(__,"default")?__["default"]:__,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,DOMPurify=DOMPurify&&Object.prototype.hasOwnProperty.call(DOMPurify,"default")?DOMPurify["default"]:DOMPurify,containerHelper=containerHelper&&Object.prototype.hasOwnProperty.call(containerHelper,"default")?containerHelper["default"]:containerHelper,tooltip=tooltip&&Object.prototype.hasOwnProperty.call(tooltip,"default")?tooltip["default"]:tooltip;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){function program1(depth0){var buffer="",stack1;return buffer+="lang=\""+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\"",buffer}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,self=this,stack1,helper;return buffer+="<span\n data-serial=\"",(helper=helpers.serial)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.serial,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\"\n data-qti-class=\"_tooltip\"\n data-role=\"tooltip-target\"\n ",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1["xml:lang"]),{hash:{},inverse:self.noop,fn:self.program(1,program1,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n>\n ",(helper=helpers.body)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.body,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n</span>\n",buffer}),Tooltip={qtiClass:"_tooltip",template:function(data,options,asString){var html=Template(data,options);return asString||!0?html:$(html)},getContainer:containerHelper.get,render:function(tooltipDOM){var $container=containerHelper.get(tooltipDOM),renderedTooltip=tooltip.create($container,tooltipDOM.content(),{theme:"default",placement:"top"});$container.data("$tooltip")&&($container.data("$tooltip").dispose(),$container.removeData("$tooltip")),$container.data("$tooltip",renderedTooltip)}};return Tooltip}),define("taoQtiItem/qtiItem/core/IdentifiedElement",["taoQtiItem/qtiItem/core/Element","taoQtiItem/qtiItem/helper/util"],function(Element,util){'use strict';Element=Element&&Object.prototype.hasOwnProperty.call(Element,"default")?Element["default"]:Element,util=util&&Object.prototype.hasOwnProperty.call(util,"default")?util["default"]:util;var IdentifiedElement=Element.extend({buildIdentifier:function(prefix,useSuffix){var item=this.getRootElement(),id=util.buildIdentifier(item,prefix||this.qtiClass,useSuffix);return id&&this.attr("identifier",id),this},id:function(value){return value||this.attr("identifier")||this.buildIdentifier(this.qtiClass,!0),this.attr("identifier",value)}});return IdentifiedElement}),define("taoQtiItem/qtiItem/core/choices/Choice",["taoQtiItem/qtiItem/core/IdentifiedElement"],function(IdentifiedElement){'use strict';IdentifiedElement=IdentifiedElement&&Object.prototype.hasOwnProperty.call(IdentifiedElement,"default")?IdentifiedElement["default"]:IdentifiedElement;var Choice=IdentifiedElement.extend({init:function init(serial,attributes){this._super(serial,attributes)},is:function is(qtiClass){return"choice"===qtiClass||this._super(qtiClass)},getInteraction:function getInteraction(){var ret=null,item=this.getRootElement(),found;return item&&(found=item.find(this.serial),found&&(ret=found.parent)),ret}});return Choice}),define("taoQtiItem/qtiItem/core/choices/Hotspot",["taoQtiItem/qtiItem/core/choices/Choice"],function(QtiChoice){'use strict';QtiChoice=QtiChoice&&Object.prototype.hasOwnProperty.call(QtiChoice,"default")?QtiChoice["default"]:QtiChoice;var QtiHotspot=QtiChoice.extend({});return QtiHotspot}),define("taoQtiItem/qtiItem/core/choices/AssociableHotspot",["taoQtiItem/qtiItem/core/choices/Hotspot"],function(QtiHotspot){'use strict';QtiHotspot=QtiHotspot&&Object.prototype.hasOwnProperty.call(QtiHotspot,"default")?QtiHotspot["default"]:QtiHotspot;var QtiAssociableHotspot=QtiHotspot.extend({qtiClass:"associableHotspot"});return QtiAssociableHotspot}),define("taoQtiItem/qtiItem/mixin/Mixin",[],function(){'use strict';return{augment:function augment(targetClass,methods,options){if("function"==typeof targetClass&&"object"===_typeof(methods))for(var methodName in methods)if(!Object.hasOwnProperty(targetClass.prototype,methodName))targetClass.prototype[methodName]=methods[methodName];else if(options&&options.append){var _parent=targetClass.prototype[methodName];targetClass.prototype[methodName]=function(){return methods[methodName].apply(this,arguments),_parent.apply(this,arguments)}}}}}),define("taoQtiItem/qtiItem/core/Container",["jquery","lodash","taoQtiItem/qtiItem/core/Element","taoQtiItem/qtiItem/helper/rendererConfig"],function($,_,Element,rendererConfig){'use strict';$=$&&Object.prototype.hasOwnProperty.call($,"default")?$["default"]:$,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,Element=Element&&Object.prototype.hasOwnProperty.call(Element,"default")?Element["default"]:Element,rendererConfig=rendererConfig&&Object.prototype.hasOwnProperty.call(rendererConfig,"default")?rendererConfig["default"]:rendererConfig;var Container=Element.extend({qtiClass:"_container",init:function init(body){if(this._super(),body&&"string"!=typeof body)throw"the body of a container must be a string";this.bdy=body||"",this.elements={}},body:function body(_body){if("undefined"==typeof _body)return this.bdy;if("string"==typeof _body)this.bdy=_body,$(document).trigger("containerBodyChange",{body:_body,container:this,parent:this.parent()});else throw"body must be a string"},setElements:function setElements(elements,body){var returnValue=!1;for(var i in elements){var elt=elements[i];if(elt instanceof Element)body=body||this.bdy,-1===body.indexOf(elt.placeholder())&&(body+=elt.placeholder()),elt.setRootElement(this.getRootElement()||null),this.elements[elt.getSerial()]=elt,$(document).trigger("containerElementAdded",{element:elt,container:this}),returnValue=!0;else throw returnValue=!1,"expected a qti element"}return this.body(body),returnValue},setElement:function setElement(element,body){return this.setElements([element],body)},removeElement:function removeElement(element){var serial="";return"string"==typeof element?serial=element:element instanceof Element&&(serial=element.getSerial()),delete this.elements[serial],this.body(this.body().replace("{{"+serial+"}}","")),this},getElements:function getElements(qtiClass){var elts={};if("string"==typeof qtiClass)for(var serial in this.elements)Element.isA(this.elements[serial],qtiClass)&&(elts[serial]=this.elements[serial]);else elts=_.clone(this.elements);return elts},getElement:function getElement(serial){return this.elements[serial]?this.elements[serial]:null},getComposingElements:function getComposingElements(){var elements=this.getElements(),elts={};for(var serial in elements)elts[serial]=elements[serial],elts=_.extend(elts,elements[serial].getComposingElements());return elts},render:function render(){var args=rendererConfig.getOptionsFromArguments(arguments),renderer=args.renderer||this.getRenderer(),elementsData=[],tpl=this.body();for(var serial in this.elements){var elt=this.elements[serial];if("function"==typeof elt.render)"_container"===elt.qtiClass?tpl=tpl.replace(elt.placeholder(),elt.render(renderer)):(tpl=tpl.replace(elt.placeholder(),"{{{"+serial+"}}}"),elementsData[serial]=elt.render(renderer));else throw"render() is not defined for the qti element: "+serial}if(renderer.isRenderer)return this._super({body:renderer.renderDirect(tpl,elementsData),contentModel:this.contentModel||"flow"},renderer,args.placeholder);throw"invalid qti renderer for qti container"},postRender:function postRender(data,altClassName,renderer){renderer=renderer||this.getRenderer();var res=_(this.elements).filter(function(elt){return"function"==typeof elt.postRender}).map(function(elt){return elt.postRender(data,"",renderer)}).flatten(!0).value().concat(this._super(data,altClassName,renderer));return res},toArray:function toArray(){var arr={serial:this.serial,body:this.bdy,elements:{}};for(var serial in this.elements)arr.elements[serial]=this.elements[serial].toArray();return arr},find:function find(serial,parent){var found=null;return this.elements[serial]?found={parent:parent||this,element:this.elements[serial],location:"body"}:_.each(this.elements,function(elt){if(found=elt.find(serial),found)return!1}),found},isEmpty:function isEmpty(){return!this.bdy}});return Container}),define("taoQtiItem/qtiItem/mixin/Container",["taoQtiItem/qtiItem/mixin/Mixin","taoQtiItem/qtiItem/core/Container"],function(Mixin,Container$1){'use strict';Mixin=Mixin&&Object.prototype.hasOwnProperty.call(Mixin,"default")?Mixin["default"]:Mixin,Container$1=Container$1&&Object.prototype.hasOwnProperty.call(Container$1,"default")?Container$1["default"]:Container$1;var methods={initContainer:function initContainer(body){this.bdy=new Container$1(body||""),this.bdy.setRootElement(this.getRootElement()||null),this.bdy.contentModel="blockStatic"},getBody:function getBody(){return this.bdy},body:function body(_body2){var ret=this.bdy.body(_body2);return _body2?this:ret},setElement:function setElement(element,body){return this.bdy.setElement(element,body),this},removeElement:function removeElement(element){return this.bdy.removeElement(element)},getElements:function getElements(qtiClass){return this.bdy.getElements(qtiClass)},getElement:function getElement(serial){return this.bdy.getElement(serial)}};return{augment:function augment(targetClass){Mixin.augment(targetClass,methods)},methods:methods}}),define("taoQtiItem/qtiItem/core/choices/ContainerChoice",["taoQtiItem/qtiItem/core/choices/Choice","taoQtiItem/qtiItem/mixin/Container"],function(Choice,Container){'use strict';Choice=Choice&&Object.prototype.hasOwnProperty.call(Choice,"default")?Choice["default"]:Choice,Container=Container&&Object.prototype.hasOwnProperty.call(Container,"default")?Container["default"]:Container;var ContainerChoice=Choice.extend({init:function init(serial,attributes){this._super(serial,attributes)},is:function is(qtiClass){return"containerChoice"===qtiClass||this._super(qtiClass)}});return Container.augment(ContainerChoice),ContainerChoice}),define("taoQtiItem/qtiItem/core/choices/Gap",["taoQtiItem/qtiItem/core/choices/Choice"],function(QtiChoice){'use strict';QtiChoice=QtiChoice&&Object.prototype.hasOwnProperty.call(QtiChoice,"default")?QtiChoice["default"]:QtiChoice;var QtiGap=QtiChoice.extend({qtiClass:"gap"});return QtiGap}),define("taoQtiItem/qtiItem/core/Object",["taoQtiItem/qtiItem/core/Element","lodash","taoQtiItem/qtiItem/helper/rendererConfig"],function(Element,_,rendererConfig){'use strict';Element=Element&&Object.prototype.hasOwnProperty.call(Element,"default")?Element["default"]:Element,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,rendererConfig=rendererConfig&&Object.prototype.hasOwnProperty.call(rendererConfig,"default")?rendererConfig["default"]:rendererConfig;var QtiObject=Element.extend({qtiClass:"object",getMediaType:function getMediaType(){var type="undefined",mimetype=this.attr("type");return mimetype&&(0===mimetype.indexOf("video")?type="video":0===mimetype.indexOf("audio")?type="audio":0===mimetype.indexOf("image")?type="image":0===mimetype.indexOf("text/html")?type="html":type="object"),type},render:function render(){var args=rendererConfig.getOptionsFromArguments(arguments),renderer=args.renderer||this.getRenderer(),defaultData={};switch(this.getMediaType()){case"video":defaultData.video=!0;break;case"audio":defaultData.audio=!0;break;case"html":defaultData.html=!0;break;case"image":default:defaultData.object=!0;}return defaultData.attributes={data:renderer.resolveUrl(this.attr("data"))},defaultData.body=this._alt,this._super(_.merge(defaultData,args.data),args.placeholder,args.subclass,renderer)},isEmpty:function isEmpty(){return!this.attr("data")}});return QtiObject}),define("taoQtiItem/qtiItem/core/choices/GapImg",["taoQtiItem/qtiItem/core/choices/Choice","taoQtiItem/qtiItem/core/Object"],function(QtiChoice,QtiObject){'use strict';QtiChoice=QtiChoice&&Object.prototype.hasOwnProperty.call(QtiChoice,"default")?QtiChoice["default"]:QtiChoice,QtiObject=QtiObject&&Object.prototype.hasOwnProperty.call(QtiObject,"default")?QtiObject["default"]:QtiObject;var QtiGapImg=QtiChoice.extend({qtiClass:"gapImg",initObject:function initObject(object){this.object=object||new QtiObject},getObject:function getObject(){return this.object}});return QtiGapImg}),define("taoQtiItem/qtiItem/core/choices/GapText",["taoQtiItem/qtiItem/core/choices/ContainerChoice"],function(QtiContainerChoice){'use strict';QtiContainerChoice=QtiContainerChoice&&Object.prototype.hasOwnProperty.call(QtiContainerChoice,"default")?QtiContainerChoice["default"]:QtiContainerChoice;var QtiGapText=QtiContainerChoice.extend({qtiClass:"gapText"});return QtiGapText}),define("taoQtiItem/qtiItem/core/choices/HotspotChoice",["taoQtiItem/qtiItem/core/choices/Hotspot"],function(QtiHotspot){'use strict';QtiHotspot=QtiHotspot&&Object.prototype.hasOwnProperty.call(QtiHotspot,"default")?QtiHotspot["default"]:QtiHotspot;var QtiHotspotChoice=QtiHotspot.extend({qtiClass:"hotspotChoice"});return QtiHotspotChoice}),define("taoQtiItem/qtiItem/mixin/ContainerInline",["taoQtiItem/qtiItem/mixin/Mixin","taoQtiItem/qtiItem/mixin/Container","lodash"],function(Mixin,Container,_){'use strict';Mixin=Mixin&&Object.prototype.hasOwnProperty.call(Mixin,"default")?Mixin["default"]:Mixin,Container=Container&&Object.prototype.hasOwnProperty.call(Container,"default")?Container["default"]:Container,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_;var methods={};_.extend(methods,Container.methods),_.extend(methods,{initContainer:function initContainer(body){Container.methods.initContainer.call(this,body),this.bdy.contentModel="inlineStatic"}});return{augment:function augment(targetClass){Mixin.augment(targetClass,methods)},methods:methods}}),define("taoQtiItem/qtiItem/core/choices/Hottext",["taoQtiItem/qtiItem/core/choices/Choice","taoQtiItem/qtiItem/mixin/ContainerInline"],function(Choice,Container){'use strict';Choice=Choice&&Object.prototype.hasOwnProperty.call(Choice,"default")?Choice["default"]:Choice,Container=Container&&Object.prototype.hasOwnProperty.call(Container,"default")?Container["default"]:Container;var Hottext=Choice.extend({qtiClass:"hottext"});return Container.augment(Hottext),Hottext}),define("taoQtiItem/qtiItem/core/choices/TextVariableChoice",["jquery","lodash","taoQtiItem/qtiItem/core/choices/Choice","taoQtiItem/qtiItem/helper/rendererConfig"],function($,_,QtiChoice,rendererConfig){'use strict';$=$&&Object.prototype.hasOwnProperty.call($,"default")?$["default"]:$,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,QtiChoice=QtiChoice&&Object.prototype.hasOwnProperty.call(QtiChoice,"default")?QtiChoice["default"]:QtiChoice,rendererConfig=rendererConfig&&Object.prototype.hasOwnProperty.call(rendererConfig,"default")?rendererConfig["default"]:rendererConfig;var QtiTextVariableChoice=QtiChoice.extend({init:function init(serial,attributes,text){this._super(serial,attributes),this.val(text||"")},is:function is(qtiClass){return"textVariableChoice"===qtiClass||this._super(qtiClass)},val:function val(text){if("undefined"==typeof text)return this.text;if("string"==typeof text)this.text=text,$(document).trigger("choiceTextChange",{choice:this,text:text});else throw"text must be a string";return this},render:function render(){var args=rendererConfig.getOptionsFromArguments(arguments),renderer=args.renderer||this.getRenderer(),defaultData={body:this.text};return this._super(_.merge(defaultData,args.data),args.placeholder,args.subclass,renderer)}});return QtiTextVariableChoice}),define("taoQtiItem/qtiItem/core/choices/InlineChoice",["taoQtiItem/qtiItem/core/choices/TextVariableChoice"],function(QtiTextVariableChoice){'use strict';QtiTextVariableChoice=QtiTextVariableChoice&&Object.prototype.hasOwnProperty.call(QtiTextVariableChoice,"default")?QtiTextVariableChoice["default"]:QtiTextVariableChoice;var QtiInlineChoice=QtiTextVariableChoice.extend({qtiClass:"inlineChoice"});return QtiInlineChoice}),define("taoQtiItem/qtiItem/core/choices/SimpleAssociableChoice",["taoQtiItem/qtiItem/core/choices/ContainerChoice"],function(QtiContainerChoice){'use strict';QtiContainerChoice=QtiContainerChoice&&Object.prototype.hasOwnProperty.call(QtiContainerChoice,"default")?QtiContainerChoice["default"]:QtiContainerChoice;var QtiSimpleAssociableChoice=QtiContainerChoice.extend({qtiClass:"simpleAssociableChoice"});return QtiSimpleAssociableChoice}),define("taoQtiItem/qtiItem/core/choices/SimpleChoice",["taoQtiItem/qtiItem/core/choices/ContainerChoice"],function(QtiContainerChoice){'use strict';QtiContainerChoice=QtiContainerChoice&&Object.prototype.hasOwnProperty.call(QtiContainerChoice,"default")?QtiContainerChoice["default"]:QtiContainerChoice;var QtiSimpleChoice=QtiContainerChoice.extend({qtiClass:"simpleChoice"});return QtiSimpleChoice}),define("taoQtiItem/qtiItem/core/choices/TextEntry",["taoQtiItem/qtiItem/core/choices/TextVariableChoice"],function(QtiTextVariableChoice){'use strict';QtiTextVariableChoice=QtiTextVariableChoice&&Object.prototype.hasOwnProperty.call(QtiTextVariableChoice,"default")?QtiTextVariableChoice["default"]:QtiTextVariableChoice;var QtiTextEntry=QtiTextVariableChoice.extend({qtiClass:"textEntry"});return QtiTextEntry}),define("taoQtiItem/qtiItem/core/feedbacks/Feedback",["taoQtiItem/qtiItem/core/IdentifiedElement"],function(IdentifiedElement){'use strict';IdentifiedElement=IdentifiedElement&&Object.prototype.hasOwnProperty.call(IdentifiedElement,"default")?IdentifiedElement["default"]:IdentifiedElement;var Feedback=IdentifiedElement.extend({is:function is(qtiClass){return"feedback"===qtiClass||this._super(qtiClass)}});return Feedback}),define("taoQtiItem/qtiItem/core/feedbacks/FeedbackBlock",["taoQtiItem/qtiItem/core/feedbacks/Feedback"],function(Feedback){'use strict';Feedback=Feedback&&Object.prototype.hasOwnProperty.call(Feedback,"default")?Feedback["default"]:Feedback;var FeedbackBlock=Feedback.extend({});return FeedbackBlock}),define("taoQtiItem/qtiItem/core/feedbacks/FeedbackInline",["taoQtiItem/qtiItem/core/feedbacks/Feedback"],function(Feedback){'use strict';Feedback=Feedback&&Object.prototype.hasOwnProperty.call(Feedback,"default")?Feedback["default"]:Feedback;var FeedbackInline=Feedback.extend({});return FeedbackInline}),define("taoQtiItem/qtiItem/core/feedbacks/ModalFeedback",["taoQtiItem/qtiItem/core/IdentifiedElement","taoQtiItem/qtiItem/mixin/Container"],function(IdentifiedElement,Container){'use strict';IdentifiedElement=IdentifiedElement&&Object.prototype.hasOwnProperty.call(IdentifiedElement,"default")?IdentifiedElement["default"]:IdentifiedElement,Container=Container&&Object.prototype.hasOwnProperty.call(Container,"default")?Container["default"]:Container;var ModalFeedback=IdentifiedElement.extend({qtiClass:"modalFeedback",is:function is(qtiClass){return"feedback"===qtiClass||this._super(qtiClass)}});return Container.augment(ModalFeedback),ModalFeedback}),define("taoQtiItem/qtiItem/core/Img",["taoQtiItem/qtiItem/core/Element","lodash","taoQtiItem/qtiItem/helper/rendererConfig"],function(Element,_,rendererConfig){'use strict';Element=Element&&Object.prototype.hasOwnProperty.call(Element,"default")?Element["default"]:Element,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,rendererConfig=rendererConfig&&Object.prototype.hasOwnProperty.call(rendererConfig,"default")?rendererConfig["default"]:rendererConfig;var Img=Element.extend({qtiClass:"img",render:function render(){var args=rendererConfig.getOptionsFromArguments(arguments),renderer=args.renderer||this.getRenderer(),defaultData={};return defaultData.attributes={src:renderer.resolveUrl(this.attr("src"))},this._super(_.merge(defaultData,args.data),args.placeholder,args.subclass,renderer)},isEmpty:function isEmpty(){return!this.attr("src")}});return Img}),define("taoQtiItem/qtiItem/mixin/NamespacedElement",["taoQtiItem/qtiItem/mixin/Mixin","lodash"],function(Mixin,_){'use strict';Mixin=Mixin&&Object.prototype.hasOwnProperty.call(Mixin,"default")?Mixin["default"]:Mixin,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_;var methods={getNamespace:function getNamespace(){var relatedItem,namespaces,ns;if(this.ns&&(this.ns.name||this.ns.uri))return _.clone(this.ns);if(relatedItem=this.getRootElement(),relatedItem){for(ns in namespaces=relatedItem.getNamespaces(),namespaces)if(0<namespaces[ns].indexOf(this.nsUriFragment))return{name:ns,uri:namespaces[ns]};return relatedItem.namespaces[this.defaultNsName]=this.defaultNsUri,{name:this.defaultNsName,uri:this.defaultNsUri}}return{}},setNamespace:function setNamespace(name,uri){this.ns={name:name,uri:uri}}};return{augment:function augment(targetClass){Mixin.augment(targetClass,methods)},methods:methods}}),define("taoQtiItem/qtiItem/core/Include",["taoQtiItem/qtiItem/core/Element","taoQtiItem/qtiItem/mixin/ContainerInline","taoQtiItem/qtiItem/mixin/NamespacedElement"],function(Element,Container,NamespacedElement){'use strict';Element=Element&&Object.prototype.hasOwnProperty.call(Element,"default")?Element["default"]:Element,Container=Container&&Object.prototype.hasOwnProperty.call(Container,"default")?Container["default"]:Container,NamespacedElement=NamespacedElement&&Object.prototype.hasOwnProperty.call(NamespacedElement,"default")?NamespacedElement["default"]:NamespacedElement;var Include=Element.extend({qtiClass:"include",defaultNsName:"xi",defaultNsUri:"http://www.w3.org/2001/XInclude",nsUriFragment:"XInclude",isEmpty:function isEmpty(){return!this.attr("href")||this.getBody().isEmpty()}});return Container.augment(Include),NamespacedElement.augment(Include),Include}),define("taoQtiItem/qtiItem/core/interactions/Interaction",["taoQtiItem/qtiItem/core/Element","lodash","taoQtiItem/qtiItem/helper/rendererConfig","taoQtiItem/qtiItem/helper/util"],function(Element,_,rendererConfig,util){'use strict';Element=Element&&Object.prototype.hasOwnProperty.call(Element,"default")?Element["default"]:Element,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,rendererConfig=rendererConfig&&Object.prototype.hasOwnProperty.call(rendererConfig,"default")?rendererConfig["default"]:rendererConfig,util=util&&Object.prototype.hasOwnProperty.call(util,"default")?util["default"]:util;var QtiInteraction=Element.extend({init:function init(serial,attributes){this._super(serial,attributes),this.choices={}},is:function is(qtiClass){return"interaction"===qtiClass||this._super(qtiClass)},addChoice:function addChoice(choice){return choice.setRootElement(this.getRootElement()||null),this.choices[choice.getSerial()]=choice,this},getChoices:function getChoices(){var choices={};for(var i in this.choices)choices[i]=this.choices[i];return choices},getChoice:function getChoice(serial){var ret=null;return this.choices[serial]&&(ret=this.choices[serial]),ret},getChoiceByIdentifier:function getChoiceByIdentifier(identifier){for(var i in this.choices)if(this.choices[i].id()===identifier)return this.choices[i];return null},getComposingElements:function getComposingElements(){var elts=this._super();for(var serial in this.choices)Element.isA(this.choices[serial],"choice")&&(elts[serial]=this.choices[serial],elts=_.extend(elts,this.choices[serial].getComposingElements()));return elts},find:function find(serial){var found=this._super(serial);return found||(found=util.findInCollection(this,"choices",serial)),found},getResponseDeclaration:function getResponseDeclaration(){var response=null,responseId=this.attr("responseIdentifier");if(responseId){var item=this.getRootElement();if(item)response=item.getResponseDeclaration(responseId);else throw"cannot get response of an interaction out of its item context"}return response},render:function render(){var args=rendererConfig.getOptionsFromArguments(arguments),renderer=args.renderer||this.getRenderer(),defaultData={_type:this.qtiClass.replace(/([A-Z])/g,function($1){return"_"+$1.toLowerCase()}),choices:[],choiceShuffle:!0};if(!renderer)throw"no renderer found for the interaction "+this.qtiClass;var choices=this.attr("shuffle")&&renderer.getOption("shuffleChoices")?renderer.getShuffledChoices(this):this.getChoices(),interactionData={interaction:{serial:this.serial,attributes:this.attributes}},_this=this;_.each(choices,function(choice){if(Element.isA(choice,"choice"))try{var renderedChoice=choice.render(_.clone(interactionData,!0),null,choice.qtiClass+"."+_this.qtiClass,renderer);defaultData.choices.push(renderedChoice)}catch(e){}});var tplName=args.subclass?this.qtiClass+"."+args.subclass:this.qtiClass;return this._super(_.merge(defaultData,args.data),args.placeholder,tplName,renderer)},postRender:function postRender(data,altClassName,renderer){var self=this;return renderer=renderer||this.getRenderer(),_(this.getChoices()).filter(function(elt){return Element.isA(elt,"choice")}).map(function(choice){return choice.postRender({},choice.qtiClass+"."+self.qtiClass,renderer)}).value().concat(this._super(data,altClassName,renderer))},setResponse:function setResponse(values){var ret=null,renderer=this.getRenderer();if(renderer)ret=renderer.setResponse(this,values);else throw"no renderer found for the interaction "+this.qtiClass;return ret},getResponse:function getResponse(){var ret=null,renderer=this.getRenderer();if(renderer)ret=renderer.getResponse(this);else throw"no renderer found for the interaction "+this.qtiClass;return ret},resetResponse:function resetResponse(){var ret=null,renderer=this.getRenderer();if(renderer)ret=renderer.resetResponse(this);else throw"no renderer found for the interaction "+this.qtiClass;return ret},getState:function getState(){var ret=null,renderer=this.getRenderer();if(renderer)_.isFunction(renderer.getState)&&(ret=renderer.getState(this));else throw"no renderer found for the interaction "+this.qtiClass;return ret},setState:function setState(state){var renderer=this.getRenderer();if(renderer)_.isFunction(renderer.setState)&&renderer.setState(this,state);else throw"no renderer found for the interaction "+this.qtiClass},clear:function clear(){var renderer=this.getRenderer();if(renderer&&_.isFunction(renderer.destroy))return renderer.destroy(this)},toArray:function toArray(){var arr=this._super();for(var serial in arr.choices={},this.choices)Element.isA(this.choices[serial],"choice")&&(arr.choices[serial]=this.choices[serial].toArray());return arr},getNormalMaximum:function(){return!1}});return QtiInteraction}),define("taoQtiItem/qtiItem/core/interactions/Prompt",["taoQtiItem/qtiItem/core/Element","taoQtiItem/qtiItem/mixin/ContainerInline"],function(Element,Container){'use strict';Element=Element&&Object.prototype.hasOwnProperty.call(Element,"default")?Element["default"]:Element,Container=Container&&Object.prototype.hasOwnProperty.call(Container,"default")?Container["default"]:Container;var Prompt=Element.extend({qtiClass:"prompt"});return Container.augment(Prompt),Prompt}),define("taoQtiItem/qtiItem/core/interactions/BlockInteraction",["taoQtiItem/qtiItem/core/interactions/Interaction","taoQtiItem/qtiItem/core/interactions/Prompt","lodash","taoQtiItem/qtiItem/helper/rendererConfig"],function(Interaction,Prompt,_,rendererConfig){'use strict';Interaction=Interaction&&Object.prototype.hasOwnProperty.call(Interaction,"default")?Interaction["default"]:Interaction,Prompt=Prompt&&Object.prototype.hasOwnProperty.call(Prompt,"default")?Prompt["default"]:Prompt,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,rendererConfig=rendererConfig&&Object.prototype.hasOwnProperty.call(rendererConfig,"default")?rendererConfig["default"]:rendererConfig;var BlockInteraction=Interaction.extend({init:function init(serial,attributes){this._super(serial,attributes),this.prompt=new Prompt("")},is:function is(qtiClass){return"blockInteraction"===qtiClass||this._super(qtiClass)},getComposingElements:function getComposingElements(){var elts=this._super();return elts=_.extend(elts,this.prompt.getComposingElements()),elts[this.prompt.getSerial()]=this.prompt,elts},find:function find(serial){return this._super(serial)||this.prompt.find(serial)},render:function render(){var args=rendererConfig.getOptionsFromArguments(arguments),renderer=args.renderer||this.getRenderer(),defaultData={promptId:"prompt-".concat(this.prompt.getSerial()),prompt:this.prompt.render(renderer)};return this._super(_.merge(defaultData,args.data),args.placeholder,args.subclass,renderer)},postRender:function postRender(data,altClassName,renderer){return renderer=renderer||this.getRenderer(),[].concat(this.prompt.postRender({},"",renderer)).concat(this._super(data,altClassName,renderer))},toArray:function toArray(){var arr=this._super();return arr.prompt=this.prompt.toArray(),arr}});return BlockInteraction}),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/core/variables/VariableDeclaration",["taoQtiItem/qtiItem/core/IdentifiedElement"],function(IdentifiedElement){'use strict';IdentifiedElement=IdentifiedElement&&Object.prototype.hasOwnProperty.call(IdentifiedElement,"default")?IdentifiedElement["default"]:IdentifiedElement;var VariableDeclaration=IdentifiedElement.extend({init:function(serial,attributes){this._super(serial,attributes),this.defaultValue=null},is:function(qtiClass){return"variableDeclaration"===qtiClass||this._super(qtiClass)},toArray:function(){var arr=this._super();return arr.defaultValue=this.defaultValue,arr},setDefaultValue:function(value){this.defaultValue=value},getDefaultValue:function(){return this.defaultValue}});return VariableDeclaration}),define("taoQtiItem/qtiItem/core/variables/OutcomeDeclaration",["taoQtiItem/qtiItem/core/variables/VariableDeclaration"],function(VariableDeclaration){'use strict';VariableDeclaration=VariableDeclaration&&Object.prototype.hasOwnProperty.call(VariableDeclaration,"default")?VariableDeclaration["default"]:VariableDeclaration;var OutcomeDeclaration=VariableDeclaration.extend({qtiClass:"outcomeDeclaration"});return OutcomeDeclaration}),define("taoQtiItem/qtiItem/helper/maxScore",["lodash","lib/gamp/gamp","taoQtiItem/qtiItem/helper/response","taoQtiItem/qtiItem/core/variables/OutcomeDeclaration"],function(_,gamp,responseHelper,OutcomeDeclaration){'use strict';var _Mathmin2=Math.min;_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,gamp=gamp&&Object.prototype.hasOwnProperty.call(gamp,"default")?gamp["default"]:gamp,responseHelper=responseHelper&&Object.prototype.hasOwnProperty.call(responseHelper,"default")?responseHelper["default"]:responseHelper,OutcomeDeclaration=OutcomeDeclaration&&Object.prototype.hasOwnProperty.call(OutcomeDeclaration,"default")?OutcomeDeclaration["default"]:OutcomeDeclaration;var pairExists=function(collection,pair){return!(2!==pair.length)&&(collection[pair[0]+" "+pair[1]]||collection[pair[1]+" "+pair[0]])};return{setNormalMaximum:function(item){var scoreOutcome=item.getOutcomeDeclaration("SCORE"),normalMaximum;scoreOutcome&&item.responseProcessing&&"templateDriven"===item.responseProcessing.processingType&&(normalMaximum=_.reduce(item.getInteractions(),function(acc,interaction){var interactionMaxScore=interaction.getNormalMaximum();return!!_.isNumber(interactionMaxScore)&&gamp.add(acc,interactionMaxScore)},0),_.isNumber(normalMaximum)?scoreOutcome.attr("normalMaximum",normalMaximum):scoreOutcome.removeAttr("normalMaximum"))},setMaxScore:function(item){var hasInvalidInteraction=!1,scoreOutcome=item.getOutcomeDeclaration("SCORE"),customOutcomes,maxScore,maxScoreOutcome;scoreOutcome&&item.responseProcessing&&"templateDriven"===item.responseProcessing.processingType&&(maxScore=_.reduce(item.getInteractions(),function(acc,interaction){var interactionMaxScore=interaction.getNormalMaximum();return _.isNumber(interactionMaxScore)?gamp.add(acc,interactionMaxScore):(hasInvalidInteraction=!0,acc)},0),customOutcomes=_(item.getOutcomes()).filter(function(outcome){return"SCORE"!==outcome.id()&&"MAXSCORE"!==outcome.id()}),customOutcomes.size()&&(maxScore=customOutcomes.reduce(function(acc,outcome){return gamp.add(acc,parseFloat(outcome.attr("normalMaximum")||0))},maxScore)),!hasInvalidInteraction||customOutcomes.size()?(maxScoreOutcome=item.getOutcomeDeclaration("MAXSCORE"),!maxScoreOutcome&&(maxScoreOutcome=new OutcomeDeclaration({cardinality:"single",baseType:"float"}),item.addOutcomeDeclaration(maxScoreOutcome),maxScoreOutcome.buildIdentifier("MAXSCORE",!1)),maxScoreOutcome.setDefaultValue(maxScore)):item.removeOutcome("MAXSCORE"))},getMatchMaxOrderedChoices:function(choiceCollection){return _(choiceCollection).map(function(choice){var matchMax=parseInt(choice.attr("matchMax"),10);return _.isNaN(matchMax)&&(matchMax=0),{matchMax:0===matchMax?1/0:matchMax,id:choice.id()}}).sortBy("matchMax").reverse().valueOf()},choiceInteractionBased:function(interaction,options){var responseDeclaration=interaction.getResponseDeclaration(),mapDefault=parseFloat(responseDeclaration.mappingAttributes.defaultValue||0),template=responseHelper.getTemplateNameFromUri(responseDeclaration.template),max,maxChoice,minChoice,scoreMaps,requiredChoiceCount,totalAnswerableResponse,sortedMapEntries,missingMapsCount;if(options=_.defaults(options||{},{maxChoices:0,minChoices:0}),maxChoice=parseInt(interaction.attr("maxChoices")||options.maxChoices,10),minChoice=0,maxChoice&&minChoice&&maxChoice<minChoice)return 0;if("MATCH_CORRECT"===template)max=maxChoice&&_.isArray(responseDeclaration.correctResponse)&&(responseDeclaration.correctResponse.length>maxChoice||responseDeclaration.correctResponse.length<minChoice)?0:responseDeclaration.correctResponse&&(!_.isArray(responseDeclaration.correctResponse)||responseDeclaration.correctResponse.length)?1:0;else if("MAP_RESPONSE"===template){if(!responseDeclaration.mapEntries||!_.size(responseDeclaration.mapEntries))return 0;requiredChoiceCount=minChoice,totalAnswerableResponse=0===maxChoice?1/0:maxChoice,scoreMaps=_.values(responseDeclaration.mapEntries),sortedMapEntries=_(scoreMaps).map(function(v){return parseFloat(v)}).sortBy().reverse().first(totalAnswerableResponse),missingMapsCount=minChoice-sortedMapEntries.size(),_.times(missingMapsCount,function(){sortedMapEntries.push(mapDefault)}),mapDefault&&0<mapDefault&&(missingMapsCount=maxChoice?maxChoice-sortedMapEntries.size():_.size(interaction.getChoices())-sortedMapEntries.size(),0<missingMapsCount&&_.times(missingMapsCount,function(){sortedMapEntries.push(mapDefault)})),max=sortedMapEntries.reduce(function(acc,v){var score=v;return 0>score&&0>=requiredChoiceCount&&(score=0),requiredChoiceCount--,gamp.add(acc,score)},0),responseDeclaration.mappingAttributes.upperBound&&(max=_Mathmin2(max,parseFloat(responseDeclaration.mappingAttributes.upperBound||0)))}else"MAP_RESPONSE_POINT"===template&&(max=0);return max},orderInteractionBased:function(interaction){var maxChoice=parseInt(interaction.attr("maxChoices")||0,10),responseDeclaration=interaction.getResponseDeclaration(),template=responseHelper.getTemplateNameFromUri(responseDeclaration.template),max;return maxChoice&&0&&0>maxChoice?0:("MATCH_CORRECT"===template?_.isArray(responseDeclaration.correctResponse)&&maxChoice&&responseDeclaration.correctResponse.length>maxChoice||0?max=0:responseDeclaration.correctResponse&&(!_.isArray(responseDeclaration.correctResponse)||responseDeclaration.correctResponse.length)?max=1:max=0:("MAP_RESPONSE"===template||"MAP_RESPONSE_POINT"===template)&&(max=0),max)},associateInteractionBased:function(interaction,options){var responseDeclaration=interaction.getResponseDeclaration(),template=responseHelper.getTemplateNameFromUri(responseDeclaration.template),maxAssoc=parseInt(interaction.attr("maxAssociations")||0,10),minAssoc=0,mapDefault=parseFloat(responseDeclaration.mappingAttributes.defaultValue||0),max,requiredAssoc,totalAnswerableResponse,usedChoices,choicesIdentifiers,sortedMapEntries,i,allPossibleMapEntries,infiniteScoringPair;if(options=_.defaults(options||{},{possiblePairs:[],checkInfinitePair:!1}),maxAssoc&&minAssoc&&maxAssoc<minAssoc)return 0;if("MATCH_CORRECT"===template)!responseDeclaration.correctResponse||_.isArray(responseDeclaration.correctResponse)&&(!responseDeclaration.correctResponse.length||maxAssoc&&responseDeclaration.correctResponse.length>maxAssoc||minAssoc)?max=0:(max=1,choicesIdentifiers=[],_.forEach(responseDeclaration.correctResponse,function(pair){var choices;_.isString(pair)&&(choices=pair.trim().split(" "),_.isArray(choices)&&2===choices.length&&(choicesIdentifiers.push(choices[0].trim()),choicesIdentifiers.push(choices[1].trim())))}),_.forEach(_.countBy(choicesIdentifiers),function(count,identifier){var choice=interaction.getChoiceByIdentifier(identifier),matchMax;return choice?(matchMax=parseInt(choice.attr("matchMax"),10),matchMax&&matchMax<count)?(max=0,!1):void 0:(max=0,!1)}));else if("MAP_RESPONSE"===template){if(requiredAssoc=minAssoc,totalAnswerableResponse=0===maxAssoc?1/0:maxAssoc,usedChoices={},!responseDeclaration.mapEntries||!_.size(responseDeclaration.mapEntries))return 0;if(allPossibleMapEntries=_.clone(responseDeclaration.mapEntries),mapDefault&&0<mapDefault&&_.forEachRight(options.possiblePairs,function(pair){pairExists(allPossibleMapEntries,pair)||(allPossibleMapEntries[pair[0]+" "+pair[1]]=mapDefault)}),sortedMapEntries=_(allPossibleMapEntries).map(function(score,pair){return{score:parseFloat(score),pair:pair}}).sortBy("score").reverse().filter(function(mapEntry){var pair=mapEntry.pair,choices,choiceId,choice,_usedChoices;if(!_.isString(pair))return!1;if(choices=pair.trim().split(" "),_.isArray(choices)&&2===choices.length){for(_usedChoices=_.cloneDeep(usedChoices),i=0;2>i;i++){if(choiceId=choices[i],!_usedChoices[choiceId]){if(choice=interaction.getChoiceByIdentifier(choiceId),!choice)return!1;_usedChoices[choiceId]={used:0,max:parseInt(choice.attr("matchMax"),10)}}if(_usedChoices[choiceId].max&&_usedChoices[choiceId].used===_usedChoices[choiceId].max)return!1;_usedChoices[choiceId].used++}return infiniteScoringPair=infiniteScoringPair||options.checkInfinitePair&&0<mapEntry.score&&0===_usedChoices[choices[0]].max&&0===_usedChoices[choices[1]].max,_.assign(usedChoices,_usedChoices),!0}return!1}).first(totalAnswerableResponse),infiniteScoringPair)return!1;max=sortedMapEntries.reduce(function(acc,v){var score=v.score;return 0>v.score&&0>=requiredAssoc&&(score=0),requiredAssoc--,gamp.add(acc,score)},0),responseDeclaration.mappingAttributes.upperBound&&(max=_Mathmin2(max,parseFloat(responseDeclaration.mappingAttributes.upperBound||0)))}else"MAP_RESPONSE_POINT"===template&&(max=0);return max},gapMatchInteractionBased:function(interaction){var responseDeclaration=interaction.getResponseDeclaration(),template=responseHelper.getTemplateNameFromUri(responseDeclaration.template),mapDefault=parseFloat(responseDeclaration.mappingAttributes.defaultValue||0),getMatchMaxOrderedChoices=function(choiceCollection){return _(choiceCollection).map(function(choice){return{matchMax:0===choice.attr("matchMax")?1/0:choice.attr("matchMax")||0,id:choice.id()}}).sortBy("matchMax").reverse().valueOf()},calculatePossiblePairs=function(gapMatchInteraction){var pairs=[],matchSet1=getMatchMaxOrderedChoices(gapMatchInteraction.getChoices()),matchSet2=getMatchMaxOrderedChoices(gapMatchInteraction.getGaps());return _.forEach(matchSet1,function(choice1){_.forEach(matchSet2,function(choice2){pairs.push([choice1.id,choice2.id])})}),pairs},max,skippableWrongResponse,totalAnswerableResponse,usedChoices,usedGaps,group1,group2,allPossibleMapEntries;if("MATCH_CORRECT"===template)responseDeclaration.correctResponse&&(!_.isArray(responseDeclaration.correctResponse)||responseDeclaration.correctResponse.length)?(max=1,group1=[],group2=[],_.forEach(responseDeclaration.correctResponse,function(pair){var choices;_.isString(pair)&&(choices=pair.trim().split(" "),_.isArray(choices)&&2===choices.length&&(group1.push(choices[0].trim()),group2.push(choices[1].trim())))}),_.forEach(_.countBy(group1),function(count,identifier){var choice=interaction.getChoiceByIdentifier(identifier),matchMax=parseInt(choice.attr("matchMax"),10);if(matchMax&&matchMax<count)return max=0,!1}),_.forEach(_.countBy(group2),function(count){if(1<count)return max=0,!1})):max=0;else if("MAP_RESPONSE"===template){if(skippableWrongResponse=1/0,totalAnswerableResponse=1/0,usedChoices={},usedGaps={},!responseDeclaration.mapEntries||!_.size(responseDeclaration.mapEntries))return 0;allPossibleMapEntries=_.clone(responseDeclaration.mapEntries),mapDefault&&0<mapDefault&&_.forEachRight(calculatePossiblePairs(interaction),function(pair){pairExists(allPossibleMapEntries,pair)||(allPossibleMapEntries[pair[0]+" "+pair[1]]=mapDefault)}),max=_(allPossibleMapEntries).map(function(score,pair){return{score:parseFloat(score),pair:pair}}).sortBy("score").reverse().filter(function(mapEntry){var pair=mapEntry.pair,_usedChoices=_.cloneDeep(usedChoices),choices,choiceId,gapId,choice;if(!_.isString(pair))return!1;if(choices=pair.trim().split(" "),_.isArray(choices)&&2===choices.length){if(choiceId=choices[0],gapId=choices[1],!_usedChoices[choiceId]){if(choice=interaction.getChoiceByIdentifier(choiceId),!choice)return!1;_usedChoices[choiceId]={used:0,max:parseInt(choice.attr("matchMax"),10)}}return!(_usedChoices[choiceId].max&&_usedChoices[choiceId].used===_usedChoices[choiceId].max)&&(_usedChoices[choiceId].used++,usedGaps[gapId]||(usedGaps[gapId]={used:0,max:1}),!(usedGaps[gapId].max&&usedGaps[gapId].used===usedGaps[gapId].max))&&(usedGaps[gapId].used++,_.assign(usedChoices,_usedChoices),!0)}return!1}).first(totalAnswerableResponse).reduce(function(acc,v){var score=v.score;return 0<=score?acc+score:0<skippableWrongResponse?(skippableWrongResponse--,acc):acc+score},0),responseDeclaration.mappingAttributes.upperBound&&(max=_Mathmin2(max,parseFloat(responseDeclaration.mappingAttributes.upperBound||0)))}else"MAP_RESPONSE_POINT"===template&&(max=!1);return max},selectPointInteractionBased:function(interaction){var maxChoice=parseInt(interaction.attr("maxChoices"),10),responseDeclaration=interaction.getResponseDeclaration(),template=responseHelper.getTemplateNameFromUri(responseDeclaration.template),max,skippableWrongResponse,totalAnswerableResponse;return"MATCH_CORRECT"===template||"MAP_RESPONSE"===template?0:("MAP_RESPONSE_POINT"===template&&(skippableWrongResponse=1/0,totalAnswerableResponse=0===maxChoice?1/0:maxChoice,max=_(responseDeclaration.mapEntries).map(function(v){return parseFloat(v.mappedValue)}).sortBy().reverse().first(totalAnswerableResponse).reduce(function(acc,v){return 0<=v?acc+v:0<skippableWrongResponse?(skippableWrongResponse--,acc):acc+v},0),max=parseFloat(max),responseDeclaration.mappingAttributes.upperBound&&(max=_Mathmin2(max,parseFloat(responseDeclaration.mappingAttributes.upperBound||0)))),max)},sliderInteractionBased:function(interaction){var responseDeclaration=interaction.getResponseDeclaration(),template=responseHelper.getTemplateNameFromUri(responseDeclaration.template),max,scoreMaps;if("MATCH_CORRECT"===template)max=responseDeclaration.correctResponse&&(!_.isArray(responseDeclaration.correctResponse)||responseDeclaration.correctResponse.length)?1:0;else if("MAP_RESPONSE"===template){if(!responseDeclaration.mapEntries||!_.size(responseDeclaration.mapEntries))return 0;scoreMaps=_.values(responseDeclaration.mapEntries),max=_(scoreMaps).map(function(v){return parseFloat(v)}).max(),max=parseFloat(max),responseDeclaration.mappingAttributes.upperBound&&(max=_Mathmin2(max,parseFloat(responseDeclaration.mappingAttributes.upperBound||0)))}else"MAP_RESPONSE_POINT"===template&&(max=0);return max},textEntryInteractionBased:function(interaction){var responseDeclaration=interaction.getResponseDeclaration(),template=responseHelper.getTemplateNameFromUri(responseDeclaration.template),isPossibleResponse=function(value){var patternMask=interaction.attr("patternMask");return!patternMask||!!value.match(new RegExp(patternMask))},max,scoreMaps;if("MATCH_CORRECT"===template)max=responseDeclaration.correctResponse&&(!_.isArray(responseDeclaration.correctResponse)||responseDeclaration.correctResponse.length)?isPossibleResponse(responseDeclaration.correctResponse[0])?1:0:0;else if("MAP_RESPONSE"===template){if(!responseDeclaration.mapEntries||!_.size(responseDeclaration.mapEntries))return 0;scoreMaps=_.values(_.filter(responseDeclaration.mapEntries,function(score,key){return isPossibleResponse(key)})),max=_(scoreMaps).map(function(v){return parseFloat(v)}).max(),max=parseFloat(max),responseDeclaration.mappingAttributes.upperBound&&(max=_Mathmin2(max,parseFloat(responseDeclaration.mappingAttributes.upperBound||0)))}else"MAP_RESPONSE_POINT"===template&&(max=0);return max}}}),define("taoQtiItem/qtiItem/core/interactions/AssociateInteraction",["taoQtiItem/qtiItem/core/interactions/BlockInteraction","taoQtiItem/qtiItem/helper/maxScore"],function(BlockInteraction,maxScore){'use strict';BlockInteraction=BlockInteraction&&Object.prototype.hasOwnProperty.call(BlockInteraction,"default")?BlockInteraction["default"]:BlockInteraction,maxScore=maxScore&&Object.prototype.hasOwnProperty.call(maxScore,"default")?maxScore["default"]:maxScore;var AssociateInteraction=BlockInteraction.extend({qtiClass:"associateInteraction",getNormalMaximum:function(){var calculatePossiblePairs=function(associateInteraction){var pairs=[],choices=maxScore.getMatchMaxOrderedChoices(associateInteraction.getChoices()),i,j;for(i=0;i<choices.length;i++)for(j=i;j<choices.length;j++)pairs.push([choices[i].id,choices[j].id]);return pairs};return maxScore.associateInteractionBased(this,{possiblePairs:calculatePossiblePairs(this)})}});return AssociateInteraction}),define("taoQtiItem/qtiItem/core/interactions/ChoiceInteraction",["taoQtiItem/qtiItem/core/interactions/BlockInteraction","taoQtiItem/qtiItem/helper/maxScore"],function(BlockInteraction,maxScore){'use strict';BlockInteraction=BlockInteraction&&Object.prototype.hasOwnProperty.call(BlockInteraction,"default")?BlockInteraction["default"]:BlockInteraction,maxScore=maxScore&&Object.prototype.hasOwnProperty.call(maxScore,"default")?maxScore["default"]:maxScore;var ChoiceInteraction=BlockInteraction.extend({qtiClass:"choiceInteraction",getNormalMaximum:function(){return maxScore.choiceInteractionBased(this)}});return ChoiceInteraction}),define("taoQtiItem/qtiItem/core/interactions/ContainerInteraction",["taoQtiItem/qtiItem/core/interactions/BlockInteraction","taoQtiItem/qtiItem/mixin/Container"],function(BlockInteraction,Container){'use strict';BlockInteraction=BlockInteraction&&Object.prototype.hasOwnProperty.call(BlockInteraction,"default")?BlockInteraction["default"]:BlockInteraction,Container=Container&&Object.prototype.hasOwnProperty.call(Container,"default")?Container["default"]:Container;var ContainerInteraction=BlockInteraction.extend({});return Container.augment(ContainerInteraction),ContainerInteraction}),define("taoQtiItem/qtiItem/mixin/CustomElement",["taoQtiItem/qtiItem/mixin/Mixin","lodash"],function(Mixin,_){'use strict';Mixin=Mixin&&Object.prototype.hasOwnProperty.call(Mixin,"default")?Mixin["default"]:Mixin,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_;var methods={prop:function(name,value){if(name)if(void 0!==value)this.properties[name]=value;else if("object"===_typeof(name))for(var prop in name)this.prop(prop,name[prop]);else if("string"==typeof name)return void 0===this.properties[name]?void 0:this.properties[name];return this},removeProp:function removeProp(propNames){var _this=this;return"string"==typeof propNames&&(propNames=[propNames]),_.each(propNames,function(propName){delete _this.attributes[propName]}),this},getProperties:function getProperties(){return _.clone(this.properties)},getMarkupNamespace:function getMarkupNamespace(){if(this.markupNs&&this.markupNs.name&&this.markupNs.uri)return _.clone(this.markupNs);var relatedItem=this.getRootElement();return relatedItem?(relatedItem.namespaces[this.defaultMarkupNsName]=this.defaultMarkupNsUri,{name:this.defaultMarkupNsName,uri:this.defaultMarkupNsUri}):{}},setMarkupNamespace:function setMarkupNamespace(name,uri){this.markupNs={name:name,uri:uri}}};return{augment:function augment(targetClass){Mixin.augment(targetClass,methods)},methods:methods}}),define("taoQtiItem/qtiItem/core/interactions/CustomInteraction",["lodash","taoQtiItem/qtiItem/core/interactions/Interaction","taoQtiItem/qtiItem/mixin/CustomElement","taoQtiItem/qtiItem/mixin/NamespacedElement","taoQtiItem/qtiItem/helper/rendererConfig"],function(_,Interaction,CustomElement,NamespacedElement,rendererConfig){'use strict';_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,Interaction=Interaction&&Object.prototype.hasOwnProperty.call(Interaction,"default")?Interaction["default"]:Interaction,CustomElement=CustomElement&&Object.prototype.hasOwnProperty.call(CustomElement,"default")?CustomElement["default"]:CustomElement,NamespacedElement=NamespacedElement&&Object.prototype.hasOwnProperty.call(NamespacedElement,"default")?NamespacedElement["default"]:NamespacedElement,rendererConfig=rendererConfig&&Object.prototype.hasOwnProperty.call(rendererConfig,"default")?rendererConfig["default"]:rendererConfig;var CustomInteraction=Interaction.extend({qtiClass:"customInteraction",defaultNsName:"pci",defaultNsUri:"http://www.imsglobal.org/xsd/portableCustomInteraction",nsUriFragment:"portableCustomInteraction",defaultMarkupNsName:"html5",defaultMarkupNsUri:"html5",init:function init(serial,attributes){this._super(serial,attributes),this.typeIdentifier="",this.markup="",this.properties={},this.libraries=[],this.entryPoint="",this.markupNs={},this.pciReadyCallbacks=[]},is:function is(qtiClass){return"customInteraction"===qtiClass||this._super(qtiClass)},render:function render(){var args=rendererConfig.getOptionsFromArguments(arguments),renderer=args.renderer||this.getRenderer(),defaultData={typeIdentifier:this.typeIdentifier,markup:this.markup,properties:this.properties,libraries:this.libraries,entryPoint:this.entryPoint,ns:{pci:this.getNamespace().name+":"}};return this._super(_.merge(defaultData,args.data),args.placeholder,args.subclass,renderer)},toArray:function toArray(){var arr=this._super();return arr.markup=this.markup,arr.properties=this.properties,arr},getMarkupNamespace:function getMarkupNamespace(){if(this.markupNs&&this.markupNs.name&&this.markupNs.uri)return _.clone(this.markupNs);var relatedItem=this.getRootElement();return relatedItem?(relatedItem.namespaces[this.defaultMarkupNsName]=this.defaultMarkupNsUri,{name:this.defaultMarkupNsName,uri:this.defaultMarkupNsUri}):{}},setMarkupNamespace:function setMarkupNamespace(name,uri){this.markupNs={name:name,uri:uri}},onPciReady:function onPciReady(callback){this.pciReadyCallbacks.push(callback),this.data("pci")&&this.triggerPciReady()},triggerPciReady:function triggerPciReady(){var _this=this,pci=this.data("pci");if(pci)_.each(this.pciReadyCallbacks,function(fn){fn.call(_this,pci)}),this.pciReadyCallbacks=[],this.data("pciReady",!0);else throw"cannot trigger pci ready when no pci is actually attached to the interaction"},onPci:function onPci(event,callback){return this.onPciReady(function(pci){if(_.isFunction(pci.on))pci.on(event,callback);else throw"the pci does not implement on() function"}),this},offPci:function offPci(event){return this.onPciReady(function(pci){if(_.isFunction(pci.off))pci.off(event);else throw"the pci does not implement off() function"}),this},triggerPci:function triggerPci(event,args){return this.onPciReady(function(pci){if(_.isFunction(pci.off))pci.trigger(event,args);else throw"the pci does not implement off() function"}),this}});return CustomElement.augment(CustomInteraction),NamespacedElement.augment(CustomInteraction),CustomInteraction}),define("taoQtiItem/qtiItem/core/interactions/InlineInteraction",["taoQtiItem/qtiItem/core/interactions/Interaction"],function(Interaction){'use strict';Interaction=Interaction&&Object.prototype.hasOwnProperty.call(Interaction,"default")?Interaction["default"]:Interaction;var InlineInteraction=Interaction.extend({is:function is(qtiClass){return"inlineInteraction"===qtiClass||this._super(qtiClass)}});return InlineInteraction}),define("taoQtiItem/qtiItem/core/interactions/EndAttemptInteraction",["taoQtiItem/qtiItem/core/interactions/InlineInteraction"],function(InlineInteraction){'use strict';InlineInteraction=InlineInteraction&&Object.prototype.hasOwnProperty.call(InlineInteraction,"default")?InlineInteraction["default"]:InlineInteraction;var EndAttemptInteraction=InlineInteraction.extend({qtiClass:"endAttemptInteraction"});return EndAttemptInteraction}),define("taoQtiItem/qtiItem/core/interactions/ExtendedTextInteraction",["lodash","taoQtiItem/qtiItem/core/interactions/BlockInteraction","taoQtiItem/qtiItem/helper/rendererConfig","taoQtiItem/qtiItem/helper/maxScore"],function(_,BlockInteraction,rendererConfig,maxScore){'use strict';_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,BlockInteraction=BlockInteraction&&Object.prototype.hasOwnProperty.call(BlockInteraction,"default")?BlockInteraction["default"]:BlockInteraction,rendererConfig=rendererConfig&&Object.prototype.hasOwnProperty.call(rendererConfig,"default")?rendererConfig["default"]:rendererConfig,maxScore=maxScore&&Object.prototype.hasOwnProperty.call(maxScore,"default")?maxScore["default"]:maxScore;var ExtendedTextInteraction=BlockInteraction.extend({qtiClass:"extendedTextInteraction",render:function(){var args=rendererConfig.getOptionsFromArguments(arguments),renderer=args.renderer||this.getRenderer(),defaultData={multiple:!1,maxStringLoop:[]},response=this.getResponseDeclaration(),i;if(this.attr("maxStrings")&&("multiple"===response.attr("cardinality")||"ordered"===response.attr("cardinality")))for(defaultData.multiple=!0,i=0;i<this.attr("maxStrings");i++)defaultData.maxStringLoop.push(i+"");return this._super(_.merge(defaultData,args.data),args.placeholder,args.subclass,renderer)},getNormalMaximum:function(){return maxScore.textEntryInteractionBased(this)}});return ExtendedTextInteraction}),define("taoQtiItem/qtiItem/core/interactions/GapMatchInteraction",["taoQtiItem/qtiItem/core/interactions/ContainerInteraction","taoQtiItem/qtiItem/helper/maxScore"],function(ContainerInteraction,maxScore){'use strict';ContainerInteraction=ContainerInteraction&&Object.prototype.hasOwnProperty.call(ContainerInteraction,"default")?ContainerInteraction["default"]:ContainerInteraction,maxScore=maxScore&&Object.prototype.hasOwnProperty.call(maxScore,"default")?maxScore["default"]:maxScore;var GapMatchInteraction=ContainerInteraction.extend({qtiClass:"gapMatchInteraction",getGaps:function(){return this.getBody().getElements("gap")},getNormalMaximum:function(){return maxScore.gapMatchInteractionBased(this)}});return GapMatchInteraction}),define("taoQtiItem/qtiItem/core/interactions/ObjectInteraction",["taoQtiItem/qtiItem/core/interactions/BlockInteraction","taoQtiItem/qtiItem/core/Object"],function(QtiBlockInteraction,QtiObject){'use strict';QtiBlockInteraction=QtiBlockInteraction&&Object.prototype.hasOwnProperty.call(QtiBlockInteraction,"default")?QtiBlockInteraction["default"]:QtiBlockInteraction,QtiObject=QtiObject&&Object.prototype.hasOwnProperty.call(QtiObject,"default")?QtiObject["default"]:QtiObject;var QtiObjectInteraction=QtiBlockInteraction.extend({initObject:function initObject(object){this.object=object||new QtiObject},getObject:function getObject(){return this.object}});return QtiObjectInteraction}),define("taoQtiItem/qtiItem/core/interactions/GraphicInteraction",["taoQtiItem/qtiItem/core/interactions/ObjectInteraction","lodash","taoQtiItem/qtiItem/helper/rendererConfig"],function(QtiObjectInteraction,_,rendererConfig){'use strict';QtiObjectInteraction=QtiObjectInteraction&&Object.prototype.hasOwnProperty.call(QtiObjectInteraction,"default")?QtiObjectInteraction["default"]:QtiObjectInteraction,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,rendererConfig=rendererConfig&&Object.prototype.hasOwnProperty.call(rendererConfig,"default")?rendererConfig["default"]:rendererConfig;var QtiGraphicInteraction=QtiObjectInteraction.extend({render:function render(){var args=rendererConfig.getOptionsFromArguments(arguments),renderer=args.renderer||this.getRenderer(),defaultData={backgroundImage:this.object.getAttributes(),object:this.object.render(renderer)};return this._super(_.merge(defaultData,args.data),args.placeholder,args.subclass,renderer)}});return QtiGraphicInteraction}),define("taoQtiItem/qtiItem/core/interactions/GraphicAssociateInteraction",["taoQtiItem/qtiItem/core/interactions/GraphicInteraction","taoQtiItem/qtiItem/helper/maxScore"],function(GraphicInteraction,maxScore){'use strict';GraphicInteraction=GraphicInteraction&&Object.prototype.hasOwnProperty.call(GraphicInteraction,"default")?GraphicInteraction["default"]:GraphicInteraction,maxScore=maxScore&&Object.prototype.hasOwnProperty.call(maxScore,"default")?maxScore["default"]:maxScore;var GraphicAssociateInteraction=GraphicInteraction.extend({qtiClass:"graphicAssociateInteraction",getNormalMaximum:function(){var calculatePossiblePairs=function(associateInteraction){var pairs=[],choices=maxScore.getMatchMaxOrderedChoices(associateInteraction.getChoices()),i,j;for(i=0;i<choices.length;i++)for(j=i;j<choices.length;j++)i!==j&&pairs.push([choices[i].id,choices[j].id]);return pairs};return maxScore.associateInteractionBased(this,{possiblePairs:calculatePossiblePairs(this)})}});return GraphicAssociateInteraction}),define("taoQtiItem/qtiItem/core/interactions/GraphicGapMatchInteraction",["taoQtiItem/qtiItem/core/interactions/GraphicInteraction","taoQtiItem/qtiItem/core/Element","lodash","taoQtiItem/qtiItem/helper/rendererConfig","taoQtiItem/qtiItem/helper/maxScore"],function(GraphicInteraction,Element,_,rendererConfig,maxScore){'use strict';GraphicInteraction=GraphicInteraction&&Object.prototype.hasOwnProperty.call(GraphicInteraction,"default")?GraphicInteraction["default"]:GraphicInteraction,Element=Element&&Object.prototype.hasOwnProperty.call(Element,"default")?Element["default"]:Element,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,rendererConfig=rendererConfig&&Object.prototype.hasOwnProperty.call(rendererConfig,"default")?rendererConfig["default"]:rendererConfig,maxScore=maxScore&&Object.prototype.hasOwnProperty.call(maxScore,"default")?maxScore["default"]:maxScore;var GraphicGapMatchInteraction=GraphicInteraction.extend({qtiClass:"graphicGapMatchInteraction",init:function(serial,attributes){this._super(serial,attributes),this.gapImgs={}},addGapImg:function(gapImg){Element.isA(gapImg,"gapImg")&&(gapImg.setRootElement(this.getRootElement()||null),this.gapImgs[gapImg.getSerial()]=gapImg)},removeGapImg:function(gapImg){var serial="";return"string"==typeof gapImg?serial=gapImg:Element.isA(gapImg,"gapImg")&&(serial=gapImg.getSerial()),delete this.gapImgs[serial],this},getGapImgs:function(){return _.clone(this.gapImgs)},getGapImg:function(serial){return this.gapImgs[serial]},getChoiceByIdentifier:function(identifier){var choice=this._super(identifier);return choice||(choice=_.find(this.gapImgs,function(elt){return elt&&elt.id()===identifier})),choice},getComposingElements:function(){var elts=this._super(),serial;for(serial in this.gapImgs)elts[serial]=this.gapImgs[serial],elts=_.extend(elts,this.gapImgs[serial].getComposingElements());return elts},find:function(serial){var found=this._super(serial);return!found&&this.gapImgs[serial]&&(found={parent:this,element:this.gapImgs[serial]}),found},render:function(){var args=rendererConfig.getOptionsFromArguments(arguments),renderer=args.renderer||this.getRenderer(),defaultData={gapImgs:[]},gapImgs=this.getGapImgs(),serial;for(serial in gapImgs)Element.isA(gapImgs[serial],"choice")&&defaultData.gapImgs.push(gapImgs[serial].render({},null,"",renderer));return this._super(_.merge(defaultData,args.data),args.placeholder,args.subclass,renderer)},toArray:function(){var arr=this._super(),serial,gapImgs;for(serial in arr.gapImgs={},gapImgs=this.getGapImgs(),gapImgs)arr.gapImgs[serial]=gapImgs[serial].toArray();return arr},getNormalMaximum:function(){var calculatePossiblePairs=function(graphicGapInteraction){var pairs=[],matchSet1=maxScore.getMatchMaxOrderedChoices(graphicGapInteraction.getGapImgs()),matchSet2=maxScore.getMatchMaxOrderedChoices(graphicGapInteraction.getChoices());return _.forEach(matchSet1,function(choice1){_.forEach(matchSet2,function(choice2){pairs.push([choice1.id,choice2.id])})}),pairs};return maxScore.associateInteractionBased(this,{possiblePairs:calculatePossiblePairs(this),checkInfinitePair:!0})}});return GraphicGapMatchInteraction}),define("taoQtiItem/qtiItem/core/interactions/GraphicOrderInteraction",["taoQtiItem/qtiItem/core/interactions/GraphicInteraction","taoQtiItem/qtiItem/helper/maxScore"],function(GraphicInteraction,maxScore){'use strict';GraphicInteraction=GraphicInteraction&&Object.prototype.hasOwnProperty.call(GraphicInteraction,"default")?GraphicInteraction["default"]:GraphicInteraction,maxScore=maxScore&&Object.prototype.hasOwnProperty.call(maxScore,"default")?maxScore["default"]:maxScore;var GraphicOrderInteraction=GraphicInteraction.extend({qtiClass:"graphicOrderInteraction",getNormalMaximum:function(){return maxScore.orderInteractionBased(this)}});return GraphicOrderInteraction}),define("taoQtiItem/qtiItem/core/interactions/HotspotInteraction",["taoQtiItem/qtiItem/core/interactions/GraphicInteraction","taoQtiItem/qtiItem/helper/maxScore"],function(GraphicInteraction,maxScore){'use strict';GraphicInteraction=GraphicInteraction&&Object.prototype.hasOwnProperty.call(GraphicInteraction,"default")?GraphicInteraction["default"]:GraphicInteraction,maxScore=maxScore&&Object.prototype.hasOwnProperty.call(maxScore,"default")?maxScore["default"]:maxScore;var HotspotInteraction=GraphicInteraction.extend({qtiClass:"hotspotInteraction",getNormalMaximum:function(){return maxScore.choiceInteractionBased(this)}});return HotspotInteraction}),define("taoQtiItem/qtiItem/core/interactions/HottextInteraction",["taoQtiItem/qtiItem/core/interactions/ContainerInteraction","taoQtiItem/qtiItem/core/Element","taoQtiItem/qtiItem/helper/maxScore"],function(ContainerInteraction,Element,maxScore){'use strict';ContainerInteraction=ContainerInteraction&&Object.prototype.hasOwnProperty.call(ContainerInteraction,"default")?ContainerInteraction["default"]:ContainerInteraction,Element=Element&&Object.prototype.hasOwnProperty.call(Element,"default")?Element["default"]:Element,maxScore=maxScore&&Object.prototype.hasOwnProperty.call(maxScore,"default")?maxScore["default"]:maxScore;var HottextInteraction=ContainerInteraction.extend({qtiClass:"hottextInteraction",getChoices:function getChoices(){return this.getBody().getElements("hottext")},getChoice:function getChoice(serial){var element=this.getBody().getElement(serial);return Element.isA(element,"choice")?element:null},getNormalMaximum:function(){return maxScore.choiceInteractionBased(this)}});return HottextInteraction}),define("taoQtiItem/qtiItem/core/interactions/InlineChoiceInteraction",["taoQtiItem/qtiItem/core/interactions/InlineInteraction","taoQtiItem/qtiItem/helper/maxScore"],function(InlineInteraction,maxScore){'use strict';InlineInteraction=InlineInteraction&&Object.prototype.hasOwnProperty.call(InlineInteraction,"default")?InlineInteraction["default"]:InlineInteraction,maxScore=maxScore&&Object.prototype.hasOwnProperty.call(maxScore,"default")?maxScore["default"]:maxScore;var InlineChoiceInteraction=InlineInteraction.extend({qtiClass:"inlineChoiceInteraction",getNormalMaximum:function(){return maxScore.choiceInteractionBased(this,{maxChoices:1})}});return InlineChoiceInteraction}),define("taoQtiItem/qtiItem/core/interactions/MatchInteraction",["taoQtiItem/qtiItem/core/interactions/BlockInteraction","taoQtiItem/qtiItem/core/choices/SimpleAssociableChoice","lodash","taoQtiItem/qtiItem/helper/rendererConfig","taoQtiItem/qtiItem/helper/util","taoQtiItem/qtiItem/helper/maxScore"],function(BlockInteraction,SimpleAssociableChoice,_,rendererConfig,util,maxScore){'use strict';BlockInteraction=BlockInteraction&&Object.prototype.hasOwnProperty.call(BlockInteraction,"default")?BlockInteraction["default"]:BlockInteraction,SimpleAssociableChoice=SimpleAssociableChoice&&Object.prototype.hasOwnProperty.call(SimpleAssociableChoice,"default")?SimpleAssociableChoice["default"]:SimpleAssociableChoice,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,rendererConfig=rendererConfig&&Object.prototype.hasOwnProperty.call(rendererConfig,"default")?rendererConfig["default"]:rendererConfig,util=util&&Object.prototype.hasOwnProperty.call(util,"default")?util["default"]:util,maxScore=maxScore&&Object.prototype.hasOwnProperty.call(maxScore,"default")?maxScore["default"]:maxScore;var MatchInteraction=BlockInteraction.extend({qtiClass:"matchInteraction",init:function(serial,attributes){this._super(serial,attributes),this.choices=[{},{}]},addChoice:function(choice,matchSet){matchSet=parseInt(matchSet),this.choices[matchSet]&&(choice.setRootElement(this.getRootElement()||null),this.choices[matchSet][choice.getSerial()]=choice)},getChoices:function(matchSet){return matchSet=parseInt(matchSet),this.choices[matchSet]?_.clone(this.choices[matchSet]):_.clone(this.choices)},getChoice:function(serial){return this.choices[0][serial]||this.choices[1][serial]||null},getChoiceByIdentifier:function(identifier){var i,matchSet,serial;for(i=0;2>i;i++)for(serial in matchSet=this.getChoices(i),matchSet)if(matchSet[serial]instanceof SimpleAssociableChoice&&matchSet[serial].id()===identifier)return matchSet[serial];return null},getComposingElements:function(){var elts=this._super(),i,matchSet,serial;for(i=0;2>i;i++)for(serial in matchSet=this.getChoices(i),matchSet)matchSet[serial]instanceof SimpleAssociableChoice&&(elts[serial]=matchSet[serial],elts=_.extend(elts,matchSet[serial].getComposingElements()));return elts},find:function(serial){var found=this._super(serial);return found||(found=util.findInCollection(this,["choices.0","choices.1"],serial)),found},render:function(){var args=rendererConfig.getOptionsFromArguments(arguments),renderer=args.renderer||this.getRenderer(),defaultData={matchSet1:[],matchSet2:[]},interactionData={interaction:{serial:this.serial,attributes:this.attributes}},choices,i,matchSet,serial;if(!renderer)throw"no renderer found for the interaction "+this.qtiClass;for(choices=this.attr("shuffle")&&renderer.getOption("shuffleChoices")?renderer.getShuffledChoices(this):this.getChoices(),i=0;2>i;i++)for(serial in matchSet=choices[i],matchSet)matchSet[serial]instanceof SimpleAssociableChoice&&defaultData["matchSet"+(i+1)].push(matchSet[serial].render(_.clone(interactionData,!0),null,"simpleAssociableChoice.matchInteraction",renderer));return this._super(_.merge(defaultData,args.data),args.placeholder,args.subclass,renderer)},postRender:function(data,altClassName,renderer){return renderer=renderer||this.getRenderer(),_(this.getChoices()).map(function(choices){return _(choices).filter(function(choice){return choice instanceof SimpleAssociableChoice}).map(function(choice){return choice.postRender({},"simpleAssociableChoice.matchInteraction",renderer)}).value()}).flatten(!0).value().concat(this._super(data,altClassName,renderer))},toArray:function(){var arr=this._super(),i,matchSet,serial;for(arr.choices={0:{},1:{}},i=0;2>i;i++)for(serial in matchSet=this.getChoices(i),matchSet)matchSet[serial]instanceof SimpleAssociableChoice&&(arr.choices[i][serial]=matchSet[serial].toArray());return arr},getNormalMaximum:function(){var calculatePossiblePairs=function(matchInteraction){var pairs=[],matchSet1=maxScore.getMatchMaxOrderedChoices(matchInteraction.getChoices(0)),matchSet2=maxScore.getMatchMaxOrderedChoices(matchInteraction.getChoices(1));return _.forEach(matchSet1,function(choice1){_.forEach(matchSet2,function(choice2){pairs.push([choice1.id,choice2.id])})}),pairs};return maxScore.associateInteractionBased(this,{possiblePairs:calculatePossiblePairs(this)})}});return MatchInteraction}),define("taoQtiItem/qtiItem/core/interactions/MediaInteraction",["lodash","taoQtiItem/qtiItem/core/interactions/ObjectInteraction","taoQtiItem/qtiItem/helper/rendererConfig"],function(_,ObjectInteraction,rendererConfig){'use strict';_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,ObjectInteraction=ObjectInteraction&&Object.prototype.hasOwnProperty.call(ObjectInteraction,"default")?ObjectInteraction["default"]:ObjectInteraction,rendererConfig=rendererConfig&&Object.prototype.hasOwnProperty.call(rendererConfig,"default")?rendererConfig["default"]:rendererConfig;var MediaInteraction=ObjectInteraction.extend({qtiClass:"mediaInteraction",render:function(){var args=rendererConfig.getOptionsFromArguments(arguments),renderer=args.renderer||this.getRenderer(),defaultData={object:this.object.render({},null,"",renderer)};return this._super(_.merge(defaultData,args.data),args.placeholder,args.subclass,renderer)},getNormalMaximum:function(){return 0}});return MediaInteraction}),define("taoQtiItem/qtiItem/core/interactions/OrderInteraction",["taoQtiItem/qtiItem/core/interactions/BlockInteraction","taoQtiItem/qtiItem/helper/maxScore"],function(BlockInteraction,maxScore){'use strict';BlockInteraction=BlockInteraction&&Object.prototype.hasOwnProperty.call(BlockInteraction,"default")?BlockInteraction["default"]:BlockInteraction,maxScore=maxScore&&Object.prototype.hasOwnProperty.call(maxScore,"default")?maxScore["default"]:maxScore;var OrderInteraction=BlockInteraction.extend({qtiClass:"orderInteraction",getNormalMaximum:function(){return maxScore.orderInteractionBased(this)}});return OrderInteraction}),define("taoQtiItem/qtiItem/core/interactions/SelectPointInteraction",["taoQtiItem/qtiItem/core/interactions/GraphicInteraction","taoQtiItem/qtiItem/helper/maxScore"],function(GraphicInteraction,maxScore){'use strict';GraphicInteraction=GraphicInteraction&&Object.prototype.hasOwnProperty.call(GraphicInteraction,"default")?GraphicInteraction["default"]:GraphicInteraction,maxScore=maxScore&&Object.prototype.hasOwnProperty.call(maxScore,"default")?maxScore["default"]:maxScore;var SelectPointInteraction=GraphicInteraction.extend({qtiClass:"selectPointInteraction",getNormalMaximum:function(){return maxScore.selectPointInteractionBased(this)}});return SelectPointInteraction}),define("taoQtiItem/qtiItem/core/interactions/SliderInteraction",["taoQtiItem/qtiItem/core/interactions/BlockInteraction","taoQtiItem/qtiItem/helper/maxScore"],function(BlockInteraction,maxScore){'use strict';BlockInteraction=BlockInteraction&&Object.prototype.hasOwnProperty.call(BlockInteraction,"default")?BlockInteraction["default"]:BlockInteraction,maxScore=maxScore&&Object.prototype.hasOwnProperty.call(maxScore,"default")?maxScore["default"]:maxScore;var SliderInteraction=BlockInteraction.extend({qtiClass:"sliderInteraction",getNormalMaximum:function(){return maxScore.sliderInteractionBased(this)}});return SliderInteraction}),define("taoQtiItem/qtiItem/core/interactions/TextEntryInteraction",["taoQtiItem/qtiItem/core/interactions/InlineInteraction","taoQtiItem/qtiItem/helper/maxScore"],function(InlineInteraction,maxScore){'use strict';InlineInteraction=InlineInteraction&&Object.prototype.hasOwnProperty.call(InlineInteraction,"default")?InlineInteraction["default"]:InlineInteraction,maxScore=maxScore&&Object.prototype.hasOwnProperty.call(maxScore,"default")?maxScore["default"]:maxScore;var TextEntryInteraction=InlineInteraction.extend({qtiClass:"textEntryInteraction",getNormalMaximum:function(){return maxScore.textEntryInteractionBased(this)}});return TextEntryInteraction}),define("taoQtiItem/qtiItem/core/interactions/UploadInteraction",["taoQtiItem/qtiItem/core/interactions/BlockInteraction"],function(InlineInteraction){'use strict';InlineInteraction=InlineInteraction&&Object.prototype.hasOwnProperty.call(InlineInteraction,"default")?InlineInteraction["default"]:InlineInteraction;var UploadInteraction=InlineInteraction.extend({qtiClass:"uploadInteraction"});return UploadInteraction}),define("taoQtiItem/qtiItem/mixin/ContainerItemBody",["taoQtiItem/qtiItem/mixin/Mixin","taoQtiItem/qtiItem/mixin/Container","lodash"],function(Mixin,Container,_){'use strict';Mixin=Mixin&&Object.prototype.hasOwnProperty.call(Mixin,"default")?Mixin["default"]:Mixin,Container=Container&&Object.prototype.hasOwnProperty.call(Container,"default")?Container["default"]:Container,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_;var methods={};_.extend(methods,Container.methods),_.extend(methods,{initContainer:function initContainer(body){Container.methods.initContainer.call(this,body),this.bdy.contentModel="itemBody"}});return{augment:function augment(targetClass){Mixin.augment(targetClass,methods)},methods:methods}}),define("taoQtiItem/qtiItem/core/Item",["taoQtiItem/qtiItem/core/Element","taoQtiItem/qtiItem/core/IdentifiedElement","taoQtiItem/qtiItem/mixin/ContainerItemBody","lodash","jquery","taoQtiItem/qtiItem/helper/util"],function(Element,IdentifiedElement,Container,_,$,util){'use strict';Element=Element&&Object.prototype.hasOwnProperty.call(Element,"default")?Element["default"]:Element,IdentifiedElement=IdentifiedElement&&Object.prototype.hasOwnProperty.call(IdentifiedElement,"default")?IdentifiedElement["default"]:IdentifiedElement,Container=Container&&Object.prototype.hasOwnProperty.call(Container,"default")?Container["default"]:Container,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,$=$&&Object.prototype.hasOwnProperty.call($,"default")?$["default"]:$,util=util&&Object.prototype.hasOwnProperty.call(util,"default")?util["default"]:util;var Item=IdentifiedElement.extend({qtiClass:"assessmentItem",init:function(serial,attributes){this._super(serial,attributes),this.rootElement=this,this.stylesheets={},this.responses={},this.outcomes={},this.modalFeedbacks={},this.namespaces={},this.schemaLocations={},this.responseProcessing=null,this.apipAccessibility=null},getInteractions:function(){var interactions=[],elts=this.getComposingElements();for(var serial in elts)Element.isA(elts[serial],"interaction")&&interactions.push(elts[serial]);return interactions},addResponseDeclaration:function(response){if(Element.isA(response,"responseDeclaration"))response.setRootElement(this),this.responses[response.getSerial()]=response;else throw"is not a qti response declaration";return this},getResponseDeclaration:function(identifier){for(var i in this.responses)if(this.responses[i].attr("identifier")===identifier)return this.responses[i];return null},addOutcomeDeclaration:function(outcome){if(Element.isA(outcome,"outcomeDeclaration"))outcome.setRootElement(this),this.outcomes[outcome.getSerial()]=outcome;else throw"is not a qti outcome declaration";return this},getOutcomeDeclaration:function(identifier){var found;return _.forEach(this.outcomes,function(outcome){if(outcome.id()===identifier)return found=outcome,!1}),found},getOutcomes:function(){return _.clone(this.outcomes)},removeOutcome:function(identifier){var outcome=this.getOutcomeDeclaration(identifier);outcome&&(this.outcomes=_.omit(this.outcomes,outcome.getSerial()))},addModalFeedback:function(feedback){if(Element.isA(feedback,"modalFeedback"))feedback.setRootElement(this),this.modalFeedbacks[feedback.getSerial()]=feedback;else throw"is not a qti modal feedback";return this},getComposingElements:function(){var elts=this._super(),_this=this;return _.forEach(["responses","outcomes","modalFeedbacks","stylesheets"],function(elementCollection){for(var i in _this[elementCollection]){var elt=_this[elementCollection][i];elts[i]=elt,elts=_.extend(elts,elt.getComposingElements())}}),this.responseProcessing instanceof Element&&(elts[this.responseProcessing.getSerial()]=this.responseProcessing),elts},find:function(serial){var found=this._super(serial);return found||(found=util.findInCollection(this,["responses","outcomes","modalFeedbacks","stylesheets"],serial)),found},getResponses:function(){return _.clone(this.responses)},getRootElement:function(){return this},addNamespace:function(name,uri){this.namespaces[name]=uri},setNamespaces:function(namespaces){this.namespaces=namespaces},getNamespaces:function(){return _.clone(this.namespaces)},setSchemaLocations:function(locations){this.schemaLocations=locations},getSchemaLocations:function(){return _.clone(this.schemaLocations)},setApipAccessibility:function(apip){this.apipAccessibility=apip||null},getApipAccessibility:function(){return this.apipAccessibility},addStylesheet:function(stylesheet){if(Element.isA(stylesheet,"stylesheet"))stylesheet.setRootElement(this),this.stylesheets[stylesheet.getSerial()]=stylesheet;else throw"is not a qti stylesheet declaration";return this},removeStyleSheet:function(stylesheet){return delete this.stylesheets[stylesheet.getSerial()],this},stylesheetExists:function(href){var exists=!1;return _.forEach(this.stylesheets,function(stylesheet){if(stylesheet.attr("href")===href)return exists=!0,!1}),exists},setResponseProcessing:function(rp){if(Element.isA(rp,"responseProcessing"))rp.setRootElement(this),this.responseProcessing=rp;else throw"is not a response processing";return this},toArray:function toArray(){var arr=this._super(),toArray=function(elt){return elt.toArray()};return arr.namespaces=this.namespaces,arr.schemaLocations=this.schemaLocations,arr.outcomes=_.map(this.outcomes,toArray),arr.responses=_.map(this.responses,toArray),arr.stylesheets=_.map(this.stylesheets,toArray),arr.modalFeedbacks=_.map(this.modalFeedbacks,toArray),arr.responseProcessing=this.responseProcessing.toArray(),arr},isEmpty:function(){var body=this.body().trim();if(body){var $dummy=$("<div>").html(body),$children=$dummy.children();return!!(1===$children.length&&$children.hasClass("empty"))}return!0},clear:function(){var renderer=this.getRenderer();renderer&&_.isFunction(renderer.destroy)&&renderer.destroy(this)}});return Container.augment(Item),Item}),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/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 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,tagMatch;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/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 _this4=this,requiredClasses=this.getRequiredClasses(data,reload),required=[],requiredClass;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){_this4.qti[QtiClass.prototype.qtiClass]=QtiClass}),callback.call(_this4,_this4.qti)})},getLoadedClasses:function getLoadedClasses(){return _.keys(this.qti)},loadItemData:function loadItemData(data,callback){var _this5=this;this.loadRequiredClasses(data,function(Qti){"object"===_typeof(data)&&"assessmentItem"===data.qtiClass&&function(){for(var i in data.serial&&Element.unsetElement(data.serial),_this5.item=new Qti.assessmentItem(data.serial,data.attributes||{}),_this5.loadContainer(_this5.item.getBody(),data.body),data.outcomes){var outcome=_this5.buildOutcome(data.outcomes[i]);outcome&&_this5.item.addOutcomeDeclaration(outcome)}for(var _i2 in data.feedbacks){var feedback=_this5.buildElement(data.feedbacks[_i2]);feedback&&_this5.item.addModalFeedback(feedback)}for(var _i3 in data.stylesheets){var stylesheet=_this5.buildElement(data.stylesheets[_i3]);stylesheet&&_this5.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=_this5.buildResponse(data.responses[_i4],responseRule);if(response){_this5.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]=_this5.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(_this5.item.responses||{}).map(function(responseKey){return _this5.item.responses[responseKey].attributes.identifier});if(data.responseProcessing){var customResponseProcessing=0<responseRules.length&&!(1===responseRules.length&&_.isEqual(responseRules[0],itemScoreHelper(responseIdentifiers)))||_this5.item.responses&&Object.keys(_this5.item.responses).some(function(responseKey){return!_this5.item.responses[responseKey].template});_this5.item.setResponseProcessing(_this5.buildResponseProcessing(data.responseProcessing,customResponseProcessing))}_this5.item.setNamespaces(data.namespaces),_this5.item.setSchemaLocations(data.schemaLocations),_this5.item.setApipAccessibility(data.apipAccessibility)}(),"function"==typeof callback&&callback.call(_this5,_this5.item)})},loadAndBuildElement:function loadAndBuildElement(data,callback){var _this6=this;this.loadRequiredClasses(data,function(){var element=_this6.buildElement(data);"function"==typeof callback&&callback.call(_this6,element)})},loadElement:function loadElement(element,data,callback){var _this7=this;this.loadRequiredClasses(data,function(){_this7.loadElementData(element,data),"function"==typeof callback&&callback.call(_this7,element)})},loadElements:function loadElements(data,callback){var _this8=this;if(!this.item)throw new Error("QtiLoader : cannot load elements in empty item");this.loadRequiredClasses(data,function(){var allElements=_this8.item.getComposingElements();for(var i in data){var elementData=data[i];elementData&&elementData.qtiClass&&elementData.serial&&allElements[elementData.serial]&&_this8.loadElementData(allElements[elementData.serial],elementData)}"function"==typeof callback&&callback.call(_this8,_this8.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/core/Math",["jquery","lodash","taoQtiItem/qtiItem/core/Element","taoQtiItem/qtiItem/helper/rendererConfig","taoQtiItem/qtiItem/mixin/NamespacedElement"],function($,_,Element,rendererConfig,NamespacedElement){'use strict';function _stripMathTags(mathML,nsName){var regex=new RegExp("<(/)?"+(nsName?nsName+":":"")+"math[^>]*>","g");return mathML.replace(regex,"").replace(/^\s*[\r\n]/gm,"").replace(/\s*[\r\n]$/gm,"")}function _stripNamespace(mathML,nsName){var regex=new RegExp("<(/)?"+(nsName?nsName+":":""),"g");return mathML.replace(regex,"<$1")}function _isEmptyMathML(mathStr){var hasContent=!1,$math,mathText;return mathStr&&mathStr.trim()&&($math=$($.parseHTML(mathStr)),mathText=$math.text(),hasContent=_.isString(mathText)&&!!mathText.trim()),!hasContent}$=$&&Object.prototype.hasOwnProperty.call($,"default")?$["default"]:$,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,Element=Element&&Object.prototype.hasOwnProperty.call(Element,"default")?Element["default"]:Element,rendererConfig=rendererConfig&&Object.prototype.hasOwnProperty.call(rendererConfig,"default")?rendererConfig["default"]:rendererConfig,NamespacedElement=NamespacedElement&&Object.prototype.hasOwnProperty.call(NamespacedElement,"default")?NamespacedElement["default"]:NamespacedElement;var Math;Math=Element.extend({qtiClass:"math",defaultNsName:"m",defaultNsUri:"http://www.w3.org/1998/Math/MathML",nsUriFragment:"MathML",init:function init(serial,attributes){this._super(serial,attributes),this.ns=null,this.mathML="",this.annotations={}},setAnnotation:function setAnnotation(encoding,value){this.annotations[encoding]=_.unescape(value)},getAnnotation:function getAnnotation(encoding){return this.annotations[encoding]},removeAnnotation:function removeAnnotation(encoding){delete this.annotations[encoding]},setMathML:function setMathML(mathML){var ns=this.getNamespace(),nsName=ns.name&&ns.uri?ns.name:"";mathML=_stripMathTags(mathML,nsName),ns&&(mathML=_stripNamespace(mathML,nsName)),this.mathML=mathML},getMathML:function getMathML(){return this.mathML},render:function render(){var args=rendererConfig.getOptionsFromArguments(arguments),renderer=args.renderer||this.getRenderer(),tag=this.qtiClass,raw=this.mathML,body=raw,ns=this.getNamespace(),annotations="",encoding,defaultData;for(encoding in this.annotations)annotations+="<annotation encoding=\""+encoding+"\">"+_.escape(this.annotations[encoding])+"</annotation>";return annotations&&(0<raw.indexOf("</semantics>")?raw=raw.replace("</semantics>",annotations+"</semantics>"):raw="<semantics>"+raw+annotations+"</semantics>"),ns&&ns.name&&(body=raw.replace(/<(\/)?([^!<])/g,"<$1"+ns.name+":$2"),tag=ns.name+":"+tag),body=body.replace(/<!--.*?-->/g,""),body=body.replace(/&lt;!--.*?--&gt;/g,""),defaultData={block:"block"===this.attr("display"),body:body,raw:raw,tag:tag,ns:ns},this._super(_.merge(defaultData,args.data),args.placeholder,args.subclass,renderer)},isEmpty:function isEmpty(){return _isEmptyMathML(this.mathML)&&(!this.annotations.latex||!this.annotations.latex.trim())}}),NamespacedElement.augment(Math);var Math$1=Math;return Math$1}),define("taoQtiItem/qtiItem/core/PortableInfoControl",["lodash","taoQtiItem/qtiItem/core/Element","taoQtiItem/qtiItem/mixin/CustomElement","taoQtiItem/qtiItem/mixin/NamespacedElement","taoQtiItem/qtiItem/helper/rendererConfig"],function(_,Element,CustomElement,NamespacedElement,rendererConfig){'use strict';_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,Element=Element&&Object.prototype.hasOwnProperty.call(Element,"default")?Element["default"]:Element,CustomElement=CustomElement&&Object.prototype.hasOwnProperty.call(CustomElement,"default")?CustomElement["default"]:CustomElement,NamespacedElement=NamespacedElement&&Object.prototype.hasOwnProperty.call(NamespacedElement,"default")?NamespacedElement["default"]:NamespacedElement,rendererConfig=rendererConfig&&Object.prototype.hasOwnProperty.call(rendererConfig,"default")?rendererConfig["default"]:rendererConfig;var PortableInfoControl=Element.extend({qtiClass:"infoControl",defaultNsName:"pic",defaultNsUri:"http://www.imsglobal.org/xsd/portableInfoControl",nsUriFragment:"portableInfoControl",defaultMarkupNsName:"html5",defaultMarkupNsUri:"html5",init:function init(serial,attributes){this._super(serial,attributes),this.typeIdentifier="",this.markup="",this.properties={},this.libraries=[],this.entryPoint="",this.markupNs={},this.readyStack=[]},is:function is(qtiClass){return"infoControl"===qtiClass||this._super(qtiClass)},render:function render(){var args=rendererConfig.getOptionsFromArguments(arguments),renderer=args.renderer||this.getRenderer(),defaultData={typeIdentifier:this.typeIdentifier,markup:this.markup,properties:this.properties,libraries:this.libraries,entryPoint:this.entryPoint,ns:{pic:this.getNamespace().name+":"}};return this._super(_.merge(defaultData,args.data),args.placeholder,args.subclass,renderer)},getState:function(){var ret=null,renderer=this.getRenderer();return renderer&&_.isFunction(renderer.getState)&&(ret=renderer.getState(this)),ret},setState:function(state){var renderer=this.getRenderer();renderer&&_.isFunction(renderer.getState)&&renderer.setState(this,state)},toArray:function toArray(){var arr=this._super();return arr.markup=this.markup,arr.properties=this.properties,arr},onReady:function(cb){this.readyStack.push(cb),this.data("_ready")&&this.data("pic")&&this.triggerReady()},triggerReady:function(){var self=this;_.forEach(this.readyStack,function(cb){cb.call(self,self.data("pic"))}),this.readyStack=[],this.data("_ready",!0)}});return CustomElement.augment(PortableInfoControl),NamespacedElement.augment(PortableInfoControl),PortableInfoControl}),define("taoQtiItem/qtiItem/core/PrintedVariable",["taoQtiItem/qtiItem/core/Element"],function(Element){'use strict';Element=Element&&Object.prototype.hasOwnProperty.call(Element,"default")?Element["default"]:Element;var PrintedVariable=Element.extend({qtiClass:"printedVariable"});return PrintedVariable}),define("taoQtiItem/qtiItem/core/response/SimpleFeedbackRule",["taoQtiItem/qtiItem/core/Element","lodash"],function(Element,_){'use strict';Element=Element&&Object.prototype.hasOwnProperty.call(Element,"default")?Element["default"]:Element,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_;var SimpleFeedbackRule=Element.extend({qtiClass:"_simpleFeedbackRule",serial:"",rootElement:null,init:function init(serial,feedbackOutcome,feedbackThen,feedbackElse){this._super(serial,{}),this.condition="correct",this.comparedOutcome=null,this.comparedValue=0,this.feedbackOutcome=feedbackOutcome,this.feedbackThen=Element.isA(feedbackThen,"feedback")?feedbackThen:null,this.feedbackElse=Element.isA(feedbackElse,"feedback")?feedbackThen:null},setCondition:function setCondition(comparedOutcome,condition,comparedValue){var _comparedValues=[];if(Element.isA(comparedOutcome,"variableDeclaration"))switch(condition){case"correct":case"incorrect":if(Element.isA(comparedOutcome,"responseDeclaration"))this.comparedOutcome=comparedOutcome,this.condition=condition;else throw"invalid outcome type: must be a responseDeclaration";break;case"lt":case"lte":case"equal":case"gte":case"gt":if(null!==comparedValue&&void 0!==comparedValue)this.comparedOutcome=comparedOutcome,this.condition=condition,this.comparedValue=comparedValue;else throw"compared value must not be null";break;case"choices":if(Element.isA(comparedOutcome,"responseDeclaration")&&null!==comparedValue&&_.isArray(comparedValue)){var choices=_.values(comparedOutcome.getInteraction().getChoices());this.comparedOutcome=comparedOutcome,this.condition=condition,_.each(comparedValue,function(v){v instanceof Element?_comparedValues.push(v):_.isString(v)&&_.each(choices,function(c){if(c.attr("identifier")===v)return _comparedValues.push(c),!1})}),this.comparedValue=_comparedValues}else throw"compared value must not be null";break;default:throw"unknown condition type : ".condition;}else throw"invalid outcome type: must be a variableDeclaration";return this},setFeedbackElse:function setFeedbackElse(feedback){Element.isA(feedback,"feedback")&&(this.feedbackElse=feedback)},toArray:function toArray(){var val=this.comparedValue,_toString=function(){return val instanceof Element?val.attr("identifier"):val+""};return val=_.isArray(val)?_.map(val,_toString):_toString(),{condition:this.condition,comparedOutcome:this.comparedOutcome.id(),comparedValue:val}}});return SimpleFeedbackRule}),define("taoQtiItem/qtiItem/core/ResponseProcessing",["taoQtiItem/qtiItem/core/Element"],function(Element){'use strict';Element=Element&&Object.prototype.hasOwnProperty.call(Element,"default")?Element["default"]:Element;var ResponseProcessing=Element.extend({qtiClass:"responseProcessing",processingType:"",xml:"",toArray:function toArray(){var arr=this._super();return arr.processingType=this.processingType,arr.xml=this.xml,arr}});return ResponseProcessing}),define("taoQtiItem/qtiItem/core/RubricBlock",["taoQtiItem/qtiItem/core/Element","taoQtiItem/qtiItem/mixin/Container"],function(Element,Container){'use strict';Element=Element&&Object.prototype.hasOwnProperty.call(Element,"default")?Element["default"]:Element,Container=Container&&Object.prototype.hasOwnProperty.call(Container,"default")?Container["default"]:Container;var RubricBlock=Element.extend({qtiClass:"rubricBlock",isEmpty:function(){return!(this.bdy&&this.bdy.body())}});return Container.augment(RubricBlock),RubricBlock}),define("taoQtiItem/qtiItem/core/Stylesheet",["taoQtiItem/qtiItem/core/Element","lodash","taoQtiItem/qtiItem/helper/rendererConfig"],function(Element,_,rendererConfig){'use strict';Element=Element&&Object.prototype.hasOwnProperty.call(Element,"default")?Element["default"]:Element,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,rendererConfig=rendererConfig&&Object.prototype.hasOwnProperty.call(rendererConfig,"default")?rendererConfig["default"]:rendererConfig;var Stylesheet=Element.extend({qtiClass:"stylesheet",render:function render(){var args=rendererConfig.getOptionsFromArguments(arguments),renderer=args.renderer||this.getRenderer(),defaultData={};return defaultData.attributes={href:renderer.resolveUrl(this.attr("href"))},this._super(_.merge(defaultData,args.data),args.placeholder,args.subclass,renderer)}});return Stylesheet}),define("taoQtiItem/qtiItem/mixin/ContainerTable",["taoQtiItem/qtiItem/mixin/Mixin","taoQtiItem/qtiItem/mixin/Container","lodash"],function(Mixin,Container,_){'use strict';Mixin=Mixin&&Object.prototype.hasOwnProperty.call(Mixin,"default")?Mixin["default"]:Mixin,Container=Container&&Object.prototype.hasOwnProperty.call(Container,"default")?Container["default"]:Container,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_;var methods={};_.extend(methods,Container.methods),_.extend(methods,{initContainer:function initContainer(body){Container.methods.initContainer.call(this,body),this.bdy.contentModel="table"}});return{augment:function augment(targetClass){Mixin.augment(targetClass,methods)},methods:methods}}),define("taoQtiItem/qtiItem/core/Table",["lodash","taoQtiItem/qtiItem/core/Element","taoQtiItem/qtiItem/mixin/ContainerTable"],function(_,Element,Container){'use strict';_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,Element=Element&&Object.prototype.hasOwnProperty.call(Element,"default")?Element["default"]:Element,Container=Container&&Object.prototype.hasOwnProperty.call(Container,"default")?Container["default"]:Container;var Table=Element.extend({qtiClass:"table"});Container.augment(Table),Table=Table.extend({body:function body(newBody){return _.isString(newBody)&&(newBody=newBody.replace("<table>","").replace("</table>","")),this._super(newBody)}});var Table$1=Table;return Table$1}),define("taoQtiItem/qtiItem/core/Tooltip",["lodash","taoQtiItem/qtiItem/core/Element","taoQtiItem/qtiItem/mixin/ContainerInline","taoQtiItem/qtiItem/helper/rendererConfig"],function(_,Element,ContainerInline,rendererConfig){'use strict';_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,Element=Element&&Object.prototype.hasOwnProperty.call(Element,"default")?Element["default"]:Element,ContainerInline=ContainerInline&&Object.prototype.hasOwnProperty.call(ContainerInline,"default")?ContainerInline["default"]:ContainerInline,rendererConfig=rendererConfig&&Object.prototype.hasOwnProperty.call(rendererConfig,"default")?rendererConfig["default"]:rendererConfig;var Tooltip=Element.extend({qtiClass:"_tooltip",init:function init(serial,attributes,newContent){this._super(serial,attributes),this.content(newContent||"")},content:function(newContent){if("undefined"==typeof newContent)return this.tooltipContent;if("string"==typeof newContent)this.tooltipContent=newContent;else throw new Error("newContent must be a string");return this},render:function render(){var args=rendererConfig.getOptionsFromArguments(arguments),renderer=args.renderer||this.getRenderer(),defaultData={content:this.tooltipContent};return this._super(_.merge(defaultData,args.data),args.placeholder,args.subclass,renderer)}});return ContainerInline.augment(Tooltip),Tooltip}),define("taoQtiItem/qtiItem/core/variables/ResponseDeclaration",["taoQtiItem/qtiItem/core/variables/VariableDeclaration","lodash"],function(VariableDeclaration,_){'use strict';VariableDeclaration=VariableDeclaration&&Object.prototype.hasOwnProperty.call(VariableDeclaration,"default")?VariableDeclaration["default"]:VariableDeclaration,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_;var ResponseDeclaration=VariableDeclaration.extend({qtiClass:"responseDeclaration",init:function init(serial,attributes){this._super(serial,attributes),this.template="",this.mappingAttributes={},this.mapEntries={},this.correctResponse=null,this.feedbackRules={}},getFeedbackRules:function getFeedbackRules(){return _.values(this.feedbackRules)},getComposingElements:function getComposingElements(){var elts=this._super();return elts=_.extend(elts,this.feedbackRules),elts},toArray:function toArray(){var arr=this._super();return arr.howMatch=this.template,arr.correctResponses=this.correctResponse,arr.mapping=this.mapEntries,arr.mappingAttributes=this.mappingAttributes,arr.feedbackRules=_.map(this.feedbackRules,function(rule){return rule.toArray()}),arr},getInteraction:function getInteraction(){var interaction=null,responseId=this.id(),item=this.getRootElement(),interactions=item.getInteractions();return _.each(interactions,function(i){if(i.attributes.responseIdentifier===responseId)return interaction=i,!1}),interaction},isCardinality:function isCardinality(cardinalities){var comparison;if(_.isArray(cardinalities))comparison=cardinalities;else if(_.isString(cardinalities))cardinalities=[cardinalities];else return!1;return 0<=_.indexOf(comparison,this.attr("cardinality"))}});return ResponseDeclaration}),define("taoQtiItem/qtiItem/helper/EventMgr",["lodash"],function(_){'use strict';return _=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,function(){var events={};this.get=function(event){return event&&events[event]?_.clone(events[event]):[]},this.on=function(event,callback){var tokens=event.split(".");if(tokens[0]){var name=tokens.shift();events[name]=events[name]||[],events[name].push({ns:tokens,callback:callback})}},this.off=function(event){event&&events[event]&&(events[event]=[])},this.trigger=function(event,data){events[event]&&_.each(events[event],function(e){e.callback.apply({type:event,ns:[]},data)})}}}),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/modalFeedback",["jquery","lodash","taoQtiItem/qtiItem/helper/pci","taoQtiItem/qtiItem/helper/container"],function($,_,pci,containerHelper){'use strict';$=$&&Object.prototype.hasOwnProperty.call($,"default")?$["default"]:$,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,pci=pci&&Object.prototype.hasOwnProperty.call(pci,"default")?pci["default"]:pci,containerHelper=containerHelper&&Object.prototype.hasOwnProperty.call(containerHelper,"default")?containerHelper["default"]:containerHelper;var getFeedbackMessageSignature=function(feedback){return(""+feedback.body()+feedback.attr("title")).toLowerCase().trim().replace(/x-tao-[a-zA-Z0-9\-._\s]*/g,"")},extractDisplayInfo=function(interaction){var $interactionContainer=interaction.getContainer(),responseIdentifier=interaction.attr("responseIdentifier"),messageGroupId,$displayContainer;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}},getInteractionsDisplayInfo=function(item){var interactionsDisplayInfo=[],$itemContainer=item.getContainer(),interactionOrder=0;return _.forEach(item.getComposingElements(),function(element){element.is("interaction")&&interactionsDisplayInfo.push(extractDisplayInfo(element))}),$itemContainer.find(".qti-interaction").each(function(){var self=this;_.forEach(interactionsDisplayInfo,function(_interactionInfo){if(_interactionInfo.interactionContainer[0]===self)return _interactionInfo.order=interactionOrder,!1}),interactionOrder++}),interactionsDisplayInfo=_.sortBy(interactionsDisplayInfo,"order"),interactionsDisplayInfo},getFeedbacks=function(item,itemSession){var messages={},$itemContainer=item.getContainer(),$itemBody=$(".qti-itemBody",$itemContainer),interactionsDisplayInfo=getInteractionsDisplayInfo(item),renderingQueue=[];return _.forEach(item.modalFeedbacks,function(feedback){var outcomeIdentifier=feedback.attr("outcomeIdentifier"),order=-1,feedbackIds,message,$container,comparedOutcome,_currentMessageGroupId,interactionInfo;if(itemSession[outcomeIdentifier]){if(feedbackIds=pci.getRawValues(itemSession[outcomeIdentifier]),!_.contains(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]=[]),_.contains(messages[_currentMessageGroupId],message))return!0;messages[_currentMessageGroupId].push(message),renderingQueue.push({feedback:feedback,$container:$container,order:order})}}),renderingQueue=_.sortBy(renderingQueue,"order"),renderingQueue};return{getFeedbacks:getFeedbacks}}),define("taoQtiItem/qtiItem/helper/Parser",["jquery"],function($){'use strict';$=$&&Object.prototype.hasOwnProperty.call($,"default")?$["default"]:$;return function Parser(){var _$xml=null;this.loadXML=function(xml){_$xml=$.parseXML(xml)},this.getDOM=function(){return _$xml}}}),define("taoQtiItem/qtiItem/helper/simpleParser",["lodash","jquery","taoQtiItem/qtiItem/helper/util","taoQtiItem/qtiItem/core/Loader"],function(_,$,util,Loader){'use strict';function _getElementSelector(qtiClass,ns){return ns?ns+"\\:"+qtiClass+","+qtiClass:qtiClass}function getQtiClassFromXmlDom($node){var qtiClass=$node.prop("tagName").toLowerCase();return qtiClass=qtiClass.replace(/.*:/,""),_qtiClassNames[qtiClass]?_qtiClassNames[qtiClass]:qtiClass}function buildElement($elt){var qtiClass=getQtiClassFromXmlDom($elt),elt={qtiClass:qtiClass,serial:util.buildSerial(qtiClass+"_"),attributes:{}};return $.each($elt[0].attributes,function(){var attrName;this.specified&&(attrName=_qtiAttributesNames[this.name]||this.name,elt.attributes[attrName]=this.value)}),elt}function buildMath($elt,options){var elt=buildElement($elt);return elt.annotations={},$elt.find(_getElementSelector("annotation",options.ns.math)).each(function(){var $annotation=$(this),encoding=$annotation.attr("encoding");encoding&&(elt.annotations[encoding]=_.unescape($annotation.html())),$annotation.remove()}),elt.mathML=$elt.html(),elt.ns={name:"m",uri:"http://www.w3.org/1998/Math/MathML"},elt}function buildTooltip(targetHtml,contentId,contentHtml){return{elements:{},qtiClass:"_tooltip",serial:util.buildSerial("_tooltip_"),attributes:{"aria-describedby":contentId},content:contentHtml,body:{elements:{},serial:util.buildSerial("container"),body:targetHtml}}}function parseTable($elt,elt,options){elt.body={body:"",elements:{}};var $parsedTable=parseContainer($elt,options);return elt.body.body=$parsedTable.body,elt.body.elements=$parsedTable.elements,elt}function parseContainer($container,options){var ret={serial:util.buildSerial("_container_"),body:"",elements:{}};return $container.find("table").each(function(){var $qtiElement=$(this),element=buildElement($qtiElement);element=parseTable($qtiElement,element,options),ret.elements[element.serial]=element,$qtiElement.replaceWith(_placeholder(element))}),$container.find(_getElementSelector("math",options.ns.math)).each(function(){var $qtiElement=$(this),element=buildMath($qtiElement,options);ret.elements[element.serial]=element,$qtiElement.replaceWith(_placeholder(element))}),$container.find(_getElementSelector("include",options.ns.include)).each(function(){var $qtiElement=$(this),element=buildElement($qtiElement);ret.elements[element.serial]=element,$qtiElement.replaceWith(_placeholder(element))}),$container.find("[data-role=\"tooltip-target\"]").each(function(){var $target=$(this),contentId=$target.attr("aria-describedBy"),element,$content,contentHtml;contentId&&($content=$container.find("#"+contentId),$content.length&&(contentHtml=$content.html(),element=buildTooltip($target.html(),contentId,contentHtml),ret.elements[element.serial]=element,$target.replaceWith(_placeholder(element)),$content.remove()))}),_.each(_parsableElements,function(qtiClass){$container.find(qtiClass).each(function(){var $qtiElement=$(this),element=buildElement($qtiElement);ret.elements[element.serial]=element,$qtiElement.replaceWith(_placeholder(element))})}),ret.body=$container.html(),ret}function _placeholder(element){return"{{"+element.serial+"}}"}_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,$=$&&Object.prototype.hasOwnProperty.call($,"default")?$["default"]:$,util=util&&Object.prototype.hasOwnProperty.call(util,"default")?util["default"]:util,Loader=Loader&&Object.prototype.hasOwnProperty.call(Loader,"default")?Loader["default"]:Loader;var _parsableElements=["img","object","printedVariable"],_qtiClassNames={rubricblock:"rubricBlock",printedvariable:"printedVariable"},_qtiAttributesNames={powerform:"powerForm",mappingindicator:"mappingIndicator"},_defaultOptions={ns:{math:"",include:"xi",table:"table",image:"img",object:""},loaded:null,model:null},parser;parser={parse:function parse(xmlStr,opts){var options=_.merge(_.clone(_defaultOptions),opts||{}),$container=$(xmlStr),element=buildElement($container),data=parseContainer($container,options),loader;return _.isUndefined(data.body)||(element.body=data),_.isFunction(options.loaded)&&options.model&&(loader=new Loader().setClassesLocation(options.model),loader.loadAndBuildElement(element,options.loaded)),element}};var parser$1=parser;return parser$1}),define("taoQtiItem/qtiItem/helper/xincludeLoader",["jquery","lodash","taoQtiItem/qtiItem/helper/simpleParser","taoQtiItem/qtiItem/core/Loader"],function($,_,simpleParser,Loader){'use strict';$=$&&Object.prototype.hasOwnProperty.call($,"default")?$["default"]:$,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,simpleParser=simpleParser&&Object.prototype.hasOwnProperty.call(simpleParser,"default")?simpleParser["default"]:simpleParser,Loader=Loader&&Object.prototype.hasOwnProperty.call(Loader,"default")?Loader["default"]:Loader;return{load:function(xinclude,baseUrl,callback){var href=xinclude.attr("href");href&&baseUrl&&require(["text!".concat(baseUrl).concat(href)],function(stimulusXml){var $wrapper=$.parseXML(stimulusXml),$sampleXMLrootNode=$wrapper.children,$stimulus=$("<include>").append($sampleXMLrootNode),data=simpleParser.parse($stimulus,{ns:{math:"m"}});new Loader().loadElement(xinclude,data,function(){if(_.isFunction(callback)){var loadedClasses=this.getLoadedClasses();loadedClasses.push("_container"),callback(xinclude,data,loadedClasses)}})},function(){callback(xinclude,!1,[])})}}}),define("taoQtiItem/runner/provider/manager/picManager",["jquery","lodash","taoQtiItem/qtiItem/core/Element"],function($,_,Element){'use strict';$=$&&Object.prototype.hasOwnProperty.call($,"default")?$["default"]:$,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,Element=Element&&Object.prototype.hasOwnProperty.call(Element,"default")?Element["default"]:Element;var picManager={init:function(pic,item){return Element.isA(pic,"infoControl")&&(this._pic=pic),Element.isA(item,"assessmentItem")&&(this._item=item),this},getPic:function(){return this._pic},getItem:function(){return this._item},getSerial:function(){return this._pic&&this._pic.serial},getTypeIdentifier:function(){return this._pic&&this._pic.typeIdentifier},getDom:function(){if(!this._dom){var serial=this.getSerial(),pic,tool;serial&&(pic=$("[data-serial=\""+serial+"\"]"),pic.length&&(tool=$("[data-pic-serial=\""+serial+"\"]"),!tool.length&&(tool=pic.children().first()),this._dom={pic:pic,tool:tool,button:tool.find(".sts-button"),broken:pic.is(":empty")}))}return this._dom},enable:function(){var dom=this.getDom();return dom&&(dom.button.removeClass("disabled"),dom.tool.find(".sts-button-disable-mask").remove(),this.disabled=!1,this.trigger("enable")),this},disable:function(){var dom=this.getDom(),button;return dom&&(button=dom.button.addClass("disabled"),$("<div class=\"sts-button-disable-mask\" style=\"position:absolute;z-index:10000000000000\"></div>").appendTo(dom.tool).offset(button.offset()).width(button.outerWidth()).height(button.outerHeight()),dom.tool.find(".sts-container, .sts-menu-container").addClass("sts-hidden-container"),this.disabled=!0,this.trigger("disable")),this},show:function(){var dom=this.getDom();return dom&&(dom.tool.show(),this.trigger("show")),this},hide:function(){var dom=this.getDom();return dom&&(dom.tool.hide(),this.trigger("hide")),this},trigger:function(eventName){var dom=this.getDom(),args=_.rest(arguments,1);return args.unshift(this),dom&&(dom.tool.trigger(eventName,args),dom.broken&&dom.pic.trigger(eventName,args)),this}},picManagerCollection={init:function(item){return Element.isA(item,"assessmentItem")&&(this._item=item),this},getList:function(force){var self=this;return(force||!self._list)&&(self._map={},self._list=[],self._item&&_.forEach(self._item.getElements(),function(element){var manager;Element.isA(element,"infoControl")&&(manager=managerFactory(element,self._item),self._list.push(manager),self._map[element.serial]=manager,self._map[element.typeIdentifier]=manager)})),this._list},getPic:function(picId){return this.getList(),this._map[picId]},execute:function(picId,action){var pic=this.getPic(picId);if(pic&&pic[action])return pic[action].apply(pic,_.rest(arguments,2))},executeAll:function(action,filter){var args=_.rest(arguments,2),cb;return cb="function"==typeof filter?function(pic){filter.call(pic,pic)&&pic[action]&&pic[action].apply(pic,args)}:function(pic){pic[action]&&pic[action].apply(pic,args)},this.each(cb)},each:function(cb){return _.forEach(this.getList(),cb),this},enablePic:function(picId){return this.execute(picId,"enable"),this},disablePic:function(picId){return this.execute(picId,"disable"),this},showPic:function(picId){return this.execute(picId,"show"),this},hidePic:function(picId){return this.execute(picId,"hide"),this},enableAll:function(filter){return this.executeAll("enable",filter),this},disableAll:function(filter){return this.executeAll("disable",filter),this},showAll:function(filter){return this.executeAll("show",filter),this},hideAll:function(filter){return this.executeAll("hide",filter),this}},managerFactory=function(pic,item){var manager=_.clone(picManager,!0);return manager.init(pic,item)},collectionFactory=function(item){var collection=_.clone(picManagerCollection,!0);return collection.init(item)};return{collection:collectionFactory,manager:managerFactory}}),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/portableElementRegistry/provider/sideLoadingProviderFactory",[],function(){'use strict';return function(portableElements){var _registry=portableElements;return{add:function(id,portableElement){return _registry[id]=portableElement,this},load:function(){return _registry}}}}),define("taoQtiItem/reviewRenderer/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 handle(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:"reviewRenderer",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",infoControl:"taoQtiItem/qtiCommonRenderer/renderers/PortableInfoControl",include:"taoQtiItem/qtiCommonRenderer/renderers/Include",choiceInteraction:"taoQtiItem/reviewRenderer/renderers/interactions/ChoiceInteraction",extendedTextInteraction:"taoQtiItem/reviewRenderer/renderers/interactions/ExtendedTextInteraction",orderInteraction:"taoQtiItem/reviewRenderer/renderers/interactions/OrderInteraction",associateInteraction:"taoQtiItem/reviewRenderer/renderers/interactions/AssociateInteraction",matchInteraction:"taoQtiItem/reviewRenderer/renderers/interactions/MatchInteraction",textEntryInteraction:"taoQtiItem/reviewRenderer/renderers/interactions/TextEntryInteraction",sliderInteraction:"taoQtiItem/reviewRenderer/renderers/interactions/SliderInteraction",inlineChoiceInteraction:"taoQtiItem/reviewRenderer/renderers/interactions/InlineChoiceInteraction","simpleChoice.choiceInteraction":"taoQtiItem/reviewRenderer/renderers/choices/SimpleChoice.ChoiceInteraction",hottext:"taoQtiItem/reviewRenderer/renderers/choices/Hottext",inlineChoice:"taoQtiItem/qtiCommonRenderer/renderers/choices/InlineChoice",hottextInteraction:"taoQtiItem/qtiCommonRenderer/renderers/interactions/HottextInteraction",hotspotInteraction:"taoQtiItem/reviewRenderer/renderers/interactions/HotspotInteraction",hotspotChoice:!1,associableHotspot:!1,gapMatchInteraction:"taoQtiItem/reviewRenderer/renderers/interactions/GapMatchInteraction",selectPointInteraction:"taoQtiItem/reviewRenderer/renderers/interactions/SelectPointInteraction",graphicOrderInteraction:"taoQtiItem/reviewRenderer/renderers/interactions/GraphicOrderInteraction",graphicAssociateInteraction:"taoQtiItem/reviewRenderer/renderers/interactions/GraphicAssociateInteraction",graphicGapMatchInteraction:"taoQtiItem/reviewRenderer/renderers/interactions/GraphicGapMatchInteraction",uploadInteraction:"taoQtiItem/reviewRenderer/renderers/interactions/UploadInteraction",customInteraction:"taoQtiItem/reviewRenderer/renderers/interactions/PortableCustomInteraction",mediaInteraction:"taoQtiItem/reviewRenderer/renderers/interactions/MediaInteraction",gap:"taoQtiItem/qtiCommonRenderer/renderers/choices/Gap",gapText:"taoQtiItem/qtiCommonRenderer/renderers/choices/GapText","simpleChoice.orderInteraction":"taoQtiItem/qtiCommonRenderer/renderers/choices/SimpleChoice.OrderInteraction","simpleAssociableChoice.matchInteraction":"taoQtiItem/qtiCommonRenderer/renderers/choices/SimpleAssociableChoice.MatchInteraction","simpleAssociableChoice.associateInteraction":"taoQtiItem/qtiCommonRenderer/renderers/choices/SimpleAssociableChoice.AssociateInteraction",gapImg:"taoQtiItem/qtiCommonRenderer/renderers/choices/GapImg",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/reviewRenderer/renderers/Renderer",["taoQtiItem/qtiRunner/core/Renderer","taoQtiItem/reviewRenderer/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/reviewRenderer/renderers/rendererProvider",["taoQtiItem/reviewRenderer/renderers/Renderer"],function(ReviewRenderer){'use strict';ReviewRenderer=ReviewRenderer&&Object.prototype.hasOwnProperty.call(ReviewRenderer,"default")?ReviewRenderer["default"]:ReviewRenderer;return{name:"reviewRenderer",init:function init(){},getRenderer:function getRenderer(){return ReviewRenderer}}}),define("taoQtiItem/runner/rendererStrategies",["core/logger","core/providerRegistry","taoQtiItem/qtiCommonRenderer/renderers/rendererProvider","taoQtiItem/reviewRenderer/renderers/rendererProvider"],function(loggerFactory,providerRegistry,qtiRenderer,reviewRenderer){'use strict';function getProviderName(name){var providers=rendererStrategies.getAvailableProviders();return providers.includes(name)?name:alias[name]?alias[name]:(name&&logger.warn("Unknown QTI Item Runner renderer ".concat(name,"!")),defaultRenderer)}function rendererStrategies(rendererName){var providerName=getProviderName(rendererName),provider=rendererStrategies.getProvider(providerName);return{init:function init(){return provider.init.call(this),this},getName:function getName(){return provider.name},getRenderer:function getRenderer(){return provider.getRenderer()}}.init()}loggerFactory=loggerFactory&&Object.prototype.hasOwnProperty.call(loggerFactory,"default")?loggerFactory["default"]:loggerFactory,providerRegistry=providerRegistry&&Object.prototype.hasOwnProperty.call(providerRegistry,"default")?providerRegistry["default"]:providerRegistry,qtiRenderer=qtiRenderer&&Object.prototype.hasOwnProperty.call(qtiRenderer,"default")?qtiRenderer["default"]:qtiRenderer,reviewRenderer=reviewRenderer&&Object.prototype.hasOwnProperty.call(reviewRenderer,"default")?reviewRenderer["default"]:reviewRenderer;var logger=loggerFactory("taoQtiItem/runner/rendererStrategies"),defaultRenderer=qtiRenderer.name,alias={author:qtiRenderer.name,candidate:qtiRenderer.name,proctor:reviewRenderer.name,scorer:reviewRenderer.name,testConstructor:qtiRenderer.name,tutor:reviewRenderer.name};return providerRegistry(rendererStrategies),rendererStrategies.registerProvider(qtiRenderer.name,qtiRenderer),rendererStrategies.registerProvider(reviewRenderer.name,reviewRenderer),rendererStrategies}),define("taoQtiItem/runner/provider/qti",["jquery","lodash","context","taoQtiItem/qtiItem/core/Loader","taoQtiItem/qtiItem/core/Element","taoQtiItem/portableElementRegistry/ciRegistry","taoQtiItem/portableElementRegistry/icRegistry","taoQtiItem/portableElementRegistry/provider/sideLoadingProviderFactory","taoQtiItem/runner/rendererStrategies","taoQtiItem/runner/provider/manager/picManager","taoQtiItem/runner/provider/manager/userModules","taoQtiItem/qtiItem/helper/modalFeedback","taoItems/assets/manager","util/locale"],function($,_,context,QtiLoader,Element,ciRegistry,icRegistry,sideLoadingProviderFactory,rendererStrategies,picManager,userModules,modalFeedbackHelper,manager,locale){'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,QtiLoader=QtiLoader&&Object.prototype.hasOwnProperty.call(QtiLoader,"default")?QtiLoader["default"]:QtiLoader,Element=Element&&Object.prototype.hasOwnProperty.call(Element,"default")?Element["default"]:Element,ciRegistry=ciRegistry&&Object.prototype.hasOwnProperty.call(ciRegistry,"default")?ciRegistry["default"]:ciRegistry,icRegistry=icRegistry&&Object.prototype.hasOwnProperty.call(icRegistry,"default")?icRegistry["default"]:icRegistry,sideLoadingProviderFactory=sideLoadingProviderFactory&&Object.prototype.hasOwnProperty.call(sideLoadingProviderFactory,"default")?sideLoadingProviderFactory["default"]:sideLoadingProviderFactory,rendererStrategies=rendererStrategies&&Object.prototype.hasOwnProperty.call(rendererStrategies,"default")?rendererStrategies["default"]:rendererStrategies,picManager=picManager&&Object.prototype.hasOwnProperty.call(picManager,"default")?picManager["default"]:picManager,userModules=userModules&&Object.prototype.hasOwnProperty.call(userModules,"default")?userModules["default"]:userModules,modalFeedbackHelper=modalFeedbackHelper&&Object.prototype.hasOwnProperty.call(modalFeedbackHelper,"default")?modalFeedbackHelper["default"]:modalFeedbackHelper,locale=locale&&Object.prototype.hasOwnProperty.call(locale,"default")?locale["default"]:locale;var timeout=1e3*(0<context.timeout?context.timeout+1:30);return{init:function init(itemData,done){var self=this,rendererOptions=_.merge({assetManager:this.assetManager},_.pick(this.options,["themes","preload","view"])),Renderer=rendererStrategies(rendererOptions.view).getRenderer();this._renderer=new Renderer(rendererOptions),this._loader=new QtiLoader,this._loader.loadItemData(itemData,function(item){return item?void(self._item=item,self._renderer.load(function(){self._item.setRenderer(this),done()},this.getLoadedClasses())):self.trigger("error","Unable to load item from the given data.")})},render:function render(elt,done,options){var self=this;if(options=_.defaults(options||{},{state:{}}),this._item){try{elt.innerHTML=this._item.render({});var $item=$(elt).find(".qti-item"),$itemBody=$item.find(".qti-itemBody"),itemDir=$itemBody.attr("dir");if(!itemDir){var itemLang=$item.attr("lang");$itemBody.attr("dir",locale.getLanguageDirection(itemLang))}}catch(e){self.trigger("error","Error in template rendering : "+e.message)}try{options.portableElements&&(options.portableElements.pci&&(ciRegistry.resetProviders(),ciRegistry.registerProvider("pciDeliveryProvider",sideLoadingProviderFactory(options.portableElements.pci))),options.portableElements.pic&&(icRegistry.resetProviders(),icRegistry.registerProvider("picDeliveryProvider",sideLoadingProviderFactory(options.portableElements.pic)))),Promise.race([Promise.all(this._item.postRender(options)),new Promise(function(resolve,reject){_.delay(reject,timeout,new Error("It seems that there is an error during item loading. The error has been reported. The test will be paused."))})]).then(function(){return $(elt).off("responseChange").on("responseChange",function(){self.trigger("statechange",self.getState()),self.trigger("responsechange",self.getResponses())}).off("endattempt").on("endattempt",function(e,responseIdentifier){self.trigger("endattempt",responseIdentifier||e.originalEvent.detail)}).off("themechange").on("themechange",function(e,themeName){var themeLoader=self._renderer.getThemeLoader();themeName=themeName||e.originalEvent.detail,themeLoader&&themeLoader.change(themeName)}),self.trigger("listpic",picManager.collection(self._item)),userModules.load().then(done)}).catch(function(renderingError){done();var error=new Error("Error in post rendering : "+renderingError instanceof Error?renderingError.message:renderingError);error.unrecoverable=!0,self.trigger("error",error)})}catch(err){self.trigger("error","Error in post rendering : "+err.message)}}},clear:function clear(elt,done){var self=this;self._item?Promise.all(this._item.getInteractions().map(function(interaction){return interaction.clear()})).then(function(){self._item.clear(),$(elt).off("responseChange").off("endattempt").off("themechange").off("feedback").empty(),self._renderer&&self._renderer.unload(),self._item=null}).then(done).catch(function(err){self.trigger("error","Something went wrong while destroying an interaction: "+err.message)}):done()},getState:function(){var state={};return this._item&&(_.forEach(this._item.getInteractions(),function(interaction){state[interaction.attr("responseIdentifier")]=interaction.getState()}),_.forEach(this._item.getElements(),function(element){Element.isA(element,"infoControl")&&element.attr("id")&&(state.pic=state.pic||{},state.pic[element.attr("id")]=element.getState())})),state},setState:function(state){this._item&&state&&(_.forEach(this._item.getInteractions(),function(interaction){var id=interaction.attr("responseIdentifier");id&&state[id]&&interaction.setState(state[id])}),state.pic&&_.forEach(this._item.getElements(),function(element){Element.isA(element,"infoControl")&&state.pic[element.attr("id")]&&element.setState(state.pic[element.attr("id")])}))},getResponses:function getResponses(){var responses={};return this._item&&_.reduce(this._item.getInteractions(),function(res,interaction){return responses[interaction.attr("responseIdentifier")]=interaction.getResponse(),responses},responses),responses},renderFeedbacks:function renderFeedbacks(feedbacks,itemSession,done){var self=this,_renderer=self._item.getRenderer(),_loader=new QtiLoader(self._item);_loader.loadElements(feedbacks,function(item){_renderer.load(function(){var renderingQueue=modalFeedbackHelper.getFeedbacks(item,itemSession);done(renderingQueue)},this.getLoadedClasses())})}}}),define("taoQtiItem/runner/qtiItemRunner",["taoItems/runner/api/itemRunner","taoQtiItem/runner/provider/qti"],function(itemRunner,qtiRuntimeProvider){'use strict';return itemRunner=itemRunner&&Object.prototype.hasOwnProperty.call(itemRunner,"default")?itemRunner["default"]:itemRunner,qtiRuntimeProvider=qtiRuntimeProvider&&Object.prototype.hasOwnProperty.call(qtiRuntimeProvider,"default")?qtiRuntimeProvider["default"]:qtiRuntimeProvider,itemRunner.register("qti",qtiRuntimeProvider),itemRunner}),define("taoQtiItem/loader/taoQtiItemRunner.bundle",function(){}),define("taoQtiItem/loader/taoQtiItemRunner.min",["taoItems/loader/taoItemsRunner.min"],function(){});
//# sourceMappingURL=taoQtiItemRunner.min.js.map