Reorganize build.js modifications and remove compilation from the lodash modern build.

Former-commit-id: af5d0500be9e11d108bf941604ce2316cbd8c4b5
This commit is contained in:
John-David Dalton
2013-04-13 11:12:01 -07:00
parent 6b920fa5e6
commit 540851ab6a
3 changed files with 330 additions and 402 deletions

397
build.js
View File

@@ -380,18 +380,6 @@
// remove `lodash.prototype` batch method assignments
source = source.replace(/(?:\s*\/\/.*)*\n( *)forOwn\(lodash, *function\(func, *methodName\)[\s\S]+?\n\1}.+/g, '');
// move `mixin(lodash)` to after the method assignments
source = source.replace(/(?:\s*\/\/.*)*\n( *)mixin\(lodash\).+/, '');
source = source.replace(getMethodAssignments(source), function(match) {
var indent = /^ *(?=lodash\.)/m.exec(match)[0];
return match + [
'',
'',
'// add functions to `lodash.prototype`',
'mixin(lodash);'
].join('\n' + indent);
});
// replace `_.mixin`
source = replaceFunction(source, 'mixin', [
'function mixin(object) {',
@@ -449,6 +437,18 @@
].join('\n' + indent);
});
// move `mixin(lodash)` to after the method assignments
source = source.replace(/(?:\s*\/\/.*)*\n( *)mixin\(lodash\).+/, '');
source = source.replace(getMethodAssignments(source), function(match) {
var indent = /^ *(?=lodash\.)/m.exec(match)[0];
return match + [
'',
'',
'// add functions to `lodash.prototype`',
'mixin(lodash);'
].join('\n' + indent);
});
return source;
}
@@ -986,9 +986,12 @@
// grab the method assignments snippet
snippet = getMethodAssignments(source);
// remove method assignment from `lodash.prototype`
// remove method assignment from `lodash.prototype`
source = source.replace(RegExp('^ *lodash\\.prototype\\.' + funcName + ' *=.+\\n', 'm'), '');
// remove pseudo private methods
source = source.replace(RegExp('^(?: *//.*\\s*)* *lodash\\._' + funcName + ' *=.+\\n', 'm'), '');
// remove assignment and aliases
var modified = getAliases(funcName).concat(funcName).reduce(function(result, otherName) {
return result.replace(RegExp('^(?: *//.*\\s*)* *lodash\\.' + otherName + ' *=.+\\n', 'm'), '');
@@ -1831,21 +1834,68 @@
source = setUseStrictOption(source, isStrict);
if (isLegacy) {
source = removeKeysOptimization(source);
source = removeSetImmediate(source);
source = removeSupportProp(source, 'fastBind');
source = replaceSupportProp(source, 'argsClass', 'false');
_.each(['getPrototypeOf', 'nativeBind', 'nativeIsArray', 'nativeKeys'], function(varName) {
source = replaceVar(source, varName, 'false');
});
_.each(['argsClass', 'fastBind'], function(propName) {
source = replaceSupportProp(source, propName, 'false');
_.each(['isIeOpera', 'isV8', 'nativeBind', 'nativeIsArray', 'nativeKeys', 'reNative'], function(varName) {
source = removeVar(source, varName);
});
source = removeKeysOptimization(source);
// remove native `Function#bind` branch in `_.bind`
source = source.replace(matchFunction(source, 'bind'), function(match) {
return match.replace(/(?:\s*\/\/.*)*\s*return support\.fastBind[^:]+:\s*/, 'return ');
});
// remove native `Array.isArray` branch in `_.isArray`
source = source.replace(matchFunction(source, 'isArray'), function(match) {
return match.replace(/nativeIsArray\s*\|\|\s*/, '');
});
// replace `_.keys` with `shimKeys`
source = source.replace(
matchFunction(source, 'keys').replace(/[\s\S]+?var keys *= */, ''),
matchFunction(source, 'shimKeys').replace(/[\s\S]+?var shimKeys *= */, '')
);
source = removeFunction(source, 'shimKeys');
// replace `_.isArguments` with fallback
source = source.replace(matchFunction(source, 'isArguments').replace(/[\s\S]+?function isArguments/, ''), function() {
var fallback = getIsArgumentsFallback(source),
body = fallback.match(/isArguments *= *function([\s\S]+? *});/)[1],
indent = getIndent(fallback);
return body.replace(RegExp('^' + indent, 'gm'), indent.slice(0, -2)) + '\n';
});
source = removeIsArgumentsFallback(source);
}
if (isModern) {
source = removeSupportArgsObject(source);
source = removeSupportSpliceObjects(source);
source = removeIsArgumentsFallback(source);
// remove `_.isPlainObject` fallback
source = source.replace(matchFunction(source, 'isPlainObject'), function(match) {
return match.replace(/!getPrototypeOf[^:]+:\s*/, '');
});
if (!isMobile) {
source = removeIsFunctionFallback(source);
}
}
if (isMobile || isUnderscore) {
source = removeKeysOptimization(source);
source = removeSetImmediate(source);
}
if (isModern || isUnderscore) {
source = removeSupportArgsClass(source);
source = removeSupportNonEnumShadows(source);
source = removeSupportEnumPrototypes(source);
source = removeSupportOwnLast(source);
@@ -1941,16 +1991,6 @@
});
}
}
if (isModern) {
// remove `_.isPlainObject` fallback
source = source.replace(matchFunction(source, 'isPlainObject'), function(match) {
return match.replace(/!getPrototypeOf[^:]+:\s*/, '');
});
if (!isMobile) {
source = removeIsFunctionFallback(source);
}
}
if (isUnderscore) {
// replace `_.assign`
source = replaceFunction(source, 'assign', [
@@ -2383,12 +2423,19 @@
'}'
].join('\n'));
// unexpose `lodash.support`
source = source.replace(/lodash\.support *= */, '');
// remove `_.templateSettings.imports assignment
source = source.replace(/,[^']*'imports':[^}]+}/, '');
// remove large array optimizations
source = removeFunction(source, 'cachedContains');
// replace `slice` with `nativeSlice.call`
source = removeFunction(source, 'slice');
source = source.replace(/([^.])\bslice\(/g, '$1nativeSlice.call(');
// remove `_.isEqual` use from `createCallback`
source = source.replace(matchFunction(source, 'createCallback'), function(match) {
return match.replace(/\bisEqual\(([^,]+), *([^,]+)[^)]+\)/, '$1 === $2');
@@ -2401,19 +2448,36 @@
});
});
// replace `slice` with `nativeSlice.call`
source = removeFunction(source, 'slice');
source = source.replace(/([^.])\bslice\(/g, '$1nativeSlice.call(');
// modify `_.every`, `_.find`, `_.isEqual`, and `_.some` to use the private `indicatorObject`
_.each(['every', 'isEqual'], function(methodName) {
source = source.replace(matchFunction(source, methodName), function(match) {
return match.replace(/\(result *= *(.+?)\);/g, '!(result = $1) && indicatorObject;');
});
});
source = source.replace(matchFunction(source, 'find'), function(match) {
return match.replace(/return false/, 'return indicatorObject');
});
source = source.replace(matchFunction(source, 'some'), function(match) {
return match.replace(/!\(result *= *(.+?)\);/, '(result = $1) && indicatorObject;');
});
// replace `lodash.createCallback` references with `createCallback`
if (!useLodashMethod('createCallback')) {
source = source.replace(/\blodash\.(createCallback\()\b/g, '$1');
}
// remove unneeded variables
if (!useLodashMethod('clone') && !useLodashMethod('cloneDeep')) {
source = removeVar(source, 'cloneableClasses');
source = removeVar(source, 'ctorByClass');
}
// remove chainability from `each` and `_.forEach`
if (!useLodashMethod('forEach')) {
_.each(['each', 'forEach'], function(methodName) {
source = source.replace(matchFunction(source, methodName), function(match) {
return match
.replace(/\n *return .+?([};\s]+)$/, '$1')
.replace(/\b(return) +result\b/, '$1')
});
});
}
// remove unused features from `createBound`
if (_.every(['bindKey', 'partial', 'partialRight'], function(methodName) {
return !_.contains(buildMethods, methodName);
@@ -2516,12 +2580,6 @@
}
});
// remove `isArguments` fallback before `isArguments` is transformed by
// other parts of the build process
if (isRemoved(source, 'isArguments')) {
source = removeIsArgumentsFallback(source);
}
// remove `iteratorTemplate` dependency checks from `_.template`
source = source.replace(matchFunction(source, 'template'), function(match) {
return match
@@ -2531,58 +2589,7 @@
/*----------------------------------------------------------------------*/
if (isLegacy) {
source = removeSetImmediate(source);
source = removeSupportProp(source, 'fastBind');
_.each(['isIeOpera', 'isV8', 'nativeBind', 'nativeIsArray', 'nativeKeys', 'reNative'], function(varName) {
source = removeVar(source, varName);
});
// remove native `Function#bind` branch in `_.bind`
source = source.replace(matchFunction(source, 'bind'), function(match) {
return match.replace(/(?:\s*\/\/.*)*\s*return support\.fastBind[^:]+:\s*/, 'return ');
});
// remove native `Array.isArray` branch in `_.isArray`
source = source.replace(matchFunction(source, 'isArray'), function(match) {
return match.replace(/nativeIsArray\s*\|\|\s*/, '');
});
// replace `_.keys` with `shimKeys`
if (!isRemoved(source, 'keys')) {
source = source.replace(
matchFunction(source, 'keys').replace(/[\s\S]+?var keys *= */, ''),
matchFunction(source, 'shimKeys').replace(/[\s\S]+?var shimKeys *= */, '')
);
source = removeFunction(source, 'shimKeys');
}
// replace `_.isArguments` with fallback
if (!isRemoved(source, 'isArguments')) {
source = source.replace(matchFunction(source, 'isArguments').replace(/[\s\S]+?function isArguments/, ''), function() {
var fallback = getIsArgumentsFallback(source),
body = fallback.match(/isArguments *= *function([\s\S]+? *});/)[1],
indent = getIndent(fallback);
return body.replace(RegExp('^' + indent, 'gm'), indent.slice(0, -2)) + '\n';
});
source = removeIsArgumentsFallback(source);
}
}
if (isModern) {
source = removeSupportArgsObject(source);
source = removeSupportSpliceObjects(source);
source = removeIsArgumentsFallback(source);
}
if (isModern || isUnderscore) {
source = removeSupportArgsClass(source);
source = removeSupportNodeClass(source);
}
if (isMobile || isUnderscore) {
source = removeVar(source, 'iteratorTemplate');
// inline all functions defined with `createIterator`
_.functions(lodash).forEach(function(methodName) {
// strip leading underscores to match pseudo private functions
@@ -2595,86 +2602,62 @@
});
}
});
}
if (isUnderscore) {
// remove `_.assign`, `_.forIn`, `_.forOwn`, `_.isPlainObject`, and `_.zipObject` assignments
(function() {
var snippet = getMethodAssignments(source),
modified = snippet;
if (!useLodashMethod('assign')) {
modified = modified.replace(/^(?: *\/\/.*\s*)* *lodash\.assign *=.+\n/m, '');
}
if (isUnderscore) {
// unexpose "exit early" feature of `each`, `_.forEach`, `_.forIn`, and `_.forOwn`
_.each(['each', 'forEach', 'forIn', 'forOwn'], function(methodName) {
if (methodName == 'each' || !useLodashMethod(methodName)) {
source = source.replace(matchFunction(source, methodName), function(match) {
return match.replace(/=== *false\)/g, '=== indicatorObject)');
});
}
});
// remove `thisArg` from unexposed `forIn` and `forOwn`
_.each(['forIn', 'forOwn'], function(methodName) {
if (!useLodashMethod(methodName)) {
source = source.replace(matchFunction(source, methodName), function(match) {
return match
.replace(/(callback), *thisArg/g, '$1')
.replace(/^ *callback *=.+\n/m, '');
});
}
});
// replace `lodash.createCallback` references with `createCallback`
if (!useLodashMethod('createCallback')) {
modified = modified.replace(/^(?: *\/\/.*\s*)* *lodash\.createCallback *=.+\n/m, '');
source = source.replace(/\blodash\.(createCallback\()\b/g, '$1');
}
if (!useLodashMethod('forIn')) {
modified = modified.replace(/^(?: *\/\/.*\s*)* *lodash\.forIn *=.+\n/m, '');
}
if (!useLodashMethod('forOwn')) {
modified = modified.replace(/^(?: *\/\/.*\s*)* *lodash\.forOwn *=.+\n/m, '');
}
if (!useLodashMethod('isPlainObject')) {
modified = modified.replace(/^(?: *\/\/.*\s*)* *lodash\.isPlainObject *=.+\n/m, '');
}
if (!useLodashMethod('zipObject')) {
modified = modified.replace(/^(?: *\/\/.*\s*)* *lodash\.zipObject *=.+\n/m, '');
}
source = source.replace(snippet, function() {
return modified;
});
}());
// remove `_.assign`, `_.forIn`, `_.forOwn`, `_.isPlainObject`, and `_.zipObject` assignments
(function() {
var snippet = getMethodAssignments(source),
modified = snippet;
// unexpose `lodash.support`
source = source.replace(/lodash\.support *= */, '');
// remove `thisArg` from unexposed `forIn` and `forOwn`
_.each(['forIn', 'forOwn'], function(methodName) {
if (!useLodashMethod(methodName)) {
source = source.replace(matchFunction(source, methodName), function(match) {
return match
.replace(/(callback), *thisArg/g, '$1')
.replace(/^ *callback *=.+\n/m, '');
if (!useLodashMethod('assign')) {
modified = modified.replace(/^(?: *\/\/.*\s*)* *lodash\.assign *=.+\n/m, '');
}
if (!useLodashMethod('createCallback')) {
modified = modified.replace(/^(?: *\/\/.*\s*)* *lodash\.createCallback *=.+\n/m, '');
}
if (!useLodashMethod('forIn')) {
modified = modified.replace(/^(?: *\/\/.*\s*)* *lodash\.forIn *=.+\n/m, '');
}
if (!useLodashMethod('forOwn')) {
modified = modified.replace(/^(?: *\/\/.*\s*)* *lodash\.forOwn *=.+\n/m, '');
}
if (!useLodashMethod('isPlainObject')) {
modified = modified.replace(/^(?: *\/\/.*\s*)* *lodash\.isPlainObject *=.+\n/m, '');
}
if (!useLodashMethod('zipObject')) {
modified = modified.replace(/^(?: *\/\/.*\s*)* *lodash\.zipObject *=.+\n/m, '');
}
source = source.replace(snippet, function() {
return modified;
});
}
});
// remove chainability from `each` and `_.forEach`
if (!useLodashMethod('forEach')) {
_.each(['each', 'forEach'], function(methodName) {
source = source.replace(matchFunction(source, methodName), function(match) {
return match
.replace(/\n *return .+?([};\s]+)$/, '$1')
.replace(/\b(return) +result\b/, '$1')
});
});
}());
}
// unexpose "exit early" feature of `each`, `_.forEach`, `_.forIn`, and `_.forOwn`
_.each(['each', 'forEach', 'forIn', 'forOwn'], function(methodName) {
if (methodName == 'each' || !useLodashMethod(methodName)) {
source = source.replace(matchFunction(source, methodName), function(match) {
return match.replace(/=== *false\)/g, '=== indicatorObject)');
});
}
});
// modify `_.every`, `_.find`, `_.isEqual`, and `_.some` to use the private `indicatorObject`
_.each(['every', 'isEqual'], function(methodName) {
source = source.replace(matchFunction(source, methodName), function(match) {
return match.replace(/\(result *= *(.+?)\);/g, '!(result = $1) && indicatorObject;');
});
});
source = source.replace(matchFunction(source, 'find'), function(match) {
return match.replace(/return false/, 'return indicatorObject');
});
source = source.replace(matchFunction(source, 'some'), function(match) {
return match.replace(/!\(result *= *(.+?)\);/, '(result = $1) && indicatorObject;');
});
}
if (!(isMobile || isUnderscore)) {
else {
source = removeFromCreateIterator(source, 'support');
// inline `iteratorTemplate` template
@@ -2756,17 +2739,52 @@
/*------------------------------------------------------------------------*/
// modify/remove references to removed methods/variables
if (!isTemplate) {
// modify/remove references to removed methods/variables
if (isRemoved(source, 'clone')) {
source = removeVar(source, 'cloneableClasses');
source = removeVar(source, 'ctorByClass');
}
if (isRemoved(source, 'clone', 'isEqual', 'isPlainObject')) {
source = removeSupportNodeClass(source);
}
if (isRemoved(source, 'createIterator', 'bind', 'keys')) {
source = removeSupportProp(source, 'fastBind');
source = removeVar(source, 'isV8');
source = removeVar(source, 'nativeBind');
}
if (isRemoved(source, 'createIterator', 'keys')) {
source = removeVar(source, 'nativeKeys');
source = removeKeysOptimization(source);
source = removeSupportNonEnumArgs(source);
}
if (isRemoved(source, 'defer')) {
source = removeSetImmediate(source);
}
if (isRemoved(source, 'invert')) {
source = replaceVar(source, 'htmlUnescapes', "{'&amp;':'&','&lt;':'<','&gt;':'>','&quot;':'\"','&#x27;':\"'\"}");
}
if (isRemoved(source, 'isArguments')) {
source = removeIsArgumentsFallback(source);
source = replaceSupportProp(source, 'argsClass', 'true');
}
if (isRemoved(source, 'isArguments', 'isEmpty')) {
source = removeSupportArgsClass(source);
}
if (isRemoved(source, 'isArray')) {
source = removeVar(source, 'nativeIsArray');
}
if (isRemoved(source, 'isFunction')) {
source = removeIsFunctionFallback(source);
}
if (isRemoved(source, 'isPlainObject')) {
source = removeFunction(source, 'shimIsPlainObject');
source = removeVar(source, 'getPrototypeOf');
source = removeSupportOwnLast(source);
}
if (isRemoved(source, 'keys')) {
source = removeFunction(source, 'shimKeys');
}
if (isRemoved(source, 'mixin')) {
// inline `_.mixin` call to ensure proper chaining behavior
source = source.replace(/^( *)mixin\(lodash\).+/m, function(match, indent) {
@@ -2788,6 +2806,14 @@
].join('\n' + indent);
});
}
if (isRemoved(source, 'parseInt')) {
source = removeVar(source, 'nativeParseInt');
source = removeVar(source, 'reLeadingZeros');
}
if (isRemoved(source, 'template')) {
// remove `templateSettings` assignment
source = source.replace(/(?:\n +\/\*[^*]*\*+(?:[^\/][^*]*\*+)*\/)?\n *lodash\.templateSettings[\s\S]+?};\n/, '');
}
if (isRemoved(source, 'value')) {
source = removeFunction(source, 'wrapperToString');
source = removeFunction(source, 'wrapperValueOf');
@@ -2816,39 +2842,6 @@
.replace(/(?:\s*\/\/.*)*\n( *)(?:each|forEach)\(\['[\s\S]+?\n\1}.+/g, '')
.replace(/(?:\s*\/\/.*)*\n *lodash\.prototype.+/g, '');
}
// remove functions, variables, and snippets that the minifier may miss
if (isRemoved(source, 'clone')) {
source = removeVar(source, 'cloneableClasses');
source = removeVar(source, 'ctorByClass');
}
if (isRemoved(source, 'defer')) {
source = removeSetImmediate(source);
}
if (isRemoved(source, 'isArray')) {
source = removeVar(source, 'nativeIsArray');
}
if (isRemoved(source, 'isPlainObject')) {
source = removeFunction(source, 'shimIsPlainObject');
source = removeVar(source, 'getPrototypeOf');
source = removeSupportOwnLast(source);
}
if (isRemoved(source, 'keys')) {
source = removeFunction(source, 'shimKeys');
}
if (isRemoved(source, 'parseInt')) {
source = removeVar(source, 'nativeParseInt');
source = removeVar(source, 'reLeadingZeros');
}
if (isRemoved(source, 'template')) {
// remove `templateSettings` assignment
source = source.replace(/(?:\n +\/\*[^*]*\*+(?:[^\/][^*]*\*+)*\/)?\n *lodash\.templateSettings[\s\S]+?};\n/, '');
}
if (isRemoved(source, 'isArguments', 'isEmpty')) {
source = removeSupportArgsClass(source);
}
if (isRemoved(source, 'clone', 'isEqual', 'isPlainObject')) {
source = removeSupportNodeClass(source);
}
if (!/\beach\(/.test(source)) {
source = source.replace(matchFunction(source, 'each'), '');
}
@@ -2862,16 +2855,6 @@
source = removeSupportNonEnumShadows(source);
source = removeSupportEnumPrototypes(source);
}
if (isRemoved(source, 'createIterator', 'bind', 'keys')) {
source = removeSupportProp(source, 'fastBind');
source = removeVar(source, 'isV8');
source = removeVar(source, 'nativeBind');
}
if (isRemoved(source, 'createIterator', 'keys')) {
source = removeVar(source, 'nativeKeys');
source = removeKeysOptimization(source);
source = removeSupportNonEnumArgs(source);
}
if (!/support\.(?:enumPrototypes|nonEnumShadows|ownLast)\b/.test(source)) {
// remove code used to resolve unneeded `support` properties
source = source.replace(/^ *\(function[\s\S]+?\n(( *)var ctor *= *function[\s\S]+?(?:\n *for.+)+\n)([\s\S]+?)}\(1\)\);\n/m, function(match, setup, indent, body) {

260
dist/lodash.js vendored
View File

@@ -349,92 +349,6 @@
/*--------------------------------------------------------------------------*/
/**
* The template used to create iterator functions.
*
* @private
* @param {Object} data The data object used to populate the text.
* @returns {String} Returns the interpolated text.
*/
var iteratorTemplate = function(obj) {
var __p = 'var index, iterable = ' +
(obj.firstArg) +
', result = ' +
(obj.init) +
';\nif (!iterable) return result;\n' +
(obj.top) +
';\n';
if (obj.arrays) {
__p += 'var length = iterable.length; index = -1;\nif (' +
(obj.arrays) +
') {\n while (++index < length) {\n ' +
(obj.loop) +
'\n }\n}\nelse { ';
}
if (obj.useHas && obj.useKeys) {
__p += '\n var ownIndex = -1,\n ownProps = objectTypes[typeof iterable] ? keys(iterable) : [],\n length = ownProps.length;\n\n while (++ownIndex < length) {\n index = ownProps[ownIndex];\n ' +
(obj.loop) +
'\n } ';
} else {
__p += '\n for (index in iterable) {';
if (obj.useHas) {
__p += '\n if (';
if (obj.useHas) {
__p += 'hasOwnProperty.call(iterable, index)';
}
__p += ') { ';
}
__p +=
(obj.loop) +
'; ';
if (obj.useHas) {
__p += '\n }';
}
__p += '\n } ';
}
if (obj.arrays) {
__p += '\n}';
}
__p +=
(obj.bottom) +
';\nreturn result';
return __p
};
/** Reusable iterator options for `assign` and `defaults` */
var defaultsIteratorOptions = {
'args': 'object, source, guard',
'top':
'var args = arguments,\n' +
' argsIndex = 0,\n' +
" argsLength = typeof guard == 'number' ? 2 : args.length;\n" +
'while (++argsIndex < argsLength) {\n' +
' iterable = args[argsIndex];\n' +
' if (iterable && objectTypes[typeof iterable]) {',
'loop': "if (typeof result[index] == 'undefined') result[index] = iterable[index]",
'bottom': ' }\n}'
};
/** Reusable iterator options shared by `each`, `forIn`, and `forOwn` */
var eachIteratorOptions = {
'args': 'collection, callback, thisArg',
'top': "callback = callback && typeof thisArg == 'undefined' ? callback : lodash.createCallback(callback, thisArg)",
'arrays': false,
'loop': 'if (callback(iterable[index], index, collection) === false) return result'
};
/** Reusable iterator options for `forIn` and `forOwn` */
var forOwnIteratorOptions = {
'top': 'if (!objectTypes[typeof iterable]) return result;\n' + eachIteratorOptions.top,
'arrays': false
};
/*--------------------------------------------------------------------------*/
/**
* Creates a function optimized to search large arrays for a given `value`,
* starting at `fromIndex`, using strict equality for comparisons, i.e. `===`.
@@ -567,54 +481,6 @@
return bound;
}
/**
* Creates compiled iteration functions.
*
* @private
* @param {Object} [options1, options2, ...] The compile options object(s).
* arrays - A string of code to determine if the iterable is an array or array-like.
* useHas - A boolean to specify using `hasOwnProperty` checks in the object loop.
* useKeys - A boolean to specify using `_.keys` for own property iteration.
* args - A string of comma separated arguments the iteration function will accept.
* top - A string of code to execute before the iteration branches.
* loop - A string of code to execute in the object loop.
* bottom - A string of code to execute after the iteration branches.
* @returns {Function} Returns the compiled function.
*/
function createIterator() {
var data = {
// iterator options
'arrays': 'isArray(iterable)',
'bottom': '',
'init': 'iterable',
'loop': '',
'top': '',
'useHas': true,
'useKeys': !!keys
};
// merge options into a template data object
for (var object, index = 0; object = arguments[index]; index++) {
for (var key in object) {
data[key] = object[key];
}
}
var args = data.args;
data.firstArg = /^[^,]+/.exec(args)[0];
// create the function factory
var factory = Function(
'hasOwnProperty, isArguments, isArray, isString, keys, ' +
'lodash, objectTypes',
'return function(' + args + ') {\n' + iteratorTemplate(data) + '\n}'
);
// return the compiled function
return factory(
hasOwnProperty, isArguments, isArray, isString, keys,
lodash, objectTypes
);
}
/**
* Used by `template` to escape characters for inclusion in compiled
* string literals.
@@ -783,13 +649,18 @@
* @param {Object} object The object to inspect.
* @returns {Array} Returns a new array of property names.
*/
var shimKeys = createIterator({
'args': 'object',
'init': '[]',
'top': 'if (!(objectTypes[typeof object])) return result',
'loop': 'result.push(index)',
'arrays': false
});
var shimKeys = function (object) {
var index, iterable = object, result = [];
if (!iterable) return result;
if (!(objectTypes[typeof object])) return result;
for (index in iterable) {
if (hasOwnProperty.call(iterable, index)) {
result.push(index);
}
}
return result
};
/**
* Creates an array composed of the own enumerable property names of `object`.
@@ -862,18 +733,40 @@
* defaults(food, { 'name': 'banana', 'type': 'fruit' });
* // => { 'name': 'apple', 'type': 'fruit' }
*/
var assign = createIterator(defaultsIteratorOptions, {
'top':
defaultsIteratorOptions.top.replace(';',
';\n' +
"if (argsLength > 3 && typeof args[argsLength - 2] == 'function') {\n" +
' var callback = lodash.createCallback(args[--argsLength - 1], args[argsLength--], 2);\n' +
"} else if (argsLength > 2 && typeof args[argsLength - 1] == 'function') {\n" +
' callback = args[--argsLength];\n' +
'}'
),
'loop': 'result[index] = callback ? callback(result[index], iterable[index]) : iterable[index]'
});
var assign = function (object, source, guard) {
var index, iterable = object, result = iterable;
if (!iterable) return result;
var args = arguments,
argsIndex = 0,
argsLength = typeof guard == 'number' ? 2 : args.length;
if (argsLength > 3 && typeof args[argsLength - 2] == 'function') {
var callback = lodash.createCallback(args[--argsLength - 1], args[argsLength--], 2);
} else if (argsLength > 2 && typeof args[argsLength - 1] == 'function') {
callback = args[--argsLength];
}
while (++argsIndex < argsLength) {
iterable = args[argsIndex];
if (iterable && objectTypes[typeof iterable]) {;
var length = iterable.length; index = -1;
if (isArray(iterable)) {
while (++index < length) {
result[index] = callback ? callback(result[index], iterable[index]) : iterable[index]
}
}
else {
var ownIndex = -1,
ownProps = objectTypes[typeof iterable] ? keys(iterable) : [],
length = ownProps.length;
while (++ownIndex < length) {
index = ownProps[ownIndex];
result[index] = callback ? callback(result[index], iterable[index]) : iterable[index]
}
}
}
};
return result
};
/**
* Creates a clone of `value`. If `deep` is `true`, nested objects will also
@@ -1066,7 +959,35 @@
* _.defaults(food, { 'name': 'banana', 'type': 'fruit' });
* // => { 'name': 'apple', 'type': 'fruit' }
*/
var defaults = createIterator(defaultsIteratorOptions);
var defaults = function (object, source, guard) {
var index, iterable = object, result = iterable;
if (!iterable) return result;
var args = arguments,
argsIndex = 0,
argsLength = typeof guard == 'number' ? 2 : args.length;
while (++argsIndex < argsLength) {
iterable = args[argsIndex];
if (iterable && objectTypes[typeof iterable]) {;
var length = iterable.length; index = -1;
if (isArray(iterable)) {
while (++index < length) {
if (typeof result[index] == 'undefined') result[index] = iterable[index]
}
}
else {
var ownIndex = -1,
ownProps = objectTypes[typeof iterable] ? keys(iterable) : [],
length = ownProps.length;
while (++ownIndex < length) {
index = ownProps[ownIndex];
if (typeof result[index] == 'undefined') result[index] = iterable[index]
}
}
}
};
return result
};
/**
* This method is similar to `_.find`, except that it returns the key of the
@@ -1129,9 +1050,17 @@
* });
* // => alerts 'name' and 'bark' (order is not guaranteed)
*/
var forIn = createIterator(eachIteratorOptions, forOwnIteratorOptions, {
'useHas': false
});
var forIn = function (collection, callback, thisArg) {
var index, iterable = collection, result = iterable;
if (!iterable) return result;
if (!objectTypes[typeof iterable]) return result;
callback = callback && typeof thisArg == 'undefined' ? callback : lodash.createCallback(callback, thisArg);
for (index in iterable) {
if (callback(iterable[index], index, collection) === false) return result;
}
return result
};
/**
* Iterates over an object's own enumerable properties, executing the `callback`
@@ -1154,7 +1083,22 @@
* });
* // => alerts '0', '1', and 'length' (order is not guaranteed)
*/
var forOwn = createIterator(eachIteratorOptions, forOwnIteratorOptions);
var forOwn = function (collection, callback, thisArg) {
var index, iterable = collection, result = iterable;
if (!iterable) return result;
if (!objectTypes[typeof iterable]) return result;
callback = callback && typeof thisArg == 'undefined' ? callback : lodash.createCallback(callback, thisArg);
var ownIndex = -1,
ownProps = objectTypes[typeof iterable] ? keys(iterable) : [],
length = ownProps.length;
while (++ownIndex < length) {
index = ownProps[ownIndex];
if (callback(iterable[index], index, collection) === false) return result
}
return result
};
/**
* Creates a sorted array of all enumerable properties, own and inherited,

75
dist/lodash.min.js vendored
View File

@@ -4,40 +4,41 @@
* Build: `lodash modern -o ./dist/lodash.js`
* Underscore.js 1.4.4 underscorejs.org/LICENSE
*/
;(function(n){function t(r){function a(n){return n&&typeof n=="object"&&!ge(n)&&Ht.call(n,"__wrapped__")?n:new K(n)}function B(n){var t=n.length,e=t>=c;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<mt(r[u],t)}return-1<mt(n,t)}}function F(n){return n.charCodeAt(0)}function R(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 T(n,t,e,r){function u(){var r=arguments,c=i?this:t;
return a||(n=t[o]),e.length&&(r=r.length?(r=ie.call(r),f?r.concat(e):e.concat(r)):e),this instanceof u?(M.prototype=n.prototype,c=new M,M.prototype=null,r=n.apply(c,r),Y(r)?r:c):n.apply(c,r)}var a=X(n),i=!e,o=t;if(i){var f=r;e=t}else if(!a){if(!r)throw new Rt;t=n}return u}function D(){for(var n,t={b:"k(m)",c:"",e:"m",f:"",h:"",i:!0,j:!!ye},e=0;n=arguments[e];e++)for(var r in n)t[r]=n[r];return n=t.a,t.d=/^[^,]+/.exec(n)[0],e=St,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+"){while(++i<n){"+t.f+"}}else{"),t.i&&t.j?r+="var s=-1,t=r[typeof m]?o(m):[],n=t.length;while(++s<n){i=t[s];"+t.f+"}":(r+="for(i in m){",t.i&&(r+="if(",t.i&&(r+="h.call(m,i)"),r+="){"),r+=t.f+";",t.i&&(r+="}"),r+="}"),t.b&&(r+="}"),r+=t.c+";return u",e("h,j,k,l,o,p,r","return function("+n+"){"+r+"}")(Ht,H,ge,nt,ye,a,A)
}function z(n){return"\\"+$[n]}function P(n){return me[n]}function K(n){this.__wrapped__=n}function M(){}function U(n){var t=!1;if(!n||Wt.call(n)!=N)return t;var e=n.constructor;return(X(e)?e instanceof e:le.nodeClass||!isNode(n))?(ke(n,function(n,e){t=e}),!1===t||Ht.call(n,t)):t}function V(n,t,e){t||(t=0),typeof e=="undefined"&&(e=n?n.length:0);var r=-1;e=e-t||0;for(var u=Nt(0>e?0:e);++r<e;)u[r]=n[t+r];return u}function G(n){return be[n]}function H(n){return Wt.call(n)==w}function J(n,t,r,u,i,o){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=Y(f)){var c=Wt.call(f);if(!S[c])return f;var l=ge(f)}if(!u||!t)return u?l?V(f):de({},f):f;switch(u=ce[c],c){case C:case x:return new u(+f);case O:case I:return new u(f);case E:return u(f.source,h.exec(f))}for(i||(i=[]),o||(o=[]),c=i.length;c--;)if(i[c]==n)return o[c];return f=l?u(f.length):{},l&&(Ht.call(n,"index")&&(f.index=n.index),Ht.call(n,"input")&&(f.input=n.input)),i.push(n),o.push(f),(l?ot:we)(n,function(n,u){f[u]=J(n,t,r,e,i,o)
}),f}function L(n){var t=[];return ke(n,function(n,e){X(n)&&t.push(e)}),t.sort()}function Q(n){for(var t=-1,e=ye(n),r=e.length,u={};++t<r;){var a=e[t];u[n[a]]=a}return u}function W(n,t,e,r,u,i){var f=e===o;if(typeof e=="function"&&!f){e=a.createCallback(e,r,2);var c=e(n,t);if(typeof c!="undefined")return!!c}if(n===t)return 0!==n||1/n==1/t;var l=typeof n,p=typeof t;if(n===n&&(!n||"function"!=l&&"object"!=l)&&(!t||"function"!=p&&"object"!=p))return!1;if(null==n||null==t)return n===t;if(p=Wt.call(n),l=Wt.call(t),p==w&&(p=N),l==w&&(l=N),p!=l)return!1;
switch(p){case C:case x:return+n==+t;case O:return n!=+n?t!=+t:0==n?1/n==1/t:n==+t;case E:case I:return n==Ft(t)}if(l=p==j,!l){if(Ht.call(n,"__wrapped__")||Ht.call(t,"__wrapped__"))return W(n.__wrapped__||n,t.__wrapped__||t,e,r,u,i);if(p!=N)return!1;var p=n.constructor,s=t.constructor;if(p!=s&&(!X(p)||!(p instanceof p&&X(s)&&s instanceof s)))return!1}for(u||(u=[]),i||(i=[]),p=u.length;p--;)if(u[p]==n)return i[p]==t;var v=0,c=!0;if(u.push(n),i.push(t),l){if(p=n.length,v=t.length,c=v==n.length,!c&&!f)return c;
for(;v--;)if(l=p,s=t[v],f)for(;l--&&!(c=W(n[l],s,e,r,u,i)););else if(!(c=W(n[v],s,e,r,u,i)))break;return c}return ke(t,function(t,a,o){return Ht.call(o,a)?(v++,c=Ht.call(n,a)&&W(n[a],t,e,r,u,i)):void 0}),c&&!f&&ke(n,function(n,t,e){return Ht.call(e,t)?c=-1<--v:void 0}),c}function X(n){return typeof n=="function"}function Y(n){return n?A[typeof n]:!1}function Z(n){return typeof n=="number"||Wt.call(n)==O}function nt(n){return typeof n=="string"||Wt.call(n)==I}function tt(n,t,e){var r=arguments,u=0,i=2;
if(!Y(n))return n;if(e===o)var f=r[3],c=r[4],l=r[5];else c=[],l=[],typeof e!="number"&&(i=r.length),3<i&&"function"==typeof r[i-2]?f=a.createCallback(r[--i-1],r[i--],2):2<i&&"function"==typeof r[i-1]&&(f=r[--i]);for(;++u<i;)(ge(r[u])?ot:we)(r[u],function(t,e){var r,u,a=t,i=n[e];if(t&&((u=ge(t))||je(t))){for(a=c.length;a--;)if(r=c[a]==t){i=l[a];break}if(!r){var p;f&&(a=f(i,t),p=typeof a!="undefined")&&(i=a),p||(i=u?ge(i)?i:[]:je(i)?i:{}),c.push(t),l.push(i),p||(i=tt(i,t,o,f,c,l))}}else f&&(a=f(i,t),typeof a=="undefined"&&(a=t)),typeof a!="undefined"&&(i=a);
n[e]=i});return n}function et(n){for(var t=-1,e=ye(n),r=e.length,u=Nt(r);++t<r;)u[t]=n[e[t]];return u}function rt(n,t,e){var r=-1,u=n?n.length:0,a=!1;return e=(0>e?ee(0,u+e):e)||0,typeof u=="number"?a=-1<(nt(n)?n.indexOf(t,e):mt(n,t,e)):we(n,function(n){return++r<e?void 0:!(a=n===t)}),a}function ut(n,t,e){var r=!0;t=a.createCallback(t,e),e=-1;var u=n?n.length:0;if(typeof u=="number")for(;++e<u&&(r=!!t(n[e],e,n)););else we(n,function(n,e,u){return r=!!t(n,e,u)});return r}function at(n,t,e){var r=[];
t=a.createCallback(t,e),e=-1;var u=n?n.length:0;if(typeof u=="number")for(;++e<u;){var i=n[e];t(i,e,n)&&r.push(i)}else we(n,function(n,e,u){t(n,e,u)&&r.push(n)});return r}function it(n,t,e){t=a.createCallback(t,e),e=-1;var r=n?n.length:0;if(typeof r!="number"){var u;return we(n,function(n,e,r){return t(n,e,r)?(u=n,!1):void 0}),u}for(;++e<r;){var i=n[e];if(t(i,e,n))return i}}function ot(n,t,e){var r=-1,u=n?n.length:0;if(t=t&&typeof e=="undefined"?t:a.createCallback(t,e),typeof u=="number")for(;++r<u&&!1!==t(n[r],r,n););else we(n,t);
return n}function ft(n,t,e){var r=-1,u=n?n.length:0;if(t=a.createCallback(t,e),typeof u=="number")for(var i=Nt(u);++r<u;)i[r]=t(n[r],r,n);else i=[],we(n,function(n,e,u){i[++r]=t(n,e,u)});return i}function ct(n,t,e){var r=-1/0,u=r;if(!t&&ge(n)){e=-1;for(var i=n.length;++e<i;){var o=n[e];o>u&&(u=o)}}else t=!t&&nt(n)?F:a.createCallback(t,e),ot(n,function(n,e,a){e=t(n,e,a),e>r&&(r=e,u=n)});return u}function lt(n,t){var e=-1,r=n?n.length:0;if(typeof r=="number")for(var u=Nt(r);++e<r;)u[e]=n[e][t];return u||ft(n,t)
}function pt(n,t,e,r){if(!n)return e;var u=3>arguments.length;t=a.createCallback(t,r,4);var i=-1,o=n.length;if(typeof o=="number")for(u&&(e=n[++i]);++i<o;)e=t(e,n[i],i,n);else we(n,function(n,r,a){e=u?(u=!1,n):t(e,n,r,a)});return e}function st(n,t,e,r){var u=n?n.length:0,i=3>arguments.length;if(typeof u!="number")var o=ye(n),u=o.length;return t=a.createCallback(t,r,4),ot(n,function(r,a,f){a=o?o[--u]:--u,e=i?(i=!1,n[a]):t(e,n[a],a,f)}),e}function vt(n,t,e){var r;t=a.createCallback(t,e),e=-1;var u=n?n.length:0;
if(typeof u=="number")for(;++e<u&&!(r=t(n[e],e,n)););else we(n,function(n,e,u){return!(r=t(n,e,u))});return!!r}function gt(n){for(var t=-1,e=n?n.length:0,r=Ut.apply(Tt,ie.call(arguments,1)),r=B(r),u=[];++t<e;){var a=n[t];r(a)||u.push(a)}return u}function ht(n,t,e){if(n){var r=0,u=n.length;if(typeof t!="number"&&null!=t){var i=-1;for(t=a.createCallback(t,e);++i<u&&t(n[i],i,n);)r++}else if(r=t,null==r||e)return n[0];return V(n,0,re(ee(0,r),u))}}function yt(n,t,e,r){var u=-1,i=n?n.length:0,o=[];for(typeof t!="boolean"&&null!=t&&(r=e,e=t,t=!1),null!=e&&(e=a.createCallback(e,r));++u<i;)r=n[u],e&&(r=e(r,u,n)),ge(r)?Jt.apply(o,t?r:yt(r)):o.push(r);
return o}function mt(n,t,e){var r=-1,u=n?n.length:0;if(typeof e=="number")r=(0>e?ee(0,u+e):e||0)-1;else if(e)return r=dt(n,t),n[r]===t?r:-1;for(;++r<u;)if(n[r]===t)return r;return-1}function bt(n,t,e){if(typeof t!="number"&&null!=t){var r=0,u=-1,i=n?n.length:0;for(t=a.createCallback(t,e);++u<i&&t(n[u],u,n);)r++}else r=null==t||e?1:ee(0,t);return V(n,r)}function dt(n,t,e,r){var u=0,i=n?n.length:u;for(e=e?a.createCallback(e,r,1):Ct,t=e(t);u<i;)r=u+i>>>1,e(n[r])<t?u=r+1:i=r;return u}function _t(n,t,e,r){var u=-1,i=n?n.length:0,o=[],l=o;
typeof t!="boolean"&&null!=t&&(r=e,e=t,t=!1);var p=!t&&i>=c;if(p)var s={};for(null!=e&&(l=[],e=a.createCallback(e,r));++u<i;){r=n[u];var v=e?e(r,u,n):r;if(p)var g=f+v,g=s[g]?!(l=s[g]):l=s[g]=[];(t?!u||l[l.length-1]!==v:g||0>mt(l,v))&&((e||p)&&l.push(v),o.push(r))}return o}function kt(n,t){for(var e=-1,r=n?n.length:0,u={};++e<r;){var a=n[e];t?u[a]=t[e]:u[a[0]]=a[1]}return u}function wt(n,t){return le.fastBind||Xt&&2<arguments.length?Xt.call.apply(Xt,arguments):T(n,t,ie.call(arguments,2))}function jt(n){var t=ie.call(arguments,1);
return Qt(function(){n.apply(e,t)},1)}function Ct(n){return n}function xt(n){ot(L(n),function(t){var e=a[t]=n[t];a.prototype[t]=function(){var n=this.__wrapped__,t=[n];return Jt.apply(t,arguments),t=e.apply(a,t),n&&typeof n=="object"&&n==t?this:new K(t)}})}function Ot(){return this.__wrapped__}r=r?q.defaults(n.Object(),r,q.pick(n,k)):n;var Nt=r.Array,Et=r.Boolean,It=r.Date,St=r.Function,At=r.Math,$t=r.Number,qt=r.Object,Bt=r.RegExp,Ft=r.String,Rt=r.TypeError,Tt=Nt(),Dt=qt(),zt=r._,Pt=Bt("^"+Ft(Dt.valueOf).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),Kt=At.ceil,Mt=r.clearTimeout,Ut=Tt.concat,Vt=At.floor,Gt=Pt.test(Gt=qt.getPrototypeOf)&&Gt,Ht=Dt.hasOwnProperty,Jt=Tt.push,Lt=r.setImmediate,Qt=r.setTimeout,Wt=Dt.toString,Xt=Pt.test(Xt=Wt.bind)&&Xt,Yt=Pt.test(Yt=Nt.isArray)&&Yt,Zt=r.isFinite,ne=r.isNaN,te=Pt.test(te=qt.keys)&&te,ee=At.max,re=At.min,ue=r.parseInt,ae=At.random,ie=Tt.slice,oe=Pt.test(r.attachEvent),fe=Xt&&!/\n|true/.test(Xt+oe),ce={};
ce[j]=Nt,ce[C]=Et,ce[x]=It,ce[N]=qt,ce[O]=$t,ce[E]=Bt,ce[I]=Ft;var le=a.support={};le.fastBind=Xt&&!fe,a.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:y,variable:"",imports:{_:a}};var pe={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:"}}"},se={a:"e,d,x",h:"d=d&&typeof x=='undefined'?d:p.createCallback(d,x)",b:!1,f:"if(d(m[i],i,e)===false)return u"},ve={h:"if(!r[typeof m])return u;"+se.h,b:!1};
K.prototype=a.prototype;var ge=Yt||function(n){return n instanceof Nt||Wt.call(n)==j},he=D({a:"q",e:"[]",h:"if(!(r[typeof q]))return u",f:"u.push(i)",b:!1}),ye=te?function(n){return Y(n)?te(n):[]}:he,me={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},be=Q(me),de=D(pe,{h:pe.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]"}),_e=D(pe),ke=D(se,ve,{i:!1}),we=D(se,ve),je=function(n){if(!n||Wt.call(n)!=N)return!1;
var t=n.valueOf,e=typeof t=="function"&&(e=Gt(t))&&Gt(e);return e?n==e||Gt(n)==e:U(n)};fe&&u&&typeof Lt=="function"&&(jt=wt(Lt,r));var Ce=8==ue("08")?ue:function(n,t){return ue(nt(n)?n.replace(m,""):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=de,a.at=function(n){for(var t=-1,e=Ut.apply(Tt,ie.call(arguments,1)),r=e.length,u=Nt(r);++t<r;)u[t]=n[e[t]];return u},a.bind=wt,a.bindAll=function(n){for(var t=1<arguments.length?Ut.apply(Tt,ie.call(arguments,1)):L(n),e=-1,r=t.length;++e<r;){var u=t[e];
n[u]=wt(n[u],n)}return n},a.bindKey=function(n,t){return T(n,t,ie.call(arguments,2),o)},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)];return t[0]}},a.countBy=function(n,t,e){var r={};return t=a.createCallback(t,e),ot(n,function(n,e,u){e=Ft(t(n,e,u)),Ht.call(r,e)?r[e]++:r[e]=1}),r},a.createCallback=function(n,t,e){if(null==n)return Ct;
var r=typeof n;if("function"!=r){if("object"!=r)return function(t){return t[n]};var u=ye(n);return function(t){for(var e=u.length,r=!1;e--&&(r=W(t[u[e]],n[u[e]],o)););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)}:function(e,r,u){return n.call(t,e,r,u)}:n},a.debounce=function(n,t,e){function r(){o=null,f&&(a=n.apply(i,u))}var u,a,i,o,f=!0;if(!0===e)var c=!0,f=!1;else e&&A[typeof e]&&(c=e.leading,f="trailing"in e?e.trailing:f);
return function(){var e=c&&!o;return u=arguments,i=this,Mt(o),o=Qt(r,t),e&&(a=n.apply(i,u)),a}},a.defaults=_e,a.defer=jt,a.delay=function(n,t){var r=ie.call(arguments,2);return Qt(function(){n.apply(e,r)},t)},a.difference=gt,a.filter=at,a.flatten=yt,a.forEach=ot,a.forIn=ke,a.forOwn=we,a.functions=L,a.groupBy=function(n,t,e){var r={};return t=a.createCallback(t,e),ot(n,function(n,e,u){e=Ft(t(n,e,u)),(Ht.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 i=u;for(t=a.createCallback(t,e);i--&&t(n[i],i,n);)r++}else r=null==t||e?1:t||r;return V(n,0,re(ee(0,u-r),u))},a.intersection=function(n){var t=arguments,e=t.length,r={0:{}},u=-1,a=n?n.length:0,i=a>=c,o=[],l=o;n:for(;++u<a;){var p=n[u];if(i)var s=f+p,s=r[0][s]?!(l=r[0][s]):l=r[0][s]=[];if(s||0>mt(l,p)){i&&l.push(p);for(var v=e;--v;)if(!(r[v]||(r[v]=B(t[v])))(p))continue n;o.push(p)}}return o},a.invert=Q,a.invoke=function(n,t){var e=ie.call(arguments,2),r=-1,u=typeof t=="function",a=n?n.length:0,i=Nt(typeof a=="number"?a:0);
return ot(n,function(n){i[++r]=(u?t:n[t]).apply(n,e)}),i},a.keys=ye,a.map=ft,a.max=ct,a.memoize=function(n,t){var e={};return function(){var r=f+(t?t.apply(this,arguments):arguments[0]);return Ht.call(e,r)?e[r]:e[r]=n.apply(this,arguments)}},a.merge=tt,a.min=function(n,t,e){var r=1/0,u=r;if(!t&&ge(n)){e=-1;for(var i=n.length;++e<i;){var o=n[e];o<u&&(u=o)}}else t=!t&&nt(n)?F:a.createCallback(t,e),ot(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 i=Ut.apply(Tt,ie.call(arguments,1));return ke(n,function(n,e,a){(r?!t(n,e,a):0>mt(i,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=ye(n),r=e.length,u=Nt(r);++t<r;){var a=e[t];u[t]=[a,n[a]]}return u},a.partial=function(n){return T(n,ie.call(arguments,1))},a.partialRight=function(n){return T(n,ie.call(arguments,1),null,o)},a.pick=function(n,t,e){var r={};if(typeof t!="function")for(var u=-1,i=Ut.apply(Tt,ie.call(arguments,1)),o=Y(n)?i.length:0;++u<o;){var f=i[u];
f in n&&(r[f]=n[f])}else t=a.createCallback(t,e),ke(n,function(n,e,u){t(n,e,u)&&(r[e]=n)});return r},a.pluck=lt,a.range=function(n,t,e){n=+n||0,e=+e||1,null==t&&(t=n,n=0);var r=-1;t=ee(0,Kt((t-n)/e));for(var u=Nt(t);++r<t;)u[r]=n,n+=e;return u},a.reject=function(n,t,e){return t=a.createCallback(t,e),at(n,function(n,e,r){return!t(n,e,r)})},a.rest=bt,a.shuffle=function(n){var t=-1,e=n?n.length:0,r=Nt(typeof e=="number"?e:0);return ot(n,function(n){var e=Vt(ae()*(++t+1));r[t]=r[e],r[e]=n}),r},a.sortBy=function(n,t,e){var r=-1,u=n?n.length:0,i=Nt(typeof u=="number"?u:0);
for(t=a.createCallback(t,e),ot(n,function(n,e,u){i[++r]={a:t(n,e,u),b:r,c:n}}),u=i.length,i.sort(R);u--;)i[u]=i[u].c;return i},a.tap=function(n,t){return t(n),n},a.throttle=function(n,t,e){function r(){f=new It,o=null,l&&(a=n.apply(i,u))}var u,a,i,o,f=0,c=!0,l=!0;return!1===e?c=!1:e&&A[typeof e]&&(c="leading"in e?e.leading:c,l="trailing"in e?e.trailing:l),function(){var e=new It;!o&&!c&&(f=e);var l=t-(e-f);return u=arguments,i=this,0<l?o||(o=Qt(r,l)):(Mt(o),o=null,f=e,a=n.apply(i,u)),a}},a.times=function(n,t,e){n=-1<(n=+n)?n:0;
var r=-1,u=Nt(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"?V(n):et(n)},a.union=function(n){return ge(n)||(arguments[0]=n?ie.call(n):Tt),_t(Ut.apply(Tt,arguments))},a.uniq=_t,a.unzip=function(n){for(var t=-1,e=n?n.length:0,r=e?ct(lt(n,"length")):0,u=Nt(r);++t<e;)for(var a=-1,i=n[t];++a<r;)(u[a]||(u[a]=Nt(e)))[t]=i[a];return u},a.values=et,a.where=at,a.without=function(n){return gt(n,ie.call(arguments,1))},a.wrap=function(n,t){return function(){var e=[n];
return Jt.apply(e,arguments),t.apply(this,e)}},a.zip=function(n){for(var t=-1,e=n?ct(lt(arguments,"length")):0,r=Nt(e);++t<e;)r[t]=lt(arguments,t);return r},a.zipObject=kt,a.collect=ft,a.drop=bt,a.each=ot,a.extend=de,a.methods=L,a.object=kt,a.select=at,a.tail=bt,a.unique=_t,xt(a),a.clone=J,a.cloneDeep=function(n,t,e){return J(n,!0,t,e)},a.contains=rt,a.escape=function(n){return null==n?"":Ft(n).replace(d,P)},a.every=ut,a.find=it,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),we(n,function(n,e,u){return t(n,e,u)?(r=e,!1):void 0}),r},a.has=function(n,t){return n?Ht.call(n,t):!1},a.identity=Ct,a.indexOf=mt,a.isArguments=H,a.isArray=ge,a.isBoolean=function(n){return!0===n||!1===n||Wt.call(n)==C},a.isDate=function(n){return n instanceof It||Wt.call(n)==x},a.isElement=function(n){return n?1===n.nodeType:!1},a.isEmpty=function(n){var t=!0;if(!n)return t;var e=Wt.call(n),r=n.length;return e==j||e==I||e==w||e==N&&typeof r=="number"&&X(n.splice)?!r:(we(n,function(){return t=!1
}),t)},a.isEqual=W,a.isFinite=function(n){return Zt(n)&&!ne(parseFloat(n))},a.isFunction=X,a.isNaN=function(n){return Z(n)&&n!=+n},a.isNull=function(n){return null===n},a.isNumber=Z,a.isObject=Y,a.isPlainObject=je,a.isRegExp=function(n){return n instanceof Bt||Wt.call(n)==E},a.isString=nt,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?ee(0,r+e):re(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},a.mixin=xt,a.noConflict=function(){return r._=zt,this
},a.parseInt=Ce,a.random=function(n,t){return null==n&&null==t&&(t=1),n=+n||0,null==t&&(t=n,n=0),n+Vt(ae()*((+t||0)-n+1))},a.reduce=pt,a.reduceRight=st,a.result=function(n,t){var r=n?n[t]:e;return X(r)?n[t]():r},a.runInContext=t,a.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:ye(n).length},a.some=vt,a.sortedIndex=dt,a.template=function(n,t,r){var u=a.templateSettings;n||(n=""),r=_e({},r,u);var i,o=_e({},r.imports,u.imports),u=ye(o),o=et(o),f=0,c=r.interpolate||b,v="__p+='",c=Bt((r.escape||b).source+"|"+c.source+"|"+(c===y?g:b).source+"|"+(r.evaluate||b).source+"|$","g");
n.replace(c,function(t,e,r,u,a,o){return r||(r=u),v+=n.slice(f,o).replace(_,z),e&&(v+="'+__e("+e+")+'"),a&&(i=!0,v+="';"+a+";__p+='"),r&&(v+="'+((__t=("+r+"))==null?'':__t)+'"),f=o+t.length,t}),v+="';\n",c=r=r.variable,c||(r="obj",v="with("+r+"){"+v+"}"),v=(i?v.replace(l,""):v).replace(p,"$1").replace(s,"$1;"),v="function("+r+"){"+(c?"":r+"||("+r+"={});")+"var __t,__p='',__e=_.escape"+(i?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+v+"return __p}";try{var h=St(u,"return "+v).apply(e,o)
}catch(m){throw m.source=v,m}return t?h(t):(h.source=v,h)},a.unescape=function(n){return null==n?"":Ft(n).replace(v,G)},a.uniqueId=function(n){var t=++i;return Ft(null==n?"":n)+t},a.all=ut,a.any=vt,a.detect=it,a.foldl=pt,a.foldr=st,a.include=rt,a.inject=pt,we(a,function(n,t){a.prototype[t]||(a.prototype[t]=function(){var t=[this.__wrapped__];return Jt.apply(t,arguments),n.apply(a,t)})}),a.first=ht,a.last=function(n,t,e){if(n){var r=0,u=n.length;if(typeof t!="number"&&null!=t){var i=u;for(t=a.createCallback(t,e);i--&&t(n[i],i,n);)r++
}else if(r=t,null==r||e)return n[u-1];return V(n,ee(0,u-r))}},a.take=ht,a.head=ht,we(a,function(n,t){a.prototype[t]||(a.prototype[t]=function(t,e){var r=n(this.__wrapped__,t,e);return null==t||e&&typeof t!="function"?r:new K(r)})}),a.VERSION="1.1.1",a.prototype.toString=function(){return Ft(this.__wrapped__)},a.prototype.value=Ot,a.prototype.valueOf=Ot,ot(["join","pop","shift"],function(n){var t=Tt[n];a.prototype[n]=function(){return t.apply(this.__wrapped__,arguments)}}),ot(["push","reverse","sort","unshift"],function(n){var t=Tt[n];
a.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),ot(["concat","slice","splice"],function(n){var t=Tt[n];a.prototype[n]=function(){return new K(t.apply(this.__wrapped__,arguments))}}),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 i=0,o={},f=+new Date+"",c=200,l=/\b__p\+='';/g,p=/\b(__p\+=)''\+/g,s=/(__e\(.*?\)|\b__t\))\+'';/g,v=/&(?:amp|lt|gt|quot|#39);/g,g=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,h=/\w*$/,y=/<%=([\s\S]+?)%>/g,m=/^0+(?=.$)/,b=/($^)/,d=/[&<>"']/g,_=/['\n\r\t\u2028\u2029\\]/g,k="Array Boolean Date Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),w="[object Arguments]",j="[object Array]",C="[object Boolean]",x="[object Date]",O="[object Number]",N="[object Object]",E="[object RegExp]",I="[object String]",S={"[object Function]":!1};
S[w]=S[j]=S[C]=S[x]=S[O]=S[N]=S[E]=S[I]=!0;var A={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},$={"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"},q=t();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=q,define(function(){return q})):r&&!r.nodeType?u?(u.exports=q)._=q:r._=q:n._=q})(this);
;(function(n){function t(o){function f(n){if(!n||re.call(n)!=S)return a;var t=n.valueOf,e=typeof t=="function"&&(e=Yt(t))&&Yt(e);return e?n==e||Yt(n)==e:X(n)}function q(n,t,e){if(!n||!F[typeof n])return n;t=t&&typeof e=="undefined"?t:M.createCallback(t,e);for(var r=-1,u=F[typeof n]?me(n):[],o=u.length;++r<o&&(e=u[r],!(t(n[e],e,n)===a)););return n}function D(n,t,e){var r;if(!n||!F[typeof n])return n;t=t&&typeof e=="undefined"?t:M.createCallback(t,e);for(r in n)if(t(n[r],r,n)===a)break;return n}function z(n,t,e){var r,u=n,a=u;
if(!u)return a;for(var o=arguments,i=0,f=typeof e=="number"?2:o.length;++i<f;)if((u=o[i])&&F[typeof u]){var c=u.length;if(r=-1,he(u))for(;++r<c;)"undefined"==typeof a[r]&&(a[r]=u[r]);else for(var l=-1,p=F[typeof u]?me(u):[],c=p.length;++l<c;)r=p[l],"undefined"==typeof a[r]&&(a[r]=u[r])}return a}function P(n,t,e){var r,u=n,a=u;if(!u)return a;var o=arguments,i=0,f=typeof e=="number"?2:o.length;if(3<f&&"function"==typeof o[f-2])var c=M.createCallback(o[--f-1],o[f--],2);else 2<f&&"function"==typeof o[f-1]&&(c=o[--f]);
for(;++i<f;)if((u=o[i])&&F[typeof u]){var l=u.length;if(r=-1,he(u))for(;++r<l;)a[r]=c?c(a[r],u[r]):u[r];else for(var p=-1,s=F[typeof u]?me(u):[],l=s.length;++p<l;)r=s[p],a[r]=c?c(a[r],u[r]):u[r]}return a}function K(n){var t,e=[];if(!n||!F[typeof n])return e;for(t in n)Zt.call(n,t)&&e.push(t);return e}function M(n){return n&&typeof n=="object"&&!he(n)&&Zt.call(n,"__wrapped__")?n:new Q(n)}function U(n){var t=n.length,e=t>=s;if(e)for(var r={},u=-1;++u<t;){var a=p+n[u];(r[a]||(r[a]=[])).push(n[u])}return function(t){if(e){var u=p+t;
return r[u]&&-1<jt(r[u],t)}return-1<jt(n,t)}}function V(n){return n.charCodeAt(0)}function G(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 H(n,t,e,r){function a(){var r=arguments,l=i?this:t;return o||(n=t[f]),e.length&&(r=r.length?(r=ve.call(r),c?r.concat(e):e.concat(r)):e),this instanceof a?(W.prototype=n.prototype,l=new W,W.prototype=u,r=n.apply(l,r),at(r)?r:l):n.apply(l,r)}var o=ut(n),i=!e,f=t;if(i){var c=r;
e=t}else if(!o){if(!r)throw new Ut;t=n}return a}function J(n){return"\\"+R[n]}function L(n){return be[n]}function Q(n){this.__wrapped__=n}function W(){}function X(n){var t=a;if(!n||re.call(n)!=S)return t;var e=n.constructor;return(ut(e)?e instanceof e:ye.nodeClass||!isNode(n))?(D(n,function(n,e){t=e}),t===a||Zt.call(n,t)):t}function Y(n,t,e){t||(t=0),typeof e=="undefined"&&(e=n?n.length:0);var r=-1;e=e-t||0;for(var u=Ft(0>e?0:e);++r<e;)u[r]=n[t+r];return u}function Z(n){return de[n]}function nt(n,t,r,u,o,i){var f=n;
if(typeof t=="function"&&(u=r,r=t,t=a),typeof r=="function"){if(r=typeof u=="undefined"?r:M.createCallback(r,u,1),f=r(f),typeof f!="undefined")return f;f=n}if(u=at(f)){var c=re.call(f);if(!B[c])return f;var l=he(f)}if(!u||!t)return u?l?Y(f):P({},f):f;switch(u=ge[c],c){case N:case E:return new u(+f);case I:case $:return new u(f);case A:return u(f.source,b.exec(f))}for(o||(o=[]),i||(i=[]),c=o.length;c--;)if(o[c]==n)return i[c];return f=l?u(f.length):{},l&&(Zt.call(n,"index")&&(f.index=n.index),Zt.call(n,"input")&&(f.input=n.input)),o.push(n),i.push(f),(l?gt:q)(n,function(n,u){f[u]=nt(n,t,r,e,o,i)
}),f}function tt(n){var t=[];return D(n,function(n,e){ut(n)&&t.push(e)}),t.sort()}function et(n){for(var t=-1,e=me(n),r=e.length,u={};++t<r;){var a=e[t];u[n[a]]=a}return u}function rt(n,t,e,o,i,f){var c=e===l;if(typeof e=="function"&&!c){e=M.createCallback(e,o,2);var p=e(n,t);if(typeof p!="undefined")return!!p}if(n===t)return 0!==n||1/n==1/t;var s=typeof n,v=typeof t;if(n===n&&(!n||"function"!=s&&"object"!=s)&&(!t||"function"!=v&&"object"!=v))return a;if(n==u||t==u)return n===t;if(v=re.call(n),s=re.call(t),v==x&&(v=S),s==x&&(s=S),v!=s)return a;
switch(v){case N:case E:return+n==+t;case I:return n!=+n?t!=+t:0==n?1/n==1/t:n==+t;case A:case $:return n==Mt(t)}if(s=v==O,!s){if(Zt.call(n,"__wrapped__")||Zt.call(t,"__wrapped__"))return rt(n.__wrapped__||n,t.__wrapped__||t,e,o,i,f);if(v!=S)return a;var v=n.constructor,g=t.constructor;if(v!=g&&(!ut(v)||!(v instanceof v&&ut(g)&&g instanceof g)))return a}for(i||(i=[]),f||(f=[]),v=i.length;v--;)if(i[v]==n)return f[v]==t;var y=0,p=r;if(i.push(n),f.push(t),s){if(v=n.length,y=t.length,p=y==n.length,!p&&!c)return p;
for(;y--;)if(s=v,g=t[y],c)for(;s--&&!(p=rt(n[s],g,e,o,i,f)););else if(!(p=rt(n[y],g,e,o,i,f)))break;return p}return D(t,function(t,r,u){return Zt.call(u,r)?(y++,p=Zt.call(n,r)&&rt(n[r],t,e,o,i,f)):void 0}),p&&!c&&D(n,function(n,t,e){return Zt.call(e,t)?p=-1<--y:void 0}),p}function ut(n){return typeof n=="function"}function at(n){return n?F[typeof n]:a}function ot(n){return typeof n=="number"||re.call(n)==I}function it(n){return typeof n=="string"||re.call(n)==$}function ft(n,t,e){var r=arguments,u=0,a=2;
if(!at(n))return n;if(e===l)var o=r[3],i=r[4],c=r[5];else i=[],c=[],typeof e!="number"&&(a=r.length),3<a&&"function"==typeof r[a-2]?o=M.createCallback(r[--a-1],r[a--],2):2<a&&"function"==typeof r[a-1]&&(o=r[--a]);for(;++u<a;)(he(r[u])?gt:q)(r[u],function(t,e){var r,u,a=t,p=n[e];if(t&&((u=he(t))||f(t))){for(a=i.length;a--;)if(r=i[a]==t){p=c[a];break}if(!r){var s;o&&(a=o(p,t),s=typeof a!="undefined")&&(p=a),s||(p=u?he(p)?p:[]:f(p)?p:{}),i.push(t),c.push(p),s||(p=ft(p,t,l,o,i,c))}}else o&&(a=o(p,t),typeof a=="undefined"&&(a=t)),typeof a!="undefined"&&(p=a);
n[e]=p});return n}function ct(n){for(var t=-1,e=me(n),r=e.length,u=Ft(r);++t<r;)u[t]=n[e[t]];return u}function lt(n,t,e){var r=-1,u=n?n.length:0,o=a;return e=(0>e?ce(0,u+e):e)||0,typeof u=="number"?o=-1<(it(n)?n.indexOf(t,e):jt(n,t,e)):q(n,function(n){return++r<e?void 0:!(o=n===t)}),o}function pt(n,t,e){var u=r;t=M.createCallback(t,e),e=-1;var a=n?n.length:0;if(typeof a=="number")for(;++e<a&&(u=!!t(n[e],e,n)););else q(n,function(n,e,r){return u=!!t(n,e,r)});return u}function st(n,t,e){var r=[];t=M.createCallback(t,e),e=-1;
var u=n?n.length:0;if(typeof u=="number")for(;++e<u;){var a=n[e];t(a,e,n)&&r.push(a)}else q(n,function(n,e,u){t(n,e,u)&&r.push(n)});return r}function vt(n,t,e){t=M.createCallback(t,e),e=-1;var r=n?n.length:0;if(typeof r!="number"){var u;return q(n,function(n,e,r){return t(n,e,r)?(u=n,a):void 0}),u}for(;++e<r;){var o=n[e];if(t(o,e,n))return o}}function gt(n,t,e){var r=-1,u=n?n.length:0;if(t=t&&typeof e=="undefined"?t:M.createCallback(t,e),typeof u=="number")for(;++r<u&&t(n[r],r,n)!==a;);else q(n,t);
return n}function yt(n,t,e){var r=-1,u=n?n.length:0;if(t=M.createCallback(t,e),typeof u=="number")for(var a=Ft(u);++r<u;)a[r]=t(n[r],r,n);else a=[],q(n,function(n,e,u){a[++r]=t(n,e,u)});return a}function ht(n,t,e){var r=-1/0,u=r;if(!t&&he(n)){e=-1;for(var a=n.length;++e<a;){var o=n[e];o>u&&(u=o)}}else t=!t&&it(n)?V:M.createCallback(t,e),gt(n,function(n,e,a){e=t(n,e,a),e>r&&(r=e,u=n)});return u}function mt(n,t){var e=-1,r=n?n.length:0;if(typeof r=="number")for(var u=Ft(r);++e<r;)u[e]=n[e][t];return u||yt(n,t)
}function bt(n,t,e,r){if(!n)return e;var u=3>arguments.length;t=M.createCallback(t,r,4);var o=-1,i=n.length;if(typeof i=="number")for(u&&(e=n[++o]);++o<i;)e=t(e,n[o],o,n);else q(n,function(n,r,o){e=u?(u=a,n):t(e,n,r,o)});return e}function dt(n,t,e,r){var u=n?n.length:0,o=3>arguments.length;if(typeof u!="number")var i=me(n),u=i.length;return t=M.createCallback(t,r,4),gt(n,function(r,f,c){f=i?i[--u]:--u,e=o?(o=a,n[f]):t(e,n[f],f,c)}),e}function _t(n,t,e){var r;t=M.createCallback(t,e),e=-1;var u=n?n.length:0;
if(typeof u=="number")for(;++e<u&&!(r=t(n[e],e,n)););else q(n,function(n,e,u){return!(r=t(n,e,u))});return!!r}function kt(n){for(var t=-1,e=n?n.length:0,r=Wt.apply(Vt,ve.call(arguments,1)),r=U(r),u=[];++t<e;){var a=n[t];r(a)||u.push(a)}return u}function wt(n,t,e){if(n){var r=0,a=n.length;if(typeof t!="number"&&t!=u){var o=-1;for(t=M.createCallback(t,e);++o<a&&t(n[o],o,n);)r++}else if(r=t,r==u||e)return n[0];return Y(n,0,le(ce(0,r),a))}}function Ct(n,t,e,r){var o=-1,i=n?n.length:0,f=[];for(typeof t!="boolean"&&t!=u&&(r=e,e=t,t=a),e!=u&&(e=M.createCallback(e,r));++o<i;)r=n[o],e&&(r=e(r,o,n)),he(r)?ne.apply(f,t?r:Ct(r)):f.push(r);
return f}function jt(n,t,e){var r=-1,u=n?n.length:0;if(typeof e=="number")r=(0>e?ce(0,u+e):e||0)-1;else if(e)return r=Ot(n,t),n[r]===t?r:-1;for(;++r<u;)if(n[r]===t)return r;return-1}function xt(n,t,e){if(typeof t!="number"&&t!=u){var r=0,a=-1,o=n?n.length:0;for(t=M.createCallback(t,e);++a<o&&t(n[a],a,n);)r++}else r=t==u||e?1:ce(0,t);return Y(n,r)}function Ot(n,t,e,r){var u=0,a=n?n.length:u;for(e=e?M.createCallback(e,r,1):At,t=e(t);u<a;)r=u+a>>>1,e(n[r])<t?u=r+1:a=r;return u}function Nt(n,t,e,r){var o=-1,i=n?n.length:0,f=[],c=f;
typeof t!="boolean"&&t!=u&&(r=e,e=t,t=a);var l=!t&&i>=s;if(l)var v={};for(e!=u&&(c=[],e=M.createCallback(e,r));++o<i;){r=n[o];var g=e?e(r,o,n):r;if(l)var y=p+g,y=v[y]?!(c=v[y]):c=v[y]=[];(t?!o||c[c.length-1]!==g:y||0>jt(c,g))&&((e||l)&&c.push(g),f.push(r))}return f}function Et(n,t){for(var e=-1,r=n?n.length:0,u={};++e<r;){var a=n[e];t?u[a]=t[e]:u[a[0]]=a[1]}return u}function It(n,t){return ye.fastBind||ue&&2<arguments.length?ue.call.apply(ue,arguments):H(n,t,ve.call(arguments,2))}function St(n){var t=ve.call(arguments,1);
return ee(function(){n.apply(e,t)},1)}function At(n){return n}function $t(n){gt(tt(n),function(t){var e=M[t]=n[t];M.prototype[t]=function(){var n=this.__wrapped__,t=[n];return ne.apply(t,arguments),t=e.apply(M,t),n&&typeof n=="object"&&n==t?this:new Q(t)}})}function Bt(){return this.__wrapped__}o=o?T.defaults(n.Object(),o,T.pick(n,j)):n;var Ft=o.Array,Rt=o.Boolean,Tt=o.Date,qt=o.Function,Dt=o.Math,zt=o.Number,Pt=o.Object,Kt=o.RegExp,Mt=o.String,Ut=o.TypeError,Vt=Ft(),Gt=Pt(),Ht=o._,Jt=Kt("^"+Mt(Gt.valueOf).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),Lt=Dt.ceil,Qt=o.clearTimeout,Wt=Vt.concat,Xt=Dt.floor,Yt=Jt.test(Yt=Pt.getPrototypeOf)&&Yt,Zt=Gt.hasOwnProperty,ne=Vt.push,te=o.setImmediate,ee=o.setTimeout,re=Gt.toString,ue=Jt.test(ue=re.bind)&&ue,ae=Jt.test(ae=Ft.isArray)&&ae,oe=o.isFinite,ie=o.isNaN,fe=Jt.test(fe=Pt.keys)&&fe,ce=Dt.max,le=Dt.min,pe=o.parseInt,se=Dt.random,ve=Vt.slice,Dt=Jt.test(o.attachEvent),Dt=ue&&!/\n|true/.test(ue+Dt),ge={};
ge[O]=Ft,ge[N]=Rt,ge[E]=Tt,ge[S]=Pt,ge[I]=zt,ge[A]=Kt,ge[$]=Mt;var ye=M.support={};ye.fastBind=ue&&!Dt,M.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:d,variable:"",imports:{_:M}},Q.prototype=M.prototype;var he=ae||function(n){return n instanceof Ft||re.call(n)==O},me=fe?function(n){return at(n)?fe(n):[]}:K,be={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},de=et(be);return Dt&&i&&typeof te=="function"&&(St=It(te,o)),Rt=8==pe("08")?pe:function(n,t){return pe(it(n)?n.replace(_,""):n,t||0)
},M.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0}},M.assign=P,M.at=function(n){for(var t=-1,e=Wt.apply(Vt,ve.call(arguments,1)),r=e.length,u=Ft(r);++t<r;)u[t]=n[e[t]];return u},M.bind=It,M.bindAll=function(n){for(var t=1<arguments.length?Wt.apply(Vt,ve.call(arguments,1)):tt(n),e=-1,r=t.length;++e<r;){var u=t[e];n[u]=It(n[u],n)}return n},M.bindKey=function(n,t){return H(n,t,ve.call(arguments,2),l)},M.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},M.compose=function(){var n=arguments;return function(){for(var t=arguments,e=n.length;e--;)t=[n[e].apply(this,t)];return t[0]}},M.countBy=function(n,t,e){var r={};return t=M.createCallback(t,e),gt(n,function(n,e,u){e=Mt(t(n,e,u)),Zt.call(r,e)?r[e]++:r[e]=1}),r},M.createCallback=function(n,t,e){if(n==u)return At;var r=typeof n;if("function"!=r){if("object"!=r)return function(t){return t[n]};var o=me(n);return function(t){for(var e=o.length,r=a;e--&&(r=rt(t[o[e]],n[o[e]],l)););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)}:function(e,r,u){return n.call(t,e,r,u)}:n},M.debounce=function(n,t,e){function o(){l=u,p&&(f=n.apply(c,i))}var i,f,c,l,p=r;if(e===r)var s=r,p=a;else e&&F[typeof e]&&(s=e.leading,p="trailing"in e?e.trailing:p);return function(){var e=s&&!l;return i=arguments,c=this,Qt(l),l=ee(o,t),e&&(f=n.apply(c,i)),f}},M.defaults=z,M.defer=St,M.delay=function(n,t){var r=ve.call(arguments,2);
return ee(function(){n.apply(e,r)},t)},M.difference=kt,M.filter=st,M.flatten=Ct,M.forEach=gt,M.forIn=D,M.forOwn=q,M.functions=tt,M.groupBy=function(n,t,e){var r={};return t=M.createCallback(t,e),gt(n,function(n,e,u){e=Mt(t(n,e,u)),(Zt.call(r,e)?r[e]:r[e]=[]).push(n)}),r},M.initial=function(n,t,e){if(!n)return[];var r=0,a=n.length;if(typeof t!="number"&&t!=u){var o=a;for(t=M.createCallback(t,e);o--&&t(n[o],o,n);)r++}else r=t==u||e?1:t||r;return Y(n,0,le(ce(0,a-r),a))},M.intersection=function(n){var t=arguments,e=t.length,r={0:{}},u=-1,a=n?n.length:0,o=a>=s,i=[],f=i;
n:for(;++u<a;){var c=n[u];if(o)var l=p+c,l=r[0][l]?!(f=r[0][l]):f=r[0][l]=[];if(l||0>jt(f,c)){o&&f.push(c);for(var v=e;--v;)if(!(r[v]||(r[v]=U(t[v])))(c))continue n;i.push(c)}}return i},M.invert=et,M.invoke=function(n,t){var e=ve.call(arguments,2),r=-1,u=typeof t=="function",a=n?n.length:0,o=Ft(typeof a=="number"?a:0);return gt(n,function(n){o[++r]=(u?t:n[t]).apply(n,e)}),o},M.keys=me,M.map=yt,M.max=ht,M.memoize=function(n,t){var e={};return function(){var r=p+(t?t.apply(this,arguments):arguments[0]);
return Zt.call(e,r)?e[r]:e[r]=n.apply(this,arguments)}},M.merge=ft,M.min=function(n,t,e){var r=1/0,u=r;if(!t&&he(n)){e=-1;for(var a=n.length;++e<a;){var o=n[e];o<u&&(u=o)}}else t=!t&&it(n)?V:M.createCallback(t,e),gt(n,function(n,e,a){e=t(n,e,a),e<r&&(r=e,u=n)});return u},M.omit=function(n,t,e){var r=typeof t=="function",u={};if(r)t=M.createCallback(t,e);else var a=Wt.apply(Vt,ve.call(arguments,1));return D(n,function(n,e,o){(r?!t(n,e,o):0>jt(a,e))&&(u[e]=n)}),u},M.once=function(n){var t,e;return function(){return t?e:(t=r,e=n.apply(this,arguments),n=u,e)
}},M.pairs=function(n){for(var t=-1,e=me(n),r=e.length,u=Ft(r);++t<r;){var a=e[t];u[t]=[a,n[a]]}return u},M.partial=function(n){return H(n,ve.call(arguments,1))},M.partialRight=function(n){return H(n,ve.call(arguments,1),u,l)},M.pick=function(n,t,e){var r={};if(typeof t!="function")for(var u=-1,a=Wt.apply(Vt,ve.call(arguments,1)),o=at(n)?a.length:0;++u<o;){var i=a[u];i in n&&(r[i]=n[i])}else t=M.createCallback(t,e),D(n,function(n,e,u){t(n,e,u)&&(r[e]=n)});return r},M.pluck=mt,M.range=function(n,t,e){n=+n||0,e=+e||1,t==u&&(t=n,n=0);
var r=-1;t=ce(0,Lt((t-n)/e));for(var a=Ft(t);++r<t;)a[r]=n,n+=e;return a},M.reject=function(n,t,e){return t=M.createCallback(t,e),st(n,function(n,e,r){return!t(n,e,r)})},M.rest=xt,M.shuffle=function(n){var t=-1,e=n?n.length:0,r=Ft(typeof e=="number"?e:0);return gt(n,function(n){var e=Xt(se()*(++t+1));r[t]=r[e],r[e]=n}),r},M.sortBy=function(n,t,e){var r=-1,u=n?n.length:0,a=Ft(typeof u=="number"?u:0);for(t=M.createCallback(t,e),gt(n,function(n,e,u){a[++r]={a:t(n,e,u),b:r,c:n}}),u=a.length,a.sort(G);u--;)a[u]=a[u].c;
return a},M.tap=function(n,t){return t(n),n},M.throttle=function(n,t,e){function o(){p=new Tt,l=u,v&&(f=n.apply(c,i))}var i,f,c,l,p=0,s=r,v=r;return e===a?s=a:e&&F[typeof e]&&(s="leading"in e?e.leading:s,v="trailing"in e?e.trailing:v),function(){var e=new Tt;!l&&!s&&(p=e);var r=t-(e-p);return i=arguments,c=this,0<r?l||(l=ee(o,r)):(Qt(l),l=u,p=e,f=n.apply(c,i)),f}},M.times=function(n,t,e){n=-1<(n=+n)?n:0;var r=-1,u=Ft(n);for(t=M.createCallback(t,e,1);++r<n;)u[r]=t(r);return u},M.toArray=function(n){return n&&typeof n.length=="number"?Y(n):ct(n)
},M.union=function(n){return he(n)||(arguments[0]=n?ve.call(n):Vt),Nt(Wt.apply(Vt,arguments))},M.uniq=Nt,M.unzip=function(n){for(var t=-1,e=n?n.length:0,r=e?ht(mt(n,"length")):0,u=Ft(r);++t<e;)for(var a=-1,o=n[t];++a<r;)(u[a]||(u[a]=Ft(e)))[t]=o[a];return u},M.values=ct,M.where=st,M.without=function(n){return kt(n,ve.call(arguments,1))},M.wrap=function(n,t){return function(){var e=[n];return ne.apply(e,arguments),t.apply(this,e)}},M.zip=function(n){for(var t=-1,e=n?ht(mt(arguments,"length")):0,r=Ft(e);++t<e;)r[t]=mt(arguments,t);
return r},M.zipObject=Et,M.collect=yt,M.drop=xt,M.each=gt,M.extend=P,M.methods=tt,M.object=Et,M.select=st,M.tail=xt,M.unique=Nt,$t(M),M.clone=nt,M.cloneDeep=function(n,t,e){return nt(n,r,t,e)},M.contains=lt,M.escape=function(n){return n==u?"":Mt(n).replace(w,L)},M.every=pt,M.find=vt,M.findIndex=function(n,t,e){var r=-1,u=n?n.length:0;for(t=M.createCallback(t,e);++r<u;)if(t(n[r],r,n))return r;return-1},M.findKey=function(n,t,e){var r;return t=M.createCallback(t,e),q(n,function(n,e,u){return t(n,e,u)?(r=e,a):void 0
}),r},M.has=function(n,t){return n?Zt.call(n,t):a},M.identity=At,M.indexOf=jt,M.isArguments=function(n){return re.call(n)==x},M.isArray=he,M.isBoolean=function(n){return n===r||n===a||re.call(n)==N},M.isDate=function(n){return n instanceof Tt||re.call(n)==E},M.isElement=function(n){return n?1===n.nodeType:a},M.isEmpty=function(n){var t=r;if(!n)return t;var e=re.call(n),u=n.length;return e==O||e==$||e==x||e==S&&typeof u=="number"&&ut(n.splice)?!u:(q(n,function(){return t=a}),t)},M.isEqual=rt,M.isFinite=function(n){return oe(n)&&!ie(parseFloat(n))
},M.isFunction=ut,M.isNaN=function(n){return ot(n)&&n!=+n},M.isNull=function(n){return n===u},M.isNumber=ot,M.isObject=at,M.isPlainObject=f,M.isRegExp=function(n){return n instanceof Kt||re.call(n)==A},M.isString=it,M.isUndefined=function(n){return typeof n=="undefined"},M.lastIndexOf=function(n,t,e){var r=n?n.length:0;for(typeof e=="number"&&(r=(0>e?ce(0,r+e):le(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},M.mixin=$t,M.noConflict=function(){return o._=Ht,this},M.parseInt=Rt,M.random=function(n,t){return n==u&&t==u&&(t=1),n=+n||0,t==u&&(t=n,n=0),n+Xt(se()*((+t||0)-n+1))
},M.reduce=bt,M.reduceRight=dt,M.result=function(n,t){var r=n?n[t]:e;return ut(r)?n[t]():r},M.runInContext=t,M.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:me(n).length},M.some=_t,M.sortedIndex=Ot,M.template=function(n,t,u){var a=M.templateSettings;n||(n=""),u=z({},u,a);var o,i=z({},u.imports,a.imports),a=me(i),i=ct(i),f=0,c=u.interpolate||k,l="__p+='",c=Kt((u.escape||k).source+"|"+c.source+"|"+(c===d?m:k).source+"|"+(u.evaluate||k).source+"|$","g");n.replace(c,function(t,e,u,a,i,c){return u||(u=a),l+=n.slice(f,c).replace(C,J),e&&(l+="'+__e("+e+")+'"),i&&(o=r,l+="';"+i+";__p+='"),u&&(l+="'+((__t=("+u+"))==null?'':__t)+'"),f=c+t.length,t
}),l+="';\n",c=u=u.variable,c||(u="obj",l="with("+u+"){"+l+"}"),l=(o?l.replace(v,""):l).replace(g,"$1").replace(y,"$1;"),l="function("+u+"){"+(c?"":u+"||("+u+"={});")+"var __t,__p='',__e=_.escape"+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+l+"return __p}";try{var p=qt(a,"return "+l).apply(e,i)}catch(s){throw s.source=l,s}return t?p(t):(p.source=l,p)},M.unescape=function(n){return n==u?"":Mt(n).replace(h,Z)},M.uniqueId=function(n){var t=++c;return Mt(n==u?"":n)+t
},M.all=pt,M.any=_t,M.detect=vt,M.foldl=bt,M.foldr=dt,M.include=lt,M.inject=bt,q(M,function(n,t){M.prototype[t]||(M.prototype[t]=function(){var t=[this.__wrapped__];return ne.apply(t,arguments),n.apply(M,t)})}),M.first=wt,M.last=function(n,t,e){if(n){var r=0,a=n.length;if(typeof t!="number"&&t!=u){var o=a;for(t=M.createCallback(t,e);o--&&t(n[o],o,n);)r++}else if(r=t,r==u||e)return n[a-1];return Y(n,ce(0,a-r))}},M.take=wt,M.head=wt,q(M,function(n,t){M.prototype[t]||(M.prototype[t]=function(t,e){var r=n(this.__wrapped__,t,e);
return t==u||e&&typeof t!="function"?r:new Q(r)})}),M.VERSION="1.1.1",M.prototype.toString=function(){return Mt(this.__wrapped__)},M.prototype.value=Bt,M.prototype.valueOf=Bt,gt(["join","pop","shift"],function(n){var t=Vt[n];M.prototype[n]=function(){return t.apply(this.__wrapped__,arguments)}}),gt(["push","reverse","sort","unshift"],function(n){var t=Vt[n];M.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),gt(["concat","slice","splice"],function(n){var t=Vt[n];M.prototype[n]=function(){return new Q(t.apply(this.__wrapped__,arguments))
}}),M}var e,r=!0,u=null,a=!1,o=typeof exports=="object"&&exports,i=typeof module=="object"&&module&&module.exports==o&&module,f=typeof global=="object"&&global;(f.global===f||f.window===f)&&(n=f);var c=0,l={},p=+new Date+"",s=200,v=/\b__p\+='';/g,g=/\b(__p\+=)''\+/g,y=/(__e\(.*?\)|\b__t\))\+'';/g,h=/&(?:amp|lt|gt|quot|#39);/g,m=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,b=/\w*$/,d=/<%=([\s\S]+?)%>/g,_=/^0+(?=.$)/,k=/($^)/,w=/[&<>"']/g,C=/['\n\r\t\u2028\u2029\\]/g,j="Array Boolean Date Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),x="[object Arguments]",O="[object Array]",N="[object Boolean]",E="[object Date]",I="[object Number]",S="[object Object]",A="[object RegExp]",$="[object String]",B={"[object Function]":a};
B[x]=B[O]=B[N]=B[E]=B[I]=B[S]=B[A]=B[$]=r;var F={"boolean":a,"function":r,object:r,number:a,string:a,undefined:a},R={"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"},T=t();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=T,define(function(){return T})):o&&!o.nodeType?i?(i.exports=T)._=T:o._=T:n._=T})(this);