// Underscore.js 1.3.1// (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc.// Underscore is freely distributable under the MIT license.// Portions of Underscore are inspired or borrowed from Prototype,// Oliver Steele's Functional, and John Resig's Micro-Templating.// For all details and documentation:// http://documentcloud.github.com/underscore(function(){functionq(a,c,d){if(a===c)returna!==0||1/a==1/c;if(a==null||c==null)returna===c;if(a._chain)a=a._wrapped;if(c._chain)c=c._wrapped;if(a.isEqual&&b.isFunction(a.isEqual))returna.isEqual(c);if(c.isEqual&&b.isFunction(c.isEqual))returnc.isEqual(a);vare=l.call(a);if(e!=l.call(c))returnfalse;switch(e){case"[object String]":returna==String(c);case"[object Number]":returna!=+a?c!=+c:a==0?1/a==1/c:a==+c;case"[object Date]":case"[object Boolean]":return+a==+c;case"[object RegExp]":returna.source==c.source&&a.global==c.global&&a.multiline==c.multiline&&a.ignoreCase==c.ignoreCase}if(typeofa!="object"||typeofc!="object")returnfalse;for(varf=d.length;f--;)if(d[f]==a)returntrue;d.push(a);varf=0,g=true;if(e=="[object Array]"){if(f=a.length,g=f==c.length)for(;f--;)if(!(g=fina==finc&&q(a[f],c[f],d)))break}else{if("constructor"ina!="constructor"inc||a.constructor!=c.constructor)returnfalse;for(varhina)if(b.has(a,h)&&(f++,!(g=b.has(c,h)&&q(a[h],c[h],d))))break;if(g){for(hinc)if(b.has(c,h)&&!f--)break;g=!f}}d.pop();returng}varr=this,G=r._,n={},k=Array.prototype,o=Object.prototype,i=k.slice,H=k.unshift,l=o.toString,I=o.hasOwnProperty,w=k.forEach,x=k.map,y=k.reduce,z=k.reduceRight,A=k.filter,B=k.every,C=k.some,p=k.indexOf,D=k.lastIndexOf,o=Array.isArray,J=Object.keys,s=Function.prototype.bind,b=function(a){returnnewm(a)};if(typeofexports!=="undefined"){if(typeofmodule!=="undefined"&&module.exports)exports=module.exports=b;exports._=b}elser._=b;b.VERSION="1.3.1";varj=b.each=b.forEach=function(a,c,d){if(a!=null)if(w&&a.forEach===w)a.forEach(c,d);elseif(a.length===+a.length)for(vare=0,f=a.length;e<f;e++){if(eina&&c.call(d,a[e],e,a)===n)break}elsefor(eina)if(b.has(a,e)&&c.call(d,a[e],e,a)===n)break};b.map=b.collect=function(a,c,b){vare=[];if(a==null)returne;if(x&&a.map===x)returna.map(c,b);j(a,function(a,g,h){e[e.length]=c.call(b,a,g,h)});if(a.length===+a.length)e.length=a.length;returne};b.reduce=b.foldl=b.inject=function(a,c,d,e){varf=arguments.length>2;a==null&&(a=[]);if(y&&a.reduce===y)returne&&(c=b.bind(c,e)),f?a.reduce(c,d):a.reduce(c);j(a,function(a,b,i){f?d=c.call(e,d,a,b,i):(d=a,f=true)});if(!f)thrownewTypeError("Reduce of empty array with no initial value");returnd};b.reduceRight=b.foldr=function(a,c,d,e){varf=arguments.length>2;a==null&&(a=[]);if(z&&a.reduceRight===z)returne&&(c=b.bind(c,e)),f?a.reduceRight(c,d):a.reduceRight(c);varg=b.toArray(a).reverse();e&&!f&&(c=b.bind(c,e));returnf?b.reduce(g,c,d,e):b.reduce(g,c)};b.find=b.detect=function(a,c,b){vare;E(a,function(a,g,h){if(c.call(b,a,g,h))returne=a,true});returne};b.filter=b.select=function(a,c,b){vare=[];if(a==null)returne;if(A&&a.filter===A)returna.filter(c,b);j(a,function(a,g,h){c.call(b,a,g,h)&&(e[e.length]=a)});returne};b.reject=function(a,c,b){vare=[];if(a==null)returne;j(a,function(a,g,h){c.call(b,a,g,h)||(e[e.length]=a)});returne};b.every=b.all=function(a,c,b){vare=true;if(a==null)returne;if(B&&a.every===B)returna.every(c,b);j(a,function(a,g,h){if(!(e=e&&c.call(b,a,g,h)))returnn});returne};varE=b.some=b.any=function(a,c,d){c||(c=b.identity);vare=false;if(a==null)returne;if(C&&a.some===C)returna.some(c,d);j(a,function(a,b,h){if(e||(e=c.call(d,a,b,h)))returnn});return!!e};b.include=b.contains=function(a,c){varb=false;if(a==null)returnb;returnp&&a.indexOf===p?a.indexOf(c)!=-1:b=E(a,function(a){returna===c})};b.invoke=function(a,c){vard=i.call(arguments,2);returnb.map(a,function(a){return(b.isFunction(c)?c||a:a[c]).apply(a,d)})};b.pluck=function(a,c){returnb.map(a,function(a){returna[c]})};b.max=function(a,c,d){if(!c&&b.isArray(a))returnMath.max.apply(Math,a);if(!c&&b.isEmpty(a))return-Infinity;vare={computed:-Infinity};j(a,function(a,b,h){b=c?c.call(d,a,b,h):a;b>=e.computed&&(e={value:a,computed:b})});returne.value};b.min=function(a,c,d){if(!c&&b.isArray(a))returnMath.min.apply(Math,a);if(!c&&b.isEmpty(a))returnInfinity;vare={computed:Infinity};j(a,function(a,b,h){b=c?c.call(d,a,b,h):a;b<e.computed&&(e={value:a,computed:b})});returne.value};b.shuffle=function(a){varb=[],d;j(a,function(a,f){f==0?b[0]=a:(d=Math.floor(Math.random()*(f+1)),b[f]=b[d],b[d]=a)});returnb};b.sortBy=function(a,c,d){returnb.pluck(b.map(a,function(a,b,g){return{value:a,criteria:c.call(d,a,b,g)}}).sort(function(a,b){varc=a.criteria,d=b.criteria;returnc<d?-1:c>d?1:0}),"value")};b.groupBy=function(a,c){vard={},e=b.isFunction(c)?c:function(a){returna[c]};j(a,function(a,b){varc=e(a,b);(d[c]||(d[c]=[])).push(a)});returnd};b.sortedIndex=function(a,c,d){d||(d=b.identity);for(vare=0,f=a.length;e<f;){varg=e+f>>1;d(a[g])<d(c)?e=g+1:f=g}returne};b.toArray=function(a){return!a?[]:a.toArray?a.toArray():b.isArray(a)?i.call(a):b.isArguments(a)?i.call(a):b.values(a)};b.size=function(a){returnb.toArray(a).length};b.first=b.head=function(a,b,d){returnb!=null&&!d?i.call(a,0,b):a[0]};b.initial=function(a,b,d){returni.call(a,0,a.length-(b==null||d?1:b))};b.last=function(a,b,d){returnb!=null&&!d?i.call(a,Math.max(a.length-b,0)):a[a.length-1]};b.rest=b.tail=function(a,b,d){returni.call(a,b==null||d?1:b)};b.compact=function(a){returnb.filter(a,function(a){return!!a})};b.flatten=function(a,c){returnb.reduce(a,function(a,e){if(b.isArray(e))returna.concat(c?e:b.flatten(e));a[a.length]=e;returna},[])};b.without=function(a){returnb.difference(a,i.call(arguments,1))};b.uniq=b.unique=function(a,c,d){vard=d?b.map(a,d):a,e=[];b.reduce(d,function(d,g,h){if(0==h||(c===true?b.last(d)!=g:!b.include(d,g)))d[d.length]=g,e[e.length]=a[h];returnd},[]);returne};b.union=function(){returnb.uniq(b.flatten(arguments,true))};b.intersection=b.intersect=function(a){varc=i.call(arguments,1);returnb.filter(b.uniq(a),function(a){returnb.every(c,function(c){returnb.indexOf(c,a)>=0})})};b.difference=function(a){varc=b.flatten(i.call(arguments,1));returnb.filter(a,function(a){return!b.include(c,a)})};b.zip=function(){for(vara=i.call(arguments),c=b.max(b.pluck(a,"length")),d=Array(c),e=0;e<c;e++)d[e]=b.pluck(a,""+e);returnd};b.indexOf=function(a,c,d){if(a==null)return-1;vare;if(d)returnd=b.sortedIndex(a,c),a[d]===c?d:-1;if(p&&a.indexOf===p)returna.indexOf(c);for(d=0,e=a.length;d<e;d++)if(dina&&a[d]===c)returnd;return-1};b.lastIndexOf=function(a,b){if(a==null)return-1;if(D&&a.lastIndexOf===D)returna.lastIndexOf(b);for(vard=a.length;d--;)if(dina&&a[d]===b)returnd;return-1};b.range=function(a,b,d){arguments.length<=1&&(b=a||0,a=0);for(vard=arguments[2]||1,e=Math.max(Math.ceil((b-a)/d),0),f=0,g=Array(e);f<e;)g[f++]=a,a+=d;returng};varF=function(){};b.bind=function(a,c){vard,e;if(a.bind===s&&s)returns.apply(a,i.call(arguments,1));if(!b.isFunction(a))thrownewTypeError;e=i.call(arguments,2);returnd=function(){if(!(thisinstanceofd))returna.apply(c,e.concat(i.call(arguments)));F.prototype=a.prototype;varb=newF,g=a.apply(b,e.concat(i.call(arguments)));returnObject(g)===g?g:b}};b.bindAll=function(a){varc=i.call(arguments,1);c.length==0&&(c=b.functions(a));j(c,function(c){a[c]=b.bind(a[c],a)});returna};b.memoize=function(a,c){vard={};c||(c=b.identity);returnfunction(){vare=c.apply(this,arguments);returnb.has(d,e)?d[e]:d[e]=a.apply(this,arguments)}};b.delay=function(a,b){vard=i.call(arguments,2);returnsetTimeout(function(){returna.apply(a,d)},b)};b.defer=function(a){returnb.delay.apply(b,[a,1].concat(i.call(arguments,1)))};b.throttle=function(a,c){vard,e,f,g,h,i=b.debounce(function(){h=g=false},c);returnfunction(){d=this;e=arguments;varb;f||(f=setTimeout(function(){f=null;h&&a.apply(d,e);i()},c));g?h=true:a.apply(d,e);i();g=true}};b.debounce=function(a,b){vard;returnfunction(){vare=this,f=arguments;clearTimeout(d);d=setTimeout(function(){d=null;a.apply(e,f)},b)}};b.once=function(a){varb=false,d;returnfunction(){if(b)returnd;b=true;returnd=a.apply(this,arguments)}};b.wrap=function(a,b){returnfunction(){vard=[a].concat(i.call(arguments,0));returnb.apply(this,d)}};b.compose=function(){vara=arguments;returnfunction(){for(varb=arguments,d=a.length-1;d>=0;d--)b=[a[d].apply(this,b)];returnb[0]}};b.after=function(a,b){returna<=0?b():function(){if(--a<1)returnb.apply(this,arguments)}};b.keys=J||function(a){if(a!==Object(a))thrownewTypeError("Invalid object");varc=[],d;for(dina)b.has(a,d)&&(c[c.length]=d);returnc};b.values=function(a){returnb.map(a,b.identity)};b.functions=b.methods=function(a){varc=[],d;for(dina)b.isFunction(a[d])&&c.push(d);returnc.sort()};b.extend=function(a){j(i.call(arguments,1),function(b){for(vardinb)a[d]=b[d]});returna};b.defaults=function(a){j(i.call(arguments,1),function(b){for(vardinb)a[d]==null&&(a[d]=b[d])});returna};b.clone=function(a){return!b.isObject(a)?a:b.isArray(a)?a.slice():b.extend({},a)};b.tap=function(a,b){b(a);returna};b.isEqual=function(a,b){returnq(a,b,[])};b.isEmpty=function(a){if(b.isArray(a)||b.isString(a))returna.length===0;for(varcina)if(b.has(a,c))returnfalse;returntrue};b.isElement=function(a){return!!(a&&a.nodeType==1)};b.isArray=o||function(a){returnl.call(a)=="[object Array]"};b.isObject=function(a){returna===Object(a)};b.isArguments=function(a){returnl.call(a)=="[object Arguments]"};if(!b.isArguments(arguments))b.isArguments=function(a){return!(!a||!b.has(a,"callee"))};b.isFunction=function(a){returnl.call(a)=="[object Function]"};b.isString=function(a){returnl.call(a)=="[object String]"};b.isNumber=function(a){returnl.call(a)=="[object Number]"};b.isNaN=function(a){returna!==a};b.isBoolean=function(a){returna===true||a===false||l.call(a)=="[object Boolean]"};b.isDate=function(a){returnl.call(a)=="[object Date]"};b.isRegExp=function(a){returnl.call(a)=="[object RegExp]"};b.isNull=function(a){returna===null};b.isUndefined=function(a){returna===void0};b.has=function(a,b){returnI.call(a,b)};b.noConflict=function(){r._=G;returnthis};b.identity=function(a){returna};b.times=function(a,b,d){for(vare=0;e<a;e++)b.call(d,e)};b.escape=function(a){return(""+a).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/")};b.mixin=function(a){j(b.functions(a),function(c){K(c,b[c]=a[c])})};varL=0;b.uniqueId=function(a){varb=L++;returna?a+b:b};b.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};vart=/.^/,u=function(a){returna.replace(/\\\\/g,"\\").replace(/\\'/g,"'")};b.template=function(a,c){vard=b.templateSettings,d="var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('"+a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(d.escape||t,function(a,b){return"',_.escape("+u(b)+"),'"}).replace(d.interpolate||t,function(a,b){return"',"+u(b)+",'"}).replace(d.evaluate||t,function(a,b){return"');"+u(b).replace(/[\r\n\t]/g," ")+";__p.push('"}).replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/\t/g,"\\t")+"');}return __p.join('');",e=newFunction("obj","_",d);returnc?e(c,b):function(a){returne.call(this,a,b)}};b.chain=function(a){returnb(a).chain()};varm=function(a){this._wrapped=a};b.prototype=m.prototype;varv=function(a,c){returnc?b(a).chain():a},K=function(a,c){m.prototype[a]=function(){vara=i.call(arguments);H.call(a,this._wrapped);returnv(c.apply(b,a),this._chain)}};b.mixin(b);j("pop,push,reverse,shift,sort,splice,unshift".split(","),function(a){varb=k[a];m.prototype[a]=function(){vard=this._wrapped;b.apply(d,arguments);vare=d.length;(a=="shift"||a=="splice")&&e===0&&deleted[0];returnv(d,this._chain)}});j(["concat","join","slice"],function(a){varb=k[a];m.prototype[a]=function(){returnv(b.apply(this._wrapped,arguments),this._chain)}});m.prototype.chain=function(){this._chain=true;returnthis};m.prototype.value=function(){returnthis._wrapped}}).call(this);