/project/dexter-server/public/js/ng-lodash.js
JavaScript | 1040 lines | 1019 code | 0 blank | 21 comment | 0 complexity | ed575485fdbda6b65dc81eab01e8d343 MD5 | raw file
- /**
- * @license
- * lodash 3.8.0 (Custom Build) <https://lodash.com/>
- * Build: `lodash modern exports="amd,commonjs,node" iife="angular.module('ngLodash', []).constant('lodash', null).config(function ($provide) { %output% $provide.constant('lodash', _);});" --output build/ng-lodash.js`
- * Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
- * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
- * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
- * Available under MIT license <https://lodash.com/license>
- */
- angular.module('ngLodash', []).constant('lodash', null).config([
- '$provide',
- function ($provide) {
- /** Used as a safe reference for `undefined` in pre-ES5 environments. */
- var undefined;
- /** Used as the semantic version number. */
- var VERSION = '3.8.0';
- /** Used to compose bitmasks for wrapper metadata. */
- var BIND_FLAG = 1, BIND_KEY_FLAG = 2, CURRY_BOUND_FLAG = 4, CURRY_FLAG = 8, CURRY_RIGHT_FLAG = 16, PARTIAL_FLAG = 32, PARTIAL_RIGHT_FLAG = 64, ARY_FLAG = 128, REARG_FLAG = 256;
- /** Used as default options for `_.trunc`. */
- var DEFAULT_TRUNC_LENGTH = 30, DEFAULT_TRUNC_OMISSION = '...';
- /** Used to detect when a function becomes hot. */
- var HOT_COUNT = 150, HOT_SPAN = 16;
- /** Used to indicate the type of lazy iteratees. */
- var LAZY_DROP_WHILE_FLAG = 0, LAZY_FILTER_FLAG = 1, LAZY_MAP_FLAG = 2;
- /** Used as the `TypeError` message for "Functions" methods. */
- var FUNC_ERROR_TEXT = 'Expected a function';
- /** Used as the internal argument placeholder. */
- var PLACEHOLDER = '__lodash_placeholder__';
- /** `Object#toString` result references. */
- var argsTag = '[object Arguments]', arrayTag = '[object Array]', boolTag = '[object Boolean]', dateTag = '[object Date]', errorTag = '[object Error]', funcTag = '[object Function]', mapTag = '[object Map]', numberTag = '[object Number]', objectTag = '[object Object]', regexpTag = '[object RegExp]', setTag = '[object Set]', stringTag = '[object String]', weakMapTag = '[object WeakMap]';
- var arrayBufferTag = '[object ArrayBuffer]', float32Tag = '[object Float32Array]', float64Tag = '[object Float64Array]', int8Tag = '[object Int8Array]', int16Tag = '[object Int16Array]', int32Tag = '[object Int32Array]', uint8Tag = '[object Uint8Array]', uint8ClampedTag = '[object Uint8ClampedArray]', uint16Tag = '[object Uint16Array]', uint32Tag = '[object Uint32Array]';
- /** Used to match empty string literals in compiled template source. */
- var reEmptyStringLeading = /\b__p \+= '';/g, reEmptyStringMiddle = /\b(__p \+=) '' \+/g, reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
- /** Used to match HTML entities and HTML characters. */
- var reEscapedHtml = /&(?:amp|lt|gt|quot|#39|#96);/g, reUnescapedHtml = /[&<>"'`]/g, reHasEscapedHtml = RegExp(reEscapedHtml.source), reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
- /** Used to match template delimiters. */
- var reEscape = /<%-([\s\S]+?)%>/g, reEvaluate = /<%([\s\S]+?)%>/g, reInterpolate = /<%=([\s\S]+?)%>/g;
- /** Used to match property names within property paths. */
- var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\n\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/, rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\n\\]|\\.)*?)\2)\]/g;
- /**
- * Used to match `RegExp` [special characters](http://www.regular-expressions.info/characters.html#special).
- * In addition to special characters the forward slash is escaped to allow for
- * easier `eval` use and `Function` compilation.
- */
- var reRegExpChars = /[.*+?^${}()|[\]\/\\]/g, reHasRegExpChars = RegExp(reRegExpChars.source);
- /** Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks). */
- var reComboMark = /[\u0300-\u036f\ufe20-\ufe23]/g;
- /** Used to match backslashes in property paths. */
- var reEscapeChar = /\\(\\)?/g;
- /** Used to match [ES template delimiters](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-template-literal-lexical-components). */
- var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
- /** Used to match `RegExp` flags from their coerced string values. */
- var reFlags = /\w*$/;
- /** Used to detect hexadecimal string values. */
- var reHasHexPrefix = /^0[xX]/;
- /** Used to detect host constructors (Safari > 5). */
- var reIsHostCtor = /^\[object .+?Constructor\]$/;
- /** Used to match latin-1 supplementary letters (excluding mathematical operators). */
- var reLatin1 = /[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g;
- /** Used to ensure capturing order of template delimiters. */
- var reNoMatch = /($^)/;
- /** Used to match unescaped characters in compiled string literals. */
- var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
- /** Used to match words to create compound words. */
- var reWords = function () {
- var upper = '[A-Z\\xc0-\\xd6\\xd8-\\xde]', lower = '[a-z\\xdf-\\xf6\\xf8-\\xff]+';
- return RegExp(upper + '+(?=' + upper + lower + ')|' + upper + '?' + lower + '|' + upper + '+|[0-9]+', 'g');
- }();
- /** Used to detect and test for whitespace. */
- var whitespace = ' \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';
- /** Used to assign default `context` object properties. */
- var contextProps = [
- 'Array',
- 'ArrayBuffer',
- 'Date',
- 'Error',
- 'Float32Array',
- 'Float64Array',
- 'Function',
- 'Int8Array',
- 'Int16Array',
- 'Int32Array',
- 'Math',
- 'Number',
- 'Object',
- 'RegExp',
- 'Set',
- 'String',
- '_',
- 'clearTimeout',
- 'document',
- 'isFinite',
- 'parseInt',
- 'setTimeout',
- 'TypeError',
- 'Uint8Array',
- 'Uint8ClampedArray',
- 'Uint16Array',
- 'Uint32Array',
- 'WeakMap',
- 'window'
- ];
- /** Used to make template sourceURLs easier to identify. */
- var templateCounter = -1;
- /** Used to identify `toStringTag` values of typed arrays. */
- var typedArrayTags = {};
- typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
- typedArrayTags[argsTag] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;
- /** Used to identify `toStringTag` values supported by `_.clone`. */
- var cloneableTags = {};
- cloneableTags[argsTag] = cloneableTags[arrayTag] = cloneableTags[arrayBufferTag] = cloneableTags[boolTag] = cloneableTags[dateTag] = cloneableTags[float32Tag] = cloneableTags[float64Tag] = cloneableTags[int8Tag] = cloneableTags[int16Tag] = cloneableTags[int32Tag] = cloneableTags[numberTag] = cloneableTags[objectTag] = cloneableTags[regexpTag] = cloneableTags[stringTag] = cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
- cloneableTags[errorTag] = cloneableTags[funcTag] = cloneableTags[mapTag] = cloneableTags[setTag] = cloneableTags[weakMapTag] = false;
- /** Used as an internal `_.debounce` options object by `_.throttle`. */
- var debounceOptions = {
- 'leading': false,
- 'maxWait': 0,
- 'trailing': false
- };
- /** Used to map latin-1 supplementary letters to basic latin letters. */
- var deburredLetters = {
- '\xc0': 'A',
- '\xc1': 'A',
- '\xc2': 'A',
- '\xc3': 'A',
- '\xc4': 'A',
- '\xc5': 'A',
- '\xe0': 'a',
- '\xe1': 'a',
- '\xe2': 'a',
- '\xe3': 'a',
- '\xe4': 'a',
- '\xe5': 'a',
- '\xc7': 'C',
- '\xe7': 'c',
- '\xd0': 'D',
- '\xf0': 'd',
- '\xc8': 'E',
- '\xc9': 'E',
- '\xca': 'E',
- '\xcb': 'E',
- '\xe8': 'e',
- '\xe9': 'e',
- '\xea': 'e',
- '\xeb': 'e',
- '\xcc': 'I',
- '\xcd': 'I',
- '\xce': 'I',
- '\xcf': 'I',
- '\xec': 'i',
- '\xed': 'i',
- '\xee': 'i',
- '\xef': 'i',
- '\xd1': 'N',
- '\xf1': 'n',
- '\xd2': 'O',
- '\xd3': 'O',
- '\xd4': 'O',
- '\xd5': 'O',
- '\xd6': 'O',
- '\xd8': 'O',
- '\xf2': 'o',
- '\xf3': 'o',
- '\xf4': 'o',
- '\xf5': 'o',
- '\xf6': 'o',
- '\xf8': 'o',
- '\xd9': 'U',
- '\xda': 'U',
- '\xdb': 'U',
- '\xdc': 'U',
- '\xf9': 'u',
- '\xfa': 'u',
- '\xfb': 'u',
- '\xfc': 'u',
- '\xdd': 'Y',
- '\xfd': 'y',
- '\xff': 'y',
- '\xc6': 'Ae',
- '\xe6': 'ae',
- '\xde': 'Th',
- '\xfe': 'th',
- '\xdf': 'ss'
- };
- /** Used to map characters to HTML entities. */
- var htmlEscapes = {
- '&': '&',
- '<': '<',
- '>': '>',
- '"': '"',
- '\'': ''',
- '`': '`'
- };
- /** Used to map HTML entities to characters. */
- var htmlUnescapes = {
- '&': '&',
- '<': '<',
- '>': '>',
- '"': '"',
- ''': '\'',
- '`': '`'
- };
- /** Used to determine if values are of the language type `Object`. */
- var objectTypes = {
- 'function': true,
- 'object': true
- };
- /** Used to escape characters for inclusion in compiled string literals. */
- var stringEscapes = {
- '\\': '\\',
- '\'': '\'',
- '\n': 'n',
- '\r': 'r',
- '\u2028': 'u2028',
- '\u2029': 'u2029'
- };
- /** Detect free variable `exports`. */
- var freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports;
- /** Detect free variable `module`. */
- var freeModule = objectTypes[typeof module] && module && !module.nodeType && module;
- /** Detect free variable `global` from Node.js. */
- var freeGlobal = freeExports && freeModule && typeof global == 'object' && global && global.Object && global;
- /** Detect free variable `self`. */
- var freeSelf = objectTypes[typeof self] && self && self.Object && self;
- /** Detect free variable `window`. */
- var freeWindow = objectTypes[typeof window] && window && window.Object && window;
- /** Detect the popular CommonJS extension `module.exports`. */
- var moduleExports = freeModule && freeModule.exports === freeExports && freeExports;
- /**
- * Used as a reference to the global object.
- *
- * The `this` value is used if it is the global object to avoid Greasemonkey's
- * restricted `window` object, otherwise the `window` object is used.
- */
- var root = freeGlobal || freeWindow !== (this && this.window) && freeWindow || freeSelf || this;
- /**
- * The base implementation of `compareAscending` which compares values and
- * sorts them in ascending order without guaranteeing a stable sort.
- *
- * @private
- * @param {*} value The value to compare to `other`.
- * @param {*} other The value to compare to `value`.
- * @returns {number} Returns the sort order indicator for `value`.
- */
- function baseCompareAscending(value, other) {
- if (value !== other) {
- var valIsReflexive = value === value, othIsReflexive = other === other;
- if (value > other || !valIsReflexive || value === undefined && othIsReflexive) {
- return 1;
- }
- if (value < other || !othIsReflexive || other === undefined && valIsReflexive) {
- return -1;
- }
- }
- return 0;
- }
- /**
- * The base implementation of `_.findIndex` and `_.findLastIndex` without
- * support for callback shorthands and `this` binding.
- *
- * @private
- * @param {Array} array The array to search.
- * @param {Function} predicate The function invoked per iteration.
- * @param {boolean} [fromRight] Specify iterating from right to left.
- * @returns {number} Returns the index of the matched value, else `-1`.
- */
- function baseFindIndex(array, predicate, fromRight) {
- var length = array.length, index = fromRight ? length : -1;
- while (fromRight ? index-- : ++index < length) {
- if (predicate(array[index], index, array)) {
- return index;
- }
- }
- return -1;
- }
- /**
- * The base implementation of `_.indexOf` without support for binary searches.
- *
- * @private
- * @param {Array} array The array to search.
- * @param {*} value The value to search for.
- * @param {number} fromIndex The index to search from.
- * @returns {number} Returns the index of the matched value, else `-1`.
- */
- function baseIndexOf(array, value, fromIndex) {
- if (value !== value) {
- return indexOfNaN(array, fromIndex);
- }
- var index = fromIndex - 1, length = array.length;
- while (++index < length) {
- if (array[index] === value) {
- return index;
- }
- }
- return -1;
- }
- /**
- * The base implementation of `_.isFunction` without support for environments
- * with incorrect `typeof` results.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
- */
- function baseIsFunction(value) {
- // Avoid a Chakra JIT bug in compatibility modes of IE 11.
- // See https://github.com/jashkenas/underscore/issues/1621 for more details.
- return typeof value == 'function' || false;
- }
- /**
- * Converts `value` to a string if it is not one. An empty string is returned
- * for `null` or `undefined` values.
- *
- * @private
- * @param {*} value The value to process.
- * @returns {string} Returns the string.
- */
- function baseToString(value) {
- if (typeof value == 'string') {
- return value;
- }
- return value == null ? '' : value + '';
- }
- /**
- * Used by `_.max` and `_.min` as the default callback for string values.
- *
- * @private
- * @param {string} string The string to inspect.
- * @returns {number} Returns the code unit of the first character of the string.
- */
- function charAtCallback(string) {
- return string.charCodeAt(0);
- }
- /**
- * Used by `_.trim` and `_.trimLeft` to get the index of the first character
- * of `string` that is not found in `chars`.
- *
- * @private
- * @param {string} string The string to inspect.
- * @param {string} chars The characters to find.
- * @returns {number} Returns the index of the first character not found in `chars`.
- */
- function charsLeftIndex(string, chars) {
- var index = -1, length = string.length;
- while (++index < length && chars.indexOf(string.charAt(index)) > -1) {
- }
- return index;
- }
- /**
- * Used by `_.trim` and `_.trimRight` to get the index of the last character
- * of `string` that is not found in `chars`.
- *
- * @private
- * @param {string} string The string to inspect.
- * @param {string} chars The characters to find.
- * @returns {number} Returns the index of the last character not found in `chars`.
- */
- function charsRightIndex(string, chars) {
- var index = string.length;
- while (index-- && chars.indexOf(string.charAt(index)) > -1) {
- }
- return index;
- }
- /**
- * Used by `_.sortBy` to compare transformed elements of a collection and stable
- * sort them in ascending order.
- *
- * @private
- * @param {Object} object The object to compare to `other`.
- * @param {Object} other The object to compare to `object`.
- * @returns {number} Returns the sort order indicator for `object`.
- */
- function compareAscending(object, other) {
- return baseCompareAscending(object.criteria, other.criteria) || object.index - other.index;
- }
- /**
- * Used by `_.sortByOrder` to compare multiple properties of each element
- * in a collection and stable sort them in the following order:
- *
- * If `orders` is unspecified, sort in ascending order for all properties.
- * Otherwise, for each property, sort in ascending order if its corresponding value in
- * orders is true, and descending order if false.
- *
- * @private
- * @param {Object} object The object to compare to `other`.
- * @param {Object} other The object to compare to `object`.
- * @param {boolean[]} orders The order to sort by for each property.
- * @returns {number} Returns the sort order indicator for `object`.
- */
- function compareMultiple(object, other, orders) {
- var index = -1, objCriteria = object.criteria, othCriteria = other.criteria, length = objCriteria.length, ordersLength = orders.length;
- while (++index < length) {
- var result = baseCompareAscending(objCriteria[index], othCriteria[index]);
- if (result) {
- if (index >= ordersLength) {
- return result;
- }
- return result * (orders[index] ? 1 : -1);
- }
- }
- // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
- // that causes it, under certain circumstances, to provide the same value for
- // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
- // for more details.
- //
- // This also ensures a stable sort in V8 and other engines.
- // See https://code.google.com/p/v8/issues/detail?id=90 for more details.
- return object.index - other.index;
- }
- /**
- * Used by `_.deburr` to convert latin-1 supplementary letters to basic latin letters.
- *
- * @private
- * @param {string} letter The matched letter to deburr.
- * @returns {string} Returns the deburred letter.
- */
- function deburrLetter(letter) {
- return deburredLetters[letter];
- }
- /**
- * Used by `_.escape` to convert characters to HTML entities.
- *
- * @private
- * @param {string} chr The matched character to escape.
- * @returns {string} Returns the escaped character.
- */
- function escapeHtmlChar(chr) {
- return htmlEscapes[chr];
- }
- /**
- * Used by `_.template` to escape characters for inclusion in compiled
- * string literals.
- *
- * @private
- * @param {string} chr The matched character to escape.
- * @returns {string} Returns the escaped character.
- */
- function escapeStringChar(chr) {
- return '\\' + stringEscapes[chr];
- }
- /**
- * Gets the index at which the first occurrence of `NaN` is found in `array`.
- *
- * @private
- * @param {Array} array The array to search.
- * @param {number} fromIndex The index to search from.
- * @param {boolean} [fromRight] Specify iterating from right to left.
- * @returns {number} Returns the index of the matched `NaN`, else `-1`.
- */
- function indexOfNaN(array, fromIndex, fromRight) {
- var length = array.length, index = fromIndex + (fromRight ? 0 : -1);
- while (fromRight ? index-- : ++index < length) {
- var other = array[index];
- if (other !== other) {
- return index;
- }
- }
- return -1;
- }
- /**
- * Checks if `value` is object-like.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
- */
- function isObjectLike(value) {
- return !!value && typeof value == 'object';
- }
- /**
- * Used by `trimmedLeftIndex` and `trimmedRightIndex` to determine if a
- * character code is whitespace.
- *
- * @private
- * @param {number} charCode The character code to inspect.
- * @returns {boolean} Returns `true` if `charCode` is whitespace, else `false`.
- */
- function isSpace(charCode) {
- return charCode <= 160 && (charCode >= 9 && charCode <= 13) || charCode == 32 || charCode == 160 || charCode == 5760 || charCode == 6158 || charCode >= 8192 && (charCode <= 8202 || charCode == 8232 || charCode == 8233 || charCode == 8239 || charCode == 8287 || charCode == 12288 || charCode == 65279);
- }
- /**
- * Replaces all `placeholder` elements in `array` with an internal placeholder
- * and returns an array of their indexes.
- *
- * @private
- * @param {Array} array The array to modify.
- * @param {*} placeholder The placeholder to replace.
- * @returns {Array} Returns the new array of placeholder indexes.
- */
- function replaceHolders(array, placeholder) {
- var index = -1, length = array.length, resIndex = -1, result = [];
- while (++index < length) {
- if (array[index] === placeholder) {
- array[index] = PLACEHOLDER;
- result[++resIndex] = index;
- }
- }
- return result;
- }
- /**
- * An implementation of `_.uniq` optimized for sorted arrays without support
- * for callback shorthands and `this` binding.
- *
- * @private
- * @param {Array} array The array to inspect.
- * @param {Function} [iteratee] The function invoked per iteration.
- * @returns {Array} Returns the new duplicate-value-free array.
- */
- function sortedUniq(array, iteratee) {
- var seen, index = -1, length = array.length, resIndex = -1, result = [];
- while (++index < length) {
- var value = array[index], computed = iteratee ? iteratee(value, index, array) : value;
- if (!index || seen !== computed) {
- seen = computed;
- result[++resIndex] = value;
- }
- }
- return result;
- }
- /**
- * Used by `_.trim` and `_.trimLeft` to get the index of the first non-whitespace
- * character of `string`.
- *
- * @private
- * @param {string} string The string to inspect.
- * @returns {number} Returns the index of the first non-whitespace character.
- */
- function trimmedLeftIndex(string) {
- var index = -1, length = string.length;
- while (++index < length && isSpace(string.charCodeAt(index))) {
- }
- return index;
- }
- /**
- * Used by `_.trim` and `_.trimRight` to get the index of the last non-whitespace
- * character of `string`.
- *
- * @private
- * @param {string} string The string to inspect.
- * @returns {number} Returns the index of the last non-whitespace character.
- */
- function trimmedRightIndex(string) {
- var index = string.length;
- while (index-- && isSpace(string.charCodeAt(index))) {
- }
- return index;
- }
- /**
- * Used by `_.unescape` to convert HTML entities to characters.
- *
- * @private
- * @param {string} chr The matched character to unescape.
- * @returns {string} Returns the unescaped character.
- */
- function unescapeHtmlChar(chr) {
- return htmlUnescapes[chr];
- }
- /**
- * Create a new pristine `lodash` function using the given `context` object.
- *
- * @static
- * @memberOf _
- * @category Utility
- * @param {Object} [context=root] The context object.
- * @returns {Function} Returns a new `lodash` function.
- * @example
- *
- * _.mixin({ 'foo': _.constant('foo') });
- *
- * var lodash = _.runInContext();
- * lodash.mixin({ 'bar': lodash.constant('bar') });
- *
- * _.isFunction(_.foo);
- * // => true
- * _.isFunction(_.bar);
- * // => false
- *
- * lodash.isFunction(lodash.foo);
- * // => false
- * lodash.isFunction(lodash.bar);
- * // => true
- *
- * // using `context` to mock `Date#getTime` use in `_.now`
- * var mock = _.runInContext({
- * 'Date': function() {
- * return { 'getTime': getTimeMock };
- * }
- * });
- *
- * // or creating a suped-up `defer` in Node.js
- * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
- */
- function runInContext(context) {
- // Avoid issues with some ES3 environments that attempt to use values, named
- // after built-in constructors like `Object`, for the creation of literals.
- // ES5 clears this up by stating that literals must use built-in constructors.
- // See https://es5.github.io/#x11.1.5 for more details.
- context = context ? _.defaults(root.Object(), context, _.pick(root, contextProps)) : root;
- /** Native constructor references. */
- var Array = context.Array, Date = context.Date, Error = context.Error, Function = context.Function, Math = context.Math, Number = context.Number, Object = context.Object, RegExp = context.RegExp, String = context.String, TypeError = context.TypeError;
- /** Used for native method references. */
- var arrayProto = Array.prototype, objectProto = Object.prototype, stringProto = String.prototype;
- /** Used to detect DOM support. */
- var document = (document = context.window) && document.document;
- /** Used to resolve the decompiled source of functions. */
- var fnToString = Function.prototype.toString;
- /** Used to check objects for own properties. */
- var hasOwnProperty = objectProto.hasOwnProperty;
- /** Used to generate unique IDs. */
- var idCounter = 0;
- /**
- * Used to resolve the [`toStringTag`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring)
- * of values.
- */
- var objToString = objectProto.toString;
- /** Used to restore the original `_` reference in `_.noConflict`. */
- var oldDash = context._;
- /** Used to detect if a method is native. */
- var reIsNative = RegExp('^' + escapeRegExp(objToString).replace(/toString|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$');
- /** Native method references. */
- var ArrayBuffer = isNative(ArrayBuffer = context.ArrayBuffer) && ArrayBuffer, bufferSlice = isNative(bufferSlice = ArrayBuffer && new ArrayBuffer(0).slice) && bufferSlice, ceil = Math.ceil, clearTimeout = context.clearTimeout, floor = Math.floor, getOwnPropertySymbols = isNative(getOwnPropertySymbols = Object.getOwnPropertySymbols) && getOwnPropertySymbols, getPrototypeOf = isNative(getPrototypeOf = Object.getPrototypeOf) && getPrototypeOf, push = arrayProto.push, preventExtensions = isNative(preventExtensions = Object.preventExtensions) && preventExtensions, propertyIsEnumerable = objectProto.propertyIsEnumerable, Set = isNative(Set = context.Set) && Set, setTimeout = context.setTimeout, splice = arrayProto.splice, Uint8Array = isNative(Uint8Array = context.Uint8Array) && Uint8Array, WeakMap = isNative(WeakMap = context.WeakMap) && WeakMap;
- /** Used to clone array buffers. */
- var Float64Array = function () {
- // Safari 5 errors when using an array buffer to initialize a typed array
- // where the array buffer's `byteLength` is not a multiple of the typed
- // array's `BYTES_PER_ELEMENT`.
- try {
- var func = isNative(func = context.Float64Array) && func, result = new func(new ArrayBuffer(10), 0, 1) && func;
- } catch (e) {
- }
- return result;
- }();
- /** Used as `baseAssign`. */
- var nativeAssign = function () {
- // Avoid `Object.assign` in Firefox 34-37 which have an early implementation
- // with a now defunct try/catch behavior. See https://bugzilla.mozilla.org/show_bug.cgi?id=1103344
- // for more details.
- //
- // Use `Object.preventExtensions` on a plain object instead of simply using
- // `Object('x')` because Chrome and IE fail to throw an error when attempting
- // to assign values to readonly indexes of strings.
- var func = preventExtensions && isNative(func = Object.assign) && func;
- try {
- if (func) {
- var object = preventExtensions({ '1': 0 });
- object[0] = 1;
- }
- } catch (e) {
- // Only attempt in strict mode.
- try {
- func(object, 'xo');
- } catch (e) {
- }
- return !object[1] && func;
- }
- return false;
- }();
- /* Native method references for those with the same name as other `lodash` methods. */
- var nativeIsArray = isNative(nativeIsArray = Array.isArray) && nativeIsArray, nativeCreate = isNative(nativeCreate = Object.create) && nativeCreate, nativeIsFinite = context.isFinite, nativeKeys = isNative(nativeKeys = Object.keys) && nativeKeys, nativeMax = Math.max, nativeMin = Math.min, nativeNow = isNative(nativeNow = Date.now) && nativeNow, nativeNumIsFinite = isNative(nativeNumIsFinite = Number.isFinite) && nativeNumIsFinite, nativeParseInt = context.parseInt, nativeRandom = Math.random;
- /** Used as references for `-Infinity` and `Infinity`. */
- var NEGATIVE_INFINITY = Number.NEGATIVE_INFINITY, POSITIVE_INFINITY = Number.POSITIVE_INFINITY;
- /** Used as references for the maximum length and index of an array. */
- var MAX_ARRAY_LENGTH = Math.pow(2, 32) - 1, MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1, HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
- /** Used as the size, in bytes, of each `Float64Array` element. */
- var FLOAT64_BYTES_PER_ELEMENT = Float64Array ? Float64Array.BYTES_PER_ELEMENT : 0;
- /**
- * Used as the [maximum length](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.max_safe_integer)
- * of an array-like value.
- */
- var MAX_SAFE_INTEGER = Math.pow(2, 53) - 1;
- /** Used to store function metadata. */
- var metaMap = WeakMap && new WeakMap();
- /** Used to lookup unminified function names. */
- var realNames = {};
- /**
- * Creates a `lodash` object which wraps `value` to enable implicit chaining.
- * Methods that operate on and return arrays, collections, and functions can
- * be chained together. Methods that return a boolean or single value will
- * automatically end the chain returning the unwrapped value. Explicit chaining
- * may be enabled using `_.chain`. The execution of chained methods is lazy,
- * that is, execution is deferred until `_#value` is implicitly or explicitly
- * called.
- *
- * Lazy evaluation allows several methods to support shortcut fusion. Shortcut
- * fusion is an optimization that merges iteratees to avoid creating intermediate
- * arrays and reduce the number of iteratee executions.
- *
- * Chaining is supported in custom builds as long as the `_#value` method is
- * directly or indirectly included in the build.
- *
- * In addition to lodash methods, wrappers have `Array` and `String` methods.
- *
- * The wrapper `Array` methods are:
- * `concat`, `join`, `pop`, `push`, `reverse`, `shift`, `slice`, `sort`,
- * `splice`, and `unshift`
- *
- * The wrapper `String` methods are:
- * `replace` and `split`
- *
- * The wrapper methods that support shortcut fusion are:
- * `compact`, `drop`, `dropRight`, `dropRightWhile`, `dropWhile`, `filter`,
- * `first`, `initial`, `last`, `map`, `pluck`, `reject`, `rest`, `reverse`,
- * `slice`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, `toArray`,
- * and `where`
- *
- * The chainable wrapper methods are:
- * `after`, `ary`, `assign`, `at`, `before`, `bind`, `bindAll`, `bindKey`,
- * `callback`, `chain`, `chunk`, `commit`, `compact`, `concat`, `constant`,
- * `countBy`, `create`, `curry`, `debounce`, `defaults`, `defer`, `delay`,
- * `difference`, `drop`, `dropRight`, `dropRightWhile`, `dropWhile`, `fill`,
- * `filter`, `flatten`, `flattenDeep`, `flow`, `flowRight`, `forEach`,
- * `forEachRight`, `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `functions`,
- * `groupBy`, `indexBy`, `initial`, `intersection`, `invert`, `invoke`, `keys`,
- * `keysIn`, `map`, `mapValues`, `matches`, `matchesProperty`, `memoize`,
- * `merge`, `mixin`, `negate`, `omit`, `once`, `pairs`, `partial`, `partialRight`,
- * `partition`, `pick`, `plant`, `pluck`, `property`, `propertyOf`, `pull`,
- * `pullAt`, `push`, `range`, `rearg`, `reject`, `remove`, `rest`, `reverse`,
- * `shuffle`, `slice`, `sort`, `sortBy`, `sortByAll`, `sortByOrder`, `splice`,
- * `spread`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, `tap`,
- * `throttle`, `thru`, `times`, `toArray`, `toPlainObject`, `transform`,
- * `union`, `uniq`, `unshift`, `unzip`, `values`, `valuesIn`, `where`,
- * `without`, `wrap`, `xor`, `zip`, and `zipObject`
- *
- * The wrapper methods that are **not** chainable by default are:
- * `add`, `attempt`, `camelCase`, `capitalize`, `clone`, `cloneDeep`, `deburr`,
- * `endsWith`, `escape`, `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`,
- * `findLast`, `findLastIndex`, `findLastKey`, `findWhere`, `first`, `has`,
- * `identity`, `includes`, `indexOf`, `inRange`, `isArguments`, `isArray`,
- * `isBoolean`, `isDate`, `isElement`, `isEmpty`, `isEqual`, `isError`, `isFinite`
- * `isFunction`, `isMatch`, `isNative`, `isNaN`, `isNull`, `isNumber`, `isObject`,
- * `isPlainObject`, `isRegExp`, `isString`, `isUndefined`, `isTypedArray`,
- * `join`, `kebabCase`, `last`, `lastIndexOf`, `max`, `min`, `noConflict`,
- * `noop`, `now`, `pad`, `padLeft`, `padRight`, `parseInt`, `pop`, `random`,
- * `reduce`, `reduceRight`, `repeat`, `result`, `runInContext`, `shift`, `size`,
- * `snakeCase`, `some`, `sortedIndex`, `sortedLastIndex`, `startCase`, `startsWith`,
- * `sum`, `template`, `trim`, `trimLeft`, `trimRight`, `trunc`, `unescape`,
- * `uniqueId`, `value`, and `words`
- *
- * The wrapper method `sample` will return a wrapped value when `n` is provided,
- * otherwise an unwrapped value is returned.
- *
- * @name _
- * @constructor
- * @category Chain
- * @param {*} value The value to wrap in a `lodash` instance.
- * @returns {Object} Returns the new `lodash` wrapper instance.
- * @example
- *
- * var wrapped = _([1, 2, 3]);
- *
- * // returns an unwrapped value
- * wrapped.reduce(function(total, n) {
- * return total + n;
- * });
- * // => 6
- *
- * // returns a wrapped value
- * var squares = wrapped.map(function(n) {
- * return n * n;
- * });
- *
- * _.isArray(squares);
- * // => false
- *
- * _.isArray(squares.value());
- * // => true
- */
- function lodash(value) {
- if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
- if (value instanceof LodashWrapper) {
- return value;
- }
- if (hasOwnProperty.call(value, '__chain__') && hasOwnProperty.call(value, '__wrapped__')) {
- return wrapperClone(value);
- }
- }
- return new LodashWrapper(value);
- }
- /**
- * The function whose prototype all chaining wrappers inherit from.
- *
- * @private
- */
- function baseLodash() {
- }
- /**
- * The base constructor for creating `lodash` wrapper objects.
- *
- * @private
- * @param {*} value The value to wrap.
- * @param {boolean} [chainAll] Enable chaining for all wrapper methods.
- * @param {Array} [actions=[]] Actions to peform to resolve the unwrapped value.
- */
- function LodashWrapper(value, chainAll, actions) {
- this.__wrapped__ = value;
- this.__actions__ = actions || [];
- this.__chain__ = !!chainAll;
- }
- /**
- * An object environment feature flags.
- *
- * @static
- * @memberOf _
- * @type Object
- */
- var support = lodash.support = {};
- (function (x) {
- var Ctor = function () {
- this.x = x;
- }, args = arguments, object = {
- '0': x,
- 'length': x
- }, props = [];
- Ctor.prototype = {
- 'valueOf': x,
- 'y': x
- };
- for (var key in new Ctor()) {
- props.push(key);
- }
- /**
- * Detect if functions can be decompiled by `Function#toString`
- * (all but Firefox OS certified apps, older Opera mobile browsers, and
- * the PlayStation 3; forced `false` for Windows 8 apps).
- *
- * @memberOf _.support
- * @type boolean
- */
- support.funcDecomp = /\bthis\b/.test(function () {
- return this;
- });
- /**
- * Detect if `Function#name` is supported (all but IE).
- *
- * @memberOf _.support
- * @type boolean
- */
- support.funcNames = typeof Function.name == 'string';
- /**
- * Detect if the DOM is supported.
- *
- * @memberOf _.support
- * @type boolean
- */
- try {
- support.dom = document.createDocumentFragment().nodeType === 11;
- } catch (e) {
- support.dom = false;
- }
- /**
- * Detect if `arguments` object indexes are non-enumerable.
- *
- * In Firefox < 4, IE < 9, PhantomJS, and Safari < 5.1 `arguments` object
- * indexes are non-enumerable. Chrome < 25 and Node.js < 0.11.0 treat
- * `arguments` object indexes as non-enumerable and fail `hasOwnProperty`
- * checks for indexes that exceed the number of function parameters and
- * whose associated argument values are `0`.
- *
- * @memberOf _.support
- * @type boolean
- */
- try {
- support.nonEnumArgs = !propertyIsEnumerable.call(args, 1);
- } catch (e) {
- support.nonEnumArgs = true;
- }
- }(1, 0));
- /**
- * By default, the template delimiters used by lodash are like those in
- * embedded Ruby (ERB). Change the following template settings to use
- * alternative delimiters.
- *
- * @static
- * @memberOf _
- * @type Object
- */
- lodash.templateSettings = {
- 'escape': reEscape,
- 'evaluate': reEvaluate,
- 'interpolate': reInterpolate,
- 'variable': '',
- 'imports': { '_': lodash }
- };
- /**
- * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
- *
- * @private
- * @param {*} value The value to wrap.
- */
- function LazyWrapper(value) {
- this.__wrapped__ = value;
- this.__actions__ = null;
- this.__dir__ = 1;
- this.__dropCount__ = 0;
- this.__filtered__ = false;
- this.__iteratees__ = null;
- this.__takeCount__ = POSITIVE_INFINITY;
- this.__views__ = null;
- }
- /**
- * Creates a clone of the lazy wrapper object.
- *
- * @private
- * @name clone
- * @memberOf LazyWrapper
- * @returns {Object} Returns the cloned `LazyWrapper` object.
- */
- function lazyClone() {
- var actions = this.__actions__, iteratees = this.__iteratees__, views = this.__views__, result = new LazyWrapper(this.__wrapped__);
- result.__actions__ = actions ? arrayCopy(actions) : null;
- result.__dir__ = this.__dir__;
- result.__filtered__ = this.__filtered__;
- result.__iteratees__ = iteratees ? arrayCopy(iteratees) : null;
- result.__takeCount__ = this.__takeCount__;
- result.__views__ = views ? arrayCopy(views) : null;
- return result;
- }
- /**
- * Reverses the direction of lazy iteration.
- *
- * @private
- * @name reverse
- * @memberOf LazyWrapper
- * @returns {Object} Returns the new reversed `LazyWrapper` object.
- */
- function lazyReverse() {
- if (this.__filtered__) {
- var result = new LazyWrapper(this);
- result.__dir__ = -1;
- result.__filtered__ = true;
- } else {
- result = this.clone();
- result.__dir__ *= -1;
- }
- return result;
- }
- /**
- * Extracts the unwrapped value from its lazy wrapper.
- *
- * @private
- * @name value
- * @memberOf LazyWrapper
- * @returns {*} Returns the unwrapped value.
- */
- function lazyValue() {
- var array = this.__wrapped__.value();
- if (!isArray(array)) {
- return baseWrapperValue(array, this.__actions__);
- }
- var dir = this.__dir__, isRight = dir < 0, view = getView(0, array.length, this.__views__), start = view.start, end = view.end, length = end - start, index = isRight ? end : start - 1, takeCount = nativeMin(length, this.__takeCount__), iteratees = this.__iteratees__, iterLength = iteratees ? iteratees.length : 0, resIndex = 0, result = [];
- outer:
- while (length-- && resIndex < takeCount) {
- index += dir;
- var iterIndex = -1, value = array[index];
- while (++iterIndex < iterLength) {
- var data = iteratees[iterIndex], iteratee = data.iteratee, type = data.type;
- if (type == LAZY_DROP_WHILE_FLAG) {
- if (data.done && (isRight ? index > data.index : index < data.index)) {
- data.count = 0;
- data.done = false;
- }
- data.index = index;
- if (!data.done) {
- var limit = data.limit;
- if (!(data.done = limit > -1 ? data.count++ >= limit : !iteratee(value))) {
- continue outer;
- }
- }
- } else {
- var computed = iteratee(value);
- if (type == LAZY_MAP_FLAG) {
- value = computed;
- } else if (!computed) {
- if (type == LAZY_FILTER_FLAG) {
- continue outer;
- } else {
- break outer;
- }
- }
- }
- }
- result[resIndex++] = value;
- }
- return result;
- }
- /**
- * Creates a cache object to store key/value pairs.
- *
- * @private
- * @static
- * @name Cache
- * @memberOf _.memoize
- */
- function MapCache() {
- this.__data__ = {};
- }
- /**
- * Removes `key` and its value from the cache.
- *
- * @private
- * @name delete
- * @memberOf _.memoize.Cache
- * @param {string} key The key of the value to remove.
- * @returns {boolean} Returns `true` if the entry was removed successfully, else `false`.
- */
- function mapDelete(key) {
- return this.has(key) && delete this.__data__[key];
- }
- /**
- * Gets the cached value for `key`.
- *
- * @private
- * @name get
- * @memberOf _.memoize.Cache
- * @param {string} key The key of the value to get.
- * @returns {*} Returns the cached value.
- */
- function mapGet(key) {
- return key == '__proto__' ? undefined : this.__data__[key];
- }
- /**
- * Checks if a cached value for `key` exists.
- *
- * @private
- * @name has
- * @memberOf _.memoize.Cache
- * @param {string} key The key of the entry to check.
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
- */
- function mapHas(key) {
- return key != '__proto__' && hasOwnProperty.call(this.__data__, key);
- }
- /**
- * Sets `value` to `key` of the cache.
- *
- * @private
- * @name set
- * @memberOf _.memoize.Cache
- * @param {string} key The key of the value to cache.
- * @param {*} value The value to cache.
-