YUI.add("node-scroll-info",function(s,t){var i=s.config.doc,e=s.config.win;s.Plugin.ScrollInfo=s.Base.create("scrollInfoPlugin",s.Plugin.Base,[],{initializer:function(t){this._host=t.host,this._hostIsBody="body"===this._host.get("nodeName").toLowerCase(),this._scrollDelay=this.get("scrollDelay"),this._scrollMargin=this.get("scrollMargin"),this._scrollNode=this._getScrollNode(),this.refreshDimensions(),this._lastScroll=this.getScrollInfo(),this._bind()},destructor:function(){new s.EventHandle(this._events).detach(),this._events=null},getOffscreenNodes:function(t,i){void 0===i&&(i=this._scrollMargin);t=s.Selector.query(t||"*",this._host._node);return new s.NodeList(s.Array.filter(t,function(t){return!this._isElementOnscreen(t,i)},this))},getOnscreenNodes:function(t,i){void 0===i&&(i=this._scrollMargin);t=s.Selector.query(t||"*",this._host._node);return new s.NodeList(s.Array.filter(t,function(t){return this._isElementOnscreen(t,i)},this))},getScrollInfo:function(){var t=this._scrollNode,i=this._lastScroll,e=this._scrollMargin,s=t.scrollLeft,o=t.scrollHeight,l=t.scrollTop,t=t.scrollWidth,r=l+this._height,n=s+this._width;return{atBottom:o-e<r,atLeft:s<e,atRight:t-e<n,atTop:l<e,isScrollDown:i&&l>i.scrollTop,isScrollLeft:i&&s<i.scrollLeft,isScrollRight:i&&s>i.scrollLeft,isScrollUp:i&&l<i.scrollTop,scrollBottom:r,scrollHeight:o,scrollLeft:s,scrollRight:n,scrollTop:l,scrollWidth:t}},isNodeOnscreen:function(t,i){return!(!(t=s.one(t))||!this._isElementOnscreen(t._node,i))},refreshDimensions:function(){var t=i.documentElement;s.UA.ios||s.UA.android&&s.UA.chrome?(this._winHeight=e.innerHeight,this._winWidth=e.innerWidth):(this._winHeight=t.clientHeight,this._winWidth=t.clientWidth),this._hostIsBody?(this._height=this._winHeight,this._width=this._winWidth):(this._height=this._scrollNode.clientHeight,this._width=this._scrollNode.clientWidth),this._refreshHostBoundingRect()},_bind:function(){var t=s.one("win");this._events=[this.after({scrollDelayChange:this._afterScrollDelayChange,scrollMarginChange:this._afterScrollMarginChange}),t.on("windowresize",this._afterResize,this)],this._hostIsBody?this._events.push(t.after("scroll",this._afterHostScroll,this)):this._events.push(t.after("scroll",this._afterWindowScroll,this),this._host.after("scroll",this._afterHostScroll,this))},_getScrollNode:function(){return this._hostIsBody&&!s.UA.webkit?i.documentElement:s.Node.getDOMNode(this._host)},_isElementOnscreen:function(t,i){var e=this._hostRect,t=t.getBoundingClientRect();return void 0===i&&(i=this._scrollMargin),!(t.top>e.bottom+i||t.bottom<e.top-i||t.right<e.left-i||t.left>e.right+i)},_refreshHostBoundingRect:function(){var t,i=this._winHeight,e=this._winWidth;this._hostIsBody?(t={bottom:i,height:i,left:0,right:e,top:0,width:e},this._isHostOnscreen=!0):t=this._scrollNode.getBoundingClientRect(),this._hostRect=t},_triggerScroll:function(t){var i=this.getScrollInfo(),t=s.merge(t,i),e=this._lastScroll;this._lastScroll=i,this.fire("scroll",t),i.isScrollLeft?this.fire("scrollLeft",t):i.isScrollRight&&this.fire("scrollRight",t),i.isScrollUp?this.fire("scrollUp",t):i.isScrollDown&&this.fire("scrollDown",t),i.atBottom&&(!e.atBottom||i.scrollHeight>e.scrollHeight)&&this.fire("scrollToBottom",t),i.atLeft&&!e.atLeft&&this.fire("scrollToLeft",t),i.atRight&&(!e.atRight||i.scrollWidth>e.scrollWidth)&&this.fire("scrollToRight",t),i.atTop&&!e.atTop&&this.fire("scrollToTop",t)},_afterHostScroll:function(t){var i=this;clearTimeout(this._scrollTimeout),this._scrollTimeout=setTimeout(function(){i._triggerScroll(t)},this._scrollDelay)},_afterResize:function(){this.refreshDimensions()},_afterScrollDelayChange:function(t){this._scrollDelay=t.newVal},_afterScrollMarginChange:function(t){this._scrollMargin=t.newVal},_afterWindowScroll:function(){this._refreshHostBoundingRect()}},{NS:"scrollInfo",ATTRS:{scrollDelay:{value:50},scrollMargin:{value:50}}})},"patched-v3.18.7",{requires:["array-extras","base-build","event-resize","node-pluginhost","plugin","selector"]});