diff --git a/addon/initializers/emberfire.js b/addon/initializers/emberfire.js index e7d97441..349585b1 100644 --- a/addon/initializers/emberfire.js +++ b/addon/initializers/emberfire.js @@ -5,7 +5,7 @@ import FirebaseAdapter from '../adapters/firebase'; import FirebaseSerializer from '../serializers/firebase'; import forEach from 'lodash/collection/forEach'; -var VERSION = '0.0.0'; +var VERSION = '1.6.6'; if (Ember.libraries) { if (Firebase.SDK_VERSION) { diff --git a/bower.json b/bower.json index 6c2c51ba..f12de448 100644 --- a/bower.json +++ b/bower.json @@ -1,7 +1,7 @@ { "name": "emberfire", "description": "The officially supported Ember binding for Firebase", - "version": "0.0.0", + "version": "1.6.6", "authors": [ "Firebase (https://www.firebase.com/)" ], diff --git a/dist/emberfire.js b/dist/emberfire.js new file mode 100644 index 00000000..a9fd52f2 --- /dev/null +++ b/dist/emberfire.js @@ -0,0 +1,4039 @@ +/*! + * EmberFire is the officially supported adapter for using Firebase with + * Ember Data. The DS.FirebaseAdapter provides all of the standard DS.Adapter + * methods and will automatically synchronize the store with Firebase. + * + * EmberFire 1.6.6 + * https://github.com/firebase/emberfire/ + * License: MIT + */ + + /** + * @license + * lodash 3.10.0 (Custom Build) + * Build: `lodash modularize modern exports="es" -o ./` + * Copyright 2012-2015 The Dojo Foundation + * Based on Underscore.js 1.8.3 + * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ +(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o.firebaseio.com/') + * }); + * ``` + * + * Requests for `App.Post` now target `https://.firebaseio.com/posts`. + * + * @property firebase + * @type {Firebase} + * @constructor + */ + init: function init() { + this._super.apply(this, arguments); + + var firebase = this.get('firebase'); + if (!firebase || typeof firebase !== 'object') { + throw new Error('Please set the `firebase` property on the adapter.'); + } + // If provided Firebase reference was a query (eg: limits), make it a ref. + this._ref = firebase.ref(); + // Keep track of what types `.findAll()` has been called for + this._findAllMapForType = {}; + // Keep a cache to check modified relationships against + this._recordCacheForType = {}; + // Used to batch records into the store + this._queue = []; + }, + + /** + * Uses push() to generate chronologically ordered unique IDs. + * + * @return {String} + */ + generateIdForRecord: function generateIdForRecord() { + return this._getKey(this._ref.push()); + }, + + /** + * Use the Firebase DataSnapshot's key as the record id + * + * @param {Object} snapshot - A Firebase snapshot + * @param {Object} payload - The payload that will be pushed into the store + * @return {Object} payload + */ + _assignIdToPayload: function _assignIdToPayload(snapshot) { + var payload = snapshot.val(); + if (payload !== null && typeof payload === 'object' && typeof payload.id === 'undefined') { + payload.id = this._getKey(snapshot); + } + return payload; + }, + + /** + * Called by the store to retrieve the JSON for a given type and ID. The + * method will return a promise which will resolve when the value is + * successfully fetched from Firebase. + * + * Additionally, from this point on, the object's value in the store will + * also be automatically updated whenever the remote value changes. + */ + findRecord: function findRecord(store, typeClass, id) { + var _this = this; + + var ref = this._getCollectionRef(typeClass, id); + + var log = 'DS: FirebaseAdapter#findRecord ' + typeClass.modelName + ' to ' + ref.toString(); + + return this._fetch(ref, log).then(function (snapshot) { + var payload = _this._assignIdToPayload(snapshot); + _this._updateRecordCacheForType(typeClass, payload); + if (payload === null) { + var error = new Error('no record was found at ' + ref.toString()); + error.recordId = id; + throw error; + } + + return payload; + }); + }, + + /** + * Promise interface for once('value') that also handle test waiters. + * + * @param {Firebase} ref + * @param {String} log + * @return {Promise} + * @private + */ + _fetch: function _fetch(ref, log) { + var _this2 = this; + + this._incrementWaiters(); + return new Promise(function (resolve, reject) { + + ref.once('value', function (snapshot) { + _this2._decrementWaiters(); + _ember2['default'].run(null, resolve, snapshot); + }, function (err) { + _this2._decrementWaiters(); + _ember2['default'].run(null, reject, err); + }); + }, log); + }, + + recordWasPushed: function recordWasPushed(store, modelName, record) { + if (!record.__listening) { + var typeClass = store.modelFor(modelName); + this.listenForChanges(store, typeClass, record); + } + }, + + recordWillUnload: function recordWillUnload(store, record) { + if (record.__listening) { + this.stopListening(store, record.constructor, record); + } + }, + + recordWillDelete: function recordWillDelete(store, record) { + var _this3 = this; + + record.eachRelationship(function (key, relationship) { + if (relationship.kind === 'belongsTo') { + var parentRecord = record.get(relationship.key); + var inverseKey = record.inverseFor(relationship.key); + if (inverseKey && parentRecord.get('id')) { + var parentRef = _this3._getCollectionRef(inverseKey.type, parentRecord.get('id')); + _this3._removeHasManyRecord(store, parentRef, inverseKey.name, record.id); + } + } + }); + }, + + listenForChanges: function listenForChanges(store, typeClass, record) { + var _this4 = this; + + // embedded records will get their changes from parent listeners + if (!this.isRecordEmbedded(record)) { + record.__listening = true; + var ref = this._getCollectionRef(typeClass, record.id); + var called = false; + ref.on('value', function (snapshot) { + if (called) { + _ember2['default'].run(function () { + _this4._handleChildValue(store, typeClass, snapshot); + }); + } + called = true; + }, function (error) { + _ember2['default'].Logger.error(error); + }); + } + }, + + stopListening: function stopListening(store, typeClass, record) { + if (record.__listening) { + var ref = this._getCollectionRef(typeClass, record.id); + ref.off('value'); + record.__listening = false; + } + }, + + /** + * Called by the store to retrieve the JSON for all of the records for a + * given type. The method will return a promise which will resolve when the + * value is successfully fetched from Firebase. + * + * Additionally, from this point on, any records of this type that are added, + * removed or modified from Firebase will automatically be reflected in the + * store. + */ + findAll: function findAll(store, typeClass) { + var _this5 = this; + + var ref = this._getCollectionRef(typeClass); + + var log = 'DS: FirebaseAdapter#findAll ' + typeClass.modelName + ' to ' + ref.toString(); + + return this._fetch(ref, log).then(function (snapshot) { + if (!_this5._findAllHasEventsForType(typeClass)) { + _this5._findAllAddEventListeners(store, typeClass, ref); + } + var results = []; + snapshot.forEach(function (childSnapshot) { + var payload = _this5._assignIdToPayload(childSnapshot); + _this5._updateRecordCacheForType(typeClass, payload); + results.push(payload); + }); + + return results; + }); + }, + + query: function query(store, typeClass, _query, recordArray) { + var _this6 = this; + + var ref = this._getCollectionRef(typeClass); + var modelName = typeClass.modelName; + + ref = this.applyQueryToRef(ref, _query); + + ref.on('child_added', _ember2['default'].run.bind(this, function (snapshot) { + var record = store.peekRecord(modelName, snapshot.key()); + + if (!record || !record.__listening) { + var payload = this._assignIdToPayload(snapshot); + var normalizedData = store.normalize(typeClass.modelName, payload); + this._updateRecordCacheForType(typeClass, payload); + record = store.push(normalizedData); + } + + if (record) { + recordArray.get('content').addObject(record._internalModel); + } + })); + + // `child_changed` is already handled by the record's + // value listener after a store.push. `child_moved` is + // a much less common case because it relates to priority + + ref.on('child_removed', _ember2['default'].run.bind(this, function (snapshot) { + var record = store.peekRecord(modelName, snapshot.key()); + if (record) { + recordArray.get('content').removeObject(record._internalModel); + } + })); + + // clean up event handlers when the array is being destroyed + // so that future firebase events wont keep trying to use a + // destroyed store/serializer + recordArray.__firebaseCleanup = function () { + ref.off('child_added'); + ref.off('child_removed'); + }; + + var log = 'DS: FirebaseAdapter#query ' + modelName + ' with ' + _query; + + return this._fetch(ref, log).then(function (snapshot) { + if (!_this6._findAllHasEventsForType(typeClass)) { + _this6._findAllAddEventListeners(store, typeClass, ref); + } + var results = []; + snapshot.forEach(function (childSnapshot) { + var payload = _this6._assignIdToPayload(childSnapshot); + _this6._updateRecordCacheForType(typeClass, payload); + results.push(payload); + }); + return results; + }); + }, + + applyQueryToRef: function applyQueryToRef(ref, query) { + + if (!query.orderBy) { + query.orderBy = '_key'; + } + + if (query.orderBy === '_key') { + ref = ref.orderByKey(); + } else if (query.orderBy === '_value') { + ref = ref.orderByValue(); + } else if (query.orderBy === '_priority') { + ref = ref.orderByPriority(); + } else { + ref = ref.orderByChild(query.orderBy); + } + + ['limitToFirst', 'limitToLast', 'startAt', 'endAt', 'equalTo'].forEach(function (key) { + if (query[key] || query[key] === '' || query[key] === false) { + ref = ref[key](query[key]); + } + }); + + return ref; + }, + + /** + * Keep track of what types `.findAll()` has been called for + * so duplicate listeners aren't added + */ + _findAllMapForType: undefined, + + /** + * Determine if the current type is already listening for children events + */ + _findAllHasEventsForType: function _findAllHasEventsForType(typeClass) { + return !_ember2['default'].isNone(this._findAllMapForType[typeClass.modelName]); + }, + + /** + * After `.findAll()` is called on a modelName, continue to listen for + * `child_added`, `child_removed`, and `child_changed` + */ + _findAllAddEventListeners: function _findAllAddEventListeners(store, typeClass, ref) { + var modelName = typeClass.modelName; + this._findAllMapForType[modelName] = true; + + ref.on('child_added', _ember2['default'].run.bind(this, function (snapshot) { + if (!store.hasRecordForId(modelName, this._getKey(snapshot))) { + this._handleChildValue(store, typeClass, snapshot); + } + })); + }, + + /** + * Push a new child record into the store + */ + _handleChildValue: function _handleChildValue(store, typeClass, snapshot) { + // No idea why we need this, we are already turning off the callback by + // calling ref.off in recordWillUnload. Something is fishy here + if (store.isDestroying) { + return; + } + var value = snapshot.val(); + if (value === null) { + var id = this._getKey(snapshot); + var record = store.peekRecord(typeClass.modelName, id); + // TODO: refactor using ED + if (!record.get('isDeleted')) { + record.deleteRecord(); + } + } else { + var payload = this._assignIdToPayload(snapshot); + + this._enqueue(function FirebaseAdapter$enqueueStorePush() { + if (!store.isDestroying) { + var normalizedData = store.normalize(typeClass.modelName, payload); + store.push(normalizedData); + } + }); + } + }, + + /** + * `createRecord` is an alias for `updateRecord` because calling \ + * `ref.set()` would wipe out any existing relationships + */ + createRecord: function createRecord(store, typeClass, snapshot) { + var _this7 = this; + + return this.updateRecord(store, typeClass, snapshot).then(function () { + _this7.listenForChanges(store, typeClass, snapshot.record); + }); + }, + + /** + * Called by the store when a record is created/updated via the `save` + * method on a model record instance. + * + * The `updateRecord` method serializes the record and performs an `update()` + * at the the Firebase location and a `.set()` at any relationship locations + * The method will return a promise which will be resolved when the data and + * any relationships have been successfully saved to Firebase. + * + * We take an optional record reference, in order for this method to be usable + * for saving nested records as well. + */ + updateRecord: function updateRecord(store, typeClass, snapshot) { + var _this8 = this; + + var recordRef = this._getAbsoluteRef(snapshot.record); + var recordCache = this._getRecordCache(typeClass, snapshot.id); + var pathPieces = recordRef.path.toString().split('/'); + var lastPiece = pathPieces[pathPieces.length - 1]; + var serializedRecord = snapshot.serialize({ + includeId: lastPiece !== snapshot.id // record has no firebase `key` in path + }); + var serializer = store.serializerFor(typeClass.modelName); + + return new Promise(function (resolve, reject) { + var relationshipsToSave = []; + // first we remove all relationships data from the serialized record, we backup the + // removed data so that we can save it at a later stage. + snapshot.record.eachRelationship(function (key, relationship) { + var relationshipKey = serializer.keyForRelationship(key); + var data = serializedRecord[relationshipKey]; + var isEmbedded = _this8.isRelationshipEmbedded(store, typeClass.modelName, relationship); + var hasMany = relationship.kind === 'hasMany'; + if (hasMany || isEmbedded) { + if (!_ember2['default'].isNone(data)) { + relationshipsToSave.push({ + data: data, + relationship: relationship, + isEmbedded: isEmbedded, + hasMany: hasMany + }); + } + delete serializedRecord[relationshipKey]; + } + }); + var reportError = function reportError(errors) { + var error = new Error('Some errors were encountered while saving ' + typeClass + ' ' + snapshot.id); + error.errors = errors; + reject(error); + }; + _this8._updateRecord(recordRef, serializedRecord).then(function () { + // and now we construct the list of promise to save relationships. + var savedRelationships = relationshipsToSave.map(function (relationshipToSave) { + var data = relationshipToSave.data; + var relationship = relationshipToSave.relationship; + if (relationshipToSave.hasMany) { + return _this8._saveHasManyRelationship(store, typeClass, relationship, data, recordRef, recordCache); + } else { + // embedded belongsTo, we need to fill in the informations. + if (relationshipToSave.isEmbedded) { + return _this8._saveEmbeddedBelongsToRecord(store, typeClass, relationship, data, recordRef); + } + } + }); + return _ember2['default'].RSVP.allSettled(savedRelationships); + })['catch'](function (e) { + reportError([e]); + }).then(function (results) { + var rejected = _ember2['default'].A(results).filterBy('state', 'rejected'); + if (rejected.length !== 0) { + reportError(rejected.mapBy('reason').toArray()); + } else { + resolve(); + } + }); + }, 'DS: FirebaseAdapter#updateRecord ' + typeClass + ' to ' + recordRef.toString()); + }, + + /** + * Update a single record without caring for the relationships + * @param {Firebase} recordRef + * @param {Object} serializedRecord + * @return {Promise} + */ + _updateRecord: function _updateRecord(recordRef, serializedRecord) { + return (0, _utilsToPromise2['default'])(recordRef.update, recordRef, [serializedRecord]); + }, + + /** + * Call _saveHasManyRelationshipRecord on each record in the relationship + * and then resolve once they have all settled + */ + _saveHasManyRelationship: function _saveHasManyRelationship(store, typeClass, relationship, ids, recordRef, recordCache) { + var _this9 = this; + + if (!_ember2['default'].isArray(ids)) { + throw new Error('hasMany relationships must must be an array'); + } + var idsCache = _ember2['default'].A(recordCache[relationship.key]); + var dirtyRecords = []; + + // Added + var addedRecords = (0, _lodashCollectionFilter2['default'])(ids, function (id) { + return !idsCache.contains(id); + }); + + // Dirty + dirtyRecords = (0, _lodashCollectionFilter2['default'])(ids, function (id) { + var relatedModelName = relationship.type; + return store.hasRecordForId(relatedModelName, id) && store.peekRecord(relatedModelName, id).get('hasDirtyAttributes') === true; + }); + + dirtyRecords = (0, _lodashCollectionMap2['default'])(uniq(dirtyRecords.concat(addedRecords)), function (id) { + return _this9._saveHasManyRecord(store, typeClass, relationship, recordRef, id); + }); + + // Removed + var removedRecords = (0, _lodashCollectionFilter2['default'])(idsCache, function (id) { + return !(0, _lodashCollectionIncludes2['default'])(ids, id); + }); + + removedRecords = (0, _lodashCollectionMap2['default'])(removedRecords, function (id) { + return _this9._removeHasManyRecord(store, recordRef, relationship.key, id); + }); + // Combine all the saved records + var savedRecords = dirtyRecords.concat(removedRecords); + // Wait for all the updates to finish + return _ember2['default'].RSVP.allSettled(savedRecords).then(function (savedRecords) { + var rejected = _ember2['default'].A(_ember2['default'].A(savedRecords).filterBy('state', 'rejected')); + if (rejected.get('length') === 0) { + // Update the cache + recordCache[relationship.key] = ids; + return savedRecords; + } else { + var error = new Error('Some errors were encountered while saving a hasMany relationship ' + relationship.parentType + ' -> ' + relationship.type); + error.errors = _ember2['default'].A(rejected).mapBy('reason'); + throw error; + } + }); + }, + + /** + * If the relationship is `async: true`, create a child ref + * named with the record id and set the value to true + * If the relationship is `embedded: true`, create a child ref + * named with the record id and update the value to the serialized + * version of the record + */ + _saveHasManyRecord: function _saveHasManyRecord(store, typeClass, relationship, parentRef, id) { + var serializer = store.serializerFor(typeClass.modelName); + var ref = this._getRelationshipRef(parentRef, serializer.keyForRelationship(relationship.key), id); + var record = store.peekRecord(relationship.type, id); + var isEmbedded = this.isRelationshipEmbedded(store, typeClass.modelName, relationship); + if (isEmbedded) { + return record.save(); + } + + return (0, _utilsToPromise2['default'])(ref.set, ref, [true]); + }, + + /** + * Determine from the serializer if the relationship is embedded via the + * serializer's `attrs` hash. + * + * @return {Boolean} Is the relationship embedded? + */ + isRelationshipEmbedded: function isRelationshipEmbedded(store, modelName, relationship) { + var serializer = store.serializerFor(modelName); + return serializer.hasDeserializeRecordsOption(relationship.key); + }, + + /** + * Determine from if the record is embedded via implicit relationships. + * + * @return {Boolean} Is the relationship embedded? + */ + isRecordEmbedded: function isRecordEmbedded(record) { + if (record._internalModel) { + record = record._internalModel; + } + + var found = this.getFirstEmbeddingParent(record); + + return !!found; + }, + + /** + * Remove a relationship + */ + _removeHasManyRecord: function _removeHasManyRecord(store, parentRef, key, id) { + var ref = this._getRelationshipRef(parentRef, key, id); + return (0, _utilsToPromise2['default'])(ref.remove, ref, [], ref.toString()); + }, + + /** + * Save an embedded belongsTo record and set its internal firebase ref + * + * @return {Promise} + */ + _saveEmbeddedBelongsToRecord: function _saveEmbeddedBelongsToRecord(store, typeClass, relationship, id, parentRef) { + var record = store.peekRecord(relationship.type, id); + if (record) { + return record.save(); + } + return _ember2['default'].RSVP.Promise.reject(new Error('Unable to find record with id ' + id + ' from embedded relationship: ' + JSON.stringify(relationship))); + }, + + /** + * Called by the store when a record is deleted. + */ + deleteRecord: function deleteRecord(store, typeClass, snapshot) { + var ref = this._getAbsoluteRef(snapshot.record); + ref.off('value'); + return (0, _utilsToPromise2['default'])(ref.remove, ref); + }, + + /** + * Determines a path fo a given type + */ + pathForType: function pathForType(modelName) { + var camelized = _ember2['default'].String.camelize(modelName); + return _ember2['default'].String.pluralize(camelized); + }, + + /** + * Return a Firebase reference for a given modelName and optional ID. + */ + _getCollectionRef: function _getCollectionRef(typeClass, id) { + var ref = this._ref; + if (typeClass) { + ref = ref.child(this.pathForType(typeClass.modelName)); + } + if (id) { + ref = ref.child(id); + } + return ref; + }, + + /** + * Returns a Firebase reference for a record taking into account if the record is embedded + * + * @param {DS.Model} record + * @return {Firebase} + */ + _getAbsoluteRef: function _getAbsoluteRef(record) { + if (record._internalModel) { + record = record._internalModel; + } + + var embeddingParent = this.getFirstEmbeddingParent(record); + + if (embeddingParent) { + var parent = embeddingParent.record; + var relationship = embeddingParent.relationship; + + var recordRef = this._getAbsoluteRef(parent).child(relationship.key); + + if (relationship.kind === 'hasMany') { + recordRef = recordRef.child(record.id); + } + return recordRef; + } + + return this._getCollectionRef(record.type, record.id); + }, + + /** + * Returns the parent record and relationship where any embedding is detected + * + * @param {DS.InternalModel} internalModel + * @return {Object} + */ + getFirstEmbeddingParent: function getFirstEmbeddingParent(internalModel) { + var _this10 = this; + + var embeddingParentRel = (0, _lodashCollectionFind2['default'])(internalModel._implicitRelationships, function (implicitRel) { + var members = implicitRel.members.toArray(); + var parent = members[0]; + + if (!parent) { + return false; + } + + var parentRel = parent._relationships.get(implicitRel.inverseKey); + return _this10.isRelationshipEmbedded(_this10.store, parent.type.modelName, parentRel.relationshipMeta); + }); + + if (embeddingParentRel) { + var parent = embeddingParentRel.members.toArray()[0]; + var parentKey = embeddingParentRel.inverseKey; + var parentRel = parent._relationships.get(parentKey).relationshipMeta; + return { record: parent, relationship: parentRel }; + } + }, + + /** + * Return a Firebase reference based on a relationship key and record id + */ + _getRelationshipRef: function _getRelationshipRef(ref, key, id) { + return ref.child(key).child(id); + }, + + /** + * The amount of time (ms) before the _queue is flushed + */ + _queueFlushDelay: 1000 / 60, // 60fps + + /** + * Called after the first item is pushed into the _queue + */ + _queueScheduleFlush: function _queueScheduleFlush() { + _ember2['default'].run.later(this, this._queueFlush, this._queueFlushDelay); + }, + + /** + * Call each function in the _queue and the reset the _queue + */ + _queueFlush: function _queueFlush() { + (0, _lodashCollectionForEach2['default'])(this._queue, function FirebaseAdapter$flushQueueItem(queueItem) { + var fn = queueItem[0]; + var args = queueItem[1]; + fn.apply(null, args); + }); + this._queue.length = 0; + }, + + /** + * Push a new function into the _queue and then schedule a + * flush if the item is the first to be pushed + */ + _enqueue: function _enqueue(callback, args) { + //Only do the queueing if we scheduled a delay + if (this._queueFlushDelay) { + var length = this._queue.push([callback, args]); + if (length === 1) { + this._queueScheduleFlush(); + } + } else { + callback.apply(null, args); + } + }, + + /** + * A cache of hasMany relationships that can be used to + * diff against new relationships when a model is saved + */ + _recordCacheForType: undefined, + + /** + * _updateHasManyCacheForType + */ + _updateRecordCacheForType: function _updateRecordCacheForType(typeClass, payload) { + if (!payload) { + return; + } + var id = payload.id; + var cache = this._getRecordCache(typeClass, id); + // Only cache relationships for now + typeClass.eachRelationship(function (key, relationship) { + if (relationship.kind === 'hasMany') { + var ids = payload[key]; + cache[key] = !_ember2['default'].isNone(ids) ? _ember2['default'].A(Object.keys(ids)) : _ember2['default'].A(); + } + }); + }, + + /** + * Get or create the cache for a record + */ + _getRecordCache: function _getRecordCache(typeClass, id) { + var modelName = typeClass.modelName; + var cache = this._recordCacheForType; + cache[modelName] = cache[modelName] || {}; + cache[modelName][id] = cache[modelName][id] || {}; + return cache[modelName][id]; + }, + + /** + * A utility for retrieving the key name of a Firebase ref or + * DataSnapshot. This is backwards-compatible with `name()` + * from Firebase 1.x.x and `key()` from Firebase 2.0.0+. Once + * support for Firebase 1.x.x is dropped in EmberFire, this + * helper can be removed. + */ + _getKey: function _getKey(refOrSnapshot) { + return typeof refOrSnapshot.key === 'function' ? refOrSnapshot.key() : refOrSnapshot.name(); + }, + + /** + * We don't need background reloading, because firebase! + */ + shouldBackgroundReloadRecord: function shouldBackgroundReloadRecord() { + return false; + } +}); +module.exports = exports['default']; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) + +},{"../mixins/waitable":3,"../utils/to-promise":5,"lodash/array/indexOf":6,"lodash/collection/filter":8,"lodash/collection/find":9,"lodash/collection/forEach":10,"lodash/collection/includes":11,"lodash/collection/map":12}],2:[function(require,module,exports){ +(function (global){ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + +var _ember = (typeof window !== "undefined" ? window['Ember'] : typeof global !== "undefined" ? global['Ember'] : null); + +var _ember2 = _interopRequireDefault(_ember); + +var _emberData = (typeof window !== "undefined" ? window['DS'] : typeof global !== "undefined" ? global['DS'] : null); + +var _emberData2 = _interopRequireDefault(_emberData); + +var _firebase = (typeof window !== "undefined" ? window['Firebase'] : typeof global !== "undefined" ? global['Firebase'] : null); + +var _firebase2 = _interopRequireDefault(_firebase); + +var _adaptersFirebase = require('../adapters/firebase'); + +var _adaptersFirebase2 = _interopRequireDefault(_adaptersFirebase); + +var _serializersFirebase = require('../serializers/firebase'); + +var _serializersFirebase2 = _interopRequireDefault(_serializersFirebase); + +var _lodashCollectionForEach = require('lodash/collection/forEach'); + +var _lodashCollectionForEach2 = _interopRequireDefault(_lodashCollectionForEach); + +var VERSION = '1.6.6'; + +if (_ember2['default'].libraries) { + if (_firebase2['default'].SDK_VERSION) { + _ember2['default'].libraries.registerCoreLibrary('Firebase', _firebase2['default'].SDK_VERSION); + } + + _ember2['default'].libraries.registerCoreLibrary('EmberFire', VERSION); +} + +exports['default'] = { + name: 'emberfire', + before: 'ember-data', + initialize: function initialize() { + + // To support Ember versions below 2.1.0 as well. + // See http://emberjs.com/deprecations/v2.x/#toc_initializer-arity + var application = arguments[1] || arguments[0]; + + application.register('adapter:-firebase', _adaptersFirebase2['default']); + application.register('serializer:-firebase', _serializersFirebase2['default']); + + // Monkeypatch the store until ED gives us a good way to listen to push events + if (!_emberData2['default'].Store.prototype._emberfirePatched) { + _emberData2['default'].Store.reopen({ + _emberfirePatched: true, + + push: function push() { + var _this = this; + + var result = this._super.apply(this, arguments); + var records = result; + + if (!_ember2['default'].isArray(result)) { + records = [result]; + } + + (0, _lodashCollectionForEach2['default'])(records, function (record) { + var modelName = record.constructor.modelName; + var adapter = _this.adapterFor(modelName); + if (adapter.recordWasPushed) { + adapter.recordWasPushed(_this, modelName, record); + } + }); + + return result; + }, + + recordWillUnload: function recordWillUnload(record) { + var adapter = this.adapterFor(record.constructor.modelName); + if (adapter.recordWillUnload) { + adapter.recordWillUnload(this, record); + } + }, + + recordWillDelete: function recordWillDelete(record) { + var adapter = this.adapterFor(record.constructor.modelName); + if (adapter.recordWillDelete) { + adapter.recordWillDelete(this, record); + } + } + }); + } + + if (!_emberData2['default'].Model.prototype._emberfirePatched) { + _emberData2['default'].Model.reopen({ + _emberfirePatched: true, + + unloadRecord: function unloadRecord() { + this.store.recordWillUnload(this); + return this._super(); + }, + + deleteRecord: function deleteRecord() { + this.store.recordWillDelete(this); + this._super(); + }, + + ref: function ref() { + var adapter = this.store.adapterFor(this.constructor.modelName); + if (adapter._getAbsoluteRef) { + return adapter._getAbsoluteRef(this); + } + } + }); + } + + if (!_emberData2['default'].AdapterPopulatedRecordArray.prototype._emberfirePatched) { + _emberData2['default'].AdapterPopulatedRecordArray.reopen({ + _emberfirePatched: true, + + willDestroy: function willDestroy() { + if (this.__firebaseCleanup) { + this.__firebaseCleanup(); + } + return this._super(); + } + }); + } + + _emberData2['default'].FirebaseAdapter = _adaptersFirebase2['default']; + _emberData2['default'].FirebaseSerializer = _serializersFirebase2['default']; + } +}; +module.exports = exports['default']; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) + +},{"../adapters/firebase":1,"../serializers/firebase":4,"lodash/collection/forEach":10}],3:[function(require,module,exports){ +(function (global){ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + +var _ember = (typeof window !== "undefined" ? window['Ember'] : typeof global !== "undefined" ? global['Ember'] : null); + +var _ember2 = _interopRequireDefault(_ember); + +exports['default'] = _ember2['default'].Mixin.create({ + + init: function init() { + this._super.apply(this, arguments); + // unresolved requests, used in testing + this._reasons = 0; + + if (_ember2['default'].testing) { + this._registerWaiter(); + } + }, + + _incrementWaiters: function _incrementWaiters() { + this._reasons++; + }, + + _decrementWaiters: function _decrementWaiters() { + this._reasons--; + }, + + /** + * The waiter calls this to determine if testing should wait. Override in + * the implementing class if needed. + * + * @return {Boolean} + * @private + */ + _shouldWait: function _shouldWait() { + return this._reasons === 0; + }, + + /** + * Wire up a waiter for this instance. + * + * @private + */ + _registerWaiter: function _registerWaiter() { + var _this = this; + + this._waiter = function () { + return _this._shouldWait(); + }; + _ember2['default'].Test.registerWaiter(this._waiter); + } + +}); +module.exports = exports['default']; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) + +},{}],4:[function(require,module,exports){ +(function (global){ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + +var _ember = (typeof window !== "undefined" ? window['Ember'] : typeof global !== "undefined" ? global['Ember'] : null); + +var _ember2 = _interopRequireDefault(_ember); + +var _emberData = (typeof window !== "undefined" ? window['DS'] : typeof global !== "undefined" ? global['DS'] : null); + +var _emberData2 = _interopRequireDefault(_emberData); + +var _lodashObjectAssign = require('lodash/object/assign'); + +var _lodashObjectAssign2 = _interopRequireDefault(_lodashObjectAssign); + +/** + * The Firebase serializer helps normalize relationships and can be extended on + * a per model basis. + */ +exports['default'] = _emberData2['default'].JSONSerializer.extend(_emberData2['default'].EmbeddedRecordsMixin, { + isNewSerializerAPI: true, + + /** + * Firebase does not send null values, it omits the key altogether. This nullifies omitted + * properties so that property deletions sync correctly. + * + * @override + */ + extractAttributes: function extractAttributes(modelClass, resourceHash) { + var attributes = this._super(modelClass, resourceHash); + + // nullify omitted attributes + modelClass.eachAttribute(function (key) { + if (!attributes.hasOwnProperty(key)) { + attributes[key] = null; + } + }); + + return attributes; + }, + + /** + * @override + */ + extractRelationships: function extractRelationships(modelClass, payload) { + this.normalizeRelationships(modelClass, payload); + return this._super(modelClass, payload); + }, + + /** + * Normalizes `hasMany` relationship structure before passing + * to `JSONSerializer.extractRelationships` + * + * before: + * + * ```js + * { + * comments: { + * abc: true, + * def: true, + * } + * } + * ``` + * + * after: + * + * ```js + * { + * comments: [ 'abc', 'def' ] + * } + * ``` + * + * Or for embedded objects: + * + * ```js + * { + * comments: { + * 'abc': { body: 'a' }, + * 'def': { body: 'd' ) + * } + * } + * ``` + * + * these should become: + * + * ```js + * { + * comments: [ + * { + * id: 'abc', + * body: 'a' + * }, + * { + * id: 'def', + * body: 'd' + * } + * ] + * } + * ``` + */ + normalizeRelationships: function normalizeRelationships(modelClass, payload) { + var _this = this; + + modelClass.eachRelationship(function (key, meta) { + var relationshipKey = _this.keyForRelationship(key, meta.kind, 'deserialize'); + + if (meta.kind === 'hasMany') { + if (payload.hasOwnProperty(relationshipKey)) { + (function () { + var relationshipPayload = payload[relationshipKey]; + // embedded + if (_this.hasDeserializeRecordsOption(key)) { + if (typeof relationshipPayload === 'object' && !_ember2['default'].isArray(relationshipPayload)) { + relationshipPayload = Object.keys(relationshipPayload).map(function (id) { + return (0, _lodashObjectAssign2['default'])({ id: id }, relationshipPayload[id]); + }); + } else if (_ember2['default'].isArray(relationshipPayload)) { + relationshipPayload = _this._addNumericIdsToEmbeddedArray(relationshipPayload); + } else { + throw new Error(modelClass.toString() + ' relationship ' + meta.kind + '(\'' + meta.type + '\') must contain embedded records with an `id`. Example: { "' + key + '": { "' + meta.type + '_1": { "id": "' + meta.type + '_1" } } } instead got: ' + JSON.stringify(payload[key])); + } + } + + // normalized + else { + if (typeof relationshipPayload === 'object' && !_ember2['default'].isArray(relationshipPayload)) { + relationshipPayload = Object.keys(relationshipPayload); + } else if (_ember2['default'].isArray(relationshipPayload)) { + relationshipPayload = _this._convertBooleanArrayToIds(relationshipPayload); + } else { + throw new Error(modelClass.toString() + ' relationship ' + meta.kind + '(\'' + meta.type + '\') must be a key/value map. Example: { "' + key + '": { "' + meta.type + '_1": true } } instead got: ' + JSON.stringify(payload[key])); + } + } + + payload[relationshipKey] = relationshipPayload; + })(); + } + + // hasMany property is not present + // server will not send a property which has no content + // (i.e. it will never send `comments: null`) so we need to + // force the empty relationship + else { + payload[relationshipKey] = []; + } + } + + if (meta.kind === 'belongsTo') { + if (!payload.hasOwnProperty(relationshipKey)) { + // server wont send property if it was made null elsewhere + payload[relationshipKey] = null; + } + } + }); + }, + + /** + * Coerce arrays back into relationship arrays. When numeric ids are used + * the firebase server will send back arrays instead of object hashes in + * certain situations. + * + * See the conditions and reasoning here: + * https://www.firebase.com/docs/web/guide/understanding-data.html#section-arrays-in-firebase + * + * Stored in Firebase: + * + * ```json + * { + * "0": true, + * "1": true, + * "3": true + * } + * ``` + * + * Given back by the JS client: + * + * ```js + * [true, true, null, true] + * ``` + * + * What we need: + * + * ```js + * [ "0", "1", "3" ] + * ``` + * + * @param {Array} arr Input array + * @return {Array} Fixed array + * @private + */ + _convertBooleanArrayToIds: function _convertBooleanArrayToIds(arr) { + var result = []; + for (var i = 0; i < arr.length; i++) { + if (arr[i] === true) { + result.push('' + i); + } else if (typeof arr[i] === 'string') { + throw new Error('hasMany relationship contains invalid data, should be in the form: { comment_1: true, comment_2: true } but was ' + JSON.stringify(arr)); + } + } + return result; + }, + + /** + * Fix embedded array ids. + * + * Objects are stored in Firebase with their id in the key only: + * + * ```json + * { + * "0": { obj0 }, + * "1": { obj1 }, + * "3": { obj3 } + * } + * ``` + * + * Given back by the JS client: + * + * ```js + * [{ obj0 }, { obj1 }, null, { obj3 }] + * ``` + * + * What we need: + * + * ```js + * [ { id: '0', ...obj0 }, { id: '1', ...obj1 }, { id: '3', ...obj3 } ] + * ``` + * + * https://www.firebase.com/docs/web/guide/understanding-data.html#section-arrays-in-firebase + * + * @param {Array} arr Input array + * @return {Array} Fixed array + * @private + */ + _addNumericIdsToEmbeddedArray: function _addNumericIdsToEmbeddedArray(arr) { + var result = []; + for (var i = 0; i < arr.length; i++) { + if (arr[i]) { + if (typeof arr[i] !== 'object') { + throw new Error('expecting embedded object hash but found ' + JSON.stringify(arr[i])); + } + result.push((0, _lodashObjectAssign2['default'])({ id: '' + i }, arr[i])); + } + } + return result; + }, + + /** + * Even when records are embedded, bypass EmbeddedRecordsMixin + * and invoke JSONSerializer's method which serializes to ids only. + * + * The adapter handles saving the embedded records via `r.save()` + * and ensures that dirty states and rollback work. + * + * Will not be neccesary when this issue is resolved: + * + * https://github.com/emberjs/data/issues/2487 + * + * @override + */ + serializeHasMany: function serializeHasMany(snapshot, json, relationship) { + _emberData2['default'].JSONSerializer.prototype.serializeHasMany.call(this, snapshot, json, relationship); + }, + + /** + * @see #serializeHasMany + * @override + */ + serializeBelongsTo: function serializeBelongsTo(snapshot, json, relationship) { + _emberData2['default'].JSONSerializer.prototype.serializeBelongsTo.call(this, snapshot, json, relationship); + }, + + /** + * @override + */ + _shouldSerializeHasMany: function _shouldSerializeHasMany(snapshot, key, relationship) { + return this._canSerialize(key); + } +}); +module.exports = exports['default']; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) + +},{"lodash/object/assign":73}],5:[function(require,module,exports){ +(function (global){ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + +var _ember = (typeof window !== "undefined" ? window['Ember'] : typeof global !== "undefined" ? global['Ember'] : null); + +var _ember2 = _interopRequireDefault(_ember); + +exports['default'] = function (fn, context, _args, errorMsg) { + var args = _args || []; + return new _ember2['default'].RSVP.Promise(function (resolve, reject) { + var callback = function callback(error) { + if (error) { + if (errorMsg && typeof error === 'object') { + error.location = errorMsg; + } + reject(error); + } else { + resolve(); + } + }; + args.push(callback); + fn.apply(context, args); + }); +}; + +module.exports = exports['default']; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) + +},{}],6:[function(require,module,exports){ +var baseIndexOf = require('../internal/baseIndexOf'), + binaryIndex = require('../internal/binaryIndex'); + +/* Native method references for those with the same name as other `lodash` methods. */ +var nativeMax = Math.max; + +/** + * Gets the index at which the first occurrence of `value` is found in `array` + * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * for equality comparisons. If `fromIndex` is negative, it is used as the offset + * from the end of `array`. If `array` is sorted providing `true` for `fromIndex` + * performs a faster binary search. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to search. + * @param {*} value The value to search for. + * @param {boolean|number} [fromIndex=0] The index to search from or `true` + * to perform a binary search on a sorted array. + * @returns {number} Returns the index of the matched value, else `-1`. + * @example + * + * _.indexOf([1, 2, 1, 2], 2); + * // => 1 + * + * // using `fromIndex` + * _.indexOf([1, 2, 1, 2], 2, 2); + * // => 3 + * + * // performing a binary search + * _.indexOf([1, 1, 2, 2], 2, true); + * // => 2 + */ +function indexOf(array, value, fromIndex) { + var length = array ? array.length : 0; + if (!length) { + return -1; + } + if (typeof fromIndex == 'number') { + fromIndex = fromIndex < 0 ? nativeMax(length + fromIndex, 0) : fromIndex; + } else if (fromIndex) { + var index = binaryIndex(array, value); + if (index < length && + (value === value ? (value === array[index]) : (array[index] !== array[index]))) { + return index; + } + return -1; + } + return baseIndexOf(array, value, fromIndex || 0); +} + +module.exports = indexOf; + +},{"../internal/baseIndexOf":29,"../internal/binaryIndex":41}],7:[function(require,module,exports){ +/** + * 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 + */ +function last(array) { + var length = array ? array.length : 0; + return length ? array[length - 1] : undefined; +} + +module.exports = last; + +},{}],8:[function(require,module,exports){ +var arrayFilter = require('../internal/arrayFilter'), + baseCallback = require('../internal/baseCallback'), + baseFilter = require('../internal/baseFilter'), + isArray = require('../lang/isArray'); + +/** + * 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'] + * + * // using the `_.matchesProperty` callback shorthand + * _.pluck(_.filter(users, 'active', false), 'user'); + * // => ['fred'] + * + * // using the `_.property` callback shorthand + * _.pluck(_.filter(users, 'active'), 'user'); + * // => ['barney'] + */ +function filter(collection, predicate, thisArg) { + var func = isArray(collection) ? arrayFilter : baseFilter; + predicate = baseCallback(predicate, thisArg, 3); + return func(collection, predicate); +} + +module.exports = filter; + +},{"../internal/arrayFilter":15,"../internal/baseCallback":20,"../internal/baseFilter":23,"../lang/isArray":67}],9:[function(require,module,exports){ +var baseEach = require('../internal/baseEach'), + createFind = require('../internal/createFind'); + +/** + * 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); + +module.exports = find; + +},{"../internal/baseEach":22,"../internal/createFind":47}],10:[function(require,module,exports){ +var arrayEach = require('../internal/arrayEach'), + baseEach = require('../internal/baseEach'), + createForEach = require('../internal/createForEach'); + +/** + * Iterates over elements of `collection` invoking `iteratee` for each element. + * The `iteratee` is bound to `thisArg` and invoked with three arguments: + * (value, index|key, collection). Iteratee functions may exit iteration early + * by explicitly returning `false`. + * + * **Note:** As with other "Collections" methods, objects with a "length" property + * are iterated like arrays. To avoid this behavior `_.forIn` or `_.forOwn` + * may be used for object iteration. + * + * @static + * @memberOf _ + * @alias each + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {Array|Object|string} Returns `collection`. + * @example + * + * _([1, 2]).forEach(function(n) { + * console.log(n); + * }).value(); + * // => logs each value from left to right and returns the array + * + * _.forEach({ 'a': 1, 'b': 2 }, function(n, key) { + * console.log(n, key); + * }); + * // => logs each value-key pair and returns the object (iteration order is not guaranteed) + */ +var forEach = createForEach(arrayEach, baseEach); + +module.exports = forEach; + +},{"../internal/arrayEach":14,"../internal/baseEach":22,"../internal/createForEach":48}],11:[function(require,module,exports){ +var baseIndexOf = require('../internal/baseIndexOf'), + getLength = require('../internal/getLength'), + isArray = require('../lang/isArray'), + isIterateeCall = require('../internal/isIterateeCall'), + isLength = require('../internal/isLength'), + isString = require('../lang/isString'), + values = require('../object/values'); + +/* Native method references for those with the same name as other `lodash` methods. */ +var nativeMax = Math.max; + +/** + * Checks if `value` is in `collection` using + * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * for equality comparisons. If `fromIndex` is negative, it is used as the offset + * from the end of `collection`. + * + * @static + * @memberOf _ + * @alias contains, include + * @category Collection + * @param {Array|Object|string} collection The collection to search. + * @param {*} target The value to search for. + * @param {number} [fromIndex=0] The index to search from. + * @param- {Object} [guard] Enables use as a callback for functions like `_.reduce`. + * @returns {boolean} Returns `true` if a matching element is found, else `false`. + * @example + * + * _.includes([1, 2, 3], 1); + * // => true + * + * _.includes([1, 2, 3], 1, 2); + * // => false + * + * _.includes({ 'user': 'fred', 'age': 40 }, 'fred'); + * // => true + * + * _.includes('pebbles', 'eb'); + * // => true + */ +function includes(collection, target, fromIndex, guard) { + var length = collection ? getLength(collection) : 0; + if (!isLength(length)) { + collection = values(collection); + length = collection.length; + } + if (typeof fromIndex != 'number' || (guard && isIterateeCall(target, fromIndex, guard))) { + fromIndex = 0; + } else { + fromIndex = fromIndex < 0 ? nativeMax(length + fromIndex, 0) : (fromIndex || 0); + } + return (typeof collection == 'string' || !isArray(collection) && isString(collection)) + ? (fromIndex <= length && collection.indexOf(target, fromIndex) > -1) + : (!!length && baseIndexOf(collection, target, fromIndex) > -1); +} + +module.exports = includes; + +},{"../internal/baseIndexOf":29,"../internal/getLength":52,"../internal/isIterateeCall":58,"../internal/isLength":60,"../lang/isArray":67,"../lang/isString":71,"../object/values":77}],12:[function(require,module,exports){ +var arrayMap = require('../internal/arrayMap'), + baseCallback = require('../internal/baseCallback'), + baseMap = require('../internal/baseMap'), + isArray = require('../lang/isArray'); + +/** + * Creates an array of values by running each element in `collection` through + * `iteratee`. The `iteratee` is bound to `thisArg` and invoked with three + * arguments: (value, index|key, collection). + * + * If a property name is provided for `iteratee` 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 `iteratee` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * Many lodash methods are guarded to work as iteratees for methods like + * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`. + * + * The guarded methods are: + * `ary`, `callback`, `chunk`, `clone`, `create`, `curry`, `curryRight`, + * `drop`, `dropRight`, `every`, `fill`, `flatten`, `invert`, `max`, `min`, + * `parseInt`, `slice`, `sortBy`, `take`, `takeRight`, `template`, `trim`, + * `trimLeft`, `trimRight`, `trunc`, `random`, `range`, `sample`, `some`, + * `sum`, `uniq`, and `words` + * + * @static + * @memberOf _ + * @alias collect + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function|Object|string} [iteratee=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {Array} Returns the new mapped array. + * @example + * + * function timesThree(n) { + * return n * 3; + * } + * + * _.map([1, 2], timesThree); + * // => [3, 6] + * + * _.map({ 'a': 1, 'b': 2 }, timesThree); + * // => [3, 6] (iteration order is not guaranteed) + * + * var users = [ + * { 'user': 'barney' }, + * { 'user': 'fred' } + * ]; + * + * // using the `_.property` callback shorthand + * _.map(users, 'user'); + * // => ['barney', 'fred'] + */ +function map(collection, iteratee, thisArg) { + var func = isArray(collection) ? arrayMap : baseMap; + iteratee = baseCallback(iteratee, thisArg, 3); + return func(collection, iteratee); +} + +module.exports = map; + +},{"../internal/arrayMap":16,"../internal/baseCallback":20,"../internal/baseMap":33,"../lang/isArray":67}],13:[function(require,module,exports){ +/** Used as the `TypeError` message for "Functions" methods. */ +var FUNC_ERROR_TEXT = 'Expected a function'; + +/* Native method references for those with the same name as other `lodash` methods. */ +var nativeMax = Math.max; + +/** + * 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/en-US/docs/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); + * }); + * + * say('hello', 'fred', 'barney', 'pebbles'); + * // => 'hello fred, barney, & pebbles' + */ +function restParam(func, start) { + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + 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); + }; +} + +module.exports = restParam; + +},{}],14:[function(require,module,exports){ +/** + * A specialized version of `_.forEach` for arrays without support for callback + * shorthands and `this` binding. + * + * @private + * @param {Array} array The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns `array`. + */ +function arrayEach(array, iteratee) { + var index = -1, + length = array.length; + + while (++index < length) { + if (iteratee(array[index], index, array) === false) { + break; + } + } + return array; +} + +module.exports = arrayEach; + +},{}],15:[function(require,module,exports){ +/** + * A specialized version of `_.filter` for arrays without support for callback + * shorthands and `this` binding. + * + * @private + * @param {Array} array The array to iterate over. + * @param {Function} predicate The function invoked per iteration. + * @returns {Array} Returns the new filtered array. + */ +function arrayFilter(array, predicate) { + var index = -1, + length = array.length, + resIndex = -1, + result = []; + + while (++index < length) { + var value = array[index]; + if (predicate(value, index, array)) { + result[++resIndex] = value; + } + } + return result; +} + +module.exports = arrayFilter; + +},{}],16:[function(require,module,exports){ +/** + * A specialized version of `_.map` for arrays without support for callback + * shorthands and `this` binding. + * + * @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; + +},{}],17:[function(require,module,exports){ +/** + * A specialized version of `_.some` for arrays without support for callback + * shorthands and `this` binding. + * + * @private + * @param {Array} array The array to iterate over. + * @param {Function} predicate The function invoked per iteration. + * @returns {boolean} Returns `true` if any element passes the predicate check, + * else `false`. + */ +function arraySome(array, predicate) { + var index = -1, + length = array.length; + + while (++index < length) { + if (predicate(array[index], index, array)) { + return true; + } + } + return false; +} + +module.exports = arraySome; + +},{}],18:[function(require,module,exports){ +var keys = require('../object/keys'); + +/** + * A specialized version of `_.assign` for customizing assigned values without + * support for argument juggling, multiple sources, and `this` binding `customizer` + * functions. + * + * @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; + } + } + return object; +} + +module.exports = assignWith; + +},{"../object/keys":74}],19:[function(require,module,exports){ +var baseCopy = require('./baseCopy'), + keys = require('../object/keys'); + +/** + * The base implementation of `_.assign` without support for argument juggling, + * multiple sources, and `customizer` functions. + * + * @private + * @param {Object} object The destination object. + * @param {Object} source The source object. + * @returns {Object} Returns `object`. + */ +function baseAssign(object, source) { + return source == null + ? object + : baseCopy(source, keys(source), object); +} + +module.exports = baseAssign; + +},{"../object/keys":74,"./baseCopy":21}],20:[function(require,module,exports){ +var baseMatches = require('./baseMatches'), + baseMatchesProperty = require('./baseMatchesProperty'), + bindCallback = require('./bindCallback'), + identity = require('../utility/identity'), + property = require('../utility/property'); + +/** + * The base implementation of `_.callback` which supports specifying the + * number of arguments to provide to `func`. + * + * @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. + */ +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); +} + +module.exports = baseCallback; + +},{"../utility/identity":78,"../utility/property":79,"./baseMatches":34,"./baseMatchesProperty":35,"./bindCallback":43}],21:[function(require,module,exports){ +/** + * 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 baseCopy(source, props, object) { + object || (object = {}); + + var index = -1, + length = props.length; + + while (++index < length) { + var key = props[index]; + object[key] = source[key]; + } + return object; +} + +module.exports = baseCopy; + +},{}],22:[function(require,module,exports){ +var baseForOwn = require('./baseForOwn'), + createBaseEach = require('./createBaseEach'); + +/** + * The base implementation of `_.forEach` without support for callback + * shorthands and `this` binding. + * + * @private + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array|Object|string} Returns `collection`. + */ +var baseEach = createBaseEach(baseForOwn); + +module.exports = baseEach; + +},{"./baseForOwn":27,"./createBaseEach":45}],23:[function(require,module,exports){ +var baseEach = require('./baseEach'); + +/** + * The base implementation of `_.filter` without support for callback + * shorthands and `this` binding. + * + * @private + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function} predicate The function invoked per iteration. + * @returns {Array} Returns the new filtered array. + */ +function baseFilter(collection, predicate) { + var result = []; + baseEach(collection, function(value, index, collection) { + if (predicate(value, index, collection)) { + result.push(value); + } + }); + return result; +} + +module.exports = baseFilter; + +},{"./baseEach":22}],24:[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`. + * + * @private + * @param {Array|Object|string} 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. + * @returns {*} Returns the found element or its key, else `undefined`. + */ +function baseFind(collection, predicate, eachFunc, retKey) { + var result; + eachFunc(collection, function(value, key, collection) { + if (predicate(value, key, collection)) { + result = retKey ? key : value; + return false; + } + }); + return result; +} + +module.exports = baseFind; + +},{}],25:[function(require,module,exports){ +/** + * The base implementation of `_.findIndex` and `_.findLastIndex` without + * support for callback shorthands and `this` binding. + * + * @private + * @param {Array} array The array to search. + * @param {Function} predicate The function invoked per iteration. + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {number} Returns the index of the matched value, else `-1`. + */ +function baseFindIndex(array, predicate, fromRight) { + var length = array.length, + index = fromRight ? length : -1; + + while ((fromRight ? index-- : ++index < length)) { + if (predicate(array[index], index, array)) { + return index; + } + } + return -1; +} + +module.exports = baseFindIndex; + +},{}],26:[function(require,module,exports){ +var createBaseFor = require('./createBaseFor'); + +/** + * The base implementation of `baseForIn` and `baseForOwn` which iterates + * over `object` properties returned by `keysFunc` invoking `iteratee` for + * each property. Iteratee functions may exit iteration early by explicitly + * returning `false`. + * + * @private + * @param {Object} object The object to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @param {Function} keysFunc The function to get the keys of `object`. + * @returns {Object} Returns `object`. + */ +var baseFor = createBaseFor(); + +module.exports = baseFor; + +},{"./createBaseFor":46}],27:[function(require,module,exports){ +var baseFor = require('./baseFor'), + keys = require('../object/keys'); + +/** + * The base implementation of `_.forOwn` without support for callback + * shorthands and `this` binding. + * + * @private + * @param {Object} object The object to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Object} Returns `object`. + */ +function baseForOwn(object, iteratee) { + return baseFor(object, iteratee, keys); +} + +module.exports = baseForOwn; + +},{"../object/keys":74,"./baseFor":26}],28:[function(require,module,exports){ +var toObject = require('./toObject'); + +/** + * The base implementation of `get` without support for string paths + * and 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. + * @returns {*} Returns the resolved value. + */ +function baseGet(object, path, pathKey) { + if (object == null) { + return; + } + if (pathKey !== undefined && pathKey in toObject(object)) { + path = [pathKey]; + } + var index = 0, + length = path.length; + + while (object != null && index < length) { + object = object[path[index++]]; + } + return (index && index == length) ? object : undefined; +} + +module.exports = baseGet; + +},{"./toObject":64}],29:[function(require,module,exports){ +var indexOfNaN = require('./indexOfNaN'); + +/** + * The base implementation of `_.indexOf` without support for binary searches. + * + * @private + * @param {Array} array The array to search. + * @param {*} value The value to search for. + * @param {number} fromIndex The index to search from. + * @returns {number} Returns the index of the matched value, else `-1`. + */ +function baseIndexOf(array, value, fromIndex) { + if (value !== value) { + return indexOfNaN(array, fromIndex); + } + var index = fromIndex - 1, + length = array.length; + + while (++index < length) { + if (array[index] === value) { + return index; + } + } + return -1; +} + +module.exports = baseIndexOf; + +},{"./indexOfNaN":55}],30:[function(require,module,exports){ +var baseIsEqualDeep = require('./baseIsEqualDeep'), + isObject = require('../lang/isObject'), + isObjectLike = require('./isObjectLike'); + +/** + * The base implementation of `_.isEqual` without support for `this` binding + * `customizer` functions. + * + * @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. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + */ +function baseIsEqual(value, other, customizer, isLoose, stackA, stackB) { + 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); +} + +module.exports = baseIsEqual; + +},{"../lang/isObject":70,"./baseIsEqualDeep":31,"./isObjectLike":61}],31:[function(require,module,exports){ +var equalArrays = require('./equalArrays'), + equalByTag = require('./equalByTag'), + equalObjects = require('./equalObjects'), + isArray = require('../lang/isArray'), + isTypedArray = require('../lang/isTypedArray'); + +/** `Object#toString` result references. */ +var argsTag = '[object Arguments]', + arrayTag = '[object Array]', + objectTag = '[object Object]'; + +/** Used for native 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 + * references to be compared. + * + * @private + * @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. + * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. + */ +function baseIsEqualDeep(object, other, equalFunc, customizer, isLoose, stackA, stackB) { + 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); + } + } + if (!othIsArr) { + othTag = objToString.call(other); + if (othTag == argsTag) { + othTag = objectTag; + } else if (othTag != objectTag) { + othIsArr = isTypedArray(other); + } + } + var objIsObj = objTag == objectTag, + othIsObj = othTag == objectTag, + isSameTag = objTag == othTag; + + if (isSameTag && !(objIsArr || objIsObj)) { + return equalByTag(object, other, objTag); + } + if (!isLoose) { + 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); + } + } + 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; +} + +module.exports = baseIsEqualDeep; + +},{"../lang/isArray":67,"../lang/isTypedArray":72,"./equalArrays":49,"./equalByTag":50,"./equalObjects":51}],32:[function(require,module,exports){ +var baseIsEqual = require('./baseIsEqual'), + toObject = require('./toObject'); + +/** + * The base implementation of `_.isMatch` without support for callback + * shorthands and `this` binding. + * + * @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. + * @returns {boolean} Returns `true` if `object` is a match, else `false`. + */ +function baseIsMatch(object, matchData, customizer) { + var index = matchData.length, + length = index, + noCustomizer = !customizer; + + if (object == null) { + return !length; + } + object = toObject(object); + while (index--) { + var data = matchData[index]; + if ((noCustomizer && data[2]) + ? data[1] !== object[data[0]] + : !(data[0] in object) + ) { + return false; + } + } + while (++index < length) { + data = matchData[index]; + var key = data[0], + objValue = object[key], + srcValue = data[1]; + + if (noCustomizer && data[2]) { + if (objValue === undefined && !(key in object)) { + return false; + } + } else { + var result = customizer ? customizer(objValue, srcValue, key) : undefined; + if (!(result === undefined ? baseIsEqual(srcValue, objValue, customizer, true) : result)) { + return false; + } + } + } + return true; +} + +module.exports = baseIsMatch; + +},{"./baseIsEqual":30,"./toObject":64}],33:[function(require,module,exports){ +var baseEach = require('./baseEach'), + isArrayLike = require('./isArrayLike'); + +/** + * The base implementation of `_.map` without support for callback shorthands + * and `this` binding. + * + * @private + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the new mapped array. + */ +function baseMap(collection, iteratee) { + var index = -1, + result = isArrayLike(collection) ? Array(collection.length) : []; + + baseEach(collection, function(value, key, collection) { + result[++index] = iteratee(value, key, collection); + }); + return result; +} + +module.exports = baseMap; + +},{"./baseEach":22,"./isArrayLike":56}],34:[function(require,module,exports){ +var baseIsMatch = require('./baseIsMatch'), + getMatchData = require('./getMatchData'), + toObject = require('./toObject'); + +/** + * The base implementation of `_.matches` which does not clone `source`. + * + * @private + * @param {Object} source The object of property values to match. + * @returns {Function} Returns the new function. + */ +function baseMatches(source) { + var matchData = getMatchData(source); + if (matchData.length == 1 && matchData[0][2]) { + var key = matchData[0][0], + value = matchData[0][1]; + + return function(object) { + if (object == null) { + return false; + } + return object[key] === value && (value !== undefined || (key in toObject(object))); + }; + } + return function(object) { + return baseIsMatch(object, matchData); + }; +} + +module.exports = baseMatches; + +},{"./baseIsMatch":32,"./getMatchData":53,"./toObject":64}],35:[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'); + +/** + * The base implementation of `_.matchesProperty` which does not clone `srcValue`. + * + * @private + * @param {string} path The path of the property to get. + * @param {*} srcValue The value to compare. + * @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); + }; +} + +module.exports = baseMatchesProperty; + +},{"../array/last":7,"../lang/isArray":67,"./baseGet":28,"./baseIsEqual":30,"./baseSlice":38,"./isKey":59,"./isStrictComparable":62,"./toObject":64,"./toPath":65}],36:[function(require,module,exports){ +/** + * The base implementation of `_.property` without support for deep paths. + * + * @private + * @param {string} key The key of the property to get. + * @returns {Function} Returns the new function. + */ +function baseProperty(key) { + return function(object) { + return object == null ? undefined : object[key]; + }; +} + +module.exports = baseProperty; + +},{}],37:[function(require,module,exports){ +var baseGet = require('./baseGet'), + toPath = require('./toPath'); + +/** + * A specialized version of `baseProperty` which supports deep paths. + * + * @private + * @param {Array|string} path The path of the property to get. + * @returns {Function} Returns the new function. + */ +function basePropertyDeep(path) { + var pathKey = (path + ''); + path = toPath(path); + return function(object) { + return baseGet(object, path, pathKey); + }; +} + +module.exports = basePropertyDeep; + +},{"./baseGet":28,"./toPath":65}],38:[function(require,module,exports){ +/** + * The base implementation of `_.slice` without an iteratee call guard. + * + * @private + * @param {Array} array The array to slice. + * @param {number} [start=0] The start position. + * @param {number} [end=array.length] The end position. + * @returns {Array} Returns the slice of `array`. + */ +function baseSlice(array, start, end) { + var index = -1, + length = array.length; + + start = start == null ? 0 : (+start || 0); + if (start < 0) { + start = -start > length ? 0 : (length + start); + } + end = (end === undefined || end > length) ? length : (+end || 0); + if (end < 0) { + end += length; + } + length = start > end ? 0 : ((end - start) >>> 0); + start >>>= 0; + + var result = Array(length); + while (++index < length) { + result[index] = array[index + start]; + } + return result; +} + +module.exports = baseSlice; + +},{}],39:[function(require,module,exports){ +/** + * Converts `value` to a string if it's not one. An empty string is returned + * for `null` or `undefined` values. + * + * @private + * @param {*} value The value to process. + * @returns {string} Returns the string. + */ +function baseToString(value) { + return value == null ? '' : (value + ''); +} + +module.exports = baseToString; + +},{}],40:[function(require,module,exports){ +/** + * The base implementation of `_.values` and `_.valuesIn` which creates an + * array of `object` property values corresponding to the property names + * of `props`. + * + * @private + * @param {Object} object The object to query. + * @param {Array} props The property names to get values for. + * @returns {Object} Returns the array of property values. + */ +function baseValues(object, props) { + var index = -1, + length = props.length, + result = Array(length); + + while (++index < length) { + result[index] = object[props[index]]; + } + return result; +} + +module.exports = baseValues; + +},{}],41:[function(require,module,exports){ +var binaryIndexBy = require('./binaryIndexBy'), + identity = require('../utility/identity'); + +/** Used as references for the maximum length and index of an array. */ +var MAX_ARRAY_LENGTH = 4294967295, + HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1; + +/** + * Performs a binary search of `array` to determine the index at which `value` + * should be inserted into `array` in order to maintain its sort order. + * + * @private + * @param {Array} array The sorted array to inspect. + * @param {*} value The value to evaluate. + * @param {boolean} [retHighest] Specify returning the highest qualified index. + * @returns {number} Returns the index at which `value` should be inserted + * into `array`. + */ +function binaryIndex(array, value, retHighest) { + var low = 0, + high = array ? array.length : low; + + if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) { + while (low < high) { + var mid = (low + high) >>> 1, + computed = array[mid]; + + if ((retHighest ? (computed <= value) : (computed < value)) && computed !== null) { + low = mid + 1; + } else { + high = mid; + } + } + return high; + } + return binaryIndexBy(array, value, identity, retHighest); +} + +module.exports = binaryIndex; + +},{"../utility/identity":78,"./binaryIndexBy":42}],42:[function(require,module,exports){ +/* Native method references for those with the same name as other `lodash` methods. */ +var nativeFloor = Math.floor, + nativeMin = Math.min; + +/** Used as references for the maximum length and index of an array. */ +var MAX_ARRAY_LENGTH = 4294967295, + MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1; + +/** + * This function is like `binaryIndex` except that it invokes `iteratee` for + * `value` and each element of `array` to compute their sort ranking. The + * iteratee is invoked with one argument; (value). + * + * @private + * @param {Array} array The sorted array to inspect. + * @param {*} value The value to evaluate. + * @param {Function} iteratee The function invoked per iteration. + * @param {boolean} [retHighest] Specify returning the highest qualified index. + * @returns {number} Returns the index at which `value` should be inserted + * into `array`. + */ +function binaryIndexBy(array, value, iteratee, retHighest) { + value = iteratee(value); + + var low = 0, + high = array ? array.length : 0, + valIsNaN = value !== value, + valIsNull = value === null, + valIsUndef = value === undefined; + + while (low < high) { + var mid = nativeFloor((low + high) / 2), + computed = iteratee(array[mid]), + isDef = computed !== undefined, + isReflexive = computed === computed; + + if (valIsNaN) { + var setLow = isReflexive || retHighest; + } else if (valIsNull) { + setLow = isReflexive && isDef && (retHighest || computed != null); + } else if (valIsUndef) { + setLow = isReflexive && (retHighest || isDef); + } else if (computed == null) { + setLow = false; + } else { + setLow = retHighest ? (computed <= value) : (computed < value); + } + if (setLow) { + low = mid + 1; + } else { + high = mid; + } + } + return nativeMin(high, MAX_ARRAY_INDEX); +} + +module.exports = binaryIndexBy; + +},{}],43:[function(require,module,exports){ +var identity = require('../utility/identity'); + +/** + * A specialized version of `baseCallback` which only supports `this` binding + * and specifying the number of arguments to provide to `func`. + * + * @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. + */ +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); + }; + } + return function() { + return func.apply(thisArg, arguments); + }; +} + +module.exports = bindCallback; + +},{"../utility/identity":78}],44:[function(require,module,exports){ +var bindCallback = require('./bindCallback'), + isIterateeCall = require('./isIterateeCall'), + restParam = require('../function/restParam'); + +/** + * Creates a `_.assign`, `_.defaults`, or `_.merge` function. + * + * @private + * @param {Function} assigner The function to assign values. + * @returns {Function} Returns the new assigner function. + */ +function createAssigner(assigner) { + return restParam(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); + } + if (guard && isIterateeCall(sources[0], sources[1], guard)) { + customizer = length < 3 ? undefined : customizer; + length = 1; + } + while (++index < length) { + var source = sources[index]; + if (source) { + assigner(object, source, customizer); + } + } + return object; + }); +} + +module.exports = createAssigner; + +},{"../function/restParam":13,"./bindCallback":43,"./isIterateeCall":58}],45:[function(require,module,exports){ +var getLength = require('./getLength'), + isLength = require('./isLength'), + toObject = require('./toObject'); + +/** + * Creates a `baseEach` or `baseEachRight` function. + * + * @private + * @param {Function} eachFunc The function to iterate over a collection. + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Function} Returns the new base function. + */ +function createBaseEach(eachFunc, fromRight) { + return function(collection, iteratee) { + var length = collection ? getLength(collection) : 0; + if (!isLength(length)) { + return eachFunc(collection, iteratee); + } + var index = fromRight ? length : -1, + iterable = toObject(collection); + + while ((fromRight ? index-- : ++index < length)) { + if (iteratee(iterable[index], index, iterable) === false) { + break; + } + } + return collection; + }; +} + +module.exports = createBaseEach; + +},{"./getLength":52,"./isLength":60,"./toObject":64}],46:[function(require,module,exports){ +var toObject = require('./toObject'); + +/** + * Creates a base function for `_.forIn` or `_.forInRight`. + * + * @private + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Function} Returns the new base function. + */ +function createBaseFor(fromRight) { + return function(object, iteratee, keysFunc) { + var iterable = toObject(object), + props = keysFunc(object), + length = props.length, + index = fromRight ? length : -1; + + while ((fromRight ? index-- : ++index < length)) { + var key = props[index]; + if (iteratee(iterable[key], key, iterable) === false) { + break; + } + } + return object; + }; +} + +module.exports = createBaseFor; + +},{"./toObject":64}],47:[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; + +},{"../lang/isArray":67,"./baseCallback":20,"./baseFind":24,"./baseFindIndex":25}],48:[function(require,module,exports){ +var bindCallback = require('./bindCallback'), + isArray = require('../lang/isArray'); + +/** + * Creates a function for `_.forEach` or `_.forEachRight`. + * + * @private + * @param {Function} arrayFunc The function to iterate over an array. + * @param {Function} eachFunc The function to iterate over a collection. + * @returns {Function} Returns the new each function. + */ +function createForEach(arrayFunc, eachFunc) { + return function(collection, iteratee, thisArg) { + return (typeof iteratee == 'function' && thisArg === undefined && isArray(collection)) + ? arrayFunc(collection, iteratee) + : eachFunc(collection, bindCallback(iteratee, thisArg, 3)); + }; +} + +module.exports = createForEach; + +},{"../lang/isArray":67,"./bindCallback":43}],49:[function(require,module,exports){ +var arraySome = require('./arraySome'); + +/** + * A specialized version of `baseIsEqualDeep` for arrays with support for + * partial deep comparisons. + * + * @private + * @param {Array} array The array to compare. + * @param {Array} other The other array to compare. + * @param {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. + * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`. + */ +function equalArrays(array, other, equalFunc, customizer, isLoose, stackA, stackB) { + var index = -1, + arrLength = array.length, + othLength = other.length; + + if (arrLength != othLength && !(isLoose && othLength > arrLength)) { + return false; + } + // 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; + + if (result !== undefined) { + if (result) { + continue; + } + return false; + } + // Recursively compare arrays (susceptible to call stack limits). + if (isLoose) { + if (!arraySome(other, function(othValue) { + return arrValue === othValue || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB); + })) { + return false; + } + } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB))) { + return false; + } + } + return true; +} + +module.exports = equalArrays; + +},{"./arraySome":17}],50:[function(require,module,exports){ +/** `Object#toString` result references. */ +var boolTag = '[object Boolean]', + dateTag = '[object Date]', + errorTag = '[object Error]', + numberTag = '[object Number]', + regexpTag = '[object RegExp]', + stringTag = '[object String]'; + +/** + * A specialized version of `baseIsEqualDeep` for comparing objects of + * the same `toStringTag`. + * + * **Note:** This function only supports comparing values with tags of + * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. + * + * @private + * @param {Object} object The object to compare. + * @param {Object} other The other object to compare. + * @param {string} tag The `toStringTag` of the objects to compare. + * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. + */ +function equalByTag(object, other, tag) { + switch (tag) { + case boolTag: + case dateTag: + // Coerce dates and booleans to numbers, dates to milliseconds and booleans + // to `1` or `0` treating invalid dates coerced to `NaN` as not equal. + return +object == +other; + + case errorTag: + return object.name == other.name && object.message == other.message; + + case numberTag: + // Treat `NaN` vs. `NaN` as equal. + 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 + ''); + } + return false; +} + +module.exports = equalByTag; + +},{}],51:[function(require,module,exports){ +var keys = require('../object/keys'); + +/** Used for native method references. */ +var objectProto = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** + * A specialized version of `baseIsEqualDeep` for objects with support for + * partial deep comparisons. + * + * @private + * @param {Object} object The object to compare. + * @param {Object} other The other object to compare. + * @param {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. + * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. + */ +function equalObjects(object, other, equalFunc, customizer, isLoose, stackA, stackB) { + var objProps = keys(object), + objLength = objProps.length, + othProps = keys(other), + othLength = othProps.length; + + if (objLength != othLength && !isLoose) { + return false; + } + var index = objLength; + while (index--) { + var key = objProps[index]; + if (!(isLoose ? key in other : hasOwnProperty.call(other, key))) { + return false; + } + } + var skipCtor = isLoose; + while (++index < objLength) { + key = objProps[index]; + var objValue = object[key], + othValue = other[key], + result = customizer ? customizer(isLoose ? othValue : objValue, isLoose? objValue : othValue, key) : undefined; + + // Recursively compare objects (susceptible to call stack limits). + if (!(result === undefined ? equalFunc(objValue, othValue, customizer, isLoose, stackA, stackB) : result)) { + return false; + } + skipCtor || (skipCtor = key == 'constructor'); + } + if (!skipCtor) { + var objCtor = object.constructor, + othCtor = other.constructor; + + // Non `Object` object instances with different constructors are not equal. + if (objCtor != othCtor && + ('constructor' in object && 'constructor' in other) && + !(typeof objCtor == 'function' && objCtor instanceof objCtor && + typeof othCtor == 'function' && othCtor instanceof othCtor)) { + return false; + } + } + return true; +} + +module.exports = equalObjects; + +},{"../object/keys":74}],52:[function(require,module,exports){ +var baseProperty = require('./baseProperty'); + +/** + * Gets the "length" property value of `object`. + * + * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) + * that affects Safari on at least iOS 8.1-8.3 ARM64. + * + * @private + * @param {Object} object The object to query. + * @returns {*} Returns the "length" value. + */ +var getLength = baseProperty('length'); + +module.exports = getLength; + +},{"./baseProperty":36}],53:[function(require,module,exports){ +var isStrictComparable = require('./isStrictComparable'), + pairs = require('../object/pairs'); + +/** + * Gets the propery 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), + length = result.length; + + while (length--) { + result[length][2] = isStrictComparable(result[length][1]); + } + return result; +} + +module.exports = getMatchData; + +},{"../object/pairs":76,"./isStrictComparable":62}],54:[function(require,module,exports){ +var isNative = require('../lang/isNative'); + +/** + * Gets the native function at `key` of `object`. + * + * @private + * @param {Object} object The object to query. + * @param {string} key The key of the method to get. + * @returns {*} Returns the function if it's native, else `undefined`. + */ +function getNative(object, key) { + var value = object == null ? undefined : object[key]; + return isNative(value) ? value : undefined; +} + +module.exports = getNative; + +},{"../lang/isNative":69}],55:[function(require,module,exports){ +/** + * Gets the index at which the first occurrence of `NaN` is found in `array`. + * + * @private + * @param {Array} array The array to search. + * @param {number} fromIndex The index to search from. + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {number} Returns the index of the matched `NaN`, else `-1`. + */ +function indexOfNaN(array, fromIndex, fromRight) { + var length = array.length, + index = fromIndex + (fromRight ? 0 : -1); + + while ((fromRight ? index-- : ++index < length)) { + var other = array[index]; + if (other !== other) { + return index; + } + } + return -1; +} + +module.exports = indexOfNaN; + +},{}],56:[function(require,module,exports){ +var getLength = require('./getLength'), + isLength = require('./isLength'); + +/** + * Checks if `value` is array-like. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is array-like, else `false`. + */ +function isArrayLike(value) { + return value != null && isLength(getLength(value)); +} + +module.exports = isArrayLike; + +},{"./getLength":52,"./isLength":60}],57:[function(require,module,exports){ +/** Used to detect unsigned integer values. */ +var reIsUint = /^\d+$/; + +/** + * 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; + +/** + * Checks if `value` is a valid array-like index. + * + * @private + * @param {*} value The value to check. + * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. + * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. + */ +function isIndex(value, length) { + value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1; + length = length == null ? MAX_SAFE_INTEGER : length; + return value > -1 && value % 1 == 0 && value < length; +} + +module.exports = isIndex; + +},{}],58:[function(require,module,exports){ +var isArrayLike = require('./isArrayLike'), + isIndex = require('./isIndex'), + isObject = require('../lang/isObject'); + +/** + * Checks if the provided arguments are from an iteratee call. + * + * @private + * @param {*} value The potential iteratee value argument. + * @param {*} index The potential iteratee index or key argument. + * @param {*} object The potential iteratee object argument. + * @returns {boolean} Returns `true` if the arguments are from an iteratee call, else `false`. + */ +function isIterateeCall(value, index, object) { + if (!isObject(object)) { + return false; + } + var type = typeof index; + if (type == 'number' + ? (isArrayLike(object) && isIndex(index, object.length)) + : (type == 'string' && index in object)) { + var other = object[index]; + return value === value ? (value === other) : (other !== other); + } + return false; +} + +module.exports = isIterateeCall; + +},{"../lang/isObject":70,"./isArrayLike":56,"./isIndex":57}],59:[function(require,module,exports){ +var isArray = require('../lang/isArray'), + toObject = require('./toObject'); + +/** Used to match property names within property paths. */ +var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\n\\]|\\.)*?\1)\]/, + reIsPlainProp = /^\w*$/; + +/** + * Checks if `value` is a property name and not a property path. + * + * @private + * @param {*} value The value to check. + * @param {Object} [object] The object to query keys on. + * @returns {boolean} Returns `true` if `value` is a property name, else `false`. + */ +function isKey(value, object) { + var type = typeof value; + if ((type == 'string' && reIsPlainProp.test(value)) || type == 'number') { + return true; + } + if (isArray(value)) { + return false; + } + var result = !reIsDeepProp.test(value); + return result || (object != null && value in toObject(object)); +} + +module.exports = isKey; + +},{"../lang/isArray":67,"./toObject":64}],60:[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; + +/** + * 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). + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. + */ +function isLength(value) { + return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; +} + +module.exports = isLength; + +},{}],61:[function(require,module,exports){ +/** + * Checks if `value` is object-like. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + */ +function isObjectLike(value) { + return !!value && typeof value == 'object'; +} + +module.exports = isObjectLike; + +},{}],62:[function(require,module,exports){ +var isObject = require('../lang/isObject'); + +/** + * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` if suitable for strict + * equality comparisons, else `false`. + */ +function isStrictComparable(value) { + return value === value && !isObject(value); +} + +module.exports = isStrictComparable; + +},{"../lang/isObject":70}],63:[function(require,module,exports){ +var isArguments = require('../lang/isArguments'), + isArray = require('../lang/isArray'), + isIndex = require('./isIndex'), + isLength = require('./isLength'), + keysIn = require('../object/keysIn'); + +/** Used for native method references. */ +var objectProto = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** + * A fallback implementation of `Object.keys` which creates an array of the + * own enumerable property names of `object`. + * + * @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; + + var allowIndexes = !!length && isLength(length) && + (isArray(object) || isArguments(object)); + + var index = -1, + result = []; + + while (++index < propsLength) { + var key = props[index]; + if ((allowIndexes && isIndex(key, length)) || hasOwnProperty.call(object, key)) { + result.push(key); + } + } + return result; +} + +module.exports = shimKeys; + +},{"../lang/isArguments":66,"../lang/isArray":67,"../object/keysIn":75,"./isIndex":57,"./isLength":60}],64:[function(require,module,exports){ +var isObject = require('../lang/isObject'); + +/** + * Converts `value` to an object if it's not one. + * + * @private + * @param {*} value The value to process. + * @returns {Object} Returns the object. + */ +function toObject(value) { + return isObject(value) ? value : Object(value); +} + +module.exports = toObject; + +},{"../lang/isObject":70}],65:[function(require,module,exports){ +var baseToString = require('./baseToString'), + isArray = require('../lang/isArray'); + +/** Used to match property names within property paths. */ +var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\n\\]|\\.)*?)\2)\]/g; + +/** Used to match backslashes in property paths. */ +var reEscapeChar = /\\(\\)?/g; + +/** + * Converts `value` to property path array if it's not one. + * + * @private + * @param {*} value The value to process. + * @returns {Array} Returns the property path 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)); + }); + return result; +} + +module.exports = toPath; + +},{"../lang/isArray":67,"./baseToString":39}],66:[function(require,module,exports){ +var isArrayLike = require('../internal/isArrayLike'), + isObjectLike = require('../internal/isObjectLike'); + +/** Used for native method references. */ +var objectProto = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** Native method references. */ +var propertyIsEnumerable = objectProto.propertyIsEnumerable; + +/** + * 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 + * + * _.isArguments(function() { return arguments; }()); + * // => true + * + * _.isArguments([1, 2, 3]); + * // => false + */ +function isArguments(value) { + return isObjectLike(value) && isArrayLike(value) && + hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee'); +} + +module.exports = isArguments; + +},{"../internal/isArrayLike":56,"../internal/isObjectLike":61}],67:[function(require,module,exports){ +var getNative = require('../internal/getNative'), + isLength = require('../internal/isLength'), + isObjectLike = require('../internal/isObjectLike'); + +/** `Object#toString` result references. */ +var arrayTag = '[object Array]'; + +/** Used for native 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; + +/* Native method references for those with the same name as other `lodash` methods. */ +var nativeIsArray = getNative(Array, 'isArray'); + +/** + * 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 + * + * _.isArray(function() { return arguments; }()); + * // => false + */ +var isArray = nativeIsArray || function(value) { + return isObjectLike(value) && isLength(value.length) && objToString.call(value) == arrayTag; +}; + +module.exports = isArray; + +},{"../internal/getNative":54,"../internal/isLength":60,"../internal/isObjectLike":61}],68:[function(require,module,exports){ +var isObject = require('./isObject'); + +/** `Object#toString` result references. */ +var funcTag = '[object Function]'; + +/** Used for native 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; + +/** + * Checks if `value` is classified as a `Function` object. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @example + * + * _.isFunction(_); + * // => true + * + * _.isFunction(/abc/); + * // => false + */ +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 equivalents which return 'object' for typed array constructors. + return isObject(value) && objToString.call(value) == funcTag; +} + +module.exports = isFunction; + +},{"./isObject":70}],69:[function(require,module,exports){ +var isFunction = require('./isFunction'), + isObjectLike = require('../internal/isObjectLike'); + +/** Used to detect host constructors (Safari > 5). */ +var reIsHostCtor = /^\[object .+?Constructor\]$/; + +/** Used for native method references. */ +var objectProto = Object.prototype; + +/** Used to resolve the decompiled source of functions. */ +var fnToString = Function.prototype.toString; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** Used to detect if a method is native. */ +var reIsNative = RegExp('^' + + fnToString.call(hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g, '\\$&') + .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' +); + +/** + * Checks if `value` is a native function. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a native function, else `false`. + * @example + * + * _.isNative(Array.prototype.push); + * // => true + * + * _.isNative(_); + * // => false + */ +function isNative(value) { + if (value == null) { + return false; + } + if (isFunction(value)) { + return reIsNative.test(fnToString.call(value)); + } + return isObjectLike(value) && reIsHostCtor.test(value); +} + +module.exports = isNative; + +},{"../internal/isObjectLike":61,"./isFunction":68}],70:[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('')`) + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an object, else `false`. + * @example + * + * _.isObject({}); + * // => true + * + * _.isObject([1, 2, 3]); + * // => true + * + * _.isObject(1); + * // => 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; + +},{}],71:[function(require,module,exports){ +var isObjectLike = require('../internal/isObjectLike'); + +/** `Object#toString` result references. */ +var stringTag = '[object String]'; + +/** Used for native 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; + +/** + * 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' || (isObjectLike(value) && objToString.call(value) == stringTag); +} + +module.exports = isString; + +},{"../internal/isObjectLike":61}],72:[function(require,module,exports){ +var isLength = require('../internal/isLength'), + isObjectLike = require('../internal/isObjectLike'); + +/** `Object#toString` result references. */ +var argsTag = '[object Arguments]', + arrayTag = '[object Array]', + boolTag = '[object Boolean]', + dateTag = '[object Date]', + errorTag = '[object Error]', + funcTag = '[object Function]', + mapTag = '[object Map]', + numberTag = '[object Number]', + objectTag = '[object Object]', + regexpTag = '[object RegExp]', + setTag = '[object Set]', + stringTag = '[object String]', + weakMapTag = '[object WeakMap]'; + +var arrayBufferTag = '[object ArrayBuffer]', + float32Tag = '[object Float32Array]', + float64Tag = '[object Float64Array]', + int8Tag = '[object Int8Array]', + int16Tag = '[object Int16Array]', + int32Tag = '[object Int32Array]', + uint8Tag = '[object Uint8Array]', + uint8ClampedTag = '[object Uint8ClampedArray]', + uint16Tag = '[object Uint16Array]', + uint32Tag = '[object Uint32Array]'; + +/** Used to identify `toStringTag` values of typed arrays. */ +var typedArrayTags = {}; +typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = +typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = +typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = +typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = +typedArrayTags[uint32Tag] = true; +typedArrayTags[argsTag] = typedArrayTags[arrayTag] = +typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = +typedArrayTags[dateTag] = typedArrayTags[errorTag] = +typedArrayTags[funcTag] = typedArrayTags[mapTag] = +typedArrayTags[numberTag] = typedArrayTags[objectTag] = +typedArrayTags[regexpTag] = typedArrayTags[setTag] = +typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false; + +/** Used for native 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; + +/** + * 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[objToString.call(value)]; +} + +module.exports = isTypedArray; + +},{"../internal/isLength":60,"../internal/isObjectLike":61}],73:[function(require,module,exports){ +var assignWith = require('../internal/assignWith'), + baseAssign = require('../internal/baseAssign'), + createAssigner = require('../internal/createAssigner'); + +/** + * 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 is invoked to produce the assigned values. + * The `customizer` is bound to `thisArg` and invoked with five arguments: + * (objectValue, sourceValue, key, object, source). + * + * **Note:** This method mutates `object` and is based on + * [`Object.assign`](http://ecma-international.org/ecma-262/6.0/#sec-object.assign). + * + * @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`. + * @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; + * }); + * + * defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred' }); + * // => { 'user': 'barney', 'age': 36 } + */ +var assign = createAssigner(function(object, source, customizer) { + return customizer + ? assignWith(object, source, customizer) + : baseAssign(object, source); +}); + +module.exports = assign; + +},{"../internal/assignWith":18,"../internal/baseAssign":19,"../internal/createAssigner":44}],74:[function(require,module,exports){ +var getNative = require('../internal/getNative'), + isArrayLike = require('../internal/isArrayLike'), + isObject = require('../lang/isObject'), + shimKeys = require('../internal/shimKeys'); + +/* Native method references for those with the same name as other `lodash` methods. */ +var nativeKeys = getNative(Object, 'keys'); + +/** + * 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'] + */ +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); + } + return isObject(object) ? nativeKeys(object) : []; +}; + +module.exports = keys; + +},{"../internal/getNative":54,"../internal/isArrayLike":56,"../internal/shimKeys":63,"../lang/isObject":70}],75:[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'); + +/** Used for native method references. */ +var objectProto = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** + * Creates an array of the own and inherited enumerable property names of `object`. + * + * **Note:** Non-object values are coerced to objects. + * + * @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; + * + * _.keysIn(new Foo); + * // => ['a', 'b', 'c'] (iteration order is not guaranteed) + */ +function keysIn(object) { + if (object == null) { + return []; + } + if (!isObject(object)) { + object = Object(object); + } + var length = object.length; + length = (length && isLength(length) && + (isArray(object) || isArguments(object)) && length) || 0; + + var Ctor = object.constructor, + index = -1, + isProto = typeof Ctor == 'function' && Ctor.prototype === object, + result = Array(length), + skipIndexes = length > 0; + + 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; +} + +module.exports = keysIn; + +},{"../internal/isIndex":57,"../internal/isLength":60,"../lang/isArguments":66,"../lang/isArray":67,"../lang/isObject":70}],76:[function(require,module,exports){ +var keys = require('./keys'), + toObject = require('../internal/toObject'); + +/** + * Creates a two dimensional array of the key-value pairs for `object`, + * e.g. `[[key1, value1], [key2, value2]]`. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the new array of key-value pairs. + * @example + * + * _.pairs({ 'barney': 36, 'fred': 40 }); + * // => [['barney', 36], ['fred', 40]] (iteration order is not guaranteed) + */ +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]]; + } + return result; +} + +module.exports = pairs; + +},{"../internal/toObject":64,"./keys":74}],77:[function(require,module,exports){ +var baseValues = require('../internal/baseValues'), + keys = require('./keys'); + +/** + * Creates an array of the own enumerable property values of `object`. + * + * **Note:** Non-object values are coerced to objects. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property values. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.values(new Foo); + * // => [1, 2] (iteration order is not guaranteed) + * + * _.values('hi'); + * // => ['h', 'i'] + */ +function values(object) { + return baseValues(object, keys(object)); +} + +module.exports = values; + +},{"../internal/baseValues":40,"./keys":74}],78:[function(require,module,exports){ +/** + * This method returns the first argument provided to it. + * + * @static + * @memberOf _ + * @category Utility + * @param {*} value Any value. + * @returns {*} Returns `value`. + * @example + * + * var object = { 'user': 'fred' }; + * + * _.identity(object) === object; + * // => true + */ +function identity(value) { + return value; +} + +module.exports = identity; + +},{}],79:[function(require,module,exports){ +var baseProperty = require('../internal/baseProperty'), + basePropertyDeep = require('../internal/basePropertyDeep'), + isKey = require('../internal/isKey'); + +/** + * Creates a function that returns the property value at `path` on a + * given object. + * + * @static + * @memberOf _ + * @category Utility + * @param {Array|string} path The path of the property to get. + * @returns {Function} Returns the new function. + * @example + * + * var objects = [ + * { 'a': { 'b': { 'c': 2 } } }, + * { 'a': { 'b': { 'c': 1 } } } + * ]; + * + * _.map(objects, _.property('a.b.c')); + * // => [2, 1] + * + * _.pluck(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c'); + * // => [1, 2] + */ +function property(path) { + return isKey(path) ? baseProperty(path) : basePropertyDeep(path); +} + +module.exports = property; + +},{"../internal/baseProperty":36,"../internal/basePropertyDeep":37,"../internal/isKey":59}],80:[function(require,module,exports){ +(function (global){ +'use strict'; + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + +var _ember = (typeof window !== "undefined" ? window['Ember'] : typeof global !== "undefined" ? global['Ember'] : null); + +var _ember2 = _interopRequireDefault(_ember); + +var _emberData = (typeof window !== "undefined" ? window['DS'] : typeof global !== "undefined" ? global['DS'] : null); + +var _emberData2 = _interopRequireDefault(_emberData); + +var _addonAdaptersFirebase = require('../../addon/adapters/firebase'); + +var _addonAdaptersFirebase2 = _interopRequireDefault(_addonAdaptersFirebase); + +var _addonSerializersFirebase = require('../../addon/serializers/firebase'); + +var _addonSerializersFirebase2 = _interopRequireDefault(_addonSerializersFirebase); + +var _addonInitializersEmberfire = require('../../addon/initializers/emberfire'); + +var _addonInitializersEmberfire2 = _interopRequireDefault(_addonInitializersEmberfire); + +_emberData2['default'].FirebaseAdapter = _addonAdaptersFirebase2['default']; +_emberData2['default'].FirebaseSerializer = _addonSerializersFirebase2['default']; + +_ember2['default'].onLoad('Ember.Application', function (Application) { + Application.initializer(_addonInitializersEmberfire2['default']); +}); + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) + +},{"../../addon/adapters/firebase":1,"../../addon/initializers/emberfire":2,"../../addon/serializers/firebase":4}]},{},[80]) + + +//# sourceMappingURL=emberfire.js.map \ No newline at end of file diff --git a/dist/emberfire.js.map b/dist/emberfire.js.map new file mode 100644 index 00000000..9cf1ed6f --- /dev/null +++ b/dist/emberfire.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["node_modules/browserify/node_modules/browser-pack/_prelude.js","addon/adapters/firebase.js","addon/initializers/emberfire.js","addon/mixins/waitable.js","addon/serializers/firebase.js","addon/utils/to-promise.js","node_modules/lodash/array/indexOf.js","node_modules/lodash/array/last.js","node_modules/lodash/collection/filter.js","node_modules/lodash/collection/find.js","node_modules/lodash/collection/forEach.js","node_modules/lodash/collection/includes.js","node_modules/lodash/collection/map.js","node_modules/lodash/function/restParam.js","node_modules/lodash/internal/arrayEach.js","node_modules/lodash/internal/arrayFilter.js","node_modules/lodash/internal/arrayMap.js","node_modules/lodash/internal/arraySome.js","node_modules/lodash/internal/assignWith.js","node_modules/lodash/internal/baseAssign.js","node_modules/lodash/internal/baseCallback.js","node_modules/lodash/internal/baseCopy.js","node_modules/lodash/internal/baseEach.js","node_modules/lodash/internal/baseFilter.js","node_modules/lodash/internal/baseFind.js","node_modules/lodash/internal/baseFindIndex.js","node_modules/lodash/internal/baseFor.js","node_modules/lodash/internal/baseForOwn.js","node_modules/lodash/internal/baseGet.js","node_modules/lodash/internal/baseIndexOf.js","node_modules/lodash/internal/baseIsEqual.js","node_modules/lodash/internal/baseIsEqualDeep.js","node_modules/lodash/internal/baseIsMatch.js","node_modules/lodash/internal/baseMap.js","node_modules/lodash/internal/baseMatches.js","node_modules/lodash/internal/baseMatchesProperty.js","node_modules/lodash/internal/baseProperty.js","node_modules/lodash/internal/basePropertyDeep.js","node_modules/lodash/internal/baseSlice.js","node_modules/lodash/internal/baseToString.js","node_modules/lodash/internal/baseValues.js","node_modules/lodash/internal/binaryIndex.js","node_modules/lodash/internal/binaryIndexBy.js","node_modules/lodash/internal/bindCallback.js","node_modules/lodash/internal/createAssigner.js","node_modules/lodash/internal/createBaseEach.js","node_modules/lodash/internal/createBaseFor.js","node_modules/lodash/internal/createFind.js","node_modules/lodash/internal/createForEach.js","node_modules/lodash/internal/equalArrays.js","node_modules/lodash/internal/equalByTag.js","node_modules/lodash/internal/equalObjects.js","node_modules/lodash/internal/getLength.js","node_modules/lodash/internal/getMatchData.js","node_modules/lodash/internal/getNative.js","node_modules/lodash/internal/indexOfNaN.js","node_modules/lodash/internal/isArrayLike.js","node_modules/lodash/internal/isIndex.js","node_modules/lodash/internal/isIterateeCall.js","node_modules/lodash/internal/isKey.js","node_modules/lodash/internal/isLength.js","node_modules/lodash/internal/isObjectLike.js","node_modules/lodash/internal/isStrictComparable.js","node_modules/lodash/internal/shimKeys.js","node_modules/lodash/internal/toObject.js","node_modules/lodash/internal/toPath.js","node_modules/lodash/lang/isArguments.js","node_modules/lodash/lang/isArray.js","node_modules/lodash/lang/isFunction.js","node_modules/lodash/lang/isNative.js","node_modules/lodash/lang/isObject.js","node_modules/lodash/lang/isString.js","node_modules/lodash/lang/isTypedArray.js","node_modules/lodash/object/assign.js","node_modules/lodash/object/keys.js","node_modules/lodash/object/keysIn.js","node_modules/lodash/object/pairs.js","node_modules/lodash/object/values.js","node_modules/lodash/utility/identity.js","node_modules/lodash/utility/property.js","vendor/legacy/emberfire.js"],"names":[],"mappings":"AAAA;;;;;;;;;;qBCAkB,OAAO;;;;yBACV,YAAY;;;;8BACN,oBAAoB;;;;8BACnB,qBAAqB;;;;uCACvB,2BAA2B;;;;sCAC5B,0BAA0B;;;;mCAC7B,uBAAuB;;;;wCAClB,4BAA4B;;;;kCAC7B,sBAAsB;;;;oCACzB,wBAAwB;;;;AAEzC,IAAI,OAAO,GAAG,mBAAM,IAAI,CAAC,OAAO,CAAC;;AAEjC,IAAI,IAAI,GAAG,SAAP,IAAI,CAAa,GAAG,EAAE;AACxB,MAAI,GAAG,GAAG,mBAAM,CAAC,EAAE,CAAC;;AAEpB,KAAG,CAAC,OAAO,CAAC,UAAS,CAAC,EAAE;AACtB,QAAI,qCAAQ,GAAG,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE;AACvB,SAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KACb;GACF,CAAC,CAAC;;AAEH,SAAO,GAAG,CAAC;CACZ,CAAC;;;;;;;;;;;;;qBAca,uBAAG,OAAO,CAAC,MAAM,8BAAW;;AAEzC,mBAAiB,EAAE,WAAW;;;;;;;;;;;;;;;;;;AAmB9B,MAAI,EAAA,gBAAG;AACL,QAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;;AAEnC,QAAI,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;AACpC,QAAI,CAAC,QAAQ,IAAI,OAAO,QAAQ,KAAK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,CAAC,QAAQ,GAAG,QAAQ,CAAC;SAC3B;AACD,cAAM,CAAC,KAAK,CAAC,CAAC;OACf,MAAM;AACL,eAAO,EAAE,CAAC;OACX;KACF,CAAC;AACF,QAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AACpB,MAAE,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;GACzB,CAAC,CAAC;CACJ;;;;;;;AClBD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC7DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACfA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC7BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC7CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACbA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACfA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACfA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACZA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACfA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1EA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC7CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;qBC/BkB,OAAO;;;;yBACV,YAAY;;;;qCACC,+BAA+B;;;;wCAC5B,kCAAkC;;;;0CAChC,oCAAoC;;;;AAErE,uBAAG,eAAe,qCAAkB,CAAC;AACrC,uBAAG,kBAAkB,wCAAqB,CAAC;;AAE3C,mBAAM,MAAM,CAAC,mBAAmB,EAAE,UAAS,WAAW,EAAE;AACtD,aAAW,CAAC,WAAW,yCAAsB,CAAC;CAC/C,CAAC,CAAC","file":"emberfire.js","sourceRoot":"/source/","sourcesContent":["(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw f.code=\"MODULE_NOT_FOUND\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"&&require;for(var o=0;o.firebaseio.com/')\n * });\n * ```\n *\n * Requests for `App.Post` now target `https://.firebaseio.com/posts`.\n *\n * @property firebase\n * @type {Firebase}\n * @constructor\n */\n init() {\n this._super.apply(this, arguments);\n\n var firebase = this.get('firebase');\n if (!firebase || typeof firebase !== 'object') {\n throw new Error('Please set the `firebase` property on the adapter.');\n }\n // If provided Firebase reference was a query (eg: limits), make it a ref.\n this._ref = firebase.ref();\n // Keep track of what types `.findAll()` has been called for\n this._findAllMapForType = {};\n // Keep a cache to check modified relationships against\n this._recordCacheForType = {};\n // Used to batch records into the store\n this._queue = [];\n },\n\n\n /**\n * Uses push() to generate chronologically ordered unique IDs.\n *\n * @return {String}\n */\n generateIdForRecord() {\n return this._getKey(this._ref.push());\n },\n\n\n /**\n * Use the Firebase DataSnapshot's key as the record id\n *\n * @param {Object} snapshot - A Firebase snapshot\n * @param {Object} payload - The payload that will be pushed into the store\n * @return {Object} payload\n */\n _assignIdToPayload(snapshot) {\n var payload = snapshot.val();\n if (payload !== null && typeof payload === 'object' && typeof payload.id === 'undefined') {\n payload.id = this._getKey(snapshot);\n }\n return payload;\n },\n\n\n /**\n * Called by the store to retrieve the JSON for a given type and ID. The\n * method will return a promise which will resolve when the value is\n * successfully fetched from Firebase.\n *\n * Additionally, from this point on, the object's value in the store will\n * also be automatically updated whenever the remote value changes.\n */\n findRecord(store, typeClass, id) {\n var ref = this._getCollectionRef(typeClass, id);\n\n var log = `DS: FirebaseAdapter#findRecord ${typeClass.modelName} to ${ref.toString()}`;\n\n return this._fetch(ref, log).then((snapshot) => {\n var payload = this._assignIdToPayload(snapshot);\n this._updateRecordCacheForType(typeClass, payload);\n if (payload === null) {\n var error = new Error(`no record was found at ${ref.toString()}`);\n error.recordId = id;\n throw error;\n }\n\n return payload;\n });\n },\n\n\n /**\n * Promise interface for once('value') that also handle test waiters.\n *\n * @param {Firebase} ref\n * @param {String} log\n * @return {Promise}\n * @private\n */\n _fetch(ref, log) {\n this._incrementWaiters();\n return new Promise((resolve, reject) => {\n\n ref.once('value', (snapshot) => {\n this._decrementWaiters();\n Ember.run(null, resolve, snapshot);\n\n }, (err) => {\n this._decrementWaiters();\n Ember.run(null, reject, err);\n });\n\n }, log);\n },\n\n\n recordWasPushed(store, modelName, record) {\n if (!record.__listening) {\n var typeClass = store.modelFor(modelName);\n this.listenForChanges(store, typeClass, record);\n }\n },\n\n\n recordWillUnload(store, record) {\n if (record.__listening) {\n this.stopListening(store, record.constructor, record);\n }\n },\n\n\n recordWillDelete(store, record) {\n record.eachRelationship((key, relationship) => {\n if (relationship.kind === 'belongsTo') {\n var parentRecord = record.get(relationship.key);\n var inverseKey = record.inverseFor(relationship.key);\n if (inverseKey && parentRecord.get('id')) {\n var parentRef = this._getCollectionRef(inverseKey.type, parentRecord.get('id'));\n this._removeHasManyRecord(store, parentRef, inverseKey.name, record.id);\n }\n }\n });\n },\n\n\n listenForChanges(store, typeClass, record) {\n // embedded records will get their changes from parent listeners\n if (!this.isRecordEmbedded(record)) {\n record.__listening = true;\n var ref = this._getCollectionRef(typeClass, record.id);\n var called = false;\n ref.on('value', (snapshot) => {\n if (called) {\n Ember.run(() => {\n this._handleChildValue(store, typeClass, snapshot);\n });\n }\n called = true;\n }, (error) => {\n Ember.Logger.error(error);\n });\n }\n },\n\n\n stopListening(store, typeClass, record) {\n if (record.__listening) {\n var ref = this._getCollectionRef(typeClass, record.id);\n ref.off('value');\n record.__listening = false;\n }\n },\n\n\n /**\n * Called by the store to retrieve the JSON for all of the records for a\n * given type. The method will return a promise which will resolve when the\n * value is successfully fetched from Firebase.\n *\n * Additionally, from this point on, any records of this type that are added,\n * removed or modified from Firebase will automatically be reflected in the\n * store.\n */\n findAll(store, typeClass) {\n var ref = this._getCollectionRef(typeClass);\n\n var log = `DS: FirebaseAdapter#findAll ${typeClass.modelName} to ${ref.toString()}`;\n\n return this._fetch(ref, log).then((snapshot) => {\n if (!this._findAllHasEventsForType(typeClass)) {\n this._findAllAddEventListeners(store, typeClass, ref);\n }\n var results = [];\n snapshot.forEach((childSnapshot) => {\n var payload = this._assignIdToPayload(childSnapshot);\n this._updateRecordCacheForType(typeClass, payload);\n results.push(payload);\n });\n\n return results;\n });\n },\n\n\n query(store, typeClass, query, recordArray) {\n var ref = this._getCollectionRef(typeClass);\n var modelName = typeClass.modelName;\n\n ref = this.applyQueryToRef(ref, query);\n\n ref.on('child_added', Ember.run.bind(this, function (snapshot) {\n var record = store.peekRecord(modelName, snapshot.key());\n\n if (!record || !record.__listening) {\n var payload = this._assignIdToPayload(snapshot);\n var normalizedData = store.normalize(typeClass.modelName, payload);\n this._updateRecordCacheForType(typeClass, payload);\n record = store.push(normalizedData);\n }\n\n if (record) {\n recordArray.get('content').addObject(record._internalModel);\n }\n }));\n\n // `child_changed` is already handled by the record's\n // value listener after a store.push. `child_moved` is\n // a much less common case because it relates to priority\n\n ref.on('child_removed', Ember.run.bind(this, function (snapshot) {\n var record = store.peekRecord(modelName, snapshot.key());\n if (record) {\n recordArray.get('content').removeObject(record._internalModel);\n }\n }));\n\n // clean up event handlers when the array is being destroyed\n // so that future firebase events wont keep trying to use a\n // destroyed store/serializer\n recordArray.__firebaseCleanup = function () {\n ref.off('child_added');\n ref.off('child_removed');\n };\n\n var log = `DS: FirebaseAdapter#query ${modelName} with ${query}`;\n\n return this._fetch(ref, log).then((snapshot) => {\n if (!this._findAllHasEventsForType(typeClass)) {\n this._findAllAddEventListeners(store, typeClass, ref);\n }\n var results = [];\n snapshot.forEach((childSnapshot) => {\n var payload = this._assignIdToPayload(childSnapshot);\n this._updateRecordCacheForType(typeClass, payload);\n results.push(payload);\n });\n return results;\n });\n },\n\n\n applyQueryToRef(ref, query) {\n\n if (!query.orderBy) {\n query.orderBy = '_key';\n }\n\n if (query.orderBy === '_key'){\n ref = ref.orderByKey();\n } else if (query.orderBy === '_value') {\n ref = ref.orderByValue();\n } else if (query.orderBy === '_priority') {\n ref = ref.orderByPriority();\n } else {\n ref = ref.orderByChild(query.orderBy);\n }\n\n ['limitToFirst', 'limitToLast', 'startAt', 'endAt', 'equalTo'].forEach(function (key) {\n if (query[key] || query[key] === '' || query[key] === false) {\n ref = ref[key](query[key]);\n }\n });\n\n return ref;\n },\n\n\n /**\n * Keep track of what types `.findAll()` has been called for\n * so duplicate listeners aren't added\n */\n _findAllMapForType: undefined,\n\n\n /**\n * Determine if the current type is already listening for children events\n */\n _findAllHasEventsForType(typeClass) {\n return !Ember.isNone(this._findAllMapForType[typeClass.modelName]);\n },\n\n\n /**\n * After `.findAll()` is called on a modelName, continue to listen for\n * `child_added`, `child_removed`, and `child_changed`\n */\n _findAllAddEventListeners(store, typeClass, ref) {\n var modelName = typeClass.modelName;\n this._findAllMapForType[modelName] = true;\n\n ref.on('child_added', Ember.run.bind(this, function (snapshot) {\n if (!store.hasRecordForId(modelName, this._getKey(snapshot))) {\n this._handleChildValue(store, typeClass, snapshot);\n }\n }));\n },\n\n\n /**\n * Push a new child record into the store\n */\n _handleChildValue(store, typeClass, snapshot) {\n // No idea why we need this, we are already turning off the callback by\n // calling ref.off in recordWillUnload. Something is fishy here\n if (store.isDestroying) {\n return;\n }\n var value = snapshot.val();\n if (value === null) {\n var id = this._getKey(snapshot);\n var record = store.peekRecord(typeClass.modelName, id);\n // TODO: refactor using ED\n if (!record.get('isDeleted')) {\n record.deleteRecord();\n }\n } else {\n var payload = this._assignIdToPayload(snapshot);\n\n this._enqueue(function FirebaseAdapter$enqueueStorePush() {\n if (!store.isDestroying) {\n var normalizedData = store.normalize(typeClass.modelName, payload);\n store.push(normalizedData);\n }\n });\n }\n },\n\n\n /**\n * `createRecord` is an alias for `updateRecord` because calling \\\n * `ref.set()` would wipe out any existing relationships\n */\n createRecord(store, typeClass, snapshot) {\n return this.updateRecord(store, typeClass, snapshot).then(() => {\n this.listenForChanges(store, typeClass, snapshot.record);\n });\n },\n\n\n /**\n * Called by the store when a record is created/updated via the `save`\n * method on a model record instance.\n *\n * The `updateRecord` method serializes the record and performs an `update()`\n * at the the Firebase location and a `.set()` at any relationship locations\n * The method will return a promise which will be resolved when the data and\n * any relationships have been successfully saved to Firebase.\n *\n * We take an optional record reference, in order for this method to be usable\n * for saving nested records as well.\n */\n updateRecord(store, typeClass, snapshot) {\n var recordRef = this._getAbsoluteRef(snapshot.record);\n var recordCache = this._getRecordCache(typeClass, snapshot.id);\n var pathPieces = recordRef.path.toString().split('/');\n var lastPiece = pathPieces[pathPieces.length-1];\n var serializedRecord = snapshot.serialize({\n includeId: (lastPiece !== snapshot.id) // record has no firebase `key` in path\n });\n const serializer = store.serializerFor(typeClass.modelName);\n\n return new Promise((resolve, reject) => {\n var relationshipsToSave = [];\n // first we remove all relationships data from the serialized record, we backup the\n // removed data so that we can save it at a later stage.\n snapshot.record.eachRelationship((key, relationship) => {\n const relationshipKey = serializer.keyForRelationship(key);\n const data = serializedRecord[relationshipKey];\n const isEmbedded = this.isRelationshipEmbedded(store, typeClass.modelName, relationship);\n const hasMany = relationship.kind === 'hasMany';\n if (hasMany || isEmbedded) {\n if (!Ember.isNone(data)) {\n relationshipsToSave.push({\n data:data,\n relationship:relationship,\n isEmbedded:isEmbedded,\n hasMany:hasMany\n });\n }\n delete serializedRecord[relationshipKey];\n }\n });\n var reportError = (errors) => {\n var error = new Error(`Some errors were encountered while saving ${typeClass} ${snapshot.id}`);\n error.errors = errors;\n reject(error);\n };\n this._updateRecord(recordRef, serializedRecord).then(() => {\n // and now we construct the list of promise to save relationships.\n var savedRelationships = relationshipsToSave.map((relationshipToSave) => {\n const data = relationshipToSave.data;\n const relationship = relationshipToSave.relationship;\n if (relationshipToSave.hasMany) {\n return this._saveHasManyRelationship(store, typeClass, relationship, data, recordRef, recordCache);\n } else {\n // embedded belongsTo, we need to fill in the informations.\n if (relationshipToSave.isEmbedded) {\n return this._saveEmbeddedBelongsToRecord(store, typeClass, relationship, data, recordRef);\n }\n }\n }\n );\n return Ember.RSVP.allSettled(savedRelationships);\n }).catch((e) => {\n reportError([e]);\n }).then((results) => {\n var rejected = Ember.A(results).filterBy('state', 'rejected');\n if (rejected.length !== 0) {\n reportError(rejected.mapBy('reason').toArray());\n } else {\n resolve();\n }\n });\n }, `DS: FirebaseAdapter#updateRecord ${typeClass} to ${recordRef.toString()}`);\n },\n\n\n /**\n * Update a single record without caring for the relationships\n * @param {Firebase} recordRef\n * @param {Object} serializedRecord\n * @return {Promise}\n */\n _updateRecord(recordRef, serializedRecord) {\n return toPromise(recordRef.update, recordRef, [serializedRecord]);\n },\n\n\n /**\n * Call _saveHasManyRelationshipRecord on each record in the relationship\n * and then resolve once they have all settled\n */\n _saveHasManyRelationship(store, typeClass, relationship, ids, recordRef, recordCache) {\n if (!Ember.isArray(ids)) {\n throw new Error('hasMany relationships must must be an array');\n }\n var idsCache = Ember.A(recordCache[relationship.key]);\n var dirtyRecords = [];\n\n // Added\n var addedRecords = filter(ids, (id) => {\n return !idsCache.contains(id);\n });\n\n // Dirty\n dirtyRecords = filter(ids, (id) => {\n var relatedModelName = relationship.type;\n return store.hasRecordForId(relatedModelName, id) && store.peekRecord(relatedModelName, id).get('hasDirtyAttributes') === true;\n });\n\n dirtyRecords = map(uniq(dirtyRecords.concat(addedRecords)), (id) => {\n return this._saveHasManyRecord(store, typeClass, relationship, recordRef, id);\n });\n\n // Removed\n var removedRecords = filter(idsCache, (id) => {\n return !includes(ids, id);\n });\n\n removedRecords = map(removedRecords, (id) => {\n return this._removeHasManyRecord(store, recordRef, relationship.key, id);\n });\n // Combine all the saved records\n var savedRecords = dirtyRecords.concat(removedRecords);\n // Wait for all the updates to finish\n return Ember.RSVP.allSettled(savedRecords).then((savedRecords) => {\n var rejected = Ember.A(Ember.A(savedRecords).filterBy('state', 'rejected'));\n if (rejected.get('length') === 0) {\n // Update the cache\n recordCache[relationship.key] = ids;\n return savedRecords;\n }\n else {\n var error = new Error(`Some errors were encountered while saving a hasMany relationship ${relationship.parentType} -> ${relationship.type}`);\n error.errors = Ember.A(rejected).mapBy('reason');\n throw error;\n }\n });\n },\n\n\n /**\n * If the relationship is `async: true`, create a child ref\n * named with the record id and set the value to true\n\n * If the relationship is `embedded: true`, create a child ref\n * named with the record id and update the value to the serialized\n * version of the record\n */\n _saveHasManyRecord(store, typeClass, relationship, parentRef, id) {\n const serializer = store.serializerFor(typeClass.modelName);\n var ref = this._getRelationshipRef(parentRef, serializer.keyForRelationship(relationship.key), id);\n var record = store.peekRecord(relationship.type, id);\n var isEmbedded = this.isRelationshipEmbedded(store, typeClass.modelName, relationship);\n if (isEmbedded) {\n return record.save();\n }\n\n return toPromise(ref.set, ref, [true]);\n },\n\n\n /**\n * Determine from the serializer if the relationship is embedded via the\n * serializer's `attrs` hash.\n *\n * @return {Boolean} Is the relationship embedded?\n */\n isRelationshipEmbedded(store, modelName, relationship) {\n var serializer = store.serializerFor(modelName);\n return serializer.hasDeserializeRecordsOption(relationship.key);\n },\n\n\n /**\n * Determine from if the record is embedded via implicit relationships.\n *\n * @return {Boolean} Is the relationship embedded?\n */\n isRecordEmbedded(record) {\n if (record._internalModel) {\n record = record._internalModel;\n }\n\n var found = this.getFirstEmbeddingParent(record);\n\n return !!found;\n },\n\n\n /**\n * Remove a relationship\n */\n _removeHasManyRecord(store, parentRef, key, id) {\n var ref = this._getRelationshipRef(parentRef, key, id);\n return toPromise(ref.remove, ref, [], ref.toString());\n },\n\n\n /**\n * Save an embedded belongsTo record and set its internal firebase ref\n *\n * @return {Promise}\n */\n _saveEmbeddedBelongsToRecord(store, typeClass, relationship, id, parentRef) {\n var record = store.peekRecord(relationship.type, id);\n if (record) {\n return record.save();\n }\n return Ember.RSVP.Promise.reject(new Error(`Unable to find record with id ${id} from embedded relationship: ${JSON.stringify(relationship)}`));\n },\n\n\n /**\n * Called by the store when a record is deleted.\n */\n deleteRecord(store, typeClass, snapshot) {\n var ref = this._getAbsoluteRef(snapshot.record);\n ref.off('value');\n return toPromise(ref.remove, ref);\n },\n\n\n /**\n * Determines a path fo a given type\n */\n pathForType(modelName) {\n var camelized = Ember.String.camelize(modelName);\n return Ember.String.pluralize(camelized);\n },\n\n\n /**\n * Return a Firebase reference for a given modelName and optional ID.\n */\n _getCollectionRef(typeClass, id) {\n var ref = this._ref;\n if (typeClass) {\n ref = ref.child(this.pathForType(typeClass.modelName));\n }\n if (id) {\n ref = ref.child(id);\n }\n return ref;\n },\n\n\n /**\n * Returns a Firebase reference for a record taking into account if the record is embedded\n *\n * @param {DS.Model} record\n * @return {Firebase}\n */\n _getAbsoluteRef(record) {\n if (record._internalModel) {\n record = record._internalModel;\n }\n\n var embeddingParent = this.getFirstEmbeddingParent(record);\n\n if (embeddingParent) {\n var { record: parent, relationship } = embeddingParent;\n var recordRef = this._getAbsoluteRef(parent).child(relationship.key);\n\n if (relationship.kind === 'hasMany') {\n recordRef = recordRef.child(record.id);\n }\n return recordRef;\n }\n\n return this._getCollectionRef(record.type, record.id);\n },\n\n\n /**\n * Returns the parent record and relationship where any embedding is detected\n *\n * @param {DS.InternalModel} internalModel\n * @return {Object}\n */\n getFirstEmbeddingParent(internalModel) {\n var embeddingParentRel = find(internalModel._implicitRelationships, (implicitRel) => {\n var members = implicitRel.members.toArray();\n var parent = members[0];\n\n if (!parent) {\n return false;\n }\n\n var parentRel = parent._relationships.get(implicitRel.inverseKey);\n return this.isRelationshipEmbedded(this.store, parent.type.modelName, parentRel.relationshipMeta);\n });\n\n if (embeddingParentRel) {\n var parent = embeddingParentRel.members.toArray()[0];\n var parentKey = embeddingParentRel.inverseKey;\n var parentRel = parent._relationships.get(parentKey).relationshipMeta;\n return { record: parent, relationship: parentRel };\n }\n },\n\n\n /**\n * Return a Firebase reference based on a relationship key and record id\n */\n _getRelationshipRef(ref, key, id) {\n return ref.child(key).child(id);\n },\n\n\n /**\n * The amount of time (ms) before the _queue is flushed\n */\n _queueFlushDelay: (1000/60), // 60fps\n\n\n /**\n * Called after the first item is pushed into the _queue\n */\n _queueScheduleFlush() {\n Ember.run.later(this, this._queueFlush, this._queueFlushDelay);\n },\n\n\n /**\n * Call each function in the _queue and the reset the _queue\n */\n _queueFlush() {\n forEach(this._queue, function FirebaseAdapter$flushQueueItem(queueItem) {\n var fn = queueItem[0];\n var args = queueItem[1];\n fn.apply(null, args);\n });\n this._queue.length = 0;\n },\n\n\n /**\n * Push a new function into the _queue and then schedule a\n * flush if the item is the first to be pushed\n */\n _enqueue(callback, args) {\n //Only do the queueing if we scheduled a delay\n if (this._queueFlushDelay) {\n var length = this._queue.push([callback, args]);\n if (length === 1) {\n this._queueScheduleFlush();\n }\n } else {\n callback.apply(null, args);\n }\n },\n\n\n /**\n * A cache of hasMany relationships that can be used to\n * diff against new relationships when a model is saved\n */\n _recordCacheForType: undefined,\n\n\n /**\n * _updateHasManyCacheForType\n */\n _updateRecordCacheForType(typeClass, payload) {\n if (!payload) { return; }\n var id = payload.id;\n var cache = this._getRecordCache(typeClass, id);\n // Only cache relationships for now\n typeClass.eachRelationship((key, relationship) => {\n if (relationship.kind === 'hasMany') {\n var ids = payload[key];\n cache[key] = !Ember.isNone(ids) ? Ember.A(Object.keys(ids)) : Ember.A();\n }\n });\n },\n\n\n /**\n * Get or create the cache for a record\n */\n _getRecordCache(typeClass, id) {\n var modelName = typeClass.modelName;\n var cache = this._recordCacheForType;\n cache[modelName] = cache[modelName] || {};\n cache[modelName][id] = cache[modelName][id] || {};\n return cache[modelName][id];\n },\n\n\n /**\n * A utility for retrieving the key name of a Firebase ref or\n * DataSnapshot. This is backwards-compatible with `name()`\n * from Firebase 1.x.x and `key()` from Firebase 2.0.0+. Once\n * support for Firebase 1.x.x is dropped in EmberFire, this\n * helper can be removed.\n */\n _getKey(refOrSnapshot) {\n return (typeof refOrSnapshot.key === 'function') ? refOrSnapshot.key() : refOrSnapshot.name();\n },\n\n\n /**\n * We don't need background reloading, because firebase!\n */\n shouldBackgroundReloadRecord() {\n return false;\n }\n});\n","import Ember from 'ember';\nimport DS from 'ember-data';\nimport Firebase from 'firebase';\nimport FirebaseAdapter from '../adapters/firebase';\nimport FirebaseSerializer from '../serializers/firebase';\nimport forEach from 'lodash/collection/forEach';\n\nvar VERSION = '1.6.6';\n\nif (Ember.libraries) {\n if (Firebase.SDK_VERSION) {\n Ember.libraries.registerCoreLibrary('Firebase', Firebase.SDK_VERSION);\n }\n\n Ember.libraries.registerCoreLibrary('EmberFire', VERSION);\n}\n\nexport default {\n name: 'emberfire',\n before: 'ember-data',\n initialize() {\n\n // To support Ember versions below 2.1.0 as well.\n // See http://emberjs.com/deprecations/v2.x/#toc_initializer-arity\n let application = arguments[1] || arguments[0];\n\n application.register('adapter:-firebase', FirebaseAdapter);\n application.register('serializer:-firebase', FirebaseSerializer);\n\n // Monkeypatch the store until ED gives us a good way to listen to push events\n if (!DS.Store.prototype._emberfirePatched) {\n DS.Store.reopen({\n _emberfirePatched: true,\n\n push() {\n var result = this._super.apply(this, arguments);\n var records = result;\n\n if (!Ember.isArray(result)) {\n records = [result];\n }\n\n forEach(records, (record) => {\n var modelName = record.constructor.modelName;\n var adapter = this.adapterFor(modelName);\n if (adapter.recordWasPushed) {\n adapter.recordWasPushed(this, modelName, record);\n }\n });\n\n return result;\n },\n\n recordWillUnload(record) {\n var adapter = this.adapterFor(record.constructor.modelName);\n if (adapter.recordWillUnload) {\n adapter.recordWillUnload(this, record);\n }\n },\n\n recordWillDelete(record) {\n var adapter = this.adapterFor(record.constructor.modelName);\n if (adapter.recordWillDelete) {\n adapter.recordWillDelete(this, record);\n }\n }\n });\n }\n\n if (!DS.Model.prototype._emberfirePatched) {\n DS.Model.reopen({\n _emberfirePatched: true,\n\n unloadRecord() {\n this.store.recordWillUnload(this);\n return this._super();\n },\n\n deleteRecord() {\n this.store.recordWillDelete(this);\n this._super();\n },\n\n ref() {\n var adapter = this.store.adapterFor(this.constructor.modelName);\n if (adapter._getAbsoluteRef) {\n return adapter._getAbsoluteRef(this);\n }\n }\n });\n }\n\n if (!DS.AdapterPopulatedRecordArray.prototype._emberfirePatched) {\n DS.AdapterPopulatedRecordArray.reopen({\n _emberfirePatched: true,\n\n willDestroy() {\n if (this.__firebaseCleanup) {\n this.__firebaseCleanup();\n }\n return this._super();\n }\n });\n }\n\n DS.FirebaseAdapter = FirebaseAdapter;\n DS.FirebaseSerializer = FirebaseSerializer;\n }\n};\n","import Ember from 'ember';\n\nexport default Ember.Mixin.create({\n\n init() {\n this._super.apply(this, arguments);\n // unresolved requests, used in testing\n this._reasons = 0;\n\n if (Ember.testing) {\n this._registerWaiter();\n }\n },\n\n\n _incrementWaiters() {\n this._reasons++;\n },\n\n\n _decrementWaiters() {\n this._reasons--;\n },\n\n\n /**\n * The waiter calls this to determine if testing should wait. Override in\n * the implementing class if needed.\n *\n * @return {Boolean}\n * @private\n */\n _shouldWait() {\n return this._reasons === 0;\n },\n\n\n /**\n * Wire up a waiter for this instance.\n *\n * @private\n */\n _registerWaiter: function() {\n this._waiter = () => {\n return this._shouldWait();\n };\n Ember.Test.registerWaiter(this._waiter);\n },\n\n});\n","import Ember from 'ember';\nimport DS from 'ember-data';\nimport assign from 'lodash/object/assign';\n\n/**\n * The Firebase serializer helps normalize relationships and can be extended on\n * a per model basis.\n */\nexport default DS.JSONSerializer.extend(DS.EmbeddedRecordsMixin, {\n isNewSerializerAPI: true,\n\n\n /**\n * Firebase does not send null values, it omits the key altogether. This nullifies omitted\n * properties so that property deletions sync correctly.\n *\n * @override\n */\n extractAttributes(modelClass, resourceHash) {\n var attributes = this._super(modelClass, resourceHash);\n\n // nullify omitted attributes\n modelClass.eachAttribute((key) => {\n if (!attributes.hasOwnProperty(key)) {\n attributes[key] = null;\n }\n });\n\n return attributes;\n },\n\n\n /**\n * @override\n */\n extractRelationships(modelClass, payload) {\n this.normalizeRelationships(modelClass, payload);\n return this._super(modelClass, payload);\n },\n\n\n /**\n * Normalizes `hasMany` relationship structure before passing\n * to `JSONSerializer.extractRelationships`\n *\n * before:\n *\n * ```js\n * {\n * comments: {\n * abc: true,\n * def: true,\n * }\n * }\n * ```\n *\n * after:\n *\n * ```js\n * {\n * comments: [ 'abc', 'def' ]\n * }\n * ```\n *\n * Or for embedded objects:\n *\n * ```js\n * {\n * comments: {\n * 'abc': { body: 'a' },\n * 'def': { body: 'd' )\n * }\n * }\n * ```\n *\n * these should become:\n *\n * ```js\n * {\n * comments: [\n * {\n * id: 'abc',\n * body: 'a'\n * },\n * {\n * id: 'def',\n * body: 'd'\n * }\n * ]\n * }\n * ```\n */\n normalizeRelationships(modelClass, payload) {\n modelClass.eachRelationship((key, meta) => {\n let relationshipKey = this.keyForRelationship(key, meta.kind, 'deserialize');\n\n if (meta.kind === 'hasMany') {\n if (payload.hasOwnProperty(relationshipKey)) {\n let relationshipPayload = payload[relationshipKey];\n // embedded\n if (this.hasDeserializeRecordsOption(key)) {\n if (typeof relationshipPayload === 'object' && !Ember.isArray(relationshipPayload)) {\n relationshipPayload = Object.keys(relationshipPayload).map((id) => {\n return assign({ id: id }, relationshipPayload[id]);\n });\n } else if (Ember.isArray(relationshipPayload)) {\n relationshipPayload = this._addNumericIdsToEmbeddedArray(relationshipPayload);\n } else {\n throw new Error(`${modelClass.toString()} relationship ${meta.kind}('${meta.type}') must contain embedded records with an \\`id\\`. Example: { \"${key}\": { \"${meta.type}_1\": { \"id\": \"${meta.type}_1\" } } } instead got: ${JSON.stringify(payload[key])}`);\n }\n }\n\n // normalized\n else {\n if (typeof relationshipPayload === 'object' && !Ember.isArray(relationshipPayload)) {\n relationshipPayload = Object.keys(relationshipPayload);\n } else if (Ember.isArray(relationshipPayload)) {\n relationshipPayload = this._convertBooleanArrayToIds(relationshipPayload);\n } else {\n throw new Error(`${modelClass.toString()} relationship ${meta.kind}('${meta.type}') must be a key/value map. Example: { \"${key}\": { \"${meta.type}_1\": true } } instead got: ${JSON.stringify(payload[key])}`);\n }\n }\n\n payload[relationshipKey] = relationshipPayload;\n }\n\n // hasMany property is not present\n // server will not send a property which has no content\n // (i.e. it will never send `comments: null`) so we need to\n // force the empty relationship\n else {\n payload[relationshipKey] = [];\n }\n }\n\n if (meta.kind === 'belongsTo') {\n if (!payload.hasOwnProperty(relationshipKey)) {\n // server wont send property if it was made null elsewhere\n payload[relationshipKey] = null;\n }\n }\n });\n },\n\n\n /**\n * Coerce arrays back into relationship arrays. When numeric ids are used\n * the firebase server will send back arrays instead of object hashes in\n * certain situations.\n *\n * See the conditions and reasoning here:\n * https://www.firebase.com/docs/web/guide/understanding-data.html#section-arrays-in-firebase\n *\n * Stored in Firebase:\n *\n * ```json\n * {\n * \"0\": true,\n * \"1\": true,\n * \"3\": true\n * }\n * ```\n *\n * Given back by the JS client:\n *\n * ```js\n * [true, true, null, true]\n * ```\n *\n * What we need:\n *\n * ```js\n * [ \"0\", \"1\", \"3\" ]\n * ```\n *\n * @param {Array} arr Input array\n * @return {Array} Fixed array\n * @private\n */\n _convertBooleanArrayToIds(arr) {\n var result = [];\n for (var i = 0; i < arr.length; i++) {\n if (arr[i] === true) {\n result.push('' + i);\n }\n else if (typeof arr[i] === 'string') {\n throw new Error(`hasMany relationship contains invalid data, should be in the form: { comment_1: true, comment_2: true } but was ${JSON.stringify(arr)}`);\n }\n }\n return result;\n },\n\n\n /**\n * Fix embedded array ids.\n *\n * Objects are stored in Firebase with their id in the key only:\n *\n * ```json\n * {\n * \"0\": { obj0 },\n * \"1\": { obj1 },\n * \"3\": { obj3 }\n * }\n * ```\n *\n * Given back by the JS client:\n *\n * ```js\n * [{ obj0 }, { obj1 }, null, { obj3 }]\n * ```\n *\n * What we need:\n *\n * ```js\n * [ { id: '0', ...obj0 }, { id: '1', ...obj1 }, { id: '3', ...obj3 } ]\n * ```\n *\n * https://www.firebase.com/docs/web/guide/understanding-data.html#section-arrays-in-firebase\n *\n * @param {Array} arr Input array\n * @return {Array} Fixed array\n * @private\n */\n _addNumericIdsToEmbeddedArray(arr) {\n var result = [];\n for (var i = 0; i < arr.length; i++) {\n if (arr[i]) {\n if (typeof arr[i] !== 'object') {\n throw new Error(`expecting embedded object hash but found ${JSON.stringify(arr[i])}`);\n }\n result.push(assign({ id: '' + i }, arr[i]));\n }\n }\n return result;\n },\n\n\n /**\n * Even when records are embedded, bypass EmbeddedRecordsMixin\n * and invoke JSONSerializer's method which serializes to ids only.\n *\n * The adapter handles saving the embedded records via `r.save()`\n * and ensures that dirty states and rollback work.\n *\n * Will not be neccesary when this issue is resolved:\n *\n * https://github.com/emberjs/data/issues/2487\n *\n * @override\n */\n serializeHasMany(snapshot, json, relationship) {\n DS.JSONSerializer.prototype.serializeHasMany.call(this, snapshot, json, relationship);\n },\n\n\n /**\n * @see #serializeHasMany\n * @override\n */\n serializeBelongsTo(snapshot, json, relationship) {\n DS.JSONSerializer.prototype.serializeBelongsTo.call(this, snapshot, json, relationship);\n },\n\n\n /**\n * @override\n */\n _shouldSerializeHasMany(snapshot, key, relationship) {\n return this._canSerialize(key);\n }\n});\n","import Ember from 'ember';\n\nexport default function(fn, context, _args, errorMsg) {\n var args = _args || [];\n return new Ember.RSVP.Promise(function(resolve, reject) {\n var callback = function(error) {\n if (error) {\n if (errorMsg && typeof error === 'object') {\n error.location = errorMsg;\n }\n reject(error);\n } else {\n resolve();\n }\n };\n args.push(callback);\n fn.apply(context, args);\n });\n}\n","var baseIndexOf = require('../internal/baseIndexOf'),\n binaryIndex = require('../internal/binaryIndex');\n\n/* Native method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max;\n\n/**\n * Gets the index at which the first occurrence of `value` is found in `array`\n * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)\n * for equality comparisons. If `fromIndex` is negative, it is used as the offset\n * from the end of `array`. If `array` is sorted providing `true` for `fromIndex`\n * performs a faster binary search.\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {Array} array The array to search.\n * @param {*} value The value to search for.\n * @param {boolean|number} [fromIndex=0] The index to search from or `true`\n * to perform a binary search on a sorted array.\n * @returns {number} Returns the index of the matched value, else `-1`.\n * @example\n *\n * _.indexOf([1, 2, 1, 2], 2);\n * // => 1\n *\n * // using `fromIndex`\n * _.indexOf([1, 2, 1, 2], 2, 2);\n * // => 3\n *\n * // performing a binary search\n * _.indexOf([1, 1, 2, 2], 2, true);\n * // => 2\n */\nfunction indexOf(array, value, fromIndex) {\n var length = array ? array.length : 0;\n if (!length) {\n return -1;\n }\n if (typeof fromIndex == 'number') {\n fromIndex = fromIndex < 0 ? nativeMax(length + fromIndex, 0) : fromIndex;\n } else if (fromIndex) {\n var index = binaryIndex(array, value);\n if (index < length &&\n (value === value ? (value === array[index]) : (array[index] !== array[index]))) {\n return index;\n }\n return -1;\n }\n return baseIndexOf(array, value, fromIndex || 0);\n}\n\nmodule.exports = indexOf;\n","/**\n * Gets the last element of `array`.\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {Array} array The array to query.\n * @returns {*} Returns the last element of `array`.\n * @example\n *\n * _.last([1, 2, 3]);\n * // => 3\n */\nfunction last(array) {\n var length = array ? array.length : 0;\n return length ? array[length - 1] : undefined;\n}\n\nmodule.exports = last;\n","var arrayFilter = require('../internal/arrayFilter'),\n baseCallback = require('../internal/baseCallback'),\n baseFilter = require('../internal/baseFilter'),\n isArray = require('../lang/isArray');\n\n/**\n * Iterates over elements of `collection`, returning an array of all elements\n * `predicate` returns truthy for. The predicate is bound to `thisArg` and\n * invoked with three arguments: (value, index|key, collection).\n *\n * If a property name is provided for `predicate` the created `_.property`\n * style callback returns the property value of the given element.\n *\n * If a value is also provided for `thisArg` the created `_.matchesProperty`\n * style callback returns `true` for elements that have a matching property\n * value, else `false`.\n *\n * If an object is provided for `predicate` the created `_.matches` style\n * callback returns `true` for elements that have the properties of the given\n * object, else `false`.\n *\n * @static\n * @memberOf _\n * @alias select\n * @category Collection\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function|Object|string} [predicate=_.identity] The function invoked\n * per iteration.\n * @param {*} [thisArg] The `this` binding of `predicate`.\n * @returns {Array} Returns the new filtered array.\n * @example\n *\n * _.filter([4, 5, 6], function(n) {\n * return n % 2 == 0;\n * });\n * // => [4, 6]\n *\n * var users = [\n * { 'user': 'barney', 'age': 36, 'active': true },\n * { 'user': 'fred', 'age': 40, 'active': false }\n * ];\n *\n * // using the `_.matches` callback shorthand\n * _.pluck(_.filter(users, { 'age': 36, 'active': true }), 'user');\n * // => ['barney']\n *\n * // using the `_.matchesProperty` callback shorthand\n * _.pluck(_.filter(users, 'active', false), 'user');\n * // => ['fred']\n *\n * // using the `_.property` callback shorthand\n * _.pluck(_.filter(users, 'active'), 'user');\n * // => ['barney']\n */\nfunction filter(collection, predicate, thisArg) {\n var func = isArray(collection) ? arrayFilter : baseFilter;\n predicate = baseCallback(predicate, thisArg, 3);\n return func(collection, predicate);\n}\n\nmodule.exports = filter;\n","var baseEach = require('../internal/baseEach'),\n createFind = require('../internal/createFind');\n\n/**\n * Iterates over elements of `collection`, returning the first element\n * `predicate` returns truthy for. The predicate is bound to `thisArg` and\n * invoked with three arguments: (value, index|key, collection).\n *\n * If a property name is provided for `predicate` the created `_.property`\n * style callback returns the property value of the given element.\n *\n * If a value is also provided for `thisArg` the created `_.matchesProperty`\n * style callback returns `true` for elements that have a matching property\n * value, else `false`.\n *\n * If an object is provided for `predicate` the created `_.matches` style\n * callback returns `true` for elements that have the properties of the given\n * object, else `false`.\n *\n * @static\n * @memberOf _\n * @alias detect\n * @category Collection\n * @param {Array|Object|string} collection The collection to search.\n * @param {Function|Object|string} [predicate=_.identity] The function invoked\n * per iteration.\n * @param {*} [thisArg] The `this` binding of `predicate`.\n * @returns {*} Returns the matched element, else `undefined`.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'age': 36, 'active': true },\n * { 'user': 'fred', 'age': 40, 'active': false },\n * { 'user': 'pebbles', 'age': 1, 'active': true }\n * ];\n *\n * _.result(_.find(users, function(chr) {\n * return chr.age < 40;\n * }), 'user');\n * // => 'barney'\n *\n * // using the `_.matches` callback shorthand\n * _.result(_.find(users, { 'age': 1, 'active': true }), 'user');\n * // => 'pebbles'\n *\n * // using the `_.matchesProperty` callback shorthand\n * _.result(_.find(users, 'active', false), 'user');\n * // => 'fred'\n *\n * // using the `_.property` callback shorthand\n * _.result(_.find(users, 'active'), 'user');\n * // => 'barney'\n */\nvar find = createFind(baseEach);\n\nmodule.exports = find;\n","var arrayEach = require('../internal/arrayEach'),\n baseEach = require('../internal/baseEach'),\n createForEach = require('../internal/createForEach');\n\n/**\n * Iterates over elements of `collection` invoking `iteratee` for each element.\n * The `iteratee` is bound to `thisArg` and invoked with three arguments:\n * (value, index|key, collection). Iteratee functions may exit iteration early\n * by explicitly returning `false`.\n *\n * **Note:** As with other \"Collections\" methods, objects with a \"length\" property\n * are iterated like arrays. To avoid this behavior `_.forIn` or `_.forOwn`\n * may be used for object iteration.\n *\n * @static\n * @memberOf _\n * @alias each\n * @category Collection\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @param {*} [thisArg] The `this` binding of `iteratee`.\n * @returns {Array|Object|string} Returns `collection`.\n * @example\n *\n * _([1, 2]).forEach(function(n) {\n * console.log(n);\n * }).value();\n * // => logs each value from left to right and returns the array\n *\n * _.forEach({ 'a': 1, 'b': 2 }, function(n, key) {\n * console.log(n, key);\n * });\n * // => logs each value-key pair and returns the object (iteration order is not guaranteed)\n */\nvar forEach = createForEach(arrayEach, baseEach);\n\nmodule.exports = forEach;\n","var baseIndexOf = require('../internal/baseIndexOf'),\n getLength = require('../internal/getLength'),\n isArray = require('../lang/isArray'),\n isIterateeCall = require('../internal/isIterateeCall'),\n isLength = require('../internal/isLength'),\n isString = require('../lang/isString'),\n values = require('../object/values');\n\n/* Native method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max;\n\n/**\n * Checks if `value` is in `collection` using\n * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)\n * for equality comparisons. If `fromIndex` is negative, it is used as the offset\n * from the end of `collection`.\n *\n * @static\n * @memberOf _\n * @alias contains, include\n * @category Collection\n * @param {Array|Object|string} collection The collection to search.\n * @param {*} target The value to search for.\n * @param {number} [fromIndex=0] The index to search from.\n * @param- {Object} [guard] Enables use as a callback for functions like `_.reduce`.\n * @returns {boolean} Returns `true` if a matching element is found, else `false`.\n * @example\n *\n * _.includes([1, 2, 3], 1);\n * // => true\n *\n * _.includes([1, 2, 3], 1, 2);\n * // => false\n *\n * _.includes({ 'user': 'fred', 'age': 40 }, 'fred');\n * // => true\n *\n * _.includes('pebbles', 'eb');\n * // => true\n */\nfunction includes(collection, target, fromIndex, guard) {\n var length = collection ? getLength(collection) : 0;\n if (!isLength(length)) {\n collection = values(collection);\n length = collection.length;\n }\n if (typeof fromIndex != 'number' || (guard && isIterateeCall(target, fromIndex, guard))) {\n fromIndex = 0;\n } else {\n fromIndex = fromIndex < 0 ? nativeMax(length + fromIndex, 0) : (fromIndex || 0);\n }\n return (typeof collection == 'string' || !isArray(collection) && isString(collection))\n ? (fromIndex <= length && collection.indexOf(target, fromIndex) > -1)\n : (!!length && baseIndexOf(collection, target, fromIndex) > -1);\n}\n\nmodule.exports = includes;\n","var arrayMap = require('../internal/arrayMap'),\n baseCallback = require('../internal/baseCallback'),\n baseMap = require('../internal/baseMap'),\n isArray = require('../lang/isArray');\n\n/**\n * Creates an array of values by running each element in `collection` through\n * `iteratee`. The `iteratee` is bound to `thisArg` and invoked with three\n * arguments: (value, index|key, collection).\n *\n * If a property name is provided for `iteratee` the created `_.property`\n * style callback returns the property value of the given element.\n *\n * If a value is also provided for `thisArg` the created `_.matchesProperty`\n * style callback returns `true` for elements that have a matching property\n * value, else `false`.\n *\n * If an object is provided for `iteratee` the created `_.matches` style\n * callback returns `true` for elements that have the properties of the given\n * object, else `false`.\n *\n * Many lodash methods are guarded to work as iteratees for methods like\n * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.\n *\n * The guarded methods are:\n * `ary`, `callback`, `chunk`, `clone`, `create`, `curry`, `curryRight`,\n * `drop`, `dropRight`, `every`, `fill`, `flatten`, `invert`, `max`, `min`,\n * `parseInt`, `slice`, `sortBy`, `take`, `takeRight`, `template`, `trim`,\n * `trimLeft`, `trimRight`, `trunc`, `random`, `range`, `sample`, `some`,\n * `sum`, `uniq`, and `words`\n *\n * @static\n * @memberOf _\n * @alias collect\n * @category Collection\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function|Object|string} [iteratee=_.identity] The function invoked\n * per iteration.\n * @param {*} [thisArg] The `this` binding of `iteratee`.\n * @returns {Array} Returns the new mapped array.\n * @example\n *\n * function timesThree(n) {\n * return n * 3;\n * }\n *\n * _.map([1, 2], timesThree);\n * // => [3, 6]\n *\n * _.map({ 'a': 1, 'b': 2 }, timesThree);\n * // => [3, 6] (iteration order is not guaranteed)\n *\n * var users = [\n * { 'user': 'barney' },\n * { 'user': 'fred' }\n * ];\n *\n * // using the `_.property` callback shorthand\n * _.map(users, 'user');\n * // => ['barney', 'fred']\n */\nfunction map(collection, iteratee, thisArg) {\n var func = isArray(collection) ? arrayMap : baseMap;\n iteratee = baseCallback(iteratee, thisArg, 3);\n return func(collection, iteratee);\n}\n\nmodule.exports = map;\n","/** Used as the `TypeError` message for \"Functions\" methods. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/* Native method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max;\n\n/**\n * Creates a function that invokes `func` with the `this` binding of the\n * created function and arguments from `start` and beyond provided as an array.\n *\n * **Note:** This method is based on the [rest parameter](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/rest_parameters).\n *\n * @static\n * @memberOf _\n * @category Function\n * @param {Function} func The function to apply a rest parameter to.\n * @param {number} [start=func.length-1] The start position of the rest parameter.\n * @returns {Function} Returns the new function.\n * @example\n *\n * var say = _.restParam(function(what, names) {\n * return what + ' ' + _.initial(names).join(', ') +\n * (_.size(names) > 1 ? ', & ' : '') + _.last(names);\n * });\n *\n * say('hello', 'fred', 'barney', 'pebbles');\n * // => 'hello fred, barney, & pebbles'\n */\nfunction restParam(func, start) {\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n start = nativeMax(start === undefined ? (func.length - 1) : (+start || 0), 0);\n return function() {\n var args = arguments,\n index = -1,\n length = nativeMax(args.length - start, 0),\n rest = Array(length);\n\n while (++index < length) {\n rest[index] = args[start + index];\n }\n switch (start) {\n case 0: return func.call(this, rest);\n case 1: return func.call(this, args[0], rest);\n case 2: return func.call(this, args[0], args[1], rest);\n }\n var otherArgs = Array(start + 1);\n index = -1;\n while (++index < start) {\n otherArgs[index] = args[index];\n }\n otherArgs[start] = rest;\n return func.apply(this, otherArgs);\n };\n}\n\nmodule.exports = restParam;\n","/**\n * A specialized version of `_.forEach` for arrays without support for callback\n * shorthands and `this` binding.\n *\n * @private\n * @param {Array} array The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns `array`.\n */\nfunction arrayEach(array, iteratee) {\n var index = -1,\n length = array.length;\n\n while (++index < length) {\n if (iteratee(array[index], index, array) === false) {\n break;\n }\n }\n return array;\n}\n\nmodule.exports = arrayEach;\n","/**\n * A specialized version of `_.filter` for arrays without support for callback\n * shorthands and `this` binding.\n *\n * @private\n * @param {Array} array The array to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {Array} Returns the new filtered array.\n */\nfunction arrayFilter(array, predicate) {\n var index = -1,\n length = array.length,\n resIndex = -1,\n result = [];\n\n while (++index < length) {\n var value = array[index];\n if (predicate(value, index, array)) {\n result[++resIndex] = value;\n }\n }\n return result;\n}\n\nmodule.exports = arrayFilter;\n","/**\n * A specialized version of `_.map` for arrays without support for callback\n * shorthands and `this` binding.\n *\n * @private\n * @param {Array} array The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the new mapped array.\n */\nfunction arrayMap(array, iteratee) {\n var index = -1,\n length = array.length,\n result = Array(length);\n\n while (++index < length) {\n result[index] = iteratee(array[index], index, array);\n }\n return result;\n}\n\nmodule.exports = arrayMap;\n","/**\n * A specialized version of `_.some` for arrays without support for callback\n * shorthands and `this` binding.\n *\n * @private\n * @param {Array} array The array to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {boolean} Returns `true` if any element passes the predicate check,\n * else `false`.\n */\nfunction arraySome(array, predicate) {\n var index = -1,\n length = array.length;\n\n while (++index < length) {\n if (predicate(array[index], index, array)) {\n return true;\n }\n }\n return false;\n}\n\nmodule.exports = arraySome;\n","var keys = require('../object/keys');\n\n/**\n * A specialized version of `_.assign` for customizing assigned values without\n * support for argument juggling, multiple sources, and `this` binding `customizer`\n * functions.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @param {Function} customizer The function to customize assigned values.\n * @returns {Object} Returns `object`.\n */\nfunction assignWith(object, source, customizer) {\n var index = -1,\n props = keys(source),\n length = props.length;\n\n while (++index < length) {\n var key = props[index],\n value = object[key],\n result = customizer(value, source[key], key, object, source);\n\n if ((result === result ? (result !== value) : (value === value)) ||\n (value === undefined && !(key in object))) {\n object[key] = result;\n }\n }\n return object;\n}\n\nmodule.exports = assignWith;\n","var baseCopy = require('./baseCopy'),\n keys = require('../object/keys');\n\n/**\n * The base implementation of `_.assign` without support for argument juggling,\n * multiple sources, and `customizer` functions.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @returns {Object} Returns `object`.\n */\nfunction baseAssign(object, source) {\n return source == null\n ? object\n : baseCopy(source, keys(source), object);\n}\n\nmodule.exports = baseAssign;\n","var baseMatches = require('./baseMatches'),\n baseMatchesProperty = require('./baseMatchesProperty'),\n bindCallback = require('./bindCallback'),\n identity = require('../utility/identity'),\n property = require('../utility/property');\n\n/**\n * The base implementation of `_.callback` which supports specifying the\n * number of arguments to provide to `func`.\n *\n * @private\n * @param {*} [func=_.identity] The value to convert to a callback.\n * @param {*} [thisArg] The `this` binding of `func`.\n * @param {number} [argCount] The number of arguments to provide to `func`.\n * @returns {Function} Returns the callback.\n */\nfunction baseCallback(func, thisArg, argCount) {\n var type = typeof func;\n if (type == 'function') {\n return thisArg === undefined\n ? func\n : bindCallback(func, thisArg, argCount);\n }\n if (func == null) {\n return identity;\n }\n if (type == 'object') {\n return baseMatches(func);\n }\n return thisArg === undefined\n ? property(func)\n : baseMatchesProperty(func, thisArg);\n}\n\nmodule.exports = baseCallback;\n","/**\n * Copies properties of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy properties from.\n * @param {Array} props The property names to copy.\n * @param {Object} [object={}] The object to copy properties to.\n * @returns {Object} Returns `object`.\n */\nfunction baseCopy(source, props, object) {\n object || (object = {});\n\n var index = -1,\n length = props.length;\n\n while (++index < length) {\n var key = props[index];\n object[key] = source[key];\n }\n return object;\n}\n\nmodule.exports = baseCopy;\n","var baseForOwn = require('./baseForOwn'),\n createBaseEach = require('./createBaseEach');\n\n/**\n * The base implementation of `_.forEach` without support for callback\n * shorthands and `this` binding.\n *\n * @private\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array|Object|string} Returns `collection`.\n */\nvar baseEach = createBaseEach(baseForOwn);\n\nmodule.exports = baseEach;\n","var baseEach = require('./baseEach');\n\n/**\n * The base implementation of `_.filter` without support for callback\n * shorthands and `this` binding.\n *\n * @private\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {Array} Returns the new filtered array.\n */\nfunction baseFilter(collection, predicate) {\n var result = [];\n baseEach(collection, function(value, index, collection) {\n if (predicate(value, index, collection)) {\n result.push(value);\n }\n });\n return result;\n}\n\nmodule.exports = baseFilter;\n","/**\n * The base implementation of `_.find`, `_.findLast`, `_.findKey`, and `_.findLastKey`,\n * without support for callback shorthands and `this` binding, which iterates\n * over `collection` using the provided `eachFunc`.\n *\n * @private\n * @param {Array|Object|string} collection The collection to search.\n * @param {Function} predicate The function invoked per iteration.\n * @param {Function} eachFunc The function to iterate over `collection`.\n * @param {boolean} [retKey] Specify returning the key of the found element\n * instead of the element itself.\n * @returns {*} Returns the found element or its key, else `undefined`.\n */\nfunction baseFind(collection, predicate, eachFunc, retKey) {\n var result;\n eachFunc(collection, function(value, key, collection) {\n if (predicate(value, key, collection)) {\n result = retKey ? key : value;\n return false;\n }\n });\n return result;\n}\n\nmodule.exports = baseFind;\n","/**\n * The base implementation of `_.findIndex` and `_.findLastIndex` without\n * support for callback shorthands and `this` binding.\n *\n * @private\n * @param {Array} array The array to search.\n * @param {Function} predicate The function invoked per iteration.\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\nfunction baseFindIndex(array, predicate, fromRight) {\n var length = array.length,\n index = fromRight ? length : -1;\n\n while ((fromRight ? index-- : ++index < length)) {\n if (predicate(array[index], index, array)) {\n return index;\n }\n }\n return -1;\n}\n\nmodule.exports = baseFindIndex;\n","var createBaseFor = require('./createBaseFor');\n\n/**\n * The base implementation of `baseForIn` and `baseForOwn` which iterates\n * over `object` properties returned by `keysFunc` invoking `iteratee` for\n * each property. Iteratee functions may exit iteration early by explicitly\n * returning `false`.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {Function} keysFunc The function to get the keys of `object`.\n * @returns {Object} Returns `object`.\n */\nvar baseFor = createBaseFor();\n\nmodule.exports = baseFor;\n","var baseFor = require('./baseFor'),\n keys = require('../object/keys');\n\n/**\n * The base implementation of `_.forOwn` without support for callback\n * shorthands and `this` binding.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Object} Returns `object`.\n */\nfunction baseForOwn(object, iteratee) {\n return baseFor(object, iteratee, keys);\n}\n\nmodule.exports = baseForOwn;\n","var toObject = require('./toObject');\n\n/**\n * The base implementation of `get` without support for string paths\n * and default values.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array} path The path of the property to get.\n * @param {string} [pathKey] The key representation of path.\n * @returns {*} Returns the resolved value.\n */\nfunction baseGet(object, path, pathKey) {\n if (object == null) {\n return;\n }\n if (pathKey !== undefined && pathKey in toObject(object)) {\n path = [pathKey];\n }\n var index = 0,\n length = path.length;\n\n while (object != null && index < length) {\n object = object[path[index++]];\n }\n return (index && index == length) ? object : undefined;\n}\n\nmodule.exports = baseGet;\n","var indexOfNaN = require('./indexOfNaN');\n\n/**\n * The base implementation of `_.indexOf` without support for binary searches.\n *\n * @private\n * @param {Array} array The array to search.\n * @param {*} value The value to search for.\n * @param {number} fromIndex The index to search from.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\nfunction baseIndexOf(array, value, fromIndex) {\n if (value !== value) {\n return indexOfNaN(array, fromIndex);\n }\n var index = fromIndex - 1,\n length = array.length;\n\n while (++index < length) {\n if (array[index] === value) {\n return index;\n }\n }\n return -1;\n}\n\nmodule.exports = baseIndexOf;\n","var baseIsEqualDeep = require('./baseIsEqualDeep'),\n isObject = require('../lang/isObject'),\n isObjectLike = require('./isObjectLike');\n\n/**\n * The base implementation of `_.isEqual` without support for `this` binding\n * `customizer` functions.\n *\n * @private\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @param {Function} [customizer] The function to customize comparing values.\n * @param {boolean} [isLoose] Specify performing partial comparisons.\n * @param {Array} [stackA] Tracks traversed `value` objects.\n * @param {Array} [stackB] Tracks traversed `other` objects.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n */\nfunction baseIsEqual(value, other, customizer, isLoose, stackA, stackB) {\n if (value === other) {\n return true;\n }\n if (value == null || other == null || (!isObject(value) && !isObjectLike(other))) {\n return value !== value && other !== other;\n }\n return baseIsEqualDeep(value, other, baseIsEqual, customizer, isLoose, stackA, stackB);\n}\n\nmodule.exports = baseIsEqual;\n","var equalArrays = require('./equalArrays'),\n equalByTag = require('./equalByTag'),\n equalObjects = require('./equalObjects'),\n isArray = require('../lang/isArray'),\n isTypedArray = require('../lang/isTypedArray');\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n arrayTag = '[object Array]',\n objectTag = '[object Object]';\n\n/** Used for native method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objToString = objectProto.toString;\n\n/**\n * A specialized version of `baseIsEqual` for arrays and objects which performs\n * deep comparisons and tracks traversed objects enabling objects with circular\n * references to be compared.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Function} [customizer] The function to customize comparing objects.\n * @param {boolean} [isLoose] Specify performing partial comparisons.\n * @param {Array} [stackA=[]] Tracks traversed `value` objects.\n * @param {Array} [stackB=[]] Tracks traversed `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\nfunction baseIsEqualDeep(object, other, equalFunc, customizer, isLoose, stackA, stackB) {\n var objIsArr = isArray(object),\n othIsArr = isArray(other),\n objTag = arrayTag,\n othTag = arrayTag;\n\n if (!objIsArr) {\n objTag = objToString.call(object);\n if (objTag == argsTag) {\n objTag = objectTag;\n } else if (objTag != objectTag) {\n objIsArr = isTypedArray(object);\n }\n }\n if (!othIsArr) {\n othTag = objToString.call(other);\n if (othTag == argsTag) {\n othTag = objectTag;\n } else if (othTag != objectTag) {\n othIsArr = isTypedArray(other);\n }\n }\n var objIsObj = objTag == objectTag,\n othIsObj = othTag == objectTag,\n isSameTag = objTag == othTag;\n\n if (isSameTag && !(objIsArr || objIsObj)) {\n return equalByTag(object, other, objTag);\n }\n if (!isLoose) {\n var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),\n othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');\n\n if (objIsWrapped || othIsWrapped) {\n return equalFunc(objIsWrapped ? object.value() : object, othIsWrapped ? other.value() : other, customizer, isLoose, stackA, stackB);\n }\n }\n if (!isSameTag) {\n return false;\n }\n // Assume cyclic values are equal.\n // For more information on detecting circular references see https://es5.github.io/#JO.\n stackA || (stackA = []);\n stackB || (stackB = []);\n\n var length = stackA.length;\n while (length--) {\n if (stackA[length] == object) {\n return stackB[length] == other;\n }\n }\n // Add `object` and `other` to the stack of traversed objects.\n stackA.push(object);\n stackB.push(other);\n\n var result = (objIsArr ? equalArrays : equalObjects)(object, other, equalFunc, customizer, isLoose, stackA, stackB);\n\n stackA.pop();\n stackB.pop();\n\n return result;\n}\n\nmodule.exports = baseIsEqualDeep;\n","var baseIsEqual = require('./baseIsEqual'),\n toObject = require('./toObject');\n\n/**\n * The base implementation of `_.isMatch` without support for callback\n * shorthands and `this` binding.\n *\n * @private\n * @param {Object} object The object to inspect.\n * @param {Array} matchData The propery names, values, and compare flags to match.\n * @param {Function} [customizer] The function to customize comparing objects.\n * @returns {boolean} Returns `true` if `object` is a match, else `false`.\n */\nfunction baseIsMatch(object, matchData, customizer) {\n var index = matchData.length,\n length = index,\n noCustomizer = !customizer;\n\n if (object == null) {\n return !length;\n }\n object = toObject(object);\n while (index--) {\n var data = matchData[index];\n if ((noCustomizer && data[2])\n ? data[1] !== object[data[0]]\n : !(data[0] in object)\n ) {\n return false;\n }\n }\n while (++index < length) {\n data = matchData[index];\n var key = data[0],\n objValue = object[key],\n srcValue = data[1];\n\n if (noCustomizer && data[2]) {\n if (objValue === undefined && !(key in object)) {\n return false;\n }\n } else {\n var result = customizer ? customizer(objValue, srcValue, key) : undefined;\n if (!(result === undefined ? baseIsEqual(srcValue, objValue, customizer, true) : result)) {\n return false;\n }\n }\n }\n return true;\n}\n\nmodule.exports = baseIsMatch;\n","var baseEach = require('./baseEach'),\n isArrayLike = require('./isArrayLike');\n\n/**\n * The base implementation of `_.map` without support for callback shorthands\n * and `this` binding.\n *\n * @private\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the new mapped array.\n */\nfunction baseMap(collection, iteratee) {\n var index = -1,\n result = isArrayLike(collection) ? Array(collection.length) : [];\n\n baseEach(collection, function(value, key, collection) {\n result[++index] = iteratee(value, key, collection);\n });\n return result;\n}\n\nmodule.exports = baseMap;\n","var baseIsMatch = require('./baseIsMatch'),\n getMatchData = require('./getMatchData'),\n toObject = require('./toObject');\n\n/**\n * The base implementation of `_.matches` which does not clone `source`.\n *\n * @private\n * @param {Object} source The object of property values to match.\n * @returns {Function} Returns the new function.\n */\nfunction baseMatches(source) {\n var matchData = getMatchData(source);\n if (matchData.length == 1 && matchData[0][2]) {\n var key = matchData[0][0],\n value = matchData[0][1];\n\n return function(object) {\n if (object == null) {\n return false;\n }\n return object[key] === value && (value !== undefined || (key in toObject(object)));\n };\n }\n return function(object) {\n return baseIsMatch(object, matchData);\n };\n}\n\nmodule.exports = baseMatches;\n","var baseGet = require('./baseGet'),\n baseIsEqual = require('./baseIsEqual'),\n baseSlice = require('./baseSlice'),\n isArray = require('../lang/isArray'),\n isKey = require('./isKey'),\n isStrictComparable = require('./isStrictComparable'),\n last = require('../array/last'),\n toObject = require('./toObject'),\n toPath = require('./toPath');\n\n/**\n * The base implementation of `_.matchesProperty` which does not clone `srcValue`.\n *\n * @private\n * @param {string} path The path of the property to get.\n * @param {*} srcValue The value to compare.\n * @returns {Function} Returns the new function.\n */\nfunction baseMatchesProperty(path, srcValue) {\n var isArr = isArray(path),\n isCommon = isKey(path) && isStrictComparable(srcValue),\n pathKey = (path + '');\n\n path = toPath(path);\n return function(object) {\n if (object == null) {\n return false;\n }\n var key = pathKey;\n object = toObject(object);\n if ((isArr || !isCommon) && !(key in object)) {\n object = path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1));\n if (object == null) {\n return false;\n }\n key = last(path);\n object = toObject(object);\n }\n return object[key] === srcValue\n ? (srcValue !== undefined || (key in object))\n : baseIsEqual(srcValue, object[key], undefined, true);\n };\n}\n\nmodule.exports = baseMatchesProperty;\n","/**\n * The base implementation of `_.property` without support for deep paths.\n *\n * @private\n * @param {string} key The key of the property to get.\n * @returns {Function} Returns the new function.\n */\nfunction baseProperty(key) {\n return function(object) {\n return object == null ? undefined : object[key];\n };\n}\n\nmodule.exports = baseProperty;\n","var baseGet = require('./baseGet'),\n toPath = require('./toPath');\n\n/**\n * A specialized version of `baseProperty` which supports deep paths.\n *\n * @private\n * @param {Array|string} path The path of the property to get.\n * @returns {Function} Returns the new function.\n */\nfunction basePropertyDeep(path) {\n var pathKey = (path + '');\n path = toPath(path);\n return function(object) {\n return baseGet(object, path, pathKey);\n };\n}\n\nmodule.exports = basePropertyDeep;\n","/**\n * The base implementation of `_.slice` without an iteratee call guard.\n *\n * @private\n * @param {Array} array The array to slice.\n * @param {number} [start=0] The start position.\n * @param {number} [end=array.length] The end position.\n * @returns {Array} Returns the slice of `array`.\n */\nfunction baseSlice(array, start, end) {\n var index = -1,\n length = array.length;\n\n start = start == null ? 0 : (+start || 0);\n if (start < 0) {\n start = -start > length ? 0 : (length + start);\n }\n end = (end === undefined || end > length) ? length : (+end || 0);\n if (end < 0) {\n end += length;\n }\n length = start > end ? 0 : ((end - start) >>> 0);\n start >>>= 0;\n\n var result = Array(length);\n while (++index < length) {\n result[index] = array[index + start];\n }\n return result;\n}\n\nmodule.exports = baseSlice;\n","/**\n * Converts `value` to a string if it's not one. An empty string is returned\n * for `null` or `undefined` values.\n *\n * @private\n * @param {*} value The value to process.\n * @returns {string} Returns the string.\n */\nfunction baseToString(value) {\n return value == null ? '' : (value + '');\n}\n\nmodule.exports = baseToString;\n","/**\n * The base implementation of `_.values` and `_.valuesIn` which creates an\n * array of `object` property values corresponding to the property names\n * of `props`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array} props The property names to get values for.\n * @returns {Object} Returns the array of property values.\n */\nfunction baseValues(object, props) {\n var index = -1,\n length = props.length,\n result = Array(length);\n\n while (++index < length) {\n result[index] = object[props[index]];\n }\n return result;\n}\n\nmodule.exports = baseValues;\n","var binaryIndexBy = require('./binaryIndexBy'),\n identity = require('../utility/identity');\n\n/** Used as references for the maximum length and index of an array. */\nvar MAX_ARRAY_LENGTH = 4294967295,\n HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;\n\n/**\n * Performs a binary search of `array` to determine the index at which `value`\n * should be inserted into `array` in order to maintain its sort order.\n *\n * @private\n * @param {Array} array The sorted array to inspect.\n * @param {*} value The value to evaluate.\n * @param {boolean} [retHighest] Specify returning the highest qualified index.\n * @returns {number} Returns the index at which `value` should be inserted\n * into `array`.\n */\nfunction binaryIndex(array, value, retHighest) {\n var low = 0,\n high = array ? array.length : low;\n\n if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {\n while (low < high) {\n var mid = (low + high) >>> 1,\n computed = array[mid];\n\n if ((retHighest ? (computed <= value) : (computed < value)) && computed !== null) {\n low = mid + 1;\n } else {\n high = mid;\n }\n }\n return high;\n }\n return binaryIndexBy(array, value, identity, retHighest);\n}\n\nmodule.exports = binaryIndex;\n","/* Native method references for those with the same name as other `lodash` methods. */\nvar nativeFloor = Math.floor,\n nativeMin = Math.min;\n\n/** Used as references for the maximum length and index of an array. */\nvar MAX_ARRAY_LENGTH = 4294967295,\n MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1;\n\n/**\n * This function is like `binaryIndex` except that it invokes `iteratee` for\n * `value` and each element of `array` to compute their sort ranking. The\n * iteratee is invoked with one argument; (value).\n *\n * @private\n * @param {Array} array The sorted array to inspect.\n * @param {*} value The value to evaluate.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {boolean} [retHighest] Specify returning the highest qualified index.\n * @returns {number} Returns the index at which `value` should be inserted\n * into `array`.\n */\nfunction binaryIndexBy(array, value, iteratee, retHighest) {\n value = iteratee(value);\n\n var low = 0,\n high = array ? array.length : 0,\n valIsNaN = value !== value,\n valIsNull = value === null,\n valIsUndef = value === undefined;\n\n while (low < high) {\n var mid = nativeFloor((low + high) / 2),\n computed = iteratee(array[mid]),\n isDef = computed !== undefined,\n isReflexive = computed === computed;\n\n if (valIsNaN) {\n var setLow = isReflexive || retHighest;\n } else if (valIsNull) {\n setLow = isReflexive && isDef && (retHighest || computed != null);\n } else if (valIsUndef) {\n setLow = isReflexive && (retHighest || isDef);\n } else if (computed == null) {\n setLow = false;\n } else {\n setLow = retHighest ? (computed <= value) : (computed < value);\n }\n if (setLow) {\n low = mid + 1;\n } else {\n high = mid;\n }\n }\n return nativeMin(high, MAX_ARRAY_INDEX);\n}\n\nmodule.exports = binaryIndexBy;\n","var identity = require('../utility/identity');\n\n/**\n * A specialized version of `baseCallback` which only supports `this` binding\n * and specifying the number of arguments to provide to `func`.\n *\n * @private\n * @param {Function} func The function to bind.\n * @param {*} thisArg The `this` binding of `func`.\n * @param {number} [argCount] The number of arguments to provide to `func`.\n * @returns {Function} Returns the callback.\n */\nfunction bindCallback(func, thisArg, argCount) {\n if (typeof func != 'function') {\n return identity;\n }\n if (thisArg === undefined) {\n return func;\n }\n switch (argCount) {\n case 1: return function(value) {\n return func.call(thisArg, value);\n };\n case 3: return function(value, index, collection) {\n return func.call(thisArg, value, index, collection);\n };\n case 4: return function(accumulator, value, index, collection) {\n return func.call(thisArg, accumulator, value, index, collection);\n };\n case 5: return function(value, other, key, object, source) {\n return func.call(thisArg, value, other, key, object, source);\n };\n }\n return function() {\n return func.apply(thisArg, arguments);\n };\n}\n\nmodule.exports = bindCallback;\n","var bindCallback = require('./bindCallback'),\n isIterateeCall = require('./isIterateeCall'),\n restParam = require('../function/restParam');\n\n/**\n * Creates a `_.assign`, `_.defaults`, or `_.merge` function.\n *\n * @private\n * @param {Function} assigner The function to assign values.\n * @returns {Function} Returns the new assigner function.\n */\nfunction createAssigner(assigner) {\n return restParam(function(object, sources) {\n var index = -1,\n length = object == null ? 0 : sources.length,\n customizer = length > 2 ? sources[length - 2] : undefined,\n guard = length > 2 ? sources[2] : undefined,\n thisArg = length > 1 ? sources[length - 1] : undefined;\n\n if (typeof customizer == 'function') {\n customizer = bindCallback(customizer, thisArg, 5);\n length -= 2;\n } else {\n customizer = typeof thisArg == 'function' ? thisArg : undefined;\n length -= (customizer ? 1 : 0);\n }\n if (guard && isIterateeCall(sources[0], sources[1], guard)) {\n customizer = length < 3 ? undefined : customizer;\n length = 1;\n }\n while (++index < length) {\n var source = sources[index];\n if (source) {\n assigner(object, source, customizer);\n }\n }\n return object;\n });\n}\n\nmodule.exports = createAssigner;\n","var getLength = require('./getLength'),\n isLength = require('./isLength'),\n toObject = require('./toObject');\n\n/**\n * Creates a `baseEach` or `baseEachRight` function.\n *\n * @private\n * @param {Function} eachFunc The function to iterate over a collection.\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new base function.\n */\nfunction createBaseEach(eachFunc, fromRight) {\n return function(collection, iteratee) {\n var length = collection ? getLength(collection) : 0;\n if (!isLength(length)) {\n return eachFunc(collection, iteratee);\n }\n var index = fromRight ? length : -1,\n iterable = toObject(collection);\n\n while ((fromRight ? index-- : ++index < length)) {\n if (iteratee(iterable[index], index, iterable) === false) {\n break;\n }\n }\n return collection;\n };\n}\n\nmodule.exports = createBaseEach;\n","var toObject = require('./toObject');\n\n/**\n * Creates a base function for `_.forIn` or `_.forInRight`.\n *\n * @private\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new base function.\n */\nfunction createBaseFor(fromRight) {\n return function(object, iteratee, keysFunc) {\n var iterable = toObject(object),\n props = keysFunc(object),\n length = props.length,\n index = fromRight ? length : -1;\n\n while ((fromRight ? index-- : ++index < length)) {\n var key = props[index];\n if (iteratee(iterable[key], key, iterable) === false) {\n break;\n }\n }\n return object;\n };\n}\n\nmodule.exports = createBaseFor;\n","var baseCallback = require('./baseCallback'),\n baseFind = require('./baseFind'),\n baseFindIndex = require('./baseFindIndex'),\n isArray = require('../lang/isArray');\n\n/**\n * Creates a `_.find` or `_.findLast` function.\n *\n * @private\n * @param {Function} eachFunc The function to iterate over a collection.\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new find function.\n */\nfunction createFind(eachFunc, fromRight) {\n return function(collection, predicate, thisArg) {\n predicate = baseCallback(predicate, thisArg, 3);\n if (isArray(collection)) {\n var index = baseFindIndex(collection, predicate, fromRight);\n return index > -1 ? collection[index] : undefined;\n }\n return baseFind(collection, predicate, eachFunc);\n };\n}\n\nmodule.exports = createFind;\n","var bindCallback = require('./bindCallback'),\n isArray = require('../lang/isArray');\n\n/**\n * Creates a function for `_.forEach` or `_.forEachRight`.\n *\n * @private\n * @param {Function} arrayFunc The function to iterate over an array.\n * @param {Function} eachFunc The function to iterate over a collection.\n * @returns {Function} Returns the new each function.\n */\nfunction createForEach(arrayFunc, eachFunc) {\n return function(collection, iteratee, thisArg) {\n return (typeof iteratee == 'function' && thisArg === undefined && isArray(collection))\n ? arrayFunc(collection, iteratee)\n : eachFunc(collection, bindCallback(iteratee, thisArg, 3));\n };\n}\n\nmodule.exports = createForEach;\n","var arraySome = require('./arraySome');\n\n/**\n * A specialized version of `baseIsEqualDeep` for arrays with support for\n * partial deep comparisons.\n *\n * @private\n * @param {Array} array The array to compare.\n * @param {Array} other The other array to compare.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Function} [customizer] The function to customize comparing arrays.\n * @param {boolean} [isLoose] Specify performing partial comparisons.\n * @param {Array} [stackA] Tracks traversed `value` objects.\n * @param {Array} [stackB] Tracks traversed `other` objects.\n * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.\n */\nfunction equalArrays(array, other, equalFunc, customizer, isLoose, stackA, stackB) {\n var index = -1,\n arrLength = array.length,\n othLength = other.length;\n\n if (arrLength != othLength && !(isLoose && othLength > arrLength)) {\n return false;\n }\n // Ignore non-index properties.\n while (++index < arrLength) {\n var arrValue = array[index],\n othValue = other[index],\n result = customizer ? customizer(isLoose ? othValue : arrValue, isLoose ? arrValue : othValue, index) : undefined;\n\n if (result !== undefined) {\n if (result) {\n continue;\n }\n return false;\n }\n // Recursively compare arrays (susceptible to call stack limits).\n if (isLoose) {\n if (!arraySome(other, function(othValue) {\n return arrValue === othValue || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB);\n })) {\n return false;\n }\n } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB))) {\n return false;\n }\n }\n return true;\n}\n\nmodule.exports = equalArrays;\n","/** `Object#toString` result references. */\nvar boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n errorTag = '[object Error]',\n numberTag = '[object Number]',\n regexpTag = '[object RegExp]',\n stringTag = '[object String]';\n\n/**\n * A specialized version of `baseIsEqualDeep` for comparing objects of\n * the same `toStringTag`.\n *\n * **Note:** This function only supports comparing values with tags of\n * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {string} tag The `toStringTag` of the objects to compare.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\nfunction equalByTag(object, other, tag) {\n switch (tag) {\n case boolTag:\n case dateTag:\n // Coerce dates and booleans to numbers, dates to milliseconds and booleans\n // to `1` or `0` treating invalid dates coerced to `NaN` as not equal.\n return +object == +other;\n\n case errorTag:\n return object.name == other.name && object.message == other.message;\n\n case numberTag:\n // Treat `NaN` vs. `NaN` as equal.\n return (object != +object)\n ? other != +other\n : object == +other;\n\n case regexpTag:\n case stringTag:\n // Coerce regexes to strings and treat strings primitives and string\n // objects as equal. See https://es5.github.io/#x15.10.6.4 for more details.\n return object == (other + '');\n }\n return false;\n}\n\nmodule.exports = equalByTag;\n","var keys = require('../object/keys');\n\n/** Used for native method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * A specialized version of `baseIsEqualDeep` for objects with support for\n * partial deep comparisons.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Function} [customizer] The function to customize comparing values.\n * @param {boolean} [isLoose] Specify performing partial comparisons.\n * @param {Array} [stackA] Tracks traversed `value` objects.\n * @param {Array} [stackB] Tracks traversed `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\nfunction equalObjects(object, other, equalFunc, customizer, isLoose, stackA, stackB) {\n var objProps = keys(object),\n objLength = objProps.length,\n othProps = keys(other),\n othLength = othProps.length;\n\n if (objLength != othLength && !isLoose) {\n return false;\n }\n var index = objLength;\n while (index--) {\n var key = objProps[index];\n if (!(isLoose ? key in other : hasOwnProperty.call(other, key))) {\n return false;\n }\n }\n var skipCtor = isLoose;\n while (++index < objLength) {\n key = objProps[index];\n var objValue = object[key],\n othValue = other[key],\n result = customizer ? customizer(isLoose ? othValue : objValue, isLoose? objValue : othValue, key) : undefined;\n\n // Recursively compare objects (susceptible to call stack limits).\n if (!(result === undefined ? equalFunc(objValue, othValue, customizer, isLoose, stackA, stackB) : result)) {\n return false;\n }\n skipCtor || (skipCtor = key == 'constructor');\n }\n if (!skipCtor) {\n var objCtor = object.constructor,\n othCtor = other.constructor;\n\n // Non `Object` object instances with different constructors are not equal.\n if (objCtor != othCtor &&\n ('constructor' in object && 'constructor' in other) &&\n !(typeof objCtor == 'function' && objCtor instanceof objCtor &&\n typeof othCtor == 'function' && othCtor instanceof othCtor)) {\n return false;\n }\n }\n return true;\n}\n\nmodule.exports = equalObjects;\n","var baseProperty = require('./baseProperty');\n\n/**\n * Gets the \"length\" property value of `object`.\n *\n * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792)\n * that affects Safari on at least iOS 8.1-8.3 ARM64.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {*} Returns the \"length\" value.\n */\nvar getLength = baseProperty('length');\n\nmodule.exports = getLength;\n","var isStrictComparable = require('./isStrictComparable'),\n pairs = require('../object/pairs');\n\n/**\n * Gets the propery names, values, and compare flags of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the match data of `object`.\n */\nfunction getMatchData(object) {\n var result = pairs(object),\n length = result.length;\n\n while (length--) {\n result[length][2] = isStrictComparable(result[length][1]);\n }\n return result;\n}\n\nmodule.exports = getMatchData;\n","var isNative = require('../lang/isNative');\n\n/**\n * Gets the native function at `key` of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the method to get.\n * @returns {*} Returns the function if it's native, else `undefined`.\n */\nfunction getNative(object, key) {\n var value = object == null ? undefined : object[key];\n return isNative(value) ? value : undefined;\n}\n\nmodule.exports = getNative;\n","/**\n * Gets the index at which the first occurrence of `NaN` is found in `array`.\n *\n * @private\n * @param {Array} array The array to search.\n * @param {number} fromIndex The index to search from.\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {number} Returns the index of the matched `NaN`, else `-1`.\n */\nfunction indexOfNaN(array, fromIndex, fromRight) {\n var length = array.length,\n index = fromIndex + (fromRight ? 0 : -1);\n\n while ((fromRight ? index-- : ++index < length)) {\n var other = array[index];\n if (other !== other) {\n return index;\n }\n }\n return -1;\n}\n\nmodule.exports = indexOfNaN;\n","var getLength = require('./getLength'),\n isLength = require('./isLength');\n\n/**\n * Checks if `value` is array-like.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n */\nfunction isArrayLike(value) {\n return value != null && isLength(getLength(value));\n}\n\nmodule.exports = isArrayLike;\n","/** Used to detect unsigned integer values. */\nvar reIsUint = /^\\d+$/;\n\n/**\n * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer)\n * of an array-like value.\n */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/**\n * Checks if `value` is a valid array-like index.\n *\n * @private\n * @param {*} value The value to check.\n * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n */\nfunction isIndex(value, length) {\n value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1;\n length = length == null ? MAX_SAFE_INTEGER : length;\n return value > -1 && value % 1 == 0 && value < length;\n}\n\nmodule.exports = isIndex;\n","var isArrayLike = require('./isArrayLike'),\n isIndex = require('./isIndex'),\n isObject = require('../lang/isObject');\n\n/**\n * Checks if the provided arguments are from an iteratee call.\n *\n * @private\n * @param {*} value The potential iteratee value argument.\n * @param {*} index The potential iteratee index or key argument.\n * @param {*} object The potential iteratee object argument.\n * @returns {boolean} Returns `true` if the arguments are from an iteratee call, else `false`.\n */\nfunction isIterateeCall(value, index, object) {\n if (!isObject(object)) {\n return false;\n }\n var type = typeof index;\n if (type == 'number'\n ? (isArrayLike(object) && isIndex(index, object.length))\n : (type == 'string' && index in object)) {\n var other = object[index];\n return value === value ? (value === other) : (other !== other);\n }\n return false;\n}\n\nmodule.exports = isIterateeCall;\n","var isArray = require('../lang/isArray'),\n toObject = require('./toObject');\n\n/** Used to match property names within property paths. */\nvar reIsDeepProp = /\\.|\\[(?:[^[\\]]*|([\"'])(?:(?!\\1)[^\\n\\\\]|\\\\.)*?\\1)\\]/,\n reIsPlainProp = /^\\w*$/;\n\n/**\n * Checks if `value` is a property name and not a property path.\n *\n * @private\n * @param {*} value The value to check.\n * @param {Object} [object] The object to query keys on.\n * @returns {boolean} Returns `true` if `value` is a property name, else `false`.\n */\nfunction isKey(value, object) {\n var type = typeof value;\n if ((type == 'string' && reIsPlainProp.test(value)) || type == 'number') {\n return true;\n }\n if (isArray(value)) {\n return false;\n }\n var result = !reIsDeepProp.test(value);\n return result || (object != null && value in toObject(object));\n}\n\nmodule.exports = isKey;\n","/**\n * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer)\n * of an array-like value.\n */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n */\nfunction isLength(value) {\n return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n}\n\nmodule.exports = isLength;\n","/**\n * Checks if `value` is object-like.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n */\nfunction isObjectLike(value) {\n return !!value && typeof value == 'object';\n}\n\nmodule.exports = isObjectLike;\n","var isObject = require('../lang/isObject');\n\n/**\n * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` if suitable for strict\n * equality comparisons, else `false`.\n */\nfunction isStrictComparable(value) {\n return value === value && !isObject(value);\n}\n\nmodule.exports = isStrictComparable;\n","var isArguments = require('../lang/isArguments'),\n isArray = require('../lang/isArray'),\n isIndex = require('./isIndex'),\n isLength = require('./isLength'),\n keysIn = require('../object/keysIn');\n\n/** Used for native method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * A fallback implementation of `Object.keys` which creates an array of the\n * own enumerable property names of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction shimKeys(object) {\n var props = keysIn(object),\n propsLength = props.length,\n length = propsLength && object.length;\n\n var allowIndexes = !!length && isLength(length) &&\n (isArray(object) || isArguments(object));\n\n var index = -1,\n result = [];\n\n while (++index < propsLength) {\n var key = props[index];\n if ((allowIndexes && isIndex(key, length)) || hasOwnProperty.call(object, key)) {\n result.push(key);\n }\n }\n return result;\n}\n\nmodule.exports = shimKeys;\n","var isObject = require('../lang/isObject');\n\n/**\n * Converts `value` to an object if it's not one.\n *\n * @private\n * @param {*} value The value to process.\n * @returns {Object} Returns the object.\n */\nfunction toObject(value) {\n return isObject(value) ? value : Object(value);\n}\n\nmodule.exports = toObject;\n","var baseToString = require('./baseToString'),\n isArray = require('../lang/isArray');\n\n/** Used to match property names within property paths. */\nvar rePropName = /[^.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|([\"'])((?:(?!\\2)[^\\n\\\\]|\\\\.)*?)\\2)\\]/g;\n\n/** Used to match backslashes in property paths. */\nvar reEscapeChar = /\\\\(\\\\)?/g;\n\n/**\n * Converts `value` to property path array if it's not one.\n *\n * @private\n * @param {*} value The value to process.\n * @returns {Array} Returns the property path array.\n */\nfunction toPath(value) {\n if (isArray(value)) {\n return value;\n }\n var result = [];\n baseToString(value).replace(rePropName, function(match, number, quote, string) {\n result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));\n });\n return result;\n}\n\nmodule.exports = toPath;\n","var isArrayLike = require('../internal/isArrayLike'),\n isObjectLike = require('../internal/isObjectLike');\n\n/** Used for native method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Native method references. */\nvar propertyIsEnumerable = objectProto.propertyIsEnumerable;\n\n/**\n * Checks if `value` is classified as an `arguments` object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isArguments(function() { return arguments; }());\n * // => true\n *\n * _.isArguments([1, 2, 3]);\n * // => false\n */\nfunction isArguments(value) {\n return isObjectLike(value) && isArrayLike(value) &&\n hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee');\n}\n\nmodule.exports = isArguments;\n","var getNative = require('../internal/getNative'),\n isLength = require('../internal/isLength'),\n isObjectLike = require('../internal/isObjectLike');\n\n/** `Object#toString` result references. */\nvar arrayTag = '[object Array]';\n\n/** Used for native method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objToString = objectProto.toString;\n\n/* Native method references for those with the same name as other `lodash` methods. */\nvar nativeIsArray = getNative(Array, 'isArray');\n\n/**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(function() { return arguments; }());\n * // => false\n */\nvar isArray = nativeIsArray || function(value) {\n return isObjectLike(value) && isLength(value.length) && objToString.call(value) == arrayTag;\n};\n\nmodule.exports = isArray;\n","var isObject = require('./isObject');\n\n/** `Object#toString` result references. */\nvar funcTag = '[object Function]';\n\n/** Used for native method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objToString = objectProto.toString;\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in older versions of Chrome and Safari which return 'function' for regexes\n // and Safari 8 equivalents which return 'object' for typed array constructors.\n return isObject(value) && objToString.call(value) == funcTag;\n}\n\nmodule.exports = isFunction;\n","var isFunction = require('./isFunction'),\n isObjectLike = require('../internal/isObjectLike');\n\n/** Used to detect host constructors (Safari > 5). */\nvar reIsHostCtor = /^\\[object .+?Constructor\\]$/;\n\n/** Used for native method references. */\nvar objectProto = Object.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar fnToString = Function.prototype.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Used to detect if a method is native. */\nvar reIsNative = RegExp('^' +\n fnToString.call(hasOwnProperty).replace(/[\\\\^$.*+?()[\\]{}|]/g, '\\\\$&')\n .replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g, '$1.*?') + '$'\n);\n\n/**\n * Checks if `value` is a native function.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a native function, else `false`.\n * @example\n *\n * _.isNative(Array.prototype.push);\n * // => true\n *\n * _.isNative(_);\n * // => false\n */\nfunction isNative(value) {\n if (value == null) {\n return false;\n }\n if (isFunction(value)) {\n return reIsNative.test(fnToString.call(value));\n }\n return isObjectLike(value) && reIsHostCtor.test(value);\n}\n\nmodule.exports = isNative;\n","/**\n * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.\n * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(1);\n * // => false\n */\nfunction isObject(value) {\n // Avoid a V8 JIT bug in Chrome 19-20.\n // See https://code.google.com/p/v8/issues/detail?id=2291 for more details.\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n}\n\nmodule.exports = isObject;\n","var isObjectLike = require('../internal/isObjectLike');\n\n/** `Object#toString` result references. */\nvar stringTag = '[object String]';\n\n/** Used for native method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objToString = objectProto.toString;\n\n/**\n * Checks if `value` is classified as a `String` primitive or object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isString('abc');\n * // => true\n *\n * _.isString(1);\n * // => false\n */\nfunction isString(value) {\n return typeof value == 'string' || (isObjectLike(value) && objToString.call(value) == stringTag);\n}\n\nmodule.exports = isString;\n","var isLength = require('../internal/isLength'),\n isObjectLike = require('../internal/isObjectLike');\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n arrayTag = '[object Array]',\n boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n errorTag = '[object Error]',\n funcTag = '[object Function]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n objectTag = '[object Object]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n weakMapTag = '[object WeakMap]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n float32Tag = '[object Float32Array]',\n float64Tag = '[object Float64Array]',\n int8Tag = '[object Int8Array]',\n int16Tag = '[object Int16Array]',\n int32Tag = '[object Int32Array]',\n uint8Tag = '[object Uint8Array]',\n uint8ClampedTag = '[object Uint8ClampedArray]',\n uint16Tag = '[object Uint16Array]',\n uint32Tag = '[object Uint32Array]';\n\n/** Used to identify `toStringTag` values of typed arrays. */\nvar typedArrayTags = {};\ntypedArrayTags[float32Tag] = typedArrayTags[float64Tag] =\ntypedArrayTags[int8Tag] = typedArrayTags[int16Tag] =\ntypedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =\ntypedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =\ntypedArrayTags[uint32Tag] = true;\ntypedArrayTags[argsTag] = typedArrayTags[arrayTag] =\ntypedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =\ntypedArrayTags[dateTag] = typedArrayTags[errorTag] =\ntypedArrayTags[funcTag] = typedArrayTags[mapTag] =\ntypedArrayTags[numberTag] = typedArrayTags[objectTag] =\ntypedArrayTags[regexpTag] = typedArrayTags[setTag] =\ntypedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;\n\n/** Used for native method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objToString = objectProto.toString;\n\n/**\n * Checks if `value` is classified as a typed array.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isTypedArray(new Uint8Array);\n * // => true\n *\n * _.isTypedArray([]);\n * // => false\n */\nfunction isTypedArray(value) {\n return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[objToString.call(value)];\n}\n\nmodule.exports = isTypedArray;\n","var assignWith = require('../internal/assignWith'),\n baseAssign = require('../internal/baseAssign'),\n createAssigner = require('../internal/createAssigner');\n\n/**\n * Assigns own enumerable properties of source object(s) to the destination\n * object. Subsequent sources overwrite property assignments of previous sources.\n * If `customizer` is provided it is invoked to produce the assigned values.\n * The `customizer` is bound to `thisArg` and invoked with five arguments:\n * (objectValue, sourceValue, key, object, source).\n *\n * **Note:** This method mutates `object` and is based on\n * [`Object.assign`](http://ecma-international.org/ecma-262/6.0/#sec-object.assign).\n *\n * @static\n * @memberOf _\n * @alias extend\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} [sources] The source objects.\n * @param {Function} [customizer] The function to customize assigned values.\n * @param {*} [thisArg] The `this` binding of `customizer`.\n * @returns {Object} Returns `object`.\n * @example\n *\n * _.assign({ 'user': 'barney' }, { 'age': 40 }, { 'user': 'fred' });\n * // => { 'user': 'fred', 'age': 40 }\n *\n * // using a customizer callback\n * var defaults = _.partialRight(_.assign, function(value, other) {\n * return _.isUndefined(value) ? other : value;\n * });\n *\n * defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred' });\n * // => { 'user': 'barney', 'age': 36 }\n */\nvar assign = createAssigner(function(object, source, customizer) {\n return customizer\n ? assignWith(object, source, customizer)\n : baseAssign(object, source);\n});\n\nmodule.exports = assign;\n","var getNative = require('../internal/getNative'),\n isArrayLike = require('../internal/isArrayLike'),\n isObject = require('../lang/isObject'),\n shimKeys = require('../internal/shimKeys');\n\n/* Native method references for those with the same name as other `lodash` methods. */\nvar nativeKeys = getNative(Object, 'keys');\n\n/**\n * Creates an array of the own enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects. See the\n * [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys)\n * for more details.\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keys(new Foo);\n * // => ['a', 'b'] (iteration order is not guaranteed)\n *\n * _.keys('hi');\n * // => ['0', '1']\n */\nvar keys = !nativeKeys ? shimKeys : function(object) {\n var Ctor = object == null ? undefined : object.constructor;\n if ((typeof Ctor == 'function' && Ctor.prototype === object) ||\n (typeof object != 'function' && isArrayLike(object))) {\n return shimKeys(object);\n }\n return isObject(object) ? nativeKeys(object) : [];\n};\n\nmodule.exports = keys;\n","var isArguments = require('../lang/isArguments'),\n isArray = require('../lang/isArray'),\n isIndex = require('../internal/isIndex'),\n isLength = require('../internal/isLength'),\n isObject = require('../lang/isObject');\n\n/** Used for native method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Creates an array of the own and inherited enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects.\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keysIn(new Foo);\n * // => ['a', 'b', 'c'] (iteration order is not guaranteed)\n */\nfunction keysIn(object) {\n if (object == null) {\n return [];\n }\n if (!isObject(object)) {\n object = Object(object);\n }\n var length = object.length;\n length = (length && isLength(length) &&\n (isArray(object) || isArguments(object)) && length) || 0;\n\n var Ctor = object.constructor,\n index = -1,\n isProto = typeof Ctor == 'function' && Ctor.prototype === object,\n result = Array(length),\n skipIndexes = length > 0;\n\n while (++index < length) {\n result[index] = (index + '');\n }\n for (var key in object) {\n if (!(skipIndexes && isIndex(key, length)) &&\n !(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {\n result.push(key);\n }\n }\n return result;\n}\n\nmodule.exports = keysIn;\n","var keys = require('./keys'),\n toObject = require('../internal/toObject');\n\n/**\n * Creates a two dimensional array of the key-value pairs for `object`,\n * e.g. `[[key1, value1], [key2, value2]]`.\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the new array of key-value pairs.\n * @example\n *\n * _.pairs({ 'barney': 36, 'fred': 40 });\n * // => [['barney', 36], ['fred', 40]] (iteration order is not guaranteed)\n */\nfunction pairs(object) {\n object = toObject(object);\n\n var index = -1,\n props = keys(object),\n length = props.length,\n result = Array(length);\n\n while (++index < length) {\n var key = props[index];\n result[index] = [key, object[key]];\n }\n return result;\n}\n\nmodule.exports = pairs;\n","var baseValues = require('../internal/baseValues'),\n keys = require('./keys');\n\n/**\n * Creates an array of the own enumerable property values of `object`.\n *\n * **Note:** Non-object values are coerced to objects.\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property values.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.values(new Foo);\n * // => [1, 2] (iteration order is not guaranteed)\n *\n * _.values('hi');\n * // => ['h', 'i']\n */\nfunction values(object) {\n return baseValues(object, keys(object));\n}\n\nmodule.exports = values;\n","/**\n * This method returns the first argument provided to it.\n *\n * @static\n * @memberOf _\n * @category Utility\n * @param {*} value Any value.\n * @returns {*} Returns `value`.\n * @example\n *\n * var object = { 'user': 'fred' };\n *\n * _.identity(object) === object;\n * // => true\n */\nfunction identity(value) {\n return value;\n}\n\nmodule.exports = identity;\n","var baseProperty = require('../internal/baseProperty'),\n basePropertyDeep = require('../internal/basePropertyDeep'),\n isKey = require('../internal/isKey');\n\n/**\n * Creates a function that returns the property value at `path` on a\n * given object.\n *\n * @static\n * @memberOf _\n * @category Utility\n * @param {Array|string} path The path of the property to get.\n * @returns {Function} Returns the new function.\n * @example\n *\n * var objects = [\n * { 'a': { 'b': { 'c': 2 } } },\n * { 'a': { 'b': { 'c': 1 } } }\n * ];\n *\n * _.map(objects, _.property('a.b.c'));\n * // => [2, 1]\n *\n * _.pluck(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c');\n * // => [1, 2]\n */\nfunction property(path) {\n return isKey(path) ? baseProperty(path) : basePropertyDeep(path);\n}\n\nmodule.exports = property;\n","import Ember from 'ember';\nimport DS from 'ember-data';\nimport FirebaseAdapter from '../../addon/adapters/firebase';\nimport FirebaseSerializer from '../../addon/serializers/firebase';\nimport EmberFireInitializer from '../../addon/initializers/emberfire';\n\nDS.FirebaseAdapter = FirebaseAdapter;\nDS.FirebaseSerializer = FirebaseSerializer;\n\nEmber.onLoad('Ember.Application', function(Application) {\n Application.initializer(EmberFireInitializer);\n});\n"]} \ No newline at end of file diff --git a/dist/emberfire.min.js b/dist/emberfire.min.js new file mode 100644 index 00000000..56142a7a --- /dev/null +++ b/dist/emberfire.min.js @@ -0,0 +1,21 @@ +/*! + * EmberFire is the officially supported adapter for using Firebase with + * Ember Data. The DS.FirebaseAdapter provides all of the standard DS.Adapter + * methods and will automatically synchronize the store with Firebase. + * + * EmberFire 1.6.6 + * https://github.com/firebase/emberfire/ + * License: MIT + */ + + /** + * @license + * lodash 3.10.0 (Custom Build) + * Build: `lodash modularize modern exports="es" -o ./` + * Copyright 2012-2015 The Dojo Foundation + * Based on Underscore.js 1.8.3 + * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ +!function e(t,r,n){function i(o,u){if(!r[o]){if(!t[o]){var l="function"==typeof require&&require;if(!u&&l)return l(o,!0);if(a)return a(o,!0);var s=new Error("Cannot find module '"+o+"'");throw s.code="MODULE_NOT_FOUND",s}var c=r[o]={exports:{}};t[o][0].call(c.exports,function(e){var r=t[o][1][e];return i(r?r:e)},c,c.exports,e,t,r,n)}return r[o].exports}for(var a="function"==typeof require&&require,o=0;o "+r.type);throw i.errors=o["default"].A(t).mapBy("reason"),i})},_saveHasManyRecord:function(e,t,r,n,i){var a=e.serializerFor(t.modelName),o=this._getRelationshipRef(n,a.keyForRelationship(r.key),i),u=e.peekRecord(r.type,i),l=this.isRelationshipEmbedded(e,t.modelName,r);return l?u.save():d["default"](o.set,o,[!0])},isRelationshipEmbedded:function(e,t,r){var n=e.serializerFor(t);return n.hasDeserializeRecordsOption(r.key)},isRecordEmbedded:function(e){e._internalModel&&(e=e._internalModel);var t=this.getFirstEmbeddingParent(e);return!!t},_removeHasManyRecord:function(e,t,r,n){var i=this._getRelationshipRef(t,r,n);return d["default"](i.remove,i,[],i.toString())},_saveEmbeddedBelongsToRecord:function(e,t,r,n,i){var a=e.peekRecord(r.type,n);return a?a.save():o["default"].RSVP.Promise.reject(new Error("Unable to find record with id "+n+" from embedded relationship: "+JSON.stringify(r)))},deleteRecord:function(e,t,r){var n=this._getAbsoluteRef(r.record);return n.off("value"),d["default"](n.remove,n)},pathForType:function(e){var t=o["default"].String.camelize(e);return o["default"].String.pluralize(t)},_getCollectionRef:function(e,t){var r=this._ref;return e&&(r=r.child(this.pathForType(e.modelName))),t&&(r=r.child(t)),r},_getAbsoluteRef:function(e){e._internalModel&&(e=e._internalModel);var t=this.getFirstEmbeddingParent(e);if(t){var r=t.record,n=t.relationship,i=this._getAbsoluteRef(r).child(n.key);return"hasMany"===n.kind&&(i=i.child(e.id)),i}return this._getCollectionRef(e.type,e.id)},getFirstEmbeddingParent:function(e){var t=this,r=x["default"](e._implicitRelationships,function(e){var r=e.members.toArray(),n=r[0];if(!n)return!1;var i=n._relationships.get(e.inverseKey);return t.isRelationshipEmbedded(t.store,n.type.modelName,i.relationshipMeta)});if(r){var n=r.members.toArray()[0],i=r.inverseKey,a=n._relationships.get(i).relationshipMeta;return{record:n,relationship:a}}},_getRelationshipRef:function(e,t,r){return e.child(t).child(r)},_queueFlushDelay:1e3/60,_queueScheduleFlush:function(){o["default"].run.later(this,this._queueFlush,this._queueFlushDelay)},_queueFlush:function(){h["default"](this._queue,function(e){var t=e[0],r=e[1];t.apply(null,r)}),this._queue.length=0},_enqueue:function(e,t){if(this._queueFlushDelay){var r=this._queue.push([e,t]);1===r&&this._queueScheduleFlush()}else e.apply(null,t)},_recordCacheForType:void 0,_updateRecordCacheForType:function(e,t){if(t){var r=t.id,n=this._getRecordCache(e,r);e.eachRelationship(function(e,r){if("hasMany"===r.kind){var i=t[e];n[e]=o["default"].isNone(i)?o["default"].A():o["default"].A(Object.keys(i))}})}},_getRecordCache:function(e,t){var r=e.modelName,n=this._recordCacheForType;return n[r]=n[r]||{},n[r][t]=n[r][t]||{},n[r][t]},_getKey:function(e){return"function"==typeof e.key?e.key():e.name()},shouldBackgroundReloadRecord:function(){return!1}}),t.exports=r["default"]}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../mixins/waitable":3,"../utils/to-promise":5,"lodash/array/indexOf":6,"lodash/collection/filter":8,"lodash/collection/find":9,"lodash/collection/forEach":10,"lodash/collection/includes":11,"lodash/collection/map":12}],2:[function(e,t,r){(function(n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(r,"__esModule",{value:!0});var a="undefined"!=typeof window?window.Ember:"undefined"!=typeof n?n.Ember:null,o=i(a),u="undefined"!=typeof window?window.DS:"undefined"!=typeof n?n.DS:null,l=i(u),s="undefined"!=typeof window?window.Firebase:"undefined"!=typeof n?n.Firebase:null,c=i(s),f=e("../adapters/firebase"),d=i(f),p=e("../serializers/firebase"),h=i(p),y=e("lodash/collection/forEach"),b=i(y),v="1.6.6";o["default"].libraries&&(c["default"].SDK_VERSION&&o["default"].libraries.registerCoreLibrary("Firebase",c["default"].SDK_VERSION),o["default"].libraries.registerCoreLibrary("EmberFire",v)),r["default"]={name:"emberfire",before:"ember-data",initialize:function(){var e=arguments[1]||arguments[0];e.register("adapter:-firebase",d["default"]),e.register("serializer:-firebase",h["default"]),l["default"].Store.prototype._emberfirePatched||l["default"].Store.reopen({_emberfirePatched:!0,push:function(){var e=this,t=this._super.apply(this,arguments),r=t;return o["default"].isArray(t)||(r=[t]),b["default"](r,function(t){var r=t.constructor.modelName,n=e.adapterFor(r);n.recordWasPushed&&n.recordWasPushed(e,r,t)}),t},recordWillUnload:function(e){var t=this.adapterFor(e.constructor.modelName);t.recordWillUnload&&t.recordWillUnload(this,e)},recordWillDelete:function(e){var t=this.adapterFor(e.constructor.modelName);t.recordWillDelete&&t.recordWillDelete(this,e)}}),l["default"].Model.prototype._emberfirePatched||l["default"].Model.reopen({_emberfirePatched:!0,unloadRecord:function(){return this.store.recordWillUnload(this),this._super()},deleteRecord:function(){this.store.recordWillDelete(this),this._super()},ref:function(){var e=this.store.adapterFor(this.constructor.modelName);return e._getAbsoluteRef?e._getAbsoluteRef(this):void 0}}),l["default"].AdapterPopulatedRecordArray.prototype._emberfirePatched||l["default"].AdapterPopulatedRecordArray.reopen({_emberfirePatched:!0,willDestroy:function(){return this.__firebaseCleanup&&this.__firebaseCleanup(),this._super()}}),l["default"].FirebaseAdapter=d["default"],l["default"].FirebaseSerializer=h["default"]}},t.exports=r["default"]}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../adapters/firebase":1,"../serializers/firebase":4,"lodash/collection/forEach":10}],3:[function(e,t,r){(function(e){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(r,"__esModule",{value:!0});var i="undefined"!=typeof window?window.Ember:"undefined"!=typeof e?e.Ember:null,a=n(i);r["default"]=a["default"].Mixin.create({init:function(){this._super.apply(this,arguments),this._reasons=0,a["default"].testing&&this._registerWaiter()},_incrementWaiters:function(){this._reasons++},_decrementWaiters:function(){this._reasons--},_shouldWait:function(){return 0===this._reasons},_registerWaiter:function(){var e=this;this._waiter=function(){return e._shouldWait()},a["default"].Test.registerWaiter(this._waiter)}}),t.exports=r["default"]}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],4:[function(e,t,r){(function(n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(r,"__esModule",{value:!0});var a="undefined"!=typeof window?window.Ember:"undefined"!=typeof n?n.Ember:null,o=i(a),u="undefined"!=typeof window?window.DS:"undefined"!=typeof n?n.DS:null,l=i(u),s=e("lodash/object/assign"),c=i(s);r["default"]=l["default"].JSONSerializer.extend(l["default"].EmbeddedRecordsMixin,{isNewSerializerAPI:!0,extractAttributes:function(e,t){var r=this._super(e,t);return e.eachAttribute(function(e){r.hasOwnProperty(e)||(r[e]=null)}),r},extractRelationships:function(e,t){return this.normalizeRelationships(e,t),this._super(e,t)},normalizeRelationships:function(e,t){var r=this;e.eachRelationship(function(n,i){var a=r.keyForRelationship(n,i.kind,"deserialize");"hasMany"===i.kind&&(t.hasOwnProperty(a)?!function(){var u=t[a];if(r.hasDeserializeRecordsOption(n))if("object"!=typeof u||o["default"].isArray(u)){if(!o["default"].isArray(u))throw new Error(e.toString()+" relationship "+i.kind+"('"+i.type+"') must contain embedded records with an `id`. Example: { \""+n+'": { "'+i.type+'_1": { "id": "'+i.type+'_1" } } } instead got: '+JSON.stringify(t[n]));u=r._addNumericIdsToEmbeddedArray(u)}else u=Object.keys(u).map(function(e){return c["default"]({id:e},u[e])});else if("object"!=typeof u||o["default"].isArray(u)){if(!o["default"].isArray(u))throw new Error(e.toString()+" relationship "+i.kind+"('"+i.type+"') must be a key/value map. Example: { \""+n+'": { "'+i.type+'_1": true } } instead got: '+JSON.stringify(t[n]));u=r._convertBooleanArrayToIds(u)}else u=Object.keys(u);t[a]=u}():t[a]=[]),"belongsTo"===i.kind&&(t.hasOwnProperty(a)||(t[a]=null))})},_convertBooleanArrayToIds:function(e){for(var t=[],r=0;rr?o(n+r,0):r;else if(r){var u=a(e,t);return n>u&&(t===t?t===e[u]:e[u]!==e[u])?u:-1}return i(e,t,r||0)}var i=e("../internal/baseIndexOf"),a=e("../internal/binaryIndex"),o=Math.max;t.exports=n},{"../internal/baseIndexOf":29,"../internal/binaryIndex":41}],7:[function(e,t,r){function n(e){var t=e?e.length:0;return t?e[t-1]:void 0}t.exports=n},{}],8:[function(e,t,r){function n(e,t,r){var n=u(e)?i:o;return t=a(t,r,3),n(e,t)}var i=e("../internal/arrayFilter"),a=e("../internal/baseCallback"),o=e("../internal/baseFilter"),u=e("../lang/isArray");t.exports=n},{"../internal/arrayFilter":15,"../internal/baseCallback":20,"../internal/baseFilter":23,"../lang/isArray":67}],9:[function(e,t,r){var n=e("../internal/baseEach"),i=e("../internal/createFind"),a=i(n);t.exports=a},{"../internal/baseEach":22,"../internal/createFind":47}],10:[function(e,t,r){var n=e("../internal/arrayEach"),i=e("../internal/baseEach"),a=e("../internal/createForEach"),o=a(n,i);t.exports=o},{"../internal/arrayEach":14,"../internal/baseEach":22,"../internal/createForEach":48}],11:[function(e,t,r){function n(e,t,r,n){var d=e?a(e):0;return l(d)||(e=c(e),d=e.length),r="number"!=typeof r||n&&u(t,r,n)?0:0>r?f(d+r,0):r||0,"string"==typeof e||!o(e)&&s(e)?d>=r&&e.indexOf(t,r)>-1:!!d&&i(e,t,r)>-1}var i=e("../internal/baseIndexOf"),a=e("../internal/getLength"),o=e("../lang/isArray"),u=e("../internal/isIterateeCall"),l=e("../internal/isLength"),s=e("../lang/isString"),c=e("../object/values"),f=Math.max;t.exports=n},{"../internal/baseIndexOf":29,"../internal/getLength":52,"../internal/isIterateeCall":58,"../internal/isLength":60,"../lang/isArray":67,"../lang/isString":71,"../object/values":77}],12:[function(e,t,r){function n(e,t,r){var n=u(e)?i:o;return t=a(t,r,3),n(e,t)}var i=e("../internal/arrayMap"),a=e("../internal/baseCallback"),o=e("../internal/baseMap"),u=e("../lang/isArray");t.exports=n},{"../internal/arrayMap":16,"../internal/baseCallback":20,"../internal/baseMap":33,"../lang/isArray":67}],13:[function(e,t,r){function n(e,t){if("function"!=typeof e)throw new TypeError(i);return t=a(void 0===t?e.length-1:+t||0,0),function(){for(var r=arguments,n=-1,i=a(r.length-t,0),o=Array(i);++nn;)e=e[t[n++]];return n&&n==a?e:void 0}}var i=e("./toObject");t.exports=n},{"./toObject":64}],29:[function(e,t,r){function n(e,t,r){if(t!==t)return i(e,r);for(var n=r-1,a=e.length;++nt&&(t=-t>i?0:i+t),r=void 0===r||r>i?i:+r||0,0>r&&(r+=i),i=t>r?0:r-t>>>0,t>>>=0;for(var a=Array(i);++n=o){for(;o>n;){var l=n+o>>>1,s=e[l];(r?t>=s:t>s)&&null!==s?n=l+1:o=l}return o}return i(e,t,a,r)}var i=e("./binaryIndexBy"),a=e("../utility/identity"),o=4294967295,u=o>>>1;t.exports=n},{"../utility/identity":78,"./binaryIndexBy":42}],42:[function(e,t,r){function n(e,t,r,n){t=r(t);for(var o=0,l=e?e.length:0,s=t!==t,c=null===t,f=void 0===t;l>o;){var d=i((o+l)/2),p=r(e[d]),h=void 0!==p,y=p===p;if(s)var b=y||n;else b=c?y&&h&&(n||null!=p):f?y&&(n||h):null==p?!1:n?t>=p:t>p;b?o=d+1:l=d}return a(l,u)}var i=Math.floor,a=Math.min,o=4294967295,u=o-1;t.exports=n},{}],43:[function(e,t,r){function n(e,t,r){if("function"!=typeof e)return i;if(void 0===t)return e;switch(r){case 1:return function(r){return e.call(t,r)};case 3:return function(r,n,i){return e.call(t,r,n,i)};case 4:return function(r,n,i,a){return e.call(t,r,n,i,a)};case 5:return function(r,n,i,a,o){return e.call(t,r,n,i,a,o)}}return function(){return e.apply(t,arguments)}}var i=e("../utility/identity");t.exports=n},{"../utility/identity":78}],44:[function(e,t,r){function n(e){return o(function(t,r){var n=-1,o=null==t?0:r.length,u=o>2?r[o-2]:void 0,l=o>2?r[2]:void 0,s=o>1?r[o-1]:void 0;for("function"==typeof u?(u=i(u,s,5),o-=2):(u="function"==typeof s?s:void 0,o-=u?1:0),l&&a(r[0],r[1],l)&&(u=3>o?void 0:u,o=1);++n-1?r[s]:void 0}return a(r,n,e)}}var i=e("./baseCallback"),a=e("./baseFind"),o=e("./baseFindIndex"),u=e("../lang/isArray");t.exports=n},{"../lang/isArray":67,"./baseCallback":20,"./baseFind":24,"./baseFindIndex":25}],48:[function(e,t,r){function n(e,t){return function(r,n,o){return"function"==typeof n&&void 0===o&&a(r)?e(r,n):t(r,i(n,o,3))}}var i=e("./bindCallback"),a=e("../lang/isArray");t.exports=n},{"../lang/isArray":67,"./bindCallback":43}],49:[function(e,t,r){function n(e,t,r,n,a,o,u){var l=-1,s=e.length,c=t.length;if(s!=c&&!(a&&c>s))return!1;for(;++l-1&&e%1==0&&t>e}var i=/^\d+$/,a=9007199254740991;t.exports=n},{}],58:[function(e,t,r){function n(e,t,r){if(!o(r))return!1;var n=typeof t;if("number"==n?i(r)&&a(t,r.length):"string"==n&&t in r){var u=r[t];return e===e?e===u:u!==u}return!1}var i=e("./isArrayLike"),a=e("./isIndex"),o=e("../lang/isObject");t.exports=n},{"../lang/isObject":70,"./isArrayLike":56,"./isIndex":57}],59:[function(e,t,r){function n(e,t){var r=typeof e;if("string"==r&&u.test(e)||"number"==r)return!0;if(i(e))return!1;var n=!o.test(e);return n||null!=t&&e in a(t)}var i=e("../lang/isArray"),a=e("./toObject"),o=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\n\\]|\\.)*?\1)\]/,u=/^\w*$/;t.exports=n},{"../lang/isArray":67,"./toObject":64}],60:[function(e,t,r){function n(e){return"number"==typeof e&&e>-1&&e%1==0&&i>=e}var i=9007199254740991;t.exports=n},{}],61:[function(e,t,r){function n(e){return!!e&&"object"==typeof e}t.exports=n},{}],62:[function(e,t,r){function n(e){return e===e&&!i(e)}var i=e("../lang/isObject");t.exports=n},{"../lang/isObject":70}],63:[function(e,t,r){function n(e){for(var t=l(e),r=t.length,n=r&&e.length,s=!!n&&u(n)&&(a(e)||i(e)),f=-1,d=[];++f0;++n (https://www.firebase.com/)", "homepage": "https://github.com/firebase/emberfire/", "directories": {