YUI.add("dd-scroll",function(e,t){var i,l,n=function(){n.superclass.constructor.apply(this,arguments)},m="host",p="buffer",w="parentScroll",T="windowScroll",D="scrollTop",N="scrollLeft",s="offsetWidth",c="offsetHeight";n.ATTRS={parentScroll:{value:!1,setter:function(t){return t||!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 t=this.get(w),i=this.get(p),e=this.get(T),l=e?[]:t.getXY(),n=e?"winWidth":s,o=e?"winHeight":c,r=e?t.get(D):l[1],e=e?t.get(N):l[0],l={top:r+i,right:t.get(n)+e-i,bottom:t.get(o)+r-i,left:e+i};return this._vpRegionCache=l},initializer:function(){var t=this.get(m);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(t){var i=this._getVPRegion(),e=this.get(m),l=this.get(T),n=e.lastXY,o=!1,r=this.get(p),s=this.get(w),c=s.get(D),a=s.get(N),h=this._dimCache.w,g=this._dimCache.h,g=n[1]+g,u=n[1],h=n[0]+h,d=n[0],f=u,_=d,S=c,v=a;this.get("horizontal")&&(d<=i.left&&(o=!0,_=n[0]-(l?r:0),v=a-r),h>=i.right)&&(o=!0,_=n[0]+(l?r:0),v=a+r),this.get("vertical")&&(g>=i.bottom&&(o=!0,f=n[1]+(l?r:0),S=c+r),u<=i.top)&&(o=!0,f=n[1]-(l?r:0),S=c-r),S<0&&(S=0,f=n[1]),v<0&&(_=n[v=0]),f<0&&(f=n[1]),_<0&&(_=n[0]),t?(e.actXY=[_,f],e._alignNode([_,f],!0),e.actXY,e.actXY=[_,f],e._moveNode({node:s,top:S,left:v}),S||v||this._cancelScroll()):o?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(t){this._scrolling&&(this._cancelScroll(),t.preventDefault()),this._scrolling||this._checkWinScroll()},_setDimCache:function(){var t=this.get(m).get("dragNode");this._dimCache={h:t.get(c),w:t.get(s)}},start:function(){this._setDimCache()},end:function(){this._dimCache=null,this._cancelScroll()}}),e.namespace("Plugin"),(i=function(){i.superclass.constructor.apply(this,arguments)}).ATTRS=e.merge(n.ATTRS,{windowScroll:{value:!0,setter:function(t){return t&&this.set(w,e.one("win")),t}}}),e.extend(i,n,{initializer:function(){this.set("windowScroll",this.get("windowScroll"))}}),i.NAME=i.NS="winscroll",e.Plugin.DDWinScroll=i,(l=function(){l.superclass.constructor.apply(this,arguments)}).ATTRS=e.merge(n.ATTRS,{node:{value:!1,setter:function(t){var i=e.one(t);return i?this.set(w,i):!1!==t&&e.error("DDNodeScroll: Invalid Node Given: "+t),i}}}),e.extend(l,n,{initializer:function(){this.set("node",this.get("node"))}}),l.NAME=l.NS="nodescroll",e.Plugin.DDNodeScroll=l,e.DD.Scroll=n},"patched-v3.18.7",{requires:["dd-drag"]});