tao-test/app/taoQtiTest/views/js/loader/testPlugins.min.js

2 lines
377 KiB
JavaScript

function _typeof2(obj){"@babel/helpers - typeof";return _typeof2="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_typeof2(obj)}define("taoQtiTest/runner/plugins/content/accessibility/focusOnFirstField",["lodash","taoTests/runner/plugin","ckeditor"],function(_,pluginFactory,ckEditor){'use strict';function isIOSDevice(){return /(iPhone|iPad)/i.test(navigator.userAgent)}_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,pluginFactory=pluginFactory&&Object.prototype.hasOwnProperty.call(pluginFactory,"default")?pluginFactory["default"]:pluginFactory,ckEditor=ckEditor&&Object.prototype.hasOwnProperty.call(ckEditor,"default")?ckEditor["default"]:ckEditor;var focusOnFirstField=pluginFactory({name:"focusOnFirstField",init:function(){var self=this;isIOSDevice()||this.getTestRunner().after("renderitem",function(){var $input=self.getAreaBroker().getContentArea().find(".qti-itemBody").find("input, textarea, select").not(":input[type=button], :input[type=submit], :input[type=reset]").first(),$cke=$input.closest(".qti-interaction").find(".cke");$cke.length?_.delay(function(){ckEditor.instances[$cke.attr("id").replace(/^cke_/,"")].focus()},100):$input.focus()})}});return focusOnFirstField}),define("taoQtiTest/runner/plugins/content/accessibility/jumplinks/helpers",["exports","i18n"],function(exports,__){'use strict';__=__&&Object.prototype.hasOwnProperty.call(__,"default")?__["default"]:__;var getItemStatus=function(item){return item.flagged?__("Flagged for review"):item.answered?__("Answered"):item.viewed?__("Not answered"):__("Not seen")};exports.getItemStatus=getItemStatus,exports.getJumpElementFactory=function(broker){return{get container(){return broker.getContainer()},get question(){return broker.getContainer().find(".content-wrapper").first()},get navigation(){return broker.getNavigationArea().find(":not(.hidden)[tabindex]").first()},get toolbox(){return broker.getToolboxArea().find(":not(.hidden)[tabindex]").first()},get teststatus(){return broker.getPanelArea().find(":not(.hidden)[tabindex]").first()}}},exports.isReviewPanelHidden=function(testRunner){return testRunner.getAreaBroker().getPanelArea().find(".qti-navigator").is(".hidden")},Object.defineProperty(exports,"__esModule",{value:!0})}),define("taoQtiTest/runner/plugins/content/accessibility/jumplinks/jumplinks",["lodash","ui/component","handlebars"],function(_,component,Handlebars){'use strict';function jumplinksTpl(data,options,asString){var html=Template(data,options);return asString||!0?html:$(html)}function jumplinksFactory(config){var jumplinksBox=component({},defaults).on("render",function(){var _this=this;_.forEach([{selector:"[data-jump=question] ",eventName:"jump",eventParam:"question"},{selector:"[data-jump=navigation]",eventName:"jump",eventParam:"navigation"},{selector:"[data-jump=toolbox]",eventName:"jump",eventParam:"toolbox"},{selector:"[data-jump=teststatus]",eventName:"jump",eventParam:"teststatus"},{selector:"[data-jump=shortcuts]",eventName:"shortcuts",eventParam:"shortcuts"}],function(linkDescription){var $link=_this.getElement().find(linkDescription.selector),handleLink=function(){_this.trigger(linkDescription.eventName,linkDescription.eventParam),_this.getElement().find(":focus").blur()};$link&&($link.on("click",handleLink),$link.on("keyup",function(event){[32,13].includes(event.keyCode)&&handleLink()}))})});return jumplinksBox.setTemplate(jumplinksTpl),_.defer(function(){jumplinksBox.init(config)}),jumplinksBox}_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,component=component&&Object.prototype.hasOwnProperty.call(component,"default")?component["default"]:component,Handlebars=Handlebars&&Object.prototype.hasOwnProperty.call(Handlebars,"default")?Handlebars["default"]:Handlebars;var Template=Handlebars.template(function(Handlebars,depth0,helpers,partials,data){this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",helperMissing=helpers.helperMissing,escapeExpression=this.escapeExpression,self=this,stack1,helper,options;return buffer+="<nav class=\"jump-links-box\" aria-label=\""+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"Jump Menu",options):helperMissing.call(depth0,"__","Jump Menu",options)))+"\">\n <ul>\n <li class=\"jump-link-item\">\n <button data-jump=\"question\" class=\"jump-link\" >"+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"Jump to:",options):helperMissing.call(depth0,"__","Jump to:",options)))+" <b>"+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"Question",options):helperMissing.call(depth0,"__","Question",options)))+" - ",(helper=helpers.questionStatus)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.questionStatus,stack1="function"===_typeof2(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"</b></button>\n </li>\n <li class=\"jump-link-item\">\n <button data-jump=\"navigation\" class=\"jump-link\" >"+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"Jump to:",options):helperMissing.call(depth0,"__","Jump to:",options)))+" <b>"+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"Navigation",options):helperMissing.call(depth0,"__","Navigation",options)))+"</b></button>\n </li>\n <li class=\"jump-link-item\">\n <button data-jump=\"toolbox\" class=\"jump-link\" >"+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"Jump to:",options):helperMissing.call(depth0,"__","Jump to:",options)))+" <b>"+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"Toolbox",options):helperMissing.call(depth0,"__","Toolbox",options)))+"</b></button>\n </li>\n <li class=\"jump-link-item ",stack1=helpers.unless.call(depth0,depth0&&depth0.isReviewPanelEnabled,{hash:{},inverse:self.noop,fn:self.program(1,function(){return"hidden"},data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\" >\n <button data-jump=\"teststatus\" class=\"jump-link\" >"+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"Jump to:",options):helperMissing.call(depth0,"__","Jump to:",options)))+" <b>"+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"Test Status and Structure",options):helperMissing.call(depth0,"__","Test Status and Structure",options)))+"</b></button>\n </li>\n <li class=\"jump-link-item\">\n <button data-jump=\"shortcuts\" class=\"jump-link\" >"+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"Jump to:",options):helperMissing.call(depth0,"__","Jump to:",options)))+" <b>"+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"Open Keyboard Shortcuts",options):helperMissing.call(depth0,"__","Open Keyboard Shortcuts",options)))+"</b></button>\n </li>\n </ul>\n</nav>\n",buffer}),defaults={};return jumplinksFactory}),define("taoQtiTest/runner/helpers/map",["lodash"],function(_){'use strict';function getEmptyStats(){return{questions:0,answered:0,flagged:0,viewed:0,total:0,questionsViewed:0}}_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_;return{getJumps:function(map){return map&&map.jumps},getParts:function(map){return map&&map.parts},getSections:function(map){var parts=this.getParts(map),result={};return _.forEach(parts,function(part){var sections=part.sections;sections&&_.forEach(sections,function(section){result[section.id]=section})}),result},getActiveItem:function(map){var parts=this.getParts(map),result={};return _.forEach(parts,function(part){var sections=part.sections;sections&&_.forEach(sections,function(section){if(section.active){var items=section.items;_.forEach(items,function(item){item.active&&(result=item)})}})}),result},getNextSections:function(map,sectionId){var sections=this.getSections(map),result={},canList=!1;return _.forEach(sections,function(section){canList&&(result[section.id]=section),section.id===sectionId&&(canList=!0)}),result},getJump:function(map,position){var jumps=this.getJumps(map);return jumps&&jumps[position]},getPart:function(map,partName){var parts=this.getParts(map);return parts&&parts[partName]},getSection:function(map,sectionName){var parts=this.getParts(map),section=null;return _.forEach(parts,function(part){var sections=part.sections;if(sections&&sections[sectionName])return section=sections[sectionName],!1}),section},getItem:function(map,itemIdentifier){var jump=_.find(this.getJumps(map),{identifier:itemIdentifier});return this.getItemAt(map,jump&&jump.position)},getItemCategories:function(map,itemIdentifier){var item=this.getItem(map,itemIdentifier);return item&&Array.isArray(item.categories)?item.categories:[]},hasItemCategory:function(map,itemIdentifier,category){var fuzzyMatch=!!(3<arguments.length&&arguments[3]!==void 0)&&arguments[3],taoPrefix="x-tao-option-",categories=this.getItemCategories(map,itemIdentifier);if(!category||!category.length)return!1;var exactMatch=categories.includes(category);if(exactMatch)return!0;if(fuzzyMatch){if(!category.startsWith(taoPrefix)&&category.includes("".concat(taoPrefix).concat(category)))return!0;var normalize=function(elt){return elt.replace(taoPrefix,"").replace(/[-_\s]/g,"").toLowerCase()};return categories.some(function(itemCategory){return normalize(itemCategory)===normalize(category)})}return!1},getTestStats:function(map){return map&&map.stats},getPartStats:function(map,partName){var part=this.getPart(map,partName);return part&&part.stats},getSectionStats:function(map,sectionName){var section=this.getSection(map,sectionName);return section&&section.stats},getScopeStats:function(map,position,scope){var jump=this.getJump(map,position);switch(scope){case"section":case"testSection":return this.getSectionStats(map,jump&&jump.section);case"part":case"testPart":return this.getPartStats(map,jump&&jump.part);case"testWithoutInaccessibleItems":{var testStats=this.getTestStats(map),_this$getPart=this.getPart(map,jump&&jump.part),currentPartPosition=_this$getPart.position,isCurrentPartLinear=_this$getPart.isLinear,parts=Object.values(this.getParts(map)).filter(function(_ref){var partPosition=_ref.position;return partPosition<currentPartPosition}).sort(function(a,b){return b-a}),linearPartIndex=isCurrentPartLinear?0:parts.findIndex(function(_ref2){var isLinear=_ref2.isLinear;return isLinear});if(-1===linearPartIndex)return testStats;var inaccessibleParts=parts.slice(linearPartIndex),countOfInaccessibleUnasweredQestions=inaccessibleParts.reduce(function(acc,_ref3){var _ref3$stats=_ref3.stats,questions=_ref3$stats.questions,answered=_ref3$stats.answered;return acc+(questions-answered)},0),countOfInaccessibleFlaggedQestions=inaccessibleParts.reduce(function(acc,_ref4){var flagged=_ref4.stats.flagged;return acc+flagged},0);return Object.assign({},testStats,{answered:testStats.answered+countOfInaccessibleUnasweredQestions,flagged:testStats.flagged-countOfInaccessibleFlaggedQestions})}default:case"test":return this.getTestStats(map);}},getScopeMap:function(map,position,scope){var scopeMap=_.cloneDeep(map||{}),jump=this.getJump(scopeMap,position),part=this.getPart(scopeMap,jump&&jump.part),section=this.getSection(scopeMap,jump&&jump.section);return scope&&"test"!==scope&&(scopeMap.parts={},part&&(scopeMap.parts[jump.part]=part)),part&&("section"===scope||"testSection"===scope)&&(part.sections={},section&&(part.sections[jump.section]=section)),section&&(section.stats=this.computeItemStats(section.items)),part&&(part.stats=this.computeStats(part.sections)),scopeMap.stats=this.computeStats(scopeMap.parts),scopeMap},getScopeMapFromContext:function(map,context,scope){var scopeMap=_.cloneDeep(map||{}),part,section;return context&&context.testPartId&&(part=this.getPart(scopeMap,context.testPartId)),context&&context.sectionId&&(section=this.getSection(scopeMap,context.sectionId)),scope&&"test"!==scope&&(scopeMap.parts={},part&&(scopeMap.parts[context.testPartId]=part)),part&&("section"===scope||"testSection"===scope)&&(part.sections={},section&&(part.sections[context.sectionId]=section)),section&&(section.stats=this.computeItemStats(section.items)),part&&(part.stats=this.computeStats(part.sections)),scopeMap.stats=this.computeStats(scopeMap.parts),scopeMap},getItemPart:function(map,position){var jump=this.getJump(map,position);return this.getPart(map,jump&&jump.part)},getItemSection:function(map,position){var jump=this.getJump(map,position),part=this.getPart(map,jump&&jump.part),sections=part&&part.sections;return sections&&sections[jump&&jump.section]},getItemAt:function(map,position){var jump=this.getJump(map,position),part=this.getPart(map,jump&&jump.part),sections=part&&part.sections,section=sections&&sections[jump&&jump.section],items=section&&section.items;return items&&items[jump&&jump.identifier]},getItemIdentifier:function(map,position){var item;return item=_.isFinite(position)?this.getItemAt(map,position):this.getItem(map,position),item&&item.id},each:function(map,callback){return _.isFunction(callback)&&_.forEach(map&&map.parts,function(part){_.forEach(part&&part.sections,function(section){_.forEach(section&&section.items,function(item){callback(item,section,part,map)})})}),map},updateItemStats:function(map,position){var jump=this.getJump(map,position),part=this.getPart(map,jump&&jump.part),sections=part&&part.sections,section=sections&&sections[jump&&jump.section];return section&&(section.stats=this.computeItemStats(section.items)),part&&(part.stats=this.computeStats(part.sections)),map&&(map.stats=this.computeStats(map.parts)),map},computeItemStats:function(items){return _.reduce(items,function(acc,item){return item.informational||(acc.questions++,item.answered&&acc.answered++,item.viewed&&acc.questionsViewed++),item.flagged&&acc.flagged++,item.viewed&&acc.viewed++,acc.total++,acc},getEmptyStats())},computeStats:function(collection){return _.reduce(collection,function(acc,item){return acc.questions+=item.stats.questions,acc.answered+=item.stats.answered,acc.flagged+=item.stats.flagged,acc.viewed+=item.stats.viewed,acc.total+=item.stats.total,acc.questionsViewed+=item.stats.questionsViewed,acc},getEmptyStats())},patch:function(currentMap,partialMap){var self=this,targetMap;if(!_.isPlainObject(partialMap)||!partialMap.parts)throw new TypeError("Invalid test map format");return currentMap&&"test"!==partialMap.scope?(targetMap=_.cloneDeep(currentMap),_.forEach(partialMap.parts,function(partialPart,targetPartId){"part"===partialMap.scope&&(targetMap.parts[targetPartId]=_.cloneDeep(partialPart)),"section"===partialMap.scope&&_.forEach(partialPart.sections,function(partialSection,targetSectionId){targetMap.parts[targetPartId].sections[targetSectionId]=_.cloneDeep(partialSection),targetMap.parts[targetPartId].sections[targetSectionId].stats=self.computeItemStats(targetMap.parts[targetPartId].sections[targetSectionId].items)}),targetMap.parts[targetPartId].stats=self.computeStats(targetMap.parts[targetPartId].sections)}),targetMap.stats=this.computeStats(targetMap.parts)):targetMap=_.cloneDeep(partialMap),targetMap=this.reindex(targetMap),targetMap},reindex:function(map){var offset=0,offsetPart=0,offsetSection=0,lastPartId,lastSectionId;if(!_.isPlainObject(map)||!map.parts)throw new TypeError("Invalid test map format");return map.jumps=[],_.sortBy(map&&map.parts,"position").forEach(function(part){_.sortBy(part&&part.sections,"position").forEach(function(section){_.sortBy(section&&section.items,"position").forEach(function(item){lastPartId!==part.id&&(offsetPart=0,lastPartId=part.id,part.position=offset),lastSectionId!==section.id&&(offsetSection=0,lastSectionId=section.id,section.position=offset),item.position=offset,item.index=offsetSection+1,item.positionInPart=offsetPart,item.positionInSection=offsetSection,map.jumps[offset]={identifier:item.id,section:section.id,part:part.id,position:offset},offset++,offsetSection++,offsetPart++})})}),map},createJumpTable:function(map){if(!_.isPlainObject(map)||!map.parts)throw new TypeError("Invalid test map format");return map.jumps=[],this.each(map,function(item,section,part){var offset=item.position;map.jumps[offset]={identifier:item.id,section:section.id,part:part.id,position:offset}}),map}}}),define("taoQtiTest/runner/helpers/isReviewPanelEnabled",["taoQtiTest/runner/helpers/map"],function(mapHelper){'use strict';function isReviewPanelEnabled(runner){var reviewEnabled=mapHelper.hasItemCategory(runner.getTestMap(),runner.getTestContext().itemIdentifier,"reviewScreen",!0),itemReviewEnabled=runner.getOptions().review.enabled;return reviewEnabled&&itemReviewEnabled}return mapHelper=mapHelper&&Object.prototype.hasOwnProperty.call(mapHelper,"default")?mapHelper["default"]:mapHelper,isReviewPanelEnabled}),define("taoQtiTest/runner/plugins/content/accessibility/jumplinks/shortcuts",["i18n","lodash","ui/component","ui/keyNavigation/navigator","ui/keyNavigation/navigableDomElement","handlebars"],function(__,_,component,keyNavigator,navigableDomElement,Handlebars){'use strict';function shortcutsTpl(data,options,asString){var html=Template(data,options);return asString||!0?html:$(html)}function shortcutsBoxFactory(config){var shortcutsBox=component({},defaults).on("render",function(){var _this=this,$element=this.getElement(),$closeBtn=$element.find(".btn-close"),$keyNavigationItems=this.getElement().find(".shortcuts-list, .btn-close");$closeBtn.on("click",function(){return _this.trigger("close")}),$element.on("click",function(e){$element.is(e.target)&&_this.trigger("close")}),$element.on("keyup",function(e){27===e.keyCode&&_this.trigger("close")}),this.navigator=keyNavigator({elements:navigableDomElement.createFromDoms($keyNavigationItems),propagateTab:!1}).on("tab",function(){this.setCursorAt(1)}).on("shift+tab",function(){this.setCursorAt(1)}).on("blur",function(){_.defer(function(){_this.navigator.isFocused()||_this.navigator.focus()})}).on("activate",function(cursor){cursor.navigable.getElement().click()}),this.navigator.first()}).on("destroy",function(){this.navigator.destroy(),this.getElement().remove()});return shortcutsBox.setTemplate(shortcutsTpl),shortcutsBox.init(config),shortcutsBox}__=__&&Object.prototype.hasOwnProperty.call(__,"default")?__["default"]:__,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,component=component&&Object.prototype.hasOwnProperty.call(component,"default")?component["default"]:component,keyNavigator=keyNavigator&&Object.prototype.hasOwnProperty.call(keyNavigator,"default")?keyNavigator["default"]:keyNavigator,navigableDomElement=navigableDomElement&&Object.prototype.hasOwnProperty.call(navigableDomElement,"default")?navigableDomElement["default"]:navigableDomElement,Handlebars=Handlebars&&Object.prototype.hasOwnProperty.call(Handlebars,"default")?Handlebars["default"]:Handlebars;var Template=Handlebars.template(function(Handlebars,depth0,helpers,partials,data){function program1(depth0,data){var buffer="",stack1,helper;return buffer+="\n <div class=\"shortcuts-group-wrapper\">\n <h3 class=\"shortcuts-group-title\">",(helper=helpers.label)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.label,stack1="function"===_typeof2(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"</h3>\n <ul class=\"shortcuts-group-list\">\n ",stack1=helpers.each.call(depth0,depth0&&depth0.shortcuts,{hash:{},inverse:self.noop,fn:self.program(2,program2,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n </ul>\n </div>\n ",buffer}function program2(depth0,data){var buffer="",stack1,helper;return buffer+="\n <li class=\"shortcut-item\">\n <span class=\"shortcut-item-shortcut\">\n <kbd>",(helper=helpers.shortcut)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.shortcut,stack1="function"===_typeof2(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"</kbd>\n </span>\n <span class=\"shortcut-item-action\">\n ",(helper=helpers.label)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.label,stack1="function"===_typeof2(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\n </span>\n </li>\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+="<div class=\"shortcuts-list-wrapper\">\n <div class=\"shortcuts-list\" role=\"dialog\" aria-modal=\"true\" aria-labelledby=\"jumplinks/shortcuts-heading\"\n aria-describedby=\"jumplinks/shortcuts-description\">\n <h2 class=\"shortcuts-list-title\" id=\"jumplinks/shortcuts-heading\">\n "+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"Keyboard Navigation",options):helperMissing.call(depth0,"__","Keyboard Navigation",options)))+"\n </h2>\n <div id=\"jumplinks/shortcuts-description\">\n <p class=\"shortcuts-list-description\">\n "+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"Keyboard shortcuts for the Accessibility Tools are available to the Test-taker.",options):helperMissing.call(depth0,"__","Keyboard shortcuts for the Accessibility Tools are available to the Test-taker.",options)))+"\n </p>\n <p class=\"shortcuts-list-description\">\n "+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"You can magnify the content by up to 200%. Check your browser settings to find out how to do it.",options):helperMissing.call(depth0,"__","You can magnify the content by up to 200%. Check your browser settings to find out how to do it.",options)))+"\n </p>\n </div>\n <button aria-label=\"Close dialog\" class=\"btn-close small\" data-control=\"close-btn\" type=\"button\">\n <span class=\"icon-close\"></span>\n </button>\n ",stack1=helpers.each.call(depth0,depth0&&depth0.shortcutsGroups,{hash:{},inverse:self.noop,fn:self.program(1,program1,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n </div>\n</div>\n",buffer}),defaults={shortcutsGroups:[{id:"navigation-shortcuts",label:__("Navigation shortcuts"),shortcuts:[{id:"next",shortcut:"ALT + Shift + N",label:__("Go to the next question")},{id:"previous",shortcut:"ALT + Shift + P",label:__("Go to the previous question")},{id:"current",shortcut:"ALT + Shift + Q",label:__("Go to the current question")},{id:"top",shortcut:"ALT + Shift + T",label:__("Go to the top of the page")}]}]};return shortcutsBoxFactory}),define("taoQtiTest/runner/plugins/content/accessibility/jumplinks/plugin",["i18n","jquery","taoTests/runner/plugin","taoQtiTest/runner/helpers/isReviewPanelEnabled","taoQtiTest/runner/plugins/content/accessibility/jumplinks/helpers","taoQtiTest/runner/plugins/content/accessibility/jumplinks/jumplinks","taoQtiTest/runner/plugins/content/accessibility/jumplinks/shortcuts","util/shortcut","util/namespace","handlebars"],function(__,$$1,pluginFactory,isReviewPanelEnabled,helpers,jumplinksFactory,shortcutsFactory,shortcut,namespaceHelper,Handlebars){'use strict';function containerTpl(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,pluginFactory=pluginFactory&&Object.prototype.hasOwnProperty.call(pluginFactory,"default")?pluginFactory["default"]:pluginFactory,isReviewPanelEnabled=isReviewPanelEnabled&&Object.prototype.hasOwnProperty.call(isReviewPanelEnabled,"default")?isReviewPanelEnabled["default"]:isReviewPanelEnabled,jumplinksFactory=jumplinksFactory&&Object.prototype.hasOwnProperty.call(jumplinksFactory,"default")?jumplinksFactory["default"]:jumplinksFactory,shortcutsFactory=shortcutsFactory&&Object.prototype.hasOwnProperty.call(shortcutsFactory,"default")?shortcutsFactory["default"]:shortcutsFactory,shortcut=shortcut&&Object.prototype.hasOwnProperty.call(shortcut,"default")?shortcut["default"]:shortcut,namespaceHelper=namespaceHelper&&Object.prototype.hasOwnProperty.call(namespaceHelper,"default")?namespaceHelper["default"]:namespaceHelper,Handlebars=Handlebars&&Object.prototype.hasOwnProperty.call(Handlebars,"default")?Handlebars["default"]:Handlebars;var Template=Handlebars.template(function(Handlebars,depth0,helpers){return this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),"<div class=\"jump-links-container\"></div>\n"}),plugin=pluginFactory({name:"jumplinks",init:function(){var _this=this,testRunner=this.getTestRunner(),item=testRunner.getCurrentItem(),config={isReviewPanelEnabled:isReviewPanelEnabled(testRunner),questionStatus:helpers.getItemStatus(item)},testRunnerOptions=testRunner.getOptions(),pluginShortcuts=(testRunnerOptions.shortcuts||{})[this.getName()]||{},areaBroker=this.getAreaBroker(),getJumpElement=helpers.getJumpElementFactory(areaBroker),shortcutsConfig=-1===navigator.appVersion.indexOf("Mac")?{}:{shortcutsGroups:[{id:"navigation-shortcuts",label:__("Navigation shortcuts"),shortcuts:[{id:"next",shortcut:"OPTION + Shift + N",label:__("Go to the next question")},{id:"previous",shortcut:"OPTION + Shift + P",label:__("Go to the previous question")},{id:"current",shortcut:"OPTION + Shift + Q",label:__("Go to the current question")},{id:"top",shortcut:"OPTION + Shift + T",label:__("Go to the top of the page")}]}]};testRunnerOptions.allowShortcuts&&(pluginShortcuts.goToTop&&shortcut.add(namespaceHelper.namespaceAll(pluginShortcuts.goToTop,this.getName(),!0),function(){$$1("[tabindex]").first().focus()},{avoidInput:!0,prevent:!0}),pluginShortcuts.goToQuestion&&shortcut.add(namespaceHelper.namespaceAll(pluginShortcuts.goToQuestion,this.getName(),!0),function(){getJumpElement.question.focus()},{avoidInput:!0,prevent:!0})),this.jumplinks=jumplinksFactory(config).on("render",function(){_this.jumplinks.on("jump",function(jumpTo){var $element=getJumpElement[jumpTo];$element.focus()}),_this.jumplinks.on("shortcuts",function(){_this.shortcuts||(_this.shortcuts=shortcutsFactory(shortcutsConfig),_this.shortcuts.render(_this.getAreaBroker().getControlArea()),_this.shortcuts.on("close",function(){_this.shortcuts.destroy(),_this.shortcuts=null}))})}).on("update",function(params){this.trigger("changeReviewPanel",params.isReviewPanelEnabled),this.trigger("changeQuesitionStatus",params.questionStatus)}).on("changeReviewPanel",function(enabled){var elem=this.getElement(),panelJumplink=elem.find("[data-jump=\"teststatus\"]").parent();enabled?panelJumplink.removeClass("hidden"):panelJumplink.addClass("hidden")}).on("changeQuesitionStatus",function(questionStatus){var elem=this.getElement(),text="".concat(__("Question")," - ").concat(questionStatus);elem.find("[data-jump=\"question\"] > b").text(text)}),testRunner.on("renderitem",function(){var currentItem=testRunner.getCurrentItem(),updatedConfig={isReviewPanelEnabled:!helpers.isReviewPanelHidden(testRunner)&&isReviewPanelEnabled(testRunner),questionStatus:helpers.getItemStatus(currentItem)},announcedText=__("Item %s loaded",currentItem.position),$announce=$$1("[aria-live=polite][role=alert]").first();1!==$announce.length&&($announce=$$1("<div aria-live=\"polite\" role=\"alert\" class=\"visible-hidden\"></div>"),$$1("main").first().append($announce)),$announce.text(announcedText),_this.jumplinks.trigger("update",updatedConfig)}).on("tool-flagitem",function(){var currentItem=testRunner.getCurrentItem(),questionStatus=helpers.getItemStatus(Object.assign({},currentItem,{flagged:!currentItem.flagged}));_this.jumplinks.trigger("changeQuesitionStatus",questionStatus)}).on("tool-reviewpanel",function(){var wasHidden=helpers.isReviewPanelHidden(testRunner);_this.jumplinks.trigger("changeReviewPanel",wasHidden)}).after("renderitem",function(){getJumpElement.question.attr("tabindex","-1").focus()})},render:function(){var jumplinksContainer=$$1(containerTpl());$$1(".content-wrap").prepend(jumplinksContainer),this.jumplinks.render(jumplinksContainer)}});return plugin}),define("taoQtiTest/runner/plugins/content/accessibility/keyNavigation/strategies/headerNavigation",["jquery","ui/keyNavigation/navigator","ui/keyNavigation/navigableDomElement","taoQtiTest/runner/plugins/content/accessibility/keyNavigation/helpers"],function($,keyNavigator,navigableDomElement,helpers){'use strict';$=$&&Object.prototype.hasOwnProperty.call($,"default")?$["default"]:$,keyNavigator=keyNavigator&&Object.prototype.hasOwnProperty.call(keyNavigator,"default")?keyNavigator["default"]:keyNavigator,navigableDomElement=navigableDomElement&&Object.prototype.hasOwnProperty.call(navigableDomElement,"default")?navigableDomElement["default"]:navigableDomElement;return{name:"header",init:function(){var _this=this,config=this.getConfig(),$headerBar=$("header"),$headerElements=$headerBar.find("a:visible"),registerHeaderNavigator=function(id,group,$elements){var elements=navigableDomElement.createFromDoms($elements);if(elements.length){var navigator=keyNavigator({id:id,group:group,elements:elements,propagateTab:!1,defaultPosition:0});helpers.setupItemsNavigator(navigator,config),helpers.setupClickableNavigator(navigator),_this.keyNavigators.push(navigator)}};return this.keyNavigators=[],config.flatNavigation?$headerElements.each(function(index,element){return registerHeaderNavigator("".concat("header-toolbar","-").concat(index),$headerBar,$(element))}):registerHeaderNavigator("header-toolbar",$headerBar,$headerElements),this},getNavigators:function(){return this.keyNavigators},destroy:function(){return this.keyNavigators.forEach(function(navigator){return navigator.destroy()}),this.keyNavigators=[],this}}}),define("taoQtiTest/runner/plugins/content/accessibility/keyNavigation/strategies/toolbarNavigation",["lodash","jquery","ui/keyNavigation/navigator","ui/keyNavigation/navigableDomElement","taoQtiTest/runner/plugins/content/accessibility/keyNavigation/helpers"],function(_,$,keyNavigator,navigableDomElement,helpers){'use strict';_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,$=$&&Object.prototype.hasOwnProperty.call($,"default")?$["default"]:$,keyNavigator=keyNavigator&&Object.prototype.hasOwnProperty.call(keyNavigator,"default")?keyNavigator["default"]:keyNavigator,navigableDomElement=navigableDomElement&&Object.prototype.hasOwnProperty.call(navigableDomElement,"default")?navigableDomElement["default"]:navigableDomElement;return{name:"toolbar",init:function(){var _this=this,config=this.getConfig(),$navigationBar=this.getTestRunner().getAreaBroker().getContainer().find(".bottom-action-bar"),$toolbarElements=$navigationBar.find(".action:not(.btn-group):visible, .action.btn-group .li-inner:visible");config.reverseBottomToolbar&&($toolbarElements=$($toolbarElements.get().reverse()));var registerToolbarNavigator=function(id,group,$elements){var elements=navigableDomElement.createFromDoms($elements);if(elements.length){var navigator=keyNavigator({id:id,group:group,elements:elements,propagateTab:!1,defaultPosition:function(navigableElements){var pos=0;return config.autoFocus&&(pos=navigableElements.length-1,_.forEach(navigableElements,function(navigable,i){var $element=navigable.getElement();("move-forward"===$element.data("control")||"move-end"===$element.data("control"))&&(pos=i)})),pos}});helpers.setupItemsNavigator(navigator,config),helpers.setupClickableNavigator(navigator),_this.keyNavigators.push(navigator)}};return this.keyNavigators=[],config.flatNavigation?$toolbarElements.each(function(index,element){return registerToolbarNavigator("".concat("bottom-toolbar","-").concat(index),$navigationBar,$(element))}):registerToolbarNavigator("bottom-toolbar",$navigationBar,$toolbarElements),this},getNavigators:function(){return this.keyNavigators},destroy:function(){return this.keyNavigators.forEach(function(navigator){return navigator.destroy()}),this.keyNavigators=[],this}}}),define("taoQtiTest/runner/plugins/content/accessibility/keyNavigation/strategies/topToolbarNavigation",["jquery","ui/keyNavigation/navigator","ui/keyNavigation/navigableDomElement","taoQtiTest/runner/plugins/content/accessibility/keyNavigation/helpers"],function($,keyNavigator,navigableDomElement,helpers){'use strict';$=$&&Object.prototype.hasOwnProperty.call($,"default")?$["default"]:$,keyNavigator=keyNavigator&&Object.prototype.hasOwnProperty.call(keyNavigator,"default")?keyNavigator["default"]:keyNavigator,navigableDomElement=navigableDomElement&&Object.prototype.hasOwnProperty.call(navigableDomElement,"default")?navigableDomElement["default"]:navigableDomElement;return{name:"top-toolbar",init:function(){var _this=this,config=this.getConfig(),$topToolbar=this.getTestRunner().getAreaBroker().getContainer().find(".top-action-bar"),$toolbarElements=$topToolbar.find(".timer-toggler"),registerTopToolbarNavigator=function(id,group,$elements){var elements=navigableDomElement.createFromDoms($elements);if(elements.length){var navigator=keyNavigator({id:id,group:group,elements:elements,propagateTab:!1});helpers.setupItemsNavigator(navigator,config),helpers.setupClickableNavigator(navigator),_this.keyNavigators.push(navigator)}};return this.keyNavigators=[],$toolbarElements.each(function(index,element){return registerTopToolbarNavigator("".concat("top-toolbar","-").concat(index),$topToolbar,$(element))}),this},getNavigators:function(){return this.keyNavigators},destroy:function(){return this.keyNavigators.forEach(function(navigator){return navigator.destroy()}),this.keyNavigators=[],this}}}),define("taoQtiTest/runner/plugins/content/accessibility/keyNavigation/strategies/navigatorNavigation",["lodash","ui/keyNavigation/navigator","ui/keyNavigation/navigableDomElement","taoQtiTest/runner/plugins/content/accessibility/keyNavigation/helpers"],function(_,keyNavigator,navigableDomElement,helpers){'use strict';_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,keyNavigator=keyNavigator&&Object.prototype.hasOwnProperty.call(keyNavigator,"default")?keyNavigator["default"]:keyNavigator,navigableDomElement=navigableDomElement&&Object.prototype.hasOwnProperty.call(navigableDomElement,"default")?navigableDomElement["default"]:navigableDomElement;var selectors={filters:".qti-navigator-filters .qti-navigator-filter",unseenItems:".qti-navigator-tree .qti-navigator-item:not(.unseen) .qti-navigator-label",allItems:".qti-navigator-tree .qti-navigator-item .qti-navigator-label"};return{name:"navigator",init:function(){var config=this.getConfig(),$panel=this.getTestRunner().getAreaBroker().getPanelArea(),$navigator=$panel.find(".qti-navigator"),itemListingVisited=!1,filtersNavigator,itemsNavigator,currentFilter;this.managedNavigators=[],this.keyNavigators=[];var testStatusNavigation;if($navigator.length&&!$navigator.hasClass("disabled")){var $filters=$navigator.find(selectors.filters),navigableFilters=navigableDomElement.createFromDoms($filters),$testStatusHeader=$navigator.find(".qti-navigator-info.collapsible > .qti-navigator-label"),navigableTestStatus=navigableDomElement.createFromDoms($testStatusHeader);$testStatusHeader.addClass("key-navigation-actionable"),navigableTestStatus.length&&(testStatusNavigation=keyNavigator({keepState:config.keepState,id:"navigator-test-status",propagateTab:!1,elements:navigableTestStatus,group:$testStatusHeader}),helpers.setupItemsNavigator(testStatusNavigation,{keyNextItem:config.keyNextTab||config.keyNextItem,keyPrevItem:config.keyPrevTab||config.keyPrevItem}),this.keyNavigators.push(testStatusNavigation),this.managedNavigators.push(testStatusNavigation)),navigableFilters.length&&(filtersNavigator=keyNavigator({keepState:config.keepState,id:"navigator-filters",propagateTab:!1,elements:navigableFilters,group:$navigator.find(".qti-navigator-filters")}),helpers.setupItemsNavigator(filtersNavigator,{keyNextItem:config.keyNextTab||config.keyNextItem,keyPrevItem:config.keyPrevTab||config.keyPrevItem}),helpers.setupClickableNavigator(filtersNavigator),config.keepState&&filtersNavigator.on("focus",function(cursor){if(config.keepState){var $element=cursor.navigable.getElement(),filter=$element.data("mode");$element.click(),currentFilter!==filter&&(itemListingVisited=!1),currentFilter=filter}}),config.keyNextContent&&filtersNavigator.on(config.keyNextContent,function(elem){helpers.allowedToNavigateFrom(elem)&&itemsNavigator&&_.defer(function(){itemListingVisited?itemsNavigator.first():itemsNavigator.focus()})}),config.keyPrevContent&&filtersNavigator.on(config.keyPrevContent,function(elem){helpers.allowedToNavigateFrom(elem)&&itemsNavigator&&_.defer(function(){itemsNavigator.last()})}),this.keyNavigators.push(filtersNavigator),this.managedNavigators.push(filtersNavigator));var $navigatorTree=$panel.find(".qti-navigator-tree"),skipAheadEnabled=$panel.find(".qti-navigator").is(".skipahead-enabled"),$trees=$navigator.find(skipAheadEnabled?selectors.allItems:selectors.unseenItems),navigableTrees=navigableDomElement.createFromDoms($trees);$trees.first().addClass("key-navigation-scrollable-up"),$trees.last().addClass("key-navigation-scrollable-down"),navigableTrees.length&&(itemsNavigator=keyNavigator({id:"navigator-items",elements:navigableTrees,group:$navigatorTree,defaultPosition:function(navigableElements){var pos=0;return(config.flatNavigation||"flagged"!==currentFilter)&&(pos=_.findIndex(navigableElements,function(navigable){var $parent=navigable.getElement().parent(".qti-navigator-item");if($parent.hasClass("active")&&$parent.is(":visible"))return!0})),pos}}).on("focus",function(cursor){itemListingVisited=!0,cursor.navigable.getElement().parent().addClass("key-navigation-highlight")}).on("blur",function(cursor){cursor.navigable.getElement().parent().removeClass("key-navigation-highlight")}),helpers.setupItemsNavigator(itemsNavigator,{keyNextItem:config.keyNextContent||config.keyNextItem,keyPrevItem:config.keyPrevContent||config.keyPrevItem}),helpers.setupClickableNavigator(itemsNavigator),config.keepState&&itemsNavigator.on("lowerbound upperbound",function(){filtersNavigator&&filtersNavigator.focus()}),config.keyNextTab&&config.keyPrevTab?(itemsNavigator.on(config.keyNextTab,function(elem){helpers.allowedToNavigateFrom(elem)&&filtersNavigator&&filtersNavigator.focus().next()}),itemsNavigator.on(config.keyPrevTab,function(elem){helpers.allowedToNavigateFrom(elem)&&filtersNavigator&&filtersNavigator.focus().previous()})):this.keyNavigators.push(itemsNavigator),this.managedNavigators.push(itemsNavigator))}return this},getNavigators:function(){return this.keyNavigators},destroy:function(){return this.managedNavigators.forEach(function(navigator){return navigator.destroy()}),this.managedNavigators=[],this.keyNavigators=[],this}}}),define("taoQtiTest/runner/plugins/content/accessibility/keyNavigation/strategies/pageNavigation",["jquery","ui/keyNavigation/navigator","ui/keyNavigation/navigableDomElement","taoQtiTest/runner/plugins/content/accessibility/keyNavigation/helpers"],function($,keyNavigator,navigableDomElement,helpers){'use strict';$=$&&Object.prototype.hasOwnProperty.call($,"default")?$["default"]:$,keyNavigator=keyNavigator&&Object.prototype.hasOwnProperty.call(keyNavigator,"default")?keyNavigator["default"]:keyNavigator,navigableDomElement=navigableDomElement&&Object.prototype.hasOwnProperty.call(navigableDomElement,"default")?navigableDomElement["default"]:navigableDomElement;return{name:"page",init:function(){var _this=this,config=this.getConfig();return this.keyNavigators=[],this.getTestRunner().getAreaBroker().getContainer().find(".content-wrapper").addClass("key-navigation-scrollable").each(function(i,el){var $element=$(el),navigator=keyNavigator({id:"".concat("item-content-wrapper","-").concat(_this.keyNavigators.length),elements:navigableDomElement.createFromDoms($element),group:$element,propagateTab:!1});helpers.setupItemsNavigator(navigator,config),_this.keyNavigators.push(navigator)}),this},getNavigators:function(){return this.keyNavigators},destroy:function(){return this.keyNavigators.forEach(function(navigator){return navigator.destroy()}),this.keyNavigators=[],this}}}),define("taoQtiTest/runner/plugins/content/accessibility/keyNavigation/strategies/rubricsNavigation",["jquery","ui/keyNavigation/navigator","ui/keyNavigation/navigableDomElement","taoQtiTest/runner/plugins/content/accessibility/keyNavigation/helpers"],function($,keyNavigator,navigableDomElement,helpers){'use strict';$=$&&Object.prototype.hasOwnProperty.call($,"default")?$["default"]:$,keyNavigator=keyNavigator&&Object.prototype.hasOwnProperty.call(keyNavigator,"default")?keyNavigator["default"]:keyNavigator,navigableDomElement=navigableDomElement&&Object.prototype.hasOwnProperty.call(navigableDomElement,"default")?navigableDomElement["default"]:navigableDomElement;return{name:"rubrics",init:function(){var _this=this,config=this.getConfig();return this.keyNavigators=[],this.getTestRunner().getAreaBroker().getContainer().find(".qti-rubricBlock").addClass("key-navigation-scrollable").each(function(i,el){var $element=$(el),navigator=keyNavigator({id:"".concat("rubric-element-navigation-group","-").concat(_this.keyNavigators.length),elements:navigableDomElement.createFromDoms($element),group:$element,propagateTab:!1});helpers.setupItemsNavigator(navigator,config),_this.keyNavigators.push(navigator)}),this},getNavigators:function(){return this.keyNavigators},destroy:function(){return this.keyNavigators.forEach(function(navigator){return navigator.destroy()}),this.keyNavigators=[],this}}}),define("taoQtiTest/runner/plugins/content/accessibility/keyNavigation/strategies/itemNavigation",["jquery","ui/scroller","ui/keyNavigation/navigator","ui/keyNavigation/navigableDomElement","taoQtiTest/runner/plugins/content/accessibility/keyNavigation/helpers"],function($,scrollHelper,keyNavigator,navigableDomElement,helpers){'use strict';$=$&&Object.prototype.hasOwnProperty.call($,"default")?$["default"]:$,scrollHelper=scrollHelper&&Object.prototype.hasOwnProperty.call(scrollHelper,"default")?scrollHelper["default"]:scrollHelper,keyNavigator=keyNavigator&&Object.prototype.hasOwnProperty.call(keyNavigator,"default")?keyNavigator["default"]:keyNavigator,navigableDomElement=navigableDomElement&&Object.prototype.hasOwnProperty.call(navigableDomElement,"default")?navigableDomElement["default"]:navigableDomElement;var addLabelledByAttribute=function(cursor){var $element=cursor.navigable.getElement(),value=$element.attr("value"),name=$element.attr("name");name&&$element.attr("aria-labelledby","".concat(name.replace("response-","choice-"),"-").concat(value))},removeLabelledByAttribute=function(cursor){var $element=cursor.navigable.getElement();$element.removeAttr("aria-labelledby","")},manageLabelledByAttribute=function(navigator){navigator&&(navigator.on("focus",addLabelledByAttribute),navigator.on("blur",removeLabelledByAttribute))};return{name:"item",init:function(){var _this=this;this.keyNavigators=[];var config=this.getConfig(),$content=this.getTestRunner().getAreaBroker().getContentArea(),getQtiChoice=function(cursor){return cursor&&cursor.navigable.getElement().closest(".qti-choice")},addNavigator=function($elements,group){var loop=!!(2<arguments.length&&void 0!==arguments[2])&&arguments[2],defaultPosition=3<arguments.length&&void 0!==arguments[3]?arguments[3]:0,elements=navigableDomElement.createFromDoms($elements);if(elements.length){var navigator=keyNavigator({elements:elements,group:group,loop:loop,defaultPosition:defaultPosition,propagateTab:!1});return _this.keyNavigators.push(navigator),navigator}},addInputsNavigator=function($elements,group,loop){var defaultPosition=3<arguments.length&&void 0!==arguments[3]?arguments[3]:0,navigator=addNavigator($elements,group,loop,defaultPosition);return navigator&&(helpers.setupItemsNavigator(navigator,config),helpers.setupClickableNavigator(navigator),navigator.on("focus",function(cursor){return scrollHelper.scrollTo(getQtiChoice(cursor).addClass("key-navigation-highlight"),$content.closest(".content-wrapper"))}).on("blur",function(cursor){return getQtiChoice(cursor).removeClass("key-navigation-highlight")})),navigator},$qtiInteractions=$content.find(".key-navigation-focusable,.qti-interaction").filter(function(i,node){return!$(node).parents(".qti-interaction").length});return $content.find(".key-navigation-focusable").addClass("key-navigation-scrollable"),$qtiInteractions.each(function(itemPos,itemElement){var $itemElement=$(itemElement),$choiceInput=$itemElement.find(".qti-choice input"),choiceType=$choiceInput.attr("type");if($itemElement.hasClass("qti-interaction")){$itemElement.find(".key-navigation-focusable").each(function(navPos,nav){var $nav=$(nav);$nav.closest(".qti-choice").length||addNavigator($nav,$nav)}),$itemElement.off(".keyNavigation");var $inputs=$itemElement.is(":input")?$itemElement:$itemElement.find(":input");if(config.flatNavigation&&(config.flatRadioNavigation||"radio"!==choiceType))$inputs.each(function(i,input){var navigator=addInputsNavigator($(input),$itemElement);manageLabelledByAttribute(navigator)});else{var navigator=addInputsNavigator($inputs,$itemElement,!0,function(){var position=-1;return $inputs.each(function(index,input){input.checked&&(position=index)}),position});manageLabelledByAttribute(navigator),navigator&&config.wcagBehavior&&navigator.on("focus",function(cursor){var $element=cursor.navigable.getElement();$element.is(":checked")||$element.click()})}}else addNavigator($itemElement,$itemElement)}),this},getNavigators:function(){return this.keyNavigators},destroy:function(){return this.keyNavigators.forEach(function(navigator){return navigator.destroy()}),this.keyNavigators=[],this}}}),define("taoQtiTest/runner/plugins/content/accessibility/keyNavigation/strategies/linearItemNavigation",["jquery","ui/keyNavigation/navigator","ui/keyNavigation/navigableDomElement","taoQtiTest/runner/plugins/content/accessibility/keyNavigation/helpers"],function($,keyNavigator,navigableDomElement,helpers){'use strict';$=$&&Object.prototype.hasOwnProperty.call($,"default")?$["default"]:$,keyNavigator=keyNavigator&&Object.prototype.hasOwnProperty.call(keyNavigator,"default")?keyNavigator["default"]:keyNavigator,navigableDomElement=navigableDomElement&&Object.prototype.hasOwnProperty.call(navigableDomElement,"default")?navigableDomElement["default"]:navigableDomElement;return{name:"linearItem",init:function(){var _this=this,config=this.getConfig(),$content=this.getTestRunner().getAreaBroker().getContentArea(),$qtiInteractions=$content.find(".key-navigation-focusable,.qti-interaction").filter(function(i,node){return!$(node).parents(".qti-interaction").length}),$qtiChoices=$qtiInteractions.find(".qti-choice"),$lastParent=null,list=[],setupListNavigator=function(){var navigator=keyNavigator({elements:list,propagateTab:!1});helpers.setupItemsNavigator(navigator,config),_this.choicesNavigators.push(navigator)};return this.keyNavigators=[],this.choicesNavigators=[],$content.find(".key-navigation-focusable").addClass("key-navigation-scrollable"),$qtiChoices.each(function(i,el){var $itemElement=$(el),$parent=$itemElement.parent(),choiceNavigator=keyNavigator({elements:navigableDomElement.createFromDoms($itemElement),group:$itemElement,propagateTab:!1});helpers.setupClickableNavigator(choiceNavigator),$lastParent&&!$parent.is($lastParent)&&(setupListNavigator(),list=[]),_this.keyNavigators.push(choiceNavigator),list.push(choiceNavigator),$lastParent=$parent}),list.length&&(setupListNavigator(),list=[]),this},getNavigators:function(){return this.keyNavigators},destroy:function(){return this.keyNavigators.forEach(function(navigator){return navigator.destroy()}),this.choicesNavigators.forEach(function(navigator){return navigator.destroy()}),this.choicesNavigators=[],this.keyNavigators=[],this}}}),define("taoQtiTest/runner/plugins/content/accessibility/keyNavigation/strategies/stimulusNavigation",["jquery","i18n","ui/keyNavigation/navigator","ui/keyNavigation/navigableDomElement","taoQtiTest/runner/plugins/content/accessibility/keyNavigation/helpers"],function($,__,keyNavigator,navigableDomElement,helpers){'use strict';$=$&&Object.prototype.hasOwnProperty.call($,"default")?$["default"]:$,__=__&&Object.prototype.hasOwnProperty.call(__,"default")?__["default"]:__,keyNavigator=keyNavigator&&Object.prototype.hasOwnProperty.call(keyNavigator,"default")?keyNavigator["default"]:keyNavigator,navigableDomElement=navigableDomElement&&Object.prototype.hasOwnProperty.call(navigableDomElement,"default")?navigableDomElement["default"]:navigableDomElement;return{name:"stimulus",init:function(){var _this=this,config=this.getConfig(),$content=this.getTestRunner().getAreaBroker().getContentArea();this.keyNavigators=[];var isEnabledDecorator=function(element){var originalIsEnabled=element.isEnabled;return element.isEnabled=function(){if(originalIsEnabled.call(this)){var node=this.getElement().get(0);return node.scrollHeight>node.clientHeight}return!1},element};return $content.find(".stimulus-container").addClass("key-navigation-scrollable").each(function(i,el){var $element=$(el),elements=navigableDomElement.createFromDoms($element).map(isEnabledDecorator);$element.attr("aria-label",__("Passage"));var navigator=keyNavigator({id:"".concat("stimulus-element-navigation-group","-").concat(i),elements:elements,group:$element,propagateTab:!1});helpers.setupItemsNavigator(navigator,config),_this.keyNavigators.push(navigator)}),this},getNavigators:function(){return this.keyNavigators},destroy:function(){return this.keyNavigators.forEach(function(navigator){return navigator.destroy()}),this.keyNavigators=[],this}}}),define("taoQtiTest/runner/plugins/content/accessibility/keyNavigation/strategies/jumpLinks",["jquery","ui/keyNavigation/navigator","ui/keyNavigation/navigableDomElement","taoQtiTest/runner/plugins/content/accessibility/keyNavigation/helpers"],function($,keyNavigator,navigableDomElement,helpers){'use strict';$=$&&Object.prototype.hasOwnProperty.call($,"default")?$["default"]:$,keyNavigator=keyNavigator&&Object.prototype.hasOwnProperty.call(keyNavigator,"default")?keyNavigator["default"]:keyNavigator,navigableDomElement=navigableDomElement&&Object.prototype.hasOwnProperty.call(navigableDomElement,"default")?navigableDomElement["default"]:navigableDomElement;return{name:"jump-links",init:function(){var _this=this,config=this.getConfig(),$jumpLinksBox=$(".content-wrap"),$links=$jumpLinksBox.find(".jump-link");this.keyNavigators=[];var registerTopToolbarNavigator=function(id,group,$elements){var elements=navigableDomElement.createFromDoms($elements);if(elements.length){var navigator=keyNavigator({id:id,group:group,elements:elements,propagateTab:!1});helpers.setupItemsNavigator(navigator,config),helpers.setupClickableNavigator(navigator),_this.keyNavigators.push(navigator)}};return $links.each(function(index,element){return registerTopToolbarNavigator("".concat("jump-links","-").concat(index),$jumpLinksBox,$(element))}),this},getNavigators:function(){return this.keyNavigators},destroy:function(){return this.keyNavigators.forEach(function(navigator){return navigator.destroy()}),this.keyNavigators=[],this}}}),define("taoQtiTest/runner/plugins/content/accessibility/keyNavigation/strategies/index",["exports","taoQtiTest/runner/plugins/content/accessibility/keyNavigation/strategies/headerNavigation","taoQtiTest/runner/plugins/content/accessibility/keyNavigation/strategies/toolbarNavigation","taoQtiTest/runner/plugins/content/accessibility/keyNavigation/strategies/topToolbarNavigation","taoQtiTest/runner/plugins/content/accessibility/keyNavigation/strategies/navigatorNavigation","taoQtiTest/runner/plugins/content/accessibility/keyNavigation/strategies/pageNavigation","taoQtiTest/runner/plugins/content/accessibility/keyNavigation/strategies/rubricsNavigation","taoQtiTest/runner/plugins/content/accessibility/keyNavigation/strategies/itemNavigation","taoQtiTest/runner/plugins/content/accessibility/keyNavigation/strategies/linearItemNavigation","taoQtiTest/runner/plugins/content/accessibility/keyNavigation/strategies/stimulusNavigation","taoQtiTest/runner/plugins/content/accessibility/keyNavigation/strategies/jumpLinks"],function(exports,headerNavigation,toolbarNavigation,topToolbarNavigation,navigatorNavigation,pageNavigation,rubricsNavigation,itemNavigation,linearItemNavigation,stimulusNavigation,jumpLinks){'use strict';headerNavigation=headerNavigation&&Object.prototype.hasOwnProperty.call(headerNavigation,"default")?headerNavigation["default"]:headerNavigation,toolbarNavigation=toolbarNavigation&&Object.prototype.hasOwnProperty.call(toolbarNavigation,"default")?toolbarNavigation["default"]:toolbarNavigation,topToolbarNavigation=topToolbarNavigation&&Object.prototype.hasOwnProperty.call(topToolbarNavigation,"default")?topToolbarNavigation["default"]:topToolbarNavigation,navigatorNavigation=navigatorNavigation&&Object.prototype.hasOwnProperty.call(navigatorNavigation,"default")?navigatorNavigation["default"]:navigatorNavigation,pageNavigation=pageNavigation&&Object.prototype.hasOwnProperty.call(pageNavigation,"default")?pageNavigation["default"]:pageNavigation,rubricsNavigation=rubricsNavigation&&Object.prototype.hasOwnProperty.call(rubricsNavigation,"default")?rubricsNavigation["default"]:rubricsNavigation,itemNavigation=itemNavigation&&Object.prototype.hasOwnProperty.call(itemNavigation,"default")?itemNavigation["default"]:itemNavigation,linearItemNavigation=linearItemNavigation&&Object.prototype.hasOwnProperty.call(linearItemNavigation,"default")?linearItemNavigation["default"]:linearItemNavigation,stimulusNavigation=stimulusNavigation&&Object.prototype.hasOwnProperty.call(stimulusNavigation,"default")?stimulusNavigation["default"]:stimulusNavigation,jumpLinks=jumpLinks&&Object.prototype.hasOwnProperty.call(jumpLinks,"default")?jumpLinks["default"]:jumpLinks,exports.headerNavigationStrategy=headerNavigation,exports.toolbarNavigationStrategy=toolbarNavigation,exports.topToolbarNavigationStrategy=topToolbarNavigation,exports.navigatorNavigationStrategy=navigatorNavigation,exports.pageNavigationStrategy=pageNavigation,exports.rubricsNavigationStrategy=rubricsNavigation,exports.itemNavigationStrategy=itemNavigation,exports.linearItemNavigationStrategy=linearItemNavigation,exports.stimulusNavigationStrategy=stimulusNavigation,exports.jumpLinksNavigationStrategy=jumpLinks,Object.defineProperty(exports,"__esModule",{value:!0})}),define("taoQtiTest/runner/plugins/content/accessibility/keyNavigation/strategiesManager",["core/providerRegistry","taoQtiTest/runner/plugins/content/accessibility/keyNavigation/strategies/index"],function(providerRegistry,strategies){'use strict';function strategyFactory(name,testRunner,config){var strategy=strategyFactory.getProvider(name);return{init:function(){return strategy.init.call(this),this},getName:function(){return name},getConfig:function(){return config},getTestRunner:function(){return testRunner},getNavigators:function(){return"function"==typeof strategy.getNavigators?strategy.getNavigators.call(this):[]},destroy:function(){return"function"==typeof strategy.destroy&&strategy.destroy.call(this),this}}}return providerRegistry=providerRegistry&&Object.prototype.hasOwnProperty.call(providerRegistry,"default")?providerRegistry["default"]:providerRegistry,providerRegistry(strategyFactory),Object.values(strategies).forEach(function(strategy){return strategyFactory.registerProvider(strategy.name,strategy)}),strategyFactory}),define("taoQtiTest/runner/plugins/content/accessibility/keyNavigation/helpers",["exports","jquery","lodash","taoQtiTest/runner/plugins/content/accessibility/keyNavigation/strategiesManager"],function(exports,$,_,strategyFactory){'use strict';function allowedToNavigateFrom(from){var element=from;if(element&&"function"==typeof element.getCursor){var _element$getCursor=element.getCursor(),navigable=_element$getCursor.navigable;element=navigable}element&&"function"==typeof element.getElement&&(element=element.getElement());var $element=$(element);return!($element.hasClass("no-key-navigation")||0<$element.parents(".".concat("no-key-navigation")).length)}function getNavigators(strategies){return _.flatten(strategies.map(function(strategy){return strategy.getNavigators()}))}$=$&&Object.prototype.hasOwnProperty.call($,"default")?$["default"]:$,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,strategyFactory=strategyFactory&&Object.prototype.hasOwnProperty.call(strategyFactory,"default")?strategyFactory["default"]:strategyFactory;exports.allowedToNavigateFrom=allowedToNavigateFrom,exports.getNavigators=getNavigators,exports.getStrategies=function(navigationMode,testRunner){return navigationMode.strategies.map(function(area){return strategyFactory(area,testRunner,navigationMode.config).init()})},exports.setupClickableNavigator=function(navigator){return navigator.on("activate",function(cursor){var $elt=cursor.navigable.getElement();$elt.is(":checkbox")?$elt.each(function(){this.click()}):$elt.click().mousedown()})},exports.setupItemsNavigator=function(navigator,config){return navigator.on(config.keyNextItem,function(elem){allowedToNavigateFrom(elem)&&this.next()}).on(config.keyPrevItem,function(elem){allowedToNavigateFrom(elem)&&this.previous()})},Object.defineProperty(exports,"__esModule",{value:!0})}),define("taoQtiTest/runner/plugins/content/accessibility/keyNavigation/modes/defaultMode",[],function(){'use strict';return{name:"default",init:function(){var config=0<arguments.length&&arguments[0]!==void 0?arguments[0]:{};return{strategies:["rubrics","stimulus","item","toolbar","header","top-toolbar","navigator","page"],config:Object.assign({autoFocus:!0,wcagBehavior:!1,keepState:!0,propagateTab:!1,flatNavigation:!1,keyNextGroup:"tab",keyPrevGroup:"shift+tab",keyNextItem:"right down",keyPrevItem:"left up",keyNextTab:"right",keyPrevTab:"left",keyNextContent:"down",keyPrevContent:"up"},config)}}}}),define("taoQtiTest/runner/plugins/content/accessibility/keyNavigation/modes/linearMode",[],function(){'use strict';return{name:"linear",init:function(){var config=0<arguments.length&&arguments[0]!==void 0?arguments[0]:{};return{strategies:["rubrics","stimulus","linearItem","toolbar","header","top-toolbar","navigator","page"],config:Object.assign({autoFocus:!0,wcagBehavior:!1,keepState:!0,propagateTab:!1,flatNavigation:!1,keyNextGroup:"tab",keyPrevGroup:"shift+tab",keyNextItem:"right down",keyPrevItem:"left up",keyNextTab:"right",keyPrevTab:"left",keyNextContent:"down",keyPrevContent:"up"},config)}}}}),define("taoQtiTest/runner/plugins/content/accessibility/keyNavigation/modes/nativeMode",[],function(){'use strict';return{name:"native",init:function(){var config=0<arguments.length&&arguments[0]!==void 0?arguments[0]:{};return{strategies:["jump-links","header","top-toolbar","navigator","page","rubrics","stimulus","item","toolbar"],config:Object.assign({autoFocus:!1,wcagBehavior:!1,keepState:!1,propagateTab:!0,flatNavigation:!0,keyNextGroup:"tab",keyPrevGroup:"shift+tab",keyNextItem:"right down",keyPrevItem:"left up",keyNextTab:"",keyPrevTab:"",keyNextContent:"",keyPrevContent:""},config)}}}}),define("taoQtiTest/runner/plugins/content/accessibility/keyNavigation/modes/index",["exports","taoQtiTest/runner/plugins/content/accessibility/keyNavigation/modes/defaultMode","taoQtiTest/runner/plugins/content/accessibility/keyNavigation/modes/linearMode","taoQtiTest/runner/plugins/content/accessibility/keyNavigation/modes/nativeMode"],function(exports,defaultMode,linearMode,nativeMode){'use strict';defaultMode=defaultMode&&Object.prototype.hasOwnProperty.call(defaultMode,"default")?defaultMode["default"]:defaultMode,linearMode=linearMode&&Object.prototype.hasOwnProperty.call(linearMode,"default")?linearMode["default"]:linearMode,nativeMode=nativeMode&&Object.prototype.hasOwnProperty.call(nativeMode,"default")?nativeMode["default"]:nativeMode,exports.defaultModeProvider=defaultMode,exports.linearModeProvider=linearMode,exports.nativeModeProvider=nativeMode,Object.defineProperty(exports,"__esModule",{value:!0})}),define("taoQtiTest/runner/plugins/content/accessibility/keyNavigation/modesManager",["core/providerRegistry","taoQtiTest/runner/plugins/content/accessibility/keyNavigation/modes/index"],function(providerRegistry,modes){'use strict';function modeFactory(mode){var config=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},instance=modeFactory.getProvider(mode);return instance.init(config)}return providerRegistry=providerRegistry&&Object.prototype.hasOwnProperty.call(providerRegistry,"default")?providerRegistry["default"]:providerRegistry,providerRegistry(modeFactory),Object.values(modes).forEach(function(mode){return modeFactory.registerProvider(mode.name,mode)}),modeFactory}),define("taoQtiTest/runner/plugins/content/accessibility/keyNavigation/keyNavigation",["ui/keyNavigation/navigator","taoQtiTest/runner/plugins/content/accessibility/keyNavigation/helpers","taoQtiTest/runner/plugins/content/accessibility/keyNavigation/modesManager","util/shortcut"],function(keyNavigator,helpers,modeFactory,shortcut){'use strict';keyNavigator=keyNavigator&&Object.prototype.hasOwnProperty.call(keyNavigator,"default")?keyNavigator["default"]:keyNavigator,modeFactory=modeFactory&&Object.prototype.hasOwnProperty.call(modeFactory,"default")?modeFactory["default"]:modeFactory,shortcut=shortcut&&Object.prototype.hasOwnProperty.call(shortcut,"default")?shortcut["default"]:shortcut;return function(testRunner){var config=1<arguments.length&&arguments[1]!==void 0?arguments[1]:{},contentNavigatorType=config.contentNavigatorType,groupNavigator=null,strategies=[];return{init:function(){var navigationMode=modeFactory(contentNavigatorType,config),navigationConfig=navigationMode.config;strategies=helpers.getStrategies(navigationMode,testRunner);var navigators=helpers.getNavigators(strategies);return document.activeElement&&document.activeElement.blur(),groupNavigator=keyNavigator({id:"test-runner",loop:!0,elements:navigators,propagateTab:navigationConfig.propagateTab}),helpers.setupItemsNavigator(groupNavigator,{keyNextItem:navigationConfig.keyNextGroup,keyPrevItem:navigationConfig.keyPrevGroup}),shortcut.remove(".keyNavigation").add("tab".concat(".keyNavigation"," shift+tab").concat(".keyNavigation"),function(e){return!!helpers.allowedToNavigateFrom(e.target)&&void(!groupNavigator.isFocused()&&groupNavigator.focus())}),this},getTestRunner:function(){return testRunner},setMode:function(newMode){return contentNavigatorType=newMode,this},getMode:function(){return contentNavigatorType},isActive:function(){return null!==groupNavigator},destroy:function(){return shortcut.remove(".keyNavigation"),strategies.forEach(function(strategy){return strategy.destroy()}),groupNavigator&&groupNavigator.destroy(),groupNavigator=null,strategies=[],this}}}}),define("css!taoQtiTest/runner/plugins/content/accessibility/css/key-navigation",[],function(){}),define("taoQtiTest/runner/plugins/content/accessibility/keyNavigation/plugin",["lodash","taoQtiTest/runner/plugins/content/accessibility/keyNavigation/keyNavigation","taoTests/runner/plugin","css!taoQtiTest/runner/plugins/content/accessibility/css/key-navigation.css"],function(_,keyNavigatorFactory,pluginFactory){'use strict';_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,keyNavigatorFactory=keyNavigatorFactory&&Object.prototype.hasOwnProperty.call(keyNavigatorFactory,"default")?keyNavigatorFactory["default"]:keyNavigatorFactory,pluginFactory=pluginFactory&&Object.prototype.hasOwnProperty.call(pluginFactory,"default")?pluginFactory["default"]:pluginFactory;var defaultPluginConfig={contentNavigatorType:"default"},plugin=pluginFactory({name:"keyNavigation",init:function(){var testRunner=this.getTestRunner(),pluginConfig=_.defaults(this.getConfig(),defaultPluginConfig),keyNavigator=keyNavigatorFactory(testRunner,pluginConfig);testRunner.after("renderitem",function(){keyNavigator.isActive()&&keyNavigator.destroy(),keyNavigator.init()}).on("unloaditem",function(){keyNavigator.destroy()}).on("setcontenttabtype",function(type){keyNavigator.setMode(type),pluginConfig.contentNavigatorType=type})}});return plugin}),define("taoQtiTest/runner/plugins/content/accessibility/mainLandmark/header",["jquery","i18n","taoTests/runner/plugin","handlebars"],function($$1,__,pluginFactory,Handlebars){'use strict';function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);enumerableOnly&&(symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})),keys.push.apply(keys,symbols)}return keys}function _objectSpread2(target){for(var i=1,source;i<arguments.length;i++)source=null==arguments[i]?{}:arguments[i],i%2?ownKeys(Object(source),!0).forEach(function(key){_defineProperty(target,key,source[key])}):Object.getOwnPropertyDescriptors?Object.defineProperties(target,Object.getOwnPropertyDescriptors(source)):ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))});return target}function _defineProperty(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function headerTpl(data,options,asString){var html=Template(data,options);return asString||!0?html:$(html)}function getState(item){var state=__("Unseen");return item.flagged?state=__("Flagged"):item.answered?state=__("Answered"):item.viewed&&(state=__("Viewed")),state}$$1=$$1&&Object.prototype.hasOwnProperty.call($$1,"default")?$$1["default"]:$$1,__=__&&Object.prototype.hasOwnProperty.call(__,"default")?__["default"]:__,pluginFactory=pluginFactory&&Object.prototype.hasOwnProperty.call(pluginFactory,"default")?pluginFactory["default"]:pluginFactory,Handlebars=Handlebars&&Object.prototype.hasOwnProperty.call(Handlebars,"default")?Handlebars["default"]:Handlebars;var Template=Handlebars.template(function(Handlebars,depth0,helpers){return this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),"<span data-control=\"qti-test-item-title\"></span>\n<span data-control=\"qti-test-item-state\"></span>\n"}),header=pluginFactory({name:"mainLandmark",init:function(){var _this=this,testRunner=this.getTestRunner(),updateTitle=function(item){_this.$title.text("".concat(item.label)).show()},updateState=function(item){_this.$state.text("".concat(getState(item))).show()};testRunner.after("renderitem",function(){var item=testRunner.getCurrentItem();updateTitle(item),updateState(item)}).on("tool-flagitem",function(){var item=testRunner.getCurrentItem();item=_objectSpread2(_objectSpread2({},item),{},{flagged:!item.flagged}),updateState(item)})},render:function(){var $container=this.getAreaBroker().getArea("mainLandmark");this.$element=$$1(headerTpl()),$container.append(this.$element),this.$title=$container.find("[data-control=\"qti-test-item-title\"]"),this.$state=$container.find("[data-control=\"qti-test-item-state\"]")}});return header}),define("taoQtiTest/runner/plugins/content/dialog/dialog",["jquery","lodash","taoTests/runner/plugin","ui/dialog/alert","ui/dialog/confirm","util/shortcut/registry","util/shortcut","util/namespace"],function($,_,pluginFactory,dialogAlert,dialogConfirm,shortcutRegistry,globalShortcut,namespaceHelper){'use strict';$=$&&Object.prototype.hasOwnProperty.call($,"default")?$["default"]:$,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,pluginFactory=pluginFactory&&Object.prototype.hasOwnProperty.call(pluginFactory,"default")?pluginFactory["default"]:pluginFactory,dialogAlert=dialogAlert&&Object.prototype.hasOwnProperty.call(dialogAlert,"default")?dialogAlert["default"]:dialogAlert,dialogConfirm=dialogConfirm&&Object.prototype.hasOwnProperty.call(dialogConfirm,"default")?dialogConfirm["default"]:dialogConfirm,shortcutRegistry=shortcutRegistry&&Object.prototype.hasOwnProperty.call(shortcutRegistry,"default")?shortcutRegistry["default"]:shortcutRegistry,globalShortcut=globalShortcut&&Object.prototype.hasOwnProperty.call(globalShortcut,"default")?globalShortcut["default"]:globalShortcut,namespaceHelper=namespaceHelper&&Object.prototype.hasOwnProperty.call(namespaceHelper,"default")?namespaceHelper["default"]:namespaceHelper;var actionPrefix="tool-".concat("dialog","-"),defaultOptions={alert:{focus:"ok"},confirm:{focus:"ok"}},dialog=pluginFactory({name:"dialog",init:function(){function closeAccept(dialog){dialog.trigger("okbtn.modal").hide()}function closeReject(dialog){dialog.hide()}function closeLast(accept,shortcut){var handle=opened.length&&opened[opened.length-1];handle&&(handle.shortcut=shortcut,accept?closeAccept(handle.dialog):closeReject(handle.dialog))}function addHandle(namespace,stack,dialog,message,accept,reject,options){function doAccept(e,reason){_.isFunction(accept)&&accept(handle.shortcut||reason)}function doReject(e,reason){_.isFunction(reject)&&reject(handle.shortcut||reason)}var handle={context:namespace,dialog:dialog(message,doAccept,doReject,options)};globalShortcut.disable(),dialogShortcut.enable(),stack.push(handle),opened.push(handle),handle.dialog.focus(options.focus),handle.dialog.on("closed.modal",function(){removeHandle(stack,handle.dialog),removeHandle(opened,handle.dialog),opened.length||(globalShortcut.enable(),dialogShortcut.disable())})}function removeHandle(stack,dialog){dialog&&_.remove(stack,function(handle){if(handle&&dialog===handle.dialog)return!0})}function closeDialogs(namespace,accept,stack){stack?_.forEach(stack,function(handle){handle&&("@"===namespace||namespace===handle.context)&&(accept?closeAccept(handle.dialog):closeReject(handle.dialog))}):(closeDialogs(namespace,accept,alerts),closeDialogs(namespace,accept,confirms))}var testRunner=this.getTestRunner(),testOptions=testRunner.getOptions(),pluginConfig=Object.assign({},defaultOptions,this.getConfig()),pluginShortcuts=(testOptions.shortcuts||{}).dialog||{},alerts=[],confirms=[],opened=[],dialogShortcut=shortcutRegistry($("body"),{propagate:!1,prevent:!0});dialogShortcut.disable().set("Tab Shift+Tab"),testOptions.allowShortcuts&&_.forEach(pluginShortcuts,function(command,key){dialogShortcut.add(namespaceHelper.namespaceAll(command,"dialog",!0),function(e,shortcut){testRunner.trigger(actionPrefix+key,shortcut)})}),testRunner.before("alert.*",function(e,msg,accept,options){addHandle(e.namespace,alerts,dialogAlert,msg,accept,accept,_.merge({},pluginConfig.alert,options))}).before("confirm.*",function(e,msg,accept,reject,options){addHandle(e.namespace,confirms,dialogConfirm,msg,accept,reject,_.merge({},pluginConfig.confirm,options))}).before("closedialog.*",function(e,accept){closeDialogs(e.namespace,accept)}).on("".concat(actionPrefix,"accept"),function(shortcut){closeLast(!0,shortcut)}).on("".concat(actionPrefix,"reject"),function(shortcut){closeLast(!1,shortcut)}).on("destroy",function(){closeDialogs(".@"),dialogShortcut.clear(),dialogShortcut=null})}});return dialog}),define("taoQtiTest/runner/plugins/content/dialog/exitMessages",["lodash","taoTests/runner/plugin"],function(_,pluginFactory){'use strict';_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,pluginFactory=pluginFactory&&Object.prototype.hasOwnProperty.call(pluginFactory,"default")?pluginFactory["default"]:pluginFactory;var exitMessages=pluginFactory({name:"exitMessages",init:function(){},install:function(){var testRunner=this.getTestRunner();testRunner.before("leave",function(e,data){if(_.isObject(data)&&data.message)return new Promise(function(resolve){var context=testRunner.getTestContext();context&&context.itemIdentifier&&testRunner.disableItem(context.itemIdentifier),testRunner.trigger("disablefeedbackalerts").trigger("alert.leave",data.message,function(){testRunner.trigger("enablefeedbackalerts"),resolve()})})})}});return exitMessages}),define("taoQtiTest/runner/plugins/content/dialog/itemAlertMessage",["jquery","ui/hider","taoTests/runner/plugin"],function($,hider,pluginFactory){'use strict';$=$&&Object.prototype.hasOwnProperty.call($,"default")?$["default"]:$,pluginFactory=pluginFactory&&Object.prototype.hasOwnProperty.call(pluginFactory,"default")?pluginFactory["default"]:pluginFactory;var itemAlertMessage=pluginFactory({name:"itemAlertMessage",init:function(){var self=this;this.$element=$(this.getContent().dom),this.$element.on("closed.modal",function(){$(this).modal("destroy")}).on("destroyed.modal",function(){self.$element=null,self.trigger("resume",self)})},render:function(){var testRunner=this.getTestRunner(),itemRunner=testRunner.itemRunner,$modalsContainer=this.getContent().$container;$modalsContainer||($modalsContainer=$("#modalFeedbacks",itemRunner._item.container)),$modalsContainer.append(this.$element),this.$element.modal({startClosed:!1,top:200})},destroy:function(){this.$element&&this.$element.length&&this.$element.modal("close")}});return itemAlertMessage}),define("taoQtiTest/runner/helpers/navigation",["lodash","taoQtiTest/runner/helpers/map"],function(_,mapHelper){'use strict';_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,mapHelper=mapHelper&&Object.prototype.hasOwnProperty.call(mapHelper,"default")?mapHelper["default"]:mapHelper;var navigationHelper={isLeavingSection:function(testContext,testMap,direction,scope,position){var section,sectionStats,nbItems,item;if(_.isPlainObject(testContext)&&_.isPlainObject(testMap)&&!_.isEmpty(testContext.sectionId)&&!_.isEmpty(testContext.itemIdentifier))return section=mapHelper.getSection(testMap,testContext.sectionId),sectionStats=mapHelper.getSectionStats(testMap,testContext.sectionId),nbItems=sectionStats&&sectionStats.total,item=mapHelper.getItem(testMap,testContext.itemIdentifier),"section"===scope||"testPart"===scope||"next"===direction&&item.positionInSection+1===nbItems||"previous"===direction&&0===item.positionInSection||"jump"===direction&&0<position&&(position<section.position||position>=section.position+nbItems);throw new TypeError("Invalid test context and test map")},isLeavingTestPart:function(testContext,testMap,direction,scope,position){var testPart,testPartStats,nbItems,item,section,sectionStats;if(_.isPlainObject(testContext)&&_.isPlainObject(testMap)&&!_.isEmpty(testContext.testPartId)&&!_.isEmpty(testContext.sectionId)&&!_.isEmpty(testContext.itemIdentifier))return testPart=mapHelper.getPart(testMap,testContext.testPartId),testPartStats=mapHelper.getPartStats(testMap,testContext.testPartId),nbItems=testPartStats&&testPartStats.total,item=mapHelper.getItem(testMap,testContext.itemIdentifier),"section"===scope&&(section=mapHelper.getSection(testMap,testContext.sectionId),sectionStats=mapHelper.getSectionStats(testMap,testContext.sectionId)),"testPart"===scope||"next"===direction&&"item"===scope&&item.positionInPart+1===nbItems||"next"===direction&&"section"===scope&&section.position+sectionStats.total>=nbItems||"previous"===direction&&"item"===scope&&0===item.positionInPart||"previous"===direction&&"section"===scope&&section.position===testPart.position||"jump"===direction&&0<position&&(position<testPart.position||position>=testPart.position+nbItems);throw new TypeError("Invalid test context and test map")},isLast:function(testMap,itemIdentifier){return this.isLastOf(testMap,itemIdentifier,"test")},isFirst:function(testMap,itemIdentifier){return this.isFirstOf(testMap,itemIdentifier,"test")},isLastOf:function(testMap,itemIdentifier,scope){var item,stats;if(!_.isPlainObject(testMap))throw new TypeError("Invalid test map");if(_.isEmpty(itemIdentifier))throw new TypeError("Invalid item identifier");if(scope=scope||"test",item=mapHelper.getItem(testMap,itemIdentifier),stats=mapHelper.getScopeStats(testMap,item.position,scope),stats&&_.isNumber(stats.total)){if("test"===scope)return item.position+1===stats.total;if("section"===scope||"assessmentSection"===scope||"testSection"===scope)return item.positionInSection+1===stats.total;if("part"===scope||"testPart"===scope)return item.positionInPart+1===stats.total}return!1},isFirstOf:function(testMap,itemIdentifier,scope){var item;if(!_.isPlainObject(testMap))throw new TypeError("Invalid test map");if(_.isEmpty(itemIdentifier))throw new TypeError("Invalid item identifier");return scope=scope||"test",item=mapHelper.getItem(testMap,itemIdentifier),"test"===scope?0===item.position:"section"===scope||"assessmentSection"===scope||"testSection"===scope?0===item.positionInSection:("part"===scope||"testPart"===scope)&&0===item.positionInPart},getSiblingItems:function(testMap,itemPosition,direction,size){var itemId=mapHelper.getItemIdentifier(testMap,itemPosition),previous=null,siblings=[],itemChain=_.reduce(testMap&&testMap.jumps,function(map,jump){var ref=jump.identifier;return previous&&(map[previous].next=ref),map[ref]={identifier:ref,previous:previous,next:null},previous=ref,map},{}),directions;return size=_.isFinite(size)?parseInt(size,10):3,directions=direction&&"both"!==direction?[direction]:["previous","next"],_.forEach(directions,function(link){var id=itemId;_.times(size,function(){return id=itemChain[id]&&itemChain[id][link],!!id&&void siblings.push(mapHelper.getItem(testMap,id))})}),siblings},getNextItem:function(testMap,itemPosition){var siblings=navigationHelper.getSiblingItems(testMap,itemPosition,"next",1);return siblings.length?siblings[0]:null},getPreviousItem:function(testMap,itemPosition){var siblings=navigationHelper.getSiblingItems(testMap,itemPosition,"previous",1);return siblings.length?siblings[0]:null},isMovingToNextItem:function(action,params){return params=params||{},"timeout"===action||"skip"===action||"move"===action&&"next"===params.direction&&"item"===params.scope},isMovingToPreviousItem:function(action,params){return params=params||{},"move"===action&&"previous"===params.direction&&"item"===params.scope},isJumpingToItem:function(action,params){return params=params||{},"move"===action&&"jump"===params.direction&&"item"===params.scope}};return navigationHelper}),define("taoQtiTest/runner/plugins/content/dialog/itemInlineMessage",["jquery","i18n","ui/hider","taoTests/runner/plugin","handlebars","taoQtiTest/runner/helpers/navigation"],function($$1,__,hider,pluginFactory,Handlebars,navigationHelper){'use strict';function buttonTpl(data,options,asString){var html=Template(data,options);return asString||!0?html:$(html)}$$1=$$1&&Object.prototype.hasOwnProperty.call($$1,"default")?$$1["default"]:$$1,__=__&&Object.prototype.hasOwnProperty.call(__,"default")?__["default"]:__,pluginFactory=pluginFactory&&Object.prototype.hasOwnProperty.call(pluginFactory,"default")?pluginFactory["default"]:pluginFactory,Handlebars=Handlebars&&Object.prototype.hasOwnProperty.call(Handlebars,"default")?Handlebars["default"]:Handlebars,navigationHelper=navigationHelper&&Object.prototype.hasOwnProperty.call(navigationHelper,"default")?navigationHelper["default"]:navigationHelper;var Template=Handlebars.template(function(Handlebars,depth0,helpers,partials,data){function program1(depth0,data){var buffer="",stack1,helper;return buffer+=" ",(helper=helpers.className)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.className,stack1="function"===_typeof2(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1),buffer}function program3(depth0,data){var buffer="",stack1;return buffer+="\n aria-"+escapeExpression((stack1=null==data||!1===data?data:data.key,"function"===_typeof2(stack1)?stack1.apply(depth0):stack1))+"=\""+escapeExpression("function"===_typeof2(depth0)?depth0.apply(depth0):depth0)+"\"\n ",buffer}function program5(depth0,data){var buffer="",stack1,helper;return buffer+="<span class=\"icon icon-",(helper=helpers.icon)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.icon,stack1="function"===_typeof2(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1),stack1=helpers.unless.call(depth0,depth0&&depth0.text,{hash:{},inverse:self.noop,fn:self.program(6,program6,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\"></span>",buffer}function program6(){return" no-label"}function program8(depth0,data){var buffer="",stack1,helper;return buffer+="<span class=\"text\">",(helper=helpers.text)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.text,stack1="function"===_typeof2(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"</span>",buffer}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,self=this,stack1,helper;return buffer+="<li\n data-control=\"",(helper=helpers.control)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.control,stack1="function"===_typeof2(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\"\n class=\"small btn-info action",stack1=helpers["if"].call(depth0,depth0&&depth0.className,{hash:{},inverse:self.noop,fn:self.program(1,program1,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\"\n title=\"",(helper=helpers.title)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.title,stack1="function"===_typeof2(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\"\n role=\"button\"\n ",stack1=helpers.each.call(depth0,depth0&&depth0.aria,{hash:{},inverse:self.noop,fn:self.program(3,program3,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n>\n <a class=\"li-inner\" href=\"#\" onclick=\"return false\" aria-hidden=\"true\" >\n ",stack1=helpers["if"].call(depth0,depth0&&depth0.icon,{hash:{},inverse:self.noop,fn:self.program(5,program5,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n ",stack1=helpers["if"].call(depth0,depth0&&depth0.text,{hash:{},inverse:self.noop,fn:self.program(8,program8,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n </a>\n</li>\n",buffer}),buttonData={next:{control:"move-forward",title:__("Submit and go to the next item"),icon:"forward",text:__("OK")},end:{control:"move-end",title:__("Submit and go to the end of the test"),icon:"fast-forward",text:__("OK & End test")}},itemInlineMessage=pluginFactory({name:"itemInlineMessage",init:function(){var self=this,testRunner=this.getTestRunner(),createOkButton=function(){var testContext=testRunner.getTestContext(),testMap=testRunner.getTestMap(),dataType=navigationHelper.isLast(testMap,testContext.itemIdentifier)?"end":"next",$btn=$$1(buttonTpl(buttonData[dataType]));return $btn.addClass("modalFeedback-button"),$btn.on("click",function(e){e.preventDefault(),self.disable(),"move-end"===$$1(this).data("control")&&self.trigger("end"),$btn.remove(),self.$element.remove(),self.trigger("resume",self)}),$btn};this.$button=createOkButton(),this.$element=$$1(this.getContent().dom)},render:function(){var $navigationContainer=this.getAreaBroker().getNavigationArea(),testRunner=this.getTestRunner(),itemRunner=testRunner.itemRunner,$inlineContainer=this.getContent().$container;!$inlineContainer&&itemRunner._item.container&&($inlineContainer=$$1(".qti-itemBody",itemRunner._item.container)),$inlineContainer.append(this.$element),$$1(".modalFeedback-button",$navigationContainer).length||$navigationContainer.append(this.$button)},enable:function(){this.$button.removeProp("disabled").removeClass("disabled")},disable:function(){this.$button.prop("disabled",!0).addClass("disabled")},destroy:function(){this.$button.click()}});return itemInlineMessage}),define("taoQtiTest/runner/plugins/content/feedback/feedback",["i18n","taoTests/runner/plugin","ui/feedback"],function(__,pluginFactory,feedback$1){'use strict';function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_typeof(obj)}__=__&&Object.prototype.hasOwnProperty.call(__,"default")?__["default"]:__,pluginFactory=pluginFactory&&Object.prototype.hasOwnProperty.call(pluginFactory,"default")?pluginFactory["default"]:pluginFactory,feedback$1=feedback$1&&Object.prototype.hasOwnProperty.call(feedback$1,"default")?feedback$1["default"]:feedback$1;var feedback=pluginFactory({name:"feedback",init:function(){var self=this,testRunner=this.getTestRunner(),closeCurrent=function(){currentFeedback&&currentFeedback.close()},currentFeedback;this.setState("enabled",!0),testRunner.on("error",function(err){var message=err,type="error";self.getState("enabled")&&("object"===_typeof(err)&&(message=err.message,type=err.type),message||(message="TestState"===type?__("The test has been closed/suspended!"):"FileNotFound"===type?__("File not found!"):__("An error occurred!")),currentFeedback=feedback$1().error(message))}).on("danger",function(message){self.getState("enabled")&&(currentFeedback=feedback$1().danger(message))}).on("warning",function(message){self.getState("enabled")&&(currentFeedback=feedback$1().warning(message))}).on("info",function(message){self.getState("enabled")&&(currentFeedback=feedback$1().info(message))}).on("alert.* confirm.* unloaditem",closeCurrent).on("disablefeedbackalerts",function(){closeCurrent(),self.setState("enabled",!1)}).on("enablefeedbackalerts",function(){self.setState("enabled",!0)})}});return feedback}),define("taoQtiTest/runner/plugins/content/itemScrolling/itemScrolling",["jquery","util/typeCaster","taoTests/runner/plugin"],function($,typeCaster,pluginFactory){'use strict';$=$&&Object.prototype.hasOwnProperty.call($,"default")?$["default"]:$,typeCaster=typeCaster&&Object.prototype.hasOwnProperty.call(typeCaster,"default")?typeCaster["default"]:typeCaster,pluginFactory=pluginFactory&&Object.prototype.hasOwnProperty.call(pluginFactory,"default")?pluginFactory["default"]:pluginFactory;var itemScrolling=pluginFactory({name:"itemScrolling",init:function(){function adaptItemHeight(){var $itemContainer=$contentArea.find("[data-scrolling=\"true\"]"),contentHeight=getItemRunnerHeight()-getExtraGridRowHeight()-getSpaceAboveQtiContent()-12-60;$itemContainer.each(function(){var $item=$(this),isScrollable=typeCaster.strToBool($item.attr("data-scrolling")||"false"),selectedHeight=parseFloat($item.attr("data-scrolling-height"))||100,containerParent=$item.parent().closest("[data-scrolling=\"true\"]");$item.length&&isScrollable&&($item.data("scrollable",!0),$item.css({"overflow-y":"scroll"}),0<containerParent.length?$item.css("max-height","".concat(containerParent.height()*(.01*selectedHeight),"px")):$item.css("max-height","".concat(contentHeight*(.01*selectedHeight),"px")))})}function getItemRunnerHeight(){var $testRunnerSections=$(".test-runner-sections");return $testRunnerSections.length?$testRunnerSections.get(0).getBoundingClientRect().height:$(window).height()}function getExtraGridRowHeight(){var $gridRows=$(".qti-itemBody > .grid-row"),extraHeight=0;return $gridRows.each(function(){var $gridRow=$(this),$itemContainer=$gridRow.find("[data-scrolling=\"true\"]");$itemContainer.length||(extraHeight+=$gridRow.outerHeight(!0))}),extraHeight}function getSpaceAboveQtiContent(){var $testRunnerSections=$(".test-runner-sections"),$qtiContent=$("#qti-content");return $testRunnerSections.length&&$qtiContent.length?$qtiContent.get(0).getBoundingClientRect().top-$testRunnerSections.get(0).getBoundingClientRect().top:0}var testRunner=this.getTestRunner(),$contentArea=testRunner.getAreaBroker().getContentArea();testRunner.on("renderitem",function(){adaptItemHeight(),$(window).off("resize.adaptItemHeight"),$(window).on("resize.adaptItemHeight",adaptItemHeight)})}});return itemScrolling}),define("taoQtiTest/runner/plugins/content/loading/loading",["layout/loading-bar","taoTests/runner/plugin"],function(loadingBar,pluginFactory){'use strict';loadingBar=loadingBar&&Object.prototype.hasOwnProperty.call(loadingBar,"default")?loadingBar["default"]:loadingBar,pluginFactory=pluginFactory&&Object.prototype.hasOwnProperty.call(pluginFactory,"default")?pluginFactory["default"]:pluginFactory;var loading=pluginFactory({name:"loading",init:function(){var testRunner=this.getTestRunner();testRunner.on("unloaditem",function(){loadingBar.start()}).on("renderitem",function(){loadingBar.stop()})}});return loading}),define("taoQtiTest/runner/plugins/content/modalFeedback/modalFeedback",["jquery","lodash","module","taoTests/runner/plugin","taoQtiTest/runner/plugins/content/dialog/itemInlineMessage","taoQtiTest/runner/plugins/content/dialog/itemAlertMessage","ui/autoscroll"],function($,_,module,pluginFactory,inlineMessage,alertMessage,autoscroll){'use strict';function destroyFeedback(feedback){var removed=!1;_.remove(renderedFeedbacks,function(storedFeedback){var found=storedFeedback===feedback;return found&&(removed=!0),found}),removed&&(feedback.destroy(),!renderedFeedbacks.length&&nextStep())}function defineMode(inline){inlineMode=inline,messagePlugin=inlineMode?inlineMessage:alertMessage}$=$&&Object.prototype.hasOwnProperty.call($,"default")?$["default"]:$,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,module=module&&Object.prototype.hasOwnProperty.call(module,"default")?module["default"]:module,pluginFactory=pluginFactory&&Object.prototype.hasOwnProperty.call(pluginFactory,"default")?pluginFactory["default"]:pluginFactory,inlineMessage=inlineMessage&&Object.prototype.hasOwnProperty.call(inlineMessage,"default")?inlineMessage["default"]:inlineMessage,alertMessage=alertMessage&&Object.prototype.hasOwnProperty.call(alertMessage,"default")?alertMessage["default"]:alertMessage,autoscroll=autoscroll&&Object.prototype.hasOwnProperty.call(autoscroll,"default")?autoscroll["default"]:autoscroll;var modalFeedback=pluginFactory({name:"QtiModalFeedback",init:function(){nextStep=function(){},defineMode(!!module.config().inlineModalFeedback)},render:function(){var self=this,testRunner=this.getTestRunner(),createMessages=function(renderingQueue,inline){var bInlineMode=inlineMode;isDestroyed=!1,renderedFeedbacks=[],_.isBoolean(inline)&&defineMode(inline),renderingQueue.length?(_.forEach(renderingQueue,function(renderingToken){var feedback=messagePlugin(testRunner,testRunner.getAreaBroker());feedback.init({dom:renderingToken.feedback.render({inline:inlineMode}),$container:inlineMode?renderingToken.$container:null}),feedback.render(),renderedFeedbacks.push(feedback)}),inlineMode&&renderedFeedbacks&&autoscroll($(".qti-modalFeedback",testRunner.getAreaBroker().getContentArea()).first(),testRunner.getAreaBroker().getContentArea().parents(".content-wrapper"))):nextStep(),defineMode(bInlineMode)};inlineMode?testRunner.off("plugin-resume.itemInlineMessage").on("plugin-resume.itemInlineMessage",function(){self.destroy()}):testRunner.off("plugin-resume.itemAlertMessage").on("plugin-resume.itemAlertMessage",function(feedback){destroyFeedback(feedback)}),testRunner.on("modalFeedbacks",function(renderingQueue,done,inline){nextStep=done,createMessages(renderingQueue,inline)})},destroy:function(){var tFeedbacks,i;if(!isDestroyed)if(isDestroyed=!0,!renderedFeedbacks)nextStep();else for(i in tFeedbacks=renderedFeedbacks.slice(0),tFeedbacks)destroyFeedback(tFeedbacks[i])}}),inlineMode,messagePlugin,renderedFeedbacks,isDestroyed,nextStep;return modalFeedback}),define("taoQtiTest/runner/plugins/content/overlay/overlay",["jquery","taoTests/runner/plugin"],function($,pluginFactory){'use strict';$=$&&Object.prototype.hasOwnProperty.call($,"default")?$["default"]:$,pluginFactory=pluginFactory&&Object.prototype.hasOwnProperty.call(pluginFactory,"default")?pluginFactory["default"]:pluginFactory;var overlay=pluginFactory({name:"overlay",init:function(){var self=this,testRunner=this.getTestRunner();this.$element=$("<div />"),this.$element.on("click mousedown mouseup touchstart touchend keyup keydow keypress scroll drop",function(e){e.stopImmediatePropagation(),e.stopPropagation()});testRunner.on("disableitem",function(){self.enable()}).on("enableitem unloaditem modalFeedbacks",function(){self.disable()})},render:function(){var $contentArea=this.getTestRunner().getAreaBroker().getContentArea();$contentArea.after(this.$element)},destroy:function(){this.$element.remove()},enable:function(){var overlayConfig=this.getConfig();this.$element.addClass("overlay"),overlayConfig.full&&this.$element.addClass("overlay-full")},disable:function(){this.$element.removeClass("overlay overlay-full")},show:function(){this.enable()},hide:function(){this.disable()}});return overlay}),define("taoQtiTest/runner/plugins/content/responsiveness/collapser",["lodash","jquery","taoTests/runner/plugin"],function(_,$,pluginFactory){'use strict';_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,$=$&&Object.prototype.hasOwnProperty.call($,"default")?$["default"]:$,pluginFactory=pluginFactory&&Object.prototype.hasOwnProperty.call(pluginFactory,"default")?pluginFactory["default"]:pluginFactory;var labelHiddenCls="no-tool-label",separatorCls="separator",defaults={collapseTools:!0,collapseNavigation:!1,collapseInOrder:!1,hover:!1,collapseOrder:[]},$window=$(window),collapser=pluginFactory({name:"collapser",init:function(){function buildCollapsiblesList(){allCollapsibles=config.collapseInOrder&&config.collapseOrder.length?getCollapsiblesFromConfig():config.collapseInOrder?getSortedCollapsiblesFromDom():getUnsortedCollapsiblesFromDom()}function getExtraWidth($element){var expandedWidth,collapsedWidth;return $element.removeClass(collapseCls),expandedWidth=$element.outerWidth(!0),$element.addClass(collapseCls),collapsedWidth=$element.outerWidth(!0),$element.removeClass(collapseCls),expandedWidth-collapsedWidth}function toggleCollapsibles(){availableWidth=getAvailableWidth(),availableWidth<previousAvailableWidth?collapseInOrder():expandInOrder(),previousAvailableWidth=availableWidth}function collapseInOrder(){for(var collapsiblesCopy=_.clone(allCollapsibles),toCollapse;collapseNeeded()&&collapsiblesCopy.length;)toCollapse=collapsiblesCopy.shift(),toCollapse.$elements.addClass(collapseCls)}function collapseNeeded(){return getToolbarWidth()>getAvailableWidth()}function expandInOrder(){_.forEachRight(allCollapsibles,function(toExpand){if(toExpand.$elements.hasClass(collapseCls))if(expandPossible(toExpand.extraWidth))toExpand.$elements.removeClass(collapseCls);else return!1})}function expandPossible(extraWidth){return getToolbarWidth()+extraWidth<getAvailableWidth()}function getAvailableWidth(){return $actionsBar.width()-20}function getToolbarWidth(){return $toolbox.outerWidth(!0)+$navigation.outerWidth(!0)}function getControlsFromDom(){var $controls=$();return config.collapseTools&&($controls=$controls.add($toolbox.find(">ul>[data-control]").not(".".concat(labelHiddenCls)).not(".".concat(separatorCls)))),config.collapseNavigation&&($controls=$controls.add($navigation.find(">ul>[data-control]").not(".".concat(labelHiddenCls)).not(".".concat(separatorCls)))),$controls}function getCollapsiblesFromConfig(){return _.compact(config.collapseOrder.map(function(selector){var $elements=$(selector).not(".".concat(labelHiddenCls)).not(".".concat(separatorCls)),extraWidth=0;return!!$elements.length&&($elements.each(function(){extraWidth+=getExtraWidth($(this))}),{$elements:$elements,extraWidth:extraWidth})}))}function getSortedCollapsiblesFromDom(){var $elements=getControlsFromDom(),_allCollapsibles=[],order={};return $elements.each(function(){var ctrl=this.dataset.control,key=ctrl.substring(0,ctrl.search(/[A-Z-_]/))||ctrl;order[key]=order[key]||$(),order[key]=order[key].add($(this))}),_.forOwn(order,function($elements){var extraWidth=0;$elements.each(function(){extraWidth+=getExtraWidth($(this))}),_allCollapsibles.push({$elements:$elements,extraWidth:extraWidth})}),_.compact(_allCollapsibles)}function getUnsortedCollapsiblesFromDom(){var $elements=getControlsFromDom(),_allCollapsibles=[],extraWidth=0;return $elements.each(function(){extraWidth+=getExtraWidth($(this))}),_allCollapsibles.push({$elements:$elements,extraWidth:extraWidth}),_.compact(_allCollapsibles)}var testRunner=this.getTestRunner(),config=Object.assign({},defaults,this.getConfig()),collapseCls=config.hover?"tool-label-collapsed-hover":"tool-label-collapsed",areaBroker=testRunner.getAreaBroker(),$actionsBar=areaBroker.getArea("actionsBar"),$toolbox=areaBroker.getToolboxArea(),$navigation=areaBroker.getNavigationArea(),allCollapsibles,availableWidth,previousAvailableWidth;$window.on("resize".concat(".collapser"),_.throttle(function(){testRunner.trigger("collapseTools")},40)),testRunner.after("renderitem loaditem",function(){previousAvailableWidth=1/0,buildCollapsiblesList(),testRunner.trigger("collapseTools")}).on("collapseTools".concat(".collapser"),function(){toggleCollapsibles()})},destroy:function(){$window.off(".collapser")}});return collapser}),define("taoQtiTest/runner/plugins/content/rubricBlock/rubricBlock",["jquery","ui/hider","taoTests/runner/plugin","handlebars"],function($$1,hider,pluginFactory,Handlebars){'use strict';function containerTpl(data,options,asString){var html=Template(data,options);return asString||!0?html:$(html)}$$1=$$1&&Object.prototype.hasOwnProperty.call($$1,"default")?$$1["default"]:$$1,hider=hider&&Object.prototype.hasOwnProperty.call(hider,"default")?hider["default"]:hider,pluginFactory=pluginFactory&&Object.prototype.hasOwnProperty.call(pluginFactory,"default")?pluginFactory["default"]:pluginFactory,Handlebars=Handlebars&&Object.prototype.hasOwnProperty.call(Handlebars,"default")?Handlebars["default"]:Handlebars;var Template=Handlebars.template(function(Handlebars,depth0,helpers){return this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),"<div id=\"qti-rubrics\"></div>\n"}),blankifyLinks=function($container){$$1("a",$container).attr("target","_blank")},mathify=function($container){return new Promise(function(resolve){0<$$1("math",$container).length?require(["mathJax"],function(MathJax){MathJax?(MathJax.Hub.Queue(["Typeset",MathJax.Hub],$container[0]),MathJax.Hub.Queue(resolve)):resolve()},resolve):resolve()})},rubricBlock=pluginFactory({name:"rubricBlock",init:function(){var self=this,testRunner=this.getTestRunner();this.$element=$$1(containerTpl()),this.hide(),testRunner.on("ready",function(){self.hide()}).on("loaditem",function(){var context=testRunner.getTestContext();context.rubrics&&(self.$element.html(context.rubrics),blankifyLinks(self.$element),mathify(self.$element).then(function(){testRunner.trigger("rubricblock")}))}).on("renderitem",function(){self.show()}).on("unloaditem",function(){self.hide(),self.$element.empty()})},render:function(){var $container=this.getAreaBroker().getContentArea();$container.before(this.$element)},destroy:function(){this.$element.remove()},enable:function(){this.$element.removeProp("disabled").removeClass("disabled")},disable:function(){this.$element.prop("disabled",!0).addClass("disabled")},show:function(){hider.show(this.$element)},hide:function(){hider.hide(this.$element)}});return rubricBlock}),define("taoQtiTest/runner/plugins/controls/connectivity/connectivity",["jquery","lodash","i18n","core/polling","ui/waitingDialog/waitingDialog","taoTests/runner/plugin","handlebars","util/namespace"],function($$1,_,__,pollingFactory,waitingDialog,pluginFactory,Handlebars,namespaceHelper){'use strict';function connectivityTpl(data,options,asString){var html=Template(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"]:__,pollingFactory=pollingFactory&&Object.prototype.hasOwnProperty.call(pollingFactory,"default")?pollingFactory["default"]:pollingFactory,waitingDialog=waitingDialog&&Object.prototype.hasOwnProperty.call(waitingDialog,"default")?waitingDialog["default"]:waitingDialog,pluginFactory=pluginFactory&&Object.prototype.hasOwnProperty.call(pluginFactory,"default")?pluginFactory["default"]:pluginFactory,Handlebars=Handlebars&&Object.prototype.hasOwnProperty.call(Handlebars,"default")?Handlebars["default"]:Handlebars,namespaceHelper=namespaceHelper&&Object.prototype.hasOwnProperty.call(namespaceHelper,"default")?namespaceHelper["default"]:namespaceHelper;var Template=Handlebars.template(function(Handlebars,depth0,helpers,partials,data){function program3(depth0,data){var buffer="",helper,options;return buffer+="<span class=\"message-connect\">"+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"Online",options):helperMissing.call(depth0,"__","Online",options)))+"</span>",buffer}function program5(depth0,data){var buffer="",helper,options;return buffer+="<span class=\"message-disconnected\">"+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"Offline",options):helperMissing.call(depth0,"__","Offline",options)))+"</span>",buffer}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",helperMissing=helpers.helperMissing,escapeExpression=this.escapeExpression,self=this,stack1,helper,options;return buffer+="<div class=\"connectivity-box ",(helper=helpers.state)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.state,stack1="function"===_typeof2(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1),stack1=helpers["if"].call(depth0,depth0&&depth0.message,{hash:{},inverse:self.noop,fn:self.program(1,function(){return" with-message"},data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\">\n ",stack1=helpers["if"].call(depth0,depth0&&depth0.message,{hash:{},inverse:self.noop,fn:self.program(3,program3,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="<span data-control=\"connectivity-connected\" class=\"qti-controls icon-connect\" title=\""+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"Connected to server",options):helperMissing.call(depth0,"__","Connected to server",options)))+"\"></span>\n ",stack1=helpers["if"].call(depth0,depth0&&depth0.message,{hash:{},inverse:self.noop,fn:self.program(5,program5,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="<span data-control=\"connectivity-disconnected\" class=\"qti-controls icon-disconnect\" title=\""+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"Disconnected from server",options):helperMissing.call(depth0,"__","Disconnected from server",options)))+"\"></span>\n</div>\n",buffer}),defaultConfig={checkInterval:30000,indicator:!0,message:!1},connectivity=pluginFactory({name:"connectivity",init:function(){var self=this,testRunner=this.getTestRunner(),proxy=testRunner.getProxy(),config=Object.assign({},defaultConfig,this.getConfig());config&&config.indicator&&(this.$element=$$1(connectivityTpl({state:proxy.isOnline()?"connected":"disconnected",message:config.message})),testRunner.on("disconnect",function(){self.$element.removeClass("connected").addClass("disconnected")}).on("reconnect",function(){self.$element.removeClass("disconnected").addClass("connected")})),this.polling&&_.isNumber(config.checkInterval)&&this.polling.setInterval(config.checkInterval)},install:function(){var self=this,waiting=!1,testRunner=this.getTestRunner(),proxy=testRunner.getProxy();this.displayWaitingDialog=function(){var message=0<arguments.length&&arguments[0]!==void 0?arguments[0]:"",dialog;return new Promise(function(resolve){waiting||(waiting=!0,testRunner.before("pause.waiting",function(){return new Promise(function(pauseResolve){proxy.off("reconnect.pausing").after("reconnect.pausing",pauseResolve)})}),dialog=waitingDialog({message:__("You are encountering a prolonged connectivity loss. ")+message,waitContent:__("Please wait while we try to restore the connection."),proceedContent:__("The connection seems to be back, please proceed")}).on("proceed",function(){resolve()}).on("render",function(){proxy.off("reconnect.waiting").after("reconnect.waiting",function(){testRunner.off("pause.waiting"),waiting=!1,dialog.endWait()})}))})},this.polling=pollingFactory({action:function(){testRunner.getProxy().telemetry(testRunner.getTestContext().itemIdentifier,"up").catch(_.noop)},interval:defaultConfig.checkInterval,autoStart:!1}),proxy.on("disconnect",function(source){testRunner.getState("disconnected")||(testRunner.setState("disconnected",!0),testRunner.trigger("disconnect",source),self.polling.start())}).on("reconnect",function(){testRunner.getState("disconnected")&&(testRunner.setState("disconnected",!1),testRunner.trigger("reconnect"),self.polling.stop())}),testRunner.before("leave",function(e,data){if(proxy.isOffline())return self.displayWaitingDialog(data.message).then(function(){testRunner.trigger("leave",data)}).catch(function(generalErr){testRunner.trigger("error",generalErr)}),!1}),testRunner.before("error.connectivity",function(e,err){return!proxy.isConnectivityError(err)&&(proxy.isOffline()?(self.displayWaitingDialog().then(function(){"nav"===err.type&&testRunner.loadItem(testRunner.getTestContext().itemIdentifier),"finish"===err.type&&testRunner.finish(),"pause"===err.type&&testRunner.trigger("pause",{reasons:err.data&&err.data.reasons,message:err.data&&err.data.comment})}).catch(function(generalErr){testRunner.trigger("error",generalErr)}),!1):void 0)}),testRunner.before("loaditem.connectivity",function(e,itemRef,item){var testContext=testRunner.getTestContext();if(item.flags&&item.flags.hasFeedbacks&&(testContext.hasFeedbacks=!0),proxy.isOffline()&&item.flags&&item.flags.containsNonPreloadedAssets)return self.displayWaitingDialog().then(function(){testRunner.loadItem(itemRef)}),!1}),testRunner.before(namespaceHelper.namespaceAll("move skip timeout","connectivity"),function(e){for(var _len=arguments.length,args=Array(1<_len?_len-1:0),_key=1;_key<_len;_key++)args[_key-1]=arguments[_key];var testContext=testRunner.getTestContext(),currentItem=testRunner.getCurrentItem();if(proxy.isOffline()&&(currentItem.hasFeedbacks||testContext.hasFeedbacks))return testRunner.trigger("disableitem"),self.displayWaitingDialog().then(function(){var _testRunner$trigger;(_testRunner$trigger=testRunner.trigger("enableitem")).trigger.apply(_testRunner$trigger,[e.name].concat(args))}),!1})},destroy:function(){this.getTestRunner().off(".connectivity")},render:function(){var $container=this.getAreaBroker().getControlArea();this.$element&&$container.append(this.$element)}});return connectivity}),define("taoQtiTest/runner/plugins/controls/connectivity/pauseOnError",["i18n","taoTests/runner/plugin","handlebars"],function(__,pluginFactory,Handlebars){'use strict';function dialogTpl(data,options,asString){var html=Template(data,options);return asString||!0?html:$(html)}__=__&&Object.prototype.hasOwnProperty.call(__,"default")?__["default"]:__,pluginFactory=pluginFactory&&Object.prototype.hasOwnProperty.call(pluginFactory,"default")?pluginFactory["default"]:pluginFactory,Handlebars=Handlebars&&Object.prototype.hasOwnProperty.call(Handlebars,"default")?Handlebars["default"]:Handlebars;var Template=Handlebars.template(function(Handlebars,depth0,helpers,partials,data){this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,stack1,helper;return buffer+="<b>",(helper=helpers.title)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.title,stack1="function"===_typeof2(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"</b><br><br>\n",(helper=helpers.message)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.message,stack1="function"===_typeof2(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1),buffer}),name="pauseOnError",dialogMessage={title:__("Something unexpected happened."),message:__("Please try reloading the page or pause the test. If you pause, you will be able to resume the test from this page.")},dialogConfig={focus:"cancel",buttons:{labels:{ok:__("Pause the test"),cancel:__("Reload the page")}}},pauseContext={reasons:{category:"technical",subCategory:"error"},originalMessage:"Due to an unexpected issue the test has been suspended."},pauseOnError=pluginFactory({name:name,init:function(){var testRunner=this.getTestRunner(),returnToHome=function(){return testRunner.trigger("pause",pauseContext)},reloadPage=function(){return testRunner.trigger("reloadpage")},processError=function(error){testRunner.on("reloadpage",function(){return window.location.reload()}).trigger("disablenav disabletools hidenav").trigger("confirm.".concat(name),dialogTpl(dialogMessage),returnToHome,reloadPage,dialogConfig),500===error.code&&(error.originalCode=error.code,delete error.code,testRunner.trigger("disablefeedbackalerts"),testRunner.after("error.pauseOnError",function(){testRunner.off("error.pauseOnError"),testRunner.trigger("enablefeedbackalerts")}))};testRunner.before("error",function(e,error){return processError(error)})}});return pauseOnError}),define("taoQtiTest/runner/plugins/controls/duration/duration",["lodash","taoTests/runner/plugin","core/logger"],function(_,pluginFactory,loggerFactory){'use strict';_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,pluginFactory=pluginFactory&&Object.prototype.hasOwnProperty.call(pluginFactory,"default")?pluginFactory["default"]:pluginFactory,loggerFactory=loggerFactory&&Object.prototype.hasOwnProperty.call(loggerFactory,"default")?loggerFactory["default"]:loggerFactory;var logger=loggerFactory("taoQtiTest/runner/plugins/controls/duration/duration"),duration=pluginFactory({name:"duration",install:function(){this.getTestRunner().getTestStore().setVolatile(this.getName())},init:function(){var testRunner=this.getTestRunner(),currentUpdatePromise=Promise.resolve(),getItemAttempt=function(){var context=testRunner.getTestContext();return"".concat(context.itemIdentifier,"#").concat(context.attempt)},getPositiveNumber=function(value){return!_.isNumber(value)||0>value?0:value};return testRunner.getPluginStore(this.getName()).then(function(durationStore){var getItemDuration=function(attemptId){return /^(.*)+#+\d+$/.test(attemptId)?durationStore.getItem(attemptId):Promise.reject(new Error("Is it really an attempt id, like \"itemid#attempt\""))},updateDuration=function(elapsed){var itemAttemptId=getItemAttempt();return currentUpdatePromise=currentUpdatePromise.then(function(){return getItemDuration(itemAttemptId)}).then(function(duration){return durationStore.setItem(itemAttemptId,getPositiveNumber(duration)+getPositiveNumber(elapsed)/1e3)}).catch(function(err){logger.warn("Error updating item duration! ".concat(err&&err.message))}),currentUpdatePromise},addDurationToCallActionParams=function(){var itemAttemptId=getItemAttempt();return currentUpdatePromise.then(function(){return getItemDuration(itemAttemptId)}).then(function(duration){return testRunner.getProxy().addCallActionParams({itemDuration:getPositiveNumber(duration)})}).catch(function(err){logger.warn("Error retrieving item duration! ".concat(err&&err.message))})};testRunner.on("tick",updateDuration).before("move skip exit timeout pause",addDurationToCallActionParams).on("plugin-get.duration",function(attemptId,getDuration){_.isFunction(getDuration)&&getDuration(getItemDuration(attemptId))})})}});return duration}),define("taoQtiTest/runner/plugins/controls/progressbar/progress",["lodash","i18n","core/format","taoQtiTest/runner/helpers/map"],function(_,__,format,mapHelper){'use strict';function getFixedMap(testMap,testContext){var currentTestPart=mapHelper.getPart(testMap,testContext.testPartId),currentItem=mapHelper.getItemAt(testMap,testContext.itemPosition);if(currentItem.answered&&currentTestPart.isLinear){var fixedTestMap=_.cloneDeep(testMap),fixedCurrentItem=mapHelper.getItemAt(fixedTestMap,testContext.itemPosition);return fixedCurrentItem.answered=!1,fixedTestMap}return testMap}function getEmptyStats(){return{position:0,reached:0,viewed:0,completed:0,total:0}}function updateStats(stats,element,position){element.position<=position&&stats.position++,element.stats.viewed&&(stats.reached++,element.stats.viewed===element.stats.total&&stats.viewed++),element.stats.answered&&element.stats.answered===element.stats.questions&&stats.completed++,stats.total++}function updateItemStats(stats,element,position){element.position<=position&&stats.position++,element.viewed&&(stats.reached++,stats.viewed++),element.answered&&stats.completed++,stats.total++}function getCategoriesToMatch(categories){var matchSize=categories&&categories.length;return matchSize&&_.reduce(categories,function(map,category){return map[category]=!0,map},{})}function getProgressStats(testMap,testContext,config,scope){var fixedMap=getFixedMap(testMap,testContext),scopedMap=mapHelper.getScopeMap(fixedMap,testContext.itemPosition,scope),stats=_.clone(scopedMap.stats),categoriesToMatch,matchSize;return"categories"===config.indicator&&(categoriesToMatch=getCategoriesToMatch(config.categories),matchSize=config.categories&&config.categories.length,stats.matchedCategories=getEmptyStats()),stats.parts=getEmptyStats(),stats.sections=getEmptyStats(),stats.answerableParts=getEmptyStats(),stats.answerableSections=getEmptyStats(),_.forEach(scopedMap.parts,function(part){updateStats(stats.parts,part,testContext.itemPosition),0<part.stats.questions&&updateStats(stats.answerableParts,part,testContext.itemPosition),_.forEach(part.sections,function(section){updateStats(stats.sections,section,testContext.itemPosition),0<section.stats.questions&&updateStats(stats.answerableSections,section,testContext.itemPosition),"categories"===config.indicator&&_.forEach(section.items,function(item){matchCategories(item.categories,categoriesToMatch,matchSize)&&updateItemStats(stats.matchedCategories,item,testContext.itemPosition)})})}),stats}function matchCategories(categories,expectedCategories,minWanted){var matched=0;return expectedCategories&&_.forEach(categories,function(category){if(expectedCategories[category]&&(matched++,matched>=minWanted))return!1}),matched===minWanted}function getRatio(position,total){var _Mathfloor=Math.floor;return position&&0<total?_Mathfloor(100*(position/total)):0}function getProgressionLabel(position,total,type,config){var patterns=labels[type]||labels.item,pattern=config.showTotal?patterns.long:patterns.short;return format(pattern,position||"0",total||"0")}function getPositionProgression(position,total,type,config){return{position:position||0,total:total||0,ratio:getRatio(position,total),label:getProgressionLabel(position,total,type,config)}}function getRatioProgression(position,total){var ratio=getRatio(position,total);return{position:position||0,total:total||0,ratio:ratio,label:"".concat(ratio,"%")}}_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,__=__&&Object.prototype.hasOwnProperty.call(__,"default")?__["default"]:__,format=format&&Object.prototype.hasOwnProperty.call(format,"default")?format["default"]:format,mapHelper=mapHelper&&Object.prototype.hasOwnProperty.call(mapHelper,"default")?mapHelper["default"]:mapHelper;var defaultConfig={scope:"test",indicator:"percentage",showTotal:!0,categories:[]},labels={item:{long:__("Item %d of %d"),short:__("Item %d")},section:{long:__("Section %d of %d"),short:__("Section %d")}},scopes={test:function(testMap,testContext,config){var stats=getProgressStats(testMap,testContext,config,"test"),item=mapHelper.getItemAt(testMap,testContext.itemPosition);return stats.position=item.position+1,stats},testPart:function(testMap,testContext,config){var stats=getProgressStats(testMap,testContext,config,"testPart"),item=mapHelper.getItemAt(testMap,testContext.itemPosition);return stats.position=item.positionInPart+1,stats},testSection:function(testMap,testContext,config){var stats=getProgressStats(testMap,testContext,config,"testSection"),item=mapHelper.getItemAt(testMap,testContext.itemPosition);return stats.position=item.positionInSection+1,stats}},indicators={percentage:function(stats){return getRatioProgression(stats.answered,stats.questions)},position:function(stats,config){return getPositionProgression(stats.position,stats.total,"item",config)},questions:function(stats,config){return getPositionProgression(stats.questionsViewed,stats.questions,"item",config)},sections:function(stats,config){return getPositionProgression(stats.answerableSections.reached,stats.answerableSections.total,"section",config)},categories:function(stats,config){return getPositionProgression(stats.matchedCategories.position,stats.matchedCategories.total,"item",config)}};return{isMatchedCategories:function(categories,expectedCategories){var categoriesToMatch=getCategoriesToMatch(expectedCategories),matchSize=expectedCategories&&expectedCategories.length;return matchCategories(categories,categoriesToMatch,matchSize)},computeStats:function(testMap,testContext,config){var testPart=mapHelper.getPart(testMap,testContext.testPartId),statsComputer=config.scope&&scopes[config.scope]||scopes.test,stats=statsComputer(testMap,testContext,config||defaultConfig);return stats.overall=testMap.stats.total,stats.overallCompleted=testPart&&testPart.isLinear?testMap.stats.answered-1:testMap.stats.answered,stats},computeIndicator:function(stats,type,config){var indicatorComputer=type&&indicators[type]||indicators.percentage;return indicatorComputer(stats||{},config||defaultConfig)},computeProgress:function(testMap,testContext,config){var progressData;return config=_.defaults(config||{},defaultConfig),progressData=this.computeStats(testMap,testContext,config),this.computeIndicator(progressData,config.indicator,config)}}}),define("taoQtiTest/runner/plugins/controls/progressbar/renderer/percentage",["ui/component","handlebars","ui/progressbar"],function(component,Handlebars){'use strict';function percentageTpl(data,options,asString){var html=Template(data,options);return asString||!0?html:$(html)}function percentageIndicatorRenderer(config,progressData){return component({update:function(data){progressData=data,this.is("rendered")&&this.controls&&(this.controls.$label.text(progressData.label),this.controls.$bar.progressbar("value",progressData.ratio)),this.trigger("update",data)}},defaults).setTemplate(percentageTpl).on("render",function(){this.controls={$label:this.getElement().find("[data-control=\"progress-label\"]"),$bar:this.getElement().find("[data-control=\"progress-bar\"]")},this.config.showLabel||this.controls.$label.hide(),this.controls.$bar.progressbar(),progressData&&this.update(progressData),this.is("hidden")&&this.hide()}).on("destroy",function(){this.controls=null}).init(config)}component=component&&Object.prototype.hasOwnProperty.call(component,"default")?component["default"]:component,Handlebars=Handlebars&&Object.prototype.hasOwnProperty.call(Handlebars,"default")?Handlebars["default"]:Handlebars;var Template=Handlebars.template(function(Handlebars,depth0,helpers){return this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),"<div class=\"progress-box\">\n <div data-control=\"progress-bar\" class=\"qti-controls progressbar info\"></div>\n <div data-control=\"progress-label\" class=\"qti-controls\"></div>\n</div>\n"}),defaults={showLabel:!0};return percentageIndicatorRenderer}),define("taoQtiTest/runner/plugins/controls/progressbar/renderer/position",["lodash","ui/component","handlebars"],function(_,component,Handlebars){'use strict';function positionTpl(data,options,asString){var html=Template(data,options);return asString||!0?html:$(html)}function pointTpl(data,options,asString){var html=Template$1(data,options);return asString||!0?html:$(html)}function positionIndicatorRenderer(config,progressData){var count=0;return component({update:function(data){progressData=data,this.is("rendered")&&this.controls&&(count!==progressData.total&&(count=progressData.total,this.controls.$bar.empty().append(pointTpl(_.range(count)))),this.controls.$label.text(progressData.label),this.controls.$bar.children().removeClass("reached current").slice(0,progressData.position).addClass("reached").slice(-1).addClass("current")),this.trigger("update",data)}},defaults).setTemplate(positionTpl).on("render",function(){this.controls={$label:this.getElement().find("[data-control=\"progress-label\"]"),$bar:this.getElement().find("[data-control=\"progress-bar\"] .progressbar-points")},this.config.showLabel||this.controls.$label.hide(),progressData&&this.update(progressData),this.is("hidden")&&this.hide()}).on("destroy",function(){this.controls=null}).init(config)}_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,component=component&&Object.prototype.hasOwnProperty.call(component,"default")?component["default"]:component,Handlebars=Handlebars&&Object.prototype.hasOwnProperty.call(Handlebars,"default")?Handlebars["default"]:Handlebars;var Template=Handlebars.template(function(Handlebars,depth0,helpers){return this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),"<div class=\"progress-box\">\n <div data-control=\"progress-bar\" class=\"qti-controls progressbar\">\n <div class=\"progressbar-points\"></div>\n </div>\n <div data-control=\"progress-label\" class=\"qti-controls\"></div>\n</div>\n"}),Template$1=Handlebars.template(function(Handlebars,depth0,helpers,partials,data){function program1(depth0){var buffer="";return buffer+="\n<span class=\"progressbar-point\" data-index=\""+escapeExpression("function"===_typeof2(depth0)?depth0.apply(depth0):depth0)+"\"></span>\n",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.each.call(depth0,depth0,{hash:{},inverse:self.noop,fn:self.program(1,program1,data),data:data}),stack1||0===stack1?stack1:""}),defaults={showLabel:!0};return positionIndicatorRenderer}),define("taoQtiTest/runner/plugins/controls/progressbar/progressbar",["taoTests/runner/plugin","taoQtiTest/runner/helpers/map","taoQtiTest/runner/plugins/controls/progressbar/progress","taoQtiTest/runner/plugins/controls/progressbar/renderer/percentage","taoQtiTest/runner/plugins/controls/progressbar/renderer/position"],function(pluginFactory,mapHelper,progressHelper,percentageRendererFactory,positionRendererFactory){'use strict';pluginFactory=pluginFactory&&Object.prototype.hasOwnProperty.call(pluginFactory,"default")?pluginFactory["default"]:pluginFactory,mapHelper=mapHelper&&Object.prototype.hasOwnProperty.call(mapHelper,"default")?mapHelper["default"]:mapHelper,progressHelper=progressHelper&&Object.prototype.hasOwnProperty.call(progressHelper,"default")?progressHelper["default"]:progressHelper,percentageRendererFactory=percentageRendererFactory&&Object.prototype.hasOwnProperty.call(percentageRendererFactory,"default")?percentageRendererFactory["default"]:percentageRendererFactory,positionRendererFactory=positionRendererFactory&&Object.prototype.hasOwnProperty.call(positionRendererFactory,"default")?positionRendererFactory["default"]:positionRendererFactory;var renderers={percentage:percentageRendererFactory,position:positionRendererFactory},progressbar=pluginFactory({name:"progressBar",init:function(){var testRunner=this.getTestRunner(),testRunnerConfig=testRunner.getOptions(),config=Object.assign({},testRunnerConfig.progressIndicator||{},this.getConfig()),self=this,rendererFactory=renderers[config.renderer]||renderers.percentage,progressConfig={indicator:config.type||"percentage",scope:config.scope||"test",showLabel:config.showLabel,showTotal:config.showTotal,categories:config.categories},hiddenByQuestions=function(item){return item&&item.informational&&"questions"===progressConfig.indicator},hiddenByCategories=function(item){return item&&"categories"===progressConfig.indicator&&!progressHelper.isMatchedCategories(item.categories,progressConfig.categories)},isProgressbarHidden=function(item){return hiddenByQuestions(item)||hiddenByCategories(item)},update=function(){var testContext=testRunner.getTestContext(),testMap=testRunner.getTestMap(),item=mapHelper.getItemAt(testMap,testContext.itemPosition);isProgressbarHidden(item)?self.renderer.hide():(self.renderer.show(),self.renderer.update(progressHelper.computeProgress(testMap,testContext,progressConfig)))};this.renderer=rendererFactory(progressConfig),update(),testRunner.on("ready loaditem",update)},render:function(){var $container=this.getAreaBroker().getControlArea();this.renderer.render($container)},destroy:function(){this.renderer&&this.renderer.destroy(),this.renderer=null},show:function(){this.renderer&&this.renderer.show()},hide:function(){this.renderer&&this.renderer.hide()}});return progressbar}),define("taoQtiTest/runner/plugins/controls/testState/testState",["lodash","taoTests/runner/plugin"],function(_,pluginFactory){'use strict';_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,pluginFactory=pluginFactory&&Object.prototype.hasOwnProperty.call(pluginFactory,"default")?pluginFactory["default"]:pluginFactory;var testState=pluginFactory({name:"testState",install:function(){var testRunner=this.getTestRunner();testRunner.getProxy().use(function(req,res,next){var data=res&&res.data;return data&&data.type&&"TestState"===data.type&&!testRunner.getState("closedOrSuspended")?(testRunner.setState("closedOrSuspended",!0),void(testRunner.getState("ready")?(_.isEmpty(data.messages)||!_.find(data.messages,{channel:"teststate"}))&&testRunner.trigger("leave",data):testRunner.trigger("destroy"))):void next()})},init:function(){var testRunner=this.getTestRunner(),isLeaving=!1;testRunner.getProxy().channel("teststate",function(data){isLeaving||!data||"close"!==data.type&&"pause"!==data.type||testRunner.getState("closedOrSuspended")||(isLeaving=!0,"pause"===data.type?testRunner.trigger("pause",data):(testRunner.setState("closedOrSuspended",!0),testRunner.trigger("leave",data)))})}});return testState}),define("taoQtiTest/runner/helpers/getTimerMessage",["i18n"],function(__){'use strict';function getTimerMessage(hours,minutes,seconds,unansweredQuestions,scope){var timeArr=[hours,minutes,seconds],timeArgArr=[],timerMessage;[__("hours"),__("minutes"),__("seconds")].forEach(function(unit,idx){0<timeArr[idx]&&timeArgArr.push("".concat(timeArr[idx]," ").concat(unit))});var answeredMessage;if(!unansweredQuestions||"item"===scope)answeredMessage=__("the current question");else{var questionsMessage=__("questions");1===unansweredQuestions&&(questionsMessage=__("question")),answeredMessage=__("remaining %s %s",unansweredQuestions,questionsMessage)}return timerMessage=0===timeArgArr.length?__("%s to answer %s","no time left",answeredMessage):__("%s to answer %s",timeArgArr.join(", "),answeredMessage),timerMessage}return __=__&&Object.prototype.hasOwnProperty.call(__,"default")?__["default"]:__,getTimerMessage}),define("css!taoQtiTest/runner/plugins/controls/timer/component/css/countdown",[],function(){}),define("taoQtiTest/runner/plugins/controls/timer/component/countdown",["jquery","lodash","core/encoder/time","ui/component","handlebars","taoQtiTest/runner/helpers/getTimerMessage","ui/tooltip","css!taoQtiTest/runner/plugins/controls/timer/component/css/countdown.css","moment"],function($$1,_,timeEncoder,component,Handlebars,getTimerMessage,tooltip,countdown_css,moment){'use strict';function countdownTpl(data,options,asString){var html=Template(data,options);return asString||!0?html:$(html)}function countdownFactory($container,config){var countdown=component({update:function(remainingTime,unansweredQuestions){var self=this,encodedTime,warningId,warningMessage;if(!this.is("completed")){if(this.remainingTime=0>=remainingTime?0:parseInt(remainingTime,10),this.is("rendered")&&this.is("running")){if(encodedTime=timeEncoder.encode(this.remainingTime/1000),encodedTime!==this.encodedTime){this.encodedTime=encodedTime;var time=moment.duration(this.remainingTime/1000,"seconds"),hours=time.get("hours"),minutes=time.get("minutes"),seconds=time.get("seconds");$time.text(this.encodedTime),$timeScreenreader.text(getTimerMessage(hours,minutes,seconds,unansweredQuestions,this.config.scope))}if(this.warnings&&(warningId=_.findLastKey(this.warnings,function(warning){return warning&&!warning.shown&&0<warning.threshold&&warning.threshold>=self.remainingTime}),warningId&&(this.warnings[warningId].shown=!0,warningMessage=_.isFunction(this.warnings[warningId].message)?this.warnings[warningId].message(this.remainingTime):this.warnings[warningId].message,this.trigger("warn",warningMessage,this.warnings[warningId].level))),this.warningsForScreenreader){var screenreaderWarningId=_.findLastKey(this.warningsForScreenreader,function(warning){return warning&&!warning.shown&&0<warning.threshold&&warning.threshold>=self.remainingTime});screenreaderWarningId&&(this.warningsForScreenreader[screenreaderWarningId].shown=!0,this.trigger("warnscreenreader",this.warningsForScreenreader[screenreaderWarningId].message,self.remainingTime,this.warningsForScreenreader[screenreaderWarningId].scope))}this.trigger("change",this.remainingTime,encodedTime)}0===this.remainingTime&&this.complete()}return this},start:function(){return!this.is("rendered")||this.is("running")||this.is("completed")||(this.enable(),this.setState("running",!0),this.trigger("start")),this},stop:function(){return this.is("rendered")&&this.is("running")&&(this.setState("running",!1),this.trigger("stop")),this},complete:function(){return this.is("rendered")&&this.is("running")&&!this.is("completed")&&(this.stop(),this.setState("completed",!0),this.trigger("complete end")),this}},defaults).on("init",function(){this.remainingTime=this.config.remainingTime,this.unansweredQuestions=this.config.unansweredQuestions,this.config.warnings&&(this.warnings=_.sortBy(this.config.warnings,"threshold")),this.config.warningsForScreenreader&&(this.warningsForScreenreader=_.sortBy(this.config.warningsForScreenreader,"threshold")),this.render($container)}).on("render",function(){$time=$$1(".time",this.getElement()),$timeScreenreader=$$1(".time--screenreader",this.getElement()),!0===this.config.showBeforeStart&&$time.text(timeEncoder.encode(this.remainingTime/1000))}).on("warn",function(message,level){var countdownTooltip;level=level||"warning",this.is("rendered")&&this.is("running")&&_.isString(message)&&!_.isEmpty(message)&&($time.removeClass("txt-success txt-info txt-warning txt-danger txt-error").addClass("txt-".concat(level)),!0===this.config.displayWarning&&(countdownTooltip=tooltip.create(this.getElement(),message,{trigger:"manual",theme:level,placement:"bottom"}),countdownTooltip.show(),setTimeout(function(){countdownTooltip.hide(),countdownTooltip.dispose()},warningTimeout[level]||2e3)))}),$time,$timeScreenreader;return countdown.setTemplate(countdownTpl),_.defer(function(){countdown.init(config)}),countdown}$$1=$$1&&Object.prototype.hasOwnProperty.call($$1,"default")?$$1["default"]:$$1,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,timeEncoder=timeEncoder&&Object.prototype.hasOwnProperty.call(timeEncoder,"default")?timeEncoder["default"]:timeEncoder,component=component&&Object.prototype.hasOwnProperty.call(component,"default")?component["default"]:component,Handlebars=Handlebars&&Object.prototype.hasOwnProperty.call(Handlebars,"default")?Handlebars["default"]:Handlebars,getTimerMessage=getTimerMessage&&Object.prototype.hasOwnProperty.call(getTimerMessage,"default")?getTimerMessage["default"]:getTimerMessage,tooltip=tooltip&&Object.prototype.hasOwnProperty.call(tooltip,"default")?tooltip["default"]:tooltip,moment=moment&&Object.prototype.hasOwnProperty.call(moment,"default")?moment["default"]:moment;var Template=Handlebars.template(function(Handlebars,depth0,helpers,partials,data){this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,stack1,helper;return buffer+="<div class=\"countdown\" data-control=\"",(helper=helpers.id)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.id,stack1="function"===_typeof2(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\" data-type=\"",(helper=helpers.type)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.type,stack1="function"===_typeof2(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\" data-scope=\"",(helper=helpers.scope)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.scope,stack1="function"===_typeof2(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\" title=\"",(helper=helpers.label)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.label,stack1="function"===_typeof2(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\" disabled>\n <span aria-label=\"",(helper=helpers.label)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.label,stack1="function"===_typeof2(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\" class=\"label truncate\">",(helper=helpers.label)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.label,stack1="function"===_typeof2(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"</span>\n <span class=\"time\" aria-hidden=\"true\"></span>\n <div class=\"time--screenreader visible-hidden\"></div>\n</div>\n",buffer}),defaults={showBeforeStart:!0,displayWarning:!0},warningTimeout={info:2e3,success:2e3,warning:4e3,danger:4e3,error:8e3};return countdownFactory}),define("css!taoQtiTest/runner/plugins/controls/timer/component/css/timerbox",[],function(){}),define("taoQtiTest/runner/plugins/controls/timer/component/timerbox",["jquery","lodash","i18n","ui/component","ui/hider","taoQtiTest/runner/plugins/controls/timer/component/countdown","handlebars","css!taoQtiTest/runner/plugins/controls/timer/component/css/timerbox.css"],function($$1,_,__,component,hider,countdownFactory,Handlebars){'use strict';function timerboxTpl(data,options,asString){var html=Template(data,options);return asString||!0?html:$(html)}function timerboxFactory(config){var timerbox=component({update:function(timers){var self=this,updating=[],timerIdsToRemove=_.difference(_.keys(this.timers),_.keys(timers));return timerIdsToRemove.length&&_.forEach(timerIdsToRemove,function(timerId){updating.push(self.removeTimer(timerId))}),_.forEach(timers,function(timer,id){"undefined"==typeof self.timers[id]?updating.push(self.addTimer(id,timer)):updating.push(self.updateTimer(id,timer))}),Promise.all(updating).then(function(results){return 0<_.size(self.timers)?hider.show($zenModeToggler):hider.hide($zenModeToggler),self.trigger("update",results),results})},getTimers:function(){return this.timers},addTimer:function(id,timer){var self=this;return this.is("rendered")&&"undefined"==typeof this.timers[id]?new Promise(function(resolve){var countdown=countdownFactory($countdownContainer,_.defaults(timer,{displayWarning:self.config.displayWarning})).on("render",function(){self.timers[id]=_.clone(timer),self.timers[id].countdown=this,self.trigger("timerchange","add",self.timers[id]),self.trigger("timeradd",self.timers[id]),resolve(self.timers[id])}).on("start",function(){self.trigger("timerstart",self.timers[id])}).on("stop",function(){self.trigger("timerstop",self.timers[id])}).on("end",function(){self.trigger("timerend",self.timers[id])}).on("change",function(value){self.timers[id]&&(self.trigger("timertick",this.remainingTime,self.timers[id].scope,self.timers[id].unansweredQuestions),self.timers[id].remainingTime=value)});countdown.spread(self,["error","change","warn","warnscreenreader"])}):Promise.resolve(!1)},updateTimer:function(id,timer){return this.is("rendered")&&"undefined"!=typeof this.timers[id]?(this.timers[id].remainingTime=timer.remainingTime,this.timers[id].unansweredQuestions=timer.unansweredQuestions,this.timers[id].extraTime=timer.extraTime,_.isNumber(timer.remainingWithoutExtraTime)&&(this.timers[id].remainingWithoutExtraTime=timer.remainingWithoutExtraTime),this.timers[id].countdown&&this.timers[id].countdown.update(timer.remainingTime,timer.unansweredQuestions),this.trigger("timerchange","update",this.timers[id]),this.trigger("timerupdate",this.timers[id]),Promise.resolve(this.timers[id])):Promise.resolve(!1)},removeTimer:function(id){var self=this;return this.is("rendered")&&"undefined"!=typeof this.timers[id]?new Promise(function(resolve){var deindex=function(){var removed=_.omit(self.timers[id],"countdown");self.timers=_.omit(self.timers,id),self.trigger("timerchange","remove",removed),self.trigger("timerremove",removed),resolve(removed)};self.timers[id].countdown?self.timers[id].countdown.on("destroy",deindex).destroy():deindex()}):Promise.resolve()},start:function(){return _.forEach(this.timers,function(timer){timer.countdown&&timer.countdown.start()}),this},stop:function(){return _.forEach(this.timers,function(timer){timer.countdown&&timer.countdown.stop()}),this},toggleZenMode:function(){return this.is("rendered")&&this.config.zenMode.enabled&&(this.is("zen")?(this.setState("zen",!1),$zenModeToggler.attr("title",__("Hide timers"))):(this.setState("zen",!0),$zenModeToggler.attr("title",__("Show timers"))),this.trigger("zenchange",this.is("zen"))),this}},defaults).on("init",function(){this.timers={}}).on("render",function(){var self=this,$element=this.getElement();$countdownContainer=$$1(".timer-wrapper",$element),this.config.zenMode.enabled&&($zenModeToggler=$$1(".timer-toggler",$element),self.setState("zen",!!self.config.zenMode.startHidden),$zenModeToggler.on("click",function(e){e.preventDefault(),self.toggleZenMode()})),this.config.timers&&this.update(this.config.timers)}),$zenModeToggler,$countdownContainer;return timerbox.setTemplate(timerboxTpl),_.defer(function(){timerbox.init(config)}),timerbox}$$1=$$1&&Object.prototype.hasOwnProperty.call($$1,"default")?$$1["default"]:$$1,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,__=__&&Object.prototype.hasOwnProperty.call(__,"default")?__["default"]:__,component=component&&Object.prototype.hasOwnProperty.call(component,"default")?component["default"]:component,hider=hider&&Object.prototype.hasOwnProperty.call(hider,"default")?hider["default"]:hider,countdownFactory=countdownFactory&&Object.prototype.hasOwnProperty.call(countdownFactory,"default")?countdownFactory["default"]:countdownFactory,Handlebars=Handlebars&&Object.prototype.hasOwnProperty.call(Handlebars,"default")?Handlebars["default"]:Handlebars;var Template=Handlebars.template(function(Handlebars,depth0,helpers,partials,data){function program1(depth0,data){var buffer="",helper,options;return buffer+="\n <a href=\"#\" class=\"timer-toggler hidden\" title=\""+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"Hide timers",options):helperMissing.call(depth0,"__","Hide timers",options)))+"\" role=\"button\"><span class=\"icon-clock\"></span></a>\n ",buffer}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",helperMissing=helpers.helperMissing,escapeExpression=this.escapeExpression,self=this,stack1,helper;return buffer+="<div class=\"timer-box\">\n ",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.zenMode,null==stack1||!1===stack1?stack1:stack1.enabled),{hash:{},inverse:self.noop,fn:self.program(1,program1,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n <div class=\"timer-wrapper\" aria-hidden=\"",(helper=helpers.ariaHidden)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.ariaHidden,stack1="function"===_typeof2(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\">\n\n </div>\n</div>\n",buffer}),defaults={zenMode:{enabled:!0,startHidden:!1}};return timerboxFactory}),define("taoQtiTest/runner/plugins/controls/timer/strategy/enforcedStay",[],function(){'use strict';return function(testRunner,timer){var testPart=testRunner.getCurrentPart();return!!(timer&&"min"===timer.type&&"item"===timer.scope&&testPart&&testPart.isLinear)&&{name:"enforcedStay",setUp:function(){testRunner.on("enablenav.enforcestay",function(){testRunner.trigger("disablenav")}),testRunner.trigger("disablenav")},complete:function(){this.tearDown(),testRunner.trigger("enablenav")},tearDown:function(){testRunner.off("enablenav.enforcestay")}}}}),define("taoQtiTest/runner/plugins/controls/timer/strategy/extraTime",["lodash"],function(_){'use strict';var _Mathmax=Math.max;_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_;var lastConsumedExtraTime=0;return function(testRunner,timer){var applyExtraTime=function(){_.isNumber(timer.extraTime)&&0<timer.extraTime&&!timer.extraTimeSetup&&(timer.extraTimeSetup=!0,testRunner.before("move.extra skip.extra exit.extra timeout.extra",function(){var consumedExtraTime=0,testContext=testRunner.getTestContext();timer.remainingTime<timer.extraTime&&(consumedExtraTime=_Mathmax(timer.extraTime-timer.remainingTime,0)/1000,lastConsumedExtraTime=_Mathmax(consumedExtraTime,lastConsumedExtraTime,testContext.extraTime.consumed),testRunner.getProxy().addCallActionParams({consumedExtraTime:lastConsumedExtraTime}))}).after("move.extra skip.extra exit.extra timeout.extra",function(){lastConsumedExtraTime=0}))};return!!(timer&&"max"===timer.type)&&{name:"extraTime",setUp:function(){applyExtraTime()},start:function(){applyExtraTime()},tearDown:function(){testRunner.off("move.extra skip.extra exit.extra timeout.extra")}}}}),define("taoQtiTest/runner/plugins/controls/timer/strategy/guidedNavigation",[],function(){'use strict';return function(testRunner,timer){var testRunnerOptions=testRunner.getOptions(),testPart=testRunner.getCurrentPart();return!!(timer&&"locked"===timer.type&&"item"===timer.scope&&!0===testRunnerOptions.guidedNavigation&&testPart&&testPart.isLinear)&&{name:"guidedNavigation",setUp:function(){testRunner.trigger("hidenav")},complete:function(){testRunner.trigger("disableitem disablenav shownav"),setTimeout(function(){testRunner.trigger("move","next","item")},500)}}}}),define("taoQtiTest/runner/plugins/controls/timer/strategy/timeout",[],function(){'use strict';return function(testRunner,timer){return!!(timer&&"max"===timer.type)&&{name:"timeout",complete:function(){if(timer.qtiClassName&&timer.source)return testRunner.timeout(timer.qtiClassName,timer.source,timer)}}}}),define("taoQtiTest/runner/helpers/currentItem",["lodash"],function(_){'use strict';_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_;var responseCardinalities={single:"base",multiple:"list",ordered:"list",record:"record"},interactionMinConstraintProperties={matchInteraction:"minAssociations",choiceInteraction:"minChoices",orderInteraction:"minChoices",associateInteraction:"minAssociations",hottextInteraction:"minChoices",hotspotInteraction:"minChoices",graphicOrderInteraction:"minChoices",graphicAssociateInteraction:"minAssociations",selectPointInteraction:"minChoices"},currentItemHelper={getDeclarations:function(runner){var itemRunner=runner.itemRunner;return itemRunner._item&&itemRunner._item.responses},getResponseDeclaration:function(runner,identifier){var found=null;return _.forEach(currentItemHelper.getDeclarations(runner),function(declaration){var attributes=declaration.attributes||{};if(attributes.identifier===identifier)return found=declaration,!1}),found},toResponse:function(value,baseType,cardinality){var mappedCardinality=responseCardinalities[cardinality],response={};_.isString(value)&&(value=[value]);var transform=function(v){return v};return"boolean"===baseType?transform=function(v){return!0===v||"true"===v}:("directedPair"==baseType||"pair"==baseType)&&(transform=function(v){return _.isString(v)?v.split(" "):v}),value=_.map(value||[],transform),mappedCardinality&&("base"===mappedCardinality?0===value.length?response.base=null:(response.base={},response.base[baseType]=value[0]):(response[mappedCardinality]={},response[mappedCardinality][baseType]=value)),response},isQtiValueNull:function(value,baseType,cardinality){var mappedCardinality=responseCardinalities[cardinality];return _.isObject(value)&&null===value[mappedCardinality]&&(value=null),_.isObject(value)&&value[mappedCardinality]&&"undefined"!=typeof value[mappedCardinality][baseType]&&(value=value[mappedCardinality][baseType]),null===value||"string"===baseType&&_.isEmpty(value)||"single"!==cardinality&&_.isEmpty(value)},isQuestionAnswered:function(response,baseType,cardinality,defaultValue,constraintValue){var fullyAnswered=!0,answered,currentCardinality,responses;return defaultValue=defaultValue||null,constraintValue=constraintValue||0,currentItemHelper.isQtiValueNull(response,baseType,cardinality)?answered=!1:(answered=!_.isEqual(response,currentItemHelper.toResponse(defaultValue,baseType,cardinality)),0!==constraintValue&&(currentCardinality=responseCardinalities[cardinality],responses=response[currentCardinality][baseType]||[],fullyAnswered=responses&&responses.length>=constraintValue),answered=answered&&fullyAnswered),answered},guessInteractionConstraintValues:function(runner){var itemRunner=runner.itemRunner,itemBody=itemRunner._item&&itemRunner._item.bdy||{},interactions=itemBody.elements||{},constraintValues={};return _.forEach(interactions,function(interaction){var attributes=interaction.attributes||{},qtiClass=interaction.__proto__.qtiClass,constraintProperty;Object.prototype.hasOwnProperty.call(interactionMinConstraintProperties,qtiClass)&&(constraintProperty=interactionMinConstraintProperties[qtiClass],constraintValues[attributes.responseIdentifier]=attributes[constraintProperty])}),constraintValues},isAnswered:function(runner,partially){var itemRunner=runner.itemRunner,responses=itemRunner&&itemRunner.getResponses(),count=0,empty=0,declarations,constraintValues;return itemRunner&&(declarations=currentItemHelper.getDeclarations(runner),constraintValues=currentItemHelper.guessInteractionConstraintValues(runner),_.forEach(declarations,function(declaration){var attributes=declaration.attributes||{},response=responses[attributes.identifier],baseType=attributes.baseType,cardinality=attributes.cardinality;count++,currentItemHelper.isQuestionAnswered(response,baseType,cardinality,declaration.defaultValue,constraintValues[attributes.identifier])||empty++})),!1===partially?0<count&&0===empty:0<count&&empty<count},getStimuliHrefs:function(runner){var itemRunner=runner.itemRunner,itemBody=itemRunner._item&&itemRunner._item.bdy||{},interactions=itemBody.elements||{};return _(interactions).values().filter(function(element){return"include"===element.qtiClass}).pluck("attributes").pluck("href").value()},getTextStimuliHrefs:function(runner){var stimuli=this.getStimuliHrefs(runner),textStimuli;return 0<stimuli.length?(textStimuli=stimuli.filter(function(stimulusHref){var domNode=document.querySelector(".qti-include[data-href=\"".concat(stimulusHref,"\"]"));return _(domNode.childNodes).some(function(child){return child.nodeType===child.TEXT_NODE})}),textStimuli):[]}};return currentItemHelper}),define("taoQtiTest/runner/helpers/stats",["lodash","taoQtiTest/runner/helpers/map","taoQtiTest/runner/helpers/currentItem"],function(_,mapHelper,currentItemHelper){'use strict';_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,mapHelper=mapHelper&&Object.prototype.hasOwnProperty.call(mapHelper,"default")?mapHelper["default"]:mapHelper,currentItemHelper=currentItemHelper&&Object.prototype.hasOwnProperty.call(currentItemHelper,"default")?currentItemHelper["default"]:currentItemHelper;return{getInstantStats:function(scope,runner,sync){var map=runner.getTestMap(),context=runner.getTestContext(),item=runner.getCurrentItem(),testPart=runner.getCurrentPart(),stats=_.clone(mapHelper.getScopeStats(map,context.itemPosition,scope));if(!item.informational){var isItemCurrentlyAnswered=currentItemHelper.isAnswered(runner);!isItemCurrentlyAnswered&&item.answered?stats.answered--:(isItemCurrentlyAnswered||sync)&&!item.answered?stats.answered++:sync&&!isItemCurrentlyAnswered&&item.answered&&testPart.isLinear&&stats.answered++}return stats}}}),define("taoQtiTest/runner/helpers/messages",["i18n","taoQtiTest/runner/helpers/stats","handlebars"],function(__,statsHelper,Handlebars){'use strict';function messageHeaderTpl(data,options,asString){var html=Template(data,options);return asString||!0?html:$(html)}function getHeader(scope){var header="";return"section"===scope||"testSection"===scope?header=__("You are about to leave this section."):"test"===scope||"testWithoutInaccessibleItems"===scope?header=__("You are about to submit the test."):"part"===scope&&(header=__("You are about to submit this test part.")),messageHeaderTpl({header:header.trim()})}function getActionMessage(scope){var submitButtonLabel=1<arguments.length&&arguments[1]!==void 0?arguments[1]:__("OK"),msg;return"section"===scope||"testSection"===scope||"part"===scope?(msg=__("Click \"%s\" to continue",submitButtonLabel).trim(),msg&&(msg+="."),msg):"test"===scope||"testWithoutInaccessibleItems"===scope?"".concat(__("You will not be able to access this test once submitted. Click \"%s\" to continue and submit the test.",submitButtonLabel)):""}function getFlaggedItemsWarning(stats){var message=1<arguments.length&&arguments[1]!==void 0?arguments[1]:"",flaggedCount=stats&&stats.flagged;return flaggedCount?message?"".concat(message," ").concat(__("and you flagged %s item(s) that you can review now",flaggedCount.toString())):__("You flagged %s item(s) that you can review now",flaggedCount.toString()):message}function getUnansweredItemsWarning(scope,runner,sync){var stats=statsHelper.getInstantStats(scope,runner,sync),unansweredCount=stats&&stats.questions-stats.answered,flaggedCount=stats&&stats.flagged,itemsCountMessage="";return"section"===scope||"testSection"===scope?(itemsCountMessage=__("You answered %s of %s question(s) for this section of the test",stats.answered.toString(),stats.questions.toString()),flaggedCount&&(itemsCountMessage+=", ".concat(__("and flagged %s of them",flaggedCount.toString())))):"test"===scope||"testWithoutInaccessibleItems"===scope?(1<unansweredCount?itemsCountMessage=__("There are %s unanswered questions",unansweredCount.toString()):1===unansweredCount&&(itemsCountMessage=__("There is %s unanswered question",unansweredCount.toString())),flaggedCount&&(itemsCountMessage=getFlaggedItemsWarning(stats,itemsCountMessage))):"part"===scope&&(1<unansweredCount?itemsCountMessage=__("There are %s unanswered questions in this part of the test",unansweredCount.toString()):1===unansweredCount&&(itemsCountMessage=__("There is %s unanswered question in this part of the test",unansweredCount.toString())),flaggedCount&&(itemsCountMessage=getFlaggedItemsWarning(stats,itemsCountMessage))),itemsCountMessage=itemsCountMessage.trim(),itemsCountMessage}__=__&&Object.prototype.hasOwnProperty.call(__,"default")?__["default"]:__,statsHelper=statsHelper&&Object.prototype.hasOwnProperty.call(statsHelper,"default")?statsHelper["default"]:statsHelper,Handlebars=Handlebars&&Object.prototype.hasOwnProperty.call(Handlebars,"default")?Handlebars["default"]:Handlebars;var Template=Handlebars.template(function(Handlebars,depth0,helpers,partials,data){function program1(depth0,data){var buffer="",stack1,helper;return buffer+="<b>",(helper=helpers.header)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.header,stack1="function"===_typeof2(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"</b><br><br>",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.header,{hash:{},inverse:self.noop,fn:self.program(1,program1,data),data:data}),stack1||0===stack1?stack1:""});return{getExitMessage:function(scope,runner){var message=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"",sync=3<arguments.length?arguments[3]:void 0,submitButtonLabel=4<arguments.length?arguments[4]:void 0,itemsCountMessage="",testRunnerOptions=runner.getOptions(),messageEnabled=testRunnerOptions.enableUnansweredItemsWarning;return messageEnabled&&(itemsCountMessage=getUnansweredItemsWarning(scope,runner,sync).trim(),itemsCountMessage&&(itemsCountMessage+=".")),"".concat(getHeader(scope)).concat(itemsCountMessage," ").concat(getActionMessage(scope,submitButtonLabel)).concat(message).trim()}}}),define("taoQtiTest/runner/config/states",[],function(){'use strict';var states={testSession:Object.freeze({initial:0,interacting:1,modalFeedback:2,suspended:3,closed:4}),itemSession:Object.freeze({initial:0,interacting:1,modalFeedback:2,suspended:3,closed:4,solution:5,notSelected:255})};return states}),define("taoQtiTest/runner/plugins/controls/timer/strategy/warnSectionLeaving",["lodash","i18n","taoQtiTest/runner/helpers/messages","taoQtiTest/runner/helpers/navigation","taoQtiTest/runner/config/states","taoQtiTest/runner/helpers/map"],function(_,__,messages,navigationHelper,states,mapHelper){'use strict';_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,__=__&&Object.prototype.hasOwnProperty.call(__,"default")?__["default"]:__,messages=messages&&Object.prototype.hasOwnProperty.call(messages,"default")?messages["default"]:messages,navigationHelper=navigationHelper&&Object.prototype.hasOwnProperty.call(navigationHelper,"default")?navigationHelper["default"]:navigationHelper,states=states&&Object.prototype.hasOwnProperty.call(states,"default")?states["default"]:states,mapHelper=mapHelper&&Object.prototype.hasOwnProperty.call(mapHelper,"default")?mapHelper["default"]:mapHelper;var exitMessage=__("Once you close this section, you cannot return to it or change your answers.");return function(testRunner,timer){var leaveTimedSection=function(direction,scope,position){var context=testRunner.getTestContext(),map=testRunner.getTestMap();return!(context.isTimeout||context.itemSessionState===states.itemSession.closed||context.sectionId!==timer.source)&&navigationHelper.isLeavingSection(context,map,direction,scope,position)};return!!(timer&&"section"===timer.scope&&"max"===timer.type)&&{name:"warnSectionLeaving",setUp:function(){testRunner.off("move.warntimedsection skip.warntimedsection").before("move.warntimedsection skip.warntimedsection",function(e,type,scope,position){var testContext=testRunner.getTestContext(),testMap=testRunner.getTestMap(),testRunnerOptions=testRunner.getOptions(),timerConfig=testRunnerOptions.timer||{},itemIdentifier=testContext.itemIdentifier,isLast=navigationHelper.isLast(testMap,itemIdentifier),endTestWarning=mapHelper.hasItemCategory(testMap,itemIdentifier,"endTestWarning",!0),noExitTimedSectionWarning=mapHelper.hasItemCategory(testMap,itemIdentifier,"noExitTimedSectionWarning",!0),movePromise=new Promise(function(resolve,reject){if(isLast&&endTestWarning)resolve();else if(leaveTimedSection(type||"next",scope,position)&&!noExitTimedSectionWarning&&!timerConfig.keepUpToTimeout){var submitButtonLabel=__("Close this Section");testRunner.trigger("confirm.exittimed",messages.getExitMessage("section",testRunner,exitMessage,!1,submitButtonLabel),resolve,reject,{buttons:{labels:{ok:submitButtonLabel,cancel:__("Review my Answers")}}})}else resolve()});return movePromise.catch(function(){_.defer(function(){testRunner.trigger("enableitem enablenav")})}),movePromise})},complete:function(){return this.tearDown()},tearDown:function(){testRunner.off("move.warntimedsection skip.warntimedsection")}}}}),define("taoQtiTest/runner/plugins/controls/timer/strategy/strategyHandler",["lodash","taoQtiTest/runner/plugins/controls/timer/strategy/enforcedStay","taoQtiTest/runner/plugins/controls/timer/strategy/extraTime","taoQtiTest/runner/plugins/controls/timer/strategy/guidedNavigation","taoQtiTest/runner/plugins/controls/timer/strategy/timeout","taoQtiTest/runner/plugins/controls/timer/strategy/warnSectionLeaving"],function(_,extraTimeStrategy,enforcedStayStrategy,guidedNavigationStrategy,timeoutStrategy,warnSectionLeavingStrategy){'use strict';function getStrategyHandler(testRunner,strategies){var actives={},applyToStrategies=function(timerId,action){var api=_.keys(strategyHandler);if(_.isEmpty(timerId)||_.isEmpty(action)||!_.contains(api,action))throw new TypeError("Invalid timer id or unauthorized action");return _.isArray(actives[timerId])?Promise.all(_.map(actives[timerId],function(strategy){if(_.isFunction(strategy[action]))return strategy[action]()})):Promise.resolve()},strategyHandler;if(!testRunner||!_.isFunction(testRunner.on)||!_.isFunction(testRunner.getTestContext))throw new TypeError("The strategy handler needs a valid test runner.");return strategyHandler={setUp:function(timer){return _.forEach(strategies||defaultAvailableStrategies,function(availableStrategy){var strategy=availableStrategy(testRunner,timer);!1!==strategy&&(actives[timer.id]=actives[timer.id]||[],actives[timer.id].push(strategy))}),applyToStrategies(timer.id,"setUp")},getActives:function(timer){return timer&&timer.id&&_.isArray(actives[timer.id])?actives[timer.id]:[]},start:function(timer){return applyToStrategies(timer.id,"start")},stop:function(timer){return applyToStrategies(timer.id,"stop")},complete:function(timer){return applyToStrategies(timer.id,"complete")},tearDown:function(timer){return applyToStrategies(timer.id,"tearDown").then(function(){actives=_.omit(actives,timer.id)})}},strategyHandler}_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,extraTimeStrategy=extraTimeStrategy&&Object.prototype.hasOwnProperty.call(extraTimeStrategy,"default")?extraTimeStrategy["default"]:extraTimeStrategy,enforcedStayStrategy=enforcedStayStrategy&&Object.prototype.hasOwnProperty.call(enforcedStayStrategy,"default")?enforcedStayStrategy["default"]:enforcedStayStrategy,guidedNavigationStrategy=guidedNavigationStrategy&&Object.prototype.hasOwnProperty.call(guidedNavigationStrategy,"default")?guidedNavigationStrategy["default"]:guidedNavigationStrategy,timeoutStrategy=timeoutStrategy&&Object.prototype.hasOwnProperty.call(timeoutStrategy,"default")?timeoutStrategy["default"]:timeoutStrategy,warnSectionLeavingStrategy=warnSectionLeavingStrategy&&Object.prototype.hasOwnProperty.call(warnSectionLeavingStrategy,"default")?warnSectionLeavingStrategy["default"]:warnSectionLeavingStrategy;var defaultAvailableStrategies=[extraTimeStrategy,enforcedStayStrategy,guidedNavigationStrategy,timeoutStrategy,warnSectionLeavingStrategy];return getStrategyHandler}),define("taoQtiTest/runner/plugins/controls/timer/timers",["lodash","i18n","moment","core/format","core/logger"],function(_,__,moment,format,loggerFactory){'use strict';function getTimers(timeConstraints,isLinear,config){var timers={},constraintsWarnings=_.reduce(config.warnings,function(acc,warnings,qtiScope){var scope=getScope(qtiScope);return acc[scope]=_.map(warnings,function(value,key){return{threshold:1000*parseInt(key,10),message:function(remainingTime){var displayRemaining=moment.duration(remainingTime/1000,"seconds").humanize();return format(warningMessages[scope],displayRemaining)},level:value,shown:!1}}),acc},{}),constraintsWarningsForScreenreader=_.reduce(config.warningsForScreenreader,function(acc,warnings,qtiScope){var scope=getScope(qtiScope);return acc[scope]=_.map(warnings,function(value){return{threshold:1000*parseInt(value,10),message:function(remainingTime,unansweredQuestions){var displayRemaining=moment.duration(remainingTime/1000,"seconds").humanize();return format(warningMessagesForScreenraeder[scope],displayRemaining,unansweredQuestions)},scope:scope,shown:!1}}),acc},{}),buildTimer=function(type,constraintData){var timer=_.pick(constraintData,["label","scope","source","extraTime","qtiClassName"]);timer.type=type,timer.allowLateSubmission=constraintData.allowLateSubmission,"min"===type?(timer.id="".concat(type,"-").concat(constraintData.scope,"-").concat(constraintData.source),timer.originalTime=1000*constraintData.minTime,timer.remainingTime=1000*constraintData.minTimeRemaining):(timer.id=constraintData.source,timer.originalTime=1000*constraintData.maxTime,timer.remainingTime=1000*constraintData.maxTimeRemaining),timer.remainingWithoutExtraTime=timer.remainingTime,timer.extraTime&&(timer.extraTime.consumed*=1000,timer.extraTime.remaining*=1000,timer.extraTime.total*=1000,timer.total=timer.originalTime+timer.extraTime.total,timer.remainingTime+=timer.extraTime.remaining),"max"===type&&_.isArray(constraintsWarnings[timer.scope])&&(timer.warnings=constraintsWarnings[timer.scope]),_.isArray(constraintsWarningsForScreenreader[timer.scope])&&(timer.warningsForScreenreader=constraintsWarningsForScreenreader[timer.scope]);var stats=config.questionsStats[timer.scope];return timer.unansweredQuestions=stats&&stats.questions-stats.answered,timer};return _.forEach(timeConstraints,function(timeConstraint){var constraintData=_.clone(timeConstraint),newTimer;constraintData.scope=getScope(timeConstraint.scope||timeConstraint.qtiClassName),constraintData.scope?!1===constraintData.minTime&&!1===constraintData.maxTime?logger.warn("Time constraint defined with no time, skipping"):config.guidedNavigation&&isLinear&&constraintData.maxTime&&constraintData.minTime&&constraintData.minTime===constraintData.maxTime&&0<constraintData.maxTime?(newTimer=buildTimer("locked",constraintData),timers[newTimer.id]=newTimer):(isLinear&&constraintData.minTime&&0<constraintData.minTime&&(newTimer=buildTimer("min",constraintData),timers[newTimer.id]=newTimer),constraintData.maxTime&&0<constraintData.maxTime&&(newTimer=buildTimer("max",constraintData),timers[newTimer.id]=newTimer)):logger.warn("Wrong data, a time constraint should apply to a valid scope, skipping")}),logger.debug("Timers built from timeConstraints",timers),timers}_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,__=__&&Object.prototype.hasOwnProperty.call(__,"default")?__["default"]:__,moment=moment&&Object.prototype.hasOwnProperty.call(moment,"default")?moment["default"]:moment,format=format&&Object.prototype.hasOwnProperty.call(format,"default")?format["default"]:format,loggerFactory=loggerFactory&&Object.prototype.hasOwnProperty.call(loggerFactory,"default")?loggerFactory["default"]:loggerFactory;var logger=loggerFactory("taoQtiTest/runner/plugins/controls/timer/timers"),scopes=["item","section","testPart","test"],scopeMapping={assessmentTest:"test",assessmentSection:"section",assessmentItemRef:"item"},getScope=function(value){return scopeMapping[value]?scopeMapping[value]:_.contains(scopes,value)?value:null},warningMessages={item:__("Warning \u2013 You have %s remaining to complete this item."),section:__("Warning \u2013 You have %s remaining to complete this section."),testPart:__("Warning \u2013 You have %s remaining to complete this test part."),test:__("Warning \u2013 You have %s remaining to complete this test.")},warningMessagesForScreenraeder={item:__("You have %s remaining to complete the current item."),section:__("You have %s left to answer remaining %s questions."),testPart:__("You have %s left to answer remaining %s questions."),test:__("You have %s left to answer remaining %s questions.")};return getTimers}),define("taoQtiTest/runner/plugins/controls/timer/plugin",["jquery","lodash","taoTests/runner/plugin","taoQtiTest/runner/plugins/controls/timer/strategy/strategyHandler","taoQtiTest/runner/plugins/controls/timer/component/timerbox","taoQtiTest/runner/plugins/controls/timer/timers","taoQtiTest/runner/helpers/isReviewPanelEnabled","taoQtiTest/runner/helpers/stats","handlebars"],function($$1,_,pluginFactory,getStrategyHandler,timerboxFactory,timersFactory,isReviewPanelEnabled,statsHelper,Handlebars){'use strict';function _defineProperty(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function screenreaderNotificationTpl(data,options,asString){var html=Template(data,options);return asString||!0?html:$(html)}$$1=$$1&&Object.prototype.hasOwnProperty.call($$1,"default")?$$1["default"]:$$1,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,pluginFactory=pluginFactory&&Object.prototype.hasOwnProperty.call(pluginFactory,"default")?pluginFactory["default"]:pluginFactory,getStrategyHandler=getStrategyHandler&&Object.prototype.hasOwnProperty.call(getStrategyHandler,"default")?getStrategyHandler["default"]:getStrategyHandler,timerboxFactory=timerboxFactory&&Object.prototype.hasOwnProperty.call(timerboxFactory,"default")?timerboxFactory["default"]:timerboxFactory,timersFactory=timersFactory&&Object.prototype.hasOwnProperty.call(timersFactory,"default")?timersFactory["default"]:timersFactory,isReviewPanelEnabled=isReviewPanelEnabled&&Object.prototype.hasOwnProperty.call(isReviewPanelEnabled,"default")?isReviewPanelEnabled["default"]:isReviewPanelEnabled,statsHelper=statsHelper&&Object.prototype.hasOwnProperty.call(statsHelper,"default")?statsHelper["default"]:statsHelper,Handlebars=Handlebars&&Object.prototype.hasOwnProperty.call(Handlebars,"default")?Handlebars["default"]:Handlebars;var Template=Handlebars.template(function(Handlebars,depth0,helpers){return this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),"<div aria-live=\"polite\" class=\"visible-hidden\"></div>\n"}),plugin=pluginFactory({name:"timer",install:function(){var testRunner=this.getTestRunner();this.loadTimers=function(timeStore,config){var testContext=testRunner.getTestContext(),testPart=testRunner.getCurrentPart(),isLinear=testPart&&testPart.isLinear,timeConstraints=testContext.timeConstraints,timers=timersFactory(timeConstraints,isLinear,config);return Promise.all(_.map(timers,function(timer){return timeStore.getItem("consumed_".concat(timer.id)).then(function(savedConsumedTime){_.isNumber(savedConsumedTime)&&0<=savedConsumedTime&&config.restoreTimerFromClient&&(timer.remainingTime=timer.originalTime+timer.extraTime.total-savedConsumedTime)})})).then(function(){return timers})},this.saveTimers=function(timeStore,timers){return Promise.all(_.map(timers,function(timer){return timeStore.setItem("consumed_".concat(timer.id),timer.originalTime+timer.extraTime.total-timer.remainingTime)}))},testRunner.getTestStore().setVolatile(this.getName())},init:function(){function loadSavedTimers(timeStore){var testContext=testRunner.getTestContext();if(self.timerbox&&testContext.timeConstraints)return self.loadTimers(timeStore,config).then(function(timers){return self.timerbox.update(timers)}).catch(handleError)}var self=this,testRunner=this.getTestRunner(),testRunnerOptions=testRunner.getOptions(),stats={},screenreaderNotifcationTimeoutId;["test","testPart","section","item"].forEach(function(scope){return Object.assign(stats,_defineProperty({},scope,statsHelper.getInstantStats(scope,testRunner)))});var config=Object.assign({contextualWarnings:!1,warnings:testRunnerOptions.timerWarning||{},warningsForScreenreader:testRunnerOptions.timerWarningForScreenreader||{},guidedNavigation:testRunnerOptions.guidedNavigation,restoreTimerFromClient:testRunnerOptions.timer&&testRunnerOptions.timer.restoreTimerFromClient,questionsStats:stats},this.getConfig()),strategyHandler=getStrategyHandler(testRunner),handleError=function(err){testRunner.trigger("error",err)};return new Promise(function(resolve){return testRunner.getPluginStore(self.getName()).then(function(timeStore){testRunner.before("renderitem",function(){return loadSavedTimers(timeStore)}).before("enableitem",function(){if(config.restoreTimerFromClient)return loadSavedTimers(timeStore)}).on("tick",function(elapsed){if(self.timerbox){var timers=self.timerbox.getTimers(),updatedTimers=Object.keys(timers).reduce(function(acc,timerName){var statsScope=statsHelper.getInstantStats(timers[timerName].scope,testRunner),unansweredQuestions=statsScope&&statsScope.questions-statsScope.answered;return acc[timerName]=Object.assign({},timers[timerName],{remainingTime:timers[timerName].remainingTime-elapsed,unansweredQuestions:unansweredQuestions}),acc},{});self.timerbox.update(updatedTimers).catch(handleError)}}).after("renderitem",function(){self.timerbox&&($$1(self.timerbox.getElement()).find(".timer-wrapper").attr("aria-hidden",isReviewPanelEnabled(testRunner)),self.timerbox.start()),self.$screenreaderWarningContainer.text("")}).after("enableitem",function(){self.timerbox&&config.restoreTimerFromClient&&self.timerbox.start()}).on("move skip",function(){self.timerbox&&self.timerbox.stop()}).on("disableitem",function(){self.timerbox&&config.restoreTimerFromClient&&self.timerbox.stop()}),timeStore.getItem("zen-mode").then(function(startZen){self.timerbox=timerboxFactory({ariaHidden:isReviewPanelEnabled(testRunner),zenMode:{enabled:!0,startHidden:!!startZen},displayWarning:config.contextualWarnings}).on("change",_.throttle(function(){self.saveTimers(timeStore,this.getTimers())},1e3)).on("timeradd",function(timer){strategyHandler.setUp(timer).catch(handleError)}).on("timerremove",function(timer){strategyHandler.tearDown(timer).catch(handleError)}).on("timerstart",function(timer){strategyHandler.start(timer).catch(handleError)}).on("timerstop",function(timer){strategyHandler.stop(timer).catch(handleError)}).on("timerend",function(timer){strategyHandler.complete(timer).catch(handleError)}).on("timerchange",function(action,timer){self.trigger("".concat(action,"timer"),timer.qtiClassName,timer)}).on("zenchange",function(isZen){timeStore.setItem("zen-mode",!!isZen)}).on("init",resolve).on("error",handleError),self.timerbox.spread(testRunner,"timertick"),config.contextualWarnings||(self.timerbox.on("warn",function(message,level){level&&message&&testRunner.trigger(level,message)}),self.timerbox.on("warnscreenreader",_.debounce(function(message,remainingTime,scope){var statsScope=statsHelper.getInstantStats(scope,testRunner),unansweredQuestions=statsScope&&statsScope.questions-statsScope.answered;screenreaderNotifcationTimeoutId&&clearTimeout(screenreaderNotifcationTimeoutId),self.$screenreaderWarningContainer.text(message(remainingTime,unansweredQuestions)),screenreaderNotifcationTimeoutId=setTimeout(function(){return self.$screenreaderWarningContainer.text("")},2e4)},1e3,{leading:!0,trailing:!1})))}).catch(handleError)})})},render:function(){var $container=this.getAreaBroker().getControlArea();this.$screenreaderWarningContainer=$$1(screenreaderNotificationTpl()),this.timerbox.render($container),$container.append(this.$screenreaderWarningContainer)},destroy:function(){this.timerbox&&this.timerbox.stop().destroy()},show:function(){this.timerbox&&this.timerbox.show()},hide:function(){this.timerbox&&this.timerbox.hide()}});return plugin}),define("taoQtiTest/runner/plugins/controls/title/title",["jquery","lodash","taoTests/runner/plugin","handlebars","taoQtiTest/runner/helpers/map","taoQtiTest/runner/helpers/getTimerMessage","moment","taoQtiTest/runner/helpers/stats"],function($$1,_,pluginFactory,Handlebars,mapHelper,getTimerMessage,moment,statsHelper){'use strict';function titleTpl(data,options,asString){var html=Template(data,options);return asString||!0?html:$(html)}$$1=$$1&&Object.prototype.hasOwnProperty.call($$1,"default")?$$1["default"]:$$1,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,pluginFactory=pluginFactory&&Object.prototype.hasOwnProperty.call(pluginFactory,"default")?pluginFactory["default"]:pluginFactory,Handlebars=Handlebars&&Object.prototype.hasOwnProperty.call(Handlebars,"default")?Handlebars["default"]:Handlebars,mapHelper=mapHelper&&Object.prototype.hasOwnProperty.call(mapHelper,"default")?mapHelper["default"]:mapHelper,getTimerMessage=getTimerMessage&&Object.prototype.hasOwnProperty.call(getTimerMessage,"default")?getTimerMessage["default"]:getTimerMessage,moment=moment&&Object.prototype.hasOwnProperty.call(moment,"default")?moment["default"]:moment,statsHelper=statsHelper&&Object.prototype.hasOwnProperty.call(statsHelper,"default")?statsHelper["default"]:statsHelper;var Template=Handlebars.template(function(Handlebars,depth0,helpers,partials,data){function program1(depth0,data){var buffer="",stack1,helper;return buffer+="\n <span data-control=\"",(helper=helpers.attribute)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.attribute,stack1="function"===_typeof2(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\" class=\"qti-controls ",(helper=helpers.className)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.className,stack1="function"===_typeof2(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\"></span>\n <div data-control=\"",(helper=helpers.attribute)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.attribute,stack1="function"===_typeof2(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"-timer\" class=\"visible-hidden\"></div>\n ",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+="<div role=\"heading\" aria-level=\"1\" class=\"title-box truncate\">\n ",stack1=helpers.each.call(depth0,depth0&&depth0.titles,{hash:{},inverse:self.noop,fn:self.program(1,program1,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n</div>\n",buffer}),title=pluginFactory({name:"title",init:function(){var _this=this,testRunner=this.getTestRunner(),testMap=testRunner.getTestMap(),updateTitles=function(){var testContext=testRunner.getTestContext(),currentPart=mapHelper.getItemPart(testMap,testContext.itemPosition),currentItem=mapHelper.getItem(testMap,testContext.itemIdentifier);if(testMap.title&&_this.titles.test.$title.text(testMap.title).show(),currentPart&&currentPart.label&&_this.titles.testPart.$title.text(" - ".concat(currentPart.label)).show(),testContext.isDeepestSectionVisible){var section=mapHelper.getItemSection(testMap,testContext.itemPosition);_this.titles.section.$title.text(" - ".concat(section.label||testContext.sectionTitle)).show()}currentItem.label&&_this.titles.item.$title.text(" - ".concat(currentItem.label)).show()};testRunner.after("renderitem",function(){_.forOwn(_this.titles,function(options,scope){_this.titles[scope].$title.text(""),_this.titles[scope].$timer.text(""),"item"!==scope&&(_this.titles[scope].stats=statsHelper.getInstantStats(scope,testRunner))}),updateTitles()}).on("timertick",function(remainingTime,scope){var title=_this.titles[scope];if(title){var _this$titles$scope=_this.titles[scope],$timer=_this$titles$scope.$timer,stats=_this$titles$scope.stats,time=moment.duration(remainingTime/1e3,"seconds"),hours=time.get("hours"),minutes=time.get("minutes"),seconds=time.get("seconds"),unansweredQuestions=stats&&stats.questions-stats.answered;$timer&&$timer.text(getTimerMessage(hours,minutes,seconds,unansweredQuestions))}}).on("unloaditem",function(){$$1(".qti-controls",_this.$element).hide()})},render:function(){var _this2=this,$container=this.getAreaBroker().getControlArea();this.titles={test:{attribute:"qti-test-title",className:""},testPart:{attribute:"qti-test-part-title",className:"visible-hidden"},section:{attribute:"qti-test-position",className:""},item:{attribute:"qti-test-item-title",className:"visible-hidden"}},this.$element=$$1(titleTpl({titles:_.values(this.titles)})),$$1(".qti-controls",this.$element).hide(),$container.append(this.$element),_.forOwn(this.titles,function(_ref,scope){var attribute=_ref.attribute;_this2.titles[scope].$title=$container.find("[data-control=\"".concat(attribute,"\"]")),_this2.titles[scope].$timer=$container.find("[data-control=\"".concat(attribute,"-timer\"]"))})}});return title}),define("taoQtiTest/runner/plugins/controls/trace/itemTraceVariables",["lodash","moment","taoTests/runner/plugin"],function(_,moment,pluginFactory){'use strict';function timestamp(){return Date.now()/1000}_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,moment=moment&&Object.prototype.hasOwnProperty.call(moment,"default")?moment["default"]:moment,pluginFactory=pluginFactory&&Object.prototype.hasOwnProperty.call(pluginFactory,"default")?pluginFactory["default"]:pluginFactory;var itemTraceVariables=pluginFactory({name:"itemTraceVariables",install:function(){this.getTestRunner().getTestStore().setVolatile("trace")},init:function(){function onError(err){testRunner.trigger("error",err)}var testRunner=this.getTestRunner(),variables={};return testRunner.getPluginStore("trace").then(function(tracesStore){testRunner.after("renderitem enableitem",function(){var context=testRunner.getTestContext();variables={ITEM_START_TIME_CLIENT:timestamp()},tracesStore.getItem(context.itemIdentifier).then(function(data){return data&&_.merge(variables,data),tracesStore.setItem(context.itemIdentifier,variables)}).catch(onError)}).before("move skip exit timeout",function(){var context=testRunner.getTestContext();return variables.ITEM_END_TIME_CLIENT=timestamp(),variables.ITEM_TIMEZONE=moment().utcOffset(moment().utcOffset()).format("Z"),tracesStore.setItem(context.itemIdentifier,variables).catch(onError)}).before("unloaditem",function(){var context=testRunner.getTestContext();return testRunner.getProxy().callItemAction(context.itemIdentifier,"storeTraceData",{traceData:JSON.stringify(variables)},!0)})})}});return itemTraceVariables}),define("taoQtiTest/runner/plugins/navigation/allowSkipping",["lodash","i18n","taoTests/runner/plugin","taoQtiTest/runner/helpers/currentItem"],function(_,__,pluginFactory,currentItemHelper){'use strict';_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,__=__&&Object.prototype.hasOwnProperty.call(__,"default")?__["default"]:__,pluginFactory=pluginFactory&&Object.prototype.hasOwnProperty.call(pluginFactory,"default")?pluginFactory["default"]:pluginFactory,currentItemHelper=currentItemHelper&&Object.prototype.hasOwnProperty.call(currentItemHelper,"default")?currentItemHelper["default"]:currentItemHelper;var defaults={allowPartial:!0},allowSkipping=pluginFactory({name:"allowSkipping",init:function(){var testRunner=this.getTestRunner(),testRunnerOptions=testRunner.getOptions(),pluginConfig=Object.assign({},defaults,this.getConfig());testRunner.before("nav-next move",function(){var testContext=testRunner.getTestContext(),isInteracting=!testRunner.getItemState(testContext.itemIdentifier,"disabled"),warning=pluginConfig.allowPartial?__("A response to this item is required."):__("A response to every question in this item is required.");if(isInteracting&&testRunnerOptions.enableAllowSkipping){var currenItem=testRunner.getCurrentItem(),allowSkipping="boolean"==typeof currenItem.allowSkipping?currenItem.allowSkipping:testContext.allowSkipping;if(!allowSkipping)return new Promise(function(resolve,reject){return 0===_.size(currentItemHelper.getDeclarations(testRunner))?resolve():currentItemHelper.isAnswered(testRunner,pluginConfig.allowPartial)?resolve():void(!testRunner.getState("alerted.notallowed")&&(testRunner.setState("alerted.notallowed",!0),testRunner.trigger("alert.notallowed",warning,function(){testRunner.trigger("resumeitem"),reject(),testRunner.setState("alerted.notallowed",!1)})))})}})}});return allowSkipping}),define("taoQtiTest/runner/plugins/navigation/next/nextWarningHelper",[],function(){'use strict';var toBoolean=function(value,defaultValue){return"undefined"==typeof value?defaultValue:!0===value||"true"===value};return function(options){function itemCanBeTriedAtWill(){return!1===isLast&&!1===isLinear&&-1===remainingAttempts&&!isNextItemInLinearPart()}function isNextItemInLinearPart(){return nextPart&&"undefined"!=typeof nextPart.isLinear&&isLastOfPart()&&!0===nextPart.isLinear}function shouldWarnOnTestEnd(){return isLast&&(endTestWarning||warnBeforeNext)&&shouldWarnForUnansweredItems()}function shouldWarnForUnansweredItems(){var hasUnanswered=stats&&0!=stats.questions-stats.answered,hasFlagged=stats&&0!==stats.flagged;return!unansweredOnly||hasUnanswered||hasFlagged}function shouldWarnOnPartChange(){return nextPartWarning&&isLastOfPart()&&shouldWarnForUnansweredItems()}function isLastOfPart(){return nextPart&&nextPart.id&&testPartId!==nextPart.id}var endTestWarning=toBoolean(options.endTestWarning,!1),isLast=toBoolean(options.isLast,!1),isLinear=toBoolean(options.isLinear,!1),nextItemWarning=toBoolean(options.nextItemWarning,!1),nextPartWarning=toBoolean(options.nextPartWarning,!1),stats=options.stats,nextPart=options.nextPart||{},remainingAttempts="undefined"==typeof options.remainingAttempts?-1:options.remainingAttempts,testPartId=options.testPartId||"",unansweredOnly=toBoolean(options.unansweredOnly,!1),warnBeforeNext=function(){return nextItemWarning&&!itemCanBeTriedAtWill()}(),warnBeforeEnd=function(){return shouldWarnOnTestEnd()}(),warnBeforeEndPart=function(){return shouldWarnOnPartChange()}();return{shouldWarnBeforeEndPart:function(){return warnBeforeEndPart},shouldWarnBeforeEnd:function(){return warnBeforeEnd},shouldWarnBeforeNext:function(){return warnBeforeNext}}}}),define("taoQtiTest/runner/plugins/navigation/next",["jquery","i18n","ui/hider","taoTests/runner/plugin","taoQtiTest/runner/plugins/navigation/next/nextWarningHelper","taoQtiTest/runner/helpers/messages","taoQtiTest/runner/helpers/map","taoQtiTest/runner/helpers/navigation","taoQtiTest/runner/helpers/stats","util/shortcut","util/namespace","handlebars"],function($$1,__,hider,pluginFactory,nextWarningHelper,messages,mapHelper,navigationHelper,statsHelper,shortcut,namespaceHelper,Handlebars){'use strict';function buttonTpl(data,options,asString){var html=Template(data,options);return asString||!0?html:$(html)}$$1=$$1&&Object.prototype.hasOwnProperty.call($$1,"default")?$$1["default"]:$$1,__=__&&Object.prototype.hasOwnProperty.call(__,"default")?__["default"]:__,hider=hider&&Object.prototype.hasOwnProperty.call(hider,"default")?hider["default"]:hider,pluginFactory=pluginFactory&&Object.prototype.hasOwnProperty.call(pluginFactory,"default")?pluginFactory["default"]:pluginFactory,nextWarningHelper=nextWarningHelper&&Object.prototype.hasOwnProperty.call(nextWarningHelper,"default")?nextWarningHelper["default"]:nextWarningHelper,messages=messages&&Object.prototype.hasOwnProperty.call(messages,"default")?messages["default"]:messages,mapHelper=mapHelper&&Object.prototype.hasOwnProperty.call(mapHelper,"default")?mapHelper["default"]:mapHelper,navigationHelper=navigationHelper&&Object.prototype.hasOwnProperty.call(navigationHelper,"default")?navigationHelper["default"]:navigationHelper,statsHelper=statsHelper&&Object.prototype.hasOwnProperty.call(statsHelper,"default")?statsHelper["default"]:statsHelper,shortcut=shortcut&&Object.prototype.hasOwnProperty.call(shortcut,"default")?shortcut["default"]:shortcut,namespaceHelper=namespaceHelper&&Object.prototype.hasOwnProperty.call(namespaceHelper,"default")?namespaceHelper["default"]:namespaceHelper,Handlebars=Handlebars&&Object.prototype.hasOwnProperty.call(Handlebars,"default")?Handlebars["default"]:Handlebars;var Template=Handlebars.template(function(Handlebars,depth0,helpers,partials,data){function program1(depth0,data){var buffer="",stack1,helper;return buffer+=" ",(helper=helpers.className)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.className,stack1="function"===_typeof2(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1),buffer}function program3(depth0,data){var buffer="",stack1;return buffer+="\n aria-"+escapeExpression((stack1=null==data||!1===data?data:data.key,"function"===_typeof2(stack1)?stack1.apply(depth0):stack1))+"=\""+escapeExpression("function"===_typeof2(depth0)?depth0.apply(depth0):depth0)+"\"\n ",buffer}function program5(depth0,data){var buffer="",stack1,helper;return buffer+="<span class=\"icon icon-",(helper=helpers.icon)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.icon,stack1="function"===_typeof2(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1),stack1=helpers.unless.call(depth0,depth0&&depth0.text,{hash:{},inverse:self.noop,fn:self.program(6,program6,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\"></span>",buffer}function program6(){return" no-label"}function program8(depth0,data){var buffer="",stack1,helper;return buffer+="<span class=\"text\">",(helper=helpers.text)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.text,stack1="function"===_typeof2(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"</span>",buffer}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,self=this,stack1,helper;return buffer+="<li\n data-control=\"",(helper=helpers.control)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.control,stack1="function"===_typeof2(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\"\n class=\"small btn-info action",stack1=helpers["if"].call(depth0,depth0&&depth0.className,{hash:{},inverse:self.noop,fn:self.program(1,program1,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\"\n title=\"",(helper=helpers.title)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.title,stack1="function"===_typeof2(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\"\n role=\"button\"\n ",stack1=helpers.each.call(depth0,depth0&&depth0.aria,{hash:{},inverse:self.noop,fn:self.program(3,program3,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n>\n <a class=\"li-inner\" href=\"#\" onclick=\"return false\" aria-hidden=\"true\" >\n ",stack1=helpers["if"].call(depth0,depth0&&depth0.icon,{hash:{},inverse:self.noop,fn:self.program(5,program5,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n ",stack1=helpers["if"].call(depth0,depth0&&depth0.text,{hash:{},inverse:self.noop,fn:self.program(8,program8,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n </a>\n</li>\n",buffer}),buttonData={next:{control:"move-forward",title:__("Submit and go to the next item"),specificTitle:__("Submit and go to the item %s"),icon:"forward",text:__("Next")},end:{control:"move-end",title:__("Submit and go to the end of the test"),icon:"fast-forward",text:__("End test")}},createElement=function(){var isLast=!!(0<arguments.length&&arguments[0]!==void 0)&&arguments[0],dataType=isLast?"end":"next";return $$1(buttonTpl(buttonData[dataType]))},enableElement=function($element){return $element.removeProp("disabled").removeClass("disabled")},disableElement=function($element){return $element.prop("disabled",!0).addClass("disabled")},updateElement=function($element,testRunner){var isLast=!!(2<arguments.length&&arguments[2]!==void 0)&&arguments[2],dataType=isLast?"end":"next",testContext=testRunner.getTestContext();if("next"===dataType&&!testContext.isAdaptive&&!testContext.isCatAdaptive){var testMap=testRunner.getTestMap(),nextItem=navigationHelper.getNextItem(testMap,testContext.itemPosition);$element.attr("title",__(buttonData.next.specificTitle,nextItem.label))}else $element.attr("title",buttonData[dataType].title);$element.attr("data-control")!==buttonData[dataType].control&&($element.attr("data-control",buttonData[dataType].control).find(".text").text(buttonData[dataType].text),"next"===dataType?$element.find(".icon-".concat(buttonData.end.icon)).removeClass("icon-".concat(buttonData.end.icon)).addClass("icon-".concat(buttonData.next.icon)):$element.find(".icon-".concat(buttonData.next.icon)).removeClass("icon-".concat(buttonData.next.icon)).addClass("icon-".concat(buttonData.end.icon)))},next=pluginFactory({name:"next",init:function(){var _this=this,testRunner=this.getTestRunner(),testRunnerOptions=testRunner.getOptions(),pluginShortcuts=(testRunnerOptions.shortcuts||{})[this.getName()]||{},isLastItem=function(){var testContext=testRunner.getTestContext(),testMap=testRunner.getTestMap(),itemIdentifier=testContext.itemIdentifier;return navigationHelper.isLast(testMap,itemIdentifier)},doNext=function(nextItemWarning){var testContext=testRunner.getTestContext(),testMap=testRunner.getTestMap(),testPart=testRunner.getCurrentPart(),nextItemPosition=testContext.itemPosition+1,itemIdentifier=testContext.itemIdentifier,unansweredWarning=mapHelper.hasItemCategory(testMap,itemIdentifier,"unansweredWarning",!0),nextPartWarning=mapHelper.hasItemCategory(testMap,itemIdentifier,"nextPartWarning",!0)||unansweredWarning,endTestWarning=mapHelper.hasItemCategory(testMap,itemIdentifier,"endTestWarning",!0),warningScope=nextPartWarning?"part":"test",enableNav=function(){return testRunner.trigger("enablenav")},triggerNextAction=function(){isLastItem()&&_this.trigger("end"),testRunner.next()};if(testRunner.trigger("disablenav"),!1!==_this.getState("enabled")){var warningHelper=nextWarningHelper({endTestWarning:endTestWarning,isLast:isLastItem(),isLinear:testPart.isLinear,nextItemWarning:nextItemWarning,nextPartWarning:nextPartWarning,nextPart:mapHelper.getItemPart(testMap,nextItemPosition),remainingAttempts:testContext.remainingAttempts,testPartId:testContext.testPartId,unansweredWarning:unansweredWarning,stats:statsHelper.getInstantStats(warningScope,testRunner),unansweredOnly:!endTestWarning&&unansweredWarning});if(warningHelper.shouldWarnBeforeEndPart()){var submitButtonLabel=__("SUBMIT THIS PART");testRunner.trigger("confirm.endTestPart",messages.getExitMessage(warningScope,testRunner,"",!1,submitButtonLabel),triggerNextAction,enableNav,{buttons:{labels:{ok:submitButtonLabel,cancel:__("CANCEL")}}})}else if(warningHelper.shouldWarnBeforeEnd()){var _submitButtonLabel=__("SUBMIT THE TEST");testRunner.trigger("confirm.endTest",messages.getExitMessage(warningScope,testRunner,"",!1,_submitButtonLabel),triggerNextAction,enableNav,{buttons:{labels:{ok:_submitButtonLabel,cancel:__("CANCEL")}}})}else warningHelper.shouldWarnBeforeNext()?testRunner.trigger("confirm.next",__("You are about to go to the next item. Click OK to continue and go to the next item."),triggerNextAction,enableNav):triggerNextAction()}};this.$element=createElement(isLastItem()),this.$element.on("click",function(e){e.preventDefault(),disableElement(_this.$element),testRunner.trigger("nav-next")});var registerShortcut=function(kbdShortcut){testRunnerOptions.allowShortcuts&&kbdShortcut&&shortcut.add(namespaceHelper.namespaceAll(kbdShortcut,_this.getName(),!0),function(){!0===_this.getState("enabled")&&testRunner.trigger("nav-next",!0)},{avoidInput:!0,prevent:!0})};registerShortcut(pluginShortcuts.trigger),this.disable(),testRunner.on("loaditem",function(){updateElement(_this.$element,testRunner,isLastItem())}).on("enablenav",function(){return _this.enable()}).on("disablenav",function(){return _this.disable()}).on("hidenav",function(){return _this.hide()}).on("shownav",function(){return _this.show()}).on("nav-next",function(nextItemWarning){return doNext(nextItemWarning)}).on("enableaccessibilitymode",function(){var kbdShortcut=pluginShortcuts.triggerAccessibility;kbdShortcut&&!_this.getState("eaccessibilitymode")&&(shortcut.remove(".".concat(_this.getName())),registerShortcut(kbdShortcut),_this.setState("eaccessibilitymode"))})},render:function(){var $container=this.getAreaBroker().getNavigationArea();$container.append(this.$element)},destroy:function(){shortcut.remove(".".concat(this.getName())),this.$element.remove()},enable:function(){enableElement(this.$element)},disable:function(){disableElement(this.$element)},show:function(){hider.show(this.$element)},hide:function(){hider.hide(this.$element)}});return next}),define("taoQtiTest/runner/plugins/navigation/next/dialogConfirmNext",["jquery","lodash","i18n","ui/dialog","handlebars"],function($$1,_,__,dialog,Handlebars){'use strict';function checkboxTpl(data,options,asString){var html=Template(data,options);return asString||!0?html:$(html)}function dialogConfirmNext(heading,message,accept,refuse,checkboxParams,dialogOptions){var accepted=!1,content=null,dlg;return checkboxParams&&!0!==checkboxParams.checked&&(content=checkboxTpl({checked:!1,text:"Don't show this again next time",id:"dont-show-again"})),dialogOptions=_.defaults({heading:heading,message:message,content:content,autoRender:!0,autoDestroy:!0,buttons:[{id:"cancel",type:"regular",label:__("Cancel"),close:!0},{id:"ok",type:"info",label:__("Go to next item"),close:!0}],onOkBtn:function(){var $checkbox;accepted=!0,_.isFunction(accept)&&(accept.call(this),checkboxParams&&($checkbox=$$1("input[name=\"dont-show-again\"]",this),$checkbox.prop("checked")&&_.isFunction(checkboxParams.submitChecked)?checkboxParams.submitChecked():!$checkbox.prop("checked")&&_.isFunction(checkboxParams.submitUnchecked)&&checkboxParams.submitUnchecked()))}},dialogOptions),dlg=dialog(dialogOptions),_.isFunction(refuse)&&dlg.on("closed.modal",function(){accepted||refuse.call(this)}),dlg}$$1=$$1&&Object.prototype.hasOwnProperty.call($$1,"default")?$$1["default"]:$$1,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,__=__&&Object.prototype.hasOwnProperty.call(__,"default")?__["default"]:__,dialog=dialog&&Object.prototype.hasOwnProperty.call(dialog,"default")?dialog["default"]:dialog,Handlebars=Handlebars&&Object.prototype.hasOwnProperty.call(Handlebars,"default")?Handlebars["default"]:Handlebars;var Template=Handlebars.template(function(Handlebars,depth0,helpers,partials,data){this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,self=this,stack1,helper;return buffer+="<label for=\"",(helper=helpers.id)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.id,stack1="function"===_typeof2(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\">\n <input type=\"checkbox\" id=\"",(helper=helpers.id)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.id,stack1="function"===_typeof2(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\" name=\"",(helper=helpers.id)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.id,stack1="function"===_typeof2(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\" ",stack1=helpers["if"].call(depth0,depth0&&depth0.checked,{hash:{},inverse:self.noop,fn:self.program(1,function(){return"checked"},data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+=" />\n <span class=\"icon-checkbox\"></span>\n ",(helper=helpers.text)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.text,stack1="function"===_typeof2(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\n</label>",buffer});return dialogConfirmNext}),define("taoQtiTest/runner/plugins/navigation/next/linearNextItemWarning",["i18n","taoTests/runner/plugin","taoQtiTest/runner/helpers/map","taoQtiTest/runner/helpers/currentItem","taoQtiTest/runner/plugins/navigation/next/dialogConfirmNext","taoQtiTest/runner/helpers/navigation"],function(__,pluginFactory,mapHelper,currentItemHelper,dialogConfirmNext,navigationHelper){'use strict';__=__&&Object.prototype.hasOwnProperty.call(__,"default")?__["default"]:__,pluginFactory=pluginFactory&&Object.prototype.hasOwnProperty.call(pluginFactory,"default")?pluginFactory["default"]:pluginFactory,mapHelper=mapHelper&&Object.prototype.hasOwnProperty.call(mapHelper,"default")?mapHelper["default"]:mapHelper,currentItemHelper=currentItemHelper&&Object.prototype.hasOwnProperty.call(currentItemHelper,"default")?currentItemHelper["default"]:currentItemHelper,dialogConfirmNext=dialogConfirmNext&&Object.prototype.hasOwnProperty.call(dialogConfirmNext,"default")?dialogConfirmNext["default"]:dialogConfirmNext,navigationHelper=navigationHelper&&Object.prototype.hasOwnProperty.call(navigationHelper,"default")?navigationHelper["default"]:navigationHelper;var linearNextItemWarning=pluginFactory({name:"linearNextItemWarning",init:function(){function getNextItemCategories(){var testContext=testRunner.getTestContext(),testMap=testRunner.getTestMap();return{nextPartWarning:mapHelper.hasItemCategory(testMap,testContext.itemIdentifier,"nextPartWarning",!0),nextSectionWarning:mapHelper.hasItemCategory(testMap,testContext.itemIdentifier,"nextSectionWarning",!0)}}function getCustomNextMessage(action){var itemPartiallyAnswered=currentItemHelper.isAnswered(testRunner,!0),customNextMessage;return customNextMessage=itemPartiallyAnswered?"next"===action?__("Are you sure you want to go to the next item? You will not be able to go back and change your answer."):"skip"===action?__("Are you sure you want to clear your answer and go to the next item? You will not be able to go back and provide an answer."):__("Are you sure you want to go to the next item? You will not be able to go back."):__("Are you sure you want to go to the next item? You will not be able to go back and provide an answer."),customNextMessage}function doNextWarning(action){return testRunner.trigger("disablenav"),testStore.getStore(self.getName()).then(function(store){return store.getItem("dontShowLinearNextItemWarning").then(function(checkboxValue){var checkboxParams=null;if(!0!==checkboxValue)return testRunnerOptions.enableLinearNextItemWarningCheckbox&&(checkboxParams={checked:checkboxValue,submitChecked:function(){store.setItem("dontShowLinearNextItemWarning",!0)},submitUnchecked:function(){store.setItem("dontShowLinearNextItemWarning",!1)}}),new Promise(function(resolve,reject){dialogConfirmNext(__("Go to the next item?"),getCustomNextMessage(action),resolve,function(){reject({cancel:!0})},checkboxParams)})})}).catch(function(err){if(err&&err instanceof Error)throw err;return err&&!0===err.cancel?(testRunner.trigger("enablenav"),Promise.reject()):void 0})}var self=this,testRunner=this.getTestRunner(),testRunnerOptions=testRunner.getOptions(),testStore=testRunner.getTestStore();testStore.setVolatile(self.getName()),testRunner.on("init",function(){testStore.getStore(self.getName()).then(function(store){store.setItem("dontShowLinearNextItemWarning",null)})}).before("move skip",function(e,type,scope){var context=testRunner.getTestContext(),map=testRunner.getTestMap(),item=testRunner.getCurrentItem(),currentPart=testRunner.getCurrentPart(),categories=getNextItemCategories(),isLast=navigationHelper.isLast(map,context.itemIdentifier);if(currentPart&&currentPart.isLinear){if("section"===scope&&categories.nextSectionWarning)return;if(categories.nextPartWarning)return;if(item.informational)return;if("next"===type&&!isLast&&testRunnerOptions.forceEnableLinearNextItemWarning)return doNextWarning("next");if("skip"===e.name&&!isLast&&testRunnerOptions.forceEnableLinearNextItemWarning)return doNextWarning("skip")}})}});return linearNextItemWarning}),define("taoQtiTest/runner/plugins/navigation/nextSection",["jquery","lodash","i18n","ui/hider","taoTests/runner/plugin","taoQtiTest/runner/helpers/messages","handlebars","taoQtiTest/runner/helpers/map"],function($$1,_,__,hider,pluginFactory,messages,Handlebars,mapHelper){'use strict';function buttonTpl(data,options,asString){var html=Template(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,pluginFactory=pluginFactory&&Object.prototype.hasOwnProperty.call(pluginFactory,"default")?pluginFactory["default"]:pluginFactory,messages=messages&&Object.prototype.hasOwnProperty.call(messages,"default")?messages["default"]:messages,Handlebars=Handlebars&&Object.prototype.hasOwnProperty.call(Handlebars,"default")?Handlebars["default"]:Handlebars,mapHelper=mapHelper&&Object.prototype.hasOwnProperty.call(mapHelper,"default")?mapHelper["default"]:mapHelper;var Template=Handlebars.template(function(Handlebars,depth0,helpers,partials,data){function program1(depth0,data){var buffer="",stack1,helper;return buffer+=" ",(helper=helpers.className)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.className,stack1="function"===_typeof2(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1),buffer}function program3(depth0,data){var buffer="",stack1;return buffer+="\n aria-"+escapeExpression((stack1=null==data||!1===data?data:data.key,"function"===_typeof2(stack1)?stack1.apply(depth0):stack1))+"=\""+escapeExpression("function"===_typeof2(depth0)?depth0.apply(depth0):depth0)+"\"\n ",buffer}function program5(depth0,data){var buffer="",stack1,helper;return buffer+="<span class=\"icon icon-",(helper=helpers.icon)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.icon,stack1="function"===_typeof2(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1),stack1=helpers.unless.call(depth0,depth0&&depth0.text,{hash:{},inverse:self.noop,fn:self.program(6,program6,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\"></span>",buffer}function program6(){return" no-label"}function program8(depth0,data){var buffer="",stack1,helper;return buffer+="<span class=\"text\">",(helper=helpers.text)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.text,stack1="function"===_typeof2(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"</span>",buffer}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,self=this,stack1,helper;return buffer+="<li\n data-control=\"",(helper=helpers.control)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.control,stack1="function"===_typeof2(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\"\n class=\"small btn-info action",stack1=helpers["if"].call(depth0,depth0&&depth0.className,{hash:{},inverse:self.noop,fn:self.program(1,program1,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\"\n title=\"",(helper=helpers.title)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.title,stack1="function"===_typeof2(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\"\n role=\"button\"\n ",stack1=helpers.each.call(depth0,depth0&&depth0.aria,{hash:{},inverse:self.noop,fn:self.program(3,program3,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n>\n <a class=\"li-inner\" href=\"#\" onclick=\"return false\" aria-hidden=\"true\" >\n ",stack1=helpers["if"].call(depth0,depth0&&depth0.icon,{hash:{},inverse:self.noop,fn:self.program(5,program5,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n ",stack1=helpers["if"].call(depth0,depth0&&depth0.text,{hash:{},inverse:self.noop,fn:self.program(8,program8,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n </a>\n</li>\n",buffer}),nextSection=pluginFactory({name:"nextsection",init:function(){function getNextSectionCategories(){var testContext=testRunner.getTestContext(),testMap=testRunner.getTestMap();return{nextSection:mapHelper.hasItemCategory(testMap,testContext.itemIdentifier,"nextSection",!0),nextSectionWarning:mapHelper.hasItemCategory(testMap,testContext.itemIdentifier,"nextSectionWarning",!0),noExitTimedSectionWarning:mapHelper.hasItemCategory(testMap,testContext.itemIdentifier,"noExitTimedSectionWarning",!0)}}function toggle(){var categories=getNextSectionCategories();testRunnerOptions.nextSection&&(categories.nextSection||categories.nextSectionWarning)?self.show():self.hide()}function nextSection(){testRunner.next("section")}var self=this,testRunner=this.getTestRunner(),testRunnerOptions=testRunner.getOptions(),isWarnSectionLeavingEabled=function(){var testContext=testRunner.getTestContext(),categories=getNextSectionCategories(),timeConstraints=testContext.timeConstraints||[];return timeConstraints.some(function(_ref){var source=_ref.source;return source===testContext.sectionId})&&!categories.noExitTimedSectionWarning&&!(testRunnerOptions.timer||{}).keepUpToTimeout};this.$element=$$1(buttonTpl({control:"next-section",title:__("Skip to the next section"),icon:"fast-forward",text:__("Next Section")})),this.$element.on("click",function(e){var enable=_.bind(self.enable,self),categories=getNextSectionCategories();if(e.preventDefault(),!1!==self.getState("enabled"))if(self.disable(),categories.nextSectionWarning&&!isWarnSectionLeavingEabled()){var submitButtonLabel=__("CONTINUE TO THE NEXT SECTION");testRunner.trigger("confirm.nextsection",messages.getExitMessage("section",testRunner,"",!1,submitButtonLabel),nextSection,enable,{buttons:{labels:{ok:submitButtonLabel,cancel:__("CANCEL")}}})}else nextSection()}),this.disable(),toggle(),testRunner.on("loaditem",toggle).on("enablenav",function(){self.enable()}).on("disablenav",function(){self.disable()}).on("hidenav",function(){self.hide()}).on("shownav",function(){self.show()})},render:function(){var $container=this.getAreaBroker().getNavigationArea();$container.append(this.$element)},destroy:function(){this.$element.remove()},enable:function(){this.$element.removeProp("disabled").removeClass("disabled")},disable:function(){this.$element.prop("disabled",!0).addClass("disabled")},show:function(){hider.show(this.$element)},hide:function(){hider.hide(this.$element)}});return nextSection}),define("taoQtiTest/runner/plugins/navigation/previous",["jquery","lodash","i18n","ui/hider","taoTests/runner/plugin","util/shortcut","util/namespace","taoQtiTest/runner/helpers/navigation","taoQtiTest/runner/helpers/map","handlebars"],function($$1,_,__,hider,pluginFactory,shortcut,namespaceHelper,navigationHelper,mapHelper,Handlebars){'use strict';function buttonTpl(data,options,asString){var html=Template(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,pluginFactory=pluginFactory&&Object.prototype.hasOwnProperty.call(pluginFactory,"default")?pluginFactory["default"]:pluginFactory,shortcut=shortcut&&Object.prototype.hasOwnProperty.call(shortcut,"default")?shortcut["default"]:shortcut,namespaceHelper=namespaceHelper&&Object.prototype.hasOwnProperty.call(namespaceHelper,"default")?namespaceHelper["default"]:namespaceHelper,navigationHelper=navigationHelper&&Object.prototype.hasOwnProperty.call(navigationHelper,"default")?navigationHelper["default"]:navigationHelper,mapHelper=mapHelper&&Object.prototype.hasOwnProperty.call(mapHelper,"default")?mapHelper["default"]:mapHelper,Handlebars=Handlebars&&Object.prototype.hasOwnProperty.call(Handlebars,"default")?Handlebars["default"]:Handlebars;var Template=Handlebars.template(function(Handlebars,depth0,helpers,partials,data){function program1(depth0,data){var buffer="",stack1,helper;return buffer+=" ",(helper=helpers.className)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.className,stack1="function"===_typeof2(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1),buffer}function program3(depth0,data){var buffer="",stack1;return buffer+="\n aria-"+escapeExpression((stack1=null==data||!1===data?data:data.key,"function"===_typeof2(stack1)?stack1.apply(depth0):stack1))+"=\""+escapeExpression("function"===_typeof2(depth0)?depth0.apply(depth0):depth0)+"\"\n ",buffer}function program5(depth0,data){var buffer="",stack1,helper;return buffer+="<span class=\"icon icon-",(helper=helpers.icon)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.icon,stack1="function"===_typeof2(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1),stack1=helpers.unless.call(depth0,depth0&&depth0.text,{hash:{},inverse:self.noop,fn:self.program(6,program6,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\"></span>",buffer}function program6(){return" no-label"}function program8(depth0,data){var buffer="",stack1,helper;return buffer+="<span class=\"text\">",(helper=helpers.text)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.text,stack1="function"===_typeof2(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"</span>",buffer}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,self=this,stack1,helper;return buffer+="<li\n data-control=\"",(helper=helpers.control)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.control,stack1="function"===_typeof2(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\"\n class=\"small btn-info action",stack1=helpers["if"].call(depth0,depth0&&depth0.className,{hash:{},inverse:self.noop,fn:self.program(1,program1,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\"\n title=\"",(helper=helpers.title)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.title,stack1="function"===_typeof2(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\"\n role=\"button\"\n ",stack1=helpers.each.call(depth0,depth0&&depth0.aria,{hash:{},inverse:self.noop,fn:self.program(3,program3,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n>\n <a class=\"li-inner\" href=\"#\" onclick=\"return false\" aria-hidden=\"true\" >\n ",stack1=helpers["if"].call(depth0,depth0&&depth0.icon,{hash:{},inverse:self.noop,fn:self.program(5,program5,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n ",stack1=helpers["if"].call(depth0,depth0&&depth0.text,{hash:{},inverse:self.noop,fn:self.program(8,program8,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n </a>\n</li>\n",buffer}),previous=pluginFactory({name:"previous",init:function(){function doPrevious(previousItemWarning){function triggerAction(){testRunner.previous()}var context=testRunner.getTestContext();testRunner.trigger("disablenav"),!1!==self.getState("enabled")&&(previousItemWarning&&-1!==context.remainingAttempts?testRunner.trigger("confirm.previous",__("You are about to go to the previous item. Click OK to continue and go to the previous item."),triggerAction,function(){testRunner.trigger("enablenav")}):triggerAction())}var _this=this,self=this,testRunner=this.getTestRunner(),testRunnerOptions=testRunner.getOptions(),pluginShortcuts=(testRunnerOptions.shortcuts||{})[this.getName()]||{},canDoPrevious=function(){var testMap=testRunner.getTestMap(),context=testRunner.getTestContext(),currentSection=testRunner.getCurrentSection(),noExitTimedSectionWarning=mapHelper.hasItemCategory(testMap,context.itemIdentifier,"noExitTimedSectionWarning",!0),currentPart=testRunner.getCurrentPart(),previousSection,previousPart;if(_.isPlainObject(testMap)&&0===_.size(testMap))return!1;if(navigationHelper.isFirst(testMap,context.itemIdentifier))return!1;if(navigationHelper.isFirstOf(testMap,context.itemIdentifier,"section")){if(currentSection.isCatAdaptive)return!1;if(previousSection=mapHelper.getItemSection(testMap,context.itemPosition-1),previousSection.isCatAdaptive||previousSection.timeConstraint&&!noExitTimedSectionWarning)return!1}return!(navigationHelper.isFirstOf(testMap,context.itemIdentifier,"part")&&(previousPart=mapHelper.getItemPart(testMap,context.itemPosition-1),previousPart.isLinear))&&!1===currentPart.isLinear&&!0===context.canMoveBackward},toggle=function(){canDoPrevious()?self.show():self.hide()};this.$element=$$1(buttonTpl({control:"move-backward",title:__("Submit and go to the previous item"),icon:"backward",text:__("Previous")})),this.$element.on("click",function(e){e.preventDefault(),testRunner.trigger("nav-previous")});var registerShortcut=function(kbdShortcut){testRunnerOptions.allowShortcuts&&kbdShortcut&&shortcut.add(namespaceHelper.namespaceAll(kbdShortcut,_this.getName(),!0),function(){canDoPrevious()&&!0===self.getState("enabled")&&testRunner.trigger("nav-previous",[!0])},{avoidInput:!0,prevent:!0})};registerShortcut(pluginShortcuts.trigger),toggle(),self.disable(),testRunner.on("loaditem",toggle).on("enablenav",function(){self.enable()}).on("disablenav",function(){self.disable()}).on("hidenav",function(){self.hide()}).on("shownav",function(){self.show()}).on("nav-previous",function(previousItemWarning){doPrevious(previousItemWarning)}).on("enableaccessibilitymode",function(){var kbdShortcut=pluginShortcuts.triggerAccessibility;kbdShortcut&&!_this.getState("eaccessibilitymode")&&(shortcut.remove(".".concat(_this.getName())),registerShortcut(kbdShortcut),_this.setState("eaccessibilitymode"))})},render:function(){var $container=this.getAreaBroker().getNavigationArea();$container.append(this.$element)},destroy:function(){shortcut.remove(".".concat(this.getName())),this.$element.remove()},enable:function(){this.$element.removeProp("disabled").removeClass("disabled")},disable:function(){this.$element.prop("disabled",!0).addClass("disabled")},show:function(){hider.show(this.$element)},hide:function(){hider.hide(this.$element)}});return previous}),define("taoQtiTest/runner/plugins/navigation/review/navigator",["jquery","lodash","ui/component","ui/autoscroll","taoQtiTest/runner/helpers/map","handlebars"],function($$1,_,component,autoscroll,mapHelper,Handlebars){'use strict';function navigatorTpl(data,options,asString){var html=Template(data,options);return asString||!0?html:$(html)}function navigatorTreeTpl(data,options,asString){var html=Template$1(data,options);return asString||!0?html:$(html)}function navigatorFactory(config,map,context){function flagItem($item){var position=$item.data("position"),flagged=!$item.hasClass(_cssCls.flagged);navigator.setItemFlag(position,flagged),navigator.trigger("flag",position,flagged)}function jump($item){var position=$item.data("position");navigator.trigger("jump",position)}var navigator;return navigator=component(navigatorApi,_defaults).setTemplate(navigatorTpl).on("destroy",function(){this.controls=null}).on("show",function(){this.autoScroll()}).on("render",function(){var self=this,$component=this.getElement(),$filterBar=$component.find(_selectors.filterBar),$filters=$filterBar.find("li"),$tree=$component.find(_selectors.tree);this.controls={$infoAnswered:$component.find(_selectors.infoAnswered),$infoViewed:$component.find(_selectors.infoViewed),$infoAll:$component.find(_selectors.tabInfoAll),$infoUnanswered:this.config.showLegend?$component.find(_selectors.infoUnanswered):$component.find(_selectors.tabInfoUnanswered),$infoFlagged:this.config.showLegend?$component.find(_selectors.infoFlagged):$component.find(_selectors.tabInfoFlagged),$filterBar:$filterBar,$filters:$filters,$tree:$tree,$linearState:$component.find(_selectors.linearState)},this.updateConfig(),$component.on("click".concat(_selectors.component),_selectors.collapseHandle,function(){self.is("disabled")||($component.toggleClass(_cssCls.collapsed),$component.hasClass(_cssCls.collapsed)&&self.openSelected())}),$component.on("click".concat(_selectors.component),_selectors.infoPanelLabels,function(){self.is("disabled")||self.togglePanel($$1(this).closest(_selectors.infoPanel),_selectors.infoPanel)}),$tree.on("click".concat(_selectors.component),_selectors.partLabels,function(){var $panel;self.is("disabled")||($panel=$$1(this).closest(_selectors.parts),self.togglePanel($panel,_selectors.parts)&&($panel.hasClass(_cssCls.active)?self.openSelected():self.openOnly($panel.find(_selectors.sections).first(),$panel)))}),$tree.on("click".concat(_selectors.component),_selectors.sectionLabels,function(){self.is("disabled")||self.togglePanel($$1(this).closest(_selectors.sections),_selectors.sections)}),$tree.on("click".concat(_selectors.component),_selectors.itemLabels,function(event){var $item,$target;self.is("disabled")||($item=$$1(this).closest(_selectors.items),!$item.hasClass(_cssCls.disabled)&&($target=$$1(event.target),self.config.canFlag&&$target.is(_selectors.icons)&&!$component.hasClass(_cssCls.collapsed)?!$item.hasClass(_cssCls.unseen)&&!$item.hasClass(_cssCls.info)&&flagItem($item):!$item.hasClass(_cssCls.active)&&(self.select($item),jump($item))))}),$tree.on("click".concat(_selectors.component),_selectors.linearStart,function(){var $btn;self.is("disabled")||($btn=$$1(this),!$btn.hasClass(_cssCls.disabled)&&($btn.addClass(_cssCls.disabled),jump($btn)))}),$filterBar.on("click".concat(_selectors.component),_selectors.filter,function(){var $btn,mode;self.is("disabled")||($btn=$$1(this),mode=$btn.data("mode"),$filters.removeClass(_cssCls.active),$filters.attr("aria-selected",!1),$component.removeClass(_cssCls.collapsed),$btn.addClass(_cssCls.active),$btn.attr("aria-selected",!0),self.filter(mode),self.autoScroll())}),this.update(map,context)}),navigator.currentFilter="all",navigator.init(config)}$$1=$$1&&Object.prototype.hasOwnProperty.call($$1,"default")?$$1["default"]:$$1,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,component=component&&Object.prototype.hasOwnProperty.call(component,"default")?component["default"]:component,autoscroll=autoscroll&&Object.prototype.hasOwnProperty.call(autoscroll,"default")?autoscroll["default"]:autoscroll,mapHelper=mapHelper&&Object.prototype.hasOwnProperty.call(mapHelper,"default")?mapHelper["default"]:mapHelper,Handlebars=Handlebars&&Object.prototype.hasOwnProperty.call(Handlebars,"default")?Handlebars["default"]:Handlebars;var Template=Handlebars.template(function(Handlebars,depth0,helpers,partials,data){function program3(depth0,data){var buffer="",helper,options;return buffer+="\n <div class=\"qti-navigator-info collapsible\">\n <span class=\"qti-navigator-label\">\n <span class=\"qti-navigator-text\">"+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"Test status",options):helperMissing.call(depth0,"__","Test status",options)))+"</span>\n <span class=\"icon-up\"></span>\n <span class=\"icon-down\"></span>\n </span>\n <ul class=\"collapsible-panel plain\">\n <li class=\"qti-navigator-viewed\" title=\""+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"Viewed items",options):helperMissing.call(depth0,"__","Viewed items",options)))+"\">\n <span class=\"qti-navigator-label\">\n <span class=\"qti-navigator-icon icon-viewed\"></span>\n <span class=\"qti-navigator-text\">"+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"Viewed",options):helperMissing.call(depth0,"__","Viewed",options)))+"</span>\n <span class=\"qti-navigator-counter\">-/-</span>\n </span>\n </li>\n <li class=\"qti-navigator-answered\" title=\""+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"Completed items",options):helperMissing.call(depth0,"__","Completed items",options)))+"\">\n <span class=\"qti-navigator-label\">\n <span class=\"qti-navigator-icon icon-answered\"></span>\n <span class=\"qti-navigator-text\">"+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"Answered",options):helperMissing.call(depth0,"__","Answered",options)))+"</span>\n <span class=\"qti-navigator-counter\">-/-</span>\n </span>\n </li>\n <li class=\"qti-navigator-unanswered\" title=\""+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"Unanswered items",options):helperMissing.call(depth0,"__","Unanswered items",options)))+"\">\n <span class=\"qti-navigator-label\">\n <span class=\"qti-navigator-icon icon-unanswered\"></span>\n <span class=\"qti-navigator-text\">"+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"Unanswered",options):helperMissing.call(depth0,"__","Unanswered",options)))+"</span>\n <span class=\"qti-navigator-counter\">-/-</span>\n </span>\n </li>\n <li class=\"qti-navigator-flagged\" title=\""+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"Items marked for later review",options):helperMissing.call(depth0,"__","Items marked for later review",options)))+"\">\n <span class=\"qti-navigator-label\">\n <span class=\"qti-navigator-icon icon-flagged\"></span>\n <span class=\"qti-navigator-text\">"+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"Flagged",options):helperMissing.call(depth0,"__","Flagged",options)))+"</span>\n <span class=\"qti-navigator-counter\">-/-</span>\n </span>\n </li>\n </ul>\n </div>\n ",buffer}function program9(depth0,data){var buffer="",helper,options;return buffer+=escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"Unanswered",options):helperMissing.call(depth0,"__","Unanswered",options)))+" (<span class=\"qti-navigator-counter\">0</span>)",buffer}function program13(depth0,data){var buffer="",helper,options;return buffer+=escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"Flagged",options):helperMissing.call(depth0,"__","Flagged",options)))+" (<span class=\"qti-navigator-counter\">0</span>)",buffer}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",helperMissing=helpers.helperMissing,escapeExpression=this.escapeExpression,self=this,stack1,helper,options;return buffer+="<div class=\"qti-panel qti-navigator",stack1=helpers["if"].call(depth0,depth0&&depth0.hidden,{hash:{},inverse:self.noop,fn:self.program(1,function(){return" hidden"},data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\">\n <div class=\"qti-navigator-collapsible\">\n <span class=\"qti-navigator-collapse icon icon-left\" title=\""+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"Collapse the review panel",options):helperMissing.call(depth0,"__","Collapse the review panel",options)))+"\"></span>\n <span class=\"qti-navigator-expand icon icon-right\" title=\""+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"Expand the review panel",options):helperMissing.call(depth0,"__","Expand the review panel",options)))+"\"></span>\n </div>\n ",stack1=helpers["if"].call(depth0,depth0&&depth0.showLegend,{hash:{},inverse:self.noop,fn:self.program(3,program3,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n\n\n <div class=\"qti-navigator-filters\">\n <ul role=\"tablist\" class=\"plain clearfix\">\n <li role=\"tab\" aria-selected=\"true\" class=\"qti-navigator-filter active\" data-mode=\"all\">\n <span title=\""+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"Reset filters",options):helperMissing.call(depth0,"__","Reset filters",options)))+"\" class=\"qti-navigator-tab\">"+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"All",options):helperMissing.call(depth0,"__","All",options)))+"\n ",stack1=helpers.unless.call(depth0,depth0&&depth0.showLegend,{hash:{},inverse:self.noop,fn:self.program(5,function(){return"(<span class=\"qti-navigator-counter\">0</span>)"},data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n </span>\n </li>\n\n <li role=\"tab\" class=\"qti-navigator-filter\" data-mode=\"unanswered\">\n <span class=\"",stack1=helpers["if"].call(depth0,depth0&&depth0.showLegend,{hash:{},inverse:self.noop,fn:self.program(7,function(){return"icon-unanswered "},data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="qti-navigator-tab\" title=\""+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"Only display the unanswered items",options):helperMissing.call(depth0,"__","Only display the unanswered items",options)))+"\">\n ",stack1=helpers.unless.call(depth0,depth0&&depth0.showLegend,{hash:{},inverse:self.noop,fn:self.program(9,program9,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n </span>\n </li>\n\n <li role=\"tab\" class=\"qti-navigator-filter\" data-mode=\"flagged\">\n <span class=\"",stack1=helpers["if"].call(depth0,depth0&&depth0.showLegend,{hash:{},inverse:self.noop,fn:self.program(11,function(){return"icon-flagged "},data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="qti-navigator-tab\" title=\""+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"Only display the items marked for review",options):helperMissing.call(depth0,"__","Only display the items marked for review",options)))+"\">\n ",stack1=helpers.unless.call(depth0,depth0&&depth0.showLegend,{hash:{},inverse:self.noop,fn:self.program(13,program13,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n </span>\n </li>\n </ul>\n </div>\n\n <nav class=\"qti-navigator-tree\"></nav>\n\n <div id=\"qti-navigator-linear\" class=\"qti-navigator-linear\">\n <span class=\"icon icon-info\" title=\""+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"In this part of the test navigation is not allowed.",options):helperMissing.call(depth0,"__","In this part of the test navigation is not allowed.",options)))+"\"></span>\n <p class=\"qti-navigator-message\">\n "+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"In this part of the test navigation is not allowed.",options):helperMissing.call(depth0,"__","In this part of the test navigation is not allowed.",options)))+"\n </p>\n </div>\n</div>\n",buffer}),Template$1=Handlebars.template(function(Handlebars,depth0,helpers,partials,data){function program1(depth0,data){var buffer="",stack1,helper;return buffer+="\n <li class=\"qti-navigator-part collapsible ",stack1=helpers["if"].call(depth0,depth0&&depth0.active,{hash:{},inverse:self.program(4,program4,data),fn:self.program(2,program2,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\" data-id=\"",(helper=helpers.id)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.id,stack1="function"===_typeof2(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\">\n <span class=\"qti-navigator-label\" title=\"",(helper=helpers.label)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.label,stack1="function"===_typeof2(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\">\n <span class=\"qti-navigator-text\">",(helper=helpers.label)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.label,stack1="function"===_typeof2(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"</span>\n <span class=\"icon-up\"></span>\n <span class=\"icon-down\"></span>\n </span>\n ",stack1=helpers["if"].call(depth0,depth0&&depth0.isLinear,{hash:{},inverse:self.program(8,program8,data),fn:self.program(6,program6,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n </li>\n ",buffer}function program2(){return"active"}function program4(){return"collapsed"}function program6(depth0,data){var buffer="",stack1,helper,options;return buffer+="\n <div class=\"qti-navigator-linear-part collapsible-panel\">\n <span class=\"icon icon-info\" title=\""+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"In this part of the test navigation is not allowed.",options):helperMissing.call(depth0,"__","In this part of the test navigation is not allowed.",options)))+"\"></span>\n <p class=\"qti-navigator-message\">\n "+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"In this part of the test navigation is not allowed.",options):helperMissing.call(depth0,"__","In this part of the test navigation is not allowed.",options)))+"\n </p>\n <p class=\"qti-navigator-actions\">\n <button class=\"btn-info small\" data-position=\"",(helper=helpers.position)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.position,stack1="function"===_typeof2(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\" title=\""+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"Start Test-part",options):helperMissing.call(depth0,"__","Start Test-part",options)))+"\">\n <span class=\"qti-navigator-text\">"+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"Start Test-part",options):helperMissing.call(depth0,"__","Start Test-part",options)))+"</span>\n <span class=\"icon-play r\"></span>\n </button>\n </p>\n </div>\n ",buffer}function program8(depth0,data){var buffer="",stack1,helper;return buffer+="\n <ul aria-label=\"",(helper=helpers.label)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.label,stack1="function"===_typeof2(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\" class=\"qti-navigator-sections collapsible-panel plain\">\n ",stack1=helpers.each.call(depth0,depth0&&depth0.sections,{hash:{},inverse:self.noop,fn:self.program(9,program9,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n </ul>\n ",buffer}function program9(depth0,data){var buffer="",stack1,helper;return buffer+="\n <li class=\"qti-navigator-section collapsible ",stack1=helpers["if"].call(depth0,depth0&&depth0.active,{hash:{},inverse:self.program(4,program4,data),fn:self.program(2,program2,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\" data-id=\"",(helper=helpers.id)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.id,stack1="function"===_typeof2(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\">\n <span class=\"qti-navigator-label\" title=\"",(helper=helpers.label)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.label,stack1="function"===_typeof2(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\">\n <span class=\"qti-navigator-text\">",(helper=helpers.label)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.label,stack1="function"===_typeof2(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"</span>\n <span class=\"qti-navigator-counter\">"+escapeExpression((stack1=(stack1=depth0&&depth0.stats,null==stack1||!1===stack1?stack1:stack1.answered),"function"===_typeof2(stack1)?stack1.apply(depth0):stack1))+"/"+escapeExpression((stack1=(stack1=depth0&&depth0.stats,null==stack1||!1===stack1?stack1:stack1.total),"function"===_typeof2(stack1)?stack1.apply(depth0):stack1))+"</span>\n </span>\n <ul aria-label=\"",(helper=helpers.label)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.label,stack1="function"===_typeof2(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\" class=\"qti-navigator-items collapsible-panel plain\">\n ",stack1=helpers.each.call(depth0,depth0&&depth0.items,{hash:{},inverse:self.noop,fn:self.programWithDepth(10,program10,data,depth0),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n </ul>\n </li>\n ",buffer}function program10(depth0,data,depth1){var buffer="",stack1,helper;return buffer+="\n <li class=\"qti-navigator-item ",(helper=helpers.cls)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.cls,stack1="function"===_typeof2(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\" data-id=\"",(helper=helpers.id)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.id,stack1="function"===_typeof2(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\" data-position=\"",(helper=helpers.position)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.position,stack1="function"===_typeof2(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\">\n <span class=\"qti-navigator-label truncate\" title=\"",(helper=helpers.label)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.label,stack1="function"===_typeof2(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\"\n role=\"link\" aria-disabled=\"",stack1=helpers["if"].call(depth0,depth0&&depth0.viewed,{hash:{},inverse:self.program(13,program13,data),fn:self.program(11,program11,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\"\n ",stack1=helpers["if"].call(depth0,depth0&&depth0.active,{hash:{},inverse:self.noop,fn:self.program(15,program15,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n aria-label=\"",(helper=helpers.index)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.index,stack1="function"===_typeof2(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+" of "+escapeExpression((stack1=(stack1=depth1&&depth1.stats,null==stack1||!1===stack1?stack1:stack1.total),"function"===_typeof2(stack1)?stack1.apply(depth0):stack1))+" ",(helper=helpers.icon)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.icon,stack1="function"===_typeof2(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\">\n <span class=\"qti-navigator-icon icon-",(helper=helpers.icon)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.icon,stack1="function"===_typeof2(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\"></span>\n <span class=\"qti-navigator-number\">",(helper=helpers.index)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.index,stack1="function"===_typeof2(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"</span>\n ",(helper=helpers.label)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.label,stack1="function"===_typeof2(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\n </span>\n </li>\n ",buffer}function program11(){return"false"}function program13(){return"true"}function program15(){return"aria-current=\"page\""}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",helperMissing=helpers.helperMissing,escapeExpression=this.escapeExpression,self=this,stack1;return buffer+="<ul class=\"qti-navigator-parts plain\">\n ",stack1=helpers.each.call(depth0,depth0&&depth0.parts,{hash:{},inverse:self.noop,fn:self.program(1,program1,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n</ul>\n",buffer}),_defaults={scope:"test",canCollapse:!1,preventsUnseen:!0,hidden:!1},_cssCls={active:"active",collapsed:"collapsed",collapsible:"collapsible",hidden:"hidden",disabled:"disabled",flagged:"flagged",answered:"answered",viewed:"viewed",unseen:"unseen",info:"info",icon:"qti-navigator-icon",scope:{test:"scope-test",testPart:"scope-test-part",testSection:"scope-test-section"}},_iconCls=[_cssCls.info,_cssCls.flagged,_cssCls.answered,_cssCls.viewed],_selectors={component:".qti-navigator",filterBar:".qti-navigator-filters",filter:".qti-navigator-filter",tree:".qti-navigator-tree",collapseHandle:".qti-navigator-collapsible",linearState:".qti-navigator-linear",infoAnswered:".qti-navigator-answered .qti-navigator-counter",infoViewed:".qti-navigator-viewed .qti-navigator-counter",infoUnanswered:".qti-navigator-unanswered .qti-navigator-counter",infoFlagged:".qti-navigator-flagged .qti-navigator-counter",infoPanel:".qti-navigator-info",infoPanelLabels:".qti-navigator-info > .qti-navigator-label",tabInfoAll:"[data-mode=\"all\"] .qti-navigator-counter",tabInfoUnanswered:"[data-mode=\"unanswered\"] .qti-navigator-counter",tabInfoFlagged:"[data-mode=\"flagged\"] .qti-navigator-counter",parts:".qti-navigator-part",partLabels:".qti-navigator-part > .qti-navigator-label",sections:".qti-navigator-section",sectionLabels:".qti-navigator-section > .qti-navigator-label",items:".qti-navigator-item",itemLabels:".qti-navigator-item > .qti-navigator-label",itemIcons:".qti-navigator-item > .qti-navigator-icon",activeItem:".qti-navigator-item.active",icons:".qti-navigator-icon",linearStart:".qti-navigator-linear-part button",counters:".qti-navigator-counter",actives:".active",collapsible:".collapsible",collapsiblePanels:".collapsible-panel",unseen:".unseen",answered:".answered",flagged:".flagged",notFlagged:":not(.flagged)",notAnswered:":not(.answered)",notInformational:":not(.info)",informational:".info",hidden:".hidden",disabled:".disabled"},_filterMap={all:"",unanswered:[_selectors.answered,_selectors.informational].join(","),flagged:_selectors.notFlagged,answered:_selectors.notAnswered,filtered:_selectors.hidden},navigatorApi={updateStats:function(position,flag){var map=this.map,item;map&&(item=mapHelper.getItemAt(map,position),item&&(item.flagged=flag,mapHelper.updateItemStats(map,position)))},getProgressionTotal:function(progression,target){var total;return total="questions"===target?progression.questions:progression.total,total},setItemFlag:function(position,flag){var $item=position&&position.jquery?position:this.controls.$tree.find("[data-position=".concat(position,"]")),progression=this.progression,icon;this.updateStats(position,flag),$item.toggleClass(_cssCls.flagged,flag),icon=_.find(_iconCls,_.bind($item.hasClass,$item))||_cssCls.unseen,$item.find(_selectors.icons).attr("class","".concat(_cssCls.icon," icon-").concat(icon)),progression.flagged=this.controls.$tree.find(_selectors.flagged).length,this.writeCount(this.controls.$infoFlagged,progression.flagged,this.getProgressionTotal(progression,"questions")),this.filter(this.currentFilter)},filter:function(criteria){var self=this,$items=this.controls.$tree.find(_selectors.items).removeClass(_cssCls.hidden),filterCb=_filterMap[criteria];filterCb&&$items.filter(filterCb).addClass(_cssCls.hidden),this.controls.$tree.find(_selectors.sections).each(function(){var $section=$$1(this),$itemsFound=$section.find(_selectors.items).not(_selectors.hidden),$filtered=$itemsFound.not(_selectors.disabled);self.writeCount($section.find(_selectors.counters),$filtered.length,$itemsFound.length)}),this.currentFilter=criteria},updateConfig:function(config){var $component=this.getElement(),scopeClass=_cssCls.scope[this.config.scope||_defaults.scope];return config=_.merge(this.config,config||{}),$component.toggleClass(_cssCls.collapsible,config.canCollapse),$component.removeClass(scopeClass),scopeClass=_cssCls.scope[this.config.scope||_defaults.scope],$component.addClass(scopeClass),this},autoScroll:function(){autoscroll(this.controls.$tree.find(_selectors.activeItem),this.controls.$tree)},update:function(map,context){var scopedMap=this.getScopedMap(map,context),testPart=mapHelper.getPart(map,context.testPartId),progression=scopedMap.stats||{questions:0,answered:0,flagged:0,viewed:0,total:0},totalQuestions=this.getProgressionTotal(progression,"questions");if(this.map=map,this.progression=progression,this.writeCount(this.controls.$infoAnswered,progression.answered,totalQuestions),this.writeCount(this.controls.$infoUnanswered,totalQuestions-progression.answered,totalQuestions),this.writeCount(this.controls.$infoViewed,progression.viewed,this.getProgressionTotal(progression,"total")),this.writeCount(this.controls.$infoFlagged,progression.flagged,totalQuestions),this.writeCount(this.controls.$infoAll,totalQuestions,null),!testPart.isLinear){this.controls.$filterBar.show(),this.controls.$linearState.hide(),this.controls.$tree.html(navigatorTreeTpl(scopedMap)),this.autoScroll();var activeItem=mapHelper.getActiveItem(scopedMap);this.setState("prevents-unseen",this.config.preventsUnseen);var isSkipaheadEnabled=activeItem&&activeItem.categories&&0<=_.indexOf(activeItem.categories,"x-tao-option-review-skipahead");this.setState("skipahead-enabled",isSkipaheadEnabled),this.config.preventsUnseen&&!isSkipaheadEnabled&&this.controls.$tree.find(_selectors.unseen).addClass(_cssCls.disabled)}else this.controls.$filterBar.hide(),this.controls.$linearState.show(),this.controls.$tree.empty();return this.filter(this.controls.$filters.filter(_selectors.actives).data("mode")),this.trigger("update"),this},getScopedMap:function(map,context){var scopedMap=mapHelper.getScopeMapFromContext(map,context,this.config.scope),testPart=mapHelper.getPart(scopedMap,context.testPartId)||{},section=mapHelper.getSection(scopedMap,context.sectionId)||{},item=mapHelper.getItem(scopedMap,context.itemIdentifier)||{};return testPart.active=!0,section.active=!0,item.active=!0,mapHelper.each(scopedMap,function(itm){var cls=[],icon="";itm.active&&cls.push("active"),itm.informational&&(cls.push("info"),icon=icon||"info"),itm.flagged&&(cls.push("flagged"),icon=icon||"flagged"),itm.answered&&(cls.push("answered"),icon=icon||"answered"),itm.viewed?(cls.push("viewed"),icon=icon||"viewed"):(cls.push("unseen"),icon=icon||"unseen"),itm.cls=cls.join(" "),itm.icon=icon})},writeCount:function($place,count,total){var display=0;$place.parent().hasClass("qti-navigator-tab")?display=Math.max(count,0):0<total&&(display="".concat(Math.min(count,total),"/").concat(total)),$place.text(display)},select:function(position,open){var $tree=this.controls.$tree,selected=position&&position.jquery?position:$tree.find("[data-position=".concat(position,"]")),hierarchy=selected.parentsUntil($tree),previousPosition=0,$previous=$tree.find(_selectors.activeItem);return $previous.length&&(previousPosition=$previous.data("position")),open&&this.openOnly(hierarchy),$tree.find(_selectors.actives).removeClass(_cssCls.active),hierarchy.add(selected).addClass(_cssCls.active),position=selected.data("position"),this.trigger("selected",position,previousPosition),selected},openSelected:function(){var $tree=this.controls.$tree,selected=$tree.find(_selectors.items+_selectors.actives),hierarchy=selected.parentsUntil($tree);return this.openOnly(hierarchy),selected},openOnly:function(opened,root){(root||this.controls.$tree).find(_selectors.collapsible).addClass(_cssCls.collapsed),opened.removeClass(_cssCls.collapsed)},togglePanel:function(panel,collapseSelector){var collapsed=panel.hasClass(_cssCls.collapsed);return collapseSelector&&this.controls.$tree.find(collapseSelector).addClass(_cssCls.collapsed),collapsed?panel.removeClass(_cssCls.collapsed):panel.addClass(_cssCls.collapsed),collapsed},toggle:function(show){return"undefined"==typeof show&&(show=this.is("hidden")),show?this.show():this.hide(),this}};return navigatorFactory}),define("taoQtiTest/runner/plugins/navigation/review/review",["lodash","i18n","ui/hider","util/shortcut","util/namespace","taoTests/runner/plugin","taoQtiTest/runner/helpers/map","taoQtiTest/runner/plugins/navigation/review/navigator"],function(_,__,hider,shortcut,namespaceHelper,pluginFactory,mapHelper,navigatorFactory){'use strict';function getFlagItemButtonData(flag){var dataType=flag?"unsetFlag":"setFlag";return buttonData[dataType]}function isItemFlagged(testMap,position){var item=mapHelper.getItemAt(testMap,position);return!!item.flagged}function getToggleButtonData(navigator){var dataType=navigator.is("hidden")?"showReview":"hideReview";return buttonData[dataType]}function updateButton(button,data){var $button=button.getElement();button.is("rendered")&&$button.data("control")!==data.control&&($button.data("control",data.control).attr("title",data.title),$button.find(".icon").attr("class","icon icon-".concat(data.icon)),$button.find(".text").text(data.text),_.contains(data.control,"flag")&&(button.is("active")?button.turnOff():button.turnOn()))}function canFlag(testRunner){var testContext=testRunner.getTestContext(),testMap=testRunner.getTestMap(),item=testRunner.getCurrentItem(),testPart=testRunner.getCurrentPart(),markReviewCategory=mapHelper.hasItemCategory(testMap,testContext.itemIdentifier,"markReview",!0);return!(testPart.isLinear||!markReviewCategory||item&&item.informational)}_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,__=__&&Object.prototype.hasOwnProperty.call(__,"default")?__["default"]:__,shortcut=shortcut&&Object.prototype.hasOwnProperty.call(shortcut,"default")?shortcut["default"]:shortcut,namespaceHelper=namespaceHelper&&Object.prototype.hasOwnProperty.call(namespaceHelper,"default")?namespaceHelper["default"]:namespaceHelper,pluginFactory=pluginFactory&&Object.prototype.hasOwnProperty.call(pluginFactory,"default")?pluginFactory["default"]:pluginFactory,mapHelper=mapHelper&&Object.prototype.hasOwnProperty.call(mapHelper,"default")?mapHelper["default"]:mapHelper,navigatorFactory=navigatorFactory&&Object.prototype.hasOwnProperty.call(navigatorFactory,"default")?navigatorFactory["default"]:navigatorFactory;var buttonData={setFlag:{control:"set-item-flag",title:__("Flag the current item for later review"),icon:"anchor",text:__("Flag for Review")},unsetFlag:{control:"unset-item-flag",title:__("Do not flag the current item for later review"),icon:"anchor",text:__("Unflag for Review")},showReview:{control:"show-review",title:__("Show the review screen"),icon:"right",text:__("Show Review")},hideReview:{control:"hide-review",title:__("Hide the review screen"),icon:"left",text:__("Hide Review")}},review=pluginFactory({name:"review",init:function(){function getReviewCategories(){var currentContext=testRunner.getTestContext(),currentMap=testRunner.getTestMap();return{reviewScreen:mapHelper.hasItemCategory(currentMap,currentContext.itemIdentifier,"reviewScreen",!0),markReview:mapHelper.hasItemCategory(currentMap,currentContext.itemIdentifier,"markReview",!0)}}function isPluginAllowed(){var categories=getReviewCategories();return navigatorConfig.enabled&&categories.reviewScreen}function flagItem(position,flag){return self.disable(),testRunner.getProxy().callTestAction("flagItem",{position:position,flag:flag}).then(function(){var item=mapHelper.getItemAt(testRunner.getTestMap(),position);item.flagged=flag,updateButton(self.flagItemButton,getFlagItemButtonData(flag)),self.navigator.setItemFlag(position,flag),self.enable()}).catch(function(){self.navigator.setItemFlag(position,!flag),self.enable()})}function flagCurrentItem(){if(!1!==self.getState("enabled")){var itemPosition=testRunner.getTestContext().itemPosition,flagStatus=isItemFlagged(testRunner.getTestMap(),itemPosition);flagItem(itemPosition,!flagStatus)}}function togglePanel(forcedState){var isHidden=_.isUndefined(forcedState)?self.navigator.is("hidden"):forcedState;isHidden?(self.explicitlyHidden=!1,self.navigator.show()):(self.explicitlyHidden=!0,self.navigator.hide()),updateButton(self.toggleButton,getToggleButtonData(self.navigator))}var self=this,testRunner=this.getTestRunner(),testContext=testRunner.getTestContext(),testMap=testRunner.getTestMap(),testRunnerOptions=testRunner.getOptions(),pluginShortcuts=(testRunnerOptions.shortcuts||{})[this.getName()]||{},navigatorConfig=testRunnerOptions.review||{defaultOpen:!1},previousItemPosition;this.navigator=navigatorFactory(navigatorConfig,testMap,testContext).on("selected",function(position,previousPosition){previousItemPosition=previousPosition}).on("jump",function(position){!1!==self.getState("enabled")&&(self.disable(),testRunner.jump(position,"item"))}).on("flag",function(position,flag){!1!==self.getState("enabled")&&flagItem(position,flag)}).render(),testRunner.on("alert.notallowed",function(){self.navigator.select(previousItemPosition)}),this.explicitlyHidden=!1,this.toggleButton=this.getAreaBroker().getToolbox().createEntry(getToggleButtonData(this.navigator)),this.toggleButton.on("click",function(e){e.preventDefault(),testRunner.trigger("tool-reviewpanel")}),this.flagItemButton=this.getAreaBroker().getToolbox().createEntry(getFlagItemButtonData(isItemFlagged(testMap,testContext.itemPosition))),this.flagItemButton.on("click",function(e){e.preventDefault(),testRunner.trigger("tool-flagitem")}),testRunnerOptions.allowShortcuts&&(pluginShortcuts.flag&&shortcut.add(namespaceHelper.namespaceAll(pluginShortcuts.flag,this.getName(),!0),function(){testRunner.trigger("tool-flagitem")},{avoidInput:!0}),pluginShortcuts.toggle&&shortcut.add(namespaceHelper.namespaceAll(pluginShortcuts.toggle,this.getName(),!0),function(){testRunner.trigger("tool-reviewpanel")},{avoidInput:!0})),isPluginAllowed()||this.hide(),this.disable(),togglePanel(navigatorConfig.defaultOpen),testRunner.on("render",function(){isPluginAllowed()?(self.show(),updateButton(self.toggleButton,getToggleButtonData(self.navigator))):self.hide()}).on("loaditem",function(){var context=testRunner.getTestContext(),map=testRunner.getTestMap(),testPart=testRunner.getCurrentPart(),categories=getReviewCategories();isPluginAllowed()?(updateButton(self.flagItemButton,getFlagItemButtonData(isItemFlagged(map,context.itemPosition))),self.navigator.update(map,context).updateConfig({canFlag:!testPart.isLinear&&categories.markReview}),self.show(),updateButton(self.toggleButton,getToggleButtonData(self.navigator))):self.hide()}).on("enabletools enablenav",function(){isPluginAllowed()&&self.enable()}).on("disabletools disablenav",function(){isPluginAllowed()&&self.disable()}).on("hidenav",function(){self.hide()}).on("shownav",function(){isPluginAllowed()&&self.show()}).on("tool-flagitem",function(){isPluginAllowed()&&canFlag(testRunner)&&flagCurrentItem()}).on("tool-reviewpanel",function(){isPluginAllowed()&&self.getState("enabled")&&togglePanel()})},render:function(){var areaBroker=this.getAreaBroker(),$panelContainer=areaBroker.getPanelArea();$panelContainer.append(this.navigator.getElement())},destroy:function(){shortcut.remove(".".concat(this.getName())),this.navigator.destroy()},enable:function(){var testRunner=this.getTestRunner(),testContext=testRunner.getTestContext(),testMap=testRunner.getTestMap();this.flagItemButton.enable(),this.toggleButton.enable(),this.navigator.enable(),isItemFlagged(testMap,testContext.itemPosition)?this.flagItemButton.turnOn():this.flagItemButton.turnOff()},disable:function(){this.flagItemButton.disable(),this.flagItemButton.turnOff(),this.toggleButton.disable(),this.navigator.disable()},show:function(){var testRunner=this.getTestRunner();canFlag(testRunner)?this.flagItemButton.show():this.flagItemButton.hide(),this.toggleButton.show(),this.explicitlyHidden?this.navigator.hide():this.navigator.show()},hide:function(){this.flagItemButton.hide(),this.toggleButton.hide(),this.navigator.hide()}});return review}),define("taoQtiTest/runner/plugins/navigation/skip",["jquery","i18n","ui/hider","taoTests/runner/plugin","taoQtiTest/runner/helpers/messages","handlebars","taoQtiTest/runner/helpers/navigation","taoQtiTest/runner/helpers/map"],function($$1,__,hider,pluginFactory,messages,Handlebars,navigationHelper,mapHelper){'use strict';function buttonTpl(data,options,asString){var html=Template(data,options);return asString||!0?html:$(html)}$$1=$$1&&Object.prototype.hasOwnProperty.call($$1,"default")?$$1["default"]:$$1,__=__&&Object.prototype.hasOwnProperty.call(__,"default")?__["default"]:__,hider=hider&&Object.prototype.hasOwnProperty.call(hider,"default")?hider["default"]:hider,pluginFactory=pluginFactory&&Object.prototype.hasOwnProperty.call(pluginFactory,"default")?pluginFactory["default"]:pluginFactory,messages=messages&&Object.prototype.hasOwnProperty.call(messages,"default")?messages["default"]:messages,Handlebars=Handlebars&&Object.prototype.hasOwnProperty.call(Handlebars,"default")?Handlebars["default"]:Handlebars,navigationHelper=navigationHelper&&Object.prototype.hasOwnProperty.call(navigationHelper,"default")?navigationHelper["default"]:navigationHelper,mapHelper=mapHelper&&Object.prototype.hasOwnProperty.call(mapHelper,"default")?mapHelper["default"]:mapHelper;var Template=Handlebars.template(function(Handlebars,depth0,helpers,partials,data){function program1(depth0,data){var buffer="",stack1,helper;return buffer+=" ",(helper=helpers.className)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.className,stack1="function"===_typeof2(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1),buffer}function program3(depth0,data){var buffer="",stack1;return buffer+="\n aria-"+escapeExpression((stack1=null==data||!1===data?data:data.key,"function"===_typeof2(stack1)?stack1.apply(depth0):stack1))+"=\""+escapeExpression("function"===_typeof2(depth0)?depth0.apply(depth0):depth0)+"\"\n ",buffer}function program5(depth0,data){var buffer="",stack1,helper;return buffer+="<span class=\"icon icon-",(helper=helpers.icon)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.icon,stack1="function"===_typeof2(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1),stack1=helpers.unless.call(depth0,depth0&&depth0.text,{hash:{},inverse:self.noop,fn:self.program(6,program6,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\"></span>",buffer}function program6(){return" no-label"}function program8(depth0,data){var buffer="",stack1,helper;return buffer+="<span class=\"text\">",(helper=helpers.text)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.text,stack1="function"===_typeof2(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"</span>",buffer}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,self=this,stack1,helper;return buffer+="<li\n data-control=\"",(helper=helpers.control)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.control,stack1="function"===_typeof2(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\"\n class=\"small btn-info action",stack1=helpers["if"].call(depth0,depth0&&depth0.className,{hash:{},inverse:self.noop,fn:self.program(1,program1,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\"\n title=\"",(helper=helpers.title)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.title,stack1="function"===_typeof2(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\"\n role=\"button\"\n ",stack1=helpers.each.call(depth0,depth0&&depth0.aria,{hash:{},inverse:self.noop,fn:self.program(3,program3,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n>\n <a class=\"li-inner\" href=\"#\" onclick=\"return false\" aria-hidden=\"true\" >\n ",stack1=helpers["if"].call(depth0,depth0&&depth0.icon,{hash:{},inverse:self.noop,fn:self.program(5,program5,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n ",stack1=helpers["if"].call(depth0,depth0&&depth0.text,{hash:{},inverse:self.noop,fn:self.program(8,program8,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n </a>\n</li>\n",buffer}),buttonData={skip:{control:"skip",title:__("Skip and go to the next item"),icon:"external",text:__("Skip")},end:{control:"skip-end",title:__("Skip and go to the end of the test"),icon:"external",text:__("Skip and end test")}},createElement=function(testRunner){var testContext=testRunner.getTestContext(),testMap=testRunner.getTestMap(),isLast=navigationHelper.isLast(testMap,testContext.itemIdentifier),dataType=isLast?"end":"skip";return $$1(buttonTpl(buttonData[dataType]))},updateElement=function($element){var isLast=!!(1<arguments.length&&arguments[1]!==void 0)&&arguments[1],dataType=isLast?"end":"skip",button=buttonData[dataType];button&&$element.attr("data-control")!==button.control&&$element.attr("data-control",button.control).attr("title",button.title).find(".text").text(button.text)},skip=pluginFactory({name:"skip",init:function(){function doSkip(){testRunner.skip()}var _this=this,testRunner=this.getTestRunner(),toggle=function(){var testContext=testRunner.getTestContext();return!0===testContext.allowSkipping?(_this.show(),!0):(_this.hide(),!1)};this.$element=createElement(testRunner),this.$element.on("click",function(e){var enable=_this.enable.bind(_this),testContext=testRunner.getTestContext(),testMap=testRunner.getTestMap(),isLast=navigationHelper.isLast(testMap,testContext.itemIdentifier),endTestWarning=mapHelper.hasItemCategory(testMap,testContext.itemIdentifier,"endTestWarning",!0);e.preventDefault(),!1!==_this.getState("enabled")&&(_this.disable(),endTestWarning&&isLast?testRunner.trigger("confirm.endTest",messages.getExitMessage("test",testRunner),doSkip,enable):doSkip())}),toggle(),this.disable(),testRunner.on("loaditem",function(){if(toggle()){var testContext=testRunner.getTestContext(),testMap=testRunner.getTestMap(),isLast=navigationHelper.isLast(testMap,testContext.itemIdentifier);updateElement(_this.$element,isLast)}}).on("enablenav",function(){return _this.enable()}).on("disablenav",function(){return _this.disable()}).on("hidenav",function(){return _this.hide()}).on("shownav",function(){return _this.show()})},render:function(){var $container=this.getAreaBroker().getNavigationArea();$container.append(this.$element)},destroy:function(){this.$element.remove()},enable:function(){this.$element.removeProp("disabled").removeClass("disabled")},disable:function(){this.$element.prop("disabled",!0).addClass("disabled")},show:function(){hider.show(this.$element)},hide:function(){hider.hide(this.$element)}});return skip}),define("taoQtiTest/runner/plugins/navigation/validateResponses",["lodash","i18n","taoTests/runner/plugin","taoQtiTest/runner/helpers/currentItem"],function(_,__,pluginFactory,currentItemHelper){'use strict';_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,__=__&&Object.prototype.hasOwnProperty.call(__,"default")?__["default"]:__,pluginFactory=pluginFactory&&Object.prototype.hasOwnProperty.call(pluginFactory,"default")?pluginFactory["default"]:pluginFactory,currentItemHelper=currentItemHelper&&Object.prototype.hasOwnProperty.call(currentItemHelper,"default")?currentItemHelper["default"]:currentItemHelper;var validateResponses=pluginFactory({name:"validateResponses",init:function(){var testRunner=this.getTestRunner(),testRunnerOptions=testRunner.getOptions(),pluginConfig=this.getConfig();return testRunner.before("move",function(e,direction){var testContext=testRunner.getTestContext(),isInteracting=!testRunner.getItemState(testContext.itemIdentifier,"disabled");if(!pluginConfig.validateOnPreviousMove&&"previous"===direction)return Promise.resolve();if(isInteracting&&testRunnerOptions.enableValidateResponses){var currenItem=testRunner.getCurrentItem(),validateResponses="boolean"==typeof currenItem.validateResponses?currenItem.validateResponses:testContext.validateResponses;if(validateResponses)return new Promise(function(resolve,reject){return 0===_.size(currentItemHelper.getDeclarations(testRunner))?resolve():currentItemHelper.isAnswered(testRunner,!1)?resolve():void(!testRunner.getState("alerted.notallowed")&&(testRunner.setState("alerted.notallowed",!0),testRunner.trigger("alert.notallowed",__("A valid response to this item is required."),function(){testRunner.trigger("resumeitem"),reject(),testRunner.setState("alerted.notallowed",!1)})))})}}),this}});return validateResponses}),define("taoQtiTest/runner/plugins/navigation/warnBeforeLeaving",["i18n","taoTests/runner/plugin"],function(__,pluginFactory){'use strict';__=__&&Object.prototype.hasOwnProperty.call(__,"default")?__["default"]:__,pluginFactory=pluginFactory&&Object.prototype.hasOwnProperty.call(pluginFactory,"default")?pluginFactory["default"]:pluginFactory;var warnMessage=__("Please confirm you want to leave the test."),warnListener=function(e){return e.returnValue=warnMessage,warnMessage},warnBeforeLeaving=pluginFactory({name:"warnBeforeLeaving",init:function(){this.enable()},destroy:function(){this.disable()},enable:function(){window.addEventListener("beforeunload",warnListener)},disable:function(){window.removeEventListener("beforeunload",warnListener)}});return warnBeforeLeaving}),define("taoQtiTest/runner/plugins/security/disableRightClick",["taoTests/runner/plugin"],function(pluginFactory){'use strict';pluginFactory=pluginFactory&&Object.prototype.hasOwnProperty.call(pluginFactory,"default")?pluginFactory["default"]:pluginFactory;var disableRightClick=pluginFactory({name:"disableRightClick",init:function(){["contextmenu","mousedown","mouseup"].forEach(function(eventName){window.document.addEventListener(eventName,function(event){2===event.button&&event.preventDefault()})})}});return disableRightClick}),define("taoQtiTest/runner/plugins/tools/answerElimination/eliminator",["lodash","i18n","ui/hider","util/shortcut","util/namespace","taoQtiTest/runner/helpers/map","taoTests/runner/plugin"],function(_,__,hider,shortcut,namespaceHelper,mapHelper,pluginFactory){'use strict';_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,__=__&&Object.prototype.hasOwnProperty.call(__,"default")?__["default"]:__,shortcut=shortcut&&Object.prototype.hasOwnProperty.call(shortcut,"default")?shortcut["default"]:shortcut,namespaceHelper=namespaceHelper&&Object.prototype.hasOwnProperty.call(namespaceHelper,"default")?namespaceHelper["default"]:namespaceHelper,mapHelper=mapHelper&&Object.prototype.hasOwnProperty.call(mapHelper,"default")?mapHelper["default"]:mapHelper,pluginFactory=pluginFactory&&Object.prototype.hasOwnProperty.call(pluginFactory,"default")?pluginFactory["default"]:pluginFactory;var actionPrefix="tool-".concat("eliminator","-"),defaultConfig={removeEliminationsOnClose:!1,restoreEliminationsOnOpen:!1},eliminator=pluginFactory({name:"eliminator",init:function(){function isPluginEnabled(){return mapHelper.hasItemCategory(testRunner.getTestMap(),testRunner.getTestContext().itemIdentifier,"eliminator",!0)}function togglePlugin(){self.$choiceInteractions&&(self.$choiceInteractions.toggleClass("eliminable"),isEliminable()?enableEliminator():disableEliminator())}function isEliminable(){return self.$choiceInteractions?self.$choiceInteractions.hasClass("eliminable"):void 0}function enableEliminator(){var $choices;self.$choiceInteractions&&($choices=self.$choiceInteractions.find(".qti-choice"),self.button.turnOn(),self.trigger("start"),config.restoreEliminationsOnOpen&&$choices.each(function(){var input=this.querySelector(".real-label input");this.dataset.wasEliminated&&(this.dataset.wasEliminated=null,this.classList.add("eliminated"),input.setAttribute("disabled","disabled"),input.checked=!1)}))}function disableEliminator(){var $choices;self.$choiceInteractions&&($choices=self.$choiceInteractions.find(".qti-choice"),self.$choiceInteractions.removeClass("eliminable"),self.button.turnOff(),self.trigger("end"),$choices.each(function(){this.classList.contains("eliminated")&&(this.dataset.wasEliminated=!0,this.classList.remove("eliminated"),this.querySelector(".real-label input").removeAttribute("disabled"))}))}var self=this,testRunner=this.getTestRunner(),$container=testRunner.getAreaBroker().getContentArea().parent(),testRunnerOptions=testRunner.getOptions(),pluginShortcuts=(testRunnerOptions.shortcuts||{}).eliminator||{},config=Object.assign({},defaultConfig,this.getConfig());this.button=this.getAreaBroker().getToolbox().createEntry({control:"eliminator",title:__("Eliminate choices"),icon:"eliminate",text:__("Answer Eliminator")}),this.button.on("click",function(e){e.preventDefault(),testRunner.trigger("".concat(actionPrefix,"toggle"))}),testRunnerOptions.allowShortcuts&&_.forEach(pluginShortcuts,function(command,key){shortcut.add(namespaceHelper.namespaceAll(command,"eliminator",!0),function(){testRunner.trigger(actionPrefix+key)},{avoidInput:!0})}),this.disable(),testRunner.on("loaditem",function(){isPluginEnabled()?self.show():self.hide()}).on("renderitem",function(){return self.$choiceInteractions=$container.find(".qti-choiceInteraction"),self.$choiceInteractions.length?void(isPluginEnabled()&&self.show()):void self.hide()}).on("enabletools renderitem",function(){self.enable()}).on("disabletools unloaditem",function(){self.disable(),disableEliminator()}).on("".concat(actionPrefix,"toggle"),function(){isPluginEnabled()&&togglePlugin()}).on("tool-answer-masking-toggle",function(){isEliminable()&&disableEliminator()})},destroy:function(){shortcut.remove(".".concat("eliminator"))},enable:function(){this.button.enable()},disable:function(){this.button.disable()},show:function(){this.button.show()},hide:function(){this.button.hide()}});return eliminator}),define("taoQtiTest/runner/plugins/tools/answerMasking/answerMasking",["lodash","jquery","core/statifier","ui/component","handlebars"],function(_,$$1,statifier,componentFactory,Handlebars){'use strict';function maskTpl(data,options,asString){var html=Template(data,options);return asString||!0?html:$(html)}function answerMaskingFactory($contentArea){function createMask($container){return componentFactory(maskApi).setTemplate(maskTpl).on("render",function(){var self=this,$component=this.getElement();$component.on("click".concat(".answerMasking"),function(e){e.stopPropagation(),e.preventDefault(),self.toggle()})}).on("destroy",function(){var $component=this.getElement();$component.off(".answerMasking")}).init().render($container).mask()}var allMasks=[],maskApi={toggle:function(){return this.is("masked")?this.reveal():this.mask()},reveal:function(){var $container=this.getContainer();return $container.removeClass("masked"),$container.find("input").removeAttr("disabled"),this.setState("masked",!1),this},mask:function(){var $container=this.getContainer();return $container.addClass("masked"),$container.find("input").attr("disabled","disabled"),this.setState("masked",!0),this}},answerMasking;return answerMasking={enable:function(){var $choiceInteractions=$contentArea.find(".qti-choiceInteraction"),$qtiChoices=$contentArea.find(".qti-choice");allMasks=[],$choiceInteractions.addClass("maskable"),$qtiChoices.each(function(){var $choice=$$1(this);allMasks.push(createMask($choice))}),this.setState("enabled",!0)},disable:function(){var $choiceInteractions=$contentArea.find(".qti-choiceInteraction");$choiceInteractions.removeClass("maskable"),allMasks.forEach(function(mask){mask.reveal(),mask.destroy()}),allMasks=[],this.setState("enabled",!1)},getMasksState:function(){var state=allMasks.map(function(mask){return mask.is("masked")});return state},setMasksState:function(state){state=state||[],state.forEach(function(masked,index){var mask=allMasks[index];_.isObject(mask)&&_.isFunction(mask.reveal)&&!masked&&mask.reveal()})}},statifier(answerMasking),answerMasking}_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,$$1=$$1&&Object.prototype.hasOwnProperty.call($$1,"default")?$$1["default"]:$$1,statifier=statifier&&Object.prototype.hasOwnProperty.call(statifier,"default")?statifier["default"]:statifier,componentFactory=componentFactory&&Object.prototype.hasOwnProperty.call(componentFactory,"default")?componentFactory["default"]:componentFactory,Handlebars=Handlebars&&Object.prototype.hasOwnProperty.call(Handlebars,"default")?Handlebars["default"]:Handlebars;var Template=Handlebars.template(function(Handlebars,depth0,helpers){return this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),"<div class=\"answer-mask\">\n <span class=\"answer-mask-toggle\"></span>\n</div>"});return answerMaskingFactory}),define("taoQtiTest/runner/plugins/tools/answerMasking/plugin",["i18n","taoTests/runner/plugin","ui/hider","util/shortcut","util/namespace","taoQtiTest/runner/helpers/map","taoQtiTest/runner/plugins/tools/answerMasking/answerMasking"],function(__,pluginFactory,hider,shortcut,namespaceHelper,mapHelper,answerMaskingFactory){'use strict';__=__&&Object.prototype.hasOwnProperty.call(__,"default")?__["default"]:__,pluginFactory=pluginFactory&&Object.prototype.hasOwnProperty.call(pluginFactory,"default")?pluginFactory["default"]:pluginFactory,shortcut=shortcut&&Object.prototype.hasOwnProperty.call(shortcut,"default")?shortcut["default"]:shortcut,namespaceHelper=namespaceHelper&&Object.prototype.hasOwnProperty.call(namespaceHelper,"default")?namespaceHelper["default"]:namespaceHelper,mapHelper=mapHelper&&Object.prototype.hasOwnProperty.call(mapHelper,"default")?mapHelper["default"]:mapHelper,answerMaskingFactory=answerMaskingFactory&&Object.prototype.hasOwnProperty.call(answerMaskingFactory,"default")?answerMaskingFactory["default"]:answerMaskingFactory;var actionPrefix="tool-".concat("answer-masking","-"),itemStates={},defaultConfig={restoreStateOnToggle:!0,restoreStateOnMove:!0},plugin=pluginFactory({name:"answer-masking",init:function(){function isPluginEnabled(){var answerMaskingCategory=mapHelper.hasItemCategory(testRunner.getTestMap(),testRunner.getTestContext().itemIdentifier,"answerMasking",!0);return answerMaskingCategory&&itemContainsChoiceInteraction()}function itemContainsChoiceInteraction(){var $container=self.getAreaBroker().getContentArea().parent();return $container.find(".qti-choiceInteraction").length}function togglePluginButton(){isPluginEnabled()?self.show():self.hide()}function togglePlugin(){answerMasking.getState("enabled")?disableMasking():enableMasking()}function enableMasking(){var testContext=testRunner.getTestContext(),itemId=testContext.itemIdentifier;answerMasking.enable(),pluginConfig.restoreStateOnToggle&&answerMasking.setMasksState(itemStates[itemId]),self.button.turnOn(),self.trigger("start")}function disableMasking(){var testContext=testRunner.getTestContext(),itemId=testContext.itemIdentifier;answerMasking.getState("enabled")&&(itemStates[itemId]=answerMasking.getMasksState()),answerMasking.disable(),self.button.turnOff(),self.trigger("end")}var self=this,testRunner=this.getTestRunner(),testRunnerOptions=testRunner.getOptions(),pluginConfig=Object.assign({},defaultConfig,this.getConfig()),pluginShortcuts=(testRunnerOptions.shortcuts||{})["answer-masking"]||{},$contentArea=this.getAreaBroker().getContentArea(),answerMasking=answerMaskingFactory($contentArea);this.button=this.getAreaBroker().getToolbox().createEntry({title:__("Answer Masking"),icon:"result-nok",control:"answer-masking",text:__("Answer Masking")}),this.button.on("click",function(e){e.preventDefault(),testRunner.trigger("".concat(actionPrefix,"toggle"))}),testRunnerOptions.allowShortcuts&&pluginShortcuts.toggle&&shortcut.add(namespaceHelper.namespaceAll(pluginShortcuts.toggle,this.getName(),!0),function(){testRunner.trigger("".concat(actionPrefix,"toggle"))},{avoidInput:!0,prevent:!0}),this.disable(),testRunner.on("loaditem",function(){var testContext=testRunner.getTestContext(),itemId=testContext.itemIdentifier;pluginConfig.restoreStateOnMove||(itemStates[itemId]=[]),togglePluginButton()}).on("enabletools renderitem",function(){togglePluginButton(),self.enable()}).on("beforeunloaditem",function(){disableMasking()}).on("disabletools unloaditem",function(){self.disable(),disableMasking()}).on("".concat(actionPrefix,"toggle"),function(){isPluginEnabled()&&togglePlugin()}).on("tool-eliminator-toggle",function(){disableMasking()})},destroy:function(){shortcut.remove(".".concat(this.getName()))},enable:function(){this.button.enable()},disable:function(){this.button.disable()},show:function(){this.button.show()},hide:function(){this.button.hide()}});return plugin}),define("taoQtiTest/runner/plugins/tools/apipTextToSpeech/textToSpeech",["jquery","i18n","handlebars","ui/component","interact","ui/component/stackable","ui/component/placeable","ui/feedback","nouislider"],function($$1,__,Handlebars,component,interact,makeStackable,makePlaceable,feedback){'use strict';function _toConsumableArray(arr){return _arrayWithoutHoles(arr)||_iterableToArray(arr)||_unsupportedIterableToArray(arr)||_nonIterableSpread()}function _arrayWithoutHoles(arr){if(Array.isArray(arr))return _arrayLikeToArray(arr)}function _iterableToArray(iter){if("undefined"!=typeof Symbol&&null!=iter[Symbol.iterator]||null!=iter["@@iterator"])return Array.from(iter)}function _unsupportedIterableToArray(o,minLen){if(o){if("string"==typeof o)return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);return"Object"===n&&o.constructor&&(n=o.constructor.name),"Map"===n||"Set"===n?Array.from(o):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(o,minLen):void 0}}function _arrayLikeToArray(arr,len){(null==len||len>arr.length)&&(len=arr.length);for(var i=0,arr2=Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _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 ttsTemplate(data,options,asString){var html=Template(data,options);return asString||!0?html:$(html)}function maskingComponentFactory(container,config){var audio=new Audio,currentPlayback=[],mediaContentData=[],selection=window.getSelection&&window.getSelection(),ttsComponent=component({clearAPIPElements:function(){var elementClass=this.config.elementClass,$contentNodes=$$1(mediaContentData.map(function(_ref){var selector=_ref.selector;return selector}).join(", "),container);$contentNodes.removeClass(elementClass),$contentNodes.off("click",this.handleContentNodeClick)},close:function(){this.setTTSStateOnContainer("playing",!1),this.setTTSStateOnContainer("sfhMode",!1),this.setState("settings",!1),this.stop(),this.trigger("close")},getCurrentItem:function(){return currentItem},handleContentNodeClick:function(e){var $target=$$1(e.target);if(!($target.hasClass("icon-checkbox")||$target.hasClass("icon-radio")||$target.is("input"))&&(e.stopPropagation(),e.preventDefault(),!!this.is("sfhMode"))){var $currentTarget=$$1(e.currentTarget),selectedItemIndex=mediaContentData.findIndex(function(_ref2){var selector=_ref2.selector;return $currentTarget.is(selector)});currentPlayback=mediaContentData.slice(selectedItemIndex),this.stop(),this.initNextItem(),this.togglePlayback()}},initDefaultModeItem:function(){this.initItemWithTextSelection(),currentItem||this.initDefaultModePlayback()},initItemWithTextSelection:function(){if(!this.is("sfhMode")&&selection&&selection.toString()){var currentSelection=selection.getRangeAt(0),commonAncestorContainer=currentSelection.commonAncestorContainer,selectedItem=mediaContentData.find(function(_ref3){var selector=_ref3.selector,$item=$$1(selector,container);return $item.is(commonAncestorContainer)||$$1.contains($item[0],commonAncestorContainer)});selectedItem&&selectedItem!==currentItem&&(currentPlayback=[selectedItem],this.initNextItem())}},initNextItem:function(){var activeElementClass=this.config.activeElementClass;if(currentItem&&$$1(currentItem.selector,container).removeClass(activeElementClass),currentItem=currentPlayback.shift(),currentItem){var _currentItem=currentItem,selector=_currentItem.selector,url=_currentItem.url;return $$1(selector,container).addClass(activeElementClass),audio.setAttribute("src",url),audio.load(),audio.playbackRate=playbackRate,this.is("playing")&&audio.play(),void this.trigger("next")}this.trigger("finish"),this.stop()},initDefaultModePlayback:function(){currentPlayback=_toConsumableArray(mediaContentData),this.initNextItem()},setMediaContentData:function(data){this.clearAPIPElements();var elementClass=this.config.elementClass;mediaContentData=data;var $contentNodes=$$1(mediaContentData.map(function(_ref4){var selector=_ref4.selector;return selector}).join(", "),container);$contentNodes.addClass(elementClass),$contentNodes.on("click",this.handleContentNodeClick),this.stop()},setPlaybackRate:function(e,value){playbackRate=value,audio.playbackRate=value},setTTSStateOnContainer:function(name,value){this.setState(name,value),$$1(container).toggleClass("tts-".concat(name),value)},stop:function(){var activeElementClass=this.config.activeElementClass;audio.pause(),audio.currentTime=0,currentItem&&$$1(currentItem.selector,container).removeClass(activeElementClass),currentItem=null,this.setTTSStateOnContainer("playing",!1)},togglePlayback:function(e){e&&e.preventDefault();var isPlaying=this.is("playing");this.initDefaultModeItem(),!isPlaying&&currentItem?(audio.play(),this.setTTSStateOnContainer("playing",!0)):(audio.pause(),this.setTTSStateOnContainer("playing",!1))},toggleSFHMode:function(){var isSFHMode=this.is("sfhMode");this.setTTSStateOnContainer("sfhMode",!isSFHMode),this.stop()},toggleSettings:function(){var isSettings=this.is("settings");this.setState("settings",!isSettings),isSettings||this.handleResize()},handleResize:function(){var _this$getPosition=this.getPosition(),x=_this$getPosition.x,y=_this$getPosition.y,maxXPosition=window.innerWidth-this.getElement().width()-10;this.moveTo(x>maxXPosition?maxXPosition:x,y)}},defaultConfig),currentItem,playbackRate;return makePlaceable(ttsComponent),makeStackable(ttsComponent,stackingOptions),ttsComponent.setTemplate(ttsTemplate).on("init",function(){if(container.hasClass("tts-component-container"))throw new Error("Container already has assigned text to speech component");container.addClass("tts-component-container"),this.render(container)}).on("render",function(){var _this=this,_this$getConfig=this.getConfig(),left=_this$getConfig.left,maxPlaybackRate=_this$getConfig.maxPlaybackRate,minPlaybackRate=_this$getConfig.minPlaybackRate,defaultPlaybackRate=_this$getConfig.playbackRate,top=_this$getConfig.top;0>left&&(left=window.innerWidth-this.getElement().width()+left);var $element=this.getElement(),$closeElement=$$1(".tts-control-close",$element),$dragElement=$$1(".tts-control-drag",$element),$playbackElement=$$1(".tts-control-playback",$element),$sfhModeElement=$$1(".tts-control-mode",$element),$sliderElement=$$1(".tts-slider",$element),$settingsElement=$$1(".tts-control-settings",$element);playbackRate=defaultPlaybackRate,$element.css("touch-action","none");var interactElement=interact($element).draggable({autoScroll:!0,manualStart:!0,restrict:{restriction:container[0],elementRect:{left:0,right:1,top:0,bottom:1}},onmove:function(event){var _Mathround=Math.round,xOffset=_Mathround(event.dx),yOffset=_Mathround(event.dy);_this.moveBy(xOffset,yOffset)}});interact($dragElement[0]).on("down",function(event){var interaction=event.interaction;interaction.start({name:"drag"},interactElement,$element[0])}),$sliderElement.noUiSlider({animate:!0,connected:!0,range:{min:minPlaybackRate,max:maxPlaybackRate},start:defaultPlaybackRate,step:.1}).on("change",this.setPlaybackRate),$closeElement.on("click",this.close),$playbackElement.on("mousedown touchstart",this.togglePlayback),$sfhModeElement.on("click",this.toggleSFHMode),$settingsElement.on("click",this.toggleSettings),audio.addEventListener("ended",this.initNextItem),audio.addEventListener("error",function(){feedback().error(__("Can not playback media file!")),_this.initNextItem()}),window.addEventListener("resize",this.handleResize),this.moveTo(left,top)}).on("hide",function(){this.setTTSStateOnContainer("visible",!1)}).on("show",function(){this.setTTSStateOnContainer("visible",!0)}).on("destroy",function(){container.removeClass("tts-component-container"),this.clearAPIPElements(),this.stop(),window.removeEventListener("resize",this.handleResize)}),ttsComponent.init(config),ttsComponent}$$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,component=component&&Object.prototype.hasOwnProperty.call(component,"default")?component["default"]:component,interact=interact&&Object.prototype.hasOwnProperty.call(interact,"default")?interact["default"]:interact,makeStackable=makeStackable&&Object.prototype.hasOwnProperty.call(makeStackable,"default")?makeStackable["default"]:makeStackable,makePlaceable=makePlaceable&&Object.prototype.hasOwnProperty.call(makePlaceable,"default")?makePlaceable["default"]:makePlaceable,feedback=feedback&&Object.prototype.hasOwnProperty.call(feedback,"default")?feedback["default"]:feedback;var Template=Handlebars.template(function(Handlebars,depth0,helpers,partials,data){this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",helperMissing=helpers.helperMissing,escapeExpression=this.escapeExpression,helper,options;return buffer+="<div class=\"tts-container\">\n <div class=\"tts-controls\">\n <div class=\"tts-control-container\">\n <a class=\"tts-control tts-control-close\" title=\""+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"Close",options):helperMissing.call(depth0,"__","Close",options)))+"\">\n <span class=\"icon-result-nok tts-icon\"></span>\n </a>\n </div>\n <div class=\"tts-control-container\">\n <a class=\"tts-control tts-control-drag\" title=\""+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"Move",options):helperMissing.call(depth0,"__","Move",options)))+"\">\n <span class=\"icon-grip tts-icon\"></span>\n <span class=\"tts-control-label\">\n "+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"Text to Speech",options):helperMissing.call(depth0,"__","Text to Speech",options)))+"\n </span>\n </a>\n </div>\n <div class=\"tts-control-container\">\n <a class=\"tts-control tts-control-playback\" title=\""+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"Toggle playback",options):helperMissing.call(depth0,"__","Toggle playback",options)))+"\">\n <span class=\"icon-play tts-icon\"></span>\n <span class=\"icon-pause tts-icon\"></span>\n </a>\n </div>\n <div class=\"tts-control-container\">\n <a class=\"tts-control tts-control-mode\" title=\""+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"Toggle start from here mode",options):helperMissing.call(depth0,"__","Toggle start from here mode",options)))+"\">\n <span class=\"icon-play-from-here tts-icon\"></span>\n </a>\n </div>\n <div class=\"tts-control-container\">\n <a class=\"tts-control tts-control-settings\" title=\""+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"Settings",options):helperMissing.call(depth0,"__","Settings",options)))+"\">\n <span class=\"icon-property-advanced tts-icon\"></span>\n </a>\n <div class=\"tts-slider-container\">\n "+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"Speed",options):helperMissing.call(depth0,"__","Speed",options)))+"<div class=\"tts-slider\"></div>\n </div>\n </div>\n </div>\n</div>\n",buffer}),defaultConfig={activeElementClass:"tts-active-content-node",elementClass:"tts-content-node",left:-10,maxPlaybackRate:2,minPlaybackRate:.5,playbackRate:1,top:50},stackingOptions={stackingScope:"test-runner"};return maskingComponentFactory}),define("taoQtiTest/runner/plugins/tools/apipTextToSpeech/ttsApipDataProvider",[],function(){'use strict';var getTTSItemData=function(apipElement){var identifier=apipElement["@attributes"].identifier,_apipElement$contentL=apipElement.contentLinkInfo,contentLinkInfo=void 0===_apipElement$contentL?{"@attributes":{}}:_apipElement$contentL,_apipElement$relatedE=apipElement.relatedElementInfo;_apipElement$relatedE=void 0===_apipElement$relatedE?{}:_apipElement$relatedE;var _apipElement$relatedE2=_apipElement$relatedE.spoken;_apipElement$relatedE2=void 0===_apipElement$relatedE2?{}:_apipElement$relatedE2;var _apipElement$relatedE3=_apipElement$relatedE2.audioFileInfo,audioFileInfo=void 0===_apipElement$relatedE3?[]:_apipElement$relatedE3,_ref=audioFileInfo.find(function(audioFile){return"audio/mpeg"===audioFile["@attributes"].mimeType})||{},_ref$fileHref=_ref.fileHref,fileHref=void 0===_ref$fileHref?"":_ref$fileHref,elementId=contentLinkInfo["@attributes"].qtiLinkIdentifierRef;return{identifier:identifier,selector:elementId&&"#".concat(elementId),url:fileHref.replace("assets/","")}},getTTSItemOrder=function(identifier,elementOrder){var _ref2=elementOrder.find(function(apipElementOrder){return apipElementOrder["@attributes"].identifierRef===identifier})||{},order=_ref2.order;return parseInt(order)||Number.POSITIVE_INFINITY};return function ttsApipDataProvider(apipData){var _apipData$accessibili=apipData.accessibilityInfo;_apipData$accessibili=void 0===_apipData$accessibili?{}:_apipData$accessibili;var _apipData$accessibili2=_apipData$accessibili.accessElement,accessElement=void 0===_apipData$accessibili2?[]:_apipData$accessibili2,_apipData$inclusionOr=apipData.inclusionOrder;_apipData$inclusionOr=void 0===_apipData$inclusionOr?{}:_apipData$inclusionOr;var _apipData$inclusionOr2=_apipData$inclusionOr.textGraphicsDefaultOrder;_apipData$inclusionOr2=void 0===_apipData$inclusionOr2?{}:_apipData$inclusionOr2;var _apipData$inclusionOr3=_apipData$inclusionOr2.elementOrder,elementOrder=void 0===_apipData$inclusionOr3?[]:_apipData$inclusionOr3;return accessElement.map(getTTSItemData).filter(function(_ref3){var url=_ref3.url;return!!url}).sort(function(a,b){return getTTSItemOrder(a.identifier,elementOrder)-getTTSItemOrder(b.identifier,elementOrder)})}}),define("taoQtiTest/runner/plugins/tools/apipTextToSpeech/plugin",["lodash","i18n","ui/hider","util/shortcut","util/namespace","taoTests/runner/plugin","taoQtiTest/runner/helpers/map","ui/keyNavigation/navigator","ui/keyNavigation/navigableDomElement","taoQtiTest/runner/plugins/tools/apipTextToSpeech/textToSpeech","taoQtiTest/runner/plugins/tools/apipTextToSpeech/ttsApipDataProvider"],function(_,__,hider,shortcut,namespaceHelper,pluginFactory,mapHelper,keyNavigator,navigableDomElement,ttsComponentFactory,ttsApipDataProvider){'use strict';_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,__=__&&Object.prototype.hasOwnProperty.call(__,"default")?__["default"]:__,shortcut=shortcut&&Object.prototype.hasOwnProperty.call(shortcut,"default")?shortcut["default"]:shortcut,namespaceHelper=namespaceHelper&&Object.prototype.hasOwnProperty.call(namespaceHelper,"default")?namespaceHelper["default"]:namespaceHelper,pluginFactory=pluginFactory&&Object.prototype.hasOwnProperty.call(pluginFactory,"default")?pluginFactory["default"]:pluginFactory,mapHelper=mapHelper&&Object.prototype.hasOwnProperty.call(mapHelper,"default")?mapHelper["default"]:mapHelper,keyNavigator=keyNavigator&&Object.prototype.hasOwnProperty.call(keyNavigator,"default")?keyNavigator["default"]:keyNavigator,navigableDomElement=navigableDomElement&&Object.prototype.hasOwnProperty.call(navigableDomElement,"default")?navigableDomElement["default"]:navigableDomElement,ttsComponentFactory=ttsComponentFactory&&Object.prototype.hasOwnProperty.call(ttsComponentFactory,"default")?ttsComponentFactory["default"]:ttsComponentFactory,ttsApipDataProvider=ttsApipDataProvider&&Object.prototype.hasOwnProperty.call(ttsApipDataProvider,"default")?ttsApipDataProvider["default"]:ttsApipDataProvider;var actionPrefix="tool-".concat("apiptts","-"),plugin=pluginFactory({name:"apiptts",init:function(){var _this=this,testRunner=this.getTestRunner(),testRunnerOptions=testRunner.getOptions(),pluginShortcuts=(testRunnerOptions.shortcuts||{})[this.getName()]||{},createNavigationGroup=function(){var $container=testRunner.getAreaBroker().getContainer(),$navigationGroupElement=_this.button.getElement(),groupNavigationId="".concat("apiptts","_navigation_group"),$navigationElements=$container.find(ttsApipData.map(function(_ref){var selector=_ref.selector;return selector}).join(", "));_this.navigationGroup=keyNavigator({id:groupNavigationId,group:$navigationGroupElement,elements:navigableDomElement.createFromDoms($navigationElements.add($navigationGroupElement)),propagateTab:!1,loop:!0,keepState:!0}).on("tab",function(){ttsComponent.is("sfhMode")&&(_this.navigationGroup.next(),testRunner.trigger("".concat(actionPrefix,"next")))}).on("shift+tab",function(){ttsComponent.is("sfhMode")&&(_this.navigationGroup.previous(),testRunner.trigger("".concat(actionPrefix,"previous")))}).on("activate",function(){ttsComponent.is("sfhMode")&&testRunner.trigger("".concat(actionPrefix,"togglePlayback"))}).on("blur",function(){setTimeout(function(){_this.navigationGroup.isFocused()||_this.navigationGroup.focus()},0)}).setCursorAt($navigationElements.length),ttsComponent.on("next finish",function(){if(ttsComponent.is("sfhMode")){var $currentElement=_this.navigationGroup.getCursor().navigable.getElement(),_ref2=ttsComponent.getCurrentItem()||{},selector=_ref2.selector;selector&&$currentElement.is(selector)||_this.navigationGroup.next()}})},getTTSComponent=function(){if(!ttsComponent){var $container=testRunner.getAreaBroker().getContainer();ttsComponent=ttsComponentFactory($container,{}).on("close",function(){_this.getState("active")&&testRunner.trigger("".concat(actionPrefix,"toggle"))}).hide()}return ttsComponent},isConfigured=function(){return mapHelper.hasItemCategory(testRunner.getTestMap(),testRunner.getTestContext().itemIdentifier,"apiptts",!0)},togglePlugin=function(){isConfigured()?_this.show():_this.hide()},enablePlugin=function(){createNavigationGroup(),_this.button.turnOn(),_this.setState("active",!0),_this.trigger("open"),ttsComponent.is("hidden")&&ttsComponent.show()},disablePlugin=function(){_this.getState("active")&&(_this.navigationGroup.blur(),_this.navigationGroup.destroy(),_this.setState("active",!1),_this.button.turnOff(),_this.trigger("close"),ttsComponent&&!ttsComponent.is("hidden")&&(ttsComponent.close(),ttsComponent.hide()))},toggleTool=function(){_this.getState("enabled")&&(_this.getState("active")?(disablePlugin(),_this.setState("sleep",!0)):(enablePlugin(),_this.setState("sleep",!1)))},ttsComponent,ttsApipData;this.button=this.getAreaBroker().getToolbox().createEntry({className:"".concat(this.getName(),"-plugin"),control:this.getName(),icon:"headphones",text:__("Text To Speech"),title:__("Enable text to speech")}),this.button.on("click",function(e){e.preventDefault(),testRunner.trigger("".concat(actionPrefix,"toggle"))}),testRunnerOptions.allowShortcuts&&_.forEach(pluginShortcuts,function(command,key){shortcut.add(namespaceHelper.namespaceAll(command,"apiptts",!0),function(){if(!("spaceTogglePlayback"===key&&ttsComponent&&ttsComponent.is("sfhMode"))){var eventKey=key.endsWith("TogglePlayback")?"togglePlayback":key;testRunner.trigger(actionPrefix+eventKey)}},{avoidInput:!0})}),togglePlugin(),this.disable(),this.hide(),testRunner.on("loaditem",function(){togglePlugin(),_this.disable()}).on("enabletools renderitem",function(){_this.enable()}).on("disabletools unloaditem",function(){disablePlugin(),_this.disable()}).on("".concat(actionPrefix,"toggle"),function(){isConfigured()&&toggleTool()}).on("".concat(actionPrefix,"togglePlayback"),function(){if(_this.getState("enabled")&&_this.getState("active")){if(ttsComponent.is("sfhMode")){var $currentElement=_this.navigationGroup.getCursor().navigable.getElement(),_ref3=ttsComponent.getCurrentItem()||{},selector=_ref3.selector;if(!$currentElement.is(selector))return void(_this.button.getElement()[0]!==$currentElement[0]&&$currentElement.trigger("click"))}ttsComponent.togglePlayback()}}).on("renderitem",function(){if(isConfigured())return ttsApipData=ttsApipDataProvider(testRunner.itemRunner.getData().apipAccessibility||{}).map(function(apipItemData){return Object.assign({},apipItemData,{url:testRunner.itemRunner.assetManager.resolve(apipItemData.url)})}),ttsApipData.length?void(getTTSComponent().setMediaContentData(ttsApipData),_this.show(),!_this.getState("sleep")&&(_this.setState("enabled",!0),toggleTool())):(disablePlugin(),void _this.hide())})},destroy:function(){shortcut.remove(".".concat(this.getName()))},enable:function(){this.button.enable()},disable:function(){this.button.disable()},show:function(){this.button.show()},hide:function(){this.button.hide()}});return plugin}),define("taoQtiTest/runner/plugins/tools/areaMasking/mask",["lodash","handlebars","ui/dynamicComponent"],function(_,Handlebars,dynamicComponent){'use strict';function areaMaskingTpl(data,options,asString){var html=Template(data,options);return asString||!0?html:$(html)}function maskingComponentFactory(){var dynamicComponentInstance;return dynamicComponentInstance=dynamicComponent({preview:function(){var self=this,delay=this.config.previewDelay||1e3;return!this.is("rendered")||this.is("disabled")||this.is("previewing")||(this.setState("previewing",!0),this.trigger("preview"),_.delay(function(){self.setState("previewing",!1)},delay)),this}},defaultConfig).on("rendercontent",function($content){var self=this,$element=this.getElement();$content.append(areaMaskingTpl({})),$element.addClass("mask-container"),$element.on("click touchstart",".view",function(e){e.preventDefault(),self.preview()}).on("click touchend",".close",function(e){e.preventDefault(),self.destroy()})}).init(),dynamicComponentInstance}_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,Handlebars=Handlebars&&Object.prototype.hasOwnProperty.call(Handlebars,"default")?Handlebars["default"]:Handlebars,dynamicComponent=dynamicComponent&&Object.prototype.hasOwnProperty.call(dynamicComponent,"default")?dynamicComponent["default"]:dynamicComponent;var Template=Handlebars.template(function(Handlebars,depth0,helpers,partials,data){this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",helperMissing=helpers.helperMissing,escapeExpression=this.escapeExpression,helper,options;return buffer+="<div class=\"mask\">\n <div class=\"inner\"></div>\n <div class=\"controls\">\n <a href=\"#\" class=\"view\" title=\""+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"Preview the covered area",options):helperMissing.call(depth0,"__","Preview the covered area",options)))+"\"><span class=\"icon-preview\"></span></a>\n <a href=\"#\" class=\"close\" title=\""+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"Close the mask",options):helperMissing.call(depth0,"__","Close the mask",options)))+"\"><span class=\"icon-result-nok\"></span></a>\n </div>\n</div>\n",buffer}),defaultConfig={draggable:!0,resizable:!0,preserveAspectRatio:!1,width:250,minWidth:160,maxWidth:1e3,minHeight:60,height:100,stackingScope:"test-runner",top:50,left:10,previewDelay:3e3};return maskingComponentFactory}),define("taoQtiTest/runner/plugins/tools/areaMasking/areaMasking",["lodash","i18n","ui/hider","util/shortcut","util/namespace","taoTests/runner/plugin","taoQtiTest/runner/plugins/tools/areaMasking/mask","taoQtiTest/runner/helpers/map"],function(_,__,hider,shortcut,namespaceHelper,pluginFactory,maskComponent,mapHelper){'use strict';_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,__=__&&Object.prototype.hasOwnProperty.call(__,"default")?__["default"]:__,shortcut=shortcut&&Object.prototype.hasOwnProperty.call(shortcut,"default")?shortcut["default"]:shortcut,namespaceHelper=namespaceHelper&&Object.prototype.hasOwnProperty.call(namespaceHelper,"default")?namespaceHelper["default"]:namespaceHelper,pluginFactory=pluginFactory&&Object.prototype.hasOwnProperty.call(pluginFactory,"default")?pluginFactory["default"]:pluginFactory,maskComponent=maskComponent&&Object.prototype.hasOwnProperty.call(maskComponent,"default")?maskComponent["default"]:maskComponent,mapHelper=mapHelper&&Object.prototype.hasOwnProperty.call(mapHelper,"default")?mapHelper["default"]:mapHelper;var actionPrefix="tool-".concat("area-masking","-"),defaultConfig={max:5,foo:!0},areaMasking=pluginFactory({name:"area-masking",init:function(){function addMask(){maskComponent().on("render",function(){self.masks.push(this),self.button.turnOn(),self.trigger("maskadd")}).on("destroy",function(){self.masks=_.without(self.masks,this),self.masks.length<config.max&&self.enable(),0===self.masks.length&&(self.button.turnOff(),self.trigger("close")),self.trigger("maskclose")}).init({renderTo:$container,draggableContainer:$container})}function isEnabled(){return mapHelper.hasItemCategory(testRunner.getTestMap(),testRunner.getTestContext().itemIdentifier,"areaMasking",!0)}var self=this,testRunner=this.getTestRunner(),$container=testRunner.getAreaBroker().getContentArea().parent(),testRunnerOptions=testRunner.getOptions(),config=Object.assign({},defaultConfig,this.getConfig()),pluginShortcuts=(testRunnerOptions.shortcuts||{})["area-masking"]||{};this.masks=[],this.button=this.getAreaBroker().getToolbox().createEntry({control:"area-masking",text:__("Masking"),title:__("Covers parts of the item"),icon:"eye-slash"}),this.button.on("click",function(e){e.preventDefault(),testRunner.trigger("".concat(actionPrefix,"toggle"))}),testRunnerOptions.allowShortcuts&&_.forEach(pluginShortcuts,function(command,key){shortcut.add(namespaceHelper.namespaceAll(command,"area-masking",!0),function(){testRunner.trigger(actionPrefix+key)},{avoidInput:!0})}),this.disable(),testRunner.on("loaditem",function(){isEnabled()?self.show():self.hide()}).on("enabletools renderitem",function(){self.enable()}).on("disabletools unloaditem",function(){self.disable(),_.invoke(self.masks,"destroy")}).on("".concat(actionPrefix,"toggle"),function(){isEnabled()&&(0===self.masks.length&&self.trigger("open"),self.masks.length<config.max?addMask():1===config.max&&_.invoke(self.masks,"destroy"))})},destroy:function(){shortcut.remove(".".concat("area-masking"))},enable:function(){this.button.enable()},disable:function(){this.button.disable()},show:function(){this.button.show()},hide:function(){this.button.hide()}});return areaMasking}),define("taoQtiTest/runner/plugins/tools/calculator",["jquery","lodash","i18n","ui/hider","ui/calculator","ui/maths/calculator/basicCalculator","ui/maths/calculator/scientificCalculator","util/shortcut","util/namespace","taoTests/runner/plugin","taoQtiTest/runner/helpers/map"],function($,_,__,hider,calculatorFactory,basicCalculatorFactory,scientificCalculatorFactory,shortcut,namespaceHelper,pluginFactory,mapHelper){'use strict';$=$&&Object.prototype.hasOwnProperty.call($,"default")?$["default"]:$,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,__=__&&Object.prototype.hasOwnProperty.call(__,"default")?__["default"]:__,calculatorFactory=calculatorFactory&&Object.prototype.hasOwnProperty.call(calculatorFactory,"default")?calculatorFactory["default"]:calculatorFactory,basicCalculatorFactory=basicCalculatorFactory&&Object.prototype.hasOwnProperty.call(basicCalculatorFactory,"default")?basicCalculatorFactory["default"]:basicCalculatorFactory,scientificCalculatorFactory=scientificCalculatorFactory&&Object.prototype.hasOwnProperty.call(scientificCalculatorFactory,"default")?scientificCalculatorFactory["default"]:scientificCalculatorFactory,shortcut=shortcut&&Object.prototype.hasOwnProperty.call(shortcut,"default")?shortcut["default"]:shortcut,namespaceHelper=namespaceHelper&&Object.prototype.hasOwnProperty.call(namespaceHelper,"default")?namespaceHelper["default"]:namespaceHelper,pluginFactory=pluginFactory&&Object.prototype.hasOwnProperty.call(pluginFactory,"default")?pluginFactory["default"]:pluginFactory,mapHelper=mapHelper&&Object.prototype.hasOwnProperty.call(mapHelper,"default")?mapHelper["default"]:mapHelper;var defaultCalcConfig={height:380,width:280,top:50,left:10,stackingScope:"test-runner",proportionalResize:!0},bodmasCalcConfig=_.defaults({height:380,width:280},defaultCalcConfig),scientificCalcConfig=_.defaults({width:490,height:420,calculator:{maths:{degree:!0}}},defaultCalcConfig),calculator=pluginFactory({name:"calculator",init:function(){function getCalculatorCategories(){var testContext=testRunner.getTestContext(),itemIdentifier=testContext.itemIdentifier,testMap=testRunner.getTestMap();return{calculator:mapHelper.hasItemCategory(testMap,itemIdentifier,"calculator",!0),bodmas:mapHelper.hasItemCategory(testMap,itemIdentifier,"calculator-bodmas",!0),scientific:mapHelper.hasItemCategory(testMap,itemIdentifier,"calculator-scientific",!0)}}function isEnabled(){var categories=getCalculatorCategories();return categories.calculator||categories.bodmas||categories.scientific}function togglePlugin(){isEnabled()?self.show():self.hide()}function buildCalculator(calcTpl){var categories=getCalculatorCategories(),factory,calcConfig;categories.scientific?(factory=scientificCalculatorFactory,calcConfig=scientificCalcConfig,calcConfig.calculator.maths.degree=_.isUndefined(config.degree)?scientificCalcConfig.calculator.maths.degree:config.degree):categories.bodmas?(factory=basicCalculatorFactory,calcConfig=bodmasCalcConfig):(factory=calculatorFactory,calcConfig=defaultCalcConfig),self.calculator=factory(_.defaults({renderTo:self.$calculatorContainer,replace:!0,draggableContainer:areaBroker.getContainer(),alternativeTemplate:calcTpl||null},calcConfig)).on("show",function(){self.trigger("open"),self.button.turnOn()}).on("hide",function(){self.trigger("close"),self.button.turnOff()}).after("render",function(){this.show()})}function toggleCalculator(){!1!==self.getState("enabled")&&(self.calculator?self.calculator.is("hidden")?self.calculator.show():self.calculator.hide():config.template?require(["tpl!".concat(config.template.replace(/\.tpl$/,""))],function(calcTpl){buildCalculator(calcTpl)},function(){buildCalculator()}):buildCalculator())}var self=this,testRunner=this.getTestRunner(),areaBroker=this.getAreaBroker(),testRunnerOptions=testRunner.getOptions(),config=this.getConfig(),pluginShortcuts=(testRunnerOptions.shortcuts||{})[this.getName()]||{};this.button=this.getAreaBroker().getToolbox().createEntry({control:"calculator",title:__("Open Calculator"),icon:"table",text:__("Calculator")}),this.$calculatorContainer=$("<div class=\"widget-calculator\">"),this.calculator=null,this.button.on("click",function(e){$(e.target).closest(".widget-calculator").length||(e.preventDefault(),testRunner.trigger("tool-calculator"))}),testRunnerOptions.allowShortcuts&&pluginShortcuts.toggle&&shortcut.add(namespaceHelper.namespaceAll(pluginShortcuts.toggle,this.getName(),!0),function(){testRunner.trigger("tool-calculator")},{avoidInput:!0,allowIn:".widget-calculator"}),togglePlugin(),this.disable(),testRunner.on("loaditem",togglePlugin).on("enabletools renderitem",function(){self.enable()}).on("disabletools unloaditem",function(){self.disable(),self.calculator&&(self.calculator.destroy(),self.calculator=null)}).on("tool-calculator",function(){isEnabled()&&toggleCalculator()})},render:function(){var areaBroker=this.getAreaBroker();areaBroker.getContainer().append(this.$calculatorContainer)},destroy:function(){shortcut.remove(".".concat(this.getName())),this.$calculatorContainer.remove(),this.calculator&&this.calculator.destroy()},enable:function(){this.button.enable()},disable:function(){this.button.disable(),this.calculator&&this.calculator.hide()},show:function(){this.button.show()},hide:function(){this.button.hide(),this.calculator&&this.calculator.hide()}});return calculator}),define("taoQtiTest/runner/plugins/tools/comment/comment",["jquery","i18n","taoTests/runner/plugin","ui/hider","ui/stacker","util/shortcut","util/namespace","handlebars"],function($$1,__,pluginFactory,hider,stackerFactory,shortcut,namespaceHelper,Handlebars){'use strict';function commentTpl(data,options,asString){var html=Template(data,options);return asString||!0?html:$(html)}$$1=$$1&&Object.prototype.hasOwnProperty.call($$1,"default")?$$1["default"]:$$1,__=__&&Object.prototype.hasOwnProperty.call(__,"default")?__["default"]:__,pluginFactory=pluginFactory&&Object.prototype.hasOwnProperty.call(pluginFactory,"default")?pluginFactory["default"]:pluginFactory,hider=hider&&Object.prototype.hasOwnProperty.call(hider,"default")?hider["default"]:hider,stackerFactory=stackerFactory&&Object.prototype.hasOwnProperty.call(stackerFactory,"default")?stackerFactory["default"]:stackerFactory,shortcut=shortcut&&Object.prototype.hasOwnProperty.call(shortcut,"default")?shortcut["default"]:shortcut,namespaceHelper=namespaceHelper&&Object.prototype.hasOwnProperty.call(namespaceHelper,"default")?namespaceHelper["default"]:namespaceHelper,Handlebars=Handlebars&&Object.prototype.hasOwnProperty.call(Handlebars,"default")?Handlebars["default"]:Handlebars;var Template=Handlebars.template(function(Handlebars,depth0,helpers,partials,data){this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",helperMissing=helpers.helperMissing,escapeExpression=this.escapeExpression,helper,options;return buffer+="<div data-control=\"qti-comment\" class=\"hidden\">\n <textarea data-control=\"qti-comment-text\" placeholder=\""+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"Your comment\u2026",options):helperMissing.call(depth0,"__","Your comment\u2026",options)))+"\"></textarea>\n <button data-control=\"qti-comment-cancel\" class=\"btn-info small\"></span>"+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"Cancel",options):helperMissing.call(depth0,"__","Cancel",options)))+"</button>\n <button data-control=\"qti-comment-send\" class=\"btn-info small\">"+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"Send",options):helperMissing.call(depth0,"__","Send",options)))+"</button>\n</div>\n",buffer}),comment=pluginFactory({name:"comment",init:function(){function isEnabled(){var currentItem=testRunner.getCurrentItem();if("boolean"==typeof currentItem.allowComment)return currentItem.allowComment;var testContext=testRunner.getTestContext(),contextOptions=testContext.options||{};return!!contextOptions.allowComment}function togglePlugin(){isEnabled()?self.show():self.hide()}function toggleComment(){!1!==self.getState("enabled")&&(hider.toggle(self.$form),hider.isHidden(self.$form)?self.button.turnOff():(self.$input.val("").focus(),self.button.turnOn(),stacker.bringToFront(self.$form)))}var self=this,testRunner=this.getTestRunner(),testRunnerOptions=testRunner.getOptions(),pluginShortcuts=(testRunnerOptions.shortcuts||{})[this.getName()]||{},stacker=stackerFactory("test-runner");this.button=this.getAreaBroker().getToolbox().createEntry({control:"comment",title:__("Leave a comment"),icon:"tag",text:__("Comment")}),this.button.on("render",function(){self.$button=self.button.getElement(),self.$form=$$1(commentTpl()).appendTo(self.$button),self.$input=self.$button.find("[data-control=\"qti-comment-text\"]"),self.$cancel=self.$button.find("[data-control=\"qti-comment-cancel\"]"),self.$submit=self.$button.find("[data-control=\"qti-comment-send\"]"),stacker.autoBringToFront(self.$form),self.$cancel.on("click",function(){hider.hide(self.$form),self.button.turnOff()}),self.$submit.on("click",function(){var comment=self.$input.val();comment&&(self.disable(),self.button.turnOff(),testRunner.getProxy().callTestAction("comment",{comment:comment}).then(function(){hider.hide(self.$form),self.enable()}).catch(function(){hider.hide(self.$form),self.enable()}))})}),this.button.on("click",function(e){$$1(e.target).closest("[data-control=\"qti-comment\"]").length||(e.preventDefault(),testRunner.trigger("tool-comment"))}),testRunnerOptions.allowShortcuts&&pluginShortcuts.toggle&&shortcut.add(namespaceHelper.namespaceAll(pluginShortcuts.toggle,this.getName(),!0),function(){testRunner.trigger("tool-comment")},{avoidInput:!0}),togglePlugin(),this.disable(),testRunner.on("loaditem",togglePlugin).on("renderitem enabletools",function(){self.enable()}).on("unloaditem disabletools",function(){self.disable()}).on("tool-comment",function(){isEnabled()&&toggleComment()})},destroy:function(){shortcut.remove(".".concat(this.getName()))},enable:function(){this.button.enable()},disable:function(){this.$form&&hider.hide(this.$form),this.button.disable(),this.button.turnOff()},show:function(){this.button.show()},hide:function(){this.$form&&hider.hide(this.$form),this.button.hide()}});return comment}),define("taoQtiTest/runner/plugins/tools/documentViewer/documentViewer",["jquery","lodash","ui/hider","ui/documentViewer","ui/documentViewer/providers/pdfViewer","taoTests/runner/plugin","handlebars"],function($$1,_,hider,viewerFactory,pdfViewer,pluginFactory,Handlebars){'use strict';function panelTpl(data,options,asString){var html=Template(data,options);return asString||!0?html:$(html)}function showPanel(plugin){hider.show(plugin.controls.$panel),plugin.trigger("panelshow"),$$1(window).on("resize.".concat(plugin.getName()),_.debounce(_.partial(resizeViewer,plugin),50))}function hidePanel(plugin){hider.hide(plugin.controls.$panel),plugin.trigger("panelhide"),$$1(window).off("resize.".concat(plugin.getName()))}function hideIfVisible(plugin){var isVisible=!hider.isHidden(plugin.controls.$panel,!0);return isVisible&&hidePanel(plugin),isVisible}function initPanelEvents(plugin){function stopPropagation(e){e.stopImmediatePropagation(),e.stopPropagation()}var namespace=".".concat(plugin.getName()),stopEvents=["click","mousedown","mouseup","touchstart","touchend","keyup","keydow","keypress","scroll","drop"].join("".concat(namespace," "))+namespace,hideViewer=_.partial(hidePanel,plugin);plugin.controls.$overlay.off(namespace).on("click".concat(namespace),hideViewer).on(stopEvents,stopPropagation),plugin.controls.$panel.off(namespace).on("click".concat(namespace),".icon-close",hideViewer).on(stopEvents,stopPropagation)}function resizeViewer(plugin){var $content=plugin.controls.$content;plugin.viewer.setSize($content.width(),$content.height())}$$1=$$1&&Object.prototype.hasOwnProperty.call($$1,"default")?$$1["default"]:$$1,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,hider=hider&&Object.prototype.hasOwnProperty.call(hider,"default")?hider["default"]:hider,viewerFactory=viewerFactory&&Object.prototype.hasOwnProperty.call(viewerFactory,"default")?viewerFactory["default"]:viewerFactory,pdfViewer=pdfViewer&&Object.prototype.hasOwnProperty.call(pdfViewer,"default")?pdfViewer["default"]:pdfViewer,pluginFactory=pluginFactory&&Object.prototype.hasOwnProperty.call(pluginFactory,"default")?pluginFactory["default"]:pluginFactory,Handlebars=Handlebars&&Object.prototype.hasOwnProperty.call(Handlebars,"default")?Handlebars["default"]:Handlebars;var Template=Handlebars.template(function(Handlebars,depth0,helpers,partials,data){this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,stack1,helper;return buffer+="<div class=\"document-viewer-plugin hidden\">\n <div class=\"viewer-overlay\"></div>\n <div class=\"viewer-panel\">\n <div class=\"viewer-header\">\n <span class=\"viewer-title\">",(helper=helpers.title)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.title,stack1="function"===_typeof2(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"</span>\n <span class=\"icon icon-close\"></span>\n </div>\n <div class=\"viewer-content\">",(helper=helpers.content)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.content,stack1="function"===_typeof2(helper)?helper.call(depth0,{hash:{},data:data}):helper),(stack1||0===stack1)&&(buffer+=stack1),buffer+="</div>\n <div class=\"viewer-footer\"></div>\n </div>\n</div>\n",buffer});viewerFactory.registerProvider("pdf",pdfViewer);var documentViewer=pluginFactory({name:"documentViewer",init:function(){function displayViewer(data){!1!==self.getState("enabled")&&(showPanel(self),self.controls.$title.text(data.label),resizeViewer(self),self.viewer.load(data.document,"pdf"))}var self=this,testRunner=this.getTestRunner(),$panel=$$1(panelTpl());this.controls={$panel:$panel,$overlay:$panel.find(".viewer-overlay"),$title:$panel.find(".viewer-title"),$content:$panel.find(".viewer-content")},this.viewer=viewerFactory({renderTo:this.controls.$content,replace:!0,fitToWidth:!0,allowSearch:!0}),testRunner.on("renderitem enabletools",function(){self.enable()}).on("renderitem",function(){self.getAreaBroker().getContentArea().append(self.controls.$panel).off(".".concat(self.getName())).on("viewDocument.".concat(self.getName()),function(event){var data=event.originalEvent.detail;displayViewer(data)}),initPanelEvents(self)}).on("move",function(){hideIfVisible(self)}).on("skip",function(){hideIfVisible(self)}).on("unloaditem disabletools",function(){self.disable()}).on("tool-documentViewer",function(data){displayViewer(data)})},render:function(){},destroy:function(){this.getAreaBroker().getContentArea().off(".".concat(this.getName())),this.viewer&&this.viewer.destroy(),this.controls.$panel&&this.controls.$panel.remove(),this.viewer=null,this.controls={}},enable:function(){},disable:function(){hideIfVisible(this)},show:function(){},hide:function(){hideIfVisible(this)}});return documentViewer}),define("taoQtiTest/runner/plugins/tools/highlighter/highlighter",["lodash","jquery","core/eventifier","ui/highlighter"],function(_,$,eventifier,highlighterFactory){'use strict';function getAllRanges(){var allRanges=[],i;for(i=0;i<selection.rangeCount;i++)allRanges.push(selection.getRangeAt(i));return allRanges}function discardSelection(){setTimeout(function(){selection.removeAllRanges()},250)}function testHighlighterFactory(options){var enabled=!0,isHighlighting=!1,highlightHelper=highlighterFactory({className:options.className||"txt-user-highlight",containerSelector:options.containerSelector||".qti-itemBody",containersBlackList:options.containersBlackList||[],clearOnClick:!0});return $(document).on("mouseup.highlighter",function(){isHighlighting&&!selection.isCollapsed&&(highlightHelper.highlightRanges(getAllRanges()),discardSelection())}),$(document).on("touchend.highlighter",function(){isHighlighting&&!selection.isCollapsed&&highlightHelper.highlightRanges(getAllRanges())}),/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream&&$(document).on("selectionchange",function(){isHighlighting||(prevSelection=_.clone(getAllRanges(),!0))}),eventifier({enable:function(){enabled=!0},disable:function(){enabled=!1},isEnabled:function(){return enabled},toggleHighlighting:function(bool){return isHighlighting=bool,isHighlighting?(this.trigger("start"),$(".qti-itemBody").toggleClass("highlighter-cursor",!0)):(this.trigger("end"),$(".qti-itemBody").toggleClass("highlighter-cursor",!1)),this},highlight:function(){isHighlighting?this.toggleHighlighting(!1):selection.isCollapsed?prevSelection[0]&&!prevSelection[0].collapsed?(this.toggleHighlighting(!0),highlightHelper.highlightRanges(prevSelection),this.toggleHighlighting(!1),discardSelection()):this.toggleHighlighting(!0):(this.toggleHighlighting(!0),highlightHelper.highlightRanges(getAllRanges()),this.toggleHighlighting(!1),discardSelection())},restoreIndex:function(index){index&&0<index.length&&highlightHelper.highlightFromIndex(index)},getIndex:function(){return highlightHelper.getHighlightIndex()},clearHighlights:function(){highlightHelper.clearHighlights(),selection.removeAllRanges()},getId:function(){return options.id}})}_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,$=$&&Object.prototype.hasOwnProperty.call($,"default")?$["default"]:$,eventifier=eventifier&&Object.prototype.hasOwnProperty.call(eventifier,"default")?eventifier["default"]:eventifier,highlighterFactory=highlighterFactory&&Object.prototype.hasOwnProperty.call(highlighterFactory,"default")?highlighterFactory["default"]:highlighterFactory;var prevSelection=[],selection;if(!window.getSelection)throw new Error("Browser does not support getSelection()");return selection=window.getSelection(),testHighlighterFactory}),define("taoQtiTest/runner/plugins/tools/highlighter/collection",["taoQtiTest/runner/plugins/tools/highlighter/highlighter"],function(highlighterFactory){'use strict';highlighterFactory=highlighterFactory&&Object.prototype.hasOwnProperty.call(highlighterFactory,"default")?highlighterFactory["default"]:highlighterFactory;var highlighters=[];return function(){return{addHighlighter:function(options){var hl=highlighterFactory(options);return highlighters.push(hl),hl},getHighlighterById:function(id){return highlighters.find(function(hl){return hl.getId()===id})},getAllHighlighters:function(){return highlighters},getItemHighlighter:function(){return highlighters[0]},getNonItemHighlighters:function(){return highlighters.slice(1)},getLength:function(){return highlighters.length},empty:function(){return highlighters=[],this}}}}),define("taoQtiTest/runner/plugins/tools/highlighter/plugin",["jquery","lodash","i18n","core/logger","taoTests/runner/plugin","util/shortcut","util/namespace","taoQtiTest/runner/helpers/currentItem","taoQtiTest/runner/plugins/tools/highlighter/collection","taoQtiTest/runner/helpers/map"],function($,_,__,loggerFactory,pluginFactory,shortcut,namespaceHelper,itemHelper,highlighterCollection,mapHelper){'use strict';$=$&&Object.prototype.hasOwnProperty.call($,"default")?$["default"]:$,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,__=__&&Object.prototype.hasOwnProperty.call(__,"default")?__["default"]:__,loggerFactory=loggerFactory&&Object.prototype.hasOwnProperty.call(loggerFactory,"default")?loggerFactory["default"]:loggerFactory,pluginFactory=pluginFactory&&Object.prototype.hasOwnProperty.call(pluginFactory,"default")?pluginFactory["default"]:pluginFactory,shortcut=shortcut&&Object.prototype.hasOwnProperty.call(shortcut,"default")?shortcut["default"]:shortcut,namespaceHelper=namespaceHelper&&Object.prototype.hasOwnProperty.call(namespaceHelper,"default")?namespaceHelper["default"]:namespaceHelper,itemHelper=itemHelper&&Object.prototype.hasOwnProperty.call(itemHelper,"default")?itemHelper["default"]:itemHelper,highlighterCollection=highlighterCollection&&Object.prototype.hasOwnProperty.call(highlighterCollection,"default")?highlighterCollection["default"]:highlighterCollection,mapHelper=mapHelper&&Object.prototype.hasOwnProperty.call(mapHelper,"default")?mapHelper["default"]:mapHelper;var plugin=pluginFactory({name:"highlighter",install:function(){var testRunner=this.getTestRunner();testRunner.getTestStore().setVolatile(this.getName())},init:function(){function isPluginEnabled(){return mapHelper.hasItemCategory(testRunner.getTestMap(),testRunner.getTestContext().itemIdentifier,"highlighter",!0)}function togglePlugin(){isPluginEnabled()?self.show():self.hide()}var self=this,testRunner=this.getTestRunner(),testRunnerOptions=testRunner.getOptions(),pluginShortcuts=(testRunnerOptions.shortcuts||{})[this.getName()]||{},hasHighlights=!1,logger=loggerFactory("highlighterPlugin"),highlighters=highlighterCollection();return highlighters.addHighlighter({className:"txt-user-highlight",containerSelector:".qti-itemBody",containersBlackList:[".qti-include"],id:"item-highlighter"}),this.buttonMain=this.getAreaBroker().getToolbox().createEntry({title:__("Highlight Text"),icon:"text-marker",control:"highlight-trigger",aria:{pressed:"false",label:__("(Visual) Highlight Text")},text:__("Highlight")}),this.buttonRemove=this.getAreaBroker().getToolbox().createEntry({title:__("Clear all active highlights"),icon:"result-nok",control:"highlight-clear",aria:{label:__("(Visual) Clear all active highlights")},text:__("Clear Highlights")}),this.buttonMain.on("mousedown",function(e){e.preventDefault(),isPluginEnabled()&&_.forEach(highlighters.getAllHighlighters(),function(instance){instance.isEnabled()&&instance.highlight()})}),this.buttonRemove.on("click",function(e){e.preventDefault(),isPluginEnabled()&&(_.forEach(highlighters.getAllHighlighters(),function(instance){instance.isEnabled()&&instance.clearHighlights()}),testRunner.trigger("clear"))}),testRunnerOptions.allowShortcuts&&pluginShortcuts.toggle&&shortcut.add(namespaceHelper.namespaceAll(pluginShortcuts.toggle,this.getName(),!0),function(){isPluginEnabled()&&_.forEach(highlighters.getAllHighlighters(),function(instance){instance.isEnabled()&&instance.highlight()})},{avoidInput:!0,prevent:!0}),this.disable(),function(){return testRunner.getTestStore().getStore(self.getName())}().then(function(highlighterStore){function saveHighlight(itemId,key){var instance,highlightsIndex;return(itemId?(key=itemId,instance=highlighters.getItemHighlighter()):instance=highlighters.getHighlighterById(key),!instance)?Promise.resolve(!1):(highlightsIndex=instance.getIndex(),!!(isPluginEnabled()&&hasHighlights&&key)&&(logger.debug("Saving ".concat(highlightsIndex.length," highlights for id ").concat(key)),highlighterStore.setItem(key,highlightsIndex)))}function saveAll(){var nonItemHighlighters=highlighters.getNonItemHighlighters();return Promise.all(_(nonItemHighlighters).filter(function(instance){return instance.isEnabled()}).map(function(instance){var key=instance.getId();return saveHighlight(null,key)}).value()).then(function(results){var itemId=testRunner.getTestContext().itemIdentifier;return saveHighlight(itemId)&&_.every(results)})}function loadHighlight(itemId,key){var instance;return itemId?(key=itemId,instance=highlighters.getItemHighlighter()):instance=highlighters.getHighlighterById(key),instance?highlighterStore.getItem(key).then(function(index){index&&(logger.debug("Loading ".concat(index.length," highlights for key ").concat(key)),hasHighlights=!0,instance.restoreIndex(index))}).then(function(){instance.on("end.save",function(){return saveHighlight(itemId,key)})}):Promise.resolve(!1)}testRunner.on("loaditem",togglePlugin).on("enabletools renderitem",function(){self.enable(),isPluginEnabled()&&_.forEach(highlighters.getAllHighlighters(),function(instance){instance.isEnabled()||instance.on("start").toggleHighlighting(!1).enable()})}).on("renderitem",function(){var itemId=testRunner.getTestContext().itemIdentifier,textStimuli;itemId&&isPluginEnabled()&&(hasHighlights=!1,highlighters.getItemHighlighter().enable(),loadHighlight(itemId),textStimuli=itemHelper.getTextStimuliHrefs(testRunner),_.forEach(textStimuli,function(textStimulusHref){var stimHighlighter=highlighters.getHighlighterById(textStimulusHref);stimHighlighter||(stimHighlighter=highlighters.addHighlighter({className:"txt-user-highlight",containerSelector:".qti-include[data-href=\"".concat(textStimulusHref,"\"]"),id:textStimulusHref})),stimHighlighter.enable(),loadHighlight(null,textStimulusHref)}))}).after("renderitem",function(){var instance=highlighters.getItemHighlighter();instance.isEnabled()&&instance.on("start",function(){self.buttonMain.turnOn(),self.buttonMain.$component.attr("aria-pressed","true"),self.trigger("start"),hasHighlights=!0}).on("end",function(){self.buttonMain.turnOff(),self.buttonMain.$component.attr("aria-pressed","false"),self.trigger("end")})}).after("clear.highlighter",function(){saveAll()}).before("skip move timeout",function(){return saveAll()}).on("disabletools unloaditem",function(){self.disable(),isPluginEnabled()&&_.forEach(highlighters.getAllHighlighters(),function(instance){instance.isEnabled()&&instance.off("end.save end start").toggleHighlighting(!1).disable()})})})},destroy:function(){shortcut.remove(".".concat(this.getName())),$(document).off(".highlighter")},enable:function(){this.buttonMain.enable(),this.buttonRemove.enable()},disable:function(){this.buttonMain.disable(),this.buttonRemove.disable()},show:function(){this.buttonMain.show(),this.buttonRemove.show()},hide:function(){this.buttonMain.hide(),this.buttonRemove.hide()}});return plugin}),define("taoQtiTest/runner/plugins/tools/itemThemeSwitcher/itemThemeSwitcher",["jquery","lodash","i18n","taoTests/runner/plugin","ui/hider","ui/themes","util/shortcut","util/namespace","ui/themeLoader"],function($,_,__,pluginFactory,hider,themeHandler,shortcut,namespaceHelper,themeLoader){'use strict';$=$&&Object.prototype.hasOwnProperty.call($,"default")?$["default"]:$,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,__=__&&Object.prototype.hasOwnProperty.call(__,"default")?__["default"]:__,pluginFactory=pluginFactory&&Object.prototype.hasOwnProperty.call(pluginFactory,"default")?pluginFactory["default"]:pluginFactory,themeHandler=themeHandler&&Object.prototype.hasOwnProperty.call(themeHandler,"default")?themeHandler["default"]:themeHandler,shortcut=shortcut&&Object.prototype.hasOwnProperty.call(shortcut,"default")?shortcut["default"]:shortcut,namespaceHelper=namespaceHelper&&Object.prototype.hasOwnProperty.call(namespaceHelper,"default")?namespaceHelper["default"]:namespaceHelper,themeLoader=themeLoader&&Object.prototype.hasOwnProperty.call(themeLoader,"default")?themeLoader["default"]:themeLoader;var itemThemeSwitcher=pluginFactory({name:"itemThemeSwitcher",install:function(){this.getTestRunner().getTestStore().setVolatile(this.getName())},init:function(){function isPluginAllowed(){return themesConfig&&1<_.size(themesConfig.available)}function reloadThemes(){var themeConfig=themeHandler.get("items");themeLoader(themeConfig).load(),state.selectedTheme?changeTheme(state.selectedTheme):changeTheme(themeConfig.default)}function changeTheme(themeId){var $qtiItem=$(".qti-item"),previousTheme=state.selectedTheme;state.selectedTheme=themeId,$qtiItem&&_.defer(function(){$qtiItem.trigger("themechange",[state.selectedTheme])}),self.storage&&self.storage.setItem("itemThemeId",themeId),previousTheme!==state.selectedTheme&&testRunner.trigger("themechange",state.selectedTheme,previousTheme),allMenuEntries.forEach(function(menuEntry){menuEntry.getId()===themeId?menuEntry.turnOn():menuEntry.turnOff()})}var self=this,pluginName=this.getName(),testRunner=this.getTestRunner(),testRunnerOptions=testRunner.getOptions(),pluginShortcuts=(testRunnerOptions.shortcuts||{})[this.getName()]||{},pluginConfig=this.getConfig(),oldNamespace=themeHandler.getActiveNamespace(),state={availableThemes:[],defaultTheme:"",selectedTheme:""},allMenuEntries=[];pluginConfig.activeNamespace&&themeHandler.setActiveNamespace(pluginConfig.activeNamespace);var themesConfig=themeHandler.get("items")||{};return pluginConfig.activeNamespace===oldNamespace||_.isEmpty(themesConfig)||reloadThemes(),themesConfig&&(themesConfig.default&&(state.defaultTheme=themesConfig.default,state.selectedTheme=themesConfig.default,changeTheme(themesConfig.default)),themesConfig.available&&_.forEach(themesConfig.available,function(theme){state.availableThemes.push({id:theme.id,label:__(theme.name)})})),this.menuButton=this.getAreaBroker().getToolbox().createMenu({control:"color-contrast",title:__("Change the current color preset"),icon:"contrast",text:__("Contrast")}).after("render",function(){isPluginAllowed()||self.hide()}).on("click",function(e){e.preventDefault(),testRunner.trigger("tool-themeswitcher-toggle")}).on("openmenu",function(){testRunner.trigger("plugin-open.".concat(pluginName),state.selectedTheme)}).on("closemenu",function(){testRunner.trigger("plugin-close.".concat(pluginName),state.selectedTheme)}),state.availableThemes.forEach(function(theme){var themeEntry=self.getAreaBroker().getToolbox().createEntry({role:"option",control:theme.id,title:theme.label,icon:"preview",text:__(theme.label)});themeEntry.setMenuId("color-contrast"),themeEntry.on("click",function(e){var themeId=this.config.control;e.preventDefault(),self.menuButton.turnOffAll(),this.turnOn(),changeTheme(themeId)}),state.defaultTheme===theme.id&&themeEntry.on("render",function(){this.turnOn()}),allMenuEntries.push(themeEntry)}),testRunnerOptions.allowShortcuts&&pluginShortcuts.toggle&&shortcut.add(namespaceHelper.namespaceAll(pluginShortcuts.toggle,this.getName(),!0),function(){testRunner.trigger("tool-themeswitcher-toggle")},{avoidInput:!0}),isPluginAllowed()||this.hide(),this.disable(),testRunner.on("loaditem",function(){isPluginAllowed()?self.show():self.hide()}).on("renderitem",function(){self.enable(),changeTheme(state.selectedTheme)}).on("enabletools",function(){self.enable()}).on("disabletools unloaditem",function(){self.disable()}).on("tool-themeswitcher-toggle",function(){!1!==self.getState("enabled")&&self.menuButton.toggleMenu()}).on("tool-themeswitcher-setnavtype",function(type){self.menuButton.setNavigationType(type)}),testRunner.getPluginStore(this.getName()).then(function(itemThemesStore){self.storage=itemThemesStore,self.storage.getItem("itemThemeId").then(function(itemThemeId){itemThemeId&&state.selectedTheme!==itemThemeId&&changeTheme(itemThemeId)})})},destroy:function(){return shortcut.remove(".".concat(this.getName())),this.getTestRunner().getPluginStore(this.getName()).then(function(itemThemesStore){return itemThemesStore.removeItem("itemThemeId")})},enable:function(){this.menuButton.enable()},disable:function(){this.menuButton.disable()},show:function(){this.menuButton.show()},hide:function(){this.menuButton.hide()}});return itemThemeSwitcher}),define("taoQtiTest/runner/plugins/tools/lineReader/compoundMask",["jquery","lodash","core/statifier","core/eventifier","ui/component","ui/component/placeable","ui/component/draggable","ui/component/resizable","ui/component/stackable"],function($,_,statifier,eventifier,componentFactory,makePlaceable,makeDraggable,makeResizable,makeStackable){'use strict';function _toConsumableArray(arr){return _arrayWithoutHoles(arr)||_iterableToArray(arr)||_unsupportedIterableToArray(arr)||_nonIterableSpread()}function _arrayWithoutHoles(arr){if(Array.isArray(arr))return _arrayLikeToArray(arr)}function _iterableToArray(iter){if("undefined"!=typeof Symbol&&null!=iter[Symbol.iterator]||null!=iter["@@iterator"])return Array.from(iter)}function _unsupportedIterableToArray(o,minLen){if(o){if("string"==typeof o)return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);return"Object"===n&&o.constructor&&(n=o.constructor.name),"Map"===n||"Set"===n?Array.from(o):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(o,minLen):void 0}}function _arrayLikeToArray(arr,len){(null==len||len>arr.length)&&(len=arr.length);for(var i=0,arr2=Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _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 compoundMaskFactory(options,dimensions,position){function createMask(maskConfig){var maskAPI={place:maskConfig.place,placeOverlay:maskConfig.placeOverlay,styleResizableEdges:function(){var $element=this.getElement();_.forOwn(this.config.edgesBorders,function(isResizable,edgeId){isResizable&&$element.addClass("border-".concat(edgeId))})},addResizeControll:function(){var $element=this.getElement(),$resizeControll=$("<div>",{class:"resize-control"});$element.append($resizeControll)}},mask;return mask=componentFactory(maskAPI,maskConfig),makeResizable(mask),makeStackable(mask,stackingOptions),mask.on("render",function(){var $element=this.getElement();this.styleResizableEdges(),this.config.resizeControll&&this.addResizeControll(),$element.addClass("line-reader-mask ".concat(maskConfig.id)).on("mousedown touchstart",function(){bringAllToFront()})}).on("resizestart",function(){innerDrag.hide(),closer.hide(),invokeOnOverlays("hide"),invokeOnMasks("setState",["resizing",!0]),this.setState("resizer",!0)}).on("beforeresize",maskConfig.beforeResize||_.noop).on("resize",maskConfig.onResize||_.noop).on("resizeend",function(){applyTransformsToOverlays(),applyTransformsToInnerDrag(),applyTransformsToCloser(),invokeOnMasks("setState",["resizing",!1]),invokeOnOverlays("show"),innerDrag.show(),closer.show(),this.setState("resizer",!1)}).init()}function createOverlay(overlayConfig){var overlay;return overlay=componentFactory({transformOverlay:function(){var $element=this.getElement();this._sizeBackup=this.getSize(),this._posBackup=this.getPosition(),this.setSize(dimensions.outerWidth,dimensions.outerHeight).moveTo(position.outerX,position.outerY),$element.addClass("moving"),this.setState("transformed",!0)},restoreOverlay:function(){var $element=this.getElement();this.is("transformed")&&(this.setSize(this._sizeBackup.width,this._sizeBackup.height).moveTo(this._posBackup.x,this._posBackup.y),$element.removeClass("moving"),this._sizeBackup=null,this._posBackup=null,this.setState("transformed",!1))},appendVisualGuides:function(){var $element=this.getElement();$element.append(visualGuides.$maskBg),$element.append(visualGuides.$innerWindow),visualGuides.$maskBg.css({width:dimensions.outerWidth-2,height:dimensions.outerHeight-2,"border-top-width":dimensions.topHeight-2,"border-right-width":dimensions.rightWidth-2,"border-bottom-width":dimensions.bottomHeight-2,"border-left-width":dimensions.leftWidth-2}),visualGuides.$innerWindow.css({width:dimensions.innerWidth,height:dimensions.innerHeight,left:dimensions.leftWidth-2,top:dimensions.topHeight-2})},removeVisualGuides:function(){visualGuides.$maskBg.remove(),visualGuides.$innerWindow.remove()}},overlayConfig),makeDraggable(overlay),makeStackable(overlay,stackingOptions),overlay.on("render",function(){var self=this,$element=this.getElement(),pointerEventsPrefix=window.PointerEvent?"pointer":"mouse",$moveIcon=$("<div>",{class:"icon icon-mobile-menu"});$element.addClass("line-reader-overlay ".concat(overlayConfig.id)).on("".concat(pointerEventsPrefix,"down")+" touchstart",function(){bringAllToFront(),self.transformOverlay()}).on("".concat(pointerEventsPrefix,"up")+" touchend",function(){self.restoreOverlay()}).prepend($moveIcon)}).on("dragstart",function(){innerDrag.hide(),closer.hide(),invokeOnMasks("hide"),this.appendVisualGuides()}).on("dragmove",function(xOffsetRelative,yOffsetRelative){position.outerX+=xOffsetRelative,position.outerY+=yOffsetRelative,position.innerX+=xOffsetRelative,position.innerY+=yOffsetRelative}).on("dragend",function(){this.removeVisualGuides(),invokeOnAll("show"),innerDrag.show(),closer.show(),applyTransforms()}).init()}function createInnerDragHandle(){innerDrag=componentFactory(),makeStackable(innerDrag,stackingOptions),makeDraggable(innerDrag,{dragRestriction:function(){var fixedXY=allParts.nw.mask.getElement().offset(),rect;return rect={x:fixedXY.left+constrains.minWidth,y:fixedXY.top+(constrains.minTopHeight+dimensions.innerHeight+options.resizeHandleSize),width:dimensions.outerWidth-2*constrains.minWidth,height:dimensions.outerHeight-(dimensions.innerHeight+constrains.minTopHeight+constrains.minBottomHeight-options.innerDragHeight)},rect}}).on("render",function(){var $element=this.getElement(),$dragIcon=$("<div>",{class:"icon icon-move"});$element.css("touch-action","none"),$element.addClass("line-reader-inner-drag"),$element.css({background:"none"}),$element.append($dragIcon)}).on("dragstart",function(){closer.hide(),bringAllToFront(),invokeOnMasks("setState",["resizing",!0])}).on("dragmove",function(xOffsetRelative,yOffsetRelative){position.innerX+=xOffsetRelative,position.innerY+=yOffsetRelative,dimensions.leftWidth+=xOffsetRelative,dimensions.topHeight+=yOffsetRelative,dimensions.rightWidth-=xOffsetRelative,dimensions.bottomHeight-=yOffsetRelative,applyTransformsToMasks()}).on("dragend",function(){innerDrag.bringToFront(),closer.show(),invokeOnMasks("setState",["resizing",!1]),applyTransformsToOverlays()}).init()}function createCloser(){closer=componentFactory(),makeStackable(closer,stackingOptions),makePlaceable(closer).on("render",function(){var self=this,$element=this.getElement(),$closeIcon=$("<div>",{class:"icon icon-result-nok"});$element.append($closeIcon),$element.addClass("line-reader-closer"),$element.on("mousedown touchstart",function(){bringAllToFront()}),$element.on("click",function(e){e.stopPropagation(),self.trigger("click")})}).init()}function bringAllToFront(){invokeOnAll("bringToFront"),innerDrag.bringToFront(),closer.bringToFront()}function invokeOnAll(fn,args){invokeOnMasks(fn,args),invokeOnOverlays(fn,args)}function invokeOnMasks(fn,args){invokeOn("mask",fn,args)}function invokeOnOverlays(fn,args){invokeOn("overlay",fn,args)}function invokeOn(target,fn,args){_.forOwn(allParts,function(part){if(_.isObject(part[target])&&_.isFunction(part[target][fn])){var _part$target;(_part$target=part[target])[fn].apply(_part$target,_toConsumableArray(args||[]))}})}function applyTransforms(){applyTransformsToMasks(),applyTransformsToOverlays(),applyTransformsToInnerDrag(),applyTransformsToCloser()}function applyTransformsToMasks(){invokeOnMasks("place")}function applyTransformsToOverlays(){_.forOwn(allParts,function(part){part.overlay&&part.mask.placeOverlay(part.overlay)})}function applyTransformsToInnerDrag(){innerDrag&&innerDrag.setSize(dimensions.innerWidth-20,options.innerDragHeight).moveTo(position.innerX+10,position.innerY+dimensions.innerHeight+options.resizeHandleSize)}function applyTransformsToCloser(){closer&&closer.setSize(constrains.minWidth-options.resizeHandleSize,constrains.minHeight-options.resizeHandleSize).moveTo(position.outerX+dimensions.outerWidth-constrains.minWidth-5,position.outerY+options.resizeHandleSize-4)}function correctTransforms(){dimensions.topHeight<constrains.minTopHeight&&(dimensions.topHeight=constrains.minTopHeight,position.innerY=position.outerY+constrains.minTopHeight),dimensions.innerHeight<constrains.minHeight&&(dimensions.innerHeight=constrains.minHeight),dimensions.bottomHeight<constrains.minBottomHeight&&(dimensions.bottomHeight=constrains.minBottomHeight),dimensions.outerHeight=dimensions.topHeight+dimensions.innerHeight+dimensions.bottomHeight,dimensions.leftWidth<constrains.minWidth&&(dimensions.leftWidth=constrains.minWidth,position.innerX=position.outerX+constrains.minWidth),dimensions.innerWidth<constrains.minWidth&&(dimensions.innerWidth=constrains.minWidth),dimensions.rightWidth<constrains.minWidth&&(dimensions.rightWidth=constrains.minWidth),dimensions.outerWidth=dimensions.leftWidth+dimensions.innerWidth+dimensions.rightWidth}function setTopHeight(newHeight,newY,fromTop){dimensions.topHeight=newHeight,fromTop?(dimensions.outerHeight=newHeight+dimensions.innerHeight+dimensions.bottomHeight,position.outerY=newY):(dimensions.innerHeight=dimensions.outerHeight-newHeight-dimensions.bottomHeight,position.innerY=position.outerY+newHeight)}function setRightWidth(newWidth,newX,fromLeft){dimensions.rightWidth=newWidth,fromLeft?dimensions.innerWidth=newX-position.innerX:dimensions.outerWidth=dimensions.leftWidth+dimensions.innerWidth+newWidth}function setBottomHeight(newHeight,newY,fromTop){dimensions.bottomHeight=newHeight,fromTop?(dimensions.innerHeight=newY-position.innerY,dimensions.bottomHeight=newHeight):dimensions.outerHeight=dimensions.topHeight+dimensions.innerHeight+newHeight}function setLeftWidth(newWidth,newX,fromLeft){dimensions.leftWidth=newWidth,fromLeft?(dimensions.outerWidth=newWidth+dimensions.innerWidth+dimensions.rightWidth,position.outerX=newX):(dimensions.innerWidth=dimensions.outerWidth-newWidth-dimensions.rightWidth,position.innerX=position.outerX+newWidth)}function createCompoundMask(){createPart({id:"n",edges:{top:!1,right:!1,bottom:!1,left:!1},edgesBorders:{top:!0,right:!1,bottom:!0,left:!1},addOverlay:!0,minHeight:constrains.minTopHeight,place:function(){this.moveTo(position.innerX,position.outerY).setSize(dimensions.innerWidth,dimensions.topHeight)},placeOverlay:function(overlay){var pos=this.getPosition(),size=this.getSize();overlay.moveTo(position.outerX,pos.y).setSize(dimensions.outerWidth,size.height)},beforeResize:function(width,height,fromLeft,fromTop){this.config.maxHeight=fromTop?null:dimensions.topHeight+(dimensions.innerHeight-constrains.minHeight)},onResize:function(width,height,fromLeft,fromTop,x,y){setTopHeight(height,y,fromTop),applyTransformsToMasks()}}),createPart({id:"ne",edges:{top:!1,right:!1,bottom:!1,left:!1},edgesBorders:{top:!0,right:!0,bottom:!1,left:!1},minHeight:constrains.minTopHeight,place:function(){this.moveTo(position.innerX+dimensions.innerWidth,position.outerY).setSize(dimensions.rightWidth,dimensions.topHeight)},placeOverlay:function(overlay){var pos=this.getPosition(),size=this.getSize();overlay.moveTo(pos.x,pos.y+options.resizeHandleSize).setSize(size.width-options.resizeHandleSize,size.height-2*options.resizeHandleSize)},onResize:function(width,height,fromLeft,fromTop,x,y){setTopHeight(height,y,fromTop),setRightWidth(width,x,fromLeft),applyTransformsToMasks()}}),createPart({id:"se",edges:{top:!1,right:".resize-control",bottom:".resize-control",left:!1},edgesBorders:{top:!1,right:!0,bottom:!0,left:!1},minHeight:constrains.minBottomHeight,resizeControll:!0,place:function(){this.moveTo(position.innerX+dimensions.innerWidth,position.innerY+dimensions.innerHeight).setSize(dimensions.rightWidth,dimensions.bottomHeight)},placeOverlay:function(overlay){var pos=this.getPosition(),size=this.getSize();overlay.moveTo(pos.x,pos.y+options.resizeHandleSize).setSize(size.width-options.resizeHandleSize,size.height-2*options.resizeHandleSize)},onResize:function(width,height,fromLeft,fromTop,x,y){setRightWidth(width,x,fromLeft),setBottomHeight(height,y,fromTop),applyTransformsToMasks()}}),createPart({id:"s",edges:{top:!1,right:!1,bottom:!1,left:!1},edgesBorders:{top:!0,right:!1,bottom:!0,left:!1},minHeight:constrains.minBottomHeight,place:function(){this.moveTo(position.innerX,position.innerY+dimensions.innerHeight).setSize(dimensions.innerWidth,dimensions.bottomHeight)},placeOverlay:function(overlay){var pos=this.getPosition(),size=this.getSize();overlay.moveTo(pos.x,pos.y+options.resizeHandleSize).setSize(size.width,size.height-2*options.resizeHandleSize)},beforeResize:function(width,height,fromLeft,fromTop){this.config.maxHeight=fromTop?dimensions.bottomHeight+(dimensions.innerHeight-constrains.minHeight):null},onResize:function(width,height,fromLeft,fromTop,x,y){setBottomHeight(height,y,fromTop),applyTransformsToMasks()}}),createPart({id:"e",edges:{top:!1,right:!1,bottom:".resize-control",left:".resize-control"},edgesBorders:{top:!1,right:!0,bottom:!1,left:!0},resizeControll:!0,place:function(){this.moveTo(position.innerX+dimensions.innerWidth,position.innerY).setSize(dimensions.rightWidth,dimensions.innerHeight)},placeOverlay:function(overlay){var pos=this.getPosition(),size=this.getSize();overlay.moveTo(pos.x+options.resizeHandleSize,pos.y-options.resizeHandleSize).setSize(size.width-2*options.resizeHandleSize,size.height+2*options.resizeHandleSize)},beforeResize:function(){this.config.maxWidth=dimensions.rightWidth+(dimensions.innerWidth-constrains.minWidth),this.config.minWidth=constrains.minWidth,this.config.maxHeight=dimensions.outerHeight-dimensions.topHeight-constrains.minBottomHeight},onResize:function(width,height,fromLeft,fromTop,x){setRightWidth(width,x,fromLeft),setInnerHeight(height),applyTransformsToMasks()}}),createPart({id:"sw",edges:{top:!1,right:!1,bottom:!1,left:!1},edgesBorders:{top:!1,right:!1,bottom:!0,left:!0},minHeight:constrains.minBottomHeight,place:function(){this.moveTo(position.outerX,position.innerY+dimensions.innerHeight).setSize(dimensions.leftWidth,dimensions.bottomHeight)},placeOverlay:function(overlay){var pos=this.getPosition(),size=this.getSize();overlay.moveTo(pos.x+options.resizeHandleSize,pos.y+options.resizeHandleSize).setSize(size.width-options.resizeHandleSize,size.height-2*options.resizeHandleSize)},onResize:function(width,height,fromLeft,fromTop,x,y){setBottomHeight(height,y,fromTop),setLeftWidth(width,x,fromLeft),applyTransformsToMasks()}}),createPart({id:"w",edges:{top:!1,right:!1,bottom:!1,left:!1},edgesBorders:{top:!1,right:!0,bottom:!1,left:!0},place:function(){this.moveTo(position.outerX,position.innerY).setSize(dimensions.leftWidth,dimensions.innerHeight)},placeOverlay:function(overlay){var pos=this.getPosition(),size=this.getSize();overlay.moveTo(pos.x+options.resizeHandleSize,pos.y-options.resizeHandleSize).setSize(size.width-2*options.resizeHandleSize,size.height+2*options.resizeHandleSize)},beforeResize:function(width,height,fromLeft){this.config.maxWidth=fromLeft?null:dimensions.leftWidth+(dimensions.innerWidth-constrains.minWidth)},onResize:function(width,height,fromLeft,fromTop,x){setLeftWidth(width,x,fromLeft),applyTransformsToMasks()}}),createPart({id:"nw",edges:{top:!1,right:!1,bottom:!1,left:!1},edgesBorders:{top:!0,right:!1,bottom:!1,left:!0},minHeight:constrains.minTopHeight,place:function(){this.moveTo(position.outerX,position.outerY).setSize(dimensions.leftWidth,dimensions.topHeight)},placeOverlay:function(overlay){var pos=this.getPosition(),size=this.getSize();overlay.moveTo(pos.x+options.resizeHandleSize,pos.y+options.resizeHandleSize).setSize(size.width-options.resizeHandleSize,size.height-2*options.resizeHandleSize)},onResize:function(width,height,fromLeft,fromTop,x,y){setTopHeight(height,y,fromTop),setLeftWidth(width,x,fromLeft),applyTransformsToMasks()}})}function createPart(partConfig){allParts[partConfig.id]={mask:createMask(_.assign({},constrains,partConfig)),overlay:partConfig.addOverlay?createOverlay(partConfig):null}}function createVisualGuides(){visualGuides.$maskBg=$("<div>",{class:"mask-bg"}),visualGuides.$innerWindow=$("<div>",{class:"inner-window"})}var allParts={},visualGuides={},setInnerHeight=function(newHeight){dimensions.innerHeight=newHeight,dimensions.bottomHeight=dimensions.outerHeight-dimensions.innerHeight-dimensions.topHeight},compoundMask,innerDrag,closer;return dimensions=_.defaults(dimensions||{},defaultDimensions),position=_.defaults(position||{},defaultPosition),options=_.defaults(options||{},defaultOptions),constrains={minWidth:2*options.resizeHandleSize+options.dragMinWidth,minHeight:2*options.resizeHandleSize+options.dragMinHeight,minBottomHeight:2*options.resizeHandleSize+options.innerDragHeight,minTopHeight:2*options.resizeHandleSize+18},compoundMask={init:function(){var self=this;return this.setTransforms(dimensions,position),createCompoundMask(),createVisualGuides(),createInnerDragHandle(),createCloser(),closer.on("click",function(){self.hide(),self.trigger("close")}),this},render:function($container){return invokeOnAll("render",[$container]),innerDrag.render($container),closer.render($container),applyTransforms(),this},destroy:function(){return invokeOnAll("destroy"),visualGuides=null,innerDrag=null,closer=null,this},show:function(){return invokeOnAll("show"),innerDrag.show(),closer.show(),this.setState("hidden",!1),this},hide:function(){return invokeOnAll("hide"),innerDrag.hide(),closer.hide(),this.setState("hidden",!0),this},setTransforms:function(dim,pos){dimensions=_.defaults(dim||{},dimensions),position=_.defaults(pos||{},position),dimensions.topHeight=pos.innerY-pos.outerY,dimensions.rightWidth=dim.outerWidth-(pos.innerX-pos.outerX)-dim.innerWidth,dimensions.bottomHeight=dim.outerHeight-(pos.innerY-pos.outerY)-dim.innerHeight,dimensions.leftWidth=pos.innerX-pos.outerX,correctTransforms(),applyTransforms()},getDimensions:function(){return dimensions},getPosition:function(){return position},getParts:function(){return allParts}},statifier(compoundMask),eventifier(compoundMask),compoundMask}$=$&&Object.prototype.hasOwnProperty.call($,"default")?$["default"]:$,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,statifier=statifier&&Object.prototype.hasOwnProperty.call(statifier,"default")?statifier["default"]:statifier,eventifier=eventifier&&Object.prototype.hasOwnProperty.call(eventifier,"default")?eventifier["default"]:eventifier,componentFactory=componentFactory&&Object.prototype.hasOwnProperty.call(componentFactory,"default")?componentFactory["default"]:componentFactory,makePlaceable=makePlaceable&&Object.prototype.hasOwnProperty.call(makePlaceable,"default")?makePlaceable["default"]:makePlaceable,makeDraggable=makeDraggable&&Object.prototype.hasOwnProperty.call(makeDraggable,"default")?makeDraggable["default"]:makeDraggable,makeResizable=makeResizable&&Object.prototype.hasOwnProperty.call(makeResizable,"default")?makeResizable["default"]:makeResizable,makeStackable=makeStackable&&Object.prototype.hasOwnProperty.call(makeStackable,"default")?makeStackable["default"]:makeStackable;var defaultDimensions={outerWidth:600,outerHeight:400,innerWidth:500,innerHeight:20},defaultPosition={outerX:0,outerY:0,innerX:50,innerY:50},defaultOptions={dragMinWidth:10,dragMinHeight:10,resizeHandleSize:10,innerDragHeight:20},stackingOptions={stackingScope:"test-runner"},constrains;return compoundMaskFactory}),define("taoQtiTest/runner/plugins/tools/lineReader/plugin",["lodash","i18n","taoTests/runner/plugin","ui/hider","util/shortcut","util/namespace","taoQtiTest/runner/helpers/map","taoQtiTest/runner/plugins/tools/lineReader/compoundMask"],function(_,__,pluginFactory,hider,shortcut,namespaceHelper,mapHelper,compoundMaskFactory){'use strict';function getDimensions($container){var $qtiContent=$container.find("#qti-content"),$qtiItem=$qtiContent.find(".qti-item"),lineHeight=Math.ceil(parseFloat($qtiContent.css("line-height")))||20;return{outerWidth:$qtiItem.width()+4*maskOptions.resizeHandleSize+2*maskOptions.dragMinWidth,outerHeight:175,innerWidth:$qtiItem.width(),innerHeight:lineHeight}}function getPosition($container){var $qtiContent=$container.find("#qti-content"),$qtiItem=$qtiContent.find(".qti-item"),itemPosition=$qtiItem.position()||{},paddingLeft=parseInt($qtiItem.css("padding-left"),10),paddingTop=parseInt($qtiItem.css("padding-top"),10),innerX=parseInt(itemPosition.left,10)+paddingLeft-3,innerY=parseInt(itemPosition.top,10)+paddingTop-3;return{outerX:innerX-2*maskOptions.resizeHandleSize-maskOptions.dragMinWidth,outerY:0,innerX:innerX,innerY:innerY}}function containerWidthHasChanged($container){var newDimensions=getDimensions($container);return newDimensions.outerWidth!==dimensions.outerWidth}_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,__=__&&Object.prototype.hasOwnProperty.call(__,"default")?__["default"]:__,pluginFactory=pluginFactory&&Object.prototype.hasOwnProperty.call(pluginFactory,"default")?pluginFactory["default"]:pluginFactory,shortcut=shortcut&&Object.prototype.hasOwnProperty.call(shortcut,"default")?shortcut["default"]:shortcut,namespaceHelper=namespaceHelper&&Object.prototype.hasOwnProperty.call(namespaceHelper,"default")?namespaceHelper["default"]:namespaceHelper,mapHelper=mapHelper&&Object.prototype.hasOwnProperty.call(mapHelper,"default")?mapHelper["default"]:mapHelper,compoundMaskFactory=compoundMaskFactory&&Object.prototype.hasOwnProperty.call(compoundMaskFactory,"default")?compoundMaskFactory["default"]:compoundMaskFactory;var actionPrefix="tool-".concat("line-reader","-"),maskOptions={dragMinWidth:17,dragMinHeight:7,resizeHandleSize:7,innerDragHeight:20},plugin=pluginFactory({name:"line-reader",init:function(){function isEnabled(){return mapHelper.hasItemCategory(testRunner.getTestMap(),testRunner.getTestContext().itemIdentifier,"lineReader",!0)}function toggleMask(){self.compoundMask.getState("hidden")?(containerWidthHasChanged($container)&&transformMask($container),openMask()):closeMask()}function openMask(){self.compoundMask.show(),self.trigger("start"),self.button.turnOn()}function closeMask(){self.compoundMask.getState("hidden")||self.compoundMask.hide(),self.trigger("end"),self.button.turnOff()}function transformMask($maskContainer){dimensions=getDimensions($maskContainer),position=getPosition($maskContainer),self.compoundMask.setTransforms(_.clone(dimensions),_.clone(position))}var self=this,testRunner=this.getTestRunner(),testRunnerOptions=testRunner.getOptions(),pluginShortcuts=(testRunnerOptions.shortcuts||{})["line-reader"]||{},$container=testRunner.getAreaBroker().getContentArea().parent();this.compoundMask=compoundMaskFactory(maskOptions).init().render($container).on("close",function(){closeMask()}).hide(),this.button=this.getAreaBroker().getToolbox().createEntry({title:__("Line Reader"),icon:"insert-horizontal-line",control:"line-reader",text:__("Line Reader")}),this.button.on("click",function(e){e.preventDefault(),testRunner.trigger("".concat(actionPrefix,"toggle"))}),testRunnerOptions.allowShortcuts&&pluginShortcuts.toggle&&shortcut.add(namespaceHelper.namespaceAll(pluginShortcuts.toggle,this.getName(),!0),function(){testRunner.trigger("".concat(actionPrefix,"toggle"))},{avoidInput:!0,prevent:!0}),this.disable(),testRunner.on("loaditem",function(){isEnabled()?self.show():self.hide()}).on("renderitem",function(){transformMask($container)}).on("enabletools renderitem",function(){self.enable()}).on("disabletools unloaditem",function(){self.disable(),closeMask()}).on("".concat(actionPrefix,"toggle"),function(){isEnabled()&&toggleMask()})},destroy:function(){this.compoundMask.destroy(),shortcut.remove(".".concat(this.getName()))},enable:function(){this.button.enable()},disable:function(){this.button.disable()},show:function(){this.button.show()},hide:function(){this.button.hide()}}),dimensions,position;return plugin}),define("taoQtiTest/runner/plugins/tools/magnifier/magnifierPanel",["jquery","lodash","ui/component","handlebars","ui/dynamicComponent"],function($$1,_,component,Handlebars,dynamicComponent){'use strict';var _Mathmin=Math.min,_Mathmax2=Math.max;function _toConsumableArray(arr){return _arrayWithoutHoles(arr)||_iterableToArray(arr)||_unsupportedIterableToArray(arr)||_nonIterableSpread()}function _arrayWithoutHoles(arr){if(Array.isArray(arr))return _arrayLikeToArray(arr)}function _iterableToArray(iter){if("undefined"!=typeof Symbol&&null!=iter[Symbol.iterator]||null!=iter["@@iterator"])return Array.from(iter)}function _unsupportedIterableToArray(o,minLen){if(o){if("string"==typeof o)return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);return"Object"===n&&o.constructor&&(n=o.constructor.name),"Map"===n||"Set"===n?Array.from(o):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(o,minLen):void 0}}function _arrayLikeToArray(arr,len){(null==len||len>arr.length)&&(len=arr.length);for(var i=0,arr2=Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _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 magnifierPanelTpl(data,options,asString){var html=Template(data,options);return asString||!0?html:$(html)}function magnifierPanelFactory(config){function scrollInClone(scrollData){var $clonedTarget;controls&&controls.$clone&&scrollData&&scrollData.id&&($clonedTarget=controls.$clone.find("[data-magnifier-scroll=".concat(scrollData.id,"]")),$clonedTarget.length&&(_.isNumber(scrollData.scrollTop)&&($clonedTarget[0].scrollTop=scrollData.scrollTop),_.isNumber(scrollData.scrollLeft)&&($clonedTarget[0].scrollLeft=scrollData.scrollLeft)))}function updateScrollPositions(){if(controls&&controls.$target){for(var elements=[controls.$target],scrollOffsetsChanged=!1;elements.length;){var $currentElement=$$1(elements.shift()),scrollLeft=$currentElement.scrollLeft(),scrollTop=$currentElement.scrollTop(),scrollId=$currentElement.data("magnifier-scroll");if(elements.push.apply(elements,_toConsumableArray(Array.from($currentElement.children()))),0<scrollLeft||0<scrollTop||scrollId)if(scrollOffsetsChanged=!0,scrollId){var scrollData=_.find(scrolling,{id:scrollId});scrollData.scrollTop=scrollTop,scrollData.scrollLeft=scrollLeft}else scrollId=_.uniqueId("scrolling_"),$currentElement.attr("data-magnifier-scroll",scrollId),scrolling.push({id:scrollId,scrollTop:scrollTop,scrollLeft:scrollLeft})}scrollOffsetsChanged&&magnifierPanel.update()}}function setScrollingListener(){updateScrollPositions(),window.addEventListener("scroll",scrollingListenerCallback,!0)}function removeScrollingListener(){window.removeEventListener("scroll",scrollingListenerCallback,!0)}function applyScrolling(){_.forEach(scrolling,scrollInClone)}function adjustZoomLevel(level){return _Mathmax2(zoomLevelMin,_Mathmin(parseFloat(level),zoomLevelMax))}function applyZoomLevel(){controls&&controls.$inner.css({transform:"scale(".concat(zoomLevel,")")})}function showZoomLevel(){var $newZoomLevel;controls&&($newZoomLevel=controls.$zoomLevel.clone(!0).html(zoomLevel),controls.$zoomLevel.before($newZoomLevel).remove(),controls.$zoomLevel=$newZoomLevel)}function updateMaxSize(){if(dynamicComponentInstance){var $window=$$1(window);dynamicComponentInstance.config.maxWidth=$window.width()*maxRatio,dynamicComponentInstance.config.maxHeight=$window.height()*maxRatio}}function applySize(){controls&&controls.$clone&&(targetWidth=controls.$target.width(),targetHeight=controls.$target.height(),controls.$clone.width(targetWidth).height(targetHeight))}function updateZoom(){var position;controls&&controls.$target&&(position=dynamicComponentInstance.position,position.x+=dx+controls.$target.scrollLeft(),position.y+=dy+controls.$target.scrollTop(),magnifierPanel.zoomAt(position.x,position.y))}function createObserver(){observer=new window.MutationObserver(updateMagnifier)}function startObserver(){controls&&controls.$target&&observer.observe(controls.$target.get(0),{childList:!0,attributes:!0,characterData:!0,subtree:!0}),setScrollingListener()}function stopObserver(){observer.disconnect(),removeScrollingListener()}function translateMagnifier(coordinate,actualSize,magnifierSize){var delta=0,ratio=zoomLevel;return actualSize&&(delta=actualSize*(zoomLevel-1)/2,ratio=(actualSize*zoomLevel-magnifierSize)/(actualSize-magnifierSize)),coordinate*ratio-delta}function getElementFromPoint(x,y){var el;return x=x||0,y=y||0,controls&&controls.$overlay.addClass("hidden"),el=document.elementFromPoint(x,y),controls&&controls.$overlay.removeClass("hidden"),el}function findSourceNode(node,root,target){var $node=$$1(node),$root=$$1(root),$target=$$1(target),indexes=[$node.index()];return $node.parents().each(function(){var $this=$$1(this);return!$this.is($root)&&void indexes.push($this.index())}),indexes.pop(),indexes.length?($node=$target,_.forEachRight(indexes,function(index){if($node=$node.children().eq(index),!$node.length)return!1})):$node=$$1(),$node}var initConfig=_.defaults(config||{},defaultConfig),zoomLevelMin=parseFloat(initConfig.levelMin),zoomLevelMax=parseFloat(initConfig.levelMax),zoomLevelStep=parseFloat(initConfig.levelStep),zoomLevel=adjustZoomLevel(initConfig.level),maxRatio=parseFloat(initConfig.maxRatio),$initTarget=null,controls=null,observer=null,scrolling=[],dynamicComponentConfig=_.defaults(config?config.component||{}:{},dynamicComponentDefaultConfig),magnifierPanel=component({getZoomLevel:function(){return zoomLevel},getTarget:function(){return controls&&controls.$target},setTarget:function($newTarget){return controls?(controls.$target=$newTarget,controls.$viewTarget=null,setScrollingListener(),this.trigger("targetchange",controls.$target),this.update()):$initTarget=$newTarget,this},zoomTo:function(level){return level&&_.isFinite(level)&&(zoomLevel=adjustZoomLevel(level)),applyZoomLevel(),showZoomLevel(),updateMaxSize(),updateZoom(),this.trigger("zoom",zoomLevel),this},zoomBy:function(step){return step&&_.isFinite(step)&&this.zoomTo(zoomLevel+parseFloat(step)),this},zoomIn:function(){return this.zoomBy(zoomLevelStep)},zoomOut:function(){return this.zoomBy(-zoomLevelStep)},zoomAt:function(x,y){var position;controls&&(position=this.translate(x,y),controls.$inner.css({top:-position.top,left:-position.left}))},translate:function(x,y){return{top:translateMagnifier(y,targetHeight,dynamicComponentInstance.position.height),left:translateMagnifier(x,targetWidth,dynamicComponentInstance.position.width)}},update:function(){return controls&&controls.$target&&(controls.$clone=controls.$target.clone().removeAttr("id"),controls.$clone.find("iframe").remove(),controls.$clone.find("[name],[id],[data-serial]").removeAttr("name id data-serial"),controls.$inner.empty().append(controls.$clone),controls.$clone.find("audio").prop("muted",!0),applySize(),applyZoomLevel(),updateZoom(),updateMaxSize(),applyScrolling(),this.trigger("update")),this}},defaultConfig),updateMagnifier=_.debounce(_.bind(magnifierPanel.update,magnifierPanel),50),scrollingListenerCallback=_.throttle(function(event){var $target=$$1(event.target),scrollingTop=event.target.scrollTop,scrollLeft=event.target.scrollLeft,scrollId,scrollData;controls&&controls.$clone&&$target.data("magnifier-scroll")?(scrollId=$target.data("magnifier-scroll"),scrollData=_.find(scrolling,{id:scrollId}),scrollData.scrollTop=scrollingTop,scrollData.scrollLeft=scrollLeft,scrollInClone(scrollData)):(scrollId=_.uniqueId("scrolling_"),$target.attr("data-magnifier-scroll",scrollId),scrolling.push({id:scrollId,scrollTop:scrollingTop,scrollLeft:scrollLeft}),magnifierPanel.update())},20),targetWidth,targetHeight,dx,dy,dynamicComponentInstance;return dynamicComponentInstance=dynamicComponent({}).on("rendercontent",function($content){var dynamicComponentContext=this,$element=this.getElement();$element.addClass("magnifier-container"),magnifierPanel.setTemplate(magnifierPanelTpl).on("render",function(){var self=this,$component=this.getElement();this.setState("hidden",!0),dx=($component.outerWidth()-$component.width())/2,dy=($component.outerHeight()-$component.height())/2,controls={$target:$initTarget,$inner:$$1(".inner",$component),$zoomLevel:$$1(".level",$component),$overlay:$$1(".overlay",$component)},$initTarget=null,$component.on("click touchstart",".control[data-control=\"zoomOut\"]",function(event){event.preventDefault(),self.zoomOut()}),$component.on("click touchstart",".control[data-control=\"zoomIn\"]",function(event){event.preventDefault(),self.zoomIn()}),$component.on("click touchstart",".closeMagnifier",function(event){event.preventDefault(),self.hide(),self.trigger("close")}),$component.on("click touchstart",".overlay",function(event){findSourceNode(getElementFromPoint(event.pageX,event.pageY),controls.$inner,controls.$target).click().focus()}),createObserver(),updateMaxSize(),applyZoomLevel()}).on("show",function(){updateMagnifier(),startObserver(),dynamicComponentContext.show()}).on("hide",function(){stopObserver(),dynamicComponentContext.hide()}).on("destroy",function(){stopObserver(),$initTarget=null,controls=null,observer=null,dynamicComponentContext.destroy()}).init(initConfig).render($content)}).on("down move resize",function(){updateZoom()}).on("resize",function(){updateMaxSize()}).init(dynamicComponentConfig),magnifierPanel}$$1=$$1&&Object.prototype.hasOwnProperty.call($$1,"default")?$$1["default"]:$$1,_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,component=component&&Object.prototype.hasOwnProperty.call(component,"default")?component["default"]:component,Handlebars=Handlebars&&Object.prototype.hasOwnProperty.call(Handlebars,"default")?Handlebars["default"]:Handlebars,dynamicComponent=dynamicComponent&&Object.prototype.hasOwnProperty.call(dynamicComponent,"default")?dynamicComponent["default"]:dynamicComponent;var Template=Handlebars.template(function(Handlebars,depth0,helpers,partials,data){this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var buffer="",escapeExpression=this.escapeExpression,helperMissing=helpers.helperMissing,stack1,helper,options;return buffer+="<div class=\"magnifier\">\n <div class=\"level\">",(helper=helpers.level)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.level,stack1="function"===_typeof2(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"</div>\n <div class=\"overlay\"></div>\n <div class=\"inner\"></div>\n <div class=\"controls close\">\n <a href=\"#\" class=\"control\" data-control=\"zoomIn\" title=\""+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"Magnify more",options):helperMissing.call(depth0,"__","Magnify more",options)))+"\"><span class=\"icon-add\"></span></a>\n <a href=\"#\" class=\"control\" data-control=\"zoomOut\" title=\""+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"Magnify less",options):helperMissing.call(depth0,"__","Magnify less",options)))+"\"><span class=\"icon-remove\"></span></a>\n <a href=\"#\" class=\"closeMagnifier\" data-control=\"closeMagnifier\" title=\""+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"Close Magnifier",options):helperMissing.call(depth0,"__","Close Magnifier",options)))+"\"><span class=\"icon-result-nok\"></span></a>\n </div>\n</div>\n",buffer}),screenRatio=window.screen.width/window.screen.height,defaultBaseSize=116,defaultLevelMin=2,defaultLevel=defaultLevelMin,defaultConfig={level:defaultLevel,levelMin:defaultLevelMin,levelMax:8,levelStep:.5,baseSize:defaultBaseSize,maxRatio:.5},dynamicComponentDefaultConfig={draggable:!0,resizable:!0,preserveAspectRatio:!1,width:defaultBaseSize*defaultLevel,height:defaultBaseSize*defaultLevel/screenRatio,minWidth:defaultBaseSize*defaultLevelMin,minHeight:defaultBaseSize*defaultLevelMin/screenRatio,stackingScope:"test-runner",top:50,left:10};return magnifierPanelFactory}),define("taoQtiTest/runner/plugins/tools/magnifier/magnifier",["lodash","i18n","taoTests/runner/plugin","ui/hider","util/shortcut","util/namespace","taoQtiTest/runner/plugins/tools/magnifier/magnifierPanel","taoQtiTest/runner/helpers/map"],function(_,__,pluginFactory,hider,shortcut,namespaceHelper,magnifierPanelFactory,mapHelper){'use strict';_=_&&Object.prototype.hasOwnProperty.call(_,"default")?_["default"]:_,__=__&&Object.prototype.hasOwnProperty.call(__,"default")?__["default"]:__,pluginFactory=pluginFactory&&Object.prototype.hasOwnProperty.call(pluginFactory,"default")?pluginFactory["default"]:pluginFactory,shortcut=shortcut&&Object.prototype.hasOwnProperty.call(shortcut,"default")?shortcut["default"]:shortcut,namespaceHelper=namespaceHelper&&Object.prototype.hasOwnProperty.call(namespaceHelper,"default")?namespaceHelper["default"]:namespaceHelper,magnifierPanelFactory=magnifierPanelFactory&&Object.prototype.hasOwnProperty.call(magnifierPanelFactory,"default")?magnifierPanelFactory["default"]:magnifierPanelFactory,mapHelper=mapHelper&&Object.prototype.hasOwnProperty.call(mapHelper,"default")?mapHelper["default"]:mapHelper;var actionPrefix="tool-".concat("magnifier","-"),defaultOptions={zoomMin:2,zoomMax:8,zoomStep:.5},magnifier=pluginFactory({name:"magnifier",init:function(){function getMagnifierPanel(){var $container;return magnifierPanel||($container=testRunner.getAreaBroker().getContainer(),magnifierPanel=magnifierPanelFactory({levelMin:pluginConfig.zoomMin,levelMax:pluginConfig.zoomMax,levelStep:pluginConfig.zoomStep,component:{renderTo:$container.parent(),draggableContainer:$container.parent()}}).on("show",function(){self.trigger("magnifier-show")}).on("hide",function(){self.trigger("magnifier-hide")}).on("zoom",function(level){self.trigger("magnifier-zoom",level)}).on("close",function(){hideMagnifier()}).setTarget($container),self.trigger("magnifier-create")),magnifierPanel}function isEnabled(){return mapHelper.hasItemCategory(testRunner.getTestMap(),testRunner.getTestContext().itemIdentifier,"magnifier",!0)}function togglePlugin(){isEnabled()?self.show():self.hide()}function toggleMagnifier(){self.getState("enabled")&&(self.getState("active")?hideMagnifier():showMagnifier())}function showMagnifier(){getMagnifierPanel(),magnifierPanel.is("hidden")&&magnifierPanel.show(),self.button.turnOn(),testRunner.trigger("plugin-open.".concat("magnifier")),self.setState("active",!0)}function hideMagnifier(){self.setState("active",!1),self.button.turnOff(),testRunner.trigger("plugin-close.".concat("magnifier")),magnifierPanel&&!magnifierPanel.is("hidden")&&magnifierPanel.hide()}var self=this,testRunner=this.getTestRunner(),testRunnerOptions=testRunner.getOptions(),pluginConfig=Object.assign({},defaultOptions,this.getConfig()),pluginShortcuts=(testRunnerOptions.shortcuts||{}).magnifier||{},magnifierPanel=null;this.button=this.getAreaBroker().getToolbox().createEntry({control:"magnify",title:__("Displays a customisable magnifier"),text:__("Magnifying Glass"),icon:"find"}),this.button.on("click",function(event){event.preventDefault(),testRunner.trigger("".concat(actionPrefix,"toggle"))}),testRunnerOptions.allowShortcuts&&_.forEach(pluginShortcuts,function(command,key){shortcut.add(namespaceHelper.namespaceAll(command,"magnifier",!0),function(){testRunner.trigger(actionPrefix+key)},{avoidInput:!0})}),togglePlugin(),this.disable(),testRunner.on("loaditem",function(){togglePlugin(),self.disable()}).on("renderitem",function(){magnifierPanel&&magnifierPanel.update().zoomTo(pluginConfig.zoomMin)}).on("enabletools renderitem",function(){self.enable()}).on("disabletools unloaditem",function(){self.getState("active")&&hideMagnifier(),self.disable()}).on("destroy",function(){magnifierPanel&&magnifierPanel.destroy(),magnifierPanel=null}).on("".concat(actionPrefix,"toggle"),function(){isEnabled()&&toggleMagnifier()}).on("".concat(actionPrefix,"in"),function(){isEnabled()&&self.getState("enabled")&&self.getState("active")&&getMagnifierPanel().zoomIn()}).on("".concat(actionPrefix,"out"),function(){isEnabled()&&self.getState("enabled")&&self.getState("active")&&getMagnifierPanel().zoomOut()}).on("".concat(actionPrefix,"close"),function(){self.getState("active")&&hideMagnifier()})},destroy:function(){shortcut.remove(".".concat("magnifier"))},enable:function(){this.button.enable()},disable:function(){this.button.disable()},show:function(){this.button.show()},hide:function(){this.button.hide()}});return magnifier}),define("taoQtiTest/runner/plugins/tools/zoom",["jquery","i18n","ui/hider","ui/transformer","util/shortcut","util/namespace","taoTests/runner/plugin","taoQtiTest/runner/helpers/map"],function($,__,hider,transformer,shortcut,namespaceHelper,pluginFactory,mapHelper){'use strict';var _Mathmax3=Math.max;$=$&&Object.prototype.hasOwnProperty.call($,"default")?$["default"]:$,__=__&&Object.prototype.hasOwnProperty.call(__,"default")?__["default"]:__,transformer=transformer&&Object.prototype.hasOwnProperty.call(transformer,"default")?transformer["default"]:transformer,shortcut=shortcut&&Object.prototype.hasOwnProperty.call(shortcut,"default")?shortcut["default"]:shortcut,namespaceHelper=namespaceHelper&&Object.prototype.hasOwnProperty.call(namespaceHelper,"default")?namespaceHelper["default"]:namespaceHelper,pluginFactory=pluginFactory&&Object.prototype.hasOwnProperty.call(pluginFactory,"default")?pluginFactory["default"]:pluginFactory,mapHelper=mapHelper&&Object.prototype.hasOwnProperty.call(mapHelper,"default")?mapHelper["default"]:mapHelper;var threshold={lower:10,upper:200},_setZoomLevel=function($target,level){var $parent=$target.parent(),newScale=level/100,isOverZoom=$parent.outerWidth(!0)<$target.width()*newScale;isOverZoom?(transformer.setTransformOrigin($target,"0 0"),$parent.css("margin-left","0")):(transformer.setTransformOrigin($target,"50% 0"),$parent.css("margin-left","")),transformer.scale($target,newScale)},_resetZoom=function($target){transformer.reset($target)},forceRepaint=function($target){var sel=$target[0];sel&&(sel.style.display="none",sel.offsetHeight,sel.style.display="")},zoom=pluginFactory({name:"zoom",init:function(){function isConfigured(){return mapHelper.hasItemCategory(testRunner.getTestMap(),testRunner.getTestContext().itemIdentifier,"zoom",!0)}function togglePlugin(){isConfigured()?self.show():self.hide()}function zoomAction(dir){var el,sx,sy,before,after;self.$zoomTarget&&(el=self.$zoomTarget[0],before=el.getBoundingClientRect(),sx=self.$container.scrollLeft(),sy=self.$container.scrollTop(),self.zoom=_Mathmax3(threshold.lower,Math.min(threshold.upper,self.zoom+10*dir)),self.zoom===100?_resetZoom(self.$zoomTarget):_setZoomLevel(self.$zoomTarget,self.zoom),forceRepaint(self.$zoomTarget),after=el.getBoundingClientRect(),sx=_Mathmax3(0,sx+(after.width-before.width)/2),sy=_Mathmax3(0,sy+(after.height-before.height)/2),self.$container.scrollLeft(sx).scrollTop(sy))}var self=this,testRunner=this.getTestRunner(),testRunnerOptions=testRunner.getOptions(),pluginShortcuts=(testRunnerOptions.shortcuts||{})[this.getName()]||{};this.buttonZoomOut=this.getAreaBroker().getToolbox().createEntry({control:"zoomOut",title:__("Zoom out"),icon:"remove"}),this.buttonZoomIn=this.getAreaBroker().getToolbox().createEntry({control:"zoomIn",title:__("Zoom in"),icon:"add"}),this.buttonZoomIn.on("click",function(e){e.preventDefault(),testRunner.trigger("tool-zoomin")}),this.buttonZoomOut.on("click",function(e){e.preventDefault(),testRunner.trigger("tool-zoomout")}),testRunnerOptions.allowShortcuts&&(pluginShortcuts.in&&shortcut.add(namespaceHelper.namespaceAll(pluginShortcuts.in,this.getName(),!0),function(){testRunner.trigger("tool-zoomin")},{avoidInput:!0}),pluginShortcuts.out&&shortcut.add(namespaceHelper.namespaceAll(pluginShortcuts.out,this.getName(),!0),function(){testRunner.trigger("tool-zoomout")},{avoidInput:!0})),togglePlugin(),this.disable(),testRunner.on("loaditem",function(){self.zoom=100,togglePlugin(),self.disable()}).on("renderitem",function(){self.$container=$("#qti-content"),self.$zoomTarget=$(".qti-item"),self.enable()}).on("enabletools",function(){self.enable()}).on("disabletools unloaditem",function(){self.disable()}).on("tool-zoomin",function(){!1!==self.getState("enabled")&&zoomAction(1)}).on("tool-zoomout",function(){!1!==self.getState("enabled")&&zoomAction(-1)})},destroy:function(){shortcut.remove(".".concat(this.getName()))},enable:function(){this.buttonZoomIn.enable(),this.buttonZoomOut.enable()},disable:function(){this.buttonZoomIn.disable(),this.buttonZoomOut.disable()},show:function(){this.buttonZoomIn.show(),this.buttonZoomOut.show()},hide:function(){this.buttonZoomIn.hide(),this.buttonZoomOut.hide()}});return zoom}),function(c){var d=document,s=d.createElement("style");s.type="text/css",d.getElementsByTagName("head")[0].appendChild(s),s.styleSheet?s.styleSheet.cssText=c:s.appendChild(d.createTextNode(c))}("/*\nUsage:\n- linear-gradient((color1, color2, color3)) - returns linear-gradient with evenly distributed colors,\n if 3 colors used then the position of each will be 33,33%\n- linear-gradient((color1 0%, color2 30%, color3 80%)) - returns linear-gradient with manually distributed colors,\n first param - color, second - position. Also you can use px or other valid units for set position.\n*/\n/* Do not edit */\n.test-runner-scope .content-wrapper p.key-navigation-group, .test-runner-scope .content-wrapper div.key-navigation-group:not(.select2-container) {\n padding: 5px !important;\n}\n\n.test-runner-scope .content-wrapper .key-navigation-group:not(.qti-extendedTextInteraction):not(.qti-textEntryInteraction):not(.qti-customInteraction) {\n border-width: 1px !important;\n border-style: solid;\n border-color: transparent;\n}\n\n.test-runner-scope .content-wrapper .key-navigation-group:not(.qti-extendedTextInteraction):not(.qti-textEntryInteraction):not(.qti-customInteraction).focusin {\n border-color: #0e5d91 !important;\n outline: none;\n}\n\n.test-runner-scope .content-wrapper .key-navigation-group:not(.qti-extendedTextInteraction):not(.qti-textEntryInteraction):not(.qti-customInteraction).qti-interaction .qti-choice.key-navigation-highlight:not(.tts-content-node) {\n background: #e7eff4 !important;\n}\n\n.test-runner-scope .content-wrapper span.key-navigation-group {\n border: none !important;\n}\n\n.test-runner-scope .content-wrapper span.key-navigation-group.focusin {\n outline: solid #0e5d91 1px !important;\n outline-offset: 1px;\n}\n\n.test-runner-scope .test-sidebar .key-navigation-group.focusin {\n background: #e7eff4;\n}\n\n.test-runner-scope .test-sidebar .key-navigation-group .qti-navigator-filters .key-navigation-highlight .qti-navigator-tab {\n border-width: 2px;\n}\n\n.test-runner-scope .test-sidebar .key-navigation-group .qti-navigator-filters .key-navigation-highlight:focus {\n outline: none;\n}\n\n.test-runner-scope .test-sidebar .key-navigation-group .qti-navigator-filters .key-navigation-highlight:focus .qti-navigator-tab {\n border-top-color: #222 !important;\n border-left-color: #222 !important;\n border-right-color: #222 !important;\n}\n\n.test-runner-scope .test-sidebar .key-navigation-group li.qti-navigator-item.key-navigation-highlight {\n padding-left: 8px;\n border-left: solid 2px #222;\n}\n\n.test-runner-scope .test-sidebar .key-navigation-group li.qti-navigator-item.key-navigation-highlight .key-navigation-highlight:focus {\n outline: none;\n}\n\n.test-runner-scope .bottom-action-bar.content-action-bar.key-navigation-group.focusin {\n -ms-box-shadow: 0 0 6px 2px #3e7da7;\n -o-box-shadow: 0 0 6px 2px #3e7da7;\n box-shadow: 0 0 6px 2px #3e7da7;\n}\n\n.test-runner-scope .bottom-action-bar.content-action-bar.key-navigation-group .key-navigation-highlight:focus {\n margin-bottom: 0;\n border-bottom-color: #e7eff4 !important;\n outline: none;\n}\n\n.test-runner-scope .bottom-action-bar.content-action-bar.key-navigation-group .key-navigation-highlight:focus.active {\n border-bottom-color: transparent !important;\n background: #e7eff4 !important;\n}\n\n.test-runner-scope .bottom-action-bar.content-action-bar.key-navigation-group .key-navigation-highlight:focus:not(.active):not(:active) .li-inner {\n color: #e7eff4;\n}\n\nheader .settings-menu .key-navigation-group {\n padding-right: 5px;\n}\n\nheader .settings-menu .key-navigation-group.focusin {\n background-color: rgba(14, 93, 145, 0.5);\n padding-bottom: 10px;\n}\n\nheader .settings-menu .key-navigation-highlight:focus {\n height: 54px;\n color: white !important;\n border-bottom: solid 2px white !important;\n}\n\n/*# sourceMappingURL=../../../taoQtiTest/views/node_modules/@oat-sa/tao-test-runner-qti/dist/plugins/content/accessibility/css/key-navigation.css.map *//*\nUsage:\n- linear-gradient((color1, color2, color3)) - returns linear-gradient with evenly distributed colors,\n if 3 colors used then the position of each will be 33,33%\n- linear-gradient((color1 0%, color2 30%, color3 80%)) - returns linear-gradient with manually distributed colors,\n first param - color, second - position. Also you can use px or other valid units for set position.\n*/\n/* Do not edit */\n.countdown {\n opacity: 0;\n position: relative;\n display: inline-block;\n overflow: hidden;\n text-align: center;\n vertical-align: top;\n line-height: 1.2;\n padding: 0 20px;\n margin-top: -1px;\n height: 100%;\n}\n\n.countdown.rendered {\n opacity: 1;\n transition: opacity, 300ms, linear, 0s;\n}\n\n.countdown .label {\n max-width: 130px;\n display: block;\n font-size: 12px;\n font-size: 1.2rem;\n}\n\n/*# sourceMappingURL=../../../taoQtiTest/views/node_modules/@oat-sa/tao-test-runner-qti/dist/plugins/controls/timer/component/css/countdown.css.map *//*\nUsage:\n- linear-gradient((color1, color2, color3)) - returns linear-gradient with evenly distributed colors,\n if 3 colors used then the position of each will be 33,33%\n- linear-gradient((color1 0%, color2 30%, color3 80%)) - returns linear-gradient with manually distributed colors,\n first param - color, second - position. Also you can use px or other valid units for set position.\n*/\n/* Do not edit */\n.timer-box {\n opacity: 0;\n padding-top: 0;\n white-space: nowrap;\n /*flex item of control-box */\n flex: 1 0 auto;\n /* is also a flex container for .qti-timer */\n display: flex;\n flex-direction: row;\n flex-wrap: nowrap;\n justify-content: flex-end;\n}\n\n.timer-box.rendered {\n opacity: 1;\n transition: opacity, 300ms, linear, 0s;\n}\n\n.timer-box .timer-toggler {\n text-decoration: none;\n color: white;\n line-height: 1.3;\n opacity: .68;\n padding: 8px 20px;\n position: relative;\n top: -1px;\n left: 20px;\n z-index: 2;\n transition: opacity, 0.5s, ease-out, 0s;\n}\n\n.timer-box .timer-toggler:hover, .timer-box .timer-toggler:active, .timer-box .timer-toggler:focus {\n outline: unset;\n}\n\n.timer-box .timer-toggler:active, .timer-box .timer-toggler:focus {\n border: 2px solid white;\n}\n\n.timer-box .timer-toggler:hover {\n opacity: .93;\n transition: opacity, 0.5s, ease-out, 0s;\n}\n\n.timer-box.zen .timer-toggler {\n opacity: .93;\n transition: opacity, 0.5s, ease-out, 0s;\n}\n\n.timer-box.zen .countdown .time {\n opacity: 0;\n transition: opacity, 1s, ease-out, 0s;\n}\n\n.timer-box .countdown::before {\n content: ' ';\n background: rgba(255, 255, 255, 0.3);\n width: 1px;\n height: 20px;\n position: absolute;\n left: 0;\n top: 5px;\n}\n\n.timer-box .countdown:first-child::before {\n content: none;\n}\n\n.timer-box .countdown[data-scope=test][data-type=min] {\n order: 5;\n}\n\n.timer-box .countdown[data-scope=test] {\n order: 10;\n}\n\n.timer-box .countdown[data-scope=testPart][data-type=min] {\n order: 15;\n}\n\n.timer-box .countdown[data-scope=testPart] {\n order: 20;\n}\n\n.timer-box .countdown[data-scope=section][data-type=min] {\n order: 25;\n}\n\n.timer-box .countdown[data-scope=section] {\n order: 30;\n}\n\n.timer-box .countdown[data-scope=item][data-type=min] {\n order: 35;\n}\n\n.timer-box .countdown[data-scope=item] {\n order: 40;\n}\n\n/*# sourceMappingURL=../../../taoQtiTest/views/node_modules/@oat-sa/tao-test-runner-qti/dist/plugins/controls/timer/component/css/timerbox.css.map */"),define("taoQtiTest/loader/testPlugins.bundle",function(){});
//# sourceMappingURL=testPlugins.min.js.map