lodash-rails 1.2.1 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,47 +1,51 @@
1
1
  /**
2
2
  * @license
3
- * Lo-Dash 1.2.1 (Custom Build) lodash.com/license
3
+ * Lo-Dash 1.3.1 (Custom Build) lodash.com/license
4
4
  * Build: `lodash -o ./dist/lodash.compat.js`
5
5
  * Underscore.js 1.4.4 underscorejs.org/LICENSE
6
6
  */
7
- ;(function(n){function t(r){function a(n){return n&&typeof n=="object"&&!me(n)&&Qt.call(n,"__wrapped__")?n:new V(n)}function R(n){var t=n.length,e=t>=l;if(e)for(var r={},u=-1;++u<t;){var a=f+n[u];(r[a]||(r[a]=[])).push(n[u])}return function(t){if(e){var u=f+t;return r[u]&&-1<_t(r[u],t)}return-1<_t(n,t)}}function T(n){return n.charCodeAt(0)}function D(n,t){var e=n.b,r=t.b;if(n=n.a,t=t.a,n!==t){if(n>t||typeof n=="undefined")return 1;if(n<t||typeof t=="undefined")return-1}return e<r?-1:1}function z(n,t,e,r){function u(){var r=arguments,l=o?this:t;
8
- return a||(n=t[i]),e.length&&(r=r.length?(r=le.call(r),f?r.concat(e):e.concat(r)):e),this instanceof u?(G.prototype=n.prototype,l=new G,G.prototype=null,r=n.apply(l,r),et(r)?r:l):n.apply(l,r)}var a=tt(n),o=!e,i=t;if(o){var f=r;e=t}else if(!a){if(!r)throw new Dt;t=n}return u}function L(){for(var n,t={g:j,b:"k(m)",c:"",e:"m",f:"",h:"",i:!0,j:!!be},e=0;n=arguments[e];e++)for(var r in n)t[r]=n[r];if(n=t.a,t.d=/^[^,]+/.exec(n)[0],e=$t,r="var i,m="+t.d+",u="+t.e+";if(!m)return u;"+t.h+";",t.b?(r+="var n=m.length;i=-1;if("+t.b+"){",ve.unindexedChars&&(r+="if(l(m)){m=m.split('')}"),r+="while(++i<n){"+t.f+"}}else{"):ve.nonEnumArgs&&(r+="var n=m.length;i=-1;if(n&&j(m)){while(++i<n){i+='';"+t.f+"}}else{"),ve.enumPrototypes&&(r+="var v=typeof m=='function';"),t.i&&t.j)r+="var s=-1,t=r[typeof m]?o(m):[],n=t.length;while(++s<n){i=t[s];",ve.enumPrototypes&&(r+="if(!(v&&i=='prototype')){"),r+=t.f,ve.enumPrototypes&&(r+="}"),r+="}";
9
- else if(r+="for(i in m){",(ve.enumPrototypes||t.i)&&(r+="if(",ve.enumPrototypes&&(r+="!(v&&i=='prototype')"),ve.enumPrototypes&&t.i&&(r+="&&"),t.i&&(r+="h.call(m,i)"),r+="){"),r+=t.f+";",(ve.enumPrototypes||t.i)&&(r+="}"),r+="}",ve.nonEnumShadows){r+="var f=m.constructor;";for(var u=0;7>u;u++)r+="i='"+t.g[u]+"';if(","constructor"==t.g[u]&&(r+="!(f&&f.prototype===m)&&"),r+="h.call(m,i)){"+t.f+"}"}return(t.b||ve.nonEnumArgs)&&(r+="}"),r+=t.c+";return u",e("h,j,k,l,o,p,r","return function("+n+"){"+r+"}")(Qt,W,me,ut,be,a,q)
10
- }function K(n){return"\\"+B[n]}function M(n){return we[n]}function U(n){return typeof n.toString!="function"&&typeof(n+"")=="string"}function V(n){this.__wrapped__=n}function G(){}function H(n){var t=!1;if(!n||Zt.call(n)!=I||!ve.argsClass&&W(n))return t;var e=n.constructor;return(tt(e)?e instanceof e:ve.nodeClass||!U(n))?ve.ownLast?(xe(n,function(n,e,r){return t=Qt.call(r,e),!1}),!0===t):(xe(n,function(n,e){t=e}),!1===t||Qt.call(n,t)):t}function J(n,t,e){t||(t=0),typeof e=="undefined"&&(e=n?n.length:0);
11
- var r=-1;e=e-t||0;for(var u=It(0>e?0:e);++r<e;)u[r]=n[t+r];return u}function Q(n){return Ce[n]}function W(n){return Zt.call(n)==k}function X(n,t,r,u,o,i){var f=n;if(typeof t=="function"&&(u=r,r=t,t=!1),typeof r=="function"){if(r=typeof u=="undefined"?r:a.createCallback(r,u,1),f=r(f),typeof f!="undefined")return f;f=n}if(u=et(f)){var l=Zt.call(f);if(!$[l]||!ve.nodeClass&&U(f))return f;var c=me(f)}if(!u||!t)return u?c?J(f):je({},f):f;switch(u=se[l],l){case O:case E:return new u(+f);case A:case N:return new u(f);
12
- case P:return u(f.source,y.exec(f))}for(o||(o=[]),i||(i=[]),l=o.length;l--;)if(o[l]==n)return i[l];return f=c?u(f.length):{},c&&(Qt.call(n,"index")&&(f.index=n.index),Qt.call(n,"input")&&(f.input=n.input)),o.push(n),i.push(f),(c?pt:Oe)(n,function(n,u){f[u]=X(n,t,r,e,o,i)}),f}function Y(n){var t=[];return xe(n,function(n,e){tt(n)&&t.push(e)}),t.sort()}function Z(n){for(var t=-1,e=be(n),r=e.length,u={};++t<r;){var a=e[t];u[n[a]]=a}return u}function nt(n,t,e,r,u,o){var f=e===i;if(typeof e=="function"&&!f){e=a.createCallback(e,r,2);
13
- var l=e(n,t);if(typeof l!="undefined")return!!l}if(n===t)return 0!==n||1/n==1/t;var c=typeof n,p=typeof t;if(n===n&&(!n||"function"!=c&&"object"!=c)&&(!t||"function"!=p&&"object"!=p))return!1;if(null==n||null==t)return n===t;if(p=Zt.call(n),c=Zt.call(t),p==k&&(p=I),c==k&&(c=I),p!=c)return!1;switch(p){case O:case E:return+n==+t;case A:return n!=+n?t!=+t:0==n?1/n==1/t:n==+t;case P:case N:return n==Tt(t)}if(c=p==x,!c){if(Qt.call(n,"__wrapped__")||Qt.call(t,"__wrapped__"))return nt(n.__wrapped__||n,t.__wrapped__||t,e,r,u,o);
14
- if(p!=I||!ve.nodeClass&&(U(n)||U(t)))return!1;var p=!ve.argsObject&&W(n)?Ft:n.constructor,s=!ve.argsObject&&W(t)?Ft:t.constructor;if(p!=s&&(!tt(p)||!(p instanceof p&&tt(s)&&s instanceof s)))return!1}for(u||(u=[]),o||(o=[]),p=u.length;p--;)if(u[p]==n)return o[p]==t;var v=0,l=!0;if(u.push(n),o.push(t),c){if(p=n.length,v=t.length,l=v==n.length,!l&&!f)return l;for(;v--;)if(c=p,s=t[v],f)for(;c--&&!(l=nt(n[c],s,e,r,u,o)););else if(!(l=nt(n[v],s,e,r,u,o)))break;return l}return xe(t,function(t,a,i){return Qt.call(i,a)?(v++,l=Qt.call(n,a)&&nt(n[a],t,e,r,u,o)):void 0
15
- }),l&&!f&&xe(n,function(n,t,e){return Qt.call(e,t)?l=-1<--v:void 0}),l}function tt(n){return typeof n=="function"}function et(n){return n?q[typeof n]:!1}function rt(n){return typeof n=="number"||Zt.call(n)==A}function ut(n){return typeof n=="string"||Zt.call(n)==N}function at(n,t,e){var r=arguments,u=0,o=2;if(!et(n))return n;if(e===i)var f=r[3],l=r[4],c=r[5];else l=[],c=[],typeof e!="number"&&(o=r.length),3<o&&"function"==typeof r[o-2]?f=a.createCallback(r[--o-1],r[o--],2):2<o&&"function"==typeof r[o-1]&&(f=r[--o]);
16
- for(;++u<o;)(me(r[u])?pt:Oe)(r[u],function(t,e){var r,u,a=t,o=n[e];if(t&&((u=me(t))||Ee(t))){for(a=l.length;a--;)if(r=l[a]==t){o=c[a];break}if(!r){var p;f&&(a=f(o,t),p=typeof a!="undefined")&&(o=a),p||(o=u?me(o)?o:[]:Ee(o)?o:{}),l.push(t),c.push(o),p||(o=at(o,t,i,f,l,c))}}else f&&(a=f(o,t),typeof a=="undefined"&&(a=t)),typeof a!="undefined"&&(o=a);n[e]=o});return n}function ot(n){for(var t=-1,e=be(n),r=e.length,u=It(r);++t<r;)u[t]=n[e[t]];return u}function it(n,t,e){var r=-1,u=n?n.length:0,a=!1;return e=(0>e?ae(0,u+e):e)||0,typeof u=="number"?a=-1<(ut(n)?n.indexOf(t,e):_t(n,t,e)):_e(n,function(n){return++r<e?void 0:!(a=n===t)
17
- }),a}function ft(n,t,e){var r=!0;if(t=a.createCallback(t,e),me(n)){e=-1;for(var u=n.length;++e<u&&(r=!!t(n[e],e,n)););}else _e(n,function(n,e,u){return r=!!t(n,e,u)});return r}function lt(n,t,e){var r=[];if(t=a.createCallback(t,e),me(n)){e=-1;for(var u=n.length;++e<u;){var o=n[e];t(o,e,n)&&r.push(o)}}else _e(n,function(n,e,u){t(n,e,u)&&r.push(n)});return r}function ct(n,t,e){if(t=a.createCallback(t,e),!me(n)){var r;return _e(n,function(n,e,u){return t(n,e,u)?(r=n,!1):void 0}),r}e=-1;for(var u=n.length;++e<u;){var o=n[e];
18
- if(t(o,e,n))return o}}function pt(n,t,e){if(t&&typeof e=="undefined"&&me(n)){e=-1;for(var r=n.length;++e<r&&!1!==t(n[e],e,n););}else _e(n,t,e);return n}function st(n,t,e){var r=-1,u=n?n.length:0,o=It(typeof u=="number"?u:0);if(t=a.createCallback(t,e),me(n))for(;++r<u;)o[r]=t(n[r],r,n);else _e(n,function(n,e,u){o[++r]=t(n,e,u)});return o}function vt(n,t,e){var r=-1/0,u=r;if(!t&&me(n)){e=-1;for(var o=n.length;++e<o;){var i=n[e];i>u&&(u=i)}}else t=!t&&ut(n)?T:a.createCallback(t,e),_e(n,function(n,e,a){e=t(n,e,a),e>r&&(r=e,u=n)
19
- });return u}function gt(n,t,e,r){var u=3>arguments.length;if(t=a.createCallback(t,r,4),me(n)){var o=-1,i=n.length;for(u&&(e=n[++o]);++o<i;)e=t(e,n[o],o,n)}else _e(n,function(n,r,a){e=u?(u=!1,n):t(e,n,r,a)});return e}function yt(n,t,e,r){var u=n,o=n?n.length:0,i=3>arguments.length;if(typeof o!="number")var f=be(n),o=f.length;else ve.unindexedChars&&ut(n)&&(u=n.split(""));return t=a.createCallback(t,r,4),pt(n,function(n,r,a){r=f?f[--o]:--o,e=i?(i=!1,u[r]):t(e,u[r],r,a)}),e}function ht(n,t,e){var r;
20
- if(t=a.createCallback(t,e),me(n)){e=-1;for(var u=n.length;++e<u&&!(r=t(n[e],e,n)););}else _e(n,function(n,e,u){return!(r=t(n,e,u))});return!!r}function mt(n){for(var t=-1,e=n?n.length:0,r=Gt.apply(zt,le.call(arguments,1)),r=R(r),u=[];++t<e;){var a=n[t];r(a)||u.push(a)}return u}function dt(n,t,e){if(n){var r=0,u=n.length;if(typeof t!="number"&&null!=t){var o=-1;for(t=a.createCallback(t,e);++o<u&&t(n[o],o,n);)r++}else if(r=t,null==r||e)return n[0];return J(n,0,oe(ae(0,r),u))}}function bt(n,t,e,r){var u=-1,o=n?n.length:0,i=[];
21
- for(typeof t!="boolean"&&null!=t&&(r=e,e=t,t=!1),null!=e&&(e=a.createCallback(e,r));++u<o;)r=n[u],e&&(r=e(r,u,n)),me(r)?Wt.apply(i,t?r:bt(r)):i.push(r);return i}function _t(n,t,e){var r=-1,u=n?n.length:0;if(typeof e=="number")r=(0>e?ae(0,u+e):e||0)-1;else if(e)return r=Ct(n,t),n[r]===t?r:-1;for(;++r<u;)if(n[r]===t)return r;return-1}function wt(n,t,e){if(typeof t!="number"&&null!=t){var r=0,u=-1,o=n?n.length:0;for(t=a.createCallback(t,e);++u<o&&t(n[u],u,n);)r++}else r=null==t||e?1:ae(0,t);return J(n,r)
22
- }function Ct(n,t,e,r){var u=0,o=n?n.length:u;for(e=e?a.createCallback(e,r,1):Et,t=e(t);u<o;)r=u+o>>>1,e(n[r])<t?u=r+1:o=r;return u}function jt(n,t,e,r){var u=-1,o=n?n.length:0,i=[],c=i;typeof t!="boolean"&&null!=t&&(r=e,e=t,t=!1);var p=!t&&o>=l;if(p)var s={};for(null!=e&&(c=[],e=a.createCallback(e,r));++u<o;){r=n[u];var v=e?e(r,u,n):r;if(p)var g=f+v,g=s[g]?!(c=s[g]):c=s[g]=[];(t?!u||c[c.length-1]!==v:g||0>_t(c,v))&&((e||p)&&c.push(v),i.push(r))}return i}function kt(n,t){for(var e=-1,r=n?n.length:0,u={};++e<r;){var a=n[e];
23
- t?u[a]=t[e]:u[a[0]]=a[1]}return u}function xt(n,t){return ve.fastBind||ne&&2<arguments.length?ne.call.apply(ne,arguments):z(n,t,le.call(arguments,2))}function Ot(n){var t=le.call(arguments,1);return Yt(function(){n.apply(e,t)},1)}function Et(n){return n}function St(n){pt(Y(n),function(t){var e=a[t]=n[t];a.prototype[t]=function(){var n=this.__wrapped__,t=[n];return Wt.apply(t,arguments),t=e.apply(a,t),n&&typeof n=="object"&&n==t?this:new V(t)}})}function At(){return this.__wrapped__}r=r?F.defaults(n.Object(),r,F.pick(n,C)):n;
24
- var It=r.Array,Pt=r.Boolean,Nt=r.Date,$t=r.Function,qt=r.Math,Bt=r.Number,Ft=r.Object,Rt=r.RegExp,Tt=r.String,Dt=r.TypeError,zt=It(),Lt=Ft(),Kt=r._,Mt=Rt("^"+Tt(Lt.valueOf).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),Ut=qt.ceil,Vt=r.clearTimeout,Gt=zt.concat,Ht=qt.floor,Jt=Mt.test(Jt=Ft.getPrototypeOf)&&Jt,Qt=Lt.hasOwnProperty,Wt=zt.push,Xt=r.setImmediate,Yt=r.setTimeout,Zt=Lt.toString,ne=Mt.test(ne=Zt.bind)&&ne,te=Mt.test(te=It.isArray)&&te,ee=r.isFinite,re=r.isNaN,ue=Mt.test(ue=Ft.keys)&&ue,ae=qt.max,oe=qt.min,ie=r.parseInt,fe=qt.random,le=zt.slice,ce=Mt.test(r.attachEvent),pe=ne&&!/\n|true/.test(ne+ce),se={};
25
- se[x]=It,se[O]=Pt,se[E]=Nt,se[I]=Ft,se[A]=Bt,se[P]=Rt,se[N]=Tt;var ve=a.support={};(function(){var n=function(){this.x=1},t={0:1,length:1},e=[];n.prototype={valueOf:1,y:1};for(var r in new n)e.push(r);for(r in arguments);ve.argsObject=arguments.constructor==Ft&&!(arguments instanceof It),ve.argsClass=W(arguments),ve.enumPrototypes=n.propertyIsEnumerable("prototype"),ve.fastBind=ne&&!pe,ve.ownLast="x"!=e[0],ve.nonEnumArgs=0!=r,ve.nonEnumShadows=!/valueOf/.test(e),ve.spliceObjects=(zt.splice.call(t,0,1),!t[0]),ve.unindexedChars="xx"!="x"[0]+Ft("x")[0];
26
- try{ve.nodeClass=!(Zt.call(document)==I&&!({toString:0}+""))}catch(u){ve.nodeClass=!0}})(1),a.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:h,variable:"",imports:{_:a}};var ge={a:"q,w,g",h:"var a=arguments,b=0,c=typeof g=='number'?2:a.length;while(++b<c){m=a[b];if(m&&r[typeof m]){",f:"if(typeof u[i]=='undefined')u[i]=m[i]",c:"}}"},ye={a:"e,d,x",h:"d=d&&typeof x=='undefined'?d:p.createCallback(d,x)",b:"typeof n=='number'",f:"if(d(m[i],i,e)===false)return u"},he={h:"if(!r[typeof m])return u;"+ye.h,b:!1};
27
- V.prototype=a.prototype,ve.argsClass||(W=function(n){return n?Qt.call(n,"callee"):!1});var me=te||function(n){return n?typeof n=="object"&&Zt.call(n)==x:!1},de=L({a:"q",e:"[]",h:"if(!(r[typeof q]))return u",f:"u.push(i)",b:!1}),be=ue?function(n){return et(n)?ve.enumPrototypes&&typeof n=="function"||ve.nonEnumArgs&&n.length&&W(n)?de(n):ue(n):[]}:de,_e=L(ye),we={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Ce=Z(we),je=L(ge,{h:ge.h.replace(";",";if(c>3&&typeof a[c-2]=='function'){var d=p.createCallback(a[--c-1],a[c--],2);}else if(c>2&&typeof a[c-1]=='function'){d=a[--c];}"),f:"u[i]=d?d(u[i],m[i]):m[i]"}),ke=L(ge),xe=L(ye,he,{i:!1}),Oe=L(ye,he);
28
- tt(/x/)&&(tt=function(n){return typeof n=="function"&&Zt.call(n)==S});var Ee=Jt?function(n){if(!n||Zt.call(n)!=I||!ve.argsClass&&W(n))return!1;var t=n.valueOf,e=typeof t=="function"&&(e=Jt(t))&&Jt(e);return e?n==e||Jt(n)==e:H(n)}:H;pe&&u&&typeof Xt=="function"&&(Ot=xt(Xt,r));var Se=8==ie(m+"08")?ie:function(n,t){return ie(ut(n)?n.replace(d,""):n,t||0)};return a.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0}},a.assign=je,a.at=function(n){var t=-1,e=Gt.apply(zt,le.call(arguments,1)),r=e.length,u=It(r);
29
- for(ve.unindexedChars&&ut(n)&&(n=n.split(""));++t<r;)u[t]=n[e[t]];return u},a.bind=xt,a.bindAll=function(n){for(var t=1<arguments.length?Gt.apply(zt,le.call(arguments,1)):Y(n),e=-1,r=t.length;++e<r;){var u=t[e];n[u]=xt(n[u],n)}return n},a.bindKey=function(n,t){return z(n,t,le.call(arguments,2),i)},a.compact=function(n){for(var t=-1,e=n?n.length:0,r=[];++t<e;){var u=n[t];u&&r.push(u)}return r},a.compose=function(){var n=arguments;return function(){for(var t=arguments,e=n.length;e--;)t=[n[e].apply(this,t)];
30
- return t[0]}},a.countBy=function(n,t,e){var r={};return t=a.createCallback(t,e),pt(n,function(n,e,u){e=Tt(t(n,e,u)),Qt.call(r,e)?r[e]++:r[e]=1}),r},a.createCallback=function(n,t,e){if(null==n)return Et;var r=typeof n;if("function"!=r){if("object"!=r)return function(t){return t[n]};var u=be(n);return function(t){for(var e=u.length,r=!1;e--&&(r=nt(t[u[e]],n[u[e]],i)););return r}}return typeof t!="undefined"?1===e?function(e){return n.call(t,e)}:2===e?function(e,r){return n.call(t,e,r)}:4===e?function(e,r,u,a){return n.call(t,e,r,u,a)
31
- }:function(e,r,u){return n.call(t,e,r,u)}:n},a.debounce=function(n,t,e){function r(){a=f=null,l&&(o=n.apply(i,u))}var u,a,o,i,f,l=!0;if(!0===e)var c=!0,l=!1;else e&&q[typeof e]&&(c=e.leading,l="trailing"in e?e.trailing:l);return function(){return u=arguments,i=this,Vt(f),!a&&c?(a=!0,o=n.apply(i,u)):f=Yt(r,t),o}},a.defaults=ke,a.defer=Ot,a.delay=function(n,t){var r=le.call(arguments,2);return Yt(function(){n.apply(e,r)},t)},a.difference=mt,a.filter=lt,a.flatten=bt,a.forEach=pt,a.forIn=xe,a.forOwn=Oe,a.functions=Y,a.groupBy=function(n,t,e){var r={};
32
- return t=a.createCallback(t,e),pt(n,function(n,e,u){e=Tt(t(n,e,u)),(Qt.call(r,e)?r[e]:r[e]=[]).push(n)}),r},a.initial=function(n,t,e){if(!n)return[];var r=0,u=n.length;if(typeof t!="number"&&null!=t){var o=u;for(t=a.createCallback(t,e);o--&&t(n[o],o,n);)r++}else r=null==t||e?1:t||r;return J(n,0,oe(ae(0,u-r),u))},a.intersection=function(n){var t=arguments,e=t.length,r={0:{}},u=-1,a=n?n.length:0,o=a>=l,i=[],c=i;n:for(;++u<a;){var p=n[u];if(o)var s=f+p,s=r[0][s]?!(c=r[0][s]):c=r[0][s]=[];if(s||0>_t(c,p)){o&&c.push(p);
33
- for(var v=e;--v;)if(!(r[v]||(r[v]=R(t[v])))(p))continue n;i.push(p)}}return i},a.invert=Z,a.invoke=function(n,t){var e=le.call(arguments,2),r=-1,u=typeof t=="function",a=n?n.length:0,o=It(typeof a=="number"?a:0);return pt(n,function(n){o[++r]=(u?t:n[t]).apply(n,e)}),o},a.keys=be,a.map=st,a.max=vt,a.memoize=function(n,t){var e={};return function(){var r=f+(t?t.apply(this,arguments):arguments[0]);return Qt.call(e,r)?e[r]:e[r]=n.apply(this,arguments)}},a.merge=at,a.min=function(n,t,e){var r=1/0,u=r;
34
- if(!t&&me(n)){e=-1;for(var o=n.length;++e<o;){var i=n[e];i<u&&(u=i)}}else t=!t&&ut(n)?T:a.createCallback(t,e),_e(n,function(n,e,a){e=t(n,e,a),e<r&&(r=e,u=n)});return u},a.omit=function(n,t,e){var r=typeof t=="function",u={};if(r)t=a.createCallback(t,e);else var o=Gt.apply(zt,le.call(arguments,1));return xe(n,function(n,e,a){(r?!t(n,e,a):0>_t(o,e))&&(u[e]=n)}),u},a.once=function(n){var t,e;return function(){return t?e:(t=!0,e=n.apply(this,arguments),n=null,e)}},a.pairs=function(n){for(var t=-1,e=be(n),r=e.length,u=It(r);++t<r;){var a=e[t];
35
- u[t]=[a,n[a]]}return u},a.partial=function(n){return z(n,le.call(arguments,1))},a.partialRight=function(n){return z(n,le.call(arguments,1),null,i)},a.pick=function(n,t,e){var r={};if(typeof t!="function")for(var u=-1,o=Gt.apply(zt,le.call(arguments,1)),i=et(n)?o.length:0;++u<i;){var f=o[u];f in n&&(r[f]=n[f])}else t=a.createCallback(t,e),xe(n,function(n,e,u){t(n,e,u)&&(r[e]=n)});return r},a.pluck=st,a.range=function(n,t,e){n=+n||0,e=+e||1,null==t&&(t=n,n=0);var r=-1;t=ae(0,Ut((t-n)/e));for(var u=It(t);++r<t;)u[r]=n,n+=e;
36
- return u},a.reject=function(n,t,e){return t=a.createCallback(t,e),lt(n,function(n,e,r){return!t(n,e,r)})},a.rest=wt,a.shuffle=function(n){var t=-1,e=n?n.length:0,r=It(typeof e=="number"?e:0);return pt(n,function(n){var e=Ht(fe()*(++t+1));r[t]=r[e],r[e]=n}),r},a.sortBy=function(n,t,e){var r=-1,u=n?n.length:0,o=It(typeof u=="number"?u:0);for(t=a.createCallback(t,e),pt(n,function(n,e,u){o[++r]={a:t(n,e,u),b:r,c:n}}),u=o.length,o.sort(D);u--;)o[u]=o[u].c;return o},a.tap=function(n,t){return t(n),n},a.throttle=function(n,t,e){function r(){i=null,c&&(f=new Nt,a=n.apply(o,u))
37
- }var u,a,o,i,f=0,l=!0,c=!0;return!1===e?l=!1:e&&q[typeof e]&&(l="leading"in e?e.leading:l,c="trailing"in e?e.trailing:c),function(){var e=new Nt;!i&&!l&&(f=e);var c=t-(e-f);return u=arguments,o=this,0<c?i||(i=Yt(r,c)):(Vt(i),i=null,f=e,a=n.apply(o,u)),a}},a.times=function(n,t,e){n=-1<(n=+n)?n:0;var r=-1,u=It(n);for(t=a.createCallback(t,e,1);++r<n;)u[r]=t(r);return u},a.toArray=function(n){return n&&typeof n.length=="number"?ve.unindexedChars&&ut(n)?n.split(""):J(n):ot(n)},a.union=function(n){return me(n)||(arguments[0]=n?le.call(n):zt),jt(Gt.apply(zt,arguments))
38
- },a.uniq=jt,a.unzip=function(n){for(var t=-1,e=n?n.length:0,r=e?vt(st(n,"length")):0,u=It(r);++t<e;)for(var a=-1,o=n[t];++a<r;)(u[a]||(u[a]=It(e)))[t]=o[a];return u},a.values=ot,a.where=lt,a.without=function(n){return mt(n,le.call(arguments,1))},a.wrap=function(n,t){return function(){var e=[n];return Wt.apply(e,arguments),t.apply(this,e)}},a.zip=function(n){for(var t=-1,e=n?vt(st(arguments,"length")):0,r=It(e);++t<e;)r[t]=st(arguments,t);return r},a.zipObject=kt,a.collect=st,a.drop=wt,a.each=pt,a.extend=je,a.methods=Y,a.object=kt,a.select=lt,a.tail=wt,a.unique=jt,St(a),a.clone=X,a.cloneDeep=function(n,t,e){return X(n,!0,t,e)
39
- },a.contains=it,a.escape=function(n){return null==n?"":Tt(n).replace(_,M)},a.every=ft,a.find=ct,a.findIndex=function(n,t,e){var r=-1,u=n?n.length:0;for(t=a.createCallback(t,e);++r<u;)if(t(n[r],r,n))return r;return-1},a.findKey=function(n,t,e){var r;return t=a.createCallback(t,e),Oe(n,function(n,e,u){return t(n,e,u)?(r=e,!1):void 0}),r},a.has=function(n,t){return n?Qt.call(n,t):!1},a.identity=Et,a.indexOf=_t,a.isArguments=W,a.isArray=me,a.isBoolean=function(n){return!0===n||!1===n||Zt.call(n)==O},a.isDate=function(n){return n?typeof n=="object"&&Zt.call(n)==E:!1
40
- },a.isElement=function(n){return n?1===n.nodeType:!1},a.isEmpty=function(n){var t=!0;if(!n)return t;var e=Zt.call(n),r=n.length;return e==x||e==N||(ve.argsClass?e==k:W(n))||e==I&&typeof r=="number"&&tt(n.splice)?!r:(Oe(n,function(){return t=!1}),t)},a.isEqual=nt,a.isFinite=function(n){return ee(n)&&!re(parseFloat(n))},a.isFunction=tt,a.isNaN=function(n){return rt(n)&&n!=+n},a.isNull=function(n){return null===n},a.isNumber=rt,a.isObject=et,a.isPlainObject=Ee,a.isRegExp=function(n){return n?q[typeof n]&&Zt.call(n)==P:!1
41
- },a.isString=ut,a.isUndefined=function(n){return typeof n=="undefined"},a.lastIndexOf=function(n,t,e){var r=n?n.length:0;for(typeof e=="number"&&(r=(0>e?ae(0,r+e):oe(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},a.mixin=St,a.noConflict=function(){return r._=Kt,this},a.parseInt=Se,a.random=function(n,t){return null==n&&null==t&&(t=1),n=+n||0,null==t&&(t=n,n=0),n+Ht(fe()*((+t||0)-n+1))},a.reduce=gt,a.reduceRight=yt,a.result=function(n,t){var r=n?n[t]:e;return tt(r)?n[t]():r},a.runInContext=t,a.size=function(n){var t=n?n.length:0;
42
- return typeof t=="number"?t:be(n).length},a.some=ht,a.sortedIndex=Ct,a.template=function(n,t,r){var u=a.templateSettings;n||(n=""),r=ke({},r,u);var o,i=ke({},r.imports,u.imports),u=be(i),i=ot(i),f=0,l=r.interpolate||b,v="__p+='",l=Rt((r.escape||b).source+"|"+l.source+"|"+(l===h?g:b).source+"|"+(r.evaluate||b).source+"|$","g");n.replace(l,function(t,e,r,u,a,i){return r||(r=u),v+=n.slice(f,i).replace(w,K),e&&(v+="'+__e("+e+")+'"),a&&(o=!0,v+="';"+a+";__p+='"),r&&(v+="'+((__t=("+r+"))==null?'':__t)+'"),f=i+t.length,t
43
- }),v+="';\n",l=r=r.variable,l||(r="obj",v="with("+r+"){"+v+"}"),v=(o?v.replace(c,""):v).replace(p,"$1").replace(s,"$1;"),v="function("+r+"){"+(l?"":r+"||("+r+"={});")+"var __t,__p='',__e=_.escape"+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+v+"return __p}";try{var y=$t(u,"return "+v).apply(e,i)}catch(m){throw m.source=v,m}return t?y(t):(y.source=v,y)},a.unescape=function(n){return null==n?"":Tt(n).replace(v,Q)},a.uniqueId=function(n){var t=++o;return Tt(null==n?"":n)+t
44
- },a.all=ft,a.any=ht,a.detect=ct,a.foldl=gt,a.foldr=yt,a.include=it,a.inject=gt,Oe(a,function(n,t){a.prototype[t]||(a.prototype[t]=function(){var t=[this.__wrapped__];return Wt.apply(t,arguments),n.apply(a,t)})}),a.first=dt,a.last=function(n,t,e){if(n){var r=0,u=n.length;if(typeof t!="number"&&null!=t){var o=u;for(t=a.createCallback(t,e);o--&&t(n[o],o,n);)r++}else if(r=t,null==r||e)return n[u-1];return J(n,ae(0,u-r))}},a.take=dt,a.head=dt,Oe(a,function(n,t){a.prototype[t]||(a.prototype[t]=function(t,e){var r=n(this.__wrapped__,t,e);
45
- return null==t||e&&typeof t!="function"?r:new V(r)})}),a.VERSION="1.2.1",a.prototype.toString=function(){return Tt(this.__wrapped__)},a.prototype.value=At,a.prototype.valueOf=At,_e(["join","pop","shift"],function(n){var t=zt[n];a.prototype[n]=function(){return t.apply(this.__wrapped__,arguments)}}),_e(["push","reverse","sort","unshift"],function(n){var t=zt[n];a.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),_e(["concat","slice","splice"],function(n){var t=zt[n];a.prototype[n]=function(){return new V(t.apply(this.__wrapped__,arguments))
46
- }}),ve.spliceObjects||_e(["pop","shift","splice"],function(n){var t=zt[n],e="splice"==n;a.prototype[n]=function(){var n=this.__wrapped__,r=t.apply(n,arguments);return 0===n.length&&delete n[0],e?new V(r):r}}),a}var e,r=typeof exports=="object"&&exports,u=typeof module=="object"&&module&&module.exports==r&&module,a=typeof global=="object"&&global;(a.global===a||a.window===a)&&(n=a);var o=0,i={},f=+new Date+"",l=200,c=/\b__p\+='';/g,p=/\b(__p\+=)''\+/g,s=/(__e\(.*?\)|\b__t\))\+'';/g,v=/&(?:amp|lt|gt|quot|#39);/g,g=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,y=/\w*$/,h=/<%=([\s\S]+?)%>/g,m=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",d=RegExp("^["+m+"]*0+(?=.$)"),b=/($^)/,_=/[&<>"']/g,w=/['\n\r\t\u2028\u2029\\]/g,C="Array Boolean Date Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),j="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),k="[object Arguments]",x="[object Array]",O="[object Boolean]",E="[object Date]",S="[object Function]",A="[object Number]",I="[object Object]",P="[object RegExp]",N="[object String]",$={};
47
- $[S]=!1,$[k]=$[x]=$[O]=$[E]=$[A]=$[I]=$[P]=$[N]=!0;var q={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},B={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},F=t();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=F,define(function(){return F})):r&&!r.nodeType?u?(u.exports=F)._=F:r._=F:n._=F})(this);
7
+ ;!function(n){function t(n,t,r){r=(r||0)-1;for(var e=n.length;++r<e;)if(n[r]===t)return r;return-1}function r(n,r){var e=typeof r;if(n=n.k,"boolean"==e||r==d)return n[r];"number"!=e&&"string"!=e&&(e="object");var u="number"==e?r:x+r;return n=n[e]||(n[e]={}),"object"==e?n[u]&&-1<t(n[u],r)?0:-1:n[u]?0:-1}function e(n){var t=this.k,r=typeof n;if("boolean"==r||n==d)t[n]=y;else{"number"!=r&&"string"!=r&&(r="object");var e="number"==r?n:x+n,u=t[r]||(t[r]={});"object"==r?(u[e]||(u[e]=[])).push(n)==this.b.length&&(t[r]=b):u[e]=y
8
+ }}function u(n){return n.charCodeAt(0)}function a(n,t){var r=n.m,e=t.m;if(n=n.l,t=t.l,n!==t){if(n>t||typeof n=="undefined")return 1;if(n<t||typeof t=="undefined")return-1}return r<e?-1:1}function o(n){var t=-1,r=n.length,u=c();u["false"]=u["null"]=u["true"]=u.undefined=b;var a=c();for(a.b=n,a.k=u,a.push=e;++t<r;)a.push(n[t]);return u.object===false?(g(a),d):a}function i(n){return"\\"+tt[n]}function l(){return _.pop()||[]}function c(){return C.pop()||{a:"",b:d,c:"",k:d,l:d,"false":b,d:"",m:0,e:"",leading:b,f:"",maxWait:0,"null":b,number:d,object:d,push:d,g:d,string:d,h:"",trailing:b,"true":b,undefined:b,i:b,j:b,n:d}
9
+ }function f(n){return typeof n.toString!="function"&&typeof(n+"")=="string"}function p(){}function s(n){n.length=0,_.length<E&&_.push(n)}function g(n){var t=n.k;t&&g(t),n.b=n.k=n.l=n.object=n.number=n.string=n.n=d,C.length<E&&C.push(n)}function v(n,t,r){t||(t=0),typeof r=="undefined"&&(r=n?n.length:0);var e=-1;r=r-t||0;for(var u=Array(0>r?0:r);++e<r;)u[e]=n[t+e];return u}function h(e){function _(n){return n&&typeof n=="object"&&!qr(n)&&sr.call(n,"__wrapped__")?n:new C(n)}function C(n){this.__wrapped__=n
10
+ }function E(n,t,r,e){function u(){var e=arguments,c=o?this:t;return a||(n=t[i]),r.length&&(e=e.length?(e=Sr.call(e),l?e.concat(r):r.concat(e)):r),this instanceof u?(c=rt(n.prototype),e=n.apply(c,e),mt(e)?e:c):n.apply(c,e)}var a=ht(n),o=!r,i=t;if(o){var l=e;r=t}else if(!a){if(!e)throw new Zt;t=n}return u}function tt(){var n=c();n.g=L,n.b=n.c=n.f=n.h="",n.e="r",n.i=y,n.j=!!Rr;for(var t,r=0;t=arguments[r];r++)for(var e in t)n[e]=t[e];r=n.a,n.d=/^[^,]+/.exec(r)[0],t=Mt,r="return function("+r+"){",e="var m,r="+n.d+",C="+n.e+";if(!r)return C;"+n.h+";",n.b?(e+="var s=r.length;m=-1;if("+n.b+"){",Pr.unindexedChars&&(e+="if(q(r)){r=r.split('')}"),e+="while(++m<s){"+n.f+";}}else{"):Pr.nonEnumArgs&&(e+="var s=r.length;m=-1;if(s&&n(r)){while(++m<s){m+='';"+n.f+";}}else{"),Pr.enumPrototypes&&(e+="var E=typeof r=='function';"),Pr.enumErrorProps&&(e+="var D=r===j||r instanceof Error;");
11
+ var u=[];if(Pr.enumPrototypes&&u.push('!(E&&m=="prototype")'),Pr.enumErrorProps&&u.push('!(D&&(m=="message"||m=="name"))'),n.i&&n.j)e+="var A=-1,B=z[typeof r]&&t(r),s=B?B.length:0;while(++A<s){m=B[A];",u.length&&(e+="if("+u.join("&&")+"){"),e+=n.f+";",u.length&&(e+="}"),e+="}";else if(e+="for(m in r){",n.i&&u.push("l.call(r, m)"),u.length&&(e+="if("+u.join("&&")+"){"),e+=n.f+";",u.length&&(e+="}"),e+="}",Pr.nonEnumShadows){for(e+="if(r!==y){var h=r.constructor,p=r===(h&&h.prototype),e=r===H?G:r===j?i:J.call(r),v=w[e];",k=0;7>k;k++)e+="m='"+n.g[k]+"';if((!(p&&v[m])&&l.call(r,m))",n.i||(e+="||(!v[m]&&r[m]!==y[m])"),e+="){"+n.f+"}";
12
+ e+="}"}return(n.b||Pr.nonEnumArgs)&&(e+="}"),e+=n.c+";return C",t=t("i,j,l,n,o,q,t,u,y,z,w,G,H,J",r+e+"}"),g(n),t(M,tr,sr,ft,qr,dt,Rr,_,rr,nt,Nr,Y,er,yr)}function rt(n){return mt(n)?br(n):{}}function ut(n){return Wr[n]}function ot(){var n=(n=_.indexOf)===Pt?t:n;return n}function it(n){return function(t,r,e,u){return typeof r!="boolean"&&r!=d&&(u=e,e=u&&u[r]===t?m:r,r=b),e!=d&&(e=_.createCallback(e,u)),n(t,r,e,u)}}function lt(n){var t,r;return!n||yr.call(n)!=Q||(t=n.constructor,ht(t)&&!(t instanceof t))||!Pr.argsClass&&ft(n)||!Pr.nodeClass&&f(n)?b:Pr.ownLast?(Jr(n,function(n,t,e){return r=sr.call(e,t),b
13
+ }),r!==false):(Jr(n,function(n,t){r=t}),r===m||sr.call(n,r))}function ct(n){return Lr[n]}function ft(n){return yr.call(n)==G}function pt(n,t,r,e,u,a){var o=n;if(typeof t!="boolean"&&t!=d&&(e=r,r=t,t=b),typeof r=="function"){if(r=typeof e=="undefined"?r:_.createCallback(r,e,1),o=r(o),typeof o!="undefined")return o;o=n}if(e=mt(o)){var i=yr.call(o);if(!Z[i]||!Pr.nodeClass&&f(o))return o;var c=qr(o)}if(!e||!t)return e?c?v(o):Gr({},o):o;switch(e=Br[i],i){case J:case K:return new e(+o);case V:case Y:return new e(o);
14
+ case X:return e(o.source,P.exec(o))}i=!u,u||(u=l()),a||(a=l());for(var p=u.length;p--;)if(u[p]==n)return a[p];return o=c?e(o.length):{},c&&(sr.call(n,"index")&&(o.index=n.index),sr.call(n,"input")&&(o.input=n.input)),u.push(n),a.push(o),(c?Tr:Kr)(n,function(n,e){o[e]=pt(n,t,r,m,u,a)}),i&&(s(u),s(a)),o}function st(n){var t=[];return Jr(n,function(n,r){ht(n)&&t.push(r)}),t.sort()}function gt(n){for(var t=-1,r=Rr(n),e=r.length,u={};++t<e;){var a=r[t];u[n[a]]=a}return u}function vt(n,t,r,e,u,a){var o=r===w;
15
+ if(typeof r=="function"&&!o){r=_.createCallback(r,e,2);var i=r(n,t);if(typeof i!="undefined")return!!i}if(n===t)return 0!==n||1/n==1/t;var c=typeof n,p=typeof t;if(n===n&&(!n||"function"!=c&&"object"!=c)&&(!t||"function"!=p&&"object"!=p))return b;if(n==d||t==d)return n===t;if(p=yr.call(n),c=yr.call(t),p==G&&(p=Q),c==G&&(c=Q),p!=c)return b;switch(p){case J:case K:return+n==+t;case V:return n!=+n?t!=+t:0==n?1/n==1/t:n==+t;case X:case Y:return n==Yt(t)}if(c=p==H,!c){if(sr.call(n,"__wrapped__")||sr.call(t,"__wrapped__"))return vt(n.__wrapped__||n,t.__wrapped__||t,r,e,u,a);
16
+ if(p!=Q||!Pr.nodeClass&&(f(n)||f(t)))return b;var p=!Pr.argsObject&&ft(n)?Qt:n.constructor,g=!Pr.argsObject&&ft(t)?Qt:t.constructor;if(p!=g&&(!ht(p)||!(p instanceof p&&ht(g)&&g instanceof g)))return b}for(g=!u,u||(u=l()),a||(a=l()),p=u.length;p--;)if(u[p]==n)return a[p]==t;var v=0,i=y;if(u.push(n),a.push(t),c){if(p=n.length,v=t.length,i=v==n.length,!i&&!o)return i;for(;v--;)if(c=p,g=t[v],o)for(;c--&&!(i=vt(n[c],g,r,e,u,a)););else if(!(i=vt(n[v],g,r,e,u,a)))break;return i}return Jr(t,function(t,o,l){return sr.call(l,o)?(v++,i=sr.call(n,o)&&vt(n[o],t,r,e,u,a)):void 0
17
+ }),i&&!o&&Jr(n,function(n,t,r){return sr.call(r,t)?i=-1<--v:void 0}),g&&(s(u),s(a)),i}function ht(n){return typeof n=="function"}function mt(n){return!(!n||!nt[typeof n])}function yt(n){return typeof n=="number"||yr.call(n)==V}function dt(n){return typeof n=="string"||yr.call(n)==Y}function bt(n,t,r){var e=arguments,u=0,a=2;if(!mt(n))return n;if(r===w)var o=e[3],i=e[4],c=e[5];else{var f=y,i=l(),c=l();typeof r!="number"&&(a=e.length),3<a&&"function"==typeof e[a-2]?o=_.createCallback(e[--a-1],e[a--],2):2<a&&"function"==typeof e[a-1]&&(o=e[--a])
18
+ }for(;++u<a;)(qr(e[u])?xt:Kr)(e[u],function(t,r){var e,u,a=t,l=n[r];if(t&&((u=qr(t))||Mr(t))){for(a=i.length;a--;)if(e=i[a]==t){l=c[a];break}if(!e){var f;o&&(a=o(l,t),f=typeof a!="undefined")&&(l=a),f||(l=u?qr(l)?l:[]:Mr(l)?l:{}),i.push(t),c.push(l),f||(l=bt(l,t,w,o,i,c))}}else o&&(a=o(l,t),typeof a=="undefined"&&(a=t)),typeof a!="undefined"&&(l=a);n[r]=l});return f&&(s(i),s(c)),n}function _t(n){for(var t=-1,r=Rr(n),e=r.length,u=Ht(e);++t<e;)u[t]=n[r[t]];return u}function Ct(n,t,r){var e=-1,u=ot(),a=n?n.length:0,o=b;
19
+ return r=(0>r?kr(0,a+r):r)||0,a&&typeof a=="number"?o=-1<(dt(n)?n.indexOf(t,r):u(n,t,r)):Tr(n,function(n){return++e<r?void 0:!(o=n===t)}),o}function jt(n,t,r){var e=y;if(t=_.createCallback(t,r),qr(n)){r=-1;for(var u=n.length;++r<u&&(e=!!t(n[r],r,n)););}else Tr(n,function(n,r,u){return e=!!t(n,r,u)});return e}function wt(n,t,r){var e=[];if(t=_.createCallback(t,r),qr(n)){r=-1;for(var u=n.length;++r<u;){var a=n[r];t(a,r,n)&&e.push(a)}}else Tr(n,function(n,r,u){t(n,r,u)&&e.push(n)});return e}function kt(n,t,r){if(t=_.createCallback(t,r),!qr(n)){var e;
20
+ return Tr(n,function(n,r,u){return t(n,r,u)?(e=n,b):void 0}),e}r=-1;for(var u=n.length;++r<u;){var a=n[r];if(t(a,r,n))return a}}function xt(n,t,r){if(t&&typeof r=="undefined"&&qr(n)){r=-1;for(var e=n.length;++r<e&&t(n[r],r,n)!==false;);}else Tr(n,t,r);return n}function Ot(n,t,r){var e=-1,u=n?n.length:0,a=Ht(typeof u=="number"?u:0);if(t=_.createCallback(t,r),qr(n))for(;++e<u;)a[e]=t(n[e],e,n);else Tr(n,function(n,r,u){a[++e]=t(n,r,u)});return a}function Et(n,t,r){var e=-1/0,a=e;if(!t&&qr(n)){r=-1;for(var o=n.length;++r<o;){var i=n[r];
21
+ i>a&&(a=i)}}else t=!t&&dt(n)?u:_.createCallback(t,r),Tr(n,function(n,r,u){r=t(n,r,u),r>e&&(e=r,a=n)});return a}function St(n,t,r,e){var u=3>arguments.length;if(t=_.createCallback(t,e,4),qr(n)){var a=-1,o=n.length;for(u&&(r=n[++a]);++a<o;)r=t(r,n[a],a,n)}else Tr(n,function(n,e,a){r=u?(u=b,n):t(r,n,e,a)});return r}function At(n,t,r,e){var u=n,a=n?n.length:0,o=3>arguments.length;if(typeof a!="number")var i=Rr(n),a=i.length;else Pr.unindexedChars&&dt(n)&&(u=n.split(""));return t=_.createCallback(t,e,4),xt(n,function(n,e,l){e=i?i[--a]:--a,r=o?(o=b,u[e]):t(r,u[e],e,l)
22
+ }),r}function It(n,t,r){var e;if(t=_.createCallback(t,r),qr(n)){r=-1;for(var u=n.length;++r<u&&!(e=t(n[r],r,n)););}else Tr(n,function(n,r,u){return!(e=t(n,r,u))});return!!e}function Bt(n){var e=-1,u=ot(),a=n?n.length:0,i=lr.apply(nr,Sr.call(arguments,1)),l=[],c=a>=O&&u===t;if(c){var f=o(i);f?(u=r,i=f):c=b}for(;++e<a;)f=n[e],0>u(i,f)&&l.push(f);return c&&g(i),l}function Nt(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&t!=d){var a=-1;for(t=_.createCallback(t,r);++a<u&&t(n[a],a,n);)e++}else if(e=t,e==d||r)return n[0];
23
+ return v(n,0,xr(kr(0,e),u))}}function Pt(n,r,e){if(typeof e=="number"){var u=n?n.length:0;e=0>e?kr(0,u+e):e||0}else if(e)return e=Ft(n,r),n[e]===r?e:-1;return n?t(n,r,e):-1}function zt(n,t,r){if(typeof t!="number"&&t!=d){var e=0,u=-1,a=n?n.length:0;for(t=_.createCallback(t,r);++u<a&&t(n[u],u,n);)e++}else e=t==d||r?1:kr(0,t);return v(n,e)}function Ft(n,t,r,e){var u=0,a=n?n.length:u;for(r=r?_.createCallback(r,e,1):Wt,t=r(t);u<a;)e=u+a>>>1,r(n[e])<t?u=e+1:a=e;return u}function $t(n){for(var t=-1,r=n?Et(Ur(n,"length")):0,e=Ht(0>r?0:r);++t<r;)e[t]=Ur(n,t);
24
+ return e}function qt(n,t){for(var r=-1,e=n?n.length:0,u={};++r<e;){var a=n[r];t?u[a]=t[r]:u[a[0]]=a[1]}return u}function Dt(n,t){return Pr.fastBind||dr&&2<arguments.length?dr.call.apply(dr,arguments):E(n,t,Sr.call(arguments,2))}function Rt(n,t,r){function e(){ir(s),ir(g),c=0,s=g=d}function u(){var t=v&&(!h||1<c);e(),t&&(p!==false&&(f=new Kt),i=n.apply(l,o))}function a(){e(),(v||p!==t)&&(f=new Kt,i=n.apply(l,o))}var o,i,l,c=0,f=0,p=b,s=d,g=d,v=y;if(t=kr(0,t||0),r===y)var h=y,v=b;else mt(r)&&(h=r.leading,p="maxWait"in r&&kr(t,r.maxWait||0),v="trailing"in r?r.trailing:v);
25
+ return function(){if(o=arguments,l=this,c++,ir(g),p===false)h&&2>c&&(i=n.apply(l,o));else{var r=new Kt;!s&&!h&&(f=r);var e=p-(r-f);0<e?s||(s=mr(a,e)):(ir(s),s=d,f=r,i=n.apply(l,o))}return t!==p&&(g=mr(u,t)),i}}function Tt(n){var t=Sr.call(arguments,1);return mr(function(){n.apply(m,t)},1)}function Wt(n){return n}function Lt(n){xt(st(n),function(t){var r=_[t]=n[t];_.prototype[t]=function(){var n=this.__wrapped__,t=[n];return gr.apply(t,arguments),t=r.apply(_,t),n&&typeof n=="object"&&n===t?this:new C(t)
26
+ }})}function Gt(){return this.__wrapped__}e=e?at.defaults(n.Object(),e,at.pick(n,W)):n;var Ht=e.Array,Jt=e.Boolean,Kt=e.Date,Mt=e.Function,Ut=e.Math,Vt=e.Number,Qt=e.Object,Xt=e.RegExp,Yt=e.String,Zt=e.TypeError,nr=[],tr=e.Error.prototype,rr=Qt.prototype,er=Yt.prototype,ur=e._,ar=Xt("^"+Yt(rr.valueOf).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),or=Ut.ceil,ir=e.clearTimeout,lr=nr.concat,cr=Ut.floor,fr=Mt.prototype.toString,pr=ar.test(pr=Qt.getPrototypeOf)&&pr,sr=rr.hasOwnProperty,gr=nr.push,vr=rr.propertyIsEnumerable,hr=e.setImmediate,mr=e.setTimeout,yr=rr.toString,dr=ar.test(dr=yr.bind)&&dr,br=ar.test(br=Qt.create)&&br,_r=ar.test(_r=Ht.isArray)&&_r,Cr=e.isFinite,jr=e.isNaN,wr=ar.test(wr=Qt.keys)&&wr,kr=Ut.max,xr=Ut.min,Or=e.parseInt,Er=Ut.random,Sr=nr.slice,Ar=ar.test(e.attachEvent),Ir=dr&&!/\n|true/.test(dr+Ar),Br={};
27
+ Br[H]=Ht,Br[J]=Jt,Br[K]=Kt,Br[U]=Mt,Br[Q]=Qt,Br[V]=Vt,Br[X]=Xt,Br[Y]=Yt;var Nr={};Nr[H]=Nr[K]=Nr[V]={constructor:y,toLocaleString:y,toString:y,valueOf:y},Nr[J]=Nr[Y]={constructor:y,toString:y,valueOf:y},Nr[M]=Nr[U]=Nr[X]={constructor:y,toString:y},Nr[Q]={constructor:y},function(){for(var n=L.length;n--;){var t,r=L[n];for(t in Nr)sr.call(Nr,t)&&!sr.call(Nr[t],r)&&(Nr[t][r]=b)}}(),C.prototype=_.prototype;var Pr=_.support={};!function(){function n(){this.x=1}var t={0:1,length:1},r=[];n.prototype={valueOf:1};
28
+ for(var e in new n)r.push(e);for(e in arguments);Pr.argsObject=arguments.constructor==Qt&&!(arguments instanceof Ht),Pr.argsClass=ft(arguments),Pr.enumErrorProps=vr.call(tr,"message")||vr.call(tr,"name"),Pr.enumPrototypes=vr.call(n,"prototype"),Pr.fastBind=dr&&!Ir,Pr.ownLast="x"!=r[0],Pr.nonEnumArgs=0!=e,Pr.nonEnumShadows=!/valueOf/.test(r),Pr.spliceObjects=(nr.splice.call(t,0,1),!t[0]),Pr.unindexedChars="xx"!="x"[0]+Qt("x")[0];try{Pr.nodeClass=!(yr.call(document)==Q&&!({toString:0}+""))}catch(u){Pr.nodeClass=y
29
+ }}(1),_.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:z,variable:"",imports:{_:_}};var zr={a:"x,F,k",h:"var a=arguments,b=0,c=typeof k=='number'?2:a.length;while(++b<c){r=a[b];if(r&&z[typeof r]){",f:"if(typeof C[m]=='undefined')C[m]=r[m]",c:"}}"},Fr={a:"f,d,I",h:"d=d&&typeof I=='undefined'?d:u.createCallback(d,I)",b:"typeof s=='number'",f:"if(d(r[m],m,f)===false)return C"},$r={h:"if(!z[typeof r])return C;"+Fr.h,b:b};br||(rt=function(n){if(mt(n)){p.prototype=n;
30
+ var t=new p;p.prototype=d}return t||{}}),Pr.argsClass||(ft=function(n){return n?sr.call(n,"callee"):b});var qr=_r||function(n){return n?typeof n=="object"&&yr.call(n)==H:b},Dr=tt({a:"x",e:"[]",h:"if(!(z[typeof x]))return C",f:"C.push(m)"}),Rr=wr?function(n){return mt(n)?Pr.enumPrototypes&&typeof n=="function"||Pr.nonEnumArgs&&n.length&&ft(n)?Dr(n):wr(n):[]}:Dr,Tr=tt(Fr),Wr={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Lr=gt(Wr),Gr=tt(zr,{h:zr.h.replace(";",";if(c>3&&typeof a[c-2]=='function'){var d=u.createCallback(a[--c-1],a[c--],2)}else if(c>2&&typeof a[c-1]=='function'){d=a[--c]}"),f:"C[m]=d?d(C[m],r[m]):r[m]"}),Hr=tt(zr),Jr=tt(Fr,$r,{i:b}),Kr=tt(Fr,$r);
31
+ ht(/x/)&&(ht=function(n){return typeof n=="function"&&yr.call(n)==U});var Mr=pr?function(n){if(!n||yr.call(n)!=Q||!Pr.argsClass&&ft(n))return b;var t=n.valueOf,r=typeof t=="function"&&(r=pr(t))&&pr(r);return r?n==r||pr(n)==r:lt(n)}:lt,Ur=Ot,Vr=it(function Yr(n,t,r){for(var e=-1,u=n?n.length:0,a=[];++e<u;){var o=n[e];r&&(o=r(o,e,n)),qr(o)?gr.apply(a,t?o:Yr(o)):a.push(o)}return a}),Qr=it(function(n,e,u){var a=-1,i=ot(),c=n?n.length:0,f=[],p=!e&&c>=O&&i===t,v=u||p?l():f;if(p){var h=o(v);h?(i=r,v=h):(p=b,v=u?v:(s(v),f))
32
+ }for(;++a<c;){var h=n[a],m=u?u(h,a,n):h;(e?!a||v[v.length-1]!==m:0>i(v,m))&&((u||p)&&v.push(m),f.push(h))}return p?(s(v.b),g(v)):u&&s(v),f});Ir&&et&&typeof hr=="function"&&(Tt=Dt(hr,e));var Xr=8==Or($+"08")?Or:function(n,t){return Or(dt(n)?n.replace(q,""):n,t||0)};return _.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0}},_.assign=Gr,_.at=function(n){var t=-1,r=lr.apply(nr,Sr.call(arguments,1)),e=r.length,u=Ht(e);for(Pr.unindexedChars&&dt(n)&&(n=n.split(""));++t<e;)u[t]=n[r[t]];
33
+ return u},_.bind=Dt,_.bindAll=function(n){for(var t=1<arguments.length?lr.apply(nr,Sr.call(arguments,1)):st(n),r=-1,e=t.length;++r<e;){var u=t[r];n[u]=Dt(n[u],n)}return n},_.bindKey=function(n,t){return E(n,t,Sr.call(arguments,2),w)},_.compact=function(n){for(var t=-1,r=n?n.length:0,e=[];++t<r;){var u=n[t];u&&e.push(u)}return e},_.compose=function(){var n=arguments;return function(){for(var t=arguments,r=n.length;r--;)t=[n[r].apply(this,t)];return t[0]}},_.countBy=function(n,t,r){var e={};return t=_.createCallback(t,r),xt(n,function(n,r,u){r=Yt(t(n,r,u)),sr.call(e,r)?e[r]++:e[r]=1
34
+ }),e},_.createCallback=function(n,t,r){if(n==d)return Wt;var e=typeof n;if("function"!=e){if("object"!=e)return function(t){return t[n]};var u=Rr(n);return function(t){for(var r=u.length,e=b;r--&&(e=vt(t[u[r]],n[u[r]],w)););return e}}return typeof t=="undefined"||F&&!F.test(fr.call(n))?n:1===r?function(r){return n.call(t,r)}:2===r?function(r,e){return n.call(t,r,e)}:4===r?function(r,e,u,a){return n.call(t,r,e,u,a)}:function(r,e,u){return n.call(t,r,e,u)}},_.debounce=Rt,_.defaults=Hr,_.defer=Tt,_.delay=function(n,t){var r=Sr.call(arguments,2);
35
+ return mr(function(){n.apply(m,r)},t)},_.difference=Bt,_.filter=wt,_.flatten=Vr,_.forEach=xt,_.forIn=Jr,_.forOwn=Kr,_.functions=st,_.groupBy=function(n,t,r){var e={};return t=_.createCallback(t,r),xt(n,function(n,r,u){r=Yt(t(n,r,u)),(sr.call(e,r)?e[r]:e[r]=[]).push(n)}),e},_.initial=function(n,t,r){if(!n)return[];var e=0,u=n.length;if(typeof t!="number"&&t!=d){var a=u;for(t=_.createCallback(t,r);a--&&t(n[a],a,n);)e++}else e=t==d||r?1:t||e;return v(n,0,xr(kr(0,u-e),u))},_.intersection=function(n){for(var e=arguments,u=e.length,a=-1,i=l(),c=-1,f=ot(),p=n?n.length:0,v=[],h=l();++a<u;){var m=e[a];
36
+ i[a]=f===t&&(m?m.length:0)>=O&&o(a?e[a]:h)}n:for(;++c<p;){var y=i[0],m=n[c];if(0>(y?r(y,m):f(h,m))){for(a=u,(y||h).push(m);--a;)if(y=i[a],0>(y?r(y,m):f(e[a],m)))continue n;v.push(m)}}for(;u--;)(y=i[u])&&g(y);return s(i),s(h),v},_.invert=gt,_.invoke=function(n,t){var r=Sr.call(arguments,2),e=-1,u=typeof t=="function",a=n?n.length:0,o=Ht(typeof a=="number"?a:0);return xt(n,function(n){o[++e]=(u?t:n[t]).apply(n,r)}),o},_.keys=Rr,_.map=Ot,_.max=Et,_.memoize=function(n,t){function r(){var e=r.cache,u=x+(t?t.apply(this,arguments):arguments[0]);
37
+ return sr.call(e,u)?e[u]:e[u]=n.apply(this,arguments)}return r.cache={},r},_.merge=bt,_.min=function(n,t,r){var e=1/0,a=e;if(!t&&qr(n)){r=-1;for(var o=n.length;++r<o;){var i=n[r];i<a&&(a=i)}}else t=!t&&dt(n)?u:_.createCallback(t,r),Tr(n,function(n,r,u){r=t(n,r,u),r<e&&(e=r,a=n)});return a},_.omit=function(n,t,r){var e=ot(),u=typeof t=="function",a={};if(u)t=_.createCallback(t,r);else var o=lr.apply(nr,Sr.call(arguments,1));return Jr(n,function(n,r,i){(u?!t(n,r,i):0>e(o,r))&&(a[r]=n)}),a},_.once=function(n){var t,r;
38
+ return function(){return t?r:(t=y,r=n.apply(this,arguments),n=d,r)}},_.pairs=function(n){for(var t=-1,r=Rr(n),e=r.length,u=Ht(e);++t<e;){var a=r[t];u[t]=[a,n[a]]}return u},_.partial=function(n){return E(n,Sr.call(arguments,1))},_.partialRight=function(n){return E(n,Sr.call(arguments,1),d,w)},_.pick=function(n,t,r){var e={};if(typeof t!="function")for(var u=-1,a=lr.apply(nr,Sr.call(arguments,1)),o=mt(n)?a.length:0;++u<o;){var i=a[u];i in n&&(e[i]=n[i])}else t=_.createCallback(t,r),Jr(n,function(n,r,u){t(n,r,u)&&(e[r]=n)
39
+ });return e},_.pluck=Ur,_.range=function(n,t,r){n=+n||0,r=+r||1,t==d&&(t=n,n=0);var e=-1;t=kr(0,or((t-n)/r));for(var u=Ht(t);++e<t;)u[e]=n,n+=r;return u},_.reject=function(n,t,r){return t=_.createCallback(t,r),wt(n,function(n,r,e){return!t(n,r,e)})},_.rest=zt,_.shuffle=function(n){var t=-1,r=n?n.length:0,e=Ht(typeof r=="number"?r:0);return xt(n,function(n){var r=cr(Er()*(++t+1));e[t]=e[r],e[r]=n}),e},_.sortBy=function(n,t,r){var e=-1,u=n?n.length:0,o=Ht(typeof u=="number"?u:0);for(t=_.createCallback(t,r),xt(n,function(n,r,u){var a=o[++e]=c();
40
+ a.l=t(n,r,u),a.m=e,a.n=n}),u=o.length,o.sort(a);u--;)n=o[u],o[u]=n.n,g(n);return o},_.tap=function(n,t){return t(n),n},_.throttle=function(n,t,r){var e=y,u=y;return r===false?e=b:mt(r)&&(e="leading"in r?r.leading:e,u="trailing"in r?r.trailing:u),r=c(),r.leading=e,r.maxWait=t,r.trailing=u,n=Rt(n,t,r),g(r),n},_.times=function(n,t,r){n=-1<(n=+n)?n:0;var e=-1,u=Ht(n);for(t=_.createCallback(t,r,1);++e<n;)u[e]=t(e);return u},_.toArray=function(n){return n&&typeof n.length=="number"?Pr.unindexedChars&&dt(n)?n.split(""):v(n):_t(n)
41
+ },_.transform=function(n,t,r,e){var u=qr(n);return t=_.createCallback(t,e,4),r==d&&(u?r=[]:(e=n&&n.constructor,r=rt(e&&e.prototype))),(u?Tr:Kr)(n,function(n,e,u){return t(r,n,e,u)}),r},_.union=function(n){return qr(n)||(arguments[0]=n?Sr.call(n):nr),Qr(lr.apply(nr,arguments))},_.uniq=Qr,_.unzip=$t,_.values=_t,_.where=wt,_.without=function(n){return Bt(n,Sr.call(arguments,1))},_.wrap=function(n,t){return function(){var r=[n];return gr.apply(r,arguments),t.apply(this,r)}},_.zip=function(n){return n?$t(arguments):[]
42
+ },_.zipObject=qt,_.collect=Ot,_.drop=zt,_.each=xt,_.extend=Gr,_.methods=st,_.object=qt,_.select=wt,_.tail=zt,_.unique=Qr,Lt(_),_.chain=_,_.prototype.chain=function(){return this},_.clone=pt,_.cloneDeep=function(n,t,r){return pt(n,y,t,r)},_.contains=Ct,_.escape=function(n){return n==d?"":Yt(n).replace(R,ut)},_.every=jt,_.find=kt,_.findIndex=function(n,t,r){var e=-1,u=n?n.length:0;for(t=_.createCallback(t,r);++e<u;)if(t(n[e],e,n))return e;return-1},_.findKey=function(n,t,r){var e;return t=_.createCallback(t,r),Kr(n,function(n,r,u){return t(n,r,u)?(e=r,b):void 0
43
+ }),e},_.has=function(n,t){return n?sr.call(n,t):b},_.identity=Wt,_.indexOf=Pt,_.isArguments=ft,_.isArray=qr,_.isBoolean=function(n){return n===y||n===false||yr.call(n)==J},_.isDate=function(n){return n?typeof n=="object"&&yr.call(n)==K:b},_.isElement=function(n){return n?1===n.nodeType:b},_.isEmpty=function(n){var t=y;if(!n)return t;var r=yr.call(n),e=n.length;return r==H||r==Y||(Pr.argsClass?r==G:ft(n))||r==Q&&typeof e=="number"&&ht(n.splice)?!e:(Kr(n,function(){return t=b}),t)},_.isEqual=vt,_.isFinite=function(n){return Cr(n)&&!jr(parseFloat(n))
44
+ },_.isFunction=ht,_.isNaN=function(n){return yt(n)&&n!=+n},_.isNull=function(n){return n===d},_.isNumber=yt,_.isObject=mt,_.isPlainObject=Mr,_.isRegExp=function(n){return!(!n||!nt[typeof n])&&yr.call(n)==X},_.isString=dt,_.isUndefined=function(n){return typeof n=="undefined"},_.lastIndexOf=function(n,t,r){var e=n?n.length:0;for(typeof r=="number"&&(e=(0>r?kr(0,e+r):xr(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},_.mixin=Lt,_.noConflict=function(){return e._=ur,this},_.parseInt=Xr,_.random=function(n,t){n==d&&t==d&&(t=1),n=+n||0,t==d?(t=n,n=0):t=+t||0;
45
+ var r=Er();return n%1||t%1?n+xr(r*(t-n+parseFloat("1e-"+((r+"").length-1))),t):n+cr(r*(t-n+1))},_.reduce=St,_.reduceRight=At,_.result=function(n,t){var r=n?n[t]:m;return ht(r)?n[t]():r},_.runInContext=h,_.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Rr(n).length},_.some=It,_.sortedIndex=Ft,_.template=function(n,t,r){var e=_.templateSettings;n||(n=""),r=Hr({},r,e);var u,a=Hr({},r.imports,e.imports),e=Rr(a),a=_t(a),o=0,l=r.interpolate||D,c="__p+='",l=Xt((r.escape||D).source+"|"+l.source+"|"+(l===z?N:D).source+"|"+(r.evaluate||D).source+"|$","g");
46
+ n.replace(l,function(t,r,e,a,l,f){return e||(e=a),c+=n.slice(o,f).replace(T,i),r&&(c+="'+__e("+r+")+'"),l&&(u=y,c+="';"+l+";__p+='"),e&&(c+="'+((__t=("+e+"))==null?'':__t)+'"),o=f+t.length,t}),c+="';\n",l=r=r.variable,l||(r="obj",c="with("+r+"){"+c+"}"),c=(u?c.replace(S,""):c).replace(A,"$1").replace(I,"$1;"),c="function("+r+"){"+(l?"":r+"||("+r+"={});")+"var __t,__p='',__e=_.escape"+(u?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+c+"return __p}";try{var f=Mt(e,"return "+c).apply(m,a)
47
+ }catch(p){throw p.source=c,p}return t?f(t):(f.source=c,f)},_.unescape=function(n){return n==d?"":Yt(n).replace(B,ct)},_.uniqueId=function(n){var t=++j;return Yt(n==d?"":n)+t},_.all=jt,_.any=It,_.detect=kt,_.findWhere=kt,_.foldl=St,_.foldr=At,_.include=Ct,_.inject=St,Kr(_,function(n,t){_.prototype[t]||(_.prototype[t]=function(){var t=[this.__wrapped__];return gr.apply(t,arguments),n.apply(_,t)})}),_.first=Nt,_.last=function(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&t!=d){var a=u;for(t=_.createCallback(t,r);a--&&t(n[a],a,n);)e++
48
+ }else if(e=t,e==d||r)return n[u-1];return v(n,kr(0,u-e))}},_.take=Nt,_.head=Nt,Kr(_,function(n,t){_.prototype[t]||(_.prototype[t]=function(t,r){var e=n(this.__wrapped__,t,r);return t==d||r&&typeof t!="function"?e:new C(e)})}),_.VERSION="1.3.1",_.prototype.toString=function(){return Yt(this.__wrapped__)},_.prototype.value=Gt,_.prototype.valueOf=Gt,Tr(["join","pop","shift"],function(n){var t=nr[n];_.prototype[n]=function(){return t.apply(this.__wrapped__,arguments)}}),Tr(["push","reverse","sort","unshift"],function(n){var t=nr[n];
49
+ _.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),Tr(["concat","slice","splice"],function(n){var t=nr[n];_.prototype[n]=function(){return new C(t.apply(this.__wrapped__,arguments))}}),Pr.spliceObjects||Tr(["pop","shift","splice"],function(n){var t=nr[n],r="splice"==n;_.prototype[n]=function(){var n=this.__wrapped__,e=t.apply(n,arguments);return 0===n.length&&delete n[0],r?new C(e):e}}),_}var m,y=!0,d=null,b=!1,_=[],C=[],j=0,w={},x=+new Date+"",O=75,E=40,S=/\b__p\+='';/g,A=/\b(__p\+=)''\+/g,I=/(__e\(.*?\)|\b__t\))\+'';/g,B=/&(?:amp|lt|gt|quot|#39);/g,N=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,P=/\w*$/,z=/<%=([\s\S]+?)%>/g,F=(F=/\bthis\b/)&&F.test(h)&&F,$=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",q=RegExp("^["+$+"]*0+(?=.$)"),D=/($^)/,R=/[&<>"']/g,T=/['\n\r\t\u2028\u2029\\]/g,W="Array Boolean Date Error Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),L="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),G="[object Arguments]",H="[object Array]",J="[object Boolean]",K="[object Date]",M="[object Error]",U="[object Function]",V="[object Number]",Q="[object Object]",X="[object RegExp]",Y="[object String]",Z={};
50
+ Z[U]=b,Z[G]=Z[H]=Z[J]=Z[K]=Z[V]=Z[Q]=Z[X]=Z[Y]=y;var nt={"boolean":b,"function":y,object:y,number:b,string:b,undefined:b},tt={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},rt=nt[typeof exports]&&exports,et=nt[typeof module]&&module&&module.exports==rt&&module,ut=nt[typeof global]&&global;!ut||ut.global!==ut&&ut.window!==ut||(n=ut);var at=h();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=at, define(function(){return at})):rt&&!rt.nodeType?et?(et.exports=at)._=at:rt._=at:n._=at
51
+ }(this);
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Lo-Dash 1.2.1 (Custom Build) <http://lodash.com/>
3
+ * Lo-Dash 1.3.1 (Custom Build) <http://lodash.com/>
4
4
  * Build: `lodash modern -o ./dist/lodash.js`
