text: /*
  Copyright (c) 2008, Yahoo! Inc. All rights reserved.
  Code licensed under the BSD License:
  http://developer.yahoo.net/yui/license.txt
  version: 3.0.0pr2
  */
  YUI.add("console",function(D){var G=D.ClassNameManager.getClassName,AC="console",l="entry",v="reset",A="checked",m="title",F="pause",d="paused",q="clear",P="info",g="warn",i="error",w="innerHTML",p="click",b="contentBox",f="disabled",t="startTime",N="lastTime",H="entryTemplate",u="rendered",W=".",x=G(AC,l),Q=G(AC,F),Z=G(AC,"checkbox"),V=G(AC,"button"),AB=G(AC,q),U=G(AC,F,"label"),S=G(AC,l,"meta"),r=G(AC,l,"cat"),e=G(AC,l,"src"),B=G(AC,l,"time"),X=G(AC,l,"content"),c=G(AC,"hd"),a=G(AC,"bd"),C=G(AC,"ft"),E=G(AC,"controls"),h=G(AC,m),k=/^(\S+)\s/,y=/&/g,K=/</g,s=/>/g,I="&#38;",j="&#60;",R="&#62;",J=D.Lang,O=J.isString,AA=J.isNumber,n=J.isObject,o=D.merge,z=D.substitute,M=D.Node.create;function T(){T.superclass.constructor.apply(this,arguments);}D.mix(T,{NAME:AC,LOG_LEVEL_INFO:3,LOG_LEVEL_WARN:2,LOG_LEVEL_ERROR:1,ENTRY_CLASSES:{entry_class:x,entry_meta_class:S,entry_cat_class:r,entry_src_class:e,entry_time_class:B,entry_content_class:X},CHROME_CLASSES:{console_hd_class:c,console_bd_class:a,console_ft_class:C,console_controls_class:E,console_checkbox_class:Z,console_pause_class:Q,console_pause_label_class:U,console_button_class:V,console_clear_class:AB,console_title_class:h},HEADER_TEMPLATE:'<div class="{console_hd_class}">'+'<h4 class="{console_title_class}">{str_title}</h4>'+"</div>",BODY_TEMPLATE:'<div class="{console_bd_class}"></div>',FOOTER_TEMPLATE:'<div class="{console_ft_class}">'+'<div class="{console_controls_class}">'+'<input type="checkbox" class="{console_checkbox_class} '+'{console_pause_class}" value="1" id="{id_guid}"> '+'<label for="{id_guid}" class="{console_pause_label_class}">'+"{str_pause}</label>"+'<input type="button" class="'+'{console_button_class} {console_clear_class}" '+'value="{str_clear}">'+"</div>"+"</div>",ENTRY_TEMPLATE:'<pre class="{entry_class} {cat_class} {src_class}">'+'<div class="{entry_meta_class}">'+"<p>"+'<span class="{entry_cat_class}">'+"{label}</span>"+'<span class="{entry_time_class}">'+" {totalTime}ms (+{elapsedTime}) {localTime}:"+"</span>"+"</p>"+'<p class="{entry_src_class}">'+"{sourceAndDetail}"+"</p>"+"</div>"+'<p class="{entry_content_class}">{message}</p>'+"</pre>",ATTRS:{logEvent:{value:"yui:log",writeOnce:true,validator:O},strings:{value:{title:"Log Console",pause:"Pause",clear:"Clear"}},paused:{value:false,validator:J.isBoolean},defaultCategory:{value:P,validator:O},defaultSource:{value:"global",validator:O},entryTemplate:{value:"",validator:O},logLevel:{value:D.config.logLevel,validator:function(L){return this._validateNewLogLevel(L);},set:function(L){return this._setLogLevel(L);}},printTimeout:{value:100,validator:AA},consoleLimit:{value:500,validator:AA},newestOnTop:{value:true},scrollIntoView:{value:true},startTime:{value:new Date()},lastTime:{value:new Date(),readOnly:true}}});D.extend(T,D.Widget,{_head:null,_body:null,_foot:null,_timeout:null,buffer:null,log:function(){return D.log.apply(D,arguments);},clearConsole:function(){this._body.set(w,"");this._clearTimeout();this.buffer=[];return this;},reset:function(){this.fire(v);return this;},printBuffer:function(){if(!this.get(d)&&this.get("rendered")){this._clearTimeout();var AD=this.buffer,Y,L;this.buffer=[];for(Y=0,L=AD.length;Y<L;++Y){this.printLogEntry(AD[Y]);}this._trimOldEntries();}return this;},printLogEntry:function(L){L=o(this._htmlEscapeMessage(L),T.ENTRY_CLASSES,{cat_class:this.getClassName(l,L.category),src_class:this.getClassName(l,L.source)});var Y=M(z(this.get("entryTemplate"),L));this._addToConsole(Y);return this;},initializer:function(){this.buffer=[];if(!this.get(H)){this.set(H,T.ENTRY_TEMPLATE);}D.on(this.get("logEvent"),D.bind(this._onLogEvent,this));this.publish(l,{defaultFn:this._defEntryFn});this.publish(v,{defaultFn:this._defResetFn});},renderUI:function(){this._initHead();this._initConsole();this._initFoot();},syncUI:function(){this.set(d,this.get(d));},bindUI:function(){this.get(b).query("input[type=checkbox]."+Q).on(p,this._onPauseClick,this);this.get(b).query("input[type=button]."+AB).on(p,this._onClearClick,this);this.after("stringsChange",this._afterStringsChange);this.after("pausedChange",this._afterPausedChange);this.after("consoleLimitChange",this._afterConsoleLimitChange);},_initHead:function(){var L=this.get(b),Y=o(T.CHROME_CLASSES,{str_title:this.get("strings.title")});this._head=M(z(T.HEADER_TEMPLATE,Y));L.insertBefore(this._head,L.get("firstChild"));},_initConsole:function(){this._body=M(z(T.BODY_TEMPLATE,T.CHROME_CLASSES));this.get(b).appendChild(this._body);},_initFoot:function(){var L=o(T.CHROME_CLASSES,{id_guid:D.guid(),str_pause:this.get("strings.pause"),str_clear:this.get("strings.clear")});this._foot=M(z(T.FOOTER_TEMPLATE,L));this.get(b).appendChild(this._foot);},_isInLogLevel:function(AE,L){var Y=this.get("logLevel"),AD=L===i?T.LOG_LEVEL_ERROR:L===g?T.LOG_LEVEL_WARN:T.LOG_LEVEL_INFO;return Y>=AD;},_normalizeMessage:function(AE,Y,AD){var L={time:new Date(),message:AE,category:Y||this.get("defaultCategory"),sourceAndDetail:AD||this.get("defaultSource"),source:null,label:null,localTime:null,elapsedTime:null,totalTime:null};L.source=k.test(L.sourceAndDetail)?RegExp.$1:L.sourceAndDetail;L.label=L.category;L.localTime=L.time.toLocaleTimeString?L.time.toLocaleTimeString():(L.time+"");L.elapsedTime=L.time-this.get(N);L.totalTime=L.time-this.get(t);this._set(N,L.time);return L;},_schedulePrint:function(){if(!this.get(d)&&!this._timeout){this._timeout=D.later(this.get("printTimeout"),this,this.printBuffer);}},_addToConsole:function(Y){var L=this.get("newestOnTop"),AD=this._body,AE;AD.insertBefore(Y,L?AD.get("firstChild"):null);if(this.get("scrollIntoView")){AE=L?0:AD.get("scrollHeight");AD.set("scrollTop",AE);}},_htmlEscapeMessage:function(L){L=D.clone(L);L.message=this._encodeHTML(L.message);L.label=this._encodeHTML(L.label);L.source=this._encodeHTML(L.source);L.sourceAndDetail=this._encodeHTML(L.sourceAndDetail);L.category=this._encodeHTML(L.category);return L;},_trimOldEntries:function(){var AE=this._body;if(AE){var L=AE.queryAll(W+x),AD=L?L.size()-this.get("consoleLimit"):0;
  if(AD>0){if(this.get("newestOnTop")){for(var Y=L.size();AD<Y;AD++){AE.removeChild(L.item(AD));}}else{for(;AD>=0;--AD){AE.removeChild(L.item(AD));}}}}},_encodeHTML:function(L){return O(L)?L.replace(y,I).replace(K,j).replace(s,R):L;},_clearTimeout:function(){if(this._timeout){this._timeout.cancel();this._timeout=null;}},_onPauseClick:function(Y){var L=Y.target.get(A);this.set(d,L,{src:D.Widget.UI_SRC});},_onClearClick:function(L){this.clearConsole();},_setLogLevel:function(L){if(O(L)){L=L.toLowerCase();L=L===i?T.LOG_LEVEL_ERROR:L===g?T.LOG_LEVEL_WARN:T.LOG_LEVEL_INFO;}else{if(!AA(L)){L=T.LOG_LEVEL_INFO;}}return L;},_validateNewLogLevel:function(L){return L===T.LOG_LEVEL_INFO||L===T.LOG_LEVEL_WARN||L===T.LOG_LEVEL_ERROR;},_afterStringsChange:function(AE){var AG=AE.subAttrName?AE.subAttrName.split(W)[1]:null,L=this.get(b),AD=AE.prevVal,AF=AE.newVal,Y;if((!AG||AG===m)&&AD.title!==AF.title){Y=L.query(W+h);if(Y){Y.set(w,AF.title);}}if((!AG||AG===F)&&AD.pause!==AF.pause){Y=L.query(W+U);if(Y){Y.set(w,AF.pause);}}if((!AG||AG===q)&&AD.clear!==AF.clear){Y=L.query(W+AB);if(Y){Y.set("value",AF.clear);}}},_afterPausedChange:function(AD){var L=AD.newVal;if(AD.src!==D.Widget.SRC_UI){var Y=this._foot.queryAll("input[type=checkbox]."+Q);if(Y){Y.set(A,L);}}if(!L){this._schedulePrint();}else{if(this._timeout){clearTimeout(this._timeout);this._timeout=null;}}},_afterConsoleLimitChange:function(){this._trimOldEntries();},_onLogEvent:function(AE,L,AD){if(!this.get(f)&&this._isInLogLevel(AE,L,AD)){var Y=D.config.debug;D.config.debug=false;this.fire(l,{message:this._normalizeMessage.apply(this,arguments)});D.config.debug=Y;}},_defResetFn:function(){this.clearConsole();this.set(t,new Date());this.set(f,false);this.set(d,false);},_defEntryFn:function(L){if(L.message){this.buffer.push(L.message);this._schedulePrint();}}});D.Console=T;},"3.0.0pr2",{requires:["substitute","widget"]});