AUI.add("aui-overlay-context",function(P){var H=P.Lang,N=H.isString,O=H.isNumber,K=H.isObject,J=H.isBoolean,R=function(A){return(A instanceof P.NodeList);},G="align",X="bl",Y="boundingBox",B="cancellableHide",Q="overlaycontext",Z="currentNode",M="focused",W="hide",D="hideDelay",S="hideOn",U="hideOnDocumentClick",I="mousedown",E="show",b="showDelay",V="showOn",a="tl",C="trigger",T="visible";var F=P.Component.create({NAME:Q,ATTRS:{align:{value:{node:null,points:[a,X]}},cancellableHide:{value:true,validator:J},currentNode:{valueFn:function(){return this.get(C).item(0);}},delay:{value:null,validator:K},hideOn:{lazyAdd:false,value:"mouseout",setter:function(A){return this._setHideOn(A);}},hideOnDocumentClick:{lazyAdd:false,setter:function(A){return this._setHideOnDocumentClick(A);},value:true,validator:J},hideDelay:{value:0},showOn:{lazyAdd:false,value:"mouseover",setter:function(A){return this._setShowOn(A);}},showDelay:{value:0,validator:O},trigger:{lazyAdd:false,setter:function(A){if(R(A)){return A;}else{if(N(A)){return P.all(A);}}return new P.NodeList([A]);}},visible:{value:false}},EXTENDS:P.OverlayBase,constructor:function(L){var A=this;A._hideTask=new P.DelayedTask(A.hide,A);A._showTask=new P.DelayedTask(A.show,A);A._showCallback=null;A._hideCallback=null;F.superclass.constructor.apply(this,arguments);},prototype:{bindUI:function(){var A=this;var L=A.get(Y);L.on(I,A._stopTriggerEventPropagation);A.before("triggerChange",A._beforeTriggerChange);A.before("showOnChange",A._beforeShowOnChange);A.before("hideOnChange",A._beforeHideOnChange);A.after("triggerChange",A._afterTriggerChange);A.after("showOnChange",A._afterShowOnChange);A.after("hideOnChange",A._afterHideOnChange);L.on("click",P.bind(A._cancelAutoHide,A));L.on("mouseenter",P.bind(A._cancelAutoHide,A));L.on("mouseleave",P.bind(A._invokeHideTaskOnInteraction,A));A.after("focusedChange",P.bind(A._invokeHideTaskOnInteraction,A));A.on("visibleChange",A._onVisibleChangeOverlayContext);},hide:function(){var A=this;A.clearIntervals();A.fire("hide");F.superclass.hide.apply(A,arguments);},show:function(L){var A=this;A.clearIntervals();A.updateCurrentNode(L);A.fire("show");F.superclass.show.apply(A,arguments);A.refreshAlign();},toggle:function(L){var A=this;if(A.get(T)){A._hideTask.delay(A.get(D),null,null,[L]);}else{A._showTask.delay(A.get(b),null,null,[L]);}},clearIntervals:function(){this._hideTask.cancel();this._showTask.cancel();},refreshAlign:function(){var A=this;var c=A.get(G);var L=A.get(Z);if(L){A._uiSetAlign(L,c.points);}},updateCurrentNode:function(d){var A=this;var f=A.get(G);var L=A.get(C);var e=null;if(d){e=d.currentTarget;}var c=f.node||e||L.item(0);if(c){A.set(Z,c);}},_toggle:function(L){var A=this;var c=L.currentTarget;if(A._lastTarget!=c){A.hide();}A.toggle(L);L.stopPropagation();A._lastTarget=c;},_afterShowOnChange:function(c){var A=this;var d=c.prevVal==A.get(S);if(d){var L=A.get(C);L.detach(c.prevVal,A._hideCallback);A._setHideOn(A.get(S));}},_afterHideOnChange:function(c){var A=this;var d=c.prevVal==A.get(V);if(d){var L=A.get(C);L.detach(c.prevVal,A._showCallback);A._setShowOn(A.get(V));}},_afterTriggerChange:function(L){var A=this;A._setShowOn(A.get(V));A._setHideOn(A.get(S));},_beforeShowOnChange:function(c){var A=this;var L=A.get(C);L.detach(c.prevVal,A._showCallback);},_beforeHideOnChange:function(c){var A=this;var L=A.get(C);L.detach(c.prevVal,A._hideCallback);},_beforeTriggerChange:function(e){var A=this;var d=A.get(C);var L=A.get(V);var c=A.get(S);d.detach(L,A._showCallback);d.detach(c,A._hideCallback);d.detach(I,A._stopTriggerEventPropagation);},_cancelAutoHide:function(L){var A=this;if(A.get(B)){A.clearIntervals();}L.stopPropagation();},_invokeHideTaskOnInteraction:function(c){var L=this;var A=L.get(B);var d=L.get(M);if(!d&&!A){L._hideTask.delay(L.get(D));}},_onVisibleChangeOverlayContext:function(L){var A=this;if(L.newVal&&A.get("disabled")){L.preventDefault();}},_stopTriggerEventPropagation:function(A){A.stopPropagation();},_setHideOn:function(e){var L=this;var d=L.get(C);var A=e==L.get(V);if(A){L._hideCallback=P.bind(L._toggle,L);d.detach(e,L._showCallback);}else{var c=L.get(D);L._hideCallback=function(f){L._hideTask.delay(c,null,null,[f]);f.stopPropagation();};}d.on(e,L._hideCallback);return e;},_setHideOnDocumentClick:function(L){var A=this;if(L){P.OverlayContextManager.register(A);}else{P.OverlayContextManager.remove(A);}return L;},_setShowOn:function(e){var L=this;var d=L.get(C);var A=e==L.get(S);if(A){L._showCallback=P.bind(L._toggle,L);d.detach(e,L._hideCallback);}else{var c=L.get(b);L._showCallback=function(f){L._showTask.delay(c,null,null,[f]);f.stopPropagation();};}if(e!=I){d.on(I,L._stopTriggerEventPropagation);}else{d.detach(I,L._stopTriggerEventPropagation);}d.on(e,L._showCallback);return e;}}});P.OverlayContext=F;P.OverlayContextManager=new P.OverlayManager({});P.on(I,function(){P.OverlayContextManager.hideAll();},P.getDoc());},"1.0.1",{requires:["aui-overlay-manager","aui-delayed-task"]});