5
5
  * Copyright 2012-2013 The Dojo Foundation <http://dojofoundation.org/>
6
6
  * Based on Underscore.js 1.4.4 <http://underscorejs.org/>
@@ -12,17 +12,9 @@
12
12
  /** Used as a safe reference for `undefined` in pre ES5 environments */
13
13
  var undefined;
14
14
 
15
- /** Detect free variable `exports` */
16
- var freeExports = typeof exports == 'object' && exports;
17
-
18
- /** Detect free variable `module` */
19
- var freeModule = typeof module == 'object' && module && module.exports == freeExports && module;
20
-
21
- /** Detect free variable `global`, from Node.js or Browserified code, and use it as `window` */
22
- var freeGlobal = typeof global == 'object' && global;
23
- if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) {
24
- window = freeGlobal;
25
- }
15
+ /** Used to pool arrays and objects used internally */
16
+ var arrayPool = [],
17
+ objectPool = [];
26
18
 
27
19
  /** Used to generate unique IDs */
28
20
  var idCounter = 0;
@@ -34,7 +26,10 @@
34
26
  var keyPrefix = +new Date + '';
35
27
 
36
28
  /** Used as the size when optimizations are enabled for large arrays */
37
- var largeArraySize = 200;
29
+ var largeArraySize = 75;
30
+
31
+ /** Used as the max size of the `arrayPool` and `objectPool` */
32
+ var maxPoolSize = 40;
38
33
 
