/** vim: et:ts=4:sw=4:sts=4
 * @license RequireJS 2.1.14 Copyright (c) 2010-2014, The Dojo Foundation All Rights Reserved.
 * Available via the MIT or new BSD license.
 * see: http://github.com/jrburke/requirejs for details
 */

// knockout-amd-helpers 0.7.0 | (c) 2014 Ryan Niemeyer |  http://www.opensource.org/licenses/mit-license

/**
 * @license RequireJS text 2.0.7 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
 * Available via the MIT or new BSD license.
 * see: http://github.com/requirejs/text for details
 */

var requirejs,require,define;(function(global){function isFunction(e){return ostring.call(e)==="[object Function]"}function isArray(e){return ostring.call(e)==="[object Array]"}function each(e,t){if(e){var n;for(n=0;n<e.length;n+=1)if(e[n]&&t(e[n],n,e))break}}function eachReverse(e,t){if(e){var n;for(n=e.length-1;n>-1;n-=1)if(e[n]&&t(e[n],n,e))break}}function hasProp(e,t){return hasOwn.call(e,t)}function getOwn(e,t){return hasProp(e,t)&&e[t]}function eachProp(e,t){var n;for(n in e)if(hasProp(e,n)&&t(e[n],n))break}function mixin(e,t,n,r){return t&&eachProp(t,function(t,i){if(n||!hasProp(e,i))r&&typeof t=="object"&&t&&!isArray(t)&&!isFunction(t)&&!(t instanceof RegExp)?(e[i]||(e[i]={}),mixin(e[i],t,n,r)):e[i]=t}),e}function bind(e,t){return function(){return t.apply(e,arguments)}}function scripts(){return document.getElementsByTagName("script")}function defaultOnError(e){throw e}function getGlobal(e){if(!e)return e;var t=global;return each(e.split("."),function(e){t=t[e]}),t}function makeError(e,t,n,r){var i=new Error(t+"\nhttp://requirejs.org/docs/errors.html#"+e);return i.requireType=e,i.requireModules=r,n&&(i.originalError=n),i}function newContext(e){function m(e){var t,n;for(t=0;t<e.length;t++){n=e[t];if(n===".")e.splice(t,1),t-=1;else if(n===".."){if(t===0||t==1&&e[2]===".."||e[t-1]==="..")continue;t>0&&(e.splice(t-1,2),t-=2)}}}function g(e,t,n){var r,i,s,u,a,f,l,c,h,p,d,v,g=t&&t.split("/"),y=o.map,b=y&&y["*"];e&&(e=e.split("/"),l=e.length-1,o.nodeIdCompat&&jsSuffixRegExp.test(e[l])&&(e[l]=e[l].replace(jsSuffixRegExp,"")),e[0].charAt(0)==="."&&g&&(v=g.slice(0,g.length-1),e=v.concat(e)),m(e),e=e.join("/"));if(n&&y&&(g||b)){s=e.split("/");e:for(u=s.length;u>0;u-=1){f=s.slice(0,u).join("/");if(g)for(a=g.length;a>0;a-=1){i=getOwn(y,g.slice(0,a).join("/"));if(i){i=getOwn(i,f);if(i){c=i,h=u;break e}}}!p&&b&&getOwn(b,f)&&(p=getOwn(b,f),d=u)}!c&&p&&(c=p,h=d),c&&(s.splice(0,h,c),e=s.join("/"))}return r=getOwn(o.pkgs,e),r?r:e}function y(e){isBrowser&&each(scripts(),function(t){if(t.getAttribute("data-requiremodule")===e&&t.getAttribute("data-requirecontext")===r.contextName)return t.parentNode.removeChild(t),!0})}function b(e){var t=getOwn(o.paths,e);if(t&&isArray(t)&&t.length>1)return t.shift(),r.require.undef(e),r.makeRequire(null,{skipMap:!0})([e]),!0}function w(e){var t,n=e?e.indexOf("!"):-1;return n>-1&&(t=e.substring(0,n),e=e.substring(n+1,e.length)),[t,e]}function E(e,t,n,i){var s,o,u,a,f=null,l=t?t.name:null,h=e,p=!0,m="";return e||(p=!1,e="_@r"+(d+=1)),a=w(e),f=a[0],e=a[1],f&&(f=g(f,l,i),o=getOwn(c,f)),e&&(f?o&&o.normalize?m=o.normalize(e,function(e){return g(e,l,i)}):m=e.indexOf("!")===-1?g(e,l,i):e:(m=g(e,l,i),a=w(m),f=a[0],m=a[1],n=!0,s=r.nameToUrl(m))),u=f&&!o&&!n?"_unnormalized"+(v+=1):"",{prefix:f,name:m,parentMap:t,unnormalized:!!u,url:s,originalName:h,isDefine:p,id:(f?f+"!"+m:m)+u}}function S(e){var t=e.id,n=getOwn(u,t);return n||(n=u[t]=new r.Module(e)),n}function x(e,t,n){var r=e.id,i=getOwn(u,r);hasProp(c,r)&&(!i||i.defineEmitComplete)?t==="defined"&&n(c[r]):(i=S(e),i.error&&t==="error"?n(i.error):i.on(t,n))}function T(e,t){var n=e.requireModules,r=!1;t?t(e):(each(n,function(t){var n=getOwn(u,t);n&&(n.error=e,n.events.error&&(r=!0,n.emit("error",e)))}),r||req.onError(e))}function N(){globalDefQueue.length&&(apsp.apply(l,[l.length,0].concat(globalDefQueue)),globalDefQueue=[])}function C(e){delete u[e],delete a[e]}function k(e,t,n){var r=e.map.id;e.error?e.emit("error",e.error):(t[r]=!0,each(e.depMaps,function(r,i){var s=r.id,o=getOwn(u,s);o&&!e.depMatched[i]&&!n[s]&&(getOwn(t,s)?(e.defineDep(i,c[s]),e.check()):k(o,t,n))}),n[r]=!0)}function L(){var e,n,i=o.waitSeconds*1e3,u=i&&r.startTime+i<(new Date).getTime(),f=[],l=[],c=!1,h=!0;if(t)return;t=!0,eachProp(a,function(e){var t=e.map,r=t.id;if(!e.enabled)return;t.isDefine||l.push(e);if(!e.error)if(!e.inited&&u)b(r)?(n=!0,c=!0):(f.push(r),y(r));else if(!e.inited&&e.fetched&&t.isDefine){c=!0;if(!t.prefix)return h=!1}});if(u&&f.length)return e=makeError("timeout","Load timeout for modules: "+f,null,f),e.contextName=r.contextName,T(e);h&&each(l,function(e){k(e,{},{})}),(!u||n)&&c&&(isBrowser||isWebWorker)&&!s&&(s=setTimeout(function(){s=0,L()},50)),t=!1}function A(e){hasProp(c,e[0])||S(E(e[0],null,!0)).init(e[1],e[2])}function O(e,t,n,r){e.detachEvent&&!isOpera?r&&e.detachEvent(r,t):e.removeEventListener(n,t,!1)}function M(e){var t=e.currentTarget||e.srcElement;return O(t,r.onScriptLoad,"load","onreadystatechange"),O(t,r.onScriptError,"error"),{node:t,id:t&&t.getAttribute("data-requiremodule")}}function _(){var e;N();while(l.length){e=l.shift();if(e[0]===null)return T(makeError("mismatch","Mismatched anonymous define() module: "+e[e.length-1]));A(e)}}var t,n,r,i,s,o={waitSeconds:7,baseUrl:"./",paths:{},bundles:{},pkgs:{},shim:{},config:{}},u={},a={},f={},l=[],c={},h={},p={},d=1,v=1;return i={require:function(e){return e.require?e.require:e.require=r.makeRequire(e.map)},exports:function(e){e.usingExports=!0;if(e.map.isDefine)return e.exports?c[e.map.id]=e.exports:e.exports=c[e.map.id]={}},module:function(e){return e.module?e.module:e.module={id:e.map.id,uri:e.map.url,config:function(){return getOwn(o.config,e.map.id)||{}},exports:e.exports||(e.exports={})}}},n=function(e){this.events=getOwn(f,e.id)||{},this.map=e,this.shim=getOwn(o.shim,e.id),this.depExports=[],this.depMaps=[],this.depMatched=[],this.pluginMaps={},this.depCount=0},n.prototype={init:function(e,t,n,r){r=r||{};if(this.inited)return;this.factory=t,n?this.on("error",n):this.events.error&&(n=bind(this,function(e){this.emit("error",e)})),this.depMaps=e&&e.slice(0),this.errback=n,this.inited=!0,this.ignore=r.ignore,r.enabled||this.enabled?this.enable():this.check()},defineDep:function(e,t){this.depMatched[e]||(this.depMatched[e]=!0,this.depCount-=1,this.depExports[e]=t)},fetch:function(){if(this.fetched)return;this.fetched=!0,r.startTime=(new Date).getTime();var e=this.map;if(!this.shim)return e.prefix?this.callPlugin():this.load();r.makeRequire(this.map,{enableBuildCallback:!0})(this.shim.deps||[],bind(this,function(){return e.prefix?this.callPlugin():this.load()}))},load:function(){var e=this.map.url;h[e]||(h[e]=!0,r.load(this.map.id,e))},check:function(){if(!this.enabled||this.enabling)return;var e,t,n=this.map.id,i=this.depExports,s=this.exports,o=this.factory;if(!this.inited)this.fetch();else if(this.error)this.emit("error",this.error);else if(!this.defining){this.defining=!0;if(this.depCount<1&&!this.defined){if(isFunction(o)){if(this.events.error&&this.map.isDefine||req.onError!==defaultOnError)try{s=r.execCb(n,o,i,s)}catch(u){e=u}else s=r.execCb(n,o,i,s);this.map.isDefine&&s===undefined&&(t=this.module,t?s=t.exports:this.usingExports&&(s=this.exports));if(e)return e.requireMap=this.map,e.requireModules=this.map.isDefine?[this.map.id]:null,e.requireType=this.map.isDefine?"define":"require",T(this.error=e)}else s=o;this.exports=s,this.map.isDefine&&!this.ignore&&(c[n]=s,req.onResourceLoad&&req.onResourceLoad(r,this.map,this.depMaps)),C(n),this.defined=!0}this.defining=!1,this.defined&&!this.defineEmitted&&(this.defineEmitted=!0,this.emit("defined",this.exports),this.defineEmitComplete=!0)}},callPlugin:function(){var e=this.map,t=e.id,n=E(e.prefix);this.depMaps.push(n),x(n,"defined",bind(this,function(n){var i,s,a,f=getOwn(p,this.map.id),l=this.map.name,c=this.map.parentMap?this.map.parentMap.name:null,h=r.makeRequire(e.parentMap,{enableBuildCallback:!0});if(this.map.unnormalized){n.normalize&&(l=n.normalize(l,function(e){return g(e,c,!0)})||""),s=E(e.prefix+"!"+l,this.map.parentMap),x(s,"defined",bind(this,function(e){this.init([],function(){return e},null,{enabled:!0,ignore:!0})})),a=getOwn(u,s.id),a&&(this.depMaps.push(s),this.events.error&&a.on("error",bind(this,function(e){this.emit("error",e)})),a.enable());return}if(f){this.map.url=r.nameToUrl(f),this.load();return}i=bind(this,function(e){this.init([],function(){return e},null,{enabled:!0})}),i.error=bind(this,function(e){this.inited=!0,this.error=e,e.requireModules=[t],eachProp(u,function(e){e.map.id.indexOf(t+"_unnormalized")===0&&C(e.map.id)}),T(e)}),i.fromText=bind(this,function(n,s){var u=e.name,a=E(u),f=useInteractive;s&&(n=s),f&&(useInteractive=!1),S(a),hasProp(o.config,t)&&(o.config[u]=o.config[t]);try{req.exec(n)}catch(l){return T(makeError("fromtexteval","fromText eval for "+t+" failed: "+l,l,[t]))}f&&(useInteractive=!0),this.depMaps.push(a),r.completeLoad(u),h([u],i)}),n.load(e.name,h,i,o)})),r.enable(n,this),this.pluginMaps[n.id]=n},enable:function(){a[this.map.id]=this,this.enabled=!0,this.enabling=!0,each(this.depMaps,bind(this,function(e,t){var n,s,o;if(typeof e=="string"){e=E(e,this.map.isDefine?this.map:this.map.parentMap,!1,!this.skipMap),this.depMaps[t]=e,o=getOwn(i,e.id);if(o){this.depExports[t]=o(this);return}this.depCount+=1,x(e,"defined",bind(this,function(e){this.defineDep(t,e),this.check()})),this.errback&&x(e,"error",bind(this,this.errback))}n=e.id,s=u[n],!hasProp(i,n)&&s&&!s.enabled&&r.enable(e,this)})),eachProp(this.pluginMaps,bind(this,function(e){var t=getOwn(u,e.id);t&&!t.enabled&&r.enable(e,this)})),this.enabling=!1,this.check()},on:function(e,t){var n=this.events[e];n||(n=this.events[e]=[]),n.push(t)},emit:function(e,t){each(this.events[e],function(e){e(t)}),e==="error"&&delete this.events[e]}},r={config:o,contextName:e,registry:u,defined:c,urlFetched:h,defQueue:l,Module:n,makeModuleMap:E,nextTick:req.nextTick,onError:T,configure:function(e){e.baseUrl&&e.baseUrl.charAt(e.baseUrl.length-1)!=="/"&&(e.baseUrl+="/");var t=o.shim,n={paths:!0,bundles:!0,config:!0,map:!0};eachProp(e,function(e,t){n[t]?(o[t]||(o[t]={}),mixin(o[t],e,!0,!0)):o[t]=e}),e.bundles&&eachProp(e.bundles,function(e,t){each(e,function(e){e!==t&&(p[e]=t)})}),e.shim&&(eachProp(e.shim,function(e,n){isArray(e)&&(e={deps:e}),(e.exports||e.init)&&!e.exportsFn&&(e.exportsFn=r.makeShimExports(e)),t[n]=e}),o.shim=t),e.packages&&each(e.packages,function(e){var t,n;e=typeof e=="string"?{name:e}:e,n=e.name,t=e.location,t&&(o.paths[n]=e.location),o.pkgs[n]=e.name+"/"+(e.main||"main").replace(currDirRegExp,"").replace(jsSuffixRegExp,"")}),eachProp(u,function(e,t){!e.inited&&!e.map.unnormalized&&(e.map=E(t))}),(e.deps||e.callback)&&r.require(e.deps||[],e.callback)},makeShimExports:function(e){function t(){var t;return e.init&&(t=e.init.apply(global,arguments)),t||e.exports&&getGlobal(e.exports)}return t},makeRequire:function(t,n){function s(o,a,f){var l,h,p;return n.enableBuildCallback&&a&&isFunction(a)&&(a.__requireJsBuild=!0),typeof o=="string"?isFunction(a)?T(makeError("requireargs","Invalid require call"),f):t&&hasProp(i,o)?i[o](u[t.id]):req.get?req.get(r,o,t,s):(h=E(o,t,!1,!0),l=h.id,hasProp(c,l)?c[l]:T(makeError("notloaded",'Module name "'+l+'" has not been loaded yet for context: '+e+(t?"":". Use require([])")))):(_(),r.nextTick(function(){_(),p=S(E(null,t)),p.skipMap=n.skipMap,p.init(o,a,f,{enabled:!0}),L()}),s)}return n=n||{},mixin(s,{isBrowser:isBrowser,toUrl:function(e){var n,i=e.lastIndexOf("."),s=e.split("/")[0],o=s==="."||s==="..";return i!==-1&&(!o||i>1)&&(n=e.substring(i,e.length),e=e.substring(0,i)),r.nameToUrl(g(e,t&&t.id,!0),n,!0)},defined:function(e){return hasProp(c,E(e,t,!1,!0).id)},specified:function(e){return e=E(e,t,!1,!0).id,hasProp(c,e)||hasProp(u,e)}}),t||(s.undef=function(e){N();var n=E(e,t,!0),r=getOwn(u,e);y(e),delete c[e],delete h[n.url],delete f[e],eachReverse(l,function(t,n){t[0]===e&&l.splice(n,1)}),r&&(r.events.defined&&(f[e]=r.events),C(e))}),s},enable:function(e){var t=getOwn(u,e.id);t&&S(e).enable()},completeLoad:function(e){var t,n,r,i=getOwn(o.shim,e)||{},s=i.exports;N();while(l.length){n=l.shift();if(n[0]===null){n[0]=e;if(t)break;t=!0}else n[0]===e&&(t=!0);A(n)}r=getOwn(u,e);if(!t&&!hasProp(c,e)&&r&&!r.inited){if(o.enforceDefine&&(!s||!getGlobal(s))){if(b(e))return;return T(makeError("nodefine","No define call for "+e,null,[e]))}A([e,i.deps||[],i.exportsFn])}L()},nameToUrl:function(e,t,n){var i,s,u,a,f,l,c,h=getOwn(o.pkgs,e);h&&(e=h),c=getOwn(p,e);if(c)return r.nameToUrl(c,t,n);if(req.jsExtRegExp.test(e))f=e+(t||"");else{i=o.paths,s=e.split("/");for(u=s.length;u>0;u-=1){a=s.slice(0,u).join("/"),l=getOwn(i,a);if(l){isArray(l)&&(l=l[0]),s.splice(0,u,l);break}}f=s.join("/"),f+=t||(/^data\:|\?/.test(f)||n?"":".js"),f=(f.charAt(0)==="/"||f.match(/^[\w\+\.\-]+:/)?"":o.baseUrl)+f}return o.urlArgs?f+((f.indexOf("?")===-1?"?":"&")+o.urlArgs):f},load:function(e,t){req.load(r,e,t)},execCb:function(e,t,n,r){return t.apply(r,n)},onScriptLoad:function(e){if(e.type==="load"||readyRegExp.test((e.currentTarget||e.srcElement).readyState)){interactiveScript=null;var t=M(e);r.completeLoad(t.id)}},onScriptError:function(e){var t=M(e);if(!b(t.id))return T(makeError("scripterror","Script error for: "+t.id,e,[t.id]))}},r.require=r.makeRequire(),r}function getInteractiveScript(){return interactiveScript&&interactiveScript.readyState==="interactive"?interactiveScript:(eachReverse(scripts(),function(e){if(e.readyState==="interactive")return interactiveScript=e}),interactiveScript)}var req,s,head,baseElement,dataMain,src,interactiveScript,currentlyAddingScript,mainScript,subPath,version="2.1.14",commentRegExp=/(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg,cjsRequireRegExp=/[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,jsSuffixRegExp=/\.js$/,currDirRegExp=/^\.\//,op=Object.prototype,ostring=op.toString,hasOwn=op.hasOwnProperty,ap=Array.prototype,apsp=ap.splice,isBrowser=typeof window!="undefined"&&typeof navigator!="undefined"&&!!window.document,isWebWorker=!isBrowser&&typeof importScripts!="undefined",readyRegExp=isBrowser&&navigator.platform==="PLAYSTATION 3"?/^complete$/:/^(complete|loaded)$/,defContextName="_",isOpera=typeof opera!="undefined"&&opera.toString()==="[object Opera]",contexts={},cfg={},globalDefQueue=[],useInteractive=!1;if(typeof define!="undefined")return;if(typeof requirejs!="undefined"){if(isFunction(requirejs))return;cfg=requirejs,requirejs=undefined}typeof require!="undefined"&&!isFunction(require)&&(cfg=require,require=undefined),req=requirejs=function(e,t,n,r){var i,s,o=defContextName;return!isArray(e)&&typeof e!="string"&&(s=e,isArray(t)?(e=t,t=n,n=r):e=[]),s&&s.context&&(o=s.context),i=getOwn(contexts,o),i||(i=contexts[o]=req.s.newContext(o)),s&&i.configure(s),i.require(e,t,n)},req.config=function(e){return req(e)},req.nextTick=typeof setTimeout!="undefined"?function(e){setTimeout(e,4)}:function(e){e()},require||(require=req),req.version=version,req.jsExtRegExp=/^\/|:|\?|\.js$/,req.isBrowser=isBrowser,s=req.s={contexts:contexts,newContext:newContext},req({}),each(["toUrl","undef","defined","specified"],function(e){req[e]=function(){var t=contexts[defContextName];return t.require[e].apply(t,arguments)}}),isBrowser&&(head=s.head=document.getElementsByTagName("head")[0],baseElement=document.getElementsByTagName("base")[0],baseElement&&(head=s.head=baseElement.parentNode)),req.onError=defaultOnError,req.createNode=function(e,t,n){var r=e.xhtml?document.createElementNS("http://www.w3.org/1999/xhtml","html:script"):document.createElement("script");return r.type=e.scriptType||"text/javascript",r.charset="utf-8",r.async=!0,r},req.load=function(e,t,n){var r=e&&e.config||{},i;if(isBrowser)return i=req.createNode(r,t,n),i.setAttribute("data-requirecontext",e.contextName),i.setAttribute("data-requiremodule",t),i.attachEvent&&!(i.attachEvent.toString&&i.attachEvent.toString().indexOf("[native code")<0)&&!isOpera?(useInteractive=!0,i.attachEvent("onreadystatechange",e.onScriptLoad)):(i.addEventListener("load",e.onScriptLoad,!1),i.addEventListener("error",e.onScriptError,!1)),i.src=n,currentlyAddingScript=i,baseElement?head.insertBefore(i,baseElement):head.appendChild(i),currentlyAddingScript=null,i;if(isWebWorker)try{importScripts(n),e.completeLoad(t)}catch(s){e.onError(makeError("importscripts","importScripts failed for "+t+" at "+n,s,[t]))}},isBrowser&&!cfg.skipDataMain&&eachReverse(scripts(),function(e){head||(head=e.parentNode),dataMain=e.getAttribute("data-main");if(dataMain)return mainScript=dataMain,cfg.baseUrl||(src=mainScript.split("/"),mainScript=src.pop(),subPath=src.length?src.join("/")+"/":"./",cfg.baseUrl=subPath),mainScript=mainScript.replace(jsSuffixRegExp,""),req.jsExtRegExp.test(mainScript)&&(mainScript=dataMain),cfg.deps=cfg.deps?cfg.deps.concat(mainScript):[mainScript],!0}),define=function(e,t,n){var r,i;typeof e!="string"&&(n=t,t=e,e=null),isArray(t)||(n=t,t=null),!t&&isFunction(n)&&(t=[],n.length&&(n.toString().replace(commentRegExp,"").replace(cjsRequireRegExp,function(e,n){t.push(n)}),t=(n.length===1?["require"]:["require","exports","module"]).concat(t))),useInteractive&&(r=currentlyAddingScript||getInteractiveScript(),r&&(e||(e=r.getAttribute("data-requiremodule")),i=contexts[r.getAttribute("data-requirecontext")])),(i?i.defQueue:globalDefQueue).push([e,t,n])},define.amd={jQuery:!0},req.exec=function(text){return eval(text)},req(cfg)})(this),define("requireLib",function(){}),define("app/config",[],function(){return{isDebug:!1,quizFolder:"quiz",configFile:"course",screensFolder:"screens",componentsFolder:"components",templateFile:"template",screenFile:"screen",templateFileSuffix:".html",jsonFileSuffix:".json",requiredPluginName:"text",actionKeyCodes:[13,32],moveBackKeyCodes:[37,38],moveNextKeyCodes:[39,40]}}),define("app/dialog",["toastr"],function(e){e.options.target=$("<div/>").attr("aria-hidden",!0).attr("aria-live","off").appendTo("body");var t="#dialog-alert",n="#dialog-confirm",r="#dialog-confirm-yes",i=undefined,s=undefined,o=function(t){e.info(t)},u=function(t){e.warning(t)},a=function(t){e.success(t)},f=function(t){e.error(t)},l=function(e){return i=$.Deferred(),$(t).find(".modal-body").text(e).end().modal({show:!0}),i.promise()},c=function(e){return s=$.Deferred(),$(n).find(".modal-body").text(e).end().modal({show:!0}),s.promise()},h=function(){$(t).modal({show:!1}).on("hide.bs.modal",function(){i&&i.state()==="pending"&&i.resolve()}).on("shown.bs.modal",function(){$("body").css("padding-right",0)}),$(n).modal({show:!1}).find(r).click(function(){s&&s.state()==="pending"&&s.resolve()}).end().on("hide.bs.modal",function(){s&&s.state()==="pending"&&s.reject()}).on("shown.bs.modal",function(){$("body").css("padding-right",0)})};return{info:o,warning:u,success:a,error:f,alert:l,confirm:c,initialize:h}}),define("app/logger",["app/config","app/dialog"],function(e,t){var n=function(n){e.isDebug&&t.success(n)},r=function(n){e.isDebug&&t.error(n)},i=function(n){e.isDebug&&t.warning(n)},s=function(n){e.isDebug&&t.info(n)},o=function(n,r){e.isDebug&&n&&r&&!n[r]&&t.error('Brak wymaganego parametru: "'+r+'".')};return{success:n,error:r,warning:i,info:s,require:o}}),define("app/json",["jquery","app/logger","app/config"],function(e,t,n){function r(r){r+=n.jsonFileSuffix;var i=new e.Deferred;return require([(n.requiredPluginName?n.requiredPluginName+"!":"")+r],function(e){var n;try{n=JSON.parse(e)}catch(s){t.error("Błąd parsowania pliku json: "+r+"; "+s.message)}n?i.resolve(n):i.reject()}),i.promise()}return{get:r}}),define("app/viewmodels/screen",["jquery","ko","app/logger"],function(e,t,n){var r=function(e){var r=this;n.require(e,"title"),n.require(e,"templatePath"),r.title=e.title,r.templatePath=e.templatePath,r.exercise=e.exercise,r.background=e.background?"url('"+e.background.file+"')"+(e.background.position?" no-repeat "+e.background.position:""):"",r.wordings=e.wordings,r.images=e.images,r.buttons=e.buttons,r.test=e.test,r.sound=e.sound,r.videos=e.videos,r.audio=e.audio,r.allInteractionsVisited=t.computed(function(){if(r.buttons)for(var e in r.buttons)if(!r.buttons[e].isVisited())return!1;if(r.images)for(var e in r.images)if(!r.images[e].isVisited())return!1;if(r.exercise)var n=t.utils.unwrapObservable(r.exercise.answers).map(function(e){return e.image});for(var e in n)if(n[e]&&!n[e].isVisited())return!1;return!0})};return r}),define("app/sound",["app/logger"],function(e){function u(e,t){return e.indexOf(t,e.length-t.length)!==-1}var t=function(t){if(t&&s!=t){n();var r,a;for(var f in t.files){var l=t.files[f];u(l,".mp3")?r=l:u(l,".ogg")&&(a=l)}s=t,i=new Audio,i.canPlayType("audio/mpeg;")&&r?i.src=r:a?i.src=a:e.error("Brak definicji obsługiwanego formatu dźwiekowego."),i.volume=o,i.addEventListener("ended",function(){s=undefined},!1),i.autoplay=!0,i.load()}},n=function(){s&&i&&(i.pause(),s=undefined)},r=function(e){o=e,i&&(i.volume=o)},i,s,o=.5;return{play:t,stop:n,setVolume:r}}),define("app/feedback",["app/sound","app/config","jquery"],function(e,t,n){var r="#feedback-overlay",i="#feedback-success",s="#feedback-success p",o="#feedback-tryagain",u="#feedback-tryagain p",a="#feedback-fail",f="#feedback-fail p",l,c,h=function(t,n,r){return t?(e.play(n.success.sound),c="success",d(n.success.text)):r?(e.play(n.fail.sound),c="fail",m(n.fail.text)):(e.play(n.tryAgain.sound),c="tryAgain",v(n.tryAgain.text))},p=function(e){l=e},d=function(e){n(s).text(e),n(r).addClass("showed"),n(i).show().attr("aria-label",e).focus()},v=function(e){n(u).text(e),n(r).addClass("showed"),n(o).show().attr("aria-label",e).focus()},m=function(e){n(f).text(e),n(r).addClass("showed"),n(a).show().attr("aria-label",e).focus()},g=function(){},y=function(){e.stop(),n(i).hide(),n(o).hide(),n(a).hide(),n(r).removeClass("showed"),typeof l=="function"&&l(c)};return{show:h,onClose:p,initialize:g,close:y}}),define("app/screamer",["jquery"],function(e){var t="#alert",n=function(n){e(t).text(n),setTimeout(function(){e(t).text("")},200)};return{scream:n}}),define("app/viewmodels/exercise",["jquery","ko","app/feedback","app/config","app/logger"],function(e,t,n,r,i){var s=function(e,n){var r=this;i.require(e,"instructions"),i.require(e,"feedback"),i.require(e,"answers"),r.course=n,r.instructions=e.instructions,r.question=e.question,r.feedback=e.feedback,r.maxTries=e.maxTries,r.points=e.points||1,r.autoFeedback=e.autoFeedback,r.clearOnlyWrongAnswers=e.clearOnlyWrongAnswers,r.preventCorrectOnStart=e.preventCorrectOnStart,r.refuseWrongAnswers=e.refuseWrongAnswers,r.multipleAnswersAllowed=e.multipleAnswersAllowed,r.multipleTargetsAllowed=e.multipleTargetsAllowed,r.onlyOneAnswerVisible=e.onlyOneAnswerVisible,r.ignoreCase=e.ignoreCase,r.isChecked=t.observable(!1),r.tries=t.observable(0),r.areTriesLeft=t.computed(function(){return!r.maxTries||t.utils.unwrapObservable(r.tries)<r.maxTries}),r.isCheckFocused=t.observable(!1),r.isClearFocused=t.observable(!1)};return s}),define("app/viewmodels/pickone",["jquery","ko","app/feedback","app/config","app/logger","app/screamer","app/viewmodels/exercise"],function(e,t,n,r,i,s,o){var u=function(i,u){function l(e){return(e.image?e.image.alt:e.text)+", "+(a.selectedAnswer()==e?a.course.caption.picked:a.course.caption.notPicked)}var a=this;o.call(a,i,u),a.answers=(i.shuffleAnswers?shuffle(i.answers):i.answers).map(function(n){return e.extend(n,{label:t.observable()})}),a.selectedAnswer=t.observable();var f=a.answers[0];f.label(l(f)),a.activeAnswer=t.observable(f),a.hasFocus=t.observable(!0),a.isAnswered=t.computed(function(){return!!a.selectedAnswer()}),a.isCorrect=t.computed(function(){var e=t.utils.unwrapObservable(a.selectedAnswer);return e?e.isCorrect:!1}),a.answerClick=function(e){t.utils.unwrapObservable(a.isChecked)||(a.selectedAnswer(e),a.activeAnswer(e),s.scream(a.course.caption.picked))},a.answerKeydown=function(n,i){if(!t.utils.unwrapObservable(a.isChecked))if(e.inArray(i.keyCode,r.actionKeyCodes)>=0)a.answerClick(n);else if(e.inArray(i.keyCode,r.moveBackKeyCodes)>=0){var s=a.answers.indexOf(a.activeAnswer())-1;if(s>=0){var o=a.answers[s];o.label(l(o)),a.activeAnswer(o)}}else if(e.inArray(i.keyCode,r.moveNextKeyCodes)>=0){var s=a.answers.indexOf(a.activeAnswer())+1;if(s<a.answers.length){var o=a.answers[s];o.label(l(o)),a.activeAnswer(o)}}return!0},a.check=t.command({execute:function(){a.isChecked(!0),a.tries(a.tries()+1),n.show(a.isCorrect(),a.feedback,!t.utils.unwrapObservable(a.areTriesLeft))},canExecute:function(){return!a.isChecked()&&a.isAnswered()&&a.areTriesLeft()}}),a.clear=t.command({execute:function(){a.selectedAnswer(undefined),a.isChecked(!1),a.activeAnswer(a.answers[0])},canExecute:function(){return a.isChecked()&&!a.isCorrect()&&a.areTriesLeft()}}),a.getCorrectAnswersCount=function(){var e=t.utils.unwrapObservable(a.selectedAnswer);return e?e.isCorrect?1:0:0},a.getExpectedAnswersCount=function(){return 1},a.getCorrectAnswersPoints=function(){var e=t.utils.unwrapObservable(a.selectedAnswer);return e?e.isCorrect?e.points||1:0:0},a.getExpectedAnswersPoints=function(){for(var e=0;e<a.answers.length;e++){var t=a.answers[e];if(t.isCorrect)return t.points||1}return 0},a.autoFeedback&&a.selectedAnswer.subscribe(function(e){e&&a.check()})};return u}),define("app/viewmodels/pickmany",["jquery","ko","app/feedback","app/config","app/logger","app/screamer","app/viewmodels/exercise"],function(e,t,n,r,i,s,o){var u=function(i,u){function h(e){return(e.image?e.image.alt:e.text)+", "+(a.selectedAnswer.indexOf(e)>=0?a.course.caption.picked:a.course.caption.notPicked)}var a=this;o.call(a,i,u),a.answers=(i.shuffleAnswers?shuffle(i.answers):i.answers).map(function(n){return e.extend(n,{label:t.observable()})}),a.selectedAnswer=t.observableArray();var f=a.answers[0];f.label(h(f)),a.activeAnswer=t.observable(f),a.isAnswered=t.computed(function(){return!!a.selectedAnswer().length}),a.isCorrect=t.computed(function(){var e=0;for(var n in t.utils.unwrapObservable(a.answers)){var r=a.answers[n];if(r.isCorrect){e++;if(a.selectedAnswer().indexOf(r)<0)return!1}}return e==a.selectedAnswer().length}),a.answerClick=function(e){t.utils.unwrapObservable(a.isChecked)||(a.selectedAnswer.indexOf(e)<0?(a.selectedAnswer.push(e),s.scream(a.course.caption.picked)):(a.selectedAnswer.remove(e),s.scream(a.course.caption.notPicked)))},a.answerKeydown=function(n,i){if(!t.utils.unwrapObservable(a.isChecked))if(e.inArray(i.keyCode,r.actionKeyCodes)>=0)a.answerClick(n);else if(e.inArray(i.keyCode,r.moveBackKeyCodes)>=0){var s=a.answers.indexOf(a.activeAnswer())-1;if(s>=0){var o=a.answers[s];o.label(h(o)),a.activeAnswer(o)}}else if(e.inArray(i.keyCode,r.moveNextKeyCodes)>=0){var s=a.answers.indexOf(a.activeAnswer())+1;if(s<a.answers.length){var o=a.answers[s];o.label(h(o)),a.activeAnswer(o)}}return!0},a.check=t.command({execute:function(){a.isChecked(!0),a.tries(a.tries()+1),n.show(a.isCorrect(),a.feedback,!t.utils.unwrapObservable(a.areTriesLeft))},canExecute:function(){return!a.isChecked()&&a.isAnswered()&&a.areTriesLeft()}}),a.clear=t.command({execute:function(){a.clearOnlyWrongAnswers?a.selectedAnswer(l()):a.selectedAnswer.removeAll(),a.isChecked(!1),a.activeAnswer(a.answers[0])},canExecute:function(){return a.isChecked()&&!a.isCorrect()&&a.areTriesLeft()}}),a.getCorrectAnswersCount=function(){return l().length},a.getExpectedAnswersCount=function(){return c().length},a.getCorrectAnswersPoints=function(){var e=0,t=l();for(var n=0;n<t.length;n++)e+=t[n].points||1;return e},a.getExpectedAnswersPoints=function(){var e=0,t=c();for(var n=0;n<t.length;n++)e+=t[n].points||1;return e};var l=function(){var e=[],n=t.utils.unwrapObservable(a.selectedAnswer);for(var r in n){var i=n[r];i.isCorrect&&e.push(i)}return e},c=function(){var e=[];for(var t=0;t<a.answers.length;t++){var n=a.answers[t];n.isCorrect&&e.push(n)}return e}};return u}),define("app/viewmodels/order",["app/feedback","app/config","app/screamer","app/viewmodels/exercise","jquery","ko"],function(e,t,n,r,i,s){var o=function(o,u){function h(e){for(var t in e){var n=e[t];if(n.order!=parseInt(t)+1)return!1}return!0}function p(e,t){return(e.image?e.image.alt:e.text)+", "+a.course.caption.numerals[t]+", "+(a.selectedAnswer()==e?a.course.caption.selected:a.course.caption.notSelected)}var a=this;r.call(a,o,u);var f=o.answers;if(o.shuffleAnswers){f=shuffle(o.answers);if(a.preventCorrectOnStart)while(h(f))f=shuffle(o.answers)}a.answers=s.observableArray(f.map(function(e){return i.extend(e,{label:s.observable()})})),a.initialOrder=[];for(var l in o.answers)a.initialOrder.push(o.answers[l].order);a.selectedAnswer=s.observable();var c=a.answers()[0];c.label(p(c,0)),a.activeAnswer=s.observable(c),a.isAnswered=s.computed(function(){if(a.preventCorrectOnStart){var e=s.utils.unwrapObservable(a.answers);for(var t in e)if(e[t].order!=a.initialOrder[t])return!0;return!1}return!0}),a.isNotChecked=s.computed(function(){return!a.isChecked()}),a.isCorrect=s.computed(function(){return h(s.utils.unwrapObservable(a.answers))}),a.dragStart=function(e){i(e.target).find(".animation").addClass("showed")},a.answerKeydown=function(e,r){if(!s.utils.unwrapObservable(a.isChecked))if(i.inArray(r.keyCode,t.actionKeyCodes)>=0){var o=a.selectedAnswer();if(!o)a.selectedAnswer(e),n.scream(a.course.caption.selected);else if(o==e)a.selectedAnswer(null),n.scream(a.course.caption.notSelected);else{var u=a.answers.indexOf(o),f=a.answers.indexOf(e),l=a.answers();u<f?(l.splice(f,1),l.splice(u,1,e),l.splice(f,0,o)):(l.splice(u,1),l.splice(f,1,o),l.splice(u,0,e)),a.answers(l),a.selectedAnswer(null),n.scream(a.course.caption.notSelected),setTimeout(function(){o.label(p(o,f)),a.activeAnswer(o)},200)}}else if(i.inArray(r.keyCode,t.moveBackKeyCodes)>=0){var l=a.answers(),c=l.indexOf(a.activeAnswer())-1;if(c>=0){var h=l[c];h.label(p(h,c)),a.activeAnswer(h)}}else if(i.inArray(r.keyCode,t.moveNextKeyCodes)>=0){var l=a.answers(),c=l.indexOf(a.activeAnswer())+1;if(c<l.length){var h=l[c];h.label(p(h,c)),a.activeAnswer(h)}}return!0},a.check=s.command({execute:function(){a.isChecked(!0),a.tries(a.tries()+1),e.show(a.isCorrect(),a.feedback,!s.utils.unwrapObservable(a.areTriesLeft))},canExecute:function(){return!a.isChecked()&&a.isAnswered()&&a.areTriesLeft()}}),a.clear=s.command({execute:function(){a.answers.sort(function(e,t){return a.initialOrder.indexOf(e.order)<a.initialOrder.indexOf(t.order)?-1:1}),a.isChecked(!1),a.activeAnswer(a.answers()[0])},canExecute:function(){return a.isChecked()&&!a.isCorrect()&&a.areTriesLeft()}}),a.getCorrectAnswersCount=function(){var e=0,t=s.utils.unwrapObservable(a.answers);for(var n=0;n<t.length;n++){var r=t[n];r.order==parseInt(n)+1&&e++}return e},a.getExpectedAnswersCount=function(){return s.utils.unwrapObservable(a.answers).length},a.getCorrectAnswersPoints=function(){var e=0,t=s.utils.unwrapObservable(a.answers);for(var n=0;n<t.length;n++){var r=t[n];r.order==parseInt(n)+1&&(e+=t[n].points||1)}return e},a.getExpectedAnswersPoints=function(){var e=0,t=s.utils.unwrapObservable(a.answers);for(var n=0;n<t.length;n++)e+=t[n].points||1;return e}};return o}),define("app/viewmodels/draganddrop",["app/feedback","app/config","app/screamer","app/viewmodels/exercise","jquery","ko"],function(e,t,n,r,i,s){var o=function(o,u){function p(e){return e.image?e.image.alt:e.text}function d(e){var t=e.answers();return e.text+(t.length?", "+a.course.caption.selectedAnswers+", "+t.map(function(e){return e.image?e.image.alt:e.text}).join(", "):"")}var a=this;r.call(a,o,u),a.originalAnswers=o.answers.map(function(e){return{id:e.id,points:e.points}});var f=o.answers.map(function(e){return i.extend(e,{label:p(e)})});a.answers=o.shuffleAnswers?s.observableArray(shuffle(f)):s.observableArray(f),a.targets=[];for(var l in o.targets){var c=o.targets[l];a.targets.push(new function(){var e=this;e.label=s.observable(),e.text=c.text,e.correctAnswers=c.correctAnswers,e.answers=s.observableArray(),e.beforeMove=function(t){if(e.answers.indexOf(t.item)>=0)t.cancelDrop=!0;else if(!a.multipleAnswersAllowed&&e.answers().length>0){var n=e.answers()[0];e.answers.removeAll(),t.sourceParent.indexOf(n)<0&&setTimeout(function(){t.sourceParent.push(n)},200),a.multipleTargetsAllowed&&a.targets.map(function(e){return e.answers}).indexOf(t.sourceParent)<0&&(t.cancelDrop=!0,e.answers.push(t.item))}else a.refuseWrongAnswers&&e.correctAnswers.indexOf(t.item.id)<0?t.cancelDrop=!0:a.multipleTargetsAllowed&&a.targets.map(function(e){return e.answers}).indexOf(t.sourceParent)<0&&(t.cancelDrop=!0,e.answers.push(t.item))}})}a.selectedAnswer=s.observable();var h=a.answers()[0];a.activeAnswer=s.observable(h),a.selectedTarget=s.observable(),a.activeTarget=s.observable(),a.isAnswered=s.computed(function(){for(var e in a.targets)if(a.targets[e].answers().length)return!0;return!1}),a.isNotChecked=s.computed(function(){return!a.isChecked()}),a.isCorrect=s.computed(function(){for(var e in a.targets){var t=a.targets[e],n=s.utils.unwrapObservable(t.answers).map(function(e){return s.utils.unwrapObservable(e).id});for(var r in n)if(t.correctAnswers.indexOf(n[r])<0)return!1;for(var r in t.correctAnswers)if(n.indexOf(t.correctAnswers[r])<0)return!1}return!0}),a.dragStart=function(e){i(e.target).removeClass("animation").find(".animation").removeClass("animation")},a.dragStop=function(){window.copyPlaceholder&&window.copyPlaceholder.remove()},a.targetKeydown=function(e,r){if(!s.utils.unwrapObservable(a.isChecked))if(i.inArray(r.keyCode,t.actionKeyCodes)>=0){var o=a.selectedAnswer(),u=a.selectedTarget();if(o&&e.answers.indexOf(o)<0&&(!a.refuseWrongAnswers||e.correctAnswers.indexOf(o.id)>=0)){if(!a.multipleAnswersAllowed&&e.answers().length>0){var f=e.answers()[0];e.answers.removeAll();var l=u?u.answers:a.answers;l.indexOf(f)<0&&l.push(f)}e.answers.push(o),!u&&!a.multipleTargetsAllowed?a.answers.splice(a.answers.indexOf(o),1):u&&u.answers.splice(u.answers.indexOf(o),1),a.selectedAnswer(null),a.selectedTarget(null),setTimeout(function(){var e=a.answers();e.length>0?(n.scream(a.course.caption.notSelected+", "+a.course.caption.answerList),setTimeout(function(){a.activeAnswer(e[0]),a.activeTarget(null),i(".spread").each(function(){i(this).data().widthSet||i(this).data({widthSet:!0}).css({width:100/(i(this).siblings().length+1)+"%"})})},200)):(n.scream(a.course.caption.notSelected),setTimeout(function(){!a.course.isTestEnabled&&!a.course.feedbackOnGoForward?a.isCheckFocused(!0):a.course.isGoForwardFocused(!0),a.activeTarget(null),i(".spread").each(function(){i(this).data().widthSet||i(this).data({widthSet:!0}).css({width:100/(i(this).siblings().length+1)+"%"})})},200))},200)}}else if(i.inArray(r.keyCode,t.moveBackKeyCodes)>=0){var c=a.targets.indexOf(a.activeTarget())-1;if(c>=0){var h=a.targets[c];h.label(d(h)),a.activeTarget(h)}}else if(i.inArray(r.keyCode,t.moveNextKeyCodes)>=0){var c=a.targets.indexOf(a.activeTarget())+1;if(c<a.targets.length){var h=a.targets[c];h.label(d(h)),a.activeTarget(h)}}return!0},a.answerKeydown=function(e,r){if(!s.utils.unwrapObservable(a.isChecked))if(i.inArray(r.keyCode,t.actionKeyCodes)>=0)a.selectedAnswer(e),a.selectedTarget(null),a.activeAnswer(null),n.scream(a.course.caption.selected+", "+a.course.caption.targetList),setTimeout(function(){var e=a.targets[0];e.label(d(e)),a.activeTarget(e)},200);else if(i.inArray(r.keyCode,t.moveBackKeyCodes)>=0){if(a.multipleTargetsAllowed||!a.onlyOneAnswerVisible){var o=a.answers(),u=o.indexOf(a.activeAnswer())-1;u>=0&&a.activeAnswer(o[u])}}else if(i.inArray(r.keyCode,t.moveNextKeyCodes)>=0)if(a.multipleTargetsAllowed||!a.onlyOneAnswerVisible){var o=a.answers(),u=o.indexOf(a.activeAnswer())+1;u<o.length&&a.activeAnswer(o[u])}return!0},a.targetAnswerKeydown=function(e,n,r){return s.utils.unwrapObservable(a.isChecked)||i.inArray(r.keyCode,t.actionKeyCodes)>=0&&(a.selectedAnswer(e),a.selectedTarget(n)),!0},a.check=s.command({execute:function(){e.show(a.isCorrect(),a.feedback,!s.utils.unwrapObservable(a.areTriesLeft)),a.tries(a.tries()+1),a.isChecked(!0)},canExecute:function(){return!a.isChecked()&&a.isAnswered()&&a.areTriesLeft()}}),a.clear=s.command({execute:function(){a.isClearFocused(!1);if(a.clearOnlyWrongAnswers)for(var e in a.targets){var t=a.targets[e],n=s.utils.unwrapObservable(t.answers),r=[];for(var o in n){var u=s.utils.unwrapObservable(n[o]);t.correctAnswers.indexOf(u.id)<0&&(r.push(u),a.multipleTargetsAllowed||a.answers.push(u))}t.answers.removeAll(r)}else for(var e in a.targets){if(!a.multipleTargetsAllowed){var f=a.targets[e].answers();for(var o in f)a.answers.push(f[o])}a.targets[e].answers.removeAll()}a.isChecked(!1),a.activeTarget(null),setTimeout(function(){a.activeAnswer(a.answers()[0]),i(".spread").each(function(){i(this).data().widthSet||i(this).data({widthSet:!0}).css({width:100/(i(this).siblings().length+1)+"%"})})},200)},canExecute:function(){return a.isChecked()&&!a.isCorrect()&&a.areTriesLeft()}}),a.getCorrectAnswersCount=function(){var e=0;for(var t=0;t<a.targets.length;t++){var n=a.targets[t],r=s.utils.unwrapObservable(n.answers).map(function(e){return s.utils.unwrapObservable(e).id});for(var i=0;i<r.length;i++)n.correctAnswers.indexOf(r[i])>=0&&e++}return e},a.getExpectedAnswersCount=function(){var e=0;for(var t=0;t<a.targets.length;t++)e+=a.targets[t].correctAnswers.length;return e},a.getCorrectAnswersPoints=function(){var e=0;for(var t=0;t<a.targets.length;t++){var n=a.targets[t],r=s.utils.unwrapObservable(n.answers);for(var i=0;i<r.length;i++){var o=r[i];n.correctAnswers.indexOf(o.id)>=0&&(e+=o.points||1)}}return e},a.getExpectedAnswersPoints=function(){var e=0,t=a.originalAnswers;for(var n=0;n<a.targets.length;n++){var r=a.targets[n].correctAnswers;for(var i=0;i<r.length;i++){var s=r[i];for(var o=0;o<t.length;o++){var u=t[o];if(u.id==s){e+=u.points||1;break}}}}return e}};return o}),define("app/viewmodels/fill",["jquery","ko","app/feedback","app/viewmodels/exercise"],function(e,t,n,r){var i=function(i,s){var o=this;r.call(o,i,s),o.correctAnswers=i.answers,o.answers=[];for(var u in i.answers)o.answers.push(t.observable());o.activeAnswer=t.observable(o.answers[0]),o.isAnswered=t.computed(function(){for(var e in o.answers)if(!o.answers[e]())return!1;return!0}),o.isCorrect=function(){for(var e in o.answers)if(!a(e))return!1;return!0},o.check=t.command({execute:function(){o.isChecked(!0),o.tries(o.tries()+1),n.show(o.isCorrect(),o.feedback,!t.utils.unwrapObservable(o.areTriesLeft))},canExecute:function(){return!o.isChecked()&&o.isAnswered()&&o.areTriesLeft()}}),o.clear=t.command({execute:function(){if(o.clearOnlyWrongAnswers)for(var t in o.answers)a(t)||o.answers[t]("");else for(var t in o.answers)o.answers[t]("");o.isChecked(!1),e("[tabindex]",e(".content-container")).first().focus()},canExecute:function(){return o.isChecked()&&!o.isCorrect()&&o.areTriesLeft()}}),o.getCorrectAnswersCount=function(){var e=0;for(var t=0;t<o.answers.length;t++)a(t)&&e++;return e},o.getExpectedAnswersCount=function(){return o.correctAnswers.length},o.getCorrectAnswersPoints=function(){var e=0;for(var t=0;t<o.answers.length;t++)a(t)&&(e+=o.correctAnswers[t].points||1);return e},o.getExpectedAnswersPoints=function(){var e=0;for(var t=0;t<o.correctAnswers.length;t++)e+=o.correctAnswers[t].points||1;return e},o.answerBlur=function(e,t){o.activeAnswer(e)};var a=function(e){var n=t.utils.unwrapObservable(o.answers[e]);return o.ignoreCase?n&&n.toLowerCase()==o.correctAnswers[e].text.toLowerCase():n&&n==o.correctAnswers[e].text}};return i}),define("app/popup",["app/logger","app/sound","app/config","jquery"],function(e,t,n,r){var i="#popup",s=function(e){r(i).modal("show").find(".modal-title").text(e.header).end().find(".modal-body").text(e.body).end()},o=function(){r(i).modal({show:!1}).on("hidden.bs.modal",function(){r(i).attr("aria-hidden","true"),t.stop()}).click(function(){return r(this).modal("hide"),!1}).on("keydown",function(e){if(r.inArray(e.keyCode,n.actionKeyCodes)>=0)return r(this).modal("hide"),!1})};return{show:s,initialize:o}}),define("app/viewmodels/button",["app/sound","app/popup","app/logger"],function(e,t,n){var r=function(r){var i=this;n.require(r,"text"),r.popup&&r.tooltip&&n.error('Dozwolony jest maksymalnie jeden z parametrów: "popup", "tooltip".'),i.text=r.text,i.sound=r.sound,i.popup=r.popup,i.tooltip=r.tooltip,i.click=function(n,r){i.sound&&e.play(i.sound);if(i.popup)t.show(i.popup);else if(i.tooltip){var s=$(r.currentTarget);s.data("bs.popover")||s.popover({title:i.tooltip.title,content:i.tooltip.body,placement:i.tooltip.position||"top",trigger:"manual"}).blur(function(){$(this).popover("hide")}).on("hide.bs.popover",function(){i.sound&&e.stop()}),s.popover("toggle")}i.isVisited(!0)},i.isVisited=ko.observable(!(i.sound||i.popup||i.tooltip))};return r}),define("app/viewmodels/image",["app/sound","app/popup","app/logger","app/config"],function(e,t,n,r){var i=function(i){function o(){if(s.sound&&s.sound.activation!="hover"||s.popup||s.tooltip)s.sound&&s.sound.activation!="hover"&&e.play(s.sound),s.popup?t.show(s.popup):s.tooltip&&($link.data("bs.popover")||$link.popover({title:s.tooltip.title,content:s.tooltip.body,placement:s.tooltip.position||"top",trigger:"manual"}).blur(function(){$(this).popover("hide")}).on("hide.bs.popover",function(){s.sound&&e.stop()}),$link.popover("toggle")),s.isVisited(!0)}var s=this;n.require(i,"file"),i.popup&&i.tooltip&&n.error('Dozwolony jest maksymalnie jeden z parametrów: "popup", "tooltip".'),s.file=i.file,s.alt=i.alt,s.width=i.width,s.height=i.height,s.sound=i.sound,s.popup=i.popup,s.tooltip=i.tooltip,s.hasInteraction=s.sound||s.popup||s.tooltip,s.click=function(){o()},s.keydown=function(e,t){return $.inArray(t.keyCode,r.actionKeyCodes)>=0&&o(),!0},s.focus=function(){s.sound&&s.sound.activation=="hover"&&(e.play(s.sound),s.isVisited(!0))},s.blur=function(){s.sound&&s.sound.activation=="hover"&&e.stop()},s.isVisited=ko.observable(!(s.sound||s.popup||s.tooltip))};return i}),define("app/viewmodels/sound",["app/logger"],function(e){var t=function(t){var n=this;e.require(t,"files"),t.files&&t.files.length<1&&e.error("Kolekcja plików musi zawierać przynajmniej jeden element."),n.files=t.files,n.activation=t.activation};return t}),define("app/viewmodels/video",["app/logger"],function(e){var t=function(t){var n=this;e.require(t,"files"),t.files&&t.files.length<1&&e.error("Kolekcja plików musi zawierać przynajmniej jeden element."),n.files=t.files,n.width=t.width,n.height=t.height};return t}),define("app/viewmodels/audio",["app/logger"],function(e){var t=function(t){var n=this;e.require(t,"files"),t.files&&t.files.length<1&&e.error("Kolekcja plików musi zawierać przynajmniej jeden element."),n.files=t.files};return t}),define("app/viewmodels/feedback",["app/logger","app/feedback"],function(e,t){var n=function(t){var n=this;e.require(t,"success"),t.success&&!t.success.text&&e.error('Brak wymaganego parametru: "success.text".'),e.require(t,"tryAgain"),t.tryAgain&&!t.tryAgain.text&&e.error('Brak wymaganego parametru: "tryAgain.text".'),e.require(t,"fail"),t.fail&&!t.fail.text&&e.error('Brak wymaganego parametru: "fail.text".'),n.success=t.success,n.tryAgain=t.tryAgain,n.fail=t.fail};return n}),define("app/screenLoader",["app/config","app/json","app/logger","app/viewmodels/screen","app/viewmodels/pickone","app/viewmodels/pickmany","app/viewmodels/order","app/viewmodels/draganddrop","app/viewmodels/fill","app/viewmodels/button","app/viewmodels/image","app/viewmodels/sound","app/viewmodels/video","app/viewmodels/audio","app/viewmodels/feedback","jquery"],function(e,t,n,r,i,s,o,u,a,f,l,c,h,p,d,v){var m=function(e,t,n){return e&&v.isArray(e)?e.map(function(e){return t(e,n)}):undefined},g=function(e,t){return e?v.extend(e,{file:e.file?t+e.file:undefined}):undefined},y=function(e,t){return e?new l(v.extend(e,{file:N(e.file,t),sound:w(e.sound,t)})):undefined},b=function(e,t){return e?new f(v.extend(e,{sound:w(e.sound,t)})):undefined},w=function(e,t){return e?new c(v.extend(e,{files:m(e.files,N,t)})):undefined},E=function(e,t){return e?new h(v.extend(e,{files:m(e.files,N,t)})):undefined},S=function(e,t){return e?new p(v.extend(e,{files:m(e.files,N,t)})):undefined},x=function(e,t){return e?new d(v.extend(e,{success:e.success&&e.success.sound?v.extend(e.success,{sound:w(e.success.sound,t)}):undefined,tryAgain:e.tryAgain&&e.tryAgain.sound?v.extend(e.tryAgain,{sound:w(e.tryAgain.sound,t)}):undefined,fail:e.fail&&e.fail.sound?v.extend(e.fail,{sound:w(e.fail.sound,t)}):undefined})):undefined},T=function(e,t){return e?v.extend(e,{image:y(e.image,t)}):undefined},N=function(e,t){return e?t+e:undefined},C=function(f,l){var c=e.quizFolder+"/"+e.screensFolder+"/",h=c+f+"/";return t.get(h+e.screenFile).then(function(t){var f;if(t.exercise)switch(t.exercise.type){case"pickone":f=i;break;case"pickmany":f=s;break;case"order":f=o;break;case"draganddrop":f=u;break;case"fill":f=a;break;default:return n.error("Nieznany typ ćwiczenia: "+exercise.type+"."),null}var c=new r(v.extend(t,{templatePath:h+"/"+e.templateFile,background:g(t.background,h),images:m(t.images,y,h),buttons:m(t.buttons,b,h),sound:w(t.sound,h),videos:m(t.videos,E,h),audio:m(t.audio,S,h),exercise:t.exercise?new f(v.extend(t.exercise,{feedback:x(t.exercise.feedback,h),answers:m(t.exercise.answers,T,h)}),l):undefined}));return c})};return{load:C}}),define("app/lms",["jquery","pipwerks","app/logger","app/dialog","app/config"],function(e,t,n,r,i){var s="1.2",o="cmi.core.lesson_status",u="incomplete",a="completed",f="cmi.core.student_name",l="cmi.core.score.min",c="cmi.core.score.max",h="cmi.core.score.raw",p="cmi.core.exit",d="suspend",v="logout",m=t.SCORM;return _isConnected=!1,_isUnloaded=!1,_handleError=function(){var e=t.SCORM.debug.getCode();return e?(n.error(t.SCORM.debug.getInfo(e)+"/n"+t.SCORM.debug.getDiagnosticInfo(e)),!0):!1},_setDefaults=function(){m.version=s,t.debug.isActive=i.isDebug},_connect=function(){return _isConnected=m.init()},_getValue=function(e){var t=m.get(e);return!t&&_handleError()?!1:t},_setValue=function(e,t){return m.set(e,t)?!0:(_handleError(),!1)},_commitChanges=function(){return m.save()?!0:(_handleError(),!1)},_disconnect=function(){return m.quit()?(_isConnected=!1,!0):(_handleError(),!1)},startSession=function(){_setDefaults(),_connect();if(_isConnected){n.info("Połączono z LMS.");var e=_getValue(o);e&&(n.info("Nazwa użytkownika: "+_getValue(f)),e==a&&n.info("Ponowny start kursu."),_setValue(o,u),_setValue(l,0),_setValue(c,100),_commitChanges())}else n.warning("Nie udało się połączyć z LMS.")},reportResult=function(e){_isConnected&&(n.info("Synchronizacja wyniku z LMS."),_setValue(h,e),_setValue(o,a),_setValue(p,v),_commitChanges(),_disconnect(),n.info("Rozłączono z LMS."))},e(window).on("unload beforeunload",function(){_isConnected&&(_setValue(p,d),_commitChanges(),_disconnect(),n.info("Rozłączono z LMS."))}),{startSession:startSession,reportResult:reportResult}}),define("app/viewmodels/course",["jquery","ko","modernizr","app/screenLoader","app/logger","app/feedback","app/dialog","app/sound","app/lms","app/config"],function(e,t,n,r,i,s,o,u,a,f){var l=function(l){function h(t){e("html, body").scrollTop(0),u.stop();if(t<c.screens.length){var n=c.screens[t];d(n)}else r.load(c.screenNames[t],c).then(function(e){c.screens.push(e),d(e)})}function p(t){e("#focus-placeholder").focus(),setTimeout(function(){c.isChangingScreen(!0),c.currentScreenIndex(t),e(".animation").removeClass("showed"),c.areTransitionsSupported||h(t)},200)}function d(e){c.currentScreen(e),e.sound&&u.play(e.sound),document.title=c.courseTitle+" - "+e.title}function v(e){var t;for(var n in c.test.feedbacks){t=c.test.feedbacks[n];if(!t.percentage||e>=t.percentage){c.testFeedback(t.text),c.isTestSuccessful(!!t.percentage);break}}a.reportResult(e);for(var n in c.screens){var r=c.screens[n];r.exercise&&r.exercise.isChecked(!0)}c.isTestFinished(!0),u.play(t.sound)}var c=this;i.require(l,"courseTitle"),i.require(l,"lang"),i.require(l,"caption"),i.require(l,"screenNames"),e("html").attr("lang",l.lang),c.areTransitionsSupported=n.csstransitions,c.courseTitle=l.courseTitle,c.caption=l.caption,c.isTestEnabled=l.isTestEnabled,c.test=l.test,c.forceAnswer=l.forceAnswer,c.autoClearWrongAnswer=l.autoClearWrongAnswer,c.autoGoForward=l.autoGoForward,c.feedbackOnGoForward=l.feedbackOnGoForward,c.forceVisitAllInteractions=l.forceVisitAllInteractions,c.screenNames=l.screenNames,c.screensCount=l.screenNames.length,c.screens=[],c.currentScreen=t.observable(),c.currentScreenIndex=t.observable(),c.isTestFinished=t.observable(!1),c.testFeedback=t.observable(),c.isTestSuccessful=t.observable(),c.finishTest=t.command({execute:function(){var e=0,n=0,r=0,s=0,u=0,a=0,l=0,h=0,p=0;for(var d in c.screens){var m=c.screens[d];m.exercise&&(t.utils.unwrapObservable(m.exercise.isAnswered)&&(n++,t.utils.unwrapObservable(m.exercise.isCorrect)&&(r++,u+=m.exercise.points)),a+=m.exercise.getExpectedAnswersCount(),l+=m.exercise.getCorrectAnswersCount(),h+=m.exercise.getExpectedAnswersPoints(),p+=m.exercise.getCorrectAnswersPoints(),e++,s+=m.exercise.points)}f.isDebug&&i.info("Podsumowanie szkolenia:<br>"+n+"/"+e+" wykonanych ćwiczeń<br>"+r+"/"+e+" poprawnych ćwiczeń<br>"+u+"/"+s+" punktów za ćwiczenia<br>"+l+"/"+a+" poprawnych odpowiedzi<br>"+p+"/"+h+" punktów za odpowiedzi");if(c.test.forceAllAnswers&&n<e)o.alert(c.caption.allAnswersRequired);else{var g;if(c.test.scoreType==="points")g=u*100/s;else if(c.test.scoreType==="exercises")g=r*100/e;else if(c.test.scoreType==="answers")g=l*100/a;else{if(c.test.scoreType!=="answerPoints"){i.error("Nieznany typ punktowania: "+c.test.scoreType);return}g=p*100/h}n===e?v(g):o.confirm(c.caption.notAllAnsweredPrompt).then(function(){v(g)})}},canExecute:function(){return c.isTestEnabled&&!c.isTestFinished()}}),c.isChangingScreen=t.observable(!0),c.goBack=t.command({execute:function(){var e=c.currentScreenIndex()-1;p(e)},canExecute:function(){return!c.isChangingScreen()&&c.currentScreenIndex()>0}}),c.isGoForwardFocused=t.observable(!1),c.goForward=t.command({execute:function(){var e=t.utils.unwrapObservable(c.currentScreen);if(!c.isTestEnabled&&c.feedbackOnGoForward&&e&&e.exercise&&e.exercise.check.canExecute())e.exercise.check.execute();else{e.exercise&&f.isDebug&&i.info('Podsumowanie ekranu "'+e.title+'"<br>'+e.exercise.getCorrectAnswersCount()+"/"+e.exercise.getExpectedAnswersCount()+" poprawnych odpowiedzi<br>"+e.exercise.getCorrectAnswersPoints()+"/"+e.exercise.getExpectedAnswersPoints()+" punktów");var n=c.currentScreenIndex()+1;p(n)}},canExecute:function(){var e=t.utils.unwrapObservable(c.currentScreen),n=!c.isChangingScreen()&&c.currentScreenIndex()<c.screensCount-1;return n&&c.forceAnswer&&e&&e.exercise&&(n&=e.exercise.isAnswered(),n&&!c.isTestEnabled&&(n&=e.exercise.isChecked())),n&&c.forceVisitAllInteractions&&(n&=e.allInteractionsVisited()),n}}),c.start=function(){c.currentScreenIndex(0),h(0)},c.screenRendered=function(){setTimeout(function(){e(".animation").addClass("showed"),e(".spread").each(function(){e(this).data().widthSet||e(this).data({widthSet:!0}).css({width:100/(e(this).siblings().length+1)+"%"})}),c.areTransitionsSupported||(c.isChangingScreen(!1),e("body").find("[tabindex]").first().focus())},300)},s.onClose(function(e){if(e=="success"||e=="fail")c.autoGoForward||c.feedbackOnGoForward?c.goForward.canExecute()&&c.goForward.execute():c.isGoForwardFocused(!0);else{var n=t.utils.unwrapObservable(c.currentScreen);c.autoClearWrongAnswer?n&&n.exercise&&n.exercise.clear.canExecute()&&n.exercise.clear.execute():n&&n.exercise&&n.exercise.isClearFocused(!0)}}),e(function(){c.areTransitionsSupported&&e("#content").on("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd",function(t){if(e(t.target).is("#content"))if(e(this).hasClass("showed"))c.isChangingScreen(!1),e("body").find("[tabindex]").first().focus();else{var n=c.currentScreenIndex();h(n)}})})};return l}),define("app/courseLoader",["app/config","app/json","app/logger","app/viewmodels/course"],function(e,t,n,r){var i=function(){return n.info("Wczytuję kurs..."),t.get(e.quizFolder+"/"+e.configFile).then(function(t){if(t.test&&t.test.feedbacks)for(var i in t.test.feedbacks){var s=t.test.feedbacks[i];if(s.sound)for(var o in s.sound.files)s.sound.files[o]=e.quizFolder+"/"+s.sound.files[o]}var u=new r(t);return n.info("Kurs wczytany."),u})};return{load:i}}),define("app/bootstrapper",["app/courseLoader","app/lms","app/logger","jquery","ko"],function(e,t,n,r,i){function s(){return e.load().then(function(e){i.applyBindings(e),e.start()})}return{run:s}}),define("knockout-amd-helpers",["knockout"],function(e){var t=window.require||window.curl,n=e.utils.unwrapObservable,r=function(e,t){var n,r=function(){return e.apply(this,t||[])};return r.prototype=e.prototype,n=new r,n.constructor=e,n},i=function(e){return e&&e.replace(/\/?$/,"/")},s=function(t){var n=e.virtualElements.firstChild(t);while(n){if(n.nodeType===1||n.nodeType===8)return!0;n=e.virtualElements.nextSibling(n)}return!1};e.bindingHandlers.module={init:function(o,u,a,f,l){var c,h,p=n(u()),d={},v=e.bindingHandlers.module.initializer,m=e.bindingHandlers.module.disposeMethod;return d.templateEngine=p&&p.templateEngine,d.templateProperty=e.bindingHandlers.module.templateProperty,d.afterRender=function(){var e=n(u());e&&typeof e.afterRender=="function"&&e.afterRender.apply(this,arguments)},s(o)||(d.name=function(){var e=n(u());return(e&&typeof e=="object"?n(e.template||e.name):e)||""}),d.data=e.observable(),d["if"]=d.data,e.applyBindingsToNode(o,{template:d},c=l.extend({$module:null})),h=function(){e.computed(function(){var e=d.data();e&&(typeof e[m]=="function"&&(e[m].call(e),e=null),d.data(null))}).dispose()},e.computed({read:function(){var s,o=n(u());o&&typeof o=="object"&&(v=o.initializer||v,m=o.disposeMethod||m,d.templateProperty=e.unwrap(o.templateProperty)||d.templateProperty,s=[].concat(n(o.data)),o=n(o.name)),h(),o&&t([i(e.bindingHandlers.module.baseDir)+o],function(e){typeof e=="function"?e=r(e,s):e&&e[v]&&(e=e[v].apply(e,s||[])||e),c.$module=e,d.data(e)})},disposeWhenNodeIsRemoved:o}),e.utils.domNodeDisposal.addDisposeCallback(o,h),{controlsDescendantBindings:!0}},baseDir:"",initializer:"initialize",disposeMethod:"dispose",templateProperty:""},e.virtualElements&&(e.virtualElements.allowedBindings.module=!0),function(e,t){var n=new e.nativeTemplateEngine,r={};n.defaultPath="templates",n.defaultSuffix=".tmpl.html",n.defaultRequireTextPluginName="text",e.templateSources.requireTemplate=function(t){this.key=t,this.template=e.observable(" "),this.requested=!1,this.retrieved=!1},e.templateSources.requireTemplate.prototype.text=function(e){!this.requested&&this.key&&(t([n.defaultRequireTextPluginName+"!"+i(n.defaultPath)+this.key+n.defaultSuffix],function(e){this.retrieved=!0,this.template(e)}.bind(this)),this.requested=!0),this.key||this.template("");if(arguments.length===0)return this.template()},n.makeTemplateSource=function(t,n){var i;if(typeof t=="string")return i=(n||document).getElementById(t),i&&i.tagName.toLowerCase()==="script"?new e.templateSources.domElement(i):(t in r||(r[t]=new e.templateSources.requireTemplate(t)),r[t]);if(t&&(t.nodeType===1||t.nodeType===8))return new e.templateSources.anonymousTemplate(t)},n.renderTemplate=function(t,r,i,s){var o,u=i&&i.afterRender,a=i&&i.templateProperty&&r.$module&&r.$module[i.templateProperty];return!a||typeof a!="function"&&typeof a!="string"?o=n.makeTemplateSource(t,s):o={text:function(){return typeof a=="function"?a.call(r.$module):a}},typeof u=="function"&&o instanceof e.templateSources.requireTemplate&&!o.retrieved&&(i.afterRender=function(){o.retrieved&&u.apply(this,arguments)}),n.renderTemplateSource(o,r,i)},e.amdTemplateEngine=n,e.setTemplateEngine(n)}(e,t)}),define("text",["module"],function(e){var t,n,r,i,s=["Msxml2.XMLHTTP","Microsoft.XMLHTTP","Msxml2.XMLHTTP.4.0"],o=/^\s*<\?xml(\s)+version=[\'\"](\d)*.(\d)*[\'\"](\s)*\?>/im,u=/<body[^>]*>\s*([\s\S]+)\s*<\/body>/im,a=typeof location!="undefined"&&location.href,f=a&&location.protocol&&location.protocol.replace(/\:/,""),l=a&&location.hostname,c=a&&(location.port||undefined),h={},p=e.config&&e.config()||{};t={version:"2.0.7",strip:function(e){if(e){e=e.replace(o,"");var t=e.match(u);t&&(e=t[1])}else e="";return e},jsEscape:function(e){return e.replace(/(['\\])/g,"\\$1").replace(/[\f]/g,"\\f").replace(/[\b]/g,"\\b").replace(/[\n]/g,"\\n").replace(/[\t]/g,"\\t").replace(/[\r]/g,"\\r").replace(/[\u2028]/g,"\\u2028").replace(/[\u2029]/g,"\\u2029")},createXhr:p.createXhr||function(){var e,t,n;if(typeof XMLHttpRequest!="undefined")return new XMLHttpRequest;if(typeof ActiveXObject!="undefined")for(t=0;t<3;t+=1){n=s[t];try{e=new ActiveXObject(n)}catch(r){}if(e){s=[n];break}}return e},parseName:function(e){var t,n,r,i=!1,s=e.indexOf("."),o=e.indexOf("./")===0||e.indexOf("../")===0;return s!==-1&&(!o||s>1)?(t=e.substring(0,s),n=e.substring(s+1,e.length)):t=e,r=n||t,s=r.indexOf("!"),s!==-1&&(i=r.substring(s+1)==="strip",r=r.substring(0,s),n?n=r:t=r),{moduleName:t,ext:n,strip:i}},xdRegExp:/^((\w+)\:)?\/\/([^\/\\]+)/,useXhr:function(e,n,r,i){var s,o,u,a=t.xdRegExp.exec(e);return a?(s=a[2],o=a[3],o=o.split(":"),u=o[1],o=o[0],(!s||s===n)&&(!o||o.toLowerCase()===r.toLowerCase())&&(!u&&!o||u===i)):!0},finishLoad:function(e,n,r,i){r=n?t.strip(r):r,p.isBuild&&(h[e]=r),i(r)},load:function(e,n,r,i){if(i.isBuild&&!i.inlineText){r();return}p.isBuild=i.isBuild;var s=t.parseName(e),o=s.moduleName+(s.ext?"."+s.ext:""),u=n.toUrl(o),h=p.useXhr||t.useXhr;!a||h(u,f,l,c)?t.get(u,function(n){t.finishLoad(e,s.strip,n,r)},function(e){r.error&&r.error(e)}):n([o],function(e){t.finishLoad(s.moduleName+"."+s.ext,s.strip,e,r)})},write:function(e,n,r,i){if(h.hasOwnProperty(n)){var s=t.jsEscape(h[n]);r.asModule(e+"!"+n,"define(function () { return '"+s+"';});\n")}},writeFile:function(e,n,r,i,s){var o=t.parseName(n),u=o.ext?"."+o.ext:"",a=o.moduleName+u,f=r.toUrl(o.moduleName+u)+".js";t.load(a,r,function(n){var r=function(e){return i(f,e)};r.asModule=function(e,t){return i.asModule(e,f,t)},t.write(e,a,r,s)},s)}};if(p.env==="node"||!p.env&&typeof process!="undefined"&&process.versions&&!!process.versions.node)n=require.nodeRequire("fs"),t.get=function(e,t,r){try{var i=n.readFileSync(e,"utf8");i.indexOf("﻿")===0&&(i=i.substring(1)),t(i)}catch(s){r(s)}};else if(p.env==="xhr"||!p.env&&t.createXhr())t.get=function(e,n,r,i){var s=t.createXhr(),o;s.open("GET",e,!0);if(i)for(o in i)i.hasOwnProperty(o)&&s.setRequestHeader(o.toLowerCase(),i[o]);p.onXhr&&p.onXhr(s,e),s.onreadystatechange=function(t){var i,o;s.readyState===4&&(i=s.status,i>399&&i<600?(o=new Error(e+" HTTP status: "+i),o.xhr=s,r(o)):n(s.responseText),p.onXhrComplete&&p.onXhrComplete(s,e))},s.send(null)};else if(p.env==="rhino"||!p.env&&typeof Packages!="undefined"&&typeof java!="undefined")t.get=function(e,t){var n,r,i="utf-8",s=new java.io.File(e),o=java.lang.System.getProperty("line.separator"),u=new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(s),i)),a="";try{n=new java.lang.StringBuffer,r=u.readLine(),r&&r.length()&&r.charAt(0)===65279&&(r=r.substring(1)),r!==null&&n.append(r);while((r=u.readLine())!==null)n.append(o),n.append(r);a=String(n.toString())}finally{u.close()}t(a)};else if(p.env==="xpconnect"||!p.env&&typeof Components!="undefined"&&Components.classes&&Components.interfaces)r=Components.classes,i=Components.interfaces,Components.utils["import"]("resource://gre/modules/FileUtils.jsm"),t.get=function(e,t){var n,s,o={},u=new FileUtils.File(e);try{n=r["@mozilla.org/network/file-input-stream;1"].createInstance(i.nsIFileInputStream),n.init(u,1,0,!1),s=r["@mozilla.org/intl/converter-input-stream;1"].createInstance(i.nsIConverterInputStream),s.init(n,"utf-8",n.available(),i.nsIConverterInputStream.DEFAULT_REPLACEMENT_CHARACTER),s.readString(n.available(),o),s.close(),n.close(),t(o.value)}catch(a){throw new Error((u&&u.path||"")+": "+a)}};return t}),function(){require.config({baseUrl:"",paths:{"knockout-amd-helpers":"scripts/knockout-amd-helpers",text:"scripts/text"}}),define("jquery",[],function(){return jQuery}),define("ko",ko),define("knockout",ko),define("toastr",toastr),define("pipwerks",pipwerks),define("modernizr",Modernizr),define("viewport-units-buggyfill",viewportUnitsBuggyfill),window.copyHelper=function(e,t){return window.copyPlaceholder=t.clone().insertAfter(t),t.clone()},window.shuffle=function(e){var t=e.length,n,r;while(0!==t)r=Math.floor(Math.random()*t),t-=1,n=e[t],e[t]=e[r],e[r]=n;return e},require(["jquery","viewport-units-buggyfill","app/bootstrapper","app/sound","app/logger","app/config","app/feedback","app/dialog","app/popup","knockout-amd-helpers","text"],function(e,t,n,r,i,s,o,u,a){requirejs.onError=function(e){i.error("Problem z ładowaniem pliku; "+e.message)},t.init(),ko.amdTemplateEngine.defaultPath="",ko.amdTemplateEngine.defaultSuffix=s.templateFileSuffix,ko.amdTemplateEngine.defaultRequireTextPluginName=s.requiredPluginName,ko.bindingHandlers.sortable.afterMove=function(){e(".spread").each(function(){e(this).data().widthSet||e(this).data({widthSet:!0}).css({width:100/(e(this).siblings().length+1)+"%"})})},ko.bindingHandlers.editableContent={init:function(t,n){var r=e(t),i=ko.utils.unwrapObservable(n());r.html(i),r.on("keyup",function(e){var t=n(),i=r.text();t(i)})},update:function(t,n){var r=e(t),i=ko.utils.unwrapObservable(n());r.html(i)}},ko.bindingHandlers.alwaysFocus={update:function(t,n){var r=n(),i=e(t);r&&!i.is(":focus")&&i.focus()}},ko.bindingHandlers.furtherFocus={update:function(t,n){var r=n(),i=e(t);i.data("further-focus")?r&&!i.is(":focus")&&i.focus():i.data("further-focus",!0)}},ko.bindingHandlers.attrOnce={init:function(e,t){var n=ko.utils.unwrapObservable(t())||{};ko.utils.objectForEach(n,function(t,n){n=ko.utils.unwrapObservable(n);var r=n===!1||n===null||n===undefined;r?e.removeAttribute(t):e.setAttribute(t,n.toString())})}},ko.components.getComponentNameForNode=function(e){var t=e.tagName&&e.tagName.toLowerCase();return ko.components.isRegistered(t)?t=="button"||t=="video"||t=="audio"?null:t:null};var f=(s.requiredPluginName?s.requiredPluginName+"!":"")+s.quizFolder+"/"+s.componentsFolder+"/";ko.components.register("navigation",{viewModel:{createViewModel:function(t,n){return{afterRender:function(){e("#volume-slider").slider({value:.5,min:0,max:1,step:.1,create:function(t,n){e(this).find(".ui-slider-handle").attr({role:"slider","aria-valuemin":"0%","aria-valuemax":"100%","aria-valuenow":"50%",title:e(this).data().label}).addClass("slider-handle")},slide:function(t,n){r.setVolume(n.value),e(this).find(".ui-slider-handle").attr({"aria-valuenow":Math.floor(n.value*100)+"%"})}}),r.setVolume(.5),e("#zoom-slider").slider({value:1,min:1,max:2,step:.1,create:function(t,n){e(this).find(".ui-slider-handle").attr({role:"slider","aria-valuemin":"100%","aria-valuemax":"200%","aria-valuenow":"100%",title:e(this).data().label}).addClass("slider-handle")},slide:function(t,n){e("#content").css({"-moz-transform":"scale("+n.value+")","-ms-transform":"scale("+n.value+")","-o-transform":"scale("+n.value+")","-webkit-transform":"scale("+n.value+")",transform:"scale("+n.value+")"}),e(this).find(".ui-slider-handle").attr({"aria-valuenow":Math.floor(n.value*100)+"%"})}})}}}},template:{require:f+"navigation"+s.templateFileSuffix}}),ko.components.register("feedback",{viewModel:{createViewModel:function(e,t){return{afterRender:function(){o.initialize()},close:function(){o.close()}}}},template:{require:f+"feedback"+s.templateFileSuffix}}),ko.components.register("dialog",{viewModel:{createViewModel:function(e,t){return{afterRender:function(){u.initialize()}}}},template:{require:f+"dialog"+s.templateFileSuffix}}),ko.components.register("popup",{viewModel:{createViewModel:function(e,t){return{afterRender:function(){a.initialize()}}}},template:{require:f+"popup"+s.templateFileSuffix}}),ko.components.register("screen-header",{template:{require:f+"screen-header"+s.templateFileSuffix}}),ko.components.register("exercise-header",{template:{require:f+"exercise-header"+s.templateFileSuffix}}),ko.components.register("exercise-footer",{template:{require:f+"exercise-footer"+s.templateFileSuffix}}),ko.components.register("wording",{viewModel:{createViewModel:function(e,t){return{index:e.index,cssClass:e.cssClass}}},template:{require:f+"wording"+s.templateFileSuffix}}),ko.components.register("image",{viewModel:{createViewModel:function(e,t){return e?{index:e.index,cssClass:e.cssClass}:{}}},template:{require:f+"image"+s.templateFileSuffix}}),ko.components.register("button",{viewModel:{createViewModel:function(e,t){return{index:e.index,cssClass:e.cssClass}}},template:{require:f+"button"+s.templateFileSuffix}}),ko.components.register("video",{viewModel:{createViewModel:function(e,t){return{index:e.index}}},template:{require:f+"video"+s.templateFileSuffix}}),ko.components.register("audio",{viewModel:{createViewModel:function(e,t){return{index:e.index}}},template:{require:f+"audio"+s.templateFileSuffix}}),ko.components.register("pickone-text",{viewModel:{createViewModel:function(e,t){return e?{cssClass:e.cssClass}:{}}},template:{require:f+"pickone-text"+s.templateFileSuffix}}),ko.components.register("pickone-text-answer",{viewModel:{createViewModel:function(e,t){return e?{cssClass:e.cssClass}:{}}},template:{require:f+"pickone-text-answer"+s.templateFileSuffix}}),ko.components.register("pickone-text-answer-list",{viewModel:{createViewModel:function(e,t){return e?{cssClass:e.cssClass}:{}}},template:{require:f+"pickone-text-answer-list"+s.templateFileSuffix}}),ko.components.register("pickone-image",{viewModel:{createViewModel:function(e,t){return e?{cssClass:e.cssClass}:{}}},template:{require:f+"pickone-image"+s.templateFileSuffix}}),ko.components.register("pickone-image-answer",{viewModel:{createViewModel:function(e,t){return e?{cssClass:e.cssClass}:{}}},template:{require:f+"pickone-image-answer"+s.templateFileSuffix}}),ko.components.register("pickone-image-answer-list",{viewModel:{createViewModel:function(e,t){return e?{cssClass:e.cssClass}:{}}},template:{require:f+"pickone-image-answer-list"+s.templateFileSuffix}}),ko.components.register("pickmany-text",{viewModel:{createViewModel:function(e,t){return e?{cssClass:e.cssClass}:{}}},template:{require:f+"pickmany-text"+s.templateFileSuffix}}),ko.components.register("pickmany-text-answer",{viewModel:{createViewModel:function(e,t){return e?{cssClass:e.cssClass}:{}}},template:{require:f+"pickmany-text-answer"+s.templateFileSuffix}}),ko.components.register("pickmany-text-answer-list",{viewModel:{createViewModel:function(e,t){return e?{cssClass:e.cssClass}:{}}},template:{require:f+"pickmany-text-answer-list"+s.templateFileSuffix}}),ko.components.register("pickmany-image",{viewModel:{createViewModel:function(e,t){return e?{cssClass:e.cssClass}:{}}},template:{require:f+"pickmany-image"+s.templateFileSuffix}}),ko.components.register("pickmany-image-answer",{viewModel:{createViewModel:function(e,t){return e?{cssClass:e.cssClass}:{}}},template:{require:f+"pickmany-image-answer"+s.templateFileSuffix}}),ko.components.register("pickmany-image-answer-list",{viewModel:{createViewModel:function(e,t){return e?{cssClass:e.cssClass}:{}}},template:{require:f+"pickmany-image-answer-list"+s.templateFileSuffix}}),ko.components.register("order-text",{viewModel:{createViewModel:function(e,t){return e?{cssClass:e.cssClass}:{}}},template:{require:f+"order-text"+s.templateFileSuffix}}),ko.components.register("order-text-answer",{viewModel:{createViewModel:function(e,t){return e?{cssClass:e.cssClass}:{}}},template:{require:f+"order-text-answer"+s.templateFileSuffix}}),ko.components.register("order-text-answer-list",{viewModel:{createViewModel:function(e,t){return e?{cssClass:e.cssClass}:{}}},template:{require:f+"order-text-answer-list"+s.templateFileSuffix}}),ko.components.register("order-image",{viewModel:{createViewModel:function(e,t){return e?{cssClass:e.cssClass}:{}}},template:{require:f+"order-image"+s.templateFileSuffix}}),ko.components.register("order-image-answer",{viewModel:{createViewModel:function(e,t){return e?{cssClass:e.cssClass}:{}}},template:{require:f+"order-image-answer"+s.templateFileSuffix}}),ko.components.register("order-image-answer-list",{viewModel:{createViewModel:function(e,t){return e?{cssClass:e.cssClass}:{}}},template:{require:f+"order-image-answer-list"+s.templateFileSuffix}}),ko.components.register("draganddrop-text-answer",{viewModel:{createViewModel:function(e,t){return e?{cssClass:e.cssClass}:{}}},template:{require:f+"draganddrop-text-answer"+s.templateFileSuffix}}),ko.components.register("draganddrop-text-answer-list",{viewModel:{createViewModel:function(e,t){return e?{cssClass:e.cssClass}:{}}},template:{require:f+"draganddrop-text-answer-list"+s.templateFileSuffix}}),ko.components.register("draganddrop-text-target",{viewModel:{createViewModel:function(e,t){return e?{cssClass:e.cssClass}:{}}},template:{require:f+"draganddrop-text-target"+s.templateFileSuffix}}),ko.components.register("draganddrop-text-target-answer",{viewModel:{createViewModel:function(e,t){return e?{cssClass:e.cssClass}:{}}},template:{require:f+"draganddrop-text-target-answer"+s.templateFileSuffix}}),ko.components.register("draganddrop-text-target-list",{viewModel:{createViewModel:function(e,t){return e?{cssClass:e.cssClass}:{}}},template:{require:f+"draganddrop-text-target-list"+s.templateFileSuffix}}),ko.components.register("draganddrop-image-answer",{viewModel:{createViewModel:function(e,t){return e?{cssClass:e.cssClass}:{}}},template:{require:f+"draganddrop-image-answer"+s.templateFileSuffix}}),ko.components.register("draganddrop-image-answer-list",{viewModel:{createViewModel:function(e,t){return e?{cssClass:e.cssClass}:{}}},template:{require:f+"draganddrop-image-answer-list"+s.templateFileSuffix}}),ko.components.register("draganddrop-image-target",{viewModel:{createViewModel:function(e,t){return e?{cssClass:e.cssClass}:{}}},template:{require:f+"draganddrop-image-target"+s.templateFileSuffix}}),ko.components.register("draganddrop-image-target-answer",{viewModel:{createViewModel:function(e,t){return e?{cssClass:e.cssClass}:{}}},template:{require:f+"draganddrop-image-target-answer"+s.templateFileSuffix}}),ko.components.register("draganddrop-image-target-list",{viewModel:{createViewModel:function(e,t){return e?{cssClass:e.cssClass}:{}}},template:{require:f+"draganddrop-image-target-list"+s.templateFileSuffix}}),ko.components.register("fill-input",{viewModel:{createViewModel:function(t,n){var r={afterRender:function(){e("input.fill-input").autoGrow(5)}};return t?e.extend(r,{index:t.index,cssClass:t.cssClass}):r}},template:{require:f+"fill-input"+s.templateFileSuffix}}),n.run().then(function(){e("#navigation").show()})})}(),define("app/main",function(){});