=e)return u=e-t[i],a=t[o]-e,f=a>u?t[i]:t[o],n&&r&&f>r&&(t[i]?f=t[i]:f=t[s-1]),f}return t[t.length-1]}})},"3.17.2",{requires:["dd-drag"]});
/*
YUI 3.17.2 (build 9c3c78e)
Copyright 2014 Yahoo! Inc. All rights reserved.
Licensed under the BSD License.
http://yuilibrary.com/license/
*/
YUI.add("dd-drop",function(e,t){var n="node",r=e.DD.DDM,i="offsetHeight",s="offsetWidth",o="drop:over",u="drop:enter",a="drop:exit",f=function(){this._lazyAddAttrs=!1,f.superclass.constructor.apply(this,arguments),e.on("domready",e.bind(function(){e.later(100,this,this._createShim)},this)),r._regTarget(this)};f.NAME="drop",f.ATTRS={node:{setter:function(t){var n=e.one(t);return n||e.error("DD.Drop: Invalid Node Given: "+t),n}},groups:{value:["default"],getter:function(){return this._groups?e.Object.keys(this._groups):(this._groups={},[])},setter:function(t){return this._groups=e.Array.hash(t),t}},padding:{value:"0",setter:function(e){return r.cssSizestoObject(e)}},lock:{value:!1,setter:function(e){return e?this.get(n).addClass(r.CSS_PREFIX+"-drop-locked"):this.get(n).removeClass(r.CSS_PREFIX+"-drop-locked"),e}},bubbles:{setter:function(e){return this.addTarget(e),e}},useShim:{value:!0,setter:function(t){return e.DD.DDM._noShim=!t,t}}},e.extend(f,e.Base,{_bubbleTargets:e.DD.DDM,addToGroup:function(e){return this._groups[e]=!0,this},removeFromGroup:function(e){return delete this._groups[e],this},_createEvents:function(){var t=[o,u,a,"drop:hit"];e.Array.each(t,function(e){this.publish(e,{type:e,emitFacade:!0,preventable:!1,bubbles:!0,queuable:!1,prefix:"drop"})},this)},_valid:null,_groups:null,shim:null,region:null,overTarget:null,inGroup:function(t){this._valid=!1;var n=!1;return e.Array.each(t,function(e){this._groups[e]&&(n=!0,this._valid=!0)},this),n},initializer:function(){e.later(100,this,this._createEvents);var t=this.get(n),i;t.get("id")||(i=e.stamp(t),t.set("id",i)),t.addClass(r.CSS_PREFIX+"-drop"),this.set("groups",this.get("groups"))},destructor:function(){r._unregTarget(this),this.shim&&this.shim!==this.get(n)&&(this.shim.detachAll(),this.shim.remove(),this.shim=null),this.get(n).removeClass(r.CSS_PREFIX+"-drop"),this.detachAll()},_deactivateShim:function(){if(!this.shim)return!1;this.get(n).removeClass(r.CSS_PREFIX+"-drop-active-valid"),this.get(n).removeClass(r.CSS_PREFIX+"-drop-active-invalid"),this.get(n).removeClass(r.CSS_PREFIX+"-drop-over"),this.get("useShim")&&this.shim.setStyles({top:"-999px",left:"-999px",zIndex:"1"}),this.overTarget=!1},_activateShim:function(){if(!r.activeDrag)return!1;if(this.get(n)===r.activeDrag.get(n))return!1;if(this.get("lock"))return!1;var e=this.get(n);this.inGroup(r.activeDrag.get("groups"))?(e.removeClass(r.CSS_PREFIX+"-drop-active-invalid"),e.addClass(r.CSS_PREFIX+"-drop-active-valid"),r._addValid(this),this.overTarget=!1,this.get("useShim")||(this.shim=this.get(n)),this.sizeShim()):(r._removeValid(this),e.removeClass(r.CSS_PREFIX+"-drop-active-valid"),e.addClass(r.CSS_PREFIX+"-drop-active-invalid"))},sizeShim:function(){if(!r.activeDrag)return!1;if(this.get(n)===r.activeDrag.get(n))return!1;if(this.get("lock"))return!1;if(!this.shim)return e.later(100,this,this.sizeShim),!1;var t=this.get(n),o=t.get(i),u=t.get(s),a=t.getXY(),f=this.get("padding"),l,c,h;u=u+f.left+f.right,o=o+f.top+f.bottom,a[0]=a[0]-f.left,a[1]=a[1]-f.top,r.activeDrag.get("dragMode")===r.INTERSECT&&(l=r.activeDrag,c=l.get(n).get(i),h=l.get(n).get(s),o+=c,u+=h,a[0]=a[0]-(h-l.deltaXY[0]),a[1]=a[1]-(c-l.deltaXY[1])),this.get("useShim")&&this.shim.setStyles({height:o+"px",width:u+"px",top:a[1]+"px",left:a[0]+"px"}),this.region={0:a[0],1:a[1],area:0,top:a[1],right:a[0]+u,bottom:a[1]+o,left:a[0]}},_createShim:function(){if(!r._pg){e.later(10,this,this._createShim);return}if(this.shim)return;var t=this.get("node");this.get("useShim")&&(t=e.Node.create(''),t.setStyles({height:this.get(n).get(i)+"px",width:this.get(n).get(s)+"px",backgroundColor:"yellow",opacity:".5",zIndex:"1",overflow:"hidden",top:"-900px",left:"-900px",position:"absolute"}),r._pg.appendChild(t),t.on("mouseover",e.bind(this._handleOverEvent,this)),t.on("mouseout",e.bind(this._handleOutEvent,this))),this.shim=t},_handleTargetOver:function(){r.isOverTarget(this)?(this.get(n).addClass(r.CSS_PREFIX+"-drop-over"),r.activeDrop=this,r.otherDrops[this]=this,this.overTarget?(r.activeDrag.fire("drag:over",{drop:this,drag:r.activeDrag}),this.fire(o,{drop:this,drag:r.activeDrag})):r.activeDrag.get("dragging")&&(this.overTarget=!0,this.fire(u,{drop:this,drag:r.activeDrag}),r.activeDrag.fire("drag:enter",{drop:this,drag:r.activeDrag}),r.activeDrag.get(n).addClass(r.CSS_PREFIX+"-drag-over"))):this._handleOut()},_handleOverEvent:function(){this.shim.setStyle("zIndex","999"),r._addActiveShim(this)},_handleOutEvent:function(){this.shim.setStyle("zIndex","1"),r._removeActiveShim(this)},_handleOut:function(e){(!r.isOverTarget(this)||e)&&this.overTarget&&(this.overTarget=!1,e||r._removeActiveShim(this),r.activeDrag&&(this.get(n).removeClass(r.CSS_PREFIX+"-drop-over"),r.activeDrag.get(n).removeClass(r.CSS_PREFIX+"-drag-over"),this.fire(a,{drop:this,drag:r.activeDrag}),r.activeDrag.fire("drag:exit",{drop:this,drag:r.activeDrag}),delete r.otherDrops[this]))}}),e.DD.Drop=f},"3.17.2",{requires:["dd-drag","dd-ddm-drop"]});
/*
YUI 3.17.2 (build 9c3c78e)
Copyright 2014 Yahoo! Inc. All rights reserved.
Licensed under the BSD License.
http://yuilibrary.com/license/
*/
YUI.add("dd-scroll",function(e,t){var n=function(){n.superclass.constructor.apply(this,arguments)},r,i,s="host",o="buffer",u="parentScroll",a="windowScroll",f="scrollTop",l="scrollLeft",c="offsetWidth",h="offsetHeight";n.ATTRS={parentScroll:{value:!1,setter:function(e){return e?e:!1}},buffer:{value:30,validator:e.Lang.isNumber},scrollDelay:{value:235,validator:e.Lang.isNumber},host:{value:null},windowScroll:{value:!1,validator:e.Lang.isBoolean},vertical:{value:!0,validator:e.Lang.isBoolean},horizontal:{value:!0,validator:e.Lang.isBoolean}},e.extend(n,e.Base,{_scrolling:null,_vpRegionCache:null,_dimCache:null,_scrollTimer:null,_getVPRegion:function(){var e={},t=this.get(u),n=this.get(o),r=this.get(a),i=r?[]:t.getXY(),s=r?"winWidth":c,p=r?"winHeight":h,d=r?t.get(f):i[1],v=r?t.get(l):i[0];return e={top:d+n,right:t.get(s)+v-n,bottom:t.get(p)+d-n,left:v+n},this._vpRegionCache=e,e},initializer:function(){var t=this.get(s);t.after("drag:start",e.bind(this.start,this)),t.after("drag:end",e.bind(this.end,this)),t.on("drag:align",e.bind(this.align,this)),e.one("win").on("scroll",e.bind(function(){this._vpRegionCache=null},this))},_checkWinScroll:function(e){var t=this._getVPRegion(),n=this.get(s),r=this.get(a),i=n.lastXY,c=!1,h=this.get(o),p=this.get(u),d=p.get(f),v=p.get(l),m=this._dimCache.w,g=this._dimCache.h,y=i[1]+g,b=i[1],w=i[0]+m,E=i[0],S=b,x=E,T=d,N=v;this.get("horizontal")&&(E<=t.left&&(c=!0,x=i[0]-(r?h:0),N=v-h),w>=t.right&&(c=!0,x=i[0]+(r?h:0),N=v+h)),this.get("vertical")&&(y>=t.bottom&&(c=!0,S=i[1]+(r?h:0),T=d+h),b<=t.top&&(c=!0,S=i[1]-(r?h:0),T=d-h)),T<0&&(T=0,S=i[1]),N<0&&(N=0,x=i[0]),S<0&&(S=i[1]),x<0&&(x=i[0]),e?(n.actXY=[x,S],n._alignNode([x,S],!0),i=n.actXY,n.actXY=[x,S],n._moveNode({node:p,top:T,left:N}),!T&&!N&&this._cancelScroll()):c?this._initScroll():this._cancelScroll()},_initScroll:function(){this._cancelScroll(),this._scrollTimer=e.Lang.later(this.get("scrollDelay"),this,this._checkWinScroll,[!0],!0)},_cancelScroll:function(){this._scrolling=!1,this._scrollTimer&&(this._scrollTimer.cancel(),delete this._scrollTimer)},align:function(e){this._scrolling&&(this._cancelScroll(),e.preventDefault()),this._scrolling||this._checkWinScroll()},_setDimCache:function(){var e=this.get(s).get("dragNode");this._dimCache={h:e.get(h),w:e.get(c)}},start:function(){this._setDimCache()},end:function(){this._dimCache=null,this._cancelScroll()}}),e.namespace("Plugin"),r=function(){r.superclass.constructor.apply(this,arguments)},r.ATTRS=e.merge(n.ATTRS,{windowScroll:{value:!0,setter:function(t){return t&&this.set(u,e.one("win")),t}}}),e.extend(r,n,{initializer:function(){this.set("windowScroll",this.get("windowScroll"))}}),r.NAME=r.NS="winscroll",e.Plugin.DDWinScroll=r,i=function(){i.superclass.constructor.apply(this,arguments)},i.ATTRS=e.merge(n.ATTRS,{node:{value:!1,setter:function(t){var n=e.one(t);return n?this.set(u,n):t!==!1&&e.error("DDNodeScroll: Invalid Node Given: "+t),n}}}),e.extend(i,n,{initializer:function(){this.set("node",this.get("node"))}}),i.NAME=i.NS="nodescroll",e.Plugin.DDNodeScroll=i,e.DD.Scroll=n},"3.17.2",{requires:["dd-drag"]});
/*
YUI 3.17.2 (build 9c3c78e)
Copyright 2014 Yahoo! Inc. All rights reserved.
Licensed under the BSD License.
http://yuilibrary.com/license/
*/
YUI.add("dd-drop-plugin",function(e,t){var n=function(e){e.node=e.host,n.superclass.constructor.apply(this,arguments)};n.NAME="dd-drop-plugin",n.NS="drop",e.extend(n,e.DD.Drop),e.namespace("Plugin"),e.Plugin.Drop=n},"3.17.2",{requires:["dd-drop"]});
/*
YUI 3.17.2 (build 9c3c78e)
Copyright 2014 Yahoo! Inc. All rights reserved.
Licensed under the BSD License.
http://yuilibrary.com/license/
*/
YUI.add("dd-delegate",function(e,t){var n=function(){n.superclass.constructor.apply(this,arguments)},r="container",i="nodes",s=e.Node.create("Temp Node
");e.extend(n,e.Base,{_bubbleTargets:e.DD.DDM,dd:null,_shimState:null,_handles:null,_onNodeChange:function(e){this.set("dragNode",e.newVal)},_afterDragEnd:function(){e.DD.DDM._noShim=this._shimState,this.set("lastNode",this.dd.get("node")),this.get("lastNode").removeClass(e.DD.DDM.CSS_PREFIX+"-dragging"),this.dd._unprep(),this.dd.set("node",s)},_delMouseDown:function(t){var n=t.currentTarget,r=this.dd,s=n,o=this.get("dragConfig");n.test(this.get(i))&&!n.test(this.get("invalid"))&&(this._shimState=e.DD.DDM._noShim,e.DD.DDM._noShim=!0,this.set("currentNode",n),r.set("node",n),o&&o.dragNode?s=o.dragNode:r.proxy&&(s=e.DD.DDM._proxy),r.set("dragNode",s),r._prep(),r.fire("drag:mouseDown",{ev:t}))},_onMouseEnter:function(){this._shimState=e.DD.DDM._noShim,e.DD.DDM._noShim=!0},_onMouseLeave:function(){e.DD.DDM._noShim=this._shimState},initializer:function(){this._handles=[];var t=this.get("dragConfig")||{},n=this.get(r);t.node=s.cloneNode(!0),t.bubbleTargets=this,this.get("handles")&&(t.handles=this.get("handles")),this.dd=new e.DD.Drag(t),this.dd.after("drag:end",e.bind(this._afterDragEnd,this)),this.dd.on("dragNodeChange",e.bind(this._onNodeChange,this)),this.dd.after("drag:mouseup",function(){this._unprep()}),this._handles.push(e.delegate(e.DD.Drag.START_EVENT,e.bind(this._delMouseDown,this),n,this.get(i))),this._handles.push(e.on("mouseenter",e.bind(this._onMouseEnter,this),n)),this._handles.push(e.on("mouseleave",e.bind(this._onMouseLeave,this),n)),e.later(50,this,this.syncTargets),e.DD.DDM.regDelegate(this)},syncTargets:function(){if(!e.Plugin.Drop||this.get("destroyed"))return;var t,n,s;return this.get("target")&&(t=e.one(this.get(r)).all(this.get(i)),n=this.dd.get("groups"),s=this.get("dragConfig"),s&&s.groups&&(n=s.groups),t.each(function(e){this.createDrop(e,n)},this)),this},createDrop:function(t,n){var r={useShim:!1,bubbleTargets:this};return t.drop||t.plug(e.Plugin.Drop,r),t.drop.set("groups",n),t},destructor:function(){this.dd&&this.dd.destroy();if(e.Plugin.Drop){var t=e.one(this.get(r)).all(this.get(i));t.unplug(e.Plugin.Drop)}e.Array.each(this._handles,function(e){e.detach()})}},{NAME:"delegate",ATTRS:{container:{value:"body"},nodes:{value:".dd-draggable"},invalid:{value:"input, select, button, a, textarea"},lastNode:{value:s},currentNode:{value:s},dragNode:{value:s},over:{value:!1},target:{value:!1},dragConfig:{value:null},handles:{value:null}}}),e.mix(e.DD.DDM,{_delegates:[],regDelegate:function(e){this._delegates.push(e)},getDelegate:function(t){var n=null;return t=e.one(t),e.Array.each(this._delegates,function(e){t.test(e.get(r))&&(n=e)},this),n}}),e.namespace("DD"),e.DD.Delegate=n},"3.17.2",{requires:["dd-drag","dd-drop-plugin","event-mouseenter"]});
YUI.add("moodle-core-notification-alert",function(e,t){var n,r,i,s,o,u,a;n="moodle-dialogue",r="notificationBase",i="yesLabel",s="noLabel",o="title",u="question",a={BASE:"moodle-dialogue-base",WRAP:"moodle-dialogue-wrap",HEADER:"moodle-dialogue-hd",BODY:"moodle-dialogue-bd",CONTENT:"moodle-dialogue-content",FOOTER:"moodle-dialogue-ft",HIDDEN:"hidden",LIGHTBOX:"moodle-dialogue-lightbox"},M.core=M.core||{};var f="Moodle alert",l;l=function(e){e.closeButton=!1,l.superclass.constructor.apply(this,[e])},e.extend(l,M.core.notification.info,{_closeEvents:null,initializer:function(){this._closeEvents=[],this.publish("complete");var t=e.Node.create(''),n=e.Node.create('').append(e.Node.create(''+this.get("message")+"
")).append(e.Node.create('').append(t));this.get(r).addClass("moodle-dialogue-confirm"),this.setStdModContent(e.WidgetStdMod.BODY,n,e.WidgetStdMod.REPLACE),this.setStdModContent(e.WidgetStdMod.HEADER,''+this.get(o)+"
",e.WidgetStdMod.REPLACE),this._closeEvents.push(e.on("key",this.submit,window,"down:13",this),t.on("click",this.submit,this));var s=this.get("boundingBox").one(".closebutton");s&&this._closeEvents.push(s.on("click",this.submit,this))},submit:function(){(new e.EventHandle(this._closeEvents)).detach(),this.fire("complete"),this.hide(),this.destroy()}},{NAME:f,CSS_PREFIX:n,ATTRS:{title:{validator:e.Lang.isString,value:"Alert"},message:{validator:e.Lang.isString,value:"Confirm"},yesLabel:{validator:e.Lang.isString,setter:function(e){return e||(e="Ok"),e},value:"Ok"}}}),M.core.alert=l},"@VERSION@",{requires:["moodle-core-notification-dialogue"]});
YUI.add("moodle-core-notification-confirm",function(e,t){var n,r,i,s,o,u,a;n="moodle-dialogue",r="notificationBase",i="yesLabel",s="noLabel",o="title",u="question",a={BASE:"moodle-dialogue-base",WRAP:"moodle-dialogue-wrap",HEADER:"moodle-dialogue-hd",BODY:"moodle-dialogue-bd",CONTENT:"moodle-dialogue-content",FOOTER:"moodle-dialogue-ft",HIDDEN:"hidden",LIGHTBOX:"moodle-dialogue-lightbox"},M.core=M.core||{};var f="Moodle confirmation dialogue",l;l=function(e){l.superclass.constructor.apply(this,[e])},e.extend(l,M.core.notification.info,{_closeEvents:null,_yesButton:null,_noButton:null,_question:null,initializer:function(){this._closeEvents=[],this.publish("complete"),this.publish("complete-yes"),this.publish("complete-no"),this._yesButton=e.Node.create(''),this._noButton=e.Node.create(''),this._question=e.Node.create(''+this.get(u)+"
");var t=e.Node.create('').append(this._question).append(e.Node.create('').append(this._yesButton).append(this._noButton));this.get(r).addClass("moodle-dialogue-confirm"),this.setStdModContent(e.WidgetStdMod.BODY,t,e.WidgetStdMod.REPLACE),this.setStdModContent(e.WidgetStdMod.HEADER,''+this.get(o)+"
",e.WidgetStdMod.REPLACE),this._closeEvents.push(e.on("key",this.submit,window,"down:27",this,!1),this._yesButton.on("click",this.submit,this,!0),this._noButton.on("click",this.submit,this,!1));var n=this.get("boundingBox").one(".closebutton");n&&this._closeEvents.push(n.on("click",this.submit,this))},submit:function(t,n){(new e.EventHandle(this._closeEvents)).detach(),this.fire("complete",n),n?this.fire("complete-yes"):this.fire("complete-no"),this.hide(),this.destroy()}},{NAME:f,CSS_PREFIX:n,ATTRS:{yesLabel:{validator:e.Lang.isString,valueFn:function(){return M.util.get_string("yes","moodle")},setter:function(e){return this._yesButton&&this._yesButton.set("value",e),e}},noLabel:{validator:e.Lang.isString,valueFn:function(){return M.util.get_string("no","moodle")},setter:function(e){return this._noButton&&this._noButton.set("value",e),e}},title:{validator:e.Lang.isString,value:M.util.get_string("confirm","moodle")},question:{validator:e.Lang.isString,valueFn:function(){return M.util.get_string("areyousure","moodle")},setter:function(e){return this._question&&this._question.set("value",e),e}}}}),e.augment(l,e.EventTarget),M.core.confirm=l},"@VERSION@",{requires:["moodle-core-notification-dialogue"]});
YUI.add("moodle-core-notification-exception",function(e,t){var n,r,i,s,o,u,a;n="moodle-dialogue",r="notificationBase",i="yesLabel",s="noLabel",o="title",u="question",a={BASE:"moodle-dialogue-base",WRAP:"moodle-dialogue-wrap",HEADER:"moodle-dialogue-hd",BODY:"moodle-dialogue-bd",CONTENT:"moodle-dialogue-content",FOOTER:"moodle-dialogue-ft",HIDDEN:"hidden",LIGHTBOX:"moodle-dialogue-lightbox"},M.core=M.core||{};var f="Moodle exception",l;l=function(t){var n=e.mix({},t);n.width=n.width||M.cfg.developerdebug?Math.floor(e.one(document.body).get("winWidth")/3)+"px":null,n.closeButton=!0;var r=["message","name","fileName","lineNumber","stack"];e.Array.each(r,function(e){n[e]=t[e]}),l.superclass.constructor.apply(this,[n])},e.extend(l,M.core.notification.info,{_hideTimeout:null,_keypress:null,initializer:function(t){var n,i=this,s=this.get("hideTimeoutDelay");this.get(r).addClass("moodle-dialogue-exception"),this.setStdModContent(e.WidgetStdMod.HEADER,'",e.WidgetStdMod.REPLACE),n=e.Node.create('').append(e.Node.create(''+e.Escape.html(this.get("message"))+"
")).append(e.Node.create(' '+e.Escape.html(this.get("fileName"))+"
")).append(e.Node.create(' '+e.Escape.html(this.get("lineNumber"))+"
")).append(e.Node.create(' '+this.get("stack")+"
")),M.cfg.developerdebug&&n.all(".moodle-exception-param").removeClass("hidden"),this.setStdModContent(e.WidgetStdMod.BODY,n,e.WidgetStdMod.REPLACE),s&&(this._hideTimeout=setTimeout(function(){i.hide()},s)),this.after("visibleChange",this.visibilityChanged,this),this._keypress=e.on("key",this.hide,window,"down:13,27",this),this.centerDialogue()},visibilityChanged:function(e){if(e.attrName==="visible"&&e.prevVal&&!e.newVal){this._keypress&&this._keypress.detach();var t=this;setTimeout(function(){t.destroy()},1e3)}}},{NAME:f,CSS_PREFIX:n,ATTRS:{message:{value:""},name:{value:""},fileName:{value:""},lineNumber:{value:""},stack:{setter:function(t){var n=e.Escape.html(t).split("\n"),r=new RegExp("^(.+)@("+M.cfg.wwwroot+")?(.{0,75}).*:(\\d+)$"),i;for(i in n)n[i]=n[i].replace(r,"ln: $4
$3
$1
");return n.join("")},value:""},hideTimeoutDelay:{validator:e.Lang.isNumber,value:null}}}),M.core.exception=l},"@VERSION@",{requires:["moodle-core-notification-dialogue"]});
YUI.add("moodle-core-notification-ajaxexception",function(e,t){var n,r,i,s,o,u,a;n="moodle-dialogue",r="notificationBase",i="yesLabel",s="noLabel",o="title",u="question",a={BASE:"moodle-dialogue-base",WRAP:"moodle-dialogue-wrap",HEADER:"moodle-dialogue-hd",BODY:"moodle-dialogue-bd",CONTENT:"moodle-dialogue-content",FOOTER:"moodle-dialogue-ft",HIDDEN:"hidden",LIGHTBOX:"moodle-dialogue-lightbox"},M.core=M.core||{};var f="Moodle AJAX exception",l;l=function(e){e.name=e.name||"Error",e.closeButton=!0,l.superclass.constructor.apply(this,[e])},e.extend(l,M.core.notification.info,{_keypress:null,initializer:function(t){var n,i=this,s=this.get("hideTimeoutDelay");this.get(r).addClass("moodle-dialogue-exception"),this.setStdModContent(e.WidgetStdMod.HEADER,''+e.Escape.html(t.name)+"
",e.WidgetStdMod.REPLACE),n=e.Node.create('').append(e.Node.create(''+e.Escape.html(this.get("error"))+"
")).append(e.Node.create(' '+this.get("reproductionlink")+"
")).append(e.Node.create(' '+e.Escape.html(this.get("debuginfo"))+"
")).append(e.Node.create(' '+e.Escape.html(this.get("stacktrace"))+"
")),M.cfg.developerdebug&&n.all(".moodle-exception-param").removeClass("hidden"),this.setStdModContent(e.WidgetStdMod.BODY,n,e.WidgetStdMod.REPLACE),s&&(this._hideTimeout=setTimeout(function(){i.hide()},s)),this.after("visibleChange",this.visibilityChanged,this),this._keypress=e.on("key",this.hide,window,"down:13, 27",this),this.centerDialogue()},visibilityChanged:function(e){if(e.attrName==="visible"&&e.prevVal&&!e.newVal){var t=this;this._keypress.detach(),setTimeout(function(){t.destroy()},1e3)}}},{NAME:f,CSS_PREFIX:n,ATTRS:{error:{validator:e.Lang.isString,value:M.util.get_string("unknownerror","moodle")},debuginfo:{value:null},stacktrace:{value:null},reproductionlink:{setter:function(t){return t!==null&&(t=e.Escape.html(t),t=''+t.replace(M.cfg.wwwroot,"")+""),t},value:null},hideTimeoutDelay:{validator:e.Lang.isNumber,value:null}}}),M.core.ajaxException=l},"@VERSION@",{requires:["moodle-core-notification-dialogue"]});
YUI.add("moodle-core-notification",function(e,t){},"@VERSION@",{requires:["moodle-core-notification-dialogue","moodle-core-notification-alert","moodle-core-notification-confirm","moodle-core-notification-exception","moodle-core-notification-ajaxexception"]});
YUI.add("moodle-core-dragdrop",function(e,t){var n={pix:"i/move_2d",largepix:"i/dragdrop",component:"moodle",cssclass:"moodle-core-dragdrop-draghandle"},r=function(){r.superclass.constructor.apply(this,arguments)};e.extend(r,e.Base,{goingup:null,absgoingup:null,samenodeclass:null,parentnodeclass:null,samenodelabel:null,parentnodelabel:null,groups:[],lastdroptarget:null,initializer:function(){e.DD.DDM.on("drag:start",this.global_drag_start,this),e.DD.DDM.on("drag:end",this.global_drag_end,this),e.DD.DDM.on("drag:drag",this.global_drag_drag,this),e.DD.DDM.on("drop:over",this.global_drop_over,this),e.DD.DDM.on("drop:hit",this.global_drop_hit,this),e.DD.DDM.on("drag:dropmiss",this.global_drag_dropmiss,this),e.one(e.config.doc.body).delegate("key",this.global_keydown,"down:32, enter, esc","."+n.cssclass,this),e.one(e.config.doc.body).delegate("click",this.global_keydown,"."+n.cssclass,this)},get_drag_handle:function(t,r,i,s){var o=n.pix;s&&(o=n.largepix);var u=e.Node.create("").setStyle("cursor","move").setAttrs({src:M.util.image_url(o,n.component),alt:t});i&&u.addClass(i);var a=e.Node.create("").addClass(r).setAttribute("title",t).setAttribute("tabIndex",0).setAttribute("data-draggroups",this.groups).setAttribute("role","button");return a.appendChild(u),a.addClass(n.cssclass),a},lock_drag_handle:function(e,t){e.removeHandle("."+t)},unlock_drag_handle:function(e,t){e.addHandle("."+t),e.get("activeHandle").focus()},ajax_failure:function(e){var t={name:e.status+" "+e.statusText,message:e.responseText};return new M.core.exception(t)},in_group:function(t){var n=!1;return e.each(this.groups,function(e){t._groups[e]&&(n=!0)},this),n},global_drag_start:function(e){var t=e.target;if(!this.in_group(t))return;t.get("node").setStyle("opacity",".25"),t.get("dragNode").setStyles({opacity:".75",borderColor:t.get("node").getStyle("borderColor"),backgroundColor:t.get("node").getStyle("backgroundColor")}),t.get("dragNode").empty(),this.drag_start(e)},global_drag_end:function(e){var t=e.target;if(!this.in_group(t))return;t.get("node").setStyles({visibility:"",opacity:"1"}),this.drag_end(e)},global_drag_drag:function(e){var t=e.target,n=e.info;if(!this.in_group(t))return;n.start[1]n.xy[1]&&(this.absgoingup=!1),n.delta[1]<0?this.goingup=!0:n.delta[1]>0&&(this.goingup=!1),this.drag_drag(e)},global_drop_over:function(e){if(!e.drop||!e.drop.inGroup(this.groups))return;var t=e.drag.get("node"),n=e.drop.get("node");this.lastdroptarget=e.drop;if(n.hasClass(this.samenodeclass)){var r;this.goingup?r="before":r="after",n.insert(t,r)}else(n.hasClass(this.parentnodeclass)||n.test('[data-droptarget="1"]'))&&!n.contains(t)&&(this.goingup?n.append(t):n.prepend(t));this.drop_over(e)},global_drag_dropmiss:function(e){e.drag=e.target,e.drop=this.lastdroptarget;if(!this.in_group(e.drag))return;if(!e.drop||!e.drop.inGroup(this.groups))return;this.drag_dropmiss(e)},global_drop_hit:function(e){if(!e.drop||!e.drop.inGroup(this.groups))return;this.drop_hit(e)},find_element_text:function(t){var n=t.all("h2, h3, h4, h5, span, p, div.no-overflow, div.dimmed_text"),r="";return n.each(function(){r===""&&e.Lang.trim(this.get("text"))!==""&&(r=this.get("text"))}),r!==""?r:M.util.get_string("emptydragdropregion","moodle")},global_start_keyboard_drag:function(t,n,r){M.core.dragdrop.keydragcontainer=r,M.core.dragdrop.keydraghandle=n;var i=this.find_element_text(r),s=M.util.get_string("movecontent","moodle",i),o=e.Node.create("");o.addClass("dragdrop-keyboard-drag");var u,a,f=e.all("."+this.samenodeclass+", ."+this.parentnodeclass);f.each(function(t){var n=!1,s=t;if(t.drop&&t.drop.inGroup(this.groups)&&t.drop.get("node")!==r)n=!0;else{var f=t.getAttribute("data-draggroups").split(" "),l,c;for(l=0;l"),listlink=e.Node.create(""),i=this.find_element_text(s),this.samenodelabel&&t.hasClass(this.samenodeclass)?a=M.util.get_string(this.samenodelabel.identifier,this.samenodelabel.component,i):this.parentnodelabel&&t.hasClass(this.parentnodeclass)?a=M.util.get_string(this.parentnodelabel.identifier,this.parentnodelabel.component,i):a=M.util.get_string("tocontent","moodle",i),listlink.setContent(a),listlink.setAttribute("data-drop-target",t.get("id")),listlink.setAttribute("tabindex","0"),listlink.on("click",this.global_keyboard_drop,this),listlink.on("key",this.global_keyboard_drop,"down:enter,32",this),u.append(listlink),o.append(u))},this),M.core.dragdrop.dropui=new M.core.dialogue({headerContent:s,bodyContent:o,draggable:!0,visible:!0,center:!0,modal:!0}),M.core.dragdrop.dropui.after("visibleChange",function(e){e.prevVal&&!e.newVal&&this.global_cancel_keyboard_drag()},this),o.one("a")&&o.one("a").focus()},simulated_drag_drop_event:function(e,t){var n=function(e){this.node=e};n.prototype.get=function(e){return e==="node"||e==="dragNode"||e==="dropNode"?this.node:e==="activeHandle"?this.node.one(".editing_move"):null},n.prototype.inGroup=function(){return!0},n.prototype.addHandle=function(){},n.prototype.removeHandle=function(){},this.drop=new n(t),this.drag=new n(e),this.target=this.drop},global_keyboard_drop:function(t){var n=M.core.dragdrop.keydragcontainer,r=e.one("#"+t.target.getAttribute("data-drop-target"));M.core.dragdrop.dropui.hide(),t.preventDefault();var i=new this.simulated_drag_drop_event(n,n),s=new this.simulated_drag_drop_event(n,r);this.drag_start(i),this.global_drop_over(s),r.hasClass(this.parentnodeclass)&&r.contains(n)&&r.prepend(n),this.global_drop_hit(s)},global_cancel_keyboard_drag:function(){M.core.dragdrop.keydragcontainer&&(M.core.dragdrop.keydraghandle.focus(),M.core.dragdrop.keydragcontainer=null),M.core.dragdrop.dropui&&M.core.dragdrop.dropui.destroy()},global_keydown:function(e){var t=e.target.ancestor("."+n.cssclass,!0),r,i;if(t===null)return;if(e.keyCode===27){this.global_cancel_keyboard_drag(),e.preventDefault
();return}if(!t.hasClass(n.cssclass))return;if(e.keyCode!==13&&e.keyCode!==32&&e.type!=="click")return;i=t.getAttribute("data-draggroups").split(" ");var s,o,u=!1;for(s=0;s ."+r.REGIONCONTENT);if(t.size()>0){var n=t.item(0);n.addClass(r.BLOCKREGION),n.set("id",r.REGIONCONTENT),n.one("div").addClass(r.REGIONCONTENT)}var s=e.Node.all("div."+r.BLOCKREGION);if(s.size()===0)return!1;if(s.size()!==this.get("regions").length){var o=e.Node.create("").addClass(r.BLOCKREGION),u=e.Node.create("").addClass(r.REGIONCONTENT);o.appendChild(u);var a=s.filter("#region-pre"),f=s.filter("#region-post");a.size()===0&&f.size()===1?(o.setAttrs({id:"region-pre"}),f.item(0).insert(o,"before"),s.unshift(o)):f.size()===0&&a.size()===1&&(o.setAttrs({id:"region-post"}),a.item(0).insert(o,"after"),s.push(o))}s.each(function(t){new e.DD.Drop({node:t.one("div."+r.REGIONCONTENT),groups:this.groups,padding:"40 240 40 240"});var n=new e.DD.Delegate({container:t,nodes:"."+r.BLOCK,target:!0,handles:[i.DRAGHANDLE],invalid:".block-hider-hide, .block-hider-show, .moveto",dragConfig:{groups:this.groups}});n.dd.plug(e.Plugin.DDProxy,{moveOnEnd:!1}),n.dd.plug(e.Plugin.DDWinScroll);var s=t.all("."+r.BLOCK);s.each(function(e){var t=e.one("a."+r.EDITINGMOVE);t&&(t.replace(this.get_drag_handle(t.getAttribute("title"),"","iconsmall",!0)),e.one(i.DRAGHANDLE).setStyle("cursor","move"))},this)},this)},get_block_id:function(e){return Number(e.get("id").replace(/inst/i,""))},get_block_region:function(t){var n=t.ancestor("div."+r.BLOCKREGION).get("id").replace(/region-/i,"");return e.Array.indexOf(this.get("regions"),n)===-1?(right_to_left()&&(n==="post"?n="pre":n==="pre"&&(n="post")),"side-"+n):n},get_region_id:function(e){return e.get("id").replace(/region-/i,"")},drag_start:function(t){var n=t.target;this.dragsourceregion=n.get("node").ancestor("div."+r.BLOCKREGION),n.get("node").previous()&&n.get("node").previous().hasClass(r.SKIPBLOCK)&&(this.skipnodetop=n.get("node").previous()),n.get("node").next()&&n.get("node").next().hasClass(r.SKIPBLOCKTO)&&(this.skipnodebottom=n.get("node").next()),e.one("body").addClass(r.BLOCKSMOVING)},drop_over:function(t){var n=t.drag.get("node"),i=t.drop.get("node");i.hasClass(this.parentnodeclass)&&i.one("."+r.BLOCKADMINBLOCK)&&i.one("."+r.BLOCKADMINBLOCK).next("."+r.BLOCK)&&i.prepend(n);if(this.dragsourceregion.contains(i))return!1;var s=e.one("body"),o=this.get_region_id(this.dragsourceregion);s.hasClass("side-"+o+"-only")&&s.removeClass("side-"+o+"-only"),o=this.get_region_id(i.ancestor("div."+r.BLOCKREGION)),this.dragsourceregion.all("."+r.BLOCK).size()===0&&this.dragsourceregion.get("id").match(/(region-pre|region-post)/i)&&(s.hasClass("side-"+o+"-only")||s.addClass("side-"+o+"-only"))},drag_end:function(){this.skipnodetop=null,this.skipnodebottom=null,this.dragsourceregion=null,e.one("body").removeClass(r.BLOCKSMOVING)},drag_dropmiss:function(e){this.drop_hit(e)},drop_hit:function(t){var i=t.drag,s=i.get("node"),o=t.drop.get("node");s.previous()&&s.previous().hasClass(r.SKIPBLOCK)&&s.insert(s.previous(),"after"),this.skipnodetop&&s.insert(this.skipnodetop,"before"),this.skipnodebottom&&s.insert(this.skipnodebottom,"after");var u=M.util.add_lightbox(e,s),a={sesskey:M.cfg.sesskey,courseid:this.get("courseid"),pagelayout:this.get("pagelayout"),pagetype:this.get("pagetype"),subpage:this.get("subpage"),contextid:this.get("contextid"),action:"move",bui_moveid:this.get_block_id(s),bui_newregion:this.get_block_region(o)};this.get("cmid")&&(a.cmid=this.get("cmid")),s.next("."+this.samenodeclass)&&!s.next("."+this.samenodeclass).hasClass(r.BLOCKADMINBLOCK)&&(a.bui_beforeid=this.get_block_id(s.next("."+this.samenodeclass))),e.io(M.cfg.wwwroot+n,{method:"POST",data:a,on:{start:function(){u.show()},success:function(t,n){window.setTimeout(function(){u.hide()},250);try{var r=e.JSON.parse(n.responseText);r.error&&new M.core.ajaxException(r)}catch(i){}},failure:function(e,t){this.ajax_failure(t),u.hide()}},context:this})}},{NAME:"core-blocks-dragdrop",ATTRS:{courseid:{value:null},cmid:{value:null},contextid:{value:null},pagelayout:{value:null},pagetype:{value:null},subpage:{value:null},regions:{value:null}}}),M.core=M.core||{},M.core.blockdraganddrop=M.core.blockdraganddrop||{},M.core.blockdraganddrop._isusingnewblocksmethod=null,M.core.blockdraganddrop.is_using_blocks_render_method=function(){if(this._isusingnewblocksmethod===null){var t=e.all(".block-region[data-blockregion]").size(),n=e.all(".block-region").size();this._isusingnewblocksmethod=n===t,t>0&&n>0&&t!==n}return this._isusingnewblocksmethod},M.core.blockdraganddrop.init=function(e){this.is_using_blocks_render_method()?new o(e):new s(e)},M.core_blocks=M.core_blocks||{},M.core_blocks.init_dragdrop=function(e){M.core.blockdraganddrop.init(e)};var o=function(){o.superclass.constructor.apply(this,arguments)};o.prototype={skipnodetop:null,skipnodebottom:null,regionobjects:{},initializer:function(){var t=this.get("regions"),n=0,s,o,a;this.groups=["block"],this.samenodeclass=r.BLOCK,this.parentnodeclass=r.BLOCKREGION;var f=e.Node.all("body#"+r.MYINDEX+" #"+r.REGIONMAIN+" > ."+r.REGIONCONTENT);if(f.size()>0){var l=f.item(0);l.addClass(r.BLOCKREGION),l.set("id",r.REGIONCONTENT),l.one("div").addClass(r.REGIONCONTENT)}for(n in t)o=t[n],s=new u({manager:this,region:o,node:e.one("#block-region-"+o)}),this.regionobjects[o]=s,new e.DD.Drop({node:s.get_droptarget(),groups
:this.groups,padding:"40 240 40 240"}),a=new e.DD.Delegate({container:s.get_droptarget(),nodes:"."+r.BLOCK,target:!0,handles:[i.DRAGHANDLE],invalid:".block-hider-hide, .block-hider-show, .moveto, .block_fake",dragConfig:{groups:this.groups}}),a.dd.plug(e.Plugin.DDProxy,{moveOnEnd:!1}),a.dd.plug(e.Plugin.DDWinScroll),e.DD.DDM.on("ddm:start",this.enable_all_regions,this),s.change_block_move_icons(this)},get_block_id:function(e){return Number(e.get("id").replace(/inst/i,""))},get_block_region:function(e){return e.test("[data-blockregion]")||(e=e.ancestor("[data-blockregion]")),e.getData("blockregion")},get_region_object:function(e){return this.regionobjects[this.get_block_region(e)]},enable_all_regions:function(){var t=e.DD.DDM.activeDrag.get("groups");if(!t||e.Array.indexOf(t,"block")===-1)return;var n;for(n in this.regionobjects){if(!this.regionobjects.hasOwnProperty(n))continue;this.regionobjects[n].enable()}},disable_regions_if_required:function(){var e=0;for(e in this.regionobjects)this.regionobjects[e].disable_if_required()},drag_start:function(e){var t=e.target;t.get("node").previous()&&t.get("node").previous().hasClass(r.SKIPBLOCK)&&(this.skipnodetop=t.get("node").previous()),t.get("node").next()&&t.get("node").next().hasClass(r.SKIPBLOCKTO)&&(this.skipnodebottom=t.get("node").next())},drop_over:function(e){var t=e.drag.get("node"),n=e.drop.get("node");n.hasClass(r.REGIONCONTENT)&&n.one("."+r.BLOCKADMINBLOCK)&&n.one("."+r.BLOCKADMINBLOCK).next("."+r.BLOCK)&&n.prepend(t)},drop_end:function(){this.skipnodetop=null,this.skipnodebottom=null,this.disable_regions_if_required()},drag_dropmiss:function(e){this.drop_hit(e)},drop_hit:function(t){var i=t.drag.get("node"),s=t.drop.get("node");i.previous()&&i.previous().hasClass(r.SKIPBLOCK)&&i.insert(i.previous(),"after"),this.skipnodetop&&i.insert(this.skipnodetop,"before"),this.skipnodebottom&&i.insert(this.skipnodebottom,"after");var o=M.util.add_lightbox(e,i),u={sesskey:M.cfg.sesskey,courseid:this.get("courseid"),pagelayout:this.get("pagelayout"),pagetype:this.get("pagetype"),subpage:this.get("subpage"),contextid:this.get("contextid"),action:"move",bui_moveid:this.get_block_id(i),bui_newregion:this.get_block_region(s)};this.get("cmid")&&(u.cmid=this.get("cmid")),i.next("."+r.BLOCK)&&!i.next("."+r.BLOCK).hasClass(r.BLOCKADMINBLOCK)&&(u.bui_beforeid=this.get_block_id(i.next("."+r.BLOCK))),e.io(M.cfg.wwwroot+n,{method:"POST",data:u,on:{start:function(){o.show()},success:function(t,n){window.setTimeout(function(){o.hide()},250);try{var r=e.JSON.parse(n.responseText);r.error&&new M.core.ajaxException(r)}catch(i){}},failure:function(e,t){this.ajax_failure(t),o.hide()},complete:function(){this.disable_regions_if_required()}},context:this})}},e.extend(o,M.core.dragdrop,o.prototype,{NAME:"core-blocks-dragdrop-manager",ATTRS:{courseid:{value:null},cmid:{value:null},contextid:{value:null},pagelayout:{value:null},pagetype:{value:null},subpage:{value:null},regions:{value:[]}}});var u=function(){u.superclass.constructor.apply(this,arguments)};u.prototype={initializer:function(){var t=this.get("node");t||(t=this.create_and_add_node());var n=e.one("body"),i=t.all("."+r.BLOCK).size()>0,s=this.get_has_region_class();this.set("hasblocks",i),n.hasClass(s)||n.addClass(s),n.addClass(i?this.get_used_region_class():this.get_empty_region_class()),n.removeClass(i?this.get_empty_region_class():this.get_used_region_class())},create_and_add_node:function(){var t=e.Node.create,n=this.get("region"),i=t('').addClass(r.BLOCKREGION).setData("blockregion",n),s=this.get("manager").get("regions"),o,u=!1,a=!1,f=!1,l,c;for(o in s)s[o].match(/(pre|left)/)?u=s[o]:s[o].match(/(post|right)/)&&(a=s[o]);return u!==!1&&a!==!1&&(n===u?(c=e.one("#block-region-"+a),c&&(c.insert(i,"before"),f=!0)):(l=e.one("#block-region-"+u),l&&(l.insert(i,"after"),f=!0))),f===!1&&e.one("body").append(i),this.set("node",i),i},change_block_move_icons:function(e){var t,n;this.get("node").all("."+r.BLOCK+" a."+r.EDITINGMOVE).each(function(r){r.setStyle("cursor","move"),t=e.get_drag_handle(r.getAttribute("title"),"","icon",!0),n=t.one("img"),n.addClass("iconsmall"),n.removeClass("icon"),r.replace(t)})},get_has_region_class:function(){return"has-region-"+this.get("region")},get_empty_region_class:function(){return"empty-region-"+this.get("region")},get_used_region_class:function(){return"used-region-"+this.get("region")},get_droptarget:function(){var e=this.get("node");return e.test('[data-droptarget="1"]')?e:e.one('[data-droptarget="1"]')},enable:function(){e.one("body").addClass(this.get_used_region_class()).removeClass(this.get_empty_region_class())},disable_if_required:function(){this.get("node").all("."+r.BLOCK).size()===0&&e.one("body").addClass(this.get_empty_region_class()).removeClass(this.get_used_region_class())}},e.extend(u,e.Base,u.prototype,{NAME:"core-blocks-dragdrop-blockregion",ATTRS:{manager:{writeOnce:"initOnly",validator:function(t){return e.Lang.isObject(t)&&t instanceof o}},region:{writeOnce:"initOnly",validator:function(t){return e.Lang.isString(t)}},node:{validator:function(t){return e.Lang.isObject(t)||e.Lang.isNull(t)}},hasblocks:{value:!1,validator:function(t){return e.Lang.isBoolean(t)}}}})},"@VERSION@",{requires:["base","node","io","dom","dd","dd-scroll","moodle-core-dragdrop","moodle-core-notification"]});