39
34
  /** Used to match empty string literals in compiled template source */
40
35
  var reEmptyStringLeading = /\b__p \+= '';/g,
@@ -56,6 +51,9 @@
56
51
  /** Used to match "interpolate" template delimiters */
57
52
  var reInterpolate = /<%=([\s\S]+?)%>/g;
58
53
 
54
+ /** Used to detect functions containing a `this` reference */
55
+ var reThis = (reThis = /\bthis\b/) && reThis.test(runInContext) && reThis;
56
+
59
57
  /** Used to detect and test whitespace */
60
58
  var whitespace = (
61
59
  // whitespace
@@ -82,9 +80,9 @@
82
80
 
83
81
  /** Used to assign default `context` object properties */
84
82
  var contextProps = [
85
- 'Array', 'Boolean', 'Date', 'Function', 'Math', 'Number', 'Object', 'RegExp',
86
- 'String', '_', 'attachEvent', 'clearTimeout', 'isFinite', 'isNaN', 'parseInt',
87
- 'setImmediate', 'setTimeout'
83
+ 'Array', 'Boolean', 'Date', 'Function', 'Math', 'Number', 'Object',
84
+ 'RegExp', 'String', '_', 'attachEvent', 'clearTimeout', 'isFinite', 'isNaN',
85
+ 'parseInt', 'setImmediate', 'setTimeout'
88
86
  ];
89
87
 
90
88
  /** Used to make template sourceURLs easier to identify */
@@ -95,6 +93,7 @@
95
93
  arrayClass = '[object Array]',
96
94
  boolClass = '[object Boolean]',
97
95
  dateClass = '[object Date]',
96
+ errorClass = '[object Error]',
98
97
  funcClass = '[object Function]',
99
98
  numberClass = '[object Number]',
100
99
  objectClass = '[object Object]',
@@ -130,6 +129,282 @@
130
129
  '\u2029': 'u2029'
131
130
  };
