123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196 |
- define('core/localstorage', ["core/config"],function(a){var b=!1,c="",d="",e=null,f=function(){if(-1==a.jsrev)return!1;if("undefined"==typeof window.localStorage)return!1;var b="test";try{return e=window.localStorage,null===e?!1:(e.setItem(b,"1"),e.removeItem(b),!0)}catch(c){return!1}},g=function(a){return c+a},h=function(){var b=e.getItem(d);if(null===b)return void e.setItem(d,a.jsrev);var c=a.jsrev;c!=b&&(e.clear(),e.setItem(d,a.jsrev))},i=function(a){var b,c,d,e=0;if(0===a.length)return e;for(b=0,d=a.length;d>b;b++)c=a.charCodeAt(b),e=(e<<5)-e+c,e|=0;return e},j=function(){b=f();var e=a.wwwroot+"/"+a.jsrev,g=i(e);c=g+"/",e=a.wwwroot+"/",g=i(e),d=g+"/jsrev"};return j(),{get:function(a){return b?(h(),a=g(a),e.getItem(a)):!1},set:function(a,c){if(!b)return!1;h(),a=g(a);try{e.setItem(a,c)}catch(d){return!1}return!0}}});
- define('core/tooltip', ["jquery"],function(a){var b=function(b){this._regionSelector=b,a(this._regionSelector).each(function(b,c){var d=a(c).attr("aria-describedby");if(d){var e=document.getElementById(d);if(e){var f="tooltip"==a(e).attr("role");f&&(a(e).hide(),a(c).attr("tabindex","0")),a(c).on("focus",this._handleFocus.bind(this)),a(c).on("mouseover",this._handleMouseOver.bind(this)),a(c).on("mouseout",this._handleMouseOut.bind(this)),a(c).on("blur",this._handleBlur.bind(this)),a(c).on("keydown",this._handleKeyDown.bind(this))}}}.bind(this))};return b.prototype._regionSelector=null,b.prototype._showTooltip=function(b){var c=a(b.target),d=c.attr("aria-describedby");if(d){var e=a(document.getElementById(d));if(e.show(),e.attr("aria-hidden","false"),!e.is(".tooltip")){var f=a('<div class="tooltip-inner"></div>');f.append(e.contents()),e.append(f),e.addClass("tooltip"),e.addClass("bottom"),e.append('<div class="tooltip-arrow"></div>')}var g=c.offset();g.top+=c.height()+10,a(e).offset(g)}},b.prototype._hideTooltip=function(b){var c=a(b.target),d=c.attr("aria-describedby");if(d){var e=document.getElementById(d);a(e).hide(),a(e).attr("aria-hidden","true")}},b.prototype._handleFocus=function(a){this._showTooltip(a)},b.prototype._handleKeyDown=function(a){27==a.which&&this._hideTooltip(a)},b.prototype._handleMouseOver=function(a){this._showTooltip(a)},b.prototype._handleMouseOut=function(b){var c=a(b.target);c.is(":focus")||this._hideTooltip(b)},b.prototype._handleBlur=function(a){this._hideTooltip(a)},b});
- define('core/tag', ["jquery","core/ajax","core/templates","core/notification","core/str"],function(a,b,c,d,e){return{initTagindexPage:function(){a("body").delegate(".tagarea[data-ta] a[data-quickload=1]","click",function(d){d.preventDefault();var e=a(this),f=e.context.search.replace(/^\?/,""),g=e.closest(".tagarea[data-ta]"),h=f.split("&").reduce(function(a,b){var c=b.split("=");return a[c[0]]=decodeURIComponent(c[1]),a},{}),i=b.call([{methodname:"core_tag_get_tagindex",args:{tagindex:h}}],!0);a.when.apply(a,i).done(function(a){c.render("core_tag/index",a).done(function(a){g.replaceWith(a)})})})},initManagePage:function(){a("body").on("updated","[data-inplaceeditable]",function(b){if(e.get_string("now").done(function(c){a(b.target).closest("tr").find("td.col-timemodified").html(c)}),"tagflag"===b.ajaxreturn.itemtype){var c=a(b.target).closest("tr");"0"===b.ajaxreturn.value?c.removeClass("flagged-tag"):c.addClass("flagged-tag")}}),a(".tag-management-table").delegate("a.tagdelete","click",function(b){b.preventDefault();var c=a(this).attr("href");e.get_strings([{key:"delete"},{key:"confirmdeletetag",component:"tag"},{key:"yes"},{key:"no"}]).done(function(a){d.confirm(a[0],a[1],a[2],a[3],function(){window.location.href=c})})}),a("#tag-management-delete").click(function(b){var c=a(this).closest("form").get(0),f=a(c).find("input[type=checkbox]:checked").length;if(!f)return!1;var g=a("<input type='hidden'/>").attr("name",this.name);b.preventDefault(),e.get_strings([{key:"delete"},{key:"confirmdeletetags",component:"tag"},{key:"yes"},{key:"no"}]).done(function(a){d.confirm(a[0],a[1],a[2],a[3],function(){g.appendTo(c),c.submit()})})}),a("#tag-management-combine").click(function(b){b.preventDefault();var c=a(this).closest("form").get(0),f=a(c).find("input[type=checkbox]:checked");if(f.length<=1)return e.get_strings([{key:"combineselected",component:"tag"},{key:"selectmultipletags",component:"tag"},{key:"ok"}]).done(function(a){d.alert(a[0],a[1],a[2])}),!1;var g=a("<input type='hidden'/>").attr("name",this.name);e.get_strings([{key:"combineselected",component:"tag"},{key:"selectmaintag",component:"tag"},{key:"continue"},{key:"cancel"}]).done(function(b){var d=a('<div><form id="combinetags_form" class="form-inline"><p class="description"></p><p class="options"></p><p class="mdl-align"><input type="submit" id="combinetags_submit"/><input type="button" id="combinetags_cancel"/></p></form></div>');d.find(".description").html(b[1]),d.find("#combinetags_submit").attr("value",b[2]),d.find("#combinetags_cancel").attr("value",b[3]);var e=d.find(".options");f.each(function(){var b=a(this).val(),c=a(".inplaceeditable[data-itemtype=tagname][data-itemid="+b+"]").attr("data-value");e.append(a('<input type="radio" name="maintag" id="combinetags_maintag_'+b+'" value="'+b+'"/><label for="combinetags_maintag_'+b+'">'+c+"</label><br>"))});var h=new M.core.dialogue({draggable:!0,modal:!0,closeButton:!0,headerContent:b[0],bodyContent:d.html()});h.show(),a("#combinetags_form input[type=radio]").first().focus().prop("checked",!0),a("#combinetags_form #combinetags_cancel").on("click",function(){h.destroy()}),a("#combinetags_form").on("submit",function(){g.appendTo(c);var b=a("input[name=maintag]:checked","#combinetags_form").val();return a("<input type='hidden'/>").attr("name","maintag").attr("value",b).appendTo(c),c.submit(),!1})})}),a("body").on("updatefailed","[data-inplaceeditable][data-itemtype=tagname]",function(b){var c=b.exception,f=b.newvalue,g=a(b.target).attr("data-itemid");"namesalreadybeeingused"===c.errorcode&&(b.preventDefault(),e.get_strings([{key:"nameuseddocombine",component:"tag"},{key:"yes"},{key:"cancel"}]).done(function(a){d.confirm(b.message,a[0],a[1],a[2],function(){window.location.href=window.location.href+"&newname="+encodeURIComponent(f)+"&tagid="+encodeURIComponent(g)+"&action=renamecombine&sesskey="+M.cfg.sesskey})}))}),a("body").on("click","a[data-action=addstandardtag]",function(b){b.preventDefault(),e.get_strings([{key:"addotags",component:"tag"},{key:"inputstandardtags",component:"tag"},{key:"continue"},{key:"cancel"}]).done(function(b){var c=a('<div><form id="addtags_form" class="form-inline" method="POST"><input type="hidden" name="action" value="addstandardtag"/><input type="hidden" name="sesskey" value="'+M.cfg.sesskey+'"/><p><label for="id_tagslist">'+b[1]+'</label><input type="text" id="id_tagslist" name="tagslist"/></p><p class="mdl-align"><input type="submit" id="addtags_submit"/><input type="button" id="addtags_cancel"/></p></form></div>');c.find("#addtags_form").attr("action",window.location.href),c.find("#addtags_submit").attr("value",b[2]),c.find("#addtags_cancel").attr("value",b[3]);var d=new M.core.dialogue({draggable:!0,modal:!0,closeButton:!0,headerContent:b[0],bodyContent:c.html()});d.show(),a("#addtags_form input[type=text]").focus(),a("#addtags_form #addtags_cancel").on("click",function(){d.destroy()})})})},initManageCollectionsPage:function(){a("body").on("updated","[data-inplaceeditable]",function(b){var c,d,e,f=b.ajaxreturn;"core_tag"===f.component&&"tagareaenable"===f.itemtype&&(c=a(this).attr("data-itemid"),a(".tag-collections-table ul[data-collectionid] li[data-areaid="+c+"]").addClass("hidden"),e=f.value,"1"===e?(a(this).closest("tr").removeClass("dimmed_text"),d=a(this).closest("tr").find('[data-itemtype="tagareacollection"]').attr("data-value"),a(".tag-collections-table ul[data-collectionid="+d+"] li[data-areaid="+c+"]").removeClass("hidden")):a(this).closest("tr").addClass("dimmed_text")),"core_tag"===f.component&&"tagareacollection"===f.itemtype&&(c=a(this).attr("data-itemid"),a(".tag-collections-table ul[data-collectionid] li[data-areaid="+c+"]").addClass("hidden"),d=a(this).attr("data-value"),e=a(this).closest("tr").find('[data-itemtype="tagareaenable"]').attr("data-value"),"1"===e&&a(".tag-collections-table ul[data-collectionid="+d+"] li[data-areaid="+c+"]").removeClass("hidden"))}),a("body").on("click",".addtagcoll > a",function(b){b.preventDefault();var c=a(this).attr("data-url")+"&sesskey="+M.cfg.sesskey;e.get_strings([{key:"addtagcoll",component:"tag"},{key:"name"},{key:"searchable",component:"tag"},{key:"create"},{key:"cancel"}]).done(function(b){var d=a('<div><form id="addtagcoll_form" class="form-inline"><p><label for="addtagcoll_name"></label>: <input id="addtagcoll_name" type="text"/></p><p><label for="addtagcoll_searchable"></label>: <input id="addtagcoll_searchable" type="checkbox" value="1" checked/></p><p class="mdl-align"><input type="submit" id="addtagcoll_submit"/><input type="button" id="addtagcoll_cancel"/></p></form></div>');d.find('label[for="addtagcoll_name"]').html(b[1]),d.find('label[for="addtagcoll_searchable"]').html(b[2]),d.find("#addtagcoll_submit").attr("value",b[3]),d.find("#addtagcoll_cancel").attr("value",b[4]);var e=new M.core.dialogue({draggable:!0,modal:!0,closeButton:!0,headerContent:b[0],bodyContent:d.html()});e.show(),a("#addtagcoll_form #addtagcoll_name").focus(),a("#addtagcoll_form #addtagcoll_cancel").on("click",function(){e.destroy()}),a("#addtagcoll_form").on("submit",function(){var b=a("#addtagcoll_form #addtagcoll_name").val(),d=a("#addtagcoll_form #addtagcoll_searchable").prop("checked")?1:0;return String(b).length>0&&(window.location.href=c+"&name="+encodeURIComponent(b)+"&searchable="+d),!1})})}),a("body").on("click",".tag-collections-table .action_delete",function(b){b.preventDefault();var c=a(this).attr("data-url")+"&sesskey="+M.cfg.sesskey;e.get_strings([{key:"delete"},{key:"suredeletecoll",component:"tag",param:a(this).attr("data-collname")},{key:"yes"},{key:"no"}]).done(function(a){d.confirm(a[0],a[1],a[2],a[3],function(){window.location.href=c})})})}}});
- define('core/form-autocomplete', ["jquery","core/log","core/str","core/templates","core/notification"],function(a,b,c,d,e){var f={DOWN:40,ENTER:13,SPACE:32,ESCAPE:27,COMMA:188,UP:38},g=function(b,c){var d=a(document.getElementById(c.selectionId)),e=d.children("[aria-selected=true]").length;for(b%=e;0>b;)b+=e;var f=a(d.children("[aria-selected=true]").get(b)),g=c.selectionId+"-"+b;d.children().attr("data-active-selection",!1).attr("id",""),f.attr("data-active-selection",!0).attr("id",g),d.attr("aria-activedescendant",g)},h=function(b,c,f){var h=[],i=a(document.getElementById(c.selectionId)),j=i.attr("aria-activedescendant"),k=!1;j&&(k=a(document.getElementById(j)).attr("data-value")),f.children("option").each(function(b,c){a(c).prop("selected")&&h.push({label:a(c).html(),value:a(c).attr("value")})});var l=a.extend({items:h},b,c);d.render("core/form_autocomplete_selection",l).done(function(b){i.empty().append(a(b).html()),k!==!1&&i.children("[aria-selected=true]").each(function(b,d){a(d).attr("data-value")===k&&g(b,c)})}).fail(e.exception)},i=function(a){"undefined"!=typeof M.core_formchangechecker&&M.core_formchangechecker.set_form_changed(),a.change()},j=function(b,c,d,e){var f=a(d).attr("data-value");b.multiple&&e.children("option").each(function(b,c){a(c).attr("value")==f&&(a(c).prop("selected",!1),a(c).attr("data-iscustom")&&a(c).remove())}),h(b,c,e),i(e)},k=function(b,c){var d=a(document.getElementById(c.inputId)),e=a(document.getElementById(c.suggestionsId)),f=e.children("[aria-hidden=false]").length;for(b%=f;0>b;)b+=f;var g=a(e.children("[aria-hidden=false]").get(b)),h=a(e.children("[role=option]")).index(g),i=c.suggestionsId+"-"+h;e.children().attr("aria-selected",!1).attr("id",""),g.attr("aria-selected",!0).attr("id",i),d.attr("aria-activedescendant",i);var j=g.offset().top-e.offset().top+e.scrollTop()-e.height()/2;e.animate({scrollTop:j},100)},l=function(b){var c=a(document.getElementById(b.suggestionsId)),d=c.children("[aria-selected=true]"),e=c.children("[aria-hidden=false]").index(d);k(e+1,b)},m=function(b){var c=a(document.getElementById(b.selectionId)),d=c.children("[data-active-selection=true]");if(!d)return void g(0,b);var e=c.children("[aria-selected=true]").index(d);g(e-1,b)},n=function(b){var c=a(document.getElementById(b.selectionId)),d=c.children("[data-active-selection=true]");if(!d)return void g(0,b);var e=c.children("[aria-selected=true]").index(d);g(e+1,b)},o=function(b){var c=a(document.getElementById(b.suggestionsId)),d=c.children("[aria-selected=true]"),e=c.children("[aria-hidden=false]").index(d);k(e-1,b)},p=function(b){var c=a(document.getElementById(b.inputId)),d=a(document.getElementById(b.suggestionsId));c.attr("aria-expanded",!1).attr("aria-activedescendant",b.selectionId),d.hide().attr("aria-hidden",!0)},q=function(b,f,g,h){var i=a(document.getElementById(f.inputId)),j=a(document.getElementById(f.suggestionsId)),l=!1,m=[];h.children("option").each(function(b,c){a(c).prop("selected")!==!0&&(m[m.length]={label:c.innerHTML,value:a(c).attr("value")})});var n=f.caseSensitive?g:g.toLocaleLowerCase(),o=a.extend({options:m},b,f);d.render("core/form_autocomplete_suggestions",o).done(function(d){j.replaceWith(d),j=a(document.getElementById(f.suggestionsId)),j.show().attr("aria-hidden",!1),j.children().each(function(c,d){d=a(d),b.caseSensitive&&d.text().indexOf(n)>-1||!b.caseSensitive&&d.text().toLocaleLowerCase().indexOf(n)>-1?(d.show().attr("aria-hidden",!1),l=!0):d.hide().attr("aria-hidden",!0)}),i.attr("aria-expanded",!0),l?b.tags||k(0,f):c.get_string("nosuggestions","form").done(function(a){j.html(a)})}).fail(e.exception)},r=function(b,c,d){var e=a(document.getElementById(c.inputId)),f=e.val(),g=f.split(","),j=!1;a.each(g,function(c,e){if(e=e.trim(),""!==e&&(b.multiple||d.children("option").prop("selected",!1),d.children("option").each(function(b,c){a(c).attr("value")==e&&(j=!0,a(c).prop("selected",!0))}),!j)){var f=a("<option>");f.append(e),f.attr("value",e),d.append(f),f.prop("selected",!0),f.attr("data-iscustom",!0)}}),h(b,c,d),i(d),e.val(""),p(c)},s=function(b,c,d){var e=a(document.getElementById(c.inputId)),f=a(document.getElementById(c.suggestionsId)),g=f.children("[aria-selected=true]").attr("data-value");b.multiple||d.children("option").prop("selected",!1),d.children("option").each(function(b,c){a(c).attr("value")==g&&a(c).prop("selected",!0)}),h(b,c,d),i(d),e.val(""),p(c)},t=function(b,c,d,f,g){var h=a(b.currentTarget).val();g.transport(c.selector,h,function(b){var e=g.processResults(c.selector,b),h=[];if(f.children("option").each(function(b,c){c=a(c),c.prop("selected")?h.push(String(c.attr("value"))):c.remove()}),!c.multiple&&0===f.children("option").length){var i=a("<option>");f.append(i)}a.each(e,function(b,c){if(-1===h.indexOf(String(c.value))){var d=a("<option>");d.append(c.label),d.attr("value",c.value),f.append(d)}}),q(c,d,"",f)},e.exception)},u=function(b,c,d){var e=a(document.getElementById(c.inputId));if(e.on("keydown",function(g){switch(g.keyCode){case f.DOWN:return b.showSuggestions?("true"===e.attr("aria-expanded")?l(c):!e.val()&&b.ajax?require([b.ajax],function(a){t(g,b,c,d,a)}):q(b,c,e.val(),d),g.preventDefault(),!1):!0;case f.COMMA:return b.tags&&r(b,c,d),g.preventDefault(),!1;case f.UP:return o(c),g.preventDefault(),!1;case f.ENTER:var h=a(document.getElementById(c.suggestionsId));return"true"===e.attr("aria-expanded")&&h.children("[aria-selected=true]").length>0?s(b,c,d):b.tags&&r(b,c,d),g.preventDefault(),!1;case f.ESCAPE:return"true"===e.attr("aria-expanded")&&p(c),g.preventDefault(),!1}return!0}),e.on("behat:set-value",function(){var f=a(document.getElementById(c.suggestionsId));"true"===e.attr("aria-expanded")&&f.children("[aria-selected=true]").length>0?s(b,c,d):b.tags&&r(b,c,d)}),e.on("blur",function(){window.setTimeout(function(){var f=a(document.activeElement);f.attr("id")!=e.attr("id")&&(b.tags&&r(b,c,d),p(c))},500)}),b.showSuggestions){var g=a(document.getElementById(c.downArrowId));g.on("click",function(){e.focus(),q(b,c,e.val(),d)})}var h=a(document.getElementById(c.suggestionsId));h.parent().on("click","[role=option]",function(e){var f=a(e.currentTarget).closest("[role=option]"),g=a(document.getElementById(c.suggestionsId)),h=g.children("[aria-hidden=false]").index(f);k(h,c),s(b,c,d)});var i=a(document.getElementById(c.selectionId));i.on("click","[role=listitem]",function(e){var f=a(e.currentTarget);j(b,c,f,d)}),i.on("keydown",function(e){switch(e.keyCode){case f.DOWN:return n(c),e.preventDefault(),!1;case f.UP:return m(c),e.preventDefault(),!1;case f.SPACE:case f.ENTER:var g=a(document.getElementById(c.selectionId)).children("[data-active-selection=true]");return g&&(j(b,c,g,d),e.preventDefault()),!1}return!0}),b.showSuggestions&&e.on("input",function(e){var f=a(e.currentTarget).val(),g=a(e.currentTarget).data("last-value");g!==f&&q(b,c,f,d),a(e.currentTarget).data("last-value",f)})};return{enhance:function(f,g,i,j,k,l,m){var n={selector:f,tags:!1,ajax:!1,placeholder:j,caseSensitive:!1,showSuggestions:!0,noSelectionString:m};"undefined"!=typeof g&&(n.tags=g),"undefined"!=typeof i&&(n.ajax=i),"undefined"!=typeof k&&(n.caseSensitive=k),"undefined"!=typeof l&&(n.showSuggestions=l),"undefined"==typeof m&&c.get_string("noselection","form").done(function(a){n.noSelectionString=a}).fail(e.exception);var o=a(f);if(!o)return b.debug("Selector not found: "+f),!1;o.hide().attr("aria-hidden",!0);var p={selectId:o.attr("id"),inputId:"form_autocomplete_input-"+a.now(),suggestionsId:"form_autocomplete_suggestions-"+a.now(),selectionId:"form_autocomplete_selection-"+a.now(),downArrowId:"form_autocomplete_downarrow-"+a.now()};n.multiple=o.attr("multiple");var q=a("[for="+p.selectId+"]"),r=[];o.children("option").each(function(b,c){r[b]={label:c.innerHTML,value:a(c).attr("value")}});var s=a.extend({},n,p);s.options=r,s.items=[];var v=d.render("core/form_autocomplete_input",s),w=d.render("core/form_autocomplete_suggestions",s),x=d.render("core/form_autocomplete_selection",s);a.when(v,w,x).done(function(b,c,d){o.after(c),o.after(b),o.after(d),q.attr("for",p.inputId),u(n,p,o);var e=a(document.getElementById(p.inputId)),f=a(document.getElementById(p.suggestionsId));f.hide().attr("aria-hidden",!0),n.ajax&&require([n.ajax],function(b){var c=null,d=function(a){t(a,n,p,o,b)},f=function(a){null!==c&&(window.clearTimeout(c),c=null),c=window.setTimeout(d.bind(this,a),300)};e.on("input",f);var g=a(document.getElementById(p.downArrowId));g.on("click",d)}),h(n,p,o)})}}});
- !function(a,b){"object"==typeof exports&&exports&&"string"!=typeof exports.nodeName?b(exports):"function"==typeof define&&define.amd?define('core/mustache', ["exports"],b):(a.Mustache={},b(a.Mustache))}(this,function(a){function b(a){return"function"==typeof a}function c(a){return p(a)?"array":typeof a}function d(a){return a.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function e(a,b){return null!=a&&"object"==typeof a&&b in a}function f(a,b){return q.call(a,b)}function g(a){return!f(r,a)}function h(a){return String(a).replace(/[&<>"'`=\/]/g,function(a){return s[a]})}function i(b,c){function e(){if(r&&!s)for(;q.length;)delete o[q.pop()];else q=[];r=!1,s=!1}function f(a){if("string"==typeof a&&(a=a.split(u,2)),!p(a)||2!==a.length)throw new Error("Invalid tags: "+a);h=new RegExp(d(a[0])+"\\s*"),i=new RegExp("\\s*"+d(a[1])),m=new RegExp("\\s*"+d("}"+a[1]))}if(!b)return[];var h,i,m,n=[],o=[],q=[],r=!1,s=!1;f(c||a.tags);for(var y,z,A,B,C,D,E=new l(b);!E.eos();){if(y=E.pos,A=E.scanUntil(h))for(var F=0,G=A.length;G>F;++F)B=A.charAt(F),g(B)?q.push(o.length):s=!0,o.push(["text",B,y,y+1]),y+=1,"\n"===B&&e();if(!E.scan(h))break;if(r=!0,z=E.scan(x)||"name",E.scan(t),"="===z?(A=E.scanUntil(v),E.scan(v),E.scanUntil(i)):"{"===z?(A=E.scanUntil(m),E.scan(w),E.scanUntil(i),z="&"):A=E.scanUntil(i),!E.scan(i))throw new Error("Unclosed tag at "+E.pos);if(C=[z,A,y,E.pos],o.push(C),"#"===z||"^"===z||"$"===z||"<"===z)n.push(C);else if("/"===z){if(D=n.pop(),!D)throw new Error('Unopened section "'+A+'" at '+y);if(D[1]!==A)throw new Error('Unclosed section "'+D[1]+'" at '+y)}else"name"===z||"{"===z||"&"===z?s=!0:"="===z&&f(A)}if(D=n.pop())throw new Error('Unclosed section "'+D[1]+'" at '+E.pos);return k(j(o))}function j(a){for(var b,c,d=[],e=0,f=a.length;f>e;++e)b=a[e],b&&("text"===b[0]&&c&&"text"===c[0]?(c[1]+=b[1],c[3]=b[3]):(d.push(b),c=b));return d}function k(a){for(var b,c,d=[],e=d,f=[],g=0,h=a.length;h>g;++g)switch(b=a[g],b[0]){case"$":case"<":case"#":case"^":e.push(b),f.push(b),e=b[4]=[];break;case"/":c=f.pop(),c[5]=b[2],e=f.length>0?f[f.length-1][4]:d;break;default:e.push(b)}return d}function l(a){this.string=a,this.tail=a,this.pos=0}function m(a,b){this.view=a,this.blocks={},this.cache={".":this.view},this.parent=b}function n(){this.cache={}}var o=Object.prototype.toString,p=Array.isArray||function(a){return"[object Array]"===o.call(a)},q=RegExp.prototype.test,r=/\S/,s={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="},t=/\s*/,u=/\s+/,v=/\s*=/,w=/\s*\}/,x=/#|\^|\/|>|\{|&|=|!|\$|</;l.prototype.eos=function(){return""===this.tail},l.prototype.scan=function(a){var b=this.tail.match(a);if(!b||0!==b.index)return"";var c=b[0];return this.tail=this.tail.substring(c.length),this.pos+=c.length,c},l.prototype.scanUntil=function(a){var b,c=this.tail.search(a);switch(c){case-1:b=this.tail,this.tail="";break;case 0:b="";break;default:b=this.tail.substring(0,c),this.tail=this.tail.substring(c)}return this.pos+=b.length,b},m.prototype.push=function(a){return new m(a,this)},m.prototype.setBlockVar=function(a,b){var c=this.blocks;return c[a]=b,b},m.prototype.clearBlockVars=function(){this.blocks={}},m.prototype.getBlockVar=function(a){var b,c=this.blocks;return c.hasOwnProperty(a)?b=c[a]:this.parent&&(b=this.parent.getBlockVar(a)),b},m.prototype.lookup=function(a){var c,d=this.cache;if(d.hasOwnProperty(a))c=d[a];else{for(var f,g,h=this,i=!1;h;){if(a.indexOf(".")>0)for(c=h.view,f=a.split("."),g=0;null!=c&&g<f.length;)g===f.length-1&&(i=e(c,f[g])),c=c[f[g++]];else c=h.view[a],i=e(h.view,a);if(i)break;h=h.parent}d[a]=c}return b(c)&&(c=c.call(this.view)),c},n.prototype.clearCache=function(){this.cache={}},n.prototype.parse=function(a,b){var c=this.cache,d=c[a];return null==d&&(d=c[a]=i(a,b)),d},n.prototype.render=function(a,b,c){var d=this.parse(a),e=b instanceof m?b:new m(b);return this.renderTokens(d,e,c,a)},n.prototype.renderTokens=function(a,b,c,d){for(var e,f,g,h="",i=0,j=a.length;j>i;++i)g=void 0,e=a[i],f=e[0],"#"===f?g=this.renderSection(e,b,c,d):"^"===f?g=this.renderInverted(e,b,c,d):">"===f?g=this.renderPartial(e,b,c,d):"<"===f?g=this.renderBlock(e,b,c,d):"$"===f?g=this.renderBlockVariable(e,b,c,d):"&"===f?g=this.unescapedValue(e,b):"name"===f?g=this.escapedValue(e,b):"text"===f&&(g=this.rawValue(e)),void 0!==g&&(h+=g);return h},n.prototype.renderSection=function(a,c,d,e){function f(a){return g.render(a,c,d)}var g=this,h="",i=c.lookup(a[1]);if(i){if(p(i))for(var j=0,k=i.length;k>j;++j)h+=this.renderTokens(a[4],c.push(i[j]),d,e);else if("object"==typeof i||"string"==typeof i||"number"==typeof i)h+=this.renderTokens(a[4],c.push(i),d,e);else if(b(i)){if("string"!=typeof e)throw new Error("Cannot use higher-order sections without the original template");i=i.call(c.view,e.slice(a[3],a[5]),f),null!=i&&(h+=i)}else h+=this.renderTokens(a[4],c,d,e);return h}},n.prototype.renderInverted=function(a,b,c,d){var e=b.lookup(a[1]);return!e||p(e)&&0===e.length?this.renderTokens(a[4],b,c,d):void 0},n.prototype.renderPartial=function(a,c,d){if(d){var e=b(d)?d(a[1]):d[a[1]];return null!=e?this.renderTokens(this.parse(e),c,d,e):void 0}},n.prototype.renderBlock=function(a,c,d,e){if(d){var f=b(d)?d(a[1]):d[a[1]];null!=f&&c.clearBlockVars(),this.renderTokens(a[4],c,d,e);var g=this.renderTokens(this.parse(f),c,d,f);return c.clearBlockVars(),g}},n.prototype.renderBlockVariable=function(a,b,c,d){var e=a[1],f=b.getBlockVar(e);return f?this.renderTokens(this.parse(f),b,c,f):(b.setBlockVar(e,d.slice(a[3],a[5])),this.renderTokens(a[4],b,c,d))},n.prototype.unescapedValue=function(a,b){var c=b.lookup(a[1]);return null!=c?c:void 0},n.prototype.escapedValue=function(b,c){var d=c.lookup(b[1]);return null!=d?a.escape(d):void 0},n.prototype.rawValue=function(a){return a[1]},a.name="mustache.js",a.version="2.2.1",a.tags=["{{","}}"];var y=new n;a.clearCache=function(){return y.clearCache()},a.parse=function(a,b){return y.parse(a,b)},a.render=function(a,b,d){if("string"!=typeof a)throw new TypeError('Invalid template! Template should be a "string" but "'+c(a)+'" was given as the first argument for mustache#render(template, view, partials)');return y.render(a,b,d)},a.to_html=function(c,d,e,f){var g=a.render(c,d,e);return b(f)?void f(g):g},a.escape=h,a.Scanner=l,a.Context=m,a.Writer=n});
- define('core/ajax', ["jquery","core/config"],function(a,b){var c=function(a){var b,c,d=this,e=null,f=0;for(f=0;f<d.length;f++){if(b=d[f],c=a[f],"undefined"==typeof c){e=new Error("missing response");break}if(c.error!==!1){e=c.exception;break}b.deferred.resolve(c.data)}if(null!==e)for(;f<d.length;f++)b=d[f],b.deferred.reject(e)},d=function(a,b){var c=this,d=0;for(d=0;d<c.length;d++){var e=c[d];"undefined"!=typeof e.fail&&e.deferred.reject(b)}};return{call:function(e,f,g){var h,i=[],j=[];for("undefined"==typeof g&&(g=!0),"undefined"==typeof f&&(f=!0),h=0;h<e.length;h++){var k=e[h];i.push({index:h,methodname:k.methodname,args:k.args}),k.deferred=a.Deferred(),j.push(k.deferred.promise()),"undefined"!=typeof k.done&&k.deferred.done(k.done),"undefined"!=typeof k.fail&&k.deferred.fail(k.fail),k.index=h}i=JSON.stringify(i);var l={type:"POST",data:i,context:e,dataType:"json",processData:!1,async:f,contentType:"application/json"},m=b.wwwroot+"/lib/ajax/service.php?sesskey="+b.sesskey;return g||(m=b.wwwroot+"/lib/ajax/service-nologin.php?sesskey="+b.sesskey),f?a.ajax(m,l).done(c).fail(d):(l.success=c,l.error=d,a.ajax(m,l)),j}}});
- define('core/inplace_editable', ["jquery","core/ajax","core/templates","core/notification","core/str","core/config","core/url"],function(a,b,c,d,e,f,g){return a("body").on("click keypress","[data-inplaceeditable] [data-inplaceeditablelink]",function(h){if("keypress"!==h.type||13===h.keyCode){h.stopImmediatePropagation(),h.preventDefault();var i=a(this),j=i.closest("[data-inplaceeditable]"),k=function(b){b.addClass("updating");var c=b.find("img.spinner");c.length?c.show():(c=a("<img/>").attr("src",g.imageUrl("i/loading_small")).addClass("spinner").addClass("smallicon"),b.append(c))},l=function(a){a.removeClass("updating"),a.find("img.spinner").hide()},m=function(e,f){k(e),b.call([{methodname:"core_update_inplace_editable",args:{itemid:e.attr("data-itemid"),component:e.attr("data-component"),itemtype:e.attr("data-itemtype"),value:f},done:function(b){var d=e.attr("data-value");c.render("core/inplace_editable",b).done(function(f,g){var h=a(f);c.replaceNode(e,h,g),h.find("[data-inplaceeditablelink]").focus(),h.trigger({type:"updated",ajaxreturn:b,oldvalue:d})})},fail:function(b){var c=a.Event("updatefailed",{exception:b,newvalue:f});l(e),e.trigger(c),c.isDefaultPrevented()||d.exception(b)}}],!0)},n=function(a){a.find("input").off(),a.find("select").off(),a.html(a.attr("data-oldcontent")),a.removeAttr("data-oldcontent"),a.removeClass("inplaceeditingon"),a.find("[data-inplaceeditablelink]").focus()},o=function(){a("span.inplaceeditable.inplaceeditingon").each(function(){n(a(this))})},p=function(b,c){var d,e=b;for(d=0;c>d;d++)e+=String(Math.floor(10*Math.random()));return 0===a("#"+e).length?e:p(b,c)},q=function(b){e.get_string("edittitleinstructions").done(function(c){var d=a('<span class="editinstructions">'+c+"</span>").attr("id",p("id_editinstructions_",20)),e=a('<input type="text"/>').attr("id",p("id_inplacevalue_",20)).attr("value",b.attr("data-value")).attr("aria-describedby",d.attr("id")).addClass("ignoredirty"),g=a('<label class="accesshide">'+j.attr("data-editlabel")+"</label>").attr("for",e.attr("id"));b.html("").append(d).append(g).append(e),e.focus(),e.select(),e.on("keyup keypress focusout",function(a){if(!f.behatsiterunning||"focusout"!==a.type){if("keypress"===a.type&&13===a.keyCode){var c=e.val();n(b),m(b,c)}("keyup"===a.type&&27===a.keyCode||"focusout"===a.type)&&n(b)}})})},r=function(a,b){n(a),m(a,b)},s=function(b,c){var d,e=a("<select></select>").attr("id",p("id_inplacevalue_",20)),g=a('<label class="accesshide">'+j.attr("data-editlabel")+"</label>").attr("for",e.attr("id"));for(d in c)e.append(a("<option>").attr("value",c[d].key).html(c[d].value));e.val(b.attr("data-value")),b.html("").append(g).append(e),e.focus(),e.select(),e.on("keyup change focusout",function(a){if(!f.behatsiterunning||"focusout"!==a.type){if("change"===a.type){var c=e.val();n(b),m(b,c)}("keyup"===a.type&&27===a.keyCode||"focusout"===a.type)&&n(b)}})},t=function(b){b.addClass("inplaceeditingon"),b.attr("data-oldcontent",b.html());var c=b.attr("data-type"),d=b.attr("data-options");"toggle"===c?r(b,d):"select"===c?s(b,a.parseJSON(d)):q(b)};o(),t(j)}}),{}});
- define('core/url', ["core/config"],function(a){return{fileUrl:function(b,c){var d=a.wwwroot+b;return"/"!=c.charAt(0)&&(c="/"+c),d+=a.slasharguments?c:"?file="+encodeURIComponent(c)},relativeUrl:function(b){if(0===b.indexOf("http:")||0===b.indexOf("https:")||b.indexOf("://")>=0)throw new Error("relativeUrl function does not accept absolute urls");return"/"!=b.charAt(0)&&(b="/"+b),"admin"!==a.admin&&(b=b.replace(/^\/admin\//,"/"+a.admin+"/")),a.wwwroot+b},imageUrl:function(a,b){return M.util.image_url(a,b)}}});
- define('core/yui', function(){return Y});
- define('core/first', ["jquery"],function(a){a(document).bind("ajaxStart",function(){M.util.js_pending("jq")}).bind("ajaxStop",function(){M.util.js_complete("jq")})});
- !function(a,b){"use strict";"object"==typeof module&&module.exports&&"function"==typeof require?module.exports=b():"function"==typeof define&&"object"==typeof define.amd?define('core/loglevel', b):a.log=b()}(this,function(){"use strict";function a(a){return typeof console===h?!1:void 0!==console[a]?b(console,a):void 0!==console.log?b(console,"log"):g}function b(a,b){var c=a[b];if("function"==typeof c.bind)return c.bind(a);try{return Function.prototype.bind.call(c,a)}catch(d){return function(){return Function.prototype.apply.apply(c,[a,arguments])}}}function c(a,b,c){return function(){typeof console!==h&&(d.call(this,b,c),this[a].apply(this,arguments))}}function d(a,b){for(var c=0;c<i.length;c++){var d=i[c];this[d]=a>c?g:this.methodFactory(d,a,b)}}function e(b,d,e){return a(b)||c.apply(this,arguments)}function f(a,b,c){function f(a){var b=(i[a]||"silent").toUpperCase();try{return void(window.localStorage[l]=b)}catch(c){}try{window.document.cookie=encodeURIComponent(l)+"="+b+";"}catch(c){}}function g(){var a;try{a=window.localStorage[l]}catch(b){}if(typeof a===h)try{var c=window.document.cookie,d=c.indexOf(encodeURIComponent(l)+"=");d&&(a=/^([^;]+)/.exec(c.slice(d))[1])}catch(b){}return void 0===k.levels[a]&&(a=void 0),a}var j,k=this,l="loglevel";a&&(l+=":"+a),k.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},k.methodFactory=c||e,k.getLevel=function(){return j},k.setLevel=function(b,c){if("string"==typeof b&&void 0!==k.levels[b.toUpperCase()]&&(b=k.levels[b.toUpperCase()]),!("number"==typeof b&&b>=0&&b<=k.levels.SILENT))throw"log.setLevel() called with invalid level: "+b;return j=b,c!==!1&&f(b),d.call(k,b,a),typeof console===h&&b<k.levels.SILENT?"No console available for logging":void 0},k.setDefaultLevel=function(a){g()||k.setLevel(a,!1)},k.enableAll=function(a){k.setLevel(k.levels.TRACE,a)},k.disableAll=function(a){k.setLevel(k.levels.SILENT,a)};var m=g();null==m&&(m=null==b?"WARN":b),k.setLevel(m,!1)}var g=function(){},h="undefined",i=["trace","debug","info","warn","error"],j=new f,k={};j.getLogger=function(a){if("string"!=typeof a||""===a)throw new TypeError("You must supply a name when creating a logger.");var b=k[a];return b||(b=k[a]=new f(a,j.getLevel(),j.methodFactory)),b};var l=typeof window!==h?window.log:void 0;return j.noConflict=function(){return typeof window!==h&&window.log===j&&(window.log=l),j},j});
- define('core/notification', ["core/yui","jquery","core/log"],function(a,b,c){var d={types:{success:"core/notification_success",info:"core/notification_info",warning:"core/notification_warning",error:"core/notification_error"},fieldName:"user-notifications",fetchNotifications:function(){require(["core/ajax"],function(a){var b=a.call([{methodname:"core_fetch_notifications",args:{contextid:d.contextid}}]);b[0].done(d.addNotifications)})},addNotifications:function(a){a||(a=[]),b.each(a,function(a,b){d.renderNotification(b.template,b.variables)})},setupTargetRegion:function(){var a=b("#"+d.fieldName);if(!a.length){var c=b("<span>").attr("id",d.fieldName);return a=b("#region-main"),a.length?a.prepend(c):(a=b('[role="main"]'),a.length?a.prepend(c):(a=b("body"),a.prepend(c)))}},addNotification:function(a){var c=d.types.error;return a=b.extend({closebutton:!0,announce:!0,type:"error"},a),a.template?(c=a.template,delete a.template):a.type&&("undefined"!=typeof d.types[a.type]&&(c=d.types[a.type]),delete a.type),d.renderNotification(c,a)},renderNotification:function(a,e){return"undefined"!=typeof e.message&&e.message?void require(["core/templates"],function(c){c.render(a,e).done(function(a,e){b("#"+d.fieldName).prepend(a),c.runTemplateJS(e)}).fail(d.exception)}):void c.debug("Notification received without content. Skipping.")},alert:function(b,c,d){a.use("moodle-core-notification-alert",function(){var a=new M.core.alert({title:b,message:c,yesLabel:d});a.show()})},confirm:function(b,c,d,e,f,g){a.use("moodle-core-notification-confirm",function(){var a=new M.core.confirm({title:b,question:c,yesLabel:d,noLabel:e});a.on("complete-yes",function(){f()}),g&&a.on("complete-no",function(){g()}),a.show()})},exception:function(b){if("undefined"==typeof b.stack&&(b.stack=""),b.debuginfo&&(b.stack+=b.debuginfo+"\n"),b.backtrace){b.stack+=b.backtrace;var c=b.backtrace.match(/line ([^ ]*) of/),d=b.backtrace.match(/ of ([^:]*): /);c&&c[1]&&(b.lineNumber=c[1]),d&&d[1]&&(b.fileName=d[1],b.fileName.length>30&&(b.fileName="..."+b.fileName.substr(b.fileName.length-27)))}"undefined"==typeof b.name&&b.errorcode&&(b.name=b.errorcode),a.use("moodle-core-notification-exception",function(){var a=new M.core.exception(b);a.show()})}};return{init:function(a,b){d.contextid=a,d.setupTargetRegion(),d.addNotifications(b),d.fetchNotifications()},fetchNotifications:d.fetchNotifications,addNotification:d.addNotification,alert:d.alert,confirm:d.confirm,exception:d.exception}});
- define('core/form-course-selector', ["core/ajax","jquery"],function(a,b){return{processResults:function(a,c){var d=[],e=0,f=String(b(a).data("exclude")).split(",");for(e=0;e<c.courses.length;e++)-1===f.indexOf(String(c.courses[e].id))&&d.push({value:c.courses[e].id,label:c.courses[e].displayname});return d},transport:function(c,d,e,f){var g=b(c),h=g.data("requiredcapabilities");h=""!==h.trim()?h.split(","):[];var i=g.data("limittoenrolled"),j=g.data("includefrontpage"),k=null;"undefined"==typeof d&&(d="");var l={criterianame:"search",criteriavalue:d,page:0,perpage:100,requiredcapabilities:h,limittoenrolled:i},m=[{methodname:"core_course_search_courses",args:l}];j&&m.push({methodname:"core_course_get_courses",args:{options:{ids:[j]}}}),k=a.call(m),b.when.apply(b.when,k).done(function(a,b){if(b&&1==b.length){var c=b.pop(),f=""===d||c.fullname.toUpperCase().indexOf(d.toUpperCase())>-1||c.shortname.toUpperCase().indexOf(d.toUpperCase())>-1;f&&a.courses.splice(0,0,c)}e(a)}).fail(f)}}});
- define('core/permissionmanager', ["jquery","core/config","core/notification","core/templates"],function(a,b,c,d){var e,f,g,h,i={ADDROLE:"a.allowlink, a.prohibitlink",REMOVEROLE:"a.preventlink, a.unprohibitlink",UNPROHIBIT:"a.unprohibitlink"},j=a.Event("rolesloaded"),k=null,l=function(){var d={contextid:e,getroles:1,sesskey:b.sesskey};a.post(g+"roles/ajax.php",d,function(){},"json").done(function(b){try{h=b,l=function(){a("body").trigger(j)},l()}catch(d){c.exception(d)}}).fail(function(a,b,d){c.exception(d)})},m=function(b,f,i){var j={contextid:e,roleid:f,sesskey:M.cfg.sesskey,action:i,capability:b.data("name")};a.post(g+"roles/ajax.php",j,function(){},"json").done(function(e){var i=e;try{var j={rolename:h[f],roleid:f,adminurl:g,imageurl:M.util.image_url("t/delete","moodle")};switch(i){case"allow":j.spanclass="allowed",j.linkclass="preventlink",j.action="prevent";break;case"prohibit":j.spanclass="forbidden",j.linkclass="unprohibitlink",j.action="unprohibit";break;case"prevent":return void b.find('a[data-role-id="'+f+'"]').first().closest(".allowed").remove();case"unprohibit":return void b.find('a[data-role-id="'+f+'"]').first().closest(".forbidden").remove();default:return}d.render("core/permissionmanager_role",j).done(function(c){if("allow"==i)a(c).insertBefore(b.find(".allowmore:first"));else if("prohibit"==i){a(c).insertBefore(b.find(".prohibitmore:first"));var d=b.find(".allowedroles").first().find('a[data-role-id="'+f+'"]');d&&d.first().closest(".allowed").remove()}k.hide()}).fail(c.exception)}catch(l){c.exception(l)}}).fail(function(a,b,d){c.exception(d)})},n=function(b){b.preventDefault(),a("body").one("rolesloaded",function(){var e=a(b.currentTarget),g=e.data("action"),j=e.closest("tr.rolecap"),l={cap:j.data("humanname"),context:f},n=M.util.get_string("role"+g+"info","core_role",l);null===k&&(k=new M.core.dialogue({draggable:!0,modal:!0,closeButton:!0,width:"450px"})),k.set("headerContent",M.util.get_string("role"+g+"header","core_role"));var o,p,q=[];switch(g){case"allow":p=j.find(i.REMOVEROLE);break;case"prohibit":p=j.find(i.UNPROHIBIT)}for(o in h){var r="",s=p.filter("[data-role-id='"+o+"']").length;s&&(r="disabled");var t={roleid:o,rolename:h[o],disabled:r};q.push(t)}d.render("core/permissionmanager_panelcontent",{message:n,roles:q}).done(function(b){k.set("bodyContent",b),k.show(),a("div.role_buttons").delegate("input","click",function(b){var c=a(b.currentTarget).data("role-id");m(j,c,g)})}).fail(c.exception)}),l()},o=function(b){b.preventDefault(),a("body").one("rolesloaded",function(){var d=a(b.currentTarget),e=d.data("action"),g=d.data("role-id"),i=d.closest("tr.rolecap"),j={role:h[g],cap:i.data("humanname"),context:f};c.confirm(M.util.get_string("confirmunassigntitle","core_role"),M.util.get_string("confirmrole"+e,"core_role",j),M.util.get_string("confirmunassignyes","core_role"),M.util.get_string("confirmunassignno","core_role"),function(){m(i,g,e)})}),l()};return{initialize:function(b){e=b.contextid,f=b.contextname,g=b.adminurl;var c=a("body");c.delegate(i.ADDROLE,"click",n),c.delegate(i.REMOVEROLE,"click",o)}}});
- define('core/templates', ["core/mustache","jquery","core/ajax","core/str","core/notification","core/url","core/config","core/localstorage","core/event","core/yui","core/log"],function(a,b,c,d,e,f,g,h,i,j,k){var l=0,m={},n=function(){this.requiredStrings=[],this.requiredJS=[],this.currentThemeName=""};n.prototype.requiredStrings=null,n.prototype.requiredJS=null,n.prototype.currentThemeName="",n.prototype.getTemplate=function(a,d){var e=b.Deferred(),f=a.split("/"),g=f.shift(),i=f.shift(),j=this.currentThemeName+"/"+a;if(j in m)return e.resolve(m[j]),e.promise();var k=h.get("core_template/"+j);if(k)return e.resolve(k),m[j]=k,e.promise();var l=c.call([{methodname:"core_output_load_template",args:{component:g,template:i,themename:this.currentThemeName}}],d,!1);return l[0].done(function(a){h.set("core_template/"+j,a),m[j]=a,e.resolve(a)}).fail(function(a){e.reject(a)}),e.promise()},n.prototype.partialHelper=function(a){var b="";return this.getTemplate(a,!1).done(function(a){b=a}).fail(e.exception),b},n.prototype.pixHelper=function(b,c,d){var e,g=c.split(","),h="",i="",j="";g.length>0&&(h=g.shift().trim()),g.length>0&&(i=g.shift().trim()),g.length>0&&(j=g.join(",").trim());var k=f.imageUrl(h,i),l={attributes:[{name:"src",value:k},{name:"alt",value:d(j)},{name:"title",value:d(j)},{name:"class",value:"smallicon"}]},n=m[this.currentThemeName+"/core/pix_icon"];return e=a.render(n,l,this.partialHelper.bind(this)),e.trim()},n.prototype.jsHelper=function(a,b,c){return this.requiredJS.push(c(b,a)),""},n.prototype.stringHelper=function(a,b,c){var d=b.split(","),e="",f="",g="";d.length>0&&(e=d.shift().trim()),d.length>0&&(f=d.shift().trim()),d.length>0&&(g=d.join(",").trim()),""!==g&&(g=c(g,a)),0===g.indexOf("{")&&0!==g.indexOf("{{")&&(g=JSON.parse(g));var h=this.requiredStrings.length;return this.requiredStrings.push({key:e,component:f,param:g}),"[[_s"+h+"]]"},n.prototype.quoteHelper=function(a,b,c){var d=c(b.trim(),a);return d=d.replace('"','\\"').replace(/([\{\}]{2,3})/g,"{{=<% %>=}}$1<%={{ }}=%>"),'"'+d+'"'},n.prototype.addHelpers=function(a,b){this.currentThemeName=b,this.requiredStrings=[],this.requiredJS=[],a.uniqid=l++,a.str=function(){return this.stringHelper.bind(this,a)}.bind(this),a.pix=function(){return this.pixHelper.bind(this,a)}.bind(this),a.js=function(){return this.jsHelper.bind(this,a)}.bind(this),a.quote=function(){return this.quoteHelper.bind(this,a)}.bind(this),a.globals={config:g},a.currentTheme=b},n.prototype.getJS=function(a){var b="";return this.requiredJS.length>0&&(b=this.requiredJS.join(";\n")),this.treatStringsInContent(b,a)},n.prototype.treatStringsInContent=function(a,b){var c,d,e,f,g,h,i=/\[\[_s\d+\]\]/;do{for(c="",d=a.search(i);d>-1;){c+=a.substring(0,d),a=a.substr(d),e="",f=4,g=a.substr(f,1);do e+=g,f++,g=a.substr(f,1);while("]"!=g);h=b[parseInt(e,10)],"undefined"==typeof h&&(k.debug("Could not find string for pattern [[_s"+e+"]]."),h=""),c+=h,a=a.substr(6+e.length),d=a.search(i)}a=c+a,d=a.search(i)}while(d>-1);return a},n.prototype.doRender=function(c,e,f){var g=b.Deferred();this.currentThemeName=f;var h=this.getTemplate("core/pix_icon",!0);return h.done(function(){this.addHelpers(e,f);var b="";try{b=a.render(c,e,this.partialHelper.bind(this))}catch(h){g.reject(h)}this.requiredStrings.length>0?d.get_strings(this.requiredStrings).then(function(a){b=this.treatStringsInContent(b,a),g.resolve(b,this.getJS(a))}.bind(this)).fail(g.reject):g.resolve(b.trim(),this.getJS([]))}.bind(this)).fail(g.reject),g.promise()};var o=function(a){if(""!==a.trim()){var c=b("<script>").attr("type","text/javascript").html(a);b("head").append(c)}},p=function(a,c,d,e){var f=b(a);if(f.length){var g=b(c),h=null;e?(h=new j.NodeList(f.children().get()),h.destroy(!0),f.empty(),f.append(g)):(h=new j.NodeList(f.get()),h.destroy(!0),f.replaceWith(g)),o(d),i.notifyFilterContentUpdated(g)}};return n.prototype.render=function(a,c,d){var e=b.Deferred();"undefined"==typeof d&&(d=g.theme),this.currentThemeName=d;var f=this.getTemplate(a,!0);return f.done(function(a){var b=this.doRender(a,c,d);b.done(function(a,b){e.resolve(a,b)}).fail(function(a){e.reject(a)})}.bind(this)).fail(function(a){e.reject(a)}),e.promise()},{render:function(a,b,c){var d=new n;return d.render(a,b,c)},runTemplateJS:o,replaceNodeContents:function(a,b,c){return p(a,b,c,!0)},replaceNode:function(a,b,c){return p(a,b,c,!1)}}});
- define('core/str', ["jquery","core/ajax","core/localstorage"],function(a,b,c){return{get_string:function(a,b,c,d){var e=this.get_strings([{key:a,component:b,param:c,lang:d}]);return e.then(function(a){return a[0]})},get_strings:function(d){var e,f=a.Deferred(),g=[],h=0,i=!1;for(h=0;h<d.length;h++)if(e=d[h],"undefined"==typeof e.lang&&(e.lang=a("html").attr("lang").replace("-","_")),"undefined"==typeof M.str[e.component]||"undefined"==typeof M.str[e.component][e.key]){var j=c.get("core_str/"+e.key+"/"+e.component+"/"+e.lang);j?("undefined"==typeof M.str[e.component]&&(M.str[e.component]=[]),M.str[e.component][e.key]=j):i=!0}if(i){var k=[];for(h=0;h<d.length;h++)e=d[h],k.push({methodname:"core_get_string",args:{stringid:e.key,component:e.component,lang:e.lang,stringparams:[]}});var l=b.call(k,!0,!1);a.when.apply(null,l).done(function(){var a=0;for(a=0;a<arguments.length;a++)e=d[a],"undefined"==typeof M.str[e.component]&&(M.str[e.component]=[]),M.str[e.component][e.key]=arguments[a],c.set("core_str/"+e.key+"/"+e.component+"/"+e.lang,arguments[a]),g[a]=M.util.get_string(e.key,e.component,e.param).trim();f.resolve(g)}).fail(function(a){f.reject(a)})}else{for(h=0;h<d.length;h++)e=d[h],g[h]=M.util.get_string(e.key,e.component,e.param);f.resolve(g)}return f.promise()}}});
- define('core/search-input', ["jquery"],function(a){var b=null,c=function(a){b.hasClass("expanded")?e():d(a)},d=function(c){var d=a(document).width();if("keydown"!==c.type||13===c.keyCode||32===c.keyCode)return 767>=d&&("click"===c.type||"keydown"===c.type)?void f():void(767>=d||("keydown"===c.type&&c.preventDefault(),b.addClass("expanded"),b.find("form").addClass("expanded"),b.find("input").focus()))},e=function(){b.removeClass("expanded"),b.find("form").removeClass("expanded")},f=function(){b.find("form").submit()};return{init:function(d){b=a("#"+d),b.on("click mouseover keydown","div",c)}}});
- define('core/fragment', ["jquery","core/ajax"],function(a,b){var c=function(c,d,e,f){var g=[];for(var h in f)g.push({name:h,value:f[h]});var i=a.Deferred(),j=b.call([{methodname:"core_get_fragment",args:{component:c,callback:d,contextid:e,args:g}}],!1);return j[0].done(function(a){i.resolve(a)}).fail(function(a){i.reject(a)}),i.promise()};return{loadFragment:function(b,d,e,f){var g=a.Deferred();return a.when(c(b,d,e,f)).then(function(b){var c=a(b.javascript),d="";c.each(function(b,c){c=a(c);var e=c.prop("tagName");if(e&&"script"==e.toLowerCase())if(c.attr("src")){var f=!1;a("script").each(function(b,d){return a(d).attr("src")==c.attr("src")&&(f=!0),!f}),f||(d+=" { ",d+=' node = document.createElement("script"); ',d+=' node.type = "text/javascript"; ',d+=' node.src = decodeURI("'+encodeURI(c.attr("src"))+'"); ',d+=' document.getElementsByTagName("head")[0].appendChild(node); ',d+=" } ")}else d+=" "+c.text()}.bind(this)),g.resolve(b.html,d)}).fail(function(a){g.reject(a)}),g.promise()}}});
- define('core/tree', ["jquery"],function(a){var b={ITEM:"[role=treeitem]",GROUP:"[role=treeitem]:has([role=group]), [role=treeitem][aria-owns], [role=treeitem][data-requires-ajax=true]",CLOSED_GROUP:"[role=treeitem]:has([role=group])[aria-expanded=false], [role=treeitem][aria-owns][aria-expanded=false], [role=treeitem][data-requires-ajax=true][aria-expanded=false]",FIRST_ITEM:"[role=treeitem]:first",VISIBLE_ITEM:"[role=treeitem]:visible",UNLOADED_AJAX_ITEM:"[role=treeitem][data-requires-ajax=true][data-loaded=false][aria-expanded=true]"},c=function(c,d){this.treeRoot=a(c),this.treeRoot.data("activeItem",null),this.selectCallback=d,this.keys={tab:9,enter:13,space:32,pageup:33,pagedown:34,end:35,home:36,left:37,up:38,right:39,down:40,asterisk:106},this.initialiseNodes(this.treeRoot),this.setActiveItem(this.treeRoot.find(b.FIRST_ITEM)),this.refreshVisibleItemsCache(),this.bindEventHandlers()};return c.prototype.refreshVisibleItemsCache=function(){this.treeRoot.data("visibleItems",this.treeRoot.find(b.VISIBLE_ITEM))},c.prototype.getVisibleItems=function(){return this.treeRoot.data("visibleItems")},c.prototype.setActiveItem=function(a){var b=this.treeRoot.data("activeItem");a!==b&&(b&&(b.attr("tabindex","-1"),b.attr("aria-selected","false")),a.attr("tabindex","0"),a.attr("aria-selected","true"),this.treeRoot.data("activeItem",a),"function"==typeof this.selectCallback&&this.selectCallback(a))},c.prototype.isGroupItem=function(a){return a.is(b.GROUP)},c.prototype.getGroupFromItem=function(a){return this.treeRoot.find("#"+a.attr("aria-owns"))||a.children("[role=group]")},c.prototype.isGroupCollapsed=function(a){return"false"===a.attr("aria-expanded")},c.prototype.isGroupCollapsible=function(a){return"false"!==a.attr("data-collapsible")},c.prototype.initialiseNodes=function(c){this.removeAllFromTabOrder(c),this.setAriaSelectedFalseOnItems(c);var d=this;c.find(b.UNLOADED_AJAX_ITEM).each(function(){var b=a(this);d.collapseGroup(b),d.expandGroup(b)})},c.prototype.removeAllFromTabOrder=function(b){b.find("*").attr("tabindex","-1"),this.getGroupFromItem(a(b)).find("*").attr("tabindex","-1")},c.prototype.setAriaSelectedFalseOnItems=function(a){a.find(b.ITEM).attr("aria-selected","false")},c.prototype.expandAllGroups=function(){var c=this;this.treeRoot.find(b.CLOSED_GROUP).each(function(){var b=a(this);c.expandGroup(a(this)).done(function(){c.expandAllChildGroups(b)})})},c.prototype.expandAllChildGroups=function(c){var d=this;this.getGroupFromItem(c).find(b.CLOSED_GROUP).each(function(){var b=a(this);d.expandGroup(a(this)).done(function(){d.expandAllChildGroups(b)})})},c.prototype.expandGroup=function(b){var c=a.Deferred();if("false"!==b.attr("data-expandable")&&this.isGroupCollapsed(b))if("true"===b.attr("data-requires-ajax")&&"true"!==b.attr("data-loaded")){b.attr("data-loaded",!1);var d=b.closest("[data-ajax-loader]").attr("data-ajax-loader"),e=this;b.addClass("loading"),require([d],function(a){a.load(b).done(function(){b.attr("data-loaded",!0),e.initialiseNodes(b),e.finishExpandingGroup(b),b.removeClass("loading"),c.resolve()})})}else this.finishExpandingGroup(b),c.resolve();else c.resolve();return c},c.prototype.finishExpandingGroup=function(a){var b=this.getGroupFromItem(a);b.attr("aria-hidden","false"),a.attr("aria-expanded","true"),this.refreshVisibleItemsCache()},c.prototype.collapseGroup=function(a){if(this.isGroupCollapsible(a)&&!this.isGroupCollapsed(a)){var b=this.getGroupFromItem(a);b.attr("aria-hidden","true"),a.attr("aria-expanded","false"),this.refreshVisibleItemsCache()}},c.prototype.toggleGroup=function(a){"true"===a.attr("aria-expanded")?this.collapseGroup(a):this.expandGroup(a)},c.prototype.handleKeyDown=function(c,d){var e=this.getVisibleItems().index(c);if(d.altKey||d.ctrlKey||d.metaKey||d.shiftKey&&d.keyCode!=this.keys.tab)return!0;switch(d.keyCode){case this.keys.home:return this.getVisibleItems().first().focus(),d.stopPropagation(),!1;case this.keys.end:return this.getVisibleItems().last().focus(),d.stopPropagation(),!1;case this.keys.enter:var f=c.children("a").length?c.children("a"):c.children().not(b.GROUP).find("a");return f.length?window.location.href=f.first().attr("href"):this.isGroupItem(c)&&this.toggleGroup(c,!0),d.stopPropagation(),!1;case this.keys.space:return this.isGroupItem(c)&&this.toggleGroup(c,!0),d.stopPropagation(),!1;case this.keys.left:var g=function(b){b.getVisibleItems().filter(function(){return b.getGroupFromItem(a(this)).has(c).length}).focus()};return this.isGroupItem(c)?this.isGroupCollapsed(c)?g(this):this.collapseGroup(c):g(this),d.stopPropagation(),!1;case this.keys.right:return this.isGroupItem(c)&&(this.isGroupCollapsed(c)?this.expandGroup(c):this.getGroupFromItem(c).find(b.ITEM).first().focus()),d.stopPropagation(),!1;case this.keys.up:if(e>0){var h=this.getVisibleItems().eq(e-1);h.focus()}return d.stopPropagation(),!1;case this.keys.down:if(e<this.getVisibleItems().length-1){var i=this.getVisibleItems().eq(e+1);i.focus()}return d.stopPropagation(),!1;case this.keys.asterisk:return this.expandAllGroups(),d.stopPropagation(),!1}return!0},c.prototype.handleClick=function(a,b){return b.altKey||b.ctrlKey||b.shiftKey||b.metaKey?!0:(a.focus(),this.isGroupItem(a)&&this.toggleGroup(a),b.stopPropagation(),!0)},c.prototype.handleFocus=function(a,b){return this.setActiveItem(a),b.stopPropagation(),!0},c.prototype.bindEventHandlers=function(){var c=this;this.treeRoot.on({click:function(b){return c.handleClick(a(this),b)},keydown:function(b){return c.handleKeyDown(a(this),b)},focus:function(b){return c.handleFocus(a(this),b)}},b.ITEM)},c});
- define('core/log', ["core/loglevel"],function(a){var b=a.methodFactory;return a.methodFactory=function(a,c){var d=b(a,c);return function(a,b){d(b?b+": "+a:a)}},a.setConfig=function(b){"undefined"!=typeof b.level&&a.setLevel(b.level)},a});
- define('core/event', ["jquery","core/yui"],function(a,b){return{notifyFilterContentUpdated:function(c){c=a(c),b.use("event","moodle-core-event",function(b){a(document).trigger(M.core.event.FILTER_CONTENT_UPDATED,c);var d=new b.NodeList(c.get());b.fire(M.core.event.FILTER_CONTENT_UPDATED,{nodes:d})})},notifyEditorContentRestored:function(){b.use("event","moodle-core-event",function(b){a(document).trigger(M.core.event.EDITOR_CONTENT_RESTORED),b.fire(M.core.event.EDITOR_CONTENT_RESTORED)})}}});
- define('core/config', function(){return M.cfg});
- define('mod_assign/grading_navigation', ["jquery","core/notification","core/str","core/form-autocomplete","core/ajax","mod_assign/grading_form_change_checker"],function(a,b,c,d,e,f){var g=function(e){this._regionSelector=e,this._region=a(e),this._filters=[],this._users=[],this._filteredUsers=[],this._loadAllUsers(),this._region.find('[data-action="previous-user"]').on("click",this._handlePreviousUser.bind(this)),this._region.find('[data-action="next-user"]').on("click",this._handleNextUser.bind(this)),this._region.find('[data-action="change-user"]').on("change",this._handleChangeUser.bind(this)),this._region.find('[data-region="user-filters"]').on("click",this._toggleExpandFilters.bind(this)),a(document).on("user-changed",this._refreshSelector.bind(this));var f=this._region.find('[data-region="user-filters"]'),g=a(document.getElementById(f.attr("aria-controls")));g.on("change",'[type="checkbox"]',this._filterChanged.bind(this));var h=a('[data-region="grading-navigation-panel"]').data("first-userid");h&&this._selectUserById(h),c.get_string("changeuser","mod_assign").done(function(a){d.enhance("[data-action=change-user]",!1,"mod_assign/participant_selector",a)}.bind(this)).fail(b.exception),a(document).bind("start-loading-user",function(){this._isLoading=!0}.bind(this)),a(document).bind("finish-loading-user",function(){this._isLoading=!1}.bind(this))};return g.prototype._isLoading=!1,g.prototype._regionSelector=null,g.prototype._filters=null,g.prototype._users=null,g.prototype._region=null,g.prototype._loadAllUsers=function(){var a=this._region.find("[data-action=change-user]"),c=a.attr("data-assignmentid"),d=a.attr("data-groupid");e.call([{methodname:"mod_assign_list_participants",args:{assignid:c,groupid:d,filter:"",onlyids:!0},done:this._usersLoaded.bind(this),fail:b.exception}])},g.prototype._usersLoaded=function(b){if(this._filteredUsers=this._users=b,this._users.length){var c=this._region.find('[data-region="user-filters"]'),d=a(document.getElementById(c.attr("aria-controls")));d.find('[type="checkbox"]').trigger("change")}else this._selectNoUser()},g.prototype._checkClickOutsideConfigureFilters=function(b){var c=this._region.find('[data-region="configure-filters"]');if(!c.is(b.target)&&0===c.has(b.target).length){var d=this._region.find('[data-region="user-filters"]');c.hide(),c.attr("aria-hidden","true"),d.attr("aria-expanded","false"),a(document).unbind("click.mod_assign_grading_navigation")}},g.prototype._filterChanged=function(d){var e=a(d.target).attr("name"),f=e.split("_").pop(),g=a(d.target).prop("checked");if(g)-1==this._filters.indexOf(f)&&(this._filters[this._filters.length]=f);else{var h=this._filters.indexOf(f);-1!=h&&this._filters.splice(h,1)}var i=[];this._region.find('[data-region="configure-filters"]').find('[type="checkbox"]').each(function(b,c){a(c).prop("checked")&&(i[i.length]=a(c).closest("label").text())}.bind(this)),i.length?this._region.find('[data-region="user-filters"] span').text(i.join(", ")):c.get_string("nofilters","mod_assign").done(function(a){this._region.find('[data-region="user-filters"] span').text(a)}.bind(this)).fail(b.exception);var j=this._region.find("[data-action=change-user]"),k=j.attr("data-selected"),l=0;this._filteredUsers=[],a.each(this._users,function(b,c){var d=!0;a.each(this._filters,function(a,b){"submitted"==b?"0"==c.submitted&&(d=!1):"notsubmitted"==b?"1"==c.submitted&&(d=!1):"requiregrading"==b&&"0"==c.requiregrading&&(d=!1)}.bind(this)),d&&(this._filteredUsers[this._filteredUsers.length]=c,k==c.id&&(l=this._filteredUsers.length-1))}.bind(this)),this._filteredUsers.length?this._selectUserById(this._filteredUsers[l].id):this._selectNoUser()},g.prototype._selectNoUser=function(){this._isLoading||(f.checkFormForChanges('[data-region="grade-panel"] .gradeform')?c.get_strings([{key:"unsavedchanges",component:"mod_assign"},{key:"unsavedchangesquestion",component:"mod_assign"},{key:"saveandcontinue",component:"mod_assign"},{key:"cancel",component:"core"}]).done(function(c){b.confirm(c[0],c[1],c[2],c[3],function(){a(document).trigger("save-changes",-1)})}.bind(this)):a(document).trigger("user-changed",-1))},g.prototype._selectUserById=function(d){var e=this._region.find("[data-action=change-user]"),g=parseInt(d,10);this._isLoading||(f.checkFormForChanges('[data-region="grade-panel"] .gradeform')?c.get_strings([{key:"unsavedchanges",component:"mod_assign"},{key:"unsavedchangesquestion",component:"mod_assign"},{key:"saveandcontinue",component:"mod_assign"},{key:"cancel",component:"core"}]).done(function(c){b.confirm(c[0],c[1],c[2],c[3],function(){a(document).trigger("save-changes",g)})}.bind(this)):(e.attr("data-selected",d),!isNaN(g)&&g>0&&a(document).trigger("user-changed",d)))},g.prototype._toggleExpandFilters=function(b){b.preventDefault();var c=a(b.target).closest('[data-region="user-filters"]'),d="true"==c.attr("aria-expanded"),e=a(document.getElementById(c.attr("aria-controls")));d?(e.hide(),e.attr("aria-hidden","true"),c.attr("aria-expanded","false"),a(document).unbind("click.mod_assign_grading_navigation")):(e.css("display","inline-block"),e.attr("aria-hidden","false"),c.attr("aria-expanded","true"),b.stopPropagation(),a(document).on("click.mod_assign_grading_navigation",this._checkClickOutsideConfigureFilters.bind(this)))},g.prototype._handlePreviousUser=function(a){a.preventDefault();var b=this._region.find("[data-action=change-user]"),c=b.attr("data-selected"),d=0,e=0;for(d=0;d<this._filteredUsers.length;d++)if(this._filteredUsers[d].id==c){e=d;break}var f=this._filteredUsers.length,g=e-1;0>g&&(g=f-1),f&&this._selectUserById(this._filteredUsers[g].id)},g.prototype._handleNextUser=function(a){a.preventDefault();var b=this._region.find("[data-action=change-user]"),c=b.attr("data-selected"),d=0,e=0;for(d=0;d<this._filteredUsers.length;d++)if(this._filteredUsers[d].id==c){e=d;break}var f=this._filteredUsers.length,g=(e+1)%f;f&&this._selectUserById(this._filteredUsers[g].id)},g.prototype._refreshCount=function(){var a=this._region.find("[data-action=change-user]"),d=a.attr("data-selected"),e=0,f=0;if(isNaN(d)||0>=d)this._region.find('[data-region="user-count"]').hide();else{for(this._region.find('[data-region="user-count"]').show(),e=0;e<this._filteredUsers.length;e++)if(this._filteredUsers[e].id==d){f=e;break}var g=this._filteredUsers.length;g&&(f+=1);var h={x:f,y:g};c.get_string("xofy","mod_assign",h).done(function(a){this._region.find('[data-region="user-count-summary"]').text(a)}.bind(this)).fail(b.exception)}},g.prototype._refreshSelector=function(a,b){var c=this._region.find("[data-action=change-user]");b=parseInt(b,10),!isNaN(b)&&b>0&&c.attr("data-selected",b),this._refreshCount()},g.prototype._handleChangeUser=function(){var d=this._region.find("[data-action=change-user]"),e=parseInt(d.val(),10);this._isLoading||(f.checkFormForChanges('[data-region="grade-panel"] .gradeform')?c.get_strings([{key:"unsavedchanges",component:"mod_assign"},{key:"unsavedchangesquestion",component:"mod_assign"},{key:"saveandcontinue",component:"mod_assign"},{key:"cancel",component:"core"}]).done(function(c){b.confirm(c[0],c[1],c[2],c[3],function(){a(document).trigger("save-changes",e)})}.bind(this)):!isNaN(e)&&e>0&&(d.attr("data-selected",e),a(document).trigger("user-changed",e)))},g});
- define('mod_assign/grading_form_change_checker', ["jquery"],function(a){return{saveFormState:function(b){a(b).trigger("save-form-state");var c=a(b).serialize();a(b).data("saved-form-state",c)},checkFormForChanges:function(b){a(b).trigger("save-form-state");var c=a(b).serialize(),d=a(b).data("saved-form-state");return"undefined"==typeof d?!1:d!=c}}});
- define('mod_assign/grading_navigation_user_info', ["jquery","core/notification","core/ajax","core/templates"],function(a,b,c,d){var e=function(b){this._regionSelector=b,this._region=a(b),this._userCache={},a(document).on("user-changed",this._refreshUserInfo.bind(this))};return e.prototype._regionSelector=null,e.prototype._userCache=null,e.prototype._region=null,e.prototype._lastUserId=0,e.prototype._getAssignmentId=function(){return this._region.attr("data-assignmentid")},e.prototype._refreshUserInfo=function(e,f){var g=a.Deferred();this._lastUserId!=f&&(this._lastUserId=f,d.render("mod_assign/loading",{}).done(function(e,h){if(this._region.fadeOut("fast",function(){d.replaceNodeContents(this._region,e,h),this._region.fadeIn("fast")}.bind(this)),0>f)return void d.render("mod_assign/grading_navigation_no_users",{}).done(function(a,b){this._region.fadeOut("fast",function(){d.replaceNodeContents(this._region,a,b),this._region.fadeIn("fast")}.bind(this))}.bind(this)).fail(b.exception);if("undefined"!=typeof this._userCache[f])g.resolve(this._userCache[f]);else{var i=this._getAssignmentId(),j=c.call([{methodname:"mod_assign_get_participant",args:{userid:f,assignid:i,embeduser:!0}}]);j[0].done(function(a){a.hasOwnProperty("id")?(this._userCache[f]=a,g.resolve(this._userCache[f])):g.reject("No users")}.bind(this)).fail(b.exception)}g.done(function(c){var e=a("[data-showuseridentity]").data("showuseridentity").split(","),f=[];c.courseid=a('[data-region="grading-navigation-panel"]').attr("data-courseid"),c.user&&(a.each(e,function(a,b){"undefined"!=typeof c.user[b]&&""!==c.user[b]&&(c.hasidentity=!0,f.push(c.user[b]))}),c.identity=f.join(", "),c.user.profileimageurl&&(c.profileimageurl=c.user.profileimageurl)),d.render("mod_assign/grading_navigation_user_summary",c).done(function(a,b){this._region.fadeOut("fast",function(){d.replaceNodeContents(this._region,a,b),this._region.fadeIn("fast")}.bind(this))}.bind(this)).fail(b.exception)}.bind(this)).fail(function(){d.render("mod_assign/grading_navigation_no_users",{}).done(function(a,b){this._region.fadeOut("fast",function(){d.replaceNodeContents(this._region,a,b),this._region.fadeIn("fast")}.bind(this))}.bind(this)).fail(b.exception)}.bind(this))}.bind(this)).fail(b.exception))},e});
- define('mod_assign/grading_review_panel', ["jquery","mod_assign/grading_events"],function(a,b){var c=function(){this._region=a('[data-region="review-panel-content"]'),this.registerEventListeners()};return c.prototype._region=null,c.prototype.getReviewPanel=function(a){var b=this._region.data("panel-owner");return"undefined"==typeof b&&this._region.data("review-panel-plugin",a),this._region.data("review-panel-plugin")==a?this._region[0]:!1},c.prototype.getTogglePanelButton=function(){return this.getPanelElement().find('[data-region="review-panel-toggle"]')},c.prototype.getPanelElement=function(){return a('[data-region="review-panel"]')},c.prototype.getPanelContentElement=function(){return a('[data-region="review-panel-content"]')},c.prototype.togglePanel=function(){this.getPanelElement().hasClass("collapsed")?a(document).trigger(b.EXPAND_REVIEW_PANEL):a(document).trigger(b.COLLAPSE_REVIEW_PANEL)},c.prototype.collapsePanel=function(){this.getPanelElement().addClass("collapsed").removeClass("grade-panel-collapsed"),this.getPanelContentElement().attr("aria-hidden",!0)},c.prototype.expandPanel=function(){this.getPanelElement().removeClass("collapsed"),this.getPanelContentElement().removeAttr("aria-hidden")},c.prototype.registerEventListeners=function(){var c=this.getTogglePanelButton();c.click(function(a){this.togglePanel(),a.preventDefault()}.bind(this)),c.keydown(function(a){a.metaKey||a.shiftKey||a.altKey||a.ctrlKey||(13===a.keyCode||32===a.keyCode)&&(this.togglePanel(),a.preventDefault())}.bind(this));var d=a(document);d.on(b.COLLAPSE_REVIEW_PANEL,function(){this.collapsePanel()}.bind(this)),d.on(b.COLLAPSE_GRADE_PANEL,function(){this.expandPanel(),this.getPanelElement().addClass("grade-panel-collapsed")}.bind(this)),d.on(b.EXPAND_REVIEW_PANEL,function(){this.expandPanel()}.bind(this)),d.on(b.EXPAND_GRADE_PANEL,function(){this.getPanelElement().removeClass("grade-panel-collapsed")}.bind(this))},c});
- define('mod_assign/grading_events', function(){return{COLLAPSE_REVIEW_PANEL:"grading:collapse-review-panel",EXPAND_REVIEW_PANEL:"grading:expand-review-panel",COLLAPSE_GRADE_PANEL:"grading:collapse-grade-panel",EXPAND_GRADE_PANEL:"grading:expand-grade-panel"}});
- define('mod_assign/grading_panel', ["jquery","core/yui","core/notification","core/templates","core/fragment","core/ajax","core/str","mod_assign/grading_form_change_checker","mod_assign/grading_events"],function(a,b,c,d,e,f,g,h,i){var j=function(b){this._regionSelector=b,this._region=a(b),this._userCache=[],this.registerEventListeners()};return j.prototype._regionSelector=null,j.prototype._lastUserId=0,j.prototype._lastAttemptNumber=-1,j.prototype._region=null,j.prototype._niceReplaceNodeContents=function(b,c,e){var f=a.Deferred();return b.fadeOut("fast",function(){d.replaceNodeContents(b,c,e),b.fadeIn("fast",function(){f.resolve()})}),f.promise()},j.prototype._saveFormState=function(){"undefined"!=typeof window.tinyMCE&&window.tinyMCE.triggerSave();var b=a('[data-region="grading-actions-form"] [name="sendstudentnotifications"]').prop("checked");a('.gradeform [name="sendstudentnotifications"]').val(b)},j.prototype._submitForm=function(b,d){var e=a(this._region.find("form.gradeform"));a('[data-region="overlay"]').show(),e.trigger("save-form-state");var g=e.serialize(),h=this._region.attr("data-assignmentid");f.call([{methodname:"mod_assign_submit_grading_form",args:{assignmentid:h,userid:this._lastUserId,jsonformdata:JSON.stringify(g)},done:this._handleFormSubmissionResponse.bind(this,g,d),fail:c.exception}])},j.prototype._handleFormSubmissionResponse=function(d,e,f){"undefined"==typeof e&&(e=this._lastUserId),f.length?a(document).trigger("reset",[this._lastUserId,d]):(g.get_strings([{key:"changessaved",component:"core"},{key:"gradechangessaveddetail",component:"mod_assign"}]).done(function(a){c.alert(a[0],a[1])}).fail(c.exception),b.use("moodle-core-formchangechecker",function(){M.core_formchangechecker.reset_form_dirty_state()}),e==this._lastUserId?a(document).trigger("reset",e):a(document).trigger("user-changed",e)),a('[data-region="overlay"]').hide()},j.prototype._resetForm=function(b,c,d){var e=a.Event("custom");"undefined"==typeof c&&(c=this._lastUserId),this._lastUserId=0,this._refreshGradingPanel(e,c,d)},j.prototype._chooseAttempt=function(b){var d=a(b.target),e=d.data("submissions"),f=a(document.getElementById(e)),h=f.clone(),i=h.wrap(a("<form/>")).html();g.get_strings([{key:"viewadifferentattempt",component:"mod_assign"},{key:"view",component:"core"},{key:"cancel",component:"core"}]).done(function(b){c.confirm(b[0],i,b[1],b[2],function(){var b=a("input:radio[name='select-attemptnumber']:checked").val();this._refreshGradingPanel(null,this._lastUserId,"",b)}.bind(this))}.bind(this)).fail(c.exception)},j.prototype._addPopoutButtons=function(b){var e=a(b);d.render("mod_assign/popout_button",{}).done(function(a){e.find(".fitem_ffilemanager .fitemtitle").append(a),e.find(".fitem_feditor .fitemtitle").append(a),e.find(".fitem_f .fitemtitle").append(a),e.on("click",'[data-region="popout-button"]',this._togglePopout.bind(this))}.bind(this)).fail(c.exception)},j.prototype._togglePopout=function(b){b.preventDefault();var c=a(b.target).closest(".fitem");c.hasClass("popout")?a(".popout").removeClass("popout"):(a(".popout").removeClass("popout"),c.addClass("popout"),c.addClass("moodle-has-zindex"))},j.prototype._refreshGradingPanel=function(b,f,g,i){var j=this._region.attr("data-contextid");"undefined"==typeof g&&(g=""),"undefined"==typeof i&&(i=-1),(this._lastUserId!=f||this._lastAttemptNumber!=i||""!==g)&&(this._lastUserId=f,this._lastAttemptNumber=i,a(document).trigger("start-loading-user"),window.M.util.js_pending("mod-assign-loading-user"),d.render("mod_assign/loading",{}).done(function(b,d){this._niceReplaceNodeContents(this._region,b,d).done(function(){if(f>0){this._region.show();var b={userid:f,attemptnumber:i,jsonformdata:JSON.stringify(g)};e.loadFragment("mod_assign","gradingpanel",j,b).done(function(b,d){this._niceReplaceNodeContents(this._region,b,d).done(function(){h.saveFormState('[data-region="grade-panel"] .gradeform'),a(document).on("editor-content-restored",function(){h.saveFormState('[data-region="grade-panel"] .gradeform')}),a('[data-region="attempt-chooser"]').on("click",this._chooseAttempt.bind(this)),this._addPopoutButtons('[data-region="grade-panel"] .gradeform'),a(document).trigger("finish-loading-user"),window.M.util.js_complete("mod-assign-loading-user")}.bind(this)).fail(c.exception)}.bind(this)).fail(c.exception)}else{this._region.hide();var d=a('[data-region="review-panel"]');d.length&&this._niceReplaceNodeContents(d,"",""),a(document).trigger("finish-loading-user"),window.M.util.js_complete("mod-assign-loading-user")}}.bind(this))}.bind(this)).fail(c.exception))},j.prototype.getPanelElement=function(){return a('[data-region="grade-panel"]')},j.prototype.collapsePanel=function(){this.getPanelElement().addClass("collapsed")},j.prototype.expandPanel=function(){this.getPanelElement().removeClass("collapsed")},j.prototype.registerEventListeners=function(){var b=a(document);b.on("user-changed",this._refreshGradingPanel.bind(this)),b.on("save-changes",this._submitForm.bind(this)),b.on("reset",this._resetForm.bind(this)),b.on("save-form-state",this._saveFormState.bind(this)),b.on(i.COLLAPSE_GRADE_PANEL,function(){this.collapsePanel()}.bind(this)),b.on(i.COLLAPSE_REVIEW_PANEL,function(){this.expandPanel()}.bind(this)),b.on(i.EXPAND_GRADE_PANEL,function(){this.expandPanel()}.bind(this))},j});
- define('mod_assign/participant_selector', ["core/ajax","jquery","core/templates"],function(a,b,c){return{processResults:function(a,b){var c=[],d=0;for(d=0;d<b.length;d++)c[d]={value:b[d].id,label:b[d].label};return c},transport:function(d,e,f,g){var h=b(d).attr("data-assignmentid"),i=b(d).attr("data-groupid"),j=b('[data-region="configure-filters"] input[type="checkbox"]'),k=[];j.each(function(a,c){k[b(c).attr("name")]=b(c).prop("checked")});var l=a.call([{methodname:"mod_assign_list_participants",args:{assignid:h,groupid:i,filter:e,limit:30,includeenrolments:!1}}]);l[0].then(function(a){var d=[],e=b("[data-showuseridentity]").data("showuseridentity").split(",");b.each(a,function(a,f){var g=f,h=[],i=!0;k.filter_submitted&&!f.submitted&&(i=!1),k.filter_notsubmitted&&f.submitted&&(i=!1),k.filter_requiregrading&&!f.requiregrading&&(i=!1),i&&(b.each(e,function(a,b){"undefined"!=typeof f[b]&&""!==f[b]&&(g.hasidentity=!0,h.push(f[b]))}),g.identity=h.join(", "),d.push(c.render("mod_assign/list_participant_user_summary",g)))}),b.when.apply(b.when,d).then(function(){var c=arguments,d=0;b.each(a,function(a,b){b.label=c[d],d++}),f(a)})},g)}}});
- define('mod_assign/grading_actions', ["jquery","mod_assign/grading_events"],function(a,b){var c=function(b){this._regionSelector=b,this._region=a(b),this.registerEventListeners()};return c.prototype._regionSelector=null,c.prototype._lastUserId=0,c.prototype._region=null,c.prototype._showActionsForm=function(a,b){var c=this._region.find("[data-region=grading-actions-form]");b!=this._lastUserId&&b>0&&(this._lastUserId=b),b>0?c.removeClass("hide"):c.addClass("hide")},c.prototype._trigger=function(b){a(document).trigger(b)},c.prototype.getReviewPanelElement=function(){return a('[data-region="review-panel"]')},c.prototype.hasReviewPanelElement=function(){return this.getReviewPanelElement().length>0},c.prototype.getCollapseGradePanelButton=function(){return a('[data-region="grade-actions"] .collapse-grade-panel')},c.prototype.getCollapseReviewPanelButton=function(){return a('[data-region="grade-actions"] .collapse-review-panel')},c.prototype.getExpandAllPanelsButton=function(){return a('[data-region="grade-actions"] .collapse-none')},c.prototype.resetLayoutButtons=function(){this.getCollapseGradePanelButton().removeClass("active"),this.getCollapseReviewPanelButton().removeClass("active"),this.getExpandAllPanelsButton().removeClass("active")},c.prototype.collapseReviewPanel=function(){a(document).trigger(b.COLLAPSE_REVIEW_PANEL),a(document).trigger(b.EXPAND_GRADE_PANEL),this.resetLayoutButtons(),this.getCollapseReviewPanelButton().addClass("active")},c.prototype.collapseGradePanel=function(){a(document).trigger(b.COLLAPSE_GRADE_PANEL),a(document).trigger(b.EXPAND_REVIEW_PANEL),this.resetLayoutButtons(),this.getCollapseGradePanelButton().addClass("active")},c.prototype.expandAllPanels=function(){a(document).trigger(b.EXPAND_GRADE_PANEL),a(document).trigger(b.EXPAND_REVIEW_PANEL),this.resetLayoutButtons(),this.getExpandAllPanelsButton().addClass("active")},c.prototype.registerEventListeners=function(){if(this.hasReviewPanelElement()){var b=this.getCollapseReviewPanelButton();b.click(function(a){this.collapseReviewPanel(),a.preventDefault()}.bind(this)),b.keydown(function(a){a.metaKey||a.shiftKey||a.altKey||a.ctrlKey||(13===a.keyCode||32===a.keyCode)&&(this.collapseReviewPanel(),a.preventDefault())}.bind(this));var c=this.getCollapseGradePanelButton();c.click(function(a){this.collapseGradePanel(),a.preventDefault()}.bind(this)),c.keydown(function(a){a.metaKey||a.shiftKey||a.altKey||a.ctrlKey||(13===a.keyCode||32===a.keyCode)&&(this.collapseGradePanel(),a.preventDefault())}.bind(this));var d=this.getExpandAllPanelsButton();d.click(function(a){this.expandAllPanels(),a.preventDefault()}.bind(this)),d.keydown(function(a){a.metaKey||a.shiftKey||a.altKey||a.ctrlKey||(13===a.keyCode||32===a.keyCode)&&(this.expandAllPanels(),a.preventDefault())}.bind(this))}a(document).on("user-changed",this._showActionsForm.bind(this)),this._region.find('[name="savechanges"]').on("click",this._trigger.bind(this,"save-changes")),this._region.find('[name="resetbutton"]').on("click",this._trigger.bind(this,"reset")),this._region.find("form").on("submit",function(a){a.preventDefault()})},c});
- define('mod_feedback/edit', ["jquery","core/ajax","core/str","core/notification"],function(a,b,c,d){var e={deleteItem:function(b){b.preventDefault(),c.get_strings([{key:"confirmation",component:"admin"},{key:"confirmdeleteitem",component:"mod_feedback"},{key:"yes",component:"moodle"},{key:"no",component:"moodle"}]).done(function(c){d.confirm(c[0],c[1],c[2],c[3],a.proxy(function(){window.location=a(this).attr("href")},b.currentTarget))})},setup:function(){a("body").delegate('[data-action="delete"]',"click",e.deleteItem)}};return{setup:e.setup}});
- define('mod_lti/tool_card_controller', ["jquery","core/ajax","core/notification","core/templates","mod_lti/tool_type","mod_lti/events","mod_lti/keys","core/str"],function(a,b,c,d,e,f,g,h){var i={DELETE_BUTTON:".delete",NAME_ELEMENT:".name",DESCRIPTION_ELEMENT:".description",CAPABILITIES_CONTAINER:".capabilities-container",ACTIVATE_BUTTON:".tool-card-footer a.activate"},j=2e3,k=function(a){return a.find(i.DELETE_BUTTON)},l=function(a){return a.find(i.NAME_ELEMENT)},m=function(a){return a.find(i.DESCRIPTION_ELEMENT)},n=function(a){return a.find(i.ACTIVATE_BUTTON)},o=function(a){return n(a).length?!0:!1},p=function(a){return a.find(i.CAPABILITIES_CONTAINER)},q=function(a){return p(a).length?!0:!1},r=function(a){return a.attr("data-type-id")},s=function(a){a.removeClass("announcement loading success fail capabilities")},t=function(a){s(a),a.addClass("announcement loading")},u=function(a){a.removeClass("announcement loading")},v=function(b){var c=a.Deferred();return s(b),b.addClass("announcement success"),setTimeout(function(){b.removeClass("announcement success"),c.resolve()},j),c},w=function(b){var c=a.Deferred();return s(b),b.addClass("announcement fail"),setTimeout(function(){b.removeClass("announcement fail"),c.resolve()},j),c},x=function(b){var d=a.Deferred(),f=r(b);return t(b),""===f?a.Deferred().resolve():(h.get_strings([{key:"delete",component:"mod_lti"},{key:"delete_confirmation",component:"mod_lti"},{key:"delete",component:"mod_lti"},{key:"cancel",component:"core"}]).done(function(a){c.confirm(a[0],a[1],a[2],a[3],function(){e["delete"](f).done(function(){u(b),v(b).done(function(){b.remove()}).fail(c.exception).always(function(){d.resolve()})}).fail(function(a){w(b),d.reject(a)})},function(){u(b),d.resolve()})}).fail(function(a){u(b),c.exception(a),d.reject(a)}),d)},y=function(a,b){a.attr("data-val-snapshot",b)},z=function(a){return a.attr("data-val-snapshot")},A=function(a){var b=m(a);if(!b.hasClass("loading")){var c=b.text().trim();y(b,c)}},B=function(b){var d=r(b);if(""===d)return a.Deferred().resolve();var f=m(b);if(f.hasClass("loading"))return a.Deferred().resolve();var g=f.text().trim(),h=z(f);if(h==g)return a.Deferred().resolve();f.addClass("loading");var i=e.update({id:d,description:g});return i.done(function(a){f.removeClass("loading"),f.text(a.description)}).fail(c.exception),i.fail(function(){f.removeClass("loading")}),i},C=function(a){var b=l(a);if(!b.hasClass("loading")){var c=b.text().trim();y(b,c)}},D=function(b){var c=r(b);if(""===c)return a.Deferred().resolve();var d=l(b);if(d.hasClass("loading"))return a.Deferred().resolve();var f=d.text().trim(),g=z(d);if(g==f)return a.Deferred().resolve();d.addClass("loading");var h=e.update({id:c,name:f});return h.done(function(a){d.removeClass("loading"),d.text(a.name)}),h.fail(function(){d.removeClass("loading")}),h},E=function(b){var c=r(b);if(""===c)return a.Deferred().resolve();t(b);var f=e.update({id:c,state:e.constants.state.configured});return f.done(function(c){u(b);var e=v(b),f=d.render("mod_lti/tool_card",c);a.when(f,e).then(function(a){var c=a[0],e=a[1];d.replaceNode(b,c,e)})}),f.fail(function(){u(b),w(b)}),f},F=function(a){a.addClass("announcement capabilities")},G=function(a){a.removeClass("announcement capabilities")},H=function(a){q(a)?F(a):E(a)},I=function(a){var b=k(a);b.click(function(b){b.preventDefault(),x(a)}),b.keypress(function(a){a.metaKey||a.shiftKey||a.altKey||a.ctrlKey||(a.keyCode==g.ENTER||a.keyCode==g.SPACE)&&(a.preventDefault(),b.click())});var c=m(a);c.focus(function(b){b.preventDefault(),A(a)}),c.blur(function(b){b.preventDefault(),B(a)}),c.keypress(function(a){a.metaKey||a.shiftKey||a.altKey||a.ctrlKey||a.keyCode==g.ENTER&&(a.preventDefault(),c.blur())});var d=l(a);if(d.focus(function(b){b.preventDefault(),C(a)}),d.blur(function(b){b.preventDefault(),D(a)}),d.keypress(function(a){a.metaKey||a.shiftKey||a.altKey||a.ctrlKey||a.keyCode==g.ENTER&&(a.preventDefault(),d.blur())}),o(a)){var e=n(a);e.click(function(b){b.preventDefault(),H(a)}),e.keypress(function(a){a.metaKey||a.shiftKey||a.altKey||a.ctrlKey||(a.keyCode==g.ENTER||a.keyCode==g.SPACE)&&(a.preventDefault(),e.click())})}if(q(a)){var h=p(a);h.on(f.CAPABILITIES_AGREE,function(){E(a)}),h.on(f.CAPABILITIES_DECLINE,function(){G(a)})}};return{init:function(a){I(a)}}});
- define('mod_lti/events', [],function(){return{NEW_TOOL_TYPE:"lti.tool.type.new",START_EXTERNAL_REGISTRATION:"lti.registration.external.start",STOP_EXTERNAL_REGISTRATION:"lti.registration.external.stop",START_CARTRIDGE_REGISTRATION:"lti.registration.cartridge.start",STOP_CARTRIDGE_REGISTRATION:"lti.registration.cartridge.stop",REGISTRATION_FEEDBACK:"lti.registration.feedback",CAPABILITIES_AGREE:"lti.tool.type.capabilities.agree",CAPABILITIES_DECLINE:"lti.tool.type.capabilities.decline"}});
- define('mod_lti/tool_type', ["core/ajax","core/notification"],function(a,b){return{query:function(c){var d={methodname:"mod_lti_get_tool_types",args:c||{}},e=a.call([d])[0];return e.fail(b.exception),e},create:function(b){var c={methodname:"mod_lti_create_tool_type",args:b},d=a.call([c])[0];return d},update:function(c){var d={methodname:"mod_lti_update_tool_type",args:c},e=a.call([d])[0];return e.fail(b.exception),e},"delete":function(c){var d={methodname:"mod_lti_delete_tool_type",args:{id:c}},e=a.call([d])[0];return e.fail(b.exception),e},getFromToolProxyId:function(a){return this.query({toolproxyid:a})},isCartridge:function(b){var c={methodname:"mod_lti_is_cartridge",args:{url:b}},d=a.call([c])[0];return d},constants:{state:{configured:1,pending:2,rejected:3}}}});
- define('mod_lti/keys', [],function(){return{ENTER:13,SPACE:32}});
- define('mod_lti/external_registration', ["jquery","core/ajax","core/notification","core/templates","mod_lti/events","mod_lti/tool_proxy","mod_lti/tool_type","mod_lti/keys","core/str"],function(a,b,c,d,e,f,g,h,i){var j={EXTERNAL_REGISTRATION_CONTAINER:"#external-registration-page-container",EXTERNAL_REGISTRATION_TEMPLATE_CONTAINER:"#external-registration-template-container",EXTERNAL_REGISTRATION_CANCEL_BUTTON:"#cancel-external-registration",TOOL_TYPE_CAPABILITIES_CONTAINER:"#tool-type-capabilities-container",TOOL_TYPE_CAPABILITIES_TEMPLATE_CONTAINER:"#tool-type-capabilities-template-container",CAPABILITIES_AGREE_CONTAINER:".capabilities-container"},k=function(){return a(j.EXTERNAL_REGISTRATION_CANCEL_BUTTON)},l=function(){return a(j.EXTERNAL_REGISTRATION_CONTAINER)},m=function(){return a(j.EXTERNAL_REGISTRATION_TEMPLATE_CONTAINER)},n=function(){return a(j.TOOL_TYPE_CAPABILITIES_CONTAINER)},o=function(){return a(j.TOOL_TYPE_CAPABILITIES_TEMPLATE_CONTAINER)},p=function(){n().addClass("loading")},q=function(){n().removeClass("loading")},r=function(){k().addClass("loading")},s=function(){k().removeClass("loading")},t=function(){n().addClass("hidden")},u=function(){n().removeClass("hidden")},v=function(){l().addClass("hidden")},w=function(){l().removeClass("hidden")},x=function(a){var b=k();b.attr("data-tool-proxy-id",a)},y=function(){var a=k();return a.attr("data-tool-proxy-id")},z=function(){var a=k();a.removeAttr("data-tool-proxy-id")},A=function(){return y()?!0:!1},B=function(){var a=k();return a.attr("data-tool-proxy-new")&&A()},C=function(){var a=k();return a.attr("data-tool-proxy-new","new")},D=function(){var a=k();return a.removeAttr("data-tool-proxy-new")},E=function(a){var c={methodname:"mod_lti_get_tool_proxy_registration_request",args:{id:a}};return b.call([c])[0]},F=function(){r();var b=a.Deferred();if(B()){var d=y();f["delete"](d).done(function(){b.resolve()}).fail(function(a){b.reject(a)})}else b.resolve();return b.done(function(){L(),s()}).fail(function(b){c.exception(b),L(),s(),i.get_string("failedtodeletetoolproxy","mod_lti").done(function(b){var c={message:b,error:!0};a(document).trigger(e.REGISTRATION_FEEDBACK,c)}).fail(c.exception)}),b},G=function(a){var b=d.render("mod_lti/tool_proxy_registration_form",a);return b.done(function(a,b){var c=m();c.append(a),d.runTemplateJS(b),c.find("form").submit(),w()}).fail(c.exception),b},H=function(a){return g.update({id:a.id,state:g.constants.state.configured})},I=function(b){var f=a.Deferred();return d.render("mod_lti/tool_type_capabilities_agree",b).done(function(a,c){var g=o();v(),u(),d.replaceNodeContents(g,a,c);var h=g.find(j.CAPABILITIES_AGREE_CONTAINER);h.on(e.CAPABILITIES_AGREE,function(){p(),H(b).always(function(){q(),g.empty(),f.resolve()})}),h.on(e.CAPABILITIES_DECLINE,function(){g.empty(),f.resolve()})}).fail(f.reject),f.done(function(){t()}).fail(c.exception),f},J=function(b){var c=a.Deferred();return b&&""!==b?f.create({regurl:b}).done(function(a){C(),c=K(a.id)}).fail(function(b){F();var d={message:b.message,error:!0};a(document).trigger(e.REGISTRATION_FEEDBACK,d),c.reject(b)}):c.resolve(),c},K=function(b){var c=a.Deferred();return x(b),E(b).done(function(a){G(a).done(function(){c.resolve()}).fail(c.fail)}).fail(c.fail),c},L=function(){A()&&z(),D(!1),v();var b=m();b.empty(),a(document).trigger(e.STOP_EXTERNAL_REGISTRATION)},M=function(){a(document).on(e.START_EXTERNAL_REGISTRATION,function(a,b){b&&(b.url&&J(b.url),b.proxyid&&K(b.proxyid))});var b=k();b.click(function(a){a.preventDefault(),F()}),b.keypress(function(a){a.metaKey||a.shiftKey||a.altKey||a.ctrlKey||(a.keyCode==h.ENTER||a.keyCode==h.SPACE)&&(a.preventDefault(),F())}),window.triggerExternalRegistrationComplete=function(b){var d=a.Deferred(),f={message:"",error:!1};if("success"==b.status){if(i.get_string("successfullycreatedtooltype","mod_lti").done(function(a){f.message=a}).fail(c.exception),d.done(function(){L(),a(document).trigger(e.REGISTRATION_FEEDBACK,f),a(document).trigger(e.NEW_TOOL_TYPE)}).fail(c.exception),B()){var h=y();g.getFromToolProxyId(h).done(function(a){if(a&&a.length){var b=a[0];b.hascapabilitygroups?I(b).always(function(){d.resolve()}):d.resolve()}else d.resolve()}).fail(function(){d.resolve()})}}else f.message=b.error,f.error=!0,d.done(function(){F().always(function(){a(document).trigger(e.REGISTRATION_FEEDBACK,f)})}).fail(c.exception),d.resolve();return d}};return{init:function(){M()}}});
- define('mod_lti/external_registration_return', [],function(){return{init:function(a,b,c,d){window.parent&&window.parent.triggerExternalRegistrationComplete({message:a,error:b,id:c,status:d})}}});
- define('mod_lti/tool_configure_controller', ["jquery","core/ajax","core/notification","core/templates","mod_lti/events","mod_lti/keys","mod_lti/tool_type","mod_lti/tool_proxy","core/str"],function(a,b,c,d,e,f,g,h,i){var j={EXTERNAL_REGISTRATION_CONTAINER:"#external-registration-container",EXTERNAL_REGISTRATION_PAGE_CONTAINER:"#external-registration-page-container",CARTRIDGE_REGISTRATION_CONTAINER:"#cartridge-registration-container",CARTRIDGE_REGISTRATION_FORM:"#cartridge-registration-form",ADD_TOOL_FORM:"#add-tool-form",TOOL_LIST_CONTAINER:"#tool-list-container",TOOL_CREATE_BUTTON:"#tool-create-button",REGISTRATION_CHOICE_CONTAINER:"#registration-choice-container",TOOL_URL:"#tool-url"},k=function(){return a(j.TOOL_CREATE_BUTTON)},l=function(){return a(j.TOOL_LIST_CONTAINER)},m=function(){return a(j.EXTERNAL_REGISTRATION_CONTAINER)},n=function(){return a(j.CARTRIDGE_REGISTRATION_CONTAINER)},o=function(){return a(j.REGISTRATION_CHOICE_CONTAINER)},p=function(){return a(j.TOOL_URL).val()},q=function(){m().addClass("hidden")},r=function(){n().addClass("hidden")},s=function(){o().addClass("hidden")},t=function(){r(),s(),m().removeClass("hidden"),v(m())},u=function(a){q(),s(),n().removeClass("hidden"),n().find(j.CARTRIDGE_REGISTRATION_FORM).attr("data-cartridge-url",a),v(n())},v=function(a){var b=a.children().clone(!0,!0);a.empty(),a.append(b)},w=function(){q(),r(),o().removeClass("hidden"),v(o())},x=function(){l().addClass("hidden")},y=function(){l().removeClass("hidden")},z=function(a){var b=a.error?"error":"success";c.addNotification({message:a.message,type:b})},A=function(a){a.addClass("loading")},B=function(a){a.removeClass("loading")},C=function(){var b=a.Deferred(),e=l();A(e),a.when(g.query(),h.query({orphanedonly:!0})).done(function(a,c){d.render("mod_lti/tool_list",{tools:a,proxies:c}).done(function(a,c){e.empty(),e.append(a),d.runTemplateJS(c),b.resolve()}).fail(b.reject)}).fail(b.reject),b.fail(c.exception).always(function(){B(e)})},D=function(){var b=a.trim(p());if(""===b)return a.Deferred().resolve();var d=k();A(d);var f=g.isCartridge(b);return f.always(function(){B(d)}),f.done(function(c){c.iscartridge?(a(j.TOOL_URL).val(""),a(document).trigger(e.START_CARTRIDGE_REGISTRATION,b)):a(document).trigger(e.START_EXTERNAL_REGISTRATION,{url:b})}),f.fail(function(){i.get_string("errorbadurl","mod_lti").done(function(b){a(document).trigger(e.REGISTRATION_FEEDBACK,{message:b,error:!0})}).fail(c.exception)}),f},E=function(){a(document).on(e.NEW_TOOL_TYPE,function(){C()}),a(document).on(e.START_EXTERNAL_REGISTRATION,function(){t(),a(j.TOOL_URL).val(""),x()}),a(document).on(e.STOP_EXTERNAL_REGISTRATION,function(){y(),w()}),a(document).on(e.START_CARTRIDGE_REGISTRATION,function(a,b){u(b)}),a(document).on(e.STOP_CARTRIDGE_REGISTRATION,function(){n().find(j.CARTRIDGE_REGISTRATION_FORM).removeAttr("data-cartridge-url"),w()}),a(document).on(e.REGISTRATION_FEEDBACK,function(a,b){z(b)});var b=a(j.ADD_TOOL_FORM);b.submit(function(a){a.preventDefault(),D()})};return{init:function(){E(),C()}}});
- define('mod_lti/tool_proxy', ["core/ajax","core/notification"],function(a,b){return{query:function(c){var d={methodname:"mod_lti_get_tool_proxies",args:c||{}},e=a.call([d])[0];return e.fail(b.exception),e},"delete":function(c){var d={methodname:"mod_lti_delete_tool_proxy",args:{id:c}},e=a.call([d])[0];return e.fail(b.exception),e},create:function(b){var c={methodname:"mod_lti_create_tool_proxy",args:b},d=a.call([c])[0];return d}}});
- define('mod_lti/tool_proxy_card_controller', ["jquery","core/ajax","core/notification","core/templates","mod_lti/tool_proxy","mod_lti/events","mod_lti/keys","core/str"],function(a,b,c,d,e,f,g,h){var i={DELETE_BUTTON:".delete",CAPABILITIES_CONTAINER:".capabilities-container",ACTIVATE_BUTTON:".tool-card-footer a.activate"},j=2e3,k=function(a){return a.find(i.DELETE_BUTTON)},l=function(a){return a.find(i.ACTIVATE_BUTTON)},m=function(a){return a.attr("data-proxy-id")},n=function(a){a.removeClass("announcement loading success fail capabilities")},o=function(a){n(a),a.addClass("announcement loading")},p=function(a){a.removeClass("announcement loading")},q=function(b){var c=a.Deferred();return n(b),b.addClass("announcement success"),setTimeout(function(){b.removeClass("announcement success"),c.resolve()},j),c},r=function(b){var c=a.Deferred();return n(b),b.addClass("announcement fail"),setTimeout(function(){b.removeClass("announcement fail"),c.resolve()},j),c},s=function(b){var d=a.Deferred(),f=m(b);return o(b),""===f?a.Deferred().resolve():(h.get_strings([{key:"delete",component:"mod_lti"},{key:"delete_confirmation",component:"mod_lti"},{key:"delete",component:"mod_lti"},{key:"cancel",component:"core"}]).done(function(a){c.confirm(a[0],a[1],a[2],a[3],function(){e["delete"](f).done(function(){p(b),q(b).done(function(){b.remove(),d.resolve()}).fail(c.exception)}).fail(function(a){r(b),d.reject(a)})},function(){p(b),d.resolve()})}).fail(function(a){p(b),c.exception(a),d.reject(a)}),d)},t=function(b){var c={proxyid:m(b)};a(document).trigger(f.START_EXTERNAL_REGISTRATION,c)},u=function(a){var b=k(a);b.click(function(b){b.preventDefault(),s(a)}),b.keypress(function(a){a.metaKey||a.shiftKey||a.altKey||a.ctrlKey||(a.keyCode==g.ENTER||a.keyCode==g.SPACE)&&(a.preventDefault(),b.click())});var c=l(a);c.click(function(b){b.preventDefault(),t(a)}),c.keypress(function(a){a.metaKey||a.shiftKey||a.altKey||a.ctrlKey||(a.keyCode==g.ENTER||a.keyCode==g.SPACE)&&(a.preventDefault(),c.click())})};return{init:function(a){u(a)}}});
- define('mod_lti/cartridge_registration_form', ["jquery","core/ajax","core/notification","mod_lti/tool_type","mod_lti/events","mod_lti/keys","core/str"],function(a,b,c,d,e,f,g){var h={CARTRIDGE_URL:"#cartridge-url",CONSUMER_KEY:"#registration-key",SHARED_SECRET:"#registration-secret",REGISTRATION_FORM:"#cartridge-registration-form",REGISTRATION_SUBMIT_BUTTON:"#cartridge-registration-submit",REGISTRATION_CANCEL_BUTTON:"#cartridge-registration-cancel"},i=function(){return a(h.REGISTRATION_FORM).attr("data-cartridge-url")},j=function(){return a(h.REGISTRATION_SUBMIT_BUTTON)},k=function(){return a(h.REGISTRATION_CANCEL_BUTTON)},l=function(){return a(h.CONSUMER_KEY).val()},m=function(){return a(h.SHARED_SECRET).val()},n=function(){j().addClass("loading")},o=function(){j().removeClass("loading")},p=function(){return j().hasClass("loading")},q=function(){if(!p()){var b=i();if(""!==b){n();var f=l(),h=m(),j=d.create({cartridgeurl:b,key:f,secret:h});return j.done(function(){g.get_string("successfullycreatedtooltype","mod_lti").done(function(b){a(document).trigger(e.NEW_TOOL_TYPE),a(document).trigger(e.STOP_CARTRIDGE_REGISTRATION),a(document).trigger(e.REGISTRATION_FEEDBACK,{message:b})}).fail(c.exception)}).fail(function(){g.get_string("failedtocreatetooltype","mod_lti").done(function(b){a(document).trigger(e.NEW_TOOL_TYPE),a(document).trigger(e.STOP_CARTRIDGE_REGISTRATION),a(document).trigger(e.REGISTRATION_FEEDBACK,{message:b,error:!0})}).fail(c.exception)}).always(function(){o()}),j}}},r=function(){var b=a(h.REGISTRATION_FORM);b.submit(function(a){a.preventDefault(),q()});var c=k();c.click(function(b){b.preventDefault(),a(document).trigger(e.STOP_CARTRIDGE_REGISTRATION)}),c.keypress(function(a){a.metaKey||a.shiftKey||a.altKey||a.ctrlKey||(a.keyCode==f.ENTER||a.keyCode==f.SPACE)&&(a.preventDefault(),c.click())})};return{init:function(){r()}}});
- define('mod_quiz/preflightcheck', ["jquery","core/yui"],function(a,b){var c={confirmDialogue:null,init:function(a,d,e,f){var g=a;b.use("moodle-core-notification",function(){b.one(e)&&(c.confirmDialogue=new M.core.dialogue({headerContent:d,bodyContent:b.one(e),draggable:!0,visible:!1,center:!0,modal:!0,width:null,extraClasses:["mod_quiz_preflight_popup"]}),b.one(a).on("click",c.displayDialogue),b.one("#id_cancel").on("click",c.hideDialogue),g=c.confirmDialogue.get("boundingBox").one('[name="submitbutton"]')),f&&b.one(g).on("click",c.launchQuizPopup,c,f)})},displayDialogue:function(a){a&&a.halt(),c.confirmDialogue.show()},hideDialogue:function(a){a&&a.halt(),c.confirmDialogue.hide(a)},launchQuizPopup:function(a,c){a.halt(),b.use("moodle-core-formchangechecker","io-form",function(){M.core_formchangechecker.reset_form_dirty_state();var d=a.target.ancestor("form");window.openpopup(a,{url:d.get("action")+"?"+b.IO.stringify(d).replace(/\bcancel=/,"x="),windowname:"quizpopup",options:c,fullscreen:!0})})}};return c});
- define('block_navigation/navblock', ["jquery","core/tree"],function(a,b){return{init:function(a){var c=new b(".block_navigation .block_tree");c.finishExpandingGroup=function(c){b.prototype.finishExpandingGroup.call(this,c),Y.use("moodle-core-event",function(){Y.Global.fire(M.core.globalEvents.BLOCK_CONTENT_UPDATED,{instanceid:a})})},c.collapseGroup=function(c){b.prototype.collapseGroup.call(this,c),Y.use("moodle-core-event",function(){Y.Global.fire(M.core.globalEvents.BLOCK_CONTENT_UPDATED,{instanceid:a})})}}}});
- define('block_navigation/ajax_response_renderer', ["jquery"],function(a){function b(d,e){var f=a("<ul></ul>");f.attr("role","group"),f.attr("aria-hidden",!0),a.each(e,function(d,e){if("object"==typeof e){var g=a("<li></li>"),h=a("<p></p>"),i=e.id||e.key+"_tree_item",j=null,k=e.expandable||e.haschildren?!0:!1;if(h.addClass("tree_item"),h.attr("id",i),h.attr("role","treeitem"),h.attr("tabindex","-1"),e.requiresajaxloading&&(h.attr("data-requires-ajax",!0),h.attr("data-node-id",e.id),h.attr("data-node-key",e.key),h.attr("data-node-type",e.type)),k&&(g.addClass("collapsed contains_branch"),h.attr("aria-expanded",!1),h.addClass("branch")),!e.icon||k&&e.type!==c.ACTIVITY&&e.type!==c.RESOURCE||(g.addClass("item_with_icon"),h.addClass("hasicon"),j=a("<img/>"),j.attr("alt",e.icon.alt),j.attr("title",e.icon.title),j.attr("src",M.util.image_url(e.icon.pix,e.icon.component)),a.each(e.icon.classes,function(a,b){j.addClass(b)})),e.link){var l=a('<a title="'+e.title+'" href="'+e.link+'"></a>');j?(l.append(j),l.append('<span class="item-content-wrap">'+e.name+"</span>")):l.append(e.name),e.hidden&&l.addClass("dimmed"),h.append(l)}else{var m=a("<span></span>");j?(m.append(j),m.append('<span class="item-content-wrap">'+e.name+"</span>")):m.append(e.name),e.hidden&&m.addClass("dimmed"),h.append(m)}g.append(h),f.append(g),e.children&&e.children.length?b(h,e.children):k&&!e.requiresajaxloading&&(g.removeClass("contains_branch"),h.addClass("emptybranch"))}}),d.parent().append(f);var g=d.attr("id")+"_group";f.attr("id",g),d.attr("aria-owns",g),d.attr("role","treeitem")}var c={ACTIVITY:40,RESOURCE:50};return{render:function(a,c){if(c.children&&c.children.length){b(a,c.children);var d=a.children("[role='treeitem']").first(),e=a.find("#"+d.attr("aria-owns"));d.attr("aria-expanded",!0),e.attr("aria-hidden",!1)}else a.parent().hasClass("contains_branch")&&(a.parent().removeClass("contains_branch"),a.addClass("emptybranch"))}}});
- define('block_navigation/site_admin_loader', ["jquery","core/ajax","core/config","block_navigation/ajax_response_renderer"],function(a,b,c,d){var e=71,f=c.wwwroot+"/lib/ajax/getsiteadminbranch.php";return{load:function(b){b=a(b);var g=a.Deferred(),h={type:e,sesskey:c.sesskey},i={type:"POST",dataType:"json",data:h};return a.ajax(f,i).done(function(a){d.render(b,a),g.resolve()}),g}}});
- define('block_navigation/nav_loader', ["jquery","core/ajax","core/config","block_navigation/ajax_response_renderer"],function(a,b,c,d){function e(a){return a.closest("[data-block]").attr("data-instanceid")}var f=c.wwwroot+"/lib/ajax/getnavbranch.php";return{load:function(b){b=a(b);var g=a.Deferred(),h={elementid:b.attr("data-node-id"),id:b.attr("data-node-key"),type:b.attr("data-node-type"),sesskey:c.sesskey,instance:e(b)},i={type:"POST",dataType:"json",data:h};return a.ajax(f,i).done(function(a){d.render(b,a),g.resolve()}),g}}});
- define('block_settings/settingsblock', ["jquery","core/tree"],function(a,b){return{init:function(a,c){var d=new b(".block_settings .block_tree");if(c){var e=d.treeRoot.find("#"+c),f=e.children("a").first();f.replaceWith('<span tabindex="0">'+f.html()+"</span>")}d.finishExpandingGroup=function(c){b.prototype.finishExpandingGroup.call(this,c),Y.use("moodle-core-event",function(){Y.Global.fire(M.core.globalEvents.BLOCK_CONTENT_UPDATED,{instanceid:a})})},d.collapseGroup=function(c){b.prototype.collapseGroup.call(this,c),Y.use("moodle-core-event",function(){Y.Global.fire(M.core.globalEvents.BLOCK_CONTENT_UPDATED,{instanceid:a})})}}}});
- define('report_competency/user_course_navigation', ["jquery"],function(a){var b=function(b,c,d,e){this._baseUrl=c,this._userId=d+"",this._courseId=e,a(b).on("change",this._userChanged.bind(this))};return b.prototype._userChanged=function(b){var c=a(b.target).val(),d="?user="+c+"&id="+this._courseId;document.location=this._baseUrl+d},b.prototype._userId=null,b.prototype._courseId=null,b.prototype._baseUrl=null,b});
- define('report_competency/grading_popup', ["jquery","core/notification","core/str","core/ajax","core/log","core/templates","tool_lp/dialogue"],function(a,b,c,d,e,f,g){var h=function(b,c){this._regionSelector=b,this._userCompetencySelector=c,a(this._regionSelector).on("click",this._userCompetencySelector,this._handleClick.bind(this))};return h.prototype._handleClick=function(c){var f=a(c.target).closest(this._userCompetencySelector),g=a(f).data("competencyid"),h=a(f).data("courseid"),i=a(f).data("userid");e.debug("Clicked on cell: competencyId="+g+", courseId="+h+", userId="+i);var j=d.call([{methodname:"tool_lp_data_for_user_competency_summary_in_course",args:{userid:i,competencyid:g,courseid:h},done:this._contextLoaded.bind(this),fail:b.exception}]);j[0].then(function(){d.call([{methodname:"core_competency_user_competency_viewed_in_course",args:{userid:i,competencyid:g,courseid:h},fail:b.exception}])})},h.prototype._contextLoaded=function(a){var d=this;a.displayuser=!0,f.render("tool_lp/user_competency_summary_in_course",a).done(function(a,e){c.get_string("usercompetencysummary","report_competency").done(function(b){new g(b,a,f.runTemplateJS.bind(f,e),d._refresh.bind(d),!0)}).fail(b.exception)}).fail(b.exception)},h.prototype._refresh=function(){var c=a(this._regionSelector),e=c.data("courseid"),f=c.data("userid");d.call([{methodname:"report_competency_data_for_report",args:{courseid:e,userid:f},done:this._pageContextLoaded.bind(this),fail:b.exception}])},h.prototype._pageContextLoaded=function(a){var c=this;f.render("report_competency/report",a).done(function(a,b){f.replaceNode(c._regionSelector,a,b)}).fail(b.exception)},h.prototype._regionSelector=null,h.prototype._userCompetencySelector=null,h});
- define('gradingform_guide/comment_chooser', ["jquery","core/templates","core/notification","core/yui"],function(a,b,c){return{initialise:function(d,e,f,g){function h(b,c){var e="<label>"+M.util.get_string("insertcomment","gradingform_guide")+"</label>",g="comment-chooser-"+d+"-cancel",h='<button id="'+g+'">'+M.util.get_string("cancel","moodle")+"</button>",i=new M.core.dialogue({modal:!0,headerContent:e,bodyContent:b,footerContent:h,focusAfterHide:"#"+f,id:"comments-chooser-dialog-"+d});a("#"+g).click(function(){i.hide()}),a.each(c,function(b,c){var e="#comment-option-"+d+"-"+c.id;a(e).click(function(){var b=a("#"+f),d=b.val();""!==a.trim(d)&&(d+="\n"),d+=c.description,b.val(d),i.hide()}),a(document).off("keypress",e).on("keypress",e,function(){var b=event.which||event.keyCode;(13==b||32==b)&&a(e).click()})}),i.after("visibleChange",function(a){a.prevVal&&!a.newVal&&this.destroy()},i),i.show()}function i(){var a={criterionId:d,comments:g};b.render("gradingform_guide/comment_chooser",a).done(function(a){h(a,g)}).fail(c.exception)}a("#"+e).click(function(a){a.preventDefault(),i()})}}});
- define('tool_lp/form-user-selector', ["jquery","core/ajax","core/templates"],function(a,b,c){return{processResults:function(b,c){var d=[];return a.each(c,function(a,b){d.push({value:b.id,label:b._label})}),d},transport:function(d,e,f,g){var h,i=a(d).data("capability");"undefined"==typeof i&&(i=""),h=b.call([{methodname:"tool_lp_search_users",args:{query:e,capability:i}}]),h[0].then(function(b){var d=[],e=0;return a.each(b.users,function(b,e){var f=e,g=[];a.each(["idnumber","email","phone1","phone2","department","institution"],function(a,b){"undefined"!=typeof e[b]&&""!==e[b]&&(f.hasidentity=!0,g.push(e[b]))}),f.identity=g.join(", "),d.push(c.render("tool_lp/form-user-selector-suggestion",f))}),a.when.apply(a.when,d).then(function(){var c=arguments;a.each(b.users,function(a,b){b._label=c[e],e++}),f(b.users)})},g)}}});
- define('tool_lp/scaleconfig', ["jquery","core/notification","core/templates","core/ajax","tool_lp/dialogue","tool_lp/scalevalues"],function(a,b,c,d,e,f){var g=function(b,c,d){this.selectSelector=b,this.inputSelector=c,this.triggerSelector=d,this.originalscaleid=a(b).val(),a(b).on("change",this.scaleChangeHandler.bind(this)).change(),a(d).click(this.showConfig.bind(this))};return g.prototype.selectSelector=null,g.prototype.inputSelector=null,g.prototype.triggerSelector=null,g.prototype.scalevalues=null,g.prototype.originalscaleid=0,g.prototype.scaleid=0,g.prototype.popup=null,g.prototype.showConfig=function(){var d=this;if(this.scaleid=a(this.selectSelector).val(),!(this.scaleid<=0)){var f=a(this.selectSelector).find("option:selected").text();this.getScaleValues(this.scaleid).done(function(){var a={scalename:f,scales:d.scalevalues};c.render("tool_lp/scale_configuration_page",a).done(function(a){new e(f,a,d.initScaleConfig.bind(d))}).fail(b.exception)}).fail(b.exception)}},g.prototype.retrieveOriginalScaleConfig=function(){var b=a(this.inputSelector).val();if(""!==b){var c=a.parseJSON(b),d=c.shift();if(d.scaleid===this.originalscaleid)return c}return""},g.prototype.initScaleConfig=function(b){this.popup=b;var c=a(b.getContent());if(this.originalscaleid===this.scaleid){var d=this.retrieveOriginalScaleConfig();""!==d&&d.forEach(function(a){1===a.scaledefault&&c.find('[data-field="tool_lp_scale_default_'+a.id+'"]').attr("checked",!0),1===a.proficient&&c.find('[data-field="tool_lp_scale_proficient_'+a.id+'"]').attr("checked",!0)})}c.on("click",'[data-action="close"]',function(){this.setScaleConfig(),b.close()}.bind(this)),c.on("click",'[data-action="cancel"]',function(){b.close()}.bind(this))},g.prototype.setScaleConfig=function(){var b=a(this.popup.getContent()),c=[{scaleid:this.scaleid}];this.scalevalues.forEach(function(a){var d=0,e=0;b.find('[data-field="tool_lp_scale_default_'+a.id+'"]').is(":checked")&&(d=1),b.find('[data-field="tool_lp_scale_proficient_'+a.id+'"]').is(":checked")&&(e=1),(d||e)&&c.push({id:a.id,scaledefault:d,proficient:e})});var d=JSON.stringify(c);a(this.inputSelector).val(d),this.originalscaleid=this.scaleid},g.prototype.getScaleValues=function(a){return f.get_values(a).then(function(a){return this.scalevalues=a,a}.bind(this))},g.prototype.scaleChangeHandler=function(b){a(b.target).val()<=0?a(this.triggerSelector).prop("disabled",!0):a(this.triggerSelector).prop("disabled",!1)},{init:function(a,b,c){return new g(a,b,c)}}});
- define('tool_lp/course_competency_settings', ["jquery","core/notification","tool_lp/dialogue","core/str","core/ajax","core/templates"],function(a,b,c,d,e,f){var g=function(b){a(b).on("click",this.configureSettings.bind(this))};return g.prototype._dialogue=null,g.prototype.configureSettings=function(e){var g=a(e.target).closest("a").data("courseid"),h=a(e.target).closest("a").data("pushratingstouserplans"),i={courseid:g,settings:{pushratingstouserplans:h}};e.preventDefault(),f.render("tool_lp/course_competency_settings",i).done(function(a){d.get_string("configurecoursecompetencysettings","tool_lp").done(function(b){this._dialogue=new c(b,a,this.addListeners.bind(this))}.bind(this)).fail(b.exception)}.bind(this)).fail(b.exception)},g.prototype.addListeners=function(){var a=this._find('[data-action="save"]');a.on("click",this.saveSettings.bind(this));var b=this._find('[data-action="cancel"]');b.on("click",this.cancelChanges.bind(this))},g.prototype.cancelChanges=function(a){a.preventDefault(),this._dialogue.close()},g.prototype._find=function(b){return a('[data-region="coursecompetencysettings"]').find(b)},g.prototype.saveSettings=function(a){a.preventDefault();var c=this._find('input[name="pushratingstouserplans"]:checked').val(),d=this._find('input[name="courseid"]').val(),f={pushratingstouserplans:c};e.call([{methodname:"core_competency_update_course_competency_settings",args:{courseid:d,settings:f}}])[0].done(function(){this.refreshCourseCompetenciesPage()}.bind(this)).fail(b.exception)},g.prototype.refreshCourseCompetenciesPage=function(){var c=this._find('input[name="courseid"]').val();e.call([{methodname:"tool_lp_data_for_course_competencies_page",args:{courseid:c}}])[0].done(function(c){f.render("tool_lp/course_competencies_page",c).done(function(b,c){a('[data-region="coursecompetenciespage"]').replaceWith(b),f.runTemplateJS(c),this._dialogue.close()}.bind(this)).fail(b.exception)}.bind(this)).fail(b.exception)},g});
- define('tool_lp/competencytree', ["core/ajax","core/notification","core/templates","tool_lp/tree","tool_lp/competency_outcomes","jquery"],function(a,b,c,d,e,f){var g={},h=0,i="",j="",k="",l=!1,m=function(a,b){var c=0,d=!1;for(a.haschildren=!1,a.children=[],c=0;c<b.length;c++)d=b[c],d.parentid==a.id&&(a.haschildren=!0,a.children.push(d),m(d,b))},n=function(b){var e=f.Deferred();return c.render("tool_lp/loading",{}).done(function(n,o){c.replaceNodeContents(f(j),n,o);var p=a.call([{methodname:"core_competency_search_competencies",args:{searchtext:b,competencyframeworkid:h}}]);p[0].done(function(a){g={};var b=0;for(b=0;b<a.length;b++)g[a[b].id]=a[b];var h=[],n=!1;for(b=0;b<a.length;b++)n=a[b],0===parseInt(n.parentid,10)&&(h.push(n),m(n,a));var o={shortname:i,canmanage:l,competencies:h};c.render("tool_lp/competencies_tree_root",o).done(function(a,b){c.replaceNodeContents(f(j),f(a).html(),b);var h=new d(j,!1);if(k){var i=f(j).find("[data-id="+k+"]");i.length&&(h.selectItem(i),h.updateFocus(i))}e.resolve(g)}).fail(e.reject)}).fail(e.reject)}),e.promise()},o=function(a,b){var c=b.selected;k=c.attr("data-id")};return{init:function(a,c,d,e,f){h=a,i=c,l=f,j=e,n(d).fail(b.exception),this.on("selectionchanged",o)},on:function(a,b){f(j).on(a,b)},getChildren:function(a){var b=[];return f.each(g,function(c,d){d.parentid==a&&b.push(d)}),b},getCompetencyFrameworkId:function(){return h},getCompetency:function(a){return g[a]},getCompetencyLevel:function(a){var b=this.getCompetency(a),c=b.path.replace(/^\/|\/$/g,"").split("/").length;return c},hasChildren:function(a){return this.getChildren(a).length>0},hasRule:function(a){var b=this.getCompetency(a);return b?b.ruleoutcome!=e.OUTCOME_NONE&&b.ruletype:!1},reloadCompetencies:function(){return n("").fail(b.exception)},listCompetencies:function(){return g}}});
- define('tool_lp/competency_plan_navigation', ["jquery"],function(a){var b=function(b,c,d,e,f){this._baseUrl=c,this._userId=d+"",this._competencyId=e+"",this._planId=f,this._ignoreFirstCompetency=!0,a(b).on("change",this._competencyChanged.bind(this))};return b.prototype._competencyChanged=function(b){if(this._ignoreFirstCompetency)return void(this._ignoreFirstCompetency=!1);var c=a(b.target).val(),d="?userid="+this._userId+"&planid="+this._planId+"&competencyid="+c;document.location=this._baseUrl+d},b.prototype._competencyId=null,b.prototype._userId=null,b.prototype._planId=null,b.prototype._baseUrl=null,b.prototype._ignoreFirstCompetency=null,b});
- define('tool_lp/grade_dialogue', ["jquery","core/notification","core/templates","tool_lp/dialogue","tool_lp/event_base","core/str"],function(a,b,c,d,e,f){var g=function(a){e.prototype.constructor.apply(this,[]),this._ratingOptions=a};return g.prototype=Object.create(e.prototype),g.prototype._popup=null,g.prototype._ratingOptions=null,g.prototype._afterRender=function(){var b=this._find('[data-action="rate"]'),c=this._find('[name="rating"]'),d=this._find('[name="comment"]');this._find('[data-action="cancel"]').click(function(a){a.preventDefault(),this._trigger("cancelled"),this.close()}.bind(this)),c.change(function(){var c=a(this);c.val()?b.prop("disabled",!1):b.prop("disabled",!0)}).change(),b.click(function(a){a.preventDefault();var b=c.val();b&&(this._trigger("rated",{rating:b,note:d.val()}),this.close())}.bind(this))},g.prototype.close=function(){this._popup.close(),this._popup=null},g.prototype.display=function(){return this._render().then(function(a){return f.get_string("rate","tool_lp").then(function(b){this._popup=new d(b,a,this._afterRender.bind(this))}.bind(this))}.bind(this)).fail(b.exception)},g.prototype._find=function(b){return a(this._popup.getContent()).find(b)},g.prototype._render=function(){var a={cangrade:this._canGrade,ratings:this._ratingOptions};return c.render("tool_lp/competency_grader",a)},g});
- define('tool_lp/competencies', ["jquery","core/notification","core/ajax","core/templates","core/str","tool_lp/competencypicker","tool_lp/dragdrop-reorder"],function(a,b,c,d,e,f,g){var h=function(b,c,d){this.itemid=b,this.itemtype=c,this.pageContextId=d,this.pickerInstance=null,a('[data-region="actions"] button').prop("disabled",!1),this.registerEvents(),this.registerDragDrop()};return h.prototype.registerDragDrop=function(){var a=this;e.get_string("movecompetency","tool_lp").done(function(b){g.dragdrop("movecompetency",b,{identifier:"movecompetency",component:"tool_lp"},{identifier:"movecompetencyafter",component:"tool_lp"},"drag-samenode","drag-parentnode","drag-handlecontainer",function(b,c){a.handleDrop.call(a,b,c)})}).fail(b.exception)},h.prototype.handleDrop=function(d,e){var f=a(d).data("id"),g=a(e).data("id"),h=this,i=[];if("course"==h.itemtype)i=c.call([{methodname:"core_competency_reorder_course_competency",args:{courseid:h.itemid,competencyidfrom:f,competencyidto:g}}]);else if("template"==h.itemtype)i=c.call([{methodname:"core_competency_reorder_template_competency",args:{templateid:h.itemid,competencyidfrom:f,competencyidto:g}}]);else{if("plan"!=h.itemtype)return null;i=c.call([{methodname:"core_competency_reorder_plan_competency",args:{planid:h.itemid,competencyidfrom:f,competencyidto:g}}])}i[0].fail(b.exception)},h.prototype.pickCompetency=function(){var e,g,h,i,j=this;j.pickerInstance||(("template"===j.itemtype||"course"===j.itemtype)&&(i="parents"),j.pickerInstance=new f(j.pageContextId,!1,i),j.pickerInstance.on("save",function(f,i){var k=i.competencyIds;"course"===j.itemtype?(e=[],a.each(k,function(a,b){e.push({methodname:"core_competency_add_competency_to_course",args:{courseid:j.itemid,competencyid:b}})}),e.push({methodname:"tool_lp_data_for_course_competencies_page",args:{courseid:j.itemid}}),g="tool_lp/course_competencies_page",h="coursecompetenciespage"):"template"===j.itemtype?(e=[],a.each(k,function(a,b){e.push({methodname:"core_competency_add_competency_to_template",args:{templateid:j.itemid,competencyid:b}})}),e.push({methodname:"tool_lp_data_for_template_competencies_page",args:{templateid:j.itemid,pagecontext:{contextid:j.pageContextId}}}),g="tool_lp/template_competencies_page",h="templatecompetenciespage"):"plan"===j.itemtype&&(e=[],a.each(k,function(a,b){e.push({methodname:"core_competency_add_competency_to_plan",args:{planid:j.itemid,competencyid:b}})}),e.push({methodname:"tool_lp_data_for_plan_page",args:{planid:j.itemid}}),g="tool_lp/plan_page",h="plan-page"),c.call(e)[e.length-1].then(function(b){return d.render(g,b).done(function(b,c){a('[data-region="'+h+'"]').replaceWith(b),d.runTemplateJS(c)})},b.exception)})),j.pickerInstance.display()},h.prototype.doDelete=function(e){var f=this,g=[],h="",i="";"course"==f.itemtype?(g=c.call([{methodname:"core_competency_remove_competency_from_course",args:{courseid:f.itemid,competencyid:e}},{methodname:"tool_lp_data_for_course_competencies_page",args:{courseid:f.itemid}}]),h="tool_lp/course_competencies_page",i="coursecompetenciespage"):"template"==f.itemtype?(g=c.call([{methodname:"core_competency_remove_competency_from_template",args:{templateid:f.itemid,competencyid:e}},{methodname:"tool_lp_data_for_template_competencies_page",args:{templateid:f.itemid,pagecontext:{contextid:f.pageContextId}}}]),h="tool_lp/template_competencies_page",i="templatecompetenciespage"):"plan"==f.itemtype&&(g=c.call([{methodname:"core_competency_remove_competency_from_plan",args:{planid:f.itemid,competencyid:e}},{methodname:"tool_lp_data_for_plan_page",args:{planid:f.itemid}}]),h="tool_lp/plan_page",i="plan-page"),g[1].done(function(c){d.render(h,c).done(function(b,c){a('[data-region="'+i+'"]').replaceWith(b),d.runTemplateJS(c)}).fail(b.exception)}).fail(b.exception)},h.prototype.deleteHandler=function(a){var d,f=this,g=[];if("course"==f.itemtype)d="unlinkcompetencycourse";else if("template"==f.itemtype)d="unlinkcompetencytemplate";else{if("plan"!=f.itemtype)return;d="unlinkcompetencyplan"}g=c.call([{methodname:"core_competency_read_competency",args:{id:a}}]),g[0].done(function(c){e.get_strings([{key:"confirm",component:"moodle"},{key:d,component:"tool_lp",param:c.shortname},{key:"confirm",component:"moodle"},{key:"cancel",component:"moodle"}]).done(function(c){b.confirm(c[0],c[1],c[2],c[3],function(){f.doDelete(a)})}).fail(b.exception)}).fail(b.exception)},h.prototype.registerEvents=function(){var e=this;"course"==e.itemtype&&a('[data-region="coursecompetenciespage"]').on("change",'select[data-field="ruleoutcome"]',function(f){var g=[],h="tool_lp/course_competencies_page",i="coursecompetenciespage",j=a(f.target).data("id"),k=a(f.target).val();g=c.call([{methodname:"core_competency_set_course_competency_ruleoutcome",args:{coursecompetencyid:j,ruleoutcome:k}},{methodname:"tool_lp_data_for_course_competencies_page",args:{courseid:e.itemid}}]),g[1].done(function(c){d.render(h,c).done(function(b,c){a('[data-region="'+i+'"]').replaceWith(b),d.runTemplateJS(c)}).fail(b.exception)}).fail(b.exception)}),a('[data-region="actions"] button').click(function(a){a.preventDefault(),e.pickCompetency()}),a('[data-action="delete-competency-link"]').click(function(b){b.preventDefault();var c=a(b.target).closest("[data-id]").data("id");e.deleteHandler(c)})},h});
- define('tool_lp/frameworks_datasource', ["jquery","core/ajax","core/notification"],function(a,b,c){return{list:function(d,e){var f,g={context:{contextid:d}};return a.extend(g,"undefined"==typeof e?{}:e),f=b.call([{methodname:"core_competency_list_competency_frameworks",args:g}])[0],f.fail(c.exception)},processResults:function(b,c){var d=[];return a.each(c,function(a,b){d.push({value:b.id,label:b.shortname+" "+b.idnumber})}),d},transport:function(b,c,d){var e=a(b),f=e.data("contextid"),g=e.data("onlyvisible");if(!f)throw new Error("The attribute data-contextid is required on "+b);this.list(f,{query:c,onlyvisible:g}).then(d)}}});
- define('tool_lp/competencyruleconfig', ["jquery","core/notification","core/templates","tool_lp/dialogue","tool_lp/competency_outcomes","core/str"],function(a,b,c,d,e,f){var g=function(b,c){this._eventNode=a("<div></div>"),this._tree=b,this._rulesModules=c,this._setUp()};return g.prototype._competency=null,g.prototype._eventNode=null,g.prototype._outcomesOption=null,g.prototype._popup=null,g.prototype._ready=null,g.prototype._rules=null,g.prototype._rulesModules=null,g.prototype._tree=null,g.prototype._afterChange=function(){this._isValid()?this._find('[data-action="save"]').prop("disabled",!1):this._find('[data-action="save"]').prop("disabled",!0)},g.prototype._afterRuleConfigChange=function(a,b){b==this._getRule()&&this._afterChange()},g.prototype._afterRender=function(){var a=this;a._find('[name="outcome"]').on("change",function(){a._switchedOutcome()}).trigger("change"),a._find('[name="rule"]').on("change",function(){a._switchedRule()}).trigger("change"),a._find('[data-action="save"]').on("click",function(){a._trigger("save",a._getConfig()),a.close()}),a._find('[data-action="cancel"]').on("click",function(){a.close()})},g.prototype.canBeConfigured=function(){var b=!1;return a.each(this._rules,function(a,c){return c.canConfig()?(b=!0,!1):void 0}),b},g.prototype.close=function(){this._popup.close(),this._popup=null},g.prototype.display=function(){var a=this;if(a._competency)return a._render().then(function(b){return f.get_string("competencyrule","tool_lp").then(function(c){a._popup=new d(c,b,a._afterRender.bind(a))})}).fail(b.exception)},g.prototype._find=function(b){return a(this._popup.getContent()).find(b)},g.prototype._getApplicableOutcomesOptions=function(){var b=this,c=[];return a.each(b._outcomesOption,function(a,d){c.push({code:d.code,name:d.name,selected:d.code==b._competency.ruleoutcome?!0:!1})}),c},g.prototype._getApplicableRulesOptions=function(){var b=this,c=[];return a.each(b._rules,function(a,d){d.canConfig()&&c.push({name:b._getRuleName(d.getType()),type:d.getType(),selected:d.getType()==b._competency.ruletype?!0:!1})}),c},g.prototype._getConfig=function(){var a=this._getRule();return{ruletype:a?a.getType():null,ruleconfig:a?a.getConfig():null,ruleoutcome:this._getOutcome()}},g.prototype._getOutcome=function(){return this._find('[name="outcome"]').val()},g.prototype._getRule=function(){var b,c=this._find('[name="rule"]').val();return a.each(this._rules,function(a,d){return d.getType()==c?(b=d,!1):void 0}),b},g.prototype._getRuleName=function(b){var c,d=this;return a.each(d._rulesModules,function(a,d){return d.type==b?(c=d.name,!1):void 0}),c},g.prototype._initOutcomes=function(){var a=this;return e.getAll().then(function(b){a._outcomesOption=b})},g.prototype._initRules=function(){var b=this,c=[];return a.each(b._rules,function(d,e){var f=e.init().then(function(){e.setTargetCompetency(b._competency),e.on("change",b._afterRuleConfigChange.bind(b))},function(){return b._rules.splice(d,1),a.when()});c.push(f)}),a.when.apply(a.when,c)},g.prototype._isValid=function(){var a=this._getOutcome(),b=this._getRule();return a==e.NONE?!0:b?b.isValid():!1},g.prototype.on=function(a,b){this._eventNode.on(a,b)},g.prototype._preRender=function(){return this.ready()},g.prototype.ready=function(){return this._ready.promise()},g.prototype._render=function(){var a=this;return this._preRender().then(function(){var b;a.canBeConfigured()?(b={},b.outcomes=a._getApplicableOutcomesOptions(),b.rules=a._getApplicableRulesOptions()):b=!1;var d={competencyshortname:a._competency.shortname,config:b};return c.render("tool_lp/competency_rule_config",d)})},g.prototype.setTargetCompetencyId=function(b){var c=this;c._competency=c._tree.getCompetency(b),a.each(c._rules,function(a,b){b.setTargetCompetency(c._competency)})},g.prototype._setUp=function(){var b=this,c=[],d=[];b._ready=a.Deferred(),b._rules=[],a.each(b._rulesModules,function(a,b){d.push(b.amd)}),require(d,function(){a.each(arguments,function(a,c){var d=new c(b._tree);b._rules.push(d)}),c.push(b._initRules()),c.push(b._initOutcomes()),a.when.apply(a.when,c).always(function(){b._ready.resolve()})})},g.prototype._switchedOutcome=function(){var a=this,b=a._getOutcome();return b==e.NONE?(a._find('[data-region="rule-type"]').hide().find('[name="rule"]').val(-1),a._find('[data-region="rule-config"]').empty().hide(),void a._afterChange()):(a._find('[data-region="rule-type"]').show(),a._find('[data-region="rule-config"]').show(),void a._afterChange())},g.prototype._switchedRule=function(){var a=this,b=a._find('[data-region="rule-config"]'),c=a._getRule();return c?void c.injectTemplate(b).then(function(){b.show()},function(){b.empty().hide()}).always(function(){a._afterChange()}):(b.empty().hide(),void a._afterChange())},g.prototype._trigger=function(a,b){this._eventNode.trigger(a,[b])},g});
- define('tool_lp/competency_rule_points', ["jquery","core/str","core/templates","tool_lp/competency_rule"],function(a,b,c,d){var e=function(){d.apply(this,arguments)};return e.prototype=Object.create(d.prototype),e.prototype._container=null,e.prototype._templateLoaded=!1,e.prototype.getConfig=function(){return JSON.stringify({base:{points:this._getRequiredPoints()},competencies:this._getCompetenciesConfig()})},e.prototype._getCompetenciesConfig=function(){var b=[];return this._container.find("[data-competency]").each(function(){var c=a(this),d=c.data("competency"),e=parseInt(c.find('[name="points"]').val(),10),f=c.find('[name="required"]').prop("checked");b.push({id:d,points:e,required:f?1:0})}),b},e.prototype._getRequiredPoints=function(){return parseInt(this._container.find('[name="requiredpoints"]').val()||1,10)},e.prototype.getType=function(){return"core_competency\\competency_rule_points"},e.prototype.injectTemplate=function(b){var d,e=this,f=this._tree.getChildren(this._competency.id),g={base:{points:2},competencies:[]};if(this._templateLoaded=!1,e._competency.ruletype==e.getType())try{g=JSON.parse(e._competency.ruleconfig)}catch(h){}return d={requiredpoints:g&&g.base?g.base.points:2,competency:e._competency,children:[]},a.each(f,function(b,c){var e={id:c.id,shortname:c.shortname,required:!1,points:0};g&&a.each(g.competencies,function(a,b){b.id==e.id&&(e.required=b.required?!0:!1,e.points=b.points)}),d.children.push(e)}),c.render("tool_lp/competency_rule_points",d).then(function(a){e._container=b,b.html(a),b.find("input").change(function(){e._triggerChange()}),e._templateLoaded=!0,e._triggerChange()})},e.prototype.isValid=function(){if(!this._templateLoaded)return!1;var b=this._getRequiredPoints(),c=0,d=!0;return a.each(this._getCompetenciesConfig(),function(a,b){b.points<0&&(d=!1),c+=b.points}),d=d&&c>=b},e});
- define('tool_lp/templateactions', ["jquery","core/templates","core/ajax","core/notification","core/str","tool_lp/actionselector"],function(a,b,c,d,e,f){var g=0,h=0,i=!0,j=function(c,d){a('[data-region="managetemplates"]').replaceWith(c),b.runTemplateJS(d)},k=function(a){b.render("tool_lp/manage_templates_page",a).done(j).fail(d.exception)},l=function(){var a=c.call([{methodname:"core_competency_delete_template",args:{id:h,deleteplans:i}},{methodname:"tool_lp_data_for_templates_manage_page",args:{pagecontext:{contextid:g}}}]);a[1].done(k).fail(d.exception)},m=function(b){b.preventDefault(),h=a(this).attr("data-templateid");var e=c.call([{methodname:"core_competency_duplicate_template",args:{id:h}},{methodname:"tool_lp_data_for_templates_manage_page",args:{pagecontext:{contextid:g}}}]);e[1].done(k).fail(d.exception)},n=function(b){b.preventDefault();var g=a(this).attr("data-templateid");h=g,i=!0;var j=c.call([{methodname:"core_competency_read_template",args:{id:h}},{methodname:"core_competency_template_has_related_data",args:{id:h}}]);j[0].done(function(a){j[1].done(function(b){b?e.get_strings([{key:"deletetemplate",component:"tool_lp",param:a.shortname},{key:"deletetemplatewithplans",component:"tool_lp"},{key:"deleteplans",component:"tool_lp"},{key:"unlinkplanstemplate",component:"tool_lp"},{key:"confirm",component:"moodle"},{key:"cancel",component:"moodle"}]).done(function(a){var b=[{text:a[2],value:"delete"},{text:a[3],value:"unlink"}],c=new f(a[0],a[1],b,a[4],a[5]);c.display(),c.on("save",function(a,b){"delete"!=b.action&&(i=!1),l()})}).fail(d.exception):e.get_strings([{key:"confirm",component:"moodle"},{key:"deletetemplate",component:"tool_lp",param:a.shortname},{key:"delete",component:"moodle"},{key:"cancel",component:"moodle"}]).done(function(a){d.confirm(a[0],a[1],a[2],a[3],l)}).fail(d.exception)}).fail(d.exception)}).fail(d.exception)};return{deleteHandler:n,duplicateHandler:m,init:function(a){g=a}}});
- define('tool_lp/competency_rule_all', ["jquery","core/str","tool_lp/competency_rule"],function(a,b,c){var d=function(){c.apply(this,arguments)};return d.prototype=Object.create(c.prototype),d.prototype.getType=function(){return"core_competency\\competency_rule_all"},d.prototype.isValid=function(){return!0},d});
- define('tool_lp/grade_user_competency_inline', ["jquery","core/notification","core/ajax","core/log","tool_lp/grade_dialogue","tool_lp/event_base","tool_lp/scalevalues"],function(a,b,c,d,e,f,g){var h=function(b,c,d,e,g,h,i){f.prototype.constructor.apply(this,[]);var j=a(b);if(!j.length)throw new Error("Could not find the trigger");this._scaleId=c,this._competencyId=d,this._userId=e,this._planId=g,this._courseId=h,this._chooseStr=i,this._setUp(),j.click(function(a){a.preventDefault(),this._dialogue.display()}.bind(this)),this._planId?(this._methodName="core_competency_grade_competency_in_plan",this._args={competencyid:this._competencyId,planid:this._planId}):this._courseId?(this._methodName="core_competency_grade_competency_in_course",this._args={competencyid:this._competencyId,courseid:this._courseId,userid:this._userId}):(this._methodName="core_competency_grade_competency",this._args={userid:this._userId,competencyid:this._competencyId})};return h.prototype=Object.create(f.prototype),h.prototype._setUp=function(){var a=[],d=this,f=g.get_values(d._scaleId);f.done(function(f){a.push({value:"",name:d._chooseStr});for(var g=0;g<f.length;g++){var h=f[g];a.push({value:h.id,name:h.name})}d._dialogue=new e(a),d._dialogue.on("rated",function(a,e){var f=d._args;f.grade=e.rating,f.note=e.note,c.call([{methodname:d._methodName,args:f,done:function(a){d._trigger("competencyupdated",{args:f,evidence:a})}.bind(d),fail:b.exception}])}.bind(d))}).fail(b.exception)},h.prototype._scaleId=null,h.prototype._competencyId=null,h.prototype._userId=null,h.prototype._planId=null,h.prototype._courseId=null,h.prototype._chooseStr=null,h.prototype._dialogue=null,h});
- define('tool_lp/user_competency_workflow', ["jquery","core/templates","core/ajax","core/notification","core/str","tool_lp/menubar","tool_lp/event_base"],function(a,b,c,d,e,f,g){var h=function(){g.prototype.constructor.apply(this,[])};return h.prototype=Object.create(g.prototype),h.prototype._nodeSelector='[data-node="user-competency"]',h.prototype._cancelReviewRequest=function(a){var b={methodname:"core_competency_user_competency_cancel_review_request",args:{userid:a.userid,competencyid:a.competencyid}};c.call([b])[0].then(function(){this._trigger("review-request-cancelled",a),this._trigger("status-changed",a)}.bind(this),function(){this._trigger("error-occured",a)}.bind(this))},h.prototype.cancelReviewRequest=function(a){this._cancelReviewRequest(a)},h.prototype._cancelReviewRequestHandler=function(b){b.preventDefault();var c=this._findUserCompetencyData(a(b.target));this.cancelReviewRequest(c)},h.prototype._requestReview=function(a){var b={methodname:"core_competency_user_competency_request_review",args:{userid:a.userid,competencyid:a.competencyid}};c.call([b])[0].then(function(){this._trigger("review-requested",a),this._trigger("status-changed",a)}.bind(this),function(){this._trigger("error-occured",a)}.bind(this))},h.prototype.requestReview=function(a){this._requestReview(a)},h.prototype._requestReviewHandler=function(b){b.preventDefault();var c=this._findUserCompetencyData(a(b.target));this.requestReview(c)},h.prototype._startReview=function(a){var b={methodname:"core_competency_user_competency_start_review",args:{userid:a.userid,competencyid:a.competencyid}};c.call([b])[0].then(function(){this._trigger("review-started",a),this._trigger("status-changed",a)}.bind(this),function(){this._trigger("error-occured",a)}.bind(this))},h.prototype.startReview=function(a){this._startReview(a)},h.prototype._startReviewHandler=function(b){b.preventDefault();var c=this._findUserCompetencyData(a(b.target));this.startReview(c)},h.prototype._stopReview=function(a){var b={methodname:"core_competency_user_competency_stop_review",args:{userid:a.userid,competencyid:a.competencyid}};c.call([b])[0].then(function(){this._trigger("review-stopped",a),this._trigger("status-changed",a)}.bind(this),function(){this._trigger("error-occured",a)}.bind(this))},h.prototype.stopReview=function(a){this._stopReview(a)},h.prototype._stopReviewHandler=function(b){b.preventDefault();var c=this._findUserCompetencyData(a(b.target));this.stopReview(c)},h.prototype.enhanceMenubar=function(a){f.enhance(a,{'[data-action="request-review"]':this._requestReviewHandler.bind(this),'[data-action="cancel-review-request"]':this._cancelReviewRequestHandler.bind(this)})},h.prototype._findUserCompetencyData=function(a){var b,c=a.parents(this._nodeSelector);if(1!=c.length)throw new Error("The evidence node was not located.");if(b=c.data(),"undefined"==typeof b||"undefined"==typeof b.userid||"undefined"==typeof b.competencyid)throw new Error("User competency data could not be found.");return b},h.prototype.enhanceMenubar=function(a){f.enhance(a,{'[data-action="request-review"]':this._requestReviewHandler.bind(this),'[data-action="cancel-review-request"]':this._cancelReviewRequestHandler.bind(this),'[data-action="start-review"]':this._startReviewHandler.bind(this),'[data-action="stop-review"]':this._stopReviewHandler.bind(this)})},h.prototype.registerEvents=function(b){var c=a(b);c.find('[data-action="request-review"]').click(this._requestReviewHandler.bind(this)),c.find('[data-action="cancel-review-request"]').click(this._cancelReviewRequestHandler.bind(this)),c.find('[data-action="start-review"]').click(this._startReviewHandler.bind(this)),c.find('[data-action="stop-review"]').click(this._stopReviewHandler.bind(this))},h});
- define('tool_lp/dragdrop-reorder', ["core/str","core/yui"],function(a,b){var c=null,d=function(a){var b=a.drag.get("node"),c=a.drop.get("node");this.callback(b.getDOMNode(),c.getDOMNode())};return{dragdrop:function(e,f,g,h,i,j,k,l){a.get_strings([{key:"emptydragdropregion",component:"moodle"},{key:"movecontent",component:"moodle"},{key:"tocontent",component:"moodle"}]).done(function(){b.use("moodle-tool_lp-dragdrop-reorder",function(){var a={callback:l};c&&c.destroy(),c=M.tool_lp.dragdrop_reorder({group:e,dragHandleText:f,sameNodeText:g,parentNodeText:h,sameNodeClass:i,parentNodeClass:j,dragHandleInsertClass:k,callback:b.bind(d,a)})})})}}});
- define('tool_lp/planactions', ["jquery","core/templates","core/ajax","core/notification","core/str","tool_lp/menubar","tool_lp/dialogue"],function(a,b,c,d,e,f,g){var h=function(a){if(this._type=a,"plan"===a)this._region='[data-region="plan-page"]',this._planNode='[data-region="plan-page"]',this._template="tool_lp/plan_page",this._contextMethod="tool_lp_data_for_plan_page";else{if("plans"!==a)throw new TypeError("Unexpected type.");this._region='[data-region="plans"]',this._planNode='[data-region="plan-node"]',this._template="tool_lp/plans_page",this._contextMethod="tool_lp_data_for_plans_page"}};return h.prototype._contextMethod=null,h.prototype._planNode=null,h.prototype._region=null,h.prototype._template=null,h.prototype._type=null,h.prototype._getContextArgs=function(a){var b=this,c={};return"plan"===b._type?c={planid:a.id}:"plans"===b._type&&(c={userid:a.userid}),c},h.prototype.refresh=function(b){var c=this._findPlanData(a(b));this._callAndRefresh([],c)},h.prototype._renderView=function(c){var e=this;b.render(e._template,c).done(function(c,d){a(e._region).replaceWith(c),b.runTemplateJS(d)}.bind(e)).fail(d.exception)},h.prototype._callAndRefresh=function(b,e){var f=this;return b.push({methodname:f._contextMethod,args:f._getContextArgs(e)}),a.when.apply(a.when,c.call(b)).then(function(){f._renderView.call(f,arguments[arguments.length-1])}).fail(d.exception)},h.prototype._doDelete=function(a){var b=this,c=[{methodname:"core_competency_delete_plan",args:{id:a.id}}];b._callAndRefresh(c,a)},h.prototype.deletePlan=function(a){var b,f=this;b=c.call([{methodname:"core_competency_read_plan",args:{id:a.id}}]),b[0].done(function(b){e.get_strings([{key:"confirm",component:"moodle"},{key:"deleteplan",component:"tool_lp",param:b.name},{key:"delete",component:"moodle"},{key:"cancel",component:"moodle"}]).done(function(b){d.confirm(b[0],b[1],b[2],b[3],function(){f._doDelete(a)}.bind(f))}).fail(d.exception)}).fail(d.exception)},h.prototype._doReopenPlan=function(a){var b=this,c=[{methodname:"core_competency_reopen_plan",args:{planid:a.id}}];b._callAndRefresh(c,a)},h.prototype.reopenPlan=function(a){var b=this,f=c.call([{methodname:"core_competency_read_plan",args:{id:a.id}}]);f[0].done(function(c){e.get_strings([{key:"confirm",component:"moodle"},{key:"reopenplanconfirm",component:"tool_lp",param:c.name},{key:"reopenplan",component:"tool_lp"},{key:"cancel",component:"moodle"}]).done(function(c){d.confirm(c[0],c[1],c[2],c[3],function(){b._doReopenPlan(a)}.bind(b))}).fail(d.exception)}).fail(d.exception)},h.prototype._doCompletePlan=function(a){var b=this,c=[{methodname:"core_competency_complete_plan",args:{planid:a.id}}];b._callAndRefresh(c,a)},h.prototype.completePlan=function(a){var b=this,f=c.call([{methodname:"core_competency_read_plan",args:{id:a.id}}]);f[0].done(function(c){e.get_strings([{key:"confirm",component:"moodle"},{key:"completeplanconfirm",component:"tool_lp",param:c.name},{key:"completeplan",component:"tool_lp"},{key:"cancel",component:"moodle"}]).done(function(c){d.confirm(c[0],c[1],c[2],c[3],function(){b._doCompletePlan(a)}.bind(b))}).fail(d.exception)}).fail(d.exception)},h.prototype._doUnlinkPlan=function(a){var b=this,c=[{methodname:"core_competency_unlink_plan_from_template",args:{planid:a.id}}];b._callAndRefresh(c,a)},h.prototype.unlinkPlan=function(a){var b=this,f=c.call([{methodname:"core_competency_read_plan",args:{id:a.id}}]);f[0].done(function(c){e.get_strings([{key:"confirm",component:"moodle"},{key:"unlinkplantemplateconfirm",component:"tool_lp",param:c.name},{key:"unlinkplantemplate",component:"tool_lp"},{key:"cancel",component:"moodle"}]).done(function(c){d.confirm(c[0],c[1],c[2],c[3],function(){b._doUnlinkPlan(a)}.bind(b))}).fail(d.exception)}).fail(d.exception)},h.prototype._doRequestReview=function(a){var b=[{methodname:"core_competency_plan_request_review",args:{id:a.id}}];this._callAndRefresh(b,a)},h.prototype.requestReview=function(a){this._doRequestReview(a)},h.prototype._doCancelReviewRequest=function(a){var b=[{methodname:"core_competency_plan_cancel_review_request",args:{id:a.id}}];this._callAndRefresh(b,a)},h.prototype.cancelReviewRequest=function(a){this._doCancelReviewRequest(a)},h.prototype._doStartReview=function(a){var b=[{methodname:"core_competency_plan_start_review",args:{id:a.id}}];this._callAndRefresh(b,a)},h.prototype.startReview=function(a){this._doStartReview(a)},h.prototype._doStopReview=function(a){var b=[{methodname:"core_competency_plan_stop_review",args:{id:a.id}}];this._callAndRefresh(b,a)},h.prototype.stopReview=function(a){this._doStopReview(a)},h.prototype._doApprove=function(a){var b=[{methodname:"core_competency_approve_plan",args:{id:a.id}}];this._callAndRefresh(b,a)},h.prototype.approve=function(a){this._doApprove(a)},h.prototype._doUnapprove=function(a){var b=[{methodname:"core_competency_unapprove_plan",args:{id:a.id}}];this._callAndRefresh(b,a)},h.prototype.unapprove=function(a){this._doUnapprove(a)},h.prototype._showLinkedCoursesHandler=function(f){f.preventDefault();var h=a(f.target).data("id"),i=c.call([{methodname:"tool_lp_list_courses_using_competency",args:{id:h}}]);i[0].done(function(a){var c={courses:a};b.render("tool_lp/linked_courses_summary",c).done(function(a){e.get_string("linkedcourses","tool_lp").done(function(b){new g(b,a)}).fail(d.exception)}).fail(d.exception)}).fail(d.exception)},h.prototype._eventHandler=function(b,c){c.preventDefault();var d=this._findPlanData(a(c.target));this[b](d)},h.prototype._findPlanData=function(b){var c,d=b.parentsUntil(a(this._region).parent(),this._planNode);if(1!=d.length)throw new Error("The plan node was not located.");if(c=d.data(),"undefined"==typeof c||"undefined"==typeof c.id)throw new Error("Plan data could not be found.");return c},h.prototype.enhanceMenubar=function(a){f.enhance(a,{'[data-action="plan-delete"]':this._eventHandler.bind(this,"deletePlan"),'[data-action="plan-complete"]':this._eventHandler.bind(this,"completePlan"),'[data-action="plan-reopen"]':this._eventHandler.bind(this,"reopenPlan"),'[data-action="plan-unlink"]':this._eventHandler.bind(this,"unlinkPlan"),'[data-action="plan-request-review"]':this._eventHandler.bind(this,"requestReview"),'[data-action="plan-cancel-review-request"]':this._eventHandler.bind(this,"cancelReviewRequest"),'[data-action="plan-start-review"]':this._eventHandler.bind(this,"startReview"),'[data-action="plan-stop-review"]':this._eventHandler.bind(this,"stopReview"),'[data-action="plan-approve"]':this._eventHandler.bind(this,"approve"),'[data-action="plan-unapprove"]':this._eventHandler.bind(this,"unapprove")})},h.prototype.registerEvents=function(){var b=a(this._region);b.find('[data-action="plan-delete"]').click(this._eventHandler.bind(this,"deletePlan")),b.find('[data-action="plan-complete"]').click(this._eventHandler.bind(this,"completePlan")),b.find('[data-action="plan-reopen"]').click(this._eventHandler.bind(this,"reopenPlan")),b.find('[data-action="plan-unlink"]').click(this._eventHandler.bind(this,"unlinkPlan")),b.find('[data-action="plan-request-review"]').click(this._eventHandler.bind(this,"requestReview")),b.find('[data-action="plan-cancel-review-request"]').click(this._eventHandler.bind(this,"cancelReviewRequest")),b.find('[data-action="plan-start-review"]').click(this._eventHandler.bind(this,"startReview")),b.find('[data-action="plan-stop-review"]').click(this._eventHandler.bind(this,"stopReview")),b.find('[data-action="plan-approve"]').click(this._eventHandler.bind(this,"approve")),b.find('[data-action="plan-unapprove"]').click(this._eventHandler.bind(this,"unapprove")),b.find('[data-action="find-courses-link"]').click(this._showLinkedCoursesHandler.bind(this))},h});
- define('tool_lp/parentcompetency_form', ["jquery","core/ajax","core/str","tool_lp/competencypicker","core/templates","core/notification"],function(a,b,c,d,e,f){var g=function(a,b,c,d,e){this.buttonSelector=a,this.inputHiddenSelector=b,this.staticElementSelector=c,this.frameworkId=d,this.pageContextId=e,this.registerEvents()};return g.prototype.buttonSelector=null,g.prototype.inputHiddenSelector=null,g.prototype.staticElementSelector=null,g.prototype.frameworkId=null,g.prototype.pageContextId=null,g.prototype.setParent=function(d){var e=this;0!==d.competencyId?b.call([{methodname:"core_competency_read_competency",args:{id:d.competencyId}}])[0].done(function(b){a(e.staticElementSelector).html(b.shortname),a(e.inputHiddenSelector).val(b.id)}).fail(f.exception):c.get_string("competencyframeworkroot","tool_lp").then(function(b){a(e.staticElementSelector).html(b),a(e.inputHiddenSelector).val(d.competencyId)}).fail(f.exception)},g.prototype.registerEvents=function(){var b=this;a(b.buttonSelector).on("click",function(a){a.preventDefault();var c=new d(b.pageContextId,b.frameworkId,"self",!1);c._render=function(){var a=this;return a._preRender().then(function(){var b={competencies:a._competencies,framework:a._getFramework(a._frameworkId),frameworks:a._frameworks,search:a._searchText,singleFramework:a._singleFramework};return e.render("tool_lp/competency_picker_competencyform",b)}.bind(a))},c.on("save",function(a,c){b.setParent(c)}.bind(b)),c.display()})},{init:function(a,b,c,d,e){new g(a,b,c,d,e)}}});
- define('tool_lp/evidence_delete', ["jquery","core/notification","core/ajax","core/str","core/log"],function(a,b,c,d,e){var f={},g=function(g,h){"undefined"==typeof f[g]&&(f[g]=a("body").delegate(g,"click",function(f){var g=a(f.currentTarget).parents(h);if(!g.length||g.length>1)return void e.error("None or too many evidence container were found.");var i=g.data("id");return i?(f.preventDefault(),f.stopPropagation(),void d.get_strings([{key:"confirm",component:"moodle"},{key:"areyousure",component:"moodle"},{key:"delete",component:"moodle"},{key:"cancel",component:"moodle"}]).done(function(a){b.confirm(a[0],a[1],a[2],a[3],function(){var a=c.call([{methodname:"core_competency_delete_evidence",args:{id:i}}]);a[0].then(function(){g.remove()}).fail(b.exception)})}).fail(b.exception)):void e.error("Evidence ID was not found.")}))};return{register:g}});
- define('tool_lp/competencypicker_user_plans', ["jquery","core/notification","core/ajax","core/templates","core/str","tool_lp/tree","tool_lp/competencypicker"],function(a,b,c,d,e,f,g){var h=function(a,b,c){g.prototype.constructor.apply(this,[1,!1,"self",c]),this._userId=a,this._plans=[],b&&(this._planId=b,this._singlePlan=!0)};return h.prototype=Object.create(g.prototype),h.prototype._plans=null,h.prototype._planId=null,h.prototype._singlePlan=!1,h.prototype._userId=null,h.prototype._afterRender=function(){var b=this;g.prototype._afterRender.apply(b,arguments),b._singlePlan||b._find('[data-action="chooseplan"]').change(function(c){b._planId=a(c.target).val(),b._loadCompetencies().then(b._refresh.bind(b))}.bind(b))},h.prototype._fetchCompetencies=function(a,d){var e=this;return c.call([{methodname:"core_competency_list_plan_competencies",args:{id:a}}])[0].done(function(a){var b,c,f=[];for(b=0;b<a.length;b++)c=a[b].competency,c.shortname.toLowerCase().indexOf(d.toLowerCase())<0||(c.children=[],c.haschildren=0,f.push(c));e._competencies=f}).fail(b.exception)},h.prototype._getPlan=function(b){var c;return a.each(this._plans,function(a,d){return d.id==b?(c=d,!1):void 0}),c},h.prototype._loadCompetencies=function(){return this._fetchCompetencies(this._planId,this._searchText)},h.prototype._loadPlans=function(){var d,e=this;return e._plans.length>0?a.when():(d=e._singlePlan?c.call([{methodname:"core_competency_read_plan",args:{id:this._planId}}])[0].then(function(a){return[a]}):c.call([{methodname:"core_competency_list_user_plans",args:{userid:e._userId}}])[0],d.done(function(a){e._plans=a}).fail(b.exception))},h.prototype._preRender=function(){var b=this;return b._loadPlans().then(function(){return!b._planId&&b._plans.length>0&&(b._planId=b._plans[0].id),b._planId?b._loadCompetencies():(b._plans=[],a.when())}.bind(b))},h.prototype._render=function(){var b=this;return b._preRender().then(function(){b._singlePlan||a.each(b._plans,function(a,c){c.id==b._planId?c.selected=!0:c.selected=!1});var c={competencies:b._competencies,plan:b._getPlan(b._planId),plans:b._plans,search:b._searchText,singlePlan:b._singlePlan};return d.render("tool_lp/competency_picker_user_plans",c)}.bind(b))},h});
- define('tool_lp/menubar', ["jquery"],function(a){var b=!1,c=!1,d=function(){a(".tool-lp-menu .tool-lp-sub-menu").attr("aria-hidden","true"),c=!1},e=function(a,b){this.menuRoot=a,this.handlers=b,this.rootMenus=this.menuRoot.children("li"),this.subMenus=this.rootMenus.children("ul"),this.subMenuItems=this.subMenus.children("li"),this.allItems=this.rootMenus.add(this.subMenuItems),this.activeItem=null,this.isChildOpen=!1,this.keys={tab:9,enter:13,esc:27,space:32,left:37,up:38,right:39,down:40},this.addAriaAttributes(),this.addEventListeners()};return e.prototype.openSubMenu=function(a){this.setOpenDirection(),d(),a.attr("aria-hidden","false"),c=!0},e.prototype.addEventListeners=function(){var e=this;b===!1&&(a(document).click(function(){c&&d()}),b=!0),this.subMenuItems.mouseenter(function(){return a(this).addClass("menu-hover"),!0}),this.subMenuItems.mouseout(function(){return a(this).removeClass("menu-hover"),!0}),this.allItems.click(function(b){return e.handleClick(a(this),b)}),this.allItems.keydown(function(b){return e.handleKeyDown(a(this),b)}),this.allItems.focus(function(){return e.handleFocus(a(this))}),this.allItems.blur(function(){return e.handleBlur(a(this))})},e.prototype.handleClick=function(b,c){c.stopPropagation();var d=b.parent();if(d.is(".tool-lp-menu"))"true"==b.children("ul").first().attr("aria-hidden")?this.openSubMenu(b.children("ul").first()):b.children("ul").first().attr("aria-hidden","true");else{this.allItems.removeClass("menu-hover menu-focus"),this.activeItem=null,this.menuRoot.find("ul").not(".root-level").attr("aria-hidden","true");var e=b.find("a").first(),f=new a.Event("click");f.target=e;var g=!1;this.handlers&&a.each(this.handlers,function(c,d){if(g)return!1;if(b.find(c).length>0){var h=a.proxy(d,e);g=h(f)===!1||f.isDefaultPrevented()}}),g||"#"===e.attr("href")||(window.location.href=e.attr("href"))}return!1},e.prototype.handleFocus=function(a){if(null===this.activeItem)this.activeItem=a;else if(a[0]!=this.activeItem[0])return!0;var b=this.activeItem.parentsUntil("ul.tool-lp-menu").filter("li");if(this.allItems.removeClass("menu-focus"),this.activeItem.addClass("menu-focus"),b.addClass("menu-focus"),this.isChildOpen===!0){var c=a.parent();c.is(".tool-lp-menu")&&"true"==a.attr("aria-haspopup")&&this.openSubMenu(a.children("ul").first())}return!0},e.prototype.handleBlur=function(a){return a.removeClass("menu-focus"),!0},e.prototype.setOpenDirection=function(){var b=this.menuRoot.offset(),c=a(document.body).hasClass("dir-rtl"),d=!1,e=this.rootMenus.outerHeight(),f=this.rootMenus.outerWidth(),g=this.rootMenus.find("ul.tool-lp-sub-menu");g.css("margin-right",""),g.css("margin-left",""),g.css("margin-top",""),g.attr("aria-hidden",!1);var h=g.outerWidth(),i=g.outerHeight(),j=null,k=null,l=null,m=b.top-a(window).scrollTop();m+i>a(window).height()&&(j=i+e,g.css("margin-top","-"+j+"px")),c?b.left-h<0&&(k=h-f,g.css("margin-right","-"+k+"px")):b.left+h>a(window).width()&&(l=h-f,g.css("margin-left","-"+l+"px")),d?this.menuRoot.addClass("tool-lp-menu-open-left"):this.menuRoot.removeClass("tool-lp-menu-open-left")},e.prototype.handleKeyDown=function(a,b){if(b.altKey||b.ctrlKey)return!0;switch(b.keyCode){case this.keys.tab:this.menuRoot.find("ul").attr("aria-hidden","true"),this.allItems.removeClass("menu-focus"),this.activeItem=null,this.isChildOpen=!1;break;case this.keys.esc:var c=a.parent();return c.is(".tool-lp-menu")?a.children("ul").first().attr("aria-hidden","true"):(this.activeItem=c.parent(),this.isChildOpen=!1,this.activeItem.focus(),c.attr("aria-hidden","true")),b.stopPropagation(),!1;case this.keys.enter:case this.keys.space:return this.handleClick(a,b);case this.keys.left:return this.activeItem=this.moveToPrevious(a),this.activeItem.focus(),b.stopPropagation(),!1;case this.keys.right:return this.activeItem=this.moveToNext(a),this.activeItem.focus(),b.stopPropagation(),!1;case this.keys.up:return this.activeItem=this.moveUp(a),this.activeItem.focus(),b.stopPropagation(),!1;case this.keys.down:return this.activeItem=this.moveDown(a),this.activeItem.focus(),b.stopPropagation(),!1}return!0},e.prototype.moveToNext=function(a){var b=a.parent(),c=b.children("li"),d=c.length,e=c.index(a),f=null,g=null;if(b.is(".tool-lp-menu"))f=d-1>e?a.next():c.first(),"true"==a.attr("aria-haspopup")&&(g=a.children("ul").first(),"false"==g.attr("aria-hidden")&&(g.attr("aria-hidden","true"),this.isChildOpen=!0)),a.removeClass("menu-focus"),"true"===f.attr("aria-haspopup")&&this.isChildOpen===!0&&(g=f.children("ul").first(),this.openSubMenu(g));else if("true"==a.attr("aria-haspopup"))g=a.children("ul").first(),f=g.children("li").first(),this.openSubMenu(g);else{var h=null,i=null;h=a.parentsUntil("ul.tool-lp-menu").filter("ul").not(".tool-lp-menu"),h.attr("aria-hidden","true"),h.find("li").removeClass("menu-focus"),h.last().parent().removeClass("menu-focus"),i=h.last().parent(),e=this.rootMenus.index(i),f=e<this.rootMenus.length-1?i.next():this.rootMenus.first(),f.addClass("menu-focus"),"true"==f.attr("aria-haspopup")&&(g=f.children("ul").first(),f=g.children("li").first(),this.openSubMenu(g),this.isChildOpen=!0)}return f},e.prototype.moveToPrevious=function(a){var b=a.parent(),c=b.children("li"),d=c.index(a),e=null,f=null;if(b.is(".tool-lp-menu"))e=d>0?a.prev():c.last(),"true"==a.attr("aria-haspopup")&&(f=a.children("ul").first(),"false"==f.attr("aria-hidden")&&(f.attr("aria-hidden","true"),this.isChildOpen=!0)),a.removeClass("menu-focus"),"true"===e.attr("aria-haspopup")&&this.isChildOpen===!0&&(f=e.children("ul").first(),this.openSubMenu(f));else{var g=b.parent(),h=g.parent();h.is(".tool-lp-menu")?(b.attr("aria-hidden","true"),a.removeClass("menu-focus"),g.removeClass("menu-focus"),d=this.rootMenus.index(g),e=d>0?g.prev():this.rootMenus.last(),e.addClass("menu-focus"),"true"==e.attr("aria-haspopup")&&(f=e.children("ul").first(),this.openSubMenu(f),this.isChildOpen=!0,e=f.children("li").first())):(e=b.parent(),b.attr("aria-hidden","true"),a.removeClass("menu-focus"))}return e},e.prototype.moveDown=function(a,b){var c=a.parent(),d=c.children("li").not(".separator"),e=d.length,f=d.index(a),g=null,h=null;if(c.is(".tool-lp-menu"))return"true"!=a.attr("aria-haspopup")?a:(h=a.children("ul").first(),g=h.children("li").first(),this.openSubMenu(h),g);if(b){var i=!1,j=f+1;for(j==e&&(j=0);j!=f;){var k=d.eq(j).html().charAt(0);if(k.toLowerCase()==b){i=!0;break}j+=1,j==e&&(j=0)}return i===!0?(g=d.eq(j),a.removeClass("menu-focus"),g):a}return g=e-1>f?d.eq(f+1):d.first(),a.removeClass("menu-focus"),g},e.prototype.moveUp=function(a){var b=a.parent(),c=b.children("li").not(".separator"),d=c.index(a),e=null;return b.is(".tool-lp-menu")?a:(e=d>0?c.eq(d-1):c.last(),a.removeClass("menu-focus"),e)},e.prototype.addAriaAttributes=function(){this.menuRoot.attr("role","menubar"),this.rootMenus.attr("role","menuitem"),this.rootMenus.attr("tabindex","0"),this.rootMenus.attr("aria-haspopup","true"),this.subMenus.attr("role","menu"),this.subMenus.attr("aria-hidden","true"),this.subMenuItems.attr("role","menuitem"),this.subMenuItems.attr("tabindex","-1"),this.menuRoot.addClass("tool-lp-menu"),this.allItems.addClass("tool-lp-menu-item"),this.rootMenus.addClass("tool-lp-root-menu"),this.subMenus.addClass("tool-lp-sub-menu")},{enhance:function(b,c){a(b).each(function(b,d){var f=a(d);f.data("menubarEnhanced")!==!0&&(new e(f,c),f.data("menubarEnhanced",!0))})},closeAll:d}});
- define('tool_lp/user_evidence_actions', ["jquery","core/templates","core/ajax","core/notification","core/str","tool_lp/menubar","tool_lp/competencypicker_user_plans"],function(a,b,c,d,e,f,g){var h=function(a){if(this._type=a,"evidence"===a)this._region='[data-region="user-evidence-page"]',this._evidenceNode='[data-region="user-evidence-page"]',this._template="tool_lp/user_evidence_page",this._contextMethod="tool_lp_data_for_user_evidence_page";else{if("list"!==a)throw new TypeError("Unexpected type.");this._region='[data-region="user-evidence-list"]',this._evidenceNode='[data-region="user-evidence-node"]',this._template="tool_lp/user_evidence_list_page",this._contextMethod="tool_lp_data_for_user_evidence_list_page"}};return h.prototype._contextMethod=null,h.prototype._evidenceNode=null,h.prototype._region=null,h.prototype._template=null,h.prototype._type=null,h.prototype._getContextArgs=function(a){var b=this,c={};return"evidence"===b._type?c={id:a.id}:"list"===b._type&&(c={userid:a.userid}),c},h.prototype._renderView=function(c){var e=this;b.render(e._template,c).done(function(c,d){b.replaceNode(a(e._region),c,d)}.bind(e)).fail(d.exception)},h.prototype._callAndRefresh=function(b,e){var f=this;return b.push({methodname:f._contextMethod,args:f._getContextArgs(e)}),a.when.apply(a.when,c.call(b)).then(function(){f._renderView.call(f,arguments[arguments.length-1])}).fail(d.exception)},h.prototype._doDelete=function(a){var b=this,c=[{methodname:"core_competency_delete_user_evidence",args:{id:a.id}}];b._callAndRefresh(c,a)},h.prototype.deleteEvidence=function(a){var b,f=this;b=c.call([{methodname:"core_competency_read_user_evidence",args:{id:a.id}}]),b[0].done(function(b){e.get_strings([{key:"confirm",component:"moodle"},{key:"deleteuserevidence",component:"tool_lp",param:b.name},{key:"delete",component:"moodle"},{key:"cancel",component:"moodle"}]).done(function(b){d.confirm(b[0],b[1],b[2],b[3],function(){f._doDelete(a)}.bind(f))}).fail(d.exception)}).fail(d.exception)},h.prototype._deleteEvidenceHandler=function(b){b.preventDefault();var c=this._findEvidenceData(a(b.target));this.deleteEvidence(c)},h.prototype._doCreateUserEvidenceCompetency=function(b,c){var d=this,e=[];a.each(c,function(a,c){e.push({methodname:"core_competency_create_user_evidence_competency",args:{userevidenceid:b.id,competencyid:c}})}),d._callAndRefresh(e,b)},h.prototype.createUserEvidenceCompetency=function(a){var b=this,c=new g(a.userid);c.on("save",function(c,d){var e=d.competencyIds;b._doCreateUserEvidenceCompetency(a,e,d.requestReview)}.bind(b)),c.display()},h.prototype._createUserEvidenceCompetencyHandler=function(b){b.preventDefault();var c=this._findEvidenceData(a(b.target));this.createUserEvidenceCompetency(c)},h.prototype._doDeleteUserEvidenceCompetency=function(a,b){var c=this,d=[];d.push({methodname:"core_competency_delete_user_evidence_competency",args:{userevidenceid:a.id,competencyid:b}}),c._callAndRefresh(d,a)},h.prototype.deleteUserEvidenceCompetency=function(a,b){this._doDeleteUserEvidenceCompetency(a,b)},h.prototype._deleteUserEvidenceCompetencyHandler=function(b){var c=this._findEvidenceData(a(b.currentTarget)),d=a(b.currentTarget).data("id");b.preventDefault(),this.deleteUserEvidenceCompetency(c,d)},h.prototype._doReviewUserEvidenceCompetencies=function(a){var b=this,c=[{methodname:"core_competency_request_review_of_user_evidence_linked_competencies",args:{id:a.id}}];b._callAndRefresh(c,a)},h.prototype.reviewUserEvidenceCompetencies=function(a){var b,f=this;b=c.call([{methodname:"core_competency_read_user_evidence",args:{id:a.id}}]),b[0].done(function(b){e.get_strings([{key:"confirm",component:"moodle"},{key:"sendallcompetenciestoreview",component:"tool_lp",param:b.name},{key:"confirm",component:"moodle"},{key:"cancel",component:"moodle"}]).done(function(b){d.confirm(b[0],b[1],b[2],b[3],function(){f._doReviewUserEvidenceCompetencies(a)}.bind(f))}).fail(d.exception)}).fail(d.exception)},h.prototype._reviewUserEvidenceCompetenciesHandler=function(b){b.preventDefault();var c=this._findEvidenceData(a(b.target));this.reviewUserEvidenceCompetencies(c)},h.prototype._findEvidenceData=function(b){var c,d=b.parentsUntil(a(this._region).parent(),this._evidenceNode);if(1!=d.length)throw new Error("The evidence node was not located.");if(c=d.data(),"undefined"==typeof c||"undefined"==typeof c.id)throw new Error("Evidence data could not be found.");return c},h.prototype.enhanceMenubar=function(a){var b=this;f.enhance(a,{'[data-action="user-evidence-delete"]':b._deleteEvidenceHandler.bind(b),'[data-action="link-competency"]':b._createUserEvidenceCompetencyHandler.bind(b),'[data-action="send-competencies-review"]':b._reviewUserEvidenceCompetenciesHandler.bind(b)})},h.prototype.registerEvents=function(){var b=a(this._region),c=this;b.find('[data-action="user-evidence-delete"]').click(c._deleteEvidenceHandler.bind(c)),b.find('[data-action="link-competency"]').click(c._createUserEvidenceCompetencyHandler.bind(c)),b.find('[data-action="delete-competency-link"]').click(c._deleteUserEvidenceCompetencyHandler.bind(c)),b.find('[data-action="send-competencies-review"]').click(c._reviewUserEvidenceCompetenciesHandler.bind(c))},h});
- define('tool_lp/competencydialogue', ["jquery","core/notification","core/ajax","core/templates","core/str","tool_lp/dialogue"],function(a,b,c,d,e,f){var g,h=function(){};return h.prototype.triggerCompetencyViewedEvent=function(a){c.call([{methodname:"core_competency_competency_viewed",args:{id:a}}])},h.prototype.showDialogue=function(a,c){var e=this.getCompetencyDataPromise(a,c),g=this;e.done(function(c){d.render("tool_lp/competency_summary",c).done(function(b){g.triggerCompetencyViewedEvent(a),new f(c.competency.shortname,b)}).fail(b.exception)}).fail(b.exception)},h.prototype.showDialogueFromData=function(a){var c=this;d.render("tool_lp/competency_summary",a).done(function(b){c.triggerCompetencyViewedEvent(a.id),new f(a.shortname,b,c.enhanceDialogue)}).fail(b.exception)},h.prototype.clickEventHandler=function(b){var c=b.data.compdialogue,d=a(b.currentTarget),e=d.data("id"),f=!d.data("excluderelated"),g=d.data("includecourses");c.showDialogue(e,{includerelated:f,includecourses:g}),b.preventDefault()},h.prototype.getCompetencyDataPromise=function(a,d){var e=c.call([{methodname:"tool_lp_data_for_competency_summary",args:{competencyid:a,includerelated:d.includerelated||!1,includecourses:d.includecourses||!1}}]);return e[0].then(function(a){return a}).fail(b.exception)},{init:function(){"undefined"==typeof g&&(g=new h,a("body").delegate('[data-action="competency-dialogue"]',"click",{compdialogue:g},g.clickEventHandler.bind(g)))}}});
- define('tool_lp/competencyactions', ["jquery","core/url","core/templates","core/notification","core/str","core/ajax","tool_lp/dragdrop-reorder","tool_lp/tree","tool_lp/dialogue","tool_lp/menubar","tool_lp/competencypicker","tool_lp/competency_outcomes","tool_lp/competencyruleconfig"],function(a,b,c,d,e,f,g,h,i,j,k,l,m){var n,o,p,q,r,s,t=null,u=null,v=null,w=null,x=function(){var c=a('[data-region="competencyactions"]').data("competency"),f={competencyframeworkid:t.getCompetencyFrameworkId(),pagecontextid:n};null!==c&&(f.parentid=c.id);var g=function(){var c=a.param(f);window.location=b.relativeUrl("/admin/tool/lp/editcompetency.php?"+c)};null!==c&&t.hasRule(c.id)?e.get_strings([{key:"confirm",component:"moodle"},{key:"addingcompetencywillresetparentrule",component:"tool_lp",param:c.shortname},{key:"yes",component:"core"},{key:"no",component:"core"}]).done(function(a){d.confirm(a[0],a[1],a[2],a[3],g)}).fail(d.exception):g()},y=function(){var b=a('[data-region="filtercompetencies"]').data("frameworkid"),c=f.call([{methodname:"core_competency_set_parent_competency",args:{competencyid:u,parentid:v}},{methodname:"tool_lp_data_for_competencies_manage_page",args:{competencyframeworkid:b,search:a('[data-region="filtercompetencies"] input').val()}}]);c[1].done(E).fail(d.exception)},z=function(){if(v="undefined"==typeof v?0:v,v!=u){var a=t.getCompetency(v)||{},b=t.getCompetency(u)||{},c="movecompetencywillresetrules",f=!1;b.parentid!=v&&(a.path&&a.path.indexOf("/"+b.id+"/")>=0&&(c="movecompetencytochildofselfwillresetrules",f=f||t.hasRule(b.id)),f=f||t.hasRule(a.id)||t.hasRule(b.parentid),f?e.get_strings([{key:"confirm",component:"moodle"},{key:c,component:"tool_lp"},{key:"yes",component:"moodle"},{key:"no",component:"moodle"}]).done(function(a){d.confirm(a[0],a[1],a[2],a[3],y)}).fail(d.exception):y())}},A=function(b){var c=a(b.getContent()),d=c.find("[data-enhance=movetree]"),e=new h(d,!1);e.on("selectionchanged",function(b,c){var d=c.selected;v=a(d).data("id")}),d.show(),c.on("click",'[data-action="move"]',function(){b.close(),z()}),c.on("click",'[data-action="cancel"]',function(){b.close()})},B=function(a,b){var c;for(c=0;c<b.length;c++)b[c].parentid==a.id&&(a.haschildren=!0,b[c].children=[],b[c].haschildren=!1,a.children[a.children.length]=b[c],B(b[c],b))},C=function(b){b.preventDefault();var g=a('[data-region="competencyactions"]').data("competency");u=g.id;var h=f.call([{methodname:"core_competency_search_competencies",args:{competencyframeworkid:g.competencyframeworkid,searchtext:""}},{methodname:"core_competency_read_competency_framework",args:{id:g.competencyframeworkid}}]);a.when.apply(null,h).done(function(a,b){var f,h=[];for(f=0;f<a.length;f++){var j=a[f];"0"==j.parentid&&(j.children=[],j.haschildren=0,h[h.length]=j,B(j,a))}e.get_strings([{key:"movecompetency",component:"tool_lp",param:g.shortname},{key:"move",component:"tool_lp"},{key:"cancel",component:"moodle"}]).done(function(a){var e={framework:b,competencies:h};c.render("tool_lp/competencies_move_tree",e).done(function(b){new i(a[0],b,A)}).fail(d.exception)}).fail(d.exception)}).fail(d.exception)},D=function(){var c=a('[data-region="competencyactions"]').data("competency"),d={competencyframeworkid:t.getCompetencyFrameworkId(),id:c.id,parentid:c.parentid,pagecontextid:n},e=a.param(d);window.location=b.relativeUrl("/admin/tool/lp/editcompetency.php?"+e)},E=function(b){c.render("tool_lp/manage_competencies_page",b).done(function(b,d){a('[data-region="managecompetencies"]').replaceWith(b),c.runTemplateJS(d)}).fail(d.exception)},F=function(b){b.preventDefault();var c=a('[data-region="filtercompetencies"]').data("frameworkid"),e=f.call([{methodname:"tool_lp_data_for_competencies_manage_page",args:{competencyframeworkid:c,search:a('[data-region="filtercompetencies"] input').val()}}]);e[0].done(E).fail(d.exception)},G=function(){var b=a('[data-region="competencyactions"]').data("competency"),c=f.call([{methodname:"core_competency_move_up_competency",args:{id:b.id}},{methodname:"tool_lp_data_for_competencies_manage_page",args:{competencyframeworkid:b.competencyframeworkid,search:a('[data-region="filtercompetencies"] input').val()}}]);c[1].done(E).fail(d.exception)},H=function(){var b=a('[data-region="competencyactions"]').data("competency"),c=f.call([{methodname:"core_competency_move_down_competency",args:{id:b.id}},{methodname:"tool_lp_data_for_competencies_manage_page",args:{competencyframeworkid:b.competencyframeworkid,search:a('[data-region="filtercompetencies"] input').val()}}]);c[1].done(E).fail(d.exception)},I=function(){var b=a('[data-region="competencyactions"]').data("competency"),g=f.call([{methodname:"tool_lp_list_courses_using_competency",args:{id:b.id}}]);g[0].done(function(a){var b={courses:a};c.render("tool_lp/linked_courses_summary",b).done(function(a){e.get_string("linkedcourses","tool_lp").done(function(b){new i(b,a,A)}).fail(d.exception)}).fail(d.exception)}).fail(d.exception)},J=function(){q=a('[data-region="competencyactions"]').data("competency"),o||(o=new k(n,q.competencyframeworkid),o.on("save",function(b,e){var g=e.competencyIds,h=[];a.each(g,function(a,b){h.push({methodname:"core_competency_add_related_competency",args:{competencyid:b,relatedcompetencyid:q.id}})}),h.push({methodname:"tool_lp_data_for_related_competencies_section",args:{competencyid:q.id}});var i=f.call(h);i[h.length-1].then(function(b){return c.render("tool_lp/related_competencies",b).done(function(b,d){a('[data-region="relatedcompetencies"]').replaceWith(b),c.runTemplateJS(d),U()})},d.exception)})),o.setDisallowedCompetencyIDs([q.id]),o.display()},K=function(b){b.preventDefault(),q=a('[data-region="competencyactions"]').data("competency"),p.setTargetCompetencyId(q.id),p.display()},L=function(a,b){var c={id:q.id,shortname:q.shortname,idnumber:q.idnumber,description:q.description,descriptionformat:q.descriptionformat,ruletype:b.ruletype,ruleoutcome:b.ruleoutcome,ruleconfig:b.ruleconfig},e=f.call([{methodname:"core_competency_update_competency",args:{competency:c}}]);e[0].then(function(a){a&&(q.ruletype=b.ruletype,q.ruleoutcome=b.ruleoutcome,q.ruleconfig=b.ruleconfig,X(q))},d.exception)},M=function(){var b=a('[data-region="competencyactions"]').data("competency"),c=f.call([{methodname:"core_competency_delete_competency",args:{id:b.id}},{methodname:"tool_lp_data_for_competencies_manage_page",args:{competencyframeworkid:b.competencyframeworkid,search:a('[data-region="filtercompetencies"] input').val()}}]);c[0].done(function(a){a===!1&&e.get_strings([{key:"competencycannotbedeleted",component:"tool_lp",param:b.shortname},{key:"cancel",component:"moodle"}]).done(function(a){d.alert(null,a[0])}).fail(d.exception)}).fail(d.exception),c[1].done(E).fail(d.exception)},N=function(){var b=a('[data-region="competencyactions"]').data("competency"),c="deletecompetency";t.hasRule(b.parentid)&&(c="deletecompetencyparenthasrule"),e.get_strings([{key:"confirm",component:"moodle"},{key:c,component:"tool_lp",param:b.shortname},{key:"delete",component:"moodle"},{key:"cancel",component:"moodle"}]).done(function(a){d.confirm(a[0],a[1],a[2],a[3],M)}).fail(d.exception)},O=function(b){b.originalEvent.dataTransfer.setData("text",a(b.target).parent().data("id"))},P=function(a){a.originalEvent.dataTransfer.dropEffect="move",a.preventDefault()},Q=function(b){b.preventDefault(),a(this).addClass("currentdragtarget")},R=function(b){b.preventDefault(),a(this).removeClass("currentdragtarget")},S=function(b){b.preventDefault(),u=b.originalEvent.dataTransfer.getData("text"),v=a(b.target).parent().data("id"),a(this).removeClass("currentdragtarget"),z()},T=function(b){b.preventDefault();var e=this.id.substr(11),g=a('[data-region="competencyactions"]').data("competency"),h=f.call([{methodname:"core_competency_remove_related_competency",args:{relatedcompetencyid:e,competencyid:g.id}},{methodname:"tool_lp_data_for_related_competencies_section",args:{competencyid:g.id}}]);h[1].done(function(b){c.render("tool_lp/related_competencies",b).done(function(b){a('[data-region="relatedcompetencies"]').replaceWith(b),U()}.bind(this)).fail(d.exception)}.bind(this)).fail(d.exception)},U=function(){a('[data-action="deleterelation"]').on("click",T)},V=function(a){a.id!==w&&(w=a.id,f.call([{methodname:"core_competency_competency_viewed",args:{id:a.id}}]))},W=function(a){var b=r[a];return b||(b="competency"),b},X=function(b){var e=a.Deferred().resolve().promise(),g={};g.competency=b,g.showdeleterelatedaction=!0,g.showrelatedcompetencies=!0,g.showrule=!1,b.ruleoutcome!=l.NONE&&(e=l.getString(b.ruleoutcome).then(function(c){var d;return a.each(s,function(a,c){c.type==b.ruletype&&(d=c.name)}),[c,d]})),e.then(function(a){"undefined"!=typeof a&&(g.showrule=!0,g.rule={outcome:a[0],type:a[1]})}).then(function(){return c.render("tool_lp/competency_summary",g).then(function(b){a('[data-region="competencyinfo"]').html(b),a('[data-action="deleterelation"]').on("click",T)})}).then(function(){return c.render("tool_lp/loading",{})}).then(function(a,b){c.replaceNodeContents('[data-region="relatedcompetencies"]',a,b)}).done(function(){f.call([{methodname:"tool_lp_data_for_related_competencies_section",args:{competencyid:b.id},done:function(b){return c.render("tool_lp/related_competencies",b).done(function(b,d){a('[data-region="relatedcompetencies"]').replaceWith(b),c.runTemplateJS(d),U()})}}])}).fail(d.exception)},Y=function(a){return e.get_string("taxonomy_add_"+W(a),"tool_lp")},Z=function(a){return e.get_string("taxonomy_selected_"+W(a),"tool_lp")},$=function(b,c){var d=c.selected,e=a(d).data("id"),f=a('[data-region="competencyactions"] [data-action="add"]'),g=a('[data-region="competencyactionsmenu"]'),h=a('[data-region="selected-competency"]'),i=0,k=1;if(j.closeAll(),"undefined"==typeof e)a('[data-region="competencyinfo"]').html(d.clone().children().remove().end().text()),a('[data-region="competencyactions"]').data("competency",null),g.hide();else{var l=t.getCompetency(e);i=t.getCompetencyLevel(e),k=i+1,g.show(),a('[data-region="competencyactions"]').data("competency",l),X(l),V(l)}return Z(i).then(function(a){h.text(a)}),Y(k).then(function(a){f.show().find('[data-region="term"]').text(a)}),b.preventDefault(),!1},_=function(a){var b=a.split(",");return b.unshift(""),delete b[0],b};return{init:function(b,c,d,e){t=b,n=c,r=_(d),s=e,a('[data-region="competencyactions"] [data-action="add"]').on("click",x),j.enhance(".competencyactionsmenu",{'[data-action="edit"]':D,'[data-action="delete"]':N,'[data-action="move"]':C,'[data-action="moveup"]':G,'[data-action="movedown"]':H,'[data-action="linkedcourses"]':I,'[data-action="relatedcompetencies"]':J.bind(this),'[data-action="competencyrules"]':K.bind(this)}),a('[data-region="competencyactionsmenu"]').hide(),a('[data-region="competencyactions"] [data-action="add"]').hide(),a('[data-region="filtercompetencies"]').on("submit",F);var f=a('[data-region="managecompetencies"] [data-enhance="tree"]');f.on("dragstart","li>span",O).on("dragover","li>span",P).on("dragenter","li>span",Q).on("dragleave","li>span",R).on("drop","li>span",S),b.on("selectionchanged",$),p=new m(t,s),p.on("save",L.bind(this))}}});
- define('tool_lp/scalevalues', ["jquery","core/ajax"],function(a,b){var c=[];return{get_values:function(d){var e=a.Deferred();return"undefined"==typeof c[d]?b.call([{methodname:"core_competency_get_scale_values",args:{scaleid:d},done:function(a){c[d]=a,e.resolve(a)},fail:e.reject}]):e.resolve(c[d]),e.promise()}}});
- define('tool_lp/frameworkactions', ["jquery","core/templates","core/ajax","core/notification","core/str"],function(a,b,c,d,e){var f=0,g=0,h=function(c,d){a('[data-region="managecompetencies"]').replaceWith(c),b.runTemplateJS(d)},i=function(a){b.render("tool_lp/manage_competency_frameworks_page",a).done(h).fail(d.exception)},j=function(b){b.preventDefault(),g=a(this).attr("data-frameworkid");var e=c.call([{methodname:"core_competency_duplicate_competency_framework",args:{id:g}},{methodname:"tool_lp_data_for_competency_frameworks_manage_page",args:{pagecontext:{contextid:f}}}]);e[1].done(i).fail(d.exception)},k=function(){var a=c.call([{methodname:"core_competency_delete_competency_framework",args:{id:g}},{methodname:"tool_lp_data_for_competency_frameworks_manage_page",args:{pagecontext:{contextid:f}}}]);a[0].done(function(a){if(a===!1){var b=c.call([{methodname:"core_competency_read_competency_framework",args:{id:g}}]);b[0].done(function(a){e.get_strings([{key:"frameworkcannotbedeleted",component:"tool_lp",param:a.shortname},{key:"cancel",component:"moodle"}]).done(function(a){d.alert(null,a[0])}).fail(d.exception)})}}).fail(d.exception),a[1].done(i).fail(d.exception)},l=function(b){b.preventDefault();var f=a(this).attr("data-frameworkid");g=f;var h=c.call([{methodname:"core_competency_read_competency_framework",args:{id:g}}]);h[0].done(function(a){e.get_strings([{key:"confirm",component:"moodle"},{key:"deletecompetencyframework",component:"tool_lp",param:a.shortname},{key:"delete",component:"moodle"},{key:"cancel",component:"moodle"}]).done(function(a){d.confirm(a[0],a[1],a[2],a[3],k)}).fail(d.exception)}).fail(d.exception)};return{deleteHandler:l,duplicateHandler:j,init:function(a){f=a}}});
- define('tool_lp/actionselector', ["jquery","core/notification","core/ajax","core/templates","tool_lp/dialogue","tool_lp/event_base"],function(a,b,c,d,e,f){var g=function(a,b,c,d,e){var g=this;f.prototype.constructor.apply(this,[]),g._title=a,g._message=b,g._actions=c,g._confirm=d,g._cancel=e,g._selectedValue=null,g._reset()};return g.prototype=Object.create(f.prototype),g.prototype._selectedValue=null,g.prototype._popup=null,g.prototype._title=null,g.prototype._message=null,g.prototype._actions=null,g.prototype._confirm=null,g.prototype._cancel=null,g.prototype._afterRender=function(){var b=this;b._find('[data-action="action-selector-confirm"]').attr("disabled","disabled"),b._find('[data-region="action-selector-radio-buttons"]').change(function(){b._selectedValue=a("input[type='radio']:checked").val(),b._find('[data-action="action-selector-confirm"]').removeAttr("disabled"),b._refresh.bind(b)}.bind(b)),b._find('[data-action="action-selector-cancel"]').click(function(a){a.preventDefault(),b.close()}.bind(b)),b._find('[data-action="action-selector-confirm"]').click(function(a){a.preventDefault(),b._selectedValue.length&&(b._trigger("save",{action:b._selectedValue}),b.close())}.bind(b))},g.prototype.close=function(){var a=this;a._popup.close(),a._reset()},g.prototype.display=function(){var a=this;return a._render().then(function(b){a._popup=new e(a._title,b,a._afterRender.bind(a))}.bind(a)).fail(b.exception)},g.prototype._find=function(b){return a(this._popup.getContent()).find(b)},g.prototype._refresh=function(){var a=this;return a._render().then(function(b){a._find('[data-region="action-selector"]').replaceWith(b),a._afterRender()}.bind(a))},g.prototype._render=function(){var a=this,b=[];for(var c in a._actions)b.push(a._actions[c]);var e={message:a._message,choices:b,confirm:a._confirm,cancel:a._cancel};return d.render("tool_lp/action_selector",e)},g.prototype._reset=function(){this._popup=null,this._selectedValue=""},g});
- define('tool_lp/form-cohort-selector', ["jquery","core/ajax","core/templates"],function(a,b,c){return{processResults:function(b,c){var d=[];return a.each(c,function(a,b){d.push({value:b.id,label:b._label})}),d},transport:function(d,e,f,g){var h,i=parseInt(a(d).data("contextid"),10),j=a(d).data("includes");h=b.call([{methodname:"tool_lp_search_cohorts",args:{query:e,context:{contextid:i},includes:j}}]),h[0].then(function(b){var d=[],e=0;return a.each(b.cohorts,function(a,b){d.push(c.render("tool_lp/form-cohort-selector-suggestion",b))}),a.when.apply(a.when,d).then(function(){var c=arguments;a.each(b.cohorts,function(a,b){b._label=c[e],e++}),f(b.cohorts)})},g)}}});
- define('tool_lp/user_competency_info', ["jquery","core/notification","core/ajax","core/templates"],function(a,b,c,d){var e=function(a,b,c,d,e,f){this._rootElement=a,this._competencyId=b,this._userId=c,this._planId=d,this._courseId=e,this._valid=!0,this._displayuser="undefined"!=typeof f?f:!1,this._planId?(this._methodName="tool_lp_data_for_user_competency_summary_in_plan",this._args={competencyid:this._competencyId,planid:this._planId},this._templateName="tool_lp/user_competency_summary_in_plan"):this._courseId?(this._methodName="tool_lp_data_for_user_competency_summary_in_course",this._args={userid:this._userId,competencyid:this._competencyId,courseid:this._courseId},this._templateName="tool_lp/user_competency_summary_in_course"):(this._methodName="tool_lp_data_for_user_competency_summary",this._args={userid:this._userId,competencyid:this._competencyId},this._templateName="tool_lp/user_competency_summary")};return e.prototype.reload=function(){var a=this,e=[];this._valid&&(e=c.call([{methodname:this._methodName,args:this._args}]),e[0].done(function(c){a._displayuser&&(c.displayuser=!0),d.render(a._templateName,c).done(function(b,c){d.replaceNode(a._rootElement,b,c)}).fail(b.exception)}).fail(b.exception))},e.prototype._rootElement=null,e.prototype._courseId=null,e.prototype._valid=null,e.prototype._planId=null,e.prototype._competencyId=null,e.prototype._userId=null,e.prototype._methodName=null,e.prototype._args=null,e.prototype._templateName=null,e.prototype._displayuser=!1,e});
- define('tool_lp/user_competency_course_navigation', ["jquery"],function(a){var b=function(b,c,d,e,f,g){this._baseUrl=d,this._userId=e+"",this._competencyId=f+"",this._courseId=g,a(b).on("change",this._userChanged.bind(this)),a(c).on("change",this._competencyChanged.bind(this))};return b.prototype._userChanged=function(b){var c=a(b.target).val(),d="?userid="+c+"&courseid="+this._courseId+"&competencyid="+this._competencyId;document.location=this._baseUrl+d},b.prototype._competencyChanged=function(b){var c=a(b.target).val(),d="?userid="+this._userId+"&courseid="+this._courseId+"&competencyid="+c;document.location=this._baseUrl+d},b.prototype._competencyId=null,b.prototype._userId=null,b.prototype._courseId=null,b.prototype._baseUrl=null,b.prototype._ignoreFirstCompetency=null,b});
- define('tool_lp/competencypicker', ["jquery","core/notification","core/ajax","core/templates","tool_lp/dialogue","core/str","tool_lp/tree"],function(a,b,c,d,e,f,g){var h=function(b,c,d,e){var f=this;f._eventNode=a("<div></div>"),f._frameworks=[],f._reset(),f._pageContextId=b,f._pageContextIncludes=d||"children",f._multiSelect="undefined"==typeof e||e===!0,c&&(f._frameworkId=c,f._singleFramework=!0)};return h.prototype._competencies=null,h.prototype._disallowedCompetencyIDs=null,h.prototype._eventNode=null,h.prototype._frameworks=null,h.prototype._frameworkId=null,h.prototype._pageContextId=null,h.prototype._pageContextIncludes=null,h.prototype._popup=null,h.prototype._searchText="",h.prototype._selectedCompetencies=null,h.prototype._singleFramework=!1,h.prototype._multiSelect=!0,h.prototype._onlyVisible=!0,h.prototype._afterRender=function(){var b=this,c=new g(b._find("[data-enhance=linktree]"),b._multiSelect);b._find("[data-enhance=linktree]").show(),c.on("selectionchanged",function(c,d){var e=d.selected;c.preventDefault();var f=[];a.each(e,function(c,d){var e=a(d).data("id"),g=!0;"undefined"==typeof e?g=!1:a.each(b._disallowedCompetencyIDs,function(a,b){b==e&&(g=!1)}),g&&f.push(e)}.bind(b)),b._selectedCompetencies=f,b._selectedCompetencies.length?b._find('[data-region="competencylinktree"] [data-action="add"]').removeAttr("disabled"):b._find('[data-region="competencylinktree"] [data-action="add"]').attr("disabled","disabled")}.bind(b)),b._singleFramework||b._find('[data-action="chooseframework"]').change(function(c){b._frameworkId=a(c.target).val(),b._loadCompetencies().then(b._refresh.bind(b))}.bind(b)),b._find('[data-region="filtercompetencies"] button').click(function(c){return c.preventDefault(),a(c.target).attr("disabled","disabled"),b._searchText=b._find('[data-region="filtercompetencies"] input').val()||"",b._refresh().always(function(){a(c.target).removeAttr("disabled")})}.bind(b)),b._find('[data-region="competencylinktree"] [data-action="cancel"]').click(function(a){a.preventDefault(),b.close()}.bind(b)),b._find('[data-region="competencylinktree"] [data-action="add"]').click(function(a){a.preventDefault(),b._selectedCompetencies.length&&(b._multiSelect?b._trigger("save",{competencyIds:b._selectedCompetencies}):b._trigger("save",{competencyId:b._selectedCompetencies[0]}),b.close())}.bind(b));var d=b._selectedCompetencies.slice(0);a.each(d,function(a,d){var e=b._find("[data-id="+d+"]");e.length&&(c.toggleItem(e),c.updateFocus(e))}.bind(b))},h.prototype.close=function(){var a=this;a._popup.close(),a._reset()},h.prototype.display=function(){var a=this;return a._render().then(function(b){return f.get_string("competencypicker","tool_lp").then(function(c){a._popup=new e(c,b,a._afterRender.bind(a))}.bind(a))}.bind(a)).fail(b.exception)},h.prototype._fetchCompetencies=function(a,d){var e=this;return c.call([{methodname:"core_competency_search_competencies",args:{searchtext:d,competencyframeworkid:a}}])[0].done(function(a){function b(a,c){for(var d=0;d<c.length;d++)c[d].parentid==a.id&&(a.haschildren=!0,c[d].children=[],c[d].haschildren=!1,a.children[a.children.length]=c[d],b(c[d],c))}var c,d,f=[];for(c=0;c<a.length;c++)d=a[c],"0"==d.parentid&&(d.children=[],d.haschildren=0,f[f.length]=d,b(d,a));e._competencies=f}.bind(e)).fail(b.exception)},h.prototype._find=function(b){return a(this._popup.getContent()).find(b)},h.prototype._getFramework=function(b){var c;return a.each(this._frameworks,function(a,d){return d.id==b?(c=d,!1):void 0}),c},h.prototype._loadCompetencies=function(){return this._fetchCompetencies(this._frameworkId,this._searchText)},h.prototype._loadFrameworks=function(){var d,e=this;return e._frameworks.length>0?a.when():(d=e._singleFramework?c.call([{methodname:"core_competency_read_competency_framework",args:{id:this._frameworkId}}])[0].then(function(a){return[a]}):c.call([{methodname:"core_competency_list_competency_frameworks",args:{sort:"shortname",context:{contextid:e._pageContextId},includes:e._pageContextIncludes,onlyvisible:e._onlyVisible}}])[0],d.done(function(a){e._frameworks=a}).fail(b.exception))},h.prototype.on=function(a,b){this._eventNode.on(a,b)},h.prototype._preRender=function(){var b=this;return b._loadFrameworks().then(function(){return!b._frameworkId&&b._frameworks.length>0&&(b._frameworkId=b._frameworks[0].id),b._frameworkId?b._loadCompetencies():(b._frameworks=[],a.when())}.bind(b))},h.prototype._refresh=function(){var a=this;return a._render().then(function(b){a._find('[data-region="competencylinktree"]').replaceWith(b),a._afterRender()}.bind(a))},h.prototype._render=function(){var b=this;return b._preRender().then(function(){b._singleFramework||a.each(b._frameworks,function(a,c){c.id==b._frameworkId?c.selected=!0:c.selected=!1});var c={competencies:b._competencies,framework:b._getFramework(b._frameworkId),frameworks:b._frameworks,search:b._searchText,singleFramework:b._singleFramework};return d.render("tool_lp/competency_picker",c)}.bind(b))},h.prototype._reset=function(){this._competencies=[],this._disallowedCompetencyIDs=[],this._popup=null,this._searchText="",this._selectedCompetencies=[]},h.prototype.setDisallowedCompetencyIDs=function(a){this._disallowedCompetencyIDs=a},h.prototype._trigger=function(a,b){this._eventNode.trigger(a,[b])},h});
- define('tool_lp/tree', ["jquery","core/url","core/log"],function(a,b,c){var d=a('<img alt="" src="'+b.imageUrl("t/expanded")+'"/>'),e=a('<img alt="" src="'+b.imageUrl("t/collapsed")+'"/>'),f=function(b,c){this.treeRoot=a(b),this.multiSelect="undefined"==typeof c||c===!0,this.items=this.treeRoot.find("li"),this.expandAll=this.items.length<20,this.parents=this.treeRoot.find("li:has(ul)"),c&&this.treeRoot.attr("aria-multiselectable","true"),this.items.attr("aria-selected","false"),this.visibleItems=null,this.activeItem=null,this.lastActiveItem=null,this.keys={tab:9,enter:13,space:32,pageup:33,pagedown:34,end:35,home:36,left:37,up:38,right:39,down:40,eight:56,asterisk:106},this.init(),this.bindEventHandlers()};return f.prototype.init=function(){this.parents.attr("aria-expanded","true"),this.parents.prepend(d.clone()),this.items.attr("role","tree-item"),this.items.attr("tabindex","-1"),this.parents.attr("role","group"),this.treeRoot.attr("role","tree"),this.visibleItems=this.treeRoot.find("li");var b=this;this.expandAll||(this.parents.each(function(){b.collapseGroup(a(this))}),this.expandGroup(this.parents.first()))},f.prototype.expandGroup=function(a){var b=a.children("ul");b.show().attr("aria-hidden","false"),a.attr("aria-expanded","true"),a.children("img").attr("src",d.attr("src")),this.visibleItems=this.treeRoot.find("li:visible")},f.prototype.collapseGroup=function(a){var b=a.children("ul");b.hide().attr("aria-hidden","true"),a.attr("aria-expanded","false"),a.children("img").attr("src",e.attr("src")),this.visibleItems=this.treeRoot.find("li:visible")},f.prototype.toggleGroup=function(a){"true"==a.attr("aria-expanded")?this.collapseGroup(a):this.expandGroup(a)},f.prototype.triggerChange=function(){var a=this.items.filter("[aria-selected=true]");this.multiSelect||(a=a.first()),this.treeRoot.trigger("selectionchanged",{selected:a})},f.prototype.multiSelectItem=function(b){if(this.multiSelect){if(null!==this.lastActiveItem){for(var c=this.visibleItems.index(this.lastActiveItem),d=this.visibleItems.index(this.activeItem),e=null;d>c;)e=a(this.visibleItems.get(c)),e.attr("aria-selected","true"),c++;for(;c>d;)e=a(this.visibleItems.get(c)),e.attr("aria-selected","true"),c--}}else this.items.attr("aria-selected","false");b.attr("aria-selected","true"),this.triggerChange()},f.prototype.selectItem=function(a){for(var b=a.parent();"tree"!=b.attr("role");)b=b.parent(),"false"==b.attr("aria-expanded")&&this.expandGroup(b),b=b.parent();this.items.attr("aria-selected","false"),a.attr("aria-selected","true"),this.triggerChange()},f.prototype.toggleItem=function(a){if(!this.multiSelect)return this.selectItem(a);var b=a.attr("aria-selected");b="true"===b?"false":"true",a.attr("aria-selected",b),this.triggerChange()},f.prototype.updateFocus=function(a){this.lastActiveItem=this.activeItem,this.activeItem=a;for(var b=a.parent();"tree"!=b.attr("role");)b=b.parent(),"false"==b.attr("aria-expanded")&&this.expandGroup(b),b=b.parent();this.items.attr("tabindex","-1"),a.attr("tabindex",0)},f.prototype.handleKeyDown=function(b,c){var d=this.visibleItems.index(b),e=null,f=c.shiftKey||c.ctrlKey||c.metaKey||c.altKey,g=this;switch(c.keyCode){case this.keys.home:return e=this.parents.first(),e.focus(),c.shiftKey?this.multiSelectItem(e):f||this.selectItem(e),c.stopPropagation(),!1;case this.keys.end:return e=this.visibleItems.last(),e.focus(),c.shiftKey?this.multiSelectItem(e):f||this.selectItem(e),c.stopPropagation(),!1;case this.keys.enter:case this.keys.space:return c.shiftKey?this.multiSelectItem(b):c.metaKey||c.ctrlKey?this.toggleItem(b):this.selectItem(b),c.stopPropagation(),!1;case this.keys.left:if(b.has("ul")&&"true"==b.attr("aria-expanded"))this.collapseGroup(b);else{var h=b.parent(),i=h.parent();i.is("li")&&(i.focus(),c.shiftKey?this.multiSelectItem(i):f||this.selectItem(i))}return c.stopPropagation(),!1;case this.keys.right:return b.has("ul")&&"false"==b.attr("aria-expanded")?this.expandGroup(b):(e=b.children("ul").children("li").first(),e.length>0&&(e.focus(),c.shiftKey?this.multiSelectItem(e):f||this.selectItem(e))),c.stopPropagation(),!1;case this.keys.up:if(d>0){var j=this.visibleItems.eq(d-1);j.focus(),c.shiftKey?this.multiSelectItem(j):f||this.selectItem(j)}return c.stopPropagation(),!1;case this.keys.down:if(d<this.visibleItems.length-1){var k=this.visibleItems.eq(d+1);k.focus(),c.shiftKey?this.multiSelectItem(k):f||this.selectItem(k)}return c.stopPropagation(),!1;case this.keys.asterisk:return this.parents.each(function(){g.expandGroup(a(this))}),c.stopPropagation(),!1;case this.keys.eight:return c.shiftKey&&(this.parents.each(function(){g.expandGroup(a(this))}),c.stopPropagation()),!1}return!0},f.prototype.handleKeyPress=function(a,b){if(b.altKey||b.ctrlKey||b.shiftKey||b.metaKey)return!0;switch(b.keyCode){case this.keys.tab:return!0;case this.keys.enter:case this.keys.home:case this.keys.end:case this.keys.left:case this.keys.right:case this.keys.up:case this.keys.down:return b.stopPropagation(),!1;default:var c=String.fromCharCode(b.which),d=!1,e=this.visibleItems.index(a),f=this.visibleItems.length,g=e+1;for(g==f&&(g=0);g!=e;){var h=this.visibleItems.eq(g),i=h.text().charAt(0);if(h.has("ul")&&(i=h.find("span").text().charAt(0)),i.toLowerCase()==c){d=!0;break}g+=1,g==f&&(g=0)}return d===!0&&this.updateFocus(this.visibleItems.eq(g)),b.stopPropagation(),!1}return!0},f.prototype.on=function(a,b){"selectionchanged"!==a?c.warning('Invalid custom event name for tree. Only "selectionchanged" is supported.'):this.treeRoot.on(a,b)},f.prototype.handleDblClick=function(a,b){return b.altKey||b.ctrlKey||b.shiftKey||b.metaKey?!0:(this.updateFocus(a),this.toggleGroup(a),b.stopPropagation(),!1)},f.prototype.handleExpandCollapseClick=function(a,b){return this.toggleGroup(a),b.stopPropagation(),!1},f.prototype.handleClick=function(a,b){return b.shiftKey?this.multiSelectItem(a):b.metaKey||b.ctrlKey?this.toggleItem(a):this.selectItem(a),this.updateFocus(a),b.stopPropagation(),!1},f.prototype.handleBlur=function(){return!0},f.prototype.handleFocus=function(a){return this.updateFocus(a),!0},f.prototype.bindEventHandlers=function(){var b=this;this.parents.dblclick(function(c){return b.handleDblClick(a(this),c)}),this.items.click(function(c){return b.handleClick(a(this),c)}),this.items.children("img").click(function(c){return b.handleExpandCollapseClick(a(this).parent(),c)}),this.items.keydown(function(c){return b.handleKeyDown(a(this),c)}),this.items.keypress(function(c){return b.handleKeyPress(a(this),c)}),this.items.focus(function(c){return b.handleFocus(a(this),c)}),this.items.blur(function(c){return b.handleBlur(a(this),c)})},f});
- define('tool_lp/competency_outcomes', ["jquery","core/str"],function(a,b){var c=0,d=1,e=2,f=3;return{NONE:c,EVIDENCE:d,COMPLETE:e,RECOMMEND:f,getAll:function(){var a=this;return b.get_strings([{key:"competencyoutcome_none",component:"tool_lp"},{key:"competencyoutcome_evidence",component:"tool_lp"},{key:"competencyoutcome_recommend",component:"tool_lp"},{key:"competencyoutcome_complete",component:"tool_lp"}]).then(function(b){var c={};return c[a.NONE]={code:a.NONE,name:b[0]},c[a.EVIDENCE]={code:a.EVIDENCE,name:b[1]},c[a.RECOMMEND]={code:a.RECOMMEND,name:b[2]},c[a.COMPLETE]={code:a.COMPLETE,name:b[3]},c})},getString:function(b){var c=this,d=c.getAll();return d.then(function(c){return"undefined"==typeof c[b]?a.Deferred().reject().promise():c[b].name})}}});
- define('tool_lp/user_competency_plan_popup', ["jquery","core/notification","core/str","core/ajax","core/templates","tool_lp/dialogue"],function(a,b,c,d,e,f){var g=function(b,c,d){this._regionSelector=b,this._userCompetencySelector=c,this._planId=d,a(this._regionSelector).on("click",this._userCompetencySelector,this._handleClick.bind(this))};return g.prototype._handleClick=function(c){c.preventDefault();var e=a(c.target).closest("tr"),f=a(e).data("competencyid"),g=a(e).data("userid"),h=this._planId,i=d.call([{methodname:"tool_lp_data_for_user_competency_summary_in_plan",args:{competencyid:f,planid:h},done:this._contextLoaded.bind(this),fail:b.exception}]);i[0].then(function(a){var c="core_competency_user_competency_viewed_in_plan";a.plan.iscompleted&&(c="core_competency_user_competency_plan_viewed"),d.call([{methodname:c,args:{competencyid:f,userid:g,planid:h},fail:b.exception}])})},g.prototype._contextLoaded=function(a){var d=this;e.render("tool_lp/user_competency_summary_in_plan",a).done(function(a,g){c.get_string("usercompetencysummary","report_competency").done(function(b){new f(b,a,e.runTemplateJS.bind(e,g),d._refresh.bind(d),!0)}).fail(b.exception)}).fail(b.exception)},g.prototype._refresh=function(){var a=this._planId;d.call([{methodname:"tool_lp_data_for_plan_page",args:{planid:a},done:this._pageContextLoaded.bind(this),fail:b.exception}])},g.prototype._pageContextLoaded=function(a){var c=this;e.render("tool_lp/plan_page",a).done(function(a,b){e.replaceNode(c._regionSelector,a,b)}).fail(b.exception)},g.prototype._regionSelector=null,g.prototype._userCompetencySelector=null,g.prototype._planId=null,g});
- define('tool_lp/dialogue', ["core/yui"],function(a){var b=function(b,c,d,e,f){this.yuiDialogue=null;var g=this;"undefined"==typeof f&&(f=!1),a.use("moodle-core-notification","timers",function(){var h="480px";f&&(h="800px"),g.yuiDialogue=new M.core.dialogue({headerContent:b,bodyContent:c,draggable:!0,visible:!1,center:!0,modal:!0,width:h}),g.yuiDialogue.after("visibleChange",function(b){b.newVal?"undefined"!=typeof d&&a.soon(function(){d(g),g.yuiDialogue.centerDialogue()}):"undefined"!=typeof e&&a.soon(function(){e(g)})}),g.yuiDialogue.show()})};return b.prototype.close=function(){this.yuiDialogue.hide(),this.yuiDialogue.destroy()},b.prototype.getContent=function(){return this.yuiDialogue.bodyNode.getDOMNode()},b});
- define('tool_lp/competency_rule', ["jquery"],function(a){var b=function(b){this._eventNode=a("<div>"),this._ready=a.Deferred(),this._tree=b};return b.prototype._competency=null,b.prototype._eventNode=null,b.prototype._ready=null,b.prototype._tree=null,b.prototype.canConfig=function(){return this._tree.hasChildren(this._competency.id)},b.prototype.getConfig=function(){return null},b.prototype.getType=function(){throw new Error("Not implemented")},b.prototype.init=function(){return this._load()},b.prototype.injectTemplate=function(){return a.Deferred().reject().promise()},b.prototype.isValid=function(){return!1},b.prototype._load=function(){return a.when()},b.prototype.on=function(a,b){this._eventNode.on(a,b)},b.prototype.setTargetCompetency=function(a){this._competency=a},b.prototype._trigger=function(a,b){this._eventNode.trigger(a,[b])},b.prototype._triggerChange=function(){this._trigger("change",this)},b});
- define('tool_lp/event_base', ["jquery"],function(a){var b=function(){this._eventNode=a("<div></div>")};return b.prototype._eventNode=null,b.prototype.on=function(a,b){this._eventNode.on(a,b)},b.prototype._trigger=function(a,b){this._eventNode.trigger(a,[b])},b});
- define('tool_templatelibrary/display', ["jquery","core/ajax","core/log","core/notification","core/templates","core/config","core/str"],function(a,b,c,d,e,f,g){var h=function(a,b){if(!a)return!1;var c="@template "+b,d=0,e=[];if(e=a.match(/{{!([\s\S]*?)}}/g),null!==e)for(d=0;d<e.length;d++){var f=e[d],g=f.indexOf(c);if(-1!==g){var h=g+c.length+1;return f=f.substr(h,f.length-2-h)}}return!1},i=function(b,f,i){g.get_string("templateselected","tool_templatelibrary",b).done(function(b){a('[data-region="displaytemplateheader"]').text(b)}).fail(d.exception);var j=h(f,b);j===!1&&(j=h(i,b)),j&&(f=j),a('[data-region="displaytemplatesource"]').text(f);var k=f.match(/Example context \(json\):([\s\S]*)/),l=!1;if(k){var m=k[1].trim();try{l=a.parseJSON(m)}catch(n){c.debug("Could not parse json example context for template."),c.debug(n)}}l?e.render(b,l).done(function(b,c){e.replaceNodeContents(a('[data-region="displaytemplateexample"]'),b,c)}).fail(d.exception):g.get_string("templatehasnoexample","tool_templatelibrary").done(function(b){a('[data-region="displaytemplateexample"]').text(b)}).fail(d.exception)},j=function(c){var e=c.split("/"),g=e.shift(),h=e.shift(),j=b.call([{methodname:"core_output_load_template",args:{component:g,template:h,themename:f.theme}},{methodname:"tool_templatelibrary_load_canonical_template",args:{component:g,template:h}}],!0,!1);a.when.apply(a,j).done(function(a,b){i(c,a,b)}).fail(d.exception)};return a('[data-region="list-templates"]').on("click","[data-templatename]",function(b){var c=a(this).data("templatename");b.preventDefault(),j(c)}),{}});
- define('tool_templatelibrary/search', ["jquery","core/ajax","core/log","core/notification","core/templates","core/config"],function(a,b,c,d,e,f){var g=function(b){e.render("tool_templatelibrary/search_results",{templates:b}).done(function(b,c){e.replaceNode(a('[data-region="searchresults"]'),b,c)}).fail(d.exception)},h=function(c){var e=a('[data-field="component"]').val(),f=a('[data-field="search"]').val();b.call([{methodname:"tool_templatelibrary_list_templates",args:{component:e,search:f,themename:c},done:g,fail:d.exception}],!0,!1)},i=null,j=function(a,b){null!==i&&window.clearTimeout(i),i=window.setTimeout(function(){a(),i=null},b)},k=function(){j(h.bind(this,f.theme),400)};return a('[data-region="list-templates"]').on("change",'[data-field="component"]',k),a('[data-region="list-templates"]').on("input",'[data-field="search"]',k),h(f.theme),{}});
- define('theme_bootstrap/bootstrap', ["jquery","core/log"],function(a,b){function c(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]};return!1}function d(b){return this.each(function(){var c=a(this),d=c.data("bs.alert");d||c.data("bs.alert",d=new t(this)),"string"==typeof b&&d[b].call(c)})}function e(b){return this.each(function(){var c=a(this),d=c.data("bs.button"),e="object"==typeof b&&b;d||c.data("bs.button",d=new v(this,e)),"toggle"==b?d.toggle():b&&d.setState(b)})}function f(b){return this.each(function(){var c=a(this),d=c.data("bs.carousel"),e=a.extend({},w.DEFAULTS,c.data(),"object"==typeof b&&b),f="string"==typeof b?b:e.slide;d||c.data("bs.carousel",d=new w(this,e)),"number"==typeof b?d.to(b):f?d[f]():e.interval&&d.pause().cycle()})}function g(b){var c,d=b.attr("data-target")||(c=b.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,"");return a(d)}function h(b){return this.each(function(){var c=a(this),d=c.data("bs.collapse"),e=a.extend({},y.DEFAULTS,c.data(),"object"==typeof b&&b);!d&&e.toggle&&/show|hide/.test(b)&&(e.toggle=!1),d||c.data("bs.collapse",d=new y(this,e)),"string"==typeof b&&d[b]()})}function i(b){b&&3===b.which||(a(z).remove(),a(A).each(function(){var c=a(this),d=j(c),e={relatedTarget:this};d.hasClass("open")&&(b&&"click"==b.type&&/input|textarea/i.test(b.target.tagName)&&a.contains(d[0],b.target)||(d.trigger(b=a.Event("hide.bs.dropdown",e)),b.isDefaultPrevented()||(c.attr("aria-expanded","false"),d.removeClass("open").trigger("hidden.bs.dropdown",e))))}))}function j(b){var c=b.attr("data-target");c||(c=b.attr("href"),c=c&&/#[A-Za-z]/.test(c)&&c.replace(/.*(?=#[^\s]*$)/,""));var d=c&&a(c);return d&&d.length?d:b.parent()}function k(b){return this.each(function(){var c=a(this),d=c.data("bs.dropdown");d||c.data("bs.dropdown",d=new B(this)),"string"==typeof b&&d[b].call(c)})}function l(b,c){return this.each(function(){var d=a(this),e=d.data("bs.modal"),f=a.extend({},C.DEFAULTS,d.data(),"object"==typeof b&&b);e||d.data("bs.modal",e=new C(this,f)),"string"==typeof b?e[b](c):f.show&&e.show(c)})}function m(b){return this.each(function(){var c=a(this),d=c.data("bs.tooltip"),e="object"==typeof b&&b;(d||!/destroy|hide/.test(b))&&(d||c.data("bs.tooltip",d=new D(this,e)),"string"==typeof b&&d[b]())})}function n(b){return this.each(function(){var c=a(this),d=c.data("bs.popover"),e="object"==typeof b&&b;(d||!/destroy|hide/.test(b))&&(d||c.data("bs.popover",d=new E(this,e)),"string"==typeof b&&d[b]())})}function o(b,c){this.$body=a(document.body),this.$scrollElement=a(a(b).is(document.body)?window:b),this.options=a.extend({},o.DEFAULTS,c),this.selector=(this.options.target||"")+" .nav li > a",this.offsets=[],this.targets=[],this.activeTarget=null,this.scrollHeight=0,this.$scrollElement.on("scroll.bs.scrollspy",a.proxy(this.process,this)),this.refresh(),this.process()}function p(b){return this.each(function(){var c=a(this),d=c.data("bs.scrollspy"),e="object"==typeof b&&b;d||c.data("bs.scrollspy",d=new o(this,e)),"string"==typeof b&&d[b]()})}function q(b){return this.each(function(){var c=a(this),d=c.data("bs.tab");d||c.data("bs.tab",d=new F(this)),"string"==typeof b&&d[b]()})}function r(b){return this.each(function(){var c=a(this),d=c.data("bs.affix"),e="object"==typeof b&&b;d||c.data("bs.affix",d=new G(this,e)),"string"==typeof b&&d[b]()})}a(".h1").hide(),b.debug("Bootstrap AMD initialised"),a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one("bsTransitionEnd",function(){c=!0});var e=function(){c||a(d).trigger(a.support.transition.end)};return setTimeout(e,b),this},a(function(){a.support.transition=c(),a.support.transition&&(a.event.special.bsTransitionEnd={bindType:a.support.transition.end,delegateType:a.support.transition.end,handle:function(b){return a(b.target).is(this)?b.handleObj.handler.apply(this,arguments):void 0}})});var s='[data-dismiss="alert"]',t=function(b){a(b).on("click",s,this.close)};t.VERSION="3.3.4",t.TRANSITION_DURATION=150,t.prototype.close=function(b){function c(){f.detach().trigger("closed.bs.alert").remove()}var d=a(this),e=d.attr("data-target");e||(e=d.attr("href"),e=e&&e.replace(/.*(?=#[^\s]*$)/,""));var f=a(e);b&&b.preventDefault(),f.length||(f=d.closest(".alert")),f.trigger(b=a.Event("close.bs.alert")),b.isDefaultPrevented()||(f.removeClass("in"),a.support.transition&&f.hasClass("fade")?f.one("bsTransitionEnd",c).emulateTransitionEnd(t.TRANSITION_DURATION):c())};var u=a.fn.alert;a.fn.alert=d,a.fn.alert.Constructor=t,a.fn.alert.noConflict=function(){return a.fn.alert=u,this},a(document).on("click.bs.alert.data-api",s,t.prototype.close);var v=function(b,c){this.$element=a(b),this.options=a.extend({},v.DEFAULTS,c),this.isLoading=!1};v.VERSION="3.3.4",v.DEFAULTS={loadingText:"loading..."},v.prototype.setState=function(b){var c="disabled",d=this.$element,e=d.is("input")?"val":"html",f=d.data();b+="Text",null==f.resetText&&d.data("resetText",d[e]()),setTimeout(a.proxy(function(){d[e](null==f[b]?this.options[b]:f[b]),"loadingText"==b?(this.isLoading=!0,d.addClass(c).attr(c,c)):this.isLoading&&(this.isLoading=!1,d.removeClass(c).removeAttr(c))},this),0)},v.prototype.toggle=function(){var a=!0,b=this.$element.closest('[data-toggle="buttons"]');if(b.length){var c=this.$element.find("input");"radio"==c.prop("type")&&(c.prop("checked")&&this.$element.hasClass("active")?a=!1:b.find(".active").removeClass("active")),a&&c.prop("checked",!this.$element.hasClass("active")).trigger("change")}else this.$element.attr("aria-pressed",!this.$element.hasClass("active"));a&&this.$element.toggleClass("active")};var u=a.fn.button;a.fn.button=e,a.fn.button.Constructor=v,a.fn.button.noConflict=function(){return a.fn.button=u,this},a(document).on("click.bs.button.data-api",'[data-toggle^="button"]',function(b){var c=a(b.target);c.hasClass("btn")||(c=c.closest(".btn")),e.call(c,"toggle"),b.preventDefault()}).on("focus.bs.button.data-api blur.bs.button.data-api",'[data-toggle^="button"]',function(b){a(b.target).closest(".btn").toggleClass("focus",/^focus(in)?$/.test(b.type))});var w=function(b,c){this.$element=a(b),this.$indicators=this.$element.find(".carousel-indicators"),this.options=c,this.paused=null,this.sliding=null,this.interval=null,this.$active=null,this.$items=null,this.options.keyboard&&this.$element.on("keydown.bs.carousel",a.proxy(this.keydown,this)),"hover"==this.options.pause&&!("ontouchstart"in document.documentElement)&&this.$element.on("mouseenter.bs.carousel",a.proxy(this.pause,this)).on("mouseleave.bs.carousel",a.proxy(this.cycle,this))};w.VERSION="3.3.4",w.TRANSITION_DURATION=600,w.DEFAULTS={interval:5e3,pause:"hover",wrap:!0,keyboard:!0},w.prototype.keydown=function(a){if(!/input|textarea/i.test(a.target.tagName)){switch(a.which){case 37:this.prev();break;case 39:this.next();break;default:return}a.preventDefault()}},w.prototype.cycle=function(b){return b||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},w.prototype.getItemIndex=function(a){return this.$items=a.parent().children(".item"),this.$items.index(a||this.$active)},w.prototype.getItemForDirection=function(a,b){var c=this.getItemIndex(b),d="prev"==a&&0===c||"next"==a&&c==this.$items.length-1;if(d&&!this.options.wrap)return b;var e="prev"==a?-1:1,f=(c+e)%this.$items.length;return this.$items.eq(f)},w.prototype.to=function(a){var b=this,c=this.getItemIndex(this.$active=this.$element.find(".item.active"));return a>this.$items.length-1||0>a?void 0:this.sliding?this.$element.one("slid.bs.carousel",function(){b.to(a)}):c==a?this.pause().cycle():this.slide(a>c?"next":"prev",this.$items.eq(a))},w.prototype.pause=function(b){return b||(this.paused=!0),this.$element.find(".next, .prev").length&&a.support.transition&&(this.$element.trigger(a.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},w.prototype.next=function(){return this.sliding?void 0:this.slide("next")},w.prototype.prev=function(){return this.sliding?void 0:this.slide("prev")},w.prototype.slide=function(b,c){var d=this.$element.find(".item.active"),e=c||this.getItemForDirection(b,d),f=this.interval,g="next"==b?"left":"right",h=this;if(e.hasClass("active"))return this.sliding=!1;var i=e[0],j=a.Event("slide.bs.carousel",{relatedTarget:i,direction:g});if(this.$element.trigger(j),!j.isDefaultPrevented()){if(this.sliding=!0,f&&this.pause(),this.$indicators.length){this.$indicators.find(".active").removeClass("active");var k=a(this.$indicators.children()[this.getItemIndex(e)]);k&&k.addClass("active")}var l=a.Event("slid.bs.carousel",{relatedTarget:i,direction:g});return a.support.transition&&this.$element.hasClass("slide")?(e.addClass(b),e[0].offsetWidth,d.addClass(g),e.addClass(g),d.one("bsTransitionEnd",function(){e.removeClass([b,g].join(" ")).addClass("active"),d.removeClass(["active",g].join(" ")),h.sliding=!1,setTimeout(function(){h.$element.trigger(l)},0)}).emulateTransitionEnd(w.TRANSITION_DURATION)):(d.removeClass("active"),e.addClass("active"),this.sliding=!1,this.$element.trigger(l)),f&&this.cycle(),this}};var u=a.fn.carousel;a.fn.carousel=f,a.fn.carousel.Constructor=w,a.fn.carousel.noConflict=function(){return a.fn.carousel=u,this};var x=function(b){var c,d=a(this),e=a(d.attr("data-target")||(c=d.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,""));if(e.hasClass("carousel")){var g=a.extend({},e.data(),d.data()),h=d.attr("data-slide-to");h&&(g.interval=!1),f.call(e,g),h&&e.data("bs.carousel").to(h),b.preventDefault()}};a(document).on("click.bs.carousel.data-api","[data-slide]",x).on("click.bs.carousel.data-api","[data-slide-to]",x),a(window).on("load",function(){a('[data-ride="carousel"]').each(function(){var b=a(this);f.call(b,b.data())})});var y=function(b,c){this.$element=a(b),this.options=a.extend({},y.DEFAULTS,c),this.$trigger=a('[data-toggle="collapse"][href="#'+b.id+'"],[data-toggle="collapse"][data-target="#'+b.id+'"]'),this.transitioning=null,this.options.parent?this.$parent=this.getParent():this.addAriaAndCollapsedClass(this.$element,this.$trigger),this.options.toggle&&this.toggle()};y.VERSION="3.3.4",y.TRANSITION_DURATION=350,y.DEFAULTS={toggle:!0},y.prototype.dimension=function(){var a=this.$element.hasClass("width");return a?"width":"height"},y.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var b,c=this.$parent&&this.$parent.children(".panel").children(".in, .collapsing");if(!(c&&c.length&&(b=c.data("bs.collapse"),b&&b.transitioning))){var d=a.Event("show.bs.collapse");if(this.$element.trigger(d),!d.isDefaultPrevented()){c&&c.length&&(h.call(c,"hide"),b||c.data("bs.collapse",null));var e=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[e](0).attr("aria-expanded",!0),this.$trigger.removeClass("collapsed").attr("aria-expanded",!0),this.transitioning=1;var f=function(){this.$element.removeClass("collapsing").addClass("collapse in")[e](""),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return f.call(this);var g=a.camelCase(["scroll",e].join("-"));this.$element.one("bsTransitionEnd",a.proxy(f,this)).emulateTransitionEnd(y.TRANSITION_DURATION)[e](this.$element[0][g])}}}},y.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var b=a.Event("hide.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.dimension();this.$element[c](this.$element[c]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse in").attr("aria-expanded",!1),this.$trigger.addClass("collapsed").attr("aria-expanded",!1),this.transitioning=1;var d=function(){this.transitioning=0,this.$element.removeClass("collapsing").addClass("collapse").trigger("hidden.bs.collapse")};return a.support.transition?void this.$element[c](0).one("bsTransitionEnd",a.proxy(d,this)).emulateTransitionEnd(y.TRANSITION_DURATION):d.call(this)}}},y.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()},y.prototype.getParent=function(){return a(this.options.parent).find('[data-toggle="collapse"][data-parent="'+this.options.parent+'"]').each(a.proxy(function(b,c){var d=a(c);this.addAriaAndCollapsedClass(g(d),d)},this)).end()},y.prototype.addAriaAndCollapsedClass=function(a,b){var c=a.hasClass("in");a.attr("aria-expanded",c),b.toggleClass("collapsed",!c).attr("aria-expanded",c)};var u=a.fn.collapse;a.fn.collapse=h,a.fn.collapse.Constructor=y,a.fn.collapse.noConflict=function(){return a.fn.collapse=u,this},a(document).on("click.bs.collapse.data-api",'[data-toggle="collapse"]',function(b){var c=a(this);c.attr("data-target")||b.preventDefault();var d=g(c),e=d.data("bs.collapse"),f=e?"toggle":c.data();h.call(d,f)});var z=".dropdown-backdrop",A='[data-toggle="dropdown"]',B=function(b){a(b).on("click.bs.dropdown",this.toggle)};B.VERSION="3.3.4",B.prototype.toggle=function(b){var c=a(this);if(!c.is(".disabled, :disabled")){var d=j(c),e=d.hasClass("open");if(i(),!e){"ontouchstart"in document.documentElement&&!d.closest(".navbar-nav").length&&a(document.createElement("div")).addClass("dropdown-backdrop").insertAfter(a(this)).on("click",i);var f={relatedTarget:this};if(d.trigger(b=a.Event("show.bs.dropdown",f)),b.isDefaultPrevented())return;c.trigger("focus").attr("aria-expanded","true"),d.toggleClass("open").trigger("shown.bs.dropdown",f)}return!1}},B.prototype.keydown=function(b){if(/(38|40|27|32)/.test(b.which)&&!/input|textarea/i.test(b.target.tagName)){var c=a(this);if(b.preventDefault(),b.stopPropagation(),!c.is(".disabled, :disabled")){var d=j(c),e=d.hasClass("open");if(!e&&27!=b.which||e&&27==b.which)return 27==b.which&&d.find(A).trigger("focus"),c.trigger("click");var f=" li:not(.disabled):visible a",g=d.find('[role="menu"]'+f+', [role="listbox"]'+f);if(g.length){var h=g.index(b.target);38==b.which&&h>0&&h--,40==b.which&&h<g.length-1&&h++,~h||(h=0),g.eq(h).trigger("focus")}}}};var u=a.fn.dropdown;a.fn.dropdown=k,a.fn.dropdown.Constructor=B,a.fn.dropdown.noConflict=function(){return a.fn.dropdown=u,this},a(document).on("click.bs.dropdown.data-api",i).on("click.bs.dropdown.data-api",".dropdown form",function(a){a.stopPropagation()}).on("click.bs.dropdown.data-api",A,B.prototype.toggle).on("keydown.bs.dropdown.data-api",A,B.prototype.keydown).on("keydown.bs.dropdown.data-api",'[role="menu"]',B.prototype.keydown).on("keydown.bs.dropdown.data-api",'[role="listbox"]',B.prototype.keydown);var C=function(b,c){this.options=c,this.$body=a(document.body),this.$element=a(b),this.$dialog=this.$element.find(".modal-dialog"),this.$backdrop=null,this.isShown=null,this.originalBodyPad=null,this.scrollbarWidth=0,this.ignoreBackdropClick=!1,this.options.remote&&this.$element.find(".modal-content").load(this.options.remote,a.proxy(function(){this.$element.trigger("loaded.bs.modal")},this))};C.VERSION="3.3.4",C.TRANSITION_DURATION=300,C.BACKDROP_TRANSITION_DURATION=150,C.DEFAULTS={backdrop:!0,keyboard:!0,show:!0},C.prototype.toggle=function(a){return this.isShown?this.hide():this.show(a)},C.prototype.show=function(b){var c=this,d=a.Event("show.bs.modal",{relatedTarget:b});this.$element.trigger(d),this.isShown||d.isDefaultPrevented()||(this.isShown=!0,this.checkScrollbar(),this.setScrollbar(),this.$body.addClass("modal-open"),this.escape(),this.resize(),this.$element.on("click.dismiss.bs.modal",'[data-dismiss="modal"]',a.proxy(this.hide,this)),this.$dialog.on("mousedown.dismiss.bs.modal",function(){c.$element.one("mouseup.dismiss.bs.modal",function(b){a(b.target).is(c.$element)&&(c.ignoreBackdropClick=!0)})}),this.backdrop(function(){var d=a.support.transition&&c.$element.hasClass("fade");c.$element.parent().length||c.$element.appendTo(c.$body),c.$element.show().scrollTop(0),c.adjustDialog(),d&&c.$element[0].offsetWidth,c.$element.addClass("in").attr("aria-hidden",!1),c.enforceFocus();var e=a.Event("shown.bs.modal",{relatedTarget:b});d?c.$dialog.one("bsTransitionEnd",function(){c.$element.trigger("focus").trigger(e)}).emulateTransitionEnd(C.TRANSITION_DURATION):c.$element.trigger("focus").trigger(e)}))},C.prototype.hide=function(b){b&&b.preventDefault(),b=a.Event("hide.bs.modal"),this.$element.trigger(b),this.isShown&&!b.isDefaultPrevented()&&(this.isShown=!1,this.escape(),this.resize(),a(document).off("focusin.bs.modal"),this.$element.removeClass("in").attr("aria-hidden",!0).off("click.dismiss.bs.modal").off("mouseup.dismiss.bs.modal"),this.$dialog.off("mousedown.dismiss.bs.modal"),a.support.transition&&this.$element.hasClass("fade")?this.$element.one("bsTransitionEnd",a.proxy(this.hideModal,this)).emulateTransitionEnd(C.TRANSITION_DURATION):this.hideModal())},C.prototype.enforceFocus=function(){a(document).off("focusin.bs.modal").on("focusin.bs.modal",a.proxy(function(a){this.$element[0]===a.target||this.$element.has(a.target).length||this.$element.trigger("focus")},this))},C.prototype.escape=function(){this.isShown&&this.options.keyboard?this.$element.on("keydown.dismiss.bs.modal",a.proxy(function(a){27==a.which&&this.hide()},this)):this.isShown||this.$element.off("keydown.dismiss.bs.modal")},C.prototype.resize=function(){this.isShown?a(window).on("resize.bs.modal",a.proxy(this.handleUpdate,this)):a(window).off("resize.bs.modal")},C.prototype.hideModal=function(){var a=this;this.$element.hide(),this.backdrop(function(){a.$body.removeClass("modal-open"),a.resetAdjustments(),a.resetScrollbar(),a.$element.trigger("hidden.bs.modal")})},C.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},C.prototype.backdrop=function(b){var c=this,d=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var e=a.support.transition&&d;if(this.$backdrop=a(document.createElement("div")).addClass("modal-backdrop "+d).appendTo(this.$body),this.$element.on("click.dismiss.bs.modal",a.proxy(function(a){return this.ignoreBackdropClick?void(this.ignoreBackdropClick=!1):void(a.target===a.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus():this.hide()))},this)),e&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!b)return;e?this.$backdrop.one("bsTransitionEnd",b).emulateTransitionEnd(C.BACKDROP_TRANSITION_DURATION):b()}else if(!this.isShown&&this.$backdrop){this.$backdrop.removeClass("in");var f=function(){c.removeBackdrop(),b&&b()};a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one("bsTransitionEnd",f).emulateTransitionEnd(C.BACKDROP_TRANSITION_DURATION):f()}else b&&b()},C.prototype.handleUpdate=function(){this.adjustDialog()},C.prototype.adjustDialog=function(){var a=this.$element[0].scrollHeight>document.documentElement.clientHeight;this.$element.css({paddingLeft:!this.bodyIsOverflowing&&a?this.scrollbarWidth:"",paddingRight:this.bodyIsOverflowing&&!a?this.scrollbarWidth:""})},C.prototype.resetAdjustments=function(){this.$element.css({paddingLeft:"",paddingRight:""})},C.prototype.checkScrollbar=function(){var a=window.innerWidth;if(!a){var b=document.documentElement.getBoundingClientRect();a=b.right-Math.abs(b.left)}this.bodyIsOverflowing=document.body.clientWidth<a,this.scrollbarWidth=this.measureScrollbar()},C.prototype.setScrollbar=function(){var a=parseInt(this.$body.css("padding-right")||0,10);this.originalBodyPad=document.body.style.paddingRight||"",this.bodyIsOverflowing&&this.$body.css("padding-right",a+this.scrollbarWidth)},C.prototype.resetScrollbar=function(){this.$body.css("padding-right",this.originalBodyPad)},C.prototype.measureScrollbar=function(){var a=document.createElement("div");a.className="modal-scrollbar-measure",this.$body.append(a);var b=a.offsetWidth-a.clientWidth;return this.$body[0].removeChild(a),b};var u=a.fn.modal;a.fn.modal=l,a.fn.modal.Constructor=C,a.fn.modal.noConflict=function(){return a.fn.modal=u,this},a(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(b){var c=a(this),d=c.attr("href"),e=a(c.attr("data-target")||d&&d.replace(/.*(?=#[^\s]+$)/,"")),f=e.data("bs.modal")?"toggle":a.extend({remote:!/#/.test(d)&&d},e.data(),c.data());c.is("a")&&b.preventDefault(),e.one("show.bs.modal",function(a){a.isDefaultPrevented()||e.one("hidden.bs.modal",function(){c.is(":visible")&&c.trigger("focus")})}),l.call(e,f,this)});var D=function(a,b){this.type=null,this.options=null,this.enabled=null,this.timeout=null,this.hoverState=null,this.$element=null,this.init("tooltip",a,b)};D.VERSION="3.3.4",D.TRANSITION_DURATION=150,D.DEFAULTS={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,container:!1,viewport:{selector:"body",padding:0}},D.prototype.init=function(b,c,d){if(this.enabled=!0,this.type=b,this.$element=a(c),this.options=this.getOptions(d),this.$viewport=this.options.viewport&&a(this.options.viewport.selector||this.options.viewport),this.$element[0]instanceof document.constructor&&!this.options.selector)throw new Error("`selector` option must be specified when initializing "+this.type+" on the window.document object!");for(var e=this.options.trigger.split(" "),f=e.length;f--;){var g=e[f];if("click"==g)this.$element.on("click."+this.type,this.options.selector,a.proxy(this.toggle,this));else if("manual"!=g){var h="hover"==g?"mouseenter":"focusin",i="hover"==g?"mouseleave":"focusout";this.$element.on(h+"."+this.type,this.options.selector,a.proxy(this.enter,this)),this.$element.on(i+"."+this.type,this.options.selector,a.proxy(this.leave,this))}}this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},D.prototype.getDefaults=function(){return D.DEFAULTS},D.prototype.getOptions=function(b){return b=a.extend({},this.getDefaults(),this.$element.data(),b),b.delay&&"number"==typeof b.delay&&(b.delay={show:b.delay,hide:b.delay}),b},D.prototype.getDelegateOptions=function(){var b={},c=this.getDefaults();return this._options&&a.each(this._options,function(a,d){c[a]!=d&&(b[a]=d)}),b},D.prototype.enter=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);return c&&c.$tip&&c.$tip.is(":visible")?void(c.hoverState="in"):(c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),clearTimeout(c.timeout),c.hoverState="in",c.options.delay&&c.options.delay.show?void(c.timeout=setTimeout(function(){"in"==c.hoverState&&c.show()},c.options.delay.show)):c.show())},D.prototype.leave=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);return c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),clearTimeout(c.timeout),c.hoverState="out",c.options.delay&&c.options.delay.hide?void(c.timeout=setTimeout(function(){"out"==c.hoverState&&c.hide()},c.options.delay.hide)):c.hide()},D.prototype.show=function(){var b=a.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(b);var c=a.contains(this.$element[0].ownerDocument.documentElement,this.$element[0]);if(b.isDefaultPrevented()||!c)return;var d=this,e=this.tip(),f=this.getUID(this.type);this.setContent(),e.attr("id",f),this.$element.attr("aria-describedby",f),this.options.animation&&e.addClass("fade");var g="function"==typeof this.options.placement?this.options.placement.call(this,e[0],this.$element[0]):this.options.placement,h=/\s?auto?\s?/i,i=h.test(g);i&&(g=g.replace(h,"")||"top"),e.detach().css({top:0,left:0,display:"block"}).addClass(g).data("bs."+this.type,this),this.options.container?e.appendTo(this.options.container):e.insertAfter(this.$element);var j=this.getPosition(),k=e[0].offsetWidth,l=e[0].offsetHeight;if(i){var m=g,n=this.options.container?a(this.options.container):this.$element.parent(),o=this.getPosition(n);g="bottom"==g&&j.bottom+l>o.bottom?"top":"top"==g&&j.top-l<o.top?"bottom":"right"==g&&j.right+k>o.width?"left":"left"==g&&j.left-k<o.left?"right":g,e.removeClass(m).addClass(g)}var p=this.getCalculatedOffset(g,j,k,l);this.applyPlacement(p,g);var q=function(){var a=d.hoverState;d.$element.trigger("shown.bs."+d.type),d.hoverState=null,"out"==a&&d.leave(d)};a.support.transition&&this.$tip.hasClass("fade")?e.one("bsTransitionEnd",q).emulateTransitionEnd(D.TRANSITION_DURATION):q()}},D.prototype.applyPlacement=function(b,c){var d=this.tip(),e=d[0].offsetWidth,f=d[0].offsetHeight,g=parseInt(d.css("margin-top"),10),h=parseInt(d.css("margin-left"),10);isNaN(g)&&(g=0),isNaN(h)&&(h=0),b.top=b.top+g,b.left=b.left+h,a.offset.setOffset(d[0],a.extend({using:function(a){d.css({top:Math.round(a.top),left:Math.round(a.left)})}},b),0),d.addClass("in");var i=d[0].offsetWidth,j=d[0].offsetHeight;"top"==c&&j!=f&&(b.top=b.top+f-j);var k=this.getViewportAdjustedDelta(c,b,i,j);k.left?b.left+=k.left:b.top+=k.top;var l=/top|bottom/.test(c),m=l?2*k.left-e+i:2*k.top-f+j,n=l?"offsetWidth":"offsetHeight";d.offset(b),this.replaceArrow(m,d[0][n],l)},D.prototype.replaceArrow=function(a,b,c){this.arrow().css(c?"left":"top",50*(1-a/b)+"%").css(c?"top":"left","")},D.prototype.setContent=function(){var a=this.tip(),b=this.getTitle();a.find(".tooltip-inner")[this.options.html?"html":"text"](b),a.removeClass("fade in top bottom left right")},D.prototype.hide=function(b){function c(){"in"!=d.hoverState&&e.detach(),d.$element.removeAttr("aria-describedby").trigger("hidden.bs."+d.type),b&&b()}var d=this,e=a(this.$tip),f=a.Event("hide.bs."+this.type);return this.$element.trigger(f),f.isDefaultPrevented()?void 0:(e.removeClass("in"),a.support.transition&&e.hasClass("fade")?e.one("bsTransitionEnd",c).emulateTransitionEnd(D.TRANSITION_DURATION):c(),this.hoverState=null,this)},D.prototype.fixTitle=function(){var a=this.$element;(a.attr("title")||"string"!=typeof a.attr("data-original-title"))&&a.attr("data-original-title",a.attr("title")||"").attr("title","")},D.prototype.hasContent=function(){return this.getTitle()},D.prototype.getPosition=function(b){b=b||this.$element;var c=b[0],d="BODY"==c.tagName,e=c.getBoundingClientRect();null==e.width&&(e=a.extend({},e,{width:e.right-e.left,height:e.bottom-e.top}));var f=d?{top:0,left:0}:b.offset(),g={scroll:d?document.documentElement.scrollTop||document.body.scrollTop:b.scrollTop()},h=d?{width:a(window).width(),height:a(window).height()}:null;return a.extend({},e,g,h,f)},D.prototype.getCalculatedOffset=function(a,b,c,d){return"bottom"==a?{top:b.top+b.height,left:b.left+b.width/2-c/2}:"top"==a?{top:b.top-d,left:b.left+b.width/2-c/2}:"left"==a?{top:b.top+b.height/2-d/2,left:b.left-c}:{top:b.top+b.height/2-d/2,left:b.left+b.width}},D.prototype.getViewportAdjustedDelta=function(a,b,c,d){var e={top:0,left:0};if(!this.$viewport)return e;var f=this.options.viewport&&this.options.viewport.padding||0,g=this.getPosition(this.$viewport);if(/right|left/.test(a)){var h=b.top-f-g.scroll,i=b.top+f-g.scroll+d;h<g.top?e.top=g.top-h:i>g.top+g.height&&(e.top=g.top+g.height-i)}else{var j=b.left-f,k=b.left+f+c;j<g.left?e.left=g.left-j:k>g.width&&(e.left=g.left+g.width-k)}return e},D.prototype.getTitle=function(){var a,b=this.$element,c=this.options;return a=b.attr("data-original-title")||("function"==typeof c.title?c.title.call(b[0]):c.title)},D.prototype.getUID=function(a){do a+=~~(1e6*Math.random());while(document.getElementById(a));return a},D.prototype.tip=function(){return this.$tip=this.$tip||a(this.options.template)},D.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},D.prototype.enable=function(){this.enabled=!0},D.prototype.disable=function(){this.enabled=!1},D.prototype.toggleEnabled=function(){this.enabled=!this.enabled},D.prototype.toggle=function(b){var c=this;b&&(c=a(b.currentTarget).data("bs."+this.type),c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c))),c.tip().hasClass("in")?c.leave(c):c.enter(c)},D.prototype.destroy=function(){var a=this;clearTimeout(this.timeout),this.hide(function(){a.$element.off("."+a.type).removeData("bs."+a.type)})};var u=a.fn.tooltip;a.fn.tooltip=m,a.fn.tooltip.Constructor=D,a.fn.tooltip.noConflict=function(){return a.fn.tooltip=u,this};var E=function(a,b){this.init("popover",a,b)};if(!a.fn.tooltip)throw new Error("Popover requires tooltip.js");E.VERSION="3.3.4",E.DEFAULTS=a.extend({},a.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:'<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'}),E.prototype=a.extend({},a.fn.tooltip.Constructor.prototype),E.prototype.constructor=E,E.prototype.getDefaults=function(){return E.DEFAULTS},E.prototype.setContent=function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.options.html?"html":"text"](b),a.find(".popover-content").children().detach().end()[this.options.html?"string"==typeof c?"html":"append":"text"](c),a.removeClass("fade top bottom left right in"),a.find(".popover-title").html()||a.find(".popover-title").hide()},E.prototype.hasContent=function(){return this.getTitle()||this.getContent()},E.prototype.getContent=function(){var a=this.$element,b=this.options;return a.attr("data-content")||("function"==typeof b.content?b.content.call(a[0]):b.content)},E.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")};var u=a.fn.popover;a.fn.popover=n,a.fn.popover.Constructor=E,a.fn.popover.noConflict=function(){return a.fn.popover=u,this},o.VERSION="3.3.4",o.DEFAULTS={offset:10},o.prototype.getScrollHeight=function(){return this.$scrollElement[0].scrollHeight||Math.max(this.$body[0].scrollHeight,document.documentElement.scrollHeight)},o.prototype.refresh=function(){var b=this,c="offset",d=0;this.offsets=[],this.targets=[],this.scrollHeight=this.getScrollHeight(),a.isWindow(this.$scrollElement[0])||(c="position",d=this.$scrollElement.scrollTop()),this.$body.find(this.selector).map(function(){var b=a(this),e=b.data("target")||b.attr("href"),f=/^#./.test(e)&&a(e);return f&&f.length&&f.is(":visible")&&[[f[c]().top+d,e]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){b.offsets.push(this[0]),b.targets.push(this[1])})},o.prototype.process=function(){var a,b=this.$scrollElement.scrollTop()+this.options.offset,c=this.getScrollHeight(),d=this.options.offset+c-this.$scrollElement.height(),e=this.offsets,f=this.targets,g=this.activeTarget;if(this.scrollHeight!=c&&this.refresh(),b>=d)return g!=(a=f[f.length-1])&&this.activate(a);if(g&&b<e[0])return this.activeTarget=null,this.clear();for(a=e.length;a--;)g!=f[a]&&b>=e[a]&&(void 0===e[a+1]||b<e[a+1])&&this.activate(f[a])},o.prototype.activate=function(b){this.activeTarget=b,this.clear();var c=this.selector+'[data-target="'+b+'"],'+this.selector+'[href="'+b+'"]',d=a(c).parents("li").addClass("active");d.parent(".dropdown-menu").length&&(d=d.closest("li.dropdown").addClass("active")),d.trigger("activate.bs.scrollspy")},o.prototype.clear=function(){a(this.selector).parentsUntil(this.options.target,".active").removeClass("active")};var u=a.fn.scrollspy;a.fn.scrollspy=p,a.fn.scrollspy.Constructor=o,a.fn.scrollspy.noConflict=function(){return a.fn.scrollspy=u,this},a(window).on("load.bs.scrollspy.data-api",function(){a('[data-spy="scroll"]').each(function(){var b=a(this);p.call(b,b.data())})});var F=function(b){this.element=a(b)};F.VERSION="3.3.4",F.TRANSITION_DURATION=150,F.prototype.show=function(){var b=this.element,c=b.closest("ul:not(.dropdown-menu)"),d=b.data("target");if(d||(d=b.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,"")),!b.parent("li").hasClass("active")){var e=c.find(".active:last a"),f=a.Event("hide.bs.tab",{relatedTarget:b[0]}),g=a.Event("show.bs.tab",{relatedTarget:e[0]});if(e.trigger(f),b.trigger(g),!g.isDefaultPrevented()&&!f.isDefaultPrevented()){var h=a(d);this.activate(b.closest("li"),c),
- this.activate(h,h.parent(),function(){e.trigger({type:"hidden.bs.tab",relatedTarget:b[0]}),b.trigger({type:"shown.bs.tab",relatedTarget:e[0]})})}}},F.prototype.activate=function(b,c,d){function e(){f.removeClass("active").find("> .dropdown-menu > .active").removeClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!1),b.addClass("active").find('[data-toggle="tab"]').attr("aria-expanded",!0),g?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu").length&&b.closest("li.dropdown").addClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!0),d&&d()}var f=c.find("> .active"),g=d&&a.support.transition&&(f.length&&f.hasClass("fade")||!!c.find("> .fade").length);f.length&&g?f.one("bsTransitionEnd",e).emulateTransitionEnd(F.TRANSITION_DURATION):e(),f.removeClass("in")};var u=a.fn.tab;a.fn.tab=q,a.fn.tab.Constructor=F,a.fn.tab.noConflict=function(){return a.fn.tab=u,this};var x=function(b){b.preventDefault(),q.call(a(this),"show")};a(document).on("click.bs.tab.data-api",'[data-toggle="tab"]',x).on("click.bs.tab.data-api",'[data-toggle="pill"]',x);var G=function(b,c){this.options=a.extend({},G.DEFAULTS,c),this.$target=a(this.options.target).on("scroll.bs.affix.data-api",a.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",a.proxy(this.checkPositionWithEventLoop,this)),this.$element=a(b),this.affixed=null,this.unpin=null,this.pinnedOffset=null,this.checkPosition()};G.VERSION="3.3.4",G.RESET="affix affix-top affix-bottom",G.DEFAULTS={offset:0,target:window},G.prototype.getState=function(a,b,c,d){var e=this.$target.scrollTop(),f=this.$element.offset(),g=this.$target.height();if(null!=c&&"top"==this.affixed)return c>e?"top":!1;if("bottom"==this.affixed)return null!=c?e+this.unpin<=f.top?!1:"bottom":a-d>=e+g?!1:"bottom";var h=null==this.affixed,i=h?e:f.top,j=h?g:b;return null!=c&&c>=e?"top":null!=d&&i+j>=a-d?"bottom":!1},G.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(G.RESET).addClass("affix");var a=this.$target.scrollTop(),b=this.$element.offset();return this.pinnedOffset=b.top-a},G.prototype.checkPositionWithEventLoop=function(){setTimeout(a.proxy(this.checkPosition,this),1)},G.prototype.checkPosition=function(){if(this.$element.is(":visible")){var b=this.$element.height(),c=this.options.offset,d=c.top,e=c.bottom,f=a(document.body).height();"object"!=typeof c&&(e=d=c),"function"==typeof d&&(d=c.top(this.$element)),"function"==typeof e&&(e=c.bottom(this.$element));var g=this.getState(f,b,d,e);if(this.affixed!=g){null!=this.unpin&&this.$element.css("top","");var h="affix"+(g?"-"+g:""),i=a.Event(h+".bs.affix");if(this.$element.trigger(i),i.isDefaultPrevented())return;this.affixed=g,this.unpin="bottom"==g?this.getPinnedOffset():null,this.$element.removeClass(G.RESET).addClass(h).trigger(h.replace("affix","affixed")+".bs.affix")}"bottom"==g&&this.$element.offset({top:f-b-e})}};var u=a.fn.affix;a.fn.affix=r,a.fn.affix.Constructor=G,a.fn.affix.noConflict=function(){return a.fn.affix=u,this},a(window).on("load",function(){a('[data-spy="affix"]').each(function(){var b=a(this),c=b.data();c.offset=c.offset||{},null!=c.offsetBottom&&(c.offset.bottom=c.offsetBottom),null!=c.offsetTop&&(c.offset.top=c.offsetTop),r.call(b,c)})})});
- define('theme_bootstrapbase/bootstrap', ["jquery"],function(a){function b(b){a(".dropdown-backdrop").remove(),a(k).each(function(){var d=c(a(this));(void 0==b||0==d.find(b).length)&&d.removeClass("open")})}function c(b){var c,d=b.attr("data-target");return d||(d=b.attr("href"),d=d&&/#/.test(d)&&d.replace(/.*(?=#[^\s]*$)/,"")),c=d&&a(d),c&&c.length||(c=b.parent()),c}function d(b,c){var d,e=a.proxy(this.process,this),f=a(a(b).is("body")?window:b);this.options=a.extend({},a.fn.scrollspy.defaults,c),this.$scrollElement=f.on("scroll.scroll-spy.data-api",e),this.selector=(this.options.target||(d=a(b).attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,"")||"")+" .nav li > a",this.$body=a("body"),this.refresh(),this.process()}a(".h1").hide(),a(function(){a.support.transition=function(){var a=function(){var a,b=document.createElement("bootstrap"),c={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(a in c)if(void 0!==b.style[a])return c[a]}();return a&&{end:a}}()});var e='[data-dismiss="alert"]',f=function(b){a(b).on("click",e,this.close)};f.prototype.close=function(b){function c(){d.trigger("closed").remove()}var d,e=a(this),f=e.attr("data-target");f||(f=e.attr("href"),f=f&&f.replace(/.*(?=#[^\s]*$)/,"")),d=a(f),b&&b.preventDefault(),d.length||(d=e.hasClass("alert")?e:e.parent()),d.trigger(b=a.Event("close")),b.isDefaultPrevented()||(d.removeClass("in"),a.support.transition&&d.hasClass("fade")?d.on(a.support.transition.end,c):c())};var g=a.fn.alert;a.fn.alert=function(b){return this.each(function(){var c=a(this),d=c.data("alert");d||c.data("alert",d=new f(this)),"string"==typeof b&&d[b].call(c)})},a.fn.alert.Constructor=f,a.fn.alert.noConflict=function(){return a.fn.alert=g,this},a(document).on("click.alert.data-api",e,f.prototype.close);var h=function(b,c){this.$element=a(b),this.options=a.extend({},a.fn.button.defaults,c)};h.prototype.setState=function(a){var b="disabled",c=this.$element,d=c.data(),e=c.is("input")?"val":"html";a+="Text",d.resetText||c.data("resetText",c[e]()),c[e](d[a]||this.options[a]),setTimeout(function(){"loadingText"==a?c.addClass(b).attr(b,b):c.removeClass(b).removeAttr(b)},0)},h.prototype.toggle=function(){var a=this.$element.closest('[data-toggle="buttons-radio"]');a&&a.find(".active").removeClass("active"),this.$element.toggleClass("active")};var g=a.fn.button;a.fn.button=function(b){return this.each(function(){var c=a(this),d=c.data("button"),e="object"==typeof b&&b;d||c.data("button",d=new h(this,e)),"toggle"==b?d.toggle():b&&d.setState(b)})},a.fn.button.defaults={loadingText:"loading..."},a.fn.button.Constructor=h,a.fn.button.noConflict=function(){return a.fn.button=g,this},a(document).on("click.button.data-api","[data-toggle^=button]",function(b){var c=a(b.target);c.hasClass("btn")||(c=c.closest(".btn")),c.button("toggle")});var i=function(b,c){this.$element=a(b),this.$indicators=this.$element.find(".carousel-indicators"),this.options=c,"hover"==this.options.pause&&this.$element.on("mouseenter",a.proxy(this.pause,this)).on("mouseleave",a.proxy(this.cycle,this))};i.prototype={cycle:function(b){return b||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},getActiveIndex:function(){return this.$active=this.$element.find(".item.active"),this.$items=this.$active.parent().children(),this.$items.index(this.$active)},to:function(b){var c=this.getActiveIndex(),d=this;if(!(b>this.$items.length-1||0>b))return this.sliding?this.$element.one("slid",function(){d.to(b)}):c==b?this.pause().cycle():this.slide(b>c?"next":"prev",a(this.$items[b]))},pause:function(b){return b||(this.paused=!0),this.$element.find(".next, .prev").length&&a.support.transition.end&&(this.$element.trigger(a.support.transition.end),this.cycle(!0)),clearInterval(this.interval),this.interval=null,this},next:function(){return this.sliding?void 0:this.slide("next")},prev:function(){return this.sliding?void 0:this.slide("prev")},slide:function(b,c){var d,e=this.$element.find(".item.active"),f=c||e[b](),g=this.interval,h="next"==b?"left":"right",i="next"==b?"first":"last",j=this;if(this.sliding=!0,g&&this.pause(),f=f.length?f:this.$element.find(".item")[i](),d=a.Event("slide",{relatedTarget:f[0],direction:h}),!f.hasClass("active")){if(this.$indicators.length&&(this.$indicators.find(".active").removeClass("active"),this.$element.one("slid",function(){var b=a(j.$indicators.children()[j.getActiveIndex()]);b&&b.addClass("active")})),a.support.transition&&this.$element.hasClass("slide")){if(this.$element.trigger(d),d.isDefaultPrevented())return;f.addClass(b),f[0].offsetWidth,e.addClass(h),f.addClass(h),this.$element.one(a.support.transition.end,function(){f.removeClass([b,h].join(" ")).addClass("active"),e.removeClass(["active",h].join(" ")),j.sliding=!1,setTimeout(function(){j.$element.trigger("slid")},0)})}else{if(this.$element.trigger(d),d.isDefaultPrevented())return;e.removeClass("active"),f.addClass("active"),this.sliding=!1,this.$element.trigger("slid")}return g&&this.cycle(),this}}};var g=a.fn.carousel;a.fn.carousel=function(b){return this.each(function(){var c=a(this),d=c.data("carousel"),e=a.extend({},a.fn.carousel.defaults,"object"==typeof b&&b),f="string"==typeof b?b:e.slide;d||c.data("carousel",d=new i(this,e)),"number"==typeof b?d.to(b):f?d[f]():e.interval&&d.pause().cycle()})},a.fn.carousel.defaults={interval:5e3,pause:"hover"},a.fn.carousel.Constructor=i,a.fn.carousel.noConflict=function(){return a.fn.carousel=g,this},a(document).on("click.carousel.data-api","[data-slide], [data-slide-to]",function(b){var c,d,e=a(this),f=a(e.attr("data-target")||(c=e.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,"")),g=a.extend({},f.data(),e.data());f.carousel(g),(d=e.attr("data-slide-to"))&&f.data("carousel").pause().to(d).cycle(),b.preventDefault()});var j=function(b,c){this.$element=a(b),this.options=a.extend({},a.fn.collapse.defaults,c),this.options.parent&&(this.$parent=a(this.options.parent)),this.options.toggle&&this.toggle()};j.prototype={constructor:j,dimension:function(){var a=this.$element.hasClass("width");return a?"width":"height"},show:function(){var b,c,d,e;if(!this.transitioning&&!this.$element.hasClass("in")){if(b=this.dimension(),c=a.camelCase(["scroll",b].join("-")),d=this.$parent&&this.$parent.find("> .accordion-group > .in"),d&&d.length){if(e=d.data("collapse"),e&&e.transitioning)return;d.collapse("hide"),e||d.data("collapse",null)}this.$element[b](0),this.transition("addClass",a.Event("show"),"shown"),a.support.transition&&this.$element[b](this.$element[0][c])}},hide:function(){var b;!this.transitioning&&this.$element.hasClass("in")&&(b=this.dimension(),this.reset(this.$element[b]()),this.transition("removeClass",a.Event("hide"),"hidden"),this.$element[b](0))},reset:function(a){var b=this.dimension();return this.$element.removeClass("collapse")[b](a||"auto")[0].offsetWidth,this.$element[null!==a?"addClass":"removeClass"]("collapse"),this},transition:function(b,c,d){var e=this,f=function(){"show"==c.type&&e.reset(),e.transitioning=0,e.$element.trigger(d)};this.$element.trigger(c),c.isDefaultPrevented()||(this.transitioning=1,this.$element[b]("in"),a.support.transition&&this.$element.hasClass("collapse")?this.$element.one(a.support.transition.end,f):f())},toggle:function(){this[this.$element.hasClass("in")?"hide":"show"]()}};var g=a.fn.collapse;a.fn.collapse=function(b){return this.each(function(){var c=a(this),d=c.data("collapse"),e=a.extend({},a.fn.collapse.defaults,c.data(),"object"==typeof b&&b);d||c.data("collapse",d=new j(this,e)),"string"==typeof b&&d[b]()})},a.fn.collapse.defaults={toggle:!0},a.fn.collapse.Constructor=j,a.fn.collapse.noConflict=function(){return a.fn.collapse=g,this},a(document).on("click.collapse.data-api","[data-toggle=collapse]",function(b){var c,d=a(this),e=d.attr("data-target")||b.preventDefault()||(c=d.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,""),f=a(e).data("collapse")?"toggle":d.data();d[a(e).hasClass("in")?"addClass":"removeClass"]("collapsed"),a(e).collapse(f)});var k="[data-toggle=dropdown]",l=function(b){var c=a(b).on("click.dropdown.data-api",this.toggle);a("html").on("click.dropdown.data-api",function(){c.parent().removeClass("open")})};l.prototype={constructor:l,toggle:function(d){var e,f,g=a(this);if(!g.is(".disabled, :disabled"))return e=c(g),f=e.hasClass("open"),b(g),f||"ontouchstart"in document.documentElement&&a('<div class="dropdown-backdrop"/>').insertBefore(a(this)).on("click",b),e.toggleClass("open"),g.focus(),!1},keydown:function(b){var d,e,f,g,h;if(/(38|40|27)/.test(b.keyCode)&&(d=a(this),b.preventDefault(),b.stopPropagation(),!d.is(".disabled, :disabled"))){if(f=c(d),g=f.hasClass("open"),!g||g&&27==b.keyCode)return 27==b.which&&f.find(k).focus(),d.click();e=a("[role=menu] li:not(.divider):visible a",f),e.length&&(h=e.index(e.filter(":focus")),38==b.keyCode&&h>0&&h--,40==b.keyCode&&h<e.length-1&&h++,~h||(h=0),e.eq(h).focus())}}};var g=a.fn.dropdown;a.fn.dropdown=function(b){return this.each(function(){var c=a(this),d=c.data("dropdown");d||c.data("dropdown",d=new l(this)),"string"==typeof b&&d[b].call(c)})},a.fn.dropdown.Constructor=l,a.fn.dropdown.noConflict=function(){return a.fn.dropdown=g,this},a(document).on("click.dropdown.data-api",b).on("click.dropdown.data-api",".dropdown form",function(a){a.stopPropagation()}).on("click.dropdown.data-api",k,l.prototype.toggle).on("keydown.dropdown.data-api",k+", [role=menu]",l.prototype.keydown);var m=function(b,c){this.options=c,this.$element=a(b).delegate('[data-dismiss="modal"]',"click.dismiss.modal",a.proxy(this.hide,this)),this.options.remote&&this.$element.find(".modal-body").load(this.options.remote)};m.prototype={constructor:m,toggle:function(){return this[this.isShown?"hide":"show"]()},show:function(){var b=this,c=a.Event("show");this.$element.trigger(c),this.isShown||c.isDefaultPrevented()||(this.isShown=!0,this.escape(),this.backdrop(function(){var c=a.support.transition&&b.$element.hasClass("fade");b.$element.parent().length||b.$element.appendTo(document.body),b.$element.show(),c&&b.$element[0].offsetWidth,b.$element.addClass("in").attr("aria-hidden",!1),b.enforceFocus(),c?b.$element.one(a.support.transition.end,function(){b.$element.focus().trigger("shown")}):b.$element.focus().trigger("shown")}))},hide:function(b){b&&b.preventDefault();b=a.Event("hide"),this.$element.trigger(b),this.isShown&&!b.isDefaultPrevented()&&(this.isShown=!1,this.escape(),a(document).off("focusin.modal"),this.$element.removeClass("in").attr("aria-hidden",!0),a.support.transition&&this.$element.hasClass("fade")?this.hideWithTransition():this.hideModal())},enforceFocus:function(){var b=this;a(document).on("focusin.modal",function(a){b.$element[0]===a.target||b.$element.has(a.target).length||b.$element.focus()})},escape:function(){var a=this;this.isShown&&this.options.keyboard?this.$element.on("keyup.dismiss.modal",function(b){27==b.which&&a.hide()}):this.isShown||this.$element.off("keyup.dismiss.modal")},hideWithTransition:function(){var b=this,c=setTimeout(function(){b.$element.off(a.support.transition.end),b.hideModal()},500);this.$element.one(a.support.transition.end,function(){clearTimeout(c),b.hideModal()})},hideModal:function(){var a=this;this.$element.hide(),this.backdrop(function(){a.removeBackdrop(),a.$element.trigger("hidden")})},removeBackdrop:function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},backdrop:function(b){var c=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var d=a.support.transition&&c;if(this.$backdrop=a('<div class="modal-backdrop '+c+'" />').appendTo(document.body),this.$backdrop.click("static"==this.options.backdrop?a.proxy(this.$element[0].focus,this.$element[0]):a.proxy(this.hide,this)),d&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!b)return;d?this.$backdrop.one(a.support.transition.end,b):b()}else!this.isShown&&this.$backdrop?(this.$backdrop.removeClass("in"),a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one(a.support.transition.end,b):b()):b&&b()}};var g=a.fn.modal;a.fn.modal=function(b){return this.each(function(){var c=a(this),d=c.data("modal"),e=a.extend({},a.fn.modal.defaults,c.data(),"object"==typeof b&&b);d||c.data("modal",d=new m(this,e)),"string"==typeof b?d[b]():e.show&&d.show()})},a.fn.modal.defaults={backdrop:!0,keyboard:!0,show:!0},a.fn.modal.Constructor=m,a.fn.modal.noConflict=function(){return a.fn.modal=g,this},a(document).on("click.modal.data-api",'[data-toggle="modal"]',function(b){var c=a(this),d=c.attr("href"),e=a(c.attr("data-target")||d&&d.replace(/.*(?=#[^\s]+$)/,"")),f=e.data("modal")?"toggle":a.extend({remote:!/#/.test(d)&&d},e.data(),c.data());b.preventDefault(),e.modal(f).one("hide",function(){c.focus()})});var n=function(a,b){this.init("tooltip",a,b)};n.prototype={constructor:n,init:function(b,c,d){var e,f,g,h,i;for(this.type=b,this.$element=a(c),this.options=this.getOptions(d),this.enabled=!0,g=this.options.trigger.split(" "),i=g.length;i--;)h=g[i],"click"==h?this.$element.on("click."+this.type,this.options.selector,a.proxy(this.toggle,this)):"manual"!=h&&(e="hover"==h?"mouseenter":"focus",f="hover"==h?"mouseleave":"blur",this.$element.on(e+"."+this.type,this.options.selector,a.proxy(this.enter,this)),this.$element.on(f+"."+this.type,this.options.selector,a.proxy(this.leave,this)));this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},getOptions:function(b){return b=a.extend({},a.fn[this.type].defaults,this.$element.data(),b),b.delay&&"number"==typeof b.delay&&(b.delay={show:b.delay,hide:b.delay}),b},enter:function(b){var c,d=a.fn[this.type].defaults,e={};return this._options&&a.each(this._options,function(a,b){d[a]!=b&&(e[a]=b)},this),c=a(b.currentTarget)[this.type](e).data(this.type),c.options.delay&&c.options.delay.show?(clearTimeout(this.timeout),c.hoverState="in",void(this.timeout=setTimeout(function(){"in"==c.hoverState&&c.show()},c.options.delay.show))):c.show()},leave:function(b){var c=a(b.currentTarget)[this.type](this._options).data(this.type);return this.timeout&&clearTimeout(this.timeout),c.options.delay&&c.options.delay.hide?(c.hoverState="out",void(this.timeout=setTimeout(function(){"out"==c.hoverState&&c.hide()},c.options.delay.hide))):c.hide()},show:function(){var b,c,d,e,f,g,h=a.Event("show");if(this.hasContent()&&this.enabled){if(this.$element.trigger(h),h.isDefaultPrevented())return;switch(b=this.tip(),this.setContent(),this.options.animation&&b.addClass("fade"),f="function"==typeof this.options.placement?this.options.placement.call(this,b[0],this.$element[0]):this.options.placement,b.detach().css({top:0,left:0,display:"block"}),this.options.container?b.appendTo(this.options.container):b.insertAfter(this.$element),c=this.getPosition(),d=b[0].offsetWidth,e=b[0].offsetHeight,f){case"bottom":g={top:c.top+c.height,left:c.left+c.width/2-d/2};break;case"top":g={top:c.top-e,left:c.left+c.width/2-d/2};break;case"left":g={top:c.top+c.height/2-e/2,left:c.left-d};break;case"right":g={top:c.top+c.height/2-e/2,left:c.left+c.width}}this.applyPlacement(g,f),this.$element.trigger("shown")}},applyPlacement:function(a,b){var c,d,e,f,g=this.tip(),h=g[0].offsetWidth,i=g[0].offsetHeight;g.offset(a).addClass(b).addClass("in"),c=g[0].offsetWidth,d=g[0].offsetHeight,"top"==b&&d!=i&&(a.top=a.top+i-d,f=!0),"bottom"==b||"top"==b?(e=0,a.left<0&&(e=-2*a.left,a.left=0,g.offset(a),c=g[0].offsetWidth,d=g[0].offsetHeight),this.replaceArrow(e-h+c,c,"left")):this.replaceArrow(d-i,d,"top"),f&&g.offset(a)},replaceArrow:function(a,b,c){this.arrow().css(c,a?50*(1-a/b)+"%":"")},setContent:function(){var a=this.tip(),b=this.getTitle();a.find(".tooltip-inner")[this.options.html?"html":"text"](b),a.removeClass("fade in top bottom left right")},hide:function(){function b(){var b=setTimeout(function(){c.off(a.support.transition.end).detach()},500);c.one(a.support.transition.end,function(){clearTimeout(b),c.detach()})}var c=this.tip(),d=a.Event("hide");return this.$element.trigger(d),d.isDefaultPrevented()?void 0:(c.removeClass("in"),a.support.transition&&this.$tip.hasClass("fade")?b():c.detach(),this.$element.trigger("hidden"),this)},fixTitle:function(){var a=this.$element;(a.attr("title")||"string"!=typeof a.attr("data-original-title"))&&a.attr("data-original-title",a.attr("title")||"").attr("title","")},hasContent:function(){return this.getTitle()},getPosition:function(){var b=this.$element[0];return a.extend({},"function"==typeof b.getBoundingClientRect?b.getBoundingClientRect():{width:b.offsetWidth,height:b.offsetHeight},this.$element.offset())},getTitle:function(){var a,b=this.$element,c=this.options;return a=b.attr("data-original-title")||("function"==typeof c.title?c.title.call(b[0]):c.title)},tip:function(){return this.$tip=this.$tip||a(this.options.template)},arrow:function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},validate:function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},enable:function(){this.enabled=!0},disable:function(){this.enabled=!1},toggleEnabled:function(){this.enabled=!this.enabled},toggle:function(b){var c=b?a(b.currentTarget)[this.type](this._options).data(this.type):this;c.tip().hasClass("in")?c.hide():c.show()},destroy:function(){this.hide().$element.off("."+this.type).removeData(this.type)}};var g=a.fn.tooltip;a.fn.tooltip=function(b){return this.each(function(){var c=a(this),d=c.data("tooltip"),e="object"==typeof b&&b;d||c.data("tooltip",d=new n(this,e)),"string"==typeof b&&d[b]()})},a.fn.tooltip.Constructor=n,a.fn.tooltip.defaults={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,container:!1},a.fn.tooltip.noConflict=function(){return a.fn.tooltip=g,this};var o=function(a,b){this.init("popover",a,b)};o.prototype=a.extend({},a.fn.tooltip.Constructor.prototype,{constructor:o,setContent:function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.options.html?"html":"text"](b),a.find(".popover-content")[this.options.html?"html":"text"](c),a.removeClass("fade top bottom left right in")},hasContent:function(){return this.getTitle()||this.getContent()},getContent:function(){var a,b=this.$element,c=this.options;return a=("function"==typeof c.content?c.content.call(b[0]):c.content)||b.attr("data-content")},tip:function(){return this.$tip||(this.$tip=a(this.options.template)),this.$tip},destroy:function(){this.hide().$element.off("."+this.type).removeData(this.type)}});var g=a.fn.popover;a.fn.popover=function(b){return this.each(function(){var c=a(this),d=c.data("popover"),e="object"==typeof b&&b;d||c.data("popover",d=new o(this,e)),"string"==typeof b&&d[b]()})},a.fn.popover.Constructor=o,a.fn.popover.defaults=a.extend({},a.fn.tooltip.defaults,{placement:"right",trigger:"click",content:"",template:'<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'}),a.fn.popover.noConflict=function(){return a.fn.popover=g,this},d.prototype={constructor:d,refresh:function(){var b,c=this;this.offsets=a([]),this.targets=a([]),b=this.$body.find(this.selector).map(function(){var b=a(this),d=b.data("target")||b.attr("href"),e=/^#\w/.test(d)&&a(d);return e&&e.length&&[[e.position().top+(!a.isWindow(c.$scrollElement.get(0))&&c.$scrollElement.scrollTop()),d]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){c.offsets.push(this[0]),c.targets.push(this[1])})},process:function(){var a,b=this.$scrollElement.scrollTop()+this.options.offset,c=this.$scrollElement[0].scrollHeight||this.$body[0].scrollHeight,d=c-this.$scrollElement.height(),e=this.offsets,f=this.targets,g=this.activeTarget;if(b>=d)return g!=(a=f.last()[0])&&this.activate(a);for(a=e.length;a--;)g!=f[a]&&b>=e[a]&&(!e[a+1]||b<=e[a+1])&&this.activate(f[a])},activate:function(b){var c,d;this.activeTarget=b,a(this.selector).parent(".active").removeClass("active"),d=this.selector+'[data-target="'+b+'"],'+this.selector+'[href="'+b+'"]',c=a(d).parent("li").addClass("active"),c.parent(".dropdown-menu").length&&(c=c.closest("li.dropdown").addClass("active")),c.trigger("activate")}};var g=a.fn.scrollspy;a.fn.scrollspy=function(b){return this.each(function(){var c=a(this),e=c.data("scrollspy"),f="object"==typeof b&&b;e||c.data("scrollspy",e=new d(this,f)),"string"==typeof b&&e[b]()})},a.fn.scrollspy.Constructor=d,a.fn.scrollspy.defaults={offset:10},a.fn.scrollspy.noConflict=function(){return a.fn.scrollspy=g,this},a(window).on("load",function(){a('[data-spy="scroll"]').each(function(){var b=a(this);b.scrollspy(b.data())})});var p=function(b){this.element=a(b)};p.prototype={constructor:p,show:function(){var b,c,d,e=this.element,f=e.closest("ul:not(.dropdown-menu)"),g=e.attr("data-target");g||(g=e.attr("href"),g=g&&g.replace(/.*(?=#[^\s]*$)/,"")),e.parent("li").hasClass("active")||(b=f.find(".active:last a")[0],d=a.Event("show",{relatedTarget:b}),e.trigger(d),d.isDefaultPrevented()||(c=a(g),this.activate(e.parent("li"),f),this.activate(c,c.parent(),function(){e.trigger({type:"shown",relatedTarget:b})})))},activate:function(b,c,d){function e(){f.removeClass("active").find("> .dropdown-menu > .active").removeClass("active"),b.addClass("active"),g?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu")&&b.closest("li.dropdown").addClass("active"),d&&d()}var f=c.find("> .active"),g=d&&a.support.transition&&f.hasClass("fade");g?f.one(a.support.transition.end,e):e(),f.removeClass("in")}};var g=a.fn.tab;a.fn.tab=function(b){return this.each(function(){var c=a(this),d=c.data("tab");d||c.data("tab",d=new p(this)),"string"==typeof b&&d[b]()})},a.fn.tab.Constructor=p,a.fn.tab.noConflict=function(){return a.fn.tab=g,this},a(document).on("click.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(b){b.preventDefault(),a(this).tab("show")});var q=function(b,c){this.$element=a(b),this.options=a.extend({},a.fn.typeahead.defaults,c),this.matcher=this.options.matcher||this.matcher,this.sorter=this.options.sorter||this.sorter,this.highlighter=this.options.highlighter||this.highlighter,this.updater=this.options.updater||this.updater,this.source=this.options.source,this.$menu=a(this.options.menu),this.shown=!1,this.listen()};q.prototype={constructor:q,select:function(){var a=this.$menu.find(".active").attr("data-value");return this.$element.val(this.updater(a)).change(),this.hide()},updater:function(a){return a},show:function(){var b=a.extend({},this.$element.position(),{height:this.$element[0].offsetHeight});return this.$menu.insertAfter(this.$element).css({top:b.top+b.height,left:b.left}).show(),this.shown=!0,this},hide:function(){return this.$menu.hide(),this.shown=!1,this},lookup:function(b){var c;return this.query=this.$element.val(),!this.query||this.query.length<this.options.minLength?this.shown?this.hide():this:(c=a.isFunction(this.source)?this.source(this.query,a.proxy(this.process,this)):this.source,c?this.process(c):this)},process:function(b){var c=this;return b=a.grep(b,function(a){return c.matcher(a)}),b=this.sorter(b),b.length?this.render(b.slice(0,this.options.items)).show():this.shown?this.hide():this},matcher:function(a){return~a.toLowerCase().indexOf(this.query.toLowerCase())},sorter:function(a){for(var b,c=[],d=[],e=[];b=a.shift();)b.toLowerCase().indexOf(this.query.toLowerCase())?~b.indexOf(this.query)?d.push(b):e.push(b):c.push(b);return c.concat(d,e)},highlighter:function(a){var b=this.query.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&");return a.replace(new RegExp("("+b+")","ig"),function(a,b){return"<strong>"+b+"</strong>"})},render:function(b){var c=this;return b=a(b).map(function(b,d){return b=a(c.options.item).attr("data-value",d),b.find("a").html(c.highlighter(d)),b[0]}),b.first().addClass("active"),this.$menu.html(b),this},next:function(b){var c=this.$menu.find(".active").removeClass("active"),d=c.next();d.length||(d=a(this.$menu.find("li")[0])),d.addClass("active")},prev:function(a){var b=this.$menu.find(".active").removeClass("active"),c=b.prev();c.length||(c=this.$menu.find("li").last()),c.addClass("active")},listen:function(){this.$element.on("focus",a.proxy(this.focus,this)).on("blur",a.proxy(this.blur,this)).on("keypress",a.proxy(this.keypress,this)).on("keyup",a.proxy(this.keyup,this)),this.eventSupported("keydown")&&this.$element.on("keydown",a.proxy(this.keydown,this)),this.$menu.on("click",a.proxy(this.click,this)).on("mouseenter","li",a.proxy(this.mouseenter,this)).on("mouseleave","li",a.proxy(this.mouseleave,this))},eventSupported:function(a){var b=a in this.$element;return b||(this.$element.setAttribute(a,"return;"),b="function"==typeof this.$element[a]),b},move:function(a){if(this.shown){switch(a.keyCode){case 9:case 13:case 27:a.preventDefault();break;case 38:a.preventDefault(),this.prev();break;case 40:a.preventDefault(),this.next()}a.stopPropagation()}},keydown:function(b){this.suppressKeyPressRepeat=~a.inArray(b.keyCode,[40,38,9,13,27]),this.move(b)},keypress:function(a){this.suppressKeyPressRepeat||this.move(a)},keyup:function(a){switch(a.keyCode){case 40:case 38:case 16:case 17:case 18:break;case 9:case 13:if(!this.shown)return;this.select();break;case 27:if(!this.shown)return;this.hide();break;default:this.lookup()}a.stopPropagation(),a.preventDefault()},focus:function(a){this.focused=!0},blur:function(a){this.focused=!1,!this.mousedover&&this.shown&&this.hide()},click:function(a){a.stopPropagation(),a.preventDefault(),this.select(),this.$element.focus()},mouseenter:function(b){this.mousedover=!0,this.$menu.find(".active").removeClass("active"),a(b.currentTarget).addClass("active")},mouseleave:function(a){this.mousedover=!1,!this.focused&&this.shown&&this.hide()}};var g=a.fn.typeahead;a.fn.typeahead=function(b){return this.each(function(){var c=a(this),d=c.data("typeahead"),e="object"==typeof b&&b;d||c.data("typeahead",d=new q(this,e)),"string"==typeof b&&d[b]()})},a.fn.typeahead.defaults={source:[],items:8,menu:'<ul class="typeahead dropdown-menu"></ul>',item:'<li><a href="#"></a></li>',minLength:1},a.fn.typeahead.Constructor=q,a.fn.typeahead.noConflict=function(){return a.fn.typeahead=g,this},a(document).on("focus.typeahead.data-api",'[data-provide="typeahead"]',function(b){var c=a(this);c.data("typeahead")||c.typeahead(c.data())});var r=function(b,c){this.options=a.extend({},a.fn.affix.defaults,c),this.$window=a(window).on("scroll.affix.data-api",a.proxy(this.checkPosition,this)).on("click.affix.data-api",a.proxy(function(){setTimeout(a.proxy(this.checkPosition,this),1)},this)),this.$element=a(b),this.checkPosition()};r.prototype.checkPosition=function(){if(this.$element.is(":visible")){var b,c=a(document).height(),d=this.$window.scrollTop(),e=this.$element.offset(),f=this.options.offset,g=f.bottom,h=f.top,i="affix affix-top affix-bottom";"object"!=typeof f&&(g=h=f),"function"==typeof h&&(h=f.top()),"function"==typeof g&&(g=f.bottom()),b=null!=this.unpin&&d+this.unpin<=e.top?!1:null!=g&&e.top+this.$element.height()>=c-g?"bottom":null!=h&&h>=d?"top":!1,this.affixed!==b&&(this.affixed=b,this.unpin="bottom"==b?e.top-d:null,this.$element.removeClass(i).addClass("affix"+(b?"-"+b:"")))}};var g=a.fn.affix;a.fn.affix=function(b){return this.each(function(){var c=a(this),d=c.data("affix"),e="object"==typeof b&&b;d||c.data("affix",d=new r(this,e)),"string"==typeof b&&d[b]()})},a.fn.affix.Constructor=r,a.fn.affix.defaults={offset:0},a.fn.affix.noConflict=function(){return a.fn.affix=g,this},a(window).on("load",function(){a('[data-spy="affix"]').each(function(){var b=a(this),c=b.data();c.offset=c.offset||{},c.offsetBottom&&(c.offset.bottom=c.offsetBottom),c.offsetTop&&(c.offset.top=c.offsetTop),b.affix(c)})})});
- /**
- * Essential is a clean and customizable theme.
- *
- * @package theme_essential
- * @copyright 2016 Gareth J Barnard
- * @copyright 2015 Gareth J Barnard
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
- define('theme_essential/anti_gravity', ["jquery","core/log"],function(a,b){"use strict";b.debug("Essential anti gravity AMD initialised"),a(document).ready(function(){var b=220,c=500;a(window).scroll(function(){a(this).scrollTop()>b?a(".back-to-top").fadeIn(c):a(".back-to-top").fadeOut(c)}),a(".back-to-top").click(function(b){return b.preventDefault(),a("html, body").animate({scrollTop:0},c),!1}),a("a[href='#region-main']").click(function(b){b.preventDefault();var d=a("#region-main");return a("html, body").animate({scrollTop:d.height()},c),!1})})});
- define('theme_essential/jBreadCrumb', ["jquery","core/log"],function(a,b){"use strict";function c(){g="object"==typeof a.easing?"easeOutQuad":"swing",j=a(i).find("li"),a(i).find("ul").wrap('<div style="overflow:hidden; position:relative; width: '+a(i).css("width")+';"><div>'),j.length>0&&(a(j[j.length-1]).addClass("last"),a(j[0]).addClass("first"),j.length>h.minimumCompressionElements&&d())}function d(){var b=a(j[j.length-1]);a(b).width()>h.maxFinalElementLength&&(h.beginningElementsToLeaveOpen>0&&h.beginningElementsToLeaveOpen--,h.endElementsToLeaveOpen>0&&h.endElementsToLeaveOpen--),a(b).width()<h.maxFinalElementLength&&a(b).width()>h.minFinalElementLength&&h.beginningElementsToLeaveOpen>0&&h.beginningElementsToLeaveOpen--;var c=j.length-1-h.endElementsToLeaveOpen;a(j).each(function(b,d){if(b>h.beginningElementsToLeaveOpen&&c>b){a(d).find("a").wrap("<span></span>").width(a(d).find("a").width()+h.previewWidth);var g={id:b,width:a(d).width(),listElement:a(d).find("span"),isAnimating:!1,element:a(d).find("span")};a(d).bind("mouseover",g,e).bind("mouseout",g,f),a(d).find("a").unbind("mouseover",e).unbind("mouseout",f),d.autoInterval=setInterval(function(){clearInterval(d.autoInterval),a(d).find("span").animate({width:h.previewWidth},h.timeInitialCollapse,h.easing)},150*(b-2))}})}function e(b){var c=b.data.width;return a(b.data.element).stop(),a(b.data.element).animate({width:c+h.previewWidth/2},{duration:h.timeExpansionAnimation,easing:h.easing,queue:!1}),!1}function f(b){return a(b.data.element).stop(),a(b.data.element).animate({width:h.previewWidth},{duration:h.timeCompressionAnimation,easing:h.easing,queue:!1}),!1}b.debug("Essential jBreadCrumb AMD");var g,h={},i={},j={};return a.fn.jBreadCrumb=function(b){return h=a.extend({},a.fn.jBreadCrumb.defaults,b),this.each(function(){i=a(this),c()})},a.fn.jBreadCrumb.defaults={maxFinalElementLength:Math.round(.05*a(window).width()),minFinalElementLength:Math.round(.02*a(window).width()),minimumCompressionElements:1,endElementsToLeaveOpen:0,beginningElementsToLeaveOpen:0,timeExpansionAnimation:500,timeCompressionAnimation:400,timeInitialCollapse:500,easing:"swing",previewWidth:Math.round(.015*a(window).width())},{init:function(){a(document).ready(function(a){a(".breadcrumb.style1").jBreadCrumb()}),b.debug("Essential jBreadCrumb AMD init")}}});
- /**
- * Essential is a clean and customizable theme.
- *
- * @package theme_essential
- * @copyright 2016 Gareth J Barnard
- * @copyright 2015 Gareth J Barnard
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
- define('theme_essential/inspector_scourer', ["jquery","jqueryui","core/log"],function(a,b,c){"use strict";return c.debug("Essential Inspector Scourer AMD initialised"),{init:function(b){a(document).ready(function(a,d){c.debug("Essential Inspector Scourer AMD init"),c.debug("Essential Inspector Scourer AJAX File: "+b.theme),a("#courseitemsearch").autocomplete({source:b.theme,appendTo:"#courseitemsearchresults",minLength:2,select:function(a,b){var c=b.item.id;"#"!=c&&(location.href=c)}}).prop("disabled",!1)})}}});
- /**
- * Essential is a clean and customizable theme.
- *
- * @package theme_essential
- * @copyright 2016 Gareth J Barnard
- * @copyright 2015 Gareth J Barnard
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
- define('theme_essential/course_navigation', ["jquery","core/log"],function(a,b){"use strict";return b.debug("Essential Course Navigation AMD."),{init:function(){b.debug("Essential Course Navigation AMD init."),a(document).ready(function(a){var c=0,d=500,e=0;a(".navbar").length&&(e=a(".navbar"),c=e.height(),b.debug("Essential Course Navigation AMD navbar height: "+c));var f=location.href,g=location.href.indexOf("#");if(b.debug("Essential Course Navigation AMD navigation page_href_base 1: "+f),b.debug("Essential Course Navigation AMD navigation hrefIndex: "+g),-1!=g){f=location.href.substring(0,g),b.debug("Essential Course Navigation AMD navigation page_href_base 2: "+f);var h=location.href,i=h.substring(h.indexOf("#")+1);b.debug("Essential Course Navigation AMD navigation page hash: "+i);var j=a('[id="'+i+'"]'),k=j.offset().top,l=k;e&&(l-="fixed"==e.css("position")?c:2*c),a("html, body").animate({scrollTop:l},d),b.debug("Essential Course Navigation AMD navigation page scrollTop: "+l),b.debug("Essential Course Navigation AMD navigation page target offset: "+k)}a('a[href*="#section-"]').each(function(){var g=this.href.substring(0,this.href.indexOf("#"));b.debug("Essential Course Navigation AMD navigation element: "+a(this).attr("href")),b.debug("Essential Course Navigation AMD navigation link_href_base: "+g),f==g&&a(this).click(function(f){f.preventDefault();var g=this.href;b.debug("Essential Course Navigation AMD navigation element url: "+g);var h=g.substring(g.indexOf("#")+1);b.debug("Essential Course Navigation AMD navigation element hash: "+h);var i=a('[id="'+h+'"]'),j=i.offset().top,k=j;e&&(k-="fixed"==e.css("position")?c:2*c),a("html, body").animate({scrollTop:k},d),b.debug("Essential Course Navigation AMD navigation element scrollTop: "+k),b.debug("Essential Course Navigation AMD navigation element target offset: "+j)})})})}}});
- define('theme_essential/carousel', ["jquery","theme_bootstrapbase/bootstrap","core/log"],function(a,b,c){"use strict";c.debug("Essential carousel AMD");var d=function(b,c){this.$element=a(b),this.$indicators=this.$element.find(".carousel-indicators"),this.options=c,"hover"==this.options.pause&&this.$element.on("mouseenter",a.proxy(this.pause,this)).on("mouseleave",a.proxy(this.cycle,this))};d.prototype={cycle:function(b){return b||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.dirright?this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.prev,this),this.options.interval)):this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},getActiveIndex:function(){return this.$active=this.$element.find(".item.active"),this.$items=this.$active.parent().children(),this.$items.index(this.$active)},to:function(b){var c=this.getActiveIndex(),d=this;if(!(b>this.$items.length-1||0>b))return this.sliding?this.$element.one("slid",function(){d.to(b)}):c==b?this.pause().cycle():this.slide(b>c?"next":"prev",a(this.$items[b]))},pause:function(b){return b||(this.paused=!0),this.$element.find(".next, .prev").length&&a.support.transition.end&&(this.$element.trigger(a.support.transition.end),this.cycle(!0)),clearInterval(this.interval),this.interval=null,this},next:function(){return this.sliding?void 0:this.slide("next")},prev:function(){return this.sliding?void 0:this.slide("prev")},slide:function(b,c){var d,e=this.$element.find(".item.active"),f=c||e[b](),g=this.interval,h="next"==b?"left":"right",i="next"==b?"first":"last",j=this;if(this.sliding=!0,g&&this.pause(),f=f.length?f:this.$element.find(".item")[i](),d=a.Event("slide",{relatedTarget:f[0],direction:h}),!f.hasClass("active")){if(this.$indicators.length&&(this.$indicators.find(".active").removeClass("active"),this.$element.one("slid",function(){var b=a(j.$indicators.children()[j.getActiveIndex()]);b&&b.addClass("active")})),a.support.transition&&this.$element.hasClass("slide")){if(this.$element.trigger(d),d.isDefaultPrevented())return;f.addClass(b),f[0].offsetWidth,e.addClass(h),f.addClass(h),this.$element.one(a.support.transition.end,function(){f.removeClass([b,h].join(" ")).addClass("active"),e.removeClass(["active",h].join(" ")),j.sliding=!1,setTimeout(function(){j.$element.trigger("slid")},0)})}else{if(this.$element.trigger(d),d.isDefaultPrevented())return;e.removeClass("active"),f.addClass("active"),this.sliding=!1,this.$element.trigger("slid")}return g&&this.cycle(),this}}};var e=a.fn.carousel;return a.fn.carousel=function(b){return this.each(function(){var c=a(this),e=c.data("carousel"),f=a.extend({},a.fn.carousel.defaults,"object"==typeof b&&b),g="string"==typeof b?b:f.slide;e||c.data("carousel",e=new d(this,f)),"number"==typeof b?e.to(b):g?e[g]():f.interval&&e.pause().cycle()})},a.fn.carousel.defaults={interval:5e3,pause:"hover"},a.fn.carousel.Constructor=d,a.fn.carousel.noConflict=function(){return a.fn.carousel=e,this},a(document).on("click.carousel.data-api","[data-slide], [data-slide-to]",function(b){var c,d,e=a(this),f=a(e.attr("data-target")||(c=e.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,"")),g=a.extend({},f.data(),e.data());f.carousel(g),(d=e.attr("data-slide-to"))&&f.data("carousel").pause().to(d).cycle(),b.preventDefault()}),{init:function(b){c.debug("Essential carousel AMD init, slide interval: "+b.slideinterval+", slideright: "+b.slideright),a(document).ready(function(a){a("#essentialCarousel").carousel({interval:b.slideinterval,dirright:b.slideright})})}}});
- /**
- * Essential is a clean and customizable theme.
- *
- * @package theme_essential
- * @copyright 2016 Gareth J Barnard
- * @copyright 2015 Gareth J Barnard
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
- define('theme_essential/coloursswitcher', ["jquery","core/log"],function(a,b){"use strict";return b.debug("Essential Colour Switcher AMD"),!function(a){var c=function(b,c){this.$element=a(b),this.SCHEMES=["default","alternative1","alternative2","alternative3","alternative4"],this.scheme="default",this.init(c)};c.prototype={constructor:c,init:function(c){var d,e;b.debug("Colour switcher on element: "+c.div);var f=a("body");for(d in this.SCHEMES){e=this.SCHEMES[d],f.hasClass("essential-colours-"+e)&&(this.scheme=e,b.debug("Colour switcher current scheme: "+e));var g=this;a(c.div+" ."+e).each(function(){b.debug("Colour switcher 'init' each: "+e),a(this).click({scheme:e,us:g},g.setScheme)})}},setScheme:function(a){if(a.preventDefault(),b.debug("Colour switcher 'setScheme' scheme: "+a.data.scheme),b.debug("Colour switcher 'setScheme' our scheme: "+a.data.us.scheme),a.data.scheme!=a.data.us.scheme){var c="essential-colours-";a.data.us.$element.removeClass(c+a.data.us.scheme).addClass(c+a.data.scheme),a.data.us.scheme=a.data.scheme,M.util.set_user_preference("theme_essential_colours",a.data.us.scheme),b.debug("Colour switcher 'setScheme' our scheme now: "+a.data.us.scheme)}}};var d=a.fn.ColoursSwitcher;a.fn.ColoursSwitcher=function(a){return new c(this,a),this},a.fn.ColoursSwitcher.noConflict=function(){return a.fn.ColoursSwitcher=d,this}}(a),{init:function(c){a(document).ready(function(a){return b.debug("Essential Colour Switcher AMD init"),a(document.body).ColoursSwitcher(c)})}}});
- /**
- * Essential is a clean and customizable theme.
- *
- * @package theme_essential
- * @copyright 2016 Gareth J Barnard
- * @copyright 2015 Gareth J Barnard
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
- define('theme_essential/affix', ["jquery","theme_bootstrapbase/bootstrap","core/log"],function(a,b,c){"use strict";return c.debug("Essential affix AMD"),{init:function(){a(document).ready(function(a){if(a("#essentialnavbar").length){var b=a("#essentialnavbar"),d=a("#page-header").height();c.debug("Essential affix AMD pageheaderHeight: "+d),b.affix({offset:{top:function(){var e=a(window).scrollTop();c.debug("Essential affix AMD wst: "+e);var f=d-e;return c.debug("Essential affix AMD diff: "+f),0>f&&(f=0),b.css("top",f+"px"),d}}})}}),c.debug("Essential affix AMD init")}}});
- /**
- * Essential is a clean and customizable theme.
- *
- * @package theme_essential
- * @copyright 2016 Gareth J Barnard
- * @copyright 2015 Gareth J Barnard
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
- define('theme_essential/header', ["jquery","core/log"],function(a,b){"use strict";return b.debug("Essential header AMD"),{init:function(){a(document).ready(function(a){if(a("#page-header .titlearea").length&&a("#essentialicons").length){var b=a("#page-header .titlearea");a("#essentialicons").on("hide",function(){b.fadeIn()}),a("#essentialicons").on("show",function(){b.fadeOut()})}}),b.debug("Essential header AMD init")}}});
- define('theme_essential/fitvids', ["jquery","core/log"],function(a,b){"use strict";/*!
- * FitVids 1.1.
- *
- * Copyright 2013, Chris Coyier - http://css-tricks.com + Dave Rupert - http://daverupert.com
- * Credit to Thierry Koblentz - http://www.alistapart.com/articles/creating-intrinsic-ratios-for-video/
- * Released under the WTFPL license - http://sam.zoy.org/wtfpl/
- *
- * Adapted to AMD for Moodle by Gareth J Barnard.
- *
- */
- return b.debug("Essential fitvids AMD"),a.fn.fitVids=function(c){var d={customSelector:null,ignore:"object[type='application/pdf']"};if(!document.getElementById("fit-vids-style")){var e=document.head||document.getElementsByTagName("head")[0],f=".fluid-width-video-wrapper{width:100%;position:relative;padding:0;}.fluid-width-video-wrapper iframe,.fluid-width-video-wrapper object,.fluid-width-video-wrapper embed {position:absolute;top:0;left:0;width:100%;height:100%;}",g=document.createElement("div");g.innerHTML='<p>x</p><style id="fit-vids-style">'+f+"</style>",e.appendChild(g.childNodes[1])}return c&&a.extend(d,c),this.each(function(){var c=["iframe[src*='player.vimeo.com']","iframe[src*='youtube.com']","iframe[src*='youtube-nocookie.com']","iframe[src*='kickstarter.com'][src*='video.html']","object","embed"];d.customSelector&&c.push(d.customSelector);var e=".fitvidsignore";d.ignore&&(e=e+", "+d.ignore);var f=a(this).find(c.join(","));f=f.not("object object"),f=f.not(e),f.each(function(){var c=a(this);if(b.debug("FitVids attempt on: "+c.prop("outerHTML")),c.parents(e).length>0)return void b.debug("FitVids not on (ignoreList)");var d=c.attr("id");if(d){if("onlineaudiorecorder"===d)return void b.debug("FitVids not on (onlineaudiorecorder)");if(d.indexOf("mp3")>=0)return void b.debug("FitVids not on (core media mp3)")}if(b.debug("FitVids attempt successful"),!("embed"===this.tagName.toLowerCase()&&c.parent("object").length||c.parent(".fluid-width-video-wrapper").length)){c.css("height")||c.css("width")||!isNaN(c.attr("height"))&&!isNaN(c.attr("width"))||(c.attr("height",9),c.attr("width",16));var f="object"===this.tagName.toLowerCase()||c.attr("height")&&!isNaN(parseInt(c.attr("height"),10))?parseInt(c.attr("height"),10):c.height(),g=isNaN(parseInt(c.attr("width"),10))?c.width():parseInt(c.attr("width"),10),h=f/g;if(!c.attr("id")){var i="fitvid"+Math.floor(999999*Math.random());c.attr("id",i)}c.wrap('<div class="fluid-width-video-wrapper"></div>').parent(".fluid-width-video-wrapper").css("padding-top",100*h+"%"),c.removeAttr("height").removeAttr("width")}})})},{init:function(){a(document).ready(function(a){a("#page").fitVids()}),b.debug("Essential fitvids AMD init")}}});
- /**
- * Essential is a clean and customizable theme.
- *
- * @package theme_essential
- * @copyright 2016 Gareth J Barnard
- * @copyright 2015 Gareth J Barnard
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
- define('theme_essential/footer', ["jquery","core/log"],function(a,b){"use strict";return b.debug("Essential Footer AMD."),{init:function(){b.debug("Essential Footer AMD init."),a(document).ready(function(a){if(a("#page-footer").length){var c=a(document).height();if(a("html").height()<c){b.debug("Essential Footer AMD adjusting footer position.");var d=a("#page-footer"),e=d.offset().top,f=d.outerHeight();b.debug("Calculated page footer offset: "+f+"."),f=c-f,b.debug("Old footer offset: "+e+"."),b.debug("Calculated footer offset: "+f+"."),b.debug("Old document height: "+c+"."),d.offset({top:f,left:0}),d.css("left",0);var g=d.offset().top;b.debug("New footer offset: "+g+"."),b.debug("New document height: "+a(document).height()+".")}}})}}});
- /*!
- Holder - client side image placeholders
- Version 2.9.0+f2dkw
- © 2015 Ivan Malopinsky - http://imsky.co
- Site: http://holderjs.com
- Issues: https://github.com/imsky/holder/issues
- License: MIT
- */
- !function(e){if(e.document){var t=e.document;t.querySelectorAll||(t.querySelectorAll=function(n){var r,i=t.createElement("style"),o=[];for(t.documentElement.firstChild.appendChild(i),t._qsa=[],i.styleSheet.cssText=n+"{x-qsa:expression(document._qsa && document._qsa.push(this))}",e.scrollBy(0,0),i.parentNode.removeChild(i);t._qsa.length;)r=t._qsa.shift(),r.style.removeAttribute("x-qsa"),o.push(r);return t._qsa=null,o}),t.querySelector||(t.querySelector=function(e){var n=t.querySelectorAll(e);return n.length?n[0]:null}),t.getElementsByClassName||(t.getElementsByClassName=function(e){return e=String(e).replace(/^|\s+/g,"."),t.querySelectorAll(e)}),Object.keys||(Object.keys=function(e){if(e!==Object(e))throw TypeError("Object.keys called on non-object");var t,n=[];for(t in e)Object.prototype.hasOwnProperty.call(e,t)&&n.push(t);return n}),Array.prototype.forEach||(Array.prototype.forEach=function(e){if(void 0===this||null===this)throw TypeError();var t=Object(this),n=t.length>>>0;if("function"!=typeof e)throw TypeError();var r,i=arguments[1];for(r=0;n>r;r++)r in t&&e.call(i,t[r],r,t)}),function(e){var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";e.atob=e.atob||function(e){e=String(e);var n,r=0,i=[],o=0,a=0;if(e=e.replace(/\s/g,""),e.length%4===0&&(e=e.replace(/=+$/,"")),e.length%4===1)throw Error("InvalidCharacterError");if(/[^+/0-9A-Za-z]/.test(e))throw Error("InvalidCharacterError");for(;r<e.length;)n=t.indexOf(e.charAt(r)),o=o<<6|n,a+=6,24===a&&(i.push(String.fromCharCode(o>>16&255)),i.push(String.fromCharCode(o>>8&255)),i.push(String.fromCharCode(255&o)),a=0,o=0),r+=1;return 12===a?(o>>=4,i.push(String.fromCharCode(255&o))):18===a&&(o>>=2,i.push(String.fromCharCode(o>>8&255)),i.push(String.fromCharCode(255&o))),i.join("")},e.btoa=e.btoa||function(e){e=String(e);var n,r,i,o,a,s,l,h=0,u=[];if(/[^\x00-\xFF]/.test(e))throw Error("InvalidCharacterError");for(;h<e.length;)n=e.charCodeAt(h++),r=e.charCodeAt(h++),i=e.charCodeAt(h++),o=n>>2,a=(3&n)<<4|r>>4,s=(15&r)<<2|i>>6,l=63&i,h===e.length+2?(s=64,l=64):h===e.length+1&&(l=64),u.push(t.charAt(o),t.charAt(a),t.charAt(s),t.charAt(l));return u.join("")}}(e),Object.prototype.hasOwnProperty||(Object.prototype.hasOwnProperty=function(e){var t=this.__proto__||this.constructor.prototype;return e in this&&(!(e in t)||t[e]!==this[e])}),function(){if("performance"in e==!1&&(e.performance={}),Date.now=Date.now||function(){return(new Date).getTime()},"now"in e.performance==!1){var t=Date.now();performance.timing&&performance.timing.navigationStart&&(t=performance.timing.navigationStart),e.performance.now=function(){return Date.now()-t}}}(),e.requestAnimationFrame||(e.webkitRequestAnimationFrame?!function(e){e.requestAnimationFrame=function(t){return webkitRequestAnimationFrame(function(){t(e.performance.now())})},e.cancelAnimationFrame=webkitCancelAnimationFrame}(e):e.mozRequestAnimationFrame?!function(e){e.requestAnimationFrame=function(t){return mozRequestAnimationFrame(function(){t(e.performance.now())})},e.cancelAnimationFrame=mozCancelAnimationFrame}(e):!function(e){e.requestAnimationFrame=function(t){return e.setTimeout(t,1e3/60)},e.cancelAnimationFrame=e.clearTimeout}(e))}}(this),function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define('theme_essential/holder', [],t):"object"==typeof exports?exports.Holder=t():e.Holder=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return e[r].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){e.exports=n(1)},function(e,t,n){(function(t){function r(e,t,n,r){var a=i(n.substr(n.lastIndexOf(e.domain)),e);a&&o({mode:null,el:r,flags:a,engineSettings:t})}function i(e,t){var n={theme:T(F.settings.themes.gray,null),stylesheets:t.stylesheets,instanceOptions:t},r=e.split("?"),i=r[0].split("/");n.holderURL=e;var o=i[1],a=o.match(/([\d]+p?)x([\d]+p?)/);if(!a)return!1;if(n.fluid=-1!==o.indexOf("p"),n.dimensions={width:a[1].replace("p","%"),height:a[2].replace("p","%")},2===r.length){var s=v.parse(r[1]);if(s.bg&&(n.theme.bg=w.parseColor(s.bg)),s.fg&&(n.theme.fg=w.parseColor(s.fg)),s.bg&&!s.fg&&(n.autoFg=!0),s.theme&&n.instanceOptions.themes.hasOwnProperty(s.theme)&&(n.theme=T(n.instanceOptions.themes[s.theme],null)),s.text&&(n.text=s.text),s.textmode&&(n.textmode=s.textmode),s.size&&(n.size=s.size),s.font&&(n.font=s.font),s.align&&(n.align=s.align),s.lineWrap&&(n.lineWrap=s.lineWrap),n.nowrap=w.truthy(s.nowrap),n.auto=w.truthy(s.auto),n.outline=w.truthy(s.outline),w.truthy(s.random)){F.vars.cache.themeKeys=F.vars.cache.themeKeys||Object.keys(n.instanceOptions.themes);var l=F.vars.cache.themeKeys[0|Math.random()*F.vars.cache.themeKeys.length];n.theme=T(n.instanceOptions.themes[l],null)}}return n}function o(e){var t=e.mode,n=e.el,r=e.flags,i=e.engineSettings,o=r.dimensions,s=r.theme,l=o.width+"x"+o.height;t=null==t?r.fluid?"fluid":"image":t;var d=/holder_([a-z]+)/g,c=!1;if(null!=r.text&&(s.text=r.text,"object"===n.nodeName.toLowerCase())){for(var f=s.text.split("\\n"),p=0;p<f.length;p++)f[p]=w.encodeHtmlEntity(f[p]);s.text=f.join("\\n")}if(s.text){var g=s.text.match(d);null!==g&&g.forEach(function(e){"holder_dimensions"===e&&(s.text=s.text.replace(e,l))})}var m=r.holderURL,v=T(i,null);if(r.font&&(s.font=r.font,!v.noFontFallback&&"img"===n.nodeName.toLowerCase()&&F.setup.supportsCanvas&&"svg"===v.renderer&&(v=T(v,{renderer:"canvas"}))),r.font&&"canvas"==v.renderer&&(v.reRender=!0),"background"==t)null==n.getAttribute("data-background-src")&&x.setAttr(n,{"data-background-src":m});else{var y={};y[F.vars.dataAttr]=m,x.setAttr(n,y)}r.theme=s,n.holderData={flags:r,engineSettings:v},("image"==t||"fluid"==t)&&x.setAttr(n,{alt:s.text?c?s.text:s.text+" ["+l+"]":l});var b={mode:t,el:n,holderSettings:{dimensions:o,theme:s,flags:r},engineSettings:v};"image"==t?(r.auto||(n.style.width=o.width+"px",n.style.height=o.height+"px"),"html"==v.renderer?n.style.backgroundColor=s.background:(a(b),"exact"==r.textmode&&(n.holderData.resizeUpdate=!0,F.vars.resizableImages.push(n),h(n)))):"background"==t&&"html"!=v.renderer?a(b):"fluid"==t&&(n.holderData.resizeUpdate=!0,"%"==o.height.slice(-1)?n.style.height=o.height:null!=r.auto&&r.auto||(n.style.height=o.height+"px"),"%"==o.width.slice(-1)?n.style.width=o.width:null!=r.auto&&r.auto||(n.style.width=o.width+"px"),("inline"==n.style.display||""===n.style.display||"none"==n.style.display)&&(n.style.display="block"),u(n),"html"==v.renderer?n.style.backgroundColor=s.background:(F.vars.resizableImages.push(n),h(n)))}function a(e){function n(){var t=null;switch(l.renderer){case"canvas":t=E(u,e);break;case"svg":t=C(u,e);break;default:throw"Holder: invalid renderer: "+l.renderer}return t}var r=null,i=e.mode,o=e.el,a=e.holderSettings,l=e.engineSettings;switch(l.renderer){case"svg":if(!F.setup.supportsSVG)return;break;case"canvas":if(!F.setup.supportsCanvas)return;break;default:return}var h={width:a.dimensions.width,height:a.dimensions.height,theme:a.theme,flags:a.flags},u=s(h);if(r=n(),null==r)throw"Holder: couldn't render placeholder";"background"==i?(o.style.backgroundImage="url("+r+")",o.style.backgroundSize=h.width+"px "+h.height+"px"):("img"===o.nodeName.toLowerCase()?x.setAttr(o,{src:r}):"object"===o.nodeName.toLowerCase()&&x.setAttr(o,{data:r,type:"image/svg+xml"}),l.reRender&&t.setTimeout(function(){var e=n();if(null==e)throw"Holder: couldn't render placeholder";"img"===o.nodeName.toLowerCase()?x.setAttr(o,{src:e}):"object"===o.nodeName.toLowerCase()&&x.setAttr(o,{data:e,type:"image/svg+xml"})},150)),x.setAttr(o,{"data-holder-rendered":!0})}function s(e){function t(e,t,n,r){t.width=n,t.height=r,e.width=Math.max(e.width,t.width),e.height+=t.height}var n=F.defaults.size;switch(parseFloat(e.theme.size)?n=e.theme.size:parseFloat(e.flags.size)&&(n=e.flags.size),e.font={family:e.theme.font?e.theme.font:"Arial, Helvetica, Open Sans, sans-serif",size:l(e.width,e.height,n,F.defaults.scale),units:e.theme.units?e.theme.units:F.defaults.units,weight:e.theme.fontweight?e.theme.fontweight:"bold"},e.text=e.theme.text||Math.floor(e.width)+"x"+Math.floor(e.height),e.noWrap=e.theme.nowrap||e.flags.nowrap,e.align=e.theme.align||e.flags.align||"center",e.flags.textmode){case"literal":e.text=e.flags.dimensions.width+"x"+e.flags.dimensions.height;break;case"exact":if(!e.flags.exactDimensions)break;e.text=Math.floor(e.flags.exactDimensions.width)+"x"+Math.floor(e.flags.exactDimensions.height)}var r=e.flags.lineWrap||F.setup.lineWrapRatio,i=e.width*r,o=i,a=new y({width:e.width,height:e.height}),s=a.Shape,h=new s.Rect("holderBg",{fill:e.theme.bg});if(h.resize(e.width,e.height),a.root.add(h),e.flags.outline){var u=new S(h.properties.fill);u=u.lighten(u.lighterThan("7f7f7f")?-.1:.1),h.properties.outline={fill:u.toHex(!0),width:2}}var d=e.theme.fg;if(e.flags.autoFg){var c=new S(h.properties.fill),f=new S("fff"),p=new S("000",{alpha:.285714});d=c.blendAlpha(c.lighterThan("7f7f7f")?p:f).toHex(!0)}var g=new s.Group("holderTextGroup",{text:e.text,align:e.align,font:e.font,fill:d});g.moveTo(null,null,1),a.root.add(g);var m=g.textPositionData=z(a);if(!m)throw"Holder: staging fallback not supported yet.";g.properties.leading=m.boundingBox.height;var v=null,w=null;if(m.lineCount>1){var b,x=0,A=0,C=0;w=new s.Group("line"+C),("left"===e.align||"right"===e.align)&&(o=e.width*(1-2*(1-r)));for(var E=0;E<m.words.length;E++){var T=m.words[E];v=new s.Text(T.text);var k="\\n"==T.text;!e.noWrap&&(x+T.width>=o||k===!0)&&(t(g,w,x,g.properties.leading),g.add(w),x=0,A+=g.properties.leading,C+=1,w=new s.Group("line"+C),w.y=A),k!==!0&&(v.moveTo(x,0),x+=m.spaceWidth+T.width,w.add(v))}if(t(g,w,x,g.properties.leading),g.add(w),"left"===e.align)g.moveTo(e.width-i,null,null);else if("right"===e.align){for(b in g.children)w=g.children[b],w.moveTo(e.width-w.width,null,null);g.moveTo(0-(e.width-i),null,null)}else{for(b in g.children)w=g.children[b],w.moveTo((g.width-w.width)/2,null,null);g.moveTo((e.width-g.width)/2,null,null)}g.moveTo(null,(e.height-g.height)/2,null),(e.height-g.height)/2<0&&g.moveTo(null,0,null)}else v=new s.Text(e.text),w=new s.Group("line0"),w.add(v),g.add(w),"left"===e.align?g.moveTo(e.width-i,null,null):"right"===e.align?g.moveTo(0-(e.width-i),null,null):g.moveTo((e.width-m.boundingBox.width)/2,null,null),g.moveTo(null,(e.height-m.boundingBox.height)/2,null);return a}function l(e,t,n,r){var i=parseInt(e,10),o=parseInt(t,10),a=Math.max(i,o),s=Math.min(i,o),l=.8*Math.min(s,a*r);return Math.round(Math.max(n,l))}function h(e){var t;t=null==e||null==e.nodeType?F.vars.resizableImages:[e];for(var n=0,r=t.length;r>n;n++){var i=t[n];if(i.holderData){var o=i.holderData.flags,s=k(i);if(s){if(!i.holderData.resizeUpdate)continue;if(o.fluid&&o.auto){var l=i.holderData.fluidConfig;switch(l.mode){case"width":s.height=s.width/l.ratio;break;case"height":s.width=s.height*l.ratio}}var h={mode:"image",holderSettings:{dimensions:s,theme:o.theme,flags:o},el:i,engineSettings:i.holderData.engineSettings};"exact"==o.textmode&&(o.exactDimensions=s,h.holderSettings.dimensions=o.dimensions),a(h)}else f(i)}}}function u(e){if(e.holderData){var t=k(e);if(t){var n=e.holderData.flags,r={fluidHeight:"%"==n.dimensions.height.slice(-1),fluidWidth:"%"==n.dimensions.width.slice(-1),mode:null,initialDimensions:t};r.fluidWidth&&!r.fluidHeight?(r.mode="width",r.ratio=r.initialDimensions.width/parseFloat(n.dimensions.height)):!r.fluidWidth&&r.fluidHeight&&(r.mode="height",r.ratio=parseFloat(n.dimensions.width)/r.initialDimensions.height),e.holderData.fluidConfig=r}else f(e)}}function d(){var e,n=[],r=Object.keys(F.vars.invisibleImages);r.forEach(function(t){e=F.vars.invisibleImages[t],k(e)&&"img"==e.nodeName.toLowerCase()&&(n.push(e),delete F.vars.invisibleImages[t])}),n.length&&O.run({images:n}),setTimeout(function(){t.requestAnimationFrame(d)},10)}function c(){F.vars.visibilityCheckStarted||(t.requestAnimationFrame(d),F.vars.visibilityCheckStarted=!0)}function f(e){e.holderData.invisibleId||(F.vars.invisibleId+=1,F.vars.invisibleImages["i"+F.vars.invisibleId]=e,e.holderData.invisibleId=F.vars.invisibleId)}function p(e){F.vars.debounceTimer||e.call(this),F.vars.debounceTimer&&t.clearTimeout(F.vars.debounceTimer),F.vars.debounceTimer=t.setTimeout(function(){F.vars.debounceTimer=null,e.call(this)},F.setup.debounce)}function g(){p(function(){h(null)})}var m=n(2),v=n(3),y=n(6),w=n(7),b=n(8),x=n(9),S=n(10),A=n(11),C=n(12),E=n(15),T=w.extend,k=w.dimensionCheck,j=A.svg_ns,O={version:A.version,addTheme:function(e,t){return null!=e&&null!=t&&(F.settings.themes[e]=t),delete F.vars.cache.themeKeys,this},addImage:function(e,t){var n=x.getNodeArray(t);return n.forEach(function(t){var n=x.newEl("img"),r={};r[F.setup.dataAttr]=e,x.setAttr(n,r),t.appendChild(n)}),this},setResizeUpdate:function(e,t){e.holderData&&(e.holderData.resizeUpdate=!!t,e.holderData.resizeUpdate&&h(e))},run:function(e){e=e||{};var n={},a=T(F.settings,e);F.vars.preempted=!0,F.vars.dataAttr=a.dataAttr||F.setup.dataAttr,n.renderer=a.renderer?a.renderer:F.setup.renderer,-1===F.setup.renderers.join(",").indexOf(n.renderer)&&(n.renderer=F.setup.supportsSVG?"svg":F.setup.supportsCanvas?"canvas":"html");var s=x.getNodeArray(a.images),l=x.getNodeArray(a.bgnodes),h=x.getNodeArray(a.stylenodes),u=x.getNodeArray(a.objects);return n.stylesheets=[],n.svgXMLStylesheet=!0,n.noFontFallback=a.noFontFallback?a.noFontFallback:!1,h.forEach(function(e){if(e.attributes.rel&&e.attributes.href&&"stylesheet"==e.attributes.rel.value){var t=e.attributes.href.value,r=x.newEl("a");r.href=t;var i=r.protocol+"//"+r.host+r.pathname+r.search;n.stylesheets.push(i)}}),l.forEach(function(e){if(t.getComputedStyle){var r=t.getComputedStyle(e,null).getPropertyValue("background-image"),s=e.getAttribute("data-background-src"),l=s||r,h=null,u=a.domain+"/",d=l.indexOf(u);if(0===d)h=l;else if(1===d&&"?"===l[0])h=l.slice(1);else{var c=l.substr(d).match(/([^\"]*)"?\)/);if(null!==c)h=c[1];else if(0===l.indexOf("url("))throw"Holder: unable to parse background URL: "+l}if(null!=h){var f=i(h,a);f&&o({mode:"background",el:e,flags:f,engineSettings:n})}}}),u.forEach(function(e){var t={};try{t.data=e.getAttribute("data"),t.dataSrc=e.getAttribute(F.vars.dataAttr)}catch(i){}var o=null!=t.data&&0===t.data.indexOf(a.domain),s=null!=t.dataSrc&&0===t.dataSrc.indexOf(a.domain);o?r(a,n,t.data,e):s&&r(a,n,t.dataSrc,e)}),s.forEach(function(e){var t={};try{t.src=e.getAttribute("src"),t.dataSrc=e.getAttribute(F.vars.dataAttr),t.rendered=e.getAttribute("data-holder-rendered")}catch(i){}var o=null!=t.src,s=null!=t.dataSrc&&0===t.dataSrc.indexOf(a.domain),l=null!=t.rendered&&"true"==t.rendered;o?0===t.src.indexOf(a.domain)?r(a,n,t.src,e):s&&(l?r(a,n,t.dataSrc,e):!function(e,t,n,i,o){w.imageExists(e,function(e){e||r(t,n,i,o)})}(t.src,a,n,t.dataSrc,e)):s&&r(a,n,t.dataSrc,e)}),this}},F={settings:{domain:"holder.js",images:"img",objects:"object",bgnodes:"body .holderjs",stylenodes:"head link.holderjs",themes:{gray:{bg:"#EEEEEE",fg:"#AAAAAA"},social:{bg:"#3a5a97",fg:"#FFFFFF"},industrial:{bg:"#434A52",fg:"#C2F200"},sky:{bg:"#0D8FDB",fg:"#FFFFFF"},vine:{bg:"#39DBAC",fg:"#1E292C"},lava:{bg:"#F8591A",fg:"#1C2846"}}},defaults:{size:10,units:"pt",scale:1/16}},z=function(){var e=null,t=null,n=null;return function(r){var i=r.root;if(F.setup.supportsSVG){var o=!1,a=function(e){return document.createTextNode(e)};(null==e||e.parentNode!==document.body)&&(o=!0),e=b.initSVG(e,i.properties.width,i.properties.height),e.style.display="block",o&&(t=x.newEl("text",j),n=a(null),x.setAttr(t,{x:0}),t.appendChild(n),e.appendChild(t),document.body.appendChild(e),e.style.visibility="hidden",e.style.position="absolute",e.style.top="-100%",e.style.left="-100%");var s=i.children.holderTextGroup,l=s.properties;x.setAttr(t,{y:l.font.size,style:w.cssProps({"font-weight":l.font.weight,"font-size":l.font.size+l.font.units,"font-family":l.font.family})}),n.nodeValue=l.text;var h=t.getBBox(),u=Math.ceil(h.width/i.properties.width),d=l.text.split(" "),c=l.text.match(/\\n/g);u+=null==c?0:c.length,n.nodeValue=l.text.replace(/[ ]+/g,"");var f=t.getComputedTextLength(),p=h.width-f,g=Math.round(p/Math.max(1,d.length-1)),m=[];if(u>1){n.nodeValue="";for(var v=0;v<d.length;v++)if(0!==d[v].length){n.nodeValue=w.decodeHtmlEntity(d[v]);var y=t.getBBox();m.push({text:d[v],width:y.width})}}return e.style.display="none",{spaceWidth:g,lineCount:u,boundingBox:h,words:m}}return!1}}();for(var D in F.flags)F.flags.hasOwnProperty(D)&&(F.flags[D].match=function(e){return e.match(this.regex)});F.setup={renderer:"html",debounce:100,ratio:1,supportsCanvas:!1,supportsSVG:!1,lineWrapRatio:.9,dataAttr:"data-src",renderers:["html","canvas","svg"]},F.vars={preempted:!1,resizableImages:[],invisibleImages:{},invisibleId:0,visibilityCheckStarted:!1,debounceTimer:null,cache:{}},function(){var e=x.newEl("canvas");e.getContext&&-1!=e.toDataURL("image/png").indexOf("data:image/png")&&(F.setup.renderer="canvas",F.setup.supportsCanvas=!0),document.createElementNS&&document.createElementNS(j,"svg").createSVGRect&&(F.setup.renderer="svg",F.setup.supportsSVG=!0)}(),c(),m&&m(function(){F.vars.preempted||O.run(),t.addEventListener?(t.addEventListener("resize",g,!1),t.addEventListener("orientationchange",g,!1)):t.attachEvent("onresize",g),"object"==typeof t.Turbolinks&&t.document.addEventListener("page:change",function(){O.run()})}),e.exports=O}).call(t,function(){return this}())},function(e,t){function n(e){function t(e){if(!x){if(!a.body)return i(t);for(x=!0;e=S.shift();)i(e)}}function n(e){(w||e.type===l||a[c]===d)&&(r(),t())}function r(){w?(a[y](m,n,h),e[y](l,n,h)):(a[p](v,n),e[p](u,n))}function i(e,t){setTimeout(e,+t>=0?t:1)}function o(e){x?i(e):S.push(e)}null==document.readyState&&document.addEventListener&&(document.addEventListener("DOMContentLoaded",function C(){document.removeEventListener("DOMContentLoaded",C,!1),document.readyState="complete"},!1),document.readyState="loading");var a=e.document,s=a.documentElement,l="load",h=!1,u="on"+l,d="complete",c="readyState",f="attachEvent",p="detachEvent",g="addEventListener",m="DOMContentLoaded",v="onreadystatechange",y="removeEventListener",w=g in a,b=h,x=h,S=[];if(a[c]===d)i(t);else if(w)a[g](m,n,h),e[g](l,n,h);else{a[f](v,n),e[f](u,n);try{b=null==e.frameElement&&s}catch(A){}b&&b.doScroll&&!function E(){if(!x){try{b.doScroll("left")}catch(e){return i(E,50)}r(),t()}}()}return o.version="1.4.0",o.isReady=function(){return x},o}e.exports="undefined"!=typeof window&&n(window)},function(e,t,n){var r=encodeURIComponent,i=decodeURIComponent,o=n(4),a=n(5),s=/(\w+)\[(\d+)\]/,l=/\w+\.\w+/;t.parse=function(e){if("string"!=typeof e)return{};if(e=o(e),""===e)return{};"?"===e.charAt(0)&&(e=e.slice(1));for(var t={},n=e.split("&"),r=0;r<n.length;r++){var a,h,u,d=n[r].split("="),c=i(d[0]);if(a=s.exec(c))t[a[1]]=t[a[1]]||[],t[a[1]][a[2]]=i(d[1]);else if(a=l.test(c)){for(a=c.split("."),h=t;a.length;)if(u=a.shift(),u.length){if(h[u]){if(h[u]&&"object"!=typeof h[u])break}else h[u]={};a.length||(h[u]=i(d[1])),h=h[u]}}else t[d[0]]=null==d[1]?"":i(d[1])}return t},t.stringify=function(e){if(!e)return"";var t=[];for(var n in e){var i=e[n];if("array"!=a(i))t.push(r(n)+"="+r(e[n]));else for(var o=0;o<i.length;++o)t.push(r(n+"["+o+"]")+"="+r(i[o]))}return t.join("&")}},function(e,t){function n(e){return e.replace(/^\s*|\s*$/g,"")}t=e.exports=n,t.left=function(e){return e.replace(/^\s*/,"")},t.right=function(e){return e.replace(/\s*$/,"")}},function(e,t){var n=Object.prototype.toString;e.exports=function(e){switch(n.call(e)){case"[object Date]":return"date";case"[object RegExp]":return"regexp";case"[object Arguments]":return"arguments";case"[object Array]":return"array";case"[object Error]":return"error"}return null===e?"null":void 0===e?"undefined":e!==e?"nan":e&&1===e.nodeType?"element":(e=e.valueOf?e.valueOf():Object.prototype.valueOf.apply(e),typeof e)}},function(e,t){var n=function(e){function t(e,t){for(var n in t)e[n]=t[n];return e}var n=1,r=function(e){n++,this.parent=null,this.children={},this.id=n,this.name="n"+n,"undefined"!=typeof e&&(this.name=e),this.x=this.y=this.z=0,this.width=this.height=0};r.prototype.resize=function(e,t){null!=e&&(this.width=e),null!=t&&(this.height=t)},r.prototype.moveTo=function(e,t,n){this.x=null!=e?e:this.x,this.y=null!=t?t:this.y,this.z=null!=n?n:this.z},r.prototype.add=function(e){var t=e.name;if("undefined"!=typeof this.children[t])throw"SceneGraph: child already exists: "+t;this.children[t]=e,e.parent=this};var i=function(){r.call(this,"root"),this.properties=e};i.prototype=new r;var o=function(e,n){if(r.call(this,e),this.properties={fill:"#000000"},"undefined"!=typeof n)t(this.properties,n);else if("undefined"!=typeof e&&"string"!=typeof e)throw"SceneGraph: invalid node name"};o.prototype=new r;var a=function(){o.apply(this,arguments),this.type="group"};a.prototype=new o;var s=function(){o.apply(this,arguments),this.type="rect"};s.prototype=new o;var l=function(e){o.call(this),this.type="text",this.properties.text=e};l.prototype=new o;var h=new i;return this.Shape={Rect:s,Text:l,Group:a},this.root=h,this};e.exports=n},function(e,t){(function(e){t.extend=function(e,t){var n={};for(var r in e)e.hasOwnProperty(r)&&(n[r]=e[r]);if(null!=t)for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);return n},t.cssProps=function(e){var t=[];for(var n in e)e.hasOwnProperty(n)&&t.push(n+":"+e[n]);return t.join(";")},t.encodeHtmlEntity=function(e){for(var t=[],n=0,r=e.length-1;r>=0;r--)n=e.charCodeAt(r),n>128?t.unshift(["&#",n,";"].join("")):t.unshift(e[r]);return t.join("")},t.imageExists=function(e,t){var n=new Image;n.onerror=function(){t.call(this,!1)},n.onload=function(){t.call(this,!0)},n.src=e},t.decodeHtmlEntity=function(e){return e.replace(/&#(\d+);/g,function(e,t){return String.fromCharCode(t)})},t.dimensionCheck=function(e){var t={height:e.clientHeight,width:e.clientWidth};return t.height&&t.width?t:!1},t.truthy=function(e){return"string"==typeof e?"true"===e||"yes"===e||"1"===e||"on"===e||"✓"===e:!!e},t.parseColor=function(e){var t,n=/(^(?:#?)[0-9a-f]{6}$)|(^(?:#?)[0-9a-f]{3}$)/i,r=/^rgb\((\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/,i=/^rgba\((\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(0\.\d{1,}|1)\)$/,o=e.match(n);return null!==o?(t=o[1]||o[2],"#"!==t[0]?"#"+t:t):(o=e.match(r),null!==o?t="rgb("+o.slice(1).join(",")+")":(o=e.match(i),null!==o?t="rgba("+o.slice(1).join(",")+")":null))},t.canvasRatio=function(){var t=1,n=1;if(e.document){var r=e.document.createElement("canvas");if(r.getContext){var i=r.getContext("2d");t=e.devicePixelRatio||1,n=i.webkitBackingStorePixelRatio||i.mozBackingStorePixelRatio||i.msBackingStorePixelRatio||i.oBackingStorePixelRatio||i.backingStorePixelRatio||1}}return t/n}}).call(t,function(){return this}())},function(e,t,n){(function(e){var r=n(9),i="http://www.w3.org/2000/svg",o=8;t.initSVG=function(e,t,n){var a,s,l=!1;e&&e.querySelector?(s=e.querySelector("style"),null===s&&(l=!0)):(e=r.newEl("svg",i),l=!0),l&&(a=r.newEl("defs",i),s=r.newEl("style",i),r.setAttr(s,{type:"text/css"}),a.appendChild(s),e.appendChild(a)),e.webkitMatchesSelector&&e.setAttribute("xmlns",i);for(var h=0;h<e.childNodes.length;h++)e.childNodes[h].nodeType===o&&e.removeChild(e.childNodes[h]);for(;s.childNodes.length;)s.removeChild(s.childNodes[0]);return r.setAttr(e,{width:t,height:n,viewBox:"0 0 "+t+" "+n,preserveAspectRatio:"none"}),e},t.svgStringToDataURI=function(){var t="data:image/svg+xml;charset=UTF-8,",n="data:image/svg+xml;charset=UTF-8;base64,";return function(r,i){return i?n+btoa(e.unescape(encodeURIComponent(r))):t+encodeURIComponent(r)}}(),t.serializeSVG=function(t,n){if(e.XMLSerializer){var i=new XMLSerializer,o="",a=n.stylesheets;if(n.svgXMLStylesheet){for(var s=r.createXML(),l=a.length-1;l>=0;l--){var h=s.createProcessingInstruction("xml-stylesheet",'href="'+a[l]+'" rel="stylesheet"');s.insertBefore(h,s.firstChild)}s.removeChild(s.documentElement),o=i.serializeToString(s)}var u=i.serializeToString(t);return u=u.replace(/\&(\#[0-9]{2,}\;)/g,"&$1"),o+u}}}).call(t,function(){return this}())},function(e,t){(function(e){t.newEl=function(t,n){return e.document?null==n?e.document.createElement(t):e.document.createElementNS(n,t):void 0},t.setAttr=function(e,t){for(var n in t)e.setAttribute(n,t[n])},t.createXML=function(){return e.DOMParser?(new DOMParser).parseFromString("<xml />","application/xml"):void 0},t.getNodeArray=function(t){var n=null;return"string"==typeof t?n=document.querySelectorAll(t):e.NodeList&&t instanceof e.NodeList?n=t:e.Node&&t instanceof e.Node?n=[t]:e.HTMLCollection&&t instanceof e.HTMLCollection?n=t:t instanceof Array?n=t:null===t&&(n=[]),n=Array.prototype.slice.call(n)}}).call(t,function(){return this}())},function(e,t){var n=function(e,t){"string"==typeof e&&(this.original=e,"#"===e.charAt(0)&&(e=e.slice(1)),/[^a-f0-9]+/i.test(e)||(3===e.length&&(e=e.replace(/./g,"$&$&")),6===e.length&&(this.alpha=1,t&&t.alpha&&(this.alpha=t.alpha),this.set(parseInt(e,16)))))};n.rgb2hex=function(e,t,n){function r(e){var t=(0|e).toString(16);return 16>e&&(t="0"+t),t}return[e,t,n].map(r).join("")},n.hsl2rgb=function(e,t,n){var r=e/60,i=(1-Math.abs(2*n-1))*t,o=i*(1-Math.abs(parseInt(r)%2-1)),a=n-i/2,s=0,l=0,h=0;return r>=0&&1>r?(s=i,l=o):r>=1&&2>r?(s=o,l=i):r>=2&&3>r?(l=i,h=o):r>=3&&4>r?(l=o,h=i):r>=4&&5>r?(s=o,h=i):r>=5&&6>r&&(s=i,h=o),s+=a,l+=a,h+=a,s=parseInt(255*s),l=parseInt(255*l),h=parseInt(255*h),[s,l,h]},n.prototype.set=function(e){this.raw=e;var t=(16711680&this.raw)>>16,n=(65280&this.raw)>>8,r=255&this.raw,i=.2126*t+.7152*n+.0722*r,o=-.09991*t-.33609*n+.436*r,a=.615*t-.55861*n-.05639*r;return this.rgb={r:t,g:n,b:r},this.yuv={y:i,u:o,v:a},this},n.prototype.lighten=function(e){var t=Math.min(1,Math.max(0,Math.abs(e)))*(0>e?-1:1),r=255*t|0,i=Math.min(255,Math.max(0,this.rgb.r+r)),o=Math.min(255,Math.max(0,this.rgb.g+r)),a=Math.min(255,Math.max(0,this.rgb.b+r)),s=n.rgb2hex(i,o,a);return new n(s)},n.prototype.toHex=function(e){return(e?"#":"")+this.raw.toString(16)},n.prototype.lighterThan=function(e){return e instanceof n||(e=new n(e)),this.yuv.y>e.yuv.y},n.prototype.blendAlpha=function(e){e instanceof n||(e=new n(e));var t=e,r=this,i=t.alpha*t.rgb.r+(1-t.alpha)*r.rgb.r,o=t.alpha*t.rgb.g+(1-t.alpha)*r.rgb.g,a=t.alpha*t.rgb.b+(1-t.alpha)*r.rgb.b;return new n(n.rgb2hex(i,o,a))},e.exports=n},function(e,t){e.exports={version:"2.9.0",svg_ns:"http://www.w3.org/2000/svg"}},function(e,t,n){function r(e,t){return d.element({tag:t,width:e.width,height:e.height,fill:e.properties.fill})}function i(e){return h.cssProps({fill:e.fill,"font-weight":e.font.weight,"font-family":e.font.family+", monospace","font-size":e.font.size+e.font.units})}function o(e,t,n){var r=n/2;return["M",r,r,"H",e-r,"V",t-r,"H",r,"V",0,"M",0,r,"L",e,t-r,"M",0,t-r,"L",e,r].join(" ")}var a=n(13),s=n(8),l=n(11),h=n(7),u=l.svg_ns,d={element:function(e){var t=e.tag,n=e.content||"";return delete e.tag,delete e.content,[t,n,e]}};e.exports=function(e,t){var n=t.engineSettings,l=n.stylesheets,h=l.map(function(e){return'<?xml-stylesheet rel="stylesheet" href="'+e+'"?>'}).join("\n"),c="holder_"+Number(new Date).toString(16),f=e.root,p=f.children.holderTextGroup,g="#"+c+" text { "+i(p.properties)+" } ";p.y+=.8*p.textPositionData.boundingBox.height;var m=[];Object.keys(p.children).forEach(function(e){var t=p.children[e];Object.keys(t.children).forEach(function(e){var n=t.children[e],r=p.x+t.x+n.x,i=p.y+t.y+n.y,o=d.element({tag:"text",content:n.properties.text,x:r,y:i});m.push(o)})});var v=d.element({tag:"g",content:m}),y=null;if(f.children.holderBg.properties.outline){var w=f.children.holderBg.properties.outline;y=d.element({tag:"path",d:o(f.children.holderBg.width,f.children.holderBg.height,w.width),"stroke-width":w.width,stroke:w.fill,fill:"none"})}var b=r(f.children.holderBg,"rect"),x=[];x.push(b),w&&x.push(y),x.push(v);var S=d.element({tag:"g",id:c,content:x}),A=d.element({tag:"style",content:g,type:"text/css"}),C=d.element({tag:"defs",content:A}),E=d.element({tag:"svg",content:[C,S],width:f.properties.width,height:f.properties.height,xmlns:u,viewBox:[0,0,f.properties.width,f.properties.height].join(" "),preserveAspectRatio:"none"}),T=a(E);T=h+T[0];var k=s.svgStringToDataURI(T,"background"===t.mode);return k}},function(e,t,n){n(14);e.exports=function r(e,t,n){"use strict";function i(e){var t=e.match(/^\w+/),r={tag:t?t[0]:"div",attr:{},children:[]},i=e.match(/#([\w-]+)/),o=e.match(/\$([\w-]+)/),a=e.match(/\.[\w-]+/g);return i&&(r.attr.id=i[1],n[i[1]]=r),o&&(n[o[1]]=r),a&&(r.attr["class"]=a.join(" ").replace(/\./g,"")),e.match(/&$/g)&&(f=!1),r}function o(e,t){return null!==t&&t!==!1&&void 0!==t?"string"!=typeof t&&"object"!=typeof t?String(t):t:void 0}function a(e){return String(e).replace(/&/g,"&").replace(/"/g,""")}function s(e){return String(e).replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}var l,h,u,d,c=1,f=!0;if(n=n||{},"string"==typeof e[0])e[0]=i(e[0]);else{if(!Array.isArray(e[0]))throw new Error("First element of array must be a string, or an array and not "+JSON.stringify(e[0]));c=0}for(;c<e.length;c++){if(e[c]===!1||null===e[c]){e[0]=!1;break}if(void 0!==e[c]&&e[c]!==!0)if("string"==typeof e[c])f&&(e[c]=s(e[c])),e[0].children.push(e[c]);else if("number"==typeof e[c])e[0].children.push(e[c]);else if(Array.isArray(e[c])){if(Array.isArray(e[c][0])){if(e[c].reverse().forEach(function(t){e.splice(c+1,0,t)}),0!==c)continue;c++}r(e[c],t,n),e[c][0]&&e[0].children.push(e[c][0])}else if("function"==typeof e[c])u=e[c];else{if("object"!=typeof e[c])throw new TypeError('"'+e[c]+'" is not allowed as a value.');for(h in e[c])e[c].hasOwnProperty(h)&&null!==e[c][h]&&e[c][h]!==!1&&("style"===h&&"object"==typeof e[c][h]?e[0].attr[h]=JSON.stringify(e[c][h],o).slice(2,-2).replace(/","/g,";").replace(/":"/g,":").replace(/\\"/g,"'"):e[0].attr[h]=e[c][h])}}if(e[0]!==!1){l="<"+e[0].tag;for(d in e[0].attr)e[0].attr.hasOwnProperty(d)&&(l+=" "+d+'="'+a(e[0].attr[d]||"")+'"');l+=">",e[0].children.forEach(function(e){l+=e}),l+="</"+e[0].tag+">",e[0]=l}return n[0]=e[0],u&&u(e[0]),n}},function(e,t){function n(e){return String(e).replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}e.exports=n},function(e,t,n){var r=n(9),i=n(7);e.exports=function(){var e=r.newEl("canvas"),t=null;return function(n){null==t&&(t=e.getContext("2d"));var r=i.canvasRatio(),o=n.root;e.width=r*o.properties.width,e.height=r*o.properties.height,t.textBaseline="middle";var a=o.children.holderBg,s=r*a.width,l=r*a.height,h=2,u=h/2;t.fillStyle=a.properties.fill,t.fillRect(0,0,s,l),a.properties.outline&&(t.strokeStyle=a.properties.outline.fill,t.lineWidth=a.properties.outline.width,t.moveTo(u,u),t.lineTo(s-u,u),t.lineTo(s-u,l-u),t.lineTo(u,l-u),t.lineTo(u,u),t.moveTo(0,u),t.lineTo(s,l-u),t.moveTo(0,l-u),t.lineTo(s,u),t.stroke());var d=o.children.holderTextGroup;t.font=d.properties.font.weight+" "+r*d.properties.font.size+d.properties.font.units+" "+d.properties.font.family+", monospace",t.fillStyle=d.properties.fill;for(var c in d.children){var f=d.children[c];for(var p in f.children){var g=f.children[p],m=r*(d.x+f.x+g.x),v=r*(d.y+f.y+g.y+d.properties.leading/2);t.fillText(g.properties.text,m,v)}}return e.toDataURL("image/png")}}()}])}),function(e,t){t&&(Holder=e.Holder)}(this,"undefined"!=typeof Meteor&&"undefined"!=typeof Package);
- /**
- * Essential is a clean and customizable theme.
- *
- * @package theme_essential
- * @copyright 2016 Gareth J Barnard
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
- define('theme_essential/navbar', ["jquery","core/log"],function(a,b){"use strict";return b.debug("Essential navbar AMD"),{init:function(c){a(document).ready(function(a){a("#essentialnavbar").length&&(c.oldnavbar?a("#page-header").css("margin-bottom",a("#essentialnavbar .navbar-inner").height()+"px"):a("#page-header").css("margin-top",a("#essentialnavbar .navbar-inner").height()+"px"))}),b.debug("Essential navbar AMD init: "+c.oldnavbar)}}});
- /**
- * Essential is a clean and customizable theme.
- *
- * @package theme_essential
- * @copyright 2016 Gareth J Barnard
- * @copyright 2015 Gareth J Barnard
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
- define('theme_essential/styleguide', ["jquery","theme_bootstrapbase/bootstrap","theme_essential/holder","core/log"],function(a,b,c,d){"use strict";return d.debug("Essential Style Guide AMD"),{init:function(){a(document).ready(function(a){a("[data-toggle=tooltip]").tooltip(),a("[data-toggle=popover]").popover().click(function(a){a.preventDefault()})}),d.debug("Essential Style Guide AMD init")}}});
|