// (c) 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
// Underscore may be freely distributed under the MIT license.
(function(){varn=this,t=n._,r={},e=Array.prototype,u=Object.prototype,i=Function.prototype,a=e.push,o=e.slice,c=e.concat,l=u.toString,f=u.hasOwnProperty,s=e.forEach,p=e.map,h=e.reduce,v=e.reduceRight,g=e.filter,d=e.every,m=e.some,y=e.indexOf,b=e.lastIndexOf,x=Array.isArray,w=Object.keys,_=i.bind,j=function(n){returnninstanceofj?n:thisinstanceofj?(this._wrapped=n,void0):newj(n)};"undefined"!=typeofexports?("undefined"!=typeofmodule&&module.exports&&(exports=module.exports=j),exports._=j):n._=j,j.VERSION="1.5.2";varA=j.each=j.forEach=function(n,t,e){if(null!=n)if(s&&n.forEach===s)n.forEach(t,e);elseif(n.length===+n.length){for(varu=0,i=n.length;i>u;u++)if(t.call(e,n[u],u,n)===r)return}elsefor(vara=j.keys(n),u=0,i=a.length;i>u;u++)if(t.call(e,n[a[u]],a[u],n)===r)return};j.map=j.collect=function(n,t,r){vare=[];returnnull==n?e:p&&n.map===p?n.map(t,r):(A(n,function(n,u,i){e.push(t.call(r,n,u,i))}),e)};varE="Reduce of empty array with no initial value";j.reduce=j.foldl=j.inject=function(n,t,r,e){varu=arguments.length>2;if(null==n&&(n=[]),h&&n.reduce===h)returne&&(t=j.bind(t,e)),u?n.reduce(t,r):n.reduce(t);if(A(n,function(n,i,a){u?r=t.call(e,r,n,i,a):(r=n,u=!0)}),!u)thrownewTypeError(E);returnr},j.reduceRight=j.foldr=function(n,t,r,e){varu=arguments.length>2;if(null==n&&(n=[]),v&&n.reduceRight===v)returne&&(t=j.bind(t,e)),u?n.reduceRight(t,r):n.reduceRight(t);vari=n.length;if(i!==+i){vara=j.keys(n);i=a.length}if(A(n,function(o,c,l){c=a?a[--i]:--i,u?r=t.call(e,r,n[c],c,l):(r=n[c],u=!0)}),!u)thrownewTypeError(E);returnr},j.find=j.detect=function(n,t,r){vare;returnO(n,function(n,u,i){returnt.call(r,n,u,i)?(e=n,!0):void0}),e},j.filter=j.select=function(n,t,r){vare=[];returnnull==n?e:g&&n.filter===g?n.filter(t,r):(A(n,function(n,u,i){t.call(r,n,u,i)&&e.push(n)}),e)},j.reject=function(n,t,r){returnj.filter(n,function(n,e,u){return!t.call(r,n,e,u)},r)},j.every=j.all=function(n,t,e){t||(t=j.identity);varu=!0;returnnull==n?u:d&&n.every===d?n.every(t,e):(A(n,function(n,i,a){return(u=u&&t.call(e,n,i,a))?void0:r}),!!u)};varO=j.some=j.any=function(n,t,e){t||(t=j.identity);varu=!1;returnnull==n?u:m&&n.some===m?n.some(t,e):(A(n,function(n,i,a){returnu||(u=t.call(e,n,i,a))?r:void0}),!!u)};j.contains=j.include=function(n,t){returnnull==n?!1:y&&n.indexOf===y?n.indexOf(t)!=-1:O(n,function(n){returnn===t})},j.invoke=function(n,t){varr=o.call(arguments,2),e=j.isFunction(t);returnj.map(n,function(n){return(e?t:n[t]).apply(n,r)})},j.pluck=function(n,t){returnj.map(n,function(n){returnn[t]})},j.where=function(n,t,r){returnj.isEmpty(t)?r?void0:[]:j[r?"find":"filter"](n,function(n){for(varrint)if(t[r]!==n[r])return!1;return!0})},j.findWhere=function(n,t){returnj.where(n,t,!0)},j.max=function(n,t,r){if(!t&&j.isArray(n)&&n[0]===+n[0]&&n.length<65535)returnMath.max.apply(Math,n);if(!t&&j.isEmpty(n))return-1/0;vare={computed:-1/0,value:-1/0};returnA(n,function(n,u,i){vara=t?t.call(r,n,u,i):n;a>e.computed&&(e={value:n,computed:a})}),e.value},j.min=function(n,t,r){if(!t&&j.isArray(n)&&n[0]===+n[0]&&n.length<65535)returnMath.min.apply(Math,n);if(!t&&j.isEmpty(n))return1/0;vare={computed:1/0,value:1/0};returnA(n,function(n,u,i){vara=t?t.call(r,n,u,i):n;a<e.computed&&(e={value:n,computed:a})}),e.value},j.shuffle=function(n){vart,r=0,e=[];returnA(n,function(n){t=j.random(r++),e[r-1]=e[t],e[t]=n}),e},j.sample=function(n,t,r){returnarguments.length<2||r?n[j.random(n.length-1)]:j.shuffle(n).slice(0,Math.max(0,t))};vark=function(n){returnj.isFunction(n)?n:function(t){returnt[n]}};j.sortBy=function(n,t,r){vare=k(t);returnj.pluck(j.map(n,function(n,t,u){return{value:n,index:t,criteria:e.call(r,n,t,u)}}).sort(function(n,t){varr=n.criteria,e=t.criteria;if(r!==e){if(r>e||r===void0)return1;if(e>r||e===void0)return-1}returnn.index-t.index}),"value")};varF=function(n){returnfunction(t,r,e){varu={},i=null==r?j.identity:k(r);returnA(t,function(r,a){varo=i.call(e,r,a,t);n(u,o,r)}),u}};j.groupBy=F(function(n,t,r){(j.has(n,t)?n[t]:n[t]=[]).push(r)}),j.indexBy=F(function(n,t,r){n[t]=r}),j.countBy=F(function(n,t){j.has(n,t)?n[t]++:n[t]=1}),j.sortedIndex=function(n,t,r,e){r=null==r?j.identity:k(r);for(varu=r.call(e,t),i=0,a=n.length;a>i;){varo=i+a>>>1;r.call(e,n[o])<u?i=o+1:a=o}returni},j.toArray=function(n){returnn?j.isArray(n)?o.call(n):n.length===+n.length?j.map(n,j.identity):j.values(n):[]},j.size=function(n){returnnull==n?0:n.length===+n.length?n.length:j.keys(n).length},j.first=j.head=j.take=function(n,t,r){returnnull==n?void0:null==t||r?n[0]:o.call(n,0,t)},j.initial=function(n,t,r){returno.call(n,0,n.length-(null==t||r?1:t))},j.last=function(n,t,r){returnnull==n?void0:null==t||r?n[n.length-1]:o.call(n,Math.max(n.length-t,0))},j.rest=j.tail=j.drop=function(n,t,r){returno.call(n,null==t||r?1:t)},j.compact=function(n){returnj.filter(n,j.identity)};varM=function(n,t,r){returnt&&j.every(n,j.isArray)?c.apply(r,n):(A(n,function(n){j.isArray(n)||j.isArguments(n)?t?a.apply(r,n):M(n,t,r):r.push(n)}),r)};j.flatten=function(n,t){returnM(n,t,[])},j.without=function(n){returnj.difference(n,o.call(arguments,1))},j.uniq=j.unique=function(n,t,r,e){j.isFunction(t)&&(e=r,r=t,t=!1);varu=r?j.map(n,r,e):n,i=[],a=[];returnA(u,function(r,e){(t?e&&a[a.length-1]===r:j.contains(a,r))||(a.push(r),i.push(n[e]))}),i},j.union=function(){returnj.uniq(j.flatten(arguments,!0))},j.intersection=function(n){vart=o.call(arguments,1);returnj.filter(j.uniq(n),function(n){returnj.every(t,function(t){returnj.indexOf(t,n)>=0})})},j.difference=function(n){vart=c.apply(e,o.call(arguments,1));returnj.filter(n,function(n){return!j.contains(t,n)})},j.zip=function(){for(varn=j.max(j.pluck(arguments,"length").concat(0)),t=newArray(n),r=0;n>r;r++)t[r]=j.pluck(arguments,""+r);returnt},j.object=function(n,t){if(null==n)return{};for(varr={},e=0,u=n.length;u>e;e++)t?r[n[e]]=t[e]:r[n[e][0]]=n[e][1];returnr},j.indexOf=function(n,t,r){if(null==n)return-1;vare=0,u=n.length;if(r){if("number"!=typeofr)returne=j.sortedIndex(n,t),n[e]===t?e:-1;e=0>r?Math.max(0,u+r):r}if(y&&n.indexOf===y)returnn.indexOf(t,r);for(;u>e;e++)if(n[e]===t)returne;return-1},j.lastIndexOf=function(n,t,r){if(null==n)return-1;vare=null!=r;if(b&&n.lastIndexOf===b)returne?n.lastIndexOf(t,r):n.lastIndexOf(t);for(varu=e?r:n.length;u--;)if(n[u]===t)returnu;return-1},j.range=function(n,t,r){arguments.length<=1&&(t=n||0,n=0),r=arguments[2]||1;for(vare=Math.max(Math.ceil((t-n)/r),0),u=0,i=newArray(e);e>u;)i[u++]=n,n+=r;returni};varR=function(){};j.bind=function(n,t){varr,e;if(_&&n.bind===_)return_.apply(n,o.call(arguments,1));if(!j.isFunction(n))thrownewTypeError;returnr=o.call(arguments,2),e=function(){if(!(thisinstanceofe))returnn.apply(t,r.concat(o.call(arguments)));R.prototype=n.prototype;varu=newR;R.prototype=null;vari=n.apply(u,r.concat(o.call(arguments)));returnObject(i)===i?i:u}},j.partial=function(n){vart=o.call(arguments,1);returnfunction(){returnn.apply(this,t.concat(o.call(arguments)))}},j.bindAll=function(n){vart=o.call(arguments,1);if(0===t.length)thrownewError("bindAll must be passed function names");returnA(t,function(t){n[t]=j.bind(n[t],n)}),n},j.memoize=function(n,t){varr={};returnt||(t=j.identity),function(){vare=t.apply(this,arguments);returnj.has(r,e)?r[e]:r[e]=n.apply(this,arguments)}},j.delay=function(n,t){varr=o.call(arguments,2);returnsetTimeout(function(){returnn.apply(null,r)},t)},j.defer=function(n){returnj.delay.apply(j,[n,1].concat(o.call(arguments,1)))},j.throttle=function(n,t,r){vare,u,i,a=null,o=0;r||(r={});varc=function(){o=r.leading===!1?0:newDate,a=null,i=n.apply(e,u)};returnfunction(){varl=newDate;o||r.leading!==!1||(o=l);varf=t-(l-o);returne=this,u=arguments,0>=f?(clearTimeout(a),a=null,o=l,i=n.apply(e,u)):a||r.trailing===!1||(a=setTimeout(c,f)),i}},j.debounce=function(n,t,r){vare,u,i,a,o;returnfunction(){i=this,u=arguments,a=newDate;varc=function(){varl=newDate-a;t>l?e=setTimeout(c,t-l):(e=null,r||(o=n.apply(i,u)))},l=r&&!e;returne||(e=setTimeout(c,t)),l&&(o=n.apply(i,u)),o}},j.once=function(n){vart,r=!1;returnfunction(){returnr?t:(r=!0,t=n.apply(this,arguments),n=null,t)}},j.wrap=function(n,t){returnfunction(){varr=[n];returna.apply(r,arguments),t.apply(this,r)}},j.compose=function(){varn=arguments;returnfunction(){for(vart=arguments,r=n.length-1;r>=0;r--)t=[n[r].apply(this,t)];returnt[0]}},j.after=function(n,t){returnfunction(){return--n<1?t.apply(this,arguments):void0}},j.keys=w||function(n){if(n!==Object(n))thrownewTypeError("Invalid object");vart=[];for(varrinn)j.has(n,r)&&t.push(r);returnt},j.values=function(n){for(vart=j.keys(n),r=t.length,e=newArray(r),u=0;r>u;u++)e[u]=n[t[u]];returne},j.pairs=function(n){for(vart=j.keys(n),r=t.length,e=newArray(r),u=0;r>u;u++)e[u]=[t[u],n[t[u]]];returne},j.invert=function(n){for(vart={},r=j.keys(n),e=0,u=r.length;u>e;e++)t[n[r[e]]]=r[e];returnt},j.functions=j.methods=function(n){vart=[];for(varrinn)j.isFunction(n[r])&&t.push(r);returnt.sort()},j.extend=function(n){returnA(o.call(arguments,1),function(t){if(t)for(varrint)n[r]=t[r]}),n},j.pick=function(n){vart={},r=c.apply(e,o.call(arguments,1));returnA(r,function(r){rinn&&(t[r]=n[r])}),t},j.omit=function(n){vart={},r=c.apply(e,o.call(arguments,1));for(varuinn)j.contains(r,u)||(t[u]=n[u]);returnt},j.defaults=function(n){returnA(o.call(arguments,1),function(t){if(t)for(varrint)n[r]===void0&&(n[r]=t[r])}),n},j.clone=function(n){returnj.isObject(n)?j.isArray(n)?n.slice():j.extend({},n):n},j.tap=function(n,t){returnt(n),n};varS=function(n,t,r,e){if(n===t)return0!==n||1/n==1/t;if(null==n||null==t)returnn===t;ninstanceofj&&(n=n._wrapped),tinstanceofj&&(t=t._wrapped);varu=l.call(n);if(u!=l.call(t))return!1;switch(u){case"[object String]":returnn==String(t);case"[object Number]":returnn!=+n?t!=+t:0==n?1/n==1/t:n==+t;case"[object Date]":case"[object Boolean]":return+n==+t;case"[object RegExp]":returnn.source==t.source&&n.global==t.global&&n.multiline==t.multiline&&n.ignoreCase==t.ignoreCase}if("object"!=typeofn||"object"!=typeoft)return!1;for(vari=r.length;i--;)if(r[i]==n)returne[i]==t;vara=n.constructor,o=t.constructor;if(a!==o&&!(j.isFunction(a)&&ainstanceofa&&j.isFunction(o)&&oinstanceofo))return!1;r.push(n),e.push(t);varc=0,f=!0;if("[object Array]"==u){if(c=n.length,f=c==t.length)for(;c--&&(f=S(n[c],t[c],r,e)););}else{for(varsinn)if(j.has(n,s)&&(c++,!(f=j.has(t,s)&&S(n[s],t[s],r,e))))break;if(f){for(sint)if(j.has(t,s)&&!c--)break;f=!c}}returnr.pop(),e.pop(),f};j.isEqual=function(n,t){returnS(n,t,[],[])},j.isEmpty=function(n){if(null==n)return!0;if(j.isArray(n)||j.isString(n))return0===n.length;for(vartinn)if(j.has(n,t))return!1;return!0},j.isElement=function(n){return!(!n||1!==n.nodeType)},j.isArray=x||function(n){return"[object Array]"==l.call(n)},j.isObject=function(n){returnn===Object(n)},A(["Arguments","Function","String","Number","Date","RegExp"],function(n){j["is"+n]=function(t){returnl.call(t)=="[object "+n+"]"}}),j.isArguments(arguments)||(j.isArguments=function(n){return!(!n||!j.has(n,"callee"))}),"function"!=typeof/./&&(j.isFunction=function(n){return"function"==typeofn}),j.isFinite=function(n){returnisFinite(n)&&!isNaN(parseFloat(n))},j.isNaN=function(n){returnj.isNumber(n)&&n!=+n},j.isBoolean=function(n){returnn===!0||n===!1||"[object Boolean]"==l.call(n)},j.isNull=function(n){returnnull===n},j.isUndefined=function(n){returnn===void0},j.has=function(n,t){returnf.call(n,t)},j.noConflict=function(){returnn._=t,this},j.identity=function(n){returnn},j.times=function(n,t,r){for(vare=Array(Math.max(0,n)),u=0;n>u;u++)e[u]=t.call(r,u);returne},j.random=function(n,t){returnnull==t&&(t=n,n=0),n+Math.floor(Math.random()*(t-n+1))};varI={escape:{"&":"&","<":"<",">":">",'"':""","'":"'"}};I.unescape=j.invert(I.escape);varT={escape:newRegExp("["+j.keys(I.escape).join("")+"]","g"),unescape:newRegExp("("+j.keys(I.unescape).join("|")+")","g")};j.each(["escape","unescape"],function(n){j[n]=function(t){returnnull==t?"":(""+t).replace(T[n],function(t){returnI[n][t]})}}),j.result=function(n,t){if(null==n)returnvoid0;varr=n[t];returnj.isFunction(r)?r.call(n):r},j.mixin=function(n){A(j.functions(n),function(t){varr=j[t]=n[t];j.prototype[t]=function(){varn=[this._wrapped];returna.apply(n,arguments),z.call(this,r.apply(j,n))}})};varN=0;j.uniqueId=function(n){vart=++N+"";returnn?n+t:t},j.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};varq=/(.)^/,B={"'":"'","\\":"\\","\r":"r","\n":"n","":"t","\u2028":"u2028","\u2029":"u2029"},D=/\\|'|\r|\n|\t|\u2028|\u2029/g;j.template=function(n,t,r){vare;r=j.defaults({},r,j.templateSettings);varu=newRegExp([(r.escape||q).source,(r.interpolate||q).source,(r.evaluate||q).source].join("|")+"|$","g"),i=0,a="__p+='";n.replace(u,function(t,r,e,u,o){returna+=n.slice(i,o).replace(D,function(n){return"\\"+B[n]}),r&&(a+="'+\n((__t=("+r+"))==null?'':_.escape(__t))+\n'"),e&&(a+="'+\n((__t=("+e+"))==null?'':__t)+\n'"),u&&(a+="';\n"+u+"\n__p+='"),i=o+t.length,t}),a+="';\n",r.variable||(a="with(obj||{}){\n"+a+"}\n"),a="var __t,__p='',__j=Array.prototype.join,"+"print=function(){__p+=__j.call(arguments,'');};\n"+a+"return __p;\n";try{e=newFunction(r.variable||"obj","_",a)}catch(o){throwo.source=a,o}if(t)returne(t,j);varc=function(n){returne.call(this,n,j)};returnc.source="function("+(r.variable||"obj")+"){\n"+a+"}",c},j.chain=function(n){returnj(n).chain()};varz=function(n){returnthis._chain?j(n).chain():n};j.mixin(j),A(["pop","push","reverse","shift","sort","splice","unshift"],function(n){vart=e[n];j.prototype[n]=function(){varr=this._wrapped;returnt.apply(r,arguments),"shift"!=n&&"splice"!=n||0!==r.length||deleter[0],z.call(this,r)}}),A(["concat","join","slice"],function(n){vart=e[n];j.prototype[n]=function(){returnz.call(this,t.apply(this._wrapped,arguments))}}),j.extend(j.prototype,{chain:function(){returnthis._chain=!0,this},value:function(){returnthis._wrapped}})}).call(this);