132
131
 
132
+ /** Detect free variable `exports` */
133
+ var freeExports = objectTypes[typeof exports] && exports;
134
+
135
+ /** Detect free variable `module` */
136
+ var freeModule = objectTypes[typeof module] && module && module.exports == freeExports && module;
137
+
138
+ /** Detect free variable `global`, from Node.js or Browserified code, and use it as `window` */
139
+ var freeGlobal = objectTypes[typeof global] && global;
140
+ if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) {
141
+ window = freeGlobal;
142
+ }
143
+
144
+ /*--------------------------------------------------------------------------*/
145
+
146
+ /**
147
+ * A basic implementation of `_.indexOf` without support for binary searches
148
+ * or `fromIndex` constraints.
149
+ *
150
+ * @private
151
+ * @param {Array} array The array to search.
152
+ * @param {Mixed} value The value to search for.
153
+ * @param {Number} [fromIndex=0] The index to search from.
154
+ * @returns {Number} Returns the index of the matched value or `-1`.
155
+ */
156
+ function basicIndexOf(array, value, fromIndex) {
157
+ var index = (fromIndex || 0) - 1,
158
+ length = array.length;
159
+
160
+ while (++index < length) {
161
+ if (array[index] === value) {
162
+ return index;
163
+ }
164
+ }
165
+ return -1;
166
+ }
167
+
168
+ /**
169
+ * An implementation of `_.contains` for cache objects that mimics the return
170
+ * signature of `_.indexOf` by returning `0` if the value is found, else `-1`.
171
+ *
172
+ * @private
173
+ * @param {Object} cache The cache object to inspect.
174
+ * @param {Mixed} value The value to search for.
175
+ * @returns {Number} Returns `0` if `value` is found, else `-1`.
176
+ */
177
+ function cacheIndexOf(cache, value) {
178
+ var type = typeof value;
179
+ cache = cache.cache;
180
+
181
+ if (type == 'boolean' || value == null) {
182
+ return cache[value];
183
+ }
184
+ if (type != 'number' && type != 'string') {
185
+ type = 'object';
186
+ }
187
+ var key = type == 'number' ? value : keyPrefix + value;
188
+ cache = cache[type] || (cache[type] = {});
189
+
190
+ return type == 'object'
191
+ ? (cache[key] && basicIndexOf(cache[key], value) > -1 ? 0 : -1)
192
+ : (cache[key] ? 0 : -1);
193
+ }
194
+
195
+ /**
196
+ * Adds a given `value` to the corresponding cache object.
197
+ *
198
+ * @private
199
+ * @param {Mixed} value The value to add to the cache.
200
+ */
201
+ function cachePush(value) {
202
+ var cache = this.cache,
203
+ type = typeof value;
204
+
205
+ if (type == 'boolean' || value == null) {
206
+ cache[value] = true;
207
+ } else {
208
+ if (type != 'number' && type != 'string') {
209
+ type = 'object';
210
+ }
211
+ var key = type == 'number' ? value : keyPrefix + value,
212
+ typeCache = cache[type] || (cache[type] = {});
213
+
214
+ if (type == 'object') {
215
+ if ((typeCache[key] || (typeCache[key] = [])).push(value) == this.array.length) {
216
+ cache[type] = false;
217
+ }
218
+ } else {
219
+ typeCache[key] = true;
220
+ }
221
+ }
222
+ }
223
+
224
+ /**
225
+ * Used by `_.max` and `_.min` as the default `callback` when a given
226
+ * `collection` is a string value.
227
+ *
228
+ * @private
229
+ * @param {String} value The character to inspect.
230
+ * @returns {Number} Returns the code unit of given character.
231
+ */
232
+ function charAtCallback(value) {
233
+ return value.charCodeAt(0);
234
+ }
235
+
236
+ /**
237
+ * Used by `sortBy` to compare transformed `collection` values, stable sorting
238
+ * them in ascending order.
239
+ *
240
+ * @private
241
+ * @param {Object} a The object to compare to `b`.
242
+ * @param {Object} b The object to compare to `a`.
243
+ * @returns {Number} Returns the sort order indicator of `1` or `-1`.
244
+ */
245
+ function compareAscending(a, b) {
246
+ var ai = a.index,
247
+ bi = b.index;
248
+
249
+ a = a.criteria;
250
+ b = b.criteria;
251
+
252
+ // ensure a stable sort in V8 and other engines
253
+ // http://code.google.com/p/v8/issues/detail?id=90
254
+ if (a !== b) {
255
+ if (a > b || typeof a == 'undefined') {
256
+ return 1;
257
+ }
258
+ if (a < b || typeof b == 'undefined') {
259
+ return -1;
260
+ }
261
+ }
262
+ return ai < bi ? -1 : 1;
263
+ }
264
+
265
+ /**
266
+ * Creates a cache object to optimize linear searches of large arrays.
267
+ *
268
+ * @private
269
+ * @param {Array} [array=[]] The array to search.
270
+ * @returns {Null|Object} Returns the cache object or `null` if caching should not be used.
271
+ */
272
+ function createCache(array) {
273
+ var index = -1,
274
+ length = array.length;
275
+
276
+ var cache = getObject();
277
+ cache['false'] = cache['null'] = cache['true'] = cache['undefined'] = false;
278
+
279
+ var result = getObject();
280
+ result.array = array;
281
+ result.cache = cache;
282
+ result.push = cachePush;
283
+
284
+ while (++index < length) {
285
+ result.push(array[index]);
286
+ }
287
+ return cache.object === false
288
+ ? (releaseObject(result), null)
289
+ : result;
290
+ }
291
+
292
+ /**
293
+ * Used by `template` to escape characters for inclusion in compiled
294
+ * string literals.
295
+ *
296
+ * @private
297
+ * @param {String} match The matched character to escape.
298
+ * @returns {String} Returns the escaped character.
299
+ */
300
+ function escapeStringChar(match) {
301
+ return '\\' + stringEscapes[match];
302
+ }
303
+
304
+ /**
305
+ * Gets an array from the array pool or creates a new one if the pool is empty.
306
+ *
307
+ * @private
308
+ * @returns {Array} The array from the pool.
309
+ */
310
+ function getArray() {
311
+ return arrayPool.pop() || [];
312
+ }
313
+
314
+ /**
315
+ * Gets an object from the object pool or creates a new one if the pool is empty.
316
+ *
317
+ * @private
318
+ * @returns {Object} The object from the pool.
319
+ */
320
+ function getObject() {
321
+ return objectPool.pop() || {
322
+ 'array': null,
323
+ 'cache': null,
324
+ 'criteria': null,
325
+ 'false': false,
326
+ 'index': 0,
327
+ 'leading': false,
328
+ 'maxWait': 0,
329
+ 'null': false,
330
+ 'number': null,
331
+ 'object': null,
332
+ 'push': null,
333
+ 'string': null,
334
+ 'trailing': false,
335
+ 'true': false,
336
+ 'undefined': false,
337
+ 'value': null
338
+ };
339
+ }
340
+
341
+ /**
342
+ * A no-operation function.
343
+ *
344
+ * @private
345
+ */
346
+ function noop() {
347
+ // no operation performed
348
+ }
349
+
350
+ /**
351
+ * Releases the given `array` back to the array pool.
352
+ *
353
+ * @private
354
+ * @param {Array} [array] The array to release.
355
+ */
356
+ function releaseArray(array) {
357
+ array.length = 0;
358
+ if (arrayPool.length < maxPoolSize) {
359
+ arrayPool.push(array);
360
+ }
361
+ }
362
+
363
+ /**
364
+ * Releases the given `object` back to the object pool.
365
+ *
366
+ * @private
367
+ * @param {Object} [object] The object to release.
368
+ */
369
+ function releaseObject(object) {
370
+ var cache = object.cache;
371
+ if (cache) {
372
+ releaseObject(cache);
373
+ }
374
+ object.array = object.cache = object.criteria = object.object = object.number = object.string = object.value = null;
375
+ if (objectPool.length < maxPoolSize) {
376
+ objectPool.push(object);
377
+ }
378
+ }
379
+
380
+ /**
381
+ * Slices the `collection` from the `start` index up to, but not including,
382
+ * the `end` index.
383
+ *
384
+ * Note: This function is used, instead of `Array#slice`, to support node lists
385
+ * in IE < 9 and to ensure dense arrays are returned.
386
+ *
387
+ * @private
388
+ * @param {Array|Object|String} collection The collection to slice.
389
+ * @param {Number} start The start index.
390
+ * @param {Number} end The end index.
391
+ * @returns {Array} Returns the new array.
392
+ */
393
+ function slice(array, start, end) {
394
+ start || (start = 0);
395
+ if (typeof end == 'undefined') {
396
+ end = array ? array.length : 0;
397
+ }
398
+ var index = -1,
399
+ length = end - start || 0,
400
+ result = Array(length < 0 ? 0 : length);
401
+
402
+ while (++index < length) {
403
+ result[index] = array[start + index];
404
+ }
405
+ return result;
406
+ }
407
+
133
408
  /*--------------------------------------------------------------------------*/
