/*
 Copyright (c) 2010, Yahoo! Inc. All rights reserved.
 Code licensed under the BSD License:
 http://developer.yahoo.com/yui/license.html
 version: 3.3.0
 build: 3167
 */
YUI.add('base-base',function(Y){var O=Y.Object,L=Y.Lang,DOT=".",DESTROY="destroy",INIT="init",INITIALIZED="initialized",DESTROYED="destroyed",INITIALIZER="initializer",BUBBLETARGETS="bubbleTargets",_BUBBLETARGETS="_bubbleTargets",OBJECT_CONSTRUCTOR=Object.prototype.constructor,DEEP="deep",SHALLOW="shallow",DESTRUCTOR="destructor",Attribute=Y.Attribute;function Base(){Y.stamp(this);Attribute.call(this);var PluginHost=Y.Plugin&&Y.Plugin.Host;if(this._initPlugins&&PluginHost){PluginHost.call(this);}
if(this._lazyAddAttrs!==false){this._lazyAddAttrs=true;}
this.name=this.constructor.NAME;this._eventPrefix=this.constructor.EVENT_PREFIX||this.constructor.NAME;this.init.apply(this,arguments);}
Base._ATTR_CFG=Attribute._ATTR_CFG.concat("cloneDefaultValue");Base.NAME="base";Base.ATTRS={initialized:{readOnly:true,value:false},destroyed:{readOnly:true,value:false}};Base.prototype={init:function(config){this._yuievt.config.prefix=this._eventPrefix;this.publish(INIT,{queuable:false,fireOnce:true,defaultTargetOnly:true,defaultFn:this._defInitFn});this._preInitEventCfg(config);this.fire(INIT,{cfg:config});return this;},_preInitEventCfg:function(config){if(config){if(config.on){this.on(config.on);}
if(config.after){this.after(config.after);}}
var i,l,target,userTargets=(config&&BUBBLETARGETS in config);if(userTargets||_BUBBLETARGETS in this){target=userTargets?(config&&config.bubbleTargets):this._bubbleTargets;if(L.isArray(target)){for(i=0,l=target.length;i<l;i++){this.addTarget(target[i]);}}else if(target){this.addTarget(target);}}},destroy:function(){this.publish(DESTROY,{queuable:false,fireOnce:true,defaultTargetOnly:true,defaultFn:this._defDestroyFn});this.fire(DESTROY);this.detachAll();return this;},_defInitFn:function(e){this._initHierarchy(e.cfg);if(this._initPlugins){this._initPlugins(e.cfg);}
this._set(INITIALIZED,true);},_defDestroyFn:function(e){this._destroyHierarchy();if(this._destroyPlugins){this._destroyPlugins();}
this._set(DESTROYED,true);},_getClasses:function(){if(!this._classes){this._initHierarchyData();}
return this._classes;},_getAttrCfgs:function(){if(!this._attrs){this._initHierarchyData();}
return this._attrs;},_filterAttrCfgs:function(clazz,allCfgs){var cfgs=null,attr,attrs=clazz.ATTRS;if(attrs){for(attr in attrs){if(attrs.hasOwnProperty(attr)&&allCfgs[attr]){cfgs=cfgs||{};cfgs[attr]=allCfgs[attr];delete allCfgs[attr];}}}
return cfgs;},_initHierarchyData:function(){var c=this.constructor,classes=[],attrs=[];while(c){classes[classes.length]=c;if(c.ATTRS){attrs[attrs.length]=c.ATTRS;}
c=c.superclass?c.superclass.constructor:null;}
this._classes=classes;this._attrs=this._aggregateAttrs(attrs);},_aggregateAttrs:function(allAttrs){var attr,attrs,cfg,val,path,i,clone,cfgProps=Base._ATTR_CFG,aggAttrs={};if(allAttrs){for(i=allAttrs.length-1;i>=0;--i){attrs=allAttrs[i];for(attr in attrs){if(attrs.hasOwnProperty(attr)){cfg=Y.mix({},attrs[attr],true,cfgProps);val=cfg.value;clone=cfg.cloneDefaultValue;if(val){if((clone===undefined&&(OBJECT_CONSTRUCTOR===val.constructor||L.isArray(val)))||clone===DEEP||clone===true){cfg.value=Y.clone(val);}else if(clone===SHALLOW){cfg.value=Y.merge(val);}}
path=null;if(attr.indexOf(DOT)!==-1){path=attr.split(DOT);attr=path.shift();}
if(path&&aggAttrs[attr]&&aggAttrs[attr].value){O.setValue(aggAttrs[attr].value,path,val);}else if(!path){if(!aggAttrs[attr]){aggAttrs[attr]=cfg;}else{Y.mix(aggAttrs[attr],cfg,true,cfgProps);}}}}}}
return aggAttrs;},_initHierarchy:function(userVals){var lazy=this._lazyAddAttrs,constr,constrProto,ci,ei,el,classes=this._getClasses(),attrCfgs=this._getAttrCfgs();for(ci=classes.length-1;ci>=0;ci--){constr=classes[ci];constrProto=constr.prototype;if(constr._yuibuild&&constr._yuibuild.exts){for(ei=0,el=constr._yuibuild.exts.length;ei<el;ei++){constr._yuibuild.exts[ei].apply(this,arguments);}}
this.addAttrs(this._filterAttrCfgs(constr,attrCfgs),userVals,lazy);if(constrProto.hasOwnProperty(INITIALIZER)){constrProto.initializer.apply(this,arguments);}}},_destroyHierarchy:function(){var constr,constrProto,ci,cl,classes=this._getClasses();for(ci=0,cl=classes.length;ci<cl;ci++){constr=classes[ci];constrProto=constr.prototype;if(constrProto.hasOwnProperty(DESTRUCTOR)){constrProto.destructor.apply(this,arguments);}}},toString:function(){return this.name+"["+Y.stamp(this,true)+"]";}};Y.mix(Base,Attribute,false,null,1);Base.prototype.constructor=Base;Y.Base=Base;},'3.3.0',{requires:['attribute-base']});YUI.add('base-pluginhost',function(Y){var Base=Y.Base,PluginHost=Y.Plugin.Host;Y.mix(Base,PluginHost,false,null,1);Base.plug=PluginHost.plug;Base.unplug=PluginHost.unplug;},'3.3.0',{requires:['base-base','pluginhost']});YUI.add('base-build',function(Y){var Base=Y.Base,L=Y.Lang,build;Base._build=function(name,main,extensions,px,sx,cfg){var build=Base._build,builtClass=build._ctor(main,cfg),buildCfg=build._cfg(main,cfg),_mixCust=build._mixCust,aggregates=buildCfg.aggregates,custom=buildCfg.custom,dynamic=builtClass._yuibuild.dynamic,i,l,val,extClass;if(dynamic&&aggregates){for(i=0,l=aggregates.length;i<l;++i){val=aggregates[i];if(main.hasOwnProperty(val)){builtClass[val]=L.isArray(main[val])?[]:{};}}}
for(i=0,l=extensions.length;i<l;i++){extClass=extensions[i];Y.mix(builtClass,extClass,true,null,1);_mixCust(builtClass,extClass,aggregates,custom);builtClass._yuibuild.exts.push(extClass);}
if(px){Y.mix(builtClass.prototype,px,true);}
if(sx){Y.mix(builtClass,build._clean(sx,aggregates,custom),true);_mixCust(builtClass,sx,aggregates,custom);}
builtClass.prototype.hasImpl=build._impl;if(dynamic){builtClass.NAME=name;builtClass.prototype.constructor=builtClass;}
return builtClass;};build=Base._build;Y.mix(build,{_mixCust:function(r,s,aggregates,custom){if(aggregates){Y.aggregate(r,s,true,aggregates);}
if(custom){for(var j in custom){if(custom.hasOwnProperty(j)){custom[j](j,r,s);}}}},_tmpl:function(main){function BuiltClass(){BuiltClass.superclass.constructor.apply(this,arguments);}
Y.extend(BuiltClass,main);return BuiltClass;},_impl:function(extClass){var classes=this._getClasses(),i,l,cls,exts,ll,j;for(i=0,l=classes.length;i<l;i++){cls=classes[i];if(cls._yuibuild){exts=cls._yuibuild.exts;ll=exts.length;for(j=0;j<ll;j++){if(exts[j]===extClass){return true;}}}}
return false;},_ctor:function(main,cfg){var dynamic=(cfg&&false===cfg.dynamic)?false:true,builtClass=(dynamic)?build._tmpl(main):main,buildCfg=builtClass._yuibuild;if(!buildCfg){buildCfg=builtClass._yuibuild={};}
buildCfg.id=buildCfg.id||null;buildCfg.exts=buildCfg.exts||[];buildCfg.dynamic=dynamic;return builtClass;},_cfg:function(main,cfg){var aggr=[],cust={},buildCfg,cfgAggr=(cfg&&cfg.aggregates),cfgCustBuild=(cfg&&cfg.custom),c=main;while(c&&c.prototype){buildCfg=c._buildCfg;if(buildCfg){if(buildCfg.aggregates){aggr=aggr.concat(buildCfg.aggregates);}
if(buildCfg.custom){Y.mix(cust,buildCfg.custom,true);}}
c=c.superclass?c.superclass.constructor:null;}
if(cfgAggr){aggr=aggr.concat(cfgAggr);}
if(cfgCustBuild){Y.mix(cust,cfg.cfgBuild,true);}
return{aggregates:aggr,custom:cust};},_clean:function(sx,aggregates,custom){var prop,i,l,sxclone=Y.merge(sx);for(prop in custom){if(sxclone.hasOwnProperty(prop)){delete sxclone[prop];}}
for(i=0,l=aggregates.length;i<l;i++){prop=aggregates[i];if(sxclone.hasOwnProperty(prop)){delete sxclone[prop];}}
return sxclone;}});Base.build=function(name,main,extensions,cfg){return build(name,main,extensions,null,null,cfg);};Base.create=function(name,base,extensions,px,sx){return build(name,base,extensions,px,sx);};Base.mix=function(main,extensions){return build(null,main,extensions,null,null,{dynamic:false});};Base._buildCfg={custom:{ATTRS:function(prop,r,s){r.ATTRS=r.ATTRS||{};if(s.ATTRS){var sAttrs=s.ATTRS,rAttrs=r.ATTRS,a;for(a in sAttrs){if(sAttrs.hasOwnProperty(a)){rAttrs[a]=rAttrs[a]||{};Y.mix(rAttrs[a],sAttrs[a],true);}}}}},aggregates:["_PLUG","_UNPLUG"]};},'3.3.0',{requires:['base-base']});YUI.add('base',function(Y){},'3.3.0',{after:['attribute-complex'],use:['base-base','base-pluginhost','base-build']});