@ovh-ux/ng-ovh-sidebar-menu
Version:
Manage and display a left menu tree
6,615 lines • 231 kB
JavaScript
function cssInject801396187a774771(css) {
if (!css || typeof document === 'undefined') return '';
const head = document.head || document.getElementsByTagName('head')[0];
const style = document.createElement('style');
style.type = 'text/css';
if (style.styleSheet) {
// for IE
style.styleSheet.cssText = css;
} else {
style.appendChild(document.createTextNode(css));
}
head.appendChild(style);
return css;
}
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('angular'), require('@ovh-ux/ng-ovh-actions-menu'), require('@uirouter/angularjs'), require('angular-translate'), require('ng-slide-down')) :
typeof define === 'function' && define.amd ? define(['angular', '@ovh-ux/ng-ovh-actions-menu', '@uirouter/angularjs', 'angular-translate', 'ng-slide-down'], factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global["ng-ovh-sidebar-menu"] = factory(global.angular));
})(this, (function (angular) { 'use strict';
function ___$insertStyle(css) {
if (!css || typeof window === 'undefined') {
return;
}
const style = document.createElement('style');
style.setAttribute('type', 'text/css');
style.innerHTML = css;
document.head.appendChild(style);
return css;
}
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
var angular__default = /*#__PURE__*/_interopDefaultLegacy(angular);
function _typeof(o) {
"@babel/helpers - typeof";
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
return typeof o;
} : function (o) {
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
}, _typeof(o);
}
/** Detect free variable `global` from Node.js. */
var freeGlobal = (typeof global === "undefined" ? "undefined" : _typeof(global)) == 'object' && global && global.Object === Object && global;
var freeGlobal$1 = freeGlobal;
/** Detect free variable `self`. */
var freeSelf = (typeof self === "undefined" ? "undefined" : _typeof(self)) == 'object' && self && self.Object === Object && self;
/** Used as a reference to the global object. */
var root = freeGlobal$1 || freeSelf || Function('return this')();
var root$1 = root;
/** Built-in value references. */
var _Symbol = root$1.Symbol;
var _Symbol$1 = _Symbol;
/** Used for built-in method references. */
var objectProto$h = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty$e = objectProto$h.hasOwnProperty;
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
var nativeObjectToString$1 = objectProto$h.toString;
/** Built-in value references. */
var symToStringTag$1 = _Symbol$1 ? _Symbol$1.toStringTag : undefined;
/**
* A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
*
* @private
* @param {*} value The value to query.
* @returns {string} Returns the raw `toStringTag`.
*/
function getRawTag(value) {
var isOwn = hasOwnProperty$e.call(value, symToStringTag$1),
tag = value[symToStringTag$1];
try {
value[symToStringTag$1] = undefined;
var unmasked = true;
} catch (e) {}
var result = nativeObjectToString$1.call(value);
if (unmasked) {
if (isOwn) {
value[symToStringTag$1] = tag;
} else {
delete value[symToStringTag$1];
}
}
return result;
}
/** Used for built-in method references. */
var objectProto$g = Object.prototype;
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
var nativeObjectToString = objectProto$g.toString;
/**
* Converts `value` to a string using `Object.prototype.toString`.
*
* @private
* @param {*} value The value to convert.
* @returns {string} Returns the converted string.
*/
function objectToString(value) {
return nativeObjectToString.call(value);
}
/** `Object#toString` result references. */
var nullTag = '[object Null]',
undefinedTag = '[object Undefined]';
/** Built-in value references. */
var symToStringTag = _Symbol$1 ? _Symbol$1.toStringTag : undefined;
/**
* The base implementation of `getTag` without fallbacks for buggy environments.
*
* @private
* @param {*} value The value to query.
* @returns {string} Returns the `toStringTag`.
*/
function baseGetTag(value) {
if (value == null) {
return value === undefined ? undefinedTag : nullTag;
}
return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
}
/**
* Checks if `value` is object-like. A value is object-like if it's not `null`
* and has a `typeof` result of "object".
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
* @example
*
* _.isObjectLike({});
* // => true
*
* _.isObjectLike([1, 2, 3]);
* // => true
*
* _.isObjectLike(_.noop);
* // => false
*
* _.isObjectLike(null);
* // => false
*/
function isObjectLike(value) {
return value != null && _typeof(value) == 'object';
}
/** `Object#toString` result references. */
var symbolTag$3 = '[object Symbol]';
/**
* Checks if `value` is classified as a `Symbol` primitive or object.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
* @example
*
* _.isSymbol(Symbol.iterator);
* // => true
*
* _.isSymbol('abc');
* // => false
*/
function isSymbol(value) {
return _typeof(value) == 'symbol' || isObjectLike(value) && baseGetTag(value) == symbolTag$3;
}
/**
* A specialized version of `_.map` for arrays without support for iteratee
* shorthands.
*
* @private
* @param {Array} [array] The array to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Array} Returns the new mapped array.
*/
function arrayMap(array, iteratee) {
var index = -1,
length = array == null ? 0 : array.length,
result = Array(length);
while (++index < length) {
result[index] = iteratee(array[index], index, array);
}
return result;
}
/**
* Checks if `value` is classified as an `Array` object.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an array, else `false`.
* @example
*
* _.isArray([1, 2, 3]);
* // => true
*
* _.isArray(document.body.children);
* // => false
*
* _.isArray('abc');
* // => false
*
* _.isArray(_.noop);
* // => false
*/
var isArray = Array.isArray;
var isArray$1 = isArray;
/** Used as references for various `Number` constants. */
var INFINITY$2 = 1 / 0;
/** Used to convert symbols to primitives and strings. */
var symbolProto$2 = _Symbol$1 ? _Symbol$1.prototype : undefined,
symbolToString = symbolProto$2 ? symbolProto$2.toString : undefined;
/**
* The base implementation of `_.toString` which doesn't convert nullish
* values to empty strings.
*
* @private
* @param {*} value The value to process.
* @returns {string} Returns the string.
*/
function baseToString(value) {
// Exit early for strings to avoid a performance hit in some environments.
if (typeof value == 'string') {
return value;
}
if (isArray$1(value)) {
// Recursively convert values (susceptible to call stack limits).
return arrayMap(value, baseToString) + '';
}
if (isSymbol(value)) {
return symbolToString ? symbolToString.call(value) : '';
}
var result = value + '';
return result == '0' && 1 / value == -INFINITY$2 ? '-0' : result;
}
/** Used to match a single whitespace character. */
var reWhitespace = /\s/;
/**
* Used by `_.trim` and `_.trimEnd` 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 trimmedEndIndex(string) {
var index = string.length;
while (index-- && reWhitespace.test(string.charAt(index))) {}
return index;
}
/** Used to match leading whitespace. */
var reTrimStart = /^\s+/;
/**
* The base implementation of `_.trim`.
*
* @private
* @param {string} string The string to trim.
* @returns {string} Returns the trimmed string.
*/
function baseTrim(string) {
return string ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '') : string;
}
/**
* Checks if `value` is the
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
* @example
*
* _.isObject({});
* // => true
*
* _.isObject([1, 2, 3]);
* // => true
*
* _.isObject(_.noop);
* // => true
*
* _.isObject(null);
* // => false
*/
function isObject(value) {
var type = _typeof(value);
return value != null && (type == 'object' || type == 'function');
}
/** Used as references for various `Number` constants. */
var NAN = 0 / 0;
/** Used to detect bad signed hexadecimal string values. */
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
/** Used to detect binary string values. */
var reIsBinary = /^0b[01]+$/i;
/** Used to detect octal string values. */
var reIsOctal = /^0o[0-7]+$/i;
/** Built-in method references without a dependency on `root`. */
var freeParseInt = parseInt;
/**
* Converts `value` to a number.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to process.
* @returns {number} Returns the number.
* @example
*
* _.toNumber(3.2);
* // => 3.2
*
* _.toNumber(Number.MIN_VALUE);
* // => 5e-324
*
* _.toNumber(Infinity);
* // => Infinity
*
* _.toNumber('3.2');
* // => 3.2
*/
function toNumber(value) {
if (typeof value == 'number') {
return value;
}
if (isSymbol(value)) {
return NAN;
}
if (isObject(value)) {
var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
value = isObject(other) ? other + '' : other;
}
if (typeof value != 'string') {
return value === 0 ? value : +value;
}
value = baseTrim(value);
var isBinary = reIsBinary.test(value);
return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
}
/** Used as references for various `Number` constants. */
var INFINITY$1 = 1 / 0,
MAX_INTEGER = 1.7976931348623157e+308;
/**
* Converts `value` to a finite number.
*
* @static
* @memberOf _
* @since 4.12.0
* @category Lang
* @param {*} value The value to convert.
* @returns {number} Returns the converted number.
* @example
*
* _.toFinite(3.2);
* // => 3.2
*
* _.toFinite(Number.MIN_VALUE);
* // => 5e-324
*
* _.toFinite(Infinity);
* // => 1.7976931348623157e+308
*
* _.toFinite('3.2');
* // => 3.2
*/
function toFinite(value) {
if (!value) {
return value === 0 ? value : 0;
}
value = toNumber(value);
if (value === INFINITY$1 || value === -INFINITY$1) {
var sign = value < 0 ? -1 : 1;
return sign * MAX_INTEGER;
}
return value === value ? value : 0;
}
/**
* Converts `value` to an integer.
*
* **Note:** This method is loosely based on
* [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to convert.
* @returns {number} Returns the converted integer.
* @example
*
* _.toInteger(3.2);
* // => 3
*
* _.toInteger(Number.MIN_VALUE);
* // => 0
*
* _.toInteger(Infinity);
* // => 1.7976931348623157e+308
*
* _.toInteger('3.2');
* // => 3
*/
function toInteger(value) {
var result = toFinite(value),
remainder = result % 1;
return result === result ? remainder ? result - remainder : result : 0;
}
/**
* This method returns the first argument it receives.
*
* @static
* @since 0.1.0
* @memberOf _
* @category Util
* @param {*} value Any value.
* @returns {*} Returns `value`.
* @example
*
* var object = { 'a': 1 };
*
* console.log(_.identity(object) === object);
* // => true
*/
function identity(value) {
return value;
}
/** `Object#toString` result references. */
var asyncTag = '[object AsyncFunction]',
funcTag$2 = '[object Function]',
genTag$1 = '[object GeneratorFunction]',
proxyTag = '[object Proxy]';
/**
* Checks if `value` is classified as a `Function` object.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a function, else `false`.
* @example
*
* _.isFunction(_);
* // => true
*
* _.isFunction(/abc/);
* // => false
*/
function isFunction(value) {
if (!isObject(value)) {
return false;
}
// The use of `Object#toString` avoids issues with the `typeof` operator
// in Safari 9 which returns 'object' for typed arrays and other constructors.
var tag = baseGetTag(value);
return tag == funcTag$2 || tag == genTag$1 || tag == asyncTag || tag == proxyTag;
}
/** Used to detect overreaching core-js shims. */
var coreJsData = root$1['__core-js_shared__'];
var coreJsData$1 = coreJsData;
/** Used to detect methods masquerading as native. */
var maskSrcKey = function () {
var uid = /[^.]+$/.exec(coreJsData$1 && coreJsData$1.keys && coreJsData$1.keys.IE_PROTO || '');
return uid ? 'Symbol(src)_1.' + uid : '';
}();
/**
* Checks if `func` has its source masked.
*
* @private
* @param {Function} func The function to check.
* @returns {boolean} Returns `true` if `func` is masked, else `false`.
*/
function isMasked(func) {
return !!maskSrcKey && maskSrcKey in func;
}
/** Used for built-in method references. */
var funcProto$2 = Function.prototype;
/** Used to resolve the decompiled source of functions. */
var funcToString$2 = funcProto$2.toString;
/**
* Converts `func` to its source code.
*
* @private
* @param {Function} func The function to convert.
* @returns {string} Returns the source code.
*/
function toSource(func) {
if (func != null) {
try {
return funcToString$2.call(func);
} catch (e) {}
try {
return func + '';
} catch (e) {}
}
return '';
}
/**
* Used to match `RegExp`
* [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
*/
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
/** Used to detect host constructors (Safari). */
var reIsHostCtor = /^\[object .+?Constructor\]$/;
/** Used for built-in method references. */
var funcProto$1 = Function.prototype,
objectProto$f = Object.prototype;
/** Used to resolve the decompiled source of functions. */
var funcToString$1 = funcProto$1.toString;
/** Used to check objects for own properties. */
var hasOwnProperty$d = objectProto$f.hasOwnProperty;
/** Used to detect if a method is native. */
var reIsNative = RegExp('^' + funcToString$1.call(hasOwnProperty$d).replace(reRegExpChar, '\\$&').replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$');
/**
* The base implementation of `_.isNative` without bad shim checks.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a native function,
* else `false`.
*/
function baseIsNative(value) {
if (!isObject(value) || isMasked(value)) {
return false;
}
var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
return pattern.test(toSource(value));
}
/**
* Gets the value at `key` of `object`.
*
* @private
* @param {Object} [object] The object to query.
* @param {string} key The key of the property to get.
* @returns {*} Returns the property value.
*/
function getValue(object, key) {
return object == null ? undefined : object[key];
}
/**
* Gets the native function at `key` of `object`.
*
* @private
* @param {Object} object The object to query.
* @param {string} key The key of the method to get.
* @returns {*} Returns the function if it's native, else `undefined`.
*/
function getNative(object, key) {
var value = getValue(object, key);
return baseIsNative(value) ? value : undefined;
}
/* Built-in method references that are verified to be native. */
var WeakMap = getNative(root$1, 'WeakMap');
var WeakMap$1 = WeakMap;
/** Built-in value references. */
var objectCreate = Object.create;
/**
* The base implementation of `_.create` without support for assigning
* properties to the created object.
*
* @private
* @param {Object} proto The object to inherit from.
* @returns {Object} Returns the new object.
*/
var baseCreate = function () {
function object() {}
return function (proto) {
if (!isObject(proto)) {
return {};
}
if (objectCreate) {
return objectCreate(proto);
}
object.prototype = proto;
var result = new object();
object.prototype = undefined;
return result;
};
}();
var baseCreate$1 = baseCreate;
/**
* A faster alternative to `Function#apply`, this function invokes `func`
* with the `this` binding of `thisArg` and the arguments of `args`.
*
* @private
* @param {Function} func The function to invoke.
* @param {*} thisArg The `this` binding of `func`.
* @param {Array} args The arguments to invoke `func` with.
* @returns {*} Returns the result of `func`.
*/
function apply(func, thisArg, args) {
switch (args.length) {
case 0:
return func.call(thisArg);
case 1:
return func.call(thisArg, args[0]);
case 2:
return func.call(thisArg, args[0], args[1]);
case 3:
return func.call(thisArg, args[0], args[1], args[2]);
}
return func.apply(thisArg, args);
}
/**
* Copies the values of `source` to `array`.
*
* @private
* @param {Array} source The array to copy values from.
* @param {Array} [array=[]] The array to copy values to.
* @returns {Array} Returns `array`.
*/
function copyArray(source, array) {
var index = -1,
length = source.length;
array || (array = Array(length));
while (++index < length) {
array[index] = source[index];
}
return array;
}
/** Used to detect hot functions by number of calls within a span of milliseconds. */
var HOT_COUNT = 800,
HOT_SPAN = 16;
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeNow = Date.now;
/**
* Creates a function that'll short out and invoke `identity` instead
* of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
* milliseconds.
*
* @private
* @param {Function} func The function to restrict.
* @returns {Function} Returns the new shortable function.
*/
function shortOut(func) {
var count = 0,
lastCalled = 0;
return function () {
var stamp = nativeNow(),
remaining = HOT_SPAN - (stamp - lastCalled);
lastCalled = stamp;
if (remaining > 0) {
if (++count >= HOT_COUNT) {
return arguments[0];
}
} else {
count = 0;
}
return func.apply(undefined, arguments);
};
}
/**
* Creates a function that returns `value`.
*
* @static
* @memberOf _
* @since 2.4.0
* @category Util
* @param {*} value The value to return from the new function.
* @returns {Function} Returns the new constant function.
* @example
*
* var objects = _.times(2, _.constant({ 'a': 1 }));
*
* console.log(objects);
* // => [{ 'a': 1 }, { 'a': 1 }]
*
* console.log(objects[0] === objects[1]);
* // => true
*/
function constant(value) {
return function () {
return value;
};
}
var defineProperty = function () {
try {
var func = getNative(Object, 'defineProperty');
func({}, '', {});
return func;
} catch (e) {}
}();
var defineProperty$1 = defineProperty;
/**
* The base implementation of `setToString` without support for hot loop shorting.
*
* @private
* @param {Function} func The function to modify.
* @param {Function} string The `toString` result.
* @returns {Function} Returns `func`.
*/
var baseSetToString = !defineProperty$1 ? identity : function (func, string) {
return defineProperty$1(func, 'toString', {
'configurable': true,
'enumerable': false,
'value': constant(string),
'writable': true
});
};
var baseSetToString$1 = baseSetToString;
/**
* Sets the `toString` method of `func` to return `string`.
*
* @private
* @param {Function} func The function to modify.
* @param {Function} string The `toString` result.
* @returns {Function} Returns `func`.
*/
var setToString = shortOut(baseSetToString$1);
var setToString$1 = setToString;
/**
* A specialized version of `_.forEach` for arrays without support for
* iteratee shorthands.
*
* @private
* @param {Array} [array] The array to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Array} Returns `array`.
*/
function arrayEach(array, iteratee) {
var index = -1,
length = array == null ? 0 : array.length;
while (++index < length) {
if (iteratee(array[index], index, array) === false) {
break;
}
}
return array;
}
/**
* The base implementation of `_.findIndex` and `_.findLastIndex` without
* support for iteratee shorthands.
*
* @private
* @param {Array} array The array to inspect.
* @param {Function} predicate The function invoked per iteration.
* @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 value, else `-1`.
*/
function baseFindIndex(array, predicate, fromIndex, fromRight) {
var length = array.length,
index = fromIndex + (fromRight ? 1 : -1);
while (fromRight ? index-- : ++index < length) {
if (predicate(array[index], index, array)) {
return index;
}
}
return -1;
}
/**
* The base implementation of `_.isNaN` without support for number objects.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
*/
function baseIsNaN(value) {
return value !== value;
}
/**
* A specialized version of `_.indexOf` which performs strict equality
* comparisons of values, i.e. `===`.
*
* @private
* @param {Array} array The array to inspect.
* @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 strictIndexOf(array, value, fromIndex) {
var index = fromIndex - 1,
length = array.length;
while (++index < length) {
if (array[index] === value) {
return index;
}
}
return -1;
}
/**
* The base implementation of `_.indexOf` without `fromIndex` bounds checks.
*
* @private
* @param {Array} array The array to inspect.
* @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) {
return value === value ? strictIndexOf(array, value, fromIndex) : baseFindIndex(array, baseIsNaN, fromIndex);
}
/**
* A specialized version of `_.includes` for arrays without support for
* specifying an index to search from.
*
* @private
* @param {Array} [array] The array to inspect.
* @param {*} target The value to search for.
* @returns {boolean} Returns `true` if `target` is found, else `false`.
*/
function arrayIncludes(array, value) {
var length = array == null ? 0 : array.length;
return !!length && baseIndexOf(array, value, 0) > -1;
}
/** Used as references for various `Number` constants. */
var MAX_SAFE_INTEGER$1 = 9007199254740991;
/** Used to detect unsigned integer values. */
var reIsUint = /^(?:0|[1-9]\d*)$/;
/**
* Checks if `value` is a valid array-like index.
*
* @private
* @param {*} value The value to check.
* @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
* @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
*/
function isIndex(value, length) {
var type = _typeof(value);
length = length == null ? MAX_SAFE_INTEGER$1 : length;
return !!length && (type == 'number' || type != 'symbol' && reIsUint.test(value)) && value > -1 && value % 1 == 0 && value < length;
}
/**
* The base implementation of `assignValue` and `assignMergeValue` without
* value checks.
*
* @private
* @param {Object} object The object to modify.
* @param {string} key The key of the property to assign.
* @param {*} value The value to assign.
*/
function baseAssignValue(object, key, value) {
if (key == '__proto__' && defineProperty$1) {
defineProperty$1(object, key, {
'configurable': true,
'enumerable': true,
'value': value,
'writable': true
});
} else {
object[key] = value;
}
}
/**
* Performs a
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* comparison between two values to determine if they are equivalent.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
* @example
*
* var object = { 'a': 1 };
* var other = { 'a': 1 };
*
* _.eq(object, object);
* // => true
*
* _.eq(object, other);
* // => false
*
* _.eq('a', 'a');
* // => true
*
* _.eq('a', Object('a'));
* // => false
*
* _.eq(NaN, NaN);
* // => true
*/
function eq(value, other) {
return value === other || value !== value && other !== other;
}
/** Used for built-in method references. */
var objectProto$e = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty$c = objectProto$e.hasOwnProperty;
/**
* Assigns `value` to `key` of `object` if the existing value is not equivalent
* using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* for equality comparisons.
*
* @private
* @param {Object} object The object to modify.
* @param {string} key The key of the property to assign.
* @param {*} value The value to assign.
*/
function assignValue(object, key, value) {
var objValue = object[key];
if (!(hasOwnProperty$c.call(object, key) && eq(objValue, value)) || value === undefined && !(key in object)) {
baseAssignValue(object, key, value);
}
}
/**
* Copies properties of `source` to `object`.
*
* @private
* @param {Object} source The object to copy properties from.
* @param {Array} props The property identifiers to copy.
* @param {Object} [object={}] The object to copy properties to.
* @param {Function} [customizer] The function to customize copied values.
* @returns {Object} Returns `object`.
*/
function copyObject(source, props, object, customizer) {
var isNew = !object;
object || (object = {});
var index = -1,
length = props.length;
while (++index < length) {
var key = props[index];
var newValue = customizer ? customizer(object[key], source[key], key, object, source) : undefined;
if (newValue === undefined) {
newValue = source[key];
}
if (isNew) {
baseAssignValue(object, key, newValue);
} else {
assignValue(object, key, newValue);
}
}
return object;
}
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeMax$1 = Math.max;
/**
* A specialized version of `baseRest` which transforms the rest array.
*
* @private
* @param {Function} func The function to apply a rest parameter to.
* @param {number} [start=func.length-1] The start position of the rest parameter.
* @param {Function} transform The rest array transform.
* @returns {Function} Returns the new function.
*/
function overRest(func, start, transform) {
start = nativeMax$1(start === undefined ? func.length - 1 : start, 0);
return function () {
var args = arguments,
index = -1,
length = nativeMax$1(args.length - start, 0),
array = Array(length);
while (++index < length) {
array[index] = args[start + index];
}
index = -1;
var otherArgs = Array(start + 1);
while (++index < start) {
otherArgs[index] = args[index];
}
otherArgs[start] = transform(array);
return apply(func, this, otherArgs);
};
}
/**
* The base implementation of `_.rest` which doesn't validate or coerce arguments.
*
* @private
* @param {Function} func The function to apply a rest parameter to.
* @param {number} [start=func.length-1] The start position of the rest parameter.
* @returns {Function} Returns the new function.
*/
function baseRest(func, start) {
return setToString$1(overRest(func, start, identity), func + '');
}
/** Used as references for various `Number` constants. */
var MAX_SAFE_INTEGER = 9007199254740991;
/**
* Checks if `value` is a valid array-like length.
*
* **Note:** This method is loosely based on
* [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
* @example
*
* _.isLength(3);
* // => true
*
* _.isLength(Number.MIN_VALUE);
* // => false
*
* _.isLength(Infinity);
* // => false
*
* _.isLength('3');
* // => false
*/
function isLength(value) {
return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
}
/**
* Checks if `value` is array-like. A value is considered array-like if it's
* not a function and has a `value.length` that's an integer greater than or
* equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is array-like, else `false`.
* @example
*
* _.isArrayLike([1, 2, 3]);
* // => true
*
* _.isArrayLike(document.body.children);
* // => true
*
* _.isArrayLike('abc');
* // => true
*
* _.isArrayLike(_.noop);
* // => false
*/
function isArrayLike(value) {
return value != null && isLength(value.length) && !isFunction(value);
}
/**
* Checks if the given arguments are from an iteratee call.
*
* @private
* @param {*} value The potential iteratee value argument.
* @param {*} index The potential iteratee index or key argument.
* @param {*} object The potential iteratee object argument.
* @returns {boolean} Returns `true` if the arguments are from an iteratee call,
* else `false`.
*/
function isIterateeCall(value, index, object) {
if (!isObject(object)) {
return false;
}
var type = _typeof(index);
if (type == 'number' ? isArrayLike(object) && isIndex(index, object.length) : type == 'string' && index in object) {
return eq(object[index], value);
}
return false;
}
/**
* Creates a function like `_.assign`.
*
* @private
* @param {Function} assigner The function to assign values.
* @returns {Function} Returns the new assigner function.
*/
function createAssigner(assigner) {
return baseRest(function (object, sources) {
var index = -1,
length = sources.length,
customizer = length > 1 ? sources[length - 1] : undefined,
guard = length > 2 ? sources[2] : undefined;
customizer = assigner.length > 3 && typeof customizer == 'function' ? (length--, customizer) : undefined;
if (guard && isIterateeCall(sources[0], sources[1], guard)) {
customizer = length < 3 ? undefined : customizer;
length = 1;
}
object = Object(object);
while (++index < length) {
var source = sources[index];
if (source) {
assigner(object, source, index, customizer);
}
}
return object;
});
}
/** Used for built-in method references. */
var objectProto$d = Object.prototype;
/**
* Checks if `value` is likely a prototype object.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
*/
function isPrototype(value) {
var Ctor = value && value.constructor,
proto = typeof Ctor == 'function' && Ctor.prototype || objectProto$d;
return value === proto;
}
/**
* The base implementation of `_.times` without support for iteratee shorthands
* or max array length checks.
*
* @private
* @param {number} n The number of times to invoke `iteratee`.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Array} Returns the array of results.
*/
function baseTimes(n, iteratee) {
var index = -1,
result = Array(n);
while (++index < n) {
result[index] = iteratee(index);
}
return result;
}
/** `Object#toString` result references. */
var argsTag$3 = '[object Arguments]';
/**
* The base implementation of `_.isArguments`.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
*/
function baseIsArguments(value) {
return isObjectLike(value) && baseGetTag(value) == argsTag$3;
}
/** Used for built-in method references. */
var objectProto$c = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty$b = objectProto$c.hasOwnProperty;
/** Built-in value references. */
var propertyIsEnumerable$1 = objectProto$c.propertyIsEnumerable;
/**
* Checks if `value` is likely an `arguments` object.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
* else `false`.
* @example
*
* _.isArguments(function() { return arguments; }());
* // => true
*
* _.isArguments([1, 2, 3]);
* // => false
*/
var isArguments = baseIsArguments(function () {
return arguments;
}()) ? baseIsArguments : function (value) {
return isObjectLike(value) && hasOwnProperty$b.call(value, 'callee') && !propertyIsEnumerable$1.call(value, 'callee');
};
var isArguments$1 = isArguments;
/**
* This method returns `false`.
*
* @static
* @memberOf _
* @since 4.13.0
* @category Util
* @returns {boolean} Returns `false`.
* @example
*
* _.times(2, _.stubFalse);
* // => [false, false]
*/
function stubFalse() {
return false;
}
/** Detect free variable `exports`. */
var freeExports$2 = (typeof exports === "undefined" ? "undefined" : _typeof(exports)) == 'object' && exports && !exports.nodeType && exports;
/** Detect free variable `module`. */
var freeModule$2 = freeExports$2 && (typeof module === "undefined" ? "undefined" : _typeof(module)) == 'object' && module && !module.nodeType && module;
/** Detect the popular CommonJS extension `module.exports`. */
var moduleExports$2 = freeModule$2 && freeModule$2.exports === freeExports$2;
/** Built-in value references. */
var Buffer$1 = moduleExports$2 ? root$1.Buffer : undefined;
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeIsBuffer = Buffer$1 ? Buffer$1.isBuffer : undefined;
/**
* Checks if `value` is a buffer.
*
* @static
* @memberOf _
* @since 4.3.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
* @example
*
* _.isBuffer(new Buffer(2));
* // => true
*
* _.isBuffer(new Uint8Array(2));
* // => false
*/
var isBuffer = nativeIsBuffer || stubFalse;
var isBuffer$1 = isBuffer;
/** `Object#toString` result references. */
var argsTag$2 = '[object Arguments]',
arrayTag$2 = '[object Array]',
boolTag$3 = '[object Boolean]',
dateTag$3 = '[object Date]',
errorTag$2 = '[object Error]',
funcTag$1 = '[object Function]',
mapTag$6 = '[object Map]',
numberTag$4 = '[object Number]',
objectTag$4 = '[object Object]',
regexpTag$3 = '[object RegExp]',
setTag$6 = '[object Set]',
stringTag$4 = '[object String]',
weakMapTag$2 = '[object WeakMap]';
var arrayBufferTag$3 = '[object ArrayBuffer]',
dataViewTag$4 = '[object DataView]',
float32Tag$2 = '[object Float32Array]',
float64Tag$2 = '[object Float64Array]',
int8Tag$2 = '[object Int8Array]',
int16Tag$2 = '[object Int16Array]',
int32Tag$2 = '[object Int32Array]',
uint8Tag$2 = '[object Uint8Array]',
uint8ClampedTag$2 = '[object Uint8ClampedArray]',
uint16Tag$2 = '[object Uint16Array]',
uint32Tag$2 = '[object Uint32Array]';
/** Used to identify `toStringTag` values of typed arrays. */
var typedArrayTags = {};
typedArrayTags[float32Tag$2] = typedArrayTags[float64Tag$2] = typedArrayTags[int8Tag$2] = typedArrayTags[int16Tag$2] = typedArrayTags[int32Tag$2] = typedArrayTags[uint8Tag$2] = typedArrayTags[uint8ClampedTag$2] = typedArrayTags[uint16Tag$2] = typedArrayTags[uint32Tag$2] = true;
typedArrayTags[argsTag$2] = typedArrayTags[arrayTag$2] = typedArrayTags[arrayBufferTag$3] = typedArrayTags[boolTag$3] = typedArrayTags[dataViewTag$4] = typedArrayTags[dateTag$3] = typedArrayTags[errorTag$2] = typedArrayTags[funcTag$1] = typedArrayTags[mapTag$6] = typedArrayTags[numberTag$4] = typedArrayTags[objectTag$4] = typedArrayTags[regexpTag$3] = typedArrayTags[setTag$6] = typedArrayTags[stringTag$4] = typedArrayTags[weakMapTag$2] = false;
/**
* The base implementation of `_.isTypedArray` without Node.js optimizations.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
*/
function baseIsTypedArray(value) {
return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
}
/**
* The base implementation of `_.unary` without support for storing metadata.
*
* @private
* @param {Function} func The function to cap arguments for.
* @returns {Function} Returns the new capped function.
*/
function baseUnary(func) {
return function (value) {
return func(value);
};
}
/** Detect free variable `exports`. */
var freeExports$1 = (typeof exports === "undefined" ? "undefined" : _typeof(exports)) == 'object' && exports && !exports.nodeType && exports;
/** Detect free variable `module`. */
var freeModule$1 = freeExports$1 && (typeof module === "undefined" ? "undefined" : _typeof(module)) == 'object' && module && !module.nodeType && module;
/** Detect the popular CommonJS extension `module.exports`. */
var moduleExports$1 = freeModule$1 && freeModule$1.exports === freeExports$1;
/** Detect free variable `process` from Node.js. */
var freeProcess = moduleExports$1 && freeGlobal$1.process;
/** Used to access faster Node.js helpers. */
var nodeUtil = function () {
try {
// Use `util.types` for Node.js 10+.
var types = freeModule$1 && freeModule$1.require && freeModule$1.require('util').types;
if (types) {
return types;
}
// Legacy `process.binding('util')` for Node.js < 10.
return freeProcess && freeProcess.binding && freeProcess.binding('util');
} catch (e) {}
}();
var nodeUtil$1 = nodeUtil;
/* Node.js helper references. */
var nodeIsTypedArray = nodeUtil$1 && nodeUtil$1.isTypedArray;
/**
* Checks if `value` is classified as a typed array.
*
* @static
* @memberOf _
* @since 3.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
* @example
*
* _.isTypedArray(new Uint8Array);
* // => true
*
* _.isTypedArray([]);
* // => false
*/
var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
var isTypedArray$1 = isTypedArray;
/** Used for built-in method references. */
var objectProto$b = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty$a = objectProto$b.hasOwnProperty;
/**
* Creates an array of the enumerable property names of the array-like `value`.
*
* @private
* @param {*} value The value to query.
* @param {boolean} inherited Specify returning inherited property names.
* @returns {Array} Returns the array of property names.
*/
function arrayLikeKeys(value, inherited) {
var isArr = isArray$1(value),
isArg = !isArr && isArguments$1(value),
isBuff = !isArr && !isArg && isBuffer$1(value),
isType = !isArr && !isArg && !isBuff && isTypedArray$1(value),
skipIndexes = isArr || isArg || isBuff || isType,
result = skipIndexes ? baseTimes(value.length, String) : [],
length = result.length;
for (var key in value) {
if ((inherited || hasOwnProperty$a.call(value, key)) && !(skipIndexes && (
// Safari 9 has enumerable `arguments.length` in strict mode.
key == 'length' ||
// Node.js 0.10 has enumerable non-index properties on buffers.
isBuff && (key == 'offset' || key == 'parent') ||
// PhantomJS 2 has enumerable non-index properties on typed arrays.
isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset') ||
// Skip index properties.
isIndex(key, length)))) {
result.push(key);
}
}
return result;
}
/**
* Creates a unary function that invokes `func` with its argument transformed.
*
* @private
* @param {Function} func The function to wrap.
* @param {Function} transform The argument transform.
* @returns {Function} Returns the new function.
*/
function overArg(func, transform) {
return function (arg) {
return func(transform(arg));
};
}
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeKeys = overArg(Object.keys, Object);
var nativeKeys$1 = nativeKeys;
/** Used for built-in method references. */
var objectProto$a = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty$9 = objectProto$a.hasOwnProperty;
/**
* The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names.
*/
function baseKeys(object) {
if (!isPrototype(object)) {
return nativeKeys$1(object);
}
var result = [];
for (var key in Object(object)) {
if (hasOwnProperty$9.call(object, key) && key != 'constructor') {
result.push(key);
}
}
return result;
}
/**
* Creates an array of the own enumerable property names of `object`.
*
* **Note:** Non-object values are coerced to objects. See the
* [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
* for more details.
*
* @static
* @since 0.1.0
* @memberOf _
* @category Object
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names.
* @example
*
* function Foo() {
* this.a = 1;
* this.b = 2;
* }
*
* Foo.prototype.c = 3;
*
* _.keys(new Foo);
* // => ['a', 'b'] (iteration order is not guaranteed)
*
* _.keys('hi');
* // => ['0', '1']
*/
function keys(object) {
return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
}
/** Used for built-in method references. */
var objectProto$9 = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty$8 = objectProto$9.hasOwnProperty;
/**
* Assigns own enumerable string keyed properties of source objects to the
* destination object. Source objects are applied from left to right.
* Subsequent sources overwrite property assignments of previous sources.
*
* **Note:** This method mutates `object` and is loosely based on
* [`Object.assign`](https://mdn.io/Object/assign).
*
* @static
* @memberOf _
* @since 0.10.0
* @category Object
* @param {Object} object The destination object.
* @param {...Object} [sources] The source objects.
* @returns {Object} Returns `object`.
* @see _.assignIn
* @example
*
* function Foo() {
* this.a = 1;
* }
*
* function Bar() {
* this.c = 3;
* }
*
* Foo.prototype.b = 2;
* Bar.prototype.d = 4;
*
* _.assign({ 'a': 0 }, new Foo, new Bar);
* // => { 'a': 1, 'c': 3 }
*/
var assign = createAssigner(function (object, source) {
if (isPrototype(source) || isArrayLike(source)) {
copyObject(source, keys(source), object);
return;
}
for (var key in source) {
if (hasOwnProperty$8.call(source, key)) {
assignValue(object, key, source[key]);
}
}
});
var assign$1 = assign;
/**
* This function is like
* [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
* except that it includes inherited enumerable properties.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names.
*/
function nativeKeysIn(object) {
var result = [];
if (object != null) {
for (var key in Object(object)) {
result.push(key);
}
}
return result;
}
/** Used for built-in method references. */
var objectProto$8 = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty$7 = objectProto$8.hasOwnProperty;
/**
* The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names.
*/
function baseKeysIn(object) {
if (!isObject(object)) {
return nativeKeysIn(object);
}
var isProto = isPrototype(object),
result = [];
for (var key in object) {
if (!(key == 'constructor' && (isProto || !hasOwnProperty$7.call(object, key)))) {
result.push(key);
}
}
return result;
}
/**
* Creates an array of the own and inherited enumerable property names of `object`.
*
* **Note:** Non-object values are coerced to objects.
*
* @static
* @memberOf _
* @since 3.0.0
* @category Object
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names.
* @example
*
* function Foo() {
* this.a = 1;
* this.b = 2;
* }
*
* Foo.prototype.c = 3;
*
* _.keysIn(new Foo);
* // => ['a', 'b', 'c'] (iteration order is not guaranteed)
*/
function keysIn(object) {
return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
}
/** Used to match property names within property paths. */
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
reIsPlainProp = /^\w*$/;
/**
* Checks if `value` is a property name and not a property path.
*
* @private
* @param {*} value The value to check.
* @param {Object} [object] The object to query keys on.
* @returns {boolean} Returns `true` if `value` is a property name, else `false`.
*/
function isKey(value, object) {
if (isArray$1(value)) {
return false;
}
var type = _typeof(value);
if (type == 'number' || type == 'symbol' || type == 'boolean' || value == null || isSymbol(value)) {
return true;
}
return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object(object);
}
/* Built-in method references that are verified to be native. */
var nativeCreate = getNative(Object, 'create');
var nativeCreate$1 = nativeCreate;
/**
* Removes all key-value entries from the hash.
*
* @private
* @name clear
* @memberOf Hash
*/
function hashClear() {
this.__data__ = nativeCreate$1 ? nativeCreate$1(null) : {};
this.size = 0;
}
/**
* Removes `key` and its value from the hash.
*
* @private
* @name delete
* @memberOf Hash
* @param {Object} hash The hash to modify.
* @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
function hashDelete(key) {
var result = this.has(key) && delete this.__data__[key];
this.size -= result ? 1 : 0;
return result;
}
/** Used to stand-in for `undefined` hash values. */
var HASH_UNDEFINED$2 = '__lodash_hash_undefined__';
/** Used for built-in method references. */
var objectProto$7 = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty$6 = objectProto$7.hasOwnProperty;
/**
* Gets the hash value for `key`.
*
* @private
* @name get
* @memberOf Hash
* @param {string} key The key of the value to get.
* @returns {*} Returns the entry value.
*/
function hashGet(key) {
var data = this.__data__;
if (nativeCreate$1) {
var result = data[key];
return result === HASH_UNDEFINED$2 ? undefined : result;
}
return hasOwnProperty$6.call(data, key) ? data[key] : undefined;
}
/** Used for built-in method references. */
var objectProto$6 = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty$5 = objectProto$6.hasOwnProperty;
/**
* Checks if a hash value for `key` exists.
*
* @private
* @name has
* @memberOf Hash
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function hashHas(key) {
var data = this.__data__;
return nativeCreate$1 ? data[key] !== undefined : hasOwnProperty$5.call(data, key);
}
/** Used to stand-in for `undefined` hash values. */
var HASH_UNDEFINED$1 = '__lodash_hash_undefined__';
/**
* Sets the hash `key` to `value`.
*
* @private
* @name set
* @memberOf Hash
* @param {string} key The key of the value to set.
* @param {*} value The value to set.
* @returns {Object} Returns the hash instance.
*/
function hashSet(key, value) {
var data = this.__data__;
this.size += this.has(key) ? 0 : 1;
data[key] = nativeCreate$1 && value === undefined ? HASH_UNDEFINED$1 : value;
return this;
}
/**
* Creates a hash object.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function Hash(entries) {
var index = -1,
length = entries == null ? 0 : entries.length;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
// Add methods to `Hash`.
Hash.prototype.clear = hashClear;
Hash.prototype['delete'] = hashDelete;
Hash.prototype.get = hashGet;
Hash.prototype.has = hashHas;
Hash.prototype.set = hashSet;
/**
* Removes all key-value entries from the list cache.
*
* @private
* @name clear
* @memberOf ListCache
*/
function listCacheClear() {
this.__data__ = [];
this.size = 0;
}
/**
* Gets the index at which the `key` is found in `array` of key-value pairs.
*
* @private
* @param {Array} array The array to inspect.
* @param {*} key The key to search for.
* @returns {number} Returns the index of the matched value, else `-1`.
*/
function assocIndexOf(array, key) {
var length = array.length;
while (length--) {
if (eq(array[length][0], key)) {
return length;
}
}
return -1;
}
/** Used for built-in method references. */
var arrayProto = Array.prototype;
/** Built-in value references. */
var splice = arrayProto.splice;
/**
* Removes `key` and its value from the list cache.
*
* @private
* @name delete
* @memberOf ListCache
* @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
function listCacheDelete(key) {
var data = this.__data__,
index = assocIndexOf(data, key);
if (index < 0) {
return false;
}
var lastIndex = data.length - 1;
if (index == lastIndex) {
data.pop();
} else {
splice.call(data, index, 1);
}
--this.size;
return true;
}
/**
* Gets the list cache value for `key`.
*
* @private
* @name get
* @memberOf ListCache
* @param {string} key The key of the value to get.
* @returns {*} Returns the entry value.
*/
function listCacheGet(key) {
var data = this.__data__,
index = assocIndexOf(data, key);
return index < 0 ? undefined : data[index][1];
}
/**
* Checks if a list cache value for `key` exists.
*
* @private
* @name has
* @memberOf ListCache
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function listCacheHas(key) {
return assocIndexOf(this.__data__, key) > -1;
}
/**
* Sets the list cache `key` to `value`.
*
* @private
* @name set
* @memberOf ListCache
* @param {string} key The key of the value to set.
* @param {*} value The value to set.
* @returns {Object} Returns the list cache instance.
*/
function listCacheSet(key, value) {
var data = this.__data__,
index = assocIndexOf(data, key);
if (index < 0) {
++this.size;
data.push([key, value]);
} else {
data[index][1] = value;
}
return this;
}
/**
* Creates an list cache object.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function ListCache(entries) {
var index = -1,
length = entries == null ? 0 : entries.length;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
// Add methods to `ListCache`.
ListCache.prototype.clear = listCacheClear;
ListCache.prototype['delete'] = listCacheDelete;
ListCache.prototype.get = listCacheGet;
ListCache.prototype.has = listCacheHas;
ListCache.prototype.set = listCacheSet;
/* Built-in method references that are verified to be native. */
var Map = getNative(root$1, 'Map');
var Map$1 = Map;
/**
* Removes all key-value entries from the map.
*
* @private
* @name clear
* @memberOf MapCache
*/
function mapCacheClear() {
this.size = 0;
this.__data__ = {
'hash': new Hash(),
'map': new (Map$1 || ListCache)(),
'string': new Hash()
};
}
/**
* Checks if `value` is suitable for use as unique object key.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is suitable, else `false`.
*/
function isKeyable(value) {
var type = _typeof(value);
return type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean' ? value !== '__proto__' : value === null;
}
/**
* Gets the data for `map`.
*
* @private
* @param {Object} map The map to query.
* @param {string} key The reference key.
* @returns {*} Returns the map data.
*/
function getMapData(map, key) {
var data = map.__data__;
return isKeyable(key) ? data[typeof key == 'string' ? 'string' : 'hash'] : data.map;
}
/**
* Removes `key` and its value from the map.
*
* @private
* @name delete
* @memberOf MapCache
* @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
function mapCacheDelete(key) {
var result = getMapData(this, key)['delete'](key);
this.size -= result ? 1 : 0;
return result;
}
/**
* Gets the map value for `key`.
*
* @private
* @name get
* @memberOf MapCache
* @param {string} key The key of the value to get.
* @returns {*} Returns the entry value.
*/
function mapCacheGet(key) {
return getMapData(this, key).get(key);
}
/**
* Checks if a map value for `key` exists.
*
* @private
* @name has
* @memberOf MapCache
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function mapCacheHas(key) {
return getMapData(this, key).has(key);
}
/**
* Sets the map `key` to `value`.
*
* @private
* @name set
* @memberOf MapCache
* @param {string} key The key of the value to set.
* @param {*} value The value to set.
* @returns {Object} Returns the map cache instance.
*/
function mapCacheSet(key, value) {
var data = getMapData(this, key),
size = data.size;
data.set(key, value);
this.size += data.size == size ? 0 : 1;
return this;
}
/**
* Creates a map cache object to store key-value pairs.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function MapCache(entries) {
var index = -1,
length = entries == null ? 0 : entries.length;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
// Add methods to `MapCache`.
MapCache.prototype.clear = mapCacheClear;
MapCache.prototype['delete'] = mapCacheDelete;
MapCache.prototype.get = mapCacheGet;
MapCache.prototype.has = mapCacheHas;
MapCache.prototype.set = mapCacheSet;
/** Error message constants. */
var FUNC_ERROR_TEXT = 'Expected a function';
/**
* Creates a function that memoizes the result of `func`. If `resolver` is
* provided, it determines the cache key for storing the result based on the
* arguments provided to the memoized function. By default, the first argument
* provided to the memoized function is used as the map cache key. The `func`
* is invoked with the `this` binding of the memoized function.
*
* **Note:** The cache is exposed as the `cache` property on the memoized
* function. Its creation may be customized by replacing the `_.memoize.Cache`
* constructor with one whose instances implement the
* [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
* method interface of `clear`, `delete`, `get`, `has`, and `set`.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Function
* @param {Function} func The function to have its output memoized.
* @param {Function} [resolver] The function to resolve the cache key.
* @returns {Function} Returns the new memoized function.
* @example
*
* var object = { 'a': 1, 'b': 2 };
* var other = { 'c': 3, 'd': 4 };
*
* var values = _.memoize(_.values);
* values(object);
* // => [1, 2]
*
* values(other);
* // => [3, 4]
*
* object.a = 2;
* values(object);
* // => [1, 2]
*
* // Modify the result cache.
* values.cache.set(object, ['a', 'b']);
* values(object);
* // => ['a', 'b']
*
* // Replace `_.memoize.Cache`.
* _.memoize.Cache = WeakMap;
*/
function memoize(func, resolver) {
if (typeof func != 'function' || resolver != null && typeof resolver != 'function') {
throw new TypeError(FUNC_ERROR_TEXT);
}
var memoized = function memoized() {
var args = arguments,
key = resolver ? resolver.apply(this, args) : args[0],
cache = memoized.cache;
if (cache.has(key)) {
return cache.get(key);
}
var result = func.apply(this, args);
memoized.cache = cache.set(key, result) || cache;
return result;
};
memoized.cache = new (memoize.Cache || MapCache)();
return memoized;
}
// Expose `MapCache`.
memoize.Cache = MapCache;
/** Used as the maximum memoize cache size. */
var MAX_MEMOIZE_SIZE = 500;
/**
* A specialized version of `_.memoize` which clears the memoized function's
* cache when it exceeds `MAX_MEMOIZE_SIZE`.
*
* @private
* @param {Function} func The function to have its output memoized.
* @returns {Function} Returns the new memoized function.
*/
function memoizeCapped(func) {
var result = memoize(func, function (key) {
if (cache.size === MAX_MEMOIZE_SIZE) {
cache.clear();
}
return key;
});
var cache = result.cache;
return result;
}
/** Used to match property names within property paths. */
var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
/** Used to match backslashes in property paths. */
var reEscapeChar = /\\(\\)?/g;
/**
* Converts `string` to a property path array.
*
* @private
* @param {string} string The string to convert.
* @returns {Array} Returns the property path array.
*/
var stringToPath = memoizeCapped(function (string) {
var result = [];
if (string.charCodeAt(0) === 46 /* . */) {
result.push('');
}
string.replace(rePropName, function (match, number, quote, subString) {
result.push(quote ? subString.replace(reEscapeChar, '$1') : number || match);
});
return result;
});
var stringToPath$1 = stringToPath;
/**
* Converts `value` to a string. An empty string is returned for `null`
* and `undefined` values. The sign of `-0` is preserved.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to convert.
* @returns {string} Returns the converted string.
* @example
*
* _.toString(null);
* // => ''
*
* _.toString(-0);
* // => '-0'
*
* _.toString([1, 2, 3]);
* // => '1,2,3'
*/
function toString(value) {
return value == null ? '' : baseToString(value);
}
/**
* Casts `value` to a path array if it's not one.
*
* @private
* @param {*} value The value to inspect.
* @param {Object} [object] The object to query keys on.
* @returns {Array} Returns the cast property path array.
*/
function castPath(value, object) {
if (isArray$1(value)) {
return value;
}
return isKey(value, object) ? [value] : stringToPath$1(toString(value));
}
/** Used as references for various `Number` constants. */
var INFINITY = 1 / 0;
/**
* Converts `value` to a string key if it's not a string or symbol.
*
* @private
* @param {*} value The value to inspect.
* @returns {string|symbol} Returns the key.
*/
function toKey(value) {
if (typeof value == 'string' || isSymbol(value)) {
return value;
}
var result = value + '';
return result == '0' && 1 / value == -INFINITY ? '-0' : result;
}
/**
* The base implementation of `_.get` without support for default values.
*
* @private
* @param {Object} object The object to query.
* @param {Array|string} path The path of the property to get.
* @returns {*} Returns the resolved value.
*/
function baseGet(object, path) {
path = castPath(path, object);
var index = 0,
length = path.length;
while (object != null && index < length) {
object = object[toKey(path[index++])];
}
return index && index == length ? object : undefined;
}
/**
* Gets the value at `path` of `object`. If the resolved value is
* `undefined`, the `defaultValue` is returned in its place.
*
* @static
* @memberOf _
* @since 3.7.0
* @category Object
* @param {Object} object The object to query.
* @param {Array|string} path The path of the property to get.
* @param {*} [defaultValue] The value returned for `undefined` resolved values.
* @returns {*} Returns the resolved value.
* @example
*
* var object = { 'a': [{ 'b': { 'c': 3 } }] };
*
* _.get(object, 'a[0].b.c');
* // => 3
*
* _.get(object, ['a', '0', 'b', 'c']);
* // => 3
*
* _.get(object, 'a.b.c', 'default');
* // => 'default'
*/
function get(object, path, defaultValue) {
var result = object == null ? undefined : baseGet(object, path);
return result === undefined ? defaultValue : result;
}
/**
* Appends the elements of `values` to `array`.
*
* @private
* @param {Array} array The array to modify.
* @param {Array} values The values to append.
* @returns {Array} Returns `array`.
*/
function arrayPush(array, values) {
var index = -1,
length = values.length,
offset = array.length;
while (++index < length) {
array[offset + index] = values[index];
}
return array;
}
/** Built-in value references. */
var spreadableSymbol = _Symbol$1 ? _Symbol$1.isConcatSpreadable : undefined;
/**
* Checks if `value` is a flattenable `arguments` object or array.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
*/
function isFlattenable(value) {
return isArray$1(value) || isArguments$1(value) || !!(spreadableSymbol && value && value[spreadableSymbol]);
}
/**
* The base implementation of `_.flatten` with support for restricting flattening.
*
* @private
* @param {Array} array The array to flatten.
* @param {number} depth The maximum recursion depth.
* @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
* @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
* @param {Array} [result=[]] The initial result value.
* @returns {Array} Returns the new flattened array.
*/
function baseFlatten(array, depth, predicate, isStrict, result) {
var index = -1,
length = array.length;
predicate || (predicate = isFlattenable);
result || (result = []);
while (++index < length) {
var value = array[index];
if (depth > 0 && predicate(value)) {
if (depth > 1) {
// Recursively flatten arrays (susceptible to call stack limits).
baseFlatten(value, depth - 1, predicate, isStrict, result);
} else {
arrayPush(result, value);
}
} else if (!isStrict) {
result[result.length] = value;
}
}
return result;
}
/**
* Flattens `array` a single level deep.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Array
* @param {Array} array The array to flatten.
* @returns {Array} Returns the new flattened array.
* @example
*
* _.flatten([1, [2, [3, [4]], 5]]);
* // => [1, 2, [3, [4]], 5]
*/
function flatten(array) {
var length = array == null ? 0 : array.length;
return length ? baseFlatten(array, 1) : [];
}
/**
* A specialized version of `baseRest` which flattens the rest array.
*
* @private
* @param {Function} func The function to apply a rest parameter to.
* @returns {Function} Returns the new function.
*/
function flatRest(func) {
return setToString$1(overRest(func, undefined, flatten), func + '');
}
/** Built-in value references. */
var getPrototype = overArg(Object.getPrototypeOf, Object);
var getPrototype$1 = getPrototype;
/** `Object#toString` result references. */
var objectTag$3 = '[object Object]';
/** Used for built-in method references. */
var funcProto = Function.prototype,
objectProto$5 = Object.prototype;
/** Used to resolve the decompiled source of functions. */
var funcToString = funcProto.toString;
/** Used to check objects for own properties. */
var hasOwnProperty$4 = objectProto$5.hasOwnProperty;
/** Used to infer the `Object` constructor. */
var objectCtorString = funcToString.call(Object);
/**
* Checks if `value` is a plain object, that is, an object created by the
* `Object` constructor or one with a `[[Prototype]]` of `null`.
*
* @static
* @memberOf _
* @since 0.8.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
* @example
*
* function Foo() {
* this.a = 1;
* }
*
* _.isPlainObject(new Foo);
* // => false
*
* _.isPlainObject([1, 2, 3]);
* // => false
*
* _.isPlainObject({ 'x': 0, 'y': 0 });
* // => true
*
* _.isPlainObject(Object.create(null));
* // => true
*/
function isPlainObject(value) {
if (!isObjectLike(value) || baseGetTag(value) != objectTag$3) {
return false;
}
var proto = getPrototype$1(value);
if (proto === null) {
return true;
}
var Ctor = hasOwnProperty$4.call(proto, 'constructor') && proto.constructor;
return typeof Ctor == 'function' && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString;
}
/**
* The base implementation of `_.slice` without an iteratee call guard.
*
* @private
* @param {Array} array The array to slice.
* @param {number} [start=0] The start position.
* @param {number} [end=array.length] The end position.
* @returns {Array} Returns the slice of `array`.
*/
function baseSlice(array, start, end) {
var index = -1,
length = array.length;
if (start < 0) {
start = -start > length ? 0 : length + start;
}
end = end > length ? length : end;
if (end < 0) {
end += length;
}
length = start > end ? 0 : end - start >>> 0;
start >>>= 0;
var result = Array(length);
while (++index < length) {
result[index] = array[index + start];
}
return result;
}
/**
* Removes all key-value entries from the stack.
*
* @private
* @name clear
* @memberOf Stack
*/
function stackClear() {
this.__data__ = new ListCache();
this.size = 0;
}
/**
* Removes `key` and its value from the stack.
*
* @private
* @name delete
* @memberOf Stack
* @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
function stackDelete(key) {
var data = this.__data__,
result = data['delete'](key);
this.size = data.size;
return result;
}
/**
* Gets the stack value for `key`.
*
* @private
* @name get
* @memberOf Stack
* @param {string} key The key of the value to get.
* @returns {*} Returns the entry value.
*/
function stackGet(key) {
return this.__data__.get(key);
}
/**
* Checks if a stack value for `key` exists.
*
* @private
* @name has
* @memberOf Stack
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function stackHas(key) {
return this.__data__.has(key);
}
/** Used as the size to enable large array optimizations. */
var LARGE_ARRAY_SIZE$1 = 200;
/**
* Sets the stack `key` to `value`.
*
* @private
* @name set
* @memberOf Stack
* @param {string} key The key of the value to set.
* @param {*} value The value to set.
* @returns {Object} Returns the stack cache instance.
*/
function stackSet(key, value) {
var data = this.__data__;
if (data instanceof ListCache) {
var pairs = data.__data__;
if (!Map$1 || pairs.length < LARGE_ARRAY_SIZE$1 - 1) {
pairs.push([key, value]);
this.size = ++data.size;
return this;
}
data = this.__data__ = new MapCache(pairs);
}
data.set(key, value);
this.size = data.size;
return this;
}
/**
* Creates a stack cache object to store key-value pairs.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function Stack(entries) {
var data = this.__data__ = new ListCache(entries);
this.size = data.size;
}
// Add methods to `Stack`.
Stack.prototype.clear = stackClear;
Stack.prototype['delete'] = stackDelete;
Stack.prototype.get = stackGet;
Stack.prototype.has = stackHas;
Stack.prototype.set = stackSet;
/**
* The base implementation of `_.assign` without support for multiple sources
* or `customizer` functions.
*
* @private
* @param {Object} object The destination object.
* @param {Object} source The source object.
* @returns {Object} Returns `object`.
*/
function baseAssign(object, source) {
return object && copyObject(source, keys(source), object);
}
/**
* The base implementation of `_.assignIn` without support for multiple sources
* or `customizer` functions.
*
* @private
* @param {Object} object The destination object.
* @param {Object} source The source object.
* @returns {Object} Returns `object`.
*/
function baseAssignIn(object, source) {
return object && copyObject(source, keysIn(source), object);
}
/** Detect free variable `exports`. */
var freeExports = (typeof exports === "undefined" ? "undefined" : _typeof(exports)) == 'object' && exports && !exports.nodeType && exports;
/** Detect free variable `module`. */
var freeModule = freeExports && (typeof module === "undefined" ? "undefined" : _typeof(module)) == 'object' && module && !module.nodeType && module;
/** Detect the popular CommonJS extension `module.exports`. */
var moduleExports = freeModule && freeModule.exports === freeExports;
/** Built-in value references. */
var Buffer = moduleExports ? root$1.Buffer : undefined,
allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined;
/**
* Creates a clone of `buffer`.
*
* @private
* @param {Buffer} buffer The buffer to clone.
* @param {boolean} [isDeep] Specify a deep clone.
* @returns {Buffer} Returns the cloned buffer.
*/
function cloneBuffer(buffer, isDeep) {
if (isDeep) {
return buffer.slice();
}
var length = buffer.length,
result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
buffer.copy(result);
return result;
}
/**
* A specialized version of `_.filter` for arrays without support for
* iteratee shorthands.
*
* @private
* @param {Array} [array] The array to iterate over.
* @param {Function} predicate The function invoked per iteration.
* @returns {Array} Returns the new filtered array.
*/
function arrayFilter(array, predicate) {
var index = -1,
length = array == null ? 0 : array.length,
resIndex = 0,
result = [];
while (++index < length) {
var value = array[index];
if (predicate(value, index, array)) {
result[resIndex++] = value;
}
}
return result;
}
/**
* This method returns a new empty array.
*
* @static
* @memberOf _
* @since 4.13.0
* @category Util
* @returns {Array} Returns the new empty array.
* @example
*
* var arrays = _.times(2, _.stubArray);
*
* console.log(arrays);
* // => [[], []]
*
* console.log(arrays[0] === arrays[1]);
* // => false
*/
function stubArray() {
return [];
}
/** Used for built-in method references. */
var objectProto$4 = Object.prototype;
/** Built-in value references. */
var propertyIsEnumerable = objectProto$4.propertyIsEnumerable;
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeGetSymbols$1 = Object.getOwnPropertySymbols;
/**
* Creates an array of the own enumerable symbols of `object`.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the array of symbols.
*/
var getSymbols = !nativeGetSymbols$1 ? stubArray : function (object) {
if (object == null) {
return [];
}
object = Object(object);
return arrayFilter(nativeGetSymbols$1(object), function (symbol) {
return propertyIsEnumerable.call(object, symbol);
});
};
var getSymbols$1 = getSymbols;
/**
* Copies own symbols of `source` to `object`.
*
* @private
* @param {Object} source The object to copy symbols from.
* @param {Object} [object={}] The object to copy symbols to.
* @returns {Object} Returns `object`.
*/
function copySymbols(source, object) {
return copyObject(source, getSymbols$1(source), object);
}
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeGetSymbols = Object.getOwnPropertySymbols;
/**
* Creates an array of the own and inherited enumerable symbols of `object`.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the array of symbols.
*/
var getSymbolsIn = !nativeGetSymbols ? stubArray : function (object) {
var result = [];
while (object) {
arrayPush(result, getSymbols$1(object));
object = getPrototype$1(object);
}
return result;
};
var getSymbolsIn$1 = getSymbolsIn;
/**
* Copies own and inherited symbols of `source` to `object`.
*
* @private
* @param {Object} source The object to copy symbols from.
* @param {Object} [object={}] The object to copy symbols to.
* @returns {Object} Returns `object`.
*/
function copySymbolsIn(source, object) {
return copyObject(source, getSymbolsIn$1(source), object);
}
/**
* The base implementation of `getAllKeys` and `getAllKeysIn` which uses
* `keysFunc` and `symbolsFunc` to get the enumerable property names and
* symbols of `object`.
*
* @private
* @param {Object} object The object to query.
* @param {Function} keysFunc The function to get the keys of `object`.
* @param {Function} symbolsFunc The function to get the symbols of `object`.
* @returns {Array} Returns the array of property names and symbols.
*/
function baseGetAllKeys(object, keysFunc, symbolsFunc) {
var result = keysFunc(object);
return isArray$1(object) ? result : arrayPush(result, symbolsFunc(object));
}
/**
* Creates an array of own enumerable property names and symbols of `object`.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names and symbols.
*/
function getAllKeys(object) {
return baseGetAllKeys(object, keys, getSymbols$1);
}
/**
* Creates an array of own and inherited enumerable property names and
* symbols of `object`.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names and symbols.
*/
function getAllKeysIn(object) {
return baseGetAllKeys(object, keysIn, getSymbolsIn$1);
}
/* Built-in method references that are verified to be native. */
var DataView = getNative(root$1, 'DataView');
var DataView$1 = DataView;
/* Built-in method references that are verified to be native. */
var Promise$1 = getNative(root$1, 'Promise');
var Promise$2 = Promise$1;
/* Built-in method references that are verified to be native. */
var Set = getNative(root$1, 'Set');
var Set$1 = Set;
/** `Object#toString` result references. */
var mapTag$5 = '[object Map]',
objectTag$2 = '[object Object]',
promiseTag = '[object Promise]',
setTag$5 = '[object Set]',
weakMapTag$1 = '[object WeakMap]';
var dataViewTag$3 = '[object DataView]';
/** Used to detect maps, sets, and weakmaps. */
var dataViewCtorString = toSource(DataView$1),
mapCtorString = toSource(Map$1),
promiseCtorString = toSource(Promise$2),
setCtorString = toSource(Set$1),
weakMapCtorString = toSource(WeakMap$1);
/**
* Gets the `toStringTag` of `value`.
*
* @private
* @param {*} value The value to query.
* @returns {string} Returns the `toStringTag`.
*/
var getTag = baseGetTag;
// Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
if (DataView$1 && getTag(new DataView$1(new ArrayBuffer(1))) != dataViewTag$3 || Map$1 && getTag(new Map$1()) != mapTag$5 || Promise$2 && getTag(Promise$2.resolve()) != promiseTag || Set$1 && getTag(new Set$1()) != setTag$5 || WeakMap$1 && getTag(new WeakMap$1()) != weakMapTag$1) {
getTag = function getTag(value) {
var result = baseGetTag(value),
Ctor = result == objectTag$2 ? value.constructor : undefined,
ctorString = Ctor ? toSource(Ctor) : '';
if (ctorString) {
switch (ctorString) {
case dataViewCtorString:
return dataViewTag$3;
case mapCtorString:
return mapTag$5;
case promiseCtorString:
return promiseTag;
case setCtorString:
return setTag$5;
case weakMapCtorString:
return weakMapTag$1;
}
}
return result;
};
}
var getTag$1 = getTag;
/** Used for built-in method references. */
var objectProto$3 = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty$3 = objectProto$3.hasOwnProperty;
/**
* Initializes an array clone.
*
* @private
* @param {Array} array The array to clone.
* @returns {Array} Returns the initialized clone.
*/
function initCloneArray(array) {
var length = array.length,
result = new array.constructor(length);
// Add properties assigned by `RegExp#exec`.
if (length && typeof array[0] == 'string' && hasOwnProperty$3.call(array, 'index')) {
result.index = array.index;
result.input = array.input;
}
return result;
}
/** Built-in value references. */
var Uint8Array = root$1.Uint8Array;
var Uint8Array$1 = Uint8Array;
/**
* Creates a clone of `arrayBuffer`.
*
* @private
* @param {ArrayBuffer} arrayBuffer The array buffer to clone.
* @returns {ArrayBuffer} Returns the cloned array buffer.
*/
function cloneArrayBuffer(arrayBuffer) {
var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
new Uint8Array$1(result).set(new Uint8Array$1(arrayBuffer));
return result;
}
/**
* Creates a clone of `dataView`.
*
* @private
* @param {Object} dataView The data view to clone.
* @param {boolean} [isDeep] Specify a deep clone.
* @returns {Object} Returns the cloned data view.
*/
function cloneDataView(dataView, isDeep) {
var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
}
/** Used to match `RegExp` flags from their coerced string values. */
var reFlags = /\w*$/;
/**
* Creates a clone of `regexp`.
*
* @private
* @param {Object} regexp The regexp to clone.
* @returns {Object} Returns the cloned regexp.
*/
function cloneRegExp(regexp) {
var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
result.lastIndex = regexp.lastIndex;
return result;
}
/** Used to convert symbols to primitives and strings. */
var symbolProto$1 = _Symbol$1 ? _Symbol$1.prototype : undefined,
symbolValueOf$1 = symbolProto$1 ? symbolProto$1.valueOf : undefined;
/**
* Creates a clone of the `symbol` object.
*
* @private
* @param {Object} symbol The symbol object to clone.
* @returns {Object} Returns the cloned symbol object.
*/
function cloneSymbol(symbol) {
return symbolValueOf$1 ? Object(symbolValueOf$1.call(symbol)) : {};
}
/**
* Creates a clone of `typedArray`.
*
* @private
* @param {Object} typedArray The typed array to clone.
* @param {boolean} [isDeep] Specify a deep clone.
* @returns {Object} Returns the cloned typed array.
*/
function cloneTypedArray(typedArray, isDeep) {
var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
}
/** `Object#toString` result references. */
var boolTag$2 = '[object Boolean]',
dateTag$2 = '[object Date]',
mapTag$4 = '[object Map]',
numberTag$3 = '[object Number]',
regexpTag$2 = '[object RegExp]',
setTag$4 = '[object Set]',
stringTag$3 = '[object String]',
symbolTag$2 = '[object Symbol]';
var arrayBufferTag$2 = '[object ArrayBuffer]',
dataViewTag$2 = '[object DataView]',
float32Tag$1 = '[object Float32Array]',
float64Tag$1 = '[object Float64Array]',
int8Tag$1 = '[object Int8Array]',
int16Tag$1 = '[object Int16Array]',
int32Tag$1 = '[object Int32Array]',
uint8Tag$1 = '[object Uint8Array]',
uint8ClampedTag$1 = '[object Uint8ClampedArray]',
uint16Tag$1 = '[object Uint16Array]',
uint32Tag$1 = '[object Uint32Array]';
/**
* Initializes an object clone based on its `toStringTag`.
*
* **Note:** This function only supports cloning values with tags of
* `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
*
* @private
* @param {Object} object The object to clone.
* @param {string} tag The `toStringTag` of the object to clone.
* @param {boolean} [isDeep] Specify a deep clone.
* @returns {Object} Returns the initialized clone.
*/
function initCloneByTag(object, tag, isDeep) {
var Ctor = object.constructor;
switch (tag) {
case arrayBufferTag$2:
return cloneArrayBuffer(object);
case boolTag$2:
case dateTag$2:
return new Ctor(+object);
case dataViewTag$2:
return cloneDataView(object, isDeep);
case float32Tag$1:
case float64Tag$1:
case int8Tag$1:
case int16Tag$1:
case int32Tag$1:
case uint8Tag$1:
case uint8ClampedTag$1:
case uint16Tag$1:
case uint32Tag$1:
return cloneTypedArray(object, isDeep);
case mapTag$4:
return new Ctor();
case numberTag$3:
case stringTag$3:
return new Ctor(object);
case regexpTag$2:
return cloneRegExp(object);
case setTag$4:
return new Ctor();
case symbolTag$2:
return cloneSymbol(object);
}
}
/**
* Initializes an object clone.
*
* @private
* @param {Object} object The object to clone.
* @returns {Object} Returns the initialized clone.
*/
function initCloneObject(object) {
return typeof object.constructor == 'function' && !isPrototype(object) ? baseCreate$1(getPrototype$1(object)) : {};
}
/** `Object#toString` result references. */
var mapTag$3 = '[object Map]';
/**
* The base implementation of `_.isMap` without Node.js optimizations.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a map, else `false`.
*/
function baseIsMap(value) {
return isObjectLike(value) && getTag$1(value) == mapTag$3;
}
/* Node.js helper references. */
var nodeIsMap = nodeUtil$1 && nodeUtil$1.isMap;
/**
* Checks if `value` is classified as a `Map` object.
*
* @static
* @memberOf _
* @since 4.3.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a map, else `false`.
* @example
*
* _.isMap(new Map);
* // => true
*
* _.isMap(new WeakMap);
* // => false
*/
var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
var isMap$1 = isMap;
/** `Object#toString` result references. */
var setTag$3 = '[object Set]';
/**
* The base implementation of `_.isSet` without Node.js optimizations.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a set, else `false`.
*/
function baseIsSet(value) {
return isObjectLike(value) && getTag$1(value) == setTag$3;
}
/* Node.js helper references. */
var nodeIsSet = nodeUtil$1 && nodeUtil$1.isSet;
/**
* Checks if `value` is classified as a `Set` object.
*
* @static
* @memberOf _
* @since 4.3.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a set, else `false`.
* @example
*
* _.isSet(new Set);
* // => true
*
* _.isSet(new WeakSet);
* // => false
*/
var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
var isSet$1 = isSet;
/** Used to compose bitmasks for cloning. */
var CLONE_DEEP_FLAG$1 = 1,
CLONE_FLAT_FLAG$1 = 2,
CLONE_SYMBOLS_FLAG$1 = 4;
/** `Object#toString` result references. */
var argsTag$1 = '[object Arguments]',
arrayTag$1 = '[object Array]',
boolTag$1 = '[object Boolean]',
dateTag$1 = '[object Date]',
errorTag$1 = '[object Error]',
funcTag = '[object Function]',
genTag = '[object GeneratorFunction]',
mapTag$2 = '[object Map]',
numberTag$2 = '[object Number]',
objectTag$1 = '[object Object]',
regexpTag$1 = '[object RegExp]',
setTag$2 = '[object Set]',
stringTag$2 = '[object String]',
symbolTag$1 = '[object Symbol]',
weakMapTag = '[object WeakMap]';
var arrayBufferTag$1 = '[object ArrayBuffer]',
dataViewTag$1 = '[object DataView]',
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 identify `toStringTag` values supported by `_.clone`. */
var cloneableTags = {};
cloneableTags[argsTag$1] = cloneableTags[arrayTag$1] = cloneableTags[arrayBufferTag$1] = cloneableTags[dataViewTag$1] = cloneableTags[boolTag$1] = cloneableTags[dateTag$1] = cloneableTags[float32Tag] = cloneableTags[float64Tag] = cloneableTags[int8Tag] = cloneableTags[int16Tag] = cloneableTags[int32Tag] = cloneableTags[mapTag$2] = cloneableTags[numberTag$2] = cloneableTags[objectTag$1] = cloneableTags[regexpTag$1] = cloneableTags[setTag$2] = cloneableTags[stringTag$2] = cloneableTags[symbolTag$1] = cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
cloneableTags[errorTag$1] = cloneableTags[funcTag] = cloneableTags[weakMapTag] = false;
/**
* The base implementation of `_.clone` and `_.cloneDeep` which tracks
* traversed objects.
*
* @private
* @param {*} value The value to clone.
* @param {boolean} bitmask The bitmask flags.
* 1 - Deep clone
* 2 - Flatten inherited properties
* 4 - Clone symbols
* @param {Function} [customizer] The function to customize cloning.
* @param {string} [key] The key of `value`.
* @param {Object} [object] The parent object of `value`.
* @param {Object} [stack] Tracks traversed objects and their clone counterparts.
* @returns {*} Returns the cloned value.
*/
function baseClone(value, bitmask, customizer, key, object, stack) {
var result,
isDeep = bitmask & CLONE_DEEP_FLAG$1,
isFlat = bitmask & CLONE_FLAT_FLAG$1,
isFull = bitmask & CLONE_SYMBOLS_FLAG$1;
if (customizer) {
result = object ? customizer(value, key, object, stack) : customizer(value);
}
if (result !== undefined) {
return result;
}
if (!isObject(value)) {
return value;
}
var isArr = isArray$1(value);
if (isArr) {
result = initCloneArray(value);
if (!isDeep) {
return copyArray(value, result);
}
} else {
var tag = getTag$1(value),
isFunc = tag == funcTag || tag == genTag;
if (isBuffer$1(value)) {
return cloneBuffer(value, isDeep);
}
if (tag == objectTag$1 || tag == argsTag$1 || isFunc && !object) {
result = isFlat || isFunc ? {} : initCloneObject(value);
if (!isDeep) {
return isFlat ? copySymbolsIn(value, baseAssignIn(result, value)) : copySymbols(value, baseAssign(result, value));
}
} else {
if (!cloneableTags[tag]) {
return object ? value : {};
}
result = initCloneByTag(value, tag, isDeep);
}
}
// Check for circular references and return its corresponding clone.
stack || (stack = new Stack());
var stacked = stack.get(value);
if (stacked) {
return stacked;
}
stack.set(value, result);
if (isSet$1(value)) {
value.forEach(function (subValue) {
result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
});
} else if (isMap$1(value)) {
value.forEach(function (subValue, key) {
result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
});
}
var keysFunc = isFull ? isFlat ? getAllKeysIn : getAllKeys : isFlat ? keysIn : keys;
var props = isArr ? undefined : keysFunc(value);
arrayEach(props || value, function (subValue, key) {
if (props) {
key = subValue;
subValue = value[key];
}
// Recursively populate clone (susceptible to call stack limits).
assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
});
return result;
}
/** Used to stand-in for `undefined` hash values. */
var HASH_UNDEFINED = '__lodash_hash_undefined__';
/**
* Adds `value` to the array cache.
*
* @private
* @name add
* @memberOf SetCache
* @alias push
* @param {*} value The value to cache.
* @returns {Object} Returns the cache instance.
*/
function setCacheAdd(value) {
this.__data__.set(value, HASH_UNDEFINED);
return this;
}
/**
* Checks if `value` is in the array cache.
*
* @private
* @name has
* @memberOf SetCache
* @param {*} value The value to search for.
* @returns {number} Returns `true` if `value` is found, else `false`.
*/
function setCacheHas(value) {
return this.__data__.has(value);
}
/**
*
* Creates an array cache object to store unique values.
*
* @private
* @constructor
* @param {Array} [values] The values to cache.
*/
function SetCache(values) {
var index = -1,
length = values == null ? 0 : values.length;
this.__data__ = new MapCache();
while (++index < length) {
this.add(values[index]);
}
}
// Add methods to `SetCache`.
SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
SetCache.prototype.has = setCacheHas;
/**
* A specialized version of `_.some` for arrays without support for iteratee
* shorthands.
*
* @private
* @param {Array} [array] The array to iterate over.
* @param {Function} predicate The function invoked per iteration.
* @returns {boolean} Returns `true` if any element passes the predicate check,
* else `false`.
*/
function arraySome(array, predicate) {
var index = -1,
length = array == null ? 0 : array.length;
while (++index < length) {
if (predicate(array[index], index, array)) {
return true;
}
}
return false;
}
/**
* Checks if a `cache` value for `key` exists.
*
* @private
* @param {Object} cache The cache to query.
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function cacheHas(cache, key) {
return cache.has(key);
}
/** Used to compose bitmasks for value comparisons. */
var COMPARE_PARTIAL_FLAG$5 = 1,
COMPARE_UNORDERED_FLAG$3 = 2;
/**
* A specialized version of `baseIsEqualDeep` for arrays with support for
* partial deep comparisons.
*
* @private
* @param {Array} array The array to compare.
* @param {Array} other The other array to compare.
* @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
* @param {Function} customizer The function to customize comparisons.
* @param {Function} equalFunc The function to determine equivalents of values.
* @param {Object} stack Tracks traversed `array` and `other` objects.
* @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
*/
function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$5,
arrLength = array.length,
othLength = other.length;
if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
return false;
}
// Check that cyclic values are equal.
var arrStacked = stack.get(array);
var othStacked = stack.get(other);
if (arrStacked && othStacked) {
return arrStacked == other && othStacked == array;
}
var index = -1,
result = true,
seen = bitmask & COMPARE_UNORDERED_FLAG$3 ? new SetCache() : undefined;
stack.set(array, other);
stack.set(other, array);
// Ignore non-index properties.
while (++index < arrLength) {
var arrValue = array[index],
othValue = other[index];
if (customizer) {
var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack);
}
if (compared !== undefined) {
if (compared) {
continue;
}
result = false;
break;
}
// Recursively compare arrays (susceptible to call stack limits).
if (seen) {
if (!arraySome(other, function (othValue, othIndex) {
if (!cacheHas(seen, othIndex) && (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
return seen.push(othIndex);
}
})) {
result = false;
break;
}
} else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
result = false;
break;
}
}
stack['delete'](array);
stack['delete'](other);
return result;
}
/**
* Converts `map` to its key-value pairs.
*
* @private
* @param {Object} map The map to convert.
* @returns {Array} Returns the key-value pairs.
*/
function mapToArray(map) {
var index = -1,
result = Array(map.size);
map.forEach(function (value, key) {
result[++index] = [key, value];
});
return result;
}
/**
* Converts `set` to an array of its values.
*
* @private
* @param {Object} set The set to convert.
* @returns {Array} Returns the values.
*/
function setToArray(set) {
var index = -1,
result = Array(set.size);
set.forEach(function (value) {
result[++index] = value;
});
return result;
}
/** Used to compose bitmasks for value comparisons. */
var COMPARE_PARTIAL_FLAG$4 = 1,
COMPARE_UNORDERED_FLAG$2 = 2;
/** `Object#toString` result references. */
var boolTag = '[object Boolean]',
dateTag = '[object Date]',
errorTag = '[object Error]',
mapTag$1 = '[object Map]',
numberTag$1 = '[object Number]',
regexpTag = '[object RegExp]',
setTag$1 = '[object Set]',
stringTag$1 = '[object String]',
symbolTag = '[object Symbol]';
var arrayBufferTag = '[object ArrayBuffer]',
dataViewTag = '[object DataView]';
/** Used to convert symbols to primitives and strings. */
var symbolProto = _Symbol$1 ? _Symbol$1.prototype : undefined,
symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
/**
* A specialized version of `baseIsEqualDeep` for comparing objects of
* the same `toStringTag`.
*
* **Note:** This function only supports comparing values with tags of
* `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
*
* @private
* @param {Object} object The object to compare.
* @param {Object} other The other object to compare.
* @param {string} tag The `toStringTag` of the objects to compare.
* @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
* @param {Function} customizer The function to customize comparisons.
* @param {Function} equalFunc The function to determine equivalents of values.
* @param {Object} stack Tracks traversed `object` and `other` objects.
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
*/
function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
switch (tag) {
case dataViewTag:
if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) {
return false;
}
object = object.buffer;
other = other.buffer;
case arrayBufferTag:
if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array$1(object), new Uint8Array$1(other))) {
return false;
}
return true;
case boolTag:
case dateTag:
case numberTag$1:
// Coerce booleans to `1` or `0` and dates to milliseconds.
// Invalid dates are coerced to `NaN`.
return eq(+object, +other);
case errorTag:
return object.name == other.name && object.message == other.message;
case regexpTag:
case stringTag$1:
// Coerce regexes to strings and treat strings, primitives and objects,
// as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
// for more details.
return object == other + '';
case mapTag$1:
var convert = mapToArray;
case setTag$1:
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$4;
convert || (convert = setToArray);
if (object.size != other.size && !isPartial) {
return false;
}
// Assume cyclic values are equal.
var stacked = stack.get(object);
if (stacked) {
return stacked == other;
}
bitmask |= COMPARE_UNORDERED_FLAG$2;
// Recursively compare objects (susceptible to call stack limits).
stack.set(object, other);
var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
stack['delete'](object);
return result;
case symbolTag:
if (symbolValueOf) {
return symbolValueOf.call(object) == symbolValueOf.call(other);
}
}
return false;
}
/** Used to compose bitmasks for value comparisons. */
var COMPARE_PARTIAL_FLAG$3 = 1;
/** Used for built-in method references. */
var objectProto$2 = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty$2 = objectProto$2.hasOwnProperty;
/**
* A specialized version of `baseIsEqualDeep` for objects with support for
* partial deep comparisons.
*
* @private
* @param {Object} object The object to compare.
* @param {Object} other The other object to compare.
* @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
* @param {Function} customizer The function to customize comparisons.
* @param {Function} equalFunc The function to determine equivalents of values.
* @param {Object} stack Tracks traversed `object` and `other` objects.
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
*/
function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$3,
objProps = getAllKeys(object),
objLength = objProps.length,
othProps = getAllKeys(other),
othLength = othProps.length;
if (objLength != othLength && !isPartial) {
return false;
}
var index = objLength;
while (index--) {
var key = objProps[index];
if (!(isPartial ? key in other : hasOwnProperty$2.call(other, key))) {
return false;
}
}
// Check that cyclic values are equal.
var objStacked = stack.get(object);
var othStacked = stack.get(other);
if (objStacked && othStacked) {
return objStacked == other && othStacked == object;
}
var result = true;
stack.set(object, other);
stack.set(other, object);
var skipCtor = isPartial;
while (++index < objLength) {
key = objProps[index];
var objValue = object[key],
othValue = other[key];
if (customizer) {
var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack);
}
// Recursively compare objects (susceptible to call stack limits).
if (!(compared === undefined ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
result = false;
break;
}
skipCtor || (skipCtor = key == 'constructor');
}
if (result && !skipCtor) {
var objCtor = object.constructor,
othCtor = other.constructor;
// Non `Object` object instances with different constructors are not equal.
if (objCtor != othCtor && 'constructor' in object && 'constructor' in other && !(typeof objCtor == 'function' && objCtor instanceof objCtor && typeof othCtor == 'function' && othCtor instanceof othCtor)) {
result = false;
}
}
stack['delete'](object);
stack['delete'](other);
return result;
}
/** Used to compose bitmasks for value comparisons. */
var COMPARE_PARTIAL_FLAG$2 = 1;
/** `Object#toString` result references. */
var argsTag = '[object Arguments]',
arrayTag = '[object Array]',
objectTag = '[object Object]';
/** Used for built-in method references. */
var objectProto$1 = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
/**
* A specialized version of `baseIsEqual` for arrays and objects which performs
* deep comparisons and tracks traversed objects enabling objects with circular
* references to be compared.
*
* @private
* @param {Object} object The object to compare.
* @param {Object} other The other object to compare.
* @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
* @param {Function} customizer The function to customize comparisons.
* @param {Function} equalFunc The function to determine equivalents of values.
* @param {Object} [stack] Tracks traversed `object` and `other` objects.
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
*/
function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
var objIsArr = isArray$1(object),
othIsArr = isArray$1(other),
objTag = objIsArr ? arrayTag : getTag$1(object),
othTag = othIsArr ? arrayTag : getTag$1(other);
objTag = objTag == argsTag ? objectTag : objTag;
othTag = othTag == argsTag ? objectTag : othTag;
var objIsObj = objTag == objectTag,
othIsObj = othTag == objectTag,
isSameTag = objTag == othTag;
if (isSameTag && isBuffer$1(object)) {
if (!isBuffer$1(other)) {
return false;
}
objIsArr = true;
objIsObj = false;
}
if (isSameTag && !objIsObj) {
stack || (stack = new Stack());
return objIsArr || isTypedArray$1(object) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
}
if (!(bitmask & COMPARE_PARTIAL_FLAG$2)) {
var objIsWrapped = objIsObj && hasOwnProperty$1.call(object, '__wrapped__'),
othIsWrapped = othIsObj && hasOwnProperty$1.call(other, '__wrapped__');
if (objIsWrapped || othIsWrapped) {
var objUnwrapped = objIsWrapped ? object.value() : object,
othUnwrapped = othIsWrapped ? other.value() : other;
stack || (stack = new Stack());
return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
}
}
if (!isSameTag) {
return false;
}
stack || (stack = new Stack());
return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
}
/**
* The base implementation of `_.isEqual` which supports partial comparisons
* and tracks traversed objects.
*
* @private
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
* @param {boolean} bitmask The bitmask flags.
* 1 - Unordered comparison
* 2 - Partial comparison
* @param {Function} [customizer] The function to customize comparisons.
* @param {Object} [stack] Tracks traversed `value` and `other` objects.
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
*/
function baseIsEqual(value, other, bitmask, customizer, stack) {
if (value === other) {
return true;
}
if (value == null || other == null || !isObjectLike(value) && !isObjectLike(other)) {
return value !== value && other !== other;
}
return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
}
/** Used to compose bitmasks for value comparisons. */
var COMPARE_PARTIAL_FLAG$1 = 1,
COMPARE_UNORDERED_FLAG$1 = 2;
/**
* The base implementation of `_.isMatch` without support for iteratee shorthands.
*
* @private
* @param {Object} object The object to inspect.
* @param {Object} source The object of property values to match.
* @param {Array} matchData The property names, values, and compare flags to match.
* @param {Function} [customizer] The function to customize comparisons.
* @returns {boolean} Returns `true` if `object` is a match, else `false`.
*/
function baseIsMatch(object, source, matchData, customizer) {
var index = matchData.length,
length = index,
noCustomizer = !customizer;
if (object == null) {
return !length;
}
object = Object(object);
while (index--) {
var data = matchData[index];
if (noCustomizer && data[2] ? data[1] !== object[data[0]] : !(data[0] in object)) {
return false;
}
}
while (++index < length) {
data = matchData[index];
var key = data[0],
objValue = object[key],
srcValue = data[1];
if (noCustomizer && data[2]) {
if (objValue === undefined && !(key in object)) {
return false;
}
} else {
var stack = new Stack();
if (customizer) {
var result = customizer(objValue, srcValue, key, object, source, stack);
}
if (!(result === undefined ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG$1 | COMPARE_UNORDERED_FLAG$1, customizer, stack) : result)) {
return false;
}
}
}
return true;
}
/**
* Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` if suitable for strict
* equality comparisons, else `false`.
*/
function isStrictComparable(value) {
return value === value && !isObject(value);
}
/**
* Gets the property names, values, and compare flags of `object`.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the match data of `object`.
*/
function getMatchData(object) {
var result = keys(object),
length = result.length;
while (length--) {
var key = result[length],
value = object[key];
result[length] = [key, value, isStrictComparable(value)];
}
return result;
}
/**
* A specialized version of `matchesProperty` for source values suitable
* for strict equality comparisons, i.e. `===`.
*
* @private
* @param {string} key The key of the property to get.
* @param {*} srcValue The value to match.
* @returns {Function} Returns the new spec function.
*/
function matchesStrictComparable(key, srcValue) {
return function (object) {
if (object == null) {
return false;
}
return object[key] === srcValue && (srcValue !== undefined || key in Object(object));
};
}
/**
* The base implementation of `_.matches` which doesn't clone `source`.
*
* @private
* @param {Object} source The object of property values to match.
* @returns {Function} Returns the new spec function.
*/
function baseMatches(source) {
var matchData = getMatchData(source);
if (matchData.length == 1 && matchData[0][2]) {
return matchesStrictComparable(matchData[0][0], matchData[0][1]);
}
return function (object) {
return object === source || baseIsMatch(object, source, matchData);
};
}
/**
* The base implementation of `_.hasIn` without support for deep paths.
*
* @private
* @param {Object} [object] The object to query.
* @param {Array|string} key The key to check.
* @returns {boolean} Returns `true` if `key` exists, else `false`.
*/
function baseHasIn(object, key) {
return object != null && key in Object(object);
}
/**
* Checks if `path` exists on `object`.
*
* @private
* @param {Object} object The object to query.
* @param {Array|string} path The path to check.
* @param {Function} hasFunc The function to check properties.
* @returns {boolean} Returns `true` if `path` exists, else `false`.
*/
function hasPath(object, path, hasFunc) {
path = castPath(path, object);
var index = -1,
length = path.length,
result = false;
while (++index < length) {
var key = toKey(path[index]);
if (!(result = object != null && hasFunc(object, key))) {
break;
}
object = object[key];
}
if (result || ++index != length) {
return result;
}
length = object == null ? 0 : object.length;
return !!length && isLength(length) && isIndex(key, length) && (isArray$1(object) || isArguments$1(object));
}
/**
* Checks if `path` is a direct or inherited property of `object`.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Object
* @param {Object} object The object to query.
* @param {Array|string} path The path to check.
* @returns {boolean} Returns `true` if `path` exists, else `false`.
* @example
*
* var object = _.create({ 'a': _.create({ 'b': 2 }) });
*
* _.hasIn(object, 'a');
* // => true
*
* _.hasIn(object, 'a.b');
* // => true
*
* _.hasIn(object, ['a', 'b']);
* // => true
*
* _.hasIn(object, 'b');
* // => false
*/
function hasIn(object, path) {
return object != null && hasPath(object, path, baseHasIn);
}
/** Used to compose bitmasks for value comparisons. */
var COMPARE_PARTIAL_FLAG = 1,
COMPARE_UNORDERED_FLAG = 2;
/**
* The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
*
* @private
* @param {string} path The path of the property to get.
* @param {*} srcValue The value to match.
* @returns {Function} Returns the new spec function.
*/
function baseMatchesProperty(path, srcValue) {
if (isKey(path) && isStrictComparable(srcValue)) {
return matchesStrictComparable(toKey(path), srcValue);
}
return function (object) {
var objValue = get(object, path);
return objValue === undefined && objValue === srcValue ? hasIn(object, path) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
};
}
/**
* The base implementation of `_.property` without support for deep paths.
*
* @private
* @param {string} key The key of the property to get.
* @returns {Function} Returns the new accessor function.
*/
function baseProperty(key) {
return function (object) {
return object == null ? undefined : object[key];
};
}
/**
* A specialized version of `baseProperty` which supports deep paths.
*
* @private
* @param {Array|string} path The path of the property to get.
* @returns {Function} Returns the new accessor function.
*/
function basePropertyDeep(path) {
return function (object) {
return baseGet(object, path);
};
}
/**
* Creates a function that returns the value at `path` of a given object.
*
* @static
* @memberOf _
* @since 2.4.0
* @category Util
* @param {Array|string} path The path of the property to get.
* @returns {Function} Returns the new accessor function.
* @example
*
* var objects = [
* { 'a': { 'b': 2 } },
* { 'a': { 'b': 1 } }
* ];
*
* _.map(objects, _.property('a.b'));
* // => [2, 1]
*
* _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
* // => [1, 2]
*/
function property(path) {
return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
}
/**
* The base implementation of `_.iteratee`.
*
* @private
* @param {*} [value=_.identity] The value to convert to an iteratee.
* @returns {Function} Returns the iteratee.
*/
function baseIteratee(value) {
// Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
// See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
if (typeof value == 'function') {
return value;
}
if (value == null) {
return identity;
}
if (_typeof(value) == 'object') {
return isArray$1(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value);
}
return property(value);
}
/**
* Creates a base function for methods like `_.forIn` and `_.forOwn`.
*
* @private
* @param {boolean} [fromRight] Specify iterating from right to left.
* @returns {Function} Returns the new base function.
*/
function createBaseFor(fromRight) {
return function (object, iteratee, keysFunc) {
var index = -1,
iterable = Object(object),
props = keysFunc(object),
length = props.length;
while (length--) {
var key = props[fromRight ? length : ++index];
if (iteratee(iterable[key], key, iterable) === false) {
break;
}
}
return object;
};
}
/**
* The base implementation of `baseForOwn` which iterates over `object`
* properties returned by `keysFunc` and invokes `iteratee` for each property.
* Iteratee functions may exit iteration early by explicitly returning `false`.
*
* @private
* @param {Object} object The object to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @param {Function} keysFunc The function to get the keys of `object`.
* @returns {Object} Returns `object`.
*/
var baseFor = createBaseFor();
var baseFor$1 = baseFor;
/**
* The base implementation of `_.forOwn` without support for iteratee shorthands.
*
* @private
* @param {Object} object The object to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Object} Returns `object`.
*/
function baseForOwn(object, iteratee) {
return object && baseFor$1(object, iteratee, keys);
}
/**
* Creates a `baseEach` or `baseEachRight` function.
*
* @private
* @param {Function} eachFunc The function to iterate over a collection.
* @param {boolean} [fromRight] Specify iterating from right to left.
* @returns {Function} Returns the new base function.
*/
function createBaseEach(eachFunc, fromRight) {
return function (collection, iteratee) {
if (collection == null) {
return collection;
}
if (!isArrayLike(collection)) {
return eachFunc(collection, iteratee);
}
var length = collection.length,
index = fromRight ? length : -1,
iterable = Object(collection);
while (fromRight ? index-- : ++index < length) {
if (iteratee(iterable[index], index, iterable) === false) {
break;
}
}
return collection;
};
}
/**
* The base implementation of `_.forEach` without support for iteratee shorthands.
*
* @private
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Array|Object} Returns `collection`.
*/
var baseEach = createBaseEach(baseForOwn);
var baseEach$1 = baseEach;
/**
* Gets the timestamp of the number of milliseconds that have elapsed since
* the Unix epoch (1 January 1970 00:00:00 UTC).
*
* @static
* @memberOf _
* @since 2.4.0
* @category Date
* @returns {number} Returns the timestamp.
* @example
*
* _.defer(function(stamp) {
* console.log(_.now() - stamp);
* }, _.now());
* // => Logs the number of milliseconds it took for the deferred invocation.
*/
var now = function now() {
return root$1.Date.now();
};
var now$1 = now;
/**
* This method is like `_.isArrayLike` except that it also checks if `value`
* is an object.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an array-like object,
* else `false`.
* @example
*
* _.isArrayLikeObject([1, 2, 3]);
* // => true
*
* _.isArrayLikeObject(document.body.children);
* // => true
*
* _.isArrayLikeObject('abc');
* // => false
*
* _.isArrayLikeObject(_.noop);
* // => false
*/
function isArrayLikeObject(value) {
return isObjectLike(value) && isArrayLike(value);
}
/**
* This function is like `arrayIncludes` except that it accepts a comparator.
*
* @private
* @param {Array} [array] The array to inspect.
* @param {*} target The value to search for.
* @param {Function} comparator The comparator invoked per element.
* @returns {boolean} Returns `true` if `target` is found, else `false`.
*/
function arrayIncludesWith(array, value, comparator) {
var index = -1,
length = array == null ? 0 : array.length;
while (++index < length) {
if (comparator(value, array[index])) {
return true;
}
}
return false;
}
/** Used as the size to enable large array optimizations. */
var LARGE_ARRAY_SIZE = 200;
/**
* The base implementation of methods like `_.difference` without support
* for excluding multiple arrays or iteratee shorthands.
*
* @private
* @param {Array} array The array to inspect.
* @param {Array} values The values to exclude.
* @param {Function} [iteratee] The iteratee invoked per element.
* @param {Function} [comparator] The comparator invoked per element.
* @returns {Array} Returns the new array of filtered values.
*/
function baseDifference(array, values, iteratee, comparator) {
var index = -1,
includes = arrayIncludes,
isCommon = true,
length = array.length,
result = [],
valuesLength = values.length;
if (!length) {
return result;
}
if (iteratee) {
values = arrayMap(values, baseUnary(iteratee));
}
if (comparator) {
includes = arrayIncludesWith;
isCommon = false;
} else if (values.length >= LARGE_ARRAY_SIZE) {
includes = cacheHas;
isCommon = false;
values = new SetCache(values);
}
outer: while (++index < length) {
var value = array[index],
computed = iteratee == null ? value : iteratee(value);
value = comparator || value !== 0 ? value : 0;
if (isCommon && computed === computed) {
var valuesIndex = valuesLength;
while (valuesIndex--) {
if (values[valuesIndex] === computed) {
continue outer;
}
}
result.push(value);
} else if (!includes(values, computed, comparator)) {
result.push(value);
}
}
return result;
}
/**
* Creates an array of `array` values not included in the other given arrays
* using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* for equality comparisons. The order and references of result values are
* determined by the first array.
*
* **Note:** Unlike `_.pullAll`, this method returns a new array.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Array
* @param {Array} array The array to inspect.
* @param {...Array} [values] The values to exclude.
* @returns {Array} Returns the new array of filtered values.
* @see _.without, _.xor
* @example
*
* _.difference([2, 1], [2, 3]);
* // => [1]
*/
var difference = baseRest(function (array, values) {
return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true)) : [];
});
var difference$1 = difference;
/**
* Gets the last element of `array`.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Array
* @param {Array} array The array to query.
* @returns {*} Returns the last element of `array`.
* @example
*
* _.last([1, 2, 3]);
* // => 3
*/
function last(array) {
var length = array == null ? 0 : array.length;
return length ? array[length - 1] : undefined;
}
/**
* Casts `value` to `identity` if it's not a function.
*
* @private
* @param {*} value The value to inspect.
* @returns {Function} Returns cast function.
*/
function castFunction(value) {
return typeof value == 'function' ? value : identity;
}
/**
* Iterates over elements of `collection` and invokes `iteratee` for each element.
* The iteratee is invoked with three arguments: (value, index|key, collection).
* Iteratee functions may exit iteration early by explicitly returning `false`.
*
* **Note:** As with other "Collections" methods, objects with a "length"
* property are iterated like arrays. To avoid this behavior use `_.forIn`
* or `_.forOwn` for object iteration.
*
* @static
* @memberOf _
* @since 0.1.0
* @alias each
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
* @returns {Array|Object} Returns `collection`.
* @see _.forEachRight
* @example
*
* _.forEach([1, 2], function(value) {
* console.log(value);
* });
* // => Logs `1` then `2`.
*
* _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
* console.log(key);
* });
* // => Logs 'a' then 'b' (iteration order is not guaranteed).
*/
function forEach(collection, iteratee) {
var func = isArray$1(collection) ? arrayEach : baseEach$1;
return func(collection, castFunction(iteratee));
}
/**
* The base implementation of `_.filter` without support for iteratee shorthands.
*
* @private
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} predicate The function invoked per iteration.
* @returns {Array} Returns the new filtered array.
*/
function baseFilter(collection, predicate) {
var result = [];
baseEach$1(collection, function (value, index, collection) {
if (predicate(value, index, collection)) {
result.push(value);
}
});
return result;
}
/**
* Iterates over elements of `collection`, returning an array of all elements
* `predicate` returns truthy for. The predicate is invoked with three
* arguments: (value, index|key, collection).
*
* **Note:** Unlike `_.remove`, this method returns a new array.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} [predicate=_.identity] The function invoked per iteration.
* @returns {Array} Returns the new filtered array.
* @see _.reject
* @example
*
* var users = [
* { 'user': 'barney', 'age': 36, 'active': true },
* { 'user': 'fred', 'age': 40, 'active': false }
* ];
*
* _.filter(users, function(o) { return !o.active; });
* // => objects for ['fred']
*
* // The `_.matches` iteratee shorthand.
* _.filter(users, { 'age': 36, 'active': true });
* // => objects for ['barney']
*
* // The `_.matchesProperty` iteratee shorthand.
* _.filter(users, ['active', false]);
* // => objects for ['fred']
*
* // The `_.property` iteratee shorthand.
* _.filter(users, 'active');
* // => objects for ['barney']
*
* // Combining several predicates using `_.overEvery` or `_.overSome`.
* _.filter(users, _.overSome([{ 'age': 36 }, ['age', 40]]));
* // => objects for ['fred', 'barney']
*/
function filter(collection, predicate) {
var func = isArray$1(collection) ? arrayFilter : baseFilter;
return func(collection, baseIteratee(predicate));
}
/**
* Creates a `_.find` or `_.findLast` function.
*
* @private
* @param {Function} findIndexFunc The function to find the collection index.
* @returns {Function} Returns the new find function.
*/
function createFind(findIndexFunc) {
return function (collection, predicate, fromIndex) {
var iterable = Object(collection);
if (!isArrayLike(collection)) {
var iteratee = baseIteratee(predicate);
collection = keys(collection);
predicate = function predicate(key) {
return iteratee(iterable[key], key, iterable);
};
}
var index = findIndexFunc(collection, predicate, fromIndex);
return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
};
}
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeMax = Math.max;
/**
* This method is like `_.find` except that it returns the index of the first
* element `predicate` returns truthy for instead of the element itself.
*
* @static
* @memberOf _
* @since 1.1.0
* @category Array
* @param {Array} array The array to inspect.
* @param {Function} [predicate=_.identity] The function invoked per iteration.
* @param {number} [fromIndex=0] The index to search from.
* @returns {number} Returns the index of the found element, else `-1`.
* @example
*
* var users = [
* { 'user': 'barney', 'active': false },
* { 'user': 'fred', 'active': false },
* { 'user': 'pebbles', 'active': true }
* ];
*
* _.findIndex(users, function(o) { return o.user == 'barney'; });
* // => 0
*
* // The `_.matches` iteratee shorthand.
* _.findIndex(users, { 'user': 'fred', 'active': false });
* // => 1
*
* // The `_.matchesProperty` iteratee shorthand.
* _.findIndex(users, ['active', false]);
* // => 0
*
* // The `_.property` iteratee shorthand.
* _.findIndex(users, 'active');
* // => 2
*/
function findIndex(array, predicate, fromIndex) {
var length = array == null ? 0 : array.length;
if (!length) {
return -1;
}
var index = fromIndex == null ? 0 : toInteger(fromIndex);
if (index < 0) {
index = nativeMax(length + index, 0);
}
return baseFindIndex(array, baseIteratee(predicate), index);
}
/**
* Iterates over elements of `collection`, returning the first element
* `predicate` returns truthy for. The predicate is invoked with three
* arguments: (value, index|key, collection).
*
* @static
* @memberOf _
* @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to inspect.
* @param {Function} [predicate=_.identity] The function invoked per iteration.
* @param {number} [fromIndex=0] The index to search from.
* @returns {*} Returns the matched element, else `undefined`.
* @example
*
* var users = [
* { 'user': 'barney', 'age': 36, 'active': true },
* { 'user': 'fred', 'age': 40, 'active': false },
* { 'user': 'pebbles', 'age': 1, 'active': true }
* ];
*
* _.find(users, function(o) { return o.age < 40; });
* // => object for 'barney'
*
* // The `_.matches` iteratee shorthand.
* _.find(users, { 'age': 1, 'active': true });
* // => object for 'pebbles'
*
* // The `_.matchesProperty` iteratee shorthand.
* _.find(users, ['active', false]);
* // => object for 'fred'
*
* // The `_.property` iteratee shorthand.
* _.find(users, 'active');
* // => object for 'barney'
*/
var find = createFind(findIndex);
var find$1 = find;
/**
* The base implementation of `_.map` without support for iteratee shorthands.
*
* @private
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Array} Returns the new mapped array.
*/
function baseMap(collection, iteratee) {
var index = -1,
result = isArrayLike(collection) ? Array(collection.length) : [];
baseEach$1(collection, function (value, key, collection) {
result[++index] = iteratee(value, key, collection);
});
return result;
}
/**
* Creates an array of values by running each element in `collection` thru
* `iteratee`. The iteratee is invoked with three arguments:
* (value, index|key, collection).
*
* Many lodash methods are guarded to work as iteratees for methods like
* `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
*
* The guarded methods are:
* `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
* `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
* `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
* `template`, `trim`, `trimEnd`, `trimStart`, and `words`
*
* @static
* @memberOf _
* @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
* @returns {Array} Returns the new mapped array.
* @example
*
* function square(n) {
* return n * n;
* }
*
* _.map([4, 8], square);
* // => [16, 64]
*
* _.map({ 'a': 4, 'b': 8 }, square);
* // => [16, 64] (iteration order is not guaranteed)
*
* var users = [
* { 'user': 'barney' },
* { 'user': 'fred' }
* ];
*
* // The `_.property` iteratee shorthand.
* _.map(users, 'user');
* // => ['barney', 'fred']
*/
function map(collection, iteratee) {
var func = isArray$1(collection) ? arrayMap : baseMap;
return func(collection, baseIteratee(iteratee));
}
/** `Object#toString` result references. */
var stringTag = '[object String]';
/**
* Checks if `value` is classified as a `String` primitive or object.
*
* @static
* @since 0.1.0
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a string, else `false`.
* @example
*
* _.isString('abc');
* // => true
*
* _.isString(1);
* // => false
*/
function isString(value) {
return typeof value == 'string' || !isArray$1(value) && isObjectLike(value) && baseGetTag(value) == stringTag;
}
/**
* Gets the parent value at `path` of `object`.
*
* @private
* @param {Object} object The object to query.
* @param {Array} path The path to get the parent value of.
* @returns {*} Returns the parent value.
*/
function parent(object, path) {
return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
}
/** `Object#toString` result references. */
var mapTag = '[object Map]',
setTag = '[object Set]';
/** Used for built-in method references. */
var objectProto = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/**
* Checks if `value` is an empty object, collection, map, or set.
*
* Objects are considered empty if they have no own enumerable string keyed
* properties.
*
* Array-like values such as `arguments` objects, arrays, buffers, strings, or
* jQuery-like collections are considered empty if they have a `length` of `0`.
* Similarly, maps and sets are considered empty if they have a `size` of `0`.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is empty, else `false`.
* @example
*
* _.isEmpty(null);
* // => true
*
* _.isEmpty(true);
* // => true
*
* _.isEmpty(1);
* // => true
*
* _.isEmpty([1, 2, 3]);
* // => false
*
* _.isEmpty({ 'a': 1 });
* // => false
*/
function isEmpty(value) {
if (value == null) {
return true;
}
if (isArrayLike(value) && (isArray$1(value) || typeof value == 'string' || typeof value.splice == 'function' || isBuffer$1(value) || isTypedArray$1(value) || isArguments$1(value))) {
return !value.length;
}
var tag = getTag$1(value);
if (tag == mapTag || tag == setTag) {
return !value.size;
}
if (isPrototype(value)) {
return !baseKeys(value).length;
}
for (var key in value) {
if (hasOwnProperty.call(value, key)) {
return false;
}
}
return true;
}
/** `Object#toString` result references. */
var numberTag = '[object Number]';
/**
* Checks if `value` is classified as a `Number` primitive or object.
*
* **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
* classified as numbers, use the `_.isFinite` method.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a number, else `false`.
* @example
*
* _.isNumber(3);
* // => true
*
* _.isNumber(Number.MIN_VALUE);
* // => true
*
* _.isNumber(Infinity);
* // => true
*
* _.isNumber('3');
* // => false
*/
function isNumber(value) {
return typeof value == 'number' || isObjectLike(value) && baseGetTag(value) == numberTag;
}
/**
* The base implementation of `_.unset`.
*
* @private
* @param {Object} object The object to modify.
* @param {Array|string} path The property path to unset.
* @returns {boolean} Returns `true` if the property is deleted, else `false`.
*/
function baseUnset(object, path) {
path = castPath(path, object);
object = parent(object, path);
return object == null || delete object[toKey(last(path))];
}
/**
* Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
* objects.
*
* @private
* @param {*} value The value to inspect.
* @param {string} key The key of the property to inspect.
* @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
*/
function customOmitClone(value) {
return isPlainObject(value) ? undefined : value;
}
/** Used to compose bitmasks for cloning. */
var CLONE_DEEP_FLAG = 1,
CLONE_FLAT_FLAG = 2,
CLONE_SYMBOLS_FLAG = 4;
/**
* The opposite of `_.pick`; this method creates an object composed of the
* own and inherited enumerable property paths of `object` that are not omitted.
*
* **Note:** This method is considerably slower than `_.pick`.
*
* @static
* @since 0.1.0
* @memberOf _
* @category Object
* @param {Object} object The source object.
* @param {...(string|string[])} [paths] The property paths to omit.
* @returns {Object} Returns the new object.
* @example
*
* var object = { 'a': 1, 'b': '2', 'c': 3 };
*
* _.omit(object, ['a', 'c']);
* // => { 'b': '2' }
*/
var omit = flatRest(function (object, paths) {
var result = {};
if (object == null) {
return result;
}
var isDeep = false;
paths = arrayMap(paths, function (path) {
path = castPath(path, object);
isDeep || (isDeep = path.length > 1);
return path;
});
copyObject(object, getAllKeysIn(object), result);
if (isDeep) {
result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
}
var length = paths.length;
while (length--) {
baseUnset(result, paths[length]);
}
return result;
});
var omit$1 = omit;
/**
* The base implementation of `_.set`.
*
* @private
* @param {Object} object The object to modify.
* @param {Array|string} path The path of the property to set.
* @param {*} value The value to set.
* @param {Function} [customizer] The function to customize path creation.
* @returns {Object} Returns `object`.
*/
function baseSet(object, path, value, customizer) {
if (!isObject(object)) {
return object;
}
path = castPath(path, object);
var index = -1,
length = path.length,
lastIndex = length - 1,
nested = object;
while (nested != null && ++index < length) {
var key = toKey(path[index]),
newValue = value;
if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
return object;
}
if (index != lastIndex) {
var objValue = nested[key];
newValue = customizer ? customizer(objValue, key, nested) : undefined;
if (newValue === undefined) {
newValue = isObject(objValue) ? objValue : isIndex(path[index + 1]) ? [] : {};
}
}
assignValue(nested, key, newValue);
nested = nested[key];
}
return object;
}
/**
* The base implementation of `_.pickBy` without support for iteratee shorthands.
*
* @private
* @param {Object} object The source object.
* @param {string[]} paths The property paths to pick.
* @param {Function} predicate The function invoked per property.
* @returns {Object} Returns the new object.
*/
function basePickBy(object, paths, predicate) {
var index = -1,
length = paths.length,
result = {};
while (++index < length) {
var path = paths[index],
value = baseGet(object, path);
if (predicate(value, path)) {
baseSet(result, castPath(path, object), value);
}
}
return result;
}
/**
* The base implementation of `_.pick` without support for individual
* property identifiers.
*
* @private
* @param {Object} object The source object.
* @param {string[]} paths The property paths to pick.
* @returns {Object} Returns the new object.
*/
function basePick(object, paths) {
return basePickBy(object, paths, function (value, path) {
return hasIn(object, path);
});
}
/**
* Creates an object composed of the picked `object` properties.
*
* @static
* @since 0.1.0
* @memberOf _
* @category Object
* @param {Object} object The source object.
* @param {...(string|string[])} [paths] The property paths to pick.
* @returns {Object} Returns the new object.
* @example
*
* var object = { 'a': 1, 'b': '2', 'c': 3 };
*
* _.pick(object, ['a', 'c']);
* // => { 'a': 1, 'c': 3 }
*/
var pick = flatRest(function (object, paths) {
return object == null ? {} : basePick(object, paths);
});
var pick$1 = pick;
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeFloor = Math.floor,
nativeRandom$1 = Math.random;
/**
* The base implementation of `_.random` without support for returning
* floating-point numbers.
*
* @private
* @param {number} lower The lower bound.
* @param {number} upper The upper bound.
* @returns {number} Returns the random number.
*/
function baseRandom(lower, upper) {
return lower + nativeFloor(nativeRandom$1() * (upper - lower + 1));
}
/** Built-in method references without a dependency on `root`. */
var freeParseFloat = parseFloat;
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeMin = Math.min,
nativeRandom = Math.random;
/**
* Produces a random number between the inclusive `lower` and `upper` bounds.
* If only one argument is provided a number between `0` and the given number
* is returned. If `floating` is `true`, or either `lower` or `upper` are
* floats, a floating-point number is returned instead of an integer.
*
* **Note:** JavaScript follows the IEEE-754 standard for resolving
* floating-point values which can produce unexpected results.
*
* @static
* @memberOf _
* @since 0.7.0
* @category Number
* @param {number} [lower=0] The lower bound.
* @param {number} [upper=1] The upper bound.
* @param {boolean} [floating] Specify returning a floating-point number.
* @returns {number} Returns the random number.
* @example
*
* _.random(0, 5);
* // => an integer between 0 and 5
*
* _.random(5);
* // => also an integer between 0 and 5
*
* _.random(5, true);
* // => a floating-point number between 0 and 5
*
* _.random(1.2, 5.2);
* // => a floating-point number between 1.2 and 5.2
*/
function random(lower, upper, floating) {
if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {
upper = floating = undefined;
}
if (floating === undefined) {
if (typeof upper == 'boolean') {
floating = upper;
upper = undefined;
} else if (typeof lower == 'boolean') {
floating = lower;
lower = undefined;
}
}
if (lower === undefined && upper === undefined) {
lower = 0;
upper = 1;
} else {
lower = toFinite(lower);
if (upper === undefined) {
upper = lower;
lower = 0;
} else {
upper = toFinite(upper);
}
}
if (lower > upper) {
var temp = lower;
lower = upper;
upper = temp;
}
if (floating || lower % 1 || upper % 1) {
var rand = nativeRandom();
return nativeMin(lower + rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1))), upper);
}
return baseRandom(lower, upper);
}
/**
* Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
* it's created. Arrays are created for missing index properties while objects
* are created for all other missing properties. Use `_.setWith` to customize
* `path` creation.
*
* **Note:** This method mutates `object`.
*
* @static
* @memberOf _
* @since 3.7.0
* @category Object
* @param {Object} object The object to modify.
* @param {Array|string} path The path of the property to set.
* @param {*} value The value to set.
* @returns {Object} Returns `object`.
* @example
*
* var object = { 'a': [{ 'b': { 'c': 3 } }] };
*
* _.set(object, 'a[0].b.c', 4);
* console.log(object.a[0].b.c);
* // => 4
*
* _.set(object, ['x', '0', 'y', 'z'], 5);
* console.log(object.x[0].y.z);
* // => 5
*/
function set(object, path, value) {
return object == null ? object : baseSet(object, path, value);
}
/**
* Creates a slice of `array` from `start` up to, but not including, `end`.
*
* **Note:** This method is used instead of
* [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
* returned.
*
* @static
* @memberOf _
* @since 3.0.0
* @category Array
* @param {Array} array The array to slice.
* @param {number} [start=0] The start position.
* @param {number} [end=array.length] The end position.
* @returns {Array} Returns the slice of `array`.
*/
function slice(array, start, end) {
var length = array == null ? 0 : array.length;
if (!length) {
return [];
}
if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
start = 0;
end = length;
} else {
start = start == null ? 0 : toInteger(start);
end = end === undefined ? length : toInteger(end);
}
return baseSlice(array, start, end);
}
/**
* The base implementation of `_.some` without support for iteratee shorthands.
*
* @private
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} predicate The function invoked per iteration.
* @returns {boolean} Returns `true` if any element passes the predicate check,
* else `false`.
*/
function baseSome(collection, predicate) {
var result;
baseEach$1(collection, function (value, index, collection) {
result = predicate(value, index, collection);
return !result;
});
return !!result;
}
/**
* Checks if `predicate` returns truthy for **any** element of `collection`.
* Iteration is stopped once `predicate` returns truthy. The predicate is
* invoked with three arguments: (value, index|key, collection).
*
* @static
* @memberOf _
* @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} [predicate=_.identity] The function invoked per iteration.
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
* @returns {boolean} Returns `true` if any element passes the predicate check,
* else `false`.
* @example
*
* _.some([null, 0, 'yes', false], Boolean);
* // => true
*
* var users = [
* { 'user': 'barney', 'active': true },
* { 'user': 'fred', 'active': false }
* ];
*
* // The `_.matches` iteratee shorthand.
* _.some(users, { 'user': 'barney', 'active': false });
* // => false
*
* // The `_.matchesProperty` iteratee shorthand.
* _.some(users, ['active', false]);
* // => true
*
* // The `_.property` iteratee shorthand.
* _.some(users, 'active');
* // => true
*/
function some(collection, predicate, guard) {
var func = isArray$1(collection) ? arraySome : baseSome;
if (guard && isIterateeCall(collection, predicate, guard)) {
predicate = undefined;
}
return func(collection, baseIteratee(predicate));
}
/**
* @ngdoc object
* @name sidebarMenu.object:SidebarMenuListItem
*
* @requires $q
*
* @description
* Factory that describe an item into manager sidebar menu.
*
* @example
* <pre>
* angular.module("myManagerApp").controller("MyTestCtrl", function ($q, SidebarMenuListItem) {
* var myMenuItem = new SidebarMenuListItem({
* title : "My beautiful title",
* state : "manager.my.state"
* stateParams : {
* foo : "test",
* test : "foo"
* },
* icon : "dots",
* allowSubItems : true,
* onLoad : function () {
* return $q.when([]);
* }
* });
* });
* </pre>
*
* @constructor
* @param {Object} options Options for creating a new SidebarMenuListItem.
* @param {Boolean=} [options.allowSearch=false] Flag telling if item allow search.
* Only available for item of level 1.
* @param {Boolean=} [options.allowSubItems=false] Flag telling if item allow to have sub items.
* If true will display an arrow icon before title.
* @param {String=} [options.category=none] Add a category to the item. This will be added as a
* new class to the menu item element.
* @param {String=} options.icon Icon added before prefix and title. Example : ovh-font icon!
* @param {Number|String=} [options.id=A random Number] Unique id of the SidebarMenuListItem.
* @param {Number=} options.level Menu item level.
* @param {Object} options.viewAllItem Links to a page that manages all subitems.
* @param {Object=} options.viewMore Custom object to implement your own pagination method.
* @param {String} options.viewMore.title The displayed title of the viewMore button.
* @param {Boolean} options.viewMore.enabled Should the viewMore button be displayed?
* @param {Boolean} options.viewMore.loading Should a loading spinner be displayed near
* the viewMore button?
* @param {Function} options.viewMore.action Custom pagination callback to be called when viewMore
* button is pressed. If this callback returns a promise, the scrollbar will scroll automatically
* to the bottom after the promise is resolved (when your paginated items have been added).
* @param {String|Array} options.loadOnState State(s) that will automatically load the menu item.
* For this to work, states MUST be declared as parent/child
* (example of state name : parent.child.subchild).
* @param {Object=} [options.loadOnStateParams={}] StateParams that will that defines the state
* that will automatically load the menu item. Ignored if no loadOnState option.
* @param {Function=} options.onLoad Function called to load sub items. This function MUST return
* a promise.
* @param {Number|String=} [options.parentId=null] Unique id of the parent SidebarMenuListItem.
* @param {String=} options.prefix Prefix added befor item title.
* @param {String=} options.state State name where to redirect when clicking on item. Will be
* ignored if both options (state and url) are setted.
* @param {Object=} [options.stateParams={}] State params to add when switching state.
* Ignored if no state option.
* @param {String=} options.status Add a status to the item. This will be added as a new class to
* the menu item element.
* @param {String=} [options.target=_blank] Target attribute value that will be added to item link.
* Ignored if no url option.
* @param {String} options.title Title of the the menu item. This is what will be displayed
* (cropped if too long and the entire title will be in the title attribute).
* @param {String} [options.error=none] Error message that will be displayed if loding promise
* is rejected.
* @param {String=} options.url Url to redirect when item link is clicked. Will be ignored
* if both options (url and state) are setted.
* @param {Boolean} options.infiniteScroll Should infinite scroll be used for scrolling subItems?
* @param {Boolean} [options.searchable=true] Flag telling if item is searchable, true by default,
* must be set to false to hide it from search.
* @param {String} [options.namespace] Namespace equals to Sidebar namespace.
*/
_ngInjectExport$2.$inject = ["$q", "$timeout"];
function _ngInjectExport$2($q, $timeout) {
/*= ==================================
= CONSTRUCTOR =
=================================== */
function SidebarMenuListItem() {
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
this.id = options.id || random(now$1());
this.parentId = options.parentId || null;
// for display
this.title = options.title;
this.error = options.error;
this.prefix = options.prefix;
this.icon = options.icon;
this.category = options.category || 'none';
this.status = options.status || 'none';
this.namespace = options.namespace;
// level informations
this.level = options.level;
// item loading
this.onLoad = options.onLoad;
this.loadOnState = options.loadOnState;
this.loadOnStateParams = options.loadOnStateParams || {};
this.isLoaded = options.isLoaded || false;
this.loading = false;
// state and url management
if (options.state && !options.url) {
this.state = options.state;
this.stateParams = options.stateParams || {};
} else if (options.url && !options.state) {
this.url = options.url;
this.target = options.target || '_blank';
}
// sub items
this.subItems = [];
/**
* SubItemsPending is an attempt to optimize performance of sidebar menu.
* When adding a subItem, it is first added to subItemPending list (which is not displayed).
* When opening the item, the subItemsPending list is appended to subItems list.
* It allow subItems to be added to the DOM only when they are displayed and increase a lot
* performance for when the tree has lots of child nodes.
*/
this.subItemsPending = [];
// raw list containing all added subItems (used when clearing search results)
this.subItemsAdded = [];
this.allowSubItems = options.allowSubItems || false;
this.viewAllItem = options.viewAllItem || null;
// search
if (this.level === 1) {
this.allowSearch = options.allowSearch || false;
}
this.forceDisplaySearch = options.forceDisplaySearch || false;
// view more
this.viewMore = options.viewMore || null;
this.isOpen = false;
this.isActive = false;
this.shouldHide = null;
// string to perform search on
this.searchable = options.searchable !== false;
this.searchKey = angular__default["default"].isString(this.id) ? this.id : '';
if (angular__default["default"].isString(this.title)) {
this.searchKey += " ".concat(this.title);
}
this.searchKey = this.searchKey.toLowerCase();
this.noSearchResults = false;
// use sexy infinite scroll?
this.infiniteScroll = options.infiniteScroll || false;
}
/* ----- End of CONSTRUCTOR ------*/
/*= ========================================
= PROTOTYPE METHODS =
========================================= */
/* ---------- HELPERS ----------*/
/**
* @ngdoc method
* @name sidebarMenu.object:SidebarMenuListItem#hasSubItems
* @methodOf sidebarMenu.object:SidebarMenuListItem
*
* @description
* Check if an item has sub items.
*
* @returns {Boolean} true if item has sub items. false otherwise.
*/
SidebarMenuListItem.prototype.hasSubItems = function hasSubItems() {
var self = this;
// note: subItemsPending are subItems that are not displayed in the DOM
return self.subItems.length > 0 || self.subItemsPending.length > 0;
};
/**
* @ngdoc method
* @name sidebarMenu.object:SidebarMenuListItem#getSubItems
* @methodOf sidebarMenu.object:SidebarMenuListItem
*
* @description
* Returns the list of sub items.
*
* @returns {Array} the list of sub items.
*/
SidebarMenuListItem.prototype.getSubItems = function getSubItems() {
// returns subItems and pending subItems (not already in the dom)
return this.subItems.concat(this.subItemsPending);
};
/**
* @ngdoc method
* @name sidebarMenu.object:SidebarMenuListItem#getTitle
* @methodOf sidebarMenu.object:SidebarMenuListItem
*
* @description
* Get the full item title. With prefix if setted.
*
* @returns {String} The full item title.
*/
SidebarMenuListItem.prototype.getTitle = function getTitle() {
var self = this;
return self.prefix ? "".concat(self.prefix, " ").concat(self.title) : self.title;
};
/**
* @ngdoc method
* @name sidebarMenu.object:SidebarMenuListItem#getFullSref
* @methodOf sidebarMenu.object:SidebarMenuListItem
*
* @description
* Build the full sref with state name and state params.
*
* @returns {String} The full sref value setted into data-ui-sref item link attribute.
*/
SidebarMenuListItem.prototype.getFullSref = function getFullSref() {
return "".concat(this.state, "(").concat(JSON.stringify(this.stateParams), ")");
};
/* ---------- ACTIONS ----------*/
/**
* @ngdoc method
* @name sidebarMenu.object:SidebarMenuListItem#loadSubItems
* @methodOf sidebarMenu.object:SidebarMenuListItem
*
* @description
* Load the sub items of the current item.
*
* @returns {Promise} That should return the list of sub SidebarMenuListItem instances loaded.
* Empty Array if no onLoad function or item does not allow sub items.
*/
SidebarMenuListItem.prototype.loadSubItems = function loadSubItems(force) {
var self = this;
var promise = $q.when([]);
if (self.onLoad && self.allowSubItems && !self.loading && (!self.isLoaded || force)) {
// set loading flag
self.loading = true;
// load items
promise = self.onLoad().then(function (result) {
self.isLoaded = true;
return result;
})["finally"](function () {
self.loading = false;
});
}
return promise;
};
/**
* @ngdoc method
* @name sidebarMenu.object:SidebarMenuListItem#toggleOpen
* @methodOf sidebarMenu.object:SidebarMenuListItem
*
* @description
* Toggle the open state of the item.
*
* @returns {SidebarMenuListItem} Current instance of menu item.
*/
SidebarMenuListItem.prototype.toggleOpen = function toggleOpen() {
var _this = this;
if (this.hasSubItems()) {
this.isOpen = !this.isOpen;
}
// append pending subItems so they are displayed in the DOM
if (this.isOpen && this.subItemsPending.length) {
// this.appendPendingListItems();
this.appendPendingListItemsAsync();
}
/**
* Be ready for an awesome performance optimization ...
*
* When we close an item, subItems won't be visible so the angular bindings
* and the DOM content of subItems is a cpu/memory waste right?
*
* So, we create a timeout that will eventually free up used $$watchers
* and DOM element by moving subItems to pendingSubItems (remember that only
* subItems are rendered in ng-repeat, not pendingSubItems).
*/
/* eslint-disable no-underscore-dangle */
if (!this.isOpen) {
if (this._garbageCollect) {
$timeout.cancel(this._garbageCollect);
}
this._garbageCollect = $timeout(function () {
if (!_this.isOpen) {
_this.subItemsPending = _this.subItems.concat(_this.subItemsPending);
_this.subItems = [];
}
}, 3000);
}
/* eslint-enable */
return this;
};
/**
* @ngdoc method
* @name sidebarMenu.object:SidebarMenuListItem#appendPendingListItems
* @methodOf sidebarMenu.object:SidebarMenuListItem
*
* @description
* Append the pending list of items to the sub items list.
* If the list of pending items is large it can be better to call
* SidebarMenuListItem#appendPendingListItemsAsync in order to
* not freeze the brower by flooding the DOM with subItems directives.
*
* @returns {SidebarMenuListItem} Current instance of menu item.
*/
SidebarMenuListItem.prototype.appendPendingListItems = function appendPendingListItems() {
var self = this;
self.subItems = self.subItems.concat(self.subItemsPending);
self.subItemsPending = [];
};
/**
* @ngdoc method
* @name sidebarMenu.object:SidebarMenuListItem#appendPendingListItemsAsync
* @methodOf sidebarMenu.object:SidebarMenuListItem
*
* @description
* Append asynchronously the pending list of items to the sub items list.
* It allows to not freeze the browser when the list of pending items is large.
* Pending items are added in chunks of 5 sequentially by calling timeouts
* multiple times.
*
* @returns {SidebarMenuListItem} Current instance of menu item.
*/
SidebarMenuListItem.prototype.appendPendingListItemsAsync = function appendPdgListItemsAsync() {
var self = this;
// timeout is here to wait for scrollbar being redrawn ...
$timeout(function () {
var chunk = slice(self.subItemsPending, 0, 5);
if (self.infiniteScroll && self.getScrollbar) {
var scrollbar = self.getScrollbar();
if (scrollbar.visible && !scrollbar.bottom) {
return;
}
}
if (chunk.length && self.isOpen) {
self.subItemsPending = self.subItemsPending.slice(chunk.length);
self.subItems = self.subItems.concat(chunk);
$timeout(function () {
self.appendPendingListItemsAsync();
}, 0);
}
});
};
/* ---------- ITEMS ----------*/
/**
* @ngdoc method
* @name sidebarMenu.object:SidebarMenuListItem#addSubItem
* @methodOf sidebarMenu.object:SidebarMenuListItem
*
* @description
* Add a sub menu item to sub items list.
*
* @param {Object} subItemOptions Options of sub item that will be added.
* See constructor for more options informations.
*
* @returns {SidebarMenuListItem} The added sub item.
*/
SidebarMenuListItem.prototype.addSubItem = function addSubItem(subItemOptions) {
var self = this;
var subItem = null;
if (!self.allowSubItems) {
return null;
}
subItem = new SidebarMenuListItem(angular__default["default"].extend(subItemOptions, {
parentId: self.id
}));
if (self.isOpen) {
self.subItems.push(subItem);
} else {
// since parent item is not open, we add the child in a temporary list
// so it will be added to the DOM only when parent will be opened
self.subItemsPending.push(subItem);
}
self.subItemsAdded.push(subItem);
return subItem;
};
/**
* @ngdoc method
* @name sidebarMenu.object:SidebarMenuListItem#addSubItems
* @methodOf sidebarMenu.object:SidebarMenuListItem
*
* @description
* Add multiple sub items to sub items list.
*
* @param {Array<Object>} subItemsOptions Array of sub items options to add to item.
* See constructor for more options informations.
*
* @returns {SidebarMenuListItem} Current instance of menu item.
*/
SidebarMenuListItem.prototype.addSubItems = function addSubItems(subItemsOptions) {
var _this2 = this;
if (!this.allowSubItems) {
return this;
}
angular__default["default"].forEach(subItemsOptions, function (subItemOptions) {
_this2.addSubItem(subItemOptions);
});
return this;
};
/**
* @ngdoc method
* @name sidebarMenu.object:SidebarMenuListItem#clearSubItems
* @methodOf sidebarMenu.object:SidebarMenuListItem
*
* @description
* Empty list of sub items.
*
* @returns {SidebarMenuListItem} Current instance of menu item.
*/
SidebarMenuListItem.prototype.clearSubItems = function clearSubItems() {
this.subItems = [];
this.subItemsPending = [];
return this;
};
/**
* @ngdoc method
* @name sidebarMenu.object:SidebarMenuListItem#addSearchKey
* @methodOf sidebarMenu.object:SidebarMenuListItem
*
* @description
* Add a key for when searching / filtering items.
*
* @returns {SidebarMenuListItem} Current instance of menu item.
*/
SidebarMenuListItem.prototype.addSearchKey = function addSearchKey(key) {
if (angular__default["default"].isString(key)) {
this.searchKey += " ".concat(key.toLowerCase());
}
return this;
};
/**
* @ngdoc method
* @name sidebarMenu.object:SidebarMenuListItem#displaySearchResults
* @methodOf sidebarMenu.object:SidebarMenuListItem
*
* @description
* Update items to display given search results.
*
* @returns {SidebarMenuListItem} Current instance of menu item.
*/
SidebarMenuListItem.prototype.displaySearchResults = function displaySearchResults(result) {
var self = this;
self.subItems = [];
self.subItemsPending = result;
self.noSearchResults = result.length === 0;
// timeout is here so the scrollbar has time to be updated
// after subItems is cleared, since calling appendPendingListItemsAsync
// depends on sidebar size to append items
$timeout(function () {
self.appendPendingListItemsAsync();
});
return self;
};
/**
* @ngdoc method
* @name sidebarMenu.object:SidebarMenuListItem#filterSubItems
* @methodOf sidebarMenu.object:SidebarMenuListItem
*
* @description
* Search for string "search" in item's searchKey and perform the
* search recursively in all subItems.
* Items not matching the "search" will be removed from the dom.
*
* @returns {SidebarMenuListItem} Current instance of menu item.
*/
SidebarMenuListItem.prototype.filterSubItems = function filterSubItems() {
// Recursively checks if item or subItems are matching the given search query
// If an item of level 2 matches the search, return it with all subItems
// If an item of level 3 matches the search, filter and attach it to its parent
// If no match, return null
function getMatchingItem(item, search) {
function isMatchingSearch(itemParam, searchParam) {
return itemParam.searchable && itemParam.searchKey.indexOf(searchParam) >= 0;
}
if (isMatchingSearch(item, search)) {
return item;
}
var matchingItem = new SidebarMenuListItem(angular__default["default"].copy(item));
angular__default["default"].forEach(item.getSubItems(), function (subItem) {
if (isMatchingSearch(subItem, search)) {
matchingItem.addSubItem(angular__default["default"].copy(subItem));
}
});
return matchingItem.hasSubItems() ? matchingItem : null;
}
return function filterSubItemsInner(searchParam) {
var search = searchParam;
var self = this;
// search nothing => clear results
if (!angular__default["default"].isString(search)) {
self.displaySearchResults(angular__default["default"].copy(self.subItemsAdded));
} else {
search = search.toLowerCase(); // ignore case
var promises = map(filter(self.subItemsAdded, function (item) {
return item.onLoad && !item.isLoaded;
}), function (item) {
return item.loadSubItems();
});
$q.all(promises).then(function () {
var filteredItems = filter(map(self.subItemsAdded, function (item) {
return getMatchingItem(item, search);
}));
self.displaySearchResults(filteredItems);
});
}
return self;
};
}();
/**
* @ngdoc method
* @name sidebarMenu.object:SidebarMenuListItem#hide
* @methodOf sidebarMenu.object:SidebarMenuListItem
*
* @description
* Hide item.
*
* @returns {SidebarMenuListItem} Current instance of menu item.
*/
SidebarMenuListItem.prototype.hide = function hide() {
var self = this;
self.shouldHide = true;
return self;
};
SidebarMenuListItem.prototype.isValidNamespace = function isValidNamespace(namespace) {
if (Array.isArray(this.namespace)) {
return this.namespace.includes(namespace);
}
return this.namespace === namespace;
};
/* ----- End of PROTOTYPE METHODS ------*/
return SidebarMenuListItem;
}
var template$2 = "<!-- item has sref and allow sub items -->\n<a class=\"menu-item\" title=\"{{ ItemMenuCtrl.item.getTitle() }}\" data-ng-if=\"ItemMenuCtrl.item.state\" data-ng-click=\"ItemMenuCtrl.toggleItemOpenState()\" data-ui-sref=\"{{ :: ItemMenuCtrl.item.getFullSref() }}\">\n <!-- ARROW -->\n <span class=\"item-arrow\" aria-hidden=\"true\" data-ng-class=\"{ 'no-sub' : !ItemMenuCtrl.item.allowSubItems }\" data-ng-if=\"!ItemMenuCtrl.item.loading\">\n <i class=\"ovh-font\" data-ng-class=\"{ 'ovh-font-small-arrow-right' : !ItemMenuCtrl.item.isOpen, 'ovh-font-small-arrow-down' : ItemMenuCtrl.item.isOpen }\" data-ng-if=\"ItemMenuCtrl.item.allowSubItems\">\n </i>\n </span>\n\n <!-- LOADING -->\n <span class=\"item-loading\" aria-hidden=\"true\" data-ng-if=\"ItemMenuCtrl.item.loading\">\n <span class=\"oui-spinner oui-spinner_s\">\n <span class=\"oui-spinner__container\">\n <span class=\"oui-spinner__image\"></span>\n </span>\n </span>\n </span>\n\n <!-- ITEM ICON -->\n <span class=\"item-icon\" aria-hidden=\"true\" data-ng-if=\"ItemMenuCtrl.item.icon\">\n <i data-ng-class=\"ItemMenuCtrl.item.icon\"></i>\n </span>\n\n <!-- ITEM PREFIX -->\n <span class=\"item-prefix\" data-ng-if=\"ItemMenuCtrl.item.prefix\" data-ng-bind=\"ItemMenuCtrl.item.prefix\">\n </span>\n\n <!-- ITEM TITLE -->\n <span class=\"item-title\" data-ng-bind=\"ItemMenuCtrl.item.title\"> </span>\n</a>\n\n<!-- TOGGLE BUTTON -->\n<button class=\"menu-item\" title=\"{{ ItemMenuCtrl.item.getTitle() }}\" type=\"button\" data-ng-if=\"!ItemMenuCtrl.item.state && !ItemMenuCtrl.item.url && ItemMenuCtrl.item.allowSubItems\" data-ng-click=\"ItemMenuCtrl.toggleItemOpenState()\">\n <!-- ARROW -->\n <span class=\"item-arrow\" aria-hidden=\"true\" data-ng-class=\"{ 'no-sub' : !ItemMenuCtrl.item.allowSubItems }\" data-ng-if=\"!ItemMenuCtrl.item.loading\">\n <i class=\"ovh-font\" data-ng-class=\"{ 'ovh-font-small-arrow-right' : !ItemMenuCtrl.item.isOpen, 'ovh-font-small-arrow-down' : ItemMenuCtrl.item.isOpen }\" data-ng-if=\"ItemMenuCtrl.item.allowSubItems\">\n </i>\n </span>\n\n <!-- LOADING -->\n <span class=\"item-loading\" aria-hidden=\"true\" data-ng-if=\"ItemMenuCtrl.item.loading\">\n <div class=\"oui-spinner oui-spinner_s\">\n <div class=\"oui-spinner__container\">\n <div class=\"oui-spinner__image\"></div>\n </div>\n </div>\n </span>\n\n <!-- ITEM ICON -->\n <span class=\"item-icon\" aria-hidden=\"true\" data-ng-if=\"ItemMenuCtrl.item.icon\">\n <i data-ng-class=\"ItemMenuCtrl.item.icon\"></i>\n </span>\n\n <!-- ITEM PREFIX -->\n <span class=\"item-prefix\" data-ng-if=\"ItemMenuCtrl.item.prefix\" data-ng-bind=\"ItemMenuCtrl.item.prefix\">\n </span>\n\n <!-- ITEM TITLE -->\n <span class=\"item-title\" data-ng-bind=\"ItemMenuCtrl.item.title\"> </span>\n</button>\n\n<!-- ERROR MESSAGE -->\n<div class=\"group-error-wrapper\" data-ng-if=\"ItemMenuCtrl.item.error && ItemMenuCtrl.errorVisible\">\n <div>\n <i class=\"ovh-font ovh-font-filled-warning\"></i>\n </div>\n <div>\n <p data-ng-bind=\"ItemMenuCtrl.item.error\"></p>\n <button class=\"btn btn-default\" type=\"button\" data-ng-click=\"ItemMenuCtrl.toggleItemOpenState()\" data-translate=\"sidebar_menu_error_retry\"></button>\n </div>\n</div>\n\n<!-- EXTERNAL LINK -->\n<a class=\"menu-item\" title=\"{{ ItemMenuCtrl.item.getTitle() }}\" data-ng-if=\"ItemMenuCtrl.item.url && !ItemMenuCtrl.item.allowSubItems\" data-ng-href=\"{{ ItemMenuCtrl.item.url }}\" target=\"{{ ItemMenuCtrl.item.target }}\">\n <!-- ARROW -->\n <span class=\"item-arrow\" aria-hidden=\"true\" data-ng-class=\"{\n 'no-sub' : !ItemMenuCtrl.item.allowSubItems\n }\" data-ng-if=\"!ItemMenuCtrl.item.loading\">\n <i class=\"ovh-font\" data-ng-class=\"{\n 'ovh-font-small-arrow-right' : !ItemMenuCtrl.item.isOpen,\n 'ovh-font-small-arrow-down' : ItemMenuCtrl.item.isOpen\n }\" data-ng-if=\"ItemMenuCtrl.item.allowSubItems\">\n </i>\n </span>\n\n <!-- LOADING -->\n <span class=\"item-loading\" aria-hidden=\"true\" data-ng-if=\"ItemMenuCtrl.item.loading\">\n <div class=\"oui-spinner oui-spinner_s\">\n <div class=\"oui-spinner__container\">\n <div class=\"oui-spinner__image\"></div>\n </div>\n </div>\n </span>\n\n <!-- ITEM ICON -->\n <span class=\"item-icon\" aria-hidden=\"true\" data-ng-if=\"ItemMenuCtrl.item.icon\">\n <i data-ng-class=\"ItemMenuCtrl.item.icon\"></i>\n </span>\n\n <!-- ITEM PREFIX -->\n <span class=\"item-prefix\" data-ng-if=\"ItemMenuCtrl.item.prefix\" data-ng-bind=\"ItemMenuCtrl.item.prefix\">\n </span>\n\n <!-- ITEM TITLE -->\n <span class=\"item-title\" data-ng-bind=\"ItemMenuCtrl.item.title\"> </span>\n</a>\n\n<!-- SLIDING CONTENT -->\n<div class=\"group-content-wrapper\" data-ng-slide-down=\"ItemMenuCtrl.item.isOpen\" data-duration=\"0.3\">\n <div class=\"group-toggle-content\">\n <!-- GROUP SEARCH -->\n <div data-ng-if=\"ItemMenuCtrl.isSearchEnabled()\" class=\"group-search\">\n <form class=\"group-search-form\" data-ng-submit=\"ItemMenuCtrl.launchSearch()\">\n <div class=\"group-search-wrapper\">\n <i class=\"ovh-font ovh-font-search\"></i>\n <input type=\"text\" placeholder=\"{{ 'sidebar_menu_search' | translate }}\" data-ng-change=\"ItemMenuCtrl.launchSearch()\" data-ng-model=\"ItemMenuCtrl.model.search\" data-ng-model-options=\"{ debounce: 300 }\">\n </div>\n </form>\n <em data-translate=\"sidebar_menu_search_no_results\" data-ng-if=\"ItemMenuCtrl.item.noSearchResults\">\n </em>\n </div>\n\n <div class=\"group-scroll-content\">\n <!-- GROUP ITEMS -->\n <nav class=\"menu-sub-items\"></nav>\n </div>\n <div class=\"menu-view-all\" data-ng-if=\"ItemMenuCtrl.item.viewMore.enabled\">\n <div class=\"menu-view-all-inner\">\n <button class=\"menu-item text-left\" title=\"{{ ItemMenuCtrl.item.viewMore.title }}\" type=\"button\" data-ng-click=\"ItemMenuCtrl.viewMore()\" data-ng-disabled=\"ItemMenuCtrl.item.viewMore.loading\">\n <div class=\"oui-spinner oui-spinner_s\" data-ng-if=\"ItemMenuCtrl.item.viewMore.loading\">\n <div class=\"oui-spinner__container\">\n <div class=\"oui-spinner__image\"></div>\n </div>\n </div>\n <span>{{ ItemMenuCtrl.item.viewMore.title }}</span>\n </button>\n </div>\n </div>\n <div class=\"menu-view-all\" data-ng-if=\"ItemMenuCtrl.item.viewAllItem\">\n <div class=\"menu-view-all-inner\">\n <a class=\"menu-item\" data-ng-href=\"{{ ItemMenuCtrl.item.viewAllItem.url }}\" target=\"{{ ItemMenuCtrl.item.viewAllItem.target }}\">\n <span data-ng-bind=\"ItemMenuCtrl.item.viewAllItem.title\"></span>\n </a>\n </div>\n </div>\n </div>\n</div>\n";
/**
* @ngdoc directive
* @name sidebarMenu.directive:sidebarMenuListItem
*
* @restrict A
*
* @description
* <p>This directive fill manager sidebar item ```<li></li>``` html element with given item.</p>
* <p>This shouln't be used outside the sidebarMenu module scope.</p>
*
* @param {SidebarMenuListItem} sidebar-menu-list-item The menu item instance to display.
*/
_ngInjectExport$1.$inject = ["$compile"];
function _ngInjectExport$1($compile) {
return {
template: template$2,
restrict: 'A',
scope: {
item: '=sidebarMenuListItem',
namespace: '=sidebarMenuListItemNamespace'
},
require: ['sidebarMenuListItem', '^sidebarMenuList'],
link: function link($scope, $element, attribute, controllers) {
var navElement;
var sidebarMenuListItemCtrl = controllers[0];
if (sidebarMenuListItemCtrl.item.allowSubItems) {
// get nav element - where to append sub menu element
navElement = $element.find('nav.menu-sub-items');
if (!navElement.find('> .sub-menu').length) {
$compile("<sidebar-menu-list\n data-sidebar-menu-list-items='ItemMenuCtrl.item.subItems'\n data-sidebar-menu-list-level='ItemMenuCtrl.item.level + 1'\n data-sidebar-menu-list-namespace='ItemMenuCtrl.namespace'\n class='sub-menu'>\n </sidebar-menu-list>")($scope, function (cloned) {
navElement.append(cloned);
});
}
sidebarMenuListItemCtrl.groupScrollElement = $element.find('.group-scroll-content');
// sidebarMenuListItemCtrl.groupScrollElement = $element.find(".oui-sidebar-list");
if (sidebarMenuListItemCtrl.item.infiniteScroll) {
sidebarMenuListItemCtrl.groupScrollElement.on('scroll', function () {
sidebarMenuListItemCtrl.addMoreItems();
});
$scope.$on('$destroy', function () {
sidebarMenuListItemCtrl.groupScrollElement.off('scroll');
});
}
} else {
// no children allowed so free up the dom
$element.find('.group-content-wrapper').empty();
}
},
bindToController: true,
controllerAs: 'ItemMenuCtrl',
controller: ["$scope", "$timeout", "$sce", "SidebarMenu", function controller($scope, $timeout, $sce, SidebarMenu) {
var self = this;
self.model = {
search: null
};
self.loading = {
search: false
};
/*= ==============================
= HELPERS =
=============================== */
self.getInnerTemplate = function getInnerTemplate() {
return $sce.trustAsHtml(SidebarMenu.getInnerMenuItemTemplate());
};
self.getMinItemsForEnablingSearch = function getMinItemsForEnablingSearch() {
return SidebarMenu.getMinItemsForEnablingSearch();
};
self.isSearchEnabled = function isSearchEnabled() {
if (self.item.allowSearch) {
if (self.item.subItemsAdded.length > self.getMinItemsForEnablingSearch() || self.item.forceDisplaySearch) {
return true;
}
// if there is less than 10 (by default) items of level 2, there is maybe more than 10
// items of level 3
var searchableItemCount = 0;
// use of every to be abble to break loop
self.item.subItemsAdded.every(function (subItem) {
searchableItemCount += filter(subItem.subItemsAdded, {
searchable: true
}).length;
return searchableItemCount <= self.getMinItemsForEnablingSearch();
});
return searchableItemCount > self.getMinItemsForEnablingSearch();
}
return false;
};
/**
* Returns scrollBar state :
* {
* visible: is scrollbar visible?
* bottom: is scrollbar is close to the bottom?
* }
*/
$scope.$watch('item', function () {
self.item.getScrollbar = function getScrollbar() {
var height = self.groupScrollElement.height();
var _self$groupScrollElem = self.groupScrollElement.get(0),
scrollHeight = _self$groupScrollElem.scrollHeight,
scrollTop = _self$groupScrollElem.scrollTop;
var result = {
visible: scrollHeight > height,
bottom: scrollTop + height >= scrollHeight * 0.9
};
return result;
};
});
self.addMoreItems = function addMoreItems() {
self.item.appendPendingListItemsAsync();
};
/* ----- End of HELPERS ------*/
/*= ==============================
= ACTIONS =
=============================== */
self.toggleItemOpenState = function toggleItemOpenState() {
self.errorVisible = false;
// load sub items
self.item.loadSubItems().then(function () {
// let SidebarMenu manage toggle states
SidebarMenu.toggleMenuItemOpenState(self.item);
})["catch"](function () {
self.errorVisible = true;
});
return true;
};
self.launchSearch = function launchSearch() {
self.item.filterSubItems(self.model.search);
};
self.viewMore = function viewMore() {
if (!self.item.viewMore || !angular__default["default"].isFunction(self.item.viewMore.action)) {
return;
}
// call view more action
var result = self.item.viewMore.action();
var promiseResult = null;
// check if action returned a promise
if (result && result.$promise) {
promiseResult = result.$promise;
} else if (result && angular__default["default"].isFunction(result.then)) {
promiseResult = result;
}
// scroll to bottom when action is complete
if (promiseResult) {
promiseResult.then(function () {
return $timeout(function () {
self.groupScrollElement.animate({
scrollTop: self.groupScrollElement[0].scrollHeight
});
}, 250);
}); // adding some delay helps to smooth the transition
}
};
/* ----- End of ACTIONS ------*/
}]
};
}
var moduleName$2 = 'ngOvhSidebarMenuListItem';
angular__default["default"].module(moduleName$2, ['ng-slide-down']).factory('SidebarMenuListItem', _ngInjectExport$2).directive('sidebarMenuListItem', _ngInjectExport$1);
var template$1 = "<ul class=\"sidebar-menu-list menu-level-{{ ListCtrl.level }}\">\n <li class=\"item-container\" data-ng-class=\"{\n 'open' : item.isOpen,\n 'active' : item.isActive,\n 'category-{{item.category}}' : item.category !== 'none',\n 'status-{{item.status}}' : item.status !== 'none',\n 'hidden': item.shouldHide === true\n }\" data-ng-if=\"(ListCtrl.namespace && item.isValidNamespace(ListCtrl.namespace)) || (!ListCtrl.namespace && (!item.namespace || item.isValidNamespace(undefined)))\" data-sidebar-menu-list-item=\"item\" data-sidebar-menu-list-item-namespace=\"ListCtrl.namespace\" data-ng-repeat=\"item in ListCtrl.items track by $index\"></li>\n</ul>\n";
/**
* @ngdoc directive
* @name sidebarMenu.directive:sidebarMenuList
*
* @restrict A
*
* @description
* <p>This directive fill manager sidebar ```<ul></ul>``` html element with given items.</p>
* <p>This shouln't be used outside the sidebarMenu module scope.</p>
*
* @param {Array<SidebarMenuListItem>} sidebar-menu-list-items The items to be filled into list
* element of manager sidebar.
*/
function directive$1 () {
return {
template: template$1,
restrict: 'AE',
scope: {
items: '=sidebarMenuListItems',
namespace: '=sidebarMenuListNamespace',
level: '=sidebarMenuListLevel'
},
require: ['^sidebarMenu', '^?sidebarMenuListItem'],
bindToController: true,
controllerAs: 'ListCtrl',
controller: angular__default["default"].noop
};
}
var moduleName$1 = 'ngOvhSidebarMenuList';
angular__default["default"].module(moduleName$1, [moduleName$2]).directive('sidebarMenuList', directive$1);
_ngInjectExport.$inject = ["$transitions", "SidebarMenu"];
function _ngInjectExport($transitions, SidebarMenu) {
var self = this;
self.loading = {
translations: false,
init: false
};
self.items = null;
/*= =====================================
= INITIALIZATION =
====================================== */
/* ---------- STATE CHANGE ----------*/
function initStateChangeSuccess() {
$transitions.onSuccess({}, function () {
SidebarMenu.manageStateChange();
});
}
/* ---------- DIRECTIVE INITIALIZATION ----------*/
function init() {
self.loading.init = true;
return SidebarMenu.loadInit().then(function () {
initStateChangeSuccess();
self.items = SidebarMenu.items;
self.actionsOptions = SidebarMenu.actionsMenuOptions;
self.popoverSettings = {
placement: 'bottom-left',
"class": 'order-actions-menu-popover',
trigger: 'outsideClick'
};
})["finally"](function () {
self.loading.init = false;
});
}
/* ----- End of INITIALIZATION ------*/
init();
}
var template = "<div id=\"sidebar-menu\">\n <!-- LOADER -->\n <div class=\"text-center\" data-ng-if=\"sideBarCtrl.loading.init\">\n <div class=\"oui-spinner oui-spinner_m\">\n <div class=\"oui-spinner__container\">\n <div class=\"oui-spinner__image\"></div>\n </div>\n </div>\n </div>\n\n <div data-ng-if=\"!sideBarCtrl.loading.init\" class=\"mt-3\">\n <!-- ORDER ACTIONS MENU -->\n <div class=\"order-actions-menu\" data-ng-if=\"sideBarCtrl.actionsOptions.length\">\n <actions-menu data-actions-menu-options=\"sideBarCtrl.actionsOptions\" data-actions-menu-popover-settings=\"sideBarCtrl.popoverSettings\">\n <span class=\"cart-icon ovh-font ovh-font-cart\" aria-hidden=\"true\"></span>\n\n <span class=\"button-text\" data-translate=\"sidebar_menu_order_actions\">\n </span>\n\n <span class=\"arrow-icon ovh-font ovh-font-small-arrow-down\" aria-hidden=\"true\"></span>\n </actions-menu>\n </div>\n\n <!-- MENU ITEMS -->\n <sidebar-menu-list data-sidebar-menu-list-items=\"sideBarCtrl.items\" data-sidebar-menu-list-namespace=\"sidebarNamespace\" data-sidebar-menu-list-level=\"1\">\n </sidebar-menu-list>\n </div>\n</div>\n";
/**
* @ngdoc directive
* @name sidebarMenu.directive:sidebarMenu
*
* @restrict A
*
* @description
* <p>This is the base directive to load into your universe code. This directive will load the
* "root" items and will manage (with {@link sidebarMenu.service:SidebarMenu SidebarMenu service})
* sub items loading and display.</p>
* <p>Basically, the directive will load the other module's directives (sidebarMenuMenu and
* sidebarMenuMenuItem).</p>
*/
function directive () {
return {
template: template,
restrict: 'A',
replace: true,
controller: _ngInjectExport,
controllerAs: 'sideBarCtrl',
scope: {
sidebarNamespace: '='
}
};
}
var innerMenuItemTemplate = "<!-- ARROW -->\n<span class=\"item-arrow\" aria-hidden=\"true\" data-ng-class=\"{\n 'no-sub' : !ItemMenuCtrl.item.allowSubItems\n }\" data-ng-if=\"!ItemMenuCtrl.item.loading\">\n <i class=\"ovh-font\" data-ng-class=\"{\n 'ovh-font-small-arrow-right' : !ItemMenuCtrl.item.isOpen,\n 'ovh-font-small-arrow-down' : ItemMenuCtrl.item.isOpen\n }\" data-ng-if=\"ItemMenuCtrl.item.allowSubItems\">\n </i>\n</span>\n\n<!-- LOADING -->\n<span class=\"item-loading\" aria-hidden=\"true\" data-ng-if=\"ItemMenuCtrl.item.loading\">\n <span class=\"oui-spinner oui-spinner_s\">\n <span class=\"oui-spinner__container\">\n <span class=\"oui-spinner__image\"></span>\n </span>\n </span>\n</span>\n\n<!-- ITEM ICON -->\n<span class=\"item-icon\" aria-hidden=\"true\" data-ng-if=\"ItemMenuCtrl.item.icon\">\n <i data-ng-class=\"ItemMenuCtrl.item.icon\"></i>\n</span>\n\n<!-- ITEM PREFIX -->\n<span class=\"item-prefix\" data-ng-if=\"ItemMenuCtrl.item.prefix\" data-ng-bind=\"ItemMenuCtrl.item.prefix\">\n</span>\n\n<!-- ITEM TITLE -->\n<span class=\"item-title\" data-ng-bind=\"ItemMenuCtrl.item.title\"> </span>\n";
/**
* @ngdoc object
* @name sidebarMenu.SidebarMenuProvider
*
* @description
* sidebarMenuProvider allows developper to configure :
* - extra translations that need to be loaded ;
* - the template path of the inner content of sidebar menu itemms.
*
* @example
* <pre>
* angular.module("myManagerApp").config(function (SidebarMenuProvider) {
* // add translation path
* SidebarMenuProvider.addTranslationPath("../components/sidebar");
* // configure the inner item content html file
* SidebarMenuProvider.setInnerMenuItemTemplatePath(
* "../components/my-dangerous-and-risky-configuration.html"
* );
* });
* </pre>
*/
function provider () {
var self = this;
var translationPaths = ['../bower_components/ovh-angular-sidebar-menu/dist/ovh-angular-sidebar-menu'];
var minItemsForEnablingSearch = 10;
/*= ====================================
= CONFIGURATION =
===================================== */
/* ---------- TRANSLATION ----------*/
/**
* @ngdoc function
* @name sidebarMenu.SidebarMenuProvider#clearTranslationPath
* @methodOf sidebarMenu.SidebarMenuProvider
*
* @description
* Clear translations path
*
* @return {Array} The list of translations to load.
*/
self.clearTranslationPath = function clearTranslationPath() {
translationPaths = [];
return translationPaths;
};
/**
* @ngdoc function
* @name sidebarMenu.SidebarMenuProvider#addTranslationPath
* @methodOf sidebarMenu.SidebarMenuProvider
*
* @description
* Allows you to add an extra translations path when manager sidebar is loading.
*
* @param {String} translationPath The translations file path to add.
*
* @return {Array} The list of translations to load.
*/
self.addTranslationPath = function addTranslationPath(translationPath) {
if (translationPath) {
translationPaths.push(translationPath);
}
return translationPaths;
};
/* ---------- INNER MENU ITEM TEMPLATE ----------*/
/**
* @ngdoc function
* @name sidebarMenu.SidebarMenuProvider#setMinItemsForEnablingSearch
* @methodOf sidebarMenu.SidebarMenuProvider
*
* @description
* Configure the minimum items length for enabling search.
* By default the min items is set to 10.
*
* @param {Number} minItems The new value for enabling search.
*
* @return {Number} The new value setted.
*/
self.setMinItemsForEnablingSearch = function setMinItemsForEnablingSearch(minItems) {
if (isNumber(minItems)) {
minItemsForEnablingSearch = minItems;
}
return minItemsForEnablingSearch;
};
/* ----- End of CONFIGURATION ------*/
self.$get = ['$q', '$state', 'SidebarMenuListItem', function $get($q, $state, SidebarMenuListItem) {
/**
* @ngdoc service
* @name sidebarMenu.service:SidebarMenu
*
* @requires $q
* @requires $state
* @requires $translatePartialLoader
* @requires SidebarMenuListItem
*
* @description
* The `SidebarMenu` service is actual core of sidebarMenu module.
* This service manage the content of the sidebar menu and the different state
* (active, open, ...) of its items.
*/
var sidebarMenuService = {
items: [],
actionsMenuOptions: [],
loadDeferred: $q.defer(),
initPromise: $q.when(true)
};
/* ---------- INITIALIZATION LOADING ----------*/
/**
* @ngdoc method
* @name sidebarMenu.service:SidebarMenu#setInitializationPromise
* @methodOf sidebarMenu.service:SidebarMenu
*
* @description
* Let you configuring an initialization promise before displaying content of sidebar-menu.
* This can be done in angular run phase.
* For example you can configure a promise that return the number of
* services per sections, ...
*
* @param {Promise} initPromise A promise object.
*
* @return {Promise} The initialized promise.
*/
sidebarMenuService.setInitializationPromise = function setInitializationPromise(initPromise) {
if (initPromise && initPromise.then) {
this.initPromise = initPromise;
}
return initPromise;
};
/**
* @ngdoc method
* @name sidebarMenu.service:SidebarMenu#loadInit
* @methodOf sidebarMenu.service:SidebarMenu
*
* @description
* Load the configured translations and initialization promise.
*
* @return {Promise} That resolve the loadDeferred object with initialization promise
* returns values.
*/
sidebarMenuService.loadInit = function loadInit() {
var _this = this;
return $q.all({
translations: this.loadTranslations(),
init: this.initPromise
}).then(function (data) {
_this.loadDeferred.resolve(data.init);
_this.manageStateChange();
return _this.loadDeferred.promise;
});
};
/* ---------- TRANSLATIONS ----------*/
/**
* @ngdoc method
* @name sidebarMenu.service:SidebarMenu#loadTranslations
* @methodOf sidebarMenu.service:SidebarMenu
*
* @description
* Load the default translations of manager sidebar component and the extra translations
* files that you have added (if some).
*
* @return {Promise} void
*/
sidebarMenuService.loadTranslations = function () {
// angular.forEach(translationPaths, function (translationPath) {
// $translatePartialLoader.addPart(translationPath);
// });
// return $translate.refresh();
};
/* ---------- GETTER ----------*/
/**
* @ngdoc method
* @name sidebarMenu.service:SidebarMenu#getInnerMenuItemTemplatePath
* @methodOf sidebarMenu.service:SidebarMenu
*
* @description
* Get the inner menu item template path for displaying the inner html content of an item.
*
* @return {String} The inner menu item template path for displaying the inner html content
* of an item. If you have configured it with the provider, this will return the
* configured path.
*/
sidebarMenuService.getInnerMenuItemTemplate = function getInnerMenuItemTemplate() {
return innerMenuItemTemplate;
};
/**
* @ngdoc method
* @name sidebarMenu.service:SidebarMenu#getMinItemsForEnablingSearch
* @methodOf sidebarMenu.service:SidebarMenu
*
* @description
* Get the minimum items length for enabling search.
*
* @return {Number} The minimum items length for enabling search.
*/
sidebarMenuService.getMinItemsForEnablingSearch = function () {
return minItemsForEnablingSearch;
};
/* ---------- ITEMS MANAGEMENT ----------*/
/**
* @ngdoc method
* @name sidebarMenu.service:SidebarMenu#addMenuItem
* @methodOf sidebarMenu.service:SidebarMenu
*
* @description
* Add a menu item to manager sidebar. It could be directly added as "root" element or to
* an already existing item.
*
* @param {Object} itemOptions The options for adding a new manager sidebar menu item.
* See {@link sidebarMenu.object:SidebarMenuListItem SidebarMenuListItem} constructor
* for more details.
* @param {SidebarMenuListItem} parentItem The parent where to add the new sidebar
* menu item. If not specified, a "root" item will be added.
*
* @return {SidebarMenuListItem} The added sidebar menu item.
*/
sidebarMenuService.addMenuItem = function addMenuItem(itemOptions, parentItem) {
var menuItem;
if (!parentItem) {
set(itemOptions, 'level', 1);
menuItem = new SidebarMenuListItem(itemOptions);
this.items.push(menuItem);
} else {
set(itemOptions, 'level', parentItem.level + 1);
menuItem = parentItem.addSubItem(itemOptions);
}
return menuItem;
};
/**
* @ngdoc method
* @name sidebarMenu.service:SidebarMenu#addMenuItems
* @methodOf sidebarMenu.service:SidebarMenu
*
* @description
* Add multiple sidebar menu items to an existing sidebar menu item (or as "root" items).
*
* @param {Array<Object>} itemsOptions A list of item options to add to sidebar menu.
* See {@link sidebarMenu.object:SidebarMenuListItem SidebarMenuListItem} constructor
* for more details.
* @param {SidebarMenuListItem} parentItem The parent where to add the new sidebar menu
* items. If not specified, "root" items will be added.
*
* @return {SidebarMenu} Current SidebarMenu service
*/
sidebarMenuService.addMenuItems = function addMenuItems(itemsOptions, parentItem) {
var _this2 = this;
angular__default["default"].forEach(itemsOptions, function (itemOptions) {
_this2.addMenuItem(itemOptions, parentItem);
});
return this;
};
/* ---------- SIDEBAR ACTIONS ----------*/
/**
* @ngdoc method
* @name sidebarMenu.service:SidebarMenu#manageMenuItemOpenAndActiveState
* @methodOf sidebarMenu.service:SidebarMenu
*
* @description
* Manage the open state and the active state of items of the manager sidebar menu.
*
* @param {SidebarMenuListItem} menuItem The clicked sidebar menu item.
*
* @return {SidebarMenu} Current SidebarMenu service
*/
sidebarMenuService.manageMenuItemOpenAndActiveState = function manageMenuItemOpenAndActiveState(menuItem) {
return this.toggleMenuItemOpenState(menuItem).manageActiveMenuItem(menuItem);
};
/**
* @ngdoc method
* @name sidebarMenu.service:SidebarMenu#toggleMenuItemOpenState
* @methodOf sidebarMenu.service:SidebarMenu
*
* @description
* Manage the open state of items of the manager sidebar menu. This will ensure that only
* one item is open at a time.
*
* @param {SidebarMenuListItem} menuItem The clicked sidebar menu item.
*
* @return {SidebarMenu} Current SidebarMenu service
*/
sidebarMenuService.toggleMenuItemOpenState = function toggleMenuItemOpenState(menuItem) {
var pathToMenuItem = this.getPathToMenuItem(menuItem).path;
var openedItems = filter(this.getAllMenuItems(), {
isOpen: true
});
// we simply close items that does not belong to the path to menuItem
forEach(difference$1(openedItems, pathToMenuItem), function (item) {
item.toggleOpen(); // close item
});
menuItem.toggleOpen();
return this;
};
/**
* @ngdoc method
* @name sidebarMenu.service:SidebarMenu#manageActiveMenuItem
* @methodOf sidebarMenu.service:SidebarMenu
*
* @description
* Manage the active state of items of the manager sidebar menu. This will ensure that
* only one item is active at a time.
*
* @param {SidebarMenuListItem} menuItem The clicked sidebar menu item.
*
* @return {SidebarMenu} Current SidebarMenu service
*/
sidebarMenuService.manageActiveMenuItem = function manageActiveMenuItem() {
var prevItem = null;
return function manageActiveMenuItemSubFn(menuItem) {
if (menuItem.state) {
if (prevItem) {
prevItem.isActive = false;
}
set(menuItem, 'isActive', true);
prevItem = menuItem;
}
};
}();
/* ---------- STATE CHANGE ----------*/
/**
* @ngdoc method
* @name sidebarMenu.service:SidebarMenu#manageStateChange
* @methodOf sidebarMenu.service:SidebarMenu
*
* @description
* Manage the active and open state of items when state is successfuly loaded.
* Called on $stateChangeSuccess.
*
* @return {Promise} That resolve when every active subMenu item is loaded
*/
sidebarMenuService.manageStateChange = function manageStateChange() {
function manageStateChangeRecur(items) {
return $q.all(map(items, function (item) {
var stateInfos = getItemStateInfos(item); // eslint-disable-line
if (stateInfos.current) {
sidebarMenuService.manageActiveMenuItem(item);
sidebarMenuService.toggleMenuItemOpenState(item);
}
if (stateInfos.included) {
return item.loadSubItems().then(function () {
// Automatically close same level opened item if it is not current one
var openedItem = find$1(sidebarMenuService.getAllMenuItems(), {
isOpen: true,
level: item.level
});
var someItemIsOpened = openedItem != null;
if (someItemIsOpened && openedItem.id !== item.id) {
openedItem.toggleOpen();
}
if (item.hasSubItems() && !item.isOpen) {
item.toggleOpen();
}
sidebarMenuService.manageActiveMenuItem(item);
return manageStateChangeRecur(item.getSubItems());
});
}
return $q.when(true);
}));
}
return function (menuItems) {
return manageStateChangeRecur(menuItems || this.items);
};
}();
/* ---------- ORDER ACTIONS MENU ----------*/
/**
* @ngdoc method
* @name sidebarMenu.service:SidebarMenu#addActionsMenuOption
* @methodOf sidebarMenu.service:SidebarMenu
*
* @description
* Add an item to order actions menu inside sidebar menu.
* See availabe options into actions-menu component.
*
* @param {Object} actionMenuOptions Options of the action menu to add
* (see availabe options into actions-menu component).
*
* @returns {Object} The added options.
*/
sidebarMenuService.addActionsMenuOption = function addActionsMenuOption(actionMenuOptions) {
this.actionsMenuOptions.push(actionMenuOptions);
return actionMenuOptions;
};
/**
* @ngdoc method
* @name sidebarMenu.service:SidebarMenu#addActionsMenuOptions
* @methodOf sidebarMenu.service:SidebarMenu
*
* @description
* Add multiple items to order actions menu inside sidebar menu.
* See availabe options into actions-menu component.
*
* @param {Array<Object>} actionMenuOptionsList List of options for adding entries into
* order actions menu (see availabe options into actions-menu component).
*
* @returns {Array<Object>} The list of item options.
*/
sidebarMenuService.addActionsMenuOptions = function addActionsMenuOptions(actionMenuOptionsList) {
var _this3 = this;
angular__default["default"].forEach(actionMenuOptionsList, function (actionMenuOptions) {
_this3.addActionsMenuOption(actionMenuOptions);
});
return actionMenuOptionsList;
};
/* ---------- HELPERS ----------*/
function getItemStateInfos(item) {
var infos = {
included: false,
current: false
};
if (item.loadOnState) {
if (isString(item.loadOnState)) {
infos.included = $state.includes(item.loadOnState, item.loadOnStateParams);
infos.current = $state.is(item.loadOnState, item.loadOnStateParams);
} else if (isArray$1(item.loadOnState)) {
infos.included = some(item.loadOnState, function (loadOnState) {
return $state.includes(loadOnState, item.loadOnStateParams);
});
infos.current = some(item.loadOnState, function (loadOnState) {
return $state.is(loadOnState, item.loadOnStateParams);
});
}
} else if (item.state) {
infos.included = $state.includes(item.state, item.stateParams);
infos.current = $state.is(item.state, item.stateParams);
}
return infos;
}
/**
* @ngdoc method
* @name sidebarMenu.service:SidebarMenu#getPathToMenuItem
* @methodOf sidebarMenu.service:SidebarMenu
*
* @description
* Return the path to the specified item in the tree.
*
* @param {SidebarMenuListItem} item The item to get the path to
*
* @return {Object} Search result : { found: true/false, path: [] }
*/
sidebarMenuService.getPathToMenuItem = function getPathToMenuItem(item, itemsParam, currentSearchParam) {
var _this4 = this;
var items = itemsParam;
var currentSearch = currentSearchParam;
currentSearch = currentSearch || {
found: false,
path: []
};
if (!angular__default["default"].isObject(item) || !item.id) {
return currentSearch;
}
items = items || this.items;
if (find$1(items, {
id: item.id,
parentId: item.parentId
})) {
currentSearch.found = true;
currentSearch.path.push(item);
} else {
forEach(items, function (child) {
if (!currentSearch.found && child.hasSubItems()) {
currentSearch.path.push(child);
currentSearch = _this4.getPathToMenuItem(item, child.getSubItems(), currentSearch);
if (!currentSearch.found) {
currentSearch.path.pop();
}
}
});
}
return currentSearch;
};
/**
* @ngdoc method
* @name sidebarMenu.service:SidebarMenu#getAllMenuItems
* @methodOf sidebarMenu.service:SidebarMenu
*
* @description
* Return a flatten list of all menu items
*
* @return {Array} Array of menu items
*/
sidebarMenuService.getAllMenuItems = function getAllMenuItems() {
function flattenSubItems(itemsParam) {
var items = itemsParam;
var mapped = map(items, function (item) {
return flattenSubItems(item.getSubItems());
});
forEach(mapped, function (item) {
items = items.concat(item);
});
return items;
}
return function () {
return flattenSubItems(this.items || []);
};
}();
/**
* @ngdoc method
* @name sidebarMenu.service:SidebarMenu#getItemById
* @methodOf sidebarMenu.service:SidebarMenu
*
* @description
* Find an item, given its id. The search is performed recursively inside the
* items tree. Don't be scared of performance issues since search result is
* cached, so subsequent search would be O(1) complexity.
*
* @param {Number|String} itemId The unique id of the item you want to find.
*
* @return {SidebarMenuListItem} The founded SidebarMenuListItem with given id.
*/
sidebarMenuService.getItemById = function getItemById(itemId, items) {
return this.getItemByCriteria({
id: itemId
}, items);
};
/**
* @ngdoc method
* @name sidebarMenu.service:SidebarMenu#getItemByCriteria
* @methodOf sidebarMenu.service:SidebarMenu
*
* @description
* Find an item according to specific criteria.
* The search is performed recursively inside the tree of items.
* Complexity for subsequent searches will be O(n), except if the
* criteria contains the id, then the complexity will be O(1).
*
* @param {Object} criteria The criteria to find the item.
*
* @return {SidebarMenuListItem} The matching SidebarMenuListItem with the given criteria.
*/
sidebarMenuService.getItemByCriteria = function getItemByCriteria() {
var itemsMap = {}; // hash of itemId => item
var found = false;
function findRecursive(itemList, criteria) {
if (!found && itemList && itemList.length) {
found = find$1(itemList, criteria);
forEach(itemList, function (item) {
findRecursive(item.getSubItems(), criteria);
});
}
}
return function innerGetItemByCriteria(criteria, items) {
found = criteria.id ? itemsMap[criteria.id] : find$1(itemsMap, criteria);
findRecursive(items || this.items, criteria);
if (found) {
itemsMap[found.id] = found; // cache search result
}
return found;
};
}();
/* ---------- ITEM DISPLAY UPDATE ----------*/
/**
* @ngdoc method
* @name sidebarMenu.service:SidebarMenu#updateItemDisplay
* @methodOf sidebarMenu.service:SidebarMenu
*
* @description
* Update the display options of a SidebarMenuListItem.
*
* @param {Object} displayOptionsParam Display options you want to update.
* @param {String} displayOptionsParam.title The new title.
* @param {String} displayOptionsParam.prefix The new prefix.
* @param {String} displayOptionsParam.icon The new icon.
* @param {String} displayOptionsParam.iconClass The new iconClass.
* @param {String} displayOptionsParam.category The new category.
* @param {String} displayOptionsParam.status The new status.
*
* @param {Number|String|Object} criteriaParam The criteria to find the item to update.
* If it's a Number or a String, then it's considered as an id.
*
* @return {SidebarMenuListItem} The matching SidebarMenuListItem with given criteria.
*/
sidebarMenuService.updateItemDisplay = function updateItemDisplay(displayOptionsParam, criteriaParam) {
var displayOptions = displayOptionsParam;
var criteria = isString(criteriaParam) || isNumber(criteriaParam) ? {
id: criteriaParam
} : criteriaParam;
var item = this.getItemByCriteria(criteria);
if (item) {
displayOptions = omit$1(displayOptions, isEmpty); // remove falsy attributes
displayOptions = pick$1(displayOptions, ['title', 'prefix', 'icon', 'iconClass', 'category', 'status']);
assign$1(item, displayOptions);
}
return item;
};
return sidebarMenuService;
}];
}
cssInject801396187a774771("/*\n * Colors\n */\n/* Delivery */\n/*\n * Fonts\n */\n/*\n * Globals\n */\n/*\n * Icons (WARNING: THIS FILE IS GENERATED, PLEASE DO NOT EDIT IT!)\n */\n/* stylelint-disable no-descending-specificity */\n#sidebar-menu {\n height: 100%;\n box-sizing: border-box;\n display: block;\n position: fixed;\n top: 0;\n bottom: 0;\n left: 0;\n padding: 0 0.625rem;\n color: #113f6d;\n background: #fff;\n box-shadow: 0 6px 6px rgba(0, 14, 156, 0.2);\n z-index: 1000;\n}\n#sidebar-menu .order-actions-menu {\n margin: 0.75rem 0.375rem;\n}\n#sidebar-menu .order-actions-menu .actions-menu-button {\n width: 100%;\n height: 2.5rem;\n display: flex;\n flex-direction: row;\n align-items: center;\n padding: 0 0.75rem;\n position: relative;\n background-color: #2859c0;\n border-color: #2859c0;\n border-style: solid;\n border-width: 2px;\n border-radius: 0.375rem;\n color: #fff;\n font-weight: 600;\n font-size: 1rem;\n text-align: left;\n}\n#sidebar-menu .order-actions-menu .actions-menu-button:focus {\n outline-width: 1px;\n outline-style: dotted;\n outline-color: initial;\n outline-offset: 2px;\n}\n#sidebar-menu .order-actions-menu .actions-menu-button:hover,\n#sidebar-menu .order-actions-menu .actions-menu-button:active,\n#sidebar-menu .order-actions-menu .actions-menu-button:focus {\n background-color: #1c3193;\n border-color: #1c3193;\n color: #fff;\n}\n#sidebar-menu .order-actions-menu .actions-menu-button.menu-open {\n background-color: #fff;\n border-color: #2859c0;\n color: #2859c0;\n}\n#sidebar-menu .order-actions-menu .actions-menu-button .button-text {\n padding: 0 0.5rem;\n flex: 1;\n}\n#sidebar-menu .order-actions-menu .actions-menu-button .arrow-icon {\n font-size: 0.75rem;\n}\n#sidebar-menu .order-actions-menu .responsive-popover.order-actions-menu-popover {\n margin: 0;\n padding: 0;\n border-color: #bbbdbf;\n border-style: solid;\n border-width: 1px;\n}\n#sidebar-menu .order-actions-menu .responsive-popover.order-actions-menu-popover .arrow {\n display: none;\n}\n#sidebar-menu .menu-item {\n width: 100%;\n padding: 0.375rem;\n display: flex;\n flex-direction: row;\n align-items: center;\n background-color: transparent;\n border: 0;\n color: #113f6d;\n font-weight: 400;\n text-align: left;\n text-decoration: none;\n}\n#sidebar-menu .menu-item .item-arrow,\n#sidebar-menu .menu-item .item-loading,\n#sidebar-menu .menu-item .item-icon,\n#sidebar-menu .menu-item .item-prefix,\n#sidebar-menu .menu-item .item-title {\n line-height: 1.25rem;\n display: inline-block;\n}\n#sidebar-menu .menu-item .item-loading,\n#sidebar-menu .menu-item .item-arrow {\n width: 1.25rem;\n margin-right: 0.313rem;\n font-size: 0.75rem;\n text-align: center;\n}\n#sidebar-menu .menu-item .item-icon {\n width: 1.25rem;\n font-size: 1.25rem;\n margin-right: 0.313rem;\n text-align: center;\n}\n#sidebar-menu .menu-item .item-icon i,\n#sidebar-menu .menu-item .item-icon span {\n color: inherit;\n font-size: inherit;\n}\n#sidebar-menu .menu-item .item-prefix {\n margin-right: 0.313rem;\n font-size: 0.625rem;\n}\n#sidebar-menu .menu-item .item-title {\n flex: 1;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n#sidebar-menu .menu-item .oui-spinner {\n vertical-align: middle;\n}\n#sidebar-menu .menu-item:focus {\n outline-width: 1px;\n outline-style: dotted;\n outline-color: initial;\n outline-offset: -2px;\n}\n#sidebar-menu .menu-item:hover,\n#sidebar-menu .menu-item:active,\n#sidebar-menu .menu-item:focus {\n text-decoration: none;\n}\n#sidebar-menu .menu-item:hover .item-title,\n#sidebar-menu .menu-item:active .item-title,\n#sidebar-menu .menu-item:focus .item-title {\n text-decoration: underline;\n}\n#sidebar-menu .active > .menu-item {\n color: #2859c0;\n background: #e6f5fc;\n font-weight: 600;\n}\n#sidebar-menu .menu-view-all .menu-view-all-inner {\n border-top: 1px solid #8392a4;\n}\n#sidebar-menu .menu-view-all .menu-view-all-inner a {\n font-weight: bold;\n letter-spacing: 0.02em;\n}\n#sidebar-menu .menu-view-all .menu-view-all-inner span {\n margin-right: 4px;\n}\n#sidebar-menu .menu-view-all .menu-view-all-inner > .menu-item > .oui-spinner {\n margin-right: 4px;\n}\n#sidebar-menu .group-search .group-search-form {\n padding: 0.625rem 0 0.625rem 0.625rem;\n}\n#sidebar-menu .group-search .group-search-form .group-search-wrapper {\n position: relative;\n}\n#sidebar-menu .group-search .group-search-form .group-search-wrapper input {\n height: 2rem;\n border: none;\n border-bottom-style: solid;\n border-bottom-width: 2px;\n border-bottom-color: #89d7f8;\n background: transparent;\n border-radius: 0;\n color: #1c3193;\n padding: 0 0.5rem 0 2.25rem;\n width: 100%;\n}\n#sidebar-menu .group-search .group-search-form .group-search-wrapper input:hover,\n#sidebar-menu .group-search .group-search-form .group-search-wrapper input:focus {\n border-color: #89d7f8;\n background-color: #eff9fd;\n}\n#sidebar-menu .group-search .group-search-form .group-search-wrapper .ovh-font-search {\n color: #1c3193;\n font-size: 1.25rem;\n position: absolute;\n top: 0.375rem;\n left: 0.625rem;\n}\n#sidebar-menu .group-search em {\n display: block;\n padding: 1rem 0;\n text-align: center;\n}\n#sidebar-menu .group-error-wrapper {\n text-align: center;\n padding: 10px 26px;\n}\n#sidebar-menu .group-error-wrapper i.ovh-font {\n margin-bottom: 5px;\n font-size: 1.5em;\n}\n#sidebar-menu .group-error-wrapper button.btn.btn-default {\n margin-top: 5px;\n}\n#sidebar-menu .sidebar-menu-list {\n padding: 0;\n margin: 0;\n list-style-type: none;\n}\n#sidebar-menu .sidebar-menu-list.menu-level-1 {\n background: #fff;\n}\n#sidebar-menu .sidebar-menu-list.menu-level-1 .group-content-wrapper {\n border-left: 3px solid #2859c0;\n}\n#sidebar-menu .sidebar-menu-list.menu-level-1 .group-scroll-content {\n max-height: 25rem;\n max-height: 35vh;\n overflow-y: auto;\n}\n#sidebar-menu .sidebar-menu-list.menu-level-1 > .item-container > .menu-item {\n padding: 0.375rem 0;\n color: #113f6d;\n font-weight: 700;\n}\n#sidebar-menu .sidebar-menu-list.menu-level-1 > .item-container.open > .menu-item {\n border-bottom: 2px solid #e6f5fc;\n}\n#sidebar-menu .sidebar-menu-list.menu-level-2 {\n background: #fff;\n}\n#sidebar-menu .sidebar-menu-list.menu-level-2 .group-content-wrapper {\n border-left: none;\n}\n#sidebar-menu .sidebar-menu-list.menu-level-2 .group-scroll-content {\n max-height: none;\n overflow-y: visible;\n}\n#sidebar-menu .sidebar-menu-list.menu-level-2 .sidebar-menu-list .menu-item {\n padding-left: calc(1.25rem + 0.313rem + 0.375rem);\n}\n#sidebar-menu .sidebar-menu-list.menu-level-3 {\n background: #fff;\n}\n#sidebar-menu .sidebar-menu-list.menu-level-4 {\n background: #fff;\n}\n@media (max-width: 1023px) {\n #sidebar-menu {\n max-width: 18.75rem;\n left: -18.75rem;\n width: 75%;\n -webkit-transition: left 2s;\n /* For Safari 3.1 to 6.0 */\n transition: left 0.15s linear;\n z-index: 1040;\n }\n #sidebar-menu.nav-open {\n left: 0;\n }\n}\n/* stylelint-enable no-descending-specificity */\n");
function __variableDynamicImportRuntime1__(path) {
switch (path) {
case './translations/Messages_de_DE.json':
return Promise.resolve().then(function () { return Messages_de_DE$1; });
case './translations/Messages_en_GB.json':
return Promise.resolve().then(function () { return Messages_en_GB$1; });
case './translations/Messages_es_ES.json':
return Promise.resolve().then(function () { return Messages_es_ES$1; });
case './translations/Messages_fr_CA.json':
return Promise.resolve().then(function () { return Messages_fr_CA$1; });
case './translations/Messages_fr_FR.json':
return Promise.resolve().then(function () { return Messages_fr_FR$1; });
case './translations/Messages_it_IT.json':
return Promise.resolve().then(function () { return Messages_it_IT$1; });
case './translations/Messages_pl_PL.json':
return Promise.resolve().then(function () { return Messages_pl_PL$1; });
case './translations/Messages_pt_PT.json':
return Promise.resolve().then(function () { return Messages_pt_PT$1; });
default:
return new Promise(function (resolve, reject) {
(typeof queueMicrotask === 'function' ? queueMicrotask : setTimeout)(reject.bind(null, new Error("Unknown variable dynamic import: " + path)));
});
}
}
function __variableDynamicImportRuntime0__(path) {
switch (path) {
case './translations/Messages_de_DE.json':
return Promise.resolve().then(function () { return Messages_de_DE$1; });
case './translations/Messages_en_GB.json':
return Promise.resolve().then(function () { return Messages_en_GB$1; });
case './translations/Messages_es_ES.json':
return Promise.resolve().then(function () { return Messages_es_ES$1; });
case './translations/Messages_fr_CA.json':
return Promise.resolve().then(function () { return Messages_fr_CA$1; });
case './translations/Messages_fr_FR.json':
return Promise.resolve().then(function () { return Messages_fr_FR$1; });
case './translations/Messages_it_IT.json':
return Promise.resolve().then(function () { return Messages_it_IT$1; });
case './translations/Messages_pl_PL.json':
return Promise.resolve().then(function () { return Messages_pl_PL$1; });
case './translations/Messages_pt_PT.json':
return Promise.resolve().then(function () { return Messages_pt_PT$1; });
default:
return new Promise(function (resolve, reject) {
(typeof queueMicrotask === 'function' ? queueMicrotask : setTimeout)(reject.bind(null, new Error("Unknown variable dynamic import: " + path)));
});
}
}
var moduleName = 'ngOvhSidebarMenu';
angular__default["default"].module(moduleName, ['ngOvhActionsMenu', moduleName$1, 'pascalprecht.translate', 'ui.router']).provider('SidebarMenu', provider).directive('sidebarMenu', directive).run(["$translate", "$q", "asyncLoader", function ($translate, $q, asyncLoader) {
var promises = [];
promises.push($q.all({
use: __variableDynamicImportRuntime0__('./translations/Messages_' + $translate.use() + '.json').then(function (module) {
return module["default"] || module;
})["catch"](function () {
return {};
}),
fallback: __variableDynamicImportRuntime1__('./translations/Messages_' + $translate.fallbackLanguage() + '.json').then(function (module) {
return module["default"] || module;
})["catch"](function () {
return {};
})
}).then(function (result) {
return Object.assign(result.fallback, result.use);
}));
promises.forEach(function (p) {
return asyncLoader.addTranslations(p);
});
return $q.all(promises).then(function () {
return $translate.refresh();
});
}]);
var Messages_de_DE = {sidebar_menu:"Menü",sidebar_menu_order_actions:"Bestellen",sidebar_menu_search:"Suchen",sidebar_menu_search_no_results:"Kein Ergebnis gefunden.",sidebar_menu_search_loading:"Suchen...",sidebar_menu_error_retry:"Erneut versuchen"};
var Messages_de_DE$1 = /*#__PURE__*/Object.freeze({
__proto__: null,
'default': Messages_de_DE
});
var Messages_en_GB = {sidebar_menu:"Menu",sidebar_menu_order_actions:"Order",sidebar_menu_search:"Search",sidebar_menu_search_no_results:"No results found.",sidebar_menu_search_loading:"Searching...",sidebar_menu_error_retry:"Try again"};
var Messages_en_GB$1 = /*#__PURE__*/Object.freeze({
__proto__: null,
'default': Messages_en_GB
});
var Messages_es_ES = {sidebar_menu:"Menú",sidebar_menu_order_actions:"Contratar",sidebar_menu_search:"Buscar",sidebar_menu_search_no_results:"No se han encontrado resultados.",sidebar_menu_search_loading:"Buscando...",sidebar_menu_error_retry:"Volver a intentarlo"};
var Messages_es_ES$1 = /*#__PURE__*/Object.freeze({
__proto__: null,
'default': Messages_es_ES
});
var Messages_fr_CA = {sidebar_menu:"Menu",sidebar_menu_order_actions:"Commander",sidebar_menu_search:"Rechercher",sidebar_menu_search_no_results:"Aucun résultat trouvé.",sidebar_menu_search_loading:"Recherche en cours...",sidebar_menu_error_retry:"Réessayer"};
var Messages_fr_CA$1 = /*#__PURE__*/Object.freeze({
__proto__: null,
'default': Messages_fr_CA
});
var Messages_fr_FR = {sidebar_menu:"Menu",sidebar_menu_order_actions:"Commander",sidebar_menu_search:"Rechercher",sidebar_menu_search_no_results:"Aucun résultat trouvé.",sidebar_menu_search_loading:"Recherche en cours...",sidebar_menu_error_retry:"Réessayer"};
var Messages_fr_FR$1 = /*#__PURE__*/Object.freeze({
__proto__: null,
'default': Messages_fr_FR
});
var Messages_it_IT = {sidebar_menu:"Menu",sidebar_menu_order_actions:"Ordina",sidebar_menu_search:"Ricerca",sidebar_menu_search_no_results:"Nessun risultato trovato",sidebar_menu_search_loading:"Ricerca in corso...",sidebar_menu_error_retry:"Riprova"};
var Messages_it_IT$1 = /*#__PURE__*/Object.freeze({
__proto__: null,
'default': Messages_it_IT
});
var Messages_pl_PL = {sidebar_menu:"Menu",sidebar_menu_order_actions:"Zamów",sidebar_menu_search:"Szukaj",sidebar_menu_search_no_results:"Brak wyników",sidebar_menu_search_loading:"Trwa wyszukiwanie...",sidebar_menu_error_retry:"Spróbuj ponownie"};
var Messages_pl_PL$1 = /*#__PURE__*/Object.freeze({
__proto__: null,
'default': Messages_pl_PL
});
var Messages_pt_PT = {sidebar_menu:"Menu",sidebar_menu_order_actions:"Encomendar",sidebar_menu_search:"Pesquisar",sidebar_menu_search_no_results:"Não foram encontrados resultados para os termos pesquisados",sidebar_menu_search_loading:"Procura em curso...",sidebar_menu_error_retry:"Tentar novamente"};
var Messages_pt_PT$1 = /*#__PURE__*/Object.freeze({
__proto__: null,
'default': Messages_pt_PT
});
return moduleName;
}));
//# sourceMappingURL=ng-ovh-sidebar-menu.js.map