134
409
 
135
410
  /**
@@ -160,16 +435,24 @@
160
435
  String = context.String,
161
436
  TypeError = context.TypeError;
162
437
 
163
- /** Used for `Array` and `Object` method references */
164
- var arrayRef = Array(),
165
- objectRef = Object();
438
+ /**
439
+ * Used for `Array` method references.
440
+ *
441
+ * Normally `Array.prototype` would suffice, however, using an array literal
442
+ * avoids issues in Narwhal.
443
+ */
444
+ var arrayRef = [];
445
+
446
+ /** Used for native method references */
447
+ var objectProto = Object.prototype,
448
+ stringProto = String.prototype;
166
449
 
167
450
  /** Used to restore the original `_` reference in `noConflict` */
168
451
  var oldDash = context._;
169
452
 
170
453
  /** Used to detect if a method is native */
171
454
  var reNative = RegExp('^' +
172
- String(objectRef.valueOf)
455
+ String(objectProto.valueOf)
173
456
  .replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
174
457
  .replace(/valueOf|for [^\]]+/g, '.+?') + '$'
175
458
  );
@@ -179,15 +462,18 @@
179
462
  clearTimeout = context.clearTimeout,
180
463
  concat = arrayRef.concat,
181
464
  floor = Math.floor,
465
+ fnToString = Function.prototype.toString,
182
466
  getPrototypeOf = reNative.test(getPrototypeOf = Object.getPrototypeOf) && getPrototypeOf,
