json-min.js revision 80c2303f32a65a670907dba765dfde42dc319087
YUI.add("json-parse",function(Y){var Native=Y.config.win.JSON,_UNICODE_EXCEPTIONS=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,_ESCAPES=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,_VALUES=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,_BRACKETS=/(?:^|:|,)(?:\s*\[)+/g,_INVALID=/[^\],:{}\s]/,_SIMPLE=/^\s*(?:"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)\s*$/,_escapeException=function(c){return"\\u"+("0000"+(+(c.charCodeAt(0))).toString(16)).slice(-4);},_revive=function(data,reviver){var walk=function(o,key){var k,v,value=o[key];if(value&&typeof value==="object"){for(k in value){if(value.hasOwnProperty(k)){v=walk(value,k);if(v===undefined){delete value[k];}else{value[k]=v;}}}}return reviver.call(o,key,value);};return typeof reviver==="function"?walk({"":data},""):data;},_parse=function(s,reviver){if(typeof s==="string"){s=s.replace(_UNICODE_EXCEPTIONS,_escapeException);if(!_INVALID.test(s.replace(_ESCAPES,"@").replace(_VALUES,"]").replace(_BRACKETS,""))){return _revive(eval("("+s+")"),reviver);}}throw new SyntaxError("JSON.parse");},test;if(Native&&Object.prototype.toString.call(Native)==="[object JSON]"){try{test=Native.parse('{"x":1}',function(k,v){return k=="x"?2:v;});switch(test.x){case 1:_parse=function(s,reviver){return _SIMPLE.test(s)?eval("("+s+")"):_revive(Native.parse(s),reviver);};break;case 2:_parse=function(s,reviver){return Native.parse(s,reviver);};break;}}catch(e){}}Y.mix(Y.namespace("JSON"),{parse:_parse});},"@VERSION@");YUI.add("json-stringify",function(C){var a=Object.prototype.toString,F=C.Lang,A=F.isFunction,M=F.isArray,D=F.type,Q="string",S="number",P="boolean",N="object",b="array",O="regexp",I="error",Z="null",E="date",f="",d="{",H="}",G="[",T="]",R=",",K=",\n",B="\n",J=":",c=": ",L='"',U=C.config.win.JSON,V=function(g,s,h){var i=C.JSON._CHARS,Y=C.JSON._SPECIAL_CHARS,n=A(s)?s:null,e=[],u=C.JSON.dateToString,r=a.call(h).match(/String|Number/);if(n||typeof s!=="object"){s=undefined;}if(r){if(r[0]==="Number"){h=new Array(Math.min(Math.max(0,h),100)+1).join(" ");}r=h;}function q(m){if(!i[m]){i[m]="\\u"+("0000"+(+(m.charCodeAt(0))).toString(16)).slice(-4);}return i[m];}function t(m){return L+m.replace(Y,q)+L;}function k(v){for(var m=e.length-1;m>=0;--m){if(e[m]===v){throw new Error("JSON.stringify. Cyclical reference");}}return false;}function j(m){return m.replace(/^/gm,h);}function p(m,z){e.push(m);var AC=[],AA=r?c:J,y,x,AB,w,AD;if(z){for(y=m.length-1;y>=0;--y){AC[y]=l(m,y)||Z;}}else{w=M(s)?s:C.Object.keys(m);for(y=0,x=0,AB=w.length;y<AB;++y){if(typeof w[y]===Q){AD=l(m,w[y]);if(AD){AC[x++]=t(w[y])+AA+AD;}}}}e.pop();if(r&&AC.length){return z?G+B+j(AC.join(K))+B+T:d+B+j(AC.join(K))+B+H;}else{return z?G+AC.join(R)+T:d+AC.join(R)+H;}}function l(w,v){var x=A(n)?n.call(w,v,w[v]):w[v],m=D(x);if(m===N){if(/String|Number|Boolean/.test(a.call(x))){x=x.valueOf();m=D(x);}}switch(m){case Q:return t(x);case S:return isFinite(x)?x+f:Z;case P:return x+f;case E:return u(x);case Z:return Z;case b:k(x);return p(x,true);case O:case I:case N:k(x);return p(x);default:return undefined;}}return l({"":g},f);},W;if(U&&a.call(U)==="[object JSON]"){try{W=U.stringify([function(){},{a:1,b:2}],["b"],"x").replace(/ +/gm,"");if(U.stringify(1)==="1"&&W==='[\nxnull,\nx{\nxx"b":2\nx}\n]'){V=U.stringify;}}catch(X){}}C.mix(C.namespace("JSON"),{_SPECIAL_CHARS:/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,_CHARS:{"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},dateToString:function(e){function Y(g){return g<10?"0"+g:g;}return L+e.getUTCFullYear()+"-"+Y(e.getUTCMonth()+1)+"-"+Y(e.getUTCDate())+"T"+Y(e.getUTCHours())+J+Y(e.getUTCMinutes())+J+Y(e.getUTCSeconds())+"Z"+L;},stringify:V});},"@VERSION@");YUI.add("json",function(A){},"@VERSION@",{use:["json-parse","json-stringify"]});