YUI.add("aui-sortable-list",function(e,t){var n=e.Lang,r=n.isString,i=n.isFunction,s="block",o="body",u="dd",a="display",f="down",l="dragNode",c="dropCondition",h="dropContainer",p="dropOn",d="float",v="height",m="helper",g="hidden",y="left",b="node",w="nodes",E="none",S="offsetHeight",x="placeholder",T="proxy",N="px",C="right",k="sortCondition",L="sortable-list",A="up",O="visibility",M="visible",_=e.DD.DDM,D=function(t){return t instanceof e.NodeList},P=e.Component.create({NAME:L,ATTRS:{dd:{value:null},dropCondition:{value:function(){return!0},setter:function(t){return e.bind(t,this)},validator:i},dropContainer:{value:function(e){var t=this,n=e.drop,r=n.get(b),i=t.get(p);return r.one(i)},validator:i},dropOn:{validator:r},helper:{value:null},nodes:{setter:function(e){return this._setNodes(e)}},placeholder:{value:null},proxy:{value:null,setter:function(t){return e.merge({moveOnEnd:!1,positionProxy:!1},t||{})}},sortCondition:{value:function(){return!0},setter:function(t){return e.bind(t,this)},validator:i}},EXTENDS:e.Base,prototype:{initializer:function(){var e=this,t=e.get(w);e.on("drag:align",e._onDragAlign),e.on("drag:end",e._onDragEnd),e.on("drag:exit",e._onDragExit),e.on("drag:mouseDown",e._onDragMouseDown),e.on("drag:over",e._onDragOver),e.on("drag:start",e._onDragStart),e._createHelper(),t&&e.addAll(t)},add:function(e){var t=this;t._createDrag(e)},addAll:function(e){var t=this;e.each(function(e){t.add(e)})},_createDrag:function(t){var n=this,r=n.get(m);if(!_.getDrag(t)){var i={bubbleTargets:n,node:t,target:!0},s=n.get(T);r&&(s.borderStyle=null),(new e.DD.Drag(e.mix(i,n.get(u)))).plug(e.Plugin.DDProxy,s)}},_createHelper:function(){var t=this,n=t.get(m);n&&(e.one(o).append(n.hide()),t.set(m,n))},_updatePlaceholder:function(e,t){var n=this,r=e.target,i=e.drop,s=r.get(b),o=i.get(b),u=n.get(h),a;u&&(a=u.apply(n,arguments));var f=!1,l=n.XDirection,p=n.YDirection;o.getStyle(d)!==E&&(f=!0);var v=n.get(x);v||(v=s);if(!v.contains(o)){var m=n.get(c);a&&!t&&m(e)?!a.contains(v)&&!v.contains(a)&&a.append(v):f&&l===y||!f&&p===A?o.placeBefore(v):o.placeAfter(v)}},_onDragAlign:function(e){var t=this,n=t.lastX,r=t.lastY,i=e.target.lastXY,s=i[0],o=i[1];o!==r&&(t.YDirection=o<r?A:f),s!==n&&(t.XDirection=s<n?y:C),t.lastX=s,t.lastY=o},_onDragEnd:function(e){var t=this,n=e.target,r=n.get(b),i=t.get(x);i&&(r.show(),i.hide(),r.contains(i)||i.placeAfter(r))},_onDragExit:function(e){var t=this,n=t.get(k);n(e)&&t._updatePlaceholder(e,!0)},_onDragMouseDown:function(e){var t=this,n=e.target,r=t.get(m);r&&n.set(l,r)},_onDragStart:function(e){var t=this,n=e.target,r=n.get(b),i=t.get(m),o=t.get(x);o&&(o.setStyle(v,r.get(S)+N),r.hide(),o.show(),r.placeAfter(o),i&&i.setStyles({display:s,visibility:M}).show())},_onDragOver:function(e){var t=this,n=t.get(k);n(e)&&t._updatePlaceholder(e)},_setNodes:function(t){var n=this;return D(t)?t:r(t)?e.all(t):new e.NodeList([t])}}});e.SortableList=P},"2.0.0",{requires:["dd-drag","dd-drop","dd-proxy","aui-node","aui-component"]});