183
- hasOwnProperty = objectRef.hasOwnProperty,
467
+ hasOwnProperty = objectProto.hasOwnProperty,
184
468
  push = arrayRef.push,
469
+ propertyIsEnumerable = objectProto.propertyIsEnumerable,
185
470
  setImmediate = context.setImmediate,
186
471
  setTimeout = context.setTimeout,
187
- toString = objectRef.toString;
472
+ toString = objectProto.toString;
188
473
 
189
474
  /* Native method shortcuts for methods with the same name as other `lodash` methods */
190
475
  var nativeBind = reNative.test(nativeBind = toString.bind) && nativeBind,
476
+ nativeCreate = reNative.test(nativeCreate = Object.create) && nativeCreate,
191
477
  nativeIsArray = reNative.test(nativeIsArray = Array.isArray) && nativeIsArray,
192
478
  nativeIsFinite = context.isFinite,
193
479
  nativeIsNaN = context.isNaN,
@@ -207,6 +493,7 @@
207
493
  ctorByClass[arrayClass] = Array;
208
494
  ctorByClass[boolClass] = Boolean;
209
495
  ctorByClass[dateClass] = Date;
496
+ ctorByClass[funcClass] = Function;
210
497
  ctorByClass[objectClass] = Object;
211
498
  ctorByClass[numberClass] = Number;
212
499
  ctorByClass[regexpClass] = RegExp;
@@ -233,8 +520,8 @@
233
520
  * `invoke`, `keys`, `map`, `max`, `memoize`, `merge`, `min`, `object`, `omit`,
234
521
  * `once`, `pairs`, `partial`, `partialRight`, `pick`, `pluck`, `push`, `range`,
235
522
  * `reject`, `rest`, `reverse`, `shuffle`, `slice`, `sort`, `sortBy`, `splice`,
236
- * `tap`, `throttle`, `times`, `toArray`, `union`, `uniq`, `unshift`, `unzip`,
237
- * `values`, `where`, `without`, `wrap`, and `zip`
523
+ * `tap`, `throttle`, `times`, `toArray`, `transform`, `union`, `uniq`, `unshift`,
524
+ * `unzip`, `values`, `where`, `without`, `wrap`, and `zip`
238
525
  *
239
526
  * The non-chainable wrapper functions are:
240
527
  * `clone`, `cloneDeep`, `contains`, `escape`, `every`, `find`, `has`,
@@ -250,6 +537,7 @@
250
537
  *
251
538
  * @name _
252
539
  * @constructor
540
+ * @alias chain
253
541
  * @category Chaining
254
542
  * @param {Mixed} value The value to wrap in a `lodash` instance.
255
543
  * @returns {Object} Returns a `lodash` instance.
@@ -281,6 +569,19 @@
281
569
  : new lodashWrapper(value);
282
570
  }
283
571
 
572
+ /**
573
+ * A fast path for creating `lodash` wrapper objects.
574
+ *
575
+ * @private
576
+ * @param {Mixed} value The value to wrap in a `lodash` instance.
577
+ * @returns {Object} Returns a `lodash` instance.
578
+ */
579
+ function lodashWrapper(value) {
580
+ this.__wrapped__ = value;
581
+ }
582
+ // ensure `new lodashWrapper` is an instance of `lodash`
583
+ lodashWrapper.prototype = lodash.prototype;
584
+
284
585
  /**
285
586
  * An object used to flag environments features.
286
587
  *
@@ -361,78 +662,6 @@
361
662
 
362
663
  /*--------------------------------------------------------------------------*/
363
664
 
364
- /**
365
- * Creates a function optimized to search large arrays for a given `value`,
366
- * starting at `fromIndex`, using strict equality for comparisons, i.e. `===`.
367
- *
368
- * @private
369
- * @param {Array} array The array to search.
370
- * @param {Mixed} value The value to search for.
371
- * @returns {Boolean} Returns `true`, if `value` is found, else `false`.
372
- */
373
- function cachedContains(array) {
374
- var length = array.length,
375
- isLarge = length >= largeArraySize;
376
-
377
- if (isLarge) {
378
- var cache = {},
379
- index = -1;
380
-
381
- while (++index < length) {
382
- var key = keyPrefix + array[index];
383
- (cache[key] || (cache[key] = [])).push(array[index]);
384
- }
385
- }
386
- return function(value) {
387
- if (isLarge) {
388
- var key = keyPrefix + value;
389
- return cache[key] && indexOf(cache[key], value) > -1;
390
- }
391
- return indexOf(array, value) > -1;
392
- }
393
- }
394
-
395
- /**
396
- * Used by `_.max` and `_.min` as the default `callback` when a given
397
- * `collection` is a string value.
398
- *
399
- * @private
400
- * @param {String} value The character to inspect.
401
- * @returns {Number} Returns the code unit of given character.
402
- */
403
- function charAtCallback(value) {
404
- return value.charCodeAt(0);
405
- }
406
-
407
- /**
408
- * Used by `sortBy` to compare transformed `collection` values, stable sorting
409
- * them in ascending order.
410
- *
411
- * @private
412
- * @param {Object} a The object to compare to `b`.
413
- * @param {Object} b The object to compare to `a`.
414
- * @returns {Number} Returns the sort order indicator of `1` or `-1`.
415
- */
416
- function compareAscending(a, b) {
417
- var ai = a.index,
418
- bi = b.index;
419
-
420
- a = a.criteria;
421
- b = b.criteria;
422
-
423
- // ensure a stable sort in V8 and other engines
424
- // http://code.google.com/p/v8/issues/detail?id=90
425
- if (a !== b) {
426
- if (a > b || typeof a == 'undefined') {
427
- return 1;
428
- }
429
- if (a < b || typeof b == 'undefined') {
430
- return -1;
431
- }
432
- }
433
- return ai < bi ? -1 : 1;
434
- }
435
-
436
665
  /**
437
666
  * Creates a function that, when called, invokes `func` with the `this` binding
438
667
  * of `thisArg` and prepends any `partialArgs` to the arguments passed to the
@@ -479,9 +708,7 @@
479
708
  }
480
709
  if (this instanceof bound) {
481
710
  // ensure `new bound` is an instance of `func`
482
- noop.prototype = func.prototype;
483
- thisBinding = new noop;
484
- noop.prototype = null;
711
+ thisBinding = createObject(func.prototype);
485
712
 
486
713
  // mimic the constructor's `return` behavior
487
714
  // http://es5.github.com/#x13.2.2
@@ -494,15 +721,14 @@
494
721
  }
495
722
 
496
723
  /**
497
- * Used by `template` to escape characters for inclusion in compiled
498
- * string literals.
724
+ * Creates a new object with the specified `prototype`.
499
725
  *
500
726
  * @private
501
- * @param {String} match The matched character to escape.
502
- * @returns {String} Returns the escaped character.
727
+ * @param {Object} prototype The prototype object.
728
+ * @returns {Object} Returns the new object.
503
729
  */
