diff --git a/dist/angular-swing.js b/dist/angular-swing.js index b88fb38..0419f65 100644 --- a/dist/angular-swing.js +++ b/dist/angular-swing.js @@ -72,11 +72,17 @@ process.chdir = function (dir) { (function (global){ 'use strict'; -Object.defineProperty(exports, '__esModule', { +Object.defineProperty(exports, "__esModule", { value: true }); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } +var _random2 = require('lodash/random'); + +var _random3 = _interopRequireDefault(_random2); + +var _assign2 = require('lodash/assign'); + +var _assign3 = _interopRequireDefault(_assign2); var _sister = require('sister'); @@ -94,46 +100,43 @@ var _vendorPrefix = require('vendor-prefix'); var _vendorPrefix2 = _interopRequireDefault(_vendorPrefix); -var _utilJs = require('./util.js'); - -var _utilJs2 = _interopRequireDefault(_utilJs); - var _raf = require('raf'); var _raf2 = _interopRequireDefault(_raf); -var Card = undefined; +var _util = require('./util'); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /** * @param {Stack} stack * @param {HTMLElement} targetElement * @return {Object} An instance of Card. */ -Card = function (stack, targetElement) { - var card = undefined, - config = undefined, - construct = undefined, - currentX = undefined, - currentY = undefined, - doMove = undefined, - eventEmitter = undefined, - isDraging = undefined, - lastThrow = undefined, - lastTranslate = undefined, - lastX = undefined, - lastY = undefined, - mc = undefined, - _onSpringUpdate = undefined, - springSystem = undefined, - springThrowIn = undefined, - springThrowOut = undefined, - throwOutDistance = undefined, - throwWhere = undefined; - - construct = function () { +var Card = function Card(stack, targetElement) { + var card = void 0, + config = void 0, + currentX = void 0, + currentY = void 0, + doMove = void 0, + eventEmitter = void 0, + isDraging = void 0, + lastThrow = void 0, + lastTranslate = void 0, + lastX = void 0, + lastY = void 0, + mc = void 0, + _onSpringUpdate = void 0, + springSystem = void 0, + springThrowIn = void 0, + springThrowOut = void 0, + throwOutDistance = void 0, + throwWhere = void 0; + + var construct = function construct() { card = {}; config = Card.makeConfig(stack.getConfig()); - eventEmitter = (0, _sister2['default'])(); + eventEmitter = (0, _sister2.default)(); springSystem = stack.getSpringSystem(); springThrowIn = springSystem.createSpring(250, 10); springThrowOut = springSystem.createSpring(500, 20); @@ -151,8 +154,8 @@ Card = function (stack, targetElement) { throwOutDistance = config.throwOutDistance(config.minThrowOutDistance, config.maxThrowOutDistance); - mc = new _hammerjs2['default'].Manager(targetElement, { - recognizers: [[_hammerjs2['default'].Pan, { + mc = new _hammerjs2.default.Manager(targetElement, { + recognizers: [[_hammerjs2.default.Pan, { threshold: 2 }]] }); @@ -175,7 +178,7 @@ Card = function (stack, targetElement) { if (isDraging) { doMove(); - (0, _raf2['default'])(animation); + (0, _raf2.default)(animation); } })(); }); @@ -186,13 +189,10 @@ Card = function (stack, targetElement) { }); eventEmitter.on('panend', function (e) { - var x = undefined, - y = undefined; - isDraging = false; - x = lastTranslate.x + e.deltaX; - y = lastTranslate.y + e.deltaY; + var x = lastTranslate.x + e.deltaX; + var y = lastTranslate.y + e.deltaY; if (config.isThrowOut(x, targetElement, config.throwOutConfidence(x, targetElement))) { card.throwOut(x, y); @@ -207,7 +207,7 @@ Card = function (stack, targetElement) { // "mousedown" event fires late on touch enabled devices, thus listening // to the touchstart event for touch enabled devices and mousedown otherwise. - if (_utilJs2['default'].isTouchDevice()) { + if ((0, _util.isTouchDevice)()) { targetElement.addEventListener('touchstart', function () { eventEmitter.trigger('panstart'); }); @@ -215,7 +215,7 @@ Card = function (stack, targetElement) { // Disable scrolling while dragging the element on the touch enabled devices. // @see http://stackoverflow.com/a/12090055/368691 (function () { - var dragging = undefined; + var dragging = void 0; targetElement.addEventListener('touchstart', function () { dragging = true; @@ -247,13 +247,9 @@ Card = function (stack, targetElement) { springThrowIn.addListener({ onSpringUpdate: function onSpringUpdate(spring) { - var value = undefined, - x = undefined, - y = undefined; - - value = spring.getCurrentValue(); - x = _rebound2['default'].MathUtil.mapValueInRange(value, 0, 1, lastThrow.fromX, 0); - y = _rebound2['default'].MathUtil.mapValueInRange(value, 0, 1, lastThrow.fromY, 0); + var value = spring.getCurrentValue(); + var x = _rebound2.default.MathUtil.mapValueInRange(value, 0, 1, lastThrow.fromX, 0); + var y = _rebound2.default.MathUtil.mapValueInRange(value, 0, 1, lastThrow.fromY, 0); _onSpringUpdate(x, y); }, @@ -266,13 +262,9 @@ Card = function (stack, targetElement) { springThrowOut.addListener({ onSpringUpdate: function onSpringUpdate(spring) { - var value = undefined, - x = undefined, - y = undefined; - - value = spring.getCurrentValue(); - x = _rebound2['default'].MathUtil.mapValueInRange(value, 0, 1, lastThrow.fromX, throwOutDistance * lastThrow.direction); - y = lastThrow.fromY; + var value = spring.getCurrentValue(); + var x = _rebound2.default.MathUtil.mapValueInRange(value, 0, 1, lastThrow.fromX, throwOutDistance * lastThrow.direction); + var y = lastThrow.fromY; _onSpringUpdate(x, y); }, @@ -288,10 +280,10 @@ Card = function (stack, targetElement) { * * @return {undefined} */ - doMove = function () { - var r = undefined, - x = undefined, - y = undefined; + doMove = function doMove() { + var r = void 0, + x = void 0, + y = void 0; if (currentX === lastX && currentY === lastY) { return; @@ -309,7 +301,8 @@ Card = function (stack, targetElement) { eventEmitter.trigger('dragmove', { target: targetElement, throwOutConfidence: config.throwOutConfidence(x, targetElement), - throwDirection: x < 0 ? Card.DIRECTION_LEFT : Card.DIRECTION_RIGHT + throwDirection: x < 0 ? Card.DIRECTION_LEFT : Card.DIRECTION_RIGHT, + offset: x }); }; @@ -320,8 +313,8 @@ Card = function (stack, targetElement) { * @param {Number} y * @return {undefined} */ - _onSpringUpdate = function (x, y) { - var r = undefined; + _onSpringUpdate = function _onSpringUpdate(x, y) { + var r = void 0; r = config.rotation(x, y, targetElement, config.maxRotation); @@ -337,7 +330,7 @@ Card = function (stack, targetElement) { * @param {Number} fromY * @return {undefined} */ - throwWhere = function (where, fromX, fromY) { + throwWhere = function throwWhere(where, fromX, fromY) { lastThrow.fromX = fromX; lastThrow.fromY = fromY; lastThrow.direction = lastThrow.fromX < 0 ? Card.DIRECTION_LEFT : Card.DIRECTION_RIGHT; @@ -430,9 +423,7 @@ Card = function (stack, targetElement) { Card.makeConfig = function () { var config = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; - var defaultConfig = undefined; - - defaultConfig = { + var defaultConfig = { isThrowOut: Card.isThrowOut, throwOutConfidence: Card.throwOutConfidence, throwOutDistance: Card.throwOutDistance, @@ -443,7 +434,7 @@ Card.makeConfig = function () { transform: Card.transform }; - return _utilJs2['default'].assign({}, defaultConfig, config); + return (0, _assign3.default)({}, defaultConfig, config); }; /** @@ -458,7 +449,7 @@ Card.makeConfig = function () { * @return {undefined} */ Card.transform = function (element, x, y, r) { - element.style[(0, _vendorPrefix2['default'])('transform')] = 'translate3d(0, 0, 0) translate(' + x + 'px, ' + y + 'px) rotate(' + r + 'deg)'; + element.style[(0, _vendorPrefix2.default)('transform')] = 'translate3d(0, 0, 0) translate(' + x + 'px, ' + y + 'px) rotate(' + r + 'deg)'; }; /** @@ -474,13 +465,9 @@ Card.transform = function (element, x, y, r) { * @return {undefined} */ Card.appendToParent = function (element) { - var parentNode = undefined, - siblings = undefined, - targetIndex = undefined; - - parentNode = element.parentNode; - siblings = _utilJs2['default'].elementChildren(parentNode); - targetIndex = siblings.indexOf(element); + var parentNode = element.parentNode; + var siblings = (0, _util.elementChildren)(parentNode); + var targetIndex = siblings.indexOf(element); if (targetIndex + 1 !== siblings.length) { parentNode.removeChild(element); @@ -523,7 +510,7 @@ Card.isThrowOut = function (offset, element, throwOutConfidence) { * @return {Number} */ Card.throwOutDistance = function (min, max) { - return _utilJs2['default'].random(min, max); + return (0, _random3.default)(min, max); }; /** @@ -536,13 +523,9 @@ Card.throwOutDistance = function (min, max) { * @return {Number} Rotation angle expressed in degrees. */ Card.rotation = function (x, y, element, maxRotation) { - var horizontalOffset = undefined, - rotation = undefined, - verticalOffset = undefined; - - horizontalOffset = Math.min(Math.max(x / element.offsetWidth, -1), 1); - verticalOffset = (y > 0 ? 1 : -1) * Math.min(Math.abs(y) / 100, 1); - rotation = horizontalOffset * verticalOffset * maxRotation; + var horizontalOffset = Math.min(Math.max(x / element.offsetWidth, -1), 1); + var verticalOffset = (y > 0 ? 1 : -1) * Math.min(Math.abs(y) / 100, 1); + var rotation = horizontalOffset * verticalOffset * maxRotation; return rotation; }; @@ -553,19 +536,18 @@ Card.DIRECTION_RIGHT = 1; Card.THROW_IN = 'in'; Card.THROW_OUT = 'out'; -exports['default'] = Card; +exports.default = Card; module.exports = exports['default']; //# sourceMappingURL=card.js.map + }).call(this,typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./util.js":5,"hammerjs":6,"raf":71,"rebound":73,"sister":74,"vendor-prefix":75}],3:[function(require,module,exports){ -(function (global){ +},{"./util":5,"hammerjs":6,"lodash/assign":91,"lodash/random":113,"raf":120,"rebound":122,"sister":123,"vendor-prefix":124}],3:[function(require,module,exports){ 'use strict'; -Object.defineProperty(exports, '__esModule', { +Object.defineProperty(exports, "__esModule", { value: true }); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } +exports.Card = exports.Stack = undefined; var _stack = require('./stack'); @@ -575,25 +557,26 @@ var _card = require('./card'); var _card2 = _interopRequireDefault(_card); -global.gajus = global.gajus || {}; - -global.gajus.Swing = { - Stack: _stack2['default'], - Card: _card2['default'] -}; +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -exports.Stack = _stack2['default']; -exports.Card = _card2['default']; +exports.Stack = _stack2.default; +exports.Card = _card2.default; //# sourceMappingURL=index.js.map -}).call(this,typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) + },{"./card":2,"./stack":4}],4:[function(require,module,exports){ 'use strict'; -Object.defineProperty(exports, '__esModule', { +Object.defineProperty(exports, "__esModule", { value: true }); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } +var _remove2 = require('lodash/remove'); + +var _remove3 = _interopRequireDefault(_remove2); + +var _find2 = require('lodash/find'); + +var _find3 = _interopRequireDefault(_find2); var _sister = require('sister'); @@ -607,27 +590,23 @@ var _card = require('./card'); var _card2 = _interopRequireDefault(_card); -var _util = require('./util'); - -var _util2 = _interopRequireDefault(_util); - -var Stack = undefined; +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /** * @param {Object} config Stack configuration. * @return {Object} An instance of Stack object. */ -Stack = function (config) { - var construct = undefined, - eventEmitter = undefined, - index = undefined, - springSystem = undefined, - stack = undefined; +var Stack = function Stack(config) { + var construct = void 0, + eventEmitter = void 0, + index = void 0, + springSystem = void 0, + stack = void 0; - construct = function () { + construct = function construct() { stack = {}; - springSystem = new _rebound2['default'].SpringSystem(); - eventEmitter = (0, _sister2['default'])(); + springSystem = new _rebound2.default.SpringSystem(); + eventEmitter = (0, _sister2.default)(); index = []; }; @@ -669,12 +648,8 @@ Stack = function (config) { * @return {Card} */ stack.createCard = function (element) { - var card = undefined, - events = undefined; - - card = (0, _card2['default'])(stack, element); - - events = ['throwout', 'throwoutend', 'throwoutleft', 'throwoutright', 'throwin', 'throwinend', 'dragstart', 'dragmove', 'dragend']; + var card = (0, _card2.default)(stack, element); + var events = ['throwout', 'throwoutend', 'throwoutleft', 'throwoutright', 'throwin', 'throwinend', 'dragstart', 'dragmove', 'dragend']; // Proxy Card events to the Stack. events.forEach(function (eventName) { @@ -698,14 +673,12 @@ Stack = function (config) { * @return {Card|null} */ stack.getCard = function (element) { - var card = undefined; - - card = _util2['default'].find(index, { + var group = (0, _find3.default)(index, { element: element }); - if (card) { - return card.card; + if (group) { + return group.card; } return null; @@ -715,56 +688,34 @@ Stack = function (config) { * Remove an instance of Card from the stack index. * * @param {Card} card - * @return {Card} + * @return {null} */ stack.destroyCard = function (card) { - return _util2['default'].remove(index, card); + return (0, _remove3.default)(index, { + card: card + }); }; return stack; }; -exports['default'] = Stack; +exports.default = Stack; module.exports = exports['default']; //# sourceMappingURL=stack.js.map -},{"./card":2,"./util":5,"rebound":73,"sister":74}],5:[function(require,module,exports){ + +},{"./card":2,"lodash/find":94,"lodash/remove":114,"rebound":122,"sister":123}],5:[function(require,module,exports){ 'use strict'; -Object.defineProperty(exports, '__esModule', { +Object.defineProperty(exports, "__esModule", { value: true }); +exports.isTouchDevice = exports.elementChildren = undefined; -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - -var _lodashArrayRemove = require('lodash/array/remove'); - -var _lodashArrayRemove2 = _interopRequireDefault(_lodashArrayRemove); - -var _lodashObjectAssign = require('lodash/object/assign'); - -var _lodashObjectAssign2 = _interopRequireDefault(_lodashObjectAssign); - -var _lodashNumberRandom = require('lodash/number/random'); - -var _lodashNumberRandom2 = _interopRequireDefault(_lodashNumberRandom); +var _filter2 = require('lodash/filter'); -var _lodashCollectionFind = require('lodash/collection/find'); +var _filter3 = _interopRequireDefault(_filter2); -var _lodashCollectionFind2 = _interopRequireDefault(_lodashCollectionFind); - -var _lodashCollectionWhere = require('lodash/collection/where'); - -var _lodashCollectionWhere2 = _interopRequireDefault(_lodashCollectionWhere); - -var util = undefined; - -util = {}; - -util.remove = _lodashArrayRemove2['default']; -util.assign = _lodashObjectAssign2['default']; -util.random = _lodashNumberRandom2['default']; -util.find = _lodashCollectionFind2['default']; -util.where = _lodashCollectionWhere2['default']; +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /** * Return direct children elements. @@ -773,8 +724,8 @@ util.where = _lodashCollectionWhere2['default']; * @param {HTMLElement} element * @return {Array} */ -util.elementChildren = function (element) { - return util.where(element.childNodes, { +var elementChildren = function elementChildren(element) { + return (0, _filter3.default)(element.childNodes, { nodeType: 1 }); }; @@ -783,14 +734,15 @@ util.elementChildren = function (element) { * @see http://stackoverflow.com/questions/4817029/whats-the-best-way-to-detect-a-touch-screen-device-using-javascript/4819886#4819886 * @return {Boolean} */ -util.isTouchDevice = function () { +var isTouchDevice = function isTouchDevice() { return 'ontouchstart' in window || navigator.msMaxTouchPoints; }; -exports['default'] = util; -module.exports = exports['default']; +exports.elementChildren = elementChildren; +exports.isTouchDevice = isTouchDevice; //# sourceMappingURL=util.js.map -},{"lodash/array/remove":8,"lodash/collection/find":10,"lodash/collection/where":11,"lodash/number/random":64,"lodash/object/assign":65}],6:[function(require,module,exports){ + +},{"lodash/filter":93}],6:[function(require,module,exports){ /*! Hammer.JS - v2.0.6 - 2015-12-23 * http://hammerjs.github.io/ * @@ -3361,316 +3313,164 @@ if (typeof define === 'function' && define.amd) { })(window, document, 'Hammer'); },{}],7:[function(require,module,exports){ +var nativeCreate = require('./_nativeCreate'); + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + /** - * Gets the last element of `array`. - * - * @static - * @memberOf _ - * @category Array - * @param {Array} array The array to query. - * @returns {*} Returns the last element of `array`. - * @example + * Creates an hash object. * - * _.last([1, 2, 3]); - * // => 3 + * @private + * @constructor + * @returns {Object} Returns the new hash object. */ -function last(array) { - var length = array ? array.length : 0; - return length ? array[length - 1] : undefined; -} +function Hash() {} -module.exports = last; +// Avoid inheriting from `Object.prototype` when possible. +Hash.prototype = nativeCreate ? nativeCreate(null) : objectProto; + +module.exports = Hash; -},{}],8:[function(require,module,exports){ -var baseCallback = require('../internal/baseCallback'), - basePullAt = require('../internal/basePullAt'); +},{"./_nativeCreate":81}],8:[function(require,module,exports){ +var getNative = require('./_getNative'), + root = require('./_root'); + +/* Built-in method references that are verified to be native. */ +var Map = getNative(root, 'Map'); + +module.exports = Map; + +},{"./_getNative":60,"./_root":83}],9:[function(require,module,exports){ +var mapClear = require('./_mapClear'), + mapDelete = require('./_mapDelete'), + mapGet = require('./_mapGet'), + mapHas = require('./_mapHas'), + mapSet = require('./_mapSet'); /** - * Removes all elements from `array` that `predicate` returns truthy for - * and returns an array of the removed elements. The predicate is bound to - * `thisArg` and invoked with three arguments: (value, index, array). - * - * If a property name is provided for `predicate` the created `_.property` - * style callback returns the property value of the given element. - * - * If a value is also provided for `thisArg` the created `_.matchesProperty` - * style callback returns `true` for elements that have a matching property - * value, else `false`. - * - * If an object is provided for `predicate` the created `_.matches` style - * callback returns `true` for elements that have the properties of the given - * object, else `false`. - * - * **Note:** Unlike `_.filter`, this method mutates `array`. - * - * @static - * @memberOf _ - * @category Array - * @param {Array} array The array to modify. - * @param {Function|Object|string} [predicate=_.identity] The function invoked - * per iteration. - * @param {*} [thisArg] The `this` binding of `predicate`. - * @returns {Array} Returns the new array of removed elements. - * @example - * - * var array = [1, 2, 3, 4]; - * var evens = _.remove(array, function(n) { - * return n % 2 == 0; - * }); + * Creates a map cache object to store key-value pairs. * - * console.log(array); - * // => [1, 3] - * - * console.log(evens); - * // => [2, 4] + * @private + * @constructor + * @param {Array} [values] The values to cache. */ -function remove(array, predicate, thisArg) { - var result = []; - if (!(array && array.length)) { - return result; - } +function MapCache(values) { var index = -1, - indexes = [], - length = array.length; + length = values ? values.length : 0; - predicate = baseCallback(predicate, thisArg, 3); + this.clear(); while (++index < length) { - var value = array[index]; - if (predicate(value, index, array)) { - result.push(value); - indexes.push(index); - } + var entry = values[index]; + this.set(entry[0], entry[1]); } - basePullAt(array, indexes); - return result; } -module.exports = remove; +// Add functions to the `MapCache`. +MapCache.prototype.clear = mapClear; +MapCache.prototype['delete'] = mapDelete; +MapCache.prototype.get = mapGet; +MapCache.prototype.has = mapHas; +MapCache.prototype.set = mapSet; + +module.exports = MapCache; + +},{"./_mapClear":75,"./_mapDelete":76,"./_mapGet":77,"./_mapHas":78,"./_mapSet":79}],10:[function(require,module,exports){ +var getNative = require('./_getNative'), + root = require('./_root'); + +/* Built-in method references that are verified to be native. */ +var Set = getNative(root, 'Set'); -},{"../internal/baseCallback":17,"../internal/basePullAt":33}],9:[function(require,module,exports){ -var arrayFilter = require('../internal/arrayFilter'), - baseCallback = require('../internal/baseCallback'), - baseFilter = require('../internal/baseFilter'), - isArray = require('../lang/isArray'); +module.exports = Set; + +},{"./_getNative":60,"./_root":83}],11:[function(require,module,exports){ +var stackClear = require('./_stackClear'), + stackDelete = require('./_stackDelete'), + stackGet = require('./_stackGet'), + stackHas = require('./_stackHas'), + stackSet = require('./_stackSet'); /** - * Iterates over elements of `collection`, returning an array of all elements - * `predicate` returns truthy for. The predicate is bound to `thisArg` and - * invoked with three arguments: (value, index|key, collection). - * - * If a property name is provided for `predicate` the created `_.property` - * style callback returns the property value of the given element. - * - * If a value is also provided for `thisArg` the created `_.matchesProperty` - * style callback returns `true` for elements that have a matching property - * value, else `false`. - * - * If an object is provided for `predicate` the created `_.matches` style - * callback returns `true` for elements that have the properties of the given - * object, else `false`. - * - * @static - * @memberOf _ - * @alias select - * @category Collection - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [predicate=_.identity] The function invoked - * per iteration. - * @param {*} [thisArg] The `this` binding of `predicate`. - * @returns {Array} Returns the new filtered array. - * @example - * - * _.filter([4, 5, 6], function(n) { - * return n % 2 == 0; - * }); - * // => [4, 6] - * - * var users = [ - * { 'user': 'barney', 'age': 36, 'active': true }, - * { 'user': 'fred', 'age': 40, 'active': false } - * ]; - * - * // using the `_.matches` callback shorthand - * _.pluck(_.filter(users, { 'age': 36, 'active': true }), 'user'); - * // => ['barney'] + * Creates a stack cache object to store key-value pairs. * - * // using the `_.matchesProperty` callback shorthand - * _.pluck(_.filter(users, 'active', false), 'user'); - * // => ['fred'] - * - * // using the `_.property` callback shorthand - * _.pluck(_.filter(users, 'active'), 'user'); - * // => ['barney'] + * @private + * @constructor + * @param {Array} [values] The values to cache. */ -function filter(collection, predicate, thisArg) { - var func = isArray(collection) ? arrayFilter : baseFilter; - predicate = baseCallback(predicate, thisArg, 3); - return func(collection, predicate); +function Stack(values) { + var index = -1, + length = values ? values.length : 0; + + this.clear(); + while (++index < length) { + var entry = values[index]; + this.set(entry[0], entry[1]); + } } -module.exports = filter; +// Add functions to the `Stack` cache. +Stack.prototype.clear = stackClear; +Stack.prototype['delete'] = stackDelete; +Stack.prototype.get = stackGet; +Stack.prototype.has = stackHas; +Stack.prototype.set = stackSet; -},{"../internal/arrayFilter":13,"../internal/baseCallback":17,"../internal/baseFilter":20,"../lang/isArray":59}],10:[function(require,module,exports){ -var baseEach = require('../internal/baseEach'), - createFind = require('../internal/createFind'); +module.exports = Stack; -/** - * Iterates over elements of `collection`, returning the first element - * `predicate` returns truthy for. The predicate is bound to `thisArg` and - * invoked with three arguments: (value, index|key, collection). - * - * If a property name is provided for `predicate` the created `_.property` - * style callback returns the property value of the given element. - * - * If a value is also provided for `thisArg` the created `_.matchesProperty` - * style callback returns `true` for elements that have a matching property - * value, else `false`. - * - * If an object is provided for `predicate` the created `_.matches` style - * callback returns `true` for elements that have the properties of the given - * object, else `false`. - * - * @static - * @memberOf _ - * @alias detect - * @category Collection - * @param {Array|Object|string} collection The collection to search. - * @param {Function|Object|string} [predicate=_.identity] The function invoked - * per iteration. - * @param {*} [thisArg] The `this` binding of `predicate`. - * @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 } - * ]; - * - * _.result(_.find(users, function(chr) { - * return chr.age < 40; - * }), 'user'); - * // => 'barney' - * - * // using the `_.matches` callback shorthand - * _.result(_.find(users, { 'age': 1, 'active': true }), 'user'); - * // => 'pebbles' - * - * // using the `_.matchesProperty` callback shorthand - * _.result(_.find(users, 'active', false), 'user'); - * // => 'fred' - * - * // using the `_.property` callback shorthand - * _.result(_.find(users, 'active'), 'user'); - * // => 'barney' - */ -var find = createFind(baseEach); +},{"./_stackClear":85,"./_stackDelete":86,"./_stackGet":87,"./_stackHas":88,"./_stackSet":89}],12:[function(require,module,exports){ +var root = require('./_root'); -module.exports = find; +/** Built-in value references. */ +var Symbol = root.Symbol; -},{"../internal/baseEach":19,"../internal/createFind":41}],11:[function(require,module,exports){ -var baseMatches = require('../internal/baseMatches'), - filter = require('./filter'); +module.exports = Symbol; -/** - * Performs a deep comparison between each element in `collection` and the - * source object, returning an array of all elements that have equivalent - * property values. - * - * **Note:** This method supports comparing arrays, booleans, `Date` objects, - * numbers, `Object` objects, regexes, and strings. Objects are compared by - * their own, not inherited, enumerable properties. For comparing a single - * own or inherited property value see `_.matchesProperty`. - * - * @static - * @memberOf _ - * @category Collection - * @param {Array|Object|string} collection The collection to search. - * @param {Object} source The object of property values to match. - * @returns {Array} Returns the new filtered array. - * @example - * - * var users = [ - * { 'user': 'barney', 'age': 36, 'active': false, 'pets': ['hoppy'] }, - * { 'user': 'fred', 'age': 40, 'active': true, 'pets': ['baby puss', 'dino'] } - * ]; - * - * _.pluck(_.where(users, { 'age': 36, 'active': false }), 'user'); - * // => ['barney'] - * - * _.pluck(_.where(users, { 'pets': ['dino'] }), 'user'); - * // => ['fred'] - */ -function where(collection, source) { - return filter(collection, baseMatches(source)); -} +},{"./_root":83}],13:[function(require,module,exports){ +var root = require('./_root'); -module.exports = where; +/** Built-in value references. */ +var Uint8Array = root.Uint8Array; -},{"../internal/baseMatches":29,"./filter":9}],12:[function(require,module,exports){ -/** Used as the `TypeError` message for "Functions" methods. */ -var FUNC_ERROR_TEXT = 'Expected a function'; +module.exports = Uint8Array; -/* Native method references for those with the same name as other `lodash` methods. */ -var nativeMax = Math.max; +},{"./_root":83}],14:[function(require,module,exports){ +var getNative = require('./_getNative'), + root = require('./_root'); + +/* Built-in method references that are verified to be native. */ +var WeakMap = getNative(root, 'WeakMap'); +module.exports = WeakMap; + +},{"./_getNative":60,"./_root":83}],15:[function(require,module,exports){ /** - * Creates a function that invokes `func` with the `this` binding of the - * created function and arguments from `start` and beyond provided as an array. - * - * **Note:** This method is based on the [rest parameter](https://developer.mozilla.org/Web/JavaScript/Reference/Functions/rest_parameters). - * - * @static - * @memberOf _ - * @category Function - * @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. - * @example - * - * var say = _.restParam(function(what, names) { - * return what + ' ' + _.initial(names).join(', ') + - * (_.size(names) > 1 ? ', & ' : '') + _.last(names); - * }); + * A faster alternative to `Function#apply`, this function invokes `func` + * with the `this` binding of `thisArg` and the arguments of `args`. * - * say('hello', 'fred', 'barney', 'pebbles'); - * // => 'hello fred, barney, & pebbles' - */ -function restParam(func, start) { - if (typeof func != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); + * @private + * @param {Function} func The function to invoke. + * @param {*} thisArg The `this` binding of `func`. + * @param {...*} args The arguments to invoke `func` with. + * @returns {*} Returns the result of `func`. + */ +function apply(func, thisArg, args) { + var length = args.length; + switch (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]); } - start = nativeMax(start === undefined ? (func.length - 1) : (+start || 0), 0); - return function() { - var args = arguments, - index = -1, - length = nativeMax(args.length - start, 0), - rest = Array(length); - - while (++index < length) { - rest[index] = args[start + index]; - } - switch (start) { - case 0: return func.call(this, rest); - case 1: return func.call(this, args[0], rest); - case 2: return func.call(this, args[0], args[1], rest); - } - var otherArgs = Array(start + 1); - index = -1; - while (++index < start) { - otherArgs[index] = args[index]; - } - otherArgs[start] = rest; - return func.apply(this, otherArgs); - }; + return func.apply(thisArg, args); } -module.exports = restParam; +module.exports = apply; -},{}],13:[function(require,module,exports){ +},{}],16:[function(require,module,exports){ /** - * A specialized version of `_.filter` for arrays without support for callback - * shorthands and `this` binding. + * A specialized version of `_.filter` for arrays without support for + * iteratee shorthands. * * @private * @param {Array} array The array to iterate over. @@ -3680,13 +3480,13 @@ module.exports = restParam; function arrayFilter(array, predicate) { var index = -1, length = array.length, - resIndex = -1, + resIndex = 0, result = []; while (++index < length) { var value = array[index]; if (predicate(value, index, array)) { - result[++resIndex] = value; + result[resIndex++] = value; } } return result; @@ -3694,16 +3494,38 @@ function arrayFilter(array, predicate) { module.exports = arrayFilter; -},{}],14:[function(require,module,exports){ +},{}],17:[function(require,module,exports){ +/** + * 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.length, + result = Array(length); + + while (++index < length) { + result[index] = iteratee(array[index], index, array); + } + return result; +} + +module.exports = arrayMap; + +},{}],18:[function(require,module,exports){ /** - * A specialized version of `_.some` for arrays without support for callback - * shorthands and `this` binding. + * 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`. + * @returns {boolean} Returns `true` if any element passes the predicate check, else `false`. */ function arraySome(array, predicate) { var index = -1, @@ -3719,149 +3541,190 @@ function arraySome(array, predicate) { module.exports = arraySome; -},{}],15:[function(require,module,exports){ -var keys = require('../object/keys'); +},{}],19:[function(require,module,exports){ +var eq = require('./eq'); + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; /** - * A specialized version of `_.assign` for customizing assigned values without - * support for argument juggling, multiple sources, and `this` binding `customizer` - * functions. + * Assigns `value` to `key` of `object` if the existing value is not equivalent + * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * for equality comparisons. * * @private - * @param {Object} object The destination object. - * @param {Object} source The source object. - * @param {Function} customizer The function to customize assigned values. - * @returns {Object} Returns `object`. - */ -function assignWith(object, source, customizer) { - var index = -1, - props = keys(source), - length = props.length; - - while (++index < length) { - var key = props[index], - value = object[key], - result = customizer(value, source[key], key, object, source); - - if ((result === result ? (result !== value) : (value === value)) || - (value === undefined && !(key in object))) { - object[key] = result; - } + * @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.call(object, key) && eq(objValue, value)) || + (value === undefined && !(key in object))) { + object[key] = value; } - return object; } -module.exports = assignWith; +module.exports = assignValue; -},{"../object/keys":66}],16:[function(require,module,exports){ -var baseCopy = require('./baseCopy'), - keys = require('../object/keys'); +},{"./eq":92}],20:[function(require,module,exports){ +var assocIndexOf = require('./_assocIndexOf'); -/** - * The base implementation of `_.assign` without support for argument juggling, - * multiple sources, and `customizer` functions. - * +/** 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 associative array. + * * @private - * @param {Object} object The destination object. - * @param {Object} source The source object. - * @returns {Object} Returns `object`. + * @param {Array} array The array to query. + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ -function baseAssign(object, source) { - return source == null - ? object - : baseCopy(source, keys(source), object); +function assocDelete(array, key) { + var index = assocIndexOf(array, key); + if (index < 0) { + return false; + } + var lastIndex = array.length - 1; + if (index == lastIndex) { + array.pop(); + } else { + splice.call(array, index, 1); + } + return true; } -module.exports = baseAssign; +module.exports = assocDelete; -},{"../object/keys":66,"./baseCopy":18}],17:[function(require,module,exports){ -var baseMatches = require('./baseMatches'), - baseMatchesProperty = require('./baseMatchesProperty'), - bindCallback = require('./bindCallback'), - identity = require('../utility/identity'), - property = require('../utility/property'); +},{"./_assocIndexOf":23}],21:[function(require,module,exports){ +var assocIndexOf = require('./_assocIndexOf'); /** - * The base implementation of `_.callback` which supports specifying the - * number of arguments to provide to `func`. + * Gets the associative array value for `key`. * * @private - * @param {*} [func=_.identity] The value to convert to a callback. - * @param {*} [thisArg] The `this` binding of `func`. - * @param {number} [argCount] The number of arguments to provide to `func`. - * @returns {Function} Returns the callback. + * @param {Array} array The array to query. + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. */ -function baseCallback(func, thisArg, argCount) { - var type = typeof func; - if (type == 'function') { - return thisArg === undefined - ? func - : bindCallback(func, thisArg, argCount); - } - if (func == null) { - return identity; - } - if (type == 'object') { - return baseMatches(func); - } - return thisArg === undefined - ? property(func) - : baseMatchesProperty(func, thisArg); +function assocGet(array, key) { + var index = assocIndexOf(array, key); + return index < 0 ? undefined : array[index][1]; } -module.exports = baseCallback; +module.exports = assocGet; + +},{"./_assocIndexOf":23}],22:[function(require,module,exports){ +var assocIndexOf = require('./_assocIndexOf'); -},{"../utility/identity":69,"../utility/property":70,"./baseMatches":29,"./baseMatchesProperty":30,"./bindCallback":37}],18:[function(require,module,exports){ /** - * Copies properties of `source` to `object`. + * Checks if an associative array value for `key` exists. * * @private - * @param {Object} source The object to copy properties from. - * @param {Array} props The property names to copy. - * @param {Object} [object={}] The object to copy properties to. - * @returns {Object} Returns `object`. + * @param {Array} array The array 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 baseCopy(source, props, object) { - object || (object = {}); +function assocHas(array, key) { + return assocIndexOf(array, key) > -1; +} - var index = -1, - length = props.length; +module.exports = assocHas; - while (++index < length) { - var key = props[index]; - object[key] = source[key]; +},{"./_assocIndexOf":23}],23:[function(require,module,exports){ +var eq = require('./eq'); + +/** + * Gets the index at which the first occurrence of `key` is found in `array` + * of key-value pairs. + * + * @private + * @param {Array} array The array to search. + * @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 object; + return -1; } -module.exports = baseCopy; +module.exports = assocIndexOf; -},{}],19:[function(require,module,exports){ -var baseForOwn = require('./baseForOwn'), - createBaseEach = require('./createBaseEach'); +},{"./eq":92}],24:[function(require,module,exports){ +var assocIndexOf = require('./_assocIndexOf'); + +/** + * Sets the associative array `key` to `value`. + * + * @private + * @param {Array} array The array to modify. + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + */ +function assocSet(array, key, value) { + var index = assocIndexOf(array, key); + if (index < 0) { + array.push([key, value]); + } else { + array[index][1] = value; + } +} + +module.exports = assocSet; + +},{"./_assocIndexOf":23}],25:[function(require,module,exports){ +var isArray = require('./isArray'), + stringToPath = require('./_stringToPath'); + +/** + * Casts `value` to a path array if it's not one. + * + * @private + * @param {*} value The value to inspect. + * @returns {Array} Returns the cast property path array. + */ +function baseCastPath(value) { + return isArray(value) ? value : stringToPath(value); +} + +module.exports = baseCastPath; + +},{"./_stringToPath":90,"./isArray":99}],26:[function(require,module,exports){ +var baseForOwn = require('./_baseForOwn'), + createBaseEach = require('./_createBaseEach'); /** - * The base implementation of `_.forEach` without support for callback - * shorthands and `this` binding. + * The base implementation of `_.forEach` without support for iteratee shorthands. * * @private - * @param {Array|Object|string} collection The collection to iterate over. + * @param {Array|Object} collection The collection to iterate over. * @param {Function} iteratee The function invoked per iteration. - * @returns {Array|Object|string} Returns `collection`. + * @returns {Array|Object} Returns `collection`. */ var baseEach = createBaseEach(baseForOwn); module.exports = baseEach; -},{"./baseForOwn":24,"./createBaseEach":39}],20:[function(require,module,exports){ -var baseEach = require('./baseEach'); +},{"./_baseForOwn":31,"./_createBaseEach":53}],27:[function(require,module,exports){ +var baseEach = require('./_baseEach'); /** - * The base implementation of `_.filter` without support for callback - * shorthands and `this` binding. + * The base implementation of `_.filter` without support for iteratee shorthands. * * @private - * @param {Array|Object|string} collection The collection to iterate over. + * @param {Array|Object} collection The collection to iterate over. * @param {Function} predicate The function invoked per iteration. * @returns {Array} Returns the new filtered array. */ @@ -3877,18 +3740,17 @@ function baseFilter(collection, predicate) { module.exports = baseFilter; -},{"./baseEach":19}],21:[function(require,module,exports){ +},{"./_baseEach":26}],28:[function(require,module,exports){ /** - * The base implementation of `_.find`, `_.findLast`, `_.findKey`, and `_.findLastKey`, - * without support for callback shorthands and `this` binding, which iterates - * over `collection` using the provided `eachFunc`. + * The base implementation of methods like `_.find` and `_.findKey`, without + * support for iteratee shorthands, which iterates over `collection` using + * `eachFunc`. * * @private - * @param {Array|Object|string} collection The collection to search. + * @param {Array|Object} collection The collection to search. * @param {Function} predicate The function invoked per iteration. * @param {Function} eachFunc The function to iterate over `collection`. - * @param {boolean} [retKey] Specify returning the key of the found element - * instead of the element itself. + * @param {boolean} [retKey] Specify returning the key of the found element instead of the element itself. * @returns {*} Returns the found element or its key, else `undefined`. */ function baseFind(collection, predicate, eachFunc, retKey) { @@ -3904,10 +3766,10 @@ function baseFind(collection, predicate, eachFunc, retKey) { module.exports = baseFind; -},{}],22:[function(require,module,exports){ +},{}],29:[function(require,module,exports){ /** * The base implementation of `_.findIndex` and `_.findLastIndex` without - * support for callback shorthands and `this` binding. + * support for iteratee shorthands. * * @private * @param {Array} array The array to search. @@ -3929,8 +3791,8 @@ function baseFindIndex(array, predicate, fromRight) { module.exports = baseFindIndex; -},{}],23:[function(require,module,exports){ -var createBaseFor = require('./createBaseFor'); +},{}],30:[function(require,module,exports){ +var createBaseFor = require('./_createBaseFor'); /** * The base implementation of `baseForIn` and `baseForOwn` which iterates @@ -3948,13 +3810,12 @@ var baseFor = createBaseFor(); module.exports = baseFor; -},{"./createBaseFor":40}],24:[function(require,module,exports){ -var baseFor = require('./baseFor'), - keys = require('../object/keys'); +},{"./_createBaseFor":54}],31:[function(require,module,exports){ +var baseFor = require('./_baseFor'), + keys = require('./keys'); /** - * The base implementation of `_.forOwn` without support for callback - * shorthands and `this` binding. + * The base implementation of `_.forOwn` without support for iteratee shorthands. * * @private * @param {Object} object The object to iterate over. @@ -3962,31 +3823,26 @@ var baseFor = require('./baseFor'), * @returns {Object} Returns `object`. */ function baseForOwn(object, iteratee) { - return baseFor(object, iteratee, keys); + return object && baseFor(object, iteratee, keys); } module.exports = baseForOwn; -},{"../object/keys":66,"./baseFor":23}],25:[function(require,module,exports){ -var toObject = require('./toObject'); +},{"./_baseFor":30,"./keys":110}],32:[function(require,module,exports){ +var baseCastPath = require('./_baseCastPath'), + isKey = require('./_isKey'); /** - * The base implementation of `get` without support for string paths - * and default values. + * The base implementation of `_.get` without support for default values. * * @private * @param {Object} object The object to query. - * @param {Array} path The path of the property to get. - * @param {string} [pathKey] The key representation of path. + * @param {Array|string} path The path of the property to get. * @returns {*} Returns the resolved value. */ -function baseGet(object, path, pathKey) { - if (object == null) { - return; - } - if (pathKey !== undefined && pathKey in toObject(object)) { - path = [pathKey]; - } +function baseGet(object, path) { + path = isKey(path, object) ? [path + ''] : baseCastPath(path); + var index = 0, length = path.length; @@ -3998,60 +3854,105 @@ function baseGet(object, path, pathKey) { module.exports = baseGet; -},{"./toObject":56}],26:[function(require,module,exports){ -var baseIsEqualDeep = require('./baseIsEqualDeep'), - isObject = require('../lang/isObject'), +},{"./_baseCastPath":25,"./_isKey":71}],33:[function(require,module,exports){ +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** Built-in value references. */ +var getPrototypeOf = Object.getPrototypeOf; + +/** + * The base implementation of `_.has` 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 baseHas(object, key) { + // Avoid a bug in IE 10-11 where objects with a [[Prototype]] of `null`, + // that are composed entirely of index properties, return `false` for + // `hasOwnProperty` checks of them. + return hasOwnProperty.call(object, key) || + (typeof object == 'object' && key in object && getPrototypeOf(object) === null); +} + +module.exports = baseHas; + +},{}],34:[function(require,module,exports){ +/** + * 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 key in Object(object); +} + +module.exports = baseHasIn; + +},{}],35:[function(require,module,exports){ +var baseIsEqualDeep = require('./_baseIsEqualDeep'), + isObject = require('./isObject'), isObjectLike = require('./isObjectLike'); /** - * The base implementation of `_.isEqual` without support for `this` binding - * `customizer` functions. + * 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 {Function} [customizer] The function to customize comparing values. - * @param {boolean} [isLoose] Specify performing partial comparisons. - * @param {Array} [stackA] Tracks traversed `value` objects. - * @param {Array} [stackB] Tracks traversed `other` objects. + * @param {Function} [customizer] The function to customize comparisons. + * @param {boolean} [bitmask] The bitmask of comparison flags. + * The bitmask may be composed of the following flags: + * 1 - Unordered comparison + * 2 - Partial comparison + * @param {Object} [stack] Tracks traversed `value` and `other` objects. * @returns {boolean} Returns `true` if the values are equivalent, else `false`. */ -function baseIsEqual(value, other, customizer, isLoose, stackA, stackB) { +function baseIsEqual(value, other, customizer, bitmask, stack) { if (value === other) { return true; } if (value == null || other == null || (!isObject(value) && !isObjectLike(other))) { return value !== value && other !== other; } - return baseIsEqualDeep(value, other, baseIsEqual, customizer, isLoose, stackA, stackB); + return baseIsEqualDeep(value, other, baseIsEqual, customizer, bitmask, stack); } module.exports = baseIsEqual; -},{"../lang/isObject":62,"./baseIsEqualDeep":27,"./isObjectLike":53}],27:[function(require,module,exports){ -var equalArrays = require('./equalArrays'), - equalByTag = require('./equalByTag'), - equalObjects = require('./equalObjects'), - isArray = require('../lang/isArray'), - isTypedArray = require('../lang/isTypedArray'); +},{"./_baseIsEqualDeep":36,"./isObject":105,"./isObjectLike":106}],36:[function(require,module,exports){ +var Stack = require('./_Stack'), + equalArrays = require('./_equalArrays'), + equalByTag = require('./_equalByTag'), + equalObjects = require('./_equalObjects'), + getTag = require('./_getTag'), + isArray = require('./isArray'), + isHostObject = require('./_isHostObject'), + isTypedArray = require('./isTypedArray'); + +/** Used to compose bitmasks for comparison styles. */ +var PARTIAL_COMPARE_FLAG = 2; /** `Object#toString` result references. */ var argsTag = '[object Arguments]', arrayTag = '[object Array]', objectTag = '[object Object]'; -/** Used for native method references. */ +/** Used for built-in method references. */ var objectProto = Object.prototype; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; -/** - * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) - * of values. - */ -var objToString = objectProto.toString; - /** * A specialized version of `baseIsEqual` for arrays and objects which performs * deep comparisons and tracks traversed objects enabling objects with circular @@ -4061,92 +3962,72 @@ var objToString = objectProto.toString; * @param {Object} object The object to compare. * @param {Object} other The other object to compare. * @param {Function} equalFunc The function to determine equivalents of values. - * @param {Function} [customizer] The function to customize comparing objects. - * @param {boolean} [isLoose] Specify performing partial comparisons. - * @param {Array} [stackA=[]] Tracks traversed `value` objects. - * @param {Array} [stackB=[]] Tracks traversed `other` objects. + * @param {Function} [customizer] The function to customize comparisons. + * @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual` for more details. + * @param {Object} [stack] Tracks traversed `object` and `other` objects. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. */ -function baseIsEqualDeep(object, other, equalFunc, customizer, isLoose, stackA, stackB) { +function baseIsEqualDeep(object, other, equalFunc, customizer, bitmask, stack) { var objIsArr = isArray(object), othIsArr = isArray(other), objTag = arrayTag, othTag = arrayTag; if (!objIsArr) { - objTag = objToString.call(object); - if (objTag == argsTag) { - objTag = objectTag; - } else if (objTag != objectTag) { - objIsArr = isTypedArray(object); - } + objTag = getTag(object); + objTag = objTag == argsTag ? objectTag : objTag; } if (!othIsArr) { - othTag = objToString.call(other); - if (othTag == argsTag) { - othTag = objectTag; - } else if (othTag != objectTag) { - othIsArr = isTypedArray(other); - } + othTag = getTag(other); + othTag = othTag == argsTag ? objectTag : othTag; } - var objIsObj = objTag == objectTag, - othIsObj = othTag == objectTag, + var objIsObj = objTag == objectTag && !isHostObject(object), + othIsObj = othTag == objectTag && !isHostObject(other), isSameTag = objTag == othTag; - if (isSameTag && !(objIsArr || objIsObj)) { - return equalByTag(object, other, objTag); + if (isSameTag && !objIsObj) { + stack || (stack = new Stack); + return (objIsArr || isTypedArray(object)) + ? equalArrays(object, other, equalFunc, customizer, bitmask, stack) + : equalByTag(object, other, objTag, equalFunc, customizer, bitmask, stack); } - if (!isLoose) { + if (!(bitmask & PARTIAL_COMPARE_FLAG)) { var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__'); if (objIsWrapped || othIsWrapped) { - return equalFunc(objIsWrapped ? object.value() : object, othIsWrapped ? other.value() : other, customizer, isLoose, stackA, stackB); + stack || (stack = new Stack); + return equalFunc(objIsWrapped ? object.value() : object, othIsWrapped ? other.value() : other, customizer, bitmask, stack); } } if (!isSameTag) { return false; } - // Assume cyclic values are equal. - // For more information on detecting circular references see https://es5.github.io/#JO. - stackA || (stackA = []); - stackB || (stackB = []); - - var length = stackA.length; - while (length--) { - if (stackA[length] == object) { - return stackB[length] == other; - } - } - // Add `object` and `other` to the stack of traversed objects. - stackA.push(object); - stackB.push(other); - - var result = (objIsArr ? equalArrays : equalObjects)(object, other, equalFunc, customizer, isLoose, stackA, stackB); - - stackA.pop(); - stackB.pop(); - - return result; + stack || (stack = new Stack); + return equalObjects(object, other, equalFunc, customizer, bitmask, stack); } module.exports = baseIsEqualDeep; -},{"../lang/isArray":59,"../lang/isTypedArray":63,"./equalArrays":42,"./equalByTag":43,"./equalObjects":44}],28:[function(require,module,exports){ -var baseIsEqual = require('./baseIsEqual'), - toObject = require('./toObject'); +},{"./_Stack":11,"./_equalArrays":55,"./_equalByTag":56,"./_equalObjects":57,"./_getTag":61,"./_isHostObject":68,"./isArray":99,"./isTypedArray":109}],37:[function(require,module,exports){ +var Stack = require('./_Stack'), + baseIsEqual = require('./_baseIsEqual'); + +/** Used to compose bitmasks for comparison styles. */ +var UNORDERED_COMPARE_FLAG = 1, + PARTIAL_COMPARE_FLAG = 2; /** - * The base implementation of `_.isMatch` without support for callback - * shorthands and `this` binding. + * The base implementation of `_.isMatch` without support for iteratee shorthands. * * @private * @param {Object} object The object to inspect. - * @param {Array} matchData The propery names, values, and compare flags to match. - * @param {Function} [customizer] The function to customize comparing objects. + * @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, matchData, customizer) { +function baseIsMatch(object, source, matchData, customizer) { var index = matchData.length, length = index, noCustomizer = !customizer; @@ -4154,7 +4035,7 @@ function baseIsMatch(object, matchData, customizer) { if (object == null) { return !length; } - object = toObject(object); + object = Object(object); while (index--) { var data = matchData[index]; if ((noCustomizer && data[2]) @@ -4175,8 +4056,13 @@ function baseIsMatch(object, matchData, customizer) { return false; } } else { - var result = customizer ? customizer(objValue, srcValue, key) : undefined; - if (!(result === undefined ? baseIsEqual(srcValue, objValue, customizer, true) : result)) { + var stack = new Stack, + result = customizer ? customizer(objValue, srcValue, key, object, source, stack) : undefined; + + if (!(result === undefined + ? baseIsEqual(srcValue, objValue, customizer, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG, stack) + : result + )) { return false; } } @@ -4186,13 +4072,62 @@ function baseIsMatch(object, matchData, customizer) { module.exports = baseIsMatch; -},{"./baseIsEqual":26,"./toObject":56}],29:[function(require,module,exports){ -var baseIsMatch = require('./baseIsMatch'), - getMatchData = require('./getMatchData'), - toObject = require('./toObject'); +},{"./_Stack":11,"./_baseIsEqual":35}],38:[function(require,module,exports){ +var baseMatches = require('./_baseMatches'), + baseMatchesProperty = require('./_baseMatchesProperty'), + identity = require('./identity'), + isArray = require('./isArray'), + property = require('./property'); + +/** + * The base implementation of `_.iteratee`. + * + * @private + * @param {*} [value=_.identity] The value to convert to an iteratee. + * @returns {Function} Returns the iteratee. + */ +function baseIteratee(value) { + var type = typeof value; + if (type == 'function') { + return value; + } + if (value == null) { + return identity; + } + if (type == 'object') { + return isArray(value) + ? baseMatchesProperty(value[0], value[1]) + : baseMatches(value); + } + return property(value); +} + +module.exports = baseIteratee; + +},{"./_baseMatches":40,"./_baseMatchesProperty":41,"./identity":97,"./isArray":99,"./property":112}],39:[function(require,module,exports){ +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeKeys = Object.keys; + +/** + * The base implementation of `_.keys` which doesn't skip the constructor + * property of prototypes or treat sparse arrays as dense. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + */ +function baseKeys(object) { + return nativeKeys(Object(object)); +} + +module.exports = baseKeys; + +},{}],40:[function(require,module,exports){ +var baseIsMatch = require('./_baseIsMatch'), + getMatchData = require('./_getMatchData'); /** - * The base implementation of `_.matches` which does not clone `source`. + * The base implementation of `_.matches` which doesn't clone `source`. * * @private * @param {Object} source The object of property values to match. @@ -4208,64 +4143,46 @@ function baseMatches(source) { if (object == null) { return false; } - return object[key] === value && (value !== undefined || (key in toObject(object))); + return object[key] === value && + (value !== undefined || (key in Object(object))); }; } return function(object) { - return baseIsMatch(object, matchData); + return object === source || baseIsMatch(object, source, matchData); }; } module.exports = baseMatches; -},{"./baseIsMatch":28,"./getMatchData":46,"./toObject":56}],30:[function(require,module,exports){ -var baseGet = require('./baseGet'), - baseIsEqual = require('./baseIsEqual'), - baseSlice = require('./baseSlice'), - isArray = require('../lang/isArray'), - isKey = require('./isKey'), - isStrictComparable = require('./isStrictComparable'), - last = require('../array/last'), - toObject = require('./toObject'), - toPath = require('./toPath'); +},{"./_baseIsMatch":37,"./_getMatchData":59}],41:[function(require,module,exports){ +var baseIsEqual = require('./_baseIsEqual'), + get = require('./get'), + hasIn = require('./hasIn'); + +/** Used to compose bitmasks for comparison styles. */ +var UNORDERED_COMPARE_FLAG = 1, + PARTIAL_COMPARE_FLAG = 2; /** - * The base implementation of `_.matchesProperty` which does not clone `srcValue`. + * 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 compare. + * @param {*} srcValue The value to match. * @returns {Function} Returns the new function. */ function baseMatchesProperty(path, srcValue) { - var isArr = isArray(path), - isCommon = isKey(path) && isStrictComparable(srcValue), - pathKey = (path + ''); - - path = toPath(path); return function(object) { - if (object == null) { - return false; - } - var key = pathKey; - object = toObject(object); - if ((isArr || !isCommon) && !(key in object)) { - object = path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1)); - if (object == null) { - return false; - } - key = last(path); - object = toObject(object); - } - return object[key] === srcValue - ? (srcValue !== undefined || (key in object)) - : baseIsEqual(srcValue, object[key], undefined, true); + var objValue = get(object, path); + return (objValue === undefined && objValue === srcValue) + ? hasIn(object, path) + : baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG); }; } module.exports = baseMatchesProperty; -},{"../array/last":7,"../lang/isArray":59,"./baseGet":25,"./baseIsEqual":26,"./baseSlice":35,"./isKey":51,"./isStrictComparable":54,"./toObject":56,"./toPath":57}],31:[function(require,module,exports){ +},{"./_baseIsEqual":35,"./get":95,"./hasIn":96}],42:[function(require,module,exports){ /** * The base implementation of `_.property` without support for deep paths. * @@ -4281,9 +4198,8 @@ function baseProperty(key) { module.exports = baseProperty; -},{}],32:[function(require,module,exports){ -var baseGet = require('./baseGet'), - toPath = require('./toPath'); +},{}],43:[function(require,module,exports){ +var baseGet = require('./_baseGet'); /** * A specialized version of `baseProperty` which supports deep paths. @@ -4293,27 +4209,29 @@ var baseGet = require('./baseGet'), * @returns {Function} Returns the new function. */ function basePropertyDeep(path) { - var pathKey = (path + ''); - path = toPath(path); return function(object) { - return baseGet(object, path, pathKey); + return baseGet(object, path); }; } module.exports = basePropertyDeep; -},{"./baseGet":25,"./toPath":57}],33:[function(require,module,exports){ -var isIndex = require('./isIndex'); +},{"./_baseGet":32}],44:[function(require,module,exports){ +var baseCastPath = require('./_baseCastPath'), + isIndex = require('./_isIndex'), + isKey = require('./_isKey'), + last = require('./last'), + parent = require('./_parent'); -/** Used for native method references. */ +/** Used for built-in method references. */ var arrayProto = Array.prototype; -/** Native method references. */ +/** Built-in value references. */ var splice = arrayProto.splice; /** * The base implementation of `_.pullAt` without support for individual - * index arguments and capturing the removed elements. + * indexes or capturing the removed elements. * * @private * @param {Array} array The array to modify. @@ -4321,12 +4239,27 @@ var splice = arrayProto.splice; * @returns {Array} Returns `array`. */ function basePullAt(array, indexes) { - var length = array ? indexes.length : 0; + var length = array ? indexes.length : 0, + lastIndex = length - 1; + while (length--) { var index = indexes[length]; - if (index != previous && isIndex(index)) { + if (lastIndex == length || index != previous) { var previous = index; - splice.call(array, index, 1); + if (isIndex(index)) { + splice.call(array, index, 1); + } + else if (!isKey(index, array)) { + var path = baseCastPath(index), + object = parent(array, path); + + if (object != null) { + delete object[last(path)]; + } + } + else { + delete array[index]; + } } } return array; @@ -4334,27 +4267,27 @@ function basePullAt(array, indexes) { module.exports = basePullAt; -},{"./isIndex":49}],34:[function(require,module,exports){ -/* Native method references for those with the same name as other `lodash` methods. */ +},{"./_baseCastPath":25,"./_isIndex":69,"./_isKey":71,"./_parent":82,"./last":111}],45:[function(require,module,exports){ +/* Built-in method references for those with the same name as other `lodash` methods. */ var nativeFloor = Math.floor, nativeRandom = Math.random; /** - * The base implementation of `_.random` without support for argument juggling - * and returning floating-point numbers. + * The base implementation of `_.random` without support for returning + * floating-point numbers. * * @private - * @param {number} min The minimum possible value. - * @param {number} max The maximum possible value. + * @param {number} lower The lower bound. + * @param {number} upper The upper bound. * @returns {number} Returns the random number. */ -function baseRandom(min, max) { - return min + nativeFloor(nativeRandom() * (max - min + 1)); +function baseRandom(lower, upper) { + return lower + nativeFloor(nativeRandom() * (upper - lower + 1)); } module.exports = baseRandom; -},{}],35:[function(require,module,exports){ +},{}],46:[function(require,module,exports){ /** * The base implementation of `_.slice` without an iteratee call guard. * @@ -4368,11 +4301,10 @@ function baseSlice(array, start, end) { var index = -1, length = array.length; - start = start == null ? 0 : (+start || 0); if (start < 0) { start = -start > length ? 0 : (length + start); } - end = (end === undefined || end > length) ? length : (+end || 0); + end = end > length ? length : end; if (end < 0) { end += length; } @@ -4388,97 +4320,145 @@ function baseSlice(array, start, end) { module.exports = baseSlice; -},{}],36:[function(require,module,exports){ +},{}],47:[function(require,module,exports){ /** - * Converts `value` to a string if it's not one. An empty string is returned - * for `null` or `undefined` values. + * The base implementation of `_.times` without support for iteratee shorthands + * or max array length checks. * * @private - * @param {*} value The value to process. - * @returns {string} Returns the string. + * @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 baseToString(value) { - return value == null ? '' : (value + ''); +function baseTimes(n, iteratee) { + var index = -1, + result = Array(n); + + while (++index < n) { + result[index] = iteratee(index); + } + return result; } -module.exports = baseToString; +module.exports = baseTimes; -},{}],37:[function(require,module,exports){ -var identity = require('../utility/identity'); +},{}],48:[function(require,module,exports){ +var arrayMap = require('./_arrayMap'); /** - * A specialized version of `baseCallback` which only supports `this` binding - * and specifying the number of arguments to provide to `func`. + * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array + * of key-value pairs for `object` corresponding to the property names of `props`. * * @private - * @param {Function} func The function to bind. - * @param {*} thisArg The `this` binding of `func`. - * @param {number} [argCount] The number of arguments to provide to `func`. - * @returns {Function} Returns the callback. + * @param {Object} object The object to query. + * @param {Array} props The property names to get values for. + * @returns {Object} Returns the new array of key-value pairs. */ -function bindCallback(func, thisArg, argCount) { - if (typeof func != 'function') { - return identity; - } - if (thisArg === undefined) { - return func; - } - switch (argCount) { - case 1: return function(value) { - return func.call(thisArg, value); - }; - case 3: return function(value, index, collection) { - return func.call(thisArg, value, index, collection); - }; - case 4: return function(accumulator, value, index, collection) { - return func.call(thisArg, accumulator, value, index, collection); - }; - case 5: return function(value, other, key, object, source) { - return func.call(thisArg, value, other, key, object, source); - }; +function baseToPairs(object, props) { + return arrayMap(props, function(key) { + return [key, object[key]]; + }); +} + +module.exports = baseToPairs; + +},{"./_arrayMap":17}],49:[function(require,module,exports){ +/** + * Checks if `value` is a global object. + * + * @private + * @param {*} value The value to check. + * @returns {null|Object} Returns `value` if it's a global object, else `null`. + */ +function checkGlobal(value) { + return (value && value.Object === Object) ? value : null; +} + +module.exports = checkGlobal; + +},{}],50:[function(require,module,exports){ +var copyObjectWith = require('./_copyObjectWith'); + +/** + * Copies properties of `source` to `object`. + * + * @private + * @param {Object} source The object to copy properties from. + * @param {Array} props The property names to copy. + * @param {Object} [object={}] The object to copy properties to. + * @returns {Object} Returns `object`. + */ +function copyObject(source, props, object) { + return copyObjectWith(source, props, object); +} + +module.exports = copyObject; + +},{"./_copyObjectWith":51}],51:[function(require,module,exports){ +var assignValue = require('./_assignValue'); + +/** + * This function is like `copyObject` except that it accepts a function to + * customize copied values. + * + * @private + * @param {Object} source The object to copy properties from. + * @param {Array} props The property names 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 copyObjectWith(source, props, object, customizer) { + 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) + : source[key]; + + assignValue(object, key, newValue); } - return function() { - return func.apply(thisArg, arguments); - }; + return object; } -module.exports = bindCallback; +module.exports = copyObjectWith; -},{"../utility/identity":69}],38:[function(require,module,exports){ -var bindCallback = require('./bindCallback'), - isIterateeCall = require('./isIterateeCall'), - restParam = require('../function/restParam'); +},{"./_assignValue":19}],52:[function(require,module,exports){ +var isIterateeCall = require('./_isIterateeCall'), + rest = require('./rest'); /** - * Creates a `_.assign`, `_.defaults`, or `_.merge` function. + * 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 restParam(function(object, sources) { + return rest(function(object, sources) { var index = -1, - length = object == null ? 0 : sources.length, - customizer = length > 2 ? sources[length - 2] : undefined, - guard = length > 2 ? sources[2] : undefined, - thisArg = length > 1 ? sources[length - 1] : undefined; - - if (typeof customizer == 'function') { - customizer = bindCallback(customizer, thisArg, 5); - length -= 2; - } else { - customizer = typeof thisArg == 'function' ? thisArg : undefined; - length -= (customizer ? 1 : 0); - } + length = sources.length, + customizer = length > 1 ? sources[length - 1] : undefined, + guard = length > 2 ? sources[2] : undefined; + + customizer = 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, customizer); + assigner(object, source, index, customizer); } } return object; @@ -4487,10 +4467,8 @@ function createAssigner(assigner) { module.exports = createAssigner; -},{"../function/restParam":12,"./bindCallback":37,"./isIterateeCall":50}],39:[function(require,module,exports){ -var getLength = require('./getLength'), - isLength = require('./isLength'), - toObject = require('./toObject'); +},{"./_isIterateeCall":70,"./rest":115}],53:[function(require,module,exports){ +var isArrayLike = require('./isArrayLike'); /** * Creates a `baseEach` or `baseEachRight` function. @@ -4502,12 +4480,15 @@ var getLength = require('./getLength'), */ function createBaseEach(eachFunc, fromRight) { return function(collection, iteratee) { - var length = collection ? getLength(collection) : 0; - if (!isLength(length)) { + if (collection == null) { + return collection; + } + if (!isArrayLike(collection)) { return eachFunc(collection, iteratee); } - var index = fromRight ? length : -1, - iterable = toObject(collection); + var length = collection.length, + index = fromRight ? length : -1, + iterable = Object(collection); while ((fromRight ? index-- : ++index < length)) { if (iteratee(iterable[index], index, iterable) === false) { @@ -4520,11 +4501,9 @@ function createBaseEach(eachFunc, fromRight) { module.exports = createBaseEach; -},{"./getLength":45,"./isLength":52,"./toObject":56}],40:[function(require,module,exports){ -var toObject = require('./toObject'); - +},{"./isArrayLike":100}],54:[function(require,module,exports){ /** - * Creates a base function for `_.forIn` or `_.forInRight`. + * Creates a base function for methods like `_.forIn`. * * @private * @param {boolean} [fromRight] Specify iterating from right to left. @@ -4532,13 +4511,13 @@ var toObject = require('./toObject'); */ function createBaseFor(fromRight) { return function(object, iteratee, keysFunc) { - var iterable = toObject(object), + var index = -1, + iterable = Object(object), props = keysFunc(object), - length = props.length, - index = fromRight ? length : -1; + length = props.length; - while ((fromRight ? index-- : ++index < length)) { - var key = props[index]; + while (length--) { + var key = props[fromRight ? length : ++index]; if (iteratee(iterable[key], key, iterable) === false) { break; } @@ -4549,35 +4528,12 @@ function createBaseFor(fromRight) { module.exports = createBaseFor; -},{"./toObject":56}],41:[function(require,module,exports){ -var baseCallback = require('./baseCallback'), - baseFind = require('./baseFind'), - baseFindIndex = require('./baseFindIndex'), - isArray = require('../lang/isArray'); - -/** - * Creates a `_.find` or `_.findLast` 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 find function. - */ -function createFind(eachFunc, fromRight) { - return function(collection, predicate, thisArg) { - predicate = baseCallback(predicate, thisArg, 3); - if (isArray(collection)) { - var index = baseFindIndex(collection, predicate, fromRight); - return index > -1 ? collection[index] : undefined; - } - return baseFind(collection, predicate, eachFunc); - }; -} - -module.exports = createFind; +},{}],55:[function(require,module,exports){ +var arraySome = require('./_arraySome'); -},{"../lang/isArray":59,"./baseCallback":17,"./baseFind":21,"./baseFindIndex":22}],42:[function(require,module,exports){ -var arraySome = require('./arraySome'); +/** Used to compose bitmasks for comparison styles. */ +var UNORDERED_COMPARE_FLAG = 1, + PARTIAL_COMPARE_FLAG = 2; /** * A specialized version of `baseIsEqualDeep` for arrays with support for @@ -4587,58 +4543,94 @@ var arraySome = require('./arraySome'); * @param {Array} array The array to compare. * @param {Array} other The other array to compare. * @param {Function} equalFunc The function to determine equivalents of values. - * @param {Function} [customizer] The function to customize comparing arrays. - * @param {boolean} [isLoose] Specify performing partial comparisons. - * @param {Array} [stackA] Tracks traversed `value` objects. - * @param {Array} [stackB] Tracks traversed `other` objects. + * @param {Function} customizer The function to customize comparisons. + * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual` for more details. + * @param {Object} stack Tracks traversed `array` and `other` objects. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`. */ -function equalArrays(array, other, equalFunc, customizer, isLoose, stackA, stackB) { +function equalArrays(array, other, equalFunc, customizer, bitmask, stack) { var index = -1, + isPartial = bitmask & PARTIAL_COMPARE_FLAG, + isUnordered = bitmask & UNORDERED_COMPARE_FLAG, arrLength = array.length, othLength = other.length; - if (arrLength != othLength && !(isLoose && othLength > arrLength)) { + if (arrLength != othLength && !(isPartial && othLength > arrLength)) { return false; } + // Assume cyclic values are equal. + var stacked = stack.get(array); + if (stacked) { + return stacked == other; + } + var result = true; + stack.set(array, other); + // Ignore non-index properties. while (++index < arrLength) { var arrValue = array[index], - othValue = other[index], - result = customizer ? customizer(isLoose ? othValue : arrValue, isLoose ? arrValue : othValue, index) : undefined; + othValue = other[index]; - if (result !== undefined) { - if (result) { + 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; } - return false; + result = false; + break; } // Recursively compare arrays (susceptible to call stack limits). - if (isLoose) { + if (isUnordered) { if (!arraySome(other, function(othValue) { - return arrValue === othValue || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB); + return arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack); })) { - return false; + result = false; + break; } - } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB))) { - return false; + } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack))) { + result = false; + break; } } - return true; + stack['delete'](array); + return result; } module.exports = equalArrays; -},{"./arraySome":14}],43:[function(require,module,exports){ +},{"./_arraySome":18}],56:[function(require,module,exports){ +var Symbol = require('./_Symbol'), + Uint8Array = require('./_Uint8Array'), + equalArrays = require('./_equalArrays'), + mapToArray = require('./_mapToArray'), + setToArray = require('./_setToArray'); + +/** Used to compose bitmasks for comparison styles. */ +var UNORDERED_COMPARE_FLAG = 1, + PARTIAL_COMPARE_FLAG = 2; + /** `Object#toString` result references. */ var boolTag = '[object Boolean]', dateTag = '[object Date]', errorTag = '[object Error]', + mapTag = '[object Map]', numberTag = '[object Number]', regexpTag = '[object RegExp]', - stringTag = '[object String]'; + setTag = '[object Set]', + stringTag = '[object String]', + symbolTag = '[object Symbol]'; -/** +var arrayBufferTag = '[object ArrayBuffer]'; + +/** Used to convert symbols to primitives and strings. */ +var symbolProto = Symbol ? Symbol.prototype : undefined, + symbolValueOf = symbolProto ? symbolProto.valueOf : undefined; + +/** * A specialized version of `baseIsEqualDeep` for comparing objects of * the same `toStringTag`. * @@ -4649,10 +4641,21 @@ var boolTag = '[object Boolean]', * @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 {Function} equalFunc The function to determine equivalents of values. + * @param {Function} customizer The function to customize comparisons. + * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual` for more details. + * @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) { +function equalByTag(object, other, tag, equalFunc, customizer, bitmask, stack) { switch (tag) { + case arrayBufferTag: + if ((object.byteLength != other.byteLength) || + !equalFunc(new Uint8Array(object), new Uint8Array(other))) { + return false; + } + return true; + case boolTag: case dateTag: // Coerce dates and booleans to numbers, dates to milliseconds and booleans @@ -4664,29 +4667,48 @@ function equalByTag(object, other, tag) { case numberTag: // Treat `NaN` vs. `NaN` as equal. - return (object != +object) - ? other != +other - : object == +other; + return (object != +object) ? other != +other : object == +other; case regexpTag: case stringTag: // Coerce regexes to strings and treat strings primitives and string // objects as equal. See https://es5.github.io/#x15.10.6.4 for more details. return object == (other + ''); + + case mapTag: + var convert = mapToArray; + + case setTag: + var isPartial = bitmask & PARTIAL_COMPARE_FLAG; + 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; + } + // Recursively compare objects (susceptible to call stack limits). + return equalArrays(convert(object), convert(other), equalFunc, customizer, bitmask | UNORDERED_COMPARE_FLAG, stack.set(object, other)); + + case symbolTag: + if (symbolValueOf) { + return symbolValueOf.call(object) == symbolValueOf.call(other); + } } return false; } module.exports = equalByTag; -},{}],44:[function(require,module,exports){ -var keys = require('../object/keys'); +},{"./_Symbol":12,"./_Uint8Array":13,"./_equalArrays":55,"./_mapToArray":80,"./_setToArray":84}],57:[function(require,module,exports){ +var baseHas = require('./_baseHas'), + keys = require('./keys'); -/** Used for native method references. */ -var objectProto = Object.prototype; - -/** Used to check objects for own properties. */ -var hasOwnProperty = objectProto.hasOwnProperty; +/** Used to compose bitmasks for comparison styles. */ +var PARTIAL_COMPARE_FLAG = 2; /** * A specialized version of `baseIsEqualDeep` for objects with support for @@ -4696,42 +4718,58 @@ var hasOwnProperty = objectProto.hasOwnProperty; * @param {Object} object The object to compare. * @param {Object} other The other object to compare. * @param {Function} equalFunc The function to determine equivalents of values. - * @param {Function} [customizer] The function to customize comparing values. - * @param {boolean} [isLoose] Specify performing partial comparisons. - * @param {Array} [stackA] Tracks traversed `value` objects. - * @param {Array} [stackB] Tracks traversed `other` objects. + * @param {Function} customizer The function to customize comparisons. + * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual` for more details. + * @param {Object} stack Tracks traversed `object` and `other` objects. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. */ -function equalObjects(object, other, equalFunc, customizer, isLoose, stackA, stackB) { - var objProps = keys(object), +function equalObjects(object, other, equalFunc, customizer, bitmask, stack) { + var isPartial = bitmask & PARTIAL_COMPARE_FLAG, + objProps = keys(object), objLength = objProps.length, othProps = keys(other), othLength = othProps.length; - if (objLength != othLength && !isLoose) { + if (objLength != othLength && !isPartial) { return false; } var index = objLength; while (index--) { var key = objProps[index]; - if (!(isLoose ? key in other : hasOwnProperty.call(other, key))) { + if (!(isPartial ? key in other : baseHas(other, key))) { return false; } } - var skipCtor = isLoose; + // Assume cyclic values are equal. + var stacked = stack.get(object); + if (stacked) { + return stacked == other; + } + var result = true; + stack.set(object, other); + + var skipCtor = isPartial; while (++index < objLength) { key = objProps[index]; var objValue = object[key], - othValue = other[key], - result = customizer ? customizer(isLoose ? othValue : objValue, isLoose? objValue : othValue, key) : undefined; + 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 (!(result === undefined ? equalFunc(objValue, othValue, customizer, isLoose, stackA, stackB) : result)) { - return false; + if (!(compared === undefined + ? (objValue === othValue || equalFunc(objValue, othValue, customizer, bitmask, stack)) + : compared + )) { + result = false; + break; } skipCtor || (skipCtor = key == 'constructor'); } - if (!skipCtor) { + if (result && !skipCtor) { var objCtor = object.constructor, othCtor = other.constructor; @@ -4740,16 +4778,17 @@ function equalObjects(object, other, equalFunc, customizer, isLoose, stackA, sta ('constructor' in object && 'constructor' in other) && !(typeof objCtor == 'function' && objCtor instanceof objCtor && typeof othCtor == 'function' && othCtor instanceof othCtor)) { - return false; + result = false; } } - return true; + stack['delete'](object); + return result; } module.exports = equalObjects; -},{"../object/keys":66}],45:[function(require,module,exports){ -var baseProperty = require('./baseProperty'); +},{"./_baseHas":33,"./keys":110}],58:[function(require,module,exports){ +var baseProperty = require('./_baseProperty'); /** * Gets the "length" property value of `object`. @@ -4765,19 +4804,19 @@ var getLength = baseProperty('length'); module.exports = getLength; -},{"./baseProperty":31}],46:[function(require,module,exports){ -var isStrictComparable = require('./isStrictComparable'), - pairs = require('../object/pairs'); +},{"./_baseProperty":42}],59:[function(require,module,exports){ +var isStrictComparable = require('./_isStrictComparable'), + toPairs = require('./toPairs'); /** - * Gets the propery names, values, and compare flags of `object`. + * 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 = pairs(object), + var result = toPairs(object), length = result.length; while (length--) { @@ -4788,8 +4827,8 @@ function getMatchData(object) { module.exports = getMatchData; -},{"../object/pairs":68,"./isStrictComparable":54}],47:[function(require,module,exports){ -var isNative = require('../lang/isNative'); +},{"./_isStrictComparable":74,"./toPairs":118}],60:[function(require,module,exports){ +var isNative = require('./isNative'); /** * Gets the native function at `key` of `object`. @@ -4800,39 +4839,260 @@ var isNative = require('../lang/isNative'); * @returns {*} Returns the function if it's native, else `undefined`. */ function getNative(object, key) { - var value = object == null ? undefined : object[key]; + var value = object[key]; return isNative(value) ? value : undefined; } module.exports = getNative; -},{"../lang/isNative":61}],48:[function(require,module,exports){ -var getLength = require('./getLength'), - isLength = require('./isLength'); +},{"./isNative":104}],61:[function(require,module,exports){ +var Map = require('./_Map'), + Set = require('./_Set'), + WeakMap = require('./_WeakMap'); + +/** `Object#toString` result references. */ +var mapTag = '[object Map]', + objectTag = '[object Object]', + setTag = '[object Set]', + weakMapTag = '[object WeakMap]'; + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** Used to resolve the decompiled source of functions. */ +var funcToString = Function.prototype.toString; + +/** + * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * of values. + */ +var objectToString = objectProto.toString; + +/** Used to detect maps, sets, and weakmaps. */ +var mapCtorString = Map ? funcToString.call(Map) : '', + setCtorString = Set ? funcToString.call(Set) : '', + weakMapCtorString = WeakMap ? funcToString.call(WeakMap) : ''; /** - * Checks if `value` is array-like. + * Gets the `toStringTag` of `value`. * * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is array-like, else `false`. + * @param {*} value The value to query. + * @returns {string} Returns the `toStringTag`. */ -function isArrayLike(value) { - return value != null && isLength(getLength(value)); +function getTag(value) { + return objectToString.call(value); } -module.exports = isArrayLike; +// Fallback for IE 11 providing `toStringTag` values for maps, sets, and weakmaps. +if ((Map && getTag(new Map) != mapTag) || + (Set && getTag(new Set) != setTag) || + (WeakMap && getTag(new WeakMap) != weakMapTag)) { + getTag = function(value) { + var result = objectToString.call(value), + Ctor = result == objectTag ? value.constructor : null, + ctorString = typeof Ctor == 'function' ? funcToString.call(Ctor) : ''; + + if (ctorString) { + switch (ctorString) { + case mapCtorString: return mapTag; + case setCtorString: return setTag; + case weakMapCtorString: return weakMapTag; + } + } + return result; + }; +} -},{"./getLength":45,"./isLength":52}],49:[function(require,module,exports){ -/** Used to detect unsigned integer values. */ -var reIsUint = /^\d+$/; +module.exports = getTag; + +},{"./_Map":8,"./_Set":10,"./_WeakMap":14}],62:[function(require,module,exports){ +var baseCastPath = require('./_baseCastPath'), + isArguments = require('./isArguments'), + isArray = require('./isArray'), + isIndex = require('./_isIndex'), + isKey = require('./_isKey'), + isLength = require('./isLength'), + isString = require('./isString'), + last = require('./last'), + parent = require('./_parent'); + +/** + * 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) { + if (object == null) { + return false; + } + var result = hasFunc(object, path); + if (!result && !isKey(path)) { + path = baseCastPath(path); + object = parent(object, path); + if (object != null) { + path = last(path); + result = hasFunc(object, path); + } + } + var length = object ? object.length : undefined; + return result || ( + !!length && isLength(length) && isIndex(path, length) && + (isArray(object) || isString(object) || isArguments(object)) + ); +} + +module.exports = hasPath; + +},{"./_baseCastPath":25,"./_isIndex":69,"./_isKey":71,"./_parent":82,"./isArguments":98,"./isArray":99,"./isLength":103,"./isString":107,"./last":111}],63:[function(require,module,exports){ +var hashHas = require('./_hashHas'); + +/** + * Removes `key` and its value from the hash. + * + * @private + * @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(hash, key) { + return hashHas(hash, key) && delete hash[key]; +} + +module.exports = hashDelete; + +},{"./_hashHas":65}],64:[function(require,module,exports){ +var nativeCreate = require('./_nativeCreate'); + +/** Used to stand-in for `undefined` hash values. */ +var HASH_UNDEFINED = '__lodash_hash_undefined__'; + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** + * Gets the hash value for `key`. + * + * @private + * @param {Object} hash The hash to query. + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ +function hashGet(hash, key) { + if (nativeCreate) { + var result = hash[key]; + return result === HASH_UNDEFINED ? undefined : result; + } + return hasOwnProperty.call(hash, key) ? hash[key] : undefined; +} + +module.exports = hashGet; + +},{"./_nativeCreate":81}],65:[function(require,module,exports){ +var nativeCreate = require('./_nativeCreate'); + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** + * Checks if a hash value for `key` exists. + * + * @private + * @param {Object} hash The hash 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 hashHas(hash, key) { + return nativeCreate ? hash[key] !== undefined : hasOwnProperty.call(hash, key); +} + +module.exports = hashHas; + +},{"./_nativeCreate":81}],66:[function(require,module,exports){ +var nativeCreate = require('./_nativeCreate'); + +/** Used to stand-in for `undefined` hash values. */ +var HASH_UNDEFINED = '__lodash_hash_undefined__'; + +/** + * Sets the hash `key` to `value`. + * + * @private + * @param {Object} hash The hash to modify. + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + */ +function hashSet(hash, key, value) { + hash[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value; +} + +module.exports = hashSet; + +},{"./_nativeCreate":81}],67:[function(require,module,exports){ +var baseTimes = require('./_baseTimes'), + isArguments = require('./isArguments'), + isArray = require('./isArray'), + isLength = require('./isLength'), + isString = require('./isString'); /** - * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer) - * of an array-like value. + * Creates an array of index keys for `object` values of arrays, + * `arguments` objects, and strings, otherwise `null` is returned. + * + * @private + * @param {Object} object The object to query. + * @returns {Array|null} Returns index keys, else `null`. */ +function indexKeys(object) { + var length = object ? object.length : undefined; + if (isLength(length) && + (isArray(object) || isString(object) || isArguments(object))) { + return baseTimes(length, String); + } + return null; +} + +module.exports = indexKeys; + +},{"./_baseTimes":47,"./isArguments":98,"./isArray":99,"./isLength":103,"./isString":107}],68:[function(require,module,exports){ +/** + * Checks if `value` is a host object in IE < 9. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a host object, else `false`. + */ +function isHostObject(value) { + // Many host objects are `Object` objects that can coerce to strings + // despite having improperly defined `toString` methods. + var result = false; + if (value != null && typeof value.toString != 'function') { + try { + result = !!(value + ''); + } catch (e) {} + } + return result; +} + +module.exports = isHostObject; + +},{}],69:[function(require,module,exports){ +/** Used as references for various `Number` constants. */ var MAX_SAFE_INTEGER = 9007199254740991; +/** Used to detect unsigned integer values. */ +var reIsUint = /^(?:0|[1-9]\d*)$/; + /** * Checks if `value` is a valid array-like index. * @@ -4849,13 +5109,14 @@ function isIndex(value, length) { module.exports = isIndex; -},{}],50:[function(require,module,exports){ -var isArrayLike = require('./isArrayLike'), - isIndex = require('./isIndex'), - isObject = require('../lang/isObject'); +},{}],70:[function(require,module,exports){ +var eq = require('./eq'), + isArrayLike = require('./isArrayLike'), + isIndex = require('./_isIndex'), + isObject = require('./isObject'); /** - * Checks if the provided arguments are from an iteratee call. + * Checks if the given arguments are from an iteratee call. * * @private * @param {*} value The potential iteratee value argument. @@ -4871,20 +5132,18 @@ function isIterateeCall(value, index, object) { if (type == 'number' ? (isArrayLike(object) && isIndex(index, object.length)) : (type == 'string' && index in object)) { - var other = object[index]; - return value === value ? (value === other) : (other !== other); + return eq(object[index], value); } return false; } module.exports = isIterateeCall; -},{"../lang/isObject":62,"./isArrayLike":48,"./isIndex":49}],51:[function(require,module,exports){ -var isArray = require('../lang/isArray'), - toObject = require('./toObject'); +},{"./_isIndex":69,"./eq":92,"./isArrayLike":100,"./isObject":105}],71:[function(require,module,exports){ +var isArray = require('./isArray'); /** Used to match property names within property paths. */ -var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\n\\]|\\.)*?\1)\]/, +var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/; /** @@ -4896,57 +5155,54 @@ var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\n\\]|\\.)*?\1)\]/, * @returns {boolean} Returns `true` if `value` is a property name, else `false`. */ function isKey(value, object) { - var type = typeof value; - if ((type == 'string' && reIsPlainProp.test(value)) || type == 'number') { + if (typeof value == 'number') { return true; } - if (isArray(value)) { - return false; - } - var result = !reIsDeepProp.test(value); - return result || (object != null && value in toObject(object)); + return !isArray(value) && + (reIsPlainProp.test(value) || !reIsDeepProp.test(value) || + (object != null && value in Object(object))); } module.exports = isKey; -},{"../lang/isArray":59,"./toObject":56}],52:[function(require,module,exports){ -/** - * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer) - * of an array-like value. - */ -var MAX_SAFE_INTEGER = 9007199254740991; - +},{"./isArray":99}],72:[function(require,module,exports){ /** - * Checks if `value` is a valid array-like length. - * - * **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). + * 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 a valid length, else `false`. + * @returns {boolean} Returns `true` if `value` is suitable, else `false`. */ -function isLength(value) { - return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; +function isKeyable(value) { + var type = typeof value; + return type == 'number' || type == 'boolean' || + (type == 'string' && value != '__proto__') || value == null; } -module.exports = isLength; +module.exports = isKeyable; + +},{}],73:[function(require,module,exports){ +/** Used for built-in method references. */ +var objectProto = Object.prototype; -},{}],53:[function(require,module,exports){ /** - * Checks if `value` is object-like. + * Checks if `value` is likely a prototype object. * * @private * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + * @returns {boolean} Returns `true` if `value` is a prototype, else `false`. */ -function isObjectLike(value) { - return !!value && typeof value == 'object'; +function isPrototype(value) { + var Ctor = value && value.constructor, + proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto; + + return value === proto; } -module.exports = isObjectLike; +module.exports = isPrototype; -},{}],54:[function(require,module,exports){ -var isObject = require('../lang/isObject'); +},{}],74:[function(require,module,exports){ +var isObject = require('./isObject'); /** * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. @@ -4962,187 +5218,830 @@ function isStrictComparable(value) { module.exports = isStrictComparable; -},{"../lang/isObject":62}],55:[function(require,module,exports){ -var isArguments = require('../lang/isArguments'), - isArray = require('../lang/isArray'), - isIndex = require('./isIndex'), - isLength = require('./isLength'), - keysIn = require('../object/keysIn'); +},{"./isObject":105}],75:[function(require,module,exports){ +var Hash = require('./_Hash'), + Map = require('./_Map'); -/** Used for native method references. */ -var objectProto = Object.prototype; +/** + * Removes all key-value entries from the map. + * + * @private + * @name clear + * @memberOf MapCache + */ +function mapClear() { + this.__data__ = { + 'hash': new Hash, + 'map': Map ? new Map : [], + 'string': new Hash + }; +} -/** Used to check objects for own properties. */ -var hasOwnProperty = objectProto.hasOwnProperty; +module.exports = mapClear; + +},{"./_Hash":7,"./_Map":8}],76:[function(require,module,exports){ +var Map = require('./_Map'), + assocDelete = require('./_assocDelete'), + hashDelete = require('./_hashDelete'), + isKeyable = require('./_isKeyable'); /** - * A fallback implementation of `Object.keys` which creates an array of the - * own enumerable property names of `object`. + * Removes `key` and its value from the map. * * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - */ -function shimKeys(object) { - var props = keysIn(object), - propsLength = props.length, - length = propsLength && object.length; + * @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 mapDelete(key) { + var data = this.__data__; + if (isKeyable(key)) { + return hashDelete(typeof key == 'string' ? data.string : data.hash, key); + } + return Map ? data.map['delete'](key) : assocDelete(data.map, key); +} - var allowIndexes = !!length && isLength(length) && - (isArray(object) || isArguments(object)); +module.exports = mapDelete; - var index = -1, - result = []; +},{"./_Map":8,"./_assocDelete":20,"./_hashDelete":63,"./_isKeyable":72}],77:[function(require,module,exports){ +var Map = require('./_Map'), + assocGet = require('./_assocGet'), + hashGet = require('./_hashGet'), + isKeyable = require('./_isKeyable'); - while (++index < propsLength) { - var key = props[index]; - if ((allowIndexes && isIndex(key, length)) || hasOwnProperty.call(object, key)) { - result.push(key); - } +/** + * 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 mapGet(key) { + var data = this.__data__; + if (isKeyable(key)) { + return hashGet(typeof key == 'string' ? data.string : data.hash, key); } - return result; + return Map ? data.map.get(key) : assocGet(data.map, key); } -module.exports = shimKeys; +module.exports = mapGet; -},{"../lang/isArguments":58,"../lang/isArray":59,"../object/keysIn":67,"./isIndex":49,"./isLength":52}],56:[function(require,module,exports){ -var isObject = require('../lang/isObject'); +},{"./_Map":8,"./_assocGet":21,"./_hashGet":64,"./_isKeyable":72}],78:[function(require,module,exports){ +var Map = require('./_Map'), + assocHas = require('./_assocHas'), + hashHas = require('./_hashHas'), + isKeyable = require('./_isKeyable'); /** - * Converts `value` to an object if it's not one. + * Checks if a map value for `key` exists. * * @private - * @param {*} value The value to process. - * @returns {Object} Returns the object. - */ -function toObject(value) { - return isObject(value) ? value : Object(value); + * @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 mapHas(key) { + var data = this.__data__; + if (isKeyable(key)) { + return hashHas(typeof key == 'string' ? data.string : data.hash, key); + } + return Map ? data.map.has(key) : assocHas(data.map, key); } -module.exports = toObject; +module.exports = mapHas; -},{"../lang/isObject":62}],57:[function(require,module,exports){ -var baseToString = require('./baseToString'), - isArray = require('../lang/isArray'); +},{"./_Map":8,"./_assocHas":22,"./_hashHas":65,"./_isKeyable":72}],79:[function(require,module,exports){ +var Map = require('./_Map'), + assocSet = require('./_assocSet'), + hashSet = require('./_hashSet'), + isKeyable = require('./_isKeyable'); -/** Used to match property names within property paths. */ -var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\n\\]|\\.)*?)\2)\]/g; +/** + * 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 object. + */ +function mapSet(key, value) { + var data = this.__data__; + if (isKeyable(key)) { + hashSet(typeof key == 'string' ? data.string : data.hash, key, value); + } else if (Map) { + data.map.set(key, value); + } else { + assocSet(data.map, key, value); + } + return this; +} -/** Used to match backslashes in property paths. */ -var reEscapeChar = /\\(\\)?/g; +module.exports = mapSet; +},{"./_Map":8,"./_assocSet":24,"./_hashSet":66,"./_isKeyable":72}],80:[function(require,module,exports){ /** - * Converts `value` to property path array if it's not one. + * Converts `map` to an array. * * @private - * @param {*} value The value to process. - * @returns {Array} Returns the property path array. + * @param {Object} map The map to convert. + * @returns {Array} Returns the converted array. */ -function toPath(value) { - if (isArray(value)) { - return value; - } - var result = []; - baseToString(value).replace(rePropName, function(match, number, quote, string) { - result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); +function mapToArray(map) { + var index = -1, + result = Array(map.size); + + map.forEach(function(value, key) { + result[++index] = [key, value]; }); return result; } -module.exports = toPath; +module.exports = mapToArray; -},{"../lang/isArray":59,"./baseToString":36}],58:[function(require,module,exports){ -var isArrayLike = require('../internal/isArrayLike'), - isObjectLike = require('../internal/isObjectLike'); +},{}],81:[function(require,module,exports){ +var getNative = require('./_getNative'); -/** Used for native method references. */ -var objectProto = Object.prototype; +/* Built-in method references that are verified to be native. */ +var nativeCreate = getNative(Object, 'create'); -/** Used to check objects for own properties. */ -var hasOwnProperty = objectProto.hasOwnProperty; +module.exports = nativeCreate; -/** Native method references. */ -var propertyIsEnumerable = objectProto.propertyIsEnumerable; +},{"./_getNative":60}],82:[function(require,module,exports){ +var baseSlice = require('./_baseSlice'), + get = require('./get'); /** - * Checks if `value` is classified as an `arguments` object. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. - * @example + * Gets the parent value at `path` of `object`. * - * _.isArguments(function() { return arguments; }()); - * // => true - * - * _.isArguments([1, 2, 3]); - * // => false + * @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 isArguments(value) { - return isObjectLike(value) && isArrayLike(value) && - hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee'); +function parent(object, path) { + return path.length == 1 ? object : get(object, baseSlice(path, 0, -1)); } -module.exports = isArguments; +module.exports = parent; -},{"../internal/isArrayLike":48,"../internal/isObjectLike":53}],59:[function(require,module,exports){ -var getNative = require('../internal/getNative'), - isLength = require('../internal/isLength'), - isObjectLike = require('../internal/isObjectLike'); +},{"./_baseSlice":46,"./get":95}],83:[function(require,module,exports){ +(function (global){ +var checkGlobal = require('./_checkGlobal'); -/** `Object#toString` result references. */ -var arrayTag = '[object Array]'; +/** Used to determine if values are of the language type `Object`. */ +var objectTypes = { + 'function': true, + 'object': true +}; -/** Used for native method references. */ -var objectProto = Object.prototype; +/** Detect free variable `exports`. */ +var freeExports = (objectTypes[typeof exports] && exports && !exports.nodeType) + ? exports + : undefined; + +/** Detect free variable `module`. */ +var freeModule = (objectTypes[typeof module] && module && !module.nodeType) + ? module + : undefined; + +/** Detect free variable `global` from Node.js. */ +var freeGlobal = checkGlobal(freeExports && freeModule && typeof global == 'object' && global); + +/** Detect free variable `self`. */ +var freeSelf = checkGlobal(objectTypes[typeof self] && self); + +/** Detect free variable `window`. */ +var freeWindow = checkGlobal(objectTypes[typeof window] && window); + +/** Detect `this` as the global object. */ +var thisGlobal = checkGlobal(objectTypes[typeof this] && this); /** - * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) - * of values. + * Used as a reference to the global object. + * + * The `this` value is used if it's the global object to avoid Greasemonkey's + * restricted `window` object, otherwise the `window` object is used. */ -var objToString = objectProto.toString; +var root = freeGlobal || + ((freeWindow !== (thisGlobal && thisGlobal.window)) && freeWindow) || + freeSelf || thisGlobal || Function('return this')(); -/* Native method references for those with the same name as other `lodash` methods. */ -var nativeIsArray = getNative(Array, 'isArray'); +module.exports = root; +}).call(this,typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"./_checkGlobal":49}],84:[function(require,module,exports){ /** - * Checks if `value` is classified as an `Array` object. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. - * @example - * - * _.isArray([1, 2, 3]); - * // => true + * Converts `set` to an array. * - * _.isArray(function() { return arguments; }()); - * // => false + * @private + * @param {Object} set The set to convert. + * @returns {Array} Returns the converted array. */ -var isArray = nativeIsArray || function(value) { - return isObjectLike(value) && isLength(value.length) && objToString.call(value) == arrayTag; -}; - -module.exports = isArray; +function setToArray(set) { + var index = -1, + result = Array(set.size); -},{"../internal/getNative":47,"../internal/isLength":52,"../internal/isObjectLike":53}],60:[function(require,module,exports){ -var isObject = require('./isObject'); + set.forEach(function(value) { + result[++index] = value; + }); + return result; +} -/** `Object#toString` result references. */ -var funcTag = '[object Function]'; +module.exports = setToArray; -/** Used for native method references. */ +},{}],85:[function(require,module,exports){ +/** + * Removes all key-value entries from the stack. + * + * @private + * @name clear + * @memberOf Stack + */ +function stackClear() { + this.__data__ = { 'array': [], 'map': null }; +} + +module.exports = stackClear; + +},{}],86:[function(require,module,exports){ +var assocDelete = require('./_assocDelete'); + +/** + * 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__, + array = data.array; + + return array ? assocDelete(array, key) : data.map['delete'](key); +} + +module.exports = stackDelete; + +},{"./_assocDelete":20}],87:[function(require,module,exports){ +var assocGet = require('./_assocGet'); + +/** + * 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) { + var data = this.__data__, + array = data.array; + + return array ? assocGet(array, key) : data.map.get(key); +} + +module.exports = stackGet; + +},{"./_assocGet":21}],88:[function(require,module,exports){ +var assocHas = require('./_assocHas'); + +/** + * 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) { + var data = this.__data__, + array = data.array; + + return array ? assocHas(array, key) : data.map.has(key); +} + +module.exports = stackHas; + +},{"./_assocHas":22}],89:[function(require,module,exports){ +var MapCache = require('./_MapCache'), + assocSet = require('./_assocSet'); + +/** Used as the size to enable large array optimizations. */ +var LARGE_ARRAY_SIZE = 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 object. + */ +function stackSet(key, value) { + var data = this.__data__, + array = data.array; + + if (array) { + if (array.length < (LARGE_ARRAY_SIZE - 1)) { + assocSet(array, key, value); + } else { + data.array = null; + data.map = new MapCache(array); + } + } + var map = data.map; + if (map) { + map.set(key, value); + } + return this; +} + +module.exports = stackSet; + +},{"./_MapCache":9,"./_assocSet":24}],90:[function(require,module,exports){ +var toString = require('./toString'); + +/** 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. + */ +function stringToPath(string) { + var result = []; + toString(string).replace(rePropName, function(match, number, quote, string) { + result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); + }); + return result; +} + +module.exports = stringToPath; + +},{"./toString":119}],91:[function(require,module,exports){ +var assignValue = require('./_assignValue'), + copyObject = require('./_copyObject'), + createAssigner = require('./_createAssigner'), + isArrayLike = require('./isArrayLike'), + isPrototype = require('./_isPrototype'), + keys = require('./keys'); + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** Built-in value references. */ +var propertyIsEnumerable = objectProto.propertyIsEnumerable; + +/** Detect if properties shadowing those on `Object.prototype` are non-enumerable. */ +var nonEnumShadows = !propertyIsEnumerable.call({ 'valueOf': 1 }, 'valueOf'); + +/** + * Assigns own enumerable 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 _ + * @category Object + * @param {Object} object The destination object. + * @param {...Object} [sources] The source objects. + * @returns {Object} Returns `object`. + * @example + * + * function Foo() { + * this.c = 3; + * } + * + * function Bar() { + * this.e = 5; + * } + * + * Foo.prototype.d = 4; + * Bar.prototype.f = 6; + * + * _.assign({ 'a': 1 }, new Foo, new Bar); + * // => { 'a': 1, 'c': 3, 'e': 5 } + */ +var assign = createAssigner(function(object, source) { + if (nonEnumShadows || isPrototype(source) || isArrayLike(source)) { + copyObject(source, keys(source), object); + return; + } + for (var key in source) { + if (hasOwnProperty.call(source, key)) { + assignValue(object, key, source[key]); + } + } +}); + +module.exports = assign; + +},{"./_assignValue":19,"./_copyObject":50,"./_createAssigner":52,"./_isPrototype":73,"./isArrayLike":100,"./keys":110}],92:[function(require,module,exports){ +/** + * Performs a [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * comparison between two values to determine if they are equivalent. + * + * @static + * @memberOf _ + * @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 = { 'user': 'fred' }; + * var other = { 'user': 'fred' }; + * + * _.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); +} + +module.exports = eq; + +},{}],93:[function(require,module,exports){ +var arrayFilter = require('./_arrayFilter'), + baseFilter = require('./_baseFilter'), + baseIteratee = require('./_baseIteratee'), + isArray = require('./isArray'); + +/** + * 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). + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. + * @returns {Array} Returns the new filtered array. + * @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'] + */ +function filter(collection, predicate) { + var func = isArray(collection) ? arrayFilter : baseFilter; + return func(collection, baseIteratee(predicate, 3)); +} + +module.exports = filter; + +},{"./_arrayFilter":16,"./_baseFilter":27,"./_baseIteratee":38,"./isArray":99}],94:[function(require,module,exports){ +var baseEach = require('./_baseEach'), + baseFind = require('./_baseFind'), + baseFindIndex = require('./_baseFindIndex'), + baseIteratee = require('./_baseIteratee'), + isArray = require('./isArray'); + +/** + * 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 _ + * @category Collection + * @param {Array|Object} collection The collection to search. + * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. + * @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' + */ +function find(collection, predicate) { + predicate = baseIteratee(predicate, 3); + if (isArray(collection)) { + var index = baseFindIndex(collection, predicate); + return index > -1 ? collection[index] : undefined; + } + return baseFind(collection, predicate, baseEach); +} + +module.exports = find; + +},{"./_baseEach":26,"./_baseFind":28,"./_baseFindIndex":29,"./_baseIteratee":38,"./isArray":99}],95:[function(require,module,exports){ +var baseGet = require('./_baseGet'); + +/** + * Gets the value at `path` of `object`. If the resolved value is + * `undefined` the `defaultValue` is used in its place. + * + * @static + * @memberOf _ + * @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 if the resolved value is `undefined`. + * @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; +} + +module.exports = get; + +},{"./_baseGet":32}],96:[function(require,module,exports){ +var baseHasIn = require('./_baseHasIn'), + hasPath = require('./_hasPath'); + +/** + * Checks if `path` is a direct or inherited property of `object`. + * + * @static + * @memberOf _ + * @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': _.create({ 'c': 3 }) }) }); + * + * _.hasIn(object, 'a'); + * // => true + * + * _.hasIn(object, 'a.b.c'); + * // => true + * + * _.hasIn(object, ['a', 'b', 'c']); + * // => true + * + * _.hasIn(object, 'b'); + * // => false + */ +function hasIn(object, path) { + return hasPath(object, path, baseHasIn); +} + +module.exports = hasIn; + +},{"./_baseHasIn":34,"./_hasPath":62}],97:[function(require,module,exports){ +/** + * This method returns the first argument given to it. + * + * @static + * @memberOf _ + * @category Util + * @param {*} value Any value. + * @returns {*} Returns `value`. + * @example + * + * var object = { 'user': 'fred' }; + * + * _.identity(object) === object; + * // => true + */ +function identity(value) { + return value; +} + +module.exports = identity; + +},{}],98:[function(require,module,exports){ +var isArrayLikeObject = require('./isArrayLikeObject'); + +/** `Object#toString` result references. */ +var argsTag = '[object Arguments]'; + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** + * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * of values. + */ +var objectToString = objectProto.toString; + +/** Built-in value references. */ +var propertyIsEnumerable = objectProto.propertyIsEnumerable; + +/** + * Checks if `value` is likely an `arguments` object. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @example + * + * _.isArguments(function() { return arguments; }()); + * // => true + * + * _.isArguments([1, 2, 3]); + * // => false + */ +function isArguments(value) { + // Safari 8.1 incorrectly makes `arguments.callee` enumerable in strict mode. + return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') && + (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag); +} + +module.exports = isArguments; + +},{"./isArrayLikeObject":101}],99:[function(require,module,exports){ +/** + * Checks if `value` is classified as an `Array` object. + * + * @static + * @memberOf _ + * @type {Function} + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @example + * + * _.isArray([1, 2, 3]); + * // => true + * + * _.isArray(document.body.children); + * // => false + * + * _.isArray('abc'); + * // => false + * + * _.isArray(_.noop); + * // => false + */ +var isArray = Array.isArray; + +module.exports = isArray; + +},{}],100:[function(require,module,exports){ +var getLength = require('./_getLength'), + isFunction = require('./isFunction'), + isLength = require('./isLength'); + +/** + * 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 _ + * @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(getLength(value)) && !isFunction(value); +} + +module.exports = isArrayLike; + +},{"./_getLength":58,"./isFunction":102,"./isLength":103}],101:[function(require,module,exports){ +var isArrayLike = require('./isArrayLike'), + isObjectLike = require('./isObjectLike'); + +/** + * This method is like `_.isArrayLike` except that it also checks if `value` + * is an object. + * + * @static + * @memberOf _ + * @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); +} + +module.exports = isArrayLikeObject; + +},{"./isArrayLike":100,"./isObjectLike":106}],102:[function(require,module,exports){ +var isObject = require('./isObject'); + +/** `Object#toString` result references. */ +var funcTag = '[object Function]', + genTag = '[object GeneratorFunction]'; + +/** Used for built-in method references. */ var objectProto = Object.prototype; /** * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) * of values. */ -var objToString = objectProto.toString; +var objectToString = objectProto.toString; /** * Checks if `value` is classified as a `Function` object. @@ -5162,32 +6061,72 @@ var objToString = objectProto.toString; */ function isFunction(value) { // The use of `Object#toString` avoids issues with the `typeof` operator - // in older versions of Chrome and Safari which return 'function' for regexes - // and Safari 8 which returns 'object' for typed array constructors. - return isObject(value) && objToString.call(value) == funcTag; + // in Safari 8 which returns 'object' for typed array and weak map constructors, + // and PhantomJS 1.9 which returns 'function' for `NodeList` instances. + var tag = isObject(value) ? objectToString.call(value) : ''; + return tag == funcTag || tag == genTag; } module.exports = isFunction; -},{"./isObject":62}],61:[function(require,module,exports){ +},{"./isObject":105}],103:[function(require,module,exports){ +/** Used as references for various `Number` constants. */ +var MAX_SAFE_INTEGER = 9007199254740991; + +/** + * Checks if `value` is a valid array-like length. + * + * **Note:** This function is loosely based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). + * + * @static + * @memberOf _ + * @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; +} + +module.exports = isLength; + +},{}],104:[function(require,module,exports){ var isFunction = require('./isFunction'), - isObjectLike = require('../internal/isObjectLike'); + isHostObject = require('./_isHostObject'), + isObjectLike = require('./isObjectLike'); + +/** Used to match `RegExp` [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns). */ +var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; /** Used to detect host constructors (Safari > 5). */ var reIsHostCtor = /^\[object .+?Constructor\]$/; -/** Used for native method references. */ +/** Used for built-in method references. */ var objectProto = Object.prototype; /** Used to resolve the decompiled source of functions. */ -var fnToString = Function.prototype.toString; +var funcToString = Function.prototype.toString; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** Used to detect if a method is native. */ var reIsNative = RegExp('^' + - fnToString.call(hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g, '\\$&') + funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' ); @@ -5212,14 +6151,15 @@ function isNative(value) { return false; } if (isFunction(value)) { - return reIsNative.test(fnToString.call(value)); + return reIsNative.test(funcToString.call(value)); } - return isObjectLike(value) && reIsHostCtor.test(value); + return isObjectLike(value) && + (isHostObject(value) ? reIsNative : reIsHostCtor).test(value); } module.exports = isNative; -},{"../internal/isObjectLike":53,"./isFunction":60}],62:[function(require,module,exports){ +},{"./_isHostObject":68,"./isFunction":102,"./isObjectLike":106}],105:[function(require,module,exports){ /** * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) @@ -5237,21 +6177,129 @@ module.exports = isNative; * _.isObject([1, 2, 3]); * // => true * - * _.isObject(1); + * _.isObject(_.noop); + * // => true + * + * _.isObject(null); * // => false */ function isObject(value) { - // Avoid a V8 JIT bug in Chrome 19-20. - // See https://code.google.com/p/v8/issues/detail?id=2291 for more details. var type = typeof value; return !!value && (type == 'object' || type == 'function'); } module.exports = isObject; -},{}],63:[function(require,module,exports){ -var isLength = require('../internal/isLength'), - isObjectLike = require('../internal/isObjectLike'); +},{}],106:[function(require,module,exports){ +/** + * 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 _ + * @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 && typeof value == 'object'; +} + +module.exports = isObjectLike; + +},{}],107:[function(require,module,exports){ +var isArray = require('./isArray'), + isObjectLike = require('./isObjectLike'); + +/** `Object#toString` result references. */ +var stringTag = '[object String]'; + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** + * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * of values. + */ +var objectToString = objectProto.toString; + +/** + * Checks if `value` is classified as a `String` primitive or object. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @example + * + * _.isString('abc'); + * // => true + * + * _.isString(1); + * // => false + */ +function isString(value) { + return typeof value == 'string' || + (!isArray(value) && isObjectLike(value) && objectToString.call(value) == stringTag); +} + +module.exports = isString; + +},{"./isArray":99,"./isObjectLike":106}],108:[function(require,module,exports){ +var isObjectLike = require('./isObjectLike'); + +/** `Object#toString` result references. */ +var symbolTag = '[object Symbol]'; + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** + * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * of values. + */ +var objectToString = objectProto.toString; + +/** + * Checks if `value` is classified as a `Symbol` primitive or object. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @example + * + * _.isSymbol(Symbol.iterator); + * // => true + * + * _.isSymbol('abc'); + * // => false + */ +function isSymbol(value) { + return typeof value == 'symbol' || + (isObjectLike(value) && objectToString.call(value) == symbolTag); +} + +module.exports = isSymbol; + +},{"./isObjectLike":106}],109:[function(require,module,exports){ +var isLength = require('./isLength'), + isObjectLike = require('./isObjectLike'); /** `Object#toString` result references. */ var argsTag = '[object Arguments]', @@ -5294,56 +6342,174 @@ typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false; -/** Used for native method references. */ -var objectProto = Object.prototype; +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** + * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * of values. + */ +var objectToString = objectProto.toString; + +/** + * Checks if `value` is classified as a typed array. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @example + * + * _.isTypedArray(new Uint8Array); + * // => true + * + * _.isTypedArray([]); + * // => false + */ +function isTypedArray(value) { + return isObjectLike(value) && + isLength(value.length) && !!typedArrayTags[objectToString.call(value)]; +} + +module.exports = isTypedArray; + +},{"./isLength":103,"./isObjectLike":106}],110:[function(require,module,exports){ +var baseHas = require('./_baseHas'), + baseKeys = require('./_baseKeys'), + indexKeys = require('./_indexKeys'), + isArrayLike = require('./isArrayLike'), + isIndex = require('./_isIndex'), + isPrototype = require('./_isPrototype'); + +/** + * 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/6.0/#sec-object.keys) + * for more details. + * + * @static + * @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) { + var isProto = isPrototype(object); + if (!(isProto || isArrayLike(object))) { + return baseKeys(object); + } + var indexes = indexKeys(object), + skipIndexes = !!indexes, + result = indexes || [], + length = result.length; + + for (var key in object) { + if (baseHas(object, key) && + !(skipIndexes && (key == 'length' || isIndex(key, length))) && + !(isProto && key == 'constructor')) { + result.push(key); + } + } + return result; +} + +module.exports = keys; +},{"./_baseHas":33,"./_baseKeys":39,"./_indexKeys":67,"./_isIndex":69,"./_isPrototype":73,"./isArrayLike":100}],111:[function(require,module,exports){ /** - * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) - * of values. + * Gets the last element of `array`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to query. + * @returns {*} Returns the last element of `array`. + * @example + * + * _.last([1, 2, 3]); + * // => 3 */ -var objToString = objectProto.toString; +function last(array) { + var length = array ? array.length : 0; + return length ? array[length - 1] : undefined; +} + +module.exports = last; + +},{}],112:[function(require,module,exports){ +var baseProperty = require('./_baseProperty'), + basePropertyDeep = require('./_basePropertyDeep'), + isKey = require('./_isKey'); /** - * Checks if `value` is classified as a typed array. + * Creates a function that returns the value at `path` of a given object. * * @static * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @category Util + * @param {Array|string} path The path of the property to get. + * @returns {Function} Returns the new function. * @example * - * _.isTypedArray(new Uint8Array); - * // => true + * var objects = [ + * { 'a': { 'b': { 'c': 2 } } }, + * { 'a': { 'b': { 'c': 1 } } } + * ]; * - * _.isTypedArray([]); - * // => false + * _.map(objects, _.property('a.b.c')); + * // => [2, 1] + * + * _.map(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c'); + * // => [1, 2] */ -function isTypedArray(value) { - return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[objToString.call(value)]; +function property(path) { + return isKey(path) ? baseProperty(path) : basePropertyDeep(path); } -module.exports = isTypedArray; +module.exports = property; + +},{"./_baseProperty":42,"./_basePropertyDeep":43,"./_isKey":71}],113:[function(require,module,exports){ +var baseRandom = require('./_baseRandom'), + isIterateeCall = require('./_isIterateeCall'), + toNumber = require('./toNumber'); -},{"../internal/isLength":52,"../internal/isObjectLike":53}],64:[function(require,module,exports){ -var baseRandom = require('../internal/baseRandom'), - isIterateeCall = require('../internal/isIterateeCall'); +/** Built-in method references without a dependency on `root`. */ +var freeParseFloat = parseFloat; -/* Native method references for those with the same name as other `lodash` methods. */ +/* 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 `min` and `max` (inclusive). If only one - * argument is provided a number between `0` and the given number is returned. - * If `floating` is `true`, or either `min` or `max` are floats, a floating-point - * number is returned instead of an integer. + * 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 _ * @category Number - * @param {number} [min=0] The minimum possible value. - * @param {number} [max=1] The maximum possible value. + * @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 @@ -5360,303 +6526,363 @@ var nativeMin = Math.min, * _.random(1.2, 5.2); * // => a floating-point number between 1.2 and 5.2 */ -function random(min, max, floating) { - if (floating && isIterateeCall(min, max, floating)) { - max = floating = undefined; +function random(lower, upper, floating) { + if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) { + upper = floating = undefined; } - var noMin = min == null, - noMax = max == null; - - if (floating == null) { - if (noMax && typeof min == 'boolean') { - floating = min; - min = 1; + if (floating === undefined) { + if (typeof upper == 'boolean') { + floating = upper; + upper = undefined; } - else if (typeof max == 'boolean') { - floating = max; - noMax = true; + else if (typeof lower == 'boolean') { + floating = lower; + lower = undefined; } } - if (noMin && noMax) { - max = 1; - noMax = false; + if (lower === undefined && upper === undefined) { + lower = 0; + upper = 1; } - min = +min || 0; - if (noMax) { - max = min; - min = 0; - } else { - max = +max || 0; + else { + lower = toNumber(lower) || 0; + if (upper === undefined) { + upper = lower; + lower = 0; + } else { + upper = toNumber(upper) || 0; + } + } + if (lower > upper) { + var temp = lower; + lower = upper; + upper = temp; } - if (floating || min % 1 || max % 1) { + if (floating || lower % 1 || upper % 1) { var rand = nativeRandom(); - return nativeMin(min + (rand * (max - min + parseFloat('1e-' + ((rand + '').length - 1)))), max); + return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper); } - return baseRandom(min, max); + return baseRandom(lower, upper); } module.exports = random; -},{"../internal/baseRandom":34,"../internal/isIterateeCall":50}],65:[function(require,module,exports){ -var assignWith = require('../internal/assignWith'), - baseAssign = require('../internal/baseAssign'), - createAssigner = require('../internal/createAssigner'); +},{"./_baseRandom":45,"./_isIterateeCall":70,"./toNumber":117}],114:[function(require,module,exports){ +var baseIteratee = require('./_baseIteratee'), + basePullAt = require('./_basePullAt'); /** - * Assigns own enumerable properties of source object(s) to the destination - * object. Subsequent sources overwrite property assignments of previous sources. - * If `customizer` is provided it's invoked to produce the assigned values. - * The `customizer` is bound to `thisArg` and invoked with five arguments: - * (objectValue, sourceValue, key, object, source). + * Removes all elements from `array` that `predicate` returns truthy for + * and returns an array of the removed elements. The predicate is invoked + * with three arguments: (value, index, array). * - * **Note:** This method mutates `object` and is based on - * [`Object.assign`](http://ecma-international.org/ecma-262/6.0/#sec-object.assign). + * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull` + * to pull elements from an array by value. * * @static * @memberOf _ - * @alias extend - * @category Object - * @param {Object} object The destination object. - * @param {...Object} [sources] The source objects. - * @param {Function} [customizer] The function to customize assigned values. - * @param {*} [thisArg] The `this` binding of `customizer`. - * @returns {Object} Returns `object`. + * @category Array + * @param {Array} array The array to modify. + * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. + * @returns {Array} Returns the new array of removed elements. * @example * - * _.assign({ 'user': 'barney' }, { 'age': 40 }, { 'user': 'fred' }); - * // => { 'user': 'fred', 'age': 40 } - * - * // using a customizer callback - * var defaults = _.partialRight(_.assign, function(value, other) { - * return _.isUndefined(value) ? other : value; + * var array = [1, 2, 3, 4]; + * var evens = _.remove(array, function(n) { + * return n % 2 == 0; * }); * - * defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred' }); - * // => { 'user': 'barney', 'age': 36 } + * console.log(array); + * // => [1, 3] + * + * console.log(evens); + * // => [2, 4] */ -var assign = createAssigner(function(object, source, customizer) { - return customizer - ? assignWith(object, source, customizer) - : baseAssign(object, source); -}); +function remove(array, predicate) { + var result = []; + if (!(array && array.length)) { + return result; + } + var index = -1, + indexes = [], + length = array.length; -module.exports = assign; + predicate = baseIteratee(predicate, 3); + while (++index < length) { + var value = array[index]; + if (predicate(value, index, array)) { + result.push(value); + indexes.push(index); + } + } + basePullAt(array, indexes); + return result; +} + +module.exports = remove; -},{"../internal/assignWith":15,"../internal/baseAssign":16,"../internal/createAssigner":38}],66:[function(require,module,exports){ -var getNative = require('../internal/getNative'), - isArrayLike = require('../internal/isArrayLike'), - isObject = require('../lang/isObject'), - shimKeys = require('../internal/shimKeys'); +},{"./_baseIteratee":38,"./_basePullAt":44}],115:[function(require,module,exports){ +var apply = require('./_apply'), + toInteger = require('./toInteger'); -/* Native method references for those with the same name as other `lodash` methods. */ -var nativeKeys = getNative(Object, 'keys'); +/** Used as the `TypeError` message for "Functions" methods. */ +var FUNC_ERROR_TEXT = 'Expected a function'; + +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeMax = Math.max; /** - * Creates an array of the own enumerable property names of `object`. + * Creates a function that invokes `func` with the `this` binding of the + * created function and arguments from `start` and beyond provided as an array. * - * **Note:** Non-object values are coerced to objects. See the - * [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys) - * for more details. + * **Note:** This method is based on the [rest parameter](https://mdn.io/rest_parameters). * * @static * @memberOf _ - * @category Object - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. + * @category Function + * @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. * @example * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.keys(new Foo); - * // => ['a', 'b'] (iteration order is not guaranteed) + * var say = _.rest(function(what, names) { + * return what + ' ' + _.initial(names).join(', ') + + * (_.size(names) > 1 ? ', & ' : '') + _.last(names); + * }); * - * _.keys('hi'); - * // => ['0', '1'] + * say('hello', 'fred', 'barney', 'pebbles'); + * // => 'hello fred, barney, & pebbles' */ -var keys = !nativeKeys ? shimKeys : function(object) { - var Ctor = object == null ? undefined : object.constructor; - if ((typeof Ctor == 'function' && Ctor.prototype === object) || - (typeof object != 'function' && isArrayLike(object))) { - return shimKeys(object); +function rest(func, start) { + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); } - return isObject(object) ? nativeKeys(object) : []; -}; + start = nativeMax(start === undefined ? (func.length - 1) : toInteger(start), 0); + return function() { + var args = arguments, + index = -1, + length = nativeMax(args.length - start, 0), + array = Array(length); -module.exports = keys; + while (++index < length) { + array[index] = args[start + index]; + } + switch (start) { + case 0: return func.call(this, array); + case 1: return func.call(this, args[0], array); + case 2: return func.call(this, args[0], args[1], array); + } + var otherArgs = Array(start + 1); + index = -1; + while (++index < start) { + otherArgs[index] = args[index]; + } + otherArgs[start] = array; + return apply(func, this, otherArgs); + }; +} -},{"../internal/getNative":47,"../internal/isArrayLike":48,"../internal/shimKeys":55,"../lang/isObject":62}],67:[function(require,module,exports){ -var isArguments = require('../lang/isArguments'), - isArray = require('../lang/isArray'), - isIndex = require('../internal/isIndex'), - isLength = require('../internal/isLength'), - isObject = require('../lang/isObject'); +module.exports = rest; -/** Used for native method references. */ -var objectProto = Object.prototype; +},{"./_apply":15,"./toInteger":116}],116:[function(require,module,exports){ +var toNumber = require('./toNumber'); -/** Used to check objects for own properties. */ -var hasOwnProperty = objectProto.hasOwnProperty; +/** Used as references for various `Number` constants. */ +var INFINITY = 1 / 0, + MAX_INTEGER = 1.7976931348623157e+308; /** - * Creates an array of the own and inherited enumerable property names of `object`. + * Converts `value` to an integer. * - * **Note:** Non-object values are coerced to objects. + * **Note:** This function is loosely based on [`ToInteger`](http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger). * * @static * @memberOf _ - * @category Object - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. + * @category Lang + * @param {*} value The value to convert. + * @returns {number} Returns the converted integer. * @example * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } + * _.toInteger(3); + * // => 3 * - * Foo.prototype.c = 3; + * _.toInteger(Number.MIN_VALUE); + * // => 0 + * + * _.toInteger(Infinity); + * // => 1.7976931348623157e+308 * - * _.keysIn(new Foo); - * // => ['a', 'b', 'c'] (iteration order is not guaranteed) + * _.toInteger('3'); + * // => 3 */ -function keysIn(object) { - if (object == null) { - return []; +function toInteger(value) { + if (!value) { + return value === 0 ? value : 0; } - if (!isObject(object)) { - object = Object(object); + value = toNumber(value); + if (value === INFINITY || value === -INFINITY) { + var sign = (value < 0 ? -1 : 1); + return sign * MAX_INTEGER; } - var length = object.length; - length = (length && isLength(length) && - (isArray(object) || isArguments(object)) && length) || 0; + var remainder = value % 1; + return value === value ? (remainder ? value - remainder : value) : 0; +} - var Ctor = object.constructor, - index = -1, - isProto = typeof Ctor == 'function' && Ctor.prototype === object, - result = Array(length), - skipIndexes = length > 0; +module.exports = toInteger; - while (++index < length) { - result[index] = (index + ''); - } - for (var key in object) { - if (!(skipIndexes && isIndex(key, length)) && - !(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) { - result.push(key); - } - } - return result; -} +},{"./toNumber":117}],117:[function(require,module,exports){ +var isFunction = require('./isFunction'), + isObject = require('./isObject'); -module.exports = keysIn; +/** Used as references for various `Number` constants. */ +var NAN = 0 / 0; -},{"../internal/isIndex":49,"../internal/isLength":52,"../lang/isArguments":58,"../lang/isArray":59,"../lang/isObject":62}],68:[function(require,module,exports){ -var keys = require('./keys'), - toObject = require('../internal/toObject'); +/** Used to match leading and trailing whitespace. */ +var reTrim = /^\s+|\s+$/g; + +/** 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; /** - * Creates a two dimensional array of the key-value pairs for `object`, - * e.g. `[[key1, value1], [key2, value2]]`. + * Converts `value` to a number. * * @static * @memberOf _ - * @category Object - * @param {Object} object The object to query. - * @returns {Array} Returns the new array of key-value pairs. + * @category Lang + * @param {*} value The value to process. + * @returns {number} Returns the number. * @example * - * _.pairs({ 'barney': 36, 'fred': 40 }); - * // => [['barney', 36], ['fred', 40]] (iteration order is not guaranteed) + * _.toNumber(3); + * // => 3 + * + * _.toNumber(Number.MIN_VALUE); + * // => 5e-324 + * + * _.toNumber(Infinity); + * // => Infinity + * + * _.toNumber('3'); + * // => 3 */ -function pairs(object) { - object = toObject(object); - - var index = -1, - props = keys(object), - length = props.length, - result = Array(length); - - while (++index < length) { - var key = props[index]; - result[index] = [key, object[key]]; +function toNumber(value) { + if (isObject(value)) { + var other = isFunction(value.valueOf) ? value.valueOf() : value; + value = isObject(other) ? (other + '') : other; } - return result; + if (typeof value != 'string') { + return value === 0 ? value : +value; + } + value = value.replace(reTrim, ''); + var isBinary = reIsBinary.test(value); + return (isBinary || reIsOctal.test(value)) + ? freeParseInt(value.slice(2), isBinary ? 2 : 8) + : (reIsBadHex.test(value) ? NAN : +value); } -module.exports = pairs; +module.exports = toNumber; + +},{"./isFunction":102,"./isObject":105}],118:[function(require,module,exports){ +var baseToPairs = require('./_baseToPairs'), + keys = require('./keys'); -},{"../internal/toObject":56,"./keys":66}],69:[function(require,module,exports){ /** - * This method returns the first argument provided to it. + * Creates an array of own enumerable key-value pairs for `object` which + * can be consumed by `_.fromPairs`. * * @static * @memberOf _ - * @category Utility - * @param {*} value Any value. - * @returns {*} Returns `value`. + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the new array of key-value pairs. * @example * - * var object = { 'user': 'fred' }; + * function Foo() { + * this.a = 1; + * this.b = 2; + * } * - * _.identity(object) === object; - * // => true + * Foo.prototype.c = 3; + * + * _.toPairs(new Foo); + * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed) */ -function identity(value) { - return value; +function toPairs(object) { + return baseToPairs(object, keys(object)); } -module.exports = identity; +module.exports = toPairs; -},{}],70:[function(require,module,exports){ -var baseProperty = require('../internal/baseProperty'), - basePropertyDeep = require('../internal/basePropertyDeep'), - isKey = require('../internal/isKey'); +},{"./_baseToPairs":48,"./keys":110}],119:[function(require,module,exports){ +var Symbol = require('./_Symbol'), + isSymbol = require('./isSymbol'); + +/** Used as references for various `Number` constants. */ +var INFINITY = 1 / 0; + +/** Used to convert symbols to primitives and strings. */ +var symbolProto = Symbol ? Symbol.prototype : undefined, + symbolToString = symbolProto ? symbolProto.toString : undefined; /** - * Creates a function that returns the property value at `path` on a - * given object. + * Converts `value` to a string if it's not one. An empty string is returned + * for `null` and `undefined` values. The sign of `-0` is preserved. * * @static * @memberOf _ - * @category Utility - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. + * @category Lang + * @param {*} value The value to process. + * @returns {string} Returns the string. * @example * - * var objects = [ - * { 'a': { 'b': { 'c': 2 } } }, - * { 'a': { 'b': { 'c': 1 } } } - * ]; + * _.toString(null); + * // => '' * - * _.map(objects, _.property('a.b.c')); - * // => [2, 1] + * _.toString(-0); + * // => '-0' * - * _.pluck(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c'); - * // => [1, 2] + * _.toString([1, 2, 3]); + * // => '1,2,3' */ -function property(path) { - return isKey(path) ? baseProperty(path) : basePropertyDeep(path); +function toString(value) { + // Exit early for strings to avoid a performance hit in some environments. + if (typeof value == 'string') { + return value; + } + if (value == null) { + return ''; + } + if (isSymbol(value)) { + return symbolToString ? symbolToString.call(value) : ''; + } + var result = (value + ''); + return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; } -module.exports = property; +module.exports = toString; -},{"../internal/baseProperty":31,"../internal/basePropertyDeep":32,"../internal/isKey":51}],71:[function(require,module,exports){ +},{"./_Symbol":12,"./isSymbol":108}],120:[function(require,module,exports){ +(function (global){ var now = require('performance-now') - , global = typeof window === 'undefined' ? {} : window + , root = typeof window === 'undefined' ? global : window , vendors = ['moz', 'webkit'] , suffix = 'AnimationFrame' - , raf = global['request' + suffix] - , caf = global['cancel' + suffix] || global['cancelRequest' + suffix] + , raf = root['request' + suffix] + , caf = root['cancel' + suffix] || root['cancelRequest' + suffix] -for(var i = 0; i < vendors.length && !raf; i++) { - raf = global[vendors[i] + 'Request' + suffix] - caf = global[vendors[i] + 'Cancel' + suffix] - || global[vendors[i] + 'CancelRequest' + suffix] +for(var i = 0; !raf && i < vendors.length; i++) { + raf = root[vendors[i] + 'Request' + suffix] + caf = root[vendors[i] + 'Cancel' + suffix] + || root[vendors[i] + 'CancelRequest' + suffix] } // Some versions of FF have rAF but not cAF @@ -5709,13 +6935,18 @@ module.exports = function(fn) { // Wrap in a new function to prevent // `cancel` potentially being assigned // to the native rAF function - return raf.call(global, fn) + return raf.call(root, fn) } module.exports.cancel = function() { - caf.apply(global, arguments) + caf.apply(root, arguments) +} +module.exports.polyfill = function() { + root.requestAnimationFrame = raf + root.cancelAnimationFrame = caf } -},{"performance-now":72}],72:[function(require,module,exports){ +}).call(this,typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"performance-now":121}],121:[function(require,module,exports){ (function (process){ // Generated by CoffeeScript 1.7.1 (function() { @@ -5751,7 +6982,7 @@ module.exports.cancel = function() { }).call(this); }).call(this,require("1YiZ5S")) -},{"1YiZ5S":1}],73:[function(require,module,exports){ +},{"1YiZ5S":1}],122:[function(require,module,exports){ (function (process){ // Rebound // ======= @@ -6907,7 +8138,7 @@ module.exports.cancel = function() { */ }).call(this,require("1YiZ5S")) -},{"1YiZ5S":1}],74:[function(require,module,exports){ +},{"1YiZ5S":1}],123:[function(require,module,exports){ (function (global){ /** * @link https://github.com/gajus/sister for the canonical source repository @@ -6970,7 +8201,7 @@ global.gajus.Sister = Sister; module.exports = Sister; }).call(this,typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],75:[function(require,module,exports){ +},{}],124:[function(require,module,exports){ 'use strict'; var style = document.createElement('p').style, @@ -7020,7 +8251,7 @@ function dashedPrefix(key){ module.exports = get; module.exports.dash = dashedPrefix; -},{}],76:[function(require,module,exports){ +},{}],125:[function(require,module,exports){ var Swing = require('swing'); (function(angular, Swing, undefined) { @@ -7029,7 +8260,34 @@ var Swing = require('swing'); angular.module('gajus.swing', []); - angular.module('gajus.swing').directive('swingStack', /* @ngInject */ ["$parse", function ($parse) { + angular.module('gajus.swing').factory('swingStacks', function() { + return { + stacks: [], + getTopCardFromStack: function(stackIndex) { + if (this.stacks[stackIndex]) { + return this.stacks[stackIndex].cards[this.countCardsInStack(stackIndex) - 1]; + } + return null; + }, + getCardFromStack: function(stackIndex, cardIndex) { + if (this.stacks[stackIndex] && this.stacks[stackIndex].cards[cardIndex]) { + return this.stacks[stackIndex].cards[cardIndex]; + } + return null; + }, + countCardsInStack: function(stackIndex) { + if (this.stacks[stackIndex]) { + return this.stacks[stackIndex].cards.length; + } + return -1; + }, + Card: Swing.Card, + Stack: Swing.Stack + }; + }); + + angular.module('gajus.swing').directive('swingStack', /* @ngInject */ ["$parse", "swingStacks", function ($parse, swingStacks) { + var stackIndex = 0; return { restrict: 'A', controller: /* @ngInject */ ["$scope", "$element", "$attrs", function ($scope, $element, $attrs) { @@ -7043,8 +8301,13 @@ var Swing = require('swing'); stack = Swing.Stack(defaultOptions); this.add = function (cardElement) { - return stack.createCard(cardElement); + var thecard = stack.createCard(cardElement); + swingStacks.stacks[this.index].cards.push(thecard); + return thecard; }; + + this.index = stackIndex++; + swingStacks.stacks.push({cards: []}); }] }; }]); @@ -7072,10 +8335,22 @@ var Swing = require('swing'); // @see https://docs.angularjs.org/api/ng/service/$compile#comprehensive-directive-api angular.forEach(events, function (eventName) { card.on(eventName, function (eventObject) { - scope['swingOn' + eventName.charAt(0).toUpperCase() + eventName.slice(1)]({ + var swingEventName = 'swingOn' + eventName.charAt(0).toUpperCase() + eventName.slice(1); + scope[swingEventName]({ eventName: eventName, eventObject: eventObject }); + switch(swingEventName) { + case 'swingOnThrowoutleft': + case 'swingOnThrowoutright': + case 'swingOnThrowout': + if(scope.$$phase) { + scope.$apply(); + } + break; + default: + break; + } }); }); } @@ -7083,4 +8358,5 @@ var Swing = require('swing'); }); })(angular, Swing); -},{"swing":3}]},{},[76]) + +},{"swing":3}]},{},[125]) \ No newline at end of file diff --git a/dist/angular-swing.min.js b/dist/angular-swing.min.js index d87b5e2..529a64f 100644 --- a/dist/angular-swing.min.js +++ b/dist/angular-swing.min.js @@ -3,5 +3,6 @@ * @link https://github.com/gajus/angular-swing for the canonical source repository * @license https://github.com/gajus/angular-swing/blob/master/LICENSE BSD 3-Clause */ -!function t(e,n,i){function r(s,a){if(!n[s]){if(!e[s]){var u="function"==typeof require&&require;if(!a&&u)return u(s,!0);if(o)return o(s,!0);throw new Error("Cannot find module '"+s+"'")}var c=n[s]={exports:{}};e[s][0].call(c.exports,function(t){var n=e[s][1][t];return r(n?n:t)},c,c.exports,t,e,n,i)}return n[s].exports}for(var o="function"==typeof require&&require,s=0;s0)){var i=n.shift();i()}},!0),function(t){n.push(t),window.postMessage("process-tick","*")}}return function(t){setTimeout(t,0)}}(),r.title="browser",r.browser=!0,r.env={},r.argv=[],r.on=i,r.addListener=i,r.once=i,r.off=i,r.removeListener=i,r.removeAllListeners=i,r.emit=i,r.binding=function(t){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(t){throw new Error("process.chdir is not supported")}},{}],2:[function(t,e,n){(function(i){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(n,"__esModule",{value:!0});var o=t("sister"),s=r(o),a=t("hammerjs"),u=r(a),c=t("rebound"),l=r(c),h=t("vendor-prefix"),f=r(h),p=t("./util.js"),d=r(p),g=t("raf"),v=r(g),m=void 0;m=function(t,e){var n=void 0,r=void 0,o=void 0,a=void 0,c=void 0,h=void 0,f=void 0,p=void 0,g=void 0,y=void 0,b=void 0,_=void 0,T=void 0,S=void 0,w=void 0,E=void 0,O=void 0,I=void 0,A=void 0;return o=function(){n={},r=m.makeConfig(t.getConfig()),f=(0,s["default"])(),w=t.getSpringSystem(),E=w.createSpring(250,10),O=w.createSpring(500,20),g={},y={x:0,y:0},E.setRestSpeedThreshold(.05),E.setRestDisplacementThreshold(.05),O.setRestSpeedThreshold(.05),O.setRestDisplacementThreshold(.05),I=r.throwOutDistance(r.minThrowOutDistance,r.maxThrowOutDistance),T=new u["default"].Manager(e,{recognizers:[[u["default"].Pan,{threshold:2}]]}),m.appendToParent(e),f.on("panstart",function(){m.appendToParent(e),f.trigger("dragstart",{target:e}),a=0,c=0,p=!0,function t(){p&&(h(),(0,v["default"])(t))}()}),f.on("panmove",function(t){a=t.deltaX,c=t.deltaY}),f.on("panend",function(t){var i=void 0,o=void 0;p=!1,i=y.x+t.deltaX,o=y.y+t.deltaY,r.isThrowOut(i,e,r.throwOutConfidence(i,e))?n.throwOut(i,o):n.throwIn(i,o),f.trigger("dragend",{target:e})}),d["default"].isTouchDevice()?(e.addEventListener("touchstart",function(){f.trigger("panstart")}),function(){var t=void 0;e.addEventListener("touchstart",function(){t=!0}),e.addEventListener("touchend",function(){t=!1}),i.addEventListener("touchmove",function(e){t&&e.preventDefault()})}()):e.addEventListener("mousedown",function(){f.trigger("panstart")}),T.on("panmove",function(t){f.trigger("panmove",t)}),T.on("panend",function(t){f.trigger("panend",t)}),E.addListener({onSpringUpdate:function(t){var e=void 0,n=void 0,i=void 0;e=t.getCurrentValue(),n=l["default"].MathUtil.mapValueInRange(e,0,1,g.fromX,0),i=l["default"].MathUtil.mapValueInRange(e,0,1,g.fromY,0),S(n,i)},onSpringAtRest:function(){f.trigger("throwinend",{target:e})}}),O.addListener({onSpringUpdate:function(t){var e=void 0,n=void 0,i=void 0;e=t.getCurrentValue(),n=l["default"].MathUtil.mapValueInRange(e,0,1,g.fromX,I*g.direction),i=g.fromY,S(n,i)},onSpringAtRest:function(){f.trigger("throwoutend",{target:e})}}),h=function(){var t=void 0,n=void 0,i=void 0;(a!==b||c!==_)&&(b=a,_=c,n=y.x+a,i=y.y+c,t=r.rotation(n,i,e,r.maxRotation),r.transform(e,n,i,t),f.trigger("dragmove",{target:e,throwOutConfidence:r.throwOutConfidence(n,e),throwDirection:0>n?m.DIRECTION_LEFT:m.DIRECTION_RIGHT}))},S=function(t,n){var i=void 0;i=r.rotation(t,n,e,r.maxRotation),y.x=t||0,y.y=n||0,m.transform(e,t,n,i)},A=function(t,n,i){if(g.fromX=n,g.fromY=i,g.direction=g.fromX<0?m.DIRECTION_LEFT:m.DIRECTION_RIGHT,t===m.THROW_IN)E.setCurrentValue(0).setAtRest().setEndValue(1),f.trigger("throwin",{target:e,throwDirection:g.direction});else{if(t!==m.THROW_OUT)throw new Error("Invalid throw event.");O.setCurrentValue(0).setAtRest().setVelocity(100).setEndValue(1),f.trigger("throwout",{target:e,throwDirection:g.direction}),g.direction===m.DIRECTION_LEFT?f.trigger("throwoutleft",{target:e,throwDirection:g.direction}):f.trigger("throwoutright",{target:e,throwDirection:g.direction})}}},o(),n.on=f.on,n.trigger=f.trigger,n.throwIn=function(t,e){A(m.THROW_IN,t,e)},n.throwOut=function(t,e){A(m.THROW_OUT,t,e)},n.destroy=function(){T.destroy(),E.destroy(),O.destroy(),t.destroyCard(n)},n},m.makeConfig=function(){var t=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],e=void 0;return e={isThrowOut:m.isThrowOut,throwOutConfidence:m.throwOutConfidence,throwOutDistance:m.throwOutDistance,minThrowOutDistance:400,maxThrowOutDistance:500,rotation:m.rotation,maxRotation:20,transform:m.transform},d["default"].assign({},e,t)},m.transform=function(t,e,n,i){t.style[(0,f["default"])("transform")]="translate3d(0, 0, 0) translate("+e+"px, "+n+"px) rotate("+i+"deg)"},m.appendToParent=function(t){var e=void 0,n=void 0,i=void 0;e=t.parentNode,n=d["default"].elementChildren(e),i=n.indexOf(t),i+1!==n.length&&(e.removeChild(t),e.appendChild(t))},m.throwOutConfidence=function(t,e){return Math.min(Math.abs(t)/e.offsetWidth,1)},m.isThrowOut=function(t,e,n){return 1===n},m.throwOutDistance=function(t,e){return d["default"].random(t,e)},m.rotation=function(t,e,n,i){var r=void 0,o=void 0,s=void 0;return r=Math.min(Math.max(t/n.offsetWidth,-1),1),s=(e>0?1:-1)*Math.min(Math.abs(e)/100,1),o=r*s*i},m.DIRECTION_LEFT=-1,m.DIRECTION_RIGHT=1,m.THROW_IN="in",m.THROW_OUT="out",n["default"]=m,e.exports=n["default"]}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./util.js":5,hammerjs:6,raf:71,rebound:73,sister:74,"vendor-prefix":75}],3:[function(t,e,n){(function(e){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(n,"__esModule",{value:!0});var r=t("./stack"),o=i(r),s=t("./card"),a=i(s);e.gajus=e.gajus||{},e.gajus.Swing={Stack:o["default"],Card:a["default"]},n.Stack=o["default"],n.Card=a["default"]}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./card":2,"./stack":4}],4:[function(t,e,n){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(n,"__esModule",{value:!0});var r=t("sister"),o=i(r),s=t("rebound"),a=i(s),u=t("./card"),c=i(u),l=t("./util"),h=i(l),f=void 0;f=function(t){var e=void 0,n=void 0,i=void 0,r=void 0,s=void 0;return e=function(){s={},r=new a["default"].SpringSystem,n=(0,o["default"])(),i=[]},e(),s.getConfig=function(){return t},s.getSpringSystem=function(){return r},s.on=function(t,e){n.on(t,e)},s.createCard=function(t){var e=void 0,r=void 0;return e=(0,c["default"])(s,t),r=["throwout","throwoutend","throwoutleft","throwoutright","throwin","throwinend","dragstart","dragmove","dragend"],r.forEach(function(t){e.on(t,function(e){n.trigger(t,e)})}),i.push({element:t,card:e}),e},s.getCard=function(t){var e=void 0;return e=h["default"].find(i,{element:t}),e?e.card:null},s.destroyCard=function(t){return h["default"].remove(i,t)},s},n["default"]=f,e.exports=n["default"]},{"./card":2,"./util":5,rebound:73,sister:74}],5:[function(t,e,n){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(n,"__esModule",{value:!0});var r=t("lodash/array/remove"),o=i(r),s=t("lodash/object/assign"),a=i(s),u=t("lodash/number/random"),c=i(u),l=t("lodash/collection/find"),h=i(l),f=t("lodash/collection/where"),p=i(f),d=void 0;d={},d.remove=o["default"],d.assign=a["default"],d.random=c["default"],d.find=h["default"],d.where=p["default"],d.elementChildren=function(t){return d.where(t.childNodes,{nodeType:1})},d.isTouchDevice=function(){return"ontouchstart"in window||navigator.msMaxTouchPoints},n["default"]=d,e.exports=n["default"]},{"lodash/array/remove":8,"lodash/collection/find":10,"lodash/collection/where":11,"lodash/number/random":64,"lodash/object/assign":65}],6:[function(t,e,n){!function(t,n,i,r){"use strict";function o(t,e,n){return setTimeout(l(t,n),e)}function s(t,e,n){return Array.isArray(t)?(a(t,n[e],n),!0):!1}function a(t,e,n){var i;if(t)if(t.forEach)t.forEach(e,n);else if(t.length!==r)for(i=0;i\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",o=t.console&&(t.console.warn||t.console.log);return o&&o.call(t.console,r,i),e.apply(this,arguments)}}function c(t,e,n){var i,r=e.prototype;i=t.prototype=Object.create(r),i.constructor=t,i._super=r,n&&ut(i,n)}function l(t,e){return function(){return t.apply(e,arguments)}}function h(t,e){return typeof t==ht?t.apply(e?e[0]||r:r,e):t}function f(t,e){return t===r?e:t}function p(t,e,n){a(m(e),function(e){t.addEventListener(e,n,!1)})}function d(t,e,n){a(m(e),function(e){t.removeEventListener(e,n,!1)})}function g(t,e){for(;t;){if(t==e)return!0;t=t.parentNode}return!1}function v(t,e){return t.indexOf(e)>-1}function m(t){return t.trim().split(/\s+/g)}function y(t,e,n){if(t.indexOf&&!n)return t.indexOf(e);for(var i=0;in[e]}):i.sort()),i}function T(t,e){for(var n,i,o=e[0].toUpperCase()+e.slice(1),s=0;s1&&!n.firstMultiple?n.firstMultiple=j(e):1===r&&(n.firstMultiple=!1);var o=n.firstInput,s=n.firstMultiple,a=s?s.center:o.center,u=e.center=R(i);e.timeStamp=dt(),e.deltaTime=e.timeStamp-o.timeStamp,e.angle=F(a,u),e.distance=L(a,u),x(n,e),e.offsetDirection=D(e.deltaX,e.deltaY);var c=M(e.deltaTime,e.deltaX,e.deltaY);e.overallVelocityX=c.x,e.overallVelocityY=c.y,e.overallVelocity=pt(c.x)>pt(c.y)?c.x:c.y,e.scale=s?V(s.pointers,i):1,e.rotation=s?P(s.pointers,i):0,e.maxPointers=n.prevInput?e.pointers.length>n.prevInput.maxPointers?e.pointers.length:n.prevInput.maxPointers:e.pointers.length,C(n,e);var l=t.element;g(e.srcEvent.target,l)&&(l=e.srcEvent.target),e.target=l}function x(t,e){var n=e.center,i=t.offsetDelta||{},r=t.prevDelta||{},o=t.prevInput||{};(e.eventType===At||o.eventType===Ct)&&(r=t.prevDelta={x:o.deltaX||0,y:o.deltaY||0},i=t.offsetDelta={x:n.x,y:n.y}),e.deltaX=r.x+(n.x-i.x),e.deltaY=r.y+(n.y-i.y)}function C(t,e){var n,i,o,s,a=t.lastInterval||e,u=e.timeStamp-a.timeStamp;if(e.eventType!=jt&&(u>It||a.velocity===r)){var c=e.deltaX-a.deltaX,l=e.deltaY-a.deltaY,h=M(u,c,l);i=h.x,o=h.y,n=pt(h.x)>pt(h.y)?h.x:h.y,s=D(c,l),t.lastInterval=e}else n=a.velocity,i=a.velocityX,o=a.velocityY,s=a.direction;e.velocity=n,e.velocityX=i,e.velocityY=o,e.direction=s}function j(t){for(var e=[],n=0;nr;)n+=t[r].clientX,i+=t[r].clientY,r++;return{x:ft(n/e),y:ft(i/e)}}function M(t,e,n){return{x:e/t||0,y:n/t||0}}function D(t,e){return t===e?Rt:pt(t)>=pt(e)?0>t?Mt:Dt:0>e?Lt:Ft}function L(t,e,n){n||(n=Nt);var i=e[n[0]]-t[n[0]],r=e[n[1]]-t[n[1]];return Math.sqrt(i*i+r*r)}function F(t,e,n){n||(n=Nt);var i=e[n[0]]-t[n[0]],r=e[n[1]]-t[n[1]];return 180*Math.atan2(r,i)/Math.PI}function P(t,e){return F(e[1],e[0],qt)+F(t[1],t[0],qt)}function V(t,e){return L(e[0],e[1],qt)/L(t[0],t[1],qt)}function k(){this.evEl=Ut,this.evWin=Wt,this.allow=!0,this.pressed=!1,E.apply(this,arguments)}function N(){this.evEl=Ht,this.evWin=Gt,E.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}function q(){this.evTarget=$t,this.evWin=Zt,this.started=!1,E.apply(this,arguments)}function z(t,e){var n=b(t.touches),i=b(t.changedTouches);return e&(Ct|jt)&&(n=_(n.concat(i),"identifier",!0)),[n,i]}function U(){this.evTarget=Jt,this.targetIds={},E.apply(this,arguments)}function W(t,e){var n=b(t.touches),i=this.targetIds;if(e&(At|xt)&&1===n.length)return i[n[0].identifier]=!0,[n,n];var r,o,s=b(t.changedTouches),a=[],u=this.target;if(o=n.filter(function(t){return g(t.target,u)}),e===At)for(r=0;ra&&(e.push(t),a=e.length-1):r&(Ct|jt)&&(n=!0),0>a||(e[a]=t,this.callback(this.manager,r,{pointers:e,changedPointers:[t],pointerType:o,srcEvent:t}),n&&e.splice(a,1))}});var Bt={touchstart:At,touchmove:xt,touchend:Ct,touchcancel:jt},$t="touchstart",Zt="touchstart touchmove touchend touchcancel";c(q,E,{handler:function(t){var e=Bt[t.type];if(e===At&&(this.started=!0),this.started){var n=z.call(this,t,e);e&(Ct|jt)&&n[0].length-n[1].length===0&&(this.started=!1),this.callback(this.manager,e,{pointers:n[0],changedPointers:n[1],pointerType:St,srcEvent:t})}}});var Kt={touchstart:At,touchmove:xt,touchend:Ct,touchcancel:jt},Jt="touchstart touchmove touchend touchcancel";c(U,E,{handler:function(t){var e=Kt[t.type],n=W.call(this,t,e);n&&this.callback(this.manager,e,{pointers:n[0],changedPointers:n[1],pointerType:St,srcEvent:t})}}),c(X,E,{handler:function(t,e,n){var i=n.pointerType==St,r=n.pointerType==Et;if(i)this.mouse.allow=!1;else if(r&&!this.mouse.allow)return;e&(Ct|jt)&&(this.mouse.allow=!0),this.callback(t,e,n)},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});var Qt=T(lt.style,"touchAction"),te=Qt!==r,ee="compute",ne="auto",ie="manipulation",re="none",oe="pan-x",se="pan-y";Y.prototype={set:function(t){t==ee&&(t=this.compute()),te&&this.manager.element.style&&(this.manager.element.style[Qt]=t),this.actions=t.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var t=[];return a(this.manager.recognizers,function(e){h(e.options.enable,[e])&&(t=t.concat(e.getTouchAction()))}),H(t.join(" "))},preventDefaults:function(t){if(!te){var e=t.srcEvent,n=t.offsetDirection;if(this.manager.session.prevented)return void e.preventDefault();var i=this.actions,r=v(i,re),o=v(i,se),s=v(i,oe);if(r){var a=1===t.pointers.length,u=t.distance<2,c=t.deltaTime<250;if(a&&u&&c)return}if(!s||!o)return r||o&&n&Pt||s&&n&Vt?this.preventSrc(e):void 0}},preventSrc:function(t){this.manager.session.prevented=!0,t.preventDefault()}};var ae=1,ue=2,ce=4,le=8,he=le,fe=16,pe=32;G.prototype={defaults:{},set:function(t){return ut(this.options,t),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(t){if(s(t,"recognizeWith",this))return this;var e=this.simultaneous;return t=Z(t,this),e[t.id]||(e[t.id]=t,t.recognizeWith(this)),this},dropRecognizeWith:function(t){return s(t,"dropRecognizeWith",this)?this:(t=Z(t,this),delete this.simultaneous[t.id],this)},requireFailure:function(t){if(s(t,"requireFailure",this))return this;var e=this.requireFail;return t=Z(t,this),-1===y(e,t)&&(e.push(t),t.requireFailure(this)),this},dropRequireFailure:function(t){if(s(t,"dropRequireFailure",this))return this;t=Z(t,this);var e=y(this.requireFail,t);return e>-1&&this.requireFail.splice(e,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(t){return!!this.simultaneous[t.id]},emit:function(t){function e(e){n.manager.emit(e,t)}var n=this,i=this.state;le>i&&e(n.options.event+B(i)),e(n.options.event),t.additionalEvent&&e(t.additionalEvent),i>=le&&e(n.options.event+B(i))},tryEmit:function(t){return this.canEmit()?this.emit(t):void(this.state=pe)},canEmit:function(){for(var t=0;to?Mt:Dt,n=o!=this.pX,i=Math.abs(t.deltaX)):(r=0===s?Rt:0>s?Lt:Ft,n=s!=this.pY,i=Math.abs(t.deltaY))),t.direction=r,n&&i>e.threshold&&r&e.direction},attrTest:function(t){return K.prototype.attrTest.call(this,t)&&(this.state&ue||!(this.state&ue)&&this.directionTest(t))},emit:function(t){this.pX=t.deltaX,this.pY=t.deltaY;var e=$(t.direction);e&&(t.additionalEvent=this.options.event+e),this._super.emit.call(this,t)}}),c(Q,K,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[re]},attrTest:function(t){return this._super.attrTest.call(this,t)&&(Math.abs(t.scale-1)>this.options.threshold||this.state&ue)},emit:function(t){if(1!==t.scale){var e=t.scale<1?"in":"out";t.additionalEvent=this.options.event+e}this._super.emit.call(this,t)}}),c(tt,G,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[ne]},process:function(t){var e=this.options,n=t.pointers.length===e.pointers,i=t.distancee.time;if(this._input=t,!i||!n||t.eventType&(Ct|jt)&&!r)this.reset();else if(t.eventType&At)this.reset(),this._timer=o(function(){this.state=he,this.tryEmit()},e.time,this);else if(t.eventType&Ct)return he;return pe},reset:function(){clearTimeout(this._timer)},emit:function(t){this.state===he&&(t&&t.eventType&Ct?this.manager.emit(this.options.event+"up",t):(this._input.timeStamp=dt(),this.manager.emit(this.options.event,this._input)))}}),c(et,K,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[re]},attrTest:function(t){return this._super.attrTest.call(this,t)&&(Math.abs(t.rotation)>this.options.threshold||this.state&ue)}}),c(nt,K,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:Pt|Vt,pointers:1},getTouchAction:function(){return J.prototype.getTouchAction.call(this)},attrTest:function(t){var e,n=this.options.direction;return n&(Pt|Vt)?e=t.overallVelocity:n&Pt?e=t.overallVelocityX:n&Vt&&(e=t.overallVelocityY),this._super.attrTest.call(this,t)&&n&t.offsetDirection&&t.distance>this.options.threshold&&t.maxPointers==this.options.pointers&&pt(e)>this.options.velocity&&t.eventType&Ct},emit:function(t){var e=$(t.offsetDirection);e&&this.manager.emit(this.options.event+e,t),this.manager.emit(this.options.event,t)}}),c(it,G,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[ie]},process:function(t){var e=this.options,n=t.pointers.length===e.pointers,i=t.distancei;)t=t[e[i++]];return i&&i==o?t:void 0}}var r=t("./toObject");e.exports=i},{"./toObject":56}],26:[function(t,e,n){function i(t,e,n,a,u,c){return t===e?!0:null==t||null==e||!o(t)&&!s(e)?t!==t&&e!==e:r(t,e,i,n,a,u,c)}var r=t("./baseIsEqualDeep"),o=t("../lang/isObject"),s=t("./isObjectLike");e.exports=i},{"../lang/isObject":62,"./baseIsEqualDeep":27,"./isObjectLike":53}],27:[function(t,e,n){function i(t,e,n,i,f,g,v){var m=a(t),y=a(e),b=l,_=l;m||(b=d.call(t),b==c?b=h:b!=h&&(m=u(t))),y||(_=d.call(e),_==c?_=h:_!=h&&(y=u(e)));var T=b==h,S=_==h,w=b==_;if(w&&!m&&!T)return o(t,e,b);if(!f){var E=T&&p.call(t,"__wrapped__"),O=S&&p.call(e,"__wrapped__"); -if(E||O)return n(E?t.value():t,O?e.value():e,i,f,g,v)}if(!w)return!1;g||(g=[]),v||(v=[]);for(var I=g.length;I--;)if(g[I]==t)return v[I]==e;g.push(t),v.push(e);var A=(m?r:s)(t,e,n,i,f,g,v);return g.pop(),v.pop(),A}var r=t("./equalArrays"),o=t("./equalByTag"),s=t("./equalObjects"),a=t("../lang/isArray"),u=t("../lang/isTypedArray"),c="[object Arguments]",l="[object Array]",h="[object Object]",f=Object.prototype,p=f.hasOwnProperty,d=f.toString;e.exports=i},{"../lang/isArray":59,"../lang/isTypedArray":63,"./equalArrays":42,"./equalByTag":43,"./equalObjects":44}],28:[function(t,e,n){function i(t,e,n){var i=e.length,s=i,a=!n;if(null==t)return!s;for(t=o(t);i--;){var u=e[i];if(a&&u[2]?u[1]!==t[u[0]]:!(u[0]in t))return!1}for(;++ie&&(e=-e>r?0:r+e),n=void 0===n||n>r?r:+n||0,0>n&&(n+=r),r=e>n?0:n-e>>>0,e>>>=0;for(var o=Array(r);++i2?n[s-2]:void 0,u=s>2?n[2]:void 0,c=s>1?n[s-1]:void 0;for("function"==typeof a?(a=r(a,c,5),s-=2):(a="function"==typeof c?c:void 0,s-=a?1:0),u&&o(n[0],n[1],u)&&(a=3>s?void 0:a,s=1);++i-1?n[c]:void 0}return o(n,i,t)}}var r=t("./baseCallback"),o=t("./baseFind"),s=t("./baseFindIndex"),a=t("../lang/isArray");e.exports=i},{"../lang/isArray":59,"./baseCallback":17,"./baseFind":21,"./baseFindIndex":22}],42:[function(t,e,n){function i(t,e,n,i,o,s,a){var u=-1,c=t.length,l=e.length;if(c!=l&&!(o&&l>c))return!1;for(;++u-1&&t%1==0&&e>t}var r=/^\d+$/,o=9007199254740991;e.exports=i},{}],50:[function(t,e,n){function i(t,e,n){if(!s(n))return!1;var i=typeof e;if("number"==i?r(n)&&o(e,n.length):"string"==i&&e in n){var a=n[e];return t===t?t===a:a!==a}return!1}var r=t("./isArrayLike"),o=t("./isIndex"),s=t("../lang/isObject");e.exports=i},{"../lang/isObject":62,"./isArrayLike":48,"./isIndex":49}],51:[function(t,e,n){function i(t,e){var n=typeof t;if("string"==n&&a.test(t)||"number"==n)return!0;if(r(t))return!1;var i=!s.test(t);return i||null!=e&&t in o(e)}var r=t("../lang/isArray"),o=t("./toObject"),s=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\n\\]|\\.)*?\1)\]/,a=/^\w*$/;e.exports=i},{"../lang/isArray":59,"./toObject":56}],52:[function(t,e,n){function i(t){return"number"==typeof t&&t>-1&&t%1==0&&r>=t}var r=9007199254740991;e.exports=i},{}],53:[function(t,e,n){function i(t){return!!t&&"object"==typeof t}e.exports=i},{}],54:[function(t,e,n){function i(t){return t===t&&!r(t)}var r=t("../lang/isObject");e.exports=i},{"../lang/isObject":62}],55:[function(t,e,n){function i(t){for(var e=u(t),n=e.length,i=n&&t.length,c=!!i&&a(i)&&(o(t)||r(t)),h=-1,f=[];++h0;++i0;)this._idleSpringIndices.pop();for(var n=0,i=this._activeSprings.length;i>n;n++){var r=this._activeSprings[n];r.systemShouldAdvance()?r.advance(t/1e3,e/1e3):this._idleSpringIndices.push(this._activeSprings.indexOf(r))}for(;this._idleSpringIndices.length>0;){var o=this._idleSpringIndices.pop();o>=0&&this._activeSprings.splice(o,1)}},loop:function(t){var e;-1===this._lastTimeMillis&&(this._lastTimeMillis=t-1);var n=t-this._lastTimeMillis;this._lastTimeMillis=t;var i=0,r=this.listeners.length;for(i=0;r>i;i++)e=this.listeners[i],e.onBeforeIntegrate&&e.onBeforeIntegrate(this);for(this.advance(t,n),0===this._activeSprings.length&&(this._isIdle=!0,this._lastTimeMillis=-1),i=0;r>i;i++)e=this.listeners[i],e.onAfterIntegrate&&e.onAfterIntegrate(this);this._isIdle||this.looper.run()},activateSpring:function(t){var e=this._springRegistry[t];-1==this._activeSprings.indexOf(e)&&this._activeSprings.push(e),this.getIsIdle()&&(this._isIdle=!1,this.looper.run())},addListener:function(t){this.listeners.push(t)},removeListener:function(t){e(this.listeners,t)},removeAllListeners:function(){this.listeners=[]}});var u=i.Spring=function m(t){this._id="s"+m._ID++,this._springSystem=t,this.listeners=[],this._currentState=new c,this._previousState=new c,this._tempState=new c};r.extend(u,{_ID:0,MAX_DELTA_TIME_SEC:.064,SOLVER_TIMESTEP_SEC:.001}),r.extend(u.prototype,{_id:0,_springConfig:null,_overshootClampingEnabled:!1,_currentState:null,_previousState:null,_tempState:null,_startValue:0,_endValue:0,_wasAtRest:!0,_restSpeedThreshold:.001,_displacementFromRestThreshold:.001,listeners:null,_timeAccumulator:0,_springSystem:null,destroy:function(){this.listeners=[],this.frames=[],this._springSystem.deregisterSpring(this)},getId:function(){return this._id},setSpringConfig:function(t){return this._springConfig=t,this},getSpringConfig:function(){return this._springConfig},setCurrentValue:function(t,e){return this._startValue=t,this._currentState.position=t,e||this.setAtRest(),this.notifyPositionUpdated(!1,!1),this},getStartValue:function(){return this._startValue},getCurrentValue:function(){return this._currentState.position},getCurrentDisplacementDistance:function(){return this.getDisplacementDistanceForState(this._currentState)},getDisplacementDistanceForState:function(t){return Math.abs(this._endValue-t.position)},setEndValue:function(t){if(this._endValue==t&&this.isAtRest())return this;this._startValue=this.getCurrentValue(),this._endValue=t,this._springSystem.activateSpring(this.getId());for(var e=0,n=this.listeners.length;n>e;e++){var i=this.listeners[e],r=i.onSpringEndStateChange;r&&r(this)}return this},getEndValue:function(){return this._endValue},setVelocity:function(t){return t===this._currentState.velocity?this:(this._currentState.velocity=t,this._springSystem.activateSpring(this.getId()),this)},getVelocity:function(){return this._currentState.velocity},setRestSpeedThreshold:function(t){return this._restSpeedThreshold=t,this},getRestSpeedThreshold:function(){return this._restSpeedThreshold},setRestDisplacementThreshold:function(t){this._displacementFromRestThreshold=t},getRestDisplacementThreshold:function(){return this._displacementFromRestThreshold},setOvershootClampingEnabled:function(t){return this._overshootClampingEnabled=t,this},isOvershootClampingEnabled:function(){return this._overshootClampingEnabled},isOvershooting:function(){var t=this._startValue,e=this._endValue;return this._springConfig.tension>0&&(e>t&&this.getCurrentValue()>e||t>e&&this.getCurrentValue()u.MAX_DELTA_TIME_SEC&&(i=u.MAX_DELTA_TIME_SEC),this._timeAccumulator+=i;for(var r,o,s,a,c,l,h,f,p,d,g=this._springConfig.tension,v=this._springConfig.friction,m=this._currentState.position,y=this._currentState.velocity,b=this._tempState.position,_=this._tempState.velocity;this._timeAccumulator>=u.SOLVER_TIMESTEP_SEC;)this._timeAccumulator-=u.SOLVER_TIMESTEP_SEC,this._timeAccumulator0&&this._interpolate(this._timeAccumulator/u.SOLVER_TIMESTEP_SEC),(this.isAtRest()||this._overshootClampingEnabled&&this.isOvershooting())&&(this._springConfig.tension>0?(this._startValue=this._endValue,this._currentState.position=this._endValue):(this._endValue=this._currentState.position,this._startValue=this._endValue),this.setVelocity(0),n=!0);var T=!1;this._wasAtRest&&(this._wasAtRest=!1,T=!0);var S=!1;n&&(this._wasAtRest=!0,S=!0),this.notifyPositionUpdated(T,S)}},notifyPositionUpdated:function(t,e){for(var n=0,i=this.listeners.length;i>n;n++){var r=this.listeners[n];t&&r.onSpringActivate&&r.onSpringActivate(this),r.onSpringUpdate&&r.onSpringUpdate(this),e&&r.onSpringAtRest&&r.onSpringAtRest(this)}},systemShouldAdvance:function(){return!this.isAtRest()||!this.wasAtRest()},wasAtRest:function(){return this._wasAtRest},isAtRest:function(){return Math.abs(this._currentState.velocity)=t?this.b3Friction1(t):t>18&&44>=t?this.b3Friction2(t):this.b3Friction3(t)}}),r.extend(l,{fromOrigamiTensionAndFriction:function(t,e){return new l(f.tensionFromOrigamiValue(t),f.frictionFromOrigamiValue(e))},fromBouncinessAndSpeed:function(t,e){var n=new i.BouncyConversion(t,e);return this.fromOrigamiTensionAndFriction(n.bouncyTension,n.bouncyFriction)},coastingConfigWithOrigamiFriction:function(t){return new l(0,f.frictionFromOrigamiValue(t))}}),l.DEFAULT_ORIGAMI_SPRING_CONFIG=l.fromOrigamiTensionAndFriction(40,7),r.extend(l.prototype,{friction:0,tension:0});var d={};r.hexToRGB=function(t){if(d[t])return d[t];t=t.replace("#",""),3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]);var e=t.match(/.{2}/g),n={r:parseInt(e[0],16),g:parseInt(e[1],16),b:parseInt(e[2],16)};return d[t]=n,n},r.rgbToHex=function(t,e,n){return t=t.toString(16),e=e.toString(16),n=n.toString(16),t=t.length<2?"0"+t:t,e=e.length<2?"0"+e:e,n=n.length<2?"0"+n:n,"#"+t+e+n};var g=i.MathUtil={mapValueInRange:function(t,e,n,i,r){var o=n-e,s=r-i,a=(t-e)/o;return i+a*s},interpolateColor:function(t,e,n,i,o,s){i=void 0===i?0:i,o=void 0===o?1:o,e=r.hexToRGB(e),n=r.hexToRGB(n);var a=Math.floor(r.mapValueInRange(t,i,o,e.r,n.r)),u=Math.floor(r.mapValueInRange(t,i,o,e.g,n.g)),c=Math.floor(r.mapValueInRange(t,i,o,e.b,n.b));return s?"rgb("+a+","+u+","+c+")":r.rgbToHex(a,u,c)},degreesToRadians:function(t){return t*Math.PI/180},radiansToDegrees:function(t){return 180*t/Math.PI}};r.extend(r,g);var v;"undefined"!=typeof window&&(v=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame||window.oRequestAnimationFrame||function(t){window.setTimeout(t,1e3/60)}),v||"undefined"==typeof t||"node"!==t.title||(v=setImmediate),r.onFrame=function(t){return v(t)},"undefined"!=typeof n?r.extend(n,i):"undefined"!=typeof window&&(window.rebound=i)}()}).call(this,t("1YiZ5S"))},{"1YiZ5S":1}],74:[function(t,e,n){(function(t){function n(){var t={},e={};return t.on=function(t,n){var i={name:t,handler:n};return e[t]=e[t]||[],e[t].unshift(i),i},t.off=function(t){var n=e[t.name].indexOf(t);-1!=n&&e[t.name].splice(n,1)},t.trigger=function(t,n){var i,r=e[t];if(r)for(i=r.length;i--;)r[i].handler(n)},t}t.gajus=t.gajus||{},t.gajus.Sister=n,e.exports=n}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],75:[function(t,e,n){"use strict";function i(t){return t in l?l[t]:l[t]=r(t)}function r(t){var e,n=t.replace(/-([a-z])/g,function(t,e){return e.toUpperCase()}),i=u.length;if(void 0!==a[n])return n;for(n=o(t);i--;)if(e=u[i]+n,void 0!==a[e])return e;throw new Error("unable to prefix "+t)}function o(t){return t.charAt(0).toUpperCase()+t.slice(1)}function s(t){var e=i(t),n=/([A-Z])/g;return n.test(e)&&(e=(c.test(e)?"-":"")+e.replace(n,"-$1")),e.toLowerCase()}var a=document.createElement("p").style,u="O ms Moz webkit".split(" "),c=/^(o|ms|moz|webkit)/,l={};e.exports=i,e.exports.dash=s},{}],76:[function(t,e,n){var i=t("swing");!function(t,e,n){"use strict";t.module("gajus.swing",[]),t.module("gajus.swing").directive("swingStack",["$parse",function(n){return{restrict:"A",controller:["$scope","$element","$attrs",function(i,r,o){var s,a={},u=n(o.swingOptions)(i);t.extend(a,u),s=e.Stack(a),this.add=function(t){return s.createCard(t)}}]}}]),t.module("gajus.swing").directive("swingCard",function(){return{restrict:"A",require:"^swingStack",scope:{swingOnThrowout:"&",swingOnThrowoutleft:"&",swingOnThrowoutright:"&",swingOnThrowin:"&",swingOnDragstart:"&",swingOnDragmove:"&",swingOnDragend:"&"},link:function(e,n,i,r){var o=r.add(n[0]),s=["throwout","throwoutleft","throwoutright","throwin","dragstart","dragmove","dragend"];t.forEach(s,function(t){o.on(t,function(n){e["swingOn"+t.charAt(0).toUpperCase()+t.slice(1)]({eventName:t,eventObject:n})})})}}})}(angular,i)},{swing:3}]},{},[76]); +!function t(e,n,r){function i(s,a){if(!n[s]){if(!e[s]){var u="function"==typeof require&&require;if(!a&&u)return u(s,!0);if(o)return o(s,!0);throw new Error("Cannot find module '"+s+"'")}var c=n[s]={exports:{}};e[s][0].call(c.exports,function(t){var n=e[s][1][t];return i(n?n:t)},c,c.exports,t,e,n,r)}return n[s].exports}for(var o="function"==typeof require&&require,s=0;s0)){var r=n.shift();r()}},!0),function(t){n.push(t),window.postMessage("process-tick","*")}}return function(t){setTimeout(t,0)}}(),i.title="browser",i.browser=!0,i.env={},i.argv=[],i.on=r,i.addListener=r,i.once=r,i.off=r,i.removeListener=r,i.removeAllListeners=r,i.emit=r,i.binding=function(t){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(t){throw new Error("process.chdir is not supported")}},{}],2:[function(t,e,n){(function(r){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(n,"__esModule",{value:!0});var o=t("lodash/random"),s=i(o),a=t("lodash/assign"),u=i(a),c=t("sister"),h=i(c),l=t("hammerjs"),f=i(l),p=t("rebound"),d=i(p),v=t("vendor-prefix"),g=i(v),_=t("raf"),m=i(_),y=t("./util"),b=function S(t,e){var n=void 0,i=void 0,o=void 0,s=void 0,a=void 0,u=void 0,c=void 0,l=void 0,p=void 0,v=void 0,g=void 0,_=void 0,b=void 0,w=void 0,T=void 0,x=void 0,O=void 0,E=void 0,I=function(){n={},i=S.makeConfig(t.getConfig()),u=(0,h["default"])(),w=t.getSpringSystem(),T=w.createSpring(250,10),x=w.createSpring(500,20),l={},p={x:0,y:0},T.setRestSpeedThreshold(.05),T.setRestDisplacementThreshold(.05),x.setRestSpeedThreshold(.05),x.setRestDisplacementThreshold(.05),O=i.throwOutDistance(i.minThrowOutDistance,i.maxThrowOutDistance),_=new f["default"].Manager(e,{recognizers:[[f["default"].Pan,{threshold:2}]]}),S.appendToParent(e),u.on("panstart",function(){S.appendToParent(e),u.trigger("dragstart",{target:e}),o=0,s=0,c=!0,function t(){c&&(a(),(0,m["default"])(t))}()}),u.on("panmove",function(t){o=t.deltaX,s=t.deltaY}),u.on("panend",function(t){c=!1;var r=p.x+t.deltaX,o=p.y+t.deltaY;i.isThrowOut(r,e,i.throwOutConfidence(r,e))?n.throwOut(r,o):n.throwIn(r,o),u.trigger("dragend",{target:e})}),(0,y.isTouchDevice)()?(e.addEventListener("touchstart",function(){u.trigger("panstart")}),function(){var t=void 0;e.addEventListener("touchstart",function(){t=!0}),e.addEventListener("touchend",function(){t=!1}),r.addEventListener("touchmove",function(e){t&&e.preventDefault()})}()):e.addEventListener("mousedown",function(){u.trigger("panstart")}),_.on("panmove",function(t){u.trigger("panmove",t)}),_.on("panend",function(t){u.trigger("panend",t)}),T.addListener({onSpringUpdate:function(t){var e=t.getCurrentValue(),n=d["default"].MathUtil.mapValueInRange(e,0,1,l.fromX,0),r=d["default"].MathUtil.mapValueInRange(e,0,1,l.fromY,0);b(n,r)},onSpringAtRest:function(){u.trigger("throwinend",{target:e})}}),x.addListener({onSpringUpdate:function(t){var e=t.getCurrentValue(),n=d["default"].MathUtil.mapValueInRange(e,0,1,l.fromX,O*l.direction),r=l.fromY;b(n,r)},onSpringAtRest:function(){u.trigger("throwoutend",{target:e})}}),a=function(){var t=void 0,n=void 0,r=void 0;o===v&&s===g||(v=o,g=s,n=p.x+o,r=p.y+s,t=i.rotation(n,r,e,i.maxRotation),i.transform(e,n,r,t),u.trigger("dragmove",{target:e,throwOutConfidence:i.throwOutConfidence(n,e),throwDirection:0>n?S.DIRECTION_LEFT:S.DIRECTION_RIGHT,offset:n}))},b=function(t,n){var r=void 0;r=i.rotation(t,n,e,i.maxRotation),p.x=t||0,p.y=n||0,S.transform(e,t,n,r)},E=function(t,n,r){if(l.fromX=n,l.fromY=r,l.direction=l.fromX<0?S.DIRECTION_LEFT:S.DIRECTION_RIGHT,t===S.THROW_IN)T.setCurrentValue(0).setAtRest().setEndValue(1),u.trigger("throwin",{target:e,throwDirection:l.direction});else{if(t!==S.THROW_OUT)throw new Error("Invalid throw event.");x.setCurrentValue(0).setAtRest().setVelocity(100).setEndValue(1),u.trigger("throwout",{target:e,throwDirection:l.direction}),l.direction===S.DIRECTION_LEFT?u.trigger("throwoutleft",{target:e,throwDirection:l.direction}):u.trigger("throwoutright",{target:e,throwDirection:l.direction})}}};return I(),n.on=u.on,n.trigger=u.trigger,n.throwIn=function(t,e){E(S.THROW_IN,t,e)},n.throwOut=function(t,e){E(S.THROW_OUT,t,e)},n.destroy=function(){_.destroy(),T.destroy(),x.destroy(),t.destroyCard(n)},n};b.makeConfig=function(){var t=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],e={isThrowOut:b.isThrowOut,throwOutConfidence:b.throwOutConfidence,throwOutDistance:b.throwOutDistance,minThrowOutDistance:400,maxThrowOutDistance:500,rotation:b.rotation,maxRotation:20,transform:b.transform};return(0,u["default"])({},e,t)},b.transform=function(t,e,n,r){t.style[(0,g["default"])("transform")]="translate3d(0, 0, 0) translate("+e+"px, "+n+"px) rotate("+r+"deg)"},b.appendToParent=function(t){var e=t.parentNode,n=(0,y.elementChildren)(e),r=n.indexOf(t);r+1!==n.length&&(e.removeChild(t),e.appendChild(t))},b.throwOutConfidence=function(t,e){return Math.min(Math.abs(t)/e.offsetWidth,1)},b.isThrowOut=function(t,e,n){return 1===n},b.throwOutDistance=function(t,e){return(0,s["default"])(t,e)},b.rotation=function(t,e,n,r){var i=Math.min(Math.max(t/n.offsetWidth,-1),1),o=(e>0?1:-1)*Math.min(Math.abs(e)/100,1),s=i*o*r;return s},b.DIRECTION_LEFT=-1,b.DIRECTION_RIGHT=1,b.THROW_IN="in",b.THROW_OUT="out",n["default"]=b,e.exports=n["default"]}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./util":5,hammerjs:6,"lodash/assign":91,"lodash/random":113,raf:120,rebound:122,sister:123,"vendor-prefix":124}],3:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(n,"__esModule",{value:!0}),n.Card=n.Stack=void 0;var i=t("./stack"),o=r(i),s=t("./card"),a=r(s);n.Stack=o["default"],n.Card=a["default"]},{"./card":2,"./stack":4}],4:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(n,"__esModule",{value:!0});var i=t("lodash/remove"),o=r(i),s=t("lodash/find"),a=r(s),u=t("sister"),c=r(u),h=t("rebound"),l=r(h),f=t("./card"),p=r(f),d=function(t){var e=void 0,n=void 0,r=void 0,i=void 0,s=void 0;return e=function(){s={},i=new l["default"].SpringSystem,n=(0,c["default"])(),r=[]},e(),s.getConfig=function(){return t},s.getSpringSystem=function(){return i},s.on=function(t,e){n.on(t,e)},s.createCard=function(t){var e=(0,p["default"])(s,t),i=["throwout","throwoutend","throwoutleft","throwoutright","throwin","throwinend","dragstart","dragmove","dragend"];return i.forEach(function(t){e.on(t,function(e){n.trigger(t,e)})}),r.push({element:t,card:e}),e},s.getCard=function(t){var e=(0,a["default"])(r,{element:t});return e?e.card:null},s.destroyCard=function(t){return(0,o["default"])(r,{card:t})},s};n["default"]=d,e.exports=n["default"]},{"./card":2,"lodash/find":94,"lodash/remove":114,rebound:122,sister:123}],5:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(n,"__esModule",{value:!0}),n.isTouchDevice=n.elementChildren=void 0;var i=t("lodash/filter"),o=r(i),s=function(t){return(0,o["default"])(t.childNodes,{nodeType:1})},a=function(){return"ontouchstart"in window||navigator.msMaxTouchPoints};n.elementChildren=s,n.isTouchDevice=a},{"lodash/filter":93}],6:[function(t,e,n){!function(t,n,r,i){"use strict";function o(t,e,n){return setTimeout(h(t,n),e)}function s(t,e,n){return Array.isArray(t)?(a(t,n[e],n),!0):!1}function a(t,e,n){var r;if(t)if(t.forEach)t.forEach(e,n);else if(t.length!==i)for(r=0;r\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",o=t.console&&(t.console.warn||t.console.log);return o&&o.call(t.console,i,r),e.apply(this,arguments)}}function c(t,e,n){var r,i=e.prototype;r=t.prototype=Object.create(i),r.constructor=t,r._super=i,n&&ut(r,n)}function h(t,e){return function(){return t.apply(e,arguments)}}function l(t,e){return typeof t==lt?t.apply(e?e[0]||i:i,e):t}function f(t,e){return t===i?e:t}function p(t,e,n){a(_(e),function(e){t.addEventListener(e,n,!1)})}function d(t,e,n){a(_(e),function(e){t.removeEventListener(e,n,!1)})}function v(t,e){for(;t;){if(t==e)return!0;t=t.parentNode}return!1}function g(t,e){return t.indexOf(e)>-1}function _(t){return t.trim().split(/\s+/g)}function m(t,e,n){if(t.indexOf&&!n)return t.indexOf(e);for(var r=0;rn[e]}):r.sort()),r}function S(t,e){for(var n,r,o=e[0].toUpperCase()+e.slice(1),s=0;s1&&!n.firstMultiple?n.firstMultiple=j(e):1===i&&(n.firstMultiple=!1);var o=n.firstInput,s=n.firstMultiple,a=s?s.center:o.center,u=e.center=R(r);e.timeStamp=dt(),e.deltaTime=e.timeStamp-o.timeStamp,e.angle=P(a,u),e.distance=D(a,u),A(n,e),e.offsetDirection=k(e.deltaX,e.deltaY);var c=M(e.deltaTime,e.deltaX,e.deltaY);e.overallVelocityX=c.x,e.overallVelocityY=c.y,e.overallVelocity=pt(c.x)>pt(c.y)?c.x:c.y,e.scale=s?L(s.pointers,r):1,e.rotation=s?F(s.pointers,r):0,e.maxPointers=n.prevInput?e.pointers.length>n.prevInput.maxPointers?e.pointers.length:n.prevInput.maxPointers:e.pointers.length,C(n,e);var h=t.element;v(e.srcEvent.target,h)&&(h=e.srcEvent.target),e.target=h}function A(t,e){var n=e.center,r=t.offsetDelta||{},i=t.prevDelta||{},o=t.prevInput||{};e.eventType!==It&&o.eventType!==Ct||(i=t.prevDelta={x:o.deltaX||0,y:o.deltaY||0},r=t.offsetDelta={x:n.x,y:n.y}),e.deltaX=i.x+(n.x-r.x),e.deltaY=i.y+(n.y-r.y)}function C(t,e){var n,r,o,s,a=t.lastInterval||e,u=e.timeStamp-a.timeStamp;if(e.eventType!=jt&&(u>Et||a.velocity===i)){var c=e.deltaX-a.deltaX,h=e.deltaY-a.deltaY,l=M(u,c,h);r=l.x,o=l.y,n=pt(l.x)>pt(l.y)?l.x:l.y,s=k(c,h),t.lastInterval=e}else n=a.velocity,r=a.velocityX,o=a.velocityY,s=a.direction;e.velocity=n,e.velocityX=r,e.velocityY=o,e.direction=s}function j(t){for(var e=[],n=0;ni;)n+=t[i].clientX,r+=t[i].clientY,i++;return{x:ft(n/e),y:ft(r/e)}}function M(t,e,n){return{x:e/t||0,y:n/t||0}}function k(t,e){return t===e?Rt:pt(t)>=pt(e)?0>t?Mt:kt:0>e?Dt:Pt}function D(t,e,n){n||(n=Nt);var r=e[n[0]]-t[n[0]],i=e[n[1]]-t[n[1]];return Math.sqrt(r*r+i*i)}function P(t,e,n){n||(n=Nt);var r=e[n[0]]-t[n[0]],i=e[n[1]]-t[n[1]];return 180*Math.atan2(i,r)/Math.PI}function F(t,e){return P(e[1],e[0],qt)+P(t[1],t[0],qt)}function L(t,e){return D(e[0],e[1],qt)/D(t[0],t[1],qt)}function V(){this.evEl=zt,this.evWin=Ut,this.allow=!0,this.pressed=!1,x.apply(this,arguments)}function N(){this.evEl=Xt,this.evWin=Yt,x.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}function q(){this.evTarget=$t,this.evWin=Kt,this.started=!1,x.apply(this,arguments)}function H(t,e){var n=y(t.touches),r=y(t.changedTouches);return e&(Ct|jt)&&(n=b(n.concat(r),"identifier",!0)),[n,r]}function z(){this.evTarget=Jt,this.targetIds={},x.apply(this,arguments)}function U(t,e){var n=y(t.touches),r=this.targetIds;if(e&(It|At)&&1===n.length)return r[n[0].identifier]=!0,[n,n];var i,o,s=y(t.changedTouches),a=[],u=this.target;if(o=n.filter(function(t){return v(t.target,u)}),e===It)for(i=0;ia&&(e.push(t),a=e.length-1):i&(Ct|jt)&&(n=!0),0>a||(e[a]=t,this.callback(this.manager,i,{pointers:e,changedPointers:[t],pointerType:o,srcEvent:t}),n&&e.splice(a,1))}});var Bt={touchstart:It,touchmove:At,touchend:Ct,touchcancel:jt},$t="touchstart",Kt="touchstart touchmove touchend touchcancel";c(q,x,{handler:function(t){var e=Bt[t.type];if(e===It&&(this.started=!0),this.started){var n=H.call(this,t,e);e&(Ct|jt)&&n[0].length-n[1].length===0&&(this.started=!1),this.callback(this.manager,e,{pointers:n[0],changedPointers:n[1],pointerType:wt,srcEvent:t})}}});var Zt={touchstart:It,touchmove:At,touchend:Ct,touchcancel:jt},Jt="touchstart touchmove touchend touchcancel";c(z,x,{handler:function(t){var e=Zt[t.type],n=U.call(this,t,e);n&&this.callback(this.manager,e,{pointers:n[0],changedPointers:n[1],pointerType:wt,srcEvent:t})}}),c(W,x,{handler:function(t,e,n){var r=n.pointerType==wt,i=n.pointerType==xt;if(r)this.mouse.allow=!1;else if(i&&!this.mouse.allow)return;e&(Ct|jt)&&(this.mouse.allow=!0),this.callback(t,e,n)},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});var Qt=S(ht.style,"touchAction"),te=Qt!==i,ee="compute",ne="auto",re="manipulation",ie="none",oe="pan-x",se="pan-y";G.prototype={set:function(t){t==ee&&(t=this.compute()),te&&this.manager.element.style&&(this.manager.element.style[Qt]=t),this.actions=t.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var t=[];return a(this.manager.recognizers,function(e){l(e.options.enable,[e])&&(t=t.concat(e.getTouchAction()))}),X(t.join(" "))},preventDefaults:function(t){if(!te){var e=t.srcEvent,n=t.offsetDirection;if(this.manager.session.prevented)return void e.preventDefault();var r=this.actions,i=g(r,ie),o=g(r,se),s=g(r,oe);if(i){var a=1===t.pointers.length,u=t.distance<2,c=t.deltaTime<250;if(a&&u&&c)return}if(!s||!o)return i||o&&n&Ft||s&&n&Lt?this.preventSrc(e):void 0}},preventSrc:function(t){this.manager.session.prevented=!0,t.preventDefault()}};var ae=1,ue=2,ce=4,he=8,le=he,fe=16,pe=32;Y.prototype={defaults:{},set:function(t){return ut(this.options,t),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(t){if(s(t,"recognizeWith",this))return this;var e=this.simultaneous;return t=K(t,this),e[t.id]||(e[t.id]=t,t.recognizeWith(this)),this},dropRecognizeWith:function(t){return s(t,"dropRecognizeWith",this)?this:(t=K(t,this),delete this.simultaneous[t.id],this)},requireFailure:function(t){if(s(t,"requireFailure",this))return this;var e=this.requireFail;return t=K(t,this),-1===m(e,t)&&(e.push(t),t.requireFailure(this)),this},dropRequireFailure:function(t){if(s(t,"dropRequireFailure",this))return this;t=K(t,this);var e=m(this.requireFail,t);return e>-1&&this.requireFail.splice(e,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(t){return!!this.simultaneous[t.id]},emit:function(t){function e(e){n.manager.emit(e,t)}var n=this,r=this.state;he>r&&e(n.options.event+B(r)),e(n.options.event),t.additionalEvent&&e(t.additionalEvent),r>=he&&e(n.options.event+B(r))},tryEmit:function(t){return this.canEmit()?this.emit(t):void(this.state=pe)},canEmit:function(){for(var t=0;to?Mt:kt,n=o!=this.pX,r=Math.abs(t.deltaX)):(i=0===s?Rt:0>s?Dt:Pt,n=s!=this.pY,r=Math.abs(t.deltaY))),t.direction=i,n&&r>e.threshold&&i&e.direction},attrTest:function(t){return Z.prototype.attrTest.call(this,t)&&(this.state&ue||!(this.state&ue)&&this.directionTest(t))},emit:function(t){this.pX=t.deltaX,this.pY=t.deltaY;var e=$(t.direction);e&&(t.additionalEvent=this.options.event+e),this._super.emit.call(this,t)}}),c(Q,Z,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[ie]},attrTest:function(t){return this._super.attrTest.call(this,t)&&(Math.abs(t.scale-1)>this.options.threshold||this.state&ue)},emit:function(t){if(1!==t.scale){var e=t.scale<1?"in":"out";t.additionalEvent=this.options.event+e}this._super.emit.call(this,t)}}),c(tt,Y,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[ne]},process:function(t){var e=this.options,n=t.pointers.length===e.pointers,r=t.distancee.time;if(this._input=t,!r||!n||t.eventType&(Ct|jt)&&!i)this.reset();else if(t.eventType&It)this.reset(),this._timer=o(function(){this.state=le,this.tryEmit()},e.time,this);else if(t.eventType&Ct)return le;return pe},reset:function(){clearTimeout(this._timer)},emit:function(t){this.state===le&&(t&&t.eventType&Ct?this.manager.emit(this.options.event+"up",t):(this._input.timeStamp=dt(),this.manager.emit(this.options.event,this._input)))}}),c(et,Z,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[ie]},attrTest:function(t){return this._super.attrTest.call(this,t)&&(Math.abs(t.rotation)>this.options.threshold||this.state&ue)}}),c(nt,Z,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:Ft|Lt,pointers:1},getTouchAction:function(){return J.prototype.getTouchAction.call(this)},attrTest:function(t){var e,n=this.options.direction;return n&(Ft|Lt)?e=t.overallVelocity:n&Ft?e=t.overallVelocityX:n&Lt&&(e=t.overallVelocityY),this._super.attrTest.call(this,t)&&n&t.offsetDirection&&t.distance>this.options.threshold&&t.maxPointers==this.options.pointers&&pt(e)>this.options.velocity&&t.eventType&Ct},emit:function(t){var e=$(t.offsetDirection);e&&this.manager.emit(this.options.event+e,t),this.manager.emit(this.options.event,t)}}),c(rt,Y,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[re]},process:function(t){var e=this.options,n=t.pointers.length===e.pointers,r=t.distancen)return!1;var r=t.length-1;return n==r?t.pop():s.call(t,n,1),!0}var i=t("./_assocIndexOf"),o=Array.prototype,s=o.splice;e.exports=r},{"./_assocIndexOf":23}],21:[function(t,e,n){function r(t,e){var n=i(t,e);return 0>n?void 0:t[n][1]}var i=t("./_assocIndexOf");e.exports=r},{"./_assocIndexOf":23}],22:[function(t,e,n){function r(t,e){return i(t,e)>-1}var i=t("./_assocIndexOf");e.exports=r},{"./_assocIndexOf":23}],23:[function(t,e,n){function r(t,e){for(var n=t.length;n--;)if(i(t[n][0],e))return n;return-1}var i=t("./eq");e.exports=r},{"./eq":92}],24:[function(t,e,n){function r(t,e,n){var r=i(t,e);0>r?t.push([e,n]):t[r][1]=n}var i=t("./_assocIndexOf");e.exports=r},{"./_assocIndexOf":23}],25:[function(t,e,n){function r(t){return i(t)?t:o(t)}var i=t("./isArray"),o=t("./_stringToPath");e.exports=r},{"./_stringToPath":90,"./isArray":99}],26:[function(t,e,n){var r=t("./_baseForOwn"),i=t("./_createBaseEach"),o=i(r);e.exports=o},{"./_baseForOwn":31,"./_createBaseEach":53}],27:[function(t,e,n){function r(t,e){var n=[];return i(t,function(t,r,i){e(t,r,i)&&n.push(t)}),n}var i=t("./_baseEach");e.exports=r},{"./_baseEach":26}],28:[function(t,e,n){function r(t,e,n,r){var i;return n(t,function(t,n,o){return e(t,n,o)?(i=r?n:t,!1):void 0}),i}e.exports=r},{}],29:[function(t,e,n){function r(t,e,n){for(var r=t.length,i=n?r:-1;n?i--:++in;)t=t[e[n++]];return n&&n==r?t:void 0}var i=t("./_baseCastPath"),o=t("./_isKey");e.exports=r},{"./_baseCastPath":25,"./_isKey":71}],33:[function(t,e,n){function r(t,e){return o.call(t,e)||"object"==typeof t&&e in t&&null===s(t)}var i=Object.prototype,o=i.hasOwnProperty,s=Object.getPrototypeOf;e.exports=r},{}],34:[function(t,e,n){function r(t,e){return e in Object(t)}e.exports=r},{}],35:[function(t,e,n){function r(t,e,n,a,u){return t===e?!0:null==t||null==e||!o(t)&&!s(e)?t!==t&&e!==e:i(t,e,r,n,a,u)}var i=t("./_baseIsEqualDeep"),o=t("./isObject"),s=t("./isObjectLike");e.exports=r},{"./_baseIsEqualDeep":36,"./isObject":105,"./isObjectLike":106}],36:[function(t,e,n){function r(t,e,n,r,g,m){var y=c(t),b=c(e),S=d,w=d;y||(S=u(t), +S=S==p?v:S),b||(w=u(e),w=w==p?v:w);var T=S==v&&!h(t),x=w==v&&!h(e),O=S==w;if(O&&!T)return m||(m=new i),y||l(t)?o(t,e,n,r,g,m):s(t,e,S,n,r,g,m);if(!(g&f)){var E=T&&_.call(t,"__wrapped__"),I=x&&_.call(e,"__wrapped__");if(E||I)return m||(m=new i),n(E?t.value():t,I?e.value():e,r,g,m)}return O?(m||(m=new i),a(t,e,n,r,g,m)):!1}var i=t("./_Stack"),o=t("./_equalArrays"),s=t("./_equalByTag"),a=t("./_equalObjects"),u=t("./_getTag"),c=t("./isArray"),h=t("./_isHostObject"),l=t("./isTypedArray"),f=2,p="[object Arguments]",d="[object Array]",v="[object Object]",g=Object.prototype,_=g.hasOwnProperty;e.exports=r},{"./_Stack":11,"./_equalArrays":55,"./_equalByTag":56,"./_equalObjects":57,"./_getTag":61,"./_isHostObject":68,"./isArray":99,"./isTypedArray":109}],37:[function(t,e,n){function r(t,e,n,r){var u=n.length,c=u,h=!r;if(null==t)return!c;for(t=Object(t);u--;){var l=n[u];if(h&&l[2]?l[1]!==t[l[0]]:!(l[0]in t))return!1}for(;++ue&&(e=-e>i?0:i+e),n=n>i?i:n,0>n&&(n+=i),i=e>n?0:n-e>>>0,e>>>=0;for(var o=Array(i);++r1?n[o-1]:void 0,a=o>2?n[2]:void 0;for(s="function"==typeof s?(o--,s):void 0,a&&i(n[0],n[1],a)&&(s=3>o?void 0:s,o=1),e=Object(e);++rf))return!1;var d=u.get(t);if(d)return d==e;var v=!0;for(u.set(t,e);++c-1&&t%1==0&&e>t}var i=9007199254740991,o=/^(?:0|[1-9]\d*)$/;e.exports=r},{}],70:[function(t,e,n){function r(t,e,n){if(!a(n))return!1;var r=typeof e;return("number"==r?o(n)&&s(e,n.length):"string"==r&&e in n)?i(n[e],t):!1}var i=t("./eq"),o=t("./isArrayLike"),s=t("./_isIndex"),a=t("./isObject");e.exports=r},{"./_isIndex":69,"./eq":92,"./isArrayLike":100,"./isObject":105}],71:[function(t,e,n){function r(t,e){return"number"==typeof t?!0:!i(t)&&(s.test(t)||!o.test(t)||null!=e&&t in Object(e))}var i=t("./isArray"),o=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,s=/^\w*$/;e.exports=r},{"./isArray":99}],72:[function(t,e,n){function r(t){var e=typeof t;return"number"==e||"boolean"==e||"string"==e&&"__proto__"!=t||null==t}e.exports=r},{}],73:[function(t,e,n){function r(t){var e=t&&t.constructor,n="function"==typeof e&&e.prototype||i;return t===n}var i=Object.prototype;e.exports=r},{}],74:[function(t,e,n){function r(t){return t===t&&!i(t)}var i=t("./isObject");e.exports=r},{"./isObject":105}],75:[function(t,e,n){function r(){this.__data__={hash:new i,map:o?new o:[],string:new i}}var i=t("./_Hash"),o=t("./_Map");e.exports=r},{"./_Hash":7,"./_Map":8}],76:[function(t,e,n){function r(t){var e=this.__data__;return a(t)?s("string"==typeof t?e.string:e.hash,t):i?e.map["delete"](t):o(e.map,t)}var i=t("./_Map"),o=t("./_assocDelete"),s=t("./_hashDelete"),a=t("./_isKeyable");e.exports=r},{"./_Map":8,"./_assocDelete":20,"./_hashDelete":63,"./_isKeyable":72}],77:[function(t,e,n){function r(t){var e=this.__data__;return a(t)?s("string"==typeof t?e.string:e.hash,t):i?e.map.get(t):o(e.map,t)}var i=t("./_Map"),o=t("./_assocGet"),s=t("./_hashGet"),a=t("./_isKeyable");e.exports=r},{"./_Map":8,"./_assocGet":21,"./_hashGet":64,"./_isKeyable":72}],78:[function(t,e,n){function r(t){var e=this.__data__;return a(t)?s("string"==typeof t?e.string:e.hash,t):i?e.map.has(t):o(e.map,t)}var i=t("./_Map"),o=t("./_assocHas"),s=t("./_hashHas"),a=t("./_isKeyable");e.exports=r},{"./_Map":8,"./_assocHas":22,"./_hashHas":65,"./_isKeyable":72}],79:[function(t,e,n){function r(t,e){var n=this.__data__;return a(t)?s("string"==typeof t?n.string:n.hash,t,e):i?n.map.set(t,e):o(n.map,t,e),this}var i=t("./_Map"),o=t("./_assocSet"),s=t("./_hashSet"),a=t("./_isKeyable");e.exports=r},{"./_Map":8,"./_assocSet":24,"./_hashSet":66,"./_isKeyable":72}],80:[function(t,e,n){function r(t){var e=-1,n=Array(t.size);return t.forEach(function(t,r){n[++e]=[r,t]}),n}e.exports=r},{}],81:[function(t,e,n){var r=t("./_getNative"),i=r(Object,"create");e.exports=i},{"./_getNative":60}],82:[function(t,e,n){function r(t,e){return 1==e.length?t:o(t,i(e,0,-1))}var i=t("./_baseSlice"),o=t("./get");e.exports=r},{"./_baseSlice":46,"./get":95}],83:[function(t,e,n){(function(r){var i=t("./_checkGlobal"),o={"function":!0,object:!0},s=o[typeof n]&&n&&!n.nodeType?n:void 0,a=o[typeof e]&&e&&!e.nodeType?e:void 0,u=i(s&&a&&"object"==typeof r&&r),c=i(o[typeof self]&&self),h=i(o[typeof window]&&window),l=i(o[typeof this]&&this),f=u||h!==(l&&l.window)&&h||c||l||Function("return this")();e.exports=f}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./_checkGlobal":49}],84:[function(t,e,n){function r(t){var e=-1,n=Array(t.size);return t.forEach(function(t){n[++e]=t}),n}e.exports=r},{}],85:[function(t,e,n){function r(){this.__data__={array:[],map:null}}e.exports=r},{}],86:[function(t,e,n){function r(t){var e=this.__data__,n=e.array;return n?i(n,t):e.map["delete"](t)}var i=t("./_assocDelete");e.exports=r},{"./_assocDelete":20}],87:[function(t,e,n){function r(t){var e=this.__data__,n=e.array;return n?i(n,t):e.map.get(t)}var i=t("./_assocGet");e.exports=r},{"./_assocGet":21}],88:[function(t,e,n){function r(t){var e=this.__data__,n=e.array;return n?i(n,t):e.map.has(t)}var i=t("./_assocHas");e.exports=r},{"./_assocHas":22}],89:[function(t,e,n){function r(t,e){var n=this.__data__,r=n.array;r&&(r.length-1?t[n]:void 0}return o(t,e,i)}var i=t("./_baseEach"),o=t("./_baseFind"),s=t("./_baseFindIndex"),a=t("./_baseIteratee"),u=t("./isArray");e.exports=r},{"./_baseEach":26,"./_baseFind":28,"./_baseFindIndex":29,"./_baseIteratee":38,"./isArray":99}],95:[function(t,e,n){function r(t,e,n){var r=null==t?void 0:i(t,e);return void 0===r?n:r}var i=t("./_baseGet");e.exports=r},{"./_baseGet":32}],96:[function(t,e,n){function r(t,e){return o(t,e,i)}var i=t("./_baseHasIn"),o=t("./_hasPath");e.exports=r},{"./_baseHasIn":34,"./_hasPath":62}],97:[function(t,e,n){function r(t){return t}e.exports=r},{}],98:[function(t,e,n){function r(t){return i(t)&&a.call(t,"callee")&&(!c.call(t,"callee")||u.call(t)==o)}var i=t("./isArrayLikeObject"),o="[object Arguments]",s=Object.prototype,a=s.hasOwnProperty,u=s.toString,c=s.propertyIsEnumerable;e.exports=r},{"./isArrayLikeObject":101}],99:[function(t,e,n){var r=Array.isArray;e.exports=r},{}],100:[function(t,e,n){function r(t){return null!=t&&s(i(t))&&!o(t)}var i=t("./_getLength"),o=t("./isFunction"),s=t("./isLength");e.exports=r},{"./_getLength":58,"./isFunction":102,"./isLength":103}],101:[function(t,e,n){function r(t){return o(t)&&i(t)}var i=t("./isArrayLike"),o=t("./isObjectLike");e.exports=r},{"./isArrayLike":100,"./isObjectLike":106}],102:[function(t,e,n){function r(t){var e=i(t)?u.call(t):"";return e==o||e==s}var i=t("./isObject"),o="[object Function]",s="[object GeneratorFunction]",a=Object.prototype,u=a.toString;e.exports=r},{"./isObject":105}],103:[function(t,e,n){function r(t){return"number"==typeof t&&t>-1&&t%1==0&&i>=t}var i=9007199254740991;e.exports=r},{}],104:[function(t,e,n){function r(t){return null==t?!1:i(t)?f.test(h.call(t)):s(t)&&(o(t)?f:u).test(t)}var i=t("./isFunction"),o=t("./_isHostObject"),s=t("./isObjectLike"),a=/[\\^$.*+?()[\]{}|]/g,u=/^\[object .+?Constructor\]$/,c=Object.prototype,h=Function.prototype.toString,l=c.hasOwnProperty,f=RegExp("^"+h.call(l).replace(a,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");e.exports=r},{"./_isHostObject":68,"./isFunction":102,"./isObjectLike":106}],105:[function(t,e,n){function r(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}e.exports=r},{}],106:[function(t,e,n){function r(t){return!!t&&"object"==typeof t}e.exports=r},{}],107:[function(t,e,n){function r(t){return"string"==typeof t||!i(t)&&o(t)&&u.call(t)==s}var i=t("./isArray"),o=t("./isObjectLike"),s="[object String]",a=Object.prototype,u=a.toString;e.exports=r},{"./isArray":99,"./isObjectLike":106}],108:[function(t,e,n){function r(t){return"symbol"==typeof t||i(t)&&a.call(t)==o}var i=t("./isObjectLike"),o="[object Symbol]",s=Object.prototype,a=s.toString;e.exports=r},{"./isObjectLike":106}],109:[function(t,e,n){function r(t){return o(t)&&i(t.length)&&!!C[R.call(t)]}var i=t("./isLength"),o=t("./isObjectLike"),s="[object Arguments]",a="[object Array]",u="[object Boolean]",c="[object Date]",h="[object Error]",l="[object Function]",f="[object Map]",p="[object Number]",d="[object Object]",v="[object RegExp]",g="[object Set]",_="[object String]",m="[object WeakMap]",y="[object ArrayBuffer]",b="[object Float32Array]",S="[object Float64Array]",w="[object Int8Array]",T="[object Int16Array]",x="[object Int32Array]",O="[object Uint8Array]",E="[object Uint8ClampedArray]",I="[object Uint16Array]",A="[object Uint32Array]",C={};C[b]=C[S]=C[w]=C[T]=C[x]=C[O]=C[E]=C[I]=C[A]=!0,C[s]=C[a]=C[y]=C[u]=C[c]=C[h]=C[l]=C[f]=C[p]=C[d]=C[v]=C[g]=C[_]=C[m]=!1;var j=Object.prototype,R=j.toString;e.exports=r},{"./isLength":103,"./isObjectLike":106}],110:[function(t,e,n){function r(t){var e=c(t);if(!e&&!a(t))return o(t);var n=s(t),r=!!n,h=n||[],l=h.length;for(var f in t)!i(t,f)||r&&("length"==f||u(f,l))||e&&"constructor"==f||h.push(f);return h}var i=t("./_baseHas"),o=t("./_baseKeys"),s=t("./_indexKeys"),a=t("./isArrayLike"),u=t("./_isIndex"),c=t("./_isPrototype");e.exports=r},{"./_baseHas":33,"./_baseKeys":39,"./_indexKeys":67,"./_isIndex":69,"./_isPrototype":73,"./isArrayLike":100}],111:[function(t,e,n){function r(t){var e=t?t.length:0;return e?t[e-1]:void 0}e.exports=r},{}],112:[function(t,e,n){function r(t){return s(t)?i(t):o(t)}var i=t("./_baseProperty"),o=t("./_basePropertyDeep"),s=t("./_isKey");e.exports=r},{"./_baseProperty":42,"./_basePropertyDeep":43,"./_isKey":71}],113:[function(t,e,n){function r(t,e,n){if(n&&"boolean"!=typeof n&&o(t,e,n)&&(e=n=void 0),void 0===n&&("boolean"==typeof e?(n=e,e=void 0):"boolean"==typeof t&&(n=t,t=void 0)),void 0===t&&void 0===e?(t=0,e=1):(t=s(t)||0,void 0===e?(e=t,t=0):e=s(e)||0),t>e){var r=t;t=e,e=r}if(n||t%1||e%1){var h=c();return u(t+h*(e-t+a("1e-"+((h+"").length-1))),e)}return i(t,e)}var i=t("./_baseRandom"),o=t("./_isIterateeCall"),s=t("./toNumber"),a=parseFloat,u=Math.min,c=Math.random;e.exports=r},{"./_baseRandom":45,"./_isIterateeCall":70,"./toNumber":117}],114:[function(t,e,n){function r(t,e){var n=[];if(!t||!t.length)return n;var r=-1,s=[],a=t.length;for(e=i(e,3);++rt?-1:1;return e*s}var n=t%1;return t===t?n?t-n:t:0}var i=t("./toNumber"),o=1/0,s=1.7976931348623157e308;e.exports=r},{"./toNumber":117}],117:[function(t,e,n){function r(t){if(o(t)){var e=i(t.valueOf)?t.valueOf():t;t=o(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(a,"");var n=c.test(t);return n||h.test(t)?l(t.slice(2),n?2:8):u.test(t)?s:+t}var i=t("./isFunction"),o=t("./isObject"),s=NaN,a=/^\s+|\s+$/g,u=/^[-+]0x[0-9a-f]+$/i,c=/^0b[01]+$/i,h=/^0o[0-7]+$/i,l=parseInt;e.exports=r},{"./isFunction":102,"./isObject":105}],118:[function(t,e,n){function r(t){return i(t,o(t))}var i=t("./_baseToPairs"),o=t("./keys");e.exports=r},{"./_baseToPairs":48,"./keys":110}],119:[function(t,e,n){function r(t){if("string"==typeof t)return t;if(null==t)return"";if(o(t))return u?u.call(t):"";var e=t+"";return"0"==e&&1/t==-s?"-0":e}var i=t("./_Symbol"),o=t("./isSymbol"),s=1/0,a=i?i.prototype:void 0,u=a?a.toString:void 0;e.exports=r},{"./_Symbol":12,"./isSymbol":108}],120:[function(t,e,n){(function(n){for(var r=t("performance-now"),i="undefined"==typeof window?n:window,o=["moz","webkit"],s="AnimationFrame",a=i["request"+s],u=i["cancel"+s]||i["cancelRequest"+s],c=0;!a&&c0;)this._idleSpringIndices.pop();for(var n=0,r=this._activeSprings.length;r>n;n++){var i=this._activeSprings[n];i.systemShouldAdvance()?i.advance(t/1e3,e/1e3):this._idleSpringIndices.push(this._activeSprings.indexOf(i))}for(;this._idleSpringIndices.length>0;){var o=this._idleSpringIndices.pop();o>=0&&this._activeSprings.splice(o,1)}},loop:function(t){var e;-1===this._lastTimeMillis&&(this._lastTimeMillis=t-1);var n=t-this._lastTimeMillis;this._lastTimeMillis=t;var r=0,i=this.listeners.length;for(r=0;i>r;r++)e=this.listeners[r],e.onBeforeIntegrate&&e.onBeforeIntegrate(this);for(this.advance(t,n),0===this._activeSprings.length&&(this._isIdle=!0,this._lastTimeMillis=-1),r=0;i>r;r++)e=this.listeners[r],e.onAfterIntegrate&&e.onAfterIntegrate(this);this._isIdle||this.looper.run()},activateSpring:function(t){var e=this._springRegistry[t];-1==this._activeSprings.indexOf(e)&&this._activeSprings.push(e),this.getIsIdle()&&(this._isIdle=!1,this.looper.run())},addListener:function(t){this.listeners.push(t)},removeListener:function(t){e(this.listeners,t)},removeAllListeners:function(){this.listeners=[]}});var u=r.Spring=function _(t){this._id="s"+_._ID++,this._springSystem=t,this.listeners=[],this._currentState=new c,this._previousState=new c,this._tempState=new c};i.extend(u,{_ID:0,MAX_DELTA_TIME_SEC:.064,SOLVER_TIMESTEP_SEC:.001}),i.extend(u.prototype,{_id:0,_springConfig:null,_overshootClampingEnabled:!1,_currentState:null,_previousState:null,_tempState:null,_startValue:0,_endValue:0,_wasAtRest:!0,_restSpeedThreshold:.001,_displacementFromRestThreshold:.001,listeners:null,_timeAccumulator:0,_springSystem:null,destroy:function(){this.listeners=[],this.frames=[],this._springSystem.deregisterSpring(this)},getId:function(){return this._id},setSpringConfig:function(t){return this._springConfig=t,this},getSpringConfig:function(){return this._springConfig},setCurrentValue:function(t,e){return this._startValue=t,this._currentState.position=t,e||this.setAtRest(),this.notifyPositionUpdated(!1,!1),this},getStartValue:function(){return this._startValue},getCurrentValue:function(){return this._currentState.position},getCurrentDisplacementDistance:function(){return this.getDisplacementDistanceForState(this._currentState)},getDisplacementDistanceForState:function(t){return Math.abs(this._endValue-t.position)},setEndValue:function(t){if(this._endValue==t&&this.isAtRest())return this;this._startValue=this.getCurrentValue(),this._endValue=t,this._springSystem.activateSpring(this.getId());for(var e=0,n=this.listeners.length;n>e;e++){var r=this.listeners[e],i=r.onSpringEndStateChange;i&&i(this)}return this},getEndValue:function(){return this._endValue},setVelocity:function(t){return t===this._currentState.velocity?this:(this._currentState.velocity=t,this._springSystem.activateSpring(this.getId()),this)},getVelocity:function(){return this._currentState.velocity},setRestSpeedThreshold:function(t){return this._restSpeedThreshold=t,this},getRestSpeedThreshold:function(){return this._restSpeedThreshold},setRestDisplacementThreshold:function(t){this._displacementFromRestThreshold=t},getRestDisplacementThreshold:function(){return this._displacementFromRestThreshold},setOvershootClampingEnabled:function(t){return this._overshootClampingEnabled=t,this},isOvershootClampingEnabled:function(){return this._overshootClampingEnabled},isOvershooting:function(){var t=this._startValue,e=this._endValue;return this._springConfig.tension>0&&(e>t&&this.getCurrentValue()>e||t>e&&this.getCurrentValue()u.MAX_DELTA_TIME_SEC&&(r=u.MAX_DELTA_TIME_SEC),this._timeAccumulator+=r;for(var i,o,s,a,c,h,l,f,p,d,v=this._springConfig.tension,g=this._springConfig.friction,_=this._currentState.position,m=this._currentState.velocity,y=this._tempState.position,b=this._tempState.velocity;this._timeAccumulator>=u.SOLVER_TIMESTEP_SEC;)this._timeAccumulator-=u.SOLVER_TIMESTEP_SEC,this._timeAccumulator0&&this._interpolate(this._timeAccumulator/u.SOLVER_TIMESTEP_SEC),(this.isAtRest()||this._overshootClampingEnabled&&this.isOvershooting())&&(this._springConfig.tension>0?(this._startValue=this._endValue,this._currentState.position=this._endValue):(this._endValue=this._currentState.position,this._startValue=this._endValue),this.setVelocity(0),n=!0);var S=!1;this._wasAtRest&&(this._wasAtRest=!1,S=!0);var w=!1;n&&(this._wasAtRest=!0,w=!0),this.notifyPositionUpdated(S,w)}},notifyPositionUpdated:function(t,e){for(var n=0,r=this.listeners.length;r>n;n++){var i=this.listeners[n];t&&i.onSpringActivate&&i.onSpringActivate(this),i.onSpringUpdate&&i.onSpringUpdate(this),e&&i.onSpringAtRest&&i.onSpringAtRest(this)}},systemShouldAdvance:function(){return!this.isAtRest()||!this.wasAtRest()},wasAtRest:function(){return this._wasAtRest},isAtRest:function(){return Math.abs(this._currentState.velocity)=t?this.b3Friction1(t):t>18&&44>=t?this.b3Friction2(t):this.b3Friction3(t)}}),i.extend(h,{fromOrigamiTensionAndFriction:function(t,e){return new h(f.tensionFromOrigamiValue(t),f.frictionFromOrigamiValue(e))},fromBouncinessAndSpeed:function(t,e){var n=new r.BouncyConversion(t,e);return this.fromOrigamiTensionAndFriction(n.bouncyTension,n.bouncyFriction)},coastingConfigWithOrigamiFriction:function(t){return new h(0,f.frictionFromOrigamiValue(t))}}),h.DEFAULT_ORIGAMI_SPRING_CONFIG=h.fromOrigamiTensionAndFriction(40,7),i.extend(h.prototype,{friction:0,tension:0});var d={};i.hexToRGB=function(t){if(d[t])return d[t];t=t.replace("#",""),3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]);var e=t.match(/.{2}/g),n={r:parseInt(e[0],16),g:parseInt(e[1],16),b:parseInt(e[2],16)};return d[t]=n,n},i.rgbToHex=function(t,e,n){return t=t.toString(16),e=e.toString(16),n=n.toString(16),t=t.length<2?"0"+t:t,e=e.length<2?"0"+e:e,n=n.length<2?"0"+n:n,"#"+t+e+n};var v=r.MathUtil={mapValueInRange:function(t,e,n,r,i){var o=n-e,s=i-r,a=(t-e)/o;return r+a*s},interpolateColor:function(t,e,n,r,o,s){r=void 0===r?0:r,o=void 0===o?1:o,e=i.hexToRGB(e),n=i.hexToRGB(n);var a=Math.floor(i.mapValueInRange(t,r,o,e.r,n.r)),u=Math.floor(i.mapValueInRange(t,r,o,e.g,n.g)),c=Math.floor(i.mapValueInRange(t,r,o,e.b,n.b));return s?"rgb("+a+","+u+","+c+")":i.rgbToHex(a,u,c)},degreesToRadians:function(t){return t*Math.PI/180},radiansToDegrees:function(t){return 180*t/Math.PI}};i.extend(i,v);var g;"undefined"!=typeof window&&(g=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame||window.oRequestAnimationFrame||function(t){window.setTimeout(t,1e3/60)}),g||"undefined"==typeof t||"node"!==t.title||(g=setImmediate),i.onFrame=function(t){return g(t)},"undefined"!=typeof n?i.extend(n,r):"undefined"!=typeof window&&(window.rebound=r)}()}).call(this,t("1YiZ5S"))},{"1YiZ5S":1}],123:[function(t,e,n){(function(t){function n(){var t={},e={};return t.on=function(t,n){var r={name:t,handler:n};return e[t]=e[t]||[],e[t].unshift(r),r},t.off=function(t){var n=e[t.name].indexOf(t);-1!=n&&e[t.name].splice(n,1)},t.trigger=function(t,n){var r,i=e[t];if(i)for(r=i.length;r--;)i[r].handler(n)},t}t.gajus=t.gajus||{},t.gajus.Sister=n,e.exports=n}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],124:[function(t,e,n){"use strict";function r(t){return t in h?h[t]:h[t]=i(t)}function i(t){var e,n=t.replace(/-([a-z])/g,function(t,e){return e.toUpperCase()}),r=u.length;if(void 0!==a[n])return n;for(n=o(t);r--;)if(e=u[r]+n,void 0!==a[e])return e;throw new Error("unable to prefix "+t)}function o(t){return t.charAt(0).toUpperCase()+t.slice(1)}function s(t){var e=r(t),n=/([A-Z])/g;return n.test(e)&&(e=(c.test(e)?"-":"")+e.replace(n,"-$1")),e.toLowerCase()}var a=document.createElement("p").style,u="O ms Moz webkit".split(" "),c=/^(o|ms|moz|webkit)/,h={};e.exports=r,e.exports.dash=s},{}],125:[function(t,e,n){var r=t("swing");!function(t,e,n){"use strict";t.module("gajus.swing",[]),t.module("gajus.swing").factory("swingStacks",function(){return{stacks:[],getTopCardFromStack:function(t){return this.stacks[t]?this.stacks[t].cards[this.countCardsInStack(t)-1]:null},getCardFromStack:function(t,e){return this.stacks[t]&&this.stacks[t].cards[e]?this.stacks[t].cards[e]:null},countCardsInStack:function(t){return this.stacks[t]?this.stacks[t].cards.length:-1},Card:e.Card,Stack:e.Stack}}),t.module("gajus.swing").directive("swingStack",["$parse","swingStacks",function(n,r){var i=0;return{restrict:"A",controller:["$scope","$element","$attrs",function(o,s,a){var u,c={},h=n(a.swingOptions)(o);t.extend(c,h),u=e.Stack(c),this.add=function(t){var e=u.createCard(t);return r.stacks[this.index].cards.push(e),e},this.index=i++,r.stacks.push({cards:[]})}]}}]),t.module("gajus.swing").directive("swingCard",function(){return{restrict:"A",require:"^swingStack",scope:{swingOnThrowout:"&",swingOnThrowoutleft:"&",swingOnThrowoutright:"&",swingOnThrowin:"&",swingOnDragstart:"&",swingOnDragmove:"&",swingOnDragend:"&"},link:function(e,n,r,i){var o=i.add(n[0]),s=["throwout","throwoutleft","throwoutright","throwin","dragstart","dragmove","dragend"];t.forEach(s,function(t){o.on(t,function(n){var r="swingOn"+t.charAt(0).toUpperCase()+t.slice(1);switch(e[r]({eventName:t,eventObject:n}),r){case"swingOnThrowoutleft":case"swingOnThrowoutright":case"swingOnThrowout":e.$$phase&&e.$apply()}})})}}})}(angular,r)},{swing:3}]},{},[125]); \ No newline at end of file diff --git a/examples/card-stack/card-stack.css b/examples/card-stack/card-stack.css index 53c0996..e7c7c2d 100644 --- a/examples/card-stack/card-stack.css +++ b/examples/card-stack/card-stack.css @@ -1,4 +1,7 @@ -html, body, ul, li { +html, +body, +ul, +li { margin: 0; padding: 0; } @@ -6,7 +9,9 @@ body { background: #FCD424; font: normal 16px/24px 'Helvetica Neue', Helvetica, Arial, freesans, sans-serif; } -button, input, code { +button, +input, +code { display: inline-block; outline: none; font: inherit; @@ -87,6 +92,17 @@ input { color: #FFFFFF; bottom: -2px; box-shadow: none; } + #viewport .left, #viewport .right { + position: absolute; + bottom: 0; + background: #FCD424; + padding: 10px; + cursor: pointer; + text-transform: uppercase; } + #viewport .right { + right: 0; } + #viewport .left { + left: 0; } #source { width: 500px; diff --git a/examples/card-stack/card-stack.js b/examples/card-stack/card-stack.js index f4ff97b..cf9b0c8 100644 --- a/examples/card-stack/card-stack.js +++ b/examples/card-stack/card-stack.js @@ -1,6 +1,6 @@ angular .module('card-stack-demo', ['gajus.swing']) - .controller('card-stack-playground', function ($scope) { + .controller('card-stack-playground', function ($scope, swingStacks) { $scope.cards = [ {name: 'clubs', symbol: '♣'}, {name: 'diamonds', symbol: '♦'}, @@ -46,4 +46,13 @@ angular return throwOutConfidence === 1; } }; + + $scope.topthrowoutleft = function() { + var card = swingStacks.getTopCardFromStack(0); + card.throwOut(swingStacks.Card.DIRECTION_LEFT, 0); + }; + $scope.topthrowoutright = function() { + var card = swingStacks.getTopCardFromStack(0); + card.throwOut(swingStacks.Card.DIRECTION_RIGHT, 0); + }; }); diff --git a/examples/card-stack/card-stack.scss b/examples/card-stack/card-stack.scss index 2922fe5..9e20969 100644 --- a/examples/card-stack/card-stack.scss +++ b/examples/card-stack/card-stack.scss @@ -61,7 +61,7 @@ input { background: #FFFFFF; color: #373737; font-weight: bold; border: none; font: normal 18px/24px 'Helvetica Neue', Helvetica, Arial, freesans, sans-serif; margin: 0 5px; padding: 10px 15px; cursor: pointer; box-shadow: 0 2px 0 #63211F; outline: none; position: relative; &:hover { - + } &:active { @@ -69,6 +69,21 @@ input { } } } + + .left, .right { + position: absolute; + bottom: 0; + background: #FCD424; + padding: 10px; + cursor: pointer; + text-transform: uppercase; + } + .right { + right: 0; + } + .left { + left: 0; + } } #source { @@ -77,4 +92,4 @@ input { a { color: #C7433E; } -} \ No newline at end of file +} diff --git a/examples/card-stack/index.html b/examples/card-stack/index.html index 17340e6..7d18869 100644 --- a/examples/card-stack/index.html +++ b/examples/card-stack/index.html @@ -9,8 +9,8 @@ - -
+ +
  • {{card.symbol}}
+
← Left
+
Right →

Drag the playing cards out of the stack and let go. Dragging them beyond the desk will throw them out of the stack. If you drag too little and let go, the cards will spring back into place. You can throw cards back into the stack after you have thrown them out.

diff --git a/src/angular-swing.js b/src/angular-swing.js index b4ddf42..d017c57 100644 --- a/src/angular-swing.js +++ b/src/angular-swing.js @@ -6,7 +6,34 @@ var Swing = require('swing'); angular.module('gajus.swing', []); - angular.module('gajus.swing').directive('swingStack', /* @ngInject */ function ($parse) { + angular.module('gajus.swing').factory('swingStacks', function() { + return { + stacks: [], + getTopCardFromStack: function(stackIndex) { + if (this.stacks[stackIndex]) { + return this.stacks[stackIndex].cards[this.countCardsInStack(stackIndex) - 1]; + } + return null; + }, + getCardFromStack: function(stackIndex, cardIndex) { + if (this.stacks[stackIndex] && this.stacks[stackIndex].cards[cardIndex]) { + return this.stacks[stackIndex].cards[cardIndex]; + } + return null; + }, + countCardsInStack: function(stackIndex) { + if (this.stacks[stackIndex]) { + return this.stacks[stackIndex].cards.length; + } + return -1; + }, + Card: Swing.Card, + Stack: Swing.Stack + }; + }); + + angular.module('gajus.swing').directive('swingStack', /* @ngInject */ function ($parse, swingStacks) { + var stackIndex = 0; return { restrict: 'A', controller: /* @ngInject */ function ($scope, $element, $attrs) { @@ -20,8 +47,13 @@ var Swing = require('swing'); stack = Swing.Stack(defaultOptions); this.add = function (cardElement) { - return stack.createCard(cardElement); + var thecard = stack.createCard(cardElement); + swingStacks.stacks[this.index].cards.push(thecard); + return thecard; }; + + this.index = stackIndex++; + swingStacks.stacks.push({cards: []}); } }; }); @@ -49,10 +81,22 @@ var Swing = require('swing'); // @see https://docs.angularjs.org/api/ng/service/$compile#comprehensive-directive-api angular.forEach(events, function (eventName) { card.on(eventName, function (eventObject) { - scope['swingOn' + eventName.charAt(0).toUpperCase() + eventName.slice(1)]({ + var swingEventName = 'swingOn' + eventName.charAt(0).toUpperCase() + eventName.slice(1); + scope[swingEventName]({ eventName: eventName, eventObject: eventObject }); + switch(swingEventName) { + case 'swingOnThrowoutleft': + case 'swingOnThrowoutright': + case 'swingOnThrowout': + if(scope.$$phase) { + scope.$apply(); + } + break; + default: + break; + } }); }); }