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);ii;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&®ex.test(allClassStr)};return Element.isA=function(qtiElement,qtiClass){return qtiElement instanceof Element&&qtiElement.is(qtiClass)},Element.getElementBySerial=function(serial){return _instances[serial]},Element.issetElement=function(serial){return!!_instances[serial]},Element.unsetElement=function(serial){var element=Element.getElementBySerial(serial);if(element){var composingElements=element.getComposingElements();return _.each(composingElements,function(elt){delete _instances[elt.serial]}),delete _instances[element.serial],!0}return!1},Element}),define("taoQtiItem/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;amaxWidth?containerWidth=maxWidth-diff:containerWidth-=diff,factor=containerWidth/imgWidth,containerHeight=imgHeight*factor,0bbox.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= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,self=this,stack1,helper;return buffer+="
\n ",(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)+"\n
",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= 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+="
\n ",(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)+"\n \n
\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?__("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?__("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]*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= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,self=this,stack1,helper;return buffer+="\r\n  \r\n",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= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,self=this,stack1,helper;return buffer+="
  • \n \n
  • ",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= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,self=this,stack1,helper;return 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
  • ",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= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,self=this,stack1,helper;return buffer+="\r\n \r\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+="\r\n",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= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,self=this,stack1,helper;return buffer+="",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= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,self=this,stack1,helper;return 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
  • ",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= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,self=this,stack1,helper;return 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",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\n \n ",buffer}function program5(depth0){var buffer="",stack1;return buffer+="\n \n \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+="
  • \n
    \n \n
    \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 \n \n \n \n
    \n
    \n
    \n \n
  • \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= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,self=this,stack1,helper;return 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
  • ",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&®istry.registerProvider(provider.module)}),registry}),define("taoQtiItem/portableElementRegistry/factory/icRegistry",["lodash","taoQtiItem/portableElementRegistry/factory/factory"],function(_,portableElementRegistry){'use strict';return function(){return portableElementRegistry()}}),define("taoQtiItem/portableElementRegistry/icRegistry",["lodash","taoQtiItem/portableElementRegistry/factory/icRegistry","module"],function(_,icRegistry,module){'use strict';var registry=icRegistry(),providers=[],config=module.config();return config&&config.providers&&(providers=config.providers),_.each(providers,function(provider){provider.name&&provider.module&®istry.registerProvider(provider.module)}),registry}),define("taoQtiItem/portableElementRegistry/assetManager/portableAssetStrategy",["taoQtiItem/portableElementRegistry/ciRegistry","taoQtiItem/portableElementRegistry/icRegistry"],function(ciRegistry,icRegistry){'use strict';function getBaseUrlByIdentifier(typeIdentifier){return ciRegistry.get(typeIdentifier)?ciRegistry.getBaseUrl(typeIdentifier):icRegistry.get(typeIdentifier)?icRegistry.getBaseUrl(typeIdentifier):typeIdentifier}return{name:"portableElementLocation",handle:function(url){if(url.file===url.path)return getBaseUrlByIdentifier(url.file);return url.source===url.relative?url.relative.replace(/^(\.\/)?([a-z_0-9]+)\/(.*)/i,function(fullmatch,$1,typeIdentifier,relPath){var runtimeLocation=getBaseUrlByIdentifier(typeIdentifier);return runtimeLocation?runtimeLocation+"/"+relPath:fullmatch}):void 0}}}),define("taoQtiItem/qtiCommonRenderer/renderers/config",["lodash","context","ui/themes","taoItems/assets/manager","taoItems/assets/strategies","module","taoQtiItem/portableElementRegistry/assetManager/portableAssetStrategy"],function(_,context,themes,assetManagerFactory,assetStrategies,module,portableAssetStrategy){'use strict';_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,context=context&&Object.prototype.hasOwnProperty.call(context,"default")?context["default"]:context,themes=themes&&Object.prototype.hasOwnProperty.call(themes,"default")?themes["default"]:themes,assetManagerFactory=assetManagerFactory&&Object.prototype.hasOwnProperty.call(assetManagerFactory,"default")?assetManagerFactory["default"]:assetManagerFactory,assetStrategies=assetStrategies&&Object.prototype.hasOwnProperty.call(assetStrategies,"default")?assetStrategies["default"]:assetStrategies,module=module&&Object.prototype.hasOwnProperty.call(module,"default")?module["default"]:module,portableAssetStrategy=portableAssetStrategy&&Object.prototype.hasOwnProperty.call(portableAssetStrategy,"default")?portableAssetStrategy["default"]:portableAssetStrategy;var itemThemes=themes.get("items"),moduleConfig=module.config(),assetManager=assetManagerFactory([{name:"theme",handle:function(url){if(itemThemes&&url.path&&(url.path===itemThemes.base||_.contains(_.pluck(itemThemes.available,"path"),url.path)))return context.root_url+url.toString()}},assetStrategies.taomedia,assetStrategies.external,assetStrategies.base64,assetStrategies.itemCssNoCache,assetStrategies.baseUrl,portableAssetStrategy],{baseUrl:""}),config={name:"commonRenderer",locations:{assessmentItem:"taoQtiItem/qtiCommonRenderer/renderers/Item",_container:"taoQtiItem/qtiCommonRenderer/renderers/Container",_simpleFeedbackRule:!1,_tooltip:"taoQtiItem/qtiCommonRenderer/renderers/Tooltip",stylesheet:"taoQtiItem/qtiCommonRenderer/renderers/Stylesheet",outcomeDeclaration:!1,responseDeclaration:!1,responseProcessing:!1,img:"taoQtiItem/qtiCommonRenderer/renderers/Img",math:"taoQtiItem/qtiCommonRenderer/renderers/Math",object:"taoQtiItem/qtiCommonRenderer/renderers/Object",table:"taoQtiItem/qtiCommonRenderer/renderers/Table",printedVariable:"taoQtiItem/qtiCommonRenderer/renderers/PrintedVariable",rubricBlock:"taoQtiItem/qtiCommonRenderer/renderers/RubricBlock",modalFeedback:"taoQtiItem/qtiCommonRenderer/renderers/ModalFeedback",prompt:"taoQtiItem/qtiCommonRenderer/renderers/interactions/Prompt",choiceInteraction:"taoQtiItem/qtiCommonRenderer/renderers/interactions/ChoiceInteraction",extendedTextInteraction:"taoQtiItem/qtiCommonRenderer/renderers/interactions/ExtendedTextInteraction",orderInteraction:"taoQtiItem/qtiCommonRenderer/renderers/interactions/OrderInteraction",associateInteraction:"taoQtiItem/qtiCommonRenderer/renderers/interactions/AssociateInteraction",matchInteraction:"taoQtiItem/qtiCommonRenderer/renderers/interactions/MatchInteraction",textEntryInteraction:"taoQtiItem/qtiCommonRenderer/renderers/interactions/TextEntryInteraction",sliderInteraction:"taoQtiItem/qtiCommonRenderer/renderers/interactions/SliderInteraction",inlineChoiceInteraction:"taoQtiItem/qtiCommonRenderer/renderers/interactions/InlineChoiceInteraction","simpleChoice.choiceInteraction":"taoQtiItem/qtiCommonRenderer/renderers/choices/SimpleChoice.ChoiceInteraction","simpleChoice.orderInteraction":"taoQtiItem/qtiCommonRenderer/renderers/choices/SimpleChoice.OrderInteraction",hottext:"taoQtiItem/qtiCommonRenderer/renderers/choices/Hottext",gap:"taoQtiItem/qtiCommonRenderer/renderers/choices/Gap",gapText:"taoQtiItem/qtiCommonRenderer/renderers/choices/GapText","simpleAssociableChoice.matchInteraction":"taoQtiItem/qtiCommonRenderer/renderers/choices/SimpleAssociableChoice.MatchInteraction","simpleAssociableChoice.associateInteraction":"taoQtiItem/qtiCommonRenderer/renderers/choices/SimpleAssociableChoice.AssociateInteraction",inlineChoice:"taoQtiItem/qtiCommonRenderer/renderers/choices/InlineChoice",hottextInteraction:"taoQtiItem/qtiCommonRenderer/renderers/interactions/HottextInteraction",hotspotInteraction:"taoQtiItem/qtiCommonRenderer/renderers/interactions/HotspotInteraction",hotspotChoice:!1,gapMatchInteraction:"taoQtiItem/qtiCommonRenderer/renderers/interactions/GapMatchInteraction",selectPointInteraction:"taoQtiItem/qtiCommonRenderer/renderers/interactions/SelectPointInteraction",graphicOrderInteraction:"taoQtiItem/qtiCommonRenderer/renderers/interactions/GraphicOrderInteraction",mediaInteraction:"taoQtiItem/qtiCommonRenderer/renderers/interactions/MediaInteraction",uploadInteraction:"taoQtiItem/qtiCommonRenderer/renderers/interactions/UploadInteraction",graphicGapMatchInteraction:"taoQtiItem/qtiCommonRenderer/renderers/interactions/GraphicGapMatchInteraction",gapImg:"taoQtiItem/qtiCommonRenderer/renderers/choices/GapImg",graphicAssociateInteraction:"taoQtiItem/qtiCommonRenderer/renderers/interactions/GraphicAssociateInteraction",associableHotspot:!1,customInteraction:"taoQtiItem/qtiCommonRenderer/renderers/interactions/PortableCustomInteraction",infoControl:"taoQtiItem/qtiCommonRenderer/renderers/PortableInfoControl",include:"taoQtiItem/qtiCommonRenderer/renderers/Include",endAttemptInteraction:"taoQtiItem/qtiCommonRenderer/renderers/interactions/EndAttemptInteraction"},options:{assetManager:assetManager,themes:itemThemes,enableDragAndDrop:{associate:!!moduleConfig.associateDragAndDrop,gapMatch:!!moduleConfig.gapMatchDragAndDrop,graphicGapMatch:!!moduleConfig.graphicGapMatchDragAndDrop,order:!!moduleConfig.orderDragAndDrop},messages:moduleConfig.messages}};return config}),define("taoQtiItem/qtiCommonRenderer/renderers/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",(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+="",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= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,self=this,stack1,helper;return buffer+="\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= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,stack1,helper;return 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
    ",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= 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+="\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
    \n
      \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
    \n
      \n
    \n
    \n\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+="
  • \n
    \n
    \n
  • \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=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",{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= 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+="\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
    \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 \n
    \n\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?(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?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= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,self=this,stack1,helper;return buffer+="\n "+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.title),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+"\n\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\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 \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
    \n ",buffer}function program21(depth0,data){var buffer="",stack1,helper;return buffer+="\n \n ",buffer}function program23(depth0,data){var buffer="",stack1,helper,options;return buffer+="\n 0 "+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"of",options):helperMissing.call(depth0,"__","of",options)))+" "+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.expectedLength),"function"===_typeof(stack1)?stack1.apply(depth0):stack1))+" "+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 0 "+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"of",options):helperMissing.call(depth0,"__","of",options)))+" ",(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)+" "+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)))+".\n ",buffer}function program28(depth0,data){var buffer="",stack1,helper,options;return buffer+="\n 0 "+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"of",options):helperMissing.call(depth0,"__","of",options)))+" ",(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)+" "+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)))+".\n ",buffer}function program30(depth0,data){var buffer="",stack1,helper,options;return buffer+="\n 0 "+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"of",options):helperMissing.call(depth0,"__","of",options)))+" ",(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)+" "+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)))+".\n ",buffer}function program32(depth0,data){var buffer="",stack1,helper,options;return buffer+="\n 0 "+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"of",options):helperMissing.call(depth0,"__","of",options)))+" ",(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)+" "+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)))+".\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+="
    \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
    \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
    \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
    \n
    \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= 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+="
    \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
      \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
    \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
    \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("",{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= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,self=this,stack1,helper;return 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
    \n
    \n
    \n
    \n
    \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?(_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= 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+="
    \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
    \n
    \n
    \n
    \n
      \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
    \n
    \n
    \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= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,self=this,stack1,helper;return 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
    \n
    \n
    \n
    \n
      \n
      \n
      \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"+position+"");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= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,self=this,stack1,helper;return 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
      \n
      \n
      \n
      \n
      \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= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,self=this,stack1,helper;return 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
      \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
      \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 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= 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+="\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\n ",buffer}function program12(){return"\n \n \n \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+="
      \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
      \n
      \n \n \n \n \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 \n \n \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 \n
      \n
      \n
      \n
      \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);0matchMax&&(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&&0choice.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&&0choice.attributes.matchMax?onMatchMaxReached(interaction,choice,this,msg,this.getLevel()):this.setLevel("success")})):0choice.attributes.matchMax?onMatchMaxReached(interaction,choice,this,msg,this.getLevel()):responseCountchoiceCount?onMaxChoicesReached(this,msg):this.setLevel("success")})):0choice.attributes.matchMax?onMatchMaxReached(interaction,choice,this,msg,this.getLevel()):responseCountmaxAssociations?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:aIndexbIndex?1:aIndex= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,self=this,stack1,helper;return 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
      \n
      \n
      \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= 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+="
      \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
      \n
      \n
        \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
      \n
      \n \n \n
      \n
        \n
          \n
        \n
        \n \n \n
        \n
        \n
        \n
        \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.ypreviousMiddle.x&&draggedMiddle.xnextMiddle.x&&$nextResult.after($dropzoneElement)):(prevMiddle&&draggedBox.topnextMiddle.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("
      • ",{class:"dropzone qti-choice"}),$$1("
        ",{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= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,self=this,stack1,helper;return 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
        ",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= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,self=this,stack1,helper;return 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
        \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= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,self=this,stack1,helper;return 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
        \n
        \n
        \n
        \n
        \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?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= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,self=this,stack1,helper;return 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
        \r\n
        \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("
        ").attr({id:"".concat(attributes.responseIdentifier,"-qti-slider"),class:"qti-slider"}),$sliderLabels=$$1("
        ").attr({class:"qti-slider-values"}),$sliderCurrentValue=$$1("
        ").attr({id:"".concat(attributes.responseIdentifier,"-qti-slider-cur-value"),class:"qti-slider-cur-value"}),$sliderValue=$$1("").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("".concat(__("Current value:"),"")).append(""),$sliderLabels.append("".concat(reverse?max:min,"")).append("".concat(reverse?min:max,"")),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("").concat(middleValue,"")):$sliderLabels.find(".slider-min").after("").concat(middleValue,""))}$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= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,self=this,stack1,helper;return buffer+="",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= 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+="
        \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
        \n
        \n
        \n "+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"Browse...",options):helperMissing.call(depth0,"__","Browse...",options)))+"\n "+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"No file selected",options):helperMissing.call(depth0,"__","No file selected",options)))+"\n \n
        \n
        \n

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

        \n
        \n
        \n
        \n
        \n
        \n
        \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= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,self=this,stack1,helper;return 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
        \n
        \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",(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+="",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+="",(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+="",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 $("
        ").html(element.body()).find(".x-tao-wrapper")}function _setBodyDomClass(element,newClass,oldClass){if(_checkContainerType(element)&&(oldClass||newClass)){var $wrapper=$("
        ").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("
        "),$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"+escapeExpression((stack1=(stack1=depth0&&depth0.attributes,null==stack1||!1===stack1?stack1:stack1.title),"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+="
        \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
        ",(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
        ",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= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,self=this,stack1,helper;return buffer+="
        \n
        \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= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,self=this,stack1,helper;return 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
        ",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= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,self=this,stack1,helper;return 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",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;nindex&&_.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\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
        \n
        \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= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,self=this,stack1,helper;return buffer+="",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= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,self=this,stack1,helper;return 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\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= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,self=this,stack1,helper;return 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\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(0maxChoice||responseDeclaration.correctResponse.lengthscore&&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&&maxAssocmaxAssoc||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&&matchMaxi;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&&0v.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&&matchMaxi;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=$("
        ").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,"")},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]+">":"");return xmlMatch.length&&-1===xml.indexOf(prefixAtt)&&(xml=xml.replace("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+=""+_.escape(this.annotations[encoding])+"";return annotations&&(0")?raw=raw.replace("",annotations+""):raw=""+raw+annotations+""),ns&&ns.name&&(body=raw.replace(/<(\/)?([^!<])/g,"<$1"+ns.name+":$2"),tag=ns.name+":"+tag),body=body.replace(//g,""),body=body.replace(/<!--.*?-->/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("","").replace("
        ","")),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=$("").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"),$("
        ").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