504
- function escapeStringChar(match) {
505
- return '\\' + stringEscapes[match];
730
+ function createObject(prototype) {
731
+ return isObject(prototype) ? nativeCreate(prototype) : {};
506
732
  }
507
733
 
508
734
  /**
@@ -517,25 +743,39 @@
517
743
  }
518
744
 
519
745
  /**
520
- * A fast path for creating `lodash` wrapper objects.
746
+ * Gets the appropriate "indexOf" function. If the `_.indexOf` method is
747
+ * customized, this method returns the custom method, otherwise it returns
748
+ * the `basicIndexOf` function.
521
749
  *
522
750
  * @private
523
- * @param {Mixed} value The value to wrap in a `lodash` instance.
524
- * @returns {Object} Returns a `lodash` instance.
751
+ * @returns {Function} Returns the "indexOf" function.
525
752
  */
526
- function lodashWrapper(value) {
527
- this.__wrapped__ = value;
753
+ function getIndexOf(array, value, fromIndex) {
754
+ var result = (result = lodash.indexOf) === indexOf ? basicIndexOf : result;
755
+ return result;
528
756
  }
529
- // ensure `new lodashWrapper` is an instance of `lodash`
530
- lodashWrapper.prototype = lodash.prototype;
531
757
 
532
758
  /**
533
- * A no-operation function.
759
+ * Creates a function that juggles arguments, allowing argument overloading
760
+ * for `_.flatten` and `_.uniq`, before passing them to the given `func`.
534
761
  *
535
762
  * @private
763
+ * @param {Function} func The function to wrap.
764
+ * @returns {Function} Returns the new function.
536
765
  */
537
- function noop() {
538
- // no operation performed
766
+ function overloadWrapper(func) {
767
+ return function(array, flag, callback, thisArg) {
768
+ // juggle arguments
769
+ if (typeof flag != 'boolean' && flag != null) {
770
+ thisArg = callback;
771
+ callback = !(thisArg && thisArg[flag] === array) ? flag : undefined;
772
+ flag = false;
773
+ }
774
+ if (callback != null) {
775
+ callback = lodash.createCallback(callback, thisArg);
776
+ }
777
+ return func(array, flag, callback, thisArg);
778
+ };
539
779
  }
540
780
 
541
781
  /**
@@ -549,52 +789,21 @@
549
789
  * @returns {Boolean} Returns `true`, if `value` is a plain object, else `false`.
550
790
  */
551
791
  function shimIsPlainObject(value) {
552
- // avoid non-objects and false positives for `arguments` objects
553
- var result = false;
554
- if (!(value && toString.call(value) == objectClass)) {
555
- return result;
556
- }
557
- // check that the constructor is `Object` (i.e. `Object instanceof Object`)
558
- var ctor = value.constructor;
559
-
560
- if (isFunction(ctor) ? ctor instanceof ctor : true) {
561
- // In most environments an object's own properties are iterated before
562
- // its inherited properties. If the last iterated property is an object's
563
- // own property then there are no inherited enumerable properties.
564
- forIn(value, function(value, key) {
565
- result = key;
566
- });
567
- return result === false || hasOwnProperty.call(value, result);
568
- }
569
- return result;
570
- }
571
-
572
- /**
573
- * Slices the `collection` from the `start` index up to, but not including,
574
- * the `end` index.
575
- *
576
- * Note: This function is used, instead of `Array#slice`, to support node lists
577
- * in IE < 9 and to ensure dense arrays are returned.
578
- *
579
- * @private
580
- * @param {Array|Object|String} collection The collection to slice.
581
- * @param {Number} start The start index.
582
- * @param {Number} end The end index.
583
- * @returns {Array} Returns the new array.
584
- */
585
- function slice(array, start, end) {
586
- start || (start = 0);
587
- if (typeof end == 'undefined') {
588
- end = array ? array.length : 0;
589
- }
590
- var index = -1,
591
- length = end - start || 0,
592
- result = Array(length < 0 ? 0 : length);
792
+ var ctor,
793
+ result;
593
794
 
594
- while (++index < length) {
595
- result[index] = array[start + index];
795
+ // avoid non Object objects, `arguments` objects, and DOM elements
796
+ if (!(value && toString.call(value) == objectClass) ||
797
+ (ctor = value.constructor, isFunction(ctor) && !(ctor instanceof ctor))) {
798
+ return false;
596
799
  }
597
- return result;
800
+ // In most environments an object's own properties are iterated before
801
+ // its inherited properties. If the last iterated property is an object's
802
+ // own property then there are no inherited enumerable properties.
803
+ forIn(value, function(value, key) {
804
+ result = key;
805
+ });
806
+ return result === undefined || hasOwnProperty.call(value, result);
598
807
  }
599
808
 
600
809
  /**
@@ -660,11 +869,10 @@
660
869
  var shimKeys = function (object) {
661
870
  var index, iterable = object, result = [];
662
871
  if (!iterable) return result;
663
- if (!(objectTypes[typeof object])) return result;
664
-
872
+ if (!(objectTypes[typeof object])) return result;
665
873
  for (index in iterable) {
666
- if (hasOwnProperty.call(iterable, index)) {
667
- result.push(index);
874
+ if (hasOwnProperty.call(iterable, index)) {
875
+ result.push(index);
668
876
  }
669
877
  }
670
878
  return result
@@ -754,25 +962,17 @@
754
962
  }
755
963
  while (++argsIndex < argsLength) {
756
964
  iterable = args[argsIndex];
757
- if (iterable && objectTypes[typeof iterable]) {;
758
- var length = iterable.length; index = -1;
759
- if (isArray(iterable)) {
760
- while (++index < length) {
761
- result[index] = callback ? callback(result[index], iterable[index]) : iterable[index]
762
- }
763
- }
764
- else {
965
+ if (iterable && objectTypes[typeof iterable]) {
765
966
  var ownIndex = -1,
766
- ownProps = objectTypes[typeof iterable] ? keys(iterable) : [],
767
- length = ownProps.length;
967
+ ownProps = objectTypes[typeof iterable] && keys(iterable),
968
+ length = ownProps ? ownProps.length : 0;
768
969
 
769
970
  while (++ownIndex < length) {
770
971
  index = ownProps[ownIndex];
771
- result[index] = callback ? callback(result[index], iterable[index]) : iterable[index]
972
+ result[index] = callback ? callback(result[index], iterable[index]) : iterable[index];
772
973
  }
773
- }
774
974
  }
775
- };
975
+ }
776
976
  return result
777
977
  };
778
978
 
@@ -823,7 +1023,7 @@
823
1023
 
824
1024
  // allows working with "Collections" methods without using their `callback`
825
1025
  // argument, `index|key`, for this method's `callback`
826
- if (typeof deep == 'function') {
1026
+ if (typeof deep != 'boolean' && deep != null) {
827
1027
  thisArg = callback;
828
1028
  callback = deep;
829
1029
  deep = false;
@@ -868,8 +1068,9 @@
868
1068
  return ctor(result.source, reFlags.exec(result));
869
1069
  }
870
1070
  // check for circular references and return corresponding clone
871
- stackA || (stackA = []);
872
- stackB || (stackB = []);
1071
+ var initedStack = !stackA;
1072
+ stackA || (stackA = getArray());
1073
+ stackB || (stackB = getArray());
873
1074
 
874
1075
  var length = stackA.length;
875
1076
  while (length--) {
@@ -899,6 +1100,10 @@
899
1100
  result[key] = clone(objValue, deep, callback, undefined, stackA, stackB);
900
1101
  });
901
1102
 
1103
+ if (initedStack) {
1104
+ releaseArray(stackA);
1105
+ releaseArray(stackB);
1106
+ }
902
1107
  return result;
903
1108
  }
904
1109
 
@@ -908,7 +1113,7 @@
908
1113
  * `undefined`, cloning will be handled by the method instead. The `callback`
909
1114
  * is bound to `thisArg` and invoked with one argument; (value).
910
1115
  *
911
- * Note: This function is loosely based on the structured clone algorithm. Functions
1116
+ * Note: This method is loosely based on the structured clone algorithm. Functions
912
1117
  * and DOM nodes are **not** cloned. The enumerable properties of `arguments` objects and
913
1118
  * objects created by constructors other than `Object` are cloned to plain `Object` objects.
914
1119
  * See http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm.
@@ -975,25 +1180,17 @@
975
1180
  argsLength = typeof guard == 'number' ? 2 : args.length;
976
1181
  while (++argsIndex < argsLength) {
977
1182
  iterable = args[argsIndex];
978
- if (iterable && objectTypes[typeof iterable]) {;
979
- var length = iterable.length; index = -1;
980
- if (isArray(iterable)) {
981
- while (++index < length) {
982
- if (typeof result[index] == 'undefined') result[index] = iterable[index]
983
- }
984
- }
985
- else {
1183
+ if (iterable && objectTypes[typeof iterable]) {
986
1184
  var ownIndex = -1,
987
- ownProps = objectTypes[typeof iterable] ? keys(iterable) : [],
988
- length = ownProps.length;
1185
+ ownProps = objectTypes[typeof iterable] && keys(iterable),
1186
+ length = ownProps ? ownProps.length : 0;
989
1187
 
990
1188
  while (++ownIndex < length) {
991
1189
  index = ownProps[ownIndex];
992
- if (typeof result[index] == 'undefined') result[index] = iterable[index]
1190
+ if (typeof result[index] == 'undefined') result[index] = iterable[index];
993
1191
  }
994
- }
995
1192
  }
996
- };
1193
+ }
997
1194
  return result
998
1195
  };
999
1196
 
@@ -1062,8 +1259,7 @@
1062
1259
  var index, iterable = collection, result = iterable;
1063
1260
  if (!iterable) return result;
1064
1261
  if (!objectTypes[typeof iterable]) return result;
1065
- callback = callback && typeof thisArg == 'undefined' ? callback : lodash.createCallback(callback, thisArg);
1066
-
1262
+ callback = callback && typeof thisArg == 'undefined' ? callback : lodash.createCallback(callback, thisArg);
1067
1263
  for (index in iterable) {
1068
1264
  if (callback(iterable[index], index, collection) === false) return result;
1069
1265
  }
@@ -1095,15 +1291,14 @@
1095
1291
  var index, iterable = collection, result = iterable;
1096
1292
  if (!iterable) return result;
1097
1293
  if (!objectTypes[typeof iterable]) return result;
1098
- callback = callback && typeof thisArg == 'undefined' ? callback : lodash.createCallback(callback, thisArg);
1099
-
1294
+ callback = callback && typeof thisArg == 'undefined' ? callback : lodash.createCallback(callback, thisArg);
1100
1295
  var ownIndex = -1,
1101
- ownProps = objectTypes[typeof iterable] ? keys(iterable) : [],
1102
- length = ownProps.length;
1296
+ ownProps = objectTypes[typeof iterable] && keys(iterable),
1297
+ length = ownProps ? ownProps.length : 0;
1103
1298
 
1104
1299
  while (++ownIndex < length) {
1105
1300
  index = ownProps[ownIndex];
1106
- if (callback(iterable[index], index, collection) === false) return result
1301
+ if (callback(iterable[index], index, collection) === false) return result;
1107
1302
  }
1108
1303
  return result
1109
1304
  };
@@ -1395,8 +1590,9 @@
1395
1590
  // assume cyclic structures are equal
1396
1591
  // the algorithm for detecting cyclic structures is adapted from ES 5.1
1397
1592
  // section 15.12.3, abstract operation `JO` (http://es5.github.com/#x15.12.3)
1398
- stackA || (stackA = []);
1399
- stackB || (stackB = []);
1593
+ var initedStack = !stackA;
1594
+ stackA || (stackA = getArray());
1595
+ stackB || (stackB = getArray());
1400
1596
 
1401
1597
  var length = stackA.length;
1402
1598
  while (length--) {
@@ -1458,6 +1654,10 @@
1458
1654
  }
1459
1655
  });
1460
1656
  }
1657
+ if (initedStack) {
1658
+ releaseArray(stackA);
1659
+ releaseArray(stackB);
1660
+ }
1461
1661
  return result;
1462
1662
  }
1463
1663
 
@@ -1535,7 +1735,7 @@
1535
1735
  // http://es5.github.com/#x8
1536
1736
  // and avoid a V8 bug
1537
1737
  // http://code.google.com/p/v8/issues/detail?id=2291
1538
- return value ? objectTypes[typeof value] : false;
1738
+ return !!(value && objectTypes[typeof value]);
1539
1739
  }
1540
1740
 
1541
1741
  /**
@@ -1761,8 +1961,9 @@
1761
1961
  stackA = args[4],
1762
1962
  stackB = args[5];
1763
1963
  } else {
1764
- stackA = [];
1765
- stackB = [];
1964
+ var initedStack = true;
1965
+ stackA = getArray();
1966
+ stackB = getArray();
1766
1967
 
1767
1968
  // allows working with `_.reduce` and `_.reduceRight` without
1768
1969
  // using their `callback` arguments, `index|key` and `collection`
@@ -1828,6 +2029,11 @@
1828
2029
  object[key] = value;
1829
2030
  });
1830
2031
  }
2032
+
2033
+ if (initedStack) {
2034
+ releaseArray(stackA);
2035
+ releaseArray(stackB);
2036
+ }
1831
2037
  return object;
1832
2038
  }
1833
2039
 
@@ -1858,7 +2064,8 @@
1858
2064
  * // => { 'name': 'moe' }
1859
2065
  */
1860
2066
  function omit(object, callback, thisArg) {
1861
- var isFunc = typeof callback == 'function',
2067
+ var indexOf = getIndexOf(),
2068
+ isFunc = typeof callback == 'function',
1862
2069
  result = {};
1863
2070
 
1864
2071
  if (isFunc) {
@@ -1953,6 +2160,57 @@
1953
2160
  return result;
1954
2161
  }
1955
2162
 
2163
+ /**
2164
+ * An alternative to `_.reduce`, this method transforms an `object` to a new
2165
+ * `accumulator` object which is the result of running each of its elements
2166
+ * through the `callback`, with each `callback` execution potentially mutating
2167
+ * the `accumulator` object. The `callback` is bound to `thisArg` and invoked
2168
+ * with four arguments; (accumulator, value, key, object). Callbacks may exit
2169
+ * iteration early by explicitly returning `false`.
2170
+ *
2171
+ * @static
2172
+ * @memberOf _
2173
+ * @category Objects
2174
+ * @param {Array|Object} collection The collection to iterate over.
2175
+ * @param {Function} [callback=identity] The function called per iteration.
2176
+ * @param {Mixed} [accumulator] The custom accumulator value.
2177
+ * @param {Mixed} [thisArg] The `this` binding of `callback`.
2178
+ * @returns {Mixed} Returns the accumulated value.
2179
+ * @example
2180
+ *
2181
+ * var squares = _.transform([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], function(result, num) {
2182
+ * num *= num;
2183
+ * if (num % 2) {
2184
+ * return result.push(num) < 3;
2185
+ * }
2186
+ * });
2187
+ * // => [1, 9, 25]
2188
+ *
2189
+ * var mapped = _.transform({ 'a': 1, 'b': 2, 'c': 3 }, function(result, num, key) {
2190
+ * result[key] = num * 3;
2191
+ * });
2192
+ * // => { 'a': 3, 'b': 6, 'c': 9 }
2193
+ */
2194
+ function transform(object, callback, accumulator, thisArg) {
2195
+ var isArr = isArray(object);
2196
+ callback = lodash.createCallback(callback, thisArg, 4);
2197
+
2198
+ if (accumulator == null) {
2199
+ if (isArr) {
2200
+ accumulator = [];
2201
+ } else {
2202
+ var ctor = object && object.constructor,
2203
+ proto = ctor && ctor.prototype;
2204
+
2205
+ accumulator = createObject(proto);
2206
+ }
2207
+ }
2208
+ (isArr ? forEach : forOwn)(object, function(value, index, object) {
2209
+ return callback(accumulator, value, index, object);
2210
+ });
2211
+ return accumulator;
2212
+ }
2213
+
1956
2214
  /**
1957
2215
  * Creates an array composed of the own enumerable property values of `object`.
1958
2216
  *
@@ -2042,11 +2300,12 @@
2042
2300
  */
2043
2301
  function contains(collection, target, fromIndex) {
2044
2302
  var index = -1,
2303
+ indexOf = getIndexOf(),
2045
2304
  length = collection ? collection.length : 0,
2046
2305
  result = false;
2047
2306
 
2048
2307
  fromIndex = (fromIndex < 0 ? nativeMax(0, length + fromIndex) : fromIndex) || 0;
2049
- if (typeof length == 'number') {
2308
+ if (length && typeof length == 'number') {
2050
2309
  result = (isString(collection)
2051
2310
  ? collection.indexOf(target, fromIndex)
2052
2311
  : indexOf(collection, target, fromIndex)
@@ -2245,7 +2504,7 @@
2245
2504
  *
2246
2505
  * @static
2247
2506
  * @memberOf _
2248
- * @alias detect
2507
+ * @alias detect, findWhere
2249
2508
  * @category Collections
2250
2509
  * @param {Array|Object|String} collection The collection to iterate over.
2251
2510
  * @param {Function|Object|String} [callback=identity] The function called per
@@ -2943,17 +3202,18 @@
2943
3202
 
2944
3203
  callback = lodash.createCallback(callback, thisArg);
2945
3204
  forEach(collection, function(value, key, collection) {
2946
- result[++index] = {
2947
- 'criteria': callback(value, key, collection),
2948
- 'index': index,
2949
- 'value': value
2950
- };
3205
+ var object = result[++index] = getObject();
3206
+ object.criteria = callback(value, key, collection);
3207
+ object.index = index;
3208
+ object.value = value;
2951
3209
  });
2952
3210
 
2953
3211
  length = result.length;
2954
3212
  result.sort(compareAscending);
2955
3213
  while (length--) {
2956
- result[length] = result[length].value;
3214
+ var object = result[length];
3215
+ result[length] = object.value;
3216
+ releaseObject(object);
2957
3217
  }
2958
3218
  return result;
2959
3219
  }
@@ -3051,17 +3311,31 @@
3051
3311
  */
3052
3312
  function difference(array) {
3053
3313
  var index = -1,
3314
+ indexOf = getIndexOf(),
3054
3315
  length = array ? array.length : 0,
3055
- flattened = concat.apply(arrayRef, nativeSlice.call(arguments, 1)),
3056
- contains = cachedContains(flattened),
3316
+ seen = concat.apply(arrayRef, nativeSlice.call(arguments, 1)),
3057
3317
  result = [];
3058
3318
 
3319
+ var isLarge = length >= largeArraySize && indexOf === basicIndexOf;
3320
+
3321
+ if (isLarge) {
3322
+ var cache = createCache(seen);
3323
+ if (cache) {
3324
+ indexOf = cacheIndexOf;
3325
+ seen = cache;
3326
+ } else {
3327
+ isLarge = false;
3328
+ }
3329
+ }
3059
3330
  while (++index < length) {
3060
3331
  var value = array[index];
3061
- if (!contains(value)) {
3332
+ if (indexOf(seen, value) < 0) {
3062
3333
  result.push(value);
3063
3334
  }
3064
3335
  }
3336
+ if (isLarge) {
3337
+ releaseObject(seen);
3338
+ }
3065
3339
  return result;
3066
3340
  }
3067
3341
 
@@ -3217,20 +3491,11 @@
3217
3491
  * _.flatten(stooges, 'quotes');
3218
3492
  * // => ['Oh, a wise guy, eh?', 'Poifect!', 'Spread out!', 'You knucklehead!']
3219
3493
  */
3220
- function flatten(array, isShallow, callback, thisArg) {
3494
+ var flatten = overloadWrapper(function flatten(array, isShallow, callback) {
3221
3495
  var index = -1,
3222
3496
  length = array ? array.length : 0,
3223
3497
  result = [];
3224
3498
 
3225
- // juggle arguments
3226
- if (typeof isShallow != 'boolean' && isShallow != null) {
3227
- thisArg = callback;
3228
- callback = isShallow;
3229
- isShallow = false;
3230
- }
3231
- if (callback != null) {
3232
- callback = lodash.createCallback(callback, thisArg);
3233
- }
3234
3499
  while (++index < length) {
3235
3500
  var value = array[index];
3236
3501
  if (callback) {
@@ -3244,7 +3509,7 @@
3244
3509
  }
3245
3510
  }
3246
3511
  return result;
3247
- }
3512
+ });
3248
3513
 
3249
3514
  /**
3250
3515
  * Gets the index at which the first occurrence of `value` is found using
@@ -3271,21 +3536,14 @@
3271
3536
  * // => 2
3272
3537
  */
3273
3538
  function indexOf(array, value, fromIndex) {
3274
- var index = -1,
3275
- length = array ? array.length : 0;
3276
-
3277
3539
  if (typeof fromIndex == 'number') {
3278
- index = (fromIndex < 0 ? nativeMax(0, length + fromIndex) : fromIndex || 0) - 1;
3540
+ var length = array ? array.length : 0;
3541
+ fromIndex = (fromIndex < 0 ? nativeMax(0, length + fromIndex) : fromIndex || 0);
3279
3542
  } else if (fromIndex) {
3280
- index = sortedIndex(array, value);
3543
+ var index = sortedIndex(array, value);
3281
3544
  return array[index] === value ? index : -1;
3282
3545
  }
3283
- while (++index < length) {
3284
- if (array[index] === value) {
3285
- return index;
3286
- }
3287
- }
3288
- return -1;
3546
+ return array ? basicIndexOf(array, value, fromIndex) : -1;
3289
3547
  }
3290
3548
 
3291
3549
  /**
@@ -3381,35 +3639,45 @@
3381
3639
  function intersection(array) {
3382
3640
  var args = arguments,
3383
3641
  argsLength = args.length,
3384
- cache = { '0': {} },
3642
+ argsIndex = -1,
3643
+ caches = getArray(),
3385
3644
  index = -1,
3645
+ indexOf = getIndexOf(),
3386
3646
  length = array ? array.length : 0,
3387
- isLarge = length >= largeArraySize,
3388
3647
  result = [],
3389
- seen = result;
3648
+ seen = getArray();
3390
3649
 
3650
+ while (++argsIndex < argsLength) {
3651
+ var value = args[argsIndex];
3652
+ caches[argsIndex] = indexOf === basicIndexOf &&
3653
+ (value ? value.length : 0) >= largeArraySize &&
3654
+ createCache(argsIndex ? args[argsIndex] : seen);
3655
+ }
3391
3656
  outer:
3392
3657
  while (++index < length) {
3393
- var value = array[index];
3394
- if (isLarge) {
3395
- var key = keyPrefix + value;
3396
- var inited = cache[0][key]
3397
- ? !(seen = cache[0][key])
3398
- : (seen = cache[0][key] = []);
3399
- }
3400
- if (inited || indexOf(seen, value) < 0) {
3401
- if (isLarge) {
3402
- seen.push(value);
3403
- }
3404
- var argsIndex = argsLength;
3658
+ var cache = caches[0];
3659
+ value = array[index];
3660
+
3661
+ if ((cache ? cacheIndexOf(cache, value) : indexOf(seen, value)) < 0) {
3662
+ argsIndex = argsLength;
3663
+ (cache || seen).push(value);
3405
3664
  while (--argsIndex) {
3406
- if (!(cache[argsIndex] || (cache[argsIndex] = cachedContains(args[argsIndex])))(value)) {
3665
+ cache = caches[argsIndex];
3666
+ if ((cache ? cacheIndexOf(cache, value) : indexOf(args[argsIndex], value)) < 0) {
3407
3667
  continue outer;
3408
3668
  }
3409
3669
  }
3410
3670
  result.push(value);
3411
3671
  }
3412
3672
  }
3673
+ while (argsLength--) {
3674
+ cache = caches[argsLength];
3675
+ if (cache) {
3676
+ releaseObject(cache);
3677
+ }
3678
+ }
3679
+ releaseArray(caches);
3680
+ releaseArray(seen);
3413
3681
  return result;
3414
3682
  }
3415
3683
 
@@ -3738,7 +4006,7 @@
3738
4006
  * Creates a duplicate-value-free version of the `array` using strict equality
3739
4007
  * for comparisons, i.e. `===`. If the `array` is already sorted, passing `true`
3740
4008
  * for `isSorted` will run a faster algorithm. If `callback` is passed, each
3741
- * element of `array` is passed through a `callback` before uniqueness is computed.
4009
+ * element of `array` is passed through the `callback` before uniqueness is computed.
3742
4010
  * The `callback` is bound to `thisArg` and invoked with three arguments; (value, index, array).
3743
4011
  *
3744
4012
  * If a property name is passed for `callback`, the created "_.pluck" style
@@ -3767,50 +4035,42 @@
3767
4035
  * _.uniq([1, 1, 2, 2, 3], true);
3768
4036
  * // => [1, 2, 3]
3769
4037
  *
3770
- * _.uniq([1, 2, 1.5, 3, 2.5], function(num) { return Math.floor(num); });
3771
- * // => [1, 2, 3]
4038
+ * _.uniq(['A', 'b', 'C', 'a', 'B', 'c'], function(letter) { return letter.toLowerCase(); });
4039
+ * // => ['A', 'b', 'C']
3772
4040
  *
3773
- * _.uniq([1, 2, 1.5, 3, 2.5], function(num) { return this.floor(num); }, Math);
3774
- * // => [1, 2, 3]
4041
+ * _.uniq([1, 2.5, 3, 1.5, 2, 3.5], function(num) { return this.floor(num); }, Math);
4042
+ * // => [1, 2.5, 3]
3775
4043
  *
3776
4044
  * // using "_.pluck" callback shorthand
3777
4045
  * _.uniq([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
3778
4046
  * // => [{ 'x': 1 }, { 'x': 2 }]
3779
4047
  */
3780
- function uniq(array, isSorted, callback, thisArg) {
4048
+ var uniq = overloadWrapper(function(array, isSorted, callback) {
3781
4049
  var index = -1,
4050
+ indexOf = getIndexOf(),
3782
4051
  length = array ? array.length : 0,
3783
- result = [],
3784
- seen = result;
4052
+ result = [];
4053
+
4054
+ var isLarge = !isSorted && length >= largeArraySize && indexOf === basicIndexOf,
4055
+ seen = (callback || isLarge) ? getArray() : result;
3785
4056
 
3786
- // juggle arguments
3787
- if (typeof isSorted != 'boolean' && isSorted != null) {
3788
- thisArg = callback;
3789
- callback = isSorted;
3790
- isSorted = false;
3791
- }
3792
- // init value cache for large arrays
3793
- var isLarge = !isSorted && length >= largeArraySize;
3794
4057
  if (isLarge) {
3795
- var cache = {};
3796
- }
3797
- if (callback != null) {
3798
- seen = [];
3799
- callback = lodash.createCallback(callback, thisArg);
4058
+ var cache = createCache(seen);
4059
+ if (cache) {
4060
+ indexOf = cacheIndexOf;
4061
+ seen = cache;
4062
+ } else {
4063
+ isLarge = false;
4064
+ seen = callback ? seen : (releaseArray(seen), result);
4065
+ }
3800
4066
  }
3801
4067
  while (++index < length) {
3802
4068
  var value = array[index],
3803
4069
  computed = callback ? callback(value, index, array) : value;
3804
4070
 
3805
- if (isLarge) {
3806
- var key = keyPrefix + computed;
3807
- var inited = cache[key]
3808
- ? !(seen = cache[key])
3809
- : (seen = cache[key] = []);
3810
- }
3811
4071
  if (isSorted
3812
4072
  ? !index || seen[seen.length - 1] !== computed
3813
- : inited || indexOf(seen, computed) < 0
4073
+ : indexOf(seen, computed) < 0
3814
4074
  ) {
3815
4075
  if (callback || isLarge) {
3816
4076
  seen.push(computed);
@@ -3818,8 +4078,14 @@
3818
4078
  result.push(value);
3819
4079
  }
3820
4080
  }
4081
+ if (isLarge) {
4082
+ releaseArray(seen.array);
4083
+ releaseObject(seen);
4084
+ } else if (callback) {
4085
+ releaseArray(seen);
4086
+ }
3821
4087
  return result;
3822
- }
4088
+ });
3823
4089
 
3824
4090
  /**
3825
4091
  * The inverse of `_.zip`, this method splits groups of elements into arrays
@@ -3837,17 +4103,11 @@
3837
4103
  */
3838
4104
  function unzip(array) {
3839
4105
  var index = -1,
3840
- length = array ? array.length : 0,
3841
- tupleLength = length ? max(pluck(array, 'length')) : 0,
3842
- result = Array(tupleLength);
4106
+ length = array ? max(pluck(array, 'length')) : 0,
4107
+ result = Array(length < 0 ? 0 : length);
3843
4108
 
3844
4109
  while (++index < length) {
3845
- var tupleIndex = -1,
3846
- tuple = array[index];
3847
-
3848
- while (++tupleIndex < tupleLength) {
3849
- (result[tupleIndex] || (result[tupleIndex] = Array(length)))[index] = tuple[tupleIndex];
3850
- }
4110
+ result[index] = pluck(array, index);
3851
4111
  }
3852
4112
  return result;
3853
4113
  }
@@ -3888,14 +4148,7 @@
3888
4148
  * // => [['moe', 30, true], ['larry', 40, false]]
3889
4149
  */
3890
4150
  function zip(array) {
3891
- var index = -1,
3892
- length = array ? max(pluck(arguments, 'length')) : 0,
3893
- result = Array(length);
3894
-
3895
- while (++index < length) {
3896
- result[index] = pluck(arguments, index);
3897
- }
3898
- return result;
4151
+ return array ? unzip(arguments) : [];
3899
4152
  }
3900
4153
 
3901
4154
  /**
@@ -4171,27 +4424,27 @@
4171
4424
  return result;
4172
4425
  };
4173
4426
  }
4174
- if (typeof thisArg != 'undefined') {
4175
- if (argCount === 1) {
4176
- return function(value) {
4177
- return func.call(thisArg, value);
4178
- };
4179
- }
4180
- if (argCount === 2) {
4181
- return function(a, b) {
4182
- return func.call(thisArg, a, b);
4183
- };
4184
- }
4185
- if (argCount === 4) {
4186
- return function(accumulator, value, index, collection) {
4187
- return func.call(thisArg, accumulator, value, index, collection);
4188
- };
4189
- }
4190
- return function(value, index, collection) {
4191
- return func.call(thisArg, value, index, collection);
4427
+ if (typeof thisArg == 'undefined' || (reThis && !reThis.test(fnToString.call(func)))) {
4428
+ return func;
4429
+ }
4430
+ if (argCount === 1) {
4431
+ return function(value) {
4432
+ return func.call(thisArg, value);
4433
+ };
4434
+ }
4435
+ if (argCount === 2) {
4436
+ return function(a, b) {
4437
+ return func.call(thisArg, a, b);
4192
4438
  };
4193
4439
  }
4194
- return func;
4440
+ if (argCount === 4) {
4441
+ return function(accumulator, value, index, collection) {
4442
+ return func.call(thisArg, accumulator, value, index, collection);
4443
+ };
4444
+ }
4445
+ return function(value, index, collection) {
4446
+ return func.call(thisArg, value, index, collection);
4447
+ };
4195
4448
  }
4196
4449
 
4197
4450
  /**
@@ -4212,6 +4465,7 @@
4212
4465
  * @param {Number} wait The number of milliseconds to delay.
4213
4466
  * @param {Object} options The options object.
4214
4467
  * [leading=false] A boolean to specify execution on the leading edge of the timeout.
4468
+ * [maxWait] The maximum time `func` is allowed to be delayed before it's called.
4215
4469
  * [trailing=true] A boolean to specify execution on the trailing edge of the timeout.
4216
4470
  * @returns {Function} Returns the new debounced function.
4217
4471
  * @example
@@ -4226,34 +4480,80 @@
4226
4480
  */
4227
4481
  function debounce(func, wait, options) {
4228
4482
  var args,
4229
- inited,
4230
4483
  result,
4231
4484
  thisArg,
4232
- timeoutId,
4485
+ callCount = 0,
4486
+ lastCalled = 0,
4487
+ maxWait = false,
4488
+ maxTimeoutId = null,
4489
+ timeoutId = null,
4233
4490
  trailing = true;
4234
4491
 
4492
+ function clear() {
4493
+ clearTimeout(maxTimeoutId);
4494
+ clearTimeout(timeoutId);
4495
+ callCount = 0;
4496
+ maxTimeoutId = timeoutId = null;
4497
+ }
4498
+
4235
4499
  function delayed() {
4236
- inited = timeoutId = null;
4237
- if (trailing) {
4500
+ var isCalled = trailing && (!leading || callCount > 1);
4501
+ clear();
4502
+ if (isCalled) {
4503
+ if (maxWait !== false) {
4504
+ lastCalled = new Date;
4505
+ }
4238
4506
  result = func.apply(thisArg, args);
4239
4507
  }
4240
4508
  }
4509
+
4510
+ function maxDelayed() {
4511
+ clear();
4512
+ if (trailing || (maxWait !== wait)) {
4513
+ lastCalled = new Date;
4514
+ result = func.apply(thisArg, args);
4515
+ }
4516
+ }
4517
+
4518
+ wait = nativeMax(0, wait || 0);
4241
4519
  if (options === true) {
4242
4520
  var leading = true;
4243
4521
  trailing = false;
4244
- } else if (options && objectTypes[typeof options]) {
4522
+ } else if (isObject(options)) {
4245
4523
  leading = options.leading;
4524
+ maxWait = 'maxWait' in options && nativeMax(wait, options.maxWait || 0);
4246
4525
  trailing = 'trailing' in options ? options.trailing : trailing;
4247
4526
  }
4248
4527
  return function() {
4249
4528
  args = arguments;
4250
4529
  thisArg = this;
4530
+ callCount++;
4531
+
4532
+ // avoid issues with Titanium and `undefined` timeout ids
4533
+ // https://github.com/appcelerator/titanium_mobile/blob/3_1_0_GA/android/titanium/src/java/ti/modules/titanium/TitaniumModule.java#L185-L192
4251
4534
  clearTimeout(timeoutId);
4252
4535
 
4253
- if (!inited && leading) {
4254
- inited = true;
4255
- result = func.apply(thisArg, args);
4536
+ if (maxWait === false) {
4537
+ if (leading && callCount < 2) {
4538
+ result = func.apply(thisArg, args);
4539
+ }
4256
4540
  } else {
4541
+ var now = new Date;
4542
+ if (!maxTimeoutId && !leading) {
4543
+ lastCalled = now;
4544
+ }
4545
+ var remaining = maxWait - (now - lastCalled);
4546
+ if (remaining <= 0) {
4547
+ clearTimeout(maxTimeoutId);
4548
+ maxTimeoutId = null;
4549
+ lastCalled = now;
4550
+ result = func.apply(thisArg, args);
4551
+ }
4552
+ else if (!maxTimeoutId) {
4553
+ maxTimeoutId = setTimeout(maxDelayed, remaining);
4554
+ }
4555
+ }
4556
+ if (wait !== maxWait) {
4257
4557
  timeoutId = setTimeout(delayed, wait);
4258
4558
  }
4259
4559
  return result;
@@ -4311,7 +4611,8 @@
4311
4611
  * passed, it will be used to determine the cache key for storing the result
4312
4612
  * based on the arguments passed to the memoized function. By default, the first
4313
4613
  * argument passed to the memoized function is used as the cache key. The `func`
4314
- * is executed with the `this` binding of the memoized function.
4614
+ * is executed with the `this` binding of the memoized function. The result
4615
+ * cache is exposed as the `cache` property on the memoized function.
4315
4616
  *
4316
4617
  * @static
4317
4618
  * @memberOf _
@@ -4326,13 +4627,16 @@
4326
4627
  * });
4327
4628
  */
4328
4629
  function memoize(func, resolver) {
4329
- var cache = {};
4330
- return function() {
4331
- var key = keyPrefix + (resolver ? resolver.apply(this, arguments) : arguments[0]);
4630
+ function memoized() {
4631
+ var cache = memoized.cache,
4632
+ key = keyPrefix + (resolver ? resolver.apply(this, arguments) : arguments[0]);
4633
+
4332
4634
  return hasOwnProperty.call(cache, key)
4333
4635
  ? cache[key]
4334
4636
  : (cache[key] = func.apply(this, arguments));
4335
- };
4637
+ }
4638
+ memoized.cache = {};
4639
+ return memoized;
4336
4640
  }
4337
4641
 
4338
4642
  /**
@@ -4452,47 +4756,23 @@
4452
4756
  * }));
4453
4757
  */
4454
4758
  function throttle(func, wait, options) {
4455
- var args,
4456
- result,
4457
- thisArg,
4458
- timeoutId,
4459
- lastCalled = 0,
4460
- leading = true,
4759
+ var leading = true,
4461
4760
  trailing = true;
4462
4761
 
4463
- function trailingCall() {
4464
- timeoutId = null;
4465
- if (trailing) {
4466
- lastCalled = new Date;
4467
- result = func.apply(thisArg, args);
4468
- }
4469
- }
4470
4762
  if (options === false) {
4471
4763
  leading = false;
4472
- } else if (options && objectTypes[typeof options]) {
4764
+ } else if (isObject(options)) {
4473
4765
  leading = 'leading' in options ? options.leading : leading;
4474
4766
  trailing = 'trailing' in options ? options.trailing : trailing;
4475
4767
  }
4476
- return function() {
4477
- var now = new Date;
4478
- if (!timeoutId && !leading) {
4479
- lastCalled = now;
4480
- }
4481
- var remaining = wait - (now - lastCalled);
4482
- args = arguments;
4483
- thisArg = this;
4768
+ options = getObject();
4769
+ options.leading = leading;
4770
+ options.maxWait = wait;
4771
+ options.trailing = trailing;
4484
4772
 
4485
- if (remaining <= 0) {
4486
- clearTimeout(timeoutId);
4487
- timeoutId = null;
4488
- lastCalled = now;
4489
- result = func.apply(thisArg, args);
4490
- }
4491
- else if (!timeoutId) {
4492
- timeoutId = setTimeout(trailingCall, remaining);
4493
- }
4494
- return result;
4495
- };
4773
+ var result = debounce(func, wait, options);
4774
+ releaseObject(options);
4775
+ return result;
4496
4776
  }
4497
4777
 
4498
4778
  /**
@@ -4545,7 +4825,7 @@
4545
4825
  }
4546
4826
 
4547
4827
  /**
4548
- * This function returns the first argument passed to it.
4828
+ * This method returns the first argument passed to it.
4549
4829
  *
4550
4830
  * @static
4551
4831
  * @memberOf _
@@ -4594,7 +4874,7 @@
4594
4874
 
4595
4875
  push.apply(args, arguments);
4596
4876
  var result = func.apply(lodash, args);
4597
- return (value && typeof value == 'object' && value == result)
4877
+ return (value && typeof value == 'object' && value === result)
4598
4878
  ? this
4599
4879
  : new lodashWrapper(result);
4600
4880
  };
@@ -4668,8 +4948,13 @@
4668
4948
  if (max == null) {
4669
4949
  max = min;
4670
4950
  min = 0;
4951
+ } else {
4952
+ max = +max || 0;
4671
4953
  }
4672
- return min + floor(nativeRandom() * ((+max || 0) - min + 1));
4954
+ var rand = nativeRandom();
4955
+ return (min % 1 || max % 1)
4956
+ ? min + nativeMin(rand * (max - min + parseFloat('1e-' + ((rand +'').length - 1))), max)
4957
+ : min + floor(rand * (max - min + 1));
4673
4958
  }
4674
4959
 
4675
4960
  /**
@@ -5072,6 +5357,7 @@
5072
5357
  lodash.throttle = throttle;
5073
5358
  lodash.times = times;
5074
5359
  lodash.toArray = toArray;
5360
+ lodash.transform = transform;
5075
5361
  lodash.union = union;
5076
5362
  lodash.uniq = uniq;
5077
5363
  lodash.unzip = unzip;
@@ -5096,6 +5382,10 @@
5096
5382
  // add functions to `lodash.prototype`
5097
5383
  mixin(lodash);
5098
5384
 
5385
+ // add Underscore compat
5386
+ lodash.chain = lodash;
5387
+ lodash.prototype.chain = function() { return this; };
5388
+
5099
5389
  /*--------------------------------------------------------------------------*/
5100
5390
 
5101
5391
  // add functions that return unwrapped values when chaining
@@ -5147,6 +5437,7 @@
5147
5437
  lodash.all = every;
5148
5438
  lodash.any = some;
5149
5439
  lodash.detect = find;
5440
+ lodash.findWhere = find;
5150
5441
  lodash.foldl = reduce;
5151
5442
  lodash.foldr = reduceRight;
5152
5443
  lodash.include = contains;
@@ -5192,7 +5483,7 @@
5192
5483
  * @memberOf _
5193
5484
  * @type String
5194
5485
  */
5195
- lodash.VERSION = '1.2.1';
5486
+ lodash.VERSION = '1.3.1';
5196
5487
 
5197
5488
  // add "Chaining" functions to the wrapper
5198
5489
  lodash.prototype.toString = wrapperToString;