YUI.add("widget-base",function(r,t){var i,n,s=r.Lang,o=r.Node,e=r.ClassNameManager,u=e.getClassName,a=r.cached(function(t){return t.substring(0,1).toUpperCase()+t.substring(1)}),c="content",h="visible",l="disabled",d="focused",_="width",g="height",f="boundingBox",N="contentBox",m="ownerDocument",v="srcNode",C="tabIndex",b="id",I="render",T="rendered",p="strings",D="
",E="loading",S="_uiSet",U=function(){},B=!0,y=!1,A={},F=[h,l,g,_,d,C],O=r.UA.webkit,x={};function w(t){var e,s,n=this,i=n.constructor;n._strs={},n._cssPrefix=i.CSS_PREFIX||u(i.NAME.toLowerCase()),t=t||{},w.superclass.constructor.call(n,t),(s=n.get(I))&&(s!==B&&(e=s),n.render(e))}w.NAME="widget",n=w.UI_SRC="ui",(w.ATTRS=A).id={valueFn:"_guid",writeOnce:B},A[T]={value:y,readOnly:B},A[f]={valueFn:"_defaultBB",setter:"_setBB",writeOnce:B},A[N]={valueFn:"_defaultCB",setter:"_setCB",writeOnce:B},A[C]={value:null,validator:"_validTabIndex"},A[d]={value:y,readOnly:B},A[l]={value:y},A[h]={value:B},A[g]={value:""},A[_]={value:""},A[p]={value:{},setter:"_strSetter",getter:"_strGetter"},A[I]={value:y,writeOnce:B},w.CSS_PREFIX=u(w.NAME.toLowerCase()),i=w.getClassName=function(){return u.apply(e,[w.CSS_PREFIX].concat(r.Array(arguments),!0))},w.getByNode=function(t){var e,s=i();return(t=o.one(t))&&(t=t.ancestor("."+s,!0))&&(e=x[r.stamp(t,!0)]),e||null},r.extend(w,r.Base,{getClassName:function(){return u.apply(e,[this._cssPrefix].concat(r.Array(arguments),!0))},initializer:function(t){var e=this.get(f);e instanceof o&&this._mapInstance(r.stamp(e))},_mapInstance:function(t){x[t]=this},destructor:function(){var t,e=this.get(f);e instanceof o&&((t=r.stamp(e,!0))in x&&delete x[t],this._destroyBox())},destroy:function(t){return this._destroyAllNodes=t,w.superclass.destroy.apply(this)},_destroyBox:function(){var t,e=this.get(f),s=this.get(N),n=this._destroyAllNodes;t=e&&e.compareTo(s),this.UI_EVENTS&&this._destroyUIEvents(),this._unbindUI(e),s&&(n&&s.empty(),s.remove(B)),t||(n&&e.empty(),e.remove(B))},render:function(t){return this.get("destroyed")||this.get(T)||(this.publish(I,{queuable:y,fireOnce:B,defaultTargetOnly:B,defaultFn:this._defRenderFn}),this.fire(I,{parentNode:t?o.one(t):null})),this},_defRenderFn:function(t){this._parentNode=t.parentNode,this.renderer(),this._set(T,B),this._removeLoadingClassNames()},renderer:function(){var t=this;t._renderUI(),t.renderUI(),t._bindUI(),t.bindUI(),t._syncUI(),t.syncUI()},bindUI:U,renderUI:U,syncUI:U,hide:function(){return this.set(h,y)},show:function(){return this.set(h,B)},focus:function(){return this._set(d,B)},blur:function(){return this._set(d,y)},enable:function(){return this.set(l,y)},disable:function(){return this.set(l,B)},_uiSizeCB:function(t){this.get(N).toggleClass(i(c,"expanded"),t)},_renderBox:function(t){var e=this.get(N),s=this.get(f),n=this.get(v),i=this.DEF_PARENT_NODE,r=n&&n.get(m)||s.get(m)||e.get(m);!n||n.compareTo(e)||e.inDoc(r)||n.replace(e),s.compareTo(e.get("parentNode"))||s.compareTo(e)||(e.inDoc(r)&&e.replace(s),s.appendChild(e)),(t=t||i&&o.one(i))?t.appendChild(s):s.inDoc(r)||o.one("body").insert(s,0)},_setBB:function(t){return this._setBox(this.get(b),t,this.BOUNDING_TEMPLATE,!0)},_setCB:function(t){return null===this.CONTENT_TEMPLATE?this.get(f):this._setBox(null,t,this.CONTENT_TEMPLATE,!1)},_defaultBB:function(){var t=this.get(v),e=null===this.CONTENT_TEMPLATE;return t&&e?t:null},_defaultCB:function(t){return this.get(v)||null},_setBox:function(t,e,s,n){return(e=o.one(e))||(e=o.create(s),n?this._bbFromTemplate=!0:this._cbFromTemplate=!0),e.get(b)||e.set(b,t||r.guid()),e},_renderUI:function(){this._renderBoxClassNames(),this._renderBox(this._parentNode)},_renderBoxClassNames:function(){var t,e,s=this._getClasses(),n=this.get(f);for(n.addClass(i()),e=s.length-3;0<=e;e--)t=s[e],n.addClass(t.CSS_PREFIX||u(t.NAME.toLowerCase()));this.get(N).addClass(this.getClassName(c))},_removeLoadingClassNames:function(){var t=this.get(f),e=this.get(N),s=this.getClassName(E),n=i(E);t.removeClass(n).removeClass(s),e.removeClass(n).removeClass(s)},_bindUI:function(){this._bindAttrUI(this._UI_ATTRS.BIND),this._bindDOM()},_unbindUI:function(t){this._unbindDOM(t)},_bindDOM:function(){var t=this.get(f).get(m),e=w._hDocFocus;e||((e=w._hDocFocus=t.on("focus",this._onDocFocus,this)).listeners={count:0}),e.listeners[r.stamp(this,!0)]=!0,e.listeners.count++,O&&(this._hDocMouseDown=t.on("mousedown",this._onDocMouseDown,this))},_unbindDOM:function(t){var e,s=w._hDocFocus,n=r.stamp(this,!0),i=this._hDocMouseDown;s&&((e=s.listeners)[n]&&(delete e[n],e.count--),0===e.count&&(s.detach(),w._hDocFocus=null)),O&&i&&i.detach()},_syncUI:function(){this._syncAttrUI(this._UI_ATTRS.SYNC)},_uiSetHeight:function(t){this._uiSetDim(g,t),this._uiSizeCB(""!==t&&"auto"!==t)},_uiSetWidth:function(t){this._uiSetDim(_,t)},_uiSetDim:function(t,e){this.get(f).setStyle(t,s.isNumber(e)?e+this.DEF_UNIT:e)},_uiSetVisible:function(t){this.get(f).toggleClass(this.getClassName("hidden"),!t)},_uiSetDisabled:function(t){this.get(f).toggleClass(this.getClassName(l),t)},_uiSetFocused:function(t,e){var s=this.get(f);s.toggleClass(this.getClassName(d),t),e!==n&&(t?s.focus():s.blur())},_uiSetTabIndex:function(t){var e=this.get(f);s.isNumber(t)?e.set(C,t):e.removeAttribute(C)},_onDocMouseDown:function(t){this._domFocus&&this._onDocFocus(t)},_onDocFocus:function(t){var e=w.getByNode(t.target),s=w._active;s&&s!==e&&(s._domFocus=!1,s._set(d,!1,{src:n}),w._active=null),e&&(e._domFocus=!0,e._set(d,!0,{src:n}),w._active=e)},toString:function(){return this.name+"["+this.get(b)+"]"},DEF_UNIT:"px",DEF_PARENT_NODE:null,CONTENT_TEMPLATE:D,BOUNDING_TEMPLATE:D,_guid:function(){return r.guid()},_validTabIndex:function(t){return s.isNumber(t)||s.isNull(t)},_bindAttrUI:function(t){var e,s=t.length;for(e=0;e